kordoc 4.18.13 → 4.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/{-DC2OO5KO.js → -LYUUVVQF.js} +11 -11
- package/dist/{chunk-ISC2TH24.js → chunk-4WTJS6ES.js} +2 -2
- package/dist/{chunk-SVIOP7PE.js → chunk-5AZQEMMG.js} +7 -7
- package/dist/{chunk-SVIOP7PE.js.map → chunk-5AZQEMMG.js.map} +1 -1
- package/dist/{chunk-GUH6HYSZ.js → chunk-6KOQPPLX.js} +25 -22
- package/dist/chunk-6KOQPPLX.js.map +1 -0
- package/dist/{chunk-PN5WWW56.js → chunk-7L5GY54Q.js} +2 -2
- package/dist/{chunk-PN5WWW56.js.map → chunk-7L5GY54Q.js.map} +1 -1
- package/dist/{chunk-PHMWSWHJ.js → chunk-7XRI4FL4.js} +2 -2
- package/dist/{chunk-32ZUIHSY.js → chunk-ADBES5QJ.js} +3 -3
- package/dist/{chunk-JWTZ3OVZ.js → chunk-BDTWXJNM.js} +2 -2
- package/dist/{chunk-INESPVEV.js → chunk-CL3CJ7X5.js} +3 -3
- package/dist/{chunk-VDEENOPW.js → chunk-DQHDI567.js} +2 -2
- package/dist/{chunk-ZNY5BRV6.js → chunk-FEGRQA3Q.js} +4 -4
- package/dist/{chunk-3FGHQWJP.cjs → chunk-FNX3ZAYB.cjs} +22 -22
- package/dist/{chunk-3FGHQWJP.cjs.map → chunk-FNX3ZAYB.cjs.map} +1 -1
- package/dist/{chunk-GGMIPTM5.cjs → chunk-GPNPYBXJ.cjs} +12 -12
- package/dist/{chunk-GGMIPTM5.cjs.map → chunk-GPNPYBXJ.cjs.map} +1 -1
- package/dist/{chunk-6CQZMVXW.cjs → chunk-HMJXB7ZE.cjs} +3 -3
- package/dist/{chunk-6CQZMVXW.cjs.map → chunk-HMJXB7ZE.cjs.map} +1 -1
- package/dist/{chunk-IRN5SDY2.js → chunk-JA5B4NPF.js} +2 -2
- package/dist/{chunk-GSW7W7AL.js → chunk-JNIJPP4B.js} +7 -4
- package/dist/chunk-JNIJPP4B.js.map +1 -0
- package/dist/{chunk-EZSWBHHI.js → chunk-KYFP5LDC.js} +2 -2
- package/dist/{chunk-XVB3PUPJ.js → chunk-L5N5UQBP.js} +10 -4
- package/dist/chunk-L5N5UQBP.js.map +1 -0
- package/dist/{chunk-6AYTYTFY.js → chunk-MSUGYK6A.js} +3 -3
- package/dist/{chunk-K6WSMTVU.cjs → chunk-RHMIEEAZ.cjs} +2 -2
- package/dist/{chunk-K6WSMTVU.cjs.map → chunk-RHMIEEAZ.cjs.map} +1 -1
- package/dist/{chunk-JKHU7HID.js → chunk-TRUR4RUJ.js} +95 -11
- package/dist/chunk-TRUR4RUJ.js.map +1 -0
- package/dist/{chunk-DHEUQXXR.js → chunk-UAAYIEIK.js} +2 -2
- package/dist/{chunk-RQEDNI4P.cjs → chunk-UOXOYZU4.cjs} +3 -3
- package/dist/{chunk-RQEDNI4P.cjs.map → chunk-UOXOYZU4.cjs.map} +1 -1
- package/dist/{chunk-6FW3AZWN.cjs → chunk-W5NXOMCD.cjs} +125 -35
- package/dist/chunk-W5NXOMCD.cjs.map +1 -0
- package/dist/{chunk-V7LKQNC4.js → chunk-X6ME7YYS.js} +2 -2
- package/dist/{chunk-LKA7Z2NH.js → chunk-XFZMRCGJ.js} +2 -2
- package/dist/{chunk-JPSLMPFI.js → chunk-YLST4S4P.js} +103 -13
- package/dist/chunk-YLST4S4P.js.map +1 -0
- package/dist/{chunk-EBXJ45VZ.js → chunk-Z2WI3E4N.js} +2 -2
- package/dist/{chunk-EBXJ45VZ.js.map → chunk-Z2WI3E4N.js.map} +1 -1
- package/dist/{chunk-7LOD4IGO.js → chunk-ZTGTFO52.js} +4 -4
- package/dist/chunks-T67OQGPJ.js +10 -0
- package/dist/cli.js +39 -28
- package/dist/cli.js.map +1 -1
- package/dist/{formula-DAMFHLQO.js → formula-G4YA7SNQ.js} +3 -3
- package/dist/{formula-HJNQGPRC.cjs → formula-J3UUIPCX.cjs} +9 -9
- package/dist/{formula-HJNQGPRC.cjs.map → formula-J3UUIPCX.cjs.map} +1 -1
- package/dist/{formula-YCAO5IVW.js → formula-QSZRYZ44.js} +4 -4
- package/dist/{image-ocr-AZ25IOC7.cjs → image-ocr-467KLV3F.cjs} +15 -15
- package/dist/{image-ocr-AZ25IOC7.cjs.map → image-ocr-467KLV3F.cjs.map} +1 -1
- package/dist/{image-ocr-VH54SDZ7.js → image-ocr-I52GBXRE.js} +6 -6
- package/dist/{image-ocr-PAF76DAW.js → image-ocr-ZP3F4MUY.js} +9 -9
- package/dist/index.cjs +669 -663
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +26 -20
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +25 -23
- package/dist/mcp.js.map +1 -1
- package/dist/{model-bundle-53CHDYCG.js → model-bundle-FEUM7XXS.js} +5 -5
- package/dist/{models-UVLAKK3M.js → models-6QCNX5YR.js} +5 -5
- package/dist/{parser-I4D3TRGU.js → parser-6EIBURDE.js} +179 -13
- package/dist/parser-6EIBURDE.js.map +1 -0
- package/dist/{parser-HWAOPQYK.cjs → parser-BIJBX2D5.cjs} +393 -227
- package/dist/parser-BIJBX2D5.cjs.map +1 -0
- package/dist/{parser-Z6PHB54O.js → parser-YX4LGKIK.js} +176 -10
- package/dist/parser-YX4LGKIK.js.map +1 -0
- package/dist/pdf-ocr-DXQIMO77.cjs +17 -0
- package/dist/{pdf-ocr-HR6CXGTX.cjs.map → pdf-ocr-DXQIMO77.cjs.map} +1 -1
- package/dist/pdf-ocr-MESGGING.js +20 -0
- package/dist/pdf-ocr-YSRBRIPR.js +16 -0
- package/dist/{profile-io-WHCWCOPW.js → profile-io-ATHFEUAP.js} +3 -3
- package/dist/{rasterize-5DZ3DHGH.js → rasterize-SG3CLXMQ.js} +3 -3
- package/dist/{redact-doc-RNJVMFGQ.js → redact-doc-K3S4HFHU.js} +11 -11
- package/dist/{render-NZ6RA6SW.js → render-6CQJM7VE.js} +7 -7
- package/dist/seal-SMO4544N.js +10 -0
- package/dist/{setup-U3EQNK4Z.js → setup-CZ5KHGPI.js} +3 -3
- package/dist/visual-UWYGQLOU.js +20 -0
- package/dist/{watch-GB2M7XU6.js → watch-RQRIGLFF.js} +12 -12
- package/package.json +3 -2
- package/dist/chunk-6FW3AZWN.cjs.map +0 -1
- package/dist/chunk-GSW7W7AL.js.map +0 -1
- package/dist/chunk-GUH6HYSZ.js.map +0 -1
- package/dist/chunk-JKHU7HID.js.map +0 -1
- package/dist/chunk-JPSLMPFI.js.map +0 -1
- package/dist/chunk-XVB3PUPJ.js.map +0 -1
- package/dist/chunks-JZW2TXIZ.js +0 -10
- package/dist/parser-HWAOPQYK.cjs.map +0 -1
- package/dist/parser-I4D3TRGU.js.map +0 -1
- package/dist/parser-Z6PHB54O.js.map +0 -1
- package/dist/pdf-ocr-F4ICXO7W.js +0 -20
- package/dist/pdf-ocr-HR6CXGTX.cjs +0 -17
- package/dist/pdf-ocr-JI3K7JIN.js +0 -16
- package/dist/seal-WHJ6O5HT.js +0 -10
- package/dist/visual-JDAS4R43.js +0 -20
- /package/dist/{-DC2OO5KO.js.map → -LYUUVVQF.js.map} +0 -0
- /package/dist/{chunk-ISC2TH24.js.map → chunk-4WTJS6ES.js.map} +0 -0
- /package/dist/{chunk-PHMWSWHJ.js.map → chunk-7XRI4FL4.js.map} +0 -0
- /package/dist/{chunk-32ZUIHSY.js.map → chunk-ADBES5QJ.js.map} +0 -0
- /package/dist/{chunk-JWTZ3OVZ.js.map → chunk-BDTWXJNM.js.map} +0 -0
- /package/dist/{chunk-INESPVEV.js.map → chunk-CL3CJ7X5.js.map} +0 -0
- /package/dist/{chunk-VDEENOPW.js.map → chunk-DQHDI567.js.map} +0 -0
- /package/dist/{chunk-ZNY5BRV6.js.map → chunk-FEGRQA3Q.js.map} +0 -0
- /package/dist/{chunk-IRN5SDY2.js.map → chunk-JA5B4NPF.js.map} +0 -0
- /package/dist/{chunk-EZSWBHHI.js.map → chunk-KYFP5LDC.js.map} +0 -0
- /package/dist/{chunk-6AYTYTFY.js.map → chunk-MSUGYK6A.js.map} +0 -0
- /package/dist/{chunk-DHEUQXXR.js.map → chunk-UAAYIEIK.js.map} +0 -0
- /package/dist/{chunk-V7LKQNC4.js.map → chunk-X6ME7YYS.js.map} +0 -0
- /package/dist/{chunk-LKA7Z2NH.js.map → chunk-XFZMRCGJ.js.map} +0 -0
- /package/dist/{chunk-7LOD4IGO.js.map → chunk-ZTGTFO52.js.map} +0 -0
- /package/dist/{chunks-JZW2TXIZ.js.map → chunks-T67OQGPJ.js.map} +0 -0
- /package/dist/{formula-DAMFHLQO.js.map → formula-G4YA7SNQ.js.map} +0 -0
- /package/dist/{formula-YCAO5IVW.js.map → formula-QSZRYZ44.js.map} +0 -0
- /package/dist/{image-ocr-VH54SDZ7.js.map → image-ocr-I52GBXRE.js.map} +0 -0
- /package/dist/{image-ocr-PAF76DAW.js.map → image-ocr-ZP3F4MUY.js.map} +0 -0
- /package/dist/{model-bundle-53CHDYCG.js.map → model-bundle-FEUM7XXS.js.map} +0 -0
- /package/dist/{models-UVLAKK3M.js.map → models-6QCNX5YR.js.map} +0 -0
- /package/dist/{pdf-ocr-F4ICXO7W.js.map → pdf-ocr-MESGGING.js.map} +0 -0
- /package/dist/{pdf-ocr-JI3K7JIN.js.map → pdf-ocr-YSRBRIPR.js.map} +0 -0
- /package/dist/{profile-io-WHCWCOPW.js.map → profile-io-ATHFEUAP.js.map} +0 -0
- /package/dist/{rasterize-5DZ3DHGH.js.map → rasterize-SG3CLXMQ.js.map} +0 -0
- /package/dist/{redact-doc-RNJVMFGQ.js.map → redact-doc-K3S4HFHU.js.map} +0 -0
- /package/dist/{render-NZ6RA6SW.js.map → render-6CQJM7VE.js.map} +0 -0
- /package/dist/{seal-WHJ6O5HT.js.map → seal-SMO4544N.js.map} +0 -0
- /package/dist/{setup-U3EQNK4Z.js.map → setup-CZ5KHGPI.js.map} +0 -0
- /package/dist/{visual-JDAS4R43.js.map → visual-UWYGQLOU.js.map} +0 -0
- /package/dist/{watch-GB2M7XU6.js.map → watch-RQRIGLFF.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkUOXOYZU4cjs = require('./chunk-UOXOYZU4.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
@@ -31,8 +31,8 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var _chunk6FW3AZWNcjs = require('./chunk-6FW3AZWN.cjs');
|
|
35
34
|
|
|
35
|
+
var _chunkW5NXOMCDcjs = require('./chunk-W5NXOMCD.cjs');
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
@@ -49,14 +49,15 @@ var _chunk6FW3AZWNcjs = require('./chunk-6FW3AZWN.cjs');
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
|
|
53
|
+
var _chunkRHMIEEAZcjs = require('./chunk-RHMIEEAZ.cjs');
|
|
53
54
|
|
|
54
55
|
|
|
55
56
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
56
57
|
|
|
57
58
|
// src/plain-markdown.ts
|
|
58
59
|
function toPlainMarkdown(md2) {
|
|
59
|
-
return
|
|
60
|
+
return _chunkW5NXOMCDcjs.plainScripts.call(void 0, md2).replace(/!\[[^\]\n]*\]\([^)\n]*\)/g, "").replace(/<img\b[^>]*>/gi, "").replace(/(?<!!)\[([^\]\n]*)\]\((?:https?|mailto|ftp):[^)\s]*\)/g, "$1").replace(/(?<!\\)<\/?u>/g, "").replace(/(?<!\\)\*\*(?=\S)([^\n]*?\S)(?<!\\)\*\*/g, "$1").replace(/(<br>)+(?=<\/t[dh]>)/g, "").replace(/[ \t]+$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
// src/html-tables.ts
|
|
@@ -573,9 +574,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
573
574
|
}
|
|
574
575
|
|
|
575
576
|
// src/hwpx/parser-shared.ts
|
|
576
|
-
var MAX_DECOMPRESS_SIZE =
|
|
577
|
+
var MAX_DECOMPRESS_SIZE = _chunkRHMIEEAZcjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
577
578
|
var MAX_ZIP_ENTRIES = 500;
|
|
578
|
-
var ZipBombError = class extends
|
|
579
|
+
var ZipBombError = class extends _chunkRHMIEEAZcjs.KordocError {
|
|
579
580
|
constructor(message) {
|
|
580
581
|
super(message);
|
|
581
582
|
this.name = "ZipBombError";
|
|
@@ -596,7 +597,7 @@ function createSectionShared() {
|
|
|
596
597
|
function createXmlParser(warnings) {
|
|
597
598
|
return new (0, _xmldom.DOMParser)({
|
|
598
599
|
onError(level, msg2) {
|
|
599
|
-
if (level === "fatalError") throw new (0,
|
|
600
|
+
if (level === "fatalError") throw new (0, _chunkRHMIEEAZcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
600
601
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
601
602
|
}
|
|
602
603
|
});
|
|
@@ -631,13 +632,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
631
632
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
632
633
|
const checksumType = attrOf(inner, "checksum-type");
|
|
633
634
|
if (algorithm !== AES256_CBC) {
|
|
634
|
-
throw new (0,
|
|
635
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
635
636
|
}
|
|
636
637
|
if (startKey !== START_KEY_SHA256) {
|
|
637
|
-
throw new (0,
|
|
638
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
638
639
|
}
|
|
639
640
|
if (!_optionalChain([checksumType, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(CHECKSUM_SHA256_1K)])) {
|
|
640
|
-
throw new (0,
|
|
641
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
641
642
|
}
|
|
642
643
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
643
644
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -645,10 +646,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
645
646
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
646
647
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
647
648
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
648
|
-
throw new (0,
|
|
649
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
649
650
|
}
|
|
650
651
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
651
|
-
throw new (0,
|
|
652
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
652
653
|
}
|
|
653
654
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
654
655
|
}
|
|
@@ -681,11 +682,11 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
681
682
|
for (const entry of entries) {
|
|
682
683
|
const file = zip.file(entry.path);
|
|
683
684
|
if (!file) {
|
|
684
|
-
throw new (0,
|
|
685
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
685
686
|
}
|
|
686
687
|
const plain4 = decryptEntry(await file.async("nodebuffer"), entry, startKey);
|
|
687
688
|
if (!plain4) {
|
|
688
|
-
throw new (0,
|
|
689
|
+
throw new (0, _chunkRHMIEEAZcjs.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.");
|
|
689
690
|
}
|
|
690
691
|
decrypted.push({ path: entry.path, plain: plain4 });
|
|
691
692
|
}
|
|
@@ -749,10 +750,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
749
750
|
const xml = await file.async("text");
|
|
750
751
|
if (decompressed) {
|
|
751
752
|
decompressed.total += xml.length * 2;
|
|
752
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
753
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkRHMIEEAZcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
753
754
|
}
|
|
754
755
|
const parser = createXmlParser();
|
|
755
|
-
const doc = parser.parseFromString(
|
|
756
|
+
const doc = parser.parseFromString(_chunkRHMIEEAZcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
756
757
|
if (!doc.documentElement) continue;
|
|
757
758
|
const domDoc = doc;
|
|
758
759
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -965,9 +966,9 @@ function detectHwpxHeadings(blocks, styleMap, tocTexts) {
|
|
|
965
966
|
let level = 0;
|
|
966
967
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _18 => _18.style, 'optionalAccess', _19 => _19.fontSize])) {
|
|
967
968
|
const ratio = block.style.fontSize / baseFontSize;
|
|
968
|
-
if (ratio >=
|
|
969
|
-
else if (ratio >=
|
|
970
|
-
else if (ratio >=
|
|
969
|
+
if (ratio >= _chunkW5NXOMCDcjs.HEADING_RATIO_H1) level = 1;
|
|
970
|
+
else if (ratio >= _chunkW5NXOMCDcjs.HEADING_RATIO_H2) level = 2;
|
|
971
|
+
else if (ratio >= _chunkW5NXOMCDcjs.HEADING_RATIO_H3) level = 3;
|
|
971
972
|
}
|
|
972
973
|
const compactText = text.replace(/\s+/g, "");
|
|
973
974
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1699,7 +1700,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1699
1700
|
|
|
1700
1701
|
// src/hwpx/table-build.ts
|
|
1701
1702
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1702
|
-
const table2 =
|
|
1703
|
+
const table2 = _chunkW5NXOMCDcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1703
1704
|
if (state.caption) table2.caption = state.caption;
|
|
1704
1705
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
1705
1706
|
if (_optionalChain([state, 'access', _29 => _29.captionBlocks, 'optionalAccess', _30 => _30.length])) table2.captionBlocks = state.captionBlocks;
|
|
@@ -1728,7 +1729,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1728
1729
|
for (const src of row) {
|
|
1729
1730
|
if (!src.edges || src.rowAddr === void 0 || src.colAddr === void 0) continue;
|
|
1730
1731
|
const cand = _optionalChain([table2, 'access', _34 => _34.cells, 'access', _35 => _35[src.rowAddr], 'optionalAccess', _36 => _36[src.colAddr]]);
|
|
1731
|
-
if (cand && anchors2.includes(cand))
|
|
1732
|
+
if (cand && anchors2.includes(cand)) _chunkW5NXOMCDcjs.CELL_EDGES.set(cand, src.edges);
|
|
1732
1733
|
}
|
|
1733
1734
|
}
|
|
1734
1735
|
const claimed = /* @__PURE__ */ new Set();
|
|
@@ -1778,7 +1779,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1778
1779
|
const cell2 = parentTable.cell;
|
|
1779
1780
|
(cell2.blocks ??= []).push(block);
|
|
1780
1781
|
cell2.hasStructure = true;
|
|
1781
|
-
let flat =
|
|
1782
|
+
let flat = _chunkW5NXOMCDcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1782
1783
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1783
1784
|
if (flat) {
|
|
1784
1785
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -2012,7 +2013,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2012
2013
|
const tkids = rc.childNodes;
|
|
2013
2014
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _44 => _44.length]), () => ( 0))); k++) {
|
|
2014
2015
|
const tk = tkids[k];
|
|
2015
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
2016
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunkW5NXOMCDcjs.escapeLiteralTags.call(void 0, _chunkW5NXOMCDcjs.escapeLiteralDollar.call(void 0, tk.textContent || ""));
|
|
2016
2017
|
else if (tk.nodeType === 1) {
|
|
2017
2018
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
2018
2019
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -2032,7 +2033,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2032
2033
|
const span2 = { text };
|
|
2033
2034
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span2.code = true;
|
|
2034
2035
|
else {
|
|
2035
|
-
if (_optionalChain([cp, 'optionalAccess', _45 => _45.script])) span2.text =
|
|
2036
|
+
if (_optionalChain([cp, 'optionalAccess', _45 => _45.script])) span2.text = _chunkW5NXOMCDcjs.wrapScript.call(void 0, text, cp.script);
|
|
2036
2037
|
if (_optionalChain([cp, 'optionalAccess', _46 => _46.bold])) span2.bold = true;
|
|
2037
2038
|
if (_optionalChain([cp, 'optionalAccess', _47 => _47.italic])) span2.italic = true;
|
|
2038
2039
|
if (_optionalChain([cp, 'optionalAccess', _48 => _48.strike])) span2.strike = true;
|
|
@@ -2052,7 +2053,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2052
2053
|
}
|
|
2053
2054
|
}
|
|
2054
2055
|
if (requireMixed && !merged.some((s) => s.strike || s.underline) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
2055
|
-
for (const s of merged) s.text =
|
|
2056
|
+
for (const s of merged) s.text = _chunkW5NXOMCDcjs.tidyScriptTags.call(void 0, s.text);
|
|
2056
2057
|
return merged;
|
|
2057
2058
|
}
|
|
2058
2059
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -2079,7 +2080,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2079
2080
|
// src/hwpx/section-walker.ts
|
|
2080
2081
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
2081
2082
|
const parser = createXmlParser(warnings);
|
|
2082
|
-
const doc = parser.parseFromString(
|
|
2083
|
+
const doc = parser.parseFromString(_chunkRHMIEEAZcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2083
2084
|
if (!doc.documentElement) return [];
|
|
2084
2085
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
2085
2086
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2178,8 +2179,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2178
2179
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2179
2180
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2180
2181
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2181
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2182
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2182
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkW5NXOMCDcjs.MAX_COLS);
|
|
2183
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkW5NXOMCDcjs.MAX_ROWS);
|
|
2183
2184
|
}
|
|
2184
2185
|
break;
|
|
2185
2186
|
case "p": {
|
|
@@ -2497,7 +2498,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2497
2498
|
const sink = [];
|
|
2498
2499
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2499
2500
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2500
|
-
let flat =
|
|
2501
|
+
let flat = _chunkW5NXOMCDcjs.convertTableToText.call(void 0, st.rows);
|
|
2501
2502
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2502
2503
|
const built = [];
|
|
2503
2504
|
completeTable(st, [], built, ctx);
|
|
@@ -2658,7 +2659,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2658
2659
|
let url = (ch.textContent || "").trim();
|
|
2659
2660
|
if (!url) continue;
|
|
2660
2661
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2661
|
-
const safe =
|
|
2662
|
+
const safe = _chunkRHMIEEAZcjs.sanitizeHref.call(void 0, url);
|
|
2662
2663
|
if (safe) return safe;
|
|
2663
2664
|
}
|
|
2664
2665
|
return void 0;
|
|
@@ -2807,7 +2808,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2807
2808
|
_optionalChain([ctx, 'access', _109 => _109.warnings, 'optionalAccess', _110 => _110.push, 'call', _111 => _111({ page: ctx.page, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
|
|
2808
2809
|
}
|
|
2809
2810
|
} else {
|
|
2810
|
-
text +=
|
|
2811
|
+
text += _chunkW5NXOMCDcjs.escapeLiteralTags.call(void 0, _chunkW5NXOMCDcjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, "")));
|
|
2811
2812
|
}
|
|
2812
2813
|
continue;
|
|
2813
2814
|
}
|
|
@@ -2860,7 +2861,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2860
2861
|
case "hyperlink": {
|
|
2861
2862
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2862
2863
|
if (url) {
|
|
2863
|
-
const safe =
|
|
2864
|
+
const safe = _chunkRHMIEEAZcjs.sanitizeHref.call(void 0, url);
|
|
2864
2865
|
if (safe) href = safe;
|
|
2865
2866
|
}
|
|
2866
2867
|
walk(child, depth + 1);
|
|
@@ -2954,7 +2955,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2954
2955
|
walk(child, depth + 1);
|
|
2955
2956
|
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
2956
2957
|
const added = text.slice(start);
|
|
2957
|
-
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) +
|
|
2958
|
+
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) + _chunkW5NXOMCDcjs.wrapScript.call(void 0, added, script);
|
|
2958
2959
|
}
|
|
2959
2960
|
break;
|
|
2960
2961
|
}
|
|
@@ -2977,7 +2978,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2977
2978
|
}
|
|
2978
2979
|
if (applied.length) href = void 0;
|
|
2979
2980
|
}
|
|
2980
|
-
text =
|
|
2981
|
+
text = _chunkW5NXOMCDcjs.tidyScriptTags.call(void 0, text);
|
|
2981
2982
|
const toc = takeTocLeaders(text);
|
|
2982
2983
|
text = toc.text;
|
|
2983
2984
|
const tocEntry = toc.tocEntry;
|
|
@@ -3091,7 +3092,7 @@ function decompressStream(data) {
|
|
|
3091
3092
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
3092
3093
|
}
|
|
3093
3094
|
function parseFileHeader(data) {
|
|
3094
|
-
if (data.length < 40) throw new (0,
|
|
3095
|
+
if (data.length < 40) throw new (0, _chunkRHMIEEAZcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
3095
3096
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
3096
3097
|
return {
|
|
3097
3098
|
signature: sig,
|
|
@@ -3601,13 +3602,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3601
3602
|
}
|
|
3602
3603
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3603
3604
|
for (const path of allCandidates) {
|
|
3604
|
-
if (
|
|
3605
|
+
if (_chunkRHMIEEAZcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3605
3606
|
const file = zip.file(path);
|
|
3606
3607
|
if (!file) continue;
|
|
3607
3608
|
try {
|
|
3608
3609
|
const data = await file.async("uint8array");
|
|
3609
3610
|
decompressed.total += data.length;
|
|
3610
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3611
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkRHMIEEAZcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3611
3612
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3612
3613
|
const mimeType = imageExtToMime(ext);
|
|
3613
3614
|
imageIndex++;
|
|
@@ -3617,7 +3618,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3617
3618
|
usedPaths.add(path);
|
|
3618
3619
|
break;
|
|
3619
3620
|
} catch (err) {
|
|
3620
|
-
if (err instanceof
|
|
3621
|
+
if (err instanceof _chunkRHMIEEAZcjs.KordocError) throw err;
|
|
3621
3622
|
}
|
|
3622
3623
|
}
|
|
3623
3624
|
if (!img) _optionalChain([warnings, 'optionalAccess', _125 => _125.push, 'call', _126 => _126({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
@@ -3637,13 +3638,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3637
3638
|
if (sweepUnreferenced) {
|
|
3638
3639
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3639
3640
|
for (const file of binEntries) {
|
|
3640
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3641
|
+
if (file.dir || usedPaths.has(file.name) || _chunkRHMIEEAZcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3641
3642
|
const basename = file.name.slice(file.name.lastIndexOf("/") + 1);
|
|
3642
3643
|
if (_optionalChain([deletedRefs, 'optionalAccess', _127 => _127.has, 'call', _128 => _128(file.name)]) || _optionalChain([deletedRefs, 'optionalAccess', _129 => _129.has, 'call', _130 => _130(basename)]) || _optionalChain([deletedRefs, 'optionalAccess', _131 => _131.has, 'call', _132 => _132(file.name.replace(/\.[^/.]+$/, ""))]) || _optionalChain([deletedRefs, 'optionalAccess', _133 => _133.has, 'call', _134 => _134(basename.replace(/\.[^.]+$/, ""))])) continue;
|
|
3643
3644
|
try {
|
|
3644
3645
|
const data = await file.async("uint8array");
|
|
3645
3646
|
decompressed.total += data.length;
|
|
3646
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3647
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkRHMIEEAZcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3647
3648
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3648
3649
|
let mimeType = imageExtToMime(ext);
|
|
3649
3650
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3657,7 +3658,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3657
3658
|
images.push(img);
|
|
3658
3659
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3659
3660
|
} catch (err) {
|
|
3660
|
-
if (err instanceof
|
|
3661
|
+
if (err instanceof _chunkRHMIEEAZcjs.KordocError) throw err;
|
|
3661
3662
|
_optionalChain([warnings, 'optionalAccess', _135 => _135.push, 'call', _136 => _136({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3662
3663
|
}
|
|
3663
3664
|
}
|
|
@@ -3670,7 +3671,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3670
3671
|
|
|
3671
3672
|
// src/hwpx/zip-sections.ts
|
|
3672
3673
|
|
|
3673
|
-
function extractFromBrokenZip(buffer) {
|
|
3674
|
+
function extractFromBrokenZip(buffer, options) {
|
|
3674
3675
|
const data = new Uint8Array(buffer);
|
|
3675
3676
|
const view = new DataView(buffer);
|
|
3676
3677
|
let pos = 0;
|
|
@@ -3708,7 +3709,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3708
3709
|
}
|
|
3709
3710
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3710
3711
|
const name = new TextDecoder().decode(nameBytes);
|
|
3711
|
-
if (
|
|
3712
|
+
if (_chunkRHMIEEAZcjs.isPathTraversal.call(void 0, name)) {
|
|
3712
3713
|
pos = fileStart + compSize;
|
|
3713
3714
|
continue;
|
|
3714
3715
|
}
|
|
@@ -3726,7 +3727,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3726
3727
|
continue;
|
|
3727
3728
|
}
|
|
3728
3729
|
totalDecompressed += content.length * 2;
|
|
3729
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3730
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3730
3731
|
sectionNum++;
|
|
3731
3732
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3732
3733
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3735,9 +3736,9 @@ function extractFromBrokenZip(buffer) {
|
|
|
3735
3736
|
continue;
|
|
3736
3737
|
}
|
|
3737
3738
|
}
|
|
3738
|
-
if (blocks.length === 0) throw new (0,
|
|
3739
|
+
if (blocks.length === 0) throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3739
3740
|
applyPageText(blocks, shared);
|
|
3740
|
-
const markdown =
|
|
3741
|
+
const markdown = _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _137 => _137.tableFormat]) });
|
|
3741
3742
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3742
3743
|
}
|
|
3743
3744
|
async function readKordocLayout(zip) {
|
|
@@ -3746,7 +3747,7 @@ async function readKordocLayout(zip) {
|
|
|
3746
3747
|
try {
|
|
3747
3748
|
const xml = await file.async("text");
|
|
3748
3749
|
if (!/<opf:meta\b[^>]*name="generator"[^>]*content="kordoc"/.test(xml)) return null;
|
|
3749
|
-
return _nullishCoalesce(_optionalChain([xml, 'access',
|
|
3750
|
+
return _nullishCoalesce(_optionalChain([xml, 'access', _138 => _138.match, 'call', _139 => _139(/<opf:meta\b[^>]*name="kordoc-layout"[^>]*content="([^"]*)"/), 'optionalAccess', _140 => _140[1]]), () => ( null));
|
|
3750
3751
|
} catch (e17) {
|
|
3751
3752
|
return null;
|
|
3752
3753
|
}
|
|
@@ -3762,11 +3763,11 @@ async function resolveSectionPaths(zip) {
|
|
|
3762
3763
|
if (paths.length > 0) return paths;
|
|
3763
3764
|
}
|
|
3764
3765
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3765
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3766
|
+
return sectionFiles.map((f) => f.name).sort(_chunkRHMIEEAZcjs.compareSectionPaths);
|
|
3766
3767
|
}
|
|
3767
3768
|
function parseSectionPathsFromManifest(xml) {
|
|
3768
3769
|
const parser = createXmlParser();
|
|
3769
|
-
const doc = parser.parseFromString(
|
|
3770
|
+
const doc = parser.parseFromString(_chunkRHMIEEAZcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3770
3771
|
const opf = "http://www.idpf.org/2007/opf/";
|
|
3771
3772
|
const namespacedItems = doc.getElementsByTagNameNS(opf, "item");
|
|
3772
3773
|
const namespacedSpine = doc.getElementsByTagNameNS(opf, "itemref");
|
|
@@ -3776,7 +3777,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3776
3777
|
for (let i = 0; i < items.length; i++) {
|
|
3777
3778
|
const item = items[i];
|
|
3778
3779
|
const id = item.getAttribute("id") || "";
|
|
3779
|
-
const href =
|
|
3780
|
+
const href = _chunkRHMIEEAZcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3780
3781
|
if (id && href) idToHref.set(id, href);
|
|
3781
3782
|
}
|
|
3782
3783
|
if (spine.length > 0) {
|
|
@@ -3787,7 +3788,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3787
3788
|
}
|
|
3788
3789
|
if (ordered.length > 0) return ordered;
|
|
3789
3790
|
}
|
|
3790
|
-
return Array.from(idToHref.values()).sort(
|
|
3791
|
+
return Array.from(idToHref.values()).sort(_chunkRHMIEEAZcjs.compareSectionPaths);
|
|
3791
3792
|
}
|
|
3792
3793
|
|
|
3793
3794
|
// src/hwpx/metadata.ts
|
|
@@ -3799,7 +3800,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3799
3800
|
const xml = await file.async("text");
|
|
3800
3801
|
if (decompressed) {
|
|
3801
3802
|
decompressed.total += xml.length * 2;
|
|
3802
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3803
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkRHMIEEAZcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3803
3804
|
}
|
|
3804
3805
|
return xml;
|
|
3805
3806
|
};
|
|
@@ -3821,13 +3822,13 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3821
3822
|
}
|
|
3822
3823
|
}
|
|
3823
3824
|
function parseOpfMetadata(xml, metadata) {
|
|
3824
|
-
const root = createXmlParser().parseFromString(
|
|
3825
|
+
const root = createXmlParser().parseFromString(_chunkRHMIEEAZcjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3825
3826
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3826
3827
|
if (!md2) return;
|
|
3827
3828
|
let title;
|
|
3828
3829
|
const meta = /* @__PURE__ */ new Map();
|
|
3829
3830
|
for (const el of elementChildren(md2)) {
|
|
3830
|
-
const text = _optionalChain([el, 'access',
|
|
3831
|
+
const text = _optionalChain([el, 'access', _141 => _141.textContent, 'optionalAccess', _142 => _142.trim, 'call', _143 => _143()]);
|
|
3831
3832
|
if (!text) continue;
|
|
3832
3833
|
const tag = localName(el);
|
|
3833
3834
|
if (tag === "title") title ??= text;
|
|
@@ -3839,11 +3840,11 @@ function parseOpfMetadata(xml, metadata) {
|
|
|
3839
3840
|
const put = (k, v) => {
|
|
3840
3841
|
if (v !== void 0 && !metadata[k]) metadata[k] = v;
|
|
3841
3842
|
};
|
|
3842
|
-
const keywords = _optionalChain([meta, 'access',
|
|
3843
|
+
const keywords = _optionalChain([meta, 'access', _144 => _144.get, 'call', _145 => _145("keyword"), 'optionalAccess', _146 => _146.split, 'call', _147 => _147(/[,;]/), 'access', _148 => _148.map, 'call', _149 => _149((k) => k.trim()), 'access', _150 => _150.filter, 'call', _151 => _151(Boolean)]);
|
|
3843
3844
|
put("title", title);
|
|
3844
3845
|
put("author", meta.get("creator"));
|
|
3845
3846
|
put("description", meta.get("description") || meta.get("subject"));
|
|
3846
|
-
put("keywords", _optionalChain([keywords, 'optionalAccess',
|
|
3847
|
+
put("keywords", _optionalChain([keywords, 'optionalAccess', _152 => _152.length]) ? keywords : void 0);
|
|
3847
3848
|
put("createdAt", isoDate(meta.get("CreatedDate")));
|
|
3848
3849
|
put("modifiedAt", isoDate(meta.get("ModifiedDate")));
|
|
3849
3850
|
}
|
|
@@ -3854,13 +3855,13 @@ function isoDate(s) {
|
|
|
3854
3855
|
}
|
|
3855
3856
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3856
3857
|
const parser = createXmlParser();
|
|
3857
|
-
const doc = parser.parseFromString(
|
|
3858
|
+
const doc = parser.parseFromString(_chunkRHMIEEAZcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3858
3859
|
if (!doc.documentElement) return;
|
|
3859
3860
|
const getText = (tagNames) => {
|
|
3860
3861
|
for (const tag of tagNames) {
|
|
3861
3862
|
const els = doc.getElementsByTagName(tag);
|
|
3862
3863
|
if (els.length > 0) {
|
|
3863
|
-
const text = _optionalChain([els, 'access',
|
|
3864
|
+
const text = _optionalChain([els, 'access', _153 => _153[0], 'access', _154 => _154.textContent, 'optionalAccess', _155 => _155.trim, 'call', _156 => _156()]);
|
|
3864
3865
|
if (text) return text;
|
|
3865
3866
|
}
|
|
3866
3867
|
}
|
|
@@ -3884,8 +3885,8 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3884
3885
|
const current = pending.pop();
|
|
3885
3886
|
current.pageNumber = sectionNum;
|
|
3886
3887
|
for (const child of _nullishCoalesce(current.children, () => ( []))) pending.push(child);
|
|
3887
|
-
for (const caption of _nullishCoalesce(_optionalChain([current, 'access',
|
|
3888
|
-
for (const row of _nullishCoalesce(_optionalChain([current, 'access',
|
|
3888
|
+
for (const caption of _nullishCoalesce(_optionalChain([current, 'access', _157 => _157.table, 'optionalAccess', _158 => _158.captionBlocks]), () => ( []))) pending.push(caption);
|
|
3889
|
+
for (const row of _nullishCoalesce(_optionalChain([current, 'access', _159 => _159.table, 'optionalAccess', _160 => _160.cells]), () => ( []))) {
|
|
3889
3890
|
for (const cell2 of row) {
|
|
3890
3891
|
for (const child of _nullishCoalesce(cell2.blocks, () => ( []))) pending.push(child);
|
|
3891
3892
|
}
|
|
@@ -3893,25 +3894,25 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3893
3894
|
}
|
|
3894
3895
|
}
|
|
3895
3896
|
async function parseHwpxDocument(buffer, options) {
|
|
3896
|
-
|
|
3897
|
+
_chunkRHMIEEAZcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3897
3898
|
let zip;
|
|
3898
3899
|
try {
|
|
3899
3900
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
3900
3901
|
} catch (e19) {
|
|
3901
|
-
return extractFromBrokenZip(buffer);
|
|
3902
|
+
return extractFromBrokenZip(buffer, options);
|
|
3902
3903
|
}
|
|
3903
3904
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3904
3905
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3905
|
-
throw new (0,
|
|
3906
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3906
3907
|
}
|
|
3907
3908
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3908
3909
|
if (manifestFile) {
|
|
3909
3910
|
const manifestXml = await manifestFile.async("text");
|
|
3910
3911
|
if (isEncryptedHwpx(manifestXml)) {
|
|
3911
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3912
|
+
if (_optionalChain([options, 'optionalAccess', _161 => _161.password])) {
|
|
3912
3913
|
await decryptHwpxInPlace(zip, manifestXml, options.password);
|
|
3913
3914
|
} else {
|
|
3914
|
-
if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
3915
|
+
if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _162 => _162.filePath])) {
|
|
3915
3916
|
try {
|
|
3916
3917
|
const { pages, pageCount, warnings: warnings2 } = extractTextViaCom(options.filePath);
|
|
3917
3918
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -3920,8 +3921,8 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3920
3921
|
} catch (e20) {
|
|
3921
3922
|
}
|
|
3922
3923
|
}
|
|
3923
|
-
const hpf = await _optionalChain([zip, 'access',
|
|
3924
|
-
throw new (0,
|
|
3924
|
+
const hpf = await _optionalChain([zip, 'access', _163 => _163.file, 'call', _164 => _164("Contents/content.hpf"), 'optionalAccess', _165 => _165.async, 'call', _166 => _166("text"), 'access', _167 => _167.catch, 'call', _168 => _168(() => "")]);
|
|
3925
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(
|
|
3925
3926
|
/\bdistribution="1"/.test(_nullishCoalesce(hpf, () => ( ""))) ? "\uBC30\uD3EC\uC6A9\uC73C\uB85C \uC554\uD638\uD654\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4 (\uBC30\uD3EC\uC6A9 \uBCF5\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC74C). \uD55C\uCEF4\uC624\uD53C\uC2A4\uC5D0\uC11C \uC77C\uBC18 \uBB38\uC11C\uB85C \uC800\uC7A5\uD55C \uB4A4 \uC5EC\uC138\uC694." : "\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694."
|
|
3926
3927
|
);
|
|
3927
3928
|
}
|
|
@@ -3933,13 +3934,13 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3933
3934
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3934
3935
|
const warnings = [];
|
|
3935
3936
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3936
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3937
|
+
if (sectionPaths.length === 0) throw new (0, _chunkRHMIEEAZcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3937
3938
|
let allBlocks = [];
|
|
3938
3939
|
const shared = createSectionShared();
|
|
3939
3940
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
3940
|
-
shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess',
|
|
3941
|
-
shared.keepEmptyParagraphs = _optionalChain([options, 'optionalAccess',
|
|
3942
|
-
shared.includeFieldPlaceholders = _optionalChain([options, 'optionalAccess',
|
|
3941
|
+
shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _169 => _169.keepTrailingEmptyCols]);
|
|
3942
|
+
shared.keepEmptyParagraphs = _optionalChain([options, 'optionalAccess', _170 => _170.keepEmptyParagraphs]);
|
|
3943
|
+
shared.includeFieldPlaceholders = _optionalChain([options, 'optionalAccess', _171 => _171.includeFieldPlaceholders]);
|
|
3943
3944
|
const sectionRanges = [];
|
|
3944
3945
|
let parsedSections = 0;
|
|
3945
3946
|
for (let si = 0; si < sectionPaths.length; si++) {
|
|
@@ -3953,7 +3954,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3953
3954
|
allBlocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
|
|
3954
3955
|
sectionRanges.push({ sectionNum: si + 1, start, end: allBlocks.length });
|
|
3955
3956
|
parsedSections++;
|
|
3956
|
-
_optionalChain([options, 'optionalAccess',
|
|
3957
|
+
_optionalChain([options, 'optionalAccess', _172 => _172.onProgress, 'optionalCall', _173 => _173(parsedSections, sectionPaths.length)]);
|
|
3957
3958
|
} catch (secErr) {
|
|
3958
3959
|
if (secErr instanceof ZipBombError) throw secErr;
|
|
3959
3960
|
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" });
|
|
@@ -3967,7 +3968,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3967
3968
|
for (let b = r.start; b < r.end; b++) assignSectionPage(allBlocks[b], r.sectionNum);
|
|
3968
3969
|
}
|
|
3969
3970
|
}
|
|
3970
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3971
|
+
if (_optionalChain([options, 'optionalAccess', _174 => _174.pages])) {
|
|
3971
3972
|
const pageFilter = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, metadata.pageCount);
|
|
3972
3973
|
allBlocks = allBlocks.filter((b) => b.pageNumber != null && pageFilter.has(b.pageNumber));
|
|
3973
3974
|
if (!layoutPages) {
|
|
@@ -3976,11 +3977,11 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3976
3977
|
}
|
|
3977
3978
|
const blocks = allBlocks;
|
|
3978
3979
|
applyPageText(blocks, shared);
|
|
3979
|
-
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess',
|
|
3980
|
-
const shown = _optionalChain([options, 'optionalAccess',
|
|
3980
|
+
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _175 => _175.pages]), shared.track.deletedImageRefs);
|
|
3981
|
+
const shown = _optionalChain([options, 'optionalAccess', _176 => _176.layoutTables]) === "keep" ? blocks : _chunkW5NXOMCDcjs.unframeLayoutTables.call(void 0, blocks, !!_optionalChain([options, 'optionalAccess', _177 => _177.keepTrailingEmptyCols]));
|
|
3981
3982
|
detectHwpxHeadings(shown, styleMap, shared.tocTexts);
|
|
3982
3983
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3983
|
-
const markdown =
|
|
3984
|
+
const markdown = _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, shown, { tableFormat: _optionalChain([options, 'optionalAccess', _178 => _178.tableFormat]) });
|
|
3984
3985
|
return { markdown, blocks: shown, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
|
|
3985
3986
|
}
|
|
3986
3987
|
|
|
@@ -4747,19 +4748,19 @@ function decryptPasswordStream(raw, password) {
|
|
|
4747
4748
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4748
4749
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4749
4750
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4750
|
-
const wrong = () => new (0,
|
|
4751
|
+
const wrong = () => new (0, _chunkRHMIEEAZcjs.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.");
|
|
4751
4752
|
let records;
|
|
4752
4753
|
try {
|
|
4753
4754
|
records = readRecords3(data);
|
|
4754
4755
|
} catch (e22) {
|
|
4755
4756
|
throw wrong();
|
|
4756
4757
|
}
|
|
4757
|
-
if (_optionalChain([records, 'access',
|
|
4758
|
+
if (_optionalChain([records, 'access', _179 => _179[0], 'optionalAccess', _180 => _180.tagId]) !== TAG_DOCUMENT_PROPERTIES) throw wrong();
|
|
4758
4759
|
if (!records.some((r) => r.tagId === TAG_ID_MAPPINGS2)) throw wrong();
|
|
4759
4760
|
}
|
|
4760
4761
|
function assertSupportedEncryptVersion(version) {
|
|
4761
4762
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4762
|
-
throw new (0,
|
|
4763
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(
|
|
4763
4764
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4764
4765
|
);
|
|
4765
4766
|
}
|
|
@@ -5137,8 +5138,8 @@ function emitParagraphBlocks(p) {
|
|
|
5137
5138
|
const { headMarker, style, footnotes, objects, pageNumber } = p;
|
|
5138
5139
|
const blocks = [];
|
|
5139
5140
|
const decorate = (t) => {
|
|
5140
|
-
let deco = _optionalChain([style, 'optionalAccess',
|
|
5141
|
-
if (_optionalChain([style, 'optionalAccess',
|
|
5141
|
+
let deco = _optionalChain([style, 'optionalAccess', _181 => _181.strike]) ? `~~${t}~~` : t;
|
|
5142
|
+
if (_optionalChain([style, 'optionalAccess', _182 => _182.underline])) deco = `<u>${deco}</u>`;
|
|
5142
5143
|
return deco;
|
|
5143
5144
|
};
|
|
5144
5145
|
if (p.text.includes(INLINE_TABLE_MARK)) {
|
|
@@ -5200,7 +5201,7 @@ function emitParagraphBlocks(p) {
|
|
|
5200
5201
|
return blocks;
|
|
5201
5202
|
}
|
|
5202
5203
|
function tableFlatText(table2) {
|
|
5203
|
-
const flat =
|
|
5204
|
+
const flat = _chunkW5NXOMCDcjs.convertTableToText.call(void 0, table2.cells);
|
|
5204
5205
|
return table2.caption ? table2.caption + (flat ? "\n" + flat : "") : flat;
|
|
5205
5206
|
}
|
|
5206
5207
|
function blocksPlainText(blocks, sep) {
|
|
@@ -5251,7 +5252,7 @@ function resolveCellOverlaps(cells, rows, cols) {
|
|
|
5251
5252
|
const r0 = _nullishCoalesce(cell2.rowAddr, () => ( 0)), c0 = _nullishCoalesce(cell2.colAddr, () => ( 0));
|
|
5252
5253
|
const hit = owner.get(r0 * cols + c0);
|
|
5253
5254
|
if (hit) {
|
|
5254
|
-
if (_optionalChain([cell2, 'access',
|
|
5255
|
+
if (_optionalChain([cell2, 'access', _183 => _183.blocks, 'optionalAccess', _184 => _184.length])) {
|
|
5255
5256
|
hit.blocks = [..._nullishCoalesce(hit.blocks, () => ( (hit.text ? [{ type: "paragraph", text: hit.text }] : []))), ...cell2.blocks];
|
|
5256
5257
|
}
|
|
5257
5258
|
if (cell2.text.trim()) hit.text = hit.text.trim() ? `${hit.text}
|
|
@@ -5280,8 +5281,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5280
5281
|
}
|
|
5281
5282
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5282
5283
|
for (const c of cells) {
|
|
5283
|
-
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1,
|
|
5284
|
-
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1,
|
|
5284
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunkW5NXOMCDcjs.MAX_ROWS));
|
|
5285
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunkW5NXOMCDcjs.MAX_COLS));
|
|
5285
5286
|
}
|
|
5286
5287
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5287
5288
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5289,17 +5290,17 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5289
5290
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5290
5291
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5291
5292
|
}
|
|
5292
|
-
const table2 =
|
|
5293
|
+
const table2 = _chunkW5NXOMCDcjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5293
5294
|
if (table2.rows === 0) return null;
|
|
5294
5295
|
for (const c of placed) {
|
|
5295
5296
|
if (c.edges) {
|
|
5296
|
-
const at = _optionalChain([table2, 'access',
|
|
5297
|
-
if (at)
|
|
5297
|
+
const at = _optionalChain([table2, 'access', _185 => _185.cells, 'access', _186 => _186[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _187 => _187[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
5298
|
+
if (at) _chunkW5NXOMCDcjs.CELL_EDGES.set(at, c.edges);
|
|
5298
5299
|
}
|
|
5299
|
-
if (!_optionalChain([c, 'access',
|
|
5300
|
-
const target = _optionalChain([table2, 'access',
|
|
5300
|
+
if (!_optionalChain([c, 'access', _188 => _188.blocks, 'optionalAccess', _189 => _189.length]) && !c.isHeader) continue;
|
|
5301
|
+
const target = _optionalChain([table2, 'access', _190 => _190.cells, 'access', _191 => _191[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _192 => _192[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
5301
5302
|
if (!target || target.text !== c.text.trim()) continue;
|
|
5302
|
-
if (_optionalChain([c, 'access',
|
|
5303
|
+
if (_optionalChain([c, 'access', _193 => _193.blocks, 'optionalAccess', _194 => _194.length])) target.blocks = c.blocks;
|
|
5303
5304
|
if (c.isHeader) target.isHeader = true;
|
|
5304
5305
|
}
|
|
5305
5306
|
return table2;
|
|
@@ -5496,7 +5497,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5496
5497
|
continue;
|
|
5497
5498
|
}
|
|
5498
5499
|
if (!ctrl.href) continue;
|
|
5499
|
-
const href =
|
|
5500
|
+
const href = _chunkRHMIEEAZcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5500
5501
|
if (!href) continue;
|
|
5501
5502
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK)) continue;
|
|
5502
5503
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5505,7 +5506,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5505
5506
|
}
|
|
5506
5507
|
if (text.includes(LITERAL_DOLLAR_MARK)) text = text.replaceAll(LITERAL_DOLLAR_MARK, "\\$");
|
|
5507
5508
|
text = resolveLiteralLt(text);
|
|
5508
|
-
text =
|
|
5509
|
+
text = _chunkW5NXOMCDcjs.tidyScriptTags.call(void 0, text);
|
|
5509
5510
|
const toc = takeTocLeaders(text);
|
|
5510
5511
|
text = toc.text;
|
|
5511
5512
|
let headingLevel = 0;
|
|
@@ -5517,7 +5518,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5517
5518
|
}
|
|
5518
5519
|
if (ps.headType === 1 || ps.headType === 2) {
|
|
5519
5520
|
const nid = ps.numberingId || (ps.headType === 1 ? ctx.doc.outlineNumberingId : 0);
|
|
5520
|
-
const numbering = nid >= 1 ? _optionalChain([ctx, 'access',
|
|
5521
|
+
const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _195 => _195.docInfo, 'optionalAccess', _196 => _196.numberings, 'access', _197 => _197[nid - 1]]) : void 0;
|
|
5521
5522
|
if (numbering) {
|
|
5522
5523
|
const counters = ctx.doc.numbering.advance(nid, ps.paraLevel);
|
|
5523
5524
|
const fmt = numbering.levelFormats[Math.min(ps.paraLevel, 6)];
|
|
@@ -5527,7 +5528,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5527
5528
|
}
|
|
5528
5529
|
}
|
|
5529
5530
|
} else if (ps.headType === 3) {
|
|
5530
|
-
const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access',
|
|
5531
|
+
const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _198 => _198.docInfo, 'optionalAccess', _199 => _199.bullets, 'access', _200 => _200[ps.numberingId - 1]]) : void 0;
|
|
5531
5532
|
if (bullet && bullet.char !== "\uFFFF") headMarker = bullet.char;
|
|
5532
5533
|
}
|
|
5533
5534
|
}
|
|
@@ -5718,20 +5719,20 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5718
5719
|
}
|
|
5719
5720
|
var A4_HEIGHT = 84188;
|
|
5720
5721
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5721
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5722
|
+
if (!cells.some((c) => c.pageSpanning)) _chunkW5NXOMCDcjs.markNonLayoutTable.call(void 0, table2);
|
|
5722
5723
|
}
|
|
5723
5724
|
function parseTableControl(ctrl, records, ctx) {
|
|
5724
5725
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
5725
5726
|
const { childStart, childEnd } = ctrl;
|
|
5726
|
-
const sourceId = _optionalChain([ctx, 'access',
|
|
5727
|
+
const sourceId = _optionalChain([ctx, 'access', _201 => _201.tableIds, 'optionalAccess', _202 => _202.get, 'call', _203 => _203(childStart - 1)]);
|
|
5727
5728
|
const directLevel = records[childStart - 1].level + 1;
|
|
5728
5729
|
let rows = 0;
|
|
5729
5730
|
let cols = 0;
|
|
5730
5731
|
let tableIdx = -1;
|
|
5731
5732
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5732
5733
|
if (records[i2].tagId === TAG_TABLE && records[i2].level === directLevel && records[i2].data.length >= 8) {
|
|
5733
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5734
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5734
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkW5NXOMCDcjs.MAX_ROWS);
|
|
5735
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkW5NXOMCDcjs.MAX_COLS);
|
|
5735
5736
|
tableIdx = i2;
|
|
5736
5737
|
break;
|
|
5737
5738
|
}
|
|
@@ -5775,11 +5776,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5775
5776
|
return table3;
|
|
5776
5777
|
}
|
|
5777
5778
|
if (rows === 0 || cols === 0) {
|
|
5778
|
-
rows = Math.min(cells.length,
|
|
5779
|
+
rows = Math.min(cells.length, _chunkW5NXOMCDcjs.MAX_ROWS);
|
|
5779
5780
|
cols = 1;
|
|
5780
5781
|
}
|
|
5781
5782
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5782
|
-
const table2 =
|
|
5783
|
+
const table2 = _chunkW5NXOMCDcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5783
5784
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5784
5785
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
5785
5786
|
keepUnlessPageSpanning(table2, cells);
|
|
@@ -5798,8 +5799,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5798
5799
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5799
5800
|
const cs = rec.data.readUInt16LE(12);
|
|
5800
5801
|
const rs = rec.data.readUInt16LE(14);
|
|
5801
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5802
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5802
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkW5NXOMCDcjs.MAX_COLS);
|
|
5803
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkW5NXOMCDcjs.MAX_ROWS);
|
|
5803
5804
|
}
|
|
5804
5805
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5805
5806
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -5809,8 +5810,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5809
5810
|
if (rec.data.length >= 24 && rec.data.readUInt32LE(20) > A4_HEIGHT) cell2.pageSpanning = true;
|
|
5810
5811
|
if (rec.data.length >= 34) {
|
|
5811
5812
|
const borderFillId = rec.data.readUInt16LE(32);
|
|
5812
|
-
const definitions = _optionalChain([ctx, 'access',
|
|
5813
|
-
const edges = borderFillId === 0 && _optionalChain([definitions, 'optionalAccess',
|
|
5813
|
+
const definitions = _optionalChain([ctx, 'access', _204 => _204.docInfo, 'optionalAccess', _205 => _205.borderEdges]);
|
|
5814
|
+
const edges = borderFillId === 0 && _optionalChain([definitions, 'optionalAccess', _206 => _206.length]) ? { t: false, b: false, l: false, r: false } : _optionalChain([definitions, 'optionalAccess', _207 => _207[borderFillId - 1]]);
|
|
5814
5815
|
if (edges) cell2.edges = edges;
|
|
5815
5816
|
}
|
|
5816
5817
|
return cell2;
|
|
@@ -5878,8 +5879,8 @@ function pictureToImageBlock(data, ctx) {
|
|
|
5878
5879
|
if (data.length < 73) return null;
|
|
5879
5880
|
const binDataId = data.readUInt16LE(71);
|
|
5880
5881
|
if (binDataId === 0) return null;
|
|
5881
|
-
const item = _optionalChain([ctx, 'access',
|
|
5882
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
5882
|
+
const item = _optionalChain([ctx, 'access', _208 => _208.docInfo, 'optionalAccess', _209 => _209.binData, 'access', _210 => _210[binDataId - 1]]);
|
|
5883
|
+
if (_optionalChain([item, 'optionalAccess', _211 => _211.kind]) === "link") {
|
|
5883
5884
|
ctx.warnings.push({ page: ctx.page, message: `\uC678\uBD80 \uC5F0\uACB0 \uC774\uBBF8\uC9C0 (binDataId ${binDataId})`, code: "SKIPPED_IMAGE" });
|
|
5884
5885
|
return null;
|
|
5885
5886
|
}
|
|
@@ -5889,7 +5890,7 @@ function pictureToImageBlock(data, ctx) {
|
|
|
5889
5890
|
function scriptLookup(runs, docInfo) {
|
|
5890
5891
|
if (!docInfo || !runs.length) return void 0;
|
|
5891
5892
|
const kindOf = (id) => {
|
|
5892
|
-
const f = _nullishCoalesce(_optionalChain([docInfo, 'access',
|
|
5893
|
+
const f = _nullishCoalesce(_optionalChain([docInfo, 'access', _212 => _212.charShapes, 'access', _213 => _213[id], 'optionalAccess', _214 => _214.attrFlags]), () => ( 0));
|
|
5893
5894
|
return f & 1 << 15 ? "sup" : f & 1 << 16 ? "sub" : null;
|
|
5894
5895
|
};
|
|
5895
5896
|
if (!runs.some(([, id]) => kindOf(id))) return void 0;
|
|
@@ -5948,25 +5949,25 @@ function openHwp5Container(buffer, options) {
|
|
|
5948
5949
|
lenientCfb = parseLenientCfb(buffer);
|
|
5949
5950
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
5950
5951
|
} catch (e24) {
|
|
5951
|
-
throw new (0,
|
|
5952
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
5952
5953
|
}
|
|
5953
5954
|
}
|
|
5954
5955
|
const readRawStream = (path) => {
|
|
5955
5956
|
if (cfb) {
|
|
5956
5957
|
const entry = CFB.find(cfb, path);
|
|
5957
|
-
return _optionalChain([entry, 'optionalAccess',
|
|
5958
|
+
return _optionalChain([entry, 'optionalAccess', _215 => _215.content]) ? Buffer.from(entry.content) : null;
|
|
5958
5959
|
}
|
|
5959
5960
|
return lenientCfb.findStream(path);
|
|
5960
5961
|
};
|
|
5961
5962
|
const headerData = readRawStream("/FileHeader");
|
|
5962
|
-
if (!headerData) throw new (0,
|
|
5963
|
+
if (!headerData) throw new (0, _chunkRHMIEEAZcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
5963
5964
|
const header = parseFileHeader(headerData);
|
|
5964
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
5965
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
5965
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkRHMIEEAZcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
5966
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkRHMIEEAZcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
5966
5967
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
5967
5968
|
if (encrypted) {
|
|
5968
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
5969
|
-
throw new (0,
|
|
5969
|
+
if (!_optionalChain([options, 'optionalAccess', _216 => _216.password])) {
|
|
5970
|
+
throw new (0, _chunkRHMIEEAZcjs.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.");
|
|
5970
5971
|
}
|
|
5971
5972
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
5972
5973
|
}
|
|
@@ -5980,12 +5981,12 @@ function openHwp5Container(buffer, options) {
|
|
|
5980
5981
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
5981
5982
|
if (encrypted) {
|
|
5982
5983
|
const rawDocInfo = findStream("/DocInfo");
|
|
5983
|
-
if (!rawDocInfo) throw new (0,
|
|
5984
|
+
if (!rawDocInfo) throw new (0, _chunkRHMIEEAZcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
5984
5985
|
let docInfoData;
|
|
5985
5986
|
try {
|
|
5986
5987
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
5987
5988
|
} catch (e25) {
|
|
5988
|
-
throw new (0,
|
|
5989
|
+
throw new (0, _chunkRHMIEEAZcjs.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.");
|
|
5989
5990
|
}
|
|
5990
5991
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
5991
5992
|
}
|
|
@@ -6010,10 +6011,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
6010
6011
|
try {
|
|
6011
6012
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
6012
6013
|
totalDecompressed += data.length;
|
|
6013
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6014
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6014
6015
|
out.push(readRecords(data));
|
|
6015
6016
|
} catch (secErr) {
|
|
6016
|
-
if (secErr instanceof
|
|
6017
|
+
if (secErr instanceof _chunkRHMIEEAZcjs.KordocError) throw secErr;
|
|
6017
6018
|
out.push(null);
|
|
6018
6019
|
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" });
|
|
6019
6020
|
}
|
|
@@ -6033,7 +6034,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6033
6034
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
6034
6035
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
6035
6036
|
const sections = readHwp5SectionStreams(c);
|
|
6036
|
-
if (sections.length === 0) throw new (0,
|
|
6037
|
+
if (sections.length === 0) throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
6037
6038
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
6038
6039
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
6039
6040
|
const sectionTableIds = [];
|
|
@@ -6047,15 +6048,15 @@ function parseHwp5Document(buffer, options) {
|
|
|
6047
6048
|
}
|
|
6048
6049
|
const layoutPages = sectionDetects.length > 0 && sectionDetects.every((d) => d != null && d.usable);
|
|
6049
6050
|
metadata.pageMode = layoutPages ? "layout" : "section";
|
|
6050
|
-
metadata.pageCount = layoutPages ? Math.max(sectionDetects.reduce((sum, d) => sum + (_nullishCoalesce(_optionalChain([d, 'optionalAccess',
|
|
6051
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
6051
|
+
metadata.pageCount = layoutPages ? Math.max(sectionDetects.reduce((sum, d) => sum + (_nullishCoalesce(_optionalChain([d, 'optionalAccess', _217 => _217.pages]), () => ( 0))), 0), 1) : sections.length;
|
|
6052
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _218 => _218.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, metadata.pageCount) : null;
|
|
6052
6053
|
if (pageFilter && !layoutPages) {
|
|
6053
6054
|
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" });
|
|
6054
6055
|
}
|
|
6055
6056
|
let bodyBlocks = [];
|
|
6056
6057
|
const doc = createHwp5DocState();
|
|
6057
|
-
doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess',
|
|
6058
|
-
doc.includeFieldPlaceholders = _optionalChain([options, 'optionalAccess',
|
|
6058
|
+
doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _219 => _219.keepTrailingEmptyCols]);
|
|
6059
|
+
doc.includeFieldPlaceholders = _optionalChain([options, 'optionalAccess', _220 => _220.includeFieldPlaceholders]);
|
|
6059
6060
|
let parsedSections = 0;
|
|
6060
6061
|
let pageBase = 0;
|
|
6061
6062
|
for (let si = 0; si < sections.length; si++) {
|
|
@@ -6075,9 +6076,9 @@ function parseHwp5Document(buffer, options) {
|
|
|
6075
6076
|
);
|
|
6076
6077
|
bodyBlocks.push(...sectionBlocks);
|
|
6077
6078
|
parsedSections++;
|
|
6078
|
-
_optionalChain([options, 'optionalAccess',
|
|
6079
|
+
_optionalChain([options, 'optionalAccess', _221 => _221.onProgress, 'optionalCall', _222 => _222(parsedSections, sections.length)]);
|
|
6079
6080
|
} catch (secErr) {
|
|
6080
|
-
if (secErr instanceof
|
|
6081
|
+
if (secErr instanceof _chunkRHMIEEAZcjs.KordocError) throw secErr;
|
|
6081
6082
|
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" });
|
|
6082
6083
|
} finally {
|
|
6083
6084
|
pageBase += detect2.pages;
|
|
@@ -6088,10 +6089,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6088
6089
|
}
|
|
6089
6090
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
6090
6091
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter, encrypted ? findStream : void 0) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter, encrypted ? findStream : void 0);
|
|
6091
|
-
let flatBlocks =
|
|
6092
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6093
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6094
|
-
const deduped =
|
|
6092
|
+
let flatBlocks = _chunkW5NXOMCDcjs.flattenLayoutTables.call(void 0, blocks);
|
|
6093
|
+
if (_optionalChain([options, 'optionalAccess', _223 => _223.layoutTables]) !== "keep") flatBlocks = _chunkW5NXOMCDcjs.unframeLayoutTables.call(void 0, flatBlocks, !!_optionalChain([options, 'optionalAccess', _224 => _224.keepTrailingEmptyCols]));
|
|
6094
|
+
if (_optionalChain([options, 'optionalAccess', _225 => _225.dedupeRunningHeaders])) {
|
|
6095
|
+
const deduped = _chunkW5NXOMCDcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
6095
6096
|
const removed = flatBlocks.length - deduped.length;
|
|
6096
6097
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
6097
6098
|
flatBlocks = deduped;
|
|
@@ -6100,10 +6101,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6100
6101
|
detectHwp5Headings(flatBlocks, docInfo, doc.tocTexts);
|
|
6101
6102
|
}
|
|
6102
6103
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
6103
|
-
let markdown =
|
|
6104
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6104
|
+
let markdown = _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, flatBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _226 => _226.tableFormat]) });
|
|
6105
|
+
if (_optionalChain([options, 'optionalAccess', _227 => _227.inlineImages]) && options.images !== false && images.length > 0) {
|
|
6105
6106
|
try {
|
|
6106
|
-
markdown =
|
|
6107
|
+
markdown = _chunkUOXOYZU4cjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
6107
6108
|
} catch (inlineErr) {
|
|
6108
6109
|
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" });
|
|
6109
6110
|
}
|
|
@@ -6113,7 +6114,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6113
6114
|
function parseDocInfoStream(cfb, compressed) {
|
|
6114
6115
|
try {
|
|
6115
6116
|
const entry = CFB.find(cfb, "/DocInfo");
|
|
6116
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
6117
|
+
if (!_optionalChain([entry, 'optionalAccess', _228 => _228.content])) return null;
|
|
6117
6118
|
const data = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
6118
6119
|
const records = readRecords(data);
|
|
6119
6120
|
return parseDocInfo(records);
|
|
@@ -6134,7 +6135,7 @@ function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
|
6134
6135
|
let baseFontSize = 0;
|
|
6135
6136
|
const sizeFreq = /* @__PURE__ */ new Map();
|
|
6136
6137
|
for (const b of blocks) {
|
|
6137
|
-
if (_optionalChain([b, 'access',
|
|
6138
|
+
if (_optionalChain([b, 'access', _229 => _229.style, 'optionalAccess', _230 => _230.fontSize]) && b.text) {
|
|
6138
6139
|
sizeFreq.set(b.style.fontSize, (sizeFreq.get(b.style.fontSize) || 0) + b.text.length);
|
|
6139
6140
|
}
|
|
6140
6141
|
}
|
|
@@ -6150,7 +6151,7 @@ function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
|
6150
6151
|
const name = (style.nameKo || style.name).toLowerCase();
|
|
6151
6152
|
if (name.includes("\uBC14\uD0D5") || name.includes("\uBCF8\uBB38") || name === "normal" || name === "body") {
|
|
6152
6153
|
const cs = docInfo.charShapes[style.charShapeId];
|
|
6153
|
-
if (_optionalChain([cs, 'optionalAccess',
|
|
6154
|
+
if (_optionalChain([cs, 'optionalAccess', _231 => _231.fontSize]) > 0) {
|
|
6154
6155
|
baseFontSize = cs.fontSize / 10;
|
|
6155
6156
|
break;
|
|
6156
6157
|
}
|
|
@@ -6160,16 +6161,16 @@ function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
|
6160
6161
|
if (baseFontSize <= 0) return;
|
|
6161
6162
|
for (const block of blocks) {
|
|
6162
6163
|
if (block.type === "heading") continue;
|
|
6163
|
-
if (block.type !== "paragraph" || !block.text || TOC_ENTRY_BLOCKS.has(block) || _optionalChain([tocTexts, 'optionalAccess',
|
|
6164
|
+
if (block.type !== "paragraph" || !block.text || TOC_ENTRY_BLOCKS.has(block) || _optionalChain([tocTexts, 'optionalAccess', _232 => _232.has, 'call', _233 => _233(block.text.trim())])) continue;
|
|
6164
6165
|
const text = block.text.trim();
|
|
6165
6166
|
if (text.length === 0 || text.length > 200) continue;
|
|
6166
6167
|
if (/^\d+$/.test(text)) continue;
|
|
6167
6168
|
let level = 0;
|
|
6168
|
-
if (_optionalChain([block, 'access',
|
|
6169
|
+
if (_optionalChain([block, 'access', _234 => _234.style, 'optionalAccess', _235 => _235.fontSize]) && baseFontSize > 0) {
|
|
6169
6170
|
const ratio = block.style.fontSize / baseFontSize;
|
|
6170
|
-
if (ratio >=
|
|
6171
|
-
else if (ratio >=
|
|
6172
|
-
else if (ratio >=
|
|
6171
|
+
if (ratio >= _chunkW5NXOMCDcjs.HEADING_RATIO_H1) level = 1;
|
|
6172
|
+
else if (ratio >= _chunkW5NXOMCDcjs.HEADING_RATIO_H2) level = 2;
|
|
6173
|
+
else if (ratio >= _chunkW5NXOMCDcjs.HEADING_RATIO_H3) level = 3;
|
|
6173
6174
|
}
|
|
6174
6175
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
6175
6176
|
if (level === 0) level = 2;
|
|
@@ -6190,7 +6191,7 @@ var CODE_PAGE_LABELS = { 949: "euc-kr", 932: "shift_jis", 936: "gbk", 950: "big5
|
|
|
6190
6191
|
function extractHwp5Metadata(cfb, metadata) {
|
|
6191
6192
|
try {
|
|
6192
6193
|
const summaryEntry = CFB.find(cfb, "/HwpSummaryInformation") || CFB.find(cfb, "/SummaryInformation");
|
|
6193
|
-
if (!_optionalChain([summaryEntry, 'optionalAccess',
|
|
6194
|
+
if (!_optionalChain([summaryEntry, 'optionalAccess', _236 => _236.content])) return;
|
|
6194
6195
|
const data = Buffer.from(summaryEntry.content);
|
|
6195
6196
|
if (data.length < 48) return;
|
|
6196
6197
|
const numSets = data.readUInt32LE(24);
|
|
@@ -6220,8 +6221,8 @@ function extractHwp5Metadata(cfb, metadata) {
|
|
|
6220
6221
|
if (title) metadata.title = title;
|
|
6221
6222
|
if (author) metadata.author = author;
|
|
6222
6223
|
if (description) metadata.description = description;
|
|
6223
|
-
const keywords = _optionalChain([text, 'call',
|
|
6224
|
-
if (_optionalChain([keywords, 'optionalAccess',
|
|
6224
|
+
const keywords = _optionalChain([text, 'call', _237 => _237(5), 'optionalAccess', _238 => _238.split, 'call', _239 => _239(/[,;]/), 'access', _240 => _240.map, 'call', _241 => _241((k) => k.trim()), 'access', _242 => _242.filter, 'call', _243 => _243(Boolean)]);
|
|
6225
|
+
if (_optionalChain([keywords, 'optionalAccess', _244 => _244.length])) metadata.keywords = keywords;
|
|
6225
6226
|
const createdAt = time(12), modifiedAt = time(13);
|
|
6226
6227
|
if (createdAt) metadata.createdAt = createdAt;
|
|
6227
6228
|
if (modifiedAt) metadata.modifiedAt = modifiedAt;
|
|
@@ -6257,7 +6258,7 @@ function findViewTextSections(cfb, compressed) {
|
|
|
6257
6258
|
const sections = [];
|
|
6258
6259
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
6259
6260
|
const entry = CFB.find(cfb, `/ViewText/Section${i}`);
|
|
6260
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
6261
|
+
if (!_optionalChain([entry, 'optionalAccess', _245 => _245.content])) break;
|
|
6261
6262
|
try {
|
|
6262
6263
|
const decrypted = decryptViewText(Buffer.from(entry.content), compressed);
|
|
6263
6264
|
sections.push({ idx: i, content: decrypted });
|
|
@@ -6280,13 +6281,13 @@ function findSections(cfb) {
|
|
|
6280
6281
|
const sections = [];
|
|
6281
6282
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
6282
6283
|
const entry = CFB.find(cfb, `/BodyText/Section${i}`);
|
|
6283
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
6284
|
+
if (!_optionalChain([entry, 'optionalAccess', _246 => _246.content])) break;
|
|
6284
6285
|
sections.push({ idx: i, content: Buffer.from(entry.content) });
|
|
6285
6286
|
}
|
|
6286
6287
|
if (sections.length === 0 && cfb.FileIndex) {
|
|
6287
6288
|
for (const entry of cfb.FileIndex) {
|
|
6288
6289
|
if (sections.length >= MAX_SECTIONS) break;
|
|
6289
|
-
if (_optionalChain([entry, 'access',
|
|
6290
|
+
if (_optionalChain([entry, 'access', _247 => _247.name, 'optionalAccess', _248 => _248.startsWith, 'call', _249 => _249("Section")]) && entry.content) {
|
|
6290
6291
|
const idx = parseInt(entry.name.replace("Section", ""), 10) || 0;
|
|
6291
6292
|
sections.push({ idx, content: Buffer.from(entry.content) });
|
|
6292
6293
|
}
|
|
@@ -6301,7 +6302,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6301
6302
|
const raw = _nullishCoalesce(lcfb.findStream(`/BodyText/Section${i}`), () => ( lcfb.findStream(`Section${i}`)));
|
|
6302
6303
|
if (!raw) break;
|
|
6303
6304
|
totalBytes += raw.length;
|
|
6304
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6305
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6305
6306
|
sections.push({ idx: i, content: raw });
|
|
6306
6307
|
}
|
|
6307
6308
|
if (sections.length === 0) {
|
|
@@ -6312,7 +6313,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6312
6313
|
const raw = lcfb.findStream(e.name);
|
|
6313
6314
|
if (raw) {
|
|
6314
6315
|
totalBytes += raw.length;
|
|
6315
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6316
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6316
6317
|
sections.push({ idx, content: raw });
|
|
6317
6318
|
}
|
|
6318
6319
|
}
|
|
@@ -6329,7 +6330,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6329
6330
|
try {
|
|
6330
6331
|
const content = decryptViewText(raw, compressed);
|
|
6331
6332
|
totalDecompressed += content.length;
|
|
6332
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6333
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6333
6334
|
sections.push({ idx: i, content });
|
|
6334
6335
|
} catch (e32) {
|
|
6335
6336
|
break;
|
|
@@ -18807,40 +18808,40 @@ function desEcbDecrypt(data, key) {
|
|
|
18807
18808
|
}
|
|
18808
18809
|
function readLayout(data) {
|
|
18809
18810
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18810
|
-
throw new (0,
|
|
18811
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18811
18812
|
}
|
|
18812
18813
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18813
18814
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18814
18815
|
if (payloadOffset >= data.length) {
|
|
18815
|
-
throw new (0,
|
|
18816
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18816
18817
|
}
|
|
18817
18818
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18818
18819
|
}
|
|
18819
18820
|
function decryptHwp3Document(input, password) {
|
|
18820
18821
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18821
18822
|
if (!compressed) {
|
|
18822
|
-
throw new (0,
|
|
18823
|
+
throw new (0, _chunkRHMIEEAZcjs.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)");
|
|
18823
18824
|
}
|
|
18824
18825
|
const source = Buffer.from(input);
|
|
18825
18826
|
const payload = source.subarray(payloadOffset);
|
|
18826
18827
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18827
18828
|
if (aligned.length === 0) {
|
|
18828
|
-
throw new (0,
|
|
18829
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18829
18830
|
}
|
|
18830
18831
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18831
18832
|
let inflated;
|
|
18832
18833
|
try {
|
|
18833
18834
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18834
18835
|
} catch (err) {
|
|
18835
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
18836
|
-
throw new (0,
|
|
18836
|
+
if (_optionalChain([err, 'optionalAccess', _250 => _250.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18837
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(
|
|
18837
18838
|
`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`
|
|
18838
18839
|
);
|
|
18839
18840
|
}
|
|
18840
|
-
throw new (0,
|
|
18841
|
+
throw new (0, _chunkRHMIEEAZcjs.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.");
|
|
18841
18842
|
}
|
|
18842
18843
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18843
|
-
throw new (0,
|
|
18844
|
+
throw new (0, _chunkRHMIEEAZcjs.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.");
|
|
18844
18845
|
}
|
|
18845
18846
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18846
18847
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -18897,9 +18898,9 @@ function hwp3CellGrid(info, count) {
|
|
|
18897
18898
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
18898
18899
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
18899
18900
|
const r2 = nextY[k] !== void 0 ? edgeAt(ys, nextY[k]) : ys.length - 1;
|
|
18900
|
-
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row),
|
|
18901
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunkW5NXOMCDcjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunkW5NXOMCDcjs.MAX_COLS) };
|
|
18901
18902
|
});
|
|
18902
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
18903
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunkW5NXOMCDcjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunkW5NXOMCDcjs.MAX_COLS), cells };
|
|
18903
18904
|
}
|
|
18904
18905
|
|
|
18905
18906
|
// src/hwp3/parser.ts
|
|
@@ -18938,8 +18939,8 @@ var SIMPLE_CTRL = /* @__PURE__ */ new Map([
|
|
|
18938
18939
|
function parseHwp3Document(buffer, options) {
|
|
18939
18940
|
let source = Buffer.from(buffer);
|
|
18940
18941
|
if (isEncryptedHwp3(source)) {
|
|
18941
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
18942
|
-
throw new (0,
|
|
18942
|
+
if (!_optionalChain([options, 'optionalAccess', _251 => _251.password])) {
|
|
18943
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(
|
|
18943
18944
|
"\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."
|
|
18944
18945
|
);
|
|
18945
18946
|
}
|
|
@@ -18955,11 +18956,11 @@ function parseHwp3Document(buffer, options) {
|
|
|
18955
18956
|
try {
|
|
18956
18957
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
18957
18958
|
} catch (err) {
|
|
18958
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
18959
|
-
throw new (0,
|
|
18959
|
+
if (_optionalChain([err, 'optionalAccess', _252 => _252.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18960
|
+
throw new (0, _chunkRHMIEEAZcjs.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`);
|
|
18960
18961
|
}
|
|
18961
18962
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
18962
|
-
throw new (0,
|
|
18963
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
18963
18964
|
}
|
|
18964
18965
|
} else {
|
|
18965
18966
|
body = tail;
|
|
@@ -18976,7 +18977,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
18976
18977
|
message: `HWP3 paragraph stream \uB3C4\uC911 \uD30C\uC2F1 \uC911\uB2E8: ${err instanceof Error ? err.message : String(err)}`
|
|
18977
18978
|
});
|
|
18978
18979
|
}
|
|
18979
|
-
const blocks =
|
|
18980
|
+
const blocks = _chunkW5NXOMCDcjs.flattenLayoutTables.call(void 0, [...ctx.headerBlocks, ...bodyBlocks, ...ctx.footerBlocks]);
|
|
18980
18981
|
const metadata = {
|
|
18981
18982
|
title: header.title || void 0,
|
|
18982
18983
|
author: header.author || void 0,
|
|
@@ -18985,7 +18986,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
18985
18986
|
version: "3.0"
|
|
18986
18987
|
};
|
|
18987
18988
|
return {
|
|
18988
|
-
markdown:
|
|
18989
|
+
markdown: _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _253 => _253.tableFormat]) }),
|
|
18989
18990
|
blocks,
|
|
18990
18991
|
metadata,
|
|
18991
18992
|
warnings: warnings.length ? warnings : void 0
|
|
@@ -19069,7 +19070,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
19069
19070
|
continue;
|
|
19070
19071
|
}
|
|
19071
19072
|
if (ch >= 32) {
|
|
19072
|
-
para2.text +=
|
|
19073
|
+
para2.text += _chunkW5NXOMCDcjs.escapeLiteralTags.call(void 0, _chunkW5NXOMCDcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( ""))));
|
|
19073
19074
|
continue;
|
|
19074
19075
|
}
|
|
19075
19076
|
if (ch === 9) {
|
|
@@ -19297,7 +19298,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19297
19298
|
|
|
19298
19299
|
// src/xlsx/sheet-blocks.ts
|
|
19299
19300
|
function sheetRowCap(cols) {
|
|
19300
|
-
return Math.max(
|
|
19301
|
+
return Math.max(_chunkW5NXOMCDcjs.MAX_ROWS, Math.floor(_chunkW5NXOMCDcjs.MAX_TABLE_CELLS / Math.max(1, cols)));
|
|
19301
19302
|
}
|
|
19302
19303
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19303
19304
|
const blocks = [];
|
|
@@ -19314,7 +19315,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19314
19315
|
}
|
|
19315
19316
|
if (firstRow === -1) return blocks;
|
|
19316
19317
|
const keepRows = [];
|
|
19317
|
-
for (let r = firstRow; r <= lastRow; r++) if (_optionalChain([rows, 'access',
|
|
19318
|
+
for (let r = firstRow; r <= lastRow; r++) if (_optionalChain([rows, 'access', _254 => _254.get, 'call', _255 => _255(r), 'optionalAccess', _256 => _256.some, 'call', _257 => _257((v) => v !== "")])) keepRows.push(r);
|
|
19318
19319
|
let keepCols;
|
|
19319
19320
|
if (keepAnchoredEmptyCols) keepCols = Array.from({ length: maxCol + 1 }, (_, c) => c);
|
|
19320
19321
|
else {
|
|
@@ -19328,7 +19329,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19328
19329
|
if (keepRows.length > rowCap) {
|
|
19329
19330
|
warnings.push({
|
|
19330
19331
|
page: sheetIndex + 1,
|
|
19331
|
-
message: `\uC2DC\uD2B8 "${sheetName}": ${keepRows.length}\uD589 \xD7 ${keepCols.length}\uC5F4 \uC911 \uC55E ${rowCap}\uD589\uB9CC \uD45C\uB85C \uB0C8\uC2B5\uB2C8\uB2E4 (\uD45C \uCE78 \uC0C1\uD55C ${
|
|
19332
|
+
message: `\uC2DC\uD2B8 "${sheetName}": ${keepRows.length}\uD589 \xD7 ${keepCols.length}\uC5F4 \uC911 \uC55E ${rowCap}\uD589\uB9CC \uD45C\uB85C \uB0C8\uC2B5\uB2C8\uB2E4 (\uD45C \uCE78 \uC0C1\uD55C ${_chunkW5NXOMCDcjs.MAX_TABLE_CELLS})`,
|
|
19332
19333
|
code: "TRUNCATED_TABLE"
|
|
19333
19334
|
});
|
|
19334
19335
|
keepRows.length = rowCap;
|
|
@@ -19342,9 +19343,9 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19342
19343
|
const rr = keepRows.filter((r) => r >= m.r1 && r <= m.r2);
|
|
19343
19344
|
const cc = keepCols.filter((c) => c >= m.c1 && c <= m.c2);
|
|
19344
19345
|
if (!rr.length || !cc.length) continue;
|
|
19345
|
-
let text = _nullishCoalesce(_optionalChain([rows, 'access',
|
|
19346
|
+
let text = _nullishCoalesce(_optionalChain([rows, 'access', _258 => _258.get, 'call', _259 => _259(m.r1), 'optionalAccess', _260 => _260[m.c1]]), () => ( ""));
|
|
19346
19347
|
for (let k = 0; !text && k < rr.length; k++) for (const c of cc) {
|
|
19347
|
-
text = _nullishCoalesce(_optionalChain([rows, 'access',
|
|
19348
|
+
text = _nullishCoalesce(_optionalChain([rows, 'access', _261 => _261.get, 'call', _262 => _262(rr[k]), 'optionalAccess', _263 => _263[c]]), () => ( ""));
|
|
19348
19349
|
if (text) break;
|
|
19349
19350
|
}
|
|
19350
19351
|
mergeMap.set(`${rowIdx.get(rr[0])},${colIdx.get(cc[0])}`, { colSpan: cc.length, rowSpan: rr.length, text });
|
|
@@ -19358,18 +19359,18 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19358
19359
|
const key = `${ri},${ci}`;
|
|
19359
19360
|
if (mergeSkip.has(key)) continue;
|
|
19360
19361
|
const merge = mergeMap.get(key);
|
|
19361
|
-
row.push({ text: merge ? merge.text : _nullishCoalesce(_optionalChain([cells, 'optionalAccess',
|
|
19362
|
+
row.push({ text: merge ? merge.text : _nullishCoalesce(_optionalChain([cells, 'optionalAccess', _264 => _264[keepCols[ci]]]), () => ( "")), colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _265 => _265.colSpan]), () => ( 1)), rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _266 => _266.rowSpan]), () => ( 1)) });
|
|
19362
19363
|
}
|
|
19363
19364
|
cellRows.push(row);
|
|
19364
19365
|
}
|
|
19365
|
-
const table2 =
|
|
19366
|
+
const table2 = _chunkW5NXOMCDcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap });
|
|
19366
19367
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19367
19368
|
return blocks;
|
|
19368
19369
|
}
|
|
19369
19370
|
|
|
19370
19371
|
// src/xlsx/parser.ts
|
|
19371
19372
|
var MAX_SHEETS = 100;
|
|
19372
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19373
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkRHMIEEAZcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19373
19374
|
var MAX_SHEET_ROWS = 1048576;
|
|
19374
19375
|
function cleanNumericValue(raw) {
|
|
19375
19376
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19398,15 +19399,15 @@ function getElements(parent, tagName) {
|
|
|
19398
19399
|
const result = [];
|
|
19399
19400
|
for (let i = 0; i < nodes.length; i++) result.push(nodes[i]);
|
|
19400
19401
|
if (result.length > 0) return result;
|
|
19401
|
-
const nsNodes = _optionalChain([parent, 'access',
|
|
19402
|
+
const nsNodes = _optionalChain([parent, 'access', _267 => _267.getElementsByTagNameNS, 'optionalCall', _268 => _268("*", tagName)]);
|
|
19402
19403
|
if (nsNodes) for (let i = 0; i < nsNodes.length; i++) result.push(nsNodes[i]);
|
|
19403
19404
|
return result;
|
|
19404
19405
|
}
|
|
19405
19406
|
function getTextContent(el) {
|
|
19406
|
-
return _nullishCoalesce(_optionalChain([el, 'access',
|
|
19407
|
+
return _nullishCoalesce(_optionalChain([el, 'access', _269 => _269.textContent, 'optionalAccess', _270 => _270.trim, 'call', _271 => _271()]), () => ( ""));
|
|
19407
19408
|
}
|
|
19408
19409
|
function parseXml(text) {
|
|
19409
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19410
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkRHMIEEAZcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19410
19411
|
}
|
|
19411
19412
|
function collectRichText(root) {
|
|
19412
19413
|
let out = "";
|
|
@@ -19415,9 +19416,9 @@ function collectRichText(root) {
|
|
|
19415
19416
|
for (let i = 0; i < children.length; i++) {
|
|
19416
19417
|
if (children[i].nodeType !== 1) continue;
|
|
19417
19418
|
const el = children[i];
|
|
19418
|
-
const local = el.localName || _optionalChain([el, 'access',
|
|
19419
|
+
const local = el.localName || _optionalChain([el, 'access', _272 => _272.tagName, 'optionalAccess', _273 => _273.replace, 'call', _274 => _274(/^[^:]+:/, "")]) || "";
|
|
19419
19420
|
if (local === "rPh") continue;
|
|
19420
|
-
if (local === "t") out +=
|
|
19421
|
+
if (local === "t") out += _chunkW5NXOMCDcjs.escapeLiteralTags.call(void 0, _chunkW5NXOMCDcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
19421
19422
|
else walk(el);
|
|
19422
19423
|
}
|
|
19423
19424
|
};
|
|
@@ -19570,7 +19571,7 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19570
19571
|
for (const cellEl of cells) {
|
|
19571
19572
|
const ref = cellEl.getAttribute("r");
|
|
19572
19573
|
const pos = ref !== null ? parseCellRef(ref) : { col: prevCol + 1, row: rowNum };
|
|
19573
|
-
if (!pos || !Number.isFinite(pos.row) || pos.row < 0 || pos.row >= MAX_SHEET_ROWS || pos.col >=
|
|
19574
|
+
if (!pos || !Number.isFinite(pos.row) || pos.row < 0 || pos.row >= MAX_SHEET_ROWS || pos.col >= _chunkW5NXOMCDcjs.MAX_COLS) continue;
|
|
19574
19575
|
prevCol = pos.col;
|
|
19575
19576
|
const type = cellEl.getAttribute("t");
|
|
19576
19577
|
const vElements = getElements(cellEl, "v");
|
|
@@ -19620,21 +19621,21 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19620
19621
|
if (m) {
|
|
19621
19622
|
merges.push({
|
|
19622
19623
|
r1: Math.min(m.startRow, MAX_SHEET_ROWS - 1),
|
|
19623
|
-
c1: Math.min(m.startCol,
|
|
19624
|
+
c1: Math.min(m.startCol, _chunkW5NXOMCDcjs.MAX_COLS - 1),
|
|
19624
19625
|
r2: Math.min(m.endRow, MAX_SHEET_ROWS - 1),
|
|
19625
|
-
c2: Math.min(m.endCol,
|
|
19626
|
+
c2: Math.min(m.endCol, _chunkW5NXOMCDcjs.MAX_COLS - 1)
|
|
19626
19627
|
});
|
|
19627
19628
|
}
|
|
19628
19629
|
}
|
|
19629
19630
|
return { rows, merges, maxCol };
|
|
19630
19631
|
}
|
|
19631
19632
|
async function parseXlsxDocument(buffer, options) {
|
|
19632
|
-
|
|
19633
|
+
_chunkRHMIEEAZcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19633
19634
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19634
19635
|
const warnings = [];
|
|
19635
19636
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19636
19637
|
if (!workbookFile) {
|
|
19637
|
-
throw new (0,
|
|
19638
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19638
19639
|
}
|
|
19639
19640
|
let sharedStrings = [];
|
|
19640
19641
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19643,7 +19644,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19643
19644
|
}
|
|
19644
19645
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
19645
19646
|
if (sheets.length === 0) {
|
|
19646
|
-
throw new (0,
|
|
19647
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19647
19648
|
}
|
|
19648
19649
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19649
19650
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19663,7 +19664,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19663
19664
|
relsMap = parseRels(await relsFile.async("text"));
|
|
19664
19665
|
}
|
|
19665
19666
|
let pageFilter = null;
|
|
19666
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
19667
|
+
if (_optionalChain([options, 'optionalAccess', _275 => _275.pages])) {
|
|
19667
19668
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-QHHFTL7X.cjs")));
|
|
19668
19669
|
pageFilter = parsePageRange2(options.pages, sheets.length);
|
|
19669
19670
|
}
|
|
@@ -19672,7 +19673,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19672
19673
|
for (let i = 0; i < processedSheets; i++) {
|
|
19673
19674
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
19674
19675
|
const sheet = sheets[i];
|
|
19675
|
-
_optionalChain([options, 'optionalAccess',
|
|
19676
|
+
_optionalChain([options, 'optionalAccess', _276 => _276.onProgress, 'optionalCall', _277 => _277(i + 1, processedSheets)]);
|
|
19676
19677
|
let sheetPath = relsMap.get(sheet.rId);
|
|
19677
19678
|
if (sheetPath) {
|
|
19678
19679
|
if (!sheetPath.startsWith("xl/") && !sheetPath.startsWith("/")) {
|
|
@@ -19695,7 +19696,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19695
19696
|
try {
|
|
19696
19697
|
const sheetXml = await sheetFile.async("text");
|
|
19697
19698
|
const { rows, merges, maxCol } = parseWorksheet(sheetXml, sharedStrings, dateXfs, date1904);
|
|
19698
|
-
const sheetBlocks = sheetToBlocks(sheet.name, rows, maxCol, merges, i, warnings, _optionalChain([options, 'optionalAccess',
|
|
19699
|
+
const sheetBlocks = sheetToBlocks(sheet.name, rows, maxCol, merges, i, warnings, _optionalChain([options, 'optionalAccess', _278 => _278.keepTrailingEmptyCols]));
|
|
19699
19700
|
blocks.push(...sheetBlocks);
|
|
19700
19701
|
} catch (err) {
|
|
19701
19702
|
warnings.push({
|
|
@@ -19727,7 +19728,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19727
19728
|
} catch (e35) {
|
|
19728
19729
|
}
|
|
19729
19730
|
}
|
|
19730
|
-
const markdown =
|
|
19731
|
+
const markdown = _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _279 => _279.tableFormat]) });
|
|
19731
19732
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19732
19733
|
}
|
|
19733
19734
|
|
|
@@ -20041,14 +20042,14 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20041
20042
|
const h = readCellHeader(rec.data);
|
|
20042
20043
|
if (h && rec.data.length >= 10) {
|
|
20043
20044
|
const isst = rec.data.readUInt32LE(6);
|
|
20044
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20045
|
+
cells.push({ row: h.row, col: h.col, value: _chunkW5NXOMCDcjs.escapeLiteralTags.call(void 0, _chunkW5NXOMCDcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(sst[isst], () => ( "")))) });
|
|
20045
20046
|
}
|
|
20046
20047
|
break;
|
|
20047
20048
|
}
|
|
20048
20049
|
case OP_LABEL: {
|
|
20049
20050
|
const h = readCellHeader(rec.data);
|
|
20050
20051
|
if (h) {
|
|
20051
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20052
|
+
cells.push({ row: h.row, col: h.col, value: _chunkW5NXOMCDcjs.escapeLiteralTags.call(void 0, _chunkW5NXOMCDcjs.escapeLiteralDollar.call(void 0, decodeLabelString(rec.data))) });
|
|
20052
20053
|
}
|
|
20053
20054
|
break;
|
|
20054
20055
|
}
|
|
@@ -20064,7 +20065,7 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20064
20065
|
cells.push({
|
|
20065
20066
|
row: h.row,
|
|
20066
20067
|
col: h.col,
|
|
20067
|
-
value:
|
|
20068
|
+
value: _chunkW5NXOMCDcjs.escapeLiteralTags.call(void 0, _chunkW5NXOMCDcjs.escapeLiteralDollar.call(void 0, decodeFormulaStringRecord(next.data)))
|
|
20068
20069
|
});
|
|
20069
20070
|
i = j;
|
|
20070
20071
|
} else {
|
|
@@ -20176,11 +20177,11 @@ function processGlobals(records) {
|
|
|
20176
20177
|
const xfFmtIds = [];
|
|
20177
20178
|
const firstBof = records[0];
|
|
20178
20179
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
20179
|
-
throw new (0,
|
|
20180
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
20180
20181
|
}
|
|
20181
20182
|
const bof = decodeBof(firstBof.data);
|
|
20182
20183
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
20183
|
-
throw new (0,
|
|
20184
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
20184
20185
|
}
|
|
20185
20186
|
let i = 1;
|
|
20186
20187
|
while (i < records.length) {
|
|
@@ -20246,14 +20247,14 @@ function rawSheetToBlocks(sheetName, sheet, sheetIndex, warnings, keepAnchoredEm
|
|
|
20246
20247
|
const rows = /* @__PURE__ */ new Map();
|
|
20247
20248
|
let maxCol = -1;
|
|
20248
20249
|
for (const c of sheet.cells) {
|
|
20249
|
-
if (c.col >=
|
|
20250
|
+
if (c.col >= _chunkW5NXOMCDcjs.MAX_COLS) continue;
|
|
20250
20251
|
let row = rows.get(c.row);
|
|
20251
20252
|
if (!row) rows.set(c.row, row = []);
|
|
20252
20253
|
while (row.length <= c.col) row.push("");
|
|
20253
20254
|
row[c.col] = cellValueToText(c.value);
|
|
20254
20255
|
if (c.col > maxCol) maxCol = c.col;
|
|
20255
20256
|
}
|
|
20256
|
-
const merges = sheet.merges.filter((m) => m.c1 <
|
|
20257
|
+
const merges = sheet.merges.filter((m) => m.c1 < _chunkW5NXOMCDcjs.MAX_COLS).map((m) => ({ r1: m.r1, c1: m.c1, r2: m.r2, c2: Math.min(m.c2, _chunkW5NXOMCDcjs.MAX_COLS - 1) }));
|
|
20257
20258
|
for (const m of merges) if (m.c2 > maxCol) maxCol = m.c2;
|
|
20258
20259
|
return sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols);
|
|
20259
20260
|
}
|
|
@@ -20263,28 +20264,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20263
20264
|
try {
|
|
20264
20265
|
cfb = parseLenientCfb(buf);
|
|
20265
20266
|
} catch (e) {
|
|
20266
|
-
throw new (0,
|
|
20267
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(
|
|
20267
20268
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20268
20269
|
);
|
|
20269
20270
|
}
|
|
20270
20271
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20271
20272
|
if (!wb) {
|
|
20272
|
-
throw new (0,
|
|
20273
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20273
20274
|
}
|
|
20274
20275
|
const records = readRecords2(wb);
|
|
20275
20276
|
if (records.length === 0) {
|
|
20276
|
-
throw new (0,
|
|
20277
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20277
20278
|
}
|
|
20278
20279
|
const firstBof = decodeBof(records[0].data);
|
|
20279
20280
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20280
|
-
throw new (0,
|
|
20281
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(
|
|
20281
20282
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20282
20283
|
);
|
|
20283
20284
|
}
|
|
20284
20285
|
const globals = processGlobals(records);
|
|
20285
20286
|
const warnings = [];
|
|
20286
20287
|
if (globals.encrypted) {
|
|
20287
|
-
throw new (0,
|
|
20288
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20288
20289
|
}
|
|
20289
20290
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20290
20291
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20296,7 +20297,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20296
20297
|
} : void 0;
|
|
20297
20298
|
const totalSheets = Math.min(globals.sheets.length, MAX_SHEETS2);
|
|
20298
20299
|
let pageFilter = null;
|
|
20299
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
20300
|
+
if (_optionalChain([options, 'optionalAccess', _280 => _280.pages])) {
|
|
20300
20301
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-QHHFTL7X.cjs")));
|
|
20301
20302
|
pageFilter = parsePageRange2(options.pages, totalSheets);
|
|
20302
20303
|
}
|
|
@@ -20305,7 +20306,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20305
20306
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
20306
20307
|
const meta = globals.sheets[i];
|
|
20307
20308
|
if (meta.dt !== 0) continue;
|
|
20308
|
-
_optionalChain([options, 'optionalAccess',
|
|
20309
|
+
_optionalChain([options, 'optionalAccess', _281 => _281.onProgress, 'optionalCall', _282 => _282(i + 1, totalSheets)]);
|
|
20309
20310
|
const bofIdx = findSheetBofIndex(records, meta.lbPlyPos);
|
|
20310
20311
|
if (bofIdx < 0) {
|
|
20311
20312
|
warnings.push({
|
|
@@ -20321,7 +20322,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20321
20322
|
}
|
|
20322
20323
|
try {
|
|
20323
20324
|
const { sheet } = extractSheetCells(records, bofIdx, globals.sst, convertNum);
|
|
20324
|
-
const blocks = rawSheetToBlocks(meta.name, sheet, i, warnings, _optionalChain([options, 'optionalAccess',
|
|
20325
|
+
const blocks = rawSheetToBlocks(meta.name, sheet, i, warnings, _optionalChain([options, 'optionalAccess', _283 => _283.keepTrailingEmptyCols]));
|
|
20325
20326
|
allBlocks.push(...blocks);
|
|
20326
20327
|
} catch (e) {
|
|
20327
20328
|
warnings.push({
|
|
@@ -20335,7 +20336,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20335
20336
|
pageCount: totalSheets
|
|
20336
20337
|
};
|
|
20337
20338
|
return {
|
|
20338
|
-
markdown:
|
|
20339
|
+
markdown: _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, allBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _284 => _284.tableFormat]) }),
|
|
20339
20340
|
blocks: allBlocks,
|
|
20340
20341
|
metadata,
|
|
20341
20342
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20367,20 +20368,20 @@ var ListCounter = (_class2 = class {constructor() { _class2.prototype.__init4.ca
|
|
|
20367
20368
|
/** numId·ilvl 문단 하나를 세고 라벨을 낸다 — 글머리표(bullet)는 null, 번호 없는 수준(none·빈 lvlText)은 "" */
|
|
20368
20369
|
next(numId, ilvl, levels) {
|
|
20369
20370
|
const lv = levels.get(ilvl);
|
|
20370
|
-
if (_optionalChain([lv, 'optionalAccess',
|
|
20371
|
-
const key = _nullishCoalesce(_optionalChain([[...levels.values()], 'access',
|
|
20371
|
+
if (_optionalChain([lv, 'optionalAccess', _285 => _285.numFmt]) === "bullet") return null;
|
|
20372
|
+
const key = _nullishCoalesce(_optionalChain([[...levels.values()], 'access', _286 => _286.find, 'call', _287 => _287((l) => l.list !== void 0), 'optionalAccess', _288 => _288.list]), () => ( numId));
|
|
20372
20373
|
const c = _nullishCoalesce(this.counts.get(key), () => ( []));
|
|
20373
20374
|
if (!this.used.has(numId)) {
|
|
20374
20375
|
this.used.add(numId);
|
|
20375
20376
|
for (const [k, l] of levels) if (l.restart) c[k] = void 0;
|
|
20376
20377
|
}
|
|
20377
|
-
c[ilvl] = (_nullishCoalesce(c[ilvl], () => ( (_nullishCoalesce(_optionalChain([lv, 'optionalAccess',
|
|
20378
|
+
c[ilvl] = (_nullishCoalesce(c[ilvl], () => ( (_nullishCoalesce(_optionalChain([lv, 'optionalAccess', _289 => _289.start]), () => ( 1))) - 1))) + 1;
|
|
20378
20379
|
for (let k = ilvl + 1; k < c.length; k++) c[k] = void 0;
|
|
20379
20380
|
this.counts.set(key, c);
|
|
20380
20381
|
if (!lv || lv.numFmt === "none") return "";
|
|
20381
20382
|
return lv.lvlText.replace(/%([1-9])/g, (_m, d) => {
|
|
20382
20383
|
const k = Number(d) - 1;
|
|
20383
|
-
return format(_nullishCoalesce(_nullishCoalesce(c[k], () => ( _optionalChain([levels, 'access',
|
|
20384
|
+
return format(_nullishCoalesce(_nullishCoalesce(c[k], () => ( _optionalChain([levels, 'access', _290 => _290.get, 'call', _291 => _291(k), 'optionalAccess', _292 => _292.start]))), () => ( 1)), _nullishCoalesce(_optionalChain([levels, 'access', _293 => _293.get, 'call', _294 => _294(k), 'optionalAccess', _295 => _295.numFmt]), () => ( "decimal")));
|
|
20384
20385
|
}).trim();
|
|
20385
20386
|
}
|
|
20386
20387
|
}, _class2);
|
|
@@ -20774,11 +20775,11 @@ function isDisplayMath(el) {
|
|
|
20774
20775
|
}
|
|
20775
20776
|
|
|
20776
20777
|
// src/docx/parser.ts
|
|
20777
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20778
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkRHMIEEAZcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20778
20779
|
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
20779
20780
|
var NEVER_READ_RE = /^word\/(?:embeddings\/.*|media\/.+\.(?:mp4|m4v|mov|avi|wmv|mpe?g|mkv|webm|mp3|wav|m4a|wma|aac|ogg|flac|mid|bin))$/i;
|
|
20780
20781
|
function matchesLocal(el, localName3) {
|
|
20781
|
-
return el.localName === localName3 || (_nullishCoalesce(_optionalChain([el, 'access',
|
|
20782
|
+
return el.localName === localName3 || (_nullishCoalesce(_optionalChain([el, 'access', _296 => _296.tagName, 'optionalAccess', _297 => _297.endsWith, 'call', _298 => _298(`:${localName3}`)]), () => ( false)));
|
|
20782
20783
|
}
|
|
20783
20784
|
function effectiveChildElements(parent) {
|
|
20784
20785
|
const result = [];
|
|
@@ -20813,7 +20814,7 @@ function findElements(parent, localName3) {
|
|
|
20813
20814
|
const child = children[i];
|
|
20814
20815
|
if (child.nodeType === 1) {
|
|
20815
20816
|
const el = child;
|
|
20816
|
-
if (el.localName === localName3 || _optionalChain([el, 'access',
|
|
20817
|
+
if (el.localName === localName3 || _optionalChain([el, 'access', _299 => _299.tagName, 'optionalAccess', _300 => _300.endsWith, 'call', _301 => _301(`:${localName3}`)])) {
|
|
20817
20818
|
result.push(el);
|
|
20818
20819
|
}
|
|
20819
20820
|
walk(el);
|
|
@@ -20832,7 +20833,7 @@ function getAttr(el, localName3) {
|
|
|
20832
20833
|
return null;
|
|
20833
20834
|
}
|
|
20834
20835
|
function parseXml2(text) {
|
|
20835
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
20836
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkRHMIEEAZcjs.stripDtd.call(void 0, text), "text/xml");
|
|
20836
20837
|
}
|
|
20837
20838
|
function parseStyles(xml) {
|
|
20838
20839
|
const doc = parseXml2(xml);
|
|
@@ -20884,10 +20885,10 @@ function parseStyles(xml) {
|
|
|
20884
20885
|
}
|
|
20885
20886
|
for (const [styleId, info] of styles) {
|
|
20886
20887
|
const seen = /* @__PURE__ */ new Set([styleId]);
|
|
20887
|
-
for (let cur = info.basedOn; info.numId === void 0 && cur && !seen.has(cur); cur = _optionalChain([styles, 'access',
|
|
20888
|
+
for (let cur = info.basedOn; info.numId === void 0 && cur && !seen.has(cur); cur = _optionalChain([styles, 'access', _302 => _302.get, 'call', _303 => _303(cur), 'optionalAccess', _304 => _304.basedOn])) {
|
|
20888
20889
|
seen.add(cur);
|
|
20889
20890
|
const parent = styles.get(cur);
|
|
20890
|
-
if (_optionalChain([parent, 'optionalAccess',
|
|
20891
|
+
if (_optionalChain([parent, 'optionalAccess', _305 => _305.numId]) !== void 0) {
|
|
20891
20892
|
info.numId = parent.numId;
|
|
20892
20893
|
info.ilvl ??= parent.ilvl;
|
|
20893
20894
|
}
|
|
@@ -20968,7 +20969,7 @@ function parseFootnotes(xml) {
|
|
|
20968
20969
|
const runs = findElements(p, "r");
|
|
20969
20970
|
for (const r of runs) {
|
|
20970
20971
|
const tElements = getChildElements(r, "t");
|
|
20971
|
-
for (const t of tElements) texts.push(
|
|
20972
|
+
for (const t of tElements) texts.push(_chunkW5NXOMCDcjs.escapeLiteralTags.call(void 0, _chunkW5NXOMCDcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(t.textContent, () => ( "")))));
|
|
20972
20973
|
}
|
|
20973
20974
|
}
|
|
20974
20975
|
notes.set(id, texts.join("").trim());
|
|
@@ -20984,7 +20985,7 @@ function collectOmmlRoots(p) {
|
|
|
20984
20985
|
const child = children[i];
|
|
20985
20986
|
if (child.nodeType !== 1) continue;
|
|
20986
20987
|
const el = child;
|
|
20987
|
-
const tag = el.localName || _optionalChain([el, 'access',
|
|
20988
|
+
const tag = el.localName || _optionalChain([el, 'access', _306 => _306.tagName, 'optionalAccess', _307 => _307.replace, 'call', _308 => _308(/^[^:]+:/, "")]) || "";
|
|
20988
20989
|
if (tag === "oMath" || tag === "oMathPara") {
|
|
20989
20990
|
out.push(el);
|
|
20990
20991
|
} else if (tag === "txbxContent" || tag === "Fallback") {
|
|
@@ -20999,7 +21000,7 @@ function collectOmmlRoots(p) {
|
|
|
20999
21000
|
function extractRun(r) {
|
|
21000
21001
|
let text = "";
|
|
21001
21002
|
for (const el of effectiveChildElements(r)) {
|
|
21002
|
-
if (matchesLocal(el, "t")) text +=
|
|
21003
|
+
if (matchesLocal(el, "t")) text += _chunkW5NXOMCDcjs.escapeLiteralTags.call(void 0, _chunkW5NXOMCDcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
21003
21004
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
21004
21005
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
21005
21006
|
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
@@ -21012,7 +21013,7 @@ function extractRun(r) {
|
|
|
21012
21013
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
21013
21014
|
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
21014
21015
|
const v = va ? getAttr(va, "val") : null;
|
|
21015
|
-
if (v === "superscript" || v === "subscript") text =
|
|
21016
|
+
if (v === "superscript" || v === "subscript") text = _chunkW5NXOMCDcjs.wrapScript.call(void 0, text, v === "superscript" ? "sup" : "sub");
|
|
21016
21017
|
}
|
|
21017
21018
|
return { text, bold, italic };
|
|
21018
21019
|
}
|
|
@@ -21030,7 +21031,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
21030
21031
|
function makeLink(text, rawHref) {
|
|
21031
21032
|
if (!text) return "";
|
|
21032
21033
|
if (!rawHref) return text;
|
|
21033
|
-
const href =
|
|
21034
|
+
const href = _chunkRHMIEEAZcjs.sanitizeHref.call(void 0, rawHref);
|
|
21034
21035
|
return href ? `[${text}](${href})` : text;
|
|
21035
21036
|
}
|
|
21036
21037
|
function collectInline(p, footnotes, rels) {
|
|
@@ -21121,7 +21122,7 @@ function collectInline(p, footnotes, rels) {
|
|
|
21121
21122
|
const m = mathText(om);
|
|
21122
21123
|
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
21123
21124
|
}
|
|
21124
|
-
const text =
|
|
21125
|
+
const text = _chunkW5NXOMCDcjs.tidyScriptTags.call(void 0, parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
21125
21126
|
return { text, bold, italic, footnoteText };
|
|
21126
21127
|
}
|
|
21127
21128
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -21148,14 +21149,14 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
21148
21149
|
}
|
|
21149
21150
|
const { text, bold: hasBold, italic: hasItalic, footnoteText } = collectInline(p, footnotes, rels);
|
|
21150
21151
|
const style = styles.get(styleId);
|
|
21151
|
-
if (!numId && _optionalChain([style, 'optionalAccess',
|
|
21152
|
+
if (!numId && _optionalChain([style, 'optionalAccess', _309 => _309.numId])) {
|
|
21152
21153
|
numId = style.numId;
|
|
21153
|
-
ilvl = _nullishCoalesce(_nullishCoalesce(style.ilvl, () => ( _optionalChain([[..._nullishCoalesce(_optionalChain([numbering, 'access',
|
|
21154
|
+
ilvl = _nullishCoalesce(_nullishCoalesce(style.ilvl, () => ( _optionalChain([[..._nullishCoalesce(_optionalChain([numbering, 'access', _310 => _310.get, 'call', _311 => _311(numId), 'optionalAccess', _312 => _312.values, 'call', _313 => _313()]), () => ( []))], 'access', _314 => _314.find, 'call', _315 => _315((l) => l.pStyle === styleId), 'optionalAccess', _316 => _316.level]))), () => ( ilvl));
|
|
21154
21155
|
}
|
|
21155
21156
|
const numDef = numId && numId !== "0" ? numbering.get(numId) : void 0;
|
|
21156
21157
|
const label = numDef ? counterOf(numbering).next(numId, ilvl, numDef) : void 0;
|
|
21157
21158
|
if (!text) return null;
|
|
21158
|
-
if (_optionalChain([style, 'optionalAccess',
|
|
21159
|
+
if (_optionalChain([style, 'optionalAccess', _317 => _317.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
|
|
21159
21160
|
return {
|
|
21160
21161
|
type: "heading",
|
|
21161
21162
|
text: label ? `${label} ${text}` : text,
|
|
@@ -21246,7 +21247,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21246
21247
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21247
21248
|
})
|
|
21248
21249
|
);
|
|
21249
|
-
const table2 =
|
|
21250
|
+
const table2 = _chunkW5NXOMCDcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21250
21251
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21251
21252
|
return { type: "table", table: table2 };
|
|
21252
21253
|
}
|
|
@@ -21256,10 +21257,10 @@ function collectCellText(tc2, styles, numbering, footnotes, rels, depth) {
|
|
|
21256
21257
|
for (const el of effectiveChildElements(tc2)) {
|
|
21257
21258
|
if (matchesLocal(el, "p")) {
|
|
21258
21259
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
21259
|
-
if (_optionalChain([block, 'optionalAccess',
|
|
21260
|
+
if (_optionalChain([block, 'optionalAccess', _318 => _318.text])) parts.push(block.text);
|
|
21260
21261
|
for (const tp of collectTextboxParagraphs(el)) {
|
|
21261
21262
|
const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
|
|
21262
|
-
if (_optionalChain([tb, 'optionalAccess',
|
|
21263
|
+
if (_optionalChain([tb, 'optionalAccess', _319 => _319.text])) parts.push(tb.text);
|
|
21263
21264
|
}
|
|
21264
21265
|
} else if (matchesLocal(el, "tbl")) {
|
|
21265
21266
|
for (const tr of getChildElements(el, "tr")) {
|
|
@@ -21295,7 +21296,7 @@ async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
|
21295
21296
|
let data = null;
|
|
21296
21297
|
if (readBytes) data = await imgFile.async("uint8array");
|
|
21297
21298
|
imgIdx++;
|
|
21298
|
-
const ext =
|
|
21299
|
+
const ext = _chunkRHMIEEAZcjs.partExtension.call(void 0, imgPath);
|
|
21299
21300
|
const mimeMap = {
|
|
21300
21301
|
png: "image/png",
|
|
21301
21302
|
jpg: "image/jpeg",
|
|
@@ -21393,13 +21394,13 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21393
21394
|
return out;
|
|
21394
21395
|
}
|
|
21395
21396
|
async function parseDocxDocument(buffer, options) {
|
|
21396
|
-
const readImages = _optionalChain([options, 'optionalAccess',
|
|
21397
|
-
|
|
21397
|
+
const readImages = _optionalChain([options, 'optionalAccess', _320 => _320.images]) !== false;
|
|
21398
|
+
_chunkRHMIEEAZcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5, void 0, { re: MEDIA_PART_RE, skip: !readImages, never: NEVER_READ_RE });
|
|
21398
21399
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21399
21400
|
const warnings = [];
|
|
21400
21401
|
const docFile = zip.file("word/document.xml");
|
|
21401
21402
|
if (!docFile) {
|
|
21402
|
-
throw new (0,
|
|
21403
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21403
21404
|
}
|
|
21404
21405
|
let rels = /* @__PURE__ */ new Map();
|
|
21405
21406
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21446,7 +21447,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21446
21447
|
const doc = parseXml2(docXml);
|
|
21447
21448
|
const body = findElements(doc, "body");
|
|
21448
21449
|
if (body.length === 0) {
|
|
21449
|
-
throw new (0,
|
|
21450
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21450
21451
|
}
|
|
21451
21452
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
21452
21453
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -21454,7 +21455,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21454
21455
|
const bodyEl = body[0];
|
|
21455
21456
|
const topLevel = effectiveChildElements(bodyEl);
|
|
21456
21457
|
for (const el of topLevel) {
|
|
21457
|
-
const localName3 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access',
|
|
21458
|
+
const localName3 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _321 => _321.tagName, 'optionalAccess', _322 => _322.split, 'call', _323 => _323(":"), 'access', _324 => _324.pop, 'call', _325 => _325()])));
|
|
21458
21459
|
if (localName3 === "p") {
|
|
21459
21460
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
21460
21461
|
if (block) blocks.push(block);
|
|
@@ -21465,7 +21466,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21465
21466
|
if (imageMap.size > 0) emitParagraphImages(tp, imageMap, linkedImages, blocks);
|
|
21466
21467
|
}
|
|
21467
21468
|
} else if (localName3 === "tbl") {
|
|
21468
|
-
const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess',
|
|
21469
|
+
const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess', _326 => _326.keepTrailingEmptyCols]));
|
|
21469
21470
|
if (block) blocks.push(block);
|
|
21470
21471
|
}
|
|
21471
21472
|
}
|
|
@@ -21499,7 +21500,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21499
21500
|
}
|
|
21500
21501
|
}
|
|
21501
21502
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21502
|
-
const markdown =
|
|
21503
|
+
const markdown = _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _327 => _327.tableFormat]) });
|
|
21503
21504
|
return {
|
|
21504
21505
|
markdown,
|
|
21505
21506
|
blocks,
|
|
@@ -21513,7 +21514,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21513
21514
|
// src/pptx/parser.ts
|
|
21514
21515
|
|
|
21515
21516
|
|
|
21516
|
-
var MAX_DECOMPRESS_SIZE6 =
|
|
21517
|
+
var MAX_DECOMPRESS_SIZE6 = _chunkRHMIEEAZcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
21517
21518
|
var MEDIA_PART_RE2 = /^ppt\/(?:media|embeddings)\//;
|
|
21518
21519
|
var NEVER_READ_RE2 = /^ppt\/(?:embeddings\/.*|media\/.+\.(?:mp4|m4v|mov|avi|wmv|mpe?g|mkv|webm|mp3|wav|m4a|wma|aac|ogg|flac|mid|bin))$/i;
|
|
21519
21520
|
var MAX_ZIP_ENTRIES2 = 1e4;
|
|
@@ -21536,7 +21537,7 @@ var IMAGE_MIME = {
|
|
|
21536
21537
|
svg: "image/svg+xml"
|
|
21537
21538
|
};
|
|
21538
21539
|
function parseXml3(text) {
|
|
21539
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21540
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkRHMIEEAZcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21540
21541
|
}
|
|
21541
21542
|
function getAttr2(el, name) {
|
|
21542
21543
|
const attrs = el.attributes;
|
|
@@ -21594,7 +21595,7 @@ async function slideParts(zip) {
|
|
|
21594
21595
|
const rels = await readRels(zip, "ppt/presentation.xml");
|
|
21595
21596
|
const list = findChildByLocalName(pres.documentElement, "sldIdLst");
|
|
21596
21597
|
for (const sld of list ? childrenByLocalName(list, "sldId") : []) {
|
|
21597
|
-
const target = _optionalChain([rels, 'access',
|
|
21598
|
+
const target = _optionalChain([rels, 'access', _328 => _328.get, 'call', _329 => _329(_nullishCoalesce(getRelId(sld), () => ( ""))), 'optionalAccess', _330 => _330.target]);
|
|
21598
21599
|
if (target && zip.file(target)) ordered.push(target);
|
|
21599
21600
|
}
|
|
21600
21601
|
}
|
|
@@ -21603,7 +21604,7 @@ async function slideParts(zip) {
|
|
|
21603
21604
|
names.sort((a, b) => Number(SLIDE_PART_RE.exec(a)[1]) - Number(SLIDE_PART_RE.exec(b)[1]));
|
|
21604
21605
|
ordered.push(...names);
|
|
21605
21606
|
}
|
|
21606
|
-
if (ordered.length > MAX_SLIDES) throw new (0,
|
|
21607
|
+
if (ordered.length > MAX_SLIDES) throw new (0, _chunkRHMIEEAZcjs.KordocError)(`PPTX \uC2AC\uB77C\uC774\uB4DC \uC218 \uCD08\uACFC: ${ordered.length} (\uCD5C\uB300 ${MAX_SLIDES})`);
|
|
21607
21608
|
return ordered;
|
|
21608
21609
|
}
|
|
21609
21610
|
function paragraphText(p) {
|
|
@@ -21614,12 +21615,12 @@ function paragraphText(p) {
|
|
|
21614
21615
|
const t = findChildByLocalName(child, "t");
|
|
21615
21616
|
const rPr = findChildByLocalName(child, "rPr");
|
|
21616
21617
|
const baseline = Number(rPr ? _nullishCoalesce(getAttr2(rPr, "baseline"), () => ( 0)) : 0);
|
|
21617
|
-
if (t) text +=
|
|
21618
|
+
if (t) text += _chunkW5NXOMCDcjs.wrapScript.call(void 0, _chunkW5NXOMCDcjs.escapeLiteralTags.call(void 0, _chunkW5NXOMCDcjs.escapeLiteralDollar.call(void 0, rawTextContent(t))), baseline > 0 ? "sup" : baseline < 0 ? "sub" : null);
|
|
21618
21619
|
} else if (name === "br") {
|
|
21619
21620
|
text += " ";
|
|
21620
21621
|
}
|
|
21621
21622
|
}
|
|
21622
|
-
return
|
|
21623
|
+
return _chunkW5NXOMCDcjs.tidyScriptTags.call(void 0, text.replace(/\s+/g, " ").trim());
|
|
21623
21624
|
}
|
|
21624
21625
|
function bodyParagraphs(txBody) {
|
|
21625
21626
|
const out = [];
|
|
@@ -21680,7 +21681,7 @@ function parseTable2(tbl2, page, keepEmptyCols) {
|
|
|
21680
21681
|
});
|
|
21681
21682
|
return cells;
|
|
21682
21683
|
});
|
|
21683
|
-
const table2 =
|
|
21684
|
+
const table2 = _chunkW5NXOMCDcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21684
21685
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21685
21686
|
return { type: "table", table: table2, pageNumber: page };
|
|
21686
21687
|
}
|
|
@@ -21693,10 +21694,10 @@ async function pictureBlock(pic, ctx) {
|
|
|
21693
21694
|
if (!filename) {
|
|
21694
21695
|
const file = ctx.zip.file(rel.target);
|
|
21695
21696
|
if (!file) return null;
|
|
21696
|
-
const ext =
|
|
21697
|
+
const ext = _chunkRHMIEEAZcjs.partExtension.call(void 0, rel.target);
|
|
21697
21698
|
filename = `image_${String(ctx.imageNames.size + 1).padStart(3, "0")}.${ext}`;
|
|
21698
21699
|
try {
|
|
21699
|
-
if (_optionalChain([ctx, 'access',
|
|
21700
|
+
if (_optionalChain([ctx, 'access', _331 => _331.options, 'optionalAccess', _332 => _332.images]) !== false) {
|
|
21700
21701
|
const data = await file.async("uint8array");
|
|
21701
21702
|
ctx.images.push({ filename, data, mimeType: _nullishCoalesce(_nullishCoalesce(IMAGE_MIME[ext], () => ( detectImageMime(data))), () => ( "application/octet-stream")), source: rel.target });
|
|
21702
21703
|
}
|
|
@@ -21741,7 +21742,7 @@ async function walkShapes(tree, ctx, out, depth = 0) {
|
|
|
21741
21742
|
const data = findPath(el, "graphic", "graphicData");
|
|
21742
21743
|
const tbl2 = data ? findChildByLocalName(data, "tbl") : null;
|
|
21743
21744
|
if (tbl2) {
|
|
21744
|
-
const block = parseTable2(tbl2, ctx.page, _optionalChain([ctx, 'access',
|
|
21745
|
+
const block = parseTable2(tbl2, ctx.page, _optionalChain([ctx, 'access', _333 => _333.options, 'optionalAccess', _334 => _334.keepTrailingEmptyCols]));
|
|
21745
21746
|
if (block) out.push(block);
|
|
21746
21747
|
} else if (data) {
|
|
21747
21748
|
const uri = _nullishCoalesce(getAttr2(data, "uri"), () => ( ""));
|
|
@@ -21771,17 +21772,17 @@ async function notesText(zip, rels) {
|
|
|
21771
21772
|
return texts.join(" ");
|
|
21772
21773
|
}
|
|
21773
21774
|
async function parsePptxDocument(buffer, options) {
|
|
21774
|
-
|
|
21775
|
+
_chunkRHMIEEAZcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE6, MAX_ZIP_ENTRIES2, { re: MEDIA_PART_RE2, skip: _optionalChain([options, 'optionalAccess', _335 => _335.images]) === false, never: NEVER_READ_RE2 });
|
|
21775
21776
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21776
21777
|
if (!zip.file("ppt/presentation.xml")) {
|
|
21777
|
-
throw new (0,
|
|
21778
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 PPTX \uD30C\uC77C: ppt/presentation.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21778
21779
|
}
|
|
21779
21780
|
const warnings = [];
|
|
21780
21781
|
const blocks = [];
|
|
21781
21782
|
const imageNames = /* @__PURE__ */ new Map();
|
|
21782
21783
|
const images = [];
|
|
21783
21784
|
const slides = await slideParts(zip);
|
|
21784
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
21785
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _336 => _336.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, slides.length) : null;
|
|
21785
21786
|
for (let i = 0; i < slides.length; i++) {
|
|
21786
21787
|
const page = i + 1;
|
|
21787
21788
|
if (pageFilter && !pageFilter.has(page)) continue;
|
|
@@ -21821,7 +21822,7 @@ async function parsePptxDocument(buffer, options) {
|
|
|
21821
21822
|
}
|
|
21822
21823
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")), pageNumber: b.pageNumber }));
|
|
21823
21824
|
return {
|
|
21824
|
-
markdown:
|
|
21825
|
+
markdown: _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _337 => _337.tableFormat]) }),
|
|
21825
21826
|
blocks,
|
|
21826
21827
|
metadata,
|
|
21827
21828
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -21837,11 +21838,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
21837
21838
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
21838
21839
|
function parseHwpmlDocument(buffer, options) {
|
|
21839
21840
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
21840
|
-
throw new (0,
|
|
21841
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
21841
21842
|
}
|
|
21842
21843
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
21843
21844
|
const normalized = text.replace(/ /g, " ");
|
|
21844
|
-
const xml =
|
|
21845
|
+
const xml = _chunkRHMIEEAZcjs.stripDtd.call(void 0, normalized);
|
|
21845
21846
|
const warnings = [];
|
|
21846
21847
|
const parser = new (0, _xmldom.DOMParser)({
|
|
21847
21848
|
onError: (_level, msg2) => {
|
|
@@ -21869,7 +21870,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
21869
21870
|
return { markdown: "", blocks: [], metadata, warnings };
|
|
21870
21871
|
}
|
|
21871
21872
|
const blocks = [];
|
|
21872
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
21873
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _338 => _338.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
|
|
21873
21874
|
let sectionIdx = 0;
|
|
21874
21875
|
const children = body.childNodes;
|
|
21875
21876
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -21878,10 +21879,10 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
21878
21879
|
if (localName(el) !== "SECTION") continue;
|
|
21879
21880
|
sectionIdx++;
|
|
21880
21881
|
if (pageFilter && !pageFilter.has(sectionIdx)) continue;
|
|
21881
|
-
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
21882
|
+
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _339 => _339.keepTrailingEmptyCols]), () => ( false)));
|
|
21882
21883
|
}
|
|
21883
21884
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
21884
|
-
const markdown =
|
|
21885
|
+
const markdown = _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _340 => _340.tableFormat]) });
|
|
21885
21886
|
return {
|
|
21886
21887
|
markdown,
|
|
21887
21888
|
blocks,
|
|
@@ -21967,7 +21968,7 @@ function parseParagraph3(el, blocks, paraShapeMap, sectionNum) {
|
|
|
21967
21968
|
const shapeInfo = paraShapeMap.get(paraShapeId);
|
|
21968
21969
|
const text = extractParagraphText(el);
|
|
21969
21970
|
if (!text) return;
|
|
21970
|
-
if (_optionalChain([shapeInfo, 'optionalAccess',
|
|
21971
|
+
if (_optionalChain([shapeInfo, 'optionalAccess', _341 => _341.headingLevel]) != null) {
|
|
21971
21972
|
blocks.push({ type: "heading", text, level: shapeInfo.headingLevel, pageNumber: sectionNum });
|
|
21972
21973
|
} else {
|
|
21973
21974
|
blocks.push({ type: "paragraph", text, pageNumber: sectionNum });
|
|
@@ -21988,7 +21989,7 @@ function collectCharText(node, parts, depth = 0) {
|
|
|
21988
21989
|
if (tag === "CHAR") {
|
|
21989
21990
|
for (const c of Array.from(el.childNodes)) {
|
|
21990
21991
|
const t = c.nodeType === 1 ? localName(c) === "TAB" ? " " : rawTextContent(c) : c.nodeType === 3 || c.nodeType === 4 ? _nullishCoalesce(c.nodeValue, () => ( "")) : "";
|
|
21991
|
-
if (t) parts.push(
|
|
21992
|
+
if (t) parts.push(_chunkW5NXOMCDcjs.escapeLiteralTags.call(void 0, t));
|
|
21992
21993
|
}
|
|
21993
21994
|
} else if (tag === "TABLE" || tag === "PICTURE" || tag === "SHAPEOBJECT") {
|
|
21994
21995
|
} else if (tag === "AUTONUM") {
|
|
@@ -22048,11 +22049,11 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
22048
22049
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
22049
22050
|
cellRows[r].push(cell2);
|
|
22050
22051
|
}
|
|
22051
|
-
const table2 =
|
|
22052
|
+
const table2 = _chunkW5NXOMCDcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
22052
22053
|
if (structured.length > 0) {
|
|
22053
22054
|
const claimed = /* @__PURE__ */ new Set();
|
|
22054
22055
|
for (const { ctx, cellBlocks } of structured) {
|
|
22055
|
-
let target = _optionalChain([table2, 'access',
|
|
22056
|
+
let target = _optionalChain([table2, 'access', _342 => _342.cells, 'access', _343 => _343[_nullishCoalesce(ctx.rowAddr, () => ( -1))], 'optionalAccess', _344 => _344[_nullishCoalesce(ctx.colAddr, () => ( -1))]]);
|
|
22056
22057
|
if (!target || claimed.has(target) || target.text !== ctx.text) {
|
|
22057
22058
|
target = void 0;
|
|
22058
22059
|
outer: for (const irRow of table2.cells) {
|
|
@@ -22357,7 +22358,7 @@ function fillInCellPatterns(cellText, values, matchedLabels, blockedLabels) {
|
|
|
22357
22358
|
(match, prefix, suffix) => {
|
|
22358
22359
|
const label = prefix + suffix;
|
|
22359
22360
|
const normalizedLabel = normalizeLabel(label);
|
|
22360
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
22361
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _345 => _345.has, 'call', _346 => _346(normalizedLabel)])) return match;
|
|
22361
22362
|
const matchKey = values.available(normalizedLabel) ? normalizedLabel : values.available(normalizeLabel(prefix)) ? normalizeLabel(prefix) : void 0;
|
|
22362
22363
|
if (matchKey === void 0) return match;
|
|
22363
22364
|
const newValue = values.consume(matchKey);
|
|
@@ -22436,17 +22437,17 @@ function matchInlineSegment(seg, values, blockedLabels) {
|
|
|
22436
22437
|
const nlabel = normalizeLabel(seg.label);
|
|
22437
22438
|
if (seg.extLabel !== void 0) {
|
|
22438
22439
|
const nExt = normalizeLabel(seg.extLabel);
|
|
22439
|
-
if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess',
|
|
22440
|
+
if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess', _347 => _347.has, 'call', _348 => _348(nExt)]) && values.has(nExt)) {
|
|
22440
22441
|
return { key: nExt, label: seg.extLabel, viaExt: true };
|
|
22441
22442
|
}
|
|
22442
22443
|
}
|
|
22443
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
22444
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _349 => _349.has, 'call', _350 => _350(nlabel)])) return void 0;
|
|
22444
22445
|
const key = findMatchingKey(nlabel, values);
|
|
22445
22446
|
return key !== void 0 ? { key, label: seg.label, viaExt: false } : void 0;
|
|
22446
22447
|
}
|
|
22447
22448
|
function clampSegmentEnd(text, seg, next, nextViaExt) {
|
|
22448
22449
|
let ve = seg.valueEnd;
|
|
22449
|
-
if (nextViaExt && _optionalChain([next, 'optionalAccess',
|
|
22450
|
+
if (nextViaExt && _optionalChain([next, 'optionalAccess', _351 => _351.extStart]) !== void 0 && next.extStart < ve) ve = next.extStart;
|
|
22450
22451
|
while (ve > seg.valueStart && /\s/.test(text[ve - 1])) ve--;
|
|
22451
22452
|
return ve;
|
|
22452
22453
|
}
|
|
@@ -22461,7 +22462,7 @@ function normalizeValues(values, warnings) {
|
|
|
22461
22462
|
const { value, format: format2 } = typeof raw === "object" && !Array.isArray(raw) ? raw : { value: raw, format: void 0 };
|
|
22462
22463
|
const key = normalizeLabel(label);
|
|
22463
22464
|
if (map.has(key)) {
|
|
22464
|
-
_optionalChain([warnings, 'optionalAccess',
|
|
22465
|
+
_optionalChain([warnings, 'optionalAccess', _352 => _352.push, 'call', _353 => _353(`\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`)]);
|
|
22465
22466
|
}
|
|
22466
22467
|
map.set(key, Array.isArray(value) ? value.map((v) => formatFillValue(v, format2)) : formatFillValue(value, format2));
|
|
22467
22468
|
}
|
|
@@ -22638,7 +22639,7 @@ function collectTables(blocks, out = [], depth = 0) {
|
|
|
22638
22639
|
if (block.type !== "table" || !block.table) continue;
|
|
22639
22640
|
out.push(block.table);
|
|
22640
22641
|
for (const row of block.table.cells) {
|
|
22641
|
-
for (const cell2 of row) if (_optionalChain([cell2, 'optionalAccess',
|
|
22642
|
+
for (const cell2 of row) if (_optionalChain([cell2, 'optionalAccess', _354 => _354.blocks, 'optionalAccess', _355 => _355.length])) collectTables(cell2.blocks, out, depth + 1);
|
|
22642
22643
|
}
|
|
22643
22644
|
}
|
|
22644
22645
|
return out;
|
|
@@ -22648,8 +22649,8 @@ function extractFromTable(table2) {
|
|
|
22648
22649
|
if (table2.cols >= 2) {
|
|
22649
22650
|
for (let r = 0; r < table2.rows; r++) {
|
|
22650
22651
|
for (let c = 0; c < table2.cols - 1; c++) {
|
|
22651
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
22652
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
22652
|
+
const labelCell = _optionalChain([table2, 'access', _356 => _356.cells, 'access', _357 => _357[r], 'optionalAccess', _358 => _358[c]]);
|
|
22653
|
+
const valueCell = _optionalChain([table2, 'access', _359 => _359.cells, 'access', _360 => _360[r], 'optionalAccess', _361 => _361[c + 1]]);
|
|
22653
22654
|
if (!labelCell || !valueCell) continue;
|
|
22654
22655
|
if (isLabelCell(labelCell.text)) {
|
|
22655
22656
|
fields.push({
|
|
@@ -22664,15 +22665,15 @@ function extractFromTable(table2) {
|
|
|
22664
22665
|
}
|
|
22665
22666
|
if (fields.length === 0 && table2.rows >= 2 && table2.cols >= 2) {
|
|
22666
22667
|
const headerRow = table2.cells[0];
|
|
22667
|
-
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess',
|
|
22668
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
22668
|
+
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _362 => _362.every, 'call', _363 => _363((cell2) => {
|
|
22669
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _364 => _364.text, 'access', _365 => _365.trim, 'call', _366 => _366()]), () => ( ""));
|
|
22669
22670
|
return t.length > 0 && t.length <= 20;
|
|
22670
22671
|
})]), () => ( false));
|
|
22671
22672
|
if (allLabels) {
|
|
22672
22673
|
for (let r = 1; r < table2.rows; r++) {
|
|
22673
22674
|
for (let c = 0; c < table2.cols; c++) {
|
|
22674
|
-
const label = _nullishCoalesce(_optionalChain([headerRow, 'access',
|
|
22675
|
-
const value = _nullishCoalesce(_optionalChain([table2, 'access',
|
|
22675
|
+
const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _367 => _367[c], 'optionalAccess', _368 => _368.text, 'access', _369 => _369.trim, 'call', _370 => _370()]), () => ( ""));
|
|
22676
|
+
const value = _nullishCoalesce(_optionalChain([table2, 'access', _371 => _371.cells, 'access', _372 => _372[r], 'optionalAccess', _373 => _373[c], 'optionalAccess', _374 => _374.text, 'access', _375 => _375.trim, 'call', _376 => _376()]), () => ( ""));
|
|
22676
22677
|
if (label && value) {
|
|
22677
22678
|
fields.push({ label, value, row: r, col: c });
|
|
22678
22679
|
}
|
|
@@ -22766,7 +22767,7 @@ function fillFormFields(blocks, values, blockedLabels) {
|
|
|
22766
22767
|
for (const table2 of allTables) {
|
|
22767
22768
|
for (let r = 0; r < table2.rows; r++) {
|
|
22768
22769
|
for (let c = 0; c < table2.cols; c++) {
|
|
22769
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
22770
|
+
const cell2 = _optionalChain([table2, 'access', _377 => _377.cells, 'access', _378 => _378[r], 'optionalAccess', _379 => _379[c]]);
|
|
22770
22771
|
if (!cell2) continue;
|
|
22771
22772
|
const result = fillInCellPatterns(cell2.text, cursor, matchedLabels, blockedLabels);
|
|
22772
22773
|
if (result) {
|
|
@@ -22798,7 +22799,7 @@ function collectIRTables(blocks, depth) {
|
|
|
22798
22799
|
out.push(block.table);
|
|
22799
22800
|
for (const row of block.table.cells) {
|
|
22800
22801
|
for (const cell2 of row) {
|
|
22801
|
-
if (_optionalChain([cell2, 'optionalAccess',
|
|
22802
|
+
if (_optionalChain([cell2, 'optionalAccess', _380 => _380.blocks, 'optionalAccess', _381 => _381.length])) out.push(...collectIRTables(cell2.blocks, depth + 1));
|
|
22802
22803
|
}
|
|
22803
22804
|
}
|
|
22804
22805
|
}
|
|
@@ -22809,7 +22810,7 @@ function coveredPositions(table2) {
|
|
|
22809
22810
|
for (let r = 0; r < table2.rows; r++) {
|
|
22810
22811
|
for (let c = 0; c < table2.cols; c++) {
|
|
22811
22812
|
if (covered.has(`${r},${c}`)) continue;
|
|
22812
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
22813
|
+
const cell2 = _optionalChain([table2, 'access', _382 => _382.cells, 'access', _383 => _383[r], 'optionalAccess', _384 => _384[c]]);
|
|
22813
22814
|
if (!cell2) continue;
|
|
22814
22815
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
22815
22816
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -22825,15 +22826,15 @@ function coveredPositions(table2) {
|
|
|
22825
22826
|
function isHeaderDataTable(table2, covered) {
|
|
22826
22827
|
if (table2.rows < 2) return false;
|
|
22827
22828
|
const headerRow = table2.cells[0];
|
|
22828
|
-
if (!_optionalChain([headerRow, 'optionalAccess',
|
|
22829
|
+
if (!_optionalChain([headerRow, 'optionalAccess', _385 => _385.length])) return false;
|
|
22829
22830
|
const allLabels = headerRow.every((cell2) => {
|
|
22830
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
22831
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _386 => _386.text, 'access', _387 => _387.trim, 'call', _388 => _388()]), () => ( ""));
|
|
22831
22832
|
return t.length > 0 && t.length <= 20 && isLabelCell(t);
|
|
22832
22833
|
});
|
|
22833
22834
|
if (!allLabels) return false;
|
|
22834
22835
|
for (let c = 0; c < table2.cols; c++) {
|
|
22835
22836
|
if (covered.has(`1,${c}`)) continue;
|
|
22836
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
22837
|
+
const cell2 = _optionalChain([table2, 'access', _389 => _389.cells, 'access', _390 => _390[1], 'optionalAccess', _391 => _391[c]]);
|
|
22837
22838
|
if (!cell2) break;
|
|
22838
22839
|
return !isLabelCell(cell2.text);
|
|
22839
22840
|
}
|
|
@@ -22846,7 +22847,7 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
22846
22847
|
for (let r = skipHeaderRow ? 1 : 0; r < table2.rows; r++) {
|
|
22847
22848
|
for (let c = 0; c < table2.cols; c++) {
|
|
22848
22849
|
if (covered.has(`${r},${c}`)) continue;
|
|
22849
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
22850
|
+
const labelCell = _optionalChain([table2, 'access', _392 => _392.cells, 'access', _393 => _393[r], 'optionalAccess', _394 => _394[c]]);
|
|
22850
22851
|
if (!labelCell) continue;
|
|
22851
22852
|
if (!isLabelCell(labelCell.text)) continue;
|
|
22852
22853
|
let vc = c + labelCell.colSpan;
|
|
@@ -22857,12 +22858,12 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
22857
22858
|
if (isKeywordLabel(valueCell.text)) continue;
|
|
22858
22859
|
const normalizedCellLabel = normalizeLabel(labelCell.text);
|
|
22859
22860
|
if (!normalizedCellLabel) continue;
|
|
22860
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
22861
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _395 => _395.has, 'call', _396 => _396(normalizedCellLabel)])) continue;
|
|
22861
22862
|
const matchKey = findMatchingKey(normalizedCellLabel, values);
|
|
22862
22863
|
if (matchKey === void 0) continue;
|
|
22863
22864
|
const newValue = values.consume(matchKey);
|
|
22864
22865
|
if (newValue === void 0) continue;
|
|
22865
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
22866
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _397 => _397.has, 'call', _398 => _398(valueCell)])) {
|
|
22866
22867
|
valueCell.text = newValue + " " + valueCell.text;
|
|
22867
22868
|
} else {
|
|
22868
22869
|
valueCell.text = newValue;
|
|
@@ -22879,8 +22880,8 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
22879
22880
|
}
|
|
22880
22881
|
if (table2.rows >= 2 && table2.cols >= 2) {
|
|
22881
22882
|
const headerRow = table2.cells[0];
|
|
22882
|
-
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess',
|
|
22883
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
22883
|
+
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _399 => _399.every, 'call', _400 => _400((cell2) => {
|
|
22884
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _401 => _401.text, 'access', _402 => _402.trim, 'call', _403 => _403()]), () => ( ""));
|
|
22884
22885
|
return t.length > 0 && t.length <= 20 && isLabelCell(t);
|
|
22885
22886
|
})]), () => ( false));
|
|
22886
22887
|
if (!allLabels) return;
|
|
@@ -22888,16 +22889,16 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
22888
22889
|
for (let c = 0; c < table2.cols; c++) {
|
|
22889
22890
|
if (covered.has(`${r},${c}`)) continue;
|
|
22890
22891
|
const headerCell = headerRow[c];
|
|
22891
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
22892
|
+
const valueCell = _optionalChain([table2, 'access', _404 => _404.cells, 'access', _405 => _405[r], 'optionalAccess', _406 => _406[c]]);
|
|
22892
22893
|
if (!headerCell || !valueCell) continue;
|
|
22893
22894
|
const headerLabel = normalizeLabel(headerCell.text);
|
|
22894
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
22895
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _407 => _407.has, 'call', _408 => _408(headerLabel)])) continue;
|
|
22895
22896
|
const matchKey = findMatchingKey(headerLabel, values);
|
|
22896
22897
|
if (matchKey === void 0) continue;
|
|
22897
22898
|
if (!values.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
22898
22899
|
const newValue = values.consume(matchKey);
|
|
22899
22900
|
if (newValue === void 0) continue;
|
|
22900
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
22901
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _409 => _409.has, 'call', _410 => _410(valueCell)])) {
|
|
22901
22902
|
valueCell.text = newValue + " " + valueCell.text;
|
|
22902
22903
|
} else {
|
|
22903
22904
|
valueCell.text = newValue;
|
|
@@ -22929,7 +22930,7 @@ function fillInlineFields(text, values, filled, matchedLabels, blockedLabels) {
|
|
|
22929
22930
|
if (newValue === void 0) continue;
|
|
22930
22931
|
matchedLabels.add(matchKey);
|
|
22931
22932
|
filled.push({ label: matched.label.trim(), value: newValue, row: -1, col: -1, key: matchKey });
|
|
22932
|
-
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access',
|
|
22933
|
+
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _411 => _411[i + 1], 'optionalAccess', _412 => _412.viaExt]), () => ( false)));
|
|
22933
22934
|
out += text.slice(pos, seg.valueStart);
|
|
22934
22935
|
out += seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
|
|
22935
22936
|
pos = ve;
|
|
@@ -23559,7 +23560,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
23559
23560
|
const splices = [];
|
|
23560
23561
|
for (const region of scanClickHereRegions(xml)) {
|
|
23561
23562
|
const key = normalizeLabel(region.name);
|
|
23562
|
-
if (!key || _optionalChain([blockedLabels, 'optionalAccess',
|
|
23563
|
+
if (!key || _optionalChain([blockedLabels, 'optionalAccess', _413 => _413.has, 'call', _414 => _414(key)])) continue;
|
|
23563
23564
|
if (!cursor.has(key)) continue;
|
|
23564
23565
|
const value = cursor.consume(key);
|
|
23565
23566
|
if (value === void 0) continue;
|
|
@@ -23584,7 +23585,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
23584
23585
|
};
|
|
23585
23586
|
}
|
|
23586
23587
|
async function extractClickHereFields(hwpxBuffer) {
|
|
23587
|
-
|
|
23588
|
+
_chunkRHMIEEAZcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
23588
23589
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
23589
23590
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
23590
23591
|
const fields = [];
|
|
@@ -23632,19 +23633,19 @@ function parseCentralDirectory(buf) {
|
|
|
23632
23633
|
}
|
|
23633
23634
|
}
|
|
23634
23635
|
}
|
|
23635
|
-
if (eocdOffset < 0) throw new (0,
|
|
23636
|
+
if (eocdOffset < 0) throw new (0, _chunkRHMIEEAZcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
23636
23637
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
23637
23638
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
23638
23639
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
23639
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
23640
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkRHMIEEAZcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23640
23641
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
23641
|
-
throw new (0,
|
|
23642
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23642
23643
|
}
|
|
23643
23644
|
const decoder = new TextDecoder("utf-8");
|
|
23644
23645
|
const entries = [];
|
|
23645
23646
|
let pos = cdOffset;
|
|
23646
23647
|
for (let i = 0; i < totalEntries; i++) {
|
|
23647
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
23648
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkRHMIEEAZcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
23648
23649
|
const flags = view.getUint16(pos + 8, true);
|
|
23649
23650
|
const method = view.getUint16(pos + 10, true);
|
|
23650
23651
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -23655,7 +23656,7 @@ function parseCentralDirectory(buf) {
|
|
|
23655
23656
|
const commentLen = view.getUint16(pos + 32, true);
|
|
23656
23657
|
const localOffset = view.getUint32(pos + 42, true);
|
|
23657
23658
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
23658
|
-
throw new (0,
|
|
23659
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23659
23660
|
}
|
|
23660
23661
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
23661
23662
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -23684,11 +23685,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23684
23685
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
23685
23686
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
23686
23687
|
for (const name of replacements.keys()) {
|
|
23687
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
23688
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkRHMIEEAZcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
23688
23689
|
}
|
|
23689
23690
|
if (additions) {
|
|
23690
23691
|
for (const name of additions.keys()) {
|
|
23691
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
23692
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkRHMIEEAZcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
23692
23693
|
}
|
|
23693
23694
|
}
|
|
23694
23695
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -23707,7 +23708,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23707
23708
|
offset += seg.length;
|
|
23708
23709
|
continue;
|
|
23709
23710
|
}
|
|
23710
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
23711
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkRHMIEEAZcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
23711
23712
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
23712
23713
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
23713
23714
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -23715,7 +23716,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23715
23716
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
23716
23717
|
const method = e.method;
|
|
23717
23718
|
if (method !== 0 && method !== 8) {
|
|
23718
|
-
throw new (0,
|
|
23719
|
+
throw new (0, _chunkRHMIEEAZcjs.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`);
|
|
23719
23720
|
}
|
|
23720
23721
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
23721
23722
|
const crc = crc32(newData);
|
|
@@ -23813,11 +23814,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23813
23814
|
// src/form/filler-hwpx.ts
|
|
23814
23815
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
23815
23816
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
23816
|
-
|
|
23817
|
+
_chunkRHMIEEAZcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
23817
23818
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
23818
23819
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
23819
23820
|
if (sectionPaths.length === 0) {
|
|
23820
|
-
throw new (0,
|
|
23821
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
23821
23822
|
}
|
|
23822
23823
|
const warnings = [];
|
|
23823
23824
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -23916,7 +23917,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
23916
23917
|
if (isKeywordLabel(cellLabelText(valueCell))) continue;
|
|
23917
23918
|
const normalizedCellLabel = normalizeLabel(labelText);
|
|
23918
23919
|
if (!normalizedCellLabel) continue;
|
|
23919
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
23920
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _415 => _415.has, 'call', _416 => _416(normalizedCellLabel)])) continue;
|
|
23920
23921
|
const matchKey = findMatchingKey(normalizedCellLabel, cursor);
|
|
23921
23922
|
if (matchKey === void 0) continue;
|
|
23922
23923
|
if (patternApplied.has(valueCell)) {
|
|
@@ -23974,7 +23975,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
23974
23975
|
const dataCells = table2.rows[rowIdx];
|
|
23975
23976
|
for (let colIdx = 0; colIdx < Math.min(headerCells.length, dataCells.length); colIdx++) {
|
|
23976
23977
|
const headerLabel = normalizeLabel(cellLabelText(headerCells[colIdx]));
|
|
23977
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
23978
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _417 => _417.has, 'call', _418 => _418(headerLabel)])) continue;
|
|
23978
23979
|
const matchKey = findMatchingKey(headerLabel, cursor);
|
|
23979
23980
|
if (matchKey === void 0) continue;
|
|
23980
23981
|
if (!cursor.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
@@ -24028,7 +24029,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
24028
24029
|
}
|
|
24029
24030
|
for (const para2 of [...scan.bodyParagraphs, ...scan.excludedParagraphs]) {
|
|
24030
24031
|
const existing = ledger.get(para2);
|
|
24031
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
24032
|
+
if (_optionalChain([existing, 'optionalAccess', _419 => _419.fullText]) !== void 0) continue;
|
|
24032
24033
|
const text = matchText(para2);
|
|
24033
24034
|
const segments = scanInlineSegments(text);
|
|
24034
24035
|
const matches = segments.map((seg) => matchInlineSegment(seg, cursor, blockedLabels));
|
|
@@ -24039,7 +24040,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
24039
24040
|
const matchKey = matched.key;
|
|
24040
24041
|
const newValue = cursor.consume(matchKey);
|
|
24041
24042
|
if (newValue === void 0) continue;
|
|
24042
|
-
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access',
|
|
24043
|
+
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _420 => _420[i + 1], 'optionalAccess', _421 => _421.viaExt]), () => ( false)));
|
|
24043
24044
|
const replacement = seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
|
|
24044
24045
|
const l = led(para2);
|
|
24045
24046
|
l.ranges.push({ start: seg.valueStart, end: ve, replacement });
|
|
@@ -24117,7 +24118,7 @@ var DIAGRAM_KEYWORDS = /조직도|비상\s*연락망|연락망|체계도|업무\
|
|
|
24117
24118
|
var KEYWORD_GATE = 0.3;
|
|
24118
24119
|
function cellType(cell2) {
|
|
24119
24120
|
const t = cell2.text.trim();
|
|
24120
|
-
if (!t && !_optionalChain([cell2, 'access',
|
|
24121
|
+
if (!t && !_optionalChain([cell2, 'access', _422 => _422.blocks, 'optionalAccess', _423 => _423.length])) return "empty";
|
|
24121
24122
|
if (!t) return "short";
|
|
24122
24123
|
if (/^[-+]?[\d,]+(\.\d+)?\s*(%|원|명|건|개|천원|백만원|㎡|㎢|kg|km|시간|일)?$/u.test(t)) return "number";
|
|
24123
24124
|
if (/^\d{2,4}[.\-/년]\s*\d{1,2}[.\-/월]?(\s*\d{1,2}[.일]?)?\.?$/u.test(t)) return "date";
|
|
@@ -24129,7 +24130,7 @@ function anchors(table2) {
|
|
|
24129
24130
|
for (let r = 0; r < table2.rows; r++) {
|
|
24130
24131
|
for (let c = 0; c < table2.cols; c++) {
|
|
24131
24132
|
if (covered.has(`${r},${c}`)) continue;
|
|
24132
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
24133
|
+
const cell2 = _optionalChain([table2, 'access', _424 => _424.cells, 'access', _425 => _425[r], 'optionalAccess', _426 => _426[c]]);
|
|
24133
24134
|
if (!cell2) continue;
|
|
24134
24135
|
for (let dr = 0; dr < cell2.rowSpan; dr++) for (let dc = 0; dc < cell2.colSpan; dc++) if (dr || dc) covered.add(`${r + dr},${c + dc}`);
|
|
24135
24136
|
out.push({ r, c, cell: cell2, type: cellType(cell2) });
|
|
@@ -24139,8 +24140,8 @@ function anchors(table2) {
|
|
|
24139
24140
|
}
|
|
24140
24141
|
function isWrapper(table2) {
|
|
24141
24142
|
if (table2.rows !== 1 || table2.cols !== 1) return false;
|
|
24142
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
24143
|
-
return !!_optionalChain([cell2, 'optionalAccess',
|
|
24143
|
+
const cell2 = _optionalChain([table2, 'access', _427 => _427.cells, 'access', _428 => _428[0], 'optionalAccess', _429 => _429[0]]);
|
|
24144
|
+
return !!_optionalChain([cell2, 'optionalAccess', _430 => _430.blocks, 'optionalAccess', _431 => _431.some, 'call', _432 => _432((b) => b.type === "table" && b.table)]);
|
|
24144
24145
|
}
|
|
24145
24146
|
function round2(v) {
|
|
24146
24147
|
return Math.round(v * 100) / 100;
|
|
@@ -24206,7 +24207,7 @@ function classifyTable(table2, ctx = {}) {
|
|
|
24206
24207
|
const emptyShare = 1 - activeRatio;
|
|
24207
24208
|
let semantic = (0.35 * repeatedRowSchema + 0.25 * gridRegularity + 0.2 * Math.min(1, activeRatio / 0.7) + 0.2 * columnTypeConsistency) * (1 - 0.6 * Math.max(0, emptyShare - 0.2) / 0.8) * (1 - spacerBands) * (1 - 0.5 * spanIrregularity);
|
|
24208
24209
|
let nonTabular = 0.6 * spanIrregularity + 0.4 * spacerBands + 0.5 * sparsity;
|
|
24209
|
-
const nestedCells = A.filter((a) => _optionalChain([a, 'access',
|
|
24210
|
+
const nestedCells = A.filter((a) => _optionalChain([a, 'access', _433 => _433.cell, 'access', _434 => _434.blocks, 'optionalAccess', _435 => _435.some, 'call', _436 => _436((b) => b.type === "table" && b.table)])).length;
|
|
24210
24211
|
if (nestedCells && nestedCells >= A.length * 0.5) {
|
|
24211
24212
|
nonTabular += 0.25;
|
|
24212
24213
|
reasons.push("nested-structure-wrapper");
|
|
@@ -24267,8 +24268,8 @@ function classifyTableTree(blocks) {
|
|
|
24267
24268
|
return blocks;
|
|
24268
24269
|
}
|
|
24269
24270
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
24270
|
-
const structured = hasMerged(table2) ||
|
|
24271
|
-
if (opts.smartVisual && _optionalChain([table2, 'access',
|
|
24271
|
+
const structured = hasMerged(table2) || _chunkW5NXOMCDcjs.hasStructuredCellContent.call(void 0, table2);
|
|
24272
|
+
if (opts.smartVisual && _optionalChain([table2, 'access', _437 => _437.classification, 'optionalAccess', _438 => _438.kind]) === "non-tabular-layout") return "visual";
|
|
24272
24273
|
return structured ? "html" : "gfm";
|
|
24273
24274
|
}
|
|
24274
24275
|
|
|
@@ -25730,7 +25731,7 @@ function fixedPitchWidthEm1000(cp) {
|
|
|
25730
25731
|
function widthFnOf(faceClass) {
|
|
25731
25732
|
if (faceClass === "fixedPitch") return fixedPitchWidthEm1000;
|
|
25732
25733
|
if (faceClass === "gothic") return gothicWidthEm1000;
|
|
25733
|
-
if (_optionalChain([faceClass, 'optionalAccess',
|
|
25734
|
+
if (_optionalChain([faceClass, 'optionalAccess', _439 => _439.startsWith, 'call', _440 => _440("font:")])) {
|
|
25734
25735
|
const face = faceClass.slice(5);
|
|
25735
25736
|
return _nullishCoalesce(fontWidthFn(face), () => ( gothicWidthEm1000));
|
|
25736
25737
|
}
|
|
@@ -25740,9 +25741,9 @@ function isSpaceCp(cp) {
|
|
|
25740
25741
|
return cp === 32 || cp === 160;
|
|
25741
25742
|
}
|
|
25742
25743
|
function measureTextWidth(text, height, ratioPct, opts) {
|
|
25743
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
25744
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
25745
|
-
const widthEm = widthFnOf(_optionalChain([opts, 'optionalAccess',
|
|
25744
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _441 => _441.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
25745
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _442 => _442.spacingPct]), () => ( 0));
|
|
25746
|
+
const widthEm = widthFnOf(_optionalChain([opts, 'optionalAccess', _443 => _443.faceClass]));
|
|
25746
25747
|
let em = 0;
|
|
25747
25748
|
for (const ch of text) {
|
|
25748
25749
|
const cp = ch.codePointAt(0);
|
|
@@ -25754,7 +25755,7 @@ function measureTextWidth(text, height, ratioPct, opts) {
|
|
|
25754
25755
|
var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u2103\u3009\u300B\u300D\u300F\u3011\u3015!%),.:;?]}\u20A9~\u2026\xB7\u3001\u3002\u3003"]);
|
|
25755
25756
|
var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
|
|
25756
25757
|
function prepareWrap(text, mode, opts) {
|
|
25757
|
-
const widthEm = widthFnOf(_optionalChain([opts, 'optionalAccess',
|
|
25758
|
+
const widthEm = widthFnOf(_optionalChain([opts, 'optionalAccess', _444 => _444.faceClass])), spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _445 => _445.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
25758
25759
|
const advances = [], steps = [];
|
|
25759
25760
|
let i = 0;
|
|
25760
25761
|
for (const ch of text) {
|
|
@@ -25770,12 +25771,12 @@ function splitWrapUnits(text, mode) {
|
|
|
25770
25771
|
}
|
|
25771
25772
|
function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
|
|
25772
25773
|
const EPS = 0.5;
|
|
25773
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
25774
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
25775
|
-
const prepared = _optionalChain([opts, 'optionalAccess',
|
|
25776
|
-
const widthEm = prepared ? null : widthFnOf(_optionalChain([opts, 'optionalAccess',
|
|
25774
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _446 => _446.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
25775
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _447 => _447.spacingPct]), () => ( 0));
|
|
25776
|
+
const prepared = _optionalChain([opts, 'optionalAccess', _448 => _448.prepared]);
|
|
25777
|
+
const widthEm = prepared ? null : widthFnOf(_optionalChain([opts, 'optionalAccess', _449 => _449.faceClass]));
|
|
25777
25778
|
const k = height * ratioPct / 100 / 1e3;
|
|
25778
|
-
const unitW = _optionalChain([opts, 'optionalAccess',
|
|
25779
|
+
const unitW = _optionalChain([opts, 'optionalAccess', _450 => _450.widths]);
|
|
25779
25780
|
const charWAt = (i, ch) => {
|
|
25780
25781
|
if (unitW) return (_nullishCoalesce(unitW[i], () => ( 0))) + (ch.length === 2 ? _nullishCoalesce(unitW[i + 1], () => ( 0)) : 0);
|
|
25781
25782
|
if (prepared) return prepared.advances[i] * (1 + spacing / 100) * k;
|
|
@@ -25795,7 +25796,7 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
25795
25796
|
}
|
|
25796
25797
|
return w;
|
|
25797
25798
|
};
|
|
25798
|
-
const units = _nullishCoalesce(_optionalChain([prepared, 'optionalAccess',
|
|
25799
|
+
const units = _nullishCoalesce(_optionalChain([prepared, 'optionalAccess', _451 => _451.units]), () => ( splitWrapUnits(text, mode)));
|
|
25799
25800
|
const starts = [0];
|
|
25800
25801
|
let lineW = 0;
|
|
25801
25802
|
let avail = firstWidth;
|
|
@@ -26024,16 +26025,16 @@ var PARA_LIST = 7;
|
|
|
26024
26025
|
var DEFAULT_TEXT_COLOR = "#000000";
|
|
26025
26026
|
function resolveTheme(theme) {
|
|
26026
26027
|
return {
|
|
26027
|
-
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
26028
|
-
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
26029
|
-
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
26030
|
-
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
26031
|
-
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
26032
|
-
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
26028
|
+
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _452 => _452.headingColors, 'optionalAccess', _453 => _453[1]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
26029
|
+
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _454 => _454.headingColors, 'optionalAccess', _455 => _455[2]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
26030
|
+
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _456 => _456.headingColors, 'optionalAccess', _457 => _457[3]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
26031
|
+
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _458 => _458.headingColors, 'optionalAccess', _459 => _459[4]]), () => ( _optionalChain([theme, 'optionalAccess', _460 => _460.headingColors, 'optionalAccess', _461 => _461[3]]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
26032
|
+
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _462 => _462.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
26033
|
+
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _463 => _463.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
26033
26034
|
/** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
|
|
26034
|
-
hasQuoteOption: _optionalChain([theme, 'optionalAccess',
|
|
26035
|
-
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
26036
|
-
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess',
|
|
26035
|
+
hasQuoteOption: _optionalChain([theme, 'optionalAccess', _464 => _464.quoteColor]) !== void 0,
|
|
26036
|
+
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _465 => _465.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _466 => _466.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
26037
|
+
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _467 => _467.tableHeaderBold])
|
|
26037
26038
|
};
|
|
26038
26039
|
}
|
|
26039
26040
|
function escapeXml(text) {
|
|
@@ -26471,7 +26472,7 @@ function buildDocFootTable(f, ctx, internal) {
|
|
|
26471
26472
|
const titleW = (t) => Math.max(unitW[0], Math.round(measureTextWidth(t, 1e3, 100, { faceClass: "fixedPitch" })) + 280 + unit + 300);
|
|
26472
26473
|
const widths = [];
|
|
26473
26474
|
for (let i = 0; i < n; i++) {
|
|
26474
|
-
widths.push(titleW(_nullishCoalesce(_optionalChain([f, 'access',
|
|
26475
|
+
widths.push(titleW(_nullishCoalesce(_optionalChain([f, 'access', _468 => _468.approvers, 'access', _469 => _469[i], 'optionalAccess', _470 => _470.title]), () => ( ""))), unitW[1]);
|
|
26475
26476
|
if (i < n - 1) widths.push(unitW[2]);
|
|
26476
26477
|
}
|
|
26477
26478
|
const used = widths.reduce((a, b) => a + b, 0);
|
|
@@ -26637,8 +26638,8 @@ function buildSummaryBox(text, ctx) {
|
|
|
26637
26638
|
let lines = 0;
|
|
26638
26639
|
const paras = bodies.map((b) => {
|
|
26639
26640
|
const f = fitParagraph(b, frame.summaryFont, frame.summaryPt, avail, avail);
|
|
26640
|
-
const c = reg.char({ font: frame.summaryFont, pt: frame.summaryPt, bold: true, ratio: _nullishCoalesce(_optionalChain([f, 'optionalAccess',
|
|
26641
|
-
lines += simulateWrap(b, avail * 0.995, avail * 0.995, frame.summaryPt * 100, _nullishCoalesce(_optionalChain([f, 'optionalAccess',
|
|
26641
|
+
const c = reg.char({ font: frame.summaryFont, pt: frame.summaryPt, bold: true, ratio: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _471 => _471.ratio]), () => ( 100)), spacing: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _472 => _472.spacing]), () => ( 0)) });
|
|
26642
|
+
lines += simulateWrap(b, avail * 0.995, avail * 0.995, frame.summaryPt * 100, _nullishCoalesce(_optionalChain([f, 'optionalAccess', _473 => _473.ratio]), () => ( 100)), "keep", { faceClass: faceClassForGen(frame.summaryFont), spacingPct: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _474 => _474.spacing]), () => ( 0)) }).lines;
|
|
26642
26643
|
return para(b, p, c);
|
|
26643
26644
|
});
|
|
26644
26645
|
const h = lines * Math.round(frame.summaryPt * 100 * 1.6) + 280 + 600;
|
|
@@ -26661,20 +26662,20 @@ function buildApprovalSeoul(labels, names, ctx) {
|
|
|
26661
26662
|
r: col === n - 1 ? "thick" : "thin"
|
|
26662
26663
|
});
|
|
26663
26664
|
const top = labels.map((l, c) => tc({ bf: edge(0, c), row: 0, col: c, w: colW, h: 1765, paras: para(l, center, c12) })).join("");
|
|
26664
|
-
const sign = labels.map((_, c) => tc({ bf: edge(1, c), row: 1, col: c, w: colW, h: 4200, paras: para(_nullishCoalesce(_optionalChain([names, 'optionalAccess',
|
|
26665
|
+
const sign = labels.map((_, c) => tc({ bf: edge(1, c), row: 1, col: c, w: colW, h: 4200, paras: para(_nullishCoalesce(_optionalChain([names, 'optionalAccess', _475 => _475[c]]), () => ( "")), center, c12b) })).join("");
|
|
26665
26666
|
return host(ftbl([top, sign], w, 5965, n, { bottomGap: 600 }), reg.para({ align: "RIGHT", lineSp: 100 }), c12);
|
|
26666
26667
|
}
|
|
26667
26668
|
function buildReportCover(inp, ctx) {
|
|
26668
26669
|
const { reg, bf, frame } = ctx;
|
|
26669
26670
|
const out = [];
|
|
26670
26671
|
const cv = frame.cover;
|
|
26671
|
-
const c12 = reg.char({ font: _nullishCoalesce(_optionalChain([cv, 'optionalAccess',
|
|
26672
|
-
const c12b = reg.char({ font: _nullishCoalesce(_optionalChain([cv, 'optionalAccess',
|
|
26672
|
+
const c12 = reg.char({ font: _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _476 => _476.infoFont]), () => ( "\uD55C\uCEF4\uB3CB\uC6C0")), pt: _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _477 => _477.infoValuePt]), () => ( 12)) });
|
|
26673
|
+
const c12b = reg.char({ font: _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _478 => _478.infoFont]), () => ( "\uD55C\uCEF4\uB3CB\uC6C0")), pt: _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _479 => _479.infoLabelPt]), () => ( 12)), bold: true });
|
|
26673
26674
|
const cAppr = cv ? reg.char({ font: cv.infoFont, pt: cv.approvalPt }) : c12;
|
|
26674
26675
|
const center = reg.para({ align: "CENTER", lineSp: 100 });
|
|
26675
26676
|
const centerAt = (k) => cv ? reg.para({ align: "CENTER", lineSp: cv.lineSp[k] }) : center;
|
|
26676
26677
|
const blank2 = (pt3 = 15) => para("", reg.para({ align: "LEFT", lineSp: 160 }), reg.char({ font: "\uD55C\uCEF4\uB3CB\uC6C0", pt: pt3 }));
|
|
26677
|
-
const infoRows = [["\uBB38\uC11C\uBC88\uD638", _nullishCoalesce(_optionalChain([inp, 'access',
|
|
26678
|
+
const infoRows = [["\uBB38\uC11C\uBC88\uD638", _nullishCoalesce(_optionalChain([inp, 'access', _480 => _480.docInfo, 'optionalAccess', _481 => _481.docNum]), () => ( ""))], ["\uACB0\uC7AC\uC77C\uC790", _nullishCoalesce(_optionalChain([inp, 'access', _482 => _482.docInfo, 'optionalAccess', _483 => _483.date]), () => ( ""))], ["\uACF5\uAC1C\uC5EC\uBD80", _nullishCoalesce(_optionalChain([inp, 'access', _484 => _484.docInfo, 'optionalAccess', _485 => _485.disclosure]), () => ( ""))], ["\uBC29\uCE68\uBC88\uD638", _nullishCoalesce(_optionalChain([inp, 'access', _486 => _486.docInfo, 'optionalAccess', _487 => _487.policyNo]), () => ( ""))]];
|
|
26678
26679
|
const infoW = Math.round(ctx.W * 0.36);
|
|
26679
26680
|
const [lw, vw] = scale([4200, 12800], infoW);
|
|
26680
26681
|
const infoXml = ftbl(infoRows.map(
|
|
@@ -26693,7 +26694,7 @@ function buildReportCover(inp, ctx) {
|
|
|
26693
26694
|
for (let i = 0; i < 4; i++) out.push(blank2(20));
|
|
26694
26695
|
const w = ctx.W - 1200;
|
|
26695
26696
|
const bar = bf.get({ t: "none", b: "none", l: "none", r: "none", fill: cv ? { gradient: [...cv.bar.gradient], type: "LINEAR", angle: 90 } : "#1F2FD6" });
|
|
26696
|
-
const barH = _nullishCoalesce(_optionalChain([cv, 'optionalAccess',
|
|
26697
|
+
const barH = _nullishCoalesce(_optionalChain([cv, 'optionalAccess', _488 => _488.bar, 'access', _489 => _489.h]), () => ( 200));
|
|
26697
26698
|
const fit = fitOneLine(inp.title, frame.titleFont, 27, w - 800, 22);
|
|
26698
26699
|
const cT = reg.char({ font: frame.titleFont, pt: fit.pt, bold: true, ratio: fit.ratio, spacing: fit.spacing });
|
|
26699
26700
|
const c1 = reg.char({ font: "\uD55C\uCEF4\uB3CB\uC6C0", pt: 1 });
|
|
@@ -26969,7 +26970,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
26969
26970
|
}
|
|
26970
26971
|
function assertFiniteRange(name, value, min, max) {
|
|
26971
26972
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
26972
|
-
throw new (0,
|
|
26973
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
26973
26974
|
}
|
|
26974
26975
|
}
|
|
26975
26976
|
function validateGongmunOptions(opts) {
|
|
@@ -26984,10 +26985,10 @@ function validateGongmunOptions(opts) {
|
|
|
26984
26985
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
26985
26986
|
}
|
|
26986
26987
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
26987
|
-
throw new (0,
|
|
26988
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
26988
26989
|
}
|
|
26989
26990
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
26990
|
-
throw new (0,
|
|
26991
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
26991
26992
|
}
|
|
26992
26993
|
}
|
|
26993
26994
|
if (opts.sizes) {
|
|
@@ -26996,24 +26997,24 @@ function validateGongmunOptions(opts) {
|
|
|
26996
26997
|
}
|
|
26997
26998
|
}
|
|
26998
26999
|
if (opts.approval && opts.approval.length > 6) {
|
|
26999
|
-
throw new (0,
|
|
27000
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("approval must contain at most 6 labels");
|
|
27000
27001
|
}
|
|
27001
27002
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
27002
27003
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
27003
27004
|
for (const n of nums) {
|
|
27004
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
27005
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkRHMIEEAZcjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
27005
27006
|
}
|
|
27006
27007
|
}
|
|
27007
27008
|
if (opts.levels) {
|
|
27008
27009
|
for (const [key, st] of Object.entries(opts.levels)) {
|
|
27009
27010
|
const depth = Number(key);
|
|
27010
27011
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
27011
|
-
throw new (0,
|
|
27012
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
27012
27013
|
}
|
|
27013
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
27014
|
+
if (!st || typeof st !== "object") throw new (0, _chunkRHMIEEAZcjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
27014
27015
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
27015
27016
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
27016
|
-
throw new (0,
|
|
27017
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
27017
27018
|
}
|
|
27018
27019
|
}
|
|
27019
27020
|
}
|
|
@@ -27025,7 +27026,7 @@ function resolveLevels(levels, bodyHeight) {
|
|
|
27025
27026
|
for (const [key, st] of Object.entries(levels)) {
|
|
27026
27027
|
if (st.font === void 0 && st.pt === void 0 && st.bold === void 0) continue;
|
|
27027
27028
|
out[Number(key)] = {
|
|
27028
|
-
font: _optionalChain([st, 'access',
|
|
27029
|
+
font: _optionalChain([st, 'access', _490 => _490.font, 'optionalAccess', _491 => _491.trim, 'call', _492 => _492()]) || null,
|
|
27029
27030
|
height: st.pt !== void 0 ? Math.round(st.pt * 100) : bodyHeight,
|
|
27030
27031
|
bold: !!st.bold
|
|
27031
27032
|
};
|
|
@@ -27033,7 +27034,7 @@ function resolveLevels(levels, bodyHeight) {
|
|
|
27033
27034
|
return Object.keys(out).length > 0 ? out : null;
|
|
27034
27035
|
}
|
|
27035
27036
|
function levelMarkerHeight(g3, depth) {
|
|
27036
|
-
return _nullishCoalesce(_optionalChain([g3, 'access',
|
|
27037
|
+
return _nullishCoalesce(_optionalChain([g3, 'access', _493 => _493.levels, 'optionalAccess', _494 => _494[depth], 'optionalAccess', _495 => _495.height]), () => ( g3.bodyHeight));
|
|
27037
27038
|
}
|
|
27038
27039
|
function incompatibleGongmunWarnings(opts) {
|
|
27039
27040
|
const warns = [];
|
|
@@ -27068,7 +27069,7 @@ function resolveChecklist(c, preset) {
|
|
|
27068
27069
|
function hexColorOption(name, value) {
|
|
27069
27070
|
if (value === void 0) return void 0;
|
|
27070
27071
|
const v = value.trim();
|
|
27071
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
27072
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkRHMIEEAZcjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
27072
27073
|
return v.toUpperCase();
|
|
27073
27074
|
}
|
|
27074
27075
|
function resolveGongmun(opts) {
|
|
@@ -27097,7 +27098,7 @@ function resolveGongmun(opts) {
|
|
|
27097
27098
|
bodyPtExplicit: opts.bodyPt !== void 0,
|
|
27098
27099
|
lineSpacingExplicit: opts.lineSpacing !== void 0,
|
|
27099
27100
|
bodyFontExplicit: opts.bodyFont !== void 0,
|
|
27100
|
-
summary: _optionalChain([opts, 'access',
|
|
27101
|
+
summary: _optionalChain([opts, 'access', _496 => _496.summary, 'optionalAccess', _497 => _497.trim, 'call', _498 => _498()]) || null,
|
|
27101
27102
|
docInfo: _nullishCoalesce(opts.docInfo, () => ( null)),
|
|
27102
27103
|
checklist: resolveChecklist(opts.checklist, preset),
|
|
27103
27104
|
toc: preset !== "press" && (_nullishCoalesce(opts.toc, () => ( (gaejosik || ministry)))),
|
|
@@ -27128,7 +27129,7 @@ function resolveGongmun(opts) {
|
|
|
27128
27129
|
suppressSingle: _nullishCoalesce(opts.suppressSingle, () => ( false)),
|
|
27129
27130
|
docHead: preset === "official" && opts.docHead ? opts.docHead : null,
|
|
27130
27131
|
docFoot: preset === "official" && opts.docFoot ? opts.docFoot : null,
|
|
27131
|
-
reportInfo: _optionalChain([opts, 'access',
|
|
27132
|
+
reportInfo: _optionalChain([opts, 'access', _499 => _499.reportInfo, 'optionalAccess', _500 => _500.trim, 'call', _501 => _501()]) || null,
|
|
27132
27133
|
noticeHead: preset === "notice" && opts.noticeHead ? opts.noticeHead : null,
|
|
27133
27134
|
// 보도자료 머리박스는 프리셋 자체가 요구 — 옵션 미지정이어도 빈 객체
|
|
27134
27135
|
press: preset === "press" ? _nullishCoalesce(opts.press, () => ( {})) : null
|
|
@@ -27455,7 +27456,7 @@ function parseInlineMarkdown(text) {
|
|
|
27455
27456
|
else spans.push(...emphasisSpans(m[0]));
|
|
27456
27457
|
} else {
|
|
27457
27458
|
const anchor = m[2] || m[3];
|
|
27458
|
-
const href = _nullishCoalesce(
|
|
27459
|
+
const href = _nullishCoalesce(_chunkRHMIEEAZcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
27459
27460
|
const sub = emphasisSpans(anchor);
|
|
27460
27461
|
if (href) for (const s of sub) s.href = href;
|
|
27461
27462
|
spans.push(...sub);
|
|
@@ -27621,8 +27622,8 @@ function resolvePage(opts) {
|
|
|
27621
27622
|
// 실측: 용지 치수는 방향과 무관하게 유지, 방향은 landscape 속성만 바뀐다
|
|
27622
27623
|
landscape: orientation === "landscape" ? "NARROWLY" : "WIDELY",
|
|
27623
27624
|
columns: cols,
|
|
27624
|
-
header: _optionalChain([header, 'optionalAccess',
|
|
27625
|
-
footer: _optionalChain([footer, 'optionalAccess',
|
|
27625
|
+
header: _optionalChain([header, 'optionalAccess', _502 => _502.trim, 'call', _503 => _503()]) ? header.trim() : null,
|
|
27626
|
+
footer: _optionalChain([footer, 'optionalAccess', _504 => _504.trim, 'call', _505 => _505()]) ? footer.trim() : null
|
|
27626
27627
|
};
|
|
27627
27628
|
}
|
|
27628
27629
|
function columnColPrXml(columns) {
|
|
@@ -27669,7 +27670,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
27669
27670
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
27670
27671
|
const got = m ? Number(m[1]) : NaN;
|
|
27671
27672
|
if (got !== startId + i) {
|
|
27672
|
-
throw new (0,
|
|
27673
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(
|
|
27673
27674
|
`\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)`
|
|
27674
27675
|
);
|
|
27675
27676
|
}
|
|
@@ -27760,7 +27761,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
27760
27761
|
}
|
|
27761
27762
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
27762
27763
|
if (rows.length !== expectedBase) {
|
|
27763
|
-
throw new (0,
|
|
27764
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(
|
|
27764
27765
|
`\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`
|
|
27765
27766
|
);
|
|
27766
27767
|
}
|
|
@@ -27987,7 +27988,7 @@ var TAB_PROPS_GONGMUN = `<hh:tabProperties itemCnt="2">
|
|
|
27987
27988
|
<hh:tabPr id="1" autoTabLeft="1" autoTabRight="0"/>
|
|
27988
27989
|
</hh:tabProperties>`;
|
|
27989
27990
|
function generateHeaderXml(theme, gongmun, ratioVariants = [], extraBorderFills = [], extraCharPrXmls = [], listIndentVariants = [], extraFonts = [], v5 = null) {
|
|
27990
|
-
const bodyFace = _nullishCoalesce(_nullishCoalesce(_optionalChain([v5, 'optionalAccess',
|
|
27991
|
+
const bodyFace = _nullishCoalesce(_nullishCoalesce(_optionalChain([v5, 'optionalAccess', _506 => _506.bodyFace]), () => ( _optionalChain([gongmun, 'optionalAccess', _507 => _507.fonts, 'access', _508 => _508.body]))), () => ( (_optionalChain([gongmun, 'optionalAccess', _509 => _509.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
|
|
27991
27992
|
const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants, extraCharPrXmls, !!v5);
|
|
27992
27993
|
const paraPropsXml = v5 ? buildParaPropertiesV5(gongmun, v5.paraPrXmls) : buildParaProperties(gongmun, gongmun ? listIndentVariants : []);
|
|
27993
27994
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
@@ -28116,8 +28117,8 @@ function parseChartFence(text) {
|
|
|
28116
28117
|
const spec = chartSpec(type);
|
|
28117
28118
|
let finalSeries = spec.pie ? [series[0]] : series;
|
|
28118
28119
|
finalSeries = finalSeries.map((s) => ({ ...s }));
|
|
28119
|
-
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
28120
|
-
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
28120
|
+
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _510 => _510.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
|
|
28121
|
+
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _511 => _511[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
|
|
28121
28122
|
if (!spec.scatter) {
|
|
28122
28123
|
finalSeries = finalSeries.map((s) => ({ ...s, values: catFinal.map((_, i) => _nullishCoalesce(s.values[i], () => ( 0))) }));
|
|
28123
28124
|
}
|
|
@@ -28159,7 +28160,7 @@ function serSpPr(color, stroke) {
|
|
|
28159
28160
|
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>`;
|
|
28160
28161
|
}
|
|
28161
28162
|
function dPtXml(pointColors, pie) {
|
|
28162
|
-
if (!_optionalChain([pointColors, 'optionalAccess',
|
|
28163
|
+
if (!_optionalChain([pointColors, 'optionalAccess', _512 => _512.length])) return "";
|
|
28163
28164
|
return pointColors.map((col, i) => {
|
|
28164
28165
|
const f = chartColorFill(col);
|
|
28165
28166
|
if (!f) return "";
|
|
@@ -28237,7 +28238,7 @@ function computeGongmunFitPlan(blocks, gongmun, gongmunList) {
|
|
|
28237
28238
|
if (block.type === "list_item" && gongmunList.items.has(i)) {
|
|
28238
28239
|
const { marker, depth, indentVariant } = gongmunList.items.get(i);
|
|
28239
28240
|
if (gongmun.numbering === "gaejosik" && (depth === 0 || (block.text || "").trimStart().startsWith("\u203B"))) continue;
|
|
28240
|
-
if (_optionalChain([gongmun, 'access',
|
|
28241
|
+
if (_optionalChain([gongmun, 'access', _513 => _513.levels, 'optionalAccess', _514 => _514[depth]])) continue;
|
|
28241
28242
|
const content = plainRenderText(block.text || "");
|
|
28242
28243
|
text = marker ? `${marker} ${content}` : content;
|
|
28243
28244
|
const li = levelIndent(depth, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, usesAsteriskThird(gongmun.preset));
|
|
@@ -28400,8 +28401,8 @@ function buildGaejosikCover(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH) {
|
|
|
28400
28401
|
const botRow = cell({ bf: GJ_BF_BAR_DARK, col: 0, row: 2, w: g3.botDarkW, h: g3.botBarH, paras: barEmpty }) + cell({ bf: GJ_BF_BAR_LIGHT, col: 1, colSpan: 2, row: 2, w: g3.botLightW, h: g3.botBarH, paras: barEmpty });
|
|
28401
28402
|
const tbl2 = table([topRow, titleRow, botRow], g3.totalW, g3.barH + g3.titleH + g3.botBarH, 3, 1, bodyWidth);
|
|
28402
28403
|
const host2 = `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${tbl2}</hp:run></hp:p>`;
|
|
28403
|
-
const date = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
28404
|
-
const org = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
28404
|
+
const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _515 => _515.cover, 'optionalAccess', _516 => _516.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
|
|
28405
|
+
const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _517 => _517.cover, 'optionalAccess', _518 => _518.org]), () => ( ""));
|
|
28405
28406
|
const sub = (t) => `<hp:p paraPrIDRef="${GJ_PARA_COVER}" styleIDRef="0"><hp:run charPrIDRef="${GJ_CHAR_COVER_SUB}"><hp:t>${escapeTextXml(t)}</hp:t></hp:run></hp:p>`;
|
|
28406
28407
|
const subEmpty = emptyPara(GJ_PARA_COVER, false, GJ_CHAR_COVER_SUB);
|
|
28407
28408
|
return [
|
|
@@ -28454,7 +28455,7 @@ function buildGaejosikBodyTitle(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH)
|
|
|
28454
28455
|
var CHAPTER_FIT_PAD = 282 + 300;
|
|
28455
28456
|
function buildGaejosikChapter(n, title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH, srcLevel = 2) {
|
|
28456
28457
|
const g3 = gongmun ? chapterGeom(gongmun.bodyHeight, gongmun.sizes, bodyWidth) : chapterGeom(1500, {}, bodyWidth);
|
|
28457
|
-
const titleW = _optionalChain([gongmun, 'optionalAccess',
|
|
28458
|
+
const titleW = _optionalChain([gongmun, 'optionalAccess', _519 => _519.chapterFit]) ? Math.min(g3.titleW, Math.ceil(measureTextWidth(
|
|
28458
28459
|
` ${title} `,
|
|
28459
28460
|
gaejosikSizes(gongmun.bodyHeight, gongmun.sizes).chapter,
|
|
28460
28461
|
100,
|
|
@@ -28672,7 +28673,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
28672
28673
|
}
|
|
28673
28674
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
28674
28675
|
function sanitizeText(text) {
|
|
28675
|
-
let result =
|
|
28676
|
+
let result = _chunkW5NXOMCDcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
28676
28677
|
if (result.length <= 30 && result.includes(" ")) {
|
|
28677
28678
|
const tokens = result.split(" ");
|
|
28678
28679
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -28702,10 +28703,10 @@ function replicateGfmTable(table2) {
|
|
|
28702
28703
|
for (let r = 0; r < numRows; r++) {
|
|
28703
28704
|
for (let c = 0; c < numCols; c++) {
|
|
28704
28705
|
if (skip.has(`${r},${c}`)) continue;
|
|
28705
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
28706
|
+
const cell2 = _optionalChain([cells, 'access', _520 => _520[r], 'optionalAccess', _521 => _521[c]]);
|
|
28706
28707
|
if (!cell2) continue;
|
|
28707
28708
|
display[r][c] = {
|
|
28708
|
-
text:
|
|
28709
|
+
text: _chunkW5NXOMCDcjs.escapeGfm.call(void 0, sanitizeText(cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\r\n|\r|\n/g, "<br>"),
|
|
28709
28710
|
gridR: r,
|
|
28710
28711
|
gridC: c
|
|
28711
28712
|
};
|
|
@@ -28756,18 +28757,18 @@ function unescapeGfmCell(text) {
|
|
|
28756
28757
|
return text.replace(/(?<!\\)<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*_`#<$\\])/g, "$1");
|
|
28757
28758
|
}
|
|
28758
28759
|
function replicateCellInnerHtml(cell2) {
|
|
28759
|
-
if (_optionalChain([cell2, 'access',
|
|
28760
|
+
if (_optionalChain([cell2, 'access', _522 => _522.blocks, 'optionalAccess', _523 => _523.length])) {
|
|
28760
28761
|
return cell2.blocks.map((b) => {
|
|
28761
28762
|
if (b.type === "table" && b.table) {
|
|
28762
28763
|
const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
|
|
28763
|
-
return (cap ?
|
|
28764
|
+
return (cap ? _chunkW5NXOMCDcjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
28764
28765
|
}
|
|
28765
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
28766
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkRHMIEEAZcjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
28766
28767
|
const t = sanitizeText(_nullishCoalesce(b.text, () => ( "")));
|
|
28767
|
-
return t ?
|
|
28768
|
+
return t ? _chunkW5NXOMCDcjs.escapeHtmlCellText.call(void 0, t + _chunkW5NXOMCDcjs.noteSuffix.call(void 0, b)).replace(/\n/g, "<br>") : "";
|
|
28768
28769
|
}).filter(Boolean).join("<br>");
|
|
28769
28770
|
}
|
|
28770
|
-
return
|
|
28771
|
+
return _chunkW5NXOMCDcjs.escapeHtmlCellText.call(void 0, sanitizeText(cell2.text)).replace(/\n/g, "<br>");
|
|
28771
28772
|
}
|
|
28772
28773
|
function replicateTableToHtml(table2) {
|
|
28773
28774
|
const rows = replicateHtmlTable(table2);
|
|
@@ -28795,7 +28796,7 @@ function replicateHtmlTable(table2) {
|
|
|
28795
28796
|
const rowCells = [];
|
|
28796
28797
|
for (let c = 0; c < numCols; c++) {
|
|
28797
28798
|
if (skip.has(`${r},${c}`)) continue;
|
|
28798
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
28799
|
+
const cell2 = _optionalChain([cells, 'access', _524 => _524[r], 'optionalAccess', _525 => _525[c]]);
|
|
28799
28800
|
if (!cell2) continue;
|
|
28800
28801
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
28801
28802
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -28841,10 +28842,10 @@ function parseHtmlTable(raw) {
|
|
|
28841
28842
|
}
|
|
28842
28843
|
} else {
|
|
28843
28844
|
if (!isClose) {
|
|
28844
|
-
const cs = parseInt(_optionalChain([attrs, 'access',
|
|
28845
|
-
const rs = parseInt(_optionalChain([attrs, 'access',
|
|
28845
|
+
const cs = parseInt(_optionalChain([attrs, 'access', _526 => _526.match, 'call', _527 => _527(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _528 => _528[1]]) || "1", 10);
|
|
28846
|
+
const rs = parseInt(_optionalChain([attrs, 'access', _529 => _529.match, 'call', _530 => _530(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _531 => _531[1]]) || "1", 10);
|
|
28846
28847
|
cellStart = m.index + m[0].length;
|
|
28847
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
28848
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkW5NXOMCDcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkW5NXOMCDcjs.MAX_ROWS) };
|
|
28848
28849
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
28849
28850
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
28850
28851
|
cellStart = -1;
|
|
@@ -28868,12 +28869,12 @@ function htmlCellInnerToLines(inner) {
|
|
|
28868
28869
|
hadNonText = true;
|
|
28869
28870
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
28870
28871
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
28871
|
-
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess',
|
|
28872
|
-
if (src) imgSrcs.push(
|
|
28872
|
+
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _532 => _532[1]]), () => ( _optionalChain([m, 'optionalAccess', _533 => _533[2]])));
|
|
28873
|
+
if (src) imgSrcs.push(_chunkRHMIEEAZcjs.unescapeHtml.call(void 0, src));
|
|
28873
28874
|
return "";
|
|
28874
28875
|
});
|
|
28875
28876
|
}
|
|
28876
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
28877
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkRHMIEEAZcjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
28877
28878
|
return { lines, hadNonText, imgSrcs };
|
|
28878
28879
|
}
|
|
28879
28880
|
function splitCellByTopLevelTables(html) {
|
|
@@ -29030,7 +29031,7 @@ function edgeXml(tag, d) {
|
|
|
29030
29031
|
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"/>`;
|
|
29031
29032
|
}
|
|
29032
29033
|
function borderFillDefToXml(id, def) {
|
|
29033
|
-
const fill = _optionalChain([def, 'access',
|
|
29034
|
+
const fill = _optionalChain([def, 'access', _534 => _534.fill, 'optionalAccess', _535 => _535.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
|
|
29034
29035
|
return ` <hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0">
|
|
29035
29036
|
<hh:slash type="NONE" Crooked="0" isCounter="0"/>
|
|
29036
29037
|
<hh:backSlash type="NONE" Crooked="0" isCounter="0"/>
|
|
@@ -29353,7 +29354,7 @@ var ImageRegistry = (_class6 = class {
|
|
|
29353
29354
|
}
|
|
29354
29355
|
/** 실데이터 등록 — images 맵 바이트·data: URI. 포맷 미상(webp 등)은 null → placeholder 폴백 */
|
|
29355
29356
|
takeReal(url) {
|
|
29356
|
-
let bytes = _optionalChain([this, 'access',
|
|
29357
|
+
let bytes = _optionalChain([this, 'access', _536 => _536.supplied, 'optionalAccess', _537 => _537.get, 'call', _538 => _538(url)]);
|
|
29357
29358
|
if (!bytes && url.startsWith("data:")) {
|
|
29358
29359
|
const m = /^data:image\/[a-z+]+;base64,([A-Za-z0-9+/=\s]+)$/i.exec(url);
|
|
29359
29360
|
if (m) {
|
|
@@ -29580,14 +29581,14 @@ function requiredTableWidth(rows, charHeight, faceClass = "hcr") {
|
|
|
29580
29581
|
return colMax.reduce((a, w) => a + Math.round((w + CELL_PAD) * colSlack(faceClass)), 0);
|
|
29581
29582
|
}
|
|
29582
29583
|
function generateTable(rows, theme, style = null, remap = null, seq = 0, images = null) {
|
|
29583
|
-
curFace = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
29584
|
+
curFace = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _539 => _539.faceClass]), () => ( "hcr"));
|
|
29584
29585
|
const rowCnt = rows.length;
|
|
29585
29586
|
const colCnt = Math.max(...rows.map((r) => r.length), 1);
|
|
29586
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
29587
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _540 => _540.bfRegistry]), () => ( null));
|
|
29587
29588
|
const totalW = style ? reg ? style.totalWidth - DATA_TABLE_INSET : style.totalWidth : 44e3;
|
|
29588
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
29589
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _541 => _541.charHeight]), () => ( 1e3));
|
|
29589
29590
|
const rowAnchor = normalizeRowAnchor((_nullishCoalesce(rows[0], () => ( []))).map((c) => c.replace(/!\[[^\]]*\]\([^)]*\)/g, "")));
|
|
29590
|
-
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access',
|
|
29591
|
+
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _542 => _542[0], 'optionalAccess', _543 => _543[0]]), () => ( ""))), seq, rowAnchor);
|
|
29591
29592
|
const colMax = Array(colCnt).fill(0);
|
|
29592
29593
|
const colMaxBody = Array(colCnt).fill(0);
|
|
29593
29594
|
const colMinWord = Array(colCnt).fill(0);
|
|
@@ -29618,7 +29619,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
29618
29619
|
const k = `${rowIdx},${colIdx}`;
|
|
29619
29620
|
const isLabelCell2 = labelCol0 && colIdx === 0;
|
|
29620
29621
|
const defaultCharPr = style ? reg && (isHeaderRow || isLabelCell2) ? style.boldCharPr : style.charPr : isHeaderRow ? headerCharPr : baseCharPr;
|
|
29621
|
-
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
29622
|
+
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _544 => _544.cellChar, 'access', _545 => _545.get, 'call', _546 => _546(k)]), () => ( defaultCharPr));
|
|
29622
29623
|
const centered = isHeaderRow || colCentered[colIdx];
|
|
29623
29624
|
const paraPrId = style ? centered ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
29624
29625
|
const p = cell2.split(/<br\s*\/?>/i).map((seg) => {
|
|
@@ -29636,11 +29637,11 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
29636
29637
|
}
|
|
29637
29638
|
}
|
|
29638
29639
|
}
|
|
29639
|
-
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess',
|
|
29640
|
+
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _547 => _547.cellChar, 'access', _548 => _548.has, 'call', _549 => _549(k)]) ? void 0 : mapId);
|
|
29640
29641
|
const body = (runs || (picRuns ? "" : `<hp:run charPrIDRef="${cellCharPr}"><hp:t></hp:t></hp:run>`)) + picRuns;
|
|
29641
29642
|
return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0">${body}</hp:p>`;
|
|
29642
29643
|
}).join("");
|
|
29643
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
29644
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _550 => _550.cellBf, 'access', _551 => _551.get, 'call', _552 => _552(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
29644
29645
|
row: rowIdx,
|
|
29645
29646
|
rowEnd: rowIdx,
|
|
29646
29647
|
col: colIdx,
|
|
@@ -29650,14 +29651,14 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
29650
29651
|
headerRows: 1,
|
|
29651
29652
|
fill: isHeaderRow ? _nullishCoalesce(style.headerFill, () => ( "#E6E6E6")) : isLabelCell2 ? _nullishCoalesce(style.labelFill, () => ( "#E7E7E7")) : void 0
|
|
29652
29653
|
})) : style && isHeaderRow ? style.headerBf : 2)));
|
|
29653
|
-
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
29654
|
+
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _553 => _553.cellH, 'access', _554 => _554.get, 'call', _555 => _555(k)]), () => ( cellH));
|
|
29654
29655
|
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>`;
|
|
29655
29656
|
}).join("");
|
|
29656
29657
|
return `<hp:tr>${tdElements}</hp:tr>`;
|
|
29657
29658
|
}).join("");
|
|
29658
29659
|
const tblW = colWidths.reduce((a, b) => a + b, 0);
|
|
29659
29660
|
const tblH = rowHeights.reduce((a, b) => a + b, 0);
|
|
29660
|
-
const hostPr = reg && _optionalChain([style, 'optionalAccess',
|
|
29661
|
+
const hostPr = reg && _optionalChain([style, 'optionalAccess', _556 => _556.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
|
|
29661
29662
|
const float = rowCnt >= 2;
|
|
29662
29663
|
const tblInner = `<hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tblH}" heightRelTo="ABSOLUTE" protect="0"/>` + tablePosXml(float, hostPr !== 0) + tableOutMarginXml(float, measureH) + `<hp:inMargin left="510" right="510" top="141" bottom="141"/>` + trElements;
|
|
29663
29664
|
const tbl2 = `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE"${float ? FLOAT_TBL_ATTRS : ""} pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0">${tblInner}</hp:tbl>`;
|
|
@@ -29671,8 +29672,8 @@ function layoutHtmlRows(rows) {
|
|
|
29671
29672
|
let c = 0;
|
|
29672
29673
|
for (const cell2 of rows[r].cells) {
|
|
29673
29674
|
while (occupied.has(`${r},${c}`)) c++;
|
|
29674
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
29675
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
29675
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkW5NXOMCDcjs.MAX_COLS);
|
|
29676
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkW5NXOMCDcjs.MAX_ROWS);
|
|
29676
29677
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
29677
29678
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
29678
29679
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -29697,8 +29698,8 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
29697
29698
|
if (!rows || rows.length === 0) return null;
|
|
29698
29699
|
const { placed, rowCnt, colCnt } = layoutHtmlRows(rows);
|
|
29699
29700
|
if (rowCnt === 0 || colCnt === 0) return null;
|
|
29700
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
29701
|
-
curFace = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
29701
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _557 => _557.charHeight]), () => ( 1e3));
|
|
29702
|
+
curFace = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _558 => _558.faceClass]), () => ( "hcr"));
|
|
29702
29703
|
const first = _nullishCoalesce(placed.find((p) => p.r === 0 && p.c === 0), () => ( placed[0]));
|
|
29703
29704
|
const row0 = Array.from({ length: colCnt }, () => "");
|
|
29704
29705
|
for (const cell2 of placed) {
|
|
@@ -29730,7 +29731,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
29730
29731
|
const tblId = nextTableId();
|
|
29731
29732
|
const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
|
|
29732
29733
|
const spanW = (cell2) => colWidths.slice(cell2.c, cell2.c + cell2.colSpan).reduce((a, b) => a + b, 0);
|
|
29733
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
29734
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _559 => _559.bfRegistry]), () => ( null));
|
|
29734
29735
|
let htmlHeaderRows = 0;
|
|
29735
29736
|
while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
|
|
29736
29737
|
const tableRowHeights = Array(rowCnt).fill(cellH);
|
|
@@ -29744,7 +29745,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
29744
29745
|
const nestedW = Math.max(Math.min(Math.max(sw - 1020, 4e3), sw - 282), 500);
|
|
29745
29746
|
const nestedXml = generateHtmlTableXml(nested2, theme, nestedW, style ? { ...style, totalWidth: nestedW } : null, null, 0, null, true);
|
|
29746
29747
|
if (nestedXml) {
|
|
29747
|
-
const szH = _optionalChain([nestedXml, 'access',
|
|
29748
|
+
const szH = _optionalChain([nestedXml, 'access', _560 => _560.match, 'call', _561 => _561(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _562 => _562[1]]);
|
|
29748
29749
|
nestedH += (szH ? Number(szH) : (_nullishCoalesce(nested2.match(/<tr[\s>]/gi), () => ( []))).length * cellH) + 300;
|
|
29749
29750
|
}
|
|
29750
29751
|
return nestedXml;
|
|
@@ -29755,7 +29756,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
29755
29756
|
for (const line of lines) wrapLines += Math.max(1, Math.ceil(measureTextWidth(line.trim(), measureH, 100, { faceClass: curFace }) / usable));
|
|
29756
29757
|
const lineH = style ? Math.round(measureH * 1.6) : 800;
|
|
29757
29758
|
const contentH = Math.max(cellH * rowSpan, Math.max(wrapLines, 1) * lineH + nestedH);
|
|
29758
|
-
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
29759
|
+
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _563 => _563.cellH, 'access', _564 => _564.get, 'call', _565 => _565(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
|
|
29759
29760
|
const perRow = Math.ceil(cellHeight / rowSpan);
|
|
29760
29761
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
|
|
29761
29762
|
return { cell: cell2, rowSpan, lines, nestedXmls, segLines, imgSrcs: cellParsed[i].imgSrcs };
|
|
@@ -29766,7 +29767,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
29766
29767
|
const baseCharPr = style ? style.charPr : CHAR_NORMAL;
|
|
29767
29768
|
const headerCharPr = isHeader && useHeaderStyle ? CHAR_TABLE_HEADER : baseCharPr;
|
|
29768
29769
|
const defaultCharPr = style && reg && isHeader ? style.boldCharPr : isHeader ? headerCharPr : baseCharPr;
|
|
29769
|
-
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
29770
|
+
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _566 => _566.cellChar, 'access', _567 => _567.get, 'call', _568 => _568(k)]), () => ( defaultCharPr));
|
|
29770
29771
|
const centered = isHeader || colCentered[cell2.c];
|
|
29771
29772
|
const paraPrId = style ? centered ? reg ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : style.centerParaPr : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
29772
29773
|
const picUrls = images ? [...imgSrcs] : [];
|
|
@@ -29806,7 +29807,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
29806
29807
|
let cellHeight = 0;
|
|
29807
29808
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) cellHeight += tableRowHeights[r];
|
|
29808
29809
|
const rowEnd = cell2.r + rowSpan - 1;
|
|
29809
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
29810
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _569 => _569.cellBf, 'access', _570 => _570.get, 'call', _571 => _571(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
29810
29811
|
row: cell2.r,
|
|
29811
29812
|
rowEnd,
|
|
29812
29813
|
col: cell2.c,
|
|
@@ -29825,7 +29826,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
29825
29826
|
}
|
|
29826
29827
|
const tableH = tableRowHeights.reduce((sum, height) => sum + height, 0);
|
|
29827
29828
|
const float = !nested && rowCnt >= 2;
|
|
29828
|
-
return `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE"${float ? FLOAT_TBL_ATTRS : ""} pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0"><hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tableH}" heightRelTo="ABSOLUTE" protect="0"/>` + tablePosXml(float, !!reg && _optionalChain([style, 'optionalAccess',
|
|
29829
|
+
return `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE"${float ? FLOAT_TBL_ATTRS : ""} pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0"><hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tableH}" heightRelTo="ABSOLUTE" protect="0"/>` + tablePosXml(float, !!reg && _optionalChain([style, 'optionalAccess', _572 => _572.rightParaPr]) !== void 0) + tableOutMarginXml(float, measureH) + `<hp:inMargin left="510" right="510" top="141" bottom="141"/>` + trXmls.join("") + `</hp:tbl>`;
|
|
29829
29830
|
}
|
|
29830
29831
|
|
|
29831
29832
|
// src/hwpx/gen-docframe.ts
|
|
@@ -29886,7 +29887,7 @@ function buildPressHead(g3, ids, bodyWidth, reg) {
|
|
|
29886
29887
|
return [`<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`, blank()];
|
|
29887
29888
|
}
|
|
29888
29889
|
function buildPressContact(g3, ids, bodyWidth, reg) {
|
|
29889
|
-
const c = _optionalChain([g3, 'access',
|
|
29890
|
+
const c = _optionalChain([g3, 'access', _573 => _573.press, 'optionalAccess', _574 => _574.contact]);
|
|
29890
29891
|
if (!c || !c.dept && !c.manager && !c.phone) return [];
|
|
29891
29892
|
const w = bodyWidth - 280;
|
|
29892
29893
|
const cells = [["\uB2F4\uB2F9 \uBD80\uC11C", _nullishCoalesce(c.dept, () => ( ""))], ["\uB2F4\uB2F9\uC790", _nullishCoalesce(c.manager, () => ( ""))], ["\uC5F0\uB77D\uCC98", _nullishCoalesce(c.phone, () => ( ""))]];
|
|
@@ -30265,10 +30266,10 @@ function generateSecPr(gongmun, page = null) {
|
|
|
30265
30266
|
m.header = gongmun.headerFooter;
|
|
30266
30267
|
m.footer = gongmun.headerFooter;
|
|
30267
30268
|
}
|
|
30268
|
-
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',
|
|
30269
|
-
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess',
|
|
30270
|
-
const hf = (_optionalChain([page, 'optionalAccess',
|
|
30271
|
-
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess',
|
|
30269
|
+
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', _575 => _575.landscape]), () => ( "WIDELY"))}" width="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _576 => _576.widthHU]), () => ( A4_W_HU))}" height="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _577 => _577.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>`;
|
|
30270
|
+
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess', _578 => _578.columns]), () => ( 1)));
|
|
30271
|
+
const hf = (_optionalChain([page, 'optionalAccess', _579 => _579.header]) ? headerFooterCtrl("header", page.header, 1) : "") + (_optionalChain([page, 'optionalAccess', _580 => _580.footer]) ? headerFooterCtrl("footer", page.footer, 2) : "");
|
|
30272
|
+
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess', _581 => _581.pageNumbers]) ? pageNumCtrl() : "");
|
|
30272
30273
|
}
|
|
30273
30274
|
var SectionOpener = (_class7 = class {
|
|
30274
30275
|
constructor(gongmun, page = null) {;_class7.prototype.__init16.call(this);
|
|
@@ -30310,16 +30311,16 @@ function buildPreamble(blocks, ctx) {
|
|
|
30310
30311
|
const { gongmun, dfIds, bfReg, tableStyle, richAssets, gjBodyW } = ctx;
|
|
30311
30312
|
const preamble = [];
|
|
30312
30313
|
let hasFrontPages = false;
|
|
30313
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
30314
|
+
if (_optionalChain([gongmun, 'optionalAccess', _582 => _582.reportInfo]) && dfIds) {
|
|
30314
30315
|
preamble.push(buildReportInfo(gongmun, dfIds));
|
|
30315
30316
|
}
|
|
30316
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
30317
|
+
if (_optionalChain([gongmun, 'optionalAccess', _583 => _583.approval]) && bfReg) {
|
|
30317
30318
|
preamble.push(buildApprovalTable(gongmun.approval, bfReg, richAssets ? GJ_CHAR_APPROVAL : GONGMUN_APPROVAL_CHAR));
|
|
30318
30319
|
}
|
|
30319
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
30320
|
+
if (_optionalChain([gongmun, 'optionalAccess', _584 => _584.noticeHead]) && dfIds) {
|
|
30320
30321
|
preamble.push(...buildNoticeHead(gongmun));
|
|
30321
30322
|
}
|
|
30322
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
30323
|
+
if (_optionalChain([gongmun, 'optionalAccess', _585 => _585.press]) && dfIds && bfReg && tableStyle) {
|
|
30323
30324
|
preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
30324
30325
|
}
|
|
30325
30326
|
if (gongmun && (gongmun.cover || gongmun.toc)) {
|
|
@@ -30348,7 +30349,7 @@ function buildPreamble(blocks, ctx) {
|
|
|
30348
30349
|
}
|
|
30349
30350
|
if (gongmun && !ctx.gaejosik && ctx.coverH1Idx < 0 && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
|
|
30350
30351
|
ctx.titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
30351
|
-
} else if (_optionalChain([gongmun, 'optionalAccess',
|
|
30352
|
+
} else if (_optionalChain([gongmun, 'optionalAccess', _586 => _586.press]) && ctx.coverH1Idx < 0 && dfIds) {
|
|
30352
30353
|
ctx.pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
30353
30354
|
}
|
|
30354
30355
|
if (preamble.length > 0) {
|
|
@@ -30373,7 +30374,7 @@ function renderHeading(block, blockIdx, ctx) {
|
|
|
30373
30374
|
if (gongmun && blockIdx === ctx.coverH1Idx) return "";
|
|
30374
30375
|
if (gongmun && blockIdx === ctx.pressH1Idx && dfIds) {
|
|
30375
30376
|
const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
|
|
30376
|
-
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
30377
|
+
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _587 => _587.press, 'optionalAccess', _588 => _588.sub]), () => ( []))) {
|
|
30377
30378
|
parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
|
|
30378
30379
|
}
|
|
30379
30380
|
return parts.join("\n ");
|
|
@@ -30480,8 +30481,8 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
30480
30481
|
const { gongmun, gongmunList, measured, fit, vBase, dfIds } = ctx;
|
|
30481
30482
|
if (gongmun && gongmunList) {
|
|
30482
30483
|
const info = gongmunList.items.get(blockIdx);
|
|
30483
|
-
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
30484
|
-
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
30484
|
+
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _589 => _589.depth]), () => ( 0));
|
|
30485
|
+
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _590 => _590.marker]), () => ( ""));
|
|
30485
30486
|
const content = block.text || "";
|
|
30486
30487
|
if (measured && content.trimStart().startsWith("\u203B")) {
|
|
30487
30488
|
return refParagraph(content.trim(), ctx);
|
|
@@ -30489,7 +30490,7 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
30489
30490
|
if (measured && block.marker === "*") {
|
|
30490
30491
|
return refParagraph(`* ${content.trim()}`, ctx);
|
|
30491
30492
|
}
|
|
30492
|
-
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess',
|
|
30493
|
+
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _591 => _591.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
|
|
30493
30494
|
let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
|
|
30494
30495
|
let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
|
|
30495
30496
|
if (measured && depth === 0 && gongmun.numbering !== "standard") {
|
|
@@ -30503,7 +30504,7 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
30503
30504
|
mapId = void 0;
|
|
30504
30505
|
}
|
|
30505
30506
|
}
|
|
30506
|
-
const lv = _optionalChain([ctx, 'access',
|
|
30507
|
+
const lv = _optionalChain([ctx, 'access', _592 => _592.levelIds, 'optionalAccess', _593 => _593[depth]]);
|
|
30507
30508
|
if (lv) {
|
|
30508
30509
|
listCharPr = lv.normal;
|
|
30509
30510
|
mapId = (id) => id === CHAR_BOLD ? lv.bold : id === CHAR_NORMAL ? lv.normal : id;
|
|
@@ -30554,15 +30555,15 @@ function renderHtmlTable(block, ctx) {
|
|
|
30554
30555
|
}
|
|
30555
30556
|
function appendPostamble(blocks, ctx) {
|
|
30556
30557
|
const { gongmun, dfIds, bfReg, tableStyle, paraXmls } = ctx;
|
|
30557
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
30558
|
+
if (_optionalChain([gongmun, 'optionalAccess', _594 => _594.noticeHead]) && dfIds) {
|
|
30558
30559
|
paraXmls.push(...buildNoticeFoot(gongmun));
|
|
30559
30560
|
}
|
|
30560
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
30561
|
-
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access',
|
|
30561
|
+
if (_optionalChain([gongmun, 'optionalAccess', _595 => _595.endMark]) && paraXmls.length > 0) {
|
|
30562
|
+
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _596 => _596.rows, 'optionalAccess', _597 => _597.length]));
|
|
30562
30563
|
const lastText = lastBlock && (lastBlock.type === "paragraph" || lastBlock.type === "list_item") ? lastBlock.text || "" : "";
|
|
30563
30564
|
if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
|
|
30564
30565
|
}
|
|
30565
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
30566
|
+
if (_optionalChain([gongmun, 'optionalAccess', _598 => _598.press]) && dfIds && bfReg && tableStyle) {
|
|
30566
30567
|
paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
30567
30568
|
}
|
|
30568
30569
|
}
|
|
@@ -30583,7 +30584,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
30583
30584
|
dfIds,
|
|
30584
30585
|
images,
|
|
30585
30586
|
levelIds,
|
|
30586
|
-
gaejosik: _optionalChain([gongmun, 'optionalAccess',
|
|
30587
|
+
gaejosik: _optionalChain([gongmun, 'optionalAccess', _599 => _599.preset]) === "gaejosik",
|
|
30587
30588
|
measured,
|
|
30588
30589
|
richAssets,
|
|
30589
30590
|
vBase: charVariantBase(richAssets, !!gongmun),
|
|
@@ -31114,7 +31115,7 @@ function buildOutline(blocks, opts) {
|
|
|
31114
31115
|
break;
|
|
31115
31116
|
}
|
|
31116
31117
|
if (lvl <= 2) {
|
|
31117
|
-
const label = _optionalChain([CHAPTER_LABEL_RE, 'access',
|
|
31118
|
+
const label = _optionalChain([CHAPTER_LABEL_RE, 'access', _600 => _600.exec, 'call', _601 => _601(raw), 'optionalAccess', _602 => _602[1]]);
|
|
31118
31119
|
nodes.push({ kind: "chapter", text: stripChapterNumber(raw) || raw, index: ++chapters, ...label ? { label } : {} });
|
|
31119
31120
|
lastExplicitDepth = -1;
|
|
31120
31121
|
listBase = -1;
|
|
@@ -31585,7 +31586,7 @@ function buildGongmunSectionV5(blocks, gongmun, deps, theme) {
|
|
|
31585
31586
|
if (box.lines > 3) warnings.push(`\uC694\uC57D\uBC15\uC2A4\uAC00 ${box.lines}\uC904\uC785\uB2C8\uB2E4 \u2014 \uBCF4\uACE0 \uBAA9\uC801\uC744 \uD55C \uBB38\uC7A5(\uC27C\uD45C \uD5C8\uC6A9) 3\uC904 \uC774\uB0B4 "\u2026\uD558\uACE0\uC790 \uD568"\uC73C\uB85C \uC904\uC774\uC138\uC694`);
|
|
31586
31587
|
paras.push(box.xml);
|
|
31587
31588
|
};
|
|
31588
|
-
const docTitle = polishGongmunText(_nullishCoalesce(_nullishCoalesce(_optionalChain([g3, 'access',
|
|
31589
|
+
const docTitle = polishGongmunText(_nullishCoalesce(_nullishCoalesce(_optionalChain([g3, 'access', _603 => _603.docHead, 'optionalAccess', _604 => _604.title]), () => ( outline.title)), () => ( "")));
|
|
31589
31590
|
const reportInfo = g3.reportInfo && polishGongmunText(g3.reportInfo);
|
|
31590
31591
|
if (preset === "official") {
|
|
31591
31592
|
if (g3.docHead) paras.push(buildDocHeadTable({ ...g3.docHead, title: docTitle }, frame));
|
|
@@ -31675,7 +31676,7 @@ function buildGongmunSectionV5(blocks, gongmun, deps, theme) {
|
|
|
31675
31676
|
let pendingNewPageNum = isMinistry && (!!g3.cover || !!g3.toc);
|
|
31676
31677
|
let chapterStyle = g3.h2Marker === "box" || g3.h2Marker === "number" || g3.h2Marker === "none" || g3.h2Marker === "band" || g3.h2Marker === "square" ? g3.h2Marker : "roman";
|
|
31677
31678
|
if (!gaejosik) chapterStyle = "number";
|
|
31678
|
-
const leadLeft = (depth, pt3) => (_nullishCoalesce(_optionalChain([scheme, 'access',
|
|
31679
|
+
const leadLeft = (depth, pt3) => (_nullishCoalesce(_optionalChain([scheme, 'access', _605 => _605.levels, 'access', _606 => _606[Math.min(depth, 7)], 'optionalAccess', _607 => _607.leadTa]), () => ( 0))) * taHu(pt3);
|
|
31679
31680
|
const renderItem = (node, styleId = 0) => {
|
|
31680
31681
|
const depth = Math.min(node.depth, 7);
|
|
31681
31682
|
const sub = gaejosik && node.legalMarker;
|
|
@@ -31736,7 +31737,7 @@ function buildGongmunSectionV5(blocks, gongmun, deps, theme) {
|
|
|
31736
31737
|
const t = plain2(node.text);
|
|
31737
31738
|
const cb = fitCharBreaks(t, st.font, st.pt, textW2, textW2, _nullishCoalesce(g3.autoFitMinRatio, () => ( 101)));
|
|
31738
31739
|
const f = _nullishCoalesce(cb, () => ( (g3.autoFitMinRatio !== null ? fitParagraph(t, st.font, st.pt, textW2, textW2, g3.autoFitMinRatio) : null)));
|
|
31739
|
-
const base = { font: st.font, pt: st.pt, bold: st.bold, ratio: _nullishCoalesce(_optionalChain([f, 'optionalAccess',
|
|
31740
|
+
const base = { font: st.font, pt: st.pt, bold: st.bold, ratio: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _608 => _608.ratio]), () => ( 100)), spacing: _nullishCoalesce(_optionalChain([f, 'optionalAccess', _609 => _609.spacing]), () => ( 0)) };
|
|
31740
31741
|
const paraId = reg.para({ align: _nullishCoalesce(st.align, () => ( "JUSTIFY")), left, indent: -lay.hang, after: isMinistry ? 400 : 0, lineSp: isMinistry ? 130 : _nullishCoalesce(st.lineSp, () => ( scheme.lineSp)), keepWord: !cb, autoTab: true, widowOrphan: true });
|
|
31741
31742
|
const markerRun = markerRunXml(marker, reg.char({ font: st.font, pt: st.pt, bold: st.bold }), lay);
|
|
31742
31743
|
return `<hp:p paraPrIDRef="${paraId}" styleIDRef="0">${markerRun}${generateRuns(node.text, reg.char(base), inlineMapper(reg, base))}</hp:p>`;
|
|
@@ -31985,7 +31986,7 @@ function buildGongmunSectionV5(blocks, gongmun, deps, theme) {
|
|
|
31985
31986
|
fax: f.fax,
|
|
31986
31987
|
email: f.email,
|
|
31987
31988
|
disclosure: f.disclosure
|
|
31988
|
-
}, frame, isInternalApproval(_optionalChain([g3, 'access',
|
|
31989
|
+
}, frame, isInternalApproval(_optionalChain([g3, 'access', _610 => _610.docHead, 'optionalAccess', _611 => _611.to]))));
|
|
31989
31990
|
}
|
|
31990
31991
|
if (paras.length === 0) paras.push(`<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0"><hp:t></hp:t></hp:run></hp:p>`);
|
|
31991
31992
|
paras[0] = paras[0].replace(/<hp:run charPrIDRef="(\d+)">/, `<hp:run charPrIDRef="$1">${generateSecPr(g3, page)}`);
|
|
@@ -32017,9 +32018,9 @@ function legalDepthOf(marker) {
|
|
|
32017
32018
|
|
|
32018
32019
|
// src/hwpx/generator.ts
|
|
32019
32020
|
async function markdownToHwpx(markdown, options) {
|
|
32020
|
-
const theme = resolveTheme(_optionalChain([options, 'optionalAccess',
|
|
32021
|
-
const gongmun = _optionalChain([options, 'optionalAccess',
|
|
32022
|
-
const page = resolvePage(_optionalChain([options, 'optionalAccess',
|
|
32021
|
+
const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _612 => _612.theme]));
|
|
32022
|
+
const gongmun = _optionalChain([options, 'optionalAccess', _613 => _613.gongmun]) ? resolveGongmun(options.gongmun) : null;
|
|
32023
|
+
const page = resolvePage(_optionalChain([options, 'optionalAccess', _614 => _614.page]));
|
|
32023
32024
|
const { md: md2, defs } = extractFootnoteDefs(markdown);
|
|
32024
32025
|
beginInlineDoc(defs);
|
|
32025
32026
|
try {
|
|
@@ -32028,14 +32029,14 @@ async function markdownToHwpx(markdown, options) {
|
|
|
32028
32029
|
const staticBfEnd2 = staticBorderFillNext(gongmun, true);
|
|
32029
32030
|
const charBase = charVariantBase(false, true);
|
|
32030
32031
|
const fontBase = staticFontNext(gongmun, true);
|
|
32031
|
-
const remap2 = _optionalChain([options, 'optionalAccess',
|
|
32032
|
-
const bfReg2 = new TableBfRegistry(staticBfEnd2 + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
32033
|
-
const reg = new StyleRegistry(charBase + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
32032
|
+
const remap2 = _optionalChain([options, 'optionalAccess', _615 => _615.profile]) ? buildProfileRemap(options.profile, charBase, staticBfEnd2, fontBase) : null;
|
|
32033
|
+
const bfReg2 = new TableBfRegistry(staticBfEnd2 + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _616 => _616.borderFillXmls, 'access', _617 => _617.length]), () => ( 0))));
|
|
32034
|
+
const reg = new StyleRegistry(charBase + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _618 => _618.charPrXmls, 'access', _619 => _619.length]), () => ( 0))), 8, fontBase + (_nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _620 => _620.fontFaces, 'access', _621 => _621.length]), () => ( 0))), ["\uD568\uCD08\uB86C\uBC14\uD0D5", "\uD568\uCD08\uB86C\uB3CB\uC6C0", "HY\uACAC\uACE0\uB515"]);
|
|
32034
32035
|
const chartParts2 = [];
|
|
32035
|
-
const supplied2 = _optionalChain([options, 'optionalAccess',
|
|
32036
|
+
const supplied2 = _optionalChain([options, 'optionalAccess', _622 => _622.images]) ? new Map(Object.entries(options.images).map(([k, v]) => [k, v instanceof Uint8Array ? v : new Uint8Array(v)])) : void 0;
|
|
32036
32037
|
const images2 = new ImageRegistry(supplied2);
|
|
32037
32038
|
const res = buildGongmunSectionV5(blocks2, gongmun, { reg, bfReg: bfReg2, remap: remap2, images: images2, page, chartParts: chartParts2 }, theme);
|
|
32038
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
32039
|
+
if (_optionalChain([options, 'optionalAccess', _623 => _623.warnings])) options.warnings.push(...res.warnings);
|
|
32039
32040
|
if (remap2 && remap2.tables.length > 0 && remap2.tables.every((t) => !t.used)) {
|
|
32040
32041
|
console.warn(`[kordoc] format profile: \uD504\uB85C\uD544 \uD45C ${remap2.tables.length}\uAC1C\uAC00 \uBB38\uC11C \uD45C\uC640 \uB9E4\uCE6D\uB418\uC9C0 \uC54A\uC544 \uBBF8\uC801\uC6A9 (\uD589\xB7\uC5F4/\uCCAB \uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)`);
|
|
32041
32042
|
}
|
|
@@ -32048,10 +32049,10 @@ async function markdownToHwpx(markdown, options) {
|
|
|
32048
32049
|
theme,
|
|
32049
32050
|
gongmun,
|
|
32050
32051
|
[],
|
|
32051
|
-
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
32052
|
-
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
32052
|
+
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _624 => _624.borderFillXmls]), () => ( [])), ...bfReg2.emit()],
|
|
32053
|
+
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _625 => _625.charPrXmls]), () => ( [])), ...reg.charPrXmls],
|
|
32053
32054
|
[],
|
|
32054
|
-
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess',
|
|
32055
|
+
[..._nullishCoalesce(_optionalChain([remap2, 'optionalAccess', _626 => _626.fontFaces]), () => ( [])), ...reg.extraFonts],
|
|
32055
32056
|
{ paraPrXmls: reg.paraPrXmls, bodyFace: "\uD568\uCD08\uB86C\uBC14\uD0D5" }
|
|
32056
32057
|
));
|
|
32057
32058
|
zip2.file("Contents/section0.xml", res.xml);
|
|
@@ -32065,18 +32066,18 @@ async function markdownToHwpx(markdown, options) {
|
|
|
32065
32066
|
const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
|
|
32066
32067
|
const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
|
|
32067
32068
|
const staticBfEnd = staticBorderFillNext(gongmun);
|
|
32068
|
-
const remap = _optionalChain([options, 'optionalAccess',
|
|
32069
|
-
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
32069
|
+
const remap = _optionalChain([options, 'optionalAccess', _627 => _627.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _628 => _628.variants, 'optionalAccess', _629 => _629.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
|
|
32070
|
+
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _630 => _630.borderFillXmls, 'access', _631 => _631.length]), () => ( 0)))) : null;
|
|
32070
32071
|
const dfActive = !!gongmun && docframeActive(gongmun);
|
|
32071
|
-
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
32072
|
+
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _632 => _632.variants, 'optionalAccess', _633 => _633.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _634 => _634.charPrXmls, 'access', _635 => _635.length]), () => ( 0)));
|
|
32072
32073
|
const dfIds = dfActive ? docframeIds(dfBase) : null;
|
|
32073
32074
|
const dfXmls = dfActive ? docframeCharPrXmls(dfBase, richAssets) : [];
|
|
32074
32075
|
const lvBase = dfBase + dfXmls.length;
|
|
32075
32076
|
const lvIds = gongmun ? levelCharIds(gongmun, lvBase) : null;
|
|
32076
32077
|
const lvFonts = gongmun ? levelFontFaces(gongmun) : [];
|
|
32077
|
-
const lvXmls = gongmun ? levelCharPrXmls(gongmun, lvBase, staticFontNext(gongmun) + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
32078
|
+
const lvXmls = gongmun ? levelCharPrXmls(gongmun, lvBase, staticFontNext(gongmun) + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _636 => _636.fontFaces, 'access', _637 => _637.length]), () => ( 0))), richAssets ? 4 : 0) : [];
|
|
32078
32079
|
const chartParts = [];
|
|
32079
|
-
const supplied = _optionalChain([options, 'optionalAccess',
|
|
32080
|
+
const supplied = _optionalChain([options, 'optionalAccess', _638 => _638.images]) ? new Map(Object.entries(options.images).map(([k, v]) => [k, v instanceof Uint8Array ? v : new Uint8Array(v)])) : void 0;
|
|
32080
32081
|
const images = new ImageRegistry(supplied);
|
|
32081
32082
|
const sectionXml = blocksToSectionXml(blocks, theme, gongmun, gongmunList, fit, chartParts, bfReg, remap, dfIds, images, page, lvIds);
|
|
32082
32083
|
if (remap && remap.tables.length > 0) {
|
|
@@ -32085,7 +32086,7 @@ async function markdownToHwpx(markdown, options) {
|
|
|
32085
32086
|
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)`);
|
|
32086
32087
|
}
|
|
32087
32088
|
}
|
|
32088
|
-
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
32089
|
+
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _639 => _639.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _640 => _640.emit, 'call', _641 => _641()]), () => ( []))];
|
|
32089
32090
|
const zip = new (0, _jszip2.default)();
|
|
32090
32091
|
zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
|
|
32091
32092
|
zip.file("META-INF/container.xml", generateContainerXml());
|
|
@@ -32094,11 +32095,11 @@ async function markdownToHwpx(markdown, options) {
|
|
|
32094
32095
|
zip.file("Contents/header.xml", generateHeaderXml(
|
|
32095
32096
|
theme,
|
|
32096
32097
|
gongmun,
|
|
32097
|
-
_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
32098
|
+
_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _642 => _642.variants]), () => ( [])),
|
|
32098
32099
|
extraBorderFills,
|
|
32099
|
-
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
32100
|
-
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess',
|
|
32101
|
-
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
32100
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _643 => _643.charPrXmls]), () => ( [])), ...dfXmls, ...lvXmls],
|
|
32101
|
+
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _644 => _644.indentVariants]), () => ( [])),
|
|
32102
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _645 => _645.fontFaces]), () => ( [])), ...lvFonts]
|
|
32102
32103
|
));
|
|
32103
32104
|
zip.file("Contents/section0.xml", sectionXml);
|
|
32104
32105
|
for (const part of chartParts) zip.file(part.name, part.xml);
|
|
@@ -32151,7 +32152,7 @@ function diffBlocks(blocksA, blocksB) {
|
|
|
32151
32152
|
function alignBlocks(a, b) {
|
|
32152
32153
|
const m = a.length, n = b.length;
|
|
32153
32154
|
if (m * n > 1e7) return fallbackAlign(a, b);
|
|
32154
|
-
const textOf = (blk) => blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
32155
|
+
const textOf = (blk) => blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _646 => _646.text]), () => ( ""))).join(" ") : "";
|
|
32155
32156
|
const pa = a.map((blk) => textProfile(textOf(blk)));
|
|
32156
32157
|
const pb = b.map((blk) => textProfile(textOf(blk)));
|
|
32157
32158
|
const passCache = new Uint8Array(m * n);
|
|
@@ -32232,8 +32233,8 @@ function tableDimSim(a, b) {
|
|
|
32232
32233
|
}
|
|
32233
32234
|
function tableSimilarity(a, b) {
|
|
32234
32235
|
const dimSim = tableDimSim(a, b);
|
|
32235
|
-
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
32236
|
-
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
32236
|
+
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _647 => _647.text]), () => ( ""))).join(" ");
|
|
32237
|
+
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _648 => _648.text]), () => ( ""))).join(" ");
|
|
32237
32238
|
const contentSim = normalizedSimilarity(textsA, textsB);
|
|
32238
32239
|
return dimSim * 0.3 + contentSim * 0.7;
|
|
32239
32240
|
}
|
|
@@ -32244,8 +32245,8 @@ function diffTableCells(a, b) {
|
|
|
32244
32245
|
for (let r = 0; r < maxRows; r++) {
|
|
32245
32246
|
const row = [];
|
|
32246
32247
|
for (let c = 0; c < maxCols; c++) {
|
|
32247
|
-
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access',
|
|
32248
|
-
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access',
|
|
32248
|
+
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access', _649 => _649.cells, 'access', _650 => _650[r], 'optionalAccess', _651 => _651[c], 'optionalAccess', _652 => _652.text]) : void 0;
|
|
32249
|
+
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access', _653 => _653.cells, 'access', _654 => _654[r], 'optionalAccess', _655 => _655[c], 'optionalAccess', _656 => _656.text]) : void 0;
|
|
32249
32250
|
let type;
|
|
32250
32251
|
if (cellA === void 0) type = "added";
|
|
32251
32252
|
else if (cellB === void 0) type = "removed";
|
|
@@ -32295,7 +32296,7 @@ function builtinTemplateDir() {
|
|
|
32295
32296
|
for (const c of candidates) {
|
|
32296
32297
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
32297
32298
|
}
|
|
32298
|
-
throw new (0,
|
|
32299
|
+
throw new (0, _chunkRHMIEEAZcjs.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)");
|
|
32299
32300
|
}
|
|
32300
32301
|
function readBuiltinTemplate(t) {
|
|
32301
32302
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -32460,7 +32461,7 @@ function parseRenderStyles(headXml) {
|
|
|
32460
32461
|
const underlineEl = findChildByLocalName(el, "underline");
|
|
32461
32462
|
const textColor = el.getAttribute("textColor");
|
|
32462
32463
|
const fontRef = findChildByLocalName(el, "fontRef");
|
|
32463
|
-
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess',
|
|
32464
|
+
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _657 => _657.getAttribute, 'call', _658 => _658("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _659 => _659.getAttribute, 'call', _660 => _660("latin")])));
|
|
32464
32465
|
const face = fontId != null ? hangulFonts.get(fontId) : void 0;
|
|
32465
32466
|
styles.charPr.set(id, {
|
|
32466
32467
|
height: Number(el.getAttribute("height")) || 1e3,
|
|
@@ -32468,8 +32469,8 @@ function parseRenderStyles(headXml) {
|
|
|
32468
32469
|
italic: findChildByLocalName(el, "italic") != null,
|
|
32469
32470
|
underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
|
|
32470
32471
|
color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
|
|
32471
|
-
ratio: Number(_optionalChain([ratioEl, 'optionalAccess',
|
|
32472
|
-
spacing: Number(_optionalChain([spacingEl, 'optionalAccess',
|
|
32472
|
+
ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _661 => _661.getAttribute, 'call', _662 => _662("hangul")])) || 100,
|
|
32473
|
+
spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _663 => _663.getAttribute, 'call', _664 => _664("hangul")])) || 0,
|
|
32473
32474
|
fontFamily: face ? hwpFaceToCssStack(face) : void 0,
|
|
32474
32475
|
face
|
|
32475
32476
|
});
|
|
@@ -32481,7 +32482,7 @@ function parseRenderStyles(headXml) {
|
|
|
32481
32482
|
const id = el.getAttribute("id");
|
|
32482
32483
|
if (id != null) {
|
|
32483
32484
|
const align = findChildByLocalName(el, "align");
|
|
32484
|
-
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess',
|
|
32485
|
+
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _665 => _665.getAttribute, 'call', _666 => _666("horizontal")]) || "JUSTIFY");
|
|
32485
32486
|
styles.paraGeom.set(id, parseParaGeom(el));
|
|
32486
32487
|
const tab = el.getAttribute("tabPrIDRef");
|
|
32487
32488
|
if (tab != null) paraTabRef.set(id, tab);
|
|
@@ -32497,7 +32498,7 @@ function parseRenderStyles(headXml) {
|
|
|
32497
32498
|
};
|
|
32498
32499
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
32499
32500
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
32500
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
32501
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _667 => _667.getAttribute, 'call', _668 => _668("faceColor")]);
|
|
32501
32502
|
if (face && face.toLowerCase() !== "none") bf.fill = face;
|
|
32502
32503
|
styles.borderFill.set(id, bf);
|
|
32503
32504
|
}
|
|
@@ -32573,7 +32574,7 @@ function collectSites(scan) {
|
|
|
32573
32574
|
}
|
|
32574
32575
|
function attrOf3(openTag, name) {
|
|
32575
32576
|
const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
|
|
32576
|
-
return _optionalChain([m, 'optionalAccess',
|
|
32577
|
+
return _optionalChain([m, 'optionalAccess', _669 => _669[1]]);
|
|
32577
32578
|
}
|
|
32578
32579
|
function paraOpenTag(xml, para2) {
|
|
32579
32580
|
const end = xml.indexOf(">", para2.start);
|
|
@@ -32588,7 +32589,7 @@ function anchorRunInfo(xml, para2, anchor) {
|
|
|
32588
32589
|
if (!tr) return null;
|
|
32589
32590
|
const before2 = xml.slice(Math.max(0, para2.start), tr.contentStart);
|
|
32590
32591
|
const runOpen = [...before2.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
|
|
32591
|
-
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess',
|
|
32592
|
+
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _670 => _670[1]]), () => ( tr.prefix)), () => ( "hp"));
|
|
32592
32593
|
const charPr2 = runOpen && attrOf3(runOpen[0], "charPrIDRef") || "0";
|
|
32593
32594
|
const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
|
|
32594
32595
|
if (close === -1) return null;
|
|
@@ -32615,7 +32616,7 @@ function cellContentWidthMm(xml, cell2) {
|
|
|
32615
32616
|
if (width === null) return null;
|
|
32616
32617
|
let content = width;
|
|
32617
32618
|
const win = cellAddrWindow(xml, cell2);
|
|
32618
|
-
const mg = _optionalChain([win, 'optionalAccess',
|
|
32619
|
+
const mg = _optionalChain([win, 'optionalAccess', _671 => _671.match, 'call', _672 => _672(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
|
|
32619
32620
|
if (mg) {
|
|
32620
32621
|
content -= Number(_nullishCoalesce(attrOf3(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf3(mg[0], "right"), () => ( 0)));
|
|
32621
32622
|
}
|
|
@@ -32649,12 +32650,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
32649
32650
|
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>`;
|
|
32650
32651
|
}
|
|
32651
32652
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
32652
|
-
if (ops.length === 0) throw new (0,
|
|
32653
|
+
if (ops.length === 0) throw new (0, _chunkRHMIEEAZcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
32653
32654
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
32654
|
-
|
|
32655
|
+
_chunkRHMIEEAZcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
32655
32656
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
32656
|
-
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access',
|
|
32657
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
32657
|
+
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _673 => _673.match, 'call', _674 => _674(/(\d+)\.xml$/i), 'optionalAccess', _675 => _675[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _676 => _676.match, 'call', _677 => _677(/(\d+)\.xml$/i), 'optionalAccess', _678 => _678[1]]), () => ( 0))));
|
|
32658
|
+
if (sectionPaths.length === 0) throw new (0, _chunkRHMIEEAZcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
32658
32659
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
32659
32660
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
32660
32661
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -32695,11 +32696,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32695
32696
|
const manifestItems = [];
|
|
32696
32697
|
const placed = [];
|
|
32697
32698
|
for (const op of ops) {
|
|
32698
|
-
if (!op.anchor) throw new (0,
|
|
32699
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
32699
|
+
if (!op.anchor) throw new (0, _chunkRHMIEEAZcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
32700
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkRHMIEEAZcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
32700
32701
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
32701
|
-
if (!MIME[ext]) throw new (0,
|
|
32702
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
32702
|
+
if (!MIME[ext]) throw new (0, _chunkRHMIEEAZcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
32703
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkRHMIEEAZcjs.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)`);
|
|
32703
32704
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
32704
32705
|
let found = null;
|
|
32705
32706
|
let total = 0;
|
|
@@ -32732,7 +32733,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32732
32733
|
}
|
|
32733
32734
|
}
|
|
32734
32735
|
}
|
|
32735
|
-
throw new (0,
|
|
32736
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(
|
|
32736
32737
|
`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)})`
|
|
32737
32738
|
);
|
|
32738
32739
|
}
|
|
@@ -32740,9 +32741,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32740
32741
|
const xml = sectionXmls[si];
|
|
32741
32742
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
32742
32743
|
if (!run) {
|
|
32743
|
-
throw new (0,
|
|
32744
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
32744
32745
|
}
|
|
32745
|
-
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess',
|
|
32746
|
+
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _679 => _679.charPr, 'access', _680 => _680.get, 'call', _681 => _681(run.charPr), 'optionalAccess', _682 => _682.height]), () => ( 1e3));
|
|
32746
32747
|
const fontPt = charPrHeight / 100;
|
|
32747
32748
|
const emMm = fontPt * 25.4 / 72;
|
|
32748
32749
|
const lineHMm = emMm;
|
|
@@ -32751,7 +32752,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32751
32752
|
const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
|
|
32752
32753
|
const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
|
|
32753
32754
|
const paraPrId = _nullishCoalesce(attrOf3(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
|
|
32754
|
-
const align = _optionalChain([styles, 'optionalAccess',
|
|
32755
|
+
const align = _optionalChain([styles, 'optionalAccess', _683 => _683.paraAlign, 'access', _684 => _684.get, 'call', _685 => _685(paraPrId)]);
|
|
32755
32756
|
let alignShiftMm = 0;
|
|
32756
32757
|
if (align === "CENTER" || align === "RIGHT") {
|
|
32757
32758
|
const paraWMm = measureMm(site.para.text, emMm);
|
|
@@ -32847,7 +32848,7 @@ function parseBorderFills(headerDoc) {
|
|
|
32847
32848
|
};
|
|
32848
32849
|
const fillBrush = findChildByLocalName(bf, "fillBrush");
|
|
32849
32850
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
32850
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
32851
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _686 => _686.getAttribute, 'call', _687 => _687("faceColor")]);
|
|
32851
32852
|
if (face && face !== "none") def.fill = { faceColor: face };
|
|
32852
32853
|
map.set(id, def);
|
|
32853
32854
|
}
|
|
@@ -32879,7 +32880,7 @@ function parseCharPrs(headerDoc, hangulFonts) {
|
|
|
32879
32880
|
if (cp.getAttribute("italic") === "1") def.italic = true;
|
|
32880
32881
|
if (findChildByLocalName(cp, "underline")) def.underline = true;
|
|
32881
32882
|
const fontRef = findChildByLocalName(cp, "fontRef");
|
|
32882
|
-
const hangul = _optionalChain([fontRef, 'optionalAccess',
|
|
32883
|
+
const hangul = _optionalChain([fontRef, 'optionalAccess', _688 => _688.getAttribute, 'call', _689 => _689("hangul")]);
|
|
32883
32884
|
if (hangul) {
|
|
32884
32885
|
def.fontRef_hangul = hangul;
|
|
32885
32886
|
const face = hangulFonts.get(hangul);
|
|
@@ -32907,7 +32908,7 @@ function parseTable4(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
32907
32908
|
const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
|
|
32908
32909
|
const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
|
|
32909
32910
|
const sz = findChildByLocalName(tbl2, "sz");
|
|
32910
|
-
const width = _optionalChain([sz, 'optionalAccess',
|
|
32911
|
+
const width = _optionalChain([sz, 'optionalAccess', _690 => _690.getAttribute, 'call', _691 => _691("width")]) || void 0;
|
|
32911
32912
|
const cells = [];
|
|
32912
32913
|
const usedBf = /* @__PURE__ */ new Set();
|
|
32913
32914
|
const usedCp = /* @__PURE__ */ new Set();
|
|
@@ -32920,17 +32921,17 @@ function parseTable4(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
32920
32921
|
const addr = findChildByLocalName(tc2, "cellAddr");
|
|
32921
32922
|
const span2 = findChildByLocalName(tc2, "cellSpan");
|
|
32922
32923
|
const csz = findChildByLocalName(tc2, "cellSz");
|
|
32923
|
-
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
32924
|
-
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
32924
|
+
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _692 => _692.getAttribute, 'call', _693 => _693("rowAddr")])), () => ( 0));
|
|
32925
|
+
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _694 => _694.getAttribute, 'call', _695 => _695("colAddr")])), () => ( 0));
|
|
32925
32926
|
if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
|
|
32926
32927
|
if (row === 0) row0Texts.set(col, directCellText(tc2));
|
|
32927
|
-
const colSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess',
|
|
32928
|
-
const rowSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess',
|
|
32928
|
+
const colSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess', _696 => _696.getAttribute, 'call', _697 => _697("colSpan")])), () => ( 1));
|
|
32929
|
+
const rowSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess', _698 => _698.getAttribute, 'call', _699 => _699("rowSpan")])), () => ( 1));
|
|
32929
32930
|
const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
|
|
32930
32931
|
const cpId = firstRunCharPr(tc2);
|
|
32931
32932
|
const cell2 = { row, col, rowSpan, colSpan };
|
|
32932
|
-
const w = _optionalChain([csz, 'optionalAccess',
|
|
32933
|
-
const hh = _optionalChain([csz, 'optionalAccess',
|
|
32933
|
+
const w = _optionalChain([csz, 'optionalAccess', _700 => _700.getAttribute, 'call', _701 => _701("width")]);
|
|
32934
|
+
const hh = _optionalChain([csz, 'optionalAccess', _702 => _702.getAttribute, 'call', _703 => _703("height")]);
|
|
32934
32935
|
if (w) cell2.width_hwpunit = w;
|
|
32935
32936
|
if (hh) cell2.height_hwpunit = hh;
|
|
32936
32937
|
if (bfId) {
|
|
@@ -33018,16 +33019,16 @@ function pick(map, keys) {
|
|
|
33018
33019
|
return out;
|
|
33019
33020
|
}
|
|
33020
33021
|
async function hwpxToProfile(input) {
|
|
33021
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
33022
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkRHMIEEAZcjs.toArrayBuffer.call(void 0, input);
|
|
33022
33023
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
33023
33024
|
const parser = createXmlParser();
|
|
33024
|
-
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access',
|
|
33025
|
+
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _704 => _704.file, 'call', _705 => _705(/[Hh]eader\.xml$/), 'optionalAccess', _706 => _706[0]])));
|
|
33025
33026
|
let headerXml = "<root/>";
|
|
33026
33027
|
if (headerFile) headerXml = await headerFile.async("text");
|
|
33027
33028
|
const headerDoc = parser.parseFromString(headerXml, "text/xml");
|
|
33028
33029
|
const borderFills = parseBorderFills(headerDoc);
|
|
33029
33030
|
const charPrs = parseCharPrs(headerDoc, parseHangulFonts(headerDoc));
|
|
33030
|
-
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access',
|
|
33031
|
+
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _707 => _707.name, 'access', _708 => _708.match, 'call', _709 => _709(/(\d+)\.xml$/), 'optionalAccess', _710 => _710[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _711 => _711.name, 'access', _712 => _712.match, 'call', _713 => _713(/(\d+)\.xml$/), 'optionalAccess', _714 => _714[1]]), () => ( null))), () => ( 0))));
|
|
33031
33032
|
const tables = [];
|
|
33032
33033
|
let tableIndex = 0;
|
|
33033
33034
|
for (const f of sectionFiles) {
|
|
@@ -33473,7 +33474,7 @@ function lintGongmunText(text, opts) {
|
|
|
33473
33474
|
}
|
|
33474
33475
|
}
|
|
33475
33476
|
}
|
|
33476
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
33477
|
+
if (_optionalChain([opts, 'optionalAccess', _715 => _715.document]) && /^\s*붙\s*임(?![가-힣])/m.test(text) && !/끝\.\s*$/m.test(text)) {
|
|
33477
33478
|
findings.push({
|
|
33478
33479
|
line: lines.length,
|
|
33479
33480
|
match: "\uBD99\uC784",
|
|
@@ -33743,7 +33744,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
|
|
|
33743
33744
|
var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
|
|
33744
33745
|
function patchTableRows(input) {
|
|
33745
33746
|
const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
|
|
33746
|
-
const xml = _optionalChain([ctx, 'access',
|
|
33747
|
+
const xml = _optionalChain([ctx, 'access', _716 => _716.scans, 'access', _717 => _717[scanTable.sectionIndex], 'optionalAccess', _718 => _718.xml]);
|
|
33747
33748
|
if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
|
|
33748
33749
|
const numRows = table2.rows;
|
|
33749
33750
|
if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
|
|
@@ -33910,7 +33911,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
|
|
|
33910
33911
|
const rr = scanTable.rowRanges[template];
|
|
33911
33912
|
const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
|
|
33912
33913
|
const scan = scanSectionXml(wrapped, 0);
|
|
33913
|
-
const row = _optionalChain([scan, 'access',
|
|
33914
|
+
const row = _optionalChain([scan, 'access', _719 => _719.tables, 'access', _720 => _720[0], 'optionalAccess', _721 => _721.rows, 'access', _722 => _722[0]]);
|
|
33914
33915
|
if (!row || row.length !== cells.length) return null;
|
|
33915
33916
|
const splices = allLinesegRemovalSplices(wrapped);
|
|
33916
33917
|
for (let i = 0; i < cells.length; i++) {
|
|
@@ -33953,7 +33954,7 @@ function rowHeightOf(fragment) {
|
|
|
33953
33954
|
}
|
|
33954
33955
|
function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
|
|
33955
33956
|
const from = scanTable.start + tblOpenLen;
|
|
33956
|
-
const to = _nullishCoalesce(_optionalChain([scanTable, 'access',
|
|
33957
|
+
const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _723 => _723.rowRanges, 'access', _724 => _724[0], 'optionalAccess', _725 => _725.start]), () => ( from));
|
|
33957
33958
|
const slice = xml.slice(from, to);
|
|
33958
33959
|
const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
|
|
33959
33960
|
if (!szM || szM.index === void 0) return null;
|
|
@@ -34028,7 +34029,7 @@ function buildEmbeddedLineSplices(para2, xml, newLines) {
|
|
|
34028
34029
|
}
|
|
34029
34030
|
}
|
|
34030
34031
|
offset += line.length;
|
|
34031
|
-
offset += _nullishCoalesce(_optionalChain([text, 'access',
|
|
34032
|
+
offset += _nullishCoalesce(_optionalChain([text, 'access', _726 => _726.slice, 'call', _727 => _727(offset), 'access', _728 => _728.match, 'call', _729 => _729(/^(?:\r\n|\r|\n)/), 'optionalAccess', _730 => _730[0], 'access', _731 => _731.length]), () => ( 0));
|
|
34032
34033
|
}
|
|
34033
34034
|
return splices;
|
|
34034
34035
|
}
|
|
@@ -34210,9 +34211,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
|
|
|
34210
34211
|
});
|
|
34211
34212
|
}
|
|
34212
34213
|
function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
|
|
34213
|
-
const irCell = _optionalChain([table2, 'access',
|
|
34214
|
+
const irCell = _optionalChain([table2, 'access', _732 => _732.cells, 'access', _733 => _733[oc.gridR], 'optionalAccess', _734 => _734[oc.gridC]]);
|
|
34214
34215
|
const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
|
|
34215
|
-
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess',
|
|
34216
|
+
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _735 => _735.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
|
|
34216
34217
|
if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
|
|
34217
34218
|
return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
|
|
34218
34219
|
}
|
|
@@ -34239,8 +34240,8 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
34239
34240
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
34240
34241
|
const t = line.trim();
|
|
34241
34242
|
if (!t) return "";
|
|
34242
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
34243
|
-
return
|
|
34243
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkW5NXOMCDcjs.escapeGfm.call(void 0, t)}**`;
|
|
34244
|
+
return _chunkW5NXOMCDcjs.escapeGfm.call(void 0, t);
|
|
34244
34245
|
}).filter(Boolean);
|
|
34245
34246
|
if (replicaLines.join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
34246
34247
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -34254,7 +34255,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
34254
34255
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
34255
34256
|
const replica = [];
|
|
34256
34257
|
for (let r = 0; r < table2.rows; r++) {
|
|
34257
|
-
const line =
|
|
34258
|
+
const line = _chunkW5NXOMCDcjs.escapeGfm.call(void 0, sanitizeText(table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
34258
34259
|
if (line) replica.push({ line, gridR: r });
|
|
34259
34260
|
}
|
|
34260
34261
|
if (replica.map((x) => x.line).join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
@@ -34280,7 +34281,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
34280
34281
|
};
|
|
34281
34282
|
const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
|
|
34282
34283
|
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)");
|
|
34283
|
-
const irCell = _optionalChain([table2, 'access',
|
|
34284
|
+
const irCell = _optionalChain([table2, 'access', _736 => _736.cells, 'access', _737 => _737[gridR], 'optionalAccess', _738 => _738[gridC]]);
|
|
34284
34285
|
const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
|
|
34285
34286
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
34286
34287
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -34294,12 +34295,12 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
34294
34295
|
const nonEmpty = cell2.paragraphs.filter((p) => normForMatch(p.text) !== "");
|
|
34295
34296
|
if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
|
|
34296
34297
|
const target = nonEmpty.length === 1 ? nonEmpty[0] : void 0;
|
|
34297
|
-
const sourceLines = _optionalChain([target, 'optionalAccess',
|
|
34298
|
+
const sourceLines = _optionalChain([target, 'optionalAccess', _739 => _739.text, 'access', _740 => _740.split, 'call', _741 => _741(/\r\n|\r|\n/), 'access', _742 => _742.map, 'call', _743 => _743((line) => line.trim())]);
|
|
34298
34299
|
const renderedLines = unescapeGfmCell(stripCellTokens(before2)).split("\n").map((line) => line.trim());
|
|
34299
|
-
if (target && _optionalChain([sourceLines, 'optionalAccess',
|
|
34300
|
-
const xml = _optionalChain([ctx, 'access',
|
|
34300
|
+
if (target && _optionalChain([sourceLines, 'optionalAccess', _744 => _744.length]) === origLineCount && sourceLines.every((line, i) => line === renderedLines[i]) && !extractCellTokens(before2)) {
|
|
34301
|
+
const xml = _optionalChain([ctx, 'access', _745 => _745.scans, 'access', _746 => _746[target.sectionIndex], 'optionalAccess', _747 => _747.xml]);
|
|
34301
34302
|
const precise = xml === void 0 ? null : buildEmbeddedLineSplices(target, xml, newLines);
|
|
34302
|
-
if (_optionalChain([precise, 'optionalAccess',
|
|
34303
|
+
if (_optionalChain([precise, 'optionalAccess', _748 => _748.length])) {
|
|
34303
34304
|
ctx.sectionSplices[target.sectionIndex].push(...precise);
|
|
34304
34305
|
return 1;
|
|
34305
34306
|
}
|
|
@@ -34315,7 +34316,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
34315
34316
|
const target = cell2.paragraphs[0];
|
|
34316
34317
|
if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
|
|
34317
34318
|
const value = newLines.join(" ");
|
|
34318
|
-
const xml = _optionalChain([ctx, 'access',
|
|
34319
|
+
const xml = _optionalChain([ctx, 'access', _749 => _749.scans, 'access', _750 => _750[target.sectionIndex], 'optionalAccess', _751 => _751.xml]);
|
|
34319
34320
|
const rawT = xml ? paraTText(target, xml) : null;
|
|
34320
34321
|
let sp;
|
|
34321
34322
|
if (xml && rawT === null) {
|
|
@@ -34349,7 +34350,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
34349
34350
|
}
|
|
34350
34351
|
for (let i = 0; i < nonEmpty.length; i++) {
|
|
34351
34352
|
if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
|
|
34352
|
-
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access',
|
|
34353
|
+
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _752 => _752.scans, 'access', _753 => _753[nonEmpty[i].sectionIndex], 'optionalAccess', _754 => _754.xml]));
|
|
34353
34354
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
34354
34355
|
splices.push(...sp);
|
|
34355
34356
|
sectionIndex = nonEmpty[i].sectionIndex;
|
|
@@ -34430,7 +34431,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
34430
34431
|
const paths = parseSectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
34431
34432
|
if (paths.length > 0) return paths;
|
|
34432
34433
|
}
|
|
34433
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
34434
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkRHMIEEAZcjs.compareSectionPaths);
|
|
34434
34435
|
}
|
|
34435
34436
|
|
|
34436
34437
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -34559,7 +34560,7 @@ var Surgeon = (_class9 = class {
|
|
|
34559
34560
|
/** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
|
|
34560
34561
|
findEntry(path) {
|
|
34561
34562
|
const parts = path.replace(/^\//, "").split("/");
|
|
34562
|
-
let scope = _nullishCoalesce(_optionalChain([this, 'access',
|
|
34563
|
+
let scope = _nullishCoalesce(_optionalChain([this, 'access', _755 => _755.entries, 'access', _756 => _756[0], 'optionalAccess', _757 => _757.child]), () => ( -1));
|
|
34563
34564
|
let current;
|
|
34564
34565
|
for (const part of parts) {
|
|
34565
34566
|
const search = (idx) => {
|
|
@@ -34853,8 +34854,8 @@ function serializeRecords(recs, repl, inserts) {
|
|
|
34853
34854
|
parts.push(header, data);
|
|
34854
34855
|
};
|
|
34855
34856
|
for (let i = 0; i < recs.length; i++) {
|
|
34856
|
-
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess',
|
|
34857
|
-
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess',
|
|
34857
|
+
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _758 => _758.get, 'call', _759 => _759(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
|
|
34858
|
+
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _760 => _760.get, 'call', _761 => _761(i)]), () => ( recs[i].data)));
|
|
34858
34859
|
}
|
|
34859
34860
|
return Buffer.concat(parts);
|
|
34860
34861
|
}
|
|
@@ -34973,7 +34974,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
34973
34974
|
return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
|
|
34974
34975
|
}
|
|
34975
34976
|
const fhEntry = CFB2.find(cfb, "/FileHeader");
|
|
34976
|
-
if (!_optionalChain([fhEntry, 'optionalAccess',
|
|
34977
|
+
if (!_optionalChain([fhEntry, 'optionalAccess', _762 => _762.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
34977
34978
|
let flags;
|
|
34978
34979
|
try {
|
|
34979
34980
|
flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
|
|
@@ -34990,7 +34991,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
34990
34991
|
origBlocks = kept.blocks;
|
|
34991
34992
|
const visual = parseHwp5Document(originalBuf).markdown;
|
|
34992
34993
|
if (kept.markdown !== visual && editedMarkdown === visual) {
|
|
34993
|
-
const verification2 = _optionalChain([options, 'optionalAccess',
|
|
34994
|
+
const verification2 = _optionalChain([options, 'optionalAccess', _763 => _763.verify]) === false ? void 0 : diffUnitLists(splitMarkdownUnits(visual), splitMarkdownUnits(editedMarkdown));
|
|
34994
34995
|
return { success: true, data: new Uint8Array(original), applied: 0, skipped, verification: verification2 };
|
|
34995
34996
|
}
|
|
34996
34997
|
if (editedFromVisual(kept.markdown, visual, editedMarkdown)) return fail(LAYOUT_MODE_MISMATCH);
|
|
@@ -35002,7 +35003,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
35002
35003
|
const scans = [];
|
|
35003
35004
|
for (let i = 0; i < sectionPaths.length; i++) {
|
|
35004
35005
|
const entry = CFB2.find(cfb, sectionPaths[i]);
|
|
35005
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
35006
|
+
if (!_optionalChain([entry, 'optionalAccess', _764 => _764.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
|
|
35006
35007
|
let stream;
|
|
35007
35008
|
try {
|
|
35008
35009
|
stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
@@ -35053,7 +35054,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
35053
35054
|
}
|
|
35054
35055
|
}
|
|
35055
35056
|
let verification;
|
|
35056
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
35057
|
+
if (_optionalChain([options, 'optionalAccess', _765 => _765.verify]) !== false) {
|
|
35057
35058
|
try {
|
|
35058
35059
|
const reparsed = parseHwp5Document(Buffer.from(data), { layoutTables: "keep" });
|
|
35059
35060
|
const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
|
|
@@ -35148,7 +35149,7 @@ function tableContentScore(irTable, scanTable) {
|
|
|
35148
35149
|
for (const [key, scanCell] of scanTable.cells) {
|
|
35149
35150
|
const comma = key.indexOf(",");
|
|
35150
35151
|
const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
|
|
35151
|
-
const irCell = _optionalChain([irTable, 'access',
|
|
35152
|
+
const irCell = _optionalChain([irTable, 'access', _766 => _766.cells, 'access', _767 => _767[r], 'optionalAccess', _768 => _768[c]]);
|
|
35152
35153
|
if (!irCell) continue;
|
|
35153
35154
|
const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
|
|
35154
35155
|
const b = normForMatch(stripCellTokens(irCell.text));
|
|
@@ -35184,7 +35185,7 @@ function handleModified(orig, edited, ctx) {
|
|
|
35184
35185
|
}
|
|
35185
35186
|
function patchParagraph(block, orig, edited, ctx, skip) {
|
|
35186
35187
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
35187
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
35188
|
+
if (!_optionalChain([mapping, 'optionalAccess', _769 => _769.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)");
|
|
35188
35189
|
const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
|
|
35189
35190
|
let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
|
|
35190
35191
|
if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
|
|
@@ -35342,8 +35343,8 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
35342
35343
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
35343
35344
|
const t = line.trim();
|
|
35344
35345
|
if (!t) return "";
|
|
35345
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
35346
|
-
return
|
|
35346
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkW5NXOMCDcjs.escapeGfm.call(void 0, t)}**`;
|
|
35347
|
+
return _chunkW5NXOMCDcjs.escapeGfm.call(void 0, t);
|
|
35347
35348
|
}).filter(Boolean);
|
|
35348
35349
|
if (replicaLines.join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
35349
35350
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -35357,7 +35358,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
35357
35358
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
35358
35359
|
const replica = [];
|
|
35359
35360
|
for (let r = 0; r < table2.rows; r++) {
|
|
35360
|
-
const line =
|
|
35361
|
+
const line = _chunkW5NXOMCDcjs.escapeGfm.call(void 0, sanitizeText(table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
35361
35362
|
if (line) replica.push({ line, gridR: r });
|
|
35362
35363
|
}
|
|
35363
35364
|
if (replica.map((x) => x.line).join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
@@ -35383,7 +35384,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
35383
35384
|
};
|
|
35384
35385
|
const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
|
|
35385
35386
|
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)");
|
|
35386
|
-
const irCell = _optionalChain([table2, 'access',
|
|
35387
|
+
const irCell = _optionalChain([table2, 'access', _770 => _770.cells, 'access', _771 => _771[gridR], 'optionalAccess', _772 => _772[gridC]]);
|
|
35387
35388
|
const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
|
|
35388
35389
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
35389
35390
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -35658,7 +35659,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
35658
35659
|
origBlocks = parsed.blocks;
|
|
35659
35660
|
const visual = await parseHwpxDocument(u8ToArrayBuffer(original));
|
|
35660
35661
|
if (parsed.markdown !== visual.markdown && editedMarkdown === visual.markdown) {
|
|
35661
|
-
const verification2 = _optionalChain([options, 'optionalAccess',
|
|
35662
|
+
const verification2 = _optionalChain([options, 'optionalAccess', _773 => _773.verify]) === false ? void 0 : diffUnitLists(splitMarkdownUnits(visual.markdown), splitMarkdownUnits(editedMarkdown));
|
|
35662
35663
|
return { success: true, data: new Uint8Array(original), applied: 0, skipped, verification: verification2 };
|
|
35663
35664
|
}
|
|
35664
35665
|
if (editedFromVisual(parsed.markdown, visual.markdown, editedMarkdown)) return { success: false, applied: 0, skipped, error: LAYOUT_MODE_MISMATCH };
|
|
@@ -35743,7 +35744,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
35743
35744
|
}
|
|
35744
35745
|
}
|
|
35745
35746
|
let verification;
|
|
35746
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
35747
|
+
if (_optionalChain([options, 'optionalAccess', _774 => _774.verify]) !== false) {
|
|
35747
35748
|
try {
|
|
35748
35749
|
const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data), { layoutTables: "keep" });
|
|
35749
35750
|
verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
|
|
@@ -35761,17 +35762,17 @@ function buildOrigUnits(blocks) {
|
|
|
35761
35762
|
let chunk;
|
|
35762
35763
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
35763
35764
|
const next = blocks[i + 1];
|
|
35764
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
35765
|
-
chunk =
|
|
35765
|
+
if (_optionalChain([next, 'optionalAccess', _775 => _775.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
35766
|
+
chunk = _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
35766
35767
|
} else {
|
|
35767
|
-
chunk =
|
|
35768
|
+
chunk = _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, [block]);
|
|
35768
35769
|
}
|
|
35769
35770
|
if (chunk) {
|
|
35770
35771
|
const subUnits = splitMarkdownUnits(chunk);
|
|
35771
35772
|
const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
|
|
35772
35773
|
for (let s = 0; s < subUnits.length; s++) {
|
|
35773
35774
|
const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
|
|
35774
|
-
if (block.type === "table" && _optionalChain([block, 'access',
|
|
35775
|
+
if (block.type === "table" && _optionalChain([block, 'access', _776 => _776.table, 'optionalAccess', _777 => _777.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
|
|
35775
35776
|
u.role = "caption";
|
|
35776
35777
|
}
|
|
35777
35778
|
units.push(u);
|
|
@@ -35980,7 +35981,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
35980
35981
|
const ti = ctx.tableInsert;
|
|
35981
35982
|
if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
|
|
35982
35983
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
35983
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
35984
|
+
if (!_optionalChain([mapping, 'optionalAccess', _778 => _778.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");
|
|
35984
35985
|
const para2 = mapping.para;
|
|
35985
35986
|
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");
|
|
35986
35987
|
const scan = ctx.scans[para2.sectionIndex];
|
|
@@ -36008,7 +36009,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
36008
36009
|
}
|
|
36009
36010
|
function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
36010
36011
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
36011
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
36012
|
+
if (!_optionalChain([mapping, 'optionalAccess', _779 => _779.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)");
|
|
36012
36013
|
if (block.text && block.text.includes("\n")) {
|
|
36013
36014
|
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)");
|
|
36014
36015
|
}
|
|
@@ -36025,7 +36026,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
36025
36026
|
ctx.skipped.push({ reason: "\uAC01\uC8FC \uD45C\uAE30 \uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 \u2014 \uAC01\uC8FC \uC720\uC9C0, \uBCF8\uBB38\uB9CC \uC801\uC6A9", before: `(\uC8FC: ${block.footnoteText})` });
|
|
36026
36027
|
}
|
|
36027
36028
|
}
|
|
36028
|
-
if (_optionalChain([mapping, 'access',
|
|
36029
|
+
if (_optionalChain([mapping, 'access', _780 => _780.noteMarks, 'optionalAccess', _781 => _781.length])) {
|
|
36029
36030
|
const r = removeNoteMarks(newPlain, mapping.noteMarks);
|
|
36030
36031
|
newPlain = r.text;
|
|
36031
36032
|
if (r.missing.length) ctx.skipped.push({ reason: "\uAC01\uC8FC \uCC38\uC870 \uBD80\uD638 \uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 \u2014 \uAC01\uC8FC \uC720\uC9C0, \uBCF8\uBB38\uB9CC \uC801\uC6A9", before: r.missing.join(" ") });
|
|
@@ -36044,7 +36045,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
36044
36045
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
36045
36046
|
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");
|
|
36046
36047
|
}
|
|
36047
|
-
const xml = _optionalChain([ctx, 'access',
|
|
36048
|
+
const xml = _optionalChain([ctx, 'access', _782 => _782.scans, 'access', _783 => _783[mapping.para.sectionIndex], 'optionalAccess', _784 => _784.xml]);
|
|
36048
36049
|
const splices = _nullishCoalesce((xml ? markerRunSplices(mapping.para, xml, newPlain) : null), () => ( buildParagraphSplices(mapping.para, newPlain, xml)));
|
|
36049
36050
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
36050
36051
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
@@ -36566,7 +36567,7 @@ var REF_NOUN = alt([
|
|
|
36566
36567
|
]);
|
|
36567
36568
|
var REF = `\\s?\\((?!(?:${REF_NOUN})[),])[\uAC00-\uD7A3]{1,6}(?:\\d{0,2}(?:\uB3D9|\uB9AC)|\\d{1,2}\uAC00)(?:,\\s?[^)]{1,30})?\\)`;
|
|
36568
36569
|
var PLACEHOLDER_NO = /(?<![\d-])0+(?![\d])/;
|
|
36569
|
-
var realNumber = (x) => !PLACEHOLDER_NO.test(_nullishCoalesce(_optionalChain([x, 'access',
|
|
36570
|
+
var realNumber = (x) => !PLACEHOLDER_NO.test(_nullishCoalesce(_optionalChain([x, 'access', _785 => _785.m, 'access', _786 => _786.groups, 'optionalAccess', _787 => _787.rest]), () => ( "")));
|
|
36570
36571
|
var ADDRESS_VARIANTS = [
|
|
36571
36572
|
{
|
|
36572
36573
|
// 도로명 주소 — 읍·면, 동·리("서울시 도봉구 창동 우이천로 4다길 9"·"서천군 판교면 판교리 대백제로 1999") 뒤도, 참고항목까지
|
|
@@ -37675,9 +37676,9 @@ var REGION_WORDS = /* @__PURE__ */ new Set([...SIDO, ...SIGUNGU, ...SIGUNGU.filt
|
|
|
37675
37676
|
var NON_NAME_END = /(?:적|하여|하는|하고|하며|하게|하기|하면|하다|한다|했다|는데|니다|습니|다고|해야|해서|되는|되어|된다|지만|니까|와서|워서)$/;
|
|
37676
37677
|
var FOREIGN_SYLLABLE = /[스트크드브프즈츠끄뜨쁘쓰쯔플클블러케퍼커터텔톤튼픈핀펜헨앤엔엠켓렛쇼핑]/;
|
|
37677
37678
|
var TITLE_SET = /* @__PURE__ */ new Set([...TITLES, ...RANKS, ...PARTY_ROLES]);
|
|
37678
|
-
var g = (x, name) => _nullishCoalesce(_optionalChain([x, 'access',
|
|
37679
|
+
var g = (x, name) => _nullishCoalesce(_optionalChain([x, 'access', _788 => _788.m, 'access', _789 => _789.groups, 'optionalAccess', _790 => _790[name]]), () => ( ""));
|
|
37679
37680
|
var nameOf = (x) => g(x, "dsur") + g(x, "dgiven") + g(x, "sur") + g(x, "given") + g(x, "given1");
|
|
37680
|
-
var span = (x) => _optionalChain([x, 'access',
|
|
37681
|
+
var span = (x) => _optionalChain([x, 'access', _791 => _791.m, 'access', _792 => _792.indices, 'optionalAccess', _793 => _793.groups, 'optionalAccess', _794 => _794.n]);
|
|
37681
37682
|
var nextIs = (x, re) => {
|
|
37682
37683
|
const n = span(x);
|
|
37683
37684
|
return !!n && re.test(x.m.input.slice(n[1], n[1] + 1));
|
|
@@ -38049,7 +38050,7 @@ function labelsBefore(norm2, start) {
|
|
|
38049
38050
|
return labelsIn(win);
|
|
38050
38051
|
}
|
|
38051
38052
|
var OTHER_AFTER_RE = /^\s{0,2}[(\[]?\s{0,2}(?:접\s*수|신\s*청|주\s*문|사\s*건|과\s*제|문\s*서|관\s*리|부\s*품|제\s*품|모\s*델|코\s*드|시\s*리\s*얼|serial|model)/i;
|
|
38052
|
-
var g2 = (x, name) => _nullishCoalesce(_optionalChain([x, 'access',
|
|
38053
|
+
var g2 = (x, name) => _nullishCoalesce(_optionalChain([x, 'access', _795 => _795.m, 'access', _796 => _796.groups, 'optionalAccess', _797 => _797[name]]), () => ( ""));
|
|
38053
38054
|
var has = (x, c) => x.ctx().has(c);
|
|
38054
38055
|
var crnOnly = (x) => has(x, "crn") && !has(x, "rrn");
|
|
38055
38056
|
var after = (x, n = 16) => {
|
|
@@ -38357,9 +38358,9 @@ function normalizeForDetect(text) {
|
|
|
38357
38358
|
}
|
|
38358
38359
|
function maskMatch(orig, norm2, start, x, v, maskChar) {
|
|
38359
38360
|
const chars = orig.split("");
|
|
38360
|
-
const idx = _optionalChain([x, 'access',
|
|
38361
|
+
const idx = _optionalChain([x, 'access', _798 => _798.m, 'access', _799 => _799.indices, 'optionalAccess', _800 => _800.groups]);
|
|
38361
38362
|
for (const name of v.mask) {
|
|
38362
|
-
const r = _optionalChain([idx, 'optionalAccess',
|
|
38363
|
+
const r = _optionalChain([idx, 'optionalAccess', _801 => _801[name]]);
|
|
38363
38364
|
if (!r) continue;
|
|
38364
38365
|
for (let i = r[0] - start; i < r[1] - start; i++) {
|
|
38365
38366
|
if (v.maskAll || /[\p{L}\p{N}]/u.test(norm2[start + i])) chars[i] = maskChar;
|
|
@@ -38384,7 +38385,7 @@ function detect(text, rules, maskChar, headerAt) {
|
|
|
38384
38385
|
const re = v.re;
|
|
38385
38386
|
re.lastIndex = 0;
|
|
38386
38387
|
for (let m = re.exec(norm2); m !== null; m = re.exec(norm2)) {
|
|
38387
|
-
const sg = v.span ? _optionalChain([m, 'access',
|
|
38388
|
+
const sg = v.span ? _optionalChain([m, 'access', _802 => _802.indices, 'optionalAccess', _803 => _803.groups, 'optionalAccess', _804 => _804[v.span]]) : void 0;
|
|
38388
38389
|
const start = sg ? sg[0] : m.index;
|
|
38389
38390
|
const end = sg ? sg[1] : start + m[0].length;
|
|
38390
38391
|
const retry = () => {
|
|
@@ -38413,7 +38414,7 @@ function detect(text, rules, maskChar, headerAt) {
|
|
|
38413
38414
|
const x = {
|
|
38414
38415
|
m,
|
|
38415
38416
|
ctx,
|
|
38416
|
-
header: () => _optionalChain([headerAt, 'optionalCall',
|
|
38417
|
+
header: () => _optionalChain([headerAt, 'optionalCall', _805 => _805(start)]),
|
|
38417
38418
|
prev: () => {
|
|
38418
38419
|
let best;
|
|
38419
38420
|
for (const o of occupied) if (o.end <= start && (!best || o.end > best.end)) best = o;
|
|
@@ -38441,9 +38442,9 @@ function applyHits(text, hits) {
|
|
|
38441
38442
|
return out + text.slice(cursor);
|
|
38442
38443
|
}
|
|
38443
38444
|
function redactText(text, options) {
|
|
38444
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
38445
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _806 => _806.maskChar]), () => ( "\u25CF"));
|
|
38445
38446
|
assertMaskChar(maskChar);
|
|
38446
|
-
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
38447
|
+
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _807 => _807.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
38447
38448
|
if (text === "" || rules.length === 0) return { text, hits: [] };
|
|
38448
38449
|
const hits = detect(text, rules, maskChar);
|
|
38449
38450
|
return { text: applyHits(text, hits), hits };
|
|
@@ -38461,7 +38462,7 @@ function htmlCells(line) {
|
|
|
38461
38462
|
const out = [];
|
|
38462
38463
|
let col = 0;
|
|
38463
38464
|
for (const m of line.matchAll(/<t([dh])\b([^>]*)>([\s\S]*?)<\/t\1>/gi)) {
|
|
38464
|
-
const span2 = Math.max(1, Number(_nullishCoalesce(_optionalChain([m, 'access',
|
|
38465
|
+
const span2 = Math.max(1, Number(_nullishCoalesce(_optionalChain([m, 'access', _808 => _808[2], 'access', _809 => _809.match, 'call', _810 => _810(/colspan="?(\d+)/i), 'optionalAccess', _811 => _811[1]]), () => ( 1))));
|
|
38465
38466
|
out.push({ start: m.index, end: m.index + m[0].length, col, span: span2, text: m[3].replace(/<[^>]*>/g, " ") });
|
|
38466
38467
|
col += span2;
|
|
38467
38468
|
}
|
|
@@ -38503,7 +38504,7 @@ function tableHeaderContext(lines) {
|
|
|
38503
38504
|
const c = cells.find((x) => off >= x.start && off < x.end);
|
|
38504
38505
|
if (!c) return void 0;
|
|
38505
38506
|
const h = hdr.find((x) => c.col >= x.col && c.col < x.col + x.span);
|
|
38506
|
-
return _optionalChain([h, 'optionalAccess',
|
|
38507
|
+
return _optionalChain([h, 'optionalAccess', _812 => _812.text]);
|
|
38507
38508
|
});
|
|
38508
38509
|
}
|
|
38509
38510
|
}
|
|
@@ -38572,9 +38573,9 @@ function detectMarkdownLine(line, rules, maskChar, headerAt) {
|
|
|
38572
38573
|
});
|
|
38573
38574
|
}
|
|
38574
38575
|
function redactMarkdown(markdown, options) {
|
|
38575
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
38576
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _813 => _813.maskChar]), () => ( "\u25CF"));
|
|
38576
38577
|
assertMaskChar(maskChar);
|
|
38577
|
-
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
38578
|
+
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _814 => _814.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
38578
38579
|
const lines = markdown.split("\n");
|
|
38579
38580
|
const headers = tableHeaderContext(lines);
|
|
38580
38581
|
const hits = [];
|
|
@@ -38604,8 +38605,10 @@ function sameBreadcrumb(a, b) {
|
|
|
38604
38605
|
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
38605
38606
|
}
|
|
38606
38607
|
function blocksToChunks(blocks, options) {
|
|
38607
|
-
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
38608
|
-
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
38608
|
+
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _815 => _815.granularity]), () => ( "section"));
|
|
38609
|
+
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _816 => _816.includeTableCells]), () => ( false));
|
|
38610
|
+
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess', _817 => _817.tableFormat]) };
|
|
38611
|
+
if (_optionalChain([options, 'optionalAccess', _818 => _818.tableFormat]) === "gfm") _chunkW5NXOMCDcjs.assignTableIds.call(void 0, blocks);
|
|
38609
38612
|
const chunks = [];
|
|
38610
38613
|
const headingStack = [];
|
|
38611
38614
|
const listStack = [];
|
|
@@ -38619,12 +38622,12 @@ function blocksToChunks(blocks, options) {
|
|
|
38619
38622
|
let run = null;
|
|
38620
38623
|
const flushRun = () => {
|
|
38621
38624
|
if (!run) return;
|
|
38622
|
-
push("text", run.breadcrumb,
|
|
38625
|
+
push("text", run.breadcrumb, _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, run.blocks, mdOptions), [run.start, run.end], run.page);
|
|
38623
38626
|
run = null;
|
|
38624
38627
|
};
|
|
38625
38628
|
for (let i = 0; i < blocks.length; i++) {
|
|
38626
38629
|
const block = blocks[i];
|
|
38627
|
-
const md2 =
|
|
38630
|
+
const md2 = _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, [block], mdOptions);
|
|
38628
38631
|
if (!md2) continue;
|
|
38629
38632
|
if (block.type === "heading") {
|
|
38630
38633
|
flushRun();
|
|
@@ -38742,7 +38745,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38742
38745
|
const block = st.blocks[blockIndex];
|
|
38743
38746
|
if (!block) return void 0;
|
|
38744
38747
|
if (block.type === "paragraph" || block.type === "heading") {
|
|
38745
|
-
const para2 = _optionalChain([st, 'access',
|
|
38748
|
+
const para2 = _optionalChain([st, 'access', _819 => _819.paraMap, 'access', _820 => _820.get, 'call', _821 => _821(blockIndex), 'optionalAccess', _822 => _822.para]);
|
|
38746
38749
|
if (!para2) return void 0;
|
|
38747
38750
|
return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
|
|
38748
38751
|
}
|
|
@@ -38767,7 +38770,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38767
38770
|
if (block.text && block.text.includes("\n")) {
|
|
38768
38771
|
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)" };
|
|
38769
38772
|
}
|
|
38770
|
-
if (!_optionalChain([st, 'access',
|
|
38773
|
+
if (!_optionalChain([st, 'access', _823 => _823.paraMap, 'access', _824 => _824.get, 'call', _825 => _825(blockIndex), 'optionalAccess', _826 => _826.para])) {
|
|
38771
38774
|
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)" };
|
|
38772
38775
|
}
|
|
38773
38776
|
return { capability: "text" };
|
|
@@ -38833,7 +38836,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38833
38836
|
continue;
|
|
38834
38837
|
}
|
|
38835
38838
|
if (block.type === "table" && block.table) {
|
|
38836
|
-
if (!_optionalChain([edit, 'access',
|
|
38839
|
+
if (!_optionalChain([edit, 'access', _827 => _827.cells, 'optionalAccess', _828 => _828.length])) {
|
|
38837
38840
|
skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
|
|
38838
38841
|
continue;
|
|
38839
38842
|
}
|
|
@@ -38853,7 +38856,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38853
38856
|
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) });
|
|
38854
38857
|
continue;
|
|
38855
38858
|
}
|
|
38856
|
-
const irCell = _optionalChain([block, 'access',
|
|
38859
|
+
const irCell = _optionalChain([block, 'access', _829 => _829.table, 'access', _830 => _830.cells, 'access', _831 => _831[cellEdit.row], 'optionalAccess', _832 => _832[cellEdit.col]]);
|
|
38857
38860
|
if (!irCell) {
|
|
38858
38861
|
skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
|
|
38859
38862
|
continue;
|
|
@@ -38909,7 +38912,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38909
38912
|
}
|
|
38910
38913
|
if (replacements.size === 0) {
|
|
38911
38914
|
let changes2;
|
|
38912
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
38915
|
+
if (_optionalChain([options, 'optionalAccess', _833 => _833.verify]) !== false) {
|
|
38913
38916
|
const units = splitMarkdownUnits(st.markdown);
|
|
38914
38917
|
changes2 = diffUnitLists(units, units);
|
|
38915
38918
|
}
|
|
@@ -38930,7 +38933,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38930
38933
|
}
|
|
38931
38934
|
this.state = newState;
|
|
38932
38935
|
let changes;
|
|
38933
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
38936
|
+
if (_optionalChain([options, 'optionalAccess', _834 => _834.verify]) !== false) {
|
|
38934
38937
|
changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
|
|
38935
38938
|
}
|
|
38936
38939
|
return { success: true, data: new Uint8Array(data), applied, skipped, changes };
|
|
@@ -38950,11 +38953,11 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38950
38953
|
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)");
|
|
38951
38954
|
}
|
|
38952
38955
|
const mapping = st.paraMap.get(blockIndex);
|
|
38953
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
38956
|
+
if (!_optionalChain([mapping, 'optionalAccess', _835 => _835.para])) {
|
|
38954
38957
|
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)");
|
|
38955
38958
|
}
|
|
38956
38959
|
let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
38957
|
-
if (_optionalChain([mapping, 'access',
|
|
38960
|
+
if (_optionalChain([mapping, 'access', _836 => _836.noteMarks, 'optionalAccess', _837 => _837.length])) {
|
|
38958
38961
|
const r = removeNoteMarks(newPlain, mapping.noteMarks);
|
|
38959
38962
|
newPlain = r.text;
|
|
38960
38963
|
if (r.missing.length) skipped.push({ reason: "\uAC01\uC8FC \uCC38\uC870 \uBD80\uD638 \uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 \u2014 \uAC01\uC8FC \uC720\uC9C0, \uBCF8\uBB38\uB9CC \uC801\uC6A9", before: r.missing.join(" ") });
|
|
@@ -38975,14 +38978,14 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
38975
38978
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
38976
38979
|
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");
|
|
38977
38980
|
}
|
|
38978
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access',
|
|
38981
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _838 => _838.scans, 'access', _839 => _839[mapping.para.sectionIndex], 'optionalAccess', _840 => _840.xml]));
|
|
38979
38982
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
38980
38983
|
sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
38981
38984
|
return 1;
|
|
38982
38985
|
}
|
|
38983
38986
|
}, _class10);
|
|
38984
38987
|
function cellStaticCheck(table2, scanTable, r, c) {
|
|
38985
|
-
const irCell = _optionalChain([table2, 'access',
|
|
38988
|
+
const irCell = _optionalChain([table2, 'access', _841 => _841.cells, 'access', _842 => _842[r], 'optionalAccess', _843 => _843[c]]);
|
|
38986
38989
|
if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
|
|
38987
38990
|
const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
|
|
38988
38991
|
if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
|
|
@@ -39067,16 +39070,16 @@ var md = new (0, _markdownit2.default)({
|
|
|
39067
39070
|
});
|
|
39068
39071
|
var SAFE_RAW_TAG = /^(?:<\/?(?:table|thead|tbody|tfoot|tr|th|td|u)>|<br\s*\/?>|<(?:th|td)(?: (?:colspan|rowspan)="[1-9]\d*"){1,2}>|<img src="(?:images\/(?:[^"'<>\/\s]+\/)?)?image_\d+\.(?:png|jpe?g|gif|webp|bmp)" alt="image">)$/i;
|
|
39069
39072
|
function sanitizeRawHtml(raw) {
|
|
39070
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
39073
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkRHMIEEAZcjs.escapeHtml.call(void 0, tag));
|
|
39071
39074
|
}
|
|
39072
39075
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
39073
39076
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
39074
39077
|
function renderHtml(markdown, options) {
|
|
39075
|
-
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
39076
|
-
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
39078
|
+
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _844 => _844.preset]), () => ( "default"));
|
|
39079
|
+
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _845 => _845.extraCss]), () => ( "")));
|
|
39077
39080
|
const body = md.render(markdown);
|
|
39078
|
-
const watermark = _optionalChain([options, 'optionalAccess',
|
|
39079
|
-
const watermarkCss = _optionalChain([options, 'optionalAccess',
|
|
39081
|
+
const watermark = _optionalChain([options, 'optionalAccess', _846 => _846.watermark]) ? `<div class="watermark">${_chunkRHMIEEAZcjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
39082
|
+
const watermarkCss = _optionalChain([options, 'optionalAccess', _847 => _847.watermark]) ? `
|
|
39080
39083
|
.watermark {
|
|
39081
39084
|
position: fixed;
|
|
39082
39085
|
top: 50%; left: 50%;
|
|
@@ -39126,13 +39129,13 @@ async function htmlToPdf(html, options) {
|
|
|
39126
39129
|
try {
|
|
39127
39130
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
39128
39131
|
} catch (e40) {
|
|
39129
|
-
throw new (0,
|
|
39132
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(
|
|
39130
39133
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
39131
39134
|
);
|
|
39132
39135
|
}
|
|
39133
39136
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
39134
39137
|
if (!executablePath) {
|
|
39135
|
-
throw new (0,
|
|
39138
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(
|
|
39136
39139
|
"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."
|
|
39137
39140
|
);
|
|
39138
39141
|
}
|
|
@@ -39140,10 +39143,10 @@ async function htmlToPdf(html, options) {
|
|
|
39140
39143
|
try {
|
|
39141
39144
|
await page.setContent(html, { waitUntil: "load" });
|
|
39142
39145
|
await page.waitForNetworkIdle({ idleTime: 500, concurrency: 0 });
|
|
39143
|
-
const margin = _optionalChain([options, 'optionalAccess',
|
|
39146
|
+
const margin = _optionalChain([options, 'optionalAccess', _848 => _848.margin]);
|
|
39144
39147
|
const pdf = await page.pdf({
|
|
39145
|
-
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
39146
|
-
landscape: _optionalChain([options, 'optionalAccess',
|
|
39148
|
+
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _849 => _849.pageSize]), () => ( "A4")),
|
|
39149
|
+
landscape: _optionalChain([options, 'optionalAccess', _850 => _850.orientation]) === "landscape",
|
|
39147
39150
|
printBackground: true,
|
|
39148
39151
|
margin: margin ? {
|
|
39149
39152
|
top: toCss(margin.top),
|
|
@@ -39151,9 +39154,9 @@ async function htmlToPdf(html, options) {
|
|
|
39151
39154
|
bottom: toCss(margin.bottom),
|
|
39152
39155
|
left: toCss(margin.left)
|
|
39153
39156
|
} : void 0,
|
|
39154
|
-
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess',
|
|
39155
|
-
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
39156
|
-
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
39157
|
+
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _851 => _851.header]) || _optionalChain([options, 'optionalAccess', _852 => _852.footer])),
|
|
39158
|
+
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _853 => _853.header]), () => ( "<div></div>")),
|
|
39159
|
+
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _854 => _854.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
|
|
39157
39160
|
});
|
|
39158
39161
|
return Buffer.from(pdf);
|
|
39159
39162
|
} finally {
|
|
@@ -39187,7 +39190,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
39187
39190
|
return htmlToPdf(html, options);
|
|
39188
39191
|
}
|
|
39189
39192
|
async function blocksToPdf(blocks, options) {
|
|
39190
|
-
const markdown =
|
|
39193
|
+
const markdown = _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, blocks);
|
|
39191
39194
|
return markdownToPdf(markdown, options);
|
|
39192
39195
|
}
|
|
39193
39196
|
|
|
@@ -39388,7 +39391,7 @@ function buildPara(p) {
|
|
|
39388
39391
|
const pos = findChildByLocalName(ch, "pos");
|
|
39389
39392
|
const w = num2(sz, "width") || num2(findChildByLocalName(ch, "curSz"), "width") || num2(findChildByLocalName(ch, "orgSz"), "width");
|
|
39390
39393
|
const h = num2(sz, "height") || num2(findChildByLocalName(ch, "curSz"), "height") || num2(findChildByLocalName(ch, "orgSz"), "height");
|
|
39391
|
-
const inline = _optionalChain([pos, 'optionalAccess',
|
|
39394
|
+
const inline = _optionalChain([pos, 'optionalAccess', _855 => _855.getAttribute, 'call', _856 => _856("treatAsChar")]) === "1";
|
|
39392
39395
|
const om = inline && cn === "tbl" ? findChildByLocalName(ch, "outMargin") : null;
|
|
39393
39396
|
if (!deleted) objs.push({
|
|
39394
39397
|
el: ch,
|
|
@@ -39424,20 +39427,20 @@ function buildPara(p) {
|
|
|
39424
39427
|
var DEFAULT_TAB_HU = 4e3;
|
|
39425
39428
|
function tabAdvance(x, firstLine, geom, saved = 0) {
|
|
39426
39429
|
const hang = geom && geom.marginIntent < 0 ? -geom.marginIntent : 0;
|
|
39427
|
-
if (firstLine && _optionalChain([geom, 'optionalAccess',
|
|
39430
|
+
if (firstLine && _optionalChain([geom, 'optionalAccess', _857 => _857.autoTabLeft]) && hang > 0 && x < hang - 0.5) return hang - x;
|
|
39428
39431
|
if (saved > 0) return saved;
|
|
39429
39432
|
return (Math.floor(x / DEFAULT_TAB_HU) + 1) * DEFAULT_TAB_HU - x;
|
|
39430
39433
|
}
|
|
39431
39434
|
function cellContentExtent(cell2, memo) {
|
|
39432
39435
|
if (!cell2.sub) return 0;
|
|
39433
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
39436
|
+
const hit = _optionalChain([memo, 'optionalAccess', _858 => _858.cell, 'access', _859 => _859.get, 'call', _860 => _860(cell2.el)]);
|
|
39434
39437
|
if (hit !== void 0) return hit;
|
|
39435
39438
|
let ext = 0;
|
|
39436
39439
|
for (const p of elements(cell2.sub)) {
|
|
39437
39440
|
if (ln(p) !== "p") continue;
|
|
39438
39441
|
const m = buildPara(p);
|
|
39439
39442
|
for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
|
|
39440
|
-
const baseV = _nullishCoalesce(_optionalChain([m, 'access',
|
|
39443
|
+
const baseV = _nullishCoalesce(_optionalChain([m, 'access', _861 => _861.segs, 'access', _862 => _862[0], 'optionalAccess', _863 => _863.vertpos]), () => ( 0));
|
|
39441
39444
|
for (const o of m.objs) {
|
|
39442
39445
|
if (o.inline) {
|
|
39443
39446
|
const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
@@ -39445,14 +39448,14 @@ function cellContentExtent(cell2, memo) {
|
|
|
39445
39448
|
continue;
|
|
39446
39449
|
}
|
|
39447
39450
|
const pos = findChildByLocalName(o.el, "pos");
|
|
39448
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
39451
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _864 => _864.getAttribute, 'call', _865 => _865("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
39449
39452
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
39450
39453
|
const pushed = baseV - (num2(om, "top") + o.height + num2(om, "bottom"));
|
|
39451
39454
|
const anchor = pushed >= -100 ? pushed : baseV;
|
|
39452
39455
|
ext = Math.max(ext, anchor + num2(om, "top") + num2(pos, "vertOffset") + o.height);
|
|
39453
39456
|
}
|
|
39454
39457
|
}
|
|
39455
|
-
_optionalChain([memo, 'optionalAccess',
|
|
39458
|
+
_optionalChain([memo, 'optionalAccess', _866 => _866.cell, 'access', _867 => _867.set, 'call', _868 => _868(cell2.el, ext)]);
|
|
39456
39459
|
return ext;
|
|
39457
39460
|
}
|
|
39458
39461
|
function collectCells(tbl2) {
|
|
@@ -39490,7 +39493,7 @@ function collectCells(tbl2) {
|
|
|
39490
39493
|
return cells;
|
|
39491
39494
|
}
|
|
39492
39495
|
function measureTableHeight(tbl2, memo) {
|
|
39493
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
39496
|
+
const hit = _optionalChain([memo, 'optionalAccess', _869 => _869.table, 'access', _870 => _870.get, 'call', _871 => _871(tbl2)]);
|
|
39494
39497
|
if (hit !== void 0) return hit;
|
|
39495
39498
|
const cells = collectCells(tbl2);
|
|
39496
39499
|
if (cells.length === 0 || cells.length > 4096) return 0;
|
|
@@ -39501,7 +39504,7 @@ function measureTableHeight(tbl2, memo) {
|
|
|
39501
39504
|
);
|
|
39502
39505
|
let sum = 0;
|
|
39503
39506
|
for (const h of rowH) sum += h;
|
|
39504
|
-
_optionalChain([memo, 'optionalAccess',
|
|
39507
|
+
_optionalChain([memo, 'optionalAccess', _872 => _872.table, 'access', _873 => _873.set, 'call', _874 => _874(tbl2, sum)]);
|
|
39505
39508
|
return sum;
|
|
39506
39509
|
}
|
|
39507
39510
|
|
|
@@ -39616,7 +39619,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode) {
|
|
|
39616
39619
|
}
|
|
39617
39620
|
const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
|
|
39618
39621
|
if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
|
|
39619
|
-
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
39622
|
+
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _875 => _875.getAttribute, 'call', _876 => _876("vertRelTo")]), () => ( "PARA"));
|
|
39620
39623
|
if (vertRel === "PAGE" || vertRel === "PAPER") continue;
|
|
39621
39624
|
const vo = Math.max(0, num3(pos, "vertOffset"));
|
|
39622
39625
|
if (wrapAttr === "TOP_AND_BOTTOM") {
|
|
@@ -39677,7 +39680,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
39677
39680
|
if (ln2(p) !== "p") continue;
|
|
39678
39681
|
reflowTablesIn(p, doc, styles, mode, counter);
|
|
39679
39682
|
const g3 = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
39680
|
-
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
39683
|
+
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _877 => _877.spaceBefore]), () => ( 0)));
|
|
39681
39684
|
const res = reflowPara(p, doc, styles, areaW, startV, mode);
|
|
39682
39685
|
if (!res) {
|
|
39683
39686
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
@@ -39690,7 +39693,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
39690
39693
|
}
|
|
39691
39694
|
if (Number.isFinite(bottom)) {
|
|
39692
39695
|
cursorV = bottom;
|
|
39693
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
39696
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _878 => _878.spaceAfter]), () => ( 0));
|
|
39694
39697
|
}
|
|
39695
39698
|
}
|
|
39696
39699
|
continue;
|
|
@@ -39751,7 +39754,7 @@ function pageStories(root, masters, paraPages, pageCount, pageBase, geom) {
|
|
|
39751
39754
|
const declarations = [];
|
|
39752
39755
|
const hidden = /* @__PURE__ */ new Map();
|
|
39753
39756
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
39754
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
39757
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _879 => _879.get, 'call', _880 => _880(p), 'optionalAccess', _881 => _881[0]]), () => ( 0));
|
|
39755
39758
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
39756
39759
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
39757
39760
|
for (const el of elements(ctrl)) {
|
|
@@ -39771,7 +39774,7 @@ function pageStories(root, masters, paraPages, pageCount, pageBase, geom) {
|
|
|
39771
39774
|
const out = [];
|
|
39772
39775
|
for (let page = 0; page < pageCount; page++) {
|
|
39773
39776
|
const n = pageBase + page + 1;
|
|
39774
|
-
const hides = (name) => _optionalChain([hidden, 'access',
|
|
39777
|
+
const hides = (name) => _optionalChain([hidden, 'access', _882 => _882.get, 'call', _883 => _883(page), 'optionalAccess', _884 => _884.has, 'call', _885 => _885(name)]) === true || page === 0 && num2(visibility, `hideFirst${name}`) !== 0;
|
|
39775
39778
|
if (!hides("MasterPage")) {
|
|
39776
39779
|
const matching = masters.filter((m) => m.getAttribute("type") === (n % 2 ? "ODD" : "EVEN"));
|
|
39777
39780
|
const both = masters.filter((m) => (m.getAttribute("type") || "BOTH") === "BOTH");
|
|
@@ -39849,7 +39852,7 @@ function objectGeometry(el, x, y, w, h, boxW = w, boxH = h) {
|
|
|
39849
39852
|
function shapeFill(el, defs, images, warn) {
|
|
39850
39853
|
const brush = findChildByLocalName(el, "fillBrush");
|
|
39851
39854
|
const win = brush && findChildByLocalName(brush, "winBrush");
|
|
39852
|
-
const face = _optionalChain([win, 'optionalAccess',
|
|
39855
|
+
const face = _optionalChain([win, 'optionalAccess', _886 => _886.getAttribute, 'call', _887 => _887("faceColor")]);
|
|
39853
39856
|
if (face && face.toLowerCase() !== "none") return esc(face);
|
|
39854
39857
|
const grad = brush && findChildByLocalName(brush, "gradation");
|
|
39855
39858
|
if (grad) {
|
|
@@ -39900,8 +39903,8 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
|
|
|
39900
39903
|
const geometry = local ? { x: boxX, y: boxY, w, h, bbox: { x: boxX, y: boxY, w, h }, transform: "" } : objectGeometry(el, boxX, boxY, w, h, o.width || w, o.height || h);
|
|
39901
39904
|
const { x, y } = geometry;
|
|
39902
39905
|
const sx = ow > 0 ? w / ow : 1, sy = oh > 0 ? h / oh : 1;
|
|
39903
|
-
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
39904
|
-
const color = esc(_optionalChain([line, 'optionalAccess',
|
|
39906
|
+
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess', _888 => _888.getAttribute, 'call', _889 => _889("style")]), () => ( "SOLID"));
|
|
39907
|
+
const color = esc(_optionalChain([line, 'optionalAccess', _890 => _890.getAttribute, 'call', _891 => _891("color")]) || "#000000");
|
|
39905
39908
|
const strokeW = style === "NONE" ? 0 : Math.max(0.2, num2(line, "width", 33) / 100 * 2.834645);
|
|
39906
39909
|
const dash = /DASH|DOT/.test(style) ? ` stroke-dasharray="${style.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
39907
39910
|
const keepWidth = local ? ` vector-effect="non-scaling-stroke"` : "";
|
|
@@ -39982,7 +39985,7 @@ function planLines(m, styles) {
|
|
|
39982
39985
|
const start = seg.textpos;
|
|
39983
39986
|
const end = i + 1 < m.segs.length ? m.segs[i + 1].textpos : Math.max(m.chars.length, start);
|
|
39984
39987
|
const tabs = /* @__PURE__ */ new Map();
|
|
39985
|
-
let x = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
39988
|
+
let x = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _892 => _892.marginIntent]), () => ( 0)), 0) : hang;
|
|
39986
39989
|
let fixedTo = start;
|
|
39987
39990
|
let fixedW = 0;
|
|
39988
39991
|
for (let k = start; k < end && k < m.chars.length; k++) {
|
|
@@ -40342,7 +40345,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
40342
40345
|
}));
|
|
40343
40346
|
for (const g3 of geom) {
|
|
40344
40347
|
const bf = g3.c.bfId != null ? ctx.styles.borderFill.get(g3.c.bfId) : void 0;
|
|
40345
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
40348
|
+
if (_optionalChain([bf, 'optionalAccess', _893 => _893.fill])) emit(ctx, `<rect x="${pt2(g3.x)}" y="${pt2(g3.y)}" width="${pt2(g3.w)}" height="${pt2(g3.h)}" fill="${escapeXml7(bf.fill)}"/>`);
|
|
40346
40349
|
}
|
|
40347
40350
|
for (const g3 of geom) {
|
|
40348
40351
|
const { c } = g3;
|
|
@@ -40395,7 +40398,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
40395
40398
|
}
|
|
40396
40399
|
function drawPicFrame(pic, x, y, w, h, transform, ctx) {
|
|
40397
40400
|
const img = findFirst(pic, "img");
|
|
40398
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
40401
|
+
const ref = _optionalChain([img, 'optionalAccess', _894 => _894.getAttribute, 'call', _895 => _895("binaryItemIDRef")]);
|
|
40399
40402
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
40400
40403
|
const imgId = ctx.regions.add("image", bboxOf(ctx, x, y, w, h), { sourceId: _nullishCoalesce(ref, () => ( void 0)), parentId: parentId(ctx) });
|
|
40401
40404
|
emit(ctx, regionOpenTag(imgId, "image", pageNo(ctx)));
|
|
@@ -40441,7 +40444,7 @@ function readSectionGeom(root) {
|
|
|
40441
40444
|
const pagePr = findFirst(root, "pagePr");
|
|
40442
40445
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
40443
40446
|
let PW = num2(pagePr, "width", 59528), PH = num2(pagePr, "height", 84188);
|
|
40444
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
40447
|
+
if (_optionalChain([pagePr, 'optionalAccess', _896 => _896.getAttribute, 'call', _897 => _897("landscape")]) === "NARROWLY" && PW < PH) {
|
|
40445
40448
|
const t = PW;
|
|
40446
40449
|
PW = PH;
|
|
40447
40450
|
PH = t;
|
|
@@ -40544,22 +40547,22 @@ function renderSectionRoots(sections, input) {
|
|
|
40544
40547
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
40545
40548
|
ctxBase.pageBase += pages.length;
|
|
40546
40549
|
}
|
|
40547
|
-
if (rendered.length === 0) throw new (0,
|
|
40550
|
+
if (rendered.length === 0) throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
40548
40551
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
40549
40552
|
}
|
|
40550
40553
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
40551
40554
|
async function renderHwpxInternal(input, options) {
|
|
40552
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
40555
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _898 => _898.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
40553
40556
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
40554
|
-
|
|
40557
|
+
_chunkRHMIEEAZcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
40555
40558
|
let zip;
|
|
40556
40559
|
try {
|
|
40557
40560
|
zip = await _jszip2.default.loadAsync(input);
|
|
40558
40561
|
} catch (e41) {
|
|
40559
|
-
throw new (0,
|
|
40562
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
40560
40563
|
}
|
|
40561
40564
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
40562
|
-
if (secFiles.length === 0) throw new (0,
|
|
40565
|
+
if (secFiles.length === 0) throw new (0, _chunkRHMIEEAZcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
40563
40566
|
const warnings = [];
|
|
40564
40567
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
40565
40568
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -40567,14 +40570,14 @@ async function renderHwpxInternal(input, options) {
|
|
|
40567
40570
|
const secXmls = [];
|
|
40568
40571
|
for (const f of secFiles) {
|
|
40569
40572
|
const xml = await f.async("string");
|
|
40570
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
40573
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
40571
40574
|
secXmls.push(xml);
|
|
40572
40575
|
}
|
|
40573
40576
|
const masterPages = /* @__PURE__ */ new Map();
|
|
40574
40577
|
const masterXmls = [];
|
|
40575
40578
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
40576
40579
|
const xml = await file.async("string");
|
|
40577
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
40580
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uBC14\uD0D5\uCABD XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
40578
40581
|
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
40579
40582
|
if (root && ln(root) === "masterPage") {
|
|
40580
40583
|
masterPages.set(root.getAttribute("id") || file.name.replace(/^.*\/|\.xml$/g, ""), root);
|
|
@@ -40602,7 +40605,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
40602
40605
|
let href = binmap.get(ref);
|
|
40603
40606
|
if (!href) {
|
|
40604
40607
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
40605
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
40608
|
+
href = _optionalChain([cand, 'optionalAccess', _899 => _899.name]);
|
|
40606
40609
|
}
|
|
40607
40610
|
if (!href) continue;
|
|
40608
40611
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -40624,7 +40627,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
40624
40627
|
for (let si = 0; si < secXmls.length; si++) {
|
|
40625
40628
|
const secXml = secXmls[si];
|
|
40626
40629
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
40627
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
40630
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _900 => _900.reflow])) {
|
|
40628
40631
|
noCacheSkipped = true;
|
|
40629
40632
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
40630
40633
|
continue;
|
|
@@ -40641,11 +40644,11 @@ async function renderHwpxInternal(input, options) {
|
|
|
40641
40644
|
}
|
|
40642
40645
|
if (roots.length === 0) {
|
|
40643
40646
|
if (noCacheSkipped) {
|
|
40644
|
-
throw new (0,
|
|
40647
|
+
throw new (0, _chunkRHMIEEAZcjs.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)");
|
|
40645
40648
|
}
|
|
40646
|
-
throw new (0,
|
|
40649
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
40647
40650
|
}
|
|
40648
|
-
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
40651
|
+
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _901 => _901.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _902 => _902.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _903 => _903.highlights]) });
|
|
40649
40652
|
}
|
|
40650
40653
|
async function renderHwpxToSvg(input, options) {
|
|
40651
40654
|
const r = await renderHwpxInternal(input, options);
|
|
@@ -40865,7 +40868,7 @@ var FOLD_END = 42124;
|
|
|
40865
40868
|
var FOLD_SHIFT = 983040 - 40960;
|
|
40866
40869
|
function textChar(ch) {
|
|
40867
40870
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
40868
|
-
const mapped =
|
|
40871
|
+
const mapped = _chunkW5NXOMCDcjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
40869
40872
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
40870
40873
|
}
|
|
40871
40874
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -40955,7 +40958,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
40955
40958
|
out += run.join("") + "</hp:run>";
|
|
40956
40959
|
run = [];
|
|
40957
40960
|
};
|
|
40958
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
40961
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _904 => _904[0], 'optionalAccess', _905 => _905[1]]), () => ( 0)));
|
|
40959
40962
|
let pos = 0, ctrlIdx = 0, o = 0;
|
|
40960
40963
|
const switchShape = () => {
|
|
40961
40964
|
while (shapeIdx + 1 < shapes.length && pos >= shapes[shapeIdx + 1][0]) {
|
|
@@ -41041,7 +41044,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
41041
41044
|
closeRun();
|
|
41042
41045
|
const rest = ctrls.filter((c) => !c.used && (c.id === CTRL_TBL3 || c.id === CTRL_GSO3 || c.id === CTRL_SECD2 || c.id === CTRL_COLD2));
|
|
41043
41046
|
if (rest.length > 0) {
|
|
41044
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
41047
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _906 => _906[0], 'optionalAccess', _907 => _907[1]]), () => ( 0)));
|
|
41045
41048
|
for (const c of rest) {
|
|
41046
41049
|
const el = ctrlElement(ctrls.indexOf(c), c.id);
|
|
41047
41050
|
run.push(el);
|
|
@@ -41196,14 +41199,14 @@ function hwp5SectionToXml(records, ctx) {
|
|
|
41196
41199
|
return `<hs:sec xmlns:hs="http://www.hancom.co.kr/hwpml/2011/section" xmlns:hp="http://www.hancom.co.kr/hwpml/2011/paragraph" xmlns:hc="http://www.hancom.co.kr/hwpml/2011/core">` + paragraphsXml(records, 0, records.length, 0, ctx, 0) + "</hs:sec>";
|
|
41197
41200
|
}
|
|
41198
41201
|
function renderHwp5Records(docInfo, styles, secRecords, binData, options, select, warnings = []) {
|
|
41199
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
41202
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _908 => _908.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
41200
41203
|
const MAX_TOTAL_IMAGE_BYTES = 128 * 1024 * 1024;
|
|
41201
41204
|
const images = /* @__PURE__ */ new Map();
|
|
41202
41205
|
let totalImgBytes = 0;
|
|
41203
41206
|
const imageRef = (binDataId) => {
|
|
41204
41207
|
if (binDataId <= 0) return null;
|
|
41205
|
-
const item = _optionalChain([docInfo, 'optionalAccess',
|
|
41206
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
41208
|
+
const item = _optionalChain([docInfo, 'optionalAccess', _909 => _909.binData, 'access', _910 => _910[binDataId - 1]]);
|
|
41209
|
+
if (_optionalChain([item, 'optionalAccess', _911 => _911.kind]) === "link") return null;
|
|
41207
41210
|
const storageId = item && item.storageId > 0 ? item.storageId : binDataId;
|
|
41208
41211
|
const ref = `bin${storageId}`;
|
|
41209
41212
|
if (images.has(ref)) return ref;
|
|
@@ -41237,8 +41240,8 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
41237
41240
|
}
|
|
41238
41241
|
roots.push({ root, index: si });
|
|
41239
41242
|
}
|
|
41240
|
-
if (roots.length === 0) throw new (0,
|
|
41241
|
-
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
41243
|
+
if (roots.length === 0) throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
41244
|
+
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _912 => _912.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _913 => _913.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _914 => _914.highlights]) });
|
|
41242
41245
|
return assemblePageSvgs(r, "hwp", select);
|
|
41243
41246
|
}
|
|
41244
41247
|
function renderHwp5Pages(input, options, select) {
|
|
@@ -41250,7 +41253,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
41250
41253
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
41251
41254
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
41252
41255
|
const sections = readHwp5SectionStreams(c);
|
|
41253
|
-
if (sections.length === 0) throw new (0,
|
|
41256
|
+
if (sections.length === 0) throw new (0, _chunkRHMIEEAZcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
41254
41257
|
const parseWarnings = [];
|
|
41255
41258
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
41256
41259
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -41335,14 +41338,14 @@ async function loadSharp() {
|
|
|
41335
41338
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
41336
41339
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
41337
41340
|
} catch (e44) {
|
|
41338
|
-
throw new (0,
|
|
41339
|
-
'PNG \uB798\uC2A4\uD130\uC5D0\uB294 sharp\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install sharp). sharp \uC5C6\uC774 \uC4F0\uB824\uBA74 format: "svg" + output_path\uB85C SVG \uD30C\uC77C \uC800\uC7A5\uC744 \uC0AC\uC6A9\uD558\uC138\uC694.' +
|
|
41341
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(
|
|
41342
|
+
'PNG \uB798\uC2A4\uD130\uC5D0\uB294 sharp\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install sharp). sharp \uC5C6\uC774 \uC4F0\uB824\uBA74 format: "svg" + output_path\uB85C SVG \uD30C\uC77C \uC800\uC7A5\uC744 \uC0AC\uC6A9\uD558\uC138\uC694.' + _chunkRHMIEEAZcjs.OPTIONAL_DEP_INSTALL_HINT
|
|
41340
41343
|
);
|
|
41341
41344
|
}
|
|
41342
41345
|
}
|
|
41343
41346
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
41344
41347
|
const sharp = await loadSharp();
|
|
41345
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
41348
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkRHMIEEAZcjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
41346
41349
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
41347
41350
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
41348
41351
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -41360,11 +41363,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
41360
41363
|
try {
|
|
41361
41364
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
41362
41365
|
} catch (e45) {
|
|
41363
|
-
throw new (0,
|
|
41366
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("PDF \uB80C\uB354\uC5D0\uB294 puppeteer-core \uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install puppeteer-core). SVG/HTML/PNG \uB294 Chromium \uC5C6\uC774 \uB429\uB2C8\uB2E4");
|
|
41364
41367
|
}
|
|
41365
41368
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
41366
41369
|
if (!executablePath) {
|
|
41367
|
-
throw new (0,
|
|
41370
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)("Chromium \uC2E4\uD589 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 browserExecutablePath \uC635\uC158 \uB610\uB294 PUPPETEER_EXECUTABLE_PATH \uD658\uACBD\uBCC0\uC218\uB97C \uC9C0\uC815\uD558\uC138\uC694");
|
|
41368
41371
|
}
|
|
41369
41372
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
41370
41373
|
try {
|
|
@@ -41380,13 +41383,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
41380
41383
|
async function loadBuffer(input) {
|
|
41381
41384
|
if (typeof input === "string") {
|
|
41382
41385
|
try {
|
|
41383
|
-
return
|
|
41386
|
+
return _chunkRHMIEEAZcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
41384
41387
|
} catch (err) {
|
|
41385
41388
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
41386
|
-
throw new (0,
|
|
41389
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
41387
41390
|
}
|
|
41388
41391
|
}
|
|
41389
|
-
if (Buffer.isBuffer(input)) return
|
|
41392
|
+
if (Buffer.isBuffer(input)) return _chunkRHMIEEAZcjs.toArrayBuffer.call(void 0, input);
|
|
41390
41393
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
41391
41394
|
return input;
|
|
41392
41395
|
}
|
|
@@ -41395,17 +41398,17 @@ async function sourceFormatOf(buffer) {
|
|
|
41395
41398
|
if (format2 === "hwpx") {
|
|
41396
41399
|
const zip = await detectZipFormat(buffer);
|
|
41397
41400
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
41398
|
-
throw new (0,
|
|
41401
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`\uB80C\uB354 \uBBF8\uC9C0\uC6D0 \uD615\uC2DD(${zip}) \u2014 \uB808\uC774\uC544\uC6C3 \uB80C\uB354\uB294 HWPX\xB7HWP \uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4`);
|
|
41399
41402
|
}
|
|
41400
41403
|
if (format2 === "hwp") return "hwp";
|
|
41401
|
-
throw new (0,
|
|
41404
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`\uB80C\uB354 \uBBF8\uC9C0\uC6D0 \uD615\uC2DD(${format2}) \u2014 \uB808\uC774\uC544\uC6C3 \uB80C\uB354\uB294 HWPX\xB7HWP \uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4`);
|
|
41402
41405
|
}
|
|
41403
41406
|
async function renderDocumentToScene(input, options = {}) {
|
|
41404
41407
|
const buffer = await loadBuffer(input);
|
|
41405
41408
|
const source = await sourceFormatOf(buffer);
|
|
41406
41409
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
41407
41410
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
41408
|
-
if (set.size === 0) throw new (0,
|
|
41411
|
+
if (set.size === 0) throw new (0, _chunkRHMIEEAZcjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
41409
41412
|
return set;
|
|
41410
41413
|
} : void 0;
|
|
41411
41414
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -41441,7 +41444,7 @@ async function renderDocument(input, options) {
|
|
|
41441
41444
|
break;
|
|
41442
41445
|
}
|
|
41443
41446
|
default:
|
|
41444
|
-
throw new (0,
|
|
41447
|
+
throw new (0, _chunkRHMIEEAZcjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
41445
41448
|
}
|
|
41446
41449
|
return { scene, assets };
|
|
41447
41450
|
}
|
|
@@ -41471,7 +41474,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
41471
41474
|
const out = [];
|
|
41472
41475
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
41473
41476
|
const meta = scene.pages.find((p) => p.page === page);
|
|
41474
|
-
if (!meta) throw new (0,
|
|
41477
|
+
if (!meta) throw new (0, _chunkRHMIEEAZcjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
41475
41478
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
41476
41479
|
for (const { region, bbox } of items) {
|
|
41477
41480
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -41495,9 +41498,9 @@ function wantsCrop(kind, policy) {
|
|
|
41495
41498
|
}
|
|
41496
41499
|
async function extractTables(input, options = {}) {
|
|
41497
41500
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
41498
|
-
const buffer = typeof input === "string" ?
|
|
41501
|
+
const buffer = typeof input === "string" ? _chunkRHMIEEAZcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkRHMIEEAZcjs.toArrayBuffer.call(void 0, input) : input;
|
|
41499
41502
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
41500
|
-
if (!parsed.success) throw new (0,
|
|
41503
|
+
if (!parsed.success) throw new (0, _chunkRHMIEEAZcjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
41501
41504
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
41502
41505
|
const out = blocks.map((b, i) => ({
|
|
41503
41506
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -41555,17 +41558,20 @@ async function extractTables(input, options = {}) {
|
|
|
41555
41558
|
// src/index.ts
|
|
41556
41559
|
async function parse(input, options) {
|
|
41557
41560
|
let buffer;
|
|
41558
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
41561
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _915 => _915.filePath]) ? { ...options, filePath: input } : options;
|
|
41562
|
+
if (_optionalChain([opts, 'optionalAccess', _916 => _916.htmlTables]) && opts.tableFormat) {
|
|
41563
|
+
return { success: false, fileType: "unknown", error: "htmlTables \uC640 tableFormat \uC740 \uD568\uAED8 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4" };
|
|
41564
|
+
}
|
|
41559
41565
|
if (typeof input === "string") {
|
|
41560
41566
|
try {
|
|
41561
41567
|
const buf = await _promises.readFile.call(void 0, input);
|
|
41562
|
-
buffer =
|
|
41568
|
+
buffer = _chunkRHMIEEAZcjs.toArrayBuffer.call(void 0, buf);
|
|
41563
41569
|
} catch (err) {
|
|
41564
41570
|
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}`;
|
|
41565
|
-
return { success: false, fileType: "unknown", error: msg2, code:
|
|
41571
|
+
return { success: false, fileType: "unknown", error: msg2, code: _chunkRHMIEEAZcjs.classifyError.call(void 0, err) };
|
|
41566
41572
|
}
|
|
41567
41573
|
} else if (Buffer.isBuffer(input)) {
|
|
41568
|
-
buffer =
|
|
41574
|
+
buffer = _chunkRHMIEEAZcjs.toArrayBuffer.call(void 0, input);
|
|
41569
41575
|
} else {
|
|
41570
41576
|
buffer = input;
|
|
41571
41577
|
}
|
|
@@ -41574,23 +41580,23 @@ async function parse(input, options) {
|
|
|
41574
41580
|
}
|
|
41575
41581
|
const format2 = detectFormat(buffer);
|
|
41576
41582
|
const result = await dispatch(format2, buffer, opts);
|
|
41577
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
41583
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _917 => _917.images]) === false) {
|
|
41578
41584
|
delete result.images;
|
|
41579
41585
|
dropImageBytes(result.blocks);
|
|
41580
41586
|
}
|
|
41581
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
41587
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _918 => _918.classifyTables])) classifyTableTree(result.blocks);
|
|
41582
41588
|
let out = result;
|
|
41583
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
41589
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _919 => _919.pages]) && result.pageCount && _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, opts.pages, result.pageCount).size === 0) {
|
|
41584
41590
|
out = { ...result, warnings: [..._nullishCoalesce(result.warnings, () => ( [])), { code: "PARTIAL_PARSE", message: `\uC694\uCCAD\uD55C \uCABD \uBC94\uC704(${opts.pages})\uAC00 \uBB38\uC11C \uCABD(1~${result.pageCount})\uACFC \uACB9\uCE58\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4` }] };
|
|
41585
41591
|
}
|
|
41586
41592
|
if (out.success && !out.pages) {
|
|
41587
|
-
const pages =
|
|
41593
|
+
const pages = _chunkUOXOYZU4cjs.blocksToPages.call(void 0, out.blocks, (bs) => _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([opts, 'optionalAccess', _920 => _920.tableFormat]) }));
|
|
41588
41594
|
if (pages) out = { ...out, pages };
|
|
41589
41595
|
}
|
|
41590
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
41596
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _921 => _921.plain])) {
|
|
41591
41597
|
out = { ...out, markdown: toPlainMarkdown(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toPlainMarkdown(p.markdown) })) } : {} };
|
|
41592
41598
|
}
|
|
41593
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
41599
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _922 => _922.htmlTables])) {
|
|
41594
41600
|
out = { ...out, markdown: toHtmlTables(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toHtmlTables(p.markdown) })) } : {} };
|
|
41595
41601
|
}
|
|
41596
41602
|
return out;
|
|
@@ -41633,45 +41639,45 @@ async function dispatch(format2, buffer, opts) {
|
|
|
41633
41639
|
}
|
|
41634
41640
|
}
|
|
41635
41641
|
function scriptsOff(r, off) {
|
|
41636
|
-
return off ?
|
|
41642
|
+
return off ? _chunkW5NXOMCDcjs.stripScriptTags.call(void 0, r) : r;
|
|
41637
41643
|
}
|
|
41638
41644
|
async function parseImage(buffer, options) {
|
|
41639
41645
|
try {
|
|
41640
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
41646
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-467KLV3F.cjs")));
|
|
41641
41647
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
41642
|
-
|
|
41648
|
+
_chunkW5NXOMCDcjs.stripScriptTags.call(void 0, { blocks });
|
|
41643
41649
|
return {
|
|
41644
41650
|
success: true,
|
|
41645
41651
|
fileType: "image",
|
|
41646
|
-
markdown:
|
|
41652
|
+
markdown: _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _923 => _923.tableFormat]) }),
|
|
41647
41653
|
blocks,
|
|
41648
41654
|
warnings: warnings.length ? warnings : void 0,
|
|
41649
41655
|
pageCount: 1
|
|
41650
41656
|
};
|
|
41651
41657
|
} catch (err) {
|
|
41652
|
-
return { success: false, fileType: "image", error:
|
|
41658
|
+
return { success: false, fileType: "image", error: _chunkRHMIEEAZcjs.sanitizeError.call(void 0, err), code: _chunkRHMIEEAZcjs.classifyError.call(void 0, err) };
|
|
41653
41659
|
}
|
|
41654
41660
|
}
|
|
41655
41661
|
async function parseHwp3(buffer, options) {
|
|
41656
41662
|
try {
|
|
41657
41663
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
41658
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
41664
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _924 => _924.pageCount]) };
|
|
41659
41665
|
} catch (err) {
|
|
41660
|
-
return { success: false, fileType: "hwp3", error:
|
|
41666
|
+
return { success: false, fileType: "hwp3", error: _chunkRHMIEEAZcjs.sanitizeError.call(void 0, err), code: _chunkRHMIEEAZcjs.classifyError.call(void 0, err) };
|
|
41661
41667
|
}
|
|
41662
41668
|
}
|
|
41663
41669
|
async function parseHwpx(buffer, options) {
|
|
41664
41670
|
try {
|
|
41665
41671
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
41666
|
-
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
41672
|
+
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _925 => _925.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _926 => _926.pageCount]) }, _optionalChain([options, 'optionalAccess', _927 => _927.scriptTags]) === false);
|
|
41667
41673
|
} catch (err) {
|
|
41668
|
-
return { success: false, fileType: "hwpx", error:
|
|
41674
|
+
return { success: false, fileType: "hwpx", error: _chunkRHMIEEAZcjs.sanitizeError.call(void 0, err), code: _chunkRHMIEEAZcjs.classifyError.call(void 0, err) };
|
|
41669
41675
|
}
|
|
41670
41676
|
}
|
|
41671
41677
|
async function parseHwp(buffer, options) {
|
|
41672
41678
|
try {
|
|
41673
41679
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
41674
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
41680
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _928 => _928.filePath])) {
|
|
41675
41681
|
try {
|
|
41676
41682
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
41677
41683
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -41689,15 +41695,15 @@ async function parseHwp(buffer, options) {
|
|
|
41689
41695
|
} catch (e46) {
|
|
41690
41696
|
}
|
|
41691
41697
|
}
|
|
41692
|
-
return scriptsOff({ success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
41698
|
+
return scriptsOff({ success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _929 => _929.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _930 => _930.pageCount]) }, _optionalChain([options, 'optionalAccess', _931 => _931.scriptTags]) === false);
|
|
41693
41699
|
} catch (err) {
|
|
41694
|
-
return { success: false, fileType: "hwp", error:
|
|
41700
|
+
return { success: false, fileType: "hwp", error: _chunkRHMIEEAZcjs.sanitizeError.call(void 0, err), code: _chunkRHMIEEAZcjs.classifyError.call(void 0, err) };
|
|
41695
41701
|
}
|
|
41696
41702
|
}
|
|
41697
41703
|
async function parsePdf(buffer, options) {
|
|
41698
41704
|
let parsePdfDocument;
|
|
41699
41705
|
try {
|
|
41700
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
41706
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-BIJBX2D5.cjs")));
|
|
41701
41707
|
parsePdfDocument = mod.parsePdfDocument;
|
|
41702
41708
|
} catch (e47) {
|
|
41703
41709
|
return {
|
|
@@ -41709,59 +41715,59 @@ async function parsePdf(buffer, options) {
|
|
|
41709
41715
|
}
|
|
41710
41716
|
try {
|
|
41711
41717
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages } = await parsePdfDocument(buffer, options);
|
|
41712
|
-
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
41718
|
+
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _932 => _932.pageCount]) }, _optionalChain([options, 'optionalAccess', _933 => _933.scriptTags]) !== true);
|
|
41713
41719
|
} catch (err) {
|
|
41714
41720
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
41715
|
-
return { success: false, fileType: "pdf", error:
|
|
41721
|
+
return { success: false, fileType: "pdf", error: _chunkRHMIEEAZcjs.sanitizeError.call(void 0, err), code: _chunkRHMIEEAZcjs.classifyError.call(void 0, err), isImageBased };
|
|
41716
41722
|
}
|
|
41717
41723
|
}
|
|
41718
41724
|
async function parseXlsx(buffer, options) {
|
|
41719
41725
|
try {
|
|
41720
41726
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
41721
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
41727
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _934 => _934.pageCount]) };
|
|
41722
41728
|
} catch (err) {
|
|
41723
|
-
return { success: false, fileType: "xlsx", error:
|
|
41729
|
+
return { success: false, fileType: "xlsx", error: _chunkRHMIEEAZcjs.sanitizeError.call(void 0, err), code: _chunkRHMIEEAZcjs.classifyError.call(void 0, err) };
|
|
41724
41730
|
}
|
|
41725
41731
|
}
|
|
41726
41732
|
async function parseXls(buffer, options) {
|
|
41727
41733
|
try {
|
|
41728
41734
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
41729
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
41735
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _935 => _935.pageCount]) };
|
|
41730
41736
|
} catch (err) {
|
|
41731
|
-
return { success: false, fileType: "xls", error:
|
|
41737
|
+
return { success: false, fileType: "xls", error: _chunkRHMIEEAZcjs.sanitizeError.call(void 0, err), code: _chunkRHMIEEAZcjs.classifyError.call(void 0, err) };
|
|
41732
41738
|
}
|
|
41733
41739
|
}
|
|
41734
41740
|
async function parseDocx(buffer, options) {
|
|
41735
41741
|
try {
|
|
41736
41742
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
41737
|
-
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
41743
|
+
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _936 => _936.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _937 => _937.pageCount]) }, _optionalChain([options, 'optionalAccess', _938 => _938.scriptTags]) === false);
|
|
41738
41744
|
} catch (err) {
|
|
41739
|
-
return { success: false, fileType: "docx", error:
|
|
41745
|
+
return { success: false, fileType: "docx", error: _chunkRHMIEEAZcjs.sanitizeError.call(void 0, err), code: _chunkRHMIEEAZcjs.classifyError.call(void 0, err) };
|
|
41740
41746
|
}
|
|
41741
41747
|
}
|
|
41742
41748
|
async function parsePptx(buffer, options) {
|
|
41743
41749
|
try {
|
|
41744
41750
|
const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
|
|
41745
|
-
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
41751
|
+
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _939 => _939.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _940 => _940.pageCount]) }, _optionalChain([options, 'optionalAccess', _941 => _941.scriptTags]) === false);
|
|
41746
41752
|
} catch (err) {
|
|
41747
|
-
return { success: false, fileType: "pptx", error:
|
|
41753
|
+
return { success: false, fileType: "pptx", error: _chunkRHMIEEAZcjs.sanitizeError.call(void 0, err), code: _chunkRHMIEEAZcjs.classifyError.call(void 0, err) };
|
|
41748
41754
|
}
|
|
41749
41755
|
}
|
|
41750
41756
|
async function parseHwpml(buffer, options) {
|
|
41751
41757
|
try {
|
|
41752
41758
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
41753
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
41759
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _942 => _942.pageCount]) };
|
|
41754
41760
|
} catch (err) {
|
|
41755
|
-
return { success: false, fileType: "hwpml", error:
|
|
41761
|
+
return { success: false, fileType: "hwpml", error: _chunkRHMIEEAZcjs.sanitizeError.call(void 0, err), code: _chunkRHMIEEAZcjs.classifyError.call(void 0, err) };
|
|
41756
41762
|
}
|
|
41757
41763
|
}
|
|
41758
41764
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
41759
41765
|
let buffer;
|
|
41760
41766
|
if (typeof input === "string") {
|
|
41761
41767
|
const buf = await _promises.readFile.call(void 0, input);
|
|
41762
|
-
buffer =
|
|
41768
|
+
buffer = _chunkRHMIEEAZcjs.toArrayBuffer.call(void 0, buf);
|
|
41763
41769
|
} else if (Buffer.isBuffer(input)) {
|
|
41764
|
-
buffer =
|
|
41770
|
+
buffer = _chunkRHMIEEAZcjs.toArrayBuffer.call(void 0, input);
|
|
41765
41771
|
} else {
|
|
41766
41772
|
buffer = input;
|
|
41767
41773
|
}
|
|
@@ -41787,7 +41793,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
41787
41793
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
41788
41794
|
}
|
|
41789
41795
|
const fill = fillFormFields(parsed.blocks, values);
|
|
41790
|
-
const markdown =
|
|
41796
|
+
const markdown = _chunkW5NXOMCDcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
41791
41797
|
if (outputFormat === "hwpx") {
|
|
41792
41798
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
41793
41799
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -41883,5 +41889,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
41883
41889
|
|
|
41884
41890
|
|
|
41885
41891
|
|
|
41886
|
-
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 =
|
|
41892
|
+
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 = _chunkRHMIEEAZcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkW5NXOMCDcjs.blocksToMarkdown; exports.blocksToPages = _chunkUOXOYZU4cjs.blocksToPages; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.chooseTableRepresentation = chooseTableRepresentation; exports.classifyTable = classifyTable; exports.classifyTableTree = classifyTableTree; exports.collectTableBlocks = collectTableBlocks; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractClickHereFields = extractClickHereFields; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.extractRenderedRegions = extractRenderedRegions; exports.extractTables = extractTables; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.flattenLayoutTables = _chunkW5NXOMCDcjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunkW5NXOMCDcjs.hasStructuredCellContent; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.lintMuncheText = lintMuncheText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.muncheLintWarnings = muncheLintWarnings; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parsePptx = parsePptx; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderDocument = renderDocument; exports.renderDocumentToScene = renderDocumentToScene; exports.renderHtml = renderHtml; exports.renderHwp5Pages = renderHwp5Pages; exports.renderHwpxToSvg = renderHwpxToSvg; exports.renderSceneToHtml = renderSceneToHtml; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.usesGaejosikMunche = usesGaejosikMunche; exports.validateHwpx = validateHwpx;
|
|
41887
41893
|
//# sourceMappingURL=index.cjs.map
|