kordoc 4.22.0 → 4.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -9
- package/dist/{-KRYEEYOX.js → -C437ZARA.js} +11 -11
- package/dist/{chunk-HIM23MJP.js → chunk-2X64TI7I.js} +2 -2
- package/dist/{chunk-SP3DBTDN.js → chunk-3LJ6QO53.js} +28 -6
- package/dist/chunk-3LJ6QO53.js.map +1 -0
- package/dist/{chunk-PPYQUI3X.js → chunk-4BJZGXNM.js} +2 -2
- package/dist/{chunk-NKWY4UJ4.js → chunk-4GCS7WJJ.js} +2 -2
- package/dist/{chunk-BKEDPKXS.js → chunk-56GBOIOE.js} +2 -2
- package/dist/{chunk-GQJ4MFLT.cjs → chunk-AUWO57ED.cjs} +2 -2
- package/dist/{chunk-GQJ4MFLT.cjs.map → chunk-AUWO57ED.cjs.map} +1 -1
- package/dist/{chunk-2ZRU6WJQ.js → chunk-AXR7OKQY.js} +2 -2
- package/dist/{chunk-HI45PG3J.js → chunk-CNMUT5YW.js} +2 -2
- package/dist/{chunk-B4IKM3CG.js → chunk-DQXP3ELP.js} +2 -2
- package/dist/{chunk-EFO7H2D4.cjs → chunk-EKKZNKJD.cjs} +3 -3
- package/dist/{chunk-EFO7H2D4.cjs.map → chunk-EKKZNKJD.cjs.map} +1 -1
- package/dist/{chunk-LJSZ3HCI.cjs → chunk-ENV25MPM.cjs} +27 -26
- package/dist/chunk-ENV25MPM.cjs.map +1 -0
- package/dist/{chunk-7BJDDE7V.js → chunk-FPUBEM3F.js} +11 -11
- package/dist/{chunk-4W7GCW3Z.js → chunk-GFQIKYBV.js} +3 -3
- package/dist/{chunk-BXBOFBHR.js → chunk-GVBQVXXB.js} +2 -2
- package/dist/{chunk-BXBOFBHR.js.map → chunk-GVBQVXXB.js.map} +1 -1
- package/dist/{chunk-EXKBLZUH.cjs → chunk-I4BS4BXE.cjs} +188 -166
- package/dist/{chunk-EXKBLZUH.cjs.map → chunk-I4BS4BXE.cjs.map} +1 -1
- package/dist/{chunk-72DOHOTQ.js → chunk-IRP6QS3K.js} +3 -3
- package/dist/{chunk-VHDD33Q4.js → chunk-L6N4OMKR.js} +60 -28
- package/dist/chunk-L6N4OMKR.js.map +1 -0
- package/dist/{chunk-GWJV3FYA.js → chunk-L6PFPBTK.js} +2 -2
- package/dist/{chunk-DKSQ22RU.cjs → chunk-MED2MR6O.cjs} +6 -6
- package/dist/{chunk-DKSQ22RU.cjs.map → chunk-MED2MR6O.cjs.map} +1 -1
- package/dist/{chunk-7YVDZCHF.js → chunk-NGDMJICC.js} +29 -7
- package/dist/{chunk-SP3DBTDN.js.map → chunk-NGDMJICC.js.map} +1 -1
- package/dist/{chunk-PMVM7BS6.js → chunk-QFJCEHY7.js} +2 -2
- package/dist/{chunk-PMVM7BS6.js.map → chunk-QFJCEHY7.js.map} +1 -1
- package/dist/{chunk-DCXK7PYL.js → chunk-S4KQUVBV.js} +6 -5
- package/dist/{chunk-POPIFZOT.js.map → chunk-S4KQUVBV.js.map} +1 -1
- package/dist/{chunk-PWCVNTMX.js → chunk-U3TZVR7A.js} +2 -2
- package/dist/{chunk-POPIFZOT.js → chunk-UMNKY2EZ.js} +6 -5
- package/dist/{chunk-DCXK7PYL.js.map → chunk-UMNKY2EZ.js.map} +1 -1
- package/dist/{chunk-NNGZXPPA.js → chunk-UV2G6XFA.js} +2 -2
- package/dist/{chunk-746T2J3U.js → chunk-VUC4JJUM.js} +2 -2
- package/dist/{chunk-D5DRW3S5.js → chunk-YOFKJ7IM.js} +2 -2
- package/dist/{chunk-DZFGZBMV.js → chunk-YTEMFVZB.js} +2 -2
- package/dist/{chunk-GBQXV6MI.cjs → chunk-ZLFUZM7H.cjs} +3 -3
- package/dist/{chunk-GBQXV6MI.cjs.map → chunk-ZLFUZM7H.cjs.map} +1 -1
- package/dist/chunks-MPOOHZVO.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-QPKCUYLS.cjs → formula-3TVRNJ66.cjs} +9 -9
- package/dist/{formula-QPKCUYLS.cjs.map → formula-3TVRNJ66.cjs.map} +1 -1
- package/dist/{formula-XSXXXRA6.js → formula-43QBPAL5.js} +4 -4
- package/dist/{formula-2G43QHEV.js → formula-HUENRCPJ.js} +3 -3
- package/dist/{image-ocr-XY3TUBYK.js → image-ocr-BAHDLDV5.js} +6 -6
- package/dist/{image-ocr-L46V4HIX.js → image-ocr-HYAKWJGE.js} +9 -9
- package/dist/{image-ocr-ZQMWJHKE.cjs → image-ocr-OC3TCXMV.cjs} +17 -17
- package/dist/{image-ocr-ZQMWJHKE.cjs.map → image-ocr-OC3TCXMV.cjs.map} +1 -1
- package/dist/index.cjs +356 -324
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +60 -28
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-QFDCCCI2.js → model-bundle-23WBSECG.js} +5 -5
- package/dist/{models-T2QBJSY5.js → models-NRZQY45P.js} +5 -5
- package/dist/{parse-worker-v2-PT6LULNS.js → parse-worker-v2-DPNXGJ73.js} +12 -12
- package/dist/{parser-2EIOJGOS.js → parser-FNUQW2F3.js} +73 -27
- package/dist/parser-FNUQW2F3.js.map +1 -0
- package/dist/{parser-BGSWEVUB.cjs → parser-OKAQRZKM.cjs} +318 -272
- package/dist/parser-OKAQRZKM.cjs.map +1 -0
- package/dist/{parser-LM6FNKVB.js → parser-XNOLC3MZ.js} +70 -24
- package/dist/parser-XNOLC3MZ.js.map +1 -0
- package/dist/pdf-ocr-6UXBIQE6.cjs +31 -0
- package/dist/pdf-ocr-6UXBIQE6.cjs.map +1 -0
- package/dist/{pdf-ocr-GSELGUFG.js → pdf-ocr-FAGA3O6B.js} +8 -6
- package/dist/{pdf-ocr-C5OFY2RY.js → pdf-ocr-N5LYC5LA.js} +11 -9
- package/dist/{profile-io-Y2TLZ62F.js → profile-io-HC6FMYX4.js} +3 -3
- package/dist/{rasterize-FB6MFPS3.js → rasterize-QLTROEV2.js} +3 -3
- package/dist/{redact-doc-AV2EOKPP.js → redact-doc-V4KMM2QV.js} +11 -11
- package/dist/{render-M5BW4TLH.js → render-V4S3QLTR.js} +7 -7
- package/dist/seal-MQ5TB5YZ.js +10 -0
- package/dist/{setup-DVKUFC73.js → setup-HU7ZOQNM.js} +3 -3
- package/dist/visual-RLIFC4XC.js +21 -0
- package/dist/{watch-S35AWINM.js → watch-NPIZ6DSJ.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-7YVDZCHF.js.map +0 -1
- package/dist/chunk-LJSZ3HCI.cjs.map +0 -1
- package/dist/chunk-VHDD33Q4.js.map +0 -1
- package/dist/chunks-5AVQEPIH.js +0 -10
- package/dist/parser-2EIOJGOS.js.map +0 -1
- package/dist/parser-BGSWEVUB.cjs.map +0 -1
- package/dist/parser-LM6FNKVB.js.map +0 -1
- package/dist/pdf-ocr-A2UWUATF.cjs +0 -29
- package/dist/pdf-ocr-A2UWUATF.cjs.map +0 -1
- package/dist/seal-JXYWI5CN.js +0 -10
- package/dist/visual-DBVBTOAV.js +0 -21
- /package/dist/{-KRYEEYOX.js.map → -C437ZARA.js.map} +0 -0
- /package/dist/{chunk-HIM23MJP.js.map → chunk-2X64TI7I.js.map} +0 -0
- /package/dist/{chunk-PPYQUI3X.js.map → chunk-4BJZGXNM.js.map} +0 -0
- /package/dist/{chunk-NKWY4UJ4.js.map → chunk-4GCS7WJJ.js.map} +0 -0
- /package/dist/{chunk-BKEDPKXS.js.map → chunk-56GBOIOE.js.map} +0 -0
- /package/dist/{chunk-2ZRU6WJQ.js.map → chunk-AXR7OKQY.js.map} +0 -0
- /package/dist/{chunk-HI45PG3J.js.map → chunk-CNMUT5YW.js.map} +0 -0
- /package/dist/{chunk-B4IKM3CG.js.map → chunk-DQXP3ELP.js.map} +0 -0
- /package/dist/{chunk-7BJDDE7V.js.map → chunk-FPUBEM3F.js.map} +0 -0
- /package/dist/{chunk-4W7GCW3Z.js.map → chunk-GFQIKYBV.js.map} +0 -0
- /package/dist/{chunk-72DOHOTQ.js.map → chunk-IRP6QS3K.js.map} +0 -0
- /package/dist/{chunk-GWJV3FYA.js.map → chunk-L6PFPBTK.js.map} +0 -0
- /package/dist/{chunk-PWCVNTMX.js.map → chunk-U3TZVR7A.js.map} +0 -0
- /package/dist/{chunk-NNGZXPPA.js.map → chunk-UV2G6XFA.js.map} +0 -0
- /package/dist/{chunk-746T2J3U.js.map → chunk-VUC4JJUM.js.map} +0 -0
- /package/dist/{chunk-D5DRW3S5.js.map → chunk-YOFKJ7IM.js.map} +0 -0
- /package/dist/{chunk-DZFGZBMV.js.map → chunk-YTEMFVZB.js.map} +0 -0
- /package/dist/{chunks-5AVQEPIH.js.map → chunks-MPOOHZVO.js.map} +0 -0
- /package/dist/{formula-XSXXXRA6.js.map → formula-43QBPAL5.js.map} +0 -0
- /package/dist/{formula-2G43QHEV.js.map → formula-HUENRCPJ.js.map} +0 -0
- /package/dist/{image-ocr-XY3TUBYK.js.map → image-ocr-BAHDLDV5.js.map} +0 -0
- /package/dist/{image-ocr-L46V4HIX.js.map → image-ocr-HYAKWJGE.js.map} +0 -0
- /package/dist/{model-bundle-QFDCCCI2.js.map → model-bundle-23WBSECG.js.map} +0 -0
- /package/dist/{models-T2QBJSY5.js.map → models-NRZQY45P.js.map} +0 -0
- /package/dist/{parse-worker-v2-PT6LULNS.js.map → parse-worker-v2-DPNXGJ73.js.map} +0 -0
- /package/dist/{pdf-ocr-C5OFY2RY.js.map → pdf-ocr-FAGA3O6B.js.map} +0 -0
- /package/dist/{pdf-ocr-GSELGUFG.js.map → pdf-ocr-N5LYC5LA.js.map} +0 -0
- /package/dist/{profile-io-Y2TLZ62F.js.map → profile-io-HC6FMYX4.js.map} +0 -0
- /package/dist/{rasterize-FB6MFPS3.js.map → rasterize-QLTROEV2.js.map} +0 -0
- /package/dist/{redact-doc-AV2EOKPP.js.map → redact-doc-V4KMM2QV.js.map} +0 -0
- /package/dist/{render-M5BW4TLH.js.map → render-V4S3QLTR.js.map} +0 -0
- /package/dist/{seal-JXYWI5CN.js.map → seal-MQ5TB5YZ.js.map} +0 -0
- /package/dist/{setup-DVKUFC73.js.map → setup-HU7ZOQNM.js.map} +0 -0
- /package/dist/{visual-DBVBTOAV.js.map → visual-RLIFC4XC.js.map} +0 -0
- /package/dist/{watch-S35AWINM.js.map → watch-NPIZ6DSJ.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -402,7 +402,7 @@ interface OcrPageLines {
|
|
|
402
402
|
/** 기울기 보정으로 래스터를 돌린 각(°, 양수 = 반시계로 세움). 좌표는 돌린 래스터 기준 — 보정하지 않았으면 0.
|
|
403
403
|
* 입력 좌표로는 θ = deskewAngle, (cx, cy) = ((width−1)/2, (height−1)/2) 로 x₀ = cx + (x−cx)cosθ − (y−cy)sinθ, y₀ = cy + (x−cx)sinθ + (y−cy)cosθ */
|
|
404
404
|
deskewAngle: number;
|
|
405
|
-
/** 텍스트층이 있는 쪽이라 그림 영역만 읽었다 — 그 영역 안 줄만 담긴다 */
|
|
405
|
+
/** 텍스트층이 있는 쪽이라 그림 영역만 읽었다 — 원본 PDF 좌표를 유지하고 deskewAngle은 0, 그 영역 안 줄만 담긴다 */
|
|
406
406
|
regionsOnly?: true;
|
|
407
407
|
/** 위→아래, 왼→오른 순 */
|
|
408
408
|
lines: OcrLine[];
|
package/dist/index.d.ts
CHANGED
|
@@ -402,7 +402,7 @@ interface OcrPageLines {
|
|
|
402
402
|
/** 기울기 보정으로 래스터를 돌린 각(°, 양수 = 반시계로 세움). 좌표는 돌린 래스터 기준 — 보정하지 않았으면 0.
|
|
403
403
|
* 입력 좌표로는 θ = deskewAngle, (cx, cy) = ((width−1)/2, (height−1)/2) 로 x₀ = cx + (x−cx)cosθ − (y−cy)sinθ, y₀ = cy + (x−cx)sinθ + (y−cy)cosθ */
|
|
404
404
|
deskewAngle: number;
|
|
405
|
-
/** 텍스트층이 있는 쪽이라 그림 영역만 읽었다 — 그 영역 안 줄만 담긴다 */
|
|
405
|
+
/** 텍스트층이 있는 쪽이라 그림 영역만 읽었다 — 원본 PDF 좌표를 유지하고 deskewAngle은 0, 그 영역 안 줄만 담긴다 */
|
|
406
406
|
regionsOnly?: true;
|
|
407
407
|
/** 위→아래, 왼→오른 순 */
|
|
408
408
|
lines: OcrLine[];
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
blocksToPages,
|
|
3
3
|
bmpToPng,
|
|
4
4
|
inlineImagesIntoMarkdown
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YOFKJ7IM.js";
|
|
6
6
|
import {
|
|
7
7
|
parsePageRange
|
|
8
8
|
} from "./chunk-V4BH5SRQ.js";
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
validateOcrOptions,
|
|
38
38
|
visibleText,
|
|
39
39
|
wrapScript
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-QFJCEHY7.js";
|
|
41
41
|
import {
|
|
42
42
|
KordocError,
|
|
43
43
|
OPTIONAL_DEP_INSTALL_HINT,
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
toArrayBuffer,
|
|
56
56
|
unescapeHtml,
|
|
57
57
|
unzipLimitBytes
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-DQXP3ELP.js";
|
|
59
59
|
|
|
60
60
|
// src/plain-markdown.ts
|
|
61
61
|
function toPlainMarkdown(md2) {
|
|
@@ -24642,7 +24642,7 @@ var MIN_SIDE = 24;
|
|
|
24642
24642
|
async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
24643
24643
|
const ocr = options?.ocr;
|
|
24644
24644
|
if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
|
|
24645
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
24645
|
+
const { parseImageDocument } = await import("./image-ocr-BAHDLDV5.js");
|
|
24646
24646
|
let inserted = false, unreadable = 0;
|
|
24647
24647
|
let failed = null;
|
|
24648
24648
|
const walk = async (list, depth) => {
|
|
@@ -35431,21 +35431,22 @@ var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u
|
|
|
35431
35431
|
var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
|
|
35432
35432
|
var HANCOM_FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;>?]^`}~\xB0\xB7\u3009\u300B\u300D\u300F\u3011\u3015\u3017\u3019\u301B\u30FB\uFF01\uFF05\uFF09\uFF0C\uFF0E\uFF1A\uFF1B\uFF1E\uFF1F\uFF3D\uFF3E\uFF40\uFF5D\uFF5E\uFF65\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308E\u30A1\u30A3\u30A5\u30A7\u30A9\u30C3\u30E3\u30E5\u30E7\u30EE\u30F5\u30F6\u3001\u3002\u3003\u3005\u30FC\u309B\u309C\u309D\u309E\u30FD\u30FE\u2019\u201D\u2024\u2025\u2026\u2030\u2031\u2032\u2033\u2034\u2035\u2036\u2037\u2103\u2109"]);
|
|
35433
35433
|
var HANCOM_FORBID_END = /* @__PURE__ */ new Set([..."(<[\\{\xA7\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\u3016\u3018\u301A\uFF04\uFF08\uFF1C\uFF3B\uFF3C\uFF5B\uFFE0\uFFE1\uFFE5\uFFE6$\xA2\xA3\xA4\xA5\u09F2\u09F3\u0E3F", ...Array.from({ length: 13 }, (_, i) => String.fromCharCode(8352 + i))]);
|
|
35434
|
+
var isWrapSpace = (ch) => ch === " " || ch === "\u2005";
|
|
35434
35435
|
function prepareWrap(text, mode, opts) {
|
|
35435
35436
|
const widthEm = widthFnOf(opts?.faceClass), spaceEm = opts?.spaceEm ?? SPACE_EM_FIXED;
|
|
35436
35437
|
const advances = [], steps = [];
|
|
35437
35438
|
let i = 0;
|
|
35438
35439
|
for (const ch of text) {
|
|
35439
35440
|
const cp = ch.codePointAt(0);
|
|
35440
|
-
advances[i] = isSpaceCp(cp) ? spaceEm : widthEm(cp);
|
|
35441
|
+
advances[i] = cp === 8197 ? 250 : isSpaceCp(cp) ? spaceEm : widthEm(cp);
|
|
35441
35442
|
steps[i] = ch.length;
|
|
35442
35443
|
i += ch.length;
|
|
35443
35444
|
}
|
|
35444
35445
|
return { units: splitWrapUnits(text, mode), advances, steps };
|
|
35445
35446
|
}
|
|
35446
35447
|
function splitWrapUnits(text, mode, latinBreak = false) {
|
|
35447
|
-
if (latinBreak) return text.match(mode === "keep" ? / +|[\x21-\x7e]|[^ \x21-\x7e]+/gu : / +|[^ ](?:\u00a0[^ \u00a0]?)*/gu) ?? [];
|
|
35448
|
-
return text.match(mode === "keep" ? / +|\ufdd0+(?=[^ \ufdd0])|[^ ]+/gu : / +|\u2060*(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ ])(?:\u00a0(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ \u00a0])?)*/gu) ?? [];
|
|
35448
|
+
if (latinBreak) return text.match(mode === "keep" ? /[ \u2005]+|[\x21-\x7e]|[^ \u2005\x21-\x7e]+/gu : /[ \u2005]+|[^ \u2005](?:\u00a0[^ \u2005\u00a0]?)*/gu) ?? [];
|
|
35449
|
+
return text.match(mode === "keep" ? /[ \u2005]+|\ufdd0+(?=[^ \u2005\ufdd0])|[^ \u2005]+/gu : /[ \u2005]+|\u2060*(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ \u2005])(?:\u00a0(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ \u2005\u00a0])?)*/gu) ?? [];
|
|
35449
35450
|
}
|
|
35450
35451
|
function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
|
|
35451
35452
|
if (!opts?.prepared && text.includes("\n")) {
|
|
@@ -35492,7 +35493,7 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35492
35493
|
if (unitW) return (unitW[i] ?? 0) + (ch.length === 2 ? unitW[i + 1] ?? 0 : 0);
|
|
35493
35494
|
if (prepared) return prepared.advances[i] * (1 + spacing / 100) * k;
|
|
35494
35495
|
const cp = ch.codePointAt(0);
|
|
35495
|
-
return (isSpaceCp(cp) ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
|
|
35496
|
+
return (cp === 8197 ? 250 : isSpaceCp(cp) ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
|
|
35496
35497
|
};
|
|
35497
35498
|
const rangeW = (from, to) => {
|
|
35498
35499
|
let w = 0;
|
|
@@ -35525,11 +35526,11 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35525
35526
|
const u = text[unitPos];
|
|
35526
35527
|
const prevStart = (end) => end - (end >= 2 && /[\uDC00-\uDFFF]/.test(text[end - 1]) && /[\uD800-\uDBFF]/.test(text[end - 2]) ? 2 : 1);
|
|
35527
35528
|
const old = opts?.before2024;
|
|
35528
|
-
const splitIn = opts?.kinsoku === "hancom" && split && u !== void 0 && u
|
|
35529
|
+
const splitIn = opts?.kinsoku === "hancom" && split && u !== void 0 && !isWrapSpace(u) && !isWrapSpace(text[bp - 1]);
|
|
35529
35530
|
const inWord = old && splitIn;
|
|
35530
|
-
if (!splitIn && u !== void 0 && forbidStart.has(u) && prevStart(bp) > lineStart() && text[bp - 1]
|
|
35531
|
+
if (!splitIn && u !== void 0 && forbidStart.has(u) && prevStart(bp) > lineStart() && !isWrapSpace(text[bp - 1])) {
|
|
35531
35532
|
bp = prevStart(bp);
|
|
35532
|
-
if (old && forbidStart.has(text[bp]) && prevStart(bp) > lineStart() && text[bp - 1]
|
|
35533
|
+
if (old && forbidStart.has(text[bp]) && prevStart(bp) > lineStart() && !isWrapSpace(text[bp - 1])) bp = prevStart(bp);
|
|
35533
35534
|
}
|
|
35534
35535
|
while (!inWord && bp - 1 >= lineStart() && forbidEnd.has(text[bp - 1])) bp--;
|
|
35535
35536
|
if (bp <= lineStart()) bp = unitPos;
|
|
@@ -35540,8 +35541,8 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35540
35541
|
lineEnded = false;
|
|
35541
35542
|
placed = unitPos > bp ? 1 : 0;
|
|
35542
35543
|
for (let i = bp; i < unitPos; i++) {
|
|
35543
|
-
if (text[i]
|
|
35544
|
-
else if (condense > 0 && (realSeen || !hancom)) spaceW += rangeW(i, i + 1) - (spAt?.[i] ?? 0);
|
|
35544
|
+
if (!isWrapSpace(text[i])) realSeen = true;
|
|
35545
|
+
else if (text[i] === " " && condense > 0 && (realSeen || !hancom)) spaceW += rangeW(i, i + 1) - (spAt?.[i] ?? 0);
|
|
35545
35546
|
}
|
|
35546
35547
|
lineW = rangeW(bp, unitPos) + w;
|
|
35547
35548
|
};
|
|
@@ -35555,16 +35556,16 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35555
35556
|
lineW = leadW;
|
|
35556
35557
|
};
|
|
35557
35558
|
for (const u of units) {
|
|
35558
|
-
if (u[0]
|
|
35559
|
+
if (isWrapSpace(u[0])) {
|
|
35559
35560
|
if (hancom) {
|
|
35560
35561
|
let k2 = 0;
|
|
35561
35562
|
for (; k2 < u.length; k2++) {
|
|
35562
35563
|
if (!lineEnded && lineW >= avail) lineEnded = true;
|
|
35563
|
-
if (lineEnded && k2 >= 2 && pos + k2 > lineStart()) break;
|
|
35564
|
+
if (lineEnded && (k2 >= 2 || u[k2] === "\u2005") && pos + k2 > lineStart()) break;
|
|
35564
35565
|
if (!lineEnded) {
|
|
35565
35566
|
const sw2 = rangeW(pos + k2, pos + k2 + 1);
|
|
35566
35567
|
lineW += sw2;
|
|
35567
|
-
if (realSeen) spaceW += sw2 - (spAt?.[pos + k2] ?? 0);
|
|
35568
|
+
if (realSeen && u[k2] === " ") spaceW += sw2 - (spAt?.[pos + k2] ?? 0);
|
|
35568
35569
|
}
|
|
35569
35570
|
}
|
|
35570
35571
|
if (k2 < u.length) breakAt(pos + k2, rangeW(pos + k2, pos + u.length));
|
|
@@ -35573,7 +35574,7 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35573
35574
|
}
|
|
35574
35575
|
const sw = rangeW(pos, pos + u.length);
|
|
35575
35576
|
lineW += sw;
|
|
35576
|
-
spaceW +=
|
|
35577
|
+
for (let k2 = 0; k2 < u.length; k2++) if (u[k2] === " ") spaceW += rangeW(pos + k2, pos + k2 + 1);
|
|
35577
35578
|
pos += u.length;
|
|
35578
35579
|
continue;
|
|
35579
35580
|
}
|
|
@@ -50718,6 +50719,21 @@ function nextParaNumber(counters, geom) {
|
|
|
50718
50719
|
});
|
|
50719
50720
|
}
|
|
50720
50721
|
|
|
50722
|
+
// src/render/reflow-cache.ts
|
|
50723
|
+
function cachedParagraphBottom(lsa, bodyFlow) {
|
|
50724
|
+
let bottom = Number.NEGATIVE_INFINITY, previousV = Number.NEGATIVE_INFINITY;
|
|
50725
|
+
for (let i = 0; i < lsa.childNodes.length; i++) {
|
|
50726
|
+
const seg = lsa.childNodes[i];
|
|
50727
|
+
if (seg.nodeType !== 1 || seg.localName !== "lineseg") continue;
|
|
50728
|
+
const num4 = (name, fallback = 0) => toInt32(seg.getAttribute(name) ?? void 0, fallback);
|
|
50729
|
+
const v = num4("vertpos");
|
|
50730
|
+
if (bodyFlow && v < previousV) bottom = Number.NEGATIVE_INFINITY;
|
|
50731
|
+
bottom = Math.max(bottom, v + Math.max(num4("vertsize", 1e3), num4("textheight", 1e3)) + num4("spacing"));
|
|
50732
|
+
previousV = v;
|
|
50733
|
+
}
|
|
50734
|
+
return bottom;
|
|
50735
|
+
}
|
|
50736
|
+
|
|
50721
50737
|
// src/render/reflow.ts
|
|
50722
50738
|
var geomMemo = (styles) => ({ cell: /* @__PURE__ */ new WeakMap(), table: /* @__PURE__ */ new WeakMap(), paraGeom: styles.paraGeom });
|
|
50723
50739
|
var LINESEG_FLAGS = "393216";
|
|
@@ -51039,10 +51055,11 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51039
51055
|
}
|
|
51040
51056
|
const lineBox = [];
|
|
51041
51057
|
const lineParts = [];
|
|
51058
|
+
const collisionHeights = [];
|
|
51042
51059
|
const boxAt = (i) => {
|
|
51043
51060
|
if (!zones.length) return void 0;
|
|
51044
51061
|
if (i in lineBox) return lineBox[i];
|
|
51045
|
-
const y0 = textStartV + i * pitch, y1 = y0 + height;
|
|
51062
|
+
const y0 = textStartV + i * pitch, y1 = y0 + Math.max(height, collisionHeights[i] ?? 0);
|
|
51046
51063
|
let free = [[marginL, marginL + avail]], hit = false, flow = "BOTH_SIDES";
|
|
51047
51064
|
for (const z of zones) {
|
|
51048
51065
|
if (!(y1 > z.top && y0 < z.bottom)) continue;
|
|
@@ -51102,7 +51119,26 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51102
51119
|
lineParts.length = 0;
|
|
51103
51120
|
}
|
|
51104
51121
|
}
|
|
51105
|
-
const
|
|
51122
|
+
const wrapLines = () => text.length === 0 ? { lines: 1, starts: [0], lastLineWidth: 0 } : simulateWrap(text, firstWrapWidth, contWidth, height, 100, paraMode, { widths, spacings, condensePct: condenseUse, kinsoku: "hancom", before2024: styles.before2024, lineWidth, latinBreak: geom.latinBreak, rightTabs });
|
|
51123
|
+
let wrap = wrapLines();
|
|
51124
|
+
if (zones.length) for (let pass = 0; pass < text.length; pass++) {
|
|
51125
|
+
let changed = false;
|
|
51126
|
+
for (const o of m.objs) if (o.inline) {
|
|
51127
|
+
const k = realIdx.indexOf(o.index), om = findChildByLocalName(o.el, "outMargin");
|
|
51128
|
+
if (k < 0) continue;
|
|
51129
|
+
let li = 0;
|
|
51130
|
+
for (let j = 1; j < wrap.starts.length; j++) if (wrap.starts[j] <= k) li = j;
|
|
51131
|
+
const h = num3(om, "top") + effHOf(o) + num3(om, "bottom");
|
|
51132
|
+
if (h > Math.max(height, collisionHeights[li] ?? 0)) {
|
|
51133
|
+
collisionHeights[li] = h;
|
|
51134
|
+
changed = true;
|
|
51135
|
+
}
|
|
51136
|
+
}
|
|
51137
|
+
if (!changed) break;
|
|
51138
|
+
lineBox.length = 0;
|
|
51139
|
+
lineParts.length = 0;
|
|
51140
|
+
wrap = wrapLines();
|
|
51141
|
+
}
|
|
51106
51142
|
const lineObjH = new Array(wrap.starts.length).fill(0);
|
|
51107
51143
|
const lineObjAsc = new Array(wrap.starts.length).fill(0);
|
|
51108
51144
|
const lineObjLs = new Array(wrap.starts.length).fill(false);
|
|
@@ -51193,12 +51229,13 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51193
51229
|
}
|
|
51194
51230
|
}
|
|
51195
51231
|
const vertpos = v;
|
|
51232
|
+
const occupiedH = Math.max(lineH, collisionHeights[li] ?? 0);
|
|
51196
51233
|
v += lineH + spacing;
|
|
51197
51234
|
const isFirst = li === 0;
|
|
51198
51235
|
const seg = doc.createElement("hp:lineseg");
|
|
51199
51236
|
seg.setAttribute("textpos", String(textpos));
|
|
51200
51237
|
seg.setAttribute("vertpos", String(vertpos));
|
|
51201
|
-
seg.setAttribute("vertsize", String(
|
|
51238
|
+
seg.setAttribute("vertsize", String(occupiedH === textH && boxAll > textH0 ? Math.max(textH0, boxTop) : occupiedH));
|
|
51202
51239
|
seg.setAttribute("textheight", String(lineH));
|
|
51203
51240
|
seg.setAttribute("baseline", String(geom.vertAlign === "TOP" ? 0 : geom.vertAlign === "CENTER" ? Math.floor(lineH / 2) : geom.vertAlign === "BOTTOM" ? lineH : Math.max(fl ? fl[1] : Math.round(textH0 * BASELINE_RATIO), lineObjAsc[li])));
|
|
51204
51241
|
seg.setAttribute("spacing", String(spacing));
|
|
@@ -51381,12 +51418,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51381
51418
|
if (!res) {
|
|
51382
51419
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
51383
51420
|
if (lsa) {
|
|
51384
|
-
|
|
51385
|
-
for (const seg of elements2(lsa)) {
|
|
51386
|
-
if (ln2(seg) !== "lineseg") continue;
|
|
51387
|
-
const th = Math.max(num3(seg, "vertsize", 1e3), num3(seg, "textheight", 1e3));
|
|
51388
|
-
bottom = Math.max(bottom, num3(seg, "vertpos") + th + num3(seg, "spacing"));
|
|
51389
|
-
}
|
|
51421
|
+
const bottom = cachedParagraphBottom(lsa, bodyFlow);
|
|
51390
51422
|
if (Number.isFinite(bottom)) {
|
|
51391
51423
|
cursorV = bottom;
|
|
51392
51424
|
prevSpaceAfter = g3?.spaceAfter ?? 0;
|
|
@@ -54751,7 +54783,7 @@ function scriptsOff(r, off) {
|
|
|
54751
54783
|
}
|
|
54752
54784
|
async function parseImage(buffer, options) {
|
|
54753
54785
|
try {
|
|
54754
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
54786
|
+
const { parseImageDocument } = await import("./image-ocr-BAHDLDV5.js");
|
|
54755
54787
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
54756
54788
|
stripScriptTags({ blocks });
|
|
54757
54789
|
return {
|
|
@@ -54815,7 +54847,7 @@ async function parseHwp(buffer, options) {
|
|
|
54815
54847
|
async function parsePdf(buffer, options) {
|
|
54816
54848
|
let parsePdfDocument;
|
|
54817
54849
|
try {
|
|
54818
|
-
const mod = await import("./parser-
|
|
54850
|
+
const mod = await import("./parser-XNOLC3MZ.js");
|
|
54819
54851
|
parsePdfDocument = mod.parsePdfDocument;
|
|
54820
54852
|
} catch {
|
|
54821
54853
|
return {
|