kordoc 4.24.19 → 4.24.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/{-IFNBZFGR.js → -IS4RXPEZ.js} +11 -11
- package/dist/{chunk-2IFSM7ZE.js → chunk-3RVASM4C.js} +4 -4
- package/dist/{chunk-MHBJAY2T.js → chunk-4OF7DHIT.js} +4 -4
- package/dist/{chunk-IXCXFGYB.js → chunk-B3POEH7X.js} +2 -2
- package/dist/{chunk-XQJNL7TD.cjs → chunk-B5M676H3.cjs} +6 -6
- package/dist/{chunk-XQJNL7TD.cjs.map → chunk-B5M676H3.cjs.map} +1 -1
- package/dist/{chunk-XGUX3JDV.js → chunk-BMXWY36E.js} +4 -4
- package/dist/{chunk-DIDPIFGO.js → chunk-BNEKESI4.js} +2 -2
- package/dist/{chunk-UTDQAY35.js → chunk-BTBFKDPH.js} +2 -2
- package/dist/{chunk-OJL4V7WL.cjs → chunk-BUFGW3UJ.cjs} +25 -25
- package/dist/{chunk-OJL4V7WL.cjs.map → chunk-BUFGW3UJ.cjs.map} +1 -1
- package/dist/{chunk-Q6XWPGGB.js → chunk-BV2YG7M6.js} +2 -2
- package/dist/{chunk-MRFBERH2.js → chunk-CPVXUEKF.js} +2 -2
- package/dist/{chunk-UNTBPUY5.js → chunk-E6G4B457.js} +2 -2
- package/dist/{chunk-EEJKU5SD.js → chunk-F4GZFIUJ.js} +2 -2
- package/dist/{chunk-752MQ7LI.js → chunk-F6OHQLN7.js} +3 -3
- package/dist/{chunk-QQAANXHZ.js → chunk-IZN5BTCW.js} +2 -2
- package/dist/{chunk-RPHURU2B.cjs → chunk-L556KKBU.cjs} +79 -79
- package/dist/{chunk-RPHURU2B.cjs.map → chunk-L556KKBU.cjs.map} +1 -1
- package/dist/{chunk-TATLMLLJ.js → chunk-MGCIQ43Y.js} +3 -3
- package/dist/{chunk-MP6CLG5T.js → chunk-MMZUWRH6.js} +11 -11
- package/dist/{chunk-DCEXKPBH.js → chunk-MYDHNNPA.js} +92 -27
- package/dist/chunk-MYDHNNPA.js.map +1 -0
- package/dist/{chunk-WUU63RFU.js → chunk-N45RCYBL.js} +3 -3
- package/dist/{chunk-DTNNWOBN.js → chunk-NE75RO62.js} +2 -2
- package/dist/{chunk-OI4LVKFX.js → chunk-NRCG3ASU.js} +2 -2
- package/dist/{chunk-B4X2Q5MK.js → chunk-O5ZCJEZ4.js} +2 -2
- package/dist/{chunk-U4QSRBEV.cjs → chunk-OMGCVZ4W.cjs} +2 -2
- package/dist/{chunk-U4QSRBEV.cjs.map → chunk-OMGCVZ4W.cjs.map} +1 -1
- package/dist/{chunk-JQJYIYMJ.js → chunk-PDOWSDNM.js} +2 -2
- package/dist/{chunk-RQCGVE3R.js → chunk-UNYH6MTO.js} +2 -2
- package/dist/{chunk-4OWHKA6D.cjs → chunk-V7S36XCU.cjs} +3 -3
- package/dist/{chunk-4OWHKA6D.cjs.map → chunk-V7S36XCU.cjs.map} +1 -1
- package/dist/{chunk-X6GHZRPS.js → chunk-WQC4XWVT.js} +2 -2
- package/dist/{chunk-7RVG2IVX.cjs → chunk-WVZSTMCZ.cjs} +3 -3
- package/dist/{chunk-7RVG2IVX.cjs.map → chunk-WVZSTMCZ.cjs.map} +1 -1
- package/dist/{chunk-S4EPR2Q4.js → chunk-Z6ONQ63K.js} +2 -2
- package/dist/chunks-FYCQOIWO.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-IYTV7SBF.js → formula-DHBBWQLC.js} +3 -3
- package/dist/{formula-WSK7DHQS.cjs → formula-G3FQTUOY.cjs} +9 -9
- package/dist/{formula-WSK7DHQS.cjs.map → formula-G3FQTUOY.cjs.map} +1 -1
- package/dist/{formula-WSFS7D7Z.js → formula-I4EA7ULD.js} +4 -4
- package/dist/{image-ocr-Y75JNXPZ.js → image-ocr-5YWVBRY6.js} +6 -6
- package/dist/{image-ocr-AVMUMNAV.js → image-ocr-QUVBGNWD.js} +9 -9
- package/dist/{image-ocr-LWWF4HEE.cjs → image-ocr-THUO6YRG.cjs} +17 -17
- package/dist/{image-ocr-LWWF4HEE.cjs.map → image-ocr-THUO6YRG.cjs.map} +1 -1
- package/dist/index.cjs +510 -445
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +92 -27
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +23 -23
- package/dist/{model-bundle-JOACGE6A.js → model-bundle-6RG5PO3R.js} +5 -5
- package/dist/{models-RTSOF7XB.js → models-CGYIGN6D.js} +5 -5
- package/dist/{parse-worker-v2-GHCIS7RI.js → parse-worker-v2-F5NXYBU6.js} +12 -12
- package/dist/{parser-4NF5BGSC.js → parser-G5QTRKII.js} +9 -9
- package/dist/{parser-GJWAT5YG.cjs → parser-GJ4PKW7I.cjs} +159 -159
- package/dist/{parser-GJWAT5YG.cjs.map → parser-GJ4PKW7I.cjs.map} +1 -1
- package/dist/{parser-E7VENFW7.js → parser-I2C5DUXC.js} +12 -12
- package/dist/pdf-ocr-LJKCUXTE.cjs +35 -0
- package/dist/{pdf-ocr-J74A2ZQW.cjs.map → pdf-ocr-LJKCUXTE.cjs.map} +1 -1
- package/dist/{pdf-ocr-CJSC4DLZ.js → pdf-ocr-TNW6YOPX.js} +6 -6
- package/dist/{pdf-ocr-K4MHY4KP.js → pdf-ocr-U3I74Q4O.js} +9 -9
- package/dist/{profile-io-LA4LFEFV.js → profile-io-5YZCFK7B.js} +3 -3
- package/dist/{rasterize-PZ6VCPOZ.js → rasterize-7VRHPOQX.js} +3 -3
- package/dist/{redact-doc-HHDDIIV7.js → redact-doc-VK6VGBK3.js} +11 -11
- package/dist/{render-QIWXWLYC.js → render-Y7J6DPRL.js} +7 -7
- package/dist/seal-4QIZ3ZNI.js +10 -0
- package/dist/{setup-Y6EZH34Z.js → setup-4XTUDU4X.js} +3 -3
- package/dist/visual-VEMQJ52W.js +21 -0
- package/dist/{watch-LBRW6NAG.js → watch-SPZRLTKG.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-DCEXKPBH.js.map +0 -1
- package/dist/chunks-7ACTVPJJ.js +0 -10
- package/dist/pdf-ocr-J74A2ZQW.cjs +0 -35
- package/dist/seal-SBA3CFCC.js +0 -10
- package/dist/visual-PN3PUVDG.js +0 -21
- /package/dist/{-IFNBZFGR.js.map → -IS4RXPEZ.js.map} +0 -0
- /package/dist/{chunk-2IFSM7ZE.js.map → chunk-3RVASM4C.js.map} +0 -0
- /package/dist/{chunk-MHBJAY2T.js.map → chunk-4OF7DHIT.js.map} +0 -0
- /package/dist/{chunk-IXCXFGYB.js.map → chunk-B3POEH7X.js.map} +0 -0
- /package/dist/{chunk-XGUX3JDV.js.map → chunk-BMXWY36E.js.map} +0 -0
- /package/dist/{chunk-DIDPIFGO.js.map → chunk-BNEKESI4.js.map} +0 -0
- /package/dist/{chunk-UTDQAY35.js.map → chunk-BTBFKDPH.js.map} +0 -0
- /package/dist/{chunk-Q6XWPGGB.js.map → chunk-BV2YG7M6.js.map} +0 -0
- /package/dist/{chunk-MRFBERH2.js.map → chunk-CPVXUEKF.js.map} +0 -0
- /package/dist/{chunk-UNTBPUY5.js.map → chunk-E6G4B457.js.map} +0 -0
- /package/dist/{chunk-EEJKU5SD.js.map → chunk-F4GZFIUJ.js.map} +0 -0
- /package/dist/{chunk-752MQ7LI.js.map → chunk-F6OHQLN7.js.map} +0 -0
- /package/dist/{chunk-QQAANXHZ.js.map → chunk-IZN5BTCW.js.map} +0 -0
- /package/dist/{chunk-TATLMLLJ.js.map → chunk-MGCIQ43Y.js.map} +0 -0
- /package/dist/{chunk-MP6CLG5T.js.map → chunk-MMZUWRH6.js.map} +0 -0
- /package/dist/{chunk-WUU63RFU.js.map → chunk-N45RCYBL.js.map} +0 -0
- /package/dist/{chunk-DTNNWOBN.js.map → chunk-NE75RO62.js.map} +0 -0
- /package/dist/{chunk-OI4LVKFX.js.map → chunk-NRCG3ASU.js.map} +0 -0
- /package/dist/{chunk-B4X2Q5MK.js.map → chunk-O5ZCJEZ4.js.map} +0 -0
- /package/dist/{chunk-JQJYIYMJ.js.map → chunk-PDOWSDNM.js.map} +0 -0
- /package/dist/{chunk-RQCGVE3R.js.map → chunk-UNYH6MTO.js.map} +0 -0
- /package/dist/{chunk-X6GHZRPS.js.map → chunk-WQC4XWVT.js.map} +0 -0
- /package/dist/{chunk-S4EPR2Q4.js.map → chunk-Z6ONQ63K.js.map} +0 -0
- /package/dist/{chunks-7ACTVPJJ.js.map → chunks-FYCQOIWO.js.map} +0 -0
- /package/dist/{formula-IYTV7SBF.js.map → formula-DHBBWQLC.js.map} +0 -0
- /package/dist/{formula-WSFS7D7Z.js.map → formula-I4EA7ULD.js.map} +0 -0
- /package/dist/{image-ocr-Y75JNXPZ.js.map → image-ocr-5YWVBRY6.js.map} +0 -0
- /package/dist/{image-ocr-AVMUMNAV.js.map → image-ocr-QUVBGNWD.js.map} +0 -0
- /package/dist/{model-bundle-JOACGE6A.js.map → model-bundle-6RG5PO3R.js.map} +0 -0
- /package/dist/{models-RTSOF7XB.js.map → models-CGYIGN6D.js.map} +0 -0
- /package/dist/{parse-worker-v2-GHCIS7RI.js.map → parse-worker-v2-F5NXYBU6.js.map} +0 -0
- /package/dist/{parser-4NF5BGSC.js.map → parser-G5QTRKII.js.map} +0 -0
- /package/dist/{parser-E7VENFW7.js.map → parser-I2C5DUXC.js.map} +0 -0
- /package/dist/{pdf-ocr-CJSC4DLZ.js.map → pdf-ocr-TNW6YOPX.js.map} +0 -0
- /package/dist/{pdf-ocr-K4MHY4KP.js.map → pdf-ocr-U3I74Q4O.js.map} +0 -0
- /package/dist/{profile-io-LA4LFEFV.js.map → profile-io-5YZCFK7B.js.map} +0 -0
- /package/dist/{rasterize-PZ6VCPOZ.js.map → rasterize-7VRHPOQX.js.map} +0 -0
- /package/dist/{redact-doc-HHDDIIV7.js.map → redact-doc-VK6VGBK3.js.map} +0 -0
- /package/dist/{render-QIWXWLYC.js.map → render-Y7J6DPRL.js.map} +0 -0
- /package/dist/{seal-SBA3CFCC.js.map → seal-4QIZ3ZNI.js.map} +0 -0
- /package/dist/{setup-Y6EZH34Z.js.map → setup-4XTUDU4X.js.map} +0 -0
- /package/dist/{visual-PN3PUVDG.js.map → visual-VEMQJ52W.js.map} +0 -0
- /package/dist/{watch-LBRW6NAG.js.map → watch-SPZRLTKG.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkWVZSTMCZcjs = require('./chunk-WVZSTMCZ.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
@@ -44,7 +44,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
var
|
|
47
|
+
var _chunkB5M676H3cjs = require('./chunk-B5M676H3.cjs');
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
@@ -62,14 +62,14 @@ var _chunkXQJNL7TDcjs = require('./chunk-XQJNL7TD.cjs');
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
var
|
|
65
|
+
var _chunkOMGCVZ4Wcjs = require('./chunk-OMGCVZ4W.cjs');
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
69
69
|
|
|
70
70
|
// src/plain-markdown.ts
|
|
71
71
|
function toPlainMarkdown(md2) {
|
|
72
|
-
return
|
|
72
|
+
return _chunkB5M676H3cjs.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();
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// src/html-tables.ts
|
|
@@ -603,9 +603,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
603
603
|
}
|
|
604
604
|
|
|
605
605
|
// src/hwpx/parser-shared.ts
|
|
606
|
-
var MAX_DECOMPRESS_SIZE =
|
|
606
|
+
var MAX_DECOMPRESS_SIZE = _chunkOMGCVZ4Wcjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
607
607
|
var MAX_ZIP_ENTRIES = 500;
|
|
608
|
-
var ZipBombError = class extends
|
|
608
|
+
var ZipBombError = class extends _chunkOMGCVZ4Wcjs.KordocError {
|
|
609
609
|
constructor(message) {
|
|
610
610
|
super(message);
|
|
611
611
|
this.name = "ZipBombError";
|
|
@@ -655,7 +655,7 @@ function createSectionShared() {
|
|
|
655
655
|
function createXmlParser(warnings) {
|
|
656
656
|
return new (0, _xmldom.DOMParser)({
|
|
657
657
|
onError(level, msg2) {
|
|
658
|
-
if (level === "fatalError") throw new (0,
|
|
658
|
+
if (level === "fatalError") throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
659
659
|
_optionalChain([warnings, 'optionalAccess', _5 => _5.push, 'call', _6 => _6({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
660
660
|
}
|
|
661
661
|
});
|
|
@@ -690,13 +690,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
690
690
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
691
691
|
const checksumType = attrOf(inner, "checksum-type");
|
|
692
692
|
if (algorithm !== AES256_CBC) {
|
|
693
|
-
throw new (0,
|
|
693
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
694
694
|
}
|
|
695
695
|
if (startKey !== START_KEY_SHA256) {
|
|
696
|
-
throw new (0,
|
|
696
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
697
697
|
}
|
|
698
698
|
if (!_optionalChain([checksumType, 'optionalAccess', _10 => _10.endsWith, 'call', _11 => _11(CHECKSUM_SHA256_1K)])) {
|
|
699
|
-
throw new (0,
|
|
699
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
700
700
|
}
|
|
701
701
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
702
702
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -704,10 +704,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
704
704
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
705
705
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
706
706
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
707
|
-
throw new (0,
|
|
707
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
708
708
|
}
|
|
709
709
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
710
|
-
throw new (0,
|
|
710
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
711
711
|
}
|
|
712
712
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
713
713
|
}
|
|
@@ -741,12 +741,12 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
741
741
|
for (const entry of entries) {
|
|
742
742
|
const file = zip.file(entry.path);
|
|
743
743
|
if (!file) {
|
|
744
|
-
throw new (0,
|
|
744
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
745
745
|
}
|
|
746
746
|
const raw = await readZipEntry(file, "uint8array", used);
|
|
747
747
|
const plain4 = decryptEntry(Buffer.from(raw.buffer, raw.byteOffset, raw.length), entry, startKey);
|
|
748
748
|
if (!plain4) {
|
|
749
|
-
throw new (0,
|
|
749
|
+
throw new (0, _chunkOMGCVZ4Wcjs.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.");
|
|
750
750
|
}
|
|
751
751
|
used += plain4.length;
|
|
752
752
|
if (used > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
@@ -815,10 +815,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
815
815
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _12 => _12.total]));
|
|
816
816
|
if (decompressed) {
|
|
817
817
|
decompressed.total += xml.length * 2;
|
|
818
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
818
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
819
819
|
}
|
|
820
820
|
const parser = createXmlParser();
|
|
821
|
-
const doc = parser.parseFromString(
|
|
821
|
+
const doc = parser.parseFromString(_chunkOMGCVZ4Wcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
822
822
|
if (!doc.documentElement) continue;
|
|
823
823
|
const domDoc = doc;
|
|
824
824
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -1031,9 +1031,9 @@ function detectHwpxHeadings(blocks, styleMap, tocTexts) {
|
|
|
1031
1031
|
let level = 0;
|
|
1032
1032
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _21 => _21.style, 'optionalAccess', _22 => _22.fontSize])) {
|
|
1033
1033
|
const ratio = block.style.fontSize / baseFontSize;
|
|
1034
|
-
if (ratio >=
|
|
1035
|
-
else if (ratio >=
|
|
1036
|
-
else if (ratio >=
|
|
1034
|
+
if (ratio >= _chunkB5M676H3cjs.HEADING_RATIO_H1) level = 1;
|
|
1035
|
+
else if (ratio >= _chunkB5M676H3cjs.HEADING_RATIO_H2) level = 2;
|
|
1036
|
+
else if (ratio >= _chunkB5M676H3cjs.HEADING_RATIO_H3) level = 3;
|
|
1037
1037
|
}
|
|
1038
1038
|
const compactText = text.replace(/\s+/g, "");
|
|
1039
1039
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1647,11 +1647,11 @@ function formatHeadNumber(n, numFormat) {
|
|
|
1647
1647
|
// 서수 시퀀스는 생성기(gongmun.ts)와 단일 소스 (v4.0.5) — 종전 mod-14 순환은
|
|
1648
1648
|
// 15번째 형제를 다시 '가'로 만들어 한글 실렌더(가→하→거→너 단모음 연속)와 어긋났다
|
|
1649
1649
|
case "CIRCLED_DIGIT":
|
|
1650
|
-
return n <= 50 ?
|
|
1650
|
+
return n <= 50 ? _chunkB5M676H3cjs.circledNumber.call(void 0, n - 1) : `(${n})`;
|
|
1651
1651
|
case "HANGUL_SYLLABLE":
|
|
1652
|
-
return
|
|
1652
|
+
return _chunkB5M676H3cjs.hangulOrdinal.call(void 0, n - 1);
|
|
1653
1653
|
case "CIRCLED_HANGUL_SYLLABLE":
|
|
1654
|
-
return n <= 14 ?
|
|
1654
|
+
return n <= 14 ? _chunkB5M676H3cjs.circledHangul.call(void 0, n - 1) : _chunkB5M676H3cjs.hangulOrdinal.call(void 0, n - 1);
|
|
1655
1655
|
case "HANGUL_JAMO":
|
|
1656
1656
|
return HANGUL_JAMO_SEQ[(n - 1) % HANGUL_JAMO_SEQ.length];
|
|
1657
1657
|
case "CIRCLED_HANGUL_JAMO":
|
|
@@ -1665,9 +1665,9 @@ function formatHeadNumber(n, numFormat) {
|
|
|
1665
1665
|
case "CIRCLED_LATIN_SMALL":
|
|
1666
1666
|
return n <= 26 ? String.fromCodePoint(9424 + n - 1) : String.fromCharCode(97 + (n - 1) % 26);
|
|
1667
1667
|
case "ROMAN_CAPITAL":
|
|
1668
|
-
return
|
|
1668
|
+
return _chunkB5M676H3cjs.romanNumeral.call(void 0, n, true);
|
|
1669
1669
|
case "ROMAN_SMALL":
|
|
1670
|
-
return
|
|
1670
|
+
return _chunkB5M676H3cjs.romanNumeral.call(void 0, n, false);
|
|
1671
1671
|
default:
|
|
1672
1672
|
return String(n);
|
|
1673
1673
|
}
|
|
@@ -1715,7 +1715,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1715
1715
|
|
|
1716
1716
|
// src/hwpx/table-build.ts
|
|
1717
1717
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1718
|
-
const table2 =
|
|
1718
|
+
const table2 = _chunkB5M676H3cjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1719
1719
|
if (state.caption) table2.caption = state.caption;
|
|
1720
1720
|
if (state.caption && state.captionBelow) table2.captionBelow = true;
|
|
1721
1721
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
@@ -1745,7 +1745,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1745
1745
|
for (const src of row) {
|
|
1746
1746
|
if (!src.edges || src.rowAddr === void 0 || src.colAddr === void 0) continue;
|
|
1747
1747
|
const cand = _optionalChain([table2, 'access', _37 => _37.cells, 'access', _38 => _38[src.rowAddr], 'optionalAccess', _39 => _39[src.colAddr]]);
|
|
1748
|
-
if (cand && anchors2.includes(cand))
|
|
1748
|
+
if (cand && anchors2.includes(cand)) _chunkB5M676H3cjs.CELL_EDGES.set(cand, src.edges);
|
|
1749
1749
|
}
|
|
1750
1750
|
}
|
|
1751
1751
|
const claimed = /* @__PURE__ */ new Set();
|
|
@@ -1795,8 +1795,8 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1795
1795
|
const cell2 = parentTable.cell;
|
|
1796
1796
|
(cell2.blocks ??= []).push(block);
|
|
1797
1797
|
cell2.hasStructure = true;
|
|
1798
|
-
let flat =
|
|
1799
|
-
if (newTable.caption) flat =
|
|
1798
|
+
let flat = _chunkB5M676H3cjs.convertTableToText.call(void 0, newTable.rows);
|
|
1799
|
+
if (newTable.caption) flat = _chunkB5M676H3cjs.captionedText.call(void 0, flat, newTable.caption, newTable.captionBelow);
|
|
1800
1800
|
if (flat) {
|
|
1801
1801
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
1802
1802
|
cell2.text += (cell2.text ? inlineJoin ? " " : "\n" : "") + flat;
|
|
@@ -2029,7 +2029,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2029
2029
|
const tkids = rc.childNodes;
|
|
2030
2030
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _47 => _47.length]), () => ( 0))); k++) {
|
|
2031
2031
|
const tk = tkids[k];
|
|
2032
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
2032
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunkB5M676H3cjs.escapeLiteralTags.call(void 0, _chunkB5M676H3cjs.escapeLiteralDollar.call(void 0, tk.textContent || ""));
|
|
2033
2033
|
else if (tk.nodeType === 1) {
|
|
2034
2034
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
2035
2035
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -2049,7 +2049,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2049
2049
|
const span2 = { text };
|
|
2050
2050
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span2.code = true;
|
|
2051
2051
|
else {
|
|
2052
|
-
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text =
|
|
2052
|
+
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text = _chunkB5M676H3cjs.wrapScript.call(void 0, text, cp.script);
|
|
2053
2053
|
if (_optionalChain([cp, 'optionalAccess', _49 => _49.bold])) span2.bold = true;
|
|
2054
2054
|
if (_optionalChain([cp, 'optionalAccess', _50 => _50.italic])) span2.italic = true;
|
|
2055
2055
|
if (_optionalChain([cp, 'optionalAccess', _51 => _51.strike])) span2.strike = true;
|
|
@@ -2069,7 +2069,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2069
2069
|
}
|
|
2070
2070
|
}
|
|
2071
2071
|
if (requireMixed && !merged.some((s) => s.strike || s.underline) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
2072
|
-
for (const s of merged) s.text =
|
|
2072
|
+
for (const s of merged) s.text = _chunkB5M676H3cjs.tidyScriptTags.call(void 0, s.text);
|
|
2073
2073
|
return merged;
|
|
2074
2074
|
}
|
|
2075
2075
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -2096,7 +2096,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2096
2096
|
// src/hwpx/section-walker.ts
|
|
2097
2097
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
2098
2098
|
const parser = createXmlParser(warnings);
|
|
2099
|
-
const doc = parser.parseFromString(
|
|
2099
|
+
const doc = parser.parseFromString(_chunkOMGCVZ4Wcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2100
2100
|
if (!doc.documentElement) return [];
|
|
2101
2101
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
2102
2102
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2198,8 +2198,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2198
2198
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2199
2199
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2200
2200
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2201
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2202
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2201
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkB5M676H3cjs.MAX_COLS);
|
|
2202
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkB5M676H3cjs.MAX_ROWS);
|
|
2203
2203
|
}
|
|
2204
2204
|
break;
|
|
2205
2205
|
case "p": {
|
|
@@ -2522,8 +2522,8 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2522
2522
|
const sink = [];
|
|
2523
2523
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2524
2524
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2525
|
-
let flat =
|
|
2526
|
-
if (st.caption) flat =
|
|
2525
|
+
let flat = _chunkB5M676H3cjs.convertTableToText.call(void 0, st.rows);
|
|
2526
|
+
if (st.caption) flat = _chunkB5M676H3cjs.captionedText.call(void 0, flat, st.caption, st.captionBelow);
|
|
2527
2527
|
const built = [];
|
|
2528
2528
|
completeTable(st, [], built, ctx);
|
|
2529
2529
|
return { text: flat, block: _nullishCoalesce(built.find((b) => b.type === "table"), () => ( null)) };
|
|
@@ -2687,7 +2687,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2687
2687
|
let url = (ch.textContent || "").trim();
|
|
2688
2688
|
if (!url) continue;
|
|
2689
2689
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2690
|
-
const safe =
|
|
2690
|
+
const safe = _chunkOMGCVZ4Wcjs.sanitizeHref.call(void 0, url);
|
|
2691
2691
|
if (safe) return safe;
|
|
2692
2692
|
}
|
|
2693
2693
|
return void 0;
|
|
@@ -2844,7 +2844,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2844
2844
|
_optionalChain([ctx, 'access', _112 => _112.warnings, 'optionalAccess', _113 => _113.push, 'call', _114 => _114({ page: ctx.page, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
|
|
2845
2845
|
}
|
|
2846
2846
|
} else {
|
|
2847
|
-
text +=
|
|
2847
|
+
text += _chunkB5M676H3cjs.escapeLiteralTags.call(void 0, _chunkB5M676H3cjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, "")));
|
|
2848
2848
|
}
|
|
2849
2849
|
continue;
|
|
2850
2850
|
}
|
|
@@ -2889,7 +2889,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2889
2889
|
break;
|
|
2890
2890
|
// 글자 겹치기 — 겹친 글은 composeText 속성에 있어 종전엔 통째로 빠졌다(법령 서식 원 번호 ⑯·⑰, 시험지 네모 번호 10)
|
|
2891
2891
|
case "compose":
|
|
2892
|
-
if (!isInDeletedRange(ctx)) text +=
|
|
2892
|
+
if (!isInDeletedRange(ctx)) text += _chunkB5M676H3cjs.escapeLiteralTags.call(void 0, _chunkB5M676H3cjs.escapeLiteralDollar.call(void 0, _chunkB5M676H3cjs.composeText.call(void 0, _nullishCoalesce(child.getAttribute("composeText"), () => ( "")), (_nullishCoalesce(child.getAttribute("circleType"), () => ( "CHAR"))) !== "CHAR")));
|
|
2893
2893
|
break;
|
|
2894
2894
|
// 양식 선택 상자·라디오 단추 — 한컴이 그리는 상자 기호와 캡션 글 (종전엔 통째로 빠졌다: form-002 "원천기술형"·서울 결재 "부분공개")
|
|
2895
2895
|
// 지운 구간의 양식 단추·수식은 글처럼 내지 않는다 (최종본)
|
|
@@ -2901,7 +2901,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2901
2901
|
case "hyperlink": {
|
|
2902
2902
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2903
2903
|
if (url) {
|
|
2904
|
-
const safe =
|
|
2904
|
+
const safe = _chunkOMGCVZ4Wcjs.sanitizeHref.call(void 0, url);
|
|
2905
2905
|
if (safe) href = safe;
|
|
2906
2906
|
}
|
|
2907
2907
|
walk(child, depth + 1);
|
|
@@ -2995,7 +2995,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2995
2995
|
walk(child, depth + 1);
|
|
2996
2996
|
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
2997
2997
|
const added = text.slice(start);
|
|
2998
|
-
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) +
|
|
2998
|
+
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) + _chunkB5M676H3cjs.wrapScript.call(void 0, added, script);
|
|
2999
2999
|
}
|
|
3000
3000
|
break;
|
|
3001
3001
|
}
|
|
@@ -3018,7 +3018,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3018
3018
|
}
|
|
3019
3019
|
if (applied.length) href = void 0;
|
|
3020
3020
|
}
|
|
3021
|
-
text =
|
|
3021
|
+
text = _chunkB5M676H3cjs.tidyScriptTags.call(void 0, text);
|
|
3022
3022
|
const toc = takeTocLeaders(text);
|
|
3023
3023
|
text = toc.text;
|
|
3024
3024
|
const tocEntry = toc.tocEntry;
|
|
@@ -3133,7 +3133,7 @@ function decompressStream(data) {
|
|
|
3133
3133
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
3134
3134
|
}
|
|
3135
3135
|
function parseFileHeader(data) {
|
|
3136
|
-
if (data.length < 40) throw new (0,
|
|
3136
|
+
if (data.length < 40) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
3137
3137
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
3138
3138
|
return {
|
|
3139
3139
|
signature: sig,
|
|
@@ -3660,13 +3660,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3660
3660
|
}
|
|
3661
3661
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3662
3662
|
for (const path of allCandidates) {
|
|
3663
|
-
if (
|
|
3663
|
+
if (_chunkOMGCVZ4Wcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3664
3664
|
const file = zip.file(path);
|
|
3665
3665
|
if (!file) continue;
|
|
3666
3666
|
try {
|
|
3667
3667
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3668
3668
|
decompressed.total += data.length;
|
|
3669
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3669
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3670
3670
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3671
3671
|
const extMime = imageExtToMime(ext);
|
|
3672
3672
|
const mimeType = extMime === "image/svg+xml" && /<script|\son[a-z]+\s*=|javascript:|<foreignObject/i.test(Buffer.from(data).toString("utf8")) ? "application/octet-stream" : extMime;
|
|
@@ -3677,7 +3677,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3677
3677
|
usedPaths.add(path);
|
|
3678
3678
|
break;
|
|
3679
3679
|
} catch (err) {
|
|
3680
|
-
if (err instanceof
|
|
3680
|
+
if (err instanceof _chunkOMGCVZ4Wcjs.KordocError) throw err;
|
|
3681
3681
|
}
|
|
3682
3682
|
}
|
|
3683
3683
|
if (!img) _optionalChain([warnings, 'optionalAccess', _128 => _128.push, 'call', _129 => _129({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
@@ -3697,13 +3697,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3697
3697
|
if (sweepUnreferenced) {
|
|
3698
3698
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3699
3699
|
for (const file of binEntries) {
|
|
3700
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3700
|
+
if (file.dir || usedPaths.has(file.name) || _chunkOMGCVZ4Wcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3701
3701
|
const basename = file.name.slice(file.name.lastIndexOf("/") + 1);
|
|
3702
3702
|
if (_optionalChain([deletedRefs, 'optionalAccess', _130 => _130.has, 'call', _131 => _131(file.name)]) || _optionalChain([deletedRefs, 'optionalAccess', _132 => _132.has, 'call', _133 => _133(basename)]) || _optionalChain([deletedRefs, 'optionalAccess', _134 => _134.has, 'call', _135 => _135(file.name.replace(/\.[^/.]+$/, ""))]) || _optionalChain([deletedRefs, 'optionalAccess', _136 => _136.has, 'call', _137 => _137(basename.replace(/\.[^.]+$/, ""))])) continue;
|
|
3703
3703
|
try {
|
|
3704
3704
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3705
3705
|
decompressed.total += data.length;
|
|
3706
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3706
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3707
3707
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3708
3708
|
let mimeType = imageExtToMime(ext);
|
|
3709
3709
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3717,7 +3717,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3717
3717
|
images.push(img);
|
|
3718
3718
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3719
3719
|
} catch (err) {
|
|
3720
|
-
if (err instanceof
|
|
3720
|
+
if (err instanceof _chunkOMGCVZ4Wcjs.KordocError) throw err;
|
|
3721
3721
|
_optionalChain([warnings, 'optionalAccess', _138 => _138.push, 'call', _139 => _139({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3722
3722
|
}
|
|
3723
3723
|
}
|
|
@@ -3768,7 +3768,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3768
3768
|
}
|
|
3769
3769
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3770
3770
|
const name = new TextDecoder().decode(nameBytes);
|
|
3771
|
-
if (
|
|
3771
|
+
if (_chunkOMGCVZ4Wcjs.isPathTraversal.call(void 0, name)) {
|
|
3772
3772
|
pos = fileStart + compSize;
|
|
3773
3773
|
continue;
|
|
3774
3774
|
}
|
|
@@ -3786,7 +3786,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3786
3786
|
continue;
|
|
3787
3787
|
}
|
|
3788
3788
|
totalDecompressed += content.length * 2;
|
|
3789
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3789
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3790
3790
|
sectionNum++;
|
|
3791
3791
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3792
3792
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3795,9 +3795,9 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3795
3795
|
continue;
|
|
3796
3796
|
}
|
|
3797
3797
|
}
|
|
3798
|
-
if (blocks.length === 0) throw new (0,
|
|
3798
|
+
if (blocks.length === 0) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3799
3799
|
applyPageText(blocks, shared);
|
|
3800
|
-
const markdown =
|
|
3800
|
+
const markdown = _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _140 => _140.tableFormat]) });
|
|
3801
3801
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3802
3802
|
}
|
|
3803
3803
|
async function readKordocLayout(zip) {
|
|
@@ -3822,11 +3822,11 @@ async function resolveSectionPaths(zip) {
|
|
|
3822
3822
|
if (paths.length > 0) return paths;
|
|
3823
3823
|
}
|
|
3824
3824
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3825
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3825
|
+
return sectionFiles.map((f) => f.name).sort(_chunkOMGCVZ4Wcjs.compareSectionPaths);
|
|
3826
3826
|
}
|
|
3827
3827
|
function parseSectionPathsFromManifest(xml) {
|
|
3828
3828
|
const parser = createXmlParser();
|
|
3829
|
-
const doc = parser.parseFromString(
|
|
3829
|
+
const doc = parser.parseFromString(_chunkOMGCVZ4Wcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3830
3830
|
const opf = "http://www.idpf.org/2007/opf/";
|
|
3831
3831
|
const namespacedItems = doc.getElementsByTagNameNS(opf, "item");
|
|
3832
3832
|
const namespacedSpine = doc.getElementsByTagNameNS(opf, "itemref");
|
|
@@ -3836,7 +3836,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3836
3836
|
for (let i = 0; i < items.length; i++) {
|
|
3837
3837
|
const item = items[i];
|
|
3838
3838
|
const id = item.getAttribute("id") || "";
|
|
3839
|
-
const href =
|
|
3839
|
+
const href = _chunkOMGCVZ4Wcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3840
3840
|
if (id && href) idToHref.set(id, href);
|
|
3841
3841
|
}
|
|
3842
3842
|
if (spine.length > 0) {
|
|
@@ -3847,7 +3847,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3847
3847
|
}
|
|
3848
3848
|
if (ordered.length > 0) return ordered;
|
|
3849
3849
|
}
|
|
3850
|
-
return Array.from(idToHref.values()).sort(
|
|
3850
|
+
return Array.from(idToHref.values()).sort(_chunkOMGCVZ4Wcjs.compareSectionPaths);
|
|
3851
3851
|
}
|
|
3852
3852
|
|
|
3853
3853
|
// src/hwpx/metadata.ts
|
|
@@ -3859,7 +3859,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3859
3859
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _144 => _144.total]));
|
|
3860
3860
|
if (decompressed) {
|
|
3861
3861
|
decompressed.total += xml.length * 2;
|
|
3862
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3862
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3863
3863
|
}
|
|
3864
3864
|
return xml;
|
|
3865
3865
|
};
|
|
@@ -3881,7 +3881,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3881
3881
|
}
|
|
3882
3882
|
}
|
|
3883
3883
|
function parseOpfMetadata(xml, metadata) {
|
|
3884
|
-
const root = createXmlParser().parseFromString(
|
|
3884
|
+
const root = createXmlParser().parseFromString(_chunkOMGCVZ4Wcjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3885
3885
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3886
3886
|
if (!md2) return;
|
|
3887
3887
|
let title;
|
|
@@ -3914,7 +3914,7 @@ function isoDate(s) {
|
|
|
3914
3914
|
}
|
|
3915
3915
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3916
3916
|
const parser = createXmlParser();
|
|
3917
|
-
const doc = parser.parseFromString(
|
|
3917
|
+
const doc = parser.parseFromString(_chunkOMGCVZ4Wcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3918
3918
|
if (!doc.documentElement) return;
|
|
3919
3919
|
const getText = (tagNames) => {
|
|
3920
3920
|
for (const tag of tagNames) {
|
|
@@ -3953,7 +3953,7 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3953
3953
|
}
|
|
3954
3954
|
}
|
|
3955
3955
|
async function parseHwpxDocument(buffer, options) {
|
|
3956
|
-
|
|
3956
|
+
_chunkOMGCVZ4Wcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3957
3957
|
let zip;
|
|
3958
3958
|
try {
|
|
3959
3959
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3962,7 +3962,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3962
3962
|
}
|
|
3963
3963
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3964
3964
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3965
|
-
throw new (0,
|
|
3965
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3966
3966
|
}
|
|
3967
3967
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3968
3968
|
if (manifestFile) {
|
|
@@ -3982,7 +3982,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3982
3982
|
}
|
|
3983
3983
|
const hpfFile = zip.file("Contents/content.hpf");
|
|
3984
3984
|
const hpf = hpfFile ? await readZipEntry(hpfFile, "text").catch(() => "") : "";
|
|
3985
|
-
throw new (0,
|
|
3985
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(
|
|
3986
3986
|
/\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."
|
|
3987
3987
|
);
|
|
3988
3988
|
}
|
|
@@ -3994,7 +3994,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3994
3994
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3995
3995
|
const warnings = [];
|
|
3996
3996
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3997
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3997
|
+
if (sectionPaths.length === 0) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3998
3998
|
let allBlocks = [];
|
|
3999
3999
|
const shared = createSectionShared();
|
|
4000
4000
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -4038,10 +4038,10 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4038
4038
|
const blocks = allBlocks;
|
|
4039
4039
|
applyPageText(blocks, shared);
|
|
4040
4040
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _173 => _173.pages]), shared.track.deletedImageRefs);
|
|
4041
|
-
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks :
|
|
4041
|
+
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks : _chunkB5M676H3cjs.unframeLayoutTables.call(void 0, blocks, !!_optionalChain([options, 'optionalAccess', _175 => _175.keepTrailingEmptyCols]));
|
|
4042
4042
|
detectHwpxHeadings(shown, styleMap, shared.tocTexts);
|
|
4043
4043
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4044
|
-
const markdown =
|
|
4044
|
+
const markdown = _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, shown, { tableFormat: _optionalChain([options, 'optionalAccess', _176 => _176.tableFormat]) });
|
|
4045
4045
|
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 };
|
|
4046
4046
|
}
|
|
4047
4047
|
|
|
@@ -4808,7 +4808,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4808
4808
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4809
4809
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4810
4810
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4811
|
-
const wrong = () => new (0,
|
|
4811
|
+
const wrong = () => new (0, _chunkOMGCVZ4Wcjs.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.");
|
|
4812
4812
|
let records;
|
|
4813
4813
|
try {
|
|
4814
4814
|
records = readRecords3(data);
|
|
@@ -4820,7 +4820,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4820
4820
|
}
|
|
4821
4821
|
function assertSupportedEncryptVersion(version) {
|
|
4822
4822
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4823
|
-
throw new (0,
|
|
4823
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(
|
|
4824
4824
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4825
4825
|
);
|
|
4826
4826
|
}
|
|
@@ -5069,19 +5069,19 @@ var HANJA_UNITS = ["", "\u5341", "\u767E", "\u5343", "\u842C"];
|
|
|
5069
5069
|
function formatNumber(n, fmt2) {
|
|
5070
5070
|
switch (fmt2) {
|
|
5071
5071
|
case "circled":
|
|
5072
|
-
return n >= 1 ?
|
|
5072
|
+
return n >= 1 ? _chunkB5M676H3cjs.circledNumber.call(void 0, n - 1) : String(n);
|
|
5073
5073
|
case "romanUpper":
|
|
5074
|
-
return
|
|
5074
|
+
return _chunkB5M676H3cjs.romanNumeral.call(void 0, n, true);
|
|
5075
5075
|
case "romanLower":
|
|
5076
|
-
return
|
|
5076
|
+
return _chunkB5M676H3cjs.romanNumeral.call(void 0, n, false);
|
|
5077
5077
|
case "latinUpper":
|
|
5078
5078
|
return formatLatin(n, true) || String(n);
|
|
5079
5079
|
case "latinLower":
|
|
5080
5080
|
return formatLatin(n, false) || String(n);
|
|
5081
5081
|
case "ganada":
|
|
5082
|
-
return n >= 1 ?
|
|
5082
|
+
return n >= 1 ? _chunkB5M676H3cjs.hangulOrdinal.call(void 0, n - 1) : String(n);
|
|
5083
5083
|
case "circledGanada":
|
|
5084
|
-
return n >= 1 ?
|
|
5084
|
+
return n >= 1 ? _chunkB5M676H3cjs.circledHangul.call(void 0, n - 1) : String(n);
|
|
5085
5085
|
case "jamo":
|
|
5086
5086
|
return fromTable(n, JAMO);
|
|
5087
5087
|
case "circledJamo":
|
|
@@ -5263,8 +5263,8 @@ function emitParagraphBlocks(p) {
|
|
|
5263
5263
|
return blocks;
|
|
5264
5264
|
}
|
|
5265
5265
|
function tableFlatText(table2) {
|
|
5266
|
-
const flat =
|
|
5267
|
-
return table2.caption ?
|
|
5266
|
+
const flat = _chunkB5M676H3cjs.convertTableToText.call(void 0, table2.cells);
|
|
5267
|
+
return table2.caption ? _chunkB5M676H3cjs.captionedText.call(void 0, flat, table2.caption, table2.captionBelow) : flat;
|
|
5268
5268
|
}
|
|
5269
5269
|
function blocksPlainText(blocks, sep) {
|
|
5270
5270
|
const parts = [];
|
|
@@ -5344,8 +5344,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5344
5344
|
}
|
|
5345
5345
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5346
5346
|
for (const c of cells) {
|
|
5347
|
-
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1,
|
|
5348
|
-
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1,
|
|
5347
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunkB5M676H3cjs.MAX_ROWS));
|
|
5348
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunkB5M676H3cjs.MAX_COLS));
|
|
5349
5349
|
}
|
|
5350
5350
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5351
5351
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5353,12 +5353,12 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5353
5353
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5354
5354
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5355
5355
|
}
|
|
5356
|
-
const table2 =
|
|
5356
|
+
const table2 = _chunkB5M676H3cjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5357
5357
|
if (table2.rows === 0) return null;
|
|
5358
5358
|
for (const c of placed) {
|
|
5359
5359
|
if (c.edges) {
|
|
5360
5360
|
const at = _optionalChain([table2, 'access', _183 => _183.cells, 'access', _184 => _184[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _185 => _185[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
5361
|
-
if (at)
|
|
5361
|
+
if (at) _chunkB5M676H3cjs.CELL_EDGES.set(at, c.edges);
|
|
5362
5362
|
}
|
|
5363
5363
|
if (!_optionalChain([c, 'access', _186 => _186.blocks, 'optionalAccess', _187 => _187.length]) && !c.isHeader) continue;
|
|
5364
5364
|
const target = _optionalChain([table2, 'access', _188 => _188.cells, 'access', _189 => _189[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _190 => _190[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
@@ -5560,7 +5560,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5560
5560
|
continue;
|
|
5561
5561
|
}
|
|
5562
5562
|
if (!ctrl.href) continue;
|
|
5563
|
-
const href =
|
|
5563
|
+
const href = _chunkOMGCVZ4Wcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5564
5564
|
if (!href) continue;
|
|
5565
5565
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK)) continue;
|
|
5566
5566
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5569,7 +5569,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5569
5569
|
}
|
|
5570
5570
|
if (text.includes(LITERAL_DOLLAR_MARK)) text = text.replaceAll(LITERAL_DOLLAR_MARK, "\\$");
|
|
5571
5571
|
text = resolveLiteralLt(text);
|
|
5572
|
-
text =
|
|
5572
|
+
text = _chunkB5M676H3cjs.tidyScriptTags.call(void 0, text);
|
|
5573
5573
|
const toc = takeTocLeaders(text);
|
|
5574
5574
|
text = toc.text;
|
|
5575
5575
|
let headingLevel = 0;
|
|
@@ -5676,7 +5676,7 @@ function applyCtrlEffect(ctrl, records, ctx) {
|
|
|
5676
5676
|
// 글자 겹침 — ctrl id 뒤 글자 수(WORD)·겹친 글자(WCHAR[n])·테두리 종류(BYTE, 0 = 없음). 종전엔 건너뛰어 법령 서식 원 번호(⑯·⑰)가 빠졌다
|
|
5677
5677
|
case CTRL_TCPS: {
|
|
5678
5678
|
const d = ctrl.data, n = d.length >= 6 ? d.readUInt16LE(4) : 0;
|
|
5679
|
-
if (n > 0 && d.length >= 6 + 2 * n) ctrl.inlineText =
|
|
5679
|
+
if (n > 0 && d.length >= 6 + 2 * n) ctrl.inlineText = _chunkB5M676H3cjs.composeText.call(void 0, d.toString("utf16le", 6, 6 + 2 * n), (_nullishCoalesce(d[6 + 2 * n], () => ( 0))) !== 0);
|
|
5680
5680
|
return;
|
|
5681
5681
|
}
|
|
5682
5682
|
// 숨은 설명/단 정의/쪽번호 위치/감추기/찾아보기/책갈피/덧말 — 본문 텍스트 없음 또는 의도적 스킵
|
|
@@ -5794,7 +5794,7 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5794
5794
|
}
|
|
5795
5795
|
var A4_HEIGHT = 84188;
|
|
5796
5796
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5797
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5797
|
+
if (!cells.some((c) => c.pageSpanning)) _chunkB5M676H3cjs.markNonLayoutTable.call(void 0, table2);
|
|
5798
5798
|
}
|
|
5799
5799
|
function parseTableControl(ctrl, records, ctx) {
|
|
5800
5800
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
@@ -5806,8 +5806,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5806
5806
|
let tableIdx = -1;
|
|
5807
5807
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5808
5808
|
if (records[i2].tagId === TAG_TABLE && records[i2].level === directLevel && records[i2].data.length >= 8) {
|
|
5809
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5810
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5809
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkB5M676H3cjs.MAX_ROWS);
|
|
5810
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkB5M676H3cjs.MAX_COLS);
|
|
5811
5811
|
tableIdx = i2;
|
|
5812
5812
|
break;
|
|
5813
5813
|
}
|
|
@@ -5854,11 +5854,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5854
5854
|
return table3;
|
|
5855
5855
|
}
|
|
5856
5856
|
if (rows === 0 || cols === 0) {
|
|
5857
|
-
rows = Math.min(cells.length,
|
|
5857
|
+
rows = Math.min(cells.length, _chunkB5M676H3cjs.MAX_ROWS);
|
|
5858
5858
|
cols = 1;
|
|
5859
5859
|
}
|
|
5860
5860
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5861
|
-
const table2 =
|
|
5861
|
+
const table2 = _chunkB5M676H3cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5862
5862
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5863
5863
|
if (caption && captionBelow && table2.rows > 0) table2.captionBelow = true;
|
|
5864
5864
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
@@ -5878,8 +5878,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5878
5878
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5879
5879
|
const cs = rec.data.readUInt16LE(12);
|
|
5880
5880
|
const rs = rec.data.readUInt16LE(14);
|
|
5881
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5882
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5881
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkB5M676H3cjs.MAX_COLS);
|
|
5882
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkB5M676H3cjs.MAX_ROWS);
|
|
5883
5883
|
}
|
|
5884
5884
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5885
5885
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -6028,7 +6028,7 @@ function openHwp5Container(buffer, options) {
|
|
|
6028
6028
|
lenientCfb = parseLenientCfb(buffer);
|
|
6029
6029
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
6030
6030
|
} catch (e24) {
|
|
6031
|
-
throw new (0,
|
|
6031
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
6032
6032
|
}
|
|
6033
6033
|
}
|
|
6034
6034
|
const readRawStream = (path) => {
|
|
@@ -6039,14 +6039,14 @@ function openHwp5Container(buffer, options) {
|
|
|
6039
6039
|
return lenientCfb.findStream(path);
|
|
6040
6040
|
};
|
|
6041
6041
|
const headerData = readRawStream("/FileHeader");
|
|
6042
|
-
if (!headerData) throw new (0,
|
|
6042
|
+
if (!headerData) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6043
6043
|
const header = parseFileHeader(headerData);
|
|
6044
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
6045
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
6044
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
6045
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
6046
6046
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
6047
6047
|
if (encrypted) {
|
|
6048
6048
|
if (!_optionalChain([options, 'optionalAccess', _214 => _214.password])) {
|
|
6049
|
-
throw new (0,
|
|
6049
|
+
throw new (0, _chunkOMGCVZ4Wcjs.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.");
|
|
6050
6050
|
}
|
|
6051
6051
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
6052
6052
|
}
|
|
@@ -6060,12 +6060,12 @@ function openHwp5Container(buffer, options) {
|
|
|
6060
6060
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
6061
6061
|
if (encrypted) {
|
|
6062
6062
|
const rawDocInfo = findStream("/DocInfo");
|
|
6063
|
-
if (!rawDocInfo) throw new (0,
|
|
6063
|
+
if (!rawDocInfo) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6064
6064
|
let docInfoData;
|
|
6065
6065
|
try {
|
|
6066
6066
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
6067
6067
|
} catch (e25) {
|
|
6068
|
-
throw new (0,
|
|
6068
|
+
throw new (0, _chunkOMGCVZ4Wcjs.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.");
|
|
6069
6069
|
}
|
|
6070
6070
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
6071
6071
|
}
|
|
@@ -6090,10 +6090,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
6090
6090
|
try {
|
|
6091
6091
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
6092
6092
|
totalDecompressed += data.length;
|
|
6093
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6093
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6094
6094
|
out.push(readRecords(data));
|
|
6095
6095
|
} catch (secErr) {
|
|
6096
|
-
if (secErr instanceof
|
|
6096
|
+
if (secErr instanceof _chunkOMGCVZ4Wcjs.KordocError) throw secErr;
|
|
6097
6097
|
out.push(null);
|
|
6098
6098
|
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" });
|
|
6099
6099
|
}
|
|
@@ -6113,7 +6113,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6113
6113
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
6114
6114
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
6115
6115
|
const sections = readHwp5SectionStreams(c);
|
|
6116
|
-
if (sections.length === 0) throw new (0,
|
|
6116
|
+
if (sections.length === 0) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
6117
6117
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
6118
6118
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
6119
6119
|
const sectionTableIds = [];
|
|
@@ -6157,7 +6157,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6157
6157
|
parsedSections++;
|
|
6158
6158
|
_optionalChain([options, 'optionalAccess', _219 => _219.onProgress, 'optionalCall', _220 => _220(parsedSections, sections.length)]);
|
|
6159
6159
|
} catch (secErr) {
|
|
6160
|
-
if (secErr instanceof
|
|
6160
|
+
if (secErr instanceof _chunkOMGCVZ4Wcjs.KordocError) throw secErr;
|
|
6161
6161
|
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" });
|
|
6162
6162
|
} finally {
|
|
6163
6163
|
pageBase += detect2.pages;
|
|
@@ -6168,10 +6168,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6168
6168
|
}
|
|
6169
6169
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
6170
6170
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter, encrypted ? findStream : void 0) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter, encrypted ? findStream : void 0);
|
|
6171
|
-
let flatBlocks =
|
|
6172
|
-
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks =
|
|
6171
|
+
let flatBlocks = _chunkB5M676H3cjs.flattenLayoutTables.call(void 0, blocks);
|
|
6172
|
+
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks = _chunkB5M676H3cjs.unframeLayoutTables.call(void 0, flatBlocks, !!_optionalChain([options, 'optionalAccess', _222 => _222.keepTrailingEmptyCols]));
|
|
6173
6173
|
if (_optionalChain([options, 'optionalAccess', _223 => _223.dedupeRunningHeaders])) {
|
|
6174
|
-
const deduped =
|
|
6174
|
+
const deduped = _chunkB5M676H3cjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
6175
6175
|
const removed = flatBlocks.length - deduped.length;
|
|
6176
6176
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
6177
6177
|
flatBlocks = deduped;
|
|
@@ -6180,10 +6180,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6180
6180
|
detectHwp5Headings(flatBlocks, docInfo, doc.tocTexts);
|
|
6181
6181
|
}
|
|
6182
6182
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
6183
|
-
let markdown =
|
|
6183
|
+
let markdown = _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, flatBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _224 => _224.tableFormat]) });
|
|
6184
6184
|
if (_optionalChain([options, 'optionalAccess', _225 => _225.inlineImages]) && options.images !== false && images.length > 0) {
|
|
6185
6185
|
try {
|
|
6186
|
-
markdown =
|
|
6186
|
+
markdown = _chunkWVZSTMCZcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
6187
6187
|
} catch (inlineErr) {
|
|
6188
6188
|
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" });
|
|
6189
6189
|
}
|
|
@@ -6247,9 +6247,9 @@ function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
|
6247
6247
|
let level = 0;
|
|
6248
6248
|
if (_optionalChain([block, 'access', _232 => _232.style, 'optionalAccess', _233 => _233.fontSize]) && baseFontSize > 0) {
|
|
6249
6249
|
const ratio = block.style.fontSize / baseFontSize;
|
|
6250
|
-
if (ratio >=
|
|
6251
|
-
else if (ratio >=
|
|
6252
|
-
else if (ratio >=
|
|
6250
|
+
if (ratio >= _chunkB5M676H3cjs.HEADING_RATIO_H1) level = 1;
|
|
6251
|
+
else if (ratio >= _chunkB5M676H3cjs.HEADING_RATIO_H2) level = 2;
|
|
6252
|
+
else if (ratio >= _chunkB5M676H3cjs.HEADING_RATIO_H3) level = 3;
|
|
6253
6253
|
}
|
|
6254
6254
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
6255
6255
|
if (level === 0) level = 2;
|
|
@@ -6381,7 +6381,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6381
6381
|
const raw = _nullishCoalesce(lcfb.findStream(`/BodyText/Section${i}`), () => ( lcfb.findStream(`Section${i}`)));
|
|
6382
6382
|
if (!raw) break;
|
|
6383
6383
|
totalBytes += raw.length;
|
|
6384
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6384
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6385
6385
|
sections.push({ idx: i, content: raw });
|
|
6386
6386
|
}
|
|
6387
6387
|
if (sections.length === 0) {
|
|
@@ -6392,7 +6392,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6392
6392
|
const raw = lcfb.findStream(e.name);
|
|
6393
6393
|
if (raw) {
|
|
6394
6394
|
totalBytes += raw.length;
|
|
6395
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6395
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6396
6396
|
sections.push({ idx, content: raw });
|
|
6397
6397
|
}
|
|
6398
6398
|
}
|
|
@@ -6409,7 +6409,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6409
6409
|
try {
|
|
6410
6410
|
const content = decryptViewText(raw, compressed);
|
|
6411
6411
|
totalDecompressed += content.length;
|
|
6412
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6412
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6413
6413
|
sections.push({ idx: i, content });
|
|
6414
6414
|
} catch (e32) {
|
|
6415
6415
|
break;
|
|
@@ -18909,25 +18909,25 @@ function desEcbDecrypt(data, key2) {
|
|
|
18909
18909
|
}
|
|
18910
18910
|
function readLayout(data) {
|
|
18911
18911
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18912
|
-
throw new (0,
|
|
18912
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18913
18913
|
}
|
|
18914
18914
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18915
18915
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18916
18916
|
if (payloadOffset >= data.length) {
|
|
18917
|
-
throw new (0,
|
|
18917
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18918
18918
|
}
|
|
18919
18919
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18920
18920
|
}
|
|
18921
18921
|
function decryptHwp3Document(input, password) {
|
|
18922
18922
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18923
18923
|
if (!compressed) {
|
|
18924
|
-
throw new (0,
|
|
18924
|
+
throw new (0, _chunkOMGCVZ4Wcjs.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)");
|
|
18925
18925
|
}
|
|
18926
18926
|
const source = Buffer.from(input);
|
|
18927
18927
|
const payload = source.subarray(payloadOffset);
|
|
18928
18928
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18929
18929
|
if (aligned.length === 0) {
|
|
18930
|
-
throw new (0,
|
|
18930
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18931
18931
|
}
|
|
18932
18932
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18933
18933
|
let inflated;
|
|
@@ -18935,14 +18935,14 @@ function decryptHwp3Document(input, password) {
|
|
|
18935
18935
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18936
18936
|
} catch (err) {
|
|
18937
18937
|
if (_optionalChain([err, 'optionalAccess', _248 => _248.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18938
|
-
throw new (0,
|
|
18938
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(
|
|
18939
18939
|
`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`
|
|
18940
18940
|
);
|
|
18941
18941
|
}
|
|
18942
|
-
throw new (0,
|
|
18942
|
+
throw new (0, _chunkOMGCVZ4Wcjs.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.");
|
|
18943
18943
|
}
|
|
18944
18944
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18945
|
-
throw new (0,
|
|
18945
|
+
throw new (0, _chunkOMGCVZ4Wcjs.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.");
|
|
18946
18946
|
}
|
|
18947
18947
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18948
18948
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -18999,9 +18999,9 @@ function hwp3CellGrid(info, count) {
|
|
|
18999
18999
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
19000
19000
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
19001
19001
|
const r2 = nextY[k] !== void 0 ? edgeAt(ys, nextY[k]) : ys.length - 1;
|
|
19002
|
-
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row),
|
|
19002
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunkB5M676H3cjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunkB5M676H3cjs.MAX_COLS) };
|
|
19003
19003
|
});
|
|
19004
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
19004
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunkB5M676H3cjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunkB5M676H3cjs.MAX_COLS), cells };
|
|
19005
19005
|
}
|
|
19006
19006
|
|
|
19007
19007
|
// src/hwp3/parser.ts
|
|
@@ -19042,7 +19042,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19042
19042
|
let source = Buffer.from(buffer);
|
|
19043
19043
|
if (isEncryptedHwp3(source)) {
|
|
19044
19044
|
if (!_optionalChain([options, 'optionalAccess', _249 => _249.password])) {
|
|
19045
|
-
throw new (0,
|
|
19045
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(
|
|
19046
19046
|
"\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."
|
|
19047
19047
|
);
|
|
19048
19048
|
}
|
|
@@ -19059,10 +19059,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19059
19059
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
19060
19060
|
} catch (err) {
|
|
19061
19061
|
if (_optionalChain([err, 'optionalAccess', _250 => _250.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
19062
|
-
throw new (0,
|
|
19062
|
+
throw new (0, _chunkOMGCVZ4Wcjs.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`);
|
|
19063
19063
|
}
|
|
19064
19064
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
19065
|
-
throw new (0,
|
|
19065
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
19066
19066
|
}
|
|
19067
19067
|
} else {
|
|
19068
19068
|
body = tail;
|
|
@@ -19085,7 +19085,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19085
19085
|
const names = new Map([...ctx.picIds].map(([name, id]) => [id, name]));
|
|
19086
19086
|
dropMissingPictures(allBlocks, binData, names, warnings);
|
|
19087
19087
|
const images = resolveImageBlocks(binData, allBlocks, warnings, true);
|
|
19088
|
-
const blocks =
|
|
19088
|
+
const blocks = _chunkB5M676H3cjs.flattenLayoutTables.call(void 0, allBlocks);
|
|
19089
19089
|
const metadata = {
|
|
19090
19090
|
title: header.title || void 0,
|
|
19091
19091
|
author: header.author || void 0,
|
|
@@ -19093,10 +19093,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19093
19093
|
createdAt: header.date || void 0,
|
|
19094
19094
|
version: "3.0"
|
|
19095
19095
|
};
|
|
19096
|
-
let markdown =
|
|
19096
|
+
let markdown = _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _251 => _251.tableFormat]) });
|
|
19097
19097
|
if (_optionalChain([options, 'optionalAccess', _252 => _252.inlineImages]) && options.images !== false && images.length > 0) {
|
|
19098
19098
|
try {
|
|
19099
|
-
markdown =
|
|
19099
|
+
markdown = _chunkWVZSTMCZcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
19100
19100
|
} catch (inlineErr) {
|
|
19101
19101
|
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" });
|
|
19102
19102
|
}
|
|
@@ -19228,7 +19228,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
19228
19228
|
continue;
|
|
19229
19229
|
}
|
|
19230
19230
|
if (ch >= 32) {
|
|
19231
|
-
para2.text +=
|
|
19231
|
+
para2.text += _chunkB5M676H3cjs.escapeLiteralTags.call(void 0, _chunkB5M676H3cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( ""))));
|
|
19232
19232
|
continue;
|
|
19233
19233
|
}
|
|
19234
19234
|
if (ch === 9) {
|
|
@@ -19463,7 +19463,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19463
19463
|
// src/xlsx/sheet-blocks.ts
|
|
19464
19464
|
var MAX_SHEET_COLS = 16384;
|
|
19465
19465
|
function sheetRowCap(cols) {
|
|
19466
|
-
return Math.floor(
|
|
19466
|
+
return Math.floor(_chunkB5M676H3cjs.MAX_TABLE_CELLS / Math.max(1, cols));
|
|
19467
19467
|
}
|
|
19468
19468
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19469
19469
|
const blocks = [];
|
|
@@ -19494,7 +19494,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19494
19494
|
if (keepRows.length > rowCap) {
|
|
19495
19495
|
warnings.push({
|
|
19496
19496
|
page: sheetIndex + 1,
|
|
19497
|
-
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 ${
|
|
19497
|
+
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 ${_chunkB5M676H3cjs.MAX_TABLE_CELLS})`,
|
|
19498
19498
|
code: "TRUNCATED_TABLE"
|
|
19499
19499
|
});
|
|
19500
19500
|
keepRows.length = rowCap;
|
|
@@ -19528,14 +19528,14 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19528
19528
|
}
|
|
19529
19529
|
cellRows.push(row);
|
|
19530
19530
|
}
|
|
19531
|
-
const table2 =
|
|
19531
|
+
const table2 = _chunkB5M676H3cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap, maxCols: keepCols.length });
|
|
19532
19532
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19533
19533
|
return blocks;
|
|
19534
19534
|
}
|
|
19535
19535
|
|
|
19536
19536
|
// src/xlsx/parser.ts
|
|
19537
19537
|
var MAX_SHEETS = 100;
|
|
19538
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19538
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkOMGCVZ4Wcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19539
19539
|
var MAX_SHEET_ROWS = 1048576;
|
|
19540
19540
|
function cleanNumericValue(raw) {
|
|
19541
19541
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19572,7 +19572,7 @@ function getTextContent(el) {
|
|
|
19572
19572
|
return _nullishCoalesce(_optionalChain([el, 'access', _268 => _268.textContent, 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]), () => ( ""));
|
|
19573
19573
|
}
|
|
19574
19574
|
function parseXml(text) {
|
|
19575
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19575
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkOMGCVZ4Wcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19576
19576
|
}
|
|
19577
19577
|
function collectRichText(root) {
|
|
19578
19578
|
let out = "";
|
|
@@ -19583,7 +19583,7 @@ function collectRichText(root) {
|
|
|
19583
19583
|
const el = children[i];
|
|
19584
19584
|
const local2 = el.localName || _optionalChain([el, 'access', _271 => _271.tagName, 'optionalAccess', _272 => _272.replace, 'call', _273 => _273(/^[^:]+:/, "")]) || "";
|
|
19585
19585
|
if (local2 === "rPh") continue;
|
|
19586
|
-
if (local2 === "t") out +=
|
|
19586
|
+
if (local2 === "t") out += _chunkB5M676H3cjs.escapeLiteralTags.call(void 0, _chunkB5M676H3cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
19587
19587
|
else walk(el);
|
|
19588
19588
|
}
|
|
19589
19589
|
};
|
|
@@ -19794,12 +19794,12 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19794
19794
|
return { rows, merges, maxCol };
|
|
19795
19795
|
}
|
|
19796
19796
|
async function parseXlsxDocument(buffer, options) {
|
|
19797
|
-
|
|
19797
|
+
_chunkOMGCVZ4Wcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19798
19798
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19799
19799
|
const warnings = [];
|
|
19800
19800
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19801
19801
|
if (!workbookFile) {
|
|
19802
|
-
throw new (0,
|
|
19802
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19803
19803
|
}
|
|
19804
19804
|
let sharedStrings = [];
|
|
19805
19805
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19808,7 +19808,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19808
19808
|
}
|
|
19809
19809
|
const { sheets, date1904 } = parseWorkbook(await readZipEntry(workbookFile, "text"));
|
|
19810
19810
|
if (sheets.length === 0) {
|
|
19811
|
-
throw new (0,
|
|
19811
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19812
19812
|
}
|
|
19813
19813
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19814
19814
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19892,7 +19892,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19892
19892
|
} catch (e35) {
|
|
19893
19893
|
}
|
|
19894
19894
|
}
|
|
19895
|
-
const markdown =
|
|
19895
|
+
const markdown = _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _278 => _278.tableFormat]) });
|
|
19896
19896
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19897
19897
|
}
|
|
19898
19898
|
|
|
@@ -20206,14 +20206,14 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20206
20206
|
const h = readCellHeader(rec.data);
|
|
20207
20207
|
if (h && rec.data.length >= 10) {
|
|
20208
20208
|
const isst = rec.data.readUInt32LE(6);
|
|
20209
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20209
|
+
cells.push({ row: h.row, col: h.col, value: _chunkB5M676H3cjs.escapeLiteralTags.call(void 0, _chunkB5M676H3cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(sst[isst], () => ( "")))) });
|
|
20210
20210
|
}
|
|
20211
20211
|
break;
|
|
20212
20212
|
}
|
|
20213
20213
|
case OP_LABEL: {
|
|
20214
20214
|
const h = readCellHeader(rec.data);
|
|
20215
20215
|
if (h) {
|
|
20216
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20216
|
+
cells.push({ row: h.row, col: h.col, value: _chunkB5M676H3cjs.escapeLiteralTags.call(void 0, _chunkB5M676H3cjs.escapeLiteralDollar.call(void 0, decodeLabelString(rec.data))) });
|
|
20217
20217
|
}
|
|
20218
20218
|
break;
|
|
20219
20219
|
}
|
|
@@ -20229,7 +20229,7 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20229
20229
|
cells.push({
|
|
20230
20230
|
row: h.row,
|
|
20231
20231
|
col: h.col,
|
|
20232
|
-
value:
|
|
20232
|
+
value: _chunkB5M676H3cjs.escapeLiteralTags.call(void 0, _chunkB5M676H3cjs.escapeLiteralDollar.call(void 0, decodeFormulaStringRecord(next.data)))
|
|
20233
20233
|
});
|
|
20234
20234
|
i = j;
|
|
20235
20235
|
} else {
|
|
@@ -20341,11 +20341,11 @@ function processGlobals(records) {
|
|
|
20341
20341
|
const xfFmtIds = [];
|
|
20342
20342
|
const firstBof = records[0];
|
|
20343
20343
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
20344
|
-
throw new (0,
|
|
20344
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
20345
20345
|
}
|
|
20346
20346
|
const bof = decodeBof(firstBof.data);
|
|
20347
20347
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
20348
|
-
throw new (0,
|
|
20348
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
20349
20349
|
}
|
|
20350
20350
|
let i = 1;
|
|
20351
20351
|
while (i < records.length) {
|
|
@@ -20429,28 +20429,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20429
20429
|
try {
|
|
20430
20430
|
cfb = parseLenientCfb(buf);
|
|
20431
20431
|
} catch (e) {
|
|
20432
|
-
throw new (0,
|
|
20432
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(
|
|
20433
20433
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20434
20434
|
);
|
|
20435
20435
|
}
|
|
20436
20436
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20437
20437
|
if (!wb) {
|
|
20438
|
-
throw new (0,
|
|
20438
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20439
20439
|
}
|
|
20440
20440
|
const records = readRecords2(wb);
|
|
20441
20441
|
if (records.length === 0) {
|
|
20442
|
-
throw new (0,
|
|
20442
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20443
20443
|
}
|
|
20444
20444
|
const firstBof = decodeBof(records[0].data);
|
|
20445
20445
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20446
|
-
throw new (0,
|
|
20446
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(
|
|
20447
20447
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20448
20448
|
);
|
|
20449
20449
|
}
|
|
20450
20450
|
const globals = processGlobals(records);
|
|
20451
20451
|
const warnings = [];
|
|
20452
20452
|
if (globals.encrypted) {
|
|
20453
|
-
throw new (0,
|
|
20453
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20454
20454
|
}
|
|
20455
20455
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20456
20456
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20501,7 +20501,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20501
20501
|
pageCount: totalSheets
|
|
20502
20502
|
};
|
|
20503
20503
|
return {
|
|
20504
|
-
markdown:
|
|
20504
|
+
markdown: _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, allBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _283 => _283.tableFormat]) }),
|
|
20505
20505
|
blocks: allBlocks,
|
|
20506
20506
|
metadata,
|
|
20507
20507
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20940,7 +20940,7 @@ function isDisplayMath(el) {
|
|
|
20940
20940
|
}
|
|
20941
20941
|
|
|
20942
20942
|
// src/docx/parser.ts
|
|
20943
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20943
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkOMGCVZ4Wcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20944
20944
|
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
20945
20945
|
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;
|
|
20946
20946
|
function matchesLocal(el, localName3) {
|
|
@@ -20998,7 +20998,7 @@ function getAttr(el, localName3) {
|
|
|
20998
20998
|
return null;
|
|
20999
20999
|
}
|
|
21000
21000
|
function parseXml2(text) {
|
|
21001
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21001
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkOMGCVZ4Wcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21002
21002
|
}
|
|
21003
21003
|
function parseStyles(xml) {
|
|
21004
21004
|
const doc = parseXml2(xml);
|
|
@@ -21134,7 +21134,7 @@ function parseFootnotes(xml) {
|
|
|
21134
21134
|
const runs = findElements(p, "r");
|
|
21135
21135
|
for (const r of runs) {
|
|
21136
21136
|
const tElements = getChildElements(r, "t");
|
|
21137
|
-
for (const t of tElements) texts.push(
|
|
21137
|
+
for (const t of tElements) texts.push(_chunkB5M676H3cjs.escapeLiteralTags.call(void 0, _chunkB5M676H3cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(t.textContent, () => ( "")))));
|
|
21138
21138
|
}
|
|
21139
21139
|
}
|
|
21140
21140
|
notes.set(id, texts.join("").trim());
|
|
@@ -21165,7 +21165,7 @@ function collectOmmlRoots(p) {
|
|
|
21165
21165
|
function extractRun(r) {
|
|
21166
21166
|
let text = "";
|
|
21167
21167
|
for (const el of effectiveChildElements(r)) {
|
|
21168
|
-
if (matchesLocal(el, "t")) text +=
|
|
21168
|
+
if (matchesLocal(el, "t")) text += _chunkB5M676H3cjs.escapeLiteralTags.call(void 0, _chunkB5M676H3cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
21169
21169
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
21170
21170
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
21171
21171
|
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
@@ -21178,7 +21178,7 @@ function extractRun(r) {
|
|
|
21178
21178
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
21179
21179
|
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
21180
21180
|
const v = va ? getAttr(va, "val") : null;
|
|
21181
|
-
if (v === "superscript" || v === "subscript") text =
|
|
21181
|
+
if (v === "superscript" || v === "subscript") text = _chunkB5M676H3cjs.wrapScript.call(void 0, text, v === "superscript" ? "sup" : "sub");
|
|
21182
21182
|
}
|
|
21183
21183
|
return { text, bold, italic };
|
|
21184
21184
|
}
|
|
@@ -21196,7 +21196,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
21196
21196
|
function makeLink(text, rawHref) {
|
|
21197
21197
|
if (!text) return "";
|
|
21198
21198
|
if (!rawHref) return text;
|
|
21199
|
-
const href =
|
|
21199
|
+
const href = _chunkOMGCVZ4Wcjs.sanitizeHref.call(void 0, rawHref);
|
|
21200
21200
|
return href ? `[${text}](${href})` : text;
|
|
21201
21201
|
}
|
|
21202
21202
|
function collectInline(p, footnotes, rels) {
|
|
@@ -21287,7 +21287,7 @@ function collectInline(p, footnotes, rels) {
|
|
|
21287
21287
|
const m = mathText(om);
|
|
21288
21288
|
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
21289
21289
|
}
|
|
21290
|
-
const text =
|
|
21290
|
+
const text = _chunkB5M676H3cjs.tidyScriptTags.call(void 0, parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
21291
21291
|
return { text, bold, italic, footnoteText };
|
|
21292
21292
|
}
|
|
21293
21293
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -21412,7 +21412,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21412
21412
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21413
21413
|
})
|
|
21414
21414
|
);
|
|
21415
|
-
const table2 =
|
|
21415
|
+
const table2 = _chunkB5M676H3cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21416
21416
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21417
21417
|
return { type: "table", table: table2 };
|
|
21418
21418
|
}
|
|
@@ -21461,7 +21461,7 @@ async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
|
21461
21461
|
let data = null;
|
|
21462
21462
|
if (readBytes) data = await readZipEntry(imgFile, "uint8array");
|
|
21463
21463
|
imgIdx++;
|
|
21464
|
-
const ext =
|
|
21464
|
+
const ext = _chunkOMGCVZ4Wcjs.partExtension.call(void 0, imgPath);
|
|
21465
21465
|
const mimeMap = {
|
|
21466
21466
|
png: "image/png",
|
|
21467
21467
|
jpg: "image/jpeg",
|
|
@@ -21560,12 +21560,12 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21560
21560
|
}
|
|
21561
21561
|
async function parseDocxDocument(buffer, options) {
|
|
21562
21562
|
const readImages = _optionalChain([options, 'optionalAccess', _319 => _319.images]) !== false;
|
|
21563
|
-
|
|
21563
|
+
_chunkOMGCVZ4Wcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5, void 0, { re: MEDIA_PART_RE, skip: !readImages, never: NEVER_READ_RE });
|
|
21564
21564
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21565
21565
|
const warnings = [];
|
|
21566
21566
|
const docFile = zip.file("word/document.xml");
|
|
21567
21567
|
if (!docFile) {
|
|
21568
|
-
throw new (0,
|
|
21568
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21569
21569
|
}
|
|
21570
21570
|
let rels = /* @__PURE__ */ new Map();
|
|
21571
21571
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21612,7 +21612,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21612
21612
|
const doc = parseXml2(docXml);
|
|
21613
21613
|
const body = findElements(doc, "body");
|
|
21614
21614
|
if (body.length === 0) {
|
|
21615
|
-
throw new (0,
|
|
21615
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21616
21616
|
}
|
|
21617
21617
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
21618
21618
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -21665,7 +21665,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21665
21665
|
}
|
|
21666
21666
|
}
|
|
21667
21667
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21668
|
-
const markdown =
|
|
21668
|
+
const markdown = _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _326 => _326.tableFormat]) });
|
|
21669
21669
|
return {
|
|
21670
21670
|
markdown,
|
|
21671
21671
|
blocks,
|
|
@@ -21679,7 +21679,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21679
21679
|
// src/pptx/parser.ts
|
|
21680
21680
|
|
|
21681
21681
|
|
|
21682
|
-
var MAX_DECOMPRESS_SIZE6 =
|
|
21682
|
+
var MAX_DECOMPRESS_SIZE6 = _chunkOMGCVZ4Wcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
21683
21683
|
var MEDIA_PART_RE2 = /^ppt\/(?:media|embeddings)\//;
|
|
21684
21684
|
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;
|
|
21685
21685
|
var MAX_ZIP_ENTRIES2 = 1e4;
|
|
@@ -21702,7 +21702,7 @@ var IMAGE_MIME = {
|
|
|
21702
21702
|
svg: "image/svg+xml"
|
|
21703
21703
|
};
|
|
21704
21704
|
function parseXml3(text) {
|
|
21705
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21705
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkOMGCVZ4Wcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21706
21706
|
}
|
|
21707
21707
|
function getAttr2(el, name) {
|
|
21708
21708
|
const attrs = el.attributes;
|
|
@@ -21769,7 +21769,7 @@ async function slideParts(zip) {
|
|
|
21769
21769
|
names.sort((a, b) => Number(SLIDE_PART_RE.exec(a)[1]) - Number(SLIDE_PART_RE.exec(b)[1]));
|
|
21770
21770
|
ordered.push(...names);
|
|
21771
21771
|
}
|
|
21772
|
-
if (ordered.length > MAX_SLIDES) throw new (0,
|
|
21772
|
+
if (ordered.length > MAX_SLIDES) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`PPTX \uC2AC\uB77C\uC774\uB4DC \uC218 \uCD08\uACFC: ${ordered.length} (\uCD5C\uB300 ${MAX_SLIDES})`);
|
|
21773
21773
|
return ordered;
|
|
21774
21774
|
}
|
|
21775
21775
|
function paragraphText(p) {
|
|
@@ -21780,12 +21780,12 @@ function paragraphText(p) {
|
|
|
21780
21780
|
const t = findChildByLocalName(child, "t");
|
|
21781
21781
|
const rPr = findChildByLocalName(child, "rPr");
|
|
21782
21782
|
const baseline = Number(rPr ? _nullishCoalesce(getAttr2(rPr, "baseline"), () => ( 0)) : 0);
|
|
21783
|
-
if (t) text +=
|
|
21783
|
+
if (t) text += _chunkB5M676H3cjs.wrapScript.call(void 0, _chunkB5M676H3cjs.escapeLiteralTags.call(void 0, _chunkB5M676H3cjs.escapeLiteralDollar.call(void 0, rawTextContent(t))), baseline > 0 ? "sup" : baseline < 0 ? "sub" : null);
|
|
21784
21784
|
} else if (name === "br") {
|
|
21785
21785
|
text += " ";
|
|
21786
21786
|
}
|
|
21787
21787
|
}
|
|
21788
|
-
return
|
|
21788
|
+
return _chunkB5M676H3cjs.tidyScriptTags.call(void 0, text.replace(/\s+/g, " ").trim());
|
|
21789
21789
|
}
|
|
21790
21790
|
function bodyParagraphs(txBody) {
|
|
21791
21791
|
const out = [];
|
|
@@ -21846,7 +21846,7 @@ function parseTable2(tbl2, page, keepEmptyCols) {
|
|
|
21846
21846
|
});
|
|
21847
21847
|
return cells;
|
|
21848
21848
|
});
|
|
21849
|
-
const table2 =
|
|
21849
|
+
const table2 = _chunkB5M676H3cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21850
21850
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21851
21851
|
return { type: "table", table: table2, pageNumber: page };
|
|
21852
21852
|
}
|
|
@@ -21859,7 +21859,7 @@ async function pictureBlock(pic, ctx) {
|
|
|
21859
21859
|
if (!filename) {
|
|
21860
21860
|
const file = ctx.zip.file(rel.target);
|
|
21861
21861
|
if (!file) return null;
|
|
21862
|
-
const ext =
|
|
21862
|
+
const ext = _chunkOMGCVZ4Wcjs.partExtension.call(void 0, rel.target);
|
|
21863
21863
|
filename = `image_${String(ctx.imageNames.size + 1).padStart(3, "0")}.${ext}`;
|
|
21864
21864
|
try {
|
|
21865
21865
|
if (_optionalChain([ctx, 'access', _330 => _330.options, 'optionalAccess', _331 => _331.images]) !== false) {
|
|
@@ -21937,10 +21937,10 @@ async function notesText(zip, rels) {
|
|
|
21937
21937
|
return texts.join(" ");
|
|
21938
21938
|
}
|
|
21939
21939
|
async function parsePptxDocument(buffer, options) {
|
|
21940
|
-
|
|
21940
|
+
_chunkOMGCVZ4Wcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE6, MAX_ZIP_ENTRIES2, { re: MEDIA_PART_RE2, skip: _optionalChain([options, 'optionalAccess', _334 => _334.images]) === false, never: NEVER_READ_RE2 });
|
|
21941
21941
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21942
21942
|
if (!zip.file("ppt/presentation.xml")) {
|
|
21943
|
-
throw new (0,
|
|
21943
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 PPTX \uD30C\uC77C: ppt/presentation.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21944
21944
|
}
|
|
21945
21945
|
const warnings = [];
|
|
21946
21946
|
const blocks = [];
|
|
@@ -21987,7 +21987,7 @@ async function parsePptxDocument(buffer, options) {
|
|
|
21987
21987
|
}
|
|
21988
21988
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")), pageNumber: b.pageNumber }));
|
|
21989
21989
|
return {
|
|
21990
|
-
markdown:
|
|
21990
|
+
markdown: _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _336 => _336.tableFormat]) }),
|
|
21991
21991
|
blocks,
|
|
21992
21992
|
metadata,
|
|
21993
21993
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -22003,11 +22003,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
22003
22003
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
22004
22004
|
function parseHwpmlDocument(buffer, options) {
|
|
22005
22005
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
22006
|
-
throw new (0,
|
|
22006
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
22007
22007
|
}
|
|
22008
22008
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
22009
22009
|
const normalized = text.replace(/ /g, " ");
|
|
22010
|
-
const xml =
|
|
22010
|
+
const xml = _chunkOMGCVZ4Wcjs.stripDtd.call(void 0, normalized);
|
|
22011
22011
|
const warnings = [];
|
|
22012
22012
|
const parser = new (0, _xmldom.DOMParser)({
|
|
22013
22013
|
onError: (_level, msg2) => {
|
|
@@ -22047,7 +22047,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
22047
22047
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _338 => _338.keepTrailingEmptyCols]), () => ( false)));
|
|
22048
22048
|
}
|
|
22049
22049
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
22050
|
-
const markdown =
|
|
22050
|
+
const markdown = _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _339 => _339.tableFormat]) });
|
|
22051
22051
|
return {
|
|
22052
22052
|
markdown,
|
|
22053
22053
|
blocks,
|
|
@@ -22167,7 +22167,7 @@ function collectCharText(node, parts, depth = 0) {
|
|
|
22167
22167
|
if (tag === "CHAR") {
|
|
22168
22168
|
for (const c of Array.from(el.childNodes)) {
|
|
22169
22169
|
const t = c.nodeType === 1 ? charElementText(c) : c.nodeType === 3 || c.nodeType === 4 ? _nullishCoalesce(c.nodeValue, () => ( "")) : "";
|
|
22170
|
-
if (t) parts.push(
|
|
22170
|
+
if (t) parts.push(_chunkB5M676H3cjs.escapeLiteralTags.call(void 0, t));
|
|
22171
22171
|
}
|
|
22172
22172
|
} else if (tag === "TABLE" || tag === "PICTURE" || tag === "SHAPEOBJECT") {
|
|
22173
22173
|
} else if (tag === "AUTONUM") {
|
|
@@ -22227,7 +22227,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
22227
22227
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
22228
22228
|
cellRows[r].push(cell2);
|
|
22229
22229
|
}
|
|
22230
|
-
const table2 =
|
|
22230
|
+
const table2 = _chunkB5M676H3cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
22231
22231
|
if (structured.length > 0) {
|
|
22232
22232
|
const claimed = /* @__PURE__ */ new Set();
|
|
22233
22233
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -24005,7 +24005,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
24005
24005
|
};
|
|
24006
24006
|
}
|
|
24007
24007
|
async function extractClickHereFields(hwpxBuffer) {
|
|
24008
|
-
|
|
24008
|
+
_chunkOMGCVZ4Wcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24009
24009
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24010
24010
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24011
24011
|
const fields = [];
|
|
@@ -24041,7 +24041,7 @@ function readZipEntries(buf) {
|
|
|
24041
24041
|
}
|
|
24042
24042
|
function localDataStart(view, localOffset) {
|
|
24043
24043
|
if (view.getUint32(localOffset, true) !== LOCAL_SIG) {
|
|
24044
|
-
throw new (0,
|
|
24044
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24045
24045
|
}
|
|
24046
24046
|
const nameLen = view.getUint16(localOffset + 26, true);
|
|
24047
24047
|
const extraLen = view.getUint16(localOffset + 28, true);
|
|
@@ -24071,19 +24071,19 @@ function parseCentralDirectory(buf) {
|
|
|
24071
24071
|
}
|
|
24072
24072
|
}
|
|
24073
24073
|
}
|
|
24074
|
-
if (eocdOffset < 0) throw new (0,
|
|
24074
|
+
if (eocdOffset < 0) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24075
24075
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
24076
24076
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
24077
24077
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
24078
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
24078
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24079
24079
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
24080
|
-
throw new (0,
|
|
24080
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24081
24081
|
}
|
|
24082
24082
|
const decoder = new TextDecoder("utf-8");
|
|
24083
24083
|
const entries = [];
|
|
24084
24084
|
let pos = cdOffset;
|
|
24085
24085
|
for (let i = 0; i < totalEntries; i++) {
|
|
24086
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
24086
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
24087
24087
|
const flags = view.getUint16(pos + 8, true);
|
|
24088
24088
|
const method = view.getUint16(pos + 10, true);
|
|
24089
24089
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -24094,7 +24094,7 @@ function parseCentralDirectory(buf) {
|
|
|
24094
24094
|
const commentLen = view.getUint16(pos + 32, true);
|
|
24095
24095
|
const localOffset = view.getUint32(pos + 42, true);
|
|
24096
24096
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
24097
|
-
throw new (0,
|
|
24097
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24098
24098
|
}
|
|
24099
24099
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
24100
24100
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -24123,11 +24123,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24123
24123
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
24124
24124
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
24125
24125
|
for (const name of replacements.keys()) {
|
|
24126
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
24126
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24127
24127
|
}
|
|
24128
24128
|
if (additions) {
|
|
24129
24129
|
for (const name of additions.keys()) {
|
|
24130
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
24130
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24131
24131
|
}
|
|
24132
24132
|
}
|
|
24133
24133
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -24146,7 +24146,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24146
24146
|
offset += seg.length;
|
|
24147
24147
|
continue;
|
|
24148
24148
|
}
|
|
24149
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
24149
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24150
24150
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
24151
24151
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
24152
24152
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -24154,7 +24154,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24154
24154
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
24155
24155
|
const method = e.method;
|
|
24156
24156
|
if (method !== 0 && method !== 8) {
|
|
24157
|
-
throw new (0,
|
|
24157
|
+
throw new (0, _chunkOMGCVZ4Wcjs.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`);
|
|
24158
24158
|
}
|
|
24159
24159
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
24160
24160
|
const crc = crc32(newData);
|
|
@@ -24252,11 +24252,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24252
24252
|
// src/form/filler-hwpx.ts
|
|
24253
24253
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
24254
24254
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
24255
|
-
|
|
24255
|
+
_chunkOMGCVZ4Wcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24256
24256
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24257
24257
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24258
24258
|
if (sectionPaths.length === 0) {
|
|
24259
|
-
throw new (0,
|
|
24259
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24260
24260
|
}
|
|
24261
24261
|
const warnings = [];
|
|
24262
24262
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -24648,7 +24648,7 @@ var MIN_SIDE = 24;
|
|
|
24648
24648
|
async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
24649
24649
|
const ocr = _optionalChain([options, 'optionalAccess', _491 => _491.ocr]);
|
|
24650
24650
|
if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
|
|
24651
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
24651
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-THUO6YRG.cjs")));
|
|
24652
24652
|
let inserted = false, unreadable = 0;
|
|
24653
24653
|
let failed = null;
|
|
24654
24654
|
const walk = async (list, depth) => {
|
|
@@ -24689,7 +24689,7 @@ async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
|
24689
24689
|
function ocrBytes(img) {
|
|
24690
24690
|
const mime = img.mimeType.toLowerCase();
|
|
24691
24691
|
if (mime.includes("wmf") || mime.includes("emf")) return null;
|
|
24692
|
-
if (mime.includes("bmp")) return
|
|
24692
|
+
if (mime.includes("bmp")) return _chunkWVZSTMCZcjs.bmpToPng.call(void 0, img.data);
|
|
24693
24693
|
return img.data;
|
|
24694
24694
|
}
|
|
24695
24695
|
async function tooSmall(bytes) {
|
|
@@ -24858,7 +24858,7 @@ function classifyTableTree(blocks) {
|
|
|
24858
24858
|
return blocks;
|
|
24859
24859
|
}
|
|
24860
24860
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
24861
|
-
const structured = hasMerged(table2) ||
|
|
24861
|
+
const structured = hasMerged(table2) || _chunkB5M676H3cjs.hasStructuredCellContent.call(void 0, table2);
|
|
24862
24862
|
if (opts.smartVisual && _optionalChain([table2, 'access', _507 => _507.classification, 'optionalAccess', _508 => _508.kind]) === "non-tabular-layout") return "visual";
|
|
24863
24863
|
return structured ? "html" : "gfm";
|
|
24864
24864
|
}
|
|
@@ -35944,7 +35944,7 @@ function findAgency(name) {
|
|
|
35944
35944
|
}
|
|
35945
35945
|
function agencyStyle(name) {
|
|
35946
35946
|
const s = findAgency(name);
|
|
35947
|
-
if (!s) throw new (0,
|
|
35947
|
+
if (!s) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`agency: \uC2E4\uCE21 \uC11C\uC2DD\uC774 \uC5C6\uB294 \uAE30\uAD00\uC785\uB2C8\uB2E4 "${name}" \u2014 ${AGENCY_COMMON_NAME} \uB610\uB294 ${agencyNames().join("\xB7")}`);
|
|
35948
35948
|
return s;
|
|
35949
35949
|
}
|
|
35950
35950
|
function applyAgency(opts, preset) {
|
|
@@ -37008,7 +37008,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
37008
37008
|
}
|
|
37009
37009
|
function assertFiniteRange(name, value, min, max) {
|
|
37010
37010
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
37011
|
-
throw new (0,
|
|
37011
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
37012
37012
|
}
|
|
37013
37013
|
}
|
|
37014
37014
|
function validateGongmunOptions(opts) {
|
|
@@ -37026,10 +37026,10 @@ function validateGongmunOptions(opts) {
|
|
|
37026
37026
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
37027
37027
|
}
|
|
37028
37028
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
37029
|
-
throw new (0,
|
|
37029
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
37030
37030
|
}
|
|
37031
37031
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
37032
|
-
throw new (0,
|
|
37032
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
37033
37033
|
}
|
|
37034
37034
|
}
|
|
37035
37035
|
if (opts.sizes) {
|
|
@@ -37038,24 +37038,24 @@ function validateGongmunOptions(opts) {
|
|
|
37038
37038
|
}
|
|
37039
37039
|
}
|
|
37040
37040
|
if (opts.approval && opts.approval.length > 6) {
|
|
37041
|
-
throw new (0,
|
|
37041
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("approval must contain at most 6 labels");
|
|
37042
37042
|
}
|
|
37043
37043
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
37044
37044
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
37045
37045
|
for (const n of nums) {
|
|
37046
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
37046
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
37047
37047
|
}
|
|
37048
37048
|
}
|
|
37049
37049
|
if (opts.levels) {
|
|
37050
37050
|
for (const [key2, st] of Object.entries(opts.levels)) {
|
|
37051
37051
|
const depth = Number(key2);
|
|
37052
37052
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
37053
|
-
throw new (0,
|
|
37053
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key2}")`);
|
|
37054
37054
|
}
|
|
37055
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
37055
|
+
if (!st || typeof st !== "object") throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`levels.${key2} must be an object {font, pt, bold}`);
|
|
37056
37056
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key2}.pt`, st.pt, 6, 60);
|
|
37057
37057
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
37058
|
-
throw new (0,
|
|
37058
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`levels.${key2}.font must be a non-empty string`);
|
|
37059
37059
|
}
|
|
37060
37060
|
}
|
|
37061
37061
|
}
|
|
@@ -37113,7 +37113,7 @@ function resolveChecklist(c, preset) {
|
|
|
37113
37113
|
function hexColorOption(name, value) {
|
|
37114
37114
|
if (value === void 0) return void 0;
|
|
37115
37115
|
const v = value.trim();
|
|
37116
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
37116
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
37117
37117
|
return v.toUpperCase();
|
|
37118
37118
|
}
|
|
37119
37119
|
function resolveGongmun(input) {
|
|
@@ -37191,21 +37191,21 @@ function standardMarker(depth, n) {
|
|
|
37191
37191
|
case 0:
|
|
37192
37192
|
return `${n + 1}.`;
|
|
37193
37193
|
case 1:
|
|
37194
|
-
return `${
|
|
37194
|
+
return `${_chunkB5M676H3cjs.hangulOrdinal.call(void 0, n)}.`;
|
|
37195
37195
|
case 2:
|
|
37196
37196
|
return `${n + 1})`;
|
|
37197
37197
|
case 3:
|
|
37198
|
-
return `${
|
|
37198
|
+
return `${_chunkB5M676H3cjs.hangulOrdinal.call(void 0, n)})`;
|
|
37199
37199
|
case 4:
|
|
37200
37200
|
return `(${n + 1})`;
|
|
37201
37201
|
case 5:
|
|
37202
|
-
return `(${
|
|
37202
|
+
return `(${_chunkB5M676H3cjs.hangulOrdinal.call(void 0, n)})`;
|
|
37203
37203
|
case 6:
|
|
37204
|
-
return
|
|
37204
|
+
return _chunkB5M676H3cjs.circledNumber.call(void 0, n);
|
|
37205
37205
|
case 7:
|
|
37206
|
-
return
|
|
37206
|
+
return _chunkB5M676H3cjs.circledHangul.call(void 0, n);
|
|
37207
37207
|
default:
|
|
37208
|
-
return
|
|
37208
|
+
return _chunkB5M676H3cjs.circledHangul.call(void 0, n);
|
|
37209
37209
|
}
|
|
37210
37210
|
}
|
|
37211
37211
|
function reportMarker(depth, bullet2 = "\u25CB", asteriskThird = false) {
|
|
@@ -37859,7 +37859,7 @@ function parseInlineMarkdown(text) {
|
|
|
37859
37859
|
else spans.push(...emphasisSpans(m[0]));
|
|
37860
37860
|
} else {
|
|
37861
37861
|
const anchor = m[2] || m[3];
|
|
37862
|
-
const href = _nullishCoalesce(
|
|
37862
|
+
const href = _nullishCoalesce(_chunkOMGCVZ4Wcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
37863
37863
|
const sub = emphasisSpans(anchor);
|
|
37864
37864
|
if (href) for (const s of sub) s.href = href;
|
|
37865
37865
|
spans.push(...sub);
|
|
@@ -38080,7 +38080,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
38080
38080
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
38081
38081
|
const got = m ? Number(m[1]) : NaN;
|
|
38082
38082
|
if (got !== startId + i) {
|
|
38083
|
-
throw new (0,
|
|
38083
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(
|
|
38084
38084
|
`\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)`
|
|
38085
38085
|
);
|
|
38086
38086
|
}
|
|
@@ -38171,7 +38171,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
38171
38171
|
}
|
|
38172
38172
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
38173
38173
|
if (rows.length !== expectedBase) {
|
|
38174
|
-
throw new (0,
|
|
38174
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(
|
|
38175
38175
|
`\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`
|
|
38176
38176
|
);
|
|
38177
38177
|
}
|
|
@@ -38679,7 +38679,7 @@ function variantMapper(fit, blockIdx, base = CHAR_VARIANT_BASE) {
|
|
|
38679
38679
|
const vi = fit.variants.indexOf(r);
|
|
38680
38680
|
return (id) => id >= 0 && id <= 3 ? base + vi * 4 + id : id;
|
|
38681
38681
|
}
|
|
38682
|
-
var ORDINAL_SYLLABLES = new Set(Array.from({ length: 84 }, (_, i) =>
|
|
38682
|
+
var ORDINAL_SYLLABLES = new Set(Array.from({ length: 84 }, (_, i) => _chunkB5M676H3cjs.hangulOrdinal.call(void 0, i)));
|
|
38683
38683
|
function literalMarkerDepth(text) {
|
|
38684
38684
|
const t = text.trimStart();
|
|
38685
38685
|
let m;
|
|
@@ -39180,7 +39180,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
39180
39180
|
return best;
|
|
39181
39181
|
}
|
|
39182
39182
|
function normForMatch(text) {
|
|
39183
|
-
return
|
|
39183
|
+
return _chunkB5M676H3cjs.sanitizeText.call(void 0, text.replace(/\\\$/g, "$").replace(/\\(?=<\/?(?:u|sup|sub)>)/g, "")).replace(/\s+/g, " ").trim();
|
|
39184
39184
|
}
|
|
39185
39185
|
function unescapeGfm(text) {
|
|
39186
39186
|
return text.replace(/\\([~*_`|#<$\\])/g, "$1");
|
|
@@ -39202,7 +39202,7 @@ function replicateGfmTable(table2) {
|
|
|
39202
39202
|
const cell2 = _optionalChain([cells, 'access', _638 => _638[r], 'optionalAccess', _639 => _639[c]]);
|
|
39203
39203
|
if (!cell2) continue;
|
|
39204
39204
|
display[r][c] = {
|
|
39205
|
-
text:
|
|
39205
|
+
text: _chunkB5M676H3cjs.escapeGfm.call(void 0, _chunkB5M676H3cjs.sanitizeText.call(void 0, cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\r\n|\r|\n/g, "<br>"),
|
|
39206
39206
|
gridR: r,
|
|
39207
39207
|
gridC: c
|
|
39208
39208
|
};
|
|
@@ -39242,16 +39242,16 @@ function replicateCellInnerHtml(cell2) {
|
|
|
39242
39242
|
if (_optionalChain([cell2, 'access', _640 => _640.blocks, 'optionalAccess', _641 => _641.length])) {
|
|
39243
39243
|
return cell2.blocks.map((b) => {
|
|
39244
39244
|
if (b.type === "table" && b.table) {
|
|
39245
|
-
const cap = b.table.caption ?
|
|
39246
|
-
return (cap ?
|
|
39245
|
+
const cap = b.table.caption ? _chunkB5M676H3cjs.sanitizeText.call(void 0, b.table.caption) : "";
|
|
39246
|
+
return (cap ? _chunkB5M676H3cjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
39247
39247
|
}
|
|
39248
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
39249
|
-
const note =
|
|
39250
|
-
const t = (
|
|
39251
|
-
return ((t ?
|
|
39248
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkOMGCVZ4Wcjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
39249
|
+
const note = _chunkB5M676H3cjs.noteTableHtml.call(void 0, b);
|
|
39250
|
+
const t = (_chunkB5M676H3cjs.sanitizeText.call(void 0, _chunkB5M676H3cjs.visibleText.call(void 0, b)) + (note ? "" : _chunkB5M676H3cjs.noteSuffix.call(void 0, b))).trim();
|
|
39251
|
+
return ((t ? _chunkB5M676H3cjs.escapeHtmlCellText.call(void 0, t).replace(/\n/g, "<br>") : "") + note).trim();
|
|
39252
39252
|
}).filter(Boolean).join("<br>");
|
|
39253
39253
|
}
|
|
39254
|
-
return
|
|
39254
|
+
return _chunkB5M676H3cjs.escapeHtmlCellText.call(void 0, _chunkB5M676H3cjs.sanitizeText.call(void 0, cell2.text)).replace(/\n/g, "<br>");
|
|
39255
39255
|
}
|
|
39256
39256
|
function replicateTableToHtml(table2) {
|
|
39257
39257
|
const rows = replicateHtmlTable(table2);
|
|
@@ -39328,7 +39328,7 @@ function parseHtmlTable(raw) {
|
|
|
39328
39328
|
const cs = parseInt(_optionalChain([attrs, 'access', _644 => _644.match, 'call', _645 => _645(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _646 => _646[1]]) || "1", 10);
|
|
39329
39329
|
const rs = parseInt(_optionalChain([attrs, 'access', _647 => _647.match, 'call', _648 => _648(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _649 => _649[1]]) || "1", 10);
|
|
39330
39330
|
cellStart = m.index + m[0].length;
|
|
39331
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
39331
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkB5M676H3cjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkB5M676H3cjs.MAX_ROWS) };
|
|
39332
39332
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
39333
39333
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
39334
39334
|
cellStart = -1;
|
|
@@ -39353,11 +39353,11 @@ function htmlCellInnerToLines(inner) {
|
|
|
39353
39353
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
39354
39354
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
39355
39355
|
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _650 => _650[1]]), () => ( _optionalChain([m, 'optionalAccess', _651 => _651[2]])));
|
|
39356
|
-
if (src) imgSrcs.push(
|
|
39356
|
+
if (src) imgSrcs.push(_chunkOMGCVZ4Wcjs.unescapeHtml.call(void 0, src));
|
|
39357
39357
|
return "";
|
|
39358
39358
|
});
|
|
39359
39359
|
}
|
|
39360
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
39360
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkOMGCVZ4Wcjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
39361
39361
|
return { lines, hadNonText, imgSrcs };
|
|
39362
39362
|
}
|
|
39363
39363
|
function splitCellByTopLevelTables(html) {
|
|
@@ -40188,8 +40188,8 @@ function layoutHtmlRows(rows) {
|
|
|
40188
40188
|
let c = 0;
|
|
40189
40189
|
for (const cell2 of rows[r].cells) {
|
|
40190
40190
|
while (occupied.has(`${r},${c}`)) c++;
|
|
40191
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
40192
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
40191
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkB5M676H3cjs.MAX_COLS);
|
|
40192
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkB5M676H3cjs.MAX_ROWS);
|
|
40193
40193
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
40194
40194
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
40195
40195
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -41660,7 +41660,7 @@ function buildMinistryItemBand(n, text, ctx, before2) {
|
|
|
41660
41660
|
const base = { font: MINISTRY.bandFont, pt: s.pt, bold: false };
|
|
41661
41661
|
const f = fitOneLine(plain(text), MINISTRY.bandFont, s.pt, w - 1800, s.pt);
|
|
41662
41662
|
const styled = f.overflow || f.ratio === 100 && f.spacing === 0 ? base : { ...base, ratio: f.ratio, spacing: f.spacing };
|
|
41663
|
-
const runs = ministryRuns(
|
|
41663
|
+
const runs = ministryRuns(_chunkB5M676H3cjs.circledNumber.call(void 0, n - 1), text, ctx, styled, MINISTRY.blue, MINISTRY.blue);
|
|
41664
41664
|
const p = reg.para({ align: "LEFT", lineSp: 130, left: 300 });
|
|
41665
41665
|
const cell2 = tc({ bf: band, row: 0, col: 0, w, h: s.h, paras: `<hp:p paraPrIDRef="${p}" styleIDRef="0">${runs}</hp:p>`, name: "__kordoc_h5" });
|
|
41666
41666
|
return host(ftbl([cell2], w, s.h, 1, { bottomGap: 700 }), reg.para({ align: "LEFT", lineSp: 100, before: before2, keepWithNext: true }), reg.char(base));
|
|
@@ -42994,37 +42994,37 @@ async function readText(zip, name, budget) {
|
|
|
42994
42994
|
return s;
|
|
42995
42995
|
}
|
|
42996
42996
|
function assertWellFormed(xml, name) {
|
|
42997
|
-
if (xml.length > MAX_XML) throw new (0,
|
|
42998
|
-
if (/<!DOCTYPE/i.test(xml)) throw new (0,
|
|
42997
|
+
if (xml.length > MAX_XML) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uACAC\uBCF8 ${name} \uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${(xml.length / 1048576).toFixed(1)}MB)`);
|
|
42998
|
+
if (/<!DOCTYPE/i.test(xml)) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uACAC\uBCF8 ${name} \uC5D0 DOCTYPE \uC774 \uC788\uC2B5\uB2C8\uB2E4 \u2014 \uD55C\uAE00 \uC800\uC7A5\uBCF8\uC774 \uC544\uB2D9\uB2C8\uB2E4`);
|
|
42999
42999
|
const issues = [];
|
|
43000
43000
|
createXmlParser(issues).parseFromString(xml, "text/xml");
|
|
43001
|
-
if (issues.some((w) => !/경고/.test(w.message))) throw new (0,
|
|
43001
|
+
if (issues.some((w) => !/경고/.test(w.message))) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uACAC\uBCF8 ${name} XML \uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4: ${issues[0].message}`);
|
|
43002
43002
|
}
|
|
43003
43003
|
async function loadTemplateZip(template) {
|
|
43004
43004
|
const buf = template instanceof Uint8Array ? template.buffer.slice(template.byteOffset, template.byteOffset + template.byteLength) : template;
|
|
43005
|
-
|
|
43005
|
+
_chunkOMGCVZ4Wcjs.precheckZipSize.call(void 0, buf, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
43006
43006
|
let zip;
|
|
43007
43007
|
try {
|
|
43008
43008
|
zip = await _jszip2.default.loadAsync(buf);
|
|
43009
43009
|
} catch (e40) {
|
|
43010
|
-
throw new (0,
|
|
43010
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uACAC\uBCF8\uC774 HWPX(zip)\uAC00 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uD55C\uAE00\uC5D0\uC11C .hwpx \uB85C \uC800\uC7A5\uD55C \uD30C\uC77C\uC744 \uC4F0\uC138\uC694 (.hwp \uB294 kordoc \uC73C\uB85C \uBA3C\uC800 \uBCC0\uD658)");
|
|
43011
43011
|
}
|
|
43012
43012
|
const names = Object.keys(zip.files);
|
|
43013
|
-
if (names.length > MAX_ZIP_ENTRIES) throw new (0,
|
|
43013
|
+
if (names.length > MAX_ZIP_ENTRIES) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uACAC\uBCF8 ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
43014
43014
|
const bad = names.find((n) => n.split("/").includes("..") || n.startsWith("/") || n.includes("\\") || /^[A-Za-z]:/.test(n));
|
|
43015
|
-
if (bad) throw new (0,
|
|
43015
|
+
if (bad) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uACAC\uBCF8 ZIP \uC5D0 \uD5C8\uC6A9\uD558\uC9C0 \uC54A\uB294 \uACBD\uB85C\uAC00 \uC788\uC2B5\uB2C8\uB2E4: ${bad.slice(0, 80)}`);
|
|
43016
43016
|
const budget = { used: 0 };
|
|
43017
43017
|
const manifest = zip.file("META-INF/manifest.xml");
|
|
43018
43018
|
if (manifest && isEncryptedHwpx(await readText(zip, "META-INF/manifest.xml", budget))) {
|
|
43019
|
-
throw new (0,
|
|
43019
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uC554\uD638\uAC00 \uAC78\uB9B0 \uACAC\uBCF8\uC785\uB2C8\uB2E4 \u2014 \uD55C\uAE00\uC5D0\uC11C \uC554\uD638\uB97C \uD480\uACE0 \uC800\uC7A5\uD55C \uD30C\uC77C\uC744 \uC4F0\uC138\uC694");
|
|
43020
43020
|
}
|
|
43021
43021
|
const sections = await resolveSectionPaths(zip);
|
|
43022
43022
|
if (!sections.length || !zip.file(sections[0]) || !zip.file("Contents/header.xml")) {
|
|
43023
|
-
throw new (0,
|
|
43023
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uACAC\uBCF8 HWPX \uC5D0 Contents/header.xml \uB610\uB294 section0.xml \uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
43024
43024
|
}
|
|
43025
43025
|
const sectionXmls = [];
|
|
43026
43026
|
for (const [i, name] of sections.entries()) {
|
|
43027
|
-
if (!zip.file(name)) throw new (0,
|
|
43027
|
+
if (!zip.file(name)) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uACAC\uBCF8 HWPX \uC5D0 ${name} \uC774 \uC5C6\uC2B5\uB2C8\uB2E4`);
|
|
43028
43028
|
const xml = await readText(zip, name, budget);
|
|
43029
43029
|
if (i === 0) assertWellFormed(xml, name);
|
|
43030
43030
|
else try {
|
|
@@ -43195,7 +43195,7 @@ var FAMILY_ROLE = {
|
|
|
43195
43195
|
var SYM_EXTRA = /^(?:\p{S}|[【〔〈《])$/u;
|
|
43196
43196
|
var SUBTITLE_RE = /^-\s.*\s-$/u;
|
|
43197
43197
|
function lineRole(plain4) {
|
|
43198
|
-
const t =
|
|
43198
|
+
const t = _chunkB5M676H3cjs.mapPuaText.call(void 0, plain4.replace(/^[\s ]+/, ""));
|
|
43199
43199
|
if (!t || SUBTITLE_RE.test(t.trim())) return null;
|
|
43200
43200
|
const cls = markerClass(t);
|
|
43201
43201
|
if (FAMILY_ROLE[cls]) return FAMILY_ROLE[cls];
|
|
@@ -43230,7 +43230,7 @@ function fillParagraph(pXml, text, opts = {}) {
|
|
|
43230
43230
|
let prefixLen = ws, mStart = -1, mLen = 0;
|
|
43231
43231
|
if (opts.marker && ws < plain4.length) {
|
|
43232
43232
|
const cp = String.fromCodePoint(plain4.codePointAt(ws));
|
|
43233
|
-
if (isMarkerChar(
|
|
43233
|
+
if (isMarkerChar(_chunkB5M676H3cjs.mapPuaText.call(void 0, cp))) {
|
|
43234
43234
|
mStart = ws;
|
|
43235
43235
|
mLen = cp.length;
|
|
43236
43236
|
prefixLen = ws + mLen + /^[\s ]*/.exec(plain4.slice(ws + mLen))[0].length;
|
|
@@ -43402,7 +43402,7 @@ function styleKey(xml, m) {
|
|
|
43402
43402
|
const plain4 = paraPlain(m);
|
|
43403
43403
|
let prefix = /^[\s ]*/.exec(plain4)[0].length;
|
|
43404
43404
|
const cp = plain4.codePointAt(prefix);
|
|
43405
|
-
if (cp !== void 0 && isMarkerChar(
|
|
43405
|
+
if (cp !== void 0 && isMarkerChar(_chunkB5M676H3cjs.mapPuaText.call(void 0, String.fromCodePoint(cp)))) prefix += String.fromCodePoint(cp).length + /^[\s ]*/.exec(plain4.slice(prefix + String.fromCodePoint(cp).length))[0].length;
|
|
43406
43406
|
let best = "", bestN = 0, pos = 0;
|
|
43407
43407
|
for (const r of m.runs) {
|
|
43408
43408
|
let n = 0;
|
|
@@ -43499,7 +43499,7 @@ function scanTemplate(sectionXml, headerXml) {
|
|
|
43499
43499
|
contactInTitle = !!t && t.cells.some(isContactCell);
|
|
43500
43500
|
headBox = !!t && t.cells.some(isHeadBox);
|
|
43501
43501
|
}
|
|
43502
|
-
const subIdx = _nullishCoalesce(_optionalChain([head, 'access', _833 => _833.find, 'call', _834 => _834(({ x, i }) => i !== titleIdx && !x.tbl && x.objs === 0 && SUBTITLE_RE.test(
|
|
43502
|
+
const subIdx = _nullishCoalesce(_optionalChain([head, 'access', _833 => _833.find, 'call', _834 => _834(({ x, i }) => i !== titleIdx && !x.tbl && x.objs === 0 && SUBTITLE_RE.test(_chunkB5M676H3cjs.mapPuaText.call(void 0, x.plain.trim()))), 'optionalAccess', _835 => _835.i]), () => ( -1));
|
|
43503
43503
|
if (subIdx >= 0) set("subtitle", subIdx);
|
|
43504
43504
|
const summaryIdx = _nullishCoalesce(_optionalChain([head, 'access', _836 => _836.find, 'call', _837 => _837(({ x, i }) => i > titleIdx && _optionalChain([x, 'access', _838 => _838.tbl, 'optionalAccess', _839 => _839.rowCnt]) === 1 && x.tbl.colCnt === 1 && !CONTACT_RE.test(_nullishCoalesce(_optionalChain([x, 'access', _840 => _840.tbl, 'access', _841 => _841.cells, 'access', _842 => _842[0], 'optionalAccess', _843 => _843.text]), () => ( ""))) && !isTocBox(infos, i)), 'optionalAccess', _844 => _844.i]), () => ( -1));
|
|
43505
43505
|
if (summaryIdx >= 0) set("summary", summaryIdx);
|
|
@@ -44155,7 +44155,7 @@ async function markdownToHwpxFromTemplate(markdown, template, warnings = [], tot
|
|
|
44155
44155
|
let nextId = 1 + maxOf2(objIds);
|
|
44156
44156
|
let z = 1 + maxOf2([...scan.head.matchAll(OBJ_TAG_RE)].map((m) => Number(_nullishCoalesce(_optionalChain([/\bzOrder="(\d{1,10})"/, 'access', _951 => _951.exec, 'call', _952 => _952(m[0]), 'optionalAccess', _953 => _953[1]]), () => ( -1)))), -1);
|
|
44157
44157
|
const body = paras.join("").replace(OBJ_TAG_RE, (tag) => tag.replace(/\bid="\d*"/, () => `id="${nextId++}"`).replace(/\binstid="\d*"/, () => `instid="${nextId++}"`).replace(/\bzOrder="-?\d+"/, () => `zOrder="${z++}"`));
|
|
44158
|
-
if (body.length > MAX_OUTPUT) throw new (0,
|
|
44158
|
+
if (body.length > MAX_OUTPUT) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uC0DD\uC131 \uBCF8\uBB38\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${(body.length / 1048576).toFixed(1)}MB) \u2014 \uC6D0\uACE0\uB97C \uB098\uB220 \uB9CC\uB4DC\uC138\uC694`);
|
|
44159
44159
|
const tops = topLevelParagraphs(sectionXml);
|
|
44160
44160
|
const newSection = sectionXml.slice(0, _nullishCoalesce(_optionalChain([tops, 'access', _954 => _954[0], 'optionalAccess', _955 => _955.start]), () => ( sectionXml.lastIndexOf("</")))) + body + sectionXml.slice(_nullishCoalesce(_optionalChain([tops, 'access', _956 => _956.at, 'call', _957 => _957(-1), 'optionalAccess', _958 => _958.end]), () => ( sectionXml.lastIndexOf("</"))));
|
|
44161
44161
|
let newHeader = appendHeader(ctx);
|
|
@@ -44470,7 +44470,7 @@ function builtinTemplateDir() {
|
|
|
44470
44470
|
for (const c of candidates) {
|
|
44471
44471
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
44472
44472
|
}
|
|
44473
|
-
throw new (0,
|
|
44473
|
+
throw new (0, _chunkOMGCVZ4Wcjs.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)");
|
|
44474
44474
|
}
|
|
44475
44475
|
function readBuiltinTemplate(t) {
|
|
44476
44476
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -44949,12 +44949,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
44949
44949
|
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>`;
|
|
44950
44950
|
}
|
|
44951
44951
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
44952
|
-
if (ops.length === 0) throw new (0,
|
|
44952
|
+
if (ops.length === 0) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
44953
44953
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
44954
|
-
|
|
44954
|
+
_chunkOMGCVZ4Wcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
44955
44955
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
44956
44956
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _1099 => _1099.match, 'call', _1100 => _1100(/(\d+)\.xml$/i), 'optionalAccess', _1101 => _1101[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _1102 => _1102.match, 'call', _1103 => _1103(/(\d+)\.xml$/i), 'optionalAccess', _1104 => _1104[1]]), () => ( 0))));
|
|
44957
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
44957
|
+
if (sectionPaths.length === 0) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
44958
44958
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
44959
44959
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
44960
44960
|
const styles = headerPath ? parseRenderStyles(await readZipEntry(zip.file(headerPath), "text")) : null;
|
|
@@ -44995,11 +44995,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
44995
44995
|
const manifestItems = [];
|
|
44996
44996
|
const placed = [];
|
|
44997
44997
|
for (const op of ops) {
|
|
44998
|
-
if (!op.anchor) throw new (0,
|
|
44999
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
44998
|
+
if (!op.anchor) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
44999
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
45000
45000
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
45001
|
-
if (!MIME[ext]) throw new (0,
|
|
45002
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
45001
|
+
if (!MIME[ext]) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
45002
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkOMGCVZ4Wcjs.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)`);
|
|
45003
45003
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
45004
45004
|
let found = null;
|
|
45005
45005
|
let total = 0;
|
|
@@ -45032,7 +45032,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
45032
45032
|
}
|
|
45033
45033
|
}
|
|
45034
45034
|
}
|
|
45035
|
-
throw new (0,
|
|
45035
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(
|
|
45036
45036
|
`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)})`
|
|
45037
45037
|
);
|
|
45038
45038
|
}
|
|
@@ -45040,7 +45040,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
45040
45040
|
const xml = sectionXmls[si];
|
|
45041
45041
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
45042
45042
|
if (!run) {
|
|
45043
|
-
throw new (0,
|
|
45043
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
45044
45044
|
}
|
|
45045
45045
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _1105 => _1105.charPr, 'access', _1106 => _1106.get, 'call', _1107 => _1107(run.charPr), 'optionalAccess', _1108 => _1108.height]), () => ( 1e3));
|
|
45046
45046
|
const fontPt = charPrHeight / 100;
|
|
@@ -45154,7 +45154,7 @@ function protoStyle(xml, ix) {
|
|
|
45154
45154
|
const plain4 = paraPlain(model);
|
|
45155
45155
|
let prefix = /^[\s ]*/.exec(plain4)[0].length;
|
|
45156
45156
|
const cp = plain4.codePointAt(prefix);
|
|
45157
|
-
if (cp !== void 0 && isMarkerChar(
|
|
45157
|
+
if (cp !== void 0 && isMarkerChar(_chunkB5M676H3cjs.mapPuaText.call(void 0, String.fromCodePoint(cp)))) {
|
|
45158
45158
|
prefix += String.fromCodePoint(cp).length;
|
|
45159
45159
|
prefix += /^[\s ]*/.exec(plain4.slice(prefix))[0].length;
|
|
45160
45160
|
}
|
|
@@ -45586,19 +45586,19 @@ function guideFor(name, manifest) {
|
|
|
45586
45586
|
}
|
|
45587
45587
|
async function buildAgencyPack(name, samples, into) {
|
|
45588
45588
|
const trimmed = name.trim();
|
|
45589
|
-
if (!trimmed || trimmed.length > 60) throw new (0,
|
|
45590
|
-
if (!samples.length) throw new (0,
|
|
45589
|
+
if (!trimmed || trimmed.length > 60) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("pack: \uAE30\uAD00 \uC774\uB984(1~60\uC790)\uC774 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
45590
|
+
if (!samples.length) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("pack: \uACAC\uBCF8 HWPX \uAC00 \uD55C \uAC74 \uC774\uC0C1 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
45591
45591
|
const byKind = /* @__PURE__ */ new Map();
|
|
45592
45592
|
for (const s of samples) {
|
|
45593
45593
|
const kind = _nullishCoalesce(s.kind, () => ( "report"));
|
|
45594
|
-
if (!KIND_RE.test(kind)) throw new (0,
|
|
45594
|
+
if (!KIND_RE.test(kind)) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`pack: \uBB38\uC11C \uC885\uB958 \uC774\uB984 "${kind}" \u2014 \uC601\uBB38 \uC18C\uBB38\uC790\xB7\uC22B\uC790\xB7\uD55C\uAE00\xB7\uBD99\uC784\uD45C 1~20\uC790`);
|
|
45595
45595
|
byKind.set(kind, [..._nullishCoalesce(byKind.get(kind), () => ( [])), s.data]);
|
|
45596
45596
|
}
|
|
45597
45597
|
const manifest = {
|
|
45598
45598
|
kordocPack: PACK_FORMAT,
|
|
45599
45599
|
name: trimmed,
|
|
45600
45600
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
45601
|
-
kordocVersion:
|
|
45601
|
+
kordocVersion: _chunkOMGCVZ4Wcjs.VERSION,
|
|
45602
45602
|
kinds: { ..._nullishCoalesce(_optionalChain([into, 'optionalAccess', _1163 => _1163.manifest, 'access', _1164 => _1164.kinds]), () => ( {})) },
|
|
45603
45603
|
sources: (_nullishCoalesce(_optionalChain([into, 'optionalAccess', _1165 => _1165.manifest, 'access', _1166 => _1166.sources]), () => ( []))).filter((s) => !byKind.has(s.kind))
|
|
45604
45604
|
};
|
|
@@ -45609,7 +45609,7 @@ async function buildAgencyPack(name, samples, into) {
|
|
|
45609
45609
|
try {
|
|
45610
45610
|
sigs.push(await templateRoleStyles(data));
|
|
45611
45611
|
} catch (e) {
|
|
45612
|
-
throw new (0,
|
|
45612
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`pack: ${kind} \uACAC\uBCF8 ${i + 1}\uBC88\uC9F8\uB97C \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4 \u2014 ${e instanceof Error ? e.message : String(e)}`);
|
|
45613
45613
|
}
|
|
45614
45614
|
}
|
|
45615
45615
|
const pick2 = chooseRepresentative(sigs);
|
|
@@ -45667,7 +45667,7 @@ async function buildAgencyPack(name, samples, into) {
|
|
|
45667
45667
|
templates.set(kind, scrub.data);
|
|
45668
45668
|
for (const data of list) manifest.sources.push({ kind, sha256: _crypto.createHash.call(void 0, "sha256").update(data).digest("hex") });
|
|
45669
45669
|
}
|
|
45670
|
-
if (Object.keys(manifest.kinds).length > MAX_KINDS) throw new (0,
|
|
45670
|
+
if (Object.keys(manifest.kinds).length > MAX_KINDS) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`pack: \uBB38\uC11C \uC885\uB958\uB294 ${MAX_KINDS}\uAC1C\uAE4C\uC9C0`);
|
|
45671
45671
|
const guide = guideFor(trimmed, manifest);
|
|
45672
45672
|
const zip = new (0, _jszip2.default)();
|
|
45673
45673
|
zip.file("pack.json", JSON.stringify(manifest, null, 2));
|
|
@@ -45677,19 +45677,19 @@ async function buildAgencyPack(name, samples, into) {
|
|
|
45677
45677
|
}
|
|
45678
45678
|
async function loadAgencyPack(data) {
|
|
45679
45679
|
const buf = data instanceof Uint8Array ? data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength) : data;
|
|
45680
|
-
if (buf.byteLength > MAX_PACK_BYTES) throw new (0,
|
|
45681
|
-
|
|
45680
|
+
if (buf.byteLength > MAX_PACK_BYTES) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("pack: \uD329 \uD30C\uC77C\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4");
|
|
45681
|
+
_chunkOMGCVZ4Wcjs.precheckZipSize.call(void 0, buf, MAX_DECOMPRESS_SIZE, 64);
|
|
45682
45682
|
let zip;
|
|
45683
45683
|
try {
|
|
45684
45684
|
zip = await _jszip2.default.loadAsync(buf);
|
|
45685
45685
|
} catch (e45) {
|
|
45686
|
-
throw new (0,
|
|
45686
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("pack: \uAE30\uAD00\uD329(.kpack, zip)\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
45687
45687
|
}
|
|
45688
45688
|
const names = Object.keys(zip.files).filter((n) => !zip.files[n].dir);
|
|
45689
45689
|
const allowed = (n) => n === "pack.json" || n === "guide.md" || /^kinds\/[a-z0-9\-가-힣]{1,20}\.hwpx$/u.test(n);
|
|
45690
45690
|
const bad = names.find((n) => !allowed(n));
|
|
45691
|
-
if (bad) throw new (0,
|
|
45692
|
-
if (!zip.file("pack.json")) throw new (0,
|
|
45691
|
+
if (bad) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`pack: \uD329\uC5D0 \uD5C8\uC6A9\uD558\uC9C0 \uC54A\uB294 \uD30C\uC77C\uC774 \uC788\uC2B5\uB2C8\uB2E4: ${bad.slice(0, 80)} (pack.json\xB7guide.md\xB7kinds/*.hwpx \uB9CC)`);
|
|
45692
|
+
if (!zip.file("pack.json")) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("pack: pack.json \uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
45693
45693
|
let used = 0;
|
|
45694
45694
|
const text = async (n) => {
|
|
45695
45695
|
const s = await readZipEntry(zip.file(n), "text", used);
|
|
@@ -45700,24 +45700,24 @@ async function loadAgencyPack(data) {
|
|
|
45700
45700
|
try {
|
|
45701
45701
|
manifest = JSON.parse(await text("pack.json"));
|
|
45702
45702
|
} catch (e46) {
|
|
45703
|
-
throw new (0,
|
|
45703
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("pack: pack.json \uC774 \uC62C\uBC14\uB978 JSON \uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
45704
45704
|
}
|
|
45705
|
-
if (_optionalChain([manifest, 'optionalAccess', _1168 => _1168.kordocPack]) !== PACK_FORMAT) throw new (0,
|
|
45706
|
-
if (typeof manifest.name !== "string" || !manifest.kinds || typeof manifest.kinds !== "object") throw new (0,
|
|
45705
|
+
if (_optionalChain([manifest, 'optionalAccess', _1168 => _1168.kordocPack]) !== PACK_FORMAT) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`pack: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD329 \uD615\uC2DD \uD310 ${String(_optionalChain([manifest, 'optionalAccess', _1169 => _1169.kordocPack]))} \u2014 \uC774 kordoc \uC740 ${PACK_FORMAT}\uD310\uC744 \uC77D\uC2B5\uB2C8\uB2E4`);
|
|
45706
|
+
if (typeof manifest.name !== "string" || !manifest.kinds || typeof manifest.kinds !== "object") throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("pack: pack.json \uC5D0 name\xB7kinds \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
45707
45707
|
const templates = /* @__PURE__ */ new Map();
|
|
45708
45708
|
for (const [kind, info] of Object.entries(manifest.kinds)) {
|
|
45709
|
-
if (!KIND_RE.test(kind) || _optionalChain([info, 'optionalAccess', _1170 => _1170.template]) !== `kinds/${kind}.hwpx` || !zip.file(info.template)) throw new (0,
|
|
45709
|
+
if (!KIND_RE.test(kind) || _optionalChain([info, 'optionalAccess', _1170 => _1170.template]) !== `kinds/${kind}.hwpx` || !zip.file(info.template)) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`pack: \uC885\uB958 ${kind.slice(0, 20)} \uC758 \uACAC\uBCF8\uC774 \uC5C6\uC2B5\uB2C8\uB2E4`);
|
|
45710
45710
|
const bytes = await readZipEntry(zip.file(info.template), "uint8array", used);
|
|
45711
45711
|
used += bytes.length;
|
|
45712
45712
|
templates.set(kind, bytes);
|
|
45713
45713
|
}
|
|
45714
|
-
if (!templates.size) throw new (0,
|
|
45714
|
+
if (!templates.size) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("pack: \uBB38\uC11C \uC885\uB958\uAC00 \uD558\uB098\uB3C4 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
45715
45715
|
return { manifest, templates, guide: zip.file("guide.md") ? await text("guide.md") : "" };
|
|
45716
45716
|
}
|
|
45717
45717
|
function resolvePackKind(pack, kind) {
|
|
45718
45718
|
const kinds = [...pack.templates.keys()];
|
|
45719
45719
|
const k = _nullishCoalesce(kind, () => ( (kinds.length === 1 ? kinds[0] : "report")));
|
|
45720
|
-
if (!pack.templates.has(k)) throw new (0,
|
|
45720
|
+
if (!pack.templates.has(k)) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`pack: ${pack.manifest.name} \uD329\uC5D0 '${k}' \uC885\uB958\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 ${kinds.join("\xB7")} \uC911\uC5D0\uC11C \uACE0\uB974\uC138\uC694`);
|
|
45721
45721
|
return k;
|
|
45722
45722
|
}
|
|
45723
45723
|
function packTemplate(pack, kind) {
|
|
@@ -45943,7 +45943,7 @@ function pick(map, keys) {
|
|
|
45943
45943
|
return out;
|
|
45944
45944
|
}
|
|
45945
45945
|
async function hwpxToProfile(input) {
|
|
45946
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
45946
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkOMGCVZ4Wcjs.toArrayBuffer.call(void 0, input);
|
|
45947
45947
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
45948
45948
|
const parser = createXmlParser();
|
|
45949
45949
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _1194 => _1194.file, 'call', _1195 => _1195(/[Hh]eader\.xml$/), 'optionalAccess', _1196 => _1196[0]])));
|
|
@@ -46280,7 +46280,7 @@ function moneyHangulCheck(m) {
|
|
|
46280
46280
|
const n = Number(m[1].replace(/,/g, ""));
|
|
46281
46281
|
const h = hangulToNumber(m[2].replace(/\s/g, ""));
|
|
46282
46282
|
if (!Number.isFinite(n) || h === null || h === n) return null;
|
|
46283
|
-
return `\uAE08${m[1]}\uC6D0(\uAE08${
|
|
46283
|
+
return `\uAE08${m[1]}\uC6D0(\uAE08${_chunkB5M676H3cjs.hangulAmount.call(void 0, n)}\uC6D0)`;
|
|
46284
46284
|
}
|
|
46285
46285
|
var RULES = [
|
|
46286
46286
|
// 날짜 ─ 온점 뒤 한 칸, 0 패딩 금지, 연도 4자리, 끝 마침표
|
|
@@ -46584,7 +46584,7 @@ function lintGongmunText(text, opts) {
|
|
|
46584
46584
|
}
|
|
46585
46585
|
function dictSuggest(code, match) {
|
|
46586
46586
|
const m = match.trim();
|
|
46587
|
-
if (code === "MONEY_NO_HANGUL") return `${m} \u2192 ${m}(\uAE08${
|
|
46587
|
+
if (code === "MONEY_NO_HANGUL") return `${m} \u2192 ${m}(\uAE08${_chunkB5M676H3cjs.hangulAmount.call(void 0, m)}\uC6D0)`;
|
|
46588
46588
|
if (code === "DATE_HYPHEN") {
|
|
46589
46589
|
const d = m.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
|
|
46590
46590
|
if (d) return `${m} \u2192 ${d[1]}. ${Number(d[2])}. ${Number(d[3])}.`;
|
|
@@ -47902,7 +47902,7 @@ function patchTableRows(input) {
|
|
|
47902
47902
|
const cells = input.editedCells(ins.ei);
|
|
47903
47903
|
if (!cells) return skip("\uC0BD\uC785 \uD589\uC5D0 \uC774\uBBF8\uC9C0/\uC911\uCCA9\uD45C \uD3EC\uD568 \u2014 \uD589 \uCD94\uAC00 \uBBF8\uC9C0\uC6D0");
|
|
47904
47904
|
for (const cell2 of cells) {
|
|
47905
|
-
const unstable = cell2.lines.find((l) =>
|
|
47905
|
+
const unstable = cell2.lines.find((l) => _chunkB5M676H3cjs.sanitizeText.call(void 0, l) !== l);
|
|
47906
47906
|
if (unstable !== void 0) return skip("\uC0BD\uC785 \uD589\uC5D0 \uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
47907
47907
|
}
|
|
47908
47908
|
const tmplCells = scanTable.rows[template];
|
|
@@ -48151,14 +48151,14 @@ function buildEmbeddedLineSplices(para2, xml, newLines) {
|
|
|
48151
48151
|
}
|
|
48152
48152
|
if (text !== para2.text || !/[\r\n]/.test(text) || /<br\s*\/?\s*>/i.test(text)) return null;
|
|
48153
48153
|
const lines = text.split(/\r\n|\r|\n/);
|
|
48154
|
-
if (lines.length !== newLines.length || lines.some((line) => !line.trim() ||
|
|
48154
|
+
if (lines.length !== newLines.length || lines.some((line) => !line.trim() || _chunkB5M676H3cjs.sanitizeText.call(void 0, line) !== line.trim())) return null;
|
|
48155
48155
|
const splices = [];
|
|
48156
48156
|
let offset = 0;
|
|
48157
48157
|
for (let i = 0; i < lines.length; i++) {
|
|
48158
48158
|
const line = lines[i];
|
|
48159
48159
|
const orig = line.trim();
|
|
48160
48160
|
const next = newLines[i];
|
|
48161
|
-
if (
|
|
48161
|
+
if (_chunkB5M676H3cjs.sanitizeText.call(void 0, next) !== next || /[\r\n]/.test(next) || /[\uD800-\uDFFF]/u.test(next) || decodeXmlEntities(escapeXmlText(next)) !== next) return null;
|
|
48162
48162
|
let prefix = 0;
|
|
48163
48163
|
while (prefix < orig.length && prefix < next.length && orig[prefix] === next[prefix]) prefix++;
|
|
48164
48164
|
if (prefix > 0 && /[\uD800-\uDBFF]/.test(orig[prefix - 1]) && /[\uDC00-\uDFFF]/.test(_nullishCoalesce(orig[prefix], () => ( "")))) prefix--;
|
|
@@ -48395,12 +48395,12 @@ function stripCellTokens(text) {
|
|
|
48395
48395
|
}
|
|
48396
48396
|
function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
48397
48397
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
48398
|
-
const content =
|
|
48398
|
+
const content = _chunkB5M676H3cjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
48399
48399
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
48400
48400
|
const t = line.trim();
|
|
48401
48401
|
if (!t) return "";
|
|
48402
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
48403
|
-
return
|
|
48402
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkB5M676H3cjs.escapeGfm.call(void 0, t)}**`;
|
|
48403
|
+
return _chunkB5M676H3cjs.escapeGfm.call(void 0, t);
|
|
48404
48404
|
}).filter(Boolean);
|
|
48405
48405
|
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");
|
|
48406
48406
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -48414,7 +48414,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
48414
48414
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
48415
48415
|
const replica = [];
|
|
48416
48416
|
for (let r = 0; r < table2.rows; r++) {
|
|
48417
|
-
const line =
|
|
48417
|
+
const line = _chunkB5M676H3cjs.escapeGfm.call(void 0, _chunkB5M676H3cjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
48418
48418
|
if (line) replica.push({ line, gridR: r });
|
|
48419
48419
|
}
|
|
48420
48420
|
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");
|
|
@@ -48468,7 +48468,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
48468
48468
|
}
|
|
48469
48469
|
const splices = [];
|
|
48470
48470
|
let sectionIndex = -1;
|
|
48471
|
-
const unstable = newLines.find((l) =>
|
|
48471
|
+
const unstable = newLines.find((l) => _chunkB5M676H3cjs.sanitizeText.call(void 0, l) !== l);
|
|
48472
48472
|
if (unstable !== void 0) return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
48473
48473
|
if (ctx.structure && newLines.length > Math.max(nonEmpty.length, 1) || ctx.structure && nonEmpty.length > 1 && newLines.length < nonEmpty.length) {
|
|
48474
48474
|
const done = restructureCellLines(cell2.paragraphs, newLines, ctx.scans, ctx.sectionSplices, normForMatch);
|
|
@@ -48535,7 +48535,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
48535
48535
|
const paths = parseSectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
48536
48536
|
if (paths.length > 0) return paths;
|
|
48537
48537
|
}
|
|
48538
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
48538
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkOMGCVZ4Wcjs.compareSectionPaths);
|
|
48539
48539
|
}
|
|
48540
48540
|
|
|
48541
48541
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -49331,7 +49331,7 @@ function patchParagraph(block, orig, edited, ctx, skip) {
|
|
|
49331
49331
|
}
|
|
49332
49332
|
const origPlain = block.text != null ? block.text : restoreBr(textUnitToPlain(orig.raw, block));
|
|
49333
49333
|
if (newPlain === origPlain) return skip("\uD14D\uC2A4\uD2B8 \uC678 \uBCC0\uACBD(\uD5E4\uB529 \uB808\uBCA8/\uC11C\uC2DD)\uB9CC \uAC10\uC9C0 \u2014 \uC2A4\uD0C0\uC77C \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
49334
|
-
if (
|
|
49334
|
+
if (_chunkB5M676H3cjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
49335
49335
|
return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
49336
49336
|
}
|
|
49337
49337
|
let origMd = restoreBr(textUnitToPlain(orig.raw, block));
|
|
@@ -49378,7 +49378,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
49378
49378
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
49379
49379
|
continue;
|
|
49380
49380
|
}
|
|
49381
|
-
if (afterEach.some((l) =>
|
|
49381
|
+
if (afterEach.some((l) => _chunkB5M676H3cjs.sanitizeText.call(void 0, l) !== l)) {
|
|
49382
49382
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
49383
49383
|
continue;
|
|
49384
49384
|
}
|
|
@@ -49406,7 +49406,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
49406
49406
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
49407
49407
|
break;
|
|
49408
49408
|
}
|
|
49409
|
-
if (
|
|
49409
|
+
if (_chunkB5M676H3cjs.sanitizeText.call(void 0, after2) !== after2) {
|
|
49410
49410
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
49411
49411
|
break;
|
|
49412
49412
|
}
|
|
@@ -49462,12 +49462,12 @@ function patchHtmlCells5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
49462
49462
|
}
|
|
49463
49463
|
function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
49464
49464
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
49465
|
-
const content =
|
|
49465
|
+
const content = _chunkB5M676H3cjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
49466
49466
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
49467
49467
|
const t = line.trim();
|
|
49468
49468
|
if (!t) return "";
|
|
49469
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
49470
|
-
return
|
|
49469
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkB5M676H3cjs.escapeGfm.call(void 0, t)}**`;
|
|
49470
|
+
return _chunkB5M676H3cjs.escapeGfm.call(void 0, t);
|
|
49471
49471
|
}).filter(Boolean);
|
|
49472
49472
|
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");
|
|
49473
49473
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -49481,7 +49481,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
49481
49481
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
49482
49482
|
const replica = [];
|
|
49483
49483
|
for (let r = 0; r < table2.rows; r++) {
|
|
49484
|
-
const line =
|
|
49484
|
+
const line = _chunkB5M676H3cjs.escapeGfm.call(void 0, _chunkB5M676H3cjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
49485
49485
|
if (line) replica.push({ line, gridR: r });
|
|
49486
49486
|
}
|
|
49487
49487
|
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");
|
|
@@ -49522,7 +49522,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
49522
49522
|
if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
|
|
49523
49523
|
return skip("\uC140 \uC904 \uACBD\uACC4 \uB9E4\uD551 \uBAA8\uD638 (\uBB38\uB2E8 \uB0B4 \uC904\uBC14\uAFC8) \u2014 \uBBF8\uC9C0\uC6D0");
|
|
49524
49524
|
}
|
|
49525
|
-
const unstable = newLines.find((l) =>
|
|
49525
|
+
const unstable = newLines.find((l) => _chunkB5M676H3cjs.sanitizeText.call(void 0, l) !== l);
|
|
49526
49526
|
if (unstable !== void 0) return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
49527
49527
|
const targets = nonEmpty.length > 0 ? nonEmpty : cell2.paras;
|
|
49528
49528
|
if (targets.length === 0) return skip("\uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC74C \u2014 \uBBF8\uC9C0\uC6D0");
|
|
@@ -49941,12 +49941,12 @@ function buildOrigUnits(blocks) {
|
|
|
49941
49941
|
const block = blocks[i];
|
|
49942
49942
|
let consume = 1;
|
|
49943
49943
|
let chunk;
|
|
49944
|
-
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(
|
|
49944
|
+
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(_chunkB5M676H3cjs.sanitizeText.call(void 0, block.text))) {
|
|
49945
49945
|
const next = blocks[i + 1];
|
|
49946
49946
|
if (_optionalChain([next, 'optionalAccess', _1315 => _1315.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
49947
|
-
chunk =
|
|
49947
|
+
chunk = _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
49948
49948
|
} else {
|
|
49949
|
-
chunk =
|
|
49949
|
+
chunk = _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, [block]);
|
|
49950
49950
|
}
|
|
49951
49951
|
if (chunk) {
|
|
49952
49952
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -50244,7 +50244,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
50244
50244
|
}
|
|
50245
50245
|
}
|
|
50246
50246
|
if (newPlain === origPlain) return skip("\uD14D\uC2A4\uD2B8 \uC678 \uBCC0\uACBD(\uD5E4\uB529 \uB808\uBCA8/\uC11C\uC2DD)\uB9CC \uAC10\uC9C0 \u2014 \uC2A4\uD0C0\uC77C \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
50247
|
-
if (
|
|
50247
|
+
if (_chunkB5M676H3cjs.sanitizeText.call(void 0, newPlain) !== newPlain && _chunkB5M676H3cjs.sanitizeText.call(void 0, origPlain) === origPlain) {
|
|
50248
50248
|
return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
50249
50249
|
}
|
|
50250
50250
|
const xml = _optionalChain([ctx, 'access', _1329 => _1329.scans, 'access', _1330 => _1330[mapping.para.sectionIndex], 'optionalAccess', _1331 => _1331.xml]);
|
|
@@ -50261,14 +50261,14 @@ function textUnitToPlain(raw, block) {
|
|
|
50261
50261
|
}
|
|
50262
50262
|
function textUnitInline(raw, block) {
|
|
50263
50263
|
let text = raw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
50264
|
-
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(
|
|
50264
|
+
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(_chunkB5M676H3cjs.sanitizeText.call(void 0, block.text))) {
|
|
50265
50265
|
text = text.replace(/^#{1,6}\s+/, "");
|
|
50266
50266
|
}
|
|
50267
50267
|
if (block.href) {
|
|
50268
50268
|
const linkMatch = text.match(/^\[([\s\S]*)\]\([^)]*\)$/);
|
|
50269
50269
|
if (linkMatch) text = linkMatch[1];
|
|
50270
50270
|
}
|
|
50271
|
-
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(
|
|
50271
|
+
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(_chunkB5M676H3cjs.sanitizeText.call(void 0, block.text))) {
|
|
50272
50272
|
text = text.slice(1, -1);
|
|
50273
50273
|
}
|
|
50274
50274
|
return text;
|
|
@@ -52819,7 +52819,7 @@ function blocksToChunks(blocks, options) {
|
|
|
52819
52819
|
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1362 => _1362.granularity]), () => ( "section"));
|
|
52820
52820
|
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1363 => _1363.includeTableCells]), () => ( false));
|
|
52821
52821
|
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess', _1364 => _1364.tableFormat]) };
|
|
52822
|
-
if (_optionalChain([options, 'optionalAccess', _1365 => _1365.tableFormat]) === "gfm")
|
|
52822
|
+
if (_optionalChain([options, 'optionalAccess', _1365 => _1365.tableFormat]) === "gfm") _chunkB5M676H3cjs.assignTableIds.call(void 0, blocks);
|
|
52823
52823
|
const chunks = [];
|
|
52824
52824
|
const headingStack = [];
|
|
52825
52825
|
const listStack = [];
|
|
@@ -52833,12 +52833,12 @@ function blocksToChunks(blocks, options) {
|
|
|
52833
52833
|
let run = null;
|
|
52834
52834
|
const flushRun = () => {
|
|
52835
52835
|
if (!run) return;
|
|
52836
|
-
push("text", run.breadcrumb,
|
|
52836
|
+
push("text", run.breadcrumb, _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, run.blocks, mdOptions), [run.start, run.end], run.page);
|
|
52837
52837
|
run = null;
|
|
52838
52838
|
};
|
|
52839
52839
|
for (let i = 0; i < blocks.length; i++) {
|
|
52840
52840
|
const block = blocks[i];
|
|
52841
|
-
const md2 =
|
|
52841
|
+
const md2 = _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, [block], mdOptions);
|
|
52842
52842
|
if (!md2) continue;
|
|
52843
52843
|
if (block.type === "heading") {
|
|
52844
52844
|
flushRun();
|
|
@@ -52926,7 +52926,7 @@ function u8ToArrayBuffer2(u8) {
|
|
|
52926
52926
|
return u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
|
|
52927
52927
|
}
|
|
52928
52928
|
function irCellLines(text) {
|
|
52929
|
-
return stripCellTokens(
|
|
52929
|
+
return stripCellTokens(_chunkB5M676H3cjs.sanitizeText.call(void 0, text)).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
52930
52930
|
}
|
|
52931
52931
|
var HwpxSession = (_class10 = class _HwpxSession {
|
|
52932
52932
|
|
|
@@ -53186,7 +53186,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
53186
53186
|
if (newPlain === "") {
|
|
53187
53187
|
return skip("\uBE14\uB85D \uBE44\uC6B0\uAE30/\uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 (v1) \u2014 \uC6D0\uBCF8 \uC720\uC9C0");
|
|
53188
53188
|
}
|
|
53189
|
-
if (
|
|
53189
|
+
if (_chunkB5M676H3cjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
53190
53190
|
return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
53191
53191
|
}
|
|
53192
53192
|
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _1385 => _1385.scans, 'access', _1386 => _1386[mapping.para.sectionIndex], 'optionalAccess', _1387 => _1387.xml]));
|
|
@@ -53281,7 +53281,7 @@ var md = new (0, _markdownit2.default)({
|
|
|
53281
53281
|
});
|
|
53282
53282
|
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;
|
|
53283
53283
|
function sanitizeRawHtml(raw) {
|
|
53284
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
53284
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkOMGCVZ4Wcjs.escapeHtml.call(void 0, tag));
|
|
53285
53285
|
}
|
|
53286
53286
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
53287
53287
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
@@ -53289,7 +53289,7 @@ function renderHtml(markdown, options) {
|
|
|
53289
53289
|
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1391 => _1391.preset]), () => ( "default"));
|
|
53290
53290
|
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _1392 => _1392.extraCss]), () => ( "")));
|
|
53291
53291
|
const body = md.render(markdown);
|
|
53292
|
-
const watermark = _optionalChain([options, 'optionalAccess', _1393 => _1393.watermark]) ? `<div class="watermark">${
|
|
53292
|
+
const watermark = _optionalChain([options, 'optionalAccess', _1393 => _1393.watermark]) ? `<div class="watermark">${_chunkOMGCVZ4Wcjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
53293
53293
|
const watermarkCss = _optionalChain([options, 'optionalAccess', _1394 => _1394.watermark]) ? `
|
|
53294
53294
|
.watermark {
|
|
53295
53295
|
position: fixed;
|
|
@@ -53343,13 +53343,13 @@ async function htmlToPdf(html, options) {
|
|
|
53343
53343
|
try {
|
|
53344
53344
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
53345
53345
|
} catch (e49) {
|
|
53346
|
-
throw new (0,
|
|
53346
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(
|
|
53347
53347
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
53348
53348
|
);
|
|
53349
53349
|
}
|
|
53350
53350
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
53351
53351
|
if (!executablePath) {
|
|
53352
|
-
throw new (0,
|
|
53352
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(
|
|
53353
53353
|
"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."
|
|
53354
53354
|
);
|
|
53355
53355
|
}
|
|
@@ -53404,7 +53404,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
53404
53404
|
return htmlToPdf(html, options);
|
|
53405
53405
|
}
|
|
53406
53406
|
async function blocksToPdf(blocks, options) {
|
|
53407
|
-
const markdown =
|
|
53407
|
+
const markdown = _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, blocks);
|
|
53408
53408
|
return markdownToPdf(markdown, options);
|
|
53409
53409
|
}
|
|
53410
53410
|
|
|
@@ -53527,9 +53527,10 @@ function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY, s
|
|
|
53527
53527
|
}
|
|
53528
53528
|
for (let k = 0; k < spans.length; k++) if (!done.has(k)) solve(k, false);
|
|
53529
53529
|
let total = h.reduce((s, x) => s + x, 0);
|
|
53530
|
+
const overSz = total > maxTotal;
|
|
53530
53531
|
for (const { c, rows } of [...spans].sort((a, b) => a.rows[a.rows.length - 1] - b.rows[b.rows.length - 1] || b.rows[0] - a.rows[0])) {
|
|
53531
53532
|
const known = rows.reduce((s, r) => s + h[r], 0);
|
|
53532
|
-
const add = Math.min(c.height - known, maxTotal - total);
|
|
53533
|
+
const add = Math.min(c.height - known, overSz && c.contentH != null && c.contentH >= c.height ? Number.POSITIVE_INFINITY : maxTotal - total);
|
|
53533
53534
|
if (rows.length && add > 0) {
|
|
53534
53535
|
h[rows[rows.length - 1]] += add;
|
|
53535
53536
|
total += add;
|
|
@@ -55599,12 +55600,24 @@ function footNoteStories(root, paraPages, geom) {
|
|
|
55599
55600
|
const above = num2(sp, "aboveLine", 850), below = num2(sp, "belowLine", 567), between = num2(sp, "betweenNotes", 283);
|
|
55600
55601
|
const byPage = /* @__PURE__ */ new Map();
|
|
55601
55602
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
55602
|
-
const
|
|
55603
|
+
const pages = _nullishCoalesce(paraPages.get(p), () => ( []));
|
|
55604
|
+
const m = pages.length > 1 ? buildPara(p) : null;
|
|
55603
55605
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
55604
55606
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
55605
55607
|
const fn = findChildByLocalName(ctrl, "footNote");
|
|
55606
55608
|
const sub = fn && !isDeletedControl(fn) ? findChildByLocalName(fn, "subList") : null;
|
|
55607
55609
|
if (!sub) continue;
|
|
55610
|
+
let page = _nullishCoalesce(pages[0], () => ( 0));
|
|
55611
|
+
if (m) {
|
|
55612
|
+
const at = m.chars.findIndex((c) => c.note === fn);
|
|
55613
|
+
if (at >= 0) {
|
|
55614
|
+
let k = 0;
|
|
55615
|
+
m.segs.forEach((sg, i) => {
|
|
55616
|
+
if (sg.textpos <= at) k = i;
|
|
55617
|
+
});
|
|
55618
|
+
page = _nullishCoalesce(pages[k], () => ( page));
|
|
55619
|
+
}
|
|
55620
|
+
}
|
|
55608
55621
|
let h = 0;
|
|
55609
55622
|
for (const q of elements(sub)) if (ln(q) === "p") {
|
|
55610
55623
|
const lsa = findChildByLocalName(q, "linesegarray");
|
|
@@ -55617,12 +55630,12 @@ function footNoteStories(root, paraPages, geom) {
|
|
|
55617
55630
|
}
|
|
55618
55631
|
}
|
|
55619
55632
|
const stories = [], rules = [];
|
|
55620
|
-
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
55621
|
-
const lineType = _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
55633
|
+
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1590 => _1590.getAttribute, 'call', _1591 => _1591("width")]), () => ( "0.12"))) || 0.12;
|
|
55634
|
+
const lineType = _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1592 => _1592.getAttribute, 'call', _1593 => _1593("type")]), () => ( "SOLID"));
|
|
55622
55635
|
for (const [page, notes] of byPage) {
|
|
55623
55636
|
const area = above + below + notes.reduce((a, n) => a + n.h, 0) + between * (notes.length - 1);
|
|
55624
55637
|
const top = geom.MT + geom.BODY_H - area;
|
|
55625
|
-
if (lineType !== "NONE") rules.push({ page, x: geom.ML, y: top + above, length: lenAttr > 0 ? lenAttr : 14173, widthMm, color: _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
55638
|
+
if (lineType !== "NONE") rules.push({ page, x: geom.ML, y: top + above, length: lenAttr > 0 ? lenAttr : 14173, widthMm, color: _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1594 => _1594.getAttribute, 'call', _1595 => _1595("color")]), () => ( "#000000")) });
|
|
55626
55639
|
let y = top + above + below;
|
|
55627
55640
|
for (const n of notes) {
|
|
55628
55641
|
stories.push({ sub: n.sub, page, x: geom.ML, y, width: geom.BODY_W });
|
|
@@ -55658,8 +55671,8 @@ function endNoteLayout(root, paraPages, geom) {
|
|
|
55658
55671
|
let col = nCol > 1 ? Math.min(nCol - 1, Math.max(0, Math.round(num2(last.seg, "horzpos") / (colW + gap)))) : 0;
|
|
55659
55672
|
let y = num2(last.seg, "vertpos") + num2(last.seg, "vertsize") + above;
|
|
55660
55673
|
const rules = [];
|
|
55661
|
-
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
55662
|
-
if ((_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
55674
|
+
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1596 => _1596.getAttribute, 'call', _1597 => _1597("width")]), () => ( "0.12"))) || 0.12;
|
|
55675
|
+
if ((_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1598 => _1598.getAttribute, 'call', _1599 => _1599("type")]), () => ( "SOLID"))) !== "NONE") rules.push({ page, x: geom.ML + col * (colW + gap), y: geom.MT + y, length: lenAttr > 0 ? lenAttr : 14173, widthMm, color: _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1600 => _1600.getAttribute, 'call', _1601 => _1601("color")]), () => ( "#000000")) });
|
|
55663
55676
|
y += below;
|
|
55664
55677
|
const next = () => {
|
|
55665
55678
|
if (++col >= nCol) {
|
|
@@ -55716,18 +55729,30 @@ function stackedFloats(c) {
|
|
|
55716
55729
|
}
|
|
55717
55730
|
return out;
|
|
55718
55731
|
}
|
|
55719
|
-
function cellLineBoxes(c) {
|
|
55732
|
+
function cellLineBoxes(c, bodyH) {
|
|
55720
55733
|
const out = [];
|
|
55721
55734
|
let shift = 0, prevV = Number.NEGATIVE_INFINITY, prevH = 0, prevSavedEnd = 0, prevEnd = 0, part = 0;
|
|
55722
55735
|
const cols = cellColumns(c.sub);
|
|
55736
|
+
let floatBottom = Number.NEGATIVE_INFINITY;
|
|
55737
|
+
let nestedCell = false;
|
|
55738
|
+
for (let a = c.el.parentNode; a; a = a.parentNode) if (a !== c.el && a.nodeType === 1 && ln(a) === "tc") {
|
|
55739
|
+
nestedCell = true;
|
|
55740
|
+
break;
|
|
55741
|
+
}
|
|
55723
55742
|
for (const p of c.sub ? elements(c.sub) : []) if (ln(p) === "p") {
|
|
55724
55743
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
55744
|
+
let first = true, pTop = 0;
|
|
55725
55745
|
for (const sg of lsa ? elements(lsa) : []) if (ln(sg) === "lineseg") {
|
|
55726
55746
|
const v = num2(sg, "vertpos"), hz = num2(sg, "horzpos");
|
|
55727
55747
|
if ((v < prevV || v === prevV && hz <= prevH && prevSavedEnd > v) && !cols) {
|
|
55728
55748
|
shift = prevEnd - v;
|
|
55729
55749
|
part++;
|
|
55750
|
+
} else if (!nestedCell && bodyH !== void 0 && floatBottom > bodyH && first && !cols && v >= prevV && v < floatBottom - 1e3) {
|
|
55751
|
+
shift = prevEnd - v;
|
|
55752
|
+
part++;
|
|
55730
55753
|
}
|
|
55754
|
+
if (first) pTop = prevSavedEnd > 0 && prevSavedEnd <= v ? prevSavedEnd : v;
|
|
55755
|
+
first = false;
|
|
55731
55756
|
prevV = v;
|
|
55732
55757
|
prevH = hz;
|
|
55733
55758
|
prevSavedEnd = v + num2(sg, "vertsize") + num2(sg, "spacing");
|
|
@@ -55735,17 +55760,26 @@ function cellLineBoxes(c) {
|
|
|
55735
55760
|
prevEnd = bottom + num2(sg, "spacing");
|
|
55736
55761
|
out.push({ seg: sg, top, bottom, part, origin: shift });
|
|
55737
55762
|
}
|
|
55763
|
+
floatBottom = Number.NEGATIVE_INFINITY;
|
|
55764
|
+
for (const run of elements(p)) if (ln(run) === "run") for (const o of elements(run)) {
|
|
55765
|
+
if (ln(o) !== "tbl" || (_nullishCoalesce(o.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) !== "TOP_AND_BOTTOM") continue;
|
|
55766
|
+
const pos = findChildByLocalName(o, "pos");
|
|
55767
|
+
if (!pos || pos.getAttribute("treatAsChar") === "1" || (_nullishCoalesce(pos.getAttribute("vertRelTo"), () => ( "PARA"))) !== "PARA") continue;
|
|
55768
|
+
const om = findChildByLocalName(o, "outMargin"), vo = num2(pos, "vertOffset"), sz = num2(findChildByLocalName(o, "sz"), "height"), full = measureTableHeight(o);
|
|
55769
|
+
const top = pTop + (vo < 2 ** 31 ? vo : 0) + num2(om, "top");
|
|
55770
|
+
if (full > sz + 1e3 && (bodyH === void 0 || top + (_nullishCoalesce(measureTableRowHeights(o)[0], () => ( 0))) <= bodyH)) floatBottom = Math.max(floatBottom, top + full + num2(om, "bottom"));
|
|
55771
|
+
}
|
|
55738
55772
|
}
|
|
55739
55773
|
return out;
|
|
55740
55774
|
}
|
|
55741
|
-
function cellLines(c) {
|
|
55742
|
-
return cellLineBoxes(c).map((b) => [b.top, b.bottom]);
|
|
55775
|
+
function cellLines(c, bodyH) {
|
|
55776
|
+
return cellLineBoxes(c, bodyH).map((b) => [b.top, b.bottom]);
|
|
55743
55777
|
}
|
|
55744
|
-
function spanPartRows(cells, rowY) {
|
|
55778
|
+
function spanPartRows(cells, rowY, bodyH) {
|
|
55745
55779
|
const out = /* @__PURE__ */ new Set();
|
|
55746
55780
|
for (const c of cells) {
|
|
55747
55781
|
if (c.rs < 2) continue;
|
|
55748
|
-
const bs = cellLineBoxes(c);
|
|
55782
|
+
const bs = cellLineBoxes(c, bodyH);
|
|
55749
55783
|
const parts = bs.length ? bs[bs.length - 1].part : 0;
|
|
55750
55784
|
let s = c.ra;
|
|
55751
55785
|
for (let k = 0; k < parts; k++) {
|
|
@@ -55766,7 +55800,7 @@ function coAnchoredFollower(tbl2) {
|
|
|
55766
55800
|
const pos = findChildByLocalName(o, "pos");
|
|
55767
55801
|
return !!pos && pos.getAttribute("treatAsChar") !== "1" && (_nullishCoalesce(pos.getAttribute("vertRelTo"), () => ( "PARA"))) === "PARA" && (_nullishCoalesce(o.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM";
|
|
55768
55802
|
};
|
|
55769
|
-
const p = _optionalChain([tbl2, 'access',
|
|
55803
|
+
const p = _optionalChain([tbl2, 'access', _1602 => _1602.parentNode, 'optionalAccess', _1603 => _1603.parentNode]);
|
|
55770
55804
|
if (!p || ln(p) !== "p" || !isTb(tbl2)) return false;
|
|
55771
55805
|
let seen = false;
|
|
55772
55806
|
for (const run of elements(p)) if (ln(run) === "run") for (const o of elements(run)) {
|
|
@@ -55789,14 +55823,14 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
55789
55823
|
const st = stackedFloats(rc[0]);
|
|
55790
55824
|
return st.length >= 2 && st.reduce((a, f) => a + f.h, 0) > h;
|
|
55791
55825
|
});
|
|
55792
|
-
if (slack > 0 && ty + rowY[nRows] > pageBottom && ty + rowY[nRows] <= pageBottom + slack && cells.some((c) => cellLineBoxes(c).some((b) => b.part > 0))) slack = 0;
|
|
55826
|
+
if (slack > 0 && ty + rowY[nRows] > pageBottom && ty + rowY[nRows] <= pageBottom + slack && cells.some((c) => cellLineBoxes(c, BODY_H).some((b) => b.part > 0))) slack = 0;
|
|
55793
55827
|
if (slack > 0 && ty + rowY[nRows] > pageBottom && ty + rowY[nRows] <= pageBottom + slack) {
|
|
55794
55828
|
const declared = num2(findChildByLocalName(tbl2, "sz"), "height");
|
|
55795
55829
|
if (rowY.some((v, k) => k > 0 && k < nRows && Math.abs(v - declared) <= 2)) slack = 0;
|
|
55796
55830
|
}
|
|
55797
|
-
const savedParts = tbl2.getAttribute("pageBreak") === "CELL" && cells.some((c) => c.h > rowY[nRows] && cellLineBoxes(c).some((b) => b.part > 0));
|
|
55831
|
+
const savedParts = tbl2.getAttribute("pageBreak") === "CELL" && cells.some((c) => c.h > rowY[nRows] && cellLineBoxes(c, BODY_H).some((b) => b.part > 0));
|
|
55798
55832
|
if (BODY_H <= 0 || ty + rowY[nRows] <= pageBottom + slack && !stackOver && !savedParts) return plain4();
|
|
55799
|
-
if (_optionalChain([findChildByLocalName, 'call',
|
|
55833
|
+
if (_optionalChain([findChildByLocalName, 'call', _1604 => _1604(tbl2, "pos"), 'optionalAccess', _1605 => _1605.getAttribute, 'call', _1606 => _1606("treatAsChar")]) === "1") {
|
|
55800
55834
|
const declared = num2(findChildByLocalName(tbl2, "sz"), "height") || rowY[nRows];
|
|
55801
55835
|
if (ty - MT < 2e3 || ty + declared <= pageBottom + slack) return plain4();
|
|
55802
55836
|
return rowH.map((h, r) => [{ page: 1, y: MT + rowY[r], h }]);
|
|
@@ -55807,17 +55841,21 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
55807
55841
|
const outB = num2(findChildByLocalName(tbl2, "outMargin"), "bottom");
|
|
55808
55842
|
const cellSplit = tbl2.getAttribute("pageBreak") === "CELL";
|
|
55809
55843
|
const out = [];
|
|
55810
|
-
const flows = (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
55844
|
+
const flows = (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1607 => _1607(tbl2, "pos"), 'optionalAccess', _1608 => _1608.getAttribute, 'call', _1609 => _1609("vertRelTo")]), () => ( "PARA"))) === "PARA";
|
|
55811
55845
|
let page = 0, y = ty, first = !flows || ty - MT < 2e3;
|
|
55846
|
+
if (!first && (_nullishCoalesce(tbl2.getAttribute("pageBreak"), () => ( "NONE"))) === "NONE") {
|
|
55847
|
+
const outT = num2(findChildByLocalName(tbl2, "outMargin"), "top");
|
|
55848
|
+
if (outT + rowY[nRows] + outB <= BODY_H) return rowH.map((h, r) => [{ page: 1, y: contMT + outT + rowY[r], h }]);
|
|
55849
|
+
}
|
|
55812
55850
|
if (!first && coAnchoredFollower(tbl2)) {
|
|
55813
55851
|
const outT = num2(findChildByLocalName(tbl2, "outMargin"), "top");
|
|
55814
55852
|
if (outT + rowY[nRows] + outB <= BODY_H) return rowH.map((h, r) => [{ page: 1, y: contMT + outT + rowY[r], h }]);
|
|
55815
55853
|
}
|
|
55816
|
-
const spanStarts = cellSplit ? spanPartRows(cells, rowY) : /* @__PURE__ */ new Set();
|
|
55854
|
+
const spanStarts = cellSplit ? spanPartRows(cells, rowY, BODY_H) : /* @__PURE__ */ new Set();
|
|
55817
55855
|
for (let r = 0; r < nRows; r++) {
|
|
55818
55856
|
let h = rowH[r];
|
|
55819
55857
|
const pieces = [];
|
|
55820
|
-
if (!first && r >= hdrRows && spanStarts.has(r) && !cells.some((c) => c.rs > 1 && c.ra < r && c.ra + c.rs > r && (_nullishCoalesce(_optionalChain([out, 'access',
|
|
55858
|
+
if (!first && r >= hdrRows && spanStarts.has(r) && !cells.some((c) => c.rs > 1 && c.ra < r && c.ra + c.rs > r && (_nullishCoalesce(_optionalChain([out, 'access', _1610 => _1610[c.ra], 'optionalAccess', _1611 => _1611[0], 'optionalAccess', _1612 => _1612.page]), () => ( page))) < page)) {
|
|
55821
55859
|
page++;
|
|
55822
55860
|
y = contTop;
|
|
55823
55861
|
first = true;
|
|
@@ -55852,7 +55890,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
55852
55890
|
continue;
|
|
55853
55891
|
}
|
|
55854
55892
|
}
|
|
55855
|
-
const boxes = splittable ? new Map(rowCells.map((c) => [c.el, cellLineBoxes(c)])) : void 0;
|
|
55893
|
+
const boxes = splittable ? new Map(rowCells.map((c) => [c.el, cellLineBoxes(c, BODY_H)])) : void 0;
|
|
55856
55894
|
const hParts = boxes ? Math.max(0, ...[...boxes.values()].flatMap((bs) => bs.map((b) => b.part))) : 0;
|
|
55857
55895
|
if (boxes && hParts > 0) {
|
|
55858
55896
|
if (!first && rowCells.some((c) => {
|
|
@@ -55873,7 +55911,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
55873
55911
|
const b = (_nullishCoalesce(boxes.get(c.el), () => ( []))).find((x) => x.part === k);
|
|
55874
55912
|
if (!b) continue;
|
|
55875
55913
|
const f = floatSpan(b.seg, y + c.marginT, contTop + c.marginT);
|
|
55876
|
-
if (_optionalChain([f, 'optionalAccess',
|
|
55914
|
+
if (_optionalChain([f, 'optionalAccess', _1613 => _1613.el]) && f.pages > 0 && f.pages > lead && Math.abs(contTop + c.marginT + b.top - b.origin - f.endY) < 3e3) {
|
|
55877
55915
|
lead = f.pages;
|
|
55878
55916
|
place = /* @__PURE__ */ new Map([[f.el, y + c.marginT]]);
|
|
55879
55917
|
led.add(b.seg);
|
|
@@ -55890,8 +55928,8 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
55890
55928
|
for (const c of rowCells) {
|
|
55891
55929
|
const bs = _nullishCoalesce(boxes.get(c.el), () => ( []));
|
|
55892
55930
|
const inK = bs.filter((b) => b.part === k), next = bs.find((b) => b.part > k);
|
|
55893
|
-
const from = _nullishCoalesce(_nullishCoalesce(_optionalChain([inK, 'access',
|
|
55894
|
-
range.set(c.el, [from, _nullishCoalesce(_optionalChain([next, 'optionalAccess',
|
|
55931
|
+
const from = _nullishCoalesce(_nullishCoalesce(_optionalChain([inK, 'access', _1614 => _1614[0], 'optionalAccess', _1615 => _1615.origin]), () => ( _optionalChain([next, 'optionalAccess', _1616 => _1616.origin]))), () => ( Number.POSITIVE_INFINITY));
|
|
55932
|
+
range.set(c.el, [from, _nullishCoalesce(_optionalChain([next, 'optionalAccess', _1617 => _1617.top]), () => ( Number.POSITIVE_INFINITY))]);
|
|
55895
55933
|
if (inK.length) ext = Math.max(ext, inK[inK.length - 1].bottom - from + c.marginT + c.marginB);
|
|
55896
55934
|
if (k === hParts && inK.length && c.sub) for (const f of subFloatBottoms(c.sub)) {
|
|
55897
55935
|
const b = bs.find((x) => x.seg === f.seg);
|
|
@@ -55902,14 +55940,14 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
55902
55940
|
const last = k === hParts;
|
|
55903
55941
|
const cellH = Math.max(0, ...rowCells.map((c) => num2(findChildByLocalName(c.el, "cellSz"), "height")));
|
|
55904
55942
|
const firstH = Math.min(declared > 0 && ty + declared - y >= ext ? Math.min(pageBottom - y, ty + declared - y) : pageBottom - y, Math.max(ext, cellH));
|
|
55905
|
-
const share = last && k === 1 ? Math.max(0, ...rowCells.filter((c) => tbl2.getAttribute("noAdjust") === "1" || /^(CENTER|BOTTOM)$/.test(_nullishCoalesce(_optionalChain([c, 'access',
|
|
55943
|
+
const share = last && k === 1 ? Math.max(0, ...rowCells.filter((c) => tbl2.getAttribute("noAdjust") === "1" || /^(CENTER|BOTTOM)$/.test(_nullishCoalesce(_optionalChain([c, 'access', _1618 => _1618.sub, 'optionalAccess', _1619 => _1619.getAttribute, 'call', _1620 => _1620("vertAlign")]), () => ( "")))).map((c) => c.h - firstPh).filter((v) => v <= pageBottom - contTop)) : 0;
|
|
55906
55944
|
const ph = last ? Math.max(ext, share) : k === 0 ? firstH : toNext > 0 ? Math.min(pageBottom - contTop, toNext) : pageBottom - contTop;
|
|
55907
55945
|
if (k === 0) firstPh = ph;
|
|
55908
55946
|
pieces.push({ page, y, h: ph, range });
|
|
55909
55947
|
if (!last) {
|
|
55910
55948
|
let span2 = 0, spanEnd = 0;
|
|
55911
55949
|
if (floatSpan) for (const c of rowCells) {
|
|
55912
|
-
const bs = (_nullishCoalesce(boxes.get(c.el), () => ( []))).filter((b) => b.part === k), from = _nullishCoalesce(_optionalChain([bs, 'access',
|
|
55950
|
+
const bs = (_nullishCoalesce(boxes.get(c.el), () => ( []))).filter((b) => b.part === k), from = _nullishCoalesce(_optionalChain([bs, 'access', _1621 => _1621[0], 'optionalAccess', _1622 => _1622.origin]), () => ( 0));
|
|
55913
55951
|
for (const b of bs) {
|
|
55914
55952
|
if (led.has(b.seg)) continue;
|
|
55915
55953
|
const f = floatSpan(b.seg, y + c.marginT + b.top - from, contTop + c.marginT);
|
|
@@ -55962,9 +56000,9 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
55962
56000
|
}
|
|
55963
56001
|
if (splittable && y + h + outB > pageBottom) {
|
|
55964
56002
|
const from = /* @__PURE__ */ new Map();
|
|
55965
|
-
const lines = new Map(rowCells.map((c) => [c.el, cellLines(c)]));
|
|
56003
|
+
const lines = new Map(rowCells.map((c) => [c.el, cellLines(c, BODY_H)]));
|
|
55966
56004
|
const sp0 = new Map(rowCells.map((c) => {
|
|
55967
|
-
const b = cellLineBoxes(c)[0];
|
|
56005
|
+
const b = cellLineBoxes(c, BODY_H)[0];
|
|
55968
56006
|
return [c.el, b ? num2(b.seg, "spacing") : 0];
|
|
55969
56007
|
}));
|
|
55970
56008
|
while (y + h + outB > pageBottom && BODY_H > rowY[hdrRows]) {
|
|
@@ -55993,7 +56031,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
55993
56031
|
if (allFit) {
|
|
55994
56032
|
const spanCells = cells.filter((c) => c.ra === r && c.rs > 1);
|
|
55995
56033
|
const spanExt = (c) => {
|
|
55996
|
-
const bs = cellLineBoxes(c);
|
|
56034
|
+
const bs = cellLineBoxes(c, BODY_H);
|
|
55997
56035
|
return bs.some((b) => b.part > 0) ? Math.max(...bs.filter((b) => b.part === 0).map((b) => b.bottom)) : cellContentExtent(c);
|
|
55998
56036
|
};
|
|
55999
56037
|
if (!first && h <= pageBottom - contTop && [...rowCells.map((c) => cellContentExtent(c) + c.marginT + c.marginB), ...spanCells.map((c) => spanExt(c) + c.marginT + c.marginB)].some((e) => e > avail)) {
|
|
@@ -56003,7 +56041,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
56003
56041
|
break;
|
|
56004
56042
|
}
|
|
56005
56043
|
const carry = !nested && h - avail > ROW_CARRY_MIN && h <= pageBottom - contTop && rowCells.every((c) => {
|
|
56006
|
-
const e = cellContentExtent(c) + c.marginT + c.marginB, va = _nullishCoalesce(_optionalChain([c, 'access',
|
|
56044
|
+
const e = cellContentExtent(c) + c.marginT + c.marginB, va = _nullishCoalesce(_optionalChain([c, 'access', _1623 => _1623.sub, 'optionalAccess', _1624 => _1624.getAttribute, 'call', _1625 => _1625("vertAlign")]), () => ( "TOP"));
|
|
56007
56045
|
return (va === "CENTER" ? (h + e) / 2 : va === "BOTTOM" ? h : e) <= avail;
|
|
56008
56046
|
});
|
|
56009
56047
|
if ((nested || carry) && avail > 0) {
|
|
@@ -56140,7 +56178,7 @@ function objectGeometry(el, x, y, w, h, boxW = w, boxH = h) {
|
|
|
56140
56178
|
function shapeFill(el, defs, images, warn) {
|
|
56141
56179
|
const brush = findChildByLocalName(el, "fillBrush");
|
|
56142
56180
|
const win = brush && findChildByLocalName(brush, "winBrush");
|
|
56143
|
-
const face = _optionalChain([win, 'optionalAccess',
|
|
56181
|
+
const face = _optionalChain([win, 'optionalAccess', _1626 => _1626.getAttribute, 'call', _1627 => _1627("faceColor")]);
|
|
56144
56182
|
if (docColor(face)) return esc(face);
|
|
56145
56183
|
const grad = brush && findChildByLocalName(brush, "gradation");
|
|
56146
56184
|
if (grad) {
|
|
@@ -56191,8 +56229,8 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local2 = false) {
|
|
|
56191
56229
|
const geometry = local2 ? { x: boxX, y: boxY, w, h, bbox: { x: boxX, y: boxY, w, h }, transform: "" } : objectGeometry(el, boxX, boxY, w, h, o.width || w, o.height || h);
|
|
56192
56230
|
const { x, y } = geometry;
|
|
56193
56231
|
const sx = ow > 0 ? w / ow : 1, sy = oh > 0 ? h / oh : 1;
|
|
56194
|
-
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
56195
|
-
const color = esc(docColor(_optionalChain([line, 'optionalAccess',
|
|
56232
|
+
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1628 => _1628.getAttribute, 'call', _1629 => _1629("style")]), () => ( "SOLID"));
|
|
56233
|
+
const color = esc(docColor(_optionalChain([line, 'optionalAccess', _1630 => _1630.getAttribute, 'call', _1631 => _1631("color")]), "#000000"));
|
|
56196
56234
|
const strokeW = style === "NONE" ? 0 : Math.max(0.2, num2(line, "width", 33) / 100 * 2.834645);
|
|
56197
56235
|
const dash = /DASH|DOT/.test(style) ? ` stroke-dasharray="${style.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
56198
56236
|
const keepWidth = local2 ? ` vector-effect="non-scaling-stroke"` : "";
|
|
@@ -56229,7 +56267,7 @@ function linePushedBy(o, lineV, paraTop) {
|
|
|
56229
56267
|
if (paraTop === void 0) return false;
|
|
56230
56268
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
56231
56269
|
const pos = findChildByLocalName(o.el, "pos");
|
|
56232
|
-
const raw = num2(pos, "vertOffset"), vo = (_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
56270
|
+
const raw = num2(pos, "vertOffset"), vo = (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1632 => _1632.getAttribute, 'call', _1633 => _1633("vertRelTo")]), () => ( "PARA"))) === "PARA" ? Math.max(0, raw >= 2 ** 31 ? raw - 2 ** 32 : raw) : 0;
|
|
56233
56271
|
return Math.abs(lineV - (vo + num2(om, "top") + o.height + num2(om, "bottom")) - paraTop) <= 10;
|
|
56234
56272
|
}
|
|
56235
56273
|
function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, lineH, lineSB = 0, anchorAt = "end") {
|
|
@@ -56269,7 +56307,7 @@ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = fals
|
|
|
56269
56307
|
if (hrel === "PAGE") {
|
|
56270
56308
|
x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
|
|
56271
56309
|
} else if (hrel === "PAPER") {
|
|
56272
|
-
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (_nullishCoalesce(_optionalChain([ctx, 'access',
|
|
56310
|
+
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (_nullishCoalesce(_optionalChain([ctx, 'access', _1634 => _1634.bodyDx, 'optionalCall', _1635 => _1635(ctx.page)]), () => ( 0)));
|
|
56273
56311
|
} else {
|
|
56274
56312
|
x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
|
|
56275
56313
|
}
|
|
@@ -56507,7 +56545,7 @@ function warnOnce(ctx, key2, msg2) {
|
|
|
56507
56545
|
function charW(c, styles, prev) {
|
|
56508
56546
|
const st = _nullishCoalesce((c.prId != null ? styles.charPr.get(c.prId) : void 0), () => ( DEFAULT_CHAR));
|
|
56509
56547
|
if (c.ch === "" && c.ctrlText) return measureTextWidth(c.ctrlText, c.ctrlSup ? Math.round(st.height * 3 / 4) : st.height, st.ratio, { spacingPct: st.spacing, faceClass: faceClassOf(st.face) });
|
|
56510
|
-
let w = 0, last = _optionalChain([prev, 'optionalAccess',
|
|
56548
|
+
let w = 0, last = _optionalChain([prev, 'optionalAccess', _1636 => _1636.ch]) ? _nullishCoalesce(prev.ch.codePointAt(prev.ch.length - 1), () => ( 0)) : 0;
|
|
56511
56549
|
for (const ch of c.ch) {
|
|
56512
56550
|
const cp = ch.codePointAt(0);
|
|
56513
56551
|
if (!joinsJamo(last, cp)) w += glyphWidth(ch, st).w;
|
|
@@ -56526,10 +56564,10 @@ function planLines(m, styles, numText = "") {
|
|
|
56526
56564
|
const align = _nullishCoalesce((m.paraPrId != null ? styles.paraAlign.get(m.paraPrId) : void 0), () => ( "JUSTIFY"));
|
|
56527
56565
|
const geom = m.paraPrId != null ? styles.paraGeom.get(m.paraPrId) : void 0;
|
|
56528
56566
|
const hang = geom && geom.marginIntent < 0 ? -geom.marginIntent : 0;
|
|
56529
|
-
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
56530
|
-
const firstPr = _nullishCoalesce(_optionalChain([m, 'access',
|
|
56531
|
-
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess',
|
|
56532
|
-
const headW = _optionalChain([bu, 'optionalAccess',
|
|
56567
|
+
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1637 => _1637.bullet]), () => ( (numText && _optionalChain([geom, 'optionalAccess', _1638 => _1638.number]) ? { ch: numText, ...geom.number } : void 0)));
|
|
56568
|
+
const firstPr = _nullishCoalesce(_optionalChain([m, 'access', _1639 => _1639.chars, 'access', _1640 => _1640.find, 'call', _1641 => _1641((c) => c.ch !== ""), 'optionalAccess', _1642 => _1642.prId]), () => ( null));
|
|
56569
|
+
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess', _1643 => _1643.charPrId]) != null ? styles.charPr.get(bu.charPrId) : firstPr != null ? styles.charPr.get(firstPr) : void 0), () => ( DEFAULT_CHAR));
|
|
56570
|
+
const headW = _optionalChain([bu, 'optionalAccess', _1644 => _1644.useInstWidth]) === false ? [...bu.ch].reduce((w, ch) => w + glyphWidth(ch, bst, false).w, 0) : bu ? measureTextWidth(bu.ch, bst.height, bst.ratio, { spacingPct: bst.spacing, faceClass: faceClassOf(bst.face) }) : 0;
|
|
56533
56571
|
const bulletW = bu ? paraHeadAdvance(bu, bst.height, headW) : 0;
|
|
56534
56572
|
const plans = [];
|
|
56535
56573
|
const inlineW = /* @__PURE__ */ new Map();
|
|
@@ -56539,8 +56577,8 @@ function planLines(m, styles, numText = "") {
|
|
|
56539
56577
|
const start = seg.textpos;
|
|
56540
56578
|
const end = i + 1 < m.segs.length ? m.segs[i + 1].textpos : Math.max(m.chars.length, start);
|
|
56541
56579
|
const tabs = /* @__PURE__ */ new Map();
|
|
56542
|
-
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
56543
|
-
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
56580
|
+
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1645 => _1645.marginIntent]), () => ( 0)), 0) + bulletW : hang + (_optionalChain([bu, 'optionalAccess', _1646 => _1646.autoIndent]) ? bulletW : 0);
|
|
56581
|
+
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1647 => _1647.marginIntent]), () => ( 0)), 0) : hang) + (i === 0 || _optionalChain([bu, 'optionalAccess', _1648 => _1648.autoIndent]) ? bulletW : 0);
|
|
56544
56582
|
let fixedTo = start;
|
|
56545
56583
|
let fixedW = 0;
|
|
56546
56584
|
for (let k = start; k < end && k < m.chars.length; k++) {
|
|
@@ -56675,7 +56713,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
56675
56713
|
let i = plan.start;
|
|
56676
56714
|
let cursor = ox + seg.horzpos + plan.xoff;
|
|
56677
56715
|
const y = oy + seg.vertpos + seg.baseline;
|
|
56678
|
-
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access',
|
|
56716
|
+
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access', _1649 => _1649.styles, 'access', _1650 => _1650.paraGeom, 'access', _1651 => _1651.get, 'call', _1652 => _1652(m.paraPrId), 'optionalAccess', _1653 => _1653.vertAlign]) : void 0;
|
|
56679
56717
|
const glyphY = (h) => y + (pva === "CENTER" ? Math.round(h * 0.35) : pva === "BOTTOM" ? -Math.round(h * 0.15) : 0);
|
|
56680
56718
|
if (plan.bullet) {
|
|
56681
56719
|
const bs = _nullishCoalesce((plan.bullet.prId != null ? ctx.styles.charPr.get(plan.bullet.prId) : void 0), () => ( DEFAULT_CHAR));
|
|
@@ -56764,7 +56802,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
56764
56802
|
if (st.italic) attrs.push(`font-style="italic"`);
|
|
56765
56803
|
if (st.underline) attrs.push(`text-decoration="underline"`);
|
|
56766
56804
|
if (st.color) attrs.push(`fill="${escapeXml7(st.color)}"`);
|
|
56767
|
-
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(
|
|
56805
|
+
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(_chunkB5M676H3cjs.mapPuaText.call(void 0, text))}</text>`);
|
|
56768
56806
|
ctx.stats.texts++;
|
|
56769
56807
|
}
|
|
56770
56808
|
return sw;
|
|
@@ -56842,11 +56880,11 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
56842
56880
|
}
|
|
56843
56881
|
});
|
|
56844
56882
|
let objBaseV = baseV;
|
|
56845
|
-
const pTop = depth === 0 ? _optionalChain([ctx, 'access',
|
|
56883
|
+
const pTop = depth === 0 ? _optionalChain([ctx, 'access', _1654 => _1654.paraTops, 'optionalAccess', _1655 => _1655.get, 'call', _1656 => _1656(p)]) : void 0;
|
|
56846
56884
|
const wrapA = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
56847
56885
|
const top0 = _nullishCoalesce(pTop, () => ( (depth > 0 && wrapA !== "TOP_AND_BOTTOM" ? cellParaTop(p, ctx.styles.paraGeom) : void 0)));
|
|
56848
56886
|
if (top0 !== void 0 && wrapA !== "TOP_AND_BOTTOM") {
|
|
56849
|
-
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
56887
|
+
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1657 => _1657.styles, 'access', _1658 => _1658.paraGeom, 'access', _1659 => _1659.get, 'call', _1660 => _1660(m.paraPrId), 'optionalAccess', _1661 => _1661.spaceBefore]), () => ( 0)) : 0);
|
|
56850
56888
|
if (baseV > start + 100) {
|
|
56851
56889
|
objBaseV = start;
|
|
56852
56890
|
if (anchorLineV === baseV) anchorLineV = start;
|
|
@@ -56855,12 +56893,12 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
56855
56893
|
if (anchorLineV === baseV) anchorLineV = top0;
|
|
56856
56894
|
}
|
|
56857
56895
|
}
|
|
56858
|
-
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
56896
|
+
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1662 => _1662(q.el, "pos"), 'optionalAccess', _1663 => _1663.getAttribute, 'call', _1664 => _1664("vertRelTo")]), () => ( "PARA"))) === "PARA").length;
|
|
56859
56897
|
let stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
56860
|
-
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
56898
|
+
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1665 => _1665.styles, 'access', _1666 => _1666.paraGeom, 'access', _1667 => _1667.get, 'call', _1668 => _1668(m.paraPrId), 'optionalAccess', _1669 => _1669.spaceBefore]), () => ( 0)) : 0;
|
|
56861
56899
|
if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, _nullishCoalesce(anchorLineV, () => ( baseV)), _nullishCoalesce(pTop, () => ( (depth > 0 ? cellParaTop(p, ctx.styles.paraGeom) : void 0))))) stay = false;
|
|
56862
56900
|
let carried;
|
|
56863
|
-
if (segPages && anchorK > 0 && segPages[anchorK] !== segPages[0] && segPages[anchorK - 1] === segPages[0] && wrapA === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
56901
|
+
if (segPages && anchorK > 0 && segPages[anchorK] !== segPages[0] && segPages[anchorK - 1] === segPages[0] && wrapA === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1670 => _1670(o.el, "pos"), 'optionalAccess', _1671 => _1671.getAttribute, 'call', _1672 => _1672("vertRelTo")]), () => ( "PARA"))) === "PARA") {
|
|
56864
56902
|
const s0 = plans[anchorK - 1].seg;
|
|
56865
56903
|
carried = s0.vertpos + s0.textheight + (_nullishCoalesce(s0.spacing, () => ( 0)));
|
|
56866
56904
|
}
|
|
@@ -56889,7 +56927,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
56889
56927
|
if (!tbStack) {
|
|
56890
56928
|
tbStack = /* @__PURE__ */ new Map();
|
|
56891
56929
|
const placed = [];
|
|
56892
|
-
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
56930
|
+
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1673 => _1673(q.el, "pos"), 'optionalAccess', _1674 => _1674.getAttribute, 'call', _1675 => _1675("vertRelTo")]), () => ( "PARA"))) === "PARA" && _optionalChain([findChildByLocalName, 'call', _1676 => _1676(q.el, "pos"), 'optionalAccess', _1677 => _1677.getAttribute, 'call', _1678 => _1678("allowOverlap")]) !== "1");
|
|
56893
56931
|
for (const q of stackable.length >= 2 ? stackable.sort((a, b) => a.index - b.index) : []) {
|
|
56894
56932
|
const posQ = findChildByLocalName(q.el, "pos"), omQ = findChildByLocalName(q.el, "outMargin"), raw = num2(posQ, "vertOffset");
|
|
56895
56933
|
const x0 = num2(posQ, "horzOffset"), x1 = x0 + num2(omQ, "left") + q.width + num2(omQ, "right");
|
|
@@ -56904,7 +56942,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
56904
56942
|
const st = tbStack.get(o.el);
|
|
56905
56943
|
if (st !== void 0) y = oy + stackTop + st;
|
|
56906
56944
|
}
|
|
56907
|
-
const moved = _optionalChain([ctx, 'access',
|
|
56945
|
+
const moved = _optionalChain([ctx, 'access', _1679 => _1679.objPlace, 'optionalAccess', _1680 => _1680.get, 'call', _1681 => _1681(o.el)]);
|
|
56908
56946
|
if (moved) {
|
|
56909
56947
|
const pg = ctx.page;
|
|
56910
56948
|
ctx.page = moved.page;
|
|
@@ -56923,7 +56961,7 @@ function cellParaTop(p, geom) {
|
|
|
56923
56961
|
const segs = lsa ? elements(lsa).filter((e) => ln(e) === "lineseg") : [];
|
|
56924
56962
|
if (!segs.length) return void 0;
|
|
56925
56963
|
const last = segs[segs.length - 1];
|
|
56926
|
-
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access',
|
|
56964
|
+
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access', _1682 => _1682.get, 'call', _1683 => _1683(_nullishCoalesce(prev.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1684 => _1684.spaceAfter]), () => ( 0)));
|
|
56927
56965
|
}
|
|
56928
56966
|
function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
56929
56967
|
if (!o.inline && depth === 0 && ctx.paintJobs) {
|
|
@@ -56964,7 +57002,7 @@ function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
|
56964
57002
|
drawObject(sub, x + num2(off, "x"), y + num2(off, "y"), baseV, areaW, ctx, depth + 1);
|
|
56965
57003
|
}
|
|
56966
57004
|
} else if (o.tag === "equation") {
|
|
56967
|
-
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
57005
|
+
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1685 => _1685(o.el, "script"), 'optionalAccess', _1686 => _1686.textContent]), () => ( ""));
|
|
56968
57006
|
const text = script ? latexToPlain(hwpEquationToLatex(script)) : "";
|
|
56969
57007
|
if (text && o.width > 0) {
|
|
56970
57008
|
const bl = Number(o.el.getAttribute("baseLine")), size = num2(o.el, "baseUnit", 1e3);
|
|
@@ -57069,7 +57107,7 @@ function tableContPages(tbl2, ty, MT, BODY_H, memo, slack = 0, floatSpan, nested
|
|
|
57069
57107
|
}
|
|
57070
57108
|
function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
57071
57109
|
return (seg, top, contMT) => {
|
|
57072
|
-
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess',
|
|
57110
|
+
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess', _1687 => _1687.parentNode]);
|
|
57073
57111
|
if (!p || ln(p) !== "p") return void 0;
|
|
57074
57112
|
const segs = elements(lsa).filter((e) => ln(e) === "lineseg"), k = segs.indexOf(seg);
|
|
57075
57113
|
const m = buildPara(p);
|
|
@@ -57077,12 +57115,12 @@ function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
|
57077
57115
|
for (const o of m.objs) {
|
|
57078
57116
|
if (o.tag !== "tbl" || o.inline) continue;
|
|
57079
57117
|
const pos = findChildByLocalName(o.el, "pos");
|
|
57080
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
57118
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1688 => _1688.getAttribute, 'call', _1689 => _1689("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
57081
57119
|
const segK = Math.max(0, m.segs.findIndex((sg, i) => sg.textpos <= o.index && (i === m.segs.length - 1 || m.segs[i + 1].textpos > o.index)));
|
|
57082
57120
|
if (segK !== k) continue;
|
|
57083
57121
|
const segV = num2(seg, "vertpos"), pTop = cellParaTop(p, _nullishCoalesce(memo.paraGeom, () => ( /* @__PURE__ */ new Map())));
|
|
57084
57122
|
const start = linePushedBy(o, segV, pTop) ? top - (segV - (_nullishCoalesce(pTop, () => ( segV)))) : top;
|
|
57085
|
-
const ty = start + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
57123
|
+
const ty = start + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1690 => _1690.getAttribute, 'call', _1691 => _1691("vertOffset")]), () => ( void 0)), 0));
|
|
57086
57124
|
const span2 = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true, contMT);
|
|
57087
57125
|
if (span2.pages > 0 && (!best || span2.pages > best.pages)) best = { ...span2, el: o.el };
|
|
57088
57126
|
}
|
|
@@ -57124,7 +57162,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
57124
57162
|
let hdrRows = 0;
|
|
57125
57163
|
if (tbl2.getAttribute("repeatHeader") === "1") while (hdrRows < nRows && cells.some((c) => c.ra === hdrRows) && cells.filter((c) => c.ra === hdrRows).every((c) => c.el.getAttribute("header") === "1")) hdrRows++;
|
|
57126
57164
|
const slack = ctx.geom.PH - ctx.geom.MT - ctx.geom.BODY_H;
|
|
57127
|
-
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call',
|
|
57165
|
+
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call', _1692 => _1692(tbl2, "pos"), 'optionalAccess', _1693 => _1693.getAttribute, 'call', _1694 => _1694("treatAsChar")]) !== "1";
|
|
57128
57166
|
const plan = splitHere ? planTableRows(tbl2, cells, rowH, ty, ctx.geom.MT, ctx.geom.BODY_H, slack, cellFloatSpan(ctx.geom.MT, ctx.geom.BODY_H, ctx.extentMemo, slack), depth !== 1, depth !== 1 && ctx.splitContMT !== void 0 ? ctx.splitContMT : ctx.geom.MT) : rowH.map((h, r) => [{ page: 0, y: ty + rowY[r], h }]);
|
|
57129
57167
|
const splitSaved2 = ctx.splitCell;
|
|
57130
57168
|
ctx.splitCell = false;
|
|
@@ -57143,13 +57181,13 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
57143
57181
|
const span2 = plan.slice(c.ra, Math.min(c.ra + c.rs, nRows)).flat();
|
|
57144
57182
|
const pages = [...new Set(span2.map((pc) => pc.page))];
|
|
57145
57183
|
if (pages.length > 1) {
|
|
57146
|
-
const bs = cellLineBoxes(c);
|
|
57184
|
+
const bs = cellLineBoxes(c, ctx.geom.BODY_H);
|
|
57147
57185
|
const partTop = (k) => bs.find((b) => b.part === k);
|
|
57148
57186
|
const groups = pages.map((pg, k) => {
|
|
57149
57187
|
const on = span2.filter((pc) => pc.page === pg);
|
|
57150
57188
|
const y0 = Math.min(...on.map((pc) => pc.y)), y1 = Math.max(...on.map((pc) => pc.y + pc.h));
|
|
57151
|
-
const from = k === 0 ? 0 : _nullishCoalesce(_optionalChain([partTop, 'call',
|
|
57152
|
-
const to = k === pages.length - 1 ? Number.POSITIVE_INFINITY : _nullishCoalesce(_optionalChain([partTop, 'call',
|
|
57189
|
+
const from = k === 0 ? 0 : _nullishCoalesce(_optionalChain([partTop, 'call', _1695 => _1695(k), 'optionalAccess', _1696 => _1696.origin]), () => ( Number.POSITIVE_INFINITY));
|
|
57190
|
+
const to = k === pages.length - 1 ? Number.POSITIVE_INFINITY : _nullishCoalesce(_optionalChain([partTop, 'call', _1697 => _1697(k + 1), 'optionalAccess', _1698 => _1698.top]), () => ( Number.POSITIVE_INFINITY));
|
|
57153
57191
|
return { page: pg, y: y0, h: y1 - y0, range: /* @__PURE__ */ new Map([[c.el, [from, to]]]) };
|
|
57154
57192
|
});
|
|
57155
57193
|
groups.forEach((pc, k) => geom.push({ c, page: startPage + pc.page, ...xw(c), y: pc.y, h: pc.h, pieces: k === 0 ? groups : [] }));
|
|
@@ -57168,7 +57206,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
57168
57206
|
for (const g3 of geom) {
|
|
57169
57207
|
ctx.page = g3.page;
|
|
57170
57208
|
const bf = g3.c.bfId != null ? ctx.styles.borderFill.get(g3.c.bfId) : void 0;
|
|
57171
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
57209
|
+
if (_optionalChain([bf, 'optionalAccess', _1699 => _1699.fill])) emit(ctx, `<rect x="${pt2(g3.x)}" y="${pt2(g3.y)}" width="${pt2(g3.w)}" height="${pt2(g3.h)}" fill="${escapeXml7(bf.fill)}"/>`);
|
|
57172
57210
|
}
|
|
57173
57211
|
for (const g3 of geom) {
|
|
57174
57212
|
const { c } = g3;
|
|
@@ -57176,17 +57214,17 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
57176
57214
|
ctx.page = g3.page;
|
|
57177
57215
|
if (g3.pieces) {
|
|
57178
57216
|
const base = g3.pieces[0].y + c.marginT;
|
|
57179
|
-
const boxes = cellLineBoxes(c);
|
|
57217
|
+
const boxes = cellLineBoxes(c, ctx.geom.BODY_H);
|
|
57180
57218
|
const contV = new Map(boxes.map((b) => [b.seg, b.top]));
|
|
57181
57219
|
const pieceOf = (v) => Math.max(0, g3.pieces.findIndex((pc) => {
|
|
57182
|
-
const r = _optionalChain([pc, 'access',
|
|
57220
|
+
const r = _optionalChain([pc, 'access', _1700 => _1700.range, 'optionalAccess', _1701 => _1701.get, 'call', _1702 => _1702(c.el)]);
|
|
57183
57221
|
return !!r && v >= r[0] && v < r[1];
|
|
57184
57222
|
}));
|
|
57185
57223
|
const va2 = _nullishCoalesce(c.sub.getAttribute("vertAlign"), () => ( "TOP"));
|
|
57186
57224
|
const lastK = g3.pieces.length - 1;
|
|
57187
57225
|
const pieceOff = g3.pieces.map((pc, k) => {
|
|
57188
57226
|
if (va2 === "TOP" || k > 0 && k < lastK || pc.fill) return 0;
|
|
57189
|
-
const from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
57227
|
+
const from = _nullishCoalesce(_optionalChain([pc, 'access', _1703 => _1703.range, 'optionalAccess', _1704 => _1704.get, 'call', _1705 => _1705(c.el), 'optionalAccess', _1706 => _1706[0]]), () => ( 0));
|
|
57190
57228
|
const bottoms = boxes.filter((b) => pieceOf(b.top) === k).map((b) => b.bottom - from);
|
|
57191
57229
|
if (k > 0) for (const f of subFloatBottoms(c.sub)) {
|
|
57192
57230
|
const b = boxes.find((x) => x.seg === f.seg);
|
|
@@ -57203,7 +57241,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
57203
57241
|
const pages = segs.map((sg) => {
|
|
57204
57242
|
const v = _nullishCoalesce(contV.get(sg), () => ( num2(sg, "vertpos")));
|
|
57205
57243
|
const k = pieceOf(v);
|
|
57206
|
-
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
57244
|
+
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access', _1707 => _1707.range, 'optionalAccess', _1708 => _1708.get, 'call', _1709 => _1709(c.el), 'optionalAccess', _1710 => _1710[0]]), () => ( 0));
|
|
57207
57245
|
sg.setAttribute("vertpos", String(v - from + pc.y + c.marginT + pieceOff[k] - base));
|
|
57208
57246
|
return startPage + pc.page;
|
|
57209
57247
|
});
|
|
@@ -57298,7 +57336,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
57298
57336
|
}
|
|
57299
57337
|
function drawPicFrame(pic, x, y, w, h, transform, ctx) {
|
|
57300
57338
|
const img = findFirst(pic, "img");
|
|
57301
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
57339
|
+
const ref = _optionalChain([img, 'optionalAccess', _1711 => _1711.getAttribute, 'call', _1712 => _1712("binaryItemIDRef")]);
|
|
57302
57340
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
57303
57341
|
const imgId = ctx.regions.add("image", bboxOf(ctx, x, y, w, h), { sourceId: _nullishCoalesce(ref, () => ( void 0)), parentId: parentId(ctx) });
|
|
57304
57342
|
emit(ctx, regionOpenTag(imgId, "image", pageNo(ctx)));
|
|
@@ -57344,12 +57382,12 @@ function readSectionGeom(root) {
|
|
|
57344
57382
|
const pagePr = findFirst(root, "pagePr");
|
|
57345
57383
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
57346
57384
|
let PW = num2(pagePr, "width", 59528), PH = num2(pagePr, "height", 84188);
|
|
57347
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
57385
|
+
if (_optionalChain([pagePr, 'optionalAccess', _1713 => _1713.getAttribute, 'call', _1714 => _1714("landscape")]) === "NARROWLY" && PW < PH) {
|
|
57348
57386
|
const t = PW;
|
|
57349
57387
|
PW = PH;
|
|
57350
57388
|
PH = t;
|
|
57351
57389
|
}
|
|
57352
|
-
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess',
|
|
57390
|
+
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess', _1715 => _1715.getAttribute, 'call', _1716 => _1716("gutterType")]), () => ( "LEFT_ONLY")), gutter = num2(margin, "gutter", 0);
|
|
57353
57391
|
const gL = gutterType === "TOP_BOTTOM" ? 0 : gutter, gT = gutterType === "TOP_BOTTOM" ? gutter : 0;
|
|
57354
57392
|
const ML = num2(margin, "left", 8504) + gL;
|
|
57355
57393
|
const MT = num2(margin, "top", 5668) + num2(margin, "header", 0) + gT;
|
|
@@ -57379,6 +57417,19 @@ function staleTopCache(root, BODY_H) {
|
|
|
57379
57417
|
}
|
|
57380
57418
|
return false;
|
|
57381
57419
|
}
|
|
57420
|
+
function overrunTopCache(root, BODY_H) {
|
|
57421
|
+
if (BODY_H <= 0) return false;
|
|
57422
|
+
let over = 0;
|
|
57423
|
+
for (const p of elements(root)) {
|
|
57424
|
+
if (ln(p) !== "p") continue;
|
|
57425
|
+
const lsa = findChildByLocalName(p, "linesegarray");
|
|
57426
|
+
for (const sg of lsa ? elements(lsa) : []) if (ln(sg) === "lineseg") {
|
|
57427
|
+
over = num2(sg, "vertpos") > BODY_H ? over + 1 : 0;
|
|
57428
|
+
if (over >= 3) return true;
|
|
57429
|
+
}
|
|
57430
|
+
}
|
|
57431
|
+
return false;
|
|
57432
|
+
}
|
|
57382
57433
|
function absoluteTopCache(root, ML, BODY_W) {
|
|
57383
57434
|
let tot = 0, over = 0;
|
|
57384
57435
|
for (const p of elements(root)) {
|
|
@@ -57396,7 +57447,7 @@ function absoluteTopCache(root, ML, BODY_W) {
|
|
|
57396
57447
|
function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters = [], hasDeletionMarkers = true, lastSection = true) {
|
|
57397
57448
|
const { PW, PH, ML, MT, BODY_W, BODY_H } = geom;
|
|
57398
57449
|
if (hasDeletionMarkers) prepareDeletedRanges(root);
|
|
57399
|
-
const degenerate = staleTopCache(root, BODY_H);
|
|
57450
|
+
const degenerate = staleTopCache(root, BODY_H) || overrunTopCache(root, BODY_H);
|
|
57400
57451
|
if (degenerate) {
|
|
57401
57452
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
57402
57453
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
@@ -57404,9 +57455,22 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57404
57455
|
}
|
|
57405
57456
|
ctxBase.warnings.push("\uC870\uD310 \uCE90\uC2DC\uAC00 \uB9DE\uC9C0 \uC54A\uC544(\uCD5C\uC0C1\uC704 \uBB38\uB2E8\uC774 \uBAA8\uB450 \uAC19\uC740 \uC790\uB9AC) \uB2E4\uC2DC \uC870\uD310\uD574 \uB80C\uB354");
|
|
57406
57457
|
}
|
|
57458
|
+
for (const tc2 of Array.from(root.getElementsByTagName("*")).filter((e) => ln(e) === "tc")) {
|
|
57459
|
+
const sub = findChildByLocalName(tc2, "subList");
|
|
57460
|
+
const paras = sub ? elements(sub).filter((q) => ln(q) === "p") : [];
|
|
57461
|
+
const vs = [];
|
|
57462
|
+
for (const q of paras) {
|
|
57463
|
+
const lsa = findChildByLocalName(q, "linesegarray");
|
|
57464
|
+
for (const sg of lsa ? elements(lsa) : []) if (ln(sg) === "lineseg") vs.push(num2(sg, "vertpos"));
|
|
57465
|
+
}
|
|
57466
|
+
if (vs.length >= 3 && (vs.every((v) => v === vs[0]) || vs.some((v, i) => i >= 2 && v === vs[i - 1] && v === vs[i - 2]))) for (const q of paras) {
|
|
57467
|
+
const lsa = findChildByLocalName(q, "linesegarray");
|
|
57468
|
+
if (lsa) q.removeChild(lsa);
|
|
57469
|
+
}
|
|
57470
|
+
}
|
|
57407
57471
|
const absolute = !degenerate && absoluteTopCache(root, ML, BODY_W);
|
|
57408
57472
|
if (absolute) {
|
|
57409
|
-
for (const lsa of Array.from(root.getElementsByTagName("*")).filter((e) => ln(e) === "linesegarray")) _optionalChain([lsa, 'access',
|
|
57473
|
+
for (const lsa of Array.from(root.getElementsByTagName("*")).filter((e) => ln(e) === "linesegarray")) _optionalChain([lsa, 'access', _1717 => _1717.parentNode, 'optionalAccess', _1718 => _1718.removeChild, 'call', _1719 => _1719(lsa)]);
|
|
57410
57474
|
ctxBase.warnings.push("\uC870\uD310 \uCE90\uC2DC\uAC00 \uCABD \uAE30\uC900 \uC88C\uD45C\uB85C \uC801\uD600 \uC788\uC5B4 \uB2E4\uC2DC \uC870\uD310\uD574 \uB80C\uB354");
|
|
57411
57475
|
}
|
|
57412
57476
|
const mixed = !doReflow && !degenerate && !absolute && Array.from(root.getElementsByTagName("*")).some((p) => ln(p) === "p" && !findChildByLocalName(p, "linesegarray"));
|
|
@@ -57437,7 +57501,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57437
57501
|
let prevH = Number.NEGATIVE_INFINITY;
|
|
57438
57502
|
let prevEnd = Number.NEGATIVE_INFINITY;
|
|
57439
57503
|
let cur = 0, col = 0;
|
|
57440
|
-
let pendingEnd = 0, pendingEndY = 0;
|
|
57504
|
+
let pendingEnd = 0, pendingEndY = 0, pendingTopY = -1;
|
|
57441
57505
|
let lastEnd = 0, lastPage = -1;
|
|
57442
57506
|
let lastSA = 0;
|
|
57443
57507
|
let prevSeg;
|
|
@@ -57462,12 +57526,12 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57462
57526
|
}
|
|
57463
57527
|
if (col > 0) s.setAttribute("horzpos", String(h + Math.round(col * (colW + colGap))));
|
|
57464
57528
|
} else {
|
|
57465
|
-
if (paraFirst && pendingEnd > cur) {
|
|
57529
|
+
if (paraFirst && pendingEnd > cur && !(v > prevV && v < pendingTopY - 100)) {
|
|
57466
57530
|
cur = v < pendingEndY - 100 ? pendingEnd + 1 : pendingEnd;
|
|
57467
57531
|
pendingEnd = 0;
|
|
57468
57532
|
} else {
|
|
57469
57533
|
const brk = v < prevV ? !multiCol || h <= prevH : v === prevV && h <= prevH && prevEnd > v && v < BODY_H / 2;
|
|
57470
|
-
const pbrk = !brk && paraFirst && prevV !== Number.NEGATIVE_INFINITY && p.getAttribute("pageBreak") === "1" && (v < BODY_H / 2 || buildPara(p).objs.some((o) => !o.inline && (_nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
57534
|
+
const pbrk = !brk && paraFirst && prevV !== Number.NEGATIVE_INFINITY && p.getAttribute("pageBreak") === "1" && (v < BODY_H / 2 || buildPara(p).objs.some((o) => !o.inline && (_nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1720 => _1720(o.el, "pos"), 'optionalAccess', _1721 => _1721.getAttribute, 'call', _1722 => _1722("vertRelTo")]), () => ( "PARA"))) === "PARA" && linePushedBy(o, v, 0)));
|
|
57471
57535
|
const obrk = !brk && !pbrk && !multiCol && paraFirst && v > prevV && v < prevEnd - 100 && prevEnd + num2(s, "vertsize") > BODY_H && v < BODY_H / 2;
|
|
57472
57536
|
if (brk || pbrk || obrk) cur++;
|
|
57473
57537
|
if (brk && prevSeg && prevV + prevSeg.vs > BODY_H && v === prevSeg.vs + prevSeg.sp && prevSeg.pages[prevSeg.idx] === cur - 1) {
|
|
@@ -57497,14 +57561,14 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57497
57561
|
const ls = segEls[segEls.length - 1];
|
|
57498
57562
|
lastEnd = num2(ls, "vertpos") + num2(ls, "vertsize") + num2(ls, "spacing");
|
|
57499
57563
|
lastPage = pagesOf[pagesOf.length - 1];
|
|
57500
|
-
lastSA = _nullishCoalesce(_optionalChain([geom0, 'access',
|
|
57564
|
+
lastSA = _nullishCoalesce(_optionalChain([geom0, 'access', _1723 => _1723.get, 'call', _1724 => _1724(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1725 => _1725.spaceAfter]), () => ( 0));
|
|
57501
57565
|
}
|
|
57502
57566
|
if (!localCols && segEls.length) {
|
|
57503
57567
|
const m0 = buildPara(p);
|
|
57504
57568
|
for (const o of m0.objs) {
|
|
57505
57569
|
if (o.tag !== "tbl") continue;
|
|
57506
57570
|
const pos = findChildByLocalName(o.el, "pos"), om = findChildByLocalName(o.el, "outMargin");
|
|
57507
|
-
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
57571
|
+
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1726 => _1726.getAttribute, 'call', _1727 => _1727("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
57508
57572
|
const segK = Math.max(0, m0.segs.findIndex((sg, k) => sg.textpos <= o.index && (k === m0.segs.length - 1 || m0.segs[k + 1].textpos > o.index)));
|
|
57509
57573
|
const segV = num2(segEls[segK], "vertpos");
|
|
57510
57574
|
const h = Math.max(o.height, measureTableHeight(o.el, ctxBase.extentMemo)), omT = num2(om, "top"), omB = num2(om, "bottom");
|
|
@@ -57518,10 +57582,10 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57518
57582
|
}
|
|
57519
57583
|
const nTb = m0.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM").length;
|
|
57520
57584
|
const wrapP = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
57521
|
-
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access',
|
|
57585
|
+
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access', _1728 => _1728.get, 'call', _1729 => _1729(m0.paraPrId), 'optionalAccess', _1730 => _1730.spaceBefore]), () => ( 0)) : 0;
|
|
57522
57586
|
const stay = nTb < 2 && !m0.objs.some((q) => q.inline) && !m0.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "") && !(!o.inline && wrapP === "TOP_AND_BOTTOM" && linePushedBy(o, segV, pTop));
|
|
57523
57587
|
const nonPush = wrapP !== "TOP_AND_BOTTOM" && pTop !== void 0 && segV > pTop + sbP + 100 ? pTop + sbP : void 0;
|
|
57524
|
-
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
57588
|
+
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1731 => _1731.getAttribute, 'call', _1732 => _1732("vertOffset")]), () => ( void 0)), 0));
|
|
57525
57589
|
const paraStart = segK === 0 && pTop !== void 0 && pTop < segV ? pTop : segV;
|
|
57526
57590
|
const below = !o.inline && wrapP === "TOP_AND_BOTTOM" && voP + omT >= num2(segEls[segK], "textheight") && !linePushedBy(o, segV, pTop);
|
|
57527
57591
|
const ty = o.inline ? MT + segV + omT : nonPush !== void 0 ? MT + nonPush + omT + voP : MT + (below ? segV - (segK === 0 ? sbP : 0) : stay ? segV - sbP : pushed - voP >= -100 ? pushed - voP : paraStart) + omT + voP;
|
|
@@ -57534,9 +57598,10 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57534
57598
|
lastPage = pagesOf[pagesOf.length - 1];
|
|
57535
57599
|
continue;
|
|
57536
57600
|
}
|
|
57537
|
-
if (span2.pages > 0 && (_nullishCoalesce(pagesOf[0], () => ( cur))) + span2.pages > pendingEnd) {
|
|
57601
|
+
if (span2.pages > 0 && o.el.getAttribute("pageBreak") !== "NONE" && (_nullishCoalesce(pagesOf[0], () => ( cur))) + span2.pages > pendingEnd) {
|
|
57538
57602
|
pendingEnd = (_nullishCoalesce(pagesOf[0], () => ( cur))) + span2.pages;
|
|
57539
57603
|
pendingEndY = span2.endY - MT;
|
|
57604
|
+
pendingTopY = below && voP > 0 && ty - MT < BODY_H ? ty - MT : -1;
|
|
57540
57605
|
}
|
|
57541
57606
|
}
|
|
57542
57607
|
}
|
|
@@ -57549,7 +57614,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57549
57614
|
for (const p of elements(root)) {
|
|
57550
57615
|
if (ln(p) !== "p") continue;
|
|
57551
57616
|
const pg = paraSegPages.get(p);
|
|
57552
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
57617
|
+
if (!_optionalChain([pg, 'optionalAccess', _1733 => _1733.length])) continue;
|
|
57553
57618
|
const pm = buildPara(p);
|
|
57554
57619
|
if (pm.objs.length || pm.chars.some((c) => c.ch.trim() !== "" || !!c.ctrlText)) lastContent = Math.max(lastContent, ...pg);
|
|
57555
57620
|
}
|
|
@@ -57566,7 +57631,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57566
57631
|
for (const p of elements(root)) {
|
|
57567
57632
|
if (ln(p) !== "p") continue;
|
|
57568
57633
|
const pg = paraSegPages.get(p);
|
|
57569
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
57634
|
+
if (!_optionalChain([pg, 'optionalAccess', _1734 => _1734.includes, 'call', _1735 => _1735(lastContent)])) continue;
|
|
57570
57635
|
const pm = buildPara(p);
|
|
57571
57636
|
pm.segs.forEach((sg, k) => {
|
|
57572
57637
|
if (pg[k] !== lastContent) return;
|
|
@@ -57586,7 +57651,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57586
57651
|
const ens = endNoteLayout(root, paraSegPages, geom);
|
|
57587
57652
|
const ctx = {
|
|
57588
57653
|
...ctxBase,
|
|
57589
|
-
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
57654
|
+
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1736 => _1736.pageCount]), () => ( 0))) }, () => []),
|
|
57590
57655
|
page: 0,
|
|
57591
57656
|
geom,
|
|
57592
57657
|
pageH,
|
|
@@ -57645,7 +57710,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57645
57710
|
ctx.bodyDx = void 0;
|
|
57646
57711
|
wrapMirror(ctx.pages, (page) => _nullishCoalesce(bodyStart[page], () => ( 0)));
|
|
57647
57712
|
const allPages = new Map(paraSegPages);
|
|
57648
|
-
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
57713
|
+
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1737 => _1737.paras]), () => ( []))) allPages.set(e.p, e.pages);
|
|
57649
57714
|
drawPageDecor(root, allPages, ctx, localCols ? nCol : 1, colW, colGap);
|
|
57650
57715
|
drawPageNumbers(root, paraSegPages, ctx);
|
|
57651
57716
|
ctx.page = 0;
|
|
@@ -57715,7 +57780,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
57715
57780
|
const hidden = /* @__PURE__ */ new Set();
|
|
57716
57781
|
const restarts = [];
|
|
57717
57782
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
57718
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
57783
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1738 => _1738.get, 'call', _1739 => _1739(p), 'optionalAccess', _1740 => _1740[0]]), () => ( 0));
|
|
57719
57784
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
57720
57785
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
57721
57786
|
const pn = findChildByLocalName(ctrl, "pageNum"), ph = findChildByLocalName(ctrl, "pageHiding"), nn = findChildByLocalName(ctrl, "newNum");
|
|
@@ -57771,7 +57836,7 @@ function renderSectionRoots(sections, input) {
|
|
|
57771
57836
|
return pm.objs.length > 0 || pm.chars.some((c) => c.ch.trim() !== "" || !!c.ctrlText);
|
|
57772
57837
|
});
|
|
57773
57838
|
let lastIdx = sections.length - 1;
|
|
57774
|
-
while (lastIdx > 0 && !hasContent(sections[lastIdx].root)) lastIdx--;
|
|
57839
|
+
while (lastIdx > 0 && !hasContent(sections[lastIdx].root) && !_optionalChain([sections, 'access', _1741 => _1741[lastIdx], 'access', _1742 => _1742.masterPages, 'optionalAccess', _1743 => _1743.length])) lastIdx--;
|
|
57775
57840
|
for (const [k, { root, index, masterPages, hasDeletionMarkers }] of sections.entries()) {
|
|
57776
57841
|
if (k > lastIdx) break;
|
|
57777
57842
|
const geom = readSectionGeom(root);
|
|
@@ -57779,34 +57844,34 @@ function renderSectionRoots(sections, input) {
|
|
|
57779
57844
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
57780
57845
|
ctxBase.pageBase += pages.length;
|
|
57781
57846
|
}
|
|
57782
|
-
if (rendered.length === 0) throw new (0,
|
|
57847
|
+
if (rendered.length === 0) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
57783
57848
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
57784
57849
|
}
|
|
57785
57850
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
57786
57851
|
async function renderHwpxInternal(input, options) {
|
|
57787
57852
|
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1744 => _1744.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
57788
57853
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
57789
|
-
|
|
57854
|
+
_chunkOMGCVZ4Wcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
57790
57855
|
let zip;
|
|
57791
57856
|
try {
|
|
57792
57857
|
zip = await _jszip2.default.loadAsync(input);
|
|
57793
57858
|
} catch (e50) {
|
|
57794
|
-
throw new (0,
|
|
57859
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
57795
57860
|
}
|
|
57796
|
-
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) =>
|
|
57797
|
-
if (secFiles.length === 0) throw new (0,
|
|
57861
|
+
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => _chunkOMGCVZ4Wcjs.compareSectionPaths.call(void 0, a.name, b.name));
|
|
57862
|
+
if (secFiles.length === 0) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
57798
57863
|
const warnings = [];
|
|
57799
57864
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
57800
57865
|
const verFile = zip.file("version.xml");
|
|
57801
57866
|
const verXml = verFile ? await readZipEntry(verFile, "text") : void 0;
|
|
57802
57867
|
const appMajor = hwpxAppMajor(verXml), appBuild = hwpxAppBuild(verXml);
|
|
57803
|
-
const headXml = headFile ?
|
|
57868
|
+
const headXml = headFile ? _chunkOMGCVZ4Wcjs.stripDtd.call(void 0, await readZipEntry(headFile, "text")) : void 0;
|
|
57804
57869
|
let styles = headXml ? parseRenderStyles(headXml, { appMajor, appBuild }) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
57805
57870
|
if (!headFile) warnings.push("header.xml \uC5C6\uC74C \u2014 \uAE30\uBCF8 \uC2A4\uD0C0\uC77C\uB85C \uB80C\uB354");
|
|
57806
57871
|
const secXmls = [];
|
|
57807
57872
|
for (const f of secFiles) {
|
|
57808
|
-
const xml =
|
|
57809
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
57873
|
+
const xml = _chunkOMGCVZ4Wcjs.stripDtd.call(void 0, await readZipEntry(f, "text"));
|
|
57874
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
57810
57875
|
secXmls.push(xml);
|
|
57811
57876
|
}
|
|
57812
57877
|
if (headXml && hasKoPubSubst(headXml)) {
|
|
@@ -57816,8 +57881,8 @@ async function renderHwpxInternal(input, options) {
|
|
|
57816
57881
|
const masterPages = /* @__PURE__ */ new Map();
|
|
57817
57882
|
const masterXmls = [];
|
|
57818
57883
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
57819
|
-
const xml =
|
|
57820
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
57884
|
+
const xml = _chunkOMGCVZ4Wcjs.stripDtd.call(void 0, await readZipEntry(file, "text"));
|
|
57885
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uBC14\uD0D5\uCABD XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
57821
57886
|
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
57822
57887
|
if (root && ln(root) === "masterPage") {
|
|
57823
57888
|
masterPages.set(root.getAttribute("id") || file.name.replace(/^.*\/|\.xml$/g, ""), root);
|
|
@@ -57893,9 +57958,9 @@ async function renderHwpxInternal(input, options) {
|
|
|
57893
57958
|
}
|
|
57894
57959
|
if (roots.length === 0) {
|
|
57895
57960
|
if (noCacheSkipped) {
|
|
57896
|
-
throw new (0,
|
|
57961
|
+
throw new (0, _chunkOMGCVZ4Wcjs.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)");
|
|
57897
57962
|
}
|
|
57898
|
-
throw new (0,
|
|
57963
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
57899
57964
|
}
|
|
57900
57965
|
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1747 => _1747.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1748 => _1748.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1749 => _1749.highlights]) });
|
|
57901
57966
|
}
|
|
@@ -58120,7 +58185,7 @@ var FOLD_END = 42124;
|
|
|
58120
58185
|
var FOLD_SHIFT = 983040 - 40960;
|
|
58121
58186
|
function textChar(ch) {
|
|
58122
58187
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
58123
|
-
const mapped =
|
|
58188
|
+
const mapped = _chunkB5M676H3cjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
58124
58189
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
58125
58190
|
}
|
|
58126
58191
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -58505,7 +58570,7 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
58505
58570
|
}
|
|
58506
58571
|
roots.push({ root, index: si });
|
|
58507
58572
|
}
|
|
58508
|
-
if (roots.length === 0) throw new (0,
|
|
58573
|
+
if (roots.length === 0) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
58509
58574
|
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1758 => _1758.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1759 => _1759.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1760 => _1760.highlights]) });
|
|
58510
58575
|
return assemblePageSvgs(r, "hwp", select);
|
|
58511
58576
|
}
|
|
@@ -58518,7 +58583,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
58518
58583
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
58519
58584
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
58520
58585
|
const sections = readHwp5SectionStreams(c);
|
|
58521
|
-
if (sections.length === 0) throw new (0,
|
|
58586
|
+
if (sections.length === 0) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
58522
58587
|
const parseWarnings = [];
|
|
58523
58588
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
58524
58589
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -58604,14 +58669,14 @@ async function loadSharp() {
|
|
|
58604
58669
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
58605
58670
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
58606
58671
|
} catch (e53) {
|
|
58607
|
-
throw new (0,
|
|
58608
|
-
'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.' +
|
|
58672
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(
|
|
58673
|
+
'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.' + _chunkOMGCVZ4Wcjs.OPTIONAL_DEP_INSTALL_HINT
|
|
58609
58674
|
);
|
|
58610
58675
|
}
|
|
58611
58676
|
}
|
|
58612
58677
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
58613
58678
|
const sharp = await loadSharp();
|
|
58614
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
58679
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
58615
58680
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
58616
58681
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
58617
58682
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -58629,11 +58694,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
58629
58694
|
try {
|
|
58630
58695
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
58631
58696
|
} catch (e54) {
|
|
58632
|
-
throw new (0,
|
|
58697
|
+
throw new (0, _chunkOMGCVZ4Wcjs.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");
|
|
58633
58698
|
}
|
|
58634
58699
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
58635
58700
|
if (!executablePath) {
|
|
58636
|
-
throw new (0,
|
|
58701
|
+
throw new (0, _chunkOMGCVZ4Wcjs.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");
|
|
58637
58702
|
}
|
|
58638
58703
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
58639
58704
|
try {
|
|
@@ -58649,13 +58714,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
58649
58714
|
async function loadBuffer(input) {
|
|
58650
58715
|
if (typeof input === "string") {
|
|
58651
58716
|
try {
|
|
58652
|
-
return
|
|
58717
|
+
return _chunkOMGCVZ4Wcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
58653
58718
|
} catch (err) {
|
|
58654
58719
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
58655
|
-
throw new (0,
|
|
58720
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
58656
58721
|
}
|
|
58657
58722
|
}
|
|
58658
|
-
if (Buffer.isBuffer(input)) return
|
|
58723
|
+
if (Buffer.isBuffer(input)) return _chunkOMGCVZ4Wcjs.toArrayBuffer.call(void 0, input);
|
|
58659
58724
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
58660
58725
|
return input;
|
|
58661
58726
|
}
|
|
@@ -58664,17 +58729,17 @@ async function sourceFormatOf(buffer) {
|
|
|
58664
58729
|
if (format2 === "hwpx") {
|
|
58665
58730
|
const zip = await detectZipFormat(buffer);
|
|
58666
58731
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
58667
|
-
throw new (0,
|
|
58732
|
+
throw new (0, _chunkOMGCVZ4Wcjs.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`);
|
|
58668
58733
|
}
|
|
58669
58734
|
if (format2 === "hwp") return "hwp";
|
|
58670
|
-
throw new (0,
|
|
58735
|
+
throw new (0, _chunkOMGCVZ4Wcjs.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`);
|
|
58671
58736
|
}
|
|
58672
58737
|
async function renderDocumentToScene(input, options = {}) {
|
|
58673
58738
|
const buffer = await loadBuffer(input);
|
|
58674
58739
|
const source = await sourceFormatOf(buffer);
|
|
58675
58740
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
58676
58741
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
58677
|
-
if (set.size === 0) throw new (0,
|
|
58742
|
+
if (set.size === 0) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
58678
58743
|
return set;
|
|
58679
58744
|
} : void 0;
|
|
58680
58745
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -58710,7 +58775,7 @@ async function renderDocument(input, options) {
|
|
|
58710
58775
|
break;
|
|
58711
58776
|
}
|
|
58712
58777
|
default:
|
|
58713
|
-
throw new (0,
|
|
58778
|
+
throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
58714
58779
|
}
|
|
58715
58780
|
return { scene, assets };
|
|
58716
58781
|
}
|
|
@@ -58740,7 +58805,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
58740
58805
|
const out = [];
|
|
58741
58806
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
58742
58807
|
const meta = scene.pages.find((p) => p.page === page);
|
|
58743
|
-
if (!meta) throw new (0,
|
|
58808
|
+
if (!meta) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
58744
58809
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
58745
58810
|
for (const { region, bbox } of items) {
|
|
58746
58811
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -58764,9 +58829,9 @@ function wantsCrop(kind, policy) {
|
|
|
58764
58829
|
}
|
|
58765
58830
|
async function extractTables(input, options = {}) {
|
|
58766
58831
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
58767
|
-
const buffer = typeof input === "string" ?
|
|
58832
|
+
const buffer = typeof input === "string" ? _chunkOMGCVZ4Wcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkOMGCVZ4Wcjs.toArrayBuffer.call(void 0, input) : input;
|
|
58768
58833
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
58769
|
-
if (!parsed.success) throw new (0,
|
|
58834
|
+
if (!parsed.success) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
58770
58835
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
58771
58836
|
const out = blocks.map((b, i) => ({
|
|
58772
58837
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -58828,18 +58893,18 @@ async function parse(input, options) {
|
|
|
58828
58893
|
if (_optionalChain([opts, 'optionalAccess', _1762 => _1762.htmlTables]) && opts.tableFormat) {
|
|
58829
58894
|
return { success: false, fileType: "unknown", error: "htmlTables \uC640 tableFormat \uC740 \uD568\uAED8 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4" };
|
|
58830
58895
|
}
|
|
58831
|
-
const ocrOptionError =
|
|
58896
|
+
const ocrOptionError = _chunkB5M676H3cjs.validateOcrOptions.call(void 0, opts);
|
|
58832
58897
|
if (ocrOptionError) return { success: false, fileType: "unknown", error: ocrOptionError };
|
|
58833
58898
|
if (typeof input === "string") {
|
|
58834
58899
|
try {
|
|
58835
58900
|
const buf = await _promises.readFile.call(void 0, input);
|
|
58836
|
-
buffer =
|
|
58901
|
+
buffer = _chunkOMGCVZ4Wcjs.toArrayBuffer.call(void 0, buf);
|
|
58837
58902
|
} catch (err) {
|
|
58838
58903
|
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}`;
|
|
58839
|
-
return { success: false, fileType: "unknown", error: msg2, code:
|
|
58904
|
+
return { success: false, fileType: "unknown", error: msg2, code: _chunkOMGCVZ4Wcjs.classifyError.call(void 0, err) };
|
|
58840
58905
|
}
|
|
58841
58906
|
} else if (Buffer.isBuffer(input)) {
|
|
58842
|
-
buffer =
|
|
58907
|
+
buffer = _chunkOMGCVZ4Wcjs.toArrayBuffer.call(void 0, input);
|
|
58843
58908
|
} else {
|
|
58844
58909
|
buffer = input;
|
|
58845
58910
|
}
|
|
@@ -58858,7 +58923,7 @@ async function parse(input, options) {
|
|
|
58858
58923
|
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` }] };
|
|
58859
58924
|
}
|
|
58860
58925
|
if (out.success && !out.pages) {
|
|
58861
|
-
const pages =
|
|
58926
|
+
const pages = _chunkWVZSTMCZcjs.blocksToPages.call(void 0, out.blocks, (bs) => _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([opts, 'optionalAccess', _1766 => _1766.tableFormat]) }));
|
|
58862
58927
|
if (pages) out = { ...out, pages };
|
|
58863
58928
|
}
|
|
58864
58929
|
if (out.success && _optionalChain([opts, 'optionalAccess', _1767 => _1767.plain])) {
|
|
@@ -58909,34 +58974,34 @@ async function dispatch(format2, buffer, opts) {
|
|
|
58909
58974
|
async function withEmbeddedImageOcr(blocks, markdown, warnings, images, options) {
|
|
58910
58975
|
const list = [..._nullishCoalesce(warnings, () => ( []))];
|
|
58911
58976
|
if (!await ocrEmbeddedImages(blocks, options, list)) return { markdown, warnings: list.length ? list : void 0 };
|
|
58912
|
-
let md2 =
|
|
58977
|
+
let md2 = _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1769 => _1769.tableFormat]) });
|
|
58913
58978
|
if (_optionalChain([options, 'optionalAccess', _1770 => _1770.inlineImages]) && options.images !== false && _optionalChain([images, 'optionalAccess', _1771 => _1771.length])) {
|
|
58914
58979
|
try {
|
|
58915
|
-
md2 =
|
|
58980
|
+
md2 = _chunkWVZSTMCZcjs.inlineImagesIntoMarkdown.call(void 0, md2, images, { compress: true });
|
|
58916
58981
|
} catch (e55) {
|
|
58917
58982
|
}
|
|
58918
58983
|
}
|
|
58919
58984
|
return { markdown: md2, warnings: list.length ? list : void 0 };
|
|
58920
58985
|
}
|
|
58921
58986
|
function scriptsOff(r, off) {
|
|
58922
|
-
return off ?
|
|
58987
|
+
return off ? _chunkB5M676H3cjs.stripScriptTags.call(void 0, r) : r;
|
|
58923
58988
|
}
|
|
58924
58989
|
async function parseImage(buffer, options) {
|
|
58925
58990
|
try {
|
|
58926
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
58991
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-THUO6YRG.cjs")));
|
|
58927
58992
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
58928
|
-
|
|
58993
|
+
_chunkB5M676H3cjs.stripScriptTags.call(void 0, { blocks });
|
|
58929
58994
|
return {
|
|
58930
58995
|
success: true,
|
|
58931
58996
|
fileType: "image",
|
|
58932
|
-
markdown:
|
|
58997
|
+
markdown: _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1772 => _1772.tableFormat]) }),
|
|
58933
58998
|
blocks,
|
|
58934
58999
|
warnings: warnings.length ? warnings : void 0,
|
|
58935
59000
|
pageCount: 1,
|
|
58936
59001
|
..._optionalChain([options, 'optionalAccess', _1773 => _1773.ocrLines]) ? { ocrLines: lines ? [lines] : [] } : {}
|
|
58937
59002
|
};
|
|
58938
59003
|
} catch (err) {
|
|
58939
|
-
return { success: false, fileType: "image", error:
|
|
59004
|
+
return { success: false, fileType: "image", error: _chunkOMGCVZ4Wcjs.sanitizeError.call(void 0, err), code: _chunkOMGCVZ4Wcjs.classifyError.call(void 0, err) };
|
|
58940
59005
|
}
|
|
58941
59006
|
}
|
|
58942
59007
|
async function parseHwp3(buffer, options) {
|
|
@@ -58944,7 +59009,7 @@ async function parseHwp3(buffer, options) {
|
|
|
58944
59009
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp3Document(buffer, options);
|
|
58945
59010
|
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess', _1774 => _1774.pageCount]) };
|
|
58946
59011
|
} catch (err) {
|
|
58947
|
-
return { success: false, fileType: "hwp3", error:
|
|
59012
|
+
return { success: false, fileType: "hwp3", error: _chunkOMGCVZ4Wcjs.sanitizeError.call(void 0, err), code: _chunkOMGCVZ4Wcjs.classifyError.call(void 0, err) };
|
|
58948
59013
|
}
|
|
58949
59014
|
}
|
|
58950
59015
|
async function parseHwpx(buffer, options) {
|
|
@@ -58954,7 +59019,7 @@ async function parseHwpx(buffer, options) {
|
|
|
58954
59019
|
const { markdown, warnings } = await withEmbeddedImageOcr(blocks, doc.markdown, doc.warnings, void 0, options);
|
|
58955
59020
|
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1775 => _1775.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1776 => _1776.pageCount]) }, _optionalChain([options, 'optionalAccess', _1777 => _1777.scriptTags]) === false);
|
|
58956
59021
|
} catch (err) {
|
|
58957
|
-
return { success: false, fileType: "hwpx", error:
|
|
59022
|
+
return { success: false, fileType: "hwpx", error: _chunkOMGCVZ4Wcjs.sanitizeError.call(void 0, err), code: _chunkOMGCVZ4Wcjs.classifyError.call(void 0, err) };
|
|
58958
59023
|
}
|
|
58959
59024
|
}
|
|
58960
59025
|
async function parseHwp(buffer, options) {
|
|
@@ -58981,13 +59046,13 @@ async function parseHwp(buffer, options) {
|
|
|
58981
59046
|
const ocred = await withEmbeddedImageOcr(blocks, markdown, warnings, images, options);
|
|
58982
59047
|
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess', _1779 => _1779.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1780 => _1780.pageCount]) }, _optionalChain([options, 'optionalAccess', _1781 => _1781.scriptTags]) === false);
|
|
58983
59048
|
} catch (err) {
|
|
58984
|
-
return { success: false, fileType: "hwp", error:
|
|
59049
|
+
return { success: false, fileType: "hwp", error: _chunkOMGCVZ4Wcjs.sanitizeError.call(void 0, err), code: _chunkOMGCVZ4Wcjs.classifyError.call(void 0, err) };
|
|
58985
59050
|
}
|
|
58986
59051
|
}
|
|
58987
59052
|
async function parsePdf(buffer, options) {
|
|
58988
59053
|
let parsePdfDocument;
|
|
58989
59054
|
try {
|
|
58990
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
59055
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-GJ4PKW7I.cjs")));
|
|
58991
59056
|
parsePdfDocument = mod.parsePdfDocument;
|
|
58992
59057
|
} catch (e57) {
|
|
58993
59058
|
return {
|
|
@@ -59002,7 +59067,7 @@ async function parsePdf(buffer, options) {
|
|
|
59002
59067
|
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _1782 => _1782.pageCount]), ...ocrLines ? { ocrLines } : {} }, _optionalChain([options, 'optionalAccess', _1783 => _1783.scriptTags]) !== true);
|
|
59003
59068
|
} catch (err) {
|
|
59004
59069
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
59005
|
-
return { success: false, fileType: "pdf", error:
|
|
59070
|
+
return { success: false, fileType: "pdf", error: _chunkOMGCVZ4Wcjs.sanitizeError.call(void 0, err), code: _chunkOMGCVZ4Wcjs.classifyError.call(void 0, err), isImageBased };
|
|
59006
59071
|
}
|
|
59007
59072
|
}
|
|
59008
59073
|
async function parseXlsx(buffer, options) {
|
|
@@ -59010,7 +59075,7 @@ async function parseXlsx(buffer, options) {
|
|
|
59010
59075
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
59011
59076
|
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1784 => _1784.pageCount]) };
|
|
59012
59077
|
} catch (err) {
|
|
59013
|
-
return { success: false, fileType: "xlsx", error:
|
|
59078
|
+
return { success: false, fileType: "xlsx", error: _chunkOMGCVZ4Wcjs.sanitizeError.call(void 0, err), code: _chunkOMGCVZ4Wcjs.classifyError.call(void 0, err) };
|
|
59014
59079
|
}
|
|
59015
59080
|
}
|
|
59016
59081
|
async function parseXls(buffer, options) {
|
|
@@ -59018,7 +59083,7 @@ async function parseXls(buffer, options) {
|
|
|
59018
59083
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
59019
59084
|
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1785 => _1785.pageCount]) };
|
|
59020
59085
|
} catch (err) {
|
|
59021
|
-
return { success: false, fileType: "xls", error:
|
|
59086
|
+
return { success: false, fileType: "xls", error: _chunkOMGCVZ4Wcjs.sanitizeError.call(void 0, err), code: _chunkOMGCVZ4Wcjs.classifyError.call(void 0, err) };
|
|
59022
59087
|
}
|
|
59023
59088
|
}
|
|
59024
59089
|
async function parseDocx(buffer, options) {
|
|
@@ -59026,7 +59091,7 @@ async function parseDocx(buffer, options) {
|
|
|
59026
59091
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
59027
59092
|
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1786 => _1786.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1787 => _1787.pageCount]) }, _optionalChain([options, 'optionalAccess', _1788 => _1788.scriptTags]) === false);
|
|
59028
59093
|
} catch (err) {
|
|
59029
|
-
return { success: false, fileType: "docx", error:
|
|
59094
|
+
return { success: false, fileType: "docx", error: _chunkOMGCVZ4Wcjs.sanitizeError.call(void 0, err), code: _chunkOMGCVZ4Wcjs.classifyError.call(void 0, err) };
|
|
59030
59095
|
}
|
|
59031
59096
|
}
|
|
59032
59097
|
async function parsePptx(buffer, options) {
|
|
@@ -59034,7 +59099,7 @@ async function parsePptx(buffer, options) {
|
|
|
59034
59099
|
const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
|
|
59035
59100
|
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1789 => _1789.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1790 => _1790.pageCount]) }, _optionalChain([options, 'optionalAccess', _1791 => _1791.scriptTags]) === false);
|
|
59036
59101
|
} catch (err) {
|
|
59037
|
-
return { success: false, fileType: "pptx", error:
|
|
59102
|
+
return { success: false, fileType: "pptx", error: _chunkOMGCVZ4Wcjs.sanitizeError.call(void 0, err), code: _chunkOMGCVZ4Wcjs.classifyError.call(void 0, err) };
|
|
59038
59103
|
}
|
|
59039
59104
|
}
|
|
59040
59105
|
async function parseHwpml(buffer, options) {
|
|
@@ -59042,16 +59107,16 @@ async function parseHwpml(buffer, options) {
|
|
|
59042
59107
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
59043
59108
|
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1792 => _1792.pageCount]) };
|
|
59044
59109
|
} catch (err) {
|
|
59045
|
-
return { success: false, fileType: "hwpml", error:
|
|
59110
|
+
return { success: false, fileType: "hwpml", error: _chunkOMGCVZ4Wcjs.sanitizeError.call(void 0, err), code: _chunkOMGCVZ4Wcjs.classifyError.call(void 0, err) };
|
|
59046
59111
|
}
|
|
59047
59112
|
}
|
|
59048
59113
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
59049
59114
|
let buffer;
|
|
59050
59115
|
if (typeof input === "string") {
|
|
59051
59116
|
const buf = await _promises.readFile.call(void 0, input);
|
|
59052
|
-
buffer =
|
|
59117
|
+
buffer = _chunkOMGCVZ4Wcjs.toArrayBuffer.call(void 0, buf);
|
|
59053
59118
|
} else if (Buffer.isBuffer(input)) {
|
|
59054
|
-
buffer =
|
|
59119
|
+
buffer = _chunkOMGCVZ4Wcjs.toArrayBuffer.call(void 0, input);
|
|
59055
59120
|
} else {
|
|
59056
59121
|
buffer = input;
|
|
59057
59122
|
}
|
|
@@ -59077,7 +59142,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
59077
59142
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
59078
59143
|
}
|
|
59079
59144
|
const fill = fillFormFields(parsed.blocks, values);
|
|
59080
|
-
const markdown =
|
|
59145
|
+
const markdown = _chunkB5M676H3cjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
59081
59146
|
if (outputFormat === "hwpx") {
|
|
59082
59147
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
59083
59148
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -59193,5 +59258,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
59193
59258
|
|
|
59194
59259
|
|
|
59195
59260
|
|
|
59196
|
-
exports.AGENCY_COMMON_NAME = AGENCY_COMMON_NAME; exports.BUILTIN_TEMPLATES = BUILTIN_TEMPLATES; exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION =
|
|
59261
|
+
exports.AGENCY_COMMON_NAME = AGENCY_COMMON_NAME; exports.BUILTIN_TEMPLATES = BUILTIN_TEMPLATES; exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkOMGCVZ4Wcjs.VERSION; exports.ValueCursor = ValueCursor; exports.agencyNames = agencyNames; exports.agencyStyle = agencyStyle; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkB5M676H3cjs.blocksToMarkdown; exports.blocksToPages = _chunkWVZSTMCZcjs.blocksToPages; exports.blocksToPdf = blocksToPdf; exports.buildAgencyPack = buildAgencyPack; 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 = _chunkB5M676H3cjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.formatGateFinding = formatGateFinding; exports.gongmunGate = gongmunGate; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunkB5M676H3cjs.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.lintBlocks = lintBlocks; exports.lintBudgetText = lintBudgetText; exports.lintGongmunText = lintGongmunText; exports.lintLogicText = lintLogicText; exports.lintMuncheText = lintMuncheText; exports.lintSlopText = lintSlopText; exports.loadAgencyPack = loadAgencyPack; exports.logicLintWarnings = logicLintWarnings; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.muncheLintWarnings = muncheLintWarnings; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.packRoleWarnings = packRoleWarnings; exports.packSummary = packSummary; exports.packTemplate = packTemplate; 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.placeTotalRow = placeTotalRow; 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.resolvePackKind = resolvePackKind; exports.runLintSuite = runLintSuite; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.slopLintWarnings = slopLintWarnings; exports.unknownFontWarnings = unknownFontWarnings; exports.usesGaejosikMunche = usesGaejosikMunche; exports.usesLogicStructure = usesLogicStructure; exports.validateHwpx = validateHwpx;
|
|
59197
59262
|
//# sourceMappingURL=index.cjs.map
|