kordoc 4.17.0 → 4.17.2
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 +6 -3
- package/dist/{-PRAKO6M4.js → -2UA2JHVA.js} +11 -11
- package/dist/{chunk-I5DJOP62.js → chunk-2XHXABCX.js} +2 -2
- package/dist/{chunk-4XVNQAK5.js → chunk-3N272C5L.js} +244 -115
- package/dist/chunk-3N272C5L.js.map +1 -0
- package/dist/{chunk-6RGGYQQC.js → chunk-4HRJISJF.js} +3 -3
- package/dist/{chunk-WN6OD2CQ.js → chunk-4TSYMJDL.js} +243 -114
- package/dist/chunk-4TSYMJDL.js.map +1 -0
- package/dist/{chunk-EFO6JZY6.js → chunk-5JZEY5IL.js} +119 -77
- package/dist/chunk-5JZEY5IL.js.map +1 -0
- package/dist/{chunk-WYON5ANU.cjs → chunk-6DOCSYEM.cjs} +113 -71
- package/dist/chunk-6DOCSYEM.cjs.map +1 -0
- package/dist/{chunk-BZG7K44Z.js → chunk-6OCKAXIS.js} +2 -2
- package/dist/{chunk-ZF6KHPB7.js → chunk-A2W2JQ3S.js} +11 -5
- package/dist/chunk-A2W2JQ3S.js.map +1 -0
- package/dist/{chunk-N6V7LQBL.js → chunk-C4MVZXB5.js} +2 -2
- package/dist/{chunk-4GSF2R7T.js → chunk-FGL4IGOT.js} +4 -4
- package/dist/{chunk-R2BUANHQ.cjs → chunk-GPC72VSF.cjs} +6 -6
- package/dist/chunk-GPC72VSF.cjs.map +1 -0
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-TDQ6XDB3.js → chunk-GYTL6WT3.js} +3 -3
- package/dist/{chunk-O7OUX6NU.cjs → chunk-HAW2VL62.cjs} +12 -12
- package/dist/chunk-HAW2VL62.cjs.map +1 -0
- package/dist/chunk-J55UQC5H.cjs.map +1 -1
- package/dist/{chunk-QJWVMPB6.js → chunk-JY2NBFIG.js} +15 -13
- package/dist/chunk-JY2NBFIG.js.map +1 -0
- package/dist/{chunk-A55JGNKD.js → chunk-KQIYC2ZU.js} +2 -2
- package/dist/{chunk-QNJLLF4J.cjs → chunk-KZVQK5NS.cjs} +11 -5
- package/dist/chunk-KZVQK5NS.cjs.map +1 -0
- package/dist/{chunk-PHID6WNG.js → chunk-MDCTITUG.js} +2 -2
- package/dist/{chunk-2KF5WZCR.js → chunk-O4CB7D2Q.js} +2 -2
- package/dist/{chunk-YZ5HHS6A.js → chunk-SDRKHEVT.js} +2 -2
- package/dist/{chunk-MJBCXW5R.js → chunk-UX3HHAWH.js} +1 -1
- package/dist/{chunk-MJBCXW5R.js.map → chunk-UX3HHAWH.js.map} +1 -1
- package/dist/{chunk-K2VYABZ3.js → chunk-VU26WGE5.js} +102 -38
- package/dist/chunk-VU26WGE5.js.map +1 -0
- package/dist/{chunk-BFT5IM2R.js → chunk-WJLICIYV.js} +2 -2
- package/dist/{chunk-5CDUL6PH.js → chunk-WL3BWROT.js} +1 -1
- package/dist/{chunk-5CDUL6PH.js.map → chunk-WL3BWROT.js.map} +1 -1
- package/dist/{chunk-XEPKOC2O.cjs → chunk-WWMKIHF7.cjs} +344 -215
- package/dist/chunk-WWMKIHF7.cjs.map +1 -0
- package/dist/{chunk-BLPR4HRF.js → chunk-XZA6X34R.js} +121 -77
- package/dist/chunk-XZA6X34R.js.map +1 -0
- package/dist/{chunk-ML4NHUR7.js → chunk-YGKC6E6A.js} +11 -5
- package/dist/chunk-YGKC6E6A.js.map +1 -0
- package/dist/{chunk-AKB72TEH.cjs → chunk-YIANW5QX.cjs} +1 -1
- package/dist/chunk-YIANW5QX.cjs.map +1 -0
- package/dist/{chunk-WY5JAR4O.js → chunk-ZDX5PIWR.js} +2 -2
- package/dist/chunks-EBWJR55V.js +10 -0
- package/dist/cli.js +26 -26
- package/dist/{formula-ECNOZT36.cjs → formula-5RETDCIC.cjs} +9 -9
- package/dist/formula-5RETDCIC.cjs.map +1 -0
- package/dist/{formula-7MMFBRGJ.js → formula-MBLN2DG4.js} +4 -4
- package/dist/{formula-SHBXRXOJ.js → formula-QZZDW5GW.js} +3 -3
- package/dist/{image-ocr-P6ECJCT2.js → image-ocr-CJSO3QSR.js} +8 -8
- package/dist/{image-ocr-QCT3A7X5.js → image-ocr-EREKAS47.js} +6 -6
- package/dist/{image-ocr-VUDSP2B4.cjs → image-ocr-PSPVRLB5.cjs} +15 -15
- package/dist/image-ocr-PSPVRLB5.cjs.map +1 -0
- package/dist/index.cjs +688 -622
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +106 -40
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-OUHGCEZY.js → model-bundle-MA4MMCRJ.js} +5 -5
- package/dist/{models-6D6LMOTH.js → models-SEJ7LNSN.js} +5 -5
- package/dist/page-range-QHHFTL7X.cjs.map +1 -1
- package/dist/{parser-ZPRQ3SSU.js → parser-M5WHRX25.js} +41 -23
- package/dist/parser-M5WHRX25.js.map +1 -0
- package/dist/{parser-RQ4PJRTJ.cjs → parser-QILYPWSI.cjs} +215 -197
- package/dist/parser-QILYPWSI.cjs.map +1 -0
- package/dist/{parser-CTRB7PKD.js → parser-VH3F4EQU.js} +38 -20
- package/dist/parser-VH3F4EQU.js.map +1 -0
- package/dist/pdf-ocr-3SZUM3CN.cjs +16 -0
- package/dist/pdf-ocr-3SZUM3CN.cjs.map +1 -0
- package/dist/pdf-ocr-QB2TB5W5.js +18 -0
- package/dist/pdf-ocr-XC33L43D.js +15 -0
- package/dist/{profile-io-YZUW6MAN.js → profile-io-5YB627EO.js} +3 -3
- package/dist/{rasterize-OUR2QJXX.js → rasterize-V2XHHS2I.js} +3 -3
- package/dist/{redact-doc-4OQKG4SM.js → redact-doc-5MK5L5IQ.js} +11 -11
- package/dist/{render-XNO6PZJO.js → render-SYZMHYK6.js} +7 -7
- package/dist/seal-IPKIQHYB.js +10 -0
- package/dist/{setup-UU3EIHNI.js → setup-ZPLJENSK.js} +3 -3
- package/dist/visual-RTTGNOAE.js +20 -0
- package/dist/{watch-SR6Q5SQN.js → watch-FNWHVKK3.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-4XVNQAK5.js.map +0 -1
- package/dist/chunk-AKB72TEH.cjs.map +0 -1
- package/dist/chunk-BLPR4HRF.js.map +0 -1
- package/dist/chunk-EFO6JZY6.js.map +0 -1
- package/dist/chunk-K2VYABZ3.js.map +0 -1
- package/dist/chunk-ML4NHUR7.js.map +0 -1
- package/dist/chunk-O7OUX6NU.cjs.map +0 -1
- package/dist/chunk-QJWVMPB6.js.map +0 -1
- package/dist/chunk-QNJLLF4J.cjs.map +0 -1
- package/dist/chunk-R2BUANHQ.cjs.map +0 -1
- package/dist/chunk-WN6OD2CQ.js.map +0 -1
- package/dist/chunk-WYON5ANU.cjs.map +0 -1
- package/dist/chunk-XEPKOC2O.cjs.map +0 -1
- package/dist/chunk-ZF6KHPB7.js.map +0 -1
- package/dist/chunks-YBFBLJ4G.js +0 -10
- package/dist/formula-ECNOZT36.cjs.map +0 -1
- package/dist/image-ocr-VUDSP2B4.cjs.map +0 -1
- package/dist/parser-CTRB7PKD.js.map +0 -1
- package/dist/parser-RQ4PJRTJ.cjs.map +0 -1
- package/dist/parser-ZPRQ3SSU.js.map +0 -1
- package/dist/pdf-ocr-462ZFSHX.js +0 -15
- package/dist/pdf-ocr-L35FQYGP.js +0 -18
- package/dist/pdf-ocr-STK5EQFF.cjs +0 -16
- package/dist/pdf-ocr-STK5EQFF.cjs.map +0 -1
- package/dist/seal-CJ7C44JN.js +0 -10
- package/dist/visual-QRMRFPUK.js +0 -20
- /package/dist/{-PRAKO6M4.js.map → -2UA2JHVA.js.map} +0 -0
- /package/dist/{chunk-I5DJOP62.js.map → chunk-2XHXABCX.js.map} +0 -0
- /package/dist/{chunk-6RGGYQQC.js.map → chunk-4HRJISJF.js.map} +0 -0
- /package/dist/{chunk-BZG7K44Z.js.map → chunk-6OCKAXIS.js.map} +0 -0
- /package/dist/{chunk-N6V7LQBL.js.map → chunk-C4MVZXB5.js.map} +0 -0
- /package/dist/{chunk-4GSF2R7T.js.map → chunk-FGL4IGOT.js.map} +0 -0
- /package/dist/{chunk-TDQ6XDB3.js.map → chunk-GYTL6WT3.js.map} +0 -0
- /package/dist/{chunk-A55JGNKD.js.map → chunk-KQIYC2ZU.js.map} +0 -0
- /package/dist/{chunk-PHID6WNG.js.map → chunk-MDCTITUG.js.map} +0 -0
- /package/dist/{chunk-2KF5WZCR.js.map → chunk-O4CB7D2Q.js.map} +0 -0
- /package/dist/{chunk-YZ5HHS6A.js.map → chunk-SDRKHEVT.js.map} +0 -0
- /package/dist/{chunk-BFT5IM2R.js.map → chunk-WJLICIYV.js.map} +0 -0
- /package/dist/{chunk-WY5JAR4O.js.map → chunk-ZDX5PIWR.js.map} +0 -0
- /package/dist/{chunks-YBFBLJ4G.js.map → chunks-EBWJR55V.js.map} +0 -0
- /package/dist/{formula-7MMFBRGJ.js.map → formula-MBLN2DG4.js.map} +0 -0
- /package/dist/{formula-SHBXRXOJ.js.map → formula-QZZDW5GW.js.map} +0 -0
- /package/dist/{image-ocr-P6ECJCT2.js.map → image-ocr-CJSO3QSR.js.map} +0 -0
- /package/dist/{image-ocr-QCT3A7X5.js.map → image-ocr-EREKAS47.js.map} +0 -0
- /package/dist/{model-bundle-OUHGCEZY.js.map → model-bundle-MA4MMCRJ.js.map} +0 -0
- /package/dist/{models-6D6LMOTH.js.map → models-SEJ7LNSN.js.map} +0 -0
- /package/dist/{pdf-ocr-462ZFSHX.js.map → pdf-ocr-QB2TB5W5.js.map} +0 -0
- /package/dist/{pdf-ocr-L35FQYGP.js.map → pdf-ocr-XC33L43D.js.map} +0 -0
- /package/dist/{profile-io-YZUW6MAN.js.map → profile-io-5YB627EO.js.map} +0 -0
- /package/dist/{rasterize-OUR2QJXX.js.map → rasterize-V2XHHS2I.js.map} +0 -0
- /package/dist/{redact-doc-4OQKG4SM.js.map → redact-doc-5MK5L5IQ.js.map} +0 -0
- /package/dist/{render-XNO6PZJO.js.map → render-SYZMHYK6.js.map} +0 -0
- /package/dist/{seal-CJ7C44JN.js.map → seal-IPKIQHYB.js.map} +0 -0
- /package/dist/{setup-UU3EIHNI.js.map → setup-ZPLJENSK.js.map} +0 -0
- /package/dist/{visual-QRMRFPUK.js.map → visual-RTTGNOAE.js.map} +0 -0
- /package/dist/{watch-SR6Q5SQN.js.map → watch-FNWHVKK3.js.map} +0 -0
package/dist/mcp.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
assertWithinRoot,
|
|
4
4
|
getAccessRoot,
|
|
5
5
|
isOfflineMode
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6OCKAXIS.js";
|
|
7
7
|
import {
|
|
8
8
|
APPROVAL_MAX,
|
|
9
9
|
BODY_FONTS,
|
|
@@ -43,25 +43,25 @@ import {
|
|
|
43
43
|
resolveBuiltinTemplate,
|
|
44
44
|
unknownFontWarnings,
|
|
45
45
|
usesGaejosikMunche
|
|
46
|
-
} from "./chunk-
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-
|
|
46
|
+
} from "./chunk-VU26WGE5.js";
|
|
47
|
+
import "./chunk-O4CB7D2Q.js";
|
|
48
|
+
import "./chunk-4HRJISJF.js";
|
|
49
49
|
import "./chunk-3WSNLH4B.js";
|
|
50
|
-
import "./chunk-
|
|
50
|
+
import "./chunk-C4MVZXB5.js";
|
|
51
51
|
import {
|
|
52
52
|
detectFormat,
|
|
53
53
|
detectOle2Format,
|
|
54
54
|
detectZipFormat,
|
|
55
55
|
extractHwp5MetadataOnly
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-JY2NBFIG.js";
|
|
57
57
|
import "./chunk-7FCNOKOR.js";
|
|
58
|
-
import "./chunk-
|
|
58
|
+
import "./chunk-WL3BWROT.js";
|
|
59
59
|
import "./chunk-VQFA55IC.js";
|
|
60
|
-
import "./chunk-
|
|
60
|
+
import "./chunk-2XHXABCX.js";
|
|
61
61
|
import {
|
|
62
62
|
blocksToMarkdown
|
|
63
|
-
} from "./chunk-
|
|
64
|
-
import "./chunk-
|
|
63
|
+
} from "./chunk-WJLICIYV.js";
|
|
64
|
+
import "./chunk-MDCTITUG.js";
|
|
65
65
|
import {
|
|
66
66
|
KordocError,
|
|
67
67
|
VERSION,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
routeConsoleToStderr,
|
|
70
70
|
sanitizeError,
|
|
71
71
|
toArrayBuffer
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-A2W2JQ3S.js";
|
|
73
73
|
|
|
74
74
|
// src/mcp.ts
|
|
75
75
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -355,7 +355,7 @@ ${markdown}`);
|
|
|
355
355
|
break;
|
|
356
356
|
case "pdf":
|
|
357
357
|
try {
|
|
358
|
-
const { extractPdfMetadataOnly } = await import("./parser-
|
|
358
|
+
const { extractPdfMetadataOnly } = await import("./parser-M5WHRX25.js");
|
|
359
359
|
metadata = await extractPdfMetadataOnly(buffer);
|
|
360
360
|
} catch {
|
|
361
361
|
metadata = void 0;
|
|
@@ -531,7 +531,7 @@ ${tableMarkdown}` }]
|
|
|
531
531
|
if (!parsed.success) {
|
|
532
532
|
return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
|
|
533
533
|
}
|
|
534
|
-
const { blocksToChunks } = await import("./chunks-
|
|
534
|
+
const { blocksToChunks } = await import("./chunks-EBWJR55V.js");
|
|
535
535
|
const chunks = blocksToChunks(parsed.blocks, { granularity, includeTableCells: include_table_cells });
|
|
536
536
|
return { content: [{ type: "text", text: capResponseText(JSON.stringify(chunks, null, 2)) }] };
|
|
537
537
|
} catch (err) {
|
|
@@ -776,7 +776,7 @@ ${previewMd}` }]
|
|
|
776
776
|
}
|
|
777
777
|
const image = new Uint8Array(await readFile2(imgResolved));
|
|
778
778
|
const ext = extname2(imgResolved).slice(1).toLowerCase();
|
|
779
|
-
const { placeSealHwpx } = await import("./seal-
|
|
779
|
+
const { placeSealHwpx } = await import("./seal-IPKIQHYB.js");
|
|
780
780
|
const result = await placeSealHwpx(buffer, [{
|
|
781
781
|
anchor,
|
|
782
782
|
occurrence,
|
|
@@ -893,7 +893,7 @@ ${previewMd}` }]
|
|
|
893
893
|
if (outPath && await isSameFile(outPath, resolved)) {
|
|
894
894
|
return { content: [{ type: "text", text: "output_path\uAC00 \uC785\uB825 \uD30C\uC77C\uACFC \uAC19\uC2B5\uB2C8\uB2E4 \u2014 \uC6D0\uBCF8\uC744 \uB36E\uC5B4\uC4F0\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uB2E4\uB978 \uACBD\uB85C\uB97C \uC9C0\uC815\uD558\uC138\uC694." }], isError: true };
|
|
895
895
|
}
|
|
896
|
-
const { redactDocument } = await import("./redact-doc-
|
|
896
|
+
const { redactDocument } = await import("./redact-doc-5MK5L5IQ.js");
|
|
897
897
|
const r = await redactDocument(buffer, { rules, maskChar: mask_char, filePath: file_path, dryRun: dry_run });
|
|
898
898
|
const MAX_LINES = 50;
|
|
899
899
|
const listed = r.fileHits.length > 0 ? r.fileHits.map((h) => ` - [${h.rule}] ${h.masked} (${h.where} @ ${h.part})`) : r.markdownHits.map((h) => ` - [${h.rule}] ${h.masked}`);
|
|
@@ -967,7 +967,7 @@ function registerRenderTools(server2) {
|
|
|
967
967
|
const { buffer, resolved } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
|
|
968
968
|
const isHwp5 = resolved.toLowerCase().endsWith(".hwp");
|
|
969
969
|
if (!isHwp5 && !pages && (format === "png" || format === "svg")) {
|
|
970
|
-
const { renderHwpxToSvg } = await import("./render-
|
|
970
|
+
const { renderHwpxToSvg } = await import("./render-SYZMHYK6.js");
|
|
971
971
|
const result = await renderHwpxToSvg(buffer, { highlights, reflow: true, reflowMode: reflow_mode });
|
|
972
972
|
const summary2 = [
|
|
973
973
|
`\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})`,
|
|
@@ -979,7 +979,7 @@ function registerRenderTools(server2) {
|
|
|
979
979
|
summary2.push(`\uC800\uC7A5: ${outPath}`);
|
|
980
980
|
return { content: [{ type: "text", text: summary2.join("\n") }] };
|
|
981
981
|
}
|
|
982
|
-
const { rasterizeSvg } = await import("./rasterize-
|
|
982
|
+
const { rasterizeSvg } = await import("./rasterize-V2XHHS2I.js");
|
|
983
983
|
const raster = await rasterizeSvg(result.svg, result.width, result.height, max_width_px ? { maxWidthPx: max_width_px } : void 0);
|
|
984
984
|
if (outPath) {
|
|
985
985
|
await mkdir2(dirname3(outPath), { recursive: true });
|
|
@@ -994,7 +994,7 @@ function registerRenderTools(server2) {
|
|
|
994
994
|
]
|
|
995
995
|
};
|
|
996
996
|
}
|
|
997
|
-
const { renderDocument } = await import("./render-
|
|
997
|
+
const { renderDocument } = await import("./render-SYZMHYK6.js");
|
|
998
998
|
const { scene, assets } = await renderDocument(buffer, { format, pages, highlights, reflow: true, reflowMode: reflow_mode, maxWidthPx: max_width_px });
|
|
999
999
|
const summary = [
|
|
1000
1000
|
`\uB80C\uB354 \uC644\uB8CC: \uBB38\uC11C ${scene.pages.length}\uD398\uC774\uC9C0 \uC911 ${assets.filter((a) => a.page !== void 0).length || 1}\uAC74 (\uD14D\uC2A4\uD2B8 ${scene.stats.texts}\xB7\uC774\uBBF8\uC9C0 ${scene.stats.images}\xB7\uD45C ${scene.stats.tables}\xB7\uB3C4\uD615 ${scene.stats.shapes})`,
|
|
@@ -1044,7 +1044,7 @@ function registerRenderTools(server2) {
|
|
|
1044
1044
|
try {
|
|
1045
1045
|
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
|
|
1046
1046
|
const dir = safeOutputPath(join2(output_dir, "regions.json"), /* @__PURE__ */ new Set([".json"])).replace(/[\\/]regions\.json$/, "");
|
|
1047
|
-
const { extractRenderedRegions } = await import("./render-
|
|
1047
|
+
const { extractRenderedRegions } = await import("./render-SYZMHYK6.js");
|
|
1048
1048
|
const regions = await extractRenderedRegions(buffer, { types: target, format, pages, paddingPt: padding_pt, reflow: true });
|
|
1049
1049
|
await mkdir2(dir, { recursive: true });
|
|
1050
1050
|
const ext = format === "jpeg" ? "jpg" : "png";
|
|
@@ -1080,7 +1080,7 @@ function registerRenderTools(server2) {
|
|
|
1080
1080
|
}
|
|
1081
1081
|
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
|
|
1082
1082
|
const dir = output_dir ? safeOutputPath(join2(output_dir, "tables.json"), /* @__PURE__ */ new Set([".json"])).replace(/[\\/]tables\.json$/, "") : void 0;
|
|
1083
|
-
const { extractTables } = await import("./visual-
|
|
1083
|
+
const { extractTables } = await import("./visual-RTTGNOAE.js");
|
|
1084
1084
|
const tables = await extractTables(buffer, { policy: visual, format, paddingPt: padding_pt });
|
|
1085
1085
|
if (dir) await mkdir2(dir, { recursive: true });
|
|
1086
1086
|
const ext = format === "jpeg" ? "jpg" : "png";
|
|
@@ -1137,7 +1137,7 @@ function registerGenerateTools(server2) {
|
|
|
1137
1137
|
try {
|
|
1138
1138
|
const out = safeOutputPath(output_path, PROFILE_EXTENSIONS);
|
|
1139
1139
|
const { buffer } = await readValidatedFile(hwpx_path);
|
|
1140
|
-
const { hwpxToProfile } = await import("./-
|
|
1140
|
+
const { hwpxToProfile } = await import("./-2UA2JHVA.js");
|
|
1141
1141
|
const profile = await hwpxToProfile(buffer);
|
|
1142
1142
|
await mkdir3(dirname4(out), { recursive: true });
|
|
1143
1143
|
await writeOutputFile(out, JSON.stringify(profile, null, 2));
|
|
@@ -1244,7 +1244,7 @@ function registerGenerateTools(server2) {
|
|
|
1244
1244
|
}
|
|
1245
1245
|
let profile;
|
|
1246
1246
|
if (profile_path) {
|
|
1247
|
-
const { parseFormatProfileJson } = await import("./profile-io-
|
|
1247
|
+
const { parseFormatProfileJson } = await import("./profile-io-5YB627EO.js");
|
|
1248
1248
|
profile = parseFormatProfileJson(await readFile3(safePath(profile_path, PROFILE_EXTENSIONS), "utf-8"));
|
|
1249
1249
|
}
|
|
1250
1250
|
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-KQIYC2ZU.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-XZA6X34R.js";
|
|
10
|
+
import "./chunk-6OCKAXIS.js";
|
|
11
|
+
import "./chunk-A2W2JQ3S.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-MA4MMCRJ.js.map
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
ocrModelPath,
|
|
11
11
|
ocrModelsCached,
|
|
12
12
|
parseCharacterDict
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-KQIYC2ZU.js";
|
|
14
|
+
import "./chunk-XZA6X34R.js";
|
|
15
|
+
import "./chunk-6OCKAXIS.js";
|
|
16
|
+
import "./chunk-A2W2JQ3S.js";
|
|
17
17
|
export {
|
|
18
18
|
ALL_OCR_MODELS,
|
|
19
19
|
OCR_DET_MODEL,
|
|
@@ -26,4 +26,4 @@ export {
|
|
|
26
26
|
ocrModelsCached,
|
|
27
27
|
parseCharacterDict
|
|
28
28
|
};
|
|
29
|
-
//# sourceMappingURL=models-
|
|
29
|
+
//# sourceMappingURL=models-SEJ7LNSN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/
|
|
1
|
+
{"version":3,"sources":["/Users/mong-e/workspace/kordoc-quality-99/dist/page-range-QHHFTL7X.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,qIAAC","file":"/Users/mong-e/workspace/kordoc-quality-99/dist/page-range-QHHFTL7X.cjs"}
|
|
@@ -39,15 +39,15 @@ import {
|
|
|
39
39
|
startsNewItem,
|
|
40
40
|
trimTrailingEmptyTableCols,
|
|
41
41
|
wrapJoiner
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-4TSYMJDL.js";
|
|
43
43
|
import {
|
|
44
44
|
ocrModelsCached
|
|
45
|
-
} from "./chunk-
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
45
|
+
} from "./chunk-KQIYC2ZU.js";
|
|
46
|
+
import "./chunk-XZA6X34R.js";
|
|
47
|
+
import "./chunk-6OCKAXIS.js";
|
|
48
48
|
import {
|
|
49
49
|
blocksToPages
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-O4CB7D2Q.js";
|
|
51
51
|
import {
|
|
52
52
|
encodePng
|
|
53
53
|
} from "./chunk-7FCNOKOR.js";
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
CONTENT_CELLS,
|
|
57
57
|
stripScriptTags,
|
|
58
58
|
unframeLayoutTables
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-WL3BWROT.js";
|
|
60
60
|
import {
|
|
61
61
|
hasRequestedPagesAfter,
|
|
62
62
|
parsePageRange
|
|
@@ -65,11 +65,11 @@ import {
|
|
|
65
65
|
WINGDINGS,
|
|
66
66
|
blocksToMarkdown,
|
|
67
67
|
escapeLiteralDollar
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-WJLICIYV.js";
|
|
69
69
|
import {
|
|
70
70
|
KordocError,
|
|
71
71
|
sanitizeHref
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-A2W2JQ3S.js";
|
|
73
73
|
|
|
74
74
|
// src/pdf/ocr-region-merge.ts
|
|
75
75
|
function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
|
|
@@ -689,6 +689,7 @@ function splitContactTables(blocks) {
|
|
|
689
689
|
}
|
|
690
690
|
|
|
691
691
|
// src/pdf/table-parts.ts
|
|
692
|
+
var flowText = (text) => text.replace(/<\/?u>|~~/g, "");
|
|
692
693
|
var PART_COL_TOL = 1;
|
|
693
694
|
var PART_COL_SNAP = 0.3;
|
|
694
695
|
function anchorsOf(table) {
|
|
@@ -736,7 +737,7 @@ var indexOf = (coords, x) => {
|
|
|
736
737
|
}
|
|
737
738
|
return bestD <= PART_COL_TOL ? best : -1;
|
|
738
739
|
};
|
|
739
|
-
var rowText = (anchors, r) => anchors.filter((a) => a.r === r).map((a) => a.cell.text.replace(/\s+/g, "")).join("|");
|
|
740
|
+
var rowText = (anchors, r) => anchors.filter((a) => a.r === r).map((a) => flowText(a.cell.text).replace(/\s+/g, "")).join("|");
|
|
740
741
|
var hasText = (t) => t.replace(/\|/g, "") !== "";
|
|
741
742
|
function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
742
743
|
if (pcx.length !== prev.cols + 1 || ccx.length !== curr.cols + 1) return null;
|
|
@@ -952,8 +953,8 @@ function continuesAcross(u, d, x1, x2) {
|
|
|
952
953
|
var OUTLINE_HEAD = /^[□■]\s*\S/;
|
|
953
954
|
var OUTLINE_ITEM = /^[ㅇ○◦\-‐–·․‧※*]\s*\S/;
|
|
954
955
|
function outlineContinues(u, d) {
|
|
955
|
-
const U = u.text.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
956
|
-
const D = d.text.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
956
|
+
const U = flowText(u.text).split("\n").map((l) => l.trim()).filter(Boolean);
|
|
957
|
+
const D = flowText(d.text).split("\n").map((l) => l.trim()).filter(Boolean);
|
|
957
958
|
return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
|
|
958
959
|
}
|
|
959
960
|
function lineEnded(c, x1, x2, next) {
|
|
@@ -965,7 +966,7 @@ function lineEnded(c, x1, x2, next) {
|
|
|
965
966
|
return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(next?.text ?? "")) * h;
|
|
966
967
|
}
|
|
967
968
|
function firstWordUnits(text) {
|
|
968
|
-
const word = text.trim().replace(/^([(\[「『<〈])\s+/, "$1").split(/\s+/)[0] ?? "";
|
|
969
|
+
const word = flowText(text).trim().replace(/^([(\[「『<〈])\s+/, "$1").split(/\s+/)[0] ?? "";
|
|
969
970
|
let units = 0;
|
|
970
971
|
for (const ch of word) units += /[가-힣\u3400-\u9fff]/.test(ch) ? 1 : 0.55;
|
|
971
972
|
return units;
|
|
@@ -985,7 +986,7 @@ var batchim = (ch) => {
|
|
|
985
986
|
return k >= 0 && k < 11172 && k % 28 !== 0;
|
|
986
987
|
};
|
|
987
988
|
function clauseContinues(u, d) {
|
|
988
|
-
const tail = u.text.trim().split(/\s+/).pop() ?? "", head = d.text.trim();
|
|
989
|
+
const tail = flowText(u.text).trim().split(/\s+/).pop() ?? "", head = flowText(d.text).trim();
|
|
989
990
|
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || startsNewItem(u.text, head)) return false;
|
|
990
991
|
const last = tail[tail.length - 1], before = tail[tail.length - 2];
|
|
991
992
|
return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
|
|
@@ -998,6 +999,7 @@ function wordOverflows(u, d, x1, x2) {
|
|
|
998
999
|
}
|
|
999
1000
|
var KO_ORDER = "\uAC00\uB098\uB2E4\uB77C\uB9C8\uBC14\uC0AC\uC544\uC790\uCC28\uCE74\uD0C0\uD30C\uD558";
|
|
1000
1001
|
function itemMark(line) {
|
|
1002
|
+
line = flowText(line).trim();
|
|
1001
1003
|
let m = /^(\d{1,2})([.)])(?!\d)/.exec(line);
|
|
1002
1004
|
if (m) return { style: "1" + m[2], n: +m[1] };
|
|
1003
1005
|
if (m = /^\((\d{1,2})\)/.exec(line)) return { style: "(1)", n: +m[1] };
|
|
@@ -1049,7 +1051,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
|
|
|
1049
1051
|
const contentPairs = pairs.filter(([u, d]) => hasContent(u.cell) && hasContent(d.cell));
|
|
1050
1052
|
const carriedSplit = !textOnly && carried && !newCell && (contentPairs.length <= 1 || contentPairs.every(([, d]) => d.rs > 1) || !cut.ruled && contentPairs.some(([u, d]) => wordOverflows(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs])));
|
|
1051
1053
|
if (!carriedSplit) {
|
|
1052
|
-
const norm = (c) => c.text.replace(/\s+/g, "");
|
|
1054
|
+
const norm = (c) => flowText(c.text).replace(/\s+/g, "");
|
|
1053
1055
|
if (pairs.some(([u, d]) => hasContent(d.cell) && norm(cell(d)) !== norm(cell(u)) && lineEnded(cell(u), colXs[u.c], colXs[u.c + u.cs], cell(d)))) return false;
|
|
1054
1056
|
const flows = ([u, d]) => continuesAcross(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs]) || clauseContinues(cell(u), cell(d));
|
|
1055
1057
|
if (!(cut.open && !newCell)) {
|
|
@@ -1146,6 +1148,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
1146
1148
|
blocks.splice(j, 1);
|
|
1147
1149
|
continue;
|
|
1148
1150
|
}
|
|
1151
|
+
if (px && cx && !CLIP_TABLES.has(prev.table) && !CLIP_TABLES.has(curr.table) && currCells.length < curr.table.cells.length && curr.table.cells[0].filter((c) => c.text.trim()).length >= 2 && prev.table.cells.at(-1).concat(currCells[0]).every((c) => c.rowSpan === 1 && c.colSpan === 1 && CELL_LINES.has(c))) {
|
|
1152
|
+
const dx = px[0] - cx[0];
|
|
1153
|
+
const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
|
|
1154
|
+
if (part?.split && part.table.rows === prev.table.rows + currCells.length - 1) {
|
|
1155
|
+
const last = prev.table.rows - 1;
|
|
1156
|
+
for (let c = 0; c < part.table.cols; c++) {
|
|
1157
|
+
const U = CELL_LINES.get(prev.table.cells[last][c]), D = CELL_LINES.get(currCells[0][c]);
|
|
1158
|
+
CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
|
|
1159
|
+
}
|
|
1160
|
+
TABLE_COLXS.set(part.table, part.colXs);
|
|
1161
|
+
placeJoined(blocks, i, j, part.table);
|
|
1162
|
+
continue;
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1149
1165
|
const merged = {
|
|
1150
1166
|
rows: prev.table.rows + currCells.length,
|
|
1151
1167
|
cols: prev.table.cols,
|
|
@@ -1230,7 +1246,7 @@ function prevLacksLeftCols(prev, px, xs, pageHeights) {
|
|
|
1230
1246
|
return xs[0] < px[0] && xs.slice(1, -1).some((x) => Math.abs(x - px[0]) <= CONTINUATION_COL_TOL);
|
|
1231
1247
|
}
|
|
1232
1248
|
function headingRow(row) {
|
|
1233
|
-
const heads = row.map((c) => c.text.replace(/\s+/g, "")).filter(Boolean);
|
|
1249
|
+
const heads = row.map((c) => flowText(c.text).replace(/\s+/g, "")).filter(Boolean);
|
|
1234
1250
|
if (heads.length === 1) return heads[0].length <= 8 || /^[①-⑳❶-❿]/.test(heads[0]);
|
|
1235
1251
|
return heads.length === 2 && /^(?:\d{1,2}|[ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ]+|[①-⑳❶-❿])$/.test(heads[0]);
|
|
1236
1252
|
}
|
|
@@ -1241,7 +1257,7 @@ function looksContinued(prev, curr, pageHeights) {
|
|
|
1241
1257
|
const firstRow = curr.table.cells[0] ?? [];
|
|
1242
1258
|
const firstText = firstRow.find((c) => c.text.trim())?.text ?? "";
|
|
1243
1259
|
if (!ANNEX_HEAD_RE.test(firstText)) return true;
|
|
1244
|
-
const filled = firstRow.map((c) => c.text.replace(/\s+/g, "")).filter(Boolean);
|
|
1260
|
+
const filled = firstRow.map((c) => flowText(c.text).replace(/\s+/g, "")).filter(Boolean);
|
|
1245
1261
|
return filled.length >= 2 && filled.every((t) => t === filled[0]);
|
|
1246
1262
|
}
|
|
1247
1263
|
function pushedLead(prev, curr) {
|
|
@@ -1270,7 +1286,7 @@ function tailOf(b) {
|
|
|
1270
1286
|
function firstRowSig(t) {
|
|
1271
1287
|
const x = TABLE_COLXS.get(t);
|
|
1272
1288
|
if (!x || x.length !== t.cols + 1) return null;
|
|
1273
|
-
return anchorsOf(t).filter((a) => a.r === 0).map((a) => ({ x1: x[a.c], x2: x[a.c + a.cs], t: a.cell.text.replace(/\s+/g, "") }));
|
|
1289
|
+
return anchorsOf(t).filter((a) => a.r === 0).map((a) => ({ x1: x[a.c], x2: x[a.c + a.cs], t: flowText(a.cell.text).replace(/\s+/g, "") }));
|
|
1274
1290
|
}
|
|
1275
1291
|
function restartsTable(blocks, i, curr, pageHeights) {
|
|
1276
1292
|
const cs = firstRowSig(curr);
|
|
@@ -1295,7 +1311,7 @@ function restartsTitledForm(head, curr) {
|
|
|
1295
1311
|
if (head.rows < 2 || curr.rows < 2 || head.cols !== curr.cols) return false;
|
|
1296
1312
|
const full = (t) => t.cells[0][0]?.colSpan === t.cols;
|
|
1297
1313
|
if (!full(head) || !full(curr)) return false;
|
|
1298
|
-
const norm = (c) => (c?.text ?? "").replace(/\s+/g, "");
|
|
1314
|
+
const norm = (c) => flowText(c?.text ?? "").replace(/\s+/g, "");
|
|
1299
1315
|
const ht = norm(head.cells[0][0]), ct = norm(curr.cells[0][0]);
|
|
1300
1316
|
if (!ht || !ct || ht === ct) return false;
|
|
1301
1317
|
const titleLike = (t) => t.length <= TITLE_ROW_MAX_CHARS && !/^[ㅇ○◦•·\-–※*□■▪☞]/.test(t);
|
|
@@ -1331,7 +1347,7 @@ function chainHead(blocks, i, pageHeights) {
|
|
|
1331
1347
|
}
|
|
1332
1348
|
function rowTextsEqual(a, b) {
|
|
1333
1349
|
if (a.length !== b.length) return false;
|
|
1334
|
-
const norm = (t) => t.replace(/\s+/g, "");
|
|
1350
|
+
const norm = (t) => flowText(t).replace(/\s+/g, "");
|
|
1335
1351
|
for (let i = 0; i < a.length; i++) {
|
|
1336
1352
|
if (norm(a[i].text) !== norm(b[i].text)) return false;
|
|
1337
1353
|
}
|
|
@@ -2696,7 +2712,7 @@ function mergeLinkRuns(markdown) {
|
|
|
2696
2712
|
|
|
2697
2713
|
// src/pdf/formula-ocr.ts
|
|
2698
2714
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
2699
|
-
const formulaMod = await import("./formula-
|
|
2715
|
+
const formulaMod = await import("./formula-MBLN2DG4.js");
|
|
2700
2716
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
2701
2717
|
await ensureFormulaModels((p) => {
|
|
2702
2718
|
if (p.phase === "download" && p.total) {
|
|
@@ -3079,7 +3095,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3079
3095
|
}
|
|
3080
3096
|
if (targets.size > 0) {
|
|
3081
3097
|
try {
|
|
3082
|
-
const { runPdfOcr } = await import("./pdf-ocr-
|
|
3098
|
+
const { runPdfOcr } = await import("./pdf-ocr-QB2TB5W5.js");
|
|
3083
3099
|
const mode = typeof options?.ocr === "function" ? options.ocr : "builtin";
|
|
3084
3100
|
const regionPages = new Map([...ocrRegions].filter(([p]) => options?.ocr !== "force" && !isImageBased && !pageQuality.find((q) => q.page === p)?.needsOcr));
|
|
3085
3101
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options?.onProgress, options?.tables !== false, vectorPageOps, regionPages);
|
|
@@ -3204,7 +3220,8 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3204
3220
|
return b.bbox.y > h * 0.1 && b.bbox.y + b.bbox.height < h * 0.9;
|
|
3205
3221
|
});
|
|
3206
3222
|
joinLatinCellWraps(outBlocks);
|
|
3207
|
-
if (options?.layoutTables !== "keep"
|
|
3223
|
+
if (options?.layoutTables !== "keep") {
|
|
3224
|
+
const hancom = await isHancomPdf(doc);
|
|
3208
3225
|
const shown = /* @__PURE__ */ new Map();
|
|
3209
3226
|
const markContent = (bs) => {
|
|
3210
3227
|
for (const b of bs ?? []) if (b.table) for (const row of b.table.cells) for (const c of row) {
|
|
@@ -3214,6 +3231,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3214
3231
|
};
|
|
3215
3232
|
const visual = (bs) => bs.flatMap((b) => {
|
|
3216
3233
|
if (b.type !== "table") return [b];
|
|
3234
|
+
if (!hancom && b.table && CLIP_TABLES.has(b.table)) return [b];
|
|
3217
3235
|
let v = shown.get(b);
|
|
3218
3236
|
if (!v) {
|
|
3219
3237
|
markContent([b]);
|
|
@@ -3309,4 +3327,4 @@ export {
|
|
|
3309
3327
|
parsePdfDocument,
|
|
3310
3328
|
removeHeaderFooterBlocks
|
|
3311
3329
|
};
|
|
3312
|
-
//# sourceMappingURL=parser-
|
|
3330
|
+
//# sourceMappingURL=parser-M5WHRX25.js.map
|