kordoc 4.24.49 → 4.24.50
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 -3
- package/dist/{-22V6D2US.js → -C2A4JYBB.js} +42 -42
- package/dist/{chunk-R2RLNUNK.js → chunk-3HX37NQI.js} +6 -6
- package/dist/{chunk-IRAZCKQ6.cjs → chunk-4H2CKUZC.cjs} +3 -3
- package/dist/{chunk-IRAZCKQ6.cjs.map → chunk-4H2CKUZC.cjs.map} +1 -1
- package/dist/{chunk-EUJX7HTR.js → chunk-5HFHRDXF.js} +9 -9
- package/dist/{chunk-EUJX7HTR.js.map → chunk-5HFHRDXF.js.map} +1 -1
- package/dist/{chunk-Y4MFHEK4.cjs → chunk-5R65VE7S.cjs} +3 -3
- package/dist/{chunk-Y4MFHEK4.cjs.map → chunk-5R65VE7S.cjs.map} +1 -1
- package/dist/{chunk-UU54HN5I.js → chunk-6X5OZ32D.js} +5 -5
- package/dist/{chunk-7KKL3PRK.js → chunk-7TFSVTEI.js} +12 -4
- package/dist/chunk-7TFSVTEI.js.map +1 -0
- package/dist/{chunk-S54DZB2Z.js → chunk-CFN65SO4.js} +47 -4
- package/dist/chunk-CFN65SO4.js.map +1 -0
- package/dist/{chunk-OAETOHH3.js → chunk-CV7R6GFL.js} +3 -3
- package/dist/{chunk-M5RQ2PNP.js → chunk-DWLDRIUW.js} +14 -6
- package/dist/chunk-DWLDRIUW.js.map +1 -0
- package/dist/{chunk-67GSFYG7.js → chunk-EEXZI6FB.js} +2 -2
- package/dist/{chunk-367WLMPO.cjs → chunk-FMY77Z2C.cjs} +65 -57
- package/dist/chunk-FMY77Z2C.cjs.map +1 -0
- package/dist/{chunk-DAAJO62F.js → chunk-FTUYGBVA.js} +2 -2
- package/dist/{chunk-HW7WVYBF.js → chunk-G3COIDD5.js} +2 -2
- package/dist/{chunk-LOSCIAHY.js → chunk-H5WXX55M.js} +2 -2
- package/dist/{chunk-HETGOJ6V.js → chunk-JLXFH46H.js} +2 -2
- package/dist/{chunk-RQLEGKEV.js → chunk-KKVUDW3R.js} +2 -2
- package/dist/{chunk-AUAJVQQK.js → chunk-LJP2C7HY.js} +2 -2
- package/dist/{chunk-CCQMSIZQ.js → chunk-MFHYWNRB.js} +19 -19
- package/dist/{chunk-4MWUBTAE.js → chunk-MGASIGAK.js} +2 -2
- package/dist/{chunk-TQOAPKLU.cjs → chunk-NTTH2JV3.cjs} +6 -6
- package/dist/{chunk-TQOAPKLU.cjs.map → chunk-NTTH2JV3.cjs.map} +1 -1
- package/dist/{chunk-TAHS42ED.js → chunk-O3LGWNKF.js} +10 -10
- package/dist/{chunk-TAHS42ED.js.map → chunk-O3LGWNKF.js.map} +1 -1
- package/dist/{chunk-EYSXMDA7.js → chunk-PSUE7IEJ.js} +17 -17
- package/dist/{chunk-WLFZOBZR.js → chunk-R2KOKVE6.js} +3 -3
- package/dist/{chunk-UBY2PLKR.cjs → chunk-R34M3KZ5.cjs} +31 -31
- package/dist/{chunk-UBY2PLKR.cjs.map → chunk-R34M3KZ5.cjs.map} +1 -1
- package/dist/{chunk-ZF24SO45.js → chunk-RFMTK6QQ.js} +2 -2
- package/dist/{chunk-LCRSRVFJ.js → chunk-SAJPPKP6.js} +2 -2
- package/dist/{chunk-PVV6OY4M.cjs → chunk-SBNHRZX5.cjs} +139 -96
- package/dist/chunk-SBNHRZX5.cjs.map +1 -0
- package/dist/{chunk-L3JP55ZY.js → chunk-SFNUS2L2.js} +2 -2
- package/dist/{chunk-4HJKBRZJ.js → chunk-SHPWOK54.js} +18 -18
- package/dist/{chunk-PMGJQWSW.js → chunk-SSITTA7K.js} +2 -2
- package/dist/{chunk-Q7FDPJUS.js → chunk-TAVJD44R.js} +10 -10
- package/dist/{chunk-VMOUAWGD.js → chunk-TBVTRCQO.js} +7 -7
- package/dist/{chunk-KXHUHGMC.js → chunk-UGVLPUEO.js} +2 -2
- package/dist/{chunk-AXW2FMVR.js → chunk-UHNUEHHP.js} +2 -2
- package/dist/{chunk-2UWWWM4Q.cjs → chunk-ULZEBO6D.cjs} +98 -98
- package/dist/{chunk-2UWWWM4Q.cjs.map → chunk-ULZEBO6D.cjs.map} +1 -1
- package/dist/{chunk-6BFWLS7E.js → chunk-WI5QVMJ2.js} +3 -3
- package/dist/{chunk-Y6QW3FJQ.js → chunk-WJZJYJCP.js} +2 -2
- package/dist/{chunk-MLBX6KQM.js → chunk-XKGH2UJU.js} +2 -2
- package/dist/{chunk-PW7MQZI4.cjs → chunk-XOL2UOIW.cjs} +2 -2
- package/dist/{chunk-PW7MQZI4.cjs.map → chunk-XOL2UOIW.cjs.map} +1 -1
- package/dist/{chunk-KB4ORA7M.js → chunk-YJJGETLN.js} +2 -2
- package/dist/{chunk-DA5AXURC.js → chunk-YV27LZOV.js} +48 -5
- package/dist/chunk-YV27LZOV.js.map +1 -0
- package/dist/{chunk-LFFARZYZ.js → chunk-YXG74TXU.js} +2 -2
- package/dist/{chunk-MIJTZKWF.js → chunk-ZYMXAFG6.js} +2 -2
- package/dist/chunks-2XOX7XKP.js +11 -0
- package/dist/cli.js +52 -51
- package/dist/cli.js.map +1 -1
- package/dist/{formula-BYEDWWZU.js → formula-CSMUW37Z.js} +4 -4
- package/dist/{formula-QJEOIVKR.cjs → formula-MQDZV5BS.cjs} +9 -9
- package/dist/{formula-QJEOIVKR.cjs.map → formula-MQDZV5BS.cjs.map} +1 -1
- package/dist/{formula-FQLMMBDP.js → formula-NEZQU4VT.js} +3 -3
- package/dist/generator-J2I6FY5A.js +17 -0
- package/dist/generator-U6KPAHRC.cjs +11 -0
- package/dist/{generator-FTM6GOGB.cjs.map → generator-U6KPAHRC.cjs.map} +1 -1
- package/dist/generator-V7WALYIG.js +10 -0
- package/dist/hancom-44AG42NH.js +85 -0
- package/dist/hancom-44AG42NH.js.map +1 -0
- package/dist/hancom-ICXEFG55.js +84 -0
- package/dist/hancom-ICXEFG55.js.map +1 -0
- package/dist/hancom-R7UQ45EN.cjs +85 -0
- package/dist/hancom-R7UQ45EN.cjs.map +1 -0
- package/dist/{image-ocr-VIGZE4YL.js → image-ocr-EDD2FWK3.js} +7 -7
- package/dist/{image-ocr-7Y3FCGRR.js → image-ocr-KGEUPOG5.js} +10 -10
- package/dist/{image-ocr-WRILL3WO.cjs → image-ocr-VVLMGTRH.cjs} +28 -28
- package/dist/{image-ocr-WRILL3WO.cjs.map → image-ocr-VVLMGTRH.cjs.map} +1 -1
- package/dist/index.cjs +1116 -1116
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +72 -72
- package/dist/mcp.js +42 -41
- package/dist/mcp.js.map +1 -1
- package/dist/memo-HW332L2B.js +17 -0
- package/dist/{model-bundle-UJRQPYUU.js → model-bundle-JQBHF6XK.js} +5 -5
- package/dist/{models-64YLAWTI.js → models-YWD5GLFW.js} +5 -5
- package/dist/{parse-worker-v2-QWQZKFQO.js → parse-worker-v2-NXKUXGGX.js} +23 -23
- package/dist/{parser-XFU3VRWM.js → parser-5E4Z3ME5.js} +16 -16
- package/dist/{parser-JPWANPLM.js → parser-FPBBI4AE.js} +12 -12
- package/dist/{parser-RB6CBNAM.cjs → parser-W4MNQL73.cjs} +166 -166
- package/dist/{parser-RB6CBNAM.cjs.map → parser-W4MNQL73.cjs.map} +1 -1
- package/dist/{pdf-ocr-ZV3KYIIE.js → pdf-ocr-GHVGOTJG.js} +9 -9
- package/dist/pdf-ocr-SPAU33VI.cjs +42 -0
- package/dist/{pdf-ocr-NOJHEH4M.cjs.map → pdf-ocr-SPAU33VI.cjs.map} +1 -1
- package/dist/{pdf-ocr-XTZZEYKJ.js → pdf-ocr-ZXEEUV72.js} +6 -6
- package/dist/{profile-io-FAJORRD2.js → profile-io-RF7AHAZE.js} +3 -3
- package/dist/{rasterize-4ZJUA2DZ.js → rasterize-GJH24CGX.js} +3 -3
- package/dist/{redact-doc-JPNROEH6.js → redact-doc-W4DR6BTT.js} +29 -29
- package/dist/{render-D4WBOBKI.js → render-OLEQELZH.js} +12 -12
- package/dist/{rewrite-fallback-OF3QI6CX.js → rewrite-fallback-4MVCADX7.js} +13 -13
- package/dist/seal-JJLC6UDD.js +16 -0
- package/dist/{setup-YC25YCQB.js → setup-BMJI6RBB.js} +3 -3
- package/dist/to-hwpx-2Y5V456C.cjs +16 -0
- package/dist/{to-hwpx-LUA6F5RR.cjs.map → to-hwpx-2Y5V456C.cjs.map} +1 -1
- package/dist/{to-hwpx-ZWN64NCQ.js → to-hwpx-XHJFVCD4.js} +4 -4
- package/dist/{to-hwpx-D7OMPDUQ.js → to-hwpx-Z5WGF6YZ.js} +7 -7
- package/dist/visual-QGD23ZDN.js +37 -0
- package/dist/{watch-ZU576VSR.js → watch-F5TGSLKR.js} +23 -23
- package/package.json +1 -1
- package/dist/chunk-367WLMPO.cjs.map +0 -1
- package/dist/chunk-7KKL3PRK.js.map +0 -1
- package/dist/chunk-DA5AXURC.js.map +0 -1
- package/dist/chunk-M5RQ2PNP.js.map +0 -1
- package/dist/chunk-PVV6OY4M.cjs.map +0 -1
- package/dist/chunk-S54DZB2Z.js.map +0 -1
- package/dist/chunks-Q7242OJE.js +0 -11
- package/dist/generator-FTM6GOGB.cjs +0 -11
- package/dist/generator-Q3L7RNUY.js +0 -17
- package/dist/generator-SU73HZHR.js +0 -10
- package/dist/memo-T5ZQEXEA.js +0 -17
- package/dist/pdf-ocr-NOJHEH4M.cjs +0 -42
- package/dist/seal-DQWEHIAM.js +0 -16
- package/dist/to-hwpx-LUA6F5RR.cjs +0 -16
- package/dist/visual-SW7NPY6K.js +0 -37
- /package/dist/{-22V6D2US.js.map → -C2A4JYBB.js.map} +0 -0
- /package/dist/{chunk-R2RLNUNK.js.map → chunk-3HX37NQI.js.map} +0 -0
- /package/dist/{chunk-UU54HN5I.js.map → chunk-6X5OZ32D.js.map} +0 -0
- /package/dist/{chunk-OAETOHH3.js.map → chunk-CV7R6GFL.js.map} +0 -0
- /package/dist/{chunk-67GSFYG7.js.map → chunk-EEXZI6FB.js.map} +0 -0
- /package/dist/{chunk-DAAJO62F.js.map → chunk-FTUYGBVA.js.map} +0 -0
- /package/dist/{chunk-HW7WVYBF.js.map → chunk-G3COIDD5.js.map} +0 -0
- /package/dist/{chunk-LOSCIAHY.js.map → chunk-H5WXX55M.js.map} +0 -0
- /package/dist/{chunk-HETGOJ6V.js.map → chunk-JLXFH46H.js.map} +0 -0
- /package/dist/{chunk-RQLEGKEV.js.map → chunk-KKVUDW3R.js.map} +0 -0
- /package/dist/{chunk-AUAJVQQK.js.map → chunk-LJP2C7HY.js.map} +0 -0
- /package/dist/{chunk-CCQMSIZQ.js.map → chunk-MFHYWNRB.js.map} +0 -0
- /package/dist/{chunk-4MWUBTAE.js.map → chunk-MGASIGAK.js.map} +0 -0
- /package/dist/{chunk-EYSXMDA7.js.map → chunk-PSUE7IEJ.js.map} +0 -0
- /package/dist/{chunk-WLFZOBZR.js.map → chunk-R2KOKVE6.js.map} +0 -0
- /package/dist/{chunk-ZF24SO45.js.map → chunk-RFMTK6QQ.js.map} +0 -0
- /package/dist/{chunk-LCRSRVFJ.js.map → chunk-SAJPPKP6.js.map} +0 -0
- /package/dist/{chunk-L3JP55ZY.js.map → chunk-SFNUS2L2.js.map} +0 -0
- /package/dist/{chunk-4HJKBRZJ.js.map → chunk-SHPWOK54.js.map} +0 -0
- /package/dist/{chunk-PMGJQWSW.js.map → chunk-SSITTA7K.js.map} +0 -0
- /package/dist/{chunk-Q7FDPJUS.js.map → chunk-TAVJD44R.js.map} +0 -0
- /package/dist/{chunk-VMOUAWGD.js.map → chunk-TBVTRCQO.js.map} +0 -0
- /package/dist/{chunk-KXHUHGMC.js.map → chunk-UGVLPUEO.js.map} +0 -0
- /package/dist/{chunk-AXW2FMVR.js.map → chunk-UHNUEHHP.js.map} +0 -0
- /package/dist/{chunk-6BFWLS7E.js.map → chunk-WI5QVMJ2.js.map} +0 -0
- /package/dist/{chunk-Y6QW3FJQ.js.map → chunk-WJZJYJCP.js.map} +0 -0
- /package/dist/{chunk-MLBX6KQM.js.map → chunk-XKGH2UJU.js.map} +0 -0
- /package/dist/{chunk-KB4ORA7M.js.map → chunk-YJJGETLN.js.map} +0 -0
- /package/dist/{chunk-LFFARZYZ.js.map → chunk-YXG74TXU.js.map} +0 -0
- /package/dist/{chunk-MIJTZKWF.js.map → chunk-ZYMXAFG6.js.map} +0 -0
- /package/dist/{chunks-Q7242OJE.js.map → chunks-2XOX7XKP.js.map} +0 -0
- /package/dist/{formula-BYEDWWZU.js.map → formula-CSMUW37Z.js.map} +0 -0
- /package/dist/{formula-FQLMMBDP.js.map → formula-NEZQU4VT.js.map} +0 -0
- /package/dist/{generator-Q3L7RNUY.js.map → generator-J2I6FY5A.js.map} +0 -0
- /package/dist/{generator-SU73HZHR.js.map → generator-V7WALYIG.js.map} +0 -0
- /package/dist/{image-ocr-VIGZE4YL.js.map → image-ocr-EDD2FWK3.js.map} +0 -0
- /package/dist/{image-ocr-7Y3FCGRR.js.map → image-ocr-KGEUPOG5.js.map} +0 -0
- /package/dist/{memo-T5ZQEXEA.js.map → memo-HW332L2B.js.map} +0 -0
- /package/dist/{model-bundle-UJRQPYUU.js.map → model-bundle-JQBHF6XK.js.map} +0 -0
- /package/dist/{models-64YLAWTI.js.map → models-YWD5GLFW.js.map} +0 -0
- /package/dist/{parse-worker-v2-QWQZKFQO.js.map → parse-worker-v2-NXKUXGGX.js.map} +0 -0
- /package/dist/{parser-XFU3VRWM.js.map → parser-5E4Z3ME5.js.map} +0 -0
- /package/dist/{parser-JPWANPLM.js.map → parser-FPBBI4AE.js.map} +0 -0
- /package/dist/{pdf-ocr-XTZZEYKJ.js.map → pdf-ocr-GHVGOTJG.js.map} +0 -0
- /package/dist/{pdf-ocr-ZV3KYIIE.js.map → pdf-ocr-ZXEEUV72.js.map} +0 -0
- /package/dist/{profile-io-FAJORRD2.js.map → profile-io-RF7AHAZE.js.map} +0 -0
- /package/dist/{rasterize-4ZJUA2DZ.js.map → rasterize-GJH24CGX.js.map} +0 -0
- /package/dist/{redact-doc-JPNROEH6.js.map → redact-doc-W4DR6BTT.js.map} +0 -0
- /package/dist/{render-D4WBOBKI.js.map → render-OLEQELZH.js.map} +0 -0
- /package/dist/{rewrite-fallback-OF3QI6CX.js.map → rewrite-fallback-4MVCADX7.js.map} +0 -0
- /package/dist/{seal-DQWEHIAM.js.map → seal-JJLC6UDD.js.map} +0 -0
- /package/dist/{setup-YC25YCQB.js.map → setup-BMJI6RBB.js.map} +0 -0
- /package/dist/{to-hwpx-D7OMPDUQ.js.map → to-hwpx-XHJFVCD4.js.map} +0 -0
- /package/dist/{to-hwpx-ZWN64NCQ.js.map → to-hwpx-Z5WGF6YZ.js.map} +0 -0
- /package/dist/{visual-SW7NPY6K.js.map → visual-QGD23ZDN.js.map} +0 -0
- /package/dist/{watch-ZU576VSR.js.map → watch-F5TGSLKR.js.map} +0 -0
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk5R65VE7Scjs = require('./chunk-5R65VE7S.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
var _chunk6NZ32OTXcjs = require('./chunk-6NZ32OTX.cjs');
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
|
|
14
|
+
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
|
|
@@ -61,18 +63,16 @@ var _chunkY4MFHEK4cjs = require('./chunk-Y4MFHEK4.cjs');
|
|
|
61
63
|
|
|
62
64
|
|
|
63
65
|
|
|
64
|
-
var _chunkUBY2PLKRcjs = require('./chunk-UBY2PLKR.cjs');
|
|
65
66
|
|
|
66
67
|
|
|
67
|
-
var _chunkMMK32GPDcjs = require('./chunk-MMK32GPD.cjs');
|
|
68
|
-
require('./chunk-IRAZCKQ6.cjs');
|
|
69
68
|
|
|
70
69
|
|
|
71
|
-
var _chunk6NZ32OTXcjs = require('./chunk-6NZ32OTX.cjs');
|
|
72
70
|
|
|
71
|
+
var _chunkR34M3KZ5cjs = require('./chunk-R34M3KZ5.cjs');
|
|
73
72
|
|
|
74
73
|
|
|
75
|
-
var
|
|
74
|
+
var _chunkMMK32GPDcjs = require('./chunk-MMK32GPD.cjs');
|
|
75
|
+
require('./chunk-4H2CKUZC.cjs');
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
|
|
@@ -89,11 +89,11 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
var
|
|
92
|
+
var _chunkNTTH2JV3cjs = require('./chunk-NTTH2JV3.cjs');
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
|
|
96
|
-
var
|
|
96
|
+
var _chunkXOL2UOIWcjs = require('./chunk-XOL2UOIW.cjs');
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -992,13 +992,13 @@ function ocrVectorOps(opList, paths) {
|
|
|
992
992
|
|
|
993
993
|
// src/pdf/split-row-pattern.ts
|
|
994
994
|
var textOf = (cell) => cell.text.replace(/<\/?u>|~~/g, "").trim();
|
|
995
|
-
var plain = (cell) => !_optionalChain([cell, 'access', _29 => _29.blocks, 'optionalAccess', _30 => _30.length]) && !
|
|
995
|
+
var plain = (cell) => !_optionalChain([cell, 'access', _29 => _29.blocks, 'optionalAccess', _30 => _30.length]) && !_chunkR34M3KZ5cjs.IMAGE_CELLS.has(cell);
|
|
996
996
|
var labelsOf = (cell) => {
|
|
997
997
|
const labels = textOf(cell).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
998
998
|
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;
|
|
999
999
|
};
|
|
1000
1000
|
var alignedLabels = (label, value, count) => {
|
|
1001
|
-
const L =
|
|
1001
|
+
const L = _chunkR34M3KZ5cjs.CELL_LINES.get(label), V = _chunkR34M3KZ5cjs.CELL_LINES.get(value);
|
|
1002
1002
|
let next = 0;
|
|
1003
1003
|
return !!L && !!V && L.length === count && V.length >= count && Math.abs(L[0].y - V[0].y) <= 1 && L.every((l) => {
|
|
1004
1004
|
while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
|
|
@@ -1006,7 +1006,7 @@ var alignedLabels = (label, value, count) => {
|
|
|
1006
1006
|
});
|
|
1007
1007
|
};
|
|
1008
1008
|
function partialAlignedLabelCells(table, owner, first) {
|
|
1009
|
-
const pageOf = (a) => _nullishCoalesce(
|
|
1009
|
+
const pageOf = (a) => _nullishCoalesce(_chunkNTTH2JV3cjs.CELL_PAGES.get(_nullishCoalesce(a.cell, () => ( table.cells[a.r][a.c]))), () => ( (a.r < first ? -1 : -2)));
|
|
1010
1010
|
const pairs = [];
|
|
1011
1011
|
let carried = false;
|
|
1012
1012
|
for (let c = 0; c < table.cols; ) {
|
|
@@ -1029,10 +1029,10 @@ function partialAlignedLabelCells(table, owner, first) {
|
|
|
1029
1029
|
const keyed = pairs.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
|
|
1030
1030
|
if (keyed.length !== 1) return;
|
|
1031
1031
|
const label = keyed[0], value = pairs.find((p) => p.c === label.c + label.cs), context = pairs.find((p) => p.c + p.cs === label.c);
|
|
1032
|
-
if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([
|
|
1032
|
+
if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([_chunkNTTH2JV3cjs.CELL_EDGES, 'access', _41 => _41.get, 'call', _42 => _42(context.upper), 'optionalAccess', _43 => _43.b]) || !_optionalChain([_chunkNTTH2JV3cjs.CELL_EDGES, 'access', _44 => _44.get, 'call', _45 => _45(context.lower), 'optionalAccess', _46 => _46.t])) return;
|
|
1033
1033
|
const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
|
|
1034
1034
|
if (D.length < 2 || sequence.length < 3 || new Set(sequence).size !== sequence.length || !alignedLabels(label.upper, value.upper, U.length)) return;
|
|
1035
|
-
const L =
|
|
1035
|
+
const L = _chunkR34M3KZ5cjs.CELL_LINES.get(label.lower), V = _chunkR34M3KZ5cjs.CELL_LINES.get(value.lower);
|
|
1036
1036
|
if (!L || !V || L.length !== D.length) return;
|
|
1037
1037
|
let next = V.findIndex((v) => Math.abs(v.y - L[0].y) <= 1);
|
|
1038
1038
|
if (next <= 0 || !V.slice(0, next).every((v) => v.y > L[0].y + 1) || !L.every((l) => {
|
|
@@ -1052,14 +1052,14 @@ function partialAlignedLabelCells(table, owner, first) {
|
|
|
1052
1052
|
continue;
|
|
1053
1053
|
}
|
|
1054
1054
|
if (list.length < 3 || new Set(list).size !== list.length) continue;
|
|
1055
|
-
const visible = _nullishCoalesce(_optionalChain([
|
|
1055
|
+
const visible = _nullishCoalesce(_optionalChain([_chunkR34M3KZ5cjs.CELL_LINES, 'access', _51 => _51.get, 'call', _52 => _52(lc), 'optionalAccess', _53 => _53.length]), () => ( 0)), values = _chunkR34M3KZ5cjs.CELL_LINES.get(vc);
|
|
1056
1056
|
if (visible < 3 || visible > list.length || !values || !alignedLabels(lc, vc, visible)) continue;
|
|
1057
1057
|
const top = Math.max(...values.map((v2) => v2.y)), bottom = Math.min(...values.map((v2) => v2.y));
|
|
1058
1058
|
const contexts = [];
|
|
1059
1059
|
for (let rr = r; rr < r + l.rs && rr < table.rows; rr++) {
|
|
1060
1060
|
const a = _optionalChain([owner, 'access', _54 => _54[rr], 'optionalAccess', _55 => _55[context.c]]), cell = a ? table.cells[a.r][a.c] : void 0;
|
|
1061
1061
|
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;
|
|
1062
|
-
const lines =
|
|
1062
|
+
const lines = _chunkR34M3KZ5cjs.CELL_LINES.get(cell);
|
|
1063
1063
|
if (!_optionalChain([lines, 'optionalAccess', _56 => _56.length]) || lines.some((line) => line.y > top + 1 || line.y < bottom - 1)) break;
|
|
1064
1064
|
contexts.push(textOf(cell).replace(/\s+/g, ""));
|
|
1065
1065
|
}
|
|
@@ -1361,7 +1361,7 @@ function rowStarts(t) {
|
|
|
1361
1361
|
}
|
|
1362
1362
|
var covering = (t, r) => rowStarts(t).slice(0, r + 1).flatMap((starts, rr) => starts.filter((s) => rr + s.cell.rowSpan > r).map((s) => s.cell));
|
|
1363
1363
|
function cellPage(cell) {
|
|
1364
|
-
const p =
|
|
1364
|
+
const p = _chunkNTTH2JV3cjs.CELL_PAGES.get(cell);
|
|
1365
1365
|
if (p !== void 0 || !_optionalChain([cell, 'access', _123 => _123.blocks, 'optionalAccess', _124 => _124.length]) || cell.blocks.some((b) => b.pageNumber === void 0)) return p;
|
|
1366
1366
|
return Math.min(...cell.blocks.map((b) => b.pageNumber));
|
|
1367
1367
|
}
|
|
@@ -1390,7 +1390,7 @@ function markJoinedPages(table, prev, curr) {
|
|
|
1390
1390
|
rows.forEach((starts, r) => {
|
|
1391
1391
|
const page2 = r < pt.rows ? pp[r] : cp[r - off];
|
|
1392
1392
|
for (const { cell } of starts) {
|
|
1393
|
-
if (page2 !== void 0 && page2 !== prev.pageNumber)
|
|
1393
|
+
if (page2 !== void 0 && page2 !== prev.pageNumber) _chunkNTTH2JV3cjs.CELL_PAGES.set(cell, page2);
|
|
1394
1394
|
const src = _optionalChain([(r < pt.rows ? ptRows[r] : ctRows[r - off]), 'optionalAccess', _127 => _127.find, 'call', _128 => _128((s) => s.cell !== cell && s.cell.text === cell.text && CELL_SPLITS.has(s.cell))]);
|
|
1395
1395
|
if (src) setSplits(cell, relocate(src.cell, cell));
|
|
1396
1396
|
}
|
|
@@ -1450,8 +1450,8 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1450
1450
|
if (!splits.length) continue;
|
|
1451
1451
|
const clone = (cell, patch) => {
|
|
1452
1452
|
const out = { ...cell, ...patch };
|
|
1453
|
-
const p =
|
|
1454
|
-
if (p !== void 0)
|
|
1453
|
+
const p = _chunkNTTH2JV3cjs.CELL_PAGES.get(cell);
|
|
1454
|
+
if (p !== void 0) _chunkNTTH2JV3cjs.CELL_PAGES.set(out, p);
|
|
1455
1455
|
if (!("text" in patch) && CELL_SPLITS.has(cell)) CELL_SPLITS.set(out, CELL_SPLITS.get(cell));
|
|
1456
1456
|
return out;
|
|
1457
1457
|
};
|
|
@@ -1462,7 +1462,7 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1462
1462
|
for (const { cell, c, split } of splits) {
|
|
1463
1463
|
cells[r][c] = clone(cell, { ...split.head, rowSpan: cut - r });
|
|
1464
1464
|
const tail = { ...cell, ...split.tail, rowSpan: r + cell.rowSpan - cut };
|
|
1465
|
-
|
|
1465
|
+
_chunkNTTH2JV3cjs.CELL_PAGES.set(tail, split.page);
|
|
1466
1466
|
setSplits(tail, split.rest);
|
|
1467
1467
|
cells[cut][c] = tail;
|
|
1468
1468
|
}
|
|
@@ -1472,7 +1472,7 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1472
1472
|
for (const { cell, c, split } of splits) {
|
|
1473
1473
|
cells[r][c] = clone(cell, split.head);
|
|
1474
1474
|
const tail = { ...cell, ...split.tail, rowSpan: 1 };
|
|
1475
|
-
|
|
1475
|
+
_chunkNTTH2JV3cjs.CELL_PAGES.set(tail, split.page);
|
|
1476
1476
|
setSplits(tail, split.rest);
|
|
1477
1477
|
row[c] = tail;
|
|
1478
1478
|
}
|
|
@@ -1563,7 +1563,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1563
1563
|
if (cols < 1) return null;
|
|
1564
1564
|
const pa = anchorsOf(prev), ca = anchorsOf(curr);
|
|
1565
1565
|
const cutOpen = (() => {
|
|
1566
|
-
const u =
|
|
1566
|
+
const u = _chunkR34M3KZ5cjs.ROW_RULES.get(prev), d = _chunkR34M3KZ5cjs.ROW_RULES.get(curr);
|
|
1567
1567
|
return !!u && !!d && !u.bottom && !d.top;
|
|
1568
1568
|
})();
|
|
1569
1569
|
let skip = 0, head = 0;
|
|
@@ -1595,19 +1595,19 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1595
1595
|
if (r + dr < rows) owner[r + dr][dc] = placed;
|
|
1596
1596
|
}
|
|
1597
1597
|
grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
|
|
1598
|
-
const lines =
|
|
1599
|
-
if (lines)
|
|
1600
|
-
if (
|
|
1601
|
-
const edges =
|
|
1598
|
+
const lines = _chunkR34M3KZ5cjs.CELL_LINES.get(a.cell);
|
|
1599
|
+
if (lines) _chunkR34M3KZ5cjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
|
|
1600
|
+
if (_chunkR34M3KZ5cjs.IMAGE_CELLS.has(a.cell)) _chunkR34M3KZ5cjs.IMAGE_CELLS.add(grid[r][c1]);
|
|
1601
|
+
const edges = _chunkNTTH2JV3cjs.CELL_EDGES.get(a.cell);
|
|
1602
1602
|
if (edges) {
|
|
1603
|
-
|
|
1603
|
+
_chunkNTTH2JV3cjs.CELL_EDGES.set(grid[r][c1], edges);
|
|
1604
1604
|
edged = true;
|
|
1605
1605
|
}
|
|
1606
1606
|
return true;
|
|
1607
1607
|
};
|
|
1608
|
-
for (const a of pa) if (!
|
|
1608
|
+
for (const a of pa) if (!_chunkR34M3KZ5cjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
|
|
1609
1609
|
for (const a of ca) {
|
|
1610
|
-
if (a.r < skip ||
|
|
1610
|
+
if (a.r < skip || _chunkR34M3KZ5cjs.FILLER_CELLS.has(a.cell)) continue;
|
|
1611
1611
|
if (!place(a, cxU, prev.rows - skip, dx)) return null;
|
|
1612
1612
|
}
|
|
1613
1613
|
const first = prev.rows;
|
|
@@ -1631,9 +1631,9 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1631
1631
|
const grown = { ...above, rs: newRs };
|
|
1632
1632
|
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;
|
|
1633
1633
|
}
|
|
1634
|
-
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null)
|
|
1634
|
+
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkR34M3KZ5cjs.FILLER_CELLS.add(grid[r][c]);
|
|
1635
1635
|
if (edged) {
|
|
1636
|
-
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null)
|
|
1636
|
+
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkNTTH2JV3cjs.CELL_EDGES.set(grid[r][c], _chunkR34M3KZ5cjs.NO_EDGES);
|
|
1637
1637
|
}
|
|
1638
1638
|
for (let c = 0; c < cols && U[c + 1] <= pcx[0] + PART_COL_TOL; c++) {
|
|
1639
1639
|
let r = prev.rows;
|
|
@@ -1642,7 +1642,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1642
1642
|
for (let rr = 0; rr < r; rr++) owner[rr][c] = through;
|
|
1643
1643
|
}
|
|
1644
1644
|
const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
|
|
1645
|
-
const pr =
|
|
1645
|
+
const pr = _chunkR34M3KZ5cjs.ROW_RULES.get(prev), cr = _chunkR34M3KZ5cjs.ROW_RULES.get(curr);
|
|
1646
1646
|
const shifted = dx !== 0;
|
|
1647
1647
|
const cut = {
|
|
1648
1648
|
open: !!pr && !!cr && !pr.bottom && !cr.top && pr.innerOpen + cr.innerOpen === 0 && pr.innerRuled + cr.innerRuled > 0,
|
|
@@ -1650,13 +1650,13 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1650
1650
|
list: !shifted ? "any" : skip > 0 && ca.filter((a) => a.r < skip && a.cell.text.trim()).length < 2 ? "none" : "multi"
|
|
1651
1651
|
};
|
|
1652
1652
|
let partial = !skip && cols === prev.cols && cols === curr.cols && cut.ruled && prevBottom !== void 0 ? partialAlignedLabelCells(table, owner, first) : void 0;
|
|
1653
|
-
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]) ||
|
|
1653
|
+
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]) || _chunkR34M3KZ5cjs.startsNewItem.call(void 0, partial.value.upper.text, partial.value.lower.text))) partial = void 0;
|
|
1654
1654
|
const selected = partial ? /* @__PURE__ */ new Set([partial.label.c, partial.value.c]) : void 0;
|
|
1655
1655
|
let split = !selected && rows > prev.rows && mergeSplitRow(table, owner, prev.rows, U, false, cut);
|
|
1656
1656
|
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 });
|
|
1657
1657
|
if (pr && cr) {
|
|
1658
1658
|
const cutRuled = pr.bottom || cr.top;
|
|
1659
|
-
|
|
1659
|
+
_chunkR34M3KZ5cjs.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) });
|
|
1660
1660
|
}
|
|
1661
1661
|
return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
|
|
1662
1662
|
}
|
|
@@ -1718,18 +1718,18 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selec
|
|
|
1718
1718
|
if (!d || d === u || u.r + u.rs - 1 !== last || d.r !== first || d.c !== u.c || d.cs !== u.cs) continue;
|
|
1719
1719
|
const a = table.cells[u.r][u.c], b = table.cells[first][d.c];
|
|
1720
1720
|
if (selected && !selected.has(u.c)) continue;
|
|
1721
|
-
const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !
|
|
1722
|
-
const openSeam = hasContent(a) && hasContent(b) &&
|
|
1721
|
+
const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !_chunkR34M3KZ5cjs.startsNewItem.call(void 0, a.text, b.text) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs]);
|
|
1722
|
+
const openSeam = hasContent(a) && hasContent(b) && _chunkR34M3KZ5cjs.hasOpenCellSeam.call(void 0, a, b) && !owner.some((row, r) => {
|
|
1723
1723
|
if (!r || r === first) return false;
|
|
1724
1724
|
const up = owner[r - 1][u.c], down = row[u.c];
|
|
1725
1725
|
if (!up || !down || up === down || up.c !== u.c || down.c !== u.c || up.cs !== u.cs || down.cs !== u.cs) return false;
|
|
1726
|
-
const ue =
|
|
1726
|
+
const ue = _chunkNTTH2JV3cjs.CELL_EDGES.get(table.cells[up.r][up.c]), de = _chunkNTTH2JV3cjs.CELL_EDGES.get(table.cells[down.r][down.c]);
|
|
1727
1727
|
return !!ue && !!de && !ue.b && !de.t;
|
|
1728
1728
|
});
|
|
1729
1729
|
if (!selected && !openSeam && !flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
|
|
1730
1730
|
if (!straddles && !midWord) continue;
|
|
1731
1731
|
if (u.r >= last && d.rs < 2) continue;
|
|
1732
|
-
const U =
|
|
1732
|
+
const U = _chunkR34M3KZ5cjs.CELL_LINES.get(a);
|
|
1733
1733
|
if (!_optionalChain([U, 'optionalAccess', _154 => _154.length]) || !hasContent(b)) continue;
|
|
1734
1734
|
if (!(straddles && filledToBottom(U, prevBottom) && clauseContinues(a, b))) {
|
|
1735
1735
|
if (U.length > STRADDLE_MAX_LINES) continue;
|
|
@@ -1747,7 +1747,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selec
|
|
|
1747
1747
|
return merged;
|
|
1748
1748
|
}
|
|
1749
1749
|
function longLastLine(c) {
|
|
1750
|
-
const L =
|
|
1750
|
+
const L = _chunkR34M3KZ5cjs.CELL_LINES.get(c), l = _optionalChain([L, 'optionalAccess', _155 => _155[L.length - 1]]);
|
|
1751
1751
|
return !!l && l.r - l.l >= 6 * (l.h || 10);
|
|
1752
1752
|
}
|
|
1753
1753
|
function filledToBottom(U, bottom) {
|
|
@@ -1780,7 +1780,7 @@ function nextItemHead(prev, next) {
|
|
|
1780
1780
|
return false;
|
|
1781
1781
|
}
|
|
1782
1782
|
function continuesAcross(u, d, x1, x2) {
|
|
1783
|
-
const U =
|
|
1783
|
+
const U = _chunkR34M3KZ5cjs.CELL_LINES.get(u), D = _chunkR34M3KZ5cjs.CELL_LINES.get(d);
|
|
1784
1784
|
if (!_optionalChain([U, 'optionalAccess', _156 => _156.length]) || !_optionalChain([D, 'optionalAccess', _157 => _157.length])) return false;
|
|
1785
1785
|
const last = U[U.length - 1];
|
|
1786
1786
|
const fs = last.h || 10;
|
|
@@ -1798,7 +1798,7 @@ function continuesAcross(u, d, x1, x2) {
|
|
|
1798
1798
|
if (U.length === 1 && x2 - last.r > Math.max(FULL_LINE_EDGE_MIN, SINGLE_LINE_WORD_GAP * fs)) return false;
|
|
1799
1799
|
const indented = last.l - minL >= HANGING_MIN * fs;
|
|
1800
1800
|
if (last.r - last.l < FULL_LINE_MIN_FRAC * (indented ? x2 - last.l : x2 - x1)) return false;
|
|
1801
|
-
const newItem =
|
|
1801
|
+
const newItem = _chunkR34M3KZ5cjs.startsNewItem.call(void 0, u.text, d.text);
|
|
1802
1802
|
const all = D.length ? U.concat(D) : U;
|
|
1803
1803
|
const leftAligned = (l) => maxR - l.r > SHORT_LINE_GAP * fs && (l.l - minL <= fs || !newItem && all.some((o) => o !== l && Math.abs(o.l - l.l) <= HANGING_TOL && Math.abs(o.r - l.r) >= HANGING_MIN * fs));
|
|
1804
1804
|
const hanging = U.length >= 2 && U.every((l) => maxR - l.r <= FULL_LINE_TOL * fs) && indented && Math.abs(D[0].l - last.l) <= HANGING_TOL;
|
|
@@ -1815,10 +1815,10 @@ function outlineContinues(u, d) {
|
|
|
1815
1815
|
return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
|
|
1816
1816
|
}
|
|
1817
1817
|
function lineEnded(c, x1, x2, next) {
|
|
1818
|
-
const L =
|
|
1818
|
+
const L = _chunkR34M3KZ5cjs.CELL_LINES.get(c);
|
|
1819
1819
|
if (!L || L.length !== 1) return false;
|
|
1820
1820
|
const l = L[0], h = l.h || 10;
|
|
1821
|
-
const d0 = next ? _optionalChain([
|
|
1821
|
+
const d0 = next ? _optionalChain([_chunkR34M3KZ5cjs.CELL_LINES, 'access', _158 => _158.get, 'call', _159 => _159(next), 'optionalAccess', _160 => _160[0]]) : void 0;
|
|
1822
1822
|
if (d0 && d0.l - l.l >= HANGING_MIN * h) return false;
|
|
1823
1823
|
return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _161 => _161.text]), () => ( "")))) * h;
|
|
1824
1824
|
}
|
|
@@ -1829,15 +1829,15 @@ function firstWordUnits(text) {
|
|
|
1829
1829
|
return units;
|
|
1830
1830
|
}
|
|
1831
1831
|
function appendCell(a, b) {
|
|
1832
|
-
if (
|
|
1832
|
+
if (_chunkR34M3KZ5cjs.IMAGE_CELLS.has(b)) _chunkR34M3KZ5cjs.IMAGE_CELLS.add(a);
|
|
1833
1833
|
if (_optionalChain([a, 'access', _162 => _162.blocks, 'optionalAccess', _163 => _163.length]) || _optionalChain([b, 'access', _164 => _164.blocks, 'optionalAccess', _165 => _165.length])) {
|
|
1834
1834
|
const asBlocks = (c) => _optionalChain([c, 'access', _166 => _166.blocks, 'optionalAccess', _167 => _167.length]) ? c.blocks : c.text.split("\n").map((l) => l.trim()).filter(Boolean).map((text) => ({ type: "paragraph", text }));
|
|
1835
1835
|
a.blocks = [...asBlocks(a), ...asBlocks(b)];
|
|
1836
1836
|
}
|
|
1837
1837
|
if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
|
|
1838
|
-
|
|
1838
|
+
_chunkR34M3KZ5cjs.joinCellEdges.call(void 0, a, b);
|
|
1839
1839
|
}
|
|
1840
|
-
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _168 => _168.blocks, 'optionalAccess', _169 => _169.length]) ||
|
|
1840
|
+
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _168 => _168.blocks, 'optionalAccess', _169 => _169.length]) || _chunkR34M3KZ5cjs.IMAGE_CELLS.has(cell);
|
|
1841
1841
|
var CLAUSE_OPEN_ENDING = /(?:하는|되는|하고|하며|하여|되어|되고|되며|이며|으며|어야|아야|여야)$/;
|
|
1842
1842
|
var batchim = (ch) => {
|
|
1843
1843
|
const k = ch.charCodeAt(0) - 44032;
|
|
@@ -1845,7 +1845,7 @@ var batchim = (ch) => {
|
|
|
1845
1845
|
};
|
|
1846
1846
|
function clauseContinues(u, d) {
|
|
1847
1847
|
const tail = _nullishCoalesce(flowText(u.text).trim().split(/\s+/).pop(), () => ( "")), head = flowText(d.text).trim();
|
|
1848
|
-
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) ||
|
|
1848
|
+
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkR34M3KZ5cjs.startsNewItem.call(void 0, u.text, head)) return false;
|
|
1849
1849
|
const last = tail[tail.length - 1], before = tail[tail.length - 2];
|
|
1850
1850
|
return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
|
|
1851
1851
|
}
|
|
@@ -1853,8 +1853,8 @@ function quantityContinues(u, d) {
|
|
|
1853
1853
|
return /\d[\d,.]*\s*(?:%|[가-힣]{1,2})?$/.test(flowText(u.text).trim()) && /^(?:미만|이상|이하|초과)(?![가-힣])/.test(flowText(d.text).trim());
|
|
1854
1854
|
}
|
|
1855
1855
|
function wordOverflows(u, d, x1, x2) {
|
|
1856
|
-
const U =
|
|
1857
|
-
if (!_optionalChain([U, 'optionalAccess', _170 => _170.length]) ||
|
|
1856
|
+
const U = _chunkR34M3KZ5cjs.CELL_LINES.get(u);
|
|
1857
|
+
if (!_optionalChain([U, 'optionalAccess', _170 => _170.length]) || _chunkR34M3KZ5cjs.startsNewItem.call(void 0, u.text, d.text)) return false;
|
|
1858
1858
|
const last = U[U.length - 1], units = firstWordUnits(d.text);
|
|
1859
1859
|
return units > 0 && last.r - last.l + units * (last.h || 10) > x2 - x1;
|
|
1860
1860
|
}
|
|
@@ -1923,7 +1923,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
|
|
|
1923
1923
|
if (!carriedSplit && !band) {
|
|
1924
1924
|
const norm = (c) => flowText(c.text).replace(/\s+/g, "");
|
|
1925
1925
|
if (pairs.some(([u, d]) => hasContent(d.cell) && norm(cell(d)) !== norm(cell(u)) && lineEnded(cell(u), colXs[u.c], colXs[u.c + u.cs], cell(d)))) return false;
|
|
1926
|
-
const oneLine = (c) => _optionalChain([
|
|
1926
|
+
const oneLine = (c) => _optionalChain([_chunkR34M3KZ5cjs.CELL_LINES, 'access', _172 => _172.get, 'call', _173 => _173(c), 'optionalAccess', _174 => _174.length]) === 1;
|
|
1927
1927
|
if (pairs.some(([u, d]) => nextItemHead(cell(u).text, cell(d).text)) && pairs.some(([u, d]) => hasContent(u.cell) && hasContent(d.cell) && oneLine(cell(u)) && oneLine(cell(d)) && norm(cell(u)) !== norm(cell(d)))) return false;
|
|
1928
1928
|
if (cut.ruled && pairs.some(([u, d]) => u.rs >= 2 && hasContent(u.cell) && hasContent(d.cell) && oneLine(cell(u)) && oneLine(cell(d)) && norm(cell(u)) !== norm(cell(d)))) return false;
|
|
1929
1929
|
const flows = ([u, d]) => continuesAcross(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs]) || clauseContinues(cell(u), cell(d)) || quantityContinues(cell(u), cell(d));
|
|
@@ -2016,19 +2016,19 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
2016
2016
|
placeJoined(blocks, i, j, joined);
|
|
2017
2017
|
continue;
|
|
2018
2018
|
}
|
|
2019
|
-
if (
|
|
2019
|
+
if (_chunkR34M3KZ5cjs.EMPTY_PARTS.has(curr.table)) {
|
|
2020
2020
|
blocks.splice(j, 1);
|
|
2021
2021
|
i++;
|
|
2022
2022
|
continue;
|
|
2023
2023
|
}
|
|
2024
2024
|
if (joined === null) continue;
|
|
2025
|
-
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable ||
|
|
2025
|
+
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkR34M3KZ5cjs.EMPTY_PARTS.has(prev.table)) continue;
|
|
2026
2026
|
const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
|
|
2027
2027
|
const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
|
|
2028
2028
|
const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
|
|
2029
2029
|
if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) continue;
|
|
2030
|
-
const px =
|
|
2031
|
-
if (px && cx && !shiftedSame(px, cx, !
|
|
2030
|
+
const px = _chunkR34M3KZ5cjs.TABLE_COLXS.get(prev.table), cx = _chunkR34M3KZ5cjs.TABLE_COLXS.get(curr.table);
|
|
2031
|
+
if (px && cx && !shiftedSame(px, cx, !_chunkR34M3KZ5cjs.CLIP_TABLES.has(prev.table) && !_chunkR34M3KZ5cjs.CLIP_TABLES.has(curr.table))) continue;
|
|
2032
2032
|
if (!px !== !cx) continue;
|
|
2033
2033
|
if (!rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
|
|
2034
2034
|
let currCells = curr.table.cells;
|
|
@@ -2040,16 +2040,16 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
2040
2040
|
blocks.splice(j, 1);
|
|
2041
2041
|
continue;
|
|
2042
2042
|
}
|
|
2043
|
-
if (px && cx && !
|
|
2043
|
+
if (px && cx && !_chunkR34M3KZ5cjs.CLIP_TABLES.has(prev.table) && !_chunkR34M3KZ5cjs.CLIP_TABLES.has(curr.table) && currCells.length < curr.table.cells.length && curr.table.cells[0].filter((c) => c.text.trim()).length >= 2 && prev.table.cells.at(-1).concat(currCells[0]).every((c) => c.rowSpan === 1 && c.colSpan === 1 && _chunkR34M3KZ5cjs.CELL_LINES.has(c))) {
|
|
2044
2044
|
const dx = px[0] - cx[0];
|
|
2045
2045
|
const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
|
|
2046
2046
|
if (_optionalChain([part, 'optionalAccess', _195 => _195.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
|
|
2047
2047
|
const last = prev.table.rows - 1;
|
|
2048
2048
|
for (let c = 0; c < part.table.cols; c++) {
|
|
2049
|
-
const U =
|
|
2050
|
-
|
|
2049
|
+
const U = _chunkR34M3KZ5cjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkR34M3KZ5cjs.CELL_LINES.get(currCells[0][c]);
|
|
2050
|
+
_chunkR34M3KZ5cjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
|
|
2051
2051
|
}
|
|
2052
|
-
|
|
2052
|
+
_chunkR34M3KZ5cjs.TABLE_COLXS.set(part.table, part.colXs);
|
|
2053
2053
|
placeJoined(blocks, i, j, part.table);
|
|
2054
2054
|
continue;
|
|
2055
2055
|
}
|
|
@@ -2062,20 +2062,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
2062
2062
|
caption: prev.table.caption,
|
|
2063
2063
|
...prev.table.renderAsTable ? { renderAsTable: true } : {}
|
|
2064
2064
|
};
|
|
2065
|
-
if (_nullishCoalesce(px, () => ( cx)))
|
|
2066
|
-
if (
|
|
2065
|
+
if (_nullishCoalesce(px, () => ( cx))) _chunkR34M3KZ5cjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
|
|
2066
|
+
if (_chunkR34M3KZ5cjs.CLIP_TABLES.has(prev.table) || _chunkR34M3KZ5cjs.CLIP_TABLES.has(curr.table)) _chunkR34M3KZ5cjs.CLIP_TABLES.add(merged);
|
|
2067
2067
|
placeJoined(blocks, i, j, merged);
|
|
2068
2068
|
}
|
|
2069
2069
|
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
2070
2070
|
const t = blocks[i].table;
|
|
2071
|
-
if (blocks[i].type === "table" && t &&
|
|
2071
|
+
if (blocks[i].type === "table" && t && _chunkR34M3KZ5cjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
|
|
2072
2072
|
}
|
|
2073
2073
|
}
|
|
2074
2074
|
function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
2075
2075
|
if (!pageHeights) return;
|
|
2076
2076
|
for (let i = 0; i < blocks.length; i++) {
|
|
2077
2077
|
const L = blocks[i];
|
|
2078
|
-
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !
|
|
2078
|
+
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkR34M3KZ5cjs.CLIP_TABLES.has(L.table) || _chunkR34M3KZ5cjs.EMPTY_PARTS.has(L.table)) continue;
|
|
2079
2079
|
const ph = pageHeights.get(L.pageNumber);
|
|
2080
2080
|
if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
|
|
2081
2081
|
let s0 = i, s1 = i;
|
|
@@ -2094,8 +2094,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
|
2094
2094
|
if (Math.abs(R.bbox.width - L.bbox.width) > Math.max(R.bbox.width, L.bbox.width) * NEIGHBOR_TABLE_EPSILON) continue;
|
|
2095
2095
|
if (!looksContinued(L, R) || restartsTable(blocks, i, R.table, pageHeights)) continue;
|
|
2096
2096
|
const rt = R.table;
|
|
2097
|
-
if (rt.rows === 1 && rt.cols === 1 && !
|
|
2098
|
-
const px =
|
|
2097
|
+
if (rt.rows === 1 && rt.cols === 1 && !_chunkR34M3KZ5cjs.CLIP_TABLES.has(rt) && L.table.rows >= 2) {
|
|
2098
|
+
const px = _chunkR34M3KZ5cjs.TABLE_COLXS.get(L.table), lb = L.bbox;
|
|
2099
2099
|
const dx = lb.x + lb.width - (R.bbox.x + R.bbox.width);
|
|
2100
2100
|
const last = L.table.cells[L.table.rows - 1];
|
|
2101
2101
|
let col = 0;
|
|
@@ -2124,8 +2124,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
|
2124
2124
|
}
|
|
2125
2125
|
function joinClipParts(prev, curr, pageHeights, lex) {
|
|
2126
2126
|
const pt = prev.table, ct = curr.table;
|
|
2127
|
-
if (!
|
|
2128
|
-
const px =
|
|
2127
|
+
if (!_chunkR34M3KZ5cjs.CLIP_TABLES.has(pt) || !_chunkR34M3KZ5cjs.CLIP_TABLES.has(ct)) return null;
|
|
2128
|
+
const px = _chunkR34M3KZ5cjs.TABLE_COLXS.get(pt), cx = _chunkR34M3KZ5cjs.TABLE_COLXS.get(ct);
|
|
2129
2129
|
if (!px || !cx) return null;
|
|
2130
2130
|
let xs = cx, shifted = false, dx = 0, foreign = false, within = false;
|
|
2131
2131
|
if (!shiftedSame(px, cx, false)) {
|
|
@@ -2141,15 +2141,15 @@ function joinClipParts(prev, curr, pageHeights, lex) {
|
|
|
2141
2141
|
const inner = b.slice(1, -1).map((x) => x + dx);
|
|
2142
2142
|
return inner.length > 0 && !inner.some((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
|
|
2143
2143
|
};
|
|
2144
|
-
foreign = unrelated(cx) && unrelated(_nullishCoalesce(
|
|
2144
|
+
foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkR34M3KZ5cjs.PART_COLXS.get(ct), () => ( cx))) && (headingRow(_nullishCoalesce(ct.cells[0], () => ( []))) || px.length > FOREIGN_FIRST_ROW_CELLS && anchorsOf(ct).filter((a) => a.r === 0).length >= FOREIGN_FIRST_ROW_CELLS);
|
|
2145
2145
|
}
|
|
2146
2146
|
const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _200 => _200.bbox, 'optionalAccess', _201 => _201.y]), lex);
|
|
2147
2147
|
if (!res || (shifted || foreign || within) && !res.split && !res.header) return null;
|
|
2148
|
-
|
|
2149
|
-
const ys =
|
|
2150
|
-
if (ys)
|
|
2151
|
-
|
|
2152
|
-
|
|
2148
|
+
_chunkR34M3KZ5cjs.TABLE_COLXS.set(res.table, res.colXs);
|
|
2149
|
+
const ys = _chunkR34M3KZ5cjs.TABLE_ROWYS.get(pt);
|
|
2150
|
+
if (ys) _chunkR34M3KZ5cjs.TABLE_ROWYS.set(res.table, ys);
|
|
2151
|
+
_chunkR34M3KZ5cjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkR34M3KZ5cjs.PART_COLXS.get(pt), () => ( px)));
|
|
2152
|
+
_chunkR34M3KZ5cjs.CLIP_TABLES.add(res.table);
|
|
2153
2153
|
return res.table;
|
|
2154
2154
|
}
|
|
2155
2155
|
function prevLacksLeftCols(prev, px, xs, pageHeights) {
|
|
@@ -2173,12 +2173,12 @@ function looksContinued(prev, curr, pageHeights) {
|
|
|
2173
2173
|
return filled.length >= 2 && filled.every((t) => t === filled[0]);
|
|
2174
2174
|
}
|
|
2175
2175
|
function pushedLead(prev, curr) {
|
|
2176
|
-
if (!
|
|
2176
|
+
if (!_chunkR34M3KZ5cjs.CLIP_TABLES.has(prev.table) || !_chunkR34M3KZ5cjs.CLIP_TABLES.has(curr.table)) return false;
|
|
2177
2177
|
const lead = leadRows(curr.table);
|
|
2178
2178
|
return lead.image && lead.height > prev.bbox.y;
|
|
2179
2179
|
}
|
|
2180
2180
|
function leadRows(t) {
|
|
2181
|
-
const ys =
|
|
2181
|
+
const ys = _chunkR34M3KZ5cjs.TABLE_ROWYS.get(t);
|
|
2182
2182
|
if (!ys || ys.length < 2) return { height: 0, image: false };
|
|
2183
2183
|
const anchors = anchorsOf(t);
|
|
2184
2184
|
let end = 1, image = false;
|
|
@@ -2186,17 +2186,17 @@ function leadRows(t) {
|
|
|
2186
2186
|
for (const a of anchors) {
|
|
2187
2187
|
if (a.r !== r) continue;
|
|
2188
2188
|
end = Math.max(end, r + a.rs);
|
|
2189
|
-
if (
|
|
2189
|
+
if (_chunkR34M3KZ5cjs.IMAGE_CELLS.has(a.cell)) image = true;
|
|
2190
2190
|
}
|
|
2191
2191
|
}
|
|
2192
2192
|
return { height: ys[0] - ys[Math.min(end, ys.length - 1)], image };
|
|
2193
2193
|
}
|
|
2194
2194
|
function tailOf(b) {
|
|
2195
|
-
const t = b.table &&
|
|
2195
|
+
const t = b.table && _chunkR34M3KZ5cjs.TABLE_TAIL.get(b.table);
|
|
2196
2196
|
return t && b.bbox ? { ...b, pageNumber: t.page, bbox: { ...b.bbox, page: t.page, y: t.y, height: t.height } } : b;
|
|
2197
2197
|
}
|
|
2198
2198
|
function firstRowSig(t) {
|
|
2199
|
-
const x =
|
|
2199
|
+
const x = _chunkR34M3KZ5cjs.TABLE_COLXS.get(t);
|
|
2200
2200
|
if (!x || x.length !== t.cols + 1) return null;
|
|
2201
2201
|
return anchorsOf(t).filter((a) => a.r === 0).map((a) => ({ x1: x[a.c], x2: x[a.c + a.cs], t: flowText(a.cell.text).replace(/\s+/g, "") }));
|
|
2202
2202
|
}
|
|
@@ -2249,7 +2249,7 @@ function chainHead(blocks, i, pageHeights) {
|
|
|
2249
2249
|
if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
|
|
2250
2250
|
if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb) || pageNumberBetween(b, pb, cur, pageHeights))) break;
|
|
2251
2251
|
if (!looksContinued(pb, cur, pageHeights)) break;
|
|
2252
|
-
const px =
|
|
2252
|
+
const px = _chunkR34M3KZ5cjs.TABLE_COLXS.get(pb.table), cx = _chunkR34M3KZ5cjs.TABLE_COLXS.get(cur.table);
|
|
2253
2253
|
if (!px || !cx) break;
|
|
2254
2254
|
const dx = px[px.length - 1] - cx[cx.length - 1];
|
|
2255
2255
|
if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL) && !prevLacksLeftCols(pb, px, cx, pageHeights)) break;
|
|
@@ -2320,7 +2320,7 @@ var RESTART_LOOKBACK_PAGES = 5;
|
|
|
2320
2320
|
var COL_MATCH_TOL = 0.5;
|
|
2321
2321
|
var CONTINUED_TABLE_PAGE_BAND = 0.16;
|
|
2322
2322
|
function lastRowCell(t, x1, x2) {
|
|
2323
|
-
const xs =
|
|
2323
|
+
const xs = _chunkR34M3KZ5cjs.TABLE_COLXS.get(t);
|
|
2324
2324
|
const covered = /* @__PURE__ */ new Set();
|
|
2325
2325
|
for (let r = 0; r < t.rows; r++) {
|
|
2326
2326
|
for (let c = 0; c < t.cols; c++) {
|
|
@@ -2338,7 +2338,7 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
|
|
|
2338
2338
|
function mergeContinuedCells(blocks, pageHeights) {
|
|
2339
2339
|
for (let j = blocks.length - 1; j > 0; j--) {
|
|
2340
2340
|
const part = blocks[j];
|
|
2341
|
-
const from = part.table ?
|
|
2341
|
+
const from = part.table ? _chunkR34M3KZ5cjs.CONT_PARTS.get(part.table) : void 0;
|
|
2342
2342
|
if (!from || !part.table) {
|
|
2343
2343
|
unwrapContinuedTable(blocks, j, pageHeights, true);
|
|
2344
2344
|
continue;
|
|
@@ -2354,12 +2354,12 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
2354
2354
|
if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
|
|
2355
2355
|
else if (part.pageNumber) markContinuedText(cell, add, part.pageNumber);
|
|
2356
2356
|
cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
|
|
2357
|
-
if (
|
|
2358
|
-
|
|
2359
|
-
const lines =
|
|
2360
|
-
if (_optionalChain([lines, 'optionalAccess', _225 => _225.length]))
|
|
2361
|
-
if (part.pageNumber && part.bbox)
|
|
2362
|
-
if (cell.text.trim() || _optionalChain([cell, 'access', _226 => _226.blocks, 'optionalAccess', _227 => _227.length]) ||
|
|
2357
|
+
if (_chunkR34M3KZ5cjs.IMAGE_CELLS.has(add)) _chunkR34M3KZ5cjs.IMAGE_CELLS.add(cell);
|
|
2358
|
+
_chunkR34M3KZ5cjs.joinCellEdges.call(void 0, cell, add);
|
|
2359
|
+
const lines = _chunkR34M3KZ5cjs.CELL_LINES.get(add);
|
|
2360
|
+
if (_optionalChain([lines, 'optionalAccess', _225 => _225.length])) _chunkR34M3KZ5cjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkR34M3KZ5cjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
|
|
2361
|
+
if (part.pageNumber && part.bbox) _chunkR34M3KZ5cjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkR34M3KZ5cjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
|
|
2362
|
+
if (cell.text.trim() || _optionalChain([cell, 'access', _226 => _226.blocks, 'optionalAccess', _227 => _227.length]) || _chunkR34M3KZ5cjs.IMAGE_CELLS.has(cell)) _chunkR34M3KZ5cjs.EMPTY_PARTS.delete(prev.table);
|
|
2363
2363
|
blocks.splice(j, 1);
|
|
2364
2364
|
if (cell.blocks && at > 0) {
|
|
2365
2365
|
const nextAt = cell.blocks[at];
|
|
@@ -2371,11 +2371,11 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
2371
2371
|
}
|
|
2372
2372
|
function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
|
|
2373
2373
|
const prev = blocks[at - 1], frame = blocks[at];
|
|
2374
|
-
if (!_optionalChain([prev, 'optionalAccess', _228 => _228.table]) || !_optionalChain([frame, 'optionalAccess', _229 => _229.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !
|
|
2374
|
+
if (!_optionalChain([prev, 'optionalAccess', _228 => _228.table]) || !_optionalChain([frame, 'optionalAccess', _229 => _229.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkR34M3KZ5cjs.CLIP_TABLES.has(frame.table)) return;
|
|
2375
2375
|
const inner = _optionalChain([frame, 'access', _230 => _230.table, 'access', _231 => _231.cells, 'access', _232 => _232[0], 'optionalAccess', _233 => _233[0], 'optionalAccess', _234 => _234.blocks]);
|
|
2376
2376
|
const next = _optionalChain([inner, 'optionalAccess', _235 => _235[0]]);
|
|
2377
|
-
if (!inner || !_optionalChain([next, 'optionalAccess', _236 => _236.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !
|
|
2378
|
-
const px =
|
|
2377
|
+
if (!inner || !_optionalChain([next, 'optionalAccess', _236 => _236.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkR34M3KZ5cjs.CLIP_TABLES.has(prev.table) || !_chunkR34M3KZ5cjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
|
|
2378
|
+
const px = _chunkR34M3KZ5cjs.TABLE_COLXS.get(prev.table), nx = _chunkR34M3KZ5cjs.TABLE_COLXS.get(next.table);
|
|
2379
2379
|
if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
|
|
2380
2380
|
const ph = _optionalChain([pageHeights, 'optionalAccess', _237 => _237.get, 'call', _238 => _238(prev.pageNumber)]), nh = _optionalChain([pageHeights, 'optionalAccess', _239 => _239.get, 'call', _240 => _240(next.pageNumber)]);
|
|
2381
2381
|
if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
|
|
@@ -2385,15 +2385,15 @@ function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
|
|
|
2385
2385
|
function fillNestedContinuation(blocks, at) {
|
|
2386
2386
|
const prev = blocks[at - 1], next = blocks[at];
|
|
2387
2387
|
const t = _optionalChain([prev, 'optionalAccess', _243 => _243.table]), u = _optionalChain([next, 'optionalAccess', _244 => _244.table]);
|
|
2388
|
-
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !
|
|
2389
|
-
const xs =
|
|
2388
|
+
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkR34M3KZ5cjs.CLIP_TABLES.has(t) || !_chunkR34M3KZ5cjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
|
|
2389
|
+
const xs = _chunkR34M3KZ5cjs.TABLE_COLXS.get(u);
|
|
2390
2390
|
const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
|
|
2391
2391
|
const add = _optionalChain([u, 'access', _245 => _245.cells, 'access', _246 => _246[0], 'optionalAccess', _247 => _247[0]]);
|
|
2392
|
-
if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _248 => _248.blocks, 'optionalAccess', _249 => _249.length]) ||
|
|
2392
|
+
if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _248 => _248.blocks, 'optionalAccess', _249 => _249.length]) || _chunkR34M3KZ5cjs.IMAGE_CELLS.has(cell)) return;
|
|
2393
2393
|
cell.text = add.text;
|
|
2394
2394
|
if (add.blocks) cell.blocks = add.blocks;
|
|
2395
|
-
if (
|
|
2396
|
-
|
|
2395
|
+
if (_chunkR34M3KZ5cjs.IMAGE_CELLS.has(add)) _chunkR34M3KZ5cjs.IMAGE_CELLS.add(cell);
|
|
2396
|
+
_chunkR34M3KZ5cjs.joinCellEdges.call(void 0, cell, add);
|
|
2397
2397
|
blocks.splice(at, 1);
|
|
2398
2398
|
}
|
|
2399
2399
|
|
|
@@ -2993,12 +2993,12 @@ function restoreUnmappedGlyphs(items, fnArray, argsArray, fontObj) {
|
|
|
2993
2993
|
}
|
|
2994
2994
|
}
|
|
2995
2995
|
for (const q of queues.values()) for (let k = 0; k < q.length; k++) {
|
|
2996
|
-
const pair = k + 1 < q.length ?
|
|
2996
|
+
const pair = k + 1 < q.length ? _chunkNTTH2JV3cjs.pairedNumber.call(void 0, q[k], q[k + 1]) : void 0;
|
|
2997
2997
|
if (pair !== void 0) {
|
|
2998
2998
|
q[k] = pair;
|
|
2999
2999
|
q[k + 1] = "";
|
|
3000
3000
|
k++;
|
|
3001
|
-
} else q[k] =
|
|
3001
|
+
} else q[k] = _chunkNTTH2JV3cjs.mapPuaText.call(void 0, q[k]);
|
|
3002
3002
|
}
|
|
3003
3003
|
const byFont = /* @__PURE__ */ new Map();
|
|
3004
3004
|
for (const it of items) {
|
|
@@ -3088,15 +3088,15 @@ function selectionContextPages(selected, pageCount) {
|
|
|
3088
3088
|
function marginContextBlocks(raw, page, view) {
|
|
3089
3089
|
const [x1, y1, x2, y2] = view;
|
|
3090
3090
|
const width = x2 - x1, height = y2 - y1;
|
|
3091
|
-
const items =
|
|
3091
|
+
const items = _chunkR34M3KZ5cjs.filterHiddenText.call(void 0, _chunkR34M3KZ5cjs.normalizeItems.call(void 0, raw), width, height, x1, y1).visible;
|
|
3092
3092
|
for (const item of items) {
|
|
3093
3093
|
item.x -= x1;
|
|
3094
3094
|
item.y -= y1;
|
|
3095
3095
|
}
|
|
3096
|
-
return
|
|
3097
|
-
const bbox =
|
|
3096
|
+
return _chunkR34M3KZ5cjs.groupByY.call(void 0, items).flatMap((line) => {
|
|
3097
|
+
const bbox = _chunkR34M3KZ5cjs.computeBBox.call(void 0, line, page);
|
|
3098
3098
|
if (bbox.y + bbox.height < height * 0.88 && bbox.y > height * 0.12) return [];
|
|
3099
|
-
return [{ type: "paragraph", text:
|
|
3099
|
+
return [{ type: "paragraph", text: _chunkR34M3KZ5cjs.mergeLineSimple.call(void 0, line), pageNumber: page, bbox, style: _chunkR34M3KZ5cjs.dominantStyle.call(void 0, line) }];
|
|
3100
3100
|
});
|
|
3101
3101
|
}
|
|
3102
3102
|
|
|
@@ -3132,7 +3132,7 @@ var WINANSI_REVERSE = {
|
|
|
3132
3132
|
};
|
|
3133
3133
|
function symbolFontTable(fontName) {
|
|
3134
3134
|
if (!fontName) return void 0;
|
|
3135
|
-
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return
|
|
3135
|
+
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkNTTH2JV3cjs.WINGDINGS;
|
|
3136
3136
|
return void 0;
|
|
3137
3137
|
}
|
|
3138
3138
|
function remapSymbolText(text, table) {
|
|
@@ -3365,7 +3365,7 @@ function wrapEquationRuns(items, faceName) {
|
|
|
3365
3365
|
for (const i of members) drop.add(i);
|
|
3366
3366
|
const toks = cur.map((it) => {
|
|
3367
3367
|
const bar2 = isBarItem(it);
|
|
3368
|
-
const text = bar2 ? "" : plain2.has(items.indexOf(it)) ?
|
|
3368
|
+
const text = bar2 ? "" : plain2.has(items.indexOf(it)) ? _chunkNTTH2JV3cjs.toTex.call(void 0, it.text) : FUNC_RE.test(it.text.trim()) ? it.text.trim() : [...it.text].map(decodeEq).join("");
|
|
3369
3369
|
return { text, x: it.x, y: it.y, w: it.w, size: sizeOf(it), bar: bar2 };
|
|
3370
3370
|
});
|
|
3371
3371
|
const tex = layout(toks).replace(/\}\\text\{/g, "");
|
|
@@ -4205,7 +4205,7 @@ function mergeEnclosedDigits(items) {
|
|
|
4205
4205
|
if (!/^\d\d?$/.test(digits)) continue;
|
|
4206
4206
|
const mid = (inside2[0].x + inside2[inside2.length - 1].x + inside2[inside2.length - 1].w) / 2;
|
|
4207
4207
|
if (Math.abs(mid - (s.x + s.w / 2)) > s.fontSize * 0.15) continue;
|
|
4208
|
-
s.text =
|
|
4208
|
+
s.text = _chunkNTTH2JV3cjs.enclosedNumber.call(void 0, Number(digits));
|
|
4209
4209
|
for (const d of inside2) drop.add(d);
|
|
4210
4210
|
}
|
|
4211
4211
|
if (!drop.size) return;
|
|
@@ -4402,7 +4402,7 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
|
|
|
4402
4402
|
if (block.type !== "heading" || !block.text) continue;
|
|
4403
4403
|
const text = block.text.replace(/<[^>]+>/g, "").trim();
|
|
4404
4404
|
const fsz = _nullishCoalesce(_optionalChain([block, 'access', _331 => _331.style, 'optionalAccess', _332 => _332.fontSize]), () => ( 0));
|
|
4405
|
-
const tocEntry = i > 0 &&
|
|
4405
|
+
const tocEntry = i > 0 && _chunkR34M3KZ5cjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkR34M3KZ5cjs.TOC_BLOCKS.has(blocks[i + 1]);
|
|
4406
4406
|
const page = _nullishCoalesce(byPage.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( []));
|
|
4407
4407
|
const proseStyle = _optionalChain([block, 'access', _333 => _333.style, 'optionalAccess', _334 => _334.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
|
|
4408
4408
|
const next = blocks[i + 1];
|
|
@@ -4500,7 +4500,7 @@ function splitSingleCellTables(blocks) {
|
|
|
4500
4500
|
const out = [];
|
|
4501
4501
|
for (const b of blocks) {
|
|
4502
4502
|
const t = b.type === "table" ? b.table : void 0;
|
|
4503
|
-
const title = t &&
|
|
4503
|
+
const title = t && _chunkR34M3KZ5cjs.FRAME_TITLE_BLOCKS.get(t);
|
|
4504
4504
|
if (title) {
|
|
4505
4505
|
out.push({ ...title, text: `${t.cells[0][0].text.trim()} ${t.cells[0][2].text.trim()}` });
|
|
4506
4506
|
continue;
|
|
@@ -4536,7 +4536,7 @@ function joinLatinCellWraps(blocks) {
|
|
|
4536
4536
|
const lines = cell.text.split("\n");
|
|
4537
4537
|
const out = [lines[0]];
|
|
4538
4538
|
for (const line of lines.slice(1)) {
|
|
4539
|
-
if (
|
|
4539
|
+
if (_chunkR34M3KZ5cjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
|
|
4540
4540
|
else out.push(line);
|
|
4541
4541
|
}
|
|
4542
4542
|
cell.text = out.join("\n");
|
|
@@ -4556,10 +4556,10 @@ function cleanPdfText(text, opts) {
|
|
|
4556
4556
|
).replace(/^(?!\| ---).*$/gm, (line) => {
|
|
4557
4557
|
if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
|
|
4558
4558
|
if (line.startsWith("|")) {
|
|
4559
|
-
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) =>
|
|
4559
|
+
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkR34M3KZ5cjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
|
|
4560
4560
|
}
|
|
4561
4561
|
const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _414 => _414.exec, 'call', _415 => _415(line), 'optionalAccess', _416 => _416[0]]), () => ( ""));
|
|
4562
|
-
return mark +
|
|
4562
|
+
return mark + _chunkR34M3KZ5cjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
|
|
4563
4563
|
}).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/<(sup|sub)>\s*<\/\1>/g, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
4564
4564
|
}
|
|
4565
4565
|
function startsWithMarker(line) {
|
|
@@ -4591,7 +4591,7 @@ function mergeKoreanLines(text) {
|
|
|
4591
4591
|
continue;
|
|
4592
4592
|
}
|
|
4593
4593
|
if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
|
|
4594
|
-
result[result.length - 1] = prev +
|
|
4594
|
+
result[result.length - 1] = prev + _chunkR34M3KZ5cjs.wrapJoiner.call(void 0, prev, curr) + curr;
|
|
4595
4595
|
} else {
|
|
4596
4596
|
result.push(curr);
|
|
4597
4597
|
}
|
|
@@ -4607,7 +4607,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
4607
4607
|
const wrapped = /* @__PURE__ */ new Set();
|
|
4608
4608
|
for (const a of annots) {
|
|
4609
4609
|
if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
|
|
4610
|
-
const url =
|
|
4610
|
+
const url = _chunkXOL2UOIWcjs.sanitizeHref.call(void 0, a.url);
|
|
4611
4611
|
if (!url) continue;
|
|
4612
4612
|
const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
|
|
4613
4613
|
const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
|
|
@@ -4659,7 +4659,7 @@ function mergeLinkRuns(markdown) {
|
|
|
4659
4659
|
|
|
4660
4660
|
// src/pdf/formula-ocr.ts
|
|
4661
4661
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
4662
|
-
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-
|
|
4662
|
+
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-MQDZV5BS.cjs")));
|
|
4663
4663
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
4664
4664
|
await ensureFormulaModels((p) => {
|
|
4665
4665
|
if (p.phase === "download" && p.total) {
|
|
@@ -4850,13 +4850,13 @@ async function loadPdfWithTimeout(buffer, data) {
|
|
|
4850
4850
|
try {
|
|
4851
4851
|
return await Promise.race([
|
|
4852
4852
|
loadingTask.promise.catch((e) => {
|
|
4853
|
-
if (e instanceof Error && e.name === "PasswordException") throw new (0,
|
|
4853
|
+
if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkXOL2UOIWcjs.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)");
|
|
4854
4854
|
throw e;
|
|
4855
4855
|
}),
|
|
4856
4856
|
new Promise((_, reject) => {
|
|
4857
4857
|
timer = setTimeout(() => {
|
|
4858
4858
|
loadingTask.destroy();
|
|
4859
|
-
reject(new (0,
|
|
4859
|
+
reject(new (0, _chunkXOL2UOIWcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
|
|
4860
4860
|
}, PDF_LOAD_TIMEOUT_MS);
|
|
4861
4861
|
})
|
|
4862
4862
|
]);
|
|
@@ -4867,8 +4867,8 @@ async function loadPdfWithTimeout(buffer, data) {
|
|
|
4867
4867
|
async function parsePdfDocument(buffer, options) {
|
|
4868
4868
|
const formulaBuffer = _optionalChain([options, 'optionalAccess', _417 => _417.formulaOcr]) ? buffer : null;
|
|
4869
4869
|
const ocrOptionError = _chunkMMK32GPDcjs.validateOcrOptions.call(void 0, options);
|
|
4870
|
-
if (ocrOptionError) throw new (0,
|
|
4871
|
-
const autoOcr = _optionalChain([options, 'optionalAccess', _418 => _418.ocr]) === void 0 && await
|
|
4870
|
+
if (ocrOptionError) throw new (0, _chunkXOL2UOIWcjs.KordocError)(ocrOptionError);
|
|
4871
|
+
const autoOcr = _optionalChain([options, 'optionalAccess', _418 => _418.ocr]) === void 0 && await _chunkR34M3KZ5cjs.ocrModelsCached.call(void 0, _chunkR34M3KZ5cjs.resolveOcrModels.call(void 0, options)) && (_optionalChain([options, 'optionalAccess', _419 => _419.ocrRec]) !== "auto" || await _chunkR34M3KZ5cjs.ocrModelsCached.call(void 0, _chunkR34M3KZ5cjs.handwritingFallbackModels.call(void 0, _chunkR34M3KZ5cjs.resolveOcrModels.call(void 0, options))));
|
|
4872
4872
|
const ocrBuffer = _optionalChain([options, 'optionalAccess', _420 => _420.ocr]) || autoOcr ? buffer : null;
|
|
4873
4873
|
const pdfjsData = new Uint8Array(buffer.slice(0));
|
|
4874
4874
|
const blanked = blankLargeImageStreams(pdfjsData);
|
|
@@ -4880,7 +4880,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4880
4880
|
let pristine;
|
|
4881
4881
|
try {
|
|
4882
4882
|
const pageCount = doc.numPages;
|
|
4883
|
-
if (pageCount === 0) throw new (0,
|
|
4883
|
+
if (pageCount === 0) throw new (0, _chunkXOL2UOIWcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
4884
4884
|
const metadata = { pageCount, pageMode: "layout" };
|
|
4885
4885
|
await extractPdfMetadata(doc, metadata);
|
|
4886
4886
|
const blocks = [];
|
|
@@ -4903,11 +4903,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4903
4903
|
const uncoveredImageRegions = /* @__PURE__ */ new Map();
|
|
4904
4904
|
const largeImageRegions = /* @__PURE__ */ new Set();
|
|
4905
4905
|
const wantWebp = _optionalChain([options, 'optionalAccess', _425 => _425.imageFormat]) === "webp" && options.images !== false;
|
|
4906
|
-
const encodeWebp = wantWebp ? await
|
|
4907
|
-
if (wantWebp && !encodeWebp) warnings.push(
|
|
4906
|
+
const encodeWebp = wantWebp ? await _chunk5R65VE7Scjs.loadWebpEncoder.call(void 0, ) : null;
|
|
4907
|
+
if (wantWebp && !encodeWebp) warnings.push(_chunk5R65VE7Scjs.WEBP_UNAVAILABLE);
|
|
4908
4908
|
const imageState = createPdfImageState(pdfium ? { decoder: pdfium, sizes: blanked.sizes, pristine: () => pristine ??= loadPdfWithTimeout(buffer) } : void 0, _nullishCoalesce(encodeWebp, () => ( void 0)));
|
|
4909
|
-
const readQr = _optionalChain([options, 'optionalAccess', _426 => _426.qrCodes]) ? await
|
|
4910
|
-
if (_optionalChain([options, 'optionalAccess', _427 => _427.qrCodes]) && !readQr) warnings.push(
|
|
4909
|
+
const readQr = _optionalChain([options, 'optionalAccess', _426 => _426.qrCodes]) ? await _chunk5R65VE7Scjs.loadQrReader.call(void 0, ) : null;
|
|
4910
|
+
if (_optionalChain([options, 'optionalAccess', _427 => _427.qrCodes]) && !readQr) warnings.push(_chunk5R65VE7Scjs.QR_UNAVAILABLE);
|
|
4911
4911
|
const imageBulletShapes = /* @__PURE__ */ new Map();
|
|
4912
4912
|
const imageArrowDirections = /* @__PURE__ */ new Map();
|
|
4913
4913
|
const extractedImages = [];
|
|
@@ -4915,7 +4915,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4915
4915
|
const carry = {};
|
|
4916
4916
|
const preciseGaps = await isHancomPdf(doc);
|
|
4917
4917
|
const vectorPageOps = /* @__PURE__ */ new Map();
|
|
4918
|
-
const wrapLexicon = new (0,
|
|
4918
|
+
const wrapLexicon = new (0, _chunkR34M3KZ5cjs.WrapLexicon)();
|
|
4919
4919
|
const noteMarks = /* @__PURE__ */ new Map();
|
|
4920
4920
|
const headerContext = [];
|
|
4921
4921
|
if (pageFilter && _optionalChain([options, 'optionalAccess', _428 => _428.removeHeaderFooter]) !== false && pageFilter.size < effectivePageCount) {
|
|
@@ -4966,12 +4966,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4966
4966
|
markSyntheticSpaces(rawItems, rawOps.fnArray, rawOps.argsArray);
|
|
4967
4967
|
restoreSoftHyphens();
|
|
4968
4968
|
rawItems.push(...spaceMappedDots(rawOps.fnArray, rawOps.argsArray, (n) => fontObj(n)));
|
|
4969
|
-
const items =
|
|
4969
|
+
const items = _chunkR34M3KZ5cjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
|
|
4970
4970
|
if (!preciseGaps) for (const it of items) {
|
|
4971
4971
|
delete it.fx;
|
|
4972
4972
|
delete it.fw;
|
|
4973
4973
|
}
|
|
4974
|
-
const filtered =
|
|
4974
|
+
const filtered = _chunkR34M3KZ5cjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
|
|
4975
4975
|
const joined = joinVerticalColumns(filtered.visible);
|
|
4976
4976
|
const visible = dropTabLeaderDots(joined);
|
|
4977
4977
|
const hiddenCount = filtered.hiddenCount + occluded.size;
|
|
@@ -4998,7 +4998,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4998
4998
|
} : rawOps;
|
|
4999
4999
|
remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _435 => _435(loadedName), 'optionalAccess', _436 => _436.name]));
|
|
5000
5000
|
remapControlGlyphs(visible, differencesOf);
|
|
5001
|
-
await
|
|
5001
|
+
await _chunkR34M3KZ5cjs.restoreImageBullets.call(void 0, visible, page, opList.fnArray, opList.argsArray, imageBulletShapes);
|
|
5002
5002
|
const faces = /* @__PURE__ */ new Map();
|
|
5003
5003
|
for (const it of visible) {
|
|
5004
5004
|
if (!it.fontName) continue;
|
|
@@ -5011,12 +5011,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5011
5011
|
it.fontName = face;
|
|
5012
5012
|
if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _438 => _438(face), 'optionalAccess', _439 => _439.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
|
|
5013
5013
|
}
|
|
5014
|
-
for (const it of visible) if (it.text.includes("$")) it.text =
|
|
5015
|
-
for (const it of visible) if (it.text.includes("<")) it.text =
|
|
5014
|
+
for (const it of visible) if (it.text.includes("$")) it.text = _chunkNTTH2JV3cjs.escapeLiteralDollar.call(void 0, it.text);
|
|
5015
|
+
for (const it of visible) if (it.text.includes("<")) it.text = _chunkNTTH2JV3cjs.escapeLiteralTags.call(void 0, it.text);
|
|
5016
5016
|
wrapEquationRuns(visible, (face) => faceNames.get(face));
|
|
5017
5017
|
const pageArea = pageW * pageH;
|
|
5018
5018
|
if (pageArea > 0) {
|
|
5019
|
-
const imageRegions =
|
|
5019
|
+
const imageRegions = _chunkR34M3KZ5cjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
|
|
5020
5020
|
let uncovered = 0;
|
|
5021
5021
|
for (const r of imageRegions) {
|
|
5022
5022
|
const area = (r.x2 - r.x1) * (r.y2 - r.y1);
|
|
@@ -5043,11 +5043,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5043
5043
|
if (uncovered > 0) skippedImagePages.set(i, uncovered);
|
|
5044
5044
|
}
|
|
5045
5045
|
const marks = superscriptNoteMarks(visible);
|
|
5046
|
-
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(
|
|
5046
|
+
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkR34M3KZ5cjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
|
|
5047
5047
|
const stamp = marginStamp(visible);
|
|
5048
5048
|
const flow = stamp.length ? visible.filter((it) => !stamp.includes(it)) : visible;
|
|
5049
|
-
const rightArrows = _optionalChain([options, 'optionalAccess', _440 => _440.tables]) !== false ? await
|
|
5050
|
-
const pageBlocks = orderTwoUpPage(
|
|
5049
|
+
const rightArrows = _optionalChain([options, 'optionalAccess', _440 => _440.tables]) !== false ? await _chunkR34M3KZ5cjs.detectRightArrowRegions.call(void 0, page, opList.fnArray, opList.argsArray, imageArrowDirections) : [];
|
|
5050
|
+
const pageBlocks = orderTwoUpPage(_chunkR34M3KZ5cjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _441 => _441.tables]) !== false, carry, wrapLexicon, rightArrows), pageW, pageH);
|
|
5051
5051
|
if (stamp.length) pageBlocks.unshift({ type: "paragraph", text: [...stamp].sort((a, b) => a.y - b.y).map((it) => it.text).join(" "), pageNumber: i });
|
|
5052
5052
|
for (const b of pageBlocks) blocks.push(b);
|
|
5053
5053
|
try {
|
|
@@ -5073,11 +5073,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5073
5073
|
if (_optionalChain([options, 'optionalAccess', _443 => _443.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
|
|
5074
5074
|
vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
|
|
5075
5075
|
}
|
|
5076
|
-
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0,
|
|
5076
|
+
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkXOL2UOIWcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
|
|
5077
5077
|
parsedPages++;
|
|
5078
5078
|
_optionalChain([options, 'optionalAccess', _444 => _444.onProgress, 'optionalCall', _445 => _445(parsedPages, totalTarget)]);
|
|
5079
5079
|
} catch (pageErr) {
|
|
5080
|
-
if (pageErr instanceof
|
|
5080
|
+
if (pageErr instanceof _chunkXOL2UOIWcjs.KordocError) throw pageErr;
|
|
5081
5081
|
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" });
|
|
5082
5082
|
} finally {
|
|
5083
5083
|
_optionalChain([loadedPage, 'optionalAccess', _446 => _446.cleanup, 'call', _447 => _447()]);
|
|
@@ -5108,12 +5108,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5108
5108
|
}
|
|
5109
5109
|
if (targets.size > 0) {
|
|
5110
5110
|
try {
|
|
5111
|
-
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
5111
|
+
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-SPAU33VI.cjs")));
|
|
5112
5112
|
const mode = typeof _optionalChain([options, 'optionalAccess', _452 => _452.ocr]) === "function" ? options.ocr : "builtin";
|
|
5113
5113
|
const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _453 => _453.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _454 => _454.find, 'call', _455 => _455((q) => q.page === p), 'optionalAccess', _456 => _456.needsOcr])));
|
|
5114
|
-
const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
5114
|
+
const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-SPAU33VI.cjs")));
|
|
5115
5115
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _457 => _457.onProgress]), _optionalChain([options, 'optionalAccess', _458 => _458.tables]) !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
|
|
5116
|
-
for (const obs of ocrPageBlocks.values())
|
|
5116
|
+
for (const obs of ocrPageBlocks.values()) _chunkNTTH2JV3cjs.stripScriptTags.call(void 0, { blocks: obs });
|
|
5117
5117
|
if (ocrPageBlocks.size > 0) {
|
|
5118
5118
|
const replacePages = /* @__PURE__ */ new Set();
|
|
5119
5119
|
for (const [p, obs] of ocrPageBlocks) {
|
|
@@ -5124,7 +5124,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5124
5124
|
continue;
|
|
5125
5125
|
}
|
|
5126
5126
|
const regions = ocrRegions.get(p);
|
|
5127
|
-
if (!regions ||
|
|
5127
|
+
if (!regions || _chunkR34M3KZ5cjs.mergeOcrImageRegions.call(void 0, blocks, p, regions, obs) === 0) continue;
|
|
5128
5128
|
ocrDone.add(p);
|
|
5129
5129
|
if (_optionalChain([pageImageBlocks, 'access', _463 => _463.get, 'call', _464 => _464(p), 'optionalAccess', _465 => _465.length]) === 1) pageImageBlocks.delete(p);
|
|
5130
5130
|
}
|
|
@@ -5177,17 +5177,17 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5177
5177
|
}
|
|
5178
5178
|
}
|
|
5179
5179
|
if (_optionalChain([options, 'optionalAccess', _466 => _466.removeHeaderFooter]) !== false && (parsedPageCount >= 3 || headerContext.length)) {
|
|
5180
|
-
const removed =
|
|
5181
|
-
const running =
|
|
5180
|
+
const removed = _chunkR34M3KZ5cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, false, headerContext);
|
|
5181
|
+
const running = _chunkR34M3KZ5cjs.runningLinePatterns.call(void 0, removed.map((ri) => blocks[ri]), pageHeights);
|
|
5182
5182
|
for (let ri = removed.length - 1; ri >= 0; ri--) {
|
|
5183
5183
|
blocks.splice(removed[ri], 1);
|
|
5184
5184
|
}
|
|
5185
|
-
const stripped =
|
|
5185
|
+
const stripped = _chunkR34M3KZ5cjs.stripAbsorbedRunningLines.call(void 0, blocks, pageHeights, running);
|
|
5186
5186
|
if (stripped !== blocks) {
|
|
5187
5187
|
blocks.length = 0;
|
|
5188
5188
|
blocks.push(...stripped);
|
|
5189
5189
|
}
|
|
5190
|
-
const kept =
|
|
5190
|
+
const kept = _chunkR34M3KZ5cjs.removeSideTabs.call(void 0, blocks, pageWidths);
|
|
5191
5191
|
if (kept !== blocks) {
|
|
5192
5192
|
blocks.length = 0;
|
|
5193
5193
|
blocks.push(...kept);
|
|
@@ -5196,12 +5196,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5196
5196
|
mergeContinuedCells(blocks, pageHeights);
|
|
5197
5197
|
mergeCrossPageTables(blocks, pageHeights, wrapLexicon);
|
|
5198
5198
|
if (_optionalChain([options, 'optionalAccess', _467 => _467.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
|
|
5199
|
-
const boxes =
|
|
5199
|
+
const boxes = _chunkR34M3KZ5cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
|
|
5200
5200
|
for (let ri = boxes.length - 1; ri >= 0; ri--) blocks.splice(boxes[ri], 1);
|
|
5201
5201
|
}
|
|
5202
5202
|
splitContactTables(blocks);
|
|
5203
|
-
if (!_optionalChain([options, 'optionalAccess', _468 => _468.keepTrailingEmptyCols]))
|
|
5204
|
-
|
|
5203
|
+
if (!_optionalChain([options, 'optionalAccess', _468 => _468.keepTrailingEmptyCols])) _chunkR34M3KZ5cjs.trimTrailingEmptyTableCols.call(void 0, blocks);
|
|
5204
|
+
_chunkR34M3KZ5cjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
|
|
5205
5205
|
await flushPdfImages(imageState, warnings, pageImageBlocks);
|
|
5206
5206
|
injectPageImageBlocks(blocks, pageImageBlocks);
|
|
5207
5207
|
if (_optionalChain([options, 'optionalAccess', _469 => _469.formulaOcr]) && formulaBuffer) {
|
|
@@ -5214,21 +5214,21 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5214
5214
|
});
|
|
5215
5215
|
}
|
|
5216
5216
|
}
|
|
5217
|
-
const medianFontSize =
|
|
5217
|
+
const medianFontSize = _chunkR34M3KZ5cjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
|
|
5218
5218
|
if (medianFontSize > 0) {
|
|
5219
|
-
|
|
5220
|
-
}
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5219
|
+
_chunkR34M3KZ5cjs.detectHeadings.call(void 0, blocks, medianFontSize);
|
|
5220
|
+
}
|
|
5221
|
+
_chunkR34M3KZ5cjs.detectDocumentStyleHeadings.call(void 0, blocks);
|
|
5222
|
+
_chunkR34M3KZ5cjs.detectTypographyHeadings.call(void 0, blocks);
|
|
5223
|
+
_chunkR34M3KZ5cjs.detectSiblingStyleHeadings.call(void 0, blocks);
|
|
5224
|
+
_chunkR34M3KZ5cjs.detectRepeatedPageLabels.call(void 0, blocks);
|
|
5225
|
+
_chunkR34M3KZ5cjs.detectPageLeadHeadings.call(void 0, blocks);
|
|
5226
|
+
_chunkR34M3KZ5cjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
|
|
5227
|
+
_chunkR34M3KZ5cjs.refineDocumentStyleHeadings.call(void 0, blocks);
|
|
5228
|
+
_chunkR34M3KZ5cjs.detectMarkerHeadings.call(void 0, blocks);
|
|
5229
5229
|
demoteNonHeadingRoles(blocks, pageHeights, faceNames);
|
|
5230
|
-
|
|
5231
|
-
|
|
5230
|
+
_chunkR34M3KZ5cjs.detectTableCaptions.call(void 0, blocks);
|
|
5231
|
+
_chunkR34M3KZ5cjs.detectKoreanListBlocks.call(void 0, blocks);
|
|
5232
5232
|
sanitizeBlockControlChars(blocks);
|
|
5233
5233
|
let outBlocks = splitSingleCellTables(blocks);
|
|
5234
5234
|
if (_optionalChain([options, 'optionalAccess', _470 => _470.layoutTables]) !== "keep") {
|
|
@@ -5249,19 +5249,19 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5249
5249
|
const shown = /* @__PURE__ */ new Map();
|
|
5250
5250
|
const markContent = (bs) => {
|
|
5251
5251
|
for (const b of _nullishCoalesce(bs, () => ( []))) if (b.table) for (const row of b.table.cells) for (const c of row) {
|
|
5252
|
-
if (
|
|
5253
|
-
const lines =
|
|
5254
|
-
if (lines)
|
|
5252
|
+
if (_chunkR34M3KZ5cjs.IMAGE_CELLS.has(c)) _chunkNTTH2JV3cjs.CONTENT_CELLS.add(c);
|
|
5253
|
+
const lines = _chunkR34M3KZ5cjs.CELL_LINES.get(c);
|
|
5254
|
+
if (lines) _chunkNTTH2JV3cjs.CELL_BASELINES.set(c, lines.map((l) => l.y));
|
|
5255
5255
|
markContent(c.blocks);
|
|
5256
5256
|
}
|
|
5257
5257
|
};
|
|
5258
5258
|
const visual = (bs) => bs.flatMap((b) => {
|
|
5259
5259
|
if (b.type !== "table") return [b];
|
|
5260
|
-
if (!hancom && b.table &&
|
|
5260
|
+
if (!hancom && b.table && _chunkR34M3KZ5cjs.CLIP_TABLES.has(b.table)) return [b];
|
|
5261
5261
|
let v = shown.get(b);
|
|
5262
5262
|
if (!v) {
|
|
5263
5263
|
markContent([b]);
|
|
5264
|
-
shown.set(b, v =
|
|
5264
|
+
shown.set(b, v = _chunkNTTH2JV3cjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _473 => _473.keepTrailingEmptyCols])));
|
|
5265
5265
|
}
|
|
5266
5266
|
return v;
|
|
5267
5267
|
});
|
|
@@ -5270,13 +5270,13 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5270
5270
|
blocks.length = 0;
|
|
5271
5271
|
for (const b of kept) blocks.push(b);
|
|
5272
5272
|
}
|
|
5273
|
-
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(
|
|
5274
|
-
if (_optionalChain([options, 'optionalAccess', _475 => _475.tableFormat]) === "gfm")
|
|
5273
|
+
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkNTTH2JV3cjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([options, 'optionalAccess', _474 => _474.tableFormat]) }), { keepLoneNumbers: true }));
|
|
5274
|
+
if (_optionalChain([options, 'optionalAccess', _475 => _475.tableFormat]) === "gfm") _chunkNTTH2JV3cjs.assignTableIds.call(void 0, blocks);
|
|
5275
5275
|
let markdown = finishMarkdown(outBlocks);
|
|
5276
5276
|
const outline = collectPdfOutline(outBlocks);
|
|
5277
5277
|
return {
|
|
5278
5278
|
markdown,
|
|
5279
|
-
pages:
|
|
5279
|
+
pages: _chunk5R65VE7Scjs.blocksToPages.call(void 0, splitPageTables(_chunkR34M3KZ5cjs.splitPageBreakWraps.call(void 0, outBlocks)), finishMarkdown),
|
|
5280
5280
|
blocks,
|
|
5281
5281
|
metadata,
|
|
5282
5282
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -5359,5 +5359,5 @@ function marginStamp(items) {
|
|
|
5359
5359
|
|
|
5360
5360
|
|
|
5361
5361
|
|
|
5362
|
-
exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks =
|
|
5363
|
-
//# sourceMappingURL=parser-
|
|
5362
|
+
exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkR34M3KZ5cjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkR34M3KZ5cjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkR34M3KZ5cjs.removeHeaderFooterBlocks;
|
|
5363
|
+
//# sourceMappingURL=parser-W4MNQL73.cjs.map
|