kordoc 4.17.0 → 4.17.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 +6 -3
- package/dist/{-PRAKO6M4.js → -2UA2JHVA.js} +11 -11
- package/dist/{chunk-I5DJOP62.js → chunk-2XHXABCX.js} +2 -2
- package/dist/{chunk-4XVNQAK5.js → chunk-3N272C5L.js} +244 -115
- package/dist/chunk-3N272C5L.js.map +1 -0
- package/dist/{chunk-6RGGYQQC.js → chunk-4HRJISJF.js} +3 -3
- package/dist/{chunk-WN6OD2CQ.js → chunk-4TSYMJDL.js} +243 -114
- package/dist/chunk-4TSYMJDL.js.map +1 -0
- package/dist/{chunk-EFO6JZY6.js → chunk-5JZEY5IL.js} +119 -77
- package/dist/chunk-5JZEY5IL.js.map +1 -0
- package/dist/{chunk-WYON5ANU.cjs → chunk-6DOCSYEM.cjs} +113 -71
- package/dist/chunk-6DOCSYEM.cjs.map +1 -0
- package/dist/{chunk-BZG7K44Z.js → chunk-6OCKAXIS.js} +2 -2
- package/dist/{chunk-ZF6KHPB7.js → chunk-A2W2JQ3S.js} +11 -5
- package/dist/chunk-A2W2JQ3S.js.map +1 -0
- package/dist/{chunk-N6V7LQBL.js → chunk-C4MVZXB5.js} +2 -2
- package/dist/{chunk-4GSF2R7T.js → chunk-FGL4IGOT.js} +4 -4
- package/dist/{chunk-R2BUANHQ.cjs → chunk-GPC72VSF.cjs} +6 -6
- package/dist/chunk-GPC72VSF.cjs.map +1 -0
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-TDQ6XDB3.js → chunk-GYTL6WT3.js} +3 -3
- package/dist/{chunk-O7OUX6NU.cjs → chunk-HAW2VL62.cjs} +12 -12
- package/dist/chunk-HAW2VL62.cjs.map +1 -0
- package/dist/chunk-J55UQC5H.cjs.map +1 -1
- package/dist/{chunk-QJWVMPB6.js → chunk-JY2NBFIG.js} +15 -13
- package/dist/chunk-JY2NBFIG.js.map +1 -0
- package/dist/{chunk-A55JGNKD.js → chunk-KQIYC2ZU.js} +2 -2
- package/dist/{chunk-QNJLLF4J.cjs → chunk-KZVQK5NS.cjs} +11 -5
- package/dist/chunk-KZVQK5NS.cjs.map +1 -0
- package/dist/{chunk-PHID6WNG.js → chunk-MDCTITUG.js} +2 -2
- package/dist/{chunk-2KF5WZCR.js → chunk-O4CB7D2Q.js} +2 -2
- package/dist/{chunk-YZ5HHS6A.js → chunk-SDRKHEVT.js} +2 -2
- package/dist/{chunk-MJBCXW5R.js → chunk-UX3HHAWH.js} +1 -1
- package/dist/{chunk-MJBCXW5R.js.map → chunk-UX3HHAWH.js.map} +1 -1
- package/dist/{chunk-K2VYABZ3.js → chunk-VU26WGE5.js} +102 -38
- package/dist/chunk-VU26WGE5.js.map +1 -0
- package/dist/{chunk-BFT5IM2R.js → chunk-WJLICIYV.js} +2 -2
- package/dist/{chunk-5CDUL6PH.js → chunk-WL3BWROT.js} +1 -1
- package/dist/{chunk-5CDUL6PH.js.map → chunk-WL3BWROT.js.map} +1 -1
- package/dist/{chunk-XEPKOC2O.cjs → chunk-WWMKIHF7.cjs} +344 -215
- package/dist/chunk-WWMKIHF7.cjs.map +1 -0
- package/dist/{chunk-BLPR4HRF.js → chunk-XZA6X34R.js} +121 -77
- package/dist/chunk-XZA6X34R.js.map +1 -0
- package/dist/{chunk-ML4NHUR7.js → chunk-YGKC6E6A.js} +11 -5
- package/dist/chunk-YGKC6E6A.js.map +1 -0
- package/dist/{chunk-AKB72TEH.cjs → chunk-YIANW5QX.cjs} +1 -1
- package/dist/chunk-YIANW5QX.cjs.map +1 -0
- package/dist/{chunk-WY5JAR4O.js → chunk-ZDX5PIWR.js} +2 -2
- package/dist/chunks-EBWJR55V.js +10 -0
- package/dist/cli.js +26 -26
- package/dist/{formula-ECNOZT36.cjs → formula-5RETDCIC.cjs} +9 -9
- package/dist/formula-5RETDCIC.cjs.map +1 -0
- package/dist/{formula-7MMFBRGJ.js → formula-MBLN2DG4.js} +4 -4
- package/dist/{formula-SHBXRXOJ.js → formula-QZZDW5GW.js} +3 -3
- package/dist/{image-ocr-P6ECJCT2.js → image-ocr-CJSO3QSR.js} +8 -8
- package/dist/{image-ocr-QCT3A7X5.js → image-ocr-EREKAS47.js} +6 -6
- package/dist/{image-ocr-VUDSP2B4.cjs → image-ocr-PSPVRLB5.cjs} +15 -15
- package/dist/image-ocr-PSPVRLB5.cjs.map +1 -0
- package/dist/index.cjs +688 -622
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +106 -40
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-OUHGCEZY.js → model-bundle-MA4MMCRJ.js} +5 -5
- package/dist/{models-6D6LMOTH.js → models-SEJ7LNSN.js} +5 -5
- package/dist/page-range-QHHFTL7X.cjs.map +1 -1
- package/dist/{parser-ZPRQ3SSU.js → parser-M5WHRX25.js} +41 -23
- package/dist/parser-M5WHRX25.js.map +1 -0
- package/dist/{parser-RQ4PJRTJ.cjs → parser-QILYPWSI.cjs} +215 -197
- package/dist/parser-QILYPWSI.cjs.map +1 -0
- package/dist/{parser-CTRB7PKD.js → parser-VH3F4EQU.js} +38 -20
- package/dist/parser-VH3F4EQU.js.map +1 -0
- package/dist/pdf-ocr-3SZUM3CN.cjs +16 -0
- package/dist/pdf-ocr-3SZUM3CN.cjs.map +1 -0
- package/dist/pdf-ocr-QB2TB5W5.js +18 -0
- package/dist/pdf-ocr-XC33L43D.js +15 -0
- package/dist/{profile-io-YZUW6MAN.js → profile-io-5YB627EO.js} +3 -3
- package/dist/{rasterize-OUR2QJXX.js → rasterize-V2XHHS2I.js} +3 -3
- package/dist/{redact-doc-4OQKG4SM.js → redact-doc-5MK5L5IQ.js} +11 -11
- package/dist/{render-XNO6PZJO.js → render-SYZMHYK6.js} +7 -7
- package/dist/seal-IPKIQHYB.js +10 -0
- package/dist/{setup-UU3EIHNI.js → setup-ZPLJENSK.js} +3 -3
- package/dist/visual-RTTGNOAE.js +20 -0
- package/dist/{watch-SR6Q5SQN.js → watch-FNWHVKK3.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-4XVNQAK5.js.map +0 -1
- package/dist/chunk-AKB72TEH.cjs.map +0 -1
- package/dist/chunk-BLPR4HRF.js.map +0 -1
- package/dist/chunk-EFO6JZY6.js.map +0 -1
- package/dist/chunk-K2VYABZ3.js.map +0 -1
- package/dist/chunk-ML4NHUR7.js.map +0 -1
- package/dist/chunk-O7OUX6NU.cjs.map +0 -1
- package/dist/chunk-QJWVMPB6.js.map +0 -1
- package/dist/chunk-QNJLLF4J.cjs.map +0 -1
- package/dist/chunk-R2BUANHQ.cjs.map +0 -1
- package/dist/chunk-WN6OD2CQ.js.map +0 -1
- package/dist/chunk-WYON5ANU.cjs.map +0 -1
- package/dist/chunk-XEPKOC2O.cjs.map +0 -1
- package/dist/chunk-ZF6KHPB7.js.map +0 -1
- package/dist/chunks-YBFBLJ4G.js +0 -10
- package/dist/formula-ECNOZT36.cjs.map +0 -1
- package/dist/image-ocr-VUDSP2B4.cjs.map +0 -1
- package/dist/parser-CTRB7PKD.js.map +0 -1
- package/dist/parser-RQ4PJRTJ.cjs.map +0 -1
- package/dist/parser-ZPRQ3SSU.js.map +0 -1
- package/dist/pdf-ocr-462ZFSHX.js +0 -15
- package/dist/pdf-ocr-L35FQYGP.js +0 -18
- package/dist/pdf-ocr-STK5EQFF.cjs +0 -16
- package/dist/pdf-ocr-STK5EQFF.cjs.map +0 -1
- package/dist/seal-CJ7C44JN.js +0 -10
- package/dist/visual-QRMRFPUK.js +0 -20
- /package/dist/{-PRAKO6M4.js.map → -2UA2JHVA.js.map} +0 -0
- /package/dist/{chunk-I5DJOP62.js.map → chunk-2XHXABCX.js.map} +0 -0
- /package/dist/{chunk-6RGGYQQC.js.map → chunk-4HRJISJF.js.map} +0 -0
- /package/dist/{chunk-BZG7K44Z.js.map → chunk-6OCKAXIS.js.map} +0 -0
- /package/dist/{chunk-N6V7LQBL.js.map → chunk-C4MVZXB5.js.map} +0 -0
- /package/dist/{chunk-4GSF2R7T.js.map → chunk-FGL4IGOT.js.map} +0 -0
- /package/dist/{chunk-TDQ6XDB3.js.map → chunk-GYTL6WT3.js.map} +0 -0
- /package/dist/{chunk-A55JGNKD.js.map → chunk-KQIYC2ZU.js.map} +0 -0
- /package/dist/{chunk-PHID6WNG.js.map → chunk-MDCTITUG.js.map} +0 -0
- /package/dist/{chunk-2KF5WZCR.js.map → chunk-O4CB7D2Q.js.map} +0 -0
- /package/dist/{chunk-YZ5HHS6A.js.map → chunk-SDRKHEVT.js.map} +0 -0
- /package/dist/{chunk-BFT5IM2R.js.map → chunk-WJLICIYV.js.map} +0 -0
- /package/dist/{chunk-WY5JAR4O.js.map → chunk-ZDX5PIWR.js.map} +0 -0
- /package/dist/{chunks-YBFBLJ4G.js.map → chunks-EBWJR55V.js.map} +0 -0
- /package/dist/{formula-7MMFBRGJ.js.map → formula-MBLN2DG4.js.map} +0 -0
- /package/dist/{formula-SHBXRXOJ.js.map → formula-QZZDW5GW.js.map} +0 -0
- /package/dist/{image-ocr-P6ECJCT2.js.map → image-ocr-CJSO3QSR.js.map} +0 -0
- /package/dist/{image-ocr-QCT3A7X5.js.map → image-ocr-EREKAS47.js.map} +0 -0
- /package/dist/{model-bundle-OUHGCEZY.js.map → model-bundle-MA4MMCRJ.js.map} +0 -0
- /package/dist/{models-6D6LMOTH.js.map → models-SEJ7LNSN.js.map} +0 -0
- /package/dist/{pdf-ocr-462ZFSHX.js.map → pdf-ocr-QB2TB5W5.js.map} +0 -0
- /package/dist/{pdf-ocr-L35FQYGP.js.map → pdf-ocr-XC33L43D.js.map} +0 -0
- /package/dist/{profile-io-YZUW6MAN.js.map → profile-io-5YB627EO.js.map} +0 -0
- /package/dist/{rasterize-OUR2QJXX.js.map → rasterize-V2XHHS2I.js.map} +0 -0
- /package/dist/{redact-doc-4OQKG4SM.js.map → redact-doc-5MK5L5IQ.js.map} +0 -0
- /package/dist/{render-XNO6PZJO.js.map → render-SYZMHYK6.js.map} +0 -0
- /package/dist/{seal-CJ7C44JN.js.map → seal-IPKIQHYB.js.map} +0 -0
- /package/dist/{setup-UU3EIHNI.js.map → setup-ZPLJENSK.js.map} +0 -0
- /package/dist/{visual-QRMRFPUK.js.map → visual-RTTGNOAE.js.map} +0 -0
- /package/dist/{watch-SR6Q5SQN.js.map → watch-FNWHVKK3.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkGPC72VSFcjs = require('./chunk-GPC72VSF.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
@@ -30,7 +30,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _chunkYIANW5QXcjs = require('./chunk-YIANW5QX.cjs');
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
@@ -47,14 +47,14 @@ var _chunkAKB72TEHcjs = require('./chunk-AKB72TEH.cjs');
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var _chunkKZVQK5NScjs = require('./chunk-KZVQK5NS.cjs');
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
54
54
|
|
|
55
55
|
// src/plain-markdown.ts
|
|
56
56
|
function toPlainMarkdown(md2) {
|
|
57
|
-
return
|
|
57
|
+
return _chunkYIANW5QXcjs.plainScripts.call(void 0, md2).replace(/!\[[^\]\n]*\]\([^)\n]*\)/g, "").replace(/<img\b[^>]*>/gi, "").replace(/(?<!!)\[([^\]\n]*)\]\((?:https?|mailto|ftp):[^)\s]*\)/g, "$1").replace(/<\/?u>/g, "").replace(/(?<!\\)\*\*(?=\S)([^\n]*?\S)(?<!\\)\*\*/g, "$1").replace(/(<br>)+(?=<\/t[dh]>)/g, "").replace(/[ \t]+$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// src/html-tables.ts
|
|
@@ -571,9 +571,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
571
571
|
}
|
|
572
572
|
|
|
573
573
|
// src/hwpx/parser-shared.ts
|
|
574
|
-
var MAX_DECOMPRESS_SIZE =
|
|
574
|
+
var MAX_DECOMPRESS_SIZE = _chunkKZVQK5NScjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
575
575
|
var MAX_ZIP_ENTRIES = 500;
|
|
576
|
-
var ZipBombError = class extends
|
|
576
|
+
var ZipBombError = class extends _chunkKZVQK5NScjs.KordocError {
|
|
577
577
|
constructor(message) {
|
|
578
578
|
super(message);
|
|
579
579
|
this.name = "ZipBombError";
|
|
@@ -593,7 +593,7 @@ function createSectionShared() {
|
|
|
593
593
|
function createXmlParser(warnings) {
|
|
594
594
|
return new (0, _xmldom.DOMParser)({
|
|
595
595
|
onError(level, msg2) {
|
|
596
|
-
if (level === "fatalError") throw new (0,
|
|
596
|
+
if (level === "fatalError") throw new (0, _chunkKZVQK5NScjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
597
597
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
598
598
|
}
|
|
599
599
|
});
|
|
@@ -628,13 +628,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
628
628
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
629
629
|
const checksumType = attrOf(inner, "checksum-type");
|
|
630
630
|
if (algorithm !== AES256_CBC) {
|
|
631
|
-
throw new (0,
|
|
631
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
632
632
|
}
|
|
633
633
|
if (startKey !== START_KEY_SHA256) {
|
|
634
|
-
throw new (0,
|
|
634
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
635
635
|
}
|
|
636
636
|
if (!_optionalChain([checksumType, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(CHECKSUM_SHA256_1K)])) {
|
|
637
|
-
throw new (0,
|
|
637
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
638
638
|
}
|
|
639
639
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
640
640
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -642,10 +642,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
642
642
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
643
643
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
644
644
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
645
|
-
throw new (0,
|
|
645
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
646
646
|
}
|
|
647
647
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
648
|
-
throw new (0,
|
|
648
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
649
649
|
}
|
|
650
650
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
651
651
|
}
|
|
@@ -678,11 +678,11 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
678
678
|
for (const entry of entries) {
|
|
679
679
|
const file = zip.file(entry.path);
|
|
680
680
|
if (!file) {
|
|
681
|
-
throw new (0,
|
|
681
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
682
682
|
}
|
|
683
683
|
const plain4 = decryptEntry(await file.async("nodebuffer"), entry, startKey);
|
|
684
684
|
if (!plain4) {
|
|
685
|
-
throw new (0,
|
|
685
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
686
686
|
}
|
|
687
687
|
decrypted.push({ path: entry.path, plain: plain4 });
|
|
688
688
|
}
|
|
@@ -731,10 +731,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
731
731
|
const xml = await file.async("text");
|
|
732
732
|
if (decompressed) {
|
|
733
733
|
decompressed.total += xml.length * 2;
|
|
734
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
734
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKZVQK5NScjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
735
735
|
}
|
|
736
736
|
const parser = createXmlParser();
|
|
737
|
-
const doc = parser.parseFromString(
|
|
737
|
+
const doc = parser.parseFromString(_chunkKZVQK5NScjs.stripDtd.call(void 0, xml), "text/xml");
|
|
738
738
|
if (!doc.documentElement) continue;
|
|
739
739
|
const domDoc = doc;
|
|
740
740
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -749,6 +749,7 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
749
749
|
continue;
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
|
+
if (result.borderEdges.size > 0 && !result.borderEdges.has("0")) result.borderEdges.set("0", { t: false, b: false, l: false, r: false });
|
|
752
753
|
return result;
|
|
753
754
|
}
|
|
754
755
|
function parseCharProperties(doc, map) {
|
|
@@ -946,9 +947,9 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
946
947
|
let level = 0;
|
|
947
948
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _16 => _16.style, 'optionalAccess', _17 => _17.fontSize])) {
|
|
948
949
|
const ratio = block.style.fontSize / baseFontSize;
|
|
949
|
-
if (ratio >=
|
|
950
|
-
else if (ratio >=
|
|
951
|
-
else if (ratio >=
|
|
950
|
+
if (ratio >= _chunkYIANW5QXcjs.HEADING_RATIO_H1) level = 1;
|
|
951
|
+
else if (ratio >= _chunkYIANW5QXcjs.HEADING_RATIO_H2) level = 2;
|
|
952
|
+
else if (ratio >= _chunkYIANW5QXcjs.HEADING_RATIO_H3) level = 3;
|
|
952
953
|
}
|
|
953
954
|
const compactText = text.replace(/\s+/g, "");
|
|
954
955
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1555,7 +1556,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1555
1556
|
|
|
1556
1557
|
// src/hwpx/table-build.ts
|
|
1557
1558
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1558
|
-
const table2 =
|
|
1559
|
+
const table2 = _chunkGPC72VSFcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1559
1560
|
if (state.caption) table2.caption = state.caption;
|
|
1560
1561
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
1561
1562
|
if (_optionalChain([state, 'access', _21 => _21.captionBlocks, 'optionalAccess', _22 => _22.length])) table2.captionBlocks = state.captionBlocks;
|
|
@@ -1584,7 +1585,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1584
1585
|
for (const src of row) {
|
|
1585
1586
|
if (!src.edges || src.rowAddr === void 0 || src.colAddr === void 0) continue;
|
|
1586
1587
|
const cand = _optionalChain([table2, 'access', _26 => _26.cells, 'access', _27 => _27[src.rowAddr], 'optionalAccess', _28 => _28[src.colAddr]]);
|
|
1587
|
-
if (cand && anchors2.includes(cand))
|
|
1588
|
+
if (cand && anchors2.includes(cand)) _chunkYIANW5QXcjs.CELL_EDGES.set(cand, src.edges);
|
|
1588
1589
|
}
|
|
1589
1590
|
}
|
|
1590
1591
|
const claimed = /* @__PURE__ */ new Set();
|
|
@@ -1634,7 +1635,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1634
1635
|
const cell2 = parentTable.cell;
|
|
1635
1636
|
(cell2.blocks ??= []).push(block);
|
|
1636
1637
|
cell2.hasStructure = true;
|
|
1637
|
-
let flat =
|
|
1638
|
+
let flat = _chunkGPC72VSFcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1638
1639
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1639
1640
|
if (flat) {
|
|
1640
1641
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -1868,7 +1869,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
1868
1869
|
const tkids = rc.childNodes;
|
|
1869
1870
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _36 => _36.length]), () => ( 0))); k++) {
|
|
1870
1871
|
const tk = tkids[k];
|
|
1871
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
1872
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunkGPC72VSFcjs.escapeLiteralDollar.call(void 0, tk.textContent || "");
|
|
1872
1873
|
else if (tk.nodeType === 1) {
|
|
1873
1874
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
1874
1875
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -1888,7 +1889,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
1888
1889
|
const span2 = { text };
|
|
1889
1890
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span2.code = true;
|
|
1890
1891
|
else {
|
|
1891
|
-
if (_optionalChain([cp, 'optionalAccess', _37 => _37.script])) span2.text =
|
|
1892
|
+
if (_optionalChain([cp, 'optionalAccess', _37 => _37.script])) span2.text = _chunkYIANW5QXcjs.wrapScript.call(void 0, text, cp.script);
|
|
1892
1893
|
if (_optionalChain([cp, 'optionalAccess', _38 => _38.bold])) span2.bold = true;
|
|
1893
1894
|
if (_optionalChain([cp, 'optionalAccess', _39 => _39.italic])) span2.italic = true;
|
|
1894
1895
|
if (_optionalChain([cp, 'optionalAccess', _40 => _40.strike])) span2.strike = true;
|
|
@@ -1908,7 +1909,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
1908
1909
|
}
|
|
1909
1910
|
}
|
|
1910
1911
|
if (requireMixed && !merged.some((s) => s.strike || s.underline) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
1911
|
-
for (const s of merged) s.text =
|
|
1912
|
+
for (const s of merged) s.text = _chunkYIANW5QXcjs.tidyScriptTags.call(void 0, s.text);
|
|
1912
1913
|
return merged;
|
|
1913
1914
|
}
|
|
1914
1915
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -1935,7 +1936,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
1935
1936
|
// src/hwpx/section-walker.ts
|
|
1936
1937
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
1937
1938
|
const parser = createXmlParser(warnings);
|
|
1938
|
-
const doc = parser.parseFromString(
|
|
1939
|
+
const doc = parser.parseFromString(_chunkKZVQK5NScjs.stripDtd.call(void 0, xml), "text/xml");
|
|
1939
1940
|
if (!doc.documentElement) return [];
|
|
1940
1941
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
1941
1942
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2052,8 +2053,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2052
2053
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2053
2054
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2054
2055
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2055
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2056
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2056
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkGPC72VSFcjs.MAX_COLS);
|
|
2057
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkGPC72VSFcjs.MAX_ROWS);
|
|
2057
2058
|
}
|
|
2058
2059
|
break;
|
|
2059
2060
|
case "p": {
|
|
@@ -2366,7 +2367,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2366
2367
|
const sink = [];
|
|
2367
2368
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2368
2369
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2369
|
-
let flat =
|
|
2370
|
+
let flat = _chunkGPC72VSFcjs.convertTableToText.call(void 0, st.rows);
|
|
2370
2371
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2371
2372
|
const built = [];
|
|
2372
2373
|
completeTable(st, [], built, ctx);
|
|
@@ -2552,7 +2553,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2552
2553
|
let url = (ch.textContent || "").trim();
|
|
2553
2554
|
if (!url) continue;
|
|
2554
2555
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2555
|
-
const safe =
|
|
2556
|
+
const safe = _chunkKZVQK5NScjs.sanitizeHref.call(void 0, url);
|
|
2556
2557
|
if (safe) return safe;
|
|
2557
2558
|
}
|
|
2558
2559
|
return void 0;
|
|
@@ -2696,7 +2697,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2696
2697
|
_optionalChain([ctx, 'access', _99 => _99.warnings, 'optionalAccess', _100 => _100.push, 'call', _101 => _101({ page: ctx.page, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
|
|
2697
2698
|
}
|
|
2698
2699
|
} else {
|
|
2699
|
-
text +=
|
|
2700
|
+
text += _chunkGPC72VSFcjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, ""));
|
|
2700
2701
|
}
|
|
2701
2702
|
continue;
|
|
2702
2703
|
}
|
|
@@ -2742,7 +2743,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2742
2743
|
case "hyperlink": {
|
|
2743
2744
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2744
2745
|
if (url) {
|
|
2745
|
-
const safe =
|
|
2746
|
+
const safe = _chunkKZVQK5NScjs.sanitizeHref.call(void 0, url);
|
|
2746
2747
|
if (safe) href = safe;
|
|
2747
2748
|
}
|
|
2748
2749
|
walk(child, depth + 1);
|
|
@@ -2835,7 +2836,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2835
2836
|
walk(child, depth + 1);
|
|
2836
2837
|
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
2837
2838
|
const added = text.slice(start);
|
|
2838
|
-
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) +
|
|
2839
|
+
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) + _chunkYIANW5QXcjs.wrapScript.call(void 0, added, script);
|
|
2839
2840
|
}
|
|
2840
2841
|
break;
|
|
2841
2842
|
}
|
|
@@ -2858,7 +2859,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2858
2859
|
}
|
|
2859
2860
|
if (applied.length) href = void 0;
|
|
2860
2861
|
}
|
|
2861
|
-
text =
|
|
2862
|
+
text = _chunkYIANW5QXcjs.tidyScriptTags.call(void 0, text);
|
|
2862
2863
|
const cleanParaText = (raw) => {
|
|
2863
2864
|
let t = raw.replace(/[ \t]+/g, " ").trim();
|
|
2864
2865
|
if (/^그림입니다\.?\s*원본\s*그림의\s*(이름|크기)/.test(t)) t = "";
|
|
@@ -2969,7 +2970,7 @@ function decompressStream(data) {
|
|
|
2969
2970
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
2970
2971
|
}
|
|
2971
2972
|
function parseFileHeader(data) {
|
|
2972
|
-
if (data.length < 40) throw new (0,
|
|
2973
|
+
if (data.length < 40) throw new (0, _chunkKZVQK5NScjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
2973
2974
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
2974
2975
|
return {
|
|
2975
2976
|
signature: sig,
|
|
@@ -3471,13 +3472,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3471
3472
|
}
|
|
3472
3473
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3473
3474
|
for (const path of allCandidates) {
|
|
3474
|
-
if (
|
|
3475
|
+
if (_chunkKZVQK5NScjs.isPathTraversal.call(void 0, path)) continue;
|
|
3475
3476
|
const file = zip.file(path);
|
|
3476
3477
|
if (!file) continue;
|
|
3477
3478
|
try {
|
|
3478
3479
|
const data = await file.async("uint8array");
|
|
3479
3480
|
decompressed.total += data.length;
|
|
3480
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3481
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKZVQK5NScjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3481
3482
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3482
3483
|
const mimeType = imageExtToMime(ext);
|
|
3483
3484
|
imageIndex++;
|
|
@@ -3487,7 +3488,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3487
3488
|
usedPaths.add(path);
|
|
3488
3489
|
break;
|
|
3489
3490
|
} catch (err) {
|
|
3490
|
-
if (err instanceof
|
|
3491
|
+
if (err instanceof _chunkKZVQK5NScjs.KordocError) throw err;
|
|
3491
3492
|
}
|
|
3492
3493
|
}
|
|
3493
3494
|
if (!img) _optionalChain([warnings, 'optionalAccess', _115 => _115.push, 'call', _116 => _116({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
@@ -3507,11 +3508,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3507
3508
|
if (sweepUnreferenced) {
|
|
3508
3509
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3509
3510
|
for (const file of binEntries) {
|
|
3510
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3511
|
+
if (file.dir || usedPaths.has(file.name) || _chunkKZVQK5NScjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3511
3512
|
try {
|
|
3512
3513
|
const data = await file.async("uint8array");
|
|
3513
3514
|
decompressed.total += data.length;
|
|
3514
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3515
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKZVQK5NScjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3515
3516
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3516
3517
|
let mimeType = imageExtToMime(ext);
|
|
3517
3518
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3525,7 +3526,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3525
3526
|
images.push(img);
|
|
3526
3527
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3527
3528
|
} catch (err) {
|
|
3528
|
-
if (err instanceof
|
|
3529
|
+
if (err instanceof _chunkKZVQK5NScjs.KordocError) throw err;
|
|
3529
3530
|
_optionalChain([warnings, 'optionalAccess', _117 => _117.push, 'call', _118 => _118({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3530
3531
|
}
|
|
3531
3532
|
}
|
|
@@ -3576,7 +3577,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3576
3577
|
}
|
|
3577
3578
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3578
3579
|
const name = new TextDecoder().decode(nameBytes);
|
|
3579
|
-
if (
|
|
3580
|
+
if (_chunkKZVQK5NScjs.isPathTraversal.call(void 0, name)) {
|
|
3580
3581
|
pos = fileStart + compSize;
|
|
3581
3582
|
continue;
|
|
3582
3583
|
}
|
|
@@ -3594,7 +3595,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3594
3595
|
continue;
|
|
3595
3596
|
}
|
|
3596
3597
|
totalDecompressed += content.length * 2;
|
|
3597
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3598
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKZVQK5NScjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3598
3599
|
sectionNum++;
|
|
3599
3600
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3600
3601
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3603,9 +3604,9 @@ function extractFromBrokenZip(buffer) {
|
|
|
3603
3604
|
continue;
|
|
3604
3605
|
}
|
|
3605
3606
|
}
|
|
3606
|
-
if (blocks.length === 0) throw new (0,
|
|
3607
|
+
if (blocks.length === 0) throw new (0, _chunkKZVQK5NScjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3607
3608
|
applyPageText(blocks, shared);
|
|
3608
|
-
const markdown =
|
|
3609
|
+
const markdown = _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3609
3610
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3610
3611
|
}
|
|
3611
3612
|
async function readKordocLayout(zip) {
|
|
@@ -3630,18 +3631,18 @@ async function resolveSectionPaths(zip) {
|
|
|
3630
3631
|
if (paths.length > 0) return paths;
|
|
3631
3632
|
}
|
|
3632
3633
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3633
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3634
|
+
return sectionFiles.map((f) => f.name).sort(_chunkKZVQK5NScjs.compareSectionPaths);
|
|
3634
3635
|
}
|
|
3635
3636
|
function parseSectionPathsFromManifest(xml) {
|
|
3636
3637
|
const parser = createXmlParser();
|
|
3637
|
-
const doc = parser.parseFromString(
|
|
3638
|
+
const doc = parser.parseFromString(_chunkKZVQK5NScjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3638
3639
|
const items = doc.getElementsByTagName("opf:item");
|
|
3639
3640
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
3640
3641
|
const idToHref = /* @__PURE__ */ new Map();
|
|
3641
3642
|
for (let i = 0; i < items.length; i++) {
|
|
3642
3643
|
const item = items[i];
|
|
3643
3644
|
const id = item.getAttribute("id") || "";
|
|
3644
|
-
const href =
|
|
3645
|
+
const href = _chunkKZVQK5NScjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3645
3646
|
if (id && href) idToHref.set(id, href);
|
|
3646
3647
|
}
|
|
3647
3648
|
if (spine.length > 0) {
|
|
@@ -3652,7 +3653,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3652
3653
|
}
|
|
3653
3654
|
if (ordered.length > 0) return ordered;
|
|
3654
3655
|
}
|
|
3655
|
-
return Array.from(idToHref.values()).sort(
|
|
3656
|
+
return Array.from(idToHref.values()).sort(_chunkKZVQK5NScjs.compareSectionPaths);
|
|
3656
3657
|
}
|
|
3657
3658
|
|
|
3658
3659
|
// src/hwpx/metadata.ts
|
|
@@ -3664,7 +3665,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3664
3665
|
const xml = await file.async("text");
|
|
3665
3666
|
if (decompressed) {
|
|
3666
3667
|
decompressed.total += xml.length * 2;
|
|
3667
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3668
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKZVQK5NScjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3668
3669
|
}
|
|
3669
3670
|
return xml;
|
|
3670
3671
|
};
|
|
@@ -3686,7 +3687,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3686
3687
|
}
|
|
3687
3688
|
}
|
|
3688
3689
|
function parseOpfMetadata(xml, metadata) {
|
|
3689
|
-
const root = createXmlParser().parseFromString(
|
|
3690
|
+
const root = createXmlParser().parseFromString(_chunkKZVQK5NScjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3690
3691
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3691
3692
|
if (!md2) return;
|
|
3692
3693
|
let title;
|
|
@@ -3719,7 +3720,7 @@ function isoDate(s) {
|
|
|
3719
3720
|
}
|
|
3720
3721
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3721
3722
|
const parser = createXmlParser();
|
|
3722
|
-
const doc = parser.parseFromString(
|
|
3723
|
+
const doc = parser.parseFromString(_chunkKZVQK5NScjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3723
3724
|
if (!doc.documentElement) return;
|
|
3724
3725
|
const getText = (tagNames) => {
|
|
3725
3726
|
for (const tag of tagNames) {
|
|
@@ -3758,7 +3759,7 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3758
3759
|
}
|
|
3759
3760
|
}
|
|
3760
3761
|
async function parseHwpxDocument(buffer, options) {
|
|
3761
|
-
|
|
3762
|
+
_chunkKZVQK5NScjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3762
3763
|
let zip;
|
|
3763
3764
|
try {
|
|
3764
3765
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3767,7 +3768,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3767
3768
|
}
|
|
3768
3769
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3769
3770
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3770
|
-
throw new (0,
|
|
3771
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3771
3772
|
}
|
|
3772
3773
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3773
3774
|
if (manifestFile) {
|
|
@@ -3786,7 +3787,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3786
3787
|
}
|
|
3787
3788
|
}
|
|
3788
3789
|
const hpf = await _optionalChain([zip, 'access', _144 => _144.file, 'call', _145 => _145("Contents/content.hpf"), 'optionalAccess', _146 => _146.async, 'call', _147 => _147("text"), 'access', _148 => _148.catch, 'call', _149 => _149(() => "")]);
|
|
3789
|
-
throw new (0,
|
|
3790
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(
|
|
3790
3791
|
/\bdistribution="1"/.test(_nullishCoalesce(hpf, () => ( ""))) ? "\uBC30\uD3EC\uC6A9\uC73C\uB85C \uC554\uD638\uD654\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4 (\uBC30\uD3EC\uC6A9 \uBCF5\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC74C). \uD55C\uCEF4\uC624\uD53C\uC2A4\uC5D0\uC11C \uC77C\uBC18 \uBB38\uC11C\uB85C \uC800\uC7A5\uD55C \uB4A4 \uC5EC\uC138\uC694." : "\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694."
|
|
3791
3792
|
);
|
|
3792
3793
|
}
|
|
@@ -3798,7 +3799,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3798
3799
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3799
3800
|
const warnings = [];
|
|
3800
3801
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3801
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3802
|
+
if (sectionPaths.length === 0) throw new (0, _chunkKZVQK5NScjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3802
3803
|
let allBlocks = [];
|
|
3803
3804
|
const shared = createSectionShared();
|
|
3804
3805
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -3842,10 +3843,10 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3842
3843
|
const blocks = allBlocks;
|
|
3843
3844
|
applyPageText(blocks, shared);
|
|
3844
3845
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _156 => _156.pages]));
|
|
3845
|
-
const shown = _optionalChain([options, 'optionalAccess', _157 => _157.layoutTables]) === "keep" ? blocks :
|
|
3846
|
+
const shown = _optionalChain([options, 'optionalAccess', _157 => _157.layoutTables]) === "keep" ? blocks : _chunkYIANW5QXcjs.unframeLayoutTables.call(void 0, blocks, !!_optionalChain([options, 'optionalAccess', _158 => _158.keepTrailingEmptyCols]));
|
|
3846
3847
|
detectHwpxHeadings(shown, styleMap);
|
|
3847
3848
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3848
|
-
const markdown =
|
|
3849
|
+
const markdown = _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, shown);
|
|
3849
3850
|
return { markdown, blocks: shown, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
|
|
3850
3851
|
}
|
|
3851
3852
|
|
|
@@ -4612,7 +4613,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4612
4613
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4613
4614
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4614
4615
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4615
|
-
const wrong = () => new (0,
|
|
4616
|
+
const wrong = () => new (0, _chunkKZVQK5NScjs.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.");
|
|
4616
4617
|
let records;
|
|
4617
4618
|
try {
|
|
4618
4619
|
records = readRecords3(data);
|
|
@@ -4624,7 +4625,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4624
4625
|
}
|
|
4625
4626
|
function assertSupportedEncryptVersion(version) {
|
|
4626
4627
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4627
|
-
throw new (0,
|
|
4628
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(
|
|
4628
4629
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4629
4630
|
);
|
|
4630
4631
|
}
|
|
@@ -5064,7 +5065,7 @@ function emitParagraphBlocks(p) {
|
|
|
5064
5065
|
return blocks;
|
|
5065
5066
|
}
|
|
5066
5067
|
function tableFlatText(table2) {
|
|
5067
|
-
const flat =
|
|
5068
|
+
const flat = _chunkGPC72VSFcjs.convertTableToText.call(void 0, table2.cells);
|
|
5068
5069
|
return table2.caption ? table2.caption + (flat ? "\n" + flat : "") : flat;
|
|
5069
5070
|
}
|
|
5070
5071
|
function blocksPlainText(blocks, sep) {
|
|
@@ -5144,8 +5145,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5144
5145
|
}
|
|
5145
5146
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5146
5147
|
for (const c of cells) {
|
|
5147
|
-
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1,
|
|
5148
|
-
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1,
|
|
5148
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunkGPC72VSFcjs.MAX_ROWS));
|
|
5149
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunkGPC72VSFcjs.MAX_COLS));
|
|
5149
5150
|
}
|
|
5150
5151
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5151
5152
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5153,12 +5154,12 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5153
5154
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5154
5155
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5155
5156
|
}
|
|
5156
|
-
const table2 =
|
|
5157
|
+
const table2 = _chunkGPC72VSFcjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5157
5158
|
if (table2.rows === 0) return null;
|
|
5158
5159
|
for (const c of placed) {
|
|
5159
5160
|
if (c.edges) {
|
|
5160
5161
|
const at = _optionalChain([table2, 'access', _165 => _165.cells, 'access', _166 => _166[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _167 => _167[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
5161
|
-
if (at)
|
|
5162
|
+
if (at) _chunkYIANW5QXcjs.CELL_EDGES.set(at, c.edges);
|
|
5162
5163
|
}
|
|
5163
5164
|
if (!_optionalChain([c, 'access', _168 => _168.blocks, 'optionalAccess', _169 => _169.length]) && !c.isHeader) continue;
|
|
5164
5165
|
const target = _optionalChain([table2, 'access', _170 => _170.cells, 'access', _171 => _171[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _172 => _172[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
@@ -5358,7 +5359,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5358
5359
|
continue;
|
|
5359
5360
|
}
|
|
5360
5361
|
if (!ctrl.href) continue;
|
|
5361
|
-
const href =
|
|
5362
|
+
const href = _chunkKZVQK5NScjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5362
5363
|
if (!href) continue;
|
|
5363
5364
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK)) continue;
|
|
5364
5365
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5366,7 +5367,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5366
5367
|
}
|
|
5367
5368
|
}
|
|
5368
5369
|
if (text.includes(LITERAL_DOLLAR_MARK)) text = text.replaceAll(LITERAL_DOLLAR_MARK, "\\$");
|
|
5369
|
-
text =
|
|
5370
|
+
text = _chunkYIANW5QXcjs.tidyScriptTags.call(void 0, text);
|
|
5370
5371
|
let headingLevel = 0;
|
|
5371
5372
|
let headMarker = null;
|
|
5372
5373
|
const ps = ctx.docInfo && paraShapeId >= 0 && paraShapeId < ctx.docInfo.paraShapes.length ? ctx.docInfo.paraShapes[paraShapeId] : null;
|
|
@@ -5570,7 +5571,7 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5570
5571
|
}
|
|
5571
5572
|
var A4_HEIGHT = 84188;
|
|
5572
5573
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5573
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5574
|
+
if (!cells.some((c) => c.pageSpanning)) _chunkGPC72VSFcjs.markNonLayoutTable.call(void 0, table2);
|
|
5574
5575
|
}
|
|
5575
5576
|
function parseTableControl(ctrl, records, ctx) {
|
|
5576
5577
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
@@ -5582,8 +5583,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5582
5583
|
let tableIdx = -1;
|
|
5583
5584
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5584
5585
|
if (records[i2].tagId === TAG_TABLE && records[i2].level === directLevel && records[i2].data.length >= 8) {
|
|
5585
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5586
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5586
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkGPC72VSFcjs.MAX_ROWS);
|
|
5587
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkGPC72VSFcjs.MAX_COLS);
|
|
5587
5588
|
tableIdx = i2;
|
|
5588
5589
|
break;
|
|
5589
5590
|
}
|
|
@@ -5627,11 +5628,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5627
5628
|
return table3;
|
|
5628
5629
|
}
|
|
5629
5630
|
if (rows === 0 || cols === 0) {
|
|
5630
|
-
rows = Math.min(cells.length,
|
|
5631
|
+
rows = Math.min(cells.length, _chunkGPC72VSFcjs.MAX_ROWS);
|
|
5631
5632
|
cols = 1;
|
|
5632
5633
|
}
|
|
5633
5634
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5634
|
-
const table2 =
|
|
5635
|
+
const table2 = _chunkGPC72VSFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5635
5636
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5636
5637
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
5637
5638
|
keepUnlessPageSpanning(table2, cells);
|
|
@@ -5650,8 +5651,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5650
5651
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5651
5652
|
const cs = rec.data.readUInt16LE(12);
|
|
5652
5653
|
const rs = rec.data.readUInt16LE(14);
|
|
5653
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5654
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5654
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkGPC72VSFcjs.MAX_COLS);
|
|
5655
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkGPC72VSFcjs.MAX_ROWS);
|
|
5655
5656
|
}
|
|
5656
5657
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5657
5658
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -5660,7 +5661,9 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5660
5661
|
if (isHeader) cell2.isHeader = true;
|
|
5661
5662
|
if (rec.data.length >= 24 && rec.data.readUInt32LE(20) > A4_HEIGHT) cell2.pageSpanning = true;
|
|
5662
5663
|
if (rec.data.length >= 34) {
|
|
5663
|
-
const
|
|
5664
|
+
const borderFillId = rec.data.readUInt16LE(32);
|
|
5665
|
+
const definitions = _optionalChain([ctx, 'access', _184 => _184.docInfo, 'optionalAccess', _185 => _185.borderEdges]);
|
|
5666
|
+
const edges = borderFillId === 0 && _optionalChain([definitions, 'optionalAccess', _186 => _186.length]) ? { t: false, b: false, l: false, r: false } : _optionalChain([definitions, 'optionalAccess', _187 => _187[borderFillId - 1]]);
|
|
5664
5667
|
if (edges) cell2.edges = edges;
|
|
5665
5668
|
}
|
|
5666
5669
|
return cell2;
|
|
@@ -5728,8 +5731,8 @@ function pictureToImageBlock(data, ctx) {
|
|
|
5728
5731
|
if (data.length < 73) return null;
|
|
5729
5732
|
const binDataId = data.readUInt16LE(71);
|
|
5730
5733
|
if (binDataId === 0) return null;
|
|
5731
|
-
const item = _optionalChain([ctx, 'access',
|
|
5732
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
5734
|
+
const item = _optionalChain([ctx, 'access', _188 => _188.docInfo, 'optionalAccess', _189 => _189.binData, 'access', _190 => _190[binDataId - 1]]);
|
|
5735
|
+
if (_optionalChain([item, 'optionalAccess', _191 => _191.kind]) === "link") {
|
|
5733
5736
|
ctx.warnings.push({ page: ctx.page, message: `\uC678\uBD80 \uC5F0\uACB0 \uC774\uBBF8\uC9C0 (binDataId ${binDataId})`, code: "SKIPPED_IMAGE" });
|
|
5734
5737
|
return null;
|
|
5735
5738
|
}
|
|
@@ -5739,7 +5742,7 @@ function pictureToImageBlock(data, ctx) {
|
|
|
5739
5742
|
function scriptLookup(runs, docInfo) {
|
|
5740
5743
|
if (!docInfo || !runs.length) return void 0;
|
|
5741
5744
|
const kindOf = (id) => {
|
|
5742
|
-
const f = _nullishCoalesce(_optionalChain([docInfo, 'access',
|
|
5745
|
+
const f = _nullishCoalesce(_optionalChain([docInfo, 'access', _192 => _192.charShapes, 'access', _193 => _193[id], 'optionalAccess', _194 => _194.attrFlags]), () => ( 0));
|
|
5743
5746
|
return f & 1 << 15 ? "sup" : f & 1 << 16 ? "sub" : null;
|
|
5744
5747
|
};
|
|
5745
5748
|
if (!runs.some(([, id]) => kindOf(id))) return void 0;
|
|
@@ -5798,25 +5801,25 @@ function openHwp5Container(buffer, options) {
|
|
|
5798
5801
|
lenientCfb = parseLenientCfb(buffer);
|
|
5799
5802
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
5800
5803
|
} catch (e24) {
|
|
5801
|
-
throw new (0,
|
|
5804
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
5802
5805
|
}
|
|
5803
5806
|
}
|
|
5804
5807
|
const readRawStream = (path) => {
|
|
5805
5808
|
if (cfb) {
|
|
5806
5809
|
const entry = CFB.find(cfb, path);
|
|
5807
|
-
return _optionalChain([entry, 'optionalAccess',
|
|
5810
|
+
return _optionalChain([entry, 'optionalAccess', _195 => _195.content]) ? Buffer.from(entry.content) : null;
|
|
5808
5811
|
}
|
|
5809
5812
|
return lenientCfb.findStream(path);
|
|
5810
5813
|
};
|
|
5811
5814
|
const headerData = readRawStream("/FileHeader");
|
|
5812
|
-
if (!headerData) throw new (0,
|
|
5815
|
+
if (!headerData) throw new (0, _chunkKZVQK5NScjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
5813
5816
|
const header = parseFileHeader(headerData);
|
|
5814
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
5815
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
5817
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkKZVQK5NScjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
5818
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkKZVQK5NScjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
5816
5819
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
5817
5820
|
if (encrypted) {
|
|
5818
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
5819
|
-
throw new (0,
|
|
5821
|
+
if (!_optionalChain([options, 'optionalAccess', _196 => _196.password])) {
|
|
5822
|
+
throw new (0, _chunkKZVQK5NScjs.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.");
|
|
5820
5823
|
}
|
|
5821
5824
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
5822
5825
|
}
|
|
@@ -5830,12 +5833,12 @@ function openHwp5Container(buffer, options) {
|
|
|
5830
5833
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
5831
5834
|
if (encrypted) {
|
|
5832
5835
|
const rawDocInfo = findStream("/DocInfo");
|
|
5833
|
-
if (!rawDocInfo) throw new (0,
|
|
5836
|
+
if (!rawDocInfo) throw new (0, _chunkKZVQK5NScjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
5834
5837
|
let docInfoData;
|
|
5835
5838
|
try {
|
|
5836
5839
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
5837
5840
|
} catch (e25) {
|
|
5838
|
-
throw new (0,
|
|
5841
|
+
throw new (0, _chunkKZVQK5NScjs.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.");
|
|
5839
5842
|
}
|
|
5840
5843
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
5841
5844
|
}
|
|
@@ -5860,10 +5863,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
5860
5863
|
try {
|
|
5861
5864
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
5862
5865
|
totalDecompressed += data.length;
|
|
5863
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
5866
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkKZVQK5NScjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
5864
5867
|
out.push(readRecords(data));
|
|
5865
5868
|
} catch (secErr) {
|
|
5866
|
-
if (secErr instanceof
|
|
5869
|
+
if (secErr instanceof _chunkKZVQK5NScjs.KordocError) throw secErr;
|
|
5867
5870
|
out.push(null);
|
|
5868
5871
|
warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
|
|
5869
5872
|
}
|
|
@@ -5882,7 +5885,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
5882
5885
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
5883
5886
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
5884
5887
|
const sections = readHwp5SectionStreams(c);
|
|
5885
|
-
if (sections.length === 0) throw new (0,
|
|
5888
|
+
if (sections.length === 0) throw new (0, _chunkKZVQK5NScjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
5886
5889
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
5887
5890
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
5888
5891
|
const sectionTableIds = [];
|
|
@@ -5896,15 +5899,15 @@ function parseHwp5Document(buffer, options) {
|
|
|
5896
5899
|
}
|
|
5897
5900
|
const layoutPages = sectionDetects.length > 0 && sectionDetects.every((d) => d != null && d.usable);
|
|
5898
5901
|
metadata.pageMode = layoutPages ? "layout" : "section";
|
|
5899
|
-
metadata.pageCount = layoutPages ? Math.max(sectionDetects.reduce((sum, d) => sum + (_nullishCoalesce(_optionalChain([d, 'optionalAccess',
|
|
5900
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
5902
|
+
metadata.pageCount = layoutPages ? Math.max(sectionDetects.reduce((sum, d) => sum + (_nullishCoalesce(_optionalChain([d, 'optionalAccess', _197 => _197.pages]), () => ( 0))), 0), 1) : sections.length;
|
|
5903
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _198 => _198.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, metadata.pageCount) : null;
|
|
5901
5904
|
if (pageFilter && !layoutPages) {
|
|
5902
5905
|
warnings.push({ code: "PAGE_BOUNDARY_APPROXIMATE", message: "\uC870\uD310 \uCE90\uC2DC\uAC00 \uC5C6\uC5B4 pages \uD544\uD130\uB97C \uC139\uC158 \uB2E8\uC704 \uADFC\uC0AC\uB85C \uC801\uC6A9\uD588\uC2B5\uB2C8\uB2E4" });
|
|
5903
5906
|
}
|
|
5904
5907
|
let bodyBlocks = [];
|
|
5905
5908
|
const doc = createHwp5DocState();
|
|
5906
|
-
doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess',
|
|
5907
|
-
doc.includeFieldPlaceholders = _optionalChain([options, 'optionalAccess',
|
|
5909
|
+
doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _199 => _199.keepTrailingEmptyCols]);
|
|
5910
|
+
doc.includeFieldPlaceholders = _optionalChain([options, 'optionalAccess', _200 => _200.includeFieldPlaceholders]);
|
|
5908
5911
|
let parsedSections = 0;
|
|
5909
5912
|
let pageBase = 0;
|
|
5910
5913
|
for (let si = 0; si < sections.length; si++) {
|
|
@@ -5924,9 +5927,9 @@ function parseHwp5Document(buffer, options) {
|
|
|
5924
5927
|
);
|
|
5925
5928
|
bodyBlocks.push(...sectionBlocks);
|
|
5926
5929
|
parsedSections++;
|
|
5927
|
-
_optionalChain([options, 'optionalAccess',
|
|
5930
|
+
_optionalChain([options, 'optionalAccess', _201 => _201.onProgress, 'optionalCall', _202 => _202(parsedSections, sections.length)]);
|
|
5928
5931
|
} catch (secErr) {
|
|
5929
|
-
if (secErr instanceof
|
|
5932
|
+
if (secErr instanceof _chunkKZVQK5NScjs.KordocError) throw secErr;
|
|
5930
5933
|
warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
|
|
5931
5934
|
} finally {
|
|
5932
5935
|
pageBase += detect2.pages;
|
|
@@ -5937,10 +5940,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
5937
5940
|
}
|
|
5938
5941
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
5939
5942
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
|
|
5940
|
-
let flatBlocks =
|
|
5941
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5942
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5943
|
-
const deduped =
|
|
5943
|
+
let flatBlocks = _chunkGPC72VSFcjs.flattenLayoutTables.call(void 0, blocks);
|
|
5944
|
+
if (_optionalChain([options, 'optionalAccess', _203 => _203.layoutTables]) !== "keep") flatBlocks = _chunkYIANW5QXcjs.unframeLayoutTables.call(void 0, flatBlocks, !!_optionalChain([options, 'optionalAccess', _204 => _204.keepTrailingEmptyCols]));
|
|
5945
|
+
if (_optionalChain([options, 'optionalAccess', _205 => _205.dedupeRunningHeaders])) {
|
|
5946
|
+
const deduped = _chunkGPC72VSFcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
5944
5947
|
const removed = flatBlocks.length - deduped.length;
|
|
5945
5948
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
5946
5949
|
flatBlocks = deduped;
|
|
@@ -5949,10 +5952,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
5949
5952
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
5950
5953
|
}
|
|
5951
5954
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
5952
|
-
let markdown =
|
|
5953
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5955
|
+
let markdown = _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
5956
|
+
if (_optionalChain([options, 'optionalAccess', _206 => _206.inlineImages]) && options.images !== false && images.length > 0) {
|
|
5954
5957
|
try {
|
|
5955
|
-
markdown =
|
|
5958
|
+
markdown = _chunkGPC72VSFcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
5956
5959
|
} catch (inlineErr) {
|
|
5957
5960
|
warnings.push({ message: `\uC774\uBBF8\uC9C0 \uC778\uB77C\uC778 \uC2E4\uD328 \u2014 \uC6D0\uBCF8 \uD30C\uC77C \uCC38\uC870\uB85C \uD3F4\uBC31: ${inlineErr instanceof Error ? inlineErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "SKIPPED_IMAGE" });
|
|
5958
5961
|
}
|
|
@@ -5962,7 +5965,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
5962
5965
|
function parseDocInfoStream(cfb, compressed) {
|
|
5963
5966
|
try {
|
|
5964
5967
|
const entry = CFB.find(cfb, "/DocInfo");
|
|
5965
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
5968
|
+
if (!_optionalChain([entry, 'optionalAccess', _207 => _207.content])) return null;
|
|
5966
5969
|
const data = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
5967
5970
|
const records = readRecords(data);
|
|
5968
5971
|
return parseDocInfo(records);
|
|
@@ -5983,7 +5986,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
5983
5986
|
let baseFontSize = 0;
|
|
5984
5987
|
const sizeFreq = /* @__PURE__ */ new Map();
|
|
5985
5988
|
for (const b of blocks) {
|
|
5986
|
-
if (_optionalChain([b, 'access',
|
|
5989
|
+
if (_optionalChain([b, 'access', _208 => _208.style, 'optionalAccess', _209 => _209.fontSize]) && b.text) {
|
|
5987
5990
|
sizeFreq.set(b.style.fontSize, (sizeFreq.get(b.style.fontSize) || 0) + b.text.length);
|
|
5988
5991
|
}
|
|
5989
5992
|
}
|
|
@@ -5999,7 +6002,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
5999
6002
|
const name = (style.nameKo || style.name).toLowerCase();
|
|
6000
6003
|
if (name.includes("\uBC14\uD0D5") || name.includes("\uBCF8\uBB38") || name === "normal" || name === "body") {
|
|
6001
6004
|
const cs = docInfo.charShapes[style.charShapeId];
|
|
6002
|
-
if (_optionalChain([cs, 'optionalAccess',
|
|
6005
|
+
if (_optionalChain([cs, 'optionalAccess', _210 => _210.fontSize]) > 0) {
|
|
6003
6006
|
baseFontSize = cs.fontSize / 10;
|
|
6004
6007
|
break;
|
|
6005
6008
|
}
|
|
@@ -6014,11 +6017,11 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
6014
6017
|
if (text.length === 0 || text.length > 200) continue;
|
|
6015
6018
|
if (/^\d+$/.test(text)) continue;
|
|
6016
6019
|
let level = 0;
|
|
6017
|
-
if (_optionalChain([block, 'access',
|
|
6020
|
+
if (_optionalChain([block, 'access', _211 => _211.style, 'optionalAccess', _212 => _212.fontSize]) && baseFontSize > 0) {
|
|
6018
6021
|
const ratio = block.style.fontSize / baseFontSize;
|
|
6019
|
-
if (ratio >=
|
|
6020
|
-
else if (ratio >=
|
|
6021
|
-
else if (ratio >=
|
|
6022
|
+
if (ratio >= _chunkYIANW5QXcjs.HEADING_RATIO_H1) level = 1;
|
|
6023
|
+
else if (ratio >= _chunkYIANW5QXcjs.HEADING_RATIO_H2) level = 2;
|
|
6024
|
+
else if (ratio >= _chunkYIANW5QXcjs.HEADING_RATIO_H3) level = 3;
|
|
6022
6025
|
}
|
|
6023
6026
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
6024
6027
|
if (level === 0) level = 2;
|
|
@@ -6039,7 +6042,7 @@ var CODE_PAGE_LABELS = { 949: "euc-kr", 932: "shift_jis", 936: "gbk", 950: "big5
|
|
|
6039
6042
|
function extractHwp5Metadata(cfb, metadata) {
|
|
6040
6043
|
try {
|
|
6041
6044
|
const summaryEntry = CFB.find(cfb, "/HwpSummaryInformation") || CFB.find(cfb, "/SummaryInformation");
|
|
6042
|
-
if (!_optionalChain([summaryEntry, 'optionalAccess',
|
|
6045
|
+
if (!_optionalChain([summaryEntry, 'optionalAccess', _213 => _213.content])) return;
|
|
6043
6046
|
const data = Buffer.from(summaryEntry.content);
|
|
6044
6047
|
if (data.length < 48) return;
|
|
6045
6048
|
const numSets = data.readUInt32LE(24);
|
|
@@ -6069,8 +6072,8 @@ function extractHwp5Metadata(cfb, metadata) {
|
|
|
6069
6072
|
if (title) metadata.title = title;
|
|
6070
6073
|
if (author) metadata.author = author;
|
|
6071
6074
|
if (description) metadata.description = description;
|
|
6072
|
-
const keywords = _optionalChain([text, 'call',
|
|
6073
|
-
if (_optionalChain([keywords, 'optionalAccess',
|
|
6075
|
+
const keywords = _optionalChain([text, 'call', _214 => _214(5), 'optionalAccess', _215 => _215.split, 'call', _216 => _216(/[,;]/), 'access', _217 => _217.map, 'call', _218 => _218((k) => k.trim()), 'access', _219 => _219.filter, 'call', _220 => _220(Boolean)]);
|
|
6076
|
+
if (_optionalChain([keywords, 'optionalAccess', _221 => _221.length])) metadata.keywords = keywords;
|
|
6074
6077
|
const createdAt = time(12), modifiedAt = time(13);
|
|
6075
6078
|
if (createdAt) metadata.createdAt = createdAt;
|
|
6076
6079
|
if (modifiedAt) metadata.modifiedAt = modifiedAt;
|
|
@@ -6106,7 +6109,7 @@ function findViewTextSections(cfb, compressed) {
|
|
|
6106
6109
|
const sections = [];
|
|
6107
6110
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
6108
6111
|
const entry = CFB.find(cfb, `/ViewText/Section${i}`);
|
|
6109
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
6112
|
+
if (!_optionalChain([entry, 'optionalAccess', _222 => _222.content])) break;
|
|
6110
6113
|
try {
|
|
6111
6114
|
const decrypted = decryptViewText(Buffer.from(entry.content), compressed);
|
|
6112
6115
|
sections.push({ idx: i, content: decrypted });
|
|
@@ -6129,13 +6132,13 @@ function findSections(cfb) {
|
|
|
6129
6132
|
const sections = [];
|
|
6130
6133
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
6131
6134
|
const entry = CFB.find(cfb, `/BodyText/Section${i}`);
|
|
6132
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
6135
|
+
if (!_optionalChain([entry, 'optionalAccess', _223 => _223.content])) break;
|
|
6133
6136
|
sections.push({ idx: i, content: Buffer.from(entry.content) });
|
|
6134
6137
|
}
|
|
6135
6138
|
if (sections.length === 0 && cfb.FileIndex) {
|
|
6136
6139
|
for (const entry of cfb.FileIndex) {
|
|
6137
6140
|
if (sections.length >= MAX_SECTIONS) break;
|
|
6138
|
-
if (_optionalChain([entry, 'access',
|
|
6141
|
+
if (_optionalChain([entry, 'access', _224 => _224.name, 'optionalAccess', _225 => _225.startsWith, 'call', _226 => _226("Section")]) && entry.content) {
|
|
6139
6142
|
const idx = parseInt(entry.name.replace("Section", ""), 10) || 0;
|
|
6140
6143
|
sections.push({ idx, content: Buffer.from(entry.content) });
|
|
6141
6144
|
}
|
|
@@ -6151,7 +6154,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
6151
6154
|
if (!raw) break;
|
|
6152
6155
|
const content = compressed ? decompressStream(raw) : raw;
|
|
6153
6156
|
totalDecompressed += content.length;
|
|
6154
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6157
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkKZVQK5NScjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6155
6158
|
sections.push({ idx: i, content });
|
|
6156
6159
|
}
|
|
6157
6160
|
if (sections.length === 0) {
|
|
@@ -6163,7 +6166,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
6163
6166
|
if (raw) {
|
|
6164
6167
|
const content = compressed ? decompressStream(raw) : raw;
|
|
6165
6168
|
totalDecompressed += content.length;
|
|
6166
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6169
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkKZVQK5NScjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6167
6170
|
sections.push({ idx, content });
|
|
6168
6171
|
}
|
|
6169
6172
|
}
|
|
@@ -6180,7 +6183,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6180
6183
|
try {
|
|
6181
6184
|
const content = decryptViewText(raw, compressed);
|
|
6182
6185
|
totalDecompressed += content.length;
|
|
6183
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6186
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkKZVQK5NScjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6184
6187
|
sections.push({ idx: i, content });
|
|
6185
6188
|
} catch (e32) {
|
|
6186
6189
|
break;
|
|
@@ -18658,40 +18661,40 @@ function desEcbDecrypt(data, key) {
|
|
|
18658
18661
|
}
|
|
18659
18662
|
function readLayout(data) {
|
|
18660
18663
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18661
|
-
throw new (0,
|
|
18664
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18662
18665
|
}
|
|
18663
18666
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18664
18667
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18665
18668
|
if (payloadOffset >= data.length) {
|
|
18666
|
-
throw new (0,
|
|
18669
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18667
18670
|
}
|
|
18668
18671
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18669
18672
|
}
|
|
18670
18673
|
function decryptHwp3Document(input, password) {
|
|
18671
18674
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18672
18675
|
if (!compressed) {
|
|
18673
|
-
throw new (0,
|
|
18676
|
+
throw new (0, _chunkKZVQK5NScjs.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)");
|
|
18674
18677
|
}
|
|
18675
18678
|
const source = Buffer.from(input);
|
|
18676
18679
|
const payload = source.subarray(payloadOffset);
|
|
18677
18680
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18678
18681
|
if (aligned.length === 0) {
|
|
18679
|
-
throw new (0,
|
|
18682
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18680
18683
|
}
|
|
18681
18684
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18682
18685
|
let inflated;
|
|
18683
18686
|
try {
|
|
18684
18687
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18685
18688
|
} catch (err) {
|
|
18686
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
18687
|
-
throw new (0,
|
|
18689
|
+
if (_optionalChain([err, 'optionalAccess', _227 => _227.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18690
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(
|
|
18688
18691
|
`HWP3 \uC554\uD638 \uBCF8\uBB38\uC758 \uC555\uCD95 \uD574\uC81C \uACB0\uACFC\uAC00 \uCD5C\uB300 \uD5C8\uC6A9 \uD06C\uAE30(${MAX_DECOMPRESSED_BYTES / 1024 / 1024}MB)\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4`
|
|
18689
18692
|
);
|
|
18690
18693
|
}
|
|
18691
|
-
throw new (0,
|
|
18694
|
+
throw new (0, _chunkKZVQK5NScjs.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.");
|
|
18692
18695
|
}
|
|
18693
18696
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18694
|
-
throw new (0,
|
|
18697
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
18695
18698
|
}
|
|
18696
18699
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18697
18700
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -18748,9 +18751,9 @@ function hwp3CellGrid(info, count) {
|
|
|
18748
18751
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
18749
18752
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
18750
18753
|
const r2 = nextY[k] !== void 0 ? edgeAt(ys, nextY[k]) : ys.length - 1;
|
|
18751
|
-
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row),
|
|
18754
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunkGPC72VSFcjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunkGPC72VSFcjs.MAX_COLS) };
|
|
18752
18755
|
});
|
|
18753
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
18756
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunkGPC72VSFcjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunkGPC72VSFcjs.MAX_COLS), cells };
|
|
18754
18757
|
}
|
|
18755
18758
|
|
|
18756
18759
|
// src/hwp3/parser.ts
|
|
@@ -18789,8 +18792,8 @@ var SIMPLE_CTRL = /* @__PURE__ */ new Map([
|
|
|
18789
18792
|
function parseHwp3Document(buffer, options) {
|
|
18790
18793
|
let source = Buffer.from(buffer);
|
|
18791
18794
|
if (isEncryptedHwp3(source)) {
|
|
18792
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
18793
|
-
throw new (0,
|
|
18795
|
+
if (!_optionalChain([options, 'optionalAccess', _228 => _228.password])) {
|
|
18796
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(
|
|
18794
18797
|
"\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWP3 \uBB38\uC11C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694."
|
|
18795
18798
|
);
|
|
18796
18799
|
}
|
|
@@ -18806,11 +18809,11 @@ function parseHwp3Document(buffer, options) {
|
|
|
18806
18809
|
try {
|
|
18807
18810
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
18808
18811
|
} catch (err) {
|
|
18809
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
18810
|
-
throw new (0,
|
|
18812
|
+
if (_optionalChain([err, 'optionalAccess', _229 => _229.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18813
|
+
throw new (0, _chunkKZVQK5NScjs.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`);
|
|
18811
18814
|
}
|
|
18812
18815
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
18813
|
-
throw new (0,
|
|
18816
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
18814
18817
|
}
|
|
18815
18818
|
} else {
|
|
18816
18819
|
body = tail;
|
|
@@ -18827,7 +18830,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
18827
18830
|
message: `HWP3 paragraph stream \uB3C4\uC911 \uD30C\uC2F1 \uC911\uB2E8: ${err instanceof Error ? err.message : String(err)}`
|
|
18828
18831
|
});
|
|
18829
18832
|
}
|
|
18830
|
-
const blocks =
|
|
18833
|
+
const blocks = _chunkGPC72VSFcjs.flattenLayoutTables.call(void 0, [...ctx.headerBlocks, ...bodyBlocks, ...ctx.footerBlocks]);
|
|
18831
18834
|
const metadata = {
|
|
18832
18835
|
title: header.title || void 0,
|
|
18833
18836
|
author: header.author || void 0,
|
|
@@ -18836,7 +18839,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
18836
18839
|
version: "3.0"
|
|
18837
18840
|
};
|
|
18838
18841
|
return {
|
|
18839
|
-
markdown:
|
|
18842
|
+
markdown: _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, blocks),
|
|
18840
18843
|
blocks,
|
|
18841
18844
|
metadata,
|
|
18842
18845
|
warnings: warnings.length ? warnings : void 0
|
|
@@ -18920,7 +18923,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
18920
18923
|
continue;
|
|
18921
18924
|
}
|
|
18922
18925
|
if (ch >= 32) {
|
|
18923
|
-
para2.text +=
|
|
18926
|
+
para2.text += _chunkGPC72VSFcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( "")));
|
|
18924
18927
|
continue;
|
|
18925
18928
|
}
|
|
18926
18929
|
if (ch === 9) {
|
|
@@ -19148,7 +19151,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19148
19151
|
|
|
19149
19152
|
// src/xlsx/sheet-blocks.ts
|
|
19150
19153
|
function sheetRowCap(cols) {
|
|
19151
|
-
return Math.max(
|
|
19154
|
+
return Math.max(_chunkGPC72VSFcjs.MAX_ROWS, Math.floor(_chunkGPC72VSFcjs.MAX_TABLE_CELLS / Math.max(1, cols)));
|
|
19152
19155
|
}
|
|
19153
19156
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19154
19157
|
const blocks = [];
|
|
@@ -19165,7 +19168,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19165
19168
|
}
|
|
19166
19169
|
if (firstRow === -1) return blocks;
|
|
19167
19170
|
const keepRows = [];
|
|
19168
|
-
for (let r = firstRow; r <= lastRow; r++) if (_optionalChain([rows, 'access',
|
|
19171
|
+
for (let r = firstRow; r <= lastRow; r++) if (_optionalChain([rows, 'access', _230 => _230.get, 'call', _231 => _231(r), 'optionalAccess', _232 => _232.some, 'call', _233 => _233((v) => v !== "")])) keepRows.push(r);
|
|
19169
19172
|
let keepCols;
|
|
19170
19173
|
if (keepAnchoredEmptyCols) keepCols = Array.from({ length: maxCol + 1 }, (_, c) => c);
|
|
19171
19174
|
else {
|
|
@@ -19179,7 +19182,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19179
19182
|
if (keepRows.length > rowCap) {
|
|
19180
19183
|
warnings.push({
|
|
19181
19184
|
page: sheetIndex + 1,
|
|
19182
|
-
message: `\uC2DC\uD2B8 "${sheetName}": ${keepRows.length}\uD589 \xD7 ${keepCols.length}\uC5F4 \uC911 \uC55E ${rowCap}\uD589\uB9CC \uD45C\uB85C \uB0C8\uC2B5\uB2C8\uB2E4 (\uD45C \uCE78 \uC0C1\uD55C ${
|
|
19185
|
+
message: `\uC2DC\uD2B8 "${sheetName}": ${keepRows.length}\uD589 \xD7 ${keepCols.length}\uC5F4 \uC911 \uC55E ${rowCap}\uD589\uB9CC \uD45C\uB85C \uB0C8\uC2B5\uB2C8\uB2E4 (\uD45C \uCE78 \uC0C1\uD55C ${_chunkGPC72VSFcjs.MAX_TABLE_CELLS})`,
|
|
19183
19186
|
code: "TRUNCATED_TABLE"
|
|
19184
19187
|
});
|
|
19185
19188
|
keepRows.length = rowCap;
|
|
@@ -19193,9 +19196,9 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19193
19196
|
const rr = keepRows.filter((r) => r >= m.r1 && r <= m.r2);
|
|
19194
19197
|
const cc = keepCols.filter((c) => c >= m.c1 && c <= m.c2);
|
|
19195
19198
|
if (!rr.length || !cc.length) continue;
|
|
19196
|
-
let text = _nullishCoalesce(_optionalChain([rows, 'access',
|
|
19199
|
+
let text = _nullishCoalesce(_optionalChain([rows, 'access', _234 => _234.get, 'call', _235 => _235(m.r1), 'optionalAccess', _236 => _236[m.c1]]), () => ( ""));
|
|
19197
19200
|
for (let k = 0; !text && k < rr.length; k++) for (const c of cc) {
|
|
19198
|
-
text = _nullishCoalesce(_optionalChain([rows, 'access',
|
|
19201
|
+
text = _nullishCoalesce(_optionalChain([rows, 'access', _237 => _237.get, 'call', _238 => _238(rr[k]), 'optionalAccess', _239 => _239[c]]), () => ( ""));
|
|
19199
19202
|
if (text) break;
|
|
19200
19203
|
}
|
|
19201
19204
|
mergeMap.set(`${rowIdx.get(rr[0])},${colIdx.get(cc[0])}`, { colSpan: cc.length, rowSpan: rr.length, text });
|
|
@@ -19209,18 +19212,18 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19209
19212
|
const key = `${ri},${ci}`;
|
|
19210
19213
|
if (mergeSkip.has(key)) continue;
|
|
19211
19214
|
const merge = mergeMap.get(key);
|
|
19212
|
-
row.push({ text: merge ? merge.text : _nullishCoalesce(_optionalChain([cells, 'optionalAccess',
|
|
19215
|
+
row.push({ text: merge ? merge.text : _nullishCoalesce(_optionalChain([cells, 'optionalAccess', _240 => _240[keepCols[ci]]]), () => ( "")), colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _241 => _241.colSpan]), () => ( 1)), rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _242 => _242.rowSpan]), () => ( 1)) });
|
|
19213
19216
|
}
|
|
19214
19217
|
cellRows.push(row);
|
|
19215
19218
|
}
|
|
19216
|
-
const table2 =
|
|
19219
|
+
const table2 = _chunkGPC72VSFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap });
|
|
19217
19220
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19218
19221
|
return blocks;
|
|
19219
19222
|
}
|
|
19220
19223
|
|
|
19221
19224
|
// src/xlsx/parser.ts
|
|
19222
19225
|
var MAX_SHEETS = 100;
|
|
19223
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19226
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkKZVQK5NScjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19224
19227
|
var MAX_SHEET_ROWS = 1048576;
|
|
19225
19228
|
function cleanNumericValue(raw) {
|
|
19226
19229
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19249,15 +19252,15 @@ function getElements(parent, tagName) {
|
|
|
19249
19252
|
const result = [];
|
|
19250
19253
|
for (let i = 0; i < nodes.length; i++) result.push(nodes[i]);
|
|
19251
19254
|
if (result.length > 0) return result;
|
|
19252
|
-
const nsNodes = _optionalChain([parent, 'access',
|
|
19255
|
+
const nsNodes = _optionalChain([parent, 'access', _243 => _243.getElementsByTagNameNS, 'optionalCall', _244 => _244("*", tagName)]);
|
|
19253
19256
|
if (nsNodes) for (let i = 0; i < nsNodes.length; i++) result.push(nsNodes[i]);
|
|
19254
19257
|
return result;
|
|
19255
19258
|
}
|
|
19256
19259
|
function getTextContent(el) {
|
|
19257
|
-
return _nullishCoalesce(_optionalChain([el, 'access',
|
|
19260
|
+
return _nullishCoalesce(_optionalChain([el, 'access', _245 => _245.textContent, 'optionalAccess', _246 => _246.trim, 'call', _247 => _247()]), () => ( ""));
|
|
19258
19261
|
}
|
|
19259
19262
|
function parseXml(text) {
|
|
19260
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19263
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkKZVQK5NScjs.stripDtd.call(void 0, text), "text/xml");
|
|
19261
19264
|
}
|
|
19262
19265
|
function collectRichText(root) {
|
|
19263
19266
|
let out = "";
|
|
@@ -19266,7 +19269,7 @@ function collectRichText(root) {
|
|
|
19266
19269
|
for (let i = 0; i < children.length; i++) {
|
|
19267
19270
|
if (children[i].nodeType !== 1) continue;
|
|
19268
19271
|
const el = children[i];
|
|
19269
|
-
const local = el.localName || _optionalChain([el, 'access',
|
|
19272
|
+
const local = el.localName || _optionalChain([el, 'access', _248 => _248.tagName, 'optionalAccess', _249 => _249.replace, 'call', _250 => _250(/^[^:]+:/, "")]) || "";
|
|
19270
19273
|
if (local === "rPh") continue;
|
|
19271
19274
|
if (local === "t") out += _nullishCoalesce(el.textContent, () => ( ""));
|
|
19272
19275
|
else walk(el);
|
|
@@ -19421,7 +19424,7 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19421
19424
|
for (const cellEl of cells) {
|
|
19422
19425
|
const ref = cellEl.getAttribute("r");
|
|
19423
19426
|
const pos = ref !== null ? parseCellRef(ref) : { col: prevCol + 1, row: rowNum };
|
|
19424
|
-
if (!pos || !Number.isFinite(pos.row) || pos.row < 0 || pos.row >= MAX_SHEET_ROWS || pos.col >=
|
|
19427
|
+
if (!pos || !Number.isFinite(pos.row) || pos.row < 0 || pos.row >= MAX_SHEET_ROWS || pos.col >= _chunkGPC72VSFcjs.MAX_COLS) continue;
|
|
19425
19428
|
prevCol = pos.col;
|
|
19426
19429
|
const type = cellEl.getAttribute("t");
|
|
19427
19430
|
const vElements = getElements(cellEl, "v");
|
|
@@ -19471,21 +19474,21 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19471
19474
|
if (m) {
|
|
19472
19475
|
merges.push({
|
|
19473
19476
|
r1: Math.min(m.startRow, MAX_SHEET_ROWS - 1),
|
|
19474
|
-
c1: Math.min(m.startCol,
|
|
19477
|
+
c1: Math.min(m.startCol, _chunkGPC72VSFcjs.MAX_COLS - 1),
|
|
19475
19478
|
r2: Math.min(m.endRow, MAX_SHEET_ROWS - 1),
|
|
19476
|
-
c2: Math.min(m.endCol,
|
|
19479
|
+
c2: Math.min(m.endCol, _chunkGPC72VSFcjs.MAX_COLS - 1)
|
|
19477
19480
|
});
|
|
19478
19481
|
}
|
|
19479
19482
|
}
|
|
19480
19483
|
return { rows, merges, maxCol };
|
|
19481
19484
|
}
|
|
19482
19485
|
async function parseXlsxDocument(buffer, options) {
|
|
19483
|
-
|
|
19486
|
+
_chunkKZVQK5NScjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19484
19487
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19485
19488
|
const warnings = [];
|
|
19486
19489
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19487
19490
|
if (!workbookFile) {
|
|
19488
|
-
throw new (0,
|
|
19491
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19489
19492
|
}
|
|
19490
19493
|
let sharedStrings = [];
|
|
19491
19494
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19494,7 +19497,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19494
19497
|
}
|
|
19495
19498
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
19496
19499
|
if (sheets.length === 0) {
|
|
19497
|
-
throw new (0,
|
|
19500
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19498
19501
|
}
|
|
19499
19502
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19500
19503
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19514,7 +19517,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19514
19517
|
relsMap = parseRels(await relsFile.async("text"));
|
|
19515
19518
|
}
|
|
19516
19519
|
let pageFilter = null;
|
|
19517
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
19520
|
+
if (_optionalChain([options, 'optionalAccess', _251 => _251.pages])) {
|
|
19518
19521
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-QHHFTL7X.cjs")));
|
|
19519
19522
|
pageFilter = parsePageRange2(options.pages, sheets.length);
|
|
19520
19523
|
}
|
|
@@ -19523,7 +19526,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19523
19526
|
for (let i = 0; i < processedSheets; i++) {
|
|
19524
19527
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
19525
19528
|
const sheet = sheets[i];
|
|
19526
|
-
_optionalChain([options, 'optionalAccess',
|
|
19529
|
+
_optionalChain([options, 'optionalAccess', _252 => _252.onProgress, 'optionalCall', _253 => _253(i + 1, processedSheets)]);
|
|
19527
19530
|
let sheetPath = relsMap.get(sheet.rId);
|
|
19528
19531
|
if (sheetPath) {
|
|
19529
19532
|
if (!sheetPath.startsWith("xl/") && !sheetPath.startsWith("/")) {
|
|
@@ -19546,7 +19549,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19546
19549
|
try {
|
|
19547
19550
|
const sheetXml = await sheetFile.async("text");
|
|
19548
19551
|
const { rows, merges, maxCol } = parseWorksheet(sheetXml, sharedStrings, dateXfs, date1904);
|
|
19549
|
-
const sheetBlocks = sheetToBlocks(sheet.name, rows, maxCol, merges, i, warnings, _optionalChain([options, 'optionalAccess',
|
|
19552
|
+
const sheetBlocks = sheetToBlocks(sheet.name, rows, maxCol, merges, i, warnings, _optionalChain([options, 'optionalAccess', _254 => _254.keepTrailingEmptyCols]));
|
|
19550
19553
|
blocks.push(...sheetBlocks);
|
|
19551
19554
|
} catch (err) {
|
|
19552
19555
|
warnings.push({
|
|
@@ -19578,7 +19581,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19578
19581
|
} catch (e35) {
|
|
19579
19582
|
}
|
|
19580
19583
|
}
|
|
19581
|
-
const markdown =
|
|
19584
|
+
const markdown = _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
19582
19585
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19583
19586
|
}
|
|
19584
19587
|
|
|
@@ -20027,11 +20030,11 @@ function processGlobals(records) {
|
|
|
20027
20030
|
const xfFmtIds = [];
|
|
20028
20031
|
const firstBof = records[0];
|
|
20029
20032
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
20030
|
-
throw new (0,
|
|
20033
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
20031
20034
|
}
|
|
20032
20035
|
const bof = decodeBof(firstBof.data);
|
|
20033
20036
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
20034
|
-
throw new (0,
|
|
20037
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
20035
20038
|
}
|
|
20036
20039
|
let i = 1;
|
|
20037
20040
|
while (i < records.length) {
|
|
@@ -20097,14 +20100,14 @@ function rawSheetToBlocks(sheetName, sheet, sheetIndex, warnings, keepAnchoredEm
|
|
|
20097
20100
|
const rows = /* @__PURE__ */ new Map();
|
|
20098
20101
|
let maxCol = -1;
|
|
20099
20102
|
for (const c of sheet.cells) {
|
|
20100
|
-
if (c.col >=
|
|
20103
|
+
if (c.col >= _chunkGPC72VSFcjs.MAX_COLS) continue;
|
|
20101
20104
|
let row = rows.get(c.row);
|
|
20102
20105
|
if (!row) rows.set(c.row, row = []);
|
|
20103
20106
|
while (row.length <= c.col) row.push("");
|
|
20104
20107
|
row[c.col] = cellValueToText(c.value);
|
|
20105
20108
|
if (c.col > maxCol) maxCol = c.col;
|
|
20106
20109
|
}
|
|
20107
|
-
const merges = sheet.merges.filter((m) => m.c1 <
|
|
20110
|
+
const merges = sheet.merges.filter((m) => m.c1 < _chunkGPC72VSFcjs.MAX_COLS).map((m) => ({ r1: m.r1, c1: m.c1, r2: m.r2, c2: Math.min(m.c2, _chunkGPC72VSFcjs.MAX_COLS - 1) }));
|
|
20108
20111
|
for (const m of merges) if (m.c2 > maxCol) maxCol = m.c2;
|
|
20109
20112
|
return sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols);
|
|
20110
20113
|
}
|
|
@@ -20114,28 +20117,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20114
20117
|
try {
|
|
20115
20118
|
cfb = parseLenientCfb(buf);
|
|
20116
20119
|
} catch (e) {
|
|
20117
|
-
throw new (0,
|
|
20120
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(
|
|
20118
20121
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20119
20122
|
);
|
|
20120
20123
|
}
|
|
20121
20124
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20122
20125
|
if (!wb) {
|
|
20123
|
-
throw new (0,
|
|
20126
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20124
20127
|
}
|
|
20125
20128
|
const records = readRecords2(wb);
|
|
20126
20129
|
if (records.length === 0) {
|
|
20127
|
-
throw new (0,
|
|
20130
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20128
20131
|
}
|
|
20129
20132
|
const firstBof = decodeBof(records[0].data);
|
|
20130
20133
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20131
|
-
throw new (0,
|
|
20134
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(
|
|
20132
20135
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20133
20136
|
);
|
|
20134
20137
|
}
|
|
20135
20138
|
const globals = processGlobals(records);
|
|
20136
20139
|
const warnings = [];
|
|
20137
20140
|
if (globals.encrypted) {
|
|
20138
|
-
throw new (0,
|
|
20141
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20139
20142
|
}
|
|
20140
20143
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20141
20144
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20147,7 +20150,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20147
20150
|
} : void 0;
|
|
20148
20151
|
const totalSheets = Math.min(globals.sheets.length, MAX_SHEETS2);
|
|
20149
20152
|
let pageFilter = null;
|
|
20150
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
20153
|
+
if (_optionalChain([options, 'optionalAccess', _255 => _255.pages])) {
|
|
20151
20154
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-QHHFTL7X.cjs")));
|
|
20152
20155
|
pageFilter = parsePageRange2(options.pages, totalSheets);
|
|
20153
20156
|
}
|
|
@@ -20156,7 +20159,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20156
20159
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
20157
20160
|
const meta = globals.sheets[i];
|
|
20158
20161
|
if (meta.dt !== 0) continue;
|
|
20159
|
-
_optionalChain([options, 'optionalAccess',
|
|
20162
|
+
_optionalChain([options, 'optionalAccess', _256 => _256.onProgress, 'optionalCall', _257 => _257(i + 1, totalSheets)]);
|
|
20160
20163
|
const bofIdx = findSheetBofIndex(records, meta.lbPlyPos);
|
|
20161
20164
|
if (bofIdx < 0) {
|
|
20162
20165
|
warnings.push({
|
|
@@ -20172,7 +20175,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20172
20175
|
}
|
|
20173
20176
|
try {
|
|
20174
20177
|
const { sheet } = extractSheetCells(records, bofIdx, globals.sst, convertNum);
|
|
20175
|
-
const blocks = rawSheetToBlocks(meta.name, sheet, i, warnings, _optionalChain([options, 'optionalAccess',
|
|
20178
|
+
const blocks = rawSheetToBlocks(meta.name, sheet, i, warnings, _optionalChain([options, 'optionalAccess', _258 => _258.keepTrailingEmptyCols]));
|
|
20176
20179
|
allBlocks.push(...blocks);
|
|
20177
20180
|
} catch (e) {
|
|
20178
20181
|
warnings.push({
|
|
@@ -20186,7 +20189,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20186
20189
|
pageCount: totalSheets
|
|
20187
20190
|
};
|
|
20188
20191
|
return {
|
|
20189
|
-
markdown:
|
|
20192
|
+
markdown: _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
20190
20193
|
blocks: allBlocks,
|
|
20191
20194
|
metadata,
|
|
20192
20195
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20218,24 +20221,39 @@ var ListCounter = (_class2 = class {constructor() { _class2.prototype.__init4.ca
|
|
|
20218
20221
|
/** numId·ilvl 문단 하나를 세고 라벨을 낸다 — 글머리표(bullet)는 null, 번호 없는 수준(none·빈 lvlText)은 "" */
|
|
20219
20222
|
next(numId, ilvl, levels) {
|
|
20220
20223
|
const lv = levels.get(ilvl);
|
|
20221
|
-
if (_optionalChain([lv, 'optionalAccess',
|
|
20222
|
-
const key = _nullishCoalesce(_optionalChain([[...levels.values()], 'access',
|
|
20224
|
+
if (_optionalChain([lv, 'optionalAccess', _259 => _259.numFmt]) === "bullet") return null;
|
|
20225
|
+
const key = _nullishCoalesce(_optionalChain([[...levels.values()], 'access', _260 => _260.find, 'call', _261 => _261((l) => l.list !== void 0), 'optionalAccess', _262 => _262.list]), () => ( numId));
|
|
20223
20226
|
const c = _nullishCoalesce(this.counts.get(key), () => ( []));
|
|
20224
20227
|
if (!this.used.has(numId)) {
|
|
20225
20228
|
this.used.add(numId);
|
|
20226
20229
|
for (const [k, l] of levels) if (l.restart) c[k] = void 0;
|
|
20227
20230
|
}
|
|
20228
|
-
c[ilvl] = (_nullishCoalesce(c[ilvl], () => ( (_nullishCoalesce(_optionalChain([lv, 'optionalAccess',
|
|
20231
|
+
c[ilvl] = (_nullishCoalesce(c[ilvl], () => ( (_nullishCoalesce(_optionalChain([lv, 'optionalAccess', _263 => _263.start]), () => ( 1))) - 1))) + 1;
|
|
20229
20232
|
for (let k = ilvl + 1; k < c.length; k++) c[k] = void 0;
|
|
20230
20233
|
this.counts.set(key, c);
|
|
20231
20234
|
if (!lv || lv.numFmt === "none") return "";
|
|
20232
20235
|
return lv.lvlText.replace(/%([1-9])/g, (_m, d) => {
|
|
20233
20236
|
const k = Number(d) - 1;
|
|
20234
|
-
return format(_nullishCoalesce(_nullishCoalesce(c[k], () => ( _optionalChain([levels, 'access',
|
|
20237
|
+
return format(_nullishCoalesce(_nullishCoalesce(c[k], () => ( _optionalChain([levels, 'access', _264 => _264.get, 'call', _265 => _265(k), 'optionalAccess', _266 => _266.start]))), () => ( 1)), _nullishCoalesce(_optionalChain([levels, 'access', _267 => _267.get, 'call', _268 => _268(k), 'optionalAccess', _269 => _269.numFmt]), () => ( "decimal")));
|
|
20235
20238
|
}).trim();
|
|
20236
20239
|
}
|
|
20237
20240
|
}, _class2);
|
|
20238
20241
|
|
|
20242
|
+
// src/docx/symbol-font.ts
|
|
20243
|
+
var SYMBOL_LO = " !\u2200#\u2203%&\u220B()\u2217+,\u2212./0123456789:;<=>?\u2245\u0391\u0392\u03A7\u0394\u0395\u03A6\u0393\u0397\u0399\u03D1\u039A\u039B\u039C\u039D\u039F\u03A0\u0398\u03A1\u03A3\u03A4\u03A5\u03C2\u03A9\u039E\u03A8\u0396[\u2234]\u22A5_\0\u03B1\u03B2\u03C7\u03B4\u03B5\u03C6\u03B3\u03B7\u03B9\u03D5\u03BA\u03BB\u03BC\u03BD\u03BF\u03C0\u03B8\u03C1\u03C3\u03C4\u03C5\u03D6\u03C9\u03BE\u03C8\u03B6{|}\u223C";
|
|
20244
|
+
var SYMBOL_HI = "\u20AC\u03D2\u2032\u2264\u2044\u221E\u0192\u2663\u2666\u2665\u2660\u2194\u2190\u2191\u2192\u2193\xB0\xB1\u2033\u2265\xD7\u221D\u2202\u2022\xF7\u2260\u2261\u2248\u2026\u23D0\u23AF\u21B5\u2135\u2111\u211C\u2118\u2297\u2295\u2205\u2229\u222A\u2283\u2287\u2284\u2282\u2286\u2208\u2209\u2220\u2207\xAE\xA9\u2122\u220F\u221A\u22C5\xAC\u2227\u2228\u21D4\u21D0\u21D1\u21D2\u21D3\u25CA\u27E8\xAE\xA9\u2122\u2211\u239B\u239C\u239D\u23A1\u23A2\u23A3\u23A7\u23A8\u23A9\u23AA\0\u27E9\u222B\u2320\u23AE\u2321\u239E\u239F\u23A0\u23A4\u23A5\u23A6\u23AB\u23AC\u23AD";
|
|
20245
|
+
var DINGBAT_FONT_RE = /^\s*(?:wingdings|webdings|marlett|zapf\s*dingbats)/i;
|
|
20246
|
+
function symbolChar(font, char) {
|
|
20247
|
+
const code = parseInt(_nullishCoalesce(char, () => ( "")), 16);
|
|
20248
|
+
if (!(code >= 32 && code <= 65535) || DINGBAT_FONT_RE.test(_nullishCoalesce(font, () => ( "")))) return "";
|
|
20249
|
+
if (/^\s*symbol\s*$/i.test(_nullishCoalesce(font, () => ( "")))) {
|
|
20250
|
+
const lo = code & 255;
|
|
20251
|
+
const c = lo >= 32 && lo <= 126 ? SYMBOL_LO[lo - 32] : lo >= 160 && lo <= 254 ? SYMBOL_HI[lo - 160] : "";
|
|
20252
|
+
return c === "\0" ? "" : c;
|
|
20253
|
+
}
|
|
20254
|
+
return code >= 61440 && code <= 61695 ? "" : String.fromCharCode(code);
|
|
20255
|
+
}
|
|
20256
|
+
|
|
20239
20257
|
// src/docx/parser.ts
|
|
20240
20258
|
|
|
20241
20259
|
|
|
@@ -20243,8 +20261,12 @@ var ListCounter = (_class2 = class {constructor() { _class2.prototype.__init4.ca
|
|
|
20243
20261
|
function runToLatex(r) {
|
|
20244
20262
|
let out = "";
|
|
20245
20263
|
for (const t of childrenByLocalName(r, "t")) out += _nullishCoalesce(t.textContent, () => ( ""));
|
|
20246
|
-
return out;
|
|
20264
|
+
return out.replace(/[#%]/g, "\\$&");
|
|
20265
|
+
}
|
|
20266
|
+
function join(a, b) {
|
|
20267
|
+
return /\\[A-Za-z]+$/.test(a) && /^[A-Za-z]/.test(b) ? a + " " + b : a + b;
|
|
20247
20268
|
}
|
|
20269
|
+
var EQ_NUMBER_RE = /\s*\\#\s*(?:\\left\((.+)\\right\)|\(([^()]*)\))\s*$/;
|
|
20248
20270
|
var FUNC_NAMES = /* @__PURE__ */ new Set([
|
|
20249
20271
|
"sin",
|
|
20250
20272
|
"cos",
|
|
@@ -20364,7 +20386,7 @@ function grp(body) {
|
|
|
20364
20386
|
function childrenToLatex(parent) {
|
|
20365
20387
|
let out = "";
|
|
20366
20388
|
for (const ch of elementChildren(parent)) {
|
|
20367
|
-
out
|
|
20389
|
+
out = join(out, nodeToLatex(ch));
|
|
20368
20390
|
}
|
|
20369
20391
|
return out;
|
|
20370
20392
|
}
|
|
@@ -20489,7 +20511,7 @@ function nodeToLatex(el) {
|
|
|
20489
20511
|
}
|
|
20490
20512
|
const items = childrenByLocalName(el, "e").map(childrenToLatex);
|
|
20491
20513
|
const body = items.join(sep);
|
|
20492
|
-
return "\\left" + mapDelim(beg, true)
|
|
20514
|
+
return join("\\left" + mapDelim(beg, true), body) + "\\right" + mapDelim(end, false);
|
|
20493
20515
|
}
|
|
20494
20516
|
// 행렬
|
|
20495
20517
|
case "m": {
|
|
@@ -20558,10 +20580,16 @@ function nodeToLatex(el) {
|
|
|
20558
20580
|
// group character (over/underset 비슷)
|
|
20559
20581
|
case "groupChr":
|
|
20560
20582
|
return childrenToLatex(_nullishCoalesce(findChildByLocalName(el, "e"), () => ( el)));
|
|
20561
|
-
//
|
|
20583
|
+
// 수식 배열 — 한 줄짜리 끝의 수식 번호 `#(43)` 는 \tag{43} (#106). 여러 줄은 종전대로 이어 붙인다
|
|
20584
|
+
case "eqArr": {
|
|
20585
|
+
const rows = childrenByLocalName(el, "e");
|
|
20586
|
+
const one = rows.length === 1 ? childrenToLatex(rows[0]) : "";
|
|
20587
|
+
const m = one.match(EQ_NUMBER_RE);
|
|
20588
|
+
return m ? one.slice(0, m.index) + " \\tag{" + (_nullishCoalesce(m[1], () => ( m[2]))).trim() + "}" : childrenToLatex(el);
|
|
20589
|
+
}
|
|
20590
|
+
// box/borderBox/phantom/… 는 자식 본문만 유지
|
|
20562
20591
|
case "borderBox":
|
|
20563
20592
|
case "phant":
|
|
20564
|
-
case "eqArr":
|
|
20565
20593
|
return childrenToLatex(el);
|
|
20566
20594
|
// 최상위 컨테이너
|
|
20567
20595
|
case "oMath":
|
|
@@ -20600,9 +20628,10 @@ function isDisplayMath(el) {
|
|
|
20600
20628
|
}
|
|
20601
20629
|
|
|
20602
20630
|
// src/docx/parser.ts
|
|
20603
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20631
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkKZVQK5NScjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20632
|
+
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
20604
20633
|
function matchesLocal(el, localName3) {
|
|
20605
|
-
return el.localName === localName3 || (_nullishCoalesce(_optionalChain([el, 'access',
|
|
20634
|
+
return el.localName === localName3 || (_nullishCoalesce(_optionalChain([el, 'access', _270 => _270.tagName, 'optionalAccess', _271 => _271.endsWith, 'call', _272 => _272(`:${localName3}`)]), () => ( false)));
|
|
20606
20635
|
}
|
|
20607
20636
|
function effectiveChildElements(parent) {
|
|
20608
20637
|
const result = [];
|
|
@@ -20618,7 +20647,7 @@ function effectiveChildElements(parent) {
|
|
|
20618
20647
|
result.push(...effectiveChildElements(c));
|
|
20619
20648
|
}
|
|
20620
20649
|
}
|
|
20621
|
-
} else if (matchesLocal(el, "ins") || matchesLocal(el, "smartTag")) {
|
|
20650
|
+
} else if (matchesLocal(el, "ins") || matchesLocal(el, "smartTag") || matchesLocal(el, "dir") || matchesLocal(el, "bdo")) {
|
|
20622
20651
|
result.push(...effectiveChildElements(el));
|
|
20623
20652
|
} else {
|
|
20624
20653
|
result.push(el);
|
|
@@ -20637,7 +20666,7 @@ function findElements(parent, localName3) {
|
|
|
20637
20666
|
const child = children[i];
|
|
20638
20667
|
if (child.nodeType === 1) {
|
|
20639
20668
|
const el = child;
|
|
20640
|
-
if (el.localName === localName3 || _optionalChain([el, 'access',
|
|
20669
|
+
if (el.localName === localName3 || _optionalChain([el, 'access', _273 => _273.tagName, 'optionalAccess', _274 => _274.endsWith, 'call', _275 => _275(`:${localName3}`)])) {
|
|
20641
20670
|
result.push(el);
|
|
20642
20671
|
}
|
|
20643
20672
|
walk(el);
|
|
@@ -20656,7 +20685,7 @@ function getAttr(el, localName3) {
|
|
|
20656
20685
|
return null;
|
|
20657
20686
|
}
|
|
20658
20687
|
function parseXml2(text) {
|
|
20659
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
20688
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkKZVQK5NScjs.stripDtd.call(void 0, text), "text/xml");
|
|
20660
20689
|
}
|
|
20661
20690
|
function parseStyles(xml) {
|
|
20662
20691
|
const doc = parseXml2(xml);
|
|
@@ -20708,10 +20737,10 @@ function parseStyles(xml) {
|
|
|
20708
20737
|
}
|
|
20709
20738
|
for (const [styleId, info] of styles) {
|
|
20710
20739
|
const seen = /* @__PURE__ */ new Set([styleId]);
|
|
20711
|
-
for (let cur = info.basedOn; info.numId === void 0 && cur && !seen.has(cur); cur = _optionalChain([styles, 'access',
|
|
20740
|
+
for (let cur = info.basedOn; info.numId === void 0 && cur && !seen.has(cur); cur = _optionalChain([styles, 'access', _276 => _276.get, 'call', _277 => _277(cur), 'optionalAccess', _278 => _278.basedOn])) {
|
|
20712
20741
|
seen.add(cur);
|
|
20713
20742
|
const parent = styles.get(cur);
|
|
20714
|
-
if (_optionalChain([parent, 'optionalAccess',
|
|
20743
|
+
if (_optionalChain([parent, 'optionalAccess', _279 => _279.numId]) !== void 0) {
|
|
20715
20744
|
info.numId = parent.numId;
|
|
20716
20745
|
info.ilvl ??= parent.ilvl;
|
|
20717
20746
|
}
|
|
@@ -20808,7 +20837,7 @@ function collectOmmlRoots(p) {
|
|
|
20808
20837
|
const child = children[i];
|
|
20809
20838
|
if (child.nodeType !== 1) continue;
|
|
20810
20839
|
const el = child;
|
|
20811
|
-
const tag = el.localName || _optionalChain([el, 'access',
|
|
20840
|
+
const tag = el.localName || _optionalChain([el, 'access', _280 => _280.tagName, 'optionalAccess', _281 => _281.replace, 'call', _282 => _282(/^[^:]+:/, "")]) || "";
|
|
20812
20841
|
if (tag === "oMath" || tag === "oMathPara") {
|
|
20813
20842
|
out.push(el);
|
|
20814
20843
|
} else if (tag === "txbxContent" || tag === "Fallback") {
|
|
@@ -20826,6 +20855,7 @@ function extractRun(r) {
|
|
|
20826
20855
|
if (matchesLocal(el, "t")) text += _nullishCoalesce(el.textContent, () => ( ""));
|
|
20827
20856
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
20828
20857
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
20858
|
+
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
20829
20859
|
}
|
|
20830
20860
|
let bold = false;
|
|
20831
20861
|
let italic = false;
|
|
@@ -20835,7 +20865,7 @@ function extractRun(r) {
|
|
|
20835
20865
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
20836
20866
|
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
20837
20867
|
const v = va ? getAttr(va, "val") : null;
|
|
20838
|
-
if (v === "superscript" || v === "subscript") text =
|
|
20868
|
+
if (v === "superscript" || v === "subscript") text = _chunkYIANW5QXcjs.wrapScript.call(void 0, text, v === "superscript" ? "sup" : "sub");
|
|
20839
20869
|
}
|
|
20840
20870
|
return { text, bold, italic };
|
|
20841
20871
|
}
|
|
@@ -20853,7 +20883,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
20853
20883
|
function makeLink(text, rawHref) {
|
|
20854
20884
|
if (!text) return "";
|
|
20855
20885
|
if (!rawHref) return text;
|
|
20856
|
-
const href =
|
|
20886
|
+
const href = _chunkKZVQK5NScjs.sanitizeHref.call(void 0, rawHref);
|
|
20857
20887
|
return href ? `[${text}](${href})` : text;
|
|
20858
20888
|
}
|
|
20859
20889
|
function collectInline(p, footnotes, rels) {
|
|
@@ -20876,7 +20906,19 @@ function collectInline(p, footnotes, rels) {
|
|
|
20876
20906
|
fieldInstr = "";
|
|
20877
20907
|
fieldDisplay = "";
|
|
20878
20908
|
};
|
|
20909
|
+
const placedMath = /* @__PURE__ */ new Set();
|
|
20910
|
+
const mathText = (om) => {
|
|
20911
|
+
const latex = ommlElementToLatex(om);
|
|
20912
|
+
return !latex ? "" : isDisplayMath(om) ? " $$" + latex + "$$ " : "$" + latex + "$";
|
|
20913
|
+
};
|
|
20879
20914
|
for (const el of effectiveChildElements(p)) {
|
|
20915
|
+
if (matchesLocal(el, "oMath") || matchesLocal(el, "oMathPara")) {
|
|
20916
|
+
placedMath.add(el);
|
|
20917
|
+
const m = mathText(el);
|
|
20918
|
+
if (fieldActive && fieldStage === "display") fieldDisplay += m;
|
|
20919
|
+
else parts.push(m);
|
|
20920
|
+
continue;
|
|
20921
|
+
}
|
|
20880
20922
|
if (matchesLocal(el, "hyperlink")) {
|
|
20881
20923
|
const rId = getAttr(el, "id");
|
|
20882
20924
|
const anchor = getAttr(el, "anchor");
|
|
@@ -20928,12 +20970,11 @@ function collectInline(p, footnotes, rels) {
|
|
|
20928
20970
|
}
|
|
20929
20971
|
flushField();
|
|
20930
20972
|
for (const om of collectOmmlRoots(p)) {
|
|
20931
|
-
|
|
20932
|
-
|
|
20933
|
-
if (
|
|
20934
|
-
else parts.push(" $" + latex + "$ ");
|
|
20973
|
+
if (placedMath.has(om)) continue;
|
|
20974
|
+
const m = mathText(om);
|
|
20975
|
+
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
20935
20976
|
}
|
|
20936
|
-
const text =
|
|
20977
|
+
const text = _chunkYIANW5QXcjs.tidyScriptTags.call(void 0, parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
20937
20978
|
return { text, bold, italic, footnoteText };
|
|
20938
20979
|
}
|
|
20939
20980
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -20960,14 +21001,14 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
20960
21001
|
}
|
|
20961
21002
|
const { text, bold: hasBold, italic: hasItalic, footnoteText } = collectInline(p, footnotes, rels);
|
|
20962
21003
|
const style = styles.get(styleId);
|
|
20963
|
-
if (!numId && _optionalChain([style, 'optionalAccess',
|
|
21004
|
+
if (!numId && _optionalChain([style, 'optionalAccess', _283 => _283.numId])) {
|
|
20964
21005
|
numId = style.numId;
|
|
20965
|
-
ilvl = _nullishCoalesce(_nullishCoalesce(style.ilvl, () => ( _optionalChain([[..._nullishCoalesce(_optionalChain([numbering, 'access',
|
|
21006
|
+
ilvl = _nullishCoalesce(_nullishCoalesce(style.ilvl, () => ( _optionalChain([[..._nullishCoalesce(_optionalChain([numbering, 'access', _284 => _284.get, 'call', _285 => _285(numId), 'optionalAccess', _286 => _286.values, 'call', _287 => _287()]), () => ( []))], 'access', _288 => _288.find, 'call', _289 => _289((l) => l.pStyle === styleId), 'optionalAccess', _290 => _290.level]))), () => ( ilvl));
|
|
20966
21007
|
}
|
|
20967
21008
|
const numDef = numId && numId !== "0" ? numbering.get(numId) : void 0;
|
|
20968
21009
|
const label = numDef ? counterOf(numbering).next(numId, ilvl, numDef) : void 0;
|
|
20969
21010
|
if (!text) return null;
|
|
20970
|
-
if (_optionalChain([style, 'optionalAccess',
|
|
21011
|
+
if (_optionalChain([style, 'optionalAccess', _291 => _291.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
|
|
20971
21012
|
return {
|
|
20972
21013
|
type: "heading",
|
|
20973
21014
|
text: label ? `${label} ${text}` : text,
|
|
@@ -21058,7 +21099,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21058
21099
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21059
21100
|
})
|
|
21060
21101
|
);
|
|
21061
|
-
const table2 =
|
|
21102
|
+
const table2 = _chunkGPC72VSFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21062
21103
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21063
21104
|
return { type: "table", table: table2 };
|
|
21064
21105
|
}
|
|
@@ -21068,10 +21109,10 @@ function collectCellText(tc2, styles, numbering, footnotes, rels, depth) {
|
|
|
21068
21109
|
for (const el of effectiveChildElements(tc2)) {
|
|
21069
21110
|
if (matchesLocal(el, "p")) {
|
|
21070
21111
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
21071
|
-
if (_optionalChain([block, 'optionalAccess',
|
|
21112
|
+
if (_optionalChain([block, 'optionalAccess', _292 => _292.text])) parts.push(block.text);
|
|
21072
21113
|
for (const tp of collectTextboxParagraphs(el)) {
|
|
21073
21114
|
const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
|
|
21074
|
-
if (_optionalChain([tb, 'optionalAccess',
|
|
21115
|
+
if (_optionalChain([tb, 'optionalAccess', _293 => _293.text])) parts.push(tb.text);
|
|
21075
21116
|
}
|
|
21076
21117
|
} else if (matchesLocal(el, "tbl")) {
|
|
21077
21118
|
for (const tr of getChildElements(el, "tr")) {
|
|
@@ -21083,7 +21124,7 @@ function collectCellText(tc2, styles, numbering, footnotes, rels, depth) {
|
|
|
21083
21124
|
}
|
|
21084
21125
|
return parts;
|
|
21085
21126
|
}
|
|
21086
|
-
async function buildImageMap(zip, rels, doc, warnings) {
|
|
21127
|
+
async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
21087
21128
|
const imageMap = /* @__PURE__ */ new Map();
|
|
21088
21129
|
const images = [];
|
|
21089
21130
|
let imgIdx = 0;
|
|
@@ -21104,9 +21145,10 @@ async function buildImageMap(zip, rels, doc, warnings) {
|
|
|
21104
21145
|
const imgFile = zip.file(imgPath);
|
|
21105
21146
|
if (!imgFile) continue;
|
|
21106
21147
|
try {
|
|
21107
|
-
|
|
21148
|
+
let data = null;
|
|
21149
|
+
if (readBytes) data = await imgFile.async("uint8array");
|
|
21108
21150
|
imgIdx++;
|
|
21109
|
-
const ext = _nullishCoalesce(_optionalChain([imgPath, 'access',
|
|
21151
|
+
const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _294 => _294.split, 'call', _295 => _295("."), 'access', _296 => _296.pop, 'call', _297 => _297(), 'optionalAccess', _298 => _298.toLowerCase, 'call', _299 => _299()]), () => ( "png"));
|
|
21110
21152
|
const mimeMap = {
|
|
21111
21153
|
png: "image/png",
|
|
21112
21154
|
jpg: "image/jpeg",
|
|
@@ -21120,8 +21162,10 @@ async function buildImageMap(zip, rels, doc, warnings) {
|
|
|
21120
21162
|
svg: "image/svg+xml"
|
|
21121
21163
|
};
|
|
21122
21164
|
const filename = `image_${String(imgIdx).padStart(3, "0")}.${ext}`;
|
|
21123
|
-
|
|
21124
|
-
|
|
21165
|
+
if (data) {
|
|
21166
|
+
const mimeType = _nullishCoalesce(_nullishCoalesce(mimeMap[ext], () => ( detectImageMime(data))), () => ( "application/octet-stream"));
|
|
21167
|
+
images.push({ filename, data, mimeType, source: imgPath });
|
|
21168
|
+
}
|
|
21125
21169
|
imageMap.set(embedId, filename);
|
|
21126
21170
|
} catch (err) {
|
|
21127
21171
|
warnings.push({
|
|
@@ -21202,12 +21246,13 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21202
21246
|
return out;
|
|
21203
21247
|
}
|
|
21204
21248
|
async function parseDocxDocument(buffer, options) {
|
|
21205
|
-
|
|
21249
|
+
const readImages = _optionalChain([options, 'optionalAccess', _300 => _300.images]) !== false;
|
|
21250
|
+
_chunkKZVQK5NScjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5, void 0, { re: MEDIA_PART_RE, skip: !readImages });
|
|
21206
21251
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21207
21252
|
const warnings = [];
|
|
21208
21253
|
const docFile = zip.file("word/document.xml");
|
|
21209
21254
|
if (!docFile) {
|
|
21210
|
-
throw new (0,
|
|
21255
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21211
21256
|
}
|
|
21212
21257
|
let rels = /* @__PURE__ */ new Map();
|
|
21213
21258
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21254,15 +21299,15 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21254
21299
|
const doc = parseXml2(docXml);
|
|
21255
21300
|
const body = findElements(doc, "body");
|
|
21256
21301
|
if (body.length === 0) {
|
|
21257
|
-
throw new (0,
|
|
21302
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21258
21303
|
}
|
|
21259
|
-
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
|
|
21304
|
+
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
21260
21305
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
21261
21306
|
const blocks = [];
|
|
21262
21307
|
const bodyEl = body[0];
|
|
21263
21308
|
const topLevel = effectiveChildElements(bodyEl);
|
|
21264
21309
|
for (const el of topLevel) {
|
|
21265
|
-
const localName3 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access',
|
|
21310
|
+
const localName3 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _301 => _301.tagName, 'optionalAccess', _302 => _302.split, 'call', _303 => _303(":"), 'access', _304 => _304.pop, 'call', _305 => _305()])));
|
|
21266
21311
|
if (localName3 === "p") {
|
|
21267
21312
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
21268
21313
|
if (block) blocks.push(block);
|
|
@@ -21273,7 +21318,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21273
21318
|
if (imageMap.size > 0) emitParagraphImages(tp, imageMap, linkedImages, blocks);
|
|
21274
21319
|
}
|
|
21275
21320
|
} else if (localName3 === "tbl") {
|
|
21276
|
-
const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess',
|
|
21321
|
+
const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess', _306 => _306.keepTrailingEmptyCols]));
|
|
21277
21322
|
if (block) blocks.push(block);
|
|
21278
21323
|
}
|
|
21279
21324
|
}
|
|
@@ -21307,7 +21352,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21307
21352
|
}
|
|
21308
21353
|
}
|
|
21309
21354
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21310
|
-
const markdown =
|
|
21355
|
+
const markdown = _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
21311
21356
|
return {
|
|
21312
21357
|
markdown,
|
|
21313
21358
|
blocks,
|
|
@@ -21325,11 +21370,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
21325
21370
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
21326
21371
|
function parseHwpmlDocument(buffer, options) {
|
|
21327
21372
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
21328
|
-
throw new (0,
|
|
21373
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
21329
21374
|
}
|
|
21330
21375
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
21331
21376
|
const normalized = text.replace(/ /g, " ");
|
|
21332
|
-
const xml =
|
|
21377
|
+
const xml = _chunkKZVQK5NScjs.stripDtd.call(void 0, normalized);
|
|
21333
21378
|
const warnings = [];
|
|
21334
21379
|
const parser = new (0, _xmldom.DOMParser)({
|
|
21335
21380
|
onError: (_level, msg2) => {
|
|
@@ -21357,7 +21402,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
21357
21402
|
return { markdown: "", blocks: [], metadata, warnings };
|
|
21358
21403
|
}
|
|
21359
21404
|
const blocks = [];
|
|
21360
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
21405
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _307 => _307.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
|
|
21361
21406
|
let sectionIdx = 0;
|
|
21362
21407
|
const children = body.childNodes;
|
|
21363
21408
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -21366,10 +21411,10 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
21366
21411
|
if (localName(el) !== "SECTION") continue;
|
|
21367
21412
|
sectionIdx++;
|
|
21368
21413
|
if (pageFilter && !pageFilter.has(sectionIdx)) continue;
|
|
21369
|
-
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
21414
|
+
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _308 => _308.keepTrailingEmptyCols]), () => ( false)));
|
|
21370
21415
|
}
|
|
21371
21416
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
21372
|
-
const markdown =
|
|
21417
|
+
const markdown = _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
21373
21418
|
return {
|
|
21374
21419
|
markdown,
|
|
21375
21420
|
blocks,
|
|
@@ -21455,7 +21500,7 @@ function parseParagraph3(el, blocks, paraShapeMap, sectionNum) {
|
|
|
21455
21500
|
const shapeInfo = paraShapeMap.get(paraShapeId);
|
|
21456
21501
|
const text = extractParagraphText(el);
|
|
21457
21502
|
if (!text) return;
|
|
21458
|
-
if (_optionalChain([shapeInfo, 'optionalAccess',
|
|
21503
|
+
if (_optionalChain([shapeInfo, 'optionalAccess', _309 => _309.headingLevel]) != null) {
|
|
21459
21504
|
blocks.push({ type: "heading", text, level: shapeInfo.headingLevel, pageNumber: sectionNum });
|
|
21460
21505
|
} else {
|
|
21461
21506
|
blocks.push({ type: "paragraph", text, pageNumber: sectionNum });
|
|
@@ -21536,11 +21581,11 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
21536
21581
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
21537
21582
|
cellRows[r].push(cell2);
|
|
21538
21583
|
}
|
|
21539
|
-
const table2 =
|
|
21584
|
+
const table2 = _chunkGPC72VSFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
21540
21585
|
if (structured.length > 0) {
|
|
21541
21586
|
const claimed = /* @__PURE__ */ new Set();
|
|
21542
21587
|
for (const { ctx, cellBlocks } of structured) {
|
|
21543
|
-
let target = _optionalChain([table2, 'access',
|
|
21588
|
+
let target = _optionalChain([table2, 'access', _310 => _310.cells, 'access', _311 => _311[_nullishCoalesce(ctx.rowAddr, () => ( -1))], 'optionalAccess', _312 => _312[_nullishCoalesce(ctx.colAddr, () => ( -1))]]);
|
|
21544
21589
|
if (!target || claimed.has(target) || target.text !== ctx.text) {
|
|
21545
21590
|
target = void 0;
|
|
21546
21591
|
outer: for (const irRow of table2.cells) {
|
|
@@ -21845,7 +21890,7 @@ function fillInCellPatterns(cellText, values, matchedLabels, blockedLabels) {
|
|
|
21845
21890
|
(match, prefix, suffix) => {
|
|
21846
21891
|
const label = prefix + suffix;
|
|
21847
21892
|
const normalizedLabel = normalizeLabel(label);
|
|
21848
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
21893
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _313 => _313.has, 'call', _314 => _314(normalizedLabel)])) return match;
|
|
21849
21894
|
const matchKey = values.available(normalizedLabel) ? normalizedLabel : values.available(normalizeLabel(prefix)) ? normalizeLabel(prefix) : void 0;
|
|
21850
21895
|
if (matchKey === void 0) return match;
|
|
21851
21896
|
const newValue = values.consume(matchKey);
|
|
@@ -21924,17 +21969,17 @@ function matchInlineSegment(seg, values, blockedLabels) {
|
|
|
21924
21969
|
const nlabel = normalizeLabel(seg.label);
|
|
21925
21970
|
if (seg.extLabel !== void 0) {
|
|
21926
21971
|
const nExt = normalizeLabel(seg.extLabel);
|
|
21927
|
-
if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess',
|
|
21972
|
+
if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess', _315 => _315.has, 'call', _316 => _316(nExt)]) && values.has(nExt)) {
|
|
21928
21973
|
return { key: nExt, label: seg.extLabel, viaExt: true };
|
|
21929
21974
|
}
|
|
21930
21975
|
}
|
|
21931
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
21976
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _317 => _317.has, 'call', _318 => _318(nlabel)])) return void 0;
|
|
21932
21977
|
const key = findMatchingKey(nlabel, values);
|
|
21933
21978
|
return key !== void 0 ? { key, label: seg.label, viaExt: false } : void 0;
|
|
21934
21979
|
}
|
|
21935
21980
|
function clampSegmentEnd(text, seg, next, nextViaExt) {
|
|
21936
21981
|
let ve = seg.valueEnd;
|
|
21937
|
-
if (nextViaExt && _optionalChain([next, 'optionalAccess',
|
|
21982
|
+
if (nextViaExt && _optionalChain([next, 'optionalAccess', _319 => _319.extStart]) !== void 0 && next.extStart < ve) ve = next.extStart;
|
|
21938
21983
|
while (ve > seg.valueStart && /\s/.test(text[ve - 1])) ve--;
|
|
21939
21984
|
return ve;
|
|
21940
21985
|
}
|
|
@@ -21949,7 +21994,7 @@ function normalizeValues(values, warnings) {
|
|
|
21949
21994
|
const { value, format: format2 } = typeof raw === "object" && !Array.isArray(raw) ? raw : { value: raw, format: void 0 };
|
|
21950
21995
|
const key = normalizeLabel(label);
|
|
21951
21996
|
if (map.has(key)) {
|
|
21952
|
-
_optionalChain([warnings, 'optionalAccess',
|
|
21997
|
+
_optionalChain([warnings, 'optionalAccess', _320 => _320.push, 'call', _321 => _321(`\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`)]);
|
|
21953
21998
|
}
|
|
21954
21999
|
map.set(key, Array.isArray(value) ? value.map((v) => formatFillValue(v, format2)) : formatFillValue(value, format2));
|
|
21955
22000
|
}
|
|
@@ -22126,7 +22171,7 @@ function collectTables(blocks, out = [], depth = 0) {
|
|
|
22126
22171
|
if (block.type !== "table" || !block.table) continue;
|
|
22127
22172
|
out.push(block.table);
|
|
22128
22173
|
for (const row of block.table.cells) {
|
|
22129
|
-
for (const cell2 of row) if (_optionalChain([cell2, 'optionalAccess',
|
|
22174
|
+
for (const cell2 of row) if (_optionalChain([cell2, 'optionalAccess', _322 => _322.blocks, 'optionalAccess', _323 => _323.length])) collectTables(cell2.blocks, out, depth + 1);
|
|
22130
22175
|
}
|
|
22131
22176
|
}
|
|
22132
22177
|
return out;
|
|
@@ -22136,8 +22181,8 @@ function extractFromTable(table2) {
|
|
|
22136
22181
|
if (table2.cols >= 2) {
|
|
22137
22182
|
for (let r = 0; r < table2.rows; r++) {
|
|
22138
22183
|
for (let c = 0; c < table2.cols - 1; c++) {
|
|
22139
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
22140
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
22184
|
+
const labelCell = _optionalChain([table2, 'access', _324 => _324.cells, 'access', _325 => _325[r], 'optionalAccess', _326 => _326[c]]);
|
|
22185
|
+
const valueCell = _optionalChain([table2, 'access', _327 => _327.cells, 'access', _328 => _328[r], 'optionalAccess', _329 => _329[c + 1]]);
|
|
22141
22186
|
if (!labelCell || !valueCell) continue;
|
|
22142
22187
|
if (isLabelCell(labelCell.text)) {
|
|
22143
22188
|
fields.push({
|
|
@@ -22152,15 +22197,15 @@ function extractFromTable(table2) {
|
|
|
22152
22197
|
}
|
|
22153
22198
|
if (fields.length === 0 && table2.rows >= 2 && table2.cols >= 2) {
|
|
22154
22199
|
const headerRow = table2.cells[0];
|
|
22155
|
-
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess',
|
|
22156
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
22200
|
+
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _330 => _330.every, 'call', _331 => _331((cell2) => {
|
|
22201
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _332 => _332.text, 'access', _333 => _333.trim, 'call', _334 => _334()]), () => ( ""));
|
|
22157
22202
|
return t.length > 0 && t.length <= 20;
|
|
22158
22203
|
})]), () => ( false));
|
|
22159
22204
|
if (allLabels) {
|
|
22160
22205
|
for (let r = 1; r < table2.rows; r++) {
|
|
22161
22206
|
for (let c = 0; c < table2.cols; c++) {
|
|
22162
|
-
const label = _nullishCoalesce(_optionalChain([headerRow, 'access',
|
|
22163
|
-
const value = _nullishCoalesce(_optionalChain([table2, 'access',
|
|
22207
|
+
const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _335 => _335[c], 'optionalAccess', _336 => _336.text, 'access', _337 => _337.trim, 'call', _338 => _338()]), () => ( ""));
|
|
22208
|
+
const value = _nullishCoalesce(_optionalChain([table2, 'access', _339 => _339.cells, 'access', _340 => _340[r], 'optionalAccess', _341 => _341[c], 'optionalAccess', _342 => _342.text, 'access', _343 => _343.trim, 'call', _344 => _344()]), () => ( ""));
|
|
22164
22209
|
if (label && value) {
|
|
22165
22210
|
fields.push({ label, value, row: r, col: c });
|
|
22166
22211
|
}
|
|
@@ -22254,7 +22299,7 @@ function fillFormFields(blocks, values, blockedLabels) {
|
|
|
22254
22299
|
for (const table2 of allTables) {
|
|
22255
22300
|
for (let r = 0; r < table2.rows; r++) {
|
|
22256
22301
|
for (let c = 0; c < table2.cols; c++) {
|
|
22257
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
22302
|
+
const cell2 = _optionalChain([table2, 'access', _345 => _345.cells, 'access', _346 => _346[r], 'optionalAccess', _347 => _347[c]]);
|
|
22258
22303
|
if (!cell2) continue;
|
|
22259
22304
|
const result = fillInCellPatterns(cell2.text, cursor, matchedLabels, blockedLabels);
|
|
22260
22305
|
if (result) {
|
|
@@ -22286,7 +22331,7 @@ function collectIRTables(blocks, depth) {
|
|
|
22286
22331
|
out.push(block.table);
|
|
22287
22332
|
for (const row of block.table.cells) {
|
|
22288
22333
|
for (const cell2 of row) {
|
|
22289
|
-
if (_optionalChain([cell2, 'optionalAccess',
|
|
22334
|
+
if (_optionalChain([cell2, 'optionalAccess', _348 => _348.blocks, 'optionalAccess', _349 => _349.length])) out.push(...collectIRTables(cell2.blocks, depth + 1));
|
|
22290
22335
|
}
|
|
22291
22336
|
}
|
|
22292
22337
|
}
|
|
@@ -22297,7 +22342,7 @@ function coveredPositions(table2) {
|
|
|
22297
22342
|
for (let r = 0; r < table2.rows; r++) {
|
|
22298
22343
|
for (let c = 0; c < table2.cols; c++) {
|
|
22299
22344
|
if (covered.has(`${r},${c}`)) continue;
|
|
22300
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
22345
|
+
const cell2 = _optionalChain([table2, 'access', _350 => _350.cells, 'access', _351 => _351[r], 'optionalAccess', _352 => _352[c]]);
|
|
22301
22346
|
if (!cell2) continue;
|
|
22302
22347
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
22303
22348
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -22313,15 +22358,15 @@ function coveredPositions(table2) {
|
|
|
22313
22358
|
function isHeaderDataTable(table2, covered) {
|
|
22314
22359
|
if (table2.rows < 2) return false;
|
|
22315
22360
|
const headerRow = table2.cells[0];
|
|
22316
|
-
if (!_optionalChain([headerRow, 'optionalAccess',
|
|
22361
|
+
if (!_optionalChain([headerRow, 'optionalAccess', _353 => _353.length])) return false;
|
|
22317
22362
|
const allLabels = headerRow.every((cell2) => {
|
|
22318
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
22363
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _354 => _354.text, 'access', _355 => _355.trim, 'call', _356 => _356()]), () => ( ""));
|
|
22319
22364
|
return t.length > 0 && t.length <= 20 && isLabelCell(t);
|
|
22320
22365
|
});
|
|
22321
22366
|
if (!allLabels) return false;
|
|
22322
22367
|
for (let c = 0; c < table2.cols; c++) {
|
|
22323
22368
|
if (covered.has(`1,${c}`)) continue;
|
|
22324
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
22369
|
+
const cell2 = _optionalChain([table2, 'access', _357 => _357.cells, 'access', _358 => _358[1], 'optionalAccess', _359 => _359[c]]);
|
|
22325
22370
|
if (!cell2) break;
|
|
22326
22371
|
return !isLabelCell(cell2.text);
|
|
22327
22372
|
}
|
|
@@ -22334,7 +22379,7 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
22334
22379
|
for (let r = skipHeaderRow ? 1 : 0; r < table2.rows; r++) {
|
|
22335
22380
|
for (let c = 0; c < table2.cols; c++) {
|
|
22336
22381
|
if (covered.has(`${r},${c}`)) continue;
|
|
22337
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
22382
|
+
const labelCell = _optionalChain([table2, 'access', _360 => _360.cells, 'access', _361 => _361[r], 'optionalAccess', _362 => _362[c]]);
|
|
22338
22383
|
if (!labelCell) continue;
|
|
22339
22384
|
if (!isLabelCell(labelCell.text)) continue;
|
|
22340
22385
|
let vc = c + labelCell.colSpan;
|
|
@@ -22345,12 +22390,12 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
22345
22390
|
if (isKeywordLabel(valueCell.text)) continue;
|
|
22346
22391
|
const normalizedCellLabel = normalizeLabel(labelCell.text);
|
|
22347
22392
|
if (!normalizedCellLabel) continue;
|
|
22348
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
22393
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _363 => _363.has, 'call', _364 => _364(normalizedCellLabel)])) continue;
|
|
22349
22394
|
const matchKey = findMatchingKey(normalizedCellLabel, values);
|
|
22350
22395
|
if (matchKey === void 0) continue;
|
|
22351
22396
|
const newValue = values.consume(matchKey);
|
|
22352
22397
|
if (newValue === void 0) continue;
|
|
22353
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
22398
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _365 => _365.has, 'call', _366 => _366(valueCell)])) {
|
|
22354
22399
|
valueCell.text = newValue + " " + valueCell.text;
|
|
22355
22400
|
} else {
|
|
22356
22401
|
valueCell.text = newValue;
|
|
@@ -22367,8 +22412,8 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
22367
22412
|
}
|
|
22368
22413
|
if (table2.rows >= 2 && table2.cols >= 2) {
|
|
22369
22414
|
const headerRow = table2.cells[0];
|
|
22370
|
-
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess',
|
|
22371
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
22415
|
+
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _367 => _367.every, 'call', _368 => _368((cell2) => {
|
|
22416
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _369 => _369.text, 'access', _370 => _370.trim, 'call', _371 => _371()]), () => ( ""));
|
|
22372
22417
|
return t.length > 0 && t.length <= 20 && isLabelCell(t);
|
|
22373
22418
|
})]), () => ( false));
|
|
22374
22419
|
if (!allLabels) return;
|
|
@@ -22376,16 +22421,16 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
22376
22421
|
for (let c = 0; c < table2.cols; c++) {
|
|
22377
22422
|
if (covered.has(`${r},${c}`)) continue;
|
|
22378
22423
|
const headerCell = headerRow[c];
|
|
22379
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
22424
|
+
const valueCell = _optionalChain([table2, 'access', _372 => _372.cells, 'access', _373 => _373[r], 'optionalAccess', _374 => _374[c]]);
|
|
22380
22425
|
if (!headerCell || !valueCell) continue;
|
|
22381
22426
|
const headerLabel = normalizeLabel(headerCell.text);
|
|
22382
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
22427
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _375 => _375.has, 'call', _376 => _376(headerLabel)])) continue;
|
|
22383
22428
|
const matchKey = findMatchingKey(headerLabel, values);
|
|
22384
22429
|
if (matchKey === void 0) continue;
|
|
22385
22430
|
if (!values.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
22386
22431
|
const newValue = values.consume(matchKey);
|
|
22387
22432
|
if (newValue === void 0) continue;
|
|
22388
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
22433
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _377 => _377.has, 'call', _378 => _378(valueCell)])) {
|
|
22389
22434
|
valueCell.text = newValue + " " + valueCell.text;
|
|
22390
22435
|
} else {
|
|
22391
22436
|
valueCell.text = newValue;
|
|
@@ -22417,7 +22462,7 @@ function fillInlineFields(text, values, filled, matchedLabels, blockedLabels) {
|
|
|
22417
22462
|
if (newValue === void 0) continue;
|
|
22418
22463
|
matchedLabels.add(matchKey);
|
|
22419
22464
|
filled.push({ label: matched.label.trim(), value: newValue, row: -1, col: -1, key: matchKey });
|
|
22420
|
-
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access',
|
|
22465
|
+
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _379 => _379[i + 1], 'optionalAccess', _380 => _380.viaExt]), () => ( false)));
|
|
22421
22466
|
out += text.slice(pos, seg.valueStart);
|
|
22422
22467
|
out += seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
|
|
22423
22468
|
pos = ve;
|
|
@@ -23047,7 +23092,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
23047
23092
|
const splices = [];
|
|
23048
23093
|
for (const region of scanClickHereRegions(xml)) {
|
|
23049
23094
|
const key = normalizeLabel(region.name);
|
|
23050
|
-
if (!key || _optionalChain([blockedLabels, 'optionalAccess',
|
|
23095
|
+
if (!key || _optionalChain([blockedLabels, 'optionalAccess', _381 => _381.has, 'call', _382 => _382(key)])) continue;
|
|
23051
23096
|
if (!cursor.has(key)) continue;
|
|
23052
23097
|
const value = cursor.consume(key);
|
|
23053
23098
|
if (value === void 0) continue;
|
|
@@ -23072,7 +23117,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
23072
23117
|
};
|
|
23073
23118
|
}
|
|
23074
23119
|
async function extractClickHereFields(hwpxBuffer) {
|
|
23075
|
-
|
|
23120
|
+
_chunkKZVQK5NScjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
23076
23121
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
23077
23122
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
23078
23123
|
const fields = [];
|
|
@@ -23120,19 +23165,19 @@ function parseCentralDirectory(buf) {
|
|
|
23120
23165
|
}
|
|
23121
23166
|
}
|
|
23122
23167
|
}
|
|
23123
|
-
if (eocdOffset < 0) throw new (0,
|
|
23168
|
+
if (eocdOffset < 0) throw new (0, _chunkKZVQK5NScjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
23124
23169
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
23125
23170
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
23126
23171
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
23127
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
23172
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkKZVQK5NScjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23128
23173
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
23129
|
-
throw new (0,
|
|
23174
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23130
23175
|
}
|
|
23131
23176
|
const decoder = new TextDecoder("utf-8");
|
|
23132
23177
|
const entries = [];
|
|
23133
23178
|
let pos = cdOffset;
|
|
23134
23179
|
for (let i = 0; i < totalEntries; i++) {
|
|
23135
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
23180
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkKZVQK5NScjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
23136
23181
|
const flags = view.getUint16(pos + 8, true);
|
|
23137
23182
|
const method = view.getUint16(pos + 10, true);
|
|
23138
23183
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -23143,7 +23188,7 @@ function parseCentralDirectory(buf) {
|
|
|
23143
23188
|
const commentLen = view.getUint16(pos + 32, true);
|
|
23144
23189
|
const localOffset = view.getUint32(pos + 42, true);
|
|
23145
23190
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
23146
|
-
throw new (0,
|
|
23191
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23147
23192
|
}
|
|
23148
23193
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
23149
23194
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -23172,11 +23217,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23172
23217
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
23173
23218
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
23174
23219
|
for (const name of replacements.keys()) {
|
|
23175
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
23220
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkKZVQK5NScjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
23176
23221
|
}
|
|
23177
23222
|
if (additions) {
|
|
23178
23223
|
for (const name of additions.keys()) {
|
|
23179
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
23224
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkKZVQK5NScjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
23180
23225
|
}
|
|
23181
23226
|
}
|
|
23182
23227
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -23195,7 +23240,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23195
23240
|
offset += seg.length;
|
|
23196
23241
|
continue;
|
|
23197
23242
|
}
|
|
23198
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
23243
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkKZVQK5NScjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
23199
23244
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
23200
23245
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
23201
23246
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -23203,7 +23248,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23203
23248
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
23204
23249
|
const method = e.method;
|
|
23205
23250
|
if (method !== 0 && method !== 8) {
|
|
23206
|
-
throw new (0,
|
|
23251
|
+
throw new (0, _chunkKZVQK5NScjs.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`);
|
|
23207
23252
|
}
|
|
23208
23253
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
23209
23254
|
const crc = crc32(newData);
|
|
@@ -23301,11 +23346,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23301
23346
|
// src/form/filler-hwpx.ts
|
|
23302
23347
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
23303
23348
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
23304
|
-
|
|
23349
|
+
_chunkKZVQK5NScjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
23305
23350
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
23306
23351
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
23307
23352
|
if (sectionPaths.length === 0) {
|
|
23308
|
-
throw new (0,
|
|
23353
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
23309
23354
|
}
|
|
23310
23355
|
const warnings = [];
|
|
23311
23356
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -23404,7 +23449,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
23404
23449
|
if (isKeywordLabel(cellLabelText(valueCell))) continue;
|
|
23405
23450
|
const normalizedCellLabel = normalizeLabel(labelText);
|
|
23406
23451
|
if (!normalizedCellLabel) continue;
|
|
23407
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
23452
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _383 => _383.has, 'call', _384 => _384(normalizedCellLabel)])) continue;
|
|
23408
23453
|
const matchKey = findMatchingKey(normalizedCellLabel, cursor);
|
|
23409
23454
|
if (matchKey === void 0) continue;
|
|
23410
23455
|
if (patternApplied.has(valueCell)) {
|
|
@@ -23462,7 +23507,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
23462
23507
|
const dataCells = table2.rows[rowIdx];
|
|
23463
23508
|
for (let colIdx = 0; colIdx < Math.min(headerCells.length, dataCells.length); colIdx++) {
|
|
23464
23509
|
const headerLabel = normalizeLabel(cellLabelText(headerCells[colIdx]));
|
|
23465
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
23510
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _385 => _385.has, 'call', _386 => _386(headerLabel)])) continue;
|
|
23466
23511
|
const matchKey = findMatchingKey(headerLabel, cursor);
|
|
23467
23512
|
if (matchKey === void 0) continue;
|
|
23468
23513
|
if (!cursor.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
@@ -23516,7 +23561,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
23516
23561
|
}
|
|
23517
23562
|
for (const para2 of [...scan.bodyParagraphs, ...scan.excludedParagraphs]) {
|
|
23518
23563
|
const existing = ledger.get(para2);
|
|
23519
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
23564
|
+
if (_optionalChain([existing, 'optionalAccess', _387 => _387.fullText]) !== void 0) continue;
|
|
23520
23565
|
const text = matchText(para2);
|
|
23521
23566
|
const segments = scanInlineSegments(text);
|
|
23522
23567
|
const matches = segments.map((seg) => matchInlineSegment(seg, cursor, blockedLabels));
|
|
@@ -23527,7 +23572,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
23527
23572
|
const matchKey = matched.key;
|
|
23528
23573
|
const newValue = cursor.consume(matchKey);
|
|
23529
23574
|
if (newValue === void 0) continue;
|
|
23530
|
-
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access',
|
|
23575
|
+
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _388 => _388[i + 1], 'optionalAccess', _389 => _389.viaExt]), () => ( false)));
|
|
23531
23576
|
const replacement = seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
|
|
23532
23577
|
const l = led(para2);
|
|
23533
23578
|
l.ranges.push({ start: seg.valueStart, end: ve, replacement });
|
|
@@ -23605,7 +23650,7 @@ var DIAGRAM_KEYWORDS = /조직도|비상\s*연락망|연락망|체계도|업무\
|
|
|
23605
23650
|
var KEYWORD_GATE = 0.3;
|
|
23606
23651
|
function cellType(cell2) {
|
|
23607
23652
|
const t = cell2.text.trim();
|
|
23608
|
-
if (!t && !_optionalChain([cell2, 'access',
|
|
23653
|
+
if (!t && !_optionalChain([cell2, 'access', _390 => _390.blocks, 'optionalAccess', _391 => _391.length])) return "empty";
|
|
23609
23654
|
if (!t) return "short";
|
|
23610
23655
|
if (/^[-+]?[\d,]+(\.\d+)?\s*(%|원|명|건|개|천원|백만원|㎡|㎢|kg|km|시간|일)?$/u.test(t)) return "number";
|
|
23611
23656
|
if (/^\d{2,4}[.\-/년]\s*\d{1,2}[.\-/월]?(\s*\d{1,2}[.일]?)?\.?$/u.test(t)) return "date";
|
|
@@ -23617,7 +23662,7 @@ function anchors(table2) {
|
|
|
23617
23662
|
for (let r = 0; r < table2.rows; r++) {
|
|
23618
23663
|
for (let c = 0; c < table2.cols; c++) {
|
|
23619
23664
|
if (covered.has(`${r},${c}`)) continue;
|
|
23620
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
23665
|
+
const cell2 = _optionalChain([table2, 'access', _392 => _392.cells, 'access', _393 => _393[r], 'optionalAccess', _394 => _394[c]]);
|
|
23621
23666
|
if (!cell2) continue;
|
|
23622
23667
|
for (let dr = 0; dr < cell2.rowSpan; dr++) for (let dc = 0; dc < cell2.colSpan; dc++) if (dr || dc) covered.add(`${r + dr},${c + dc}`);
|
|
23623
23668
|
out.push({ r, c, cell: cell2, type: cellType(cell2) });
|
|
@@ -23627,8 +23672,8 @@ function anchors(table2) {
|
|
|
23627
23672
|
}
|
|
23628
23673
|
function isWrapper(table2) {
|
|
23629
23674
|
if (table2.rows !== 1 || table2.cols !== 1) return false;
|
|
23630
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
23631
|
-
return !!_optionalChain([cell2, 'optionalAccess',
|
|
23675
|
+
const cell2 = _optionalChain([table2, 'access', _395 => _395.cells, 'access', _396 => _396[0], 'optionalAccess', _397 => _397[0]]);
|
|
23676
|
+
return !!_optionalChain([cell2, 'optionalAccess', _398 => _398.blocks, 'optionalAccess', _399 => _399.some, 'call', _400 => _400((b) => b.type === "table" && b.table)]);
|
|
23632
23677
|
}
|
|
23633
23678
|
function round2(v) {
|
|
23634
23679
|
return Math.round(v * 100) / 100;
|
|
@@ -23694,7 +23739,7 @@ function classifyTable(table2, ctx = {}) {
|
|
|
23694
23739
|
const emptyShare = 1 - activeRatio;
|
|
23695
23740
|
let semantic = (0.35 * repeatedRowSchema + 0.25 * gridRegularity + 0.2 * Math.min(1, activeRatio / 0.7) + 0.2 * columnTypeConsistency) * (1 - 0.6 * Math.max(0, emptyShare - 0.2) / 0.8) * (1 - spacerBands) * (1 - 0.5 * spanIrregularity);
|
|
23696
23741
|
let nonTabular = 0.6 * spanIrregularity + 0.4 * spacerBands + 0.5 * sparsity;
|
|
23697
|
-
const nestedCells = A.filter((a) => _optionalChain([a, 'access',
|
|
23742
|
+
const nestedCells = A.filter((a) => _optionalChain([a, 'access', _401 => _401.cell, 'access', _402 => _402.blocks, 'optionalAccess', _403 => _403.some, 'call', _404 => _404((b) => b.type === "table" && b.table)])).length;
|
|
23698
23743
|
if (nestedCells && nestedCells >= A.length * 0.5) {
|
|
23699
23744
|
nonTabular += 0.25;
|
|
23700
23745
|
reasons.push("nested-structure-wrapper");
|
|
@@ -23755,8 +23800,8 @@ function classifyTableTree(blocks) {
|
|
|
23755
23800
|
return blocks;
|
|
23756
23801
|
}
|
|
23757
23802
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
23758
|
-
const structured = hasMerged(table2) ||
|
|
23759
|
-
if (opts.smartVisual && _optionalChain([table2, 'access',
|
|
23803
|
+
const structured = hasMerged(table2) || _chunkGPC72VSFcjs.hasStructuredCellContent.call(void 0, table2);
|
|
23804
|
+
if (opts.smartVisual && _optionalChain([table2, 'access', _405 => _405.classification, 'optionalAccess', _406 => _406.kind]) === "non-tabular-layout") return "visual";
|
|
23760
23805
|
return structured ? "html" : "gfm";
|
|
23761
23806
|
}
|
|
23762
23807
|
|
|
@@ -25027,11 +25072,10 @@ var FONTS = {
|
|
|
25027
25072
|
function hasFontMetrics(face) {
|
|
25028
25073
|
return !!face && Object.prototype.hasOwnProperty.call(FONTS, face.trim());
|
|
25029
25074
|
}
|
|
25030
|
-
function
|
|
25075
|
+
function fontWidthFn(face) {
|
|
25076
|
+
if (!hasFontMetrics(face)) return null;
|
|
25031
25077
|
const m = FONTS[face.trim()];
|
|
25032
|
-
|
|
25033
|
-
if (cp >= 32 && cp <= 126) return m.ascii[cp - 32];
|
|
25034
|
-
return _nullishCoalesce(m.ex[cp], () => ( m.cjk));
|
|
25078
|
+
return (cp) => cp >= 32 && cp <= 126 ? m.ascii[cp - 32] : _nullishCoalesce(m.ex[cp], () => ( m.cjk));
|
|
25035
25079
|
}
|
|
25036
25080
|
|
|
25037
25081
|
// src/hwpx/text-metrics.ts
|
|
@@ -25219,9 +25263,9 @@ function fixedPitchWidthEm1000(cp) {
|
|
|
25219
25263
|
function widthFnOf(faceClass) {
|
|
25220
25264
|
if (faceClass === "fixedPitch") return fixedPitchWidthEm1000;
|
|
25221
25265
|
if (faceClass === "gothic") return gothicWidthEm1000;
|
|
25222
|
-
if (_optionalChain([faceClass, 'optionalAccess',
|
|
25266
|
+
if (_optionalChain([faceClass, 'optionalAccess', _407 => _407.startsWith, 'call', _408 => _408("font:")])) {
|
|
25223
25267
|
const face = faceClass.slice(5);
|
|
25224
|
-
return
|
|
25268
|
+
return _nullishCoalesce(fontWidthFn(face), () => ( gothicWidthEm1000));
|
|
25225
25269
|
}
|
|
25226
25270
|
return charWidthEm1000;
|
|
25227
25271
|
}
|
|
@@ -25229,9 +25273,9 @@ function isSpaceCp(cp) {
|
|
|
25229
25273
|
return cp === 32 || cp === 160;
|
|
25230
25274
|
}
|
|
25231
25275
|
function measureTextWidth(text, height, ratioPct, opts) {
|
|
25232
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
25233
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
25234
|
-
const widthEm = widthFnOf(_optionalChain([opts, 'optionalAccess',
|
|
25276
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _409 => _409.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
25277
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _410 => _410.spacingPct]), () => ( 0));
|
|
25278
|
+
const widthEm = widthFnOf(_optionalChain([opts, 'optionalAccess', _411 => _411.faceClass]));
|
|
25235
25279
|
let em = 0;
|
|
25236
25280
|
for (const ch of text) {
|
|
25237
25281
|
const cp = ch.codePointAt(0);
|
|
@@ -25244,11 +25288,11 @@ var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u
|
|
|
25244
25288
|
var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
|
|
25245
25289
|
function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
|
|
25246
25290
|
const EPS = 0.5;
|
|
25247
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
25248
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
25249
|
-
const widthEm = widthFnOf(_optionalChain([opts, 'optionalAccess',
|
|
25291
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _412 => _412.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
25292
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _413 => _413.spacingPct]), () => ( 0));
|
|
25293
|
+
const widthEm = widthFnOf(_optionalChain([opts, 'optionalAccess', _414 => _414.faceClass]));
|
|
25250
25294
|
const k = height * ratioPct / 100 / 1e3;
|
|
25251
|
-
const unitW = _optionalChain([opts, 'optionalAccess',
|
|
25295
|
+
const unitW = _optionalChain([opts, 'optionalAccess', _415 => _415.widths]);
|
|
25252
25296
|
const charWAt = (i, ch) => {
|
|
25253
25297
|
if (unitW) return (_nullishCoalesce(unitW[i], () => ( 0))) + (ch.length === 2 ? _nullishCoalesce(unitW[i + 1], () => ( 0)) : 0);
|
|
25254
25298
|
const cp = ch.codePointAt(0);
|
|
@@ -25272,7 +25316,8 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
25272
25316
|
const breakBefore = (unitPos, w) => {
|
|
25273
25317
|
let bp = unitPos;
|
|
25274
25318
|
const u = text[unitPos];
|
|
25275
|
-
|
|
25319
|
+
const prevStart = (end) => end - (end >= 2 && /[\uDC00-\uDFFF]/.test(text[end - 1]) && /[\uD800-\uDBFF]/.test(text[end - 2]) ? 2 : 1);
|
|
25320
|
+
if (u !== void 0 && FORBID_START.has(u) && prevStart(bp) > lineStart() && text[bp - 1] !== " ") bp = prevStart(bp);
|
|
25276
25321
|
while (bp - 1 > lineStart() && FORBID_END.has(text[bp - 1])) bp--;
|
|
25277
25322
|
if (bp <= lineStart()) bp = unitPos;
|
|
25278
25323
|
starts.push(bp);
|
|
@@ -25491,16 +25536,16 @@ var PARA_LIST = 7;
|
|
|
25491
25536
|
var DEFAULT_TEXT_COLOR = "#000000";
|
|
25492
25537
|
function resolveTheme(theme) {
|
|
25493
25538
|
return {
|
|
25494
|
-
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
25495
|
-
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
25496
|
-
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
25497
|
-
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
25498
|
-
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
25499
|
-
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
25539
|
+
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _416 => _416.headingColors, 'optionalAccess', _417 => _417[1]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
25540
|
+
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _418 => _418.headingColors, 'optionalAccess', _419 => _419[2]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
25541
|
+
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _420 => _420.headingColors, 'optionalAccess', _421 => _421[3]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
25542
|
+
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _422 => _422.headingColors, 'optionalAccess', _423 => _423[4]]), () => ( _optionalChain([theme, 'optionalAccess', _424 => _424.headingColors, 'optionalAccess', _425 => _425[3]]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
25543
|
+
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _426 => _426.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
25544
|
+
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _427 => _427.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
25500
25545
|
/** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
|
|
25501
|
-
hasQuoteOption: _optionalChain([theme, 'optionalAccess',
|
|
25502
|
-
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
25503
|
-
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess',
|
|
25546
|
+
hasQuoteOption: _optionalChain([theme, 'optionalAccess', _428 => _428.quoteColor]) !== void 0,
|
|
25547
|
+
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _429 => _429.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _430 => _430.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
25548
|
+
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _431 => _431.tableHeaderBold])
|
|
25504
25549
|
};
|
|
25505
25550
|
}
|
|
25506
25551
|
function escapeXml(text) {
|
|
@@ -25750,28 +25795,49 @@ function fitParagraph(text, font, pt2, firstW, contW, minRatio = 88, orphanRatio
|
|
|
25750
25795
|
const ladder = [[100, 0], ...SQUEEZE.filter(([r]) => r >= minRatio)];
|
|
25751
25796
|
const base = simulateWrap(text, f, c, h, 100, "keep", { faceClass });
|
|
25752
25797
|
if (base.lines < 2) return null;
|
|
25798
|
+
const wraps = /* @__PURE__ */ new Map([["100:0", base]]);
|
|
25799
|
+
const looseness = /* @__PURE__ */ new Map();
|
|
25800
|
+
const wrap = (r, sp) => {
|
|
25801
|
+
const key = `${r}:${sp}`;
|
|
25802
|
+
let w = wraps.get(key);
|
|
25803
|
+
if (!w) {
|
|
25804
|
+
w = simulateWrap(text, f, c, h, r, "keep", { faceClass, spacingPct: sp });
|
|
25805
|
+
wraps.set(key, w);
|
|
25806
|
+
}
|
|
25807
|
+
return w;
|
|
25808
|
+
};
|
|
25809
|
+
const looseAt = (r, sp, w) => {
|
|
25810
|
+
const key = `${r}:${sp}`;
|
|
25811
|
+
let loose = looseness.get(key);
|
|
25812
|
+
if (loose === void 0) {
|
|
25813
|
+
loose = worstLooseness(text, w.starts, f, c, h, r, sp, faceClass);
|
|
25814
|
+
looseness.set(key, loose);
|
|
25815
|
+
}
|
|
25816
|
+
return loose;
|
|
25817
|
+
};
|
|
25753
25818
|
if (base.lastLineWidth <= c * PULL_TAIL) {
|
|
25754
25819
|
let pull = null;
|
|
25755
25820
|
for (const [r, sp] of ladder) {
|
|
25756
25821
|
const amt = squeezeOf(r, sp);
|
|
25757
25822
|
if (amt > PULL_MAX + 1e-9 || pull && amt >= pull.amt - 1e-9) continue;
|
|
25758
|
-
const w =
|
|
25759
|
-
if (w.lines < base.lines &&
|
|
25823
|
+
const w = wrap(r, sp);
|
|
25824
|
+
if (w.lines < base.lines && looseAt(r, sp, w) <= LOOSE_LIMIT) pull = { r, sp, amt };
|
|
25760
25825
|
}
|
|
25761
25826
|
if (pull) return { ratio: pull.r, spacing: pull.sp };
|
|
25762
25827
|
}
|
|
25763
25828
|
let baseLines = 0;
|
|
25764
25829
|
let best = null;
|
|
25765
25830
|
for (const [r, sp] of ladder) {
|
|
25766
|
-
const w =
|
|
25831
|
+
const w = wrap(r, sp);
|
|
25767
25832
|
if (!best) {
|
|
25768
25833
|
if (w.lines < 2) return null;
|
|
25769
25834
|
baseLines = w.lines;
|
|
25770
25835
|
}
|
|
25771
25836
|
if (w.lines > baseLines) continue;
|
|
25772
25837
|
const orphan = w.lines > 1 && w.lastLineWidth <= contW * orphanRatio;
|
|
25773
|
-
const loose =
|
|
25838
|
+
const loose = looseAt(r, sp, w);
|
|
25774
25839
|
const cost = Math.max(0, loose - LOOSE_LIMIT) + (orphan ? ORPHAN_COST : 0) + squeezeOf(r, sp) * COMPRESS_COST;
|
|
25840
|
+
if (r === 100 && sp === 0 && cost === 0) return null;
|
|
25775
25841
|
if (!best || cost < best.cost - 1e-9) best = { r, sp, cost };
|
|
25776
25842
|
}
|
|
25777
25843
|
return best && (best.r !== 100 || best.sp !== 0) ? { ratio: best.r, spacing: best.sp } : null;
|
|
@@ -25915,7 +25981,7 @@ function buildDocFootTable(f, ctx, internal) {
|
|
|
25915
25981
|
const titleW = (t) => Math.max(unitW[0], Math.round(measureTextWidth(t, 1e3, 100, { faceClass: "fixedPitch" })) + 280 + unit + 300);
|
|
25916
25982
|
const widths = [];
|
|
25917
25983
|
for (let i = 0; i < n; i++) {
|
|
25918
|
-
widths.push(titleW(_nullishCoalesce(_optionalChain([f, 'access',
|
|
25984
|
+
widths.push(titleW(_nullishCoalesce(_optionalChain([f, 'access', _432 => _432.approvers, 'access', _433 => _433[i], 'optionalAccess', _434 => _434.title]), () => ( ""))), unitW[1]);
|
|
25919
25985
|
if (i < n - 1) widths.push(unitW[2]);
|
|
25920
25986
|
}
|
|
25921
25987
|
const used = widths.reduce((a, b) => a + b, 0);
|
|
@@ -26081,8 +26147,8 @@ function buildSummaryBox(text, ctx) {
|
|
|
26081
26147
|
let lines = 0;
|
|
26082
26148
|
const paras = bodies.map((b) => {
|
|
26083
26149
|
const f = fitParagraph(b, frame.summaryFont, frame.summaryPt, avail, avail);
|
|
26084
|
-
const c = reg.char({ font: frame.summaryFont, pt: frame.summaryPt, bold: true, ratio: _nullishCoalesce(_optionalChain([f, 'optionalAccess',
|
|
26085
|
-
lines += simulateWrap(b, avail * 0.995, avail * 0.995, frame.summaryPt * 100, _nullishCoalesce(_optionalChain([f, 'optionalAccess',
|
|
26150
|
+
const c = reg.char({ font: frame.summaryFont, pt: frame.summaryPt, bold: true, ratio: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _435 => _435.ratio]), () => ( 100)), spacing: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _436 => _436.spacing]), () => ( 0)) });
|
|
26151
|
+
lines += simulateWrap(b, avail * 0.995, avail * 0.995, frame.summaryPt * 100, _nullishCoalesce(_optionalChain([f, 'optionalAccess', _437 => _437.ratio]), () => ( 100)), "keep", { faceClass: faceClassForGen(frame.summaryFont), spacingPct: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _438 => _438.spacing]), () => ( 0)) }).lines;
|
|
26086
26152
|
return para(b, p, c);
|
|
26087
26153
|
});
|
|
26088
26154
|
const h = lines * Math.round(frame.summaryPt * 100 * 1.6) + 280 + 600;
|
|
@@ -26105,20 +26171,20 @@ function buildApprovalSeoul(labels, names, ctx) {
|
|
|
26105
26171
|
r: col === n - 1 ? "thick" : "thin"
|
|
26106
26172
|
});
|
|
26107
26173
|
const top = labels.map((l, c) => tc({ bf: edge(0, c), row: 0, col: c, w: colW, h: 1765, paras: para(l, center, c12) })).join("");
|
|
26108
|
-
const sign = labels.map((_, c) => tc({ bf: edge(1, c), row: 1, col: c, w: colW, h: 4200, paras: para(_nullishCoalesce(_optionalChain([names, 'optionalAccess',
|
|
26174
|
+
const sign = labels.map((_, c) => tc({ bf: edge(1, c), row: 1, col: c, w: colW, h: 4200, paras: para(_nullishCoalesce(_optionalChain([names, 'optionalAccess', _439 => _439[c]]), () => ( "")), center, c12b) })).join("");
|
|
26109
26175
|
return host(ftbl([top, sign], w, 5965, n, { bottomGap: 600 }), reg.para({ align: "RIGHT", lineSp: 100 }), c12);
|
|
26110
26176
|
}
|
|
26111
26177
|
function buildReportCover(inp, ctx) {
|
|
26112
26178
|
const { reg, bf, frame } = ctx;
|
|
26113
26179
|
const out = [];
|
|
26114
26180
|
const cv = frame.cover;
|
|
26115
|
-
const c12 = reg.char({ font: _nullishCoalesce(_optionalChain([cv, 'optionalAccess',
|
|
26116
|
-
const c12b = reg.char({ font: _nullishCoalesce(_optionalChain([cv, 'optionalAccess',
|
|
26181
|
+
const c12 = reg.char({ font: _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _440 => _440.infoFont]), () => ( "\uD55C\uCEF4\uB3CB\uC6C0")), pt: _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _441 => _441.infoValuePt]), () => ( 12)) });
|
|
26182
|
+
const c12b = reg.char({ font: _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _442 => _442.infoFont]), () => ( "\uD55C\uCEF4\uB3CB\uC6C0")), pt: _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _443 => _443.infoLabelPt]), () => ( 12)), bold: true });
|
|
26117
26183
|
const cAppr = cv ? reg.char({ font: cv.infoFont, pt: cv.approvalPt }) : c12;
|
|
26118
26184
|
const center = reg.para({ align: "CENTER", lineSp: 100 });
|
|
26119
26185
|
const centerAt = (k) => cv ? reg.para({ align: "CENTER", lineSp: cv.lineSp[k] }) : center;
|
|
26120
26186
|
const blank2 = (pt2 = 15) => para("", reg.para({ align: "LEFT", lineSp: 160 }), reg.char({ font: "\uD55C\uCEF4\uB3CB\uC6C0", pt: pt2 }));
|
|
26121
|
-
const infoRows = [["\uBB38\uC11C\uBC88\uD638", _nullishCoalesce(_optionalChain([inp, 'access',
|
|
26187
|
+
const infoRows = [["\uBB38\uC11C\uBC88\uD638", _nullishCoalesce(_optionalChain([inp, 'access', _444 => _444.docInfo, 'optionalAccess', _445 => _445.docNum]), () => ( ""))], ["\uACB0\uC7AC\uC77C\uC790", _nullishCoalesce(_optionalChain([inp, 'access', _446 => _446.docInfo, 'optionalAccess', _447 => _447.date]), () => ( ""))], ["\uACF5\uAC1C\uC5EC\uBD80", _nullishCoalesce(_optionalChain([inp, 'access', _448 => _448.docInfo, 'optionalAccess', _449 => _449.disclosure]), () => ( ""))], ["\uBC29\uCE68\uBC88\uD638", _nullishCoalesce(_optionalChain([inp, 'access', _450 => _450.docInfo, 'optionalAccess', _451 => _451.policyNo]), () => ( ""))]];
|
|
26122
26188
|
const infoW = Math.round(ctx.W * 0.36);
|
|
26123
26189
|
const [lw, vw] = scale([4200, 12800], infoW);
|
|
26124
26190
|
const infoXml = ftbl(infoRows.map(
|
|
@@ -26137,7 +26203,7 @@ function buildReportCover(inp, ctx) {
|
|
|
26137
26203
|
for (let i = 0; i < 4; i++) out.push(blank2(20));
|
|
26138
26204
|
const w = ctx.W - 1200;
|
|
26139
26205
|
const bar = bf.get({ t: "none", b: "none", l: "none", r: "none", fill: cv ? { gradient: [...cv.bar.gradient], type: "LINEAR", angle: 90 } : "#1F2FD6" });
|
|
26140
|
-
const barH = _nullishCoalesce(_optionalChain([cv, 'optionalAccess',
|
|
26206
|
+
const barH = _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _452 => _452.bar, 'access', _453 => _453.h]), () => ( 200));
|
|
26141
26207
|
const fit = fitOneLine(inp.title, frame.titleFont, 27, w - 800, 22);
|
|
26142
26208
|
const cT = reg.char({ font: frame.titleFont, pt: fit.pt, bold: true, ratio: fit.ratio, spacing: fit.spacing });
|
|
26143
26209
|
const c1 = reg.char({ font: "\uD55C\uCEF4\uB3CB\uC6C0", pt: 1 });
|
|
@@ -26413,7 +26479,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
26413
26479
|
}
|
|
26414
26480
|
function assertFiniteRange(name, value, min, max) {
|
|
26415
26481
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
26416
|
-
throw new (0,
|
|
26482
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
26417
26483
|
}
|
|
26418
26484
|
}
|
|
26419
26485
|
function validateGongmunOptions(opts) {
|
|
@@ -26428,10 +26494,10 @@ function validateGongmunOptions(opts) {
|
|
|
26428
26494
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
26429
26495
|
}
|
|
26430
26496
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
26431
|
-
throw new (0,
|
|
26497
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
26432
26498
|
}
|
|
26433
26499
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
26434
|
-
throw new (0,
|
|
26500
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
26435
26501
|
}
|
|
26436
26502
|
}
|
|
26437
26503
|
if (opts.sizes) {
|
|
@@ -26440,24 +26506,24 @@ function validateGongmunOptions(opts) {
|
|
|
26440
26506
|
}
|
|
26441
26507
|
}
|
|
26442
26508
|
if (opts.approval && opts.approval.length > 6) {
|
|
26443
|
-
throw new (0,
|
|
26509
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("approval must contain at most 6 labels");
|
|
26444
26510
|
}
|
|
26445
26511
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
26446
26512
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
26447
26513
|
for (const n of nums) {
|
|
26448
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
26514
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkKZVQK5NScjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
26449
26515
|
}
|
|
26450
26516
|
}
|
|
26451
26517
|
if (opts.levels) {
|
|
26452
26518
|
for (const [key, st] of Object.entries(opts.levels)) {
|
|
26453
26519
|
const depth = Number(key);
|
|
26454
26520
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
26455
|
-
throw new (0,
|
|
26521
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
26456
26522
|
}
|
|
26457
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
26523
|
+
if (!st || typeof st !== "object") throw new (0, _chunkKZVQK5NScjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
26458
26524
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
26459
26525
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
26460
|
-
throw new (0,
|
|
26526
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
26461
26527
|
}
|
|
26462
26528
|
}
|
|
26463
26529
|
}
|
|
@@ -26469,7 +26535,7 @@ function resolveLevels(levels, bodyHeight) {
|
|
|
26469
26535
|
for (const [key, st] of Object.entries(levels)) {
|
|
26470
26536
|
if (st.font === void 0 && st.pt === void 0 && st.bold === void 0) continue;
|
|
26471
26537
|
out[Number(key)] = {
|
|
26472
|
-
font: _optionalChain([st, 'access',
|
|
26538
|
+
font: _optionalChain([st, 'access', _454 => _454.font, 'optionalAccess', _455 => _455.trim, 'call', _456 => _456()]) || null,
|
|
26473
26539
|
height: st.pt !== void 0 ? Math.round(st.pt * 100) : bodyHeight,
|
|
26474
26540
|
bold: !!st.bold
|
|
26475
26541
|
};
|
|
@@ -26477,7 +26543,7 @@ function resolveLevels(levels, bodyHeight) {
|
|
|
26477
26543
|
return Object.keys(out).length > 0 ? out : null;
|
|
26478
26544
|
}
|
|
26479
26545
|
function levelMarkerHeight(g3, depth) {
|
|
26480
|
-
return _nullishCoalesce(_optionalChain([g3, 'access',
|
|
26546
|
+
return _nullishCoalesce(_optionalChain([g3, 'access', _457 => _457.levels, 'optionalAccess', _458 => _458[depth], 'optionalAccess', _459 => _459.height]), () => ( g3.bodyHeight));
|
|
26481
26547
|
}
|
|
26482
26548
|
function incompatibleGongmunWarnings(opts) {
|
|
26483
26549
|
const warns = [];
|
|
@@ -26512,7 +26578,7 @@ function resolveChecklist(c, preset) {
|
|
|
26512
26578
|
function hexColorOption(name, value) {
|
|
26513
26579
|
if (value === void 0) return void 0;
|
|
26514
26580
|
const v = value.trim();
|
|
26515
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
26581
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkKZVQK5NScjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
26516
26582
|
return v.toUpperCase();
|
|
26517
26583
|
}
|
|
26518
26584
|
function resolveGongmun(opts) {
|
|
@@ -26541,7 +26607,7 @@ function resolveGongmun(opts) {
|
|
|
26541
26607
|
bodyPtExplicit: opts.bodyPt !== void 0,
|
|
26542
26608
|
lineSpacingExplicit: opts.lineSpacing !== void 0,
|
|
26543
26609
|
bodyFontExplicit: opts.bodyFont !== void 0,
|
|
26544
|
-
summary: _optionalChain([opts, 'access',
|
|
26610
|
+
summary: _optionalChain([opts, 'access', _460 => _460.summary, 'optionalAccess', _461 => _461.trim, 'call', _462 => _462()]) || null,
|
|
26545
26611
|
docInfo: _nullishCoalesce(opts.docInfo, () => ( null)),
|
|
26546
26612
|
checklist: resolveChecklist(opts.checklist, preset),
|
|
26547
26613
|
toc: preset !== "press" && (_nullishCoalesce(opts.toc, () => ( (gaejosik || ministry)))),
|
|
@@ -26572,7 +26638,7 @@ function resolveGongmun(opts) {
|
|
|
26572
26638
|
suppressSingle: _nullishCoalesce(opts.suppressSingle, () => ( false)),
|
|
26573
26639
|
docHead: preset === "official" && opts.docHead ? opts.docHead : null,
|
|
26574
26640
|
docFoot: preset === "official" && opts.docFoot ? opts.docFoot : null,
|
|
26575
|
-
reportInfo: _optionalChain([opts, 'access',
|
|
26641
|
+
reportInfo: _optionalChain([opts, 'access', _463 => _463.reportInfo, 'optionalAccess', _464 => _464.trim, 'call', _465 => _465()]) || null,
|
|
26576
26642
|
noticeHead: preset === "notice" && opts.noticeHead ? opts.noticeHead : null,
|
|
26577
26643
|
// 보도자료 머리박스는 프리셋 자체가 요구 — 옵션 미지정이어도 빈 객체
|
|
26578
26644
|
press: preset === "press" ? _nullishCoalesce(opts.press, () => ( {})) : null
|
|
@@ -26899,7 +26965,7 @@ function parseInlineMarkdown(text) {
|
|
|
26899
26965
|
else spans.push(...emphasisSpans(m[0]));
|
|
26900
26966
|
} else {
|
|
26901
26967
|
const anchor = m[2] || m[3];
|
|
26902
|
-
const href = _nullishCoalesce(
|
|
26968
|
+
const href = _nullishCoalesce(_chunkKZVQK5NScjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
26903
26969
|
const sub = emphasisSpans(anchor);
|
|
26904
26970
|
if (href) for (const s of sub) s.href = href;
|
|
26905
26971
|
spans.push(...sub);
|
|
@@ -27065,8 +27131,8 @@ function resolvePage(opts) {
|
|
|
27065
27131
|
// 실측: 용지 치수는 방향과 무관하게 유지, 방향은 landscape 속성만 바뀐다
|
|
27066
27132
|
landscape: orientation === "landscape" ? "NARROWLY" : "WIDELY",
|
|
27067
27133
|
columns: cols,
|
|
27068
|
-
header: _optionalChain([header, 'optionalAccess',
|
|
27069
|
-
footer: _optionalChain([footer, 'optionalAccess',
|
|
27134
|
+
header: _optionalChain([header, 'optionalAccess', _466 => _466.trim, 'call', _467 => _467()]) ? header.trim() : null,
|
|
27135
|
+
footer: _optionalChain([footer, 'optionalAccess', _468 => _468.trim, 'call', _469 => _469()]) ? footer.trim() : null
|
|
27070
27136
|
};
|
|
27071
27137
|
}
|
|
27072
27138
|
function columnColPrXml(columns) {
|
|
@@ -27113,7 +27179,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
27113
27179
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
27114
27180
|
const got = m ? Number(m[1]) : NaN;
|
|
27115
27181
|
if (got !== startId + i) {
|
|
27116
|
-
throw new (0,
|
|
27182
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(
|
|
27117
27183
|
`\uB0B4\uBD80 \uC624\uB958: ${label} id \uD30C\uD2F0\uC158 \uB4DC\uB9AC\uD504\uD2B8 \u2014 ${startId + i} \uC704\uCE58\uC5D0 id=${m ? m[1] : "?"} \uBC29\uCD9C. id \uC0C1\uC218(gen-ids)\uC640 \uC2E4\uC81C \uBC29\uCD9C \uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4 (GJ_CHAR_COUNT\uB958 \uCE74\uC6B4\uD2B8\xB7base \uC0B0\uC220 \uD655\uC778)`
|
|
27118
27184
|
);
|
|
27119
27185
|
}
|
|
@@ -27204,7 +27270,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
27204
27270
|
}
|
|
27205
27271
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
27206
27272
|
if (rows.length !== expectedBase) {
|
|
27207
|
-
throw new (0,
|
|
27273
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(
|
|
27208
27274
|
`\uB0B4\uBD80 \uC624\uB958: charPr \uAE30\uBCF8 \uBE14\uB85D \uBC29\uCD9C \uC218(${rows.length}) \u2260 charVariantBase(${expectedBase}) \u2014 gen-header \uBC29\uCD9C \uD589\uACFC gen-ids \uCE74\uC6B4\uD2B8 \uC0C1\uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4`
|
|
27209
27275
|
);
|
|
27210
27276
|
}
|
|
@@ -27431,7 +27497,7 @@ var TAB_PROPS_GONGMUN = `<hh:tabProperties itemCnt="2">
|
|
|
27431
27497
|
<hh:tabPr id="1" autoTabLeft="1" autoTabRight="0"/>
|
|
27432
27498
|
</hh:tabProperties>`;
|
|
27433
27499
|
function generateHeaderXml(theme, gongmun, ratioVariants = [], extraBorderFills = [], extraCharPrXmls = [], listIndentVariants = [], extraFonts = [], v5 = null) {
|
|
27434
|
-
const bodyFace = _nullishCoalesce(_nullishCoalesce(_optionalChain([v5, 'optionalAccess',
|
|
27500
|
+
const bodyFace = _nullishCoalesce(_nullishCoalesce(_optionalChain([v5, 'optionalAccess', _470 => _470.bodyFace]), () => ( _optionalChain([gongmun, 'optionalAccess', _471 => _471.fonts, 'access', _472 => _472.body]))), () => ( (_optionalChain([gongmun, 'optionalAccess', _473 => _473.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
|
|
27435
27501
|
const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants, extraCharPrXmls, !!v5);
|
|
27436
27502
|
const paraPropsXml = v5 ? buildParaPropertiesV5(gongmun, v5.paraPrXmls) : buildParaProperties(gongmun, gongmun ? listIndentVariants : []);
|
|
27437
27503
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
@@ -27560,8 +27626,8 @@ function parseChartFence(text) {
|
|
|
27560
27626
|
const spec = chartSpec(type);
|
|
27561
27627
|
let finalSeries = spec.pie ? [series[0]] : series;
|
|
27562
27628
|
finalSeries = finalSeries.map((s) => ({ ...s }));
|
|
27563
|
-
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
27564
|
-
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
27629
|
+
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _474 => _474.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
|
|
27630
|
+
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _475 => _475[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
|
|
27565
27631
|
if (!spec.scatter) {
|
|
27566
27632
|
finalSeries = finalSeries.map((s) => ({ ...s, values: catFinal.map((_, i) => _nullishCoalesce(s.values[i], () => ( 0))) }));
|
|
27567
27633
|
}
|
|
@@ -27603,7 +27669,7 @@ function serSpPr(color, stroke) {
|
|
|
27603
27669
|
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>`;
|
|
27604
27670
|
}
|
|
27605
27671
|
function dPtXml(pointColors, pie) {
|
|
27606
|
-
if (!_optionalChain([pointColors, 'optionalAccess',
|
|
27672
|
+
if (!_optionalChain([pointColors, 'optionalAccess', _476 => _476.length])) return "";
|
|
27607
27673
|
return pointColors.map((col, i) => {
|
|
27608
27674
|
const f = chartColorFill(col);
|
|
27609
27675
|
if (!f) return "";
|
|
@@ -27681,7 +27747,7 @@ function computeGongmunFitPlan(blocks, gongmun, gongmunList) {
|
|
|
27681
27747
|
if (block.type === "list_item" && gongmunList.items.has(i)) {
|
|
27682
27748
|
const { marker, depth, indentVariant } = gongmunList.items.get(i);
|
|
27683
27749
|
if (gongmun.numbering === "gaejosik" && (depth === 0 || (block.text || "").trimStart().startsWith("\u203B"))) continue;
|
|
27684
|
-
if (_optionalChain([gongmun, 'access',
|
|
27750
|
+
if (_optionalChain([gongmun, 'access', _477 => _477.levels, 'optionalAccess', _478 => _478[depth]])) continue;
|
|
27685
27751
|
const content = plainRenderText(block.text || "");
|
|
27686
27752
|
text = marker ? `${marker} ${content}` : content;
|
|
27687
27753
|
const li = levelIndent(depth, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, usesAsteriskThird(gongmun.preset));
|
|
@@ -27844,8 +27910,8 @@ function buildGaejosikCover(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH) {
|
|
|
27844
27910
|
const botRow = cell({ bf: GJ_BF_BAR_DARK, col: 0, row: 2, w: g3.botDarkW, h: g3.botBarH, paras: barEmpty }) + cell({ bf: GJ_BF_BAR_LIGHT, col: 1, colSpan: 2, row: 2, w: g3.botLightW, h: g3.botBarH, paras: barEmpty });
|
|
27845
27911
|
const tbl2 = table([topRow, titleRow, botRow], g3.totalW, g3.barH + g3.titleH + g3.botBarH, 3, 1, bodyWidth);
|
|
27846
27912
|
const host2 = `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${tbl2}</hp:run></hp:p>`;
|
|
27847
|
-
const date = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
27848
|
-
const org = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
27913
|
+
const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _479 => _479.cover, 'optionalAccess', _480 => _480.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
|
|
27914
|
+
const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _481 => _481.cover, 'optionalAccess', _482 => _482.org]), () => ( ""));
|
|
27849
27915
|
const sub = (t) => `<hp:p paraPrIDRef="${GJ_PARA_COVER}" styleIDRef="0"><hp:run charPrIDRef="${GJ_CHAR_COVER_SUB}"><hp:t>${escapeTextXml(t)}</hp:t></hp:run></hp:p>`;
|
|
27850
27916
|
const subEmpty = emptyPara(GJ_PARA_COVER, false, GJ_CHAR_COVER_SUB);
|
|
27851
27917
|
return [
|
|
@@ -27898,7 +27964,7 @@ function buildGaejosikBodyTitle(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH)
|
|
|
27898
27964
|
var CHAPTER_FIT_PAD = 282 + 300;
|
|
27899
27965
|
function buildGaejosikChapter(n, title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH, srcLevel = 2) {
|
|
27900
27966
|
const g3 = gongmun ? chapterGeom(gongmun.bodyHeight, gongmun.sizes, bodyWidth) : chapterGeom(1500, {}, bodyWidth);
|
|
27901
|
-
const titleW = _optionalChain([gongmun, 'optionalAccess',
|
|
27967
|
+
const titleW = _optionalChain([gongmun, 'optionalAccess', _483 => _483.chapterFit]) ? Math.min(g3.titleW, Math.ceil(measureTextWidth(
|
|
27902
27968
|
` ${title} `,
|
|
27903
27969
|
gaejosikSizes(gongmun.bodyHeight, gongmun.sizes).chapter,
|
|
27904
27970
|
100,
|
|
@@ -28116,7 +28182,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
28116
28182
|
}
|
|
28117
28183
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
28118
28184
|
function sanitizeText(text) {
|
|
28119
|
-
let result =
|
|
28185
|
+
let result = _chunkGPC72VSFcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
28120
28186
|
if (result.length <= 30 && result.includes(" ")) {
|
|
28121
28187
|
const tokens = result.split(" ");
|
|
28122
28188
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -28146,10 +28212,10 @@ function replicateGfmTable(table2) {
|
|
|
28146
28212
|
for (let r = 0; r < numRows; r++) {
|
|
28147
28213
|
for (let c = 0; c < numCols; c++) {
|
|
28148
28214
|
if (skip.has(`${r},${c}`)) continue;
|
|
28149
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
28215
|
+
const cell2 = _optionalChain([cells, 'access', _484 => _484[r], 'optionalAccess', _485 => _485[c]]);
|
|
28150
28216
|
if (!cell2) continue;
|
|
28151
28217
|
display[r][c] = {
|
|
28152
|
-
text:
|
|
28218
|
+
text: _chunkGPC72VSFcjs.escapeGfm.call(void 0, sanitizeText(cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\n/g, "<br>"),
|
|
28153
28219
|
gridR: r,
|
|
28154
28220
|
gridC: c
|
|
28155
28221
|
};
|
|
@@ -28200,18 +28266,18 @@ function unescapeGfmCell(text) {
|
|
|
28200
28266
|
return text.replace(/(?<!\\)<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*_`#<$\\])/g, "$1");
|
|
28201
28267
|
}
|
|
28202
28268
|
function replicateCellInnerHtml(cell2) {
|
|
28203
|
-
if (_optionalChain([cell2, 'access',
|
|
28269
|
+
if (_optionalChain([cell2, 'access', _486 => _486.blocks, 'optionalAccess', _487 => _487.length])) {
|
|
28204
28270
|
return cell2.blocks.map((b) => {
|
|
28205
28271
|
if (b.type === "table" && b.table) {
|
|
28206
28272
|
const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
|
|
28207
|
-
return (cap ?
|
|
28273
|
+
return (cap ? _chunkGPC72VSFcjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
28208
28274
|
}
|
|
28209
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
28275
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkKZVQK5NScjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
28210
28276
|
const t = sanitizeText(_nullishCoalesce(b.text, () => ( "")));
|
|
28211
|
-
return t ?
|
|
28277
|
+
return t ? _chunkGPC72VSFcjs.escapeHtmlCellText.call(void 0, t + _chunkGPC72VSFcjs.noteSuffix.call(void 0, b)).replace(/\n/g, "<br>") : "";
|
|
28212
28278
|
}).filter(Boolean).join("<br>");
|
|
28213
28279
|
}
|
|
28214
|
-
return
|
|
28280
|
+
return _chunkGPC72VSFcjs.escapeHtmlCellText.call(void 0, sanitizeText(cell2.text)).replace(/\n/g, "<br>");
|
|
28215
28281
|
}
|
|
28216
28282
|
function replicateTableToHtml(table2) {
|
|
28217
28283
|
const rows = replicateHtmlTable(table2);
|
|
@@ -28239,7 +28305,7 @@ function replicateHtmlTable(table2) {
|
|
|
28239
28305
|
const rowCells = [];
|
|
28240
28306
|
for (let c = 0; c < numCols; c++) {
|
|
28241
28307
|
if (skip.has(`${r},${c}`)) continue;
|
|
28242
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
28308
|
+
const cell2 = _optionalChain([cells, 'access', _488 => _488[r], 'optionalAccess', _489 => _489[c]]);
|
|
28243
28309
|
if (!cell2) continue;
|
|
28244
28310
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
28245
28311
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -28285,10 +28351,10 @@ function parseHtmlTable(raw) {
|
|
|
28285
28351
|
}
|
|
28286
28352
|
} else {
|
|
28287
28353
|
if (!isClose) {
|
|
28288
|
-
const cs = parseInt(_optionalChain([attrs, 'access',
|
|
28289
|
-
const rs = parseInt(_optionalChain([attrs, 'access',
|
|
28354
|
+
const cs = parseInt(_optionalChain([attrs, 'access', _490 => _490.match, 'call', _491 => _491(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _492 => _492[1]]) || "1", 10);
|
|
28355
|
+
const rs = parseInt(_optionalChain([attrs, 'access', _493 => _493.match, 'call', _494 => _494(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _495 => _495[1]]) || "1", 10);
|
|
28290
28356
|
cellStart = m.index + m[0].length;
|
|
28291
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
28357
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkGPC72VSFcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkGPC72VSFcjs.MAX_ROWS) };
|
|
28292
28358
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
28293
28359
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
28294
28360
|
cellStart = -1;
|
|
@@ -28312,12 +28378,12 @@ function htmlCellInnerToLines(inner) {
|
|
|
28312
28378
|
hadNonText = true;
|
|
28313
28379
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
28314
28380
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
28315
|
-
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess',
|
|
28316
|
-
if (src) imgSrcs.push(
|
|
28381
|
+
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _496 => _496[1]]), () => ( _optionalChain([m, 'optionalAccess', _497 => _497[2]])));
|
|
28382
|
+
if (src) imgSrcs.push(_chunkKZVQK5NScjs.unescapeHtml.call(void 0, src));
|
|
28317
28383
|
return "";
|
|
28318
28384
|
});
|
|
28319
28385
|
}
|
|
28320
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
28386
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkKZVQK5NScjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
28321
28387
|
return { lines, hadNonText, imgSrcs };
|
|
28322
28388
|
}
|
|
28323
28389
|
function splitCellByTopLevelTables(html) {
|
|
@@ -28474,7 +28540,7 @@ function edgeXml(tag, d) {
|
|
|
28474
28540
|
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"/>`;
|
|
28475
28541
|
}
|
|
28476
28542
|
function borderFillDefToXml(id, def) {
|
|
28477
|
-
const fill = _optionalChain([def, 'access',
|
|
28543
|
+
const fill = _optionalChain([def, 'access', _498 => _498.fill, 'optionalAccess', _499 => _499.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
|
|
28478
28544
|
return ` <hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0">
|
|
28479
28545
|
<hh:slash type="NONE" Crooked="0" isCounter="0"/>
|
|
28480
28546
|
<hh:backSlash type="NONE" Crooked="0" isCounter="0"/>
|
|
@@ -28792,7 +28858,7 @@ var ImageRegistry = (_class6 = class {
|
|
|
28792
28858
|
}
|
|
28793
28859
|
/** 실데이터 등록 — images 맵 바이트·data: URI. 포맷 미상(webp 등)은 null → placeholder 폴백 */
|
|
28794
28860
|
takeReal(url) {
|
|
28795
|
-
let bytes = _optionalChain([this, 'access',
|
|
28861
|
+
let bytes = _optionalChain([this, 'access', _500 => _500.supplied, 'optionalAccess', _501 => _501.get, 'call', _502 => _502(url)]);
|
|
28796
28862
|
if (!bytes && url.startsWith("data:")) {
|
|
28797
28863
|
const m = /^data:image\/[a-z+]+;base64,([A-Za-z0-9+/=\s]+)$/i.exec(url);
|
|
28798
28864
|
if (m) {
|
|
@@ -29003,14 +29069,14 @@ function requiredTableWidth(rows, charHeight, faceClass = "hcr") {
|
|
|
29003
29069
|
return colMax.reduce((a, w) => a + Math.round((w + CELL_PAD) * colSlack(faceClass)), 0);
|
|
29004
29070
|
}
|
|
29005
29071
|
function generateTable(rows, theme, style = null, remap = null, seq = 0, images = null) {
|
|
29006
|
-
curFace = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
29072
|
+
curFace = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _503 => _503.faceClass]), () => ( "hcr"));
|
|
29007
29073
|
const rowCnt = rows.length;
|
|
29008
29074
|
const colCnt = Math.max(...rows.map((r) => r.length), 1);
|
|
29009
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
29075
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _504 => _504.bfRegistry]), () => ( null));
|
|
29010
29076
|
const totalW = style ? reg ? style.totalWidth - DATA_TABLE_INSET : style.totalWidth : 44e3;
|
|
29011
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
29077
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _505 => _505.charHeight]), () => ( 1e3));
|
|
29012
29078
|
const rowAnchor = normalizeRowAnchor((_nullishCoalesce(rows[0], () => ( []))).map((c) => c.replace(/!\[[^\]]*\]\([^)]*\)/g, "")));
|
|
29013
|
-
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access',
|
|
29079
|
+
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _506 => _506[0], 'optionalAccess', _507 => _507[0]]), () => ( ""))), seq, rowAnchor);
|
|
29014
29080
|
const colMax = Array(colCnt).fill(0);
|
|
29015
29081
|
const colMaxBody = Array(colCnt).fill(0);
|
|
29016
29082
|
const colMinWord = Array(colCnt).fill(0);
|
|
@@ -29039,7 +29105,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
29039
29105
|
const k = `${rowIdx},${colIdx}`;
|
|
29040
29106
|
const isLabelCell2 = labelCol0 && colIdx === 0;
|
|
29041
29107
|
const defaultCharPr = style ? reg && (isHeaderRow || isLabelCell2) ? style.boldCharPr : style.charPr : isHeaderRow ? headerCharPr : baseCharPr;
|
|
29042
|
-
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
29108
|
+
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _508 => _508.cellChar, 'access', _509 => _509.get, 'call', _510 => _510(k)]), () => ( defaultCharPr));
|
|
29043
29109
|
const centered = isHeaderRow || colCentered[colIdx];
|
|
29044
29110
|
const paraPrId = style ? centered ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
29045
29111
|
const p = cell2.split(/<br\s*\/?>/i).map((seg) => {
|
|
@@ -29057,11 +29123,11 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
29057
29123
|
}
|
|
29058
29124
|
}
|
|
29059
29125
|
}
|
|
29060
|
-
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess',
|
|
29126
|
+
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _511 => _511.cellChar, 'access', _512 => _512.has, 'call', _513 => _513(k)]) ? void 0 : mapId);
|
|
29061
29127
|
const body = (runs || (picRuns ? "" : `<hp:run charPrIDRef="${cellCharPr}"><hp:t></hp:t></hp:run>`)) + picRuns;
|
|
29062
29128
|
return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0">${body}</hp:p>`;
|
|
29063
29129
|
}).join("");
|
|
29064
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
29130
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _514 => _514.cellBf, 'access', _515 => _515.get, 'call', _516 => _516(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
29065
29131
|
row: rowIdx,
|
|
29066
29132
|
rowEnd: rowIdx,
|
|
29067
29133
|
col: colIdx,
|
|
@@ -29071,14 +29137,14 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
29071
29137
|
headerRows: 1,
|
|
29072
29138
|
fill: isHeaderRow ? _nullishCoalesce(style.headerFill, () => ( "#E6E6E6")) : isLabelCell2 ? _nullishCoalesce(style.labelFill, () => ( "#E7E7E7")) : void 0
|
|
29073
29139
|
})) : style && isHeaderRow ? style.headerBf : 2)));
|
|
29074
|
-
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
29140
|
+
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _517 => _517.cellH, 'access', _518 => _518.get, 'call', _519 => _519(k)]), () => ( cellH));
|
|
29075
29141
|
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>`;
|
|
29076
29142
|
}).join("");
|
|
29077
29143
|
return `<hp:tr>${tdElements}</hp:tr>`;
|
|
29078
29144
|
}).join("");
|
|
29079
29145
|
const tblW = colWidths.reduce((a, b) => a + b, 0);
|
|
29080
29146
|
const tblH = rowHeights.reduce((a, b) => a + b, 0);
|
|
29081
|
-
const hostPr = reg && _optionalChain([style, 'optionalAccess',
|
|
29147
|
+
const hostPr = reg && _optionalChain([style, 'optionalAccess', _520 => _520.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
|
|
29082
29148
|
const float = rowCnt >= 2;
|
|
29083
29149
|
const tblInner = `<hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tblH}" heightRelTo="ABSOLUTE" protect="0"/>` + tablePosXml(float, hostPr !== 0) + tableOutMarginXml(float, measureH) + `<hp:inMargin left="510" right="510" top="141" bottom="141"/>` + trElements;
|
|
29084
29150
|
const tbl2 = `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE"${float ? FLOAT_TBL_ATTRS : ""} pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0">${tblInner}</hp:tbl>`;
|
|
@@ -29092,8 +29158,8 @@ function layoutHtmlRows(rows) {
|
|
|
29092
29158
|
let c = 0;
|
|
29093
29159
|
for (const cell2 of rows[r].cells) {
|
|
29094
29160
|
while (occupied.has(`${r},${c}`)) c++;
|
|
29095
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
29096
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
29161
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkGPC72VSFcjs.MAX_COLS);
|
|
29162
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkGPC72VSFcjs.MAX_ROWS);
|
|
29097
29163
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
29098
29164
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
29099
29165
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -29118,8 +29184,8 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
29118
29184
|
if (!rows || rows.length === 0) return null;
|
|
29119
29185
|
const { placed, rowCnt, colCnt } = layoutHtmlRows(rows);
|
|
29120
29186
|
if (rowCnt === 0 || colCnt === 0) return null;
|
|
29121
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
29122
|
-
curFace = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
29187
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _521 => _521.charHeight]), () => ( 1e3));
|
|
29188
|
+
curFace = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _522 => _522.faceClass]), () => ( "hcr"));
|
|
29123
29189
|
const first = _nullishCoalesce(placed.find((p) => p.r === 0 && p.c === 0), () => ( placed[0]));
|
|
29124
29190
|
const row0 = Array.from({ length: colCnt }, () => "");
|
|
29125
29191
|
for (const cell2 of placed) {
|
|
@@ -29151,7 +29217,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
29151
29217
|
const tblId = nextTableId();
|
|
29152
29218
|
const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
|
|
29153
29219
|
const spanW = (cell2) => colWidths.slice(cell2.c, cell2.c + cell2.colSpan).reduce((a, b) => a + b, 0);
|
|
29154
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
29220
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _523 => _523.bfRegistry]), () => ( null));
|
|
29155
29221
|
let htmlHeaderRows = 0;
|
|
29156
29222
|
while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
|
|
29157
29223
|
const tableRowHeights = Array(rowCnt).fill(cellH);
|
|
@@ -29165,7 +29231,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
29165
29231
|
const nestedW = Math.max(Math.min(Math.max(sw - 1020, 4e3), sw - 282), 500);
|
|
29166
29232
|
const nestedXml = generateHtmlTableXml(nested2, theme, nestedW, style ? { ...style, totalWidth: nestedW } : null, null, 0, null, true);
|
|
29167
29233
|
if (nestedXml) {
|
|
29168
|
-
const szH = _optionalChain([nestedXml, 'access',
|
|
29234
|
+
const szH = _optionalChain([nestedXml, 'access', _524 => _524.match, 'call', _525 => _525(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _526 => _526[1]]);
|
|
29169
29235
|
nestedH += (szH ? Number(szH) : (_nullishCoalesce(nested2.match(/<tr[\s>]/gi), () => ( []))).length * cellH) + 300;
|
|
29170
29236
|
}
|
|
29171
29237
|
return nestedXml;
|
|
@@ -29176,7 +29242,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
29176
29242
|
for (const line of lines) wrapLines += Math.max(1, Math.ceil(measureTextWidth(line.trim(), measureH, 100, { faceClass: curFace }) / usable));
|
|
29177
29243
|
const lineH = style ? Math.round(measureH * 1.6) : 800;
|
|
29178
29244
|
const contentH = Math.max(cellH * rowSpan, Math.max(wrapLines, 1) * lineH + nestedH);
|
|
29179
|
-
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
29245
|
+
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _527 => _527.cellH, 'access', _528 => _528.get, 'call', _529 => _529(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
|
|
29180
29246
|
const perRow = Math.ceil(cellHeight / rowSpan);
|
|
29181
29247
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
|
|
29182
29248
|
return { cell: cell2, rowSpan, lines, nestedXmls, segLines, imgSrcs: cellParsed[i].imgSrcs };
|
|
@@ -29187,7 +29253,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
29187
29253
|
const baseCharPr = style ? style.charPr : CHAR_NORMAL;
|
|
29188
29254
|
const headerCharPr = isHeader && useHeaderStyle ? CHAR_TABLE_HEADER : baseCharPr;
|
|
29189
29255
|
const defaultCharPr = style && reg && isHeader ? style.boldCharPr : isHeader ? headerCharPr : baseCharPr;
|
|
29190
|
-
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
29256
|
+
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _530 => _530.cellChar, 'access', _531 => _531.get, 'call', _532 => _532(k)]), () => ( defaultCharPr));
|
|
29191
29257
|
const centered = isHeader || colCentered[cell2.c];
|
|
29192
29258
|
const paraPrId = style ? centered ? reg ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : style.centerParaPr : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
29193
29259
|
const picUrls = images ? [...imgSrcs] : [];
|
|
@@ -29227,7 +29293,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
29227
29293
|
let cellHeight = 0;
|
|
29228
29294
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) cellHeight += tableRowHeights[r];
|
|
29229
29295
|
const rowEnd = cell2.r + rowSpan - 1;
|
|
29230
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
29296
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _533 => _533.cellBf, 'access', _534 => _534.get, 'call', _535 => _535(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
29231
29297
|
row: cell2.r,
|
|
29232
29298
|
rowEnd,
|
|
29233
29299
|
col: cell2.c,
|
|
@@ -29246,7 +29312,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
29246
29312
|
}
|
|
29247
29313
|
const tableH = tableRowHeights.reduce((sum, height) => sum + height, 0);
|
|
29248
29314
|
const float = !nested && rowCnt >= 2;
|
|
29249
|
-
return `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE"${float ? FLOAT_TBL_ATTRS : ""} pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0"><hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tableH}" heightRelTo="ABSOLUTE" protect="0"/>` + tablePosXml(float, !!reg && _optionalChain([style, 'optionalAccess',
|
|
29315
|
+
return `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE"${float ? FLOAT_TBL_ATTRS : ""} pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0"><hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tableH}" heightRelTo="ABSOLUTE" protect="0"/>` + tablePosXml(float, !!reg && _optionalChain([style, 'optionalAccess', _536 => _536.rightParaPr]) !== void 0) + tableOutMarginXml(float, measureH) + `<hp:inMargin left="510" right="510" top="141" bottom="141"/>` + trXmls.join("") + `</hp:tbl>`;
|
|
29250
29316
|
}
|
|
29251
29317
|
|
|
29252
29318
|
// src/hwpx/gen-docframe.ts
|
|
@@ -29307,7 +29373,7 @@ function buildPressHead(g3, ids, bodyWidth, reg) {
|
|
|
29307
29373
|
return [`<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`, blank()];
|
|
29308
29374
|
}
|
|
29309
29375
|
function buildPressContact(g3, ids, bodyWidth, reg) {
|
|
29310
|
-
const c = _optionalChain([g3, 'access',
|
|
29376
|
+
const c = _optionalChain([g3, 'access', _537 => _537.press, 'optionalAccess', _538 => _538.contact]);
|
|
29311
29377
|
if (!c || !c.dept && !c.manager && !c.phone) return [];
|
|
29312
29378
|
const w = bodyWidth - 280;
|
|
29313
29379
|
const cells = [["\uB2F4\uB2F9 \uBD80\uC11C", _nullishCoalesce(c.dept, () => ( ""))], ["\uB2F4\uB2F9\uC790", _nullishCoalesce(c.manager, () => ( ""))], ["\uC5F0\uB77D\uCC98", _nullishCoalesce(c.phone, () => ( ""))]];
|
|
@@ -29686,10 +29752,10 @@ function generateSecPr(gongmun, page = null) {
|
|
|
29686
29752
|
m.header = gongmun.headerFooter;
|
|
29687
29753
|
m.footer = gongmun.headerFooter;
|
|
29688
29754
|
}
|
|
29689
|
-
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',
|
|
29690
|
-
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess',
|
|
29691
|
-
const hf = (_optionalChain([page, 'optionalAccess',
|
|
29692
|
-
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess',
|
|
29755
|
+
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', _539 => _539.landscape]), () => ( "WIDELY"))}" width="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _540 => _540.widthHU]), () => ( A4_W_HU))}" height="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _541 => _541.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>`;
|
|
29756
|
+
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess', _542 => _542.columns]), () => ( 1)));
|
|
29757
|
+
const hf = (_optionalChain([page, 'optionalAccess', _543 => _543.header]) ? headerFooterCtrl("header", page.header, 1) : "") + (_optionalChain([page, 'optionalAccess', _544 => _544.footer]) ? headerFooterCtrl("footer", page.footer, 2) : "");
|
|
29758
|
+
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess', _545 => _545.pageNumbers]) ? pageNumCtrl() : "");
|
|
29693
29759
|
}
|
|
29694
29760
|
var SectionOpener = (_class7 = class {
|
|
29695
29761
|
constructor(gongmun, page = null) {;_class7.prototype.__init15.call(this);
|
|
@@ -29731,16 +29797,16 @@ function buildPreamble(blocks, ctx) {
|
|
|
29731
29797
|
const { gongmun, dfIds, bfReg, tableStyle, richAssets, gjBodyW } = ctx;
|
|
29732
29798
|
const preamble = [];
|
|
29733
29799
|
let hasFrontPages = false;
|
|
29734
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
29800
|
+
if (_optionalChain([gongmun, 'optionalAccess', _546 => _546.reportInfo]) && dfIds) {
|
|
29735
29801
|
preamble.push(buildReportInfo(gongmun, dfIds));
|
|
29736
29802
|
}
|
|
29737
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
29803
|
+
if (_optionalChain([gongmun, 'optionalAccess', _547 => _547.approval]) && bfReg) {
|
|
29738
29804
|
preamble.push(buildApprovalTable(gongmun.approval, bfReg, richAssets ? GJ_CHAR_APPROVAL : GONGMUN_APPROVAL_CHAR));
|
|
29739
29805
|
}
|
|
29740
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
29806
|
+
if (_optionalChain([gongmun, 'optionalAccess', _548 => _548.noticeHead]) && dfIds) {
|
|
29741
29807
|
preamble.push(...buildNoticeHead(gongmun));
|
|
29742
29808
|
}
|
|
29743
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
29809
|
+
if (_optionalChain([gongmun, 'optionalAccess', _549 => _549.press]) && dfIds && bfReg && tableStyle) {
|
|
29744
29810
|
preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
29745
29811
|
}
|
|
29746
29812
|
if (gongmun && (gongmun.cover || gongmun.toc)) {
|
|
@@ -29769,7 +29835,7 @@ function buildPreamble(blocks, ctx) {
|
|
|
29769
29835
|
}
|
|
29770
29836
|
if (gongmun && !ctx.gaejosik && ctx.coverH1Idx < 0 && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
|
|
29771
29837
|
ctx.titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
29772
|
-
} else if (_optionalChain([gongmun, 'optionalAccess',
|
|
29838
|
+
} else if (_optionalChain([gongmun, 'optionalAccess', _550 => _550.press]) && ctx.coverH1Idx < 0 && dfIds) {
|
|
29773
29839
|
ctx.pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
29774
29840
|
}
|
|
29775
29841
|
if (preamble.length > 0) {
|
|
@@ -29794,7 +29860,7 @@ function renderHeading(block, blockIdx, ctx) {
|
|
|
29794
29860
|
if (gongmun && blockIdx === ctx.coverH1Idx) return "";
|
|
29795
29861
|
if (gongmun && blockIdx === ctx.pressH1Idx && dfIds) {
|
|
29796
29862
|
const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
|
|
29797
|
-
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
29863
|
+
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _551 => _551.press, 'optionalAccess', _552 => _552.sub]), () => ( []))) {
|
|
29798
29864
|
parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
|
|
29799
29865
|
}
|
|
29800
29866
|
return parts.join("\n ");
|
|
@@ -29901,8 +29967,8 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
29901
29967
|
const { gongmun, gongmunList, measured, fit, vBase, dfIds } = ctx;
|
|
29902
29968
|
if (gongmun && gongmunList) {
|
|
29903
29969
|
const info = gongmunList.items.get(blockIdx);
|
|
29904
|
-
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
29905
|
-
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
29970
|
+
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _553 => _553.depth]), () => ( 0));
|
|
29971
|
+
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _554 => _554.marker]), () => ( ""));
|
|
29906
29972
|
const content = block.text || "";
|
|
29907
29973
|
if (measured && content.trimStart().startsWith("\u203B")) {
|
|
29908
29974
|
return refParagraph(content.trim(), ctx);
|
|
@@ -29910,7 +29976,7 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
29910
29976
|
if (measured && block.marker === "*") {
|
|
29911
29977
|
return refParagraph(`* ${content.trim()}`, ctx);
|
|
29912
29978
|
}
|
|
29913
|
-
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess',
|
|
29979
|
+
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _555 => _555.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
|
|
29914
29980
|
let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
|
|
29915
29981
|
let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
|
|
29916
29982
|
if (measured && depth === 0 && gongmun.numbering !== "standard") {
|
|
@@ -29924,7 +29990,7 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
29924
29990
|
mapId = void 0;
|
|
29925
29991
|
}
|
|
29926
29992
|
}
|
|
29927
|
-
const lv = _optionalChain([ctx, 'access',
|
|
29993
|
+
const lv = _optionalChain([ctx, 'access', _556 => _556.levelIds, 'optionalAccess', _557 => _557[depth]]);
|
|
29928
29994
|
if (lv) {
|
|
29929
29995
|
listCharPr = lv.normal;
|
|
29930
29996
|
mapId = (id) => id === CHAR_BOLD ? lv.bold : id === CHAR_NORMAL ? lv.normal : id;
|
|
@@ -29974,15 +30040,15 @@ function renderHtmlTable(block, ctx) {
|
|
|
29974
30040
|
}
|
|
29975
30041
|
function appendPostamble(blocks, ctx) {
|
|
29976
30042
|
const { gongmun, dfIds, bfReg, tableStyle, paraXmls } = ctx;
|
|
29977
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
30043
|
+
if (_optionalChain([gongmun, 'optionalAccess', _558 => _558.noticeHead]) && dfIds) {
|
|
29978
30044
|
paraXmls.push(...buildNoticeFoot(gongmun));
|
|
29979
30045
|
}
|
|
29980
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
29981
|
-
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access',
|
|
30046
|
+
if (_optionalChain([gongmun, 'optionalAccess', _559 => _559.endMark]) && paraXmls.length > 0) {
|
|
30047
|
+
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _560 => _560.rows, 'optionalAccess', _561 => _561.length]));
|
|
29982
30048
|
const lastText = lastBlock && (lastBlock.type === "paragraph" || lastBlock.type === "list_item") ? lastBlock.text || "" : "";
|
|
29983
30049
|
if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
|
|
29984
30050
|
}
|
|
29985
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
30051
|
+
if (_optionalChain([gongmun, 'optionalAccess', _562 => _562.press]) && dfIds && bfReg && tableStyle) {
|
|
29986
30052
|
paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
29987
30053
|
}
|
|
29988
30054
|
}
|
|
@@ -30003,7 +30069,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
30003
30069
|
dfIds,
|
|
30004
30070
|
images,
|
|
30005
30071
|
levelIds,
|
|
30006
|
-
gaejosik: _optionalChain([gongmun, 'optionalAccess',
|
|
30072
|
+
gaejosik: _optionalChain([gongmun, 'optionalAccess', _563 => _563.preset]) === "gaejosik",
|
|
30007
30073
|
measured,
|
|
30008
30074
|
richAssets,
|
|
30009
30075
|
vBase: charVariantBase(richAssets, !!gongmun),
|
|
@@ -30475,7 +30541,7 @@ function legalMarkerDepth(marker) {
|
|
|
30475
30541
|
return 7;
|
|
30476
30542
|
}
|
|
30477
30543
|
function parseLeadingMarker(text, keepMarkers = false) {
|
|
30478
|
-
const t = text.replace(/^[\s ]+/, "").replace(
|
|
30544
|
+
const t = text.replace(/^[\s ]+/, "").replace(/^(\*\*|__)([□■ㅇ○◦●❍◎▸※-])\1(?=\s|$)/u, "$2").replace(/^(\*\*|__)([□■ㅇ○◦●❍◎▸※-])\s*(?=\S)/u, "$2 $1");
|
|
30479
30545
|
const ref = REF_RE.exec(t);
|
|
30480
30546
|
if (ref) return { kind: "ref", depth: 0, marker: ref[1], rest: t.slice(ref[0].length).trim() };
|
|
30481
30547
|
if (keepMarkers) {
|
|
@@ -30534,7 +30600,7 @@ function buildOutline(blocks, opts) {
|
|
|
30534
30600
|
break;
|
|
30535
30601
|
}
|
|
30536
30602
|
if (lvl <= 2) {
|
|
30537
|
-
const label = _optionalChain([CHAPTER_LABEL_RE, 'access',
|
|
30603
|
+
const label = _optionalChain([CHAPTER_LABEL_RE, 'access', _564 => _564.exec, 'call', _565 => _565(raw), 'optionalAccess', _566 => _566[1]]);
|
|
30538
30604
|
nodes.push({ kind: "chapter", text: stripChapterNumber(raw) || raw, index: ++chapters, ...label ? { label } : {} });
|
|
30539
30605
|
lastExplicitDepth = -1;
|
|
30540
30606
|
listBase = -1;
|
|
@@ -30945,7 +31011,7 @@ function chapterLabel(index, style) {
|
|
|
30945
31011
|
return style === "roman" ? `${ROMAN[(index - 1) % 12]}.` : `${index}.`;
|
|
30946
31012
|
}
|
|
30947
31013
|
function plain2(text) {
|
|
30948
|
-
return text
|
|
31014
|
+
return parseInlineMarkdown(text).map((span2) => span2.text).join("");
|
|
30949
31015
|
}
|
|
30950
31016
|
function buildGongmunSectionV5(blocks, gongmun, deps, theme) {
|
|
30951
31017
|
resetTableIds();
|
|
@@ -31005,7 +31071,7 @@ function buildGongmunSectionV5(blocks, gongmun, deps, theme) {
|
|
|
31005
31071
|
if (box.lines > 3) warnings.push(`\uC694\uC57D\uBC15\uC2A4\uAC00 ${box.lines}\uC904\uC785\uB2C8\uB2E4 \u2014 \uBCF4\uACE0 \uBAA9\uC801\uC744 \uD55C \uBB38\uC7A5(\uC27C\uD45C \uD5C8\uC6A9) 3\uC904 \uC774\uB0B4 "\u2026\uD558\uACE0\uC790 \uD568"\uC73C\uB85C \uC904\uC774\uC138\uC694`);
|
|
31006
31072
|
paras.push(box.xml);
|
|
31007
31073
|
};
|
|
31008
|
-
const docTitle = polishGongmunText(_nullishCoalesce(_nullishCoalesce(_optionalChain([g3, 'access',
|
|
31074
|
+
const docTitle = polishGongmunText(_nullishCoalesce(_nullishCoalesce(_optionalChain([g3, 'access', _567 => _567.docHead, 'optionalAccess', _568 => _568.title]), () => ( outline.title)), () => ( "")));
|
|
31009
31075
|
const reportInfo = g3.reportInfo && polishGongmunText(g3.reportInfo);
|
|
31010
31076
|
if (preset === "official") {
|
|
31011
31077
|
if (g3.docHead) paras.push(buildDocHeadTable({ ...g3.docHead, title: docTitle }, frame));
|
|
@@ -31095,7 +31161,7 @@ function buildGongmunSectionV5(blocks, gongmun, deps, theme) {
|
|
|
31095
31161
|
let pendingNewPageNum = isMinistry && (!!g3.cover || !!g3.toc);
|
|
31096
31162
|
let chapterStyle = g3.h2Marker === "box" || g3.h2Marker === "number" || g3.h2Marker === "none" || g3.h2Marker === "band" || g3.h2Marker === "square" ? g3.h2Marker : "roman";
|
|
31097
31163
|
if (!gaejosik) chapterStyle = "number";
|
|
31098
|
-
const leadLeft = (depth, pt2) => (_nullishCoalesce(_optionalChain([scheme, 'access',
|
|
31164
|
+
const leadLeft = (depth, pt2) => (_nullishCoalesce(_optionalChain([scheme, 'access', _569 => _569.levels, 'access', _570 => _570[Math.min(depth, 7)], 'optionalAccess', _571 => _571.leadTa]), () => ( 0))) * taHu(pt2);
|
|
31099
31165
|
const renderItem = (node, styleId = 0) => {
|
|
31100
31166
|
const depth = Math.min(node.depth, 7);
|
|
31101
31167
|
const sub = gaejosik && node.legalMarker;
|
|
@@ -31156,7 +31222,7 @@ function buildGongmunSectionV5(blocks, gongmun, deps, theme) {
|
|
|
31156
31222
|
const t = plain2(node.text);
|
|
31157
31223
|
const cb = fitCharBreaks(t, st.font, st.pt, textW2, textW2, _nullishCoalesce(g3.autoFitMinRatio, () => ( 101)));
|
|
31158
31224
|
const f = _nullishCoalesce(cb, () => ( (g3.autoFitMinRatio !== null ? fitParagraph(t, st.font, st.pt, textW2, textW2, g3.autoFitMinRatio) : null)));
|
|
31159
|
-
const base = { font: st.font, pt: st.pt, bold: st.bold, ratio: _nullishCoalesce(_optionalChain([f, 'optionalAccess',
|
|
31225
|
+
const base = { font: st.font, pt: st.pt, bold: st.bold, ratio: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _572 => _572.ratio]), () => ( 100)), spacing: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _573 => _573.spacing]), () => ( 0)) };
|
|
31160
31226
|
const paraId = reg.para({ align: _nullishCoalesce(st.align, () => ( "JUSTIFY")), left, indent: -lay.hang, after: isMinistry ? 400 : 0, lineSp: isMinistry ? 130 : _nullishCoalesce(st.lineSp, () => ( scheme.lineSp)), keepWord: !cb, autoTab: true, widowOrphan: true });
|
|
31161
31227
|
const markerRun = markerRunXml(marker, reg.char({ font: st.font, pt: st.pt, bold: st.bold }), lay);
|
|
31162
31228
|
return `<hp:p paraPrIDRef="${paraId}" styleIDRef="0">${markerRun}${generateRuns(node.text, reg.char(base), inlineMapper(reg, base))}</hp:p>`;
|
|
@@ -31405,7 +31471,7 @@ function buildGongmunSectionV5(blocks, gongmun, deps, theme) {
|
|
|
31405
31471
|
fax: f.fax,
|
|
31406
31472
|
email: f.email,
|
|
31407
31473
|
disclosure: f.disclosure
|
|
31408
|
-
}, frame, isInternalApproval(_optionalChain([g3, 'access',
|
|
31474
|
+
}, frame, isInternalApproval(_optionalChain([g3, 'access', _574 => _574.docHead, 'optionalAccess', _575 => _575.to]))));
|
|
31409
31475
|
}
|
|
31410
31476
|
if (paras.length === 0) paras.push(`<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0"><hp:t></hp:t></hp:run></hp:p>`);
|
|
31411
31477
|
paras[0] = paras[0].replace(/<hp:run charPrIDRef="(\d+)">/, `<hp:run charPrIDRef="$1">${generateSecPr(g3, page)}`);
|
|
@@ -31437,9 +31503,9 @@ function legalDepthOf(marker) {
|
|
|
31437
31503
|
|
|
31438
31504
|
// src/hwpx/generator.ts
|
|
31439
31505
|
async function markdownToHwpx(markdown, options) {
|
|
31440
|
-
const theme = resolveTheme(_optionalChain([options, 'optionalAccess',
|
|
31441
|
-
const gongmun = _optionalChain([options, 'optionalAccess',
|
|
31442
|
-
const page = resolvePage(_optionalChain([options, 'optionalAccess',
|
|
31506
|
+
const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _576 => _576.theme]));
|
|
31507
|
+
const gongmun = _optionalChain([options, 'optionalAccess', _577 => _577.gongmun]) ? resolveGongmun(options.gongmun) : null;
|
|
31508
|
+
const page = resolvePage(_optionalChain([options, 'optionalAccess', _578 => _578.page]));
|
|
31443
31509
|
const { md: md2, defs } = extractFootnoteDefs(markdown);
|
|
31444
31510
|
beginInlineDoc(defs);
|
|
31445
31511
|
try {
|
|
@@ -31448,14 +31514,14 @@ async function markdownToHwpx(markdown, options) {
|
|
|
31448
31514
|
const staticBfEnd2 = staticBorderFillNext(gongmun, true);
|
|
31449
31515
|
const charBase = charVariantBase(false, true);
|
|
31450
31516
|
const fontBase = staticFontNext(gongmun, true);
|
|
31451
|
-
const remap2 = _optionalChain([options, 'optionalAccess',
|
|
31452
|
-
const bfReg2 = new TableBfRegistry(staticBfEnd2 + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
31453
|
-
const reg = new StyleRegistry(charBase + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
31517
|
+
const remap2 = _optionalChain([options, 'optionalAccess', _579 => _579.profile]) ? buildProfileRemap(options.profile, charBase, staticBfEnd2, fontBase) : null;
|
|
31518
|
+
const bfReg2 = new TableBfRegistry(staticBfEnd2 + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _580 => _580.borderFillXmls, 'access', _581 => _581.length]), () => ( 0))));
|
|
31519
|
+
const reg = new StyleRegistry(charBase + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _582 => _582.charPrXmls, 'access', _583 => _583.length]), () => ( 0))), 8, fontBase + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _584 => _584.fontFaces, 'access', _585 => _585.length]), () => ( 0))), ["\uD568\uCD08\uB86C\uBC14\uD0D5", "\uD568\uCD08\uB86C\uB3CB\uC6C0", "HY\uACAC\uACE0\uB515"]);
|
|
31454
31520
|
const chartParts2 = [];
|
|
31455
|
-
const supplied2 = _optionalChain([options, 'optionalAccess',
|
|
31521
|
+
const supplied2 = _optionalChain([options, 'optionalAccess', _586 => _586.images]) ? new Map(Object.entries(options.images).map(([k, v]) => [k, v instanceof Uint8Array ? v : new Uint8Array(v)])) : void 0;
|
|
31456
31522
|
const images2 = new ImageRegistry(supplied2);
|
|
31457
31523
|
const res = buildGongmunSectionV5(blocks2, gongmun, { reg, bfReg: bfReg2, remap: remap2, images: images2, page, chartParts: chartParts2 }, theme);
|
|
31458
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
31524
|
+
if (_optionalChain([options, 'optionalAccess', _587 => _587.warnings])) options.warnings.push(...res.warnings);
|
|
31459
31525
|
if (remap2 && remap2.tables.length > 0 && remap2.tables.every((t) => !t.used)) {
|
|
31460
31526
|
console.warn(`[kordoc] format profile: \uD504\uB85C\uD544 \uD45C ${remap2.tables.length}\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)`);
|
|
31461
31527
|
}
|
|
@@ -31468,10 +31534,10 @@ async function markdownToHwpx(markdown, options) {
|
|
|
31468
31534
|
theme,
|
|
31469
31535
|
gongmun,
|
|
31470
31536
|
[],
|
|
31471
|
-
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
31472
|
-
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
31537
|
+
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _588 => _588.borderFillXmls]), () => ( [])), ...bfReg2.emit()],
|
|
31538
|
+
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _589 => _589.charPrXmls]), () => ( [])), ...reg.charPrXmls],
|
|
31473
31539
|
[],
|
|
31474
|
-
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
31540
|
+
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _590 => _590.fontFaces]), () => ( [])), ...reg.extraFonts],
|
|
31475
31541
|
{ paraPrXmls: reg.paraPrXmls, bodyFace: "\uD568\uCD08\uB86C\uBC14\uD0D5" }
|
|
31476
31542
|
));
|
|
31477
31543
|
zip2.file("Contents/section0.xml", res.xml);
|
|
@@ -31485,18 +31551,18 @@ async function markdownToHwpx(markdown, options) {
|
|
|
31485
31551
|
const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
|
|
31486
31552
|
const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
|
|
31487
31553
|
const staticBfEnd = staticBorderFillNext(gongmun);
|
|
31488
|
-
const remap = _optionalChain([options, 'optionalAccess',
|
|
31489
|
-
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
31554
|
+
const remap = _optionalChain([options, 'optionalAccess', _591 => _591.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _592 => _592.variants, 'optionalAccess', _593 => _593.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
|
|
31555
|
+
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _594 => _594.borderFillXmls, 'access', _595 => _595.length]), () => ( 0)))) : null;
|
|
31490
31556
|
const dfActive = !!gongmun && docframeActive(gongmun);
|
|
31491
|
-
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
31557
|
+
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _596 => _596.variants, 'optionalAccess', _597 => _597.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _598 => _598.charPrXmls, 'access', _599 => _599.length]), () => ( 0)));
|
|
31492
31558
|
const dfIds = dfActive ? docframeIds(dfBase) : null;
|
|
31493
31559
|
const dfXmls = dfActive ? docframeCharPrXmls(dfBase, richAssets) : [];
|
|
31494
31560
|
const lvBase = dfBase + dfXmls.length;
|
|
31495
31561
|
const lvIds = gongmun ? levelCharIds(gongmun, lvBase) : null;
|
|
31496
31562
|
const lvFonts = gongmun ? levelFontFaces(gongmun) : [];
|
|
31497
|
-
const lvXmls = gongmun ? levelCharPrXmls(gongmun, lvBase, staticFontNext(gongmun) + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
31563
|
+
const lvXmls = gongmun ? levelCharPrXmls(gongmun, lvBase, staticFontNext(gongmun) + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _600 => _600.fontFaces, 'access', _601 => _601.length]), () => ( 0))), richAssets ? 4 : 0) : [];
|
|
31498
31564
|
const chartParts = [];
|
|
31499
|
-
const supplied = _optionalChain([options, 'optionalAccess',
|
|
31565
|
+
const supplied = _optionalChain([options, 'optionalAccess', _602 => _602.images]) ? new Map(Object.entries(options.images).map(([k, v]) => [k, v instanceof Uint8Array ? v : new Uint8Array(v)])) : void 0;
|
|
31500
31566
|
const images = new ImageRegistry(supplied);
|
|
31501
31567
|
const sectionXml = blocksToSectionXml(blocks, theme, gongmun, gongmunList, fit, chartParts, bfReg, remap, dfIds, images, page, lvIds);
|
|
31502
31568
|
if (remap && remap.tables.length > 0) {
|
|
@@ -31505,7 +31571,7 @@ async function markdownToHwpx(markdown, options) {
|
|
|
31505
31571
|
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)`);
|
|
31506
31572
|
}
|
|
31507
31573
|
}
|
|
31508
|
-
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
31574
|
+
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _603 => _603.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _604 => _604.emit, 'call', _605 => _605()]), () => ( []))];
|
|
31509
31575
|
const zip = new (0, _jszip2.default)();
|
|
31510
31576
|
zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
|
|
31511
31577
|
zip.file("META-INF/container.xml", generateContainerXml());
|
|
@@ -31514,11 +31580,11 @@ async function markdownToHwpx(markdown, options) {
|
|
|
31514
31580
|
zip.file("Contents/header.xml", generateHeaderXml(
|
|
31515
31581
|
theme,
|
|
31516
31582
|
gongmun,
|
|
31517
|
-
_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
31583
|
+
_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _606 => _606.variants]), () => ( [])),
|
|
31518
31584
|
extraBorderFills,
|
|
31519
|
-
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
31520
|
-
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess',
|
|
31521
|
-
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
31585
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _607 => _607.charPrXmls]), () => ( [])), ...dfXmls, ...lvXmls],
|
|
31586
|
+
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _608 => _608.indentVariants]), () => ( [])),
|
|
31587
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _609 => _609.fontFaces]), () => ( [])), ...lvFonts]
|
|
31522
31588
|
));
|
|
31523
31589
|
zip.file("Contents/section0.xml", sectionXml);
|
|
31524
31590
|
for (const part of chartParts) zip.file(part.name, part.xml);
|
|
@@ -31571,7 +31637,7 @@ function diffBlocks(blocksA, blocksB) {
|
|
|
31571
31637
|
function alignBlocks(a, b) {
|
|
31572
31638
|
const m = a.length, n = b.length;
|
|
31573
31639
|
if (m * n > 1e7) return fallbackAlign(a, b);
|
|
31574
|
-
const textOf = (blk) => blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
31640
|
+
const textOf = (blk) => blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _610 => _610.text]), () => ( ""))).join(" ") : "";
|
|
31575
31641
|
const pa = a.map((blk) => textProfile(textOf(blk)));
|
|
31576
31642
|
const pb = b.map((blk) => textProfile(textOf(blk)));
|
|
31577
31643
|
const passCache = new Uint8Array(m * n);
|
|
@@ -31652,8 +31718,8 @@ function tableDimSim(a, b) {
|
|
|
31652
31718
|
}
|
|
31653
31719
|
function tableSimilarity(a, b) {
|
|
31654
31720
|
const dimSim = tableDimSim(a, b);
|
|
31655
|
-
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
31656
|
-
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
31721
|
+
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _611 => _611.text]), () => ( ""))).join(" ");
|
|
31722
|
+
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _612 => _612.text]), () => ( ""))).join(" ");
|
|
31657
31723
|
const contentSim = normalizedSimilarity(textsA, textsB);
|
|
31658
31724
|
return dimSim * 0.3 + contentSim * 0.7;
|
|
31659
31725
|
}
|
|
@@ -31664,8 +31730,8 @@ function diffTableCells(a, b) {
|
|
|
31664
31730
|
for (let r = 0; r < maxRows; r++) {
|
|
31665
31731
|
const row = [];
|
|
31666
31732
|
for (let c = 0; c < maxCols; c++) {
|
|
31667
|
-
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access',
|
|
31668
|
-
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access',
|
|
31733
|
+
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access', _613 => _613.cells, 'access', _614 => _614[r], 'optionalAccess', _615 => _615[c], 'optionalAccess', _616 => _616.text]) : void 0;
|
|
31734
|
+
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access', _617 => _617.cells, 'access', _618 => _618[r], 'optionalAccess', _619 => _619[c], 'optionalAccess', _620 => _620.text]) : void 0;
|
|
31669
31735
|
let type;
|
|
31670
31736
|
if (cellA === void 0) type = "added";
|
|
31671
31737
|
else if (cellB === void 0) type = "removed";
|
|
@@ -31715,7 +31781,7 @@ function builtinTemplateDir() {
|
|
|
31715
31781
|
for (const c of candidates) {
|
|
31716
31782
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
31717
31783
|
}
|
|
31718
|
-
throw new (0,
|
|
31784
|
+
throw new (0, _chunkKZVQK5NScjs.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)");
|
|
31719
31785
|
}
|
|
31720
31786
|
function readBuiltinTemplate(t) {
|
|
31721
31787
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -31880,7 +31946,7 @@ function parseRenderStyles(headXml) {
|
|
|
31880
31946
|
const underlineEl = findChildByLocalName(el, "underline");
|
|
31881
31947
|
const textColor = el.getAttribute("textColor");
|
|
31882
31948
|
const fontRef = findChildByLocalName(el, "fontRef");
|
|
31883
|
-
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess',
|
|
31949
|
+
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _621 => _621.getAttribute, 'call', _622 => _622("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _623 => _623.getAttribute, 'call', _624 => _624("latin")])));
|
|
31884
31950
|
const face = fontId != null ? hangulFonts.get(fontId) : void 0;
|
|
31885
31951
|
styles.charPr.set(id, {
|
|
31886
31952
|
height: Number(el.getAttribute("height")) || 1e3,
|
|
@@ -31888,8 +31954,8 @@ function parseRenderStyles(headXml) {
|
|
|
31888
31954
|
italic: findChildByLocalName(el, "italic") != null,
|
|
31889
31955
|
underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
|
|
31890
31956
|
color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
|
|
31891
|
-
ratio: Number(_optionalChain([ratioEl, 'optionalAccess',
|
|
31892
|
-
spacing: Number(_optionalChain([spacingEl, 'optionalAccess',
|
|
31957
|
+
ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _625 => _625.getAttribute, 'call', _626 => _626("hangul")])) || 100,
|
|
31958
|
+
spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _627 => _627.getAttribute, 'call', _628 => _628("hangul")])) || 0,
|
|
31893
31959
|
fontFamily: face ? hwpFaceToCssStack(face) : void 0,
|
|
31894
31960
|
face
|
|
31895
31961
|
});
|
|
@@ -31901,7 +31967,7 @@ function parseRenderStyles(headXml) {
|
|
|
31901
31967
|
const id = el.getAttribute("id");
|
|
31902
31968
|
if (id != null) {
|
|
31903
31969
|
const align = findChildByLocalName(el, "align");
|
|
31904
|
-
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess',
|
|
31970
|
+
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _629 => _629.getAttribute, 'call', _630 => _630("horizontal")]) || "JUSTIFY");
|
|
31905
31971
|
styles.paraGeom.set(id, parseParaGeom(el));
|
|
31906
31972
|
const tab = el.getAttribute("tabPrIDRef");
|
|
31907
31973
|
if (tab != null) paraTabRef.set(id, tab);
|
|
@@ -31917,7 +31983,7 @@ function parseRenderStyles(headXml) {
|
|
|
31917
31983
|
};
|
|
31918
31984
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
31919
31985
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
31920
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
31986
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _631 => _631.getAttribute, 'call', _632 => _632("faceColor")]);
|
|
31921
31987
|
if (face && face.toLowerCase() !== "none") bf.fill = face;
|
|
31922
31988
|
styles.borderFill.set(id, bf);
|
|
31923
31989
|
}
|
|
@@ -31993,7 +32059,7 @@ function collectSites(scan) {
|
|
|
31993
32059
|
}
|
|
31994
32060
|
function attrOf3(openTag, name) {
|
|
31995
32061
|
const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
|
|
31996
|
-
return _optionalChain([m, 'optionalAccess',
|
|
32062
|
+
return _optionalChain([m, 'optionalAccess', _633 => _633[1]]);
|
|
31997
32063
|
}
|
|
31998
32064
|
function paraOpenTag(xml, para2) {
|
|
31999
32065
|
const end = xml.indexOf(">", para2.start);
|
|
@@ -32008,7 +32074,7 @@ function anchorRunInfo(xml, para2, anchor) {
|
|
|
32008
32074
|
if (!tr) return null;
|
|
32009
32075
|
const before2 = xml.slice(Math.max(0, para2.start), tr.contentStart);
|
|
32010
32076
|
const runOpen = [...before2.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
|
|
32011
|
-
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess',
|
|
32077
|
+
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _634 => _634[1]]), () => ( tr.prefix)), () => ( "hp"));
|
|
32012
32078
|
const charPr2 = runOpen && attrOf3(runOpen[0], "charPrIDRef") || "0";
|
|
32013
32079
|
const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
|
|
32014
32080
|
if (close === -1) return null;
|
|
@@ -32035,7 +32101,7 @@ function cellContentWidthMm(xml, cell2) {
|
|
|
32035
32101
|
if (width === null) return null;
|
|
32036
32102
|
let content = width;
|
|
32037
32103
|
const win = cellAddrWindow(xml, cell2);
|
|
32038
|
-
const mg = _optionalChain([win, 'optionalAccess',
|
|
32104
|
+
const mg = _optionalChain([win, 'optionalAccess', _635 => _635.match, 'call', _636 => _636(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
|
|
32039
32105
|
if (mg) {
|
|
32040
32106
|
content -= Number(_nullishCoalesce(attrOf3(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf3(mg[0], "right"), () => ( 0)));
|
|
32041
32107
|
}
|
|
@@ -32069,12 +32135,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
32069
32135
|
return `<hp:pic xmlns:hc="http://www.hancom.co.kr/hwpml/2011/core" id="${ids.id}" zOrder="0" numberingType="PICTURE" textWrap="IN_FRONT_OF_TEXT" textFlow="BOTH_SIDES" lock="0" dropcapstyle="None" href="" groupLevel="0" instid="${ids.instid}" reverse="0"><hp:offset x="0" y="0"/><hp:orgSz width="${w}" height="${h}"/><hp:curSz width="${w}" height="${h}"/><hp:flip horizontal="0" vertical="0"/><hp:rotationInfo angle="0" centerX="${Math.round(w / 2)}" centerY="${Math.round(h / 2)}" rotateimage="1"/><hp:renderingInfo><hc:transMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/><hc:scaMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/><hc:rotMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/></hp:renderingInfo><hp:imgRect><hc:pt0 x="0" y="0"/><hc:pt1 x="${w}" y="0"/><hc:pt2 x="${w}" y="${h}"/><hc:pt3 x="0" y="${h}"/></hp:imgRect><hp:imgClip left="0" right="${w}" top="0" bottom="${h}"/><hp:inMargin left="0" right="0" top="0" bottom="0"/><hp:imgDim dimwidth="${w}" dimheight="${h}"/><hc:img binaryItemIDRef="${itemId}" bright="0" contrast="0" effect="REAL_PIC" alpha="0"/><hp:effects/><hp:sz width="${w}" widthRelTo="ABSOLUTE" height="${h}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="0" affectLSpacing="0" flowWithText="0" allowOverlap="1" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="COLUMN" vertAlign="TOP" horzAlign="LEFT" vertOffset="${posYHu}" horzOffset="${posXHu}"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:shapeComment>kordoc seal</hp:shapeComment></hp:pic>`;
|
|
32070
32136
|
}
|
|
32071
32137
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
32072
|
-
if (ops.length === 0) throw new (0,
|
|
32138
|
+
if (ops.length === 0) throw new (0, _chunkKZVQK5NScjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
32073
32139
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
32074
|
-
|
|
32140
|
+
_chunkKZVQK5NScjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
32075
32141
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
32076
|
-
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access',
|
|
32077
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
32142
|
+
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _637 => _637.match, 'call', _638 => _638(/(\d+)\.xml$/i), 'optionalAccess', _639 => _639[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _640 => _640.match, 'call', _641 => _641(/(\d+)\.xml$/i), 'optionalAccess', _642 => _642[1]]), () => ( 0))));
|
|
32143
|
+
if (sectionPaths.length === 0) throw new (0, _chunkKZVQK5NScjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
32078
32144
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
32079
32145
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
32080
32146
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -32115,11 +32181,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32115
32181
|
const manifestItems = [];
|
|
32116
32182
|
const placed = [];
|
|
32117
32183
|
for (const op of ops) {
|
|
32118
|
-
if (!op.anchor) throw new (0,
|
|
32119
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
32184
|
+
if (!op.anchor) throw new (0, _chunkKZVQK5NScjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
32185
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkKZVQK5NScjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
32120
32186
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
32121
|
-
if (!MIME[ext]) throw new (0,
|
|
32122
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
32187
|
+
if (!MIME[ext]) throw new (0, _chunkKZVQK5NScjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
32188
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkKZVQK5NScjs.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)`);
|
|
32123
32189
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
32124
32190
|
let found = null;
|
|
32125
32191
|
let total = 0;
|
|
@@ -32152,7 +32218,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32152
32218
|
}
|
|
32153
32219
|
}
|
|
32154
32220
|
}
|
|
32155
|
-
throw new (0,
|
|
32221
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(
|
|
32156
32222
|
`place_seal: \uC575\uCEE4 "${op.anchor}" ${wantOcc}\uBC88\uC9F8 \uB4F1\uC7A5\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4 (\uBCF8\uBB38 \uB0B4 ${total}\uD68C \uB4F1\uC7A5 \u2014 occurrence 0..${Math.max(0, total - 1)})`
|
|
32157
32223
|
);
|
|
32158
32224
|
}
|
|
@@ -32160,9 +32226,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32160
32226
|
const xml = sectionXmls[si];
|
|
32161
32227
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
32162
32228
|
if (!run) {
|
|
32163
|
-
throw new (0,
|
|
32229
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
32164
32230
|
}
|
|
32165
|
-
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess',
|
|
32231
|
+
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _643 => _643.charPr, 'access', _644 => _644.get, 'call', _645 => _645(run.charPr), 'optionalAccess', _646 => _646.height]), () => ( 1e3));
|
|
32166
32232
|
const fontPt = charPrHeight / 100;
|
|
32167
32233
|
const emMm = fontPt * 25.4 / 72;
|
|
32168
32234
|
const lineHMm = emMm;
|
|
@@ -32171,7 +32237,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32171
32237
|
const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
|
|
32172
32238
|
const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
|
|
32173
32239
|
const paraPrId = _nullishCoalesce(attrOf3(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
|
|
32174
|
-
const align = _optionalChain([styles, 'optionalAccess',
|
|
32240
|
+
const align = _optionalChain([styles, 'optionalAccess', _647 => _647.paraAlign, 'access', _648 => _648.get, 'call', _649 => _649(paraPrId)]);
|
|
32175
32241
|
let alignShiftMm = 0;
|
|
32176
32242
|
if (align === "CENTER" || align === "RIGHT") {
|
|
32177
32243
|
const paraWMm = measureMm(site.para.text, emMm);
|
|
@@ -32267,7 +32333,7 @@ function parseBorderFills(headerDoc) {
|
|
|
32267
32333
|
};
|
|
32268
32334
|
const fillBrush = findChildByLocalName(bf, "fillBrush");
|
|
32269
32335
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
32270
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
32336
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _650 => _650.getAttribute, 'call', _651 => _651("faceColor")]);
|
|
32271
32337
|
if (face && face !== "none") def.fill = { faceColor: face };
|
|
32272
32338
|
map.set(id, def);
|
|
32273
32339
|
}
|
|
@@ -32299,7 +32365,7 @@ function parseCharPrs(headerDoc, hangulFonts) {
|
|
|
32299
32365
|
if (cp.getAttribute("italic") === "1") def.italic = true;
|
|
32300
32366
|
if (findChildByLocalName(cp, "underline")) def.underline = true;
|
|
32301
32367
|
const fontRef = findChildByLocalName(cp, "fontRef");
|
|
32302
|
-
const hangul = _optionalChain([fontRef, 'optionalAccess',
|
|
32368
|
+
const hangul = _optionalChain([fontRef, 'optionalAccess', _652 => _652.getAttribute, 'call', _653 => _653("hangul")]);
|
|
32303
32369
|
if (hangul) {
|
|
32304
32370
|
def.fontRef_hangul = hangul;
|
|
32305
32371
|
const face = hangulFonts.get(hangul);
|
|
@@ -32327,7 +32393,7 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
32327
32393
|
const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
|
|
32328
32394
|
const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
|
|
32329
32395
|
const sz = findChildByLocalName(tbl2, "sz");
|
|
32330
|
-
const width = _optionalChain([sz, 'optionalAccess',
|
|
32396
|
+
const width = _optionalChain([sz, 'optionalAccess', _654 => _654.getAttribute, 'call', _655 => _655("width")]) || void 0;
|
|
32331
32397
|
const cells = [];
|
|
32332
32398
|
const usedBf = /* @__PURE__ */ new Set();
|
|
32333
32399
|
const usedCp = /* @__PURE__ */ new Set();
|
|
@@ -32340,17 +32406,17 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
32340
32406
|
const addr = findChildByLocalName(tc2, "cellAddr");
|
|
32341
32407
|
const span2 = findChildByLocalName(tc2, "cellSpan");
|
|
32342
32408
|
const csz = findChildByLocalName(tc2, "cellSz");
|
|
32343
|
-
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
32344
|
-
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
32409
|
+
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _656 => _656.getAttribute, 'call', _657 => _657("rowAddr")])), () => ( 0));
|
|
32410
|
+
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _658 => _658.getAttribute, 'call', _659 => _659("colAddr")])), () => ( 0));
|
|
32345
32411
|
if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
|
|
32346
32412
|
if (row === 0) row0Texts.set(col, directCellText(tc2));
|
|
32347
|
-
const colSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess',
|
|
32348
|
-
const rowSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess',
|
|
32413
|
+
const colSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess', _660 => _660.getAttribute, 'call', _661 => _661("colSpan")])), () => ( 1));
|
|
32414
|
+
const rowSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess', _662 => _662.getAttribute, 'call', _663 => _663("rowSpan")])), () => ( 1));
|
|
32349
32415
|
const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
|
|
32350
32416
|
const cpId = firstRunCharPr(tc2);
|
|
32351
32417
|
const cell2 = { row, col, rowSpan, colSpan };
|
|
32352
|
-
const w = _optionalChain([csz, 'optionalAccess',
|
|
32353
|
-
const hh = _optionalChain([csz, 'optionalAccess',
|
|
32418
|
+
const w = _optionalChain([csz, 'optionalAccess', _664 => _664.getAttribute, 'call', _665 => _665("width")]);
|
|
32419
|
+
const hh = _optionalChain([csz, 'optionalAccess', _666 => _666.getAttribute, 'call', _667 => _667("height")]);
|
|
32354
32420
|
if (w) cell2.width_hwpunit = w;
|
|
32355
32421
|
if (hh) cell2.height_hwpunit = hh;
|
|
32356
32422
|
if (bfId) {
|
|
@@ -32438,16 +32504,16 @@ function pick(map, keys) {
|
|
|
32438
32504
|
return out;
|
|
32439
32505
|
}
|
|
32440
32506
|
async function hwpxToProfile(input) {
|
|
32441
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
32507
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkKZVQK5NScjs.toArrayBuffer.call(void 0, input);
|
|
32442
32508
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
32443
32509
|
const parser = createXmlParser();
|
|
32444
|
-
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access',
|
|
32510
|
+
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _668 => _668.file, 'call', _669 => _669(/[Hh]eader\.xml$/), 'optionalAccess', _670 => _670[0]])));
|
|
32445
32511
|
let headerXml = "<root/>";
|
|
32446
32512
|
if (headerFile) headerXml = await headerFile.async("text");
|
|
32447
32513
|
const headerDoc = parser.parseFromString(headerXml, "text/xml");
|
|
32448
32514
|
const borderFills = parseBorderFills(headerDoc);
|
|
32449
32515
|
const charPrs = parseCharPrs(headerDoc, parseHangulFonts(headerDoc));
|
|
32450
|
-
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access',
|
|
32516
|
+
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _671 => _671.name, 'access', _672 => _672.match, 'call', _673 => _673(/(\d+)\.xml$/), 'optionalAccess', _674 => _674[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _675 => _675.name, 'access', _676 => _676.match, 'call', _677 => _677(/(\d+)\.xml$/), 'optionalAccess', _678 => _678[1]]), () => ( null))), () => ( 0))));
|
|
32451
32517
|
const tables = [];
|
|
32452
32518
|
let tableIndex = 0;
|
|
32453
32519
|
for (const f of sectionFiles) {
|
|
@@ -32893,7 +32959,7 @@ function lintGongmunText(text, opts) {
|
|
|
32893
32959
|
}
|
|
32894
32960
|
}
|
|
32895
32961
|
}
|
|
32896
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
32962
|
+
if (_optionalChain([opts, 'optionalAccess', _679 => _679.document]) && /^\s*붙\s*임(?![가-힣])/m.test(text) && !/끝\.\s*$/m.test(text)) {
|
|
32897
32963
|
findings.push({
|
|
32898
32964
|
line: lines.length,
|
|
32899
32965
|
match: "\uBD99\uC784",
|
|
@@ -33163,7 +33229,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
|
|
|
33163
33229
|
var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
|
|
33164
33230
|
function patchTableRows(input) {
|
|
33165
33231
|
const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
|
|
33166
|
-
const xml = _optionalChain([ctx, 'access',
|
|
33232
|
+
const xml = _optionalChain([ctx, 'access', _680 => _680.scans, 'access', _681 => _681[scanTable.sectionIndex], 'optionalAccess', _682 => _682.xml]);
|
|
33167
33233
|
if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
|
|
33168
33234
|
const numRows = table2.rows;
|
|
33169
33235
|
if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
|
|
@@ -33330,7 +33396,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
|
|
|
33330
33396
|
const rr = scanTable.rowRanges[template];
|
|
33331
33397
|
const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
|
|
33332
33398
|
const scan = scanSectionXml(wrapped, 0);
|
|
33333
|
-
const row = _optionalChain([scan, 'access',
|
|
33399
|
+
const row = _optionalChain([scan, 'access', _683 => _683.tables, 'access', _684 => _684[0], 'optionalAccess', _685 => _685.rows, 'access', _686 => _686[0]]);
|
|
33334
33400
|
if (!row || row.length !== cells.length) return null;
|
|
33335
33401
|
const splices = allLinesegRemovalSplices(wrapped);
|
|
33336
33402
|
for (let i = 0; i < cells.length; i++) {
|
|
@@ -33373,7 +33439,7 @@ function rowHeightOf(fragment) {
|
|
|
33373
33439
|
}
|
|
33374
33440
|
function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
|
|
33375
33441
|
const from = scanTable.start + tblOpenLen;
|
|
33376
|
-
const to = _nullishCoalesce(_optionalChain([scanTable, 'access',
|
|
33442
|
+
const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _687 => _687.rowRanges, 'access', _688 => _688[0], 'optionalAccess', _689 => _689.start]), () => ( from));
|
|
33377
33443
|
const slice = xml.slice(from, to);
|
|
33378
33444
|
const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
|
|
33379
33445
|
if (!szM || szM.index === void 0) return null;
|
|
@@ -33562,9 +33628,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
|
|
|
33562
33628
|
});
|
|
33563
33629
|
}
|
|
33564
33630
|
function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
|
|
33565
|
-
const irCell = _optionalChain([table2, 'access',
|
|
33631
|
+
const irCell = _optionalChain([table2, 'access', _690 => _690.cells, 'access', _691 => _691[oc.gridR], 'optionalAccess', _692 => _692[oc.gridC]]);
|
|
33566
33632
|
const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
|
|
33567
|
-
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess',
|
|
33633
|
+
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _693 => _693.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
|
|
33568
33634
|
if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
|
|
33569
33635
|
return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
|
|
33570
33636
|
}
|
|
@@ -33591,8 +33657,8 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
33591
33657
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
33592
33658
|
const t = line.trim();
|
|
33593
33659
|
if (!t) return "";
|
|
33594
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
33595
|
-
return
|
|
33660
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkGPC72VSFcjs.escapeGfm.call(void 0, t)}**`;
|
|
33661
|
+
return _chunkGPC72VSFcjs.escapeGfm.call(void 0, t);
|
|
33596
33662
|
}).filter(Boolean);
|
|
33597
33663
|
if (replicaLines.join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
33598
33664
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -33606,7 +33672,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
33606
33672
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
33607
33673
|
const replica = [];
|
|
33608
33674
|
for (let r = 0; r < table2.rows; r++) {
|
|
33609
|
-
const line =
|
|
33675
|
+
const line = _chunkGPC72VSFcjs.escapeGfm.call(void 0, sanitizeText(table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
33610
33676
|
if (line) replica.push({ line, gridR: r });
|
|
33611
33677
|
}
|
|
33612
33678
|
if (replica.map((x) => x.line).join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
@@ -33632,7 +33698,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
33632
33698
|
};
|
|
33633
33699
|
const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
|
|
33634
33700
|
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)");
|
|
33635
|
-
const irCell = _optionalChain([table2, 'access',
|
|
33701
|
+
const irCell = _optionalChain([table2, 'access', _694 => _694.cells, 'access', _695 => _695[gridR], 'optionalAccess', _696 => _696[gridC]]);
|
|
33636
33702
|
const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
|
|
33637
33703
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
33638
33704
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -33656,7 +33722,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
33656
33722
|
const target = cell2.paragraphs[0];
|
|
33657
33723
|
if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
|
|
33658
33724
|
const value = newLines.join(" ");
|
|
33659
|
-
const xml = _optionalChain([ctx, 'access',
|
|
33725
|
+
const xml = _optionalChain([ctx, 'access', _697 => _697.scans, 'access', _698 => _698[target.sectionIndex], 'optionalAccess', _699 => _699.xml]);
|
|
33660
33726
|
const rawT = xml ? paraTText(target, xml) : null;
|
|
33661
33727
|
let sp;
|
|
33662
33728
|
if (xml && rawT === null) {
|
|
@@ -33690,7 +33756,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
33690
33756
|
}
|
|
33691
33757
|
for (let i = 0; i < nonEmpty.length; i++) {
|
|
33692
33758
|
if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
|
|
33693
|
-
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access',
|
|
33759
|
+
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _700 => _700.scans, 'access', _701 => _701[nonEmpty[i].sectionIndex], 'optionalAccess', _702 => _702.xml]));
|
|
33694
33760
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
33695
33761
|
splices.push(...sp);
|
|
33696
33762
|
sectionIndex = nonEmpty[i].sectionIndex;
|
|
@@ -33771,7 +33837,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
33771
33837
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
33772
33838
|
if (paths.length > 0) return paths;
|
|
33773
33839
|
}
|
|
33774
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
33840
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkKZVQK5NScjs.compareSectionPaths);
|
|
33775
33841
|
}
|
|
33776
33842
|
function sectionPathsFromManifest(xml) {
|
|
33777
33843
|
const attr = (tag, name) => {
|
|
@@ -33781,7 +33847,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
33781
33847
|
const idToHref = /* @__PURE__ */ new Map();
|
|
33782
33848
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
33783
33849
|
const id = attr(m[1], "id");
|
|
33784
|
-
const href =
|
|
33850
|
+
const href = _chunkKZVQK5NScjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
33785
33851
|
if (id && href) idToHref.set(id, href);
|
|
33786
33852
|
}
|
|
33787
33853
|
const ordered = [];
|
|
@@ -33790,7 +33856,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
33790
33856
|
if (href) ordered.push(href);
|
|
33791
33857
|
}
|
|
33792
33858
|
if (ordered.length > 0) return ordered;
|
|
33793
|
-
return Array.from(idToHref.values()).sort(
|
|
33859
|
+
return Array.from(idToHref.values()).sort(_chunkKZVQK5NScjs.compareSectionPaths);
|
|
33794
33860
|
}
|
|
33795
33861
|
|
|
33796
33862
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -33919,7 +33985,7 @@ var Surgeon = (_class9 = class {
|
|
|
33919
33985
|
/** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
|
|
33920
33986
|
findEntry(path) {
|
|
33921
33987
|
const parts = path.replace(/^\//, "").split("/");
|
|
33922
|
-
let scope = _nullishCoalesce(_optionalChain([this, 'access',
|
|
33988
|
+
let scope = _nullishCoalesce(_optionalChain([this, 'access', _703 => _703.entries, 'access', _704 => _704[0], 'optionalAccess', _705 => _705.child]), () => ( -1));
|
|
33923
33989
|
let current;
|
|
33924
33990
|
for (const part of parts) {
|
|
33925
33991
|
const search = (idx) => {
|
|
@@ -34213,8 +34279,8 @@ function serializeRecords(recs, repl, inserts) {
|
|
|
34213
34279
|
parts.push(header, data);
|
|
34214
34280
|
};
|
|
34215
34281
|
for (let i = 0; i < recs.length; i++) {
|
|
34216
|
-
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess',
|
|
34217
|
-
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess',
|
|
34282
|
+
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _706 => _706.get, 'call', _707 => _707(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
|
|
34283
|
+
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _708 => _708.get, 'call', _709 => _709(i)]), () => ( recs[i].data)));
|
|
34218
34284
|
}
|
|
34219
34285
|
return Buffer.concat(parts);
|
|
34220
34286
|
}
|
|
@@ -34333,7 +34399,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
34333
34399
|
return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
|
|
34334
34400
|
}
|
|
34335
34401
|
const fhEntry = CFB2.find(cfb, "/FileHeader");
|
|
34336
|
-
if (!_optionalChain([fhEntry, 'optionalAccess',
|
|
34402
|
+
if (!_optionalChain([fhEntry, 'optionalAccess', _710 => _710.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
34337
34403
|
let flags;
|
|
34338
34404
|
try {
|
|
34339
34405
|
flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
|
|
@@ -34357,7 +34423,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
34357
34423
|
const scans = [];
|
|
34358
34424
|
for (let i = 0; i < sectionPaths.length; i++) {
|
|
34359
34425
|
const entry = CFB2.find(cfb, sectionPaths[i]);
|
|
34360
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
34426
|
+
if (!_optionalChain([entry, 'optionalAccess', _711 => _711.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
|
|
34361
34427
|
let stream;
|
|
34362
34428
|
try {
|
|
34363
34429
|
stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
@@ -34408,7 +34474,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
34408
34474
|
}
|
|
34409
34475
|
}
|
|
34410
34476
|
let verification;
|
|
34411
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
34477
|
+
if (_optionalChain([options, 'optionalAccess', _712 => _712.verify]) !== false) {
|
|
34412
34478
|
try {
|
|
34413
34479
|
const reparsed = parseHwp5Document(Buffer.from(data), { layoutTables: "keep" });
|
|
34414
34480
|
const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
|
|
@@ -34503,7 +34569,7 @@ function tableContentScore(irTable, scanTable) {
|
|
|
34503
34569
|
for (const [key, scanCell] of scanTable.cells) {
|
|
34504
34570
|
const comma = key.indexOf(",");
|
|
34505
34571
|
const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
|
|
34506
|
-
const irCell = _optionalChain([irTable, 'access',
|
|
34572
|
+
const irCell = _optionalChain([irTable, 'access', _713 => _713.cells, 'access', _714 => _714[r], 'optionalAccess', _715 => _715[c]]);
|
|
34507
34573
|
if (!irCell) continue;
|
|
34508
34574
|
const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
|
|
34509
34575
|
const b = normForMatch(stripCellTokens(irCell.text));
|
|
@@ -34539,7 +34605,7 @@ function handleModified(orig, edited, ctx) {
|
|
|
34539
34605
|
}
|
|
34540
34606
|
function patchParagraph(block, orig, edited, ctx, skip) {
|
|
34541
34607
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
34542
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
34608
|
+
if (!_optionalChain([mapping, 'optionalAccess', _716 => _716.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)");
|
|
34543
34609
|
const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
|
|
34544
34610
|
let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
|
|
34545
34611
|
if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
|
|
@@ -34697,8 +34763,8 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
34697
34763
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
34698
34764
|
const t = line.trim();
|
|
34699
34765
|
if (!t) return "";
|
|
34700
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
34701
|
-
return
|
|
34766
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkGPC72VSFcjs.escapeGfm.call(void 0, t)}**`;
|
|
34767
|
+
return _chunkGPC72VSFcjs.escapeGfm.call(void 0, t);
|
|
34702
34768
|
}).filter(Boolean);
|
|
34703
34769
|
if (replicaLines.join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
34704
34770
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -34712,7 +34778,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
34712
34778
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
34713
34779
|
const replica = [];
|
|
34714
34780
|
for (let r = 0; r < table2.rows; r++) {
|
|
34715
|
-
const line =
|
|
34781
|
+
const line = _chunkGPC72VSFcjs.escapeGfm.call(void 0, sanitizeText(table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
34716
34782
|
if (line) replica.push({ line, gridR: r });
|
|
34717
34783
|
}
|
|
34718
34784
|
if (replica.map((x) => x.line).join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
@@ -34738,7 +34804,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
34738
34804
|
};
|
|
34739
34805
|
const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
|
|
34740
34806
|
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)");
|
|
34741
|
-
const irCell = _optionalChain([table2, 'access',
|
|
34807
|
+
const irCell = _optionalChain([table2, 'access', _717 => _717.cells, 'access', _718 => _718[gridR], 'optionalAccess', _719 => _719[gridC]]);
|
|
34742
34808
|
const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
|
|
34743
34809
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
34744
34810
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -35094,7 +35160,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
35094
35160
|
}
|
|
35095
35161
|
}
|
|
35096
35162
|
let verification;
|
|
35097
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
35163
|
+
if (_optionalChain([options, 'optionalAccess', _720 => _720.verify]) !== false) {
|
|
35098
35164
|
try {
|
|
35099
35165
|
const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data), { layoutTables: "keep" });
|
|
35100
35166
|
verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
|
|
@@ -35112,17 +35178,17 @@ function buildOrigUnits(blocks) {
|
|
|
35112
35178
|
let chunk;
|
|
35113
35179
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
35114
35180
|
const next = blocks[i + 1];
|
|
35115
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
35116
|
-
chunk =
|
|
35181
|
+
if (_optionalChain([next, 'optionalAccess', _721 => _721.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
35182
|
+
chunk = _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
35117
35183
|
} else {
|
|
35118
|
-
chunk =
|
|
35184
|
+
chunk = _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, [block]);
|
|
35119
35185
|
}
|
|
35120
35186
|
if (chunk) {
|
|
35121
35187
|
const subUnits = splitMarkdownUnits(chunk);
|
|
35122
35188
|
const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
|
|
35123
35189
|
for (let s = 0; s < subUnits.length; s++) {
|
|
35124
35190
|
const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
|
|
35125
|
-
if (block.type === "table" && _optionalChain([block, 'access',
|
|
35191
|
+
if (block.type === "table" && _optionalChain([block, 'access', _722 => _722.table, 'optionalAccess', _723 => _723.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
|
|
35126
35192
|
u.role = "caption";
|
|
35127
35193
|
}
|
|
35128
35194
|
units.push(u);
|
|
@@ -35331,7 +35397,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
35331
35397
|
const ti = ctx.tableInsert;
|
|
35332
35398
|
if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
|
|
35333
35399
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
35334
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
35400
|
+
if (!_optionalChain([mapping, 'optionalAccess', _724 => _724.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");
|
|
35335
35401
|
const para2 = mapping.para;
|
|
35336
35402
|
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");
|
|
35337
35403
|
const scan = ctx.scans[para2.sectionIndex];
|
|
@@ -35359,7 +35425,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
35359
35425
|
}
|
|
35360
35426
|
function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
35361
35427
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
35362
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
35428
|
+
if (!_optionalChain([mapping, 'optionalAccess', _725 => _725.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)");
|
|
35363
35429
|
if (block.text && block.text.includes("\n")) {
|
|
35364
35430
|
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)");
|
|
35365
35431
|
}
|
|
@@ -35376,7 +35442,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
35376
35442
|
ctx.skipped.push({ reason: "\uAC01\uC8FC \uD45C\uAE30 \uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 \u2014 \uAC01\uC8FC \uC720\uC9C0, \uBCF8\uBB38\uB9CC \uC801\uC6A9", before: `(\uC8FC: ${block.footnoteText})` });
|
|
35377
35443
|
}
|
|
35378
35444
|
}
|
|
35379
|
-
if (_optionalChain([mapping, 'access',
|
|
35445
|
+
if (_optionalChain([mapping, 'access', _726 => _726.noteMarks, 'optionalAccess', _727 => _727.length])) {
|
|
35380
35446
|
const r = removeNoteMarks(newPlain, mapping.noteMarks);
|
|
35381
35447
|
newPlain = r.text;
|
|
35382
35448
|
if (r.missing.length) ctx.skipped.push({ reason: "\uAC01\uC8FC \uCC38\uC870 \uBD80\uD638 \uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 \u2014 \uAC01\uC8FC \uC720\uC9C0, \uBCF8\uBB38\uB9CC \uC801\uC6A9", before: r.missing.join(" ") });
|
|
@@ -35395,7 +35461,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
35395
35461
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
35396
35462
|
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");
|
|
35397
35463
|
}
|
|
35398
|
-
const xml = _optionalChain([ctx, 'access',
|
|
35464
|
+
const xml = _optionalChain([ctx, 'access', _728 => _728.scans, 'access', _729 => _729[mapping.para.sectionIndex], 'optionalAccess', _730 => _730.xml]);
|
|
35399
35465
|
const splices = _nullishCoalesce((xml ? markerRunSplices(mapping.para, xml, newPlain) : null), () => ( buildParagraphSplices(mapping.para, newPlain, xml)));
|
|
35400
35466
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
35401
35467
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
@@ -35917,7 +35983,7 @@ var REF_NOUN = alt([
|
|
|
35917
35983
|
]);
|
|
35918
35984
|
var REF = `\\s?\\((?!(?:${REF_NOUN})[),])[\uAC00-\uD7A3]{1,6}(?:\\d{0,2}(?:\uB3D9|\uB9AC)|\\d{1,2}\uAC00)(?:,\\s?[^)]{1,30})?\\)`;
|
|
35919
35985
|
var PLACEHOLDER_NO = /(?<![\d-])0+(?![\d])/;
|
|
35920
|
-
var realNumber = (x) => !PLACEHOLDER_NO.test(_nullishCoalesce(_optionalChain([x, 'access',
|
|
35986
|
+
var realNumber = (x) => !PLACEHOLDER_NO.test(_nullishCoalesce(_optionalChain([x, 'access', _731 => _731.m, 'access', _732 => _732.groups, 'optionalAccess', _733 => _733.rest]), () => ( "")));
|
|
35921
35987
|
var ADDRESS_VARIANTS = [
|
|
35922
35988
|
{
|
|
35923
35989
|
// 도로명 주소 — 읍·면, 동·리("서울시 도봉구 창동 우이천로 4다길 9"·"서천군 판교면 판교리 대백제로 1999") 뒤도, 참고항목까지
|
|
@@ -37026,9 +37092,9 @@ var REGION_WORDS = /* @__PURE__ */ new Set([...SIDO, ...SIGUNGU, ...SIGUNGU.filt
|
|
|
37026
37092
|
var NON_NAME_END = /(?:적|하여|하는|하고|하며|하게|하기|하면|하다|한다|했다|는데|니다|습니|다고|해야|해서|되는|되어|된다|지만|니까|와서|워서)$/;
|
|
37027
37093
|
var FOREIGN_SYLLABLE = /[스트크드브프즈츠끄뜨쁘쓰쯔플클블러케퍼커터텔톤튼픈핀펜헨앤엔엠켓렛쇼핑]/;
|
|
37028
37094
|
var TITLE_SET = /* @__PURE__ */ new Set([...TITLES, ...RANKS, ...PARTY_ROLES]);
|
|
37029
|
-
var g = (x, name) => _nullishCoalesce(_optionalChain([x, 'access',
|
|
37095
|
+
var g = (x, name) => _nullishCoalesce(_optionalChain([x, 'access', _734 => _734.m, 'access', _735 => _735.groups, 'optionalAccess', _736 => _736[name]]), () => ( ""));
|
|
37030
37096
|
var nameOf = (x) => g(x, "dsur") + g(x, "dgiven") + g(x, "sur") + g(x, "given") + g(x, "given1");
|
|
37031
|
-
var span = (x) => _optionalChain([x, 'access',
|
|
37097
|
+
var span = (x) => _optionalChain([x, 'access', _737 => _737.m, 'access', _738 => _738.indices, 'optionalAccess', _739 => _739.groups, 'optionalAccess', _740 => _740.n]);
|
|
37032
37098
|
var nextIs = (x, re) => {
|
|
37033
37099
|
const n = span(x);
|
|
37034
37100
|
return !!n && re.test(x.m.input.slice(n[1], n[1] + 1));
|
|
@@ -37400,7 +37466,7 @@ function labelsBefore(norm2, start) {
|
|
|
37400
37466
|
return labelsIn(win);
|
|
37401
37467
|
}
|
|
37402
37468
|
var OTHER_AFTER_RE = /^\s{0,2}[(\[]?\s{0,2}(?:접\s*수|신\s*청|주\s*문|사\s*건|과\s*제|문\s*서|관\s*리|부\s*품|제\s*품|모\s*델|코\s*드|시\s*리\s*얼|serial|model)/i;
|
|
37403
|
-
var g2 = (x, name) => _nullishCoalesce(_optionalChain([x, 'access',
|
|
37469
|
+
var g2 = (x, name) => _nullishCoalesce(_optionalChain([x, 'access', _741 => _741.m, 'access', _742 => _742.groups, 'optionalAccess', _743 => _743[name]]), () => ( ""));
|
|
37404
37470
|
var has = (x, c) => x.ctx().has(c);
|
|
37405
37471
|
var crnOnly = (x) => has(x, "crn") && !has(x, "rrn");
|
|
37406
37472
|
var after = (x, n = 16) => {
|
|
@@ -37708,9 +37774,9 @@ function normalizeForDetect(text) {
|
|
|
37708
37774
|
}
|
|
37709
37775
|
function maskMatch(orig, norm2, start, x, v, maskChar) {
|
|
37710
37776
|
const chars = orig.split("");
|
|
37711
|
-
const idx = _optionalChain([x, 'access',
|
|
37777
|
+
const idx = _optionalChain([x, 'access', _744 => _744.m, 'access', _745 => _745.indices, 'optionalAccess', _746 => _746.groups]);
|
|
37712
37778
|
for (const name of v.mask) {
|
|
37713
|
-
const r = _optionalChain([idx, 'optionalAccess',
|
|
37779
|
+
const r = _optionalChain([idx, 'optionalAccess', _747 => _747[name]]);
|
|
37714
37780
|
if (!r) continue;
|
|
37715
37781
|
for (let i = r[0] - start; i < r[1] - start; i++) {
|
|
37716
37782
|
if (v.maskAll || /[\p{L}\p{N}]/u.test(norm2[start + i])) chars[i] = maskChar;
|
|
@@ -37735,7 +37801,7 @@ function detect(text, rules, maskChar, headerAt) {
|
|
|
37735
37801
|
const re = v.re;
|
|
37736
37802
|
re.lastIndex = 0;
|
|
37737
37803
|
for (let m = re.exec(norm2); m !== null; m = re.exec(norm2)) {
|
|
37738
|
-
const sg = v.span ? _optionalChain([m, 'access',
|
|
37804
|
+
const sg = v.span ? _optionalChain([m, 'access', _748 => _748.indices, 'optionalAccess', _749 => _749.groups, 'optionalAccess', _750 => _750[v.span]]) : void 0;
|
|
37739
37805
|
const start = sg ? sg[0] : m.index;
|
|
37740
37806
|
const end = sg ? sg[1] : start + m[0].length;
|
|
37741
37807
|
const retry = () => {
|
|
@@ -37764,7 +37830,7 @@ function detect(text, rules, maskChar, headerAt) {
|
|
|
37764
37830
|
const x = {
|
|
37765
37831
|
m,
|
|
37766
37832
|
ctx,
|
|
37767
|
-
header: () => _optionalChain([headerAt, 'optionalCall',
|
|
37833
|
+
header: () => _optionalChain([headerAt, 'optionalCall', _751 => _751(start)]),
|
|
37768
37834
|
prev: () => {
|
|
37769
37835
|
let best;
|
|
37770
37836
|
for (const o of occupied) if (o.end <= start && (!best || o.end > best.end)) best = o;
|
|
@@ -37792,9 +37858,9 @@ function applyHits(text, hits) {
|
|
|
37792
37858
|
return out + text.slice(cursor);
|
|
37793
37859
|
}
|
|
37794
37860
|
function redactText(text, options) {
|
|
37795
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
37861
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _752 => _752.maskChar]), () => ( "\u25CF"));
|
|
37796
37862
|
assertMaskChar(maskChar);
|
|
37797
|
-
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
37863
|
+
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _753 => _753.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
37798
37864
|
if (text === "" || rules.length === 0) return { text, hits: [] };
|
|
37799
37865
|
const hits = detect(text, rules, maskChar);
|
|
37800
37866
|
return { text: applyHits(text, hits), hits };
|
|
@@ -37812,7 +37878,7 @@ function htmlCells(line) {
|
|
|
37812
37878
|
const out = [];
|
|
37813
37879
|
let col = 0;
|
|
37814
37880
|
for (const m of line.matchAll(/<t([dh])\b([^>]*)>([\s\S]*?)<\/t\1>/gi)) {
|
|
37815
|
-
const span2 = Math.max(1, Number(_nullishCoalesce(_optionalChain([m, 'access',
|
|
37881
|
+
const span2 = Math.max(1, Number(_nullishCoalesce(_optionalChain([m, 'access', _754 => _754[2], 'access', _755 => _755.match, 'call', _756 => _756(/colspan="?(\d+)/i), 'optionalAccess', _757 => _757[1]]), () => ( 1))));
|
|
37816
37882
|
out.push({ start: m.index, end: m.index + m[0].length, col, span: span2, text: m[3].replace(/<[^>]*>/g, " ") });
|
|
37817
37883
|
col += span2;
|
|
37818
37884
|
}
|
|
@@ -37854,7 +37920,7 @@ function tableHeaderContext(lines) {
|
|
|
37854
37920
|
const c = cells.find((x) => off >= x.start && off < x.end);
|
|
37855
37921
|
if (!c) return void 0;
|
|
37856
37922
|
const h = hdr.find((x) => c.col >= x.col && c.col < x.col + x.span);
|
|
37857
|
-
return _optionalChain([h, 'optionalAccess',
|
|
37923
|
+
return _optionalChain([h, 'optionalAccess', _758 => _758.text]);
|
|
37858
37924
|
});
|
|
37859
37925
|
}
|
|
37860
37926
|
}
|
|
@@ -37923,9 +37989,9 @@ function detectMarkdownLine(line, rules, maskChar, headerAt) {
|
|
|
37923
37989
|
});
|
|
37924
37990
|
}
|
|
37925
37991
|
function redactMarkdown(markdown, options) {
|
|
37926
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
37992
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _759 => _759.maskChar]), () => ( "\u25CF"));
|
|
37927
37993
|
assertMaskChar(maskChar);
|
|
37928
|
-
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
37994
|
+
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _760 => _760.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
37929
37995
|
const lines = markdown.split("\n");
|
|
37930
37996
|
const headers = tableHeaderContext(lines);
|
|
37931
37997
|
const hits = [];
|
|
@@ -37955,8 +38021,8 @@ function sameBreadcrumb(a, b) {
|
|
|
37955
38021
|
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
37956
38022
|
}
|
|
37957
38023
|
function blocksToChunks(blocks, options) {
|
|
37958
|
-
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
37959
|
-
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
38024
|
+
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _761 => _761.granularity]), () => ( "section"));
|
|
38025
|
+
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _762 => _762.includeTableCells]), () => ( false));
|
|
37960
38026
|
const chunks = [];
|
|
37961
38027
|
const headingStack = [];
|
|
37962
38028
|
const listStack = [];
|
|
@@ -37970,12 +38036,12 @@ function blocksToChunks(blocks, options) {
|
|
|
37970
38036
|
let run = null;
|
|
37971
38037
|
const flushRun = () => {
|
|
37972
38038
|
if (!run) return;
|
|
37973
|
-
push("text", run.breadcrumb,
|
|
38039
|
+
push("text", run.breadcrumb, _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
37974
38040
|
run = null;
|
|
37975
38041
|
};
|
|
37976
38042
|
for (let i = 0; i < blocks.length; i++) {
|
|
37977
38043
|
const block = blocks[i];
|
|
37978
|
-
const md2 =
|
|
38044
|
+
const md2 = _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, [block]);
|
|
37979
38045
|
if (!md2) continue;
|
|
37980
38046
|
if (block.type === "heading") {
|
|
37981
38047
|
flushRun();
|
|
@@ -38093,7 +38159,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38093
38159
|
const block = st.blocks[blockIndex];
|
|
38094
38160
|
if (!block) return void 0;
|
|
38095
38161
|
if (block.type === "paragraph" || block.type === "heading") {
|
|
38096
|
-
const para2 = _optionalChain([st, 'access',
|
|
38162
|
+
const para2 = _optionalChain([st, 'access', _763 => _763.paraMap, 'access', _764 => _764.get, 'call', _765 => _765(blockIndex), 'optionalAccess', _766 => _766.para]);
|
|
38097
38163
|
if (!para2) return void 0;
|
|
38098
38164
|
return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
|
|
38099
38165
|
}
|
|
@@ -38118,7 +38184,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38118
38184
|
if (block.text && block.text.includes("\n")) {
|
|
38119
38185
|
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)" };
|
|
38120
38186
|
}
|
|
38121
|
-
if (!_optionalChain([st, 'access',
|
|
38187
|
+
if (!_optionalChain([st, 'access', _767 => _767.paraMap, 'access', _768 => _768.get, 'call', _769 => _769(blockIndex), 'optionalAccess', _770 => _770.para])) {
|
|
38122
38188
|
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)" };
|
|
38123
38189
|
}
|
|
38124
38190
|
return { capability: "text" };
|
|
@@ -38184,7 +38250,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38184
38250
|
continue;
|
|
38185
38251
|
}
|
|
38186
38252
|
if (block.type === "table" && block.table) {
|
|
38187
|
-
if (!_optionalChain([edit, 'access',
|
|
38253
|
+
if (!_optionalChain([edit, 'access', _771 => _771.cells, 'optionalAccess', _772 => _772.length])) {
|
|
38188
38254
|
skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
|
|
38189
38255
|
continue;
|
|
38190
38256
|
}
|
|
@@ -38204,7 +38270,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38204
38270
|
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) });
|
|
38205
38271
|
continue;
|
|
38206
38272
|
}
|
|
38207
|
-
const irCell = _optionalChain([block, 'access',
|
|
38273
|
+
const irCell = _optionalChain([block, 'access', _773 => _773.table, 'access', _774 => _774.cells, 'access', _775 => _775[cellEdit.row], 'optionalAccess', _776 => _776[cellEdit.col]]);
|
|
38208
38274
|
if (!irCell) {
|
|
38209
38275
|
skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
|
|
38210
38276
|
continue;
|
|
@@ -38260,7 +38326,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38260
38326
|
}
|
|
38261
38327
|
if (replacements.size === 0) {
|
|
38262
38328
|
let changes2;
|
|
38263
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
38329
|
+
if (_optionalChain([options, 'optionalAccess', _777 => _777.verify]) !== false) {
|
|
38264
38330
|
const units = splitMarkdownUnits(st.markdown);
|
|
38265
38331
|
changes2 = diffUnitLists(units, units);
|
|
38266
38332
|
}
|
|
@@ -38281,7 +38347,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38281
38347
|
}
|
|
38282
38348
|
this.state = newState;
|
|
38283
38349
|
let changes;
|
|
38284
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
38350
|
+
if (_optionalChain([options, 'optionalAccess', _778 => _778.verify]) !== false) {
|
|
38285
38351
|
changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
|
|
38286
38352
|
}
|
|
38287
38353
|
return { success: true, data: new Uint8Array(data), applied, skipped, changes };
|
|
@@ -38301,11 +38367,11 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38301
38367
|
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)");
|
|
38302
38368
|
}
|
|
38303
38369
|
const mapping = st.paraMap.get(blockIndex);
|
|
38304
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
38370
|
+
if (!_optionalChain([mapping, 'optionalAccess', _779 => _779.para])) {
|
|
38305
38371
|
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)");
|
|
38306
38372
|
}
|
|
38307
38373
|
let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
38308
|
-
if (_optionalChain([mapping, 'access',
|
|
38374
|
+
if (_optionalChain([mapping, 'access', _780 => _780.noteMarks, 'optionalAccess', _781 => _781.length])) {
|
|
38309
38375
|
const r = removeNoteMarks(newPlain, mapping.noteMarks);
|
|
38310
38376
|
newPlain = r.text;
|
|
38311
38377
|
if (r.missing.length) skipped.push({ reason: "\uAC01\uC8FC \uCC38\uC870 \uBD80\uD638 \uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 \u2014 \uAC01\uC8FC \uC720\uC9C0, \uBCF8\uBB38\uB9CC \uC801\uC6A9", before: r.missing.join(" ") });
|
|
@@ -38326,14 +38392,14 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38326
38392
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
38327
38393
|
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");
|
|
38328
38394
|
}
|
|
38329
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access',
|
|
38395
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _782 => _782.scans, 'access', _783 => _783[mapping.para.sectionIndex], 'optionalAccess', _784 => _784.xml]));
|
|
38330
38396
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
38331
38397
|
sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
38332
38398
|
return 1;
|
|
38333
38399
|
}
|
|
38334
38400
|
}, _class10);
|
|
38335
38401
|
function cellStaticCheck(table2, scanTable, r, c) {
|
|
38336
|
-
const irCell = _optionalChain([table2, 'access',
|
|
38402
|
+
const irCell = _optionalChain([table2, 'access', _785 => _785.cells, 'access', _786 => _786[r], 'optionalAccess', _787 => _787[c]]);
|
|
38337
38403
|
if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
|
|
38338
38404
|
const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
|
|
38339
38405
|
if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
|
|
@@ -38418,16 +38484,16 @@ var md = new (0, _markdownit2.default)({
|
|
|
38418
38484
|
});
|
|
38419
38485
|
var SAFE_RAW_TAG = /^(?:<\/?(?:table|thead|tbody|tfoot|tr|th|td|u)>|<br\s*\/?>|<(?:th|td)(?: (?:colspan|rowspan)="[1-9]\d*"){1,2}>|<img src="(?:images\/(?:[^"'<>\/\s]+\/)?)?image_\d+\.(?:png|jpe?g|gif|webp|bmp)" alt="image">)$/i;
|
|
38420
38486
|
function sanitizeRawHtml(raw) {
|
|
38421
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
38487
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkKZVQK5NScjs.escapeHtml.call(void 0, tag));
|
|
38422
38488
|
}
|
|
38423
38489
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
38424
38490
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
38425
38491
|
function renderHtml(markdown, options) {
|
|
38426
|
-
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
38427
|
-
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
38492
|
+
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _788 => _788.preset]), () => ( "default"));
|
|
38493
|
+
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _789 => _789.extraCss]), () => ( "")));
|
|
38428
38494
|
const body = md.render(markdown);
|
|
38429
|
-
const watermark = _optionalChain([options, 'optionalAccess',
|
|
38430
|
-
const watermarkCss = _optionalChain([options, 'optionalAccess',
|
|
38495
|
+
const watermark = _optionalChain([options, 'optionalAccess', _790 => _790.watermark]) ? `<div class="watermark">${_chunkKZVQK5NScjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
38496
|
+
const watermarkCss = _optionalChain([options, 'optionalAccess', _791 => _791.watermark]) ? `
|
|
38431
38497
|
.watermark {
|
|
38432
38498
|
position: fixed;
|
|
38433
38499
|
top: 50%; left: 50%;
|
|
@@ -38477,13 +38543,13 @@ async function htmlToPdf(html, options) {
|
|
|
38477
38543
|
try {
|
|
38478
38544
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
38479
38545
|
} catch (e40) {
|
|
38480
|
-
throw new (0,
|
|
38546
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(
|
|
38481
38547
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
38482
38548
|
);
|
|
38483
38549
|
}
|
|
38484
38550
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
38485
38551
|
if (!executablePath) {
|
|
38486
|
-
throw new (0,
|
|
38552
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(
|
|
38487
38553
|
"Chromium \uC2E4\uD589 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. PUPPETEER_EXECUTABLE_PATH \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694."
|
|
38488
38554
|
);
|
|
38489
38555
|
}
|
|
@@ -38491,10 +38557,10 @@ async function htmlToPdf(html, options) {
|
|
|
38491
38557
|
try {
|
|
38492
38558
|
await page.setContent(html, { waitUntil: "load" });
|
|
38493
38559
|
await page.waitForNetworkIdle({ idleTime: 500, concurrency: 0 });
|
|
38494
|
-
const margin = _optionalChain([options, 'optionalAccess',
|
|
38560
|
+
const margin = _optionalChain([options, 'optionalAccess', _792 => _792.margin]);
|
|
38495
38561
|
const pdf = await page.pdf({
|
|
38496
|
-
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
38497
|
-
landscape: _optionalChain([options, 'optionalAccess',
|
|
38562
|
+
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _793 => _793.pageSize]), () => ( "A4")),
|
|
38563
|
+
landscape: _optionalChain([options, 'optionalAccess', _794 => _794.orientation]) === "landscape",
|
|
38498
38564
|
printBackground: true,
|
|
38499
38565
|
margin: margin ? {
|
|
38500
38566
|
top: toCss(margin.top),
|
|
@@ -38502,9 +38568,9 @@ async function htmlToPdf(html, options) {
|
|
|
38502
38568
|
bottom: toCss(margin.bottom),
|
|
38503
38569
|
left: toCss(margin.left)
|
|
38504
38570
|
} : void 0,
|
|
38505
|
-
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess',
|
|
38506
|
-
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
38507
|
-
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
38571
|
+
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _795 => _795.header]) || _optionalChain([options, 'optionalAccess', _796 => _796.footer])),
|
|
38572
|
+
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _797 => _797.header]), () => ( "<div></div>")),
|
|
38573
|
+
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _798 => _798.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
|
|
38508
38574
|
});
|
|
38509
38575
|
return Buffer.from(pdf);
|
|
38510
38576
|
} finally {
|
|
@@ -38538,7 +38604,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
38538
38604
|
return htmlToPdf(html, options);
|
|
38539
38605
|
}
|
|
38540
38606
|
async function blocksToPdf(blocks, options) {
|
|
38541
|
-
const markdown =
|
|
38607
|
+
const markdown = _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
38542
38608
|
return markdownToPdf(markdown, options);
|
|
38543
38609
|
}
|
|
38544
38610
|
|
|
@@ -38691,7 +38757,7 @@ function buildPara(p) {
|
|
|
38691
38757
|
const pos = findChildByLocalName(ch, "pos");
|
|
38692
38758
|
const w = num2(sz, "width") || num2(findChildByLocalName(ch, "curSz"), "width") || num2(findChildByLocalName(ch, "orgSz"), "width");
|
|
38693
38759
|
const h = num2(sz, "height") || num2(findChildByLocalName(ch, "curSz"), "height") || num2(findChildByLocalName(ch, "orgSz"), "height");
|
|
38694
|
-
const inline = _optionalChain([pos, 'optionalAccess',
|
|
38760
|
+
const inline = _optionalChain([pos, 'optionalAccess', _799 => _799.getAttribute, 'call', _800 => _800("treatAsChar")]) === "1";
|
|
38695
38761
|
const om = inline && cn === "tbl" ? findChildByLocalName(ch, "outMargin") : null;
|
|
38696
38762
|
objs.push({
|
|
38697
38763
|
el: ch,
|
|
@@ -38724,20 +38790,20 @@ function buildPara(p) {
|
|
|
38724
38790
|
var DEFAULT_TAB_HU = 4e3;
|
|
38725
38791
|
function tabAdvance(x, firstLine, geom, saved = 0) {
|
|
38726
38792
|
const hang = geom && geom.marginIntent < 0 ? -geom.marginIntent : 0;
|
|
38727
|
-
if (firstLine && _optionalChain([geom, 'optionalAccess',
|
|
38793
|
+
if (firstLine && _optionalChain([geom, 'optionalAccess', _801 => _801.autoTabLeft]) && hang > 0 && x < hang - 0.5) return hang - x;
|
|
38728
38794
|
if (saved > 0) return saved;
|
|
38729
38795
|
return (Math.floor(x / DEFAULT_TAB_HU) + 1) * DEFAULT_TAB_HU - x;
|
|
38730
38796
|
}
|
|
38731
38797
|
function cellContentExtent(cell2, memo) {
|
|
38732
38798
|
if (!cell2.sub) return 0;
|
|
38733
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
38799
|
+
const hit = _optionalChain([memo, 'optionalAccess', _802 => _802.cell, 'access', _803 => _803.get, 'call', _804 => _804(cell2.el)]);
|
|
38734
38800
|
if (hit !== void 0) return hit;
|
|
38735
38801
|
let ext = 0;
|
|
38736
38802
|
for (const p of elements(cell2.sub)) {
|
|
38737
38803
|
if (ln(p) !== "p") continue;
|
|
38738
38804
|
const m = buildPara(p);
|
|
38739
38805
|
for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
|
|
38740
|
-
const baseV = _nullishCoalesce(_optionalChain([m, 'access',
|
|
38806
|
+
const baseV = _nullishCoalesce(_optionalChain([m, 'access', _805 => _805.segs, 'access', _806 => _806[0], 'optionalAccess', _807 => _807.vertpos]), () => ( 0));
|
|
38741
38807
|
for (const o of m.objs) {
|
|
38742
38808
|
if (o.inline) {
|
|
38743
38809
|
const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
@@ -38745,14 +38811,14 @@ function cellContentExtent(cell2, memo) {
|
|
|
38745
38811
|
continue;
|
|
38746
38812
|
}
|
|
38747
38813
|
const pos = findChildByLocalName(o.el, "pos");
|
|
38748
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
38814
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _808 => _808.getAttribute, 'call', _809 => _809("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
38749
38815
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
38750
38816
|
const pushed = baseV - (num2(om, "top") + o.height + num2(om, "bottom"));
|
|
38751
38817
|
const anchor = pushed >= -100 ? pushed : baseV;
|
|
38752
38818
|
ext = Math.max(ext, anchor + num2(om, "top") + num2(pos, "vertOffset") + o.height);
|
|
38753
38819
|
}
|
|
38754
38820
|
}
|
|
38755
|
-
_optionalChain([memo, 'optionalAccess',
|
|
38821
|
+
_optionalChain([memo, 'optionalAccess', _810 => _810.cell, 'access', _811 => _811.set, 'call', _812 => _812(cell2.el, ext)]);
|
|
38756
38822
|
return ext;
|
|
38757
38823
|
}
|
|
38758
38824
|
function collectCells(tbl2) {
|
|
@@ -38790,7 +38856,7 @@ function collectCells(tbl2) {
|
|
|
38790
38856
|
return cells;
|
|
38791
38857
|
}
|
|
38792
38858
|
function measureTableHeight(tbl2, memo) {
|
|
38793
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
38859
|
+
const hit = _optionalChain([memo, 'optionalAccess', _813 => _813.table, 'access', _814 => _814.get, 'call', _815 => _815(tbl2)]);
|
|
38794
38860
|
if (hit !== void 0) return hit;
|
|
38795
38861
|
const cells = collectCells(tbl2);
|
|
38796
38862
|
if (cells.length === 0 || cells.length > 4096) return 0;
|
|
@@ -38801,7 +38867,7 @@ function measureTableHeight(tbl2, memo) {
|
|
|
38801
38867
|
);
|
|
38802
38868
|
let sum = 0;
|
|
38803
38869
|
for (const h of rowH) sum += h;
|
|
38804
|
-
_optionalChain([memo, 'optionalAccess',
|
|
38870
|
+
_optionalChain([memo, 'optionalAccess', _816 => _816.table, 'access', _817 => _817.set, 'call', _818 => _818(tbl2, sum)]);
|
|
38805
38871
|
return sum;
|
|
38806
38872
|
}
|
|
38807
38873
|
|
|
@@ -38916,7 +38982,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode) {
|
|
|
38916
38982
|
}
|
|
38917
38983
|
const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
|
|
38918
38984
|
if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
|
|
38919
|
-
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
38985
|
+
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _819 => _819.getAttribute, 'call', _820 => _820("vertRelTo")]), () => ( "PARA"));
|
|
38920
38986
|
if (vertRel === "PAGE" || vertRel === "PAPER") continue;
|
|
38921
38987
|
const vo = Math.max(0, num3(pos, "vertOffset"));
|
|
38922
38988
|
if (wrapAttr === "TOP_AND_BOTTOM") {
|
|
@@ -38977,7 +39043,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
38977
39043
|
if (ln2(p) !== "p") continue;
|
|
38978
39044
|
reflowTablesIn(p, doc, styles, mode, counter);
|
|
38979
39045
|
const g3 = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
38980
|
-
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
39046
|
+
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _821 => _821.spaceBefore]), () => ( 0)));
|
|
38981
39047
|
const res = reflowPara(p, doc, styles, areaW, startV, mode);
|
|
38982
39048
|
if (!res) {
|
|
38983
39049
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
@@ -38990,7 +39056,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
38990
39056
|
}
|
|
38991
39057
|
if (Number.isFinite(bottom)) {
|
|
38992
39058
|
cursorV = bottom;
|
|
38993
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
39059
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _822 => _822.spaceAfter]), () => ( 0));
|
|
38994
39060
|
}
|
|
38995
39061
|
}
|
|
38996
39062
|
continue;
|
|
@@ -39092,7 +39158,7 @@ function planLines(m, styles) {
|
|
|
39092
39158
|
const start = seg.textpos;
|
|
39093
39159
|
const end = i + 1 < m.segs.length ? m.segs[i + 1].textpos : Math.max(m.chars.length, start);
|
|
39094
39160
|
const tabs = /* @__PURE__ */ new Map();
|
|
39095
|
-
let x = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
39161
|
+
let x = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _823 => _823.marginIntent]), () => ( 0)), 0) : hang;
|
|
39096
39162
|
let fixedTo = start;
|
|
39097
39163
|
let fixedW = 0;
|
|
39098
39164
|
for (let k = start; k < end && k < m.chars.length; k++) {
|
|
@@ -39348,15 +39414,15 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
39348
39414
|
const sx = ow > 0 ? w / ow : 1;
|
|
39349
39415
|
const sy = oh > 0 ? h / oh : 1;
|
|
39350
39416
|
const lineShape = findChildByLocalName(el, "lineShape");
|
|
39351
|
-
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess',
|
|
39352
|
-
const strokeCol = _optionalChain([lineShape, 'optionalAccess',
|
|
39417
|
+
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _824 => _824.getAttribute, 'call', _825 => _825("style")]), () => ( "SOLID"));
|
|
39418
|
+
const strokeCol = _optionalChain([lineShape, 'optionalAccess', _826 => _826.getAttribute, 'call', _827 => _827("color")]) || "#000000";
|
|
39353
39419
|
const hasStroke = lstyle !== "NONE";
|
|
39354
39420
|
const strokeW = hasStroke ? shapeStrokePt(lineShape ? num2(lineShape, "width") : 33) : 0;
|
|
39355
39421
|
const dash = /DASH|DOT/.test(lstyle) ? ` stroke-dasharray="${lstyle.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
39356
39422
|
const strokeAttr = hasStroke ? ` stroke="${escapeXml7(strokeCol)}" stroke-width="${strokeW.toFixed(2)}"${dash}` : "";
|
|
39357
39423
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
39358
39424
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
39359
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
39425
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _828 => _828.getAttribute, 'call', _829 => _829("faceColor")]);
|
|
39360
39426
|
const fill = face && face.toLowerCase() !== "none" ? face : "none";
|
|
39361
39427
|
const fillAttr = ` fill="${fill === "none" ? "none" : escapeXml7(fill)}"`;
|
|
39362
39428
|
ctx.stats.shapes++;
|
|
@@ -39424,7 +39490,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
39424
39490
|
}));
|
|
39425
39491
|
for (const g3 of geom) {
|
|
39426
39492
|
const bf = g3.c.bfId != null ? ctx.styles.borderFill.get(g3.c.bfId) : void 0;
|
|
39427
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
39493
|
+
if (_optionalChain([bf, 'optionalAccess', _830 => _830.fill])) emit(ctx, `<rect x="${pt(g3.x)}" y="${pt(g3.y)}" width="${pt(g3.w)}" height="${pt(g3.h)}" fill="${escapeXml7(bf.fill)}"/>`);
|
|
39428
39494
|
}
|
|
39429
39495
|
for (const g3 of geom) {
|
|
39430
39496
|
const { c } = g3;
|
|
@@ -39464,7 +39530,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
39464
39530
|
const sz = findChildByLocalName(pic, "sz");
|
|
39465
39531
|
const w = num2(sz, "width", 5669), h = num2(sz, "height", 5669);
|
|
39466
39532
|
const img = findFirst(pic, "img");
|
|
39467
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
39533
|
+
const ref = _optionalChain([img, 'optionalAccess', _831 => _831.getAttribute, 'call', _832 => _832("binaryItemIDRef")]);
|
|
39468
39534
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
39469
39535
|
const imgId = ctx.regions.add("image", bboxOf(ctx, x, y, w, h), { sourceId: _nullishCoalesce(ref, () => ( void 0)), parentId: parentId(ctx) });
|
|
39470
39536
|
emit(ctx, regionOpenTag(imgId, "image", pageNo(ctx)));
|
|
@@ -39508,7 +39574,7 @@ function readSectionGeom(root) {
|
|
|
39508
39574
|
const pagePr = findFirst(root, "pagePr");
|
|
39509
39575
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
39510
39576
|
let PW = num2(pagePr, "width", 59528), PH = num2(pagePr, "height", 84188);
|
|
39511
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
39577
|
+
if (_optionalChain([pagePr, 'optionalAccess', _833 => _833.getAttribute, 'call', _834 => _834("landscape")]) === "NARROWLY" && PW < PH) {
|
|
39512
39578
|
const t = PW;
|
|
39513
39579
|
PW = PH;
|
|
39514
39580
|
PH = t;
|
|
@@ -39587,22 +39653,22 @@ function renderSectionRoots(sections, input) {
|
|
|
39587
39653
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
39588
39654
|
ctxBase.pageBase += pages.length;
|
|
39589
39655
|
}
|
|
39590
|
-
if (rendered.length === 0) throw new (0,
|
|
39656
|
+
if (rendered.length === 0) throw new (0, _chunkKZVQK5NScjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
39591
39657
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
39592
39658
|
}
|
|
39593
39659
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
39594
39660
|
async function renderHwpxInternal(input, options) {
|
|
39595
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
39661
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _835 => _835.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
39596
39662
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
39597
|
-
|
|
39663
|
+
_chunkKZVQK5NScjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
39598
39664
|
let zip;
|
|
39599
39665
|
try {
|
|
39600
39666
|
zip = await _jszip2.default.loadAsync(input);
|
|
39601
39667
|
} catch (e41) {
|
|
39602
|
-
throw new (0,
|
|
39668
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
39603
39669
|
}
|
|
39604
39670
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
39605
|
-
if (secFiles.length === 0) throw new (0,
|
|
39671
|
+
if (secFiles.length === 0) throw new (0, _chunkKZVQK5NScjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
39606
39672
|
const warnings = [];
|
|
39607
39673
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
39608
39674
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -39610,7 +39676,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
39610
39676
|
const secXmls = [];
|
|
39611
39677
|
for (const f of secFiles) {
|
|
39612
39678
|
const xml = await f.async("string");
|
|
39613
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
39679
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKZVQK5NScjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
39614
39680
|
secXmls.push(xml);
|
|
39615
39681
|
}
|
|
39616
39682
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -39634,7 +39700,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
39634
39700
|
let href = binmap.get(ref);
|
|
39635
39701
|
if (!href) {
|
|
39636
39702
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
39637
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
39703
|
+
href = _optionalChain([cand, 'optionalAccess', _836 => _836.name]);
|
|
39638
39704
|
}
|
|
39639
39705
|
if (!href) continue;
|
|
39640
39706
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -39656,7 +39722,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
39656
39722
|
for (let si = 0; si < secXmls.length; si++) {
|
|
39657
39723
|
const secXml = secXmls[si];
|
|
39658
39724
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
39659
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
39725
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _837 => _837.reflow])) {
|
|
39660
39726
|
noCacheSkipped = true;
|
|
39661
39727
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
39662
39728
|
continue;
|
|
@@ -39671,11 +39737,11 @@ async function renderHwpxInternal(input, options) {
|
|
|
39671
39737
|
}
|
|
39672
39738
|
if (roots.length === 0) {
|
|
39673
39739
|
if (noCacheSkipped) {
|
|
39674
|
-
throw new (0,
|
|
39740
|
+
throw new (0, _chunkKZVQK5NScjs.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)");
|
|
39675
39741
|
}
|
|
39676
|
-
throw new (0,
|
|
39742
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
39677
39743
|
}
|
|
39678
|
-
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
39744
|
+
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _838 => _838.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _839 => _839.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _840 => _840.highlights]) });
|
|
39679
39745
|
}
|
|
39680
39746
|
async function renderHwpxToSvg(input, options) {
|
|
39681
39747
|
const r = await renderHwpxInternal(input, options);
|
|
@@ -39895,7 +39961,7 @@ var FOLD_END = 42124;
|
|
|
39895
39961
|
var FOLD_SHIFT = 983040 - 40960;
|
|
39896
39962
|
function textChar(ch) {
|
|
39897
39963
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
39898
|
-
const mapped =
|
|
39964
|
+
const mapped = _chunkGPC72VSFcjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
39899
39965
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
39900
39966
|
}
|
|
39901
39967
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -39985,7 +40051,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
39985
40051
|
out += run.join("") + "</hp:run>";
|
|
39986
40052
|
run = [];
|
|
39987
40053
|
};
|
|
39988
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
40054
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _841 => _841[0], 'optionalAccess', _842 => _842[1]]), () => ( 0)));
|
|
39989
40055
|
let pos = 0, ctrlIdx = 0, o = 0;
|
|
39990
40056
|
const switchShape = () => {
|
|
39991
40057
|
while (shapeIdx + 1 < shapes.length && pos >= shapes[shapeIdx + 1][0]) {
|
|
@@ -40071,7 +40137,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
40071
40137
|
closeRun();
|
|
40072
40138
|
const rest = ctrls.filter((c) => !c.used && (c.id === CTRL_TBL3 || c.id === CTRL_GSO3 || c.id === CTRL_SECD2 || c.id === CTRL_COLD2));
|
|
40073
40139
|
if (rest.length > 0) {
|
|
40074
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
40140
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _843 => _843[0], 'optionalAccess', _844 => _844[1]]), () => ( 0)));
|
|
40075
40141
|
for (const c of rest) {
|
|
40076
40142
|
const el = ctrlElement(ctrls.indexOf(c), c.id);
|
|
40077
40143
|
run.push(el);
|
|
@@ -40226,14 +40292,14 @@ function hwp5SectionToXml(records, ctx) {
|
|
|
40226
40292
|
return `<hs:sec xmlns:hs="http://www.hancom.co.kr/hwpml/2011/section" xmlns:hp="http://www.hancom.co.kr/hwpml/2011/paragraph" xmlns:hc="http://www.hancom.co.kr/hwpml/2011/core">` + paragraphsXml(records, 0, records.length, 0, ctx, 0) + "</hs:sec>";
|
|
40227
40293
|
}
|
|
40228
40294
|
function renderHwp5Records(docInfo, styles, secRecords, binData, options, select, warnings = []) {
|
|
40229
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
40295
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _845 => _845.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
40230
40296
|
const MAX_TOTAL_IMAGE_BYTES = 128 * 1024 * 1024;
|
|
40231
40297
|
const images = /* @__PURE__ */ new Map();
|
|
40232
40298
|
let totalImgBytes = 0;
|
|
40233
40299
|
const imageRef = (binDataId) => {
|
|
40234
40300
|
if (binDataId <= 0) return null;
|
|
40235
|
-
const item = _optionalChain([docInfo, 'optionalAccess',
|
|
40236
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
40301
|
+
const item = _optionalChain([docInfo, 'optionalAccess', _846 => _846.binData, 'access', _847 => _847[binDataId - 1]]);
|
|
40302
|
+
if (_optionalChain([item, 'optionalAccess', _848 => _848.kind]) === "link") return null;
|
|
40237
40303
|
const storageId = item && item.storageId > 0 ? item.storageId : binDataId;
|
|
40238
40304
|
const ref = `bin${storageId}`;
|
|
40239
40305
|
if (images.has(ref)) return ref;
|
|
@@ -40267,8 +40333,8 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
40267
40333
|
}
|
|
40268
40334
|
roots.push({ root, index: si });
|
|
40269
40335
|
}
|
|
40270
|
-
if (roots.length === 0) throw new (0,
|
|
40271
|
-
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
40336
|
+
if (roots.length === 0) throw new (0, _chunkKZVQK5NScjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
40337
|
+
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _849 => _849.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _850 => _850.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _851 => _851.highlights]) });
|
|
40272
40338
|
return assemblePageSvgs(r, "hwp", select);
|
|
40273
40339
|
}
|
|
40274
40340
|
function renderHwp5Pages(input, options, select) {
|
|
@@ -40280,7 +40346,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
40280
40346
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
40281
40347
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
40282
40348
|
const sections = readHwp5SectionStreams(c);
|
|
40283
|
-
if (sections.length === 0) throw new (0,
|
|
40349
|
+
if (sections.length === 0) throw new (0, _chunkKZVQK5NScjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
40284
40350
|
const parseWarnings = [];
|
|
40285
40351
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
40286
40352
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -40365,14 +40431,14 @@ async function loadSharp() {
|
|
|
40365
40431
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
40366
40432
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
40367
40433
|
} catch (e44) {
|
|
40368
|
-
throw new (0,
|
|
40369
|
-
'PNG \uB798\uC2A4\uD130\uC5D0\uB294 sharp\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install sharp). sharp \uC5C6\uC774 \uC4F0\uB824\uBA74 format: "svg" + output_path\uB85C SVG \uD30C\uC77C \uC800\uC7A5\uC744 \uC0AC\uC6A9\uD558\uC138\uC694.' +
|
|
40434
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(
|
|
40435
|
+
'PNG \uB798\uC2A4\uD130\uC5D0\uB294 sharp\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install sharp). sharp \uC5C6\uC774 \uC4F0\uB824\uBA74 format: "svg" + output_path\uB85C SVG \uD30C\uC77C \uC800\uC7A5\uC744 \uC0AC\uC6A9\uD558\uC138\uC694.' + _chunkKZVQK5NScjs.OPTIONAL_DEP_INSTALL_HINT
|
|
40370
40436
|
);
|
|
40371
40437
|
}
|
|
40372
40438
|
}
|
|
40373
40439
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
40374
40440
|
const sharp = await loadSharp();
|
|
40375
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
40441
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkKZVQK5NScjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
40376
40442
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
40377
40443
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
40378
40444
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -40390,11 +40456,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
40390
40456
|
try {
|
|
40391
40457
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
40392
40458
|
} catch (e45) {
|
|
40393
|
-
throw new (0,
|
|
40459
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("PDF \uB80C\uB354\uC5D0\uB294 puppeteer-core \uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install puppeteer-core). SVG/HTML/PNG \uB294 Chromium \uC5C6\uC774 \uB429\uB2C8\uB2E4");
|
|
40394
40460
|
}
|
|
40395
40461
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
40396
40462
|
if (!executablePath) {
|
|
40397
|
-
throw new (0,
|
|
40463
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)("Chromium \uC2E4\uD589 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 browserExecutablePath \uC635\uC158 \uB610\uB294 PUPPETEER_EXECUTABLE_PATH \uD658\uACBD\uBCC0\uC218\uB97C \uC9C0\uC815\uD558\uC138\uC694");
|
|
40398
40464
|
}
|
|
40399
40465
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
40400
40466
|
try {
|
|
@@ -40410,13 +40476,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
40410
40476
|
async function loadBuffer(input) {
|
|
40411
40477
|
if (typeof input === "string") {
|
|
40412
40478
|
try {
|
|
40413
|
-
return
|
|
40479
|
+
return _chunkKZVQK5NScjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
40414
40480
|
} catch (err) {
|
|
40415
40481
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
40416
|
-
throw new (0,
|
|
40482
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
40417
40483
|
}
|
|
40418
40484
|
}
|
|
40419
|
-
if (Buffer.isBuffer(input)) return
|
|
40485
|
+
if (Buffer.isBuffer(input)) return _chunkKZVQK5NScjs.toArrayBuffer.call(void 0, input);
|
|
40420
40486
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
40421
40487
|
return input;
|
|
40422
40488
|
}
|
|
@@ -40425,17 +40491,17 @@ async function sourceFormatOf(buffer) {
|
|
|
40425
40491
|
if (format2 === "hwpx") {
|
|
40426
40492
|
const zip = await detectZipFormat(buffer);
|
|
40427
40493
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
40428
|
-
throw new (0,
|
|
40494
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`\uB80C\uB354 \uBBF8\uC9C0\uC6D0 \uD615\uC2DD(${zip}) \u2014 \uB808\uC774\uC544\uC6C3 \uB80C\uB354\uB294 HWPX\xB7HWP \uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4`);
|
|
40429
40495
|
}
|
|
40430
40496
|
if (format2 === "hwp") return "hwp";
|
|
40431
|
-
throw new (0,
|
|
40497
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`\uB80C\uB354 \uBBF8\uC9C0\uC6D0 \uD615\uC2DD(${format2}) \u2014 \uB808\uC774\uC544\uC6C3 \uB80C\uB354\uB294 HWPX\xB7HWP \uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4`);
|
|
40432
40498
|
}
|
|
40433
40499
|
async function renderDocumentToScene(input, options = {}) {
|
|
40434
40500
|
const buffer = await loadBuffer(input);
|
|
40435
40501
|
const source = await sourceFormatOf(buffer);
|
|
40436
40502
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
40437
40503
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
40438
|
-
if (set.size === 0) throw new (0,
|
|
40504
|
+
if (set.size === 0) throw new (0, _chunkKZVQK5NScjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
40439
40505
|
return set;
|
|
40440
40506
|
} : void 0;
|
|
40441
40507
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -40471,7 +40537,7 @@ async function renderDocument(input, options) {
|
|
|
40471
40537
|
break;
|
|
40472
40538
|
}
|
|
40473
40539
|
default:
|
|
40474
|
-
throw new (0,
|
|
40540
|
+
throw new (0, _chunkKZVQK5NScjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
40475
40541
|
}
|
|
40476
40542
|
return { scene, assets };
|
|
40477
40543
|
}
|
|
@@ -40501,7 +40567,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
40501
40567
|
const out = [];
|
|
40502
40568
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
40503
40569
|
const meta = scene.pages.find((p) => p.page === page);
|
|
40504
|
-
if (!meta) throw new (0,
|
|
40570
|
+
if (!meta) throw new (0, _chunkKZVQK5NScjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
40505
40571
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
40506
40572
|
for (const { region, bbox } of items) {
|
|
40507
40573
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -40525,9 +40591,9 @@ function wantsCrop(kind, policy) {
|
|
|
40525
40591
|
}
|
|
40526
40592
|
async function extractTables(input, options = {}) {
|
|
40527
40593
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
40528
|
-
const buffer = typeof input === "string" ?
|
|
40594
|
+
const buffer = typeof input === "string" ? _chunkKZVQK5NScjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkKZVQK5NScjs.toArrayBuffer.call(void 0, input) : input;
|
|
40529
40595
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
40530
|
-
if (!parsed.success) throw new (0,
|
|
40596
|
+
if (!parsed.success) throw new (0, _chunkKZVQK5NScjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
40531
40597
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
40532
40598
|
const out = blocks.map((b, i) => ({
|
|
40533
40599
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -40585,17 +40651,17 @@ async function extractTables(input, options = {}) {
|
|
|
40585
40651
|
// src/index.ts
|
|
40586
40652
|
async function parse(input, options) {
|
|
40587
40653
|
let buffer;
|
|
40588
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
40654
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _852 => _852.filePath]) ? { ...options, filePath: input } : options;
|
|
40589
40655
|
if (typeof input === "string") {
|
|
40590
40656
|
try {
|
|
40591
40657
|
const buf = await _promises.readFile.call(void 0, input);
|
|
40592
|
-
buffer =
|
|
40658
|
+
buffer = _chunkKZVQK5NScjs.toArrayBuffer.call(void 0, buf);
|
|
40593
40659
|
} catch (err) {
|
|
40594
40660
|
const msg2 = err instanceof Error && "code" in err && err.code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`;
|
|
40595
40661
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
40596
40662
|
}
|
|
40597
40663
|
} else if (Buffer.isBuffer(input)) {
|
|
40598
|
-
buffer =
|
|
40664
|
+
buffer = _chunkKZVQK5NScjs.toArrayBuffer.call(void 0, input);
|
|
40599
40665
|
} else {
|
|
40600
40666
|
buffer = input;
|
|
40601
40667
|
}
|
|
@@ -40604,20 +40670,20 @@ async function parse(input, options) {
|
|
|
40604
40670
|
}
|
|
40605
40671
|
const format2 = detectFormat(buffer);
|
|
40606
40672
|
const result = await dispatch(format2, buffer, opts);
|
|
40607
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
40673
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _853 => _853.images]) === false) {
|
|
40608
40674
|
delete result.images;
|
|
40609
40675
|
dropImageBytes(result.blocks);
|
|
40610
40676
|
}
|
|
40611
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
40677
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _854 => _854.classifyTables])) classifyTableTree(result.blocks);
|
|
40612
40678
|
let out = result;
|
|
40613
40679
|
if (result.success && !result.pages) {
|
|
40614
|
-
const pages =
|
|
40680
|
+
const pages = _chunkGPC72VSFcjs.blocksToPages.call(void 0, result.blocks);
|
|
40615
40681
|
if (pages) out = { ...result, pages };
|
|
40616
40682
|
}
|
|
40617
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
40683
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _855 => _855.plain])) {
|
|
40618
40684
|
out = { ...out, markdown: toPlainMarkdown(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toPlainMarkdown(p.markdown) })) } : {} };
|
|
40619
40685
|
}
|
|
40620
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
40686
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _856 => _856.htmlTables])) {
|
|
40621
40687
|
out = { ...out, markdown: toHtmlTables(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toHtmlTables(p.markdown) })) } : {} };
|
|
40622
40688
|
}
|
|
40623
40689
|
return out;
|
|
@@ -40662,45 +40728,45 @@ async function dispatch(format2, buffer, opts) {
|
|
|
40662
40728
|
}
|
|
40663
40729
|
}
|
|
40664
40730
|
function scriptsOff(r, off) {
|
|
40665
|
-
return off ?
|
|
40731
|
+
return off ? _chunkYIANW5QXcjs.stripScriptTags.call(void 0, r) : r;
|
|
40666
40732
|
}
|
|
40667
40733
|
async function parseImage(buffer, options) {
|
|
40668
40734
|
try {
|
|
40669
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
40735
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-PSPVRLB5.cjs")));
|
|
40670
40736
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
40671
|
-
|
|
40737
|
+
_chunkYIANW5QXcjs.stripScriptTags.call(void 0, { blocks });
|
|
40672
40738
|
return {
|
|
40673
40739
|
success: true,
|
|
40674
40740
|
fileType: "image",
|
|
40675
|
-
markdown:
|
|
40741
|
+
markdown: _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, blocks),
|
|
40676
40742
|
blocks,
|
|
40677
40743
|
warnings: warnings.length ? warnings : void 0,
|
|
40678
40744
|
pageCount: 1
|
|
40679
40745
|
};
|
|
40680
40746
|
} catch (err) {
|
|
40681
|
-
return { success: false, fileType: "image", error:
|
|
40747
|
+
return { success: false, fileType: "image", error: _chunkKZVQK5NScjs.sanitizeError.call(void 0, err), code: _chunkKZVQK5NScjs.classifyError.call(void 0, err) };
|
|
40682
40748
|
}
|
|
40683
40749
|
}
|
|
40684
40750
|
async function parseHwp3(buffer, options) {
|
|
40685
40751
|
try {
|
|
40686
40752
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
40687
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
40753
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _857 => _857.pageCount]) };
|
|
40688
40754
|
} catch (err) {
|
|
40689
|
-
return { success: false, fileType: "hwp3", error:
|
|
40755
|
+
return { success: false, fileType: "hwp3", error: _chunkKZVQK5NScjs.sanitizeError.call(void 0, err), code: _chunkKZVQK5NScjs.classifyError.call(void 0, err) };
|
|
40690
40756
|
}
|
|
40691
40757
|
}
|
|
40692
40758
|
async function parseHwpx(buffer, options) {
|
|
40693
40759
|
try {
|
|
40694
40760
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
40695
|
-
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
40761
|
+
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _858 => _858.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _859 => _859.pageCount]) }, _optionalChain([options, 'optionalAccess', _860 => _860.scriptTags]) === false);
|
|
40696
40762
|
} catch (err) {
|
|
40697
|
-
return { success: false, fileType: "hwpx", error:
|
|
40763
|
+
return { success: false, fileType: "hwpx", error: _chunkKZVQK5NScjs.sanitizeError.call(void 0, err), code: _chunkKZVQK5NScjs.classifyError.call(void 0, err) };
|
|
40698
40764
|
}
|
|
40699
40765
|
}
|
|
40700
40766
|
async function parseHwp(buffer, options) {
|
|
40701
40767
|
try {
|
|
40702
40768
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
40703
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
40769
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _861 => _861.filePath])) {
|
|
40704
40770
|
try {
|
|
40705
40771
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
40706
40772
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -40718,15 +40784,15 @@ async function parseHwp(buffer, options) {
|
|
|
40718
40784
|
} catch (e46) {
|
|
40719
40785
|
}
|
|
40720
40786
|
}
|
|
40721
|
-
return scriptsOff({ success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
40787
|
+
return scriptsOff({ success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _862 => _862.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _863 => _863.pageCount]) }, _optionalChain([options, 'optionalAccess', _864 => _864.scriptTags]) === false);
|
|
40722
40788
|
} catch (err) {
|
|
40723
|
-
return { success: false, fileType: "hwp", error:
|
|
40789
|
+
return { success: false, fileType: "hwp", error: _chunkKZVQK5NScjs.sanitizeError.call(void 0, err), code: _chunkKZVQK5NScjs.classifyError.call(void 0, err) };
|
|
40724
40790
|
}
|
|
40725
40791
|
}
|
|
40726
40792
|
async function parsePdf(buffer, options) {
|
|
40727
40793
|
let parsePdfDocument;
|
|
40728
40794
|
try {
|
|
40729
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
40795
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-QILYPWSI.cjs")));
|
|
40730
40796
|
parsePdfDocument = mod.parsePdfDocument;
|
|
40731
40797
|
} catch (e47) {
|
|
40732
40798
|
return {
|
|
@@ -40738,51 +40804,51 @@ async function parsePdf(buffer, options) {
|
|
|
40738
40804
|
}
|
|
40739
40805
|
try {
|
|
40740
40806
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages } = await parsePdfDocument(buffer, options);
|
|
40741
|
-
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
40807
|
+
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _865 => _865.pageCount]) }, _optionalChain([options, 'optionalAccess', _866 => _866.scriptTags]) !== true);
|
|
40742
40808
|
} catch (err) {
|
|
40743
40809
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
40744
|
-
return { success: false, fileType: "pdf", error:
|
|
40810
|
+
return { success: false, fileType: "pdf", error: _chunkKZVQK5NScjs.sanitizeError.call(void 0, err), code: _chunkKZVQK5NScjs.classifyError.call(void 0, err), isImageBased };
|
|
40745
40811
|
}
|
|
40746
40812
|
}
|
|
40747
40813
|
async function parseXlsx(buffer, options) {
|
|
40748
40814
|
try {
|
|
40749
40815
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
40750
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
40816
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _867 => _867.pageCount]) };
|
|
40751
40817
|
} catch (err) {
|
|
40752
|
-
return { success: false, fileType: "xlsx", error:
|
|
40818
|
+
return { success: false, fileType: "xlsx", error: _chunkKZVQK5NScjs.sanitizeError.call(void 0, err), code: _chunkKZVQK5NScjs.classifyError.call(void 0, err) };
|
|
40753
40819
|
}
|
|
40754
40820
|
}
|
|
40755
40821
|
async function parseXls(buffer, options) {
|
|
40756
40822
|
try {
|
|
40757
40823
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
40758
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
40824
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _868 => _868.pageCount]) };
|
|
40759
40825
|
} catch (err) {
|
|
40760
|
-
return { success: false, fileType: "xls", error:
|
|
40826
|
+
return { success: false, fileType: "xls", error: _chunkKZVQK5NScjs.sanitizeError.call(void 0, err), code: _chunkKZVQK5NScjs.classifyError.call(void 0, err) };
|
|
40761
40827
|
}
|
|
40762
40828
|
}
|
|
40763
40829
|
async function parseDocx(buffer, options) {
|
|
40764
40830
|
try {
|
|
40765
40831
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
40766
|
-
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
40832
|
+
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _869 => _869.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _870 => _870.pageCount]) }, _optionalChain([options, 'optionalAccess', _871 => _871.scriptTags]) === false);
|
|
40767
40833
|
} catch (err) {
|
|
40768
|
-
return { success: false, fileType: "docx", error:
|
|
40834
|
+
return { success: false, fileType: "docx", error: _chunkKZVQK5NScjs.sanitizeError.call(void 0, err), code: _chunkKZVQK5NScjs.classifyError.call(void 0, err) };
|
|
40769
40835
|
}
|
|
40770
40836
|
}
|
|
40771
40837
|
async function parseHwpml(buffer, options) {
|
|
40772
40838
|
try {
|
|
40773
40839
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
40774
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
40840
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _872 => _872.pageCount]) };
|
|
40775
40841
|
} catch (err) {
|
|
40776
|
-
return { success: false, fileType: "hwpml", error:
|
|
40842
|
+
return { success: false, fileType: "hwpml", error: _chunkKZVQK5NScjs.sanitizeError.call(void 0, err), code: _chunkKZVQK5NScjs.classifyError.call(void 0, err) };
|
|
40777
40843
|
}
|
|
40778
40844
|
}
|
|
40779
40845
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
40780
40846
|
let buffer;
|
|
40781
40847
|
if (typeof input === "string") {
|
|
40782
40848
|
const buf = await _promises.readFile.call(void 0, input);
|
|
40783
|
-
buffer =
|
|
40849
|
+
buffer = _chunkKZVQK5NScjs.toArrayBuffer.call(void 0, buf);
|
|
40784
40850
|
} else if (Buffer.isBuffer(input)) {
|
|
40785
|
-
buffer =
|
|
40851
|
+
buffer = _chunkKZVQK5NScjs.toArrayBuffer.call(void 0, input);
|
|
40786
40852
|
} else {
|
|
40787
40853
|
buffer = input;
|
|
40788
40854
|
}
|
|
@@ -40808,7 +40874,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
40808
40874
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
40809
40875
|
}
|
|
40810
40876
|
const fill = fillFormFields(parsed.blocks, values);
|
|
40811
|
-
const markdown =
|
|
40877
|
+
const markdown = _chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
40812
40878
|
if (outputFormat === "hwpx") {
|
|
40813
40879
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
40814
40880
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -40903,5 +40969,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
40903
40969
|
|
|
40904
40970
|
|
|
40905
40971
|
|
|
40906
|
-
exports.BUILTIN_TEMPLATES = BUILTIN_TEMPLATES; exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION =
|
|
40972
|
+
exports.BUILTIN_TEMPLATES = BUILTIN_TEMPLATES; exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkKZVQK5NScjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkGPC72VSFcjs.blocksToMarkdown; exports.blocksToPages = _chunkGPC72VSFcjs.blocksToPages; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.chooseTableRepresentation = chooseTableRepresentation; exports.classifyTable = classifyTable; exports.classifyTableTree = classifyTableTree; exports.collectTableBlocks = collectTableBlocks; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractClickHereFields = extractClickHereFields; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.extractRenderedRegions = extractRenderedRegions; exports.extractTables = extractTables; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.flattenLayoutTables = _chunkGPC72VSFcjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunkGPC72VSFcjs.hasStructuredCellContent; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.lintMuncheText = lintMuncheText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.muncheLintWarnings = muncheLintWarnings; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderDocument = renderDocument; exports.renderDocumentToScene = renderDocumentToScene; exports.renderHtml = renderHtml; exports.renderHwp5Pages = renderHwp5Pages; exports.renderHwpxToSvg = renderHwpxToSvg; exports.renderSceneToHtml = renderSceneToHtml; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.usesGaejosikMunche = usesGaejosikMunche; exports.validateHwpx = validateHwpx;
|
|
40907
40973
|
//# sourceMappingURL=index.cjs.map
|