kordoc 3.16.1 → 3.16.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/dist/{-YVONYEEN.js → -C4FVXHIP.js} +7 -7
- package/dist/{chunk-K4L563FA.js → chunk-4WI7QXEG.js} +2 -2
- package/dist/{chunk-VNIQK4AL.cjs → chunk-72LLOLFX.cjs} +2 -2
- package/dist/{chunk-VNIQK4AL.cjs.map → chunk-72LLOLFX.cjs.map} +1 -1
- package/dist/{chunk-CDFCA37S.js → chunk-E4Y73XRH.js} +3 -3
- package/dist/{chunk-QOPY6URE.js → chunk-EJ2ZIYTO.js} +2 -2
- package/dist/{chunk-I6T3DKYK.js → chunk-EUEKDZ7O.js} +7 -7
- package/dist/{chunk-IY3NX4FT.js → chunk-HECUYZZK.js} +2 -2
- package/dist/{chunk-F62GOZFB.js → chunk-IS3IK7UT.js} +2 -2
- package/dist/{chunk-7WUTJXKP.js → chunk-WR5LHRXO.js} +3 -3
- package/dist/cli.js +12 -12
- package/dist/index.cjs +128 -128
- package/dist/index.js +2 -2
- package/dist/mcp.js +8 -8
- package/dist/{parser-B4O7CW5Q.js → parser-CMPNM6ZL.js} +4 -4
- package/dist/parser-CMPNM6ZL.js.map +1 -0
- package/dist/{parser-BNEAMKUF.js → parser-GWL72XYS.js} +3 -3
- package/dist/parser-GWL72XYS.js.map +1 -0
- package/dist/{parser-3O2UF6VO.cjs → parser-YVRTKGKO.cjs} +15 -15
- package/dist/{parser-3O2UF6VO.cjs.map → parser-YVRTKGKO.cjs.map} +1 -1
- package/dist/render-A2LFMJCP.js +10 -0
- package/dist/seal-KA4VAV2Z.js +10 -0
- package/dist/{watch-RLF5F3TN.js → watch-WLI6K3IR.js} +7 -7
- package/package.json +1 -1
- package/dist/parser-B4O7CW5Q.js.map +0 -1
- package/dist/parser-BNEAMKUF.js.map +0 -1
- package/dist/render-QCNMRR7L.js +0 -10
- package/dist/seal-REDSMUI5.js +0 -10
- /package/dist/{-YVONYEEN.js.map → -C4FVXHIP.js.map} +0 -0
- /package/dist/{chunk-K4L563FA.js.map → chunk-4WI7QXEG.js.map} +0 -0
- /package/dist/{chunk-CDFCA37S.js.map → chunk-E4Y73XRH.js.map} +0 -0
- /package/dist/{chunk-QOPY6URE.js.map → chunk-EJ2ZIYTO.js.map} +0 -0
- /package/dist/{chunk-I6T3DKYK.js.map → chunk-EUEKDZ7O.js.map} +0 -0
- /package/dist/{chunk-IY3NX4FT.js.map → chunk-HECUYZZK.js.map} +0 -0
- /package/dist/{chunk-F62GOZFB.js.map → chunk-IS3IK7UT.js.map} +0 -0
- /package/dist/{chunk-7WUTJXKP.js.map → chunk-WR5LHRXO.js.map} +0 -0
- /package/dist/{render-QCNMRR7L.js.map → render-A2LFMJCP.js.map} +0 -0
- /package/dist/{seal-REDSMUI5.js.map → seal-KA4VAV2Z.js.map} +0 -0
- /package/dist/{watch-RLF5F3TN.js.map → watch-WLI6K3IR.js.map} +0 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunk72LLOLFXcjs = require('./chunk-72LLOLFX.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -2147,14 +2147,14 @@ function isProseSpread(items) {
|
|
|
2147
2147
|
for (let i = 1; i < sorted.length; i++) {
|
|
2148
2148
|
gaps.push(sorted[i].x - (sorted[i - 1].x + sorted[i - 1].w));
|
|
2149
2149
|
}
|
|
2150
|
-
const maxGap =
|
|
2150
|
+
const maxGap = _chunk72LLOLFXcjs.safeMax.call(void 0, gaps);
|
|
2151
2151
|
const avgLen = items.reduce((s, i) => s + i.text.length, 0) / items.length;
|
|
2152
2152
|
return maxGap < 40 && avgLen < 5;
|
|
2153
2153
|
}
|
|
2154
2154
|
function detectColumns(yLines) {
|
|
2155
2155
|
const allItems = yLines.flat();
|
|
2156
2156
|
if (allItems.length === 0) return null;
|
|
2157
|
-
const pageWidth =
|
|
2157
|
+
const pageWidth = _chunk72LLOLFXcjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunk72LLOLFXcjs.safeMin.call(void 0, allItems.map((i) => i.x));
|
|
2158
2158
|
if (pageWidth < 100) return null;
|
|
2159
2159
|
let bigoLineIdx = -1;
|
|
2160
2160
|
for (let i = 0; i < yLines.length; i++) {
|
|
@@ -2376,9 +2376,9 @@ function detectHeadings(blocks, medianFontSize) {
|
|
|
2376
2376
|
if (/^\d+$/.test(text)) continue;
|
|
2377
2377
|
const ratio = block.style.fontSize / medianFontSize;
|
|
2378
2378
|
let level = 0;
|
|
2379
|
-
if (ratio >=
|
|
2380
|
-
else if (ratio >=
|
|
2381
|
-
else if (ratio >=
|
|
2379
|
+
if (ratio >= _chunk72LLOLFXcjs.HEADING_RATIO_H1) level = 1;
|
|
2380
|
+
else if (ratio >= _chunk72LLOLFXcjs.HEADING_RATIO_H2) level = 2;
|
|
2381
|
+
else if (ratio >= _chunk72LLOLFXcjs.HEADING_RATIO_H3) level = 3;
|
|
2382
2382
|
if (level > 0) {
|
|
2383
2383
|
block.type = "heading";
|
|
2384
2384
|
block.level = level;
|
|
@@ -2393,7 +2393,7 @@ function shouldDemoteTable(table) {
|
|
|
2393
2393
|
const t = c.text.trim();
|
|
2394
2394
|
return t.length > 0 && t.length <= 12 && !/[□■◆○●▶ㅇ<>]/.test(t);
|
|
2395
2395
|
}) && table.cells.slice(1).some((row) => row.some((c) => c.text.trim() !== ""))) return false;
|
|
2396
|
-
if (table.rows <= 3 && table.cols <= 3) {
|
|
2396
|
+
if (table.rows <= 3 && table.cols <= 3 && allText.length <= 200) {
|
|
2397
2397
|
const totalCells2 = table.rows * table.cols;
|
|
2398
2398
|
const emptyCells2 = totalCells2 - allCells.length;
|
|
2399
2399
|
if (emptyCells2 >= totalCells2 * 0.3) return true;
|
|
@@ -2954,7 +2954,7 @@ function extractBlocksWithGrids(items, pageNum, grids, horizontals, verticals) {
|
|
|
2954
2954
|
}
|
|
2955
2955
|
if (remaining.length > 0) {
|
|
2956
2956
|
const allY = remaining.map((i) => i.y);
|
|
2957
|
-
const pageH =
|
|
2957
|
+
const pageH = _chunk72LLOLFXcjs.safeMax.call(void 0, allY) - _chunk72LLOLFXcjs.safeMin.call(void 0, allY);
|
|
2958
2958
|
const groups = xyCutOrder(remaining, Math.max(15, pageH * 0.03));
|
|
2959
2959
|
const textBlocks = [];
|
|
2960
2960
|
for (const group of groups) {
|
|
@@ -3130,7 +3130,7 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false) {
|
|
|
3130
3130
|
blocks.push({ type: "paragraph", text: tableText, pageNumber: pageNum, bbox, style: dominantStyle(items) });
|
|
3131
3131
|
} else {
|
|
3132
3132
|
const allY = items.map((i) => i.y);
|
|
3133
|
-
const pageHeight =
|
|
3133
|
+
const pageHeight = _chunk72LLOLFXcjs.safeMax.call(void 0, allY) - _chunk72LLOLFXcjs.safeMin.call(void 0, allY);
|
|
3134
3134
|
const gapThreshold = Math.max(15, pageHeight * 0.03);
|
|
3135
3135
|
const orderedGroups = proseCutX !== null ? splitTwoColumnProse(items, proseCutX) : xyCutOrder(items, gapThreshold);
|
|
3136
3136
|
for (const group of orderedGroups) {
|
|
@@ -3383,7 +3383,7 @@ async function loadPdfWithTimeout(buffer) {
|
|
|
3383
3383
|
new Promise((_, reject) => {
|
|
3384
3384
|
timer = setTimeout(() => {
|
|
3385
3385
|
loadingTask.destroy();
|
|
3386
|
-
reject(new (0,
|
|
3386
|
+
reject(new (0, _chunk72LLOLFXcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
|
|
3387
3387
|
}, PDF_LOAD_TIMEOUT_MS);
|
|
3388
3388
|
})
|
|
3389
3389
|
]);
|
|
@@ -3396,7 +3396,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3396
3396
|
const doc = await loadPdfWithTimeout(buffer);
|
|
3397
3397
|
try {
|
|
3398
3398
|
const pageCount = doc.numPages;
|
|
3399
|
-
if (pageCount === 0) throw new (0,
|
|
3399
|
+
if (pageCount === 0) throw new (0, _chunk72LLOLFXcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
3400
3400
|
const metadata = { pageCount };
|
|
3401
3401
|
await extractPdfMetadata(doc, metadata);
|
|
3402
3402
|
const blocks = [];
|
|
@@ -3456,11 +3456,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3456
3456
|
pageText += pageText ? "\n" + t : t;
|
|
3457
3457
|
}
|
|
3458
3458
|
pageQuality.push(computePageQuality(i, pageText));
|
|
3459
|
-
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0,
|
|
3459
|
+
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunk72LLOLFXcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
|
|
3460
3460
|
parsedPages++;
|
|
3461
3461
|
_optionalChain([options, 'optionalAccess', _36 => _36.onProgress, 'optionalCall', _37 => _37(parsedPages, totalTarget)]);
|
|
3462
3462
|
} catch (pageErr) {
|
|
3463
|
-
if (pageErr instanceof
|
|
3463
|
+
if (pageErr instanceof _chunk72LLOLFXcjs.KordocError) throw pageErr;
|
|
3464
3464
|
warnings.push({ page: i, message: `\uD398\uC774\uC9C0 ${i} \uD30C\uC2F1 \uC2E4\uD328: ${pageErr instanceof Error ? pageErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
|
|
3465
3465
|
}
|
|
3466
3466
|
}
|
|
@@ -3528,7 +3528,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3528
3528
|
detectKoreanListBlocks(blocks);
|
|
3529
3529
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3530
3530
|
sanitizeBlockControlChars(blocks);
|
|
3531
|
-
let markdown = cleanPdfText(
|
|
3531
|
+
let markdown = cleanPdfText(_chunk72LLOLFXcjs.blocksToMarkdown.call(void 0, blocks));
|
|
3532
3532
|
return {
|
|
3533
3533
|
markdown,
|
|
3534
3534
|
blocks,
|
|
@@ -3587,4 +3587,4 @@ async function extractPdfMetadataOnly(buffer) {
|
|
|
3587
3587
|
|
|
3588
3588
|
|
|
3589
3589
|
exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = detectKoreanListBlocks; exports.detectTableCaptions = detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = removeHeaderFooterBlocks;
|
|
3590
|
-
//# sourceMappingURL=parser-
|
|
3590
|
+
//# sourceMappingURL=parser-YVRTKGKO.cjs.map
|