kordoc 4.22.4 → 4.22.5
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 +8 -7
- package/dist/{-HAK3YFWW.js → -WFRWBH7T.js} +11 -11
- package/dist/{chunk-F3AWNFMO.js → chunk-2L3Q7REU.js} +3 -3
- package/dist/{chunk-CWBH66IQ.js → chunk-35ZHXEJA.js} +3 -3
- package/dist/{chunk-Q6SVCBMK.js → chunk-3BR7VKWL.js} +2 -2
- package/dist/{chunk-G2325K2F.js → chunk-3G3TLZDK.js} +2 -2
- package/dist/{chunk-36DK6AOX.js → chunk-3YEL7P4L.js} +2 -2
- package/dist/{chunk-S45M7IQH.cjs → chunk-4SUB43EJ.cjs} +24 -24
- package/dist/{chunk-S45M7IQH.cjs.map → chunk-4SUB43EJ.cjs.map} +1 -1
- package/dist/{chunk-5ARHF54C.js → chunk-4TWN7PWJ.js} +2 -2
- package/dist/{chunk-WCTC3LSV.js → chunk-52HIK4C2.js} +4 -3
- package/dist/chunk-52HIK4C2.js.map +1 -0
- package/dist/{chunk-3TUJ34V7.js → chunk-63N6CEJE.js} +2 -2
- package/dist/{chunk-DEFT7Z3B.js → chunk-6MCC2XNB.js} +2 -2
- package/dist/{chunk-C5J5LDWM.js → chunk-6MQKNB6K.js} +4 -3
- package/dist/chunk-6MQKNB6K.js.map +1 -0
- package/dist/{chunk-MJSHXESK.cjs → chunk-AS25R4EU.cjs} +2 -2
- package/dist/{chunk-MJSHXESK.cjs.map → chunk-AS25R4EU.cjs.map} +1 -1
- package/dist/{chunk-AYV5VRHL.js → chunk-C3REGEQO.js} +2 -2
- package/dist/{chunk-4X7AR4EH.cjs → chunk-C6B5GWN7.cjs} +24 -23
- package/dist/chunk-C6B5GWN7.cjs.map +1 -0
- package/dist/{chunk-A3SKXHAN.js → chunk-CO7O3ZT6.js} +2 -2
- package/dist/{chunk-WNW77CAY.js → chunk-CRSTBATY.js} +2 -2
- package/dist/{chunk-MYTMZSQO.js → chunk-CW67DAAH.js} +2 -2
- package/dist/{chunk-RPSILMQY.js → chunk-DN55FTJP.js} +2 -2
- package/dist/{chunk-HN3QMHTT.js → chunk-HLPMC7L4.js} +5 -4
- package/dist/chunk-HLPMC7L4.js.map +1 -0
- package/dist/{chunk-LVVSMYG4.js → chunk-LE4VHWIT.js} +4 -4
- package/dist/{chunk-VXQWAPC6.cjs → chunk-N6KXGIIN.cjs} +3 -3
- package/dist/{chunk-VXQWAPC6.cjs.map → chunk-N6KXGIIN.cjs.map} +1 -1
- package/dist/{chunk-G4KNI7EO.js → chunk-PSORL4PA.js} +11 -11
- package/dist/{chunk-FAFSBCU2.js → chunk-RYKDIUHT.js} +4 -4
- package/dist/{chunk-SSL3TKJY.js → chunk-SETAYS6P.js} +2 -2
- package/dist/{chunk-Q65HT2BL.js → chunk-T7OZ7X6A.js} +2 -2
- package/dist/{chunk-UJVVL6BI.js → chunk-TOUJCO2P.js} +2 -2
- package/dist/{chunk-EVL6HZQL.js → chunk-U3GUZQ54.js} +1286 -1279
- package/dist/chunk-U3GUZQ54.js.map +1 -0
- package/dist/{chunk-EYQLJ57Y.cjs → chunk-UCK6WGHY.cjs} +3 -3
- package/dist/{chunk-EYQLJ57Y.cjs.map → chunk-UCK6WGHY.cjs.map} +1 -1
- package/dist/{chunk-K2NWHLCD.cjs → chunk-YG4GFQB7.cjs} +6 -6
- package/dist/{chunk-K2NWHLCD.cjs.map → chunk-YG4GFQB7.cjs.map} +1 -1
- package/dist/chunks-NXABWR6G.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-PWAUR5PF.js → formula-FSVHUQ6Y.js} +4 -4
- package/dist/{formula-KSTY73DQ.js → formula-L625ULJP.js} +3 -3
- package/dist/{formula-JGFYGFYX.cjs → formula-QZGTF3DZ.cjs} +9 -9
- package/dist/{formula-JGFYGFYX.cjs.map → formula-QZGTF3DZ.cjs.map} +1 -1
- package/dist/{image-ocr-UULNAC5Y.cjs → image-ocr-AELVAU75.cjs} +17 -17
- package/dist/{image-ocr-UULNAC5Y.cjs.map → image-ocr-AELVAU75.cjs.map} +1 -1
- package/dist/{image-ocr-RASJHOAK.js → image-ocr-KE3RUS3R.js} +6 -6
- package/dist/{image-ocr-RPBPO3VT.js → image-ocr-QTZNBP5V.js} +9 -9
- package/dist/index.cjs +790 -782
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +249 -241
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-ZPQ4IFT7.js → model-bundle-F6TU6ZAV.js} +5 -5
- package/dist/{models-YJQ5VHOR.js → models-ZHNNVH2W.js} +5 -5
- package/dist/{parse-worker-v2-7PNZYASF.js → parse-worker-v2-KQRG3NQO.js} +12 -12
- package/dist/{parser-ER3VLB37.js → parser-RVMH4PUB.js} +133 -20
- package/dist/parser-RVMH4PUB.js.map +1 -0
- package/dist/{parser-DR6ZHYEB.js → parser-WBKVRDPV.js} +129 -16
- package/dist/parser-WBKVRDPV.js.map +1 -0
- package/dist/{parser-ZFXVZZKQ.cjs → parser-WNDH2X6N.cjs} +397 -284
- package/dist/parser-WNDH2X6N.cjs.map +1 -0
- package/dist/pdf-ocr-IOUZTPPH.cjs +31 -0
- package/dist/{pdf-ocr-QWTGWYQT.cjs.map → pdf-ocr-IOUZTPPH.cjs.map} +1 -1
- package/dist/{pdf-ocr-BYT7XVID.js → pdf-ocr-X5XLGL5J.js} +6 -6
- package/dist/{pdf-ocr-DRQN5BXA.js → pdf-ocr-ZP2CUWSO.js} +9 -9
- package/dist/{profile-io-3QYTSPNH.js → profile-io-B4VSI4LW.js} +3 -3
- package/dist/{rasterize-LPLWCBXV.js → rasterize-Y7NVUVXU.js} +3 -3
- package/dist/{redact-doc-HDA6ZG3N.js → redact-doc-GIBTFWCO.js} +11 -11
- package/dist/{render-MYZGD3SB.js → render-JVCGYRRO.js} +7 -7
- package/dist/seal-WNX2ZJTK.js +10 -0
- package/dist/{setup-EF5TQVAI.js → setup-7L7EQPMG.js} +3 -3
- package/dist/visual-VPWPXIHN.js +21 -0
- package/dist/{watch-PM5PRSFW.js → watch-VYMFGX72.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-4X7AR4EH.cjs.map +0 -1
- package/dist/chunk-C5J5LDWM.js.map +0 -1
- package/dist/chunk-EVL6HZQL.js.map +0 -1
- package/dist/chunk-HN3QMHTT.js.map +0 -1
- package/dist/chunk-WCTC3LSV.js.map +0 -1
- package/dist/chunks-3N7OFSA4.js +0 -10
- package/dist/parser-DR6ZHYEB.js.map +0 -1
- package/dist/parser-ER3VLB37.js.map +0 -1
- package/dist/parser-ZFXVZZKQ.cjs.map +0 -1
- package/dist/pdf-ocr-QWTGWYQT.cjs +0 -31
- package/dist/seal-XA5V6A6V.js +0 -10
- package/dist/visual-DB7NJOID.js +0 -21
- /package/dist/{-HAK3YFWW.js.map → -WFRWBH7T.js.map} +0 -0
- /package/dist/{chunk-F3AWNFMO.js.map → chunk-2L3Q7REU.js.map} +0 -0
- /package/dist/{chunk-CWBH66IQ.js.map → chunk-35ZHXEJA.js.map} +0 -0
- /package/dist/{chunk-Q6SVCBMK.js.map → chunk-3BR7VKWL.js.map} +0 -0
- /package/dist/{chunk-G2325K2F.js.map → chunk-3G3TLZDK.js.map} +0 -0
- /package/dist/{chunk-36DK6AOX.js.map → chunk-3YEL7P4L.js.map} +0 -0
- /package/dist/{chunk-5ARHF54C.js.map → chunk-4TWN7PWJ.js.map} +0 -0
- /package/dist/{chunk-3TUJ34V7.js.map → chunk-63N6CEJE.js.map} +0 -0
- /package/dist/{chunk-DEFT7Z3B.js.map → chunk-6MCC2XNB.js.map} +0 -0
- /package/dist/{chunk-AYV5VRHL.js.map → chunk-C3REGEQO.js.map} +0 -0
- /package/dist/{chunk-A3SKXHAN.js.map → chunk-CO7O3ZT6.js.map} +0 -0
- /package/dist/{chunk-WNW77CAY.js.map → chunk-CRSTBATY.js.map} +0 -0
- /package/dist/{chunk-MYTMZSQO.js.map → chunk-CW67DAAH.js.map} +0 -0
- /package/dist/{chunk-RPSILMQY.js.map → chunk-DN55FTJP.js.map} +0 -0
- /package/dist/{chunk-LVVSMYG4.js.map → chunk-LE4VHWIT.js.map} +0 -0
- /package/dist/{chunk-G4KNI7EO.js.map → chunk-PSORL4PA.js.map} +0 -0
- /package/dist/{chunk-FAFSBCU2.js.map → chunk-RYKDIUHT.js.map} +0 -0
- /package/dist/{chunk-SSL3TKJY.js.map → chunk-SETAYS6P.js.map} +0 -0
- /package/dist/{chunk-Q65HT2BL.js.map → chunk-T7OZ7X6A.js.map} +0 -0
- /package/dist/{chunk-UJVVL6BI.js.map → chunk-TOUJCO2P.js.map} +0 -0
- /package/dist/{chunks-3N7OFSA4.js.map → chunks-NXABWR6G.js.map} +0 -0
- /package/dist/{formula-PWAUR5PF.js.map → formula-FSVHUQ6Y.js.map} +0 -0
- /package/dist/{formula-KSTY73DQ.js.map → formula-L625ULJP.js.map} +0 -0
- /package/dist/{image-ocr-RASJHOAK.js.map → image-ocr-KE3RUS3R.js.map} +0 -0
- /package/dist/{image-ocr-RPBPO3VT.js.map → image-ocr-QTZNBP5V.js.map} +0 -0
- /package/dist/{model-bundle-ZPQ4IFT7.js.map → model-bundle-F6TU6ZAV.js.map} +0 -0
- /package/dist/{models-YJQ5VHOR.js.map → models-ZHNNVH2W.js.map} +0 -0
- /package/dist/{parse-worker-v2-7PNZYASF.js.map → parse-worker-v2-KQRG3NQO.js.map} +0 -0
- /package/dist/{pdf-ocr-BYT7XVID.js.map → pdf-ocr-X5XLGL5J.js.map} +0 -0
- /package/dist/{pdf-ocr-DRQN5BXA.js.map → pdf-ocr-ZP2CUWSO.js.map} +0 -0
- /package/dist/{profile-io-3QYTSPNH.js.map → profile-io-B4VSI4LW.js.map} +0 -0
- /package/dist/{rasterize-LPLWCBXV.js.map → rasterize-Y7NVUVXU.js.map} +0 -0
- /package/dist/{redact-doc-HDA6ZG3N.js.map → redact-doc-GIBTFWCO.js.map} +0 -0
- /package/dist/{render-MYZGD3SB.js.map → render-JVCGYRRO.js.map} +0 -0
- /package/dist/{seal-XA5V6A6V.js.map → seal-WNX2ZJTK.js.map} +0 -0
- /package/dist/{setup-EF5TQVAI.js.map → setup-7L7EQPMG.js.map} +0 -0
- /package/dist/{visual-DB7NJOID.js.map → visual-VPWPXIHN.js.map} +0 -0
- /package/dist/{watch-PM5PRSFW.js.map → watch-VYMFGX72.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkN6KXGIINcjs = require('./chunk-N6KXGIIN.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
@@ -37,7 +37,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _chunkYG4GFQB7cjs = require('./chunk-YG4GFQB7.cjs');
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
@@ -55,14 +55,14 @@ var _chunkK2NWHLCDcjs = require('./chunk-K2NWHLCD.cjs');
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
var
|
|
58
|
+
var _chunkAS25R4EUcjs = require('./chunk-AS25R4EU.cjs');
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
62
62
|
|
|
63
63
|
// src/plain-markdown.ts
|
|
64
64
|
function toPlainMarkdown(md2) {
|
|
65
|
-
return
|
|
65
|
+
return _chunkYG4GFQB7cjs.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();
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
// src/html-tables.ts
|
|
@@ -596,9 +596,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
596
596
|
}
|
|
597
597
|
|
|
598
598
|
// src/hwpx/parser-shared.ts
|
|
599
|
-
var MAX_DECOMPRESS_SIZE =
|
|
599
|
+
var MAX_DECOMPRESS_SIZE = _chunkAS25R4EUcjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
600
600
|
var MAX_ZIP_ENTRIES = 500;
|
|
601
|
-
var ZipBombError = class extends
|
|
601
|
+
var ZipBombError = class extends _chunkAS25R4EUcjs.KordocError {
|
|
602
602
|
constructor(message) {
|
|
603
603
|
super(message);
|
|
604
604
|
this.name = "ZipBombError";
|
|
@@ -648,7 +648,7 @@ function createSectionShared() {
|
|
|
648
648
|
function createXmlParser(warnings) {
|
|
649
649
|
return new (0, _xmldom.DOMParser)({
|
|
650
650
|
onError(level, msg2) {
|
|
651
|
-
if (level === "fatalError") throw new (0,
|
|
651
|
+
if (level === "fatalError") throw new (0, _chunkAS25R4EUcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
652
652
|
_optionalChain([warnings, 'optionalAccess', _5 => _5.push, 'call', _6 => _6({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
653
653
|
}
|
|
654
654
|
});
|
|
@@ -683,13 +683,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
683
683
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
684
684
|
const checksumType = attrOf(inner, "checksum-type");
|
|
685
685
|
if (algorithm !== AES256_CBC) {
|
|
686
|
-
throw new (0,
|
|
686
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
687
687
|
}
|
|
688
688
|
if (startKey !== START_KEY_SHA256) {
|
|
689
|
-
throw new (0,
|
|
689
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
690
690
|
}
|
|
691
691
|
if (!_optionalChain([checksumType, 'optionalAccess', _10 => _10.endsWith, 'call', _11 => _11(CHECKSUM_SHA256_1K)])) {
|
|
692
|
-
throw new (0,
|
|
692
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
693
693
|
}
|
|
694
694
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
695
695
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -697,10 +697,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
697
697
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
698
698
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
699
699
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
700
|
-
throw new (0,
|
|
700
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
701
701
|
}
|
|
702
702
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
703
|
-
throw new (0,
|
|
703
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
704
704
|
}
|
|
705
705
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
706
706
|
}
|
|
@@ -734,12 +734,12 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
734
734
|
for (const entry of entries) {
|
|
735
735
|
const file = zip.file(entry.path);
|
|
736
736
|
if (!file) {
|
|
737
|
-
throw new (0,
|
|
737
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
738
738
|
}
|
|
739
739
|
const raw = await readZipEntry(file, "uint8array", used);
|
|
740
740
|
const plain4 = decryptEntry(Buffer.from(raw.buffer, raw.byteOffset, raw.length), entry, startKey);
|
|
741
741
|
if (!plain4) {
|
|
742
|
-
throw new (0,
|
|
742
|
+
throw new (0, _chunkAS25R4EUcjs.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.");
|
|
743
743
|
}
|
|
744
744
|
used += plain4.length;
|
|
745
745
|
if (used > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
@@ -805,10 +805,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
805
805
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _12 => _12.total]));
|
|
806
806
|
if (decompressed) {
|
|
807
807
|
decompressed.total += xml.length * 2;
|
|
808
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
808
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkAS25R4EUcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
809
809
|
}
|
|
810
810
|
const parser = createXmlParser();
|
|
811
|
-
const doc = parser.parseFromString(
|
|
811
|
+
const doc = parser.parseFromString(_chunkAS25R4EUcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
812
812
|
if (!doc.documentElement) continue;
|
|
813
813
|
const domDoc = doc;
|
|
814
814
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -1021,9 +1021,9 @@ function detectHwpxHeadings(blocks, styleMap, tocTexts) {
|
|
|
1021
1021
|
let level = 0;
|
|
1022
1022
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _21 => _21.style, 'optionalAccess', _22 => _22.fontSize])) {
|
|
1023
1023
|
const ratio = block.style.fontSize / baseFontSize;
|
|
1024
|
-
if (ratio >=
|
|
1025
|
-
else if (ratio >=
|
|
1026
|
-
else if (ratio >=
|
|
1024
|
+
if (ratio >= _chunkYG4GFQB7cjs.HEADING_RATIO_H1) level = 1;
|
|
1025
|
+
else if (ratio >= _chunkYG4GFQB7cjs.HEADING_RATIO_H2) level = 2;
|
|
1026
|
+
else if (ratio >= _chunkYG4GFQB7cjs.HEADING_RATIO_H3) level = 3;
|
|
1027
1027
|
}
|
|
1028
1028
|
const compactText = text.replace(/\s+/g, "");
|
|
1029
1029
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1758,7 +1758,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1758
1758
|
|
|
1759
1759
|
// src/hwpx/table-build.ts
|
|
1760
1760
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1761
|
-
const table2 =
|
|
1761
|
+
const table2 = _chunkYG4GFQB7cjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1762
1762
|
if (state.caption) table2.caption = state.caption;
|
|
1763
1763
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
1764
1764
|
if (_optionalChain([state, 'access', _32 => _32.captionBlocks, 'optionalAccess', _33 => _33.length])) table2.captionBlocks = state.captionBlocks;
|
|
@@ -1787,7 +1787,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1787
1787
|
for (const src of row) {
|
|
1788
1788
|
if (!src.edges || src.rowAddr === void 0 || src.colAddr === void 0) continue;
|
|
1789
1789
|
const cand = _optionalChain([table2, 'access', _37 => _37.cells, 'access', _38 => _38[src.rowAddr], 'optionalAccess', _39 => _39[src.colAddr]]);
|
|
1790
|
-
if (cand && anchors2.includes(cand))
|
|
1790
|
+
if (cand && anchors2.includes(cand)) _chunkYG4GFQB7cjs.CELL_EDGES.set(cand, src.edges);
|
|
1791
1791
|
}
|
|
1792
1792
|
}
|
|
1793
1793
|
const claimed = /* @__PURE__ */ new Set();
|
|
@@ -1837,7 +1837,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1837
1837
|
const cell2 = parentTable.cell;
|
|
1838
1838
|
(cell2.blocks ??= []).push(block);
|
|
1839
1839
|
cell2.hasStructure = true;
|
|
1840
|
-
let flat =
|
|
1840
|
+
let flat = _chunkYG4GFQB7cjs.convertTableToText.call(void 0, newTable.rows);
|
|
1841
1841
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1842
1842
|
if (flat) {
|
|
1843
1843
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -2071,7 +2071,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2071
2071
|
const tkids = rc.childNodes;
|
|
2072
2072
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _47 => _47.length]), () => ( 0))); k++) {
|
|
2073
2073
|
const tk = tkids[k];
|
|
2074
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
2074
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunkYG4GFQB7cjs.escapeLiteralTags.call(void 0, _chunkYG4GFQB7cjs.escapeLiteralDollar.call(void 0, tk.textContent || ""));
|
|
2075
2075
|
else if (tk.nodeType === 1) {
|
|
2076
2076
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
2077
2077
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -2091,7 +2091,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2091
2091
|
const span2 = { text };
|
|
2092
2092
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span2.code = true;
|
|
2093
2093
|
else {
|
|
2094
|
-
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text =
|
|
2094
|
+
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text = _chunkYG4GFQB7cjs.wrapScript.call(void 0, text, cp.script);
|
|
2095
2095
|
if (_optionalChain([cp, 'optionalAccess', _49 => _49.bold])) span2.bold = true;
|
|
2096
2096
|
if (_optionalChain([cp, 'optionalAccess', _50 => _50.italic])) span2.italic = true;
|
|
2097
2097
|
if (_optionalChain([cp, 'optionalAccess', _51 => _51.strike])) span2.strike = true;
|
|
@@ -2111,7 +2111,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2111
2111
|
}
|
|
2112
2112
|
}
|
|
2113
2113
|
if (requireMixed && !merged.some((s) => s.strike || s.underline) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
2114
|
-
for (const s of merged) s.text =
|
|
2114
|
+
for (const s of merged) s.text = _chunkYG4GFQB7cjs.tidyScriptTags.call(void 0, s.text);
|
|
2115
2115
|
return merged;
|
|
2116
2116
|
}
|
|
2117
2117
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -2138,7 +2138,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2138
2138
|
// src/hwpx/section-walker.ts
|
|
2139
2139
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
2140
2140
|
const parser = createXmlParser(warnings);
|
|
2141
|
-
const doc = parser.parseFromString(
|
|
2141
|
+
const doc = parser.parseFromString(_chunkAS25R4EUcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2142
2142
|
if (!doc.documentElement) return [];
|
|
2143
2143
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
2144
2144
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2239,8 +2239,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2239
2239
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2240
2240
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2241
2241
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2242
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2243
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2242
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkYG4GFQB7cjs.MAX_COLS);
|
|
2243
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkYG4GFQB7cjs.MAX_ROWS);
|
|
2244
2244
|
}
|
|
2245
2245
|
break;
|
|
2246
2246
|
case "p": {
|
|
@@ -2563,7 +2563,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2563
2563
|
const sink = [];
|
|
2564
2564
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2565
2565
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2566
|
-
let flat =
|
|
2566
|
+
let flat = _chunkYG4GFQB7cjs.convertTableToText.call(void 0, st.rows);
|
|
2567
2567
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2568
2568
|
const built = [];
|
|
2569
2569
|
completeTable(st, [], built, ctx);
|
|
@@ -2727,7 +2727,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2727
2727
|
let url = (ch.textContent || "").trim();
|
|
2728
2728
|
if (!url) continue;
|
|
2729
2729
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2730
|
-
const safe =
|
|
2730
|
+
const safe = _chunkAS25R4EUcjs.sanitizeHref.call(void 0, url);
|
|
2731
2731
|
if (safe) return safe;
|
|
2732
2732
|
}
|
|
2733
2733
|
return void 0;
|
|
@@ -2883,7 +2883,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2883
2883
|
_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" })]);
|
|
2884
2884
|
}
|
|
2885
2885
|
} else {
|
|
2886
|
-
text +=
|
|
2886
|
+
text += _chunkYG4GFQB7cjs.escapeLiteralTags.call(void 0, _chunkYG4GFQB7cjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, "")));
|
|
2887
2887
|
}
|
|
2888
2888
|
continue;
|
|
2889
2889
|
}
|
|
@@ -2936,7 +2936,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2936
2936
|
case "hyperlink": {
|
|
2937
2937
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2938
2938
|
if (url) {
|
|
2939
|
-
const safe =
|
|
2939
|
+
const safe = _chunkAS25R4EUcjs.sanitizeHref.call(void 0, url);
|
|
2940
2940
|
if (safe) href = safe;
|
|
2941
2941
|
}
|
|
2942
2942
|
walk(child, depth + 1);
|
|
@@ -3030,7 +3030,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3030
3030
|
walk(child, depth + 1);
|
|
3031
3031
|
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
3032
3032
|
const added = text.slice(start);
|
|
3033
|
-
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) +
|
|
3033
|
+
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) + _chunkYG4GFQB7cjs.wrapScript.call(void 0, added, script);
|
|
3034
3034
|
}
|
|
3035
3035
|
break;
|
|
3036
3036
|
}
|
|
@@ -3053,7 +3053,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3053
3053
|
}
|
|
3054
3054
|
if (applied.length) href = void 0;
|
|
3055
3055
|
}
|
|
3056
|
-
text =
|
|
3056
|
+
text = _chunkYG4GFQB7cjs.tidyScriptTags.call(void 0, text);
|
|
3057
3057
|
const toc = takeTocLeaders(text);
|
|
3058
3058
|
text = toc.text;
|
|
3059
3059
|
const tocEntry = toc.tocEntry;
|
|
@@ -3167,7 +3167,7 @@ function decompressStream(data) {
|
|
|
3167
3167
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
3168
3168
|
}
|
|
3169
3169
|
function parseFileHeader(data) {
|
|
3170
|
-
if (data.length < 40) throw new (0,
|
|
3170
|
+
if (data.length < 40) throw new (0, _chunkAS25R4EUcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
3171
3171
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
3172
3172
|
return {
|
|
3173
3173
|
signature: sig,
|
|
@@ -3694,13 +3694,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3694
3694
|
}
|
|
3695
3695
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3696
3696
|
for (const path of allCandidates) {
|
|
3697
|
-
if (
|
|
3697
|
+
if (_chunkAS25R4EUcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3698
3698
|
const file = zip.file(path);
|
|
3699
3699
|
if (!file) continue;
|
|
3700
3700
|
try {
|
|
3701
3701
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3702
3702
|
decompressed.total += data.length;
|
|
3703
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3703
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkAS25R4EUcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3704
3704
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3705
3705
|
const extMime = imageExtToMime(ext);
|
|
3706
3706
|
const mimeType = extMime === "image/svg+xml" && /<script|\son[a-z]+\s*=|javascript:|<foreignObject/i.test(Buffer.from(data).toString("utf8")) ? "application/octet-stream" : extMime;
|
|
@@ -3711,7 +3711,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3711
3711
|
usedPaths.add(path);
|
|
3712
3712
|
break;
|
|
3713
3713
|
} catch (err) {
|
|
3714
|
-
if (err instanceof
|
|
3714
|
+
if (err instanceof _chunkAS25R4EUcjs.KordocError) throw err;
|
|
3715
3715
|
}
|
|
3716
3716
|
}
|
|
3717
3717
|
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" })]);
|
|
@@ -3731,13 +3731,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3731
3731
|
if (sweepUnreferenced) {
|
|
3732
3732
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3733
3733
|
for (const file of binEntries) {
|
|
3734
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3734
|
+
if (file.dir || usedPaths.has(file.name) || _chunkAS25R4EUcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3735
3735
|
const basename = file.name.slice(file.name.lastIndexOf("/") + 1);
|
|
3736
3736
|
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;
|
|
3737
3737
|
try {
|
|
3738
3738
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3739
3739
|
decompressed.total += data.length;
|
|
3740
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3740
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkAS25R4EUcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3741
3741
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3742
3742
|
let mimeType = imageExtToMime(ext);
|
|
3743
3743
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3751,7 +3751,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3751
3751
|
images.push(img);
|
|
3752
3752
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3753
3753
|
} catch (err) {
|
|
3754
|
-
if (err instanceof
|
|
3754
|
+
if (err instanceof _chunkAS25R4EUcjs.KordocError) throw err;
|
|
3755
3755
|
_optionalChain([warnings, 'optionalAccess', _138 => _138.push, 'call', _139 => _139({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3756
3756
|
}
|
|
3757
3757
|
}
|
|
@@ -3802,7 +3802,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3802
3802
|
}
|
|
3803
3803
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3804
3804
|
const name = new TextDecoder().decode(nameBytes);
|
|
3805
|
-
if (
|
|
3805
|
+
if (_chunkAS25R4EUcjs.isPathTraversal.call(void 0, name)) {
|
|
3806
3806
|
pos = fileStart + compSize;
|
|
3807
3807
|
continue;
|
|
3808
3808
|
}
|
|
@@ -3820,7 +3820,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3820
3820
|
continue;
|
|
3821
3821
|
}
|
|
3822
3822
|
totalDecompressed += content.length * 2;
|
|
3823
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3823
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkAS25R4EUcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3824
3824
|
sectionNum++;
|
|
3825
3825
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3826
3826
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3829,9 +3829,9 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3829
3829
|
continue;
|
|
3830
3830
|
}
|
|
3831
3831
|
}
|
|
3832
|
-
if (blocks.length === 0) throw new (0,
|
|
3832
|
+
if (blocks.length === 0) throw new (0, _chunkAS25R4EUcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3833
3833
|
applyPageText(blocks, shared);
|
|
3834
|
-
const markdown =
|
|
3834
|
+
const markdown = _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _140 => _140.tableFormat]) });
|
|
3835
3835
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3836
3836
|
}
|
|
3837
3837
|
async function readKordocLayout(zip) {
|
|
@@ -3856,11 +3856,11 @@ async function resolveSectionPaths(zip) {
|
|
|
3856
3856
|
if (paths.length > 0) return paths;
|
|
3857
3857
|
}
|
|
3858
3858
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3859
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3859
|
+
return sectionFiles.map((f) => f.name).sort(_chunkAS25R4EUcjs.compareSectionPaths);
|
|
3860
3860
|
}
|
|
3861
3861
|
function parseSectionPathsFromManifest(xml) {
|
|
3862
3862
|
const parser = createXmlParser();
|
|
3863
|
-
const doc = parser.parseFromString(
|
|
3863
|
+
const doc = parser.parseFromString(_chunkAS25R4EUcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3864
3864
|
const opf = "http://www.idpf.org/2007/opf/";
|
|
3865
3865
|
const namespacedItems = doc.getElementsByTagNameNS(opf, "item");
|
|
3866
3866
|
const namespacedSpine = doc.getElementsByTagNameNS(opf, "itemref");
|
|
@@ -3870,7 +3870,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3870
3870
|
for (let i = 0; i < items.length; i++) {
|
|
3871
3871
|
const item = items[i];
|
|
3872
3872
|
const id = item.getAttribute("id") || "";
|
|
3873
|
-
const href =
|
|
3873
|
+
const href = _chunkAS25R4EUcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3874
3874
|
if (id && href) idToHref.set(id, href);
|
|
3875
3875
|
}
|
|
3876
3876
|
if (spine.length > 0) {
|
|
@@ -3881,7 +3881,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3881
3881
|
}
|
|
3882
3882
|
if (ordered.length > 0) return ordered;
|
|
3883
3883
|
}
|
|
3884
|
-
return Array.from(idToHref.values()).sort(
|
|
3884
|
+
return Array.from(idToHref.values()).sort(_chunkAS25R4EUcjs.compareSectionPaths);
|
|
3885
3885
|
}
|
|
3886
3886
|
|
|
3887
3887
|
// src/hwpx/metadata.ts
|
|
@@ -3893,7 +3893,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3893
3893
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _144 => _144.total]));
|
|
3894
3894
|
if (decompressed) {
|
|
3895
3895
|
decompressed.total += xml.length * 2;
|
|
3896
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3896
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkAS25R4EUcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3897
3897
|
}
|
|
3898
3898
|
return xml;
|
|
3899
3899
|
};
|
|
@@ -3915,7 +3915,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3915
3915
|
}
|
|
3916
3916
|
}
|
|
3917
3917
|
function parseOpfMetadata(xml, metadata) {
|
|
3918
|
-
const root = createXmlParser().parseFromString(
|
|
3918
|
+
const root = createXmlParser().parseFromString(_chunkAS25R4EUcjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3919
3919
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3920
3920
|
if (!md2) return;
|
|
3921
3921
|
let title;
|
|
@@ -3948,7 +3948,7 @@ function isoDate(s) {
|
|
|
3948
3948
|
}
|
|
3949
3949
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3950
3950
|
const parser = createXmlParser();
|
|
3951
|
-
const doc = parser.parseFromString(
|
|
3951
|
+
const doc = parser.parseFromString(_chunkAS25R4EUcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3952
3952
|
if (!doc.documentElement) return;
|
|
3953
3953
|
const getText = (tagNames) => {
|
|
3954
3954
|
for (const tag of tagNames) {
|
|
@@ -3987,7 +3987,7 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3987
3987
|
}
|
|
3988
3988
|
}
|
|
3989
3989
|
async function parseHwpxDocument(buffer, options) {
|
|
3990
|
-
|
|
3990
|
+
_chunkAS25R4EUcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3991
3991
|
let zip;
|
|
3992
3992
|
try {
|
|
3993
3993
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3996,7 +3996,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3996
3996
|
}
|
|
3997
3997
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3998
3998
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3999
|
-
throw new (0,
|
|
3999
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
4000
4000
|
}
|
|
4001
4001
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
4002
4002
|
if (manifestFile) {
|
|
@@ -4016,7 +4016,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4016
4016
|
}
|
|
4017
4017
|
const hpfFile = zip.file("Contents/content.hpf");
|
|
4018
4018
|
const hpf = hpfFile ? await readZipEntry(hpfFile, "text").catch(() => "") : "";
|
|
4019
|
-
throw new (0,
|
|
4019
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(
|
|
4020
4020
|
/\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."
|
|
4021
4021
|
);
|
|
4022
4022
|
}
|
|
@@ -4028,7 +4028,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4028
4028
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
4029
4029
|
const warnings = [];
|
|
4030
4030
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
4031
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
4031
|
+
if (sectionPaths.length === 0) throw new (0, _chunkAS25R4EUcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4032
4032
|
let allBlocks = [];
|
|
4033
4033
|
const shared = createSectionShared();
|
|
4034
4034
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -4072,10 +4072,10 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4072
4072
|
const blocks = allBlocks;
|
|
4073
4073
|
applyPageText(blocks, shared);
|
|
4074
4074
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _173 => _173.pages]), shared.track.deletedImageRefs);
|
|
4075
|
-
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks :
|
|
4075
|
+
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks : _chunkYG4GFQB7cjs.unframeLayoutTables.call(void 0, blocks, !!_optionalChain([options, 'optionalAccess', _175 => _175.keepTrailingEmptyCols]));
|
|
4076
4076
|
detectHwpxHeadings(shown, styleMap, shared.tocTexts);
|
|
4077
4077
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4078
|
-
const markdown =
|
|
4078
|
+
const markdown = _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, shown, { tableFormat: _optionalChain([options, 'optionalAccess', _176 => _176.tableFormat]) });
|
|
4079
4079
|
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 };
|
|
4080
4080
|
}
|
|
4081
4081
|
|
|
@@ -4842,7 +4842,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4842
4842
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4843
4843
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4844
4844
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4845
|
-
const wrong = () => new (0,
|
|
4845
|
+
const wrong = () => new (0, _chunkAS25R4EUcjs.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.");
|
|
4846
4846
|
let records;
|
|
4847
4847
|
try {
|
|
4848
4848
|
records = readRecords3(data);
|
|
@@ -4854,7 +4854,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4854
4854
|
}
|
|
4855
4855
|
function assertSupportedEncryptVersion(version) {
|
|
4856
4856
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4857
|
-
throw new (0,
|
|
4857
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(
|
|
4858
4858
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4859
4859
|
);
|
|
4860
4860
|
}
|
|
@@ -5297,7 +5297,7 @@ function emitParagraphBlocks(p) {
|
|
|
5297
5297
|
return blocks;
|
|
5298
5298
|
}
|
|
5299
5299
|
function tableFlatText(table2) {
|
|
5300
|
-
const flat =
|
|
5300
|
+
const flat = _chunkYG4GFQB7cjs.convertTableToText.call(void 0, table2.cells);
|
|
5301
5301
|
return table2.caption ? table2.caption + (flat ? "\n" + flat : "") : flat;
|
|
5302
5302
|
}
|
|
5303
5303
|
function blocksPlainText(blocks, sep) {
|
|
@@ -5378,8 +5378,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5378
5378
|
}
|
|
5379
5379
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5380
5380
|
for (const c of cells) {
|
|
5381
|
-
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1,
|
|
5382
|
-
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1,
|
|
5381
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunkYG4GFQB7cjs.MAX_ROWS));
|
|
5382
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunkYG4GFQB7cjs.MAX_COLS));
|
|
5383
5383
|
}
|
|
5384
5384
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5385
5385
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5387,12 +5387,12 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5387
5387
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5388
5388
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5389
5389
|
}
|
|
5390
|
-
const table2 =
|
|
5390
|
+
const table2 = _chunkYG4GFQB7cjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5391
5391
|
if (table2.rows === 0) return null;
|
|
5392
5392
|
for (const c of placed) {
|
|
5393
5393
|
if (c.edges) {
|
|
5394
5394
|
const at = _optionalChain([table2, 'access', _183 => _183.cells, 'access', _184 => _184[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _185 => _185[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
5395
|
-
if (at)
|
|
5395
|
+
if (at) _chunkYG4GFQB7cjs.CELL_EDGES.set(at, c.edges);
|
|
5396
5396
|
}
|
|
5397
5397
|
if (!_optionalChain([c, 'access', _186 => _186.blocks, 'optionalAccess', _187 => _187.length]) && !c.isHeader) continue;
|
|
5398
5398
|
const target = _optionalChain([table2, 'access', _188 => _188.cells, 'access', _189 => _189[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _190 => _190[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
@@ -5594,7 +5594,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5594
5594
|
continue;
|
|
5595
5595
|
}
|
|
5596
5596
|
if (!ctrl.href) continue;
|
|
5597
|
-
const href =
|
|
5597
|
+
const href = _chunkAS25R4EUcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5598
5598
|
if (!href) continue;
|
|
5599
5599
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK)) continue;
|
|
5600
5600
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5603,7 +5603,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5603
5603
|
}
|
|
5604
5604
|
if (text.includes(LITERAL_DOLLAR_MARK)) text = text.replaceAll(LITERAL_DOLLAR_MARK, "\\$");
|
|
5605
5605
|
text = resolveLiteralLt(text);
|
|
5606
|
-
text =
|
|
5606
|
+
text = _chunkYG4GFQB7cjs.tidyScriptTags.call(void 0, text);
|
|
5607
5607
|
const toc = takeTocLeaders(text);
|
|
5608
5608
|
text = toc.text;
|
|
5609
5609
|
let headingLevel = 0;
|
|
@@ -5823,7 +5823,7 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5823
5823
|
}
|
|
5824
5824
|
var A4_HEIGHT = 84188;
|
|
5825
5825
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5826
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5826
|
+
if (!cells.some((c) => c.pageSpanning)) _chunkYG4GFQB7cjs.markNonLayoutTable.call(void 0, table2);
|
|
5827
5827
|
}
|
|
5828
5828
|
function parseTableControl(ctrl, records, ctx) {
|
|
5829
5829
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
@@ -5835,8 +5835,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5835
5835
|
let tableIdx = -1;
|
|
5836
5836
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5837
5837
|
if (records[i2].tagId === TAG_TABLE && records[i2].level === directLevel && records[i2].data.length >= 8) {
|
|
5838
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5839
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5838
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkYG4GFQB7cjs.MAX_ROWS);
|
|
5839
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkYG4GFQB7cjs.MAX_COLS);
|
|
5840
5840
|
tableIdx = i2;
|
|
5841
5841
|
break;
|
|
5842
5842
|
}
|
|
@@ -5880,11 +5880,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5880
5880
|
return table3;
|
|
5881
5881
|
}
|
|
5882
5882
|
if (rows === 0 || cols === 0) {
|
|
5883
|
-
rows = Math.min(cells.length,
|
|
5883
|
+
rows = Math.min(cells.length, _chunkYG4GFQB7cjs.MAX_ROWS);
|
|
5884
5884
|
cols = 1;
|
|
5885
5885
|
}
|
|
5886
5886
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5887
|
-
const table2 =
|
|
5887
|
+
const table2 = _chunkYG4GFQB7cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5888
5888
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5889
5889
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
5890
5890
|
keepUnlessPageSpanning(table2, cells);
|
|
@@ -5903,8 +5903,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5903
5903
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5904
5904
|
const cs = rec.data.readUInt16LE(12);
|
|
5905
5905
|
const rs = rec.data.readUInt16LE(14);
|
|
5906
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5907
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5906
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkYG4GFQB7cjs.MAX_COLS);
|
|
5907
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkYG4GFQB7cjs.MAX_ROWS);
|
|
5908
5908
|
}
|
|
5909
5909
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5910
5910
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -6053,7 +6053,7 @@ function openHwp5Container(buffer, options) {
|
|
|
6053
6053
|
lenientCfb = parseLenientCfb(buffer);
|
|
6054
6054
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
6055
6055
|
} catch (e24) {
|
|
6056
|
-
throw new (0,
|
|
6056
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
6057
6057
|
}
|
|
6058
6058
|
}
|
|
6059
6059
|
const readRawStream = (path) => {
|
|
@@ -6064,14 +6064,14 @@ function openHwp5Container(buffer, options) {
|
|
|
6064
6064
|
return lenientCfb.findStream(path);
|
|
6065
6065
|
};
|
|
6066
6066
|
const headerData = readRawStream("/FileHeader");
|
|
6067
|
-
if (!headerData) throw new (0,
|
|
6067
|
+
if (!headerData) throw new (0, _chunkAS25R4EUcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6068
6068
|
const header = parseFileHeader(headerData);
|
|
6069
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
6070
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
6069
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkAS25R4EUcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
6070
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkAS25R4EUcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
6071
6071
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
6072
6072
|
if (encrypted) {
|
|
6073
6073
|
if (!_optionalChain([options, 'optionalAccess', _214 => _214.password])) {
|
|
6074
|
-
throw new (0,
|
|
6074
|
+
throw new (0, _chunkAS25R4EUcjs.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.");
|
|
6075
6075
|
}
|
|
6076
6076
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
6077
6077
|
}
|
|
@@ -6085,12 +6085,12 @@ function openHwp5Container(buffer, options) {
|
|
|
6085
6085
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
6086
6086
|
if (encrypted) {
|
|
6087
6087
|
const rawDocInfo = findStream("/DocInfo");
|
|
6088
|
-
if (!rawDocInfo) throw new (0,
|
|
6088
|
+
if (!rawDocInfo) throw new (0, _chunkAS25R4EUcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6089
6089
|
let docInfoData;
|
|
6090
6090
|
try {
|
|
6091
6091
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
6092
6092
|
} catch (e25) {
|
|
6093
|
-
throw new (0,
|
|
6093
|
+
throw new (0, _chunkAS25R4EUcjs.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.");
|
|
6094
6094
|
}
|
|
6095
6095
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
6096
6096
|
}
|
|
@@ -6115,10 +6115,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
6115
6115
|
try {
|
|
6116
6116
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
6117
6117
|
totalDecompressed += data.length;
|
|
6118
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6118
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkAS25R4EUcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6119
6119
|
out.push(readRecords(data));
|
|
6120
6120
|
} catch (secErr) {
|
|
6121
|
-
if (secErr instanceof
|
|
6121
|
+
if (secErr instanceof _chunkAS25R4EUcjs.KordocError) throw secErr;
|
|
6122
6122
|
out.push(null);
|
|
6123
6123
|
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" });
|
|
6124
6124
|
}
|
|
@@ -6138,7 +6138,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6138
6138
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
6139
6139
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
6140
6140
|
const sections = readHwp5SectionStreams(c);
|
|
6141
|
-
if (sections.length === 0) throw new (0,
|
|
6141
|
+
if (sections.length === 0) throw new (0, _chunkAS25R4EUcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
6142
6142
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
6143
6143
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
6144
6144
|
const sectionTableIds = [];
|
|
@@ -6182,7 +6182,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6182
6182
|
parsedSections++;
|
|
6183
6183
|
_optionalChain([options, 'optionalAccess', _219 => _219.onProgress, 'optionalCall', _220 => _220(parsedSections, sections.length)]);
|
|
6184
6184
|
} catch (secErr) {
|
|
6185
|
-
if (secErr instanceof
|
|
6185
|
+
if (secErr instanceof _chunkAS25R4EUcjs.KordocError) throw secErr;
|
|
6186
6186
|
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" });
|
|
6187
6187
|
} finally {
|
|
6188
6188
|
pageBase += detect2.pages;
|
|
@@ -6193,10 +6193,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6193
6193
|
}
|
|
6194
6194
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
6195
6195
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter, encrypted ? findStream : void 0) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter, encrypted ? findStream : void 0);
|
|
6196
|
-
let flatBlocks =
|
|
6197
|
-
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks =
|
|
6196
|
+
let flatBlocks = _chunkYG4GFQB7cjs.flattenLayoutTables.call(void 0, blocks);
|
|
6197
|
+
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks = _chunkYG4GFQB7cjs.unframeLayoutTables.call(void 0, flatBlocks, !!_optionalChain([options, 'optionalAccess', _222 => _222.keepTrailingEmptyCols]));
|
|
6198
6198
|
if (_optionalChain([options, 'optionalAccess', _223 => _223.dedupeRunningHeaders])) {
|
|
6199
|
-
const deduped =
|
|
6199
|
+
const deduped = _chunkYG4GFQB7cjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
6200
6200
|
const removed = flatBlocks.length - deduped.length;
|
|
6201
6201
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
6202
6202
|
flatBlocks = deduped;
|
|
@@ -6205,10 +6205,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6205
6205
|
detectHwp5Headings(flatBlocks, docInfo, doc.tocTexts);
|
|
6206
6206
|
}
|
|
6207
6207
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
6208
|
-
let markdown =
|
|
6208
|
+
let markdown = _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, flatBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _224 => _224.tableFormat]) });
|
|
6209
6209
|
if (_optionalChain([options, 'optionalAccess', _225 => _225.inlineImages]) && options.images !== false && images.length > 0) {
|
|
6210
6210
|
try {
|
|
6211
|
-
markdown =
|
|
6211
|
+
markdown = _chunkN6KXGIINcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
6212
6212
|
} catch (inlineErr) {
|
|
6213
6213
|
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" });
|
|
6214
6214
|
}
|
|
@@ -6272,9 +6272,9 @@ function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
|
6272
6272
|
let level = 0;
|
|
6273
6273
|
if (_optionalChain([block, 'access', _232 => _232.style, 'optionalAccess', _233 => _233.fontSize]) && baseFontSize > 0) {
|
|
6274
6274
|
const ratio = block.style.fontSize / baseFontSize;
|
|
6275
|
-
if (ratio >=
|
|
6276
|
-
else if (ratio >=
|
|
6277
|
-
else if (ratio >=
|
|
6275
|
+
if (ratio >= _chunkYG4GFQB7cjs.HEADING_RATIO_H1) level = 1;
|
|
6276
|
+
else if (ratio >= _chunkYG4GFQB7cjs.HEADING_RATIO_H2) level = 2;
|
|
6277
|
+
else if (ratio >= _chunkYG4GFQB7cjs.HEADING_RATIO_H3) level = 3;
|
|
6278
6278
|
}
|
|
6279
6279
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
6280
6280
|
if (level === 0) level = 2;
|
|
@@ -6406,7 +6406,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6406
6406
|
const raw = _nullishCoalesce(lcfb.findStream(`/BodyText/Section${i}`), () => ( lcfb.findStream(`Section${i}`)));
|
|
6407
6407
|
if (!raw) break;
|
|
6408
6408
|
totalBytes += raw.length;
|
|
6409
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6409
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkAS25R4EUcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6410
6410
|
sections.push({ idx: i, content: raw });
|
|
6411
6411
|
}
|
|
6412
6412
|
if (sections.length === 0) {
|
|
@@ -6417,7 +6417,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6417
6417
|
const raw = lcfb.findStream(e.name);
|
|
6418
6418
|
if (raw) {
|
|
6419
6419
|
totalBytes += raw.length;
|
|
6420
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6420
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkAS25R4EUcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6421
6421
|
sections.push({ idx, content: raw });
|
|
6422
6422
|
}
|
|
6423
6423
|
}
|
|
@@ -6434,7 +6434,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6434
6434
|
try {
|
|
6435
6435
|
const content = decryptViewText(raw, compressed);
|
|
6436
6436
|
totalDecompressed += content.length;
|
|
6437
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6437
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkAS25R4EUcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6438
6438
|
sections.push({ idx: i, content });
|
|
6439
6439
|
} catch (e32) {
|
|
6440
6440
|
break;
|
|
@@ -18934,25 +18934,25 @@ function desEcbDecrypt(data, key) {
|
|
|
18934
18934
|
}
|
|
18935
18935
|
function readLayout(data) {
|
|
18936
18936
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18937
|
-
throw new (0,
|
|
18937
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18938
18938
|
}
|
|
18939
18939
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18940
18940
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18941
18941
|
if (payloadOffset >= data.length) {
|
|
18942
|
-
throw new (0,
|
|
18942
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18943
18943
|
}
|
|
18944
18944
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18945
18945
|
}
|
|
18946
18946
|
function decryptHwp3Document(input, password) {
|
|
18947
18947
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18948
18948
|
if (!compressed) {
|
|
18949
|
-
throw new (0,
|
|
18949
|
+
throw new (0, _chunkAS25R4EUcjs.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)");
|
|
18950
18950
|
}
|
|
18951
18951
|
const source = Buffer.from(input);
|
|
18952
18952
|
const payload = source.subarray(payloadOffset);
|
|
18953
18953
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18954
18954
|
if (aligned.length === 0) {
|
|
18955
|
-
throw new (0,
|
|
18955
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18956
18956
|
}
|
|
18957
18957
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18958
18958
|
let inflated;
|
|
@@ -18960,14 +18960,14 @@ function decryptHwp3Document(input, password) {
|
|
|
18960
18960
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18961
18961
|
} catch (err) {
|
|
18962
18962
|
if (_optionalChain([err, 'optionalAccess', _248 => _248.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18963
|
-
throw new (0,
|
|
18963
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(
|
|
18964
18964
|
`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`
|
|
18965
18965
|
);
|
|
18966
18966
|
}
|
|
18967
|
-
throw new (0,
|
|
18967
|
+
throw new (0, _chunkAS25R4EUcjs.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.");
|
|
18968
18968
|
}
|
|
18969
18969
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18970
|
-
throw new (0,
|
|
18970
|
+
throw new (0, _chunkAS25R4EUcjs.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.");
|
|
18971
18971
|
}
|
|
18972
18972
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18973
18973
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -19024,9 +19024,9 @@ function hwp3CellGrid(info, count) {
|
|
|
19024
19024
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
19025
19025
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
19026
19026
|
const r2 = nextY[k] !== void 0 ? edgeAt(ys, nextY[k]) : ys.length - 1;
|
|
19027
|
-
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row),
|
|
19027
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunkYG4GFQB7cjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunkYG4GFQB7cjs.MAX_COLS) };
|
|
19028
19028
|
});
|
|
19029
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
19029
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunkYG4GFQB7cjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunkYG4GFQB7cjs.MAX_COLS), cells };
|
|
19030
19030
|
}
|
|
19031
19031
|
|
|
19032
19032
|
// src/hwp3/parser.ts
|
|
@@ -19067,7 +19067,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19067
19067
|
let source = Buffer.from(buffer);
|
|
19068
19068
|
if (isEncryptedHwp3(source)) {
|
|
19069
19069
|
if (!_optionalChain([options, 'optionalAccess', _249 => _249.password])) {
|
|
19070
|
-
throw new (0,
|
|
19070
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(
|
|
19071
19071
|
"\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."
|
|
19072
19072
|
);
|
|
19073
19073
|
}
|
|
@@ -19084,10 +19084,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19084
19084
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
19085
19085
|
} catch (err) {
|
|
19086
19086
|
if (_optionalChain([err, 'optionalAccess', _250 => _250.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
19087
|
-
throw new (0,
|
|
19087
|
+
throw new (0, _chunkAS25R4EUcjs.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`);
|
|
19088
19088
|
}
|
|
19089
19089
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
19090
|
-
throw new (0,
|
|
19090
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
19091
19091
|
}
|
|
19092
19092
|
} else {
|
|
19093
19093
|
body = tail;
|
|
@@ -19110,7 +19110,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19110
19110
|
const names = new Map([...ctx.picIds].map(([name, id]) => [id, name]));
|
|
19111
19111
|
dropMissingPictures(allBlocks, binData, names, warnings);
|
|
19112
19112
|
const images = resolveImageBlocks(binData, allBlocks, warnings, true);
|
|
19113
|
-
const blocks =
|
|
19113
|
+
const blocks = _chunkYG4GFQB7cjs.flattenLayoutTables.call(void 0, allBlocks);
|
|
19114
19114
|
const metadata = {
|
|
19115
19115
|
title: header.title || void 0,
|
|
19116
19116
|
author: header.author || void 0,
|
|
@@ -19118,10 +19118,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19118
19118
|
createdAt: header.date || void 0,
|
|
19119
19119
|
version: "3.0"
|
|
19120
19120
|
};
|
|
19121
|
-
let markdown =
|
|
19121
|
+
let markdown = _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _251 => _251.tableFormat]) });
|
|
19122
19122
|
if (_optionalChain([options, 'optionalAccess', _252 => _252.inlineImages]) && options.images !== false && images.length > 0) {
|
|
19123
19123
|
try {
|
|
19124
|
-
markdown =
|
|
19124
|
+
markdown = _chunkN6KXGIINcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
19125
19125
|
} catch (inlineErr) {
|
|
19126
19126
|
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" });
|
|
19127
19127
|
}
|
|
@@ -19253,7 +19253,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
19253
19253
|
continue;
|
|
19254
19254
|
}
|
|
19255
19255
|
if (ch >= 32) {
|
|
19256
|
-
para2.text +=
|
|
19256
|
+
para2.text += _chunkYG4GFQB7cjs.escapeLiteralTags.call(void 0, _chunkYG4GFQB7cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( ""))));
|
|
19257
19257
|
continue;
|
|
19258
19258
|
}
|
|
19259
19259
|
if (ch === 9) {
|
|
@@ -19488,7 +19488,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19488
19488
|
// src/xlsx/sheet-blocks.ts
|
|
19489
19489
|
var MAX_SHEET_COLS = 16384;
|
|
19490
19490
|
function sheetRowCap(cols) {
|
|
19491
|
-
return Math.floor(
|
|
19491
|
+
return Math.floor(_chunkYG4GFQB7cjs.MAX_TABLE_CELLS / Math.max(1, cols));
|
|
19492
19492
|
}
|
|
19493
19493
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19494
19494
|
const blocks = [];
|
|
@@ -19519,7 +19519,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19519
19519
|
if (keepRows.length > rowCap) {
|
|
19520
19520
|
warnings.push({
|
|
19521
19521
|
page: sheetIndex + 1,
|
|
19522
|
-
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 ${
|
|
19522
|
+
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 ${_chunkYG4GFQB7cjs.MAX_TABLE_CELLS})`,
|
|
19523
19523
|
code: "TRUNCATED_TABLE"
|
|
19524
19524
|
});
|
|
19525
19525
|
keepRows.length = rowCap;
|
|
@@ -19553,14 +19553,14 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19553
19553
|
}
|
|
19554
19554
|
cellRows.push(row);
|
|
19555
19555
|
}
|
|
19556
|
-
const table2 =
|
|
19556
|
+
const table2 = _chunkYG4GFQB7cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap, maxCols: keepCols.length });
|
|
19557
19557
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19558
19558
|
return blocks;
|
|
19559
19559
|
}
|
|
19560
19560
|
|
|
19561
19561
|
// src/xlsx/parser.ts
|
|
19562
19562
|
var MAX_SHEETS = 100;
|
|
19563
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19563
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkAS25R4EUcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19564
19564
|
var MAX_SHEET_ROWS = 1048576;
|
|
19565
19565
|
function cleanNumericValue(raw) {
|
|
19566
19566
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19597,7 +19597,7 @@ function getTextContent(el) {
|
|
|
19597
19597
|
return _nullishCoalesce(_optionalChain([el, 'access', _268 => _268.textContent, 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]), () => ( ""));
|
|
19598
19598
|
}
|
|
19599
19599
|
function parseXml(text) {
|
|
19600
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19600
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkAS25R4EUcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19601
19601
|
}
|
|
19602
19602
|
function collectRichText(root) {
|
|
19603
19603
|
let out = "";
|
|
@@ -19608,7 +19608,7 @@ function collectRichText(root) {
|
|
|
19608
19608
|
const el = children[i];
|
|
19609
19609
|
const local = el.localName || _optionalChain([el, 'access', _271 => _271.tagName, 'optionalAccess', _272 => _272.replace, 'call', _273 => _273(/^[^:]+:/, "")]) || "";
|
|
19610
19610
|
if (local === "rPh") continue;
|
|
19611
|
-
if (local === "t") out +=
|
|
19611
|
+
if (local === "t") out += _chunkYG4GFQB7cjs.escapeLiteralTags.call(void 0, _chunkYG4GFQB7cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
19612
19612
|
else walk(el);
|
|
19613
19613
|
}
|
|
19614
19614
|
};
|
|
@@ -19819,12 +19819,12 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19819
19819
|
return { rows, merges, maxCol };
|
|
19820
19820
|
}
|
|
19821
19821
|
async function parseXlsxDocument(buffer, options) {
|
|
19822
|
-
|
|
19822
|
+
_chunkAS25R4EUcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19823
19823
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19824
19824
|
const warnings = [];
|
|
19825
19825
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19826
19826
|
if (!workbookFile) {
|
|
19827
|
-
throw new (0,
|
|
19827
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19828
19828
|
}
|
|
19829
19829
|
let sharedStrings = [];
|
|
19830
19830
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19833,7 +19833,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19833
19833
|
}
|
|
19834
19834
|
const { sheets, date1904 } = parseWorkbook(await readZipEntry(workbookFile, "text"));
|
|
19835
19835
|
if (sheets.length === 0) {
|
|
19836
|
-
throw new (0,
|
|
19836
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19837
19837
|
}
|
|
19838
19838
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19839
19839
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19917,7 +19917,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19917
19917
|
} catch (e35) {
|
|
19918
19918
|
}
|
|
19919
19919
|
}
|
|
19920
|
-
const markdown =
|
|
19920
|
+
const markdown = _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _278 => _278.tableFormat]) });
|
|
19921
19921
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19922
19922
|
}
|
|
19923
19923
|
|
|
@@ -20231,14 +20231,14 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20231
20231
|
const h = readCellHeader(rec.data);
|
|
20232
20232
|
if (h && rec.data.length >= 10) {
|
|
20233
20233
|
const isst = rec.data.readUInt32LE(6);
|
|
20234
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20234
|
+
cells.push({ row: h.row, col: h.col, value: _chunkYG4GFQB7cjs.escapeLiteralTags.call(void 0, _chunkYG4GFQB7cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(sst[isst], () => ( "")))) });
|
|
20235
20235
|
}
|
|
20236
20236
|
break;
|
|
20237
20237
|
}
|
|
20238
20238
|
case OP_LABEL: {
|
|
20239
20239
|
const h = readCellHeader(rec.data);
|
|
20240
20240
|
if (h) {
|
|
20241
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20241
|
+
cells.push({ row: h.row, col: h.col, value: _chunkYG4GFQB7cjs.escapeLiteralTags.call(void 0, _chunkYG4GFQB7cjs.escapeLiteralDollar.call(void 0, decodeLabelString(rec.data))) });
|
|
20242
20242
|
}
|
|
20243
20243
|
break;
|
|
20244
20244
|
}
|
|
@@ -20254,7 +20254,7 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20254
20254
|
cells.push({
|
|
20255
20255
|
row: h.row,
|
|
20256
20256
|
col: h.col,
|
|
20257
|
-
value:
|
|
20257
|
+
value: _chunkYG4GFQB7cjs.escapeLiteralTags.call(void 0, _chunkYG4GFQB7cjs.escapeLiteralDollar.call(void 0, decodeFormulaStringRecord(next.data)))
|
|
20258
20258
|
});
|
|
20259
20259
|
i = j;
|
|
20260
20260
|
} else {
|
|
@@ -20366,11 +20366,11 @@ function processGlobals(records) {
|
|
|
20366
20366
|
const xfFmtIds = [];
|
|
20367
20367
|
const firstBof = records[0];
|
|
20368
20368
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
20369
|
-
throw new (0,
|
|
20369
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
20370
20370
|
}
|
|
20371
20371
|
const bof = decodeBof(firstBof.data);
|
|
20372
20372
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
20373
|
-
throw new (0,
|
|
20373
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
20374
20374
|
}
|
|
20375
20375
|
let i = 1;
|
|
20376
20376
|
while (i < records.length) {
|
|
@@ -20454,28 +20454,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20454
20454
|
try {
|
|
20455
20455
|
cfb = parseLenientCfb(buf);
|
|
20456
20456
|
} catch (e) {
|
|
20457
|
-
throw new (0,
|
|
20457
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(
|
|
20458
20458
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20459
20459
|
);
|
|
20460
20460
|
}
|
|
20461
20461
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20462
20462
|
if (!wb) {
|
|
20463
|
-
throw new (0,
|
|
20463
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20464
20464
|
}
|
|
20465
20465
|
const records = readRecords2(wb);
|
|
20466
20466
|
if (records.length === 0) {
|
|
20467
|
-
throw new (0,
|
|
20467
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20468
20468
|
}
|
|
20469
20469
|
const firstBof = decodeBof(records[0].data);
|
|
20470
20470
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20471
|
-
throw new (0,
|
|
20471
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(
|
|
20472
20472
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20473
20473
|
);
|
|
20474
20474
|
}
|
|
20475
20475
|
const globals = processGlobals(records);
|
|
20476
20476
|
const warnings = [];
|
|
20477
20477
|
if (globals.encrypted) {
|
|
20478
|
-
throw new (0,
|
|
20478
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20479
20479
|
}
|
|
20480
20480
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20481
20481
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20526,7 +20526,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20526
20526
|
pageCount: totalSheets
|
|
20527
20527
|
};
|
|
20528
20528
|
return {
|
|
20529
|
-
markdown:
|
|
20529
|
+
markdown: _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, allBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _283 => _283.tableFormat]) }),
|
|
20530
20530
|
blocks: allBlocks,
|
|
20531
20531
|
metadata,
|
|
20532
20532
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20965,7 +20965,7 @@ function isDisplayMath(el) {
|
|
|
20965
20965
|
}
|
|
20966
20966
|
|
|
20967
20967
|
// src/docx/parser.ts
|
|
20968
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20968
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkAS25R4EUcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20969
20969
|
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
20970
20970
|
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;
|
|
20971
20971
|
function matchesLocal(el, localName3) {
|
|
@@ -21023,7 +21023,7 @@ function getAttr(el, localName3) {
|
|
|
21023
21023
|
return null;
|
|
21024
21024
|
}
|
|
21025
21025
|
function parseXml2(text) {
|
|
21026
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21026
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkAS25R4EUcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21027
21027
|
}
|
|
21028
21028
|
function parseStyles(xml) {
|
|
21029
21029
|
const doc = parseXml2(xml);
|
|
@@ -21159,7 +21159,7 @@ function parseFootnotes(xml) {
|
|
|
21159
21159
|
const runs = findElements(p, "r");
|
|
21160
21160
|
for (const r of runs) {
|
|
21161
21161
|
const tElements = getChildElements(r, "t");
|
|
21162
|
-
for (const t of tElements) texts.push(
|
|
21162
|
+
for (const t of tElements) texts.push(_chunkYG4GFQB7cjs.escapeLiteralTags.call(void 0, _chunkYG4GFQB7cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(t.textContent, () => ( "")))));
|
|
21163
21163
|
}
|
|
21164
21164
|
}
|
|
21165
21165
|
notes.set(id, texts.join("").trim());
|
|
@@ -21190,7 +21190,7 @@ function collectOmmlRoots(p) {
|
|
|
21190
21190
|
function extractRun(r) {
|
|
21191
21191
|
let text = "";
|
|
21192
21192
|
for (const el of effectiveChildElements(r)) {
|
|
21193
|
-
if (matchesLocal(el, "t")) text +=
|
|
21193
|
+
if (matchesLocal(el, "t")) text += _chunkYG4GFQB7cjs.escapeLiteralTags.call(void 0, _chunkYG4GFQB7cjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
21194
21194
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
21195
21195
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
21196
21196
|
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
@@ -21203,7 +21203,7 @@ function extractRun(r) {
|
|
|
21203
21203
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
21204
21204
|
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
21205
21205
|
const v = va ? getAttr(va, "val") : null;
|
|
21206
|
-
if (v === "superscript" || v === "subscript") text =
|
|
21206
|
+
if (v === "superscript" || v === "subscript") text = _chunkYG4GFQB7cjs.wrapScript.call(void 0, text, v === "superscript" ? "sup" : "sub");
|
|
21207
21207
|
}
|
|
21208
21208
|
return { text, bold, italic };
|
|
21209
21209
|
}
|
|
@@ -21221,7 +21221,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
21221
21221
|
function makeLink(text, rawHref) {
|
|
21222
21222
|
if (!text) return "";
|
|
21223
21223
|
if (!rawHref) return text;
|
|
21224
|
-
const href =
|
|
21224
|
+
const href = _chunkAS25R4EUcjs.sanitizeHref.call(void 0, rawHref);
|
|
21225
21225
|
return href ? `[${text}](${href})` : text;
|
|
21226
21226
|
}
|
|
21227
21227
|
function collectInline(p, footnotes, rels) {
|
|
@@ -21312,7 +21312,7 @@ function collectInline(p, footnotes, rels) {
|
|
|
21312
21312
|
const m = mathText(om);
|
|
21313
21313
|
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
21314
21314
|
}
|
|
21315
|
-
const text =
|
|
21315
|
+
const text = _chunkYG4GFQB7cjs.tidyScriptTags.call(void 0, parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
21316
21316
|
return { text, bold, italic, footnoteText };
|
|
21317
21317
|
}
|
|
21318
21318
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -21437,7 +21437,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21437
21437
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21438
21438
|
})
|
|
21439
21439
|
);
|
|
21440
|
-
const table2 =
|
|
21440
|
+
const table2 = _chunkYG4GFQB7cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21441
21441
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21442
21442
|
return { type: "table", table: table2 };
|
|
21443
21443
|
}
|
|
@@ -21486,7 +21486,7 @@ async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
|
21486
21486
|
let data = null;
|
|
21487
21487
|
if (readBytes) data = await readZipEntry(imgFile, "uint8array");
|
|
21488
21488
|
imgIdx++;
|
|
21489
|
-
const ext =
|
|
21489
|
+
const ext = _chunkAS25R4EUcjs.partExtension.call(void 0, imgPath);
|
|
21490
21490
|
const mimeMap = {
|
|
21491
21491
|
png: "image/png",
|
|
21492
21492
|
jpg: "image/jpeg",
|
|
@@ -21585,12 +21585,12 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21585
21585
|
}
|
|
21586
21586
|
async function parseDocxDocument(buffer, options) {
|
|
21587
21587
|
const readImages = _optionalChain([options, 'optionalAccess', _319 => _319.images]) !== false;
|
|
21588
|
-
|
|
21588
|
+
_chunkAS25R4EUcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5, void 0, { re: MEDIA_PART_RE, skip: !readImages, never: NEVER_READ_RE });
|
|
21589
21589
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21590
21590
|
const warnings = [];
|
|
21591
21591
|
const docFile = zip.file("word/document.xml");
|
|
21592
21592
|
if (!docFile) {
|
|
21593
|
-
throw new (0,
|
|
21593
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21594
21594
|
}
|
|
21595
21595
|
let rels = /* @__PURE__ */ new Map();
|
|
21596
21596
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21637,7 +21637,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21637
21637
|
const doc = parseXml2(docXml);
|
|
21638
21638
|
const body = findElements(doc, "body");
|
|
21639
21639
|
if (body.length === 0) {
|
|
21640
|
-
throw new (0,
|
|
21640
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21641
21641
|
}
|
|
21642
21642
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
21643
21643
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -21690,7 +21690,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21690
21690
|
}
|
|
21691
21691
|
}
|
|
21692
21692
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21693
|
-
const markdown =
|
|
21693
|
+
const markdown = _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _326 => _326.tableFormat]) });
|
|
21694
21694
|
return {
|
|
21695
21695
|
markdown,
|
|
21696
21696
|
blocks,
|
|
@@ -21704,7 +21704,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21704
21704
|
// src/pptx/parser.ts
|
|
21705
21705
|
|
|
21706
21706
|
|
|
21707
|
-
var MAX_DECOMPRESS_SIZE6 =
|
|
21707
|
+
var MAX_DECOMPRESS_SIZE6 = _chunkAS25R4EUcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
21708
21708
|
var MEDIA_PART_RE2 = /^ppt\/(?:media|embeddings)\//;
|
|
21709
21709
|
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;
|
|
21710
21710
|
var MAX_ZIP_ENTRIES2 = 1e4;
|
|
@@ -21727,7 +21727,7 @@ var IMAGE_MIME = {
|
|
|
21727
21727
|
svg: "image/svg+xml"
|
|
21728
21728
|
};
|
|
21729
21729
|
function parseXml3(text) {
|
|
21730
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21730
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkAS25R4EUcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21731
21731
|
}
|
|
21732
21732
|
function getAttr2(el, name) {
|
|
21733
21733
|
const attrs = el.attributes;
|
|
@@ -21794,7 +21794,7 @@ async function slideParts(zip) {
|
|
|
21794
21794
|
names.sort((a, b) => Number(SLIDE_PART_RE.exec(a)[1]) - Number(SLIDE_PART_RE.exec(b)[1]));
|
|
21795
21795
|
ordered.push(...names);
|
|
21796
21796
|
}
|
|
21797
|
-
if (ordered.length > MAX_SLIDES) throw new (0,
|
|
21797
|
+
if (ordered.length > MAX_SLIDES) throw new (0, _chunkAS25R4EUcjs.KordocError)(`PPTX \uC2AC\uB77C\uC774\uB4DC \uC218 \uCD08\uACFC: ${ordered.length} (\uCD5C\uB300 ${MAX_SLIDES})`);
|
|
21798
21798
|
return ordered;
|
|
21799
21799
|
}
|
|
21800
21800
|
function paragraphText(p) {
|
|
@@ -21805,12 +21805,12 @@ function paragraphText(p) {
|
|
|
21805
21805
|
const t = findChildByLocalName(child, "t");
|
|
21806
21806
|
const rPr = findChildByLocalName(child, "rPr");
|
|
21807
21807
|
const baseline = Number(rPr ? _nullishCoalesce(getAttr2(rPr, "baseline"), () => ( 0)) : 0);
|
|
21808
|
-
if (t) text +=
|
|
21808
|
+
if (t) text += _chunkYG4GFQB7cjs.wrapScript.call(void 0, _chunkYG4GFQB7cjs.escapeLiteralTags.call(void 0, _chunkYG4GFQB7cjs.escapeLiteralDollar.call(void 0, rawTextContent(t))), baseline > 0 ? "sup" : baseline < 0 ? "sub" : null);
|
|
21809
21809
|
} else if (name === "br") {
|
|
21810
21810
|
text += " ";
|
|
21811
21811
|
}
|
|
21812
21812
|
}
|
|
21813
|
-
return
|
|
21813
|
+
return _chunkYG4GFQB7cjs.tidyScriptTags.call(void 0, text.replace(/\s+/g, " ").trim());
|
|
21814
21814
|
}
|
|
21815
21815
|
function bodyParagraphs(txBody) {
|
|
21816
21816
|
const out = [];
|
|
@@ -21871,7 +21871,7 @@ function parseTable2(tbl2, page, keepEmptyCols) {
|
|
|
21871
21871
|
});
|
|
21872
21872
|
return cells;
|
|
21873
21873
|
});
|
|
21874
|
-
const table2 =
|
|
21874
|
+
const table2 = _chunkYG4GFQB7cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21875
21875
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21876
21876
|
return { type: "table", table: table2, pageNumber: page };
|
|
21877
21877
|
}
|
|
@@ -21884,7 +21884,7 @@ async function pictureBlock(pic, ctx) {
|
|
|
21884
21884
|
if (!filename) {
|
|
21885
21885
|
const file = ctx.zip.file(rel.target);
|
|
21886
21886
|
if (!file) return null;
|
|
21887
|
-
const ext =
|
|
21887
|
+
const ext = _chunkAS25R4EUcjs.partExtension.call(void 0, rel.target);
|
|
21888
21888
|
filename = `image_${String(ctx.imageNames.size + 1).padStart(3, "0")}.${ext}`;
|
|
21889
21889
|
try {
|
|
21890
21890
|
if (_optionalChain([ctx, 'access', _330 => _330.options, 'optionalAccess', _331 => _331.images]) !== false) {
|
|
@@ -21962,10 +21962,10 @@ async function notesText(zip, rels) {
|
|
|
21962
21962
|
return texts.join(" ");
|
|
21963
21963
|
}
|
|
21964
21964
|
async function parsePptxDocument(buffer, options) {
|
|
21965
|
-
|
|
21965
|
+
_chunkAS25R4EUcjs.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 });
|
|
21966
21966
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21967
21967
|
if (!zip.file("ppt/presentation.xml")) {
|
|
21968
|
-
throw new (0,
|
|
21968
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 PPTX \uD30C\uC77C: ppt/presentation.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21969
21969
|
}
|
|
21970
21970
|
const warnings = [];
|
|
21971
21971
|
const blocks = [];
|
|
@@ -22012,7 +22012,7 @@ async function parsePptxDocument(buffer, options) {
|
|
|
22012
22012
|
}
|
|
22013
22013
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")), pageNumber: b.pageNumber }));
|
|
22014
22014
|
return {
|
|
22015
|
-
markdown:
|
|
22015
|
+
markdown: _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _336 => _336.tableFormat]) }),
|
|
22016
22016
|
blocks,
|
|
22017
22017
|
metadata,
|
|
22018
22018
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -22028,11 +22028,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
22028
22028
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
22029
22029
|
function parseHwpmlDocument(buffer, options) {
|
|
22030
22030
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
22031
|
-
throw new (0,
|
|
22031
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
22032
22032
|
}
|
|
22033
22033
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
22034
22034
|
const normalized = text.replace(/ /g, " ");
|
|
22035
|
-
const xml =
|
|
22035
|
+
const xml = _chunkAS25R4EUcjs.stripDtd.call(void 0, normalized);
|
|
22036
22036
|
const warnings = [];
|
|
22037
22037
|
const parser = new (0, _xmldom.DOMParser)({
|
|
22038
22038
|
onError: (_level, msg2) => {
|
|
@@ -22072,7 +22072,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
22072
22072
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _338 => _338.keepTrailingEmptyCols]), () => ( false)));
|
|
22073
22073
|
}
|
|
22074
22074
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
22075
|
-
const markdown =
|
|
22075
|
+
const markdown = _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _339 => _339.tableFormat]) });
|
|
22076
22076
|
return {
|
|
22077
22077
|
markdown,
|
|
22078
22078
|
blocks,
|
|
@@ -22179,7 +22179,7 @@ function collectCharText(node, parts, depth = 0) {
|
|
|
22179
22179
|
if (tag === "CHAR") {
|
|
22180
22180
|
for (const c of Array.from(el.childNodes)) {
|
|
22181
22181
|
const t = c.nodeType === 1 ? localName(c) === "TAB" ? " " : rawTextContent(c) : c.nodeType === 3 || c.nodeType === 4 ? _nullishCoalesce(c.nodeValue, () => ( "")) : "";
|
|
22182
|
-
if (t) parts.push(
|
|
22182
|
+
if (t) parts.push(_chunkYG4GFQB7cjs.escapeLiteralTags.call(void 0, t));
|
|
22183
22183
|
}
|
|
22184
22184
|
} else if (tag === "TABLE" || tag === "PICTURE" || tag === "SHAPEOBJECT") {
|
|
22185
22185
|
} else if (tag === "AUTONUM") {
|
|
@@ -22239,7 +22239,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
22239
22239
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
22240
22240
|
cellRows[r].push(cell2);
|
|
22241
22241
|
}
|
|
22242
|
-
const table2 =
|
|
22242
|
+
const table2 = _chunkYG4GFQB7cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
22243
22243
|
if (structured.length > 0) {
|
|
22244
22244
|
const claimed = /* @__PURE__ */ new Set();
|
|
22245
22245
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -24002,7 +24002,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
24002
24002
|
};
|
|
24003
24003
|
}
|
|
24004
24004
|
async function extractClickHereFields(hwpxBuffer) {
|
|
24005
|
-
|
|
24005
|
+
_chunkAS25R4EUcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24006
24006
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24007
24007
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24008
24008
|
const fields = [];
|
|
@@ -24038,7 +24038,7 @@ function readZipEntries(buf) {
|
|
|
24038
24038
|
}
|
|
24039
24039
|
function localDataStart(view, localOffset) {
|
|
24040
24040
|
if (view.getUint32(localOffset, true) !== LOCAL_SIG) {
|
|
24041
|
-
throw new (0,
|
|
24041
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24042
24042
|
}
|
|
24043
24043
|
const nameLen = view.getUint16(localOffset + 26, true);
|
|
24044
24044
|
const extraLen = view.getUint16(localOffset + 28, true);
|
|
@@ -24068,19 +24068,19 @@ function parseCentralDirectory(buf) {
|
|
|
24068
24068
|
}
|
|
24069
24069
|
}
|
|
24070
24070
|
}
|
|
24071
|
-
if (eocdOffset < 0) throw new (0,
|
|
24071
|
+
if (eocdOffset < 0) throw new (0, _chunkAS25R4EUcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24072
24072
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
24073
24073
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
24074
24074
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
24075
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
24075
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkAS25R4EUcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24076
24076
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
24077
|
-
throw new (0,
|
|
24077
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24078
24078
|
}
|
|
24079
24079
|
const decoder = new TextDecoder("utf-8");
|
|
24080
24080
|
const entries = [];
|
|
24081
24081
|
let pos = cdOffset;
|
|
24082
24082
|
for (let i = 0; i < totalEntries; i++) {
|
|
24083
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
24083
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkAS25R4EUcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
24084
24084
|
const flags = view.getUint16(pos + 8, true);
|
|
24085
24085
|
const method = view.getUint16(pos + 10, true);
|
|
24086
24086
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -24091,7 +24091,7 @@ function parseCentralDirectory(buf) {
|
|
|
24091
24091
|
const commentLen = view.getUint16(pos + 32, true);
|
|
24092
24092
|
const localOffset = view.getUint32(pos + 42, true);
|
|
24093
24093
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
24094
|
-
throw new (0,
|
|
24094
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24095
24095
|
}
|
|
24096
24096
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
24097
24097
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -24120,11 +24120,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24120
24120
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
24121
24121
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
24122
24122
|
for (const name of replacements.keys()) {
|
|
24123
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
24123
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkAS25R4EUcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24124
24124
|
}
|
|
24125
24125
|
if (additions) {
|
|
24126
24126
|
for (const name of additions.keys()) {
|
|
24127
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
24127
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkAS25R4EUcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24128
24128
|
}
|
|
24129
24129
|
}
|
|
24130
24130
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -24143,7 +24143,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24143
24143
|
offset += seg.length;
|
|
24144
24144
|
continue;
|
|
24145
24145
|
}
|
|
24146
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
24146
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkAS25R4EUcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24147
24147
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
24148
24148
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
24149
24149
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -24151,7 +24151,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24151
24151
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
24152
24152
|
const method = e.method;
|
|
24153
24153
|
if (method !== 0 && method !== 8) {
|
|
24154
|
-
throw new (0,
|
|
24154
|
+
throw new (0, _chunkAS25R4EUcjs.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`);
|
|
24155
24155
|
}
|
|
24156
24156
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
24157
24157
|
const crc = crc32(newData);
|
|
@@ -24249,11 +24249,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24249
24249
|
// src/form/filler-hwpx.ts
|
|
24250
24250
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
24251
24251
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
24252
|
-
|
|
24252
|
+
_chunkAS25R4EUcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24253
24253
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24254
24254
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24255
24255
|
if (sectionPaths.length === 0) {
|
|
24256
|
-
throw new (0,
|
|
24256
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24257
24257
|
}
|
|
24258
24258
|
const warnings = [];
|
|
24259
24259
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -24645,7 +24645,7 @@ var MIN_SIDE = 24;
|
|
|
24645
24645
|
async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
24646
24646
|
const ocr = _optionalChain([options, 'optionalAccess', _485 => _485.ocr]);
|
|
24647
24647
|
if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
|
|
24648
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
24648
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-AELVAU75.cjs")));
|
|
24649
24649
|
let inserted = false, unreadable = 0;
|
|
24650
24650
|
let failed = null;
|
|
24651
24651
|
const walk = async (list, depth) => {
|
|
@@ -24686,7 +24686,7 @@ async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
|
24686
24686
|
function ocrBytes(img) {
|
|
24687
24687
|
const mime = img.mimeType.toLowerCase();
|
|
24688
24688
|
if (mime.includes("wmf") || mime.includes("emf")) return null;
|
|
24689
|
-
if (mime.includes("bmp")) return
|
|
24689
|
+
if (mime.includes("bmp")) return _chunkN6KXGIINcjs.bmpToPng.call(void 0, img.data);
|
|
24690
24690
|
return img.data;
|
|
24691
24691
|
}
|
|
24692
24692
|
async function tooSmall(bytes) {
|
|
@@ -24855,7 +24855,7 @@ function classifyTableTree(blocks) {
|
|
|
24855
24855
|
return blocks;
|
|
24856
24856
|
}
|
|
24857
24857
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
24858
|
-
const structured = hasMerged(table2) ||
|
|
24858
|
+
const structured = hasMerged(table2) || _chunkYG4GFQB7cjs.hasStructuredCellContent.call(void 0, table2);
|
|
24859
24859
|
if (opts.smartVisual && _optionalChain([table2, 'access', _501 => _501.classification, 'optionalAccess', _502 => _502.kind]) === "non-tabular-layout") return "visual";
|
|
24860
24860
|
return structured ? "html" : "gfm";
|
|
24861
24861
|
}
|
|
@@ -35146,14 +35146,14 @@ function fontHasGlyph(face, cp) {
|
|
|
35146
35146
|
if (!hasFontMetrics(face)) return false;
|
|
35147
35147
|
return cp >= 32 && cp <= 126 || FONTS[face.trim()].ex[cp] !== void 0;
|
|
35148
35148
|
}
|
|
35149
|
-
var HANCOM_FALLBACK_W = { 8228: 173, 8231: 173, 8211: 430, 8680: 1e3, 8728: 500, 8227: 465, 12295: 1e3 };
|
|
35149
|
+
var HANCOM_FALLBACK_W = { 8228: 173, 8231: 173, 8211: 430, 8680: 1e3, 8728: 500, 8227: 465, 12295: 1e3, 61607: 937 / 2048 * 1e3, 61599: 937 / 2048 * 1e3, 61550: 1529 / 2048 * 1e3 };
|
|
35150
35150
|
function isHanja(cp) {
|
|
35151
35151
|
return cp >= 19968 && cp <= 40959 || cp >= 13312 && cp <= 19903 || cp >= 63744 && cp <= 64255;
|
|
35152
35152
|
}
|
|
35153
|
-
function fontWidthFn(face) {
|
|
35153
|
+
function fontWidthFn(face, fallback = true) {
|
|
35154
35154
|
if (!hasFontMetrics(face)) return null;
|
|
35155
35155
|
const m = FONTS[face.trim()];
|
|
35156
|
-
return (cp) => cp >= 32 && cp <= 126 ? m.ascii[cp - 32] : _nullishCoalesce(m.ex[cp], () => ( (_nullishCoalesce(HANCOM_FALLBACK_W[cp], () => ( (isHalfwidthForm(cp) ? 500 : m.han !== void 0 && isHanja(cp) ? m.han : m.cjk))))));
|
|
35156
|
+
return (cp) => cp >= 32 && cp <= 126 ? m.ascii[cp - 32] : _nullishCoalesce(m.ex[cp], () => ( (_nullishCoalesce((fallback ? HANCOM_FALLBACK_W[cp] : void 0), () => ( (isHalfwidthForm(cp) ? 500 : m.han !== void 0 && isHanja(cp) ? m.han : m.cjk))))));
|
|
35157
35157
|
}
|
|
35158
35158
|
function isHalfwidthForm(cp) {
|
|
35159
35159
|
return cp >= 65377 && cp <= 65500 || cp >= 65512 && cp <= 65518;
|
|
@@ -35377,20 +35377,20 @@ function fixedPitchWidthEm1000(cp) {
|
|
|
35377
35377
|
return cp < 128 || isHalfwidthForm(cp) ? 500 : 1e3;
|
|
35378
35378
|
}
|
|
35379
35379
|
var PUA_FULL = /* @__PURE__ */ new Set([983729, 983730, 983731, 983732, 983733, 983734, 983803]);
|
|
35380
|
-
function widthFnOf(faceClass) {
|
|
35381
|
-
const base = baseWidthFnOf(faceClass);
|
|
35380
|
+
function widthFnOf(faceClass, fallback = true) {
|
|
35381
|
+
const base = baseWidthFnOf(faceClass, fallback);
|
|
35382
35382
|
const hcr = faceClass === "hcr" || faceClass === "font:\uD568\uCD08\uB86C\uB3CB\uC6C0" || faceClass === "font:\uD568\uCD08\uB86C\uBC14\uD0D5";
|
|
35383
35383
|
const f = (cp) => cp >= 983040 ? PUA_FULL.has(cp) ? 1e3 : 500 : cp === 61600 ? base(32) : !hcr && cp >= 10102 && cp <= 10131 ? 1e3 : base(cp);
|
|
35384
|
-
if (faceClass === "fixedPitch" || faceClass === "cjk") return (cp) => isZeroWidthCp(cp) ? 0 : _nullishCoalesce(HANCOM_FALLBACK_W[cp], () => ( f(cp)));
|
|
35384
|
+
if (fallback && (faceClass === "fixedPitch" || faceClass === "cjk")) return (cp) => isZeroWidthCp(cp) ? 0 : _nullishCoalesce(HANCOM_FALLBACK_W[cp], () => ( f(cp)));
|
|
35385
35385
|
return (cp) => isZeroWidthCp(cp) ? 0 : f(cp);
|
|
35386
35386
|
}
|
|
35387
|
-
function baseWidthFnOf(faceClass) {
|
|
35387
|
+
function baseWidthFnOf(faceClass, fallback = true) {
|
|
35388
35388
|
if (faceClass === "fixedPitch") return fixedPitchWidthEm1000;
|
|
35389
35389
|
if (faceClass === "gothic") return (cp) => isHalfwidthForm(cp) ? 500 : gothicWidthEm1000(cp);
|
|
35390
35390
|
if (faceClass === "cjk") return cjkWidthEm1000;
|
|
35391
35391
|
if (_optionalChain([faceClass, 'optionalAccess', _503 => _503.startsWith, 'call', _504 => _504("font:")])) {
|
|
35392
35392
|
const face = faceClass.slice(5);
|
|
35393
|
-
return _nullishCoalesce(fontWidthFn(face), () => ( gothicWidthEm1000));
|
|
35393
|
+
return _nullishCoalesce(fontWidthFn(face, fallback), () => ( gothicWidthEm1000));
|
|
35394
35394
|
}
|
|
35395
35395
|
return charWidthEm1000;
|
|
35396
35396
|
}
|
|
@@ -35413,7 +35413,7 @@ function mulDiv(a, b, c) {
|
|
|
35413
35413
|
const e = a * b;
|
|
35414
35414
|
return Math.trunc(e < 0 ? (e - c / 2) / c : (e + c / 2) / c);
|
|
35415
35415
|
}
|
|
35416
|
-
function hancomCharWidth(ch, height, ratioPct, spacingPct, faceClass, emAdd = 0) {
|
|
35416
|
+
function hancomCharWidth(ch, height, ratioPct, spacingPct, faceClass, emAdd = 0, fallback = true) {
|
|
35417
35417
|
const cp = ch.codePointAt(0);
|
|
35418
35418
|
let w;
|
|
35419
35419
|
if (cp === 8197) {
|
|
@@ -35422,7 +35422,7 @@ function hancomCharWidth(ch, height, ratioPct, spacingPct, faceClass, emAdd = 0)
|
|
|
35422
35422
|
} else if (isSpaceCp(cp)) {
|
|
35423
35423
|
const s = Math.trunc(height / 8);
|
|
35424
35424
|
w = 4 * (ratioPct === 100 ? s : mulDiv(s, ratioPct, 100));
|
|
35425
|
-
} else return hancomEmWidth(widthFnOf(faceClass)(cp) + emAdd, height, ratioPct, spacingPct);
|
|
35425
|
+
} else return hancomEmWidth(widthFnOf(faceClass, fallback)(cp) + emAdd, height, ratioPct, spacingPct);
|
|
35426
35426
|
if (spacingPct) w += 4 * mulDiv(Math.trunc(w / 4), spacingPct, 100);
|
|
35427
35427
|
return w;
|
|
35428
35428
|
}
|
|
@@ -35850,7 +35850,7 @@ function findAgency(name) {
|
|
|
35850
35850
|
}
|
|
35851
35851
|
function agencyStyle(name) {
|
|
35852
35852
|
const s = findAgency(name);
|
|
35853
|
-
if (!s) throw new (0,
|
|
35853
|
+
if (!s) throw new (0, _chunkAS25R4EUcjs.KordocError)(`agency: \uC2E4\uCE21 \uC11C\uC2DD\uC774 \uC5C6\uB294 \uAE30\uAD00\uC785\uB2C8\uB2E4 "${name}" \u2014 ${AGENCY_COMMON_NAME} \uB610\uB294 ${agencyNames().join("\xB7")}`);
|
|
35854
35854
|
return s;
|
|
35855
35855
|
}
|
|
35856
35856
|
function applyAgency(opts, preset) {
|
|
@@ -36914,7 +36914,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
36914
36914
|
}
|
|
36915
36915
|
function assertFiniteRange(name, value, min, max) {
|
|
36916
36916
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
36917
|
-
throw new (0,
|
|
36917
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
36918
36918
|
}
|
|
36919
36919
|
}
|
|
36920
36920
|
function validateGongmunOptions(opts) {
|
|
@@ -36932,10 +36932,10 @@ function validateGongmunOptions(opts) {
|
|
|
36932
36932
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
36933
36933
|
}
|
|
36934
36934
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
36935
|
-
throw new (0,
|
|
36935
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
36936
36936
|
}
|
|
36937
36937
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
36938
|
-
throw new (0,
|
|
36938
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
36939
36939
|
}
|
|
36940
36940
|
}
|
|
36941
36941
|
if (opts.sizes) {
|
|
@@ -36944,24 +36944,24 @@ function validateGongmunOptions(opts) {
|
|
|
36944
36944
|
}
|
|
36945
36945
|
}
|
|
36946
36946
|
if (opts.approval && opts.approval.length > 6) {
|
|
36947
|
-
throw new (0,
|
|
36947
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("approval must contain at most 6 labels");
|
|
36948
36948
|
}
|
|
36949
36949
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
36950
36950
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
36951
36951
|
for (const n of nums) {
|
|
36952
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
36952
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkAS25R4EUcjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
36953
36953
|
}
|
|
36954
36954
|
}
|
|
36955
36955
|
if (opts.levels) {
|
|
36956
36956
|
for (const [key, st] of Object.entries(opts.levels)) {
|
|
36957
36957
|
const depth = Number(key);
|
|
36958
36958
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
36959
|
-
throw new (0,
|
|
36959
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
36960
36960
|
}
|
|
36961
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
36961
|
+
if (!st || typeof st !== "object") throw new (0, _chunkAS25R4EUcjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
36962
36962
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
36963
36963
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
36964
|
-
throw new (0,
|
|
36964
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
36965
36965
|
}
|
|
36966
36966
|
}
|
|
36967
36967
|
}
|
|
@@ -37019,7 +37019,7 @@ function resolveChecklist(c, preset) {
|
|
|
37019
37019
|
function hexColorOption(name, value) {
|
|
37020
37020
|
if (value === void 0) return void 0;
|
|
37021
37021
|
const v = value.trim();
|
|
37022
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
37022
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkAS25R4EUcjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
37023
37023
|
return v.toUpperCase();
|
|
37024
37024
|
}
|
|
37025
37025
|
function resolveGongmun(input) {
|
|
@@ -37763,7 +37763,7 @@ function parseInlineMarkdown(text) {
|
|
|
37763
37763
|
else spans.push(...emphasisSpans(m[0]));
|
|
37764
37764
|
} else {
|
|
37765
37765
|
const anchor = m[2] || m[3];
|
|
37766
|
-
const href = _nullishCoalesce(
|
|
37766
|
+
const href = _nullishCoalesce(_chunkAS25R4EUcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
37767
37767
|
const sub = emphasisSpans(anchor);
|
|
37768
37768
|
if (href) for (const s of sub) s.href = href;
|
|
37769
37769
|
spans.push(...sub);
|
|
@@ -37984,7 +37984,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
37984
37984
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
37985
37985
|
const got = m ? Number(m[1]) : NaN;
|
|
37986
37986
|
if (got !== startId + i) {
|
|
37987
|
-
throw new (0,
|
|
37987
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(
|
|
37988
37988
|
`\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)`
|
|
37989
37989
|
);
|
|
37990
37990
|
}
|
|
@@ -38075,7 +38075,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
38075
38075
|
}
|
|
38076
38076
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
38077
38077
|
if (rows.length !== expectedBase) {
|
|
38078
|
-
throw new (0,
|
|
38078
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(
|
|
38079
38079
|
`\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`
|
|
38080
38080
|
);
|
|
38081
38081
|
}
|
|
@@ -39084,7 +39084,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
39084
39084
|
return best;
|
|
39085
39085
|
}
|
|
39086
39086
|
function normForMatch(text) {
|
|
39087
|
-
return
|
|
39087
|
+
return _chunkYG4GFQB7cjs.sanitizeText.call(void 0, text.replace(/\\\$/g, "$").replace(/\\(?=<\/?(?:u|sup|sub)>)/g, "")).replace(/\s+/g, " ").trim();
|
|
39088
39088
|
}
|
|
39089
39089
|
function unescapeGfm(text) {
|
|
39090
39090
|
return text.replace(/\\([~*_`|#<$\\])/g, "$1");
|
|
@@ -39106,7 +39106,7 @@ function replicateGfmTable(table2) {
|
|
|
39106
39106
|
const cell2 = _optionalChain([cells, 'access', _632 => _632[r], 'optionalAccess', _633 => _633[c]]);
|
|
39107
39107
|
if (!cell2) continue;
|
|
39108
39108
|
display[r][c] = {
|
|
39109
|
-
text:
|
|
39109
|
+
text: _chunkYG4GFQB7cjs.escapeGfm.call(void 0, _chunkYG4GFQB7cjs.sanitizeText.call(void 0, cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\r\n|\r|\n/g, "<br>"),
|
|
39110
39110
|
gridR: r,
|
|
39111
39111
|
gridC: c
|
|
39112
39112
|
};
|
|
@@ -39146,16 +39146,16 @@ function replicateCellInnerHtml(cell2) {
|
|
|
39146
39146
|
if (_optionalChain([cell2, 'access', _634 => _634.blocks, 'optionalAccess', _635 => _635.length])) {
|
|
39147
39147
|
return cell2.blocks.map((b) => {
|
|
39148
39148
|
if (b.type === "table" && b.table) {
|
|
39149
|
-
const cap = b.table.caption ?
|
|
39150
|
-
return (cap ?
|
|
39149
|
+
const cap = b.table.caption ? _chunkYG4GFQB7cjs.sanitizeText.call(void 0, b.table.caption) : "";
|
|
39150
|
+
return (cap ? _chunkYG4GFQB7cjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
39151
39151
|
}
|
|
39152
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
39153
|
-
const note =
|
|
39154
|
-
const t = (
|
|
39155
|
-
return ((t ?
|
|
39152
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkAS25R4EUcjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
39153
|
+
const note = _chunkYG4GFQB7cjs.noteTableHtml.call(void 0, b);
|
|
39154
|
+
const t = (_chunkYG4GFQB7cjs.sanitizeText.call(void 0, _chunkYG4GFQB7cjs.visibleText.call(void 0, b)) + (note ? "" : _chunkYG4GFQB7cjs.noteSuffix.call(void 0, b))).trim();
|
|
39155
|
+
return ((t ? _chunkYG4GFQB7cjs.escapeHtmlCellText.call(void 0, t).replace(/\n/g, "<br>") : "") + note).trim();
|
|
39156
39156
|
}).filter(Boolean).join("<br>");
|
|
39157
39157
|
}
|
|
39158
|
-
return
|
|
39158
|
+
return _chunkYG4GFQB7cjs.escapeHtmlCellText.call(void 0, _chunkYG4GFQB7cjs.sanitizeText.call(void 0, cell2.text)).replace(/\n/g, "<br>");
|
|
39159
39159
|
}
|
|
39160
39160
|
function replicateTableToHtml(table2) {
|
|
39161
39161
|
const rows = replicateHtmlTable(table2);
|
|
@@ -39232,7 +39232,7 @@ function parseHtmlTable(raw) {
|
|
|
39232
39232
|
const cs = parseInt(_optionalChain([attrs, 'access', _638 => _638.match, 'call', _639 => _639(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _640 => _640[1]]) || "1", 10);
|
|
39233
39233
|
const rs = parseInt(_optionalChain([attrs, 'access', _641 => _641.match, 'call', _642 => _642(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _643 => _643[1]]) || "1", 10);
|
|
39234
39234
|
cellStart = m.index + m[0].length;
|
|
39235
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
39235
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkYG4GFQB7cjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkYG4GFQB7cjs.MAX_ROWS) };
|
|
39236
39236
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
39237
39237
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
39238
39238
|
cellStart = -1;
|
|
@@ -39257,11 +39257,11 @@ function htmlCellInnerToLines(inner) {
|
|
|
39257
39257
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
39258
39258
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
39259
39259
|
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _644 => _644[1]]), () => ( _optionalChain([m, 'optionalAccess', _645 => _645[2]])));
|
|
39260
|
-
if (src) imgSrcs.push(
|
|
39260
|
+
if (src) imgSrcs.push(_chunkAS25R4EUcjs.unescapeHtml.call(void 0, src));
|
|
39261
39261
|
return "";
|
|
39262
39262
|
});
|
|
39263
39263
|
}
|
|
39264
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
39264
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkAS25R4EUcjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
39265
39265
|
return { lines, hadNonText, imgSrcs };
|
|
39266
39266
|
}
|
|
39267
39267
|
function splitCellByTopLevelTables(html) {
|
|
@@ -40077,8 +40077,8 @@ function layoutHtmlRows(rows) {
|
|
|
40077
40077
|
let c = 0;
|
|
40078
40078
|
for (const cell2 of rows[r].cells) {
|
|
40079
40079
|
while (occupied.has(`${r},${c}`)) c++;
|
|
40080
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
40081
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
40080
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkYG4GFQB7cjs.MAX_COLS);
|
|
40081
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkYG4GFQB7cjs.MAX_ROWS);
|
|
40082
40082
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
40083
40083
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
40084
40084
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -42413,7 +42413,7 @@ function builtinTemplateDir() {
|
|
|
42413
42413
|
for (const c of candidates) {
|
|
42414
42414
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
42415
42415
|
}
|
|
42416
|
-
throw new (0,
|
|
42416
|
+
throw new (0, _chunkAS25R4EUcjs.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)");
|
|
42417
42417
|
}
|
|
42418
42418
|
function readBuiltinTemplate(t) {
|
|
42419
42419
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -42690,7 +42690,8 @@ function parseRenderStyles(headXml, opts) {
|
|
|
42690
42690
|
...cpr != null && cpr !== "4294967295" ? { charPrId: cpr } : {},
|
|
42691
42691
|
offset: Number(_optionalChain([head, 'optionalAccess', _841 => _841.getAttribute, 'call', _842 => _842("textOffset")])) || 0,
|
|
42692
42692
|
offsetPct: (_nullishCoalesce(_optionalChain([head, 'optionalAccess', _843 => _843.getAttribute, 'call', _844 => _844("textOffsetType")]), () => ( "PERCENT"))) === "PERCENT",
|
|
42693
|
-
autoIndent: _optionalChain([head, 'optionalAccess', _845 => _845.getAttribute, 'call', _846 => _846("autoIndent")]) !== "0"
|
|
42693
|
+
autoIndent: _optionalChain([head, 'optionalAccess', _845 => _845.getAttribute, 'call', _846 => _846("autoIndent")]) !== "0",
|
|
42694
|
+
..._optionalChain([head, 'optionalAccess', _847 => _847.hasAttribute, 'call', _848 => _848("useInstWidth")]) ? { useInstWidth: head.getAttribute("useInstWidth") !== "0" } : {}
|
|
42694
42695
|
});
|
|
42695
42696
|
}
|
|
42696
42697
|
} else if (tag === "numbering") {
|
|
@@ -42722,7 +42723,7 @@ function parseRenderStyles(headXml, opts) {
|
|
|
42722
42723
|
};
|
|
42723
42724
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
42724
42725
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
42725
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
42726
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _849 => _849.getAttribute, 'call', _850 => _850("faceColor")]);
|
|
42726
42727
|
const fill = docColor(face);
|
|
42727
42728
|
if (fill) bf.fill = fill;
|
|
42728
42729
|
styles.borderFill.set(id, bf);
|
|
@@ -42744,12 +42745,12 @@ function parseRenderStyles(headXml, opts) {
|
|
|
42744
42745
|
if (g3 && autoTabPr.has(tab)) g3.autoTabLeft = true;
|
|
42745
42746
|
}
|
|
42746
42747
|
for (const [id, n] of paraNumber) {
|
|
42747
|
-
const g3 = styles.paraGeom.get(id), levels = numberings.get(n.id), lv = _optionalChain([levels, 'optionalAccess',
|
|
42748
|
+
const g3 = styles.paraGeom.get(id), levels = numberings.get(n.id), lv = _optionalChain([levels, 'optionalAccess', _851 => _851.get, 'call', _852 => _852(n.level)]);
|
|
42748
42749
|
if (g3 && levels && lv) g3.number = { id: n.id, level: n.level, heads: new Map([...levels].map(([k, v]) => [k, v.head])), ...lv.charPrId != null ? { charPrId: lv.charPrId } : {}, offset: lv.offset, offsetPct: lv.offsetPct, autoIndent: lv.autoIndent };
|
|
42749
42750
|
}
|
|
42750
42751
|
for (const [id, b] of paraBullet) {
|
|
42751
42752
|
const g3 = styles.paraGeom.get(id), bu = bullets.get(b);
|
|
42752
|
-
if (g3 && _optionalChain([bu, 'optionalAccess',
|
|
42753
|
+
if (g3 && _optionalChain([bu, 'optionalAccess', _853 => _853.ch])) g3.bullet = bu;
|
|
42753
42754
|
}
|
|
42754
42755
|
if (before2024) for (const st of styles.charPr.values()) st.before2024 = true;
|
|
42755
42756
|
if (halfQuote) for (const st of styles.charPr.values()) st.halfQuote = true;
|
|
@@ -42813,7 +42814,7 @@ function collectSites(scan) {
|
|
|
42813
42814
|
}
|
|
42814
42815
|
function attrOf3(openTag, name) {
|
|
42815
42816
|
const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
|
|
42816
|
-
return _optionalChain([m, 'optionalAccess',
|
|
42817
|
+
return _optionalChain([m, 'optionalAccess', _854 => _854[1]]);
|
|
42817
42818
|
}
|
|
42818
42819
|
function paraOpenTag(xml, para2) {
|
|
42819
42820
|
const end = xml.indexOf(">", para2.start);
|
|
@@ -42828,7 +42829,7 @@ function anchorRunInfo(xml, para2, anchor) {
|
|
|
42828
42829
|
if (!tr) return null;
|
|
42829
42830
|
const before2 = xml.slice(Math.max(0, para2.start), tr.contentStart);
|
|
42830
42831
|
const runOpen = [...before2.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
|
|
42831
|
-
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess',
|
|
42832
|
+
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _855 => _855[1]]), () => ( tr.prefix)), () => ( "hp"));
|
|
42832
42833
|
const charPr2 = runOpen && attrOf3(runOpen[0], "charPrIDRef") || "0";
|
|
42833
42834
|
const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
|
|
42834
42835
|
if (close === -1) return null;
|
|
@@ -42855,7 +42856,7 @@ function cellContentWidthMm(xml, cell2) {
|
|
|
42855
42856
|
if (width === null) return null;
|
|
42856
42857
|
let content = width;
|
|
42857
42858
|
const win = cellAddrWindow(xml, cell2);
|
|
42858
|
-
const mg = _optionalChain([win, 'optionalAccess',
|
|
42859
|
+
const mg = _optionalChain([win, 'optionalAccess', _856 => _856.match, 'call', _857 => _857(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
|
|
42859
42860
|
if (mg) {
|
|
42860
42861
|
content -= Number(_nullishCoalesce(attrOf3(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf3(mg[0], "right"), () => ( 0)));
|
|
42861
42862
|
}
|
|
@@ -42889,12 +42890,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
42889
42890
|
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>`;
|
|
42890
42891
|
}
|
|
42891
42892
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
42892
|
-
if (ops.length === 0) throw new (0,
|
|
42893
|
+
if (ops.length === 0) throw new (0, _chunkAS25R4EUcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42893
42894
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
42894
|
-
|
|
42895
|
+
_chunkAS25R4EUcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
42895
42896
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
42896
|
-
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access',
|
|
42897
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
42897
|
+
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))));
|
|
42898
|
+
if (sectionPaths.length === 0) throw new (0, _chunkAS25R4EUcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42898
42899
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
42899
42900
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
42900
42901
|
const styles = headerPath ? parseRenderStyles(await readZipEntry(zip.file(headerPath), "text")) : null;
|
|
@@ -42935,11 +42936,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42935
42936
|
const manifestItems = [];
|
|
42936
42937
|
const placed = [];
|
|
42937
42938
|
for (const op of ops) {
|
|
42938
|
-
if (!op.anchor) throw new (0,
|
|
42939
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
42939
|
+
if (!op.anchor) throw new (0, _chunkAS25R4EUcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
42940
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkAS25R4EUcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
42940
42941
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
42941
|
-
if (!MIME[ext]) throw new (0,
|
|
42942
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
42942
|
+
if (!MIME[ext]) throw new (0, _chunkAS25R4EUcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
42943
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkAS25R4EUcjs.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)`);
|
|
42943
42944
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
42944
42945
|
let found = null;
|
|
42945
42946
|
let total = 0;
|
|
@@ -42972,7 +42973,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42972
42973
|
}
|
|
42973
42974
|
}
|
|
42974
42975
|
}
|
|
42975
|
-
throw new (0,
|
|
42976
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(
|
|
42976
42977
|
`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)})`
|
|
42977
42978
|
);
|
|
42978
42979
|
}
|
|
@@ -42980,9 +42981,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42980
42981
|
const xml = sectionXmls[si];
|
|
42981
42982
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
42982
42983
|
if (!run) {
|
|
42983
|
-
throw new (0,
|
|
42984
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
42984
42985
|
}
|
|
42985
|
-
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess',
|
|
42986
|
+
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _864 => _864.charPr, 'access', _865 => _865.get, 'call', _866 => _866(run.charPr), 'optionalAccess', _867 => _867.height]), () => ( 1e3));
|
|
42986
42987
|
const fontPt = charPrHeight / 100;
|
|
42987
42988
|
const emMm = fontPt * 25.4 / 72;
|
|
42988
42989
|
const lineHMm = emMm;
|
|
@@ -42991,7 +42992,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42991
42992
|
const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
|
|
42992
42993
|
const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
|
|
42993
42994
|
const paraPrId = _nullishCoalesce(attrOf3(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
|
|
42994
|
-
const align = _optionalChain([styles, 'optionalAccess',
|
|
42995
|
+
const align = _optionalChain([styles, 'optionalAccess', _868 => _868.paraAlign, 'access', _869 => _869.get, 'call', _870 => _870(paraPrId)]);
|
|
42995
42996
|
let alignShiftMm = 0;
|
|
42996
42997
|
if (align === "CENTER" || align === "RIGHT") {
|
|
42997
42998
|
const paraWMm = measureMm(site.para.text, emMm);
|
|
@@ -43087,7 +43088,7 @@ function parseBorderFills(headerDoc) {
|
|
|
43087
43088
|
};
|
|
43088
43089
|
const fillBrush = findChildByLocalName(bf, "fillBrush");
|
|
43089
43090
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
43090
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
43091
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _871 => _871.getAttribute, 'call', _872 => _872("faceColor")]);
|
|
43091
43092
|
if (face && face !== "none") def.fill = { faceColor: face };
|
|
43092
43093
|
map.set(id, def);
|
|
43093
43094
|
}
|
|
@@ -43117,9 +43118,9 @@ function parseCharPrs(headerDoc, hangulFonts) {
|
|
|
43117
43118
|
if (color) def.textColor = color;
|
|
43118
43119
|
if (cp.getAttribute("bold") === "1") def.bold = true;
|
|
43119
43120
|
if (cp.getAttribute("italic") === "1") def.italic = true;
|
|
43120
|
-
if (_optionalChain([findChildByLocalName, 'call',
|
|
43121
|
+
if (_optionalChain([findChildByLocalName, 'call', _873 => _873(cp, "underline"), 'optionalAccess', _874 => _874.getAttribute, 'call', _875 => _875("type")]) === "BOTTOM") def.underline = true;
|
|
43121
43122
|
const fontRef = findChildByLocalName(cp, "fontRef");
|
|
43122
|
-
const hangul = _optionalChain([fontRef, 'optionalAccess',
|
|
43123
|
+
const hangul = _optionalChain([fontRef, 'optionalAccess', _876 => _876.getAttribute, 'call', _877 => _877("hangul")]);
|
|
43123
43124
|
if (hangul) {
|
|
43124
43125
|
def.fontRef_hangul = hangul;
|
|
43125
43126
|
const face = hangulFonts.get(hangul);
|
|
@@ -43147,7 +43148,7 @@ function parseTable4(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
43147
43148
|
const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
|
|
43148
43149
|
const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
|
|
43149
43150
|
const sz = findChildByLocalName(tbl2, "sz");
|
|
43150
|
-
const width = _optionalChain([sz, 'optionalAccess',
|
|
43151
|
+
const width = _optionalChain([sz, 'optionalAccess', _878 => _878.getAttribute, 'call', _879 => _879("width")]) || void 0;
|
|
43151
43152
|
const cells = [];
|
|
43152
43153
|
const usedBf = /* @__PURE__ */ new Set();
|
|
43153
43154
|
const usedCp = /* @__PURE__ */ new Set();
|
|
@@ -43160,17 +43161,17 @@ function parseTable4(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
43160
43161
|
const addr = findChildByLocalName(tc2, "cellAddr");
|
|
43161
43162
|
const span2 = findChildByLocalName(tc2, "cellSpan");
|
|
43162
43163
|
const csz = findChildByLocalName(tc2, "cellSz");
|
|
43163
|
-
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
43164
|
-
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
43164
|
+
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _880 => _880.getAttribute, 'call', _881 => _881("rowAddr")])), () => ( 0));
|
|
43165
|
+
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _882 => _882.getAttribute, 'call', _883 => _883("colAddr")])), () => ( 0));
|
|
43165
43166
|
if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
|
|
43166
43167
|
if (row === 0) row0Texts.set(col, directCellText(tc2));
|
|
43167
|
-
const colSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess',
|
|
43168
|
-
const rowSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess',
|
|
43168
|
+
const colSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess', _884 => _884.getAttribute, 'call', _885 => _885("colSpan")])), () => ( 1));
|
|
43169
|
+
const rowSpan = _nullishCoalesce(num(_optionalChain([span2, 'optionalAccess', _886 => _886.getAttribute, 'call', _887 => _887("rowSpan")])), () => ( 1));
|
|
43169
43170
|
const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
|
|
43170
43171
|
const cpId = firstRunCharPr(tc2);
|
|
43171
43172
|
const cell2 = { row, col, rowSpan, colSpan };
|
|
43172
|
-
const w = _optionalChain([csz, 'optionalAccess',
|
|
43173
|
-
const hh = _optionalChain([csz, 'optionalAccess',
|
|
43173
|
+
const w = _optionalChain([csz, 'optionalAccess', _888 => _888.getAttribute, 'call', _889 => _889("width")]);
|
|
43174
|
+
const hh = _optionalChain([csz, 'optionalAccess', _890 => _890.getAttribute, 'call', _891 => _891("height")]);
|
|
43174
43175
|
if (w) cell2.width_hwpunit = w;
|
|
43175
43176
|
if (hh) cell2.height_hwpunit = hh;
|
|
43176
43177
|
if (bfId) {
|
|
@@ -43258,16 +43259,16 @@ function pick(map, keys) {
|
|
|
43258
43259
|
return out;
|
|
43259
43260
|
}
|
|
43260
43261
|
async function hwpxToProfile(input) {
|
|
43261
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
43262
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkAS25R4EUcjs.toArrayBuffer.call(void 0, input);
|
|
43262
43263
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
43263
43264
|
const parser = createXmlParser();
|
|
43264
|
-
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access',
|
|
43265
|
+
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _892 => _892.file, 'call', _893 => _893(/[Hh]eader\.xml$/), 'optionalAccess', _894 => _894[0]])));
|
|
43265
43266
|
let headerXml = "<root/>";
|
|
43266
43267
|
if (headerFile) headerXml = await readZipEntry(headerFile, "text");
|
|
43267
43268
|
const headerDoc = parser.parseFromString(headerXml, "text/xml");
|
|
43268
43269
|
const borderFills = parseBorderFills(headerDoc);
|
|
43269
43270
|
const charPrs = parseCharPrs(headerDoc, parseHangulFonts(headerDoc));
|
|
43270
|
-
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access',
|
|
43271
|
+
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _895 => _895.name, 'access', _896 => _896.match, 'call', _897 => _897(/(\d+)\.xml$/), 'optionalAccess', _898 => _898[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _899 => _899.name, 'access', _900 => _900.match, 'call', _901 => _901(/(\d+)\.xml$/), 'optionalAccess', _902 => _902[1]]), () => ( null))), () => ( 0))));
|
|
43271
43272
|
const tables = [];
|
|
43272
43273
|
let tableIndex = 0;
|
|
43273
43274
|
for (const f of sectionFiles) {
|
|
@@ -43816,8 +43817,8 @@ function lintGongmunText(text, opts) {
|
|
|
43816
43817
|
const tableLine = /^\s*\|/.test(line) || /<t[dhr][\s>]/i.test(line);
|
|
43817
43818
|
for (const r of RULES) {
|
|
43818
43819
|
if (r.skipTable && tableLine) continue;
|
|
43819
|
-
if (r.documentOnly && !_optionalChain([opts, 'optionalAccess',
|
|
43820
|
-
if (r.rawSource && _optionalChain([opts, 'optionalAccess',
|
|
43820
|
+
if (r.documentOnly && !_optionalChain([opts, 'optionalAccess', _903 => _903.document])) continue;
|
|
43821
|
+
if (r.rawSource && _optionalChain([opts, 'optionalAccess', _904 => _904.parsed])) continue;
|
|
43821
43822
|
r.pattern.lastIndex = 0;
|
|
43822
43823
|
for (const m of line.matchAll(r.pattern)) {
|
|
43823
43824
|
const checked = r.check ? r.check(m) : void 0;
|
|
@@ -43833,7 +43834,7 @@ function lintGongmunText(text, opts) {
|
|
|
43833
43834
|
}
|
|
43834
43835
|
}
|
|
43835
43836
|
}
|
|
43836
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
43837
|
+
if (_optionalChain([opts, 'optionalAccess', _905 => _905.document]) && /^\s*붙\s*임(?![가-힣])/m.test(text) && !/끝\.\s*$/m.test(text)) {
|
|
43837
43838
|
findings.push({
|
|
43838
43839
|
line: lines.length,
|
|
43839
43840
|
match: "\uBD99\uC784",
|
|
@@ -44157,7 +44158,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
|
|
|
44157
44158
|
var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
|
|
44158
44159
|
function patchTableRows(input) {
|
|
44159
44160
|
const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
|
|
44160
|
-
const xml = _optionalChain([ctx, 'access',
|
|
44161
|
+
const xml = _optionalChain([ctx, 'access', _906 => _906.scans, 'access', _907 => _907[scanTable.sectionIndex], 'optionalAccess', _908 => _908.xml]);
|
|
44161
44162
|
if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
|
|
44162
44163
|
const numRows = table2.rows;
|
|
44163
44164
|
if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
|
|
@@ -44231,7 +44232,7 @@ function patchTableRows(input) {
|
|
|
44231
44232
|
const cells = input.editedCells(ins.ei);
|
|
44232
44233
|
if (!cells) return skip("\uC0BD\uC785 \uD589\uC5D0 \uC774\uBBF8\uC9C0/\uC911\uCCA9\uD45C \uD3EC\uD568 \u2014 \uD589 \uCD94\uAC00 \uBBF8\uC9C0\uC6D0");
|
|
44233
44234
|
for (const cell2 of cells) {
|
|
44234
|
-
const unstable = cell2.lines.find((l) =>
|
|
44235
|
+
const unstable = cell2.lines.find((l) => _chunkYG4GFQB7cjs.sanitizeText.call(void 0, l) !== l);
|
|
44235
44236
|
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");
|
|
44236
44237
|
}
|
|
44237
44238
|
const tmplCells = scanTable.rows[template];
|
|
@@ -44345,7 +44346,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
|
|
|
44345
44346
|
const rr = scanTable.rowRanges[template];
|
|
44346
44347
|
const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
|
|
44347
44348
|
const scan = scanSectionXml(wrapped, 0);
|
|
44348
|
-
const row = _optionalChain([scan, 'access',
|
|
44349
|
+
const row = _optionalChain([scan, 'access', _909 => _909.tables, 'access', _910 => _910[0], 'optionalAccess', _911 => _911.rows, 'access', _912 => _912[0]]);
|
|
44349
44350
|
if (!row || row.length !== cells.length) return null;
|
|
44350
44351
|
const splices = allLinesegRemovalSplices(wrapped);
|
|
44351
44352
|
for (let i = 0; i < cells.length; i++) {
|
|
@@ -44388,7 +44389,7 @@ function rowHeightOf(fragment) {
|
|
|
44388
44389
|
}
|
|
44389
44390
|
function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
|
|
44390
44391
|
const from = scanTable.start + tblOpenLen;
|
|
44391
|
-
const to = _nullishCoalesce(_optionalChain([scanTable, 'access',
|
|
44392
|
+
const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _913 => _913.rowRanges, 'access', _914 => _914[0], 'optionalAccess', _915 => _915.start]), () => ( from));
|
|
44392
44393
|
const slice = xml.slice(from, to);
|
|
44393
44394
|
const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
|
|
44394
44395
|
if (!szM || szM.index === void 0) return null;
|
|
@@ -44426,14 +44427,14 @@ function buildEmbeddedLineSplices(para2, xml, newLines) {
|
|
|
44426
44427
|
}
|
|
44427
44428
|
if (text !== para2.text || !/[\r\n]/.test(text) || /<br\s*\/?\s*>/i.test(text)) return null;
|
|
44428
44429
|
const lines = text.split(/\r\n|\r|\n/);
|
|
44429
|
-
if (lines.length !== newLines.length || lines.some((line) => !line.trim() ||
|
|
44430
|
+
if (lines.length !== newLines.length || lines.some((line) => !line.trim() || _chunkYG4GFQB7cjs.sanitizeText.call(void 0, line) !== line.trim())) return null;
|
|
44430
44431
|
const splices = [];
|
|
44431
44432
|
let offset = 0;
|
|
44432
44433
|
for (let i = 0; i < lines.length; i++) {
|
|
44433
44434
|
const line = lines[i];
|
|
44434
44435
|
const orig = line.trim();
|
|
44435
44436
|
const next = newLines[i];
|
|
44436
|
-
if (
|
|
44437
|
+
if (_chunkYG4GFQB7cjs.sanitizeText.call(void 0, next) !== next || /[\r\n]/.test(next) || /[\uD800-\uDFFF]/u.test(next) || decodeXmlEntities(escapeXmlText(next)) !== next) return null;
|
|
44437
44438
|
let prefix = 0;
|
|
44438
44439
|
while (prefix < orig.length && prefix < next.length && orig[prefix] === next[prefix]) prefix++;
|
|
44439
44440
|
if (prefix > 0 && /[\uD800-\uDBFF]/.test(orig[prefix - 1]) && /[\uDC00-\uDFFF]/.test(_nullishCoalesce(orig[prefix], () => ( "")))) prefix--;
|
|
@@ -44463,7 +44464,7 @@ function buildEmbeddedLineSplices(para2, xml, newLines) {
|
|
|
44463
44464
|
}
|
|
44464
44465
|
}
|
|
44465
44466
|
offset += line.length;
|
|
44466
|
-
offset += _nullishCoalesce(_optionalChain([text, 'access',
|
|
44467
|
+
offset += _nullishCoalesce(_optionalChain([text, 'access', _916 => _916.slice, 'call', _917 => _917(offset), 'access', _918 => _918.match, 'call', _919 => _919(/^(?:\r\n|\r|\n)/), 'optionalAccess', _920 => _920[0], 'access', _921 => _921.length]), () => ( 0));
|
|
44467
44468
|
}
|
|
44468
44469
|
return splices;
|
|
44469
44470
|
}
|
|
@@ -44520,11 +44521,11 @@ function parseEmphasis(text) {
|
|
|
44520
44521
|
}
|
|
44521
44522
|
const charBefore = (k) => {
|
|
44522
44523
|
const t = toks[k - 1];
|
|
44523
|
-
return _optionalChain([t, 'optionalAccess',
|
|
44524
|
+
return _optionalChain([t, 'optionalAccess', _922 => _922.kind]) === "text" ? t.text[t.text.length - 1] : t ? "x" : void 0;
|
|
44524
44525
|
};
|
|
44525
44526
|
const charAfter = (k) => {
|
|
44526
44527
|
const t = toks[k + 1];
|
|
44527
|
-
return _optionalChain([t, 'optionalAccess',
|
|
44528
|
+
return _optionalChain([t, 'optionalAccess', _923 => _923.kind]) === "text" ? t.text[0] : t ? "x" : void 0;
|
|
44528
44529
|
};
|
|
44529
44530
|
const stack = [];
|
|
44530
44531
|
for (let k = 0; k < toks.length; k++) {
|
|
@@ -44808,9 +44809,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
|
|
|
44808
44809
|
});
|
|
44809
44810
|
}
|
|
44810
44811
|
function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
|
|
44811
|
-
const irCell = _optionalChain([table2, 'access',
|
|
44812
|
+
const irCell = _optionalChain([table2, 'access', _924 => _924.cells, 'access', _925 => _925[oc.gridR], 'optionalAccess', _926 => _926[oc.gridC]]);
|
|
44812
44813
|
const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
|
|
44813
|
-
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess',
|
|
44814
|
+
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _927 => _927.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
|
|
44814
44815
|
if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
|
|
44815
44816
|
return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
|
|
44816
44817
|
}
|
|
@@ -44833,12 +44834,12 @@ function stripCellTokens(text) {
|
|
|
44833
44834
|
}
|
|
44834
44835
|
function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
44835
44836
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
44836
|
-
const content =
|
|
44837
|
+
const content = _chunkYG4GFQB7cjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
44837
44838
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
44838
44839
|
const t = line.trim();
|
|
44839
44840
|
if (!t) return "";
|
|
44840
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
44841
|
-
return
|
|
44841
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkYG4GFQB7cjs.escapeGfm.call(void 0, t)}**`;
|
|
44842
|
+
return _chunkYG4GFQB7cjs.escapeGfm.call(void 0, t);
|
|
44842
44843
|
}).filter(Boolean);
|
|
44843
44844
|
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");
|
|
44844
44845
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -44852,7 +44853,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
44852
44853
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
44853
44854
|
const replica = [];
|
|
44854
44855
|
for (let r = 0; r < table2.rows; r++) {
|
|
44855
|
-
const line =
|
|
44856
|
+
const line = _chunkYG4GFQB7cjs.escapeGfm.call(void 0, _chunkYG4GFQB7cjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
44856
44857
|
if (line) replica.push({ line, gridR: r });
|
|
44857
44858
|
}
|
|
44858
44859
|
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");
|
|
@@ -44878,7 +44879,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
44878
44879
|
};
|
|
44879
44880
|
const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
|
|
44880
44881
|
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)");
|
|
44881
|
-
const irCell = _optionalChain([table2, 'access',
|
|
44882
|
+
const irCell = _optionalChain([table2, 'access', _928 => _928.cells, 'access', _929 => _929[gridR], 'optionalAccess', _930 => _930[gridC]]);
|
|
44882
44883
|
const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
|
|
44883
44884
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
44884
44885
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -44892,12 +44893,12 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
44892
44893
|
const nonEmpty = cell2.paragraphs.filter((p) => normForMatch(p.text) !== "");
|
|
44893
44894
|
if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
|
|
44894
44895
|
const target = nonEmpty.length === 1 ? nonEmpty[0] : void 0;
|
|
44895
|
-
const sourceLines = _optionalChain([target, 'optionalAccess',
|
|
44896
|
+
const sourceLines = _optionalChain([target, 'optionalAccess', _931 => _931.text, 'access', _932 => _932.split, 'call', _933 => _933(/\r\n|\r|\n/), 'access', _934 => _934.map, 'call', _935 => _935((line) => line.trim())]);
|
|
44896
44897
|
const renderedLines = unescapeGfmCell(stripCellTokens(before2)).split("\n").map((line) => line.trim());
|
|
44897
|
-
if (target && _optionalChain([sourceLines, 'optionalAccess',
|
|
44898
|
-
const xml = _optionalChain([ctx, 'access',
|
|
44898
|
+
if (target && _optionalChain([sourceLines, 'optionalAccess', _936 => _936.length]) === origLineCount && sourceLines.every((line, i) => line === renderedLines[i]) && !extractCellTokens(before2)) {
|
|
44899
|
+
const xml = _optionalChain([ctx, 'access', _937 => _937.scans, 'access', _938 => _938[target.sectionIndex], 'optionalAccess', _939 => _939.xml]);
|
|
44899
44900
|
const precise = xml === void 0 ? null : buildEmbeddedLineSplices(target, xml, newLines);
|
|
44900
|
-
if (_optionalChain([precise, 'optionalAccess',
|
|
44901
|
+
if (_optionalChain([precise, 'optionalAccess', _940 => _940.length])) {
|
|
44901
44902
|
ctx.sectionSplices[target.sectionIndex].push(...precise);
|
|
44902
44903
|
return 1;
|
|
44903
44904
|
}
|
|
@@ -44906,14 +44907,14 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
44906
44907
|
}
|
|
44907
44908
|
const splices = [];
|
|
44908
44909
|
let sectionIndex = -1;
|
|
44909
|
-
const unstable = newLines.find((l) =>
|
|
44910
|
+
const unstable = newLines.find((l) => _chunkYG4GFQB7cjs.sanitizeText.call(void 0, l) !== l);
|
|
44910
44911
|
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");
|
|
44911
44912
|
if (nonEmpty.length === 0) {
|
|
44912
44913
|
if (newLines.length === 0) return 0;
|
|
44913
44914
|
const target = cell2.paragraphs[0];
|
|
44914
44915
|
if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
|
|
44915
44916
|
const value = newLines.join(" ");
|
|
44916
|
-
const xml = _optionalChain([ctx, 'access',
|
|
44917
|
+
const xml = _optionalChain([ctx, 'access', _941 => _941.scans, 'access', _942 => _942[target.sectionIndex], 'optionalAccess', _943 => _943.xml]);
|
|
44917
44918
|
const rawT = xml ? paraTText(target, xml) : null;
|
|
44918
44919
|
let sp;
|
|
44919
44920
|
if (xml && rawT === null) {
|
|
@@ -44947,7 +44948,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
44947
44948
|
}
|
|
44948
44949
|
for (let i = 0; i < nonEmpty.length; i++) {
|
|
44949
44950
|
if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
|
|
44950
|
-
const xml = _optionalChain([ctx, 'access',
|
|
44951
|
+
const xml = _optionalChain([ctx, 'access', _944 => _944.scans, 'access', _945 => _945[nonEmpty[i].sectionIndex], 'optionalAccess', _946 => _946.xml]);
|
|
44951
44952
|
const placeholderRaw = xml && isDatePlaceholder(nonEmpty[i].text) ? paraTText(nonEmpty[i], xml) : null;
|
|
44952
44953
|
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)));
|
|
44953
44954
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
@@ -45030,7 +45031,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
45030
45031
|
const paths = parseSectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
45031
45032
|
if (paths.length > 0) return paths;
|
|
45032
45033
|
}
|
|
45033
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
45034
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkAS25R4EUcjs.compareSectionPaths);
|
|
45034
45035
|
}
|
|
45035
45036
|
|
|
45036
45037
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -45159,7 +45160,7 @@ var Surgeon = (_class9 = class {
|
|
|
45159
45160
|
/** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
|
|
45160
45161
|
findEntry(path) {
|
|
45161
45162
|
const parts = path.replace(/^\//, "").split("/");
|
|
45162
|
-
let scope = _nullishCoalesce(_optionalChain([this, 'access',
|
|
45163
|
+
let scope = _nullishCoalesce(_optionalChain([this, 'access', _947 => _947.entries, 'access', _948 => _948[0], 'optionalAccess', _949 => _949.child]), () => ( -1));
|
|
45163
45164
|
let current;
|
|
45164
45165
|
for (const part of parts) {
|
|
45165
45166
|
const search = (idx) => {
|
|
@@ -45453,8 +45454,8 @@ function serializeRecords(recs, repl, inserts) {
|
|
|
45453
45454
|
parts.push(header, data);
|
|
45454
45455
|
};
|
|
45455
45456
|
for (let i = 0; i < recs.length; i++) {
|
|
45456
|
-
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess',
|
|
45457
|
-
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess',
|
|
45457
|
+
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _950 => _950.get, 'call', _951 => _951(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
|
|
45458
|
+
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _952 => _952.get, 'call', _953 => _953(i)]), () => ( recs[i].data)));
|
|
45458
45459
|
}
|
|
45459
45460
|
return Buffer.concat(parts);
|
|
45460
45461
|
}
|
|
@@ -45573,7 +45574,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
45573
45574
|
return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
|
|
45574
45575
|
}
|
|
45575
45576
|
const fhEntry = CFB2.find(cfb, "/FileHeader");
|
|
45576
|
-
if (!_optionalChain([fhEntry, 'optionalAccess',
|
|
45577
|
+
if (!_optionalChain([fhEntry, 'optionalAccess', _954 => _954.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
45577
45578
|
let flags;
|
|
45578
45579
|
try {
|
|
45579
45580
|
flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
|
|
@@ -45594,7 +45595,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
45594
45595
|
origBlocks = kept.blocks;
|
|
45595
45596
|
const visual = parseHwp5Document(originalBuf, { keepTrailingEmptyCols }).markdown;
|
|
45596
45597
|
if (kept.markdown !== visual && editedMarkdown === visual) {
|
|
45597
|
-
const verification2 = _optionalChain([options, 'optionalAccess',
|
|
45598
|
+
const verification2 = _optionalChain([options, 'optionalAccess', _955 => _955.verify]) === false ? void 0 : diffUnitLists(splitMarkdownUnits(visual), splitMarkdownUnits(editedMarkdown));
|
|
45598
45599
|
return { success: true, data: new Uint8Array(original), applied: 0, skipped, verification: verification2 };
|
|
45599
45600
|
}
|
|
45600
45601
|
if (editedFromVisual(kept.markdown, visual, editedMarkdown)) return fail(LAYOUT_MODE_MISMATCH);
|
|
@@ -45606,7 +45607,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
45606
45607
|
const scans = [];
|
|
45607
45608
|
for (let i = 0; i < sectionPaths.length; i++) {
|
|
45608
45609
|
const entry = CFB2.find(cfb, sectionPaths[i]);
|
|
45609
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
45610
|
+
if (!_optionalChain([entry, 'optionalAccess', _956 => _956.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
|
|
45610
45611
|
let stream;
|
|
45611
45612
|
try {
|
|
45612
45613
|
stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
@@ -45657,7 +45658,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
45657
45658
|
}
|
|
45658
45659
|
}
|
|
45659
45660
|
let verification;
|
|
45660
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
45661
|
+
if (_optionalChain([options, 'optionalAccess', _957 => _957.verify]) !== false) {
|
|
45661
45662
|
try {
|
|
45662
45663
|
const reparsed = parseHwp5Document(Buffer.from(data), { layoutTables: "keep", keepTrailingEmptyCols });
|
|
45663
45664
|
const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
|
|
@@ -45752,7 +45753,7 @@ function tableContentScore(irTable, scanTable) {
|
|
|
45752
45753
|
for (const [key, scanCell] of scanTable.cells) {
|
|
45753
45754
|
const comma = key.indexOf(",");
|
|
45754
45755
|
const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
|
|
45755
|
-
const irCell = _optionalChain([irTable, 'access',
|
|
45756
|
+
const irCell = _optionalChain([irTable, 'access', _958 => _958.cells, 'access', _959 => _959[r], 'optionalAccess', _960 => _960[c]]);
|
|
45756
45757
|
if (!irCell) continue;
|
|
45757
45758
|
const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
|
|
45758
45759
|
const b = normForMatch(stripCellTokens(irCell.text));
|
|
@@ -45788,7 +45789,7 @@ function handleModified(orig, edited, ctx) {
|
|
|
45788
45789
|
}
|
|
45789
45790
|
function patchParagraph(block, orig, edited, ctx, skip) {
|
|
45790
45791
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
45791
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
45792
|
+
if (!_optionalChain([mapping, 'optionalAccess', _961 => _961.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)");
|
|
45792
45793
|
const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
|
|
45793
45794
|
let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
|
|
45794
45795
|
if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
|
|
@@ -45817,7 +45818,7 @@ function patchParagraph(block, orig, edited, ctx, skip) {
|
|
|
45817
45818
|
}
|
|
45818
45819
|
const origPlain = block.text != null ? block.text : restoreBr(textUnitToPlain(orig.raw, block));
|
|
45819
45820
|
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");
|
|
45820
|
-
if (
|
|
45821
|
+
if (_chunkYG4GFQB7cjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
45821
45822
|
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");
|
|
45822
45823
|
}
|
|
45823
45824
|
let origMd = restoreBr(textUnitToPlain(orig.raw, block));
|
|
@@ -45864,7 +45865,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
45864
45865
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
45865
45866
|
continue;
|
|
45866
45867
|
}
|
|
45867
|
-
if (afterEach.some((l) =>
|
|
45868
|
+
if (afterEach.some((l) => _chunkYG4GFQB7cjs.sanitizeText.call(void 0, l) !== l)) {
|
|
45868
45869
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
45869
45870
|
continue;
|
|
45870
45871
|
}
|
|
@@ -45892,7 +45893,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
45892
45893
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
45893
45894
|
break;
|
|
45894
45895
|
}
|
|
45895
|
-
if (
|
|
45896
|
+
if (_chunkYG4GFQB7cjs.sanitizeText.call(void 0, after2) !== after2) {
|
|
45896
45897
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
45897
45898
|
break;
|
|
45898
45899
|
}
|
|
@@ -45948,12 +45949,12 @@ function patchHtmlCells5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
45948
45949
|
}
|
|
45949
45950
|
function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
45950
45951
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
45951
|
-
const content =
|
|
45952
|
+
const content = _chunkYG4GFQB7cjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
45952
45953
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
45953
45954
|
const t = line.trim();
|
|
45954
45955
|
if (!t) return "";
|
|
45955
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
45956
|
-
return
|
|
45956
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkYG4GFQB7cjs.escapeGfm.call(void 0, t)}**`;
|
|
45957
|
+
return _chunkYG4GFQB7cjs.escapeGfm.call(void 0, t);
|
|
45957
45958
|
}).filter(Boolean);
|
|
45958
45959
|
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");
|
|
45959
45960
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -45967,7 +45968,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
45967
45968
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
45968
45969
|
const replica = [];
|
|
45969
45970
|
for (let r = 0; r < table2.rows; r++) {
|
|
45970
|
-
const line =
|
|
45971
|
+
const line = _chunkYG4GFQB7cjs.escapeGfm.call(void 0, _chunkYG4GFQB7cjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
45971
45972
|
if (line) replica.push({ line, gridR: r });
|
|
45972
45973
|
}
|
|
45973
45974
|
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");
|
|
@@ -45993,7 +45994,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
45993
45994
|
};
|
|
45994
45995
|
const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
|
|
45995
45996
|
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)");
|
|
45996
|
-
const irCell = _optionalChain([table2, 'access',
|
|
45997
|
+
const irCell = _optionalChain([table2, 'access', _962 => _962.cells, 'access', _963 => _963[gridR], 'optionalAccess', _964 => _964[gridC]]);
|
|
45997
45998
|
const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
|
|
45998
45999
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
45999
46000
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -46008,7 +46009,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
46008
46009
|
if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
|
|
46009
46010
|
return skip("\uC140 \uC904 \uACBD\uACC4 \uB9E4\uD551 \uBAA8\uD638 (\uBB38\uB2E8 \uB0B4 \uC904\uBC14\uAFC8) \u2014 \uBBF8\uC9C0\uC6D0");
|
|
46010
46011
|
}
|
|
46011
|
-
const unstable = newLines.find((l) =>
|
|
46012
|
+
const unstable = newLines.find((l) => _chunkYG4GFQB7cjs.sanitizeText.call(void 0, l) !== l);
|
|
46012
46013
|
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");
|
|
46013
46014
|
const targets = nonEmpty.length > 0 ? nonEmpty : cell2.paras;
|
|
46014
46015
|
if (targets.length === 0) return skip("\uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC74C \u2014 \uBBF8\uC9C0\uC6D0");
|
|
@@ -46255,7 +46256,7 @@ function stageParaPatch(scan, para2, newPlain, skip, origPlain) {
|
|
|
46255
46256
|
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");
|
|
46256
46257
|
}
|
|
46257
46258
|
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");
|
|
46258
|
-
const edit = origPlain !== void 0 && !origPlain.includes("\n") && !newPlain.includes("\n") ? _optionalChain([alignedTextEdits, 'call',
|
|
46259
|
+
const edit = origPlain !== void 0 && !origPlain.includes("\n") && !newPlain.includes("\n") ? _optionalChain([alignedTextEdits, 'call', _965 => _965(para2.rawText, origPlain, newPlain), 'optionalAccess', _966 => _966[0]]) : void 0;
|
|
46259
46260
|
const lead = para2.rawText.match(/^\s*/)[0];
|
|
46260
46261
|
const trail = para2.rawText.match(/\s*$/)[0];
|
|
46261
46262
|
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;
|
|
@@ -46306,7 +46307,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
46306
46307
|
origBlocks = parsed.blocks;
|
|
46307
46308
|
const visual = await parseHwpxDocument(u8ToArrayBuffer(original), { keepTrailingEmptyCols });
|
|
46308
46309
|
if (parsed.markdown !== visual.markdown && editedMarkdown === visual.markdown) {
|
|
46309
|
-
const verification2 = _optionalChain([options, 'optionalAccess',
|
|
46310
|
+
const verification2 = _optionalChain([options, 'optionalAccess', _967 => _967.verify]) === false ? void 0 : diffUnitLists(splitMarkdownUnits(visual.markdown), splitMarkdownUnits(editedMarkdown));
|
|
46310
46311
|
return { success: true, data: new Uint8Array(original), applied: 0, skipped, verification: verification2 };
|
|
46311
46312
|
}
|
|
46312
46313
|
if (editedFromVisual(parsed.markdown, visual.markdown, editedMarkdown)) return { success: false, applied: 0, skipped, error: LAYOUT_MODE_MISMATCH };
|
|
@@ -46392,7 +46393,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
46392
46393
|
}
|
|
46393
46394
|
}
|
|
46394
46395
|
let verification;
|
|
46395
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
46396
|
+
if (_optionalChain([options, 'optionalAccess', _968 => _968.verify]) !== false) {
|
|
46396
46397
|
const issues = replacements.size > 0 ? checkPatchIntegrity(original, data, replacements, edited) : [];
|
|
46397
46398
|
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("; ")}` };
|
|
46398
46399
|
try {
|
|
@@ -46410,19 +46411,19 @@ function buildOrigUnits(blocks) {
|
|
|
46410
46411
|
const block = blocks[i];
|
|
46411
46412
|
let consume = 1;
|
|
46412
46413
|
let chunk;
|
|
46413
|
-
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(
|
|
46414
|
+
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(_chunkYG4GFQB7cjs.sanitizeText.call(void 0, block.text))) {
|
|
46414
46415
|
const next = blocks[i + 1];
|
|
46415
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
46416
|
-
chunk =
|
|
46416
|
+
if (_optionalChain([next, 'optionalAccess', _969 => _969.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
46417
|
+
chunk = _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
46417
46418
|
} else {
|
|
46418
|
-
chunk =
|
|
46419
|
+
chunk = _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, [block]);
|
|
46419
46420
|
}
|
|
46420
46421
|
if (chunk) {
|
|
46421
46422
|
const subUnits = splitMarkdownUnits(chunk);
|
|
46422
46423
|
const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
|
|
46423
46424
|
for (let s = 0; s < subUnits.length; s++) {
|
|
46424
46425
|
const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
|
|
46425
|
-
if (block.type === "table" && _optionalChain([block, 'access',
|
|
46426
|
+
if (block.type === "table" && _optionalChain([block, 'access', _970 => _970.table, 'optionalAccess', _971 => _971.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
|
|
46426
46427
|
u.role = "caption";
|
|
46427
46428
|
}
|
|
46428
46429
|
units.push(u);
|
|
@@ -46631,7 +46632,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
46631
46632
|
const ti = ctx.tableInsert;
|
|
46632
46633
|
if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
|
|
46633
46634
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
46634
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
46635
|
+
if (!_optionalChain([mapping, 'optionalAccess', _972 => _972.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");
|
|
46635
46636
|
const para2 = mapping.para;
|
|
46636
46637
|
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");
|
|
46637
46638
|
const scan = ctx.scans[para2.sectionIndex];
|
|
@@ -46659,7 +46660,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
46659
46660
|
}
|
|
46660
46661
|
function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
46661
46662
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
46662
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
46663
|
+
if (!_optionalChain([mapping, 'optionalAccess', _973 => _973.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)");
|
|
46663
46664
|
if (block.text && block.text.includes("\n")) {
|
|
46664
46665
|
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)");
|
|
46665
46666
|
}
|
|
@@ -46667,9 +46668,9 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
46667
46668
|
const newInline = parseEmphasis(textUnitInline(edited.raw, block));
|
|
46668
46669
|
let origPlain = origInline.plain;
|
|
46669
46670
|
let newPlain = newInline.plain;
|
|
46670
|
-
const segsUsable = !block.footnoteText && !_optionalChain([mapping, 'access',
|
|
46671
|
+
const segsUsable = !block.footnoteText && !_optionalChain([mapping, 'access', _974 => _974.noteMarks, 'optionalAccess', _975 => _975.length]) && !mapping.prefixStripped;
|
|
46671
46672
|
if (block.footnoteText) {
|
|
46672
|
-
const origNote = block.footnoteBlocks ? _optionalChain([origPlain, 'access',
|
|
46673
|
+
const origNote = block.footnoteBlocks ? _optionalChain([origPlain, 'access', _976 => _976.match, 'call', _977 => _977(/\s*\(주: ([\s\S]*)\)$/), 'optionalAccess', _978 => _978[1]]) : void 0;
|
|
46673
46674
|
origPlain = origPlain.replace(/\s*\(주: [\s\S]*\)$/, "");
|
|
46674
46675
|
const noteMatch = newPlain.match(/\s*\(주: ([\s\S]*)\)$/);
|
|
46675
46676
|
if (noteMatch) {
|
|
@@ -46681,7 +46682,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
46681
46682
|
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})` });
|
|
46682
46683
|
}
|
|
46683
46684
|
}
|
|
46684
|
-
if (_optionalChain([mapping, 'access',
|
|
46685
|
+
if (_optionalChain([mapping, 'access', _979 => _979.noteMarks, 'optionalAccess', _980 => _980.length])) {
|
|
46685
46686
|
origPlain = removeNoteMarks(origPlain, mapping.noteMarks).text;
|
|
46686
46687
|
const r = removeNoteMarks(newPlain, mapping.noteMarks);
|
|
46687
46688
|
newPlain = r.text;
|
|
@@ -46699,10 +46700,10 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
46699
46700
|
}
|
|
46700
46701
|
}
|
|
46701
46702
|
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");
|
|
46702
|
-
if (
|
|
46703
|
+
if (_chunkYG4GFQB7cjs.sanitizeText.call(void 0, newPlain) !== newPlain && _chunkYG4GFQB7cjs.sanitizeText.call(void 0, origPlain) === origPlain) {
|
|
46703
46704
|
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");
|
|
46704
46705
|
}
|
|
46705
|
-
const xml = _optionalChain([ctx, 'access',
|
|
46706
|
+
const xml = _optionalChain([ctx, 'access', _981 => _981.scans, 'access', _982 => _982[mapping.para.sectionIndex], 'optionalAccess', _983 => _983.xml]);
|
|
46706
46707
|
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)));
|
|
46707
46708
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
46708
46709
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
@@ -46716,14 +46717,14 @@ function textUnitToPlain(raw, block) {
|
|
|
46716
46717
|
}
|
|
46717
46718
|
function textUnitInline(raw, block) {
|
|
46718
46719
|
let text = raw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
46719
|
-
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(
|
|
46720
|
+
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(_chunkYG4GFQB7cjs.sanitizeText.call(void 0, block.text))) {
|
|
46720
46721
|
text = text.replace(/^#{1,6}\s+/, "");
|
|
46721
46722
|
}
|
|
46722
46723
|
if (block.href) {
|
|
46723
46724
|
const linkMatch = text.match(/^\[([\s\S]*)\]\([^)]*\)$/);
|
|
46724
46725
|
if (linkMatch) text = linkMatch[1];
|
|
46725
46726
|
}
|
|
46726
|
-
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(
|
|
46727
|
+
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(_chunkYG4GFQB7cjs.sanitizeText.call(void 0, block.text))) {
|
|
46727
46728
|
text = text.slice(1, -1);
|
|
46728
46729
|
}
|
|
46729
46730
|
return text;
|
|
@@ -47230,7 +47231,7 @@ var REF_NOUN = alt([
|
|
|
47230
47231
|
]);
|
|
47231
47232
|
var REF = `\\s?\\((?!(?:${REF_NOUN})[),])[\uAC00-\uD7A3]{1,6}(?:\\d{0,2}(?:\uB3D9|\uB9AC)|\\d{1,2}\uAC00)(?:,\\s?[^)]{1,30})?\\)`;
|
|
47232
47233
|
var PLACEHOLDER_NO = /(?<![\d-])0+(?![\d])/;
|
|
47233
|
-
var realNumber = (x) => !PLACEHOLDER_NO.test(_nullishCoalesce(_optionalChain([x, 'access',
|
|
47234
|
+
var realNumber = (x) => !PLACEHOLDER_NO.test(_nullishCoalesce(_optionalChain([x, 'access', _984 => _984.m, 'access', _985 => _985.groups, 'optionalAccess', _986 => _986.rest]), () => ( "")));
|
|
47234
47235
|
var ADDRESS_VARIANTS = [
|
|
47235
47236
|
{
|
|
47236
47237
|
// 도로명 주소 — 읍·면, 동·리("서울시 도봉구 창동 우이천로 4다길 9"·"서천군 판교면 판교리 대백제로 1999") 뒤도, 참고항목까지
|
|
@@ -48339,9 +48340,9 @@ var REGION_WORDS = /* @__PURE__ */ new Set([...SIDO, ...SIGUNGU, ...SIGUNGU.filt
|
|
|
48339
48340
|
var NON_NAME_END = /(?:적|하여|하는|하고|하며|하게|하기|하면|하다|한다|했다|는데|니다|습니|다고|해야|해서|되는|되어|된다|지만|니까|와서|워서)$/;
|
|
48340
48341
|
var FOREIGN_SYLLABLE = /[스트크드브프즈츠끄뜨쁘쓰쯔플클블러케퍼커터텔톤튼픈핀펜헨앤엔엠켓렛쇼핑]/;
|
|
48341
48342
|
var TITLE_SET = /* @__PURE__ */ new Set([...TITLES, ...RANKS, ...PARTY_ROLES]);
|
|
48342
|
-
var g = (x, name) => _nullishCoalesce(_optionalChain([x, 'access',
|
|
48343
|
+
var g = (x, name) => _nullishCoalesce(_optionalChain([x, 'access', _987 => _987.m, 'access', _988 => _988.groups, 'optionalAccess', _989 => _989[name]]), () => ( ""));
|
|
48343
48344
|
var nameOf = (x) => g(x, "dsur") + g(x, "dgiven") + g(x, "sur") + g(x, "given") + g(x, "given1");
|
|
48344
|
-
var span = (x) => _optionalChain([x, 'access',
|
|
48345
|
+
var span = (x) => _optionalChain([x, 'access', _990 => _990.m, 'access', _991 => _991.indices, 'optionalAccess', _992 => _992.groups, 'optionalAccess', _993 => _993.n]);
|
|
48345
48346
|
var nextIs = (x, re) => {
|
|
48346
48347
|
const n = span(x);
|
|
48347
48348
|
return !!n && re.test(x.m.input.slice(n[1], n[1] + 1));
|
|
@@ -48713,7 +48714,7 @@ function labelsBefore(norm2, start) {
|
|
|
48713
48714
|
return labelsIn(win);
|
|
48714
48715
|
}
|
|
48715
48716
|
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;
|
|
48716
|
-
var g2 = (x, name) => _nullishCoalesce(_optionalChain([x, 'access',
|
|
48717
|
+
var g2 = (x, name) => _nullishCoalesce(_optionalChain([x, 'access', _994 => _994.m, 'access', _995 => _995.groups, 'optionalAccess', _996 => _996[name]]), () => ( ""));
|
|
48717
48718
|
var has = (x, c) => x.ctx().has(c);
|
|
48718
48719
|
var crnOnly = (x) => has(x, "crn") && !has(x, "rrn");
|
|
48719
48720
|
var after = (x, n = 16) => {
|
|
@@ -49021,9 +49022,9 @@ function normalizeForDetect(text) {
|
|
|
49021
49022
|
}
|
|
49022
49023
|
function maskMatch(orig, norm2, start, x, v, maskChar) {
|
|
49023
49024
|
const chars = orig.split("");
|
|
49024
|
-
const idx = _optionalChain([x, 'access',
|
|
49025
|
+
const idx = _optionalChain([x, 'access', _997 => _997.m, 'access', _998 => _998.indices, 'optionalAccess', _999 => _999.groups]);
|
|
49025
49026
|
for (const name of v.mask) {
|
|
49026
|
-
const r = _optionalChain([idx, 'optionalAccess',
|
|
49027
|
+
const r = _optionalChain([idx, 'optionalAccess', _1000 => _1000[name]]);
|
|
49027
49028
|
if (!r) continue;
|
|
49028
49029
|
for (let i = r[0] - start; i < r[1] - start; i++) {
|
|
49029
49030
|
if (v.maskAll || /[\p{L}\p{N}]/u.test(norm2[start + i])) chars[i] = maskChar;
|
|
@@ -49048,7 +49049,7 @@ function detect(text, rules, maskChar, headerAt) {
|
|
|
49048
49049
|
const re = v.re;
|
|
49049
49050
|
re.lastIndex = 0;
|
|
49050
49051
|
for (let m = re.exec(norm2); m !== null; m = re.exec(norm2)) {
|
|
49051
|
-
const sg = v.span ? _optionalChain([m, 'access',
|
|
49052
|
+
const sg = v.span ? _optionalChain([m, 'access', _1001 => _1001.indices, 'optionalAccess', _1002 => _1002.groups, 'optionalAccess', _1003 => _1003[v.span]]) : void 0;
|
|
49052
49053
|
const start = sg ? sg[0] : m.index;
|
|
49053
49054
|
const end = sg ? sg[1] : start + m[0].length;
|
|
49054
49055
|
const retry = () => {
|
|
@@ -49077,7 +49078,7 @@ function detect(text, rules, maskChar, headerAt) {
|
|
|
49077
49078
|
const x = {
|
|
49078
49079
|
m,
|
|
49079
49080
|
ctx,
|
|
49080
|
-
header: () => _optionalChain([headerAt, 'optionalCall',
|
|
49081
|
+
header: () => _optionalChain([headerAt, 'optionalCall', _1004 => _1004(start)]),
|
|
49081
49082
|
prev: () => {
|
|
49082
49083
|
let best;
|
|
49083
49084
|
for (const o of occupied) if (o.end <= start && (!best || o.end > best.end)) best = o;
|
|
@@ -49105,9 +49106,9 @@ function applyHits(text, hits) {
|
|
|
49105
49106
|
return out + text.slice(cursor);
|
|
49106
49107
|
}
|
|
49107
49108
|
function redactText(text, options) {
|
|
49108
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49109
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1005 => _1005.maskChar]), () => ( "\u25CF"));
|
|
49109
49110
|
assertMaskChar(maskChar);
|
|
49110
|
-
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49111
|
+
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1006 => _1006.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
49111
49112
|
if (text === "" || rules.length === 0) return { text, hits: [] };
|
|
49112
49113
|
const hits = detect(text, rules, maskChar);
|
|
49113
49114
|
return { text: applyHits(text, hits), hits };
|
|
@@ -49125,7 +49126,7 @@ function htmlCells(line) {
|
|
|
49125
49126
|
const out = [];
|
|
49126
49127
|
let col = 0;
|
|
49127
49128
|
for (const m of line.matchAll(/<t([dh])\b([^>]*)>([\s\S]*?)<\/t\1>/gi)) {
|
|
49128
|
-
const span2 = Math.max(1, Number(_nullishCoalesce(_optionalChain([m, 'access',
|
|
49129
|
+
const span2 = Math.max(1, Number(_nullishCoalesce(_optionalChain([m, 'access', _1007 => _1007[2], 'access', _1008 => _1008.match, 'call', _1009 => _1009(/colspan="?(\d+)/i), 'optionalAccess', _1010 => _1010[1]]), () => ( 1))));
|
|
49129
49130
|
out.push({ start: m.index, end: m.index + m[0].length, col, span: span2, text: m[3].replace(/<[^>]*>/g, " ") });
|
|
49130
49131
|
col += span2;
|
|
49131
49132
|
}
|
|
@@ -49167,7 +49168,7 @@ function tableHeaderContext(lines) {
|
|
|
49167
49168
|
const c = cells.find((x) => off >= x.start && off < x.end);
|
|
49168
49169
|
if (!c) return void 0;
|
|
49169
49170
|
const h = hdr.find((x) => c.col >= x.col && c.col < x.col + x.span);
|
|
49170
|
-
return _optionalChain([h, 'optionalAccess',
|
|
49171
|
+
return _optionalChain([h, 'optionalAccess', _1011 => _1011.text]);
|
|
49171
49172
|
});
|
|
49172
49173
|
}
|
|
49173
49174
|
}
|
|
@@ -49236,9 +49237,9 @@ function detectMarkdownLine(line, rules, maskChar, headerAt) {
|
|
|
49236
49237
|
});
|
|
49237
49238
|
}
|
|
49238
49239
|
function redactMarkdown(markdown, options) {
|
|
49239
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49240
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1012 => _1012.maskChar]), () => ( "\u25CF"));
|
|
49240
49241
|
assertMaskChar(maskChar);
|
|
49241
|
-
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49242
|
+
const rules = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1013 => _1013.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
49242
49243
|
const lines = markdown.split("\n");
|
|
49243
49244
|
const headers = tableHeaderContext(lines);
|
|
49244
49245
|
const hits = [];
|
|
@@ -49268,10 +49269,10 @@ function sameBreadcrumb(a, b) {
|
|
|
49268
49269
|
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
49269
49270
|
}
|
|
49270
49271
|
function blocksToChunks(blocks, options) {
|
|
49271
|
-
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49272
|
-
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49273
|
-
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess',
|
|
49274
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
49272
|
+
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1014 => _1014.granularity]), () => ( "section"));
|
|
49273
|
+
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1015 => _1015.includeTableCells]), () => ( false));
|
|
49274
|
+
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess', _1016 => _1016.tableFormat]) };
|
|
49275
|
+
if (_optionalChain([options, 'optionalAccess', _1017 => _1017.tableFormat]) === "gfm") _chunkYG4GFQB7cjs.assignTableIds.call(void 0, blocks);
|
|
49275
49276
|
const chunks = [];
|
|
49276
49277
|
const headingStack = [];
|
|
49277
49278
|
const listStack = [];
|
|
@@ -49285,12 +49286,12 @@ function blocksToChunks(blocks, options) {
|
|
|
49285
49286
|
let run = null;
|
|
49286
49287
|
const flushRun = () => {
|
|
49287
49288
|
if (!run) return;
|
|
49288
|
-
push("text", run.breadcrumb,
|
|
49289
|
+
push("text", run.breadcrumb, _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, run.blocks, mdOptions), [run.start, run.end], run.page);
|
|
49289
49290
|
run = null;
|
|
49290
49291
|
};
|
|
49291
49292
|
for (let i = 0; i < blocks.length; i++) {
|
|
49292
49293
|
const block = blocks[i];
|
|
49293
|
-
const md2 =
|
|
49294
|
+
const md2 = _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, [block], mdOptions);
|
|
49294
49295
|
if (!md2) continue;
|
|
49295
49296
|
if (block.type === "heading") {
|
|
49296
49297
|
flushRun();
|
|
@@ -49378,7 +49379,7 @@ function u8ToArrayBuffer2(u8) {
|
|
|
49378
49379
|
return u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
|
|
49379
49380
|
}
|
|
49380
49381
|
function irCellLines(text) {
|
|
49381
|
-
return stripCellTokens(
|
|
49382
|
+
return stripCellTokens(_chunkYG4GFQB7cjs.sanitizeText.call(void 0, text)).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
49382
49383
|
}
|
|
49383
49384
|
var HwpxSession = (_class10 = class _HwpxSession {
|
|
49384
49385
|
|
|
@@ -49408,7 +49409,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49408
49409
|
const block = st.blocks[blockIndex];
|
|
49409
49410
|
if (!block) return void 0;
|
|
49410
49411
|
if (block.type === "paragraph" || block.type === "heading") {
|
|
49411
|
-
const para2 = _optionalChain([st, 'access',
|
|
49412
|
+
const para2 = _optionalChain([st, 'access', _1018 => _1018.paraMap, 'access', _1019 => _1019.get, 'call', _1020 => _1020(blockIndex), 'optionalAccess', _1021 => _1021.para]);
|
|
49412
49413
|
if (!para2) return void 0;
|
|
49413
49414
|
return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
|
|
49414
49415
|
}
|
|
@@ -49433,7 +49434,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49433
49434
|
if (block.text && block.text.includes("\n")) {
|
|
49434
49435
|
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)" };
|
|
49435
49436
|
}
|
|
49436
|
-
if (!_optionalChain([st, 'access',
|
|
49437
|
+
if (!_optionalChain([st, 'access', _1022 => _1022.paraMap, 'access', _1023 => _1023.get, 'call', _1024 => _1024(blockIndex), 'optionalAccess', _1025 => _1025.para])) {
|
|
49437
49438
|
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)" };
|
|
49438
49439
|
}
|
|
49439
49440
|
return { capability: "text" };
|
|
@@ -49499,7 +49500,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49499
49500
|
continue;
|
|
49500
49501
|
}
|
|
49501
49502
|
if (block.type === "table" && block.table) {
|
|
49502
|
-
if (!_optionalChain([edit, 'access',
|
|
49503
|
+
if (!_optionalChain([edit, 'access', _1026 => _1026.cells, 'optionalAccess', _1027 => _1027.length])) {
|
|
49503
49504
|
skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
|
|
49504
49505
|
continue;
|
|
49505
49506
|
}
|
|
@@ -49519,7 +49520,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49519
49520
|
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) });
|
|
49520
49521
|
continue;
|
|
49521
49522
|
}
|
|
49522
|
-
const irCell = _optionalChain([block, 'access',
|
|
49523
|
+
const irCell = _optionalChain([block, 'access', _1028 => _1028.table, 'access', _1029 => _1029.cells, 'access', _1030 => _1030[cellEdit.row], 'optionalAccess', _1031 => _1031[cellEdit.col]]);
|
|
49523
49524
|
if (!irCell) {
|
|
49524
49525
|
skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
|
|
49525
49526
|
continue;
|
|
@@ -49575,7 +49576,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49575
49576
|
}
|
|
49576
49577
|
if (replacements.size === 0) {
|
|
49577
49578
|
let changes2;
|
|
49578
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
49579
|
+
if (_optionalChain([options, 'optionalAccess', _1032 => _1032.verify]) !== false) {
|
|
49579
49580
|
const units = splitMarkdownUnits(st.markdown);
|
|
49580
49581
|
changes2 = diffUnitLists(units, units);
|
|
49581
49582
|
}
|
|
@@ -49596,7 +49597,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49596
49597
|
}
|
|
49597
49598
|
this.state = newState;
|
|
49598
49599
|
let changes;
|
|
49599
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
49600
|
+
if (_optionalChain([options, 'optionalAccess', _1033 => _1033.verify]) !== false) {
|
|
49600
49601
|
changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
|
|
49601
49602
|
}
|
|
49602
49603
|
return { success: true, data: new Uint8Array(data), applied, skipped, changes };
|
|
@@ -49616,11 +49617,11 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49616
49617
|
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)");
|
|
49617
49618
|
}
|
|
49618
49619
|
const mapping = st.paraMap.get(blockIndex);
|
|
49619
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
49620
|
+
if (!_optionalChain([mapping, 'optionalAccess', _1034 => _1034.para])) {
|
|
49620
49621
|
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)");
|
|
49621
49622
|
}
|
|
49622
49623
|
let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
49623
|
-
if (_optionalChain([mapping, 'access',
|
|
49624
|
+
if (_optionalChain([mapping, 'access', _1035 => _1035.noteMarks, 'optionalAccess', _1036 => _1036.length])) {
|
|
49624
49625
|
const r = removeNoteMarks(newPlain, mapping.noteMarks);
|
|
49625
49626
|
newPlain = r.text;
|
|
49626
49627
|
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(" ") });
|
|
@@ -49638,17 +49639,17 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49638
49639
|
if (newPlain === "") {
|
|
49639
49640
|
return skip("\uBE14\uB85D \uBE44\uC6B0\uAE30/\uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 (v1) \u2014 \uC6D0\uBCF8 \uC720\uC9C0");
|
|
49640
49641
|
}
|
|
49641
|
-
if (
|
|
49642
|
+
if (_chunkYG4GFQB7cjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
49642
49643
|
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");
|
|
49643
49644
|
}
|
|
49644
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access',
|
|
49645
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _1037 => _1037.scans, 'access', _1038 => _1038[mapping.para.sectionIndex], 'optionalAccess', _1039 => _1039.xml]));
|
|
49645
49646
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
49646
49647
|
sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
49647
49648
|
return 1;
|
|
49648
49649
|
}
|
|
49649
49650
|
}, _class10);
|
|
49650
49651
|
function cellStaticCheck(table2, scanTable, r, c) {
|
|
49651
|
-
const irCell = _optionalChain([table2, 'access',
|
|
49652
|
+
const irCell = _optionalChain([table2, 'access', _1040 => _1040.cells, 'access', _1041 => _1041[r], 'optionalAccess', _1042 => _1042[c]]);
|
|
49652
49653
|
if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
|
|
49653
49654
|
const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
|
|
49654
49655
|
if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
|
|
@@ -49733,16 +49734,16 @@ var md = new (0, _markdownit2.default)({
|
|
|
49733
49734
|
});
|
|
49734
49735
|
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;
|
|
49735
49736
|
function sanitizeRawHtml(raw) {
|
|
49736
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
49737
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkAS25R4EUcjs.escapeHtml.call(void 0, tag));
|
|
49737
49738
|
}
|
|
49738
49739
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
49739
49740
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
49740
49741
|
function renderHtml(markdown, options) {
|
|
49741
|
-
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49742
|
-
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49742
|
+
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1043 => _1043.preset]), () => ( "default"));
|
|
49743
|
+
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _1044 => _1044.extraCss]), () => ( "")));
|
|
49743
49744
|
const body = md.render(markdown);
|
|
49744
|
-
const watermark = _optionalChain([options, 'optionalAccess',
|
|
49745
|
-
const watermarkCss = _optionalChain([options, 'optionalAccess',
|
|
49745
|
+
const watermark = _optionalChain([options, 'optionalAccess', _1045 => _1045.watermark]) ? `<div class="watermark">${_chunkAS25R4EUcjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
49746
|
+
const watermarkCss = _optionalChain([options, 'optionalAccess', _1046 => _1046.watermark]) ? `
|
|
49746
49747
|
.watermark {
|
|
49747
49748
|
position: fixed;
|
|
49748
49749
|
top: 50%; left: 50%;
|
|
@@ -49766,7 +49767,7 @@ ${body}
|
|
|
49766
49767
|
</body>
|
|
49767
49768
|
</html>`;
|
|
49768
49769
|
}
|
|
49769
|
-
function chromiumSandboxArgs(env = process.env, isRootLinux = process.platform === "linux" && _optionalChain([process, 'access',
|
|
49770
|
+
function chromiumSandboxArgs(env = process.env, isRootLinux = process.platform === "linux" && _optionalChain([process, 'access', _1047 => _1047.getuid, 'optionalCall', _1048 => _1048()]) === 0) {
|
|
49770
49771
|
return env.KORDOC_CHROMIUM_NO_SANDBOX === "1" || isRootLinux ? ["--no-sandbox", "--disable-setuid-sandbox"] : [];
|
|
49771
49772
|
}
|
|
49772
49773
|
async function launchLockedPage(puppeteer, executablePath) {
|
|
@@ -49795,13 +49796,13 @@ async function htmlToPdf(html, options) {
|
|
|
49795
49796
|
try {
|
|
49796
49797
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
49797
49798
|
} catch (e42) {
|
|
49798
|
-
throw new (0,
|
|
49799
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(
|
|
49799
49800
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
49800
49801
|
);
|
|
49801
49802
|
}
|
|
49802
49803
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
49803
49804
|
if (!executablePath) {
|
|
49804
|
-
throw new (0,
|
|
49805
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(
|
|
49805
49806
|
"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."
|
|
49806
49807
|
);
|
|
49807
49808
|
}
|
|
@@ -49809,10 +49810,10 @@ async function htmlToPdf(html, options) {
|
|
|
49809
49810
|
try {
|
|
49810
49811
|
await page.setContent(html, { waitUntil: "load" });
|
|
49811
49812
|
await page.waitForNetworkIdle({ idleTime: 500, concurrency: 0 });
|
|
49812
|
-
const margin = _optionalChain([options, 'optionalAccess',
|
|
49813
|
+
const margin = _optionalChain([options, 'optionalAccess', _1049 => _1049.margin]);
|
|
49813
49814
|
const pdf = await page.pdf({
|
|
49814
|
-
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49815
|
-
landscape: _optionalChain([options, 'optionalAccess',
|
|
49815
|
+
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1050 => _1050.pageSize]), () => ( "A4")),
|
|
49816
|
+
landscape: _optionalChain([options, 'optionalAccess', _1051 => _1051.orientation]) === "landscape",
|
|
49816
49817
|
printBackground: true,
|
|
49817
49818
|
margin: margin ? {
|
|
49818
49819
|
top: toCss(margin.top),
|
|
@@ -49820,9 +49821,9 @@ async function htmlToPdf(html, options) {
|
|
|
49820
49821
|
bottom: toCss(margin.bottom),
|
|
49821
49822
|
left: toCss(margin.left)
|
|
49822
49823
|
} : void 0,
|
|
49823
|
-
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess',
|
|
49824
|
-
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49825
|
-
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
49824
|
+
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _1052 => _1052.header]) || _optionalChain([options, 'optionalAccess', _1053 => _1053.footer])),
|
|
49825
|
+
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1054 => _1054.header]), () => ( "<div></div>")),
|
|
49826
|
+
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1055 => _1055.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
|
|
49826
49827
|
});
|
|
49827
49828
|
return Buffer.from(pdf);
|
|
49828
49829
|
} finally {
|
|
@@ -49856,7 +49857,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
49856
49857
|
return htmlToPdf(html, options);
|
|
49857
49858
|
}
|
|
49858
49859
|
async function blocksToPdf(blocks, options) {
|
|
49859
|
-
const markdown =
|
|
49860
|
+
const markdown = _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, blocks);
|
|
49860
49861
|
return markdownToPdf(markdown, options);
|
|
49861
49862
|
}
|
|
49862
49863
|
|
|
@@ -49982,7 +49983,7 @@ var OBJ_TAGS = /* @__PURE__ */ new Set(["tbl", "pic", "container", "equation", "
|
|
|
49982
49983
|
var CHAR_CTRL_1SLOT = /* @__PURE__ */ new Set(["lineBreak", "hyphen", "hypen", "nbSpace", "fwSpace"]);
|
|
49983
49984
|
var noteFmtCache = /* @__PURE__ */ new WeakMap();
|
|
49984
49985
|
function sectionNoteFormats2(p) {
|
|
49985
|
-
const root = _optionalChain([p, 'access',
|
|
49986
|
+
const root = _optionalChain([p, 'access', _1056 => _1056.ownerDocument, 'optionalAccess', _1057 => _1057.documentElement]);
|
|
49986
49987
|
if (!root) return {};
|
|
49987
49988
|
let f = noteFmtCache.get(root);
|
|
49988
49989
|
if (!f) {
|
|
@@ -50013,7 +50014,8 @@ function pushTextSlots(t, chars, prId, depth, del = { deleted: 0 }) {
|
|
|
50013
50014
|
} else if (tag === "tab") {
|
|
50014
50015
|
if (del.deleted) pushFillers(chars, 8, prId);
|
|
50015
50016
|
else {
|
|
50016
|
-
|
|
50017
|
+
const width = num2(el, "width", -1);
|
|
50018
|
+
chars.push({ ch: "", prId, tab: true, ...width >= 0 ? { tabW: width } : {}, ...el.getAttribute("type") === "2" ? { tabRight: true } : {} });
|
|
50017
50019
|
pushFillers(chars, 7, prId);
|
|
50018
50020
|
}
|
|
50019
50021
|
} else if (tag === "titleMark") {
|
|
@@ -50088,7 +50090,7 @@ function buildPara(p) {
|
|
|
50088
50090
|
const pos = findChildByLocalName(ch, "pos");
|
|
50089
50091
|
const w = num2(sz, "width") || num2(findChildByLocalName(ch, "curSz"), "width") || num2(findChildByLocalName(ch, "orgSz"), "width");
|
|
50090
50092
|
const h = num2(sz, "height") || num2(findChildByLocalName(ch, "curSz"), "height") || num2(findChildByLocalName(ch, "orgSz"), "height");
|
|
50091
|
-
const inline = _optionalChain([pos, 'optionalAccess',
|
|
50093
|
+
const inline = _optionalChain([pos, 'optionalAccess', _1058 => _1058.getAttribute, 'call', _1059 => _1059("treatAsChar")]) === "1";
|
|
50092
50094
|
const om = inline ? findChildByLocalName(ch, "outMargin") : null;
|
|
50093
50095
|
if (!deleted) objs.push({
|
|
50094
50096
|
el: ch,
|
|
@@ -50152,10 +50154,13 @@ function captionExtra(el) {
|
|
|
50152
50154
|
return c && (c.side === "TOP" || c.side === "BOTTOM") ? c.h + c.gap : 0;
|
|
50153
50155
|
}
|
|
50154
50156
|
var DEFAULT_TAB_HU = 4e3;
|
|
50155
|
-
function
|
|
50157
|
+
function paraHeadAdvance(head, offsetHeight, width) {
|
|
50158
|
+
return width + (head.offsetPct ? Math.trunc(offsetHeight * head.offset / 100) : head.offset);
|
|
50159
|
+
}
|
|
50160
|
+
function tabAdvance(x, firstLine, geom, saved) {
|
|
50156
50161
|
const hang = geom && geom.marginIntent < 0 ? -geom.marginIntent : 0;
|
|
50157
|
-
if (firstLine && _optionalChain([geom, 'optionalAccess',
|
|
50158
|
-
if (saved
|
|
50162
|
+
if (firstLine && _optionalChain([geom, 'optionalAccess', _1060 => _1060.autoTabLeft]) && hang > 0 && x < hang - 0.5) return hang - x;
|
|
50163
|
+
if (saved != null && saved >= 0) return saved;
|
|
50159
50164
|
return (Math.floor(x / DEFAULT_TAB_HU) + 1) * DEFAULT_TAB_HU - x;
|
|
50160
50165
|
}
|
|
50161
50166
|
function cellColumns(sub) {
|
|
@@ -50166,7 +50171,7 @@ function cellColumns(sub) {
|
|
|
50166
50171
|
}
|
|
50167
50172
|
function cellContentExtent(cell2, memo) {
|
|
50168
50173
|
if (!cell2.sub) return 0;
|
|
50169
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
50174
|
+
const hit = _optionalChain([memo, 'optionalAccess', _1061 => _1061.cell, 'access', _1062 => _1062.get, 'call', _1063 => _1063(cell2.el)]);
|
|
50170
50175
|
if (hit !== void 0) return hit;
|
|
50171
50176
|
const cols = cellColumns(cell2.sub);
|
|
50172
50177
|
let ext = 0;
|
|
@@ -50184,7 +50189,7 @@ function cellContentExtent(cell2, memo) {
|
|
|
50184
50189
|
prevEnd = s.vertpos + shift + s.textheight + (_nullishCoalesce(s.spacing, () => ( 0)));
|
|
50185
50190
|
ext = Math.max(ext, s.vertpos + s.textheight + shift);
|
|
50186
50191
|
});
|
|
50187
|
-
const baseV = (_nullishCoalesce(_optionalChain([m, 'access',
|
|
50192
|
+
const baseV = (_nullishCoalesce(_optionalChain([m, 'access', _1064 => _1064.segs, 'access', _1065 => _1065[0], 'optionalAccess', _1066 => _1066.vertpos]), () => ( 0))) + firstShift;
|
|
50188
50193
|
for (const o of m.objs) {
|
|
50189
50194
|
if (o.inline) {
|
|
50190
50195
|
const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
@@ -50194,15 +50199,15 @@ function cellContentExtent(cell2, memo) {
|
|
|
50194
50199
|
continue;
|
|
50195
50200
|
}
|
|
50196
50201
|
const pos = findChildByLocalName(o.el, "pos");
|
|
50197
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
50202
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1067 => _1067.getAttribute, 'call', _1068 => _1068("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
50198
50203
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
50199
50204
|
const pushed = baseV - (num2(om, "top") + o.height + num2(om, "bottom"));
|
|
50200
|
-
const anchor = pushed >= -100 ? pushed : baseV - (_nullishCoalesce(_optionalChain([memo, 'optionalAccess',
|
|
50205
|
+
const anchor = pushed >= -100 ? pushed : baseV - (_nullishCoalesce(_optionalChain([memo, 'optionalAccess', _1069 => _1069.paraGeom, 'optionalAccess', _1070 => _1070.get, 'call', _1071 => _1071(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1072 => _1072.spaceBefore]), () => ( 0)));
|
|
50201
50206
|
const vo = num2(pos, "vertOffset");
|
|
50202
50207
|
ext = Math.max(ext, anchor + num2(om, "top") + Math.max(0, vo) + o.height);
|
|
50203
50208
|
}
|
|
50204
50209
|
}
|
|
50205
|
-
_optionalChain([memo, 'optionalAccess',
|
|
50210
|
+
_optionalChain([memo, 'optionalAccess', _1073 => _1073.cell, 'access', _1074 => _1074.set, 'call', _1075 => _1075(cell2.el, ext)]);
|
|
50206
50211
|
return ext;
|
|
50207
50212
|
}
|
|
50208
50213
|
function cellMarginOf(cm, side, def) {
|
|
@@ -50259,12 +50264,12 @@ function measureTableRowHeights(tbl2, memo) {
|
|
|
50259
50264
|
return rows;
|
|
50260
50265
|
}
|
|
50261
50266
|
function measureTableHeight(tbl2, memo) {
|
|
50262
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
50267
|
+
const hit = _optionalChain([memo, 'optionalAccess', _1076 => _1076.table, 'access', _1077 => _1077.get, 'call', _1078 => _1078(tbl2)]);
|
|
50263
50268
|
if (hit !== void 0) return hit;
|
|
50264
50269
|
const rowH = measureTableRowHeights(tbl2, memo);
|
|
50265
50270
|
let sum = 0;
|
|
50266
50271
|
for (const h of rowH) sum += h;
|
|
50267
|
-
_optionalChain([memo, 'optionalAccess',
|
|
50272
|
+
_optionalChain([memo, 'optionalAccess', _1079 => _1079.table, 'access', _1080 => _1080.set, 'call', _1081 => _1081(tbl2, sum)]);
|
|
50268
50273
|
return sum;
|
|
50269
50274
|
}
|
|
50270
50275
|
|
|
@@ -50277,22 +50282,22 @@ function squareTableOver(p, startV, lim, withText = false, areaW = 0) {
|
|
|
50277
50282
|
const pb = o.el.getAttribute("pageBreak");
|
|
50278
50283
|
if (pb !== "CELL" && pb !== "TABLE") return false;
|
|
50279
50284
|
const pos = findChildByLocalName(o.el, "pos"), om = findChildByLocalName(o.el, "outMargin");
|
|
50280
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
50285
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1082 => _1082.getAttribute, 'call', _1083 => _1083("vertRelTo")]), () => ( "PARA"))) !== "PARA") return false;
|
|
50281
50286
|
const vo = num2(pos, "vertOffset"), voS = Math.max(0, vo >= 2 ** 31 ? vo - 2 ** 32 : vo);
|
|
50282
50287
|
if (withText && Math.max(0, num2(pos, "horzOffset")) + num2(om, "left") + o.width + num2(om, "right") < areaW - 1440) return false;
|
|
50283
50288
|
return startV + voS + num2(om, "top") + (withText ? measureTableHeight(o.el) : Math.max(o.height, measureTableHeight(o.el))) + num2(om, "bottom") > lim;
|
|
50284
50289
|
});
|
|
50285
50290
|
}
|
|
50286
50291
|
function bulletEmptyHost(p, g3) {
|
|
50287
|
-
if (!_optionalChain([g3, 'optionalAccess',
|
|
50292
|
+
if (!_optionalChain([g3, 'optionalAccess', _1084 => _1084.bullet])) return false;
|
|
50288
50293
|
const m = buildPara(p);
|
|
50289
50294
|
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");
|
|
50290
50295
|
}
|
|
50291
50296
|
function hasTbFloat(p) {
|
|
50292
|
-
return buildPara(p).objs.some((o) => !o.inline && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
50297
|
+
return buildPara(p).objs.some((o) => !o.inline && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1085 => _1085(o.el, "pos"), 'optionalAccess', _1086 => _1086.getAttribute, 'call', _1087 => _1087("vertRelTo")]), () => ( "PARA"))) === "PARA");
|
|
50293
50298
|
}
|
|
50294
50299
|
function m0Objs(p) {
|
|
50295
|
-
return _optionalChain([buildPara, 'call',
|
|
50300
|
+
return _optionalChain([buildPara, 'call', _1088 => _1088(p), 'access', _1089 => _1089.objs, 'access', _1090 => _1090.find, 'call', _1091 => _1091((o) => !o.inline && o.tag === "tbl"), 'optionalAccess', _1092 => _1092.el]);
|
|
50296
50301
|
}
|
|
50297
50302
|
function contentTableHeight(tbl2) {
|
|
50298
50303
|
const cells = collectCells(tbl2);
|
|
@@ -50308,7 +50313,7 @@ function bandTableOver(p, top, lim) {
|
|
|
50308
50313
|
const pb = o.el.getAttribute("pageBreak");
|
|
50309
50314
|
if (pb !== "CELL" && pb !== "TABLE") return false;
|
|
50310
50315
|
const pos = findChildByLocalName(o.el, "pos"), om = findChildByLocalName(o.el, "outMargin");
|
|
50311
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
50316
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1093 => _1093.getAttribute, 'call', _1094 => _1094("vertRelTo")]), () => ( "PARA"))) !== "PARA") return false;
|
|
50312
50317
|
const vo = num2(pos, "vertOffset");
|
|
50313
50318
|
if (vo <= 0 || vo >= 2 ** 31) return false;
|
|
50314
50319
|
return top + vo + num2(om, "top") + contentTableHeight(o.el) + num2(om, "bottom") > lim;
|
|
@@ -50321,7 +50326,7 @@ function splitFloatTableRemainder(p, startV, lim, bodyH, styles, withText = fals
|
|
|
50321
50326
|
for (const o of m.objs) {
|
|
50322
50327
|
if (o.inline || o.tag !== "tbl" || !(o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" || o.el.getAttribute("textWrap") === "SQUARE")) continue;
|
|
50323
50328
|
const pos = findChildByLocalName(o.el, "pos");
|
|
50324
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
50329
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1095 => _1095.getAttribute, 'call', _1096 => _1096("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
50325
50330
|
const b = splitTableRows(o.el, startV + Math.max(0, num2(pos, "vertOffset")), lim, bodyH, styles, notes);
|
|
50326
50331
|
if (b !== void 0) {
|
|
50327
50332
|
best = Math.max(_nullishCoalesce(best, () => ( 0)), b);
|
|
@@ -50419,18 +50424,18 @@ function cellRowRemainder(cells, row, avail, from, record, bases, carries, style
|
|
|
50419
50424
|
const cuts = [];
|
|
50420
50425
|
for (const c of cells) {
|
|
50421
50426
|
if (c.ra !== row || c.rs !== 1 || !c.sub) continue;
|
|
50422
|
-
const off = _nullishCoalesce(from.get(c.el), () => ( 0)), base = _nullishCoalesce(_optionalChain([bases, 'optionalAccess',
|
|
50427
|
+
const off = _nullishCoalesce(from.get(c.el), () => ( 0)), base = _nullishCoalesce(_optionalChain([bases, 'optionalAccess', _1097 => _1097.get, 'call', _1098 => _1098(c.el)]), () => ( 0));
|
|
50423
50428
|
const limAbs = base + avail - c.marginB - c.marginT;
|
|
50424
50429
|
let carry = 0, carryFrom = Infinity;
|
|
50425
50430
|
let splitAt;
|
|
50426
50431
|
for (let guard = 0; guard < 16; guard++) {
|
|
50427
50432
|
const f = subFloatBottoms(c.sub).find((f2) => f2.v0 >= off && f2.lineBottom <= limAbs && f2.bottom > limAbs && f2.v0 < carryFrom);
|
|
50428
50433
|
if (!f) break;
|
|
50429
|
-
if (_optionalChain([f, 'access',
|
|
50434
|
+
if (_optionalChain([f, 'access', _1099 => _1099.rows, 'optionalAccess', _1100 => _1100.length])) {
|
|
50430
50435
|
let y = f.bottom - f.carry + f.outT, k2 = 0;
|
|
50431
50436
|
while (k2 < f.rows.length && y + f.rows[k2] <= limAbs) y += f.rows[k2++];
|
|
50432
50437
|
if (k2 === f.rows.length) break;
|
|
50433
|
-
if ((k2 > 0 || _optionalChain([f, 'access',
|
|
50438
|
+
if ((k2 > 0 || _optionalChain([f, 'access', _1101 => _1101.el, 'optionalAccess', _1102 => _1102.getAttribute, 'call', _1103 => _1103("pageBreak")]) === "CELL") && contH > 0 && f.el) {
|
|
50434
50439
|
const nested = splitTableRows(f.el, f.bottom - f.carry - base, avail - c.marginB - c.marginT, contH - c.marginT - c.marginB, styles);
|
|
50435
50440
|
const rem2 = _nullishCoalesce(nested, () => ( (k2 > 0 ? f.outT + f.rows.slice(k2).reduce((a, b) => a + b, 0) + f.outB : void 0)));
|
|
50436
50441
|
if (rem2 !== void 0) {
|
|
@@ -50461,10 +50466,8 @@ function cellRowRemainder(cells, row, avail, from, record, bases, carries, style
|
|
|
50461
50466
|
const end = Math.max(...lines.map((l) => l[1]));
|
|
50462
50467
|
const k = lines.findIndex((l) => c.marginT + l[1] > avail - c.marginB);
|
|
50463
50468
|
if (k < 0) {
|
|
50464
|
-
|
|
50465
|
-
|
|
50466
|
-
rem = Math.max(rem, c.marginT + carry + c.marginB);
|
|
50467
|
-
}
|
|
50469
|
+
placed = true;
|
|
50470
|
+
if (carry > 0) rem = Math.max(rem, c.marginT + carry + c.marginB);
|
|
50468
50471
|
cuts.push([c.el, base + end + 1, base]);
|
|
50469
50472
|
continue;
|
|
50470
50473
|
}
|
|
@@ -50478,9 +50481,9 @@ function cellRowRemainder(cells, row, avail, from, record, bases, carries, style
|
|
|
50478
50481
|
}
|
|
50479
50482
|
if (carry > 0 && cutV > carryFrom) {
|
|
50480
50483
|
nb -= carry;
|
|
50481
|
-
const m = _nullishCoalesce(_optionalChain([carries, 'optionalAccess',
|
|
50484
|
+
const m = _nullishCoalesce(_optionalChain([carries, 'optionalAccess', _1104 => _1104.get, 'call', _1105 => _1105(c.sub)]), () => ( /* @__PURE__ */ new Map()));
|
|
50482
50485
|
m.set(cutV, carry);
|
|
50483
|
-
_optionalChain([carries, 'optionalAccess',
|
|
50486
|
+
_optionalChain([carries, 'optionalAccess', _1106 => _1106.set, 'call', _1107 => _1107(c.sub, m)]);
|
|
50484
50487
|
}
|
|
50485
50488
|
cuts.push([c.el, base + lines[k][0], nb]);
|
|
50486
50489
|
rem = Math.max(rem, end + base - nb + c.marginT + c.marginB);
|
|
@@ -50488,7 +50491,7 @@ function cellRowRemainder(cells, row, avail, from, record, bases, carries, style
|
|
|
50488
50491
|
if (!(any && placed)) return void 0;
|
|
50489
50492
|
for (const [el, v, nb] of cuts) {
|
|
50490
50493
|
from.set(el, v);
|
|
50491
|
-
_optionalChain([bases, 'optionalAccess',
|
|
50494
|
+
_optionalChain([bases, 'optionalAccess', _1108 => _1108.set, 'call', _1109 => _1109(el, nb)]);
|
|
50492
50495
|
}
|
|
50493
50496
|
if (record) for (const c of cells) {
|
|
50494
50497
|
if (c.ra !== row || c.rs !== 1 || !c.sub) continue;
|
|
@@ -50523,7 +50526,7 @@ function subFloatBottoms(sub) {
|
|
|
50523
50526
|
for (const o of elements(run)) {
|
|
50524
50527
|
if (!OBJ_TAGS.has(ln(o)) || o.getAttribute("textWrap") !== "TOP_AND_BOTTOM") continue;
|
|
50525
50528
|
const pos = findChildByLocalName(o, "pos");
|
|
50526
|
-
if (_optionalChain([pos, 'optionalAccess',
|
|
50529
|
+
if (_optionalChain([pos, 'optionalAccess', _1110 => _1110.getAttribute, 'call', _1111 => _1111("treatAsChar")]) === "1" || (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1112 => _1112.getAttribute, 'call', _1113 => _1113("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
50527
50530
|
const om = findChildByLocalName(o, "outMargin"), sz = findChildByLocalName(o, "sz");
|
|
50528
50531
|
const h = (ln(o) === "tbl" ? Math.max(num2(sz, "height"), measureTableHeight(o)) : num2(sz, "height")) + captionExtra(o);
|
|
50529
50532
|
const vo = num2(pos, "vertOffset"), v0 = num2(seg, "vertpos"), carry = num2(om, "top") + h + num2(om, "bottom");
|
|
@@ -50543,11 +50546,11 @@ function subFloatBottoms(sub) {
|
|
|
50543
50546
|
}
|
|
50544
50547
|
function spaceAfterAt(sg, styles) {
|
|
50545
50548
|
if (!styles) return 0;
|
|
50546
|
-
const lsa = sg.parentNode, p = _optionalChain([lsa, 'optionalAccess',
|
|
50549
|
+
const lsa = sg.parentNode, p = _optionalChain([lsa, 'optionalAccess', _1114 => _1114.parentNode]);
|
|
50547
50550
|
if (!lsa || !p) return 0;
|
|
50548
50551
|
const segs = elements(lsa).filter((e) => ln(e) === "lineseg");
|
|
50549
50552
|
if (segs[segs.length - 1] !== sg) return 0;
|
|
50550
|
-
return _nullishCoalesce(_optionalChain([styles, 'access',
|
|
50553
|
+
return _nullishCoalesce(_optionalChain([styles, 'access', _1115 => _1115.paraGeom, 'access', _1116 => _1116.get, 'call', _1117 => _1117(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1118 => _1118.spaceAfter]), () => ( 0));
|
|
50551
50554
|
}
|
|
50552
50555
|
function rebaseSplitCells(record, carries, styles) {
|
|
50553
50556
|
for (const [sub, cuts] of record) {
|
|
@@ -50565,7 +50568,7 @@ function rebaseSplitCells(record, carries, styles) {
|
|
|
50565
50568
|
if (old[i] < c) base = Math.max(base, old[i] + num2(sg, "vertsize") + num2(sg, "spacing") + spaceAfterAt(sg, styles));
|
|
50566
50569
|
});
|
|
50567
50570
|
for (const f of floats) if (f.v0 < c && f.bottom <= c) base = Math.max(base, f.bottom);
|
|
50568
|
-
return base - (_nullishCoalesce(_optionalChain([carries, 'optionalAccess',
|
|
50571
|
+
return base - (_nullishCoalesce(_optionalChain([carries, 'optionalAccess', _1119 => _1119.get, 'call', _1120 => _1120(sub), 'optionalAccess', _1121 => _1121.get, 'call', _1122 => _1122(c)]), () => ( 0)));
|
|
50569
50572
|
});
|
|
50570
50573
|
segs.forEach((sg, i) => {
|
|
50571
50574
|
let j = -1;
|
|
@@ -50581,7 +50584,7 @@ function pageBottomReserve(p) {
|
|
|
50581
50584
|
for (const o of elements(run)) {
|
|
50582
50585
|
if (!OBJ_TAGS.has(ln(o)) || o.getAttribute("textWrap") !== "TOP_AND_BOTTOM") continue;
|
|
50583
50586
|
const pos = findChildByLocalName(o, "pos");
|
|
50584
|
-
if (_optionalChain([pos, 'optionalAccess',
|
|
50587
|
+
if (_optionalChain([pos, 'optionalAccess', _1123 => _1123.getAttribute, 'call', _1124 => _1124("treatAsChar")]) === "1" || _optionalChain([pos, 'optionalAccess', _1125 => _1125.getAttribute, 'call', _1126 => _1126("vertRelTo")]) !== "PAGE" || _optionalChain([pos, 'optionalAccess', _1127 => _1127.getAttribute, 'call', _1128 => _1128("vertAlign")]) !== "BOTTOM") continue;
|
|
50585
50588
|
const om = findChildByLocalName(o, "outMargin"), sz = findChildByLocalName(o, "sz");
|
|
50586
50589
|
const h = ln(o) === "tbl" ? Math.max(num2(sz, "height"), measureTableHeight(o)) : num2(sz, "height");
|
|
50587
50590
|
r = Math.max(r, num2(pos, "vertOffset") + num2(om, "top") + h + num2(om, "bottom"));
|
|
@@ -50710,17 +50713,17 @@ function formatHeadNumber2(n, format2) {
|
|
|
50710
50713
|
}
|
|
50711
50714
|
}
|
|
50712
50715
|
function nextParaNumber(counters, geom) {
|
|
50713
|
-
const num4 = _optionalChain([geom, 'optionalAccess',
|
|
50716
|
+
const num4 = _optionalChain([geom, 'optionalAccess', _1129 => _1129.number]);
|
|
50714
50717
|
if (!num4) return "";
|
|
50715
50718
|
const cur = _nullishCoalesce(counters.get(num4.id), () => ( []));
|
|
50716
50719
|
const head = num4.heads.get(num4.level);
|
|
50717
|
-
cur[num4.level] = (_nullishCoalesce(cur[num4.level], () => ( (_nullishCoalesce(_optionalChain([head, 'optionalAccess',
|
|
50720
|
+
cur[num4.level] = (_nullishCoalesce(cur[num4.level], () => ( (_nullishCoalesce(_optionalChain([head, 'optionalAccess', _1130 => _1130.start]), () => ( 1))) - 1))) + 1;
|
|
50718
50721
|
cur.length = num4.level + 1;
|
|
50719
50722
|
counters.set(num4.id, cur);
|
|
50720
|
-
return (_nullishCoalesce(_optionalChain([head, 'optionalAccess',
|
|
50723
|
+
return (_nullishCoalesce(_optionalChain([head, 'optionalAccess', _1131 => _1131.text]), () => ( ""))).replace(/\^(\d)?/g, (_m, d) => {
|
|
50721
50724
|
if (d === void 0) return "";
|
|
50722
50725
|
const lv = Number(d), h = num4.heads.get(lv);
|
|
50723
|
-
return formatHeadNumber2(_nullishCoalesce(_nullishCoalesce(cur[lv], () => ( _optionalChain([h, 'optionalAccess',
|
|
50726
|
+
return formatHeadNumber2(_nullishCoalesce(_nullishCoalesce(cur[lv], () => ( _optionalChain([h, 'optionalAccess', _1132 => _1132.start]))), () => ( 1)), _nullishCoalesce(_optionalChain([h, 'optionalAccess', _1133 => _1133.format]), () => ( "DIGIT")));
|
|
50724
50727
|
});
|
|
50725
50728
|
}
|
|
50726
50729
|
|
|
@@ -50784,7 +50787,7 @@ function lineBorderBox(model, styles, start, end) {
|
|
|
50784
50787
|
let top = 0, all = 0;
|
|
50785
50788
|
const include = (prId) => {
|
|
50786
50789
|
const st = prId != null ? styles.charPr.get(prId) : void 0;
|
|
50787
|
-
const f = _optionalChain([st, 'optionalAccess',
|
|
50790
|
+
const f = _optionalChain([st, 'optionalAccess', _1134 => _1134.borderFill]) != null ? styles.borderFill.get(st.borderFill) : void 0;
|
|
50788
50791
|
if (!f || !f.top && !f.bottom) return;
|
|
50789
50792
|
const width = (pt3) => empty ? 2 * Math.trunc(pt3 * 50) : Math.trunc(pt3 * 100);
|
|
50790
50793
|
const t = f.top ? width(f.top.widthPt) : 0, b = f.bottom ? width(f.bottom.widthPt) : 0;
|
|
@@ -50802,12 +50805,12 @@ var LINESEG_FLAGS = "393216";
|
|
|
50802
50805
|
var BASELINE_RATIO = 0.85;
|
|
50803
50806
|
var FONT_LINE_METRICS = [
|
|
50804
50807
|
[/^맑은 고딕/, 2230 / 2048, 496 / 2048, true],
|
|
50805
|
-
[/^(바탕|돋움|굴림|궁서)(체)
|
|
50808
|
+
[/^(바탕|돋움|굴림|궁서)(체)?$|^한컴바탕$|^HY/, 1758 / 2048, 290 / 2048],
|
|
50806
50809
|
[/^휴먼명조$/, 0.859, 0.195],
|
|
50807
50810
|
[/^KoPub(World)?(돋움|바탕)체 Light$/, 0.85, 0.25]
|
|
50808
50811
|
];
|
|
50809
|
-
function fontLineMetrics(face) {
|
|
50810
|
-
if (!face) return void 0;
|
|
50812
|
+
function fontLineMetrics(face, hft) {
|
|
50813
|
+
if (!face || hft && face.trim() === "\uD55C\uCEF4\uBC14\uD0D5") return void 0;
|
|
50811
50814
|
for (const [re, a, d, up] of FONT_LINE_METRICS) if (re.test(face.trim())) return [a, d, up];
|
|
50812
50815
|
return void 0;
|
|
50813
50816
|
}
|
|
@@ -50847,7 +50850,7 @@ function hancomLangOf(cp) {
|
|
|
50847
50850
|
if (cp >= 57344 && cp < 63744 || cp >= 983040) return "hangul";
|
|
50848
50851
|
return "symbol";
|
|
50849
50852
|
}
|
|
50850
|
-
function glyphWidth(ch, st) {
|
|
50853
|
+
function glyphWidth(ch, st, fallback = true) {
|
|
50851
50854
|
const cp = ch.codePointAt(0);
|
|
50852
50855
|
const space = cp === 32 || cp === 160;
|
|
50853
50856
|
const lang = space ? "hangul" : hancomLangOf(cp);
|
|
@@ -50856,11 +50859,11 @@ function glyphWidth(ch, st) {
|
|
|
50856
50859
|
let h = rel !== 100 ? mulDiv(st.height, rel, 100) : st.height;
|
|
50857
50860
|
if (!space && st.script) h = mulDiv(h, 16, 25);
|
|
50858
50861
|
const ratio = L ? L.ratio : st.ratio;
|
|
50859
|
-
const spacing = space ? _nullishCoalesce(_optionalChain([st, 'access',
|
|
50860
|
-
const face1 = _nullishCoalesce(_optionalChain([L, 'optionalAccess',
|
|
50862
|
+
const spacing = space ? _nullishCoalesce(_optionalChain([st, 'access', _1135 => _1135.latin, 'optionalAccess', _1136 => _1136.spacing]), () => ( st.spacing)) : L ? L.spacing : st.spacing;
|
|
50863
|
+
const face1 = _nullishCoalesce(_optionalChain([L, 'optionalAccess', _1137 => _1137.face]), () => ( st.face));
|
|
50861
50864
|
const face0 = face1 === "Batang" ? st.before2024 ? "\uBC14\uD0D5" : "\uD55C\uCEF4\uBC14\uD0D5" : face1;
|
|
50862
50865
|
const boldFace = !space && st.bold && (L ? L.hft : st.hft) && face0 && fontHasGlyph(`${face0} Bold`, cp) ? `${face0} Bold` : void 0;
|
|
50863
|
-
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',
|
|
50866
|
+
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', _1138 => _1138.face]) ? L.hft : st.hft))) ? _optionalChain([BEFORE_2024_WIDTH, 'access', _1139 => _1139[face0], 'optionalAccess', _1140 => _1140[cp]]) : !st.halfQuote && face0 === "\uD734\uBA3C\uBA85\uC870" && cp === 8231 ? _optionalChain([BEFORE_2024_WIDTH, 'access', _1141 => _1141[face0], 'optionalAccess', _1142 => _1142[cp]]) : void 0;
|
|
50864
50867
|
const fc = faceClassForReflow(_nullishCoalesce(boldFace, () => ( face0)));
|
|
50865
50868
|
const fsEm = space && st.fontSpace ? fontSpaceEm(st.face) : void 0;
|
|
50866
50869
|
if (fsEm !== void 0) {
|
|
@@ -50868,13 +50871,13 @@ function glyphWidth(ch, st) {
|
|
|
50868
50871
|
const s = spacing ? 4 * mulDiv(Math.trunc(b / 4), spacing, 100) : 0;
|
|
50869
50872
|
return { w: b + s, sp: s };
|
|
50870
50873
|
}
|
|
50871
|
-
const bAdd = !space && st.bold && !boldFace ? syntheticBoldEm(_nullishCoalesce(_optionalChain([L, 'optionalAccess',
|
|
50874
|
+
const bAdd = !space && st.bold && !boldFace ? syntheticBoldEm(_nullishCoalesce(_optionalChain([L, 'optionalAccess', _1143 => _1143.face]), () => ( st.face)), L ? L.hft : st.hft) : 0;
|
|
50872
50875
|
if (oldEm !== void 0) {
|
|
50873
50876
|
const b0 = hancomEmWidth(oldEm + bAdd, h, ratio, 0), w0 = spacing ? hancomEmWidth(oldEm + bAdd, h, ratio, spacing) : b0;
|
|
50874
50877
|
return { w: w0, sp: w0 - b0 };
|
|
50875
50878
|
}
|
|
50876
|
-
const base = hancomCharWidth(ch, h, ratio, 0, fc, bAdd);
|
|
50877
|
-
const w = spacing ? hancomCharWidth(ch, h, ratio, spacing, fc, bAdd) : base;
|
|
50879
|
+
const base = hancomCharWidth(ch, h, ratio, 0, fc, bAdd, fallback);
|
|
50880
|
+
const w = spacing ? hancomCharWidth(ch, h, ratio, spacing, fc, bAdd, fallback) : base;
|
|
50878
50881
|
return { w, sp: w - base };
|
|
50879
50882
|
}
|
|
50880
50883
|
function pitchFor(height, geom) {
|
|
@@ -51003,14 +51006,12 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51003
51006
|
const avail = Math.max(1440, Math.floor(areaW / 4) * 4 - marginL - geom.marginRight);
|
|
51004
51007
|
const firstWidth = avail;
|
|
51005
51008
|
const bu = _nullishCoalesce(geom.bullet, () => ( (numText && geom.number ? { ch: numText, ...geom.number } : void 0)));
|
|
51009
|
+
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess', _1144 => _1144.charPrId]) != null ? styles.charPr.get(bu.charPrId) : void 0), () => ( domChar));
|
|
51006
51010
|
let headW = 0;
|
|
51007
|
-
if (bu)
|
|
51008
|
-
|
|
51009
|
-
|
|
51010
|
-
|
|
51011
|
-
const bulletW = bu ? headW + (bu.offsetPct ? Math.trunc(height * bu.offset / 100) : bu.offset) : 0;
|
|
51012
|
-
const contBullet = _optionalChain([bu, 'optionalAccess', _1142 => _1142.autoIndent]) ? bulletW : 0;
|
|
51013
|
-
const squeeze = _optionalChain([p, 'access', _1143 => _1143.parentNode, 'optionalAccess', _1144 => _1144.getAttribute, 'optionalCall', _1145 => _1145("lineWrap")]) === "SQUEEZE" || !!geom.squeeze;
|
|
51011
|
+
if (bu) for (const ch of bu.ch) headW += glyphWidth(ch, bst, bu.useInstWidth !== false).w;
|
|
51012
|
+
const bulletW = bu ? paraHeadAdvance(bu, height, headW) : 0;
|
|
51013
|
+
const contBullet = _optionalChain([bu, 'optionalAccess', _1145 => _1145.autoIndent]) ? bulletW : 0;
|
|
51014
|
+
const squeeze = _optionalChain([p, 'access', _1146 => _1146.parentNode, 'optionalAccess', _1147 => _1147.getAttribute, 'optionalCall', _1148 => _1148("lineWrap")]) === "SQUEEZE" || !!geom.squeeze;
|
|
51014
51015
|
const NO_WRAP = 1e9;
|
|
51015
51016
|
const intentPos = geom.marginIntent >= avail ? 0 : Math.max(0, geom.marginIntent);
|
|
51016
51017
|
const firstWrapWidth = squeeze ? NO_WRAP : Math.max(500, avail - (styles.before2024 && bulletW > 0 ? Math.max(intentPos, bulletW) : intentPos + bulletW));
|
|
@@ -51033,7 +51034,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51033
51034
|
let cellFloatBottom = 0, cellTextBelow = 0;
|
|
51034
51035
|
const spacesOnly = spacesHost(p);
|
|
51035
51036
|
const zoneStart = zones.length;
|
|
51036
|
-
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',
|
|
51037
|
+
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', _1149 => _1149(o.el, "pos"), 'optionalAccess', _1150 => _1150.getAttribute, 'call', _1151 => _1151("allowOverlap")]) === "1");
|
|
51037
51038
|
const spacesText = bodyFlow && (spacesOnly || !!OVP || bulletEmptyHost(p, geom));
|
|
51038
51039
|
const textish = m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "") || m.objs.some((o) => o.inline) || spacesText;
|
|
51039
51040
|
for (const o of m.objs) {
|
|
@@ -51043,10 +51044,10 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51043
51044
|
const outT = num3(om, "top"), outB = num3(om, "bottom");
|
|
51044
51045
|
const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
|
|
51045
51046
|
if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
|
|
51046
|
-
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51047
|
+
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1152 => _1152.getAttribute, 'call', _1153 => _1153("vertRelTo")]), () => ( "PARA"));
|
|
51047
51048
|
if (vertRel === "PAPER" && bodyFlow && wrapAttr !== "TOP_AND_BOTTOM") {
|
|
51048
51049
|
const [oxL, oyT, paperW] = paperOrigin(p);
|
|
51049
|
-
const hRel2 = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51050
|
+
const hRel2 = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1154 => _1154.getAttribute, 'call', _1155 => _1155("horzRelTo")]), () => ( "COLUMN")), hAlign2 = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1156 => _1156.getAttribute, 'call', _1157 => _1157("horzAlign")]), () => ( "LEFT"));
|
|
51050
51051
|
const ho2 = num3(pos, "horzOffset"), base2 = hRel2 === "PAPER" ? -oxL : hRel2 === "PARA" ? marginL : 0, span3 = hRel2 === "PAPER" ? paperW : hRel2 === "PARA" ? avail : areaW;
|
|
51051
51052
|
const x02 = base2 + (hAlign2 === "RIGHT" ? span3 - ho2 - o.width : hAlign2 === "CENTER" ? (span3 - o.width) / 2 + ho2 : ho2);
|
|
51052
51053
|
const vo0 = Math.max(0, num3(pos, "vertOffset")), top2 = vertRel === "PAPER" ? vo0 - oyT : vo0;
|
|
@@ -51060,7 +51061,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51060
51061
|
const voRaw = num3(pos, "vertOffset"), voSigned = Math.max(0, voRaw >= 2 ** 31 ? voRaw - 2 ** 32 : voRaw);
|
|
51061
51062
|
const effH = effHOf(o);
|
|
51062
51063
|
if (wrapAttr === "TOP_AND_BOTTOM") {
|
|
51063
|
-
const hR = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51064
|
+
const hR = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1158 => _1158.getAttribute, 'call', _1159 => _1159("horzRelTo")]), () => ( "COLUMN")), hA = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1160 => _1160.getAttribute, 'call', _1161 => _1161("horzAlign")]), () => ( "LEFT"));
|
|
51064
51065
|
const hoff = num3(pos, "horzOffset"), b0 = hR === "PARA" ? marginL : 0, sp = hR === "PARA" ? avail : areaW;
|
|
51065
51066
|
const xL = b0 + (hA === "RIGHT" ? sp - hoff - o.width : hA === "CENTER" ? (sp - o.width) / 2 + hoff : hoff);
|
|
51066
51067
|
if ((hR === "COLUMN" || hR === "PARA") && (xL >= areaW || xL + o.width <= 0)) continue;
|
|
@@ -51077,7 +51078,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51077
51078
|
else cellFloatBottom = Math.max(cellFloatBottom, voSigned + outT + effH + outB);
|
|
51078
51079
|
continue;
|
|
51079
51080
|
}
|
|
51080
|
-
const hRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51081
|
+
const hRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1162 => _1162.getAttribute, 'call', _1163 => _1163("horzRelTo")]), () => ( "COLUMN")), hAlign = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1164 => _1164.getAttribute, 'call', _1165 => _1165("horzAlign")]), () => ( "LEFT"));
|
|
51081
51082
|
const ho = num3(pos, "horzOffset"), base = hRel === "PARA" ? marginL : 0, span2 = hRel === "PARA" ? avail : areaW;
|
|
51082
51083
|
const x0 = base + (hAlign === "RIGHT" ? span2 - ho - o.width : hAlign === "CENTER" ? (span2 - o.width) / 2 + ho : ho);
|
|
51083
51084
|
const top = startV - (bodyFlow && vertRel === "PARA" && wrapAttr === "SQUARE" ? geom.spaceBefore : 0) + vo;
|
|
@@ -51087,7 +51088,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51087
51088
|
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 } : {} });
|
|
51088
51089
|
}
|
|
51089
51090
|
const hasText = textish;
|
|
51090
|
-
const nFloat = m.objs.filter((o) => !o.inline && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
51091
|
+
const nFloat = m.objs.filter((o) => !o.inline && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1166 => _1166(o.el, "pos"), 'optionalAccess', _1167 => _1167.getAttribute, 'call', _1168 => _1168("vertRelTo")]), () => ( "PARA"))) === "PARA").length;
|
|
51091
51092
|
const areaTop = bodyFlow ? startV - (_nullishCoalesce(geom.spaceBefore, () => ( 0))) : startV;
|
|
51092
51093
|
let floatFloor = 0;
|
|
51093
51094
|
if (!hasText && nFloat < 2) {
|
|
@@ -51214,25 +51215,25 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51214
51215
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
51215
51216
|
const li = lineOf(o.index);
|
|
51216
51217
|
const h = num3(om, "top") + effHOf(o) + num3(om, "bottom");
|
|
51217
|
-
if (o.tag === "tbl" && li > 0 && o.omL + o.width + o.omR > (_nullishCoalesce(_optionalChain([lineWidth, 'optionalCall',
|
|
51218
|
+
if (o.tag === "tbl" && li > 0 && o.omL + o.width + o.omR > (_nullishCoalesce(_optionalChain([lineWidth, 'optionalCall', _1169 => _1169(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);
|
|
51218
51219
|
lineObjH[li] = Math.max(lineObjH[li], h);
|
|
51219
|
-
if (_optionalChain([findChildByLocalName, 'call',
|
|
51220
|
+
if (_optionalChain([findChildByLocalName, 'call', _1170 => _1170(o.el, "pos"), 'optionalAccess', _1171 => _1171.getAttribute, 'call', _1172 => _1172("affectLSpacing")]) === "1") lineObjLs[li] = true;
|
|
51220
51221
|
const bl = o.tag === "equation" ? Number(o.el.getAttribute("baseLine")) : NaN;
|
|
51221
51222
|
lineObjAsc[li] = Math.max(lineObjAsc[li], Math.round(h * (Number.isFinite(bl) ? bl / 100 : BASELINE_RATIO)));
|
|
51222
51223
|
}
|
|
51223
51224
|
const lsa = doc.createElement("hp:linesegarray");
|
|
51224
51225
|
const subList = p.parentNode;
|
|
51225
|
-
const verticalCenter = _optionalChain([subList, 'optionalAccess',
|
|
51226
|
+
const verticalCenter = _optionalChain([subList, 'optionalAccess', _1173 => _1173.getAttribute, 'optionalCall', _1174 => _1174("vertAlign")]) === "CENTER" && ["VERTICAL", "VERTICALALL"].includes(_nullishCoalesce(subList.getAttribute("textDirection"), () => ( "")));
|
|
51226
51227
|
let v = textStartV;
|
|
51227
51228
|
let firstAcc = 0;
|
|
51228
51229
|
const textposOf = wrap.starts.map((startReal, li) => li === 0 ? 0 : startReal < realIdx.length ? realIdx[startReal] : realIdx.length ? m.chars.length : 0);
|
|
51229
|
-
const heightOf = (prId) => (prId != null ? _optionalChain([styles, 'access',
|
|
51230
|
+
const heightOf = (prId) => (prId != null ? _optionalChain([styles, 'access', _1175 => _1175.charPr, 'access', _1176 => _1176.get, 'call', _1177 => _1177(prId), 'optionalAccess', _1178 => _1178.height]) : void 0) || 0;
|
|
51230
51231
|
const lineTextH = (li) => {
|
|
51231
51232
|
const s = textposOf[li], last = li === wrap.starts.length - 1, e = last ? m.chars.length : textposOf[li + 1];
|
|
51232
51233
|
let h = 0;
|
|
51233
51234
|
for (let k = s; k < e; k++) h = Math.max(h, heightOf(m.chars[k].prId));
|
|
51234
51235
|
for (const r of m.runs) if (r.at >= s && (last ? r.at <= e : r.at < e)) h = Math.max(h, heightOf(r.prId));
|
|
51235
|
-
if (li === 0 && _optionalChain([bu, 'optionalAccess',
|
|
51236
|
+
if (li === 0 && _optionalChain([bu, 'optionalAccess', _1179 => _1179.charPrId]) != null) h = Math.max(h, heightOf(bu.charPrId));
|
|
51236
51237
|
return h || height;
|
|
51237
51238
|
};
|
|
51238
51239
|
const fontLineOf = (li) => {
|
|
@@ -51246,7 +51247,8 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51246
51247
|
const st = c.prId != null ? styles.charPr.get(c.prId) : void 0;
|
|
51247
51248
|
if (!st) continue;
|
|
51248
51249
|
const cp = c.ch.codePointAt(0);
|
|
51249
|
-
const
|
|
51250
|
+
const font = c.ch !== " " && st.latin && isLatinCp(cp) ? st.latin : st;
|
|
51251
|
+
const fm = fontLineMetrics(font.face, font.hft);
|
|
51250
51252
|
any = true;
|
|
51251
51253
|
h = Math.max(h, fm ? Math.round(st.height * fm[0]) + (fm[2] ? Math.round : Math.trunc)(st.height * fm[1]) : st.height);
|
|
51252
51254
|
b = Math.max(b, fm ? Math.round(st.height * fm[0]) : Math.round(st.height * BASELINE_RATIO));
|
|
@@ -51280,7 +51282,9 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51280
51282
|
}
|
|
51281
51283
|
}
|
|
51282
51284
|
const vertpos = v;
|
|
51283
|
-
const
|
|
51285
|
+
const nextStart = textposOf[li + 1], nextChar = m.chars[nextStart];
|
|
51286
|
+
const boundaryH = !m.objs.length && !geom.fontLineHeight && _optionalChain([nextChar, 'optionalAccess', _1180 => _1180.ch, 'access', _1181 => _1181.trim, 'call', _1182 => _1182()]) && m.runs.some((r) => r.at === nextStart && r.prId === nextChar.prId) ? heightOf(nextChar.prId) : 0;
|
|
51287
|
+
const occupiedH = Math.max(lineH, _nullishCoalesce(collisionHeights[li], () => ( 0)), boundaryH);
|
|
51284
51288
|
v += lineH + spacing;
|
|
51285
51289
|
const isFirst = li === 0;
|
|
51286
51290
|
const seg = doc.createElement("hp:lineseg");
|
|
@@ -51291,7 +51295,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51291
51295
|
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 : Math.max(fl ? fl[1] : Math.round(textH0 * BASELINE_RATIO), boxTop > textH0 ? Math.round(boxTop * BASELINE_RATIO) : 0, lineObjAsc[li])));
|
|
51292
51296
|
seg.setAttribute("spacing", String(spacing));
|
|
51293
51297
|
let box = boxAt(li);
|
|
51294
|
-
const fit = wrap.starts.length === 1 && lineObjH[li] === 0 ? _optionalChain([lineParts, 'access',
|
|
51298
|
+
const fit = wrap.starts.length === 1 && lineObjH[li] === 0 ? _optionalChain([lineParts, 'access', _1183 => _1183[li], 'optionalAccess', _1184 => _1184.filter, 'call', _1185 => _1185(([a, b]) => b - a >= 1440)]) : void 0;
|
|
51295
51299
|
const parts = fit && fit.length > 1 && natW <= fit[0][1] - fit[0][0] - Math.max(0, geom.marginIntent) ? fit : void 0;
|
|
51296
51300
|
if (parts) box = [parts[0][0], parts[0][1] - parts[0][0]];
|
|
51297
51301
|
seg.setAttribute("horzpos", String(box ? box[0] : isFirst ? marginL : contHorz));
|
|
@@ -51305,7 +51309,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51305
51309
|
{ text, widths, spacings, slots: realIdx, start: wrap.starts[li], end: _nullishCoalesce(wrap.starts[li + 1], () => ( text.length)) }
|
|
51306
51310
|
)) continue;
|
|
51307
51311
|
lsa.appendChild(seg);
|
|
51308
|
-
for (const [a, b] of _nullishCoalesce(_optionalChain([parts, 'optionalAccess',
|
|
51312
|
+
for (const [a, b] of _nullishCoalesce(_optionalChain([parts, 'optionalAccess', _1186 => _1186.slice, 'call', _1187 => _1187(1)]), () => ( []))) {
|
|
51309
51313
|
const more = seg.cloneNode(false);
|
|
51310
51314
|
more.setAttribute("textpos", String(m.chars.length + 1));
|
|
51311
51315
|
more.setAttribute("horzpos", String(a));
|
|
@@ -51324,9 +51328,9 @@ function paperOrigin(p) {
|
|
|
51324
51328
|
const d = p.ownerDocument;
|
|
51325
51329
|
const hit = originMemo.get(d);
|
|
51326
51330
|
if (hit) return hit;
|
|
51327
|
-
const pagePr = _nullishCoalesce(_optionalChain([p, 'access',
|
|
51331
|
+
const pagePr = _nullishCoalesce(_optionalChain([p, 'access', _1188 => _1188.ownerDocument, 'optionalAccess', _1189 => _1189.getElementsByTagName, 'call', _1190 => _1190("hp:pagePr"), 'access', _1191 => _1191[0]]), () => ( null));
|
|
51328
51332
|
const mg = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
51329
|
-
const tb = _optionalChain([pagePr, 'optionalAccess',
|
|
51333
|
+
const tb = _optionalChain([pagePr, 'optionalAccess', _1192 => _1192.getAttribute, 'call', _1193 => _1193("gutterType")]) === "TOP_BOTTOM", gut = num3(mg, "gutter");
|
|
51330
51334
|
const o = [num3(mg, "left", 8504) + (tb ? 0 : gut), num3(mg, "top", 5668) + num3(mg, "header") + (tb ? gut : 0), num3(pagePr, "width", 59528)];
|
|
51331
51335
|
originMemo.set(d, o);
|
|
51332
51336
|
return o;
|
|
@@ -51343,7 +51347,7 @@ function pageTopBand(p) {
|
|
|
51343
51347
|
for (const o of elements2(run)) {
|
|
51344
51348
|
if (!OBJ_TAGS.has(ln2(o)) || o.getAttribute("textWrap") !== "TOP_AND_BOTTOM") continue;
|
|
51345
51349
|
const pos = findChildByLocalName(o, "pos");
|
|
51346
|
-
if (_optionalChain([pos, 'optionalAccess',
|
|
51350
|
+
if (_optionalChain([pos, 'optionalAccess', _1194 => _1194.getAttribute, 'call', _1195 => _1195("treatAsChar")]) === "1" || _optionalChain([pos, 'optionalAccess', _1196 => _1196.getAttribute, 'call', _1197 => _1197("vertRelTo")]) !== "PAGE" || (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1198 => _1198.getAttribute, 'call', _1199 => _1199("vertAlign")]), () => ( "TOP"))) !== "TOP") continue;
|
|
51347
51351
|
const om = findChildByLocalName(o, "outMargin"), sz = findChildByLocalName(o, "sz");
|
|
51348
51352
|
const h = ln2(o) === "tbl" ? Math.max(num3(sz, "height"), measureTableHeight(o)) : num3(sz, "height");
|
|
51349
51353
|
const vo = Math.max(0, num3(pos, "vertOffset"));
|
|
@@ -51399,7 +51403,7 @@ function footNoteHeights(p, ownOnly = false) {
|
|
|
51399
51403
|
let a = fn.parentNode, inSplit = false;
|
|
51400
51404
|
while (a && a !== p) {
|
|
51401
51405
|
const e = a;
|
|
51402
|
-
if (ln2(e) === "tbl" && (e.getAttribute("pageBreak") === "CELL" || e.getAttribute("pageBreak") === "TABLE") && _optionalChain([findChildByLocalName, 'call',
|
|
51406
|
+
if (ln2(e) === "tbl" && (e.getAttribute("pageBreak") === "CELL" || e.getAttribute("pageBreak") === "TABLE") && _optionalChain([findChildByLocalName, 'call', _1200 => _1200(e, "pos"), 'optionalAccess', _1201 => _1201.getAttribute, 'call', _1202 => _1202("treatAsChar")]) !== "1") inSplit = true;
|
|
51403
51407
|
a = a.parentNode;
|
|
51404
51408
|
}
|
|
51405
51409
|
if (inSplit) continue;
|
|
@@ -51428,7 +51432,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51428
51432
|
let prevPlaced;
|
|
51429
51433
|
const bodyFlow = areaW === counter.bodyW && bodyH > 0;
|
|
51430
51434
|
const vis = bodyH > 0 ? findFirst(container, "visibility") : null;
|
|
51431
|
-
const hideFirstEmpty = _optionalChain([vis, 'optionalAccess',
|
|
51435
|
+
const hideFirstEmpty = _optionalChain([vis, 'optionalAccess', _1203 => _1203.getAttribute, 'call', _1204 => _1204("hideFirstEmptyLine")]) === "1";
|
|
51432
51436
|
let hidPrev = 0;
|
|
51433
51437
|
const cellW = areaW;
|
|
51434
51438
|
let cellCols = 1, cellCol = 0;
|
|
@@ -51453,7 +51457,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51453
51457
|
reflowSubListsIn(p, doc, styles, mode, counter, reflowBlockFlow, bodyFlow ? areaW : void 0);
|
|
51454
51458
|
const g3 = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
51455
51459
|
const cursorBefore = cursorV;
|
|
51456
|
-
let startV = Math.max(cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51460
|
+
let startV = Math.max(cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1205 => _1205.spaceBefore]), () => ( 0))), floatFloor);
|
|
51457
51461
|
floatFloor = 0;
|
|
51458
51462
|
if (bodyH > 0) {
|
|
51459
51463
|
const [top, bot] = pageTopBand(p);
|
|
@@ -51479,13 +51483,13 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51479
51483
|
const bottom = cachedParagraphBottom(lsa, bodyFlow);
|
|
51480
51484
|
if (Number.isFinite(bottom)) {
|
|
51481
51485
|
cursorV = bottom;
|
|
51482
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51486
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1206 => _1206.spaceAfter]), () => ( 0));
|
|
51483
51487
|
}
|
|
51484
51488
|
}
|
|
51485
51489
|
continue;
|
|
51486
51490
|
}
|
|
51487
51491
|
const paraH = res.paraBottom - startV;
|
|
51488
|
-
const explicitBreak = bodyH > 0 && startV > 0 && (p.getAttribute("pageBreak") === "1" || p.getAttribute("columnBreak") === "1" || !!_optionalChain([g3, 'optionalAccess',
|
|
51492
|
+
const explicitBreak = bodyH > 0 && startV > 0 && (p.getAttribute("pageBreak") === "1" || p.getAttribute("columnBreak") === "1" || !!_optionalChain([g3, 'optionalAccess', _1207 => _1207.pageBreakBefore]));
|
|
51489
51493
|
const lines = bodyH > 0 ? elements2(_nullishCoalesce(findChildByLocalName(p, "linesegarray"), () => ( p))).filter((e) => ln2(e) === "lineseg") : [];
|
|
51490
51494
|
const reserve = bodyH > 0 ? pageBottomReserve(p) : 0;
|
|
51491
51495
|
const fns = bodyH > 0 ? footNoteHeights(p) : [];
|
|
@@ -51520,9 +51524,9 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51520
51524
|
let cut = -1;
|
|
51521
51525
|
if (!explicitBreak && !firstOver && lines.length > 1) {
|
|
51522
51526
|
cut = lines.findIndex((seg, i) => i > 0 && lineBottom(seg) > limAt(i) && num3(seg, "vertsize") <= bodyH);
|
|
51523
|
-
if (cut > 0 && _optionalChain([g3, 'optionalAccess',
|
|
51527
|
+
if (cut > 0 && _optionalChain([g3, 'optionalAccess', _1208 => _1208.widowOrphan]) && lines.length >= 3 && cut === lines.length - 1) cut--;
|
|
51524
51528
|
}
|
|
51525
|
-
const orphan = cut === 1 && !!_optionalChain([g3, 'optionalAccess',
|
|
51529
|
+
const orphan = cut === 1 && !!_optionalChain([g3, 'optionalAccess', _1209 => _1209.widowOrphan]) || cut > 0 && !!_optionalChain([g3, 'optionalAccess', _1210 => _1210.keepLines]);
|
|
51526
51530
|
if (cut > 0 && !orphan) {
|
|
51527
51531
|
for (let i = cut; i < lines.length; i++) {
|
|
51528
51532
|
const seg = lines[i];
|
|
@@ -51542,7 +51546,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51542
51546
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
51543
51547
|
if (lsa) p.removeChild(lsa);
|
|
51544
51548
|
const zb = zones.length;
|
|
51545
|
-
const sb0 = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51549
|
+
const sb0 = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1211 => _1211.spaceBefore]), () => ( 0));
|
|
51546
51550
|
let moveRes = reflowPara(p, doc, styles, areaW, sb0, mode, zones, new Map([...numsBefore].map(([k, v]) => [k, v.slice()])), true, bodyH);
|
|
51547
51551
|
const lsaM = findChildByLocalName(p, "linesegarray"), sM = lsaM ? elements2(lsaM).find((e) => ln2(e) === "lineseg") : void 0;
|
|
51548
51552
|
const vM = sM ? num3(sM, "vertpos") : sb0;
|
|
@@ -51562,7 +51566,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51562
51566
|
}
|
|
51563
51567
|
}
|
|
51564
51568
|
} else {
|
|
51565
|
-
const top = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51569
|
+
const top = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1212 => _1212.spaceBefore]), () => ( 0));
|
|
51566
51570
|
shiftParaVert(p, top - startV);
|
|
51567
51571
|
cursorV = paraH + top;
|
|
51568
51572
|
if (bodyH > 0 && (top + paraH > bodyH || squareTableOver(p, top, bodyH))) {
|
|
@@ -51574,7 +51578,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51574
51578
|
splitPage = true;
|
|
51575
51579
|
}
|
|
51576
51580
|
}
|
|
51577
|
-
if (_optionalChain([prevPlaced, 'optionalAccess',
|
|
51581
|
+
if (_optionalChain([prevPlaced, 'optionalAccess', _1213 => _1213.keepWithNext]) && prevPlaced.startV > prevPlaced.top) {
|
|
51578
51582
|
shiftParaVert(prevPlaced.p, prevPlaced.top - prevPlaced.startV);
|
|
51579
51583
|
const base = prevPlaced.top + prevPlaced.h + prevPlaced.spaceAfter;
|
|
51580
51584
|
shiftParaVert(p, base);
|
|
@@ -51589,7 +51593,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51589
51593
|
const tVo = tEl ? num3(findChildByLocalName(tEl, "pos"), "vertOffset") : 0;
|
|
51590
51594
|
const tOm = tEl ? findChildByLocalName(tEl, "outMargin") : null;
|
|
51591
51595
|
if (tEl && tVo > 0 && tVo < 2 ** 31 && num3(tOm, "top") + measureTableHeight(tEl) + num3(tOm, "bottom") <= bodyH) {
|
|
51592
|
-
const tTop = startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51596
|
+
const tTop = startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1214 => _1214.spaceBefore]), () => ( 0))) + tVo;
|
|
51593
51597
|
zones.push({ top: tTop, bottom: Math.max(bodyH + 1, tTop + 1), left: -1e9, right: 1e9, flow: "BOTH_SIDES", carry: split });
|
|
51594
51598
|
floatFloor = 0;
|
|
51595
51599
|
cursorV = res.textBottom;
|
|
@@ -51616,9 +51620,9 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51616
51620
|
zones.length = 0;
|
|
51617
51621
|
splitPage = true;
|
|
51618
51622
|
}
|
|
51619
|
-
} else if (bodyH > 0 && off === 0 && bandTableOver(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51623
|
+
} else if (bodyH > 0 && off === 0 && bandTableOver(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1215 => _1215.spaceBefore]), () => ( 0))), lim)) {
|
|
51620
51624
|
const BU = BUH;
|
|
51621
|
-
const split4 = splitFloatTableRemainder(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51625
|
+
const split4 = splitFloatTableRemainder(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1216 => _1216.spaceBefore]), () => ( 0))), BU ? limOwn : lim, bodyH, styles, true, BU ? { n0: pageNotes + fnsOwn.length, s0: pageFoot + ownSum, area: footArea } : void 0);
|
|
51622
51626
|
if (split4 !== void 0) {
|
|
51623
51627
|
cursorV = 0;
|
|
51624
51628
|
floatFloor = split4;
|
|
@@ -51636,7 +51640,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51636
51640
|
}
|
|
51637
51641
|
const keepCursor = hidden && !explicitBreak;
|
|
51638
51642
|
hidPrev = hidden ? hidPrev + 1 : 0;
|
|
51639
|
-
prevPlaced = off === 0 && !(explicitBreak || firstOver || orphan) ? { p, startV, top: _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51643
|
+
prevPlaced = off === 0 && !(explicitBreak || firstOver || orphan) ? { p, startV, top: _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1217 => _1217.spaceBefore]), () => ( 0)), h: paraH, spaceAfter: res.spaceAfter, keepWithNext: !!_optionalChain([g3, 'optionalAccess', _1218 => _1218.keepWithNext]) } : void 0;
|
|
51640
51644
|
const moved = explicitBreak || firstOver || orphan || off !== 0;
|
|
51641
51645
|
pageLimit = reserve > 0 ? bodyH - reserve : moved ? bodyH : Math.min(pageLimit, reserve > 0 ? bodyH - reserve : pageLimit);
|
|
51642
51646
|
if (moved && refs.length && cut > 0 && !orphan && !explicitBreak && !firstOver) {
|
|
@@ -51736,7 +51740,7 @@ function flowEndNotes(root, bodyH) {
|
|
|
51736
51740
|
if (done.has(f) || raw0 < f.bottom) continue;
|
|
51737
51741
|
done.add(f);
|
|
51738
51742
|
if (!(base + f.lineBottom - shift <= bodyH && base + f.bottom - shift > bodyH)) continue;
|
|
51739
|
-
if (_optionalChain([f, 'access',
|
|
51743
|
+
if (_optionalChain([f, 'access', _1219 => _1219.rows, 'optionalAccess', _1220 => _1220.length]) && _optionalChain([f, 'access', _1221 => _1221.el, 'optionalAccess', _1222 => _1222.getAttribute, 'call', _1223 => _1223("pageBreak")]) === "CELL") {
|
|
51740
51744
|
let yy = base + f.bottom - f.carry - shift + f.outT, k = 0;
|
|
51741
51745
|
while (k < f.rows.length && yy + f.rows[k] <= bodyH) yy += f.rows[k++];
|
|
51742
51746
|
if (k === f.rows.length) continue;
|
|
@@ -51766,205 +51770,6 @@ function flowEndNotes(root, bodyH) {
|
|
|
51766
51770
|
});
|
|
51767
51771
|
}
|
|
51768
51772
|
|
|
51769
|
-
// src/render/equation-text.ts
|
|
51770
|
-
var SYMBOLS = {
|
|
51771
|
-
alpha: "\u03B1",
|
|
51772
|
-
beta: "\u03B2",
|
|
51773
|
-
gamma: "\u03B3",
|
|
51774
|
-
delta: "\u03B4",
|
|
51775
|
-
epsilon: "\u03B5",
|
|
51776
|
-
varepsilon: "\u03B5",
|
|
51777
|
-
zeta: "\u03B6",
|
|
51778
|
-
eta: "\u03B7",
|
|
51779
|
-
theta: "\u03B8",
|
|
51780
|
-
vartheta: "\u03D1",
|
|
51781
|
-
iota: "\u03B9",
|
|
51782
|
-
kappa: "\u03BA",
|
|
51783
|
-
lambda: "\u03BB",
|
|
51784
|
-
mu: "\u03BC",
|
|
51785
|
-
nu: "\u03BD",
|
|
51786
|
-
xi: "\u03BE",
|
|
51787
|
-
pi: "\u03C0",
|
|
51788
|
-
rho: "\u03C1",
|
|
51789
|
-
sigma: "\u03C3",
|
|
51790
|
-
tau: "\u03C4",
|
|
51791
|
-
upsilon: "\u03C5",
|
|
51792
|
-
phi: "\u03C6",
|
|
51793
|
-
varphi: "\u03C6",
|
|
51794
|
-
chi: "\u03C7",
|
|
51795
|
-
psi: "\u03C8",
|
|
51796
|
-
omega: "\u03C9",
|
|
51797
|
-
Gamma: "\u0393",
|
|
51798
|
-
Delta: "\u0394",
|
|
51799
|
-
Theta: "\u0398",
|
|
51800
|
-
Lambda: "\u039B",
|
|
51801
|
-
Xi: "\u039E",
|
|
51802
|
-
Pi: "\u03A0",
|
|
51803
|
-
Sigma: "\u03A3",
|
|
51804
|
-
Phi: "\u03A6",
|
|
51805
|
-
Psi: "\u03A8",
|
|
51806
|
-
Omega: "\u03A9",
|
|
51807
|
-
times: "\xD7",
|
|
51808
|
-
cdot: "\xB7",
|
|
51809
|
-
div: "\xF7",
|
|
51810
|
-
pm: "\xB1",
|
|
51811
|
-
mp: "\u2213",
|
|
51812
|
-
le: "\u2264",
|
|
51813
|
-
leq: "\u2264",
|
|
51814
|
-
ge: "\u2265",
|
|
51815
|
-
geq: "\u2265",
|
|
51816
|
-
ne: "\u2260",
|
|
51817
|
-
neq: "\u2260",
|
|
51818
|
-
approx: "\u2248",
|
|
51819
|
-
equiv: "\u2261",
|
|
51820
|
-
sim: "\u223C",
|
|
51821
|
-
infty: "\u221E",
|
|
51822
|
-
rightarrow: "\u2192",
|
|
51823
|
-
leftarrow: "\u2190",
|
|
51824
|
-
Rightarrow: "\u21D2",
|
|
51825
|
-
Leftarrow: "\u21D0",
|
|
51826
|
-
leftrightarrow: "\u2194",
|
|
51827
|
-
Leftrightarrow: "\u21D4",
|
|
51828
|
-
to: "\u2192",
|
|
51829
|
-
angle: "\u2220",
|
|
51830
|
-
triangle: "\u25B3",
|
|
51831
|
-
perp: "\u22A5",
|
|
51832
|
-
parallel: "\u2225",
|
|
51833
|
-
circ: "\u2218",
|
|
51834
|
-
degree: "\xB0",
|
|
51835
|
-
sum: "\u03A3",
|
|
51836
|
-
prod: "\u03A0",
|
|
51837
|
-
int: "\u222B",
|
|
51838
|
-
oint: "\u222E",
|
|
51839
|
-
partial: "\u2202",
|
|
51840
|
-
nabla: "\u2207",
|
|
51841
|
-
in: "\u2208",
|
|
51842
|
-
notin: "\u2209",
|
|
51843
|
-
subset: "\u2282",
|
|
51844
|
-
supset: "\u2283",
|
|
51845
|
-
subseteq: "\u2286",
|
|
51846
|
-
supseteq: "\u2287",
|
|
51847
|
-
cup: "\u222A",
|
|
51848
|
-
cap: "\u2229",
|
|
51849
|
-
emptyset: "\u2205",
|
|
51850
|
-
forall: "\u2200",
|
|
51851
|
-
exists: "\u2203",
|
|
51852
|
-
therefore: "\u2234",
|
|
51853
|
-
because: "\u2235",
|
|
51854
|
-
prime: "\u2032",
|
|
51855
|
-
cdots: "\u22EF",
|
|
51856
|
-
ldots: "\u2026",
|
|
51857
|
-
dots: "\u2026",
|
|
51858
|
-
vdots: "\u22EE",
|
|
51859
|
-
lim: "lim",
|
|
51860
|
-
log: "log",
|
|
51861
|
-
ln: "ln",
|
|
51862
|
-
sin: "sin",
|
|
51863
|
-
cos: "cos",
|
|
51864
|
-
tan: "tan",
|
|
51865
|
-
sec: "sec",
|
|
51866
|
-
csc: "csc",
|
|
51867
|
-
cot: "cot",
|
|
51868
|
-
exp: "exp",
|
|
51869
|
-
max: "max",
|
|
51870
|
-
min: "min",
|
|
51871
|
-
quad: " ",
|
|
51872
|
-
qquad: " ",
|
|
51873
|
-
",": " ",
|
|
51874
|
-
";": " ",
|
|
51875
|
-
"!": "",
|
|
51876
|
-
"{": "{",
|
|
51877
|
-
"}": "}",
|
|
51878
|
-
"|": "\u2016",
|
|
51879
|
-
backslash: "\\",
|
|
51880
|
-
lbrace: "{",
|
|
51881
|
-
rbrace: "}",
|
|
51882
|
-
langle: "\u27E8",
|
|
51883
|
-
rangle: "\u27E9"
|
|
51884
|
-
};
|
|
51885
|
-
var SUP = { "0": "\u2070", "1": "\xB9", "2": "\xB2", "3": "\xB3", "4": "\u2074", "5": "\u2075", "6": "\u2076", "7": "\u2077", "8": "\u2078", "9": "\u2079", "+": "\u207A", "-": "\u207B", "=": "\u207C", "(": "\u207D", ")": "\u207E", n: "\u207F", i: "\u2071", x: "\u02E3", "\u2032": "\u2032" };
|
|
51886
|
-
var SUB = { "0": "\u2080", "1": "\u2081", "2": "\u2082", "3": "\u2083", "4": "\u2084", "5": "\u2085", "6": "\u2086", "7": "\u2087", "8": "\u2088", "9": "\u2089", "+": "\u208A", "-": "\u208B", "=": "\u208C", "(": "\u208D", ")": "\u208E" };
|
|
51887
|
-
function latexToPlain(latex) {
|
|
51888
|
-
let i = 0;
|
|
51889
|
-
const s = latex;
|
|
51890
|
-
const skipWs = () => {
|
|
51891
|
-
while (i < s.length && s[i] === " ") i++;
|
|
51892
|
-
};
|
|
51893
|
-
const arg = () => {
|
|
51894
|
-
skipWs();
|
|
51895
|
-
if (s[i] === "{") {
|
|
51896
|
-
i++;
|
|
51897
|
-
const v = seq("}");
|
|
51898
|
-
i++;
|
|
51899
|
-
return v;
|
|
51900
|
-
}
|
|
51901
|
-
return atom();
|
|
51902
|
-
};
|
|
51903
|
-
const wrap = (v) => v.length > 1 && !/^[\w.′]+$|^\(.*\)$/u.test(v) ? `(${v})` : v;
|
|
51904
|
-
const script = (v, map, mark) => {
|
|
51905
|
-
const t = v.trim();
|
|
51906
|
-
return [...t].every((c) => map[c]) ? [...t].map((c) => map[c]).join("") : `${mark}${wrap(t)}`;
|
|
51907
|
-
};
|
|
51908
|
-
const atom = () => {
|
|
51909
|
-
const c = s[i];
|
|
51910
|
-
if (c === void 0) return "";
|
|
51911
|
-
if (c === "\\") {
|
|
51912
|
-
i++;
|
|
51913
|
-
let name = "";
|
|
51914
|
-
if (/[A-Za-z]/.test(_nullishCoalesce(s[i], () => ( "")))) while (/[A-Za-z]/.test(_nullishCoalesce(s[i], () => ( "")))) name += s[i++];
|
|
51915
|
-
else name = _nullishCoalesce(s[i++], () => ( ""));
|
|
51916
|
-
if (name === "frac") {
|
|
51917
|
-
const a = arg(), b = arg();
|
|
51918
|
-
return `${wrap(a.trim())}/${wrap(b.trim())}`;
|
|
51919
|
-
}
|
|
51920
|
-
if (name === "sqrt") {
|
|
51921
|
-
skipWs();
|
|
51922
|
-
let root = "";
|
|
51923
|
-
if (s[i] === "[") {
|
|
51924
|
-
i++;
|
|
51925
|
-
root = seq("]");
|
|
51926
|
-
i++;
|
|
51927
|
-
}
|
|
51928
|
-
const a = arg();
|
|
51929
|
-
return `${root ? script(root, SUP, "") : ""}\u221A${wrap(a.trim())}`;
|
|
51930
|
-
}
|
|
51931
|
-
if (name === "left" || name === "right" || name === "big" || name === "Big" || name === "bigg" || name === "Bigg") {
|
|
51932
|
-
skipWs();
|
|
51933
|
-
const d = s[i] === "\\" ? atom() : _nullishCoalesce(s[i++], () => ( ""));
|
|
51934
|
-
return d === "." ? "" : d;
|
|
51935
|
-
}
|
|
51936
|
-
if (name === "overline" || name === "bar" || name === "hat" || name === "vec" || name === "dot" || name === "tilde") {
|
|
51937
|
-
const a = arg().trim(), mark = { overline: "\u0305", bar: "\u0304", hat: "\u0302", vec: "\u20D7", dot: "\u0307", tilde: "\u0303" }[name];
|
|
51938
|
-
return [...a].map((ch) => ch + mark).join("");
|
|
51939
|
-
}
|
|
51940
|
-
if (name === "mathrm" || name === "text" || name === "rm" || name === "mathbf" || name === "it" || name === "mathit" || name === "operatorname") return name === "rm" || name === "it" ? "" : arg();
|
|
51941
|
-
return _nullishCoalesce(SYMBOLS[name], () => ( name));
|
|
51942
|
-
}
|
|
51943
|
-
i++;
|
|
51944
|
-
if (c === "{") {
|
|
51945
|
-
const v = seq("}");
|
|
51946
|
-
i++;
|
|
51947
|
-
return v;
|
|
51948
|
-
}
|
|
51949
|
-
if (c === "^") return script(arg(), SUP, "^");
|
|
51950
|
-
if (c === "_") return script(arg(), SUB, "_");
|
|
51951
|
-
if (c === "~" || c === "`") return " ";
|
|
51952
|
-
return c;
|
|
51953
|
-
};
|
|
51954
|
-
const seq = (end) => {
|
|
51955
|
-
let out = "";
|
|
51956
|
-
while (i < s.length && s[i] !== end) {
|
|
51957
|
-
if (s[i] === " ") {
|
|
51958
|
-
i++;
|
|
51959
|
-
continue;
|
|
51960
|
-
}
|
|
51961
|
-
out += atom();
|
|
51962
|
-
}
|
|
51963
|
-
return out;
|
|
51964
|
-
};
|
|
51965
|
-
return seq("\0").replace(/\s+/g, " ").trim();
|
|
51966
|
-
}
|
|
51967
|
-
|
|
51968
51773
|
// src/render/scene.ts
|
|
51969
51774
|
function regionId(type, seq) {
|
|
51970
51775
|
return `${type}-${String(seq).padStart(6, "0")}`;
|
|
@@ -52002,7 +51807,7 @@ function pageStories(root, masters, paraPages, pageCount, pageBase, geom) {
|
|
|
52002
51807
|
const declarations = [];
|
|
52003
51808
|
const hidden = /* @__PURE__ */ new Map();
|
|
52004
51809
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
52005
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
51810
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1224 => _1224.get, 'call', _1225 => _1225(p), 'optionalAccess', _1226 => _1226[0]]), () => ( 0));
|
|
52006
51811
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
52007
51812
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
52008
51813
|
for (const el of elements(ctrl)) {
|
|
@@ -52022,7 +51827,7 @@ function pageStories(root, masters, paraPages, pageCount, pageBase, geom) {
|
|
|
52022
51827
|
const out = [];
|
|
52023
51828
|
for (let page = 0; page < pageCount; page++) {
|
|
52024
51829
|
const n = pageBase + page + 1;
|
|
52025
|
-
const hides = (name) => _optionalChain([hidden, 'access',
|
|
51830
|
+
const hides = (name) => _optionalChain([hidden, 'access', _1227 => _1227.get, 'call', _1228 => _1228(page), 'optionalAccess', _1229 => _1229.has, 'call', _1230 => _1230(name)]) === true || page === 0 && num2(visibility, `hideFirst${name}`) !== 0;
|
|
52026
51831
|
if (!hides("MasterPage")) {
|
|
52027
51832
|
const matching = masters.filter((m) => m.getAttribute("type") === (n % 2 ? "ODD" : "EVEN"));
|
|
52028
51833
|
const both = masters.filter((m) => (m.getAttribute("type") || "BOTH") === "BOTH");
|
|
@@ -52051,7 +51856,7 @@ function footNoteStories(root, paraPages, geom) {
|
|
|
52051
51856
|
const above = num2(sp, "aboveLine", 850), below = num2(sp, "belowLine", 567), between = num2(sp, "betweenNotes", 283);
|
|
52052
51857
|
const byPage = /* @__PURE__ */ new Map();
|
|
52053
51858
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
52054
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
51859
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1231 => _1231.get, 'call', _1232 => _1232(p), 'optionalAccess', _1233 => _1233[0]]), () => ( 0));
|
|
52055
51860
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
52056
51861
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
52057
51862
|
const fn = findChildByLocalName(ctrl, "footNote");
|
|
@@ -52069,12 +51874,12 @@ function footNoteStories(root, paraPages, geom) {
|
|
|
52069
51874
|
}
|
|
52070
51875
|
}
|
|
52071
51876
|
const stories = [], rules = [];
|
|
52072
|
-
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52073
|
-
const lineType = _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
51877
|
+
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1234 => _1234.getAttribute, 'call', _1235 => _1235("width")]), () => ( "0.12"))) || 0.12;
|
|
51878
|
+
const lineType = _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1236 => _1236.getAttribute, 'call', _1237 => _1237("type")]), () => ( "SOLID"));
|
|
52074
51879
|
for (const [page, notes] of byPage) {
|
|
52075
51880
|
const area = above + below + notes.reduce((a, n) => a + n.h, 0) + between * (notes.length - 1);
|
|
52076
51881
|
const top = geom.MT + geom.BODY_H - area;
|
|
52077
|
-
if (lineType !== "NONE") rules.push({ page, x: geom.ML, y: top + above, length: lenAttr > 0 ? lenAttr : 14173, widthMm, color: _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
51882
|
+
if (lineType !== "NONE") rules.push({ page, x: geom.ML, y: top + above, length: lenAttr > 0 ? lenAttr : 14173, widthMm, color: _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1238 => _1238.getAttribute, 'call', _1239 => _1239("color")]), () => ( "#000000")) });
|
|
52078
51883
|
let y = top + above + below;
|
|
52079
51884
|
for (const n of notes) {
|
|
52080
51885
|
stories.push({ sub: n.sub, page, x: geom.ML, y, width: geom.BODY_W });
|
|
@@ -52110,8 +51915,8 @@ function endNoteLayout(root, paraPages, geom) {
|
|
|
52110
51915
|
let col = nCol > 1 ? Math.min(nCol - 1, Math.max(0, Math.round(num2(last.seg, "horzpos") / (colW + gap)))) : 0;
|
|
52111
51916
|
let y = num2(last.seg, "vertpos") + num2(last.seg, "vertsize") + above;
|
|
52112
51917
|
const rules = [];
|
|
52113
|
-
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52114
|
-
if ((_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
51918
|
+
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1240 => _1240.getAttribute, 'call', _1241 => _1241("width")]), () => ( "0.12"))) || 0.12;
|
|
51919
|
+
if ((_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1242 => _1242.getAttribute, 'call', _1243 => _1243("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', _1244 => _1244.getAttribute, 'call', _1245 => _1245("color")]), () => ( "#000000")) });
|
|
52115
51920
|
y += below;
|
|
52116
51921
|
const next = () => {
|
|
52117
51922
|
if (++col >= nCol) {
|
|
@@ -52205,7 +52010,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52205
52010
|
return st.length >= 2 && st.reduce((a, f) => a + f.h, 0) > h;
|
|
52206
52011
|
});
|
|
52207
52012
|
if (BODY_H <= 0 || ty + rowY[nRows] <= pageBottom + slack && !stackOver) return plain4();
|
|
52208
|
-
if (_optionalChain([findChildByLocalName, 'call',
|
|
52013
|
+
if (_optionalChain([findChildByLocalName, 'call', _1246 => _1246(tbl2, "pos"), 'optionalAccess', _1247 => _1247.getAttribute, 'call', _1248 => _1248("treatAsChar")]) === "1") {
|
|
52209
52014
|
const declared = num2(findChildByLocalName(tbl2, "sz"), "height") || rowY[nRows];
|
|
52210
52015
|
if (ty - MT < 2e3 || ty + declared <= pageBottom + slack) return plain4();
|
|
52211
52016
|
return rowH.map((h, r) => [{ page: 1, y: MT + rowY[r], h }]);
|
|
@@ -52261,7 +52066,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52261
52066
|
const b = (_nullishCoalesce(boxes.get(c.el), () => ( []))).find((x) => x.part === k);
|
|
52262
52067
|
if (!b) continue;
|
|
52263
52068
|
const f = floatSpan(b.seg, y + c.marginT);
|
|
52264
|
-
if (_optionalChain([f, 'optionalAccess',
|
|
52069
|
+
if (_optionalChain([f, 'optionalAccess', _1249 => _1249.el]) && f.pages > 0 && f.pages > lead && Math.abs(contTop + c.marginT + b.top - b.origin - f.endY) < 3e3) {
|
|
52265
52070
|
lead = f.pages;
|
|
52266
52071
|
place = /* @__PURE__ */ new Map([[f.el, y + c.marginT]]);
|
|
52267
52072
|
led.add(b.seg);
|
|
@@ -52278,8 +52083,8 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52278
52083
|
for (const c of rowCells) {
|
|
52279
52084
|
const bs = _nullishCoalesce(boxes.get(c.el), () => ( []));
|
|
52280
52085
|
const inK = bs.filter((b) => b.part === k), next = bs.find((b) => b.part > k);
|
|
52281
|
-
const from = _nullishCoalesce(_nullishCoalesce(_optionalChain([inK, 'access',
|
|
52282
|
-
range.set(c.el, [from, _nullishCoalesce(_optionalChain([next, 'optionalAccess',
|
|
52086
|
+
const from = _nullishCoalesce(_nullishCoalesce(_optionalChain([inK, 'access', _1250 => _1250[0], 'optionalAccess', _1251 => _1251.origin]), () => ( _optionalChain([next, 'optionalAccess', _1252 => _1252.origin]))), () => ( Number.POSITIVE_INFINITY));
|
|
52087
|
+
range.set(c.el, [from, _nullishCoalesce(_optionalChain([next, 'optionalAccess', _1253 => _1253.top]), () => ( Number.POSITIVE_INFINITY))]);
|
|
52283
52088
|
if (inK.length) ext = Math.max(ext, inK[inK.length - 1].bottom - from + c.marginT + c.marginB);
|
|
52284
52089
|
if (inK.length && next) toNext = Math.max(toNext, next.top - from + c.marginT + c.marginB);
|
|
52285
52090
|
}
|
|
@@ -52290,7 +52095,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52290
52095
|
if (!last) {
|
|
52291
52096
|
let span2 = 0, spanEnd = 0;
|
|
52292
52097
|
if (floatSpan) for (const c of rowCells) {
|
|
52293
|
-
const bs = (_nullishCoalesce(boxes.get(c.el), () => ( []))).filter((b) => b.part === k), from = _nullishCoalesce(_optionalChain([bs, 'access',
|
|
52098
|
+
const bs = (_nullishCoalesce(boxes.get(c.el), () => ( []))).filter((b) => b.part === k), from = _nullishCoalesce(_optionalChain([bs, 'access', _1254 => _1254[0], 'optionalAccess', _1255 => _1255.origin]), () => ( 0));
|
|
52294
52099
|
for (const b of bs) {
|
|
52295
52100
|
if (led.has(b.seg)) continue;
|
|
52296
52101
|
const f = floatSpan(b.seg, y + c.marginT + b.top - from);
|
|
@@ -52455,7 +52260,7 @@ function objectGeometry(el, x, y, w, h, boxW = w, boxH = h) {
|
|
|
52455
52260
|
function shapeFill(el, defs, images, warn) {
|
|
52456
52261
|
const brush = findChildByLocalName(el, "fillBrush");
|
|
52457
52262
|
const win = brush && findChildByLocalName(brush, "winBrush");
|
|
52458
|
-
const face = _optionalChain([win, 'optionalAccess',
|
|
52263
|
+
const face = _optionalChain([win, 'optionalAccess', _1256 => _1256.getAttribute, 'call', _1257 => _1257("faceColor")]);
|
|
52459
52264
|
if (docColor(face)) return esc(face);
|
|
52460
52265
|
const grad = brush && findChildByLocalName(brush, "gradation");
|
|
52461
52266
|
if (grad) {
|
|
@@ -52506,8 +52311,8 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
|
|
|
52506
52311
|
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);
|
|
52507
52312
|
const { x, y } = geometry;
|
|
52508
52313
|
const sx = ow > 0 ? w / ow : 1, sy = oh > 0 ? h / oh : 1;
|
|
52509
|
-
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52510
|
-
const color = esc(docColor(_optionalChain([line, 'optionalAccess',
|
|
52314
|
+
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1258 => _1258.getAttribute, 'call', _1259 => _1259("style")]), () => ( "SOLID"));
|
|
52315
|
+
const color = esc(docColor(_optionalChain([line, 'optionalAccess', _1260 => _1260.getAttribute, 'call', _1261 => _1261("color")]), "#000000"));
|
|
52511
52316
|
const strokeW = style === "NONE" ? 0 : Math.max(0.2, num2(line, "width", 33) / 100 * 2.834645);
|
|
52512
52317
|
const dash = /DASH|DOT/.test(style) ? ` stroke-dasharray="${style.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
52513
52318
|
const keepWidth = local ? ` vector-effect="non-scaling-stroke"` : "";
|
|
@@ -52539,6 +52344,205 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
|
|
|
52539
52344
|
return { ...geometry, svg };
|
|
52540
52345
|
}
|
|
52541
52346
|
|
|
52347
|
+
// src/render/equation-text.ts
|
|
52348
|
+
var SYMBOLS = {
|
|
52349
|
+
alpha: "\u03B1",
|
|
52350
|
+
beta: "\u03B2",
|
|
52351
|
+
gamma: "\u03B3",
|
|
52352
|
+
delta: "\u03B4",
|
|
52353
|
+
epsilon: "\u03B5",
|
|
52354
|
+
varepsilon: "\u03B5",
|
|
52355
|
+
zeta: "\u03B6",
|
|
52356
|
+
eta: "\u03B7",
|
|
52357
|
+
theta: "\u03B8",
|
|
52358
|
+
vartheta: "\u03D1",
|
|
52359
|
+
iota: "\u03B9",
|
|
52360
|
+
kappa: "\u03BA",
|
|
52361
|
+
lambda: "\u03BB",
|
|
52362
|
+
mu: "\u03BC",
|
|
52363
|
+
nu: "\u03BD",
|
|
52364
|
+
xi: "\u03BE",
|
|
52365
|
+
pi: "\u03C0",
|
|
52366
|
+
rho: "\u03C1",
|
|
52367
|
+
sigma: "\u03C3",
|
|
52368
|
+
tau: "\u03C4",
|
|
52369
|
+
upsilon: "\u03C5",
|
|
52370
|
+
phi: "\u03C6",
|
|
52371
|
+
varphi: "\u03C6",
|
|
52372
|
+
chi: "\u03C7",
|
|
52373
|
+
psi: "\u03C8",
|
|
52374
|
+
omega: "\u03C9",
|
|
52375
|
+
Gamma: "\u0393",
|
|
52376
|
+
Delta: "\u0394",
|
|
52377
|
+
Theta: "\u0398",
|
|
52378
|
+
Lambda: "\u039B",
|
|
52379
|
+
Xi: "\u039E",
|
|
52380
|
+
Pi: "\u03A0",
|
|
52381
|
+
Sigma: "\u03A3",
|
|
52382
|
+
Phi: "\u03A6",
|
|
52383
|
+
Psi: "\u03A8",
|
|
52384
|
+
Omega: "\u03A9",
|
|
52385
|
+
times: "\xD7",
|
|
52386
|
+
cdot: "\xB7",
|
|
52387
|
+
div: "\xF7",
|
|
52388
|
+
pm: "\xB1",
|
|
52389
|
+
mp: "\u2213",
|
|
52390
|
+
le: "\u2264",
|
|
52391
|
+
leq: "\u2264",
|
|
52392
|
+
ge: "\u2265",
|
|
52393
|
+
geq: "\u2265",
|
|
52394
|
+
ne: "\u2260",
|
|
52395
|
+
neq: "\u2260",
|
|
52396
|
+
approx: "\u2248",
|
|
52397
|
+
equiv: "\u2261",
|
|
52398
|
+
sim: "\u223C",
|
|
52399
|
+
infty: "\u221E",
|
|
52400
|
+
rightarrow: "\u2192",
|
|
52401
|
+
leftarrow: "\u2190",
|
|
52402
|
+
Rightarrow: "\u21D2",
|
|
52403
|
+
Leftarrow: "\u21D0",
|
|
52404
|
+
leftrightarrow: "\u2194",
|
|
52405
|
+
Leftrightarrow: "\u21D4",
|
|
52406
|
+
to: "\u2192",
|
|
52407
|
+
angle: "\u2220",
|
|
52408
|
+
triangle: "\u25B3",
|
|
52409
|
+
perp: "\u22A5",
|
|
52410
|
+
parallel: "\u2225",
|
|
52411
|
+
circ: "\u2218",
|
|
52412
|
+
degree: "\xB0",
|
|
52413
|
+
sum: "\u03A3",
|
|
52414
|
+
prod: "\u03A0",
|
|
52415
|
+
int: "\u222B",
|
|
52416
|
+
oint: "\u222E",
|
|
52417
|
+
partial: "\u2202",
|
|
52418
|
+
nabla: "\u2207",
|
|
52419
|
+
in: "\u2208",
|
|
52420
|
+
notin: "\u2209",
|
|
52421
|
+
subset: "\u2282",
|
|
52422
|
+
supset: "\u2283",
|
|
52423
|
+
subseteq: "\u2286",
|
|
52424
|
+
supseteq: "\u2287",
|
|
52425
|
+
cup: "\u222A",
|
|
52426
|
+
cap: "\u2229",
|
|
52427
|
+
emptyset: "\u2205",
|
|
52428
|
+
forall: "\u2200",
|
|
52429
|
+
exists: "\u2203",
|
|
52430
|
+
therefore: "\u2234",
|
|
52431
|
+
because: "\u2235",
|
|
52432
|
+
prime: "\u2032",
|
|
52433
|
+
cdots: "\u22EF",
|
|
52434
|
+
ldots: "\u2026",
|
|
52435
|
+
dots: "\u2026",
|
|
52436
|
+
vdots: "\u22EE",
|
|
52437
|
+
lim: "lim",
|
|
52438
|
+
log: "log",
|
|
52439
|
+
ln: "ln",
|
|
52440
|
+
sin: "sin",
|
|
52441
|
+
cos: "cos",
|
|
52442
|
+
tan: "tan",
|
|
52443
|
+
sec: "sec",
|
|
52444
|
+
csc: "csc",
|
|
52445
|
+
cot: "cot",
|
|
52446
|
+
exp: "exp",
|
|
52447
|
+
max: "max",
|
|
52448
|
+
min: "min",
|
|
52449
|
+
quad: " ",
|
|
52450
|
+
qquad: " ",
|
|
52451
|
+
",": " ",
|
|
52452
|
+
";": " ",
|
|
52453
|
+
"!": "",
|
|
52454
|
+
"{": "{",
|
|
52455
|
+
"}": "}",
|
|
52456
|
+
"|": "\u2016",
|
|
52457
|
+
backslash: "\\",
|
|
52458
|
+
lbrace: "{",
|
|
52459
|
+
rbrace: "}",
|
|
52460
|
+
langle: "\u27E8",
|
|
52461
|
+
rangle: "\u27E9"
|
|
52462
|
+
};
|
|
52463
|
+
var SUP = { "0": "\u2070", "1": "\xB9", "2": "\xB2", "3": "\xB3", "4": "\u2074", "5": "\u2075", "6": "\u2076", "7": "\u2077", "8": "\u2078", "9": "\u2079", "+": "\u207A", "-": "\u207B", "=": "\u207C", "(": "\u207D", ")": "\u207E", n: "\u207F", i: "\u2071", x: "\u02E3", "\u2032": "\u2032" };
|
|
52464
|
+
var SUB = { "0": "\u2080", "1": "\u2081", "2": "\u2082", "3": "\u2083", "4": "\u2084", "5": "\u2085", "6": "\u2086", "7": "\u2087", "8": "\u2088", "9": "\u2089", "+": "\u208A", "-": "\u208B", "=": "\u208C", "(": "\u208D", ")": "\u208E" };
|
|
52465
|
+
function latexToPlain(latex) {
|
|
52466
|
+
let i = 0;
|
|
52467
|
+
const s = latex;
|
|
52468
|
+
const skipWs = () => {
|
|
52469
|
+
while (i < s.length && s[i] === " ") i++;
|
|
52470
|
+
};
|
|
52471
|
+
const arg = () => {
|
|
52472
|
+
skipWs();
|
|
52473
|
+
if (s[i] === "{") {
|
|
52474
|
+
i++;
|
|
52475
|
+
const v = seq("}");
|
|
52476
|
+
i++;
|
|
52477
|
+
return v;
|
|
52478
|
+
}
|
|
52479
|
+
return atom();
|
|
52480
|
+
};
|
|
52481
|
+
const wrap = (v) => v.length > 1 && !/^[\w.′]+$|^\(.*\)$/u.test(v) ? `(${v})` : v;
|
|
52482
|
+
const script = (v, map, mark) => {
|
|
52483
|
+
const t = v.trim();
|
|
52484
|
+
return [...t].every((c) => map[c]) ? [...t].map((c) => map[c]).join("") : `${mark}${wrap(t)}`;
|
|
52485
|
+
};
|
|
52486
|
+
const atom = () => {
|
|
52487
|
+
const c = s[i];
|
|
52488
|
+
if (c === void 0) return "";
|
|
52489
|
+
if (c === "\\") {
|
|
52490
|
+
i++;
|
|
52491
|
+
let name = "";
|
|
52492
|
+
if (/[A-Za-z]/.test(_nullishCoalesce(s[i], () => ( "")))) while (/[A-Za-z]/.test(_nullishCoalesce(s[i], () => ( "")))) name += s[i++];
|
|
52493
|
+
else name = _nullishCoalesce(s[i++], () => ( ""));
|
|
52494
|
+
if (name === "frac") {
|
|
52495
|
+
const a = arg(), b = arg();
|
|
52496
|
+
return `${wrap(a.trim())}/${wrap(b.trim())}`;
|
|
52497
|
+
}
|
|
52498
|
+
if (name === "sqrt") {
|
|
52499
|
+
skipWs();
|
|
52500
|
+
let root = "";
|
|
52501
|
+
if (s[i] === "[") {
|
|
52502
|
+
i++;
|
|
52503
|
+
root = seq("]");
|
|
52504
|
+
i++;
|
|
52505
|
+
}
|
|
52506
|
+
const a = arg();
|
|
52507
|
+
return `${root ? script(root, SUP, "") : ""}\u221A${wrap(a.trim())}`;
|
|
52508
|
+
}
|
|
52509
|
+
if (name === "left" || name === "right" || name === "big" || name === "Big" || name === "bigg" || name === "Bigg") {
|
|
52510
|
+
skipWs();
|
|
52511
|
+
const d = s[i] === "\\" ? atom() : _nullishCoalesce(s[i++], () => ( ""));
|
|
52512
|
+
return d === "." ? "" : d;
|
|
52513
|
+
}
|
|
52514
|
+
if (name === "overline" || name === "bar" || name === "hat" || name === "vec" || name === "dot" || name === "tilde") {
|
|
52515
|
+
const a = arg().trim(), mark = { overline: "\u0305", bar: "\u0304", hat: "\u0302", vec: "\u20D7", dot: "\u0307", tilde: "\u0303" }[name];
|
|
52516
|
+
return [...a].map((ch) => ch + mark).join("");
|
|
52517
|
+
}
|
|
52518
|
+
if (name === "mathrm" || name === "text" || name === "rm" || name === "mathbf" || name === "it" || name === "mathit" || name === "operatorname") return name === "rm" || name === "it" ? "" : arg();
|
|
52519
|
+
return _nullishCoalesce(SYMBOLS[name], () => ( name));
|
|
52520
|
+
}
|
|
52521
|
+
i++;
|
|
52522
|
+
if (c === "{") {
|
|
52523
|
+
const v = seq("}");
|
|
52524
|
+
i++;
|
|
52525
|
+
return v;
|
|
52526
|
+
}
|
|
52527
|
+
if (c === "^") return script(arg(), SUP, "^");
|
|
52528
|
+
if (c === "_") return script(arg(), SUB, "_");
|
|
52529
|
+
if (c === "~" || c === "`") return " ";
|
|
52530
|
+
return c;
|
|
52531
|
+
};
|
|
52532
|
+
const seq = (end) => {
|
|
52533
|
+
let out = "";
|
|
52534
|
+
while (i < s.length && s[i] !== end) {
|
|
52535
|
+
if (s[i] === " ") {
|
|
52536
|
+
i++;
|
|
52537
|
+
continue;
|
|
52538
|
+
}
|
|
52539
|
+
out += atom();
|
|
52540
|
+
}
|
|
52541
|
+
return out;
|
|
52542
|
+
};
|
|
52543
|
+
return seq("\0").replace(/\s+/g, " ").trim();
|
|
52544
|
+
}
|
|
52545
|
+
|
|
52542
52546
|
// src/render/object-anchor.ts
|
|
52543
52547
|
function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, laterLineH) {
|
|
52544
52548
|
const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
|
|
@@ -52575,14 +52579,14 @@ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = fals
|
|
|
52575
52579
|
if (hrel === "PAGE") {
|
|
52576
52580
|
x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
|
|
52577
52581
|
} else if (hrel === "PAPER") {
|
|
52578
|
-
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (_nullishCoalesce(_optionalChain([ctx, 'access',
|
|
52582
|
+
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (_nullishCoalesce(_optionalChain([ctx, 'access', _1262 => _1262.bodyDx, 'optionalCall', _1263 => _1263(ctx.page)]), () => ( 0)));
|
|
52579
52583
|
} else {
|
|
52580
52584
|
x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
|
|
52581
52585
|
}
|
|
52582
52586
|
return { x, y };
|
|
52583
52587
|
}
|
|
52584
52588
|
|
|
52585
|
-
// src/render/svg-
|
|
52589
|
+
// src/render/svg-content.ts
|
|
52586
52590
|
function escapeXml7(s) {
|
|
52587
52591
|
return s.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
52588
52592
|
}
|
|
@@ -52629,18 +52633,19 @@ function planLines(m, styles, numText = "") {
|
|
|
52629
52633
|
const align = _nullishCoalesce((m.paraPrId != null ? styles.paraAlign.get(m.paraPrId) : void 0), () => ( "JUSTIFY"));
|
|
52630
52634
|
const geom = m.paraPrId != null ? styles.paraGeom.get(m.paraPrId) : void 0;
|
|
52631
52635
|
const hang = geom && geom.marginIntent < 0 ? -geom.marginIntent : 0;
|
|
52632
|
-
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
52633
|
-
const firstPr = _nullishCoalesce(_optionalChain([m, 'access',
|
|
52634
|
-
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess',
|
|
52635
|
-
const
|
|
52636
|
+
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1264 => _1264.bullet]), () => ( (numText && _optionalChain([geom, 'optionalAccess', _1265 => _1265.number]) ? { ch: numText, ...geom.number } : void 0)));
|
|
52637
|
+
const firstPr = _nullishCoalesce(_optionalChain([m, 'access', _1266 => _1266.chars, 'access', _1267 => _1267.find, 'call', _1268 => _1268((c) => c.ch !== ""), 'optionalAccess', _1269 => _1269.prId]), () => ( null));
|
|
52638
|
+
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess', _1270 => _1270.charPrId]) != null ? styles.charPr.get(bu.charPrId) : firstPr != null ? styles.charPr.get(firstPr) : void 0), () => ( DEFAULT_CHAR));
|
|
52639
|
+
const headW = _optionalChain([bu, 'optionalAccess', _1271 => _1271.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;
|
|
52640
|
+
const bulletW = bu ? paraHeadAdvance(bu, bst.height, headW) : 0;
|
|
52636
52641
|
const plans = [];
|
|
52637
52642
|
for (let i = 0; i < m.segs.length; i++) {
|
|
52638
52643
|
const seg = m.segs[i];
|
|
52639
52644
|
const start = seg.textpos;
|
|
52640
52645
|
const end = i + 1 < m.segs.length ? m.segs[i + 1].textpos : Math.max(m.chars.length, start);
|
|
52641
52646
|
const tabs = /* @__PURE__ */ new Map();
|
|
52642
|
-
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
52643
|
-
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
52647
|
+
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1272 => _1272.marginIntent]), () => ( 0)), 0) + bulletW : hang + (_optionalChain([bu, 'optionalAccess', _1273 => _1273.autoIndent]) ? bulletW : 0);
|
|
52648
|
+
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1274 => _1274.marginIntent]), () => ( 0)), 0) : hang) + (i === 0 || _optionalChain([bu, 'optionalAccess', _1275 => _1275.autoIndent]) ? bulletW : 0);
|
|
52644
52649
|
let fixedTo = start;
|
|
52645
52650
|
let fixedW = 0;
|
|
52646
52651
|
for (let k = start; k < end && k < m.chars.length; k++) {
|
|
@@ -52736,7 +52741,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52736
52741
|
let i = plan.start;
|
|
52737
52742
|
let cursor = ox + seg.horzpos + plan.xoff;
|
|
52738
52743
|
const y = oy + seg.vertpos + seg.baseline;
|
|
52739
|
-
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access',
|
|
52744
|
+
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access', _1276 => _1276.styles, 'access', _1277 => _1277.paraGeom, 'access', _1278 => _1278.get, 'call', _1279 => _1279(m.paraPrId), 'optionalAccess', _1280 => _1280.vertAlign]) : void 0;
|
|
52740
52745
|
const glyphY = (h) => y + (pva === "CENTER" ? Math.round(h * 0.35) : pva === "BOTTOM" ? -Math.round(h * 0.15) : 0);
|
|
52741
52746
|
if (plan.bullet) {
|
|
52742
52747
|
const bs = _nullishCoalesce((plan.bullet.prId != null ? ctx.styles.charPr.get(plan.bullet.prId) : void 0), () => ( DEFAULT_CHAR));
|
|
@@ -52821,7 +52826,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52821
52826
|
if (st.italic) attrs.push(`font-style="italic"`);
|
|
52822
52827
|
if (st.underline) attrs.push(`text-decoration="underline"`);
|
|
52823
52828
|
if (st.color) attrs.push(`fill="${escapeXml7(st.color)}"`);
|
|
52824
|
-
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(
|
|
52829
|
+
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(_chunkYG4GFQB7cjs.mapPuaText.call(void 0, text))}</text>`);
|
|
52825
52830
|
ctx.stats.texts++;
|
|
52826
52831
|
}
|
|
52827
52832
|
return sw;
|
|
@@ -52890,26 +52895,26 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52890
52895
|
anchorLineH = pl.seg.textheight;
|
|
52891
52896
|
}
|
|
52892
52897
|
let objBaseV = baseV;
|
|
52893
|
-
const pTop = depth === 0 ? _optionalChain([ctx, 'access',
|
|
52898
|
+
const pTop = depth === 0 ? _optionalChain([ctx, 'access', _1281 => _1281.paraTops, 'optionalAccess', _1282 => _1282.get, 'call', _1283 => _1283(p)]) : void 0;
|
|
52894
52899
|
const wrapA = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
52895
52900
|
const top0 = _nullishCoalesce(pTop, () => ( (depth > 0 && wrapA !== "TOP_AND_BOTTOM" ? cellParaTop(p, ctx.styles.paraGeom) : void 0)));
|
|
52896
52901
|
if (top0 !== void 0 && wrapA !== "TOP_AND_BOTTOM") {
|
|
52897
|
-
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
52902
|
+
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1284 => _1284.styles, 'access', _1285 => _1285.paraGeom, 'access', _1286 => _1286.get, 'call', _1287 => _1287(m.paraPrId), 'optionalAccess', _1288 => _1288.spaceBefore]), () => ( 0)) : 0);
|
|
52898
52903
|
if (baseV > start + 100) {
|
|
52899
52904
|
objBaseV = start;
|
|
52900
52905
|
if (anchorLineV === baseV) anchorLineV = start;
|
|
52901
52906
|
}
|
|
52902
52907
|
}
|
|
52903
|
-
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
52908
|
+
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1289 => _1289(q.el, "pos"), 'optionalAccess', _1290 => _1290.getAttribute, 'call', _1291 => _1291("vertRelTo")]), () => ( "PARA"))) === "PARA").length;
|
|
52904
52909
|
const stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
52905
|
-
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
52910
|
+
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1292 => _1292.styles, 'access', _1293 => _1293.paraGeom, 'access', _1294 => _1294.get, 'call', _1295 => _1295(m.paraPrId), 'optionalAccess', _1296 => _1296.spaceBefore]), () => ( 0)) : 0;
|
|
52906
52911
|
const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
|
|
52907
52912
|
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);
|
|
52908
52913
|
if (depth === 0 && tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM") {
|
|
52909
52914
|
if (!tbStack) {
|
|
52910
52915
|
tbStack = /* @__PURE__ */ new Map();
|
|
52911
52916
|
let below = 0;
|
|
52912
|
-
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
52917
|
+
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1297 => _1297(q.el, "pos"), 'optionalAccess', _1298 => _1298.getAttribute, 'call', _1299 => _1299("vertRelTo")]), () => ( "PARA"))) === "PARA" && _optionalChain([findChildByLocalName, 'call', _1300 => _1300(q.el, "pos"), 'optionalAccess', _1301 => _1301.getAttribute, 'call', _1302 => _1302("allowOverlap")]) !== "1");
|
|
52913
52918
|
for (const q of stackable.length >= 2 ? stackable.sort((a, b) => a.index - b.index) : []) {
|
|
52914
52919
|
const omQ = findChildByLocalName(q.el, "outMargin"), raw = num2(findChildByLocalName(q.el, "pos"), "vertOffset");
|
|
52915
52920
|
const top = Math.max(below, raw >= 2 ** 31 ? raw - 2 ** 32 : raw);
|
|
@@ -52920,7 +52925,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52920
52925
|
const st = tbStack.get(o.el);
|
|
52921
52926
|
if (st !== void 0) y = oy + (_nullishCoalesce(pTop, () => ( 0))) + st;
|
|
52922
52927
|
}
|
|
52923
|
-
const moved = _optionalChain([ctx, 'access',
|
|
52928
|
+
const moved = _optionalChain([ctx, 'access', _1303 => _1303.objPlace, 'optionalAccess', _1304 => _1304.get, 'call', _1305 => _1305(o.el)]);
|
|
52924
52929
|
if (moved) {
|
|
52925
52930
|
const pg = ctx.page;
|
|
52926
52931
|
ctx.page = moved.page;
|
|
@@ -52939,7 +52944,7 @@ function cellParaTop(p, geom) {
|
|
|
52939
52944
|
const segs = lsa ? elements(lsa).filter((e) => ln(e) === "lineseg") : [];
|
|
52940
52945
|
if (!segs.length) return void 0;
|
|
52941
52946
|
const last = segs[segs.length - 1];
|
|
52942
|
-
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access',
|
|
52947
|
+
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access', _1306 => _1306.get, 'call', _1307 => _1307(_nullishCoalesce(prev.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1308 => _1308.spaceAfter]), () => ( 0)));
|
|
52943
52948
|
}
|
|
52944
52949
|
function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
52945
52950
|
if (!o.inline && depth === 0 && ctx.paintJobs) {
|
|
@@ -52967,8 +52972,8 @@ function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
|
52967
52972
|
x = ox;
|
|
52968
52973
|
y = oy;
|
|
52969
52974
|
}
|
|
52970
|
-
if (o.tag === "tbl")
|
|
52971
|
-
else if (o.tag === "pic")
|
|
52975
|
+
if (o.tag === "tbl") ctx.draw.table(o.el, x, y, ctx, depth + 1);
|
|
52976
|
+
else if (o.tag === "pic") ctx.draw.pic(o.el, x, y, ctx);
|
|
52972
52977
|
else if (o.tag === "container") {
|
|
52973
52978
|
if (drawGroupByMatrix(o, x, y, baseV, areaW, ctx, depth)) return;
|
|
52974
52979
|
for (const ch of elements(o.el)) {
|
|
@@ -52980,7 +52985,7 @@ function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
|
52980
52985
|
drawObject(sub, x + num2(off, "x"), y + num2(off, "y"), baseV, areaW, ctx, depth + 1);
|
|
52981
52986
|
}
|
|
52982
52987
|
} else if (o.tag === "equation") {
|
|
52983
|
-
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
52988
|
+
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1309 => _1309(o.el, "script"), 'optionalAccess', _1310 => _1310.textContent]), () => ( ""));
|
|
52984
52989
|
const text = script ? latexToPlain(hwpEquationToLatex(script)) : "";
|
|
52985
52990
|
if (text && o.width > 0) {
|
|
52986
52991
|
const bl = Number(o.el.getAttribute("baseLine")), size = num2(o.el, "baseUnit", 1e3);
|
|
@@ -53024,7 +53029,7 @@ function drawGroupByMatrix(o, x, y, baseV, areaW, ctx, depth) {
|
|
|
53024
53029
|
ctx.regionRotations.push(m);
|
|
53025
53030
|
emit(ctx, `<g transform="matrix(${m.slice(0, 4).map((v) => Math.round(v * 1e6) / 1e6).join(" ")} ${pt2(m[4])} ${pt2(m[5])})">`);
|
|
53026
53031
|
const sub = { el: leaf, tag, index: 0, inline: true, width: w, height: h, omL: 0, omR: 0 };
|
|
53027
|
-
if (tag === "pic")
|
|
53032
|
+
if (tag === "pic") ctx.draw.picFrame(leaf, 0, 0, w, h, "", ctx);
|
|
53028
53033
|
else if (SHAPE_TAGS.has(tag)) drawShape(sub, 0, 0, ctx, depth + 1, [Math.hypot(m[0], m[1]) || 1, Math.hypot(m[2], m[3]) || 1]);
|
|
53029
53034
|
else drawObject(sub, 0, 0, baseV, areaW, ctx, depth + 1);
|
|
53030
53035
|
emit(ctx, "</g>");
|
|
@@ -53072,6 +53077,8 @@ function drawShape(o, x, y, ctx, depth, groupScale) {
|
|
|
53072
53077
|
ctx.parentStack.pop();
|
|
53073
53078
|
emit(ctx, "</g>");
|
|
53074
53079
|
}
|
|
53080
|
+
|
|
53081
|
+
// src/render/svg-render.ts
|
|
53075
53082
|
function edgeLine(x1, y1, x2, y2, e) {
|
|
53076
53083
|
const dash = /DASH|DOT/.test(e.type) ? ` stroke-dasharray="${e.type.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
53077
53084
|
return `<line x1="${pt2(x1)}" y1="${pt2(y1)}" x2="${pt2(x2)}" y2="${pt2(y2)}" stroke="${escapeXml7(e.color)}" stroke-width="${e.widthPt.toFixed(2)}"${dash}/>`;
|
|
@@ -53083,7 +53090,7 @@ function tableContPages(tbl2, ty, MT, BODY_H, memo, slack = 0, floatSpan, nested
|
|
|
53083
53090
|
}
|
|
53084
53091
|
function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
53085
53092
|
return (seg, top) => {
|
|
53086
|
-
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess',
|
|
53093
|
+
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess', _1311 => _1311.parentNode]);
|
|
53087
53094
|
if (!p || ln(p) !== "p") return void 0;
|
|
53088
53095
|
const segs = elements(lsa).filter((e) => ln(e) === "lineseg"), k = segs.indexOf(seg);
|
|
53089
53096
|
const m = buildPara(p);
|
|
@@ -53091,10 +53098,10 @@ function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
|
53091
53098
|
for (const o of m.objs) {
|
|
53092
53099
|
if (o.tag !== "tbl" || o.inline) continue;
|
|
53093
53100
|
const pos = findChildByLocalName(o.el, "pos");
|
|
53094
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53101
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1312 => _1312.getAttribute, 'call', _1313 => _1313("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
53095
53102
|
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)));
|
|
53096
53103
|
if (segK !== k) continue;
|
|
53097
|
-
const ty = top + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53104
|
+
const ty = top + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1314 => _1314.getAttribute, 'call', _1315 => _1315("vertOffset")]), () => ( void 0)), 0));
|
|
53098
53105
|
const span2 = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true);
|
|
53099
53106
|
if (span2.pages > 0 && (!best || span2.pages > best.pages)) best = { ...span2, el: o.el };
|
|
53100
53107
|
}
|
|
@@ -53126,7 +53133,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53126
53133
|
let hdrRows = 0;
|
|
53127
53134
|
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++;
|
|
53128
53135
|
const slack = ctx.geom.PH - ctx.geom.MT - ctx.geom.BODY_H;
|
|
53129
|
-
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call',
|
|
53136
|
+
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call', _1316 => _1316(tbl2, "pos"), 'optionalAccess', _1317 => _1317.getAttribute, 'call', _1318 => _1318("treatAsChar")]) !== "1";
|
|
53130
53137
|
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) : rowH.map((h, r) => [{ page: 0, y: ty + rowY[r], h }]);
|
|
53131
53138
|
const splitSaved = ctx.splitCell;
|
|
53132
53139
|
ctx.splitCell = false;
|
|
@@ -53148,7 +53155,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53148
53155
|
for (const g3 of geom) {
|
|
53149
53156
|
ctx.page = g3.page;
|
|
53150
53157
|
const bf = g3.c.bfId != null ? ctx.styles.borderFill.get(g3.c.bfId) : void 0;
|
|
53151
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
53158
|
+
if (_optionalChain([bf, 'optionalAccess', _1319 => _1319.fill])) emit(ctx, `<rect x="${pt2(g3.x)}" y="${pt2(g3.y)}" width="${pt2(g3.w)}" height="${pt2(g3.h)}" fill="${escapeXml7(bf.fill)}"/>`);
|
|
53152
53159
|
}
|
|
53153
53160
|
for (const g3 of geom) {
|
|
53154
53161
|
const { c } = g3;
|
|
@@ -53159,13 +53166,13 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53159
53166
|
const boxes = cellLineBoxes(c);
|
|
53160
53167
|
const contV = new Map(boxes.map((b) => [b.seg, b.top]));
|
|
53161
53168
|
const pieceOf = (v) => Math.max(0, g3.pieces.findIndex((pc) => {
|
|
53162
|
-
const r = _optionalChain([pc, 'access',
|
|
53169
|
+
const r = _optionalChain([pc, 'access', _1320 => _1320.range, 'optionalAccess', _1321 => _1321.get, 'call', _1322 => _1322(c.el)]);
|
|
53163
53170
|
return !!r && v >= r[0] && v < r[1];
|
|
53164
53171
|
}));
|
|
53165
53172
|
const va2 = _nullishCoalesce(c.sub.getAttribute("vertAlign"), () => ( "TOP"));
|
|
53166
53173
|
const pieceOff = g3.pieces.map((pc, k) => {
|
|
53167
53174
|
if (va2 === "TOP") return 0;
|
|
53168
|
-
const from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
53175
|
+
const from = _nullishCoalesce(_optionalChain([pc, 'access', _1323 => _1323.range, 'optionalAccess', _1324 => _1324.get, 'call', _1325 => _1325(c.el), 'optionalAccess', _1326 => _1326[0]]), () => ( 0));
|
|
53169
53176
|
const bottoms = boxes.filter((b) => pieceOf(b.top) === k).map((b) => b.bottom - from);
|
|
53170
53177
|
if (!bottoms.length) return 0;
|
|
53171
53178
|
const free = pc.h - c.marginT - c.marginB - Math.max(...bottoms);
|
|
@@ -53178,7 +53185,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53178
53185
|
const pages = segs.map((sg) => {
|
|
53179
53186
|
const v = _nullishCoalesce(contV.get(sg), () => ( num2(sg, "vertpos")));
|
|
53180
53187
|
const k = pieceOf(v);
|
|
53181
|
-
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
53188
|
+
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access', _1327 => _1327.range, 'optionalAccess', _1328 => _1328.get, 'call', _1329 => _1329(c.el), 'optionalAccess', _1330 => _1330[0]]), () => ( 0));
|
|
53182
53189
|
sg.setAttribute("vertpos", String(v - from + pc.y + c.marginT + pieceOff[k] - base));
|
|
53183
53190
|
return startPage + pc.page;
|
|
53184
53191
|
});
|
|
@@ -53270,7 +53277,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
53270
53277
|
}
|
|
53271
53278
|
function drawPicFrame(pic, x, y, w, h, transform, ctx) {
|
|
53272
53279
|
const img = findFirst(pic, "img");
|
|
53273
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
53280
|
+
const ref = _optionalChain([img, 'optionalAccess', _1331 => _1331.getAttribute, 'call', _1332 => _1332("binaryItemIDRef")]);
|
|
53274
53281
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
53275
53282
|
const imgId = ctx.regions.add("image", bboxOf(ctx, x, y, w, h), { sourceId: _nullishCoalesce(ref, () => ( void 0)), parentId: parentId(ctx) });
|
|
53276
53283
|
emit(ctx, regionOpenTag(imgId, "image", pageNo(ctx)));
|
|
@@ -53316,12 +53323,12 @@ function readSectionGeom(root) {
|
|
|
53316
53323
|
const pagePr = findFirst(root, "pagePr");
|
|
53317
53324
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
53318
53325
|
let PW = num2(pagePr, "width", 59528), PH = num2(pagePr, "height", 84188);
|
|
53319
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
53326
|
+
if (_optionalChain([pagePr, 'optionalAccess', _1333 => _1333.getAttribute, 'call', _1334 => _1334("landscape")]) === "NARROWLY" && PW < PH) {
|
|
53320
53327
|
const t = PW;
|
|
53321
53328
|
PW = PH;
|
|
53322
53329
|
PH = t;
|
|
53323
53330
|
}
|
|
53324
|
-
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess',
|
|
53331
|
+
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess', _1335 => _1335.getAttribute, 'call', _1336 => _1336("gutterType")]), () => ( "LEFT_ONLY")), gutter = num2(margin, "gutter", 0);
|
|
53325
53332
|
const gL = gutterType === "TOP_BOTTOM" ? 0 : gutter, gT = gutterType === "TOP_BOTTOM" ? gutter : 0;
|
|
53326
53333
|
const ML = num2(margin, "left", 8504) + gL;
|
|
53327
53334
|
const MT = num2(margin, "top", 5668) + num2(margin, "header", 0) + gT;
|
|
@@ -53452,7 +53459,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53452
53459
|
for (const o of m0.objs) {
|
|
53453
53460
|
if (o.tag !== "tbl") continue;
|
|
53454
53461
|
const pos = findChildByLocalName(o.el, "pos"), om = findChildByLocalName(o.el, "outMargin");
|
|
53455
|
-
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53462
|
+
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1337 => _1337.getAttribute, 'call', _1338 => _1338("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
53456
53463
|
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)));
|
|
53457
53464
|
const segV = num2(segEls[segK], "vertpos");
|
|
53458
53465
|
const h = Math.max(o.height, measureTableHeight(o.el, ctxBase.extentMemo)), omT = num2(om, "top"), omB = num2(om, "bottom");
|
|
@@ -53460,9 +53467,9 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53460
53467
|
const nTb = m0.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM").length;
|
|
53461
53468
|
const stay = nTb < 2 && !m0.objs.some((q) => q.inline) && !m0.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
53462
53469
|
const wrapP = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
53463
|
-
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access',
|
|
53470
|
+
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access', _1339 => _1339.get, 'call', _1340 => _1340(m0.paraPrId), 'optionalAccess', _1341 => _1341.spaceBefore]), () => ( 0)) : 0;
|
|
53464
53471
|
const nonPush = wrapP !== "TOP_AND_BOTTOM" && pTop !== void 0 && segV > pTop + sbP + 100 ? pTop + sbP : void 0;
|
|
53465
|
-
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53472
|
+
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1342 => _1342.getAttribute, 'call', _1343 => _1343("vertOffset")]), () => ( void 0)), 0));
|
|
53466
53473
|
const paraStart = segK === 0 && pTop !== void 0 && pTop < segV ? pTop : segV;
|
|
53467
53474
|
const ty = o.inline ? MT + segV + omT : nonPush !== void 0 ? MT + nonPush + omT + voP : MT + (stay ? segV - sbP : pushed >= -100 ? pushed : paraStart) + omT + voP;
|
|
53468
53475
|
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));
|
|
@@ -53489,7 +53496,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53489
53496
|
for (const p of elements(root)) {
|
|
53490
53497
|
if (ln(p) !== "p") continue;
|
|
53491
53498
|
const pg = paraSegPages.get(p);
|
|
53492
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
53499
|
+
if (!_optionalChain([pg, 'optionalAccess', _1344 => _1344.length])) continue;
|
|
53493
53500
|
const pm = buildPara(p);
|
|
53494
53501
|
if (pm.objs.length || pm.chars.some((c) => c.ch.trim() !== "" || !!c.ctrlText)) lastContent = Math.max(lastContent, ...pg);
|
|
53495
53502
|
}
|
|
@@ -53506,7 +53513,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53506
53513
|
for (const p of elements(root)) {
|
|
53507
53514
|
if (ln(p) !== "p") continue;
|
|
53508
53515
|
const pg = paraSegPages.get(p);
|
|
53509
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
53516
|
+
if (!_optionalChain([pg, 'optionalAccess', _1345 => _1345.includes, 'call', _1346 => _1346(lastContent)])) continue;
|
|
53510
53517
|
const pm = buildPara(p);
|
|
53511
53518
|
pm.segs.forEach((sg, k) => {
|
|
53512
53519
|
if (pg[k] !== lastContent) return;
|
|
@@ -53526,7 +53533,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53526
53533
|
const ens = endNoteLayout(root, paraSegPages, geom);
|
|
53527
53534
|
const ctx = {
|
|
53528
53535
|
...ctxBase,
|
|
53529
|
-
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
53536
|
+
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1347 => _1347.pageCount]), () => ( 0))) }, () => []),
|
|
53530
53537
|
page: 0,
|
|
53531
53538
|
geom,
|
|
53532
53539
|
pageH,
|
|
@@ -53584,7 +53591,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53584
53591
|
ctx.bodyDx = void 0;
|
|
53585
53592
|
wrapMirror(ctx.pages, (page) => _nullishCoalesce(bodyStart[page], () => ( 0)));
|
|
53586
53593
|
const allPages = new Map(paraSegPages);
|
|
53587
|
-
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
53594
|
+
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1348 => _1348.paras]), () => ( []))) allPages.set(e.p, e.pages);
|
|
53588
53595
|
drawPageDecor(root, allPages, ctx, localCols ? nCol : 1, colW, colGap);
|
|
53589
53596
|
drawPageNumbers(root, paraSegPages, ctx);
|
|
53590
53597
|
ctx.page = 0;
|
|
@@ -53653,7 +53660,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
53653
53660
|
let decl;
|
|
53654
53661
|
const hidden = /* @__PURE__ */ new Set();
|
|
53655
53662
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
53656
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
53663
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1349 => _1349.get, 'call', _1350 => _1350(p), 'optionalAccess', _1351 => _1351[0]]), () => ( 0));
|
|
53657
53664
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
53658
53665
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
53659
53666
|
const pn = findChildByLocalName(ctrl, "pageNum"), ph = findChildByLocalName(ctrl, "pageHiding");
|
|
@@ -53686,6 +53693,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
53686
53693
|
}
|
|
53687
53694
|
function renderSectionRoots(sections, input) {
|
|
53688
53695
|
const ctxBase = {
|
|
53696
|
+
draw: { table: drawTable, pic: drawPic, picFrame: drawPicFrame },
|
|
53689
53697
|
styles: input.styles,
|
|
53690
53698
|
images: input.images,
|
|
53691
53699
|
defs: [],
|
|
@@ -53714,22 +53722,22 @@ function renderSectionRoots(sections, input) {
|
|
|
53714
53722
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
53715
53723
|
ctxBase.pageBase += pages.length;
|
|
53716
53724
|
}
|
|
53717
|
-
if (rendered.length === 0) throw new (0,
|
|
53725
|
+
if (rendered.length === 0) throw new (0, _chunkAS25R4EUcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
53718
53726
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
53719
53727
|
}
|
|
53720
53728
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
53721
53729
|
async function renderHwpxInternal(input, options) {
|
|
53722
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
53730
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1352 => _1352.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
53723
53731
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
53724
|
-
|
|
53732
|
+
_chunkAS25R4EUcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
53725
53733
|
let zip;
|
|
53726
53734
|
try {
|
|
53727
53735
|
zip = await _jszip2.default.loadAsync(input);
|
|
53728
53736
|
} catch (e43) {
|
|
53729
|
-
throw new (0,
|
|
53737
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
53730
53738
|
}
|
|
53731
|
-
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) =>
|
|
53732
|
-
if (secFiles.length === 0) throw new (0,
|
|
53739
|
+
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => _chunkAS25R4EUcjs.compareSectionPaths.call(void 0, a.name, b.name));
|
|
53740
|
+
if (secFiles.length === 0) throw new (0, _chunkAS25R4EUcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
53733
53741
|
const warnings = [];
|
|
53734
53742
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
53735
53743
|
const verFile = zip.file("version.xml");
|
|
@@ -53740,14 +53748,14 @@ async function renderHwpxInternal(input, options) {
|
|
|
53740
53748
|
const secXmls = [];
|
|
53741
53749
|
for (const f of secFiles) {
|
|
53742
53750
|
const xml = await readZipEntry(f, "text");
|
|
53743
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
53751
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkAS25R4EUcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
53744
53752
|
secXmls.push(xml);
|
|
53745
53753
|
}
|
|
53746
53754
|
const masterPages = /* @__PURE__ */ new Map();
|
|
53747
53755
|
const masterXmls = [];
|
|
53748
53756
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
53749
53757
|
const xml = await readZipEntry(file, "text");
|
|
53750
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
53758
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkAS25R4EUcjs.KordocError)("\uBC14\uD0D5\uCABD XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
53751
53759
|
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
53752
53760
|
if (root && ln(root) === "masterPage") {
|
|
53753
53761
|
masterPages.set(root.getAttribute("id") || file.name.replace(/^.*\/|\.xml$/g, ""), root);
|
|
@@ -53775,7 +53783,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
53775
53783
|
let href = binmap.get(ref);
|
|
53776
53784
|
if (!href) {
|
|
53777
53785
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
53778
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
53786
|
+
href = _optionalChain([cand, 'optionalAccess', _1353 => _1353.name]);
|
|
53779
53787
|
}
|
|
53780
53788
|
if (!href) continue;
|
|
53781
53789
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -53797,7 +53805,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
53797
53805
|
for (let si = 0; si < secXmls.length; si++) {
|
|
53798
53806
|
const secXml = secXmls[si];
|
|
53799
53807
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
53800
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
53808
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _1354 => _1354.reflow])) {
|
|
53801
53809
|
noCacheSkipped = true;
|
|
53802
53810
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
53803
53811
|
continue;
|
|
@@ -53814,11 +53822,11 @@ async function renderHwpxInternal(input, options) {
|
|
|
53814
53822
|
}
|
|
53815
53823
|
if (roots.length === 0) {
|
|
53816
53824
|
if (noCacheSkipped) {
|
|
53817
|
-
throw new (0,
|
|
53825
|
+
throw new (0, _chunkAS25R4EUcjs.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)");
|
|
53818
53826
|
}
|
|
53819
|
-
throw new (0,
|
|
53827
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
53820
53828
|
}
|
|
53821
|
-
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
53829
|
+
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1355 => _1355.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1356 => _1356.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1357 => _1357.highlights]) });
|
|
53822
53830
|
}
|
|
53823
53831
|
async function renderHwpxToSvg(input, options) {
|
|
53824
53832
|
const r = await renderHwpxInternal(input, options);
|
|
@@ -54041,7 +54049,7 @@ var FOLD_END = 42124;
|
|
|
54041
54049
|
var FOLD_SHIFT = 983040 - 40960;
|
|
54042
54050
|
function textChar(ch) {
|
|
54043
54051
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
54044
|
-
const mapped =
|
|
54052
|
+
const mapped = _chunkYG4GFQB7cjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
54045
54053
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
54046
54054
|
}
|
|
54047
54055
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -54133,7 +54141,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
54133
54141
|
out += run.join("") + "</hp:run>";
|
|
54134
54142
|
run = [];
|
|
54135
54143
|
};
|
|
54136
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
54144
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1358 => _1358[0], 'optionalAccess', _1359 => _1359[1]]), () => ( 0)));
|
|
54137
54145
|
let pos = 0, ctrlIdx = 0, o = 0;
|
|
54138
54146
|
const switchShape = () => {
|
|
54139
54147
|
while (shapeIdx + 1 < shapes.length && pos >= shapes[shapeIdx + 1][0]) {
|
|
@@ -54219,7 +54227,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
54219
54227
|
closeRun();
|
|
54220
54228
|
const rest = ctrls.filter((c) => !c.used && (c.id === CTRL_TBL3 || c.id === CTRL_GSO3 || c.id === CTRL_SECD2 || c.id === CTRL_COLD2));
|
|
54221
54229
|
if (rest.length > 0) {
|
|
54222
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
54230
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1360 => _1360[0], 'optionalAccess', _1361 => _1361[1]]), () => ( 0)));
|
|
54223
54231
|
for (const c of rest) {
|
|
54224
54232
|
const el = ctrlElement(ctrls.indexOf(c), c.id);
|
|
54225
54233
|
run.push(el);
|
|
@@ -54385,14 +54393,14 @@ function hwp5SectionToXml(records, ctx) {
|
|
|
54385
54393
|
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>";
|
|
54386
54394
|
}
|
|
54387
54395
|
function renderHwp5Records(docInfo, styles, secRecords, binData, options, select, warnings = []) {
|
|
54388
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
54396
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1362 => _1362.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
54389
54397
|
const MAX_TOTAL_IMAGE_BYTES = 128 * 1024 * 1024;
|
|
54390
54398
|
const images = /* @__PURE__ */ new Map();
|
|
54391
54399
|
let totalImgBytes = 0;
|
|
54392
54400
|
const imageRef = (binDataId) => {
|
|
54393
54401
|
if (binDataId <= 0) return null;
|
|
54394
|
-
const item = _optionalChain([docInfo, 'optionalAccess',
|
|
54395
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
54402
|
+
const item = _optionalChain([docInfo, 'optionalAccess', _1363 => _1363.binData, 'access', _1364 => _1364[binDataId - 1]]);
|
|
54403
|
+
if (_optionalChain([item, 'optionalAccess', _1365 => _1365.kind]) === "link") return null;
|
|
54396
54404
|
const storageId = item && item.storageId > 0 ? item.storageId : binDataId;
|
|
54397
54405
|
const ref = `bin${storageId}`;
|
|
54398
54406
|
if (images.has(ref)) return ref;
|
|
@@ -54426,8 +54434,8 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
54426
54434
|
}
|
|
54427
54435
|
roots.push({ root, index: si });
|
|
54428
54436
|
}
|
|
54429
|
-
if (roots.length === 0) throw new (0,
|
|
54430
|
-
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
54437
|
+
if (roots.length === 0) throw new (0, _chunkAS25R4EUcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
54438
|
+
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1366 => _1366.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1367 => _1367.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1368 => _1368.highlights]) });
|
|
54431
54439
|
return assemblePageSvgs(r, "hwp", select);
|
|
54432
54440
|
}
|
|
54433
54441
|
function renderHwp5Pages(input, options, select) {
|
|
@@ -54439,7 +54447,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
54439
54447
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
54440
54448
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
54441
54449
|
const sections = readHwp5SectionStreams(c);
|
|
54442
|
-
if (sections.length === 0) throw new (0,
|
|
54450
|
+
if (sections.length === 0) throw new (0, _chunkAS25R4EUcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
54443
54451
|
const parseWarnings = [];
|
|
54444
54452
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
54445
54453
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -54525,14 +54533,14 @@ async function loadSharp() {
|
|
|
54525
54533
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
54526
54534
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
54527
54535
|
} catch (e46) {
|
|
54528
|
-
throw new (0,
|
|
54529
|
-
'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.' +
|
|
54536
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(
|
|
54537
|
+
'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.' + _chunkAS25R4EUcjs.OPTIONAL_DEP_INSTALL_HINT
|
|
54530
54538
|
);
|
|
54531
54539
|
}
|
|
54532
54540
|
}
|
|
54533
54541
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
54534
54542
|
const sharp = await loadSharp();
|
|
54535
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
54543
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkAS25R4EUcjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
54536
54544
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
54537
54545
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
54538
54546
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -54550,11 +54558,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
54550
54558
|
try {
|
|
54551
54559
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
54552
54560
|
} catch (e47) {
|
|
54553
|
-
throw new (0,
|
|
54561
|
+
throw new (0, _chunkAS25R4EUcjs.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");
|
|
54554
54562
|
}
|
|
54555
54563
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
54556
54564
|
if (!executablePath) {
|
|
54557
|
-
throw new (0,
|
|
54565
|
+
throw new (0, _chunkAS25R4EUcjs.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");
|
|
54558
54566
|
}
|
|
54559
54567
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
54560
54568
|
try {
|
|
@@ -54570,13 +54578,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
54570
54578
|
async function loadBuffer(input) {
|
|
54571
54579
|
if (typeof input === "string") {
|
|
54572
54580
|
try {
|
|
54573
|
-
return
|
|
54581
|
+
return _chunkAS25R4EUcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
54574
54582
|
} catch (err) {
|
|
54575
54583
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
54576
|
-
throw new (0,
|
|
54584
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
54577
54585
|
}
|
|
54578
54586
|
}
|
|
54579
|
-
if (Buffer.isBuffer(input)) return
|
|
54587
|
+
if (Buffer.isBuffer(input)) return _chunkAS25R4EUcjs.toArrayBuffer.call(void 0, input);
|
|
54580
54588
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
54581
54589
|
return input;
|
|
54582
54590
|
}
|
|
@@ -54585,17 +54593,17 @@ async function sourceFormatOf(buffer) {
|
|
|
54585
54593
|
if (format2 === "hwpx") {
|
|
54586
54594
|
const zip = await detectZipFormat(buffer);
|
|
54587
54595
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
54588
|
-
throw new (0,
|
|
54596
|
+
throw new (0, _chunkAS25R4EUcjs.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`);
|
|
54589
54597
|
}
|
|
54590
54598
|
if (format2 === "hwp") return "hwp";
|
|
54591
|
-
throw new (0,
|
|
54599
|
+
throw new (0, _chunkAS25R4EUcjs.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`);
|
|
54592
54600
|
}
|
|
54593
54601
|
async function renderDocumentToScene(input, options = {}) {
|
|
54594
54602
|
const buffer = await loadBuffer(input);
|
|
54595
54603
|
const source = await sourceFormatOf(buffer);
|
|
54596
54604
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
54597
54605
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
54598
|
-
if (set.size === 0) throw new (0,
|
|
54606
|
+
if (set.size === 0) throw new (0, _chunkAS25R4EUcjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
54599
54607
|
return set;
|
|
54600
54608
|
} : void 0;
|
|
54601
54609
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -54631,7 +54639,7 @@ async function renderDocument(input, options) {
|
|
|
54631
54639
|
break;
|
|
54632
54640
|
}
|
|
54633
54641
|
default:
|
|
54634
|
-
throw new (0,
|
|
54642
|
+
throw new (0, _chunkAS25R4EUcjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
54635
54643
|
}
|
|
54636
54644
|
return { scene, assets };
|
|
54637
54645
|
}
|
|
@@ -54661,7 +54669,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
54661
54669
|
const out = [];
|
|
54662
54670
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
54663
54671
|
const meta = scene.pages.find((p) => p.page === page);
|
|
54664
|
-
if (!meta) throw new (0,
|
|
54672
|
+
if (!meta) throw new (0, _chunkAS25R4EUcjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
54665
54673
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
54666
54674
|
for (const { region, bbox } of items) {
|
|
54667
54675
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -54685,9 +54693,9 @@ function wantsCrop(kind, policy) {
|
|
|
54685
54693
|
}
|
|
54686
54694
|
async function extractTables(input, options = {}) {
|
|
54687
54695
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
54688
|
-
const buffer = typeof input === "string" ?
|
|
54696
|
+
const buffer = typeof input === "string" ? _chunkAS25R4EUcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkAS25R4EUcjs.toArrayBuffer.call(void 0, input) : input;
|
|
54689
54697
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
54690
|
-
if (!parsed.success) throw new (0,
|
|
54698
|
+
if (!parsed.success) throw new (0, _chunkAS25R4EUcjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
54691
54699
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
54692
54700
|
const out = blocks.map((b, i) => ({
|
|
54693
54701
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -54745,22 +54753,22 @@ async function extractTables(input, options = {}) {
|
|
|
54745
54753
|
// src/index.ts
|
|
54746
54754
|
async function parse(input, options) {
|
|
54747
54755
|
let buffer;
|
|
54748
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
54749
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
54756
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _1369 => _1369.filePath]) ? { ...options, filePath: input } : options;
|
|
54757
|
+
if (_optionalChain([opts, 'optionalAccess', _1370 => _1370.htmlTables]) && opts.tableFormat) {
|
|
54750
54758
|
return { success: false, fileType: "unknown", error: "htmlTables \uC640 tableFormat \uC740 \uD568\uAED8 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4" };
|
|
54751
54759
|
}
|
|
54752
|
-
const ocrOptionError =
|
|
54760
|
+
const ocrOptionError = _chunkYG4GFQB7cjs.validateOcrOptions.call(void 0, opts);
|
|
54753
54761
|
if (ocrOptionError) return { success: false, fileType: "unknown", error: ocrOptionError };
|
|
54754
54762
|
if (typeof input === "string") {
|
|
54755
54763
|
try {
|
|
54756
54764
|
const buf = await _promises.readFile.call(void 0, input);
|
|
54757
|
-
buffer =
|
|
54765
|
+
buffer = _chunkAS25R4EUcjs.toArrayBuffer.call(void 0, buf);
|
|
54758
54766
|
} catch (err) {
|
|
54759
54767
|
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}`;
|
|
54760
|
-
return { success: false, fileType: "unknown", error: msg2, code:
|
|
54768
|
+
return { success: false, fileType: "unknown", error: msg2, code: _chunkAS25R4EUcjs.classifyError.call(void 0, err) };
|
|
54761
54769
|
}
|
|
54762
54770
|
} else if (Buffer.isBuffer(input)) {
|
|
54763
|
-
buffer =
|
|
54771
|
+
buffer = _chunkAS25R4EUcjs.toArrayBuffer.call(void 0, input);
|
|
54764
54772
|
} else {
|
|
54765
54773
|
buffer = input;
|
|
54766
54774
|
}
|
|
@@ -54769,23 +54777,23 @@ async function parse(input, options) {
|
|
|
54769
54777
|
}
|
|
54770
54778
|
const format2 = detectFormat(buffer);
|
|
54771
54779
|
const result = await dispatch(format2, buffer, opts);
|
|
54772
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
54780
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1371 => _1371.images]) === false) {
|
|
54773
54781
|
delete result.images;
|
|
54774
54782
|
dropImageBytes(result.blocks);
|
|
54775
54783
|
}
|
|
54776
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
54784
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1372 => _1372.classifyTables])) classifyTableTree(result.blocks);
|
|
54777
54785
|
let out = result;
|
|
54778
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
54786
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1373 => _1373.pages]) && result.pageCount && _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, opts.pages, result.pageCount).size === 0) {
|
|
54779
54787
|
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` }] };
|
|
54780
54788
|
}
|
|
54781
54789
|
if (out.success && !out.pages) {
|
|
54782
|
-
const pages =
|
|
54790
|
+
const pages = _chunkN6KXGIINcjs.blocksToPages.call(void 0, out.blocks, (bs) => _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([opts, 'optionalAccess', _1374 => _1374.tableFormat]) }));
|
|
54783
54791
|
if (pages) out = { ...out, pages };
|
|
54784
54792
|
}
|
|
54785
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
54793
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1375 => _1375.plain])) {
|
|
54786
54794
|
out = { ...out, markdown: toPlainMarkdown(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toPlainMarkdown(p.markdown) })) } : {} };
|
|
54787
54795
|
}
|
|
54788
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
54796
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1376 => _1376.htmlTables])) {
|
|
54789
54797
|
out = { ...out, markdown: toHtmlTables(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toHtmlTables(p.markdown) })) } : {} };
|
|
54790
54798
|
}
|
|
54791
54799
|
return out;
|
|
@@ -54830,42 +54838,42 @@ async function dispatch(format2, buffer, opts) {
|
|
|
54830
54838
|
async function withEmbeddedImageOcr(blocks, markdown, warnings, images, options) {
|
|
54831
54839
|
const list = [..._nullishCoalesce(warnings, () => ( []))];
|
|
54832
54840
|
if (!await ocrEmbeddedImages(blocks, options, list)) return { markdown, warnings: list.length ? list : void 0 };
|
|
54833
|
-
let md2 =
|
|
54834
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
54841
|
+
let md2 = _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1377 => _1377.tableFormat]) });
|
|
54842
|
+
if (_optionalChain([options, 'optionalAccess', _1378 => _1378.inlineImages]) && options.images !== false && _optionalChain([images, 'optionalAccess', _1379 => _1379.length])) {
|
|
54835
54843
|
try {
|
|
54836
|
-
md2 =
|
|
54844
|
+
md2 = _chunkN6KXGIINcjs.inlineImagesIntoMarkdown.call(void 0, md2, images, { compress: true });
|
|
54837
54845
|
} catch (e48) {
|
|
54838
54846
|
}
|
|
54839
54847
|
}
|
|
54840
54848
|
return { markdown: md2, warnings: list.length ? list : void 0 };
|
|
54841
54849
|
}
|
|
54842
54850
|
function scriptsOff(r, off) {
|
|
54843
|
-
return off ?
|
|
54851
|
+
return off ? _chunkYG4GFQB7cjs.stripScriptTags.call(void 0, r) : r;
|
|
54844
54852
|
}
|
|
54845
54853
|
async function parseImage(buffer, options) {
|
|
54846
54854
|
try {
|
|
54847
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
54855
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-AELVAU75.cjs")));
|
|
54848
54856
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
54849
|
-
|
|
54857
|
+
_chunkYG4GFQB7cjs.stripScriptTags.call(void 0, { blocks });
|
|
54850
54858
|
return {
|
|
54851
54859
|
success: true,
|
|
54852
54860
|
fileType: "image",
|
|
54853
|
-
markdown:
|
|
54861
|
+
markdown: _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1380 => _1380.tableFormat]) }),
|
|
54854
54862
|
blocks,
|
|
54855
54863
|
warnings: warnings.length ? warnings : void 0,
|
|
54856
54864
|
pageCount: 1,
|
|
54857
|
-
..._optionalChain([options, 'optionalAccess',
|
|
54865
|
+
..._optionalChain([options, 'optionalAccess', _1381 => _1381.ocrLines]) ? { ocrLines: lines ? [lines] : [] } : {}
|
|
54858
54866
|
};
|
|
54859
54867
|
} catch (err) {
|
|
54860
|
-
return { success: false, fileType: "image", error:
|
|
54868
|
+
return { success: false, fileType: "image", error: _chunkAS25R4EUcjs.sanitizeError.call(void 0, err), code: _chunkAS25R4EUcjs.classifyError.call(void 0, err) };
|
|
54861
54869
|
}
|
|
54862
54870
|
}
|
|
54863
54871
|
async function parseHwp3(buffer, options) {
|
|
54864
54872
|
try {
|
|
54865
54873
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp3Document(buffer, options);
|
|
54866
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54874
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess', _1382 => _1382.pageCount]) };
|
|
54867
54875
|
} catch (err) {
|
|
54868
|
-
return { success: false, fileType: "hwp3", error:
|
|
54876
|
+
return { success: false, fileType: "hwp3", error: _chunkAS25R4EUcjs.sanitizeError.call(void 0, err), code: _chunkAS25R4EUcjs.classifyError.call(void 0, err) };
|
|
54869
54877
|
}
|
|
54870
54878
|
}
|
|
54871
54879
|
async function parseHwpx(buffer, options) {
|
|
@@ -54873,15 +54881,15 @@ async function parseHwpx(buffer, options) {
|
|
|
54873
54881
|
const doc = await parseHwpxDocument(buffer, options);
|
|
54874
54882
|
const { blocks, metadata, outline, images } = doc;
|
|
54875
54883
|
const { markdown, warnings } = await withEmbeddedImageOcr(blocks, doc.markdown, doc.warnings, void 0, options);
|
|
54876
|
-
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
54884
|
+
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1383 => _1383.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1384 => _1384.pageCount]) }, _optionalChain([options, 'optionalAccess', _1385 => _1385.scriptTags]) === false);
|
|
54877
54885
|
} catch (err) {
|
|
54878
|
-
return { success: false, fileType: "hwpx", error:
|
|
54886
|
+
return { success: false, fileType: "hwpx", error: _chunkAS25R4EUcjs.sanitizeError.call(void 0, err), code: _chunkAS25R4EUcjs.classifyError.call(void 0, err) };
|
|
54879
54887
|
}
|
|
54880
54888
|
}
|
|
54881
54889
|
async function parseHwp(buffer, options) {
|
|
54882
54890
|
try {
|
|
54883
54891
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
54884
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
54892
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _1386 => _1386.filePath])) {
|
|
54885
54893
|
try {
|
|
54886
54894
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
54887
54895
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -54900,15 +54908,15 @@ async function parseHwp(buffer, options) {
|
|
|
54900
54908
|
}
|
|
54901
54909
|
}
|
|
54902
54910
|
const ocred = await withEmbeddedImageOcr(blocks, markdown, warnings, images, options);
|
|
54903
|
-
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess',
|
|
54911
|
+
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess', _1387 => _1387.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1388 => _1388.pageCount]) }, _optionalChain([options, 'optionalAccess', _1389 => _1389.scriptTags]) === false);
|
|
54904
54912
|
} catch (err) {
|
|
54905
|
-
return { success: false, fileType: "hwp", error:
|
|
54913
|
+
return { success: false, fileType: "hwp", error: _chunkAS25R4EUcjs.sanitizeError.call(void 0, err), code: _chunkAS25R4EUcjs.classifyError.call(void 0, err) };
|
|
54906
54914
|
}
|
|
54907
54915
|
}
|
|
54908
54916
|
async function parsePdf(buffer, options) {
|
|
54909
54917
|
let parsePdfDocument;
|
|
54910
54918
|
try {
|
|
54911
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
54919
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-WNDH2X6N.cjs")));
|
|
54912
54920
|
parsePdfDocument = mod.parsePdfDocument;
|
|
54913
54921
|
} catch (e50) {
|
|
54914
54922
|
return {
|
|
@@ -54920,59 +54928,59 @@ async function parsePdf(buffer, options) {
|
|
|
54920
54928
|
}
|
|
54921
54929
|
try {
|
|
54922
54930
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, ocrLines } = await parsePdfDocument(buffer, options);
|
|
54923
|
-
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54931
|
+
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _1390 => _1390.pageCount]), ...ocrLines ? { ocrLines } : {} }, _optionalChain([options, 'optionalAccess', _1391 => _1391.scriptTags]) !== true);
|
|
54924
54932
|
} catch (err) {
|
|
54925
54933
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
54926
|
-
return { success: false, fileType: "pdf", error:
|
|
54934
|
+
return { success: false, fileType: "pdf", error: _chunkAS25R4EUcjs.sanitizeError.call(void 0, err), code: _chunkAS25R4EUcjs.classifyError.call(void 0, err), isImageBased };
|
|
54927
54935
|
}
|
|
54928
54936
|
}
|
|
54929
54937
|
async function parseXlsx(buffer, options) {
|
|
54930
54938
|
try {
|
|
54931
54939
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
54932
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54940
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1392 => _1392.pageCount]) };
|
|
54933
54941
|
} catch (err) {
|
|
54934
|
-
return { success: false, fileType: "xlsx", error:
|
|
54942
|
+
return { success: false, fileType: "xlsx", error: _chunkAS25R4EUcjs.sanitizeError.call(void 0, err), code: _chunkAS25R4EUcjs.classifyError.call(void 0, err) };
|
|
54935
54943
|
}
|
|
54936
54944
|
}
|
|
54937
54945
|
async function parseXls(buffer, options) {
|
|
54938
54946
|
try {
|
|
54939
54947
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
54940
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54948
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1393 => _1393.pageCount]) };
|
|
54941
54949
|
} catch (err) {
|
|
54942
|
-
return { success: false, fileType: "xls", error:
|
|
54950
|
+
return { success: false, fileType: "xls", error: _chunkAS25R4EUcjs.sanitizeError.call(void 0, err), code: _chunkAS25R4EUcjs.classifyError.call(void 0, err) };
|
|
54943
54951
|
}
|
|
54944
54952
|
}
|
|
54945
54953
|
async function parseDocx(buffer, options) {
|
|
54946
54954
|
try {
|
|
54947
54955
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
54948
|
-
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
54956
|
+
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1394 => _1394.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1395 => _1395.pageCount]) }, _optionalChain([options, 'optionalAccess', _1396 => _1396.scriptTags]) === false);
|
|
54949
54957
|
} catch (err) {
|
|
54950
|
-
return { success: false, fileType: "docx", error:
|
|
54958
|
+
return { success: false, fileType: "docx", error: _chunkAS25R4EUcjs.sanitizeError.call(void 0, err), code: _chunkAS25R4EUcjs.classifyError.call(void 0, err) };
|
|
54951
54959
|
}
|
|
54952
54960
|
}
|
|
54953
54961
|
async function parsePptx(buffer, options) {
|
|
54954
54962
|
try {
|
|
54955
54963
|
const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
|
|
54956
|
-
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
54964
|
+
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1397 => _1397.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1398 => _1398.pageCount]) }, _optionalChain([options, 'optionalAccess', _1399 => _1399.scriptTags]) === false);
|
|
54957
54965
|
} catch (err) {
|
|
54958
|
-
return { success: false, fileType: "pptx", error:
|
|
54966
|
+
return { success: false, fileType: "pptx", error: _chunkAS25R4EUcjs.sanitizeError.call(void 0, err), code: _chunkAS25R4EUcjs.classifyError.call(void 0, err) };
|
|
54959
54967
|
}
|
|
54960
54968
|
}
|
|
54961
54969
|
async function parseHwpml(buffer, options) {
|
|
54962
54970
|
try {
|
|
54963
54971
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
54964
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54972
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1400 => _1400.pageCount]) };
|
|
54965
54973
|
} catch (err) {
|
|
54966
|
-
return { success: false, fileType: "hwpml", error:
|
|
54974
|
+
return { success: false, fileType: "hwpml", error: _chunkAS25R4EUcjs.sanitizeError.call(void 0, err), code: _chunkAS25R4EUcjs.classifyError.call(void 0, err) };
|
|
54967
54975
|
}
|
|
54968
54976
|
}
|
|
54969
54977
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
54970
54978
|
let buffer;
|
|
54971
54979
|
if (typeof input === "string") {
|
|
54972
54980
|
const buf = await _promises.readFile.call(void 0, input);
|
|
54973
|
-
buffer =
|
|
54981
|
+
buffer = _chunkAS25R4EUcjs.toArrayBuffer.call(void 0, buf);
|
|
54974
54982
|
} else if (Buffer.isBuffer(input)) {
|
|
54975
|
-
buffer =
|
|
54983
|
+
buffer = _chunkAS25R4EUcjs.toArrayBuffer.call(void 0, input);
|
|
54976
54984
|
} else {
|
|
54977
54985
|
buffer = input;
|
|
54978
54986
|
}
|
|
@@ -54998,7 +55006,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
54998
55006
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
54999
55007
|
}
|
|
55000
55008
|
const fill = fillFormFields(parsed.blocks, values);
|
|
55001
|
-
const markdown =
|
|
55009
|
+
const markdown = _chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
55002
55010
|
if (outputFormat === "hwpx") {
|
|
55003
55011
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
55004
55012
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -55097,5 +55105,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
55097
55105
|
|
|
55098
55106
|
|
|
55099
55107
|
|
|
55100
|
-
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 =
|
|
55108
|
+
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 = _chunkAS25R4EUcjs.VERSION; exports.ValueCursor = ValueCursor; exports.agencyNames = agencyNames; exports.agencyStyle = agencyStyle; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkYG4GFQB7cjs.blocksToMarkdown; exports.blocksToPages = _chunkN6KXGIINcjs.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 = _chunkYG4GFQB7cjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunkYG4GFQB7cjs.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;
|
|
55101
55109
|
//# sourceMappingURL=index.cjs.map
|