kordoc 4.22.3 → 4.22.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/dist/{-AOWV7MNY.js → -WFRWBH7T.js} +11 -11
- package/dist/{chunk-3ANXRVI2.js → chunk-2L3Q7REU.js} +3 -3
- package/dist/{chunk-FDFXL7VJ.js → chunk-35ZHXEJA.js} +3 -3
- package/dist/{chunk-BS2XWGT5.js → chunk-3BR7VKWL.js} +2 -2
- package/dist/{chunk-KBGNPGVY.js → chunk-3G3TLZDK.js} +2 -2
- package/dist/{chunk-M2X766AY.js → chunk-3YEL7P4L.js} +2 -2
- package/dist/{chunk-NJEMRAIF.cjs → chunk-4SUB43EJ.cjs} +24 -24
- package/dist/{chunk-NJEMRAIF.cjs.map → chunk-4SUB43EJ.cjs.map} +1 -1
- package/dist/{chunk-DKJ2RNDG.js → chunk-4TWN7PWJ.js} +2 -2
- package/dist/{chunk-UCLDUUBX.js → chunk-52HIK4C2.js} +4 -3
- package/dist/chunk-52HIK4C2.js.map +1 -0
- package/dist/{chunk-3H2IEU4V.js → chunk-63N6CEJE.js} +2 -2
- package/dist/{chunk-MEIQ476H.js → chunk-6MCC2XNB.js} +2 -2
- package/dist/{chunk-SKRWKVVW.js → chunk-6MQKNB6K.js} +15 -8
- package/dist/chunk-6MQKNB6K.js.map +1 -0
- package/dist/{chunk-MI655NV5.cjs → chunk-AS25R4EU.cjs} +2 -2
- package/dist/{chunk-MI655NV5.cjs.map → chunk-AS25R4EU.cjs.map} +1 -1
- package/dist/{chunk-4NQ4EZEE.js → chunk-C3REGEQO.js} +2 -2
- package/dist/{chunk-NLGOMLGU.cjs → chunk-C6B5GWN7.cjs} +35 -28
- package/dist/chunk-C6B5GWN7.cjs.map +1 -0
- package/dist/{chunk-6LIBF2ZB.js → chunk-CO7O3ZT6.js} +2 -2
- package/dist/{chunk-IRNWAHHZ.js → chunk-CRSTBATY.js} +2 -2
- package/dist/{chunk-VJCQOSMT.js → chunk-CW67DAAH.js} +2 -2
- package/dist/{chunk-6QBBGZST.js → chunk-DN55FTJP.js} +2 -2
- package/dist/{chunk-OIF5HRVP.js → chunk-HLPMC7L4.js} +16 -9
- package/dist/chunk-HLPMC7L4.js.map +1 -0
- package/dist/{chunk-24YLYR6Q.js → chunk-LE4VHWIT.js} +4 -4
- package/dist/{chunk-2BCQVQO2.cjs → chunk-N6KXGIIN.cjs} +3 -3
- package/dist/{chunk-2BCQVQO2.cjs.map → chunk-N6KXGIIN.cjs.map} +1 -1
- package/dist/{chunk-7XITVUAK.js → chunk-PSORL4PA.js} +11 -11
- package/dist/{chunk-AXX5AQT4.js → chunk-RYKDIUHT.js} +4 -4
- package/dist/{chunk-O5E25RHU.js → chunk-SETAYS6P.js} +2 -2
- package/dist/{chunk-X45Q7EAC.js → chunk-T7OZ7X6A.js} +2 -2
- package/dist/{chunk-J5PYESLX.js → chunk-TOUJCO2P.js} +2 -2
- package/dist/{chunk-YOGMCRM7.js → chunk-U3GUZQ54.js} +1353 -1335
- package/dist/chunk-U3GUZQ54.js.map +1 -0
- package/dist/{chunk-O3OS6FAW.cjs → chunk-UCK6WGHY.cjs} +3 -3
- package/dist/{chunk-O3OS6FAW.cjs.map → chunk-UCK6WGHY.cjs.map} +1 -1
- package/dist/{chunk-SJ5OZXEL.cjs → chunk-YG4GFQB7.cjs} +6 -6
- package/dist/{chunk-SJ5OZXEL.cjs.map → chunk-YG4GFQB7.cjs.map} +1 -1
- package/dist/chunks-NXABWR6G.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-W4OL33YQ.js → formula-FSVHUQ6Y.js} +4 -4
- package/dist/{formula-C26FMMGO.js → formula-L625ULJP.js} +3 -3
- package/dist/{formula-5V2WG4BH.cjs → formula-QZGTF3DZ.cjs} +9 -9
- package/dist/{formula-5V2WG4BH.cjs.map → formula-QZGTF3DZ.cjs.map} +1 -1
- package/dist/{image-ocr-BELHEWPX.cjs → image-ocr-AELVAU75.cjs} +17 -17
- package/dist/{image-ocr-BELHEWPX.cjs.map → image-ocr-AELVAU75.cjs.map} +1 -1
- package/dist/{image-ocr-T72HMX2W.js → image-ocr-KE3RUS3R.js} +6 -6
- package/dist/{image-ocr-NSQ34Y6T.js → image-ocr-QTZNBP5V.js} +9 -9
- package/dist/index.cjs +859 -840
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +322 -303
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-34T2LJB4.js → model-bundle-F6TU6ZAV.js} +5 -5
- package/dist/{models-TQH5EM6V.js → models-ZHNNVH2W.js} +5 -5
- package/dist/{parse-worker-v2-YEYLILGJ.js → parse-worker-v2-KQRG3NQO.js} +12 -12
- package/dist/{parser-SJHCBL7T.js → parser-RVMH4PUB.js} +183 -21
- package/dist/parser-RVMH4PUB.js.map +1 -0
- package/dist/{parser-E6BG3ECD.js → parser-WBKVRDPV.js} +179 -17
- package/dist/parser-WBKVRDPV.js.map +1 -0
- package/dist/{parser-OAXCXVQ4.cjs → parser-WNDH2X6N.cjs} +442 -280
- package/dist/parser-WNDH2X6N.cjs.map +1 -0
- package/dist/pdf-ocr-IOUZTPPH.cjs +31 -0
- package/dist/{pdf-ocr-RKXDY3ZA.cjs.map → pdf-ocr-IOUZTPPH.cjs.map} +1 -1
- package/dist/{pdf-ocr-LGPSJM22.js → pdf-ocr-X5XLGL5J.js} +6 -6
- package/dist/{pdf-ocr-T5ASSUKK.js → pdf-ocr-ZP2CUWSO.js} +9 -9
- package/dist/{profile-io-KMCAFTMG.js → profile-io-B4VSI4LW.js} +3 -3
- package/dist/{rasterize-M52AKY7R.js → rasterize-Y7NVUVXU.js} +3 -3
- package/dist/{redact-doc-SWJC27LL.js → redact-doc-GIBTFWCO.js} +11 -11
- package/dist/{render-45AB5YZR.js → render-JVCGYRRO.js} +7 -7
- package/dist/seal-WNX2ZJTK.js +10 -0
- package/dist/{setup-5PBMUI6M.js → setup-7L7EQPMG.js} +3 -3
- package/dist/visual-VPWPXIHN.js +21 -0
- package/dist/{watch-QOGKV52T.js → watch-VYMFGX72.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-NLGOMLGU.cjs.map +0 -1
- package/dist/chunk-OIF5HRVP.js.map +0 -1
- package/dist/chunk-SKRWKVVW.js.map +0 -1
- package/dist/chunk-UCLDUUBX.js.map +0 -1
- package/dist/chunk-YOGMCRM7.js.map +0 -1
- package/dist/chunks-7KXTS7IV.js +0 -10
- package/dist/parser-E6BG3ECD.js.map +0 -1
- package/dist/parser-OAXCXVQ4.cjs.map +0 -1
- package/dist/parser-SJHCBL7T.js.map +0 -1
- package/dist/pdf-ocr-RKXDY3ZA.cjs +0 -31
- package/dist/seal-7KWG6VHS.js +0 -10
- package/dist/visual-OMJNXLNZ.js +0 -21
- /package/dist/{-AOWV7MNY.js.map → -WFRWBH7T.js.map} +0 -0
- /package/dist/{chunk-3ANXRVI2.js.map → chunk-2L3Q7REU.js.map} +0 -0
- /package/dist/{chunk-FDFXL7VJ.js.map → chunk-35ZHXEJA.js.map} +0 -0
- /package/dist/{chunk-BS2XWGT5.js.map → chunk-3BR7VKWL.js.map} +0 -0
- /package/dist/{chunk-KBGNPGVY.js.map → chunk-3G3TLZDK.js.map} +0 -0
- /package/dist/{chunk-M2X766AY.js.map → chunk-3YEL7P4L.js.map} +0 -0
- /package/dist/{chunk-DKJ2RNDG.js.map → chunk-4TWN7PWJ.js.map} +0 -0
- /package/dist/{chunk-3H2IEU4V.js.map → chunk-63N6CEJE.js.map} +0 -0
- /package/dist/{chunk-MEIQ476H.js.map → chunk-6MCC2XNB.js.map} +0 -0
- /package/dist/{chunk-4NQ4EZEE.js.map → chunk-C3REGEQO.js.map} +0 -0
- /package/dist/{chunk-6LIBF2ZB.js.map → chunk-CO7O3ZT6.js.map} +0 -0
- /package/dist/{chunk-IRNWAHHZ.js.map → chunk-CRSTBATY.js.map} +0 -0
- /package/dist/{chunk-VJCQOSMT.js.map → chunk-CW67DAAH.js.map} +0 -0
- /package/dist/{chunk-6QBBGZST.js.map → chunk-DN55FTJP.js.map} +0 -0
- /package/dist/{chunk-24YLYR6Q.js.map → chunk-LE4VHWIT.js.map} +0 -0
- /package/dist/{chunk-7XITVUAK.js.map → chunk-PSORL4PA.js.map} +0 -0
- /package/dist/{chunk-AXX5AQT4.js.map → chunk-RYKDIUHT.js.map} +0 -0
- /package/dist/{chunk-O5E25RHU.js.map → chunk-SETAYS6P.js.map} +0 -0
- /package/dist/{chunk-X45Q7EAC.js.map → chunk-T7OZ7X6A.js.map} +0 -0
- /package/dist/{chunk-J5PYESLX.js.map → chunk-TOUJCO2P.js.map} +0 -0
- /package/dist/{chunks-7KXTS7IV.js.map → chunks-NXABWR6G.js.map} +0 -0
- /package/dist/{formula-W4OL33YQ.js.map → formula-FSVHUQ6Y.js.map} +0 -0
- /package/dist/{formula-C26FMMGO.js.map → formula-L625ULJP.js.map} +0 -0
- /package/dist/{image-ocr-T72HMX2W.js.map → image-ocr-KE3RUS3R.js.map} +0 -0
- /package/dist/{image-ocr-NSQ34Y6T.js.map → image-ocr-QTZNBP5V.js.map} +0 -0
- /package/dist/{model-bundle-34T2LJB4.js.map → model-bundle-F6TU6ZAV.js.map} +0 -0
- /package/dist/{models-TQH5EM6V.js.map → models-ZHNNVH2W.js.map} +0 -0
- /package/dist/{parse-worker-v2-YEYLILGJ.js.map → parse-worker-v2-KQRG3NQO.js.map} +0 -0
- /package/dist/{pdf-ocr-LGPSJM22.js.map → pdf-ocr-X5XLGL5J.js.map} +0 -0
- /package/dist/{pdf-ocr-T5ASSUKK.js.map → pdf-ocr-ZP2CUWSO.js.map} +0 -0
- /package/dist/{profile-io-KMCAFTMG.js.map → profile-io-B4VSI4LW.js.map} +0 -0
- /package/dist/{rasterize-M52AKY7R.js.map → rasterize-Y7NVUVXU.js.map} +0 -0
- /package/dist/{redact-doc-SWJC27LL.js.map → redact-doc-GIBTFWCO.js.map} +0 -0
- /package/dist/{render-45AB5YZR.js.map → render-JVCGYRRO.js.map} +0 -0
- /package/dist/{seal-7KWG6VHS.js.map → seal-WNX2ZJTK.js.map} +0 -0
- /package/dist/{setup-5PBMUI6M.js.map → setup-7L7EQPMG.js.map} +0 -0
- /package/dist/{visual-OMJNXLNZ.js.map → visual-VPWPXIHN.js.map} +0 -0
- /package/dist/{watch-QOGKV52T.js.map → watch-VYMFGX72.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-PSORL4PA.js";
|
|
42
|
+
import "./chunk-CO7O3ZT6.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-U3GUZQ54.js";
|
|
49
|
+
import "./chunk-DN55FTJP.js";
|
|
50
|
+
import "./chunk-3G3TLZDK.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-C3REGEQO.js";
|
|
55
55
|
import {
|
|
56
56
|
blocksToMarkdown
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-3BR7VKWL.js";
|
|
58
58
|
import {
|
|
59
59
|
assertWithinRoot,
|
|
60
60
|
getAccessRoot,
|
|
61
61
|
isOfflineMode
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-63N6CEJE.js";
|
|
63
63
|
import {
|
|
64
64
|
extractFormFields,
|
|
65
65
|
fillWithUniqueGuard
|
|
66
|
-
} from "./chunk-
|
|
67
|
-
import "./chunk-
|
|
66
|
+
} from "./chunk-2L3Q7REU.js";
|
|
67
|
+
import "./chunk-52HIK4C2.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-4TWN7PWJ.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-RVMH4PUB.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-NXABWR6G.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-WNX2ZJTK.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-GIBTFWCO.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-JVCGYRRO.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-Y7NVUVXU.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-JVCGYRRO.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-JVCGYRRO.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-VPWPXIHN.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("./-WFRWBH7T.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-B4VSI4LW.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-CW67DAAH.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-3YEL7P4L.js";
|
|
10
|
+
import "./chunk-63N6CEJE.js";
|
|
11
|
+
import "./chunk-4TWN7PWJ.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-F6TU6ZAV.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-CW67DAAH.js";
|
|
20
|
+
import "./chunk-3YEL7P4L.js";
|
|
21
|
+
import "./chunk-63N6CEJE.js";
|
|
22
|
+
import "./chunk-4TWN7PWJ.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-ZHNNVH2W.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-35ZHXEJA.js";
|
|
5
|
+
import "./chunk-PSORL4PA.js";
|
|
6
|
+
import "./chunk-CO7O3ZT6.js";
|
|
7
|
+
import "./chunk-U3GUZQ54.js";
|
|
8
|
+
import "./chunk-DN55FTJP.js";
|
|
9
|
+
import "./chunk-3G3TLZDK.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-C3REGEQO.js";
|
|
16
|
+
import "./chunk-3BR7VKWL.js";
|
|
17
|
+
import "./chunk-2L3Q7REU.js";
|
|
18
|
+
import "./chunk-52HIK4C2.js";
|
|
19
19
|
import {
|
|
20
20
|
VERSION,
|
|
21
21
|
sanitizeError
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-4TWN7PWJ.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-KQRG3NQO.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
blocksToPages
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3G3TLZDK.js";
|
|
5
5
|
import {
|
|
6
6
|
encodePng
|
|
7
7
|
} from "./chunk-VKVDMH7X.js";
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
stripAbsorbedRunningLines,
|
|
63
63
|
trimTrailingEmptyTableCols,
|
|
64
64
|
wrapJoiner
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-6MQKNB6K.js";
|
|
66
66
|
import {
|
|
67
67
|
validateOcrOptions
|
|
68
68
|
} from "./chunk-BHVOY6V4.js";
|
|
@@ -74,23 +74,24 @@ import {
|
|
|
74
74
|
escapeLiteralTags,
|
|
75
75
|
stripScriptTags,
|
|
76
76
|
unframeLayoutTables
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-C3REGEQO.js";
|
|
78
78
|
import {
|
|
79
79
|
WINGDINGS,
|
|
80
80
|
assignTableIds,
|
|
81
81
|
blocksToMarkdown,
|
|
82
|
-
escapeLiteralDollar
|
|
83
|
-
|
|
82
|
+
escapeLiteralDollar,
|
|
83
|
+
mapPuaText
|
|
84
|
+
} from "./chunk-3BR7VKWL.js";
|
|
84
85
|
import {
|
|
85
86
|
ocrModelsCached,
|
|
86
87
|
resolveOcrModels
|
|
87
|
-
} from "./chunk-
|
|
88
|
-
import "./chunk-
|
|
89
|
-
import "./chunk-
|
|
88
|
+
} from "./chunk-CW67DAAH.js";
|
|
89
|
+
import "./chunk-3YEL7P4L.js";
|
|
90
|
+
import "./chunk-63N6CEJE.js";
|
|
90
91
|
import {
|
|
91
92
|
KordocError,
|
|
92
93
|
sanitizeHref
|
|
93
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-4TWN7PWJ.js";
|
|
94
95
|
|
|
95
96
|
// src/pdf/image-extract.ts
|
|
96
97
|
import { createHash } from "crypto";
|
|
@@ -621,6 +622,117 @@ function ocrVectorOps(opList, paths) {
|
|
|
621
622
|
// src/pdf/split-row-pattern.ts
|
|
622
623
|
var textOf = (cell) => cell.text.replace(/<\/?u>|~~/g, "").trim();
|
|
623
624
|
var plain = (cell) => !cell.blocks?.length && !IMAGE_CELLS.has(cell);
|
|
625
|
+
var labelsOf = (cell) => {
|
|
626
|
+
const labels = textOf(cell).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
627
|
+
return labels.length && labels.every((s) => /^\p{L}[\p{L}\p{N} ]{0,15}[::]$/u.test(s)) ? labels.map((s) => s.replace(/\s+/g, "").replace(/:/g, ":")) : void 0;
|
|
628
|
+
};
|
|
629
|
+
var alignedLabels = (label, value, count) => {
|
|
630
|
+
const L = CELL_LINES.get(label), V = CELL_LINES.get(value);
|
|
631
|
+
let next = 0;
|
|
632
|
+
return !!L && !!V && L.length === count && V.length >= count && Math.abs(L[0].y - V[0].y) <= 1 && L.every((l) => {
|
|
633
|
+
while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
|
|
634
|
+
return next++ < V.length;
|
|
635
|
+
});
|
|
636
|
+
};
|
|
637
|
+
function partialAlignedLabelCells(table, owner, first) {
|
|
638
|
+
const pageOf = (a) => CELL_PAGES.get(a.cell ?? table.cells[a.r][a.c]) ?? (a.r < first ? -1 : -2);
|
|
639
|
+
const pairs = [];
|
|
640
|
+
let carried = false;
|
|
641
|
+
for (let c = 0; c < table.cols; ) {
|
|
642
|
+
const u = owner[first - 1]?.[c], d = owner[first]?.[c];
|
|
643
|
+
if (u && u === d) {
|
|
644
|
+
carried = true;
|
|
645
|
+
c = u.c + u.cs;
|
|
646
|
+
continue;
|
|
647
|
+
}
|
|
648
|
+
const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
|
|
649
|
+
if (!upper?.text.trim() && !lower?.text.trim()) {
|
|
650
|
+
c++;
|
|
651
|
+
continue;
|
|
652
|
+
}
|
|
653
|
+
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) || !textOf(upper) || !textOf(lower)) return;
|
|
654
|
+
pairs.push({ c, cs: u.cs, upper, lower });
|
|
655
|
+
c += u.cs;
|
|
656
|
+
}
|
|
657
|
+
if (!carried || pairs.length !== 3) return;
|
|
658
|
+
const keyed = pairs.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
|
|
659
|
+
if (keyed.length !== 1) return;
|
|
660
|
+
const label = keyed[0], value = pairs.find((p) => p.c === label.c + label.cs), context = pairs.find((p) => p.c + p.cs === label.c);
|
|
661
|
+
if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !CELL_EDGES.get(context.upper)?.b || !CELL_EDGES.get(context.lower)?.t) return;
|
|
662
|
+
const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
|
|
663
|
+
if (D.length < 2 || sequence.length < 3 || new Set(sequence).size !== sequence.length || !alignedLabels(label.upper, value.upper, U.length)) return;
|
|
664
|
+
const L = CELL_LINES.get(label.lower), V = CELL_LINES.get(value.lower);
|
|
665
|
+
if (!L || !V || L.length !== D.length) return;
|
|
666
|
+
let next = V.findIndex((v) => Math.abs(v.y - L[0].y) <= 1);
|
|
667
|
+
if (next <= 0 || !V.slice(0, next).every((v) => v.y > L[0].y + 1) || !L.every((l) => {
|
|
668
|
+
while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
|
|
669
|
+
return next++ < V.length;
|
|
670
|
+
})) return;
|
|
671
|
+
let peers = 0, shared = false;
|
|
672
|
+
for (let r = 0; r < table.rows; r++) {
|
|
673
|
+
if (r === first - 1 || r === first) continue;
|
|
674
|
+
const l = owner[r]?.[label.c], v = owner[r]?.[value.c];
|
|
675
|
+
if (!l || !v || l.r !== r || v.r !== r || l.c !== label.c || v.c !== value.c || l.cs !== label.cs || v.cs !== value.cs || l.rs !== v.rs) continue;
|
|
676
|
+
const lc = table.cells[r][l.c], vc = table.cells[r][v.c];
|
|
677
|
+
const list = labelsOf(lc);
|
|
678
|
+
if (!plain(lc) || !plain(vc) || !textOf(vc) || !list || pageOf(l) !== pageOf(v)) continue;
|
|
679
|
+
if (l.rs === 1) {
|
|
680
|
+
if (list.join("|") === sequence.join("|") && alignedLabels(lc, vc, list.length)) peers++;
|
|
681
|
+
continue;
|
|
682
|
+
}
|
|
683
|
+
if (list.length < 3 || new Set(list).size !== list.length) continue;
|
|
684
|
+
const visible = CELL_LINES.get(lc)?.length ?? 0, values = CELL_LINES.get(vc);
|
|
685
|
+
if (visible < 3 || visible > list.length || !values || !alignedLabels(lc, vc, visible)) continue;
|
|
686
|
+
const top = Math.max(...values.map((v2) => v2.y)), bottom = Math.min(...values.map((v2) => v2.y));
|
|
687
|
+
const contexts = [];
|
|
688
|
+
for (let rr = r; rr < r + l.rs && rr < table.rows; rr++) {
|
|
689
|
+
const a = owner[rr]?.[context.c], cell = a ? table.cells[a.r][a.c] : void 0;
|
|
690
|
+
if (!a || a.r !== rr || a.c !== context.c || a.cs !== context.cs || a.rs !== 1 || !cell || !plain(cell) || !textOf(cell) || pageOf(a) !== pageOf(l)) break;
|
|
691
|
+
const lines = CELL_LINES.get(cell);
|
|
692
|
+
if (!lines?.length || lines.some((line) => line.y > top + 1 || line.y < bottom - 1)) break;
|
|
693
|
+
contexts.push(textOf(cell).replace(/\s+/g, ""));
|
|
694
|
+
}
|
|
695
|
+
if (new Set(contexts).size >= 2) shared = true;
|
|
696
|
+
}
|
|
697
|
+
return peers >= 2 && shared ? { context, label, value } : void 0;
|
|
698
|
+
}
|
|
699
|
+
function matchesCompleteAlignedLabelListRow(table, owner, first) {
|
|
700
|
+
const pairs = [];
|
|
701
|
+
let carried = false;
|
|
702
|
+
for (let c = 0; c < table.cols; ) {
|
|
703
|
+
const u = owner[first - 1]?.[c], d = owner[first]?.[c];
|
|
704
|
+
if (u && u === d) {
|
|
705
|
+
carried = true;
|
|
706
|
+
c = u.c + u.cs;
|
|
707
|
+
continue;
|
|
708
|
+
}
|
|
709
|
+
const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
|
|
710
|
+
if (!upper?.text.trim() && !lower?.text.trim()) {
|
|
711
|
+
c++;
|
|
712
|
+
continue;
|
|
713
|
+
}
|
|
714
|
+
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)) return false;
|
|
715
|
+
pairs.push({ c, cs: u.cs, upper, lower });
|
|
716
|
+
c += u.cs;
|
|
717
|
+
}
|
|
718
|
+
const filled = pairs.filter((p) => textOf(p.upper) && textOf(p.lower));
|
|
719
|
+
if (!carried || filled.length !== 2) return false;
|
|
720
|
+
const keyed = filled.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
|
|
721
|
+
if (keyed.length !== 1) return false;
|
|
722
|
+
const label = keyed[0], value = filled.find((p) => p !== label);
|
|
723
|
+
const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
|
|
724
|
+
if (D.length < 2 || sequence.length < 3 || new Set(sequence).size !== sequence.length || value.c !== label.c + label.cs || pairs.some((p) => p !== label && p !== value && textOf(p.lower)) || !pairs.some((p) => p.c < label.c && textOf(p.upper) && !textOf(p.lower)) || !alignedLabels(label.upper, value.upper, U.length) || !alignedLabels(label.lower, value.lower, D.length)) return false;
|
|
725
|
+
let peers = 0;
|
|
726
|
+
for (let r = 0; r < table.rows; r++) {
|
|
727
|
+
if (r === first - 1 || r === first) continue;
|
|
728
|
+
const L = owner[r]?.[label.c], V = owner[r]?.[value.c];
|
|
729
|
+
if (L?.r !== r || V?.r !== r || L.c !== label.c || V.c !== value.c || L.rs !== 1 || V.rs !== 1 || L.cs !== label.cs || V.cs !== value.cs) continue;
|
|
730
|
+
const l = table.cells[r][label.c], v = table.cells[r][value.c];
|
|
731
|
+
if (!plain(l) || !plain(v) || !textOf(v) || labelsOf(l)?.join("|") !== sequence.join("|") || !alignedLabels(l, v, sequence.length)) continue;
|
|
732
|
+
if (++peers >= 2) return true;
|
|
733
|
+
}
|
|
734
|
+
return false;
|
|
735
|
+
}
|
|
624
736
|
function matchesIndependentRowPair(table, owner, first) {
|
|
625
737
|
const norm = (cell) => textOf(cell).replace(/\s+/g, "");
|
|
626
738
|
const pairs = [];
|
|
@@ -913,6 +1025,17 @@ function markJoinedPages(table, prev, curr) {
|
|
|
913
1025
|
}
|
|
914
1026
|
});
|
|
915
1027
|
const cr = pt.rows - 1 - off, page = cp[cr];
|
|
1028
|
+
if (cr === -1 && table.cols === pt.cols && pt.cols === ct.cols) {
|
|
1029
|
+
const tailPage = cp[0];
|
|
1030
|
+
if (tailPage === void 0 || tailPage === prev.pageNumber) return;
|
|
1031
|
+
for (let r = 0; r < pt.rows; r++) for (const { cell, c } of rows[r]) {
|
|
1032
|
+
const head = ptRows[r]?.find((s) => s.c === c)?.cell, tail = ctRows[0]?.find((s) => s.c === c)?.cell;
|
|
1033
|
+
if (!head?.text.trim() || !tail?.text.trim() || cell.blocks?.length || cell.colSpan !== head.colSpan || cell.colSpan !== tail.colSpan || cell.rowSpan <= head.rowSpan || r + head.rowSpan !== pt.rows || r + cell.rowSpan <= pt.rows || !cell.text.startsWith(head.text.trimEnd()) || !cell.text.trimEnd().endsWith(tail.text.trimEnd())) continue;
|
|
1034
|
+
const from = head.text.trimEnd().length, at = cell.text.indexOf(tail.text.trim().slice(0, 20), from);
|
|
1035
|
+
if (at >= from) setSplits(cell, [...relocate(head, cell), { at, page: tailPage }, ...relocate(tail, cell, at)]);
|
|
1036
|
+
}
|
|
1037
|
+
return;
|
|
1038
|
+
}
|
|
916
1039
|
if (cr < 0 || page === void 0 || page === prev.pageNumber) return;
|
|
917
1040
|
const tails = ctRows[cr].filter((s) => s.cell.text.trim());
|
|
918
1041
|
for (const { cell } of ctRows[cr]) for (const b of cell.blocks ?? []) b.pageNumber ??= page;
|
|
@@ -963,6 +1086,17 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
963
1086
|
};
|
|
964
1087
|
const e = Math.max(...splits.map((s) => r + s.cell.rowSpan - 1));
|
|
965
1088
|
const cells = t.cells.map((row2) => row2.slice());
|
|
1089
|
+
const cut = pages.findIndex((p, rr) => rr > r && p !== pages[r]);
|
|
1090
|
+
if (cut > r && splits.every((s) => cut < r + s.cell.rowSpan && pages[cut] === s.split.page)) {
|
|
1091
|
+
for (const { cell, c, split } of splits) {
|
|
1092
|
+
cells[r][c] = clone(cell, { ...split.head, rowSpan: cut - r });
|
|
1093
|
+
const tail = { ...cell, ...split.tail, rowSpan: r + cell.rowSpan - cut };
|
|
1094
|
+
CELL_PAGES.set(tail, split.page);
|
|
1095
|
+
setSplits(tail, split.rest);
|
|
1096
|
+
cells[cut][c] = tail;
|
|
1097
|
+
}
|
|
1098
|
+
return splitCrossPageRows({ ...t, cells }, pageNumber);
|
|
1099
|
+
}
|
|
966
1100
|
const row = Array.from({ length: t.cols }, () => ({ text: "", colSpan: 1, rowSpan: 1 }));
|
|
967
1101
|
for (const { cell, c, split } of splits) {
|
|
968
1102
|
cells[r][c] = clone(cell, split.head);
|
|
@@ -1140,15 +1274,18 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1140
1274
|
ruled: !!pr && !!cr && pr.bottom && cr.top,
|
|
1141
1275
|
list: !shifted ? "any" : skip > 0 && ca.filter((a) => a.r < skip && a.cell.text.trim()).length < 2 ? "none" : "multi"
|
|
1142
1276
|
};
|
|
1143
|
-
let
|
|
1144
|
-
if (
|
|
1277
|
+
let partial = !skip && cols === prev.cols && cols === curr.cols && cut.ruled && prevBottom !== void 0 ? partialAlignedLabelCells(table, owner, first) : void 0;
|
|
1278
|
+
if (partial && (continuesAcross(partial.context.upper, partial.context.lower, U[partial.context.c], U[partial.context.c + partial.context.cs]) || clauseContinues(partial.context.upper, partial.context.lower) || quantityContinues(partial.context.upper, partial.context.lower) || !continuesAcross(partial.value.upper, partial.value.lower, U[partial.value.c], U[partial.value.c + partial.value.cs]) || startsNewItem(partial.value.upper.text, partial.value.lower.text))) partial = void 0;
|
|
1279
|
+
const selected = partial ? /* @__PURE__ */ new Set([partial.label.c, partial.value.c]) : void 0;
|
|
1280
|
+
let split = !selected && rows > prev.rows && mergeSplitRow(table, owner, prev.rows, U, false, cut);
|
|
1281
|
+
if (rows > prev.rows && !split && prevBottom !== void 0 && mergeStraddlingCells(table, owner, prev.rows, prevBottom, lex, U, selected) && !selected) split = mergeSplitRow(table, owner, prev.rows, U, true, { ...cut, open: false });
|
|
1145
1282
|
if (pr && cr) {
|
|
1146
1283
|
const cutRuled = pr.bottom || cr.top;
|
|
1147
1284
|
ROW_RULES.set(table, { top: pr.top, bottom: cr.bottom, innerRuled: pr.innerRuled + cr.innerRuled + (!split && cutRuled ? 1 : 0), innerOpen: pr.innerOpen + cr.innerOpen + (!split && !cutRuled ? 1 : 0) });
|
|
1148
1285
|
}
|
|
1149
1286
|
return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
|
|
1150
1287
|
}
|
|
1151
|
-
function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
|
|
1288
|
+
function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selected) {
|
|
1152
1289
|
const last = first - 1;
|
|
1153
1290
|
const straddles = owner[first].some((o, c) => o !== null && o === owner[last][c]);
|
|
1154
1291
|
let firstNew = table.cols;
|
|
@@ -1205,6 +1342,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
|
|
|
1205
1342
|
c = u.c + u.cs;
|
|
1206
1343
|
if (!d || d === u || u.r + u.rs - 1 !== last || d.r !== first || d.c !== u.c || d.cs !== u.cs) continue;
|
|
1207
1344
|
const a = table.cells[u.r][u.c], b = table.cells[first][d.c];
|
|
1345
|
+
if (selected && !selected.has(u.c)) continue;
|
|
1208
1346
|
const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !startsNewItem(a.text, b.text) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs]);
|
|
1209
1347
|
const openSeam = hasContent(a) && hasContent(b) && hasOpenCellSeam(a, b) && !owner.some((row, r) => {
|
|
1210
1348
|
if (!r || r === first) return false;
|
|
@@ -1213,7 +1351,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
|
|
|
1213
1351
|
const ue = CELL_EDGES.get(table.cells[up.r][up.c]), de = CELL_EDGES.get(table.cells[down.r][down.c]);
|
|
1214
1352
|
return !!ue && !!de && !ue.b && !de.t;
|
|
1215
1353
|
});
|
|
1216
|
-
if (!openSeam && !flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
|
|
1354
|
+
if (!selected && !openSeam && !flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
|
|
1217
1355
|
if (!straddles && !midWord) continue;
|
|
1218
1356
|
if (u.r >= last && d.rs < 2) continue;
|
|
1219
1357
|
const U = CELL_LINES.get(a);
|
|
@@ -1405,7 +1543,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
|
|
|
1405
1543
|
if (!(cut.open && !newCell)) {
|
|
1406
1544
|
if (pairs.some((p) => p[1].rs > 1 && !flows(p))) return false;
|
|
1407
1545
|
const one = pairs.filter(([, d]) => d.rs === 1);
|
|
1408
|
-
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;
|
|
1546
|
+
if (!matchesCompleteSiblingRow(table, owner, first) && !matchesCompleteRubricRow(table, owner, first) && !(cut.ruled && (matchesCompleteContextRow(table, owner, first) || matchesCompleteAlignedLabelListRow(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;
|
|
1409
1547
|
}
|
|
1410
1548
|
}
|
|
1411
1549
|
for (const [u, d] of pairs) {
|
|
@@ -1853,6 +1991,30 @@ function fillNestedContinuation(blocks, at) {
|
|
|
1853
1991
|
|
|
1854
1992
|
// src/pdf/symbol-glyphs.ts
|
|
1855
1993
|
import { OPS as OPS3 } from "pdfjs-dist/legacy/build/pdf.mjs";
|
|
1994
|
+
|
|
1995
|
+
// src/pdf/known-font-glyphs.ts
|
|
1996
|
+
import { createHash as createHash2 } from "crypto";
|
|
1997
|
+
var HCR_DOT = "bb7a2a3ab48d5bfdfd9582c0fb6525401c3a7f1851bb1c1bdb45048be95d1599";
|
|
1998
|
+
var BATANG_NUMBERS = [
|
|
1999
|
+
"8a4af2cf2dfe3238b4e2b35af976746216ade6e89cd3c55ec1e43bca532379b9",
|
|
2000
|
+
"7332dcab9d77002bdb92723a7fa4afa963ad01601f6328fbedd7289798fb77d0",
|
|
2001
|
+
"e7cc725807eae1ae0311898429629931f5924ade91a876c899b0c5bd109b325b",
|
|
2002
|
+
"3956a9db6baa74ef40ff93291ef5c42245cd4b36d613e5c956e307f347705adb",
|
|
2003
|
+
"8340732dc5f6a75a6808e87749ae9e9e7d54f4299f86eabbfaedd95da10ad447",
|
|
2004
|
+
"1412a79bd9ed7fdb34a8f04c29e341230a3bef649fb7b44a58ea6a56da0f3e44"
|
|
2005
|
+
];
|
|
2006
|
+
function knownFontGlyph(name, outline, width) {
|
|
2007
|
+
const face = name?.replace(/^[A-Z]{6}\+/, "");
|
|
2008
|
+
const dot = face === "HCRDotum" && width === 970 && outline.upm === 1e3;
|
|
2009
|
+
const number = (face === "Haansoft Batang" || face === "Haansoft-Batang") && width === 1e3 && outline.upm === 1024;
|
|
2010
|
+
if (!dot && !number) return null;
|
|
2011
|
+
const signature = createHash2("sha256").update(JSON.stringify([outline.upm, width, outline.contours])).digest("hex");
|
|
2012
|
+
if (dot) return signature === HCR_DOT ? mapPuaText(String.fromCodePoint(983791)) : null;
|
|
2013
|
+
const index = BATANG_NUMBERS.indexOf(signature);
|
|
2014
|
+
return index < 0 ? null : mapPuaText(String.fromCodePoint(983729 + index));
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
// src/pdf/symbol-glyphs.ts
|
|
1856
2018
|
var NO_UNICODE = "\uF000";
|
|
1857
2019
|
var u16 = (b, o) => b[o] << 8 | b[o + 1];
|
|
1858
2020
|
var i16 = (b, o) => {
|
|
@@ -2016,14 +2178,14 @@ function restoreUnmappedGlyphs(items, fnArray, argsArray, fontObj) {
|
|
|
2016
2178
|
for (const g2 of args[0]) {
|
|
2017
2179
|
const glyph = g2;
|
|
2018
2180
|
if (!glyph || glyph.unicode !== NO_UNICODE || typeof glyph.fontChar !== "string") continue;
|
|
2019
|
-
const key = font + "\0" + glyph.fontChar;
|
|
2181
|
+
const key = font + "\0" + glyph.fontChar + "\0" + typeof glyph.width + ":" + String(glyph.width);
|
|
2020
2182
|
if (!cache.has(key)) {
|
|
2021
2183
|
let sym = null;
|
|
2022
2184
|
try {
|
|
2023
|
-
const
|
|
2185
|
+
const source = fontObj(font), data = source?.data;
|
|
2024
2186
|
const code = glyph.fontChar.codePointAt(0);
|
|
2025
2187
|
const outline = data && code !== void 0 ? readOutline(data, code) : null;
|
|
2026
|
-
if (outline) sym = classifyOutline(outline);
|
|
2188
|
+
if (outline) sym = knownFontGlyph(source?.name, outline, glyph.width) ?? classifyOutline(outline);
|
|
2027
2189
|
} catch {
|
|
2028
2190
|
}
|
|
2029
2191
|
cache.set(key, sym);
|
|
@@ -3433,7 +3595,7 @@ function mergeLinkRuns(markdown) {
|
|
|
3433
3595
|
|
|
3434
3596
|
// src/pdf/formula-ocr.ts
|
|
3435
3597
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
3436
|
-
const formulaMod = await import("./formula-
|
|
3598
|
+
const formulaMod = await import("./formula-FSVHUQ6Y.js");
|
|
3437
3599
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
3438
3600
|
await ensureFormulaModels((p) => {
|
|
3439
3601
|
if (p.phase === "download" && p.total) {
|
|
@@ -3859,10 +4021,10 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3859
4021
|
}
|
|
3860
4022
|
if (targets.size > 0) {
|
|
3861
4023
|
try {
|
|
3862
|
-
const { runPdfOcr } = await import("./pdf-ocr-
|
|
4024
|
+
const { runPdfOcr } = await import("./pdf-ocr-ZP2CUWSO.js");
|
|
3863
4025
|
const mode = typeof options?.ocr === "function" ? options.ocr : "builtin";
|
|
3864
4026
|
const regionPages = new Map([...ocrRegions].filter(([p]) => options?.ocr !== "force" && !isImageBased && !pageQuality.find((q) => q.page === p)?.needsOcr));
|
|
3865
|
-
const { builtinOcrConfig } = await import("./pdf-ocr-
|
|
4027
|
+
const { builtinOcrConfig } = await import("./pdf-ocr-ZP2CUWSO.js");
|
|
3866
4028
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options?.onProgress, options?.tables !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
|
|
3867
4029
|
for (const obs of ocrPageBlocks.values()) stripScriptTags({ blocks: obs });
|
|
3868
4030
|
if (ocrPageBlocks.size > 0) {
|
|
@@ -4107,4 +4269,4 @@ export {
|
|
|
4107
4269
|
parsePdfDocument,
|
|
4108
4270
|
removeHeaderFooterBlocks
|
|
4109
4271
|
};
|
|
4110
|
-
//# sourceMappingURL=parser-
|
|
4272
|
+
//# sourceMappingURL=parser-RVMH4PUB.js.map
|