kordoc 4.21.21 → 4.21.23
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 -4
- package/dist/{-ZYF6HX4M.js → -FLEBKE6V.js} +25 -25
- package/dist/{chunk-QHNVH4TC.js → chunk-2S37CQUJ.js} +21 -21
- package/dist/{chunk-YM3K3LCD.js → chunk-4F6OVO2A.js} +122 -46
- package/dist/chunk-4F6OVO2A.js.map +1 -0
- package/dist/{chunk-ZZIQWSGC.js → chunk-75J4Y5ZQ.js} +2 -2
- package/dist/{chunk-7YAJCXCD.js → chunk-7MTKOSAF.js} +2 -2
- package/dist/{chunk-KBV4WFZ6.js → chunk-C3RR6Z3M.js} +4 -4
- package/dist/{chunk-KBV4WFZ6.js.map → chunk-C3RR6Z3M.js.map} +1 -1
- package/dist/{chunk-TRO4CQHJ.js → chunk-CA742RMF.js} +4 -4
- package/dist/{chunk-CY4QM2KQ.js → chunk-DACTHSPR.js} +2 -2
- package/dist/{chunk-DTZIZ5PP.cjs → chunk-EGYLKSA4.cjs} +13 -13
- package/dist/{chunk-DTZIZ5PP.cjs.map → chunk-EGYLKSA4.cjs.map} +1 -1
- package/dist/{chunk-T7PN5D4D.cjs → chunk-EVPP2BSO.cjs} +6 -6
- package/dist/{chunk-T7PN5D4D.cjs.map → chunk-EVPP2BSO.cjs.map} +1 -1
- package/dist/{chunk-TMUUDMDH.cjs → chunk-GELBKBGQ.cjs} +23 -23
- package/dist/{chunk-TMUUDMDH.cjs.map → chunk-GELBKBGQ.cjs.map} +1 -1
- package/dist/{chunk-FBJVDBMO.js → chunk-GNIOEZDG.js} +2 -2
- package/dist/{chunk-RBRHO7WL.js → chunk-GPIMKPEI.js} +2 -2
- package/dist/{chunk-MCUX2Y2C.cjs → chunk-GUU7OHIH.cjs} +2 -2
- package/dist/{chunk-MCUX2Y2C.cjs.map → chunk-GUU7OHIH.cjs.map} +1 -1
- package/dist/{chunk-5HTFWUJE.js → chunk-J25WF6DP.js} +2 -2
- package/dist/{chunk-HWIW3WK2.js → chunk-JA4ZWCYL.js} +3 -3
- package/dist/{chunk-2ZGP7A5T.js → chunk-JLG7KK4M.js} +2 -2
- package/dist/{chunk-3TCF5HPP.js → chunk-JUA7IACQ.js} +2 -2
- package/dist/{chunk-YQZOPT3A.js → chunk-L4NFUEWJ.js} +5 -5
- package/dist/{chunk-YQZOPT3A.js.map → chunk-L4NFUEWJ.js.map} +1 -1
- package/dist/{chunk-T3DTTK23.js → chunk-QRIGJUOQ.js} +26 -25
- package/dist/chunk-QRIGJUOQ.js.map +1 -0
- package/dist/{chunk-J5PBI3ZC.js → chunk-RDV2RHVH.js} +3 -3
- package/dist/{chunk-YHPJTLCA.js → chunk-RKWJMA2B.js} +2 -2
- package/dist/{chunk-FZMGF6XU.js → chunk-TAU45SJK.js} +2 -2
- package/dist/{chunk-BG6LUCQL.js → chunk-U6D7LUCR.js} +2 -2
- package/dist/{chunk-BC54LBST.js → chunk-UKLNKY7Q.js} +3 -3
- package/dist/{chunk-H2MS4VG3.cjs → chunk-VA43X5N4.cjs} +3 -3
- package/dist/{chunk-H2MS4VG3.cjs.map → chunk-VA43X5N4.cjs.map} +1 -1
- package/dist/{chunk-7FCNOKOR.js → chunk-VKVDMH7X.js} +2 -1
- package/dist/{chunk-KTLHADU4.js → chunk-XEUBMLAS.js} +2 -2
- package/dist/{chunk-57VNFMMS.cjs → chunk-Y7XHHV55.cjs} +28 -27
- package/dist/chunk-Y7XHHV55.cjs.map +1 -0
- package/dist/{chunk-PTF4NCFM.js → chunk-YA6UGARL.js} +2 -2
- package/dist/{chunk-WGMYVRSA.js → chunk-ZE77KLKN.js} +2 -2
- package/dist/chunks-PR2GRNLX.js +10 -0
- package/dist/cli.js +34 -34
- package/dist/{formula-P7M7IH2L.js → formula-2MTBKZKO.js} +4 -4
- package/dist/{formula-A3I5VAP7.cjs → formula-CY2HF27M.cjs} +9 -9
- package/dist/{formula-A3I5VAP7.cjs.map → formula-CY2HF27M.cjs.map} +1 -1
- package/dist/{formula-6XNIXZ5L.js → formula-LGLSIYDI.js} +3 -3
- package/dist/{image-ocr-ITNY454I.js → image-ocr-BKRQVMW6.js} +9 -9
- package/dist/{image-ocr-UJRSQ2T3.cjs → image-ocr-HJM5IJKU.cjs} +15 -15
- package/dist/{image-ocr-UJRSQ2T3.cjs.map → image-ocr-HJM5IJKU.cjs.map} +1 -1
- package/dist/{image-ocr-3C6W3KZO.js → image-ocr-HP65O2CC.js} +6 -6
- package/dist/index.cjs +653 -577
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +83 -7
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +28 -28
- package/dist/{model-bundle-LAWQH75O.js → model-bundle-M7YMF4L4.js} +5 -5
- package/dist/{models-6QTD2CFM.js → models-AMPRHBYB.js} +5 -5
- package/dist/{parse-worker-v2-FEPJG3ER.js → parse-worker-v2-NMYEMVYX.js} +14 -14
- package/dist/{parser-VKWUMUML.cjs → parser-J6M4WG3I.cjs} +136 -136
- package/dist/{parser-VKWUMUML.cjs.map → parser-J6M4WG3I.cjs.map} +1 -1
- package/dist/{parser-56I364YM.js → parser-LX5MOE6Q.js} +8 -8
- package/dist/{parser-KFCY3NIN.js → parser-M45SFXWF.js} +22 -22
- package/dist/pdf-ocr-4YVV5PT4.cjs +19 -0
- package/dist/{pdf-ocr-OKAHNEJA.cjs.map → pdf-ocr-4YVV5PT4.cjs.map} +1 -1
- package/dist/pdf-ocr-D73YYQJ5.js +18 -0
- package/dist/pdf-ocr-SLWZO4D2.js +22 -0
- package/dist/{profile-io-OCITHUQF.js → profile-io-CUMSC3TD.js} +3 -3
- package/dist/{rasterize-SFCG4YOI.js → rasterize-W6NY4ADH.js} +3 -3
- package/dist/{redact-doc-5SMPXIGG.js → redact-doc-7HVCZT3C.js} +25 -25
- package/dist/{render-FGPG5A2N.js → render-FPMJX4CU.js} +9 -9
- package/dist/seal-YTRVR373.js +10 -0
- package/dist/{setup-JQVYZO7I.js → setup-UKIYOUT6.js} +3 -3
- package/dist/visual-DG5EVBZD.js +20 -0
- package/dist/{watch-C77BUSP7.js → watch-YHKMAVJ6.js} +16 -16
- package/package.json +1 -1
- package/dist/chunk-57VNFMMS.cjs.map +0 -1
- package/dist/chunk-T3DTTK23.js.map +0 -1
- package/dist/chunk-YM3K3LCD.js.map +0 -1
- package/dist/chunks-MDMJRCJ7.js +0 -10
- package/dist/pdf-ocr-MME37BL4.js +0 -18
- package/dist/pdf-ocr-OKAHNEJA.cjs +0 -19
- package/dist/pdf-ocr-ZZ6AJL6Z.js +0 -22
- package/dist/seal-GA7NZDTG.js +0 -10
- package/dist/visual-YMG644YW.js +0 -20
- /package/dist/{-ZYF6HX4M.js.map → -FLEBKE6V.js.map} +0 -0
- /package/dist/{chunk-QHNVH4TC.js.map → chunk-2S37CQUJ.js.map} +0 -0
- /package/dist/{chunk-ZZIQWSGC.js.map → chunk-75J4Y5ZQ.js.map} +0 -0
- /package/dist/{chunk-7YAJCXCD.js.map → chunk-7MTKOSAF.js.map} +0 -0
- /package/dist/{chunk-TRO4CQHJ.js.map → chunk-CA742RMF.js.map} +0 -0
- /package/dist/{chunk-CY4QM2KQ.js.map → chunk-DACTHSPR.js.map} +0 -0
- /package/dist/{chunk-FBJVDBMO.js.map → chunk-GNIOEZDG.js.map} +0 -0
- /package/dist/{chunk-RBRHO7WL.js.map → chunk-GPIMKPEI.js.map} +0 -0
- /package/dist/{chunk-5HTFWUJE.js.map → chunk-J25WF6DP.js.map} +0 -0
- /package/dist/{chunk-HWIW3WK2.js.map → chunk-JA4ZWCYL.js.map} +0 -0
- /package/dist/{chunk-2ZGP7A5T.js.map → chunk-JLG7KK4M.js.map} +0 -0
- /package/dist/{chunk-3TCF5HPP.js.map → chunk-JUA7IACQ.js.map} +0 -0
- /package/dist/{chunk-J5PBI3ZC.js.map → chunk-RDV2RHVH.js.map} +0 -0
- /package/dist/{chunk-YHPJTLCA.js.map → chunk-RKWJMA2B.js.map} +0 -0
- /package/dist/{chunk-FZMGF6XU.js.map → chunk-TAU45SJK.js.map} +0 -0
- /package/dist/{chunk-BG6LUCQL.js.map → chunk-U6D7LUCR.js.map} +0 -0
- /package/dist/{chunk-BC54LBST.js.map → chunk-UKLNKY7Q.js.map} +0 -0
- /package/dist/{chunk-7FCNOKOR.js.map → chunk-VKVDMH7X.js.map} +0 -0
- /package/dist/{chunk-KTLHADU4.js.map → chunk-XEUBMLAS.js.map} +0 -0
- /package/dist/{chunk-PTF4NCFM.js.map → chunk-YA6UGARL.js.map} +0 -0
- /package/dist/{chunk-WGMYVRSA.js.map → chunk-ZE77KLKN.js.map} +0 -0
- /package/dist/{chunks-MDMJRCJ7.js.map → chunks-PR2GRNLX.js.map} +0 -0
- /package/dist/{formula-P7M7IH2L.js.map → formula-2MTBKZKO.js.map} +0 -0
- /package/dist/{formula-6XNIXZ5L.js.map → formula-LGLSIYDI.js.map} +0 -0
- /package/dist/{image-ocr-ITNY454I.js.map → image-ocr-BKRQVMW6.js.map} +0 -0
- /package/dist/{image-ocr-3C6W3KZO.js.map → image-ocr-HP65O2CC.js.map} +0 -0
- /package/dist/{model-bundle-LAWQH75O.js.map → model-bundle-M7YMF4L4.js.map} +0 -0
- /package/dist/{models-6QTD2CFM.js.map → models-AMPRHBYB.js.map} +0 -0
- /package/dist/{parse-worker-v2-FEPJG3ER.js.map → parse-worker-v2-NMYEMVYX.js.map} +0 -0
- /package/dist/{parser-56I364YM.js.map → parser-LX5MOE6Q.js.map} +0 -0
- /package/dist/{parser-KFCY3NIN.js.map → parser-M45SFXWF.js.map} +0 -0
- /package/dist/{pdf-ocr-MME37BL4.js.map → pdf-ocr-D73YYQJ5.js.map} +0 -0
- /package/dist/{pdf-ocr-ZZ6AJL6Z.js.map → pdf-ocr-SLWZO4D2.js.map} +0 -0
- /package/dist/{profile-io-OCITHUQF.js.map → profile-io-CUMSC3TD.js.map} +0 -0
- /package/dist/{rasterize-SFCG4YOI.js.map → rasterize-W6NY4ADH.js.map} +0 -0
- /package/dist/{redact-doc-5SMPXIGG.js.map → redact-doc-7HVCZT3C.js.map} +0 -0
- /package/dist/{render-FGPG5A2N.js.map → render-FPMJX4CU.js.map} +0 -0
- /package/dist/{seal-GA7NZDTG.js.map → seal-YTRVR373.js.map} +0 -0
- /package/dist/{setup-JQVYZO7I.js.map → setup-UKIYOUT6.js.map} +0 -0
- /package/dist/{visual-YMG644YW.js.map → visual-DG5EVBZD.js.map} +0 -0
- /package/dist/{watch-C77BUSP7.js.map → watch-YHKMAVJ6.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
var _chunkY7XHHV55cjs = require('./chunk-Y7XHHV55.cjs');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
@@ -32,7 +33,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
var
|
|
36
|
+
var _chunkEVPP2BSOcjs = require('./chunk-EVPP2BSO.cjs');
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
|
|
@@ -50,14 +51,14 @@ var _chunkT7PN5D4Dcjs = require('./chunk-T7PN5D4D.cjs');
|
|
|
50
51
|
|
|
51
52
|
|
|
52
53
|
|
|
53
|
-
var
|
|
54
|
+
var _chunkGUU7OHIHcjs = require('./chunk-GUU7OHIH.cjs');
|
|
54
55
|
|
|
55
56
|
|
|
56
57
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
57
58
|
|
|
58
59
|
// src/plain-markdown.ts
|
|
59
60
|
function toPlainMarkdown(md2) {
|
|
60
|
-
return
|
|
61
|
+
return _chunkEVPP2BSOcjs.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();
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
// src/html-tables.ts
|
|
@@ -589,9 +590,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
589
590
|
}
|
|
590
591
|
|
|
591
592
|
// src/hwpx/parser-shared.ts
|
|
592
|
-
var MAX_DECOMPRESS_SIZE =
|
|
593
|
+
var MAX_DECOMPRESS_SIZE = _chunkGUU7OHIHcjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
593
594
|
var MAX_ZIP_ENTRIES = 500;
|
|
594
|
-
var ZipBombError = class extends
|
|
595
|
+
var ZipBombError = class extends _chunkGUU7OHIHcjs.KordocError {
|
|
595
596
|
constructor(message) {
|
|
596
597
|
super(message);
|
|
597
598
|
this.name = "ZipBombError";
|
|
@@ -639,7 +640,7 @@ function createSectionShared() {
|
|
|
639
640
|
function createXmlParser(warnings) {
|
|
640
641
|
return new (0, _xmldom.DOMParser)({
|
|
641
642
|
onError(level, msg2) {
|
|
642
|
-
if (level === "fatalError") throw new (0,
|
|
643
|
+
if (level === "fatalError") throw new (0, _chunkGUU7OHIHcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
643
644
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
644
645
|
}
|
|
645
646
|
});
|
|
@@ -674,13 +675,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
674
675
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
675
676
|
const checksumType = attrOf(inner, "checksum-type");
|
|
676
677
|
if (algorithm !== AES256_CBC) {
|
|
677
|
-
throw new (0,
|
|
678
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
678
679
|
}
|
|
679
680
|
if (startKey !== START_KEY_SHA256) {
|
|
680
|
-
throw new (0,
|
|
681
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
681
682
|
}
|
|
682
683
|
if (!_optionalChain([checksumType, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(CHECKSUM_SHA256_1K)])) {
|
|
683
|
-
throw new (0,
|
|
684
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
684
685
|
}
|
|
685
686
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
686
687
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -688,10 +689,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
688
689
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
689
690
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
690
691
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
691
|
-
throw new (0,
|
|
692
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
692
693
|
}
|
|
693
694
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
694
|
-
throw new (0,
|
|
695
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
695
696
|
}
|
|
696
697
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
697
698
|
}
|
|
@@ -725,12 +726,12 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
725
726
|
for (const entry of entries) {
|
|
726
727
|
const file = zip.file(entry.path);
|
|
727
728
|
if (!file) {
|
|
728
|
-
throw new (0,
|
|
729
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
729
730
|
}
|
|
730
731
|
const raw = await readZipEntry(file, "uint8array", used);
|
|
731
732
|
const plain4 = decryptEntry(Buffer.from(raw.buffer, raw.byteOffset, raw.length), entry, startKey);
|
|
732
733
|
if (!plain4) {
|
|
733
|
-
throw new (0,
|
|
734
|
+
throw new (0, _chunkGUU7OHIHcjs.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.");
|
|
734
735
|
}
|
|
735
736
|
used += plain4.length;
|
|
736
737
|
if (used > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
@@ -796,10 +797,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
796
797
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _10 => _10.total]));
|
|
797
798
|
if (decompressed) {
|
|
798
799
|
decompressed.total += xml.length * 2;
|
|
799
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
800
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkGUU7OHIHcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
800
801
|
}
|
|
801
802
|
const parser = createXmlParser();
|
|
802
|
-
const doc = parser.parseFromString(
|
|
803
|
+
const doc = parser.parseFromString(_chunkGUU7OHIHcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
803
804
|
if (!doc.documentElement) continue;
|
|
804
805
|
const domDoc = doc;
|
|
805
806
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -1012,9 +1013,9 @@ function detectHwpxHeadings(blocks, styleMap, tocTexts) {
|
|
|
1012
1013
|
let level = 0;
|
|
1013
1014
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _19 => _19.style, 'optionalAccess', _20 => _20.fontSize])) {
|
|
1014
1015
|
const ratio = block.style.fontSize / baseFontSize;
|
|
1015
|
-
if (ratio >=
|
|
1016
|
-
else if (ratio >=
|
|
1017
|
-
else if (ratio >=
|
|
1016
|
+
if (ratio >= _chunkEVPP2BSOcjs.HEADING_RATIO_H1) level = 1;
|
|
1017
|
+
else if (ratio >= _chunkEVPP2BSOcjs.HEADING_RATIO_H2) level = 2;
|
|
1018
|
+
else if (ratio >= _chunkEVPP2BSOcjs.HEADING_RATIO_H3) level = 3;
|
|
1018
1019
|
}
|
|
1019
1020
|
const compactText = text.replace(/\s+/g, "");
|
|
1020
1021
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1746,7 +1747,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1746
1747
|
|
|
1747
1748
|
// src/hwpx/table-build.ts
|
|
1748
1749
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1749
|
-
const table2 =
|
|
1750
|
+
const table2 = _chunkEVPP2BSOcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1750
1751
|
if (state.caption) table2.caption = state.caption;
|
|
1751
1752
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
1752
1753
|
if (_optionalChain([state, 'access', _30 => _30.captionBlocks, 'optionalAccess', _31 => _31.length])) table2.captionBlocks = state.captionBlocks;
|
|
@@ -1775,7 +1776,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1775
1776
|
for (const src of row) {
|
|
1776
1777
|
if (!src.edges || src.rowAddr === void 0 || src.colAddr === void 0) continue;
|
|
1777
1778
|
const cand = _optionalChain([table2, 'access', _35 => _35.cells, 'access', _36 => _36[src.rowAddr], 'optionalAccess', _37 => _37[src.colAddr]]);
|
|
1778
|
-
if (cand && anchors2.includes(cand))
|
|
1779
|
+
if (cand && anchors2.includes(cand)) _chunkEVPP2BSOcjs.CELL_EDGES.set(cand, src.edges);
|
|
1779
1780
|
}
|
|
1780
1781
|
}
|
|
1781
1782
|
const claimed = /* @__PURE__ */ new Set();
|
|
@@ -1825,7 +1826,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1825
1826
|
const cell2 = parentTable.cell;
|
|
1826
1827
|
(cell2.blocks ??= []).push(block);
|
|
1827
1828
|
cell2.hasStructure = true;
|
|
1828
|
-
let flat =
|
|
1829
|
+
let flat = _chunkEVPP2BSOcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1829
1830
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1830
1831
|
if (flat) {
|
|
1831
1832
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -2059,7 +2060,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2059
2060
|
const tkids = rc.childNodes;
|
|
2060
2061
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _45 => _45.length]), () => ( 0))); k++) {
|
|
2061
2062
|
const tk = tkids[k];
|
|
2062
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
2063
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunkEVPP2BSOcjs.escapeLiteralTags.call(void 0, _chunkEVPP2BSOcjs.escapeLiteralDollar.call(void 0, tk.textContent || ""));
|
|
2063
2064
|
else if (tk.nodeType === 1) {
|
|
2064
2065
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
2065
2066
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -2079,7 +2080,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2079
2080
|
const span2 = { text };
|
|
2080
2081
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span2.code = true;
|
|
2081
2082
|
else {
|
|
2082
|
-
if (_optionalChain([cp, 'optionalAccess', _46 => _46.script])) span2.text =
|
|
2083
|
+
if (_optionalChain([cp, 'optionalAccess', _46 => _46.script])) span2.text = _chunkEVPP2BSOcjs.wrapScript.call(void 0, text, cp.script);
|
|
2083
2084
|
if (_optionalChain([cp, 'optionalAccess', _47 => _47.bold])) span2.bold = true;
|
|
2084
2085
|
if (_optionalChain([cp, 'optionalAccess', _48 => _48.italic])) span2.italic = true;
|
|
2085
2086
|
if (_optionalChain([cp, 'optionalAccess', _49 => _49.strike])) span2.strike = true;
|
|
@@ -2099,7 +2100,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2099
2100
|
}
|
|
2100
2101
|
}
|
|
2101
2102
|
if (requireMixed && !merged.some((s) => s.strike || s.underline) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
2102
|
-
for (const s of merged) s.text =
|
|
2103
|
+
for (const s of merged) s.text = _chunkEVPP2BSOcjs.tidyScriptTags.call(void 0, s.text);
|
|
2103
2104
|
return merged;
|
|
2104
2105
|
}
|
|
2105
2106
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -2126,7 +2127,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2126
2127
|
// src/hwpx/section-walker.ts
|
|
2127
2128
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
2128
2129
|
const parser = createXmlParser(warnings);
|
|
2129
|
-
const doc = parser.parseFromString(
|
|
2130
|
+
const doc = parser.parseFromString(_chunkGUU7OHIHcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2130
2131
|
if (!doc.documentElement) return [];
|
|
2131
2132
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
2132
2133
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2227,8 +2228,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2227
2228
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2228
2229
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2229
2230
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2230
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2231
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2231
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkEVPP2BSOcjs.MAX_COLS);
|
|
2232
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkEVPP2BSOcjs.MAX_ROWS);
|
|
2232
2233
|
}
|
|
2233
2234
|
break;
|
|
2234
2235
|
case "p": {
|
|
@@ -2547,7 +2548,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2547
2548
|
const sink = [];
|
|
2548
2549
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2549
2550
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2550
|
-
let flat =
|
|
2551
|
+
let flat = _chunkEVPP2BSOcjs.convertTableToText.call(void 0, st.rows);
|
|
2551
2552
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2552
2553
|
const built = [];
|
|
2553
2554
|
completeTable(st, [], built, ctx);
|
|
@@ -2710,7 +2711,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2710
2711
|
let url = (ch.textContent || "").trim();
|
|
2711
2712
|
if (!url) continue;
|
|
2712
2713
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2713
|
-
const safe =
|
|
2714
|
+
const safe = _chunkGUU7OHIHcjs.sanitizeHref.call(void 0, url);
|
|
2714
2715
|
if (safe) return safe;
|
|
2715
2716
|
}
|
|
2716
2717
|
return void 0;
|
|
@@ -2859,7 +2860,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2859
2860
|
_optionalChain([ctx, 'access', _110 => _110.warnings, 'optionalAccess', _111 => _111.push, 'call', _112 => _112({ page: ctx.page, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
|
|
2860
2861
|
}
|
|
2861
2862
|
} else {
|
|
2862
|
-
text +=
|
|
2863
|
+
text += _chunkEVPP2BSOcjs.escapeLiteralTags.call(void 0, _chunkEVPP2BSOcjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, "")));
|
|
2863
2864
|
}
|
|
2864
2865
|
continue;
|
|
2865
2866
|
}
|
|
@@ -2912,7 +2913,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2912
2913
|
case "hyperlink": {
|
|
2913
2914
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2914
2915
|
if (url) {
|
|
2915
|
-
const safe =
|
|
2916
|
+
const safe = _chunkGUU7OHIHcjs.sanitizeHref.call(void 0, url);
|
|
2916
2917
|
if (safe) href = safe;
|
|
2917
2918
|
}
|
|
2918
2919
|
walk(child, depth + 1);
|
|
@@ -3006,7 +3007,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3006
3007
|
walk(child, depth + 1);
|
|
3007
3008
|
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
3008
3009
|
const added = text.slice(start);
|
|
3009
|
-
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) +
|
|
3010
|
+
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) + _chunkEVPP2BSOcjs.wrapScript.call(void 0, added, script);
|
|
3010
3011
|
}
|
|
3011
3012
|
break;
|
|
3012
3013
|
}
|
|
@@ -3029,7 +3030,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3029
3030
|
}
|
|
3030
3031
|
if (applied.length) href = void 0;
|
|
3031
3032
|
}
|
|
3032
|
-
text =
|
|
3033
|
+
text = _chunkEVPP2BSOcjs.tidyScriptTags.call(void 0, text);
|
|
3033
3034
|
const toc = takeTocLeaders(text);
|
|
3034
3035
|
text = toc.text;
|
|
3035
3036
|
const tocEntry = toc.tocEntry;
|
|
@@ -3143,7 +3144,7 @@ function decompressStream(data) {
|
|
|
3143
3144
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
3144
3145
|
}
|
|
3145
3146
|
function parseFileHeader(data) {
|
|
3146
|
-
if (data.length < 40) throw new (0,
|
|
3147
|
+
if (data.length < 40) throw new (0, _chunkGUU7OHIHcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
3147
3148
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
3148
3149
|
return {
|
|
3149
3150
|
signature: sig,
|
|
@@ -3669,13 +3670,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3669
3670
|
}
|
|
3670
3671
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3671
3672
|
for (const path of allCandidates) {
|
|
3672
|
-
if (
|
|
3673
|
+
if (_chunkGUU7OHIHcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3673
3674
|
const file = zip.file(path);
|
|
3674
3675
|
if (!file) continue;
|
|
3675
3676
|
try {
|
|
3676
3677
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3677
3678
|
decompressed.total += data.length;
|
|
3678
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3679
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkGUU7OHIHcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3679
3680
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3680
3681
|
const mimeType = imageExtToMime(ext);
|
|
3681
3682
|
imageIndex++;
|
|
@@ -3685,7 +3686,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3685
3686
|
usedPaths.add(path);
|
|
3686
3687
|
break;
|
|
3687
3688
|
} catch (err) {
|
|
3688
|
-
if (err instanceof
|
|
3689
|
+
if (err instanceof _chunkGUU7OHIHcjs.KordocError) throw err;
|
|
3689
3690
|
}
|
|
3690
3691
|
}
|
|
3691
3692
|
if (!img) _optionalChain([warnings, 'optionalAccess', _126 => _126.push, 'call', _127 => _127({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
@@ -3705,13 +3706,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3705
3706
|
if (sweepUnreferenced) {
|
|
3706
3707
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3707
3708
|
for (const file of binEntries) {
|
|
3708
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3709
|
+
if (file.dir || usedPaths.has(file.name) || _chunkGUU7OHIHcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3709
3710
|
const basename = file.name.slice(file.name.lastIndexOf("/") + 1);
|
|
3710
3711
|
if (_optionalChain([deletedRefs, 'optionalAccess', _128 => _128.has, 'call', _129 => _129(file.name)]) || _optionalChain([deletedRefs, 'optionalAccess', _130 => _130.has, 'call', _131 => _131(basename)]) || _optionalChain([deletedRefs, 'optionalAccess', _132 => _132.has, 'call', _133 => _133(file.name.replace(/\.[^/.]+$/, ""))]) || _optionalChain([deletedRefs, 'optionalAccess', _134 => _134.has, 'call', _135 => _135(basename.replace(/\.[^.]+$/, ""))])) continue;
|
|
3711
3712
|
try {
|
|
3712
3713
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3713
3714
|
decompressed.total += data.length;
|
|
3714
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3715
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkGUU7OHIHcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3715
3716
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3716
3717
|
let mimeType = imageExtToMime(ext);
|
|
3717
3718
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3725,7 +3726,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3725
3726
|
images.push(img);
|
|
3726
3727
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3727
3728
|
} catch (err) {
|
|
3728
|
-
if (err instanceof
|
|
3729
|
+
if (err instanceof _chunkGUU7OHIHcjs.KordocError) throw err;
|
|
3729
3730
|
_optionalChain([warnings, 'optionalAccess', _136 => _136.push, 'call', _137 => _137({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3730
3731
|
}
|
|
3731
3732
|
}
|
|
@@ -3776,7 +3777,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3776
3777
|
}
|
|
3777
3778
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3778
3779
|
const name = new TextDecoder().decode(nameBytes);
|
|
3779
|
-
if (
|
|
3780
|
+
if (_chunkGUU7OHIHcjs.isPathTraversal.call(void 0, name)) {
|
|
3780
3781
|
pos = fileStart + compSize;
|
|
3781
3782
|
continue;
|
|
3782
3783
|
}
|
|
@@ -3794,7 +3795,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3794
3795
|
continue;
|
|
3795
3796
|
}
|
|
3796
3797
|
totalDecompressed += content.length * 2;
|
|
3797
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3798
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3798
3799
|
sectionNum++;
|
|
3799
3800
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3800
3801
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3803,9 +3804,9 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3803
3804
|
continue;
|
|
3804
3805
|
}
|
|
3805
3806
|
}
|
|
3806
|
-
if (blocks.length === 0) throw new (0,
|
|
3807
|
+
if (blocks.length === 0) throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3807
3808
|
applyPageText(blocks, shared);
|
|
3808
|
-
const markdown =
|
|
3809
|
+
const markdown = _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _138 => _138.tableFormat]) });
|
|
3809
3810
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3810
3811
|
}
|
|
3811
3812
|
async function readKordocLayout(zip) {
|
|
@@ -3830,11 +3831,11 @@ async function resolveSectionPaths(zip) {
|
|
|
3830
3831
|
if (paths.length > 0) return paths;
|
|
3831
3832
|
}
|
|
3832
3833
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3833
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3834
|
+
return sectionFiles.map((f) => f.name).sort(_chunkGUU7OHIHcjs.compareSectionPaths);
|
|
3834
3835
|
}
|
|
3835
3836
|
function parseSectionPathsFromManifest(xml) {
|
|
3836
3837
|
const parser = createXmlParser();
|
|
3837
|
-
const doc = parser.parseFromString(
|
|
3838
|
+
const doc = parser.parseFromString(_chunkGUU7OHIHcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3838
3839
|
const opf = "http://www.idpf.org/2007/opf/";
|
|
3839
3840
|
const namespacedItems = doc.getElementsByTagNameNS(opf, "item");
|
|
3840
3841
|
const namespacedSpine = doc.getElementsByTagNameNS(opf, "itemref");
|
|
@@ -3844,7 +3845,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3844
3845
|
for (let i = 0; i < items.length; i++) {
|
|
3845
3846
|
const item = items[i];
|
|
3846
3847
|
const id = item.getAttribute("id") || "";
|
|
3847
|
-
const href =
|
|
3848
|
+
const href = _chunkGUU7OHIHcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3848
3849
|
if (id && href) idToHref.set(id, href);
|
|
3849
3850
|
}
|
|
3850
3851
|
if (spine.length > 0) {
|
|
@@ -3855,7 +3856,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3855
3856
|
}
|
|
3856
3857
|
if (ordered.length > 0) return ordered;
|
|
3857
3858
|
}
|
|
3858
|
-
return Array.from(idToHref.values()).sort(
|
|
3859
|
+
return Array.from(idToHref.values()).sort(_chunkGUU7OHIHcjs.compareSectionPaths);
|
|
3859
3860
|
}
|
|
3860
3861
|
|
|
3861
3862
|
// src/hwpx/metadata.ts
|
|
@@ -3867,7 +3868,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3867
3868
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _142 => _142.total]));
|
|
3868
3869
|
if (decompressed) {
|
|
3869
3870
|
decompressed.total += xml.length * 2;
|
|
3870
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3871
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkGUU7OHIHcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3871
3872
|
}
|
|
3872
3873
|
return xml;
|
|
3873
3874
|
};
|
|
@@ -3889,7 +3890,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3889
3890
|
}
|
|
3890
3891
|
}
|
|
3891
3892
|
function parseOpfMetadata(xml, metadata) {
|
|
3892
|
-
const root = createXmlParser().parseFromString(
|
|
3893
|
+
const root = createXmlParser().parseFromString(_chunkGUU7OHIHcjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3893
3894
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3894
3895
|
if (!md2) return;
|
|
3895
3896
|
let title;
|
|
@@ -3922,7 +3923,7 @@ function isoDate(s) {
|
|
|
3922
3923
|
}
|
|
3923
3924
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3924
3925
|
const parser = createXmlParser();
|
|
3925
|
-
const doc = parser.parseFromString(
|
|
3926
|
+
const doc = parser.parseFromString(_chunkGUU7OHIHcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3926
3927
|
if (!doc.documentElement) return;
|
|
3927
3928
|
const getText = (tagNames) => {
|
|
3928
3929
|
for (const tag of tagNames) {
|
|
@@ -3961,7 +3962,7 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3961
3962
|
}
|
|
3962
3963
|
}
|
|
3963
3964
|
async function parseHwpxDocument(buffer, options) {
|
|
3964
|
-
|
|
3965
|
+
_chunkGUU7OHIHcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3965
3966
|
let zip;
|
|
3966
3967
|
try {
|
|
3967
3968
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3970,7 +3971,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3970
3971
|
}
|
|
3971
3972
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3972
3973
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3973
|
-
throw new (0,
|
|
3974
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3974
3975
|
}
|
|
3975
3976
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3976
3977
|
if (manifestFile) {
|
|
@@ -3990,7 +3991,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3990
3991
|
}
|
|
3991
3992
|
const hpfFile = zip.file("Contents/content.hpf");
|
|
3992
3993
|
const hpf = hpfFile ? await readZipEntry(hpfFile, "text").catch(() => "") : "";
|
|
3993
|
-
throw new (0,
|
|
3994
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(
|
|
3994
3995
|
/\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."
|
|
3995
3996
|
);
|
|
3996
3997
|
}
|
|
@@ -4002,7 +4003,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4002
4003
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
4003
4004
|
const warnings = [];
|
|
4004
4005
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
4005
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
4006
|
+
if (sectionPaths.length === 0) throw new (0, _chunkGUU7OHIHcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4006
4007
|
let allBlocks = [];
|
|
4007
4008
|
const shared = createSectionShared();
|
|
4008
4009
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -4046,10 +4047,10 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4046
4047
|
const blocks = allBlocks;
|
|
4047
4048
|
applyPageText(blocks, shared);
|
|
4048
4049
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _171 => _171.pages]), shared.track.deletedImageRefs);
|
|
4049
|
-
const shown = _optionalChain([options, 'optionalAccess', _172 => _172.layoutTables]) === "keep" ? blocks :
|
|
4050
|
+
const shown = _optionalChain([options, 'optionalAccess', _172 => _172.layoutTables]) === "keep" ? blocks : _chunkEVPP2BSOcjs.unframeLayoutTables.call(void 0, blocks, !!_optionalChain([options, 'optionalAccess', _173 => _173.keepTrailingEmptyCols]));
|
|
4050
4051
|
detectHwpxHeadings(shown, styleMap, shared.tocTexts);
|
|
4051
4052
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4052
|
-
const markdown =
|
|
4053
|
+
const markdown = _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, shown, { tableFormat: _optionalChain([options, 'optionalAccess', _174 => _174.tableFormat]) });
|
|
4053
4054
|
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 };
|
|
4054
4055
|
}
|
|
4055
4056
|
|
|
@@ -4816,7 +4817,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4816
4817
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4817
4818
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4818
4819
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4819
|
-
const wrong = () => new (0,
|
|
4820
|
+
const wrong = () => new (0, _chunkGUU7OHIHcjs.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.");
|
|
4820
4821
|
let records;
|
|
4821
4822
|
try {
|
|
4822
4823
|
records = readRecords3(data);
|
|
@@ -4828,7 +4829,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4828
4829
|
}
|
|
4829
4830
|
function assertSupportedEncryptVersion(version) {
|
|
4830
4831
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4831
|
-
throw new (0,
|
|
4832
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(
|
|
4832
4833
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4833
4834
|
);
|
|
4834
4835
|
}
|
|
@@ -5269,7 +5270,7 @@ function emitParagraphBlocks(p) {
|
|
|
5269
5270
|
return blocks;
|
|
5270
5271
|
}
|
|
5271
5272
|
function tableFlatText(table2) {
|
|
5272
|
-
const flat =
|
|
5273
|
+
const flat = _chunkEVPP2BSOcjs.convertTableToText.call(void 0, table2.cells);
|
|
5273
5274
|
return table2.caption ? table2.caption + (flat ? "\n" + flat : "") : flat;
|
|
5274
5275
|
}
|
|
5275
5276
|
function blocksPlainText(blocks, sep) {
|
|
@@ -5349,8 +5350,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5349
5350
|
}
|
|
5350
5351
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5351
5352
|
for (const c of cells) {
|
|
5352
|
-
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1,
|
|
5353
|
-
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1,
|
|
5353
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunkEVPP2BSOcjs.MAX_ROWS));
|
|
5354
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunkEVPP2BSOcjs.MAX_COLS));
|
|
5354
5355
|
}
|
|
5355
5356
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5356
5357
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5358,12 +5359,12 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5358
5359
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5359
5360
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5360
5361
|
}
|
|
5361
|
-
const table2 =
|
|
5362
|
+
const table2 = _chunkEVPP2BSOcjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5362
5363
|
if (table2.rows === 0) return null;
|
|
5363
5364
|
for (const c of placed) {
|
|
5364
5365
|
if (c.edges) {
|
|
5365
5366
|
const at = _optionalChain([table2, 'access', _181 => _181.cells, 'access', _182 => _182[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _183 => _183[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
5366
|
-
if (at)
|
|
5367
|
+
if (at) _chunkEVPP2BSOcjs.CELL_EDGES.set(at, c.edges);
|
|
5367
5368
|
}
|
|
5368
5369
|
if (!_optionalChain([c, 'access', _184 => _184.blocks, 'optionalAccess', _185 => _185.length]) && !c.isHeader) continue;
|
|
5369
5370
|
const target = _optionalChain([table2, 'access', _186 => _186.cells, 'access', _187 => _187[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _188 => _188[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
@@ -5565,7 +5566,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5565
5566
|
continue;
|
|
5566
5567
|
}
|
|
5567
5568
|
if (!ctrl.href) continue;
|
|
5568
|
-
const href =
|
|
5569
|
+
const href = _chunkGUU7OHIHcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5569
5570
|
if (!href) continue;
|
|
5570
5571
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK)) continue;
|
|
5571
5572
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5574,7 +5575,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5574
5575
|
}
|
|
5575
5576
|
if (text.includes(LITERAL_DOLLAR_MARK)) text = text.replaceAll(LITERAL_DOLLAR_MARK, "\\$");
|
|
5576
5577
|
text = resolveLiteralLt(text);
|
|
5577
|
-
text =
|
|
5578
|
+
text = _chunkEVPP2BSOcjs.tidyScriptTags.call(void 0, text);
|
|
5578
5579
|
const toc = takeTocLeaders(text);
|
|
5579
5580
|
text = toc.text;
|
|
5580
5581
|
let headingLevel = 0;
|
|
@@ -5787,7 +5788,7 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5787
5788
|
}
|
|
5788
5789
|
var A4_HEIGHT = 84188;
|
|
5789
5790
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5790
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5791
|
+
if (!cells.some((c) => c.pageSpanning)) _chunkEVPP2BSOcjs.markNonLayoutTable.call(void 0, table2);
|
|
5791
5792
|
}
|
|
5792
5793
|
function parseTableControl(ctrl, records, ctx) {
|
|
5793
5794
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
@@ -5799,8 +5800,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5799
5800
|
let tableIdx = -1;
|
|
5800
5801
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5801
5802
|
if (records[i2].tagId === TAG_TABLE && records[i2].level === directLevel && records[i2].data.length >= 8) {
|
|
5802
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5803
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5803
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkEVPP2BSOcjs.MAX_ROWS);
|
|
5804
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkEVPP2BSOcjs.MAX_COLS);
|
|
5804
5805
|
tableIdx = i2;
|
|
5805
5806
|
break;
|
|
5806
5807
|
}
|
|
@@ -5844,11 +5845,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5844
5845
|
return table3;
|
|
5845
5846
|
}
|
|
5846
5847
|
if (rows === 0 || cols === 0) {
|
|
5847
|
-
rows = Math.min(cells.length,
|
|
5848
|
+
rows = Math.min(cells.length, _chunkEVPP2BSOcjs.MAX_ROWS);
|
|
5848
5849
|
cols = 1;
|
|
5849
5850
|
}
|
|
5850
5851
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5851
|
-
const table2 =
|
|
5852
|
+
const table2 = _chunkEVPP2BSOcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5852
5853
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5853
5854
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
5854
5855
|
keepUnlessPageSpanning(table2, cells);
|
|
@@ -5867,8 +5868,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5867
5868
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5868
5869
|
const cs = rec.data.readUInt16LE(12);
|
|
5869
5870
|
const rs = rec.data.readUInt16LE(14);
|
|
5870
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5871
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5871
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkEVPP2BSOcjs.MAX_COLS);
|
|
5872
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkEVPP2BSOcjs.MAX_ROWS);
|
|
5872
5873
|
}
|
|
5873
5874
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5874
5875
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -6017,7 +6018,7 @@ function openHwp5Container(buffer, options) {
|
|
|
6017
6018
|
lenientCfb = parseLenientCfb(buffer);
|
|
6018
6019
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
6019
6020
|
} catch (e24) {
|
|
6020
|
-
throw new (0,
|
|
6021
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
6021
6022
|
}
|
|
6022
6023
|
}
|
|
6023
6024
|
const readRawStream = (path) => {
|
|
@@ -6028,14 +6029,14 @@ function openHwp5Container(buffer, options) {
|
|
|
6028
6029
|
return lenientCfb.findStream(path);
|
|
6029
6030
|
};
|
|
6030
6031
|
const headerData = readRawStream("/FileHeader");
|
|
6031
|
-
if (!headerData) throw new (0,
|
|
6032
|
+
if (!headerData) throw new (0, _chunkGUU7OHIHcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6032
6033
|
const header = parseFileHeader(headerData);
|
|
6033
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
6034
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
6034
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkGUU7OHIHcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
6035
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkGUU7OHIHcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
6035
6036
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
6036
6037
|
if (encrypted) {
|
|
6037
6038
|
if (!_optionalChain([options, 'optionalAccess', _212 => _212.password])) {
|
|
6038
|
-
throw new (0,
|
|
6039
|
+
throw new (0, _chunkGUU7OHIHcjs.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.");
|
|
6039
6040
|
}
|
|
6040
6041
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
6041
6042
|
}
|
|
@@ -6049,12 +6050,12 @@ function openHwp5Container(buffer, options) {
|
|
|
6049
6050
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
6050
6051
|
if (encrypted) {
|
|
6051
6052
|
const rawDocInfo = findStream("/DocInfo");
|
|
6052
|
-
if (!rawDocInfo) throw new (0,
|
|
6053
|
+
if (!rawDocInfo) throw new (0, _chunkGUU7OHIHcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6053
6054
|
let docInfoData;
|
|
6054
6055
|
try {
|
|
6055
6056
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
6056
6057
|
} catch (e25) {
|
|
6057
|
-
throw new (0,
|
|
6058
|
+
throw new (0, _chunkGUU7OHIHcjs.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.");
|
|
6058
6059
|
}
|
|
6059
6060
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
6060
6061
|
}
|
|
@@ -6079,10 +6080,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
6079
6080
|
try {
|
|
6080
6081
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
6081
6082
|
totalDecompressed += data.length;
|
|
6082
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6083
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6083
6084
|
out.push(readRecords(data));
|
|
6084
6085
|
} catch (secErr) {
|
|
6085
|
-
if (secErr instanceof
|
|
6086
|
+
if (secErr instanceof _chunkGUU7OHIHcjs.KordocError) throw secErr;
|
|
6086
6087
|
out.push(null);
|
|
6087
6088
|
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" });
|
|
6088
6089
|
}
|
|
@@ -6102,7 +6103,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6102
6103
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
6103
6104
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
6104
6105
|
const sections = readHwp5SectionStreams(c);
|
|
6105
|
-
if (sections.length === 0) throw new (0,
|
|
6106
|
+
if (sections.length === 0) throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
6106
6107
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
6107
6108
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
6108
6109
|
const sectionTableIds = [];
|
|
@@ -6146,7 +6147,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6146
6147
|
parsedSections++;
|
|
6147
6148
|
_optionalChain([options, 'optionalAccess', _217 => _217.onProgress, 'optionalCall', _218 => _218(parsedSections, sections.length)]);
|
|
6148
6149
|
} catch (secErr) {
|
|
6149
|
-
if (secErr instanceof
|
|
6150
|
+
if (secErr instanceof _chunkGUU7OHIHcjs.KordocError) throw secErr;
|
|
6150
6151
|
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" });
|
|
6151
6152
|
} finally {
|
|
6152
6153
|
pageBase += detect2.pages;
|
|
@@ -6157,10 +6158,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6157
6158
|
}
|
|
6158
6159
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
6159
6160
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter, encrypted ? findStream : void 0) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter, encrypted ? findStream : void 0);
|
|
6160
|
-
let flatBlocks =
|
|
6161
|
-
if (_optionalChain([options, 'optionalAccess', _219 => _219.layoutTables]) !== "keep") flatBlocks =
|
|
6161
|
+
let flatBlocks = _chunkEVPP2BSOcjs.flattenLayoutTables.call(void 0, blocks);
|
|
6162
|
+
if (_optionalChain([options, 'optionalAccess', _219 => _219.layoutTables]) !== "keep") flatBlocks = _chunkEVPP2BSOcjs.unframeLayoutTables.call(void 0, flatBlocks, !!_optionalChain([options, 'optionalAccess', _220 => _220.keepTrailingEmptyCols]));
|
|
6162
6163
|
if (_optionalChain([options, 'optionalAccess', _221 => _221.dedupeRunningHeaders])) {
|
|
6163
|
-
const deduped =
|
|
6164
|
+
const deduped = _chunkEVPP2BSOcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
6164
6165
|
const removed = flatBlocks.length - deduped.length;
|
|
6165
6166
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
6166
6167
|
flatBlocks = deduped;
|
|
@@ -6169,10 +6170,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6169
6170
|
detectHwp5Headings(flatBlocks, docInfo, doc.tocTexts);
|
|
6170
6171
|
}
|
|
6171
6172
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
6172
|
-
let markdown =
|
|
6173
|
+
let markdown = _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, flatBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _222 => _222.tableFormat]) });
|
|
6173
6174
|
if (_optionalChain([options, 'optionalAccess', _223 => _223.inlineImages]) && options.images !== false && images.length > 0) {
|
|
6174
6175
|
try {
|
|
6175
|
-
markdown =
|
|
6176
|
+
markdown = _chunkY7XHHV55cjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
6176
6177
|
} catch (inlineErr) {
|
|
6177
6178
|
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" });
|
|
6178
6179
|
}
|
|
@@ -6236,9 +6237,9 @@ function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
|
6236
6237
|
let level = 0;
|
|
6237
6238
|
if (_optionalChain([block, 'access', _230 => _230.style, 'optionalAccess', _231 => _231.fontSize]) && baseFontSize > 0) {
|
|
6238
6239
|
const ratio = block.style.fontSize / baseFontSize;
|
|
6239
|
-
if (ratio >=
|
|
6240
|
-
else if (ratio >=
|
|
6241
|
-
else if (ratio >=
|
|
6240
|
+
if (ratio >= _chunkEVPP2BSOcjs.HEADING_RATIO_H1) level = 1;
|
|
6241
|
+
else if (ratio >= _chunkEVPP2BSOcjs.HEADING_RATIO_H2) level = 2;
|
|
6242
|
+
else if (ratio >= _chunkEVPP2BSOcjs.HEADING_RATIO_H3) level = 3;
|
|
6242
6243
|
}
|
|
6243
6244
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
6244
6245
|
if (level === 0) level = 2;
|
|
@@ -6370,7 +6371,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6370
6371
|
const raw = _nullishCoalesce(lcfb.findStream(`/BodyText/Section${i}`), () => ( lcfb.findStream(`Section${i}`)));
|
|
6371
6372
|
if (!raw) break;
|
|
6372
6373
|
totalBytes += raw.length;
|
|
6373
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6374
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6374
6375
|
sections.push({ idx: i, content: raw });
|
|
6375
6376
|
}
|
|
6376
6377
|
if (sections.length === 0) {
|
|
@@ -6381,7 +6382,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6381
6382
|
const raw = lcfb.findStream(e.name);
|
|
6382
6383
|
if (raw) {
|
|
6383
6384
|
totalBytes += raw.length;
|
|
6384
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6385
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6385
6386
|
sections.push({ idx, content: raw });
|
|
6386
6387
|
}
|
|
6387
6388
|
}
|
|
@@ -6398,7 +6399,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6398
6399
|
try {
|
|
6399
6400
|
const content = decryptViewText(raw, compressed);
|
|
6400
6401
|
totalDecompressed += content.length;
|
|
6401
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6402
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6402
6403
|
sections.push({ idx: i, content });
|
|
6403
6404
|
} catch (e32) {
|
|
6404
6405
|
break;
|
|
@@ -18898,25 +18899,25 @@ function desEcbDecrypt(data, key) {
|
|
|
18898
18899
|
}
|
|
18899
18900
|
function readLayout(data) {
|
|
18900
18901
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18901
|
-
throw new (0,
|
|
18902
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18902
18903
|
}
|
|
18903
18904
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18904
18905
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18905
18906
|
if (payloadOffset >= data.length) {
|
|
18906
|
-
throw new (0,
|
|
18907
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18907
18908
|
}
|
|
18908
18909
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18909
18910
|
}
|
|
18910
18911
|
function decryptHwp3Document(input, password) {
|
|
18911
18912
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18912
18913
|
if (!compressed) {
|
|
18913
|
-
throw new (0,
|
|
18914
|
+
throw new (0, _chunkGUU7OHIHcjs.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)");
|
|
18914
18915
|
}
|
|
18915
18916
|
const source = Buffer.from(input);
|
|
18916
18917
|
const payload = source.subarray(payloadOffset);
|
|
18917
18918
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18918
18919
|
if (aligned.length === 0) {
|
|
18919
|
-
throw new (0,
|
|
18920
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18920
18921
|
}
|
|
18921
18922
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18922
18923
|
let inflated;
|
|
@@ -18924,14 +18925,14 @@ function decryptHwp3Document(input, password) {
|
|
|
18924
18925
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18925
18926
|
} catch (err) {
|
|
18926
18927
|
if (_optionalChain([err, 'optionalAccess', _246 => _246.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18927
|
-
throw new (0,
|
|
18928
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(
|
|
18928
18929
|
`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`
|
|
18929
18930
|
);
|
|
18930
18931
|
}
|
|
18931
|
-
throw new (0,
|
|
18932
|
+
throw new (0, _chunkGUU7OHIHcjs.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.");
|
|
18932
18933
|
}
|
|
18933
18934
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18934
|
-
throw new (0,
|
|
18935
|
+
throw new (0, _chunkGUU7OHIHcjs.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.");
|
|
18935
18936
|
}
|
|
18936
18937
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18937
18938
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -18988,9 +18989,9 @@ function hwp3CellGrid(info, count) {
|
|
|
18988
18989
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
18989
18990
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
18990
18991
|
const r2 = nextY[k] !== void 0 ? edgeAt(ys, nextY[k]) : ys.length - 1;
|
|
18991
|
-
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row),
|
|
18992
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunkEVPP2BSOcjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunkEVPP2BSOcjs.MAX_COLS) };
|
|
18992
18993
|
});
|
|
18993
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
18994
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunkEVPP2BSOcjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunkEVPP2BSOcjs.MAX_COLS), cells };
|
|
18994
18995
|
}
|
|
18995
18996
|
|
|
18996
18997
|
// src/hwp3/parser.ts
|
|
@@ -19031,7 +19032,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19031
19032
|
let source = Buffer.from(buffer);
|
|
19032
19033
|
if (isEncryptedHwp3(source)) {
|
|
19033
19034
|
if (!_optionalChain([options, 'optionalAccess', _247 => _247.password])) {
|
|
19034
|
-
throw new (0,
|
|
19035
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(
|
|
19035
19036
|
"\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."
|
|
19036
19037
|
);
|
|
19037
19038
|
}
|
|
@@ -19048,10 +19049,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19048
19049
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
19049
19050
|
} catch (err) {
|
|
19050
19051
|
if (_optionalChain([err, 'optionalAccess', _248 => _248.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
19051
|
-
throw new (0,
|
|
19052
|
+
throw new (0, _chunkGUU7OHIHcjs.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`);
|
|
19052
19053
|
}
|
|
19053
19054
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
19054
|
-
throw new (0,
|
|
19055
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
19055
19056
|
}
|
|
19056
19057
|
} else {
|
|
19057
19058
|
body = tail;
|
|
@@ -19074,7 +19075,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19074
19075
|
const names = new Map([...ctx.picIds].map(([name, id]) => [id, name]));
|
|
19075
19076
|
dropMissingPictures(allBlocks, binData, names, warnings);
|
|
19076
19077
|
const images = resolveImageBlocks(binData, allBlocks, warnings, true);
|
|
19077
|
-
const blocks =
|
|
19078
|
+
const blocks = _chunkEVPP2BSOcjs.flattenLayoutTables.call(void 0, allBlocks);
|
|
19078
19079
|
const metadata = {
|
|
19079
19080
|
title: header.title || void 0,
|
|
19080
19081
|
author: header.author || void 0,
|
|
@@ -19082,10 +19083,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19082
19083
|
createdAt: header.date || void 0,
|
|
19083
19084
|
version: "3.0"
|
|
19084
19085
|
};
|
|
19085
|
-
let markdown =
|
|
19086
|
+
let markdown = _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _249 => _249.tableFormat]) });
|
|
19086
19087
|
if (_optionalChain([options, 'optionalAccess', _250 => _250.inlineImages]) && options.images !== false && images.length > 0) {
|
|
19087
19088
|
try {
|
|
19088
|
-
markdown =
|
|
19089
|
+
markdown = _chunkY7XHHV55cjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
19089
19090
|
} catch (inlineErr) {
|
|
19090
19091
|
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" });
|
|
19091
19092
|
}
|
|
@@ -19217,7 +19218,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
19217
19218
|
continue;
|
|
19218
19219
|
}
|
|
19219
19220
|
if (ch >= 32) {
|
|
19220
|
-
para2.text +=
|
|
19221
|
+
para2.text += _chunkEVPP2BSOcjs.escapeLiteralTags.call(void 0, _chunkEVPP2BSOcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( ""))));
|
|
19221
19222
|
continue;
|
|
19222
19223
|
}
|
|
19223
19224
|
if (ch === 9) {
|
|
@@ -19452,7 +19453,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19452
19453
|
// src/xlsx/sheet-blocks.ts
|
|
19453
19454
|
var MAX_SHEET_COLS = 16384;
|
|
19454
19455
|
function sheetRowCap(cols) {
|
|
19455
|
-
return Math.floor(
|
|
19456
|
+
return Math.floor(_chunkEVPP2BSOcjs.MAX_TABLE_CELLS / Math.max(1, cols));
|
|
19456
19457
|
}
|
|
19457
19458
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19458
19459
|
const blocks = [];
|
|
@@ -19483,7 +19484,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19483
19484
|
if (keepRows.length > rowCap) {
|
|
19484
19485
|
warnings.push({
|
|
19485
19486
|
page: sheetIndex + 1,
|
|
19486
|
-
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 ${
|
|
19487
|
+
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 ${_chunkEVPP2BSOcjs.MAX_TABLE_CELLS})`,
|
|
19487
19488
|
code: "TRUNCATED_TABLE"
|
|
19488
19489
|
});
|
|
19489
19490
|
keepRows.length = rowCap;
|
|
@@ -19517,14 +19518,14 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19517
19518
|
}
|
|
19518
19519
|
cellRows.push(row);
|
|
19519
19520
|
}
|
|
19520
|
-
const table2 =
|
|
19521
|
+
const table2 = _chunkEVPP2BSOcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap, maxCols: keepCols.length });
|
|
19521
19522
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19522
19523
|
return blocks;
|
|
19523
19524
|
}
|
|
19524
19525
|
|
|
19525
19526
|
// src/xlsx/parser.ts
|
|
19526
19527
|
var MAX_SHEETS = 100;
|
|
19527
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19528
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkGUU7OHIHcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19528
19529
|
var MAX_SHEET_ROWS = 1048576;
|
|
19529
19530
|
function cleanNumericValue(raw) {
|
|
19530
19531
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19561,7 +19562,7 @@ function getTextContent(el) {
|
|
|
19561
19562
|
return _nullishCoalesce(_optionalChain([el, 'access', _266 => _266.textContent, 'optionalAccess', _267 => _267.trim, 'call', _268 => _268()]), () => ( ""));
|
|
19562
19563
|
}
|
|
19563
19564
|
function parseXml(text) {
|
|
19564
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19565
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkGUU7OHIHcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19565
19566
|
}
|
|
19566
19567
|
function collectRichText(root) {
|
|
19567
19568
|
let out = "";
|
|
@@ -19572,7 +19573,7 @@ function collectRichText(root) {
|
|
|
19572
19573
|
const el = children[i];
|
|
19573
19574
|
const local = el.localName || _optionalChain([el, 'access', _269 => _269.tagName, 'optionalAccess', _270 => _270.replace, 'call', _271 => _271(/^[^:]+:/, "")]) || "";
|
|
19574
19575
|
if (local === "rPh") continue;
|
|
19575
|
-
if (local === "t") out +=
|
|
19576
|
+
if (local === "t") out += _chunkEVPP2BSOcjs.escapeLiteralTags.call(void 0, _chunkEVPP2BSOcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
19576
19577
|
else walk(el);
|
|
19577
19578
|
}
|
|
19578
19579
|
};
|
|
@@ -19783,12 +19784,12 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19783
19784
|
return { rows, merges, maxCol };
|
|
19784
19785
|
}
|
|
19785
19786
|
async function parseXlsxDocument(buffer, options) {
|
|
19786
|
-
|
|
19787
|
+
_chunkGUU7OHIHcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19787
19788
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19788
19789
|
const warnings = [];
|
|
19789
19790
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19790
19791
|
if (!workbookFile) {
|
|
19791
|
-
throw new (0,
|
|
19792
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19792
19793
|
}
|
|
19793
19794
|
let sharedStrings = [];
|
|
19794
19795
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19797,7 +19798,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19797
19798
|
}
|
|
19798
19799
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
19799
19800
|
if (sheets.length === 0) {
|
|
19800
|
-
throw new (0,
|
|
19801
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19801
19802
|
}
|
|
19802
19803
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19803
19804
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19881,7 +19882,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19881
19882
|
} catch (e35) {
|
|
19882
19883
|
}
|
|
19883
19884
|
}
|
|
19884
|
-
const markdown =
|
|
19885
|
+
const markdown = _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _276 => _276.tableFormat]) });
|
|
19885
19886
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19886
19887
|
}
|
|
19887
19888
|
|
|
@@ -20195,14 +20196,14 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20195
20196
|
const h = readCellHeader(rec.data);
|
|
20196
20197
|
if (h && rec.data.length >= 10) {
|
|
20197
20198
|
const isst = rec.data.readUInt32LE(6);
|
|
20198
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20199
|
+
cells.push({ row: h.row, col: h.col, value: _chunkEVPP2BSOcjs.escapeLiteralTags.call(void 0, _chunkEVPP2BSOcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(sst[isst], () => ( "")))) });
|
|
20199
20200
|
}
|
|
20200
20201
|
break;
|
|
20201
20202
|
}
|
|
20202
20203
|
case OP_LABEL: {
|
|
20203
20204
|
const h = readCellHeader(rec.data);
|
|
20204
20205
|
if (h) {
|
|
20205
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20206
|
+
cells.push({ row: h.row, col: h.col, value: _chunkEVPP2BSOcjs.escapeLiteralTags.call(void 0, _chunkEVPP2BSOcjs.escapeLiteralDollar.call(void 0, decodeLabelString(rec.data))) });
|
|
20206
20207
|
}
|
|
20207
20208
|
break;
|
|
20208
20209
|
}
|
|
@@ -20218,7 +20219,7 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20218
20219
|
cells.push({
|
|
20219
20220
|
row: h.row,
|
|
20220
20221
|
col: h.col,
|
|
20221
|
-
value:
|
|
20222
|
+
value: _chunkEVPP2BSOcjs.escapeLiteralTags.call(void 0, _chunkEVPP2BSOcjs.escapeLiteralDollar.call(void 0, decodeFormulaStringRecord(next.data)))
|
|
20222
20223
|
});
|
|
20223
20224
|
i = j;
|
|
20224
20225
|
} else {
|
|
@@ -20330,11 +20331,11 @@ function processGlobals(records) {
|
|
|
20330
20331
|
const xfFmtIds = [];
|
|
20331
20332
|
const firstBof = records[0];
|
|
20332
20333
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
20333
|
-
throw new (0,
|
|
20334
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
20334
20335
|
}
|
|
20335
20336
|
const bof = decodeBof(firstBof.data);
|
|
20336
20337
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
20337
|
-
throw new (0,
|
|
20338
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
20338
20339
|
}
|
|
20339
20340
|
let i = 1;
|
|
20340
20341
|
while (i < records.length) {
|
|
@@ -20418,28 +20419,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20418
20419
|
try {
|
|
20419
20420
|
cfb = parseLenientCfb(buf);
|
|
20420
20421
|
} catch (e) {
|
|
20421
|
-
throw new (0,
|
|
20422
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(
|
|
20422
20423
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20423
20424
|
);
|
|
20424
20425
|
}
|
|
20425
20426
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20426
20427
|
if (!wb) {
|
|
20427
|
-
throw new (0,
|
|
20428
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20428
20429
|
}
|
|
20429
20430
|
const records = readRecords2(wb);
|
|
20430
20431
|
if (records.length === 0) {
|
|
20431
|
-
throw new (0,
|
|
20432
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20432
20433
|
}
|
|
20433
20434
|
const firstBof = decodeBof(records[0].data);
|
|
20434
20435
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20435
|
-
throw new (0,
|
|
20436
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(
|
|
20436
20437
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20437
20438
|
);
|
|
20438
20439
|
}
|
|
20439
20440
|
const globals = processGlobals(records);
|
|
20440
20441
|
const warnings = [];
|
|
20441
20442
|
if (globals.encrypted) {
|
|
20442
|
-
throw new (0,
|
|
20443
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20443
20444
|
}
|
|
20444
20445
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20445
20446
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20490,7 +20491,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20490
20491
|
pageCount: totalSheets
|
|
20491
20492
|
};
|
|
20492
20493
|
return {
|
|
20493
|
-
markdown:
|
|
20494
|
+
markdown: _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, allBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _281 => _281.tableFormat]) }),
|
|
20494
20495
|
blocks: allBlocks,
|
|
20495
20496
|
metadata,
|
|
20496
20497
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20929,7 +20930,7 @@ function isDisplayMath(el) {
|
|
|
20929
20930
|
}
|
|
20930
20931
|
|
|
20931
20932
|
// src/docx/parser.ts
|
|
20932
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20933
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkGUU7OHIHcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20933
20934
|
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
20934
20935
|
var NEVER_READ_RE = /^word\/(?:embeddings\/.*|media\/.+\.(?:mp4|m4v|mov|avi|wmv|mpe?g|mkv|webm|mp3|wav|m4a|wma|aac|ogg|flac|mid|bin))$/i;
|
|
20935
20936
|
function matchesLocal(el, localName3) {
|
|
@@ -20987,7 +20988,7 @@ function getAttr(el, localName3) {
|
|
|
20987
20988
|
return null;
|
|
20988
20989
|
}
|
|
20989
20990
|
function parseXml2(text) {
|
|
20990
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
20991
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkGUU7OHIHcjs.stripDtd.call(void 0, text), "text/xml");
|
|
20991
20992
|
}
|
|
20992
20993
|
function parseStyles(xml) {
|
|
20993
20994
|
const doc = parseXml2(xml);
|
|
@@ -21123,7 +21124,7 @@ function parseFootnotes(xml) {
|
|
|
21123
21124
|
const runs = findElements(p, "r");
|
|
21124
21125
|
for (const r of runs) {
|
|
21125
21126
|
const tElements = getChildElements(r, "t");
|
|
21126
|
-
for (const t of tElements) texts.push(
|
|
21127
|
+
for (const t of tElements) texts.push(_chunkEVPP2BSOcjs.escapeLiteralTags.call(void 0, _chunkEVPP2BSOcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(t.textContent, () => ( "")))));
|
|
21127
21128
|
}
|
|
21128
21129
|
}
|
|
21129
21130
|
notes.set(id, texts.join("").trim());
|
|
@@ -21154,7 +21155,7 @@ function collectOmmlRoots(p) {
|
|
|
21154
21155
|
function extractRun(r) {
|
|
21155
21156
|
let text = "";
|
|
21156
21157
|
for (const el of effectiveChildElements(r)) {
|
|
21157
|
-
if (matchesLocal(el, "t")) text +=
|
|
21158
|
+
if (matchesLocal(el, "t")) text += _chunkEVPP2BSOcjs.escapeLiteralTags.call(void 0, _chunkEVPP2BSOcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
21158
21159
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
21159
21160
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
21160
21161
|
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
@@ -21167,7 +21168,7 @@ function extractRun(r) {
|
|
|
21167
21168
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
21168
21169
|
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
21169
21170
|
const v = va ? getAttr(va, "val") : null;
|
|
21170
|
-
if (v === "superscript" || v === "subscript") text =
|
|
21171
|
+
if (v === "superscript" || v === "subscript") text = _chunkEVPP2BSOcjs.wrapScript.call(void 0, text, v === "superscript" ? "sup" : "sub");
|
|
21171
21172
|
}
|
|
21172
21173
|
return { text, bold, italic };
|
|
21173
21174
|
}
|
|
@@ -21185,7 +21186,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
21185
21186
|
function makeLink(text, rawHref) {
|
|
21186
21187
|
if (!text) return "";
|
|
21187
21188
|
if (!rawHref) return text;
|
|
21188
|
-
const href =
|
|
21189
|
+
const href = _chunkGUU7OHIHcjs.sanitizeHref.call(void 0, rawHref);
|
|
21189
21190
|
return href ? `[${text}](${href})` : text;
|
|
21190
21191
|
}
|
|
21191
21192
|
function collectInline(p, footnotes, rels) {
|
|
@@ -21276,7 +21277,7 @@ function collectInline(p, footnotes, rels) {
|
|
|
21276
21277
|
const m = mathText(om);
|
|
21277
21278
|
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
21278
21279
|
}
|
|
21279
|
-
const text =
|
|
21280
|
+
const text = _chunkEVPP2BSOcjs.tidyScriptTags.call(void 0, parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
21280
21281
|
return { text, bold, italic, footnoteText };
|
|
21281
21282
|
}
|
|
21282
21283
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -21401,7 +21402,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21401
21402
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21402
21403
|
})
|
|
21403
21404
|
);
|
|
21404
|
-
const table2 =
|
|
21405
|
+
const table2 = _chunkEVPP2BSOcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21405
21406
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21406
21407
|
return { type: "table", table: table2 };
|
|
21407
21408
|
}
|
|
@@ -21450,7 +21451,7 @@ async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
|
21450
21451
|
let data = null;
|
|
21451
21452
|
if (readBytes) data = await imgFile.async("uint8array");
|
|
21452
21453
|
imgIdx++;
|
|
21453
|
-
const ext =
|
|
21454
|
+
const ext = _chunkGUU7OHIHcjs.partExtension.call(void 0, imgPath);
|
|
21454
21455
|
const mimeMap = {
|
|
21455
21456
|
png: "image/png",
|
|
21456
21457
|
jpg: "image/jpeg",
|
|
@@ -21549,12 +21550,12 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21549
21550
|
}
|
|
21550
21551
|
async function parseDocxDocument(buffer, options) {
|
|
21551
21552
|
const readImages = _optionalChain([options, 'optionalAccess', _317 => _317.images]) !== false;
|
|
21552
|
-
|
|
21553
|
+
_chunkGUU7OHIHcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5, void 0, { re: MEDIA_PART_RE, skip: !readImages, never: NEVER_READ_RE });
|
|
21553
21554
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21554
21555
|
const warnings = [];
|
|
21555
21556
|
const docFile = zip.file("word/document.xml");
|
|
21556
21557
|
if (!docFile) {
|
|
21557
|
-
throw new (0,
|
|
21558
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21558
21559
|
}
|
|
21559
21560
|
let rels = /* @__PURE__ */ new Map();
|
|
21560
21561
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21601,7 +21602,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21601
21602
|
const doc = parseXml2(docXml);
|
|
21602
21603
|
const body = findElements(doc, "body");
|
|
21603
21604
|
if (body.length === 0) {
|
|
21604
|
-
throw new (0,
|
|
21605
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21605
21606
|
}
|
|
21606
21607
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
21607
21608
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -21654,7 +21655,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21654
21655
|
}
|
|
21655
21656
|
}
|
|
21656
21657
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21657
|
-
const markdown =
|
|
21658
|
+
const markdown = _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _324 => _324.tableFormat]) });
|
|
21658
21659
|
return {
|
|
21659
21660
|
markdown,
|
|
21660
21661
|
blocks,
|
|
@@ -21668,7 +21669,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21668
21669
|
// src/pptx/parser.ts
|
|
21669
21670
|
|
|
21670
21671
|
|
|
21671
|
-
var MAX_DECOMPRESS_SIZE6 =
|
|
21672
|
+
var MAX_DECOMPRESS_SIZE6 = _chunkGUU7OHIHcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
21672
21673
|
var MEDIA_PART_RE2 = /^ppt\/(?:media|embeddings)\//;
|
|
21673
21674
|
var NEVER_READ_RE2 = /^ppt\/(?:embeddings\/.*|media\/.+\.(?:mp4|m4v|mov|avi|wmv|mpe?g|mkv|webm|mp3|wav|m4a|wma|aac|ogg|flac|mid|bin))$/i;
|
|
21674
21675
|
var MAX_ZIP_ENTRIES2 = 1e4;
|
|
@@ -21691,7 +21692,7 @@ var IMAGE_MIME = {
|
|
|
21691
21692
|
svg: "image/svg+xml"
|
|
21692
21693
|
};
|
|
21693
21694
|
function parseXml3(text) {
|
|
21694
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21695
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkGUU7OHIHcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21695
21696
|
}
|
|
21696
21697
|
function getAttr2(el, name) {
|
|
21697
21698
|
const attrs = el.attributes;
|
|
@@ -21758,7 +21759,7 @@ async function slideParts(zip) {
|
|
|
21758
21759
|
names.sort((a, b) => Number(SLIDE_PART_RE.exec(a)[1]) - Number(SLIDE_PART_RE.exec(b)[1]));
|
|
21759
21760
|
ordered.push(...names);
|
|
21760
21761
|
}
|
|
21761
|
-
if (ordered.length > MAX_SLIDES) throw new (0,
|
|
21762
|
+
if (ordered.length > MAX_SLIDES) throw new (0, _chunkGUU7OHIHcjs.KordocError)(`PPTX \uC2AC\uB77C\uC774\uB4DC \uC218 \uCD08\uACFC: ${ordered.length} (\uCD5C\uB300 ${MAX_SLIDES})`);
|
|
21762
21763
|
return ordered;
|
|
21763
21764
|
}
|
|
21764
21765
|
function paragraphText(p) {
|
|
@@ -21769,12 +21770,12 @@ function paragraphText(p) {
|
|
|
21769
21770
|
const t = findChildByLocalName(child, "t");
|
|
21770
21771
|
const rPr = findChildByLocalName(child, "rPr");
|
|
21771
21772
|
const baseline = Number(rPr ? _nullishCoalesce(getAttr2(rPr, "baseline"), () => ( 0)) : 0);
|
|
21772
|
-
if (t) text +=
|
|
21773
|
+
if (t) text += _chunkEVPP2BSOcjs.wrapScript.call(void 0, _chunkEVPP2BSOcjs.escapeLiteralTags.call(void 0, _chunkEVPP2BSOcjs.escapeLiteralDollar.call(void 0, rawTextContent(t))), baseline > 0 ? "sup" : baseline < 0 ? "sub" : null);
|
|
21773
21774
|
} else if (name === "br") {
|
|
21774
21775
|
text += " ";
|
|
21775
21776
|
}
|
|
21776
21777
|
}
|
|
21777
|
-
return
|
|
21778
|
+
return _chunkEVPP2BSOcjs.tidyScriptTags.call(void 0, text.replace(/\s+/g, " ").trim());
|
|
21778
21779
|
}
|
|
21779
21780
|
function bodyParagraphs(txBody) {
|
|
21780
21781
|
const out = [];
|
|
@@ -21835,7 +21836,7 @@ function parseTable2(tbl2, page, keepEmptyCols) {
|
|
|
21835
21836
|
});
|
|
21836
21837
|
return cells;
|
|
21837
21838
|
});
|
|
21838
|
-
const table2 =
|
|
21839
|
+
const table2 = _chunkEVPP2BSOcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21839
21840
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21840
21841
|
return { type: "table", table: table2, pageNumber: page };
|
|
21841
21842
|
}
|
|
@@ -21848,7 +21849,7 @@ async function pictureBlock(pic, ctx) {
|
|
|
21848
21849
|
if (!filename) {
|
|
21849
21850
|
const file = ctx.zip.file(rel.target);
|
|
21850
21851
|
if (!file) return null;
|
|
21851
|
-
const ext =
|
|
21852
|
+
const ext = _chunkGUU7OHIHcjs.partExtension.call(void 0, rel.target);
|
|
21852
21853
|
filename = `image_${String(ctx.imageNames.size + 1).padStart(3, "0")}.${ext}`;
|
|
21853
21854
|
try {
|
|
21854
21855
|
if (_optionalChain([ctx, 'access', _328 => _328.options, 'optionalAccess', _329 => _329.images]) !== false) {
|
|
@@ -21926,10 +21927,10 @@ async function notesText(zip, rels) {
|
|
|
21926
21927
|
return texts.join(" ");
|
|
21927
21928
|
}
|
|
21928
21929
|
async function parsePptxDocument(buffer, options) {
|
|
21929
|
-
|
|
21930
|
+
_chunkGUU7OHIHcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE6, MAX_ZIP_ENTRIES2, { re: MEDIA_PART_RE2, skip: _optionalChain([options, 'optionalAccess', _332 => _332.images]) === false, never: NEVER_READ_RE2 });
|
|
21930
21931
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21931
21932
|
if (!zip.file("ppt/presentation.xml")) {
|
|
21932
|
-
throw new (0,
|
|
21933
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 PPTX \uD30C\uC77C: ppt/presentation.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21933
21934
|
}
|
|
21934
21935
|
const warnings = [];
|
|
21935
21936
|
const blocks = [];
|
|
@@ -21976,7 +21977,7 @@ async function parsePptxDocument(buffer, options) {
|
|
|
21976
21977
|
}
|
|
21977
21978
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")), pageNumber: b.pageNumber }));
|
|
21978
21979
|
return {
|
|
21979
|
-
markdown:
|
|
21980
|
+
markdown: _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _334 => _334.tableFormat]) }),
|
|
21980
21981
|
blocks,
|
|
21981
21982
|
metadata,
|
|
21982
21983
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -21992,11 +21993,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
21992
21993
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
21993
21994
|
function parseHwpmlDocument(buffer, options) {
|
|
21994
21995
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
21995
|
-
throw new (0,
|
|
21996
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
21996
21997
|
}
|
|
21997
21998
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
21998
21999
|
const normalized = text.replace(/ /g, " ");
|
|
21999
|
-
const xml =
|
|
22000
|
+
const xml = _chunkGUU7OHIHcjs.stripDtd.call(void 0, normalized);
|
|
22000
22001
|
const warnings = [];
|
|
22001
22002
|
const parser = new (0, _xmldom.DOMParser)({
|
|
22002
22003
|
onError: (_level, msg2) => {
|
|
@@ -22036,7 +22037,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
22036
22037
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _336 => _336.keepTrailingEmptyCols]), () => ( false)));
|
|
22037
22038
|
}
|
|
22038
22039
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
22039
|
-
const markdown =
|
|
22040
|
+
const markdown = _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _337 => _337.tableFormat]) });
|
|
22040
22041
|
return {
|
|
22041
22042
|
markdown,
|
|
22042
22043
|
blocks,
|
|
@@ -22143,7 +22144,7 @@ function collectCharText(node, parts, depth = 0) {
|
|
|
22143
22144
|
if (tag === "CHAR") {
|
|
22144
22145
|
for (const c of Array.from(el.childNodes)) {
|
|
22145
22146
|
const t = c.nodeType === 1 ? localName(c) === "TAB" ? " " : rawTextContent(c) : c.nodeType === 3 || c.nodeType === 4 ? _nullishCoalesce(c.nodeValue, () => ( "")) : "";
|
|
22146
|
-
if (t) parts.push(
|
|
22147
|
+
if (t) parts.push(_chunkEVPP2BSOcjs.escapeLiteralTags.call(void 0, t));
|
|
22147
22148
|
}
|
|
22148
22149
|
} else if (tag === "TABLE" || tag === "PICTURE" || tag === "SHAPEOBJECT") {
|
|
22149
22150
|
} else if (tag === "AUTONUM") {
|
|
@@ -22203,7 +22204,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
22203
22204
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
22204
22205
|
cellRows[r].push(cell2);
|
|
22205
22206
|
}
|
|
22206
|
-
const table2 =
|
|
22207
|
+
const table2 = _chunkEVPP2BSOcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
22207
22208
|
if (structured.length > 0) {
|
|
22208
22209
|
const claimed = /* @__PURE__ */ new Set();
|
|
22209
22210
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -23832,7 +23833,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
23832
23833
|
};
|
|
23833
23834
|
}
|
|
23834
23835
|
async function extractClickHereFields(hwpxBuffer) {
|
|
23835
|
-
|
|
23836
|
+
_chunkGUU7OHIHcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
23836
23837
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
23837
23838
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
23838
23839
|
const fields = [];
|
|
@@ -23868,7 +23869,7 @@ function readZipEntries(buf) {
|
|
|
23868
23869
|
}
|
|
23869
23870
|
function localDataStart(view, localOffset) {
|
|
23870
23871
|
if (view.getUint32(localOffset, true) !== LOCAL_SIG) {
|
|
23871
|
-
throw new (0,
|
|
23872
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
23872
23873
|
}
|
|
23873
23874
|
const nameLen = view.getUint16(localOffset + 26, true);
|
|
23874
23875
|
const extraLen = view.getUint16(localOffset + 28, true);
|
|
@@ -23898,19 +23899,19 @@ function parseCentralDirectory(buf) {
|
|
|
23898
23899
|
}
|
|
23899
23900
|
}
|
|
23900
23901
|
}
|
|
23901
|
-
if (eocdOffset < 0) throw new (0,
|
|
23902
|
+
if (eocdOffset < 0) throw new (0, _chunkGUU7OHIHcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
23902
23903
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
23903
23904
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
23904
23905
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
23905
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
23906
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkGUU7OHIHcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23906
23907
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
23907
|
-
throw new (0,
|
|
23908
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23908
23909
|
}
|
|
23909
23910
|
const decoder = new TextDecoder("utf-8");
|
|
23910
23911
|
const entries = [];
|
|
23911
23912
|
let pos = cdOffset;
|
|
23912
23913
|
for (let i = 0; i < totalEntries; i++) {
|
|
23913
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
23914
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkGUU7OHIHcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
23914
23915
|
const flags = view.getUint16(pos + 8, true);
|
|
23915
23916
|
const method = view.getUint16(pos + 10, true);
|
|
23916
23917
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -23921,7 +23922,7 @@ function parseCentralDirectory(buf) {
|
|
|
23921
23922
|
const commentLen = view.getUint16(pos + 32, true);
|
|
23922
23923
|
const localOffset = view.getUint32(pos + 42, true);
|
|
23923
23924
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
23924
|
-
throw new (0,
|
|
23925
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23925
23926
|
}
|
|
23926
23927
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
23927
23928
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -23950,11 +23951,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23950
23951
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
23951
23952
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
23952
23953
|
for (const name of replacements.keys()) {
|
|
23953
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
23954
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkGUU7OHIHcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
23954
23955
|
}
|
|
23955
23956
|
if (additions) {
|
|
23956
23957
|
for (const name of additions.keys()) {
|
|
23957
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
23958
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkGUU7OHIHcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
23958
23959
|
}
|
|
23959
23960
|
}
|
|
23960
23961
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -23973,7 +23974,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23973
23974
|
offset += seg.length;
|
|
23974
23975
|
continue;
|
|
23975
23976
|
}
|
|
23976
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
23977
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkGUU7OHIHcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
23977
23978
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
23978
23979
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
23979
23980
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -23981,7 +23982,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23981
23982
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
23982
23983
|
const method = e.method;
|
|
23983
23984
|
if (method !== 0 && method !== 8) {
|
|
23984
|
-
throw new (0,
|
|
23985
|
+
throw new (0, _chunkGUU7OHIHcjs.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`);
|
|
23985
23986
|
}
|
|
23986
23987
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
23987
23988
|
const crc = crc32(newData);
|
|
@@ -24080,11 +24081,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24080
24081
|
var ANNOTATION_BLANK_RE = /[((][^))]*[::]\s*[))]/;
|
|
24081
24082
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
24082
24083
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
24083
|
-
|
|
24084
|
+
_chunkGUU7OHIHcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24084
24085
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24085
24086
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24086
24087
|
if (sectionPaths.length === 0) {
|
|
24087
|
-
throw new (0,
|
|
24088
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24088
24089
|
}
|
|
24089
24090
|
const warnings = [];
|
|
24090
24091
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -24453,12 +24454,72 @@ function collectAllTables(scan) {
|
|
|
24453
24454
|
return out;
|
|
24454
24455
|
}
|
|
24455
24456
|
|
|
24457
|
+
// src/ocr/embedded-image-ocr.ts
|
|
24458
|
+
var MIN_SIDE = 24;
|
|
24459
|
+
async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
24460
|
+
const ocr = _optionalChain([options, 'optionalAccess', _441 => _441.ocr]);
|
|
24461
|
+
if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
|
|
24462
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-HJM5IJKU.cjs")));
|
|
24463
|
+
let inserted = false, unreadable = 0;
|
|
24464
|
+
let failed = null;
|
|
24465
|
+
const walk = async (list, depth) => {
|
|
24466
|
+
if (depth > 64) return;
|
|
24467
|
+
for (let i = 0; i < list.length; i++) {
|
|
24468
|
+
const b = list[i];
|
|
24469
|
+
if (b.children) await walk(b.children, depth + 1);
|
|
24470
|
+
if (b.table) {
|
|
24471
|
+
for (const row of b.table.cells) for (const cell2 of row) if (cell2.blocks) await walk(cell2.blocks, depth + 1);
|
|
24472
|
+
}
|
|
24473
|
+
if (b.type !== "image" || !b.imageData || failed) continue;
|
|
24474
|
+
const bytes = ocrBytes(b.imageData);
|
|
24475
|
+
if (!bytes) {
|
|
24476
|
+
unreadable++;
|
|
24477
|
+
continue;
|
|
24478
|
+
}
|
|
24479
|
+
if (await tooSmall(bytes)) continue;
|
|
24480
|
+
let found;
|
|
24481
|
+
try {
|
|
24482
|
+
const buf = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
24483
|
+
found = (await parseImageDocument(buf, options)).blocks;
|
|
24484
|
+
} catch (err) {
|
|
24485
|
+
failed = err instanceof Error ? err.message : String(err);
|
|
24486
|
+
continue;
|
|
24487
|
+
}
|
|
24488
|
+
if (!found.length) continue;
|
|
24489
|
+
const placed = found.map((f) => ({ ...f, pageNumber: b.pageNumber, bbox: void 0 }));
|
|
24490
|
+
list.splice(i + 1, 0, ...placed);
|
|
24491
|
+
i += placed.length;
|
|
24492
|
+
inserted = true;
|
|
24493
|
+
}
|
|
24494
|
+
};
|
|
24495
|
+
await walk(blocks, 0);
|
|
24496
|
+
if (unreadable) warnings.push({ code: "SKIPPED_IMAGE", message: `${unreadable}\uAC1C \uADF8\uB9BC\uC740 OCR \uB85C \uC77D\uC744 \uC218 \uC5C6\uB294 \uD615\uC2DD(WMF\xB7EMF \uB4F1)\uC774\uB77C \uAC74\uB108\uB700` });
|
|
24497
|
+
if (failed) warnings.push({ code: "OCR_FAILED", message: `\uC0BD\uC785 \uADF8\uB9BC OCR \uC2E4\uD328 \u2014 \uADF8\uB9BC \uC18D \uAE00 \uC5C6\uC774 \uACC4\uC18D: ${failed}` });
|
|
24498
|
+
return inserted;
|
|
24499
|
+
}
|
|
24500
|
+
function ocrBytes(img) {
|
|
24501
|
+
const mime = img.mimeType.toLowerCase();
|
|
24502
|
+
if (mime.includes("wmf") || mime.includes("emf")) return null;
|
|
24503
|
+
if (mime.includes("bmp")) return _chunkY7XHHV55cjs.bmpToPng.call(void 0, img.data);
|
|
24504
|
+
return img.data;
|
|
24505
|
+
}
|
|
24506
|
+
async function tooSmall(bytes) {
|
|
24507
|
+
try {
|
|
24508
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
24509
|
+
const sharp = typeof mod === "function" ? mod : mod.default;
|
|
24510
|
+
const { width, height } = await sharp(Buffer.from(bytes)).metadata();
|
|
24511
|
+
return !!width && !!height && (width < MIN_SIDE || height < MIN_SIDE);
|
|
24512
|
+
} catch (e37) {
|
|
24513
|
+
return false;
|
|
24514
|
+
}
|
|
24515
|
+
}
|
|
24516
|
+
|
|
24456
24517
|
// src/table/classifier.ts
|
|
24457
24518
|
var DIAGRAM_KEYWORDS = /조직도|비상\s*연락망|연락망|체계도|업무\s*체계도|기구표|배치도|흐름도|추진\s*체계/u;
|
|
24458
24519
|
var KEYWORD_GATE = 0.3;
|
|
24459
24520
|
function cellType(cell2) {
|
|
24460
24521
|
const t = cell2.text.trim();
|
|
24461
|
-
if (!t && !_optionalChain([cell2, 'access',
|
|
24522
|
+
if (!t && !_optionalChain([cell2, 'access', _442 => _442.blocks, 'optionalAccess', _443 => _443.length])) return "empty";
|
|
24462
24523
|
if (!t) return "short";
|
|
24463
24524
|
if (/^[-+]?[\d,]+(\.\d+)?\s*(%|원|명|건|개|천원|백만원|㎡|㎢|kg|km|시간|일)?$/u.test(t)) return "number";
|
|
24464
24525
|
if (/^\d{2,4}[.\-/년]\s*\d{1,2}[.\-/월]?(\s*\d{1,2}[.일]?)?\.?$/u.test(t)) return "date";
|
|
@@ -24470,7 +24531,7 @@ function anchors(table2) {
|
|
|
24470
24531
|
for (let r = 0; r < table2.rows; r++) {
|
|
24471
24532
|
for (let c = 0; c < table2.cols; c++) {
|
|
24472
24533
|
if (covered.has(`${r},${c}`)) continue;
|
|
24473
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
24534
|
+
const cell2 = _optionalChain([table2, 'access', _444 => _444.cells, 'access', _445 => _445[r], 'optionalAccess', _446 => _446[c]]);
|
|
24474
24535
|
if (!cell2) continue;
|
|
24475
24536
|
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}`);
|
|
24476
24537
|
out.push({ r, c, cell: cell2, type: cellType(cell2) });
|
|
@@ -24480,8 +24541,8 @@ function anchors(table2) {
|
|
|
24480
24541
|
}
|
|
24481
24542
|
function isWrapper(table2) {
|
|
24482
24543
|
if (table2.rows !== 1 || table2.cols !== 1) return false;
|
|
24483
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
24484
|
-
return !!_optionalChain([cell2, 'optionalAccess',
|
|
24544
|
+
const cell2 = _optionalChain([table2, 'access', _447 => _447.cells, 'access', _448 => _448[0], 'optionalAccess', _449 => _449[0]]);
|
|
24545
|
+
return !!_optionalChain([cell2, 'optionalAccess', _450 => _450.blocks, 'optionalAccess', _451 => _451.some, 'call', _452 => _452((b) => b.type === "table" && b.table)]);
|
|
24485
24546
|
}
|
|
24486
24547
|
function round2(v) {
|
|
24487
24548
|
return Math.round(v * 100) / 100;
|
|
@@ -24547,7 +24608,7 @@ function classifyTable(table2, ctx = {}) {
|
|
|
24547
24608
|
const emptyShare = 1 - activeRatio;
|
|
24548
24609
|
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);
|
|
24549
24610
|
let nonTabular = 0.6 * spanIrregularity + 0.4 * spacerBands + 0.5 * sparsity;
|
|
24550
|
-
const nestedCells = A.filter((a) => _optionalChain([a, 'access',
|
|
24611
|
+
const nestedCells = A.filter((a) => _optionalChain([a, 'access', _453 => _453.cell, 'access', _454 => _454.blocks, 'optionalAccess', _455 => _455.some, 'call', _456 => _456((b) => b.type === "table" && b.table)])).length;
|
|
24551
24612
|
if (nestedCells && nestedCells >= A.length * 0.5) {
|
|
24552
24613
|
nonTabular += 0.25;
|
|
24553
24614
|
reasons.push("nested-structure-wrapper");
|
|
@@ -24608,8 +24669,8 @@ function classifyTableTree(blocks) {
|
|
|
24608
24669
|
return blocks;
|
|
24609
24670
|
}
|
|
24610
24671
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
24611
|
-
const structured = hasMerged(table2) ||
|
|
24612
|
-
if (opts.smartVisual && _optionalChain([table2, 'access',
|
|
24672
|
+
const structured = hasMerged(table2) || _chunkEVPP2BSOcjs.hasStructuredCellContent.call(void 0, table2);
|
|
24673
|
+
if (opts.smartVisual && _optionalChain([table2, 'access', _457 => _457.classification, 'optionalAccess', _458 => _458.kind]) === "non-tabular-layout") return "visual";
|
|
24613
24674
|
return structured ? "html" : "gfm";
|
|
24614
24675
|
}
|
|
24615
24676
|
|
|
@@ -26073,7 +26134,7 @@ function fixedPitchWidthEm1000(cp) {
|
|
|
26073
26134
|
function widthFnOf(faceClass) {
|
|
26074
26135
|
if (faceClass === "fixedPitch") return fixedPitchWidthEm1000;
|
|
26075
26136
|
if (faceClass === "gothic") return gothicWidthEm1000;
|
|
26076
|
-
if (_optionalChain([faceClass, 'optionalAccess',
|
|
26137
|
+
if (_optionalChain([faceClass, 'optionalAccess', _459 => _459.startsWith, 'call', _460 => _460("font:")])) {
|
|
26077
26138
|
const face = faceClass.slice(5);
|
|
26078
26139
|
return _nullishCoalesce(fontWidthFn(face), () => ( gothicWidthEm1000));
|
|
26079
26140
|
}
|
|
@@ -26083,9 +26144,9 @@ function isSpaceCp(cp) {
|
|
|
26083
26144
|
return cp === 32 || cp === 160;
|
|
26084
26145
|
}
|
|
26085
26146
|
function measureTextWidth(text, height, ratioPct, opts) {
|
|
26086
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
26087
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
26088
|
-
const widthEm = widthFnOf(_optionalChain([opts, 'optionalAccess',
|
|
26147
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _461 => _461.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
26148
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _462 => _462.spacingPct]), () => ( 0));
|
|
26149
|
+
const widthEm = widthFnOf(_optionalChain([opts, 'optionalAccess', _463 => _463.faceClass]));
|
|
26089
26150
|
let em = 0;
|
|
26090
26151
|
for (const ch of text) {
|
|
26091
26152
|
const cp = ch.codePointAt(0);
|
|
@@ -26097,7 +26158,7 @@ function measureTextWidth(text, height, ratioPct, opts) {
|
|
|
26097
26158
|
var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u2103\u3009\u300B\u300D\u300F\u3011\u3015!%),.:;?]}\u20A9~\u2026\xB7\u3001\u3002\u3003"]);
|
|
26098
26159
|
var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
|
|
26099
26160
|
function prepareWrap(text, mode, opts) {
|
|
26100
|
-
const widthEm = widthFnOf(_optionalChain([opts, 'optionalAccess',
|
|
26161
|
+
const widthEm = widthFnOf(_optionalChain([opts, 'optionalAccess', _464 => _464.faceClass])), spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _465 => _465.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
26101
26162
|
const advances = [], steps = [];
|
|
26102
26163
|
let i = 0;
|
|
26103
26164
|
for (const ch of text) {
|
|
@@ -26113,12 +26174,12 @@ function splitWrapUnits(text, mode) {
|
|
|
26113
26174
|
}
|
|
26114
26175
|
function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
|
|
26115
26176
|
const EPS = 0.5;
|
|
26116
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
26117
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
26118
|
-
const prepared = _optionalChain([opts, 'optionalAccess',
|
|
26119
|
-
const widthEm = prepared ? null : widthFnOf(_optionalChain([opts, 'optionalAccess',
|
|
26177
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _466 => _466.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
26178
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _467 => _467.spacingPct]), () => ( 0));
|
|
26179
|
+
const prepared = _optionalChain([opts, 'optionalAccess', _468 => _468.prepared]);
|
|
26180
|
+
const widthEm = prepared ? null : widthFnOf(_optionalChain([opts, 'optionalAccess', _469 => _469.faceClass]));
|
|
26120
26181
|
const k = height * ratioPct / 100 / 1e3;
|
|
26121
|
-
const unitW = _optionalChain([opts, 'optionalAccess',
|
|
26182
|
+
const unitW = _optionalChain([opts, 'optionalAccess', _470 => _470.widths]);
|
|
26122
26183
|
const charWAt = (i, ch) => {
|
|
26123
26184
|
if (unitW) return (_nullishCoalesce(unitW[i], () => ( 0))) + (ch.length === 2 ? _nullishCoalesce(unitW[i + 1], () => ( 0)) : 0);
|
|
26124
26185
|
if (prepared) return prepared.advances[i] * (1 + spacing / 100) * k;
|
|
@@ -26138,7 +26199,7 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
26138
26199
|
}
|
|
26139
26200
|
return w;
|
|
26140
26201
|
};
|
|
26141
|
-
const units = _nullishCoalesce(_optionalChain([prepared, 'optionalAccess',
|
|
26202
|
+
const units = _nullishCoalesce(_optionalChain([prepared, 'optionalAccess', _471 => _471.units]), () => ( splitWrapUnits(text, mode)));
|
|
26142
26203
|
const starts = [0];
|
|
26143
26204
|
let lineW = 0;
|
|
26144
26205
|
let avail = firstWidth;
|
|
@@ -26411,17 +26472,17 @@ function findAgency(name) {
|
|
|
26411
26472
|
}
|
|
26412
26473
|
function agencyStyle(name) {
|
|
26413
26474
|
const s = findAgency(name);
|
|
26414
|
-
if (!s) throw new (0,
|
|
26475
|
+
if (!s) throw new (0, _chunkGUU7OHIHcjs.KordocError)(`agency: \uC2E4\uCE21 \uC11C\uC2DD\uC774 \uC5C6\uB294 \uAE30\uAD00\uC785\uB2C8\uB2E4 "${name}" \u2014 ${AGENCY_COMMON_NAME} \uB610\uB294 ${agencyNames().join("\xB7")}`);
|
|
26415
26476
|
return s;
|
|
26416
26477
|
}
|
|
26417
26478
|
function applyAgency(opts, preset) {
|
|
26418
|
-
if (!_optionalChain([opts, 'access',
|
|
26479
|
+
if (!_optionalChain([opts, 'access', _472 => _472.agency, 'optionalAccess', _473 => _473.trim, 'call', _474 => _474()])) return { opts, agency: null };
|
|
26419
26480
|
agencyStyle(opts.agency);
|
|
26420
26481
|
if (!AGENCY_PRESETS.has(preset)) return { opts, agency: null };
|
|
26421
26482
|
const name = opts.agency.trim();
|
|
26422
26483
|
const st = agencyStyle(name);
|
|
26423
|
-
const userBody = _nullishCoalesce(_optionalChain([opts, 'access',
|
|
26424
|
-
const userHeading = _optionalChain([opts, 'access',
|
|
26484
|
+
const userBody = _nullishCoalesce(_optionalChain([opts, 'access', _475 => _475.fonts, 'optionalAccess', _476 => _476.body]), () => ( (opts.bodyFont ? opts.bodyFont === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5" : void 0)));
|
|
26485
|
+
const userHeading = _optionalChain([opts, 'access', _477 => _477.fonts, 'optionalAccess', _478 => _478.heading]);
|
|
26425
26486
|
const ptFree = opts.bodyPt === void 0;
|
|
26426
26487
|
const fonts = { ...opts.fonts };
|
|
26427
26488
|
const setFont = (role, font) => {
|
|
@@ -26481,7 +26542,7 @@ function applyAgency(opts, preset) {
|
|
|
26481
26542
|
return { opts: merged, agency };
|
|
26482
26543
|
}
|
|
26483
26544
|
function agencyWarnings(opts, preset) {
|
|
26484
|
-
const name = _optionalChain([opts, 'access',
|
|
26545
|
+
const name = _optionalChain([opts, 'access', _479 => _479.agency, 'optionalAccess', _480 => _480.trim, 'call', _481 => _481()]);
|
|
26485
26546
|
if (!name) return [];
|
|
26486
26547
|
if (!AGENCY_PRESETS.has(preset)) return [`agency(\uAE30\uAD00 \uC11C\uC2DD)\uB294 \uBCF4\uACE0\uC11C\xB7\uACC4\uD68D\uC11C\xB7\uC5C5\uBB34\uBCF4\uACE0\xB7\uAC1C\uC870\uC2DD\xB7\uBCF4\uB3C4\uC790\uB8CC \uC804\uC6A9 \u2014 '${preset}' \uD504\uB9AC\uC14B\uC5D0\uC11C \uBB34\uC2DC\uB428`];
|
|
26487
26548
|
const st = findAgency(name);
|
|
@@ -26519,16 +26580,16 @@ var PARA_LIST = 7;
|
|
|
26519
26580
|
var DEFAULT_TEXT_COLOR = "#000000";
|
|
26520
26581
|
function resolveTheme(theme) {
|
|
26521
26582
|
return {
|
|
26522
|
-
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
26523
|
-
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
26524
|
-
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
26525
|
-
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
26526
|
-
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
26527
|
-
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
26583
|
+
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _482 => _482.headingColors, 'optionalAccess', _483 => _483[1]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
26584
|
+
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _484 => _484.headingColors, 'optionalAccess', _485 => _485[2]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
26585
|
+
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _486 => _486.headingColors, 'optionalAccess', _487 => _487[3]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
26586
|
+
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _488 => _488.headingColors, 'optionalAccess', _489 => _489[4]]), () => ( _optionalChain([theme, 'optionalAccess', _490 => _490.headingColors, 'optionalAccess', _491 => _491[3]]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
26587
|
+
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _492 => _492.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
26588
|
+
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _493 => _493.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
26528
26589
|
/** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
|
|
26529
|
-
hasQuoteOption: _optionalChain([theme, 'optionalAccess',
|
|
26530
|
-
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
26531
|
-
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess',
|
|
26590
|
+
hasQuoteOption: _optionalChain([theme, 'optionalAccess', _494 => _494.quoteColor]) !== void 0,
|
|
26591
|
+
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _495 => _495.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _496 => _496.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
26592
|
+
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _497 => _497.tableHeaderBold])
|
|
26532
26593
|
};
|
|
26533
26594
|
}
|
|
26534
26595
|
function escapeXml(text) {
|
|
@@ -26967,7 +27028,7 @@ function buildDocFootTable(f, ctx, internal) {
|
|
|
26967
27028
|
const titleW = (t) => Math.max(unitW[0], Math.round(measureTextWidth(t, 1e3, 100, { faceClass: "fixedPitch" })) + 280 + unit + 300);
|
|
26968
27029
|
const widths = [];
|
|
26969
27030
|
for (let i = 0; i < n; i++) {
|
|
26970
|
-
widths.push(titleW(_nullishCoalesce(_optionalChain([f, 'access',
|
|
27031
|
+
widths.push(titleW(_nullishCoalesce(_optionalChain([f, 'access', _498 => _498.approvers, 'access', _499 => _499[i], 'optionalAccess', _500 => _500.title]), () => ( ""))), unitW[1]);
|
|
26971
27032
|
if (i < n - 1) widths.push(unitW[2]);
|
|
26972
27033
|
}
|
|
26973
27034
|
const used = widths.reduce((a, b) => a + b, 0);
|
|
@@ -27143,8 +27204,8 @@ function buildSummaryBox(text, ctx) {
|
|
|
27143
27204
|
let lines = 0;
|
|
27144
27205
|
const paras = bodies.map((b) => {
|
|
27145
27206
|
const f = fitParagraph(b, frame.summaryFont, frame.summaryPt, avail, avail);
|
|
27146
|
-
const c = reg.char({ font: frame.summaryFont, pt: frame.summaryPt, bold: true, ratio: _nullishCoalesce(_optionalChain([f, 'optionalAccess',
|
|
27147
|
-
lines += simulateWrap(b, avail * 0.995, avail * 0.995, frame.summaryPt * 100, _nullishCoalesce(_optionalChain([f, 'optionalAccess',
|
|
27207
|
+
const c = reg.char({ font: frame.summaryFont, pt: frame.summaryPt, bold: true, ratio: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _501 => _501.ratio]), () => ( 100)), spacing: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _502 => _502.spacing]), () => ( 0)) });
|
|
27208
|
+
lines += simulateWrap(b, avail * 0.995, avail * 0.995, frame.summaryPt * 100, _nullishCoalesce(_optionalChain([f, 'optionalAccess', _503 => _503.ratio]), () => ( 100)), "keep", { faceClass: faceClassForGen(frame.summaryFont), spacingPct: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _504 => _504.spacing]), () => ( 0)) }).lines;
|
|
27148
27209
|
return para(b, p, c);
|
|
27149
27210
|
});
|
|
27150
27211
|
const h = lines * Math.round(frame.summaryPt * 100 * 1.6) + 280 + 600;
|
|
@@ -27167,20 +27228,20 @@ function buildApprovalSeoul(labels, names, ctx) {
|
|
|
27167
27228
|
r: col === n - 1 ? "thick" : "thin"
|
|
27168
27229
|
});
|
|
27169
27230
|
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("");
|
|
27170
|
-
const sign = labels.map((_, c) => tc({ bf: edge(1, c), row: 1, col: c, w: colW, h: 4200, paras: para(_nullishCoalesce(_optionalChain([names, 'optionalAccess',
|
|
27231
|
+
const sign = labels.map((_, c) => tc({ bf: edge(1, c), row: 1, col: c, w: colW, h: 4200, paras: para(_nullishCoalesce(_optionalChain([names, 'optionalAccess', _505 => _505[c]]), () => ( "")), center, c12b) })).join("");
|
|
27171
27232
|
return host(ftbl([top, sign], w, 5965, n, { bottomGap: 600 }), reg.para({ align: "RIGHT", lineSp: 100 }), c12);
|
|
27172
27233
|
}
|
|
27173
27234
|
function buildReportCover(inp, ctx) {
|
|
27174
27235
|
const { reg, bf, frame } = ctx;
|
|
27175
27236
|
const out = [];
|
|
27176
27237
|
const cv = frame.cover;
|
|
27177
|
-
const c12 = reg.char({ font: _nullishCoalesce(_optionalChain([cv, 'optionalAccess',
|
|
27178
|
-
const c12b = reg.char({ font: _nullishCoalesce(_optionalChain([cv, 'optionalAccess',
|
|
27238
|
+
const c12 = reg.char({ font: _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _506 => _506.infoFont]), () => ( "\uD55C\uCEF4\uB3CB\uC6C0")), pt: _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _507 => _507.infoValuePt]), () => ( 12)) });
|
|
27239
|
+
const c12b = reg.char({ font: _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _508 => _508.infoFont]), () => ( "\uD55C\uCEF4\uB3CB\uC6C0")), pt: _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _509 => _509.infoLabelPt]), () => ( 12)), bold: true });
|
|
27179
27240
|
const cAppr = cv ? reg.char({ font: cv.infoFont, pt: cv.approvalPt }) : c12;
|
|
27180
27241
|
const center = reg.para({ align: "CENTER", lineSp: 100 });
|
|
27181
27242
|
const centerAt = (k) => cv ? reg.para({ align: "CENTER", lineSp: cv.lineSp[k] }) : center;
|
|
27182
27243
|
const blank2 = (pt3 = 15) => para("", reg.para({ align: "LEFT", lineSp: 160 }), reg.char({ font: "\uD55C\uCEF4\uB3CB\uC6C0", pt: pt3 }));
|
|
27183
|
-
const infoRows = [["\uBB38\uC11C\uBC88\uD638", _nullishCoalesce(_optionalChain([inp, 'access',
|
|
27244
|
+
const infoRows = [["\uBB38\uC11C\uBC88\uD638", _nullishCoalesce(_optionalChain([inp, 'access', _510 => _510.docInfo, 'optionalAccess', _511 => _511.docNum]), () => ( ""))], ["\uACB0\uC7AC\uC77C\uC790", _nullishCoalesce(_optionalChain([inp, 'access', _512 => _512.docInfo, 'optionalAccess', _513 => _513.date]), () => ( ""))], ["\uACF5\uAC1C\uC5EC\uBD80", _nullishCoalesce(_optionalChain([inp, 'access', _514 => _514.docInfo, 'optionalAccess', _515 => _515.disclosure]), () => ( ""))], ["\uBC29\uCE68\uBC88\uD638", _nullishCoalesce(_optionalChain([inp, 'access', _516 => _516.docInfo, 'optionalAccess', _517 => _517.policyNo]), () => ( ""))]];
|
|
27184
27245
|
const infoW = Math.round(ctx.W * 0.36);
|
|
27185
27246
|
const [lw, vw] = scale([4200, 12800], infoW);
|
|
27186
27247
|
const infoXml = ftbl(infoRows.map(
|
|
@@ -27199,7 +27260,7 @@ function buildReportCover(inp, ctx) {
|
|
|
27199
27260
|
for (let i = 0; i < 4; i++) out.push(blank2(20));
|
|
27200
27261
|
const w = ctx.W - 1200;
|
|
27201
27262
|
const bar = bf.get({ t: "none", b: "none", l: "none", r: "none", fill: cv ? { gradient: [...cv.bar.gradient], type: "LINEAR", angle: 90 } : "#1F2FD6" });
|
|
27202
|
-
const barH = _nullishCoalesce(_optionalChain([cv, 'optionalAccess',
|
|
27263
|
+
const barH = _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _518 => _518.bar, 'access', _519 => _519.h]), () => ( 200));
|
|
27203
27264
|
const fit = fitOneLine(inp.title, frame.titleFont, 27, w - 800, 22);
|
|
27204
27265
|
const cT = reg.char({ font: frame.titleFont, pt: fit.pt, bold: true, ratio: fit.ratio, spacing: fit.spacing });
|
|
27205
27266
|
const c1 = reg.char({ font: "\uD55C\uCEF4\uB3CB\uC6C0", pt: 1 });
|
|
@@ -27475,7 +27536,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
27475
27536
|
}
|
|
27476
27537
|
function assertFiniteRange(name, value, min, max) {
|
|
27477
27538
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
27478
|
-
throw new (0,
|
|
27539
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
27479
27540
|
}
|
|
27480
27541
|
}
|
|
27481
27542
|
function validateGongmunOptions(opts) {
|
|
@@ -27493,10 +27554,10 @@ function validateGongmunOptions(opts) {
|
|
|
27493
27554
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
27494
27555
|
}
|
|
27495
27556
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
27496
|
-
throw new (0,
|
|
27557
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
27497
27558
|
}
|
|
27498
27559
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
27499
|
-
throw new (0,
|
|
27560
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
27500
27561
|
}
|
|
27501
27562
|
}
|
|
27502
27563
|
if (opts.sizes) {
|
|
@@ -27505,24 +27566,24 @@ function validateGongmunOptions(opts) {
|
|
|
27505
27566
|
}
|
|
27506
27567
|
}
|
|
27507
27568
|
if (opts.approval && opts.approval.length > 6) {
|
|
27508
|
-
throw new (0,
|
|
27569
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("approval must contain at most 6 labels");
|
|
27509
27570
|
}
|
|
27510
27571
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
27511
27572
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
27512
27573
|
for (const n of nums) {
|
|
27513
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
27574
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkGUU7OHIHcjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
27514
27575
|
}
|
|
27515
27576
|
}
|
|
27516
27577
|
if (opts.levels) {
|
|
27517
27578
|
for (const [key, st] of Object.entries(opts.levels)) {
|
|
27518
27579
|
const depth = Number(key);
|
|
27519
27580
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
27520
|
-
throw new (0,
|
|
27581
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
27521
27582
|
}
|
|
27522
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
27583
|
+
if (!st || typeof st !== "object") throw new (0, _chunkGUU7OHIHcjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
27523
27584
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
27524
27585
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
27525
|
-
throw new (0,
|
|
27586
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
27526
27587
|
}
|
|
27527
27588
|
}
|
|
27528
27589
|
}
|
|
@@ -27534,7 +27595,7 @@ function resolveLevels(levels, bodyHeight) {
|
|
|
27534
27595
|
for (const [key, st] of Object.entries(levels)) {
|
|
27535
27596
|
if (st.font === void 0 && st.pt === void 0 && st.bold === void 0) continue;
|
|
27536
27597
|
out[Number(key)] = {
|
|
27537
|
-
font: _optionalChain([st, 'access',
|
|
27598
|
+
font: _optionalChain([st, 'access', _520 => _520.font, 'optionalAccess', _521 => _521.trim, 'call', _522 => _522()]) || null,
|
|
27538
27599
|
height: st.pt !== void 0 ? Math.round(st.pt * 100) : bodyHeight,
|
|
27539
27600
|
bold: !!st.bold
|
|
27540
27601
|
};
|
|
@@ -27542,7 +27603,7 @@ function resolveLevels(levels, bodyHeight) {
|
|
|
27542
27603
|
return Object.keys(out).length > 0 ? out : null;
|
|
27543
27604
|
}
|
|
27544
27605
|
function levelMarkerHeight(g3, depth) {
|
|
27545
|
-
return _nullishCoalesce(_optionalChain([g3, 'access',
|
|
27606
|
+
return _nullishCoalesce(_optionalChain([g3, 'access', _523 => _523.levels, 'optionalAccess', _524 => _524[depth], 'optionalAccess', _525 => _525.height]), () => ( g3.bodyHeight));
|
|
27546
27607
|
}
|
|
27547
27608
|
function incompatibleGongmunWarnings(opts) {
|
|
27548
27609
|
const warns = [];
|
|
@@ -27553,8 +27614,8 @@ function incompatibleGongmunWarnings(opts) {
|
|
|
27553
27614
|
if (opts.press && preset !== "press") warns.push(`press(\uBA38\uB9AC\uBC15\uC2A4\xB7\uBD80\uC81C\xB7\uB2F4\uB2F9)\uB294 \uBCF4\uB3C4\uC790\uB8CC(press) \uC804\uC6A9 \u2014 '${preset}' \uD504\uB9AC\uC14B\uC5D0\uC11C \uBB34\uC2DC\uB428`);
|
|
27554
27615
|
if (opts.checklist && !SEOUL_REPORT_PRESETS.has(preset)) warns.push(`checklist(\uC0AC\uC804 \uAC80\uD1A0\uD56D\uBAA9 \uC810\uAC80\uD45C)\uB294 \uBCF4\uACE0\uC11C\xB7\uACC4\uD68D\uC11C\xB7\uBC29\uCE68\uC11C \uC804\uC6A9 \u2014 '${preset}' \uD504\uB9AC\uC14B\uC5D0\uC11C \uBB34\uC2DC\uB428`);
|
|
27555
27616
|
warns.push(...agencyWarnings(opts, preset));
|
|
27556
|
-
const contact = _optionalChain([opts, 'access',
|
|
27557
|
-
if (_optionalChain([contact, 'optionalAccess',
|
|
27617
|
+
const contact = _optionalChain([opts, 'access', _526 => _526.press, 'optionalAccess', _527 => _527.contact]);
|
|
27618
|
+
if (_optionalChain([contact, 'optionalAccess', _528 => _528.people, 'optionalAccess', _529 => _529.length]) && (contact.manager || contact.phone)) warns.push("press.contact: people(\uC0AC\uB78C\uBCC4 \uD589)\uB97C \uC8FC\uBA74 manager\xB7phone(\uD55C \uD589 \uAF34)\uC740 \uBB34\uC2DC\uB428");
|
|
27558
27619
|
if (preset === "press" && (opts.cover === true || typeof opts.cover === "object" || opts.toc === true)) {
|
|
27559
27620
|
warns.push("\uBCF4\uB3C4\uC790\uB8CC\uB294 \uBA38\uB9AC\uBC15\uC2A4 \uC11C\uC2DD\uACFC \uC591\uB9BD \uBD88\uAC00\uB77C \uD45C\uC9C0\xB7\uBAA9\uCC28\uAC00 \uBB34\uC2DC\uB428");
|
|
27560
27621
|
}
|
|
@@ -27580,7 +27641,7 @@ function resolveChecklist(c, preset) {
|
|
|
27580
27641
|
function hexColorOption(name, value) {
|
|
27581
27642
|
if (value === void 0) return void 0;
|
|
27582
27643
|
const v = value.trim();
|
|
27583
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
27644
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkGUU7OHIHcjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
27584
27645
|
return v.toUpperCase();
|
|
27585
27646
|
}
|
|
27586
27647
|
function resolveGongmun(input) {
|
|
@@ -27611,7 +27672,7 @@ function resolveGongmun(input) {
|
|
|
27611
27672
|
bodyPtExplicit: opts.bodyPt !== void 0,
|
|
27612
27673
|
lineSpacingExplicit: opts.lineSpacing !== void 0,
|
|
27613
27674
|
bodyFontExplicit: opts.bodyFont !== void 0,
|
|
27614
|
-
summary: _optionalChain([opts, 'access',
|
|
27675
|
+
summary: _optionalChain([opts, 'access', _530 => _530.summary, 'optionalAccess', _531 => _531.trim, 'call', _532 => _532()]) || null,
|
|
27615
27676
|
docInfo: _nullishCoalesce(opts.docInfo, () => ( null)),
|
|
27616
27677
|
checklist: resolveChecklist(opts.checklist, preset),
|
|
27617
27678
|
toc: preset !== "press" && (_nullishCoalesce(opts.toc, () => ( (gaejosik || ministry)))),
|
|
@@ -27642,7 +27703,7 @@ function resolveGongmun(input) {
|
|
|
27642
27703
|
suppressSingle: _nullishCoalesce(opts.suppressSingle, () => ( false)),
|
|
27643
27704
|
docHead: preset === "official" && opts.docHead ? opts.docHead : null,
|
|
27644
27705
|
docFoot: preset === "official" && opts.docFoot ? opts.docFoot : null,
|
|
27645
|
-
reportInfo: _optionalChain([opts, 'access',
|
|
27706
|
+
reportInfo: _optionalChain([opts, 'access', _533 => _533.reportInfo, 'optionalAccess', _534 => _534.trim, 'call', _535 => _535()]) || null,
|
|
27646
27707
|
noticeHead: preset === "notice" && opts.noticeHead ? opts.noticeHead : null,
|
|
27647
27708
|
// 보도자료 머리박스는 프리셋 자체가 요구 — 옵션 미지정이어도 빈 객체
|
|
27648
27709
|
press: preset === "press" ? _nullishCoalesce(opts.press, () => ( {})) : null,
|
|
@@ -27970,7 +28031,7 @@ function parseInlineMarkdown(text) {
|
|
|
27970
28031
|
else spans.push(...emphasisSpans(m[0]));
|
|
27971
28032
|
} else {
|
|
27972
28033
|
const anchor = m[2] || m[3];
|
|
27973
|
-
const href = _nullishCoalesce(
|
|
28034
|
+
const href = _nullishCoalesce(_chunkGUU7OHIHcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
27974
28035
|
const sub = emphasisSpans(anchor);
|
|
27975
28036
|
if (href) for (const s of sub) s.href = href;
|
|
27976
28037
|
spans.push(...sub);
|
|
@@ -28136,8 +28197,8 @@ function resolvePage(opts) {
|
|
|
28136
28197
|
// 실측: 용지 치수는 방향과 무관하게 유지, 방향은 landscape 속성만 바뀐다
|
|
28137
28198
|
landscape: orientation === "landscape" ? "NARROWLY" : "WIDELY",
|
|
28138
28199
|
columns: cols,
|
|
28139
|
-
header: _optionalChain([header, 'optionalAccess',
|
|
28140
|
-
footer: _optionalChain([footer, 'optionalAccess',
|
|
28200
|
+
header: _optionalChain([header, 'optionalAccess', _536 => _536.trim, 'call', _537 => _537()]) ? header.trim() : null,
|
|
28201
|
+
footer: _optionalChain([footer, 'optionalAccess', _538 => _538.trim, 'call', _539 => _539()]) ? footer.trim() : null
|
|
28141
28202
|
};
|
|
28142
28203
|
}
|
|
28143
28204
|
function columnColPrXml(columns) {
|
|
@@ -28184,7 +28245,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
28184
28245
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
28185
28246
|
const got = m ? Number(m[1]) : NaN;
|
|
28186
28247
|
if (got !== startId + i) {
|
|
28187
|
-
throw new (0,
|
|
28248
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(
|
|
28188
28249
|
`\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)`
|
|
28189
28250
|
);
|
|
28190
28251
|
}
|
|
@@ -28275,7 +28336,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
28275
28336
|
}
|
|
28276
28337
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
28277
28338
|
if (rows.length !== expectedBase) {
|
|
28278
|
-
throw new (0,
|
|
28339
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(
|
|
28279
28340
|
`\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`
|
|
28280
28341
|
);
|
|
28281
28342
|
}
|
|
@@ -28502,7 +28563,7 @@ var TAB_PROPS_GONGMUN = `<hh:tabProperties itemCnt="2">
|
|
|
28502
28563
|
<hh:tabPr id="1" autoTabLeft="1" autoTabRight="0"/>
|
|
28503
28564
|
</hh:tabProperties>`;
|
|
28504
28565
|
function generateHeaderXml(theme, gongmun, ratioVariants = [], extraBorderFills = [], extraCharPrXmls = [], listIndentVariants = [], extraFonts = [], v5 = null) {
|
|
28505
|
-
const bodyFace = _nullishCoalesce(_nullishCoalesce(_optionalChain([v5, 'optionalAccess',
|
|
28566
|
+
const bodyFace = _nullishCoalesce(_nullishCoalesce(_optionalChain([v5, 'optionalAccess', _540 => _540.bodyFace]), () => ( _optionalChain([gongmun, 'optionalAccess', _541 => _541.fonts, 'access', _542 => _542.body]))), () => ( (_optionalChain([gongmun, 'optionalAccess', _543 => _543.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
|
|
28506
28567
|
const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants, extraCharPrXmls, !!v5);
|
|
28507
28568
|
const paraPropsXml = v5 ? buildParaPropertiesV5(gongmun, v5.paraPrXmls) : buildParaProperties(gongmun, gongmun ? listIndentVariants : []);
|
|
28508
28569
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
@@ -28631,8 +28692,8 @@ function parseChartFence(text) {
|
|
|
28631
28692
|
const spec = chartSpec(type);
|
|
28632
28693
|
let finalSeries = spec.pie ? [series[0]] : series;
|
|
28633
28694
|
finalSeries = finalSeries.map((s) => ({ ...s }));
|
|
28634
|
-
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
28635
|
-
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
28695
|
+
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _544 => _544.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
|
|
28696
|
+
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _545 => _545[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
|
|
28636
28697
|
if (!spec.scatter) {
|
|
28637
28698
|
finalSeries = finalSeries.map((s) => ({ ...s, values: catFinal.map((_, i) => _nullishCoalesce(s.values[i], () => ( 0))) }));
|
|
28638
28699
|
}
|
|
@@ -28674,7 +28735,7 @@ function serSpPr(color, stroke) {
|
|
|
28674
28735
|
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>`;
|
|
28675
28736
|
}
|
|
28676
28737
|
function dPtXml(pointColors, pie) {
|
|
28677
|
-
if (!_optionalChain([pointColors, 'optionalAccess',
|
|
28738
|
+
if (!_optionalChain([pointColors, 'optionalAccess', _546 => _546.length])) return "";
|
|
28678
28739
|
return pointColors.map((col, i) => {
|
|
28679
28740
|
const f = chartColorFill(col);
|
|
28680
28741
|
if (!f) return "";
|
|
@@ -28752,7 +28813,7 @@ function computeGongmunFitPlan(blocks, gongmun, gongmunList) {
|
|
|
28752
28813
|
if (block.type === "list_item" && gongmunList.items.has(i)) {
|
|
28753
28814
|
const { marker, depth, indentVariant } = gongmunList.items.get(i);
|
|
28754
28815
|
if (gongmun.numbering === "gaejosik" && (depth === 0 || (block.text || "").trimStart().startsWith("\u203B"))) continue;
|
|
28755
|
-
if (_optionalChain([gongmun, 'access',
|
|
28816
|
+
if (_optionalChain([gongmun, 'access', _547 => _547.levels, 'optionalAccess', _548 => _548[depth]])) continue;
|
|
28756
28817
|
const content = plainRenderText(block.text || "");
|
|
28757
28818
|
text = marker ? `${marker} ${content}` : content;
|
|
28758
28819
|
const li = levelIndent(depth, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, usesAsteriskThird(gongmun.preset));
|
|
@@ -28961,8 +29022,8 @@ function buildGaejosikCover(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH) {
|
|
|
28961
29022
|
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 });
|
|
28962
29023
|
const tbl2 = table([topRow, titleRow, botRow], g3.totalW, g3.barH + g3.titleH + g3.botBarH, 3, 1, bodyWidth);
|
|
28963
29024
|
const host2 = `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${tbl2}</hp:run></hp:p>`;
|
|
28964
|
-
const date = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
28965
|
-
const org = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
29025
|
+
const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _549 => _549.cover, 'optionalAccess', _550 => _550.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
|
|
29026
|
+
const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _551 => _551.cover, 'optionalAccess', _552 => _552.org]), () => ( ""));
|
|
28966
29027
|
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>`;
|
|
28967
29028
|
const subEmpty = emptyPara(GJ_PARA_COVER, false, GJ_CHAR_COVER_SUB);
|
|
28968
29029
|
return [
|
|
@@ -29021,13 +29082,13 @@ function coverMetaBlocks(blocks, h1, g3) {
|
|
|
29021
29082
|
const out = {};
|
|
29022
29083
|
if (h1 < 0 || !g3.cover || g3.cover.date !== null) return out;
|
|
29023
29084
|
const d = blocks[h1 + 1];
|
|
29024
|
-
const dateText = _optionalChain([d, 'optionalAccess',
|
|
29085
|
+
const dateText = _optionalChain([d, 'optionalAccess', _553 => _553.type]) === "list_item" && d.ordered && !d.indent ? `${d.marker} ${d.text}` : _optionalChain([d, 'optionalAccess', _554 => _554.type]) === "paragraph" ? d.text : "";
|
|
29025
29086
|
if (!COVER_DATE.test((_nullishCoalesce(dateText, () => ( ""))).trim())) return out;
|
|
29026
29087
|
out.date = h1 + 1;
|
|
29027
29088
|
out.dateText = dateText.trim();
|
|
29028
29089
|
const o = blocks[h1 + 2], after2 = blocks[h1 + 3];
|
|
29029
|
-
const t = (_nullishCoalesce(_optionalChain([o, 'optionalAccess',
|
|
29030
|
-
if (!g3.cover.org && _optionalChain([o, 'optionalAccess',
|
|
29090
|
+
const t = (_nullishCoalesce(_optionalChain([o, 'optionalAccess', _555 => _555.text]), () => ( ""))).trim();
|
|
29091
|
+
if (!g3.cover.org && _optionalChain([o, 'optionalAccess', _556 => _556.type]) === "paragraph" && t && !t.includes("\n") && [...t].length <= 40 && !/[.!?]$/.test(t) && (_optionalChain([after2, 'optionalAccess', _557 => _557.type]) === "blockquote" || _optionalChain([after2, 'optionalAccess', _558 => _558.type]) === "heading")) out.org = h1 + 2;
|
|
29031
29092
|
return out;
|
|
29032
29093
|
}
|
|
29033
29094
|
function planGaejosikSummary(blocks, g3, bodyWidth) {
|
|
@@ -29039,7 +29100,7 @@ function planGaejosikSummary(blocks, g3, bodyWidth) {
|
|
|
29039
29100
|
const meta = coverMetaBlocks(blocks, h1, g3);
|
|
29040
29101
|
const at = h1 + 1 + (meta.date !== void 0 ? 1 : 0) + (meta.org !== void 0 ? 1 : 0);
|
|
29041
29102
|
const next = h1 >= 0 ? blocks[at] : void 0;
|
|
29042
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
29103
|
+
if (_optionalChain([next, 'optionalAccess', _559 => _559.type]) === "blockquote" && _optionalChain([next, 'access', _560 => _560.text, 'optionalAccess', _561 => _561.trim, 'call', _562 => _562()])) {
|
|
29043
29104
|
text = next.text;
|
|
29044
29105
|
quoteIdx = at;
|
|
29045
29106
|
}
|
|
@@ -29051,7 +29112,7 @@ function planGaejosikSummary(blocks, g3, bodyWidth) {
|
|
|
29051
29112
|
const height = g3.bodyHeight;
|
|
29052
29113
|
const pt3 = height / 100;
|
|
29053
29114
|
const f = paras.length === 1 ? fitParagraph(stripInline(paras[0]), GJ_SUMMARY_FONT, pt3, avail, avail) : null;
|
|
29054
|
-
const ratio = _nullishCoalesce(_optionalChain([f, 'optionalAccess',
|
|
29115
|
+
const ratio = _nullishCoalesce(_optionalChain([f, 'optionalAccess', _563 => _563.ratio]), () => ( 100)), spacing = _nullishCoalesce(_optionalChain([f, 'optionalAccess', _564 => _564.spacing]), () => ( 0));
|
|
29055
29116
|
const faceClass = faceClassForGen(GJ_SUMMARY_FONT);
|
|
29056
29117
|
const lines = paras.reduce((n, p) => n + simulateWrap(stripInline(p), avail * 0.995, avail * 0.995, height, ratio, "keep", { faceClass, spacingPct: spacing }).lines, 0);
|
|
29057
29118
|
return { paras, quoteIdx, height, ratio, spacing, lines, width, warnings: summaryWarnings(paras.join("\n"), lines) };
|
|
@@ -29067,7 +29128,7 @@ function buildGaejosikSummary(plan, charPrId, bfReg, bodyWidth) {
|
|
|
29067
29128
|
var CHAPTER_FIT_PAD = 282 + 300;
|
|
29068
29129
|
function buildGaejosikChapter(n, title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH, srcLevel = 2) {
|
|
29069
29130
|
const g3 = gongmun ? chapterGeom(gongmun.bodyHeight, gongmun.sizes, bodyWidth) : chapterGeom(1500, {}, bodyWidth);
|
|
29070
|
-
const titleW = _optionalChain([gongmun, 'optionalAccess',
|
|
29131
|
+
const titleW = _optionalChain([gongmun, 'optionalAccess', _565 => _565.chapterFit]) ? Math.min(g3.titleW, Math.ceil(measureTextWidth(
|
|
29071
29132
|
` ${title} `,
|
|
29072
29133
|
gaejosikSizes(gongmun.bodyHeight, gongmun.sizes).chapter,
|
|
29073
29134
|
100,
|
|
@@ -29285,7 +29346,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
29285
29346
|
}
|
|
29286
29347
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
29287
29348
|
function sanitizeText(text) {
|
|
29288
|
-
let result =
|
|
29349
|
+
let result = _chunkEVPP2BSOcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
29289
29350
|
if (result.length <= 30 && result.includes(" ")) {
|
|
29290
29351
|
const tokens = result.split(" ");
|
|
29291
29352
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -29315,10 +29376,10 @@ function replicateGfmTable(table2) {
|
|
|
29315
29376
|
for (let r = 0; r < numRows; r++) {
|
|
29316
29377
|
for (let c = 0; c < numCols; c++) {
|
|
29317
29378
|
if (skip.has(`${r},${c}`)) continue;
|
|
29318
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
29379
|
+
const cell2 = _optionalChain([cells, 'access', _566 => _566[r], 'optionalAccess', _567 => _567[c]]);
|
|
29319
29380
|
if (!cell2) continue;
|
|
29320
29381
|
display[r][c] = {
|
|
29321
|
-
text:
|
|
29382
|
+
text: _chunkEVPP2BSOcjs.escapeGfm.call(void 0, sanitizeText(cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\r\n|\r|\n/g, "<br>"),
|
|
29322
29383
|
gridR: r,
|
|
29323
29384
|
gridC: c
|
|
29324
29385
|
};
|
|
@@ -29369,18 +29430,18 @@ function unescapeGfmCell(text) {
|
|
|
29369
29430
|
return text.replace(/(?<!\\)<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*_`#<$\\])/g, "$1");
|
|
29370
29431
|
}
|
|
29371
29432
|
function replicateCellInnerHtml(cell2) {
|
|
29372
|
-
if (_optionalChain([cell2, 'access',
|
|
29433
|
+
if (_optionalChain([cell2, 'access', _568 => _568.blocks, 'optionalAccess', _569 => _569.length])) {
|
|
29373
29434
|
return cell2.blocks.map((b) => {
|
|
29374
29435
|
if (b.type === "table" && b.table) {
|
|
29375
29436
|
const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
|
|
29376
|
-
return (cap ?
|
|
29437
|
+
return (cap ? _chunkEVPP2BSOcjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
29377
29438
|
}
|
|
29378
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
29439
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkGUU7OHIHcjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
29379
29440
|
const t = sanitizeText(_nullishCoalesce(b.text, () => ( "")));
|
|
29380
|
-
return t ?
|
|
29441
|
+
return t ? _chunkEVPP2BSOcjs.escapeHtmlCellText.call(void 0, t + _chunkEVPP2BSOcjs.noteSuffix.call(void 0, b)).replace(/\n/g, "<br>") : "";
|
|
29381
29442
|
}).filter(Boolean).join("<br>");
|
|
29382
29443
|
}
|
|
29383
|
-
return
|
|
29444
|
+
return _chunkEVPP2BSOcjs.escapeHtmlCellText.call(void 0, sanitizeText(cell2.text)).replace(/\n/g, "<br>");
|
|
29384
29445
|
}
|
|
29385
29446
|
function replicateTableToHtml(table2) {
|
|
29386
29447
|
const rows = replicateHtmlTable(table2);
|
|
@@ -29408,7 +29469,7 @@ function replicateHtmlTable(table2) {
|
|
|
29408
29469
|
const rowCells = [];
|
|
29409
29470
|
for (let c = 0; c < numCols; c++) {
|
|
29410
29471
|
if (skip.has(`${r},${c}`)) continue;
|
|
29411
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
29472
|
+
const cell2 = _optionalChain([cells, 'access', _570 => _570[r], 'optionalAccess', _571 => _571[c]]);
|
|
29412
29473
|
if (!cell2) continue;
|
|
29413
29474
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
29414
29475
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -29454,10 +29515,10 @@ function parseHtmlTable(raw) {
|
|
|
29454
29515
|
}
|
|
29455
29516
|
} else {
|
|
29456
29517
|
if (!isClose) {
|
|
29457
|
-
const cs = parseInt(_optionalChain([attrs, 'access',
|
|
29458
|
-
const rs = parseInt(_optionalChain([attrs, 'access',
|
|
29518
|
+
const cs = parseInt(_optionalChain([attrs, 'access', _572 => _572.match, 'call', _573 => _573(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _574 => _574[1]]) || "1", 10);
|
|
29519
|
+
const rs = parseInt(_optionalChain([attrs, 'access', _575 => _575.match, 'call', _576 => _576(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _577 => _577[1]]) || "1", 10);
|
|
29459
29520
|
cellStart = m.index + m[0].length;
|
|
29460
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
29521
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkEVPP2BSOcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkEVPP2BSOcjs.MAX_ROWS) };
|
|
29461
29522
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
29462
29523
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
29463
29524
|
cellStart = -1;
|
|
@@ -29481,12 +29542,12 @@ function htmlCellInnerToLines(inner) {
|
|
|
29481
29542
|
hadNonText = true;
|
|
29482
29543
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
29483
29544
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
29484
|
-
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess',
|
|
29485
|
-
if (src) imgSrcs.push(
|
|
29545
|
+
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _578 => _578[1]]), () => ( _optionalChain([m, 'optionalAccess', _579 => _579[2]])));
|
|
29546
|
+
if (src) imgSrcs.push(_chunkGUU7OHIHcjs.unescapeHtml.call(void 0, src));
|
|
29486
29547
|
return "";
|
|
29487
29548
|
});
|
|
29488
29549
|
}
|
|
29489
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
29550
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkGUU7OHIHcjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
29490
29551
|
return { lines, hadNonText, imgSrcs };
|
|
29491
29552
|
}
|
|
29492
29553
|
function splitCellByTopLevelTables(html) {
|
|
@@ -29643,7 +29704,7 @@ function edgeXml(tag, d) {
|
|
|
29643
29704
|
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"/>`;
|
|
29644
29705
|
}
|
|
29645
29706
|
function borderFillDefToXml(id, def) {
|
|
29646
|
-
const fill = _optionalChain([def, 'access',
|
|
29707
|
+
const fill = _optionalChain([def, 'access', _580 => _580.fill, 'optionalAccess', _581 => _581.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
|
|
29647
29708
|
return ` <hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0">
|
|
29648
29709
|
<hh:slash type="NONE" Crooked="0" isCounter="0"/>
|
|
29649
29710
|
<hh:backSlash type="NONE" Crooked="0" isCounter="0"/>
|
|
@@ -29914,7 +29975,7 @@ function probeImageSize(b) {
|
|
|
29914
29975
|
if (b[0] === 66 && b[1] === 77) {
|
|
29915
29976
|
return { w: dv.getUint32(18, true), h: Math.abs(dv.getInt32(22, true)) };
|
|
29916
29977
|
}
|
|
29917
|
-
} catch (
|
|
29978
|
+
} catch (e38) {
|
|
29918
29979
|
}
|
|
29919
29980
|
return null;
|
|
29920
29981
|
}
|
|
@@ -29966,13 +30027,13 @@ var ImageRegistry = (_class6 = class {
|
|
|
29966
30027
|
}
|
|
29967
30028
|
/** 실데이터 등록 — images 맵 바이트·data: URI. 포맷 미상(webp 등)은 null → placeholder 폴백 */
|
|
29968
30029
|
takeReal(url) {
|
|
29969
|
-
let bytes = _optionalChain([this, 'access',
|
|
30030
|
+
let bytes = _optionalChain([this, 'access', _582 => _582.supplied, 'optionalAccess', _583 => _583.get, 'call', _584 => _584(url)]);
|
|
29970
30031
|
if (!bytes && url.startsWith("data:")) {
|
|
29971
30032
|
const m = /^data:image\/[a-z+]+;base64,([A-Za-z0-9+/=\s]+)$/i.exec(url);
|
|
29972
30033
|
if (m) {
|
|
29973
30034
|
try {
|
|
29974
30035
|
bytes = new Uint8Array(Buffer.from(m[1].replace(/\s+/g, ""), "base64"));
|
|
29975
|
-
} catch (
|
|
30036
|
+
} catch (e39) {
|
|
29976
30037
|
}
|
|
29977
30038
|
}
|
|
29978
30039
|
}
|
|
@@ -30193,14 +30254,14 @@ function requiredTableWidth(rows, charHeight, faceClass = "hcr") {
|
|
|
30193
30254
|
return colMax.reduce((a, w) => a + Math.round((w + CELL_PAD) * colSlack(faceClass)), 0);
|
|
30194
30255
|
}
|
|
30195
30256
|
function generateTable(rows, theme, style = null, remap = null, seq = 0, images = null) {
|
|
30196
|
-
curFace = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
30257
|
+
curFace = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _585 => _585.faceClass]), () => ( "hcr"));
|
|
30197
30258
|
const rowCnt = rows.length;
|
|
30198
30259
|
const colCnt = Math.max(...rows.map((r) => r.length), 1);
|
|
30199
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
30260
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _586 => _586.bfRegistry]), () => ( null));
|
|
30200
30261
|
const totalW = style ? reg ? style.totalWidth - DATA_TABLE_INSET : style.totalWidth : 44e3;
|
|
30201
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
30262
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _587 => _587.charHeight]), () => ( 1e3));
|
|
30202
30263
|
const rowAnchor = normalizeRowAnchor((_nullishCoalesce(rows[0], () => ( []))).map((c) => c.replace(/!\[[^\]]*\]\([^)]*\)/g, "")));
|
|
30203
|
-
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access',
|
|
30264
|
+
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _588 => _588[0], 'optionalAccess', _589 => _589[0]]), () => ( ""))), seq, rowAnchor);
|
|
30204
30265
|
const colMax = Array(colCnt).fill(0);
|
|
30205
30266
|
const colMaxBody = Array(colCnt).fill(0);
|
|
30206
30267
|
const colMinWord = Array(colCnt).fill(0);
|
|
@@ -30231,7 +30292,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
30231
30292
|
const k = `${rowIdx},${colIdx}`;
|
|
30232
30293
|
const isLabelCell2 = labelCol0 && colIdx === 0;
|
|
30233
30294
|
const defaultCharPr = style ? reg && (isHeaderRow || isLabelCell2) ? style.boldCharPr : style.charPr : isHeaderRow ? headerCharPr : baseCharPr;
|
|
30234
|
-
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
30295
|
+
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _590 => _590.cellChar, 'access', _591 => _591.get, 'call', _592 => _592(k)]), () => ( defaultCharPr));
|
|
30235
30296
|
const centered = isHeaderRow || colCentered[colIdx];
|
|
30236
30297
|
const paraPrId = style ? centered ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
30237
30298
|
const p = cell2.split(/<br\s*\/?>/i).map((seg) => {
|
|
@@ -30249,11 +30310,11 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
30249
30310
|
}
|
|
30250
30311
|
}
|
|
30251
30312
|
}
|
|
30252
|
-
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess',
|
|
30313
|
+
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _593 => _593.cellChar, 'access', _594 => _594.has, 'call', _595 => _595(k)]) ? void 0 : mapId);
|
|
30253
30314
|
const body = (runs || (picRuns ? "" : `<hp:run charPrIDRef="${cellCharPr}"><hp:t></hp:t></hp:run>`)) + picRuns;
|
|
30254
30315
|
return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0">${body}</hp:p>`;
|
|
30255
30316
|
}).join("");
|
|
30256
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
30317
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _596 => _596.cellBf, 'access', _597 => _597.get, 'call', _598 => _598(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
30257
30318
|
row: rowIdx,
|
|
30258
30319
|
rowEnd: rowIdx,
|
|
30259
30320
|
col: colIdx,
|
|
@@ -30263,14 +30324,14 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
30263
30324
|
headerRows: 1,
|
|
30264
30325
|
fill: isHeaderRow ? _nullishCoalesce(style.headerFill, () => ( "#E6E6E6")) : isLabelCell2 ? _nullishCoalesce(style.labelFill, () => ( "#E7E7E7")) : void 0
|
|
30265
30326
|
})) : style && isHeaderRow ? style.headerBf : 2)));
|
|
30266
|
-
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
30327
|
+
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _599 => _599.cellH, 'access', _600 => _600.get, 'call', _601 => _601(k)]), () => ( cellH));
|
|
30267
30328
|
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>`;
|
|
30268
30329
|
}).join("");
|
|
30269
30330
|
return `<hp:tr>${tdElements}</hp:tr>`;
|
|
30270
30331
|
}).join("");
|
|
30271
30332
|
const tblW = colWidths.reduce((a, b) => a + b, 0);
|
|
30272
30333
|
const tblH = rowHeights.reduce((a, b) => a + b, 0);
|
|
30273
|
-
const hostPr = reg && _optionalChain([style, 'optionalAccess',
|
|
30334
|
+
const hostPr = reg && _optionalChain([style, 'optionalAccess', _602 => _602.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
|
|
30274
30335
|
const float = rowCnt >= 2;
|
|
30275
30336
|
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;
|
|
30276
30337
|
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>`;
|
|
@@ -30284,8 +30345,8 @@ function layoutHtmlRows(rows) {
|
|
|
30284
30345
|
let c = 0;
|
|
30285
30346
|
for (const cell2 of rows[r].cells) {
|
|
30286
30347
|
while (occupied.has(`${r},${c}`)) c++;
|
|
30287
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
30288
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
30348
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkEVPP2BSOcjs.MAX_COLS);
|
|
30349
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkEVPP2BSOcjs.MAX_ROWS);
|
|
30289
30350
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
30290
30351
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
30291
30352
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -30310,8 +30371,8 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
30310
30371
|
if (!rows || rows.length === 0) return null;
|
|
30311
30372
|
const { placed, rowCnt, colCnt } = layoutHtmlRows(rows);
|
|
30312
30373
|
if (rowCnt === 0 || colCnt === 0) return null;
|
|
30313
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
30314
|
-
curFace = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
30374
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _603 => _603.charHeight]), () => ( 1e3));
|
|
30375
|
+
curFace = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _604 => _604.faceClass]), () => ( "hcr"));
|
|
30315
30376
|
const first = _nullishCoalesce(placed.find((p) => p.r === 0 && p.c === 0), () => ( placed[0]));
|
|
30316
30377
|
const row0 = Array.from({ length: colCnt }, () => "");
|
|
30317
30378
|
for (const cell2 of placed) {
|
|
@@ -30343,7 +30404,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
30343
30404
|
const tblId = nextTableId();
|
|
30344
30405
|
const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
|
|
30345
30406
|
const spanW = (cell2) => colWidths.slice(cell2.c, cell2.c + cell2.colSpan).reduce((a, b) => a + b, 0);
|
|
30346
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
30407
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _605 => _605.bfRegistry]), () => ( null));
|
|
30347
30408
|
let htmlHeaderRows = 0;
|
|
30348
30409
|
while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
|
|
30349
30410
|
const tableRowHeights = Array(rowCnt).fill(cellH);
|
|
@@ -30357,7 +30418,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
30357
30418
|
const nestedW = Math.max(Math.min(Math.max(sw - 1020, 4e3), sw - 282), 500);
|
|
30358
30419
|
const nestedXml = generateHtmlTableXml(nested2, theme, nestedW, style ? { ...style, totalWidth: nestedW } : null, null, 0, null, true);
|
|
30359
30420
|
if (nestedXml) {
|
|
30360
|
-
const szH = _optionalChain([nestedXml, 'access',
|
|
30421
|
+
const szH = _optionalChain([nestedXml, 'access', _606 => _606.match, 'call', _607 => _607(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _608 => _608[1]]);
|
|
30361
30422
|
nestedH += (szH ? Number(szH) : (_nullishCoalesce(nested2.match(/<tr[\s>]/gi), () => ( []))).length * cellH) + 300;
|
|
30362
30423
|
}
|
|
30363
30424
|
return nestedXml;
|
|
@@ -30368,7 +30429,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
30368
30429
|
for (const line of lines) wrapLines += Math.max(1, Math.ceil(measureTextWidth(line.trim(), measureH, 100, { faceClass: curFace }) / usable));
|
|
30369
30430
|
const lineH = style ? Math.round(measureH * 1.6) : 800;
|
|
30370
30431
|
const contentH = Math.max(cellH * rowSpan, Math.max(wrapLines, 1) * lineH + nestedH);
|
|
30371
|
-
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
30432
|
+
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _609 => _609.cellH, 'access', _610 => _610.get, 'call', _611 => _611(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
|
|
30372
30433
|
const perRow = Math.ceil(cellHeight / rowSpan);
|
|
30373
30434
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
|
|
30374
30435
|
return { cell: cell2, rowSpan, lines, nestedXmls, segLines, imgSrcs: cellParsed[i].imgSrcs };
|
|
@@ -30379,7 +30440,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
30379
30440
|
const baseCharPr = style ? style.charPr : CHAR_NORMAL;
|
|
30380
30441
|
const headerCharPr = isHeader && useHeaderStyle ? CHAR_TABLE_HEADER : baseCharPr;
|
|
30381
30442
|
const defaultCharPr = style && reg && isHeader ? style.boldCharPr : isHeader ? headerCharPr : baseCharPr;
|
|
30382
|
-
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
30443
|
+
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _612 => _612.cellChar, 'access', _613 => _613.get, 'call', _614 => _614(k)]), () => ( defaultCharPr));
|
|
30383
30444
|
const centered = isHeader || colCentered[cell2.c];
|
|
30384
30445
|
const paraPrId = style ? centered ? reg ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : style.centerParaPr : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
30385
30446
|
const picUrls = images ? [...imgSrcs] : [];
|
|
@@ -30419,7 +30480,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
30419
30480
|
let cellHeight = 0;
|
|
30420
30481
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) cellHeight += tableRowHeights[r];
|
|
30421
30482
|
const rowEnd = cell2.r + rowSpan - 1;
|
|
30422
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
30483
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _615 => _615.cellBf, 'access', _616 => _616.get, 'call', _617 => _617(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
30423
30484
|
row: cell2.r,
|
|
30424
30485
|
rowEnd,
|
|
30425
30486
|
col: cell2.c,
|
|
@@ -30438,7 +30499,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
30438
30499
|
}
|
|
30439
30500
|
const tableH = tableRowHeights.reduce((sum, height) => sum + height, 0);
|
|
30440
30501
|
const float = !nested && rowCnt >= 2;
|
|
30441
|
-
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',
|
|
30502
|
+
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', _618 => _618.rightParaPr]) !== void 0) + tableOutMarginXml(float, measureH) + `<hp:inMargin left="510" right="510" top="141" bottom="141"/>` + trXmls.join("") + `</hp:tbl>`;
|
|
30442
30503
|
}
|
|
30443
30504
|
|
|
30444
30505
|
// src/hwpx/gen-docframe.ts
|
|
@@ -30531,8 +30592,8 @@ function buildPressPeople(dept, people, ids, w, reg) {
|
|
|
30531
30592
|
return tbl(rows, w, PRESS_PEOPLE_ROW_H * n, ws.length);
|
|
30532
30593
|
}
|
|
30533
30594
|
function buildPressContact(g3, ids, bodyWidth, reg) {
|
|
30534
|
-
const c = _optionalChain([g3, 'access',
|
|
30535
|
-
const people = (_nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
30595
|
+
const c = _optionalChain([g3, 'access', _619 => _619.press, 'optionalAccess', _620 => _620.contact]);
|
|
30596
|
+
const people = (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _621 => _621.people]), () => ( []))).filter((p) => p.role || p.title || p.name || p.phone);
|
|
30536
30597
|
if (!c || !c.dept && !c.manager && !c.phone && people.length === 0) return [];
|
|
30537
30598
|
const w = bodyWidth - 280;
|
|
30538
30599
|
if (people.length > 0) {
|
|
@@ -30914,10 +30975,10 @@ function generateSecPr(gongmun, page = null) {
|
|
|
30914
30975
|
m.header = gongmun.headerFooter;
|
|
30915
30976
|
m.footer = gongmun.headerFooter;
|
|
30916
30977
|
}
|
|
30917
|
-
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',
|
|
30918
|
-
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess',
|
|
30919
|
-
const hf = (_optionalChain([page, 'optionalAccess',
|
|
30920
|
-
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess',
|
|
30978
|
+
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', _622 => _622.landscape]), () => ( "WIDELY"))}" width="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _623 => _623.widthHU]), () => ( A4_W_HU))}" height="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _624 => _624.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>`;
|
|
30979
|
+
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess', _625 => _625.columns]), () => ( 1)));
|
|
30980
|
+
const hf = (_optionalChain([page, 'optionalAccess', _626 => _626.header]) ? headerFooterCtrl("header", page.header, 1) : "") + (_optionalChain([page, 'optionalAccess', _627 => _627.footer]) ? headerFooterCtrl("footer", page.footer, 2) : "");
|
|
30981
|
+
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess', _628 => _628.pageNumbers]) ? pageNumCtrl() : "");
|
|
30921
30982
|
}
|
|
30922
30983
|
var SectionOpener = (_class7 = class {
|
|
30923
30984
|
constructor(gongmun, page = null) {;_class7.prototype.__init16.call(this);
|
|
@@ -30960,16 +31021,16 @@ function buildPreamble(blocks, ctx) {
|
|
|
30960
31021
|
const preamble = [];
|
|
30961
31022
|
let hasFrontPages = false;
|
|
30962
31023
|
let bodyTitled = false;
|
|
30963
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
31024
|
+
if (_optionalChain([gongmun, 'optionalAccess', _629 => _629.reportInfo]) && dfIds) {
|
|
30964
31025
|
preamble.push(buildReportInfo(gongmun, dfIds));
|
|
30965
31026
|
}
|
|
30966
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
31027
|
+
if (_optionalChain([gongmun, 'optionalAccess', _630 => _630.approval]) && bfReg) {
|
|
30967
31028
|
preamble.push(buildApprovalTable(gongmun.approval, bfReg, richAssets ? GJ_CHAR_APPROVAL : GONGMUN_APPROVAL_CHAR));
|
|
30968
31029
|
}
|
|
30969
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
31030
|
+
if (_optionalChain([gongmun, 'optionalAccess', _631 => _631.noticeHead]) && dfIds) {
|
|
30970
31031
|
preamble.push(...buildNoticeHead(gongmun));
|
|
30971
31032
|
}
|
|
30972
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
31033
|
+
if (_optionalChain([gongmun, 'optionalAccess', _632 => _632.press]) && dfIds && bfReg && tableStyle) {
|
|
30973
31034
|
preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
30974
31035
|
}
|
|
30975
31036
|
if (gongmun && (gongmun.cover || gongmun.toc)) {
|
|
@@ -31012,7 +31073,7 @@ function buildPreamble(blocks, ctx) {
|
|
|
31012
31073
|
}
|
|
31013
31074
|
if (gongmun && !ctx.gaejosik && ctx.coverH1Idx < 0 && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
|
|
31014
31075
|
ctx.titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
31015
|
-
} else if (_optionalChain([gongmun, 'optionalAccess',
|
|
31076
|
+
} else if (_optionalChain([gongmun, 'optionalAccess', _633 => _633.press]) && ctx.coverH1Idx < 0 && dfIds) {
|
|
31016
31077
|
ctx.pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
31017
31078
|
}
|
|
31018
31079
|
if (preamble.length > 0) {
|
|
@@ -31037,7 +31098,7 @@ function renderHeading(block, blockIdx, ctx) {
|
|
|
31037
31098
|
if (gongmun && blockIdx === ctx.coverH1Idx) return "";
|
|
31038
31099
|
if (gongmun && blockIdx === ctx.pressH1Idx && dfIds) {
|
|
31039
31100
|
const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
|
|
31040
|
-
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
31101
|
+
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _634 => _634.press, 'optionalAccess', _635 => _635.sub]), () => ( []))) {
|
|
31041
31102
|
parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
|
|
31042
31103
|
}
|
|
31043
31104
|
return parts.join("\n ");
|
|
@@ -31144,8 +31205,8 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
31144
31205
|
const { gongmun, gongmunList, measured, fit, vBase, dfIds } = ctx;
|
|
31145
31206
|
if (gongmun && gongmunList) {
|
|
31146
31207
|
const info = gongmunList.items.get(blockIdx);
|
|
31147
|
-
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
31148
|
-
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
31208
|
+
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _636 => _636.depth]), () => ( 0));
|
|
31209
|
+
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _637 => _637.marker]), () => ( ""));
|
|
31149
31210
|
const content = block.text || "";
|
|
31150
31211
|
if (measured && content.trimStart().startsWith("\u203B")) {
|
|
31151
31212
|
return refParagraph(content.trim(), ctx);
|
|
@@ -31153,7 +31214,7 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
31153
31214
|
if (measured && block.marker === "*") {
|
|
31154
31215
|
return refParagraph(`* ${content.trim()}`, ctx);
|
|
31155
31216
|
}
|
|
31156
|
-
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess',
|
|
31217
|
+
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _638 => _638.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
|
|
31157
31218
|
let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
|
|
31158
31219
|
let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
|
|
31159
31220
|
if (measured && depth === 0 && gongmun.numbering !== "standard") {
|
|
@@ -31167,7 +31228,7 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
31167
31228
|
mapId = void 0;
|
|
31168
31229
|
}
|
|
31169
31230
|
}
|
|
31170
|
-
const lv = _optionalChain([ctx, 'access',
|
|
31231
|
+
const lv = _optionalChain([ctx, 'access', _639 => _639.levelIds, 'optionalAccess', _640 => _640[depth]]);
|
|
31171
31232
|
if (lv) {
|
|
31172
31233
|
listCharPr = lv.normal;
|
|
31173
31234
|
mapId = (id) => id === CHAR_BOLD ? lv.bold : id === CHAR_NORMAL ? lv.normal : id;
|
|
@@ -31218,15 +31279,15 @@ function renderHtmlTable(block, ctx) {
|
|
|
31218
31279
|
}
|
|
31219
31280
|
function appendPostamble(blocks, ctx) {
|
|
31220
31281
|
const { gongmun, dfIds, bfReg, tableStyle, paraXmls } = ctx;
|
|
31221
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
31282
|
+
if (_optionalChain([gongmun, 'optionalAccess', _641 => _641.noticeHead]) && dfIds) {
|
|
31222
31283
|
paraXmls.push(...buildNoticeFoot(gongmun));
|
|
31223
31284
|
}
|
|
31224
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
31225
|
-
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access',
|
|
31285
|
+
if (_optionalChain([gongmun, 'optionalAccess', _642 => _642.endMark]) && paraXmls.length > 0) {
|
|
31286
|
+
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _643 => _643.rows, 'optionalAccess', _644 => _644.length]));
|
|
31226
31287
|
const lastText = lastBlock && (lastBlock.type === "paragraph" || lastBlock.type === "list_item") ? lastBlock.text || "" : "";
|
|
31227
31288
|
if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
|
|
31228
31289
|
}
|
|
31229
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
31290
|
+
if (_optionalChain([gongmun, 'optionalAccess', _645 => _645.press]) && dfIds && bfReg && tableStyle) {
|
|
31230
31291
|
paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
31231
31292
|
}
|
|
31232
31293
|
}
|
|
@@ -31248,7 +31309,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
31248
31309
|
images,
|
|
31249
31310
|
levelIds,
|
|
31250
31311
|
gjSummary,
|
|
31251
|
-
gaejosik: _optionalChain([gongmun, 'optionalAccess',
|
|
31312
|
+
gaejosik: _optionalChain([gongmun, 'optionalAccess', _646 => _646.preset]) === "gaejosik",
|
|
31252
31313
|
measured,
|
|
31253
31314
|
richAssets,
|
|
31254
31315
|
vBase: charVariantBase(richAssets, !!gongmun),
|
|
@@ -31315,7 +31376,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
31315
31376
|
xml = renderEquation(block, blockIdx, ctx);
|
|
31316
31377
|
break;
|
|
31317
31378
|
case "blockquote":
|
|
31318
|
-
xml = blockIdx === _optionalChain([ctx, 'access',
|
|
31379
|
+
xml = blockIdx === _optionalChain([ctx, 'access', _647 => _647.gjSummary, 'optionalAccess', _648 => _648.plan, 'access', _649 => _649.quoteIdx]) ? "" : renderBlockquote(block, ctx);
|
|
31319
31380
|
break;
|
|
31320
31381
|
case "list_item":
|
|
31321
31382
|
xml = renderListItem(block, blockIdx, ctx);
|
|
@@ -31634,8 +31695,8 @@ function seoulLegalScheme(bodyFont = "\uAD74\uB9BC\uCCB4", bodyPt = 12, lineSp =
|
|
|
31634
31695
|
}
|
|
31635
31696
|
function applySchemeOverrides(s, g3) {
|
|
31636
31697
|
const out = { ...s, levels: s.levels.map((l) => ({ ...l })), body: { ...s.body }, ref: { ...s.ref }, table: { ...s.table } };
|
|
31637
|
-
if (_optionalChain([g3, 'access',
|
|
31638
|
-
if (_optionalChain([g3, 'access',
|
|
31698
|
+
if (_optionalChain([g3, 'access', _650 => _650.agency, 'optionalAccess', _651 => _651.refPt])) out.ref.pt = g3.agency.refPt;
|
|
31699
|
+
if (_optionalChain([g3, 'access', _652 => _652.agency, 'optionalAccess', _653 => _653.table])) {
|
|
31639
31700
|
if (g3.agency.table.pt) out.table.pt = g3.agency.table.pt;
|
|
31640
31701
|
out.table.headerFill = g3.agency.table.headerFill;
|
|
31641
31702
|
}
|
|
@@ -31786,7 +31847,7 @@ function buildOutline(blocks, opts) {
|
|
|
31786
31847
|
break;
|
|
31787
31848
|
}
|
|
31788
31849
|
if (lvl <= 2) {
|
|
31789
|
-
const label = _optionalChain([CHAPTER_LABEL_RE, 'access',
|
|
31850
|
+
const label = _optionalChain([CHAPTER_LABEL_RE, 'access', _654 => _654.exec, 'call', _655 => _655(raw), 'optionalAccess', _656 => _656[1]]);
|
|
31790
31851
|
nodes.push({ kind: "chapter", text: stripChapterNumber(raw) || raw, index: ++chapters, ...label ? { label } : {} });
|
|
31791
31852
|
lastExplicitDepth = -1;
|
|
31792
31853
|
listBase = -1;
|
|
@@ -32211,7 +32272,7 @@ function buildGongmunSectionV5(blocks, gongmun, deps, theme) {
|
|
|
32211
32272
|
warnings.push(...summaryWarnings(t, box.lines));
|
|
32212
32273
|
paras.push(box.xml);
|
|
32213
32274
|
};
|
|
32214
|
-
const docTitle = polishGongmunText(_nullishCoalesce(_nullishCoalesce(_optionalChain([g3, 'access',
|
|
32275
|
+
const docTitle = polishGongmunText(_nullishCoalesce(_nullishCoalesce(_optionalChain([g3, 'access', _657 => _657.docHead, 'optionalAccess', _658 => _658.title]), () => ( outline.title)), () => ( "")));
|
|
32215
32276
|
const reportInfo = g3.reportInfo && polishGongmunText(g3.reportInfo);
|
|
32216
32277
|
if (preset === "official") {
|
|
32217
32278
|
if (g3.docHead) paras.push(buildDocHeadTable({ ...g3.docHead, title: docTitle }, frame));
|
|
@@ -32301,7 +32362,7 @@ function buildGongmunSectionV5(blocks, gongmun, deps, theme) {
|
|
|
32301
32362
|
let pendingNewPageNum = isMinistry && (!!g3.cover || !!g3.toc);
|
|
32302
32363
|
let chapterStyle = g3.h2Marker === "box" || g3.h2Marker === "number" || g3.h2Marker === "none" || g3.h2Marker === "band" || g3.h2Marker === "square" ? g3.h2Marker : "roman";
|
|
32303
32364
|
if (!gaejosik) chapterStyle = "number";
|
|
32304
|
-
const leadLeft = (depth, pt3) => (_nullishCoalesce(_optionalChain([scheme, 'access',
|
|
32365
|
+
const leadLeft = (depth, pt3) => (_nullishCoalesce(_optionalChain([scheme, 'access', _659 => _659.levels, 'access', _660 => _660[Math.min(depth, 7)], 'optionalAccess', _661 => _661.leadTa]), () => ( 0))) * taHu(pt3);
|
|
32305
32366
|
const renderItem = (node, styleId = 0) => {
|
|
32306
32367
|
const depth = Math.min(node.depth, 7);
|
|
32307
32368
|
const sub = gaejosik && node.legalMarker;
|
|
@@ -32362,7 +32423,7 @@ function buildGongmunSectionV5(blocks, gongmun, deps, theme) {
|
|
|
32362
32423
|
const t = plain2(node.text);
|
|
32363
32424
|
const cb = fitCharBreaks(t, st.font, st.pt, textW2, textW2, _nullishCoalesce(g3.autoFitMinRatio, () => ( 101)), g3.autoFitSafety);
|
|
32364
32425
|
const f = _nullishCoalesce(cb, () => ( (g3.autoFitMinRatio !== null ? fitParagraph(t, st.font, st.pt, textW2, textW2, g3.autoFitMinRatio, void 0, g3.autoFitSafety) : null)));
|
|
32365
|
-
const base = { font: st.font, pt: st.pt, bold: st.bold, ratio: _nullishCoalesce(_optionalChain([f, 'optionalAccess',
|
|
32426
|
+
const base = { font: st.font, pt: st.pt, bold: st.bold, ratio: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _662 => _662.ratio]), () => ( 100)), spacing: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _663 => _663.spacing]), () => ( 0)) };
|
|
32366
32427
|
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 });
|
|
32367
32428
|
const markerRun = markerRunXml(marker, reg.char({ font: st.font, pt: st.pt, bold: st.bold }), lay);
|
|
32368
32429
|
return `<hp:p paraPrIDRef="${paraId}" styleIDRef="0">${markerRun}${generateRuns(node.text, reg.char(base), inlineMapper(reg, base))}</hp:p>`;
|
|
@@ -32611,7 +32672,7 @@ function buildGongmunSectionV5(blocks, gongmun, deps, theme) {
|
|
|
32611
32672
|
fax: f.fax,
|
|
32612
32673
|
email: f.email,
|
|
32613
32674
|
disclosure: f.disclosure
|
|
32614
|
-
}, frame, isInternalApproval(_optionalChain([g3, 'access',
|
|
32675
|
+
}, frame, isInternalApproval(_optionalChain([g3, 'access', _664 => _664.docHead, 'optionalAccess', _665 => _665.to]))));
|
|
32615
32676
|
}
|
|
32616
32677
|
if (paras.length === 0) paras.push(`<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0"><hp:t></hp:t></hp:run></hp:p>`);
|
|
32617
32678
|
paras[0] = paras[0].replace(/<hp:run charPrIDRef="(\d+)">/, `<hp:run charPrIDRef="$1">${generateSecPr(g3, page)}`);
|
|
@@ -32668,11 +32729,11 @@ function cleanPastedMarkdown(md2) {
|
|
|
32668
32729
|
|
|
32669
32730
|
// src/hwpx/generator.ts
|
|
32670
32731
|
async function markdownToHwpx(markdown, options) {
|
|
32671
|
-
const theme = resolveTheme(_optionalChain([options, 'optionalAccess',
|
|
32672
|
-
const gongmun = _optionalChain([options, 'optionalAccess',
|
|
32673
|
-
const page = resolvePage(_optionalChain([options, 'optionalAccess',
|
|
32732
|
+
const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _666 => _666.theme]));
|
|
32733
|
+
const gongmun = _optionalChain([options, 'optionalAccess', _667 => _667.gongmun]) ? resolveGongmun(options.gongmun) : null;
|
|
32734
|
+
const page = resolvePage(_optionalChain([options, 'optionalAccess', _668 => _668.page]));
|
|
32674
32735
|
const pasted = cleanPastedMarkdown(markdown);
|
|
32675
|
-
if (pasted.removed > 0) _optionalChain([options, 'optionalAccess',
|
|
32736
|
+
if (pasted.removed > 0) _optionalChain([options, 'optionalAccess', _669 => _669.warnings, 'optionalAccess', _670 => _670.push, 'call', _671 => _671(`\uBD99\uC5EC\uB123\uAE30 \uD754\uC801 ${pasted.removed}\uAC1C \uC815\uB9AC (\uBCF4\uC774\uC9C0 \uC54A\uB294 \uAE00\uC790\xB7\uC778\uC6A9 \uD45C\uC2DC\xB7\uC774\uC2A4\uCF00\uC774\uD504\uB41C \uAD75\uAC8C)`)]);
|
|
32676
32737
|
const { md: md2, defs } = extractFootnoteDefs(pasted.md);
|
|
32677
32738
|
beginInlineDoc(defs);
|
|
32678
32739
|
try {
|
|
@@ -32681,14 +32742,14 @@ async function markdownToHwpx(markdown, options) {
|
|
|
32681
32742
|
const staticBfEnd2 = staticBorderFillNext(gongmun, true);
|
|
32682
32743
|
const charBase = charVariantBase(false, true);
|
|
32683
32744
|
const fontBase = staticFontNext(gongmun, true);
|
|
32684
|
-
const remap2 = _optionalChain([options, 'optionalAccess',
|
|
32685
|
-
const bfReg2 = new TableBfRegistry(staticBfEnd2 + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
32686
|
-
const reg = new StyleRegistry(charBase + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
32745
|
+
const remap2 = _optionalChain([options, 'optionalAccess', _672 => _672.profile]) ? buildProfileRemap(options.profile, charBase, staticBfEnd2, fontBase) : null;
|
|
32746
|
+
const bfReg2 = new TableBfRegistry(staticBfEnd2 + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _673 => _673.borderFillXmls, 'access', _674 => _674.length]), () => ( 0))));
|
|
32747
|
+
const reg = new StyleRegistry(charBase + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _675 => _675.charPrXmls, 'access', _676 => _676.length]), () => ( 0))), 8, fontBase + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _677 => _677.fontFaces, 'access', _678 => _678.length]), () => ( 0))), ["\uD568\uCD08\uB86C\uBC14\uD0D5", "\uD568\uCD08\uB86C\uB3CB\uC6C0", "HY\uACAC\uACE0\uB515"]);
|
|
32687
32748
|
const chartParts2 = [];
|
|
32688
|
-
const supplied2 = _optionalChain([options, 'optionalAccess',
|
|
32749
|
+
const supplied2 = _optionalChain([options, 'optionalAccess', _679 => _679.images]) ? new Map(Object.entries(options.images).map(([k, v]) => [k, v instanceof Uint8Array ? v : new Uint8Array(v)])) : void 0;
|
|
32689
32750
|
const images2 = new ImageRegistry(supplied2);
|
|
32690
32751
|
const res = buildGongmunSectionV5(blocks2, gongmun, { reg, bfReg: bfReg2, remap: remap2, images: images2, page, chartParts: chartParts2 }, theme);
|
|
32691
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
32752
|
+
if (_optionalChain([options, 'optionalAccess', _680 => _680.warnings])) options.warnings.push(...res.warnings);
|
|
32692
32753
|
if (remap2 && remap2.tables.length > 0 && remap2.tables.every((t) => !t.used)) {
|
|
32693
32754
|
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)`);
|
|
32694
32755
|
}
|
|
@@ -32701,10 +32762,10 @@ async function markdownToHwpx(markdown, options) {
|
|
|
32701
32762
|
theme,
|
|
32702
32763
|
gongmun,
|
|
32703
32764
|
[],
|
|
32704
|
-
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
32705
|
-
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
32765
|
+
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _681 => _681.borderFillXmls]), () => ( [])), ...bfReg2.emit()],
|
|
32766
|
+
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _682 => _682.charPrXmls]), () => ( [])), ...reg.charPrXmls],
|
|
32706
32767
|
[],
|
|
32707
|
-
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
32768
|
+
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _683 => _683.fontFaces]), () => ( [])), ...reg.extraFonts],
|
|
32708
32769
|
{ paraPrXmls: reg.paraPrXmls, bodyFace: "\uD568\uCD08\uB86C\uBC14\uD0D5" }
|
|
32709
32770
|
));
|
|
32710
32771
|
zip2.file("Contents/section0.xml", res.xml);
|
|
@@ -32716,29 +32777,29 @@ async function markdownToHwpx(markdown, options) {
|
|
|
32716
32777
|
const richAssets = !!gongmun && needsGaejosikAssets(gongmun);
|
|
32717
32778
|
const blocks = gongmun ? parseMarkdownToBlocks(md2).map(polishGongmunBlock) : parseMarkdownToBlocks(md2);
|
|
32718
32779
|
const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
|
|
32719
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
32720
|
-
_optionalChain([options, 'optionalAccess',
|
|
32780
|
+
if (_optionalChain([gongmun, 'optionalAccess', _684 => _684.agency, 'optionalAccess', _685 => _685.pressStyle]) === "para" && gongmunList && [...gongmunList.items.values()].some((it) => it.depth === 0)) {
|
|
32781
|
+
_optionalChain([options, 'optionalAccess', _686 => _686.warnings, 'optionalAccess', _687 => _687.push, 'call', _688 => _688(`agency: ${gongmun.agency.name} \uBCF4\uB3C4\uC790\uB8CC \uBCF8\uBB38\uC740 \uBB38\uB2E8\uC2DD(\uAE30\uD638 \uC5C6\uB294 \uAE30\uC0AC\uCCB4 \uBB38\uB2E8)\uC774 \uC8FC\uB41C \uBC29\uC2DD \u2014 \u25A1 \uD56D\uBAA9 \uB300\uC2E0 \uBB38\uB2E8\uC73C\uB85C \uC4F0\uB294 \uAC83\uC744 \uAC80\uD1A0\uD558\uC138\uC694`)]);
|
|
32721
32782
|
}
|
|
32722
32783
|
const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
|
|
32723
32784
|
const staticBfEnd = staticBorderFillNext(gongmun);
|
|
32724
|
-
const remap = _optionalChain([options, 'optionalAccess',
|
|
32725
|
-
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
32785
|
+
const remap = _optionalChain([options, 'optionalAccess', _689 => _689.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _690 => _690.variants, 'optionalAccess', _691 => _691.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
|
|
32786
|
+
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _692 => _692.borderFillXmls, 'access', _693 => _693.length]), () => ( 0)))) : null;
|
|
32726
32787
|
const dfActive = !!gongmun && docframeActive(gongmun);
|
|
32727
|
-
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
32788
|
+
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _694 => _694.variants, 'optionalAccess', _695 => _695.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _696 => _696.charPrXmls, 'access', _697 => _697.length]), () => ( 0)));
|
|
32728
32789
|
const dfIds = dfActive ? docframeIds(dfBase) : null;
|
|
32729
32790
|
const dfXmls = dfActive ? docframeCharPrXmls(dfBase, richAssets) : [];
|
|
32730
32791
|
const lvBase = dfBase + dfXmls.length;
|
|
32731
32792
|
const lvIds = gongmun ? levelCharIds(gongmun, lvBase) : null;
|
|
32732
32793
|
const lvFonts = gongmun ? levelFontFaces(gongmun) : [];
|
|
32733
|
-
const lvXmls = gongmun ? levelCharPrXmls(gongmun, lvBase, staticFontNext(gongmun) + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
32794
|
+
const lvXmls = gongmun ? levelCharPrXmls(gongmun, lvBase, staticFontNext(gongmun) + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _698 => _698.fontFaces, 'access', _699 => _699.length]), () => ( 0))), richAssets ? 4 : 0) : [];
|
|
32734
32795
|
const sumPlan = gongmun ? planGaejosikSummary(blocks, gongmun, gaejosikBodyWidth(gongmun.margins)) : null;
|
|
32735
32796
|
const sumFonts = sumPlan && !lvFonts.includes(GJ_SUMMARY_FONT) ? [GJ_SUMMARY_FONT] : [];
|
|
32736
|
-
const sumFontId = staticFontNext(gongmun) + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
32797
|
+
const sumFontId = staticFontNext(gongmun) + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _700 => _700.fontFaces, 'access', _701 => _701.length]), () => ( 0))) + [...lvFonts, ...sumFonts].indexOf(GJ_SUMMARY_FONT);
|
|
32737
32798
|
const sumXmls = sumPlan ? [charPr(lvBase + lvXmls.length, sumPlan.height, true, false, sumFontId, void 0, sumPlan.ratio, sumFontId, sumPlan.spacing)] : [];
|
|
32738
32799
|
const gjSummary = sumPlan ? { plan: sumPlan, charPrId: lvBase + lvXmls.length } : null;
|
|
32739
|
-
if (sumPlan) _optionalChain([options, 'optionalAccess',
|
|
32800
|
+
if (sumPlan) _optionalChain([options, 'optionalAccess', _702 => _702.warnings, 'optionalAccess', _703 => _703.push, 'call', _704 => _704(...sumPlan.warnings)]);
|
|
32740
32801
|
const chartParts = [];
|
|
32741
|
-
const supplied = _optionalChain([options, 'optionalAccess',
|
|
32802
|
+
const supplied = _optionalChain([options, 'optionalAccess', _705 => _705.images]) ? new Map(Object.entries(options.images).map(([k, v]) => [k, v instanceof Uint8Array ? v : new Uint8Array(v)])) : void 0;
|
|
32742
32803
|
const images = new ImageRegistry(supplied);
|
|
32743
32804
|
const sectionXml = blocksToSectionXml(blocks, theme, gongmun, gongmunList, fit, chartParts, bfReg, remap, dfIds, images, page, lvIds, gjSummary);
|
|
32744
32805
|
if (remap && remap.tables.length > 0) {
|
|
@@ -32747,7 +32808,7 @@ async function markdownToHwpx(markdown, options) {
|
|
|
32747
32808
|
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)`);
|
|
32748
32809
|
}
|
|
32749
32810
|
}
|
|
32750
|
-
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
32811
|
+
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _706 => _706.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _707 => _707.emit, 'call', _708 => _708()]), () => ( []))];
|
|
32751
32812
|
const zip = new (0, _jszip2.default)();
|
|
32752
32813
|
zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
|
|
32753
32814
|
zip.file("META-INF/container.xml", generateContainerXml());
|
|
@@ -32756,11 +32817,11 @@ async function markdownToHwpx(markdown, options) {
|
|
|
32756
32817
|
zip.file("Contents/header.xml", generateHeaderXml(
|
|
32757
32818
|
theme,
|
|
32758
32819
|
gongmun,
|
|
32759
|
-
_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
32820
|
+
_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _709 => _709.variants]), () => ( [])),
|
|
32760
32821
|
extraBorderFills,
|
|
32761
|
-
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
32762
|
-
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess',
|
|
32763
|
-
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
32822
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _710 => _710.charPrXmls]), () => ( [])), ...dfXmls, ...lvXmls, ...sumXmls],
|
|
32823
|
+
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _711 => _711.indentVariants]), () => ( [])),
|
|
32824
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _712 => _712.fontFaces]), () => ( [])), ...lvFonts, ...sumFonts]
|
|
32764
32825
|
));
|
|
32765
32826
|
zip.file("Contents/section0.xml", sectionXml);
|
|
32766
32827
|
for (const part of chartParts) zip.file(part.name, part.xml);
|
|
@@ -32813,7 +32874,7 @@ function diffBlocks(blocksA, blocksB) {
|
|
|
32813
32874
|
function alignBlocks(a, b) {
|
|
32814
32875
|
const m = a.length, n = b.length;
|
|
32815
32876
|
if (m * n > 1e7) return fallbackAlign(a, b);
|
|
32816
|
-
const textOf = (blk) => blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
32877
|
+
const textOf = (blk) => blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _713 => _713.text]), () => ( ""))).join(" ") : "";
|
|
32817
32878
|
const pa = a.map((blk) => textProfile(textOf(blk)));
|
|
32818
32879
|
const pb = b.map((blk) => textProfile(textOf(blk)));
|
|
32819
32880
|
const passCache = new Uint8Array(m * n);
|
|
@@ -32894,8 +32955,8 @@ function tableDimSim(a, b) {
|
|
|
32894
32955
|
}
|
|
32895
32956
|
function tableSimilarity(a, b) {
|
|
32896
32957
|
const dimSim = tableDimSim(a, b);
|
|
32897
|
-
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
32898
|
-
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
32958
|
+
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _714 => _714.text]), () => ( ""))).join(" ");
|
|
32959
|
+
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _715 => _715.text]), () => ( ""))).join(" ");
|
|
32899
32960
|
const contentSim = normalizedSimilarity(textsA, textsB);
|
|
32900
32961
|
return dimSim * 0.3 + contentSim * 0.7;
|
|
32901
32962
|
}
|
|
@@ -32906,8 +32967,8 @@ function diffTableCells(a, b) {
|
|
|
32906
32967
|
for (let r = 0; r < maxRows; r++) {
|
|
32907
32968
|
const row = [];
|
|
32908
32969
|
for (let c = 0; c < maxCols; c++) {
|
|
32909
|
-
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access',
|
|
32910
|
-
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access',
|
|
32970
|
+
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access', _716 => _716.cells, 'access', _717 => _717[r], 'optionalAccess', _718 => _718[c], 'optionalAccess', _719 => _719.text]) : void 0;
|
|
32971
|
+
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access', _720 => _720.cells, 'access', _721 => _721[r], 'optionalAccess', _722 => _722[c], 'optionalAccess', _723 => _723.text]) : void 0;
|
|
32911
32972
|
let type;
|
|
32912
32973
|
if (cellA === void 0) type = "added";
|
|
32913
32974
|
else if (cellB === void 0) type = "removed";
|
|
@@ -32957,7 +33018,7 @@ function builtinTemplateDir() {
|
|
|
32957
33018
|
for (const c of candidates) {
|
|
32958
33019
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
32959
33020
|
}
|
|
32960
|
-
throw new (0,
|
|
33021
|
+
throw new (0, _chunkGUU7OHIHcjs.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)");
|
|
32961
33022
|
}
|
|
32962
33023
|
function readBuiltinTemplate(t) {
|
|
32963
33024
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -33122,7 +33183,7 @@ function parseRenderStyles(headXml) {
|
|
|
33122
33183
|
const underlineEl = findChildByLocalName(el, "underline");
|
|
33123
33184
|
const textColor = el.getAttribute("textColor");
|
|
33124
33185
|
const fontRef = findChildByLocalName(el, "fontRef");
|
|
33125
|
-
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess',
|
|
33186
|
+
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _724 => _724.getAttribute, 'call', _725 => _725("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _726 => _726.getAttribute, 'call', _727 => _727("latin")])));
|
|
33126
33187
|
const face = fontId != null ? hangulFonts.get(fontId) : void 0;
|
|
33127
33188
|
styles.charPr.set(id, {
|
|
33128
33189
|
height: Number(el.getAttribute("height")) || 1e3,
|
|
@@ -33130,8 +33191,8 @@ function parseRenderStyles(headXml) {
|
|
|
33130
33191
|
italic: findChildByLocalName(el, "italic") != null,
|
|
33131
33192
|
underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
|
|
33132
33193
|
color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
|
|
33133
|
-
ratio: Number(_optionalChain([ratioEl, 'optionalAccess',
|
|
33134
|
-
spacing: Number(_optionalChain([spacingEl, 'optionalAccess',
|
|
33194
|
+
ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _728 => _728.getAttribute, 'call', _729 => _729("hangul")])) || 100,
|
|
33195
|
+
spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _730 => _730.getAttribute, 'call', _731 => _731("hangul")])) || 0,
|
|
33135
33196
|
fontFamily: face ? hwpFaceToCssStack(face) : void 0,
|
|
33136
33197
|
face
|
|
33137
33198
|
});
|
|
@@ -33143,7 +33204,7 @@ function parseRenderStyles(headXml) {
|
|
|
33143
33204
|
const id = el.getAttribute("id");
|
|
33144
33205
|
if (id != null) {
|
|
33145
33206
|
const align = findChildByLocalName(el, "align");
|
|
33146
|
-
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess',
|
|
33207
|
+
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _732 => _732.getAttribute, 'call', _733 => _733("horizontal")]) || "JUSTIFY");
|
|
33147
33208
|
styles.paraGeom.set(id, parseParaGeom(el));
|
|
33148
33209
|
const tab = el.getAttribute("tabPrIDRef");
|
|
33149
33210
|
if (tab != null) paraTabRef.set(id, tab);
|
|
@@ -33159,7 +33220,7 @@ function parseRenderStyles(headXml) {
|
|
|
33159
33220
|
};
|
|
33160
33221
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
33161
33222
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
33162
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
33223
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _734 => _734.getAttribute, 'call', _735 => _735("faceColor")]);
|
|
33163
33224
|
if (face && face.toLowerCase() !== "none") bf.fill = face;
|
|
33164
33225
|
styles.borderFill.set(id, bf);
|
|
33165
33226
|
}
|
|
@@ -33235,7 +33296,7 @@ function collectSites(scan) {
|
|
|
33235
33296
|
}
|
|
33236
33297
|
function attrOf3(openTag, name) {
|
|
33237
33298
|
const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
|
|
33238
|
-
return _optionalChain([m, 'optionalAccess',
|
|
33299
|
+
return _optionalChain([m, 'optionalAccess', _736 => _736[1]]);
|
|
33239
33300
|
}
|
|
33240
33301
|
function paraOpenTag(xml, para2) {
|
|
33241
33302
|
const end = xml.indexOf(">", para2.start);
|
|
@@ -33250,7 +33311,7 @@ function anchorRunInfo(xml, para2, anchor) {
|
|
|
33250
33311
|
if (!tr) return null;
|
|
33251
33312
|
const before2 = xml.slice(Math.max(0, para2.start), tr.contentStart);
|
|
33252
33313
|
const runOpen = [...before2.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
|
|
33253
|
-
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess',
|
|
33314
|
+
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _737 => _737[1]]), () => ( tr.prefix)), () => ( "hp"));
|
|
33254
33315
|
const charPr2 = runOpen && attrOf3(runOpen[0], "charPrIDRef") || "0";
|
|
33255
33316
|
const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
|
|
33256
33317
|
if (close === -1) return null;
|
|
@@ -33277,7 +33338,7 @@ function cellContentWidthMm(xml, cell2) {
|
|
|
33277
33338
|
if (width === null) return null;
|
|
33278
33339
|
let content = width;
|
|
33279
33340
|
const win = cellAddrWindow(xml, cell2);
|
|
33280
|
-
const mg = _optionalChain([win, 'optionalAccess',
|
|
33341
|
+
const mg = _optionalChain([win, 'optionalAccess', _738 => _738.match, 'call', _739 => _739(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
|
|
33281
33342
|
if (mg) {
|
|
33282
33343
|
content -= Number(_nullishCoalesce(attrOf3(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf3(mg[0], "right"), () => ( 0)));
|
|
33283
33344
|
}
|
|
@@ -33311,12 +33372,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
33311
33372
|
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>`;
|
|
33312
33373
|
}
|
|
33313
33374
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
33314
|
-
if (ops.length === 0) throw new (0,
|
|
33375
|
+
if (ops.length === 0) throw new (0, _chunkGUU7OHIHcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
33315
33376
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
33316
|
-
|
|
33377
|
+
_chunkGUU7OHIHcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
33317
33378
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
33318
|
-
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access',
|
|
33319
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
33379
|
+
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _740 => _740.match, 'call', _741 => _741(/(\d+)\.xml$/i), 'optionalAccess', _742 => _742[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _743 => _743.match, 'call', _744 => _744(/(\d+)\.xml$/i), 'optionalAccess', _745 => _745[1]]), () => ( 0))));
|
|
33380
|
+
if (sectionPaths.length === 0) throw new (0, _chunkGUU7OHIHcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
33320
33381
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
33321
33382
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
33322
33383
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -33357,11 +33418,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
33357
33418
|
const manifestItems = [];
|
|
33358
33419
|
const placed = [];
|
|
33359
33420
|
for (const op of ops) {
|
|
33360
|
-
if (!op.anchor) throw new (0,
|
|
33361
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
33421
|
+
if (!op.anchor) throw new (0, _chunkGUU7OHIHcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
33422
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkGUU7OHIHcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
33362
33423
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
33363
|
-
if (!MIME[ext]) throw new (0,
|
|
33364
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
33424
|
+
if (!MIME[ext]) throw new (0, _chunkGUU7OHIHcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
33425
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkGUU7OHIHcjs.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)`);
|
|
33365
33426
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
33366
33427
|
let found = null;
|
|
33367
33428
|
let total = 0;
|
|
@@ -33394,7 +33455,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
33394
33455
|
}
|
|
33395
33456
|
}
|
|
33396
33457
|
}
|
|
33397
|
-
throw new (0,
|
|
33458
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(
|
|
33398
33459
|
`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)})`
|
|
33399
33460
|
);
|
|
33400
33461
|
}
|
|
@@ -33402,9 +33463,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
33402
33463
|
const xml = sectionXmls[si];
|
|
33403
33464
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
33404
33465
|
if (!run) {
|
|
33405
|
-
throw new (0,
|
|
33466
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
33406
33467
|
}
|
|
33407
|
-
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess',
|
|
33468
|
+
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _746 => _746.charPr, 'access', _747 => _747.get, 'call', _748 => _748(run.charPr), 'optionalAccess', _749 => _749.height]), () => ( 1e3));
|
|
33408
33469
|
const fontPt = charPrHeight / 100;
|
|
33409
33470
|
const emMm = fontPt * 25.4 / 72;
|
|
33410
33471
|
const lineHMm = emMm;
|
|
@@ -33413,7 +33474,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
33413
33474
|
const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
|
|
33414
33475
|
const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
|
|
33415
33476
|
const paraPrId = _nullishCoalesce(attrOf3(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
|
|
33416
|
-
const align = _optionalChain([styles, 'optionalAccess',
|
|
33477
|
+
const align = _optionalChain([styles, 'optionalAccess', _750 => _750.paraAlign, 'access', _751 => _751.get, 'call', _752 => _752(paraPrId)]);
|
|
33417
33478
|
let alignShiftMm = 0;
|
|
33418
33479
|
if (align === "CENTER" || align === "RIGHT") {
|
|
33419
33480
|
const paraWMm = measureMm(site.para.text, emMm);
|
|
@@ -33509,7 +33570,7 @@ function parseBorderFills(headerDoc) {
|
|
|
33509
33570
|
};
|
|
33510
33571
|
const fillBrush = findChildByLocalName(bf, "fillBrush");
|
|
33511
33572
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
33512
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
33573
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _753 => _753.getAttribute, 'call', _754 => _754("faceColor")]);
|
|
33513
33574
|
if (face && face !== "none") def.fill = { faceColor: face };
|
|
33514
33575
|
map.set(id, def);
|
|
33515
33576
|
}
|
|
@@ -33539,9 +33600,9 @@ function parseCharPrs(headerDoc, hangulFonts) {
|
|
|
33539
33600
|
if (color) def.textColor = color;
|
|
33540
33601
|
if (cp.getAttribute("bold") === "1") def.bold = true;
|
|
33541
33602
|
if (cp.getAttribute("italic") === "1") def.italic = true;
|
|
33542
|
-
if (_optionalChain([findChildByLocalName, 'call',
|
|
33603
|
+
if (_optionalChain([findChildByLocalName, 'call', _755 => _755(cp, "underline"), 'optionalAccess', _756 => _756.getAttribute, 'call', _757 => _757("type")]) === "BOTTOM") def.underline = true;
|
|
33543
33604
|
const fontRef = findChildByLocalName(cp, "fontRef");
|
|
33544
|
-
const hangul = _optionalChain([fontRef, 'optionalAccess',
|
|
33605
|
+
const hangul = _optionalChain([fontRef, 'optionalAccess', _758 => _758.getAttribute, 'call', _759 => _759("hangul")]);
|
|
33545
33606
|
if (hangul) {
|
|
33546
33607
|
def.fontRef_hangul = hangul;
|
|
33547
33608
|
const face = hangulFonts.get(hangul);
|
|
@@ -33569,7 +33630,7 @@ function parseTable4(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
33569
33630
|
const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
|
|
33570
33631
|
const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
|
|
33571
33632
|
const sz = findChildByLocalName(tbl2, "sz");
|
|
33572
|
-
const width = _optionalChain([sz, 'optionalAccess',
|
|
33633
|
+
const width = _optionalChain([sz, 'optionalAccess', _760 => _760.getAttribute, 'call', _761 => _761("width")]) || void 0;
|
|
33573
33634
|
const cells = [];
|
|
33574
33635
|
const usedBf = /* @__PURE__ */ new Set();
|
|
33575
33636
|
const usedCp = /* @__PURE__ */ new Set();
|
|
@@ -33582,17 +33643,17 @@ function parseTable4(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
33582
33643
|
const addr = findChildByLocalName(tc2, "cellAddr");
|
|
33583
33644
|
const span2 = findChildByLocalName(tc2, "cellSpan");
|
|
33584
33645
|
const csz = findChildByLocalName(tc2, "cellSz");
|
|
33585
|
-
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
33586
|
-
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
33646
|
+
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _762 => _762.getAttribute, 'call', _763 => _763("rowAddr")])), () => ( 0));
|
|
33647
|
+
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _764 => _764.getAttribute, 'call', _765 => _765("colAddr")])), () => ( 0));
|
|
33587
33648
|
if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
|
|
33588
33649
|
if (row === 0) row0Texts.set(col, directCellText(tc2));
|
|
33589
|
-
const colSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess',
|
|
33590
|
-
const rowSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess',
|
|
33650
|
+
const colSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess', _766 => _766.getAttribute, 'call', _767 => _767("colSpan")])), () => ( 1));
|
|
33651
|
+
const rowSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess', _768 => _768.getAttribute, 'call', _769 => _769("rowSpan")])), () => ( 1));
|
|
33591
33652
|
const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
|
|
33592
33653
|
const cpId = firstRunCharPr(tc2);
|
|
33593
33654
|
const cell2 = { row, col, rowSpan, colSpan };
|
|
33594
|
-
const w = _optionalChain([csz, 'optionalAccess',
|
|
33595
|
-
const hh = _optionalChain([csz, 'optionalAccess',
|
|
33655
|
+
const w = _optionalChain([csz, 'optionalAccess', _770 => _770.getAttribute, 'call', _771 => _771("width")]);
|
|
33656
|
+
const hh = _optionalChain([csz, 'optionalAccess', _772 => _772.getAttribute, 'call', _773 => _773("height")]);
|
|
33596
33657
|
if (w) cell2.width_hwpunit = w;
|
|
33597
33658
|
if (hh) cell2.height_hwpunit = hh;
|
|
33598
33659
|
if (bfId) {
|
|
@@ -33680,16 +33741,16 @@ function pick(map, keys) {
|
|
|
33680
33741
|
return out;
|
|
33681
33742
|
}
|
|
33682
33743
|
async function hwpxToProfile(input) {
|
|
33683
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
33744
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkGUU7OHIHcjs.toArrayBuffer.call(void 0, input);
|
|
33684
33745
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
33685
33746
|
const parser = createXmlParser();
|
|
33686
|
-
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access',
|
|
33747
|
+
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _774 => _774.file, 'call', _775 => _775(/[Hh]eader\.xml$/), 'optionalAccess', _776 => _776[0]])));
|
|
33687
33748
|
let headerXml = "<root/>";
|
|
33688
33749
|
if (headerFile) headerXml = await headerFile.async("text");
|
|
33689
33750
|
const headerDoc = parser.parseFromString(headerXml, "text/xml");
|
|
33690
33751
|
const borderFills = parseBorderFills(headerDoc);
|
|
33691
33752
|
const charPrs = parseCharPrs(headerDoc, parseHangulFonts(headerDoc));
|
|
33692
|
-
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access',
|
|
33753
|
+
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _777 => _777.name, 'access', _778 => _778.match, 'call', _779 => _779(/(\d+)\.xml$/), 'optionalAccess', _780 => _780[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _781 => _781.name, 'access', _782 => _782.match, 'call', _783 => _783(/(\d+)\.xml$/), 'optionalAccess', _784 => _784[1]]), () => ( null))), () => ( 0))));
|
|
33693
33754
|
const tables = [];
|
|
33694
33755
|
let tableIndex = 0;
|
|
33695
33756
|
for (const f of sectionFiles) {
|
|
@@ -34238,8 +34299,8 @@ function lintGongmunText(text, opts) {
|
|
|
34238
34299
|
const tableLine = /^\s*\|/.test(line) || /<t[dhr][\s>]/i.test(line);
|
|
34239
34300
|
for (const r of RULES) {
|
|
34240
34301
|
if (r.skipTable && tableLine) continue;
|
|
34241
|
-
if (r.documentOnly && !_optionalChain([opts, 'optionalAccess',
|
|
34242
|
-
if (r.rawSource && _optionalChain([opts, 'optionalAccess',
|
|
34302
|
+
if (r.documentOnly && !_optionalChain([opts, 'optionalAccess', _785 => _785.document])) continue;
|
|
34303
|
+
if (r.rawSource && _optionalChain([opts, 'optionalAccess', _786 => _786.parsed])) continue;
|
|
34243
34304
|
r.pattern.lastIndex = 0;
|
|
34244
34305
|
for (const m of line.matchAll(r.pattern)) {
|
|
34245
34306
|
const checked = r.check ? r.check(m) : void 0;
|
|
@@ -34255,7 +34316,7 @@ function lintGongmunText(text, opts) {
|
|
|
34255
34316
|
}
|
|
34256
34317
|
}
|
|
34257
34318
|
}
|
|
34258
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
34319
|
+
if (_optionalChain([opts, 'optionalAccess', _787 => _787.document]) && /^\s*붙\s*임(?![가-힣])/m.test(text) && !/끝\.\s*$/m.test(text)) {
|
|
34259
34320
|
findings.push({
|
|
34260
34321
|
line: lines.length,
|
|
34261
34322
|
match: "\uBD99\uC784",
|
|
@@ -34554,7 +34615,7 @@ function checkPatchIntegrity(original, patched, replacements, sections) {
|
|
|
34554
34615
|
if (!e) return null;
|
|
34555
34616
|
try {
|
|
34556
34617
|
return decoder.decode(e.method === 8 ? _zlib.inflateRawSync.call(void 0, e.compData) : e.compData);
|
|
34557
|
-
} catch (
|
|
34618
|
+
} catch (e40) {
|
|
34558
34619
|
return null;
|
|
34559
34620
|
}
|
|
34560
34621
|
};
|
|
@@ -34579,7 +34640,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
|
|
|
34579
34640
|
var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
|
|
34580
34641
|
function patchTableRows(input) {
|
|
34581
34642
|
const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
|
|
34582
|
-
const xml = _optionalChain([ctx, 'access',
|
|
34643
|
+
const xml = _optionalChain([ctx, 'access', _788 => _788.scans, 'access', _789 => _789[scanTable.sectionIndex], 'optionalAccess', _790 => _790.xml]);
|
|
34583
34644
|
if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
|
|
34584
34645
|
const numRows = table2.rows;
|
|
34585
34646
|
if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
|
|
@@ -34746,7 +34807,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
|
|
|
34746
34807
|
const rr = scanTable.rowRanges[template];
|
|
34747
34808
|
const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
|
|
34748
34809
|
const scan = scanSectionXml(wrapped, 0);
|
|
34749
|
-
const row = _optionalChain([scan, 'access',
|
|
34810
|
+
const row = _optionalChain([scan, 'access', _791 => _791.tables, 'access', _792 => _792[0], 'optionalAccess', _793 => _793.rows, 'access', _794 => _794[0]]);
|
|
34750
34811
|
if (!row || row.length !== cells.length) return null;
|
|
34751
34812
|
const splices = allLinesegRemovalSplices(wrapped);
|
|
34752
34813
|
for (let i = 0; i < cells.length; i++) {
|
|
@@ -34789,7 +34850,7 @@ function rowHeightOf(fragment) {
|
|
|
34789
34850
|
}
|
|
34790
34851
|
function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
|
|
34791
34852
|
const from = scanTable.start + tblOpenLen;
|
|
34792
|
-
const to = _nullishCoalesce(_optionalChain([scanTable, 'access',
|
|
34853
|
+
const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _795 => _795.rowRanges, 'access', _796 => _796[0], 'optionalAccess', _797 => _797.start]), () => ( from));
|
|
34793
34854
|
const slice = xml.slice(from, to);
|
|
34794
34855
|
const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
|
|
34795
34856
|
if (!szM || szM.index === void 0) return null;
|
|
@@ -34864,7 +34925,7 @@ function buildEmbeddedLineSplices(para2, xml, newLines) {
|
|
|
34864
34925
|
}
|
|
34865
34926
|
}
|
|
34866
34927
|
offset += line.length;
|
|
34867
|
-
offset += _nullishCoalesce(_optionalChain([text, 'access',
|
|
34928
|
+
offset += _nullishCoalesce(_optionalChain([text, 'access', _798 => _798.slice, 'call', _799 => _799(offset), 'access', _800 => _800.match, 'call', _801 => _801(/^(?:\r\n|\r|\n)/), 'optionalAccess', _802 => _802[0], 'access', _803 => _803.length]), () => ( 0));
|
|
34868
34929
|
}
|
|
34869
34930
|
return splices;
|
|
34870
34931
|
}
|
|
@@ -34921,11 +34982,11 @@ function parseEmphasis(text) {
|
|
|
34921
34982
|
}
|
|
34922
34983
|
const charBefore = (k) => {
|
|
34923
34984
|
const t = toks[k - 1];
|
|
34924
|
-
return _optionalChain([t, 'optionalAccess',
|
|
34985
|
+
return _optionalChain([t, 'optionalAccess', _804 => _804.kind]) === "text" ? t.text[t.text.length - 1] : t ? "x" : void 0;
|
|
34925
34986
|
};
|
|
34926
34987
|
const charAfter = (k) => {
|
|
34927
34988
|
const t = toks[k + 1];
|
|
34928
|
-
return _optionalChain([t, 'optionalAccess',
|
|
34989
|
+
return _optionalChain([t, 'optionalAccess', _805 => _805.kind]) === "text" ? t.text[0] : t ? "x" : void 0;
|
|
34929
34990
|
};
|
|
34930
34991
|
const stack = [];
|
|
34931
34992
|
for (let k = 0; k < toks.length; k++) {
|
|
@@ -35203,9 +35264,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
|
|
|
35203
35264
|
});
|
|
35204
35265
|
}
|
|
35205
35266
|
function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
|
|
35206
|
-
const irCell = _optionalChain([table2, 'access',
|
|
35267
|
+
const irCell = _optionalChain([table2, 'access', _806 => _806.cells, 'access', _807 => _807[oc.gridR], 'optionalAccess', _808 => _808[oc.gridC]]);
|
|
35207
35268
|
const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
|
|
35208
|
-
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess',
|
|
35269
|
+
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _809 => _809.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
|
|
35209
35270
|
if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
|
|
35210
35271
|
return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
|
|
35211
35272
|
}
|
|
@@ -35232,8 +35293,8 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
35232
35293
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
35233
35294
|
const t = line.trim();
|
|
35234
35295
|
if (!t) return "";
|
|
35235
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
35236
|
-
return
|
|
35296
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkEVPP2BSOcjs.escapeGfm.call(void 0, t)}**`;
|
|
35297
|
+
return _chunkEVPP2BSOcjs.escapeGfm.call(void 0, t);
|
|
35237
35298
|
}).filter(Boolean);
|
|
35238
35299
|
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");
|
|
35239
35300
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -35247,7 +35308,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
35247
35308
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
35248
35309
|
const replica = [];
|
|
35249
35310
|
for (let r = 0; r < table2.rows; r++) {
|
|
35250
|
-
const line =
|
|
35311
|
+
const line = _chunkEVPP2BSOcjs.escapeGfm.call(void 0, sanitizeText(table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
35251
35312
|
if (line) replica.push({ line, gridR: r });
|
|
35252
35313
|
}
|
|
35253
35314
|
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");
|
|
@@ -35273,7 +35334,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
35273
35334
|
};
|
|
35274
35335
|
const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
|
|
35275
35336
|
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)");
|
|
35276
|
-
const irCell = _optionalChain([table2, 'access',
|
|
35337
|
+
const irCell = _optionalChain([table2, 'access', _810 => _810.cells, 'access', _811 => _811[gridR], 'optionalAccess', _812 => _812[gridC]]);
|
|
35277
35338
|
const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
|
|
35278
35339
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
35279
35340
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -35287,12 +35348,12 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
35287
35348
|
const nonEmpty = cell2.paragraphs.filter((p) => normForMatch(p.text) !== "");
|
|
35288
35349
|
if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
|
|
35289
35350
|
const target = nonEmpty.length === 1 ? nonEmpty[0] : void 0;
|
|
35290
|
-
const sourceLines = _optionalChain([target, 'optionalAccess',
|
|
35351
|
+
const sourceLines = _optionalChain([target, 'optionalAccess', _813 => _813.text, 'access', _814 => _814.split, 'call', _815 => _815(/\r\n|\r|\n/), 'access', _816 => _816.map, 'call', _817 => _817((line) => line.trim())]);
|
|
35291
35352
|
const renderedLines = unescapeGfmCell(stripCellTokens(before2)).split("\n").map((line) => line.trim());
|
|
35292
|
-
if (target && _optionalChain([sourceLines, 'optionalAccess',
|
|
35293
|
-
const xml = _optionalChain([ctx, 'access',
|
|
35353
|
+
if (target && _optionalChain([sourceLines, 'optionalAccess', _818 => _818.length]) === origLineCount && sourceLines.every((line, i) => line === renderedLines[i]) && !extractCellTokens(before2)) {
|
|
35354
|
+
const xml = _optionalChain([ctx, 'access', _819 => _819.scans, 'access', _820 => _820[target.sectionIndex], 'optionalAccess', _821 => _821.xml]);
|
|
35294
35355
|
const precise = xml === void 0 ? null : buildEmbeddedLineSplices(target, xml, newLines);
|
|
35295
|
-
if (_optionalChain([precise, 'optionalAccess',
|
|
35356
|
+
if (_optionalChain([precise, 'optionalAccess', _822 => _822.length])) {
|
|
35296
35357
|
ctx.sectionSplices[target.sectionIndex].push(...precise);
|
|
35297
35358
|
return 1;
|
|
35298
35359
|
}
|
|
@@ -35308,7 +35369,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
35308
35369
|
const target = cell2.paragraphs[0];
|
|
35309
35370
|
if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
|
|
35310
35371
|
const value = newLines.join(" ");
|
|
35311
|
-
const xml = _optionalChain([ctx, 'access',
|
|
35372
|
+
const xml = _optionalChain([ctx, 'access', _823 => _823.scans, 'access', _824 => _824[target.sectionIndex], 'optionalAccess', _825 => _825.xml]);
|
|
35312
35373
|
const rawT = xml ? paraTText(target, xml) : null;
|
|
35313
35374
|
let sp;
|
|
35314
35375
|
if (xml && rawT === null) {
|
|
@@ -35342,7 +35403,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
35342
35403
|
}
|
|
35343
35404
|
for (let i = 0; i < nonEmpty.length; i++) {
|
|
35344
35405
|
if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
|
|
35345
|
-
const xml = _optionalChain([ctx, 'access',
|
|
35406
|
+
const xml = _optionalChain([ctx, 'access', _826 => _826.scans, 'access', _827 => _827[nonEmpty[i].sectionIndex], 'optionalAccess', _828 => _828.xml]);
|
|
35346
35407
|
const sp = _nullishCoalesce((xml ? minimalTextSplices(nonEmpty[i], xml, normForMatch(nonEmpty[i].text), assigned[i]) : null), () => ( buildParagraphSplices(nonEmpty[i], assigned[i], xml)));
|
|
35347
35408
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
35348
35409
|
splices.push(...sp);
|
|
@@ -35424,7 +35485,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
35424
35485
|
const paths = parseSectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
35425
35486
|
if (paths.length > 0) return paths;
|
|
35426
35487
|
}
|
|
35427
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
35488
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkGUU7OHIHcjs.compareSectionPaths);
|
|
35428
35489
|
}
|
|
35429
35490
|
|
|
35430
35491
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -35553,7 +35614,7 @@ var Surgeon = (_class9 = class {
|
|
|
35553
35614
|
/** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
|
|
35554
35615
|
findEntry(path) {
|
|
35555
35616
|
const parts = path.replace(/^\//, "").split("/");
|
|
35556
|
-
let scope = _nullishCoalesce(_optionalChain([this, 'access',
|
|
35617
|
+
let scope = _nullishCoalesce(_optionalChain([this, 'access', _829 => _829.entries, 'access', _830 => _830[0], 'optionalAccess', _831 => _831.child]), () => ( -1));
|
|
35557
35618
|
let current;
|
|
35558
35619
|
for (const part of parts) {
|
|
35559
35620
|
const search = (idx) => {
|
|
@@ -35847,8 +35908,8 @@ function serializeRecords(recs, repl, inserts) {
|
|
|
35847
35908
|
parts.push(header, data);
|
|
35848
35909
|
};
|
|
35849
35910
|
for (let i = 0; i < recs.length; i++) {
|
|
35850
|
-
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess',
|
|
35851
|
-
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess',
|
|
35911
|
+
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _832 => _832.get, 'call', _833 => _833(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
|
|
35912
|
+
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _834 => _834.get, 'call', _835 => _835(i)]), () => ( recs[i].data)));
|
|
35852
35913
|
}
|
|
35853
35914
|
return Buffer.concat(parts);
|
|
35854
35915
|
}
|
|
@@ -35967,7 +36028,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
35967
36028
|
return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
|
|
35968
36029
|
}
|
|
35969
36030
|
const fhEntry = CFB2.find(cfb, "/FileHeader");
|
|
35970
|
-
if (!_optionalChain([fhEntry, 'optionalAccess',
|
|
36031
|
+
if (!_optionalChain([fhEntry, 'optionalAccess', _836 => _836.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
35971
36032
|
let flags;
|
|
35972
36033
|
try {
|
|
35973
36034
|
flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
|
|
@@ -35984,7 +36045,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
35984
36045
|
origBlocks = kept.blocks;
|
|
35985
36046
|
const visual = parseHwp5Document(originalBuf).markdown;
|
|
35986
36047
|
if (kept.markdown !== visual && editedMarkdown === visual) {
|
|
35987
|
-
const verification2 = _optionalChain([options, 'optionalAccess',
|
|
36048
|
+
const verification2 = _optionalChain([options, 'optionalAccess', _837 => _837.verify]) === false ? void 0 : diffUnitLists(splitMarkdownUnits(visual), splitMarkdownUnits(editedMarkdown));
|
|
35988
36049
|
return { success: true, data: new Uint8Array(original), applied: 0, skipped, verification: verification2 };
|
|
35989
36050
|
}
|
|
35990
36051
|
if (editedFromVisual(kept.markdown, visual, editedMarkdown)) return fail(LAYOUT_MODE_MISMATCH);
|
|
@@ -35996,7 +36057,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
35996
36057
|
const scans = [];
|
|
35997
36058
|
for (let i = 0; i < sectionPaths.length; i++) {
|
|
35998
36059
|
const entry = CFB2.find(cfb, sectionPaths[i]);
|
|
35999
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
36060
|
+
if (!_optionalChain([entry, 'optionalAccess', _838 => _838.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
|
|
36000
36061
|
let stream;
|
|
36001
36062
|
try {
|
|
36002
36063
|
stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
@@ -36047,7 +36108,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
36047
36108
|
}
|
|
36048
36109
|
}
|
|
36049
36110
|
let verification;
|
|
36050
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
36111
|
+
if (_optionalChain([options, 'optionalAccess', _839 => _839.verify]) !== false) {
|
|
36051
36112
|
try {
|
|
36052
36113
|
const reparsed = parseHwp5Document(Buffer.from(data), { layoutTables: "keep" });
|
|
36053
36114
|
const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
|
|
@@ -36142,7 +36203,7 @@ function tableContentScore(irTable, scanTable) {
|
|
|
36142
36203
|
for (const [key, scanCell] of scanTable.cells) {
|
|
36143
36204
|
const comma = key.indexOf(",");
|
|
36144
36205
|
const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
|
|
36145
|
-
const irCell = _optionalChain([irTable, 'access',
|
|
36206
|
+
const irCell = _optionalChain([irTable, 'access', _840 => _840.cells, 'access', _841 => _841[r], 'optionalAccess', _842 => _842[c]]);
|
|
36146
36207
|
if (!irCell) continue;
|
|
36147
36208
|
const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
|
|
36148
36209
|
const b = normForMatch(stripCellTokens(irCell.text));
|
|
@@ -36178,7 +36239,7 @@ function handleModified(orig, edited, ctx) {
|
|
|
36178
36239
|
}
|
|
36179
36240
|
function patchParagraph(block, orig, edited, ctx, skip) {
|
|
36180
36241
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
36181
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
36242
|
+
if (!_optionalChain([mapping, 'optionalAccess', _843 => _843.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)");
|
|
36182
36243
|
const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
|
|
36183
36244
|
let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
|
|
36184
36245
|
if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
|
|
@@ -36342,8 +36403,8 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
36342
36403
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
36343
36404
|
const t = line.trim();
|
|
36344
36405
|
if (!t) return "";
|
|
36345
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
36346
|
-
return
|
|
36406
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkEVPP2BSOcjs.escapeGfm.call(void 0, t)}**`;
|
|
36407
|
+
return _chunkEVPP2BSOcjs.escapeGfm.call(void 0, t);
|
|
36347
36408
|
}).filter(Boolean);
|
|
36348
36409
|
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");
|
|
36349
36410
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -36357,7 +36418,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
36357
36418
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
36358
36419
|
const replica = [];
|
|
36359
36420
|
for (let r = 0; r < table2.rows; r++) {
|
|
36360
|
-
const line =
|
|
36421
|
+
const line = _chunkEVPP2BSOcjs.escapeGfm.call(void 0, sanitizeText(table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
36361
36422
|
if (line) replica.push({ line, gridR: r });
|
|
36362
36423
|
}
|
|
36363
36424
|
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");
|
|
@@ -36383,7 +36444,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
36383
36444
|
};
|
|
36384
36445
|
const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
|
|
36385
36446
|
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)");
|
|
36386
|
-
const irCell = _optionalChain([table2, 'access',
|
|
36447
|
+
const irCell = _optionalChain([table2, 'access', _844 => _844.cells, 'access', _845 => _845[gridR], 'optionalAccess', _846 => _846[gridC]]);
|
|
36387
36448
|
const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
|
|
36388
36449
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
36389
36450
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -36645,7 +36706,7 @@ function stageParaPatch(scan, para2, newPlain, skip, origPlain) {
|
|
|
36645
36706
|
return skip(para2.ctrlMask !== 0 ? "\uCEE8\uD2B8\uB864 \uBB38\uC790(\uD0ED/\uD544\uB4DC/\uD2B9\uC218\uACF5\uBC31 \uB4F1 \uD14D\uC2A4\uD2B8 \uC911\uAC04) \uD3EC\uD568 \uBB38\uB2E8 \u2014 \uBBF8\uC9C0\uC6D0 (v1)" : "PARA_TEXT \uC7AC\uAD6C\uC131 \uBD88\uC77C\uCE58 \u2014 \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
36646
36707
|
}
|
|
36647
36708
|
if (seg.core !== para2.rawText) return skip("PARA_TEXT \uC7AC\uAD6C\uC131 \uBD88\uC77C\uCE58 \u2014 \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
36648
|
-
const edit = origPlain !== void 0 && !origPlain.includes("\n") && !newPlain.includes("\n") ? _optionalChain([alignedTextEdits, 'call',
|
|
36709
|
+
const edit = origPlain !== void 0 && !origPlain.includes("\n") && !newPlain.includes("\n") ? _optionalChain([alignedTextEdits, 'call', _847 => _847(para2.rawText, origPlain, newPlain), 'optionalAccess', _848 => _848[0]]) : void 0;
|
|
36649
36710
|
const lead = para2.rawText.match(/^\s*/)[0];
|
|
36650
36711
|
const trail = para2.rawText.match(/\s*$/)[0];
|
|
36651
36712
|
const newRaw = edit ? para2.rawText.slice(0, edit.start) + edit.text + para2.rawText.slice(edit.end) : para2.rawText.trim() === para2.rawText ? newPlain : lead + newPlain + trail;
|
|
@@ -36692,7 +36753,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
36692
36753
|
origBlocks = parsed.blocks;
|
|
36693
36754
|
const visual = await parseHwpxDocument(u8ToArrayBuffer(original));
|
|
36694
36755
|
if (parsed.markdown !== visual.markdown && editedMarkdown === visual.markdown) {
|
|
36695
|
-
const verification2 = _optionalChain([options, 'optionalAccess',
|
|
36756
|
+
const verification2 = _optionalChain([options, 'optionalAccess', _849 => _849.verify]) === false ? void 0 : diffUnitLists(splitMarkdownUnits(visual.markdown), splitMarkdownUnits(editedMarkdown));
|
|
36696
36757
|
return { success: true, data: new Uint8Array(original), applied: 0, skipped, verification: verification2 };
|
|
36697
36758
|
}
|
|
36698
36759
|
if (editedFromVisual(parsed.markdown, visual.markdown, editedMarkdown)) return { success: false, applied: 0, skipped, error: LAYOUT_MODE_MISMATCH };
|
|
@@ -36702,7 +36763,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
36702
36763
|
let zip;
|
|
36703
36764
|
try {
|
|
36704
36765
|
zip = await _jszip2.default.loadAsync(original);
|
|
36705
|
-
} catch (
|
|
36766
|
+
} catch (e41) {
|
|
36706
36767
|
return { success: false, applied: 0, skipped, error: "ZIP \uB85C\uB4DC \uC2E4\uD328" };
|
|
36707
36768
|
}
|
|
36708
36769
|
const sectionPaths = await resolveSectionEntryNames(zip);
|
|
@@ -36778,7 +36839,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
36778
36839
|
}
|
|
36779
36840
|
}
|
|
36780
36841
|
let verification;
|
|
36781
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
36842
|
+
if (_optionalChain([options, 'optionalAccess', _850 => _850.verify]) !== false) {
|
|
36782
36843
|
const issues = replacements.size > 0 ? checkPatchIntegrity(original, data, replacements, edited) : [];
|
|
36783
36844
|
if (issues.length) return { success: false, applied, skipped, error: `\uD328\uCE58\uBCF8 \uBB34\uACB0\uC131 \uAC80\uC0AC \uC2E4\uD328 \u2014 \uD328\uCE58 \uC911\uB2E8: ${issues.join("; ")}` };
|
|
36784
36845
|
try {
|
|
@@ -36798,17 +36859,17 @@ function buildOrigUnits(blocks) {
|
|
|
36798
36859
|
let chunk;
|
|
36799
36860
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
36800
36861
|
const next = blocks[i + 1];
|
|
36801
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
36802
|
-
chunk =
|
|
36862
|
+
if (_optionalChain([next, 'optionalAccess', _851 => _851.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
36863
|
+
chunk = _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
36803
36864
|
} else {
|
|
36804
|
-
chunk =
|
|
36865
|
+
chunk = _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, [block]);
|
|
36805
36866
|
}
|
|
36806
36867
|
if (chunk) {
|
|
36807
36868
|
const subUnits = splitMarkdownUnits(chunk);
|
|
36808
36869
|
const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
|
|
36809
36870
|
for (let s = 0; s < subUnits.length; s++) {
|
|
36810
36871
|
const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
|
|
36811
|
-
if (block.type === "table" && _optionalChain([block, 'access',
|
|
36872
|
+
if (block.type === "table" && _optionalChain([block, 'access', _852 => _852.table, 'optionalAccess', _853 => _853.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
|
|
36812
36873
|
u.role = "caption";
|
|
36813
36874
|
}
|
|
36814
36875
|
units.push(u);
|
|
@@ -37017,7 +37078,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
37017
37078
|
const ti = ctx.tableInsert;
|
|
37018
37079
|
if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
|
|
37019
37080
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
37020
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
37081
|
+
if (!_optionalChain([mapping, 'optionalAccess', _854 => _854.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");
|
|
37021
37082
|
const para2 = mapping.para;
|
|
37022
37083
|
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");
|
|
37023
37084
|
const scan = ctx.scans[para2.sectionIndex];
|
|
@@ -37045,7 +37106,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
37045
37106
|
}
|
|
37046
37107
|
function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
37047
37108
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
37048
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
37109
|
+
if (!_optionalChain([mapping, 'optionalAccess', _855 => _855.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)");
|
|
37049
37110
|
if (block.text && block.text.includes("\n")) {
|
|
37050
37111
|
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)");
|
|
37051
37112
|
}
|
|
@@ -37053,7 +37114,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
37053
37114
|
const newInline = parseEmphasis(textUnitInline(edited.raw, block));
|
|
37054
37115
|
let origPlain = origInline.plain;
|
|
37055
37116
|
let newPlain = newInline.plain;
|
|
37056
|
-
const segsUsable = !block.footnoteText && !_optionalChain([mapping, 'access',
|
|
37117
|
+
const segsUsable = !block.footnoteText && !_optionalChain([mapping, 'access', _856 => _856.noteMarks, 'optionalAccess', _857 => _857.length]) && !mapping.prefixStripped;
|
|
37057
37118
|
if (block.footnoteText) {
|
|
37058
37119
|
origPlain = origPlain.replace(/\s*\(주: [\s\S]*\)$/, "");
|
|
37059
37120
|
const noteMatch = newPlain.match(/\s*\(주: ([\s\S]*)\)$/);
|
|
@@ -37066,7 +37127,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
37066
37127
|
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})` });
|
|
37067
37128
|
}
|
|
37068
37129
|
}
|
|
37069
|
-
if (_optionalChain([mapping, 'access',
|
|
37130
|
+
if (_optionalChain([mapping, 'access', _858 => _858.noteMarks, 'optionalAccess', _859 => _859.length])) {
|
|
37070
37131
|
origPlain = removeNoteMarks(origPlain, mapping.noteMarks).text;
|
|
37071
37132
|
const r = removeNoteMarks(newPlain, mapping.noteMarks);
|
|
37072
37133
|
newPlain = r.text;
|
|
@@ -37087,7 +37148,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
37087
37148
|
if (sanitizeText(newPlain) !== newPlain && sanitizeText(origPlain) === origPlain) {
|
|
37088
37149
|
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");
|
|
37089
37150
|
}
|
|
37090
|
-
const xml = _optionalChain([ctx, 'access',
|
|
37151
|
+
const xml = _optionalChain([ctx, 'access', _860 => _860.scans, 'access', _861 => _861[mapping.para.sectionIndex], 'optionalAccess', _862 => _862.xml]);
|
|
37091
37152
|
const splices = _nullishCoalesce(_nullishCoalesce((xml ? minimalTextSplices(mapping.para, xml, origPlain, newPlain, segsUsable ? origInline.segs : void 0, segsUsable ? newInline.segs : void 0) : null), () => ( (xml ? markerRunSplices(mapping.para, xml, newPlain) : null))), () => ( buildParagraphSplices(mapping.para, newPlain, xml)));
|
|
37092
37153
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
37093
37154
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
@@ -37615,7 +37676,7 @@ var REF_NOUN = alt([
|
|
|
37615
37676
|
]);
|
|
37616
37677
|
var REF = `\\s?\\((?!(?:${REF_NOUN})[),])[\uAC00-\uD7A3]{1,6}(?:\\d{0,2}(?:\uB3D9|\uB9AC)|\\d{1,2}\uAC00)(?:,\\s?[^)]{1,30})?\\)`;
|
|
37617
37678
|
var PLACEHOLDER_NO = /(?<![\d-])0+(?![\d])/;
|
|
37618
|
-
var realNumber = (x) => !PLACEHOLDER_NO.test(_nullishCoalesce(_optionalChain([x, 'access',
|
|
37679
|
+
var realNumber = (x) => !PLACEHOLDER_NO.test(_nullishCoalesce(_optionalChain([x, 'access', _863 => _863.m, 'access', _864 => _864.groups, 'optionalAccess', _865 => _865.rest]), () => ( "")));
|
|
37619
37680
|
var ADDRESS_VARIANTS = [
|
|
37620
37681
|
{
|
|
37621
37682
|
// 도로명 주소 — 읍·면, 동·리("서울시 도봉구 창동 우이천로 4다길 9"·"서천군 판교면 판교리 대백제로 1999") 뒤도, 참고항목까지
|
|
@@ -38724,9 +38785,9 @@ var REGION_WORDS = /* @__PURE__ */ new Set([...SIDO, ...SIGUNGU, ...SIGUNGU.filt
|
|
|
38724
38785
|
var NON_NAME_END = /(?:적|하여|하는|하고|하며|하게|하기|하면|하다|한다|했다|는데|니다|습니|다고|해야|해서|되는|되어|된다|지만|니까|와서|워서)$/;
|
|
38725
38786
|
var FOREIGN_SYLLABLE = /[스트크드브프즈츠끄뜨쁘쓰쯔플클블러케퍼커터텔톤튼픈핀펜헨앤엔엠켓렛쇼핑]/;
|
|
38726
38787
|
var TITLE_SET = /* @__PURE__ */ new Set([...TITLES, ...RANKS, ...PARTY_ROLES]);
|
|
38727
|
-
var g = (x, name) => _nullishCoalesce(_optionalChain([x, 'access',
|
|
38788
|
+
var g = (x, name) => _nullishCoalesce(_optionalChain([x, 'access', _866 => _866.m, 'access', _867 => _867.groups, 'optionalAccess', _868 => _868[name]]), () => ( ""));
|
|
38728
38789
|
var nameOf = (x) => g(x, "dsur") + g(x, "dgiven") + g(x, "sur") + g(x, "given") + g(x, "given1");
|
|
38729
|
-
var span = (x) => _optionalChain([x, 'access',
|
|
38790
|
+
var span = (x) => _optionalChain([x, 'access', _869 => _869.m, 'access', _870 => _870.indices, 'optionalAccess', _871 => _871.groups, 'optionalAccess', _872 => _872.n]);
|
|
38730
38791
|
var nextIs = (x, re) => {
|
|
38731
38792
|
const n = span(x);
|
|
38732
38793
|
return !!n && re.test(x.m.input.slice(n[1], n[1] + 1));
|
|
@@ -39098,7 +39159,7 @@ function labelsBefore(norm2, start) {
|
|
|
39098
39159
|
return labelsIn(win);
|
|
39099
39160
|
}
|
|
39100
39161
|
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;
|
|
39101
|
-
var g2 = (x, name) => _nullishCoalesce(_optionalChain([x, 'access',
|
|
39162
|
+
var g2 = (x, name) => _nullishCoalesce(_optionalChain([x, 'access', _873 => _873.m, 'access', _874 => _874.groups, 'optionalAccess', _875 => _875[name]]), () => ( ""));
|
|
39102
39163
|
var has = (x, c) => x.ctx().has(c);
|
|
39103
39164
|
var crnOnly = (x) => has(x, "crn") && !has(x, "rrn");
|
|
39104
39165
|
var after = (x, n = 16) => {
|
|
@@ -39406,9 +39467,9 @@ function normalizeForDetect(text) {
|
|
|
39406
39467
|
}
|
|
39407
39468
|
function maskMatch(orig, norm2, start, x, v, maskChar) {
|
|
39408
39469
|
const chars = orig.split("");
|
|
39409
|
-
const idx = _optionalChain([x, 'access',
|
|
39470
|
+
const idx = _optionalChain([x, 'access', _876 => _876.m, 'access', _877 => _877.indices, 'optionalAccess', _878 => _878.groups]);
|
|
39410
39471
|
for (const name of v.mask) {
|
|
39411
|
-
const r = _optionalChain([idx, 'optionalAccess',
|
|
39472
|
+
const r = _optionalChain([idx, 'optionalAccess', _879 => _879[name]]);
|
|
39412
39473
|
if (!r) continue;
|
|
39413
39474
|
for (let i = r[0] - start; i < r[1] - start; i++) {
|
|
39414
39475
|
if (v.maskAll || /[\p{L}\p{N}]/u.test(norm2[start + i])) chars[i] = maskChar;
|
|
@@ -39433,7 +39494,7 @@ function detect(text, rules, maskChar, headerAt) {
|
|
|
39433
39494
|
const re = v.re;
|
|
39434
39495
|
re.lastIndex = 0;
|
|
39435
39496
|
for (let m = re.exec(norm2); m !== null; m = re.exec(norm2)) {
|
|
39436
|
-
const sg = v.span ? _optionalChain([m, 'access',
|
|
39497
|
+
const sg = v.span ? _optionalChain([m, 'access', _880 => _880.indices, 'optionalAccess', _881 => _881.groups, 'optionalAccess', _882 => _882[v.span]]) : void 0;
|
|
39437
39498
|
const start = sg ? sg[0] : m.index;
|
|
39438
39499
|
const end = sg ? sg[1] : start + m[0].length;
|
|
39439
39500
|
const retry = () => {
|
|
@@ -39462,7 +39523,7 @@ function detect(text, rules, maskChar, headerAt) {
|
|
|
39462
39523
|
const x = {
|
|
39463
39524
|
m,
|
|
39464
39525
|
ctx,
|
|
39465
|
-
header: () => _optionalChain([headerAt, 'optionalCall',
|
|
39526
|
+
header: () => _optionalChain([headerAt, 'optionalCall', _883 => _883(start)]),
|
|
39466
39527
|
prev: () => {
|
|
39467
39528
|
let best;
|
|
39468
39529
|
for (const o of occupied) if (o.end <= start && (!best || o.end > best.end)) best = o;
|
|
@@ -39490,9 +39551,9 @@ function applyHits(text, hits) {
|
|
|
39490
39551
|
return out + text.slice(cursor);
|
|
39491
39552
|
}
|
|
39492
39553
|
function redactText(text, options) {
|
|
39493
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
39554
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _884 => _884.maskChar]), () => ( "\u25CF"));
|
|
39494
39555
|
assertMaskChar(maskChar);
|
|
39495
|
-
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
39556
|
+
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _885 => _885.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
39496
39557
|
if (text === "" || rules.length === 0) return { text, hits: [] };
|
|
39497
39558
|
const hits = detect(text, rules, maskChar);
|
|
39498
39559
|
return { text: applyHits(text, hits), hits };
|
|
@@ -39510,7 +39571,7 @@ function htmlCells(line) {
|
|
|
39510
39571
|
const out = [];
|
|
39511
39572
|
let col = 0;
|
|
39512
39573
|
for (const m of line.matchAll(/<t([dh])\b([^>]*)>([\s\S]*?)<\/t\1>/gi)) {
|
|
39513
|
-
const span2 = Math.max(1, Number(_nullishCoalesce(_optionalChain([m, 'access',
|
|
39574
|
+
const span2 = Math.max(1, Number(_nullishCoalesce(_optionalChain([m, 'access', _886 => _886[2], 'access', _887 => _887.match, 'call', _888 => _888(/colspan="?(\d+)/i), 'optionalAccess', _889 => _889[1]]), () => ( 1))));
|
|
39514
39575
|
out.push({ start: m.index, end: m.index + m[0].length, col, span: span2, text: m[3].replace(/<[^>]*>/g, " ") });
|
|
39515
39576
|
col += span2;
|
|
39516
39577
|
}
|
|
@@ -39552,7 +39613,7 @@ function tableHeaderContext(lines) {
|
|
|
39552
39613
|
const c = cells.find((x) => off >= x.start && off < x.end);
|
|
39553
39614
|
if (!c) return void 0;
|
|
39554
39615
|
const h = hdr.find((x) => c.col >= x.col && c.col < x.col + x.span);
|
|
39555
|
-
return _optionalChain([h, 'optionalAccess',
|
|
39616
|
+
return _optionalChain([h, 'optionalAccess', _890 => _890.text]);
|
|
39556
39617
|
});
|
|
39557
39618
|
}
|
|
39558
39619
|
}
|
|
@@ -39621,9 +39682,9 @@ function detectMarkdownLine(line, rules, maskChar, headerAt) {
|
|
|
39621
39682
|
});
|
|
39622
39683
|
}
|
|
39623
39684
|
function redactMarkdown(markdown, options) {
|
|
39624
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
39685
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _891 => _891.maskChar]), () => ( "\u25CF"));
|
|
39625
39686
|
assertMaskChar(maskChar);
|
|
39626
|
-
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
39687
|
+
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _892 => _892.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
39627
39688
|
const lines = markdown.split("\n");
|
|
39628
39689
|
const headers = tableHeaderContext(lines);
|
|
39629
39690
|
const hits = [];
|
|
@@ -39653,10 +39714,10 @@ function sameBreadcrumb(a, b) {
|
|
|
39653
39714
|
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
39654
39715
|
}
|
|
39655
39716
|
function blocksToChunks(blocks, options) {
|
|
39656
|
-
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
39657
|
-
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
39658
|
-
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess',
|
|
39659
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
39717
|
+
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _893 => _893.granularity]), () => ( "section"));
|
|
39718
|
+
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _894 => _894.includeTableCells]), () => ( false));
|
|
39719
|
+
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess', _895 => _895.tableFormat]) };
|
|
39720
|
+
if (_optionalChain([options, 'optionalAccess', _896 => _896.tableFormat]) === "gfm") _chunkEVPP2BSOcjs.assignTableIds.call(void 0, blocks);
|
|
39660
39721
|
const chunks = [];
|
|
39661
39722
|
const headingStack = [];
|
|
39662
39723
|
const listStack = [];
|
|
@@ -39670,12 +39731,12 @@ function blocksToChunks(blocks, options) {
|
|
|
39670
39731
|
let run = null;
|
|
39671
39732
|
const flushRun = () => {
|
|
39672
39733
|
if (!run) return;
|
|
39673
|
-
push("text", run.breadcrumb,
|
|
39734
|
+
push("text", run.breadcrumb, _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, run.blocks, mdOptions), [run.start, run.end], run.page);
|
|
39674
39735
|
run = null;
|
|
39675
39736
|
};
|
|
39676
39737
|
for (let i = 0; i < blocks.length; i++) {
|
|
39677
39738
|
const block = blocks[i];
|
|
39678
|
-
const md2 =
|
|
39739
|
+
const md2 = _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, [block], mdOptions);
|
|
39679
39740
|
if (!md2) continue;
|
|
39680
39741
|
if (block.type === "heading") {
|
|
39681
39742
|
flushRun();
|
|
@@ -39793,7 +39854,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
39793
39854
|
const block = st.blocks[blockIndex];
|
|
39794
39855
|
if (!block) return void 0;
|
|
39795
39856
|
if (block.type === "paragraph" || block.type === "heading") {
|
|
39796
|
-
const para2 = _optionalChain([st, 'access',
|
|
39857
|
+
const para2 = _optionalChain([st, 'access', _897 => _897.paraMap, 'access', _898 => _898.get, 'call', _899 => _899(blockIndex), 'optionalAccess', _900 => _900.para]);
|
|
39797
39858
|
if (!para2) return void 0;
|
|
39798
39859
|
return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
|
|
39799
39860
|
}
|
|
@@ -39818,7 +39879,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
39818
39879
|
if (block.text && block.text.includes("\n")) {
|
|
39819
39880
|
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)" };
|
|
39820
39881
|
}
|
|
39821
|
-
if (!_optionalChain([st, 'access',
|
|
39882
|
+
if (!_optionalChain([st, 'access', _901 => _901.paraMap, 'access', _902 => _902.get, 'call', _903 => _903(blockIndex), 'optionalAccess', _904 => _904.para])) {
|
|
39822
39883
|
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)" };
|
|
39823
39884
|
}
|
|
39824
39885
|
return { capability: "text" };
|
|
@@ -39884,7 +39945,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
39884
39945
|
continue;
|
|
39885
39946
|
}
|
|
39886
39947
|
if (block.type === "table" && block.table) {
|
|
39887
|
-
if (!_optionalChain([edit, 'access',
|
|
39948
|
+
if (!_optionalChain([edit, 'access', _905 => _905.cells, 'optionalAccess', _906 => _906.length])) {
|
|
39888
39949
|
skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
|
|
39889
39950
|
continue;
|
|
39890
39951
|
}
|
|
@@ -39904,7 +39965,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
39904
39965
|
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) });
|
|
39905
39966
|
continue;
|
|
39906
39967
|
}
|
|
39907
|
-
const irCell = _optionalChain([block, 'access',
|
|
39968
|
+
const irCell = _optionalChain([block, 'access', _907 => _907.table, 'access', _908 => _908.cells, 'access', _909 => _909[cellEdit.row], 'optionalAccess', _910 => _910[cellEdit.col]]);
|
|
39908
39969
|
if (!irCell) {
|
|
39909
39970
|
skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
|
|
39910
39971
|
continue;
|
|
@@ -39960,7 +40021,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
39960
40021
|
}
|
|
39961
40022
|
if (replacements.size === 0) {
|
|
39962
40023
|
let changes2;
|
|
39963
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
40024
|
+
if (_optionalChain([options, 'optionalAccess', _911 => _911.verify]) !== false) {
|
|
39964
40025
|
const units = splitMarkdownUnits(st.markdown);
|
|
39965
40026
|
changes2 = diffUnitLists(units, units);
|
|
39966
40027
|
}
|
|
@@ -39981,7 +40042,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
39981
40042
|
}
|
|
39982
40043
|
this.state = newState;
|
|
39983
40044
|
let changes;
|
|
39984
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
40045
|
+
if (_optionalChain([options, 'optionalAccess', _912 => _912.verify]) !== false) {
|
|
39985
40046
|
changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
|
|
39986
40047
|
}
|
|
39987
40048
|
return { success: true, data: new Uint8Array(data), applied, skipped, changes };
|
|
@@ -40001,11 +40062,11 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
40001
40062
|
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)");
|
|
40002
40063
|
}
|
|
40003
40064
|
const mapping = st.paraMap.get(blockIndex);
|
|
40004
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
40065
|
+
if (!_optionalChain([mapping, 'optionalAccess', _913 => _913.para])) {
|
|
40005
40066
|
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)");
|
|
40006
40067
|
}
|
|
40007
40068
|
let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
40008
|
-
if (_optionalChain([mapping, 'access',
|
|
40069
|
+
if (_optionalChain([mapping, 'access', _914 => _914.noteMarks, 'optionalAccess', _915 => _915.length])) {
|
|
40009
40070
|
const r = removeNoteMarks(newPlain, mapping.noteMarks);
|
|
40010
40071
|
newPlain = r.text;
|
|
40011
40072
|
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(" ") });
|
|
@@ -40026,14 +40087,14 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
40026
40087
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
40027
40088
|
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");
|
|
40028
40089
|
}
|
|
40029
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access',
|
|
40090
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _916 => _916.scans, 'access', _917 => _917[mapping.para.sectionIndex], 'optionalAccess', _918 => _918.xml]));
|
|
40030
40091
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
40031
40092
|
sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
40032
40093
|
return 1;
|
|
40033
40094
|
}
|
|
40034
40095
|
}, _class10);
|
|
40035
40096
|
function cellStaticCheck(table2, scanTable, r, c) {
|
|
40036
|
-
const irCell = _optionalChain([table2, 'access',
|
|
40097
|
+
const irCell = _optionalChain([table2, 'access', _919 => _919.cells, 'access', _920 => _920[r], 'optionalAccess', _921 => _921[c]]);
|
|
40037
40098
|
if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
|
|
40038
40099
|
const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
|
|
40039
40100
|
if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
|
|
@@ -40118,16 +40179,16 @@ var md = new (0, _markdownit2.default)({
|
|
|
40118
40179
|
});
|
|
40119
40180
|
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;
|
|
40120
40181
|
function sanitizeRawHtml(raw) {
|
|
40121
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
40182
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkGUU7OHIHcjs.escapeHtml.call(void 0, tag));
|
|
40122
40183
|
}
|
|
40123
40184
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
40124
40185
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
40125
40186
|
function renderHtml(markdown, options) {
|
|
40126
|
-
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
40127
|
-
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
40187
|
+
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _922 => _922.preset]), () => ( "default"));
|
|
40188
|
+
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _923 => _923.extraCss]), () => ( "")));
|
|
40128
40189
|
const body = md.render(markdown);
|
|
40129
|
-
const watermark = _optionalChain([options, 'optionalAccess',
|
|
40130
|
-
const watermarkCss = _optionalChain([options, 'optionalAccess',
|
|
40190
|
+
const watermark = _optionalChain([options, 'optionalAccess', _924 => _924.watermark]) ? `<div class="watermark">${_chunkGUU7OHIHcjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
40191
|
+
const watermarkCss = _optionalChain([options, 'optionalAccess', _925 => _925.watermark]) ? `
|
|
40131
40192
|
.watermark {
|
|
40132
40193
|
position: fixed;
|
|
40133
40194
|
top: 50%; left: 50%;
|
|
@@ -40176,14 +40237,14 @@ async function htmlToPdf(html, options) {
|
|
|
40176
40237
|
let puppeteer;
|
|
40177
40238
|
try {
|
|
40178
40239
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
40179
|
-
} catch (
|
|
40180
|
-
throw new (0,
|
|
40240
|
+
} catch (e42) {
|
|
40241
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(
|
|
40181
40242
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
40182
40243
|
);
|
|
40183
40244
|
}
|
|
40184
40245
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
40185
40246
|
if (!executablePath) {
|
|
40186
|
-
throw new (0,
|
|
40247
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(
|
|
40187
40248
|
"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."
|
|
40188
40249
|
);
|
|
40189
40250
|
}
|
|
@@ -40191,10 +40252,10 @@ async function htmlToPdf(html, options) {
|
|
|
40191
40252
|
try {
|
|
40192
40253
|
await page.setContent(html, { waitUntil: "load" });
|
|
40193
40254
|
await page.waitForNetworkIdle({ idleTime: 500, concurrency: 0 });
|
|
40194
|
-
const margin = _optionalChain([options, 'optionalAccess',
|
|
40255
|
+
const margin = _optionalChain([options, 'optionalAccess', _926 => _926.margin]);
|
|
40195
40256
|
const pdf = await page.pdf({
|
|
40196
|
-
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
40197
|
-
landscape: _optionalChain([options, 'optionalAccess',
|
|
40257
|
+
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _927 => _927.pageSize]), () => ( "A4")),
|
|
40258
|
+
landscape: _optionalChain([options, 'optionalAccess', _928 => _928.orientation]) === "landscape",
|
|
40198
40259
|
printBackground: true,
|
|
40199
40260
|
margin: margin ? {
|
|
40200
40261
|
top: toCss(margin.top),
|
|
@@ -40202,9 +40263,9 @@ async function htmlToPdf(html, options) {
|
|
|
40202
40263
|
bottom: toCss(margin.bottom),
|
|
40203
40264
|
left: toCss(margin.left)
|
|
40204
40265
|
} : void 0,
|
|
40205
|
-
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess',
|
|
40206
|
-
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
40207
|
-
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
40266
|
+
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _929 => _929.header]) || _optionalChain([options, 'optionalAccess', _930 => _930.footer])),
|
|
40267
|
+
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _931 => _931.header]), () => ( "<div></div>")),
|
|
40268
|
+
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _932 => _932.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
|
|
40208
40269
|
});
|
|
40209
40270
|
return Buffer.from(pdf);
|
|
40210
40271
|
} finally {
|
|
@@ -40238,7 +40299,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
40238
40299
|
return htmlToPdf(html, options);
|
|
40239
40300
|
}
|
|
40240
40301
|
async function blocksToPdf(blocks, options) {
|
|
40241
|
-
const markdown =
|
|
40302
|
+
const markdown = _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, blocks);
|
|
40242
40303
|
return markdownToPdf(markdown, options);
|
|
40243
40304
|
}
|
|
40244
40305
|
|
|
@@ -40439,7 +40500,7 @@ function buildPara(p) {
|
|
|
40439
40500
|
const pos = findChildByLocalName(ch, "pos");
|
|
40440
40501
|
const w = num2(sz, "width") || num2(findChildByLocalName(ch, "curSz"), "width") || num2(findChildByLocalName(ch, "orgSz"), "width");
|
|
40441
40502
|
const h = num2(sz, "height") || num2(findChildByLocalName(ch, "curSz"), "height") || num2(findChildByLocalName(ch, "orgSz"), "height");
|
|
40442
|
-
const inline = _optionalChain([pos, 'optionalAccess',
|
|
40503
|
+
const inline = _optionalChain([pos, 'optionalAccess', _933 => _933.getAttribute, 'call', _934 => _934("treatAsChar")]) === "1";
|
|
40443
40504
|
const om = inline && cn === "tbl" ? findChildByLocalName(ch, "outMargin") : null;
|
|
40444
40505
|
if (!deleted) objs.push({
|
|
40445
40506
|
el: ch,
|
|
@@ -40475,20 +40536,20 @@ function buildPara(p) {
|
|
|
40475
40536
|
var DEFAULT_TAB_HU = 4e3;
|
|
40476
40537
|
function tabAdvance(x, firstLine, geom, saved = 0) {
|
|
40477
40538
|
const hang = geom && geom.marginIntent < 0 ? -geom.marginIntent : 0;
|
|
40478
|
-
if (firstLine && _optionalChain([geom, 'optionalAccess',
|
|
40539
|
+
if (firstLine && _optionalChain([geom, 'optionalAccess', _935 => _935.autoTabLeft]) && hang > 0 && x < hang - 0.5) return hang - x;
|
|
40479
40540
|
if (saved > 0) return saved;
|
|
40480
40541
|
return (Math.floor(x / DEFAULT_TAB_HU) + 1) * DEFAULT_TAB_HU - x;
|
|
40481
40542
|
}
|
|
40482
40543
|
function cellContentExtent(cell2, memo) {
|
|
40483
40544
|
if (!cell2.sub) return 0;
|
|
40484
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
40545
|
+
const hit = _optionalChain([memo, 'optionalAccess', _936 => _936.cell, 'access', _937 => _937.get, 'call', _938 => _938(cell2.el)]);
|
|
40485
40546
|
if (hit !== void 0) return hit;
|
|
40486
40547
|
let ext = 0;
|
|
40487
40548
|
for (const p of elements(cell2.sub)) {
|
|
40488
40549
|
if (ln(p) !== "p") continue;
|
|
40489
40550
|
const m = buildPara(p);
|
|
40490
40551
|
for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
|
|
40491
|
-
const baseV = _nullishCoalesce(_optionalChain([m, 'access',
|
|
40552
|
+
const baseV = _nullishCoalesce(_optionalChain([m, 'access', _939 => _939.segs, 'access', _940 => _940[0], 'optionalAccess', _941 => _941.vertpos]), () => ( 0));
|
|
40492
40553
|
for (const o of m.objs) {
|
|
40493
40554
|
if (o.inline) {
|
|
40494
40555
|
const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
@@ -40496,14 +40557,14 @@ function cellContentExtent(cell2, memo) {
|
|
|
40496
40557
|
continue;
|
|
40497
40558
|
}
|
|
40498
40559
|
const pos = findChildByLocalName(o.el, "pos");
|
|
40499
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
40560
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _942 => _942.getAttribute, 'call', _943 => _943("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
40500
40561
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
40501
40562
|
const pushed = baseV - (num2(om, "top") + o.height + num2(om, "bottom"));
|
|
40502
40563
|
const anchor = pushed >= -100 ? pushed : baseV;
|
|
40503
40564
|
ext = Math.max(ext, anchor + num2(om, "top") + num2(pos, "vertOffset") + o.height);
|
|
40504
40565
|
}
|
|
40505
40566
|
}
|
|
40506
|
-
_optionalChain([memo, 'optionalAccess',
|
|
40567
|
+
_optionalChain([memo, 'optionalAccess', _944 => _944.cell, 'access', _945 => _945.set, 'call', _946 => _946(cell2.el, ext)]);
|
|
40507
40568
|
return ext;
|
|
40508
40569
|
}
|
|
40509
40570
|
function collectCells(tbl2) {
|
|
@@ -40541,7 +40602,7 @@ function collectCells(tbl2) {
|
|
|
40541
40602
|
return cells;
|
|
40542
40603
|
}
|
|
40543
40604
|
function measureTableHeight(tbl2, memo) {
|
|
40544
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
40605
|
+
const hit = _optionalChain([memo, 'optionalAccess', _947 => _947.table, 'access', _948 => _948.get, 'call', _949 => _949(tbl2)]);
|
|
40545
40606
|
if (hit !== void 0) return hit;
|
|
40546
40607
|
const cells = collectCells(tbl2);
|
|
40547
40608
|
if (cells.length === 0 || cells.length > 4096) return 0;
|
|
@@ -40552,7 +40613,7 @@ function measureTableHeight(tbl2, memo) {
|
|
|
40552
40613
|
);
|
|
40553
40614
|
let sum = 0;
|
|
40554
40615
|
for (const h of rowH) sum += h;
|
|
40555
|
-
_optionalChain([memo, 'optionalAccess',
|
|
40616
|
+
_optionalChain([memo, 'optionalAccess', _950 => _950.table, 'access', _951 => _951.set, 'call', _952 => _952(tbl2, sum)]);
|
|
40556
40617
|
return sum;
|
|
40557
40618
|
}
|
|
40558
40619
|
|
|
@@ -40667,7 +40728,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode) {
|
|
|
40667
40728
|
}
|
|
40668
40729
|
const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
|
|
40669
40730
|
if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
|
|
40670
|
-
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
40731
|
+
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _953 => _953.getAttribute, 'call', _954 => _954("vertRelTo")]), () => ( "PARA"));
|
|
40671
40732
|
if (vertRel === "PAGE" || vertRel === "PAPER") continue;
|
|
40672
40733
|
const vo = Math.max(0, num3(pos, "vertOffset"));
|
|
40673
40734
|
if (wrapAttr === "TOP_AND_BOTTOM") {
|
|
@@ -40728,7 +40789,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
40728
40789
|
if (ln2(p) !== "p") continue;
|
|
40729
40790
|
reflowTablesIn(p, doc, styles, mode, counter);
|
|
40730
40791
|
const g3 = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
40731
|
-
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
40792
|
+
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _955 => _955.spaceBefore]), () => ( 0)));
|
|
40732
40793
|
const res = reflowPara(p, doc, styles, areaW, startV, mode);
|
|
40733
40794
|
if (!res) {
|
|
40734
40795
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
@@ -40741,7 +40802,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
40741
40802
|
}
|
|
40742
40803
|
if (Number.isFinite(bottom)) {
|
|
40743
40804
|
cursorV = bottom;
|
|
40744
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
40805
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _956 => _956.spaceAfter]), () => ( 0));
|
|
40745
40806
|
}
|
|
40746
40807
|
}
|
|
40747
40808
|
continue;
|
|
@@ -40802,7 +40863,7 @@ function pageStories(root, masters, paraPages, pageCount, pageBase, geom) {
|
|
|
40802
40863
|
const declarations = [];
|
|
40803
40864
|
const hidden = /* @__PURE__ */ new Map();
|
|
40804
40865
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
40805
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
40866
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _957 => _957.get, 'call', _958 => _958(p), 'optionalAccess', _959 => _959[0]]), () => ( 0));
|
|
40806
40867
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
40807
40868
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
40808
40869
|
for (const el of elements(ctrl)) {
|
|
@@ -40822,7 +40883,7 @@ function pageStories(root, masters, paraPages, pageCount, pageBase, geom) {
|
|
|
40822
40883
|
const out = [];
|
|
40823
40884
|
for (let page = 0; page < pageCount; page++) {
|
|
40824
40885
|
const n = pageBase + page + 1;
|
|
40825
|
-
const hides = (name) => _optionalChain([hidden, 'access',
|
|
40886
|
+
const hides = (name) => _optionalChain([hidden, 'access', _960 => _960.get, 'call', _961 => _961(page), 'optionalAccess', _962 => _962.has, 'call', _963 => _963(name)]) === true || page === 0 && num2(visibility, `hideFirst${name}`) !== 0;
|
|
40826
40887
|
if (!hides("MasterPage")) {
|
|
40827
40888
|
const matching = masters.filter((m) => m.getAttribute("type") === (n % 2 ? "ODD" : "EVEN"));
|
|
40828
40889
|
const both = masters.filter((m) => (m.getAttribute("type") || "BOTH") === "BOTH");
|
|
@@ -40900,7 +40961,7 @@ function objectGeometry(el, x, y, w, h, boxW = w, boxH = h) {
|
|
|
40900
40961
|
function shapeFill(el, defs, images, warn) {
|
|
40901
40962
|
const brush = findChildByLocalName(el, "fillBrush");
|
|
40902
40963
|
const win = brush && findChildByLocalName(brush, "winBrush");
|
|
40903
|
-
const face = _optionalChain([win, 'optionalAccess',
|
|
40964
|
+
const face = _optionalChain([win, 'optionalAccess', _964 => _964.getAttribute, 'call', _965 => _965("faceColor")]);
|
|
40904
40965
|
if (face && face.toLowerCase() !== "none") return esc(face);
|
|
40905
40966
|
const grad = brush && findChildByLocalName(brush, "gradation");
|
|
40906
40967
|
if (grad) {
|
|
@@ -40951,8 +41012,8 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
|
|
|
40951
41012
|
const geometry = local ? { x: boxX, y: boxY, w, h, bbox: { x: boxX, y: boxY, w, h }, transform: "" } : objectGeometry(el, boxX, boxY, w, h, o.width || w, o.height || h);
|
|
40952
41013
|
const { x, y } = geometry;
|
|
40953
41014
|
const sx = ow > 0 ? w / ow : 1, sy = oh > 0 ? h / oh : 1;
|
|
40954
|
-
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
40955
|
-
const color = esc(_optionalChain([line, 'optionalAccess',
|
|
41015
|
+
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess', _966 => _966.getAttribute, 'call', _967 => _967("style")]), () => ( "SOLID"));
|
|
41016
|
+
const color = esc(_optionalChain([line, 'optionalAccess', _968 => _968.getAttribute, 'call', _969 => _969("color")]) || "#000000");
|
|
40956
41017
|
const strokeW = style === "NONE" ? 0 : Math.max(0.2, num2(line, "width", 33) / 100 * 2.834645);
|
|
40957
41018
|
const dash = /DASH|DOT/.test(style) ? ` stroke-dasharray="${style.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
40958
41019
|
const keepWidth = local ? ` vector-effect="non-scaling-stroke"` : "";
|
|
@@ -41033,7 +41094,7 @@ function planLines(m, styles) {
|
|
|
41033
41094
|
const start = seg.textpos;
|
|
41034
41095
|
const end = i + 1 < m.segs.length ? m.segs[i + 1].textpos : Math.max(m.chars.length, start);
|
|
41035
41096
|
const tabs = /* @__PURE__ */ new Map();
|
|
41036
|
-
let x = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
41097
|
+
let x = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _970 => _970.marginIntent]), () => ( 0)), 0) : hang;
|
|
41037
41098
|
let fixedTo = start;
|
|
41038
41099
|
let fixedW = 0;
|
|
41039
41100
|
for (let k = start; k < end && k < m.chars.length; k++) {
|
|
@@ -41393,7 +41454,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
41393
41454
|
}));
|
|
41394
41455
|
for (const g3 of geom) {
|
|
41395
41456
|
const bf = g3.c.bfId != null ? ctx.styles.borderFill.get(g3.c.bfId) : void 0;
|
|
41396
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
41457
|
+
if (_optionalChain([bf, 'optionalAccess', _971 => _971.fill])) emit(ctx, `<rect x="${pt2(g3.x)}" y="${pt2(g3.y)}" width="${pt2(g3.w)}" height="${pt2(g3.h)}" fill="${escapeXml7(bf.fill)}"/>`);
|
|
41397
41458
|
}
|
|
41398
41459
|
for (const g3 of geom) {
|
|
41399
41460
|
const { c } = g3;
|
|
@@ -41446,7 +41507,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
41446
41507
|
}
|
|
41447
41508
|
function drawPicFrame(pic, x, y, w, h, transform, ctx) {
|
|
41448
41509
|
const img = findFirst(pic, "img");
|
|
41449
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
41510
|
+
const ref = _optionalChain([img, 'optionalAccess', _972 => _972.getAttribute, 'call', _973 => _973("binaryItemIDRef")]);
|
|
41450
41511
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
41451
41512
|
const imgId = ctx.regions.add("image", bboxOf(ctx, x, y, w, h), { sourceId: _nullishCoalesce(ref, () => ( void 0)), parentId: parentId(ctx) });
|
|
41452
41513
|
emit(ctx, regionOpenTag(imgId, "image", pageNo(ctx)));
|
|
@@ -41492,7 +41553,7 @@ function readSectionGeom(root) {
|
|
|
41492
41553
|
const pagePr = findFirst(root, "pagePr");
|
|
41493
41554
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
41494
41555
|
let PW = num2(pagePr, "width", 59528), PH = num2(pagePr, "height", 84188);
|
|
41495
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
41556
|
+
if (_optionalChain([pagePr, 'optionalAccess', _974 => _974.getAttribute, 'call', _975 => _975("landscape")]) === "NARROWLY" && PW < PH) {
|
|
41496
41557
|
const t = PW;
|
|
41497
41558
|
PW = PH;
|
|
41498
41559
|
PH = t;
|
|
@@ -41595,22 +41656,22 @@ function renderSectionRoots(sections, input) {
|
|
|
41595
41656
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
41596
41657
|
ctxBase.pageBase += pages.length;
|
|
41597
41658
|
}
|
|
41598
|
-
if (rendered.length === 0) throw new (0,
|
|
41659
|
+
if (rendered.length === 0) throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
41599
41660
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
41600
41661
|
}
|
|
41601
41662
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
41602
41663
|
async function renderHwpxInternal(input, options) {
|
|
41603
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
41664
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _976 => _976.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
41604
41665
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
41605
|
-
|
|
41666
|
+
_chunkGUU7OHIHcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
41606
41667
|
let zip;
|
|
41607
41668
|
try {
|
|
41608
41669
|
zip = await _jszip2.default.loadAsync(input);
|
|
41609
|
-
} catch (
|
|
41610
|
-
throw new (0,
|
|
41670
|
+
} catch (e43) {
|
|
41671
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
41611
41672
|
}
|
|
41612
41673
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
41613
|
-
if (secFiles.length === 0) throw new (0,
|
|
41674
|
+
if (secFiles.length === 0) throw new (0, _chunkGUU7OHIHcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
41614
41675
|
const warnings = [];
|
|
41615
41676
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
41616
41677
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -41618,14 +41679,14 @@ async function renderHwpxInternal(input, options) {
|
|
|
41618
41679
|
const secXmls = [];
|
|
41619
41680
|
for (const f of secFiles) {
|
|
41620
41681
|
const xml = await f.async("string");
|
|
41621
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
41682
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
41622
41683
|
secXmls.push(xml);
|
|
41623
41684
|
}
|
|
41624
41685
|
const masterPages = /* @__PURE__ */ new Map();
|
|
41625
41686
|
const masterXmls = [];
|
|
41626
41687
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
41627
41688
|
const xml = await file.async("string");
|
|
41628
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
41689
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uBC14\uD0D5\uCABD XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
41629
41690
|
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
41630
41691
|
if (root && ln(root) === "masterPage") {
|
|
41631
41692
|
masterPages.set(root.getAttribute("id") || file.name.replace(/^.*\/|\.xml$/g, ""), root);
|
|
@@ -41653,7 +41714,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
41653
41714
|
let href = binmap.get(ref);
|
|
41654
41715
|
if (!href) {
|
|
41655
41716
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
41656
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
41717
|
+
href = _optionalChain([cand, 'optionalAccess', _977 => _977.name]);
|
|
41657
41718
|
}
|
|
41658
41719
|
if (!href) continue;
|
|
41659
41720
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -41675,7 +41736,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
41675
41736
|
for (let si = 0; si < secXmls.length; si++) {
|
|
41676
41737
|
const secXml = secXmls[si];
|
|
41677
41738
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
41678
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
41739
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _978 => _978.reflow])) {
|
|
41679
41740
|
noCacheSkipped = true;
|
|
41680
41741
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
41681
41742
|
continue;
|
|
@@ -41692,11 +41753,11 @@ async function renderHwpxInternal(input, options) {
|
|
|
41692
41753
|
}
|
|
41693
41754
|
if (roots.length === 0) {
|
|
41694
41755
|
if (noCacheSkipped) {
|
|
41695
|
-
throw new (0,
|
|
41756
|
+
throw new (0, _chunkGUU7OHIHcjs.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)");
|
|
41696
41757
|
}
|
|
41697
|
-
throw new (0,
|
|
41758
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
41698
41759
|
}
|
|
41699
|
-
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
41760
|
+
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _979 => _979.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _980 => _980.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _981 => _981.highlights]) });
|
|
41700
41761
|
}
|
|
41701
41762
|
async function renderHwpxToSvg(input, options) {
|
|
41702
41763
|
const r = await renderHwpxInternal(input, options);
|
|
@@ -41916,7 +41977,7 @@ var FOLD_END = 42124;
|
|
|
41916
41977
|
var FOLD_SHIFT = 983040 - 40960;
|
|
41917
41978
|
function textChar(ch) {
|
|
41918
41979
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
41919
|
-
const mapped =
|
|
41980
|
+
const mapped = _chunkEVPP2BSOcjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
41920
41981
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
41921
41982
|
}
|
|
41922
41983
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -42006,7 +42067,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
42006
42067
|
out += run.join("") + "</hp:run>";
|
|
42007
42068
|
run = [];
|
|
42008
42069
|
};
|
|
42009
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
42070
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _982 => _982[0], 'optionalAccess', _983 => _983[1]]), () => ( 0)));
|
|
42010
42071
|
let pos = 0, ctrlIdx = 0, o = 0;
|
|
42011
42072
|
const switchShape = () => {
|
|
42012
42073
|
while (shapeIdx + 1 < shapes.length && pos >= shapes[shapeIdx + 1][0]) {
|
|
@@ -42092,7 +42153,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
42092
42153
|
closeRun();
|
|
42093
42154
|
const rest = ctrls.filter((c) => !c.used && (c.id === CTRL_TBL3 || c.id === CTRL_GSO3 || c.id === CTRL_SECD2 || c.id === CTRL_COLD2));
|
|
42094
42155
|
if (rest.length > 0) {
|
|
42095
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
42156
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _984 => _984[0], 'optionalAccess', _985 => _985[1]]), () => ( 0)));
|
|
42096
42157
|
for (const c of rest) {
|
|
42097
42158
|
const el = ctrlElement(ctrls.indexOf(c), c.id);
|
|
42098
42159
|
run.push(el);
|
|
@@ -42247,14 +42308,14 @@ function hwp5SectionToXml(records, ctx) {
|
|
|
42247
42308
|
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>";
|
|
42248
42309
|
}
|
|
42249
42310
|
function renderHwp5Records(docInfo, styles, secRecords, binData, options, select, warnings = []) {
|
|
42250
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
42311
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _986 => _986.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
42251
42312
|
const MAX_TOTAL_IMAGE_BYTES = 128 * 1024 * 1024;
|
|
42252
42313
|
const images = /* @__PURE__ */ new Map();
|
|
42253
42314
|
let totalImgBytes = 0;
|
|
42254
42315
|
const imageRef = (binDataId) => {
|
|
42255
42316
|
if (binDataId <= 0) return null;
|
|
42256
|
-
const item = _optionalChain([docInfo, 'optionalAccess',
|
|
42257
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
42317
|
+
const item = _optionalChain([docInfo, 'optionalAccess', _987 => _987.binData, 'access', _988 => _988[binDataId - 1]]);
|
|
42318
|
+
if (_optionalChain([item, 'optionalAccess', _989 => _989.kind]) === "link") return null;
|
|
42258
42319
|
const storageId = item && item.storageId > 0 ? item.storageId : binDataId;
|
|
42259
42320
|
const ref = `bin${storageId}`;
|
|
42260
42321
|
if (images.has(ref)) return ref;
|
|
@@ -42288,8 +42349,8 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
42288
42349
|
}
|
|
42289
42350
|
roots.push({ root, index: si });
|
|
42290
42351
|
}
|
|
42291
|
-
if (roots.length === 0) throw new (0,
|
|
42292
|
-
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
42352
|
+
if (roots.length === 0) throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
42353
|
+
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _990 => _990.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _991 => _991.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _992 => _992.highlights]) });
|
|
42293
42354
|
return assemblePageSvgs(r, "hwp", select);
|
|
42294
42355
|
}
|
|
42295
42356
|
function renderHwp5Pages(input, options, select) {
|
|
@@ -42301,7 +42362,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
42301
42362
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
42302
42363
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
42303
42364
|
const sections = readHwp5SectionStreams(c);
|
|
42304
|
-
if (sections.length === 0) throw new (0,
|
|
42365
|
+
if (sections.length === 0) throw new (0, _chunkGUU7OHIHcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42305
42366
|
const parseWarnings = [];
|
|
42306
42367
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
42307
42368
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -42363,7 +42424,7 @@ async function probeDensityExponent(sharp) {
|
|
|
42363
42424
|
const k = pngWidth(png) / 100;
|
|
42364
42425
|
const e = k > 0 ? Math.log(k) / Math.log(2) : 1;
|
|
42365
42426
|
densityExponent = Number.isFinite(e) && e > 0.5 ? Math.round(e * 4) / 4 : 1;
|
|
42366
|
-
} catch (
|
|
42427
|
+
} catch (e44) {
|
|
42367
42428
|
densityExponent = 1;
|
|
42368
42429
|
}
|
|
42369
42430
|
return densityExponent;
|
|
@@ -42377,7 +42438,7 @@ async function actualSize(sharp, data, fallbackW, fallbackH) {
|
|
|
42377
42438
|
try {
|
|
42378
42439
|
const m = await sharp(data).metadata();
|
|
42379
42440
|
if (m.width && m.height) return { w: m.width, h: m.height };
|
|
42380
|
-
} catch (
|
|
42441
|
+
} catch (e45) {
|
|
42381
42442
|
}
|
|
42382
42443
|
return { w: fallbackW, h: fallbackH };
|
|
42383
42444
|
}
|
|
@@ -42385,15 +42446,15 @@ async function loadSharp() {
|
|
|
42385
42446
|
try {
|
|
42386
42447
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
42387
42448
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
42388
|
-
} catch (
|
|
42389
|
-
throw new (0,
|
|
42390
|
-
'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.' +
|
|
42449
|
+
} catch (e46) {
|
|
42450
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(
|
|
42451
|
+
'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.' + _chunkGUU7OHIHcjs.OPTIONAL_DEP_INSTALL_HINT
|
|
42391
42452
|
);
|
|
42392
42453
|
}
|
|
42393
42454
|
}
|
|
42394
42455
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
42395
42456
|
const sharp = await loadSharp();
|
|
42396
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
42457
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkGUU7OHIHcjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
42397
42458
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
42398
42459
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
42399
42460
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -42410,12 +42471,12 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
42410
42471
|
let puppeteer;
|
|
42411
42472
|
try {
|
|
42412
42473
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
42413
|
-
} catch (
|
|
42414
|
-
throw new (0,
|
|
42474
|
+
} catch (e47) {
|
|
42475
|
+
throw new (0, _chunkGUU7OHIHcjs.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");
|
|
42415
42476
|
}
|
|
42416
42477
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
42417
42478
|
if (!executablePath) {
|
|
42418
|
-
throw new (0,
|
|
42479
|
+
throw new (0, _chunkGUU7OHIHcjs.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");
|
|
42419
42480
|
}
|
|
42420
42481
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
42421
42482
|
try {
|
|
@@ -42431,13 +42492,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
42431
42492
|
async function loadBuffer(input) {
|
|
42432
42493
|
if (typeof input === "string") {
|
|
42433
42494
|
try {
|
|
42434
|
-
return
|
|
42495
|
+
return _chunkGUU7OHIHcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
42435
42496
|
} catch (err) {
|
|
42436
42497
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
42437
|
-
throw new (0,
|
|
42498
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
42438
42499
|
}
|
|
42439
42500
|
}
|
|
42440
|
-
if (Buffer.isBuffer(input)) return
|
|
42501
|
+
if (Buffer.isBuffer(input)) return _chunkGUU7OHIHcjs.toArrayBuffer.call(void 0, input);
|
|
42441
42502
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
42442
42503
|
return input;
|
|
42443
42504
|
}
|
|
@@ -42446,17 +42507,17 @@ async function sourceFormatOf(buffer) {
|
|
|
42446
42507
|
if (format2 === "hwpx") {
|
|
42447
42508
|
const zip = await detectZipFormat(buffer);
|
|
42448
42509
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
42449
|
-
throw new (0,
|
|
42510
|
+
throw new (0, _chunkGUU7OHIHcjs.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`);
|
|
42450
42511
|
}
|
|
42451
42512
|
if (format2 === "hwp") return "hwp";
|
|
42452
|
-
throw new (0,
|
|
42513
|
+
throw new (0, _chunkGUU7OHIHcjs.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`);
|
|
42453
42514
|
}
|
|
42454
42515
|
async function renderDocumentToScene(input, options = {}) {
|
|
42455
42516
|
const buffer = await loadBuffer(input);
|
|
42456
42517
|
const source = await sourceFormatOf(buffer);
|
|
42457
42518
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
42458
42519
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
42459
|
-
if (set.size === 0) throw new (0,
|
|
42520
|
+
if (set.size === 0) throw new (0, _chunkGUU7OHIHcjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
42460
42521
|
return set;
|
|
42461
42522
|
} : void 0;
|
|
42462
42523
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -42492,7 +42553,7 @@ async function renderDocument(input, options) {
|
|
|
42492
42553
|
break;
|
|
42493
42554
|
}
|
|
42494
42555
|
default:
|
|
42495
|
-
throw new (0,
|
|
42556
|
+
throw new (0, _chunkGUU7OHIHcjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
42496
42557
|
}
|
|
42497
42558
|
return { scene, assets };
|
|
42498
42559
|
}
|
|
@@ -42522,7 +42583,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
42522
42583
|
const out = [];
|
|
42523
42584
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
42524
42585
|
const meta = scene.pages.find((p) => p.page === page);
|
|
42525
|
-
if (!meta) throw new (0,
|
|
42586
|
+
if (!meta) throw new (0, _chunkGUU7OHIHcjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
42526
42587
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
42527
42588
|
for (const { region, bbox } of items) {
|
|
42528
42589
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -42546,9 +42607,9 @@ function wantsCrop(kind, policy) {
|
|
|
42546
42607
|
}
|
|
42547
42608
|
async function extractTables(input, options = {}) {
|
|
42548
42609
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
42549
|
-
const buffer = typeof input === "string" ?
|
|
42610
|
+
const buffer = typeof input === "string" ? _chunkGUU7OHIHcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkGUU7OHIHcjs.toArrayBuffer.call(void 0, input) : input;
|
|
42550
42611
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
42551
|
-
if (!parsed.success) throw new (0,
|
|
42612
|
+
if (!parsed.success) throw new (0, _chunkGUU7OHIHcjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
42552
42613
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
42553
42614
|
const out = blocks.map((b, i) => ({
|
|
42554
42615
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -42606,20 +42667,20 @@ async function extractTables(input, options = {}) {
|
|
|
42606
42667
|
// src/index.ts
|
|
42607
42668
|
async function parse(input, options) {
|
|
42608
42669
|
let buffer;
|
|
42609
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
42610
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
42670
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _993 => _993.filePath]) ? { ...options, filePath: input } : options;
|
|
42671
|
+
if (_optionalChain([opts, 'optionalAccess', _994 => _994.htmlTables]) && opts.tableFormat) {
|
|
42611
42672
|
return { success: false, fileType: "unknown", error: "htmlTables \uC640 tableFormat \uC740 \uD568\uAED8 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4" };
|
|
42612
42673
|
}
|
|
42613
42674
|
if (typeof input === "string") {
|
|
42614
42675
|
try {
|
|
42615
42676
|
const buf = await _promises.readFile.call(void 0, input);
|
|
42616
|
-
buffer =
|
|
42677
|
+
buffer = _chunkGUU7OHIHcjs.toArrayBuffer.call(void 0, buf);
|
|
42617
42678
|
} catch (err) {
|
|
42618
42679
|
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}`;
|
|
42619
|
-
return { success: false, fileType: "unknown", error: msg2, code:
|
|
42680
|
+
return { success: false, fileType: "unknown", error: msg2, code: _chunkGUU7OHIHcjs.classifyError.call(void 0, err) };
|
|
42620
42681
|
}
|
|
42621
42682
|
} else if (Buffer.isBuffer(input)) {
|
|
42622
|
-
buffer =
|
|
42683
|
+
buffer = _chunkGUU7OHIHcjs.toArrayBuffer.call(void 0, input);
|
|
42623
42684
|
} else {
|
|
42624
42685
|
buffer = input;
|
|
42625
42686
|
}
|
|
@@ -42628,23 +42689,23 @@ async function parse(input, options) {
|
|
|
42628
42689
|
}
|
|
42629
42690
|
const format2 = detectFormat(buffer);
|
|
42630
42691
|
const result = await dispatch(format2, buffer, opts);
|
|
42631
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
42692
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _995 => _995.images]) === false) {
|
|
42632
42693
|
delete result.images;
|
|
42633
42694
|
dropImageBytes(result.blocks);
|
|
42634
42695
|
}
|
|
42635
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
42696
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _996 => _996.classifyTables])) classifyTableTree(result.blocks);
|
|
42636
42697
|
let out = result;
|
|
42637
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
42698
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _997 => _997.pages]) && result.pageCount && _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, opts.pages, result.pageCount).size === 0) {
|
|
42638
42699
|
out = { ...result, warnings: [..._nullishCoalesce(result.warnings, () => ( [])), { code: "PARTIAL_PARSE", message: `\uC694\uCCAD\uD55C \uCABD \uBC94\uC704(${opts.pages})\uAC00 \uBB38\uC11C \uCABD(1~${result.pageCount})\uACFC \uACB9\uCE58\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4` }] };
|
|
42639
42700
|
}
|
|
42640
42701
|
if (out.success && !out.pages) {
|
|
42641
|
-
const pages =
|
|
42702
|
+
const pages = _chunkY7XHHV55cjs.blocksToPages.call(void 0, out.blocks, (bs) => _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([opts, 'optionalAccess', _998 => _998.tableFormat]) }));
|
|
42642
42703
|
if (pages) out = { ...out, pages };
|
|
42643
42704
|
}
|
|
42644
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
42705
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _999 => _999.plain])) {
|
|
42645
42706
|
out = { ...out, markdown: toPlainMarkdown(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toPlainMarkdown(p.markdown) })) } : {} };
|
|
42646
42707
|
}
|
|
42647
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
42708
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1000 => _1000.htmlTables])) {
|
|
42648
42709
|
out = { ...out, markdown: toHtmlTables(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toHtmlTables(p.markdown) })) } : {} };
|
|
42649
42710
|
}
|
|
42650
42711
|
return out;
|
|
@@ -42686,46 +42747,60 @@ async function dispatch(format2, buffer, opts) {
|
|
|
42686
42747
|
return { success: false, fileType: "unknown", error: "\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD615\uC2DD\uC785\uB2C8\uB2E4.", code: "UNSUPPORTED_FORMAT" };
|
|
42687
42748
|
}
|
|
42688
42749
|
}
|
|
42750
|
+
async function withEmbeddedImageOcr(blocks, markdown, warnings, images, options) {
|
|
42751
|
+
const list = [..._nullishCoalesce(warnings, () => ( []))];
|
|
42752
|
+
if (!await ocrEmbeddedImages(blocks, options, list)) return { markdown, warnings: list.length ? list : void 0 };
|
|
42753
|
+
let md2 = _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1001 => _1001.tableFormat]) });
|
|
42754
|
+
if (_optionalChain([options, 'optionalAccess', _1002 => _1002.inlineImages]) && options.images !== false && _optionalChain([images, 'optionalAccess', _1003 => _1003.length])) {
|
|
42755
|
+
try {
|
|
42756
|
+
md2 = _chunkY7XHHV55cjs.inlineImagesIntoMarkdown.call(void 0, md2, images, { compress: true });
|
|
42757
|
+
} catch (e48) {
|
|
42758
|
+
}
|
|
42759
|
+
}
|
|
42760
|
+
return { markdown: md2, warnings: list.length ? list : void 0 };
|
|
42761
|
+
}
|
|
42689
42762
|
function scriptsOff(r, off) {
|
|
42690
|
-
return off ?
|
|
42763
|
+
return off ? _chunkEVPP2BSOcjs.stripScriptTags.call(void 0, r) : r;
|
|
42691
42764
|
}
|
|
42692
42765
|
async function parseImage(buffer, options) {
|
|
42693
42766
|
try {
|
|
42694
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
42767
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-HJM5IJKU.cjs")));
|
|
42695
42768
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
42696
|
-
|
|
42769
|
+
_chunkEVPP2BSOcjs.stripScriptTags.call(void 0, { blocks });
|
|
42697
42770
|
return {
|
|
42698
42771
|
success: true,
|
|
42699
42772
|
fileType: "image",
|
|
42700
|
-
markdown:
|
|
42773
|
+
markdown: _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1004 => _1004.tableFormat]) }),
|
|
42701
42774
|
blocks,
|
|
42702
42775
|
warnings: warnings.length ? warnings : void 0,
|
|
42703
42776
|
pageCount: 1
|
|
42704
42777
|
};
|
|
42705
42778
|
} catch (err) {
|
|
42706
|
-
return { success: false, fileType: "image", error:
|
|
42779
|
+
return { success: false, fileType: "image", error: _chunkGUU7OHIHcjs.sanitizeError.call(void 0, err), code: _chunkGUU7OHIHcjs.classifyError.call(void 0, err) };
|
|
42707
42780
|
}
|
|
42708
42781
|
}
|
|
42709
42782
|
async function parseHwp3(buffer, options) {
|
|
42710
42783
|
try {
|
|
42711
42784
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp3Document(buffer, options);
|
|
42712
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
42785
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess', _1005 => _1005.pageCount]) };
|
|
42713
42786
|
} catch (err) {
|
|
42714
|
-
return { success: false, fileType: "hwp3", error:
|
|
42787
|
+
return { success: false, fileType: "hwp3", error: _chunkGUU7OHIHcjs.sanitizeError.call(void 0, err), code: _chunkGUU7OHIHcjs.classifyError.call(void 0, err) };
|
|
42715
42788
|
}
|
|
42716
42789
|
}
|
|
42717
42790
|
async function parseHwpx(buffer, options) {
|
|
42718
42791
|
try {
|
|
42719
|
-
const
|
|
42720
|
-
|
|
42792
|
+
const doc = await parseHwpxDocument(buffer, options);
|
|
42793
|
+
const { blocks, metadata, outline, images } = doc;
|
|
42794
|
+
const { markdown, warnings } = await withEmbeddedImageOcr(blocks, doc.markdown, doc.warnings, void 0, options);
|
|
42795
|
+
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1006 => _1006.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1007 => _1007.pageCount]) }, _optionalChain([options, 'optionalAccess', _1008 => _1008.scriptTags]) === false);
|
|
42721
42796
|
} catch (err) {
|
|
42722
|
-
return { success: false, fileType: "hwpx", error:
|
|
42797
|
+
return { success: false, fileType: "hwpx", error: _chunkGUU7OHIHcjs.sanitizeError.call(void 0, err), code: _chunkGUU7OHIHcjs.classifyError.call(void 0, err) };
|
|
42723
42798
|
}
|
|
42724
42799
|
}
|
|
42725
42800
|
async function parseHwp(buffer, options) {
|
|
42726
42801
|
try {
|
|
42727
42802
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
42728
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
42803
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _1009 => _1009.filePath])) {
|
|
42729
42804
|
try {
|
|
42730
42805
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
42731
42806
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -42740,20 +42815,21 @@ async function parseHwp(buffer, options) {
|
|
|
42740
42815
|
pageCount
|
|
42741
42816
|
};
|
|
42742
42817
|
}
|
|
42743
|
-
} catch (
|
|
42818
|
+
} catch (e49) {
|
|
42744
42819
|
}
|
|
42745
42820
|
}
|
|
42746
|
-
|
|
42821
|
+
const ocred = await withEmbeddedImageOcr(blocks, markdown, warnings, images, options);
|
|
42822
|
+
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess', _1010 => _1010.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1011 => _1011.pageCount]) }, _optionalChain([options, 'optionalAccess', _1012 => _1012.scriptTags]) === false);
|
|
42747
42823
|
} catch (err) {
|
|
42748
|
-
return { success: false, fileType: "hwp", error:
|
|
42824
|
+
return { success: false, fileType: "hwp", error: _chunkGUU7OHIHcjs.sanitizeError.call(void 0, err), code: _chunkGUU7OHIHcjs.classifyError.call(void 0, err) };
|
|
42749
42825
|
}
|
|
42750
42826
|
}
|
|
42751
42827
|
async function parsePdf(buffer, options) {
|
|
42752
42828
|
let parsePdfDocument;
|
|
42753
42829
|
try {
|
|
42754
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
42830
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-J6M4WG3I.cjs")));
|
|
42755
42831
|
parsePdfDocument = mod.parsePdfDocument;
|
|
42756
|
-
} catch (
|
|
42832
|
+
} catch (e50) {
|
|
42757
42833
|
return {
|
|
42758
42834
|
success: false,
|
|
42759
42835
|
fileType: "pdf",
|
|
@@ -42763,59 +42839,59 @@ async function parsePdf(buffer, options) {
|
|
|
42763
42839
|
}
|
|
42764
42840
|
try {
|
|
42765
42841
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages } = await parsePdfDocument(buffer, options);
|
|
42766
|
-
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
42842
|
+
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _1013 => _1013.pageCount]) }, _optionalChain([options, 'optionalAccess', _1014 => _1014.scriptTags]) !== true);
|
|
42767
42843
|
} catch (err) {
|
|
42768
42844
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
42769
|
-
return { success: false, fileType: "pdf", error:
|
|
42845
|
+
return { success: false, fileType: "pdf", error: _chunkGUU7OHIHcjs.sanitizeError.call(void 0, err), code: _chunkGUU7OHIHcjs.classifyError.call(void 0, err), isImageBased };
|
|
42770
42846
|
}
|
|
42771
42847
|
}
|
|
42772
42848
|
async function parseXlsx(buffer, options) {
|
|
42773
42849
|
try {
|
|
42774
42850
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
42775
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
42851
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1015 => _1015.pageCount]) };
|
|
42776
42852
|
} catch (err) {
|
|
42777
|
-
return { success: false, fileType: "xlsx", error:
|
|
42853
|
+
return { success: false, fileType: "xlsx", error: _chunkGUU7OHIHcjs.sanitizeError.call(void 0, err), code: _chunkGUU7OHIHcjs.classifyError.call(void 0, err) };
|
|
42778
42854
|
}
|
|
42779
42855
|
}
|
|
42780
42856
|
async function parseXls(buffer, options) {
|
|
42781
42857
|
try {
|
|
42782
42858
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
42783
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
42859
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1016 => _1016.pageCount]) };
|
|
42784
42860
|
} catch (err) {
|
|
42785
|
-
return { success: false, fileType: "xls", error:
|
|
42861
|
+
return { success: false, fileType: "xls", error: _chunkGUU7OHIHcjs.sanitizeError.call(void 0, err), code: _chunkGUU7OHIHcjs.classifyError.call(void 0, err) };
|
|
42786
42862
|
}
|
|
42787
42863
|
}
|
|
42788
42864
|
async function parseDocx(buffer, options) {
|
|
42789
42865
|
try {
|
|
42790
42866
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
42791
|
-
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
42867
|
+
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1017 => _1017.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1018 => _1018.pageCount]) }, _optionalChain([options, 'optionalAccess', _1019 => _1019.scriptTags]) === false);
|
|
42792
42868
|
} catch (err) {
|
|
42793
|
-
return { success: false, fileType: "docx", error:
|
|
42869
|
+
return { success: false, fileType: "docx", error: _chunkGUU7OHIHcjs.sanitizeError.call(void 0, err), code: _chunkGUU7OHIHcjs.classifyError.call(void 0, err) };
|
|
42794
42870
|
}
|
|
42795
42871
|
}
|
|
42796
42872
|
async function parsePptx(buffer, options) {
|
|
42797
42873
|
try {
|
|
42798
42874
|
const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
|
|
42799
|
-
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
42875
|
+
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1020 => _1020.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1021 => _1021.pageCount]) }, _optionalChain([options, 'optionalAccess', _1022 => _1022.scriptTags]) === false);
|
|
42800
42876
|
} catch (err) {
|
|
42801
|
-
return { success: false, fileType: "pptx", error:
|
|
42877
|
+
return { success: false, fileType: "pptx", error: _chunkGUU7OHIHcjs.sanitizeError.call(void 0, err), code: _chunkGUU7OHIHcjs.classifyError.call(void 0, err) };
|
|
42802
42878
|
}
|
|
42803
42879
|
}
|
|
42804
42880
|
async function parseHwpml(buffer, options) {
|
|
42805
42881
|
try {
|
|
42806
42882
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
42807
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
42883
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1023 => _1023.pageCount]) };
|
|
42808
42884
|
} catch (err) {
|
|
42809
|
-
return { success: false, fileType: "hwpml", error:
|
|
42885
|
+
return { success: false, fileType: "hwpml", error: _chunkGUU7OHIHcjs.sanitizeError.call(void 0, err), code: _chunkGUU7OHIHcjs.classifyError.call(void 0, err) };
|
|
42810
42886
|
}
|
|
42811
42887
|
}
|
|
42812
42888
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
42813
42889
|
let buffer;
|
|
42814
42890
|
if (typeof input === "string") {
|
|
42815
42891
|
const buf = await _promises.readFile.call(void 0, input);
|
|
42816
|
-
buffer =
|
|
42892
|
+
buffer = _chunkGUU7OHIHcjs.toArrayBuffer.call(void 0, buf);
|
|
42817
42893
|
} else if (Buffer.isBuffer(input)) {
|
|
42818
|
-
buffer =
|
|
42894
|
+
buffer = _chunkGUU7OHIHcjs.toArrayBuffer.call(void 0, input);
|
|
42819
42895
|
} else {
|
|
42820
42896
|
buffer = input;
|
|
42821
42897
|
}
|
|
@@ -42841,7 +42917,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
42841
42917
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
42842
42918
|
}
|
|
42843
42919
|
const fill = fillFormFields(parsed.blocks, values);
|
|
42844
|
-
const markdown =
|
|
42920
|
+
const markdown = _chunkEVPP2BSOcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
42845
42921
|
if (outputFormat === "hwpx") {
|
|
42846
42922
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
42847
42923
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -42940,5 +43016,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
42940
43016
|
|
|
42941
43017
|
|
|
42942
43018
|
|
|
42943
|
-
exports.AGENCY_COMMON_NAME = AGENCY_COMMON_NAME; 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 =
|
|
43019
|
+
exports.AGENCY_COMMON_NAME = AGENCY_COMMON_NAME; 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 = _chunkGUU7OHIHcjs.VERSION; exports.ValueCursor = ValueCursor; exports.agencyNames = agencyNames; exports.agencyStyle = agencyStyle; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkEVPP2BSOcjs.blocksToMarkdown; exports.blocksToPages = _chunkY7XHHV55cjs.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 = _chunkEVPP2BSOcjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunkEVPP2BSOcjs.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.parsePptx = parsePptx; 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;
|
|
42944
43020
|
//# sourceMappingURL=index.cjs.map
|