kordoc 4.16.2 → 4.16.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 +3 -6
- package/dist/{-4G6MA4X6.js → -5XQIJN3D.js} +10 -10
- package/dist/{chunk-UTP2WCHS.js → chunk-2EJ5YSFZ.js} +4 -4
- package/dist/{chunk-IQGIT2VX.js → chunk-3ZVZPYSA.js} +5 -5
- package/dist/{chunk-TXUKTOG2.js → chunk-46H2PPG7.js} +3 -3
- package/dist/{chunk-7KNGSQU7.js → chunk-4O5XQSCT.js} +2 -2
- package/dist/{chunk-MLIS253L.js → chunk-7NYRZI2Z.js} +2 -2
- package/dist/{chunk-GO5IFOUF.js → chunk-7USPM2VT.js} +2 -2
- package/dist/{chunk-XTFN5WKS.cjs → chunk-7WV3WETF.cjs} +6 -6
- package/dist/{chunk-XTFN5WKS.cjs.map → chunk-7WV3WETF.cjs.map} +1 -1
- package/dist/{chunk-KIOQ4N37.js → chunk-AL2WM6ZZ.js} +2 -2
- package/dist/{chunk-F4NRLLY4.js → chunk-AWWFGIBA.js} +2 -2
- package/dist/{chunk-QOCS7W7R.js → chunk-D2UGAEXY.js} +9 -9
- package/dist/{chunk-P6ZDXTV6.js → chunk-ENF34XNH.js} +2 -2
- package/dist/{chunk-5KS5PWJR.js → chunk-GGGO3OH2.js} +2 -2
- package/dist/{chunk-JFLAM3MM.js → chunk-GH2JGKWP.js} +2 -2
- package/dist/{chunk-S2PL227Q.js → chunk-IE6QX3T3.js} +2 -2
- package/dist/{chunk-LEIAEWZ7.js → chunk-JIFG35UT.js} +2 -2
- package/dist/{chunk-DES2LGFZ.js → chunk-LQAKDKSF.js} +2 -2
- package/dist/{chunk-SFEQYKYJ.js → chunk-MC2SRJXO.js} +2 -2
- package/dist/{chunk-STM3ORY7.cjs → chunk-PMULUMUF.cjs} +2 -2
- package/dist/{chunk-STM3ORY7.cjs.map → chunk-PMULUMUF.cjs.map} +1 -1
- package/dist/{chunk-FSDJLAOW.js → chunk-QPJXYJIK.js} +55 -1
- package/dist/chunk-QPJXYJIK.js.map +1 -0
- package/dist/{chunk-OXLPVQYK.js → chunk-T2QHY3S5.js} +3 -3
- package/dist/{chunk-4VODJKFL.js → chunk-UCGGVNTD.js} +3 -3
- package/dist/{chunk-AUWGDP4G.js → chunk-XPYK7Z73.js} +2 -2
- package/dist/{chunk-FKUDAIJI.cjs → chunk-YJECRT5Q.cjs} +12 -12
- package/dist/{chunk-FKUDAIJI.cjs.map → chunk-YJECRT5Q.cjs.map} +1 -1
- package/dist/{chunk-WDQTFAXY.cjs → chunk-YOCFY44Z.cjs} +11 -11
- package/dist/{chunk-WDQTFAXY.cjs.map → chunk-YOCFY44Z.cjs.map} +1 -1
- package/dist/{chunk-JELRWAZC.js → chunk-YUZZNS6E.js} +2 -2
- package/dist/{chunk-CEIATRDW.cjs → chunk-Z3RFAVZ2.cjs} +3 -3
- package/dist/{chunk-CEIATRDW.cjs.map → chunk-Z3RFAVZ2.cjs.map} +1 -1
- package/dist/chunks-GBPAQ6JM.js +10 -0
- package/dist/cli.js +31 -50
- package/dist/cli.js.map +1 -1
- package/dist/{formula-EPKLPDU7.js → formula-EUX2AHXG.js} +3 -3
- package/dist/{formula-NARUOXRX.js → formula-IMEE5OJR.js} +4 -4
- package/dist/{formula-WIMV5TUX.cjs → formula-NPOU4BSO.cjs} +9 -9
- package/dist/{formula-WIMV5TUX.cjs.map → formula-NPOU4BSO.cjs.map} +1 -1
- package/dist/{image-ocr-3WJ4QH3T.js → image-ocr-CCIE3SPX.js} +7 -7
- package/dist/{image-ocr-AXWXR6JV.cjs → image-ocr-LTSQRHCN.cjs} +14 -14
- package/dist/{image-ocr-AXWXR6JV.cjs.map → image-ocr-LTSQRHCN.cjs.map} +1 -1
- package/dist/{image-ocr-5BUJQ4TK.js → image-ocr-QLW5VL4M.js} +5 -5
- package/dist/index.cjs +237 -237
- package/dist/index.js +4 -4
- package/dist/mcp.js +30 -37
- package/dist/mcp.js.map +1 -1
- package/dist/{model-bundle-IMBW7D2Z.js → model-bundle-VRKRVD6Z.js} +5 -5
- package/dist/{models-SY75IBOE.js → models-GSZIPSV2.js} +5 -5
- package/dist/{parser-N6476XAC.js → parser-64C45UPQ.js} +10 -10
- package/dist/{parser-ZQM3664Z.js → parser-NARS2CF7.js} +7 -7
- package/dist/{parser-2LU4EVU3.cjs → parser-U52HRNOY.cjs} +81 -81
- package/dist/{parser-2LU4EVU3.cjs.map → parser-U52HRNOY.cjs.map} +1 -1
- package/dist/pdf-ocr-4QWLMFJQ.js +18 -0
- package/dist/pdf-ocr-C7RXT5YU.cjs +16 -0
- package/dist/{pdf-ocr-GHEJVPX2.cjs.map → pdf-ocr-C7RXT5YU.cjs.map} +1 -1
- package/dist/pdf-ocr-ZYRJLOWQ.js +15 -0
- package/dist/{profile-io-GJPKCYPT.js → profile-io-PZBOSV5X.js} +3 -3
- package/dist/{rasterize-UOALJQDS.js → rasterize-DXBWM6T2.js} +3 -3
- package/dist/{redact-doc-22SYW3KH.js → redact-doc-FLMBZ53F.js} +10 -10
- package/dist/{render-MJ4H3R23.js → render-QNWUOQXJ.js} +6 -6
- package/dist/seal-NNZUQPDJ.js +10 -0
- package/dist/{setup-2URYVUEO.js → setup-3OR4QZFF.js} +3 -3
- package/dist/visual-RDGSACGE.js +20 -0
- package/dist/{watch-ALXZGTOB.js → watch-5A52FP6G.js} +11 -11
- package/package.json +1 -1
- package/dist/chunk-FSDJLAOW.js.map +0 -1
- package/dist/chunks-NUNIKS2J.js +0 -10
- package/dist/pdf-ocr-6DEE23IP.js +0 -15
- package/dist/pdf-ocr-GHEJVPX2.cjs +0 -16
- package/dist/pdf-ocr-MQTWODVU.js +0 -18
- package/dist/seal-XWMRUTI4.js +0 -10
- package/dist/visual-USPS4QRC.js +0 -20
- /package/dist/{-4G6MA4X6.js.map → -5XQIJN3D.js.map} +0 -0
- /package/dist/{chunk-UTP2WCHS.js.map → chunk-2EJ5YSFZ.js.map} +0 -0
- /package/dist/{chunk-IQGIT2VX.js.map → chunk-3ZVZPYSA.js.map} +0 -0
- /package/dist/{chunk-TXUKTOG2.js.map → chunk-46H2PPG7.js.map} +0 -0
- /package/dist/{chunk-7KNGSQU7.js.map → chunk-4O5XQSCT.js.map} +0 -0
- /package/dist/{chunk-MLIS253L.js.map → chunk-7NYRZI2Z.js.map} +0 -0
- /package/dist/{chunk-GO5IFOUF.js.map → chunk-7USPM2VT.js.map} +0 -0
- /package/dist/{chunk-KIOQ4N37.js.map → chunk-AL2WM6ZZ.js.map} +0 -0
- /package/dist/{chunk-F4NRLLY4.js.map → chunk-AWWFGIBA.js.map} +0 -0
- /package/dist/{chunk-QOCS7W7R.js.map → chunk-D2UGAEXY.js.map} +0 -0
- /package/dist/{chunk-P6ZDXTV6.js.map → chunk-ENF34XNH.js.map} +0 -0
- /package/dist/{chunk-5KS5PWJR.js.map → chunk-GGGO3OH2.js.map} +0 -0
- /package/dist/{chunk-JFLAM3MM.js.map → chunk-GH2JGKWP.js.map} +0 -0
- /package/dist/{chunk-S2PL227Q.js.map → chunk-IE6QX3T3.js.map} +0 -0
- /package/dist/{chunk-LEIAEWZ7.js.map → chunk-JIFG35UT.js.map} +0 -0
- /package/dist/{chunk-DES2LGFZ.js.map → chunk-LQAKDKSF.js.map} +0 -0
- /package/dist/{chunk-SFEQYKYJ.js.map → chunk-MC2SRJXO.js.map} +0 -0
- /package/dist/{chunk-OXLPVQYK.js.map → chunk-T2QHY3S5.js.map} +0 -0
- /package/dist/{chunk-4VODJKFL.js.map → chunk-UCGGVNTD.js.map} +0 -0
- /package/dist/{chunk-AUWGDP4G.js.map → chunk-XPYK7Z73.js.map} +0 -0
- /package/dist/{chunk-JELRWAZC.js.map → chunk-YUZZNS6E.js.map} +0 -0
- /package/dist/{chunks-NUNIKS2J.js.map → chunks-GBPAQ6JM.js.map} +0 -0
- /package/dist/{formula-EPKLPDU7.js.map → formula-EUX2AHXG.js.map} +0 -0
- /package/dist/{formula-NARUOXRX.js.map → formula-IMEE5OJR.js.map} +0 -0
- /package/dist/{image-ocr-3WJ4QH3T.js.map → image-ocr-CCIE3SPX.js.map} +0 -0
- /package/dist/{image-ocr-5BUJQ4TK.js.map → image-ocr-QLW5VL4M.js.map} +0 -0
- /package/dist/{model-bundle-IMBW7D2Z.js.map → model-bundle-VRKRVD6Z.js.map} +0 -0
- /package/dist/{models-SY75IBOE.js.map → models-GSZIPSV2.js.map} +0 -0
- /package/dist/{parser-N6476XAC.js.map → parser-64C45UPQ.js.map} +0 -0
- /package/dist/{parser-ZQM3664Z.js.map → parser-NARS2CF7.js.map} +0 -0
- /package/dist/{pdf-ocr-6DEE23IP.js.map → pdf-ocr-4QWLMFJQ.js.map} +0 -0
- /package/dist/{pdf-ocr-MQTWODVU.js.map → pdf-ocr-ZYRJLOWQ.js.map} +0 -0
- /package/dist/{profile-io-GJPKCYPT.js.map → profile-io-PZBOSV5X.js.map} +0 -0
- /package/dist/{rasterize-UOALJQDS.js.map → rasterize-DXBWM6T2.js.map} +0 -0
- /package/dist/{redact-doc-22SYW3KH.js.map → redact-doc-FLMBZ53F.js.map} +0 -0
- /package/dist/{render-MJ4H3R23.js.map → render-QNWUOQXJ.js.map} +0 -0
- /package/dist/{seal-XWMRUTI4.js.map → seal-NNZUQPDJ.js.map} +0 -0
- /package/dist/{setup-2URYVUEO.js.map → setup-3OR4QZFF.js.map} +0 -0
- /package/dist/{visual-USPS4QRC.js.map → visual-RDGSACGE.js.map} +0 -0
- /package/dist/{watch-ALXZGTOB.js.map → watch-5A52FP6G.js.map} +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk7WV3WETFcjs = require('./chunk-7WV3WETF.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -44,15 +44,15 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
var
|
|
47
|
+
var _chunkYOCFY44Zcjs = require('./chunk-YOCFY44Z.cjs');
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
var _chunk62W7QCEXcjs = require('./chunk-62W7QCEX.cjs');
|
|
51
|
-
require('./chunk-
|
|
51
|
+
require('./chunk-Z3RFAVZ2.cjs');
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
var
|
|
55
|
+
var _chunkPMULUMUFcjs = require('./chunk-PMULUMUF.cjs');
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -246,7 +246,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
|
|
|
246
246
|
const filename = `image_${String(state.imageIndex).padStart(3, "0")}.png`;
|
|
247
247
|
state.seen.set(hash, filename);
|
|
248
248
|
if (withBytes) {
|
|
249
|
-
const png =
|
|
249
|
+
const png = _chunk7WV3WETFcjs.encodePng.call(void 0, w, h, rgba);
|
|
250
250
|
state.totalBytes += png.length;
|
|
251
251
|
images.push({ filename, data: png, mimeType: "image/png" });
|
|
252
252
|
}
|
|
@@ -733,14 +733,14 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
733
733
|
if (r + dr < rows) owner[r + dr][dc] = placed;
|
|
734
734
|
}
|
|
735
735
|
grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
|
|
736
|
-
const lines =
|
|
737
|
-
if (lines)
|
|
738
|
-
if (
|
|
736
|
+
const lines = _chunkYOCFY44Zcjs.CELL_LINES.get(a.cell);
|
|
737
|
+
if (lines) _chunkYOCFY44Zcjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
|
|
738
|
+
if (_chunkYOCFY44Zcjs.IMAGE_CELLS.has(a.cell)) _chunkYOCFY44Zcjs.IMAGE_CELLS.add(grid[r][c1]);
|
|
739
739
|
return true;
|
|
740
740
|
};
|
|
741
|
-
for (const a of pa) if (!
|
|
741
|
+
for (const a of pa) if (!_chunkYOCFY44Zcjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
|
|
742
742
|
for (const a of ca) {
|
|
743
|
-
if (a.r < skip ||
|
|
743
|
+
if (a.r < skip || _chunkYOCFY44Zcjs.FILLER_CELLS.has(a.cell)) continue;
|
|
744
744
|
if (!place(a, ccx, prev.rows - skip, dx)) return null;
|
|
745
745
|
}
|
|
746
746
|
const first = prev.rows;
|
|
@@ -764,7 +764,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
764
764
|
const grown = { ...above, rs: newRs };
|
|
765
765
|
for (let rr = above.r; rr < above.r + newRs; rr++) for (let dc = above.c; dc < above.c + above.cs; dc++) owner[rr][dc] = grown;
|
|
766
766
|
}
|
|
767
|
-
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null)
|
|
767
|
+
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkYOCFY44Zcjs.FILLER_CELLS.add(grid[r][c]);
|
|
768
768
|
const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
|
|
769
769
|
let split = rows > prev.rows && mergeSplitRow(table, owner, prev.rows, U);
|
|
770
770
|
if (rows > prev.rows && !split && prevBottom !== void 0 && mergeStraddlingCells(table, owner, prev.rows, prevBottom, lex)) split = mergeSplitRow(table, owner, prev.rows, U, true);
|
|
@@ -807,7 +807,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex) {
|
|
|
807
807
|
if (!(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
|
|
808
808
|
if (!straddles && !midWord) continue;
|
|
809
809
|
if (u.r >= last && d.rs < 2) continue;
|
|
810
|
-
const U =
|
|
810
|
+
const U = _chunkYOCFY44Zcjs.CELL_LINES.get(a);
|
|
811
811
|
if (!_optionalChain([U, 'optionalAccess', _33 => _33.length]) || U.length > STRADDLE_MAX_LINES || !hasContent(b)) continue;
|
|
812
812
|
const lu = U[U.length - 1];
|
|
813
813
|
if (!midWord && lu.y - prevBottom > (u.r >= last ? STRADDLE_BOTTOM_ONE_ROW : STRADDLE_BOTTOM) * (lu.h || 10)) continue;
|
|
@@ -834,7 +834,7 @@ var LABEL_ROOM = 1.5;
|
|
|
834
834
|
var HANGING_MIN = 0.5;
|
|
835
835
|
var HANGING_TOL = 1;
|
|
836
836
|
function continuesAcross(u, d, x1, x2) {
|
|
837
|
-
const U =
|
|
837
|
+
const U = _chunkYOCFY44Zcjs.CELL_LINES.get(u), D = _chunkYOCFY44Zcjs.CELL_LINES.get(d);
|
|
838
838
|
if (!_optionalChain([U, 'optionalAccess', _34 => _34.length]) || !_optionalChain([D, 'optionalAccess', _35 => _35.length])) return false;
|
|
839
839
|
const last = U[U.length - 1];
|
|
840
840
|
const fs = last.h || 10;
|
|
@@ -863,7 +863,7 @@ function outlineContinues(u, d) {
|
|
|
863
863
|
return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
|
|
864
864
|
}
|
|
865
865
|
function lineEnded(c, x1, x2, next = "") {
|
|
866
|
-
const L =
|
|
866
|
+
const L = _chunkYOCFY44Zcjs.CELL_LINES.get(c);
|
|
867
867
|
if (!L || L.length !== 1) return false;
|
|
868
868
|
const l = L[0], h = l.h || 10;
|
|
869
869
|
const word = _nullishCoalesce(next.trim().split(/\s+/)[0], () => ( ""));
|
|
@@ -878,7 +878,7 @@ function appendCell(a, b) {
|
|
|
878
878
|
}
|
|
879
879
|
if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
|
|
880
880
|
}
|
|
881
|
-
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _42 => _42.blocks, 'optionalAccess', _43 => _43.length]) ||
|
|
881
|
+
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _42 => _42.blocks, 'optionalAccess', _43 => _43.length]) || _chunkYOCFY44Zcjs.IMAGE_CELLS.has(cell);
|
|
882
882
|
var CLAUSE_OPEN_ENDING = /(?:하는|되는|하고|하며|하여|되어|되고|되며|이며|으며|어야|아야|여야)$/;
|
|
883
883
|
var batchim = (ch) => {
|
|
884
884
|
const k = ch.charCodeAt(0) - 44032;
|
|
@@ -886,7 +886,7 @@ var batchim = (ch) => {
|
|
|
886
886
|
};
|
|
887
887
|
function clauseContinues(u, d) {
|
|
888
888
|
const tail = _nullishCoalesce(u.text.trim().split(/\s+/).pop(), () => ( "")), head = d.text.trim();
|
|
889
|
-
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) ||
|
|
889
|
+
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkYOCFY44Zcjs.startsNewItem.call(void 0, u.text, head)) return false;
|
|
890
890
|
const last = tail[tail.length - 1], before = tail[tail.length - 2];
|
|
891
891
|
return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
|
|
892
892
|
}
|
|
@@ -979,19 +979,19 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
979
979
|
placeJoined(blocks, i, j, joined);
|
|
980
980
|
continue;
|
|
981
981
|
}
|
|
982
|
-
if (
|
|
982
|
+
if (_chunkYOCFY44Zcjs.EMPTY_PARTS.has(curr.table)) {
|
|
983
983
|
blocks.splice(j, 1);
|
|
984
984
|
i++;
|
|
985
985
|
continue;
|
|
986
986
|
}
|
|
987
987
|
if (joined === null) continue;
|
|
988
|
-
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable ||
|
|
988
|
+
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkYOCFY44Zcjs.EMPTY_PARTS.has(prev.table)) continue;
|
|
989
989
|
const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
|
|
990
990
|
const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
|
|
991
991
|
const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
|
|
992
992
|
if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) continue;
|
|
993
|
-
const px =
|
|
994
|
-
if (px && cx && !shiftedSame(px, cx, !
|
|
993
|
+
const px = _chunkYOCFY44Zcjs.TABLE_COLXS.get(prev.table), cx = _chunkYOCFY44Zcjs.TABLE_COLXS.get(curr.table);
|
|
994
|
+
if (px && cx && !shiftedSame(px, cx, !_chunkYOCFY44Zcjs.CLIP_TABLES.has(prev.table) && !_chunkYOCFY44Zcjs.CLIP_TABLES.has(curr.table))) continue;
|
|
995
995
|
if (!rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
|
|
996
996
|
let currCells = curr.table.cells;
|
|
997
997
|
if (currCells.length > 1 && prev.table.cells.length > 0 && rowTextsEqual(prev.table.cells[0], currCells[0])) {
|
|
@@ -1009,20 +1009,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
1009
1009
|
caption: prev.table.caption,
|
|
1010
1010
|
...prev.table.renderAsTable ? { renderAsTable: true } : {}
|
|
1011
1011
|
};
|
|
1012
|
-
if (_nullishCoalesce(px, () => ( cx)))
|
|
1013
|
-
if (
|
|
1012
|
+
if (_nullishCoalesce(px, () => ( cx))) _chunkYOCFY44Zcjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
|
|
1013
|
+
if (_chunkYOCFY44Zcjs.CLIP_TABLES.has(prev.table) || _chunkYOCFY44Zcjs.CLIP_TABLES.has(curr.table)) _chunkYOCFY44Zcjs.CLIP_TABLES.add(merged);
|
|
1014
1014
|
placeJoined(blocks, i, j, merged);
|
|
1015
1015
|
}
|
|
1016
1016
|
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
1017
1017
|
const t = blocks[i].table;
|
|
1018
|
-
if (blocks[i].type === "table" && t &&
|
|
1018
|
+
if (blocks[i].type === "table" && t && _chunkYOCFY44Zcjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
|
|
1019
1019
|
}
|
|
1020
1020
|
}
|
|
1021
1021
|
function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
1022
1022
|
if (!pageHeights) return;
|
|
1023
1023
|
for (let i = 0; i < blocks.length; i++) {
|
|
1024
1024
|
const L = blocks[i];
|
|
1025
|
-
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !
|
|
1025
|
+
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkYOCFY44Zcjs.CLIP_TABLES.has(L.table) || _chunkYOCFY44Zcjs.EMPTY_PARTS.has(L.table)) continue;
|
|
1026
1026
|
const ph = pageHeights.get(L.pageNumber);
|
|
1027
1027
|
if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
|
|
1028
1028
|
let s0 = i, s1 = i;
|
|
@@ -1051,8 +1051,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
|
1051
1051
|
}
|
|
1052
1052
|
function joinClipParts(prev, curr, pageHeights, lex) {
|
|
1053
1053
|
const pt = prev.table, ct = curr.table;
|
|
1054
|
-
if (!
|
|
1055
|
-
const px =
|
|
1054
|
+
if (!_chunkYOCFY44Zcjs.CLIP_TABLES.has(pt) || !_chunkYOCFY44Zcjs.CLIP_TABLES.has(ct)) return null;
|
|
1055
|
+
const px = _chunkYOCFY44Zcjs.TABLE_COLXS.get(pt), cx = _chunkYOCFY44Zcjs.TABLE_COLXS.get(ct);
|
|
1056
1056
|
if (!px || !cx) return null;
|
|
1057
1057
|
let xs = cx, shifted = false, dx = 0, foreign = false;
|
|
1058
1058
|
if (!shiftedSame(px, cx, false)) {
|
|
@@ -1068,8 +1068,8 @@ function joinClipParts(prev, curr, pageHeights, lex) {
|
|
|
1068
1068
|
}
|
|
1069
1069
|
const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _58 => _58.bbox, 'optionalAccess', _59 => _59.y]), lex);
|
|
1070
1070
|
if (!res || (shifted || foreign) && !res.split && !res.header) return null;
|
|
1071
|
-
|
|
1072
|
-
|
|
1071
|
+
_chunkYOCFY44Zcjs.TABLE_COLXS.set(res.table, res.colXs);
|
|
1072
|
+
_chunkYOCFY44Zcjs.CLIP_TABLES.add(res.table);
|
|
1073
1073
|
return res.table;
|
|
1074
1074
|
}
|
|
1075
1075
|
function headingRow(row) {
|
|
@@ -1088,7 +1088,7 @@ function looksContinued(prev, curr, pageHeights) {
|
|
|
1088
1088
|
return filled.length >= 2 && filled.every((t) => t === filled[0]);
|
|
1089
1089
|
}
|
|
1090
1090
|
function firstRowSig(t) {
|
|
1091
|
-
const x =
|
|
1091
|
+
const x = _chunkYOCFY44Zcjs.TABLE_COLXS.get(t);
|
|
1092
1092
|
if (!x || x.length !== t.cols + 1) return null;
|
|
1093
1093
|
return anchorsOf(t).filter((a) => a.r === 0).map((a) => ({ x1: x[a.c], x2: x[a.c + a.cs], t: a.cell.text.replace(/\s+/g, "") }));
|
|
1094
1094
|
}
|
|
@@ -1141,7 +1141,7 @@ function chainHead(blocks, i, pageHeights) {
|
|
|
1141
1141
|
if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
|
|
1142
1142
|
if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb))) break;
|
|
1143
1143
|
if (!looksContinued(pb, cur, pageHeights)) break;
|
|
1144
|
-
const px =
|
|
1144
|
+
const px = _chunkYOCFY44Zcjs.TABLE_COLXS.get(pb.table), cx = _chunkYOCFY44Zcjs.TABLE_COLXS.get(cur.table);
|
|
1145
1145
|
if (!px || !cx) break;
|
|
1146
1146
|
const dx = px[px.length - 1] - cx[cx.length - 1];
|
|
1147
1147
|
if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL)) break;
|
|
@@ -1172,7 +1172,7 @@ var RESTART_LOOKBACK_PAGES = 5;
|
|
|
1172
1172
|
var COL_MATCH_TOL = 0.5;
|
|
1173
1173
|
var CONTINUED_TABLE_PAGE_BAND = 0.16;
|
|
1174
1174
|
function lastRowCell(t, x1, x2) {
|
|
1175
|
-
const xs =
|
|
1175
|
+
const xs = _chunkYOCFY44Zcjs.TABLE_COLXS.get(t);
|
|
1176
1176
|
const covered = /* @__PURE__ */ new Set();
|
|
1177
1177
|
for (let r = 0; r < t.rows; r++) {
|
|
1178
1178
|
for (let c = 0; c < t.cols; c++) {
|
|
@@ -1190,7 +1190,7 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
|
|
|
1190
1190
|
function mergeContinuedCells(blocks, pageHeights) {
|
|
1191
1191
|
for (let j = blocks.length - 1; j > 0; j--) {
|
|
1192
1192
|
const part = blocks[j];
|
|
1193
|
-
const from = part.table ?
|
|
1193
|
+
const from = part.table ? _chunkYOCFY44Zcjs.CONT_PARTS.get(part.table) : void 0;
|
|
1194
1194
|
if (!from || !part.table) continue;
|
|
1195
1195
|
let i = j - 1;
|
|
1196
1196
|
while (i >= 0 && blocks[i].type !== "table") i--;
|
|
@@ -1202,7 +1202,7 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
1202
1202
|
const at = cell.blocks || add.blocks ? cellBlocks(cell, prev.pageNumber).length : -1;
|
|
1203
1203
|
if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
|
|
1204
1204
|
cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
|
|
1205
|
-
if (cell.text.trim() || _optionalChain([cell, 'access', _79 => _79.blocks, 'optionalAccess', _80 => _80.length]))
|
|
1205
|
+
if (cell.text.trim() || _optionalChain([cell, 'access', _79 => _79.blocks, 'optionalAccess', _80 => _80.length])) _chunkYOCFY44Zcjs.EMPTY_PARTS.delete(prev.table);
|
|
1206
1206
|
blocks.splice(j, 1);
|
|
1207
1207
|
if (cell.blocks && at > 0) {
|
|
1208
1208
|
const nextAt = cell.blocks[at];
|
|
@@ -1214,11 +1214,11 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
1214
1214
|
}
|
|
1215
1215
|
function unwrapContinuedTable(blocks, at, pageHeights) {
|
|
1216
1216
|
const prev = blocks[at - 1], frame = blocks[at];
|
|
1217
|
-
if (!_optionalChain([prev, 'optionalAccess', _81 => _81.table]) || !_optionalChain([frame, 'optionalAccess', _82 => _82.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !
|
|
1217
|
+
if (!_optionalChain([prev, 'optionalAccess', _81 => _81.table]) || !_optionalChain([frame, 'optionalAccess', _82 => _82.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkYOCFY44Zcjs.CLIP_TABLES.has(frame.table)) return;
|
|
1218
1218
|
const inner = _optionalChain([frame, 'access', _83 => _83.table, 'access', _84 => _84.cells, 'access', _85 => _85[0], 'optionalAccess', _86 => _86[0], 'optionalAccess', _87 => _87.blocks]);
|
|
1219
1219
|
const next = _optionalChain([inner, 'optionalAccess', _88 => _88[0]]);
|
|
1220
|
-
if (!inner || !_optionalChain([next, 'optionalAccess', _89 => _89.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !
|
|
1221
|
-
const px =
|
|
1220
|
+
if (!inner || !_optionalChain([next, 'optionalAccess', _89 => _89.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkYOCFY44Zcjs.CLIP_TABLES.has(prev.table) || !_chunkYOCFY44Zcjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
|
|
1221
|
+
const px = _chunkYOCFY44Zcjs.TABLE_COLXS.get(prev.table), nx = _chunkYOCFY44Zcjs.TABLE_COLXS.get(next.table);
|
|
1222
1222
|
if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
|
|
1223
1223
|
const ph = _optionalChain([pageHeights, 'optionalAccess', _90 => _90.get, 'call', _91 => _91(prev.pageNumber)]), nh = _optionalChain([pageHeights, 'optionalAccess', _92 => _92.get, 'call', _93 => _93(next.pageNumber)]);
|
|
1224
1224
|
if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
|
|
@@ -1227,8 +1227,8 @@ function unwrapContinuedTable(blocks, at, pageHeights) {
|
|
|
1227
1227
|
function fillNestedContinuation(blocks, at) {
|
|
1228
1228
|
const prev = blocks[at - 1], next = blocks[at];
|
|
1229
1229
|
const t = _optionalChain([prev, 'optionalAccess', _94 => _94.table]), u = _optionalChain([next, 'optionalAccess', _95 => _95.table]);
|
|
1230
|
-
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !
|
|
1231
|
-
const xs =
|
|
1230
|
+
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkYOCFY44Zcjs.CLIP_TABLES.has(t) || !_chunkYOCFY44Zcjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
|
|
1231
|
+
const xs = _chunkYOCFY44Zcjs.TABLE_COLXS.get(u);
|
|
1232
1232
|
const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
|
|
1233
1233
|
const add = _optionalChain([u, 'access', _96 => _96.cells, 'access', _97 => _97[0], 'optionalAccess', _98 => _98[0]]);
|
|
1234
1234
|
if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _99 => _99.blocks, 'optionalAccess', _100 => _100.length])) return;
|
|
@@ -1269,7 +1269,7 @@ var WINANSI_REVERSE = {
|
|
|
1269
1269
|
};
|
|
1270
1270
|
function symbolFontTable(fontName) {
|
|
1271
1271
|
if (!fontName) return void 0;
|
|
1272
|
-
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return
|
|
1272
|
+
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunk7WV3WETFcjs.WINGDINGS;
|
|
1273
1273
|
return void 0;
|
|
1274
1274
|
}
|
|
1275
1275
|
function remapSymbolText(text, table) {
|
|
@@ -2289,7 +2289,7 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
|
|
|
2289
2289
|
if (block.type !== "heading" || !block.text) continue;
|
|
2290
2290
|
const text = block.text.replace(/<[^>]+>/g, "").trim();
|
|
2291
2291
|
const fsz = _nullishCoalesce(_optionalChain([block, 'access', _133 => _133.style, 'optionalAccess', _134 => _134.fontSize]), () => ( 0));
|
|
2292
|
-
const tocEntry = i > 0 &&
|
|
2292
|
+
const tocEntry = i > 0 && _chunkYOCFY44Zcjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkYOCFY44Zcjs.TOC_BLOCKS.has(blocks[i + 1]);
|
|
2293
2293
|
const page = _nullishCoalesce(byPage.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( []));
|
|
2294
2294
|
const proseStyle = _optionalChain([block, 'access', _135 => _135.style, 'optionalAccess', _136 => _136.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
|
|
2295
2295
|
const next = blocks[i + 1];
|
|
@@ -2398,7 +2398,7 @@ function joinLatinCellWraps(blocks) {
|
|
|
2398
2398
|
const lines = cell.text.split("\n");
|
|
2399
2399
|
const out = [lines[0]];
|
|
2400
2400
|
for (const line of lines.slice(1)) {
|
|
2401
|
-
if (
|
|
2401
|
+
if (_chunkYOCFY44Zcjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
|
|
2402
2402
|
else out.push(line);
|
|
2403
2403
|
}
|
|
2404
2404
|
cell.text = out.join("\n");
|
|
@@ -2418,10 +2418,10 @@ function cleanPdfText(text, opts) {
|
|
|
2418
2418
|
).replace(/^(?!\| ---).*$/gm, (line) => {
|
|
2419
2419
|
if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
|
|
2420
2420
|
if (line.startsWith("|")) {
|
|
2421
|
-
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) =>
|
|
2421
|
+
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkYOCFY44Zcjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
|
|
2422
2422
|
}
|
|
2423
2423
|
const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _208 => _208.exec, 'call', _209 => _209(line), 'optionalAccess', _210 => _210[0]]), () => ( ""));
|
|
2424
|
-
return mark +
|
|
2424
|
+
return mark + _chunkYOCFY44Zcjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
|
|
2425
2425
|
}).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/<(sup|sub)>\s*<\/\1>/g, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
2426
2426
|
}
|
|
2427
2427
|
function startsWithMarker(line) {
|
|
@@ -2453,7 +2453,7 @@ function mergeKoreanLines(text) {
|
|
|
2453
2453
|
continue;
|
|
2454
2454
|
}
|
|
2455
2455
|
if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
|
|
2456
|
-
result[result.length - 1] = prev +
|
|
2456
|
+
result[result.length - 1] = prev + _chunkYOCFY44Zcjs.wrapJoiner.call(void 0, prev, curr) + curr;
|
|
2457
2457
|
} else {
|
|
2458
2458
|
result.push(curr);
|
|
2459
2459
|
}
|
|
@@ -2469,7 +2469,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
2469
2469
|
const wrapped = /* @__PURE__ */ new Set();
|
|
2470
2470
|
for (const a of annots) {
|
|
2471
2471
|
if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
|
|
2472
|
-
const url =
|
|
2472
|
+
const url = _chunkPMULUMUFcjs.sanitizeHref.call(void 0, a.url);
|
|
2473
2473
|
if (!url) continue;
|
|
2474
2474
|
const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
|
|
2475
2475
|
const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
|
|
@@ -2510,7 +2510,7 @@ function mergeLinkRuns(markdown) {
|
|
|
2510
2510
|
|
|
2511
2511
|
// src/pdf/formula-ocr.ts
|
|
2512
2512
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
2513
|
-
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-
|
|
2513
|
+
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-NPOU4BSO.cjs")));
|
|
2514
2514
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
2515
2515
|
await ensureFormulaModels((p) => {
|
|
2516
2516
|
if (p.phase === "download" && p.total) {
|
|
@@ -2689,13 +2689,13 @@ async function loadPdfWithTimeout(buffer) {
|
|
|
2689
2689
|
try {
|
|
2690
2690
|
return await Promise.race([
|
|
2691
2691
|
loadingTask.promise.catch((e) => {
|
|
2692
|
-
if (e instanceof Error && e.name === "PasswordException") throw new (0,
|
|
2692
|
+
if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkPMULUMUFcjs.KordocError)("\uC554\uD638\uB85C \uBCF4\uD638\uB41C PDF \uD30C\uC77C\uC785\uB2C8\uB2E4 (PDF \uC5F4\uAE30 \uC554\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4)");
|
|
2693
2693
|
throw e;
|
|
2694
2694
|
}),
|
|
2695
2695
|
new Promise((_, reject) => {
|
|
2696
2696
|
timer = setTimeout(() => {
|
|
2697
2697
|
loadingTask.destroy();
|
|
2698
|
-
reject(new (0,
|
|
2698
|
+
reject(new (0, _chunkPMULUMUFcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
|
|
2699
2699
|
}, PDF_LOAD_TIMEOUT_MS);
|
|
2700
2700
|
})
|
|
2701
2701
|
]);
|
|
@@ -2705,12 +2705,12 @@ async function loadPdfWithTimeout(buffer) {
|
|
|
2705
2705
|
}
|
|
2706
2706
|
async function parsePdfDocument(buffer, options) {
|
|
2707
2707
|
const formulaBuffer = _optionalChain([options, 'optionalAccess', _211 => _211.formulaOcr]) ? buffer : null;
|
|
2708
|
-
const autoOcr = _optionalChain([options, 'optionalAccess', _212 => _212.ocr]) === void 0 && await
|
|
2708
|
+
const autoOcr = _optionalChain([options, 'optionalAccess', _212 => _212.ocr]) === void 0 && await _chunkYOCFY44Zcjs.ocrModelsCached.call(void 0, );
|
|
2709
2709
|
const ocrBuffer = _optionalChain([options, 'optionalAccess', _213 => _213.ocr]) || autoOcr ? buffer : null;
|
|
2710
2710
|
const doc = await loadPdfWithTimeout(buffer);
|
|
2711
2711
|
try {
|
|
2712
2712
|
const pageCount = doc.numPages;
|
|
2713
|
-
if (pageCount === 0) throw new (0,
|
|
2713
|
+
if (pageCount === 0) throw new (0, _chunkPMULUMUFcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
2714
2714
|
const metadata = { pageCount, pageMode: "layout" };
|
|
2715
2715
|
await extractPdfMetadata(doc, metadata);
|
|
2716
2716
|
const blocks = [];
|
|
@@ -2737,7 +2737,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
2737
2737
|
const pageImageBlocks = /* @__PURE__ */ new Map();
|
|
2738
2738
|
const carry = {};
|
|
2739
2739
|
const vectorPageOps = /* @__PURE__ */ new Map();
|
|
2740
|
-
const wrapLexicon = new (0,
|
|
2740
|
+
const wrapLexicon = new (0, _chunkYOCFY44Zcjs.WrapLexicon)();
|
|
2741
2741
|
const noteMarks = /* @__PURE__ */ new Map();
|
|
2742
2742
|
let parsedPages = 0;
|
|
2743
2743
|
for (let i = 1; i <= effectivePageCount; i++) {
|
|
@@ -2765,8 +2765,8 @@ async function parsePdfDocument(buffer, options) {
|
|
|
2765
2765
|
restoreTrackedSpacing(rawItems, rawOps.fnArray, rawOps.argsArray);
|
|
2766
2766
|
markSyntheticSpaces(rawItems, rawOps.fnArray, rawOps.argsArray);
|
|
2767
2767
|
const occluded = occludedTextItems(rawItems, rawOps.fnArray, rawOps.argsArray);
|
|
2768
|
-
const items =
|
|
2769
|
-
const filtered =
|
|
2768
|
+
const items = _chunkYOCFY44Zcjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
|
|
2769
|
+
const filtered = _chunkYOCFY44Zcjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
|
|
2770
2770
|
const joined = joinVerticalColumns(filtered.visible);
|
|
2771
2771
|
const visible = dropTabLeaderDots(joined);
|
|
2772
2772
|
const hiddenCount = filtered.hiddenCount + occluded.size;
|
|
@@ -2804,11 +2804,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
2804
2804
|
it.fontName = face;
|
|
2805
2805
|
if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _223 => _223(face), 'optionalAccess', _224 => _224.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
|
|
2806
2806
|
}
|
|
2807
|
-
for (const it of visible) if (it.text.includes("$")) it.text =
|
|
2807
|
+
for (const it of visible) if (it.text.includes("$")) it.text = _chunk7WV3WETFcjs.escapeLiteralDollar.call(void 0, it.text);
|
|
2808
2808
|
wrapEquationRuns(visible, (face) => faceNames.get(face));
|
|
2809
2809
|
const pageArea = pageW * pageH;
|
|
2810
2810
|
if (pageArea > 0) {
|
|
2811
|
-
const imageRegions =
|
|
2811
|
+
const imageRegions = _chunkYOCFY44Zcjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
|
|
2812
2812
|
let uncovered = 0;
|
|
2813
2813
|
for (const r of imageRegions) {
|
|
2814
2814
|
const area = (r.x2 - r.x1) * (r.y2 - r.y1);
|
|
@@ -2834,10 +2834,10 @@ async function parsePdfDocument(buffer, options) {
|
|
|
2834
2834
|
if (uncovered > 0) skippedImagePages.set(i, uncovered);
|
|
2835
2835
|
}
|
|
2836
2836
|
const marks = superscriptNoteMarks(visible);
|
|
2837
|
-
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(
|
|
2837
|
+
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkYOCFY44Zcjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
|
|
2838
2838
|
const stamp = marginStamp(visible);
|
|
2839
2839
|
const flow = stamp.length ? visible.filter((it) => !stamp.includes(it)) : visible;
|
|
2840
|
-
const pageBlocks = orderTwoUpPage(
|
|
2840
|
+
const pageBlocks = orderTwoUpPage(_chunkYOCFY44Zcjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _225 => _225.tables]) !== false, carry, wrapLexicon), pageW, pageH);
|
|
2841
2841
|
if (stamp.length) pageBlocks.unshift({ type: "paragraph", text: [...stamp].sort((a, b) => a.y - b.y).map((it) => it.text).join(" "), pageNumber: i });
|
|
2842
2842
|
for (const b of pageBlocks) blocks.push(b);
|
|
2843
2843
|
try {
|
|
@@ -2863,11 +2863,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
2863
2863
|
if (_optionalChain([options, 'optionalAccess', _227 => _227.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
|
|
2864
2864
|
vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
|
|
2865
2865
|
}
|
|
2866
|
-
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0,
|
|
2866
|
+
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkPMULUMUFcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
|
|
2867
2867
|
parsedPages++;
|
|
2868
2868
|
_optionalChain([options, 'optionalAccess', _228 => _228.onProgress, 'optionalCall', _229 => _229(parsedPages, totalTarget)]);
|
|
2869
2869
|
} catch (pageErr) {
|
|
2870
|
-
if (pageErr instanceof
|
|
2870
|
+
if (pageErr instanceof _chunkPMULUMUFcjs.KordocError) throw pageErr;
|
|
2871
2871
|
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" });
|
|
2872
2872
|
} finally {
|
|
2873
2873
|
_optionalChain([loadedPage, 'optionalAccess', _230 => _230.cleanup, 'call', _231 => _231()]);
|
|
@@ -2893,7 +2893,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
2893
2893
|
}
|
|
2894
2894
|
if (targets.size > 0) {
|
|
2895
2895
|
try {
|
|
2896
|
-
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
2896
|
+
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-C7RXT5YU.cjs")));
|
|
2897
2897
|
const mode = typeof _optionalChain([options, 'optionalAccess', _236 => _236.ocr]) === "function" ? options.ocr : "builtin";
|
|
2898
2898
|
const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _237 => _237.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _238 => _238.find, 'call', _239 => _239((q) => q.page === p), 'optionalAccess', _240 => _240.needsOcr])));
|
|
2899
2899
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _241 => _241.onProgress]), _optionalChain([options, 'optionalAccess', _242 => _242.tables]) !== false, vectorPageOps, regionPages);
|
|
@@ -2961,7 +2961,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
2961
2961
|
}
|
|
2962
2962
|
}
|
|
2963
2963
|
if (_optionalChain([options, 'optionalAccess', _250 => _250.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
|
|
2964
|
-
const removed =
|
|
2964
|
+
const removed = _chunkYOCFY44Zcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks);
|
|
2965
2965
|
for (let ri = removed.length - 1; ri >= 0; ri--) {
|
|
2966
2966
|
blocks.splice(removed[ri], 1);
|
|
2967
2967
|
}
|
|
@@ -2974,12 +2974,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
2974
2974
|
mergeContinuedCells(blocks, pageHeights);
|
|
2975
2975
|
mergeCrossPageTables(blocks, pageHeights, wrapLexicon);
|
|
2976
2976
|
if (_optionalChain([options, 'optionalAccess', _251 => _251.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
|
|
2977
|
-
const boxes =
|
|
2977
|
+
const boxes = _chunkYOCFY44Zcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
|
|
2978
2978
|
for (let ri = boxes.length - 1; ri >= 0; ri--) blocks.splice(boxes[ri], 1);
|
|
2979
2979
|
}
|
|
2980
2980
|
splitContactTables(blocks);
|
|
2981
|
-
if (!_optionalChain([options, 'optionalAccess', _252 => _252.keepTrailingEmptyCols]))
|
|
2982
|
-
|
|
2981
|
+
if (!_optionalChain([options, 'optionalAccess', _252 => _252.keepTrailingEmptyCols])) _chunkYOCFY44Zcjs.trimTrailingEmptyTableCols.call(void 0, blocks);
|
|
2982
|
+
_chunkYOCFY44Zcjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
|
|
2983
2983
|
injectPageImageBlocks(blocks, pageImageBlocks);
|
|
2984
2984
|
if (_optionalChain([options, 'optionalAccess', _253 => _253.formulaOcr]) && formulaBuffer) {
|
|
2985
2985
|
try {
|
|
@@ -2991,21 +2991,21 @@ async function parsePdfDocument(buffer, options) {
|
|
|
2991
2991
|
});
|
|
2992
2992
|
}
|
|
2993
2993
|
}
|
|
2994
|
-
const medianFontSize =
|
|
2994
|
+
const medianFontSize = _chunkYOCFY44Zcjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
|
|
2995
2995
|
if (medianFontSize > 0) {
|
|
2996
|
-
|
|
2997
|
-
}
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
2996
|
+
_chunkYOCFY44Zcjs.detectHeadings.call(void 0, blocks, medianFontSize);
|
|
2997
|
+
}
|
|
2998
|
+
_chunkYOCFY44Zcjs.detectDocumentStyleHeadings.call(void 0, blocks);
|
|
2999
|
+
_chunkYOCFY44Zcjs.detectTypographyHeadings.call(void 0, blocks);
|
|
3000
|
+
_chunkYOCFY44Zcjs.detectSiblingStyleHeadings.call(void 0, blocks);
|
|
3001
|
+
_chunkYOCFY44Zcjs.detectRepeatedPageLabels.call(void 0, blocks);
|
|
3002
|
+
_chunkYOCFY44Zcjs.detectPageLeadHeadings.call(void 0, blocks);
|
|
3003
|
+
_chunkYOCFY44Zcjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
|
|
3004
|
+
_chunkYOCFY44Zcjs.refineDocumentStyleHeadings.call(void 0, blocks);
|
|
3005
|
+
_chunkYOCFY44Zcjs.detectMarkerHeadings.call(void 0, blocks);
|
|
3006
3006
|
demoteNonHeadingRoles(blocks, pageHeights, faceNames);
|
|
3007
|
-
|
|
3008
|
-
|
|
3007
|
+
_chunkYOCFY44Zcjs.detectTableCaptions.call(void 0, blocks);
|
|
3008
|
+
_chunkYOCFY44Zcjs.detectKoreanListBlocks.call(void 0, blocks);
|
|
3009
3009
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3010
3010
|
sanitizeBlockControlChars(blocks);
|
|
3011
3011
|
let outBlocks = splitSingleCellTables(blocks);
|
|
@@ -3018,11 +3018,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3018
3018
|
return b.bbox.y > h * 0.1 && b.bbox.y + b.bbox.height < h * 0.9;
|
|
3019
3019
|
});
|
|
3020
3020
|
joinLatinCellWraps(outBlocks);
|
|
3021
|
-
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(
|
|
3021
|
+
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, bs), { keepLoneNumbers: true }));
|
|
3022
3022
|
let markdown = finishMarkdown(outBlocks);
|
|
3023
3023
|
return {
|
|
3024
3024
|
markdown,
|
|
3025
|
-
pages:
|
|
3025
|
+
pages: _chunk7WV3WETFcjs.blocksToPages.call(void 0, outBlocks, finishMarkdown),
|
|
3026
3026
|
blocks,
|
|
3027
3027
|
metadata,
|
|
3028
3028
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -3092,5 +3092,5 @@ function marginStamp(items) {
|
|
|
3092
3092
|
|
|
3093
3093
|
|
|
3094
3094
|
|
|
3095
|
-
exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks =
|
|
3096
|
-
//# sourceMappingURL=parser-
|
|
3095
|
+
exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkYOCFY44Zcjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkYOCFY44Zcjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkYOCFY44Zcjs.removeHeaderFooterBlocks;
|
|
3096
|
+
//# sourceMappingURL=parser-U52HRNOY.cjs.map
|