kordoc 4.18.1 → 4.18.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 +7 -6
- package/dist/{-X4KTLQC6.js → -I3CP33G4.js} +13 -11
- package/dist/{chunk-NQR3VKWN.js → chunk-4B2EXELH.js} +2 -2
- package/dist/{chunk-SQQ4ITJ5.js → chunk-6OKBTY72.js} +2 -2
- package/dist/{chunk-HUGBJVAA.js → chunk-B2E6C2LH.js} +12 -7
- package/dist/chunk-B2E6C2LH.js.map +1 -0
- package/dist/{chunk-X625PCZM.js → chunk-BL7KRE6X.js} +3 -3
- package/dist/{chunk-5PNQIF3V.js → chunk-C2CVOC5K.js} +4 -4
- package/dist/{chunk-AQUNBGXH.js → chunk-CKUIFTXJ.js} +2 -2
- package/dist/{chunk-TMC4A3FM.js → chunk-F5HING4Y.js} +10 -5
- package/dist/chunk-F5HING4Y.js.map +1 -0
- package/dist/{chunk-PWRY4W6Q.js → chunk-GM7XIZF2.js} +2 -2
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-K35WIYBD.js → chunk-IA3UKDHA.js} +4 -4
- package/dist/chunk-IA3UKDHA.js.map +1 -0
- package/dist/chunk-J55UQC5H.cjs.map +1 -1
- package/dist/{chunk-7DC2KL3V.cjs → chunk-KDMAYOWH.cjs} +158 -43
- package/dist/chunk-KDMAYOWH.cjs.map +1 -0
- package/dist/{chunk-Z4KCEERM.js → chunk-L5RLJPI3.js} +3 -3
- package/dist/{chunk-WWOTHS2E.js → chunk-L64QRUMK.js} +202 -7
- package/dist/chunk-L64QRUMK.js.map +1 -0
- package/dist/{chunk-6N5BOPJI.js → chunk-LACO375L.js} +2 -2
- package/dist/{chunk-KXR4CTFT.js → chunk-LSOD2A6N.js} +2 -2
- package/dist/{chunk-UTVMLJZE.js → chunk-M4P7YS2N.js} +389 -57
- package/dist/chunk-M4P7YS2N.js.map +1 -0
- package/dist/{chunk-VDIXNEWV.js → chunk-N5DQFA7L.js} +2 -2
- package/dist/{chunk-R2IFWAHI.js → chunk-NZM2SSI4.js} +2 -2
- package/dist/{chunk-KBZ3MQJX.js → chunk-O2DI4GHD.js} +2 -2
- package/dist/{chunk-I7YWXECO.js → chunk-OBILAVWC.js} +2 -2
- package/dist/{chunk-6V7QRQY3.js → chunk-OGAYGUJF.js} +122 -87
- package/dist/chunk-OGAYGUJF.js.map +1 -0
- package/dist/{chunk-IUMV45TX.cjs → chunk-OI5ZSSIC.cjs} +12 -12
- package/dist/chunk-OI5ZSSIC.cjs.map +1 -0
- package/dist/{chunk-Q5N4YS3T.cjs → chunk-QGFZU3JE.cjs} +16 -11
- package/dist/chunk-QGFZU3JE.cjs.map +1 -0
- package/dist/{chunk-2VFZQ634.js → chunk-QP7IXF7R.js} +2 -2
- package/dist/{chunk-CWJ5KY2F.js → chunk-T4MXCSBP.js} +137 -27
- package/dist/chunk-T4MXCSBP.js.map +1 -0
- package/dist/{chunk-PCSOJ523.cjs → chunk-UZGZRGYM.cjs} +2 -2
- package/dist/chunk-UZGZRGYM.cjs.map +1 -0
- package/dist/{chunk-MTTYJEKA.js → chunk-VSY5PAJ5.js} +2 -2
- package/dist/{chunk-IXAXI2S3.cjs → chunk-W2YYBPW5.cjs} +3 -3
- package/dist/chunk-W2YYBPW5.cjs.map +1 -0
- package/dist/{chunk-SIZ63E5G.cjs → chunk-YNLW6EGU.cjs} +3 -3
- package/dist/chunk-YNLW6EGU.cjs.map +1 -0
- package/dist/chunks-IFFRC5IQ.js +10 -0
- package/dist/cli.js +26 -26
- package/dist/{formula-LICM6K27.js → formula-AQZODKZF.js} +3 -3
- package/dist/{formula-T4Q2UHWO.js → formula-E3N7KDDG.js} +4 -4
- package/dist/{formula-W3GQC6L6.cjs → formula-VY4ITOMN.cjs} +9 -9
- package/dist/formula-VY4ITOMN.cjs.map +1 -0
- package/dist/{image-ocr-7PNHBD2G.cjs → image-ocr-6LYEBMVR.cjs} +15 -15
- package/dist/image-ocr-6LYEBMVR.cjs.map +1 -0
- package/dist/{image-ocr-WZJURDX6.js → image-ocr-IMYXOHHV.js} +6 -6
- package/dist/{image-ocr-XB2NFKGZ.js → image-ocr-LN3GSQPW.js} +9 -9
- package/dist/index.cjs +1037 -603
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +523 -89
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +26 -27
- package/dist/mcp.js.map +1 -1
- package/dist/{model-bundle-O2XYR54X.js → model-bundle-IHKNDLOT.js} +5 -5
- package/dist/{models-SKK3NH3V.js → models-YXITRAMR.js} +5 -5
- package/dist/page-range-QHHFTL7X.cjs.map +1 -1
- package/dist/{parser-PJUZSMFR.cjs → parser-7KECZTTP.cjs} +176 -228
- package/dist/parser-7KECZTTP.cjs.map +1 -0
- package/dist/{parser-4D2M5BKY.js → parser-KB4BYQBZ.js} +14 -66
- package/dist/parser-KB4BYQBZ.js.map +1 -0
- package/dist/{parser-5G5G7HHG.js → parser-M3T2EWUN.js} +11 -63
- package/dist/parser-M3T2EWUN.js.map +1 -0
- package/dist/pdf-ocr-4S2OAHUX.js +15 -0
- package/dist/pdf-ocr-IGYCZ7G2.cjs +16 -0
- package/dist/pdf-ocr-IGYCZ7G2.cjs.map +1 -0
- package/dist/pdf-ocr-YEBFWU2K.js +19 -0
- package/dist/{profile-io-BAQTYPK7.js → profile-io-GQWQR7YQ.js} +3 -3
- package/dist/{rasterize-A2ZEACKV.js → rasterize-Y6TVFQ3M.js} +3 -3
- package/dist/{redact-doc-26KN2LSZ.js → redact-doc-TRPZ3HNW.js} +11 -11
- package/dist/{render-62ZUDMHB.js → render-GHT5HKBO.js} +7 -7
- package/dist/seal-3YTXSABW.js +10 -0
- package/dist/{setup-2A3E6WRE.js → setup-AGSCEHDB.js} +3 -3
- package/dist/visual-R3E35Q2K.js +20 -0
- package/dist/{watch-D2T5FEKT.js → watch-ALSEW4GB.js} +13 -13
- package/dist/watch-ALSEW4GB.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-6V7QRQY3.js.map +0 -1
- package/dist/chunk-7DC2KL3V.cjs.map +0 -1
- package/dist/chunk-CWJ5KY2F.js.map +0 -1
- package/dist/chunk-HUGBJVAA.js.map +0 -1
- package/dist/chunk-IUMV45TX.cjs.map +0 -1
- package/dist/chunk-IXAXI2S3.cjs.map +0 -1
- package/dist/chunk-K35WIYBD.js.map +0 -1
- package/dist/chunk-PCSOJ523.cjs.map +0 -1
- package/dist/chunk-Q5N4YS3T.cjs.map +0 -1
- package/dist/chunk-SIZ63E5G.cjs.map +0 -1
- package/dist/chunk-TMC4A3FM.js.map +0 -1
- package/dist/chunk-UTVMLJZE.js.map +0 -1
- package/dist/chunk-WWOTHS2E.js.map +0 -1
- package/dist/chunks-ACUC63N3.js +0 -10
- package/dist/formula-W3GQC6L6.cjs.map +0 -1
- package/dist/image-ocr-7PNHBD2G.cjs.map +0 -1
- package/dist/parser-4D2M5BKY.js.map +0 -1
- package/dist/parser-5G5G7HHG.js.map +0 -1
- package/dist/parser-PJUZSMFR.cjs.map +0 -1
- package/dist/pdf-ocr-EGWOIB6O.cjs +0 -16
- package/dist/pdf-ocr-EGWOIB6O.cjs.map +0 -1
- package/dist/pdf-ocr-NJTFXBRC.js +0 -19
- package/dist/pdf-ocr-ZXR6Q6BK.js +0 -15
- package/dist/seal-3GXC2API.js +0 -10
- package/dist/visual-4ZBZRMCM.js +0 -20
- package/dist/watch-D2T5FEKT.js.map +0 -1
- /package/dist/{-X4KTLQC6.js.map → -I3CP33G4.js.map} +0 -0
- /package/dist/{chunk-NQR3VKWN.js.map → chunk-4B2EXELH.js.map} +0 -0
- /package/dist/{chunk-SQQ4ITJ5.js.map → chunk-6OKBTY72.js.map} +0 -0
- /package/dist/{chunk-X625PCZM.js.map → chunk-BL7KRE6X.js.map} +0 -0
- /package/dist/{chunk-5PNQIF3V.js.map → chunk-C2CVOC5K.js.map} +0 -0
- /package/dist/{chunk-AQUNBGXH.js.map → chunk-CKUIFTXJ.js.map} +0 -0
- /package/dist/{chunk-PWRY4W6Q.js.map → chunk-GM7XIZF2.js.map} +0 -0
- /package/dist/{chunk-Z4KCEERM.js.map → chunk-L5RLJPI3.js.map} +0 -0
- /package/dist/{chunk-6N5BOPJI.js.map → chunk-LACO375L.js.map} +0 -0
- /package/dist/{chunk-KXR4CTFT.js.map → chunk-LSOD2A6N.js.map} +0 -0
- /package/dist/{chunk-VDIXNEWV.js.map → chunk-N5DQFA7L.js.map} +0 -0
- /package/dist/{chunk-R2IFWAHI.js.map → chunk-NZM2SSI4.js.map} +0 -0
- /package/dist/{chunk-KBZ3MQJX.js.map → chunk-O2DI4GHD.js.map} +0 -0
- /package/dist/{chunk-I7YWXECO.js.map → chunk-OBILAVWC.js.map} +0 -0
- /package/dist/{chunk-2VFZQ634.js.map → chunk-QP7IXF7R.js.map} +0 -0
- /package/dist/{chunk-MTTYJEKA.js.map → chunk-VSY5PAJ5.js.map} +0 -0
- /package/dist/{chunks-ACUC63N3.js.map → chunks-IFFRC5IQ.js.map} +0 -0
- /package/dist/{formula-LICM6K27.js.map → formula-AQZODKZF.js.map} +0 -0
- /package/dist/{formula-T4Q2UHWO.js.map → formula-E3N7KDDG.js.map} +0 -0
- /package/dist/{image-ocr-WZJURDX6.js.map → image-ocr-IMYXOHHV.js.map} +0 -0
- /package/dist/{image-ocr-XB2NFKGZ.js.map → image-ocr-LN3GSQPW.js.map} +0 -0
- /package/dist/{model-bundle-O2XYR54X.js.map → model-bundle-IHKNDLOT.js.map} +0 -0
- /package/dist/{models-SKK3NH3V.js.map → models-YXITRAMR.js.map} +0 -0
- /package/dist/{pdf-ocr-NJTFXBRC.js.map → pdf-ocr-4S2OAHUX.js.map} +0 -0
- /package/dist/{pdf-ocr-ZXR6Q6BK.js.map → pdf-ocr-YEBFWU2K.js.map} +0 -0
- /package/dist/{profile-io-BAQTYPK7.js.map → profile-io-GQWQR7YQ.js.map} +0 -0
- /package/dist/{rasterize-A2ZEACKV.js.map → rasterize-Y6TVFQ3M.js.map} +0 -0
- /package/dist/{redact-doc-26KN2LSZ.js.map → redact-doc-TRPZ3HNW.js.map} +0 -0
- /package/dist/{render-62ZUDMHB.js.map → render-GHT5HKBO.js.map} +0 -0
- /package/dist/{seal-3GXC2API.js.map → seal-3YTXSABW.js.map} +0 -0
- /package/dist/{setup-2A3E6WRE.js.map → setup-AGSCEHDB.js.map} +0 -0
- /package/dist/{visual-4ZBZRMCM.js.map → visual-R3E35Q2K.js.map} +0 -0
|
@@ -36,27 +36,29 @@ import {
|
|
|
36
36
|
normalizeItems,
|
|
37
37
|
refineDocumentStyleHeadings,
|
|
38
38
|
removeHeaderFooterBlocks,
|
|
39
|
+
removeSideTabs,
|
|
39
40
|
startsNewItem,
|
|
40
41
|
trimTrailingEmptyTableCols,
|
|
41
42
|
wrapJoiner
|
|
42
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-OGAYGUJF.js";
|
|
43
44
|
import {
|
|
44
45
|
ocrModelsCached
|
|
45
|
-
} from "./chunk-
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
46
|
+
} from "./chunk-NZM2SSI4.js";
|
|
47
|
+
import "./chunk-4B2EXELH.js";
|
|
48
|
+
import "./chunk-6OKBTY72.js";
|
|
48
49
|
import {
|
|
49
50
|
blocksToPages
|
|
50
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-GM7XIZF2.js";
|
|
51
52
|
import {
|
|
52
53
|
encodePng
|
|
53
54
|
} from "./chunk-7FCNOKOR.js";
|
|
54
55
|
import {
|
|
55
56
|
CELL_EDGES,
|
|
56
57
|
CONTENT_CELLS,
|
|
58
|
+
escapeLiteralTags,
|
|
57
59
|
stripScriptTags,
|
|
58
60
|
unframeLayoutTables
|
|
59
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-F5HING4Y.js";
|
|
60
62
|
import {
|
|
61
63
|
hasRequestedPagesAfter,
|
|
62
64
|
parsePageRange
|
|
@@ -65,11 +67,11 @@ import {
|
|
|
65
67
|
WINGDINGS,
|
|
66
68
|
blocksToMarkdown,
|
|
67
69
|
escapeLiteralDollar
|
|
68
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-IA3UKDHA.js";
|
|
69
71
|
import {
|
|
70
72
|
KordocError,
|
|
71
73
|
sanitizeHref
|
|
72
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-OBILAVWC.js";
|
|
73
75
|
|
|
74
76
|
// src/pdf/ocr-region-merge.ts
|
|
75
77
|
function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
|
|
@@ -2335,61 +2337,6 @@ function orderTwoUpPage(blocks, pageWidth, pageHeight) {
|
|
|
2335
2337
|
return [...left, ...right, ...rest];
|
|
2336
2338
|
}
|
|
2337
2339
|
|
|
2338
|
-
// src/pdf/side-tabs.ts
|
|
2339
|
-
var BAND = 0.12;
|
|
2340
|
-
var MAX_CHARS = 10;
|
|
2341
|
-
var MIN_REPEAT = 3;
|
|
2342
|
-
var RUN_GAP = 5;
|
|
2343
|
-
function removeSideTabs(blocks, pageWidths) {
|
|
2344
|
-
const edges = /* @__PURE__ */ new Map();
|
|
2345
|
-
for (const b of blocks) {
|
|
2346
|
-
if (!b.bbox || b.pageNumber === void 0 || [...b.text?.trim() ?? ""].length <= MAX_CHARS) continue;
|
|
2347
|
-
const e = edges.get(b.pageNumber) ?? { lefts: [], rights: [] };
|
|
2348
|
-
e.lefts.push(b.bbox.x);
|
|
2349
|
-
e.rights.push(b.bbox.x + b.bbox.width);
|
|
2350
|
-
edges.set(b.pageNumber, e);
|
|
2351
|
-
}
|
|
2352
|
-
const q = (xs, p) => {
|
|
2353
|
-
const v = [...xs].sort((a, b) => a - b);
|
|
2354
|
-
return v[Math.min(v.length - 1, Math.floor(p * v.length))];
|
|
2355
|
-
};
|
|
2356
|
-
const body = /* @__PURE__ */ new Map();
|
|
2357
|
-
for (const [page, e] of edges) body.set(page, { left: q(e.lefts, 0.2), right: q(e.rights, 0.8) });
|
|
2358
|
-
const all = [...body.values()];
|
|
2359
|
-
const fallback = all.length ? { left: q(all.map((e) => e.left), 0.5), right: q(all.map((e) => e.right), 0.5) } : void 0;
|
|
2360
|
-
const key = (b) => {
|
|
2361
|
-
const w = b.pageNumber !== void 0 ? pageWidths.get(b.pageNumber) : void 0;
|
|
2362
|
-
const text = b.text?.trim();
|
|
2363
|
-
const area = (b.pageNumber !== void 0 ? body.get(b.pageNumber) : void 0) ?? fallback;
|
|
2364
|
-
if (!w || !area || !b.bbox || !text || b.type === "table" || [...text].length > MAX_CHARS) return null;
|
|
2365
|
-
const side = b.bbox.x + b.bbox.width <= Math.min(w * BAND, area.left - 1) ? "L" : b.bbox.x >= Math.max(w * (1 - BAND), area.right + 1) ? "R" : null;
|
|
2366
|
-
return side && text.replace(/\s+/g, "");
|
|
2367
|
-
};
|
|
2368
|
-
const pages = /* @__PURE__ */ new Map();
|
|
2369
|
-
for (const b of blocks) {
|
|
2370
|
-
const k = key(b);
|
|
2371
|
-
if (k) pages.set(k, (pages.get(k) ?? /* @__PURE__ */ new Set()).add(b.pageNumber));
|
|
2372
|
-
}
|
|
2373
|
-
const running = /* @__PURE__ */ new Set();
|
|
2374
|
-
for (const [k, ps] of pages) {
|
|
2375
|
-
const list = [...ps].sort((a, b) => a - b);
|
|
2376
|
-
let run = [];
|
|
2377
|
-
const flush = () => {
|
|
2378
|
-
if (run.length >= MIN_REPEAT && run.length >= (run[run.length - 1] - run[0] + 1) * 0.4) for (const p of run) running.add(`${p}\0${k}`);
|
|
2379
|
-
run = [];
|
|
2380
|
-
};
|
|
2381
|
-
for (const p of list) {
|
|
2382
|
-
if (run.length && p - run[run.length - 1] > RUN_GAP) flush();
|
|
2383
|
-
run.push(p);
|
|
2384
|
-
}
|
|
2385
|
-
flush();
|
|
2386
|
-
}
|
|
2387
|
-
return running.size ? blocks.filter((b) => {
|
|
2388
|
-
const k = key(b);
|
|
2389
|
-
return !k || !running.has(`${b.pageNumber}\0${k}`);
|
|
2390
|
-
}) : blocks;
|
|
2391
|
-
}
|
|
2392
|
-
|
|
2393
2340
|
// src/pdf/footnotes.ts
|
|
2394
2341
|
var MARK = /^\d{1,3}\)$/;
|
|
2395
2342
|
function footnoteSeparators(horizontals, pageWidth, pageHeight) {
|
|
@@ -2739,7 +2686,7 @@ function mergeLinkRuns(markdown) {
|
|
|
2739
2686
|
|
|
2740
2687
|
// src/pdf/formula-ocr.ts
|
|
2741
2688
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
2742
|
-
const formulaMod = await import("./formula-
|
|
2689
|
+
const formulaMod = await import("./formula-E3N7KDDG.js");
|
|
2743
2690
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
2744
2691
|
await ensureFormulaModels((p) => {
|
|
2745
2692
|
if (p.phase === "download" && p.total) {
|
|
@@ -3034,6 +2981,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3034
2981
|
if (!faceNames.has(face)) faceNames.set(face, (fontObj(face)?.name ?? "").replace(/^[A-Z]{6}\+/, ""));
|
|
3035
2982
|
}
|
|
3036
2983
|
for (const it of visible) if (it.text.includes("$")) it.text = escapeLiteralDollar(it.text);
|
|
2984
|
+
for (const it of visible) if (it.text.includes("<")) it.text = escapeLiteralTags(it.text);
|
|
3037
2985
|
wrapEquationRuns(visible, (face) => faceNames.get(face));
|
|
3038
2986
|
const pageArea = pageW * pageH;
|
|
3039
2987
|
if (pageArea > 0) {
|
|
@@ -3122,7 +3070,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3122
3070
|
}
|
|
3123
3071
|
if (targets.size > 0) {
|
|
3124
3072
|
try {
|
|
3125
|
-
const { runPdfOcr } = await import("./pdf-ocr-
|
|
3073
|
+
const { runPdfOcr } = await import("./pdf-ocr-YEBFWU2K.js");
|
|
3126
3074
|
const mode = typeof options?.ocr === "function" ? options.ocr : "builtin";
|
|
3127
3075
|
const regionPages = new Map([...ocrRegions].filter(([p]) => options?.ocr !== "force" && !isImageBased && !pageQuality.find((q) => q.page === p)?.needsOcr));
|
|
3128
3076
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options?.onProgress, options?.tables !== false, vectorPageOps, regionPages);
|
|
@@ -3354,4 +3302,4 @@ export {
|
|
|
3354
3302
|
parsePdfDocument,
|
|
3355
3303
|
removeHeaderFooterBlocks
|
|
3356
3304
|
};
|
|
3357
|
-
//# sourceMappingURL=parser-
|
|
3305
|
+
//# sourceMappingURL=parser-KB4BYQBZ.js.map
|