kordoc 4.22.13 → 4.22.15
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 +10 -6
- package/dist/{-WQIGIQTE.js → -QKNGJHAZ.js} +11 -11
- package/dist/{chunk-DO3TPBBJ.js → chunk-4BEGCKHJ.js} +2 -2
- package/dist/{chunk-6VNSISFI.js → chunk-5BA72NJJ.js} +34 -12
- package/dist/chunk-5BA72NJJ.js.map +1 -0
- package/dist/{chunk-ZEVEVTRG.cjs → chunk-5N6MENH6.cjs} +6 -6
- package/dist/{chunk-ZEVEVTRG.cjs.map → chunk-5N6MENH6.cjs.map} +1 -1
- package/dist/{chunk-EMEEVTP2.js → chunk-7QEYWKCX.js} +2 -2
- package/dist/{chunk-47NQ362T.js → chunk-7RWA3PZ4.js} +2 -2
- package/dist/{chunk-47NQ362T.js.map → chunk-7RWA3PZ4.js.map} +1 -1
- package/dist/{chunk-M3YLZLHF.js → chunk-AIK55H5I.js} +3 -3
- package/dist/{chunk-AXKG24PC.cjs → chunk-AUENDUDZ.cjs} +3 -3
- package/dist/{chunk-AXKG24PC.cjs.map → chunk-AUENDUDZ.cjs.map} +1 -1
- package/dist/{chunk-T4JZ7DGA.js → chunk-B5M5SQKA.js} +2 -2
- package/dist/{chunk-T2BVIFDL.js → chunk-BH4PFHF5.js} +4 -4
- package/dist/{chunk-RQII7NRF.js → chunk-C7GEA5EE.js} +2 -2
- package/dist/{chunk-3FXLQRWO.js → chunk-CHVZJ657.js} +4 -4
- package/dist/{chunk-MKRVPDDJ.js → chunk-DM67WSTH.js} +2 -2
- package/dist/{chunk-MKRVPDDJ.js.map → chunk-DM67WSTH.js.map} +1 -1
- package/dist/{chunk-Q7BAXRRK.js → chunk-DQRHLLZX.js} +3 -3
- package/dist/{chunk-KGO5RHY2.js → chunk-ETER5U3Z.js} +2 -2
- package/dist/{chunk-LKHXRJX2.js → chunk-H66FRBTO.js} +2 -2
- package/dist/{chunk-JOHVSCHT.cjs → chunk-ILRCRR54.cjs} +2 -2
- package/dist/{chunk-JOHVSCHT.cjs.map → chunk-ILRCRR54.cjs.map} +1 -1
- package/dist/{chunk-GZEVDQ7S.cjs → chunk-KXTCBOUC.cjs} +3 -3
- package/dist/{chunk-GZEVDQ7S.cjs.map → chunk-KXTCBOUC.cjs.map} +1 -1
- package/dist/{chunk-DUTPIML6.js → chunk-L66D5JSX.js} +2 -2
- package/dist/{chunk-GBJNTGVV.js → chunk-NELX5BUF.js} +2 -2
- package/dist/{chunk-YLCNGVXU.js → chunk-OGYWOGKZ.js} +2 -2
- package/dist/{chunk-FVHGH6DG.js → chunk-PZWP7QZI.js} +3 -3
- package/dist/{chunk-AEDBCPFA.js → chunk-QCDFGYTY.js} +454 -29
- package/dist/chunk-QCDFGYTY.js.map +1 -0
- package/dist/{chunk-PE3PGTLM.js → chunk-QG35WGJY.js} +2 -2
- package/dist/{chunk-KMYZ2SBN.cjs → chunk-SOLVML3D.cjs} +24 -24
- package/dist/{chunk-KMYZ2SBN.cjs.map → chunk-SOLVML3D.cjs.map} +1 -1
- package/dist/{chunk-EQNLV4YH.js → chunk-WBDHB4XF.js} +2 -2
- package/dist/{chunk-W5B45M7Z.js → chunk-XZ34KDGA.js} +4 -4
- package/dist/{chunk-YD4TF6JI.js → chunk-YEGBKWM2.js} +2 -2
- package/dist/{chunk-GDLEO7SO.cjs → chunk-YFBPSJIK.cjs} +23 -23
- package/dist/{chunk-GDLEO7SO.cjs.map → chunk-YFBPSJIK.cjs.map} +1 -1
- package/dist/{chunk-FKMKZ3CV.js → chunk-YPXIUH4N.js} +2 -2
- package/dist/chunks-VIMWBMRT.js +10 -0
- package/dist/cli.js +32 -32
- package/dist/cli.js.map +1 -1
- package/dist/{formula-DZA6DTBT.cjs → formula-GHINZR45.cjs} +9 -9
- package/dist/{formula-DZA6DTBT.cjs.map → formula-GHINZR45.cjs.map} +1 -1
- package/dist/{formula-GAW4HYPK.js → formula-TRZNBQA7.js} +4 -4
- package/dist/{formula-Q5O27Q3L.js → formula-YQXHLN62.js} +3 -3
- package/dist/{image-ocr-SKLXAVIR.js → image-ocr-7G5BY6HP.js} +9 -9
- package/dist/{image-ocr-WHMF24OA.js → image-ocr-TMBFSD4U.js} +6 -6
- package/dist/{image-ocr-YUVG57VO.cjs → image-ocr-VS42CA7V.cjs} +17 -17
- package/dist/{image-ocr-YUVG57VO.cjs.map → image-ocr-VS42CA7V.cjs.map} +1 -1
- package/dist/index.cjs +1021 -574
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +477 -30
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +41 -33
- package/dist/mcp.js.map +1 -1
- package/dist/{model-bundle-PHYAMJXE.js → model-bundle-3N52FRRY.js} +5 -5
- package/dist/{models-B7DEVMPD.js → models-APDB3SOF.js} +5 -5
- package/dist/{parse-worker-v2-C7VA7D6M.js → parse-worker-v2-35LPGAQU.js} +12 -12
- package/dist/{parser-IBWL5DO6.cjs → parser-FVCPSKL3.cjs} +157 -157
- package/dist/{parser-IBWL5DO6.cjs.map → parser-FVCPSKL3.cjs.map} +1 -1
- package/dist/{parser-SCRC6YOP.js → parser-HSHTGLFC.js} +12 -12
- package/dist/{parser-4L4HI6KN.js → parser-QDNORIBQ.js} +9 -9
- package/dist/pdf-ocr-2J4X7BIB.cjs +31 -0
- package/dist/{pdf-ocr-BEXABEIP.cjs.map → pdf-ocr-2J4X7BIB.cjs.map} +1 -1
- package/dist/{pdf-ocr-Z62E4OGV.js → pdf-ocr-IL4EKHC2.js} +6 -6
- package/dist/{pdf-ocr-7JVAWHAF.js → pdf-ocr-K6BODKK6.js} +9 -9
- package/dist/{profile-io-T4O5ZOSF.js → profile-io-IMYZVBUB.js} +3 -3
- package/dist/{rasterize-2WOVCKGY.js → rasterize-52M5QMCF.js} +3 -3
- package/dist/{redact-doc-BS5KXZJU.js → redact-doc-OWZYVLOL.js} +11 -11
- package/dist/{render-EWFXTGYC.js → render-B4DB5V3H.js} +7 -7
- package/dist/seal-GILBR2UU.js +10 -0
- package/dist/{setup-LRMO3ZKM.js → setup-XQOG5DQH.js} +3 -3
- package/dist/visual-ZJY2HO57.js +21 -0
- package/dist/{watch-SOK25KLD.js → watch-YLHLYA2C.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-6VNSISFI.js.map +0 -1
- package/dist/chunk-AEDBCPFA.js.map +0 -1
- package/dist/chunks-FBC25VC6.js +0 -10
- package/dist/pdf-ocr-BEXABEIP.cjs +0 -31
- package/dist/seal-B2FGIQ5C.js +0 -10
- package/dist/visual-UZQZUJIA.js +0 -21
- /package/dist/{-WQIGIQTE.js.map → -QKNGJHAZ.js.map} +0 -0
- /package/dist/{chunk-DO3TPBBJ.js.map → chunk-4BEGCKHJ.js.map} +0 -0
- /package/dist/{chunk-EMEEVTP2.js.map → chunk-7QEYWKCX.js.map} +0 -0
- /package/dist/{chunk-M3YLZLHF.js.map → chunk-AIK55H5I.js.map} +0 -0
- /package/dist/{chunk-T4JZ7DGA.js.map → chunk-B5M5SQKA.js.map} +0 -0
- /package/dist/{chunk-T2BVIFDL.js.map → chunk-BH4PFHF5.js.map} +0 -0
- /package/dist/{chunk-RQII7NRF.js.map → chunk-C7GEA5EE.js.map} +0 -0
- /package/dist/{chunk-3FXLQRWO.js.map → chunk-CHVZJ657.js.map} +0 -0
- /package/dist/{chunk-Q7BAXRRK.js.map → chunk-DQRHLLZX.js.map} +0 -0
- /package/dist/{chunk-KGO5RHY2.js.map → chunk-ETER5U3Z.js.map} +0 -0
- /package/dist/{chunk-LKHXRJX2.js.map → chunk-H66FRBTO.js.map} +0 -0
- /package/dist/{chunk-DUTPIML6.js.map → chunk-L66D5JSX.js.map} +0 -0
- /package/dist/{chunk-GBJNTGVV.js.map → chunk-NELX5BUF.js.map} +0 -0
- /package/dist/{chunk-YLCNGVXU.js.map → chunk-OGYWOGKZ.js.map} +0 -0
- /package/dist/{chunk-FVHGH6DG.js.map → chunk-PZWP7QZI.js.map} +0 -0
- /package/dist/{chunk-PE3PGTLM.js.map → chunk-QG35WGJY.js.map} +0 -0
- /package/dist/{chunk-EQNLV4YH.js.map → chunk-WBDHB4XF.js.map} +0 -0
- /package/dist/{chunk-W5B45M7Z.js.map → chunk-XZ34KDGA.js.map} +0 -0
- /package/dist/{chunk-YD4TF6JI.js.map → chunk-YEGBKWM2.js.map} +0 -0
- /package/dist/{chunk-FKMKZ3CV.js.map → chunk-YPXIUH4N.js.map} +0 -0
- /package/dist/{chunks-FBC25VC6.js.map → chunks-VIMWBMRT.js.map} +0 -0
- /package/dist/{formula-GAW4HYPK.js.map → formula-TRZNBQA7.js.map} +0 -0
- /package/dist/{formula-Q5O27Q3L.js.map → formula-YQXHLN62.js.map} +0 -0
- /package/dist/{image-ocr-SKLXAVIR.js.map → image-ocr-7G5BY6HP.js.map} +0 -0
- /package/dist/{image-ocr-WHMF24OA.js.map → image-ocr-TMBFSD4U.js.map} +0 -0
- /package/dist/{model-bundle-PHYAMJXE.js.map → model-bundle-3N52FRRY.js.map} +0 -0
- /package/dist/{models-B7DEVMPD.js.map → models-APDB3SOF.js.map} +0 -0
- /package/dist/{parse-worker-v2-C7VA7D6M.js.map → parse-worker-v2-35LPGAQU.js.map} +0 -0
- /package/dist/{parser-SCRC6YOP.js.map → parser-HSHTGLFC.js.map} +0 -0
- /package/dist/{parser-4L4HI6KN.js.map → parser-QDNORIBQ.js.map} +0 -0
- /package/dist/{pdf-ocr-7JVAWHAF.js.map → pdf-ocr-IL4EKHC2.js.map} +0 -0
- /package/dist/{pdf-ocr-Z62E4OGV.js.map → pdf-ocr-K6BODKK6.js.map} +0 -0
- /package/dist/{profile-io-T4O5ZOSF.js.map → profile-io-IMYZVBUB.js.map} +0 -0
- /package/dist/{rasterize-2WOVCKGY.js.map → rasterize-52M5QMCF.js.map} +0 -0
- /package/dist/{redact-doc-BS5KXZJU.js.map → redact-doc-OWZYVLOL.js.map} +0 -0
- /package/dist/{render-EWFXTGYC.js.map → render-B4DB5V3H.js.map} +0 -0
- /package/dist/{seal-B2FGIQ5C.js.map → seal-GILBR2UU.js.map} +0 -0
- /package/dist/{setup-LRMO3ZKM.js.map → setup-XQOG5DQH.js.map} +0 -0
- /package/dist/{visual-UZQZUJIA.js.map → visual-ZJY2HO57.js.map} +0 -0
- /package/dist/{watch-SOK25KLD.js.map → watch-YLHLYA2C.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkKXTCBOUCcjs = require('./chunk-KXTCBOUC.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
@@ -43,7 +43,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
var
|
|
46
|
+
var _chunk5N6MENH6cjs = require('./chunk-5N6MENH6.cjs');
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
@@ -61,14 +61,14 @@ var _chunkZEVEVTRGcjs = require('./chunk-ZEVEVTRG.cjs');
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
var
|
|
64
|
+
var _chunkILRCRR54cjs = require('./chunk-ILRCRR54.cjs');
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
68
68
|
|
|
69
69
|
// src/plain-markdown.ts
|
|
70
70
|
function toPlainMarkdown(md2) {
|
|
71
|
-
return
|
|
71
|
+
return _chunk5N6MENH6cjs.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();
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// src/html-tables.ts
|
|
@@ -473,7 +473,7 @@ Copy-Item -LiteralPath $src -Destination $tmpFile -Force
|
|
|
473
473
|
|
|
474
474
|
try {
|
|
475
475
|
$hwp = New-Object -ComObject HWPFrame.HwpObject
|
|
476
|
-
$hwp.RegisterModule('
|
|
476
|
+
$hwp.RegisterModule('FilePathCheckDLL', 'FilePathCheckerModuleExample') | Out-Null
|
|
477
477
|
# suspendpassword: \uC5F4\uAE30 \uC554\uD638\uAC00 \uAC78\uB9B0 \uBB38\uC11C\uB294 \uC554\uD638 \uC785\uB825 \uCC3D\uC744 \uB744\uC6B0\uC9C0 \uC54A\uACE0 \uBC14\uB85C \uC2E4\uD328 \u2014 \uC228\uC740 \uCC3D\uC774 \uC785\uB825\uC744 \uAE30\uB2E4\uB9AC\uBA70 \uBA48\uCD94\uB358 \uAC83 (#93)
|
|
478
478
|
$opened = $hwp.Open($tmpFile, '', 'suspendpassword:TRUE;forceopen:TRUE;versionwarning:FALSE')
|
|
479
479
|
if (-not $opened) { throw 'Open \uC2E4\uD328 (\uC5F4\uAE30 \uC554\uD638\uAC00 \uAC78\uB9B0 \uBB38\uC11C\uC77C \uC218 \uC788\uC74C)' }
|
|
@@ -602,9 +602,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
602
602
|
}
|
|
603
603
|
|
|
604
604
|
// src/hwpx/parser-shared.ts
|
|
605
|
-
var MAX_DECOMPRESS_SIZE =
|
|
605
|
+
var MAX_DECOMPRESS_SIZE = _chunkILRCRR54cjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
606
606
|
var MAX_ZIP_ENTRIES = 500;
|
|
607
|
-
var ZipBombError = class extends
|
|
607
|
+
var ZipBombError = class extends _chunkILRCRR54cjs.KordocError {
|
|
608
608
|
constructor(message) {
|
|
609
609
|
super(message);
|
|
610
610
|
this.name = "ZipBombError";
|
|
@@ -654,7 +654,7 @@ function createSectionShared() {
|
|
|
654
654
|
function createXmlParser(warnings) {
|
|
655
655
|
return new (0, _xmldom.DOMParser)({
|
|
656
656
|
onError(level, msg2) {
|
|
657
|
-
if (level === "fatalError") throw new (0,
|
|
657
|
+
if (level === "fatalError") throw new (0, _chunkILRCRR54cjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
658
658
|
_optionalChain([warnings, 'optionalAccess', _5 => _5.push, 'call', _6 => _6({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
659
659
|
}
|
|
660
660
|
});
|
|
@@ -689,13 +689,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
689
689
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
690
690
|
const checksumType = attrOf(inner, "checksum-type");
|
|
691
691
|
if (algorithm !== AES256_CBC) {
|
|
692
|
-
throw new (0,
|
|
692
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
693
693
|
}
|
|
694
694
|
if (startKey !== START_KEY_SHA256) {
|
|
695
|
-
throw new (0,
|
|
695
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
696
696
|
}
|
|
697
697
|
if (!_optionalChain([checksumType, 'optionalAccess', _10 => _10.endsWith, 'call', _11 => _11(CHECKSUM_SHA256_1K)])) {
|
|
698
|
-
throw new (0,
|
|
698
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
699
699
|
}
|
|
700
700
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
701
701
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -703,10 +703,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
703
703
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
704
704
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
705
705
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
706
|
-
throw new (0,
|
|
706
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
707
707
|
}
|
|
708
708
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
709
|
-
throw new (0,
|
|
709
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
710
710
|
}
|
|
711
711
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
712
712
|
}
|
|
@@ -740,12 +740,12 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
740
740
|
for (const entry of entries) {
|
|
741
741
|
const file = zip.file(entry.path);
|
|
742
742
|
if (!file) {
|
|
743
|
-
throw new (0,
|
|
743
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
744
744
|
}
|
|
745
745
|
const raw = await readZipEntry(file, "uint8array", used);
|
|
746
746
|
const plain4 = decryptEntry(Buffer.from(raw.buffer, raw.byteOffset, raw.length), entry, startKey);
|
|
747
747
|
if (!plain4) {
|
|
748
|
-
throw new (0,
|
|
748
|
+
throw new (0, _chunkILRCRR54cjs.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.");
|
|
749
749
|
}
|
|
750
750
|
used += plain4.length;
|
|
751
751
|
if (used > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
@@ -811,10 +811,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
811
811
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _12 => _12.total]));
|
|
812
812
|
if (decompressed) {
|
|
813
813
|
decompressed.total += xml.length * 2;
|
|
814
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
814
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkILRCRR54cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
815
815
|
}
|
|
816
816
|
const parser = createXmlParser();
|
|
817
|
-
const doc = parser.parseFromString(
|
|
817
|
+
const doc = parser.parseFromString(_chunkILRCRR54cjs.stripDtd.call(void 0, xml), "text/xml");
|
|
818
818
|
if (!doc.documentElement) continue;
|
|
819
819
|
const domDoc = doc;
|
|
820
820
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -1027,9 +1027,9 @@ function detectHwpxHeadings(blocks, styleMap, tocTexts) {
|
|
|
1027
1027
|
let level = 0;
|
|
1028
1028
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _21 => _21.style, 'optionalAccess', _22 => _22.fontSize])) {
|
|
1029
1029
|
const ratio = block.style.fontSize / baseFontSize;
|
|
1030
|
-
if (ratio >=
|
|
1031
|
-
else if (ratio >=
|
|
1032
|
-
else if (ratio >=
|
|
1030
|
+
if (ratio >= _chunk5N6MENH6cjs.HEADING_RATIO_H1) level = 1;
|
|
1031
|
+
else if (ratio >= _chunk5N6MENH6cjs.HEADING_RATIO_H2) level = 2;
|
|
1032
|
+
else if (ratio >= _chunk5N6MENH6cjs.HEADING_RATIO_H3) level = 3;
|
|
1033
1033
|
}
|
|
1034
1034
|
const compactText = text.replace(/\s+/g, "");
|
|
1035
1035
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1643,11 +1643,11 @@ function formatHeadNumber(n, numFormat) {
|
|
|
1643
1643
|
// 서수 시퀀스는 생성기(gongmun.ts)와 단일 소스 (v4.0.5) — 종전 mod-14 순환은
|
|
1644
1644
|
// 15번째 형제를 다시 '가'로 만들어 한글 실렌더(가→하→거→너 단모음 연속)와 어긋났다
|
|
1645
1645
|
case "CIRCLED_DIGIT":
|
|
1646
|
-
return n <= 50 ?
|
|
1646
|
+
return n <= 50 ? _chunk5N6MENH6cjs.circledNumber.call(void 0, n - 1) : `(${n})`;
|
|
1647
1647
|
case "HANGUL_SYLLABLE":
|
|
1648
|
-
return
|
|
1648
|
+
return _chunk5N6MENH6cjs.hangulOrdinal.call(void 0, n - 1);
|
|
1649
1649
|
case "CIRCLED_HANGUL_SYLLABLE":
|
|
1650
|
-
return n <= 14 ?
|
|
1650
|
+
return n <= 14 ? _chunk5N6MENH6cjs.circledHangul.call(void 0, n - 1) : _chunk5N6MENH6cjs.hangulOrdinal.call(void 0, n - 1);
|
|
1651
1651
|
case "HANGUL_JAMO":
|
|
1652
1652
|
return HANGUL_JAMO_SEQ[(n - 1) % HANGUL_JAMO_SEQ.length];
|
|
1653
1653
|
case "CIRCLED_HANGUL_JAMO":
|
|
@@ -1661,9 +1661,9 @@ function formatHeadNumber(n, numFormat) {
|
|
|
1661
1661
|
case "CIRCLED_LATIN_SMALL":
|
|
1662
1662
|
return n <= 26 ? String.fromCodePoint(9424 + n - 1) : String.fromCharCode(97 + (n - 1) % 26);
|
|
1663
1663
|
case "ROMAN_CAPITAL":
|
|
1664
|
-
return
|
|
1664
|
+
return _chunk5N6MENH6cjs.romanNumeral.call(void 0, n, true);
|
|
1665
1665
|
case "ROMAN_SMALL":
|
|
1666
|
-
return
|
|
1666
|
+
return _chunk5N6MENH6cjs.romanNumeral.call(void 0, n, false);
|
|
1667
1667
|
default:
|
|
1668
1668
|
return String(n);
|
|
1669
1669
|
}
|
|
@@ -1711,7 +1711,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1711
1711
|
|
|
1712
1712
|
// src/hwpx/table-build.ts
|
|
1713
1713
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1714
|
-
const table2 =
|
|
1714
|
+
const table2 = _chunk5N6MENH6cjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1715
1715
|
if (state.caption) table2.caption = state.caption;
|
|
1716
1716
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
1717
1717
|
if (_optionalChain([state, 'access', _32 => _32.captionBlocks, 'optionalAccess', _33 => _33.length])) table2.captionBlocks = state.captionBlocks;
|
|
@@ -1740,7 +1740,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1740
1740
|
for (const src of row) {
|
|
1741
1741
|
if (!src.edges || src.rowAddr === void 0 || src.colAddr === void 0) continue;
|
|
1742
1742
|
const cand = _optionalChain([table2, 'access', _37 => _37.cells, 'access', _38 => _38[src.rowAddr], 'optionalAccess', _39 => _39[src.colAddr]]);
|
|
1743
|
-
if (cand && anchors2.includes(cand))
|
|
1743
|
+
if (cand && anchors2.includes(cand)) _chunk5N6MENH6cjs.CELL_EDGES.set(cand, src.edges);
|
|
1744
1744
|
}
|
|
1745
1745
|
}
|
|
1746
1746
|
const claimed = /* @__PURE__ */ new Set();
|
|
@@ -1790,7 +1790,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1790
1790
|
const cell2 = parentTable.cell;
|
|
1791
1791
|
(cell2.blocks ??= []).push(block);
|
|
1792
1792
|
cell2.hasStructure = true;
|
|
1793
|
-
let flat =
|
|
1793
|
+
let flat = _chunk5N6MENH6cjs.convertTableToText.call(void 0, newTable.rows);
|
|
1794
1794
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1795
1795
|
if (flat) {
|
|
1796
1796
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -2024,7 +2024,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2024
2024
|
const tkids = rc.childNodes;
|
|
2025
2025
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _47 => _47.length]), () => ( 0))); k++) {
|
|
2026
2026
|
const tk = tkids[k];
|
|
2027
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
2027
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunk5N6MENH6cjs.escapeLiteralTags.call(void 0, _chunk5N6MENH6cjs.escapeLiteralDollar.call(void 0, tk.textContent || ""));
|
|
2028
2028
|
else if (tk.nodeType === 1) {
|
|
2029
2029
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
2030
2030
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -2044,7 +2044,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2044
2044
|
const span2 = { text };
|
|
2045
2045
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span2.code = true;
|
|
2046
2046
|
else {
|
|
2047
|
-
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text =
|
|
2047
|
+
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text = _chunk5N6MENH6cjs.wrapScript.call(void 0, text, cp.script);
|
|
2048
2048
|
if (_optionalChain([cp, 'optionalAccess', _49 => _49.bold])) span2.bold = true;
|
|
2049
2049
|
if (_optionalChain([cp, 'optionalAccess', _50 => _50.italic])) span2.italic = true;
|
|
2050
2050
|
if (_optionalChain([cp, 'optionalAccess', _51 => _51.strike])) span2.strike = true;
|
|
@@ -2064,7 +2064,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2064
2064
|
}
|
|
2065
2065
|
}
|
|
2066
2066
|
if (requireMixed && !merged.some((s) => s.strike || s.underline) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
2067
|
-
for (const s of merged) s.text =
|
|
2067
|
+
for (const s of merged) s.text = _chunk5N6MENH6cjs.tidyScriptTags.call(void 0, s.text);
|
|
2068
2068
|
return merged;
|
|
2069
2069
|
}
|
|
2070
2070
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -2091,7 +2091,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2091
2091
|
// src/hwpx/section-walker.ts
|
|
2092
2092
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
2093
2093
|
const parser = createXmlParser(warnings);
|
|
2094
|
-
const doc = parser.parseFromString(
|
|
2094
|
+
const doc = parser.parseFromString(_chunkILRCRR54cjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2095
2095
|
if (!doc.documentElement) return [];
|
|
2096
2096
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
2097
2097
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2192,8 +2192,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2192
2192
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2193
2193
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2194
2194
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2195
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2196
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2195
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunk5N6MENH6cjs.MAX_COLS);
|
|
2196
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunk5N6MENH6cjs.MAX_ROWS);
|
|
2197
2197
|
}
|
|
2198
2198
|
break;
|
|
2199
2199
|
case "p": {
|
|
@@ -2516,7 +2516,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2516
2516
|
const sink = [];
|
|
2517
2517
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2518
2518
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2519
|
-
let flat =
|
|
2519
|
+
let flat = _chunk5N6MENH6cjs.convertTableToText.call(void 0, st.rows);
|
|
2520
2520
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2521
2521
|
const built = [];
|
|
2522
2522
|
completeTable(st, [], built, ctx);
|
|
@@ -2680,7 +2680,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2680
2680
|
let url = (ch.textContent || "").trim();
|
|
2681
2681
|
if (!url) continue;
|
|
2682
2682
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2683
|
-
const safe =
|
|
2683
|
+
const safe = _chunkILRCRR54cjs.sanitizeHref.call(void 0, url);
|
|
2684
2684
|
if (safe) return safe;
|
|
2685
2685
|
}
|
|
2686
2686
|
return void 0;
|
|
@@ -2836,7 +2836,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2836
2836
|
_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" })]);
|
|
2837
2837
|
}
|
|
2838
2838
|
} else {
|
|
2839
|
-
text +=
|
|
2839
|
+
text += _chunk5N6MENH6cjs.escapeLiteralTags.call(void 0, _chunk5N6MENH6cjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, "")));
|
|
2840
2840
|
}
|
|
2841
2841
|
continue;
|
|
2842
2842
|
}
|
|
@@ -2881,7 +2881,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2881
2881
|
break;
|
|
2882
2882
|
// 글자 겹치기 — 겹친 글은 composeText 속성에 있어 종전엔 통째로 빠졌다(법령 서식 원 번호 ⑯·⑰, 시험지 네모 번호 10)
|
|
2883
2883
|
case "compose":
|
|
2884
|
-
if (!isInDeletedRange(ctx)) text +=
|
|
2884
|
+
if (!isInDeletedRange(ctx)) text += _chunk5N6MENH6cjs.escapeLiteralTags.call(void 0, _chunk5N6MENH6cjs.escapeLiteralDollar.call(void 0, _chunk5N6MENH6cjs.composeText.call(void 0, _nullishCoalesce(child.getAttribute("composeText"), () => ( "")), (_nullishCoalesce(child.getAttribute("circleType"), () => ( "CHAR"))) !== "CHAR")));
|
|
2885
2885
|
break;
|
|
2886
2886
|
// 양식 선택 상자·라디오 단추 — 한컴이 그리는 상자 기호와 캡션 글 (종전엔 통째로 빠졌다: form-002 "원천기술형"·서울 결재 "부분공개")
|
|
2887
2887
|
// 지운 구간의 양식 단추·수식은 글처럼 내지 않는다 (최종본)
|
|
@@ -2893,7 +2893,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2893
2893
|
case "hyperlink": {
|
|
2894
2894
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2895
2895
|
if (url) {
|
|
2896
|
-
const safe =
|
|
2896
|
+
const safe = _chunkILRCRR54cjs.sanitizeHref.call(void 0, url);
|
|
2897
2897
|
if (safe) href = safe;
|
|
2898
2898
|
}
|
|
2899
2899
|
walk(child, depth + 1);
|
|
@@ -2987,7 +2987,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2987
2987
|
walk(child, depth + 1);
|
|
2988
2988
|
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
2989
2989
|
const added = text.slice(start);
|
|
2990
|
-
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) +
|
|
2990
|
+
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) + _chunk5N6MENH6cjs.wrapScript.call(void 0, added, script);
|
|
2991
2991
|
}
|
|
2992
2992
|
break;
|
|
2993
2993
|
}
|
|
@@ -3010,7 +3010,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3010
3010
|
}
|
|
3011
3011
|
if (applied.length) href = void 0;
|
|
3012
3012
|
}
|
|
3013
|
-
text =
|
|
3013
|
+
text = _chunk5N6MENH6cjs.tidyScriptTags.call(void 0, text);
|
|
3014
3014
|
const toc = takeTocLeaders(text);
|
|
3015
3015
|
text = toc.text;
|
|
3016
3016
|
const tocEntry = toc.tocEntry;
|
|
@@ -3124,7 +3124,7 @@ function decompressStream(data) {
|
|
|
3124
3124
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
3125
3125
|
}
|
|
3126
3126
|
function parseFileHeader(data) {
|
|
3127
|
-
if (data.length < 40) throw new (0,
|
|
3127
|
+
if (data.length < 40) throw new (0, _chunkILRCRR54cjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
3128
3128
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
3129
3129
|
return {
|
|
3130
3130
|
signature: sig,
|
|
@@ -3651,13 +3651,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3651
3651
|
}
|
|
3652
3652
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3653
3653
|
for (const path of allCandidates) {
|
|
3654
|
-
if (
|
|
3654
|
+
if (_chunkILRCRR54cjs.isPathTraversal.call(void 0, path)) continue;
|
|
3655
3655
|
const file = zip.file(path);
|
|
3656
3656
|
if (!file) continue;
|
|
3657
3657
|
try {
|
|
3658
3658
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3659
3659
|
decompressed.total += data.length;
|
|
3660
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3660
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkILRCRR54cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3661
3661
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3662
3662
|
const extMime = imageExtToMime(ext);
|
|
3663
3663
|
const mimeType = extMime === "image/svg+xml" && /<script|\son[a-z]+\s*=|javascript:|<foreignObject/i.test(Buffer.from(data).toString("utf8")) ? "application/octet-stream" : extMime;
|
|
@@ -3668,7 +3668,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3668
3668
|
usedPaths.add(path);
|
|
3669
3669
|
break;
|
|
3670
3670
|
} catch (err) {
|
|
3671
|
-
if (err instanceof
|
|
3671
|
+
if (err instanceof _chunkILRCRR54cjs.KordocError) throw err;
|
|
3672
3672
|
}
|
|
3673
3673
|
}
|
|
3674
3674
|
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" })]);
|
|
@@ -3688,13 +3688,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3688
3688
|
if (sweepUnreferenced) {
|
|
3689
3689
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3690
3690
|
for (const file of binEntries) {
|
|
3691
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3691
|
+
if (file.dir || usedPaths.has(file.name) || _chunkILRCRR54cjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3692
3692
|
const basename = file.name.slice(file.name.lastIndexOf("/") + 1);
|
|
3693
3693
|
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;
|
|
3694
3694
|
try {
|
|
3695
3695
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3696
3696
|
decompressed.total += data.length;
|
|
3697
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3697
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkILRCRR54cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3698
3698
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3699
3699
|
let mimeType = imageExtToMime(ext);
|
|
3700
3700
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3708,7 +3708,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3708
3708
|
images.push(img);
|
|
3709
3709
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3710
3710
|
} catch (err) {
|
|
3711
|
-
if (err instanceof
|
|
3711
|
+
if (err instanceof _chunkILRCRR54cjs.KordocError) throw err;
|
|
3712
3712
|
_optionalChain([warnings, 'optionalAccess', _138 => _138.push, 'call', _139 => _139({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3713
3713
|
}
|
|
3714
3714
|
}
|
|
@@ -3759,7 +3759,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3759
3759
|
}
|
|
3760
3760
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3761
3761
|
const name = new TextDecoder().decode(nameBytes);
|
|
3762
|
-
if (
|
|
3762
|
+
if (_chunkILRCRR54cjs.isPathTraversal.call(void 0, name)) {
|
|
3763
3763
|
pos = fileStart + compSize;
|
|
3764
3764
|
continue;
|
|
3765
3765
|
}
|
|
@@ -3777,7 +3777,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3777
3777
|
continue;
|
|
3778
3778
|
}
|
|
3779
3779
|
totalDecompressed += content.length * 2;
|
|
3780
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3780
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkILRCRR54cjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3781
3781
|
sectionNum++;
|
|
3782
3782
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3783
3783
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3786,9 +3786,9 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3786
3786
|
continue;
|
|
3787
3787
|
}
|
|
3788
3788
|
}
|
|
3789
|
-
if (blocks.length === 0) throw new (0,
|
|
3789
|
+
if (blocks.length === 0) throw new (0, _chunkILRCRR54cjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3790
3790
|
applyPageText(blocks, shared);
|
|
3791
|
-
const markdown =
|
|
3791
|
+
const markdown = _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _140 => _140.tableFormat]) });
|
|
3792
3792
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3793
3793
|
}
|
|
3794
3794
|
async function readKordocLayout(zip) {
|
|
@@ -3813,11 +3813,11 @@ async function resolveSectionPaths(zip) {
|
|
|
3813
3813
|
if (paths.length > 0) return paths;
|
|
3814
3814
|
}
|
|
3815
3815
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3816
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3816
|
+
return sectionFiles.map((f) => f.name).sort(_chunkILRCRR54cjs.compareSectionPaths);
|
|
3817
3817
|
}
|
|
3818
3818
|
function parseSectionPathsFromManifest(xml) {
|
|
3819
3819
|
const parser = createXmlParser();
|
|
3820
|
-
const doc = parser.parseFromString(
|
|
3820
|
+
const doc = parser.parseFromString(_chunkILRCRR54cjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3821
3821
|
const opf = "http://www.idpf.org/2007/opf/";
|
|
3822
3822
|
const namespacedItems = doc.getElementsByTagNameNS(opf, "item");
|
|
3823
3823
|
const namespacedSpine = doc.getElementsByTagNameNS(opf, "itemref");
|
|
@@ -3827,7 +3827,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3827
3827
|
for (let i = 0; i < items.length; i++) {
|
|
3828
3828
|
const item = items[i];
|
|
3829
3829
|
const id = item.getAttribute("id") || "";
|
|
3830
|
-
const href =
|
|
3830
|
+
const href = _chunkILRCRR54cjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3831
3831
|
if (id && href) idToHref.set(id, href);
|
|
3832
3832
|
}
|
|
3833
3833
|
if (spine.length > 0) {
|
|
@@ -3838,7 +3838,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3838
3838
|
}
|
|
3839
3839
|
if (ordered.length > 0) return ordered;
|
|
3840
3840
|
}
|
|
3841
|
-
return Array.from(idToHref.values()).sort(
|
|
3841
|
+
return Array.from(idToHref.values()).sort(_chunkILRCRR54cjs.compareSectionPaths);
|
|
3842
3842
|
}
|
|
3843
3843
|
|
|
3844
3844
|
// src/hwpx/metadata.ts
|
|
@@ -3850,7 +3850,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3850
3850
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _144 => _144.total]));
|
|
3851
3851
|
if (decompressed) {
|
|
3852
3852
|
decompressed.total += xml.length * 2;
|
|
3853
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3853
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkILRCRR54cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3854
3854
|
}
|
|
3855
3855
|
return xml;
|
|
3856
3856
|
};
|
|
@@ -3872,7 +3872,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3872
3872
|
}
|
|
3873
3873
|
}
|
|
3874
3874
|
function parseOpfMetadata(xml, metadata) {
|
|
3875
|
-
const root = createXmlParser().parseFromString(
|
|
3875
|
+
const root = createXmlParser().parseFromString(_chunkILRCRR54cjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3876
3876
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3877
3877
|
if (!md2) return;
|
|
3878
3878
|
let title;
|
|
@@ -3905,7 +3905,7 @@ function isoDate(s) {
|
|
|
3905
3905
|
}
|
|
3906
3906
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3907
3907
|
const parser = createXmlParser();
|
|
3908
|
-
const doc = parser.parseFromString(
|
|
3908
|
+
const doc = parser.parseFromString(_chunkILRCRR54cjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3909
3909
|
if (!doc.documentElement) return;
|
|
3910
3910
|
const getText = (tagNames) => {
|
|
3911
3911
|
for (const tag of tagNames) {
|
|
@@ -3944,7 +3944,7 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3944
3944
|
}
|
|
3945
3945
|
}
|
|
3946
3946
|
async function parseHwpxDocument(buffer, options) {
|
|
3947
|
-
|
|
3947
|
+
_chunkILRCRR54cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3948
3948
|
let zip;
|
|
3949
3949
|
try {
|
|
3950
3950
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3953,7 +3953,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3953
3953
|
}
|
|
3954
3954
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3955
3955
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3956
|
-
throw new (0,
|
|
3956
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3957
3957
|
}
|
|
3958
3958
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3959
3959
|
if (manifestFile) {
|
|
@@ -3973,7 +3973,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3973
3973
|
}
|
|
3974
3974
|
const hpfFile = zip.file("Contents/content.hpf");
|
|
3975
3975
|
const hpf = hpfFile ? await readZipEntry(hpfFile, "text").catch(() => "") : "";
|
|
3976
|
-
throw new (0,
|
|
3976
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(
|
|
3977
3977
|
/\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."
|
|
3978
3978
|
);
|
|
3979
3979
|
}
|
|
@@ -3985,7 +3985,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3985
3985
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3986
3986
|
const warnings = [];
|
|
3987
3987
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3988
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3988
|
+
if (sectionPaths.length === 0) throw new (0, _chunkILRCRR54cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3989
3989
|
let allBlocks = [];
|
|
3990
3990
|
const shared = createSectionShared();
|
|
3991
3991
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -4029,10 +4029,10 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4029
4029
|
const blocks = allBlocks;
|
|
4030
4030
|
applyPageText(blocks, shared);
|
|
4031
4031
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _173 => _173.pages]), shared.track.deletedImageRefs);
|
|
4032
|
-
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks :
|
|
4032
|
+
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks : _chunk5N6MENH6cjs.unframeLayoutTables.call(void 0, blocks, !!_optionalChain([options, 'optionalAccess', _175 => _175.keepTrailingEmptyCols]));
|
|
4033
4033
|
detectHwpxHeadings(shown, styleMap, shared.tocTexts);
|
|
4034
4034
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4035
|
-
const markdown =
|
|
4035
|
+
const markdown = _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, shown, { tableFormat: _optionalChain([options, 'optionalAccess', _176 => _176.tableFormat]) });
|
|
4036
4036
|
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 };
|
|
4037
4037
|
}
|
|
4038
4038
|
|
|
@@ -4799,7 +4799,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4799
4799
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4800
4800
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4801
4801
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4802
|
-
const wrong = () => new (0,
|
|
4802
|
+
const wrong = () => new (0, _chunkILRCRR54cjs.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.");
|
|
4803
4803
|
let records;
|
|
4804
4804
|
try {
|
|
4805
4805
|
records = readRecords3(data);
|
|
@@ -4811,7 +4811,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4811
4811
|
}
|
|
4812
4812
|
function assertSupportedEncryptVersion(version) {
|
|
4813
4813
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4814
|
-
throw new (0,
|
|
4814
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(
|
|
4815
4815
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4816
4816
|
);
|
|
4817
4817
|
}
|
|
@@ -5060,19 +5060,19 @@ var HANJA_UNITS = ["", "\u5341", "\u767E", "\u5343", "\u842C"];
|
|
|
5060
5060
|
function formatNumber(n, fmt) {
|
|
5061
5061
|
switch (fmt) {
|
|
5062
5062
|
case "circled":
|
|
5063
|
-
return n >= 1 ?
|
|
5063
|
+
return n >= 1 ? _chunk5N6MENH6cjs.circledNumber.call(void 0, n - 1) : String(n);
|
|
5064
5064
|
case "romanUpper":
|
|
5065
|
-
return
|
|
5065
|
+
return _chunk5N6MENH6cjs.romanNumeral.call(void 0, n, true);
|
|
5066
5066
|
case "romanLower":
|
|
5067
|
-
return
|
|
5067
|
+
return _chunk5N6MENH6cjs.romanNumeral.call(void 0, n, false);
|
|
5068
5068
|
case "latinUpper":
|
|
5069
5069
|
return formatLatin(n, true) || String(n);
|
|
5070
5070
|
case "latinLower":
|
|
5071
5071
|
return formatLatin(n, false) || String(n);
|
|
5072
5072
|
case "ganada":
|
|
5073
|
-
return n >= 1 ?
|
|
5073
|
+
return n >= 1 ? _chunk5N6MENH6cjs.hangulOrdinal.call(void 0, n - 1) : String(n);
|
|
5074
5074
|
case "circledGanada":
|
|
5075
|
-
return n >= 1 ?
|
|
5075
|
+
return n >= 1 ? _chunk5N6MENH6cjs.circledHangul.call(void 0, n - 1) : String(n);
|
|
5076
5076
|
case "jamo":
|
|
5077
5077
|
return fromTable(n, JAMO);
|
|
5078
5078
|
case "circledJamo":
|
|
@@ -5254,7 +5254,7 @@ function emitParagraphBlocks(p) {
|
|
|
5254
5254
|
return blocks;
|
|
5255
5255
|
}
|
|
5256
5256
|
function tableFlatText(table2) {
|
|
5257
|
-
const flat =
|
|
5257
|
+
const flat = _chunk5N6MENH6cjs.convertTableToText.call(void 0, table2.cells);
|
|
5258
5258
|
return table2.caption ? table2.caption + (flat ? "\n" + flat : "") : flat;
|
|
5259
5259
|
}
|
|
5260
5260
|
function blocksPlainText(blocks, sep) {
|
|
@@ -5335,8 +5335,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5335
5335
|
}
|
|
5336
5336
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5337
5337
|
for (const c of cells) {
|
|
5338
|
-
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1,
|
|
5339
|
-
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1,
|
|
5338
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunk5N6MENH6cjs.MAX_ROWS));
|
|
5339
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunk5N6MENH6cjs.MAX_COLS));
|
|
5340
5340
|
}
|
|
5341
5341
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5342
5342
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5344,12 +5344,12 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5344
5344
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5345
5345
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5346
5346
|
}
|
|
5347
|
-
const table2 =
|
|
5347
|
+
const table2 = _chunk5N6MENH6cjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5348
5348
|
if (table2.rows === 0) return null;
|
|
5349
5349
|
for (const c of placed) {
|
|
5350
5350
|
if (c.edges) {
|
|
5351
5351
|
const at = _optionalChain([table2, 'access', _183 => _183.cells, 'access', _184 => _184[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _185 => _185[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
5352
|
-
if (at)
|
|
5352
|
+
if (at) _chunk5N6MENH6cjs.CELL_EDGES.set(at, c.edges);
|
|
5353
5353
|
}
|
|
5354
5354
|
if (!_optionalChain([c, 'access', _186 => _186.blocks, 'optionalAccess', _187 => _187.length]) && !c.isHeader) continue;
|
|
5355
5355
|
const target = _optionalChain([table2, 'access', _188 => _188.cells, 'access', _189 => _189[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _190 => _190[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
@@ -5551,7 +5551,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5551
5551
|
continue;
|
|
5552
5552
|
}
|
|
5553
5553
|
if (!ctrl.href) continue;
|
|
5554
|
-
const href =
|
|
5554
|
+
const href = _chunkILRCRR54cjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5555
5555
|
if (!href) continue;
|
|
5556
5556
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK)) continue;
|
|
5557
5557
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5560,7 +5560,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5560
5560
|
}
|
|
5561
5561
|
if (text.includes(LITERAL_DOLLAR_MARK)) text = text.replaceAll(LITERAL_DOLLAR_MARK, "\\$");
|
|
5562
5562
|
text = resolveLiteralLt(text);
|
|
5563
|
-
text =
|
|
5563
|
+
text = _chunk5N6MENH6cjs.tidyScriptTags.call(void 0, text);
|
|
5564
5564
|
const toc = takeTocLeaders(text);
|
|
5565
5565
|
text = toc.text;
|
|
5566
5566
|
let headingLevel = 0;
|
|
@@ -5667,7 +5667,7 @@ function applyCtrlEffect(ctrl, records, ctx) {
|
|
|
5667
5667
|
// 글자 겹침 — ctrl id 뒤 글자 수(WORD)·겹친 글자(WCHAR[n])·테두리 종류(BYTE, 0 = 없음). 종전엔 건너뛰어 법령 서식 원 번호(⑯·⑰)가 빠졌다
|
|
5668
5668
|
case CTRL_TCPS: {
|
|
5669
5669
|
const d = ctrl.data, n = d.length >= 6 ? d.readUInt16LE(4) : 0;
|
|
5670
|
-
if (n > 0 && d.length >= 6 + 2 * n) ctrl.inlineText =
|
|
5670
|
+
if (n > 0 && d.length >= 6 + 2 * n) ctrl.inlineText = _chunk5N6MENH6cjs.composeText.call(void 0, d.toString("utf16le", 6, 6 + 2 * n), (_nullishCoalesce(d[6 + 2 * n], () => ( 0))) !== 0);
|
|
5671
5671
|
return;
|
|
5672
5672
|
}
|
|
5673
5673
|
// 숨은 설명/단 정의/쪽번호 위치/감추기/찾아보기/책갈피/덧말 — 본문 텍스트 없음 또는 의도적 스킵
|
|
@@ -5785,7 +5785,7 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5785
5785
|
}
|
|
5786
5786
|
var A4_HEIGHT = 84188;
|
|
5787
5787
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5788
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5788
|
+
if (!cells.some((c) => c.pageSpanning)) _chunk5N6MENH6cjs.markNonLayoutTable.call(void 0, table2);
|
|
5789
5789
|
}
|
|
5790
5790
|
function parseTableControl(ctrl, records, ctx) {
|
|
5791
5791
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
@@ -5797,8 +5797,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5797
5797
|
let tableIdx = -1;
|
|
5798
5798
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5799
5799
|
if (records[i2].tagId === TAG_TABLE && records[i2].level === directLevel && records[i2].data.length >= 8) {
|
|
5800
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5801
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5800
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunk5N6MENH6cjs.MAX_ROWS);
|
|
5801
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunk5N6MENH6cjs.MAX_COLS);
|
|
5802
5802
|
tableIdx = i2;
|
|
5803
5803
|
break;
|
|
5804
5804
|
}
|
|
@@ -5842,11 +5842,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5842
5842
|
return table3;
|
|
5843
5843
|
}
|
|
5844
5844
|
if (rows === 0 || cols === 0) {
|
|
5845
|
-
rows = Math.min(cells.length,
|
|
5845
|
+
rows = Math.min(cells.length, _chunk5N6MENH6cjs.MAX_ROWS);
|
|
5846
5846
|
cols = 1;
|
|
5847
5847
|
}
|
|
5848
5848
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5849
|
-
const table2 =
|
|
5849
|
+
const table2 = _chunk5N6MENH6cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5850
5850
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5851
5851
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
5852
5852
|
keepUnlessPageSpanning(table2, cells);
|
|
@@ -5865,8 +5865,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5865
5865
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5866
5866
|
const cs = rec.data.readUInt16LE(12);
|
|
5867
5867
|
const rs = rec.data.readUInt16LE(14);
|
|
5868
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5869
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5868
|
+
if (cs > 0) colSpan = Math.min(cs, _chunk5N6MENH6cjs.MAX_COLS);
|
|
5869
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunk5N6MENH6cjs.MAX_ROWS);
|
|
5870
5870
|
}
|
|
5871
5871
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5872
5872
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -6015,7 +6015,7 @@ function openHwp5Container(buffer, options) {
|
|
|
6015
6015
|
lenientCfb = parseLenientCfb(buffer);
|
|
6016
6016
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
6017
6017
|
} catch (e24) {
|
|
6018
|
-
throw new (0,
|
|
6018
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
6019
6019
|
}
|
|
6020
6020
|
}
|
|
6021
6021
|
const readRawStream = (path) => {
|
|
@@ -6026,14 +6026,14 @@ function openHwp5Container(buffer, options) {
|
|
|
6026
6026
|
return lenientCfb.findStream(path);
|
|
6027
6027
|
};
|
|
6028
6028
|
const headerData = readRawStream("/FileHeader");
|
|
6029
|
-
if (!headerData) throw new (0,
|
|
6029
|
+
if (!headerData) throw new (0, _chunkILRCRR54cjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6030
6030
|
const header = parseFileHeader(headerData);
|
|
6031
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
6032
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
6031
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkILRCRR54cjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
6032
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkILRCRR54cjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
6033
6033
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
6034
6034
|
if (encrypted) {
|
|
6035
6035
|
if (!_optionalChain([options, 'optionalAccess', _214 => _214.password])) {
|
|
6036
|
-
throw new (0,
|
|
6036
|
+
throw new (0, _chunkILRCRR54cjs.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.");
|
|
6037
6037
|
}
|
|
6038
6038
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
6039
6039
|
}
|
|
@@ -6047,12 +6047,12 @@ function openHwp5Container(buffer, options) {
|
|
|
6047
6047
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
6048
6048
|
if (encrypted) {
|
|
6049
6049
|
const rawDocInfo = findStream("/DocInfo");
|
|
6050
|
-
if (!rawDocInfo) throw new (0,
|
|
6050
|
+
if (!rawDocInfo) throw new (0, _chunkILRCRR54cjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6051
6051
|
let docInfoData;
|
|
6052
6052
|
try {
|
|
6053
6053
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
6054
6054
|
} catch (e25) {
|
|
6055
|
-
throw new (0,
|
|
6055
|
+
throw new (0, _chunkILRCRR54cjs.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.");
|
|
6056
6056
|
}
|
|
6057
6057
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
6058
6058
|
}
|
|
@@ -6077,10 +6077,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
6077
6077
|
try {
|
|
6078
6078
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
6079
6079
|
totalDecompressed += data.length;
|
|
6080
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6080
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkILRCRR54cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6081
6081
|
out.push(readRecords(data));
|
|
6082
6082
|
} catch (secErr) {
|
|
6083
|
-
if (secErr instanceof
|
|
6083
|
+
if (secErr instanceof _chunkILRCRR54cjs.KordocError) throw secErr;
|
|
6084
6084
|
out.push(null);
|
|
6085
6085
|
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" });
|
|
6086
6086
|
}
|
|
@@ -6100,7 +6100,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6100
6100
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
6101
6101
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
6102
6102
|
const sections = readHwp5SectionStreams(c);
|
|
6103
|
-
if (sections.length === 0) throw new (0,
|
|
6103
|
+
if (sections.length === 0) throw new (0, _chunkILRCRR54cjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
6104
6104
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
6105
6105
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
6106
6106
|
const sectionTableIds = [];
|
|
@@ -6144,7 +6144,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6144
6144
|
parsedSections++;
|
|
6145
6145
|
_optionalChain([options, 'optionalAccess', _219 => _219.onProgress, 'optionalCall', _220 => _220(parsedSections, sections.length)]);
|
|
6146
6146
|
} catch (secErr) {
|
|
6147
|
-
if (secErr instanceof
|
|
6147
|
+
if (secErr instanceof _chunkILRCRR54cjs.KordocError) throw secErr;
|
|
6148
6148
|
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" });
|
|
6149
6149
|
} finally {
|
|
6150
6150
|
pageBase += detect2.pages;
|
|
@@ -6155,10 +6155,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6155
6155
|
}
|
|
6156
6156
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
6157
6157
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter, encrypted ? findStream : void 0) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter, encrypted ? findStream : void 0);
|
|
6158
|
-
let flatBlocks =
|
|
6159
|
-
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks =
|
|
6158
|
+
let flatBlocks = _chunk5N6MENH6cjs.flattenLayoutTables.call(void 0, blocks);
|
|
6159
|
+
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks = _chunk5N6MENH6cjs.unframeLayoutTables.call(void 0, flatBlocks, !!_optionalChain([options, 'optionalAccess', _222 => _222.keepTrailingEmptyCols]));
|
|
6160
6160
|
if (_optionalChain([options, 'optionalAccess', _223 => _223.dedupeRunningHeaders])) {
|
|
6161
|
-
const deduped =
|
|
6161
|
+
const deduped = _chunk5N6MENH6cjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
6162
6162
|
const removed = flatBlocks.length - deduped.length;
|
|
6163
6163
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
6164
6164
|
flatBlocks = deduped;
|
|
@@ -6167,10 +6167,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6167
6167
|
detectHwp5Headings(flatBlocks, docInfo, doc.tocTexts);
|
|
6168
6168
|
}
|
|
6169
6169
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
6170
|
-
let markdown =
|
|
6170
|
+
let markdown = _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, flatBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _224 => _224.tableFormat]) });
|
|
6171
6171
|
if (_optionalChain([options, 'optionalAccess', _225 => _225.inlineImages]) && options.images !== false && images.length > 0) {
|
|
6172
6172
|
try {
|
|
6173
|
-
markdown =
|
|
6173
|
+
markdown = _chunkKXTCBOUCcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
6174
6174
|
} catch (inlineErr) {
|
|
6175
6175
|
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" });
|
|
6176
6176
|
}
|
|
@@ -6234,9 +6234,9 @@ function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
|
6234
6234
|
let level = 0;
|
|
6235
6235
|
if (_optionalChain([block, 'access', _232 => _232.style, 'optionalAccess', _233 => _233.fontSize]) && baseFontSize > 0) {
|
|
6236
6236
|
const ratio = block.style.fontSize / baseFontSize;
|
|
6237
|
-
if (ratio >=
|
|
6238
|
-
else if (ratio >=
|
|
6239
|
-
else if (ratio >=
|
|
6237
|
+
if (ratio >= _chunk5N6MENH6cjs.HEADING_RATIO_H1) level = 1;
|
|
6238
|
+
else if (ratio >= _chunk5N6MENH6cjs.HEADING_RATIO_H2) level = 2;
|
|
6239
|
+
else if (ratio >= _chunk5N6MENH6cjs.HEADING_RATIO_H3) level = 3;
|
|
6240
6240
|
}
|
|
6241
6241
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
6242
6242
|
if (level === 0) level = 2;
|
|
@@ -6368,7 +6368,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6368
6368
|
const raw = _nullishCoalesce(lcfb.findStream(`/BodyText/Section${i}`), () => ( lcfb.findStream(`Section${i}`)));
|
|
6369
6369
|
if (!raw) break;
|
|
6370
6370
|
totalBytes += raw.length;
|
|
6371
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6371
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkILRCRR54cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6372
6372
|
sections.push({ idx: i, content: raw });
|
|
6373
6373
|
}
|
|
6374
6374
|
if (sections.length === 0) {
|
|
@@ -6379,7 +6379,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6379
6379
|
const raw = lcfb.findStream(e.name);
|
|
6380
6380
|
if (raw) {
|
|
6381
6381
|
totalBytes += raw.length;
|
|
6382
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6382
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkILRCRR54cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6383
6383
|
sections.push({ idx, content: raw });
|
|
6384
6384
|
}
|
|
6385
6385
|
}
|
|
@@ -6396,7 +6396,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6396
6396
|
try {
|
|
6397
6397
|
const content = decryptViewText(raw, compressed);
|
|
6398
6398
|
totalDecompressed += content.length;
|
|
6399
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6399
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkILRCRR54cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6400
6400
|
sections.push({ idx: i, content });
|
|
6401
6401
|
} catch (e32) {
|
|
6402
6402
|
break;
|
|
@@ -18896,25 +18896,25 @@ function desEcbDecrypt(data, key) {
|
|
|
18896
18896
|
}
|
|
18897
18897
|
function readLayout(data) {
|
|
18898
18898
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18899
|
-
throw new (0,
|
|
18899
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18900
18900
|
}
|
|
18901
18901
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18902
18902
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18903
18903
|
if (payloadOffset >= data.length) {
|
|
18904
|
-
throw new (0,
|
|
18904
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18905
18905
|
}
|
|
18906
18906
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18907
18907
|
}
|
|
18908
18908
|
function decryptHwp3Document(input, password) {
|
|
18909
18909
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18910
18910
|
if (!compressed) {
|
|
18911
|
-
throw new (0,
|
|
18911
|
+
throw new (0, _chunkILRCRR54cjs.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)");
|
|
18912
18912
|
}
|
|
18913
18913
|
const source = Buffer.from(input);
|
|
18914
18914
|
const payload = source.subarray(payloadOffset);
|
|
18915
18915
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18916
18916
|
if (aligned.length === 0) {
|
|
18917
|
-
throw new (0,
|
|
18917
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18918
18918
|
}
|
|
18919
18919
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18920
18920
|
let inflated;
|
|
@@ -18922,14 +18922,14 @@ function decryptHwp3Document(input, password) {
|
|
|
18922
18922
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18923
18923
|
} catch (err) {
|
|
18924
18924
|
if (_optionalChain([err, 'optionalAccess', _248 => _248.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18925
|
-
throw new (0,
|
|
18925
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(
|
|
18926
18926
|
`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`
|
|
18927
18927
|
);
|
|
18928
18928
|
}
|
|
18929
|
-
throw new (0,
|
|
18929
|
+
throw new (0, _chunkILRCRR54cjs.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.");
|
|
18930
18930
|
}
|
|
18931
18931
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18932
|
-
throw new (0,
|
|
18932
|
+
throw new (0, _chunkILRCRR54cjs.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.");
|
|
18933
18933
|
}
|
|
18934
18934
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18935
18935
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -18986,9 +18986,9 @@ function hwp3CellGrid(info, count) {
|
|
|
18986
18986
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
18987
18987
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
18988
18988
|
const r2 = nextY[k] !== void 0 ? edgeAt(ys, nextY[k]) : ys.length - 1;
|
|
18989
|
-
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row),
|
|
18989
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunk5N6MENH6cjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunk5N6MENH6cjs.MAX_COLS) };
|
|
18990
18990
|
});
|
|
18991
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
18991
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunk5N6MENH6cjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunk5N6MENH6cjs.MAX_COLS), cells };
|
|
18992
18992
|
}
|
|
18993
18993
|
|
|
18994
18994
|
// src/hwp3/parser.ts
|
|
@@ -19029,7 +19029,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19029
19029
|
let source = Buffer.from(buffer);
|
|
19030
19030
|
if (isEncryptedHwp3(source)) {
|
|
19031
19031
|
if (!_optionalChain([options, 'optionalAccess', _249 => _249.password])) {
|
|
19032
|
-
throw new (0,
|
|
19032
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(
|
|
19033
19033
|
"\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."
|
|
19034
19034
|
);
|
|
19035
19035
|
}
|
|
@@ -19046,10 +19046,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19046
19046
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
19047
19047
|
} catch (err) {
|
|
19048
19048
|
if (_optionalChain([err, 'optionalAccess', _250 => _250.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
19049
|
-
throw new (0,
|
|
19049
|
+
throw new (0, _chunkILRCRR54cjs.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`);
|
|
19050
19050
|
}
|
|
19051
19051
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
19052
|
-
throw new (0,
|
|
19052
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
19053
19053
|
}
|
|
19054
19054
|
} else {
|
|
19055
19055
|
body = tail;
|
|
@@ -19072,7 +19072,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19072
19072
|
const names = new Map([...ctx.picIds].map(([name, id]) => [id, name]));
|
|
19073
19073
|
dropMissingPictures(allBlocks, binData, names, warnings);
|
|
19074
19074
|
const images = resolveImageBlocks(binData, allBlocks, warnings, true);
|
|
19075
|
-
const blocks =
|
|
19075
|
+
const blocks = _chunk5N6MENH6cjs.flattenLayoutTables.call(void 0, allBlocks);
|
|
19076
19076
|
const metadata = {
|
|
19077
19077
|
title: header.title || void 0,
|
|
19078
19078
|
author: header.author || void 0,
|
|
@@ -19080,10 +19080,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19080
19080
|
createdAt: header.date || void 0,
|
|
19081
19081
|
version: "3.0"
|
|
19082
19082
|
};
|
|
19083
|
-
let markdown =
|
|
19083
|
+
let markdown = _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _251 => _251.tableFormat]) });
|
|
19084
19084
|
if (_optionalChain([options, 'optionalAccess', _252 => _252.inlineImages]) && options.images !== false && images.length > 0) {
|
|
19085
19085
|
try {
|
|
19086
|
-
markdown =
|
|
19086
|
+
markdown = _chunkKXTCBOUCcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
19087
19087
|
} catch (inlineErr) {
|
|
19088
19088
|
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" });
|
|
19089
19089
|
}
|
|
@@ -19215,7 +19215,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
19215
19215
|
continue;
|
|
19216
19216
|
}
|
|
19217
19217
|
if (ch >= 32) {
|
|
19218
|
-
para2.text +=
|
|
19218
|
+
para2.text += _chunk5N6MENH6cjs.escapeLiteralTags.call(void 0, _chunk5N6MENH6cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( ""))));
|
|
19219
19219
|
continue;
|
|
19220
19220
|
}
|
|
19221
19221
|
if (ch === 9) {
|
|
@@ -19450,7 +19450,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19450
19450
|
// src/xlsx/sheet-blocks.ts
|
|
19451
19451
|
var MAX_SHEET_COLS = 16384;
|
|
19452
19452
|
function sheetRowCap(cols) {
|
|
19453
|
-
return Math.floor(
|
|
19453
|
+
return Math.floor(_chunk5N6MENH6cjs.MAX_TABLE_CELLS / Math.max(1, cols));
|
|
19454
19454
|
}
|
|
19455
19455
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19456
19456
|
const blocks = [];
|
|
@@ -19481,7 +19481,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19481
19481
|
if (keepRows.length > rowCap) {
|
|
19482
19482
|
warnings.push({
|
|
19483
19483
|
page: sheetIndex + 1,
|
|
19484
|
-
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 ${
|
|
19484
|
+
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 ${_chunk5N6MENH6cjs.MAX_TABLE_CELLS})`,
|
|
19485
19485
|
code: "TRUNCATED_TABLE"
|
|
19486
19486
|
});
|
|
19487
19487
|
keepRows.length = rowCap;
|
|
@@ -19515,14 +19515,14 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19515
19515
|
}
|
|
19516
19516
|
cellRows.push(row);
|
|
19517
19517
|
}
|
|
19518
|
-
const table2 =
|
|
19518
|
+
const table2 = _chunk5N6MENH6cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap, maxCols: keepCols.length });
|
|
19519
19519
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19520
19520
|
return blocks;
|
|
19521
19521
|
}
|
|
19522
19522
|
|
|
19523
19523
|
// src/xlsx/parser.ts
|
|
19524
19524
|
var MAX_SHEETS = 100;
|
|
19525
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19525
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkILRCRR54cjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19526
19526
|
var MAX_SHEET_ROWS = 1048576;
|
|
19527
19527
|
function cleanNumericValue(raw) {
|
|
19528
19528
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19559,7 +19559,7 @@ function getTextContent(el) {
|
|
|
19559
19559
|
return _nullishCoalesce(_optionalChain([el, 'access', _268 => _268.textContent, 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]), () => ( ""));
|
|
19560
19560
|
}
|
|
19561
19561
|
function parseXml(text) {
|
|
19562
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19562
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkILRCRR54cjs.stripDtd.call(void 0, text), "text/xml");
|
|
19563
19563
|
}
|
|
19564
19564
|
function collectRichText(root) {
|
|
19565
19565
|
let out = "";
|
|
@@ -19570,7 +19570,7 @@ function collectRichText(root) {
|
|
|
19570
19570
|
const el = children[i];
|
|
19571
19571
|
const local = el.localName || _optionalChain([el, 'access', _271 => _271.tagName, 'optionalAccess', _272 => _272.replace, 'call', _273 => _273(/^[^:]+:/, "")]) || "";
|
|
19572
19572
|
if (local === "rPh") continue;
|
|
19573
|
-
if (local === "t") out +=
|
|
19573
|
+
if (local === "t") out += _chunk5N6MENH6cjs.escapeLiteralTags.call(void 0, _chunk5N6MENH6cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
19574
19574
|
else walk(el);
|
|
19575
19575
|
}
|
|
19576
19576
|
};
|
|
@@ -19781,12 +19781,12 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19781
19781
|
return { rows, merges, maxCol };
|
|
19782
19782
|
}
|
|
19783
19783
|
async function parseXlsxDocument(buffer, options) {
|
|
19784
|
-
|
|
19784
|
+
_chunkILRCRR54cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19785
19785
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19786
19786
|
const warnings = [];
|
|
19787
19787
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19788
19788
|
if (!workbookFile) {
|
|
19789
|
-
throw new (0,
|
|
19789
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19790
19790
|
}
|
|
19791
19791
|
let sharedStrings = [];
|
|
19792
19792
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19795,7 +19795,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19795
19795
|
}
|
|
19796
19796
|
const { sheets, date1904 } = parseWorkbook(await readZipEntry(workbookFile, "text"));
|
|
19797
19797
|
if (sheets.length === 0) {
|
|
19798
|
-
throw new (0,
|
|
19798
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19799
19799
|
}
|
|
19800
19800
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19801
19801
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19879,7 +19879,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19879
19879
|
} catch (e35) {
|
|
19880
19880
|
}
|
|
19881
19881
|
}
|
|
19882
|
-
const markdown =
|
|
19882
|
+
const markdown = _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _278 => _278.tableFormat]) });
|
|
19883
19883
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19884
19884
|
}
|
|
19885
19885
|
|
|
@@ -20193,14 +20193,14 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20193
20193
|
const h = readCellHeader(rec.data);
|
|
20194
20194
|
if (h && rec.data.length >= 10) {
|
|
20195
20195
|
const isst = rec.data.readUInt32LE(6);
|
|
20196
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20196
|
+
cells.push({ row: h.row, col: h.col, value: _chunk5N6MENH6cjs.escapeLiteralTags.call(void 0, _chunk5N6MENH6cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(sst[isst], () => ( "")))) });
|
|
20197
20197
|
}
|
|
20198
20198
|
break;
|
|
20199
20199
|
}
|
|
20200
20200
|
case OP_LABEL: {
|
|
20201
20201
|
const h = readCellHeader(rec.data);
|
|
20202
20202
|
if (h) {
|
|
20203
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20203
|
+
cells.push({ row: h.row, col: h.col, value: _chunk5N6MENH6cjs.escapeLiteralTags.call(void 0, _chunk5N6MENH6cjs.escapeLiteralDollar.call(void 0, decodeLabelString(rec.data))) });
|
|
20204
20204
|
}
|
|
20205
20205
|
break;
|
|
20206
20206
|
}
|
|
@@ -20216,7 +20216,7 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20216
20216
|
cells.push({
|
|
20217
20217
|
row: h.row,
|
|
20218
20218
|
col: h.col,
|
|
20219
|
-
value:
|
|
20219
|
+
value: _chunk5N6MENH6cjs.escapeLiteralTags.call(void 0, _chunk5N6MENH6cjs.escapeLiteralDollar.call(void 0, decodeFormulaStringRecord(next.data)))
|
|
20220
20220
|
});
|
|
20221
20221
|
i = j;
|
|
20222
20222
|
} else {
|
|
@@ -20328,11 +20328,11 @@ function processGlobals(records) {
|
|
|
20328
20328
|
const xfFmtIds = [];
|
|
20329
20329
|
const firstBof = records[0];
|
|
20330
20330
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
20331
|
-
throw new (0,
|
|
20331
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
20332
20332
|
}
|
|
20333
20333
|
const bof = decodeBof(firstBof.data);
|
|
20334
20334
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
20335
|
-
throw new (0,
|
|
20335
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
20336
20336
|
}
|
|
20337
20337
|
let i = 1;
|
|
20338
20338
|
while (i < records.length) {
|
|
@@ -20416,28 +20416,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20416
20416
|
try {
|
|
20417
20417
|
cfb = parseLenientCfb(buf);
|
|
20418
20418
|
} catch (e) {
|
|
20419
|
-
throw new (0,
|
|
20419
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(
|
|
20420
20420
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20421
20421
|
);
|
|
20422
20422
|
}
|
|
20423
20423
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20424
20424
|
if (!wb) {
|
|
20425
|
-
throw new (0,
|
|
20425
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20426
20426
|
}
|
|
20427
20427
|
const records = readRecords2(wb);
|
|
20428
20428
|
if (records.length === 0) {
|
|
20429
|
-
throw new (0,
|
|
20429
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20430
20430
|
}
|
|
20431
20431
|
const firstBof = decodeBof(records[0].data);
|
|
20432
20432
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20433
|
-
throw new (0,
|
|
20433
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(
|
|
20434
20434
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20435
20435
|
);
|
|
20436
20436
|
}
|
|
20437
20437
|
const globals = processGlobals(records);
|
|
20438
20438
|
const warnings = [];
|
|
20439
20439
|
if (globals.encrypted) {
|
|
20440
|
-
throw new (0,
|
|
20440
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20441
20441
|
}
|
|
20442
20442
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20443
20443
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20488,7 +20488,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20488
20488
|
pageCount: totalSheets
|
|
20489
20489
|
};
|
|
20490
20490
|
return {
|
|
20491
|
-
markdown:
|
|
20491
|
+
markdown: _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, allBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _283 => _283.tableFormat]) }),
|
|
20492
20492
|
blocks: allBlocks,
|
|
20493
20493
|
metadata,
|
|
20494
20494
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20927,7 +20927,7 @@ function isDisplayMath(el) {
|
|
|
20927
20927
|
}
|
|
20928
20928
|
|
|
20929
20929
|
// src/docx/parser.ts
|
|
20930
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20930
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkILRCRR54cjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20931
20931
|
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
20932
20932
|
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;
|
|
20933
20933
|
function matchesLocal(el, localName3) {
|
|
@@ -20985,7 +20985,7 @@ function getAttr(el, localName3) {
|
|
|
20985
20985
|
return null;
|
|
20986
20986
|
}
|
|
20987
20987
|
function parseXml2(text) {
|
|
20988
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
20988
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkILRCRR54cjs.stripDtd.call(void 0, text), "text/xml");
|
|
20989
20989
|
}
|
|
20990
20990
|
function parseStyles(xml) {
|
|
20991
20991
|
const doc = parseXml2(xml);
|
|
@@ -21121,7 +21121,7 @@ function parseFootnotes(xml) {
|
|
|
21121
21121
|
const runs = findElements(p, "r");
|
|
21122
21122
|
for (const r of runs) {
|
|
21123
21123
|
const tElements = getChildElements(r, "t");
|
|
21124
|
-
for (const t of tElements) texts.push(
|
|
21124
|
+
for (const t of tElements) texts.push(_chunk5N6MENH6cjs.escapeLiteralTags.call(void 0, _chunk5N6MENH6cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(t.textContent, () => ( "")))));
|
|
21125
21125
|
}
|
|
21126
21126
|
}
|
|
21127
21127
|
notes.set(id, texts.join("").trim());
|
|
@@ -21152,7 +21152,7 @@ function collectOmmlRoots(p) {
|
|
|
21152
21152
|
function extractRun(r) {
|
|
21153
21153
|
let text = "";
|
|
21154
21154
|
for (const el of effectiveChildElements(r)) {
|
|
21155
|
-
if (matchesLocal(el, "t")) text +=
|
|
21155
|
+
if (matchesLocal(el, "t")) text += _chunk5N6MENH6cjs.escapeLiteralTags.call(void 0, _chunk5N6MENH6cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
21156
21156
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
21157
21157
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
21158
21158
|
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
@@ -21165,7 +21165,7 @@ function extractRun(r) {
|
|
|
21165
21165
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
21166
21166
|
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
21167
21167
|
const v = va ? getAttr(va, "val") : null;
|
|
21168
|
-
if (v === "superscript" || v === "subscript") text =
|
|
21168
|
+
if (v === "superscript" || v === "subscript") text = _chunk5N6MENH6cjs.wrapScript.call(void 0, text, v === "superscript" ? "sup" : "sub");
|
|
21169
21169
|
}
|
|
21170
21170
|
return { text, bold, italic };
|
|
21171
21171
|
}
|
|
@@ -21183,7 +21183,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
21183
21183
|
function makeLink(text, rawHref) {
|
|
21184
21184
|
if (!text) return "";
|
|
21185
21185
|
if (!rawHref) return text;
|
|
21186
|
-
const href =
|
|
21186
|
+
const href = _chunkILRCRR54cjs.sanitizeHref.call(void 0, rawHref);
|
|
21187
21187
|
return href ? `[${text}](${href})` : text;
|
|
21188
21188
|
}
|
|
21189
21189
|
function collectInline(p, footnotes, rels) {
|
|
@@ -21274,7 +21274,7 @@ function collectInline(p, footnotes, rels) {
|
|
|
21274
21274
|
const m = mathText(om);
|
|
21275
21275
|
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
21276
21276
|
}
|
|
21277
|
-
const text =
|
|
21277
|
+
const text = _chunk5N6MENH6cjs.tidyScriptTags.call(void 0, parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
21278
21278
|
return { text, bold, italic, footnoteText };
|
|
21279
21279
|
}
|
|
21280
21280
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -21399,7 +21399,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21399
21399
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21400
21400
|
})
|
|
21401
21401
|
);
|
|
21402
|
-
const table2 =
|
|
21402
|
+
const table2 = _chunk5N6MENH6cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21403
21403
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21404
21404
|
return { type: "table", table: table2 };
|
|
21405
21405
|
}
|
|
@@ -21448,7 +21448,7 @@ async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
|
21448
21448
|
let data = null;
|
|
21449
21449
|
if (readBytes) data = await readZipEntry(imgFile, "uint8array");
|
|
21450
21450
|
imgIdx++;
|
|
21451
|
-
const ext =
|
|
21451
|
+
const ext = _chunkILRCRR54cjs.partExtension.call(void 0, imgPath);
|
|
21452
21452
|
const mimeMap = {
|
|
21453
21453
|
png: "image/png",
|
|
21454
21454
|
jpg: "image/jpeg",
|
|
@@ -21547,12 +21547,12 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21547
21547
|
}
|
|
21548
21548
|
async function parseDocxDocument(buffer, options) {
|
|
21549
21549
|
const readImages = _optionalChain([options, 'optionalAccess', _319 => _319.images]) !== false;
|
|
21550
|
-
|
|
21550
|
+
_chunkILRCRR54cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5, void 0, { re: MEDIA_PART_RE, skip: !readImages, never: NEVER_READ_RE });
|
|
21551
21551
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21552
21552
|
const warnings = [];
|
|
21553
21553
|
const docFile = zip.file("word/document.xml");
|
|
21554
21554
|
if (!docFile) {
|
|
21555
|
-
throw new (0,
|
|
21555
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21556
21556
|
}
|
|
21557
21557
|
let rels = /* @__PURE__ */ new Map();
|
|
21558
21558
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21599,7 +21599,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21599
21599
|
const doc = parseXml2(docXml);
|
|
21600
21600
|
const body = findElements(doc, "body");
|
|
21601
21601
|
if (body.length === 0) {
|
|
21602
|
-
throw new (0,
|
|
21602
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21603
21603
|
}
|
|
21604
21604
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
21605
21605
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -21652,7 +21652,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21652
21652
|
}
|
|
21653
21653
|
}
|
|
21654
21654
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21655
|
-
const markdown =
|
|
21655
|
+
const markdown = _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _326 => _326.tableFormat]) });
|
|
21656
21656
|
return {
|
|
21657
21657
|
markdown,
|
|
21658
21658
|
blocks,
|
|
@@ -21666,7 +21666,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21666
21666
|
// src/pptx/parser.ts
|
|
21667
21667
|
|
|
21668
21668
|
|
|
21669
|
-
var MAX_DECOMPRESS_SIZE6 =
|
|
21669
|
+
var MAX_DECOMPRESS_SIZE6 = _chunkILRCRR54cjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
21670
21670
|
var MEDIA_PART_RE2 = /^ppt\/(?:media|embeddings)\//;
|
|
21671
21671
|
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;
|
|
21672
21672
|
var MAX_ZIP_ENTRIES2 = 1e4;
|
|
@@ -21689,7 +21689,7 @@ var IMAGE_MIME = {
|
|
|
21689
21689
|
svg: "image/svg+xml"
|
|
21690
21690
|
};
|
|
21691
21691
|
function parseXml3(text) {
|
|
21692
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21692
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkILRCRR54cjs.stripDtd.call(void 0, text), "text/xml");
|
|
21693
21693
|
}
|
|
21694
21694
|
function getAttr2(el, name) {
|
|
21695
21695
|
const attrs = el.attributes;
|
|
@@ -21756,7 +21756,7 @@ async function slideParts(zip) {
|
|
|
21756
21756
|
names.sort((a, b) => Number(SLIDE_PART_RE.exec(a)[1]) - Number(SLIDE_PART_RE.exec(b)[1]));
|
|
21757
21757
|
ordered.push(...names);
|
|
21758
21758
|
}
|
|
21759
|
-
if (ordered.length > MAX_SLIDES) throw new (0,
|
|
21759
|
+
if (ordered.length > MAX_SLIDES) throw new (0, _chunkILRCRR54cjs.KordocError)(`PPTX \uC2AC\uB77C\uC774\uB4DC \uC218 \uCD08\uACFC: ${ordered.length} (\uCD5C\uB300 ${MAX_SLIDES})`);
|
|
21760
21760
|
return ordered;
|
|
21761
21761
|
}
|
|
21762
21762
|
function paragraphText(p) {
|
|
@@ -21767,12 +21767,12 @@ function paragraphText(p) {
|
|
|
21767
21767
|
const t = findChildByLocalName(child, "t");
|
|
21768
21768
|
const rPr = findChildByLocalName(child, "rPr");
|
|
21769
21769
|
const baseline = Number(rPr ? _nullishCoalesce(getAttr2(rPr, "baseline"), () => ( 0)) : 0);
|
|
21770
|
-
if (t) text +=
|
|
21770
|
+
if (t) text += _chunk5N6MENH6cjs.wrapScript.call(void 0, _chunk5N6MENH6cjs.escapeLiteralTags.call(void 0, _chunk5N6MENH6cjs.escapeLiteralDollar.call(void 0, rawTextContent(t))), baseline > 0 ? "sup" : baseline < 0 ? "sub" : null);
|
|
21771
21771
|
} else if (name === "br") {
|
|
21772
21772
|
text += " ";
|
|
21773
21773
|
}
|
|
21774
21774
|
}
|
|
21775
|
-
return
|
|
21775
|
+
return _chunk5N6MENH6cjs.tidyScriptTags.call(void 0, text.replace(/\s+/g, " ").trim());
|
|
21776
21776
|
}
|
|
21777
21777
|
function bodyParagraphs(txBody) {
|
|
21778
21778
|
const out = [];
|
|
@@ -21833,7 +21833,7 @@ function parseTable2(tbl2, page, keepEmptyCols) {
|
|
|
21833
21833
|
});
|
|
21834
21834
|
return cells;
|
|
21835
21835
|
});
|
|
21836
|
-
const table2 =
|
|
21836
|
+
const table2 = _chunk5N6MENH6cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21837
21837
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21838
21838
|
return { type: "table", table: table2, pageNumber: page };
|
|
21839
21839
|
}
|
|
@@ -21846,7 +21846,7 @@ async function pictureBlock(pic, ctx) {
|
|
|
21846
21846
|
if (!filename) {
|
|
21847
21847
|
const file = ctx.zip.file(rel.target);
|
|
21848
21848
|
if (!file) return null;
|
|
21849
|
-
const ext =
|
|
21849
|
+
const ext = _chunkILRCRR54cjs.partExtension.call(void 0, rel.target);
|
|
21850
21850
|
filename = `image_${String(ctx.imageNames.size + 1).padStart(3, "0")}.${ext}`;
|
|
21851
21851
|
try {
|
|
21852
21852
|
if (_optionalChain([ctx, 'access', _330 => _330.options, 'optionalAccess', _331 => _331.images]) !== false) {
|
|
@@ -21924,10 +21924,10 @@ async function notesText(zip, rels) {
|
|
|
21924
21924
|
return texts.join(" ");
|
|
21925
21925
|
}
|
|
21926
21926
|
async function parsePptxDocument(buffer, options) {
|
|
21927
|
-
|
|
21927
|
+
_chunkILRCRR54cjs.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 });
|
|
21928
21928
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21929
21929
|
if (!zip.file("ppt/presentation.xml")) {
|
|
21930
|
-
throw new (0,
|
|
21930
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 PPTX \uD30C\uC77C: ppt/presentation.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21931
21931
|
}
|
|
21932
21932
|
const warnings = [];
|
|
21933
21933
|
const blocks = [];
|
|
@@ -21974,7 +21974,7 @@ async function parsePptxDocument(buffer, options) {
|
|
|
21974
21974
|
}
|
|
21975
21975
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")), pageNumber: b.pageNumber }));
|
|
21976
21976
|
return {
|
|
21977
|
-
markdown:
|
|
21977
|
+
markdown: _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _336 => _336.tableFormat]) }),
|
|
21978
21978
|
blocks,
|
|
21979
21979
|
metadata,
|
|
21980
21980
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -21990,11 +21990,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
21990
21990
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
21991
21991
|
function parseHwpmlDocument(buffer, options) {
|
|
21992
21992
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
21993
|
-
throw new (0,
|
|
21993
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
21994
21994
|
}
|
|
21995
21995
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
21996
21996
|
const normalized = text.replace(/ /g, " ");
|
|
21997
|
-
const xml =
|
|
21997
|
+
const xml = _chunkILRCRR54cjs.stripDtd.call(void 0, normalized);
|
|
21998
21998
|
const warnings = [];
|
|
21999
21999
|
const parser = new (0, _xmldom.DOMParser)({
|
|
22000
22000
|
onError: (_level, msg2) => {
|
|
@@ -22034,7 +22034,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
22034
22034
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _338 => _338.keepTrailingEmptyCols]), () => ( false)));
|
|
22035
22035
|
}
|
|
22036
22036
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
22037
|
-
const markdown =
|
|
22037
|
+
const markdown = _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _339 => _339.tableFormat]) });
|
|
22038
22038
|
return {
|
|
22039
22039
|
markdown,
|
|
22040
22040
|
blocks,
|
|
@@ -22141,7 +22141,7 @@ function collectCharText(node, parts, depth = 0) {
|
|
|
22141
22141
|
if (tag === "CHAR") {
|
|
22142
22142
|
for (const c of Array.from(el.childNodes)) {
|
|
22143
22143
|
const t = c.nodeType === 1 ? localName(c) === "TAB" ? " " : rawTextContent(c) : c.nodeType === 3 || c.nodeType === 4 ? _nullishCoalesce(c.nodeValue, () => ( "")) : "";
|
|
22144
|
-
if (t) parts.push(
|
|
22144
|
+
if (t) parts.push(_chunk5N6MENH6cjs.escapeLiteralTags.call(void 0, t));
|
|
22145
22145
|
}
|
|
22146
22146
|
} else if (tag === "TABLE" || tag === "PICTURE" || tag === "SHAPEOBJECT") {
|
|
22147
22147
|
} else if (tag === "AUTONUM") {
|
|
@@ -22201,7 +22201,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
22201
22201
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
22202
22202
|
cellRows[r].push(cell2);
|
|
22203
22203
|
}
|
|
22204
|
-
const table2 =
|
|
22204
|
+
const table2 = _chunk5N6MENH6cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
22205
22205
|
if (structured.length > 0) {
|
|
22206
22206
|
const claimed = /* @__PURE__ */ new Set();
|
|
22207
22207
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -23964,7 +23964,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
23964
23964
|
};
|
|
23965
23965
|
}
|
|
23966
23966
|
async function extractClickHereFields(hwpxBuffer) {
|
|
23967
|
-
|
|
23967
|
+
_chunkILRCRR54cjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
23968
23968
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
23969
23969
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
23970
23970
|
const fields = [];
|
|
@@ -24000,7 +24000,7 @@ function readZipEntries(buf) {
|
|
|
24000
24000
|
}
|
|
24001
24001
|
function localDataStart(view, localOffset) {
|
|
24002
24002
|
if (view.getUint32(localOffset, true) !== LOCAL_SIG) {
|
|
24003
|
-
throw new (0,
|
|
24003
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24004
24004
|
}
|
|
24005
24005
|
const nameLen = view.getUint16(localOffset + 26, true);
|
|
24006
24006
|
const extraLen = view.getUint16(localOffset + 28, true);
|
|
@@ -24030,19 +24030,19 @@ function parseCentralDirectory(buf) {
|
|
|
24030
24030
|
}
|
|
24031
24031
|
}
|
|
24032
24032
|
}
|
|
24033
|
-
if (eocdOffset < 0) throw new (0,
|
|
24033
|
+
if (eocdOffset < 0) throw new (0, _chunkILRCRR54cjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24034
24034
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
24035
24035
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
24036
24036
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
24037
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
24037
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkILRCRR54cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24038
24038
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
24039
|
-
throw new (0,
|
|
24039
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24040
24040
|
}
|
|
24041
24041
|
const decoder = new TextDecoder("utf-8");
|
|
24042
24042
|
const entries = [];
|
|
24043
24043
|
let pos = cdOffset;
|
|
24044
24044
|
for (let i = 0; i < totalEntries; i++) {
|
|
24045
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
24045
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkILRCRR54cjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
24046
24046
|
const flags = view.getUint16(pos + 8, true);
|
|
24047
24047
|
const method = view.getUint16(pos + 10, true);
|
|
24048
24048
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -24053,7 +24053,7 @@ function parseCentralDirectory(buf) {
|
|
|
24053
24053
|
const commentLen = view.getUint16(pos + 32, true);
|
|
24054
24054
|
const localOffset = view.getUint32(pos + 42, true);
|
|
24055
24055
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
24056
|
-
throw new (0,
|
|
24056
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24057
24057
|
}
|
|
24058
24058
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
24059
24059
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -24082,11 +24082,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24082
24082
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
24083
24083
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
24084
24084
|
for (const name of replacements.keys()) {
|
|
24085
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
24085
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkILRCRR54cjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24086
24086
|
}
|
|
24087
24087
|
if (additions) {
|
|
24088
24088
|
for (const name of additions.keys()) {
|
|
24089
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
24089
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkILRCRR54cjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24090
24090
|
}
|
|
24091
24091
|
}
|
|
24092
24092
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -24105,7 +24105,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24105
24105
|
offset += seg.length;
|
|
24106
24106
|
continue;
|
|
24107
24107
|
}
|
|
24108
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
24108
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkILRCRR54cjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24109
24109
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
24110
24110
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
24111
24111
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -24113,7 +24113,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24113
24113
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
24114
24114
|
const method = e.method;
|
|
24115
24115
|
if (method !== 0 && method !== 8) {
|
|
24116
|
-
throw new (0,
|
|
24116
|
+
throw new (0, _chunkILRCRR54cjs.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`);
|
|
24117
24117
|
}
|
|
24118
24118
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
24119
24119
|
const crc = crc32(newData);
|
|
@@ -24211,11 +24211,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24211
24211
|
// src/form/filler-hwpx.ts
|
|
24212
24212
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
24213
24213
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
24214
|
-
|
|
24214
|
+
_chunkILRCRR54cjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24215
24215
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24216
24216
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24217
24217
|
if (sectionPaths.length === 0) {
|
|
24218
|
-
throw new (0,
|
|
24218
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24219
24219
|
}
|
|
24220
24220
|
const warnings = [];
|
|
24221
24221
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -24607,7 +24607,7 @@ var MIN_SIDE = 24;
|
|
|
24607
24607
|
async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
24608
24608
|
const ocr = _optionalChain([options, 'optionalAccess', _485 => _485.ocr]);
|
|
24609
24609
|
if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
|
|
24610
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
24610
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-VS42CA7V.cjs")));
|
|
24611
24611
|
let inserted = false, unreadable = 0;
|
|
24612
24612
|
let failed = null;
|
|
24613
24613
|
const walk = async (list, depth) => {
|
|
@@ -24648,7 +24648,7 @@ async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
|
24648
24648
|
function ocrBytes(img) {
|
|
24649
24649
|
const mime = img.mimeType.toLowerCase();
|
|
24650
24650
|
if (mime.includes("wmf") || mime.includes("emf")) return null;
|
|
24651
|
-
if (mime.includes("bmp")) return
|
|
24651
|
+
if (mime.includes("bmp")) return _chunkKXTCBOUCcjs.bmpToPng.call(void 0, img.data);
|
|
24652
24652
|
return img.data;
|
|
24653
24653
|
}
|
|
24654
24654
|
async function tooSmall(bytes) {
|
|
@@ -24817,7 +24817,7 @@ function classifyTableTree(blocks) {
|
|
|
24817
24817
|
return blocks;
|
|
24818
24818
|
}
|
|
24819
24819
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
24820
|
-
const structured = hasMerged(table2) ||
|
|
24820
|
+
const structured = hasMerged(table2) || _chunk5N6MENH6cjs.hasStructuredCellContent.call(void 0, table2);
|
|
24821
24821
|
if (opts.smartVisual && _optionalChain([table2, 'access', _501 => _501.classification, 'optionalAccess', _502 => _502.kind]) === "non-tabular-layout") return "visual";
|
|
24822
24822
|
return structured ? "html" : "gfm";
|
|
24823
24823
|
}
|
|
@@ -35429,11 +35429,11 @@ function cjkWidthEm1000(cp) {
|
|
|
35429
35429
|
function fixedPitchWidthEm1000(cp) {
|
|
35430
35430
|
return cp < 128 || isHalfwidthForm(cp) ? 500 : 1e3;
|
|
35431
35431
|
}
|
|
35432
|
-
var
|
|
35432
|
+
var isPuaFull = (cp) => cp <= 983803 || cp >= 983903 && cp <= 984052;
|
|
35433
35433
|
function widthFnOf(faceClass, fallback = true) {
|
|
35434
35434
|
const base = baseWidthFnOf(faceClass, fallback);
|
|
35435
35435
|
const hcr = faceClass === "hcr" || faceClass === "font:\uD568\uCD08\uB86C\uB3CB\uC6C0" || faceClass === "font:\uD568\uCD08\uB86C\uBC14\uD0D5";
|
|
35436
|
-
const f = (cp) => cp >= 983040 ?
|
|
35436
|
+
const f = (cp) => cp >= 983040 ? isPuaFull(cp) ? 1e3 : 500 : cp === 61600 ? base(32) : !hcr && cp >= 10102 && cp <= 10131 ? 1e3 : base(cp);
|
|
35437
35437
|
if (fallback && (faceClass === "fixedPitch" || faceClass === "cjk")) return (cp) => isZeroWidthCp(cp) ? 0 : _nullishCoalesce(HANCOM_FALLBACK_W[cp], () => ( f(cp)));
|
|
35438
35438
|
return (cp) => isZeroWidthCp(cp) ? 0 : f(cp);
|
|
35439
35439
|
}
|
|
@@ -35903,7 +35903,7 @@ function findAgency(name) {
|
|
|
35903
35903
|
}
|
|
35904
35904
|
function agencyStyle(name) {
|
|
35905
35905
|
const s = findAgency(name);
|
|
35906
|
-
if (!s) throw new (0,
|
|
35906
|
+
if (!s) throw new (0, _chunkILRCRR54cjs.KordocError)(`agency: \uC2E4\uCE21 \uC11C\uC2DD\uC774 \uC5C6\uB294 \uAE30\uAD00\uC785\uB2C8\uB2E4 "${name}" \u2014 ${AGENCY_COMMON_NAME} \uB610\uB294 ${agencyNames().join("\xB7")}`);
|
|
35907
35907
|
return s;
|
|
35908
35908
|
}
|
|
35909
35909
|
function applyAgency(opts, preset) {
|
|
@@ -36967,7 +36967,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
36967
36967
|
}
|
|
36968
36968
|
function assertFiniteRange(name, value, min, max) {
|
|
36969
36969
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
36970
|
-
throw new (0,
|
|
36970
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
36971
36971
|
}
|
|
36972
36972
|
}
|
|
36973
36973
|
function validateGongmunOptions(opts) {
|
|
@@ -36985,10 +36985,10 @@ function validateGongmunOptions(opts) {
|
|
|
36985
36985
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
36986
36986
|
}
|
|
36987
36987
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
36988
|
-
throw new (0,
|
|
36988
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
36989
36989
|
}
|
|
36990
36990
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
36991
|
-
throw new (0,
|
|
36991
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
36992
36992
|
}
|
|
36993
36993
|
}
|
|
36994
36994
|
if (opts.sizes) {
|
|
@@ -36997,24 +36997,24 @@ function validateGongmunOptions(opts) {
|
|
|
36997
36997
|
}
|
|
36998
36998
|
}
|
|
36999
36999
|
if (opts.approval && opts.approval.length > 6) {
|
|
37000
|
-
throw new (0,
|
|
37000
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("approval must contain at most 6 labels");
|
|
37001
37001
|
}
|
|
37002
37002
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
37003
37003
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
37004
37004
|
for (const n of nums) {
|
|
37005
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
37005
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkILRCRR54cjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
37006
37006
|
}
|
|
37007
37007
|
}
|
|
37008
37008
|
if (opts.levels) {
|
|
37009
37009
|
for (const [key, st] of Object.entries(opts.levels)) {
|
|
37010
37010
|
const depth = Number(key);
|
|
37011
37011
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
37012
|
-
throw new (0,
|
|
37012
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
37013
37013
|
}
|
|
37014
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
37014
|
+
if (!st || typeof st !== "object") throw new (0, _chunkILRCRR54cjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
37015
37015
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
37016
37016
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
37017
|
-
throw new (0,
|
|
37017
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
37018
37018
|
}
|
|
37019
37019
|
}
|
|
37020
37020
|
}
|
|
@@ -37072,7 +37072,7 @@ function resolveChecklist(c, preset) {
|
|
|
37072
37072
|
function hexColorOption(name, value) {
|
|
37073
37073
|
if (value === void 0) return void 0;
|
|
37074
37074
|
const v = value.trim();
|
|
37075
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
37075
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkILRCRR54cjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
37076
37076
|
return v.toUpperCase();
|
|
37077
37077
|
}
|
|
37078
37078
|
function resolveGongmun(input) {
|
|
@@ -37148,21 +37148,21 @@ function standardMarker(depth, n) {
|
|
|
37148
37148
|
case 0:
|
|
37149
37149
|
return `${n + 1}.`;
|
|
37150
37150
|
case 1:
|
|
37151
|
-
return `${
|
|
37151
|
+
return `${_chunk5N6MENH6cjs.hangulOrdinal.call(void 0, n)}.`;
|
|
37152
37152
|
case 2:
|
|
37153
37153
|
return `${n + 1})`;
|
|
37154
37154
|
case 3:
|
|
37155
|
-
return `${
|
|
37155
|
+
return `${_chunk5N6MENH6cjs.hangulOrdinal.call(void 0, n)})`;
|
|
37156
37156
|
case 4:
|
|
37157
37157
|
return `(${n + 1})`;
|
|
37158
37158
|
case 5:
|
|
37159
|
-
return `(${
|
|
37159
|
+
return `(${_chunk5N6MENH6cjs.hangulOrdinal.call(void 0, n)})`;
|
|
37160
37160
|
case 6:
|
|
37161
|
-
return
|
|
37161
|
+
return _chunk5N6MENH6cjs.circledNumber.call(void 0, n);
|
|
37162
37162
|
case 7:
|
|
37163
|
-
return
|
|
37163
|
+
return _chunk5N6MENH6cjs.circledHangul.call(void 0, n);
|
|
37164
37164
|
default:
|
|
37165
|
-
return
|
|
37165
|
+
return _chunk5N6MENH6cjs.circledHangul.call(void 0, n);
|
|
37166
37166
|
}
|
|
37167
37167
|
}
|
|
37168
37168
|
function reportMarker(depth, bullet2 = "\u25CB", asteriskThird = false) {
|
|
@@ -37816,7 +37816,7 @@ function parseInlineMarkdown(text) {
|
|
|
37816
37816
|
else spans.push(...emphasisSpans(m[0]));
|
|
37817
37817
|
} else {
|
|
37818
37818
|
const anchor = m[2] || m[3];
|
|
37819
|
-
const href = _nullishCoalesce(
|
|
37819
|
+
const href = _nullishCoalesce(_chunkILRCRR54cjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
37820
37820
|
const sub = emphasisSpans(anchor);
|
|
37821
37821
|
if (href) for (const s of sub) s.href = href;
|
|
37822
37822
|
spans.push(...sub);
|
|
@@ -38037,7 +38037,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
38037
38037
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
38038
38038
|
const got = m ? Number(m[1]) : NaN;
|
|
38039
38039
|
if (got !== startId + i) {
|
|
38040
|
-
throw new (0,
|
|
38040
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(
|
|
38041
38041
|
`\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)`
|
|
38042
38042
|
);
|
|
38043
38043
|
}
|
|
@@ -38128,7 +38128,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
38128
38128
|
}
|
|
38129
38129
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
38130
38130
|
if (rows.length !== expectedBase) {
|
|
38131
|
-
throw new (0,
|
|
38131
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(
|
|
38132
38132
|
`\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`
|
|
38133
38133
|
);
|
|
38134
38134
|
}
|
|
@@ -38636,7 +38636,7 @@ function variantMapper(fit, blockIdx, base = CHAR_VARIANT_BASE) {
|
|
|
38636
38636
|
const vi = fit.variants.indexOf(r);
|
|
38637
38637
|
return (id) => id >= 0 && id <= 3 ? base + vi * 4 + id : id;
|
|
38638
38638
|
}
|
|
38639
|
-
var ORDINAL_SYLLABLES = new Set(Array.from({ length: 84 }, (_, i) =>
|
|
38639
|
+
var ORDINAL_SYLLABLES = new Set(Array.from({ length: 84 }, (_, i) => _chunk5N6MENH6cjs.hangulOrdinal.call(void 0, i)));
|
|
38640
38640
|
function literalMarkerDepth(text) {
|
|
38641
38641
|
const t = text.trimStart();
|
|
38642
38642
|
let m;
|
|
@@ -39137,7 +39137,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
39137
39137
|
return best;
|
|
39138
39138
|
}
|
|
39139
39139
|
function normForMatch(text) {
|
|
39140
|
-
return
|
|
39140
|
+
return _chunk5N6MENH6cjs.sanitizeText.call(void 0, text.replace(/\\\$/g, "$").replace(/\\(?=<\/?(?:u|sup|sub)>)/g, "")).replace(/\s+/g, " ").trim();
|
|
39141
39141
|
}
|
|
39142
39142
|
function unescapeGfm(text) {
|
|
39143
39143
|
return text.replace(/\\([~*_`|#<$\\])/g, "$1");
|
|
@@ -39159,7 +39159,7 @@ function replicateGfmTable(table2) {
|
|
|
39159
39159
|
const cell2 = _optionalChain([cells, 'access', _632 => _632[r], 'optionalAccess', _633 => _633[c]]);
|
|
39160
39160
|
if (!cell2) continue;
|
|
39161
39161
|
display[r][c] = {
|
|
39162
|
-
text:
|
|
39162
|
+
text: _chunk5N6MENH6cjs.escapeGfm.call(void 0, _chunk5N6MENH6cjs.sanitizeText.call(void 0, cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\r\n|\r|\n/g, "<br>"),
|
|
39163
39163
|
gridR: r,
|
|
39164
39164
|
gridC: c
|
|
39165
39165
|
};
|
|
@@ -39199,16 +39199,16 @@ function replicateCellInnerHtml(cell2) {
|
|
|
39199
39199
|
if (_optionalChain([cell2, 'access', _634 => _634.blocks, 'optionalAccess', _635 => _635.length])) {
|
|
39200
39200
|
return cell2.blocks.map((b) => {
|
|
39201
39201
|
if (b.type === "table" && b.table) {
|
|
39202
|
-
const cap = b.table.caption ?
|
|
39203
|
-
return (cap ?
|
|
39202
|
+
const cap = b.table.caption ? _chunk5N6MENH6cjs.sanitizeText.call(void 0, b.table.caption) : "";
|
|
39203
|
+
return (cap ? _chunk5N6MENH6cjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
39204
39204
|
}
|
|
39205
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
39206
|
-
const note =
|
|
39207
|
-
const t = (
|
|
39208
|
-
return ((t ?
|
|
39205
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkILRCRR54cjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
39206
|
+
const note = _chunk5N6MENH6cjs.noteTableHtml.call(void 0, b);
|
|
39207
|
+
const t = (_chunk5N6MENH6cjs.sanitizeText.call(void 0, _chunk5N6MENH6cjs.visibleText.call(void 0, b)) + (note ? "" : _chunk5N6MENH6cjs.noteSuffix.call(void 0, b))).trim();
|
|
39208
|
+
return ((t ? _chunk5N6MENH6cjs.escapeHtmlCellText.call(void 0, t).replace(/\n/g, "<br>") : "") + note).trim();
|
|
39209
39209
|
}).filter(Boolean).join("<br>");
|
|
39210
39210
|
}
|
|
39211
|
-
return
|
|
39211
|
+
return _chunk5N6MENH6cjs.escapeHtmlCellText.call(void 0, _chunk5N6MENH6cjs.sanitizeText.call(void 0, cell2.text)).replace(/\n/g, "<br>");
|
|
39212
39212
|
}
|
|
39213
39213
|
function replicateTableToHtml(table2) {
|
|
39214
39214
|
const rows = replicateHtmlTable(table2);
|
|
@@ -39285,7 +39285,7 @@ function parseHtmlTable(raw) {
|
|
|
39285
39285
|
const cs = parseInt(_optionalChain([attrs, 'access', _638 => _638.match, 'call', _639 => _639(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _640 => _640[1]]) || "1", 10);
|
|
39286
39286
|
const rs = parseInt(_optionalChain([attrs, 'access', _641 => _641.match, 'call', _642 => _642(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _643 => _643[1]]) || "1", 10);
|
|
39287
39287
|
cellStart = m.index + m[0].length;
|
|
39288
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
39288
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunk5N6MENH6cjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunk5N6MENH6cjs.MAX_ROWS) };
|
|
39289
39289
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
39290
39290
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
39291
39291
|
cellStart = -1;
|
|
@@ -39310,11 +39310,11 @@ function htmlCellInnerToLines(inner) {
|
|
|
39310
39310
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
39311
39311
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
39312
39312
|
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _644 => _644[1]]), () => ( _optionalChain([m, 'optionalAccess', _645 => _645[2]])));
|
|
39313
|
-
if (src) imgSrcs.push(
|
|
39313
|
+
if (src) imgSrcs.push(_chunkILRCRR54cjs.unescapeHtml.call(void 0, src));
|
|
39314
39314
|
return "";
|
|
39315
39315
|
});
|
|
39316
39316
|
}
|
|
39317
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
39317
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkILRCRR54cjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
39318
39318
|
return { lines, hadNonText, imgSrcs };
|
|
39319
39319
|
}
|
|
39320
39320
|
function splitCellByTopLevelTables(html) {
|
|
@@ -40130,8 +40130,8 @@ function layoutHtmlRows(rows) {
|
|
|
40130
40130
|
let c = 0;
|
|
40131
40131
|
for (const cell2 of rows[r].cells) {
|
|
40132
40132
|
while (occupied.has(`${r},${c}`)) c++;
|
|
40133
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
40134
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
40133
|
+
const colSpan = clampSpan(cell2.colSpan, _chunk5N6MENH6cjs.MAX_COLS);
|
|
40134
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunk5N6MENH6cjs.MAX_ROWS);
|
|
40135
40135
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
40136
40136
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
40137
40137
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -41595,7 +41595,7 @@ function buildMinistryItemBand(n, text, ctx, before2) {
|
|
|
41595
41595
|
const base = { font: MINISTRY.bandFont, pt: s.pt, bold: false };
|
|
41596
41596
|
const f = fitOneLine(plain(text), MINISTRY.bandFont, s.pt, w - 1800, s.pt);
|
|
41597
41597
|
const styled = f.overflow || f.ratio === 100 && f.spacing === 0 ? base : { ...base, ratio: f.ratio, spacing: f.spacing };
|
|
41598
|
-
const runs = ministryRuns(
|
|
41598
|
+
const runs = ministryRuns(_chunk5N6MENH6cjs.circledNumber.call(void 0, n - 1), text, ctx, styled, MINISTRY.blue, MINISTRY.blue);
|
|
41599
41599
|
const p = reg.para({ align: "LEFT", lineSp: 130, left: 300 });
|
|
41600
41600
|
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" });
|
|
41601
41601
|
return host(ftbl([cell2], w, s.h, 1, { bottomGap: 700 }), reg.para({ align: "LEFT", lineSp: 100, before: before2, keepWithNext: true }), reg.char(base));
|
|
@@ -42466,7 +42466,7 @@ function builtinTemplateDir() {
|
|
|
42466
42466
|
for (const c of candidates) {
|
|
42467
42467
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
42468
42468
|
}
|
|
42469
|
-
throw new (0,
|
|
42469
|
+
throw new (0, _chunkILRCRR54cjs.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)");
|
|
42470
42470
|
}
|
|
42471
42471
|
function readBuiltinTemplate(t) {
|
|
42472
42472
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -42944,12 +42944,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
42944
42944
|
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>`;
|
|
42945
42945
|
}
|
|
42946
42946
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
42947
|
-
if (ops.length === 0) throw new (0,
|
|
42947
|
+
if (ops.length === 0) throw new (0, _chunkILRCRR54cjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42948
42948
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
42949
|
-
|
|
42949
|
+
_chunkILRCRR54cjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
42950
42950
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
42951
42951
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _858 => _858.match, 'call', _859 => _859(/(\d+)\.xml$/i), 'optionalAccess', _860 => _860[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _861 => _861.match, 'call', _862 => _862(/(\d+)\.xml$/i), 'optionalAccess', _863 => _863[1]]), () => ( 0))));
|
|
42952
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
42952
|
+
if (sectionPaths.length === 0) throw new (0, _chunkILRCRR54cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42953
42953
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
42954
42954
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
42955
42955
|
const styles = headerPath ? parseRenderStyles(await readZipEntry(zip.file(headerPath), "text")) : null;
|
|
@@ -42990,11 +42990,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42990
42990
|
const manifestItems = [];
|
|
42991
42991
|
const placed = [];
|
|
42992
42992
|
for (const op of ops) {
|
|
42993
|
-
if (!op.anchor) throw new (0,
|
|
42994
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
42993
|
+
if (!op.anchor) throw new (0, _chunkILRCRR54cjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
42994
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkILRCRR54cjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
42995
42995
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
42996
|
-
if (!MIME[ext]) throw new (0,
|
|
42997
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
42996
|
+
if (!MIME[ext]) throw new (0, _chunkILRCRR54cjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
42997
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkILRCRR54cjs.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)`);
|
|
42998
42998
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
42999
42999
|
let found = null;
|
|
43000
43000
|
let total = 0;
|
|
@@ -43027,7 +43027,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
43027
43027
|
}
|
|
43028
43028
|
}
|
|
43029
43029
|
}
|
|
43030
|
-
throw new (0,
|
|
43030
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(
|
|
43031
43031
|
`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)})`
|
|
43032
43032
|
);
|
|
43033
43033
|
}
|
|
@@ -43035,7 +43035,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
43035
43035
|
const xml = sectionXmls[si];
|
|
43036
43036
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
43037
43037
|
if (!run) {
|
|
43038
|
-
throw new (0,
|
|
43038
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
43039
43039
|
}
|
|
43040
43040
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _864 => _864.charPr, 'access', _865 => _865.get, 'call', _866 => _866(run.charPr), 'optionalAccess', _867 => _867.height]), () => ( 1e3));
|
|
43041
43041
|
const fontPt = charPrHeight / 100;
|
|
@@ -43313,7 +43313,7 @@ function pick(map, keys) {
|
|
|
43313
43313
|
return out;
|
|
43314
43314
|
}
|
|
43315
43315
|
async function hwpxToProfile(input) {
|
|
43316
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
43316
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkILRCRR54cjs.toArrayBuffer.call(void 0, input);
|
|
43317
43317
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
43318
43318
|
const parser = createXmlParser();
|
|
43319
43319
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _892 => _892.file, 'call', _893 => _893(/[Hh]eader\.xml$/), 'optionalAccess', _894 => _894[0]])));
|
|
@@ -43615,7 +43615,7 @@ function moneyHangulCheck(m) {
|
|
|
43615
43615
|
const n = Number(m[1].replace(/,/g, ""));
|
|
43616
43616
|
const h = hangulToNumber(m[2].replace(/\s/g, ""));
|
|
43617
43617
|
if (!Number.isFinite(n) || h === null || h === n) return null;
|
|
43618
|
-
return `\uAE08${m[1]}\uC6D0(\uAE08${
|
|
43618
|
+
return `\uAE08${m[1]}\uC6D0(\uAE08${_chunk5N6MENH6cjs.hangulAmount.call(void 0, n)}\uC6D0)`;
|
|
43619
43619
|
}
|
|
43620
43620
|
var RULES = [
|
|
43621
43621
|
// 날짜 ─ 온점 뒤 한 칸, 0 패딩 금지, 연도 4자리, 끝 마침표
|
|
@@ -43902,7 +43902,7 @@ function lintGongmunText(text, opts) {
|
|
|
43902
43902
|
}
|
|
43903
43903
|
function dictSuggest(code, match) {
|
|
43904
43904
|
const m = match.trim();
|
|
43905
|
-
if (code === "MONEY_NO_HANGUL") return `${m} \u2192 ${m}(\uAE08${
|
|
43905
|
+
if (code === "MONEY_NO_HANGUL") return `${m} \u2192 ${m}(\uAE08${_chunk5N6MENH6cjs.hangulAmount.call(void 0, m)}\uC6D0)`;
|
|
43906
43906
|
if (code === "DATE_HYPHEN") {
|
|
43907
43907
|
const d = m.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
|
|
43908
43908
|
if (d) return `${m} \u2192 ${d[1]}. ${Number(d[2])}. ${Number(d[3])}.`;
|
|
@@ -44286,7 +44286,7 @@ function patchTableRows(input) {
|
|
|
44286
44286
|
const cells = input.editedCells(ins.ei);
|
|
44287
44287
|
if (!cells) return skip("\uC0BD\uC785 \uD589\uC5D0 \uC774\uBBF8\uC9C0/\uC911\uCCA9\uD45C \uD3EC\uD568 \u2014 \uD589 \uCD94\uAC00 \uBBF8\uC9C0\uC6D0");
|
|
44288
44288
|
for (const cell2 of cells) {
|
|
44289
|
-
const unstable = cell2.lines.find((l) =>
|
|
44289
|
+
const unstable = cell2.lines.find((l) => _chunk5N6MENH6cjs.sanitizeText.call(void 0, l) !== l);
|
|
44290
44290
|
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");
|
|
44291
44291
|
}
|
|
44292
44292
|
const tmplCells = scanTable.rows[template];
|
|
@@ -44481,14 +44481,14 @@ function buildEmbeddedLineSplices(para2, xml, newLines) {
|
|
|
44481
44481
|
}
|
|
44482
44482
|
if (text !== para2.text || !/[\r\n]/.test(text) || /<br\s*\/?\s*>/i.test(text)) return null;
|
|
44483
44483
|
const lines = text.split(/\r\n|\r|\n/);
|
|
44484
|
-
if (lines.length !== newLines.length || lines.some((line) => !line.trim() ||
|
|
44484
|
+
if (lines.length !== newLines.length || lines.some((line) => !line.trim() || _chunk5N6MENH6cjs.sanitizeText.call(void 0, line) !== line.trim())) return null;
|
|
44485
44485
|
const splices = [];
|
|
44486
44486
|
let offset = 0;
|
|
44487
44487
|
for (let i = 0; i < lines.length; i++) {
|
|
44488
44488
|
const line = lines[i];
|
|
44489
44489
|
const orig = line.trim();
|
|
44490
44490
|
const next = newLines[i];
|
|
44491
|
-
if (
|
|
44491
|
+
if (_chunk5N6MENH6cjs.sanitizeText.call(void 0, next) !== next || /[\r\n]/.test(next) || /[\uD800-\uDFFF]/u.test(next) || decodeXmlEntities(escapeXmlText(next)) !== next) return null;
|
|
44492
44492
|
let prefix = 0;
|
|
44493
44493
|
while (prefix < orig.length && prefix < next.length && orig[prefix] === next[prefix]) prefix++;
|
|
44494
44494
|
if (prefix > 0 && /[\uD800-\uDBFF]/.test(orig[prefix - 1]) && /[\uDC00-\uDFFF]/.test(_nullishCoalesce(orig[prefix], () => ( "")))) prefix--;
|
|
@@ -44686,6 +44686,400 @@ function minimalTextSplices(para2, xml, origPlain, newPlain, origSegs, newSegs)
|
|
|
44686
44686
|
return out;
|
|
44687
44687
|
}
|
|
44688
44688
|
|
|
44689
|
+
// src/roundtrip/structure-edit.ts
|
|
44690
|
+
var LINESEG_RE2 = /<(\w+:)?linesegarray\b[^>]*?(?:\/>|>[\s\S]*?<\/\1linesegarray>)/g;
|
|
44691
|
+
var OBJECT_RE = /<(?:\w+:)?(?:secPr|ctrl|tbl|pic|container|rect|ellipse|arc|polygon|curve|line|connectLine|textart|ole|equation|chart|video|drawText|switch)\b/;
|
|
44692
|
+
var SYMBOL_FAMILY = {
|
|
44693
|
+
"\u25CB": "\u25CB",
|
|
44694
|
+
"\u3147": "\u25CB",
|
|
44695
|
+
"\u25E6": "\u25CB",
|
|
44696
|
+
"\u274D": "\u25CB",
|
|
44697
|
+
"o": "\u25CB",
|
|
44698
|
+
"\u25CF": "\u25CF",
|
|
44699
|
+
"-": "-",
|
|
44700
|
+
"\u2013": "-",
|
|
44701
|
+
"\u2015": "-",
|
|
44702
|
+
"\u2014": "-",
|
|
44703
|
+
"\uFF0D": "-",
|
|
44704
|
+
"\xB7": "\u318D",
|
|
44705
|
+
"\u318D": "\u318D",
|
|
44706
|
+
"\u2219": "\u318D",
|
|
44707
|
+
"\u2022": "\u318D",
|
|
44708
|
+
"\u25A1": "\u25A1",
|
|
44709
|
+
"\u25A0": "\u25A0",
|
|
44710
|
+
"\u25C7": "\u25C7",
|
|
44711
|
+
"\u25C6": "\u25C6",
|
|
44712
|
+
"\u25A3": "\u25A3",
|
|
44713
|
+
"\u203B": "\u203B",
|
|
44714
|
+
"*": "*",
|
|
44715
|
+
"\u25B6": "\u25B6",
|
|
44716
|
+
"\u25B7": "\u25B7",
|
|
44717
|
+
"\u25BA": "\u25B6",
|
|
44718
|
+
"\u25B8": "\u25B8",
|
|
44719
|
+
"\u25AA": "\u25AA",
|
|
44720
|
+
"\u2713": "\u2713",
|
|
44721
|
+
"\u21D2": "\u21D2",
|
|
44722
|
+
"\u21B3": "\u21B3"
|
|
44723
|
+
};
|
|
44724
|
+
function markerClass(plain4, headingLevel) {
|
|
44725
|
+
const t = plain4.replace(/^\s+/, "");
|
|
44726
|
+
let cls = "";
|
|
44727
|
+
const sym = SYMBOL_FAMILY[t[0]];
|
|
44728
|
+
if (sym && (t.length === 1 || /\s/.test(t[1]))) cls = sym;
|
|
44729
|
+
else if (/^붙\s*임(?:\s|$)/.test(t)) cls = "\uBD99\uC784";
|
|
44730
|
+
else if (/^[❶-❿]/.test(t)) cls = "\u2776";
|
|
44731
|
+
else if (/^[①-⑳]/.test(t)) cls = "\u2460";
|
|
44732
|
+
else if (/^[㉮-㉻]/.test(t)) cls = "\u326E";
|
|
44733
|
+
else if (/^[Ⅰ-Ⅻ][.\s]/.test(t)) cls = "\u2160.";
|
|
44734
|
+
else {
|
|
44735
|
+
const m = /^(\(?)(\d{1,2}|[가나다라마바사아자차카타파하])([.)])(?=\s|$)/.exec(t);
|
|
44736
|
+
if (m) cls = `${m[1]}${/\d/.test(m[2]) ? "N" : "K"}${m[3]}`;
|
|
44737
|
+
}
|
|
44738
|
+
return headingLevel ? `h${headingLevel}:${cls}` : cls;
|
|
44739
|
+
}
|
|
44740
|
+
function topLevelParagraphs(xml) {
|
|
44741
|
+
const root = /<(?:\w+:)?sec\b[^>]*>/.exec(xml);
|
|
44742
|
+
if (!root) return [];
|
|
44743
|
+
const out = [];
|
|
44744
|
+
let pos = root.index + root[0].length;
|
|
44745
|
+
const pRe = /<(?:\w+:)?p(?=[\s>/])/y;
|
|
44746
|
+
for (; ; ) {
|
|
44747
|
+
const lt = xml.indexOf("<", pos);
|
|
44748
|
+
if (lt < 0 || xml.startsWith("</", lt)) break;
|
|
44749
|
+
const end = findElementEnd(xml, lt);
|
|
44750
|
+
if (end < 0) break;
|
|
44751
|
+
pRe.lastIndex = lt;
|
|
44752
|
+
if (pRe.test(xml)) out.push({ start: lt, end });
|
|
44753
|
+
pos = end;
|
|
44754
|
+
}
|
|
44755
|
+
return out;
|
|
44756
|
+
}
|
|
44757
|
+
function containingTopParagraph(tops, pos) {
|
|
44758
|
+
let lo = 0, hi = tops.length - 1;
|
|
44759
|
+
while (lo <= hi) {
|
|
44760
|
+
const mid = lo + hi >> 1;
|
|
44761
|
+
if (tops[mid].end <= pos) lo = mid + 1;
|
|
44762
|
+
else if (tops[mid].start > pos) hi = mid - 1;
|
|
44763
|
+
else return tops[mid];
|
|
44764
|
+
}
|
|
44765
|
+
return void 0;
|
|
44766
|
+
}
|
|
44767
|
+
function isRemovableParagraph(fragment) {
|
|
44768
|
+
const open = fragment.slice(0, fragment.indexOf(">") + 1);
|
|
44769
|
+
if (/\b(?:pageBreak|columnBreak)="1"/.test(open)) return false;
|
|
44770
|
+
return !OBJECT_RE.test(fragment.slice(open.length));
|
|
44771
|
+
}
|
|
44772
|
+
function keepBreaks(clone, targetOpen) {
|
|
44773
|
+
let out = clone;
|
|
44774
|
+
for (const attr of ["pageBreak", "columnBreak"]) {
|
|
44775
|
+
if (!new RegExp(`\\b${attr}="1"`).test(targetOpen)) continue;
|
|
44776
|
+
out = new RegExp(`^<[^>]*?\\b${attr}=`).test(out) ? out.replace(new RegExp(`^(<[^>]*?)\\b${attr}="0"`), `$1${attr}="1"`) : out.replace(/^<([\w:]+)/, `<$1 ${attr}="1"`);
|
|
44777
|
+
}
|
|
44778
|
+
return out;
|
|
44779
|
+
}
|
|
44780
|
+
function pickDonor(donors, cls, near, exclude) {
|
|
44781
|
+
let best;
|
|
44782
|
+
for (const d of donors) {
|
|
44783
|
+
if (d.cls !== cls || d.unitIdx === exclude) continue;
|
|
44784
|
+
if (!best || Math.abs(d.unitIdx - near) < Math.abs(best.unitIdx - near)) best = d;
|
|
44785
|
+
}
|
|
44786
|
+
return best;
|
|
44787
|
+
}
|
|
44788
|
+
function cloneParagraphXml(xml, donor, newPlain, newSegs) {
|
|
44789
|
+
const end = findElementEnd(xml, donor.para.start);
|
|
44790
|
+
if (end < 0) return null;
|
|
44791
|
+
const frag = xml.slice(donor.para.start, end);
|
|
44792
|
+
if (!isRemovableParagraph(frag.replace(/\b(?:pageBreak|columnBreak)="1"/, ""))) return null;
|
|
44793
|
+
const para2 = scanSectionXml(frag, donor.sectionIndex).bodyParagraphs[0];
|
|
44794
|
+
if (!para2 || para2.start !== 0) return null;
|
|
44795
|
+
const splices = _nullishCoalesce(_nullishCoalesce(minimalTextSplices(para2, frag, donor.plain, newPlain, donor.segs, newSegs), () => ( markerRunSplices(para2, frag, newPlain))), () => ( buildParagraphSplices(para2, newPlain, frag)));
|
|
44796
|
+
if (splices === null) return null;
|
|
44797
|
+
return applySplices(frag, splices).replace(LINESEG_RE2, "").replace(/^(<[^>]*?)\bpageBreak="1"/, '$1pageBreak="0"').replace(/^(<[^>]*?)\bcolumnBreak="1"/, '$1columnBreak="0"');
|
|
44798
|
+
}
|
|
44799
|
+
function editedInline(raw) {
|
|
44800
|
+
let text = raw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
44801
|
+
const hm = /^(#{1,6})\s+/.exec(text);
|
|
44802
|
+
if (hm) text = text.slice(hm[0].length);
|
|
44803
|
+
return { ...parseEmphasis(text), level: hm ? hm[1].length : void 0 };
|
|
44804
|
+
}
|
|
44805
|
+
function createStructureEditor(env) {
|
|
44806
|
+
const tops = env.scans.map((s) => topLevelParagraphs(s.xml));
|
|
44807
|
+
const removed = env.scans.map(() => []);
|
|
44808
|
+
const loc = (oi) => {
|
|
44809
|
+
const u = env.origUnits[oi];
|
|
44810
|
+
const block = env.origBlocks[u.blockIdx];
|
|
44811
|
+
if (!block) return void 0;
|
|
44812
|
+
if (block.type === "table") {
|
|
44813
|
+
const ord = env.obTableOrdinals.get(u.blockIdx);
|
|
44814
|
+
const t = ord !== void 0 && env.obTableOrdinals.size === env.scanTables.length ? env.scanTables[ord] : void 0;
|
|
44815
|
+
return t ? { sectionIndex: t.sectionIndex, pos: t.start } : void 0;
|
|
44816
|
+
}
|
|
44817
|
+
const para2 = _optionalChain([env, 'access', _924 => _924.paraMap, 'access', _925 => _925.get, 'call', _926 => _926(u.blockIdx), 'optionalAccess', _927 => _927.para]);
|
|
44818
|
+
return para2 ? { sectionIndex: para2.sectionIndex, pos: para2.start } : void 0;
|
|
44819
|
+
};
|
|
44820
|
+
const topOf = (oi) => {
|
|
44821
|
+
const l = loc(oi);
|
|
44822
|
+
const top = l && containingTopParagraph(tops[l.sectionIndex], l.pos);
|
|
44823
|
+
return top && { sectionIndex: l.sectionIndex, ...top };
|
|
44824
|
+
};
|
|
44825
|
+
const isRemoved = (sectionIndex, pos) => removed[sectionIndex].some((r) => pos >= r.start && pos < r.end);
|
|
44826
|
+
const touched = (sectionIndex, start, end) => env.sectionSplices[sectionIndex].some((s) => s.start < end && s.end > start && !(s.start === s.end && (s.start === start || s.start === end)));
|
|
44827
|
+
const donors = [];
|
|
44828
|
+
env.origUnits.forEach((u, oi) => {
|
|
44829
|
+
if (u.kind !== "text" || u.fragment || u.role) return;
|
|
44830
|
+
const block = env.origBlocks[u.blockIdx];
|
|
44831
|
+
if (!block || block.type !== "paragraph" && block.type !== "heading" || block.footnoteText || _optionalChain([block, 'access', _928 => _928.text, 'optionalAccess', _929 => _929.includes, 'call', _930 => _930("\n")])) return;
|
|
44832
|
+
const m = env.paraMap.get(u.blockIdx);
|
|
44833
|
+
if (!_optionalChain([m, 'optionalAccess', _931 => _931.para]) || m.para.kind !== "body" || m.prefixStripped || _optionalChain([m, 'access', _932 => _932.noteMarks, 'optionalAccess', _933 => _933.length])) return;
|
|
44834
|
+
const top = topOf(oi);
|
|
44835
|
+
const xml = env.scans[m.para.sectionIndex].xml;
|
|
44836
|
+
if (!top || top.start !== m.para.start || !isRemovableParagraph(xml.slice(top.start, top.end).replace(/\b(?:pageBreak|columnBreak)="1"/, ""))) return;
|
|
44837
|
+
const { plain: plain4, segs } = parseEmphasis(env.inlineOf(oi));
|
|
44838
|
+
if (!plain4.trim()) return;
|
|
44839
|
+
donors.push({ cls: markerClass(plain4, block.type === "heading" ? block.level : void 0), unitIdx: oi, sectionIndex: m.para.sectionIndex, para: m.para, plain: plain4, segs });
|
|
44840
|
+
});
|
|
44841
|
+
const donorOf = new Map(donors.map((d) => [d.unitIdx, d]));
|
|
44842
|
+
const chooseDonor = (cls, near) => {
|
|
44843
|
+
const same = _nullishCoalesce(pickDonor(donors, cls, near), () => ( (cls.startsWith("h") ? pickDonor(donors, cls.slice(cls.indexOf(":") + 1), near) : void 0)));
|
|
44844
|
+
if (same) return same;
|
|
44845
|
+
let before2;
|
|
44846
|
+
for (const d of donors) {
|
|
44847
|
+
if (d.unitIdx < near) before2 = d;
|
|
44848
|
+
else return _nullishCoalesce(before2, () => ( d));
|
|
44849
|
+
}
|
|
44850
|
+
return before2;
|
|
44851
|
+
};
|
|
44852
|
+
const skip = (reason, before2, after2) => {
|
|
44853
|
+
env.skipped.push({ reason, ...before2 !== void 0 ? { before: summarize(before2) } : {}, ...after2 !== void 0 ? { after: summarize(after2) } : {} });
|
|
44854
|
+
return 0;
|
|
44855
|
+
};
|
|
44856
|
+
const firstEdit = env.scans.map(() => Infinity);
|
|
44857
|
+
const mark = (sectionIndex, pos) => {
|
|
44858
|
+
firstEdit[sectionIndex] = Math.min(firstEdit[sectionIndex], pos);
|
|
44859
|
+
};
|
|
44860
|
+
return {
|
|
44861
|
+
/**
|
|
44862
|
+
* 구조 편집 뒤 최상위 문단의 줄 배치 캐시 제거 splice — 문단이 늘거나 줄면 뒤 문단 캐시의 세로 위치(vertpos)가 낡는다.
|
|
44863
|
+
* 캐시를 믿고 그리는 뷰어(kordoc render)가 낡은 자리에 그려 붙임 줄이 다음 쪽 한가운데로 밀렸다(견본 재작성 실측).
|
|
44864
|
+
* 첫 구조 편집 앞 문단과 글을 고친 문단(패처가 따로 지운다)은 건드리지 않는다
|
|
44865
|
+
*/
|
|
44866
|
+
staleCacheSplices(sectionIndex) {
|
|
44867
|
+
const from = firstEdit[sectionIndex];
|
|
44868
|
+
if (from === Infinity) return [];
|
|
44869
|
+
const xml = env.scans[sectionIndex].xml;
|
|
44870
|
+
const out = [];
|
|
44871
|
+
for (const top of tops[sectionIndex]) {
|
|
44872
|
+
if (top.start < from || touched(sectionIndex, top.start, top.end)) continue;
|
|
44873
|
+
const c = ownCacheSplice(xml, top.start, top.end);
|
|
44874
|
+
if (c) out.push(c);
|
|
44875
|
+
}
|
|
44876
|
+
return out;
|
|
44877
|
+
},
|
|
44878
|
+
/** 부호가 바뀐 글 수정 — 새 부호를 단 견본 문단을 복제해 그 자리를 갈아 끼운다. 해당 없으면 null(일반 수정으로) */
|
|
44879
|
+
restyle(oi, edited) {
|
|
44880
|
+
const own = donorOf.get(oi);
|
|
44881
|
+
if (!own || edited.kind !== "text") return null;
|
|
44882
|
+
const ed = editedInline(edited.raw);
|
|
44883
|
+
const cls = markerClass(ed.plain, ed.level);
|
|
44884
|
+
if (cls === own.cls) return null;
|
|
44885
|
+
const donor = pickDonor(donors, cls, oi, oi);
|
|
44886
|
+
if (!donor) return null;
|
|
44887
|
+
const top = topOf(oi);
|
|
44888
|
+
if (touched(top.sectionIndex, top.start, top.end)) return null;
|
|
44889
|
+
const clone = cloneParagraphXml(env.scans[donor.sectionIndex].xml, donor, ed.plain, ed.segs);
|
|
44890
|
+
if (clone === null) return null;
|
|
44891
|
+
const xml = env.scans[top.sectionIndex].xml;
|
|
44892
|
+
env.sectionSplices[top.sectionIndex].push({ start: top.start, end: top.end, replacement: keepBreaks(clone, xml.slice(top.start, xml.indexOf(">", top.start) + 1)) });
|
|
44893
|
+
removed[top.sectionIndex].push(top);
|
|
44894
|
+
mark(top.sectionIndex, top.start);
|
|
44895
|
+
return 1;
|
|
44896
|
+
},
|
|
44897
|
+
remove(oi) {
|
|
44898
|
+
const u = env.origUnits[oi];
|
|
44899
|
+
if (u.kind === "image" || u.kind === "separator") return skip("\uC774\uBBF8\uC9C0/\uAD6C\uBD84\uC120 \uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 \u2014 \uC6D0\uBCF8 \uC720\uC9C0", u.raw);
|
|
44900
|
+
if (u.fragment || u.role) return skip("\uBB38\uB2E8 \uC77C\uBD80(\uAC15\uC81C \uC904\uBC14\uAFC8 \uC870\uAC01\xB7\uD45C \uCEA1\uC158) \uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 \u2014 \uC6D0\uBCF8 \uC720\uC9C0", u.raw);
|
|
44901
|
+
const top = topOf(oi);
|
|
44902
|
+
if (!top) return skip("\uC0AD\uC81C\uD560 \uBB38\uB2E8 \uC704\uCE58\uB97C \uCC3E\uC9C0 \uBABB\uD568 (\uBA38\uB9AC\uB9D0\xB7\uAE00\uC0C1\uC790\xB7\uD45C \uC548 \uC601\uC5ED) \u2014 \uC6D0\uBCF8 \uC720\uC9C0", u.raw);
|
|
44903
|
+
if (isRemoved(top.sectionIndex, top.start)) return 0;
|
|
44904
|
+
const xml = env.scans[top.sectionIndex].xml;
|
|
44905
|
+
const block = env.origBlocks[u.blockIdx];
|
|
44906
|
+
let rest = xml.slice(top.start, top.end);
|
|
44907
|
+
if (_optionalChain([block, 'optionalAccess', _934 => _934.type]) === "table") {
|
|
44908
|
+
const l = loc(oi);
|
|
44909
|
+
const tEnd = findElementEnd(xml, l.pos);
|
|
44910
|
+
rest = xml.slice(top.start, l.pos) + xml.slice(tEnd, top.end);
|
|
44911
|
+
if (/<(?:\w+:)?t>[^<]*\S/.test(rest)) return skip("\uD45C \uC0AD\uC81C \uBBF8\uC9C0\uC6D0 \u2014 \uD45C\uC640 \uAC19\uC740 \uBB38\uB2E8\uC5D0 \uAE00\uC774 \uC788\uC74C", u.raw);
|
|
44912
|
+
} else {
|
|
44913
|
+
const para2 = _optionalChain([env, 'access', _935 => _935.paraMap, 'access', _936 => _936.get, 'call', _937 => _937(u.blockIdx), 'optionalAccess', _938 => _938.para]);
|
|
44914
|
+
if (!para2 || para2.kind !== "body" || para2.start !== top.start) return skip("\uBCF8\uBB38 \uBC16(\uD45C \uCE78\xB7\uAE00\uC0C1\uC790) \uBB38\uB2E8 \uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 \u2014 \uC6D0\uBCF8 \uC720\uC9C0", u.raw);
|
|
44915
|
+
}
|
|
44916
|
+
if (!isRemovableParagraph(rest) || touched(top.sectionIndex, top.start, top.end)) {
|
|
44917
|
+
const para2 = _optionalChain([block, 'optionalAccess', _939 => _939.type]) !== "table" ? _optionalChain([env, 'access', _940 => _940.paraMap, 'access', _941 => _941.get, 'call', _942 => _942(u.blockIdx), 'optionalAccess', _943 => _943.para]) : void 0;
|
|
44918
|
+
const splices = para2 && !touched(top.sectionIndex, top.start, top.end) ? buildParagraphSplices(para2, "", xml) : null;
|
|
44919
|
+
if (!splices) return skip("\uAC1C\uCCB4\xB7\uAD6C\uC5ED \uC815\uC758\uAC00 \uB4E0 \uBB38\uB2E8\uC774\uB77C \uC0AD\uC81C \uBBF8\uC9C0\uC6D0 \u2014 \uC6D0\uBCF8 \uC720\uC9C0", u.raw);
|
|
44920
|
+
env.sectionSplices[top.sectionIndex].push(...splices);
|
|
44921
|
+
env.skipped.push({ reason: "\uAC1C\uCCB4\xB7\uAD6C\uC5ED \uC815\uC758\xB7\uCABD \uB098\uB214\uC774 \uB4E0 \uBB38\uB2E8 \u2014 \uBB38\uB2E8\uC740 \uB450\uACE0 \uAE00\uB9CC \uBE44\uC6C0", before: summarize(u.raw), partial: true });
|
|
44922
|
+
return 1;
|
|
44923
|
+
}
|
|
44924
|
+
env.sectionSplices[top.sectionIndex].push({ start: top.start, end: top.end, replacement: "" });
|
|
44925
|
+
removed[top.sectionIndex].push(top);
|
|
44926
|
+
mark(top.sectionIndex, top.start);
|
|
44927
|
+
return 1;
|
|
44928
|
+
},
|
|
44929
|
+
insert(edited, lastOi) {
|
|
44930
|
+
if (edited.kind === "image" || edited.kind === "separator") return skip("\uC774\uBBF8\uC9C0/\uAD6C\uBD84\uC120 \uCD94\uAC00\uB294 \uBBF8\uC9C0\uC6D0", void 0, edited.raw);
|
|
44931
|
+
if (edited.kind === "html-table") return skip("\uBCD1\uD569\uD45C(HTML) \uCD94\uAC00\uB294 \uBBF8\uC9C0\uC6D0 \u2014 GFM \uD45C(| \uD5E4\uB354 | \u2026 |)\uB85C \uC4F0\uAC70\uB098 \uC6D0\uBCF8 \uD45C\uB97C \uACE0\uCCD0 \uC4F0\uC138\uC694", void 0, edited.raw);
|
|
44932
|
+
let at;
|
|
44933
|
+
for (let k = _nullishCoalesce(lastOi, () => ( -1)); k >= 0 && !at; k--) {
|
|
44934
|
+
const top = topOf(k);
|
|
44935
|
+
if (top) at = { sectionIndex: top.sectionIndex, pos: top.end, near: k + 0.5 };
|
|
44936
|
+
}
|
|
44937
|
+
if (!at) {
|
|
44938
|
+
for (let k = 0; k < env.origUnits.length && !at; k++) {
|
|
44939
|
+
const top = topOf(k);
|
|
44940
|
+
if (!top) continue;
|
|
44941
|
+
if (OBJECT_RE.test(env.scans[top.sectionIndex].xml.slice(top.start, top.end))) return skip("\uBB38\uC11C \uB9E8 \uC55E(\uAD6C\uC5ED \uC815\uC758 \uBB38\uB2E8 \uC55E) \uCD94\uAC00\uB294 \uBBF8\uC9C0\uC6D0 \u2014 \uCCAB \uBE14\uB85D \uB4A4\uC5D0 \uC4F0\uC138\uC694", void 0, edited.raw);
|
|
44942
|
+
at = { sectionIndex: top.sectionIndex, pos: top.start, near: k - 0.5 };
|
|
44943
|
+
}
|
|
44944
|
+
}
|
|
44945
|
+
if (!at) return skip("\uCD94\uAC00\uD560 \uC790\uB9AC\uB97C \uCC3E\uC9C0 \uBABB\uD568", void 0, edited.raw);
|
|
44946
|
+
const xml = env.scans[at.sectionIndex].xml;
|
|
44947
|
+
let fragment;
|
|
44948
|
+
if (edited.kind === "gfm-table") {
|
|
44949
|
+
const near = chooseDonor("", at.near);
|
|
44950
|
+
const prId = near ? Number(_nullishCoalesce(_optionalChain([/paraPrIDRef="(\d+)"/, 'access', _944 => _944.exec, 'call', _945 => _945(xml.slice(near.para.start, near.para.start + 400)), 'optionalAccess', _946 => _946[1]]), () => ( 0))) : 0;
|
|
44951
|
+
const built = env.tableXml(edited, prId);
|
|
44952
|
+
if (typeof built !== "string") return skip(built.reason, void 0, edited.raw);
|
|
44953
|
+
fragment = built;
|
|
44954
|
+
} else {
|
|
44955
|
+
const ed = editedInline(edited.raw);
|
|
44956
|
+
if (!ed.plain.trim()) return 0;
|
|
44957
|
+
const donor = chooseDonor(markerClass(ed.plain, ed.level), at.near);
|
|
44958
|
+
if (!donor) return skip("\uC11C\uC2DD\uC744 \uBE4C\uB9B4 \uBCF8\uBB38 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uCD94\uAC00 \uBBF8\uC9C0\uC6D0", void 0, edited.raw);
|
|
44959
|
+
fragment = cloneParagraphXml(env.scans[donor.sectionIndex].xml, donor, ed.plain, ed.segs);
|
|
44960
|
+
if (fragment === null) return skip("\uACAC\uBCF8 \uBB38\uB2E8 \uBCF5\uC81C \uC2E4\uD328 \u2014 \uCD94\uAC00 \uBBF8\uC9C0\uC6D0", void 0, edited.raw);
|
|
44961
|
+
}
|
|
44962
|
+
env.sectionSplices[at.sectionIndex].push({ start: at.pos, end: at.pos, replacement: fragment });
|
|
44963
|
+
mark(at.sectionIndex, at.pos);
|
|
44964
|
+
return 1;
|
|
44965
|
+
}
|
|
44966
|
+
};
|
|
44967
|
+
}
|
|
44968
|
+
function pairTablesInGaps(pairs, a, b) {
|
|
44969
|
+
const isTable = (k) => k === "gfm-table" || k === "html-table";
|
|
44970
|
+
const out = [];
|
|
44971
|
+
let gap = [];
|
|
44972
|
+
const flush = () => {
|
|
44973
|
+
const A = gap.filter((p) => p[0] !== null).map((p) => p[0]);
|
|
44974
|
+
const B = gap.filter((p) => p[1] !== null).map((p) => p[1]);
|
|
44975
|
+
gap = [];
|
|
44976
|
+
const matches = [];
|
|
44977
|
+
let bj = 0;
|
|
44978
|
+
for (const ai of A) {
|
|
44979
|
+
if (!isTable(a[ai].kind)) continue;
|
|
44980
|
+
let k = bj;
|
|
44981
|
+
while (k < B.length && b[B[k]].kind !== a[ai].kind) k++;
|
|
44982
|
+
if (k < B.length) {
|
|
44983
|
+
matches.push([ai, B[k]]);
|
|
44984
|
+
bj = k + 1;
|
|
44985
|
+
}
|
|
44986
|
+
}
|
|
44987
|
+
let ia = 0, ib = 0;
|
|
44988
|
+
for (const [ma, mb] of matches) {
|
|
44989
|
+
while (A[ia] !== ma) out.push([A[ia++], null]);
|
|
44990
|
+
while (B[ib] !== mb) out.push([null, B[ib++]]);
|
|
44991
|
+
out.push([A[ia++], B[ib++]]);
|
|
44992
|
+
}
|
|
44993
|
+
while (ia < A.length) out.push([A[ia++], null]);
|
|
44994
|
+
while (ib < B.length) out.push([null, B[ib++]]);
|
|
44995
|
+
};
|
|
44996
|
+
for (const p of pairs) {
|
|
44997
|
+
if (p[0] !== null && p[1] !== null) {
|
|
44998
|
+
flush();
|
|
44999
|
+
out.push(p);
|
|
45000
|
+
} else gap.push(p);
|
|
45001
|
+
}
|
|
45002
|
+
flush();
|
|
45003
|
+
return out;
|
|
45004
|
+
}
|
|
45005
|
+
function ownCacheSplice(xml, start, end) {
|
|
45006
|
+
const head = xml.slice(start, xml.lastIndexOf("</", end - 1)).trimEnd();
|
|
45007
|
+
const close = /<\/(\w+:)?linesegarray>$/.exec(head);
|
|
45008
|
+
const open = close ? head.lastIndexOf(`<${_nullishCoalesce(close[1], () => ( ""))}linesegarray`) : -1;
|
|
45009
|
+
return open >= 0 ? { start: start + open, end: start + head.length, replacement: "" } : null;
|
|
45010
|
+
}
|
|
45011
|
+
function restructureCellLines(cellParas, newLines, scans, sectionSplices, norm2) {
|
|
45012
|
+
cellParas = cellParas.filter((p) => !p.inTextbox);
|
|
45013
|
+
if (cellParas.length === 0) return null;
|
|
45014
|
+
const sectionIndex = cellParas[0].sectionIndex;
|
|
45015
|
+
const xml = scans[sectionIndex].xml;
|
|
45016
|
+
const nonEmpty = cellParas.filter((p) => norm2(p.text) !== "");
|
|
45017
|
+
const olds = nonEmpty.length ? nonEmpty : [cellParas[0]];
|
|
45018
|
+
const range = (p) => ({ start: p.start, end: findElementEnd(xml, p.start) });
|
|
45019
|
+
if (olds.some((p) => range(p).end < 0)) return null;
|
|
45020
|
+
const donors = olds.flatMap((p, i) => {
|
|
45021
|
+
const r = range(p);
|
|
45022
|
+
if (!isRemovableParagraph(xml.slice(r.start, r.end).replace(/\b(?:pageBreak|columnBreak)="1"/, ""))) return [];
|
|
45023
|
+
const plain4 = norm2(p.text);
|
|
45024
|
+
return [{ cls: markerClass(plain4), unitIdx: i, sectionIndex, para: p, plain: plain4, segs: [plain4] }];
|
|
45025
|
+
});
|
|
45026
|
+
if (donors.length === 0) return null;
|
|
45027
|
+
const pairs = nonEmpty.length ? alignUnits(olds.map((p) => norm2(p.text)), newLines.map(norm2)) : newLines.map((_, k) => k === 0 ? [0, 0] : [null, k]);
|
|
45028
|
+
const out = [];
|
|
45029
|
+
let first = Infinity, remaining = cellParas.length, lastOld = null;
|
|
45030
|
+
for (const [oi, ei] of pairs) {
|
|
45031
|
+
if (oi !== null && ei !== null) {
|
|
45032
|
+
lastOld = oi;
|
|
45033
|
+
const p = olds[oi], line = newLines[ei];
|
|
45034
|
+
if (norm2(p.text) === norm2(line)) continue;
|
|
45035
|
+
const cls = markerClass(line);
|
|
45036
|
+
const r = range(p);
|
|
45037
|
+
const donor = cls !== markerClass(norm2(p.text)) && isRemovableParagraph(xml.slice(r.start, r.end).replace(/\b(?:pageBreak|columnBreak)="1"/, "")) ? pickDonor(donors, cls, oi, oi) : void 0;
|
|
45038
|
+
const clone = donor ? cloneParagraphXml(xml, donor, line, [line]) : null;
|
|
45039
|
+
if (clone !== null) {
|
|
45040
|
+
out.push({ start: r.start, end: r.end, replacement: keepBreaks(clone, xml.slice(r.start, xml.indexOf(">", r.start) + 1)) });
|
|
45041
|
+
first = Math.min(first, r.start);
|
|
45042
|
+
continue;
|
|
45043
|
+
}
|
|
45044
|
+
const sp = _nullishCoalesce(minimalTextSplices(p, xml, norm2(p.text), line), () => ( buildParagraphSplices(p, line, xml)));
|
|
45045
|
+
if (sp === null) return null;
|
|
45046
|
+
out.push(...sp);
|
|
45047
|
+
} else if (oi !== null) {
|
|
45048
|
+
lastOld = oi;
|
|
45049
|
+
const p = olds[oi], r = range(p);
|
|
45050
|
+
if (remaining > 1 && isRemovableParagraph(xml.slice(r.start, r.end))) {
|
|
45051
|
+
out.push({ start: r.start, end: r.end, replacement: "" });
|
|
45052
|
+
remaining--;
|
|
45053
|
+
first = Math.min(first, r.start);
|
|
45054
|
+
} else {
|
|
45055
|
+
const sp = buildParagraphSplices(p, "", xml);
|
|
45056
|
+
if (sp === null) return null;
|
|
45057
|
+
out.push(...sp);
|
|
45058
|
+
}
|
|
45059
|
+
} else if (ei !== null) {
|
|
45060
|
+
const line = newLines[ei];
|
|
45061
|
+
if (!norm2(line)) continue;
|
|
45062
|
+
const near = lastOld === null ? -0.5 : lastOld + 0.5;
|
|
45063
|
+
const donor = _nullishCoalesce(_nullishCoalesce(pickDonor(donors, markerClass(line), near), () => ( pickDonor(donors, "", near))), () => ( pickDonor(donors, donors[0].cls, near)));
|
|
45064
|
+
const clone = donor && cloneParagraphXml(xml, donor, line, [line]);
|
|
45065
|
+
if (!clone) return null;
|
|
45066
|
+
const at = lastOld === null ? olds[0].start : range(olds[lastOld]).end;
|
|
45067
|
+
out.push({ start: at, end: at, replacement: clone });
|
|
45068
|
+
first = Math.min(first, at);
|
|
45069
|
+
}
|
|
45070
|
+
}
|
|
45071
|
+
if (first !== Infinity) {
|
|
45072
|
+
for (const p of cellParas) {
|
|
45073
|
+
const r = range(p);
|
|
45074
|
+
if (r.start < first || out.some((s) => s.start < r.end && s.end > r.start)) continue;
|
|
45075
|
+
const c = ownCacheSplice(xml, r.start, r.end);
|
|
45076
|
+
if (c) out.push(c);
|
|
45077
|
+
}
|
|
45078
|
+
}
|
|
45079
|
+
sectionSplices[sectionIndex].push(...out);
|
|
45080
|
+
return 1;
|
|
45081
|
+
}
|
|
45082
|
+
|
|
44689
45083
|
// src/roundtrip/table-patch.ts
|
|
44690
45084
|
function patchGfmTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
44691
45085
|
const replica = replicateGfmTable(table2);
|
|
@@ -44863,9 +45257,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
|
|
|
44863
45257
|
});
|
|
44864
45258
|
}
|
|
44865
45259
|
function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
|
|
44866
|
-
const irCell = _optionalChain([table2, 'access',
|
|
45260
|
+
const irCell = _optionalChain([table2, 'access', _947 => _947.cells, 'access', _948 => _948[oc.gridR], 'optionalAccess', _949 => _949[oc.gridC]]);
|
|
44867
45261
|
const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
|
|
44868
|
-
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess',
|
|
45262
|
+
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _950 => _950.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
|
|
44869
45263
|
if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
|
|
44870
45264
|
return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
|
|
44871
45265
|
}
|
|
@@ -44888,12 +45282,12 @@ function stripCellTokens(text) {
|
|
|
44888
45282
|
}
|
|
44889
45283
|
function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
44890
45284
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
44891
|
-
const content =
|
|
45285
|
+
const content = _chunk5N6MENH6cjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
44892
45286
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
44893
45287
|
const t = line.trim();
|
|
44894
45288
|
if (!t) return "";
|
|
44895
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
44896
|
-
return
|
|
45289
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunk5N6MENH6cjs.escapeGfm.call(void 0, t)}**`;
|
|
45290
|
+
return _chunk5N6MENH6cjs.escapeGfm.call(void 0, t);
|
|
44897
45291
|
}).filter(Boolean);
|
|
44898
45292
|
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");
|
|
44899
45293
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -44907,7 +45301,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
44907
45301
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
44908
45302
|
const replica = [];
|
|
44909
45303
|
for (let r = 0; r < table2.rows; r++) {
|
|
44910
|
-
const line =
|
|
45304
|
+
const line = _chunk5N6MENH6cjs.escapeGfm.call(void 0, _chunk5N6MENH6cjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
44911
45305
|
if (line) replica.push({ line, gridR: r });
|
|
44912
45306
|
}
|
|
44913
45307
|
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");
|
|
@@ -44933,7 +45327,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
44933
45327
|
};
|
|
44934
45328
|
const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
|
|
44935
45329
|
if (!cell2) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
|
|
44936
|
-
const irCell = _optionalChain([table2, 'access',
|
|
45330
|
+
const irCell = _optionalChain([table2, 'access', _951 => _951.cells, 'access', _952 => _952[gridR], 'optionalAccess', _953 => _953[gridC]]);
|
|
44937
45331
|
const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
|
|
44938
45332
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
44939
45333
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -44947,12 +45341,12 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
44947
45341
|
const nonEmpty = cell2.paragraphs.filter((p) => normForMatch(p.text) !== "");
|
|
44948
45342
|
if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
|
|
44949
45343
|
const target = nonEmpty.length === 1 ? nonEmpty[0] : void 0;
|
|
44950
|
-
const sourceLines = _optionalChain([target, 'optionalAccess',
|
|
45344
|
+
const sourceLines = _optionalChain([target, 'optionalAccess', _954 => _954.text, 'access', _955 => _955.split, 'call', _956 => _956(/\r\n|\r|\n/), 'access', _957 => _957.map, 'call', _958 => _958((line) => line.trim())]);
|
|
44951
45345
|
const renderedLines = unescapeGfmCell(stripCellTokens(before2)).split("\n").map((line) => line.trim());
|
|
44952
|
-
if (target && _optionalChain([sourceLines, 'optionalAccess',
|
|
44953
|
-
const xml = _optionalChain([ctx, 'access',
|
|
45346
|
+
if (target && _optionalChain([sourceLines, 'optionalAccess', _959 => _959.length]) === origLineCount && sourceLines.every((line, i) => line === renderedLines[i]) && !extractCellTokens(before2)) {
|
|
45347
|
+
const xml = _optionalChain([ctx, 'access', _960 => _960.scans, 'access', _961 => _961[target.sectionIndex], 'optionalAccess', _962 => _962.xml]);
|
|
44954
45348
|
const precise = xml === void 0 ? null : buildEmbeddedLineSplices(target, xml, newLines);
|
|
44955
|
-
if (_optionalChain([precise, 'optionalAccess',
|
|
45349
|
+
if (_optionalChain([precise, 'optionalAccess', _963 => _963.length])) {
|
|
44956
45350
|
ctx.sectionSplices[target.sectionIndex].push(...precise);
|
|
44957
45351
|
return 1;
|
|
44958
45352
|
}
|
|
@@ -44961,14 +45355,18 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
44961
45355
|
}
|
|
44962
45356
|
const splices = [];
|
|
44963
45357
|
let sectionIndex = -1;
|
|
44964
|
-
const unstable = newLines.find((l) =>
|
|
45358
|
+
const unstable = newLines.find((l) => _chunk5N6MENH6cjs.sanitizeText.call(void 0, l) !== l);
|
|
44965
45359
|
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");
|
|
45360
|
+
if (ctx.structure && newLines.length > Math.max(nonEmpty.length, 1) || ctx.structure && nonEmpty.length > 1 && newLines.length < nonEmpty.length) {
|
|
45361
|
+
const done = restructureCellLines(cell2.paragraphs, newLines, ctx.scans, ctx.sectionSplices, normForMatch);
|
|
45362
|
+
if (done !== null) return done;
|
|
45363
|
+
}
|
|
44966
45364
|
if (nonEmpty.length === 0) {
|
|
44967
45365
|
if (newLines.length === 0) return 0;
|
|
44968
45366
|
const target = cell2.paragraphs[0];
|
|
44969
45367
|
if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
|
|
44970
45368
|
const value = newLines.join(" ");
|
|
44971
|
-
const xml = _optionalChain([ctx, 'access',
|
|
45369
|
+
const xml = _optionalChain([ctx, 'access', _964 => _964.scans, 'access', _965 => _965[target.sectionIndex], 'optionalAccess', _966 => _966.xml]);
|
|
44972
45370
|
const rawT = xml ? paraTText(target, xml) : null;
|
|
44973
45371
|
let sp;
|
|
44974
45372
|
if (xml && rawT === null) {
|
|
@@ -45002,7 +45400,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
45002
45400
|
}
|
|
45003
45401
|
for (let i = 0; i < nonEmpty.length; i++) {
|
|
45004
45402
|
if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
|
|
45005
|
-
const xml = _optionalChain([ctx, 'access',
|
|
45403
|
+
const xml = _optionalChain([ctx, 'access', _967 => _967.scans, 'access', _968 => _968[nonEmpty[i].sectionIndex], 'optionalAccess', _969 => _969.xml]);
|
|
45006
45404
|
const placeholderRaw = xml && isDatePlaceholder(nonEmpty[i].text) ? paraTText(nonEmpty[i], xml) : null;
|
|
45007
45405
|
const sp = _nullishCoalesce(_nullishCoalesce((placeholderRaw !== null ? buildRangeSplices(nonEmpty[i], xml, 0, placeholderRaw.length, assigned[i]) : null), () => ( (xml ? minimalTextSplices(nonEmpty[i], xml, normForMatch(nonEmpty[i].text), assigned[i]) : null))), () => ( buildParagraphSplices(nonEmpty[i], assigned[i], xml)));
|
|
45008
45406
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
@@ -45085,7 +45483,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
45085
45483
|
const paths = parseSectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
45086
45484
|
if (paths.length > 0) return paths;
|
|
45087
45485
|
}
|
|
45088
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
45486
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkILRCRR54cjs.compareSectionPaths);
|
|
45089
45487
|
}
|
|
45090
45488
|
|
|
45091
45489
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -45214,7 +45612,7 @@ var Surgeon = (_class9 = class {
|
|
|
45214
45612
|
/** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
|
|
45215
45613
|
findEntry(path) {
|
|
45216
45614
|
const parts = path.replace(/^\//, "").split("/");
|
|
45217
|
-
let scope = _nullishCoalesce(_optionalChain([this, 'access',
|
|
45615
|
+
let scope = _nullishCoalesce(_optionalChain([this, 'access', _970 => _970.entries, 'access', _971 => _971[0], 'optionalAccess', _972 => _972.child]), () => ( -1));
|
|
45218
45616
|
let current;
|
|
45219
45617
|
for (const part of parts) {
|
|
45220
45618
|
const search = (idx) => {
|
|
@@ -45508,8 +45906,8 @@ function serializeRecords(recs, repl, inserts) {
|
|
|
45508
45906
|
parts.push(header, data);
|
|
45509
45907
|
};
|
|
45510
45908
|
for (let i = 0; i < recs.length; i++) {
|
|
45511
|
-
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess',
|
|
45512
|
-
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess',
|
|
45909
|
+
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _973 => _973.get, 'call', _974 => _974(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
|
|
45910
|
+
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _975 => _975.get, 'call', _976 => _976(i)]), () => ( recs[i].data)));
|
|
45513
45911
|
}
|
|
45514
45912
|
return Buffer.concat(parts);
|
|
45515
45913
|
}
|
|
@@ -45628,7 +46026,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
45628
46026
|
return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
|
|
45629
46027
|
}
|
|
45630
46028
|
const fhEntry = CFB2.find(cfb, "/FileHeader");
|
|
45631
|
-
if (!_optionalChain([fhEntry, 'optionalAccess',
|
|
46029
|
+
if (!_optionalChain([fhEntry, 'optionalAccess', _977 => _977.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
45632
46030
|
let flags;
|
|
45633
46031
|
try {
|
|
45634
46032
|
flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
|
|
@@ -45649,7 +46047,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
45649
46047
|
origBlocks = kept.blocks;
|
|
45650
46048
|
const visual = parseHwp5Document(originalBuf, { keepTrailingEmptyCols }).markdown;
|
|
45651
46049
|
if (kept.markdown !== visual && editedMarkdown === visual) {
|
|
45652
|
-
const verification2 = _optionalChain([options, 'optionalAccess',
|
|
46050
|
+
const verification2 = _optionalChain([options, 'optionalAccess', _978 => _978.verify]) === false ? void 0 : diffUnitLists(splitMarkdownUnits(visual), splitMarkdownUnits(editedMarkdown));
|
|
45653
46051
|
return { success: true, data: new Uint8Array(original), applied: 0, skipped, verification: verification2 };
|
|
45654
46052
|
}
|
|
45655
46053
|
if (editedFromVisual(kept.markdown, visual, editedMarkdown)) return fail(LAYOUT_MODE_MISMATCH);
|
|
@@ -45661,7 +46059,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
45661
46059
|
const scans = [];
|
|
45662
46060
|
for (let i = 0; i < sectionPaths.length; i++) {
|
|
45663
46061
|
const entry = CFB2.find(cfb, sectionPaths[i]);
|
|
45664
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
46062
|
+
if (!_optionalChain([entry, 'optionalAccess', _979 => _979.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
|
|
45665
46063
|
let stream;
|
|
45666
46064
|
try {
|
|
45667
46065
|
stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
@@ -45712,7 +46110,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
45712
46110
|
}
|
|
45713
46111
|
}
|
|
45714
46112
|
let verification;
|
|
45715
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
46113
|
+
if (_optionalChain([options, 'optionalAccess', _980 => _980.verify]) !== false) {
|
|
45716
46114
|
try {
|
|
45717
46115
|
const reparsed = parseHwp5Document(Buffer.from(data), { layoutTables: "keep", keepTrailingEmptyCols });
|
|
45718
46116
|
const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
|
|
@@ -45807,7 +46205,7 @@ function tableContentScore(irTable, scanTable) {
|
|
|
45807
46205
|
for (const [key, scanCell] of scanTable.cells) {
|
|
45808
46206
|
const comma = key.indexOf(",");
|
|
45809
46207
|
const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
|
|
45810
|
-
const irCell = _optionalChain([irTable, 'access',
|
|
46208
|
+
const irCell = _optionalChain([irTable, 'access', _981 => _981.cells, 'access', _982 => _982[r], 'optionalAccess', _983 => _983[c]]);
|
|
45811
46209
|
if (!irCell) continue;
|
|
45812
46210
|
const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
|
|
45813
46211
|
const b = normForMatch(stripCellTokens(irCell.text));
|
|
@@ -45843,7 +46241,7 @@ function handleModified(orig, edited, ctx) {
|
|
|
45843
46241
|
}
|
|
45844
46242
|
function patchParagraph(block, orig, edited, ctx, skip) {
|
|
45845
46243
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
45846
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
46244
|
+
if (!_optionalChain([mapping, 'optionalAccess', _984 => _984.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
45847
46245
|
const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
|
|
45848
46246
|
let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
|
|
45849
46247
|
if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
|
|
@@ -45872,7 +46270,7 @@ function patchParagraph(block, orig, edited, ctx, skip) {
|
|
|
45872
46270
|
}
|
|
45873
46271
|
const origPlain = block.text != null ? block.text : restoreBr(textUnitToPlain(orig.raw, block));
|
|
45874
46272
|
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");
|
|
45875
|
-
if (
|
|
46273
|
+
if (_chunk5N6MENH6cjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
45876
46274
|
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");
|
|
45877
46275
|
}
|
|
45878
46276
|
let origMd = restoreBr(textUnitToPlain(orig.raw, block));
|
|
@@ -45919,7 +46317,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
45919
46317
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
45920
46318
|
continue;
|
|
45921
46319
|
}
|
|
45922
|
-
if (afterEach.some((l) =>
|
|
46320
|
+
if (afterEach.some((l) => _chunk5N6MENH6cjs.sanitizeText.call(void 0, l) !== l)) {
|
|
45923
46321
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
45924
46322
|
continue;
|
|
45925
46323
|
}
|
|
@@ -45947,7 +46345,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
45947
46345
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
45948
46346
|
break;
|
|
45949
46347
|
}
|
|
45950
|
-
if (
|
|
46348
|
+
if (_chunk5N6MENH6cjs.sanitizeText.call(void 0, after2) !== after2) {
|
|
45951
46349
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
45952
46350
|
break;
|
|
45953
46351
|
}
|
|
@@ -46003,12 +46401,12 @@ function patchHtmlCells5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
46003
46401
|
}
|
|
46004
46402
|
function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
46005
46403
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
46006
|
-
const content =
|
|
46404
|
+
const content = _chunk5N6MENH6cjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
46007
46405
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
46008
46406
|
const t = line.trim();
|
|
46009
46407
|
if (!t) return "";
|
|
46010
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
46011
|
-
return
|
|
46408
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunk5N6MENH6cjs.escapeGfm.call(void 0, t)}**`;
|
|
46409
|
+
return _chunk5N6MENH6cjs.escapeGfm.call(void 0, t);
|
|
46012
46410
|
}).filter(Boolean);
|
|
46013
46411
|
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");
|
|
46014
46412
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -46022,7 +46420,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
46022
46420
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
46023
46421
|
const replica = [];
|
|
46024
46422
|
for (let r = 0; r < table2.rows; r++) {
|
|
46025
|
-
const line =
|
|
46423
|
+
const line = _chunk5N6MENH6cjs.escapeGfm.call(void 0, _chunk5N6MENH6cjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
46026
46424
|
if (line) replica.push({ line, gridR: r });
|
|
46027
46425
|
}
|
|
46028
46426
|
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");
|
|
@@ -46048,7 +46446,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
46048
46446
|
};
|
|
46049
46447
|
const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
|
|
46050
46448
|
if (!cell2) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
|
|
46051
|
-
const irCell = _optionalChain([table2, 'access',
|
|
46449
|
+
const irCell = _optionalChain([table2, 'access', _985 => _985.cells, 'access', _986 => _986[gridR], 'optionalAccess', _987 => _987[gridC]]);
|
|
46052
46450
|
const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
|
|
46053
46451
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
46054
46452
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -46063,7 +46461,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
46063
46461
|
if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
|
|
46064
46462
|
return skip("\uC140 \uC904 \uACBD\uACC4 \uB9E4\uD551 \uBAA8\uD638 (\uBB38\uB2E8 \uB0B4 \uC904\uBC14\uAFC8) \u2014 \uBBF8\uC9C0\uC6D0");
|
|
46065
46463
|
}
|
|
46066
|
-
const unstable = newLines.find((l) =>
|
|
46464
|
+
const unstable = newLines.find((l) => _chunk5N6MENH6cjs.sanitizeText.call(void 0, l) !== l);
|
|
46067
46465
|
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");
|
|
46068
46466
|
const targets = nonEmpty.length > 0 ? nonEmpty : cell2.paras;
|
|
46069
46467
|
if (targets.length === 0) return skip("\uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC74C \u2014 \uBBF8\uC9C0\uC6D0");
|
|
@@ -46310,7 +46708,7 @@ function stageParaPatch(scan, para2, newPlain, skip, origPlain) {
|
|
|
46310
46708
|
return skip(para2.ctrlMask !== 0 ? "\uCEE8\uD2B8\uB864 \uBB38\uC790(\uD0ED/\uD544\uB4DC/\uD2B9\uC218\uACF5\uBC31 \uB4F1 \uD14D\uC2A4\uD2B8 \uC911\uAC04) \uD3EC\uD568 \uBB38\uB2E8 \u2014 \uBBF8\uC9C0\uC6D0 (v1)" : "PARA_TEXT \uC7AC\uAD6C\uC131 \uBD88\uC77C\uCE58 \u2014 \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
46311
46709
|
}
|
|
46312
46710
|
if (seg.core !== para2.rawText) return skip("PARA_TEXT \uC7AC\uAD6C\uC131 \uBD88\uC77C\uCE58 \u2014 \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
46313
|
-
const edit = origPlain !== void 0 && !origPlain.includes("\n") && !newPlain.includes("\n") ? _optionalChain([alignedTextEdits, 'call',
|
|
46711
|
+
const edit = origPlain !== void 0 && !origPlain.includes("\n") && !newPlain.includes("\n") ? _optionalChain([alignedTextEdits, 'call', _988 => _988(para2.rawText, origPlain, newPlain), 'optionalAccess', _989 => _989[0]]) : void 0;
|
|
46314
46712
|
const lead = para2.rawText.match(/^\s*/)[0];
|
|
46315
46713
|
const trail = para2.rawText.match(/\s*$/)[0];
|
|
46316
46714
|
const newRaw = edit ? para2.rawText.slice(0, edit.start) + edit.text + para2.rawText.slice(edit.end) : para2.rawText.trim() === para2.rawText ? newPlain : lead + newPlain + trail;
|
|
@@ -46361,7 +46759,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
46361
46759
|
origBlocks = parsed.blocks;
|
|
46362
46760
|
const visual = await parseHwpxDocument(u8ToArrayBuffer(original), { keepTrailingEmptyCols });
|
|
46363
46761
|
if (parsed.markdown !== visual.markdown && editedMarkdown === visual.markdown) {
|
|
46364
|
-
const verification2 = _optionalChain([options, 'optionalAccess',
|
|
46762
|
+
const verification2 = _optionalChain([options, 'optionalAccess', _990 => _990.verify]) === false ? void 0 : diffUnitLists(splitMarkdownUnits(visual.markdown), splitMarkdownUnits(editedMarkdown));
|
|
46365
46763
|
return { success: true, data: new Uint8Array(original), applied: 0, skipped, verification: verification2 };
|
|
46366
46764
|
}
|
|
46367
46765
|
if (editedFromVisual(parsed.markdown, visual.markdown, editedMarkdown)) return { success: false, applied: 0, skipped, error: LAYOUT_MODE_MISMATCH };
|
|
@@ -46392,32 +46790,44 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
46392
46790
|
}
|
|
46393
46791
|
const origUnits = buildOrigUnits(origBlocks);
|
|
46394
46792
|
const editedUnits = splitMarkdownUnits(editedMarkdown);
|
|
46395
|
-
const pairs = alignUnits(origUnits.map((u) => u.raw), editedUnits.map((u) => u.raw));
|
|
46793
|
+
const pairs = alignUnits(origUnits.map((u) => looseRaw(u.raw)), editedUnits.map((u) => looseRaw(u.raw)));
|
|
46396
46794
|
const paraMap = resolveParagraphMappings(origBlocks, scans);
|
|
46397
46795
|
const scanTables = scans.flatMap((s) => s.tables.filter((t) => t.rows.length > 0));
|
|
46398
46796
|
const obTableOrdinals = buildTableOrdinals(origBlocks);
|
|
46399
46797
|
const sectionSplices = scans.map(() => []);
|
|
46400
|
-
|
|
46798
|
+
const structural = _optionalChain([options, 'optionalAccess', _991 => _991.structure]) !== false && origUnits.length * editedUnits.length <= 4e6;
|
|
46799
|
+
const ctx = { origBlocks, paraMap, scans, scanTables, obTableOrdinals, sectionSplices, skipped, tableInsert, structure: structural };
|
|
46800
|
+
const struct = structural ? createStructureEditor({
|
|
46801
|
+
origUnits,
|
|
46802
|
+
origBlocks,
|
|
46803
|
+
paraMap,
|
|
46804
|
+
scans,
|
|
46805
|
+
scanTables,
|
|
46806
|
+
obTableOrdinals,
|
|
46807
|
+
sectionSplices,
|
|
46808
|
+
skipped,
|
|
46809
|
+
inlineOf: (oi) => textUnitInline(origUnits[oi].raw, origBlocks[origUnits[oi].blockIdx]),
|
|
46810
|
+
tableXml: (edited2, outerParaPrId) => newTableParagraph(edited2, outerParaPrId, tableInsert)
|
|
46811
|
+
}) : null;
|
|
46812
|
+
let lastOi = null;
|
|
46813
|
+
for (const [oi, ei] of struct ? pairTablesInGaps(pairs, origUnits, editedUnits) : pairs) {
|
|
46401
46814
|
if (oi !== null && ei !== null) {
|
|
46815
|
+
lastOi = oi;
|
|
46402
46816
|
const orig = origUnits[oi];
|
|
46403
46817
|
const edited2 = editedUnits[ei];
|
|
46404
|
-
if (orig.raw === edited2.raw) continue;
|
|
46405
|
-
|
|
46406
|
-
|
|
46407
|
-
paraMap,
|
|
46408
|
-
scans,
|
|
46409
|
-
scanTables,
|
|
46410
|
-
obTableOrdinals,
|
|
46411
|
-
sectionSplices,
|
|
46412
|
-
skipped,
|
|
46413
|
-
tableInsert
|
|
46414
|
-
});
|
|
46818
|
+
if (looseRaw(orig.raw) === looseRaw(edited2.raw)) continue;
|
|
46819
|
+
const restyled = _nullishCoalesce(_optionalChain([struct, 'optionalAccess', _992 => _992.restyle, 'call', _993 => _993(oi, edited2)]), () => ( null));
|
|
46820
|
+
applied += _nullishCoalesce(restyled, () => ( handleModifiedUnit(orig, edited2, ctx)));
|
|
46415
46821
|
} else if (oi !== null) {
|
|
46416
|
-
|
|
46822
|
+
lastOi = oi;
|
|
46823
|
+
if (struct) applied += struct.remove(oi);
|
|
46824
|
+
else skipped.push({ reason: "\uBE14\uB85D \uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 (structure: false) \u2014 \uC6D0\uBCF8 \uC720\uC9C0", before: summarize(origUnits[oi].raw) });
|
|
46417
46825
|
} else if (ei !== null) {
|
|
46418
|
-
|
|
46826
|
+
if (struct) applied += struct.insert(editedUnits[ei], lastOi);
|
|
46827
|
+
else skipped.push({ reason: "\uBE14\uB85D \uCD94\uAC00\uB294 \uBBF8\uC9C0\uC6D0 (structure: false)", after: summarize(editedUnits[ei].raw) });
|
|
46419
46828
|
}
|
|
46420
46829
|
}
|
|
46830
|
+
if (struct) scans.forEach((_, i) => sectionSplices[i].push(...struct.staleCacheSplices(i)));
|
|
46421
46831
|
const replacements = /* @__PURE__ */ new Map();
|
|
46422
46832
|
const edited = [];
|
|
46423
46833
|
const encoder = new TextEncoder();
|
|
@@ -46447,7 +46857,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
46447
46857
|
}
|
|
46448
46858
|
}
|
|
46449
46859
|
let verification;
|
|
46450
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
46860
|
+
if (_optionalChain([options, 'optionalAccess', _994 => _994.verify]) !== false) {
|
|
46451
46861
|
const issues = replacements.size > 0 ? checkPatchIntegrity(original, data, replacements, edited) : [];
|
|
46452
46862
|
if (issues.length) return { success: false, applied, skipped, error: `\uD328\uCE58\uBCF8 \uBB34\uACB0\uC131 \uAC80\uC0AC \uC2E4\uD328 \u2014 \uD328\uCE58 \uC911\uB2E8: ${issues.join("; ")}` };
|
|
46453
46863
|
try {
|
|
@@ -46465,19 +46875,19 @@ function buildOrigUnits(blocks) {
|
|
|
46465
46875
|
const block = blocks[i];
|
|
46466
46876
|
let consume = 1;
|
|
46467
46877
|
let chunk;
|
|
46468
|
-
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(
|
|
46878
|
+
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(_chunk5N6MENH6cjs.sanitizeText.call(void 0, block.text))) {
|
|
46469
46879
|
const next = blocks[i + 1];
|
|
46470
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
46471
|
-
chunk =
|
|
46880
|
+
if (_optionalChain([next, 'optionalAccess', _995 => _995.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
46881
|
+
chunk = _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
46472
46882
|
} else {
|
|
46473
|
-
chunk =
|
|
46883
|
+
chunk = _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, [block]);
|
|
46474
46884
|
}
|
|
46475
46885
|
if (chunk) {
|
|
46476
46886
|
const subUnits = splitMarkdownUnits(chunk);
|
|
46477
46887
|
const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
|
|
46478
46888
|
for (let s = 0; s < subUnits.length; s++) {
|
|
46479
46889
|
const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
|
|
46480
|
-
if (block.type === "table" && _optionalChain([block, 'access',
|
|
46890
|
+
if (block.type === "table" && _optionalChain([block, 'access', _996 => _996.table, 'optionalAccess', _997 => _997.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
|
|
46481
46891
|
u.role = "caption";
|
|
46482
46892
|
}
|
|
46483
46893
|
units.push(u);
|
|
@@ -46686,7 +47096,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
46686
47096
|
const ti = ctx.tableInsert;
|
|
46687
47097
|
if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
|
|
46688
47098
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
46689
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
47099
|
+
if (!_optionalChain([mapping, 'optionalAccess', _998 => _998.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED) \u2014 \uD45C \uBCC0\uD658 \uBD88\uAC00");
|
|
46690
47100
|
const para2 = mapping.para;
|
|
46691
47101
|
if (para2.kind !== "body") return skip("\uBCF8\uBB38 \uC678 \uC601\uC5ED(\uD45C \uC140/\uAE00\uC0C1\uC790) \uBB38\uB2E8\uC758 \uD45C \uBCC0\uD658\uC740 \uBBF8\uC9C0\uC6D0");
|
|
46692
47102
|
const scan = ctx.scans[para2.sectionIndex];
|
|
@@ -46712,9 +47122,21 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
46712
47122
|
ctx.sectionSplices[para2.sectionIndex].push({ start: para2.start, end: pEnd, replacement: tableXml2 });
|
|
46713
47123
|
return 1;
|
|
46714
47124
|
}
|
|
47125
|
+
function newTableParagraph(edited, outerParaPrId, ti) {
|
|
47126
|
+
if (!ti) return { reason: "\uD45C \uCD94\uAC00 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328" };
|
|
47127
|
+
const rows = parseGfmTable(edited.lines);
|
|
47128
|
+
if (rows.length === 0 || rows.every((r) => r.length === 0)) return { reason: "\uD45C \uB0B4\uC6A9\uC774 \uBE44\uC5B4 \uC788\uC74C" };
|
|
47129
|
+
if (ti.borderFillId === null) {
|
|
47130
|
+
const inj = injectCellBorderFill(ti.headerXml, ti.nextId++);
|
|
47131
|
+
if (!inj) return { reason: "header <hh:borderFills> \uAD6C\uC870\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC5B4 \uD45C \uD14C\uB450\uB9AC \uC0DD\uC131 \uBD88\uAC00" };
|
|
47132
|
+
ti.borderFillId = inj.borderFillId;
|
|
47133
|
+
ti.headerSplices.push(...inj.headerSplices);
|
|
47134
|
+
}
|
|
47135
|
+
return buildTableParagraphXml(rows, { borderFillId: ti.borderFillId, outerParaPrId, cellParaPrId: 0, cellCharPrId: 0, tableId: ti.nextId++ });
|
|
47136
|
+
}
|
|
46715
47137
|
function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
46716
47138
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
46717
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
47139
|
+
if (!_optionalChain([mapping, 'optionalAccess', _999 => _999.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
46718
47140
|
if (block.text && block.text.includes("\n")) {
|
|
46719
47141
|
return skip("\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)");
|
|
46720
47142
|
}
|
|
@@ -46722,9 +47144,9 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
46722
47144
|
const newInline = parseEmphasis(textUnitInline(edited.raw, block));
|
|
46723
47145
|
let origPlain = origInline.plain;
|
|
46724
47146
|
let newPlain = newInline.plain;
|
|
46725
|
-
const segsUsable = !block.footnoteText && !_optionalChain([mapping, 'access',
|
|
47147
|
+
const segsUsable = !block.footnoteText && !_optionalChain([mapping, 'access', _1000 => _1000.noteMarks, 'optionalAccess', _1001 => _1001.length]) && !mapping.prefixStripped;
|
|
46726
47148
|
if (block.footnoteText) {
|
|
46727
|
-
const origNote = block.footnoteBlocks ? _optionalChain([origPlain, 'access',
|
|
47149
|
+
const origNote = block.footnoteBlocks ? _optionalChain([origPlain, 'access', _1002 => _1002.match, 'call', _1003 => _1003(/\s*\(주: ([\s\S]*)\)$/), 'optionalAccess', _1004 => _1004[1]]) : void 0;
|
|
46728
47150
|
origPlain = origPlain.replace(/\s*\(주: [\s\S]*\)$/, "");
|
|
46729
47151
|
const noteMatch = newPlain.match(/\s*\(주: ([\s\S]*)\)$/);
|
|
46730
47152
|
if (noteMatch) {
|
|
@@ -46736,7 +47158,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
46736
47158
|
ctx.skipped.push({ reason: "\uAC01\uC8FC \uD45C\uAE30 \uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 \u2014 \uAC01\uC8FC \uC720\uC9C0, \uBCF8\uBB38\uB9CC \uC801\uC6A9", before: `(\uC8FC: ${block.footnoteText})` });
|
|
46737
47159
|
}
|
|
46738
47160
|
}
|
|
46739
|
-
if (_optionalChain([mapping, 'access',
|
|
47161
|
+
if (_optionalChain([mapping, 'access', _1005 => _1005.noteMarks, 'optionalAccess', _1006 => _1006.length])) {
|
|
46740
47162
|
origPlain = removeNoteMarks(origPlain, mapping.noteMarks).text;
|
|
46741
47163
|
const r = removeNoteMarks(newPlain, mapping.noteMarks);
|
|
46742
47164
|
newPlain = r.text;
|
|
@@ -46754,10 +47176,10 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
46754
47176
|
}
|
|
46755
47177
|
}
|
|
46756
47178
|
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");
|
|
46757
|
-
if (
|
|
47179
|
+
if (_chunk5N6MENH6cjs.sanitizeText.call(void 0, newPlain) !== newPlain && _chunk5N6MENH6cjs.sanitizeText.call(void 0, origPlain) === origPlain) {
|
|
46758
47180
|
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");
|
|
46759
47181
|
}
|
|
46760
|
-
const xml = _optionalChain([ctx, 'access',
|
|
47182
|
+
const xml = _optionalChain([ctx, 'access', _1007 => _1007.scans, 'access', _1008 => _1008[mapping.para.sectionIndex], 'optionalAccess', _1009 => _1009.xml]);
|
|
46761
47183
|
const splices = _nullishCoalesce(_nullishCoalesce((xml ? minimalTextSplices(mapping.para, xml, origPlain, newPlain, segsUsable ? origInline.segs : void 0, segsUsable ? newInline.segs : void 0) : null), () => ( (xml ? markerRunSplices(mapping.para, xml, newPlain) : null))), () => ( buildParagraphSplices(mapping.para, newPlain, xml)));
|
|
46762
47184
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
46763
47185
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
@@ -46771,25 +47193,25 @@ function textUnitToPlain(raw, block) {
|
|
|
46771
47193
|
}
|
|
46772
47194
|
function textUnitInline(raw, block) {
|
|
46773
47195
|
let text = raw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
46774
|
-
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(
|
|
47196
|
+
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(_chunk5N6MENH6cjs.sanitizeText.call(void 0, block.text))) {
|
|
46775
47197
|
text = text.replace(/^#{1,6}\s+/, "");
|
|
46776
47198
|
}
|
|
46777
47199
|
if (block.href) {
|
|
46778
47200
|
const linkMatch = text.match(/^\[([\s\S]*)\]\([^)]*\)$/);
|
|
46779
47201
|
if (linkMatch) text = linkMatch[1];
|
|
46780
47202
|
}
|
|
46781
|
-
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(
|
|
47203
|
+
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(_chunk5N6MENH6cjs.sanitizeText.call(void 0, block.text))) {
|
|
46782
47204
|
text = text.slice(1, -1);
|
|
46783
47205
|
}
|
|
46784
47206
|
return text;
|
|
46785
47207
|
}
|
|
46786
47208
|
function diffUnitLists(a, b) {
|
|
46787
|
-
const pairs = alignUnits(a.map((u) => u.raw), b.map((u) => u.raw));
|
|
47209
|
+
const pairs = alignUnits(a.map((u) => looseRaw(u.raw)), b.map((u) => looseRaw(u.raw)));
|
|
46788
47210
|
const stats = { added: 0, removed: 0, modified: 0, unchanged: 0 };
|
|
46789
47211
|
const diffs = [];
|
|
46790
47212
|
for (const [ai, bi] of pairs) {
|
|
46791
47213
|
if (ai !== null && bi !== null) {
|
|
46792
|
-
if (a[ai].raw === b[bi].raw) {
|
|
47214
|
+
if (looseRaw(a[ai].raw) === looseRaw(b[bi].raw)) {
|
|
46793
47215
|
stats.unchanged++;
|
|
46794
47216
|
continue;
|
|
46795
47217
|
}
|
|
@@ -46805,6 +47227,9 @@ function diffUnitLists(a, b) {
|
|
|
46805
47227
|
}
|
|
46806
47228
|
return { stats, diffs };
|
|
46807
47229
|
}
|
|
47230
|
+
function looseRaw(raw) {
|
|
47231
|
+
return raw.replace(/\\~/g, "~");
|
|
47232
|
+
}
|
|
46808
47233
|
function unitToBlock(u) {
|
|
46809
47234
|
return { type: "paragraph", text: u.raw };
|
|
46810
47235
|
}
|
|
@@ -47285,7 +47710,7 @@ var REF_NOUN = alt([
|
|
|
47285
47710
|
]);
|
|
47286
47711
|
var REF = `\\s?\\((?!(?:${REF_NOUN})[),])[\uAC00-\uD7A3]{1,6}(?:\\d{0,2}(?:\uB3D9|\uB9AC)|\\d{1,2}\uAC00)(?:,\\s?[^)]{1,30})?\\)`;
|
|
47287
47712
|
var PLACEHOLDER_NO = /(?<![\d-])0+(?![\d])/;
|
|
47288
|
-
var realNumber = (x) => !PLACEHOLDER_NO.test(_nullishCoalesce(_optionalChain([x, 'access',
|
|
47713
|
+
var realNumber = (x) => !PLACEHOLDER_NO.test(_nullishCoalesce(_optionalChain([x, 'access', _1010 => _1010.m, 'access', _1011 => _1011.groups, 'optionalAccess', _1012 => _1012.rest]), () => ( "")));
|
|
47289
47714
|
var ADDRESS_VARIANTS = [
|
|
47290
47715
|
{
|
|
47291
47716
|
// 도로명 주소 — 읍·면, 동·리("서울시 도봉구 창동 우이천로 4다길 9"·"서천군 판교면 판교리 대백제로 1999") 뒤도, 참고항목까지
|
|
@@ -48394,9 +48819,9 @@ var REGION_WORDS = /* @__PURE__ */ new Set([...SIDO, ...SIGUNGU, ...SIGUNGU.filt
|
|
|
48394
48819
|
var NON_NAME_END = /(?:적|하여|하는|하고|하며|하게|하기|하면|하다|한다|했다|는데|니다|습니|다고|해야|해서|되는|되어|된다|지만|니까|와서|워서)$/;
|
|
48395
48820
|
var FOREIGN_SYLLABLE = /[스트크드브프즈츠끄뜨쁘쓰쯔플클블러케퍼커터텔톤튼픈핀펜헨앤엔엠켓렛쇼핑]/;
|
|
48396
48821
|
var TITLE_SET = /* @__PURE__ */ new Set([...TITLES, ...RANKS, ...PARTY_ROLES]);
|
|
48397
|
-
var g = (x, name) => _nullishCoalesce(_optionalChain([x, 'access',
|
|
48822
|
+
var g = (x, name) => _nullishCoalesce(_optionalChain([x, 'access', _1013 => _1013.m, 'access', _1014 => _1014.groups, 'optionalAccess', _1015 => _1015[name]]), () => ( ""));
|
|
48398
48823
|
var nameOf = (x) => g(x, "dsur") + g(x, "dgiven") + g(x, "sur") + g(x, "given") + g(x, "given1");
|
|
48399
|
-
var span = (x) => _optionalChain([x, 'access',
|
|
48824
|
+
var span = (x) => _optionalChain([x, 'access', _1016 => _1016.m, 'access', _1017 => _1017.indices, 'optionalAccess', _1018 => _1018.groups, 'optionalAccess', _1019 => _1019.n]);
|
|
48400
48825
|
var nextIs = (x, re) => {
|
|
48401
48826
|
const n = span(x);
|
|
48402
48827
|
return !!n && re.test(x.m.input.slice(n[1], n[1] + 1));
|
|
@@ -48768,7 +49193,7 @@ function labelsBefore(norm2, start) {
|
|
|
48768
49193
|
return labelsIn(win);
|
|
48769
49194
|
}
|
|
48770
49195
|
var OTHER_AFTER_RE = /^\s{0,2}[(\[]?\s{0,2}(?:접\s*수|신\s*청|주\s*문|사\s*건|과\s*제|문\s*서|관\s*리|부\s*품|제\s*품|모\s*델|코\s*드|시\s*리\s*얼|serial|model)/i;
|
|
48771
|
-
var g2 = (x, name) => _nullishCoalesce(_optionalChain([x, 'access',
|
|
49196
|
+
var g2 = (x, name) => _nullishCoalesce(_optionalChain([x, 'access', _1020 => _1020.m, 'access', _1021 => _1021.groups, 'optionalAccess', _1022 => _1022[name]]), () => ( ""));
|
|
48772
49197
|
var has = (x, c) => x.ctx().has(c);
|
|
48773
49198
|
var crnOnly = (x) => has(x, "crn") && !has(x, "rrn");
|
|
48774
49199
|
var after = (x, n = 16) => {
|
|
@@ -49076,9 +49501,9 @@ function normalizeForDetect(text) {
|
|
|
49076
49501
|
}
|
|
49077
49502
|
function maskMatch(orig, norm2, start, x, v, maskChar) {
|
|
49078
49503
|
const chars = orig.split("");
|
|
49079
|
-
const idx = _optionalChain([x, 'access',
|
|
49504
|
+
const idx = _optionalChain([x, 'access', _1023 => _1023.m, 'access', _1024 => _1024.indices, 'optionalAccess', _1025 => _1025.groups]);
|
|
49080
49505
|
for (const name of v.mask) {
|
|
49081
|
-
const r = _optionalChain([idx, 'optionalAccess',
|
|
49506
|
+
const r = _optionalChain([idx, 'optionalAccess', _1026 => _1026[name]]);
|
|
49082
49507
|
if (!r) continue;
|
|
49083
49508
|
for (let i = r[0] - start; i < r[1] - start; i++) {
|
|
49084
49509
|
if (v.maskAll || /[\p{L}\p{N}]/u.test(norm2[start + i])) chars[i] = maskChar;
|
|
@@ -49103,7 +49528,7 @@ function detect(text, rules, maskChar, headerAt) {
|
|
|
49103
49528
|
const re = v.re;
|
|
49104
49529
|
re.lastIndex = 0;
|
|
49105
49530
|
for (let m = re.exec(norm2); m !== null; m = re.exec(norm2)) {
|
|
49106
|
-
const sg = v.span ? _optionalChain([m, 'access',
|
|
49531
|
+
const sg = v.span ? _optionalChain([m, 'access', _1027 => _1027.indices, 'optionalAccess', _1028 => _1028.groups, 'optionalAccess', _1029 => _1029[v.span]]) : void 0;
|
|
49107
49532
|
const start = sg ? sg[0] : m.index;
|
|
49108
49533
|
const end = sg ? sg[1] : start + m[0].length;
|
|
49109
49534
|
const retry = () => {
|
|
@@ -49132,7 +49557,7 @@ function detect(text, rules, maskChar, headerAt) {
|
|
|
49132
49557
|
const x = {
|
|
49133
49558
|
m,
|
|
49134
49559
|
ctx,
|
|
49135
|
-
header: () => _optionalChain([headerAt, 'optionalCall',
|
|
49560
|
+
header: () => _optionalChain([headerAt, 'optionalCall', _1030 => _1030(start)]),
|
|
49136
49561
|
prev: () => {
|
|
49137
49562
|
let best;
|
|
49138
49563
|
for (const o of occupied) if (o.end <= start && (!best || o.end > best.end)) best = o;
|
|
@@ -49160,9 +49585,9 @@ function applyHits(text, hits) {
|
|
|
49160
49585
|
return out + text.slice(cursor);
|
|
49161
49586
|
}
|
|
49162
49587
|
function redactText(text, options) {
|
|
49163
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49588
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1031 => _1031.maskChar]), () => ( "\u25CF"));
|
|
49164
49589
|
assertMaskChar(maskChar);
|
|
49165
|
-
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49590
|
+
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1032 => _1032.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
49166
49591
|
if (text === "" || rules.length === 0) return { text, hits: [] };
|
|
49167
49592
|
const hits = detect(text, rules, maskChar);
|
|
49168
49593
|
return { text: applyHits(text, hits), hits };
|
|
@@ -49180,7 +49605,7 @@ function htmlCells(line) {
|
|
|
49180
49605
|
const out = [];
|
|
49181
49606
|
let col = 0;
|
|
49182
49607
|
for (const m of line.matchAll(/<t([dh])\b([^>]*)>([\s\S]*?)<\/t\1>/gi)) {
|
|
49183
|
-
const span2 = Math.max(1, Number(_nullishCoalesce(_optionalChain([m, 'access',
|
|
49608
|
+
const span2 = Math.max(1, Number(_nullishCoalesce(_optionalChain([m, 'access', _1033 => _1033[2], 'access', _1034 => _1034.match, 'call', _1035 => _1035(/colspan="?(\d+)/i), 'optionalAccess', _1036 => _1036[1]]), () => ( 1))));
|
|
49184
49609
|
out.push({ start: m.index, end: m.index + m[0].length, col, span: span2, text: m[3].replace(/<[^>]*>/g, " ") });
|
|
49185
49610
|
col += span2;
|
|
49186
49611
|
}
|
|
@@ -49222,7 +49647,7 @@ function tableHeaderContext(lines) {
|
|
|
49222
49647
|
const c = cells.find((x) => off >= x.start && off < x.end);
|
|
49223
49648
|
if (!c) return void 0;
|
|
49224
49649
|
const h = hdr.find((x) => c.col >= x.col && c.col < x.col + x.span);
|
|
49225
|
-
return _optionalChain([h, 'optionalAccess',
|
|
49650
|
+
return _optionalChain([h, 'optionalAccess', _1037 => _1037.text]);
|
|
49226
49651
|
});
|
|
49227
49652
|
}
|
|
49228
49653
|
}
|
|
@@ -49291,9 +49716,9 @@ function detectMarkdownLine(line, rules, maskChar, headerAt) {
|
|
|
49291
49716
|
});
|
|
49292
49717
|
}
|
|
49293
49718
|
function redactMarkdown(markdown, options) {
|
|
49294
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49719
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1038 => _1038.maskChar]), () => ( "\u25CF"));
|
|
49295
49720
|
assertMaskChar(maskChar);
|
|
49296
|
-
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49721
|
+
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1039 => _1039.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
49297
49722
|
const lines = markdown.split("\n");
|
|
49298
49723
|
const headers = tableHeaderContext(lines);
|
|
49299
49724
|
const hits = [];
|
|
@@ -49323,10 +49748,10 @@ function sameBreadcrumb(a, b) {
|
|
|
49323
49748
|
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
49324
49749
|
}
|
|
49325
49750
|
function blocksToChunks(blocks, options) {
|
|
49326
|
-
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49327
|
-
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49328
|
-
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess',
|
|
49329
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
49751
|
+
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1040 => _1040.granularity]), () => ( "section"));
|
|
49752
|
+
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1041 => _1041.includeTableCells]), () => ( false));
|
|
49753
|
+
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess', _1042 => _1042.tableFormat]) };
|
|
49754
|
+
if (_optionalChain([options, 'optionalAccess', _1043 => _1043.tableFormat]) === "gfm") _chunk5N6MENH6cjs.assignTableIds.call(void 0, blocks);
|
|
49330
49755
|
const chunks = [];
|
|
49331
49756
|
const headingStack = [];
|
|
49332
49757
|
const listStack = [];
|
|
@@ -49340,12 +49765,12 @@ function blocksToChunks(blocks, options) {
|
|
|
49340
49765
|
let run = null;
|
|
49341
49766
|
const flushRun = () => {
|
|
49342
49767
|
if (!run) return;
|
|
49343
|
-
push("text", run.breadcrumb,
|
|
49768
|
+
push("text", run.breadcrumb, _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, run.blocks, mdOptions), [run.start, run.end], run.page);
|
|
49344
49769
|
run = null;
|
|
49345
49770
|
};
|
|
49346
49771
|
for (let i = 0; i < blocks.length; i++) {
|
|
49347
49772
|
const block = blocks[i];
|
|
49348
|
-
const md2 =
|
|
49773
|
+
const md2 = _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, [block], mdOptions);
|
|
49349
49774
|
if (!md2) continue;
|
|
49350
49775
|
if (block.type === "heading") {
|
|
49351
49776
|
flushRun();
|
|
@@ -49433,7 +49858,7 @@ function u8ToArrayBuffer2(u8) {
|
|
|
49433
49858
|
return u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
|
|
49434
49859
|
}
|
|
49435
49860
|
function irCellLines(text) {
|
|
49436
|
-
return stripCellTokens(
|
|
49861
|
+
return stripCellTokens(_chunk5N6MENH6cjs.sanitizeText.call(void 0, text)).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
49437
49862
|
}
|
|
49438
49863
|
var HwpxSession = (_class10 = class _HwpxSession {
|
|
49439
49864
|
|
|
@@ -49463,7 +49888,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49463
49888
|
const block = st.blocks[blockIndex];
|
|
49464
49889
|
if (!block) return void 0;
|
|
49465
49890
|
if (block.type === "paragraph" || block.type === "heading") {
|
|
49466
|
-
const para2 = _optionalChain([st, 'access',
|
|
49891
|
+
const para2 = _optionalChain([st, 'access', _1044 => _1044.paraMap, 'access', _1045 => _1045.get, 'call', _1046 => _1046(blockIndex), 'optionalAccess', _1047 => _1047.para]);
|
|
49467
49892
|
if (!para2) return void 0;
|
|
49468
49893
|
return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
|
|
49469
49894
|
}
|
|
@@ -49488,7 +49913,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49488
49913
|
if (block.text && block.text.includes("\n")) {
|
|
49489
49914
|
return { capability: "locked", reason: "\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)" };
|
|
49490
49915
|
}
|
|
49491
|
-
if (!_optionalChain([st, 'access',
|
|
49916
|
+
if (!_optionalChain([st, 'access', _1048 => _1048.paraMap, 'access', _1049 => _1049.get, 'call', _1050 => _1050(blockIndex), 'optionalAccess', _1051 => _1051.para])) {
|
|
49492
49917
|
return { capability: "locked", reason: "\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)" };
|
|
49493
49918
|
}
|
|
49494
49919
|
return { capability: "text" };
|
|
@@ -49554,7 +49979,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49554
49979
|
continue;
|
|
49555
49980
|
}
|
|
49556
49981
|
if (block.type === "table" && block.table) {
|
|
49557
|
-
if (!_optionalChain([edit, 'access',
|
|
49982
|
+
if (!_optionalChain([edit, 'access', _1052 => _1052.cells, 'optionalAccess', _1053 => _1053.length])) {
|
|
49558
49983
|
skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
|
|
49559
49984
|
continue;
|
|
49560
49985
|
}
|
|
@@ -49574,7 +49999,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49574
49999
|
skipped.push({ reason: "\uAC19\uC740 \uC140\uC5D0 \uC911\uBCF5 \uD3B8\uC9D1 \u2014 \uBA3C\uC800 \uC801\uC6A9\uB41C \uD3B8\uC9D1 \uC720\uC9C0", after: summarize(cellEdit.text) });
|
|
49575
50000
|
continue;
|
|
49576
50001
|
}
|
|
49577
|
-
const irCell = _optionalChain([block, 'access',
|
|
50002
|
+
const irCell = _optionalChain([block, 'access', _1054 => _1054.table, 'access', _1055 => _1055.cells, 'access', _1056 => _1056[cellEdit.row], 'optionalAccess', _1057 => _1057[cellEdit.col]]);
|
|
49578
50003
|
if (!irCell) {
|
|
49579
50004
|
skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
|
|
49580
50005
|
continue;
|
|
@@ -49630,7 +50055,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49630
50055
|
}
|
|
49631
50056
|
if (replacements.size === 0) {
|
|
49632
50057
|
let changes2;
|
|
49633
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
50058
|
+
if (_optionalChain([options, 'optionalAccess', _1058 => _1058.verify]) !== false) {
|
|
49634
50059
|
const units = splitMarkdownUnits(st.markdown);
|
|
49635
50060
|
changes2 = diffUnitLists(units, units);
|
|
49636
50061
|
}
|
|
@@ -49651,7 +50076,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49651
50076
|
}
|
|
49652
50077
|
this.state = newState;
|
|
49653
50078
|
let changes;
|
|
49654
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
50079
|
+
if (_optionalChain([options, 'optionalAccess', _1059 => _1059.verify]) !== false) {
|
|
49655
50080
|
changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
|
|
49656
50081
|
}
|
|
49657
50082
|
return { success: true, data: new Uint8Array(data), applied, skipped, changes };
|
|
@@ -49671,11 +50096,11 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49671
50096
|
return skip("\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)");
|
|
49672
50097
|
}
|
|
49673
50098
|
const mapping = st.paraMap.get(blockIndex);
|
|
49674
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
50099
|
+
if (!_optionalChain([mapping, 'optionalAccess', _1060 => _1060.para])) {
|
|
49675
50100
|
return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
49676
50101
|
}
|
|
49677
50102
|
let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
49678
|
-
if (_optionalChain([mapping, 'access',
|
|
50103
|
+
if (_optionalChain([mapping, 'access', _1061 => _1061.noteMarks, 'optionalAccess', _1062 => _1062.length])) {
|
|
49679
50104
|
const r = removeNoteMarks(newPlain, mapping.noteMarks);
|
|
49680
50105
|
newPlain = r.text;
|
|
49681
50106
|
if (r.missing.length) skipped.push({ reason: "\uAC01\uC8FC \uCC38\uC870 \uBD80\uD638 \uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 \u2014 \uAC01\uC8FC \uC720\uC9C0, \uBCF8\uBB38\uB9CC \uC801\uC6A9", before: r.missing.join(" ") });
|
|
@@ -49693,17 +50118,17 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49693
50118
|
if (newPlain === "") {
|
|
49694
50119
|
return skip("\uBE14\uB85D \uBE44\uC6B0\uAE30/\uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 (v1) \u2014 \uC6D0\uBCF8 \uC720\uC9C0");
|
|
49695
50120
|
}
|
|
49696
|
-
if (
|
|
50121
|
+
if (_chunk5N6MENH6cjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
49697
50122
|
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");
|
|
49698
50123
|
}
|
|
49699
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access',
|
|
50124
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _1063 => _1063.scans, 'access', _1064 => _1064[mapping.para.sectionIndex], 'optionalAccess', _1065 => _1065.xml]));
|
|
49700
50125
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
49701
50126
|
sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
49702
50127
|
return 1;
|
|
49703
50128
|
}
|
|
49704
50129
|
}, _class10);
|
|
49705
50130
|
function cellStaticCheck(table2, scanTable, r, c) {
|
|
49706
|
-
const irCell = _optionalChain([table2, 'access',
|
|
50131
|
+
const irCell = _optionalChain([table2, 'access', _1066 => _1066.cells, 'access', _1067 => _1067[r], 'optionalAccess', _1068 => _1068[c]]);
|
|
49707
50132
|
if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
|
|
49708
50133
|
const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
|
|
49709
50134
|
if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
|
|
@@ -49788,16 +50213,16 @@ var md = new (0, _markdownit2.default)({
|
|
|
49788
50213
|
});
|
|
49789
50214
|
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;
|
|
49790
50215
|
function sanitizeRawHtml(raw) {
|
|
49791
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
50216
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkILRCRR54cjs.escapeHtml.call(void 0, tag));
|
|
49792
50217
|
}
|
|
49793
50218
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
49794
50219
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
49795
50220
|
function renderHtml(markdown, options) {
|
|
49796
|
-
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49797
|
-
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
50221
|
+
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1069 => _1069.preset]), () => ( "default"));
|
|
50222
|
+
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _1070 => _1070.extraCss]), () => ( "")));
|
|
49798
50223
|
const body = md.render(markdown);
|
|
49799
|
-
const watermark = _optionalChain([options, 'optionalAccess',
|
|
49800
|
-
const watermarkCss = _optionalChain([options, 'optionalAccess',
|
|
50224
|
+
const watermark = _optionalChain([options, 'optionalAccess', _1071 => _1071.watermark]) ? `<div class="watermark">${_chunkILRCRR54cjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
50225
|
+
const watermarkCss = _optionalChain([options, 'optionalAccess', _1072 => _1072.watermark]) ? `
|
|
49801
50226
|
.watermark {
|
|
49802
50227
|
position: fixed;
|
|
49803
50228
|
top: 50%; left: 50%;
|
|
@@ -49821,7 +50246,7 @@ ${body}
|
|
|
49821
50246
|
</body>
|
|
49822
50247
|
</html>`;
|
|
49823
50248
|
}
|
|
49824
|
-
function chromiumSandboxArgs(env = process.env, isRootLinux = process.platform === "linux" && _optionalChain([process, 'access',
|
|
50249
|
+
function chromiumSandboxArgs(env = process.env, isRootLinux = process.platform === "linux" && _optionalChain([process, 'access', _1073 => _1073.getuid, 'optionalCall', _1074 => _1074()]) === 0) {
|
|
49825
50250
|
return env.KORDOC_CHROMIUM_NO_SANDBOX === "1" || isRootLinux ? ["--no-sandbox", "--disable-setuid-sandbox"] : [];
|
|
49826
50251
|
}
|
|
49827
50252
|
async function launchLockedPage(puppeteer, executablePath) {
|
|
@@ -49850,13 +50275,13 @@ async function htmlToPdf(html, options) {
|
|
|
49850
50275
|
try {
|
|
49851
50276
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
49852
50277
|
} catch (e42) {
|
|
49853
|
-
throw new (0,
|
|
50278
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(
|
|
49854
50279
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
49855
50280
|
);
|
|
49856
50281
|
}
|
|
49857
50282
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
49858
50283
|
if (!executablePath) {
|
|
49859
|
-
throw new (0,
|
|
50284
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(
|
|
49860
50285
|
"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."
|
|
49861
50286
|
);
|
|
49862
50287
|
}
|
|
@@ -49864,10 +50289,10 @@ async function htmlToPdf(html, options) {
|
|
|
49864
50289
|
try {
|
|
49865
50290
|
await page.setContent(html, { waitUntil: "load" });
|
|
49866
50291
|
await page.waitForNetworkIdle({ idleTime: 500, concurrency: 0 });
|
|
49867
|
-
const margin = _optionalChain([options, 'optionalAccess',
|
|
50292
|
+
const margin = _optionalChain([options, 'optionalAccess', _1075 => _1075.margin]);
|
|
49868
50293
|
const pdf = await page.pdf({
|
|
49869
|
-
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49870
|
-
landscape: _optionalChain([options, 'optionalAccess',
|
|
50294
|
+
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1076 => _1076.pageSize]), () => ( "A4")),
|
|
50295
|
+
landscape: _optionalChain([options, 'optionalAccess', _1077 => _1077.orientation]) === "landscape",
|
|
49871
50296
|
printBackground: true,
|
|
49872
50297
|
margin: margin ? {
|
|
49873
50298
|
top: toCss(margin.top),
|
|
@@ -49875,9 +50300,9 @@ async function htmlToPdf(html, options) {
|
|
|
49875
50300
|
bottom: toCss(margin.bottom),
|
|
49876
50301
|
left: toCss(margin.left)
|
|
49877
50302
|
} : void 0,
|
|
49878
|
-
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess',
|
|
49879
|
-
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49880
|
-
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
50303
|
+
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _1078 => _1078.header]) || _optionalChain([options, 'optionalAccess', _1079 => _1079.footer])),
|
|
50304
|
+
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1080 => _1080.header]), () => ( "<div></div>")),
|
|
50305
|
+
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1081 => _1081.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
|
|
49881
50306
|
});
|
|
49882
50307
|
return Buffer.from(pdf);
|
|
49883
50308
|
} finally {
|
|
@@ -49911,7 +50336,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
49911
50336
|
return htmlToPdf(html, options);
|
|
49912
50337
|
}
|
|
49913
50338
|
async function blocksToPdf(blocks, options) {
|
|
49914
|
-
const markdown =
|
|
50339
|
+
const markdown = _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, blocks);
|
|
49915
50340
|
return markdownToPdf(markdown, options);
|
|
49916
50341
|
}
|
|
49917
50342
|
|
|
@@ -50069,7 +50494,7 @@ var OBJ_TAGS = /* @__PURE__ */ new Set(["tbl", "pic", "container", "equation", "
|
|
|
50069
50494
|
var CHAR_CTRL_1SLOT = /* @__PURE__ */ new Set(["lineBreak", "hyphen", "hypen", "nbSpace", "fwSpace"]);
|
|
50070
50495
|
var noteFmtCache = /* @__PURE__ */ new WeakMap();
|
|
50071
50496
|
function sectionNoteFormats2(p) {
|
|
50072
|
-
const root = _optionalChain([p, 'access',
|
|
50497
|
+
const root = _optionalChain([p, 'access', _1082 => _1082.ownerDocument, 'optionalAccess', _1083 => _1083.documentElement]);
|
|
50073
50498
|
if (!root) return {};
|
|
50074
50499
|
let f = noteFmtCache.get(root);
|
|
50075
50500
|
if (!f) {
|
|
@@ -50160,6 +50585,7 @@ function buildPara(p) {
|
|
|
50160
50585
|
let segs = [];
|
|
50161
50586
|
const runs = [];
|
|
50162
50587
|
let deleted = _nullishCoalesce(deletedStarts.get(p), () => ( 0));
|
|
50588
|
+
let secSlots = 0;
|
|
50163
50589
|
for (const runEl of elements(p)) {
|
|
50164
50590
|
const tag = ln(runEl);
|
|
50165
50591
|
if (tag === "run") {
|
|
@@ -50179,7 +50605,7 @@ function buildPara(p) {
|
|
|
50179
50605
|
const box = findChildByLocalName(ch, "drawText") && !rot && num2(cur, "width") > 0 && num2(cur, "height") > 0 && num2(cur, "height") < 2 ** 31;
|
|
50180
50606
|
const w = box ? num2(cur, "width") : num2(sz, "width") || num2(cur, "width") || num2(findChildByLocalName(ch, "orgSz"), "width");
|
|
50181
50607
|
const h = box ? num2(cur, "height") : num2(sz, "height") || num2(cur, "height") || num2(findChildByLocalName(ch, "orgSz"), "height");
|
|
50182
|
-
const inline = _optionalChain([pos, 'optionalAccess',
|
|
50608
|
+
const inline = _optionalChain([pos, 'optionalAccess', _1084 => _1084.getAttribute, 'call', _1085 => _1085("treatAsChar")]) === "1";
|
|
50183
50609
|
const om = inline ? findChildByLocalName(ch, "outMargin") : null;
|
|
50184
50610
|
if (!deleted) objs.push({
|
|
50185
50611
|
el: ch,
|
|
@@ -50196,7 +50622,8 @@ function buildPara(p) {
|
|
|
50196
50622
|
} else {
|
|
50197
50623
|
if (cn === "ctrl" || cn === "deleteBegin" || cn === "deleteEnd") deleted = deletionDelta(ch, deleted);
|
|
50198
50624
|
pushFillers(chars, 8, prId);
|
|
50199
|
-
if (cn
|
|
50625
|
+
if (cn === "secPr" || cn === "ctrl" && findChildByLocalName(ch, "colPr")) secSlots += 8;
|
|
50626
|
+
else {
|
|
50200
50627
|
const slot = chars[chars.length - 8];
|
|
50201
50628
|
slot.ctrl = true;
|
|
50202
50629
|
const an = cn === "ctrl" ? findChildByLocalName(ch, "autoNum") : null;
|
|
@@ -50221,6 +50648,11 @@ function buildPara(p) {
|
|
|
50221
50648
|
});
|
|
50222
50649
|
}
|
|
50223
50650
|
}
|
|
50651
|
+
if (secSlots > 0 && segs.length > 1) {
|
|
50652
|
+
let lead = 0;
|
|
50653
|
+
while (lead < chars.length && chars[lead].ch === "" && !chars[lead].ctrl && !objs.some((o) => o.index === lead)) lead++;
|
|
50654
|
+
if (segs.slice(1).some((s) => s.textpos < lead)) segs = segs.map((s, k) => k > 0 ? { ...s, textpos: s.textpos + secSlots } : s);
|
|
50655
|
+
}
|
|
50224
50656
|
return { chars, segs, objs, paraPrId: p.getAttribute("paraPrIDRef"), runs };
|
|
50225
50657
|
}
|
|
50226
50658
|
function captionOf(el) {
|
|
@@ -50248,7 +50680,7 @@ function paraHeadAdvance(head, offsetHeight, width) {
|
|
|
50248
50680
|
}
|
|
50249
50681
|
function tabAdvance(x, firstLine, geom, saved) {
|
|
50250
50682
|
const hang = geom && geom.marginIntent < 0 ? -geom.marginIntent : 0;
|
|
50251
|
-
if (firstLine && _optionalChain([geom, 'optionalAccess',
|
|
50683
|
+
if (firstLine && _optionalChain([geom, 'optionalAccess', _1086 => _1086.autoTabLeft]) && hang > 0 && x < hang - 0.5) return hang - x;
|
|
50252
50684
|
if (saved != null && saved >= 0) return saved;
|
|
50253
50685
|
return (Math.floor(x / DEFAULT_TAB_HU) + 1) * DEFAULT_TAB_HU - x;
|
|
50254
50686
|
}
|
|
@@ -50260,7 +50692,7 @@ function cellColumns(sub) {
|
|
|
50260
50692
|
}
|
|
50261
50693
|
function cellContentExtent(cell2, memo) {
|
|
50262
50694
|
if (!cell2.sub) return 0;
|
|
50263
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
50695
|
+
const hit = _optionalChain([memo, 'optionalAccess', _1087 => _1087.cell, 'access', _1088 => _1088.get, 'call', _1089 => _1089(cell2.el)]);
|
|
50264
50696
|
if (hit !== void 0) return hit;
|
|
50265
50697
|
const cols = cellColumns(cell2.sub);
|
|
50266
50698
|
let ext = 0;
|
|
@@ -50268,6 +50700,7 @@ function cellContentExtent(cell2, memo) {
|
|
|
50268
50700
|
for (const p of elements(cell2.sub)) {
|
|
50269
50701
|
if (ln(p) !== "p") continue;
|
|
50270
50702
|
const m = buildPara(p);
|
|
50703
|
+
const paraStart = prevEnd;
|
|
50271
50704
|
let firstShift = shift;
|
|
50272
50705
|
const lineTops = [];
|
|
50273
50706
|
m.segs.forEach((s, k) => {
|
|
@@ -50279,7 +50712,7 @@ function cellContentExtent(cell2, memo) {
|
|
|
50279
50712
|
prevEnd = s.vertpos + shift + s.textheight + (_nullishCoalesce(s.spacing, () => ( 0)));
|
|
50280
50713
|
ext = Math.max(ext, s.vertpos + s.textheight + shift);
|
|
50281
50714
|
});
|
|
50282
|
-
const baseV = (_nullishCoalesce(_optionalChain([m, 'access',
|
|
50715
|
+
const baseV = (_nullishCoalesce(_optionalChain([m, 'access', _1090 => _1090.segs, 'access', _1091 => _1091[0], 'optionalAccess', _1092 => _1092.vertpos]), () => ( 0))) + firstShift;
|
|
50283
50716
|
for (const o of m.objs) {
|
|
50284
50717
|
if (o.inline) {
|
|
50285
50718
|
const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
@@ -50289,16 +50722,16 @@ function cellContentExtent(cell2, memo) {
|
|
|
50289
50722
|
continue;
|
|
50290
50723
|
}
|
|
50291
50724
|
const pos = findChildByLocalName(o.el, "pos");
|
|
50292
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
50725
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1093 => _1093.getAttribute, 'call', _1094 => _1094("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
50293
50726
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
50294
50727
|
const pushed = baseV - (num2(om, "top") + o.height + num2(om, "bottom"));
|
|
50295
|
-
const anchor = pushed >= -100 ? pushed : baseV - (_nullishCoalesce(_optionalChain([memo, 'optionalAccess',
|
|
50728
|
+
const anchor = pushed >= (paraStart > 0 ? paraStart - 100 : -100) ? pushed : baseV - (_nullishCoalesce(_optionalChain([memo, 'optionalAccess', _1095 => _1095.paraGeom, 'optionalAccess', _1096 => _1096.get, 'call', _1097 => _1097(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1098 => _1098.spaceBefore]), () => ( 0)));
|
|
50296
50729
|
const vo = num2(pos, "vertOffset");
|
|
50297
50730
|
const oh = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
50298
50731
|
ext = Math.max(ext, anchor + num2(om, "top") + Math.max(0, vo) + oh);
|
|
50299
50732
|
}
|
|
50300
50733
|
}
|
|
50301
|
-
_optionalChain([memo, 'optionalAccess',
|
|
50734
|
+
_optionalChain([memo, 'optionalAccess', _1099 => _1099.cell, 'access', _1100 => _1100.set, 'call', _1101 => _1101(cell2.el, ext)]);
|
|
50302
50735
|
return ext;
|
|
50303
50736
|
}
|
|
50304
50737
|
function cellMarginOf(cm, side, def) {
|
|
@@ -50358,12 +50791,12 @@ function measureTableRowHeights(tbl2, memo) {
|
|
|
50358
50791
|
return rows;
|
|
50359
50792
|
}
|
|
50360
50793
|
function measureTableHeight(tbl2, memo) {
|
|
50361
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
50794
|
+
const hit = _optionalChain([memo, 'optionalAccess', _1102 => _1102.table, 'access', _1103 => _1103.get, 'call', _1104 => _1104(tbl2)]);
|
|
50362
50795
|
if (hit !== void 0) return hit;
|
|
50363
50796
|
const rowH = measureTableRowHeights(tbl2, memo);
|
|
50364
50797
|
let sum = 0;
|
|
50365
50798
|
for (const h of rowH) sum += h;
|
|
50366
|
-
_optionalChain([memo, 'optionalAccess',
|
|
50799
|
+
_optionalChain([memo, 'optionalAccess', _1105 => _1105.table, 'access', _1106 => _1106.set, 'call', _1107 => _1107(tbl2, sum)]);
|
|
50367
50800
|
return sum;
|
|
50368
50801
|
}
|
|
50369
50802
|
|
|
@@ -50376,22 +50809,22 @@ function squareTableOver(p, startV, lim, withText = false, areaW = 0) {
|
|
|
50376
50809
|
const pb = o.el.getAttribute("pageBreak");
|
|
50377
50810
|
if (pb !== "CELL" && pb !== "TABLE") return false;
|
|
50378
50811
|
const pos = findChildByLocalName(o.el, "pos"), om = findChildByLocalName(o.el, "outMargin");
|
|
50379
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
50812
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1108 => _1108.getAttribute, 'call', _1109 => _1109("vertRelTo")]), () => ( "PARA"))) !== "PARA") return false;
|
|
50380
50813
|
const vo = num2(pos, "vertOffset"), voS = Math.max(0, vo >= 2 ** 31 ? vo - 2 ** 32 : vo);
|
|
50381
50814
|
if (withText && Math.max(0, num2(pos, "horzOffset")) + num2(om, "left") + o.width + num2(om, "right") < areaW - 1440) return false;
|
|
50382
50815
|
return startV + voS + num2(om, "top") + (withText ? measureTableHeight(o.el) : Math.max(o.height, measureTableHeight(o.el))) + num2(om, "bottom") > lim;
|
|
50383
50816
|
});
|
|
50384
50817
|
}
|
|
50385
50818
|
function bulletEmptyHost(p, g3) {
|
|
50386
|
-
if (!_optionalChain([g3, 'optionalAccess',
|
|
50819
|
+
if (!_optionalChain([g3, 'optionalAccess', _1110 => _1110.bullet])) return false;
|
|
50387
50820
|
const m = buildPara(p);
|
|
50388
50821
|
return m.objs.length > 0 && !m.chars.some((c) => c.ch !== "" && c.ch.trim() !== "") && m.objs.every((o) => !o.inline && o.tag === "tbl" && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM");
|
|
50389
50822
|
}
|
|
50390
50823
|
function hasTbFloat(p) {
|
|
50391
|
-
return buildPara(p).objs.some((o) => !o.inline && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
50824
|
+
return buildPara(p).objs.some((o) => !o.inline && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1111 => _1111(o.el, "pos"), 'optionalAccess', _1112 => _1112.getAttribute, 'call', _1113 => _1113("vertRelTo")]), () => ( "PARA"))) === "PARA");
|
|
50392
50825
|
}
|
|
50393
50826
|
function m0Objs(p) {
|
|
50394
|
-
return _optionalChain([buildPara, 'call',
|
|
50827
|
+
return _optionalChain([buildPara, 'call', _1114 => _1114(p), 'access', _1115 => _1115.objs, 'access', _1116 => _1116.find, 'call', _1117 => _1117((o) => !o.inline && o.tag === "tbl"), 'optionalAccess', _1118 => _1118.el]);
|
|
50395
50828
|
}
|
|
50396
50829
|
function contentTableHeight(tbl2) {
|
|
50397
50830
|
const cells = collectCells(tbl2);
|
|
@@ -50407,7 +50840,7 @@ function bandTableOver(p, top, lim) {
|
|
|
50407
50840
|
const pb = o.el.getAttribute("pageBreak");
|
|
50408
50841
|
if (pb !== "CELL" && pb !== "TABLE") return false;
|
|
50409
50842
|
const pos = findChildByLocalName(o.el, "pos"), om = findChildByLocalName(o.el, "outMargin");
|
|
50410
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
50843
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1119 => _1119.getAttribute, 'call', _1120 => _1120("vertRelTo")]), () => ( "PARA"))) !== "PARA") return false;
|
|
50411
50844
|
const vo = num2(pos, "vertOffset");
|
|
50412
50845
|
if (vo <= 0 || vo >= 2 ** 31) return false;
|
|
50413
50846
|
return top + vo + num2(om, "top") + contentTableHeight(o.el) + num2(om, "bottom") > lim;
|
|
@@ -50420,7 +50853,7 @@ function splitFloatTableRemainder(p, startV, lim, bodyH, styles, withText = fals
|
|
|
50420
50853
|
for (const o of m.objs) {
|
|
50421
50854
|
if (o.inline || o.tag !== "tbl" || !(o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" || o.el.getAttribute("textWrap") === "SQUARE")) continue;
|
|
50422
50855
|
const pos = findChildByLocalName(o.el, "pos");
|
|
50423
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
50856
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1121 => _1121.getAttribute, 'call', _1122 => _1122("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
50424
50857
|
const b = splitTableRows(o.el, startV + Math.max(0, num2(pos, "vertOffset")), lim, bodyH, styles, notes);
|
|
50425
50858
|
if (b !== void 0) {
|
|
50426
50859
|
best = Math.max(_nullishCoalesce(best, () => ( 0)), b);
|
|
@@ -50454,7 +50887,7 @@ function splitTableRows(tbl2, top, lim, bodyH, styles, notes) {
|
|
|
50454
50887
|
if (rows.length === 0) return void 0;
|
|
50455
50888
|
const outT = num2(om, "top");
|
|
50456
50889
|
const cap = captionOf(tbl2);
|
|
50457
|
-
const capTop = _optionalChain([cap, 'optionalAccess',
|
|
50890
|
+
const capTop = _optionalChain([cap, 'optionalAccess', _1123 => _1123.side]) === "TOP" ? cap.h + cap.gap : 0, capBottom = _optionalChain([cap, 'optionalAccess', _1124 => _1124.side]) === "BOTTOM" ? cap.h + cap.gap : 0;
|
|
50458
50891
|
let headH = 0;
|
|
50459
50892
|
if (tbl2.getAttribute("repeatHeader") === "1") {
|
|
50460
50893
|
const heads = /* @__PURE__ */ new Set();
|
|
@@ -50522,18 +50955,18 @@ function cellRowRemainder(cells, row, avail, from, record, bases, carries, style
|
|
|
50522
50955
|
const cuts = [];
|
|
50523
50956
|
for (const c of cells) {
|
|
50524
50957
|
if (c.ra !== row || c.rs !== 1 || !c.sub) continue;
|
|
50525
|
-
const off = _nullishCoalesce(from.get(c.el), () => ( 0)), base = _nullishCoalesce(_optionalChain([bases, 'optionalAccess',
|
|
50958
|
+
const off = _nullishCoalesce(from.get(c.el), () => ( 0)), base = _nullishCoalesce(_optionalChain([bases, 'optionalAccess', _1125 => _1125.get, 'call', _1126 => _1126(c.el)]), () => ( 0));
|
|
50526
50959
|
const limAbs = base + avail - c.marginB - c.marginT;
|
|
50527
50960
|
let carry = 0, carryFrom = Infinity;
|
|
50528
50961
|
let splitAt;
|
|
50529
50962
|
for (let guard = 0; guard < 16; guard++) {
|
|
50530
50963
|
const f = subFloatBottoms(c.sub).find((f2) => f2.v0 >= off && f2.lineBottom <= limAbs && f2.bottom > limAbs && f2.v0 < carryFrom);
|
|
50531
50964
|
if (!f) break;
|
|
50532
|
-
if (_optionalChain([f, 'access',
|
|
50965
|
+
if (_optionalChain([f, 'access', _1127 => _1127.rows, 'optionalAccess', _1128 => _1128.length])) {
|
|
50533
50966
|
let y = f.bottom - f.carry + f.outT, k2 = 0;
|
|
50534
50967
|
while (k2 < f.rows.length && y + f.rows[k2] <= limAbs) y += f.rows[k2++];
|
|
50535
50968
|
if (k2 === f.rows.length) break;
|
|
50536
|
-
if ((k2 > 0 || _optionalChain([f, 'access',
|
|
50969
|
+
if ((k2 > 0 || _optionalChain([f, 'access', _1129 => _1129.el, 'optionalAccess', _1130 => _1130.getAttribute, 'call', _1131 => _1131("pageBreak")]) === "CELL") && contH > 0 && f.el) {
|
|
50537
50970
|
const nested = splitTableRows(f.el, f.bottom - f.carry - base, avail - c.marginB - c.marginT, contH - c.marginT - c.marginB, styles);
|
|
50538
50971
|
const rem2 = _nullishCoalesce(nested, () => ( (k2 > 0 ? f.outT + f.rows.slice(k2).reduce((a, b) => a + b, 0) + f.outB : void 0)));
|
|
50539
50972
|
if (rem2 !== void 0) {
|
|
@@ -50579,9 +51012,9 @@ function cellRowRemainder(cells, row, avail, from, record, bases, carries, style
|
|
|
50579
51012
|
}
|
|
50580
51013
|
if (carry > 0 && cutV > carryFrom) {
|
|
50581
51014
|
nb -= carry;
|
|
50582
|
-
const m = _nullishCoalesce(_optionalChain([carries, 'optionalAccess',
|
|
51015
|
+
const m = _nullishCoalesce(_optionalChain([carries, 'optionalAccess', _1132 => _1132.get, 'call', _1133 => _1133(c.sub)]), () => ( /* @__PURE__ */ new Map()));
|
|
50583
51016
|
m.set(cutV, carry);
|
|
50584
|
-
_optionalChain([carries, 'optionalAccess',
|
|
51017
|
+
_optionalChain([carries, 'optionalAccess', _1134 => _1134.set, 'call', _1135 => _1135(c.sub, m)]);
|
|
50585
51018
|
}
|
|
50586
51019
|
cuts.push([c.el, base + lines[k][0], nb]);
|
|
50587
51020
|
rem = Math.max(rem, end + base - nb + c.marginT + c.marginB);
|
|
@@ -50590,7 +51023,7 @@ function cellRowRemainder(cells, row, avail, from, record, bases, carries, style
|
|
|
50590
51023
|
if (!(any && placed)) return void 0;
|
|
50591
51024
|
for (const [el, v, nb] of cuts) {
|
|
50592
51025
|
from.set(el, v);
|
|
50593
|
-
_optionalChain([bases, 'optionalAccess',
|
|
51026
|
+
_optionalChain([bases, 'optionalAccess', _1136 => _1136.set, 'call', _1137 => _1137(el, nb)]);
|
|
50594
51027
|
}
|
|
50595
51028
|
if (record) for (const c of cells) {
|
|
50596
51029
|
if (c.ra !== row || c.rs !== 1 || !c.sub) continue;
|
|
@@ -50625,7 +51058,7 @@ function subFloatBottoms(sub) {
|
|
|
50625
51058
|
for (const o of elements(run)) {
|
|
50626
51059
|
if (!OBJ_TAGS.has(ln(o)) || o.getAttribute("textWrap") !== "TOP_AND_BOTTOM") continue;
|
|
50627
51060
|
const pos = findChildByLocalName(o, "pos");
|
|
50628
|
-
if (_optionalChain([pos, 'optionalAccess',
|
|
51061
|
+
if (_optionalChain([pos, 'optionalAccess', _1138 => _1138.getAttribute, 'call', _1139 => _1139("treatAsChar")]) === "1" || (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1140 => _1140.getAttribute, 'call', _1141 => _1141("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
50629
51062
|
const om = findChildByLocalName(o, "outMargin"), sz = findChildByLocalName(o, "sz");
|
|
50630
51063
|
const h = (ln(o) === "tbl" ? Math.max(num2(sz, "height"), measureTableHeight(o)) : num2(sz, "height")) + captionExtra(o);
|
|
50631
51064
|
const vo = num2(pos, "vertOffset"), v0 = num2(seg, "vertpos"), carry = num2(om, "top") + h + num2(om, "bottom");
|
|
@@ -50645,11 +51078,11 @@ function subFloatBottoms(sub) {
|
|
|
50645
51078
|
}
|
|
50646
51079
|
function spaceAfterAt(sg, styles) {
|
|
50647
51080
|
if (!styles) return 0;
|
|
50648
|
-
const lsa = sg.parentNode, p = _optionalChain([lsa, 'optionalAccess',
|
|
51081
|
+
const lsa = sg.parentNode, p = _optionalChain([lsa, 'optionalAccess', _1142 => _1142.parentNode]);
|
|
50649
51082
|
if (!lsa || !p) return 0;
|
|
50650
51083
|
const segs = elements(lsa).filter((e) => ln(e) === "lineseg");
|
|
50651
51084
|
if (segs[segs.length - 1] !== sg) return 0;
|
|
50652
|
-
return _nullishCoalesce(_optionalChain([styles, 'access',
|
|
51085
|
+
return _nullishCoalesce(_optionalChain([styles, 'access', _1143 => _1143.paraGeom, 'access', _1144 => _1144.get, 'call', _1145 => _1145(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1146 => _1146.spaceAfter]), () => ( 0));
|
|
50653
51086
|
}
|
|
50654
51087
|
function rebaseSplitCells(record, carries, styles) {
|
|
50655
51088
|
for (const [sub, cuts] of record) {
|
|
@@ -50667,7 +51100,7 @@ function rebaseSplitCells(record, carries, styles) {
|
|
|
50667
51100
|
if (old[i] < c) base = Math.max(base, old[i] + num2(sg, "vertsize") + num2(sg, "spacing") + spaceAfterAt(sg, styles));
|
|
50668
51101
|
});
|
|
50669
51102
|
for (const f of floats) if (f.v0 < c && f.bottom <= c) base = Math.max(base, f.bottom);
|
|
50670
|
-
return base - (_nullishCoalesce(_optionalChain([carries, 'optionalAccess',
|
|
51103
|
+
return base - (_nullishCoalesce(_optionalChain([carries, 'optionalAccess', _1147 => _1147.get, 'call', _1148 => _1148(sub), 'optionalAccess', _1149 => _1149.get, 'call', _1150 => _1150(c)]), () => ( 0)));
|
|
50671
51104
|
});
|
|
50672
51105
|
segs.forEach((sg, i) => {
|
|
50673
51106
|
let j = -1;
|
|
@@ -50683,7 +51116,7 @@ function pageBottomReserve(p) {
|
|
|
50683
51116
|
for (const o of elements(run)) {
|
|
50684
51117
|
if (!OBJ_TAGS.has(ln(o)) || o.getAttribute("textWrap") !== "TOP_AND_BOTTOM") continue;
|
|
50685
51118
|
const pos = findChildByLocalName(o, "pos");
|
|
50686
|
-
if (_optionalChain([pos, 'optionalAccess',
|
|
51119
|
+
if (_optionalChain([pos, 'optionalAccess', _1151 => _1151.getAttribute, 'call', _1152 => _1152("treatAsChar")]) === "1" || _optionalChain([pos, 'optionalAccess', _1153 => _1153.getAttribute, 'call', _1154 => _1154("vertRelTo")]) !== "PAGE" || _optionalChain([pos, 'optionalAccess', _1155 => _1155.getAttribute, 'call', _1156 => _1156("vertAlign")]) !== "BOTTOM") continue;
|
|
50687
51120
|
const om = findChildByLocalName(o, "outMargin"), sz = findChildByLocalName(o, "sz");
|
|
50688
51121
|
const h = ln(o) === "tbl" ? Math.max(num2(sz, "height"), measureTableHeight(o)) : num2(sz, "height");
|
|
50689
51122
|
r = Math.max(r, num2(pos, "vertOffset") + num2(om, "top") + h + num2(om, "bottom"));
|
|
@@ -50812,17 +51245,17 @@ function formatHeadNumber2(n, format2) {
|
|
|
50812
51245
|
}
|
|
50813
51246
|
}
|
|
50814
51247
|
function nextParaNumber(counters, geom) {
|
|
50815
|
-
const num4 = _optionalChain([geom, 'optionalAccess',
|
|
51248
|
+
const num4 = _optionalChain([geom, 'optionalAccess', _1157 => _1157.number]);
|
|
50816
51249
|
if (!num4) return "";
|
|
50817
51250
|
const cur = _nullishCoalesce(counters.get(num4.id), () => ( []));
|
|
50818
51251
|
const head = num4.heads.get(num4.level);
|
|
50819
|
-
cur[num4.level] = (_nullishCoalesce(cur[num4.level], () => ( (_nullishCoalesce(_optionalChain([head, 'optionalAccess',
|
|
51252
|
+
cur[num4.level] = (_nullishCoalesce(cur[num4.level], () => ( (_nullishCoalesce(_optionalChain([head, 'optionalAccess', _1158 => _1158.start]), () => ( 1))) - 1))) + 1;
|
|
50820
51253
|
cur.length = num4.level + 1;
|
|
50821
51254
|
counters.set(num4.id, cur);
|
|
50822
|
-
return (_nullishCoalesce(_optionalChain([head, 'optionalAccess',
|
|
51255
|
+
return (_nullishCoalesce(_optionalChain([head, 'optionalAccess', _1159 => _1159.text]), () => ( ""))).replace(/\^(\d)?/g, (_m, d) => {
|
|
50823
51256
|
if (d === void 0) return "";
|
|
50824
51257
|
const lv = Number(d), h = num4.heads.get(lv);
|
|
50825
|
-
return formatHeadNumber2(_nullishCoalesce(_nullishCoalesce(cur[lv], () => ( _optionalChain([h, 'optionalAccess',
|
|
51258
|
+
return formatHeadNumber2(_nullishCoalesce(_nullishCoalesce(cur[lv], () => ( _optionalChain([h, 'optionalAccess', _1160 => _1160.start]))), () => ( 1)), _nullishCoalesce(_optionalChain([h, 'optionalAccess', _1161 => _1161.format]), () => ( "DIGIT")));
|
|
50826
51259
|
});
|
|
50827
51260
|
}
|
|
50828
51261
|
|
|
@@ -50886,7 +51319,7 @@ function lineBorderBox(model, styles, start, end) {
|
|
|
50886
51319
|
let top = 0, all = 0;
|
|
50887
51320
|
const include = (prId) => {
|
|
50888
51321
|
const st = prId != null ? styles.charPr.get(prId) : void 0;
|
|
50889
|
-
const f = _optionalChain([st, 'optionalAccess',
|
|
51322
|
+
const f = _optionalChain([st, 'optionalAccess', _1162 => _1162.borderFill]) != null ? styles.borderFill.get(st.borderFill) : void 0;
|
|
50890
51323
|
if (!f || !f.top && !f.bottom) return;
|
|
50891
51324
|
const width = (pt3) => empty ? 2 * Math.trunc(pt3 * 50) : Math.trunc(pt3 * 100);
|
|
50892
51325
|
const t = f.top ? width(f.top.widthPt) : 0, b = f.bottom ? width(f.bottom.widthPt) : 0;
|
|
@@ -50959,11 +51392,11 @@ function glyphWidth(ch, st, fallback = true) {
|
|
|
50959
51392
|
let h = rel !== 100 ? mulDiv(st.height, rel, 100) : st.height;
|
|
50960
51393
|
if (!space && st.script) h = mulDiv(h, 16, 25);
|
|
50961
51394
|
const ratio = L ? L.ratio : st.ratio;
|
|
50962
|
-
const spacing = space ? _nullishCoalesce(_optionalChain([st, 'access',
|
|
50963
|
-
const face1 = _nullishCoalesce(_optionalChain([L, 'optionalAccess',
|
|
51395
|
+
const spacing = space ? _nullishCoalesce(_optionalChain([st, 'access', _1163 => _1163.latin, 'optionalAccess', _1164 => _1164.spacing]), () => ( st.spacing)) : L ? L.spacing : st.spacing;
|
|
51396
|
+
const face1 = _nullishCoalesce(_optionalChain([L, 'optionalAccess', _1165 => _1165.face]), () => ( st.face));
|
|
50964
51397
|
const face0 = face1 === "Batang" ? st.before2024 ? "\uBC14\uD0D5" : "\uD55C\uCEF4\uBC14\uD0D5" : face1;
|
|
50965
51398
|
const boldFace = !space && st.bold && (L ? L.hft : st.hft) && face0 && fontHasGlyph(`${face0} Bold`, cp) ? `${face0} Bold` : void 0;
|
|
50966
|
-
const oldEm = st.halfQuote && face0 === "\uD734\uBA3C\uBA85\uC870" && (cp === 8220 || cp === 8221) ? 500 : st.halfQuote && !st.before2024 && face0 === "\uD734\uBA3C\uBA85\uC870" && (cp === 8216 || cp === 8217) ? 312 : st.before2024 && face0 && !(face0 === "\uC2E0\uBA85\uC870" && (st.halfQuote || (_optionalChain([L, 'optionalAccess',
|
|
51399
|
+
const oldEm = st.halfQuote && face0 === "\uD734\uBA3C\uBA85\uC870" && (cp === 8220 || cp === 8221) ? 500 : st.halfQuote && !st.before2024 && face0 === "\uD734\uBA3C\uBA85\uC870" && (cp === 8216 || cp === 8217) ? 312 : st.before2024 && face0 && !(face0 === "\uC2E0\uBA85\uC870" && (st.halfQuote || (_optionalChain([L, 'optionalAccess', _1166 => _1166.face]) ? L.hft : st.hft))) ? _optionalChain([BEFORE_2024_WIDTH, 'access', _1167 => _1167[face0], 'optionalAccess', _1168 => _1168[cp]]) : !st.halfQuote && face0 === "\uD734\uBA3C\uBA85\uC870" && cp === 8231 ? _optionalChain([BEFORE_2024_WIDTH, 'access', _1169 => _1169[face0], 'optionalAccess', _1170 => _1170[cp]]) : void 0;
|
|
50967
51400
|
const fc = faceClassForReflow(_nullishCoalesce(boldFace, () => ( face0)));
|
|
50968
51401
|
const fsEm = space && st.fontSpace ? fontSpaceEm(st.face) : void 0;
|
|
50969
51402
|
if (fsEm !== void 0) {
|
|
@@ -50971,7 +51404,7 @@ function glyphWidth(ch, st, fallback = true) {
|
|
|
50971
51404
|
const s = spacing ? 4 * mulDiv(Math.trunc(b / 4), spacing, 100) : 0;
|
|
50972
51405
|
return { w: b + s, sp: s };
|
|
50973
51406
|
}
|
|
50974
|
-
const bAdd = !space && st.bold && !boldFace ? syntheticBoldEm(_nullishCoalesce(_optionalChain([L, 'optionalAccess',
|
|
51407
|
+
const bAdd = !space && st.bold && !boldFace ? syntheticBoldEm(_nullishCoalesce(_optionalChain([L, 'optionalAccess', _1171 => _1171.face]), () => ( st.face)), L ? L.hft : st.hft) : 0;
|
|
50975
51408
|
if (oldEm !== void 0) {
|
|
50976
51409
|
const b0 = hancomEmWidth(oldEm + bAdd, h, ratio, 0), w0 = spacing ? hancomEmWidth(oldEm + bAdd, h, ratio, spacing) : b0;
|
|
50977
51410
|
return { w: w0, sp: w0 - b0 };
|
|
@@ -51106,12 +51539,12 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51106
51539
|
const avail = Math.max(1440, Math.floor(areaW / 4) * 4 - marginL - geom.marginRight);
|
|
51107
51540
|
const firstWidth = avail;
|
|
51108
51541
|
const bu = _nullishCoalesce(geom.bullet, () => ( (numText && geom.number ? { ch: numText, ...geom.number } : void 0)));
|
|
51109
|
-
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess',
|
|
51542
|
+
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess', _1172 => _1172.charPrId]) != null ? styles.charPr.get(bu.charPrId) : void 0), () => ( domChar));
|
|
51110
51543
|
let headW = 0;
|
|
51111
51544
|
if (bu) for (const ch of bu.ch) headW += glyphWidth(ch, bst, bu.useInstWidth !== false).w;
|
|
51112
51545
|
const bulletW = bu ? paraHeadAdvance(bu, height, headW) : 0;
|
|
51113
|
-
const contBullet = _optionalChain([bu, 'optionalAccess',
|
|
51114
|
-
const squeeze = _optionalChain([p, 'access',
|
|
51546
|
+
const contBullet = _optionalChain([bu, 'optionalAccess', _1173 => _1173.autoIndent]) ? bulletW : 0;
|
|
51547
|
+
const squeeze = _optionalChain([p, 'access', _1174 => _1174.parentNode, 'optionalAccess', _1175 => _1175.getAttribute, 'optionalCall', _1176 => _1176("lineWrap")]) === "SQUEEZE" || !!geom.squeeze;
|
|
51115
51548
|
const NO_WRAP = 1e9;
|
|
51116
51549
|
const intentPos = geom.marginIntent >= avail ? 0 : Math.max(0, geom.marginIntent);
|
|
51117
51550
|
const firstWrapWidth = squeeze ? NO_WRAP : Math.max(500, avail - (styles.before2024 && bulletW > 0 ? Math.max(intentPos, bulletW) : intentPos + bulletW));
|
|
@@ -51134,7 +51567,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51134
51567
|
let cellFloatBottom = 0, cellTextBelow = 0;
|
|
51135
51568
|
const spacesOnly = spacesHost(p);
|
|
51136
51569
|
const zoneStart = zones.length;
|
|
51137
|
-
const OVP = bodyFlow && m.objs.length > 0 && !m.chars.some((c) => c.ch !== "" && c.ch.trim() !== "") && m.objs.every((o) => !o.inline && o.tag === "pic" && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && _optionalChain([findChildByLocalName, 'call',
|
|
51570
|
+
const OVP = bodyFlow && m.objs.length > 0 && !m.chars.some((c) => c.ch !== "" && c.ch.trim() !== "") && m.objs.every((o) => !o.inline && o.tag === "pic" && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && _optionalChain([findChildByLocalName, 'call', _1177 => _1177(o.el, "pos"), 'optionalAccess', _1178 => _1178.getAttribute, 'call', _1179 => _1179("allowOverlap")]) === "1");
|
|
51138
51571
|
const spacesText = bodyFlow && (spacesOnly || !!OVP || bulletEmptyHost(p, geom));
|
|
51139
51572
|
const textish = m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "") || m.objs.some((o) => o.inline) || spacesText;
|
|
51140
51573
|
for (const o of m.objs) {
|
|
@@ -51144,11 +51577,11 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51144
51577
|
const outT = num3(om, "top"), outB = num3(om, "bottom");
|
|
51145
51578
|
const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
|
|
51146
51579
|
if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
|
|
51147
|
-
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51148
|
-
const paperBand = wrapAttr === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51580
|
+
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1180 => _1180.getAttribute, 'call', _1181 => _1181("vertRelTo")]), () => ( "PARA"));
|
|
51581
|
+
const paperBand = wrapAttr === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1182 => _1182.getAttribute, 'call', _1183 => _1183("vertAlign")]), () => ( "TOP"))) === "TOP";
|
|
51149
51582
|
if (vertRel === "PAPER" && bodyFlow && (wrapAttr !== "TOP_AND_BOTTOM" || paperBand)) {
|
|
51150
51583
|
const [oxL, oyT, paperW] = paperOrigin(p);
|
|
51151
|
-
const hRel2 = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51584
|
+
const hRel2 = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1184 => _1184.getAttribute, 'call', _1185 => _1185("horzRelTo")]), () => ( "COLUMN")), hAlign2 = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1186 => _1186.getAttribute, 'call', _1187 => _1187("horzAlign")]), () => ( "LEFT"));
|
|
51152
51585
|
const ho2 = num3(pos, "horzOffset"), base2 = hRel2 === "PAPER" ? -oxL : hRel2 === "PARA" ? marginL : 0, span3 = hRel2 === "PAPER" ? paperW : hRel2 === "PARA" ? avail : areaW;
|
|
51153
51586
|
const x02 = base2 + (hAlign2 === "RIGHT" ? span3 - ho2 - o.width : hAlign2 === "CENTER" ? (span3 - o.width) / 2 + ho2 : ho2);
|
|
51154
51587
|
const vo0 = Math.max(0, num3(pos, "vertOffset")), top2 = vertRel === "PAPER" ? vo0 - oyT : vo0;
|
|
@@ -51162,7 +51595,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51162
51595
|
const voRaw = num3(pos, "vertOffset"), voSigned = Math.max(0, voRaw >= 2 ** 31 ? voRaw - 2 ** 32 : voRaw);
|
|
51163
51596
|
const effH = effHOf(o);
|
|
51164
51597
|
if (wrapAttr === "TOP_AND_BOTTOM") {
|
|
51165
|
-
const hR = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51598
|
+
const hR = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1188 => _1188.getAttribute, 'call', _1189 => _1189("horzRelTo")]), () => ( "COLUMN")), hA = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1190 => _1190.getAttribute, 'call', _1191 => _1191("horzAlign")]), () => ( "LEFT"));
|
|
51166
51599
|
const hoff = num3(pos, "horzOffset"), b0 = hR === "PARA" ? marginL : 0, sp = hR === "PARA" ? avail : areaW;
|
|
51167
51600
|
const xL = b0 + (hA === "RIGHT" ? sp - hoff - o.width : hA === "CENTER" ? (sp - o.width) / 2 + hoff : hoff);
|
|
51168
51601
|
if ((hR === "COLUMN" || hR === "PARA") && (xL >= areaW || xL + o.width <= 0)) continue;
|
|
@@ -51179,7 +51612,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51179
51612
|
else cellFloatBottom = Math.max(cellFloatBottom, voSigned + outT + effH + outB);
|
|
51180
51613
|
continue;
|
|
51181
51614
|
}
|
|
51182
|
-
const hRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51615
|
+
const hRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1192 => _1192.getAttribute, 'call', _1193 => _1193("horzRelTo")]), () => ( "COLUMN")), hAlign = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1194 => _1194.getAttribute, 'call', _1195 => _1195("horzAlign")]), () => ( "LEFT"));
|
|
51183
51616
|
const ho = num3(pos, "horzOffset"), base = hRel === "PARA" ? marginL : 0, span2 = hRel === "PARA" ? avail : areaW;
|
|
51184
51617
|
const x0 = base + (hAlign === "RIGHT" ? span2 - ho - o.width : hAlign === "CENTER" ? (span2 - o.width) / 2 + ho : ho);
|
|
51185
51618
|
const top = startV - (bodyFlow && vertRel === "PARA" && wrapAttr === "SQUARE" ? geom.spaceBefore : 0) + vo;
|
|
@@ -51189,7 +51622,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51189
51622
|
zones.push({ top: nextPage ? -1 : top, bottom: nextPage ? -1 : top + effH + outB, left: xs - omLx, right: xs + o.width + omRx, flow: _nullishCoalesce(o.el.getAttribute("textFlow"), () => ( "BOTH_SIDES")), anchor: nextPage ? void 0 : o.index, carry: outT + effH + outB, ...nextPage ? { nextPage } : {} });
|
|
51190
51623
|
}
|
|
51191
51624
|
const hasText = textish;
|
|
51192
|
-
const nFloat = m.objs.filter((o) => !o.inline && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
51625
|
+
const nFloat = m.objs.filter((o) => !o.inline && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1196 => _1196(o.el, "pos"), 'optionalAccess', _1197 => _1197.getAttribute, 'call', _1198 => _1198("vertRelTo")]), () => ( "PARA"))) === "PARA").length;
|
|
51193
51626
|
const areaTop = bodyFlow ? startV - (_nullishCoalesce(geom.spaceBefore, () => ( 0))) : startV;
|
|
51194
51627
|
let floatFloor = 0;
|
|
51195
51628
|
if (!hasText && nFloat < 2) {
|
|
@@ -51316,25 +51749,25 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51316
51749
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
51317
51750
|
const li = lineOf(o.index);
|
|
51318
51751
|
const h = num3(om, "top") + effHOf(o) + num3(om, "bottom");
|
|
51319
|
-
if (o.tag === "tbl" && li > 0 && o.omL + o.width + o.omR > (_nullishCoalesce(_optionalChain([lineWidth, 'optionalCall',
|
|
51752
|
+
if (o.tag === "tbl" && li > 0 && o.omL + o.width + o.omR > (_nullishCoalesce(_optionalChain([lineWidth, 'optionalCall', _1199 => _1199(li - 1)]), () => ( (li === 1 ? firstWrapWidth : contWidth)))) && /^[\u2060\ufdd0]+$/.test(text.slice(wrap.starts[li - 1], wrap.starts[li]))) collisionHeights[li - 1] = Math.max(_nullishCoalesce(collisionHeights[li - 1], () => ( 0)), h);
|
|
51320
51753
|
lineObjH[li] = Math.max(lineObjH[li], h);
|
|
51321
|
-
if (_optionalChain([findChildByLocalName, 'call',
|
|
51754
|
+
if (_optionalChain([findChildByLocalName, 'call', _1200 => _1200(o.el, "pos"), 'optionalAccess', _1201 => _1201.getAttribute, 'call', _1202 => _1202("affectLSpacing")]) === "1") lineObjLs[li] = true;
|
|
51322
51755
|
const bl = o.tag === "equation" ? Number(o.el.getAttribute("baseLine")) : NaN;
|
|
51323
51756
|
lineObjAsc[li] = Math.max(lineObjAsc[li], Math.round(h * (Number.isFinite(bl) ? bl / 100 : BASELINE_RATIO)));
|
|
51324
51757
|
}
|
|
51325
51758
|
const lsa = doc.createElement("hp:linesegarray");
|
|
51326
51759
|
const subList = p.parentNode;
|
|
51327
|
-
const verticalCenter = _optionalChain([subList, 'optionalAccess',
|
|
51760
|
+
const verticalCenter = _optionalChain([subList, 'optionalAccess', _1203 => _1203.getAttribute, 'optionalCall', _1204 => _1204("vertAlign")]) === "CENTER" && ["VERTICAL", "VERTICALALL"].includes(_nullishCoalesce(subList.getAttribute("textDirection"), () => ( "")));
|
|
51328
51761
|
let v = textStartV;
|
|
51329
51762
|
let firstAcc = 0;
|
|
51330
51763
|
const textposOf = wrap.starts.map((startReal, li) => li === 0 ? 0 : startReal < realIdx.length ? realIdx[startReal] : realIdx.length ? m.chars.length : 0);
|
|
51331
|
-
const heightOf = (prId) => (prId != null ? _optionalChain([styles, 'access',
|
|
51764
|
+
const heightOf = (prId) => (prId != null ? _optionalChain([styles, 'access', _1205 => _1205.charPr, 'access', _1206 => _1206.get, 'call', _1207 => _1207(prId), 'optionalAccess', _1208 => _1208.height]) : void 0) || 0;
|
|
51332
51765
|
const lineTextH = (li) => {
|
|
51333
51766
|
const s = textposOf[li], last = li === wrap.starts.length - 1, e = last ? m.chars.length : textposOf[li + 1];
|
|
51334
51767
|
let h = 0;
|
|
51335
51768
|
for (let k = s; k < e; k++) h = Math.max(h, heightOf(m.chars[k].prId));
|
|
51336
51769
|
for (const r of m.runs) if (r.at >= s && (last ? r.at <= e : r.at < e)) h = Math.max(h, heightOf(r.prId));
|
|
51337
|
-
if (li === 0 && _optionalChain([bu, 'optionalAccess',
|
|
51770
|
+
if (li === 0 && _optionalChain([bu, 'optionalAccess', _1209 => _1209.charPrId]) != null) h = Math.max(h, heightOf(bu.charPrId));
|
|
51338
51771
|
return h || height;
|
|
51339
51772
|
};
|
|
51340
51773
|
const fontLineOf = (li) => {
|
|
@@ -51371,7 +51804,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51371
51804
|
}
|
|
51372
51805
|
return m.objs.some((o) => o.inline && o.tag === "equation" && lineOf(o.index) === li);
|
|
51373
51806
|
})();
|
|
51374
|
-
const endH = li === wrap.starts.length - 1 && lineObjH[li] > 0 && lineObjH[li] < textH && !m.chars.slice(textposOf[li]).some((c) => c.ch && c.ch.trim() !== "") && m.objs.some((o) => o.inline && o.tag === "tbl" && lineOf(o.index) === li) ? heightOf(_nullishCoalesce(_optionalChain([m, 'access',
|
|
51807
|
+
const endH = li === wrap.starts.length - 1 && lineObjH[li] > 0 && lineObjH[li] < textH && !m.chars.slice(textposOf[li]).some((c) => c.ch && c.ch.trim() !== "") && m.objs.some((o) => o.inline && o.tag === "tbl" && lineOf(o.index) === li) ? heightOf(_nullishCoalesce(_optionalChain([m, 'access', _1210 => _1210.runs, 'access', _1211 => _1211[m.runs.length - 1], 'optionalAccess', _1212 => _1212.prId]), () => ( null))) : -1;
|
|
51375
51808
|
const lineH = objOnly ? lineObjH[li] : endH >= 0 ? Math.max(lineObjH[li], endH) : Math.max(textH, lineObjH[li]);
|
|
51376
51809
|
const spBase = lineObjLs[li] || geom.lineSpacingType === "FIXED" ? lineH : textH;
|
|
51377
51810
|
const spacing = pitchFor(spBase, geom) - spBase;
|
|
@@ -51385,7 +51818,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51385
51818
|
}
|
|
51386
51819
|
const vertpos = v;
|
|
51387
51820
|
const nextStart = textposOf[li + 1], nextChar = m.chars[nextStart];
|
|
51388
|
-
const boundaryH = !m.objs.length && !geom.fontLineHeight && _optionalChain([nextChar, 'optionalAccess',
|
|
51821
|
+
const boundaryH = !m.objs.length && !geom.fontLineHeight && _optionalChain([nextChar, 'optionalAccess', _1213 => _1213.ch, 'access', _1214 => _1214.trim, 'call', _1215 => _1215()]) && m.runs.some((r) => r.at === nextStart && r.prId === nextChar.prId) ? heightOf(nextChar.prId) : 0;
|
|
51389
51822
|
const occupiedH = Math.max(lineH, _nullishCoalesce(collisionHeights[li], () => ( 0)), boundaryH);
|
|
51390
51823
|
v += lineH + spacing;
|
|
51391
51824
|
const isFirst = li === 0;
|
|
@@ -51397,7 +51830,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51397
51830
|
seg.setAttribute("baseline", String(geom.vertAlign === "TOP" ? 0 : geom.vertAlign === "CENTER" || verticalCenter && (!geom.vertAlign || geom.vertAlign === "BASELINE") ? Math.floor(lineH / 2) : geom.vertAlign === "BOTTOM" ? lineH : endH >= 0 ? Math.max(Math.round(endH * BASELINE_RATIO), lineObjAsc[li]) : Math.max(fl ? fl[1] : Math.round(textH0 * BASELINE_RATIO), boxTop > textH0 ? Math.round(boxTop * BASELINE_RATIO) : 0, lineObjAsc[li])));
|
|
51398
51831
|
seg.setAttribute("spacing", String(spacing));
|
|
51399
51832
|
let box = boxAt(li);
|
|
51400
|
-
const fit = wrap.starts.length === 1 && lineObjH[li] === 0 ? _optionalChain([lineParts, 'access',
|
|
51833
|
+
const fit = wrap.starts.length === 1 && lineObjH[li] === 0 ? _optionalChain([lineParts, 'access', _1216 => _1216[li], 'optionalAccess', _1217 => _1217.filter, 'call', _1218 => _1218(([a, b]) => b - a >= 1440)]) : void 0;
|
|
51401
51834
|
const parts = fit && fit.length > 1 && natW <= fit[0][1] - fit[0][0] - Math.max(0, geom.marginIntent) ? fit : void 0;
|
|
51402
51835
|
if (parts) box = [parts[0][0], parts[0][1] - parts[0][0]];
|
|
51403
51836
|
seg.setAttribute("horzpos", String(box ? box[0] : isFirst ? marginL : contHorz));
|
|
@@ -51411,7 +51844,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51411
51844
|
{ text, widths, spacings, slots: realIdx, start: wrap.starts[li], end: _nullishCoalesce(wrap.starts[li + 1], () => ( text.length)) }
|
|
51412
51845
|
)) continue;
|
|
51413
51846
|
lsa.appendChild(seg);
|
|
51414
|
-
for (const [a, b] of _nullishCoalesce(_optionalChain([parts, 'optionalAccess',
|
|
51847
|
+
for (const [a, b] of _nullishCoalesce(_optionalChain([parts, 'optionalAccess', _1219 => _1219.slice, 'call', _1220 => _1220(1)]), () => ( []))) {
|
|
51415
51848
|
const more = seg.cloneNode(false);
|
|
51416
51849
|
more.setAttribute("textpos", String(m.chars.length + 1));
|
|
51417
51850
|
more.setAttribute("horzpos", String(a));
|
|
@@ -51430,9 +51863,9 @@ function paperOrigin(p) {
|
|
|
51430
51863
|
const d = p.ownerDocument;
|
|
51431
51864
|
const hit = originMemo.get(d);
|
|
51432
51865
|
if (hit) return hit;
|
|
51433
|
-
const pagePr = _nullishCoalesce(_optionalChain([p, 'access',
|
|
51866
|
+
const pagePr = _nullishCoalesce(_optionalChain([p, 'access', _1221 => _1221.ownerDocument, 'optionalAccess', _1222 => _1222.getElementsByTagName, 'call', _1223 => _1223("hp:pagePr"), 'access', _1224 => _1224[0]]), () => ( null));
|
|
51434
51867
|
const mg = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
51435
|
-
const tb = _optionalChain([pagePr, 'optionalAccess',
|
|
51868
|
+
const tb = _optionalChain([pagePr, 'optionalAccess', _1225 => _1225.getAttribute, 'call', _1226 => _1226("gutterType")]) === "TOP_BOTTOM", gut = num3(mg, "gutter");
|
|
51436
51869
|
const o = [num3(mg, "left", 8504) + (tb ? 0 : gut), num3(mg, "top", 5668) + num3(mg, "header") + (tb ? gut : 0), num3(pagePr, "width", 59528)];
|
|
51437
51870
|
originMemo.set(d, o);
|
|
51438
51871
|
return o;
|
|
@@ -51449,7 +51882,7 @@ function pageTopBand(p) {
|
|
|
51449
51882
|
for (const o of elements2(run)) {
|
|
51450
51883
|
if (!OBJ_TAGS.has(ln2(o)) || o.getAttribute("textWrap") !== "TOP_AND_BOTTOM") continue;
|
|
51451
51884
|
const pos = findChildByLocalName(o, "pos");
|
|
51452
|
-
if (_optionalChain([pos, 'optionalAccess',
|
|
51885
|
+
if (_optionalChain([pos, 'optionalAccess', _1227 => _1227.getAttribute, 'call', _1228 => _1228("treatAsChar")]) === "1" || _optionalChain([pos, 'optionalAccess', _1229 => _1229.getAttribute, 'call', _1230 => _1230("vertRelTo")]) !== "PAGE" || (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1231 => _1231.getAttribute, 'call', _1232 => _1232("vertAlign")]), () => ( "TOP"))) !== "TOP") continue;
|
|
51453
51886
|
const om = findChildByLocalName(o, "outMargin"), sz = findChildByLocalName(o, "sz");
|
|
51454
51887
|
const h = ln2(o) === "tbl" ? Math.max(num3(sz, "height"), measureTableHeight(o)) : num3(sz, "height");
|
|
51455
51888
|
const vo = Math.max(0, num3(pos, "vertOffset"));
|
|
@@ -51505,7 +51938,7 @@ function footNoteHeights(p, ownOnly = false) {
|
|
|
51505
51938
|
let a = fn.parentNode, inSplit = false;
|
|
51506
51939
|
while (a && a !== p) {
|
|
51507
51940
|
const e = a;
|
|
51508
|
-
if (ln2(e) === "tbl" && (e.getAttribute("pageBreak") === "CELL" || e.getAttribute("pageBreak") === "TABLE") && _optionalChain([findChildByLocalName, 'call',
|
|
51941
|
+
if (ln2(e) === "tbl" && (e.getAttribute("pageBreak") === "CELL" || e.getAttribute("pageBreak") === "TABLE") && _optionalChain([findChildByLocalName, 'call', _1233 => _1233(e, "pos"), 'optionalAccess', _1234 => _1234.getAttribute, 'call', _1235 => _1235("treatAsChar")]) !== "1") inSplit = true;
|
|
51509
51942
|
a = a.parentNode;
|
|
51510
51943
|
}
|
|
51511
51944
|
if (inSplit) continue;
|
|
@@ -51534,7 +51967,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51534
51967
|
let prevPlaced;
|
|
51535
51968
|
const bodyFlow = areaW === counter.bodyW && bodyH > 0;
|
|
51536
51969
|
const vis = bodyH > 0 ? findFirst(container, "visibility") : null;
|
|
51537
|
-
const hideFirstEmpty = _optionalChain([vis, 'optionalAccess',
|
|
51970
|
+
const hideFirstEmpty = _optionalChain([vis, 'optionalAccess', _1236 => _1236.getAttribute, 'call', _1237 => _1237("hideFirstEmptyLine")]) === "1";
|
|
51538
51971
|
let hidPrev = 0;
|
|
51539
51972
|
const cellW = areaW;
|
|
51540
51973
|
let cellCols = 1, cellCol = 0;
|
|
@@ -51559,7 +51992,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51559
51992
|
reflowSubListsIn(p, doc, styles, mode, counter, reflowBlockFlow, bodyFlow ? areaW : void 0);
|
|
51560
51993
|
const g3 = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
51561
51994
|
const cursorBefore = cursorV;
|
|
51562
|
-
let startV = Math.max(cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51995
|
+
let startV = Math.max(cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1238 => _1238.spaceBefore]), () => ( 0))), floatFloor);
|
|
51563
51996
|
floatFloor = 0;
|
|
51564
51997
|
if (bodyH > 0) {
|
|
51565
51998
|
const [top, bot] = pageTopBand(p);
|
|
@@ -51585,13 +52018,13 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51585
52018
|
const bottom = cachedParagraphBottom(lsa, bodyFlow);
|
|
51586
52019
|
if (Number.isFinite(bottom)) {
|
|
51587
52020
|
cursorV = bottom;
|
|
51588
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
52021
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1239 => _1239.spaceAfter]), () => ( 0));
|
|
51589
52022
|
}
|
|
51590
52023
|
}
|
|
51591
52024
|
continue;
|
|
51592
52025
|
}
|
|
51593
52026
|
const paraH = res.paraBottom - startV;
|
|
51594
|
-
const explicitBreak = bodyH > 0 && startV > 0 && (p.getAttribute("pageBreak") === "1" || p.getAttribute("columnBreak") === "1" || !!_optionalChain([g3, 'optionalAccess',
|
|
52027
|
+
const explicitBreak = bodyH > 0 && startV > 0 && (p.getAttribute("pageBreak") === "1" || p.getAttribute("columnBreak") === "1" || !!_optionalChain([g3, 'optionalAccess', _1240 => _1240.pageBreakBefore]));
|
|
51595
52028
|
const lines = bodyH > 0 ? elements2(_nullishCoalesce(findChildByLocalName(p, "linesegarray"), () => ( p))).filter((e) => ln2(e) === "lineseg") : [];
|
|
51596
52029
|
const reserve = bodyH > 0 ? pageBottomReserve(p) : 0;
|
|
51597
52030
|
const fns = bodyH > 0 ? footNoteHeights(p) : [];
|
|
@@ -51626,9 +52059,9 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51626
52059
|
let cut = -1;
|
|
51627
52060
|
if (!explicitBreak && !firstOver && lines.length > 1) {
|
|
51628
52061
|
cut = lines.findIndex((seg, i) => i > 0 && lineBottom(seg) > limAt(i) && num3(seg, "vertsize") <= bodyH);
|
|
51629
|
-
if (cut > 0 && _optionalChain([g3, 'optionalAccess',
|
|
52062
|
+
if (cut > 0 && _optionalChain([g3, 'optionalAccess', _1241 => _1241.widowOrphan]) && lines.length >= 3 && cut === lines.length - 1) cut--;
|
|
51630
52063
|
}
|
|
51631
|
-
const orphan = cut === 1 && !!_optionalChain([g3, 'optionalAccess',
|
|
52064
|
+
const orphan = cut === 1 && !!_optionalChain([g3, 'optionalAccess', _1242 => _1242.widowOrphan]) || cut > 0 && !!_optionalChain([g3, 'optionalAccess', _1243 => _1243.keepLines]);
|
|
51632
52065
|
if (cut > 0 && !orphan) {
|
|
51633
52066
|
for (let i = cut; i < lines.length; i++) {
|
|
51634
52067
|
const seg = lines[i];
|
|
@@ -51650,7 +52083,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51650
52083
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
51651
52084
|
if (lsa) p.removeChild(lsa);
|
|
51652
52085
|
const zb = zones.length;
|
|
51653
|
-
const sb0 = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
52086
|
+
const sb0 = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1244 => _1244.spaceBefore]), () => ( 0));
|
|
51654
52087
|
let moveRes = reflowPara(p, doc, styles, areaW, sb0, mode, zones, new Map([...numsBefore].map(([k, v]) => [k, v.slice()])), true, bodyH);
|
|
51655
52088
|
const lsaM = findChildByLocalName(p, "linesegarray"), sM = lsaM ? elements2(lsaM).find((e) => ln2(e) === "lineseg") : void 0;
|
|
51656
52089
|
const vM = sM ? num3(sM, "vertpos") : sb0;
|
|
@@ -51670,7 +52103,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51670
52103
|
}
|
|
51671
52104
|
}
|
|
51672
52105
|
} else {
|
|
51673
|
-
const top = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
52106
|
+
const top = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1245 => _1245.spaceBefore]), () => ( 0));
|
|
51674
52107
|
shiftParaVert(p, top - startV);
|
|
51675
52108
|
cursorV = paraH + top;
|
|
51676
52109
|
if (bodyH > 0 && (top + paraH > bodyH || squareTableOver(p, top, bodyH))) {
|
|
@@ -51682,7 +52115,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51682
52115
|
splitPage = true;
|
|
51683
52116
|
}
|
|
51684
52117
|
}
|
|
51685
|
-
if (_optionalChain([prevPlaced, 'optionalAccess',
|
|
52118
|
+
if (_optionalChain([prevPlaced, 'optionalAccess', _1246 => _1246.keepWithNext]) && prevPlaced.startV > prevPlaced.top) {
|
|
51686
52119
|
shiftParaVert(prevPlaced.p, prevPlaced.top - prevPlaced.startV);
|
|
51687
52120
|
const base = prevPlaced.top + prevPlaced.h + prevPlaced.spaceAfter;
|
|
51688
52121
|
shiftParaVert(p, base);
|
|
@@ -51692,12 +52125,12 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51692
52125
|
} else {
|
|
51693
52126
|
cursorV = (res.floatFloor > 0 && off === 0 ? res.textBottom : res.paraBottom) + off;
|
|
51694
52127
|
if (res.floatFloor > 0 && off === 0) floatFloor = res.floatFloor;
|
|
51695
|
-
const split = bodyH > 0 && off === 0 && (res.paraBottom > lim || squareTableOver(p, startV, lim)) ? splitFloatTableRemainder(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
52128
|
+
const split = bodyH > 0 && off === 0 && (res.paraBottom > lim || squareTableOver(p, startV, lim)) ? splitFloatTableRemainder(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1247 => _1247.spaceBefore]), () => ( 0))), limOwn, bodyH, styles, false, { n0: pageNotes + fnsOwn.length, s0: pageFoot + ownSum, area: footArea }) : void 0;
|
|
51696
52129
|
const tEl = split !== void 0 && splitWhole ? m0Objs(p) : void 0;
|
|
51697
52130
|
const tVo = tEl ? num3(findChildByLocalName(tEl, "pos"), "vertOffset") : 0;
|
|
51698
52131
|
const tOm = tEl ? findChildByLocalName(tEl, "outMargin") : null;
|
|
51699
52132
|
if (tEl && tVo > 0 && tVo < 2 ** 31 && num3(tOm, "top") + measureTableHeight(tEl) + num3(tOm, "bottom") <= bodyH) {
|
|
51700
|
-
const tTop = startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
52133
|
+
const tTop = startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1248 => _1248.spaceBefore]), () => ( 0))) + tVo;
|
|
51701
52134
|
zones.push({ top: tTop, bottom: Math.max(bodyH + 1, tTop + 1), left: -1e9, right: 1e9, flow: "BOTH_SIDES", carry: split });
|
|
51702
52135
|
floatFloor = 0;
|
|
51703
52136
|
cursorV = res.textBottom;
|
|
@@ -51731,9 +52164,9 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51731
52164
|
zones.length = 0;
|
|
51732
52165
|
splitPage = true;
|
|
51733
52166
|
}
|
|
51734
|
-
} else if (bodyH > 0 && off === 0 && bandTableOver(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
52167
|
+
} else if (bodyH > 0 && off === 0 && bandTableOver(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1249 => _1249.spaceBefore]), () => ( 0))), lim)) {
|
|
51735
52168
|
const BU = BUH;
|
|
51736
|
-
const split4 = splitFloatTableRemainder(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
52169
|
+
const split4 = splitFloatTableRemainder(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1250 => _1250.spaceBefore]), () => ( 0))), BU ? limOwn : lim, bodyH, styles, true, BU ? { n0: pageNotes + fnsOwn.length, s0: pageFoot + ownSum, area: footArea } : void 0);
|
|
51737
52170
|
if (split4 !== void 0) {
|
|
51738
52171
|
cursorV = 0;
|
|
51739
52172
|
floatFloor = split4;
|
|
@@ -51751,7 +52184,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51751
52184
|
}
|
|
51752
52185
|
const keepCursor = hidden && !explicitBreak;
|
|
51753
52186
|
hidPrev = hidden ? hidPrev + 1 : 0;
|
|
51754
|
-
prevPlaced = off === 0 && !(explicitBreak || firstOver || orphan) ? { p, startV, top: _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
52187
|
+
prevPlaced = off === 0 && !(explicitBreak || firstOver || orphan) ? { p, startV, top: _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1251 => _1251.spaceBefore]), () => ( 0)), h: paraH, spaceAfter: res.spaceAfter, keepWithNext: !!_optionalChain([g3, 'optionalAccess', _1252 => _1252.keepWithNext]) } : void 0;
|
|
51755
52188
|
const moved = explicitBreak || firstOver || orphan || off !== 0;
|
|
51756
52189
|
pageLimit = reserve > 0 ? bodyH - reserve : moved ? bodyH : Math.min(pageLimit, reserve > 0 ? bodyH - reserve : pageLimit);
|
|
51757
52190
|
if (moved && refs.length && cut > 0 && !orphan && !explicitBreak && !firstOver) {
|
|
@@ -51851,7 +52284,7 @@ function flowEndNotes(root, bodyH) {
|
|
|
51851
52284
|
if (done.has(f) || raw0 < f.bottom) continue;
|
|
51852
52285
|
done.add(f);
|
|
51853
52286
|
if (!(base + f.lineBottom - shift <= bodyH && base + f.bottom - shift > bodyH)) continue;
|
|
51854
|
-
if (_optionalChain([f, 'access',
|
|
52287
|
+
if (_optionalChain([f, 'access', _1253 => _1253.rows, 'optionalAccess', _1254 => _1254.length]) && _optionalChain([f, 'access', _1255 => _1255.el, 'optionalAccess', _1256 => _1256.getAttribute, 'call', _1257 => _1257("pageBreak")]) === "CELL") {
|
|
51855
52288
|
let yy = base + f.bottom - f.carry - shift + f.outT, k = 0;
|
|
51856
52289
|
while (k < f.rows.length && yy + f.rows[k] <= bodyH) yy += f.rows[k++];
|
|
51857
52290
|
if (k === f.rows.length) continue;
|
|
@@ -51918,7 +52351,7 @@ function pageStories(root, masters, paraPages, pageCount, pageBase, geom) {
|
|
|
51918
52351
|
const declarations = [];
|
|
51919
52352
|
const hidden = /* @__PURE__ */ new Map();
|
|
51920
52353
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
51921
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
52354
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1258 => _1258.get, 'call', _1259 => _1259(p), 'optionalAccess', _1260 => _1260[0]]), () => ( 0));
|
|
51922
52355
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
51923
52356
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
51924
52357
|
for (const el of elements(ctrl)) {
|
|
@@ -51938,7 +52371,7 @@ function pageStories(root, masters, paraPages, pageCount, pageBase, geom) {
|
|
|
51938
52371
|
const out = [];
|
|
51939
52372
|
for (let page = 0; page < pageCount; page++) {
|
|
51940
52373
|
const n = pageBase + page + 1;
|
|
51941
|
-
const hides = (name) => _optionalChain([hidden, 'access',
|
|
52374
|
+
const hides = (name) => _optionalChain([hidden, 'access', _1261 => _1261.get, 'call', _1262 => _1262(page), 'optionalAccess', _1263 => _1263.has, 'call', _1264 => _1264(name)]) === true || page === 0 && num2(visibility, `hideFirst${name}`) !== 0;
|
|
51942
52375
|
if (!hides("MasterPage")) {
|
|
51943
52376
|
const matching = masters.filter((m) => m.getAttribute("type") === (n % 2 ? "ODD" : "EVEN"));
|
|
51944
52377
|
const both = masters.filter((m) => (m.getAttribute("type") || "BOTH") === "BOTH");
|
|
@@ -51967,7 +52400,7 @@ function footNoteStories(root, paraPages, geom) {
|
|
|
51967
52400
|
const above = num2(sp, "aboveLine", 850), below = num2(sp, "belowLine", 567), between = num2(sp, "betweenNotes", 283);
|
|
51968
52401
|
const byPage = /* @__PURE__ */ new Map();
|
|
51969
52402
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
51970
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
52403
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1265 => _1265.get, 'call', _1266 => _1266(p), 'optionalAccess', _1267 => _1267[0]]), () => ( 0));
|
|
51971
52404
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
51972
52405
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
51973
52406
|
const fn = findChildByLocalName(ctrl, "footNote");
|
|
@@ -51985,12 +52418,12 @@ function footNoteStories(root, paraPages, geom) {
|
|
|
51985
52418
|
}
|
|
51986
52419
|
}
|
|
51987
52420
|
const stories = [], rules = [];
|
|
51988
|
-
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
51989
|
-
const lineType = _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52421
|
+
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1268 => _1268.getAttribute, 'call', _1269 => _1269("width")]), () => ( "0.12"))) || 0.12;
|
|
52422
|
+
const lineType = _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1270 => _1270.getAttribute, 'call', _1271 => _1271("type")]), () => ( "SOLID"));
|
|
51990
52423
|
for (const [page, notes] of byPage) {
|
|
51991
52424
|
const area = above + below + notes.reduce((a, n) => a + n.h, 0) + between * (notes.length - 1);
|
|
51992
52425
|
const top = geom.MT + geom.BODY_H - area;
|
|
51993
|
-
if (lineType !== "NONE") rules.push({ page, x: geom.ML, y: top + above, length: lenAttr > 0 ? lenAttr : 14173, widthMm, color: _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52426
|
+
if (lineType !== "NONE") rules.push({ page, x: geom.ML, y: top + above, length: lenAttr > 0 ? lenAttr : 14173, widthMm, color: _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1272 => _1272.getAttribute, 'call', _1273 => _1273("color")]), () => ( "#000000")) });
|
|
51994
52427
|
let y = top + above + below;
|
|
51995
52428
|
for (const n of notes) {
|
|
51996
52429
|
stories.push({ sub: n.sub, page, x: geom.ML, y, width: geom.BODY_W });
|
|
@@ -52026,8 +52459,8 @@ function endNoteLayout(root, paraPages, geom) {
|
|
|
52026
52459
|
let col = nCol > 1 ? Math.min(nCol - 1, Math.max(0, Math.round(num2(last.seg, "horzpos") / (colW + gap)))) : 0;
|
|
52027
52460
|
let y = num2(last.seg, "vertpos") + num2(last.seg, "vertsize") + above;
|
|
52028
52461
|
const rules = [];
|
|
52029
|
-
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52030
|
-
if ((_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52462
|
+
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1274 => _1274.getAttribute, 'call', _1275 => _1275("width")]), () => ( "0.12"))) || 0.12;
|
|
52463
|
+
if ((_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1276 => _1276.getAttribute, 'call', _1277 => _1277("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', _1278 => _1278.getAttribute, 'call', _1279 => _1279("color")]), () => ( "#000000")) });
|
|
52031
52464
|
y += below;
|
|
52032
52465
|
const next = () => {
|
|
52033
52466
|
if (++col >= nCol) {
|
|
@@ -52123,8 +52556,12 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52123
52556
|
return st.length >= 2 && st.reduce((a, f) => a + f.h, 0) > h;
|
|
52124
52557
|
});
|
|
52125
52558
|
if (slack > 0 && ty + rowY[nRows] > pageBottom && ty + rowY[nRows] <= pageBottom + slack && cells.some((c) => cellLineBoxes(c).some((b) => b.part > 0))) slack = 0;
|
|
52559
|
+
if (slack > 0 && ty + rowY[nRows] > pageBottom && ty + rowY[nRows] <= pageBottom + slack) {
|
|
52560
|
+
const declared = num2(findChildByLocalName(tbl2, "sz"), "height");
|
|
52561
|
+
if (rowY.some((v, k) => k > 0 && k < nRows && Math.abs(v - declared) <= 2)) slack = 0;
|
|
52562
|
+
}
|
|
52126
52563
|
if (BODY_H <= 0 || ty + rowY[nRows] <= pageBottom + slack && !stackOver) return plain4();
|
|
52127
|
-
if (_optionalChain([findChildByLocalName, 'call',
|
|
52564
|
+
if (_optionalChain([findChildByLocalName, 'call', _1280 => _1280(tbl2, "pos"), 'optionalAccess', _1281 => _1281.getAttribute, 'call', _1282 => _1282("treatAsChar")]) === "1") {
|
|
52128
52565
|
const declared = num2(findChildByLocalName(tbl2, "sz"), "height") || rowY[nRows];
|
|
52129
52566
|
if (ty - MT < 2e3 || ty + declared <= pageBottom + slack) return plain4();
|
|
52130
52567
|
return rowH.map((h, r) => [{ page: 1, y: MT + rowY[r], h }]);
|
|
@@ -52135,7 +52572,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52135
52572
|
const outB = num2(findChildByLocalName(tbl2, "outMargin"), "bottom");
|
|
52136
52573
|
const cellSplit = tbl2.getAttribute("pageBreak") === "CELL";
|
|
52137
52574
|
const out = [];
|
|
52138
|
-
const flows = (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
52575
|
+
const flows = (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1283 => _1283(tbl2, "pos"), 'optionalAccess', _1284 => _1284.getAttribute, 'call', _1285 => _1285("vertRelTo")]), () => ( "PARA"))) === "PARA";
|
|
52139
52576
|
let page = 0, y = ty, first = !flows || ty - MT < 2e3;
|
|
52140
52577
|
for (let r = 0; r < nRows; r++) {
|
|
52141
52578
|
let h = rowH[r];
|
|
@@ -52191,7 +52628,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52191
52628
|
const b = (_nullishCoalesce(boxes.get(c.el), () => ( []))).find((x) => x.part === k);
|
|
52192
52629
|
if (!b) continue;
|
|
52193
52630
|
const f = floatSpan(b.seg, y + c.marginT, contTop + c.marginT);
|
|
52194
|
-
if (_optionalChain([f, 'optionalAccess',
|
|
52631
|
+
if (_optionalChain([f, 'optionalAccess', _1286 => _1286.el]) && f.pages > 0 && f.pages > lead && Math.abs(contTop + c.marginT + b.top - b.origin - f.endY) < 3e3) {
|
|
52195
52632
|
lead = f.pages;
|
|
52196
52633
|
place = /* @__PURE__ */ new Map([[f.el, y + c.marginT]]);
|
|
52197
52634
|
led.add(b.seg);
|
|
@@ -52208,8 +52645,8 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52208
52645
|
for (const c of rowCells) {
|
|
52209
52646
|
const bs = _nullishCoalesce(boxes.get(c.el), () => ( []));
|
|
52210
52647
|
const inK = bs.filter((b) => b.part === k), next = bs.find((b) => b.part > k);
|
|
52211
|
-
const from = _nullishCoalesce(_nullishCoalesce(_optionalChain([inK, 'access',
|
|
52212
|
-
range.set(c.el, [from, _nullishCoalesce(_optionalChain([next, 'optionalAccess',
|
|
52648
|
+
const from = _nullishCoalesce(_nullishCoalesce(_optionalChain([inK, 'access', _1287 => _1287[0], 'optionalAccess', _1288 => _1288.origin]), () => ( _optionalChain([next, 'optionalAccess', _1289 => _1289.origin]))), () => ( Number.POSITIVE_INFINITY));
|
|
52649
|
+
range.set(c.el, [from, _nullishCoalesce(_optionalChain([next, 'optionalAccess', _1290 => _1290.top]), () => ( Number.POSITIVE_INFINITY))]);
|
|
52213
52650
|
if (inK.length) ext = Math.max(ext, inK[inK.length - 1].bottom - from + c.marginT + c.marginB);
|
|
52214
52651
|
if (k === hParts && inK.length && c.sub) for (const f of subFloatBottoms(c.sub)) {
|
|
52215
52652
|
const b = bs.find((x) => x.seg === f.seg);
|
|
@@ -52220,14 +52657,14 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52220
52657
|
const last = k === hParts;
|
|
52221
52658
|
const cellH = Math.max(0, ...rowCells.map((c) => num2(findChildByLocalName(c.el, "cellSz"), "height")));
|
|
52222
52659
|
const firstH = Math.min(declared > 0 && ty + declared - y >= ext ? Math.min(pageBottom - y, ty + declared - y) : pageBottom - y, Math.max(ext, cellH));
|
|
52223
|
-
const share = last && k === 1 ? Math.max(0, ...rowCells.filter((c) => tbl2.getAttribute("noAdjust") === "1" || /^(CENTER|BOTTOM)$/.test(_nullishCoalesce(_optionalChain([c, 'access',
|
|
52660
|
+
const share = last && k === 1 ? Math.max(0, ...rowCells.filter((c) => tbl2.getAttribute("noAdjust") === "1" || /^(CENTER|BOTTOM)$/.test(_nullishCoalesce(_optionalChain([c, 'access', _1291 => _1291.sub, 'optionalAccess', _1292 => _1292.getAttribute, 'call', _1293 => _1293("vertAlign")]), () => ( "")))).map((c) => c.h - firstPh).filter((v) => v <= pageBottom - contTop)) : 0;
|
|
52224
52661
|
const ph = last ? Math.max(ext, share) : k === 0 ? firstH : toNext > 0 ? Math.min(pageBottom - contTop, toNext) : pageBottom - contTop;
|
|
52225
52662
|
if (k === 0) firstPh = ph;
|
|
52226
52663
|
pieces.push({ page, y, h: ph, range });
|
|
52227
52664
|
if (!last) {
|
|
52228
52665
|
let span2 = 0, spanEnd = 0;
|
|
52229
52666
|
if (floatSpan) for (const c of rowCells) {
|
|
52230
|
-
const bs = (_nullishCoalesce(boxes.get(c.el), () => ( []))).filter((b) => b.part === k), from = _nullishCoalesce(_optionalChain([bs, 'access',
|
|
52667
|
+
const bs = (_nullishCoalesce(boxes.get(c.el), () => ( []))).filter((b) => b.part === k), from = _nullishCoalesce(_optionalChain([bs, 'access', _1294 => _1294[0], 'optionalAccess', _1295 => _1295.origin]), () => ( 0));
|
|
52231
52668
|
for (const b of bs) {
|
|
52232
52669
|
if (led.has(b.seg)) continue;
|
|
52233
52670
|
const f = floatSpan(b.seg, y + c.marginT + b.top - from, contTop + c.marginT);
|
|
@@ -52415,7 +52852,7 @@ function objectGeometry(el, x, y, w, h, boxW = w, boxH = h) {
|
|
|
52415
52852
|
function shapeFill(el, defs, images, warn) {
|
|
52416
52853
|
const brush = findChildByLocalName(el, "fillBrush");
|
|
52417
52854
|
const win = brush && findChildByLocalName(brush, "winBrush");
|
|
52418
|
-
const face = _optionalChain([win, 'optionalAccess',
|
|
52855
|
+
const face = _optionalChain([win, 'optionalAccess', _1296 => _1296.getAttribute, 'call', _1297 => _1297("faceColor")]);
|
|
52419
52856
|
if (docColor(face)) return esc(face);
|
|
52420
52857
|
const grad = brush && findChildByLocalName(brush, "gradation");
|
|
52421
52858
|
if (grad) {
|
|
@@ -52466,8 +52903,8 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
|
|
|
52466
52903
|
const geometry = local ? { x: boxX, y: boxY, w, h, bbox: { x: boxX, y: boxY, w, h }, transform: "" } : objectGeometry(el, boxX, boxY, w, h, o.width || w, o.height || h);
|
|
52467
52904
|
const { x, y } = geometry;
|
|
52468
52905
|
const sx = ow > 0 ? w / ow : 1, sy = oh > 0 ? h / oh : 1;
|
|
52469
|
-
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52470
|
-
const color = esc(docColor(_optionalChain([line, 'optionalAccess',
|
|
52906
|
+
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1298 => _1298.getAttribute, 'call', _1299 => _1299("style")]), () => ( "SOLID"));
|
|
52907
|
+
const color = esc(docColor(_optionalChain([line, 'optionalAccess', _1300 => _1300.getAttribute, 'call', _1301 => _1301("color")]), "#000000"));
|
|
52471
52908
|
const strokeW = style === "NONE" ? 0 : Math.max(0.2, num2(line, "width", 33) / 100 * 2.834645);
|
|
52472
52909
|
const dash = /DASH|DOT/.test(style) ? ` stroke-dasharray="${style.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
52473
52910
|
const keepWidth = local ? ` vector-effect="non-scaling-stroke"` : "";
|
|
@@ -52540,7 +52977,7 @@ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = fals
|
|
|
52540
52977
|
if (hrel === "PAGE") {
|
|
52541
52978
|
x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
|
|
52542
52979
|
} else if (hrel === "PAPER") {
|
|
52543
|
-
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (_nullishCoalesce(_optionalChain([ctx, 'access',
|
|
52980
|
+
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (_nullishCoalesce(_optionalChain([ctx, 'access', _1302 => _1302.bodyDx, 'optionalCall', _1303 => _1303(ctx.page)]), () => ( 0)));
|
|
52544
52981
|
} else {
|
|
52545
52982
|
x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
|
|
52546
52983
|
}
|
|
@@ -52778,7 +53215,7 @@ function warnOnce(ctx, key, msg2) {
|
|
|
52778
53215
|
function charW(c, styles, prev) {
|
|
52779
53216
|
const st = _nullishCoalesce((c.prId != null ? styles.charPr.get(c.prId) : void 0), () => ( DEFAULT_CHAR));
|
|
52780
53217
|
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) });
|
|
52781
|
-
let w = 0, last = _optionalChain([prev, 'optionalAccess',
|
|
53218
|
+
let w = 0, last = _optionalChain([prev, 'optionalAccess', _1304 => _1304.ch]) ? _nullishCoalesce(prev.ch.codePointAt(prev.ch.length - 1), () => ( 0)) : 0;
|
|
52782
53219
|
for (const ch of c.ch) {
|
|
52783
53220
|
const cp = ch.codePointAt(0);
|
|
52784
53221
|
if (!joinsJamo(last, cp)) w += glyphWidth(ch, st).w;
|
|
@@ -52797,10 +53234,10 @@ function planLines(m, styles, numText = "") {
|
|
|
52797
53234
|
const align = _nullishCoalesce((m.paraPrId != null ? styles.paraAlign.get(m.paraPrId) : void 0), () => ( "JUSTIFY"));
|
|
52798
53235
|
const geom = m.paraPrId != null ? styles.paraGeom.get(m.paraPrId) : void 0;
|
|
52799
53236
|
const hang = geom && geom.marginIntent < 0 ? -geom.marginIntent : 0;
|
|
52800
|
-
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
52801
|
-
const firstPr = _nullishCoalesce(_optionalChain([m, 'access',
|
|
52802
|
-
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess',
|
|
52803
|
-
const headW = _optionalChain([bu, 'optionalAccess',
|
|
53237
|
+
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1305 => _1305.bullet]), () => ( (numText && _optionalChain([geom, 'optionalAccess', _1306 => _1306.number]) ? { ch: numText, ...geom.number } : void 0)));
|
|
53238
|
+
const firstPr = _nullishCoalesce(_optionalChain([m, 'access', _1307 => _1307.chars, 'access', _1308 => _1308.find, 'call', _1309 => _1309((c) => c.ch !== ""), 'optionalAccess', _1310 => _1310.prId]), () => ( null));
|
|
53239
|
+
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess', _1311 => _1311.charPrId]) != null ? styles.charPr.get(bu.charPrId) : firstPr != null ? styles.charPr.get(firstPr) : void 0), () => ( DEFAULT_CHAR));
|
|
53240
|
+
const headW = _optionalChain([bu, 'optionalAccess', _1312 => _1312.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;
|
|
52804
53241
|
const bulletW = bu ? paraHeadAdvance(bu, bst.height, headW) : 0;
|
|
52805
53242
|
const plans = [];
|
|
52806
53243
|
const inlineW = /* @__PURE__ */ new Map();
|
|
@@ -52810,8 +53247,8 @@ function planLines(m, styles, numText = "") {
|
|
|
52810
53247
|
const start = seg.textpos;
|
|
52811
53248
|
const end = i + 1 < m.segs.length ? m.segs[i + 1].textpos : Math.max(m.chars.length, start);
|
|
52812
53249
|
const tabs = /* @__PURE__ */ new Map();
|
|
52813
|
-
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
52814
|
-
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
53250
|
+
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1313 => _1313.marginIntent]), () => ( 0)), 0) + bulletW : hang + (_optionalChain([bu, 'optionalAccess', _1314 => _1314.autoIndent]) ? bulletW : 0);
|
|
53251
|
+
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1315 => _1315.marginIntent]), () => ( 0)), 0) : hang) + (i === 0 || _optionalChain([bu, 'optionalAccess', _1316 => _1316.autoIndent]) ? bulletW : 0);
|
|
52815
53252
|
let fixedTo = start;
|
|
52816
53253
|
let fixedW = 0;
|
|
52817
53254
|
for (let k = start; k < end && k < m.chars.length; k++) {
|
|
@@ -52844,6 +53281,16 @@ function planLines(m, styles, numText = "") {
|
|
|
52844
53281
|
let scale2 = 1;
|
|
52845
53282
|
const lineW = seg.horzsize - lead;
|
|
52846
53283
|
const avail = lineW - nat.obj;
|
|
53284
|
+
let lastSp = 0;
|
|
53285
|
+
if (fixedTo === start) {
|
|
53286
|
+
let k = textEnd - 1;
|
|
53287
|
+
while (k >= start && m.chars[k].ch === "") k--;
|
|
53288
|
+
if (k >= start) {
|
|
53289
|
+
const c = m.chars[k], st = _nullishCoalesce((c.prId != null ? styles.charPr.get(c.prId) : void 0), () => ( DEFAULT_CHAR));
|
|
53290
|
+
const cps = [...c.ch];
|
|
53291
|
+
lastSp = glyphWidth(cps[cps.length - 1], st).sp;
|
|
53292
|
+
}
|
|
53293
|
+
}
|
|
52847
53294
|
const stretch = align === "JUSTIFY" || align === "DISTRIBUTE" || align === "DISTRIBUTE_SPACE";
|
|
52848
53295
|
let spaceAdd = 0, spaceFrom = fixedTo;
|
|
52849
53296
|
if (nat.text > 0 && stretch && (!isLast || align === "DISTRIBUTE" || align === "DISTRIBUTE_SPACE")) {
|
|
@@ -52851,11 +53298,11 @@ function planLines(m, styles, numText = "") {
|
|
|
52851
53298
|
while (spFrom < textEnd && (m.chars[spFrom].ch === " " || m.chars[spFrom].ch === "")) spFrom++;
|
|
52852
53299
|
for (let k = spFrom; k < textEnd; k++) if (m.chars[k].ch === " ") nSp++;
|
|
52853
53300
|
if (nSp > 0 && align !== "DISTRIBUTE") {
|
|
52854
|
-
spaceAdd = (avail - nat.text) / nSp;
|
|
53301
|
+
spaceAdd = (avail - nat.text + lastSp) / nSp;
|
|
52855
53302
|
spaceFrom = spFrom;
|
|
52856
53303
|
} else scale2 = avail > 0 ? avail / nat.text : 1;
|
|
52857
53304
|
} else if (nat.text + nat.obj > 0 && (isLast || !stretch)) {
|
|
52858
|
-
const w = nat.text + nat.obj;
|
|
53305
|
+
const w = nat.text + nat.obj - lastSp;
|
|
52859
53306
|
if (align === "CENTER") xoff = Math.max(0, (lineW - w) / 2);
|
|
52860
53307
|
else if (align === "RIGHT") xoff = Math.max(0, lineW - w);
|
|
52861
53308
|
}
|
|
@@ -52912,7 +53359,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52912
53359
|
let i = plan.start;
|
|
52913
53360
|
let cursor = ox + seg.horzpos + plan.xoff;
|
|
52914
53361
|
const y = oy + seg.vertpos + seg.baseline;
|
|
52915
|
-
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access',
|
|
53362
|
+
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access', _1317 => _1317.styles, 'access', _1318 => _1318.paraGeom, 'access', _1319 => _1319.get, 'call', _1320 => _1320(m.paraPrId), 'optionalAccess', _1321 => _1321.vertAlign]) : void 0;
|
|
52916
53363
|
const glyphY = (h) => y + (pva === "CENTER" ? Math.round(h * 0.35) : pva === "BOTTOM" ? -Math.round(h * 0.15) : 0);
|
|
52917
53364
|
if (plan.bullet) {
|
|
52918
53365
|
const bs = _nullishCoalesce((plan.bullet.prId != null ? ctx.styles.charPr.get(plan.bullet.prId) : void 0), () => ( DEFAULT_CHAR));
|
|
@@ -53001,7 +53448,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
53001
53448
|
if (st.italic) attrs.push(`font-style="italic"`);
|
|
53002
53449
|
if (st.underline) attrs.push(`text-decoration="underline"`);
|
|
53003
53450
|
if (st.color) attrs.push(`fill="${escapeXml7(st.color)}"`);
|
|
53004
|
-
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(
|
|
53451
|
+
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(_chunk5N6MENH6cjs.mapPuaText.call(void 0, text))}</text>`);
|
|
53005
53452
|
ctx.stats.texts++;
|
|
53006
53453
|
}
|
|
53007
53454
|
return sw;
|
|
@@ -53070,19 +53517,19 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
53070
53517
|
anchorLineH = pl.seg.textheight;
|
|
53071
53518
|
}
|
|
53072
53519
|
let objBaseV = baseV;
|
|
53073
|
-
const pTop = depth === 0 ? _optionalChain([ctx, 'access',
|
|
53520
|
+
const pTop = depth === 0 ? _optionalChain([ctx, 'access', _1322 => _1322.paraTops, 'optionalAccess', _1323 => _1323.get, 'call', _1324 => _1324(p)]) : void 0;
|
|
53074
53521
|
const wrapA = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
53075
53522
|
const top0 = _nullishCoalesce(pTop, () => ( (depth > 0 && wrapA !== "TOP_AND_BOTTOM" ? cellParaTop(p, ctx.styles.paraGeom) : void 0)));
|
|
53076
53523
|
if (top0 !== void 0 && wrapA !== "TOP_AND_BOTTOM") {
|
|
53077
|
-
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
53524
|
+
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1325 => _1325.styles, 'access', _1326 => _1326.paraGeom, 'access', _1327 => _1327.get, 'call', _1328 => _1328(m.paraPrId), 'optionalAccess', _1329 => _1329.spaceBefore]), () => ( 0)) : 0);
|
|
53078
53525
|
if (baseV > start + 100) {
|
|
53079
53526
|
objBaseV = start;
|
|
53080
53527
|
if (anchorLineV === baseV) anchorLineV = start;
|
|
53081
53528
|
}
|
|
53082
53529
|
}
|
|
53083
|
-
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
53530
|
+
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1330 => _1330(q.el, "pos"), 'optionalAccess', _1331 => _1331.getAttribute, 'call', _1332 => _1332("vertRelTo")]), () => ( "PARA"))) === "PARA").length;
|
|
53084
53531
|
let stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
53085
|
-
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
53532
|
+
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1333 => _1333.styles, 'access', _1334 => _1334.paraGeom, 'access', _1335 => _1335.get, 'call', _1336 => _1336(m.paraPrId), 'optionalAccess', _1337 => _1337.spaceBefore]), () => ( 0)) : 0;
|
|
53086
53533
|
if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, _nullishCoalesce(anchorLineV, () => ( baseV)), _nullishCoalesce(pTop, () => ( (depth > 0 ? cellParaTop(p, ctx.styles.paraGeom) : void 0))))) stay = false;
|
|
53087
53534
|
const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
|
|
53088
53535
|
let { x, y } = anchorObject(o, ax, oy, objBaseV, aw, ctx, anchorLineV, stay ? sbA : false, (firstLine || wrapA === "SQUARE") && pTop !== void 0 && pTop < baseV ? pTop : void 0, firstLine ? void 0 : anchorLineH);
|
|
@@ -53090,7 +53537,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
53090
53537
|
if (!tbStack) {
|
|
53091
53538
|
tbStack = /* @__PURE__ */ new Map();
|
|
53092
53539
|
let below = 0;
|
|
53093
|
-
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
53540
|
+
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1338 => _1338(q.el, "pos"), 'optionalAccess', _1339 => _1339.getAttribute, 'call', _1340 => _1340("vertRelTo")]), () => ( "PARA"))) === "PARA" && _optionalChain([findChildByLocalName, 'call', _1341 => _1341(q.el, "pos"), 'optionalAccess', _1342 => _1342.getAttribute, 'call', _1343 => _1343("allowOverlap")]) !== "1");
|
|
53094
53541
|
for (const q of stackable.length >= 2 ? stackable.sort((a, b) => a.index - b.index) : []) {
|
|
53095
53542
|
const omQ = findChildByLocalName(q.el, "outMargin"), raw = num2(findChildByLocalName(q.el, "pos"), "vertOffset");
|
|
53096
53543
|
const top = Math.max(below, raw >= 2 ** 31 ? raw - 2 ** 32 : raw);
|
|
@@ -53101,7 +53548,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
53101
53548
|
const st = tbStack.get(o.el);
|
|
53102
53549
|
if (st !== void 0) y = oy + (_nullishCoalesce(pTop, () => ( 0))) + st;
|
|
53103
53550
|
}
|
|
53104
|
-
const moved = _optionalChain([ctx, 'access',
|
|
53551
|
+
const moved = _optionalChain([ctx, 'access', _1344 => _1344.objPlace, 'optionalAccess', _1345 => _1345.get, 'call', _1346 => _1346(o.el)]);
|
|
53105
53552
|
if (moved) {
|
|
53106
53553
|
const pg = ctx.page;
|
|
53107
53554
|
ctx.page = moved.page;
|
|
@@ -53120,7 +53567,7 @@ function cellParaTop(p, geom) {
|
|
|
53120
53567
|
const segs = lsa ? elements(lsa).filter((e) => ln(e) === "lineseg") : [];
|
|
53121
53568
|
if (!segs.length) return void 0;
|
|
53122
53569
|
const last = segs[segs.length - 1];
|
|
53123
|
-
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access',
|
|
53570
|
+
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access', _1347 => _1347.get, 'call', _1348 => _1348(_nullishCoalesce(prev.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1349 => _1349.spaceAfter]), () => ( 0)));
|
|
53124
53571
|
}
|
|
53125
53572
|
function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
53126
53573
|
if (!o.inline && depth === 0 && ctx.paintJobs) {
|
|
@@ -53161,7 +53608,7 @@ function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
|
53161
53608
|
drawObject(sub, x + num2(off, "x"), y + num2(off, "y"), baseV, areaW, ctx, depth + 1);
|
|
53162
53609
|
}
|
|
53163
53610
|
} else if (o.tag === "equation") {
|
|
53164
|
-
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
53611
|
+
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1350 => _1350(o.el, "script"), 'optionalAccess', _1351 => _1351.textContent]), () => ( ""));
|
|
53165
53612
|
const text = script ? latexToPlain(hwpEquationToLatex(script)) : "";
|
|
53166
53613
|
if (text && o.width > 0) {
|
|
53167
53614
|
const bl = Number(o.el.getAttribute("baseLine")), size = num2(o.el, "baseUnit", 1e3);
|
|
@@ -53266,7 +53713,7 @@ function tableContPages(tbl2, ty, MT, BODY_H, memo, slack = 0, floatSpan, nested
|
|
|
53266
53713
|
}
|
|
53267
53714
|
function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
53268
53715
|
return (seg, top, contMT) => {
|
|
53269
|
-
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess',
|
|
53716
|
+
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess', _1352 => _1352.parentNode]);
|
|
53270
53717
|
if (!p || ln(p) !== "p") return void 0;
|
|
53271
53718
|
const segs = elements(lsa).filter((e) => ln(e) === "lineseg"), k = segs.indexOf(seg);
|
|
53272
53719
|
const m = buildPara(p);
|
|
@@ -53274,12 +53721,12 @@ function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
|
53274
53721
|
for (const o of m.objs) {
|
|
53275
53722
|
if (o.tag !== "tbl" || o.inline) continue;
|
|
53276
53723
|
const pos = findChildByLocalName(o.el, "pos");
|
|
53277
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53724
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1353 => _1353.getAttribute, 'call', _1354 => _1354("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
53278
53725
|
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)));
|
|
53279
53726
|
if (segK !== k) continue;
|
|
53280
53727
|
const segV = num2(seg, "vertpos"), pTop = cellParaTop(p, _nullishCoalesce(memo.paraGeom, () => ( /* @__PURE__ */ new Map())));
|
|
53281
53728
|
const start = linePushedBy(o, segV, pTop) ? top - (segV - (_nullishCoalesce(pTop, () => ( segV)))) : top;
|
|
53282
|
-
const ty = start + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53729
|
+
const ty = start + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1355 => _1355.getAttribute, 'call', _1356 => _1356("vertOffset")]), () => ( void 0)), 0));
|
|
53283
53730
|
const span2 = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true, contMT);
|
|
53284
53731
|
if (span2.pages > 0 && (!best || span2.pages > best.pages)) best = { ...span2, el: o.el };
|
|
53285
53732
|
}
|
|
@@ -53320,7 +53767,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53320
53767
|
let hdrRows = 0;
|
|
53321
53768
|
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++;
|
|
53322
53769
|
const slack = ctx.geom.PH - ctx.geom.MT - ctx.geom.BODY_H;
|
|
53323
|
-
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call',
|
|
53770
|
+
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call', _1357 => _1357(tbl2, "pos"), 'optionalAccess', _1358 => _1358.getAttribute, 'call', _1359 => _1359("treatAsChar")]) !== "1";
|
|
53324
53771
|
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 }]);
|
|
53325
53772
|
const splitSaved = ctx.splitCell;
|
|
53326
53773
|
ctx.splitCell = false;
|
|
@@ -53342,7 +53789,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53342
53789
|
for (const g3 of geom) {
|
|
53343
53790
|
ctx.page = g3.page;
|
|
53344
53791
|
const bf = g3.c.bfId != null ? ctx.styles.borderFill.get(g3.c.bfId) : void 0;
|
|
53345
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
53792
|
+
if (_optionalChain([bf, 'optionalAccess', _1360 => _1360.fill])) emit(ctx, `<rect x="${pt2(g3.x)}" y="${pt2(g3.y)}" width="${pt2(g3.w)}" height="${pt2(g3.h)}" fill="${escapeXml7(bf.fill)}"/>`);
|
|
53346
53793
|
}
|
|
53347
53794
|
for (const g3 of geom) {
|
|
53348
53795
|
const { c } = g3;
|
|
@@ -53353,14 +53800,14 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53353
53800
|
const boxes = cellLineBoxes(c);
|
|
53354
53801
|
const contV = new Map(boxes.map((b) => [b.seg, b.top]));
|
|
53355
53802
|
const pieceOf = (v) => Math.max(0, g3.pieces.findIndex((pc) => {
|
|
53356
|
-
const r = _optionalChain([pc, 'access',
|
|
53803
|
+
const r = _optionalChain([pc, 'access', _1361 => _1361.range, 'optionalAccess', _1362 => _1362.get, 'call', _1363 => _1363(c.el)]);
|
|
53357
53804
|
return !!r && v >= r[0] && v < r[1];
|
|
53358
53805
|
}));
|
|
53359
53806
|
const va2 = _nullishCoalesce(c.sub.getAttribute("vertAlign"), () => ( "TOP"));
|
|
53360
53807
|
const lastK = g3.pieces.length - 1;
|
|
53361
53808
|
const pieceOff = g3.pieces.map((pc, k) => {
|
|
53362
53809
|
if (va2 === "TOP" || k > 0 && k < lastK || pc.fill) return 0;
|
|
53363
|
-
const from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
53810
|
+
const from = _nullishCoalesce(_optionalChain([pc, 'access', _1364 => _1364.range, 'optionalAccess', _1365 => _1365.get, 'call', _1366 => _1366(c.el), 'optionalAccess', _1367 => _1367[0]]), () => ( 0));
|
|
53364
53811
|
const bottoms = boxes.filter((b) => pieceOf(b.top) === k).map((b) => b.bottom - from);
|
|
53365
53812
|
if (k > 0) for (const f of subFloatBottoms(c.sub)) {
|
|
53366
53813
|
const b = boxes.find((x) => x.seg === f.seg);
|
|
@@ -53377,7 +53824,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53377
53824
|
const pages = segs.map((sg) => {
|
|
53378
53825
|
const v = _nullishCoalesce(contV.get(sg), () => ( num2(sg, "vertpos")));
|
|
53379
53826
|
const k = pieceOf(v);
|
|
53380
|
-
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
53827
|
+
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access', _1368 => _1368.range, 'optionalAccess', _1369 => _1369.get, 'call', _1370 => _1370(c.el), 'optionalAccess', _1371 => _1371[0]]), () => ( 0));
|
|
53381
53828
|
sg.setAttribute("vertpos", String(v - from + pc.y + c.marginT + pieceOff[k] - base));
|
|
53382
53829
|
return startPage + pc.page;
|
|
53383
53830
|
});
|
|
@@ -53472,7 +53919,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
53472
53919
|
}
|
|
53473
53920
|
function drawPicFrame(pic, x, y, w, h, transform, ctx) {
|
|
53474
53921
|
const img = findFirst(pic, "img");
|
|
53475
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
53922
|
+
const ref = _optionalChain([img, 'optionalAccess', _1372 => _1372.getAttribute, 'call', _1373 => _1373("binaryItemIDRef")]);
|
|
53476
53923
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
53477
53924
|
const imgId = ctx.regions.add("image", bboxOf(ctx, x, y, w, h), { sourceId: _nullishCoalesce(ref, () => ( void 0)), parentId: parentId(ctx) });
|
|
53478
53925
|
emit(ctx, regionOpenTag(imgId, "image", pageNo(ctx)));
|
|
@@ -53518,12 +53965,12 @@ function readSectionGeom(root) {
|
|
|
53518
53965
|
const pagePr = findFirst(root, "pagePr");
|
|
53519
53966
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
53520
53967
|
let PW = num2(pagePr, "width", 59528), PH = num2(pagePr, "height", 84188);
|
|
53521
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
53968
|
+
if (_optionalChain([pagePr, 'optionalAccess', _1374 => _1374.getAttribute, 'call', _1375 => _1375("landscape")]) === "NARROWLY" && PW < PH) {
|
|
53522
53969
|
const t = PW;
|
|
53523
53970
|
PW = PH;
|
|
53524
53971
|
PH = t;
|
|
53525
53972
|
}
|
|
53526
|
-
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess',
|
|
53973
|
+
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess', _1376 => _1376.getAttribute, 'call', _1377 => _1377("gutterType")]), () => ( "LEFT_ONLY")), gutter = num2(margin, "gutter", 0);
|
|
53527
53974
|
const gL = gutterType === "TOP_BOTTOM" ? 0 : gutter, gT = gutterType === "TOP_BOTTOM" ? gutter : 0;
|
|
53528
53975
|
const ML = num2(margin, "left", 8504) + gL;
|
|
53529
53976
|
const MT = num2(margin, "top", 5668) + num2(margin, "header", 0) + gT;
|
|
@@ -53580,7 +54027,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53580
54027
|
}
|
|
53581
54028
|
const absolute = !degenerate && absoluteTopCache(root, ML, BODY_W);
|
|
53582
54029
|
if (absolute) {
|
|
53583
|
-
for (const lsa of Array.from(root.getElementsByTagName("*")).filter((e) => ln(e) === "linesegarray")) _optionalChain([lsa, 'access',
|
|
54030
|
+
for (const lsa of Array.from(root.getElementsByTagName("*")).filter((e) => ln(e) === "linesegarray")) _optionalChain([lsa, 'access', _1378 => _1378.parentNode, 'optionalAccess', _1379 => _1379.removeChild, 'call', _1380 => _1380(lsa)]);
|
|
53584
54031
|
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");
|
|
53585
54032
|
}
|
|
53586
54033
|
const mixed = !doReflow && !degenerate && !absolute && Array.from(root.getElementsByTagName("*")).some((p) => ln(p) === "p" && !findChildByLocalName(p, "linesegarray"));
|
|
@@ -53639,7 +54086,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53639
54086
|
pendingEnd = 0;
|
|
53640
54087
|
} else {
|
|
53641
54088
|
const brk = v < prevV ? !multiCol || h <= prevH : v === prevV && h <= prevH && prevEnd > v && v < BODY_H / 2;
|
|
53642
|
-
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',
|
|
54089
|
+
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', _1381 => _1381(o.el, "pos"), 'optionalAccess', _1382 => _1382.getAttribute, 'call', _1383 => _1383("vertRelTo")]), () => ( "PARA"))) === "PARA" && linePushedBy(o, v, 0)));
|
|
53643
54090
|
const obrk = !brk && !pbrk && !multiCol && paraFirst && v > prevV && v < prevEnd - 100 && prevEnd + num2(s, "vertsize") > BODY_H && v < BODY_H / 2;
|
|
53644
54091
|
if (brk || pbrk || obrk) cur++;
|
|
53645
54092
|
if (brk && prevSeg && prevV + prevSeg.vs > BODY_H && v === prevSeg.vs + prevSeg.sp && prevSeg.pages[prevSeg.idx] === cur - 1) {
|
|
@@ -53673,17 +54120,17 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53673
54120
|
for (const o of m0.objs) {
|
|
53674
54121
|
if (o.tag !== "tbl") continue;
|
|
53675
54122
|
const pos = findChildByLocalName(o.el, "pos"), om = findChildByLocalName(o.el, "outMargin");
|
|
53676
|
-
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
54123
|
+
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1384 => _1384.getAttribute, 'call', _1385 => _1385("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
53677
54124
|
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)));
|
|
53678
54125
|
const segV = num2(segEls[segK], "vertpos");
|
|
53679
54126
|
const h = Math.max(o.height, measureTableHeight(o.el, ctxBase.extentMemo)), omT = num2(om, "top"), omB = num2(om, "bottom");
|
|
53680
54127
|
const pushed = segV - (omT + h + omB);
|
|
53681
54128
|
const nTb = m0.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM").length;
|
|
53682
54129
|
const wrapP = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
53683
|
-
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access',
|
|
54130
|
+
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access', _1386 => _1386.get, 'call', _1387 => _1387(m0.paraPrId), 'optionalAccess', _1388 => _1388.spaceBefore]), () => ( 0)) : 0;
|
|
53684
54131
|
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));
|
|
53685
54132
|
const nonPush = wrapP !== "TOP_AND_BOTTOM" && pTop !== void 0 && segV > pTop + sbP + 100 ? pTop + sbP : void 0;
|
|
53686
|
-
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
54133
|
+
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1389 => _1389.getAttribute, 'call', _1390 => _1390("vertOffset")]), () => ( void 0)), 0));
|
|
53687
54134
|
const paraStart = segK === 0 && pTop !== void 0 && pTop < segV ? pTop : segV;
|
|
53688
54135
|
const ty = o.inline ? MT + segV + omT : nonPush !== void 0 ? MT + nonPush + omT + voP : MT + (stay ? segV - sbP : pushed >= -100 ? pushed : paraStart) + omT + voP;
|
|
53689
54136
|
const span2 = tableContPages(o.el, ty, MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H, cellFloatSpan(MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H));
|
|
@@ -53710,7 +54157,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53710
54157
|
for (const p of elements(root)) {
|
|
53711
54158
|
if (ln(p) !== "p") continue;
|
|
53712
54159
|
const pg = paraSegPages.get(p);
|
|
53713
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
54160
|
+
if (!_optionalChain([pg, 'optionalAccess', _1391 => _1391.length])) continue;
|
|
53714
54161
|
const pm = buildPara(p);
|
|
53715
54162
|
if (pm.objs.length || pm.chars.some((c) => c.ch.trim() !== "" || !!c.ctrlText)) lastContent = Math.max(lastContent, ...pg);
|
|
53716
54163
|
}
|
|
@@ -53727,7 +54174,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53727
54174
|
for (const p of elements(root)) {
|
|
53728
54175
|
if (ln(p) !== "p") continue;
|
|
53729
54176
|
const pg = paraSegPages.get(p);
|
|
53730
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
54177
|
+
if (!_optionalChain([pg, 'optionalAccess', _1392 => _1392.includes, 'call', _1393 => _1393(lastContent)])) continue;
|
|
53731
54178
|
const pm = buildPara(p);
|
|
53732
54179
|
pm.segs.forEach((sg, k) => {
|
|
53733
54180
|
if (pg[k] !== lastContent) return;
|
|
@@ -53747,7 +54194,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53747
54194
|
const ens = endNoteLayout(root, paraSegPages, geom);
|
|
53748
54195
|
const ctx = {
|
|
53749
54196
|
...ctxBase,
|
|
53750
|
-
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
54197
|
+
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1394 => _1394.pageCount]), () => ( 0))) }, () => []),
|
|
53751
54198
|
page: 0,
|
|
53752
54199
|
geom,
|
|
53753
54200
|
pageH,
|
|
@@ -53805,7 +54252,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53805
54252
|
ctx.bodyDx = void 0;
|
|
53806
54253
|
wrapMirror(ctx.pages, (page) => _nullishCoalesce(bodyStart[page], () => ( 0)));
|
|
53807
54254
|
const allPages = new Map(paraSegPages);
|
|
53808
|
-
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
54255
|
+
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1395 => _1395.paras]), () => ( []))) allPages.set(e.p, e.pages);
|
|
53809
54256
|
drawPageDecor(root, allPages, ctx, localCols ? nCol : 1, colW, colGap);
|
|
53810
54257
|
drawPageNumbers(root, paraSegPages, ctx);
|
|
53811
54258
|
ctx.page = 0;
|
|
@@ -53874,7 +54321,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
53874
54321
|
let decl;
|
|
53875
54322
|
const hidden = /* @__PURE__ */ new Set();
|
|
53876
54323
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
53877
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
54324
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1396 => _1396.get, 'call', _1397 => _1397(p), 'optionalAccess', _1398 => _1398[0]]), () => ( 0));
|
|
53878
54325
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
53879
54326
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
53880
54327
|
const pn = findChildByLocalName(ctrl, "pageNum"), ph = findChildByLocalName(ctrl, "pageHiding");
|
|
@@ -53936,22 +54383,22 @@ function renderSectionRoots(sections, input) {
|
|
|
53936
54383
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
53937
54384
|
ctxBase.pageBase += pages.length;
|
|
53938
54385
|
}
|
|
53939
|
-
if (rendered.length === 0) throw new (0,
|
|
54386
|
+
if (rendered.length === 0) throw new (0, _chunkILRCRR54cjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
53940
54387
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
53941
54388
|
}
|
|
53942
54389
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
53943
54390
|
async function renderHwpxInternal(input, options) {
|
|
53944
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
54391
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1399 => _1399.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
53945
54392
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
53946
|
-
|
|
54393
|
+
_chunkILRCRR54cjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
53947
54394
|
let zip;
|
|
53948
54395
|
try {
|
|
53949
54396
|
zip = await _jszip2.default.loadAsync(input);
|
|
53950
54397
|
} catch (e43) {
|
|
53951
|
-
throw new (0,
|
|
54398
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
53952
54399
|
}
|
|
53953
|
-
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) =>
|
|
53954
|
-
if (secFiles.length === 0) throw new (0,
|
|
54400
|
+
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => _chunkILRCRR54cjs.compareSectionPaths.call(void 0, a.name, b.name));
|
|
54401
|
+
if (secFiles.length === 0) throw new (0, _chunkILRCRR54cjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
53955
54402
|
const warnings = [];
|
|
53956
54403
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
53957
54404
|
const verFile = zip.file("version.xml");
|
|
@@ -53962,14 +54409,14 @@ async function renderHwpxInternal(input, options) {
|
|
|
53962
54409
|
const secXmls = [];
|
|
53963
54410
|
for (const f of secFiles) {
|
|
53964
54411
|
const xml = await readZipEntry(f, "text");
|
|
53965
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
54412
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkILRCRR54cjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
53966
54413
|
secXmls.push(xml);
|
|
53967
54414
|
}
|
|
53968
54415
|
const masterPages = /* @__PURE__ */ new Map();
|
|
53969
54416
|
const masterXmls = [];
|
|
53970
54417
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
53971
54418
|
const xml = await readZipEntry(file, "text");
|
|
53972
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
54419
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkILRCRR54cjs.KordocError)("\uBC14\uD0D5\uCABD XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
53973
54420
|
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
53974
54421
|
if (root && ln(root) === "masterPage") {
|
|
53975
54422
|
masterPages.set(root.getAttribute("id") || file.name.replace(/^.*\/|\.xml$/g, ""), root);
|
|
@@ -53997,7 +54444,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
53997
54444
|
let href = binmap.get(ref);
|
|
53998
54445
|
if (!href) {
|
|
53999
54446
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
54000
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
54447
|
+
href = _optionalChain([cand, 'optionalAccess', _1400 => _1400.name]);
|
|
54001
54448
|
}
|
|
54002
54449
|
if (!href) continue;
|
|
54003
54450
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -54019,7 +54466,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
54019
54466
|
for (let si = 0; si < secXmls.length; si++) {
|
|
54020
54467
|
const secXml = secXmls[si];
|
|
54021
54468
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
54022
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
54469
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _1401 => _1401.reflow])) {
|
|
54023
54470
|
noCacheSkipped = true;
|
|
54024
54471
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
54025
54472
|
continue;
|
|
@@ -54036,11 +54483,11 @@ async function renderHwpxInternal(input, options) {
|
|
|
54036
54483
|
}
|
|
54037
54484
|
if (roots.length === 0) {
|
|
54038
54485
|
if (noCacheSkipped) {
|
|
54039
|
-
throw new (0,
|
|
54486
|
+
throw new (0, _chunkILRCRR54cjs.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)");
|
|
54040
54487
|
}
|
|
54041
|
-
throw new (0,
|
|
54488
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
54042
54489
|
}
|
|
54043
|
-
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
54490
|
+
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1402 => _1402.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1403 => _1403.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1404 => _1404.highlights]) });
|
|
54044
54491
|
}
|
|
54045
54492
|
async function renderHwpxToSvg(input, options) {
|
|
54046
54493
|
const r = await renderHwpxInternal(input, options);
|
|
@@ -54263,7 +54710,7 @@ var FOLD_END = 42124;
|
|
|
54263
54710
|
var FOLD_SHIFT = 983040 - 40960;
|
|
54264
54711
|
function textChar(ch) {
|
|
54265
54712
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
54266
|
-
const mapped =
|
|
54713
|
+
const mapped = _chunk5N6MENH6cjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
54267
54714
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
54268
54715
|
}
|
|
54269
54716
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -54355,7 +54802,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
54355
54802
|
out += run.join("") + "</hp:run>";
|
|
54356
54803
|
run = [];
|
|
54357
54804
|
};
|
|
54358
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
54805
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1405 => _1405[0], 'optionalAccess', _1406 => _1406[1]]), () => ( 0)));
|
|
54359
54806
|
let pos = 0, ctrlIdx = 0, o = 0;
|
|
54360
54807
|
const switchShape = () => {
|
|
54361
54808
|
while (shapeIdx + 1 < shapes.length && pos >= shapes[shapeIdx + 1][0]) {
|
|
@@ -54441,7 +54888,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
54441
54888
|
closeRun();
|
|
54442
54889
|
const rest = ctrls.filter((c) => !c.used && (c.id === CTRL_TBL3 || c.id === CTRL_GSO3 || c.id === CTRL_SECD2 || c.id === CTRL_COLD2));
|
|
54443
54890
|
if (rest.length > 0) {
|
|
54444
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
54891
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1407 => _1407[0], 'optionalAccess', _1408 => _1408[1]]), () => ( 0)));
|
|
54445
54892
|
for (const c of rest) {
|
|
54446
54893
|
const el = ctrlElement(ctrls.indexOf(c), c.id);
|
|
54447
54894
|
run.push(el);
|
|
@@ -54607,14 +55054,14 @@ function hwp5SectionToXml(records, ctx) {
|
|
|
54607
55054
|
return `<hs:sec xmlns:hs="http://www.hancom.co.kr/hwpml/2011/section" xmlns:hp="http://www.hancom.co.kr/hwpml/2011/paragraph" xmlns:hc="http://www.hancom.co.kr/hwpml/2011/core">` + paragraphsXml(records, 0, records.length, 0, ctx, 0) + "</hs:sec>";
|
|
54608
55055
|
}
|
|
54609
55056
|
function renderHwp5Records(docInfo, styles, secRecords, binData, options, select, warnings = []) {
|
|
54610
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
55057
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1409 => _1409.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
54611
55058
|
const MAX_TOTAL_IMAGE_BYTES = 128 * 1024 * 1024;
|
|
54612
55059
|
const images = /* @__PURE__ */ new Map();
|
|
54613
55060
|
let totalImgBytes = 0;
|
|
54614
55061
|
const imageRef = (binDataId) => {
|
|
54615
55062
|
if (binDataId <= 0) return null;
|
|
54616
|
-
const item = _optionalChain([docInfo, 'optionalAccess',
|
|
54617
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
55063
|
+
const item = _optionalChain([docInfo, 'optionalAccess', _1410 => _1410.binData, 'access', _1411 => _1411[binDataId - 1]]);
|
|
55064
|
+
if (_optionalChain([item, 'optionalAccess', _1412 => _1412.kind]) === "link") return null;
|
|
54618
55065
|
const storageId = item && item.storageId > 0 ? item.storageId : binDataId;
|
|
54619
55066
|
const ref = `bin${storageId}`;
|
|
54620
55067
|
if (images.has(ref)) return ref;
|
|
@@ -54648,8 +55095,8 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
54648
55095
|
}
|
|
54649
55096
|
roots.push({ root, index: si });
|
|
54650
55097
|
}
|
|
54651
|
-
if (roots.length === 0) throw new (0,
|
|
54652
|
-
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
55098
|
+
if (roots.length === 0) throw new (0, _chunkILRCRR54cjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
55099
|
+
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1413 => _1413.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1414 => _1414.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1415 => _1415.highlights]) });
|
|
54653
55100
|
return assemblePageSvgs(r, "hwp", select);
|
|
54654
55101
|
}
|
|
54655
55102
|
function renderHwp5Pages(input, options, select) {
|
|
@@ -54661,7 +55108,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
54661
55108
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
54662
55109
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
54663
55110
|
const sections = readHwp5SectionStreams(c);
|
|
54664
|
-
if (sections.length === 0) throw new (0,
|
|
55111
|
+
if (sections.length === 0) throw new (0, _chunkILRCRR54cjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
54665
55112
|
const parseWarnings = [];
|
|
54666
55113
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
54667
55114
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -54747,14 +55194,14 @@ async function loadSharp() {
|
|
|
54747
55194
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
54748
55195
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
54749
55196
|
} catch (e46) {
|
|
54750
|
-
throw new (0,
|
|
54751
|
-
'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.' +
|
|
55197
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(
|
|
55198
|
+
'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.' + _chunkILRCRR54cjs.OPTIONAL_DEP_INSTALL_HINT
|
|
54752
55199
|
);
|
|
54753
55200
|
}
|
|
54754
55201
|
}
|
|
54755
55202
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
54756
55203
|
const sharp = await loadSharp();
|
|
54757
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
55204
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkILRCRR54cjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
54758
55205
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
54759
55206
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
54760
55207
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -54772,11 +55219,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
54772
55219
|
try {
|
|
54773
55220
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
54774
55221
|
} catch (e47) {
|
|
54775
|
-
throw new (0,
|
|
55222
|
+
throw new (0, _chunkILRCRR54cjs.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");
|
|
54776
55223
|
}
|
|
54777
55224
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
54778
55225
|
if (!executablePath) {
|
|
54779
|
-
throw new (0,
|
|
55226
|
+
throw new (0, _chunkILRCRR54cjs.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");
|
|
54780
55227
|
}
|
|
54781
55228
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
54782
55229
|
try {
|
|
@@ -54792,13 +55239,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
54792
55239
|
async function loadBuffer(input) {
|
|
54793
55240
|
if (typeof input === "string") {
|
|
54794
55241
|
try {
|
|
54795
|
-
return
|
|
55242
|
+
return _chunkILRCRR54cjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
54796
55243
|
} catch (err) {
|
|
54797
55244
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
54798
|
-
throw new (0,
|
|
55245
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
54799
55246
|
}
|
|
54800
55247
|
}
|
|
54801
|
-
if (Buffer.isBuffer(input)) return
|
|
55248
|
+
if (Buffer.isBuffer(input)) return _chunkILRCRR54cjs.toArrayBuffer.call(void 0, input);
|
|
54802
55249
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
54803
55250
|
return input;
|
|
54804
55251
|
}
|
|
@@ -54807,17 +55254,17 @@ async function sourceFormatOf(buffer) {
|
|
|
54807
55254
|
if (format2 === "hwpx") {
|
|
54808
55255
|
const zip = await detectZipFormat(buffer);
|
|
54809
55256
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
54810
|
-
throw new (0,
|
|
55257
|
+
throw new (0, _chunkILRCRR54cjs.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`);
|
|
54811
55258
|
}
|
|
54812
55259
|
if (format2 === "hwp") return "hwp";
|
|
54813
|
-
throw new (0,
|
|
55260
|
+
throw new (0, _chunkILRCRR54cjs.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`);
|
|
54814
55261
|
}
|
|
54815
55262
|
async function renderDocumentToScene(input, options = {}) {
|
|
54816
55263
|
const buffer = await loadBuffer(input);
|
|
54817
55264
|
const source = await sourceFormatOf(buffer);
|
|
54818
55265
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
54819
55266
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
54820
|
-
if (set.size === 0) throw new (0,
|
|
55267
|
+
if (set.size === 0) throw new (0, _chunkILRCRR54cjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
54821
55268
|
return set;
|
|
54822
55269
|
} : void 0;
|
|
54823
55270
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -54853,7 +55300,7 @@ async function renderDocument(input, options) {
|
|
|
54853
55300
|
break;
|
|
54854
55301
|
}
|
|
54855
55302
|
default:
|
|
54856
|
-
throw new (0,
|
|
55303
|
+
throw new (0, _chunkILRCRR54cjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
54857
55304
|
}
|
|
54858
55305
|
return { scene, assets };
|
|
54859
55306
|
}
|
|
@@ -54883,7 +55330,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
54883
55330
|
const out = [];
|
|
54884
55331
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
54885
55332
|
const meta = scene.pages.find((p) => p.page === page);
|
|
54886
|
-
if (!meta) throw new (0,
|
|
55333
|
+
if (!meta) throw new (0, _chunkILRCRR54cjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
54887
55334
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
54888
55335
|
for (const { region, bbox } of items) {
|
|
54889
55336
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -54907,9 +55354,9 @@ function wantsCrop(kind, policy) {
|
|
|
54907
55354
|
}
|
|
54908
55355
|
async function extractTables(input, options = {}) {
|
|
54909
55356
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
54910
|
-
const buffer = typeof input === "string" ?
|
|
55357
|
+
const buffer = typeof input === "string" ? _chunkILRCRR54cjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkILRCRR54cjs.toArrayBuffer.call(void 0, input) : input;
|
|
54911
55358
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
54912
|
-
if (!parsed.success) throw new (0,
|
|
55359
|
+
if (!parsed.success) throw new (0, _chunkILRCRR54cjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
54913
55360
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
54914
55361
|
const out = blocks.map((b, i) => ({
|
|
54915
55362
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -54967,22 +55414,22 @@ async function extractTables(input, options = {}) {
|
|
|
54967
55414
|
// src/index.ts
|
|
54968
55415
|
async function parse(input, options) {
|
|
54969
55416
|
let buffer;
|
|
54970
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
54971
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
55417
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _1416 => _1416.filePath]) ? { ...options, filePath: input } : options;
|
|
55418
|
+
if (_optionalChain([opts, 'optionalAccess', _1417 => _1417.htmlTables]) && opts.tableFormat) {
|
|
54972
55419
|
return { success: false, fileType: "unknown", error: "htmlTables \uC640 tableFormat \uC740 \uD568\uAED8 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4" };
|
|
54973
55420
|
}
|
|
54974
|
-
const ocrOptionError =
|
|
55421
|
+
const ocrOptionError = _chunk5N6MENH6cjs.validateOcrOptions.call(void 0, opts);
|
|
54975
55422
|
if (ocrOptionError) return { success: false, fileType: "unknown", error: ocrOptionError };
|
|
54976
55423
|
if (typeof input === "string") {
|
|
54977
55424
|
try {
|
|
54978
55425
|
const buf = await _promises.readFile.call(void 0, input);
|
|
54979
|
-
buffer =
|
|
55426
|
+
buffer = _chunkILRCRR54cjs.toArrayBuffer.call(void 0, buf);
|
|
54980
55427
|
} catch (err) {
|
|
54981
55428
|
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}`;
|
|
54982
|
-
return { success: false, fileType: "unknown", error: msg2, code:
|
|
55429
|
+
return { success: false, fileType: "unknown", error: msg2, code: _chunkILRCRR54cjs.classifyError.call(void 0, err) };
|
|
54983
55430
|
}
|
|
54984
55431
|
} else if (Buffer.isBuffer(input)) {
|
|
54985
|
-
buffer =
|
|
55432
|
+
buffer = _chunkILRCRR54cjs.toArrayBuffer.call(void 0, input);
|
|
54986
55433
|
} else {
|
|
54987
55434
|
buffer = input;
|
|
54988
55435
|
}
|
|
@@ -54991,23 +55438,23 @@ async function parse(input, options) {
|
|
|
54991
55438
|
}
|
|
54992
55439
|
const format2 = detectFormat(buffer);
|
|
54993
55440
|
const result = await dispatch(format2, buffer, opts);
|
|
54994
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
55441
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1418 => _1418.images]) === false) {
|
|
54995
55442
|
delete result.images;
|
|
54996
55443
|
dropImageBytes(result.blocks);
|
|
54997
55444
|
}
|
|
54998
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
55445
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1419 => _1419.classifyTables])) classifyTableTree(result.blocks);
|
|
54999
55446
|
let out = result;
|
|
55000
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
55447
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1420 => _1420.pages]) && result.pageCount && _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, opts.pages, result.pageCount).size === 0) {
|
|
55001
55448
|
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` }] };
|
|
55002
55449
|
}
|
|
55003
55450
|
if (out.success && !out.pages) {
|
|
55004
|
-
const pages =
|
|
55451
|
+
const pages = _chunkKXTCBOUCcjs.blocksToPages.call(void 0, out.blocks, (bs) => _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([opts, 'optionalAccess', _1421 => _1421.tableFormat]) }));
|
|
55005
55452
|
if (pages) out = { ...out, pages };
|
|
55006
55453
|
}
|
|
55007
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
55454
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1422 => _1422.plain])) {
|
|
55008
55455
|
out = { ...out, markdown: toPlainMarkdown(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toPlainMarkdown(p.markdown) })) } : {} };
|
|
55009
55456
|
}
|
|
55010
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
55457
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1423 => _1423.htmlTables])) {
|
|
55011
55458
|
out = { ...out, markdown: toHtmlTables(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toHtmlTables(p.markdown) })) } : {} };
|
|
55012
55459
|
}
|
|
55013
55460
|
return out;
|
|
@@ -55052,42 +55499,42 @@ async function dispatch(format2, buffer, opts) {
|
|
|
55052
55499
|
async function withEmbeddedImageOcr(blocks, markdown, warnings, images, options) {
|
|
55053
55500
|
const list = [..._nullishCoalesce(warnings, () => ( []))];
|
|
55054
55501
|
if (!await ocrEmbeddedImages(blocks, options, list)) return { markdown, warnings: list.length ? list : void 0 };
|
|
55055
|
-
let md2 =
|
|
55056
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
55502
|
+
let md2 = _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1424 => _1424.tableFormat]) });
|
|
55503
|
+
if (_optionalChain([options, 'optionalAccess', _1425 => _1425.inlineImages]) && options.images !== false && _optionalChain([images, 'optionalAccess', _1426 => _1426.length])) {
|
|
55057
55504
|
try {
|
|
55058
|
-
md2 =
|
|
55505
|
+
md2 = _chunkKXTCBOUCcjs.inlineImagesIntoMarkdown.call(void 0, md2, images, { compress: true });
|
|
55059
55506
|
} catch (e48) {
|
|
55060
55507
|
}
|
|
55061
55508
|
}
|
|
55062
55509
|
return { markdown: md2, warnings: list.length ? list : void 0 };
|
|
55063
55510
|
}
|
|
55064
55511
|
function scriptsOff(r, off) {
|
|
55065
|
-
return off ?
|
|
55512
|
+
return off ? _chunk5N6MENH6cjs.stripScriptTags.call(void 0, r) : r;
|
|
55066
55513
|
}
|
|
55067
55514
|
async function parseImage(buffer, options) {
|
|
55068
55515
|
try {
|
|
55069
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
55516
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-VS42CA7V.cjs")));
|
|
55070
55517
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
55071
|
-
|
|
55518
|
+
_chunk5N6MENH6cjs.stripScriptTags.call(void 0, { blocks });
|
|
55072
55519
|
return {
|
|
55073
55520
|
success: true,
|
|
55074
55521
|
fileType: "image",
|
|
55075
|
-
markdown:
|
|
55522
|
+
markdown: _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1427 => _1427.tableFormat]) }),
|
|
55076
55523
|
blocks,
|
|
55077
55524
|
warnings: warnings.length ? warnings : void 0,
|
|
55078
55525
|
pageCount: 1,
|
|
55079
|
-
..._optionalChain([options, 'optionalAccess',
|
|
55526
|
+
..._optionalChain([options, 'optionalAccess', _1428 => _1428.ocrLines]) ? { ocrLines: lines ? [lines] : [] } : {}
|
|
55080
55527
|
};
|
|
55081
55528
|
} catch (err) {
|
|
55082
|
-
return { success: false, fileType: "image", error:
|
|
55529
|
+
return { success: false, fileType: "image", error: _chunkILRCRR54cjs.sanitizeError.call(void 0, err), code: _chunkILRCRR54cjs.classifyError.call(void 0, err) };
|
|
55083
55530
|
}
|
|
55084
55531
|
}
|
|
55085
55532
|
async function parseHwp3(buffer, options) {
|
|
55086
55533
|
try {
|
|
55087
55534
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp3Document(buffer, options);
|
|
55088
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
55535
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess', _1429 => _1429.pageCount]) };
|
|
55089
55536
|
} catch (err) {
|
|
55090
|
-
return { success: false, fileType: "hwp3", error:
|
|
55537
|
+
return { success: false, fileType: "hwp3", error: _chunkILRCRR54cjs.sanitizeError.call(void 0, err), code: _chunkILRCRR54cjs.classifyError.call(void 0, err) };
|
|
55091
55538
|
}
|
|
55092
55539
|
}
|
|
55093
55540
|
async function parseHwpx(buffer, options) {
|
|
@@ -55095,15 +55542,15 @@ async function parseHwpx(buffer, options) {
|
|
|
55095
55542
|
const doc = await parseHwpxDocument(buffer, options);
|
|
55096
55543
|
const { blocks, metadata, outline, images } = doc;
|
|
55097
55544
|
const { markdown, warnings } = await withEmbeddedImageOcr(blocks, doc.markdown, doc.warnings, void 0, options);
|
|
55098
|
-
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
55545
|
+
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1430 => _1430.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1431 => _1431.pageCount]) }, _optionalChain([options, 'optionalAccess', _1432 => _1432.scriptTags]) === false);
|
|
55099
55546
|
} catch (err) {
|
|
55100
|
-
return { success: false, fileType: "hwpx", error:
|
|
55547
|
+
return { success: false, fileType: "hwpx", error: _chunkILRCRR54cjs.sanitizeError.call(void 0, err), code: _chunkILRCRR54cjs.classifyError.call(void 0, err) };
|
|
55101
55548
|
}
|
|
55102
55549
|
}
|
|
55103
55550
|
async function parseHwp(buffer, options) {
|
|
55104
55551
|
try {
|
|
55105
55552
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
55106
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
55553
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _1433 => _1433.filePath])) {
|
|
55107
55554
|
try {
|
|
55108
55555
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
55109
55556
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -55122,15 +55569,15 @@ async function parseHwp(buffer, options) {
|
|
|
55122
55569
|
}
|
|
55123
55570
|
}
|
|
55124
55571
|
const ocred = await withEmbeddedImageOcr(blocks, markdown, warnings, images, options);
|
|
55125
|
-
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess',
|
|
55572
|
+
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess', _1434 => _1434.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1435 => _1435.pageCount]) }, _optionalChain([options, 'optionalAccess', _1436 => _1436.scriptTags]) === false);
|
|
55126
55573
|
} catch (err) {
|
|
55127
|
-
return { success: false, fileType: "hwp", error:
|
|
55574
|
+
return { success: false, fileType: "hwp", error: _chunkILRCRR54cjs.sanitizeError.call(void 0, err), code: _chunkILRCRR54cjs.classifyError.call(void 0, err) };
|
|
55128
55575
|
}
|
|
55129
55576
|
}
|
|
55130
55577
|
async function parsePdf(buffer, options) {
|
|
55131
55578
|
let parsePdfDocument;
|
|
55132
55579
|
try {
|
|
55133
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
55580
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-FVCPSKL3.cjs")));
|
|
55134
55581
|
parsePdfDocument = mod.parsePdfDocument;
|
|
55135
55582
|
} catch (e50) {
|
|
55136
55583
|
return {
|
|
@@ -55142,59 +55589,59 @@ async function parsePdf(buffer, options) {
|
|
|
55142
55589
|
}
|
|
55143
55590
|
try {
|
|
55144
55591
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, ocrLines } = await parsePdfDocument(buffer, options);
|
|
55145
|
-
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
55592
|
+
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _1437 => _1437.pageCount]), ...ocrLines ? { ocrLines } : {} }, _optionalChain([options, 'optionalAccess', _1438 => _1438.scriptTags]) !== true);
|
|
55146
55593
|
} catch (err) {
|
|
55147
55594
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
55148
|
-
return { success: false, fileType: "pdf", error:
|
|
55595
|
+
return { success: false, fileType: "pdf", error: _chunkILRCRR54cjs.sanitizeError.call(void 0, err), code: _chunkILRCRR54cjs.classifyError.call(void 0, err), isImageBased };
|
|
55149
55596
|
}
|
|
55150
55597
|
}
|
|
55151
55598
|
async function parseXlsx(buffer, options) {
|
|
55152
55599
|
try {
|
|
55153
55600
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
55154
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
55601
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1439 => _1439.pageCount]) };
|
|
55155
55602
|
} catch (err) {
|
|
55156
|
-
return { success: false, fileType: "xlsx", error:
|
|
55603
|
+
return { success: false, fileType: "xlsx", error: _chunkILRCRR54cjs.sanitizeError.call(void 0, err), code: _chunkILRCRR54cjs.classifyError.call(void 0, err) };
|
|
55157
55604
|
}
|
|
55158
55605
|
}
|
|
55159
55606
|
async function parseXls(buffer, options) {
|
|
55160
55607
|
try {
|
|
55161
55608
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
55162
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
55609
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1440 => _1440.pageCount]) };
|
|
55163
55610
|
} catch (err) {
|
|
55164
|
-
return { success: false, fileType: "xls", error:
|
|
55611
|
+
return { success: false, fileType: "xls", error: _chunkILRCRR54cjs.sanitizeError.call(void 0, err), code: _chunkILRCRR54cjs.classifyError.call(void 0, err) };
|
|
55165
55612
|
}
|
|
55166
55613
|
}
|
|
55167
55614
|
async function parseDocx(buffer, options) {
|
|
55168
55615
|
try {
|
|
55169
55616
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
55170
|
-
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
55617
|
+
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1441 => _1441.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1442 => _1442.pageCount]) }, _optionalChain([options, 'optionalAccess', _1443 => _1443.scriptTags]) === false);
|
|
55171
55618
|
} catch (err) {
|
|
55172
|
-
return { success: false, fileType: "docx", error:
|
|
55619
|
+
return { success: false, fileType: "docx", error: _chunkILRCRR54cjs.sanitizeError.call(void 0, err), code: _chunkILRCRR54cjs.classifyError.call(void 0, err) };
|
|
55173
55620
|
}
|
|
55174
55621
|
}
|
|
55175
55622
|
async function parsePptx(buffer, options) {
|
|
55176
55623
|
try {
|
|
55177
55624
|
const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
|
|
55178
|
-
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
55625
|
+
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1444 => _1444.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1445 => _1445.pageCount]) }, _optionalChain([options, 'optionalAccess', _1446 => _1446.scriptTags]) === false);
|
|
55179
55626
|
} catch (err) {
|
|
55180
|
-
return { success: false, fileType: "pptx", error:
|
|
55627
|
+
return { success: false, fileType: "pptx", error: _chunkILRCRR54cjs.sanitizeError.call(void 0, err), code: _chunkILRCRR54cjs.classifyError.call(void 0, err) };
|
|
55181
55628
|
}
|
|
55182
55629
|
}
|
|
55183
55630
|
async function parseHwpml(buffer, options) {
|
|
55184
55631
|
try {
|
|
55185
55632
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
55186
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
55633
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1447 => _1447.pageCount]) };
|
|
55187
55634
|
} catch (err) {
|
|
55188
|
-
return { success: false, fileType: "hwpml", error:
|
|
55635
|
+
return { success: false, fileType: "hwpml", error: _chunkILRCRR54cjs.sanitizeError.call(void 0, err), code: _chunkILRCRR54cjs.classifyError.call(void 0, err) };
|
|
55189
55636
|
}
|
|
55190
55637
|
}
|
|
55191
55638
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
55192
55639
|
let buffer;
|
|
55193
55640
|
if (typeof input === "string") {
|
|
55194
55641
|
const buf = await _promises.readFile.call(void 0, input);
|
|
55195
|
-
buffer =
|
|
55642
|
+
buffer = _chunkILRCRR54cjs.toArrayBuffer.call(void 0, buf);
|
|
55196
55643
|
} else if (Buffer.isBuffer(input)) {
|
|
55197
|
-
buffer =
|
|
55644
|
+
buffer = _chunkILRCRR54cjs.toArrayBuffer.call(void 0, input);
|
|
55198
55645
|
} else {
|
|
55199
55646
|
buffer = input;
|
|
55200
55647
|
}
|
|
@@ -55220,7 +55667,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
55220
55667
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
55221
55668
|
}
|
|
55222
55669
|
const fill = fillFormFields(parsed.blocks, values);
|
|
55223
|
-
const markdown =
|
|
55670
|
+
const markdown = _chunk5N6MENH6cjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
55224
55671
|
if (outputFormat === "hwpx") {
|
|
55225
55672
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
55226
55673
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -55319,5 +55766,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
55319
55766
|
|
|
55320
55767
|
|
|
55321
55768
|
|
|
55322
|
-
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 =
|
|
55769
|
+
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 = _chunkILRCRR54cjs.VERSION; exports.ValueCursor = ValueCursor; exports.agencyNames = agencyNames; exports.agencyStyle = agencyStyle; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunk5N6MENH6cjs.blocksToMarkdown; exports.blocksToPages = _chunkKXTCBOUCcjs.blocksToPages; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.chooseTableRepresentation = chooseTableRepresentation; exports.classifyTable = classifyTable; exports.classifyTableTree = classifyTableTree; exports.collectTableBlocks = collectTableBlocks; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractClickHereFields = extractClickHereFields; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.extractRenderedRegions = extractRenderedRegions; exports.extractTables = extractTables; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.flattenLayoutTables = _chunk5N6MENH6cjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunk5N6MENH6cjs.hasStructuredCellContent; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.lintMuncheText = lintMuncheText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.muncheLintWarnings = muncheLintWarnings; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parsePptx = parsePptx; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderDocument = renderDocument; exports.renderDocumentToScene = renderDocumentToScene; exports.renderHtml = renderHtml; exports.renderHwp5Pages = renderHwp5Pages; exports.renderHwpxToSvg = renderHwpxToSvg; exports.renderSceneToHtml = renderSceneToHtml; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.usesGaejosikMunche = usesGaejosikMunche; exports.validateHwpx = validateHwpx;
|
|
55323
55770
|
//# sourceMappingURL=index.cjs.map
|