kordoc 4.24.78 → 4.24.79
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 +2 -2
- package/dist/{-3INLR7KZ.js → -WCLMRO7B.js} +22 -22
- package/dist/{chunk-ELOZVH5S.cjs → chunk-22L7WGJE.cjs} +8 -8
- package/dist/{chunk-ELOZVH5S.cjs.map → chunk-22L7WGJE.cjs.map} +1 -1
- package/dist/{chunk-PNKLL5TE.js → chunk-2DJI6DDM.js} +2 -2
- package/dist/{chunk-VEIPW7QU.js → chunk-3CQGKB62.js} +13 -10
- package/dist/chunk-3CQGKB62.js.map +1 -0
- package/dist/{chunk-MQYI7KWD.js → chunk-3G2BXR34.js} +2 -2
- package/dist/{chunk-QRNA3W7B.cjs → chunk-42P53WKD.cjs} +3 -3
- package/dist/{chunk-QRNA3W7B.cjs.map → chunk-42P53WKD.cjs.map} +1 -1
- package/dist/{chunk-KK77Q5NA.js → chunk-4DA67IZR.js} +2 -2
- package/dist/{chunk-HBKSG62C.js → chunk-7B6W4I3A.js} +2 -2
- package/dist/{chunk-SJF2ZMOH.js → chunk-7DD7G4BI.js} +2 -2
- package/dist/{chunk-V5JHID6L.js → chunk-A6KTEOXE.js} +3 -3
- package/dist/{chunk-ZE4OZOSO.js → chunk-ADPVFTTT.js} +12 -10
- package/dist/chunk-ADPVFTTT.js.map +1 -0
- package/dist/{chunk-TFKBIIDY.js → chunk-B6IV3WVP.js} +16 -16
- package/dist/{chunk-6RJGAVYA.js → chunk-B6OD2Z3R.js} +2 -2
- package/dist/{chunk-7BAKREYA.cjs → chunk-BJ365LX3.cjs} +3 -3
- package/dist/{chunk-7BAKREYA.cjs.map → chunk-BJ365LX3.cjs.map} +1 -1
- package/dist/{chunk-36KS4PDO.js → chunk-BWD4IPFG.js} +2 -2
- package/dist/{chunk-AEQJOD3U.js → chunk-CKOSQJCH.js} +2 -2
- package/dist/{chunk-EQO6PYJF.cjs → chunk-CKVPN66T.cjs} +33 -31
- package/dist/chunk-CKVPN66T.cjs.map +1 -0
- package/dist/{chunk-ENUL3MLZ.js → chunk-CY3JNBY7.js} +3 -3
- package/dist/{chunk-H6ZJK5KA.js → chunk-D6PDKX72.js} +2 -2
- package/dist/{chunk-7ASPTCTD.js → chunk-DKIBSCFV.js} +2 -2
- package/dist/{chunk-YDONOMUK.js → chunk-E4D3HKPN.js} +2 -2
- package/dist/{chunk-PLF5QVIR.cjs → chunk-E7ZG5NBU.cjs} +6 -6
- package/dist/{chunk-PLF5QVIR.cjs.map → chunk-E7ZG5NBU.cjs.map} +1 -1
- package/dist/{chunk-LVRS6HPA.js → chunk-EEUN7GWB.js} +6 -6
- package/dist/{chunk-KM5P2HJ2.js → chunk-FI4SFNUZ.js} +2 -2
- package/dist/{chunk-3JZINNV6.cjs → chunk-FOYPUNFB.cjs} +104 -104
- package/dist/{chunk-3JZINNV6.cjs.map → chunk-FOYPUNFB.cjs.map} +1 -1
- package/dist/{chunk-DJVCW5YA.js → chunk-FPJAA7GO.js} +12 -9
- package/dist/chunk-FPJAA7GO.js.map +1 -0
- package/dist/{chunk-Y2NIFMWC.js → chunk-GSBMOVCF.js} +7 -7
- package/dist/{chunk-F5RCXSUO.js → chunk-HNTRTZ2J.js} +2 -2
- package/dist/{chunk-7YAXU4XB.js → chunk-I5PYUR3W.js} +11 -11
- package/dist/{chunk-QXAQIVOI.js → chunk-IPAKNA6R.js} +2 -2
- package/dist/{chunk-DSUKSIMD.js → chunk-IZFALQLA.js} +6 -6
- package/dist/{chunk-7RQDJ63R.js → chunk-JEVINS5E.js} +11 -9
- package/dist/chunk-JEVINS5E.js.map +1 -0
- package/dist/{chunk-WENH6GSY.cjs → chunk-LPLU7527.cjs} +58 -58
- package/dist/{chunk-WENH6GSY.cjs.map → chunk-LPLU7527.cjs.map} +1 -1
- package/dist/{chunk-5JKGN6YF.js → chunk-MALK5PX5.js} +2 -2
- package/dist/{chunk-Q62ZOF73.js → chunk-PSYI2EYA.js} +2 -2
- package/dist/{chunk-ZOOI4PGA.js → chunk-Q2QT6AL6.js} +2 -2
- package/dist/{chunk-BXNK6DQL.js → chunk-RDDRHUSA.js} +2 -2
- package/dist/{chunk-Z4RKJYK4.js → chunk-RO577YPX.js} +10 -10
- package/dist/{chunk-YRYL75TY.js → chunk-TEWYIAFY.js} +2 -2
- package/dist/{chunk-XMNGFHK6.cjs → chunk-UP3KRRVN.cjs} +2 -2
- package/dist/{chunk-XMNGFHK6.cjs.map → chunk-UP3KRRVN.cjs.map} +1 -1
- package/dist/{chunk-VZRUNNZ2.js → chunk-VS5FCFDX.js} +2 -2
- package/dist/{chunk-PGTOBYRX.js → chunk-VTXPEJDA.js} +5 -5
- package/dist/{chunk-FAJO643G.js → chunk-W5FLEZV4.js} +5 -5
- package/dist/{chunk-PSWNPOWW.js → chunk-WHQXWZZK.js} +2 -2
- package/dist/{chunk-NWAA7CP7.js → chunk-XLR77IOC.js} +3 -3
- package/dist/{chunk-M5VCRPXU.js → chunk-Y3X53MRF.js} +5 -5
- package/dist/{chunk-EU7LGFMR.cjs → chunk-ZLHHSW2T.cjs} +97 -94
- package/dist/chunk-ZLHHSW2T.cjs.map +1 -0
- package/dist/chunks-6UAF6SYV.js +11 -0
- package/dist/cli.js +46 -46
- package/dist/{formula-X4J6TPFE.cjs → formula-HECGAXCQ.cjs} +9 -9
- package/dist/{formula-X4J6TPFE.cjs.map → formula-HECGAXCQ.cjs.map} +1 -1
- package/dist/{formula-OVW7R4O5.js → formula-JYXL5ZDG.js} +3 -3
- package/dist/{formula-OYCTBHT6.js → formula-NBB34N4Y.js} +4 -4
- package/dist/generator-AZ3APW7A.js +11 -0
- package/dist/generator-FSH6G2BY.cjs +12 -0
- package/dist/{generator-BCGW5ITF.cjs.map → generator-FSH6G2BY.cjs.map} +1 -1
- package/dist/generator-WTZZ2OSI.js +18 -0
- package/dist/{hancom-KYUZYWLO.js → hancom-GSUBPFCZ.js} +2 -2
- package/dist/{hancom-O4E5BLIX.js → hancom-GXUGVC5L.js} +2 -2
- package/dist/{hancom-WH7WXXZH.cjs → hancom-UUFWDLTN.cjs} +5 -5
- package/dist/{hancom-WH7WXXZH.cjs.map → hancom-UUFWDLTN.cjs.map} +1 -1
- package/dist/{image-ocr-OPDOCCLA.js → image-ocr-62D6HIBB.js} +11 -11
- package/dist/{image-ocr-GY4K5NOY.js → image-ocr-XSKOCOW7.js} +8 -8
- package/dist/{image-ocr-5ZFMCHZL.cjs → image-ocr-ZVU4TCW7.cjs} +36 -36
- package/dist/{image-ocr-5ZFMCHZL.cjs.map → image-ocr-ZVU4TCW7.cjs.map} +1 -1
- package/dist/index.cjs +1113 -1113
- package/dist/index.js +10 -10
- package/dist/mcp.js +37 -37
- package/dist/memo-A4PUH3YJ.js +17 -0
- package/dist/{model-bundle-VGXIVXVT.js → model-bundle-DPTHBESJ.js} +5 -5
- package/dist/{models-TUSHH7AR.js → models-O7M5SDJV.js} +5 -5
- package/dist/{parse-worker-v2-Z3XGSG52.js → parse-worker-v2-3ILBPY7P.js} +23 -23
- package/dist/{parser-OAQ2QNB6.js → parser-EIOKEMXD.js} +21 -15
- package/dist/parser-EIOKEMXD.js.map +1 -0
- package/dist/{parser-ZMBMSI3G.js → parser-LGJVHF2C.js} +18 -12
- package/dist/parser-LGJVHF2C.js.map +1 -0
- package/dist/{parser-EQTJOS7W.cjs → parser-TGMBU6NM.cjs} +173 -167
- package/dist/parser-TGMBU6NM.cjs.map +1 -0
- package/dist/{pdf-ocr-WRJDDC57.js → pdf-ocr-OU7XVMJW.js} +9 -9
- package/dist/pdf-ocr-VKZPLCS7.cjs +43 -0
- package/dist/{pdf-ocr-YGAPGMHW.cjs.map → pdf-ocr-VKZPLCS7.cjs.map} +1 -1
- package/dist/{pdf-ocr-3CUUB3YV.js → pdf-ocr-VQGNNEFT.js} +6 -6
- package/dist/{profile-io-IOVBPV7R.js → profile-io-AEG7M5KV.js} +3 -3
- package/dist/{rasterize-ZJZKZF5R.js → rasterize-2TX6CRQY.js} +3 -3
- package/dist/{redact-doc-NPMUDPQZ.js → redact-doc-UWXE2D52.js} +22 -22
- package/dist/{render-F43PBJAG.js → render-3TPZAAY3.js} +12 -12
- package/dist/{rewrite-fallback-RITELBHU.js → rewrite-fallback-FVI3MVUH.js} +13 -13
- package/dist/seal-ZNN4P4IN.js +16 -0
- package/dist/{setup-J7I3KFRD.js → setup-5SZWEMHX.js} +3 -3
- package/dist/to-hwpx-KHSK7PL3.cjs +16 -0
- package/dist/{to-hwpx-ACL6I6I7.cjs.map → to-hwpx-KHSK7PL3.cjs.map} +1 -1
- package/dist/{to-hwpx-M7W7O47H.js → to-hwpx-KVCLOFIT.js} +4 -4
- package/dist/{to-hwpx-6JBBYURE.js → to-hwpx-UNNR4Y7K.js} +7 -7
- package/dist/visual-UDZERIUK.js +40 -0
- package/dist/{watch-YILY6776.js → watch-YCNXUIJL.js} +23 -23
- package/package.json +1 -1
- package/dist/chunk-7RQDJ63R.js.map +0 -1
- package/dist/chunk-DJVCW5YA.js.map +0 -1
- package/dist/chunk-EQO6PYJF.cjs.map +0 -1
- package/dist/chunk-EU7LGFMR.cjs.map +0 -1
- package/dist/chunk-VEIPW7QU.js.map +0 -1
- package/dist/chunk-ZE4OZOSO.js.map +0 -1
- package/dist/chunks-QN3OZOZA.js +0 -11
- package/dist/generator-BCGW5ITF.cjs +0 -12
- package/dist/generator-GJJMS4RD.js +0 -11
- package/dist/generator-ZWGWYDPM.js +0 -18
- package/dist/memo-7BFDELVU.js +0 -17
- package/dist/parser-EQTJOS7W.cjs.map +0 -1
- package/dist/parser-OAQ2QNB6.js.map +0 -1
- package/dist/parser-ZMBMSI3G.js.map +0 -1
- package/dist/pdf-ocr-YGAPGMHW.cjs +0 -43
- package/dist/seal-BEVAF3RV.js +0 -16
- package/dist/to-hwpx-ACL6I6I7.cjs +0 -16
- package/dist/visual-EG4OBDUG.js +0 -40
- /package/dist/{-3INLR7KZ.js.map → -WCLMRO7B.js.map} +0 -0
- /package/dist/{chunk-PNKLL5TE.js.map → chunk-2DJI6DDM.js.map} +0 -0
- /package/dist/{chunk-MQYI7KWD.js.map → chunk-3G2BXR34.js.map} +0 -0
- /package/dist/{chunk-KK77Q5NA.js.map → chunk-4DA67IZR.js.map} +0 -0
- /package/dist/{chunk-HBKSG62C.js.map → chunk-7B6W4I3A.js.map} +0 -0
- /package/dist/{chunk-SJF2ZMOH.js.map → chunk-7DD7G4BI.js.map} +0 -0
- /package/dist/{chunk-V5JHID6L.js.map → chunk-A6KTEOXE.js.map} +0 -0
- /package/dist/{chunk-TFKBIIDY.js.map → chunk-B6IV3WVP.js.map} +0 -0
- /package/dist/{chunk-6RJGAVYA.js.map → chunk-B6OD2Z3R.js.map} +0 -0
- /package/dist/{chunk-36KS4PDO.js.map → chunk-BWD4IPFG.js.map} +0 -0
- /package/dist/{chunk-AEQJOD3U.js.map → chunk-CKOSQJCH.js.map} +0 -0
- /package/dist/{chunk-ENUL3MLZ.js.map → chunk-CY3JNBY7.js.map} +0 -0
- /package/dist/{chunk-H6ZJK5KA.js.map → chunk-D6PDKX72.js.map} +0 -0
- /package/dist/{chunk-7ASPTCTD.js.map → chunk-DKIBSCFV.js.map} +0 -0
- /package/dist/{chunk-YDONOMUK.js.map → chunk-E4D3HKPN.js.map} +0 -0
- /package/dist/{chunk-LVRS6HPA.js.map → chunk-EEUN7GWB.js.map} +0 -0
- /package/dist/{chunk-KM5P2HJ2.js.map → chunk-FI4SFNUZ.js.map} +0 -0
- /package/dist/{chunk-Y2NIFMWC.js.map → chunk-GSBMOVCF.js.map} +0 -0
- /package/dist/{chunk-F5RCXSUO.js.map → chunk-HNTRTZ2J.js.map} +0 -0
- /package/dist/{chunk-7YAXU4XB.js.map → chunk-I5PYUR3W.js.map} +0 -0
- /package/dist/{chunk-QXAQIVOI.js.map → chunk-IPAKNA6R.js.map} +0 -0
- /package/dist/{chunk-DSUKSIMD.js.map → chunk-IZFALQLA.js.map} +0 -0
- /package/dist/{chunk-5JKGN6YF.js.map → chunk-MALK5PX5.js.map} +0 -0
- /package/dist/{chunk-Q62ZOF73.js.map → chunk-PSYI2EYA.js.map} +0 -0
- /package/dist/{chunk-ZOOI4PGA.js.map → chunk-Q2QT6AL6.js.map} +0 -0
- /package/dist/{chunk-BXNK6DQL.js.map → chunk-RDDRHUSA.js.map} +0 -0
- /package/dist/{chunk-Z4RKJYK4.js.map → chunk-RO577YPX.js.map} +0 -0
- /package/dist/{chunk-YRYL75TY.js.map → chunk-TEWYIAFY.js.map} +0 -0
- /package/dist/{chunk-VZRUNNZ2.js.map → chunk-VS5FCFDX.js.map} +0 -0
- /package/dist/{chunk-PGTOBYRX.js.map → chunk-VTXPEJDA.js.map} +0 -0
- /package/dist/{chunk-FAJO643G.js.map → chunk-W5FLEZV4.js.map} +0 -0
- /package/dist/{chunk-PSWNPOWW.js.map → chunk-WHQXWZZK.js.map} +0 -0
- /package/dist/{chunk-NWAA7CP7.js.map → chunk-XLR77IOC.js.map} +0 -0
- /package/dist/{chunk-M5VCRPXU.js.map → chunk-Y3X53MRF.js.map} +0 -0
- /package/dist/{chunks-QN3OZOZA.js.map → chunks-6UAF6SYV.js.map} +0 -0
- /package/dist/{formula-OVW7R4O5.js.map → formula-JYXL5ZDG.js.map} +0 -0
- /package/dist/{formula-OYCTBHT6.js.map → formula-NBB34N4Y.js.map} +0 -0
- /package/dist/{generator-GJJMS4RD.js.map → generator-AZ3APW7A.js.map} +0 -0
- /package/dist/{generator-ZWGWYDPM.js.map → generator-WTZZ2OSI.js.map} +0 -0
- /package/dist/{hancom-KYUZYWLO.js.map → hancom-GSUBPFCZ.js.map} +0 -0
- /package/dist/{hancom-O4E5BLIX.js.map → hancom-GXUGVC5L.js.map} +0 -0
- /package/dist/{image-ocr-OPDOCCLA.js.map → image-ocr-62D6HIBB.js.map} +0 -0
- /package/dist/{image-ocr-GY4K5NOY.js.map → image-ocr-XSKOCOW7.js.map} +0 -0
- /package/dist/{memo-7BFDELVU.js.map → memo-A4PUH3YJ.js.map} +0 -0
- /package/dist/{model-bundle-VGXIVXVT.js.map → model-bundle-DPTHBESJ.js.map} +0 -0
- /package/dist/{models-TUSHH7AR.js.map → models-O7M5SDJV.js.map} +0 -0
- /package/dist/{parse-worker-v2-Z3XGSG52.js.map → parse-worker-v2-3ILBPY7P.js.map} +0 -0
- /package/dist/{pdf-ocr-3CUUB3YV.js.map → pdf-ocr-OU7XVMJW.js.map} +0 -0
- /package/dist/{pdf-ocr-WRJDDC57.js.map → pdf-ocr-VQGNNEFT.js.map} +0 -0
- /package/dist/{profile-io-IOVBPV7R.js.map → profile-io-AEG7M5KV.js.map} +0 -0
- /package/dist/{rasterize-ZJZKZF5R.js.map → rasterize-2TX6CRQY.js.map} +0 -0
- /package/dist/{redact-doc-NPMUDPQZ.js.map → redact-doc-UWXE2D52.js.map} +0 -0
- /package/dist/{render-F43PBJAG.js.map → render-3TPZAAY3.js.map} +0 -0
- /package/dist/{rewrite-fallback-RITELBHU.js.map → rewrite-fallback-FVI3MVUH.js.map} +0 -0
- /package/dist/{seal-BEVAF3RV.js.map → seal-ZNN4P4IN.js.map} +0 -0
- /package/dist/{setup-J7I3KFRD.js.map → setup-5SZWEMHX.js.map} +0 -0
- /package/dist/{to-hwpx-6JBBYURE.js.map → to-hwpx-KVCLOFIT.js.map} +0 -0
- /package/dist/{to-hwpx-M7W7O47H.js.map → to-hwpx-UNNR4Y7K.js.map} +0 -0
- /package/dist/{visual-EG4OBDUG.js.map → visual-UDZERIUK.js.map} +0 -0
- /package/dist/{watch-YILY6776.js.map → watch-YCNXUIJL.js.map} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk42P53WKDcjs = require('./chunk-42P53WKD.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -71,11 +71,11 @@ var _chunkHHLZQQNLcjs = require('./chunk-HHLZQQNL.cjs');
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
var
|
|
74
|
+
var _chunkCKVPN66Tcjs = require('./chunk-CKVPN66T.cjs');
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
var _chunkMMK32GPDcjs = require('./chunk-MMK32GPD.cjs');
|
|
78
|
-
require('./chunk-
|
|
78
|
+
require('./chunk-BJ365LX3.cjs');
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
|
|
@@ -92,11 +92,11 @@ require('./chunk-7BAKREYA.cjs');
|
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
|
|
95
|
-
var
|
|
95
|
+
var _chunk22L7WGJEcjs = require('./chunk-22L7WGJE.cjs');
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
|
|
99
|
-
var
|
|
99
|
+
var _chunkUP3KRRVNcjs = require('./chunk-UP3KRRVN.cjs');
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -429,7 +429,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
|
|
|
429
429
|
let pristine;
|
|
430
430
|
let paintIndex = -1;
|
|
431
431
|
const regions = state.placement ? /* @__PURE__ */ new Map() : void 0;
|
|
432
|
-
if (regions)
|
|
432
|
+
if (regions) _chunkCKVPN66Tcjs.extractImageRegions.call(void 0, fnArray, argsArray, false, regions);
|
|
433
433
|
const placed = (block, i) => {
|
|
434
434
|
const r = _optionalChain([regions, 'optionalAccess', _4 => _4.get, 'call', _5 => _5(i)]);
|
|
435
435
|
if (r) block.bbox = { page: pageNumber, x: r.x1, y: r.y1, width: r.x2 - r.x1, height: r.y2 - r.y1 };
|
|
@@ -511,7 +511,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
|
|
|
511
511
|
if (state.seen.has(hash)) continue;
|
|
512
512
|
const rgba = toRgba(imgData, withBytes || !!readQr || state.dropBlank);
|
|
513
513
|
if (!rgba) continue;
|
|
514
|
-
if (state.dropBlank &&
|
|
514
|
+
if (state.dropBlank && _chunk42P53WKDcjs.isBlankRgba.call(void 0, rgba)) {
|
|
515
515
|
state.seen.set(hash, "");
|
|
516
516
|
continue;
|
|
517
517
|
}
|
|
@@ -611,7 +611,7 @@ async function extractPdfiumImage(image, pageNumber, state, warnings, withBytes,
|
|
|
611
611
|
const hash = `${w}x${h}kPh${contentHash(rgba)}`;
|
|
612
612
|
state.rawKeys.set(image.raw, hash);
|
|
613
613
|
if (state.seen.has(hash)) return null;
|
|
614
|
-
if (state.dropBlank &&
|
|
614
|
+
if (state.dropBlank && _chunk42P53WKDcjs.isBlankRgba.call(void 0, rgba)) {
|
|
615
615
|
state.seen.set(hash, "");
|
|
616
616
|
return null;
|
|
617
617
|
}
|
|
@@ -1059,13 +1059,13 @@ function ocrVectorOps(opList, paths) {
|
|
|
1059
1059
|
|
|
1060
1060
|
// src/pdf/split-row-pattern.ts
|
|
1061
1061
|
var textOf = (cell) => cell.text.replace(/<\/?u>|~~/g, "").trim();
|
|
1062
|
-
var plain = (cell) => !_optionalChain([cell, 'access', _31 => _31.blocks, 'optionalAccess', _32 => _32.length]) && !
|
|
1062
|
+
var plain = (cell) => !_optionalChain([cell, 'access', _31 => _31.blocks, 'optionalAccess', _32 => _32.length]) && !_chunkCKVPN66Tcjs.IMAGE_CELLS.has(cell);
|
|
1063
1063
|
var labelsOf = (cell) => {
|
|
1064
1064
|
const labels = textOf(cell).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
1065
1065
|
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;
|
|
1066
1066
|
};
|
|
1067
1067
|
var alignedLabels = (label, value, count) => {
|
|
1068
|
-
const L =
|
|
1068
|
+
const L = _chunkCKVPN66Tcjs.CELL_LINES.get(label), V = _chunkCKVPN66Tcjs.CELL_LINES.get(value);
|
|
1069
1069
|
let next = 0;
|
|
1070
1070
|
return !!L && !!V && L.length === count && V.length >= count && Math.abs(L[0].y - V[0].y) <= 1 && L.every((l) => {
|
|
1071
1071
|
while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
|
|
@@ -1073,7 +1073,7 @@ var alignedLabels = (label, value, count) => {
|
|
|
1073
1073
|
});
|
|
1074
1074
|
};
|
|
1075
1075
|
function partialAlignedLabelCells(table, owner, first) {
|
|
1076
|
-
const pageOf = (a) => _nullishCoalesce(
|
|
1076
|
+
const pageOf = (a) => _nullishCoalesce(_chunk22L7WGJEcjs.CELL_PAGES.get(_nullishCoalesce(a.cell, () => ( table.cells[a.r][a.c]))), () => ( (a.r < first ? -1 : -2)));
|
|
1077
1077
|
const pairs = [];
|
|
1078
1078
|
let carried = false;
|
|
1079
1079
|
for (let c = 0; c < table.cols; ) {
|
|
@@ -1096,10 +1096,10 @@ function partialAlignedLabelCells(table, owner, first) {
|
|
|
1096
1096
|
const keyed = pairs.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
|
|
1097
1097
|
if (keyed.length !== 1) return;
|
|
1098
1098
|
const label = keyed[0], value = pairs.find((p) => p.c === label.c + label.cs), context = pairs.find((p) => p.c + p.cs === label.c);
|
|
1099
|
-
if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([
|
|
1099
|
+
if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([_chunk22L7WGJEcjs.CELL_EDGES, 'access', _43 => _43.get, 'call', _44 => _44(context.upper), 'optionalAccess', _45 => _45.b]) || !_optionalChain([_chunk22L7WGJEcjs.CELL_EDGES, 'access', _46 => _46.get, 'call', _47 => _47(context.lower), 'optionalAccess', _48 => _48.t])) return;
|
|
1100
1100
|
const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
|
|
1101
1101
|
if (D.length < 2 || sequence.length < 3 || new Set(sequence).size !== sequence.length || !alignedLabels(label.upper, value.upper, U.length)) return;
|
|
1102
|
-
const L =
|
|
1102
|
+
const L = _chunkCKVPN66Tcjs.CELL_LINES.get(label.lower), V = _chunkCKVPN66Tcjs.CELL_LINES.get(value.lower);
|
|
1103
1103
|
if (!L || !V || L.length !== D.length) return;
|
|
1104
1104
|
let next = V.findIndex((v) => Math.abs(v.y - L[0].y) <= 1);
|
|
1105
1105
|
if (next <= 0 || !V.slice(0, next).every((v) => v.y > L[0].y + 1) || !L.every((l) => {
|
|
@@ -1119,14 +1119,14 @@ function partialAlignedLabelCells(table, owner, first) {
|
|
|
1119
1119
|
continue;
|
|
1120
1120
|
}
|
|
1121
1121
|
if (list.length < 3 || new Set(list).size !== list.length) continue;
|
|
1122
|
-
const visible = _nullishCoalesce(_optionalChain([
|
|
1122
|
+
const visible = _nullishCoalesce(_optionalChain([_chunkCKVPN66Tcjs.CELL_LINES, 'access', _53 => _53.get, 'call', _54 => _54(lc), 'optionalAccess', _55 => _55.length]), () => ( 0)), values = _chunkCKVPN66Tcjs.CELL_LINES.get(vc);
|
|
1123
1123
|
if (visible < 3 || visible > list.length || !values || !alignedLabels(lc, vc, visible)) continue;
|
|
1124
1124
|
const top = Math.max(...values.map((v2) => v2.y)), bottom = Math.min(...values.map((v2) => v2.y));
|
|
1125
1125
|
const contexts = [];
|
|
1126
1126
|
for (let rr = r; rr < r + l.rs && rr < table.rows; rr++) {
|
|
1127
1127
|
const a = _optionalChain([owner, 'access', _56 => _56[rr], 'optionalAccess', _57 => _57[context.c]]), cell = a ? table.cells[a.r][a.c] : void 0;
|
|
1128
1128
|
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;
|
|
1129
|
-
const lines =
|
|
1129
|
+
const lines = _chunkCKVPN66Tcjs.CELL_LINES.get(cell);
|
|
1130
1130
|
if (!_optionalChain([lines, 'optionalAccess', _58 => _58.length]) || lines.some((line) => line.y > top + 1 || line.y < bottom - 1)) break;
|
|
1131
1131
|
contexts.push(textOf(cell).replace(/\s+/g, ""));
|
|
1132
1132
|
}
|
|
@@ -1428,7 +1428,7 @@ function rowStarts(t) {
|
|
|
1428
1428
|
}
|
|
1429
1429
|
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));
|
|
1430
1430
|
function cellPage(cell) {
|
|
1431
|
-
const p =
|
|
1431
|
+
const p = _chunk22L7WGJEcjs.CELL_PAGES.get(cell);
|
|
1432
1432
|
if (p !== void 0 || !_optionalChain([cell, 'access', _125 => _125.blocks, 'optionalAccess', _126 => _126.length]) || cell.blocks.some((b) => b.pageNumber === void 0)) return p;
|
|
1433
1433
|
return Math.min(...cell.blocks.map((b) => b.pageNumber));
|
|
1434
1434
|
}
|
|
@@ -1457,7 +1457,7 @@ function markJoinedPages(table, prev, curr) {
|
|
|
1457
1457
|
rows.forEach((starts, r) => {
|
|
1458
1458
|
const page2 = r < pt.rows ? pp[r] : cp[r - off];
|
|
1459
1459
|
for (const { cell } of starts) {
|
|
1460
|
-
if (page2 !== void 0 && page2 !== prev.pageNumber)
|
|
1460
|
+
if (page2 !== void 0 && page2 !== prev.pageNumber) _chunk22L7WGJEcjs.CELL_PAGES.set(cell, page2);
|
|
1461
1461
|
const src = _optionalChain([(r < pt.rows ? ptRows[r] : ctRows[r - off]), 'optionalAccess', _129 => _129.find, 'call', _130 => _130((s) => s.cell !== cell && s.cell.text === cell.text && CELL_SPLITS.has(s.cell))]);
|
|
1462
1462
|
if (src) setSplits(cell, relocate(src.cell, cell));
|
|
1463
1463
|
}
|
|
@@ -1517,8 +1517,8 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1517
1517
|
if (!splits.length) continue;
|
|
1518
1518
|
const clone = (cell, patch) => {
|
|
1519
1519
|
const out = { ...cell, ...patch };
|
|
1520
|
-
const p =
|
|
1521
|
-
if (p !== void 0)
|
|
1520
|
+
const p = _chunk22L7WGJEcjs.CELL_PAGES.get(cell);
|
|
1521
|
+
if (p !== void 0) _chunk22L7WGJEcjs.CELL_PAGES.set(out, p);
|
|
1522
1522
|
if (!("text" in patch) && CELL_SPLITS.has(cell)) CELL_SPLITS.set(out, CELL_SPLITS.get(cell));
|
|
1523
1523
|
return out;
|
|
1524
1524
|
};
|
|
@@ -1529,7 +1529,7 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1529
1529
|
for (const { cell, c, split } of splits) {
|
|
1530
1530
|
cells[r][c] = clone(cell, { ...split.head, rowSpan: cut - r });
|
|
1531
1531
|
const tail = { ...cell, ...split.tail, rowSpan: r + cell.rowSpan - cut };
|
|
1532
|
-
|
|
1532
|
+
_chunk22L7WGJEcjs.CELL_PAGES.set(tail, split.page);
|
|
1533
1533
|
setSplits(tail, split.rest);
|
|
1534
1534
|
cells[cut][c] = tail;
|
|
1535
1535
|
}
|
|
@@ -1539,7 +1539,7 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1539
1539
|
for (const { cell, c, split } of splits) {
|
|
1540
1540
|
cells[r][c] = clone(cell, split.head);
|
|
1541
1541
|
const tail = { ...cell, ...split.tail, rowSpan: 1 };
|
|
1542
|
-
|
|
1542
|
+
_chunk22L7WGJEcjs.CELL_PAGES.set(tail, split.page);
|
|
1543
1543
|
setSplits(tail, split.rest);
|
|
1544
1544
|
row[c] = tail;
|
|
1545
1545
|
}
|
|
@@ -1630,7 +1630,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1630
1630
|
if (cols < 1) return null;
|
|
1631
1631
|
const pa = anchorsOf(prev), ca = anchorsOf(curr);
|
|
1632
1632
|
const cutOpen = (() => {
|
|
1633
|
-
const u =
|
|
1633
|
+
const u = _chunkCKVPN66Tcjs.ROW_RULES.get(prev), d = _chunkCKVPN66Tcjs.ROW_RULES.get(curr);
|
|
1634
1634
|
return !!u && !!d && !u.bottom && !d.top;
|
|
1635
1635
|
})();
|
|
1636
1636
|
let skip = 0, head = 0;
|
|
@@ -1662,19 +1662,19 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1662
1662
|
if (r + dr < rows) owner[r + dr][dc] = placed;
|
|
1663
1663
|
}
|
|
1664
1664
|
grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
|
|
1665
|
-
const lines =
|
|
1666
|
-
if (lines)
|
|
1667
|
-
if (
|
|
1668
|
-
const edges =
|
|
1665
|
+
const lines = _chunkCKVPN66Tcjs.CELL_LINES.get(a.cell);
|
|
1666
|
+
if (lines) _chunkCKVPN66Tcjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
|
|
1667
|
+
if (_chunkCKVPN66Tcjs.IMAGE_CELLS.has(a.cell)) _chunkCKVPN66Tcjs.IMAGE_CELLS.add(grid[r][c1]);
|
|
1668
|
+
const edges = _chunk22L7WGJEcjs.CELL_EDGES.get(a.cell);
|
|
1669
1669
|
if (edges) {
|
|
1670
|
-
|
|
1670
|
+
_chunk22L7WGJEcjs.CELL_EDGES.set(grid[r][c1], edges);
|
|
1671
1671
|
edged = true;
|
|
1672
1672
|
}
|
|
1673
1673
|
return true;
|
|
1674
1674
|
};
|
|
1675
|
-
for (const a of pa) if (!
|
|
1675
|
+
for (const a of pa) if (!_chunkCKVPN66Tcjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
|
|
1676
1676
|
for (const a of ca) {
|
|
1677
|
-
if (a.r < skip ||
|
|
1677
|
+
if (a.r < skip || _chunkCKVPN66Tcjs.FILLER_CELLS.has(a.cell)) continue;
|
|
1678
1678
|
if (!place(a, cxU, prev.rows - skip, dx)) return null;
|
|
1679
1679
|
}
|
|
1680
1680
|
const first = prev.rows;
|
|
@@ -1698,9 +1698,9 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1698
1698
|
const grown = { ...above, rs: newRs };
|
|
1699
1699
|
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;
|
|
1700
1700
|
}
|
|
1701
|
-
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null)
|
|
1701
|
+
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkCKVPN66Tcjs.FILLER_CELLS.add(grid[r][c]);
|
|
1702
1702
|
if (edged) {
|
|
1703
|
-
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null)
|
|
1703
|
+
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunk22L7WGJEcjs.CELL_EDGES.set(grid[r][c], _chunkCKVPN66Tcjs.NO_EDGES);
|
|
1704
1704
|
}
|
|
1705
1705
|
for (let c = 0; c < cols && U[c + 1] <= pcx[0] + PART_COL_TOL; c++) {
|
|
1706
1706
|
let r = prev.rows;
|
|
@@ -1709,7 +1709,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1709
1709
|
for (let rr = 0; rr < r; rr++) owner[rr][c] = through;
|
|
1710
1710
|
}
|
|
1711
1711
|
const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
|
|
1712
|
-
const pr =
|
|
1712
|
+
const pr = _chunkCKVPN66Tcjs.ROW_RULES.get(prev), cr = _chunkCKVPN66Tcjs.ROW_RULES.get(curr);
|
|
1713
1713
|
const shifted = dx !== 0;
|
|
1714
1714
|
const cut = {
|
|
1715
1715
|
open: !!pr && !!cr && !pr.bottom && !cr.top && pr.innerOpen + cr.innerOpen === 0 && pr.innerRuled + cr.innerRuled > 0,
|
|
@@ -1717,13 +1717,13 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1717
1717
|
list: !shifted ? "any" : skip > 0 && ca.filter((a) => a.r < skip && a.cell.text.trim()).length < 2 ? "none" : "multi"
|
|
1718
1718
|
};
|
|
1719
1719
|
let partial = !skip && cols === prev.cols && cols === curr.cols && cut.ruled && prevBottom !== void 0 ? partialAlignedLabelCells(table, owner, first) : void 0;
|
|
1720
|
-
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]) ||
|
|
1720
|
+
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]) || _chunkCKVPN66Tcjs.startsNewItem.call(void 0, partial.value.upper.text, partial.value.lower.text))) partial = void 0;
|
|
1721
1721
|
const selected = partial ? /* @__PURE__ */ new Set([partial.label.c, partial.value.c]) : void 0;
|
|
1722
1722
|
let split = !selected && rows > prev.rows && mergeSplitRow(table, owner, prev.rows, U, false, cut);
|
|
1723
1723
|
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 });
|
|
1724
1724
|
if (pr && cr) {
|
|
1725
1725
|
const cutRuled = pr.bottom || cr.top;
|
|
1726
|
-
|
|
1726
|
+
_chunkCKVPN66Tcjs.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) });
|
|
1727
1727
|
}
|
|
1728
1728
|
return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
|
|
1729
1729
|
}
|
|
@@ -1785,18 +1785,18 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selec
|
|
|
1785
1785
|
if (!d || d === u || u.r + u.rs - 1 !== last || d.r !== first || d.c !== u.c || d.cs !== u.cs) continue;
|
|
1786
1786
|
const a = table.cells[u.r][u.c], b = table.cells[first][d.c];
|
|
1787
1787
|
if (selected && !selected.has(u.c)) continue;
|
|
1788
|
-
const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !
|
|
1789
|
-
const openSeam = hasContent(a) && hasContent(b) &&
|
|
1788
|
+
const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !_chunkCKVPN66Tcjs.startsNewItem.call(void 0, a.text, b.text) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs]);
|
|
1789
|
+
const openSeam = hasContent(a) && hasContent(b) && _chunkCKVPN66Tcjs.hasOpenCellSeam.call(void 0, a, b) && !owner.some((row, r) => {
|
|
1790
1790
|
if (!r || r === first) return false;
|
|
1791
1791
|
const up = owner[r - 1][u.c], down = row[u.c];
|
|
1792
1792
|
if (!up || !down || up === down || up.c !== u.c || down.c !== u.c || up.cs !== u.cs || down.cs !== u.cs) return false;
|
|
1793
|
-
const ue =
|
|
1793
|
+
const ue = _chunk22L7WGJEcjs.CELL_EDGES.get(table.cells[up.r][up.c]), de = _chunk22L7WGJEcjs.CELL_EDGES.get(table.cells[down.r][down.c]);
|
|
1794
1794
|
return !!ue && !!de && !ue.b && !de.t;
|
|
1795
1795
|
});
|
|
1796
1796
|
if (!selected && !openSeam && !flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
|
|
1797
1797
|
if (!straddles && !midWord) continue;
|
|
1798
1798
|
if (u.r >= last && d.rs < 2) continue;
|
|
1799
|
-
const U =
|
|
1799
|
+
const U = _chunkCKVPN66Tcjs.CELL_LINES.get(a);
|
|
1800
1800
|
if (!_optionalChain([U, 'optionalAccess', _156 => _156.length]) || !hasContent(b)) continue;
|
|
1801
1801
|
if (!(straddles && filledToBottom(U, prevBottom) && clauseContinues(a, b))) {
|
|
1802
1802
|
if (U.length > STRADDLE_MAX_LINES) continue;
|
|
@@ -1814,7 +1814,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selec
|
|
|
1814
1814
|
return merged;
|
|
1815
1815
|
}
|
|
1816
1816
|
function longLastLine(c) {
|
|
1817
|
-
const L =
|
|
1817
|
+
const L = _chunkCKVPN66Tcjs.CELL_LINES.get(c), l = _optionalChain([L, 'optionalAccess', _157 => _157[L.length - 1]]);
|
|
1818
1818
|
return !!l && l.r - l.l >= 6 * (l.h || 10);
|
|
1819
1819
|
}
|
|
1820
1820
|
function filledToBottom(U, bottom) {
|
|
@@ -1847,7 +1847,7 @@ function nextItemHead(prev, next) {
|
|
|
1847
1847
|
return false;
|
|
1848
1848
|
}
|
|
1849
1849
|
function continuesAcross(u, d, x1, x2) {
|
|
1850
|
-
const U =
|
|
1850
|
+
const U = _chunkCKVPN66Tcjs.CELL_LINES.get(u), D = _chunkCKVPN66Tcjs.CELL_LINES.get(d);
|
|
1851
1851
|
if (!_optionalChain([U, 'optionalAccess', _158 => _158.length]) || !_optionalChain([D, 'optionalAccess', _159 => _159.length])) return false;
|
|
1852
1852
|
const last = U[U.length - 1];
|
|
1853
1853
|
const fs = last.h || 10;
|
|
@@ -1865,7 +1865,7 @@ function continuesAcross(u, d, x1, x2) {
|
|
|
1865
1865
|
if (U.length === 1 && x2 - last.r > Math.max(FULL_LINE_EDGE_MIN, SINGLE_LINE_WORD_GAP * fs)) return false;
|
|
1866
1866
|
const indented = last.l - minL >= HANGING_MIN * fs;
|
|
1867
1867
|
if (last.r - last.l < FULL_LINE_MIN_FRAC * (indented ? x2 - last.l : x2 - x1)) return false;
|
|
1868
|
-
const newItem =
|
|
1868
|
+
const newItem = _chunkCKVPN66Tcjs.startsNewItem.call(void 0, u.text, d.text);
|
|
1869
1869
|
const all = D.length ? U.concat(D) : U;
|
|
1870
1870
|
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));
|
|
1871
1871
|
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;
|
|
@@ -1882,10 +1882,10 @@ function outlineContinues(u, d) {
|
|
|
1882
1882
|
return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
|
|
1883
1883
|
}
|
|
1884
1884
|
function lineEnded(c, x1, x2, next) {
|
|
1885
|
-
const L =
|
|
1885
|
+
const L = _chunkCKVPN66Tcjs.CELL_LINES.get(c);
|
|
1886
1886
|
if (!L || L.length !== 1) return false;
|
|
1887
1887
|
const l = L[0], h = l.h || 10;
|
|
1888
|
-
const d0 = next ? _optionalChain([
|
|
1888
|
+
const d0 = next ? _optionalChain([_chunkCKVPN66Tcjs.CELL_LINES, 'access', _160 => _160.get, 'call', _161 => _161(next), 'optionalAccess', _162 => _162[0]]) : void 0;
|
|
1889
1889
|
if (d0 && d0.l - l.l >= HANGING_MIN * h) return false;
|
|
1890
1890
|
return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _163 => _163.text]), () => ( "")))) * h;
|
|
1891
1891
|
}
|
|
@@ -1896,15 +1896,15 @@ function firstWordUnits(text) {
|
|
|
1896
1896
|
return units;
|
|
1897
1897
|
}
|
|
1898
1898
|
function appendCell(a, b) {
|
|
1899
|
-
if (
|
|
1899
|
+
if (_chunkCKVPN66Tcjs.IMAGE_CELLS.has(b)) _chunkCKVPN66Tcjs.IMAGE_CELLS.add(a);
|
|
1900
1900
|
if (_optionalChain([a, 'access', _164 => _164.blocks, 'optionalAccess', _165 => _165.length]) || _optionalChain([b, 'access', _166 => _166.blocks, 'optionalAccess', _167 => _167.length])) {
|
|
1901
1901
|
const asBlocks = (c) => _optionalChain([c, 'access', _168 => _168.blocks, 'optionalAccess', _169 => _169.length]) ? c.blocks : c.text.split("\n").map((l) => l.trim()).filter(Boolean).map((text) => ({ type: "paragraph", text }));
|
|
1902
1902
|
a.blocks = [...asBlocks(a), ...asBlocks(b)];
|
|
1903
1903
|
}
|
|
1904
1904
|
if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
|
|
1905
|
-
|
|
1905
|
+
_chunkCKVPN66Tcjs.joinCellEdges.call(void 0, a, b);
|
|
1906
1906
|
}
|
|
1907
|
-
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _170 => _170.blocks, 'optionalAccess', _171 => _171.length]) ||
|
|
1907
|
+
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _170 => _170.blocks, 'optionalAccess', _171 => _171.length]) || _chunkCKVPN66Tcjs.IMAGE_CELLS.has(cell);
|
|
1908
1908
|
var CLAUSE_OPEN_ENDING = /(?:하는|되는|하고|하며|하여|되어|되고|되며|이며|으며|어야|아야|여야)$/;
|
|
1909
1909
|
var batchim = (ch) => {
|
|
1910
1910
|
const k = ch.charCodeAt(0) - 44032;
|
|
@@ -1912,7 +1912,7 @@ var batchim = (ch) => {
|
|
|
1912
1912
|
};
|
|
1913
1913
|
function clauseContinues(u, d) {
|
|
1914
1914
|
const tail = _nullishCoalesce(flowText(u.text).trim().split(/\s+/).pop(), () => ( "")), head = flowText(d.text).trim();
|
|
1915
|
-
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) ||
|
|
1915
|
+
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkCKVPN66Tcjs.startsNewItem.call(void 0, u.text, head)) return false;
|
|
1916
1916
|
const last = tail[tail.length - 1], before = tail[tail.length - 2];
|
|
1917
1917
|
return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
|
|
1918
1918
|
}
|
|
@@ -1920,8 +1920,8 @@ function quantityContinues(u, d) {
|
|
|
1920
1920
|
return /\d[\d,.]*\s*(?:%|[가-힣]{1,2})?$/.test(flowText(u.text).trim()) && /^(?:미만|이상|이하|초과)(?![가-힣])/.test(flowText(d.text).trim());
|
|
1921
1921
|
}
|
|
1922
1922
|
function wordOverflows(u, d, x1, x2) {
|
|
1923
|
-
const U =
|
|
1924
|
-
if (!_optionalChain([U, 'optionalAccess', _172 => _172.length]) ||
|
|
1923
|
+
const U = _chunkCKVPN66Tcjs.CELL_LINES.get(u);
|
|
1924
|
+
if (!_optionalChain([U, 'optionalAccess', _172 => _172.length]) || _chunkCKVPN66Tcjs.startsNewItem.call(void 0, u.text, d.text)) return false;
|
|
1925
1925
|
const last = U[U.length - 1], units = firstWordUnits(d.text);
|
|
1926
1926
|
return units > 0 && last.r - last.l + units * (last.h || 10) > x2 - x1;
|
|
1927
1927
|
}
|
|
@@ -1989,9 +1989,10 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
|
|
|
1989
1989
|
const carriedSplit = !textOnly && carried && !newCell && (contentPairs.length <= 1 || contentPairs.every(([, d]) => d.rs > 1) || !cut.ruled && contentPairs.some(([u, d]) => wordOverflows(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs])));
|
|
1990
1990
|
if (!carriedSplit && !band) {
|
|
1991
1991
|
const norm = (c) => flowText(c.text).replace(/\s+/g, "");
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1992
|
+
const openCut = cut.open && !newCell;
|
|
1993
|
+
if (!openCut && 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;
|
|
1994
|
+
const oneLine = (c) => _optionalChain([_chunkCKVPN66Tcjs.CELL_LINES, 'access', _174 => _174.get, 'call', _175 => _175(c), 'optionalAccess', _176 => _176.length]) === 1;
|
|
1995
|
+
if (!openCut && 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;
|
|
1995
1996
|
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;
|
|
1996
1997
|
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));
|
|
1997
1998
|
if (!(cut.open && !newCell)) {
|
|
@@ -2083,19 +2084,19 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
2083
2084
|
placeJoined(blocks, i, j, joined);
|
|
2084
2085
|
continue;
|
|
2085
2086
|
}
|
|
2086
|
-
if (
|
|
2087
|
+
if (_chunkCKVPN66Tcjs.EMPTY_PARTS.has(curr.table)) {
|
|
2087
2088
|
blocks.splice(j, 1);
|
|
2088
2089
|
i++;
|
|
2089
2090
|
continue;
|
|
2090
2091
|
}
|
|
2091
2092
|
if (joined === null) continue;
|
|
2092
|
-
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable ||
|
|
2093
|
+
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkCKVPN66Tcjs.EMPTY_PARTS.has(prev.table)) continue;
|
|
2093
2094
|
const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
|
|
2094
2095
|
const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
|
|
2095
2096
|
const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
|
|
2096
2097
|
if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) continue;
|
|
2097
|
-
const px =
|
|
2098
|
-
if (px && cx && !shiftedSame(px, cx, !
|
|
2098
|
+
const px = _chunkCKVPN66Tcjs.TABLE_COLXS.get(prev.table), cx = _chunkCKVPN66Tcjs.TABLE_COLXS.get(curr.table);
|
|
2099
|
+
if (px && cx && !shiftedSame(px, cx, !_chunkCKVPN66Tcjs.CLIP_TABLES.has(prev.table) && !_chunkCKVPN66Tcjs.CLIP_TABLES.has(curr.table))) continue;
|
|
2099
2100
|
if (!px !== !cx) continue;
|
|
2100
2101
|
if (!rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
|
|
2101
2102
|
let currCells = curr.table.cells;
|
|
@@ -2107,16 +2108,16 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
2107
2108
|
blocks.splice(j, 1);
|
|
2108
2109
|
continue;
|
|
2109
2110
|
}
|
|
2110
|
-
if (px && cx && !
|
|
2111
|
+
if (px && cx && !_chunkCKVPN66Tcjs.CLIP_TABLES.has(prev.table) && !_chunkCKVPN66Tcjs.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 && _chunkCKVPN66Tcjs.CELL_LINES.has(c))) {
|
|
2111
2112
|
const dx = px[0] - cx[0];
|
|
2112
2113
|
const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
|
|
2113
2114
|
if (_optionalChain([part, 'optionalAccess', _197 => _197.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
|
|
2114
2115
|
const last = prev.table.rows - 1;
|
|
2115
2116
|
for (let c = 0; c < part.table.cols; c++) {
|
|
2116
|
-
const U =
|
|
2117
|
-
|
|
2117
|
+
const U = _chunkCKVPN66Tcjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkCKVPN66Tcjs.CELL_LINES.get(currCells[0][c]);
|
|
2118
|
+
_chunkCKVPN66Tcjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
|
|
2118
2119
|
}
|
|
2119
|
-
|
|
2120
|
+
_chunkCKVPN66Tcjs.TABLE_COLXS.set(part.table, part.colXs);
|
|
2120
2121
|
placeJoined(blocks, i, j, part.table);
|
|
2121
2122
|
continue;
|
|
2122
2123
|
}
|
|
@@ -2129,20 +2130,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
2129
2130
|
caption: prev.table.caption,
|
|
2130
2131
|
...prev.table.renderAsTable ? { renderAsTable: true } : {}
|
|
2131
2132
|
};
|
|
2132
|
-
if (_nullishCoalesce(px, () => ( cx)))
|
|
2133
|
-
if (
|
|
2133
|
+
if (_nullishCoalesce(px, () => ( cx))) _chunkCKVPN66Tcjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
|
|
2134
|
+
if (_chunkCKVPN66Tcjs.CLIP_TABLES.has(prev.table) || _chunkCKVPN66Tcjs.CLIP_TABLES.has(curr.table)) _chunkCKVPN66Tcjs.CLIP_TABLES.add(merged);
|
|
2134
2135
|
placeJoined(blocks, i, j, merged);
|
|
2135
2136
|
}
|
|
2136
2137
|
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
2137
2138
|
const t = blocks[i].table;
|
|
2138
|
-
if (blocks[i].type === "table" && t &&
|
|
2139
|
+
if (blocks[i].type === "table" && t && _chunkCKVPN66Tcjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
|
|
2139
2140
|
}
|
|
2140
2141
|
}
|
|
2141
2142
|
function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
2142
2143
|
if (!pageHeights) return;
|
|
2143
2144
|
for (let i = 0; i < blocks.length; i++) {
|
|
2144
2145
|
const L = blocks[i];
|
|
2145
|
-
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !
|
|
2146
|
+
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkCKVPN66Tcjs.CLIP_TABLES.has(L.table) || _chunkCKVPN66Tcjs.EMPTY_PARTS.has(L.table)) continue;
|
|
2146
2147
|
const ph = pageHeights.get(L.pageNumber);
|
|
2147
2148
|
if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
|
|
2148
2149
|
let s0 = i, s1 = i;
|
|
@@ -2161,8 +2162,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
|
2161
2162
|
if (Math.abs(R.bbox.width - L.bbox.width) > Math.max(R.bbox.width, L.bbox.width) * NEIGHBOR_TABLE_EPSILON) continue;
|
|
2162
2163
|
if (!looksContinued(L, R) || restartsTable(blocks, i, R.table, pageHeights)) continue;
|
|
2163
2164
|
const rt = R.table;
|
|
2164
|
-
if (rt.rows === 1 && rt.cols === 1 && !
|
|
2165
|
-
const px =
|
|
2165
|
+
if (rt.rows === 1 && rt.cols === 1 && !_chunkCKVPN66Tcjs.CLIP_TABLES.has(rt) && L.table.rows >= 2) {
|
|
2166
|
+
const px = _chunkCKVPN66Tcjs.TABLE_COLXS.get(L.table), lb = L.bbox;
|
|
2166
2167
|
const dx = lb.x + lb.width - (R.bbox.x + R.bbox.width);
|
|
2167
2168
|
const last = L.table.cells[L.table.rows - 1];
|
|
2168
2169
|
let col = 0;
|
|
@@ -2191,8 +2192,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
|
2191
2192
|
}
|
|
2192
2193
|
function joinClipParts(prev, curr, pageHeights, lex) {
|
|
2193
2194
|
const pt = prev.table, ct = curr.table;
|
|
2194
|
-
if (!
|
|
2195
|
-
const px =
|
|
2195
|
+
if (!_chunkCKVPN66Tcjs.CLIP_TABLES.has(pt) || !_chunkCKVPN66Tcjs.CLIP_TABLES.has(ct)) return null;
|
|
2196
|
+
const px = _chunkCKVPN66Tcjs.TABLE_COLXS.get(pt), cx = _chunkCKVPN66Tcjs.TABLE_COLXS.get(ct);
|
|
2196
2197
|
if (!px || !cx) return null;
|
|
2197
2198
|
let xs = cx, shifted = false, dx = 0, foreign = false, within = false;
|
|
2198
2199
|
if (!shiftedSame(px, cx, false)) {
|
|
@@ -2208,15 +2209,15 @@ function joinClipParts(prev, curr, pageHeights, lex) {
|
|
|
2208
2209
|
const inner = b.slice(1, -1).map((x) => x + dx);
|
|
2209
2210
|
return inner.length > 0 && !inner.some((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
|
|
2210
2211
|
};
|
|
2211
|
-
foreign = unrelated(cx) && unrelated(_nullishCoalesce(
|
|
2212
|
+
foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkCKVPN66Tcjs.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);
|
|
2212
2213
|
}
|
|
2213
2214
|
const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _202 => _202.bbox, 'optionalAccess', _203 => _203.y]), lex);
|
|
2214
2215
|
if (!res || (shifted || foreign || within) && !res.split && !res.header) return null;
|
|
2215
|
-
|
|
2216
|
-
const ys =
|
|
2217
|
-
if (ys)
|
|
2218
|
-
|
|
2219
|
-
|
|
2216
|
+
_chunkCKVPN66Tcjs.TABLE_COLXS.set(res.table, res.colXs);
|
|
2217
|
+
const ys = _chunkCKVPN66Tcjs.TABLE_ROWYS.get(pt);
|
|
2218
|
+
if (ys) _chunkCKVPN66Tcjs.TABLE_ROWYS.set(res.table, ys);
|
|
2219
|
+
_chunkCKVPN66Tcjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkCKVPN66Tcjs.PART_COLXS.get(pt), () => ( px)));
|
|
2220
|
+
_chunkCKVPN66Tcjs.CLIP_TABLES.add(res.table);
|
|
2220
2221
|
return res.table;
|
|
2221
2222
|
}
|
|
2222
2223
|
function prevLacksLeftCols(prev, px, xs, pageHeights) {
|
|
@@ -2240,12 +2241,12 @@ function looksContinued(prev, curr, pageHeights) {
|
|
|
2240
2241
|
return filled.length >= 2 && filled.every((t) => t === filled[0]);
|
|
2241
2242
|
}
|
|
2242
2243
|
function pushedLead(prev, curr) {
|
|
2243
|
-
if (!
|
|
2244
|
+
if (!_chunkCKVPN66Tcjs.CLIP_TABLES.has(prev.table) || !_chunkCKVPN66Tcjs.CLIP_TABLES.has(curr.table)) return false;
|
|
2244
2245
|
const lead = leadRows(curr.table);
|
|
2245
2246
|
return lead.image && lead.height > prev.bbox.y;
|
|
2246
2247
|
}
|
|
2247
2248
|
function leadRows(t) {
|
|
2248
|
-
const ys =
|
|
2249
|
+
const ys = _chunkCKVPN66Tcjs.TABLE_ROWYS.get(t);
|
|
2249
2250
|
if (!ys || ys.length < 2) return { height: 0, image: false };
|
|
2250
2251
|
const anchors = anchorsOf(t);
|
|
2251
2252
|
let end = 1, image = false;
|
|
@@ -2253,17 +2254,17 @@ function leadRows(t) {
|
|
|
2253
2254
|
for (const a of anchors) {
|
|
2254
2255
|
if (a.r !== r) continue;
|
|
2255
2256
|
end = Math.max(end, r + a.rs);
|
|
2256
|
-
if (
|
|
2257
|
+
if (_chunkCKVPN66Tcjs.IMAGE_CELLS.has(a.cell)) image = true;
|
|
2257
2258
|
}
|
|
2258
2259
|
}
|
|
2259
2260
|
return { height: ys[0] - ys[Math.min(end, ys.length - 1)], image };
|
|
2260
2261
|
}
|
|
2261
2262
|
function tailOf(b) {
|
|
2262
|
-
const t = b.table &&
|
|
2263
|
+
const t = b.table && _chunkCKVPN66Tcjs.TABLE_TAIL.get(b.table);
|
|
2263
2264
|
return t && b.bbox ? { ...b, pageNumber: t.page, bbox: { ...b.bbox, page: t.page, y: t.y, height: t.height } } : b;
|
|
2264
2265
|
}
|
|
2265
2266
|
function firstRowSig(t) {
|
|
2266
|
-
const x =
|
|
2267
|
+
const x = _chunkCKVPN66Tcjs.TABLE_COLXS.get(t);
|
|
2267
2268
|
if (!x || x.length !== t.cols + 1) return null;
|
|
2268
2269
|
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, "") }));
|
|
2269
2270
|
}
|
|
@@ -2316,7 +2317,7 @@ function chainHead(blocks, i, pageHeights) {
|
|
|
2316
2317
|
if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
|
|
2317
2318
|
if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb) || pageNumberBetween(b, pb, cur, pageHeights))) break;
|
|
2318
2319
|
if (!looksContinued(pb, cur, pageHeights)) break;
|
|
2319
|
-
const px =
|
|
2320
|
+
const px = _chunkCKVPN66Tcjs.TABLE_COLXS.get(pb.table), cx = _chunkCKVPN66Tcjs.TABLE_COLXS.get(cur.table);
|
|
2320
2321
|
if (!px || !cx) break;
|
|
2321
2322
|
const dx = px[px.length - 1] - cx[cx.length - 1];
|
|
2322
2323
|
if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL) && !prevLacksLeftCols(pb, px, cx, pageHeights)) break;
|
|
@@ -2387,7 +2388,7 @@ var RESTART_LOOKBACK_PAGES = 5;
|
|
|
2387
2388
|
var COL_MATCH_TOL = 0.5;
|
|
2388
2389
|
var CONTINUED_TABLE_PAGE_BAND = 0.16;
|
|
2389
2390
|
function lastRowCell(t, x1, x2) {
|
|
2390
|
-
const xs =
|
|
2391
|
+
const xs = _chunkCKVPN66Tcjs.TABLE_COLXS.get(t);
|
|
2391
2392
|
const covered = /* @__PURE__ */ new Set();
|
|
2392
2393
|
for (let r = 0; r < t.rows; r++) {
|
|
2393
2394
|
for (let c = 0; c < t.cols; c++) {
|
|
@@ -2405,7 +2406,7 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
|
|
|
2405
2406
|
function mergeContinuedCells(blocks, pageHeights) {
|
|
2406
2407
|
for (let j = blocks.length - 1; j > 0; j--) {
|
|
2407
2408
|
const part = blocks[j];
|
|
2408
|
-
const from = part.table ?
|
|
2409
|
+
const from = part.table ? _chunkCKVPN66Tcjs.CONT_PARTS.get(part.table) : void 0;
|
|
2409
2410
|
if (!from || !part.table) {
|
|
2410
2411
|
unwrapContinuedTable(blocks, j, pageHeights, true);
|
|
2411
2412
|
continue;
|
|
@@ -2421,12 +2422,12 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
2421
2422
|
if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
|
|
2422
2423
|
else if (part.pageNumber) markContinuedText(cell, add, part.pageNumber);
|
|
2423
2424
|
cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
|
|
2424
|
-
if (
|
|
2425
|
-
|
|
2426
|
-
const lines =
|
|
2427
|
-
if (_optionalChain([lines, 'optionalAccess', _227 => _227.length]))
|
|
2428
|
-
if (part.pageNumber && part.bbox)
|
|
2429
|
-
if (cell.text.trim() || _optionalChain([cell, 'access', _228 => _228.blocks, 'optionalAccess', _229 => _229.length]) ||
|
|
2425
|
+
if (_chunkCKVPN66Tcjs.IMAGE_CELLS.has(add)) _chunkCKVPN66Tcjs.IMAGE_CELLS.add(cell);
|
|
2426
|
+
_chunkCKVPN66Tcjs.joinCellEdges.call(void 0, cell, add);
|
|
2427
|
+
const lines = _chunkCKVPN66Tcjs.CELL_LINES.get(add);
|
|
2428
|
+
if (_optionalChain([lines, 'optionalAccess', _227 => _227.length])) _chunkCKVPN66Tcjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkCKVPN66Tcjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
|
|
2429
|
+
if (part.pageNumber && part.bbox) _chunkCKVPN66Tcjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkCKVPN66Tcjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
|
|
2430
|
+
if (cell.text.trim() || _optionalChain([cell, 'access', _228 => _228.blocks, 'optionalAccess', _229 => _229.length]) || _chunkCKVPN66Tcjs.IMAGE_CELLS.has(cell)) _chunkCKVPN66Tcjs.EMPTY_PARTS.delete(prev.table);
|
|
2430
2431
|
blocks.splice(j, 1);
|
|
2431
2432
|
if (cell.blocks && at > 0) {
|
|
2432
2433
|
const nextAt = cell.blocks[at];
|
|
@@ -2438,11 +2439,11 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
2438
2439
|
}
|
|
2439
2440
|
function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
|
|
2440
2441
|
const prev = blocks[at - 1], frame = blocks[at];
|
|
2441
|
-
if (!_optionalChain([prev, 'optionalAccess', _230 => _230.table]) || !_optionalChain([frame, 'optionalAccess', _231 => _231.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !
|
|
2442
|
+
if (!_optionalChain([prev, 'optionalAccess', _230 => _230.table]) || !_optionalChain([frame, 'optionalAccess', _231 => _231.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkCKVPN66Tcjs.CLIP_TABLES.has(frame.table)) return;
|
|
2442
2443
|
const inner = _optionalChain([frame, 'access', _232 => _232.table, 'access', _233 => _233.cells, 'access', _234 => _234[0], 'optionalAccess', _235 => _235[0], 'optionalAccess', _236 => _236.blocks]);
|
|
2443
2444
|
const next = _optionalChain([inner, 'optionalAccess', _237 => _237[0]]);
|
|
2444
|
-
if (!inner || !_optionalChain([next, 'optionalAccess', _238 => _238.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !
|
|
2445
|
-
const px =
|
|
2445
|
+
if (!inner || !_optionalChain([next, 'optionalAccess', _238 => _238.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkCKVPN66Tcjs.CLIP_TABLES.has(prev.table) || !_chunkCKVPN66Tcjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
|
|
2446
|
+
const px = _chunkCKVPN66Tcjs.TABLE_COLXS.get(prev.table), nx = _chunkCKVPN66Tcjs.TABLE_COLXS.get(next.table);
|
|
2446
2447
|
if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
|
|
2447
2448
|
const ph = _optionalChain([pageHeights, 'optionalAccess', _239 => _239.get, 'call', _240 => _240(prev.pageNumber)]), nh = _optionalChain([pageHeights, 'optionalAccess', _241 => _241.get, 'call', _242 => _242(next.pageNumber)]);
|
|
2448
2449
|
if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
|
|
@@ -2452,15 +2453,15 @@ function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
|
|
|
2452
2453
|
function fillNestedContinuation(blocks, at) {
|
|
2453
2454
|
const prev = blocks[at - 1], next = blocks[at];
|
|
2454
2455
|
const t = _optionalChain([prev, 'optionalAccess', _245 => _245.table]), u = _optionalChain([next, 'optionalAccess', _246 => _246.table]);
|
|
2455
|
-
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !
|
|
2456
|
-
const xs =
|
|
2456
|
+
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkCKVPN66Tcjs.CLIP_TABLES.has(t) || !_chunkCKVPN66Tcjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
|
|
2457
|
+
const xs = _chunkCKVPN66Tcjs.TABLE_COLXS.get(u);
|
|
2457
2458
|
const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
|
|
2458
2459
|
const add = _optionalChain([u, 'access', _247 => _247.cells, 'access', _248 => _248[0], 'optionalAccess', _249 => _249[0]]);
|
|
2459
|
-
if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _250 => _250.blocks, 'optionalAccess', _251 => _251.length]) ||
|
|
2460
|
+
if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _250 => _250.blocks, 'optionalAccess', _251 => _251.length]) || _chunkCKVPN66Tcjs.IMAGE_CELLS.has(cell)) return;
|
|
2460
2461
|
cell.text = add.text;
|
|
2461
2462
|
if (add.blocks) cell.blocks = add.blocks;
|
|
2462
|
-
if (
|
|
2463
|
-
|
|
2463
|
+
if (_chunkCKVPN66Tcjs.IMAGE_CELLS.has(add)) _chunkCKVPN66Tcjs.IMAGE_CELLS.add(cell);
|
|
2464
|
+
_chunkCKVPN66Tcjs.joinCellEdges.call(void 0, cell, add);
|
|
2464
2465
|
blocks.splice(at, 1);
|
|
2465
2466
|
}
|
|
2466
2467
|
|
|
@@ -3060,12 +3061,12 @@ function restoreUnmappedGlyphs(items, fnArray, argsArray, fontObj) {
|
|
|
3060
3061
|
}
|
|
3061
3062
|
}
|
|
3062
3063
|
for (const q of queues.values()) for (let k = 0; k < q.length; k++) {
|
|
3063
|
-
const pair = k + 1 < q.length ?
|
|
3064
|
+
const pair = k + 1 < q.length ? _chunk22L7WGJEcjs.pairedNumber.call(void 0, q[k], q[k + 1]) : void 0;
|
|
3064
3065
|
if (pair !== void 0) {
|
|
3065
3066
|
q[k] = pair;
|
|
3066
3067
|
q[k + 1] = "";
|
|
3067
3068
|
k++;
|
|
3068
|
-
} else q[k] =
|
|
3069
|
+
} else q[k] = _chunk22L7WGJEcjs.mapPuaText.call(void 0, q[k]);
|
|
3069
3070
|
}
|
|
3070
3071
|
const byFont = /* @__PURE__ */ new Map();
|
|
3071
3072
|
for (const it of items) {
|
|
@@ -3155,15 +3156,15 @@ function selectionContextPages(selected, pageCount) {
|
|
|
3155
3156
|
function marginContextBlocks(raw, page, view) {
|
|
3156
3157
|
const [x1, y1, x2, y2] = view;
|
|
3157
3158
|
const width = x2 - x1, height = y2 - y1;
|
|
3158
|
-
const items =
|
|
3159
|
+
const items = _chunkCKVPN66Tcjs.filterHiddenText.call(void 0, _chunkCKVPN66Tcjs.normalizeItems.call(void 0, raw), width, height, x1, y1).visible;
|
|
3159
3160
|
for (const item of items) {
|
|
3160
3161
|
item.x -= x1;
|
|
3161
3162
|
item.y -= y1;
|
|
3162
3163
|
}
|
|
3163
|
-
return
|
|
3164
|
-
const bbox =
|
|
3164
|
+
return _chunkCKVPN66Tcjs.groupByY.call(void 0, items).flatMap((line) => {
|
|
3165
|
+
const bbox = _chunkCKVPN66Tcjs.computeBBox.call(void 0, line, page);
|
|
3165
3166
|
if (bbox.y + bbox.height < height * 0.88 && bbox.y > height * 0.12) return [];
|
|
3166
|
-
return [{ type: "paragraph", text:
|
|
3167
|
+
return [{ type: "paragraph", text: _chunkCKVPN66Tcjs.mergeLineSimple.call(void 0, line), pageNumber: page, bbox, style: _chunkCKVPN66Tcjs.dominantStyle.call(void 0, line) }];
|
|
3167
3168
|
});
|
|
3168
3169
|
}
|
|
3169
3170
|
|
|
@@ -3199,7 +3200,7 @@ var WINANSI_REVERSE = {
|
|
|
3199
3200
|
};
|
|
3200
3201
|
function symbolFontTable(fontName) {
|
|
3201
3202
|
if (!fontName) return void 0;
|
|
3202
|
-
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return
|
|
3203
|
+
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunk22L7WGJEcjs.WINGDINGS;
|
|
3203
3204
|
return void 0;
|
|
3204
3205
|
}
|
|
3205
3206
|
function remapSymbolText(text, table) {
|
|
@@ -3432,7 +3433,7 @@ function wrapEquationRuns(items, faceName) {
|
|
|
3432
3433
|
for (const i of members) drop.add(i);
|
|
3433
3434
|
const toks = cur.map((it) => {
|
|
3434
3435
|
const bar2 = isBarItem(it);
|
|
3435
|
-
const text = bar2 ? "" : plain2.has(items.indexOf(it)) ?
|
|
3436
|
+
const text = bar2 ? "" : plain2.has(items.indexOf(it)) ? _chunk22L7WGJEcjs.toTex.call(void 0, it.text) : FUNC_RE.test(it.text.trim()) ? it.text.trim() : [...it.text].map(decodeEq).join("");
|
|
3436
3437
|
return { text, x: it.x, y: it.y, w: it.w, size: sizeOf(it), bar: bar2 };
|
|
3437
3438
|
});
|
|
3438
3439
|
const tex = layout(toks).replace(/\}\\text\{/g, "");
|
|
@@ -3960,8 +3961,9 @@ function joinLoneColumns(items) {
|
|
|
3960
3961
|
// src/pdf/tracked-text.ts
|
|
3961
3962
|
|
|
3962
3963
|
var TRACKED = /^(?:[^\s\u1100-\u11ff\u3130-\u318f\uac00-\ud7a3] ){3,}[^\s\u1100-\u11ff\u3130-\u318f\uac00-\ud7a3]$/;
|
|
3964
|
+
var SPACED_NUMBER = /^(?=[^\d]*\d)(?=\S* )[\d\s\-().·,☎]+$/;
|
|
3963
3965
|
function restoreTrackedSpacing(items, fnArray, argsArray) {
|
|
3964
|
-
if (!items.some((it) => TRACKED.test(_nullishCoalesce(it.str, () => ( ""))))) return 0;
|
|
3966
|
+
if (!items.some((it) => TRACKED.test(_nullishCoalesce(it.str, () => ( ""))) || SPACED_NUMBER.test((_nullishCoalesce(it.str, () => ( ""))).trim()))) return 0;
|
|
3965
3967
|
const streams = /* @__PURE__ */ new Map();
|
|
3966
3968
|
const saved = [];
|
|
3967
3969
|
let font = "";
|
|
@@ -4007,6 +4009,10 @@ function restoreTrackedSpacing(items, fnArray, argsArray) {
|
|
|
4007
4009
|
it.str = rebuilt;
|
|
4008
4010
|
changed++;
|
|
4009
4011
|
}
|
|
4012
|
+
} else if (SPACED_NUMBER.test(it.str.trim()) && /\S\s+\S/.test(text)) {
|
|
4013
|
+
it.str = text.replace(/\s+/g, " ").trim();
|
|
4014
|
+
it.glyphSpaced = true;
|
|
4015
|
+
changed++;
|
|
4010
4016
|
}
|
|
4011
4017
|
}
|
|
4012
4018
|
return changed;
|
|
@@ -4343,7 +4349,7 @@ function mergeEnclosedDigits(items) {
|
|
|
4343
4349
|
if (!/^\d\d?$/.test(digits)) continue;
|
|
4344
4350
|
const mid = (inside2[0].x + inside2[inside2.length - 1].x + inside2[inside2.length - 1].w) / 2;
|
|
4345
4351
|
if (Math.abs(mid - (s.x + s.w / 2)) > s.fontSize * 0.15) continue;
|
|
4346
|
-
s.text =
|
|
4352
|
+
s.text = _chunk22L7WGJEcjs.enclosedNumber.call(void 0, Number(digits));
|
|
4347
4353
|
for (const d of inside2) drop.add(d);
|
|
4348
4354
|
}
|
|
4349
4355
|
if (!drop.size) return;
|
|
@@ -4540,7 +4546,7 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
|
|
|
4540
4546
|
if (block.type !== "heading" || !block.text) continue;
|
|
4541
4547
|
const text = block.text.replace(/<[^>]+>/g, "").trim();
|
|
4542
4548
|
const fsz = _nullishCoalesce(_optionalChain([block, 'access', _335 => _335.style, 'optionalAccess', _336 => _336.fontSize]), () => ( 0));
|
|
4543
|
-
const tocEntry = i > 0 &&
|
|
4549
|
+
const tocEntry = i > 0 && _chunkCKVPN66Tcjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkCKVPN66Tcjs.TOC_BLOCKS.has(blocks[i + 1]);
|
|
4544
4550
|
const page = _nullishCoalesce(byPage.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( []));
|
|
4545
4551
|
const proseStyle = _optionalChain([block, 'access', _337 => _337.style, 'optionalAccess', _338 => _338.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
|
|
4546
4552
|
const next = blocks[i + 1];
|
|
@@ -4638,7 +4644,7 @@ function splitSingleCellTables(blocks) {
|
|
|
4638
4644
|
const out = [];
|
|
4639
4645
|
for (const b of blocks) {
|
|
4640
4646
|
const t = b.type === "table" ? b.table : void 0;
|
|
4641
|
-
const title = t &&
|
|
4647
|
+
const title = t && _chunkCKVPN66Tcjs.FRAME_TITLE_BLOCKS.get(t);
|
|
4642
4648
|
if (title) {
|
|
4643
4649
|
out.push({ ...title, text: `${t.cells[0][0].text.trim()} ${t.cells[0][2].text.trim()}` });
|
|
4644
4650
|
continue;
|
|
@@ -4674,7 +4680,7 @@ function joinLatinCellWraps(blocks) {
|
|
|
4674
4680
|
const lines = cell.text.split("\n");
|
|
4675
4681
|
const out = [lines[0]];
|
|
4676
4682
|
for (const line of lines.slice(1)) {
|
|
4677
|
-
if (
|
|
4683
|
+
if (_chunkCKVPN66Tcjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
|
|
4678
4684
|
else out.push(line);
|
|
4679
4685
|
}
|
|
4680
4686
|
cell.text = out.join("\n");
|
|
@@ -4694,10 +4700,10 @@ function cleanPdfText(text, opts) {
|
|
|
4694
4700
|
).replace(/^(?!\| ---).*$/gm, (line) => {
|
|
4695
4701
|
if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
|
|
4696
4702
|
if (line.startsWith("|")) {
|
|
4697
|
-
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) =>
|
|
4703
|
+
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkCKVPN66Tcjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
|
|
4698
4704
|
}
|
|
4699
4705
|
const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _418 => _418.exec, 'call', _419 => _419(line), 'optionalAccess', _420 => _420[0]]), () => ( ""));
|
|
4700
|
-
return mark +
|
|
4706
|
+
return mark + _chunkCKVPN66Tcjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
|
|
4701
4707
|
}).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/<(sup|sub)>\s*<\/\1>/g, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
4702
4708
|
}
|
|
4703
4709
|
function startsWithMarker(line) {
|
|
@@ -4729,7 +4735,7 @@ function mergeKoreanLines(text) {
|
|
|
4729
4735
|
continue;
|
|
4730
4736
|
}
|
|
4731
4737
|
if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
|
|
4732
|
-
result[result.length - 1] = prev +
|
|
4738
|
+
result[result.length - 1] = prev + _chunkCKVPN66Tcjs.wrapJoiner.call(void 0, prev, curr) + curr;
|
|
4733
4739
|
} else {
|
|
4734
4740
|
result.push(curr);
|
|
4735
4741
|
}
|
|
@@ -4745,7 +4751,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
4745
4751
|
const wrapped = /* @__PURE__ */ new Set();
|
|
4746
4752
|
for (const a of annots) {
|
|
4747
4753
|
if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
|
|
4748
|
-
const url =
|
|
4754
|
+
const url = _chunkUP3KRRVNcjs.sanitizeHref.call(void 0, a.url);
|
|
4749
4755
|
if (!url) continue;
|
|
4750
4756
|
const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
|
|
4751
4757
|
const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
|
|
@@ -4797,7 +4803,7 @@ function mergeLinkRuns(markdown) {
|
|
|
4797
4803
|
|
|
4798
4804
|
// src/pdf/formula-ocr.ts
|
|
4799
4805
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
4800
|
-
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-
|
|
4806
|
+
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-HECGAXCQ.cjs")));
|
|
4801
4807
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
4802
4808
|
await ensureFormulaModels((p) => {
|
|
4803
4809
|
if (p.phase === "download" && p.total) {
|
|
@@ -4988,13 +4994,13 @@ async function loadPdfWithTimeout(buffer, data) {
|
|
|
4988
4994
|
try {
|
|
4989
4995
|
return await Promise.race([
|
|
4990
4996
|
loadingTask.promise.catch((e) => {
|
|
4991
|
-
if (e instanceof Error && e.name === "PasswordException") throw new (0,
|
|
4997
|
+
if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkUP3KRRVNcjs.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)");
|
|
4992
4998
|
throw e;
|
|
4993
4999
|
}),
|
|
4994
5000
|
new Promise((_, reject) => {
|
|
4995
5001
|
timer = setTimeout(() => {
|
|
4996
5002
|
loadingTask.destroy();
|
|
4997
|
-
reject(new (0,
|
|
5003
|
+
reject(new (0, _chunkUP3KRRVNcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
|
|
4998
5004
|
}, PDF_LOAD_TIMEOUT_MS);
|
|
4999
5005
|
})
|
|
5000
5006
|
]);
|
|
@@ -5005,8 +5011,8 @@ async function loadPdfWithTimeout(buffer, data) {
|
|
|
5005
5011
|
async function parsePdfDocument(buffer, options) {
|
|
5006
5012
|
const formulaBuffer = _optionalChain([options, 'optionalAccess', _421 => _421.formulaOcr]) ? buffer : null;
|
|
5007
5013
|
const ocrOptionError = _chunkMMK32GPDcjs.validateOcrOptions.call(void 0, options);
|
|
5008
|
-
if (ocrOptionError) throw new (0,
|
|
5009
|
-
const autoOcr = _optionalChain([options, 'optionalAccess', _422 => _422.ocr]) === void 0 && await
|
|
5014
|
+
if (ocrOptionError) throw new (0, _chunkUP3KRRVNcjs.KordocError)(ocrOptionError);
|
|
5015
|
+
const autoOcr = _optionalChain([options, 'optionalAccess', _422 => _422.ocr]) === void 0 && await _chunkCKVPN66Tcjs.ocrModelsCached.call(void 0, _chunkCKVPN66Tcjs.resolveOcrModels.call(void 0, options)) && (_optionalChain([options, 'optionalAccess', _423 => _423.ocrRec]) !== "auto" || await _chunkCKVPN66Tcjs.ocrModelsCached.call(void 0, _chunkCKVPN66Tcjs.handwritingFallbackModels.call(void 0, _chunkCKVPN66Tcjs.resolveOcrModels.call(void 0, options))));
|
|
5010
5016
|
const ocrBuffer = _optionalChain([options, 'optionalAccess', _424 => _424.ocr]) || autoOcr ? buffer : null;
|
|
5011
5017
|
const pdfjsData = new Uint8Array(buffer.slice(0));
|
|
5012
5018
|
const blanked = blankLargeImageStreams(pdfjsData);
|
|
@@ -5018,7 +5024,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5018
5024
|
let pristine;
|
|
5019
5025
|
try {
|
|
5020
5026
|
const pageCount = doc.numPages;
|
|
5021
|
-
if (pageCount === 0) throw new (0,
|
|
5027
|
+
if (pageCount === 0) throw new (0, _chunkUP3KRRVNcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
5022
5028
|
const metadata = { pageCount, pageMode: "layout" };
|
|
5023
5029
|
await extractPdfMetadata(doc, metadata);
|
|
5024
5030
|
const blocks = [];
|
|
@@ -5044,8 +5050,8 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5044
5050
|
const encodeWebp = wantWebp ? await _chunkTV7B6DJQcjs.loadWebpEncoder.call(void 0, ) : null;
|
|
5045
5051
|
if (wantWebp && !encodeWebp) warnings.push(_chunkTV7B6DJQcjs.WEBP_UNAVAILABLE);
|
|
5046
5052
|
const imageState = createPdfImageState(pdfium ? { decoder: pdfium, sizes: blanked.sizes, pristine: () => pristine ??= loadPdfWithTimeout(buffer) } : void 0, _nullishCoalesce(encodeWebp, () => ( void 0)), _optionalChain([options, 'optionalAccess', _430 => _430.imagePlacement]) === "flow", !!_optionalChain([options, 'optionalAccess', _431 => _431.dropBlankImages]) && _optionalChain([options, 'optionalAccess', _432 => _432.images]) !== false);
|
|
5047
|
-
const readQr = _optionalChain([options, 'optionalAccess', _433 => _433.qrCodes]) ? await
|
|
5048
|
-
if (_optionalChain([options, 'optionalAccess', _434 => _434.qrCodes]) && !readQr) warnings.push(
|
|
5053
|
+
const readQr = _optionalChain([options, 'optionalAccess', _433 => _433.qrCodes]) ? await _chunk42P53WKDcjs.loadQrReader.call(void 0, ) : null;
|
|
5054
|
+
if (_optionalChain([options, 'optionalAccess', _434 => _434.qrCodes]) && !readQr) warnings.push(_chunk42P53WKDcjs.QR_UNAVAILABLE);
|
|
5049
5055
|
const imageBulletShapes = /* @__PURE__ */ new Map();
|
|
5050
5056
|
const imageArrowDirections = /* @__PURE__ */ new Map();
|
|
5051
5057
|
const extractedImages = [];
|
|
@@ -5054,7 +5060,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5054
5060
|
const hancomPdf = await isHancomPdf(doc);
|
|
5055
5061
|
const preciseGaps = hancomPdf || await isPreciseGapProducer(doc);
|
|
5056
5062
|
const vectorPageOps = /* @__PURE__ */ new Map();
|
|
5057
|
-
const wrapLexicon = new (0,
|
|
5063
|
+
const wrapLexicon = new (0, _chunkCKVPN66Tcjs.WrapLexicon)();
|
|
5058
5064
|
const noteMarks = /* @__PURE__ */ new Map();
|
|
5059
5065
|
const headerContext = [];
|
|
5060
5066
|
if (pageFilter && _optionalChain([options, 'optionalAccess', _435 => _435.removeHeaderFooter]) !== false && pageFilter.size < effectivePageCount) {
|
|
@@ -5106,12 +5112,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5106
5112
|
if (hancomPdf) joinTrackedHangul(rawItems, rawOps.fnArray, rawOps.argsArray);
|
|
5107
5113
|
restoreSoftHyphens();
|
|
5108
5114
|
rawItems.push(...spaceMappedDots(rawOps.fnArray, rawOps.argsArray, (n) => fontObj(n)));
|
|
5109
|
-
const items =
|
|
5115
|
+
const items = _chunkCKVPN66Tcjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
|
|
5110
5116
|
if (!preciseGaps) for (const it of items) {
|
|
5111
5117
|
delete it.fx;
|
|
5112
5118
|
delete it.fw;
|
|
5113
5119
|
}
|
|
5114
|
-
const filtered =
|
|
5120
|
+
const filtered = _chunkCKVPN66Tcjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
|
|
5115
5121
|
const joined = joinVerticalColumns(filtered.visible);
|
|
5116
5122
|
const visible = dropTabLeaderDots(joined);
|
|
5117
5123
|
const hiddenCount = filtered.hiddenCount + occluded.size;
|
|
@@ -5138,7 +5144,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5138
5144
|
} : rawOps;
|
|
5139
5145
|
remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _442 => _442(loadedName), 'optionalAccess', _443 => _443.name]));
|
|
5140
5146
|
remapControlGlyphs(visible, differencesOf);
|
|
5141
|
-
await
|
|
5147
|
+
await _chunkCKVPN66Tcjs.restoreImageBullets.call(void 0, visible, page, opList.fnArray, opList.argsArray, imageBulletShapes);
|
|
5142
5148
|
const faces = /* @__PURE__ */ new Map();
|
|
5143
5149
|
for (const it of visible) {
|
|
5144
5150
|
if (!it.fontName) continue;
|
|
@@ -5151,12 +5157,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5151
5157
|
it.fontName = face;
|
|
5152
5158
|
if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _445 => _445(face), 'optionalAccess', _446 => _446.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
|
|
5153
5159
|
}
|
|
5154
|
-
for (const it of visible) if (it.text.includes("$")) it.text =
|
|
5155
|
-
for (const it of visible) if (it.text.includes("<")) it.text =
|
|
5160
|
+
for (const it of visible) if (it.text.includes("$")) it.text = _chunk22L7WGJEcjs.escapeLiteralDollar.call(void 0, it.text);
|
|
5161
|
+
for (const it of visible) if (it.text.includes("<")) it.text = _chunk22L7WGJEcjs.escapeLiteralTags.call(void 0, it.text);
|
|
5156
5162
|
wrapEquationRuns(visible, (face) => faceNames.get(face));
|
|
5157
5163
|
const pageArea = pageW * pageH;
|
|
5158
5164
|
if (pageArea > 0) {
|
|
5159
|
-
const imageRegions =
|
|
5165
|
+
const imageRegions = _chunkCKVPN66Tcjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
|
|
5160
5166
|
let uncovered = 0;
|
|
5161
5167
|
for (const r of imageRegions) {
|
|
5162
5168
|
const area = (r.x2 - r.x1) * (r.y2 - r.y1);
|
|
@@ -5183,11 +5189,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5183
5189
|
if (uncovered > 0) skippedImagePages.set(i, uncovered);
|
|
5184
5190
|
}
|
|
5185
5191
|
const marks = superscriptNoteMarks(visible);
|
|
5186
|
-
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(
|
|
5192
|
+
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkCKVPN66Tcjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
|
|
5187
5193
|
const stamp = marginStamp(visible);
|
|
5188
5194
|
const flow = stamp.length ? visible.filter((it) => !stamp.includes(it)) : visible;
|
|
5189
|
-
const rightArrows = _optionalChain([options, 'optionalAccess', _447 => _447.tables]) !== false ? await
|
|
5190
|
-
const pageBlocks = orderTwoUpPage(
|
|
5195
|
+
const rightArrows = _optionalChain([options, 'optionalAccess', _447 => _447.tables]) !== false ? await _chunkCKVPN66Tcjs.detectRightArrowRegions.call(void 0, page, opList.fnArray, opList.argsArray, imageArrowDirections) : [];
|
|
5196
|
+
const pageBlocks = orderTwoUpPage(_chunkCKVPN66Tcjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _448 => _448.tables]) !== false, carry, wrapLexicon, rightArrows), pageW, pageH);
|
|
5191
5197
|
if (stamp.length) pageBlocks.unshift({ type: "paragraph", text: [...stamp].sort((a, b) => a.y - b.y).map((it) => it.text).join(" "), pageNumber: i });
|
|
5192
5198
|
for (const b of pageBlocks) blocks.push(b);
|
|
5193
5199
|
try {
|
|
@@ -5213,11 +5219,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5213
5219
|
if (_optionalChain([options, 'optionalAccess', _450 => _450.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
|
|
5214
5220
|
vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
|
|
5215
5221
|
}
|
|
5216
|
-
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0,
|
|
5222
|
+
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkUP3KRRVNcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
|
|
5217
5223
|
parsedPages++;
|
|
5218
5224
|
_optionalChain([options, 'optionalAccess', _451 => _451.onProgress, 'optionalCall', _452 => _452(parsedPages, totalTarget)]);
|
|
5219
5225
|
} catch (pageErr) {
|
|
5220
|
-
if (pageErr instanceof
|
|
5226
|
+
if (pageErr instanceof _chunkUP3KRRVNcjs.KordocError) throw pageErr;
|
|
5221
5227
|
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" });
|
|
5222
5228
|
} finally {
|
|
5223
5229
|
_optionalChain([loadedPage, 'optionalAccess', _453 => _453.cleanup, 'call', _454 => _454()]);
|
|
@@ -5248,12 +5254,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5248
5254
|
}
|
|
5249
5255
|
if (targets.size > 0) {
|
|
5250
5256
|
try {
|
|
5251
|
-
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
5257
|
+
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-VKZPLCS7.cjs")));
|
|
5252
5258
|
const mode = typeof _optionalChain([options, 'optionalAccess', _459 => _459.ocr]) === "function" ? options.ocr : "builtin";
|
|
5253
5259
|
const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _460 => _460.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _461 => _461.find, 'call', _462 => _462((q) => q.page === p), 'optionalAccess', _463 => _463.needsOcr])));
|
|
5254
|
-
const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
5260
|
+
const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-VKZPLCS7.cjs")));
|
|
5255
5261
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _464 => _464.onProgress]), _optionalChain([options, 'optionalAccess', _465 => _465.tables]) !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
|
|
5256
|
-
for (const obs of ocrPageBlocks.values())
|
|
5262
|
+
for (const obs of ocrPageBlocks.values()) _chunk22L7WGJEcjs.stripScriptTags.call(void 0, { blocks: obs });
|
|
5257
5263
|
if (ocrPageBlocks.size > 0) {
|
|
5258
5264
|
const replacePages = /* @__PURE__ */ new Set();
|
|
5259
5265
|
for (const [p, obs] of ocrPageBlocks) {
|
|
@@ -5264,7 +5270,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5264
5270
|
continue;
|
|
5265
5271
|
}
|
|
5266
5272
|
const regions = ocrRegions.get(p);
|
|
5267
|
-
if (!regions ||
|
|
5273
|
+
if (!regions || _chunkCKVPN66Tcjs.mergeOcrImageRegions.call(void 0, blocks, p, regions, obs) === 0) continue;
|
|
5268
5274
|
ocrDone.add(p);
|
|
5269
5275
|
if (_optionalChain([pageImageBlocks, 'access', _470 => _470.get, 'call', _471 => _471(p), 'optionalAccess', _472 => _472.length]) === 1) pageImageBlocks.delete(p);
|
|
5270
5276
|
}
|
|
@@ -5317,17 +5323,17 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5317
5323
|
}
|
|
5318
5324
|
}
|
|
5319
5325
|
if (_optionalChain([options, 'optionalAccess', _473 => _473.removeHeaderFooter]) !== false && (parsedPageCount >= 3 || headerContext.length)) {
|
|
5320
|
-
const removed =
|
|
5321
|
-
const running =
|
|
5326
|
+
const removed = _chunkCKVPN66Tcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, false, headerContext);
|
|
5327
|
+
const running = _chunkCKVPN66Tcjs.runningLinePatterns.call(void 0, removed.map((ri) => blocks[ri]), pageHeights);
|
|
5322
5328
|
for (let ri = removed.length - 1; ri >= 0; ri--) {
|
|
5323
5329
|
blocks.splice(removed[ri], 1);
|
|
5324
5330
|
}
|
|
5325
|
-
const stripped =
|
|
5331
|
+
const stripped = _chunkCKVPN66Tcjs.stripAbsorbedRunningLines.call(void 0, blocks, pageHeights, running);
|
|
5326
5332
|
if (stripped !== blocks) {
|
|
5327
5333
|
blocks.length = 0;
|
|
5328
5334
|
blocks.push(...stripped);
|
|
5329
5335
|
}
|
|
5330
|
-
const kept =
|
|
5336
|
+
const kept = _chunkCKVPN66Tcjs.removeSideTabs.call(void 0, blocks, pageWidths);
|
|
5331
5337
|
if (kept !== blocks) {
|
|
5332
5338
|
blocks.length = 0;
|
|
5333
5339
|
blocks.push(...kept);
|
|
@@ -5336,12 +5342,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5336
5342
|
mergeContinuedCells(blocks, pageHeights);
|
|
5337
5343
|
mergeCrossPageTables(blocks, pageHeights, wrapLexicon);
|
|
5338
5344
|
if (_optionalChain([options, 'optionalAccess', _474 => _474.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
|
|
5339
|
-
const boxes =
|
|
5345
|
+
const boxes = _chunkCKVPN66Tcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
|
|
5340
5346
|
for (let ri = boxes.length - 1; ri >= 0; ri--) blocks.splice(boxes[ri], 1);
|
|
5341
5347
|
}
|
|
5342
5348
|
splitContactTables(blocks);
|
|
5343
|
-
if (!_optionalChain([options, 'optionalAccess', _475 => _475.keepTrailingEmptyCols]))
|
|
5344
|
-
|
|
5349
|
+
if (!_optionalChain([options, 'optionalAccess', _475 => _475.keepTrailingEmptyCols])) _chunkCKVPN66Tcjs.trimTrailingEmptyTableCols.call(void 0, blocks);
|
|
5350
|
+
_chunkCKVPN66Tcjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
|
|
5345
5351
|
await flushPdfImages(imageState, warnings, pageImageBlocks);
|
|
5346
5352
|
injectPageImageBlocks(blocks, pageImageBlocks);
|
|
5347
5353
|
if (_optionalChain([options, 'optionalAccess', _476 => _476.formulaOcr]) && formulaBuffer) {
|
|
@@ -5354,21 +5360,21 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5354
5360
|
});
|
|
5355
5361
|
}
|
|
5356
5362
|
}
|
|
5357
|
-
const medianFontSize =
|
|
5363
|
+
const medianFontSize = _chunkCKVPN66Tcjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
|
|
5358
5364
|
if (medianFontSize > 0) {
|
|
5359
|
-
|
|
5360
|
-
}
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5365
|
+
_chunkCKVPN66Tcjs.detectHeadings.call(void 0, blocks, medianFontSize);
|
|
5366
|
+
}
|
|
5367
|
+
_chunkCKVPN66Tcjs.detectDocumentStyleHeadings.call(void 0, blocks);
|
|
5368
|
+
_chunkCKVPN66Tcjs.detectTypographyHeadings.call(void 0, blocks);
|
|
5369
|
+
_chunkCKVPN66Tcjs.detectSiblingStyleHeadings.call(void 0, blocks);
|
|
5370
|
+
_chunkCKVPN66Tcjs.detectRepeatedPageLabels.call(void 0, blocks);
|
|
5371
|
+
_chunkCKVPN66Tcjs.detectPageLeadHeadings.call(void 0, blocks);
|
|
5372
|
+
_chunkCKVPN66Tcjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
|
|
5373
|
+
_chunkCKVPN66Tcjs.refineDocumentStyleHeadings.call(void 0, blocks);
|
|
5374
|
+
_chunkCKVPN66Tcjs.detectMarkerHeadings.call(void 0, blocks);
|
|
5369
5375
|
demoteNonHeadingRoles(blocks, pageHeights, faceNames);
|
|
5370
|
-
|
|
5371
|
-
|
|
5376
|
+
_chunkCKVPN66Tcjs.detectTableCaptions.call(void 0, blocks);
|
|
5377
|
+
_chunkCKVPN66Tcjs.detectKoreanListBlocks.call(void 0, blocks);
|
|
5372
5378
|
sanitizeBlockControlChars(blocks);
|
|
5373
5379
|
if (_optionalChain([options, 'optionalAccess', _477 => _477.imagePlacement]) === "flow") moveImagesInFlow(blocks);
|
|
5374
5380
|
let outBlocks = splitSingleCellTables(blocks);
|
|
@@ -5390,19 +5396,19 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5390
5396
|
const shown = /* @__PURE__ */ new Map();
|
|
5391
5397
|
const markContent = (bs) => {
|
|
5392
5398
|
for (const b of _nullishCoalesce(bs, () => ( []))) if (b.table) for (const row of b.table.cells) for (const c of row) {
|
|
5393
|
-
if (
|
|
5394
|
-
const lines =
|
|
5395
|
-
if (lines)
|
|
5399
|
+
if (_chunkCKVPN66Tcjs.IMAGE_CELLS.has(c)) _chunk22L7WGJEcjs.CONTENT_CELLS.add(c);
|
|
5400
|
+
const lines = _chunkCKVPN66Tcjs.CELL_LINES.get(c);
|
|
5401
|
+
if (lines) _chunk22L7WGJEcjs.CELL_BASELINES.set(c, lines.map((l) => l.y));
|
|
5396
5402
|
markContent(c.blocks);
|
|
5397
5403
|
}
|
|
5398
5404
|
};
|
|
5399
5405
|
const visual = (bs) => bs.flatMap((b) => {
|
|
5400
5406
|
if (b.type !== "table") return [b];
|
|
5401
|
-
if (!hancom && b.table &&
|
|
5407
|
+
if (!hancom && b.table && _chunkCKVPN66Tcjs.CLIP_TABLES.has(b.table)) return [b];
|
|
5402
5408
|
let v = shown.get(b);
|
|
5403
5409
|
if (!v) {
|
|
5404
5410
|
markContent([b]);
|
|
5405
|
-
shown.set(b, v =
|
|
5411
|
+
shown.set(b, v = _chunk22L7WGJEcjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _481 => _481.keepTrailingEmptyCols])));
|
|
5406
5412
|
}
|
|
5407
5413
|
return v;
|
|
5408
5414
|
});
|
|
@@ -5411,13 +5417,13 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5411
5417
|
blocks.length = 0;
|
|
5412
5418
|
for (const b of kept) blocks.push(b);
|
|
5413
5419
|
}
|
|
5414
|
-
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(
|
|
5415
|
-
if (_optionalChain([options, 'optionalAccess', _483 => _483.tableFormat]) === "gfm")
|
|
5420
|
+
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunk22L7WGJEcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([options, 'optionalAccess', _482 => _482.tableFormat]) }), { keepLoneNumbers: true }));
|
|
5421
|
+
if (_optionalChain([options, 'optionalAccess', _483 => _483.tableFormat]) === "gfm") _chunk22L7WGJEcjs.assignTableIds.call(void 0, blocks);
|
|
5416
5422
|
let markdown = finishMarkdown(outBlocks);
|
|
5417
5423
|
const outline = collectPdfOutline(outBlocks);
|
|
5418
5424
|
return {
|
|
5419
5425
|
markdown,
|
|
5420
|
-
pages:
|
|
5426
|
+
pages: _chunk42P53WKDcjs.blocksToPages.call(void 0, splitPageTables(_chunkCKVPN66Tcjs.splitPageBreakWraps.call(void 0, outBlocks)), finishMarkdown),
|
|
5421
5427
|
blocks,
|
|
5422
5428
|
metadata,
|
|
5423
5429
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -5509,5 +5515,5 @@ function marginStamp(items) {
|
|
|
5509
5515
|
|
|
5510
5516
|
|
|
5511
5517
|
|
|
5512
|
-
exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks =
|
|
5513
|
-
//# sourceMappingURL=parser-
|
|
5518
|
+
exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkCKVPN66Tcjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkCKVPN66Tcjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.isPreciseGapProducer = isPreciseGapProducer; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkCKVPN66Tcjs.removeHeaderFooterBlocks;
|
|
5519
|
+
//# sourceMappingURL=parser-TGMBU6NM.cjs.map
|