kordoc 4.18.11 → 4.18.13
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 +2 -1
- package/dist/{-TUDCOQX6.js → -DC2OO5KO.js} +11 -11
- package/dist/{chunk-PF4O626Y.js → chunk-32ZUIHSY.js} +3 -3
- package/dist/{chunk-Q5GB73E7.cjs → chunk-3FGHQWJP.cjs} +151 -130
- package/dist/chunk-3FGHQWJP.cjs.map +1 -0
- package/dist/{chunk-GNXDTPP6.js → chunk-6AYTYTFY.js} +3 -3
- package/dist/{chunk-DT5OWHWO.cjs → chunk-6CQZMVXW.cjs} +3 -3
- package/dist/{chunk-DT5OWHWO.cjs.map → chunk-6CQZMVXW.cjs.map} +1 -1
- package/dist/{chunk-IUOGBCVI.cjs → chunk-6FW3AZWN.cjs} +6 -6
- package/dist/{chunk-IUOGBCVI.cjs.map → chunk-6FW3AZWN.cjs.map} +1 -1
- package/dist/{chunk-KFB7LHCB.js → chunk-7LOD4IGO.js} +4 -4
- package/dist/{chunk-5GVDHHHO.js → chunk-DHEUQXXR.js} +2 -2
- package/dist/{chunk-KA2NMWIC.js → chunk-EBXJ45VZ.js} +2 -2
- package/dist/{chunk-DU2DV4LO.js → chunk-EZSWBHHI.js} +2 -2
- package/dist/{chunk-7H5P475X.cjs → chunk-GGMIPTM5.cjs} +12 -12
- package/dist/{chunk-7H5P475X.cjs.map → chunk-GGMIPTM5.cjs.map} +1 -1
- package/dist/{chunk-PIRSOTKK.js → chunk-GSW7W7AL.js} +2 -2
- package/dist/{chunk-TYIUJKUT.js → chunk-GUH6HYSZ.js} +10 -10
- package/dist/{chunk-CNU4NPCC.js → chunk-INESPVEV.js} +26 -5
- package/dist/chunk-INESPVEV.js.map +1 -0
- package/dist/{chunk-DXRKZWC3.js → chunk-IRN5SDY2.js} +2 -2
- package/dist/{chunk-P6GO34IP.js → chunk-ISC2TH24.js} +2 -2
- package/dist/{chunk-WP6KG5Z7.js → chunk-JKHU7HID.js} +2 -2
- package/dist/{chunk-UAWOYMBR.js → chunk-JPSLMPFI.js} +2 -2
- package/dist/{chunk-QK6AJJMJ.js → chunk-JWTZ3OVZ.js} +2 -2
- package/dist/{chunk-FS6RCEF6.cjs → chunk-K6WSMTVU.cjs} +2 -2
- package/dist/{chunk-FS6RCEF6.cjs.map → chunk-K6WSMTVU.cjs.map} +1 -1
- package/dist/{chunk-56QHHRWD.js → chunk-LKA7Z2NH.js} +2 -2
- package/dist/{chunk-XJCWMVVY.js → chunk-PHMWSWHJ.js} +2 -2
- package/dist/{chunk-JZ3VPASI.js → chunk-PN5WWW56.js} +2 -2
- package/dist/{chunk-PC4U3XRK.cjs → chunk-RQEDNI4P.cjs} +3 -3
- package/dist/{chunk-PC4U3XRK.cjs.map → chunk-RQEDNI4P.cjs.map} +1 -1
- package/dist/{chunk-L7TALZNE.js → chunk-SVIOP7PE.js} +6 -6
- package/dist/{chunk-UG4GIJSH.js → chunk-V7LKQNC4.js} +2 -2
- package/dist/{chunk-DKVS6CFO.js → chunk-VDEENOPW.js} +2 -2
- package/dist/{chunk-UETNJSA7.js → chunk-XVB3PUPJ.js} +2 -2
- package/dist/{chunk-CMROXIWJ.js → chunk-ZNY5BRV6.js} +27 -6
- package/dist/chunk-ZNY5BRV6.js.map +1 -0
- package/dist/chunks-JZW2TXIZ.js +10 -0
- package/dist/cli.js +26 -26
- package/dist/{formula-5BPY5GQL.js → formula-DAMFHLQO.js} +3 -3
- package/dist/{formula-VUI2AJUZ.cjs → formula-HJNQGPRC.cjs} +9 -9
- package/dist/{formula-VUI2AJUZ.cjs.map → formula-HJNQGPRC.cjs.map} +1 -1
- package/dist/{formula-RA2JV55J.js → formula-YCAO5IVW.js} +4 -4
- package/dist/{image-ocr-3LUFXLSS.cjs → image-ocr-AZ25IOC7.cjs} +15 -15
- package/dist/{image-ocr-3LUFXLSS.cjs.map → image-ocr-AZ25IOC7.cjs.map} +1 -1
- package/dist/{image-ocr-MOGXLPIS.js → image-ocr-PAF76DAW.js} +9 -9
- package/dist/{image-ocr-QDNBFOLW.js → image-ocr-VH54SDZ7.js} +6 -6
- package/dist/index.cjs +277 -277
- package/dist/index.js +5 -5
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-PKJUJTPC.js → model-bundle-53CHDYCG.js} +5 -5
- package/dist/{models-ZZCRW54N.js → models-UVLAKK3M.js} +5 -5
- package/dist/{parser-SL5XDJYU.cjs → parser-HWAOPQYK.cjs} +126 -126
- package/dist/{parser-SL5XDJYU.cjs.map → parser-HWAOPQYK.cjs.map} +1 -1
- package/dist/{parser-PICN5MDD.js → parser-I4D3TRGU.js} +11 -11
- package/dist/{parser-IU4QXSEQ.js → parser-Z6PHB54O.js} +8 -8
- package/dist/pdf-ocr-F4ICXO7W.js +20 -0
- package/dist/pdf-ocr-HR6CXGTX.cjs +17 -0
- package/dist/{pdf-ocr-37GLDHR2.cjs.map → pdf-ocr-HR6CXGTX.cjs.map} +1 -1
- package/dist/pdf-ocr-JI3K7JIN.js +16 -0
- package/dist/{profile-io-TQXBV4NZ.js → profile-io-WHCWCOPW.js} +3 -3
- package/dist/{rasterize-QHUKA2N7.js → rasterize-5DZ3DHGH.js} +3 -3
- package/dist/{redact-doc-HHTMXA3E.js → redact-doc-RNJVMFGQ.js} +11 -11
- package/dist/{render-RZF6SNSN.js → render-NZ6RA6SW.js} +7 -7
- package/dist/seal-WHJ6O5HT.js +10 -0
- package/dist/{setup-IUCBBXYG.js → setup-U3EQNK4Z.js} +3 -3
- package/dist/visual-JDAS4R43.js +20 -0
- package/dist/{watch-G46MOBKP.js → watch-GB2M7XU6.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-CMROXIWJ.js.map +0 -1
- package/dist/chunk-CNU4NPCC.js.map +0 -1
- package/dist/chunk-Q5GB73E7.cjs.map +0 -1
- package/dist/chunks-ZZZGBVGM.js +0 -10
- package/dist/pdf-ocr-37GLDHR2.cjs +0 -17
- package/dist/pdf-ocr-7AWV7MY3.js +0 -20
- package/dist/pdf-ocr-UXP4CV6V.js +0 -16
- package/dist/seal-TBTMKXLY.js +0 -10
- package/dist/visual-I64Z7W3Q.js +0 -20
- /package/dist/{-TUDCOQX6.js.map → -DC2OO5KO.js.map} +0 -0
- /package/dist/{chunk-PF4O626Y.js.map → chunk-32ZUIHSY.js.map} +0 -0
- /package/dist/{chunk-GNXDTPP6.js.map → chunk-6AYTYTFY.js.map} +0 -0
- /package/dist/{chunk-KFB7LHCB.js.map → chunk-7LOD4IGO.js.map} +0 -0
- /package/dist/{chunk-5GVDHHHO.js.map → chunk-DHEUQXXR.js.map} +0 -0
- /package/dist/{chunk-KA2NMWIC.js.map → chunk-EBXJ45VZ.js.map} +0 -0
- /package/dist/{chunk-DU2DV4LO.js.map → chunk-EZSWBHHI.js.map} +0 -0
- /package/dist/{chunk-PIRSOTKK.js.map → chunk-GSW7W7AL.js.map} +0 -0
- /package/dist/{chunk-TYIUJKUT.js.map → chunk-GUH6HYSZ.js.map} +0 -0
- /package/dist/{chunk-DXRKZWC3.js.map → chunk-IRN5SDY2.js.map} +0 -0
- /package/dist/{chunk-P6GO34IP.js.map → chunk-ISC2TH24.js.map} +0 -0
- /package/dist/{chunk-WP6KG5Z7.js.map → chunk-JKHU7HID.js.map} +0 -0
- /package/dist/{chunk-UAWOYMBR.js.map → chunk-JPSLMPFI.js.map} +0 -0
- /package/dist/{chunk-QK6AJJMJ.js.map → chunk-JWTZ3OVZ.js.map} +0 -0
- /package/dist/{chunk-56QHHRWD.js.map → chunk-LKA7Z2NH.js.map} +0 -0
- /package/dist/{chunk-XJCWMVVY.js.map → chunk-PHMWSWHJ.js.map} +0 -0
- /package/dist/{chunk-JZ3VPASI.js.map → chunk-PN5WWW56.js.map} +0 -0
- /package/dist/{chunk-L7TALZNE.js.map → chunk-SVIOP7PE.js.map} +0 -0
- /package/dist/{chunk-UG4GIJSH.js.map → chunk-V7LKQNC4.js.map} +0 -0
- /package/dist/{chunk-DKVS6CFO.js.map → chunk-VDEENOPW.js.map} +0 -0
- /package/dist/{chunk-UETNJSA7.js.map → chunk-XVB3PUPJ.js.map} +0 -0
- /package/dist/{chunks-ZZZGBVGM.js.map → chunks-JZW2TXIZ.js.map} +0 -0
- /package/dist/{formula-5BPY5GQL.js.map → formula-DAMFHLQO.js.map} +0 -0
- /package/dist/{formula-RA2JV55J.js.map → formula-YCAO5IVW.js.map} +0 -0
- /package/dist/{image-ocr-MOGXLPIS.js.map → image-ocr-PAF76DAW.js.map} +0 -0
- /package/dist/{image-ocr-QDNBFOLW.js.map → image-ocr-VH54SDZ7.js.map} +0 -0
- /package/dist/{model-bundle-PKJUJTPC.js.map → model-bundle-53CHDYCG.js.map} +0 -0
- /package/dist/{models-ZZCRW54N.js.map → models-UVLAKK3M.js.map} +0 -0
- /package/dist/{parser-PICN5MDD.js.map → parser-I4D3TRGU.js.map} +0 -0
- /package/dist/{parser-IU4QXSEQ.js.map → parser-Z6PHB54O.js.map} +0 -0
- /package/dist/{pdf-ocr-7AWV7MY3.js.map → pdf-ocr-F4ICXO7W.js.map} +0 -0
- /package/dist/{pdf-ocr-UXP4CV6V.js.map → pdf-ocr-JI3K7JIN.js.map} +0 -0
- /package/dist/{profile-io-TQXBV4NZ.js.map → profile-io-WHCWCOPW.js.map} +0 -0
- /package/dist/{rasterize-QHUKA2N7.js.map → rasterize-5DZ3DHGH.js.map} +0 -0
- /package/dist/{redact-doc-HHTMXA3E.js.map → redact-doc-RNJVMFGQ.js.map} +0 -0
- /package/dist/{render-RZF6SNSN.js.map → render-NZ6RA6SW.js.map} +0 -0
- /package/dist/{seal-TBTMKXLY.js.map → seal-WHJ6O5HT.js.map} +0 -0
- /package/dist/{setup-IUCBBXYG.js.map → setup-U3EQNK4Z.js.map} +0 -0
- /package/dist/{visual-I64Z7W3Q.js.map → visual-JDAS4R43.js.map} +0 -0
- /package/dist/{watch-G46MOBKP.js.map → watch-GB2M7XU6.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 _chunkRQEDNI4Pcjs = require('./chunk-RQEDNI4P.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
@@ -31,7 +31,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _chunk6FW3AZWNcjs = require('./chunk-6FW3AZWN.cjs');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
@@ -49,14 +49,14 @@ var _chunkIUOGBCVIcjs = require('./chunk-IUOGBCVI.cjs');
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
var
|
|
52
|
+
var _chunkK6WSMTVUcjs = require('./chunk-K6WSMTVU.cjs');
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
56
56
|
|
|
57
57
|
// src/plain-markdown.ts
|
|
58
58
|
function toPlainMarkdown(md2) {
|
|
59
|
-
return
|
|
59
|
+
return _chunk6FW3AZWNcjs.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
60
|
}
|
|
61
61
|
|
|
62
62
|
// src/html-tables.ts
|
|
@@ -573,9 +573,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
573
573
|
}
|
|
574
574
|
|
|
575
575
|
// src/hwpx/parser-shared.ts
|
|
576
|
-
var MAX_DECOMPRESS_SIZE =
|
|
576
|
+
var MAX_DECOMPRESS_SIZE = _chunkK6WSMTVUcjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
577
577
|
var MAX_ZIP_ENTRIES = 500;
|
|
578
|
-
var ZipBombError = class extends
|
|
578
|
+
var ZipBombError = class extends _chunkK6WSMTVUcjs.KordocError {
|
|
579
579
|
constructor(message) {
|
|
580
580
|
super(message);
|
|
581
581
|
this.name = "ZipBombError";
|
|
@@ -596,7 +596,7 @@ function createSectionShared() {
|
|
|
596
596
|
function createXmlParser(warnings) {
|
|
597
597
|
return new (0, _xmldom.DOMParser)({
|
|
598
598
|
onError(level, msg2) {
|
|
599
|
-
if (level === "fatalError") throw new (0,
|
|
599
|
+
if (level === "fatalError") throw new (0, _chunkK6WSMTVUcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
600
600
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
601
601
|
}
|
|
602
602
|
});
|
|
@@ -631,13 +631,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
631
631
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
632
632
|
const checksumType = attrOf(inner, "checksum-type");
|
|
633
633
|
if (algorithm !== AES256_CBC) {
|
|
634
|
-
throw new (0,
|
|
634
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
635
635
|
}
|
|
636
636
|
if (startKey !== START_KEY_SHA256) {
|
|
637
|
-
throw new (0,
|
|
637
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
638
638
|
}
|
|
639
639
|
if (!_optionalChain([checksumType, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(CHECKSUM_SHA256_1K)])) {
|
|
640
|
-
throw new (0,
|
|
640
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
641
641
|
}
|
|
642
642
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
643
643
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -645,10 +645,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
645
645
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
646
646
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
647
647
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
648
|
-
throw new (0,
|
|
648
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
649
649
|
}
|
|
650
650
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
651
|
-
throw new (0,
|
|
651
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
652
652
|
}
|
|
653
653
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
654
654
|
}
|
|
@@ -681,11 +681,11 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
681
681
|
for (const entry of entries) {
|
|
682
682
|
const file = zip.file(entry.path);
|
|
683
683
|
if (!file) {
|
|
684
|
-
throw new (0,
|
|
684
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
685
685
|
}
|
|
686
686
|
const plain4 = decryptEntry(await file.async("nodebuffer"), entry, startKey);
|
|
687
687
|
if (!plain4) {
|
|
688
|
-
throw new (0,
|
|
688
|
+
throw new (0, _chunkK6WSMTVUcjs.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
689
|
}
|
|
690
690
|
decrypted.push({ path: entry.path, plain: plain4 });
|
|
691
691
|
}
|
|
@@ -749,10 +749,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
749
749
|
const xml = await file.async("text");
|
|
750
750
|
if (decompressed) {
|
|
751
751
|
decompressed.total += xml.length * 2;
|
|
752
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
752
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkK6WSMTVUcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
753
753
|
}
|
|
754
754
|
const parser = createXmlParser();
|
|
755
|
-
const doc = parser.parseFromString(
|
|
755
|
+
const doc = parser.parseFromString(_chunkK6WSMTVUcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
756
756
|
if (!doc.documentElement) continue;
|
|
757
757
|
const domDoc = doc;
|
|
758
758
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -965,9 +965,9 @@ function detectHwpxHeadings(blocks, styleMap, tocTexts) {
|
|
|
965
965
|
let level = 0;
|
|
966
966
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _18 => _18.style, 'optionalAccess', _19 => _19.fontSize])) {
|
|
967
967
|
const ratio = block.style.fontSize / baseFontSize;
|
|
968
|
-
if (ratio >=
|
|
969
|
-
else if (ratio >=
|
|
970
|
-
else if (ratio >=
|
|
968
|
+
if (ratio >= _chunk6FW3AZWNcjs.HEADING_RATIO_H1) level = 1;
|
|
969
|
+
else if (ratio >= _chunk6FW3AZWNcjs.HEADING_RATIO_H2) level = 2;
|
|
970
|
+
else if (ratio >= _chunk6FW3AZWNcjs.HEADING_RATIO_H3) level = 3;
|
|
971
971
|
}
|
|
972
972
|
const compactText = text.replace(/\s+/g, "");
|
|
973
973
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1699,7 +1699,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1699
1699
|
|
|
1700
1700
|
// src/hwpx/table-build.ts
|
|
1701
1701
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1702
|
-
const table2 =
|
|
1702
|
+
const table2 = _chunk6FW3AZWNcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1703
1703
|
if (state.caption) table2.caption = state.caption;
|
|
1704
1704
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
1705
1705
|
if (_optionalChain([state, 'access', _29 => _29.captionBlocks, 'optionalAccess', _30 => _30.length])) table2.captionBlocks = state.captionBlocks;
|
|
@@ -1728,7 +1728,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1728
1728
|
for (const src of row) {
|
|
1729
1729
|
if (!src.edges || src.rowAddr === void 0 || src.colAddr === void 0) continue;
|
|
1730
1730
|
const cand = _optionalChain([table2, 'access', _34 => _34.cells, 'access', _35 => _35[src.rowAddr], 'optionalAccess', _36 => _36[src.colAddr]]);
|
|
1731
|
-
if (cand && anchors2.includes(cand))
|
|
1731
|
+
if (cand && anchors2.includes(cand)) _chunk6FW3AZWNcjs.CELL_EDGES.set(cand, src.edges);
|
|
1732
1732
|
}
|
|
1733
1733
|
}
|
|
1734
1734
|
const claimed = /* @__PURE__ */ new Set();
|
|
@@ -1778,7 +1778,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1778
1778
|
const cell2 = parentTable.cell;
|
|
1779
1779
|
(cell2.blocks ??= []).push(block);
|
|
1780
1780
|
cell2.hasStructure = true;
|
|
1781
|
-
let flat =
|
|
1781
|
+
let flat = _chunk6FW3AZWNcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1782
1782
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1783
1783
|
if (flat) {
|
|
1784
1784
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -2012,7 +2012,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2012
2012
|
const tkids = rc.childNodes;
|
|
2013
2013
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _44 => _44.length]), () => ( 0))); k++) {
|
|
2014
2014
|
const tk = tkids[k];
|
|
2015
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
2015
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunk6FW3AZWNcjs.escapeLiteralTags.call(void 0, _chunk6FW3AZWNcjs.escapeLiteralDollar.call(void 0, tk.textContent || ""));
|
|
2016
2016
|
else if (tk.nodeType === 1) {
|
|
2017
2017
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
2018
2018
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -2032,7 +2032,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2032
2032
|
const span2 = { text };
|
|
2033
2033
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span2.code = true;
|
|
2034
2034
|
else {
|
|
2035
|
-
if (_optionalChain([cp, 'optionalAccess', _45 => _45.script])) span2.text =
|
|
2035
|
+
if (_optionalChain([cp, 'optionalAccess', _45 => _45.script])) span2.text = _chunk6FW3AZWNcjs.wrapScript.call(void 0, text, cp.script);
|
|
2036
2036
|
if (_optionalChain([cp, 'optionalAccess', _46 => _46.bold])) span2.bold = true;
|
|
2037
2037
|
if (_optionalChain([cp, 'optionalAccess', _47 => _47.italic])) span2.italic = true;
|
|
2038
2038
|
if (_optionalChain([cp, 'optionalAccess', _48 => _48.strike])) span2.strike = true;
|
|
@@ -2052,7 +2052,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2052
2052
|
}
|
|
2053
2053
|
}
|
|
2054
2054
|
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 =
|
|
2055
|
+
for (const s of merged) s.text = _chunk6FW3AZWNcjs.tidyScriptTags.call(void 0, s.text);
|
|
2056
2056
|
return merged;
|
|
2057
2057
|
}
|
|
2058
2058
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -2079,7 +2079,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2079
2079
|
// src/hwpx/section-walker.ts
|
|
2080
2080
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
2081
2081
|
const parser = createXmlParser(warnings);
|
|
2082
|
-
const doc = parser.parseFromString(
|
|
2082
|
+
const doc = parser.parseFromString(_chunkK6WSMTVUcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2083
2083
|
if (!doc.documentElement) return [];
|
|
2084
2084
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
2085
2085
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2178,8 +2178,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2178
2178
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2179
2179
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2180
2180
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2181
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2182
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2181
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunk6FW3AZWNcjs.MAX_COLS);
|
|
2182
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunk6FW3AZWNcjs.MAX_ROWS);
|
|
2183
2183
|
}
|
|
2184
2184
|
break;
|
|
2185
2185
|
case "p": {
|
|
@@ -2497,7 +2497,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2497
2497
|
const sink = [];
|
|
2498
2498
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2499
2499
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2500
|
-
let flat =
|
|
2500
|
+
let flat = _chunk6FW3AZWNcjs.convertTableToText.call(void 0, st.rows);
|
|
2501
2501
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2502
2502
|
const built = [];
|
|
2503
2503
|
completeTable(st, [], built, ctx);
|
|
@@ -2658,7 +2658,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2658
2658
|
let url = (ch.textContent || "").trim();
|
|
2659
2659
|
if (!url) continue;
|
|
2660
2660
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2661
|
-
const safe =
|
|
2661
|
+
const safe = _chunkK6WSMTVUcjs.sanitizeHref.call(void 0, url);
|
|
2662
2662
|
if (safe) return safe;
|
|
2663
2663
|
}
|
|
2664
2664
|
return void 0;
|
|
@@ -2807,7 +2807,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2807
2807
|
_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
2808
|
}
|
|
2809
2809
|
} else {
|
|
2810
|
-
text +=
|
|
2810
|
+
text += _chunk6FW3AZWNcjs.escapeLiteralTags.call(void 0, _chunk6FW3AZWNcjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, "")));
|
|
2811
2811
|
}
|
|
2812
2812
|
continue;
|
|
2813
2813
|
}
|
|
@@ -2860,7 +2860,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2860
2860
|
case "hyperlink": {
|
|
2861
2861
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2862
2862
|
if (url) {
|
|
2863
|
-
const safe =
|
|
2863
|
+
const safe = _chunkK6WSMTVUcjs.sanitizeHref.call(void 0, url);
|
|
2864
2864
|
if (safe) href = safe;
|
|
2865
2865
|
}
|
|
2866
2866
|
walk(child, depth + 1);
|
|
@@ -2954,7 +2954,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2954
2954
|
walk(child, depth + 1);
|
|
2955
2955
|
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
2956
2956
|
const added = text.slice(start);
|
|
2957
|
-
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) +
|
|
2957
|
+
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) + _chunk6FW3AZWNcjs.wrapScript.call(void 0, added, script);
|
|
2958
2958
|
}
|
|
2959
2959
|
break;
|
|
2960
2960
|
}
|
|
@@ -2977,7 +2977,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2977
2977
|
}
|
|
2978
2978
|
if (applied.length) href = void 0;
|
|
2979
2979
|
}
|
|
2980
|
-
text =
|
|
2980
|
+
text = _chunk6FW3AZWNcjs.tidyScriptTags.call(void 0, text);
|
|
2981
2981
|
const toc = takeTocLeaders(text);
|
|
2982
2982
|
text = toc.text;
|
|
2983
2983
|
const tocEntry = toc.tocEntry;
|
|
@@ -3091,7 +3091,7 @@ function decompressStream(data) {
|
|
|
3091
3091
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
3092
3092
|
}
|
|
3093
3093
|
function parseFileHeader(data) {
|
|
3094
|
-
if (data.length < 40) throw new (0,
|
|
3094
|
+
if (data.length < 40) throw new (0, _chunkK6WSMTVUcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
3095
3095
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
3096
3096
|
return {
|
|
3097
3097
|
signature: sig,
|
|
@@ -3601,13 +3601,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3601
3601
|
}
|
|
3602
3602
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3603
3603
|
for (const path of allCandidates) {
|
|
3604
|
-
if (
|
|
3604
|
+
if (_chunkK6WSMTVUcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3605
3605
|
const file = zip.file(path);
|
|
3606
3606
|
if (!file) continue;
|
|
3607
3607
|
try {
|
|
3608
3608
|
const data = await file.async("uint8array");
|
|
3609
3609
|
decompressed.total += data.length;
|
|
3610
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3610
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkK6WSMTVUcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3611
3611
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3612
3612
|
const mimeType = imageExtToMime(ext);
|
|
3613
3613
|
imageIndex++;
|
|
@@ -3617,7 +3617,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3617
3617
|
usedPaths.add(path);
|
|
3618
3618
|
break;
|
|
3619
3619
|
} catch (err) {
|
|
3620
|
-
if (err instanceof
|
|
3620
|
+
if (err instanceof _chunkK6WSMTVUcjs.KordocError) throw err;
|
|
3621
3621
|
}
|
|
3622
3622
|
}
|
|
3623
3623
|
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 +3637,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3637
3637
|
if (sweepUnreferenced) {
|
|
3638
3638
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3639
3639
|
for (const file of binEntries) {
|
|
3640
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3640
|
+
if (file.dir || usedPaths.has(file.name) || _chunkK6WSMTVUcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3641
3641
|
const basename = file.name.slice(file.name.lastIndexOf("/") + 1);
|
|
3642
3642
|
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
3643
|
try {
|
|
3644
3644
|
const data = await file.async("uint8array");
|
|
3645
3645
|
decompressed.total += data.length;
|
|
3646
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3646
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkK6WSMTVUcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3647
3647
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3648
3648
|
let mimeType = imageExtToMime(ext);
|
|
3649
3649
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3657,7 +3657,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3657
3657
|
images.push(img);
|
|
3658
3658
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3659
3659
|
} catch (err) {
|
|
3660
|
-
if (err instanceof
|
|
3660
|
+
if (err instanceof _chunkK6WSMTVUcjs.KordocError) throw err;
|
|
3661
3661
|
_optionalChain([warnings, 'optionalAccess', _135 => _135.push, 'call', _136 => _136({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3662
3662
|
}
|
|
3663
3663
|
}
|
|
@@ -3708,7 +3708,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3708
3708
|
}
|
|
3709
3709
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3710
3710
|
const name = new TextDecoder().decode(nameBytes);
|
|
3711
|
-
if (
|
|
3711
|
+
if (_chunkK6WSMTVUcjs.isPathTraversal.call(void 0, name)) {
|
|
3712
3712
|
pos = fileStart + compSize;
|
|
3713
3713
|
continue;
|
|
3714
3714
|
}
|
|
@@ -3726,7 +3726,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3726
3726
|
continue;
|
|
3727
3727
|
}
|
|
3728
3728
|
totalDecompressed += content.length * 2;
|
|
3729
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3729
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3730
3730
|
sectionNum++;
|
|
3731
3731
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3732
3732
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3735,9 +3735,9 @@ function extractFromBrokenZip(buffer) {
|
|
|
3735
3735
|
continue;
|
|
3736
3736
|
}
|
|
3737
3737
|
}
|
|
3738
|
-
if (blocks.length === 0) throw new (0,
|
|
3738
|
+
if (blocks.length === 0) throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3739
3739
|
applyPageText(blocks, shared);
|
|
3740
|
-
const markdown =
|
|
3740
|
+
const markdown = _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3741
3741
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3742
3742
|
}
|
|
3743
3743
|
async function readKordocLayout(zip) {
|
|
@@ -3762,11 +3762,11 @@ async function resolveSectionPaths(zip) {
|
|
|
3762
3762
|
if (paths.length > 0) return paths;
|
|
3763
3763
|
}
|
|
3764
3764
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3765
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3765
|
+
return sectionFiles.map((f) => f.name).sort(_chunkK6WSMTVUcjs.compareSectionPaths);
|
|
3766
3766
|
}
|
|
3767
3767
|
function parseSectionPathsFromManifest(xml) {
|
|
3768
3768
|
const parser = createXmlParser();
|
|
3769
|
-
const doc = parser.parseFromString(
|
|
3769
|
+
const doc = parser.parseFromString(_chunkK6WSMTVUcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3770
3770
|
const opf = "http://www.idpf.org/2007/opf/";
|
|
3771
3771
|
const namespacedItems = doc.getElementsByTagNameNS(opf, "item");
|
|
3772
3772
|
const namespacedSpine = doc.getElementsByTagNameNS(opf, "itemref");
|
|
@@ -3776,7 +3776,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3776
3776
|
for (let i = 0; i < items.length; i++) {
|
|
3777
3777
|
const item = items[i];
|
|
3778
3778
|
const id = item.getAttribute("id") || "";
|
|
3779
|
-
const href =
|
|
3779
|
+
const href = _chunkK6WSMTVUcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3780
3780
|
if (id && href) idToHref.set(id, href);
|
|
3781
3781
|
}
|
|
3782
3782
|
if (spine.length > 0) {
|
|
@@ -3787,7 +3787,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3787
3787
|
}
|
|
3788
3788
|
if (ordered.length > 0) return ordered;
|
|
3789
3789
|
}
|
|
3790
|
-
return Array.from(idToHref.values()).sort(
|
|
3790
|
+
return Array.from(idToHref.values()).sort(_chunkK6WSMTVUcjs.compareSectionPaths);
|
|
3791
3791
|
}
|
|
3792
3792
|
|
|
3793
3793
|
// src/hwpx/metadata.ts
|
|
@@ -3799,7 +3799,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3799
3799
|
const xml = await file.async("text");
|
|
3800
3800
|
if (decompressed) {
|
|
3801
3801
|
decompressed.total += xml.length * 2;
|
|
3802
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3802
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkK6WSMTVUcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3803
3803
|
}
|
|
3804
3804
|
return xml;
|
|
3805
3805
|
};
|
|
@@ -3821,7 +3821,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3821
3821
|
}
|
|
3822
3822
|
}
|
|
3823
3823
|
function parseOpfMetadata(xml, metadata) {
|
|
3824
|
-
const root = createXmlParser().parseFromString(
|
|
3824
|
+
const root = createXmlParser().parseFromString(_chunkK6WSMTVUcjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3825
3825
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3826
3826
|
if (!md2) return;
|
|
3827
3827
|
let title;
|
|
@@ -3854,7 +3854,7 @@ function isoDate(s) {
|
|
|
3854
3854
|
}
|
|
3855
3855
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3856
3856
|
const parser = createXmlParser();
|
|
3857
|
-
const doc = parser.parseFromString(
|
|
3857
|
+
const doc = parser.parseFromString(_chunkK6WSMTVUcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3858
3858
|
if (!doc.documentElement) return;
|
|
3859
3859
|
const getText = (tagNames) => {
|
|
3860
3860
|
for (const tag of tagNames) {
|
|
@@ -3893,7 +3893,7 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3893
3893
|
}
|
|
3894
3894
|
}
|
|
3895
3895
|
async function parseHwpxDocument(buffer, options) {
|
|
3896
|
-
|
|
3896
|
+
_chunkK6WSMTVUcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3897
3897
|
let zip;
|
|
3898
3898
|
try {
|
|
3899
3899
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3902,7 +3902,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3902
3902
|
}
|
|
3903
3903
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3904
3904
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3905
|
-
throw new (0,
|
|
3905
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3906
3906
|
}
|
|
3907
3907
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3908
3908
|
if (manifestFile) {
|
|
@@ -3921,7 +3921,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3921
3921
|
}
|
|
3922
3922
|
}
|
|
3923
3923
|
const hpf = await _optionalChain([zip, 'access', _162 => _162.file, 'call', _163 => _163("Contents/content.hpf"), 'optionalAccess', _164 => _164.async, 'call', _165 => _165("text"), 'access', _166 => _166.catch, 'call', _167 => _167(() => "")]);
|
|
3924
|
-
throw new (0,
|
|
3924
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(
|
|
3925
3925
|
/\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
3926
|
);
|
|
3927
3927
|
}
|
|
@@ -3933,7 +3933,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3933
3933
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3934
3934
|
const warnings = [];
|
|
3935
3935
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3936
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3936
|
+
if (sectionPaths.length === 0) throw new (0, _chunkK6WSMTVUcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3937
3937
|
let allBlocks = [];
|
|
3938
3938
|
const shared = createSectionShared();
|
|
3939
3939
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -3977,10 +3977,10 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3977
3977
|
const blocks = allBlocks;
|
|
3978
3978
|
applyPageText(blocks, shared);
|
|
3979
3979
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _174 => _174.pages]), shared.track.deletedImageRefs);
|
|
3980
|
-
const shown = _optionalChain([options, 'optionalAccess', _175 => _175.layoutTables]) === "keep" ? blocks :
|
|
3980
|
+
const shown = _optionalChain([options, 'optionalAccess', _175 => _175.layoutTables]) === "keep" ? blocks : _chunk6FW3AZWNcjs.unframeLayoutTables.call(void 0, blocks, !!_optionalChain([options, 'optionalAccess', _176 => _176.keepTrailingEmptyCols]));
|
|
3981
3981
|
detectHwpxHeadings(shown, styleMap, shared.tocTexts);
|
|
3982
3982
|
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 =
|
|
3983
|
+
const markdown = _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, shown);
|
|
3984
3984
|
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
3985
|
}
|
|
3986
3986
|
|
|
@@ -4747,7 +4747,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4747
4747
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4748
4748
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4749
4749
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4750
|
-
const wrong = () => new (0,
|
|
4750
|
+
const wrong = () => new (0, _chunkK6WSMTVUcjs.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
4751
|
let records;
|
|
4752
4752
|
try {
|
|
4753
4753
|
records = readRecords3(data);
|
|
@@ -4759,7 +4759,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4759
4759
|
}
|
|
4760
4760
|
function assertSupportedEncryptVersion(version) {
|
|
4761
4761
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4762
|
-
throw new (0,
|
|
4762
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(
|
|
4763
4763
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4764
4764
|
);
|
|
4765
4765
|
}
|
|
@@ -5200,7 +5200,7 @@ function emitParagraphBlocks(p) {
|
|
|
5200
5200
|
return blocks;
|
|
5201
5201
|
}
|
|
5202
5202
|
function tableFlatText(table2) {
|
|
5203
|
-
const flat =
|
|
5203
|
+
const flat = _chunk6FW3AZWNcjs.convertTableToText.call(void 0, table2.cells);
|
|
5204
5204
|
return table2.caption ? table2.caption + (flat ? "\n" + flat : "") : flat;
|
|
5205
5205
|
}
|
|
5206
5206
|
function blocksPlainText(blocks, sep) {
|
|
@@ -5280,8 +5280,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5280
5280
|
}
|
|
5281
5281
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5282
5282
|
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,
|
|
5283
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunk6FW3AZWNcjs.MAX_ROWS));
|
|
5284
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunk6FW3AZWNcjs.MAX_COLS));
|
|
5285
5285
|
}
|
|
5286
5286
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5287
5287
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5289,12 +5289,12 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5289
5289
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5290
5290
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5291
5291
|
}
|
|
5292
|
-
const table2 =
|
|
5292
|
+
const table2 = _chunk6FW3AZWNcjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5293
5293
|
if (table2.rows === 0) return null;
|
|
5294
5294
|
for (const c of placed) {
|
|
5295
5295
|
if (c.edges) {
|
|
5296
5296
|
const at = _optionalChain([table2, 'access', _183 => _183.cells, 'access', _184 => _184[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _185 => _185[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
5297
|
-
if (at)
|
|
5297
|
+
if (at) _chunk6FW3AZWNcjs.CELL_EDGES.set(at, c.edges);
|
|
5298
5298
|
}
|
|
5299
5299
|
if (!_optionalChain([c, 'access', _186 => _186.blocks, 'optionalAccess', _187 => _187.length]) && !c.isHeader) continue;
|
|
5300
5300
|
const target = _optionalChain([table2, 'access', _188 => _188.cells, 'access', _189 => _189[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _190 => _190[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
@@ -5496,7 +5496,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5496
5496
|
continue;
|
|
5497
5497
|
}
|
|
5498
5498
|
if (!ctrl.href) continue;
|
|
5499
|
-
const href =
|
|
5499
|
+
const href = _chunkK6WSMTVUcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5500
5500
|
if (!href) continue;
|
|
5501
5501
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK)) continue;
|
|
5502
5502
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5505,7 +5505,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5505
5505
|
}
|
|
5506
5506
|
if (text.includes(LITERAL_DOLLAR_MARK)) text = text.replaceAll(LITERAL_DOLLAR_MARK, "\\$");
|
|
5507
5507
|
text = resolveLiteralLt(text);
|
|
5508
|
-
text =
|
|
5508
|
+
text = _chunk6FW3AZWNcjs.tidyScriptTags.call(void 0, text);
|
|
5509
5509
|
const toc = takeTocLeaders(text);
|
|
5510
5510
|
text = toc.text;
|
|
5511
5511
|
let headingLevel = 0;
|
|
@@ -5718,7 +5718,7 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5718
5718
|
}
|
|
5719
5719
|
var A4_HEIGHT = 84188;
|
|
5720
5720
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5721
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5721
|
+
if (!cells.some((c) => c.pageSpanning)) _chunk6FW3AZWNcjs.markNonLayoutTable.call(void 0, table2);
|
|
5722
5722
|
}
|
|
5723
5723
|
function parseTableControl(ctrl, records, ctx) {
|
|
5724
5724
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
@@ -5730,8 +5730,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5730
5730
|
let tableIdx = -1;
|
|
5731
5731
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5732
5732
|
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),
|
|
5733
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunk6FW3AZWNcjs.MAX_ROWS);
|
|
5734
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunk6FW3AZWNcjs.MAX_COLS);
|
|
5735
5735
|
tableIdx = i2;
|
|
5736
5736
|
break;
|
|
5737
5737
|
}
|
|
@@ -5775,11 +5775,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5775
5775
|
return table3;
|
|
5776
5776
|
}
|
|
5777
5777
|
if (rows === 0 || cols === 0) {
|
|
5778
|
-
rows = Math.min(cells.length,
|
|
5778
|
+
rows = Math.min(cells.length, _chunk6FW3AZWNcjs.MAX_ROWS);
|
|
5779
5779
|
cols = 1;
|
|
5780
5780
|
}
|
|
5781
5781
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5782
|
-
const table2 =
|
|
5782
|
+
const table2 = _chunk6FW3AZWNcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5783
5783
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5784
5784
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
5785
5785
|
keepUnlessPageSpanning(table2, cells);
|
|
@@ -5798,8 +5798,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5798
5798
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5799
5799
|
const cs = rec.data.readUInt16LE(12);
|
|
5800
5800
|
const rs = rec.data.readUInt16LE(14);
|
|
5801
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5802
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5801
|
+
if (cs > 0) colSpan = Math.min(cs, _chunk6FW3AZWNcjs.MAX_COLS);
|
|
5802
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunk6FW3AZWNcjs.MAX_ROWS);
|
|
5803
5803
|
}
|
|
5804
5804
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5805
5805
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -5948,7 +5948,7 @@ function openHwp5Container(buffer, options) {
|
|
|
5948
5948
|
lenientCfb = parseLenientCfb(buffer);
|
|
5949
5949
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
5950
5950
|
} catch (e24) {
|
|
5951
|
-
throw new (0,
|
|
5951
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
5952
5952
|
}
|
|
5953
5953
|
}
|
|
5954
5954
|
const readRawStream = (path) => {
|
|
@@ -5959,14 +5959,14 @@ function openHwp5Container(buffer, options) {
|
|
|
5959
5959
|
return lenientCfb.findStream(path);
|
|
5960
5960
|
};
|
|
5961
5961
|
const headerData = readRawStream("/FileHeader");
|
|
5962
|
-
if (!headerData) throw new (0,
|
|
5962
|
+
if (!headerData) throw new (0, _chunkK6WSMTVUcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
5963
5963
|
const header = parseFileHeader(headerData);
|
|
5964
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
5965
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
5964
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkK6WSMTVUcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
5965
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkK6WSMTVUcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
5966
5966
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
5967
5967
|
if (encrypted) {
|
|
5968
5968
|
if (!_optionalChain([options, 'optionalAccess', _214 => _214.password])) {
|
|
5969
|
-
throw new (0,
|
|
5969
|
+
throw new (0, _chunkK6WSMTVUcjs.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
5970
|
}
|
|
5971
5971
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
5972
5972
|
}
|
|
@@ -5980,12 +5980,12 @@ function openHwp5Container(buffer, options) {
|
|
|
5980
5980
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
5981
5981
|
if (encrypted) {
|
|
5982
5982
|
const rawDocInfo = findStream("/DocInfo");
|
|
5983
|
-
if (!rawDocInfo) throw new (0,
|
|
5983
|
+
if (!rawDocInfo) throw new (0, _chunkK6WSMTVUcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
5984
5984
|
let docInfoData;
|
|
5985
5985
|
try {
|
|
5986
5986
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
5987
5987
|
} catch (e25) {
|
|
5988
|
-
throw new (0,
|
|
5988
|
+
throw new (0, _chunkK6WSMTVUcjs.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
5989
|
}
|
|
5990
5990
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
5991
5991
|
}
|
|
@@ -6010,10 +6010,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
6010
6010
|
try {
|
|
6011
6011
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
6012
6012
|
totalDecompressed += data.length;
|
|
6013
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6013
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6014
6014
|
out.push(readRecords(data));
|
|
6015
6015
|
} catch (secErr) {
|
|
6016
|
-
if (secErr instanceof
|
|
6016
|
+
if (secErr instanceof _chunkK6WSMTVUcjs.KordocError) throw secErr;
|
|
6017
6017
|
out.push(null);
|
|
6018
6018
|
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
6019
|
}
|
|
@@ -6033,7 +6033,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6033
6033
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
6034
6034
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
6035
6035
|
const sections = readHwp5SectionStreams(c);
|
|
6036
|
-
if (sections.length === 0) throw new (0,
|
|
6036
|
+
if (sections.length === 0) throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
6037
6037
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
6038
6038
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
6039
6039
|
const sectionTableIds = [];
|
|
@@ -6077,7 +6077,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6077
6077
|
parsedSections++;
|
|
6078
6078
|
_optionalChain([options, 'optionalAccess', _219 => _219.onProgress, 'optionalCall', _220 => _220(parsedSections, sections.length)]);
|
|
6079
6079
|
} catch (secErr) {
|
|
6080
|
-
if (secErr instanceof
|
|
6080
|
+
if (secErr instanceof _chunkK6WSMTVUcjs.KordocError) throw secErr;
|
|
6081
6081
|
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
6082
|
} finally {
|
|
6083
6083
|
pageBase += detect2.pages;
|
|
@@ -6088,10 +6088,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6088
6088
|
}
|
|
6089
6089
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
6090
6090
|
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', _221 => _221.layoutTables]) !== "keep") flatBlocks =
|
|
6091
|
+
let flatBlocks = _chunk6FW3AZWNcjs.flattenLayoutTables.call(void 0, blocks);
|
|
6092
|
+
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks = _chunk6FW3AZWNcjs.unframeLayoutTables.call(void 0, flatBlocks, !!_optionalChain([options, 'optionalAccess', _222 => _222.keepTrailingEmptyCols]));
|
|
6093
6093
|
if (_optionalChain([options, 'optionalAccess', _223 => _223.dedupeRunningHeaders])) {
|
|
6094
|
-
const deduped =
|
|
6094
|
+
const deduped = _chunk6FW3AZWNcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
6095
6095
|
const removed = flatBlocks.length - deduped.length;
|
|
6096
6096
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
6097
6097
|
flatBlocks = deduped;
|
|
@@ -6100,10 +6100,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6100
6100
|
detectHwp5Headings(flatBlocks, docInfo, doc.tocTexts);
|
|
6101
6101
|
}
|
|
6102
6102
|
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 =
|
|
6103
|
+
let markdown = _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
6104
6104
|
if (_optionalChain([options, 'optionalAccess', _224 => _224.inlineImages]) && options.images !== false && images.length > 0) {
|
|
6105
6105
|
try {
|
|
6106
|
-
markdown =
|
|
6106
|
+
markdown = _chunkRQEDNI4Pcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
6107
6107
|
} catch (inlineErr) {
|
|
6108
6108
|
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
6109
|
}
|
|
@@ -6167,9 +6167,9 @@ function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
|
6167
6167
|
let level = 0;
|
|
6168
6168
|
if (_optionalChain([block, 'access', _231 => _231.style, 'optionalAccess', _232 => _232.fontSize]) && baseFontSize > 0) {
|
|
6169
6169
|
const ratio = block.style.fontSize / baseFontSize;
|
|
6170
|
-
if (ratio >=
|
|
6171
|
-
else if (ratio >=
|
|
6172
|
-
else if (ratio >=
|
|
6170
|
+
if (ratio >= _chunk6FW3AZWNcjs.HEADING_RATIO_H1) level = 1;
|
|
6171
|
+
else if (ratio >= _chunk6FW3AZWNcjs.HEADING_RATIO_H2) level = 2;
|
|
6172
|
+
else if (ratio >= _chunk6FW3AZWNcjs.HEADING_RATIO_H3) level = 3;
|
|
6173
6173
|
}
|
|
6174
6174
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
6175
6175
|
if (level === 0) level = 2;
|
|
@@ -6301,7 +6301,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6301
6301
|
const raw = _nullishCoalesce(lcfb.findStream(`/BodyText/Section${i}`), () => ( lcfb.findStream(`Section${i}`)));
|
|
6302
6302
|
if (!raw) break;
|
|
6303
6303
|
totalBytes += raw.length;
|
|
6304
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6304
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6305
6305
|
sections.push({ idx: i, content: raw });
|
|
6306
6306
|
}
|
|
6307
6307
|
if (sections.length === 0) {
|
|
@@ -6312,7 +6312,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6312
6312
|
const raw = lcfb.findStream(e.name);
|
|
6313
6313
|
if (raw) {
|
|
6314
6314
|
totalBytes += raw.length;
|
|
6315
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6315
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6316
6316
|
sections.push({ idx, content: raw });
|
|
6317
6317
|
}
|
|
6318
6318
|
}
|
|
@@ -6329,7 +6329,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6329
6329
|
try {
|
|
6330
6330
|
const content = decryptViewText(raw, compressed);
|
|
6331
6331
|
totalDecompressed += content.length;
|
|
6332
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6332
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6333
6333
|
sections.push({ idx: i, content });
|
|
6334
6334
|
} catch (e32) {
|
|
6335
6335
|
break;
|
|
@@ -18807,25 +18807,25 @@ function desEcbDecrypt(data, key) {
|
|
|
18807
18807
|
}
|
|
18808
18808
|
function readLayout(data) {
|
|
18809
18809
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18810
|
-
throw new (0,
|
|
18810
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18811
18811
|
}
|
|
18812
18812
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18813
18813
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18814
18814
|
if (payloadOffset >= data.length) {
|
|
18815
|
-
throw new (0,
|
|
18815
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18816
18816
|
}
|
|
18817
18817
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18818
18818
|
}
|
|
18819
18819
|
function decryptHwp3Document(input, password) {
|
|
18820
18820
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18821
18821
|
if (!compressed) {
|
|
18822
|
-
throw new (0,
|
|
18822
|
+
throw new (0, _chunkK6WSMTVUcjs.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
18823
|
}
|
|
18824
18824
|
const source = Buffer.from(input);
|
|
18825
18825
|
const payload = source.subarray(payloadOffset);
|
|
18826
18826
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18827
18827
|
if (aligned.length === 0) {
|
|
18828
|
-
throw new (0,
|
|
18828
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18829
18829
|
}
|
|
18830
18830
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18831
18831
|
let inflated;
|
|
@@ -18833,14 +18833,14 @@ function decryptHwp3Document(input, password) {
|
|
|
18833
18833
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18834
18834
|
} catch (err) {
|
|
18835
18835
|
if (_optionalChain([err, 'optionalAccess', _247 => _247.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18836
|
-
throw new (0,
|
|
18836
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(
|
|
18837
18837
|
`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
18838
|
);
|
|
18839
18839
|
}
|
|
18840
|
-
throw new (0,
|
|
18840
|
+
throw new (0, _chunkK6WSMTVUcjs.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
18841
|
}
|
|
18842
18842
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18843
|
-
throw new (0,
|
|
18843
|
+
throw new (0, _chunkK6WSMTVUcjs.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
18844
|
}
|
|
18845
18845
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18846
18846
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -18897,9 +18897,9 @@ function hwp3CellGrid(info, count) {
|
|
|
18897
18897
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
18898
18898
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
18899
18899
|
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),
|
|
18900
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunk6FW3AZWNcjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunk6FW3AZWNcjs.MAX_COLS) };
|
|
18901
18901
|
});
|
|
18902
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
18902
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunk6FW3AZWNcjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunk6FW3AZWNcjs.MAX_COLS), cells };
|
|
18903
18903
|
}
|
|
18904
18904
|
|
|
18905
18905
|
// src/hwp3/parser.ts
|
|
@@ -18939,7 +18939,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
18939
18939
|
let source = Buffer.from(buffer);
|
|
18940
18940
|
if (isEncryptedHwp3(source)) {
|
|
18941
18941
|
if (!_optionalChain([options, 'optionalAccess', _248 => _248.password])) {
|
|
18942
|
-
throw new (0,
|
|
18942
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(
|
|
18943
18943
|
"\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
18944
|
);
|
|
18945
18945
|
}
|
|
@@ -18956,10 +18956,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
18956
18956
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
18957
18957
|
} catch (err) {
|
|
18958
18958
|
if (_optionalChain([err, 'optionalAccess', _249 => _249.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18959
|
-
throw new (0,
|
|
18959
|
+
throw new (0, _chunkK6WSMTVUcjs.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
18960
|
}
|
|
18961
18961
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
18962
|
-
throw new (0,
|
|
18962
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
18963
18963
|
}
|
|
18964
18964
|
} else {
|
|
18965
18965
|
body = tail;
|
|
@@ -18976,7 +18976,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
18976
18976
|
message: `HWP3 paragraph stream \uB3C4\uC911 \uD30C\uC2F1 \uC911\uB2E8: ${err instanceof Error ? err.message : String(err)}`
|
|
18977
18977
|
});
|
|
18978
18978
|
}
|
|
18979
|
-
const blocks =
|
|
18979
|
+
const blocks = _chunk6FW3AZWNcjs.flattenLayoutTables.call(void 0, [...ctx.headerBlocks, ...bodyBlocks, ...ctx.footerBlocks]);
|
|
18980
18980
|
const metadata = {
|
|
18981
18981
|
title: header.title || void 0,
|
|
18982
18982
|
author: header.author || void 0,
|
|
@@ -18985,7 +18985,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
18985
18985
|
version: "3.0"
|
|
18986
18986
|
};
|
|
18987
18987
|
return {
|
|
18988
|
-
markdown:
|
|
18988
|
+
markdown: _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, blocks),
|
|
18989
18989
|
blocks,
|
|
18990
18990
|
metadata,
|
|
18991
18991
|
warnings: warnings.length ? warnings : void 0
|
|
@@ -19069,7 +19069,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
19069
19069
|
continue;
|
|
19070
19070
|
}
|
|
19071
19071
|
if (ch >= 32) {
|
|
19072
|
-
para2.text +=
|
|
19072
|
+
para2.text += _chunk6FW3AZWNcjs.escapeLiteralTags.call(void 0, _chunk6FW3AZWNcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( ""))));
|
|
19073
19073
|
continue;
|
|
19074
19074
|
}
|
|
19075
19075
|
if (ch === 9) {
|
|
@@ -19297,7 +19297,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19297
19297
|
|
|
19298
19298
|
// src/xlsx/sheet-blocks.ts
|
|
19299
19299
|
function sheetRowCap(cols) {
|
|
19300
|
-
return Math.max(
|
|
19300
|
+
return Math.max(_chunk6FW3AZWNcjs.MAX_ROWS, Math.floor(_chunk6FW3AZWNcjs.MAX_TABLE_CELLS / Math.max(1, cols)));
|
|
19301
19301
|
}
|
|
19302
19302
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19303
19303
|
const blocks = [];
|
|
@@ -19328,7 +19328,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19328
19328
|
if (keepRows.length > rowCap) {
|
|
19329
19329
|
warnings.push({
|
|
19330
19330
|
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 ${
|
|
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 ${_chunk6FW3AZWNcjs.MAX_TABLE_CELLS})`,
|
|
19332
19332
|
code: "TRUNCATED_TABLE"
|
|
19333
19333
|
});
|
|
19334
19334
|
keepRows.length = rowCap;
|
|
@@ -19362,14 +19362,14 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19362
19362
|
}
|
|
19363
19363
|
cellRows.push(row);
|
|
19364
19364
|
}
|
|
19365
|
-
const table2 =
|
|
19365
|
+
const table2 = _chunk6FW3AZWNcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap });
|
|
19366
19366
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19367
19367
|
return blocks;
|
|
19368
19368
|
}
|
|
19369
19369
|
|
|
19370
19370
|
// src/xlsx/parser.ts
|
|
19371
19371
|
var MAX_SHEETS = 100;
|
|
19372
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19372
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkK6WSMTVUcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19373
19373
|
var MAX_SHEET_ROWS = 1048576;
|
|
19374
19374
|
function cleanNumericValue(raw) {
|
|
19375
19375
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19406,7 +19406,7 @@ function getTextContent(el) {
|
|
|
19406
19406
|
return _nullishCoalesce(_optionalChain([el, 'access', _265 => _265.textContent, 'optionalAccess', _266 => _266.trim, 'call', _267 => _267()]), () => ( ""));
|
|
19407
19407
|
}
|
|
19408
19408
|
function parseXml(text) {
|
|
19409
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19409
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkK6WSMTVUcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19410
19410
|
}
|
|
19411
19411
|
function collectRichText(root) {
|
|
19412
19412
|
let out = "";
|
|
@@ -19417,7 +19417,7 @@ function collectRichText(root) {
|
|
|
19417
19417
|
const el = children[i];
|
|
19418
19418
|
const local = el.localName || _optionalChain([el, 'access', _268 => _268.tagName, 'optionalAccess', _269 => _269.replace, 'call', _270 => _270(/^[^:]+:/, "")]) || "";
|
|
19419
19419
|
if (local === "rPh") continue;
|
|
19420
|
-
if (local === "t") out +=
|
|
19420
|
+
if (local === "t") out += _chunk6FW3AZWNcjs.escapeLiteralTags.call(void 0, _chunk6FW3AZWNcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
19421
19421
|
else walk(el);
|
|
19422
19422
|
}
|
|
19423
19423
|
};
|
|
@@ -19570,7 +19570,7 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19570
19570
|
for (const cellEl of cells) {
|
|
19571
19571
|
const ref = cellEl.getAttribute("r");
|
|
19572
19572
|
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 >=
|
|
19573
|
+
if (!pos || !Number.isFinite(pos.row) || pos.row < 0 || pos.row >= MAX_SHEET_ROWS || pos.col >= _chunk6FW3AZWNcjs.MAX_COLS) continue;
|
|
19574
19574
|
prevCol = pos.col;
|
|
19575
19575
|
const type = cellEl.getAttribute("t");
|
|
19576
19576
|
const vElements = getElements(cellEl, "v");
|
|
@@ -19620,21 +19620,21 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19620
19620
|
if (m) {
|
|
19621
19621
|
merges.push({
|
|
19622
19622
|
r1: Math.min(m.startRow, MAX_SHEET_ROWS - 1),
|
|
19623
|
-
c1: Math.min(m.startCol,
|
|
19623
|
+
c1: Math.min(m.startCol, _chunk6FW3AZWNcjs.MAX_COLS - 1),
|
|
19624
19624
|
r2: Math.min(m.endRow, MAX_SHEET_ROWS - 1),
|
|
19625
|
-
c2: Math.min(m.endCol,
|
|
19625
|
+
c2: Math.min(m.endCol, _chunk6FW3AZWNcjs.MAX_COLS - 1)
|
|
19626
19626
|
});
|
|
19627
19627
|
}
|
|
19628
19628
|
}
|
|
19629
19629
|
return { rows, merges, maxCol };
|
|
19630
19630
|
}
|
|
19631
19631
|
async function parseXlsxDocument(buffer, options) {
|
|
19632
|
-
|
|
19632
|
+
_chunkK6WSMTVUcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19633
19633
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19634
19634
|
const warnings = [];
|
|
19635
19635
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19636
19636
|
if (!workbookFile) {
|
|
19637
|
-
throw new (0,
|
|
19637
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19638
19638
|
}
|
|
19639
19639
|
let sharedStrings = [];
|
|
19640
19640
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19643,7 +19643,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19643
19643
|
}
|
|
19644
19644
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
19645
19645
|
if (sheets.length === 0) {
|
|
19646
|
-
throw new (0,
|
|
19646
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19647
19647
|
}
|
|
19648
19648
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19649
19649
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19727,7 +19727,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19727
19727
|
} catch (e35) {
|
|
19728
19728
|
}
|
|
19729
19729
|
}
|
|
19730
|
-
const markdown =
|
|
19730
|
+
const markdown = _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, blocks);
|
|
19731
19731
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19732
19732
|
}
|
|
19733
19733
|
|
|
@@ -20041,14 +20041,14 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20041
20041
|
const h = readCellHeader(rec.data);
|
|
20042
20042
|
if (h && rec.data.length >= 10) {
|
|
20043
20043
|
const isst = rec.data.readUInt32LE(6);
|
|
20044
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20044
|
+
cells.push({ row: h.row, col: h.col, value: _chunk6FW3AZWNcjs.escapeLiteralTags.call(void 0, _chunk6FW3AZWNcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(sst[isst], () => ( "")))) });
|
|
20045
20045
|
}
|
|
20046
20046
|
break;
|
|
20047
20047
|
}
|
|
20048
20048
|
case OP_LABEL: {
|
|
20049
20049
|
const h = readCellHeader(rec.data);
|
|
20050
20050
|
if (h) {
|
|
20051
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20051
|
+
cells.push({ row: h.row, col: h.col, value: _chunk6FW3AZWNcjs.escapeLiteralTags.call(void 0, _chunk6FW3AZWNcjs.escapeLiteralDollar.call(void 0, decodeLabelString(rec.data))) });
|
|
20052
20052
|
}
|
|
20053
20053
|
break;
|
|
20054
20054
|
}
|
|
@@ -20064,7 +20064,7 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20064
20064
|
cells.push({
|
|
20065
20065
|
row: h.row,
|
|
20066
20066
|
col: h.col,
|
|
20067
|
-
value:
|
|
20067
|
+
value: _chunk6FW3AZWNcjs.escapeLiteralTags.call(void 0, _chunk6FW3AZWNcjs.escapeLiteralDollar.call(void 0, decodeFormulaStringRecord(next.data)))
|
|
20068
20068
|
});
|
|
20069
20069
|
i = j;
|
|
20070
20070
|
} else {
|
|
@@ -20176,11 +20176,11 @@ function processGlobals(records) {
|
|
|
20176
20176
|
const xfFmtIds = [];
|
|
20177
20177
|
const firstBof = records[0];
|
|
20178
20178
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
20179
|
-
throw new (0,
|
|
20179
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
20180
20180
|
}
|
|
20181
20181
|
const bof = decodeBof(firstBof.data);
|
|
20182
20182
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
20183
|
-
throw new (0,
|
|
20183
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
20184
20184
|
}
|
|
20185
20185
|
let i = 1;
|
|
20186
20186
|
while (i < records.length) {
|
|
@@ -20246,14 +20246,14 @@ function rawSheetToBlocks(sheetName, sheet, sheetIndex, warnings, keepAnchoredEm
|
|
|
20246
20246
|
const rows = /* @__PURE__ */ new Map();
|
|
20247
20247
|
let maxCol = -1;
|
|
20248
20248
|
for (const c of sheet.cells) {
|
|
20249
|
-
if (c.col >=
|
|
20249
|
+
if (c.col >= _chunk6FW3AZWNcjs.MAX_COLS) continue;
|
|
20250
20250
|
let row = rows.get(c.row);
|
|
20251
20251
|
if (!row) rows.set(c.row, row = []);
|
|
20252
20252
|
while (row.length <= c.col) row.push("");
|
|
20253
20253
|
row[c.col] = cellValueToText(c.value);
|
|
20254
20254
|
if (c.col > maxCol) maxCol = c.col;
|
|
20255
20255
|
}
|
|
20256
|
-
const merges = sheet.merges.filter((m) => m.c1 <
|
|
20256
|
+
const merges = sheet.merges.filter((m) => m.c1 < _chunk6FW3AZWNcjs.MAX_COLS).map((m) => ({ r1: m.r1, c1: m.c1, r2: m.r2, c2: Math.min(m.c2, _chunk6FW3AZWNcjs.MAX_COLS - 1) }));
|
|
20257
20257
|
for (const m of merges) if (m.c2 > maxCol) maxCol = m.c2;
|
|
20258
20258
|
return sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols);
|
|
20259
20259
|
}
|
|
@@ -20263,28 +20263,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20263
20263
|
try {
|
|
20264
20264
|
cfb = parseLenientCfb(buf);
|
|
20265
20265
|
} catch (e) {
|
|
20266
|
-
throw new (0,
|
|
20266
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(
|
|
20267
20267
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20268
20268
|
);
|
|
20269
20269
|
}
|
|
20270
20270
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20271
20271
|
if (!wb) {
|
|
20272
|
-
throw new (0,
|
|
20272
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20273
20273
|
}
|
|
20274
20274
|
const records = readRecords2(wb);
|
|
20275
20275
|
if (records.length === 0) {
|
|
20276
|
-
throw new (0,
|
|
20276
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20277
20277
|
}
|
|
20278
20278
|
const firstBof = decodeBof(records[0].data);
|
|
20279
20279
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20280
|
-
throw new (0,
|
|
20280
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(
|
|
20281
20281
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20282
20282
|
);
|
|
20283
20283
|
}
|
|
20284
20284
|
const globals = processGlobals(records);
|
|
20285
20285
|
const warnings = [];
|
|
20286
20286
|
if (globals.encrypted) {
|
|
20287
|
-
throw new (0,
|
|
20287
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20288
20288
|
}
|
|
20289
20289
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20290
20290
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20335,7 +20335,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20335
20335
|
pageCount: totalSheets
|
|
20336
20336
|
};
|
|
20337
20337
|
return {
|
|
20338
|
-
markdown:
|
|
20338
|
+
markdown: _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
20339
20339
|
blocks: allBlocks,
|
|
20340
20340
|
metadata,
|
|
20341
20341
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20774,7 +20774,7 @@ function isDisplayMath(el) {
|
|
|
20774
20774
|
}
|
|
20775
20775
|
|
|
20776
20776
|
// src/docx/parser.ts
|
|
20777
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20777
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkK6WSMTVUcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20778
20778
|
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
20779
20779
|
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
20780
|
function matchesLocal(el, localName3) {
|
|
@@ -20832,7 +20832,7 @@ function getAttr(el, localName3) {
|
|
|
20832
20832
|
return null;
|
|
20833
20833
|
}
|
|
20834
20834
|
function parseXml2(text) {
|
|
20835
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
20835
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkK6WSMTVUcjs.stripDtd.call(void 0, text), "text/xml");
|
|
20836
20836
|
}
|
|
20837
20837
|
function parseStyles(xml) {
|
|
20838
20838
|
const doc = parseXml2(xml);
|
|
@@ -20968,7 +20968,7 @@ function parseFootnotes(xml) {
|
|
|
20968
20968
|
const runs = findElements(p, "r");
|
|
20969
20969
|
for (const r of runs) {
|
|
20970
20970
|
const tElements = getChildElements(r, "t");
|
|
20971
|
-
for (const t of tElements) texts.push(
|
|
20971
|
+
for (const t of tElements) texts.push(_chunk6FW3AZWNcjs.escapeLiteralTags.call(void 0, _chunk6FW3AZWNcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(t.textContent, () => ( "")))));
|
|
20972
20972
|
}
|
|
20973
20973
|
}
|
|
20974
20974
|
notes.set(id, texts.join("").trim());
|
|
@@ -20999,7 +20999,7 @@ function collectOmmlRoots(p) {
|
|
|
20999
20999
|
function extractRun(r) {
|
|
21000
21000
|
let text = "";
|
|
21001
21001
|
for (const el of effectiveChildElements(r)) {
|
|
21002
|
-
if (matchesLocal(el, "t")) text +=
|
|
21002
|
+
if (matchesLocal(el, "t")) text += _chunk6FW3AZWNcjs.escapeLiteralTags.call(void 0, _chunk6FW3AZWNcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
21003
21003
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
21004
21004
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
21005
21005
|
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
@@ -21012,7 +21012,7 @@ function extractRun(r) {
|
|
|
21012
21012
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
21013
21013
|
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
21014
21014
|
const v = va ? getAttr(va, "val") : null;
|
|
21015
|
-
if (v === "superscript" || v === "subscript") text =
|
|
21015
|
+
if (v === "superscript" || v === "subscript") text = _chunk6FW3AZWNcjs.wrapScript.call(void 0, text, v === "superscript" ? "sup" : "sub");
|
|
21016
21016
|
}
|
|
21017
21017
|
return { text, bold, italic };
|
|
21018
21018
|
}
|
|
@@ -21030,7 +21030,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
21030
21030
|
function makeLink(text, rawHref) {
|
|
21031
21031
|
if (!text) return "";
|
|
21032
21032
|
if (!rawHref) return text;
|
|
21033
|
-
const href =
|
|
21033
|
+
const href = _chunkK6WSMTVUcjs.sanitizeHref.call(void 0, rawHref);
|
|
21034
21034
|
return href ? `[${text}](${href})` : text;
|
|
21035
21035
|
}
|
|
21036
21036
|
function collectInline(p, footnotes, rels) {
|
|
@@ -21121,7 +21121,7 @@ function collectInline(p, footnotes, rels) {
|
|
|
21121
21121
|
const m = mathText(om);
|
|
21122
21122
|
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
21123
21123
|
}
|
|
21124
|
-
const text =
|
|
21124
|
+
const text = _chunk6FW3AZWNcjs.tidyScriptTags.call(void 0, parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
21125
21125
|
return { text, bold, italic, footnoteText };
|
|
21126
21126
|
}
|
|
21127
21127
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -21246,7 +21246,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21246
21246
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21247
21247
|
})
|
|
21248
21248
|
);
|
|
21249
|
-
const table2 =
|
|
21249
|
+
const table2 = _chunk6FW3AZWNcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21250
21250
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21251
21251
|
return { type: "table", table: table2 };
|
|
21252
21252
|
}
|
|
@@ -21295,7 +21295,7 @@ async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
|
21295
21295
|
let data = null;
|
|
21296
21296
|
if (readBytes) data = await imgFile.async("uint8array");
|
|
21297
21297
|
imgIdx++;
|
|
21298
|
-
const ext =
|
|
21298
|
+
const ext = _chunkK6WSMTVUcjs.partExtension.call(void 0, imgPath);
|
|
21299
21299
|
const mimeMap = {
|
|
21300
21300
|
png: "image/png",
|
|
21301
21301
|
jpg: "image/jpeg",
|
|
@@ -21394,12 +21394,12 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21394
21394
|
}
|
|
21395
21395
|
async function parseDocxDocument(buffer, options) {
|
|
21396
21396
|
const readImages = _optionalChain([options, 'optionalAccess', _314 => _314.images]) !== false;
|
|
21397
|
-
|
|
21397
|
+
_chunkK6WSMTVUcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5, void 0, { re: MEDIA_PART_RE, skip: !readImages, never: NEVER_READ_RE });
|
|
21398
21398
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21399
21399
|
const warnings = [];
|
|
21400
21400
|
const docFile = zip.file("word/document.xml");
|
|
21401
21401
|
if (!docFile) {
|
|
21402
|
-
throw new (0,
|
|
21402
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21403
21403
|
}
|
|
21404
21404
|
let rels = /* @__PURE__ */ new Map();
|
|
21405
21405
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21446,7 +21446,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21446
21446
|
const doc = parseXml2(docXml);
|
|
21447
21447
|
const body = findElements(doc, "body");
|
|
21448
21448
|
if (body.length === 0) {
|
|
21449
|
-
throw new (0,
|
|
21449
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21450
21450
|
}
|
|
21451
21451
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
21452
21452
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -21499,7 +21499,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21499
21499
|
}
|
|
21500
21500
|
}
|
|
21501
21501
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21502
|
-
const markdown =
|
|
21502
|
+
const markdown = _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, blocks);
|
|
21503
21503
|
return {
|
|
21504
21504
|
markdown,
|
|
21505
21505
|
blocks,
|
|
@@ -21513,7 +21513,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21513
21513
|
// src/pptx/parser.ts
|
|
21514
21514
|
|
|
21515
21515
|
|
|
21516
|
-
var MAX_DECOMPRESS_SIZE6 =
|
|
21516
|
+
var MAX_DECOMPRESS_SIZE6 = _chunkK6WSMTVUcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
21517
21517
|
var MEDIA_PART_RE2 = /^ppt\/(?:media|embeddings)\//;
|
|
21518
21518
|
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
21519
|
var MAX_ZIP_ENTRIES2 = 1e4;
|
|
@@ -21536,7 +21536,7 @@ var IMAGE_MIME = {
|
|
|
21536
21536
|
svg: "image/svg+xml"
|
|
21537
21537
|
};
|
|
21538
21538
|
function parseXml3(text) {
|
|
21539
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21539
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkK6WSMTVUcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21540
21540
|
}
|
|
21541
21541
|
function getAttr2(el, name) {
|
|
21542
21542
|
const attrs = el.attributes;
|
|
@@ -21603,7 +21603,7 @@ async function slideParts(zip) {
|
|
|
21603
21603
|
names.sort((a, b) => Number(SLIDE_PART_RE.exec(a)[1]) - Number(SLIDE_PART_RE.exec(b)[1]));
|
|
21604
21604
|
ordered.push(...names);
|
|
21605
21605
|
}
|
|
21606
|
-
if (ordered.length > MAX_SLIDES) throw new (0,
|
|
21606
|
+
if (ordered.length > MAX_SLIDES) throw new (0, _chunkK6WSMTVUcjs.KordocError)(`PPTX \uC2AC\uB77C\uC774\uB4DC \uC218 \uCD08\uACFC: ${ordered.length} (\uCD5C\uB300 ${MAX_SLIDES})`);
|
|
21607
21607
|
return ordered;
|
|
21608
21608
|
}
|
|
21609
21609
|
function paragraphText(p) {
|
|
@@ -21614,12 +21614,12 @@ function paragraphText(p) {
|
|
|
21614
21614
|
const t = findChildByLocalName(child, "t");
|
|
21615
21615
|
const rPr = findChildByLocalName(child, "rPr");
|
|
21616
21616
|
const baseline = Number(rPr ? _nullishCoalesce(getAttr2(rPr, "baseline"), () => ( 0)) : 0);
|
|
21617
|
-
if (t) text +=
|
|
21617
|
+
if (t) text += _chunk6FW3AZWNcjs.wrapScript.call(void 0, _chunk6FW3AZWNcjs.escapeLiteralTags.call(void 0, _chunk6FW3AZWNcjs.escapeLiteralDollar.call(void 0, rawTextContent(t))), baseline > 0 ? "sup" : baseline < 0 ? "sub" : null);
|
|
21618
21618
|
} else if (name === "br") {
|
|
21619
21619
|
text += " ";
|
|
21620
21620
|
}
|
|
21621
21621
|
}
|
|
21622
|
-
return
|
|
21622
|
+
return _chunk6FW3AZWNcjs.tidyScriptTags.call(void 0, text.replace(/\s+/g, " ").trim());
|
|
21623
21623
|
}
|
|
21624
21624
|
function bodyParagraphs(txBody) {
|
|
21625
21625
|
const out = [];
|
|
@@ -21680,7 +21680,7 @@ function parseTable2(tbl2, page, keepEmptyCols) {
|
|
|
21680
21680
|
});
|
|
21681
21681
|
return cells;
|
|
21682
21682
|
});
|
|
21683
|
-
const table2 =
|
|
21683
|
+
const table2 = _chunk6FW3AZWNcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21684
21684
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21685
21685
|
return { type: "table", table: table2, pageNumber: page };
|
|
21686
21686
|
}
|
|
@@ -21693,7 +21693,7 @@ async function pictureBlock(pic, ctx) {
|
|
|
21693
21693
|
if (!filename) {
|
|
21694
21694
|
const file = ctx.zip.file(rel.target);
|
|
21695
21695
|
if (!file) return null;
|
|
21696
|
-
const ext =
|
|
21696
|
+
const ext = _chunkK6WSMTVUcjs.partExtension.call(void 0, rel.target);
|
|
21697
21697
|
filename = `image_${String(ctx.imageNames.size + 1).padStart(3, "0")}.${ext}`;
|
|
21698
21698
|
try {
|
|
21699
21699
|
if (_optionalChain([ctx, 'access', _324 => _324.options, 'optionalAccess', _325 => _325.images]) !== false) {
|
|
@@ -21771,10 +21771,10 @@ async function notesText(zip, rels) {
|
|
|
21771
21771
|
return texts.join(" ");
|
|
21772
21772
|
}
|
|
21773
21773
|
async function parsePptxDocument(buffer, options) {
|
|
21774
|
-
|
|
21774
|
+
_chunkK6WSMTVUcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE6, MAX_ZIP_ENTRIES2, { re: MEDIA_PART_RE2, skip: _optionalChain([options, 'optionalAccess', _328 => _328.images]) === false, never: NEVER_READ_RE2 });
|
|
21775
21775
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21776
21776
|
if (!zip.file("ppt/presentation.xml")) {
|
|
21777
|
-
throw new (0,
|
|
21777
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 PPTX \uD30C\uC77C: ppt/presentation.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21778
21778
|
}
|
|
21779
21779
|
const warnings = [];
|
|
21780
21780
|
const blocks = [];
|
|
@@ -21821,7 +21821,7 @@ async function parsePptxDocument(buffer, options) {
|
|
|
21821
21821
|
}
|
|
21822
21822
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")), pageNumber: b.pageNumber }));
|
|
21823
21823
|
return {
|
|
21824
|
-
markdown:
|
|
21824
|
+
markdown: _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, blocks),
|
|
21825
21825
|
blocks,
|
|
21826
21826
|
metadata,
|
|
21827
21827
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -21837,11 +21837,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
21837
21837
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
21838
21838
|
function parseHwpmlDocument(buffer, options) {
|
|
21839
21839
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
21840
|
-
throw new (0,
|
|
21840
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
21841
21841
|
}
|
|
21842
21842
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
21843
21843
|
const normalized = text.replace(/ /g, " ");
|
|
21844
|
-
const xml =
|
|
21844
|
+
const xml = _chunkK6WSMTVUcjs.stripDtd.call(void 0, normalized);
|
|
21845
21845
|
const warnings = [];
|
|
21846
21846
|
const parser = new (0, _xmldom.DOMParser)({
|
|
21847
21847
|
onError: (_level, msg2) => {
|
|
@@ -21881,7 +21881,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
21881
21881
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _331 => _331.keepTrailingEmptyCols]), () => ( false)));
|
|
21882
21882
|
}
|
|
21883
21883
|
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 =
|
|
21884
|
+
const markdown = _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, blocks);
|
|
21885
21885
|
return {
|
|
21886
21886
|
markdown,
|
|
21887
21887
|
blocks,
|
|
@@ -21988,7 +21988,7 @@ function collectCharText(node, parts, depth = 0) {
|
|
|
21988
21988
|
if (tag === "CHAR") {
|
|
21989
21989
|
for (const c of Array.from(el.childNodes)) {
|
|
21990
21990
|
const t = c.nodeType === 1 ? localName(c) === "TAB" ? " " : rawTextContent(c) : c.nodeType === 3 || c.nodeType === 4 ? _nullishCoalesce(c.nodeValue, () => ( "")) : "";
|
|
21991
|
-
if (t) parts.push(
|
|
21991
|
+
if (t) parts.push(_chunk6FW3AZWNcjs.escapeLiteralTags.call(void 0, t));
|
|
21992
21992
|
}
|
|
21993
21993
|
} else if (tag === "TABLE" || tag === "PICTURE" || tag === "SHAPEOBJECT") {
|
|
21994
21994
|
} else if (tag === "AUTONUM") {
|
|
@@ -22048,7 +22048,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
22048
22048
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
22049
22049
|
cellRows[r].push(cell2);
|
|
22050
22050
|
}
|
|
22051
|
-
const table2 =
|
|
22051
|
+
const table2 = _chunk6FW3AZWNcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
22052
22052
|
if (structured.length > 0) {
|
|
22053
22053
|
const claimed = /* @__PURE__ */ new Set();
|
|
22054
22054
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -23584,7 +23584,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
23584
23584
|
};
|
|
23585
23585
|
}
|
|
23586
23586
|
async function extractClickHereFields(hwpxBuffer) {
|
|
23587
|
-
|
|
23587
|
+
_chunkK6WSMTVUcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
23588
23588
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
23589
23589
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
23590
23590
|
const fields = [];
|
|
@@ -23632,19 +23632,19 @@ function parseCentralDirectory(buf) {
|
|
|
23632
23632
|
}
|
|
23633
23633
|
}
|
|
23634
23634
|
}
|
|
23635
|
-
if (eocdOffset < 0) throw new (0,
|
|
23635
|
+
if (eocdOffset < 0) throw new (0, _chunkK6WSMTVUcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
23636
23636
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
23637
23637
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
23638
23638
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
23639
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
23639
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkK6WSMTVUcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23640
23640
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
23641
|
-
throw new (0,
|
|
23641
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23642
23642
|
}
|
|
23643
23643
|
const decoder = new TextDecoder("utf-8");
|
|
23644
23644
|
const entries = [];
|
|
23645
23645
|
let pos = cdOffset;
|
|
23646
23646
|
for (let i = 0; i < totalEntries; i++) {
|
|
23647
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
23647
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkK6WSMTVUcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
23648
23648
|
const flags = view.getUint16(pos + 8, true);
|
|
23649
23649
|
const method = view.getUint16(pos + 10, true);
|
|
23650
23650
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -23655,7 +23655,7 @@ function parseCentralDirectory(buf) {
|
|
|
23655
23655
|
const commentLen = view.getUint16(pos + 32, true);
|
|
23656
23656
|
const localOffset = view.getUint32(pos + 42, true);
|
|
23657
23657
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
23658
|
-
throw new (0,
|
|
23658
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23659
23659
|
}
|
|
23660
23660
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
23661
23661
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -23684,11 +23684,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23684
23684
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
23685
23685
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
23686
23686
|
for (const name of replacements.keys()) {
|
|
23687
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
23687
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkK6WSMTVUcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
23688
23688
|
}
|
|
23689
23689
|
if (additions) {
|
|
23690
23690
|
for (const name of additions.keys()) {
|
|
23691
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
23691
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkK6WSMTVUcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
23692
23692
|
}
|
|
23693
23693
|
}
|
|
23694
23694
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -23707,7 +23707,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23707
23707
|
offset += seg.length;
|
|
23708
23708
|
continue;
|
|
23709
23709
|
}
|
|
23710
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
23710
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkK6WSMTVUcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
23711
23711
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
23712
23712
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
23713
23713
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -23715,7 +23715,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23715
23715
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
23716
23716
|
const method = e.method;
|
|
23717
23717
|
if (method !== 0 && method !== 8) {
|
|
23718
|
-
throw new (0,
|
|
23718
|
+
throw new (0, _chunkK6WSMTVUcjs.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
23719
|
}
|
|
23720
23720
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
23721
23721
|
const crc = crc32(newData);
|
|
@@ -23813,11 +23813,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23813
23813
|
// src/form/filler-hwpx.ts
|
|
23814
23814
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
23815
23815
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
23816
|
-
|
|
23816
|
+
_chunkK6WSMTVUcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
23817
23817
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
23818
23818
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
23819
23819
|
if (sectionPaths.length === 0) {
|
|
23820
|
-
throw new (0,
|
|
23820
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
23821
23821
|
}
|
|
23822
23822
|
const warnings = [];
|
|
23823
23823
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -24267,7 +24267,7 @@ function classifyTableTree(blocks) {
|
|
|
24267
24267
|
return blocks;
|
|
24268
24268
|
}
|
|
24269
24269
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
24270
|
-
const structured = hasMerged(table2) ||
|
|
24270
|
+
const structured = hasMerged(table2) || _chunk6FW3AZWNcjs.hasStructuredCellContent.call(void 0, table2);
|
|
24271
24271
|
if (opts.smartVisual && _optionalChain([table2, 'access', _428 => _428.classification, 'optionalAccess', _429 => _429.kind]) === "non-tabular-layout") return "visual";
|
|
24272
24272
|
return structured ? "html" : "gfm";
|
|
24273
24273
|
}
|
|
@@ -26969,7 +26969,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
26969
26969
|
}
|
|
26970
26970
|
function assertFiniteRange(name, value, min, max) {
|
|
26971
26971
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
26972
|
-
throw new (0,
|
|
26972
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
26973
26973
|
}
|
|
26974
26974
|
}
|
|
26975
26975
|
function validateGongmunOptions(opts) {
|
|
@@ -26984,10 +26984,10 @@ function validateGongmunOptions(opts) {
|
|
|
26984
26984
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
26985
26985
|
}
|
|
26986
26986
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
26987
|
-
throw new (0,
|
|
26987
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
26988
26988
|
}
|
|
26989
26989
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
26990
|
-
throw new (0,
|
|
26990
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
26991
26991
|
}
|
|
26992
26992
|
}
|
|
26993
26993
|
if (opts.sizes) {
|
|
@@ -26996,24 +26996,24 @@ function validateGongmunOptions(opts) {
|
|
|
26996
26996
|
}
|
|
26997
26997
|
}
|
|
26998
26998
|
if (opts.approval && opts.approval.length > 6) {
|
|
26999
|
-
throw new (0,
|
|
26999
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("approval must contain at most 6 labels");
|
|
27000
27000
|
}
|
|
27001
27001
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
27002
27002
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
27003
27003
|
for (const n of nums) {
|
|
27004
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
27004
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkK6WSMTVUcjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
27005
27005
|
}
|
|
27006
27006
|
}
|
|
27007
27007
|
if (opts.levels) {
|
|
27008
27008
|
for (const [key, st] of Object.entries(opts.levels)) {
|
|
27009
27009
|
const depth = Number(key);
|
|
27010
27010
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
27011
|
-
throw new (0,
|
|
27011
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
27012
27012
|
}
|
|
27013
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
27013
|
+
if (!st || typeof st !== "object") throw new (0, _chunkK6WSMTVUcjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
27014
27014
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
27015
27015
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
27016
|
-
throw new (0,
|
|
27016
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
27017
27017
|
}
|
|
27018
27018
|
}
|
|
27019
27019
|
}
|
|
@@ -27068,7 +27068,7 @@ function resolveChecklist(c, preset) {
|
|
|
27068
27068
|
function hexColorOption(name, value) {
|
|
27069
27069
|
if (value === void 0) return void 0;
|
|
27070
27070
|
const v = value.trim();
|
|
27071
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
27071
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkK6WSMTVUcjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
27072
27072
|
return v.toUpperCase();
|
|
27073
27073
|
}
|
|
27074
27074
|
function resolveGongmun(opts) {
|
|
@@ -27455,7 +27455,7 @@ function parseInlineMarkdown(text) {
|
|
|
27455
27455
|
else spans.push(...emphasisSpans(m[0]));
|
|
27456
27456
|
} else {
|
|
27457
27457
|
const anchor = m[2] || m[3];
|
|
27458
|
-
const href = _nullishCoalesce(
|
|
27458
|
+
const href = _nullishCoalesce(_chunkK6WSMTVUcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
27459
27459
|
const sub = emphasisSpans(anchor);
|
|
27460
27460
|
if (href) for (const s of sub) s.href = href;
|
|
27461
27461
|
spans.push(...sub);
|
|
@@ -27669,7 +27669,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
27669
27669
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
27670
27670
|
const got = m ? Number(m[1]) : NaN;
|
|
27671
27671
|
if (got !== startId + i) {
|
|
27672
|
-
throw new (0,
|
|
27672
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(
|
|
27673
27673
|
`\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
27674
|
);
|
|
27675
27675
|
}
|
|
@@ -27760,7 +27760,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
27760
27760
|
}
|
|
27761
27761
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
27762
27762
|
if (rows.length !== expectedBase) {
|
|
27763
|
-
throw new (0,
|
|
27763
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(
|
|
27764
27764
|
`\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
27765
|
);
|
|
27766
27766
|
}
|
|
@@ -28672,7 +28672,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
28672
28672
|
}
|
|
28673
28673
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
28674
28674
|
function sanitizeText(text) {
|
|
28675
|
-
let result =
|
|
28675
|
+
let result = _chunk6FW3AZWNcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
28676
28676
|
if (result.length <= 30 && result.includes(" ")) {
|
|
28677
28677
|
const tokens = result.split(" ");
|
|
28678
28678
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -28705,7 +28705,7 @@ function replicateGfmTable(table2) {
|
|
|
28705
28705
|
const cell2 = _optionalChain([cells, 'access', _511 => _511[r], 'optionalAccess', _512 => _512[c]]);
|
|
28706
28706
|
if (!cell2) continue;
|
|
28707
28707
|
display[r][c] = {
|
|
28708
|
-
text:
|
|
28708
|
+
text: _chunk6FW3AZWNcjs.escapeGfm.call(void 0, sanitizeText(cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\r\n|\r|\n/g, "<br>"),
|
|
28709
28709
|
gridR: r,
|
|
28710
28710
|
gridC: c
|
|
28711
28711
|
};
|
|
@@ -28760,14 +28760,14 @@ function replicateCellInnerHtml(cell2) {
|
|
|
28760
28760
|
return cell2.blocks.map((b) => {
|
|
28761
28761
|
if (b.type === "table" && b.table) {
|
|
28762
28762
|
const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
|
|
28763
|
-
return (cap ?
|
|
28763
|
+
return (cap ? _chunk6FW3AZWNcjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
28764
28764
|
}
|
|
28765
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
28765
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkK6WSMTVUcjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
28766
28766
|
const t = sanitizeText(_nullishCoalesce(b.text, () => ( "")));
|
|
28767
|
-
return t ?
|
|
28767
|
+
return t ? _chunk6FW3AZWNcjs.escapeHtmlCellText.call(void 0, t + _chunk6FW3AZWNcjs.noteSuffix.call(void 0, b)).replace(/\n/g, "<br>") : "";
|
|
28768
28768
|
}).filter(Boolean).join("<br>");
|
|
28769
28769
|
}
|
|
28770
|
-
return
|
|
28770
|
+
return _chunk6FW3AZWNcjs.escapeHtmlCellText.call(void 0, sanitizeText(cell2.text)).replace(/\n/g, "<br>");
|
|
28771
28771
|
}
|
|
28772
28772
|
function replicateTableToHtml(table2) {
|
|
28773
28773
|
const rows = replicateHtmlTable(table2);
|
|
@@ -28844,7 +28844,7 @@ function parseHtmlTable(raw) {
|
|
|
28844
28844
|
const cs = parseInt(_optionalChain([attrs, 'access', _517 => _517.match, 'call', _518 => _518(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _519 => _519[1]]) || "1", 10);
|
|
28845
28845
|
const rs = parseInt(_optionalChain([attrs, 'access', _520 => _520.match, 'call', _521 => _521(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _522 => _522[1]]) || "1", 10);
|
|
28846
28846
|
cellStart = m.index + m[0].length;
|
|
28847
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
28847
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunk6FW3AZWNcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunk6FW3AZWNcjs.MAX_ROWS) };
|
|
28848
28848
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
28849
28849
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
28850
28850
|
cellStart = -1;
|
|
@@ -28869,11 +28869,11 @@ function htmlCellInnerToLines(inner) {
|
|
|
28869
28869
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
28870
28870
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
28871
28871
|
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _523 => _523[1]]), () => ( _optionalChain([m, 'optionalAccess', _524 => _524[2]])));
|
|
28872
|
-
if (src) imgSrcs.push(
|
|
28872
|
+
if (src) imgSrcs.push(_chunkK6WSMTVUcjs.unescapeHtml.call(void 0, src));
|
|
28873
28873
|
return "";
|
|
28874
28874
|
});
|
|
28875
28875
|
}
|
|
28876
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
28876
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkK6WSMTVUcjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
28877
28877
|
return { lines, hadNonText, imgSrcs };
|
|
28878
28878
|
}
|
|
28879
28879
|
function splitCellByTopLevelTables(html) {
|
|
@@ -29671,8 +29671,8 @@ function layoutHtmlRows(rows) {
|
|
|
29671
29671
|
let c = 0;
|
|
29672
29672
|
for (const cell2 of rows[r].cells) {
|
|
29673
29673
|
while (occupied.has(`${r},${c}`)) c++;
|
|
29674
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
29675
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
29674
|
+
const colSpan = clampSpan(cell2.colSpan, _chunk6FW3AZWNcjs.MAX_COLS);
|
|
29675
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunk6FW3AZWNcjs.MAX_ROWS);
|
|
29676
29676
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
29677
29677
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
29678
29678
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -32295,7 +32295,7 @@ function builtinTemplateDir() {
|
|
|
32295
32295
|
for (const c of candidates) {
|
|
32296
32296
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
32297
32297
|
}
|
|
32298
|
-
throw new (0,
|
|
32298
|
+
throw new (0, _chunkK6WSMTVUcjs.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
32299
|
}
|
|
32300
32300
|
function readBuiltinTemplate(t) {
|
|
32301
32301
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -32649,12 +32649,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
32649
32649
|
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
32650
|
}
|
|
32651
32651
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
32652
|
-
if (ops.length === 0) throw new (0,
|
|
32652
|
+
if (ops.length === 0) throw new (0, _chunkK6WSMTVUcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
32653
32653
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
32654
|
-
|
|
32654
|
+
_chunkK6WSMTVUcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
32655
32655
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
32656
32656
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _664 => _664.match, 'call', _665 => _665(/(\d+)\.xml$/i), 'optionalAccess', _666 => _666[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _667 => _667.match, 'call', _668 => _668(/(\d+)\.xml$/i), 'optionalAccess', _669 => _669[1]]), () => ( 0))));
|
|
32657
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
32657
|
+
if (sectionPaths.length === 0) throw new (0, _chunkK6WSMTVUcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
32658
32658
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
32659
32659
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
32660
32660
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -32695,11 +32695,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32695
32695
|
const manifestItems = [];
|
|
32696
32696
|
const placed = [];
|
|
32697
32697
|
for (const op of ops) {
|
|
32698
|
-
if (!op.anchor) throw new (0,
|
|
32699
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
32698
|
+
if (!op.anchor) throw new (0, _chunkK6WSMTVUcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
32699
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkK6WSMTVUcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
32700
32700
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
32701
|
-
if (!MIME[ext]) throw new (0,
|
|
32702
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
32701
|
+
if (!MIME[ext]) throw new (0, _chunkK6WSMTVUcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
32702
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkK6WSMTVUcjs.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
32703
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
32704
32704
|
let found = null;
|
|
32705
32705
|
let total = 0;
|
|
@@ -32732,7 +32732,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32732
32732
|
}
|
|
32733
32733
|
}
|
|
32734
32734
|
}
|
|
32735
|
-
throw new (0,
|
|
32735
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(
|
|
32736
32736
|
`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
32737
|
);
|
|
32738
32738
|
}
|
|
@@ -32740,7 +32740,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32740
32740
|
const xml = sectionXmls[si];
|
|
32741
32741
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
32742
32742
|
if (!run) {
|
|
32743
|
-
throw new (0,
|
|
32743
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
32744
32744
|
}
|
|
32745
32745
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _670 => _670.charPr, 'access', _671 => _671.get, 'call', _672 => _672(run.charPr), 'optionalAccess', _673 => _673.height]), () => ( 1e3));
|
|
32746
32746
|
const fontPt = charPrHeight / 100;
|
|
@@ -33018,7 +33018,7 @@ function pick(map, keys) {
|
|
|
33018
33018
|
return out;
|
|
33019
33019
|
}
|
|
33020
33020
|
async function hwpxToProfile(input) {
|
|
33021
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
33021
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkK6WSMTVUcjs.toArrayBuffer.call(void 0, input);
|
|
33022
33022
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
33023
33023
|
const parser = createXmlParser();
|
|
33024
33024
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _695 => _695.file, 'call', _696 => _696(/[Hh]eader\.xml$/), 'optionalAccess', _697 => _697[0]])));
|
|
@@ -34239,8 +34239,8 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
34239
34239
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
34240
34240
|
const t = line.trim();
|
|
34241
34241
|
if (!t) return "";
|
|
34242
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
34243
|
-
return
|
|
34242
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunk6FW3AZWNcjs.escapeGfm.call(void 0, t)}**`;
|
|
34243
|
+
return _chunk6FW3AZWNcjs.escapeGfm.call(void 0, t);
|
|
34244
34244
|
}).filter(Boolean);
|
|
34245
34245
|
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
34246
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -34254,7 +34254,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
34254
34254
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
34255
34255
|
const replica = [];
|
|
34256
34256
|
for (let r = 0; r < table2.rows; r++) {
|
|
34257
|
-
const line =
|
|
34257
|
+
const line = _chunk6FW3AZWNcjs.escapeGfm.call(void 0, sanitizeText(table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
34258
34258
|
if (line) replica.push({ line, gridR: r });
|
|
34259
34259
|
}
|
|
34260
34260
|
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");
|
|
@@ -34430,7 +34430,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
34430
34430
|
const paths = parseSectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
34431
34431
|
if (paths.length > 0) return paths;
|
|
34432
34432
|
}
|
|
34433
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
34433
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkK6WSMTVUcjs.compareSectionPaths);
|
|
34434
34434
|
}
|
|
34435
34435
|
|
|
34436
34436
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -35342,8 +35342,8 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
35342
35342
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
35343
35343
|
const t = line.trim();
|
|
35344
35344
|
if (!t) return "";
|
|
35345
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
35346
|
-
return
|
|
35345
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunk6FW3AZWNcjs.escapeGfm.call(void 0, t)}**`;
|
|
35346
|
+
return _chunk6FW3AZWNcjs.escapeGfm.call(void 0, t);
|
|
35347
35347
|
}).filter(Boolean);
|
|
35348
35348
|
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
35349
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -35357,7 +35357,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
35357
35357
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
35358
35358
|
const replica = [];
|
|
35359
35359
|
for (let r = 0; r < table2.rows; r++) {
|
|
35360
|
-
const line =
|
|
35360
|
+
const line = _chunk6FW3AZWNcjs.escapeGfm.call(void 0, sanitizeText(table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
35361
35361
|
if (line) replica.push({ line, gridR: r });
|
|
35362
35362
|
}
|
|
35363
35363
|
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");
|
|
@@ -35762,9 +35762,9 @@ function buildOrigUnits(blocks) {
|
|
|
35762
35762
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
35763
35763
|
const next = blocks[i + 1];
|
|
35764
35764
|
if (_optionalChain([next, 'optionalAccess', _766 => _766.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
35765
|
-
chunk =
|
|
35765
|
+
chunk = _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
35766
35766
|
} else {
|
|
35767
|
-
chunk =
|
|
35767
|
+
chunk = _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, [block]);
|
|
35768
35768
|
}
|
|
35769
35769
|
if (chunk) {
|
|
35770
35770
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -38619,12 +38619,12 @@ function blocksToChunks(blocks, options) {
|
|
|
38619
38619
|
let run = null;
|
|
38620
38620
|
const flushRun = () => {
|
|
38621
38621
|
if (!run) return;
|
|
38622
|
-
push("text", run.breadcrumb,
|
|
38622
|
+
push("text", run.breadcrumb, _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
38623
38623
|
run = null;
|
|
38624
38624
|
};
|
|
38625
38625
|
for (let i = 0; i < blocks.length; i++) {
|
|
38626
38626
|
const block = blocks[i];
|
|
38627
|
-
const md2 =
|
|
38627
|
+
const md2 = _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, [block]);
|
|
38628
38628
|
if (!md2) continue;
|
|
38629
38629
|
if (block.type === "heading") {
|
|
38630
38630
|
flushRun();
|
|
@@ -39067,7 +39067,7 @@ var md = new (0, _markdownit2.default)({
|
|
|
39067
39067
|
});
|
|
39068
39068
|
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
39069
|
function sanitizeRawHtml(raw) {
|
|
39070
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
39070
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkK6WSMTVUcjs.escapeHtml.call(void 0, tag));
|
|
39071
39071
|
}
|
|
39072
39072
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
39073
39073
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
@@ -39075,7 +39075,7 @@ function renderHtml(markdown, options) {
|
|
|
39075
39075
|
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _833 => _833.preset]), () => ( "default"));
|
|
39076
39076
|
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _834 => _834.extraCss]), () => ( "")));
|
|
39077
39077
|
const body = md.render(markdown);
|
|
39078
|
-
const watermark = _optionalChain([options, 'optionalAccess', _835 => _835.watermark]) ? `<div class="watermark">${
|
|
39078
|
+
const watermark = _optionalChain([options, 'optionalAccess', _835 => _835.watermark]) ? `<div class="watermark">${_chunkK6WSMTVUcjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
39079
39079
|
const watermarkCss = _optionalChain([options, 'optionalAccess', _836 => _836.watermark]) ? `
|
|
39080
39080
|
.watermark {
|
|
39081
39081
|
position: fixed;
|
|
@@ -39126,13 +39126,13 @@ async function htmlToPdf(html, options) {
|
|
|
39126
39126
|
try {
|
|
39127
39127
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
39128
39128
|
} catch (e40) {
|
|
39129
|
-
throw new (0,
|
|
39129
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(
|
|
39130
39130
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
39131
39131
|
);
|
|
39132
39132
|
}
|
|
39133
39133
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
39134
39134
|
if (!executablePath) {
|
|
39135
|
-
throw new (0,
|
|
39135
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(
|
|
39136
39136
|
"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
39137
|
);
|
|
39138
39138
|
}
|
|
@@ -39187,7 +39187,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
39187
39187
|
return htmlToPdf(html, options);
|
|
39188
39188
|
}
|
|
39189
39189
|
async function blocksToPdf(blocks, options) {
|
|
39190
|
-
const markdown =
|
|
39190
|
+
const markdown = _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, blocks);
|
|
39191
39191
|
return markdownToPdf(markdown, options);
|
|
39192
39192
|
}
|
|
39193
39193
|
|
|
@@ -40544,22 +40544,22 @@ function renderSectionRoots(sections, input) {
|
|
|
40544
40544
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
40545
40545
|
ctxBase.pageBase += pages.length;
|
|
40546
40546
|
}
|
|
40547
|
-
if (rendered.length === 0) throw new (0,
|
|
40547
|
+
if (rendered.length === 0) throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
40548
40548
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
40549
40549
|
}
|
|
40550
40550
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
40551
40551
|
async function renderHwpxInternal(input, options) {
|
|
40552
40552
|
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _887 => _887.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
40553
40553
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
40554
|
-
|
|
40554
|
+
_chunkK6WSMTVUcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
40555
40555
|
let zip;
|
|
40556
40556
|
try {
|
|
40557
40557
|
zip = await _jszip2.default.loadAsync(input);
|
|
40558
40558
|
} catch (e41) {
|
|
40559
|
-
throw new (0,
|
|
40559
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
40560
40560
|
}
|
|
40561
40561
|
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,
|
|
40562
|
+
if (secFiles.length === 0) throw new (0, _chunkK6WSMTVUcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
40563
40563
|
const warnings = [];
|
|
40564
40564
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
40565
40565
|
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 +40567,14 @@ async function renderHwpxInternal(input, options) {
|
|
|
40567
40567
|
const secXmls = [];
|
|
40568
40568
|
for (const f of secFiles) {
|
|
40569
40569
|
const xml = await f.async("string");
|
|
40570
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
40570
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
40571
40571
|
secXmls.push(xml);
|
|
40572
40572
|
}
|
|
40573
40573
|
const masterPages = /* @__PURE__ */ new Map();
|
|
40574
40574
|
const masterXmls = [];
|
|
40575
40575
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
40576
40576
|
const xml = await file.async("string");
|
|
40577
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
40577
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uBC14\uD0D5\uCABD XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
40578
40578
|
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
40579
40579
|
if (root && ln(root) === "masterPage") {
|
|
40580
40580
|
masterPages.set(root.getAttribute("id") || file.name.replace(/^.*\/|\.xml$/g, ""), root);
|
|
@@ -40641,9 +40641,9 @@ async function renderHwpxInternal(input, options) {
|
|
|
40641
40641
|
}
|
|
40642
40642
|
if (roots.length === 0) {
|
|
40643
40643
|
if (noCacheSkipped) {
|
|
40644
|
-
throw new (0,
|
|
40644
|
+
throw new (0, _chunkK6WSMTVUcjs.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
40645
|
}
|
|
40646
|
-
throw new (0,
|
|
40646
|
+
throw new (0, _chunkK6WSMTVUcjs.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
40647
|
}
|
|
40648
40648
|
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _890 => _890.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _891 => _891.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _892 => _892.highlights]) });
|
|
40649
40649
|
}
|
|
@@ -40865,7 +40865,7 @@ var FOLD_END = 42124;
|
|
|
40865
40865
|
var FOLD_SHIFT = 983040 - 40960;
|
|
40866
40866
|
function textChar(ch) {
|
|
40867
40867
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
40868
|
-
const mapped =
|
|
40868
|
+
const mapped = _chunk6FW3AZWNcjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
40869
40869
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
40870
40870
|
}
|
|
40871
40871
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -41237,7 +41237,7 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
41237
41237
|
}
|
|
41238
41238
|
roots.push({ root, index: si });
|
|
41239
41239
|
}
|
|
41240
|
-
if (roots.length === 0) throw new (0,
|
|
41240
|
+
if (roots.length === 0) throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
41241
41241
|
const r = 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]) });
|
|
41242
41242
|
return assemblePageSvgs(r, "hwp", select);
|
|
41243
41243
|
}
|
|
@@ -41250,7 +41250,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
41250
41250
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
41251
41251
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
41252
41252
|
const sections = readHwp5SectionStreams(c);
|
|
41253
|
-
if (sections.length === 0) throw new (0,
|
|
41253
|
+
if (sections.length === 0) throw new (0, _chunkK6WSMTVUcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
41254
41254
|
const parseWarnings = [];
|
|
41255
41255
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
41256
41256
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -41335,14 +41335,14 @@ async function loadSharp() {
|
|
|
41335
41335
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
41336
41336
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
41337
41337
|
} 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.' +
|
|
41338
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(
|
|
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.' + _chunkK6WSMTVUcjs.OPTIONAL_DEP_INSTALL_HINT
|
|
41340
41340
|
);
|
|
41341
41341
|
}
|
|
41342
41342
|
}
|
|
41343
41343
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
41344
41344
|
const sharp = await loadSharp();
|
|
41345
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
41345
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkK6WSMTVUcjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
41346
41346
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
41347
41347
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
41348
41348
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -41360,11 +41360,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
41360
41360
|
try {
|
|
41361
41361
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
41362
41362
|
} catch (e45) {
|
|
41363
|
-
throw new (0,
|
|
41363
|
+
throw new (0, _chunkK6WSMTVUcjs.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
41364
|
}
|
|
41365
41365
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
41366
41366
|
if (!executablePath) {
|
|
41367
|
-
throw new (0,
|
|
41367
|
+
throw new (0, _chunkK6WSMTVUcjs.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
41368
|
}
|
|
41369
41369
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
41370
41370
|
try {
|
|
@@ -41380,13 +41380,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
41380
41380
|
async function loadBuffer(input) {
|
|
41381
41381
|
if (typeof input === "string") {
|
|
41382
41382
|
try {
|
|
41383
|
-
return
|
|
41383
|
+
return _chunkK6WSMTVUcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
41384
41384
|
} catch (err) {
|
|
41385
41385
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
41386
|
-
throw new (0,
|
|
41386
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
41387
41387
|
}
|
|
41388
41388
|
}
|
|
41389
|
-
if (Buffer.isBuffer(input)) return
|
|
41389
|
+
if (Buffer.isBuffer(input)) return _chunkK6WSMTVUcjs.toArrayBuffer.call(void 0, input);
|
|
41390
41390
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
41391
41391
|
return input;
|
|
41392
41392
|
}
|
|
@@ -41395,17 +41395,17 @@ async function sourceFormatOf(buffer) {
|
|
|
41395
41395
|
if (format2 === "hwpx") {
|
|
41396
41396
|
const zip = await detectZipFormat(buffer);
|
|
41397
41397
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
41398
|
-
throw new (0,
|
|
41398
|
+
throw new (0, _chunkK6WSMTVUcjs.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
41399
|
}
|
|
41400
41400
|
if (format2 === "hwp") return "hwp";
|
|
41401
|
-
throw new (0,
|
|
41401
|
+
throw new (0, _chunkK6WSMTVUcjs.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
41402
|
}
|
|
41403
41403
|
async function renderDocumentToScene(input, options = {}) {
|
|
41404
41404
|
const buffer = await loadBuffer(input);
|
|
41405
41405
|
const source = await sourceFormatOf(buffer);
|
|
41406
41406
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
41407
41407
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
41408
|
-
if (set.size === 0) throw new (0,
|
|
41408
|
+
if (set.size === 0) throw new (0, _chunkK6WSMTVUcjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
41409
41409
|
return set;
|
|
41410
41410
|
} : void 0;
|
|
41411
41411
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -41441,7 +41441,7 @@ async function renderDocument(input, options) {
|
|
|
41441
41441
|
break;
|
|
41442
41442
|
}
|
|
41443
41443
|
default:
|
|
41444
|
-
throw new (0,
|
|
41444
|
+
throw new (0, _chunkK6WSMTVUcjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
41445
41445
|
}
|
|
41446
41446
|
return { scene, assets };
|
|
41447
41447
|
}
|
|
@@ -41471,7 +41471,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
41471
41471
|
const out = [];
|
|
41472
41472
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
41473
41473
|
const meta = scene.pages.find((p) => p.page === page);
|
|
41474
|
-
if (!meta) throw new (0,
|
|
41474
|
+
if (!meta) throw new (0, _chunkK6WSMTVUcjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
41475
41475
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
41476
41476
|
for (const { region, bbox } of items) {
|
|
41477
41477
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -41495,9 +41495,9 @@ function wantsCrop(kind, policy) {
|
|
|
41495
41495
|
}
|
|
41496
41496
|
async function extractTables(input, options = {}) {
|
|
41497
41497
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
41498
|
-
const buffer = typeof input === "string" ?
|
|
41498
|
+
const buffer = typeof input === "string" ? _chunkK6WSMTVUcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkK6WSMTVUcjs.toArrayBuffer.call(void 0, input) : input;
|
|
41499
41499
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
41500
|
-
if (!parsed.success) throw new (0,
|
|
41500
|
+
if (!parsed.success) throw new (0, _chunkK6WSMTVUcjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
41501
41501
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
41502
41502
|
const out = blocks.map((b, i) => ({
|
|
41503
41503
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -41559,13 +41559,13 @@ async function parse(input, options) {
|
|
|
41559
41559
|
if (typeof input === "string") {
|
|
41560
41560
|
try {
|
|
41561
41561
|
const buf = await _promises.readFile.call(void 0, input);
|
|
41562
|
-
buffer =
|
|
41562
|
+
buffer = _chunkK6WSMTVUcjs.toArrayBuffer.call(void 0, buf);
|
|
41563
41563
|
} catch (err) {
|
|
41564
41564
|
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:
|
|
41565
|
+
return { success: false, fileType: "unknown", error: msg2, code: _chunkK6WSMTVUcjs.classifyError.call(void 0, err) };
|
|
41566
41566
|
}
|
|
41567
41567
|
} else if (Buffer.isBuffer(input)) {
|
|
41568
|
-
buffer =
|
|
41568
|
+
buffer = _chunkK6WSMTVUcjs.toArrayBuffer.call(void 0, input);
|
|
41569
41569
|
} else {
|
|
41570
41570
|
buffer = input;
|
|
41571
41571
|
}
|
|
@@ -41584,7 +41584,7 @@ async function parse(input, options) {
|
|
|
41584
41584
|
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
41585
|
}
|
|
41586
41586
|
if (out.success && !out.pages) {
|
|
41587
|
-
const pages =
|
|
41587
|
+
const pages = _chunkRQEDNI4Pcjs.blocksToPages.call(void 0, out.blocks);
|
|
41588
41588
|
if (pages) out = { ...out, pages };
|
|
41589
41589
|
}
|
|
41590
41590
|
if (out.success && _optionalChain([opts, 'optionalAccess', _908 => _908.plain])) {
|
|
@@ -41633,23 +41633,23 @@ async function dispatch(format2, buffer, opts) {
|
|
|
41633
41633
|
}
|
|
41634
41634
|
}
|
|
41635
41635
|
function scriptsOff(r, off) {
|
|
41636
|
-
return off ?
|
|
41636
|
+
return off ? _chunk6FW3AZWNcjs.stripScriptTags.call(void 0, r) : r;
|
|
41637
41637
|
}
|
|
41638
41638
|
async function parseImage(buffer, options) {
|
|
41639
41639
|
try {
|
|
41640
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
41640
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-AZ25IOC7.cjs")));
|
|
41641
41641
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
41642
|
-
|
|
41642
|
+
_chunk6FW3AZWNcjs.stripScriptTags.call(void 0, { blocks });
|
|
41643
41643
|
return {
|
|
41644
41644
|
success: true,
|
|
41645
41645
|
fileType: "image",
|
|
41646
|
-
markdown:
|
|
41646
|
+
markdown: _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, blocks),
|
|
41647
41647
|
blocks,
|
|
41648
41648
|
warnings: warnings.length ? warnings : void 0,
|
|
41649
41649
|
pageCount: 1
|
|
41650
41650
|
};
|
|
41651
41651
|
} catch (err) {
|
|
41652
|
-
return { success: false, fileType: "image", error:
|
|
41652
|
+
return { success: false, fileType: "image", error: _chunkK6WSMTVUcjs.sanitizeError.call(void 0, err), code: _chunkK6WSMTVUcjs.classifyError.call(void 0, err) };
|
|
41653
41653
|
}
|
|
41654
41654
|
}
|
|
41655
41655
|
async function parseHwp3(buffer, options) {
|
|
@@ -41657,7 +41657,7 @@ async function parseHwp3(buffer, options) {
|
|
|
41657
41657
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
41658
41658
|
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _910 => _910.pageCount]) };
|
|
41659
41659
|
} catch (err) {
|
|
41660
|
-
return { success: false, fileType: "hwp3", error:
|
|
41660
|
+
return { success: false, fileType: "hwp3", error: _chunkK6WSMTVUcjs.sanitizeError.call(void 0, err), code: _chunkK6WSMTVUcjs.classifyError.call(void 0, err) };
|
|
41661
41661
|
}
|
|
41662
41662
|
}
|
|
41663
41663
|
async function parseHwpx(buffer, options) {
|
|
@@ -41665,7 +41665,7 @@ async function parseHwpx(buffer, options) {
|
|
|
41665
41665
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
41666
41666
|
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _911 => _911.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _912 => _912.pageCount]) }, _optionalChain([options, 'optionalAccess', _913 => _913.scriptTags]) === false);
|
|
41667
41667
|
} catch (err) {
|
|
41668
|
-
return { success: false, fileType: "hwpx", error:
|
|
41668
|
+
return { success: false, fileType: "hwpx", error: _chunkK6WSMTVUcjs.sanitizeError.call(void 0, err), code: _chunkK6WSMTVUcjs.classifyError.call(void 0, err) };
|
|
41669
41669
|
}
|
|
41670
41670
|
}
|
|
41671
41671
|
async function parseHwp(buffer, options) {
|
|
@@ -41691,13 +41691,13 @@ async function parseHwp(buffer, options) {
|
|
|
41691
41691
|
}
|
|
41692
41692
|
return scriptsOff({ success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _915 => _915.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _916 => _916.pageCount]) }, _optionalChain([options, 'optionalAccess', _917 => _917.scriptTags]) === false);
|
|
41693
41693
|
} catch (err) {
|
|
41694
|
-
return { success: false, fileType: "hwp", error:
|
|
41694
|
+
return { success: false, fileType: "hwp", error: _chunkK6WSMTVUcjs.sanitizeError.call(void 0, err), code: _chunkK6WSMTVUcjs.classifyError.call(void 0, err) };
|
|
41695
41695
|
}
|
|
41696
41696
|
}
|
|
41697
41697
|
async function parsePdf(buffer, options) {
|
|
41698
41698
|
let parsePdfDocument;
|
|
41699
41699
|
try {
|
|
41700
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
41700
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-HWAOPQYK.cjs")));
|
|
41701
41701
|
parsePdfDocument = mod.parsePdfDocument;
|
|
41702
41702
|
} catch (e47) {
|
|
41703
41703
|
return {
|
|
@@ -41712,7 +41712,7 @@ async function parsePdf(buffer, options) {
|
|
|
41712
41712
|
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _918 => _918.pageCount]) }, _optionalChain([options, 'optionalAccess', _919 => _919.scriptTags]) !== true);
|
|
41713
41713
|
} catch (err) {
|
|
41714
41714
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
41715
|
-
return { success: false, fileType: "pdf", error:
|
|
41715
|
+
return { success: false, fileType: "pdf", error: _chunkK6WSMTVUcjs.sanitizeError.call(void 0, err), code: _chunkK6WSMTVUcjs.classifyError.call(void 0, err), isImageBased };
|
|
41716
41716
|
}
|
|
41717
41717
|
}
|
|
41718
41718
|
async function parseXlsx(buffer, options) {
|
|
@@ -41720,7 +41720,7 @@ async function parseXlsx(buffer, options) {
|
|
|
41720
41720
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
41721
41721
|
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _920 => _920.pageCount]) };
|
|
41722
41722
|
} catch (err) {
|
|
41723
|
-
return { success: false, fileType: "xlsx", error:
|
|
41723
|
+
return { success: false, fileType: "xlsx", error: _chunkK6WSMTVUcjs.sanitizeError.call(void 0, err), code: _chunkK6WSMTVUcjs.classifyError.call(void 0, err) };
|
|
41724
41724
|
}
|
|
41725
41725
|
}
|
|
41726
41726
|
async function parseXls(buffer, options) {
|
|
@@ -41728,7 +41728,7 @@ async function parseXls(buffer, options) {
|
|
|
41728
41728
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
41729
41729
|
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _921 => _921.pageCount]) };
|
|
41730
41730
|
} catch (err) {
|
|
41731
|
-
return { success: false, fileType: "xls", error:
|
|
41731
|
+
return { success: false, fileType: "xls", error: _chunkK6WSMTVUcjs.sanitizeError.call(void 0, err), code: _chunkK6WSMTVUcjs.classifyError.call(void 0, err) };
|
|
41732
41732
|
}
|
|
41733
41733
|
}
|
|
41734
41734
|
async function parseDocx(buffer, options) {
|
|
@@ -41736,7 +41736,7 @@ async function parseDocx(buffer, options) {
|
|
|
41736
41736
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
41737
41737
|
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _922 => _922.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _923 => _923.pageCount]) }, _optionalChain([options, 'optionalAccess', _924 => _924.scriptTags]) === false);
|
|
41738
41738
|
} catch (err) {
|
|
41739
|
-
return { success: false, fileType: "docx", error:
|
|
41739
|
+
return { success: false, fileType: "docx", error: _chunkK6WSMTVUcjs.sanitizeError.call(void 0, err), code: _chunkK6WSMTVUcjs.classifyError.call(void 0, err) };
|
|
41740
41740
|
}
|
|
41741
41741
|
}
|
|
41742
41742
|
async function parsePptx(buffer, options) {
|
|
@@ -41744,7 +41744,7 @@ async function parsePptx(buffer, options) {
|
|
|
41744
41744
|
const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
|
|
41745
41745
|
return scriptsOff({ success: true, fileType: "pptx", 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);
|
|
41746
41746
|
} catch (err) {
|
|
41747
|
-
return { success: false, fileType: "pptx", error:
|
|
41747
|
+
return { success: false, fileType: "pptx", error: _chunkK6WSMTVUcjs.sanitizeError.call(void 0, err), code: _chunkK6WSMTVUcjs.classifyError.call(void 0, err) };
|
|
41748
41748
|
}
|
|
41749
41749
|
}
|
|
41750
41750
|
async function parseHwpml(buffer, options) {
|
|
@@ -41752,16 +41752,16 @@ async function parseHwpml(buffer, options) {
|
|
|
41752
41752
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
41753
41753
|
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _928 => _928.pageCount]) };
|
|
41754
41754
|
} catch (err) {
|
|
41755
|
-
return { success: false, fileType: "hwpml", error:
|
|
41755
|
+
return { success: false, fileType: "hwpml", error: _chunkK6WSMTVUcjs.sanitizeError.call(void 0, err), code: _chunkK6WSMTVUcjs.classifyError.call(void 0, err) };
|
|
41756
41756
|
}
|
|
41757
41757
|
}
|
|
41758
41758
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
41759
41759
|
let buffer;
|
|
41760
41760
|
if (typeof input === "string") {
|
|
41761
41761
|
const buf = await _promises.readFile.call(void 0, input);
|
|
41762
|
-
buffer =
|
|
41762
|
+
buffer = _chunkK6WSMTVUcjs.toArrayBuffer.call(void 0, buf);
|
|
41763
41763
|
} else if (Buffer.isBuffer(input)) {
|
|
41764
|
-
buffer =
|
|
41764
|
+
buffer = _chunkK6WSMTVUcjs.toArrayBuffer.call(void 0, input);
|
|
41765
41765
|
} else {
|
|
41766
41766
|
buffer = input;
|
|
41767
41767
|
}
|
|
@@ -41787,7 +41787,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
41787
41787
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
41788
41788
|
}
|
|
41789
41789
|
const fill = fillFormFields(parsed.blocks, values);
|
|
41790
|
-
const markdown =
|
|
41790
|
+
const markdown = _chunk6FW3AZWNcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
41791
41791
|
if (outputFormat === "hwpx") {
|
|
41792
41792
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
41793
41793
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -41883,5 +41883,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
41883
41883
|
|
|
41884
41884
|
|
|
41885
41885
|
|
|
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 =
|
|
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 = _chunkK6WSMTVUcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunk6FW3AZWNcjs.blocksToMarkdown; exports.blocksToPages = _chunkRQEDNI4Pcjs.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 = _chunk6FW3AZWNcjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunk6FW3AZWNcjs.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
41887
|
//# sourceMappingURL=index.cjs.map
|