kordoc 4.7.2 → 4.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/{-CVPGGSAB.js → -WYNJOQ6P.js} +9 -9
- package/dist/{chunk-GLZMUKYL.js → chunk-3NKSSL44.js} +3 -3
- package/dist/{chunk-O4VLHQVG.js → chunk-3P5YCJQE.js} +2 -2
- package/dist/{chunk-JMWBMGNH.js → chunk-46F5RMU7.js} +2 -2
- package/dist/{chunk-QKHN7LEV.js → chunk-4HZN7EZZ.js} +2 -2
- package/dist/{chunk-4VNUQYUE.js → chunk-4KGGVCYX.js} +1 -1
- package/dist/chunk-4KGGVCYX.js.map +1 -0
- package/dist/{chunk-BSWJCSG7.js → chunk-CGJDCZA3.js} +2 -2
- package/dist/chunk-DCZVOIEO.cjs.map +1 -1
- package/dist/{chunk-DZBMQC2N.cjs → chunk-E6DONLTM.cjs} +2 -2
- package/dist/chunk-E6DONLTM.cjs.map +1 -0
- package/dist/{chunk-URTDBXV6.cjs → chunk-EV53YE3W.cjs} +1 -1
- package/dist/chunk-EV53YE3W.cjs.map +1 -0
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-Y3VDFFAW.js → chunk-HJV4BVQI.js} +2 -2
- package/dist/{chunk-VXB52EWX.js → chunk-IMFIACHP.js} +2 -2
- package/dist/{chunk-IVSEGHI2.js → chunk-JKJEBDP7.js} +3 -3
- package/dist/{chunk-E2XTVK7H.cjs → chunk-KE6DLZAW.cjs} +11 -11
- package/dist/chunk-KE6DLZAW.cjs.map +1 -0
- package/dist/{chunk-P7HPLWEP.js → chunk-KEGAEHWO.js} +2 -2
- package/dist/{chunk-I4TP7HYB.js → chunk-KSATSTC5.js} +1 -1
- package/dist/chunk-KSATSTC5.js.map +1 -0
- package/dist/{chunk-7CWNBDWQ.js → chunk-LMHVMGEC.js} +3 -3
- package/dist/{chunk-IN2AOMX6.js → chunk-NYLYIN55.js} +3 -3
- package/dist/{chunk-PGDJUJ4L.js → chunk-P663PYWV.js} +2 -2
- package/dist/{chunk-PV6WSN6E.cjs → chunk-QETZP25M.cjs} +3 -3
- package/dist/chunk-QETZP25M.cjs.map +1 -0
- package/dist/{chunk-YU3PLOX4.cjs → chunk-QGATKC4R.cjs} +6 -6
- package/dist/chunk-QGATKC4R.cjs.map +1 -0
- package/dist/{chunk-46VU6YXF.cjs → chunk-R4LXZRYP.cjs} +4 -4
- package/dist/chunk-R4LXZRYP.cjs.map +1 -0
- package/dist/{chunk-TYIFZT5H.js → chunk-RQVFFSAO.js} +2 -2
- package/dist/{chunk-IMY4LQ3J.js → chunk-TXQQ7URG.js} +2 -2
- package/dist/{chunk-LJW5EQXS.js → chunk-VZ3AQVBN.js} +8 -3
- package/dist/chunk-VZ3AQVBN.js.map +1 -0
- package/dist/{chunk-QXC5NPO2.js → chunk-W5NZYPRQ.js} +386 -80
- package/dist/chunk-W5NZYPRQ.js.map +1 -0
- package/dist/{chunk-FJBOVJAG.js → chunk-XOO6YEZE.js} +3 -3
- package/dist/{chunk-VEBTOI3I.js → chunk-Y7T5Z4DC.js} +3 -3
- package/dist/chunks-LWAOHTK2.js +10 -0
- package/dist/cli.js +22 -22
- package/dist/cli.js.map +1 -1
- package/dist/{formula-RTGCS55B.js → formula-IFKZZPD2.js} +4 -4
- package/dist/{formula-7D3MLOSV.cjs → formula-PDMZMBIP.cjs} +9 -9
- package/dist/formula-PDMZMBIP.cjs.map +1 -0
- package/dist/{formula-GHGK7T3S.js → formula-V6EAYHMF.js} +3 -3
- package/dist/{image-ocr-PRI2JKDW.cjs → image-ocr-75WGMVU6.cjs} +12 -12
- package/dist/image-ocr-75WGMVU6.cjs.map +1 -0
- package/dist/{image-ocr-2UMWFGRS.js → image-ocr-B7TMIG3F.js} +8 -8
- package/dist/{image-ocr-TQ5THN35.js → image-ocr-XHBZONFZ.js} +6 -6
- package/dist/index.cjs +864 -553
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +388 -77
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +19 -18
- package/dist/mcp.js.map +1 -1
- package/dist/{model-bundle-5RLZV7P2.js → model-bundle-Q4HQXJQG.js} +5 -5
- package/dist/{models-RSHR2BY7.js → models-QQA7OQHY.js} +5 -5
- package/dist/page-range-P7SDW6LR.cjs.map +1 -1
- package/dist/{parser-SCQ7NJUJ.cjs → parser-4CBOPTVY.cjs} +28 -28
- package/dist/parser-4CBOPTVY.cjs.map +1 -0
- package/dist/{parser-QPMTNRPU.js → parser-HT7GZOF2.js} +8 -8
- package/dist/{parser-FXEIK3VJ.js.map → parser-HT7GZOF2.js.map} +1 -1
- package/dist/{parser-FXEIK3VJ.js → parser-Z36MZUHS.js} +8 -8
- package/dist/{parser-QPMTNRPU.js.map → parser-Z36MZUHS.js.map} +1 -1
- package/dist/pdf-ocr-6ZNGDVC6.cjs +14 -0
- package/dist/pdf-ocr-6ZNGDVC6.cjs.map +1 -0
- package/dist/pdf-ocr-NTXRJI4T.js +13 -0
- package/dist/pdf-ocr-TYMCEUPH.js +16 -0
- package/dist/{profile-io-I4UGTNP6.js → profile-io-ACYRLCSR.js} +3 -3
- package/dist/{rasterize-QY3XJKCH.js → rasterize-QYCLEH2J.js} +2 -2
- package/dist/render-5Y2US4IM.js +10 -0
- package/dist/seal-VU6JS2QD.js +10 -0
- package/dist/{setup-T2BY3VME.js → setup-MG3YYKXU.js} +3 -3
- package/dist/{watch-JJE2UGVK.js → watch-AZIY6AWC.js} +10 -10
- package/package.json +1 -1
- package/dist/chunk-46VU6YXF.cjs.map +0 -1
- package/dist/chunk-4VNUQYUE.js.map +0 -1
- package/dist/chunk-DZBMQC2N.cjs.map +0 -1
- package/dist/chunk-E2XTVK7H.cjs.map +0 -1
- package/dist/chunk-I4TP7HYB.js.map +0 -1
- package/dist/chunk-LJW5EQXS.js.map +0 -1
- package/dist/chunk-PV6WSN6E.cjs.map +0 -1
- package/dist/chunk-QXC5NPO2.js.map +0 -1
- package/dist/chunk-URTDBXV6.cjs.map +0 -1
- package/dist/chunk-YU3PLOX4.cjs.map +0 -1
- package/dist/chunks-RNP6VLGK.js +0 -10
- package/dist/formula-7D3MLOSV.cjs.map +0 -1
- package/dist/image-ocr-PRI2JKDW.cjs.map +0 -1
- package/dist/parser-SCQ7NJUJ.cjs.map +0 -1
- package/dist/pdf-ocr-HPRM24SP.js +0 -16
- package/dist/pdf-ocr-I6DISTBR.js +0 -13
- package/dist/pdf-ocr-JNWL65YW.cjs +0 -14
- package/dist/pdf-ocr-JNWL65YW.cjs.map +0 -1
- package/dist/render-HEQX5DII.js +0 -10
- package/dist/seal-NB2YJ5F4.js +0 -10
- /package/dist/{-CVPGGSAB.js.map → -WYNJOQ6P.js.map} +0 -0
- /package/dist/{chunk-GLZMUKYL.js.map → chunk-3NKSSL44.js.map} +0 -0
- /package/dist/{chunk-O4VLHQVG.js.map → chunk-3P5YCJQE.js.map} +0 -0
- /package/dist/{chunk-JMWBMGNH.js.map → chunk-46F5RMU7.js.map} +0 -0
- /package/dist/{chunk-QKHN7LEV.js.map → chunk-4HZN7EZZ.js.map} +0 -0
- /package/dist/{chunk-BSWJCSG7.js.map → chunk-CGJDCZA3.js.map} +0 -0
- /package/dist/{chunk-Y3VDFFAW.js.map → chunk-HJV4BVQI.js.map} +0 -0
- /package/dist/{chunk-VXB52EWX.js.map → chunk-IMFIACHP.js.map} +0 -0
- /package/dist/{chunk-IVSEGHI2.js.map → chunk-JKJEBDP7.js.map} +0 -0
- /package/dist/{chunk-P7HPLWEP.js.map → chunk-KEGAEHWO.js.map} +0 -0
- /package/dist/{chunk-7CWNBDWQ.js.map → chunk-LMHVMGEC.js.map} +0 -0
- /package/dist/{chunk-IN2AOMX6.js.map → chunk-NYLYIN55.js.map} +0 -0
- /package/dist/{chunk-PGDJUJ4L.js.map → chunk-P663PYWV.js.map} +0 -0
- /package/dist/{chunk-TYIFZT5H.js.map → chunk-RQVFFSAO.js.map} +0 -0
- /package/dist/{chunk-IMY4LQ3J.js.map → chunk-TXQQ7URG.js.map} +0 -0
- /package/dist/{chunk-FJBOVJAG.js.map → chunk-XOO6YEZE.js.map} +0 -0
- /package/dist/{chunk-VEBTOI3I.js.map → chunk-Y7T5Z4DC.js.map} +0 -0
- /package/dist/{chunks-RNP6VLGK.js.map → chunks-LWAOHTK2.js.map} +0 -0
- /package/dist/{formula-RTGCS55B.js.map → formula-IFKZZPD2.js.map} +0 -0
- /package/dist/{formula-GHGK7T3S.js.map → formula-V6EAYHMF.js.map} +0 -0
- /package/dist/{image-ocr-2UMWFGRS.js.map → image-ocr-B7TMIG3F.js.map} +0 -0
- /package/dist/{image-ocr-TQ5THN35.js.map → image-ocr-XHBZONFZ.js.map} +0 -0
- /package/dist/{model-bundle-5RLZV7P2.js.map → model-bundle-Q4HQXJQG.js.map} +0 -0
- /package/dist/{models-RSHR2BY7.js.map → models-QQA7OQHY.js.map} +0 -0
- /package/dist/{pdf-ocr-HPRM24SP.js.map → pdf-ocr-NTXRJI4T.js.map} +0 -0
- /package/dist/{pdf-ocr-I6DISTBR.js.map → pdf-ocr-TYMCEUPH.js.map} +0 -0
- /package/dist/{profile-io-I4UGTNP6.js.map → profile-io-ACYRLCSR.js.map} +0 -0
- /package/dist/{rasterize-QY3XJKCH.js.map → rasterize-QYCLEH2J.js.map} +0 -0
- /package/dist/{render-HEQX5DII.js.map → render-5Y2US4IM.js.map} +0 -0
- /package/dist/{seal-NB2YJ5F4.js.map → seal-VU6JS2QD.js.map} +0 -0
- /package/dist/{setup-T2BY3VME.js.map → setup-MG3YYKXU.js.map} +0 -0
- /package/dist/{watch-JJE2UGVK.js.map → watch-AZIY6AWC.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkR4LXZRYPcjs = require('./chunk-R4LXZRYP.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -16,7 +16,7 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkEV53YE3Wcjs = require('./chunk-EV53YE3W.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -29,7 +29,7 @@ var _chunkURTDBXV6cjs = require('./chunk-URTDBXV6.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkE6DONLTMcjs = require('./chunk-E6DONLTM.cjs');
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -398,7 +398,7 @@ function comResultToParseResult(pages, pageCount, warnings) {
|
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
const markdown = lines.join("\n\n");
|
|
401
|
-
const metadata = { pageCount };
|
|
401
|
+
const metadata = { pageCount, pageMode: "layout" };
|
|
402
402
|
warnings.push({
|
|
403
403
|
message: "DRM \uBB38\uC11C: \uD55C\uCEF4 COM API\uB85C \uD14D\uC2A4\uD2B8 \uCD94\uCD9C (\uC11C\uC2DD/\uD45C \uC815\uBCF4 \uC81C\uD55C\uC801)",
|
|
404
404
|
code: "DRM_COM_FALLBACK"
|
|
@@ -484,7 +484,7 @@ function rawTextContent(node, depth = 0) {
|
|
|
484
484
|
// src/hwpx/parser-shared.ts
|
|
485
485
|
var MAX_DECOMPRESS_SIZE = 256 * 1024 * 1024;
|
|
486
486
|
var MAX_ZIP_ENTRIES = 500;
|
|
487
|
-
var ZipBombError = class extends
|
|
487
|
+
var ZipBombError = class extends _chunkE6DONLTMcjs.KordocError {
|
|
488
488
|
constructor(message) {
|
|
489
489
|
super(message);
|
|
490
490
|
this.name = "ZipBombError";
|
|
@@ -494,12 +494,17 @@ function clampSpan(val, max) {
|
|
|
494
494
|
return Math.max(1, Math.min(val, max));
|
|
495
495
|
}
|
|
496
496
|
function createSectionShared() {
|
|
497
|
-
return {
|
|
497
|
+
return {
|
|
498
|
+
numState: /* @__PURE__ */ new Map(),
|
|
499
|
+
pageText: { headers: [], footers: [] },
|
|
500
|
+
track: { deleteDepth: 0, warned: false },
|
|
501
|
+
pageState: { base: 0, allUsable: true }
|
|
502
|
+
};
|
|
498
503
|
}
|
|
499
504
|
function createXmlParser(warnings) {
|
|
500
505
|
return new (0, _xmldom.DOMParser)({
|
|
501
506
|
onError(level, msg2) {
|
|
502
|
-
if (level === "fatalError") throw new (0,
|
|
507
|
+
if (level === "fatalError") throw new (0, _chunkE6DONLTMcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
503
508
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
504
509
|
}
|
|
505
510
|
});
|
|
@@ -534,13 +539,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
534
539
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
535
540
|
const checksumType = attrOf(inner, "checksum-type");
|
|
536
541
|
if (algorithm !== AES256_CBC) {
|
|
537
|
-
throw new (0,
|
|
542
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
538
543
|
}
|
|
539
544
|
if (startKey !== START_KEY_SHA256) {
|
|
540
|
-
throw new (0,
|
|
545
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
541
546
|
}
|
|
542
547
|
if (!_optionalChain([checksumType, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(CHECKSUM_SHA256_1K)])) {
|
|
543
|
-
throw new (0,
|
|
548
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
544
549
|
}
|
|
545
550
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
546
551
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -548,10 +553,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
548
553
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
549
554
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
550
555
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
551
|
-
throw new (0,
|
|
556
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
552
557
|
}
|
|
553
558
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
554
|
-
throw new (0,
|
|
559
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
555
560
|
}
|
|
556
561
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
557
562
|
}
|
|
@@ -584,11 +589,11 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
584
589
|
for (const entry of entries) {
|
|
585
590
|
const file = zip.file(entry.path);
|
|
586
591
|
if (!file) {
|
|
587
|
-
throw new (0,
|
|
592
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
588
593
|
}
|
|
589
594
|
const plain = decryptEntry(await file.async("nodebuffer"), entry, startKey);
|
|
590
595
|
if (!plain) {
|
|
591
|
-
throw new (0,
|
|
596
|
+
throw new (0, _chunkE6DONLTMcjs.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.");
|
|
592
597
|
}
|
|
593
598
|
decrypted.push({ path: entry.path, plain });
|
|
594
599
|
}
|
|
@@ -636,10 +641,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
636
641
|
const xml = await file.async("text");
|
|
637
642
|
if (decompressed) {
|
|
638
643
|
decompressed.total += xml.length * 2;
|
|
639
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
644
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
640
645
|
}
|
|
641
646
|
const parser = createXmlParser();
|
|
642
|
-
const doc = parser.parseFromString(
|
|
647
|
+
const doc = parser.parseFromString(_chunkE6DONLTMcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
643
648
|
if (!doc.documentElement) continue;
|
|
644
649
|
const domDoc = doc;
|
|
645
650
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -828,9 +833,9 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
828
833
|
let level = 0;
|
|
829
834
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _16 => _16.style, 'optionalAccess', _17 => _17.fontSize])) {
|
|
830
835
|
const ratio = block.style.fontSize / baseFontSize;
|
|
831
|
-
if (ratio >=
|
|
832
|
-
else if (ratio >=
|
|
833
|
-
else if (ratio >=
|
|
836
|
+
if (ratio >= _chunkEV53YE3Wcjs.HEADING_RATIO_H1) level = 1;
|
|
837
|
+
else if (ratio >= _chunkEV53YE3Wcjs.HEADING_RATIO_H2) level = 2;
|
|
838
|
+
else if (ratio >= _chunkEV53YE3Wcjs.HEADING_RATIO_H3) level = 3;
|
|
834
839
|
}
|
|
835
840
|
const compactText = text.replace(/\s+/g, "");
|
|
836
841
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1423,7 +1428,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1423
1428
|
|
|
1424
1429
|
// src/hwpx/table-build.ts
|
|
1425
1430
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1426
|
-
const table2 =
|
|
1431
|
+
const table2 = _chunkR4LXZRYPcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1427
1432
|
if (state.caption) table2.caption = state.caption;
|
|
1428
1433
|
if (_optionalChain([state, 'access', _21 => _21.captionBlocks, 'optionalAccess', _22 => _22.length])) table2.captionBlocks = state.captionBlocks;
|
|
1429
1434
|
const anchors = [];
|
|
@@ -1485,16 +1490,16 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1485
1490
|
function completeTable(newTable, tableStack, blocks, ctx) {
|
|
1486
1491
|
const parentTable = tableStack.length > 0 ? tableStack.pop() : null;
|
|
1487
1492
|
if (newTable.rows.length === 0) {
|
|
1488
|
-
if (newTable.caption) blocks.push({ type: "paragraph", text: newTable.caption, pageNumber: ctx.
|
|
1493
|
+
if (newTable.caption) blocks.push({ type: "paragraph", text: newTable.caption, pageNumber: ctx.page });
|
|
1489
1494
|
return parentTable;
|
|
1490
1495
|
}
|
|
1491
1496
|
const ir = buildTableWithCellMeta(newTable, ctx.shared.keepTrailingEmptyCols, ctx.shared.keepEmptyParagraphs);
|
|
1492
|
-
const block = { type: "table", table: ir, pageNumber: ctx.
|
|
1497
|
+
const block = { type: "table", table: ir, pageNumber: ctx.page };
|
|
1493
1498
|
if (_optionalChain([parentTable, 'optionalAccess', _29 => _29.cell])) {
|
|
1494
1499
|
const cell2 = parentTable.cell;
|
|
1495
1500
|
(cell2.blocks ??= []).push(block);
|
|
1496
1501
|
cell2.hasStructure = true;
|
|
1497
|
-
let flat =
|
|
1502
|
+
let flat = _chunkR4LXZRYPcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1498
1503
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1499
1504
|
if (flat) {
|
|
1500
1505
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -1507,13 +1512,147 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1507
1512
|
return parentTable;
|
|
1508
1513
|
}
|
|
1509
1514
|
|
|
1515
|
+
// src/hwpx/page-boundary.ts
|
|
1516
|
+
var MIDPAGE_V = 2e3;
|
|
1517
|
+
var localName2 = (el) => {
|
|
1518
|
+
const n = el.nodeName;
|
|
1519
|
+
const i = n.indexOf(":");
|
|
1520
|
+
return i >= 0 ? n.slice(i + 1) : n;
|
|
1521
|
+
};
|
|
1522
|
+
var childElements = (parent) => {
|
|
1523
|
+
const out = [];
|
|
1524
|
+
for (let c = parent.firstChild; c; c = c.nextSibling) {
|
|
1525
|
+
if (c.nodeType === 1) out.push(c);
|
|
1526
|
+
}
|
|
1527
|
+
return out;
|
|
1528
|
+
};
|
|
1529
|
+
var numAttr = (el, name) => {
|
|
1530
|
+
const v = el.getAttribute(name);
|
|
1531
|
+
const n = v == null ? NaN : Number(v);
|
|
1532
|
+
return Number.isFinite(n) ? n : 0;
|
|
1533
|
+
};
|
|
1534
|
+
var findDescendant = (root, local, maxDepth = 8) => {
|
|
1535
|
+
if (maxDepth < 0) return null;
|
|
1536
|
+
for (const c of childElements(root)) {
|
|
1537
|
+
if (localName2(c) === local) return c;
|
|
1538
|
+
const found = findDescendant(c, local, maxDepth - 1);
|
|
1539
|
+
if (found) return found;
|
|
1540
|
+
}
|
|
1541
|
+
return null;
|
|
1542
|
+
};
|
|
1543
|
+
function linesegsOf(p) {
|
|
1544
|
+
const lsa = childElements(p).find((c) => localName2(c) === "linesegarray");
|
|
1545
|
+
return lsa ? childElements(lsa).filter((s) => localName2(s) === "lineseg") : [];
|
|
1546
|
+
}
|
|
1547
|
+
function cellFlowResets(subList) {
|
|
1548
|
+
let prevV = Number.NEGATIVE_INFINITY;
|
|
1549
|
+
let resets = 0;
|
|
1550
|
+
for (const p of childElements(subList)) {
|
|
1551
|
+
if (localName2(p) !== "p") continue;
|
|
1552
|
+
for (const s of linesegsOf(p)) {
|
|
1553
|
+
const v = numAttr(s, "vertpos");
|
|
1554
|
+
if (v < prevV) resets++;
|
|
1555
|
+
prevV = v;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
return resets;
|
|
1559
|
+
}
|
|
1560
|
+
function tableIntraBreaks(tbl2) {
|
|
1561
|
+
const rowMax = /* @__PURE__ */ new Map();
|
|
1562
|
+
for (const tr of childElements(tbl2)) {
|
|
1563
|
+
if (localName2(tr) !== "tr") continue;
|
|
1564
|
+
for (const tc2 of childElements(tr)) {
|
|
1565
|
+
if (localName2(tc2) !== "tc") continue;
|
|
1566
|
+
const addr = childElements(tc2).find((e) => localName2(e) === "cellAddr");
|
|
1567
|
+
const row = addr ? numAttr(addr, "rowAddr") : 0;
|
|
1568
|
+
const sub = childElements(tc2).find((e) => localName2(e) === "subList");
|
|
1569
|
+
if (!sub) continue;
|
|
1570
|
+
const r = cellFlowResets(sub);
|
|
1571
|
+
rowMax.set(row, Math.max(_nullishCoalesce(rowMax.get(row), () => ( 0)), r));
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
let sum = 0;
|
|
1575
|
+
for (const v of rowMax.values()) sum += v;
|
|
1576
|
+
return sum;
|
|
1577
|
+
}
|
|
1578
|
+
function detectHwpxSectionPages(root) {
|
|
1579
|
+
const colPr = findDescendant(root, "colPr");
|
|
1580
|
+
const multiCol = colPr ? numAttr(colPr, "colCount") > 1 : false;
|
|
1581
|
+
const paraPage = /* @__PURE__ */ new Map();
|
|
1582
|
+
let cur = 0;
|
|
1583
|
+
let prevV = Number.NEGATIVE_INFINITY;
|
|
1584
|
+
let prevH = Number.NEGATIVE_INFINITY;
|
|
1585
|
+
let first = true;
|
|
1586
|
+
let suppressMidReset = false;
|
|
1587
|
+
let topParas = 0;
|
|
1588
|
+
let parasWithSegs = 0;
|
|
1589
|
+
for (const p of childElements(root)) {
|
|
1590
|
+
if (localName2(p) !== "p") continue;
|
|
1591
|
+
topParas++;
|
|
1592
|
+
const explicit = p.getAttribute("pageBreak") === "1";
|
|
1593
|
+
let brokeByExplicit = false;
|
|
1594
|
+
if (explicit && !first) {
|
|
1595
|
+
cur++;
|
|
1596
|
+
brokeByExplicit = true;
|
|
1597
|
+
suppressMidReset = false;
|
|
1598
|
+
}
|
|
1599
|
+
const segs = linesegsOf(p);
|
|
1600
|
+
if (segs.length > 0) parasWithSegs++;
|
|
1601
|
+
let paraFirst = true;
|
|
1602
|
+
let startPage = cur;
|
|
1603
|
+
for (const s of segs) {
|
|
1604
|
+
const v = numAttr(s, "vertpos");
|
|
1605
|
+
const h = numAttr(s, "horzpos");
|
|
1606
|
+
const brk = v < prevV ? !multiCol || h <= prevH : paraFirst && v === prevV && h <= prevH;
|
|
1607
|
+
if (brk && !(paraFirst && brokeByExplicit)) {
|
|
1608
|
+
if (paraFirst && suppressMidReset && v >= MIDPAGE_V) {
|
|
1609
|
+
} else {
|
|
1610
|
+
cur++;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
if (paraFirst) {
|
|
1614
|
+
suppressMidReset = false;
|
|
1615
|
+
startPage = cur;
|
|
1616
|
+
}
|
|
1617
|
+
paraFirst = false;
|
|
1618
|
+
prevV = v;
|
|
1619
|
+
prevH = h;
|
|
1620
|
+
}
|
|
1621
|
+
paraPage.set(p, startPage);
|
|
1622
|
+
first = false;
|
|
1623
|
+
let add = 0;
|
|
1624
|
+
for (const r of childElements(p)) {
|
|
1625
|
+
if (localName2(r) !== "run") continue;
|
|
1626
|
+
for (const t of childElements(r)) {
|
|
1627
|
+
if (localName2(t) === "tbl") add += tableIntraBreaks(t);
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
if (add > 0) {
|
|
1631
|
+
cur += add;
|
|
1632
|
+
suppressMidReset = true;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
return {
|
|
1636
|
+
paraPage,
|
|
1637
|
+
pages: cur + 1,
|
|
1638
|
+
usable: topParas > 0 && parasWithSegs === topParas
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1510
1642
|
// src/hwpx/section-walker.ts
|
|
1511
1643
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
1512
1644
|
const parser = createXmlParser(warnings);
|
|
1513
|
-
const doc = parser.parseFromString(
|
|
1645
|
+
const doc = parser.parseFromString(_chunkE6DONLTMcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
1514
1646
|
if (!doc.documentElement) return [];
|
|
1515
1647
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
1516
1648
|
ctx.shared.track.deleteDepth = 0;
|
|
1649
|
+
const detect = detectHwpxSectionPages(doc.documentElement);
|
|
1650
|
+
const ps = ctx.shared.pageState;
|
|
1651
|
+
if (!detect.usable) ps.allUsable = false;
|
|
1652
|
+
ctx.paraPage = detect.paraPage;
|
|
1653
|
+
ctx.pageBase = ps.base;
|
|
1654
|
+
ctx.page = ps.base + 1;
|
|
1655
|
+
ps.base += detect.pages;
|
|
1517
1656
|
for (const tagName of ["hp:secPr", "secPr"]) {
|
|
1518
1657
|
const els = doc.getElementsByTagName(tagName);
|
|
1519
1658
|
if (els.length > 0) {
|
|
@@ -1560,7 +1699,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1560
1699
|
const chan = kordocTableChannel(el, ctx);
|
|
1561
1700
|
if (chan) {
|
|
1562
1701
|
if (chan.kind === "heading" && chan.text) {
|
|
1563
|
-
blocks.push({ type: "heading", level: chan.level, text: chan.text, pageNumber: ctx.
|
|
1702
|
+
blocks.push({ type: "heading", level: chan.level, text: chan.text, pageNumber: ctx.page });
|
|
1564
1703
|
}
|
|
1565
1704
|
break;
|
|
1566
1705
|
}
|
|
@@ -1579,7 +1718,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1579
1718
|
tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + cap.text;
|
|
1580
1719
|
if (cap.hasStructure) (tableCtx.captionBlocks ??= []).push(...cap.blocks);
|
|
1581
1720
|
} else {
|
|
1582
|
-
blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.
|
|
1721
|
+
blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.page });
|
|
1583
1722
|
}
|
|
1584
1723
|
}
|
|
1585
1724
|
break;
|
|
@@ -1617,24 +1756,26 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1617
1756
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
1618
1757
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
1619
1758
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
1620
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
1621
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
1759
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkR4LXZRYPcjs.MAX_COLS);
|
|
1760
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkR4LXZRYPcjs.MAX_ROWS);
|
|
1622
1761
|
}
|
|
1623
1762
|
break;
|
|
1624
1763
|
case "p": {
|
|
1764
|
+
const paraPg = _optionalChain([ctx, 'access', _32 => _32.paraPage, 'optionalAccess', _33 => _33.get, 'call', _34 => _34(el)]);
|
|
1765
|
+
if (paraPg !== void 0 && ctx.pageBase !== void 0) ctx.page = ctx.pageBase + paraPg + 1;
|
|
1625
1766
|
const { text: rawText, href, footnote, style, segments } = extractParagraphInfo(el, ctx.styleMap, ctx);
|
|
1626
1767
|
let text = rawText;
|
|
1627
1768
|
let headingLevel;
|
|
1628
1769
|
const ph = resolveParaHeading(el, ctx);
|
|
1629
1770
|
if (text) {
|
|
1630
|
-
if (_optionalChain([ph, 'optionalAccess',
|
|
1631
|
-
headingLevel = _optionalChain([ph, 'optionalAccess',
|
|
1771
|
+
if (_optionalChain([ph, 'optionalAccess', _35 => _35.prefix])) text = ph.prefix + " " + text;
|
|
1772
|
+
headingLevel = _optionalChain([ph, 'optionalAccess', _36 => _36.headingLevel]);
|
|
1632
1773
|
}
|
|
1633
1774
|
if (segments) {
|
|
1634
|
-
const cell2 = _nullishCoalesce(_optionalChain([tableCtx, 'optionalAccess',
|
|
1775
|
+
const cell2 = _nullishCoalesce(_optionalChain([tableCtx, 'optionalAccess', _37 => _37.cell]), () => ( null));
|
|
1635
1776
|
if (cell2) cell2.lineOpen = false;
|
|
1636
1777
|
const segs = [...segments];
|
|
1637
|
-
if (_optionalChain([ph, 'optionalAccess',
|
|
1778
|
+
if (_optionalChain([ph, 'optionalAccess', _38 => _38.prefix])) {
|
|
1638
1779
|
const fi = segs.findIndex((s) => s);
|
|
1639
1780
|
if (fi >= 0) segs[fi] = ph.prefix + " " + segs[fi];
|
|
1640
1781
|
}
|
|
@@ -1643,7 +1784,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1643
1784
|
const flush = () => {
|
|
1644
1785
|
const s = segs[segIdx++];
|
|
1645
1786
|
if (!s) return;
|
|
1646
|
-
const block = { type: "paragraph", text: s, pageNumber: ctx.
|
|
1787
|
+
const block = { type: "paragraph", text: s, pageNumber: ctx.page };
|
|
1647
1788
|
if (first && !cell2) {
|
|
1648
1789
|
first = false;
|
|
1649
1790
|
if (style) block.style = style;
|
|
@@ -1662,14 +1803,14 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1662
1803
|
break;
|
|
1663
1804
|
}
|
|
1664
1805
|
if (text) {
|
|
1665
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
1806
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _39 => _39.cell])) {
|
|
1666
1807
|
const cell2 = tableCtx.cell;
|
|
1667
1808
|
if (footnote) text += ` (\uC8FC: ${footnote})`;
|
|
1668
1809
|
cell2.text += (cell2.text || cell2.paraSeen ? "\n" : "") + text;
|
|
1669
1810
|
cell2.paraSeen = true;
|
|
1670
|
-
const cellBlock = { type: "paragraph", text, pageNumber: ctx.
|
|
1811
|
+
const cellBlock = { type: "paragraph", text, pageNumber: ctx.page };
|
|
1671
1812
|
const cellSpanMode = spanModeOf(ctx.shared.kordocLayout);
|
|
1672
|
-
if (cellSpanMode && !_optionalChain([ph, 'optionalAccess',
|
|
1813
|
+
if (cellSpanMode && !_optionalChain([ph, 'optionalAccess', _40 => _40.prefix])) {
|
|
1673
1814
|
const spans = extractRunSpans(el, ctx, cellSpanMode, cellSpanMode !== "kordoc");
|
|
1674
1815
|
if (spans && spans.map((s) => s.text).join("").replace(/[ \t]+/g, " ").trim() === text) {
|
|
1675
1816
|
cellBlock.spans = spans;
|
|
@@ -1679,16 +1820,16 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1679
1820
|
(cell2.blocks ??= []).push(cellBlock);
|
|
1680
1821
|
} else if (!tableCtx) {
|
|
1681
1822
|
if (ctx.shared.kordocLayout && /^─{10,}$/.test(text)) {
|
|
1682
|
-
blocks.push({ type: "separator", pageNumber: ctx.
|
|
1823
|
+
blocks.push({ type: "separator", pageNumber: ctx.page });
|
|
1683
1824
|
tableCtx = walkParagraphChildren(el, blocks, tableCtx, tableStack, ctx, depth + 1);
|
|
1684
1825
|
break;
|
|
1685
1826
|
}
|
|
1686
|
-
const block = { type: headingLevel ? "heading" : "paragraph", text, pageNumber: ctx.
|
|
1827
|
+
const block = { type: headingLevel ? "heading" : "paragraph", text, pageNumber: ctx.page };
|
|
1687
1828
|
if (headingLevel) block.level = headingLevel;
|
|
1688
1829
|
if (style) block.style = style;
|
|
1689
1830
|
if (href) block.href = href;
|
|
1690
1831
|
if (footnote) block.footnoteText = footnote;
|
|
1691
|
-
const ind = _optionalChain([ctx, 'access',
|
|
1832
|
+
const ind = _optionalChain([ctx, 'access', _41 => _41.styleMap, 'optionalAccess', _42 => _42.paraIndents, 'access', _43 => _43.get, 'call', _44 => _44(_nullishCoalesce(el.getAttribute("paraPrIDRef"), () => ( "")))]);
|
|
1692
1833
|
if (ind) {
|
|
1693
1834
|
const eff = ind.left + Math.max(0, ind.intent);
|
|
1694
1835
|
if (eff > 0) block.indent = eff;
|
|
@@ -1699,7 +1840,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1699
1840
|
}
|
|
1700
1841
|
const spanMode = spanModeOf(ctx.shared.kordocLayout);
|
|
1701
1842
|
if (!headingLevel && spanMode) {
|
|
1702
|
-
if (!_optionalChain([ph, 'optionalAccess',
|
|
1843
|
+
if (!_optionalChain([ph, 'optionalAccess', _45 => _45.prefix])) {
|
|
1703
1844
|
const spans = extractRunSpans(el, ctx, spanMode, spanMode === "gongmun");
|
|
1704
1845
|
if (spans && spans.map((s) => s.text).join("").replace(/[ \t]+/g, " ").trim() === text) {
|
|
1705
1846
|
block.spans = spans;
|
|
@@ -1709,17 +1850,17 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1709
1850
|
}
|
|
1710
1851
|
blocks.push(block);
|
|
1711
1852
|
} else {
|
|
1712
|
-
blocks.push({ type: "paragraph", text, pageNumber: ctx.
|
|
1853
|
+
blocks.push({ type: "paragraph", text, pageNumber: ctx.page });
|
|
1713
1854
|
}
|
|
1714
1855
|
} else if (ctx.shared.keepEmptyParagraphs && !hasObjectDescendant(el)) {
|
|
1715
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
1856
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _46 => _46.cell])) {
|
|
1716
1857
|
const cell2 = tableCtx.cell;
|
|
1717
1858
|
if (cell2.text || cell2.paraSeen) cell2.text += "\n";
|
|
1718
1859
|
cell2.paraSeen = true;
|
|
1719
1860
|
cell2.lineOpen = false;
|
|
1720
|
-
(cell2.blocks ??= []).push({ type: "paragraph", text: "", pageNumber: ctx.
|
|
1861
|
+
(cell2.blocks ??= []).push({ type: "paragraph", text: "", pageNumber: ctx.page });
|
|
1721
1862
|
} else if (!tableCtx) {
|
|
1722
|
-
blocks.push({ type: "paragraph", text: "", pageNumber: ctx.
|
|
1863
|
+
blocks.push({ type: "paragraph", text: "", pageNumber: ctx.page });
|
|
1723
1864
|
}
|
|
1724
1865
|
}
|
|
1725
1866
|
tableCtx = walkParagraphChildren(el, blocks, tableCtx, tableStack, ctx, depth + 1);
|
|
@@ -1729,7 +1870,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1729
1870
|
case "pic":
|
|
1730
1871
|
case "shape":
|
|
1731
1872
|
case "drawingObject": {
|
|
1732
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
1873
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _47 => _47.cell])) {
|
|
1733
1874
|
const sink = [];
|
|
1734
1875
|
handleShape(el, sink, ctx);
|
|
1735
1876
|
mergeBlocksIntoCell(tableCtx.cell, sink);
|
|
@@ -1742,7 +1883,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1742
1883
|
case "memogroup":
|
|
1743
1884
|
case "memo": {
|
|
1744
1885
|
if (ctx.warnings && extractTextFromNode(el)) {
|
|
1745
|
-
ctx.warnings.push({ page: ctx.
|
|
1886
|
+
ctx.warnings.push({ page: ctx.page, message: "\uBA54\uBAA8 \uD14D\uC2A4\uD2B8 \uBCF8\uBB38 \uC81C\uC678: memogroup", code: "HIDDEN_TEXT_FILTERED" });
|
|
1746
1887
|
}
|
|
1747
1888
|
break;
|
|
1748
1889
|
}
|
|
@@ -1754,9 +1895,9 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1754
1895
|
}
|
|
1755
1896
|
function handleShape(el, sink, ctx) {
|
|
1756
1897
|
const imgRef = extractImageRef(el);
|
|
1757
|
-
const drawTextChild =
|
|
1898
|
+
const drawTextChild = findDescendant2(el, "drawText");
|
|
1758
1899
|
if (imgRef) {
|
|
1759
|
-
const block = { type: "image", text: imgRef, pageNumber: ctx.
|
|
1900
|
+
const block = { type: "image", text: imgRef, pageNumber: ctx.page };
|
|
1760
1901
|
const alt = userShapeComment(el);
|
|
1761
1902
|
if (alt) block.footnoteText = alt;
|
|
1762
1903
|
sink.push(block);
|
|
@@ -1767,11 +1908,11 @@ function handleShape(el, sink, ctx) {
|
|
|
1767
1908
|
const capEl = findChildByLocalName(el, "caption");
|
|
1768
1909
|
if (capEl) {
|
|
1769
1910
|
const capText = collectSubListText(capEl, ctx);
|
|
1770
|
-
if (capText) sink.push({ type: "paragraph", text: capText, pageNumber: ctx.
|
|
1911
|
+
if (capText) sink.push({ type: "paragraph", text: capText, pageNumber: ctx.page });
|
|
1771
1912
|
}
|
|
1772
1913
|
if (!imgRef && !drawTextChild && ctx.warnings && ctx.sectionNum) {
|
|
1773
1914
|
const localTag = (el.tagName || el.localName || "").replace(/^[^:]+:/, "");
|
|
1774
|
-
ctx.warnings.push({ page: ctx.
|
|
1915
|
+
ctx.warnings.push({ page: ctx.page, message: `\uC2A4\uD0B5\uB41C \uC694\uC18C: ${localTag}`, code: "SKIPPED_IMAGE" });
|
|
1775
1916
|
}
|
|
1776
1917
|
}
|
|
1777
1918
|
function userShapeComment(el) {
|
|
@@ -1834,7 +1975,7 @@ function hasPageAutoNum(el, depth = 0) {
|
|
|
1834
1975
|
const ch = children[i];
|
|
1835
1976
|
if (ch.nodeType !== 1) continue;
|
|
1836
1977
|
const tag = (ch.tagName || ch.localName || "").replace(/^[^:]+:/, "");
|
|
1837
|
-
if (tag === "autoNum" && _optionalChain([ch, 'access',
|
|
1978
|
+
if (tag === "autoNum" && _optionalChain([ch, 'access', _48 => _48.getAttribute, 'optionalCall', _49 => _49("numType")]) === "PAGE") return true;
|
|
1838
1979
|
if (hasPageAutoNum(ch, depth + 1)) return true;
|
|
1839
1980
|
}
|
|
1840
1981
|
return false;
|
|
@@ -1856,7 +1997,7 @@ function collectSubListContent(el, ctx, depth = 0) {
|
|
|
1856
1997
|
const t = extractParagraphInfo(ch, ctx.styleMap, ctx).text;
|
|
1857
1998
|
if (t) {
|
|
1858
1999
|
parts.push(t);
|
|
1859
|
-
out.blocks.push({ type: "paragraph", text: t, pageNumber: ctx.
|
|
2000
|
+
out.blocks.push({ type: "paragraph", text: t, pageNumber: ctx.page });
|
|
1860
2001
|
}
|
|
1861
2002
|
const tbls = [];
|
|
1862
2003
|
findTopLevelTbls(ch, tbls);
|
|
@@ -1889,7 +2030,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
1889
2030
|
const sink = [];
|
|
1890
2031
|
const st = { rows: [], currentRow: [], cell: null };
|
|
1891
2032
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
1892
|
-
let flat =
|
|
2033
|
+
let flat = _chunkR4LXZRYPcjs.convertTableToText.call(void 0, st.rows);
|
|
1893
2034
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
1894
2035
|
const built = [];
|
|
1895
2036
|
completeTable(st, [], built, ctx);
|
|
@@ -1929,7 +2070,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
1929
2070
|
const chan = kordocTableChannel(el, ctx);
|
|
1930
2071
|
if (chan) {
|
|
1931
2072
|
if (chan.kind === "heading" && chan.text) {
|
|
1932
|
-
blocks.push({ type: "heading", level: chan.level, text: chan.text, pageNumber: ctx.
|
|
2073
|
+
blocks.push({ type: "heading", level: chan.level, text: chan.text, pageNumber: ctx.page });
|
|
1933
2074
|
}
|
|
1934
2075
|
continue;
|
|
1935
2076
|
}
|
|
@@ -1941,14 +2082,14 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
1941
2082
|
} else if (localTag === "caption" && !inShape) {
|
|
1942
2083
|
const cap = collectSubListContent(el, ctx);
|
|
1943
2084
|
if (cap.text) {
|
|
1944
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2085
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _50 => _50.cell])) mergeBlocksIntoCell(tableCtx.cell, [{ type: "paragraph", text: cap.text, pageNumber: ctx.page }]);
|
|
1945
2086
|
else if (tableCtx) {
|
|
1946
2087
|
tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + cap.text;
|
|
1947
2088
|
if (cap.hasStructure) (tableCtx.captionBlocks ??= []).push(...cap.blocks);
|
|
1948
|
-
} else blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.
|
|
2089
|
+
} else blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.page });
|
|
1949
2090
|
}
|
|
1950
2091
|
} else if (localTag === "pic" || localTag === "shape" || localTag === "drawingObject") {
|
|
1951
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2092
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _51 => _51.cell])) {
|
|
1952
2093
|
const sink = [];
|
|
1953
2094
|
handleShape(el, sink, ctx);
|
|
1954
2095
|
mergeBlocksIntoCell(tableCtx.cell, sink);
|
|
@@ -1956,7 +2097,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
1956
2097
|
handleShape(el, blocks, ctx);
|
|
1957
2098
|
}
|
|
1958
2099
|
} else if (localTag === "drawText") {
|
|
1959
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2100
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _52 => _52.cell])) {
|
|
1960
2101
|
const sink = [];
|
|
1961
2102
|
extractDrawTextBlocks(el, sink, ctx);
|
|
1962
2103
|
mergeBlocksIntoCell(tableCtx.cell, sink);
|
|
@@ -1988,9 +2129,9 @@ function hasObjectDescendant(node, depth = 0) {
|
|
|
1988
2129
|
return false;
|
|
1989
2130
|
}
|
|
1990
2131
|
function isInlineTbl(tbl2) {
|
|
1991
|
-
return _optionalChain([findChildByLocalName, 'call',
|
|
2132
|
+
return _optionalChain([findChildByLocalName, 'call', _53 => _53(tbl2, "pos"), 'optionalAccess', _54 => _54.getAttribute, 'call', _55 => _55("treatAsChar")]) === "1";
|
|
1992
2133
|
}
|
|
1993
|
-
function
|
|
2134
|
+
function findDescendant2(node, targetTag, depth = 0) {
|
|
1994
2135
|
if (depth > 5) return null;
|
|
1995
2136
|
const children = node.childNodes;
|
|
1996
2137
|
if (!children) return null;
|
|
@@ -1999,7 +2140,7 @@ function findDescendant(node, targetTag, depth = 0) {
|
|
|
1999
2140
|
if (child.nodeType !== 1) continue;
|
|
2000
2141
|
const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
|
|
2001
2142
|
if (tag === targetTag) return child;
|
|
2002
|
-
const found =
|
|
2143
|
+
const found = findDescendant2(child, targetTag, depth + 1);
|
|
2003
2144
|
if (found) return found;
|
|
2004
2145
|
}
|
|
2005
2146
|
return null;
|
|
@@ -2019,8 +2160,8 @@ function extractDrawTextBlocks(drawTextNode, blocks, ctx) {
|
|
|
2019
2160
|
let text = info.text.trim();
|
|
2020
2161
|
const ph = resolveParaHeading(child, ctx);
|
|
2021
2162
|
if (text) {
|
|
2022
|
-
if (_optionalChain([ph, 'optionalAccess',
|
|
2023
|
-
const block = { type: "paragraph", text, style: _nullishCoalesce(info.style, () => ( void 0)), pageNumber: ctx.
|
|
2163
|
+
if (_optionalChain([ph, 'optionalAccess', _56 => _56.prefix])) text = ph.prefix + " " + text;
|
|
2164
|
+
const block = { type: "paragraph", text, style: _nullishCoalesce(info.style, () => ( void 0)), pageNumber: ctx.page };
|
|
2024
2165
|
if (info.href) block.href = info.href;
|
|
2025
2166
|
if (info.footnote) block.footnoteText = info.footnote;
|
|
2026
2167
|
blocks.push(block);
|
|
@@ -2044,13 +2185,13 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2044
2185
|
let url = (ch.textContent || "").trim();
|
|
2045
2186
|
if (!url) continue;
|
|
2046
2187
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2047
|
-
const safe =
|
|
2188
|
+
const safe = _chunkE6DONLTMcjs.sanitizeHref.call(void 0, url);
|
|
2048
2189
|
if (safe) return safe;
|
|
2049
2190
|
}
|
|
2050
2191
|
return void 0;
|
|
2051
2192
|
}
|
|
2052
2193
|
function isInDeletedRange(ctx) {
|
|
2053
|
-
return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess',
|
|
2194
|
+
return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess', _57 => _57.shared, 'access', _58 => _58.track, 'access', _59 => _59.deleteDepth]), () => ( 0))) > 0;
|
|
2054
2195
|
}
|
|
2055
2196
|
function extractParagraphInfo(para2, styleMap, ctx) {
|
|
2056
2197
|
let text = "";
|
|
@@ -2071,7 +2212,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2071
2212
|
};
|
|
2072
2213
|
const onFieldEnd = () => {
|
|
2073
2214
|
const open = openFields.pop();
|
|
2074
|
-
if (_optionalChain([open, 'optionalAccess',
|
|
2215
|
+
if (_optionalChain([open, 'optionalAccess', _60 => _60.rangeIdx]) !== void 0) linkRanges[open.rangeIdx].end = text.length;
|
|
2075
2216
|
};
|
|
2076
2217
|
const handleCtrl = (ctrlEl) => {
|
|
2077
2218
|
const kids = ctrlEl.childNodes;
|
|
@@ -2122,8 +2263,8 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2122
2263
|
// 삽입분은 최종본에 포함
|
|
2123
2264
|
// 숨은 설명 — 본문 혼입 차단
|
|
2124
2265
|
case "hiddenComment": {
|
|
2125
|
-
if (_optionalChain([ctx, 'optionalAccess',
|
|
2126
|
-
ctx.warnings.push({ page: ctx.
|
|
2266
|
+
if (_optionalChain([ctx, 'optionalAccess', _61 => _61.warnings]) && extractTextFromNode(k)) {
|
|
2267
|
+
ctx.warnings.push({ page: ctx.page, message: "\uC228\uC740 \uC124\uBA85 \uD14D\uC2A4\uD2B8 \uC81C\uC678: hiddenComment", code: "HIDDEN_TEXT_FILTERED" });
|
|
2127
2268
|
}
|
|
2128
2269
|
break;
|
|
2129
2270
|
}
|
|
@@ -2142,8 +2283,8 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2142
2283
|
break;
|
|
2143
2284
|
// 미지원 요소 — 텍스트를 가졌으면 무음 손실 대신 경고
|
|
2144
2285
|
default: {
|
|
2145
|
-
if (_optionalChain([ctx, 'optionalAccess',
|
|
2146
|
-
ctx.warnings.push({ page: ctx.
|
|
2286
|
+
if (_optionalChain([ctx, 'optionalAccess', _62 => _62.warnings]) && extractTextFromNode(k)) {
|
|
2287
|
+
ctx.warnings.push({ page: ctx.page, message: `\uBBF8\uC9C0\uC6D0 \uC81C\uC5B4 \uC694\uC18C\uC758 \uD14D\uC2A4\uD2B8 \uC190\uC2E4: ${ktag}`, code: "UNSUPPORTED_ELEMENT" });
|
|
2147
2288
|
}
|
|
2148
2289
|
}
|
|
2149
2290
|
}
|
|
@@ -2160,7 +2301,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2160
2301
|
if (isInDeletedRange(ctx)) {
|
|
2161
2302
|
if (t && ctx && !ctx.shared.track.warned) {
|
|
2162
2303
|
ctx.shared.track.warned = true;
|
|
2163
|
-
_optionalChain([ctx, 'access',
|
|
2304
|
+
_optionalChain([ctx, 'access', _63 => _63.warnings, 'optionalAccess', _64 => _64.push, 'call', _65 => _65({ page: ctx.page, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
|
|
2164
2305
|
}
|
|
2165
2306
|
} else {
|
|
2166
2307
|
text += t.replace(/\x1E/g, "");
|
|
@@ -2204,7 +2345,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2204
2345
|
case "hyperlink": {
|
|
2205
2346
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2206
2347
|
if (url) {
|
|
2207
|
-
const safe =
|
|
2348
|
+
const safe = _chunkE6DONLTMcjs.sanitizeHref.call(void 0, url);
|
|
2208
2349
|
if (safe) href = safe;
|
|
2209
2350
|
}
|
|
2210
2351
|
walk(child, depth + 1);
|
|
@@ -2270,9 +2411,9 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2270
2411
|
const latex = hmlToLatex(raw).trim();
|
|
2271
2412
|
if (latex) text += " $" + latex + "$ ";
|
|
2272
2413
|
} catch (e13) {
|
|
2273
|
-
if (_optionalChain([ctx, 'optionalAccess',
|
|
2414
|
+
if (_optionalChain([ctx, 'optionalAccess', _66 => _66.warnings])) {
|
|
2274
2415
|
ctx.warnings.push({
|
|
2275
|
-
page: ctx.
|
|
2416
|
+
page: ctx.page,
|
|
2276
2417
|
message: `\uC218\uC2DD LaTeX \uBCC0\uD658 \uC2E4\uD328 \u2014 \uC218\uC2DD \uD14D\uC2A4\uD2B8 \uC81C\uC678: ${raw.trim().slice(0, 40)}`,
|
|
2277
2418
|
code: "PARTIAL_PARSE"
|
|
2278
2419
|
});
|
|
@@ -2358,13 +2499,13 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2358
2499
|
if (tag !== "run" && tag !== "r") return null;
|
|
2359
2500
|
let text = "";
|
|
2360
2501
|
const rkids = child.childNodes;
|
|
2361
|
-
for (let j = 0; j < (_nullishCoalesce(_optionalChain([rkids, 'optionalAccess',
|
|
2502
|
+
for (let j = 0; j < (_nullishCoalesce(_optionalChain([rkids, 'optionalAccess', _67 => _67.length]), () => ( 0))); j++) {
|
|
2362
2503
|
const rc = rkids[j];
|
|
2363
2504
|
if (rc.nodeType !== 1) continue;
|
|
2364
2505
|
const rtag = (rc.tagName || rc.localName || "").replace(/^[^:]+:/, "");
|
|
2365
2506
|
if (rtag === "t") {
|
|
2366
2507
|
const tkids = rc.childNodes;
|
|
2367
|
-
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess',
|
|
2508
|
+
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _68 => _68.length]), () => ( 0))); k++) {
|
|
2368
2509
|
const tk = tkids[k];
|
|
2369
2510
|
if (tk.nodeType === 3 || tk.nodeType === 4) text += tk.textContent || "";
|
|
2370
2511
|
else if (tk.nodeType === 1) return null;
|
|
@@ -2382,10 +2523,10 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2382
2523
|
const span = { text };
|
|
2383
2524
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span.code = true;
|
|
2384
2525
|
else {
|
|
2385
|
-
if (_optionalChain([cp, 'optionalAccess',
|
|
2386
|
-
if (_optionalChain([cp, 'optionalAccess',
|
|
2387
|
-
if (_optionalChain([cp, 'optionalAccess',
|
|
2388
|
-
if (_optionalChain([cp, 'optionalAccess',
|
|
2526
|
+
if (_optionalChain([cp, 'optionalAccess', _69 => _69.bold])) span.bold = true;
|
|
2527
|
+
if (_optionalChain([cp, 'optionalAccess', _70 => _70.italic])) span.italic = true;
|
|
2528
|
+
if (_optionalChain([cp, 'optionalAccess', _71 => _71.strike])) span.strike = true;
|
|
2529
|
+
if (_optionalChain([cp, 'optionalAccess', _72 => _72.underline])) span.underline = true;
|
|
2389
2530
|
}
|
|
2390
2531
|
if (span.bold || span.italic || span.strike || span.underline || span.code) styled = true;
|
|
2391
2532
|
spans.push(span);
|
|
@@ -2408,12 +2549,12 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2408
2549
|
if (!styleMap) return null;
|
|
2409
2550
|
let unit = 0;
|
|
2410
2551
|
const kids = para2.childNodes;
|
|
2411
|
-
for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids, 'optionalAccess',
|
|
2552
|
+
for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids, 'optionalAccess', _73 => _73.length]), () => ( 0))); i++) {
|
|
2412
2553
|
const child = kids[i];
|
|
2413
2554
|
if (child.nodeType !== 1) continue;
|
|
2414
2555
|
const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
|
|
2415
2556
|
if (tag !== "run" && tag !== "r") continue;
|
|
2416
|
-
const size = _optionalChain([styleMap, 'access',
|
|
2557
|
+
const size = _optionalChain([styleMap, 'access', _74 => _74.charProperties, 'access', _75 => _75.get, 'call', _76 => _76(_nullishCoalesce(child.getAttribute("charPrIDRef"), () => ( ""))), 'optionalAccess', _77 => _77.fontSize]);
|
|
2417
2558
|
if (size) unit = size * 100;
|
|
2418
2559
|
break;
|
|
2419
2560
|
}
|
|
@@ -2429,6 +2570,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2429
2570
|
var TAG_PARA_HEADER = 66;
|
|
2430
2571
|
var TAG_PARA_TEXT = 67;
|
|
2431
2572
|
var TAG_CHAR_SHAPE = 68;
|
|
2573
|
+
var TAG_PARA_LINE_SEG = 69;
|
|
2432
2574
|
var TAG_CTRL_HEADER = 71;
|
|
2433
2575
|
var TAG_LIST_HEADER = 72;
|
|
2434
2576
|
var TAG_TABLE = 77;
|
|
@@ -2486,7 +2628,7 @@ function decompressStream(data) {
|
|
|
2486
2628
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
2487
2629
|
}
|
|
2488
2630
|
function parseFileHeader(data) {
|
|
2489
|
-
if (data.length < 40) throw new (0,
|
|
2631
|
+
if (data.length < 40) throw new (0, _chunkE6DONLTMcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
2490
2632
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
2491
2633
|
return {
|
|
2492
2634
|
signature: sig,
|
|
@@ -2619,7 +2761,7 @@ function appendParaText(state, data, resolveControl) {
|
|
|
2619
2761
|
const resolveAt = (byteOffset, extended) => {
|
|
2620
2762
|
const ctrlId = data.readUInt32LE(byteOffset);
|
|
2621
2763
|
const idx = extended ? state.ctrlIdx : -1;
|
|
2622
|
-
const replacement = _optionalChain([resolveControl, 'optionalCall',
|
|
2764
|
+
const replacement = _optionalChain([resolveControl, 'optionalCall', _78 => _78(idx, ctrlId)]);
|
|
2623
2765
|
if (replacement) result += replacement;
|
|
2624
2766
|
if (extended) state.ctrlIdx++;
|
|
2625
2767
|
};
|
|
@@ -2823,7 +2965,7 @@ function extractHwp5Images(fileIndex, blocks, warnings, sweepUnreferenced) {
|
|
|
2823
2965
|
const binDataMap = /* @__PURE__ */ new Map();
|
|
2824
2966
|
if (fileIndex) {
|
|
2825
2967
|
for (const entry of fileIndex) {
|
|
2826
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
2968
|
+
if (!_optionalChain([entry, 'optionalAccess', _79 => _79.name]) || !entry.content) continue;
|
|
2827
2969
|
const match = entry.name.match(BIN_ENTRY_RE);
|
|
2828
2970
|
if (!match) continue;
|
|
2829
2971
|
const idx = parseInt(match[1], 16);
|
|
@@ -2899,11 +3041,11 @@ function collectImageBlocks2(blocks, out, ownerCell, depth = 0) {
|
|
|
2899
3041
|
} else if (block.type === "table" && block.table) {
|
|
2900
3042
|
for (const row of block.table.cells) {
|
|
2901
3043
|
for (const cell2 of row) {
|
|
2902
|
-
if (_optionalChain([cell2, 'access',
|
|
3044
|
+
if (_optionalChain([cell2, 'access', _80 => _80.blocks, 'optionalAccess', _81 => _81.length])) collectImageBlocks2(cell2.blocks, out, cell2, depth + 1);
|
|
2903
3045
|
}
|
|
2904
3046
|
}
|
|
2905
3047
|
}
|
|
2906
|
-
if (_optionalChain([block, 'access',
|
|
3048
|
+
if (_optionalChain([block, 'access', _82 => _82.children, 'optionalAccess', _83 => _83.length])) collectImageBlocks2(block.children, out, ownerCell, depth + 1);
|
|
2907
3049
|
}
|
|
2908
3050
|
}
|
|
2909
3051
|
async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUnreferenced) {
|
|
@@ -2938,13 +3080,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2938
3080
|
}
|
|
2939
3081
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
2940
3082
|
for (const path of allCandidates) {
|
|
2941
|
-
if (
|
|
3083
|
+
if (_chunkE6DONLTMcjs.isPathTraversal.call(void 0, path)) continue;
|
|
2942
3084
|
const file = zip.file(path);
|
|
2943
3085
|
if (!file) continue;
|
|
2944
3086
|
try {
|
|
2945
3087
|
const data = await file.async("uint8array");
|
|
2946
3088
|
decompressed.total += data.length;
|
|
2947
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3089
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
2948
3090
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
2949
3091
|
const mimeType = imageExtToMime(ext);
|
|
2950
3092
|
imageIndex++;
|
|
@@ -2954,10 +3096,10 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2954
3096
|
usedPaths.add(path);
|
|
2955
3097
|
break;
|
|
2956
3098
|
} catch (err) {
|
|
2957
|
-
if (err instanceof
|
|
3099
|
+
if (err instanceof _chunkE6DONLTMcjs.KordocError) throw err;
|
|
2958
3100
|
}
|
|
2959
3101
|
}
|
|
2960
|
-
if (!img) _optionalChain([warnings, 'optionalAccess',
|
|
3102
|
+
if (!img) _optionalChain([warnings, 'optionalAccess', _84 => _84.push, 'call', _85 => _85({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
2961
3103
|
resolved.set(ref, img);
|
|
2962
3104
|
}
|
|
2963
3105
|
if (!img) {
|
|
@@ -2974,11 +3116,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2974
3116
|
if (sweepUnreferenced) {
|
|
2975
3117
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
2976
3118
|
for (const file of binEntries) {
|
|
2977
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3119
|
+
if (file.dir || usedPaths.has(file.name) || _chunkE6DONLTMcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
2978
3120
|
try {
|
|
2979
3121
|
const data = await file.async("uint8array");
|
|
2980
3122
|
decompressed.total += data.length;
|
|
2981
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3123
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
2982
3124
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
2983
3125
|
let mimeType = imageExtToMime(ext);
|
|
2984
3126
|
if (mimeType === "application/octet-stream") {
|
|
@@ -2992,8 +3134,8 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2992
3134
|
images.push(img);
|
|
2993
3135
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
2994
3136
|
} catch (err) {
|
|
2995
|
-
if (err instanceof
|
|
2996
|
-
_optionalChain([warnings, 'optionalAccess',
|
|
3137
|
+
if (err instanceof _chunkE6DONLTMcjs.KordocError) throw err;
|
|
3138
|
+
_optionalChain([warnings, 'optionalAccess', _86 => _86.push, 'call', _87 => _87({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
2997
3139
|
}
|
|
2998
3140
|
}
|
|
2999
3141
|
}
|
|
@@ -3043,7 +3185,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3043
3185
|
}
|
|
3044
3186
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3045
3187
|
const name = new TextDecoder().decode(nameBytes);
|
|
3046
|
-
if (
|
|
3188
|
+
if (_chunkE6DONLTMcjs.isPathTraversal.call(void 0, name)) {
|
|
3047
3189
|
pos = fileStart + compSize;
|
|
3048
3190
|
continue;
|
|
3049
3191
|
}
|
|
@@ -3061,16 +3203,18 @@ function extractFromBrokenZip(buffer) {
|
|
|
3061
3203
|
continue;
|
|
3062
3204
|
}
|
|
3063
3205
|
totalDecompressed += content.length * 2;
|
|
3064
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3206
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3065
3207
|
sectionNum++;
|
|
3066
|
-
|
|
3208
|
+
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3209
|
+
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
3210
|
+
blocks.push(...secBlocks);
|
|
3067
3211
|
} catch (e17) {
|
|
3068
3212
|
continue;
|
|
3069
3213
|
}
|
|
3070
3214
|
}
|
|
3071
|
-
if (blocks.length === 0) throw new (0,
|
|
3215
|
+
if (blocks.length === 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3072
3216
|
applyPageText(blocks, shared);
|
|
3073
|
-
const markdown =
|
|
3217
|
+
const markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3074
3218
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3075
3219
|
}
|
|
3076
3220
|
async function readKordocLayout(zip) {
|
|
@@ -3079,7 +3223,7 @@ async function readKordocLayout(zip) {
|
|
|
3079
3223
|
try {
|
|
3080
3224
|
const xml = await file.async("text");
|
|
3081
3225
|
if (!/<opf:meta\b[^>]*name="generator"[^>]*content="kordoc"/.test(xml)) return null;
|
|
3082
|
-
return _nullishCoalesce(_optionalChain([xml, 'access',
|
|
3226
|
+
return _nullishCoalesce(_optionalChain([xml, 'access', _88 => _88.match, 'call', _89 => _89(/<opf:meta\b[^>]*name="kordoc-layout"[^>]*content="([^"]*)"/), 'optionalAccess', _90 => _90[1]]), () => ( null));
|
|
3083
3227
|
} catch (e18) {
|
|
3084
3228
|
return null;
|
|
3085
3229
|
}
|
|
@@ -3095,18 +3239,18 @@ async function resolveSectionPaths(zip) {
|
|
|
3095
3239
|
if (paths.length > 0) return paths;
|
|
3096
3240
|
}
|
|
3097
3241
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3098
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3242
|
+
return sectionFiles.map((f) => f.name).sort(_chunkE6DONLTMcjs.compareSectionPaths);
|
|
3099
3243
|
}
|
|
3100
3244
|
function parseSectionPathsFromManifest(xml) {
|
|
3101
3245
|
const parser = createXmlParser();
|
|
3102
|
-
const doc = parser.parseFromString(
|
|
3246
|
+
const doc = parser.parseFromString(_chunkE6DONLTMcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3103
3247
|
const items = doc.getElementsByTagName("opf:item");
|
|
3104
3248
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
3105
3249
|
const idToHref = /* @__PURE__ */ new Map();
|
|
3106
3250
|
for (let i = 0; i < items.length; i++) {
|
|
3107
3251
|
const item = items[i];
|
|
3108
3252
|
const id = item.getAttribute("id") || "";
|
|
3109
|
-
const href =
|
|
3253
|
+
const href = _chunkE6DONLTMcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3110
3254
|
if (id && href) idToHref.set(id, href);
|
|
3111
3255
|
}
|
|
3112
3256
|
if (spine.length > 0) {
|
|
@@ -3117,7 +3261,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3117
3261
|
}
|
|
3118
3262
|
if (ordered.length > 0) return ordered;
|
|
3119
3263
|
}
|
|
3120
|
-
return Array.from(idToHref.values()).sort(
|
|
3264
|
+
return Array.from(idToHref.values()).sort(_chunkE6DONLTMcjs.compareSectionPaths);
|
|
3121
3265
|
}
|
|
3122
3266
|
|
|
3123
3267
|
// src/hwpx/metadata.ts
|
|
@@ -3130,7 +3274,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3130
3274
|
const xml = await file.async("text");
|
|
3131
3275
|
if (decompressed) {
|
|
3132
3276
|
decompressed.total += xml.length * 2;
|
|
3133
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3277
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3134
3278
|
}
|
|
3135
3279
|
parseDublinCoreMetadata(xml, metadata);
|
|
3136
3280
|
if (metadata.title || metadata.author) return;
|
|
@@ -3140,13 +3284,13 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3140
3284
|
}
|
|
3141
3285
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3142
3286
|
const parser = createXmlParser();
|
|
3143
|
-
const doc = parser.parseFromString(
|
|
3287
|
+
const doc = parser.parseFromString(_chunkE6DONLTMcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3144
3288
|
if (!doc.documentElement) return;
|
|
3145
3289
|
const getText = (tagNames) => {
|
|
3146
3290
|
for (const tag of tagNames) {
|
|
3147
3291
|
const els = doc.getElementsByTagName(tag);
|
|
3148
3292
|
if (els.length > 0) {
|
|
3149
|
-
const text = _optionalChain([els, 'access',
|
|
3293
|
+
const text = _optionalChain([els, 'access', _91 => _91[0], 'access', _92 => _92.textContent, 'optionalAccess', _93 => _93.trim, 'call', _94 => _94()]);
|
|
3150
3294
|
if (text) return text;
|
|
3151
3295
|
}
|
|
3152
3296
|
}
|
|
@@ -3165,7 +3309,7 @@ function parseDublinCoreMetadata(xml, metadata) {
|
|
|
3165
3309
|
|
|
3166
3310
|
// src/hwpx/parser.ts
|
|
3167
3311
|
async function parseHwpxDocument(buffer, options) {
|
|
3168
|
-
|
|
3312
|
+
_chunkE6DONLTMcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3169
3313
|
let zip;
|
|
3170
3314
|
try {
|
|
3171
3315
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3174,22 +3318,22 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3174
3318
|
}
|
|
3175
3319
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3176
3320
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3177
|
-
throw new (0,
|
|
3321
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3178
3322
|
}
|
|
3179
3323
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3180
3324
|
if (manifestFile) {
|
|
3181
3325
|
const manifestXml = await manifestFile.async("text");
|
|
3182
3326
|
if (isEncryptedHwpx(manifestXml)) {
|
|
3183
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3327
|
+
if (_optionalChain([options, 'optionalAccess', _95 => _95.password])) {
|
|
3184
3328
|
await decryptHwpxInPlace(zip, manifestXml, options.password);
|
|
3185
3329
|
} else {
|
|
3186
|
-
if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
3330
|
+
if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _96 => _96.filePath])) {
|
|
3187
3331
|
const { pages, pageCount, warnings: warnings2 } = extractTextViaCom(options.filePath);
|
|
3188
3332
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
3189
3333
|
return comResultToParseResult(pages, pageCount, warnings2);
|
|
3190
3334
|
}
|
|
3191
3335
|
}
|
|
3192
|
-
throw new (0,
|
|
3336
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
3193
3337
|
"\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694."
|
|
3194
3338
|
);
|
|
3195
3339
|
}
|
|
@@ -3201,37 +3345,52 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3201
3345
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3202
3346
|
const warnings = [];
|
|
3203
3347
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3204
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3205
|
-
|
|
3206
|
-
const pageFilter = _optionalChain([options, 'optionalAccess', _94 => _94.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
|
|
3207
|
-
const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
|
|
3208
|
-
const blocks = [];
|
|
3348
|
+
if (sectionPaths.length === 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3349
|
+
let allBlocks = [];
|
|
3209
3350
|
const shared = createSectionShared();
|
|
3210
3351
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
3211
|
-
shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess',
|
|
3212
|
-
shared.keepEmptyParagraphs = _optionalChain([options, 'optionalAccess',
|
|
3352
|
+
shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _97 => _97.keepTrailingEmptyCols]);
|
|
3353
|
+
shared.keepEmptyParagraphs = _optionalChain([options, 'optionalAccess', _98 => _98.keepEmptyParagraphs]);
|
|
3354
|
+
const sectionRanges = [];
|
|
3213
3355
|
let parsedSections = 0;
|
|
3214
3356
|
for (let si = 0; si < sectionPaths.length; si++) {
|
|
3215
|
-
if (pageFilter && !pageFilter.has(si + 1)) continue;
|
|
3216
3357
|
const file = zip.file(sectionPaths[si]);
|
|
3217
3358
|
if (!file) continue;
|
|
3218
3359
|
try {
|
|
3219
3360
|
const xml = await file.async("text");
|
|
3220
3361
|
decompressed.total += xml.length * 2;
|
|
3221
3362
|
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3222
|
-
|
|
3363
|
+
const start = allBlocks.length;
|
|
3364
|
+
allBlocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
|
|
3365
|
+
sectionRanges.push({ sectionNum: si + 1, start, end: allBlocks.length });
|
|
3223
3366
|
parsedSections++;
|
|
3224
|
-
_optionalChain([options, 'optionalAccess',
|
|
3367
|
+
_optionalChain([options, 'optionalAccess', _99 => _99.onProgress, 'optionalCall', _100 => _100(parsedSections, sectionPaths.length)]);
|
|
3225
3368
|
} catch (secErr) {
|
|
3226
3369
|
if (secErr instanceof ZipBombError) throw secErr;
|
|
3227
3370
|
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" });
|
|
3228
3371
|
}
|
|
3229
3372
|
}
|
|
3373
|
+
const layoutPages = shared.pageState.allUsable && parsedSections > 0;
|
|
3374
|
+
metadata.pageMode = layoutPages ? "layout" : "section";
|
|
3375
|
+
metadata.pageCount = layoutPages ? Math.max(shared.pageState.base, 1) : sectionPaths.length;
|
|
3376
|
+
if (!layoutPages) {
|
|
3377
|
+
for (const r of sectionRanges) {
|
|
3378
|
+
for (let b = r.start; b < r.end; b++) allBlocks[b].pageNumber = r.sectionNum;
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
if (_optionalChain([options, 'optionalAccess', _101 => _101.pages])) {
|
|
3382
|
+
const pageFilter = _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, metadata.pageCount);
|
|
3383
|
+
allBlocks = allBlocks.filter((b) => b.pageNumber != null && pageFilter.has(b.pageNumber));
|
|
3384
|
+
if (!layoutPages) {
|
|
3385
|
+
warnings.push({ code: "PAGE_BOUNDARY_APPROXIMATE", message: "\uC870\uD310 \uCE90\uC2DC\uAC00 \uC5C6\uC5B4 pages \uD544\uD130\uB97C \uC139\uC158 \uB2E8\uC704 \uADFC\uC0AC\uB85C \uC801\uC6A9\uD588\uC2B5\uB2C8\uB2E4" });
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
const blocks = allBlocks;
|
|
3230
3389
|
applyPageText(blocks, shared);
|
|
3231
|
-
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !
|
|
3390
|
+
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _102 => _102.pages]));
|
|
3232
3391
|
detectHwpxHeadings(blocks, styleMap);
|
|
3233
3392
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3234
|
-
const markdown =
|
|
3393
|
+
const markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3235
3394
|
return { markdown, blocks, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
|
|
3236
3395
|
}
|
|
3237
3396
|
|
|
@@ -4231,24 +4390,130 @@ function decryptPasswordStream(raw, password) {
|
|
|
4231
4390
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4232
4391
|
var TAG_ID_MAPPINGS = 17;
|
|
4233
4392
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4234
|
-
const wrong = () => new (0,
|
|
4393
|
+
const wrong = () => new (0, _chunkE6DONLTMcjs.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.");
|
|
4235
4394
|
let records;
|
|
4236
4395
|
try {
|
|
4237
4396
|
records = readRecords3(data);
|
|
4238
4397
|
} catch (e22) {
|
|
4239
4398
|
throw wrong();
|
|
4240
4399
|
}
|
|
4241
|
-
if (_optionalChain([records, 'access',
|
|
4400
|
+
if (_optionalChain([records, 'access', _103 => _103[0], 'optionalAccess', _104 => _104.tagId]) !== TAG_DOCUMENT_PROPERTIES) throw wrong();
|
|
4242
4401
|
if (!records.some((r) => r.tagId === TAG_ID_MAPPINGS)) throw wrong();
|
|
4243
4402
|
}
|
|
4244
4403
|
function assertSupportedEncryptVersion(version) {
|
|
4245
4404
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4246
|
-
throw new (0,
|
|
4405
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
4247
4406
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4248
4407
|
);
|
|
4249
4408
|
}
|
|
4250
4409
|
}
|
|
4251
4410
|
|
|
4411
|
+
// src/hwp5/page-boundary.ts
|
|
4412
|
+
var MIDPAGE_V2 = 2e3;
|
|
4413
|
+
var CTRL_ID_TBL = 1952607264;
|
|
4414
|
+
function tableIntraBreaks2(records, start, end) {
|
|
4415
|
+
const rowMax = /* @__PURE__ */ new Map();
|
|
4416
|
+
let curRow = -1;
|
|
4417
|
+
let prevV = Number.NEGATIVE_INFINITY;
|
|
4418
|
+
let resets = 0;
|
|
4419
|
+
const flush = () => {
|
|
4420
|
+
if (curRow >= 0) rowMax.set(curRow, Math.max(_nullishCoalesce(rowMax.get(curRow), () => ( 0)), resets));
|
|
4421
|
+
resets = 0;
|
|
4422
|
+
prevV = Number.NEGATIVE_INFINITY;
|
|
4423
|
+
};
|
|
4424
|
+
for (let i = start; i < end; i++) {
|
|
4425
|
+
const rec = records[i];
|
|
4426
|
+
if (rec.tagId === TAG_LIST_HEADER && rec.level === 2 && rec.data.length >= 12) {
|
|
4427
|
+
flush();
|
|
4428
|
+
curRow = rec.data.readUInt16LE(10);
|
|
4429
|
+
} else if (rec.tagId === TAG_PARA_LINE_SEG && rec.level === 3 && curRow >= 0) {
|
|
4430
|
+
for (let off = 0; off + 36 <= rec.data.length; off += 36) {
|
|
4431
|
+
const v = rec.data.readInt32LE(off + 4);
|
|
4432
|
+
if (v < prevV) resets++;
|
|
4433
|
+
prevV = v;
|
|
4434
|
+
}
|
|
4435
|
+
}
|
|
4436
|
+
}
|
|
4437
|
+
flush();
|
|
4438
|
+
let sum = 0;
|
|
4439
|
+
for (const v of rowMax.values()) sum += v;
|
|
4440
|
+
return sum;
|
|
4441
|
+
}
|
|
4442
|
+
function detectHwp5SectionPages(records) {
|
|
4443
|
+
const pageAtPara = [];
|
|
4444
|
+
let cur = 0;
|
|
4445
|
+
let prevV = Number.NEGATIVE_INFINITY;
|
|
4446
|
+
let prevH = Number.NEGATIVE_INFINITY;
|
|
4447
|
+
let first = true;
|
|
4448
|
+
let suppressMidReset = false;
|
|
4449
|
+
let parasWithSegs = 0;
|
|
4450
|
+
let i = 0;
|
|
4451
|
+
while (i < records.length) {
|
|
4452
|
+
const rec = records[i];
|
|
4453
|
+
if (rec.tagId !== TAG_PARA_HEADER || rec.level !== 0) {
|
|
4454
|
+
i++;
|
|
4455
|
+
continue;
|
|
4456
|
+
}
|
|
4457
|
+
let j = i + 1;
|
|
4458
|
+
while (j < records.length && records[j].level > 0) j++;
|
|
4459
|
+
const divideSort = rec.data.length >= 12 ? rec.data.readUInt8(11) : 0;
|
|
4460
|
+
const explicit = (divideSort & 4) !== 0;
|
|
4461
|
+
let brokeByExplicit = false;
|
|
4462
|
+
if (explicit && !first) {
|
|
4463
|
+
cur++;
|
|
4464
|
+
brokeByExplicit = true;
|
|
4465
|
+
suppressMidReset = false;
|
|
4466
|
+
}
|
|
4467
|
+
let paraFirst = true;
|
|
4468
|
+
let startPage = cur;
|
|
4469
|
+
let hadSegs = false;
|
|
4470
|
+
let intraAdd = 0;
|
|
4471
|
+
for (let k = i + 1; k < j; k++) {
|
|
4472
|
+
const r = records[k];
|
|
4473
|
+
if (r.tagId === TAG_PARA_LINE_SEG && r.level === 1) {
|
|
4474
|
+
hadSegs = true;
|
|
4475
|
+
for (let off = 0; off + 36 <= r.data.length; off += 36) {
|
|
4476
|
+
const v = r.data.readInt32LE(off + 4);
|
|
4477
|
+
const h = r.data.readInt32LE(off + 24);
|
|
4478
|
+
const brk = v < prevV || paraFirst && v === prevV && h <= prevH;
|
|
4479
|
+
if (brk && !(paraFirst && brokeByExplicit)) {
|
|
4480
|
+
if (paraFirst && suppressMidReset && v >= MIDPAGE_V2) {
|
|
4481
|
+
} else {
|
|
4482
|
+
cur++;
|
|
4483
|
+
}
|
|
4484
|
+
}
|
|
4485
|
+
if (paraFirst) {
|
|
4486
|
+
suppressMidReset = false;
|
|
4487
|
+
startPage = cur;
|
|
4488
|
+
}
|
|
4489
|
+
paraFirst = false;
|
|
4490
|
+
prevV = v;
|
|
4491
|
+
prevH = h;
|
|
4492
|
+
}
|
|
4493
|
+
}
|
|
4494
|
+
if (r.tagId === TAG_CTRL_HEADER && r.level === 1 && r.data.length >= 4 && r.data.readUInt32LE(0) === CTRL_ID_TBL) {
|
|
4495
|
+
let ce = k + 1;
|
|
4496
|
+
while (ce < j && records[ce].level > 1) ce++;
|
|
4497
|
+
intraAdd += tableIntraBreaks2(records, k + 1, ce);
|
|
4498
|
+
k = ce - 1;
|
|
4499
|
+
}
|
|
4500
|
+
}
|
|
4501
|
+
if (hadSegs) parasWithSegs++;
|
|
4502
|
+
pageAtPara.push(startPage);
|
|
4503
|
+
first = false;
|
|
4504
|
+
if (intraAdd > 0) {
|
|
4505
|
+
cur += intraAdd;
|
|
4506
|
+
suppressMidReset = true;
|
|
4507
|
+
}
|
|
4508
|
+
i = j;
|
|
4509
|
+
}
|
|
4510
|
+
return {
|
|
4511
|
+
pageAtPara,
|
|
4512
|
+
pages: cur + 1,
|
|
4513
|
+
usable: pageAtPara.length > 0 && parasWithSegs === pageAtPara.length
|
|
4514
|
+
};
|
|
4515
|
+
}
|
|
4516
|
+
|
|
4252
4517
|
// src/hwp5/parser.ts
|
|
4253
4518
|
var _module = require('module');
|
|
4254
4519
|
var require2 = _module.createRequire.call(void 0, _chunkGS7T56RPcjs.importMetaUrl);
|
|
@@ -4326,25 +4591,25 @@ function parseHwp5Document(buffer, options) {
|
|
|
4326
4591
|
lenientCfb = parseLenientCfb(buffer);
|
|
4327
4592
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
4328
4593
|
} catch (e24) {
|
|
4329
|
-
throw new (0,
|
|
4594
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
4330
4595
|
}
|
|
4331
4596
|
}
|
|
4332
4597
|
const readRawStream = (path) => {
|
|
4333
4598
|
if (cfb) {
|
|
4334
4599
|
const entry = CFB.find(cfb, path);
|
|
4335
|
-
return _optionalChain([entry, 'optionalAccess',
|
|
4600
|
+
return _optionalChain([entry, 'optionalAccess', _105 => _105.content]) ? Buffer.from(entry.content) : null;
|
|
4336
4601
|
}
|
|
4337
4602
|
return lenientCfb.findStream(path);
|
|
4338
4603
|
};
|
|
4339
4604
|
const headerData = readRawStream("/FileHeader");
|
|
4340
|
-
if (!headerData) throw new (0,
|
|
4605
|
+
if (!headerData) throw new (0, _chunkE6DONLTMcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4341
4606
|
const header = parseFileHeader(headerData);
|
|
4342
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
4343
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
4607
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkE6DONLTMcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
4608
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkE6DONLTMcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
4344
4609
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
4345
4610
|
if (encrypted) {
|
|
4346
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
4347
|
-
throw new (0,
|
|
4611
|
+
if (!_optionalChain([options, 'optionalAccess', _106 => _106.password])) {
|
|
4612
|
+
throw new (0, _chunkE6DONLTMcjs.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.");
|
|
4348
4613
|
}
|
|
4349
4614
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
4350
4615
|
}
|
|
@@ -4362,48 +4627,80 @@ function parseHwp5Document(buffer, options) {
|
|
|
4362
4627
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
4363
4628
|
if (encrypted) {
|
|
4364
4629
|
const rawDocInfo = findStream("/DocInfo");
|
|
4365
|
-
if (!rawDocInfo) throw new (0,
|
|
4630
|
+
if (!rawDocInfo) throw new (0, _chunkE6DONLTMcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4366
4631
|
let docInfoData;
|
|
4367
4632
|
try {
|
|
4368
4633
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
4369
4634
|
} catch (e25) {
|
|
4370
|
-
throw new (0,
|
|
4635
|
+
throw new (0, _chunkE6DONLTMcjs.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.");
|
|
4371
4636
|
}
|
|
4372
4637
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
4373
4638
|
}
|
|
4374
4639
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
4375
4640
|
const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : encrypted ? findSectionsVia(findStream) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
|
|
4376
|
-
if (sections.length === 0) throw new (0,
|
|
4377
|
-
|
|
4378
|
-
const
|
|
4379
|
-
const totalTarget = pageFilter ? pageFilter.size : sections.length;
|
|
4380
|
-
const bodyBlocks = [];
|
|
4381
|
-
const doc = createHwp5DocState();
|
|
4382
|
-
doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _104 => _104.keepTrailingEmptyCols]);
|
|
4641
|
+
if (sections.length === 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4642
|
+
const sectionRecords = [];
|
|
4643
|
+
const sectionDetects = [];
|
|
4383
4644
|
let totalDecompressed = 0;
|
|
4384
|
-
let parsedSections = 0;
|
|
4385
4645
|
for (let si = 0; si < sections.length; si++) {
|
|
4386
|
-
if (pageFilter && !pageFilter.has(si + 1)) continue;
|
|
4387
4646
|
try {
|
|
4388
|
-
const
|
|
4389
|
-
const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
|
|
4647
|
+
const data = !distribution && compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
4390
4648
|
totalDecompressed += data.length;
|
|
4391
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4649
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4392
4650
|
const records = readRecords(data);
|
|
4393
|
-
|
|
4651
|
+
sectionRecords.push(records);
|
|
4652
|
+
sectionDetects.push(detectHwp5SectionPages(records));
|
|
4653
|
+
} catch (secErr) {
|
|
4654
|
+
if (secErr instanceof _chunkE6DONLTMcjs.KordocError) throw secErr;
|
|
4655
|
+
sectionRecords.push(null);
|
|
4656
|
+
sectionDetects.push(null);
|
|
4657
|
+
warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
|
|
4658
|
+
}
|
|
4659
|
+
}
|
|
4660
|
+
const layoutPages = sectionDetects.length > 0 && sectionDetects.every((d) => d != null && d.usable);
|
|
4661
|
+
metadata.pageMode = layoutPages ? "layout" : "section";
|
|
4662
|
+
metadata.pageCount = layoutPages ? Math.max(sectionDetects.reduce((sum, d) => sum + (_nullishCoalesce(_optionalChain([d, 'optionalAccess', _107 => _107.pages]), () => ( 0))), 0), 1) : sections.length;
|
|
4663
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _108 => _108.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, metadata.pageCount) : null;
|
|
4664
|
+
if (pageFilter && !layoutPages) {
|
|
4665
|
+
warnings.push({ code: "PAGE_BOUNDARY_APPROXIMATE", message: "\uC870\uD310 \uCE90\uC2DC\uAC00 \uC5C6\uC5B4 pages \uD544\uD130\uB97C \uC139\uC158 \uB2E8\uC704 \uADFC\uC0AC\uB85C \uC801\uC6A9\uD588\uC2B5\uB2C8\uB2E4" });
|
|
4666
|
+
}
|
|
4667
|
+
let bodyBlocks = [];
|
|
4668
|
+
const doc = createHwp5DocState();
|
|
4669
|
+
doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _109 => _109.keepTrailingEmptyCols]);
|
|
4670
|
+
let parsedSections = 0;
|
|
4671
|
+
let pageBase = 0;
|
|
4672
|
+
for (let si = 0; si < sections.length; si++) {
|
|
4673
|
+
const records = sectionRecords[si];
|
|
4674
|
+
if (!records) continue;
|
|
4675
|
+
const detect = sectionDetects[si];
|
|
4676
|
+
if (!layoutPages && pageFilter && !pageFilter.has(si + 1)) continue;
|
|
4677
|
+
try {
|
|
4678
|
+
const sectionBlocks = parseSection(
|
|
4679
|
+
records,
|
|
4680
|
+
docInfo,
|
|
4681
|
+
warnings,
|
|
4682
|
+
si + 1,
|
|
4683
|
+
doc,
|
|
4684
|
+
layoutPages ? { base: pageBase, pageAtPara: detect.pageAtPara } : void 0
|
|
4685
|
+
);
|
|
4394
4686
|
bodyBlocks.push(...sectionBlocks);
|
|
4395
4687
|
parsedSections++;
|
|
4396
|
-
_optionalChain([options, 'optionalAccess',
|
|
4688
|
+
_optionalChain([options, 'optionalAccess', _110 => _110.onProgress, 'optionalCall', _111 => _111(parsedSections, sections.length)]);
|
|
4397
4689
|
} catch (secErr) {
|
|
4398
|
-
if (secErr instanceof
|
|
4690
|
+
if (secErr instanceof _chunkE6DONLTMcjs.KordocError) throw secErr;
|
|
4399
4691
|
warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
|
|
4692
|
+
} finally {
|
|
4693
|
+
pageBase += detect.pages;
|
|
4400
4694
|
}
|
|
4401
4695
|
}
|
|
4696
|
+
if (pageFilter && layoutPages) {
|
|
4697
|
+
bodyBlocks = bodyBlocks.filter((b) => b.pageNumber != null && pageFilter.has(b.pageNumber));
|
|
4698
|
+
}
|
|
4402
4699
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
4403
4700
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
|
|
4404
|
-
let flatBlocks =
|
|
4405
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4406
|
-
const deduped =
|
|
4701
|
+
let flatBlocks = _chunkR4LXZRYPcjs.flattenLayoutTables.call(void 0, blocks);
|
|
4702
|
+
if (_optionalChain([options, 'optionalAccess', _112 => _112.dedupeRunningHeaders])) {
|
|
4703
|
+
const deduped = _chunkR4LXZRYPcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
4407
4704
|
const removed = flatBlocks.length - deduped.length;
|
|
4408
4705
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
4409
4706
|
flatBlocks = deduped;
|
|
@@ -4412,10 +4709,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
4412
4709
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
4413
4710
|
}
|
|
4414
4711
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4415
|
-
let markdown =
|
|
4416
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4712
|
+
let markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
4713
|
+
if (_optionalChain([options, 'optionalAccess', _113 => _113.inlineImages]) && images.length > 0) {
|
|
4417
4714
|
try {
|
|
4418
|
-
markdown =
|
|
4715
|
+
markdown = _chunkR4LXZRYPcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
4419
4716
|
} catch (inlineErr) {
|
|
4420
4717
|
warnings.push({ message: `\uC774\uBBF8\uC9C0 \uC778\uB77C\uC778 \uC2E4\uD328 \u2014 \uC6D0\uBCF8 \uD30C\uC77C \uCC38\uC870\uB85C \uD3F4\uBC31: ${inlineErr instanceof Error ? inlineErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "SKIPPED_IMAGE" });
|
|
4421
4718
|
}
|
|
@@ -4425,7 +4722,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
4425
4722
|
function parseDocInfoStream(cfb, compressed) {
|
|
4426
4723
|
try {
|
|
4427
4724
|
const entry = CFB.find(cfb, "/DocInfo");
|
|
4428
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4725
|
+
if (!_optionalChain([entry, 'optionalAccess', _114 => _114.content])) return null;
|
|
4429
4726
|
const data = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
4430
4727
|
const records = readRecords(data);
|
|
4431
4728
|
return parseDocInfo(records);
|
|
@@ -4446,7 +4743,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4446
4743
|
let baseFontSize = 0;
|
|
4447
4744
|
const sizeFreq = /* @__PURE__ */ new Map();
|
|
4448
4745
|
for (const b of blocks) {
|
|
4449
|
-
if (_optionalChain([b, 'access',
|
|
4746
|
+
if (_optionalChain([b, 'access', _115 => _115.style, 'optionalAccess', _116 => _116.fontSize]) && b.text) {
|
|
4450
4747
|
sizeFreq.set(b.style.fontSize, (sizeFreq.get(b.style.fontSize) || 0) + b.text.length);
|
|
4451
4748
|
}
|
|
4452
4749
|
}
|
|
@@ -4462,7 +4759,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4462
4759
|
const name = (style.nameKo || style.name).toLowerCase();
|
|
4463
4760
|
if (name.includes("\uBC14\uD0D5") || name.includes("\uBCF8\uBB38") || name === "normal" || name === "body") {
|
|
4464
4761
|
const cs = docInfo.charShapes[style.charShapeId];
|
|
4465
|
-
if (_optionalChain([cs, 'optionalAccess',
|
|
4762
|
+
if (_optionalChain([cs, 'optionalAccess', _117 => _117.fontSize]) > 0) {
|
|
4466
4763
|
baseFontSize = cs.fontSize / 10;
|
|
4467
4764
|
break;
|
|
4468
4765
|
}
|
|
@@ -4477,11 +4774,11 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4477
4774
|
if (text.length === 0 || text.length > 200) continue;
|
|
4478
4775
|
if (/^\d+$/.test(text)) continue;
|
|
4479
4776
|
let level = 0;
|
|
4480
|
-
if (_optionalChain([block, 'access',
|
|
4777
|
+
if (_optionalChain([block, 'access', _118 => _118.style, 'optionalAccess', _119 => _119.fontSize]) && baseFontSize > 0) {
|
|
4481
4778
|
const ratio = block.style.fontSize / baseFontSize;
|
|
4482
|
-
if (ratio >=
|
|
4483
|
-
else if (ratio >=
|
|
4484
|
-
else if (ratio >=
|
|
4779
|
+
if (ratio >= _chunkEV53YE3Wcjs.HEADING_RATIO_H1) level = 1;
|
|
4780
|
+
else if (ratio >= _chunkEV53YE3Wcjs.HEADING_RATIO_H2) level = 2;
|
|
4781
|
+
else if (ratio >= _chunkEV53YE3Wcjs.HEADING_RATIO_H3) level = 3;
|
|
4485
4782
|
}
|
|
4486
4783
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
4487
4784
|
if (level === 0) level = 2;
|
|
@@ -4497,7 +4794,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4497
4794
|
function extractHwp5Metadata(cfb, metadata) {
|
|
4498
4795
|
try {
|
|
4499
4796
|
const summaryEntry = CFB.find(cfb, "/HwpSummaryInformation") || CFB.find(cfb, "/SummaryInformation");
|
|
4500
|
-
if (!_optionalChain([summaryEntry, 'optionalAccess',
|
|
4797
|
+
if (!_optionalChain([summaryEntry, 'optionalAccess', _120 => _120.content])) return;
|
|
4501
4798
|
const data = Buffer.from(summaryEntry.content);
|
|
4502
4799
|
if (data.length < 48) return;
|
|
4503
4800
|
const numSets = data.readUInt32LE(24);
|
|
@@ -4530,7 +4827,7 @@ function findViewTextSections(cfb, compressed) {
|
|
|
4530
4827
|
const sections = [];
|
|
4531
4828
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
4532
4829
|
const entry = CFB.find(cfb, `/ViewText/Section${i}`);
|
|
4533
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4830
|
+
if (!_optionalChain([entry, 'optionalAccess', _121 => _121.content])) break;
|
|
4534
4831
|
try {
|
|
4535
4832
|
const decrypted = decryptViewText(Buffer.from(entry.content), compressed);
|
|
4536
4833
|
sections.push({ idx: i, content: decrypted });
|
|
@@ -4553,13 +4850,13 @@ function findSections(cfb) {
|
|
|
4553
4850
|
const sections = [];
|
|
4554
4851
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
4555
4852
|
const entry = CFB.find(cfb, `/BodyText/Section${i}`);
|
|
4556
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4853
|
+
if (!_optionalChain([entry, 'optionalAccess', _122 => _122.content])) break;
|
|
4557
4854
|
sections.push({ idx: i, content: Buffer.from(entry.content) });
|
|
4558
4855
|
}
|
|
4559
4856
|
if (sections.length === 0 && cfb.FileIndex) {
|
|
4560
4857
|
for (const entry of cfb.FileIndex) {
|
|
4561
4858
|
if (sections.length >= MAX_SECTIONS) break;
|
|
4562
|
-
if (_optionalChain([entry, 'access',
|
|
4859
|
+
if (_optionalChain([entry, 'access', _123 => _123.name, 'optionalAccess', _124 => _124.startsWith, 'call', _125 => _125("Section")]) && entry.content) {
|
|
4563
4860
|
const idx = parseInt(entry.name.replace("Section", ""), 10) || 0;
|
|
4564
4861
|
sections.push({ idx, content: Buffer.from(entry.content) });
|
|
4565
4862
|
}
|
|
@@ -4575,7 +4872,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4575
4872
|
if (!raw) break;
|
|
4576
4873
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4577
4874
|
totalDecompressed += content.length;
|
|
4578
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4875
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4579
4876
|
sections.push({ idx: i, content });
|
|
4580
4877
|
}
|
|
4581
4878
|
if (sections.length === 0) {
|
|
@@ -4587,7 +4884,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4587
4884
|
if (raw) {
|
|
4588
4885
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4589
4886
|
totalDecompressed += content.length;
|
|
4590
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4887
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4591
4888
|
sections.push({ idx, content });
|
|
4592
4889
|
}
|
|
4593
4890
|
}
|
|
@@ -4604,7 +4901,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
4604
4901
|
try {
|
|
4605
4902
|
const content = decryptViewText(raw, compressed);
|
|
4606
4903
|
totalDecompressed += content.length;
|
|
4607
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4904
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4608
4905
|
sections.push({ idx: i, content });
|
|
4609
4906
|
} catch (e30) {
|
|
4610
4907
|
break;
|
|
@@ -4635,8 +4932,17 @@ function createHwp5DocState() {
|
|
|
4635
4932
|
footerBlocks: []
|
|
4636
4933
|
};
|
|
4637
4934
|
}
|
|
4638
|
-
function parseSection(records, docInfo, warnings, sectionNum, doc) {
|
|
4639
|
-
const ctx = {
|
|
4935
|
+
function parseSection(records, docInfo, warnings, sectionNum, doc, pageMap) {
|
|
4936
|
+
const ctx = {
|
|
4937
|
+
docInfo,
|
|
4938
|
+
warnings,
|
|
4939
|
+
sectionNum,
|
|
4940
|
+
doc: _nullishCoalesce(doc, () => ( createHwp5DocState())),
|
|
4941
|
+
depth: 0,
|
|
4942
|
+
page: pageMap ? pageMap.base + 1 : sectionNum,
|
|
4943
|
+
pageMap,
|
|
4944
|
+
topOrdinal: 0
|
|
4945
|
+
};
|
|
4640
4946
|
return parseParagraphList(records, 0, records.length, ctx);
|
|
4641
4947
|
}
|
|
4642
4948
|
function parseParagraphList(records, start, end, ctx) {
|
|
@@ -4645,6 +4951,11 @@ function parseParagraphList(records, start, end, ctx) {
|
|
|
4645
4951
|
while (i < end) {
|
|
4646
4952
|
if (records[i].tagId === TAG_PARA_HEADER) {
|
|
4647
4953
|
const baseLevel = records[i].level;
|
|
4954
|
+
if (baseLevel === 0 && ctx.depth === 0 && ctx.pageMap) {
|
|
4955
|
+
const pg = ctx.pageMap.pageAtPara[ctx.topOrdinal];
|
|
4956
|
+
if (pg !== void 0) ctx.page = ctx.pageMap.base + pg + 1;
|
|
4957
|
+
ctx.topOrdinal++;
|
|
4958
|
+
}
|
|
4648
4959
|
let j = i + 1;
|
|
4649
4960
|
while (j < end && records[j].level > baseLevel) j++;
|
|
4650
4961
|
blocks.push(...parseParagraph(records, i, j, ctx));
|
|
@@ -4705,9 +5016,9 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4705
5016
|
const applied = [];
|
|
4706
5017
|
for (const r of ranges) {
|
|
4707
5018
|
const ctrl = ctrls[r.ctrlIdx];
|
|
4708
|
-
if (!_optionalChain([ctrl, 'optionalAccess',
|
|
5019
|
+
if (!_optionalChain([ctrl, 'optionalAccess', _126 => _126.href]) || r.end <= r.start) continue;
|
|
4709
5020
|
if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
|
|
4710
|
-
const href =
|
|
5021
|
+
const href = _chunkE6DONLTMcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
4711
5022
|
if (!href) continue;
|
|
4712
5023
|
const anchor = text.slice(r.start, r.end);
|
|
4713
5024
|
if (!anchor.trim()) continue;
|
|
@@ -4725,7 +5036,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4725
5036
|
}
|
|
4726
5037
|
if (ps.headType === 1 || ps.headType === 2) {
|
|
4727
5038
|
const nid = ps.numberingId || (ps.headType === 1 ? ctx.doc.outlineNumberingId : 0);
|
|
4728
|
-
const numbering = nid >= 1 ? _optionalChain([ctx, 'access',
|
|
5039
|
+
const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _127 => _127.docInfo, 'optionalAccess', _128 => _128.numberings, 'access', _129 => _129[nid - 1]]) : void 0;
|
|
4729
5040
|
if (numbering) {
|
|
4730
5041
|
const counters = ctx.doc.numbering.advance(nid, ps.paraLevel);
|
|
4731
5042
|
const fmt = numbering.levelFormats[Math.min(ps.paraLevel, 6)];
|
|
@@ -4735,7 +5046,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4735
5046
|
}
|
|
4736
5047
|
}
|
|
4737
5048
|
} else if (ps.headType === 3) {
|
|
4738
|
-
const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access',
|
|
5049
|
+
const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _130 => _130.docInfo, 'optionalAccess', _131 => _131.bullets, 'access', _132 => _132[ps.numberingId - 1]]) : void 0;
|
|
4739
5050
|
if (bullet && bullet.char !== "\uFFFF") headMarker = bullet.char;
|
|
4740
5051
|
}
|
|
4741
5052
|
}
|
|
@@ -4745,7 +5056,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4745
5056
|
const block = {
|
|
4746
5057
|
type: headingLevel > 0 ? "heading" : "paragraph",
|
|
4747
5058
|
text: headMarker ? `${headMarker} ${trimmed}` : trimmed,
|
|
4748
|
-
pageNumber: ctx.
|
|
5059
|
+
pageNumber: ctx.page
|
|
4749
5060
|
};
|
|
4750
5061
|
if (headingLevel > 0) block.level = headingLevel;
|
|
4751
5062
|
if (ctx.docInfo && charShapeIds.length > 0) {
|
|
@@ -4762,7 +5073,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4762
5073
|
if (footnotes.length > 0) block.footnoteText = footnotes.join("; ");
|
|
4763
5074
|
blocks.push(block);
|
|
4764
5075
|
} else if (footnotes.length > 0) {
|
|
4765
|
-
blocks.push({ type: "paragraph", text: `(\uC8FC: ${footnotes.join("; ")})`, pageNumber: ctx.
|
|
5076
|
+
blocks.push({ type: "paragraph", text: `(\uC8FC: ${footnotes.join("; ")})`, pageNumber: ctx.page });
|
|
4766
5077
|
}
|
|
4767
5078
|
for (const ctrl of ctrls) {
|
|
4768
5079
|
if (ctrl.afterBlocks) blocks.push(...ctrl.afterBlocks);
|
|
@@ -4773,7 +5084,7 @@ function applyCtrlEffect(ctrl, records, ctx) {
|
|
|
4773
5084
|
switch (ctrl.id) {
|
|
4774
5085
|
case CTRL_TBL: {
|
|
4775
5086
|
const table2 = parseTableControl(ctrl, records, ctx);
|
|
4776
|
-
if (table2) ctrl.afterBlocks = [{ type: "table", table: table2, pageNumber: ctx.
|
|
5087
|
+
if (table2) ctrl.afterBlocks = [{ type: "table", table: table2, pageNumber: ctx.page }];
|
|
4777
5088
|
return;
|
|
4778
5089
|
}
|
|
4779
5090
|
case CTRL_GSO: {
|
|
@@ -4825,7 +5136,7 @@ function applyCtrlEffect(ctrl, records, ctx) {
|
|
|
4825
5136
|
return;
|
|
4826
5137
|
}
|
|
4827
5138
|
case CTRL_OLE: {
|
|
4828
|
-
ctx.warnings.push({ page: ctx.
|
|
5139
|
+
ctx.warnings.push({ page: ctx.page, message: "\uC2A4\uD0B5\uB41C OLE \uAC1C\uCCB4", code: "SKIPPED_OLE" });
|
|
4829
5140
|
return;
|
|
4830
5141
|
}
|
|
4831
5142
|
// 숨은 설명/단 정의/쪽번호 위치/감추기/찾아보기/책갈피/글자겹침/덧말 — 본문 텍스트 없음 또는 의도적 스킵
|
|
@@ -4902,7 +5213,7 @@ function applyHeaderFooterEffect(ctrl, records, ctx, isHeader) {
|
|
|
4902
5213
|
const key = (isHeader ? "h:" : "f:") + text;
|
|
4903
5214
|
if (ctx.doc.headerTexts.has(key)) return;
|
|
4904
5215
|
ctx.doc.headerTexts.add(key);
|
|
4905
|
-
const block = { type: "paragraph", text, pageNumber: ctx.
|
|
5216
|
+
const block = { type: "paragraph", text, pageNumber: ctx.page };
|
|
4906
5217
|
if (isHeader) ctx.doc.headerBlocks.push(block);
|
|
4907
5218
|
else ctx.doc.footerBlocks.push(block);
|
|
4908
5219
|
}
|
|
@@ -4947,8 +5258,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4947
5258
|
let tableIdx = -1;
|
|
4948
5259
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
4949
5260
|
if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
|
|
4950
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
4951
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5261
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkR4LXZRYPcjs.MAX_ROWS);
|
|
5262
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkR4LXZRYPcjs.MAX_COLS);
|
|
4952
5263
|
tableIdx = i2;
|
|
4953
5264
|
break;
|
|
4954
5265
|
}
|
|
@@ -4988,7 +5299,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4988
5299
|
const cellRows2 = arrangeCells(rows, cols, cells);
|
|
4989
5300
|
const irCells = cellRows2.map((row) => row.map((c) => {
|
|
4990
5301
|
const ir = { text: c.text.trim(), colSpan: c.colSpan, rowSpan: c.rowSpan };
|
|
4991
|
-
if (_optionalChain([c, 'access',
|
|
5302
|
+
if (_optionalChain([c, 'access', _133 => _133.blocks, 'optionalAccess', _134 => _134.length])) ir.blocks = c.blocks;
|
|
4992
5303
|
if (c.isHeader) ir.isHeader = true;
|
|
4993
5304
|
return ir;
|
|
4994
5305
|
}));
|
|
@@ -4997,7 +5308,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4997
5308
|
return table3;
|
|
4998
5309
|
}
|
|
4999
5310
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5000
|
-
const table2 =
|
|
5311
|
+
const table2 = _chunkR4LXZRYPcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5001
5312
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5002
5313
|
return table2.rows > 0 ? table2 : null;
|
|
5003
5314
|
}
|
|
@@ -5014,8 +5325,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5014
5325
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5015
5326
|
const cs = rec.data.readUInt16LE(12);
|
|
5016
5327
|
const rs = rec.data.readUInt16LE(14);
|
|
5017
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5018
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5328
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkR4LXZRYPcjs.MAX_COLS);
|
|
5329
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkR4LXZRYPcjs.MAX_ROWS);
|
|
5019
5330
|
}
|
|
5020
5331
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5021
5332
|
const parts = [];
|
|
@@ -5025,7 +5336,7 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5025
5336
|
parts.push(``);
|
|
5026
5337
|
hasStructure = true;
|
|
5027
5338
|
} else if (b.type === "table" && b.table) {
|
|
5028
|
-
const flat =
|
|
5339
|
+
const flat = _chunkR4LXZRYPcjs.convertTableToText.call(void 0, b.table.cells);
|
|
5029
5340
|
if (flat) parts.push(flat);
|
|
5030
5341
|
hasStructure = true;
|
|
5031
5342
|
} else if (b.text) {
|
|
@@ -5122,13 +5433,13 @@ function pictureToImageBlock(data, ctx) {
|
|
|
5122
5433
|
if (data.length < 73) return null;
|
|
5123
5434
|
const binDataId = data.readUInt16LE(71);
|
|
5124
5435
|
if (binDataId === 0) return null;
|
|
5125
|
-
const item = _optionalChain([ctx, 'access',
|
|
5126
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
5127
|
-
ctx.warnings.push({ page: ctx.
|
|
5436
|
+
const item = _optionalChain([ctx, 'access', _135 => _135.docInfo, 'optionalAccess', _136 => _136.binData, 'access', _137 => _137[binDataId - 1]]);
|
|
5437
|
+
if (_optionalChain([item, 'optionalAccess', _138 => _138.kind]) === "link") {
|
|
5438
|
+
ctx.warnings.push({ page: ctx.page, message: `\uC678\uBD80 \uC5F0\uACB0 \uC774\uBBF8\uC9C0 (binDataId ${binDataId})`, code: "SKIPPED_IMAGE" });
|
|
5128
5439
|
return null;
|
|
5129
5440
|
}
|
|
5130
5441
|
const storageId = item && item.storageId > 0 ? item.storageId : binDataId;
|
|
5131
|
-
return { type: "image", text: String(storageId), pageNumber: ctx.
|
|
5442
|
+
return { type: "image", text: String(storageId), pageNumber: ctx.page };
|
|
5132
5443
|
}
|
|
5133
5444
|
function resolveCharStyle(charShapeIds, docInfo) {
|
|
5134
5445
|
if (charShapeIds.length === 0 || docInfo.charShapes.length === 0) return void 0;
|
|
@@ -17300,40 +17611,40 @@ function desEcbDecrypt(data, key) {
|
|
|
17300
17611
|
}
|
|
17301
17612
|
function readLayout(data) {
|
|
17302
17613
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
17303
|
-
throw new (0,
|
|
17614
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
17304
17615
|
}
|
|
17305
17616
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
17306
17617
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
17307
17618
|
if (payloadOffset >= data.length) {
|
|
17308
|
-
throw new (0,
|
|
17619
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17309
17620
|
}
|
|
17310
17621
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
17311
17622
|
}
|
|
17312
17623
|
function decryptHwp3Document(input, password) {
|
|
17313
17624
|
const { payloadOffset, compressed } = readLayout(input);
|
|
17314
17625
|
if (!compressed) {
|
|
17315
|
-
throw new (0,
|
|
17626
|
+
throw new (0, _chunkE6DONLTMcjs.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)");
|
|
17316
17627
|
}
|
|
17317
17628
|
const source = Buffer.from(input);
|
|
17318
17629
|
const payload = source.subarray(payloadOffset);
|
|
17319
17630
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
17320
17631
|
if (aligned.length === 0) {
|
|
17321
|
-
throw new (0,
|
|
17632
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
17322
17633
|
}
|
|
17323
17634
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
17324
17635
|
let inflated;
|
|
17325
17636
|
try {
|
|
17326
17637
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
17327
17638
|
} catch (err) {
|
|
17328
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
17329
|
-
throw new (0,
|
|
17639
|
+
if (_optionalChain([err, 'optionalAccess', _139 => _139.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17640
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
17330
17641
|
`HWP3 \uC554\uD638 \uBCF8\uBB38\uC758 \uC555\uCD95 \uD574\uC81C \uACB0\uACFC\uAC00 \uCD5C\uB300 \uD5C8\uC6A9 \uD06C\uAE30(${MAX_DECOMPRESSED_BYTES / 1024 / 1024}MB)\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4`
|
|
17331
17642
|
);
|
|
17332
17643
|
}
|
|
17333
|
-
throw new (0,
|
|
17644
|
+
throw new (0, _chunkE6DONLTMcjs.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.");
|
|
17334
17645
|
}
|
|
17335
17646
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
17336
|
-
throw new (0,
|
|
17647
|
+
throw new (0, _chunkE6DONLTMcjs.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.");
|
|
17337
17648
|
}
|
|
17338
17649
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
17339
17650
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -17367,8 +17678,8 @@ var SIMPLE_CTRL = /* @__PURE__ */ new Map([
|
|
|
17367
17678
|
function parseHwp3Document(buffer, options) {
|
|
17368
17679
|
let source = Buffer.from(buffer);
|
|
17369
17680
|
if (isEncryptedHwp3(source)) {
|
|
17370
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
17371
|
-
throw new (0,
|
|
17681
|
+
if (!_optionalChain([options, 'optionalAccess', _140 => _140.password])) {
|
|
17682
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
17372
17683
|
"\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWP3 \uBB38\uC11C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694."
|
|
17373
17684
|
);
|
|
17374
17685
|
}
|
|
@@ -17384,11 +17695,11 @@ function parseHwp3Document(buffer, options) {
|
|
|
17384
17695
|
try {
|
|
17385
17696
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
17386
17697
|
} catch (err) {
|
|
17387
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
17388
|
-
throw new (0,
|
|
17698
|
+
if (_optionalChain([err, 'optionalAccess', _141 => _141.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17699
|
+
throw new (0, _chunkE6DONLTMcjs.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`);
|
|
17389
17700
|
}
|
|
17390
17701
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
17391
|
-
throw new (0,
|
|
17702
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
17392
17703
|
}
|
|
17393
17704
|
} else {
|
|
17394
17705
|
body = tail;
|
|
@@ -17622,15 +17933,15 @@ function getElements(parent, tagName) {
|
|
|
17622
17933
|
const result = [];
|
|
17623
17934
|
for (let i = 0; i < nodes.length; i++) result.push(nodes[i]);
|
|
17624
17935
|
if (result.length > 0) return result;
|
|
17625
|
-
const nsNodes = _optionalChain([parent, 'access',
|
|
17936
|
+
const nsNodes = _optionalChain([parent, 'access', _142 => _142.getElementsByTagNameNS, 'optionalCall', _143 => _143("*", tagName)]);
|
|
17626
17937
|
if (nsNodes) for (let i = 0; i < nsNodes.length; i++) result.push(nsNodes[i]);
|
|
17627
17938
|
return result;
|
|
17628
17939
|
}
|
|
17629
17940
|
function getTextContent(el) {
|
|
17630
|
-
return _nullishCoalesce(_optionalChain([el, 'access',
|
|
17941
|
+
return _nullishCoalesce(_optionalChain([el, 'access', _144 => _144.textContent, 'optionalAccess', _145 => _145.trim, 'call', _146 => _146()]), () => ( ""));
|
|
17631
17942
|
}
|
|
17632
17943
|
function parseXml(text) {
|
|
17633
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
17944
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkE6DONLTMcjs.stripDtd.call(void 0, text), "text/xml");
|
|
17634
17945
|
}
|
|
17635
17946
|
function collectRichText(root) {
|
|
17636
17947
|
let out = "";
|
|
@@ -17639,7 +17950,7 @@ function collectRichText(root) {
|
|
|
17639
17950
|
for (let i = 0; i < children.length; i++) {
|
|
17640
17951
|
if (children[i].nodeType !== 1) continue;
|
|
17641
17952
|
const el = children[i];
|
|
17642
|
-
const local = el.localName || _optionalChain([el, 'access',
|
|
17953
|
+
const local = el.localName || _optionalChain([el, 'access', _147 => _147.tagName, 'optionalAccess', _148 => _148.replace, 'call', _149 => _149(/^[^:]+:/, "")]) || "";
|
|
17643
17954
|
if (local === "rPh") continue;
|
|
17644
17955
|
if (local === "t") out += _nullishCoalesce(el.textContent, () => ( ""));
|
|
17645
17956
|
else walk(el);
|
|
@@ -17858,14 +18169,14 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
17858
18169
|
const merge = mergeMap.get(key);
|
|
17859
18170
|
row.push({
|
|
17860
18171
|
text,
|
|
17861
|
-
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
17862
|
-
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18172
|
+
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _150 => _150.colSpan]), () => ( 1)),
|
|
18173
|
+
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _151 => _151.rowSpan]), () => ( 1))
|
|
17863
18174
|
});
|
|
17864
18175
|
}
|
|
17865
18176
|
cellRows.push(row);
|
|
17866
18177
|
}
|
|
17867
18178
|
if (cellRows.length > 0) {
|
|
17868
|
-
const table2 =
|
|
18179
|
+
const table2 = _chunkR4LXZRYPcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
17869
18180
|
if (table2.rows > 0) {
|
|
17870
18181
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
17871
18182
|
}
|
|
@@ -17873,12 +18184,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
17873
18184
|
return blocks;
|
|
17874
18185
|
}
|
|
17875
18186
|
async function parseXlsxDocument(buffer, options) {
|
|
17876
|
-
|
|
18187
|
+
_chunkE6DONLTMcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
17877
18188
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
17878
18189
|
const warnings = [];
|
|
17879
18190
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
17880
18191
|
if (!workbookFile) {
|
|
17881
|
-
throw new (0,
|
|
18192
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17882
18193
|
}
|
|
17883
18194
|
let sharedStrings = [];
|
|
17884
18195
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -17887,7 +18198,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17887
18198
|
}
|
|
17888
18199
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
17889
18200
|
if (sheets.length === 0) {
|
|
17890
|
-
throw new (0,
|
|
18201
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17891
18202
|
}
|
|
17892
18203
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
17893
18204
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -17907,7 +18218,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17907
18218
|
relsMap = parseRels(await relsFile.async("text"));
|
|
17908
18219
|
}
|
|
17909
18220
|
let pageFilter = null;
|
|
17910
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
18221
|
+
if (_optionalChain([options, 'optionalAccess', _152 => _152.pages])) {
|
|
17911
18222
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
|
|
17912
18223
|
pageFilter = parsePageRange2(options.pages, sheets.length);
|
|
17913
18224
|
}
|
|
@@ -17916,7 +18227,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17916
18227
|
for (let i = 0; i < processedSheets; i++) {
|
|
17917
18228
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
17918
18229
|
const sheet = sheets[i];
|
|
17919
|
-
_optionalChain([options, 'optionalAccess',
|
|
18230
|
+
_optionalChain([options, 'optionalAccess', _153 => _153.onProgress, 'optionalCall', _154 => _154(i + 1, processedSheets)]);
|
|
17920
18231
|
let sheetPath = relsMap.get(sheet.rId);
|
|
17921
18232
|
if (sheetPath) {
|
|
17922
18233
|
if (!sheetPath.startsWith("xl/") && !sheetPath.startsWith("/")) {
|
|
@@ -17939,7 +18250,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17939
18250
|
try {
|
|
17940
18251
|
const sheetXml = await sheetFile.async("text");
|
|
17941
18252
|
const { grid, merges, maxRow, maxCol } = parseWorksheet(sheetXml, sharedStrings, dateXfs, date1904);
|
|
17942
|
-
const sheetBlocks = sheetToBlocks(sheet.name, grid, merges, maxRow, maxCol, i, _optionalChain([options, 'optionalAccess',
|
|
18253
|
+
const sheetBlocks = sheetToBlocks(sheet.name, grid, merges, maxRow, maxCol, i, _optionalChain([options, 'optionalAccess', _155 => _155.keepTrailingEmptyCols]));
|
|
17943
18254
|
blocks.push(...sheetBlocks);
|
|
17944
18255
|
} catch (err) {
|
|
17945
18256
|
warnings.push({
|
|
@@ -17971,7 +18282,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17971
18282
|
} catch (e32) {
|
|
17972
18283
|
}
|
|
17973
18284
|
}
|
|
17974
|
-
const markdown =
|
|
18285
|
+
const markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks);
|
|
17975
18286
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
17976
18287
|
}
|
|
17977
18288
|
|
|
@@ -18422,11 +18733,11 @@ function processGlobals(records) {
|
|
|
18422
18733
|
const xfFmtIds = [];
|
|
18423
18734
|
const firstBof = records[0];
|
|
18424
18735
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
18425
|
-
throw new (0,
|
|
18736
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
18426
18737
|
}
|
|
18427
18738
|
const bof = decodeBof(firstBof.data);
|
|
18428
18739
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
18429
|
-
throw new (0,
|
|
18740
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
18430
18741
|
}
|
|
18431
18742
|
let i = 1;
|
|
18432
18743
|
while (i < records.length) {
|
|
@@ -18554,14 +18865,14 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex, keepAnchoredEmptyCols) {
|
|
|
18554
18865
|
const merge = mergeMap.get(key);
|
|
18555
18866
|
row.push({
|
|
18556
18867
|
text: grid[r][c],
|
|
18557
|
-
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18558
|
-
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18868
|
+
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _156 => _156.colSpan]), () => ( 1)),
|
|
18869
|
+
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _157 => _157.rowSpan]), () => ( 1))
|
|
18559
18870
|
});
|
|
18560
18871
|
}
|
|
18561
18872
|
cellRows.push(row);
|
|
18562
18873
|
}
|
|
18563
18874
|
if (cellRows.length > 0) {
|
|
18564
|
-
const table2 =
|
|
18875
|
+
const table2 = _chunkR4LXZRYPcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18565
18876
|
if (table2.rows > 0) {
|
|
18566
18877
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18567
18878
|
}
|
|
@@ -18574,28 +18885,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18574
18885
|
try {
|
|
18575
18886
|
cfb = parseLenientCfb(buf);
|
|
18576
18887
|
} catch (e) {
|
|
18577
|
-
throw new (0,
|
|
18888
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
18578
18889
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
18579
18890
|
);
|
|
18580
18891
|
}
|
|
18581
18892
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
18582
18893
|
if (!wb) {
|
|
18583
|
-
throw new (0,
|
|
18894
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
18584
18895
|
}
|
|
18585
18896
|
const records = readRecords2(wb);
|
|
18586
18897
|
if (records.length === 0) {
|
|
18587
|
-
throw new (0,
|
|
18898
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
18588
18899
|
}
|
|
18589
18900
|
const firstBof = decodeBof(records[0].data);
|
|
18590
18901
|
if (firstBof && firstBof.vers !== 1536) {
|
|
18591
|
-
throw new (0,
|
|
18902
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
18592
18903
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
18593
18904
|
);
|
|
18594
18905
|
}
|
|
18595
18906
|
const globals = processGlobals(records);
|
|
18596
18907
|
const warnings = [];
|
|
18597
18908
|
if (globals.encrypted) {
|
|
18598
|
-
throw new (0,
|
|
18909
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18599
18910
|
}
|
|
18600
18911
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
18601
18912
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -18607,7 +18918,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18607
18918
|
} : void 0;
|
|
18608
18919
|
const totalSheets = Math.min(globals.sheets.length, MAX_SHEETS2);
|
|
18609
18920
|
let pageFilter = null;
|
|
18610
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
18921
|
+
if (_optionalChain([options, 'optionalAccess', _158 => _158.pages])) {
|
|
18611
18922
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
|
|
18612
18923
|
pageFilter = parsePageRange2(options.pages, totalSheets);
|
|
18613
18924
|
}
|
|
@@ -18616,7 +18927,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18616
18927
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
18617
18928
|
const meta = globals.sheets[i];
|
|
18618
18929
|
if (meta.dt !== 0) continue;
|
|
18619
|
-
_optionalChain([options, 'optionalAccess',
|
|
18930
|
+
_optionalChain([options, 'optionalAccess', _159 => _159.onProgress, 'optionalCall', _160 => _160(i + 1, totalSheets)]);
|
|
18620
18931
|
const bofIdx = findSheetBofIndex(records, meta.lbPlyPos);
|
|
18621
18932
|
if (bofIdx < 0) {
|
|
18622
18933
|
warnings.push({
|
|
@@ -18632,7 +18943,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18632
18943
|
}
|
|
18633
18944
|
try {
|
|
18634
18945
|
const { sheet } = extractSheetCells(records, bofIdx, globals.sst, convertNum);
|
|
18635
|
-
const blocks = sheetToBlocks2(meta.name, sheet, i, _optionalChain([options, 'optionalAccess',
|
|
18946
|
+
const blocks = sheetToBlocks2(meta.name, sheet, i, _optionalChain([options, 'optionalAccess', _161 => _161.keepTrailingEmptyCols]));
|
|
18636
18947
|
allBlocks.push(...blocks);
|
|
18637
18948
|
} catch (e) {
|
|
18638
18949
|
warnings.push({
|
|
@@ -18646,7 +18957,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18646
18957
|
pageCount: totalSheets
|
|
18647
18958
|
};
|
|
18648
18959
|
return {
|
|
18649
|
-
markdown:
|
|
18960
|
+
markdown: _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
18650
18961
|
blocks: allBlocks,
|
|
18651
18962
|
metadata,
|
|
18652
18963
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -19019,8 +19330,8 @@ function isDisplayMath(el) {
|
|
|
19019
19330
|
|
|
19020
19331
|
// src/docx/parser.ts
|
|
19021
19332
|
var MAX_DECOMPRESS_SIZE5 = 100 * 1024 * 1024;
|
|
19022
|
-
function matchesLocal(el,
|
|
19023
|
-
return el.localName ===
|
|
19333
|
+
function matchesLocal(el, localName3) {
|
|
19334
|
+
return el.localName === localName3 || (_nullishCoalesce(_optionalChain([el, 'access', _162 => _162.tagName, 'optionalAccess', _163 => _163.endsWith, 'call', _164 => _164(`:${localName3}`)]), () => ( false)));
|
|
19024
19335
|
}
|
|
19025
19336
|
function effectiveChildElements(parent) {
|
|
19026
19337
|
const result = [];
|
|
@@ -19044,10 +19355,10 @@ function effectiveChildElements(parent) {
|
|
|
19044
19355
|
}
|
|
19045
19356
|
return result;
|
|
19046
19357
|
}
|
|
19047
|
-
function getChildElements(parent,
|
|
19048
|
-
return effectiveChildElements(parent).filter((el) => matchesLocal(el,
|
|
19358
|
+
function getChildElements(parent, localName3) {
|
|
19359
|
+
return effectiveChildElements(parent).filter((el) => matchesLocal(el, localName3));
|
|
19049
19360
|
}
|
|
19050
|
-
function findElements(parent,
|
|
19361
|
+
function findElements(parent, localName3) {
|
|
19051
19362
|
const result = [];
|
|
19052
19363
|
const walk = (node) => {
|
|
19053
19364
|
const children = node.childNodes;
|
|
@@ -19055,7 +19366,7 @@ function findElements(parent, localName2) {
|
|
|
19055
19366
|
const child = children[i];
|
|
19056
19367
|
if (child.nodeType === 1) {
|
|
19057
19368
|
const el = child;
|
|
19058
|
-
if (el.localName ===
|
|
19369
|
+
if (el.localName === localName3 || _optionalChain([el, 'access', _165 => _165.tagName, 'optionalAccess', _166 => _166.endsWith, 'call', _167 => _167(`:${localName3}`)])) {
|
|
19059
19370
|
result.push(el);
|
|
19060
19371
|
}
|
|
19061
19372
|
walk(el);
|
|
@@ -19065,16 +19376,16 @@ function findElements(parent, localName2) {
|
|
|
19065
19376
|
walk(parent);
|
|
19066
19377
|
return result;
|
|
19067
19378
|
}
|
|
19068
|
-
function getAttr(el,
|
|
19379
|
+
function getAttr(el, localName3) {
|
|
19069
19380
|
const attrs = el.attributes;
|
|
19070
19381
|
for (let i = 0; i < attrs.length; i++) {
|
|
19071
19382
|
const attr = attrs[i];
|
|
19072
|
-
if (attr.localName ===
|
|
19383
|
+
if (attr.localName === localName3 || attr.name === localName3) return attr.value;
|
|
19073
19384
|
}
|
|
19074
19385
|
return null;
|
|
19075
19386
|
}
|
|
19076
19387
|
function parseXml2(text) {
|
|
19077
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19388
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkE6DONLTMcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19078
19389
|
}
|
|
19079
19390
|
function parseStyles(xml) {
|
|
19080
19391
|
const doc = parseXml2(xml);
|
|
@@ -19191,7 +19502,7 @@ function collectOmmlRoots(p) {
|
|
|
19191
19502
|
const child = children[i];
|
|
19192
19503
|
if (child.nodeType !== 1) continue;
|
|
19193
19504
|
const el = child;
|
|
19194
|
-
const tag = el.localName || _optionalChain([el, 'access',
|
|
19505
|
+
const tag = el.localName || _optionalChain([el, 'access', _168 => _168.tagName, 'optionalAccess', _169 => _169.replace, 'call', _170 => _170(/^[^:]+:/, "")]) || "";
|
|
19195
19506
|
if (tag === "oMath" || tag === "oMathPara") {
|
|
19196
19507
|
out.push(el);
|
|
19197
19508
|
} else if (tag === "txbxContent" || tag === "Fallback") {
|
|
@@ -19232,7 +19543,7 @@ function fieldUrlFromInstr(instr) {
|
|
|
19232
19543
|
function makeLink(text, rawHref) {
|
|
19233
19544
|
if (!text) return "";
|
|
19234
19545
|
if (!rawHref) return text;
|
|
19235
|
-
const href =
|
|
19546
|
+
const href = _chunkE6DONLTMcjs.sanitizeHref.call(void 0, rawHref);
|
|
19236
19547
|
return href ? `[${text}](${href})` : text;
|
|
19237
19548
|
}
|
|
19238
19549
|
function collectInline(p, footnotes, rels) {
|
|
@@ -19334,7 +19645,7 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
19334
19645
|
const { text, bold: hasBold, italic: hasItalic, footnoteText } = collectInline(p, footnotes, rels);
|
|
19335
19646
|
if (!text) return null;
|
|
19336
19647
|
const style = styles.get(styleId);
|
|
19337
|
-
if (_optionalChain([style, 'optionalAccess',
|
|
19648
|
+
if (_optionalChain([style, 'optionalAccess', _171 => _171.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
|
|
19338
19649
|
return {
|
|
19339
19650
|
type: "heading",
|
|
19340
19651
|
text,
|
|
@@ -19343,8 +19654,8 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
19343
19654
|
}
|
|
19344
19655
|
if (numId && numId !== "0") {
|
|
19345
19656
|
const numDef = numbering.get(numId);
|
|
19346
|
-
const levelInfo = _optionalChain([numDef, 'optionalAccess',
|
|
19347
|
-
const listType = _optionalChain([levelInfo, 'optionalAccess',
|
|
19657
|
+
const levelInfo = _optionalChain([numDef, 'optionalAccess', _172 => _172.get, 'call', _173 => _173(ilvl)]);
|
|
19658
|
+
const listType = _optionalChain([levelInfo, 'optionalAccess', _174 => _174.numFmt]) === "bullet" ? "unordered" : "ordered";
|
|
19348
19659
|
return { type: "list", text, listType };
|
|
19349
19660
|
}
|
|
19350
19661
|
const block = { type: "paragraph", text };
|
|
@@ -19426,7 +19737,7 @@ ${cell2.text}` : cell2.text;
|
|
|
19426
19737
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
19427
19738
|
})
|
|
19428
19739
|
);
|
|
19429
|
-
const table2 =
|
|
19740
|
+
const table2 = _chunkR4LXZRYPcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
19430
19741
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
19431
19742
|
return { type: "table", table: table2 };
|
|
19432
19743
|
}
|
|
@@ -19436,10 +19747,10 @@ function collectCellText(tc2, styles, numbering, footnotes, rels, depth) {
|
|
|
19436
19747
|
for (const el of effectiveChildElements(tc2)) {
|
|
19437
19748
|
if (matchesLocal(el, "p")) {
|
|
19438
19749
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
19439
|
-
if (_optionalChain([block, 'optionalAccess',
|
|
19750
|
+
if (_optionalChain([block, 'optionalAccess', _175 => _175.text])) parts.push(block.text);
|
|
19440
19751
|
for (const tp of collectTextboxParagraphs(el)) {
|
|
19441
19752
|
const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
|
|
19442
|
-
if (_optionalChain([tb, 'optionalAccess',
|
|
19753
|
+
if (_optionalChain([tb, 'optionalAccess', _176 => _176.text])) parts.push(tb.text);
|
|
19443
19754
|
}
|
|
19444
19755
|
} else if (matchesLocal(el, "tbl")) {
|
|
19445
19756
|
for (const tr of getChildElements(el, "tr")) {
|
|
@@ -19474,7 +19785,7 @@ async function buildImageMap(zip, rels, doc, warnings) {
|
|
|
19474
19785
|
try {
|
|
19475
19786
|
const data = await imgFile.async("uint8array");
|
|
19476
19787
|
imgIdx++;
|
|
19477
|
-
const ext = _nullishCoalesce(_optionalChain([imgPath, 'access',
|
|
19788
|
+
const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _177 => _177.split, 'call', _178 => _178("."), 'access', _179 => _179.pop, 'call', _180 => _180(), 'optionalAccess', _181 => _181.toLowerCase, 'call', _182 => _182()]), () => ( "png"));
|
|
19478
19789
|
const mimeMap = {
|
|
19479
19790
|
png: "image/png",
|
|
19480
19791
|
jpg: "image/jpeg",
|
|
@@ -19528,12 +19839,12 @@ function emitParagraphImages(p, imageMap, linked, out) {
|
|
|
19528
19839
|
}
|
|
19529
19840
|
}
|
|
19530
19841
|
async function parseDocxDocument(buffer, options) {
|
|
19531
|
-
|
|
19842
|
+
_chunkE6DONLTMcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
|
|
19532
19843
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19533
19844
|
const warnings = [];
|
|
19534
19845
|
const docFile = zip.file("word/document.xml");
|
|
19535
19846
|
if (!docFile) {
|
|
19536
|
-
throw new (0,
|
|
19847
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19537
19848
|
}
|
|
19538
19849
|
let rels = /* @__PURE__ */ new Map();
|
|
19539
19850
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -19580,7 +19891,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19580
19891
|
const doc = parseXml2(docXml);
|
|
19581
19892
|
const body = findElements(doc, "body");
|
|
19582
19893
|
if (body.length === 0) {
|
|
19583
|
-
throw new (0,
|
|
19894
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19584
19895
|
}
|
|
19585
19896
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
|
|
19586
19897
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -19588,8 +19899,8 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19588
19899
|
const bodyEl = body[0];
|
|
19589
19900
|
const topLevel = effectiveChildElements(bodyEl);
|
|
19590
19901
|
for (const el of topLevel) {
|
|
19591
|
-
const
|
|
19592
|
-
if (
|
|
19902
|
+
const localName3 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _183 => _183.tagName, 'optionalAccess', _184 => _184.split, 'call', _185 => _185(":"), 'access', _186 => _186.pop, 'call', _187 => _187()])));
|
|
19903
|
+
if (localName3 === "p") {
|
|
19593
19904
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
19594
19905
|
if (block) blocks.push(block);
|
|
19595
19906
|
if (imageMap.size > 0) emitParagraphImages(el, imageMap, linkedImages, blocks);
|
|
@@ -19598,8 +19909,8 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19598
19909
|
if (tb) blocks.push(tb);
|
|
19599
19910
|
if (imageMap.size > 0) emitParagraphImages(tp, imageMap, linkedImages, blocks);
|
|
19600
19911
|
}
|
|
19601
|
-
} else if (
|
|
19602
|
-
const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess',
|
|
19912
|
+
} else if (localName3 === "tbl") {
|
|
19913
|
+
const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess', _188 => _188.keepTrailingEmptyCols]));
|
|
19603
19914
|
if (block) blocks.push(block);
|
|
19604
19915
|
}
|
|
19605
19916
|
}
|
|
@@ -19631,7 +19942,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19631
19942
|
}
|
|
19632
19943
|
}
|
|
19633
19944
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
19634
|
-
const markdown =
|
|
19945
|
+
const markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks);
|
|
19635
19946
|
return {
|
|
19636
19947
|
markdown,
|
|
19637
19948
|
blocks,
|
|
@@ -19649,11 +19960,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
19649
19960
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
19650
19961
|
function parseHwpmlDocument(buffer, options) {
|
|
19651
19962
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
19652
|
-
throw new (0,
|
|
19963
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
19653
19964
|
}
|
|
19654
19965
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
19655
19966
|
const normalized = text.replace(/ /g, " ");
|
|
19656
|
-
const xml =
|
|
19967
|
+
const xml = _chunkE6DONLTMcjs.stripDtd.call(void 0, normalized);
|
|
19657
19968
|
const warnings = [];
|
|
19658
19969
|
const parser = new (0, _xmldom.DOMParser)({
|
|
19659
19970
|
onError: (_level, msg2) => {
|
|
@@ -19681,7 +19992,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
19681
19992
|
return { markdown: "", blocks: [], metadata, warnings };
|
|
19682
19993
|
}
|
|
19683
19994
|
const blocks = [];
|
|
19684
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
19995
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _189 => _189.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
|
|
19685
19996
|
let sectionIdx = 0;
|
|
19686
19997
|
const children = body.childNodes;
|
|
19687
19998
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -19690,10 +20001,10 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
19690
20001
|
if (localName(el) !== "SECTION") continue;
|
|
19691
20002
|
sectionIdx++;
|
|
19692
20003
|
if (pageFilter && !pageFilter.has(sectionIdx)) continue;
|
|
19693
|
-
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
20004
|
+
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _190 => _190.keepTrailingEmptyCols]), () => ( false)));
|
|
19694
20005
|
}
|
|
19695
20006
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
19696
|
-
const markdown =
|
|
20007
|
+
const markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks);
|
|
19697
20008
|
return {
|
|
19698
20009
|
markdown,
|
|
19699
20010
|
blocks,
|
|
@@ -19779,7 +20090,7 @@ function parseParagraph3(el, blocks, paraShapeMap, sectionNum) {
|
|
|
19779
20090
|
const shapeInfo = paraShapeMap.get(paraShapeId);
|
|
19780
20091
|
const text = extractParagraphText(el);
|
|
19781
20092
|
if (!text) return;
|
|
19782
|
-
if (_optionalChain([shapeInfo, 'optionalAccess',
|
|
20093
|
+
if (_optionalChain([shapeInfo, 'optionalAccess', _191 => _191.headingLevel]) != null) {
|
|
19783
20094
|
blocks.push({ type: "heading", text, level: shapeInfo.headingLevel, pageNumber: sectionNum });
|
|
19784
20095
|
} else {
|
|
19785
20096
|
blocks.push({ type: "paragraph", text, pageNumber: sectionNum });
|
|
@@ -19858,11 +20169,11 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
19858
20169
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
19859
20170
|
cellRows[r].push(cell2);
|
|
19860
20171
|
}
|
|
19861
|
-
const table2 =
|
|
20172
|
+
const table2 = _chunkR4LXZRYPcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
19862
20173
|
if (structured.length > 0) {
|
|
19863
20174
|
const claimed = /* @__PURE__ */ new Set();
|
|
19864
20175
|
for (const { ctx, cellBlocks } of structured) {
|
|
19865
|
-
let target = _optionalChain([table2, 'access',
|
|
20176
|
+
let target = _optionalChain([table2, 'access', _192 => _192.cells, 'access', _193 => _193[_nullishCoalesce(ctx.rowAddr, () => ( -1))], 'optionalAccess', _194 => _194[_nullishCoalesce(ctx.colAddr, () => ( -1))]]);
|
|
19866
20177
|
if (!target || claimed.has(target) || target.text !== ctx.text) {
|
|
19867
20178
|
target = void 0;
|
|
19868
20179
|
outer: for (const irRow of table2.cells) {
|
|
@@ -20166,7 +20477,7 @@ function fillInCellPatterns(cellText, values, matchedLabels, blockedLabels) {
|
|
|
20166
20477
|
(match, prefix, suffix) => {
|
|
20167
20478
|
const label = prefix + suffix;
|
|
20168
20479
|
const normalizedLabel = normalizeLabel(label);
|
|
20169
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20480
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _195 => _195.has, 'call', _196 => _196(normalizedLabel)])) return match;
|
|
20170
20481
|
const matchKey = values.available(normalizedLabel) ? normalizedLabel : values.available(normalizeLabel(prefix)) ? normalizeLabel(prefix) : void 0;
|
|
20171
20482
|
if (matchKey === void 0) return match;
|
|
20172
20483
|
const newValue = values.consume(matchKey);
|
|
@@ -20245,17 +20556,17 @@ function matchInlineSegment(seg, values, blockedLabels) {
|
|
|
20245
20556
|
const nlabel = normalizeLabel(seg.label);
|
|
20246
20557
|
if (seg.extLabel !== void 0) {
|
|
20247
20558
|
const nExt = normalizeLabel(seg.extLabel);
|
|
20248
|
-
if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess',
|
|
20559
|
+
if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess', _197 => _197.has, 'call', _198 => _198(nExt)]) && values.has(nExt)) {
|
|
20249
20560
|
return { key: nExt, label: seg.extLabel, viaExt: true };
|
|
20250
20561
|
}
|
|
20251
20562
|
}
|
|
20252
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20563
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _199 => _199.has, 'call', _200 => _200(nlabel)])) return void 0;
|
|
20253
20564
|
const key = findMatchingKey(nlabel, values);
|
|
20254
20565
|
return key !== void 0 ? { key, label: seg.label, viaExt: false } : void 0;
|
|
20255
20566
|
}
|
|
20256
20567
|
function clampSegmentEnd(text, seg, next, nextViaExt) {
|
|
20257
20568
|
let ve = seg.valueEnd;
|
|
20258
|
-
if (nextViaExt && _optionalChain([next, 'optionalAccess',
|
|
20569
|
+
if (nextViaExt && _optionalChain([next, 'optionalAccess', _201 => _201.extStart]) !== void 0 && next.extStart < ve) ve = next.extStart;
|
|
20259
20570
|
while (ve > seg.valueStart && /\s/.test(text[ve - 1])) ve--;
|
|
20260
20571
|
return ve;
|
|
20261
20572
|
}
|
|
@@ -20270,7 +20581,7 @@ function normalizeValues(values, warnings) {
|
|
|
20270
20581
|
const { value, format } = typeof raw === "object" && !Array.isArray(raw) ? raw : { value: raw, format: void 0 };
|
|
20271
20582
|
const key = normalizeLabel(label);
|
|
20272
20583
|
if (map.has(key)) {
|
|
20273
|
-
_optionalChain([warnings, 'optionalAccess',
|
|
20584
|
+
_optionalChain([warnings, 'optionalAccess', _202 => _202.push, 'call', _203 => _203(`\uC785\uB825 \uB77C\uBCA8 "${label}"\uC774 \uC815\uADDC\uD654 \uD0A4 "${key}"\uC5D0\uC11C \uB2E4\uB978 \uB77C\uBCA8\uACFC \uCDA9\uB3CC \u2014 \uB4A4 \uAC12\uC73C\uB85C \uB36E\uC5B4\uC500`)]);
|
|
20274
20585
|
}
|
|
20275
20586
|
map.set(key, Array.isArray(value) ? value.map((v) => formatFillValue(v, format)) : formatFillValue(value, format));
|
|
20276
20587
|
}
|
|
@@ -20447,8 +20758,8 @@ function extractFromTable(table2) {
|
|
|
20447
20758
|
if (table2.cols >= 2) {
|
|
20448
20759
|
for (let r = 0; r < table2.rows; r++) {
|
|
20449
20760
|
for (let c = 0; c < table2.cols - 1; c++) {
|
|
20450
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
20451
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
20761
|
+
const labelCell = _optionalChain([table2, 'access', _204 => _204.cells, 'access', _205 => _205[r], 'optionalAccess', _206 => _206[c]]);
|
|
20762
|
+
const valueCell = _optionalChain([table2, 'access', _207 => _207.cells, 'access', _208 => _208[r], 'optionalAccess', _209 => _209[c + 1]]);
|
|
20452
20763
|
if (!labelCell || !valueCell) continue;
|
|
20453
20764
|
if (isLabelCell(labelCell.text)) {
|
|
20454
20765
|
fields.push({
|
|
@@ -20463,15 +20774,15 @@ function extractFromTable(table2) {
|
|
|
20463
20774
|
}
|
|
20464
20775
|
if (fields.length === 0 && table2.rows >= 2 && table2.cols >= 2) {
|
|
20465
20776
|
const headerRow = table2.cells[0];
|
|
20466
|
-
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess',
|
|
20467
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
20777
|
+
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _210 => _210.every, 'call', _211 => _211((cell2) => {
|
|
20778
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _212 => _212.text, 'access', _213 => _213.trim, 'call', _214 => _214()]), () => ( ""));
|
|
20468
20779
|
return t.length > 0 && t.length <= 20;
|
|
20469
20780
|
})]), () => ( false));
|
|
20470
20781
|
if (allLabels) {
|
|
20471
20782
|
for (let r = 1; r < table2.rows; r++) {
|
|
20472
20783
|
for (let c = 0; c < table2.cols; c++) {
|
|
20473
|
-
const label = _nullishCoalesce(_optionalChain([headerRow, 'access',
|
|
20474
|
-
const value = _nullishCoalesce(_optionalChain([table2, 'access',
|
|
20784
|
+
const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _215 => _215[c], 'optionalAccess', _216 => _216.text, 'access', _217 => _217.trim, 'call', _218 => _218()]), () => ( ""));
|
|
20785
|
+
const value = _nullishCoalesce(_optionalChain([table2, 'access', _219 => _219.cells, 'access', _220 => _220[r], 'optionalAccess', _221 => _221[c], 'optionalAccess', _222 => _222.text, 'access', _223 => _223.trim, 'call', _224 => _224()]), () => ( ""));
|
|
20475
20786
|
if (label && value) {
|
|
20476
20787
|
fields.push({ label, value, row: r, col: c });
|
|
20477
20788
|
}
|
|
@@ -20565,7 +20876,7 @@ function fillFormFields(blocks, values, blockedLabels) {
|
|
|
20565
20876
|
for (const table2 of allTables) {
|
|
20566
20877
|
for (let r = 0; r < table2.rows; r++) {
|
|
20567
20878
|
for (let c = 0; c < table2.cols; c++) {
|
|
20568
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20879
|
+
const cell2 = _optionalChain([table2, 'access', _225 => _225.cells, 'access', _226 => _226[r], 'optionalAccess', _227 => _227[c]]);
|
|
20569
20880
|
if (!cell2) continue;
|
|
20570
20881
|
const result = fillInCellPatterns(cell2.text, cursor, matchedLabels, blockedLabels);
|
|
20571
20882
|
if (result) {
|
|
@@ -20597,7 +20908,7 @@ function collectIRTables(blocks, depth) {
|
|
|
20597
20908
|
out.push(block.table);
|
|
20598
20909
|
for (const row of block.table.cells) {
|
|
20599
20910
|
for (const cell2 of row) {
|
|
20600
|
-
if (_optionalChain([cell2, 'optionalAccess',
|
|
20911
|
+
if (_optionalChain([cell2, 'optionalAccess', _228 => _228.blocks, 'optionalAccess', _229 => _229.length])) out.push(...collectIRTables(cell2.blocks, depth + 1));
|
|
20601
20912
|
}
|
|
20602
20913
|
}
|
|
20603
20914
|
}
|
|
@@ -20608,7 +20919,7 @@ function coveredPositions(table2) {
|
|
|
20608
20919
|
for (let r = 0; r < table2.rows; r++) {
|
|
20609
20920
|
for (let c = 0; c < table2.cols; c++) {
|
|
20610
20921
|
if (covered.has(`${r},${c}`)) continue;
|
|
20611
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20922
|
+
const cell2 = _optionalChain([table2, 'access', _230 => _230.cells, 'access', _231 => _231[r], 'optionalAccess', _232 => _232[c]]);
|
|
20612
20923
|
if (!cell2) continue;
|
|
20613
20924
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
20614
20925
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -20624,15 +20935,15 @@ function coveredPositions(table2) {
|
|
|
20624
20935
|
function isHeaderDataTable(table2, covered) {
|
|
20625
20936
|
if (table2.rows < 2) return false;
|
|
20626
20937
|
const headerRow = table2.cells[0];
|
|
20627
|
-
if (!_optionalChain([headerRow, 'optionalAccess',
|
|
20938
|
+
if (!_optionalChain([headerRow, 'optionalAccess', _233 => _233.length])) return false;
|
|
20628
20939
|
const allLabels = headerRow.every((cell2) => {
|
|
20629
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
20940
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _234 => _234.text, 'access', _235 => _235.trim, 'call', _236 => _236()]), () => ( ""));
|
|
20630
20941
|
return t.length > 0 && t.length <= 20 && isLabelCell(t);
|
|
20631
20942
|
});
|
|
20632
20943
|
if (!allLabels) return false;
|
|
20633
20944
|
for (let c = 0; c < table2.cols; c++) {
|
|
20634
20945
|
if (covered.has(`1,${c}`)) continue;
|
|
20635
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20946
|
+
const cell2 = _optionalChain([table2, 'access', _237 => _237.cells, 'access', _238 => _238[1], 'optionalAccess', _239 => _239[c]]);
|
|
20636
20947
|
if (!cell2) break;
|
|
20637
20948
|
return !isLabelCell(cell2.text);
|
|
20638
20949
|
}
|
|
@@ -20645,7 +20956,7 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20645
20956
|
for (let r = skipHeaderRow ? 1 : 0; r < table2.rows; r++) {
|
|
20646
20957
|
for (let c = 0; c < table2.cols; c++) {
|
|
20647
20958
|
if (covered.has(`${r},${c}`)) continue;
|
|
20648
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
20959
|
+
const labelCell = _optionalChain([table2, 'access', _240 => _240.cells, 'access', _241 => _241[r], 'optionalAccess', _242 => _242[c]]);
|
|
20649
20960
|
if (!labelCell) continue;
|
|
20650
20961
|
if (!isLabelCell(labelCell.text)) continue;
|
|
20651
20962
|
let vc = c + labelCell.colSpan;
|
|
@@ -20656,12 +20967,12 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20656
20967
|
if (isKeywordLabel(valueCell.text)) continue;
|
|
20657
20968
|
const normalizedCellLabel = normalizeLabel(labelCell.text);
|
|
20658
20969
|
if (!normalizedCellLabel) continue;
|
|
20659
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20970
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _243 => _243.has, 'call', _244 => _244(normalizedCellLabel)])) continue;
|
|
20660
20971
|
const matchKey = findMatchingKey(normalizedCellLabel, values);
|
|
20661
20972
|
if (matchKey === void 0) continue;
|
|
20662
20973
|
const newValue = values.consume(matchKey);
|
|
20663
20974
|
if (newValue === void 0) continue;
|
|
20664
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
20975
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _245 => _245.has, 'call', _246 => _246(valueCell)])) {
|
|
20665
20976
|
valueCell.text = newValue + " " + valueCell.text;
|
|
20666
20977
|
} else {
|
|
20667
20978
|
valueCell.text = newValue;
|
|
@@ -20678,8 +20989,8 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20678
20989
|
}
|
|
20679
20990
|
if (table2.rows >= 2 && table2.cols >= 2) {
|
|
20680
20991
|
const headerRow = table2.cells[0];
|
|
20681
|
-
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess',
|
|
20682
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
20992
|
+
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _247 => _247.every, 'call', _248 => _248((cell2) => {
|
|
20993
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _249 => _249.text, 'access', _250 => _250.trim, 'call', _251 => _251()]), () => ( ""));
|
|
20683
20994
|
return t.length > 0 && t.length <= 20 && isLabelCell(t);
|
|
20684
20995
|
})]), () => ( false));
|
|
20685
20996
|
if (!allLabels) return;
|
|
@@ -20687,16 +20998,16 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20687
20998
|
for (let c = 0; c < table2.cols; c++) {
|
|
20688
20999
|
if (covered.has(`${r},${c}`)) continue;
|
|
20689
21000
|
const headerCell = headerRow[c];
|
|
20690
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
21001
|
+
const valueCell = _optionalChain([table2, 'access', _252 => _252.cells, 'access', _253 => _253[r], 'optionalAccess', _254 => _254[c]]);
|
|
20691
21002
|
if (!headerCell || !valueCell) continue;
|
|
20692
21003
|
const headerLabel = normalizeLabel(headerCell.text);
|
|
20693
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
21004
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _255 => _255.has, 'call', _256 => _256(headerLabel)])) continue;
|
|
20694
21005
|
const matchKey = findMatchingKey(headerLabel, values);
|
|
20695
21006
|
if (matchKey === void 0) continue;
|
|
20696
21007
|
if (!values.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
20697
21008
|
const newValue = values.consume(matchKey);
|
|
20698
21009
|
if (newValue === void 0) continue;
|
|
20699
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
21010
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _257 => _257.has, 'call', _258 => _258(valueCell)])) {
|
|
20700
21011
|
valueCell.text = newValue + " " + valueCell.text;
|
|
20701
21012
|
} else {
|
|
20702
21013
|
valueCell.text = newValue;
|
|
@@ -20728,7 +21039,7 @@ function fillInlineFields(text, values, filled, matchedLabels, blockedLabels) {
|
|
|
20728
21039
|
if (newValue === void 0) continue;
|
|
20729
21040
|
matchedLabels.add(matchKey);
|
|
20730
21041
|
filled.push({ label: matched.label.trim(), value: newValue, row: -1, col: -1, key: matchKey });
|
|
20731
|
-
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access',
|
|
21042
|
+
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _259 => _259[i + 1], 'optionalAccess', _260 => _260.viaExt]), () => ( false)));
|
|
20732
21043
|
out += text.slice(pos, seg.valueStart);
|
|
20733
21044
|
out += seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
|
|
20734
21045
|
pos = ve;
|
|
@@ -21351,7 +21662,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
21351
21662
|
const splices = [];
|
|
21352
21663
|
for (const region of scanClickHereRegions(xml)) {
|
|
21353
21664
|
const key = normalizeLabel(region.name);
|
|
21354
|
-
if (!key || _optionalChain([blockedLabels, 'optionalAccess',
|
|
21665
|
+
if (!key || _optionalChain([blockedLabels, 'optionalAccess', _261 => _261.has, 'call', _262 => _262(key)])) continue;
|
|
21355
21666
|
if (!cursor.has(key)) continue;
|
|
21356
21667
|
const value = cursor.consume(key);
|
|
21357
21668
|
if (value === void 0) continue;
|
|
@@ -21369,7 +21680,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
21369
21680
|
};
|
|
21370
21681
|
}
|
|
21371
21682
|
async function extractClickHereFields(hwpxBuffer) {
|
|
21372
|
-
|
|
21683
|
+
_chunkE6DONLTMcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
21373
21684
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21374
21685
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21375
21686
|
const fields = [];
|
|
@@ -21417,19 +21728,19 @@ function parseCentralDirectory(buf) {
|
|
|
21417
21728
|
}
|
|
21418
21729
|
}
|
|
21419
21730
|
}
|
|
21420
|
-
if (eocdOffset < 0) throw new (0,
|
|
21731
|
+
if (eocdOffset < 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21421
21732
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
21422
21733
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
21423
21734
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
21424
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
21735
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21425
21736
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
21426
|
-
throw new (0,
|
|
21737
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21427
21738
|
}
|
|
21428
21739
|
const decoder = new TextDecoder("utf-8");
|
|
21429
21740
|
const entries = [];
|
|
21430
21741
|
let pos = cdOffset;
|
|
21431
21742
|
for (let i = 0; i < totalEntries; i++) {
|
|
21432
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
21743
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
21433
21744
|
const flags = view.getUint16(pos + 8, true);
|
|
21434
21745
|
const method = view.getUint16(pos + 10, true);
|
|
21435
21746
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -21440,7 +21751,7 @@ function parseCentralDirectory(buf) {
|
|
|
21440
21751
|
const commentLen = view.getUint16(pos + 32, true);
|
|
21441
21752
|
const localOffset = view.getUint32(pos + 42, true);
|
|
21442
21753
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
21443
|
-
throw new (0,
|
|
21754
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21444
21755
|
}
|
|
21445
21756
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
21446
21757
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -21469,11 +21780,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21469
21780
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
21470
21781
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
21471
21782
|
for (const name of replacements.keys()) {
|
|
21472
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
21783
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkE6DONLTMcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21473
21784
|
}
|
|
21474
21785
|
if (additions) {
|
|
21475
21786
|
for (const name of additions.keys()) {
|
|
21476
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
21787
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkE6DONLTMcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21477
21788
|
}
|
|
21478
21789
|
}
|
|
21479
21790
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -21492,7 +21803,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21492
21803
|
offset += seg.length;
|
|
21493
21804
|
continue;
|
|
21494
21805
|
}
|
|
21495
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
21806
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
21496
21807
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
21497
21808
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
21498
21809
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -21500,7 +21811,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21500
21811
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
21501
21812
|
const method = e.method;
|
|
21502
21813
|
if (method !== 0 && method !== 8) {
|
|
21503
|
-
throw new (0,
|
|
21814
|
+
throw new (0, _chunkE6DONLTMcjs.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`);
|
|
21504
21815
|
}
|
|
21505
21816
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
21506
21817
|
const crc = crc32(newData);
|
|
@@ -21598,11 +21909,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21598
21909
|
// src/form/filler-hwpx.ts
|
|
21599
21910
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
21600
21911
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
21601
|
-
|
|
21912
|
+
_chunkE6DONLTMcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
21602
21913
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21603
21914
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21604
21915
|
if (sectionPaths.length === 0) {
|
|
21605
|
-
throw new (0,
|
|
21916
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21606
21917
|
}
|
|
21607
21918
|
const warnings = [];
|
|
21608
21919
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -21701,7 +22012,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21701
22012
|
if (isKeywordLabel(cellLabelText(valueCell))) continue;
|
|
21702
22013
|
const normalizedCellLabel = normalizeLabel(labelText);
|
|
21703
22014
|
if (!normalizedCellLabel) continue;
|
|
21704
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
22015
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _263 => _263.has, 'call', _264 => _264(normalizedCellLabel)])) continue;
|
|
21705
22016
|
const matchKey = findMatchingKey(normalizedCellLabel, cursor);
|
|
21706
22017
|
if (matchKey === void 0) continue;
|
|
21707
22018
|
if (patternApplied.has(valueCell)) {
|
|
@@ -21759,7 +22070,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21759
22070
|
const dataCells = table2.rows[rowIdx];
|
|
21760
22071
|
for (let colIdx = 0; colIdx < Math.min(headerCells.length, dataCells.length); colIdx++) {
|
|
21761
22072
|
const headerLabel = normalizeLabel(cellLabelText(headerCells[colIdx]));
|
|
21762
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
22073
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _265 => _265.has, 'call', _266 => _266(headerLabel)])) continue;
|
|
21763
22074
|
const matchKey = findMatchingKey(headerLabel, cursor);
|
|
21764
22075
|
if (matchKey === void 0) continue;
|
|
21765
22076
|
if (!cursor.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
@@ -21813,7 +22124,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21813
22124
|
}
|
|
21814
22125
|
for (const para2 of [...scan.bodyParagraphs, ...scan.excludedParagraphs]) {
|
|
21815
22126
|
const existing = ledger.get(para2);
|
|
21816
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
22127
|
+
if (_optionalChain([existing, 'optionalAccess', _267 => _267.fullText]) !== void 0) continue;
|
|
21817
22128
|
const text = matchText(para2);
|
|
21818
22129
|
const segments = scanInlineSegments(text);
|
|
21819
22130
|
const matches = segments.map((seg) => matchInlineSegment(seg, cursor, blockedLabels));
|
|
@@ -21824,7 +22135,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21824
22135
|
const matchKey = matched.key;
|
|
21825
22136
|
const newValue = cursor.consume(matchKey);
|
|
21826
22137
|
if (newValue === void 0) continue;
|
|
21827
|
-
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access',
|
|
22138
|
+
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _268 => _268[i + 1], 'optionalAccess', _269 => _269.viaExt]), () => ( false)));
|
|
21828
22139
|
const replacement = seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
|
|
21829
22140
|
const l = led(para2);
|
|
21830
22141
|
l.ranges.push({ start: seg.valueStart, end: ve, replacement });
|
|
@@ -22065,9 +22376,9 @@ function fixedPitchWidthEm1000(cp) {
|
|
|
22065
22376
|
return cp < 128 ? 500 : 1e3;
|
|
22066
22377
|
}
|
|
22067
22378
|
function measureTextWidth(text, height, ratioPct, opts) {
|
|
22068
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22069
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22070
|
-
const widthEm = _optionalChain([opts, 'optionalAccess',
|
|
22379
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _270 => _270.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
22380
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _271 => _271.spacingPct]), () => ( 0));
|
|
22381
|
+
const widthEm = _optionalChain([opts, 'optionalAccess', _272 => _272.faceClass]) === "fixedPitch" ? fixedPitchWidthEm1000 : charWidthEm1000;
|
|
22071
22382
|
let em = 0;
|
|
22072
22383
|
for (const ch of text) {
|
|
22073
22384
|
const cp = ch.codePointAt(0);
|
|
@@ -22080,9 +22391,9 @@ var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u
|
|
|
22080
22391
|
var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
|
|
22081
22392
|
function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
|
|
22082
22393
|
const EPS = 0.5;
|
|
22083
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22084
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22085
|
-
const widthEm = _optionalChain([opts, 'optionalAccess',
|
|
22394
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _273 => _273.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
22395
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _274 => _274.spacingPct]), () => ( 0));
|
|
22396
|
+
const widthEm = _optionalChain([opts, 'optionalAccess', _275 => _275.faceClass]) === "fixedPitch" ? fixedPitchWidthEm1000 : charWidthEm1000;
|
|
22086
22397
|
const k = height * ratioPct / 100 / 1e3;
|
|
22087
22398
|
const cwCp = (cp) => (cp === 32 ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
|
|
22088
22399
|
const charW2 = (ch) => cwCp(ch.codePointAt(0));
|
|
@@ -22344,7 +22655,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
22344
22655
|
}
|
|
22345
22656
|
function assertFiniteRange(name, value, min, max) {
|
|
22346
22657
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
22347
|
-
throw new (0,
|
|
22658
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
22348
22659
|
}
|
|
22349
22660
|
}
|
|
22350
22661
|
function validateGongmunOptions(opts) {
|
|
@@ -22359,10 +22670,10 @@ function validateGongmunOptions(opts) {
|
|
|
22359
22670
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
22360
22671
|
}
|
|
22361
22672
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
22362
|
-
throw new (0,
|
|
22673
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
22363
22674
|
}
|
|
22364
22675
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
22365
|
-
throw new (0,
|
|
22676
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
22366
22677
|
}
|
|
22367
22678
|
}
|
|
22368
22679
|
if (opts.sizes) {
|
|
@@ -22371,7 +22682,7 @@ function validateGongmunOptions(opts) {
|
|
|
22371
22682
|
}
|
|
22372
22683
|
}
|
|
22373
22684
|
if (opts.approval && opts.approval.length > 6) {
|
|
22374
|
-
throw new (0,
|
|
22685
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("approval must contain at most 6 labels");
|
|
22375
22686
|
}
|
|
22376
22687
|
}
|
|
22377
22688
|
function incompatibleGongmunWarnings(opts) {
|
|
@@ -22435,7 +22746,7 @@ function resolveGongmun(opts) {
|
|
|
22435
22746
|
suppressSingle: _nullishCoalesce(opts.suppressSingle, () => ( false)),
|
|
22436
22747
|
docHead: preset === "official" && opts.docHead ? opts.docHead : null,
|
|
22437
22748
|
docFoot: preset === "official" && opts.docFoot ? opts.docFoot : null,
|
|
22438
|
-
reportInfo: _optionalChain([opts, 'access',
|
|
22749
|
+
reportInfo: _optionalChain([opts, 'access', _276 => _276.reportInfo, 'optionalAccess', _277 => _277.trim, 'call', _278 => _278()]) || null,
|
|
22439
22750
|
noticeHead: preset === "notice" && opts.noticeHead ? opts.noticeHead : null,
|
|
22440
22751
|
// 보도자료 머리박스는 프리셋 자체가 요구 — 옵션 미지정이어도 빈 객체
|
|
22441
22752
|
press: preset === "press" ? _nullishCoalesce(opts.press, () => ( {})) : null
|
|
@@ -22544,16 +22855,16 @@ var PARA_LIST = 7;
|
|
|
22544
22855
|
var DEFAULT_TEXT_COLOR = "#000000";
|
|
22545
22856
|
function resolveTheme(theme) {
|
|
22546
22857
|
return {
|
|
22547
|
-
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22548
|
-
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22549
|
-
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22550
|
-
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22551
|
-
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22552
|
-
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22858
|
+
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _279 => _279.headingColors, 'optionalAccess', _280 => _280[1]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22859
|
+
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _281 => _281.headingColors, 'optionalAccess', _282 => _282[2]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22860
|
+
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _283 => _283.headingColors, 'optionalAccess', _284 => _284[3]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22861
|
+
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _285 => _285.headingColors, 'optionalAccess', _286 => _286[4]]), () => ( _optionalChain([theme, 'optionalAccess', _287 => _287.headingColors, 'optionalAccess', _288 => _288[3]]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
22862
|
+
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _289 => _289.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22863
|
+
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _290 => _290.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22553
22864
|
/** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
|
|
22554
|
-
hasQuoteOption: _optionalChain([theme, 'optionalAccess',
|
|
22555
|
-
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22556
|
-
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess',
|
|
22865
|
+
hasQuoteOption: _optionalChain([theme, 'optionalAccess', _291 => _291.quoteColor]) !== void 0,
|
|
22866
|
+
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _292 => _292.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _293 => _293.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
22867
|
+
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _294 => _294.tableHeaderBold])
|
|
22557
22868
|
};
|
|
22558
22869
|
}
|
|
22559
22870
|
function escapeXml(text) {
|
|
@@ -22909,7 +23220,7 @@ function parseInlineMarkdown(text) {
|
|
|
22909
23220
|
else spans.push(...emphasisSpans(m[0]));
|
|
22910
23221
|
} else {
|
|
22911
23222
|
const anchor = m[2] || m[3];
|
|
22912
|
-
const href = _nullishCoalesce(
|
|
23223
|
+
const href = _nullishCoalesce(_chunkE6DONLTMcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
22913
23224
|
const sub = emphasisSpans(anchor);
|
|
22914
23225
|
if (href) for (const s of sub) s.href = href;
|
|
22915
23226
|
spans.push(...sub);
|
|
@@ -23075,8 +23386,8 @@ function resolvePage(opts) {
|
|
|
23075
23386
|
// 실측: 용지 치수는 방향과 무관하게 유지, 방향은 landscape 속성만 바뀐다
|
|
23076
23387
|
landscape: orientation === "landscape" ? "NARROWLY" : "WIDELY",
|
|
23077
23388
|
columns: cols,
|
|
23078
|
-
header: _optionalChain([header, 'optionalAccess',
|
|
23079
|
-
footer: _optionalChain([footer, 'optionalAccess',
|
|
23389
|
+
header: _optionalChain([header, 'optionalAccess', _295 => _295.trim, 'call', _296 => _296()]) ? header.trim() : null,
|
|
23390
|
+
footer: _optionalChain([footer, 'optionalAccess', _297 => _297.trim, 'call', _298 => _298()]) ? footer.trim() : null
|
|
23080
23391
|
};
|
|
23081
23392
|
}
|
|
23082
23393
|
function columnColPrXml(columns) {
|
|
@@ -23123,7 +23434,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
23123
23434
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
23124
23435
|
const got = m ? Number(m[1]) : NaN;
|
|
23125
23436
|
if (got !== startId + i) {
|
|
23126
|
-
throw new (0,
|
|
23437
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
23127
23438
|
`\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)`
|
|
23128
23439
|
);
|
|
23129
23440
|
}
|
|
@@ -23207,7 +23518,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
23207
23518
|
}
|
|
23208
23519
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
23209
23520
|
if (rows.length !== expectedBase) {
|
|
23210
|
-
throw new (0,
|
|
23521
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
23211
23522
|
`\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`
|
|
23212
23523
|
);
|
|
23213
23524
|
}
|
|
@@ -23435,7 +23746,7 @@ function buildStyles(gongmun) {
|
|
|
23435
23746
|
</hh:styles>`;
|
|
23436
23747
|
}
|
|
23437
23748
|
function generateHeaderXml(theme, gongmun, ratioVariants = [], extraBorderFills = [], extraCharPrXmls = [], listIndentVariants = [], extraFonts = []) {
|
|
23438
|
-
const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess',
|
|
23749
|
+
const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _299 => _299.fonts, 'access', _300 => _300.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _301 => _301.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
|
|
23439
23750
|
const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants, extraCharPrXmls);
|
|
23440
23751
|
const paraPropsXml = buildParaProperties(gongmun, gongmun ? listIndentVariants : []);
|
|
23441
23752
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
@@ -23564,8 +23875,8 @@ function parseChartFence(text) {
|
|
|
23564
23875
|
const spec = chartSpec(type);
|
|
23565
23876
|
let finalSeries = spec.pie ? [series[0]] : series;
|
|
23566
23877
|
finalSeries = finalSeries.map((s) => ({ ...s }));
|
|
23567
|
-
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
23568
|
-
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
23878
|
+
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _302 => _302.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
|
|
23879
|
+
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _303 => _303[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
|
|
23569
23880
|
if (!spec.scatter) {
|
|
23570
23881
|
finalSeries = finalSeries.map((s) => ({ ...s, values: catFinal.map((_, i) => _nullishCoalesce(s.values[i], () => ( 0))) }));
|
|
23571
23882
|
}
|
|
@@ -23607,7 +23918,7 @@ function serSpPr(color, stroke) {
|
|
|
23607
23918
|
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>`;
|
|
23608
23919
|
}
|
|
23609
23920
|
function dPtXml(pointColors, pie) {
|
|
23610
|
-
if (!_optionalChain([pointColors, 'optionalAccess',
|
|
23921
|
+
if (!_optionalChain([pointColors, 'optionalAccess', _304 => _304.length])) return "";
|
|
23611
23922
|
return pointColors.map((col, i) => {
|
|
23612
23923
|
const f = chartColorFill(col);
|
|
23613
23924
|
if (!f) return "";
|
|
@@ -23846,8 +24157,8 @@ function buildGaejosikCover(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH) {
|
|
|
23846
24157
|
const botRow = cell({ bf: GJ_BF_BAR_DARK, col: 0, row: 2, w: g.botDarkW, h: g.botBarH, paras: barEmpty }) + cell({ bf: GJ_BF_BAR_LIGHT, col: 1, colSpan: 2, row: 2, w: g.botLightW, h: g.botBarH, paras: barEmpty });
|
|
23847
24158
|
const tbl2 = table([topRow, titleRow, botRow], g.totalW, g.barH + g.titleH + g.botBarH, 3, 1, bodyWidth);
|
|
23848
24159
|
const host = `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${tbl2}</hp:run></hp:p>`;
|
|
23849
|
-
const date = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
23850
|
-
const org = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
24160
|
+
const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _305 => _305.cover, 'optionalAccess', _306 => _306.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
|
|
24161
|
+
const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _307 => _307.cover, 'optionalAccess', _308 => _308.org]), () => ( ""));
|
|
23851
24162
|
const sub = (t) => `<hp:p paraPrIDRef="${GJ_PARA_COVER}" styleIDRef="0"><hp:run charPrIDRef="${GJ_CHAR_COVER_SUB}"><hp:t>${escapeXml(t)}</hp:t></hp:run></hp:p>`;
|
|
23852
24163
|
const subEmpty = emptyPara(GJ_PARA_COVER, false, GJ_CHAR_COVER_SUB);
|
|
23853
24164
|
return [
|
|
@@ -24103,7 +24414,7 @@ function escapeGfm(text) {
|
|
|
24103
24414
|
}
|
|
24104
24415
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
24105
24416
|
function sanitizeText(text) {
|
|
24106
|
-
let result =
|
|
24417
|
+
let result = _chunkR4LXZRYPcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
24107
24418
|
if (result.length <= 30 && result.includes(" ")) {
|
|
24108
24419
|
const tokens = result.split(" ");
|
|
24109
24420
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -24133,7 +24444,7 @@ function replicateGfmTable(table2) {
|
|
|
24133
24444
|
for (let r = 0; r < numRows; r++) {
|
|
24134
24445
|
for (let c = 0; c < numCols; c++) {
|
|
24135
24446
|
if (skip.has(`${r},${c}`)) continue;
|
|
24136
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
24447
|
+
const cell2 = _optionalChain([cells, 'access', _309 => _309[r], 'optionalAccess', _310 => _310[c]]);
|
|
24137
24448
|
if (!cell2) continue;
|
|
24138
24449
|
display[r][c] = {
|
|
24139
24450
|
text: escapeGfm(sanitizeText(cell2.text)).replace(/\|/g, "\\|").replace(/\n/g, "<br>"),
|
|
@@ -24187,7 +24498,7 @@ function unescapeGfmCell(text) {
|
|
|
24187
24498
|
return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*_`])/g, "$1");
|
|
24188
24499
|
}
|
|
24189
24500
|
function replicateCellInnerHtml(cell2) {
|
|
24190
|
-
if (_optionalChain([cell2, 'access',
|
|
24501
|
+
if (_optionalChain([cell2, 'access', _311 => _311.blocks, 'optionalAccess', _312 => _312.length])) {
|
|
24191
24502
|
return cell2.blocks.map((b) => {
|
|
24192
24503
|
if (b.type === "table" && b.table) {
|
|
24193
24504
|
const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
|
|
@@ -24226,7 +24537,7 @@ function replicateHtmlTable(table2) {
|
|
|
24226
24537
|
const rowCells = [];
|
|
24227
24538
|
for (let c = 0; c < numCols; c++) {
|
|
24228
24539
|
if (skip.has(`${r},${c}`)) continue;
|
|
24229
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
24540
|
+
const cell2 = _optionalChain([cells, 'access', _313 => _313[r], 'optionalAccess', _314 => _314[c]]);
|
|
24230
24541
|
if (!cell2) continue;
|
|
24231
24542
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
24232
24543
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -24272,10 +24583,10 @@ function parseHtmlTable(raw) {
|
|
|
24272
24583
|
}
|
|
24273
24584
|
} else {
|
|
24274
24585
|
if (!isClose) {
|
|
24275
|
-
const cs = parseInt(_optionalChain([attrs, 'access',
|
|
24276
|
-
const rs = parseInt(_optionalChain([attrs, 'access',
|
|
24586
|
+
const cs = parseInt(_optionalChain([attrs, 'access', _315 => _315.match, 'call', _316 => _316(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _317 => _317[1]]) || "1", 10);
|
|
24587
|
+
const rs = parseInt(_optionalChain([attrs, 'access', _318 => _318.match, 'call', _319 => _319(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _320 => _320[1]]) || "1", 10);
|
|
24277
24588
|
cellStart = m.index + m[0].length;
|
|
24278
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
24589
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkR4LXZRYPcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkR4LXZRYPcjs.MAX_ROWS) };
|
|
24279
24590
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
24280
24591
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
24281
24592
|
cellStart = -1;
|
|
@@ -24299,7 +24610,7 @@ function htmlCellInnerToLines(inner) {
|
|
|
24299
24610
|
hadNonText = true;
|
|
24300
24611
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
24301
24612
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
24302
|
-
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess',
|
|
24613
|
+
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _321 => _321[1]]), () => ( _optionalChain([m, 'optionalAccess', _322 => _322[2]])));
|
|
24303
24614
|
if (src) imgSrcs.push(src);
|
|
24304
24615
|
return "";
|
|
24305
24616
|
});
|
|
@@ -24442,7 +24753,7 @@ function edgeXml(tag, d) {
|
|
|
24442
24753
|
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"/>`;
|
|
24443
24754
|
}
|
|
24444
24755
|
function borderFillDefToXml(id, def) {
|
|
24445
|
-
const fill = _optionalChain([def, 'access',
|
|
24756
|
+
const fill = _optionalChain([def, 'access', _323 => _323.fill, 'optionalAccess', _324 => _324.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
|
|
24446
24757
|
return ` <hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0">
|
|
24447
24758
|
<hh:slash type="NONE" Crooked="0" isCounter="0"/>
|
|
24448
24759
|
<hh:backSlash type="NONE" Crooked="0" isCounter="0"/>
|
|
@@ -24758,7 +25069,7 @@ var ImageRegistry = (_class5 = class {
|
|
|
24758
25069
|
}
|
|
24759
25070
|
/** 실데이터 등록 — images 맵 바이트·data: URI. 포맷 미상(webp 등)은 null → placeholder 폴백 */
|
|
24760
25071
|
takeReal(url) {
|
|
24761
|
-
let bytes = _optionalChain([this, 'access',
|
|
25072
|
+
let bytes = _optionalChain([this, 'access', _325 => _325.supplied, 'optionalAccess', _326 => _326.get, 'call', _327 => _327(url)]);
|
|
24762
25073
|
if (!bytes && url.startsWith("data:")) {
|
|
24763
25074
|
const m = /^data:image\/[a-z+]+;base64,([A-Za-z0-9+/=\s]+)$/i.exec(url);
|
|
24764
25075
|
if (m) {
|
|
@@ -24933,11 +25244,11 @@ function estimateRowHeight(cells, widths, charHeight) {
|
|
|
24933
25244
|
function generateTable(rows, theme, style = null, remap = null, seq = 0, images = null) {
|
|
24934
25245
|
const rowCnt = rows.length;
|
|
24935
25246
|
const colCnt = Math.max(...rows.map((r) => r.length), 1);
|
|
24936
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25247
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _328 => _328.bfRegistry]), () => ( null));
|
|
24937
25248
|
const totalW = style ? reg ? style.totalWidth - DATA_TABLE_INSET : style.totalWidth : 44e3;
|
|
24938
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25249
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _329 => _329.charHeight]), () => ( 1e3));
|
|
24939
25250
|
const rowAnchor = normalizeRowAnchor((_nullishCoalesce(rows[0], () => ( []))).map((c) => c.replace(/!\[[^\]]*\]\([^)]*\)/g, "")));
|
|
24940
|
-
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access',
|
|
25251
|
+
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _330 => _330[0], 'optionalAccess', _331 => _331[0]]), () => ( ""))), seq, rowAnchor);
|
|
24941
25252
|
const colMax = Array(colCnt).fill(0);
|
|
24942
25253
|
const colMaxBody = Array(colCnt).fill(0);
|
|
24943
25254
|
const colMinWord = Array(colCnt).fill(0);
|
|
@@ -24965,7 +25276,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24965
25276
|
const k = `${rowIdx},${colIdx}`;
|
|
24966
25277
|
const isLabelCell2 = labelCol0 && colIdx === 0;
|
|
24967
25278
|
const defaultCharPr = style ? reg && (isHeaderRow || isLabelCell2) ? style.boldCharPr : style.charPr : isHeaderRow ? headerCharPr : baseCharPr;
|
|
24968
|
-
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25279
|
+
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _332 => _332.cellChar, 'access', _333 => _333.get, 'call', _334 => _334(k)]), () => ( defaultCharPr));
|
|
24969
25280
|
const centered = isHeaderRow || colCentered[colIdx];
|
|
24970
25281
|
const paraPrId = style ? centered ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
24971
25282
|
const p = cell2.split(/<br\s*\/?>/i).map((seg) => {
|
|
@@ -24983,11 +25294,11 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24983
25294
|
}
|
|
24984
25295
|
}
|
|
24985
25296
|
}
|
|
24986
|
-
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess',
|
|
25297
|
+
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _335 => _335.cellChar, 'access', _336 => _336.has, 'call', _337 => _337(k)]) ? void 0 : mapId);
|
|
24987
25298
|
const body = (runs || (picRuns ? "" : `<hp:run charPrIDRef="${cellCharPr}"><hp:t></hp:t></hp:run>`)) + picRuns;
|
|
24988
25299
|
return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0">${body}</hp:p>`;
|
|
24989
25300
|
}).join("");
|
|
24990
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25301
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _338 => _338.cellBf, 'access', _339 => _339.get, 'call', _340 => _340(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
24991
25302
|
row: rowIdx,
|
|
24992
25303
|
rowEnd: rowIdx,
|
|
24993
25304
|
col: colIdx,
|
|
@@ -24997,7 +25308,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24997
25308
|
headerRows: 1,
|
|
24998
25309
|
fill: isHeaderRow ? _nullishCoalesce(style.headerFill, () => ( "#E6E6E6")) : isLabelCell2 ? _nullishCoalesce(style.labelFill, () => ( "#E7E7E7")) : void 0
|
|
24999
25310
|
})) : style && isHeaderRow ? style.headerBf : 2)));
|
|
25000
|
-
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25311
|
+
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _341 => _341.cellH, 'access', _342 => _342.get, 'call', _343 => _343(k)]), () => ( cellH));
|
|
25001
25312
|
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>`;
|
|
25002
25313
|
}).join("");
|
|
25003
25314
|
return `<hp:tr>${tdElements}</hp:tr>`;
|
|
@@ -25006,7 +25317,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
25006
25317
|
const tblH = rowHeights.reduce((a, b) => a + b, 0);
|
|
25007
25318
|
const tblInner = `<hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tblH}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="1" affectLSpacing="0" flowWithText="0" allowOverlap="0" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="PARA" vertAlign="TOP" horzAlign="LEFT" vertOffset="0" horzOffset="0"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:inMargin left="510" right="510" top="141" bottom="141"/>` + trElements;
|
|
25008
25319
|
const tbl2 = `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE" pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0">${tblInner}</hp:tbl>`;
|
|
25009
|
-
const hostPr = reg && _optionalChain([style, 'optionalAccess',
|
|
25320
|
+
const hostPr = reg && _optionalChain([style, 'optionalAccess', _344 => _344.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
|
|
25010
25321
|
return `<hp:p paraPrIDRef="${hostPr}" styleIDRef="0"><hp:run charPrIDRef="0">${tbl2}</hp:run></hp:p>`;
|
|
25011
25322
|
}
|
|
25012
25323
|
function layoutHtmlRows(rows) {
|
|
@@ -25017,8 +25328,8 @@ function layoutHtmlRows(rows) {
|
|
|
25017
25328
|
let c = 0;
|
|
25018
25329
|
for (const cell2 of rows[r].cells) {
|
|
25019
25330
|
while (occupied.has(`${r},${c}`)) c++;
|
|
25020
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
25021
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
25331
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkR4LXZRYPcjs.MAX_COLS);
|
|
25332
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkR4LXZRYPcjs.MAX_ROWS);
|
|
25022
25333
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
25023
25334
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
25024
25335
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -25046,7 +25357,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25046
25357
|
if (!rows || rows.length === 0) return null;
|
|
25047
25358
|
const { placed, rowCnt, colCnt } = layoutHtmlRows(rows);
|
|
25048
25359
|
if (rowCnt === 0 || colCnt === 0) return null;
|
|
25049
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25360
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _345 => _345.charHeight]), () => ( 1e3));
|
|
25050
25361
|
const first = _nullishCoalesce(placed.find((p) => p.r === 0 && p.c === 0), () => ( placed[0]));
|
|
25051
25362
|
const row0 = Array.from({ length: colCnt }, () => "");
|
|
25052
25363
|
for (const cell2 of placed) {
|
|
@@ -25075,7 +25386,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25075
25386
|
const tblId = nextTableId();
|
|
25076
25387
|
const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
|
|
25077
25388
|
const spanW = (cell2) => colWidths.slice(cell2.c, cell2.c + cell2.colSpan).reduce((a, b) => a + b, 0);
|
|
25078
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25389
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _346 => _346.bfRegistry]), () => ( null));
|
|
25079
25390
|
let htmlHeaderRows = 0;
|
|
25080
25391
|
while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
|
|
25081
25392
|
const tableRowHeights = Array(rowCnt).fill(cellH);
|
|
@@ -25089,7 +25400,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25089
25400
|
const nestedW = Math.max(Math.min(Math.max(sw - 1020, 4e3), sw - 282), 500);
|
|
25090
25401
|
const nestedXml = generateHtmlTableXml(nested, theme, nestedW, style ? { ...style, totalWidth: nestedW } : null);
|
|
25091
25402
|
if (nestedXml) {
|
|
25092
|
-
const szH = _optionalChain([nestedXml, 'access',
|
|
25403
|
+
const szH = _optionalChain([nestedXml, 'access', _347 => _347.match, 'call', _348 => _348(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _349 => _349[1]]);
|
|
25093
25404
|
nestedH += (szH ? Number(szH) : (_nullishCoalesce(nested.match(/<tr[\s>]/gi), () => ( []))).length * cellH) + 300;
|
|
25094
25405
|
}
|
|
25095
25406
|
return nestedXml;
|
|
@@ -25100,7 +25411,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25100
25411
|
for (const line of lines) wrapLines += Math.max(1, Math.ceil(measureTextWidth(unescapeHtml(line).trim(), measureH, 100) / usable));
|
|
25101
25412
|
const lineH = style ? Math.round(measureH * 1.6) : 800;
|
|
25102
25413
|
const contentH = Math.max(cellH * rowSpan, Math.max(wrapLines, 1) * lineH + nestedH);
|
|
25103
|
-
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25414
|
+
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _350 => _350.cellH, 'access', _351 => _351.get, 'call', _352 => _352(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
|
|
25104
25415
|
const perRow = Math.ceil(cellHeight / rowSpan);
|
|
25105
25416
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
|
|
25106
25417
|
return { cell: cell2, rowSpan, lines, nestedXmls, segLines, imgSrcs: cellParsed[i].imgSrcs };
|
|
@@ -25111,7 +25422,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25111
25422
|
const baseCharPr = style ? style.charPr : CHAR_NORMAL;
|
|
25112
25423
|
const headerCharPr = isHeader && useHeaderStyle ? CHAR_TABLE_HEADER : baseCharPr;
|
|
25113
25424
|
const defaultCharPr = style && reg && isHeader ? style.boldCharPr : isHeader ? headerCharPr : baseCharPr;
|
|
25114
|
-
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25425
|
+
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _353 => _353.cellChar, 'access', _354 => _354.get, 'call', _355 => _355(k)]), () => ( defaultCharPr));
|
|
25115
25426
|
const centered = isHeader || colCentered[cell2.c];
|
|
25116
25427
|
const paraPrId = style ? centered ? reg ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : style.centerParaPr : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
25117
25428
|
const picUrls = images ? [...imgSrcs] : [];
|
|
@@ -25151,7 +25462,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25151
25462
|
let cellHeight = 0;
|
|
25152
25463
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) cellHeight += tableRowHeights[r];
|
|
25153
25464
|
const rowEnd = cell2.r + rowSpan - 1;
|
|
25154
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25465
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _356 => _356.cellBf, 'access', _357 => _357.get, 'call', _358 => _358(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
25155
25466
|
row: cell2.r,
|
|
25156
25467
|
rowEnd,
|
|
25157
25468
|
col: cell2.c,
|
|
@@ -25321,7 +25632,7 @@ function buildPressHead(g, ids, bodyWidth, reg) {
|
|
|
25321
25632
|
return [`<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`, blank()];
|
|
25322
25633
|
}
|
|
25323
25634
|
function buildPressContact(g, ids, bodyWidth, reg) {
|
|
25324
|
-
const c = _optionalChain([g, 'access',
|
|
25635
|
+
const c = _optionalChain([g, 'access', _359 => _359.press, 'optionalAccess', _360 => _360.contact]);
|
|
25325
25636
|
if (!c || !c.dept && !c.manager && !c.phone) return [];
|
|
25326
25637
|
const w = bodyWidth - 280;
|
|
25327
25638
|
const cells = [["\uB2F4\uB2F9 \uBD80\uC11C", _nullishCoalesce(c.dept, () => ( ""))], ["\uB2F4\uB2F9\uC790", _nullishCoalesce(c.manager, () => ( ""))], ["\uC5F0\uB77D\uCC98", _nullishCoalesce(c.phone, () => ( ""))]];
|
|
@@ -25700,10 +26011,10 @@ function generateSecPr(gongmun, page = null) {
|
|
|
25700
26011
|
m.header = gongmun.headerFooter;
|
|
25701
26012
|
m.footer = gongmun.headerFooter;
|
|
25702
26013
|
}
|
|
25703
|
-
const secPr = `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="1" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="${_nullishCoalesce(_optionalChain([page, 'optionalAccess',
|
|
25704
|
-
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess',
|
|
25705
|
-
const hf = (_optionalChain([page, 'optionalAccess',
|
|
25706
|
-
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess',
|
|
26014
|
+
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', _361 => _361.landscape]), () => ( "WIDELY"))}" width="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _362 => _362.widthHU]), () => ( A4_W_HU))}" height="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _363 => _363.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>`;
|
|
26015
|
+
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess', _364 => _364.columns]), () => ( 1)));
|
|
26016
|
+
const hf = (_optionalChain([page, 'optionalAccess', _365 => _365.header]) ? headerFooterCtrl("header", page.header, 1) : "") + (_optionalChain([page, 'optionalAccess', _366 => _366.footer]) ? headerFooterCtrl("footer", page.footer, 2) : "");
|
|
26017
|
+
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess', _367 => _367.pageNumbers]) ? pageNumCtrl() : "");
|
|
25707
26018
|
}
|
|
25708
26019
|
var SectionOpener = (_class6 = class {
|
|
25709
26020
|
constructor(gongmun, page = null) {;_class6.prototype.__init13.call(this);
|
|
@@ -25743,19 +26054,19 @@ function buildPreamble(blocks, ctx) {
|
|
|
25743
26054
|
const { gongmun, dfIds, bfReg, tableStyle, richAssets, gjBodyW } = ctx;
|
|
25744
26055
|
const preamble = [];
|
|
25745
26056
|
let hasFrontPages = false;
|
|
25746
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26057
|
+
if (_optionalChain([gongmun, 'optionalAccess', _368 => _368.reportInfo]) && dfIds) {
|
|
25747
26058
|
preamble.push(buildReportInfo(gongmun, dfIds));
|
|
25748
26059
|
}
|
|
25749
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26060
|
+
if (_optionalChain([gongmun, 'optionalAccess', _369 => _369.approval]) && bfReg) {
|
|
25750
26061
|
preamble.push(buildApprovalTable(gongmun.approval, bfReg, richAssets ? GJ_CHAR_APPROVAL : GONGMUN_APPROVAL_CHAR));
|
|
25751
26062
|
}
|
|
25752
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26063
|
+
if (_optionalChain([gongmun, 'optionalAccess', _370 => _370.docHead]) && dfIds) {
|
|
25753
26064
|
preamble.push(...buildDocHead(gongmun, dfIds));
|
|
25754
26065
|
}
|
|
25755
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26066
|
+
if (_optionalChain([gongmun, 'optionalAccess', _371 => _371.noticeHead]) && dfIds) {
|
|
25756
26067
|
preamble.push(...buildNoticeHead(gongmun));
|
|
25757
26068
|
}
|
|
25758
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26069
|
+
if (_optionalChain([gongmun, 'optionalAccess', _372 => _372.press]) && dfIds && bfReg && tableStyle) {
|
|
25759
26070
|
preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
25760
26071
|
}
|
|
25761
26072
|
if (gongmun && (gongmun.cover || gongmun.toc)) {
|
|
@@ -25784,7 +26095,7 @@ function buildPreamble(blocks, ctx) {
|
|
|
25784
26095
|
}
|
|
25785
26096
|
if (gongmun && !ctx.gaejosik && ctx.coverH1Idx < 0 && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
|
|
25786
26097
|
ctx.titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
25787
|
-
} else if (_optionalChain([gongmun, 'optionalAccess',
|
|
26098
|
+
} else if (_optionalChain([gongmun, 'optionalAccess', _373 => _373.press]) && ctx.coverH1Idx < 0 && dfIds) {
|
|
25788
26099
|
ctx.pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
25789
26100
|
}
|
|
25790
26101
|
if (preamble.length > 0) {
|
|
@@ -25799,7 +26110,7 @@ function renderHeading(block, blockIdx, ctx) {
|
|
|
25799
26110
|
if (gongmun && blockIdx === ctx.coverH1Idx) return "";
|
|
25800
26111
|
if (gongmun && blockIdx === ctx.pressH1Idx && dfIds) {
|
|
25801
26112
|
const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
|
|
25802
|
-
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
26113
|
+
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _374 => _374.press, 'optionalAccess', _375 => _375.sub]), () => ( []))) {
|
|
25803
26114
|
parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
|
|
25804
26115
|
}
|
|
25805
26116
|
return parts.join("\n ");
|
|
@@ -25893,8 +26204,8 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
25893
26204
|
const { gongmun, gongmunList, measured, fit, vBase, dfIds } = ctx;
|
|
25894
26205
|
if (gongmun && gongmunList) {
|
|
25895
26206
|
const info = gongmunList.items.get(blockIdx);
|
|
25896
|
-
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
25897
|
-
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
26207
|
+
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _376 => _376.depth]), () => ( 0));
|
|
26208
|
+
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _377 => _377.marker]), () => ( ""));
|
|
25898
26209
|
const content = block.text || "";
|
|
25899
26210
|
if (measured && content.trimStart().startsWith("\u203B")) {
|
|
25900
26211
|
return generateParagraph(content.trim(), GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
|
|
@@ -25903,7 +26214,7 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
25903
26214
|
return generateParagraph(`* ${content.trim()}`, GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
|
|
25904
26215
|
}
|
|
25905
26216
|
const text = marker2 ? `${marker2} ${content}` : content;
|
|
25906
|
-
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess',
|
|
26217
|
+
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _378 => _378.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
|
|
25907
26218
|
let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
|
|
25908
26219
|
let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
|
|
25909
26220
|
if (measured && depth === 0 && gongmun.numbering !== "standard") {
|
|
@@ -25962,18 +26273,18 @@ function renderHtmlTable(block, ctx) {
|
|
|
25962
26273
|
}
|
|
25963
26274
|
function appendPostamble(blocks, ctx) {
|
|
25964
26275
|
const { gongmun, dfIds, bfReg, tableStyle, paraXmls } = ctx;
|
|
25965
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26276
|
+
if (_optionalChain([gongmun, 'optionalAccess', _379 => _379.noticeHead]) && dfIds) {
|
|
25966
26277
|
paraXmls.push(...buildNoticeFoot(gongmun));
|
|
25967
26278
|
}
|
|
25968
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25969
|
-
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access',
|
|
26279
|
+
if (_optionalChain([gongmun, 'optionalAccess', _380 => _380.endMark]) && paraXmls.length > 0) {
|
|
26280
|
+
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _381 => _381.rows, 'optionalAccess', _382 => _382.length]));
|
|
25970
26281
|
const lastText = lastBlock && (lastBlock.type === "paragraph" || lastBlock.type === "list_item") ? lastBlock.text || "" : "";
|
|
25971
26282
|
if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
|
|
25972
26283
|
}
|
|
25973
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26284
|
+
if (_optionalChain([gongmun, 'optionalAccess', _383 => _383.docFoot]) && dfIds) {
|
|
25974
26285
|
paraXmls.push(...buildDocFoot(gongmun, dfIds));
|
|
25975
26286
|
}
|
|
25976
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26287
|
+
if (_optionalChain([gongmun, 'optionalAccess', _384 => _384.press]) && dfIds && bfReg && tableStyle) {
|
|
25977
26288
|
paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
25978
26289
|
}
|
|
25979
26290
|
}
|
|
@@ -25993,7 +26304,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
25993
26304
|
remap,
|
|
25994
26305
|
dfIds,
|
|
25995
26306
|
images,
|
|
25996
|
-
gaejosik: _optionalChain([gongmun, 'optionalAccess',
|
|
26307
|
+
gaejosik: _optionalChain([gongmun, 'optionalAccess', _385 => _385.preset]) === "gaejosik",
|
|
25997
26308
|
measured,
|
|
25998
26309
|
richAssets,
|
|
25999
26310
|
vBase: charVariantBase(richAssets, !!gongmun),
|
|
@@ -26099,9 +26410,9 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
26099
26410
|
|
|
26100
26411
|
// src/hwpx/generator.ts
|
|
26101
26412
|
async function markdownToHwpx(markdown, options) {
|
|
26102
|
-
const theme = resolveTheme(_optionalChain([options, 'optionalAccess',
|
|
26103
|
-
const gongmun = _optionalChain([options, 'optionalAccess',
|
|
26104
|
-
const page = resolvePage(_optionalChain([options, 'optionalAccess',
|
|
26413
|
+
const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _386 => _386.theme]));
|
|
26414
|
+
const gongmun = _optionalChain([options, 'optionalAccess', _387 => _387.gongmun]) ? resolveGongmun(options.gongmun) : null;
|
|
26415
|
+
const page = resolvePage(_optionalChain([options, 'optionalAccess', _388 => _388.page]));
|
|
26105
26416
|
const { md: md2, defs } = extractFootnoteDefs(markdown);
|
|
26106
26417
|
beginInlineDoc(defs);
|
|
26107
26418
|
try {
|
|
@@ -26111,13 +26422,13 @@ async function markdownToHwpx(markdown, options) {
|
|
|
26111
26422
|
const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
|
|
26112
26423
|
const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
|
|
26113
26424
|
const staticBfEnd = staticBorderFillNext(gongmun);
|
|
26114
|
-
const remap = _optionalChain([options, 'optionalAccess',
|
|
26115
|
-
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26425
|
+
const remap = _optionalChain([options, 'optionalAccess', _389 => _389.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _390 => _390.variants, 'optionalAccess', _391 => _391.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
|
|
26426
|
+
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _392 => _392.borderFillXmls, 'access', _393 => _393.length]), () => ( 0)))) : null;
|
|
26116
26427
|
const dfActive = !!gongmun && docframeActive(gongmun);
|
|
26117
|
-
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
26428
|
+
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _394 => _394.variants, 'optionalAccess', _395 => _395.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _396 => _396.charPrXmls, 'access', _397 => _397.length]), () => ( 0)));
|
|
26118
26429
|
const dfIds = dfActive ? docframeIds(dfBase) : null;
|
|
26119
26430
|
const chartParts = [];
|
|
26120
|
-
const supplied = _optionalChain([options, 'optionalAccess',
|
|
26431
|
+
const supplied = _optionalChain([options, 'optionalAccess', _398 => _398.images]) ? new Map(Object.entries(options.images).map(([k, v]) => [k, v instanceof Uint8Array ? v : new Uint8Array(v)])) : void 0;
|
|
26121
26432
|
const images = new ImageRegistry(supplied);
|
|
26122
26433
|
const sectionXml = blocksToSectionXml(blocks, theme, gongmun, gongmunList, fit, chartParts, bfReg, remap, dfIds, images, page);
|
|
26123
26434
|
if (remap && remap.tables.length > 0) {
|
|
@@ -26126,7 +26437,7 @@ async function markdownToHwpx(markdown, options) {
|
|
|
26126
26437
|
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)`);
|
|
26127
26438
|
}
|
|
26128
26439
|
}
|
|
26129
|
-
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26440
|
+
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _399 => _399.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _400 => _400.emit, 'call', _401 => _401()]), () => ( []))];
|
|
26130
26441
|
const zip = new (0, _jszip2.default)();
|
|
26131
26442
|
zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
|
|
26132
26443
|
zip.file("META-INF/container.xml", generateContainerXml());
|
|
@@ -26135,11 +26446,11 @@ async function markdownToHwpx(markdown, options) {
|
|
|
26135
26446
|
zip.file("Contents/header.xml", generateHeaderXml(
|
|
26136
26447
|
theme,
|
|
26137
26448
|
gongmun,
|
|
26138
|
-
_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
26449
|
+
_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _402 => _402.variants]), () => ( [])),
|
|
26139
26450
|
extraBorderFills,
|
|
26140
|
-
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26141
|
-
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess',
|
|
26142
|
-
_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26451
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _403 => _403.charPrXmls]), () => ( [])), ...dfActive ? docframeCharPrXmls(dfBase, richAssets) : []],
|
|
26452
|
+
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _404 => _404.indentVariants]), () => ( [])),
|
|
26453
|
+
_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _405 => _405.fontFaces]), () => ( []))
|
|
26143
26454
|
));
|
|
26144
26455
|
zip.file("Contents/section0.xml", sectionXml);
|
|
26145
26456
|
for (const part of chartParts) zip.file(part.name, part.xml);
|
|
@@ -26193,7 +26504,7 @@ function alignBlocks(a, b) {
|
|
|
26193
26504
|
const m = a.length, n = b.length;
|
|
26194
26505
|
if (m * n > 1e7) return fallbackAlign(a, b);
|
|
26195
26506
|
const lenOf = (blk) => {
|
|
26196
|
-
const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
26507
|
+
const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _406 => _406.text]), () => ( ""))).join(" ") : "";
|
|
26197
26508
|
return t.replace(/\s+/g, " ").trim().length;
|
|
26198
26509
|
};
|
|
26199
26510
|
const aLen = a.map(lenOf);
|
|
@@ -26266,8 +26577,8 @@ function blockSimilarity(a, b) {
|
|
|
26266
26577
|
}
|
|
26267
26578
|
function tableSimilarity(a, b) {
|
|
26268
26579
|
const dimSim = 1 - Math.abs(a.rows * a.cols - b.rows * b.cols) / Math.max(a.rows * a.cols, b.rows * b.cols, 1);
|
|
26269
|
-
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
26270
|
-
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
26580
|
+
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _407 => _407.text]), () => ( ""))).join(" ");
|
|
26581
|
+
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _408 => _408.text]), () => ( ""))).join(" ");
|
|
26271
26582
|
const contentSim = normalizedSimilarity(textsA, textsB);
|
|
26272
26583
|
return dimSim * 0.3 + contentSim * 0.7;
|
|
26273
26584
|
}
|
|
@@ -26278,8 +26589,8 @@ function diffTableCells(a, b) {
|
|
|
26278
26589
|
for (let r = 0; r < maxRows; r++) {
|
|
26279
26590
|
const row = [];
|
|
26280
26591
|
for (let c = 0; c < maxCols; c++) {
|
|
26281
|
-
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access',
|
|
26282
|
-
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access',
|
|
26592
|
+
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access', _409 => _409.cells, 'access', _410 => _410[r], 'optionalAccess', _411 => _411[c], 'optionalAccess', _412 => _412.text]) : void 0;
|
|
26593
|
+
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access', _413 => _413.cells, 'access', _414 => _414[r], 'optionalAccess', _415 => _415[c], 'optionalAccess', _416 => _416.text]) : void 0;
|
|
26283
26594
|
let type;
|
|
26284
26595
|
if (cellA === void 0) type = "added";
|
|
26285
26596
|
else if (cellB === void 0) type = "removed";
|
|
@@ -26329,7 +26640,7 @@ function builtinTemplateDir() {
|
|
|
26329
26640
|
for (const c of candidates) {
|
|
26330
26641
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
26331
26642
|
}
|
|
26332
|
-
throw new (0,
|
|
26643
|
+
throw new (0, _chunkE6DONLTMcjs.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)");
|
|
26333
26644
|
}
|
|
26334
26645
|
function readBuiltinTemplate(t) {
|
|
26335
26646
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -26492,7 +26803,7 @@ function parseRenderStyles(headXml) {
|
|
|
26492
26803
|
const underlineEl = findChildByLocalName(el, "underline");
|
|
26493
26804
|
const textColor = el.getAttribute("textColor");
|
|
26494
26805
|
const fontRef = findChildByLocalName(el, "fontRef");
|
|
26495
|
-
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess',
|
|
26806
|
+
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _417 => _417.getAttribute, 'call', _418 => _418("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _419 => _419.getAttribute, 'call', _420 => _420("latin")])));
|
|
26496
26807
|
const face = fontId != null ? hangulFonts.get(fontId) : void 0;
|
|
26497
26808
|
styles.charPr.set(id, {
|
|
26498
26809
|
height: Number(el.getAttribute("height")) || 1e3,
|
|
@@ -26500,8 +26811,8 @@ function parseRenderStyles(headXml) {
|
|
|
26500
26811
|
italic: findChildByLocalName(el, "italic") != null,
|
|
26501
26812
|
underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
|
|
26502
26813
|
color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
|
|
26503
|
-
ratio: Number(_optionalChain([ratioEl, 'optionalAccess',
|
|
26504
|
-
spacing: Number(_optionalChain([spacingEl, 'optionalAccess',
|
|
26814
|
+
ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _421 => _421.getAttribute, 'call', _422 => _422("hangul")])) || 100,
|
|
26815
|
+
spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _423 => _423.getAttribute, 'call', _424 => _424("hangul")])) || 0,
|
|
26505
26816
|
fontFamily: face ? hwpFaceToCssStack(face) : void 0,
|
|
26506
26817
|
face
|
|
26507
26818
|
});
|
|
@@ -26510,7 +26821,7 @@ function parseRenderStyles(headXml) {
|
|
|
26510
26821
|
const id = el.getAttribute("id");
|
|
26511
26822
|
if (id != null) {
|
|
26512
26823
|
const align = findChildByLocalName(el, "align");
|
|
26513
|
-
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess',
|
|
26824
|
+
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _425 => _425.getAttribute, 'call', _426 => _426("horizontal")]) || "JUSTIFY");
|
|
26514
26825
|
styles.paraGeom.set(id, parseParaGeom(el));
|
|
26515
26826
|
}
|
|
26516
26827
|
} else if (tag === "borderFill") {
|
|
@@ -26524,7 +26835,7 @@ function parseRenderStyles(headXml) {
|
|
|
26524
26835
|
};
|
|
26525
26836
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
26526
26837
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
26527
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
26838
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _427 => _427.getAttribute, 'call', _428 => _428("faceColor")]);
|
|
26528
26839
|
if (face && face.toLowerCase() !== "none") bf.fill = face;
|
|
26529
26840
|
styles.borderFill.set(id, bf);
|
|
26530
26841
|
}
|
|
@@ -26596,7 +26907,7 @@ function collectSites(scan) {
|
|
|
26596
26907
|
}
|
|
26597
26908
|
function attrOf3(openTag, name) {
|
|
26598
26909
|
const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
|
|
26599
|
-
return _optionalChain([m, 'optionalAccess',
|
|
26910
|
+
return _optionalChain([m, 'optionalAccess', _429 => _429[1]]);
|
|
26600
26911
|
}
|
|
26601
26912
|
function paraOpenTag(xml, para2) {
|
|
26602
26913
|
const end = xml.indexOf(">", para2.start);
|
|
@@ -26611,7 +26922,7 @@ function anchorRunInfo(xml, para2, anchor) {
|
|
|
26611
26922
|
if (!tr) return null;
|
|
26612
26923
|
const before = xml.slice(Math.max(0, para2.start), tr.contentStart);
|
|
26613
26924
|
const runOpen = [...before.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
|
|
26614
|
-
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess',
|
|
26925
|
+
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _430 => _430[1]]), () => ( tr.prefix)), () => ( "hp"));
|
|
26615
26926
|
const charPr2 = runOpen && attrOf3(runOpen[0], "charPrIDRef") || "0";
|
|
26616
26927
|
const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
|
|
26617
26928
|
if (close === -1) return null;
|
|
@@ -26638,7 +26949,7 @@ function cellContentWidthMm(xml, cell2) {
|
|
|
26638
26949
|
if (width === null) return null;
|
|
26639
26950
|
let content = width;
|
|
26640
26951
|
const win = cellAddrWindow(xml, cell2);
|
|
26641
|
-
const mg = _optionalChain([win, 'optionalAccess',
|
|
26952
|
+
const mg = _optionalChain([win, 'optionalAccess', _431 => _431.match, 'call', _432 => _432(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
|
|
26642
26953
|
if (mg) {
|
|
26643
26954
|
content -= Number(_nullishCoalesce(attrOf3(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf3(mg[0], "right"), () => ( 0)));
|
|
26644
26955
|
}
|
|
@@ -26672,12 +26983,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
26672
26983
|
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>`;
|
|
26673
26984
|
}
|
|
26674
26985
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
26675
|
-
if (ops.length === 0) throw new (0,
|
|
26986
|
+
if (ops.length === 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
26676
26987
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
26677
|
-
|
|
26988
|
+
_chunkE6DONLTMcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
26678
26989
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
26679
|
-
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access',
|
|
26680
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
26990
|
+
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _433 => _433.match, 'call', _434 => _434(/(\d+)\.xml$/i), 'optionalAccess', _435 => _435[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _436 => _436.match, 'call', _437 => _437(/(\d+)\.xml$/i), 'optionalAccess', _438 => _438[1]]), () => ( 0))));
|
|
26991
|
+
if (sectionPaths.length === 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
26681
26992
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
26682
26993
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
26683
26994
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -26718,11 +27029,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26718
27029
|
const manifestItems = [];
|
|
26719
27030
|
const placed = [];
|
|
26720
27031
|
for (const op of ops) {
|
|
26721
|
-
if (!op.anchor) throw new (0,
|
|
26722
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
27032
|
+
if (!op.anchor) throw new (0, _chunkE6DONLTMcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
27033
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
26723
27034
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
26724
|
-
if (!MIME[ext]) throw new (0,
|
|
26725
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
27035
|
+
if (!MIME[ext]) throw new (0, _chunkE6DONLTMcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
27036
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkE6DONLTMcjs.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)`);
|
|
26726
27037
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
26727
27038
|
let found = null;
|
|
26728
27039
|
let total = 0;
|
|
@@ -26755,7 +27066,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26755
27066
|
}
|
|
26756
27067
|
}
|
|
26757
27068
|
}
|
|
26758
|
-
throw new (0,
|
|
27069
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
26759
27070
|
`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)})`
|
|
26760
27071
|
);
|
|
26761
27072
|
}
|
|
@@ -26763,9 +27074,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26763
27074
|
const xml = sectionXmls[si];
|
|
26764
27075
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
26765
27076
|
if (!run) {
|
|
26766
|
-
throw new (0,
|
|
27077
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
26767
27078
|
}
|
|
26768
|
-
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess',
|
|
27079
|
+
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _439 => _439.charPr, 'access', _440 => _440.get, 'call', _441 => _441(run.charPr), 'optionalAccess', _442 => _442.height]), () => ( 1e3));
|
|
26769
27080
|
const fontPt = charPrHeight / 100;
|
|
26770
27081
|
const emMm = fontPt * 25.4 / 72;
|
|
26771
27082
|
const lineHMm = emMm;
|
|
@@ -26774,7 +27085,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26774
27085
|
const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
|
|
26775
27086
|
const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
|
|
26776
27087
|
const paraPrId = _nullishCoalesce(attrOf3(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
|
|
26777
|
-
const align = _optionalChain([styles, 'optionalAccess',
|
|
27088
|
+
const align = _optionalChain([styles, 'optionalAccess', _443 => _443.paraAlign, 'access', _444 => _444.get, 'call', _445 => _445(paraPrId)]);
|
|
26778
27089
|
let alignShiftMm = 0;
|
|
26779
27090
|
if (align === "CENTER" || align === "RIGHT") {
|
|
26780
27091
|
const paraWMm = measureMm(site.para.text, emMm);
|
|
@@ -26870,7 +27181,7 @@ function parseBorderFills(headerDoc) {
|
|
|
26870
27181
|
};
|
|
26871
27182
|
const fillBrush = findChildByLocalName(bf, "fillBrush");
|
|
26872
27183
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
26873
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
27184
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _446 => _446.getAttribute, 'call', _447 => _447("faceColor")]);
|
|
26874
27185
|
if (face && face !== "none") def.fill = { faceColor: face };
|
|
26875
27186
|
map.set(id, def);
|
|
26876
27187
|
}
|
|
@@ -26902,7 +27213,7 @@ function parseCharPrs(headerDoc, hangulFonts) {
|
|
|
26902
27213
|
if (cp.getAttribute("italic") === "1") def.italic = true;
|
|
26903
27214
|
if (findChildByLocalName(cp, "underline")) def.underline = true;
|
|
26904
27215
|
const fontRef = findChildByLocalName(cp, "fontRef");
|
|
26905
|
-
const hangul = _optionalChain([fontRef, 'optionalAccess',
|
|
27216
|
+
const hangul = _optionalChain([fontRef, 'optionalAccess', _448 => _448.getAttribute, 'call', _449 => _449("hangul")]);
|
|
26906
27217
|
if (hangul) {
|
|
26907
27218
|
def.fontRef_hangul = hangul;
|
|
26908
27219
|
const face = hangulFonts.get(hangul);
|
|
@@ -26930,7 +27241,7 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
26930
27241
|
const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
|
|
26931
27242
|
const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
|
|
26932
27243
|
const sz = findChildByLocalName(tbl2, "sz");
|
|
26933
|
-
const width = _optionalChain([sz, 'optionalAccess',
|
|
27244
|
+
const width = _optionalChain([sz, 'optionalAccess', _450 => _450.getAttribute, 'call', _451 => _451("width")]) || void 0;
|
|
26934
27245
|
const cells = [];
|
|
26935
27246
|
const usedBf = /* @__PURE__ */ new Set();
|
|
26936
27247
|
const usedCp = /* @__PURE__ */ new Set();
|
|
@@ -26943,17 +27254,17 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
26943
27254
|
const addr = findChildByLocalName(tc2, "cellAddr");
|
|
26944
27255
|
const span = findChildByLocalName(tc2, "cellSpan");
|
|
26945
27256
|
const csz = findChildByLocalName(tc2, "cellSz");
|
|
26946
|
-
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
26947
|
-
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
27257
|
+
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _452 => _452.getAttribute, 'call', _453 => _453("rowAddr")])), () => ( 0));
|
|
27258
|
+
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _454 => _454.getAttribute, 'call', _455 => _455("colAddr")])), () => ( 0));
|
|
26948
27259
|
if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
|
|
26949
27260
|
if (row === 0) row0Texts.set(col, directCellText(tc2));
|
|
26950
|
-
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
26951
|
-
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
27261
|
+
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _456 => _456.getAttribute, 'call', _457 => _457("colSpan")])), () => ( 1));
|
|
27262
|
+
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _458 => _458.getAttribute, 'call', _459 => _459("rowSpan")])), () => ( 1));
|
|
26952
27263
|
const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
|
|
26953
27264
|
const cpId = firstRunCharPr(tc2);
|
|
26954
27265
|
const cell2 = { row, col, rowSpan, colSpan };
|
|
26955
|
-
const w = _optionalChain([csz, 'optionalAccess',
|
|
26956
|
-
const hh = _optionalChain([csz, 'optionalAccess',
|
|
27266
|
+
const w = _optionalChain([csz, 'optionalAccess', _460 => _460.getAttribute, 'call', _461 => _461("width")]);
|
|
27267
|
+
const hh = _optionalChain([csz, 'optionalAccess', _462 => _462.getAttribute, 'call', _463 => _463("height")]);
|
|
26957
27268
|
if (w) cell2.width_hwpunit = w;
|
|
26958
27269
|
if (hh) cell2.height_hwpunit = hh;
|
|
26959
27270
|
if (bfId) {
|
|
@@ -27041,16 +27352,16 @@ function pick(map, keys) {
|
|
|
27041
27352
|
return out;
|
|
27042
27353
|
}
|
|
27043
27354
|
async function hwpxToProfile(input) {
|
|
27044
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
27355
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkE6DONLTMcjs.toArrayBuffer.call(void 0, input);
|
|
27045
27356
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
27046
27357
|
const parser = createXmlParser();
|
|
27047
|
-
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access',
|
|
27358
|
+
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _464 => _464.file, 'call', _465 => _465(/[Hh]eader\.xml$/), 'optionalAccess', _466 => _466[0]])));
|
|
27048
27359
|
let headerXml = "<root/>";
|
|
27049
27360
|
if (headerFile) headerXml = await headerFile.async("text");
|
|
27050
27361
|
const headerDoc = parser.parseFromString(headerXml, "text/xml");
|
|
27051
27362
|
const borderFills = parseBorderFills(headerDoc);
|
|
27052
27363
|
const charPrs = parseCharPrs(headerDoc, parseHangulFonts(headerDoc));
|
|
27053
|
-
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access',
|
|
27364
|
+
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _467 => _467.name, 'access', _468 => _468.match, 'call', _469 => _469(/(\d+)\.xml$/), 'optionalAccess', _470 => _470[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _471 => _471.name, 'access', _472 => _472.match, 'call', _473 => _473(/(\d+)\.xml$/), 'optionalAccess', _474 => _474[1]]), () => ( null))), () => ( 0))));
|
|
27054
27365
|
const tables = [];
|
|
27055
27366
|
let tableIndex = 0;
|
|
27056
27367
|
for (const f of sectionFiles) {
|
|
@@ -27364,7 +27675,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
|
|
|
27364
27675
|
var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
|
|
27365
27676
|
function patchTableRows(input) {
|
|
27366
27677
|
const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
|
|
27367
|
-
const xml = _optionalChain([ctx, 'access',
|
|
27678
|
+
const xml = _optionalChain([ctx, 'access', _475 => _475.scans, 'access', _476 => _476[scanTable.sectionIndex], 'optionalAccess', _477 => _477.xml]);
|
|
27368
27679
|
if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
|
|
27369
27680
|
const numRows = table2.rows;
|
|
27370
27681
|
if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
|
|
@@ -27531,7 +27842,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
|
|
|
27531
27842
|
const rr = scanTable.rowRanges[template];
|
|
27532
27843
|
const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
|
|
27533
27844
|
const scan = scanSectionXml(wrapped, 0);
|
|
27534
|
-
const row = _optionalChain([scan, 'access',
|
|
27845
|
+
const row = _optionalChain([scan, 'access', _478 => _478.tables, 'access', _479 => _479[0], 'optionalAccess', _480 => _480.rows, 'access', _481 => _481[0]]);
|
|
27535
27846
|
if (!row || row.length !== cells.length) return null;
|
|
27536
27847
|
const splices = allLinesegRemovalSplices(wrapped);
|
|
27537
27848
|
for (let i = 0; i < cells.length; i++) {
|
|
@@ -27574,7 +27885,7 @@ function rowHeightOf(fragment) {
|
|
|
27574
27885
|
}
|
|
27575
27886
|
function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
|
|
27576
27887
|
const from = scanTable.start + tblOpenLen;
|
|
27577
|
-
const to = _nullishCoalesce(_optionalChain([scanTable, 'access',
|
|
27888
|
+
const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _482 => _482.rowRanges, 'access', _483 => _483[0], 'optionalAccess', _484 => _484.start]), () => ( from));
|
|
27578
27889
|
const slice = xml.slice(from, to);
|
|
27579
27890
|
const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
|
|
27580
27891
|
if (!szM || szM.index === void 0) return null;
|
|
@@ -27763,9 +28074,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
|
|
|
27763
28074
|
});
|
|
27764
28075
|
}
|
|
27765
28076
|
function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
|
|
27766
|
-
const irCell = _optionalChain([table2, 'access',
|
|
28077
|
+
const irCell = _optionalChain([table2, 'access', _485 => _485.cells, 'access', _486 => _486[oc.gridR], 'optionalAccess', _487 => _487[oc.gridC]]);
|
|
27767
28078
|
const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
|
|
27768
|
-
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess',
|
|
28079
|
+
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _488 => _488.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
|
|
27769
28080
|
if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
|
|
27770
28081
|
return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
|
|
27771
28082
|
}
|
|
@@ -27833,7 +28144,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
27833
28144
|
};
|
|
27834
28145
|
const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
|
|
27835
28146
|
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)");
|
|
27836
|
-
const irCell = _optionalChain([table2, 'access',
|
|
28147
|
+
const irCell = _optionalChain([table2, 'access', _489 => _489.cells, 'access', _490 => _490[gridR], 'optionalAccess', _491 => _491[gridC]]);
|
|
27837
28148
|
const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
|
|
27838
28149
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
27839
28150
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -27857,7 +28168,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
27857
28168
|
const target = cell2.paragraphs[0];
|
|
27858
28169
|
if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
|
|
27859
28170
|
const value = newLines.join(" ");
|
|
27860
|
-
const xml = _optionalChain([ctx, 'access',
|
|
28171
|
+
const xml = _optionalChain([ctx, 'access', _492 => _492.scans, 'access', _493 => _493[target.sectionIndex], 'optionalAccess', _494 => _494.xml]);
|
|
27861
28172
|
const rawT = xml ? paraTText(target, xml) : null;
|
|
27862
28173
|
let sp;
|
|
27863
28174
|
if (xml && rawT === null) {
|
|
@@ -27891,7 +28202,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
27891
28202
|
}
|
|
27892
28203
|
for (let i = 0; i < nonEmpty.length; i++) {
|
|
27893
28204
|
if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
|
|
27894
|
-
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access',
|
|
28205
|
+
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _495 => _495.scans, 'access', _496 => _496[nonEmpty[i].sectionIndex], 'optionalAccess', _497 => _497.xml]));
|
|
27895
28206
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
27896
28207
|
splices.push(...sp);
|
|
27897
28208
|
sectionIndex = nonEmpty[i].sectionIndex;
|
|
@@ -27972,7 +28283,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
27972
28283
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
27973
28284
|
if (paths.length > 0) return paths;
|
|
27974
28285
|
}
|
|
27975
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
28286
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkE6DONLTMcjs.compareSectionPaths);
|
|
27976
28287
|
}
|
|
27977
28288
|
function sectionPathsFromManifest(xml) {
|
|
27978
28289
|
const attr = (tag, name) => {
|
|
@@ -27982,7 +28293,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
27982
28293
|
const idToHref = /* @__PURE__ */ new Map();
|
|
27983
28294
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
27984
28295
|
const id = attr(m[1], "id");
|
|
27985
|
-
const href =
|
|
28296
|
+
const href = _chunkE6DONLTMcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
27986
28297
|
if (id && href) idToHref.set(id, href);
|
|
27987
28298
|
}
|
|
27988
28299
|
const ordered = [];
|
|
@@ -27991,7 +28302,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
27991
28302
|
if (href) ordered.push(href);
|
|
27992
28303
|
}
|
|
27993
28304
|
if (ordered.length > 0) return ordered;
|
|
27994
|
-
return Array.from(idToHref.values()).sort(
|
|
28305
|
+
return Array.from(idToHref.values()).sort(_chunkE6DONLTMcjs.compareSectionPaths);
|
|
27995
28306
|
}
|
|
27996
28307
|
|
|
27997
28308
|
// src/roundtrip/patcher.ts
|
|
@@ -28083,7 +28394,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
28083
28394
|
}
|
|
28084
28395
|
}
|
|
28085
28396
|
let verification;
|
|
28086
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
28397
|
+
if (_optionalChain([options, 'optionalAccess', _498 => _498.verify]) !== false) {
|
|
28087
28398
|
try {
|
|
28088
28399
|
const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
|
|
28089
28400
|
verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
|
|
@@ -28101,17 +28412,17 @@ function buildOrigUnits(blocks) {
|
|
|
28101
28412
|
let chunk;
|
|
28102
28413
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
28103
28414
|
const next = blocks[i + 1];
|
|
28104
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
28105
|
-
chunk =
|
|
28415
|
+
if (_optionalChain([next, 'optionalAccess', _499 => _499.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
28416
|
+
chunk = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
28106
28417
|
} else {
|
|
28107
|
-
chunk =
|
|
28418
|
+
chunk = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, [block]);
|
|
28108
28419
|
}
|
|
28109
28420
|
if (chunk) {
|
|
28110
28421
|
const subUnits = splitMarkdownUnits(chunk);
|
|
28111
28422
|
const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
|
|
28112
28423
|
for (let s = 0; s < subUnits.length; s++) {
|
|
28113
28424
|
const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
|
|
28114
|
-
if (block.type === "table" && _optionalChain([block, 'access',
|
|
28425
|
+
if (block.type === "table" && _optionalChain([block, 'access', _500 => _500.table, 'optionalAccess', _501 => _501.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
|
|
28115
28426
|
u.role = "caption";
|
|
28116
28427
|
}
|
|
28117
28428
|
units.push(u);
|
|
@@ -28222,7 +28533,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
28222
28533
|
const ti = ctx.tableInsert;
|
|
28223
28534
|
if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
|
|
28224
28535
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
28225
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
28536
|
+
if (!_optionalChain([mapping, 'optionalAccess', _502 => _502.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");
|
|
28226
28537
|
const para2 = mapping.para;
|
|
28227
28538
|
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");
|
|
28228
28539
|
const scan = ctx.scans[para2.sectionIndex];
|
|
@@ -28250,7 +28561,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
28250
28561
|
}
|
|
28251
28562
|
function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
28252
28563
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
28253
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
28564
|
+
if (!_optionalChain([mapping, 'optionalAccess', _503 => _503.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)");
|
|
28254
28565
|
if (block.text && block.text.includes("\n")) {
|
|
28255
28566
|
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)");
|
|
28256
28567
|
}
|
|
@@ -28281,7 +28592,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
28281
28592
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
28282
28593
|
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");
|
|
28283
28594
|
}
|
|
28284
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access',
|
|
28595
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _504 => _504.scans, 'access', _505 => _505[mapping.para.sectionIndex], 'optionalAccess', _506 => _506.xml]));
|
|
28285
28596
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
28286
28597
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
28287
28598
|
return 1;
|
|
@@ -28473,7 +28784,7 @@ var Surgeon = (_class7 = class {
|
|
|
28473
28784
|
/** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
|
|
28474
28785
|
findEntry(path) {
|
|
28475
28786
|
const parts = path.replace(/^\//, "").split("/");
|
|
28476
|
-
let scope = _nullishCoalesce(_optionalChain([this, 'access',
|
|
28787
|
+
let scope = _nullishCoalesce(_optionalChain([this, 'access', _507 => _507.entries, 'access', _508 => _508[0], 'optionalAccess', _509 => _509.child]), () => ( -1));
|
|
28477
28788
|
let current;
|
|
28478
28789
|
for (const part of parts) {
|
|
28479
28790
|
const search = (idx) => {
|
|
@@ -28681,7 +28992,7 @@ var Surgeon = (_class7 = class {
|
|
|
28681
28992
|
// src/roundtrip/hwp5-patch.ts
|
|
28682
28993
|
var require3 = _module.createRequire.call(void 0, _chunkGS7T56RPcjs.importMetaUrl);
|
|
28683
28994
|
var CFB2 = require3("cfb");
|
|
28684
|
-
var
|
|
28995
|
+
var TAG_PARA_LINE_SEG2 = 69;
|
|
28685
28996
|
function cid2(s) {
|
|
28686
28997
|
return (s.charCodeAt(0) << 24 | s.charCodeAt(1) << 16 | s.charCodeAt(2) << 8 | s.charCodeAt(3)) >>> 0;
|
|
28687
28998
|
}
|
|
@@ -28726,8 +29037,8 @@ function serializeRecords(recs, repl, inserts) {
|
|
|
28726
29037
|
parts.push(header, data);
|
|
28727
29038
|
};
|
|
28728
29039
|
for (let i = 0; i < recs.length; i++) {
|
|
28729
|
-
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess',
|
|
28730
|
-
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess',
|
|
29040
|
+
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _510 => _510.get, 'call', _511 => _511(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
|
|
29041
|
+
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _512 => _512.get, 'call', _513 => _513(i)]), () => ( recs[i].data)));
|
|
28731
29042
|
}
|
|
28732
29043
|
return Buffer.concat(parts);
|
|
28733
29044
|
}
|
|
@@ -28762,7 +29073,7 @@ function scanSection(stream, sectionIndex, compressed) {
|
|
|
28762
29073
|
textIdx = textIdx === -1 ? j : -2;
|
|
28763
29074
|
appendParaText(state, records[j].data);
|
|
28764
29075
|
} else if (t === TAG_CHAR_SHAPE && charShapeIdx === -1) charShapeIdx = j;
|
|
28765
|
-
else if (t ===
|
|
29076
|
+
else if (t === TAG_PARA_LINE_SEG2 && lineSegIdx === -1) lineSegIdx = j;
|
|
28766
29077
|
}
|
|
28767
29078
|
let ctrlSeen = false, nonGso = false;
|
|
28768
29079
|
for (let a = parent[i]; a >= 0; a = parent[a]) {
|
|
@@ -28845,7 +29156,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
28845
29156
|
return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
|
|
28846
29157
|
}
|
|
28847
29158
|
const fhEntry = CFB2.find(cfb, "/FileHeader");
|
|
28848
|
-
if (!_optionalChain([fhEntry, 'optionalAccess',
|
|
29159
|
+
if (!_optionalChain([fhEntry, 'optionalAccess', _514 => _514.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
28849
29160
|
let flags;
|
|
28850
29161
|
try {
|
|
28851
29162
|
flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
|
|
@@ -28867,7 +29178,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
28867
29178
|
const scans = [];
|
|
28868
29179
|
for (let i = 0; i < sectionPaths.length; i++) {
|
|
28869
29180
|
const entry = CFB2.find(cfb, sectionPaths[i]);
|
|
28870
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
29181
|
+
if (!_optionalChain([entry, 'optionalAccess', _515 => _515.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
|
|
28871
29182
|
let stream;
|
|
28872
29183
|
try {
|
|
28873
29184
|
stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
@@ -28918,7 +29229,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
28918
29229
|
}
|
|
28919
29230
|
}
|
|
28920
29231
|
let verification;
|
|
28921
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
29232
|
+
if (_optionalChain([options, 'optionalAccess', _516 => _516.verify]) !== false) {
|
|
28922
29233
|
try {
|
|
28923
29234
|
const reparsed = parseHwp5Document(Buffer.from(data));
|
|
28924
29235
|
const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
|
|
@@ -29008,7 +29319,7 @@ function tableContentScore(irTable, scanTable) {
|
|
|
29008
29319
|
for (const [key, scanCell] of scanTable.cells) {
|
|
29009
29320
|
const comma = key.indexOf(",");
|
|
29010
29321
|
const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
|
|
29011
|
-
const irCell = _optionalChain([irTable, 'access',
|
|
29322
|
+
const irCell = _optionalChain([irTable, 'access', _517 => _517.cells, 'access', _518 => _518[r], 'optionalAccess', _519 => _519[c]]);
|
|
29012
29323
|
if (!irCell) continue;
|
|
29013
29324
|
const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
|
|
29014
29325
|
const b = normForMatch(stripCellTokens(irCell.text));
|
|
@@ -29044,7 +29355,7 @@ function handleModified(orig, edited, ctx) {
|
|
|
29044
29355
|
}
|
|
29045
29356
|
function patchParagraph(block, orig, edited, ctx, skip) {
|
|
29046
29357
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
29047
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
29358
|
+
if (!_optionalChain([mapping, 'optionalAccess', _520 => _520.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)");
|
|
29048
29359
|
const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
|
|
29049
29360
|
let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
|
|
29050
29361
|
if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
|
|
@@ -29243,7 +29554,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before,
|
|
|
29243
29554
|
};
|
|
29244
29555
|
const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
|
|
29245
29556
|
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)");
|
|
29246
|
-
const irCell = _optionalChain([table2, 'access',
|
|
29557
|
+
const irCell = _optionalChain([table2, 'access', _521 => _521.cells, 'access', _522 => _522[gridR], 'optionalAccess', _523 => _523[gridC]]);
|
|
29247
29558
|
const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
|
|
29248
29559
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
29249
29560
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -29650,11 +29961,11 @@ var RULES2 = {
|
|
|
29650
29961
|
}
|
|
29651
29962
|
};
|
|
29652
29963
|
function redactText(text, options) {
|
|
29653
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29964
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _524 => _524.maskChar]), () => ( "\u25CF"));
|
|
29654
29965
|
if (maskChar.length !== 1 || /[0-9A-Za-z]/.test(maskChar)) {
|
|
29655
29966
|
throw new Error(`maskChar\uB294 \uC601\uC22B\uC790\uAC00 \uC544\uB2CC 1\uAE00\uC790\uC5EC\uC57C \uD568: ${JSON.stringify(maskChar)}`);
|
|
29656
29967
|
}
|
|
29657
|
-
const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29968
|
+
const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _525 => _525.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
29658
29969
|
const hits = [];
|
|
29659
29970
|
if (text === "" || enabled.length === 0) return { text, hits };
|
|
29660
29971
|
const occupied = [];
|
|
@@ -29709,8 +30020,8 @@ function sameBreadcrumb(a, b) {
|
|
|
29709
30020
|
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
29710
30021
|
}
|
|
29711
30022
|
function blocksToChunks(blocks, options) {
|
|
29712
|
-
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29713
|
-
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30023
|
+
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _526 => _526.granularity]), () => ( "section"));
|
|
30024
|
+
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _527 => _527.includeTableCells]), () => ( false));
|
|
29714
30025
|
const chunks = [];
|
|
29715
30026
|
const headingStack = [];
|
|
29716
30027
|
const listStack = [];
|
|
@@ -29724,12 +30035,12 @@ function blocksToChunks(blocks, options) {
|
|
|
29724
30035
|
let run = null;
|
|
29725
30036
|
const flushRun = () => {
|
|
29726
30037
|
if (!run) return;
|
|
29727
|
-
push("text", run.breadcrumb,
|
|
30038
|
+
push("text", run.breadcrumb, _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
29728
30039
|
run = null;
|
|
29729
30040
|
};
|
|
29730
30041
|
for (let i = 0; i < blocks.length; i++) {
|
|
29731
30042
|
const block = blocks[i];
|
|
29732
|
-
const md2 =
|
|
30043
|
+
const md2 = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, [block]);
|
|
29733
30044
|
if (!md2) continue;
|
|
29734
30045
|
if (block.type === "heading") {
|
|
29735
30046
|
flushRun();
|
|
@@ -29845,7 +30156,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29845
30156
|
const block = st.blocks[blockIndex];
|
|
29846
30157
|
if (!block) return void 0;
|
|
29847
30158
|
if (block.type === "paragraph" || block.type === "heading") {
|
|
29848
|
-
const para2 = _optionalChain([st, 'access',
|
|
30159
|
+
const para2 = _optionalChain([st, 'access', _528 => _528.paraMap, 'access', _529 => _529.get, 'call', _530 => _530(blockIndex), 'optionalAccess', _531 => _531.para]);
|
|
29849
30160
|
if (!para2) return void 0;
|
|
29850
30161
|
return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
|
|
29851
30162
|
}
|
|
@@ -29870,7 +30181,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29870
30181
|
if (block.text && block.text.includes("\n")) {
|
|
29871
30182
|
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)" };
|
|
29872
30183
|
}
|
|
29873
|
-
if (!_optionalChain([st, 'access',
|
|
30184
|
+
if (!_optionalChain([st, 'access', _532 => _532.paraMap, 'access', _533 => _533.get, 'call', _534 => _534(blockIndex), 'optionalAccess', _535 => _535.para])) {
|
|
29874
30185
|
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)" };
|
|
29875
30186
|
}
|
|
29876
30187
|
return { capability: "text" };
|
|
@@ -29936,7 +30247,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29936
30247
|
continue;
|
|
29937
30248
|
}
|
|
29938
30249
|
if (block.type === "table" && block.table) {
|
|
29939
|
-
if (!_optionalChain([edit, 'access',
|
|
30250
|
+
if (!_optionalChain([edit, 'access', _536 => _536.cells, 'optionalAccess', _537 => _537.length])) {
|
|
29940
30251
|
skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
|
|
29941
30252
|
continue;
|
|
29942
30253
|
}
|
|
@@ -29956,7 +30267,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29956
30267
|
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) });
|
|
29957
30268
|
continue;
|
|
29958
30269
|
}
|
|
29959
|
-
const irCell = _optionalChain([block, 'access',
|
|
30270
|
+
const irCell = _optionalChain([block, 'access', _538 => _538.table, 'access', _539 => _539.cells, 'access', _540 => _540[cellEdit.row], 'optionalAccess', _541 => _541[cellEdit.col]]);
|
|
29960
30271
|
if (!irCell) {
|
|
29961
30272
|
skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
|
|
29962
30273
|
continue;
|
|
@@ -30012,7 +30323,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30012
30323
|
}
|
|
30013
30324
|
if (replacements.size === 0) {
|
|
30014
30325
|
let changes2;
|
|
30015
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
30326
|
+
if (_optionalChain([options, 'optionalAccess', _542 => _542.verify]) !== false) {
|
|
30016
30327
|
const units = splitMarkdownUnits(st.markdown);
|
|
30017
30328
|
changes2 = diffUnitLists(units, units);
|
|
30018
30329
|
}
|
|
@@ -30033,7 +30344,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30033
30344
|
}
|
|
30034
30345
|
this.state = newState;
|
|
30035
30346
|
let changes;
|
|
30036
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
30347
|
+
if (_optionalChain([options, 'optionalAccess', _543 => _543.verify]) !== false) {
|
|
30037
30348
|
changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
|
|
30038
30349
|
}
|
|
30039
30350
|
return { success: true, data: new Uint8Array(data), applied, skipped, changes };
|
|
@@ -30053,7 +30364,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30053
30364
|
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)");
|
|
30054
30365
|
}
|
|
30055
30366
|
const mapping = st.paraMap.get(blockIndex);
|
|
30056
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
30367
|
+
if (!_optionalChain([mapping, 'optionalAccess', _544 => _544.para])) {
|
|
30057
30368
|
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)");
|
|
30058
30369
|
}
|
|
30059
30370
|
let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
@@ -30073,14 +30384,14 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30073
30384
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
30074
30385
|
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");
|
|
30075
30386
|
}
|
|
30076
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access',
|
|
30387
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _545 => _545.scans, 'access', _546 => _546[mapping.para.sectionIndex], 'optionalAccess', _547 => _547.xml]));
|
|
30077
30388
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
30078
30389
|
sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
30079
30390
|
return 1;
|
|
30080
30391
|
}
|
|
30081
30392
|
}, _class8);
|
|
30082
30393
|
function cellStaticCheck(table2, scanTable, r, c) {
|
|
30083
|
-
const irCell = _optionalChain([table2, 'access',
|
|
30394
|
+
const irCell = _optionalChain([table2, 'access', _548 => _548.cells, 'access', _549 => _549[r], 'optionalAccess', _550 => _550[c]]);
|
|
30084
30395
|
if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
|
|
30085
30396
|
const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
|
|
30086
30397
|
if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
|
|
@@ -30164,11 +30475,11 @@ var md = new (0, _markdownit2.default)({
|
|
|
30164
30475
|
breaks: false
|
|
30165
30476
|
});
|
|
30166
30477
|
function renderHtml(markdown, options) {
|
|
30167
|
-
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30168
|
-
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30478
|
+
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _551 => _551.preset]), () => ( "default"));
|
|
30479
|
+
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _552 => _552.extraCss]), () => ( "")));
|
|
30169
30480
|
const body = md.render(markdown);
|
|
30170
|
-
const watermark = _optionalChain([options, 'optionalAccess',
|
|
30171
|
-
const watermarkCss = _optionalChain([options, 'optionalAccess',
|
|
30481
|
+
const watermark = _optionalChain([options, 'optionalAccess', _553 => _553.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
|
|
30482
|
+
const watermarkCss = _optionalChain([options, 'optionalAccess', _554 => _554.watermark]) ? `
|
|
30172
30483
|
.watermark {
|
|
30173
30484
|
position: fixed;
|
|
30174
30485
|
top: 50%; left: 50%;
|
|
@@ -30199,13 +30510,13 @@ async function htmlToPdf(html, options) {
|
|
|
30199
30510
|
try {
|
|
30200
30511
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
30201
30512
|
} catch (e37) {
|
|
30202
|
-
throw new (0,
|
|
30513
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
30203
30514
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
30204
30515
|
);
|
|
30205
30516
|
}
|
|
30206
30517
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
30207
30518
|
if (!executablePath) {
|
|
30208
|
-
throw new (0,
|
|
30519
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
30209
30520
|
"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."
|
|
30210
30521
|
);
|
|
30211
30522
|
}
|
|
@@ -30217,10 +30528,10 @@ async function htmlToPdf(html, options) {
|
|
|
30217
30528
|
try {
|
|
30218
30529
|
const page = await browser.newPage();
|
|
30219
30530
|
await page.setContent(html, { waitUntil: "networkidle0" });
|
|
30220
|
-
const margin = _optionalChain([options, 'optionalAccess',
|
|
30531
|
+
const margin = _optionalChain([options, 'optionalAccess', _555 => _555.margin]);
|
|
30221
30532
|
const pdf = await page.pdf({
|
|
30222
|
-
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30223
|
-
landscape: _optionalChain([options, 'optionalAccess',
|
|
30533
|
+
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _556 => _556.pageSize]), () => ( "A4")),
|
|
30534
|
+
landscape: _optionalChain([options, 'optionalAccess', _557 => _557.orientation]) === "landscape",
|
|
30224
30535
|
printBackground: true,
|
|
30225
30536
|
margin: margin ? {
|
|
30226
30537
|
top: toCss(margin.top),
|
|
@@ -30228,9 +30539,9 @@ async function htmlToPdf(html, options) {
|
|
|
30228
30539
|
bottom: toCss(margin.bottom),
|
|
30229
30540
|
left: toCss(margin.left)
|
|
30230
30541
|
} : void 0,
|
|
30231
|
-
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess',
|
|
30232
|
-
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30233
|
-
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30542
|
+
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _558 => _558.header]) || _optionalChain([options, 'optionalAccess', _559 => _559.footer])),
|
|
30543
|
+
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _560 => _560.header]), () => ( "<div></div>")),
|
|
30544
|
+
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _561 => _561.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
|
|
30234
30545
|
});
|
|
30235
30546
|
return Buffer.from(pdf);
|
|
30236
30547
|
} finally {
|
|
@@ -30264,7 +30575,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
30264
30575
|
return htmlToPdf(html, options);
|
|
30265
30576
|
}
|
|
30266
30577
|
async function blocksToPdf(blocks, options) {
|
|
30267
|
-
const markdown =
|
|
30578
|
+
const markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks);
|
|
30268
30579
|
return markdownToPdf(markdown, options);
|
|
30269
30580
|
}
|
|
30270
30581
|
|
|
@@ -30443,7 +30754,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode) {
|
|
|
30443
30754
|
}
|
|
30444
30755
|
const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
|
|
30445
30756
|
if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
|
|
30446
|
-
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
30757
|
+
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _562 => _562.getAttribute, 'call', _563 => _563("vertRelTo")]), () => ( "PARA"));
|
|
30447
30758
|
if (vertRel === "PAGE" || vertRel === "PAPER") continue;
|
|
30448
30759
|
const vo = Math.max(0, num2(pos, "vertOffset"));
|
|
30449
30760
|
if (wrapAttr === "TOP_AND_BOTTOM") {
|
|
@@ -30504,7 +30815,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
30504
30815
|
if (ln(p) !== "p") continue;
|
|
30505
30816
|
reflowTablesIn(p, doc, styles, mode, counter);
|
|
30506
30817
|
const g = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
30507
|
-
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
30818
|
+
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _564 => _564.spaceBefore]), () => ( 0)));
|
|
30508
30819
|
const res = reflowPara(p, doc, styles, areaW, startV, mode);
|
|
30509
30820
|
if (!res) {
|
|
30510
30821
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
@@ -30517,7 +30828,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
30517
30828
|
}
|
|
30518
30829
|
if (Number.isFinite(bottom)) {
|
|
30519
30830
|
cursorV = bottom;
|
|
30520
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
30831
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess', _565 => _565.spaceAfter]), () => ( 0));
|
|
30521
30832
|
}
|
|
30522
30833
|
}
|
|
30523
30834
|
continue;
|
|
@@ -30623,7 +30934,7 @@ function buildPara(p) {
|
|
|
30623
30934
|
const pos = findChildByLocalName(ch, "pos");
|
|
30624
30935
|
const w = num3(sz, "width") || num3(findChildByLocalName(ch, "curSz"), "width") || num3(findChildByLocalName(ch, "orgSz"), "width");
|
|
30625
30936
|
const h = num3(sz, "height") || num3(findChildByLocalName(ch, "curSz"), "height") || num3(findChildByLocalName(ch, "orgSz"), "height");
|
|
30626
|
-
const inline = _optionalChain([pos, 'optionalAccess',
|
|
30937
|
+
const inline = _optionalChain([pos, 'optionalAccess', _566 => _566.getAttribute, 'call', _567 => _567("treatAsChar")]) === "1";
|
|
30627
30938
|
const om = inline && cn === "tbl" ? findChildByLocalName(ch, "outMargin") : null;
|
|
30628
30939
|
objs.push({
|
|
30629
30940
|
el: ch,
|
|
@@ -30883,15 +31194,15 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
30883
31194
|
const sx = ow > 0 ? w / ow : 1;
|
|
30884
31195
|
const sy = oh > 0 ? h / oh : 1;
|
|
30885
31196
|
const lineShape = findChildByLocalName(el, "lineShape");
|
|
30886
|
-
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess',
|
|
30887
|
-
const strokeCol = _optionalChain([lineShape, 'optionalAccess',
|
|
31197
|
+
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _568 => _568.getAttribute, 'call', _569 => _569("style")]), () => ( "SOLID"));
|
|
31198
|
+
const strokeCol = _optionalChain([lineShape, 'optionalAccess', _570 => _570.getAttribute, 'call', _571 => _571("color")]) || "#000000";
|
|
30888
31199
|
const hasStroke = lstyle !== "NONE";
|
|
30889
31200
|
const strokeW = hasStroke ? shapeStrokePt(lineShape ? num3(lineShape, "width") : 33) : 0;
|
|
30890
31201
|
const dash = /DASH|DOT/.test(lstyle) ? ` stroke-dasharray="${lstyle.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
30891
31202
|
const strokeAttr = hasStroke ? ` stroke="${escapeXml3(strokeCol)}" stroke-width="${strokeW.toFixed(2)}"${dash}` : "";
|
|
30892
31203
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
30893
31204
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
30894
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
31205
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _572 => _572.getAttribute, 'call', _573 => _573("faceColor")]);
|
|
30895
31206
|
const fill = face && face.toLowerCase() !== "none" ? face : "none";
|
|
30896
31207
|
const fillAttr = ` fill="${fill === "none" ? "none" : escapeXml3(fill)}"`;
|
|
30897
31208
|
if (o.tag === "rect") {
|
|
@@ -30918,14 +31229,14 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
30918
31229
|
}
|
|
30919
31230
|
function cellContentExtent(cell2, memo) {
|
|
30920
31231
|
if (!cell2.sub) return 0;
|
|
30921
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
31232
|
+
const hit = _optionalChain([memo, 'optionalAccess', _574 => _574.cell, 'access', _575 => _575.get, 'call', _576 => _576(cell2.el)]);
|
|
30922
31233
|
if (hit !== void 0) return hit;
|
|
30923
31234
|
let ext = 0;
|
|
30924
31235
|
for (const p of elements2(cell2.sub)) {
|
|
30925
31236
|
if (ln2(p) !== "p") continue;
|
|
30926
31237
|
const m = buildPara(p);
|
|
30927
31238
|
for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
|
|
30928
|
-
const baseV = _nullishCoalesce(_optionalChain([m, 'access',
|
|
31239
|
+
const baseV = _nullishCoalesce(_optionalChain([m, 'access', _577 => _577.segs, 'access', _578 => _578[0], 'optionalAccess', _579 => _579.vertpos]), () => ( 0));
|
|
30929
31240
|
for (const o of m.objs) {
|
|
30930
31241
|
if (o.inline) {
|
|
30931
31242
|
const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
@@ -30933,14 +31244,14 @@ function cellContentExtent(cell2, memo) {
|
|
|
30933
31244
|
continue;
|
|
30934
31245
|
}
|
|
30935
31246
|
const pos = findChildByLocalName(o.el, "pos");
|
|
30936
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
31247
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _580 => _580.getAttribute, 'call', _581 => _581("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
30937
31248
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
30938
31249
|
const pushed = baseV - (num3(om, "top") + o.height + num3(om, "bottom"));
|
|
30939
31250
|
const anchor = pushed >= -100 ? pushed : baseV;
|
|
30940
31251
|
ext = Math.max(ext, anchor + num3(om, "top") + num3(pos, "vertOffset") + o.height);
|
|
30941
31252
|
}
|
|
30942
31253
|
}
|
|
30943
|
-
_optionalChain([memo, 'optionalAccess',
|
|
31254
|
+
_optionalChain([memo, 'optionalAccess', _582 => _582.cell, 'access', _583 => _583.set, 'call', _584 => _584(cell2.el, ext)]);
|
|
30944
31255
|
return ext;
|
|
30945
31256
|
}
|
|
30946
31257
|
function edgeLine(x1, y1, x2, y2, e) {
|
|
@@ -30982,7 +31293,7 @@ function collectCells(tbl2) {
|
|
|
30982
31293
|
return cells;
|
|
30983
31294
|
}
|
|
30984
31295
|
function measureTableHeight(tbl2, memo) {
|
|
30985
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
31296
|
+
const hit = _optionalChain([memo, 'optionalAccess', _585 => _585.table, 'access', _586 => _586.get, 'call', _587 => _587(tbl2)]);
|
|
30986
31297
|
if (hit !== void 0) return hit;
|
|
30987
31298
|
const cells = collectCells(tbl2);
|
|
30988
31299
|
if (cells.length === 0 || cells.length > 4096) return 0;
|
|
@@ -30993,7 +31304,7 @@ function measureTableHeight(tbl2, memo) {
|
|
|
30993
31304
|
);
|
|
30994
31305
|
let sum = 0;
|
|
30995
31306
|
for (const h of rowH) sum += h;
|
|
30996
|
-
_optionalChain([memo, 'optionalAccess',
|
|
31307
|
+
_optionalChain([memo, 'optionalAccess', _588 => _588.table, 'access', _589 => _589.set, 'call', _590 => _590(tbl2, sum)]);
|
|
30997
31308
|
return sum;
|
|
30998
31309
|
}
|
|
30999
31310
|
function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
@@ -31024,7 +31335,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
31024
31335
|
}));
|
|
31025
31336
|
for (const g of geom) {
|
|
31026
31337
|
const bf = g.c.bfId != null ? ctx.styles.borderFill.get(g.c.bfId) : void 0;
|
|
31027
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
31338
|
+
if (_optionalChain([bf, 'optionalAccess', _591 => _591.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
|
|
31028
31339
|
}
|
|
31029
31340
|
for (const g of geom) {
|
|
31030
31341
|
const { c } = g;
|
|
@@ -31062,7 +31373,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
31062
31373
|
const sz = findChildByLocalName(pic, "sz");
|
|
31063
31374
|
const w = num3(sz, "width", 5669), h = num3(sz, "height", 5669);
|
|
31064
31375
|
const img = findFirst(pic, "img");
|
|
31065
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
31376
|
+
const ref = _optionalChain([img, 'optionalAccess', _592 => _592.getAttribute, 'call', _593 => _593("binaryItemIDRef")]);
|
|
31066
31377
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
31067
31378
|
if (!loaded) {
|
|
31068
31379
|
emit(ctx, `<rect x="${pt(x)}" y="${pt(y)}" width="${pt(w)}" height="${pt(h)}" fill="#eee" stroke="#c00" stroke-width="0.5"/>`);
|
|
@@ -31102,7 +31413,7 @@ function readSectionGeom(root) {
|
|
|
31102
31413
|
const pagePr = findFirst(root, "pagePr");
|
|
31103
31414
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
31104
31415
|
let PW = num3(pagePr, "width", 59528), PH = num3(pagePr, "height", 84188);
|
|
31105
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
31416
|
+
if (_optionalChain([pagePr, 'optionalAccess', _594 => _594.getAttribute, 'call', _595 => _595("landscape")]) === "NARROWLY" && PW < PH) {
|
|
31106
31417
|
const t = PW;
|
|
31107
31418
|
PW = PH;
|
|
31108
31419
|
PH = t;
|
|
@@ -31160,17 +31471,17 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode) {
|
|
|
31160
31471
|
return { pages: ctx.pages, pageH };
|
|
31161
31472
|
}
|
|
31162
31473
|
async function renderHwpxToSvg(input, options) {
|
|
31163
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
31474
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _596 => _596.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
31164
31475
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
31165
|
-
|
|
31476
|
+
_chunkE6DONLTMcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
31166
31477
|
let zip;
|
|
31167
31478
|
try {
|
|
31168
31479
|
zip = await _jszip2.default.loadAsync(input);
|
|
31169
31480
|
} catch (e38) {
|
|
31170
|
-
throw new (0,
|
|
31481
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
31171
31482
|
}
|
|
31172
31483
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
31173
|
-
if (secFiles.length === 0) throw new (0,
|
|
31484
|
+
if (secFiles.length === 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
31174
31485
|
const warnings = [];
|
|
31175
31486
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
31176
31487
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -31178,7 +31489,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31178
31489
|
const secXmls = [];
|
|
31179
31490
|
for (const f of secFiles) {
|
|
31180
31491
|
const xml = await f.async("string");
|
|
31181
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
31492
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
31182
31493
|
secXmls.push(xml);
|
|
31183
31494
|
}
|
|
31184
31495
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -31202,7 +31513,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31202
31513
|
let href = binmap.get(ref);
|
|
31203
31514
|
if (!href) {
|
|
31204
31515
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
31205
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
31516
|
+
href = _optionalChain([cand, 'optionalAccess', _597 => _597.name]);
|
|
31206
31517
|
}
|
|
31207
31518
|
if (!href) continue;
|
|
31208
31519
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -31223,7 +31534,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31223
31534
|
styles,
|
|
31224
31535
|
images,
|
|
31225
31536
|
defs: [],
|
|
31226
|
-
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
31537
|
+
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _598 => _598.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
|
|
31227
31538
|
warnings,
|
|
31228
31539
|
warned: /* @__PURE__ */ new Set(),
|
|
31229
31540
|
stats: { texts: 0, images: 0, tables: 0 },
|
|
@@ -31234,7 +31545,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31234
31545
|
for (let si = 0; si < secXmls.length; si++) {
|
|
31235
31546
|
const secXml = secXmls[si];
|
|
31236
31547
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
31237
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
31548
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _599 => _599.reflow])) {
|
|
31238
31549
|
noCacheSkipped = true;
|
|
31239
31550
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
31240
31551
|
continue;
|
|
@@ -31246,14 +31557,14 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31246
31557
|
continue;
|
|
31247
31558
|
}
|
|
31248
31559
|
const geom = readSectionGeom(root);
|
|
31249
|
-
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess',
|
|
31560
|
+
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess', _600 => _600.reflow]), _nullishCoalesce(_optionalChain([options, 'optionalAccess', _601 => _601.reflowMode]), () => ( "keep")));
|
|
31250
31561
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${si}` });
|
|
31251
31562
|
}
|
|
31252
31563
|
if (rendered.length === 0) {
|
|
31253
31564
|
if (noCacheSkipped) {
|
|
31254
|
-
throw new (0,
|
|
31565
|
+
throw new (0, _chunkE6DONLTMcjs.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)");
|
|
31255
31566
|
}
|
|
31256
|
-
throw new (0,
|
|
31567
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
31257
31568
|
}
|
|
31258
31569
|
const GAP = 2400;
|
|
31259
31570
|
const clipDefs = [];
|
|
@@ -31285,17 +31596,17 @@ ${groups.join("\n")}
|
|
|
31285
31596
|
// src/index.ts
|
|
31286
31597
|
async function parse(input, options) {
|
|
31287
31598
|
let buffer;
|
|
31288
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
31599
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _602 => _602.filePath]) ? { ...options, filePath: input } : options;
|
|
31289
31600
|
if (typeof input === "string") {
|
|
31290
31601
|
try {
|
|
31291
31602
|
const buf = await _promises.readFile.call(void 0, input);
|
|
31292
|
-
buffer =
|
|
31603
|
+
buffer = _chunkE6DONLTMcjs.toArrayBuffer.call(void 0, buf);
|
|
31293
31604
|
} catch (err) {
|
|
31294
31605
|
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}`;
|
|
31295
31606
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
31296
31607
|
}
|
|
31297
31608
|
} else if (Buffer.isBuffer(input)) {
|
|
31298
|
-
buffer =
|
|
31609
|
+
buffer = _chunkE6DONLTMcjs.toArrayBuffer.call(void 0, input);
|
|
31299
31610
|
} else {
|
|
31300
31611
|
buffer = input;
|
|
31301
31612
|
}
|
|
@@ -31329,40 +31640,40 @@ async function parse(input, options) {
|
|
|
31329
31640
|
}
|
|
31330
31641
|
async function parseImage(buffer, options) {
|
|
31331
31642
|
try {
|
|
31332
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
31643
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-75WGMVU6.cjs")));
|
|
31333
31644
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
31334
31645
|
return {
|
|
31335
31646
|
success: true,
|
|
31336
31647
|
fileType: "image",
|
|
31337
|
-
markdown:
|
|
31648
|
+
markdown: _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks),
|
|
31338
31649
|
blocks,
|
|
31339
31650
|
warnings: warnings.length ? warnings : void 0,
|
|
31340
31651
|
pageCount: 1
|
|
31341
31652
|
};
|
|
31342
31653
|
} catch (err) {
|
|
31343
|
-
return { success: false, fileType: "image", error:
|
|
31654
|
+
return { success: false, fileType: "image", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31344
31655
|
}
|
|
31345
31656
|
}
|
|
31346
31657
|
async function parseHwp3(buffer, options) {
|
|
31347
31658
|
try {
|
|
31348
31659
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
31349
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31660
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _603 => _603.pageCount]) };
|
|
31350
31661
|
} catch (err) {
|
|
31351
|
-
return { success: false, fileType: "hwp3", error:
|
|
31662
|
+
return { success: false, fileType: "hwp3", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31352
31663
|
}
|
|
31353
31664
|
}
|
|
31354
31665
|
async function parseHwpx(buffer, options) {
|
|
31355
31666
|
try {
|
|
31356
31667
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
31357
|
-
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
31668
|
+
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _604 => _604.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _605 => _605.pageCount]) };
|
|
31358
31669
|
} catch (err) {
|
|
31359
|
-
return { success: false, fileType: "hwpx", error:
|
|
31670
|
+
return { success: false, fileType: "hwpx", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31360
31671
|
}
|
|
31361
31672
|
}
|
|
31362
31673
|
async function parseHwp(buffer, options) {
|
|
31363
31674
|
try {
|
|
31364
31675
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
31365
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
31676
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _606 => _606.filePath])) {
|
|
31366
31677
|
try {
|
|
31367
31678
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
31368
31679
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -31380,15 +31691,15 @@ async function parseHwp(buffer, options) {
|
|
|
31380
31691
|
} catch (e39) {
|
|
31381
31692
|
}
|
|
31382
31693
|
}
|
|
31383
|
-
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
31694
|
+
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _607 => _607.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _608 => _608.pageCount]) };
|
|
31384
31695
|
} catch (err) {
|
|
31385
|
-
return { success: false, fileType: "hwp", error:
|
|
31696
|
+
return { success: false, fileType: "hwp", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31386
31697
|
}
|
|
31387
31698
|
}
|
|
31388
31699
|
async function parsePdf(buffer, options) {
|
|
31389
31700
|
let parsePdfDocument;
|
|
31390
31701
|
try {
|
|
31391
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
31702
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-4CBOPTVY.cjs")));
|
|
31392
31703
|
parsePdfDocument = mod.parsePdfDocument;
|
|
31393
31704
|
} catch (e40) {
|
|
31394
31705
|
return {
|
|
@@ -31400,51 +31711,51 @@ async function parsePdf(buffer, options) {
|
|
|
31400
31711
|
}
|
|
31401
31712
|
try {
|
|
31402
31713
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images } = await parsePdfDocument(buffer, options);
|
|
31403
|
-
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31714
|
+
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess', _609 => _609.pageCount]) };
|
|
31404
31715
|
} catch (err) {
|
|
31405
31716
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
31406
|
-
return { success: false, fileType: "pdf", error:
|
|
31717
|
+
return { success: false, fileType: "pdf", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err), isImageBased };
|
|
31407
31718
|
}
|
|
31408
31719
|
}
|
|
31409
31720
|
async function parseXlsx(buffer, options) {
|
|
31410
31721
|
try {
|
|
31411
31722
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
31412
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31723
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _610 => _610.pageCount]) };
|
|
31413
31724
|
} catch (err) {
|
|
31414
|
-
return { success: false, fileType: "xlsx", error:
|
|
31725
|
+
return { success: false, fileType: "xlsx", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31415
31726
|
}
|
|
31416
31727
|
}
|
|
31417
31728
|
async function parseXls(buffer, options) {
|
|
31418
31729
|
try {
|
|
31419
31730
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
31420
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31731
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _611 => _611.pageCount]) };
|
|
31421
31732
|
} catch (err) {
|
|
31422
|
-
return { success: false, fileType: "xls", error:
|
|
31733
|
+
return { success: false, fileType: "xls", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31423
31734
|
}
|
|
31424
31735
|
}
|
|
31425
31736
|
async function parseDocx(buffer, options) {
|
|
31426
31737
|
try {
|
|
31427
31738
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
31428
|
-
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
31739
|
+
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _612 => _612.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _613 => _613.pageCount]) };
|
|
31429
31740
|
} catch (err) {
|
|
31430
|
-
return { success: false, fileType: "docx", error:
|
|
31741
|
+
return { success: false, fileType: "docx", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31431
31742
|
}
|
|
31432
31743
|
}
|
|
31433
31744
|
async function parseHwpml(buffer, options) {
|
|
31434
31745
|
try {
|
|
31435
31746
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
31436
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31747
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _614 => _614.pageCount]) };
|
|
31437
31748
|
} catch (err) {
|
|
31438
|
-
return { success: false, fileType: "hwpml", error:
|
|
31749
|
+
return { success: false, fileType: "hwpml", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31439
31750
|
}
|
|
31440
31751
|
}
|
|
31441
31752
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
31442
31753
|
let buffer;
|
|
31443
31754
|
if (typeof input === "string") {
|
|
31444
31755
|
const buf = await _promises.readFile.call(void 0, input);
|
|
31445
|
-
buffer =
|
|
31756
|
+
buffer = _chunkE6DONLTMcjs.toArrayBuffer.call(void 0, buf);
|
|
31446
31757
|
} else if (Buffer.isBuffer(input)) {
|
|
31447
|
-
buffer =
|
|
31758
|
+
buffer = _chunkE6DONLTMcjs.toArrayBuffer.call(void 0, input);
|
|
31448
31759
|
} else {
|
|
31449
31760
|
buffer = input;
|
|
31450
31761
|
}
|
|
@@ -31470,7 +31781,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
31470
31781
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
31471
31782
|
}
|
|
31472
31783
|
const fill = fillFormFields(parsed.blocks, values);
|
|
31473
|
-
const markdown =
|
|
31784
|
+
const markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
31474
31785
|
if (outputFormat === "hwpx") {
|
|
31475
31786
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
31476
31787
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -31549,5 +31860,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
31549
31860
|
|
|
31550
31861
|
|
|
31551
31862
|
|
|
31552
|
-
exports.BUILTIN_TEMPLATES = BUILTIN_TEMPLATES; exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION =
|
|
31863
|
+
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 = _chunkE6DONLTMcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkR4LXZRYPcjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractClickHereFields = extractClickHereFields; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
|
|
31553
31864
|
//# sourceMappingURL=index.cjs.map
|