kordoc 4.7.3 → 4.8.0
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 +19 -1
- package/dist/{-WYNJOQ6P.js → -URO5XBEB.js} +11 -9
- package/dist/{chunk-TXQQ7URG.js → chunk-2ANLGAUG.js} +2 -2
- package/dist/{chunk-LMHVMGEC.js → chunk-37SAM3LH.js} +3 -3
- package/dist/{chunk-W5NZYPRQ.js → chunk-3CBHCDYD.js} +41 -9
- package/dist/chunk-3CBHCDYD.js.map +1 -0
- package/dist/{chunk-QETZP25M.cjs → chunk-5IRX3TQP.cjs} +3 -3
- package/dist/{chunk-QETZP25M.cjs.map → chunk-5IRX3TQP.cjs.map} +1 -1
- package/dist/{chunk-3P5YCJQE.js → chunk-7OHDTS5Q.js} +2 -2
- package/dist/{chunk-KSATSTC5.js → chunk-BN33O25L.js} +1 -1
- package/dist/{chunk-4KGGVCYX.js.map → chunk-BN33O25L.js.map} +1 -1
- package/dist/{chunk-KE6DLZAW.cjs → chunk-CX2LRBC5.cjs} +11 -11
- package/dist/{chunk-KE6DLZAW.cjs.map → chunk-CX2LRBC5.cjs.map} +1 -1
- package/dist/{chunk-HJV4BVQI.js → chunk-E6OJKTYS.js} +2 -2
- package/dist/{chunk-NYLYIN55.js → chunk-F7RZZI5P.js} +3 -3
- package/dist/{chunk-R4LXZRYP.cjs → chunk-GGZ5PSJO.cjs} +4 -4
- package/dist/{chunk-R4LXZRYP.cjs.map → chunk-GGZ5PSJO.cjs.map} +1 -1
- package/dist/{chunk-JKJEBDP7.js → chunk-HFVMCUXF.js} +3 -3
- package/dist/{chunk-RQVFFSAO.js → chunk-HS4762CD.js} +2 -2
- package/dist/{chunk-E6DONLTM.cjs → chunk-J7DBL77B.cjs} +2 -2
- package/dist/{chunk-E6DONLTM.cjs.map → chunk-J7DBL77B.cjs.map} +1 -1
- package/dist/{chunk-IMFIACHP.js → chunk-L2Q3NLHX.js} +2 -2
- package/dist/{chunk-EV53YE3W.cjs → chunk-L5CDTOC3.cjs} +1 -1
- package/dist/chunk-L5CDTOC3.cjs.map +1 -0
- package/dist/{chunk-P663PYWV.js → chunk-NFCQ5XNT.js} +2 -2
- package/dist/{chunk-KEGAEHWO.js → chunk-OKE6G67G.js} +2 -2
- package/dist/{chunk-QGATKC4R.cjs → chunk-OKISH2NK.cjs} +6 -6
- package/dist/{chunk-QGATKC4R.cjs.map → chunk-OKISH2NK.cjs.map} +1 -1
- package/dist/{chunk-46F5RMU7.js → chunk-S4SMUQAT.js} +2 -2
- package/dist/{chunk-CGJDCZA3.js → chunk-TXRTH5BV.js} +2 -2
- package/dist/{chunk-XOO6YEZE.js → chunk-VPAYFTMH.js} +3 -3
- package/dist/{chunk-4HZN7EZZ.js → chunk-WG473BIB.js} +2 -2
- package/dist/{chunk-Y7T5Z4DC.js → chunk-WXC4HKSD.js} +3 -3
- package/dist/{chunk-4KGGVCYX.js → chunk-XINP35F4.js} +1 -1
- package/dist/{chunk-KSATSTC5.js.map → chunk-XINP35F4.js.map} +1 -1
- package/dist/{chunk-3NKSSL44.js → chunk-YB2TYOYY.js} +3 -3
- package/dist/{chunk-VZ3AQVBN.js → chunk-ZEQPTIWN.js} +2 -2
- package/dist/chunks-M64IY7AK.js +10 -0
- package/dist/cli.js +21 -21
- package/dist/{formula-PDMZMBIP.cjs → formula-3K5KC3VV.cjs} +9 -9
- package/dist/{formula-PDMZMBIP.cjs.map → formula-3K5KC3VV.cjs.map} +1 -1
- package/dist/{formula-V6EAYHMF.js → formula-7BNCJ55B.js} +3 -3
- package/dist/{formula-IFKZZPD2.js → formula-YRMQ7BTI.js} +4 -4
- package/dist/{image-ocr-75WGMVU6.cjs → image-ocr-CBMJIJTQ.cjs} +12 -12
- package/dist/{image-ocr-75WGMVU6.cjs.map → image-ocr-CBMJIJTQ.cjs.map} +1 -1
- package/dist/{image-ocr-B7TMIG3F.js → image-ocr-O7TKPDTY.js} +8 -8
- package/dist/{image-ocr-XHBZONFZ.js → image-ocr-XRVXVYKO.js} +6 -6
- package/dist/index.cjs +396 -364
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -1
- package/dist/index.d.ts +42 -1
- package/dist/index.js +37 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +16 -16
- package/dist/{model-bundle-Q4HQXJQG.js → model-bundle-GNDUKNME.js} +5 -5
- package/dist/{models-QQA7OQHY.js → models-TJ45RB2Z.js} +5 -5
- package/dist/{parser-Z36MZUHS.js → parser-5MLJHSRX.js} +7 -7
- package/dist/{parser-4CBOPTVY.cjs → parser-GIVQWVKJ.cjs} +27 -27
- package/dist/{parser-4CBOPTVY.cjs.map → parser-GIVQWVKJ.cjs.map} +1 -1
- package/dist/{parser-HT7GZOF2.js → parser-U3SMCGRK.js} +7 -7
- package/dist/pdf-ocr-BUBZA4EE.cjs +14 -0
- package/dist/{pdf-ocr-6ZNGDVC6.cjs.map → pdf-ocr-BUBZA4EE.cjs.map} +1 -1
- package/dist/pdf-ocr-HITVPJLV.js +13 -0
- package/dist/pdf-ocr-K4WOCJGJ.js +16 -0
- package/dist/{profile-io-ACYRLCSR.js → profile-io-VATWYLZX.js} +3 -3
- package/dist/{rasterize-QYCLEH2J.js → rasterize-PNRXMSL2.js} +2 -2
- package/dist/render-YY5RKZEB.js +10 -0
- package/dist/seal-5ZNJXOOQ.js +10 -0
- package/dist/{setup-MG3YYKXU.js → setup-OEUDZ4BT.js} +3 -3
- package/dist/{watch-AZIY6AWC.js → watch-USNQJXQC.js} +10 -10
- package/package.json +2 -2
- package/dist/chunk-EV53YE3W.cjs.map +0 -1
- package/dist/chunk-W5NZYPRQ.js.map +0 -1
- package/dist/chunks-LWAOHTK2.js +0 -10
- package/dist/pdf-ocr-6ZNGDVC6.cjs +0 -14
- package/dist/pdf-ocr-NTXRJI4T.js +0 -13
- package/dist/pdf-ocr-TYMCEUPH.js +0 -16
- package/dist/render-5Y2US4IM.js +0 -10
- package/dist/seal-VU6JS2QD.js +0 -10
- /package/dist/{-WYNJOQ6P.js.map → -URO5XBEB.js.map} +0 -0
- /package/dist/{chunk-TXQQ7URG.js.map → chunk-2ANLGAUG.js.map} +0 -0
- /package/dist/{chunk-LMHVMGEC.js.map → chunk-37SAM3LH.js.map} +0 -0
- /package/dist/{chunk-3P5YCJQE.js.map → chunk-7OHDTS5Q.js.map} +0 -0
- /package/dist/{chunk-HJV4BVQI.js.map → chunk-E6OJKTYS.js.map} +0 -0
- /package/dist/{chunk-NYLYIN55.js.map → chunk-F7RZZI5P.js.map} +0 -0
- /package/dist/{chunk-JKJEBDP7.js.map → chunk-HFVMCUXF.js.map} +0 -0
- /package/dist/{chunk-RQVFFSAO.js.map → chunk-HS4762CD.js.map} +0 -0
- /package/dist/{chunk-IMFIACHP.js.map → chunk-L2Q3NLHX.js.map} +0 -0
- /package/dist/{chunk-P663PYWV.js.map → chunk-NFCQ5XNT.js.map} +0 -0
- /package/dist/{chunk-KEGAEHWO.js.map → chunk-OKE6G67G.js.map} +0 -0
- /package/dist/{chunk-46F5RMU7.js.map → chunk-S4SMUQAT.js.map} +0 -0
- /package/dist/{chunk-CGJDCZA3.js.map → chunk-TXRTH5BV.js.map} +0 -0
- /package/dist/{chunk-XOO6YEZE.js.map → chunk-VPAYFTMH.js.map} +0 -0
- /package/dist/{chunk-4HZN7EZZ.js.map → chunk-WG473BIB.js.map} +0 -0
- /package/dist/{chunk-Y7T5Z4DC.js.map → chunk-WXC4HKSD.js.map} +0 -0
- /package/dist/{chunk-3NKSSL44.js.map → chunk-YB2TYOYY.js.map} +0 -0
- /package/dist/{chunk-VZ3AQVBN.js.map → chunk-ZEQPTIWN.js.map} +0 -0
- /package/dist/{chunks-LWAOHTK2.js.map → chunks-M64IY7AK.js.map} +0 -0
- /package/dist/{formula-V6EAYHMF.js.map → formula-7BNCJ55B.js.map} +0 -0
- /package/dist/{formula-IFKZZPD2.js.map → formula-YRMQ7BTI.js.map} +0 -0
- /package/dist/{image-ocr-B7TMIG3F.js.map → image-ocr-O7TKPDTY.js.map} +0 -0
- /package/dist/{image-ocr-XHBZONFZ.js.map → image-ocr-XRVXVYKO.js.map} +0 -0
- /package/dist/{model-bundle-Q4HQXJQG.js.map → model-bundle-GNDUKNME.js.map} +0 -0
- /package/dist/{models-QQA7OQHY.js.map → models-TJ45RB2Z.js.map} +0 -0
- /package/dist/{parser-Z36MZUHS.js.map → parser-5MLJHSRX.js.map} +0 -0
- /package/dist/{parser-HT7GZOF2.js.map → parser-U3SMCGRK.js.map} +0 -0
- /package/dist/{pdf-ocr-NTXRJI4T.js.map → pdf-ocr-HITVPJLV.js.map} +0 -0
- /package/dist/{pdf-ocr-TYMCEUPH.js.map → pdf-ocr-K4WOCJGJ.js.map} +0 -0
- /package/dist/{profile-io-ACYRLCSR.js.map → profile-io-VATWYLZX.js.map} +0 -0
- /package/dist/{rasterize-QYCLEH2J.js.map → rasterize-PNRXMSL2.js.map} +0 -0
- /package/dist/{render-5Y2US4IM.js.map → render-YY5RKZEB.js.map} +0 -0
- /package/dist/{seal-VU6JS2QD.js.map → seal-5ZNJXOOQ.js.map} +0 -0
- /package/dist/{setup-MG3YYKXU.js.map → setup-OEUDZ4BT.js.map} +0 -0
- /package/dist/{watch-AZIY6AWC.js.map → watch-USNQJXQC.js.map} +0 -0
package/dist/mcp.js
CHANGED
|
@@ -37,30 +37,30 @@ import {
|
|
|
37
37
|
readBuiltinTemplate,
|
|
38
38
|
resolveBuiltinTemplate,
|
|
39
39
|
unknownFontWarnings
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-3CBHCDYD.js";
|
|
41
41
|
import "./chunk-7FCNOKOR.js";
|
|
42
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-XINP35F4.js";
|
|
43
43
|
import "./chunk-MOL7MDBG.js";
|
|
44
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-F7RZZI5P.js";
|
|
45
45
|
import "./chunk-DZIXKL7E.js";
|
|
46
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-TXRTH5BV.js";
|
|
47
47
|
import {
|
|
48
48
|
blocksToMarkdown
|
|
49
|
-
} from "./chunk-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
49
|
+
} from "./chunk-OKE6G67G.js";
|
|
50
|
+
import "./chunk-VPAYFTMH.js";
|
|
51
|
+
import "./chunk-ZEQPTIWN.js";
|
|
52
52
|
import {
|
|
53
53
|
assertWithinRoot,
|
|
54
54
|
getAccessRoot,
|
|
55
55
|
isOfflineMode
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-HS4762CD.js";
|
|
57
57
|
import {
|
|
58
58
|
KordocError,
|
|
59
59
|
VERSION,
|
|
60
60
|
classifyError,
|
|
61
61
|
sanitizeError,
|
|
62
62
|
toArrayBuffer
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-L2Q3NLHX.js";
|
|
64
64
|
|
|
65
65
|
// src/mcp.ts
|
|
66
66
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -310,7 +310,7 @@ server.tool(
|
|
|
310
310
|
break;
|
|
311
311
|
case "pdf":
|
|
312
312
|
try {
|
|
313
|
-
const { extractPdfMetadataOnly } = await import("./parser-
|
|
313
|
+
const { extractPdfMetadataOnly } = await import("./parser-U3SMCGRK.js");
|
|
314
314
|
metadata = await extractPdfMetadataOnly(buffer);
|
|
315
315
|
} catch {
|
|
316
316
|
metadata = void 0;
|
|
@@ -692,7 +692,7 @@ server.tool(
|
|
|
692
692
|
}
|
|
693
693
|
const image = new Uint8Array(await readFile(imgResolved));
|
|
694
694
|
const ext = extname(imgResolved).slice(1).toLowerCase();
|
|
695
|
-
const { placeSealHwpx } = await import("./seal-
|
|
695
|
+
const { placeSealHwpx } = await import("./seal-5ZNJXOOQ.js");
|
|
696
696
|
const result = await placeSealHwpx(buffer, [{
|
|
697
697
|
anchor,
|
|
698
698
|
occurrence,
|
|
@@ -794,7 +794,7 @@ server.tool(
|
|
|
794
794
|
}
|
|
795
795
|
const outPath = output_path ? safeOutputPath(output_path, /* @__PURE__ */ new Set([format === "png" ? ".png" : ".svg"])) : void 0;
|
|
796
796
|
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx"]));
|
|
797
|
-
const { renderHwpxToSvg } = await import("./render-
|
|
797
|
+
const { renderHwpxToSvg } = await import("./render-YY5RKZEB.js");
|
|
798
798
|
const result = await renderHwpxToSvg(buffer, { highlights, reflow: true, reflowMode: reflow_mode });
|
|
799
799
|
const summary = [
|
|
800
800
|
`\uB80C\uB354 \uC644\uB8CC: ${result.pageCount}\uD398\uC774\uC9C0, ${Math.round(result.width)}x${Math.round(result.height)}pt (\uD14D\uC2A4\uD2B8 ${result.stats.texts}\xB7\uC774\uBBF8\uC9C0 ${result.stats.images}\xB7\uD45C ${result.stats.tables})`,
|
|
@@ -806,7 +806,7 @@ server.tool(
|
|
|
806
806
|
summary.push(`\uC800\uC7A5: ${outPath}`);
|
|
807
807
|
return { content: [{ type: "text", text: summary.join("\n") }] };
|
|
808
808
|
}
|
|
809
|
-
const { rasterizeSvg } = await import("./rasterize-
|
|
809
|
+
const { rasterizeSvg } = await import("./rasterize-PNRXMSL2.js");
|
|
810
810
|
const raster = await rasterizeSvg(result.svg, result.width, result.height);
|
|
811
811
|
if (outPath) {
|
|
812
812
|
await mkdir(dirname(outPath), { recursive: true });
|
|
@@ -904,7 +904,7 @@ server.tool(
|
|
|
904
904
|
if (!parsed.success) {
|
|
905
905
|
return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
|
|
906
906
|
}
|
|
907
|
-
const { blocksToChunks } = await import("./chunks-
|
|
907
|
+
const { blocksToChunks } = await import("./chunks-M64IY7AK.js");
|
|
908
908
|
const chunks = blocksToChunks(parsed.blocks, { granularity, includeTableCells: include_table_cells });
|
|
909
909
|
return { content: [{ type: "text", text: capResponseText(JSON.stringify(chunks, null, 2)) }] };
|
|
910
910
|
} catch (err) {
|
|
@@ -923,7 +923,7 @@ server.tool(
|
|
|
923
923
|
try {
|
|
924
924
|
const out = safeOutputPath(output_path, PROFILE_EXTENSIONS);
|
|
925
925
|
const { buffer } = await readValidatedFile(hwpx_path);
|
|
926
|
-
const { hwpxToProfile } = await import("./-
|
|
926
|
+
const { hwpxToProfile } = await import("./-URO5XBEB.js");
|
|
927
927
|
const profile = await hwpxToProfile(buffer);
|
|
928
928
|
await mkdir(dirname(out), { recursive: true });
|
|
929
929
|
await writeFile(out, JSON.stringify(profile, null, 2));
|
|
@@ -1012,7 +1012,7 @@ server.tool(
|
|
|
1012
1012
|
}
|
|
1013
1013
|
let profile;
|
|
1014
1014
|
if (profile_path) {
|
|
1015
|
-
const { parseFormatProfileJson } = await import("./profile-io-
|
|
1015
|
+
const { parseFormatProfileJson } = await import("./profile-io-VATWYLZX.js");
|
|
1016
1016
|
profile = parseFormatProfileJson(await readFile(safePath(profile_path, PROFILE_EXTENSIONS), "utf-8"));
|
|
1017
1017
|
}
|
|
1018
1018
|
const out = safeOutputPath(output_path, /* @__PURE__ */ new Set([".hwpx"]));
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ALL_OCR_MODELS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2ANLGAUG.js";
|
|
5
5
|
import {
|
|
6
6
|
ALL_FORMULA_MODELS,
|
|
7
7
|
getModelStatusIn,
|
|
8
8
|
getModelsDir
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-WG473BIB.js";
|
|
10
|
+
import "./chunk-HS4762CD.js";
|
|
11
|
+
import "./chunk-L2Q3NLHX.js";
|
|
12
12
|
|
|
13
13
|
// src/shared/model-bundle.ts
|
|
14
14
|
import { copyFile, mkdir } from "fs/promises";
|
|
@@ -101,4 +101,4 @@ export {
|
|
|
101
101
|
importModels,
|
|
102
102
|
modelCacheStatus
|
|
103
103
|
};
|
|
104
|
-
//# sourceMappingURL=model-bundle-
|
|
104
|
+
//# sourceMappingURL=model-bundle-GNDUKNME.js.map
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
getOcrModelsDir,
|
|
10
10
|
ocrModelPath,
|
|
11
11
|
parseCharacterDict
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-2ANLGAUG.js";
|
|
13
|
+
import "./chunk-WG473BIB.js";
|
|
14
|
+
import "./chunk-HS4762CD.js";
|
|
15
|
+
import "./chunk-L2Q3NLHX.js";
|
|
16
16
|
export {
|
|
17
17
|
ALL_OCR_MODELS,
|
|
18
18
|
OCR_DET_MODEL,
|
|
@@ -24,4 +24,4 @@ export {
|
|
|
24
24
|
ocrModelPath,
|
|
25
25
|
parseCharacterDict
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=models-
|
|
27
|
+
//# sourceMappingURL=models-TJ45RB2Z.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
blocksToMarkdown,
|
|
3
3
|
encodePng
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NFCQ5XNT.js";
|
|
5
5
|
import {
|
|
6
6
|
parsePageRange
|
|
7
7
|
} from "./chunk-GE43BE46.js";
|
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
mergeCrossPageTables,
|
|
19
19
|
normalizeItems,
|
|
20
20
|
removeHeaderFooterBlocks
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-37SAM3LH.js";
|
|
22
|
+
import "./chunk-BN33O25L.js";
|
|
23
23
|
import {
|
|
24
24
|
KordocError,
|
|
25
25
|
sanitizeHref
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-S4SMUQAT.js";
|
|
27
27
|
|
|
28
28
|
// src/pdf/image-extract.ts
|
|
29
29
|
import { OPS, ImageKind } from "pdfjs-dist/legacy/build/pdf.mjs";
|
|
@@ -420,7 +420,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
420
420
|
|
|
421
421
|
// src/pdf/formula-ocr.ts
|
|
422
422
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
423
|
-
const formulaMod = await import("./formula-
|
|
423
|
+
const formulaMod = await import("./formula-7BNCJ55B.js");
|
|
424
424
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
425
425
|
await ensureFormulaModels((p) => {
|
|
426
426
|
if (p.phase === "download" && p.total) {
|
|
@@ -705,7 +705,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
705
705
|
}
|
|
706
706
|
if (targets.size > 0) {
|
|
707
707
|
try {
|
|
708
|
-
const { runPdfOcr } = await import("./pdf-ocr-
|
|
708
|
+
const { runPdfOcr } = await import("./pdf-ocr-HITVPJLV.js");
|
|
709
709
|
const mode = typeof options.ocr === "function" ? options.ocr : "builtin";
|
|
710
710
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options.onProgress, options.tables !== false);
|
|
711
711
|
if (ocrPageBlocks.size > 0) {
|
|
@@ -841,4 +841,4 @@ export {
|
|
|
841
841
|
parsePdfDocument,
|
|
842
842
|
removeHeaderFooterBlocks
|
|
843
843
|
};
|
|
844
|
-
//# sourceMappingURL=parser-
|
|
844
|
+
//# sourceMappingURL=parser-5MLJHSRX.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkGGZ5PSJOcjs = require('./chunk-GGZ5PSJO.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -18,12 +18,12 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
22
|
-
require('./chunk-
|
|
21
|
+
var _chunkCX2LRBC5cjs = require('./chunk-CX2LRBC5.cjs');
|
|
22
|
+
require('./chunk-L5CDTOC3.cjs');
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _chunkJ7DBL77Bcjs = require('./chunk-J7DBL77B.cjs');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -149,7 +149,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
|
|
|
149
149
|
if (state.seen.has(hash)) continue;
|
|
150
150
|
const rgba = toRgba(imgData);
|
|
151
151
|
if (!rgba) continue;
|
|
152
|
-
const png =
|
|
152
|
+
const png = _chunkGGZ5PSJOcjs.encodePng.call(void 0, w, h, rgba);
|
|
153
153
|
state.imageIndex++;
|
|
154
154
|
state.totalBytes += png.length;
|
|
155
155
|
const filename = `image_${String(state.imageIndex).padStart(3, "0")}.png`;
|
|
@@ -344,7 +344,7 @@ function cleanPdfText(text) {
|
|
|
344
344
|
stripControlChars(text).replace(/^\d{1,4}\n/, "").replace(/^[\s]*[-–—]\s*[-–—]?\d+[-–—]?[\s]*[-–—]?[\s]*$/gm, "").replace(/^\s*\d+\s*\/\s*\d+\s*$/gm, "").replace(/\n\d{1,4}\n/g, "\n").replace(/\n\d{1,4}$/, "").replace(/^#{1,6}\s*\d{1,4}\s*$/gm, "")
|
|
345
345
|
).replace(/^(?!\| ---).*$/gm, (line) => {
|
|
346
346
|
if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
|
|
347
|
-
return
|
|
347
|
+
return _chunkCX2LRBC5cjs.collapseEvenSpacing.call(void 0, line);
|
|
348
348
|
}).replace(/([□■◆○●▶ㅇ])\s+([가-힣])\s+([가-힣])/g, "$1 $2$3").replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
349
349
|
}
|
|
350
350
|
function startsWithMarker(line) {
|
|
@@ -392,7 +392,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
392
392
|
const wrapped = /* @__PURE__ */ new Set();
|
|
393
393
|
for (const a of annots) {
|
|
394
394
|
if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
|
|
395
|
-
const url =
|
|
395
|
+
const url = _chunkJ7DBL77Bcjs.sanitizeHref.call(void 0, a.url);
|
|
396
396
|
if (!url) continue;
|
|
397
397
|
const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
|
|
398
398
|
const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
|
|
@@ -423,7 +423,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
423
423
|
|
|
424
424
|
// src/pdf/formula-ocr.ts
|
|
425
425
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
426
|
-
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-
|
|
426
|
+
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-3K5KC3VV.cjs")));
|
|
427
427
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
428
428
|
await ensureFormulaModels((p) => {
|
|
429
429
|
if (p.phase === "download" && p.total) {
|
|
@@ -591,7 +591,7 @@ async function loadPdfWithTimeout(buffer) {
|
|
|
591
591
|
new Promise((_, reject) => {
|
|
592
592
|
timer = setTimeout(() => {
|
|
593
593
|
loadingTask.destroy();
|
|
594
|
-
reject(new (0,
|
|
594
|
+
reject(new (0, _chunkJ7DBL77Bcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
|
|
595
595
|
}, PDF_LOAD_TIMEOUT_MS);
|
|
596
596
|
})
|
|
597
597
|
]);
|
|
@@ -605,7 +605,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
605
605
|
const doc = await loadPdfWithTimeout(buffer);
|
|
606
606
|
try {
|
|
607
607
|
const pageCount = doc.numPages;
|
|
608
|
-
if (pageCount === 0) throw new (0,
|
|
608
|
+
if (pageCount === 0) throw new (0, _chunkJ7DBL77Bcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
609
609
|
const metadata = { pageCount, pageMode: "layout" };
|
|
610
610
|
await extractPdfMetadata(doc, metadata);
|
|
611
611
|
const blocks = [];
|
|
@@ -632,8 +632,8 @@ async function parsePdfDocument(buffer, options) {
|
|
|
632
632
|
const viewport = page.getViewport({ scale: 1 });
|
|
633
633
|
pageHeights.set(i, viewport.height);
|
|
634
634
|
const rawItems = tc.items;
|
|
635
|
-
const items =
|
|
636
|
-
const { visible, hiddenCount } =
|
|
635
|
+
const items = _chunkCX2LRBC5cjs.normalizeItems.call(void 0, rawItems);
|
|
636
|
+
const { visible, hiddenCount } = _chunkCX2LRBC5cjs.filterHiddenText.call(void 0, items, viewport.width, viewport.height);
|
|
637
637
|
if (hiddenCount > 0) {
|
|
638
638
|
warnings.push({ page: i, message: `${hiddenCount}\uAC1C \uC228\uACA8\uC9C4 \uD14D\uC2A4\uD2B8 \uC694\uC18C \uD544\uD130\uB9C1\uB428`, code: "HIDDEN_TEXT_FILTERED" });
|
|
639
639
|
}
|
|
@@ -648,7 +648,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
648
648
|
const opList = await page.getOperatorList();
|
|
649
649
|
const pageArea = viewport.width * viewport.height;
|
|
650
650
|
if (pageArea > 0) {
|
|
651
|
-
const imageRegions =
|
|
651
|
+
const imageRegions = _chunkCX2LRBC5cjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
|
|
652
652
|
let uncovered = 0;
|
|
653
653
|
for (const r of imageRegions) {
|
|
654
654
|
const area = (r.x2 - r.x1) * (r.y2 - r.y1);
|
|
@@ -663,7 +663,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
663
663
|
}
|
|
664
664
|
if (uncovered > 0) skippedImagePages.set(i, uncovered);
|
|
665
665
|
}
|
|
666
|
-
const pageBlocks =
|
|
666
|
+
const pageBlocks = _chunkCX2LRBC5cjs.extractPageBlocksWithLines.call(void 0, visible, i, opList, viewport.width, viewport.height, void 0, _optionalChain([options, 'optionalAccess', _10 => _10.tables]) !== false);
|
|
667
667
|
for (const b of pageBlocks) blocks.push(b);
|
|
668
668
|
try {
|
|
669
669
|
const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings);
|
|
@@ -683,11 +683,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
683
683
|
pageText += pageText ? "\n" + t : t;
|
|
684
684
|
}
|
|
685
685
|
pageQuality.push(computePageQuality(i, pageText));
|
|
686
|
-
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0,
|
|
686
|
+
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkJ7DBL77Bcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
|
|
687
687
|
parsedPages++;
|
|
688
688
|
_optionalChain([options, 'optionalAccess', _11 => _11.onProgress, 'optionalCall', _12 => _12(parsedPages, totalTarget)]);
|
|
689
689
|
} catch (pageErr) {
|
|
690
|
-
if (pageErr instanceof
|
|
690
|
+
if (pageErr instanceof _chunkJ7DBL77Bcjs.KordocError) throw pageErr;
|
|
691
691
|
warnings.push({ page: i, message: `\uD398\uC774\uC9C0 ${i} \uD30C\uC2F1 \uC2E4\uD328: ${pageErr instanceof Error ? pageErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
|
|
692
692
|
}
|
|
693
693
|
}
|
|
@@ -708,7 +708,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
708
708
|
}
|
|
709
709
|
if (targets.size > 0) {
|
|
710
710
|
try {
|
|
711
|
-
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
711
|
+
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-BUBZA4EE.cjs")));
|
|
712
712
|
const mode = typeof options.ocr === "function" ? options.ocr : "builtin";
|
|
713
713
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options.onProgress, options.tables !== false);
|
|
714
714
|
if (ocrPageBlocks.size > 0) {
|
|
@@ -758,12 +758,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
758
758
|
}
|
|
759
759
|
}
|
|
760
760
|
if (_optionalChain([options, 'optionalAccess', _14 => _14.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
|
|
761
|
-
const removed =
|
|
761
|
+
const removed = _chunkCX2LRBC5cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings);
|
|
762
762
|
for (let ri = removed.length - 1; ri >= 0; ri--) {
|
|
763
763
|
blocks.splice(removed[ri], 1);
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
|
-
|
|
766
|
+
_chunkCX2LRBC5cjs.mergeCrossPageTables.call(void 0, blocks);
|
|
767
767
|
injectPageImageBlocks(blocks, pageImageBlocks);
|
|
768
768
|
if (_optionalChain([options, 'optionalAccess', _15 => _15.formulaOcr]) && formulaBuffer) {
|
|
769
769
|
try {
|
|
@@ -775,16 +775,16 @@ async function parsePdfDocument(buffer, options) {
|
|
|
775
775
|
});
|
|
776
776
|
}
|
|
777
777
|
}
|
|
778
|
-
const medianFontSize =
|
|
778
|
+
const medianFontSize = _chunkCX2LRBC5cjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
|
|
779
779
|
if (medianFontSize > 0) {
|
|
780
|
-
|
|
780
|
+
_chunkCX2LRBC5cjs.detectHeadings.call(void 0, blocks, medianFontSize);
|
|
781
781
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
782
|
+
_chunkCX2LRBC5cjs.detectMarkerHeadings.call(void 0, blocks);
|
|
783
|
+
_chunkCX2LRBC5cjs.detectTableCaptions.call(void 0, blocks);
|
|
784
|
+
_chunkCX2LRBC5cjs.detectKoreanListBlocks.call(void 0, blocks);
|
|
785
785
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
786
786
|
sanitizeBlockControlChars(blocks);
|
|
787
|
-
let markdown = cleanPdfText(
|
|
787
|
+
let markdown = cleanPdfText(_chunkGGZ5PSJOcjs.blocksToMarkdown.call(void 0, blocks));
|
|
788
788
|
return {
|
|
789
789
|
markdown,
|
|
790
790
|
blocks,
|
|
@@ -843,5 +843,5 @@ async function extractPdfMetadataOnly(buffer) {
|
|
|
843
843
|
|
|
844
844
|
|
|
845
845
|
|
|
846
|
-
exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks =
|
|
847
|
-
//# sourceMappingURL=parser-
|
|
846
|
+
exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkCX2LRBC5cjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkCX2LRBC5cjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = _chunkCX2LRBC5cjs.mergeCrossPageTables; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkCX2LRBC5cjs.removeHeaderFooterBlocks;
|
|
847
|
+
//# sourceMappingURL=parser-GIVQWVKJ.cjs.map
|