kordoc 4.22.1 → 4.22.3
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 +12 -5
- package/dist/{-FYKHW5G6.js → -AOWV7MNY.js} +11 -11
- package/dist/{chunk-QH4B3PL7.js → chunk-24YLYR6Q.js} +4 -4
- package/dist/{chunk-OSFB5SQS.cjs → chunk-2BCQVQO2.cjs} +3 -3
- package/dist/{chunk-OSFB5SQS.cjs.map → chunk-2BCQVQO2.cjs.map} +1 -1
- package/dist/{chunk-5VBAHUGC.js → chunk-3ANXRVI2.js} +3 -3
- package/dist/{chunk-IB5TO2CO.js → chunk-3H2IEU4V.js} +2 -2
- package/dist/{chunk-MDS3GH43.js → chunk-4NQ4EZEE.js} +14 -4
- package/dist/chunk-4NQ4EZEE.js.map +1 -0
- package/dist/{chunk-7FASIFQP.js → chunk-6LIBF2ZB.js} +2 -2
- package/dist/{chunk-5SVJU22Z.js → chunk-6QBBGZST.js} +2 -2
- package/dist/{chunk-YE4IN3D7.js → chunk-7XITVUAK.js} +11 -11
- package/dist/{chunk-M4JC7TXG.js → chunk-AXX5AQT4.js} +4 -4
- package/dist/{chunk-AIAIBNIB.js → chunk-BS2XWGT5.js} +2 -2
- package/dist/{chunk-TSZQ4LMV.js → chunk-DKJ2RNDG.js} +2 -2
- package/dist/{chunk-7RND4SNB.js → chunk-FDFXL7VJ.js} +3 -3
- package/dist/{chunk-3SPOIAST.js → chunk-IRNWAHHZ.js} +2 -2
- package/dist/{chunk-SMPK5TUQ.js → chunk-J5PYESLX.js} +14 -4
- package/dist/chunk-J5PYESLX.js.map +1 -0
- package/dist/{chunk-5FD3LAKC.js → chunk-KBGNPGVY.js} +2 -2
- package/dist/{chunk-DOBJ7BW5.js → chunk-M2X766AY.js} +2 -2
- package/dist/{chunk-ME4NQSLE.js → chunk-MEIQ476H.js} +2 -2
- package/dist/{chunk-M2CBEXHN.cjs → chunk-MI655NV5.cjs} +2 -2
- package/dist/{chunk-M2CBEXHN.cjs.map → chunk-MI655NV5.cjs.map} +1 -1
- package/dist/{chunk-EXVTF6XE.cjs → chunk-NJEMRAIF.cjs} +24 -24
- package/dist/{chunk-EXVTF6XE.cjs.map → chunk-NJEMRAIF.cjs.map} +1 -1
- package/dist/{chunk-ZECSXHYP.cjs → chunk-NLGOMLGU.cjs} +188 -166
- package/dist/{chunk-ZECSXHYP.cjs.map → chunk-NLGOMLGU.cjs.map} +1 -1
- package/dist/{chunk-B35C5HJK.cjs → chunk-O3OS6FAW.cjs} +3 -3
- package/dist/{chunk-B35C5HJK.cjs.map → chunk-O3OS6FAW.cjs.map} +1 -1
- package/dist/{chunk-3H5QG6I2.js → chunk-O5E25RHU.js} +2 -2
- package/dist/{chunk-MGJYVNDX.js → chunk-OIF5HRVP.js} +29 -7
- package/dist/{chunk-JHHXTNZQ.js.map → chunk-OIF5HRVP.js.map} +1 -1
- package/dist/{chunk-RO7AORMO.cjs → chunk-SJ5OZXEL.cjs} +23 -13
- package/dist/chunk-SJ5OZXEL.cjs.map +1 -0
- package/dist/{chunk-JHHXTNZQ.js → chunk-SKRWKVVW.js} +28 -6
- package/dist/chunk-SKRWKVVW.js.map +1 -0
- package/dist/{chunk-LHO7E3RW.js → chunk-UCLDUUBX.js} +2 -2
- package/dist/{chunk-IK4W2M4P.js → chunk-VJCQOSMT.js} +2 -2
- package/dist/{chunk-ATODI25J.js → chunk-X45Q7EAC.js} +2 -2
- package/dist/{chunk-R37TFXMP.js → chunk-YOGMCRM7.js} +108 -29
- package/dist/chunk-YOGMCRM7.js.map +1 -0
- package/dist/chunks-7KXTS7IV.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-PYDSQGLS.cjs → formula-5V2WG4BH.cjs} +9 -9
- package/dist/{formula-PYDSQGLS.cjs.map → formula-5V2WG4BH.cjs.map} +1 -1
- package/dist/{formula-RUS4SF3O.js → formula-C26FMMGO.js} +3 -3
- package/dist/{formula-JBTYYSKB.js → formula-W4OL33YQ.js} +4 -4
- package/dist/{image-ocr-PLNNCEOR.cjs → image-ocr-BELHEWPX.cjs} +17 -17
- package/dist/{image-ocr-PLNNCEOR.cjs.map → image-ocr-BELHEWPX.cjs.map} +1 -1
- package/dist/{image-ocr-QJT4EIQU.js → image-ocr-NSQ34Y6T.js} +9 -9
- package/dist/{image-ocr-VA6WV6E4.js → image-ocr-T72HMX2W.js} +6 -6
- package/dist/index.cjs +507 -428
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +108 -29
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-U2YY7ATC.js → model-bundle-34T2LJB4.js} +5 -5
- package/dist/{models-BOJ2SFCR.js → models-TQH5EM6V.js} +5 -5
- package/dist/{parse-worker-v2-ZHMFK3U3.js → parse-worker-v2-YEYLILGJ.js} +12 -12
- package/dist/{parser-A2EWLK2J.js → parser-E6BG3ECD.js} +133 -27
- package/dist/parser-E6BG3ECD.js.map +1 -0
- package/dist/{parser-6337Z4U2.cjs → parser-OAXCXVQ4.cjs} +383 -277
- package/dist/parser-OAXCXVQ4.cjs.map +1 -0
- package/dist/{parser-HM6N7J4R.js → parser-SJHCBL7T.js} +136 -30
- package/dist/parser-SJHCBL7T.js.map +1 -0
- package/dist/{pdf-ocr-JDER5BHI.js → pdf-ocr-LGPSJM22.js} +6 -6
- package/dist/pdf-ocr-RKXDY3ZA.cjs +31 -0
- package/dist/{pdf-ocr-PGXNUFU7.cjs.map → pdf-ocr-RKXDY3ZA.cjs.map} +1 -1
- package/dist/{pdf-ocr-MEVC6HXG.js → pdf-ocr-T5ASSUKK.js} +9 -9
- package/dist/{profile-io-OJ23SPYO.js → profile-io-KMCAFTMG.js} +3 -3
- package/dist/{rasterize-76CWCLSU.js → rasterize-M52AKY7R.js} +3 -3
- package/dist/{redact-doc-EZQIHRVT.js → redact-doc-SWJC27LL.js} +11 -11
- package/dist/{render-JZFJPFWK.js → render-45AB5YZR.js} +7 -7
- package/dist/seal-7KWG6VHS.js +10 -0
- package/dist/{setup-RIVS74JN.js → setup-5PBMUI6M.js} +3 -3
- package/dist/visual-OMJNXLNZ.js +21 -0
- package/dist/{watch-WMH222E5.js → watch-QOGKV52T.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-MDS3GH43.js.map +0 -1
- package/dist/chunk-MGJYVNDX.js.map +0 -1
- package/dist/chunk-R37TFXMP.js.map +0 -1
- package/dist/chunk-RO7AORMO.cjs.map +0 -1
- package/dist/chunk-SMPK5TUQ.js.map +0 -1
- package/dist/chunks-4XIAEJEX.js +0 -10
- package/dist/parser-6337Z4U2.cjs.map +0 -1
- package/dist/parser-A2EWLK2J.js.map +0 -1
- package/dist/parser-HM6N7J4R.js.map +0 -1
- package/dist/pdf-ocr-PGXNUFU7.cjs +0 -31
- package/dist/seal-P2NOP4LC.js +0 -10
- package/dist/visual-R5GGZBTU.js +0 -21
- /package/dist/{-FYKHW5G6.js.map → -AOWV7MNY.js.map} +0 -0
- /package/dist/{chunk-QH4B3PL7.js.map → chunk-24YLYR6Q.js.map} +0 -0
- /package/dist/{chunk-5VBAHUGC.js.map → chunk-3ANXRVI2.js.map} +0 -0
- /package/dist/{chunk-IB5TO2CO.js.map → chunk-3H2IEU4V.js.map} +0 -0
- /package/dist/{chunk-7FASIFQP.js.map → chunk-6LIBF2ZB.js.map} +0 -0
- /package/dist/{chunk-5SVJU22Z.js.map → chunk-6QBBGZST.js.map} +0 -0
- /package/dist/{chunk-YE4IN3D7.js.map → chunk-7XITVUAK.js.map} +0 -0
- /package/dist/{chunk-M4JC7TXG.js.map → chunk-AXX5AQT4.js.map} +0 -0
- /package/dist/{chunk-AIAIBNIB.js.map → chunk-BS2XWGT5.js.map} +0 -0
- /package/dist/{chunk-TSZQ4LMV.js.map → chunk-DKJ2RNDG.js.map} +0 -0
- /package/dist/{chunk-7RND4SNB.js.map → chunk-FDFXL7VJ.js.map} +0 -0
- /package/dist/{chunk-3SPOIAST.js.map → chunk-IRNWAHHZ.js.map} +0 -0
- /package/dist/{chunk-5FD3LAKC.js.map → chunk-KBGNPGVY.js.map} +0 -0
- /package/dist/{chunk-DOBJ7BW5.js.map → chunk-M2X766AY.js.map} +0 -0
- /package/dist/{chunk-ME4NQSLE.js.map → chunk-MEIQ476H.js.map} +0 -0
- /package/dist/{chunk-3H5QG6I2.js.map → chunk-O5E25RHU.js.map} +0 -0
- /package/dist/{chunk-LHO7E3RW.js.map → chunk-UCLDUUBX.js.map} +0 -0
- /package/dist/{chunk-IK4W2M4P.js.map → chunk-VJCQOSMT.js.map} +0 -0
- /package/dist/{chunk-ATODI25J.js.map → chunk-X45Q7EAC.js.map} +0 -0
- /package/dist/{chunks-4XIAEJEX.js.map → chunks-7KXTS7IV.js.map} +0 -0
- /package/dist/{formula-RUS4SF3O.js.map → formula-C26FMMGO.js.map} +0 -0
- /package/dist/{formula-JBTYYSKB.js.map → formula-W4OL33YQ.js.map} +0 -0
- /package/dist/{image-ocr-QJT4EIQU.js.map → image-ocr-NSQ34Y6T.js.map} +0 -0
- /package/dist/{image-ocr-VA6WV6E4.js.map → image-ocr-T72HMX2W.js.map} +0 -0
- /package/dist/{model-bundle-U2YY7ATC.js.map → model-bundle-34T2LJB4.js.map} +0 -0
- /package/dist/{models-BOJ2SFCR.js.map → models-TQH5EM6V.js.map} +0 -0
- /package/dist/{parse-worker-v2-ZHMFK3U3.js.map → parse-worker-v2-YEYLILGJ.js.map} +0 -0
- /package/dist/{pdf-ocr-JDER5BHI.js.map → pdf-ocr-LGPSJM22.js.map} +0 -0
- /package/dist/{pdf-ocr-MEVC6HXG.js.map → pdf-ocr-T5ASSUKK.js.map} +0 -0
- /package/dist/{profile-io-OJ23SPYO.js.map → profile-io-KMCAFTMG.js.map} +0 -0
- /package/dist/{rasterize-76CWCLSU.js.map → rasterize-M52AKY7R.js.map} +0 -0
- /package/dist/{redact-doc-EZQIHRVT.js.map → redact-doc-SWJC27LL.js.map} +0 -0
- /package/dist/{render-JZFJPFWK.js.map → render-45AB5YZR.js.map} +0 -0
- /package/dist/{seal-P2NOP4LC.js.map → seal-7KWG6VHS.js.map} +0 -0
- /package/dist/{setup-RIVS74JN.js.map → setup-5PBMUI6M.js.map} +0 -0
- /package/dist/{visual-R5GGZBTU.js.map → visual-OMJNXLNZ.js.map} +0 -0
- /package/dist/{watch-WMH222E5.js.map → watch-QOGKV52T.js.map} +0 -0
package/dist/mcp.js
CHANGED
|
@@ -38,33 +38,33 @@ import {
|
|
|
38
38
|
resolveBuiltinTemplate,
|
|
39
39
|
unknownFontWarnings,
|
|
40
40
|
usesGaejosikMunche
|
|
41
|
-
} from "./chunk-
|
|
42
|
-
import "./chunk-
|
|
41
|
+
} from "./chunk-7XITVUAK.js";
|
|
42
|
+
import "./chunk-6LIBF2ZB.js";
|
|
43
43
|
import {
|
|
44
44
|
detectFormat,
|
|
45
45
|
detectOle2Format,
|
|
46
46
|
detectZipFormat,
|
|
47
47
|
extractHwp5MetadataOnly
|
|
48
|
-
} from "./chunk-
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
48
|
+
} from "./chunk-YOGMCRM7.js";
|
|
49
|
+
import "./chunk-6QBBGZST.js";
|
|
50
|
+
import "./chunk-KBGNPGVY.js";
|
|
51
51
|
import "./chunk-VKVDMH7X.js";
|
|
52
52
|
import "./chunk-VQFA55IC.js";
|
|
53
53
|
import "./chunk-BHVOY6V4.js";
|
|
54
|
-
import "./chunk-
|
|
54
|
+
import "./chunk-4NQ4EZEE.js";
|
|
55
55
|
import {
|
|
56
56
|
blocksToMarkdown
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-BS2XWGT5.js";
|
|
58
58
|
import {
|
|
59
59
|
assertWithinRoot,
|
|
60
60
|
getAccessRoot,
|
|
61
61
|
isOfflineMode
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-3H2IEU4V.js";
|
|
63
63
|
import {
|
|
64
64
|
extractFormFields,
|
|
65
65
|
fillWithUniqueGuard
|
|
66
|
-
} from "./chunk-
|
|
67
|
-
import "./chunk-
|
|
66
|
+
} from "./chunk-3ANXRVI2.js";
|
|
67
|
+
import "./chunk-UCLDUUBX.js";
|
|
68
68
|
import {
|
|
69
69
|
KordocError,
|
|
70
70
|
VERSION,
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
routeConsoleToStderr,
|
|
73
73
|
sanitizeError,
|
|
74
74
|
toArrayBuffer
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-DKJ2RNDG.js";
|
|
76
76
|
import "./chunk-3WSNLH4B.js";
|
|
77
77
|
|
|
78
78
|
// src/mcp.ts
|
|
@@ -371,7 +371,7 @@ ${markdown}`);
|
|
|
371
371
|
break;
|
|
372
372
|
case "pdf":
|
|
373
373
|
try {
|
|
374
|
-
const { extractPdfMetadataOnly } = await import("./parser-
|
|
374
|
+
const { extractPdfMetadataOnly } = await import("./parser-SJHCBL7T.js");
|
|
375
375
|
metadata = await extractPdfMetadataOnly(buffer);
|
|
376
376
|
} catch {
|
|
377
377
|
metadata = void 0;
|
|
@@ -548,7 +548,7 @@ ${tableMarkdown}` }]
|
|
|
548
548
|
if (!parsed.success) {
|
|
549
549
|
return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
|
|
550
550
|
}
|
|
551
|
-
const { blocksToChunks } = await import("./chunks-
|
|
551
|
+
const { blocksToChunks } = await import("./chunks-7KXTS7IV.js");
|
|
552
552
|
const chunks = blocksToChunks(parsed.blocks, { granularity, includeTableCells: include_table_cells });
|
|
553
553
|
return { content: [{ type: "text", text: capResponseText(JSON.stringify(chunks, null, 2)) }] };
|
|
554
554
|
} catch (err) {
|
|
@@ -818,7 +818,7 @@ ${previewMd}` }]
|
|
|
818
818
|
}
|
|
819
819
|
const image = new Uint8Array(await readFile2(imgResolved));
|
|
820
820
|
const ext = extname2(imgResolved).slice(1).toLowerCase();
|
|
821
|
-
const { placeSealHwpx } = await import("./seal-
|
|
821
|
+
const { placeSealHwpx } = await import("./seal-7KWG6VHS.js");
|
|
822
822
|
const result = await placeSealHwpx(buffer, [{
|
|
823
823
|
anchor,
|
|
824
824
|
occurrence,
|
|
@@ -935,7 +935,7 @@ ${previewMd}` }]
|
|
|
935
935
|
if (outPath && await isSameFile(outPath, resolved)) {
|
|
936
936
|
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 };
|
|
937
937
|
}
|
|
938
|
-
const { redactDocument } = await import("./redact-doc-
|
|
938
|
+
const { redactDocument } = await import("./redact-doc-SWJC27LL.js");
|
|
939
939
|
const r = await redactDocument(buffer, { rules, maskChar: mask_char, filePath: file_path, dryRun: dry_run });
|
|
940
940
|
const MAX_LINES = 50;
|
|
941
941
|
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}`);
|
|
@@ -1009,7 +1009,7 @@ function registerRenderTools(server2) {
|
|
|
1009
1009
|
const { buffer, resolved } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
|
|
1010
1010
|
const isHwp5 = resolved.toLowerCase().endsWith(".hwp");
|
|
1011
1011
|
if (!isHwp5 && !pages && (format === "png" || format === "svg")) {
|
|
1012
|
-
const { renderHwpxToSvg } = await import("./render-
|
|
1012
|
+
const { renderHwpxToSvg } = await import("./render-45AB5YZR.js");
|
|
1013
1013
|
const result = await renderHwpxToSvg(buffer, { highlights, reflow: true, reflowMode: reflow_mode });
|
|
1014
1014
|
const summary2 = [
|
|
1015
1015
|
`\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})`,
|
|
@@ -1021,7 +1021,7 @@ function registerRenderTools(server2) {
|
|
|
1021
1021
|
summary2.push(`\uC800\uC7A5: ${outPath}`);
|
|
1022
1022
|
return { content: [{ type: "text", text: summary2.join("\n") }] };
|
|
1023
1023
|
}
|
|
1024
|
-
const { rasterizeSvg } = await import("./rasterize-
|
|
1024
|
+
const { rasterizeSvg } = await import("./rasterize-M52AKY7R.js");
|
|
1025
1025
|
const raster = await rasterizeSvg(result.svg, result.width, result.height, max_width_px ? { maxWidthPx: max_width_px } : void 0);
|
|
1026
1026
|
if (outPath) {
|
|
1027
1027
|
await mkdir2(dirname3(outPath), { recursive: true });
|
|
@@ -1036,7 +1036,7 @@ function registerRenderTools(server2) {
|
|
|
1036
1036
|
]
|
|
1037
1037
|
};
|
|
1038
1038
|
}
|
|
1039
|
-
const { renderDocument } = await import("./render-
|
|
1039
|
+
const { renderDocument } = await import("./render-45AB5YZR.js");
|
|
1040
1040
|
const { scene, assets } = await renderDocument(buffer, { format, pages, highlights, reflow: true, reflowMode: reflow_mode, maxWidthPx: max_width_px });
|
|
1041
1041
|
const summary = [
|
|
1042
1042
|
`\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})`,
|
|
@@ -1086,7 +1086,7 @@ function registerRenderTools(server2) {
|
|
|
1086
1086
|
try {
|
|
1087
1087
|
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
|
|
1088
1088
|
const dir = safeOutputPath(join2(output_dir, "regions.json"), /* @__PURE__ */ new Set([".json"])).replace(/[\\/]regions\.json$/, "");
|
|
1089
|
-
const { extractRenderedRegions } = await import("./render-
|
|
1089
|
+
const { extractRenderedRegions } = await import("./render-45AB5YZR.js");
|
|
1090
1090
|
const regions = await extractRenderedRegions(buffer, { types: target, format, pages, paddingPt: padding_pt, reflow: true });
|
|
1091
1091
|
await mkdir2(dir, { recursive: true });
|
|
1092
1092
|
const ext = format === "jpeg" ? "jpg" : "png";
|
|
@@ -1122,7 +1122,7 @@ function registerRenderTools(server2) {
|
|
|
1122
1122
|
}
|
|
1123
1123
|
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
|
|
1124
1124
|
const dir = output_dir ? safeOutputPath(join2(output_dir, "tables.json"), /* @__PURE__ */ new Set([".json"])).replace(/[\\/]tables\.json$/, "") : void 0;
|
|
1125
|
-
const { extractTables } = await import("./visual-
|
|
1125
|
+
const { extractTables } = await import("./visual-OMJNXLNZ.js");
|
|
1126
1126
|
const tables = await extractTables(buffer, { policy: visual, format, paddingPt: padding_pt });
|
|
1127
1127
|
if (dir) await mkdir2(dir, { recursive: true });
|
|
1128
1128
|
const ext = format === "jpeg" ? "jpg" : "png";
|
|
@@ -1179,7 +1179,7 @@ function registerGenerateTools(server2) {
|
|
|
1179
1179
|
try {
|
|
1180
1180
|
const out = safeOutputPath(output_path, PROFILE_EXTENSIONS);
|
|
1181
1181
|
const { buffer } = await readValidatedFile(hwpx_path);
|
|
1182
|
-
const { hwpxToProfile } = await import("./-
|
|
1182
|
+
const { hwpxToProfile } = await import("./-AOWV7MNY.js");
|
|
1183
1183
|
const profile = await hwpxToProfile(buffer);
|
|
1184
1184
|
await mkdir3(dirname4(out), { recursive: true });
|
|
1185
1185
|
await writeOutputFile(out, JSON.stringify(profile, null, 2));
|
|
@@ -1292,7 +1292,7 @@ function registerGenerateTools(server2) {
|
|
|
1292
1292
|
}
|
|
1293
1293
|
let profile;
|
|
1294
1294
|
if (profile_path) {
|
|
1295
|
-
const { parseFormatProfileJson } = await import("./profile-io-
|
|
1295
|
+
const { parseFormatProfileJson } = await import("./profile-io-KMCAFTMG.js");
|
|
1296
1296
|
profile = parseFormatProfileJson(await readFile3(safePath(profile_path, PROFILE_EXTENSIONS), "utf-8"));
|
|
1297
1297
|
}
|
|
1298
1298
|
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-VJCQOSMT.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-M2X766AY.js";
|
|
10
|
+
import "./chunk-3H2IEU4V.js";
|
|
11
|
+
import "./chunk-DKJ2RNDG.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-34T2LJB4.js.map
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
ocrSourcePath,
|
|
17
17
|
parseCharacterDict,
|
|
18
18
|
resolveOcrModels
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-VJCQOSMT.js";
|
|
20
|
+
import "./chunk-M2X766AY.js";
|
|
21
|
+
import "./chunk-3H2IEU4V.js";
|
|
22
|
+
import "./chunk-DKJ2RNDG.js";
|
|
23
23
|
export {
|
|
24
24
|
ALL_OCR_MODELS,
|
|
25
25
|
DEFAULT_OCR_MODELS,
|
|
@@ -38,4 +38,4 @@ export {
|
|
|
38
38
|
parseCharacterDict,
|
|
39
39
|
resolveOcrModels
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=models-
|
|
41
|
+
//# sourceMappingURL=models-TQH5EM6V.js.map
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
parseWorkerFile
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-FDFXL7VJ.js";
|
|
5
|
+
import "./chunk-7XITVUAK.js";
|
|
6
|
+
import "./chunk-6LIBF2ZB.js";
|
|
7
|
+
import "./chunk-YOGMCRM7.js";
|
|
8
|
+
import "./chunk-6QBBGZST.js";
|
|
9
|
+
import "./chunk-KBGNPGVY.js";
|
|
10
10
|
import "./chunk-VKVDMH7X.js";
|
|
11
11
|
import "./chunk-VQFA55IC.js";
|
|
12
12
|
import {
|
|
13
13
|
validateOcrOptions
|
|
14
14
|
} from "./chunk-BHVOY6V4.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-4NQ4EZEE.js";
|
|
16
|
+
import "./chunk-BS2XWGT5.js";
|
|
17
|
+
import "./chunk-3ANXRVI2.js";
|
|
18
|
+
import "./chunk-UCLDUUBX.js";
|
|
19
19
|
import {
|
|
20
20
|
VERSION,
|
|
21
21
|
sanitizeError
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-DKJ2RNDG.js";
|
|
23
23
|
import "./chunk-3WSNLH4B.js";
|
|
24
24
|
|
|
25
25
|
// src/cli/parse-worker-v2.ts
|
|
@@ -311,4 +311,4 @@ export {
|
|
|
311
311
|
runParseWorkerV2,
|
|
312
312
|
toParseOptions
|
|
313
313
|
};
|
|
314
|
-
//# sourceMappingURL=parse-worker-v2-
|
|
314
|
+
//# sourceMappingURL=parse-worker-v2-YEYLILGJ.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
blocksToPages,
|
|
3
3
|
encodePng
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IRNWAHHZ.js";
|
|
5
5
|
import {
|
|
6
6
|
hasRequestedPagesAfter,
|
|
7
7
|
parsePageRange
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
stripAbsorbedRunningLines,
|
|
62
62
|
trimTrailingEmptyTableCols,
|
|
63
63
|
wrapJoiner
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-OIF5HRVP.js";
|
|
65
65
|
import {
|
|
66
66
|
CELL_BASELINES,
|
|
67
67
|
CELL_EDGES,
|
|
@@ -75,12 +75,12 @@ import {
|
|
|
75
75
|
stripScriptTags,
|
|
76
76
|
unframeLayoutTables,
|
|
77
77
|
validateOcrOptions
|
|
78
|
-
} from "./chunk-
|
|
79
|
-
import "./chunk-
|
|
78
|
+
} from "./chunk-J5PYESLX.js";
|
|
79
|
+
import "./chunk-O5E25RHU.js";
|
|
80
80
|
import {
|
|
81
81
|
KordocError,
|
|
82
82
|
sanitizeHref
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-X45Q7EAC.js";
|
|
84
84
|
|
|
85
85
|
// src/pdf/image-extract.ts
|
|
86
86
|
import { createHash } from "crypto";
|
|
@@ -611,6 +611,61 @@ function ocrVectorOps(opList, paths) {
|
|
|
611
611
|
// src/pdf/split-row-pattern.ts
|
|
612
612
|
var textOf = (cell) => cell.text.replace(/<\/?u>|~~/g, "").trim();
|
|
613
613
|
var plain = (cell) => !cell.blocks?.length && !IMAGE_CELLS.has(cell);
|
|
614
|
+
function matchesIndependentRowPair(table, owner, first) {
|
|
615
|
+
const norm = (cell) => textOf(cell).replace(/\s+/g, "");
|
|
616
|
+
const pairs = [];
|
|
617
|
+
for (let c = 0; c < table.cols; ) {
|
|
618
|
+
const u = owner[first - 1]?.[c], d = owner[first]?.[c];
|
|
619
|
+
if (u && u === d) {
|
|
620
|
+
c = u.c + u.cs;
|
|
621
|
+
continue;
|
|
622
|
+
}
|
|
623
|
+
const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
|
|
624
|
+
if (!upper?.text.trim() && !lower?.text.trim()) {
|
|
625
|
+
c++;
|
|
626
|
+
continue;
|
|
627
|
+
}
|
|
628
|
+
if (!u || !d || !upper || !lower || u.r !== first - 1 || d.r !== first || u.c !== c || d.c !== c || u.rs !== 1 || d.rs !== 1 || u.cs !== d.cs || !plain(upper) || !plain(lower) || !norm(upper) || !norm(lower)) return false;
|
|
629
|
+
pairs.push({ c, cs: u.cs, upper: norm(upper), lower: norm(lower) });
|
|
630
|
+
c += u.cs;
|
|
631
|
+
}
|
|
632
|
+
if (pairs.length < 2 || pairs.every((p) => p.upper === p.lower)) return false;
|
|
633
|
+
return table.cells.some((_, r) => {
|
|
634
|
+
if (r + 1 >= table.rows || r + 1 >= first - 1 && r <= first) return false;
|
|
635
|
+
return pairs.every((p) => [p.upper, p.lower].every((text, i) => {
|
|
636
|
+
const a = owner[r + i]?.[p.c], cell = table.cells[r + i]?.[p.c];
|
|
637
|
+
return a?.r === r + i && a.c === p.c && a.rs === 1 && a.cs === p.cs && !!cell && plain(cell) && norm(cell) === text;
|
|
638
|
+
}));
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
function matchesCompleteContextRow(table, owner, first) {
|
|
642
|
+
const norm = (s) => s.replace(/\s+/g, "");
|
|
643
|
+
const context = [];
|
|
644
|
+
let value;
|
|
645
|
+
for (let c = 0; c < table.cols; ) {
|
|
646
|
+
const u = owner[first - 1]?.[c], d = owner[first]?.[c];
|
|
647
|
+
if (u && u === d) {
|
|
648
|
+
const cell = table.cells[u.r][u.c];
|
|
649
|
+
if (u.r === first - 1 && u.rs === 2 && plain(cell) && textOf(cell)) context.push({ c, cs: u.cs, text: norm(textOf(cell)) });
|
|
650
|
+
c = u.c + u.cs;
|
|
651
|
+
continue;
|
|
652
|
+
}
|
|
653
|
+
const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
|
|
654
|
+
if (!upper?.text.trim() && !lower?.text.trim()) {
|
|
655
|
+
c++;
|
|
656
|
+
continue;
|
|
657
|
+
}
|
|
658
|
+
if (value || !u || !d || !upper || !lower || u.r !== first - 1 || d.r !== first || u.c !== c || d.c !== c || u.rs !== 1 || d.rs !== 1 || u.cs !== d.cs || !plain(upper) || !plain(lower) || !textOf(upper) || !textOf(lower)) return false;
|
|
659
|
+
value = { c, cs: u.cs, text: norm(textOf(upper) + textOf(lower)) };
|
|
660
|
+
c += u.cs;
|
|
661
|
+
}
|
|
662
|
+
if (!value || !context.length) return false;
|
|
663
|
+
const proof = [...context, value];
|
|
664
|
+
return table.cells.some((row, r) => r !== first - 1 && r !== first && proof.every((p) => {
|
|
665
|
+
const a = owner[r]?.[p.c], cell = row[p.c];
|
|
666
|
+
return a?.r === r && a.c === p.c && a.rs === 1 && a.cs === p.cs && !!cell && plain(cell) && norm(textOf(cell)) === p.text;
|
|
667
|
+
}));
|
|
668
|
+
}
|
|
614
669
|
function matchesCompleteSiblingRow(table, owner, first) {
|
|
615
670
|
const pairs = [];
|
|
616
671
|
for (let c = 0; c < table.cols; ) {
|
|
@@ -676,6 +731,41 @@ function matchesCompleteRubricRow(table, owner, first) {
|
|
|
676
731
|
return peerMarks.length === marks.length && peerMarks.every((m, i) => m.n === marks[i].n) && values(row[score.c]).join("|") === scores.join("|") && norm(peer.slice(peerMarks[peerMarks.length - 1].at)) === tail;
|
|
677
732
|
});
|
|
678
733
|
}
|
|
734
|
+
var KO_ORDER = "\uAC00\uB098\uB2E4\uB77C\uB9C8\uBC14\uC0AC\uC544\uC790\uCC28\uCE74\uD0C0\uD30C\uD558";
|
|
735
|
+
function itemMark(line) {
|
|
736
|
+
line = line.replace(/<\/?u>|~~/g, "").trim();
|
|
737
|
+
let m = /^(\d{1,2})([.)])(?!\d)/.exec(line);
|
|
738
|
+
if (m) return { style: "1" + m[2], n: +m[1] };
|
|
739
|
+
if (m = /^\((\d{1,2})\)/.exec(line)) return { style: "(1)", n: +m[1] };
|
|
740
|
+
if ((m = /^([가-하])([.)])/.exec(line)) && KO_ORDER.includes(m[1])) return { style: "\uAC00" + m[2], n: KO_ORDER.indexOf(m[1]) };
|
|
741
|
+
if ((m = /^\(([가-하])\)/.exec(line)) && KO_ORDER.includes(m[1])) return { style: "(\uAC00)", n: KO_ORDER.indexOf(m[1]) };
|
|
742
|
+
if (m = /^[①-⑳]/.exec(line)) return { style: "\u2460", n: m[0].charCodeAt(0) };
|
|
743
|
+
if (m = /^([A-Z])\.\s/.exec(line)) return { style: "A.", n: m[1].charCodeAt(0) };
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
function hasNumberedRowSequence(table, owner, first) {
|
|
747
|
+
if (first < 3) return false;
|
|
748
|
+
const rows = [first - 3, first - 2, first - 1, first];
|
|
749
|
+
const separate = (c, cs) => rows.every((r) => {
|
|
750
|
+
const a = owner[r]?.[c], cell = table.cells[r]?.[c];
|
|
751
|
+
return a?.r === r && a.c === c && a.rs === 1 && a.cs === cs && !!cell && plain(cell) && !!textOf(cell);
|
|
752
|
+
});
|
|
753
|
+
for (let c = 0; c < table.cols; c++) {
|
|
754
|
+
const a = owner[first]?.[c];
|
|
755
|
+
if (!a || !separate(c, a.cs)) continue;
|
|
756
|
+
const marks = rows.map((r) => {
|
|
757
|
+
const lines = textOf(table.cells[r][c]).split("\n"), firstMark = itemMark(lines[0]);
|
|
758
|
+
return firstMark && lines.slice(1).every((l) => !itemMark(l)) ? firstMark : null;
|
|
759
|
+
});
|
|
760
|
+
const head = marks[0];
|
|
761
|
+
if (!head || marks.some((m, i) => !m || m.style !== head.style || m.n !== head.n + i)) continue;
|
|
762
|
+
for (let d = 0; d < table.cols; d++) {
|
|
763
|
+
const side = owner[first]?.[d];
|
|
764
|
+
if (side && (d + side.cs <= c || d >= c + a.cs) && separate(d, side.cs)) return true;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
return false;
|
|
768
|
+
}
|
|
679
769
|
|
|
680
770
|
// src/pdf/contact-table.ts
|
|
681
771
|
var CONTACT_HEAD = /^(?:담당\s*부서|<[^<>]+>)$/;
|
|
@@ -694,8 +784,25 @@ function splitContactTables(blocks) {
|
|
|
694
784
|
const whole = PERSON.exec(r[3].text.replace(/\s+/g, " ").trim());
|
|
695
785
|
return whole ? [whole] : null;
|
|
696
786
|
});
|
|
697
|
-
if (people.some((p) => !p) || rows.some((r) =>
|
|
787
|
+
if (people.some((p) => !p) || rows.some((r) => r[3].rowSpan !== 1 || r[3].colSpan !== 1)) continue;
|
|
788
|
+
let roleEnd = 0;
|
|
789
|
+
const validRoles = rows.every((r, i) => {
|
|
790
|
+
const role = r[2];
|
|
791
|
+
if (role.colSpan !== 1) return false;
|
|
792
|
+
if (i < roleEnd) return !role.text.trim() && role.rowSpan === 1;
|
|
793
|
+
if (!CONTACT_ROLE.test(role.text.replace(/\s+/g, "")) || role.rowSpan < 1 || i + role.rowSpan > t.rows) return false;
|
|
794
|
+
roleEnd = i + role.rowSpan;
|
|
795
|
+
return true;
|
|
796
|
+
});
|
|
797
|
+
if (!validRoles) continue;
|
|
698
798
|
if (!people.some((p) => p.some(spaced))) continue;
|
|
799
|
+
const one = (text) => ({ text, colSpan: 1, rowSpan: 1 });
|
|
800
|
+
const part = (i, k) => one(people[i].map((p) => p[k]).join("\n"));
|
|
801
|
+
if (rows.some((r) => r[2].rowSpan > 1)) {
|
|
802
|
+
t.cells = rows.map((r, i) => [...r.slice(0, 3), part(i, 1), part(i, 2), part(i, 3)]);
|
|
803
|
+
t.cols = 6;
|
|
804
|
+
continue;
|
|
805
|
+
}
|
|
699
806
|
const lead = [];
|
|
700
807
|
let ok = true;
|
|
701
808
|
for (const c of [0, 1]) {
|
|
@@ -716,8 +823,6 @@ function splitContactTables(blocks) {
|
|
|
716
823
|
lead.push(col);
|
|
717
824
|
}
|
|
718
825
|
if (!ok) continue;
|
|
719
|
-
const one = (text) => ({ text, colSpan: 1, rowSpan: 1 });
|
|
720
|
-
const part = (i, k) => one(people[i].map((p) => p[k]).join("\n"));
|
|
721
826
|
t.cells = rows.map((r, i) => [one(lead[0][i]), one(lead[1][i]), one(r[2].text), part(i, 1), part(i, 2), part(i, 3)]);
|
|
722
827
|
t.cols = 6;
|
|
723
828
|
}
|
|
@@ -1230,18 +1335,6 @@ function wordOverflows(u, d, x1, x2) {
|
|
|
1230
1335
|
const last = U[U.length - 1], units = firstWordUnits(d.text);
|
|
1231
1336
|
return units > 0 && last.r - last.l + units * (last.h || 10) > x2 - x1;
|
|
1232
1337
|
}
|
|
1233
|
-
var KO_ORDER = "\uAC00\uB098\uB2E4\uB77C\uB9C8\uBC14\uC0AC\uC544\uC790\uCC28\uCE74\uD0C0\uD30C\uD558";
|
|
1234
|
-
function itemMark(line) {
|
|
1235
|
-
line = flowText(line).trim();
|
|
1236
|
-
let m = /^(\d{1,2})([.)])(?!\d)/.exec(line);
|
|
1237
|
-
if (m) return { style: "1" + m[2], n: +m[1] };
|
|
1238
|
-
if (m = /^\((\d{1,2})\)/.exec(line)) return { style: "(1)", n: +m[1] };
|
|
1239
|
-
if ((m = /^([가-하])([.)])/.exec(line)) && KO_ORDER.includes(m[1])) return { style: "\uAC00" + m[2], n: KO_ORDER.indexOf(m[1]) };
|
|
1240
|
-
if ((m = /^\(([가-하])\)/.exec(line)) && KO_ORDER.includes(m[1])) return { style: "(\uAC00)", n: KO_ORDER.indexOf(m[1]) };
|
|
1241
|
-
if (m = /^[①-⑳]/.exec(line)) return { style: "\u2460", n: m[0].charCodeAt(0) };
|
|
1242
|
-
if (m = /^([A-Z])\.\s/.exec(line)) return { style: "A.", n: m[1].charCodeAt(0) };
|
|
1243
|
-
return null;
|
|
1244
|
-
}
|
|
1245
1338
|
function listContinues(u, d, multi = false) {
|
|
1246
1339
|
const head = itemMark(d.text.trim());
|
|
1247
1340
|
if (!head) return false;
|
|
@@ -1289,6 +1382,8 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
|
|
|
1289
1382
|
const a = serial(cell(u)), b = serial(cell(d));
|
|
1290
1383
|
return a !== null && b === a + 1;
|
|
1291
1384
|
})) return false;
|
|
1385
|
+
if (cut.ruled && hasNumberedRowSequence(table, owner, first)) return false;
|
|
1386
|
+
if (cut.ruled && matchesIndependentRowPair(table, owner, first)) return false;
|
|
1292
1387
|
const contentPairs = pairs.filter(([u, d]) => hasContent(u.cell) && hasContent(d.cell));
|
|
1293
1388
|
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])));
|
|
1294
1389
|
if (!carriedSplit) {
|
|
@@ -1300,7 +1395,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
|
|
|
1300
1395
|
if (!(cut.open && !newCell)) {
|
|
1301
1396
|
if (pairs.some((p) => p[1].rs > 1 && !flows(p))) return false;
|
|
1302
1397
|
const one = pairs.filter(([, d]) => d.rs === 1);
|
|
1303
|
-
if (!matchesCompleteSiblingRow(table, owner, first) && !matchesCompleteRubricRow(table, owner, first) && !outlineOnly(pairs, cell) && !one.some(flows) && (cut.list === "none" || !one.some(([u, d]) => listContinues(cell(u), cell(d), cut.list === "multi")))) return false;
|
|
1398
|
+
if (!matchesCompleteSiblingRow(table, owner, first) && !matchesCompleteRubricRow(table, owner, first) && !(cut.ruled && matchesCompleteContextRow(table, owner, first)) && !outlineOnly(pairs, cell) && !one.some(flows) && (cut.list === "none" || !one.some(([u, d]) => listContinues(cell(u), cell(d), cut.list === "multi")))) return false;
|
|
1304
1399
|
}
|
|
1305
1400
|
}
|
|
1306
1401
|
for (const [u, d] of pairs) {
|
|
@@ -1361,6 +1456,12 @@ function sameHeadShape(a, b) {
|
|
|
1361
1456
|
}
|
|
1362
1457
|
return tall;
|
|
1363
1458
|
}
|
|
1459
|
+
function hasBoxTitle(t) {
|
|
1460
|
+
const titles = t.cells[0]?.filter((c) => c.text.trim()) ?? [];
|
|
1461
|
+
if (titles.length !== 1 || titles[0].rowSpan < 2) return false;
|
|
1462
|
+
const body = t.cells[titles[0].rowSpan];
|
|
1463
|
+
return !!body && body[0].colSpan === t.cols && !!body[0].text.trim();
|
|
1464
|
+
}
|
|
1364
1465
|
function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
1365
1466
|
mergeColumnFlow(blocks, pageHeights, lex);
|
|
1366
1467
|
for (let i = blocks.length - 2; i >= 0; i--) {
|
|
@@ -1374,6 +1475,7 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
1374
1475
|
if (!prev.table || !prev.bbox || !prev.pageNumber) continue;
|
|
1375
1476
|
if (!curr || curr.type !== "table" || !curr.table || !curr.bbox || curr.pageNumber !== prev.pageNumber + 1) continue;
|
|
1376
1477
|
if (startsWithUnitRow(prev.table) && startsWithUnitRow(curr.table)) continue;
|
|
1478
|
+
if (hasBoxTitle(prev.table) && hasBoxTitle(curr.table) && !rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
|
|
1377
1479
|
const joined = j === i + 1 || blocks.slice(i + 1, j).every((b) => besideOwn(b, prev, curr) || insideTable(b, prev) || insideTable(b, curr) || pageNumberBetween(b, prev, curr, pageHeights)) ? looksContinued(prev, curr, pageHeights) && !restartsTable(blocks, i, curr.table, pageHeights) ? joinClipParts(prev, curr, pageHeights, lex) ?? false : null : null;
|
|
1378
1480
|
if (joined) {
|
|
1379
1481
|
placeJoined(blocks, i, j, joined);
|
|
@@ -1681,7 +1783,10 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
1681
1783
|
for (let j = blocks.length - 1; j > 0; j--) {
|
|
1682
1784
|
const part = blocks[j];
|
|
1683
1785
|
const from = part.table ? CONT_PARTS.get(part.table) : void 0;
|
|
1684
|
-
if (!from || !part.table)
|
|
1786
|
+
if (!from || !part.table) {
|
|
1787
|
+
unwrapContinuedTable(blocks, j, pageHeights, true);
|
|
1788
|
+
continue;
|
|
1789
|
+
}
|
|
1685
1790
|
let i = j - 1;
|
|
1686
1791
|
while (i >= 0 && blocks[i].type !== "table") i--;
|
|
1687
1792
|
const prev = blocks[i];
|
|
@@ -1708,7 +1813,7 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
1708
1813
|
if (cell.blocks) mergeCrossPageTables(cell.blocks, pageHeights);
|
|
1709
1814
|
}
|
|
1710
1815
|
}
|
|
1711
|
-
function unwrapContinuedTable(blocks, at, pageHeights) {
|
|
1816
|
+
function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
|
|
1712
1817
|
const prev = blocks[at - 1], frame = blocks[at];
|
|
1713
1818
|
if (!prev?.table || !frame?.table || frame.table.rows !== 1 || frame.table.cols !== 1 || !CLIP_TABLES.has(frame.table)) return;
|
|
1714
1819
|
const inner = frame.table.cells[0]?.[0]?.blocks;
|
|
@@ -1718,6 +1823,7 @@ function unwrapContinuedTable(blocks, at, pageHeights) {
|
|
|
1718
1823
|
if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
|
|
1719
1824
|
const ph = pageHeights?.get(prev.pageNumber), nh = pageHeights?.get(next.pageNumber);
|
|
1720
1825
|
if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
|
|
1826
|
+
if (splitOnly && (inner.length !== 1 || !joinSplitParts(prev.table, px, next.table, nx, 0, prev.bbox.y)?.split)) return;
|
|
1721
1827
|
blocks.splice(at, 1, ...inner);
|
|
1722
1828
|
}
|
|
1723
1829
|
function fillNestedContinuation(blocks, at) {
|
|
@@ -3317,7 +3423,7 @@ function mergeLinkRuns(markdown) {
|
|
|
3317
3423
|
|
|
3318
3424
|
// src/pdf/formula-ocr.ts
|
|
3319
3425
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
3320
|
-
const formulaMod = await import("./formula-
|
|
3426
|
+
const formulaMod = await import("./formula-C26FMMGO.js");
|
|
3321
3427
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
3322
3428
|
await ensureFormulaModels((p) => {
|
|
3323
3429
|
if (p.phase === "download" && p.total) {
|
|
@@ -3743,10 +3849,10 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3743
3849
|
}
|
|
3744
3850
|
if (targets.size > 0) {
|
|
3745
3851
|
try {
|
|
3746
|
-
const { runPdfOcr } = await import("./pdf-ocr-
|
|
3852
|
+
const { runPdfOcr } = await import("./pdf-ocr-LGPSJM22.js");
|
|
3747
3853
|
const mode = typeof options?.ocr === "function" ? options.ocr : "builtin";
|
|
3748
3854
|
const regionPages = new Map([...ocrRegions].filter(([p]) => options?.ocr !== "force" && !isImageBased && !pageQuality.find((q) => q.page === p)?.needsOcr));
|
|
3749
|
-
const { builtinOcrConfig } = await import("./pdf-ocr-
|
|
3855
|
+
const { builtinOcrConfig } = await import("./pdf-ocr-LGPSJM22.js");
|
|
3750
3856
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options?.onProgress, options?.tables !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
|
|
3751
3857
|
for (const obs of ocrPageBlocks.values()) stripScriptTags({ blocks: obs });
|
|
3752
3858
|
if (ocrPageBlocks.size > 0) {
|
|
@@ -3991,4 +4097,4 @@ export {
|
|
|
3991
4097
|
parsePdfDocument,
|
|
3992
4098
|
removeHeaderFooterBlocks
|
|
3993
4099
|
};
|
|
3994
|
-
//# sourceMappingURL=parser-
|
|
4100
|
+
//# sourceMappingURL=parser-E6BG3ECD.js.map
|