kordoc 4.24.0 → 4.24.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 +26 -54
- package/dist/{-VEOO4BOM.js → -SRNEV7LS.js} +11 -11
- package/dist/{chunk-P35SCAJN.js → chunk-3HN65YAL.js} +2 -2
- package/dist/{chunk-H5PDQ66I.js → chunk-4745MFQU.js} +3 -3
- package/dist/{chunk-ENCAYXDI.js → chunk-4XC4O7FJ.js} +4 -4
- package/dist/{chunk-EN3PK6OT.js → chunk-7NTMM6PO.js} +2 -2
- package/dist/{chunk-GEY6ZMXH.js → chunk-C6ZVB547.js} +43 -23
- package/dist/{chunk-GEY6ZMXH.js.map → chunk-C6ZVB547.js.map} +1 -1
- package/dist/{chunk-CKCJU42Y.js → chunk-DHMBPMKC.js} +74 -30
- package/dist/chunk-DHMBPMKC.js.map +1 -0
- package/dist/{chunk-ZGNHJCDR.js → chunk-E6VBLBOO.js} +2 -2
- package/dist/{chunk-O2SLKE4L.js → chunk-E7B5CXYI.js} +2 -2
- package/dist/{chunk-DKWEZWCF.cjs → chunk-HLTPMSYW.cjs} +3 -3
- package/dist/{chunk-DKWEZWCF.cjs.map → chunk-HLTPMSYW.cjs.map} +1 -1
- package/dist/{chunk-DZT3CHNZ.cjs → chunk-IGG63DFK.cjs} +3 -3
- package/dist/{chunk-DZT3CHNZ.cjs.map → chunk-IGG63DFK.cjs.map} +1 -1
- package/dist/{chunk-IHNIPVPJ.cjs → chunk-JFUUFJZW.cjs} +6 -6
- package/dist/{chunk-IHNIPVPJ.cjs.map → chunk-JFUUFJZW.cjs.map} +1 -1
- package/dist/{chunk-PX6X4YOR.js → chunk-JMOAMKAR.js} +4 -4
- package/dist/{chunk-P6FNIU5P.js → chunk-KUC5I5MB.js} +2 -2
- package/dist/{chunk-Z5G6QNVH.js → chunk-LMEF7FN5.js} +2 -2
- package/dist/{chunk-OJISMR2Z.js → chunk-M46PB75E.js} +2 -2
- package/dist/{chunk-G4HWEM6Q.js → chunk-MHNJOJQV.js} +4 -4
- package/dist/{chunk-Z62PHCSU.js → chunk-NJ5RUDCW.js} +3 -3
- package/dist/{chunk-DM5YPONO.js → chunk-NMFFIUI6.js} +2 -2
- package/dist/{chunk-HOXHBG4C.cjs → chunk-PNSALBXH.cjs} +2 -2
- package/dist/{chunk-HOXHBG4C.cjs.map → chunk-PNSALBXH.cjs.map} +1 -1
- package/dist/{chunk-FHFPQ6MX.cjs → chunk-PNX5FYHC.cjs} +24 -24
- package/dist/{chunk-FHFPQ6MX.cjs.map → chunk-PNX5FYHC.cjs.map} +1 -1
- package/dist/{chunk-IZYYKE5F.js → chunk-R2GIGE5H.js} +2 -2
- package/dist/{chunk-55DOBEGD.js → chunk-RIRPLFPN.js} +2 -2
- package/dist/{chunk-3M2BIQLZ.js → chunk-TDMBTG7U.js} +2 -2
- package/dist/{chunk-6YDPTTIY.js → chunk-TW3V6FSH.js} +2 -2
- package/dist/{chunk-OHDGEGDJ.cjs → chunk-UNICY546.cjs} +23 -23
- package/dist/{chunk-OHDGEGDJ.cjs.map → chunk-UNICY546.cjs.map} +1 -1
- package/dist/{chunk-SRUBDR3Z.js → chunk-VPSF5LEM.js} +3 -3
- package/dist/{chunk-4VPN5MHS.js → chunk-W24TJJNN.js} +2 -2
- package/dist/{chunk-DBPDAG7N.js → chunk-WDSTW3BD.js} +2 -2
- package/dist/{chunk-XLY5ZJRP.js → chunk-WJAFE3Z6.js} +2 -2
- package/dist/chunks-AL4P5TO5.js +10 -0
- package/dist/cli.js +41 -30
- package/dist/cli.js.map +1 -1
- package/dist/{formula-4GRNVWIQ.js → formula-DSB574H7.js} +4 -4
- package/dist/{formula-R3OWFGCZ.cjs → formula-HK2MNZ3Q.cjs} +9 -9
- package/dist/{formula-R3OWFGCZ.cjs.map → formula-HK2MNZ3Q.cjs.map} +1 -1
- package/dist/{formula-6Y467S4R.js → formula-U2LZ67KI.js} +3 -3
- package/dist/{image-ocr-CGJJCD4E.js → image-ocr-3QB2HLSI.js} +9 -9
- package/dist/{image-ocr-ZLL66KNO.js → image-ocr-J54Q3YWP.js} +6 -6
- package/dist/{image-ocr-EBKG45KF.cjs → image-ocr-QNIMVE5A.cjs} +17 -17
- package/dist/{image-ocr-EBKG45KF.cjs.map → image-ocr-QNIMVE5A.cjs.map} +1 -1
- package/dist/index.cjs +683 -619
- 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 +106 -42
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +36 -33
- package/dist/mcp.js.map +1 -1
- package/dist/{model-bundle-RD4KSNTB.js → model-bundle-CGWU4ALC.js} +5 -5
- package/dist/{models-OLGCZBXI.js → models-A3TF3BDV.js} +5 -5
- package/dist/{parse-worker-v2-YZY2GQY5.js → parse-worker-v2-MNUD4WAR.js} +20 -13
- package/dist/parse-worker-v2-MNUD4WAR.js.map +1 -0
- package/dist/{parser-IHCFHLHN.js → parser-C3ARF26I.js} +12 -12
- package/dist/{parser-J22QBXPP.js → parser-OBGWEWSU.js} +9 -9
- package/dist/{parser-DX4I3GT7.cjs → parser-RPAHN3OR.cjs} +157 -157
- package/dist/{parser-DX4I3GT7.cjs.map → parser-RPAHN3OR.cjs.map} +1 -1
- package/dist/{pdf-ocr-TYIH23RP.js → pdf-ocr-ENLVEEYL.js} +9 -9
- package/dist/pdf-ocr-GA5QJFNK.cjs +31 -0
- package/dist/{pdf-ocr-WU7SZHWM.cjs.map → pdf-ocr-GA5QJFNK.cjs.map} +1 -1
- package/dist/{pdf-ocr-H2247ZZH.js → pdf-ocr-K53REDNY.js} +6 -6
- package/dist/{profile-io-GH3TYTNJ.js → profile-io-ZGFEO7CB.js} +3 -3
- package/dist/{rasterize-7TFTVFMB.js → rasterize-QMC2SAUT.js} +3 -3
- package/dist/{redact-doc-DSSQOO3A.js → redact-doc-JH6RZZBE.js} +11 -11
- package/dist/{render-NKXZQINI.js → render-ZGKQLKPJ.js} +7 -7
- package/dist/seal-KMGYTJAV.js +10 -0
- package/dist/{setup-JVLMX2TH.js → setup-LAQGCYQ2.js} +3 -3
- package/dist/visual-4OYJFGXL.js +21 -0
- package/dist/{watch-5RZVHAKI.js → watch-7YPB4TKC.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-CKCJU42Y.js.map +0 -1
- package/dist/chunks-LV5EJBZ4.js +0 -10
- package/dist/parse-worker-v2-YZY2GQY5.js.map +0 -1
- package/dist/pdf-ocr-WU7SZHWM.cjs +0 -31
- package/dist/seal-JIVSSI3Z.js +0 -10
- package/dist/visual-BKVZN6HP.js +0 -21
- /package/dist/{-VEOO4BOM.js.map → -SRNEV7LS.js.map} +0 -0
- /package/dist/{chunk-P35SCAJN.js.map → chunk-3HN65YAL.js.map} +0 -0
- /package/dist/{chunk-H5PDQ66I.js.map → chunk-4745MFQU.js.map} +0 -0
- /package/dist/{chunk-ENCAYXDI.js.map → chunk-4XC4O7FJ.js.map} +0 -0
- /package/dist/{chunk-EN3PK6OT.js.map → chunk-7NTMM6PO.js.map} +0 -0
- /package/dist/{chunk-ZGNHJCDR.js.map → chunk-E6VBLBOO.js.map} +0 -0
- /package/dist/{chunk-O2SLKE4L.js.map → chunk-E7B5CXYI.js.map} +0 -0
- /package/dist/{chunk-PX6X4YOR.js.map → chunk-JMOAMKAR.js.map} +0 -0
- /package/dist/{chunk-P6FNIU5P.js.map → chunk-KUC5I5MB.js.map} +0 -0
- /package/dist/{chunk-Z5G6QNVH.js.map → chunk-LMEF7FN5.js.map} +0 -0
- /package/dist/{chunk-OJISMR2Z.js.map → chunk-M46PB75E.js.map} +0 -0
- /package/dist/{chunk-G4HWEM6Q.js.map → chunk-MHNJOJQV.js.map} +0 -0
- /package/dist/{chunk-Z62PHCSU.js.map → chunk-NJ5RUDCW.js.map} +0 -0
- /package/dist/{chunk-DM5YPONO.js.map → chunk-NMFFIUI6.js.map} +0 -0
- /package/dist/{chunk-IZYYKE5F.js.map → chunk-R2GIGE5H.js.map} +0 -0
- /package/dist/{chunk-55DOBEGD.js.map → chunk-RIRPLFPN.js.map} +0 -0
- /package/dist/{chunk-3M2BIQLZ.js.map → chunk-TDMBTG7U.js.map} +0 -0
- /package/dist/{chunk-6YDPTTIY.js.map → chunk-TW3V6FSH.js.map} +0 -0
- /package/dist/{chunk-SRUBDR3Z.js.map → chunk-VPSF5LEM.js.map} +0 -0
- /package/dist/{chunk-4VPN5MHS.js.map → chunk-W24TJJNN.js.map} +0 -0
- /package/dist/{chunk-DBPDAG7N.js.map → chunk-WDSTW3BD.js.map} +0 -0
- /package/dist/{chunk-XLY5ZJRP.js.map → chunk-WJAFE3Z6.js.map} +0 -0
- /package/dist/{chunks-LV5EJBZ4.js.map → chunks-AL4P5TO5.js.map} +0 -0
- /package/dist/{formula-4GRNVWIQ.js.map → formula-DSB574H7.js.map} +0 -0
- /package/dist/{formula-6Y467S4R.js.map → formula-U2LZ67KI.js.map} +0 -0
- /package/dist/{image-ocr-CGJJCD4E.js.map → image-ocr-3QB2HLSI.js.map} +0 -0
- /package/dist/{image-ocr-ZLL66KNO.js.map → image-ocr-J54Q3YWP.js.map} +0 -0
- /package/dist/{model-bundle-RD4KSNTB.js.map → model-bundle-CGWU4ALC.js.map} +0 -0
- /package/dist/{models-OLGCZBXI.js.map → models-A3TF3BDV.js.map} +0 -0
- /package/dist/{parser-IHCFHLHN.js.map → parser-C3ARF26I.js.map} +0 -0
- /package/dist/{parser-J22QBXPP.js.map → parser-OBGWEWSU.js.map} +0 -0
- /package/dist/{pdf-ocr-H2247ZZH.js.map → pdf-ocr-ENLVEEYL.js.map} +0 -0
- /package/dist/{pdf-ocr-TYIH23RP.js.map → pdf-ocr-K53REDNY.js.map} +0 -0
- /package/dist/{profile-io-GH3TYTNJ.js.map → profile-io-ZGFEO7CB.js.map} +0 -0
- /package/dist/{rasterize-7TFTVFMB.js.map → rasterize-QMC2SAUT.js.map} +0 -0
- /package/dist/{redact-doc-DSSQOO3A.js.map → redact-doc-JH6RZZBE.js.map} +0 -0
- /package/dist/{render-NKXZQINI.js.map → render-ZGKQLKPJ.js.map} +0 -0
- /package/dist/{seal-JIVSSI3Z.js.map → seal-KMGYTJAV.js.map} +0 -0
- /package/dist/{setup-JVLMX2TH.js.map → setup-LAQGCYQ2.js.map} +0 -0
- /package/dist/{visual-BKVZN6HP.js.map → visual-4OYJFGXL.js.map} +0 -0
- /package/dist/{watch-5RZVHAKI.js.map → watch-7YPB4TKC.js.map} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
loadSharp,
|
|
4
4
|
rasterizePageSvg
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-E6VBLBOO.js";
|
|
6
6
|
import {
|
|
7
7
|
inlineImagesIntoMarkdown
|
|
8
8
|
} from "./chunk-VKVDMH7X.js";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
HEADING_RATIO_H3,
|
|
17
17
|
tidyScriptTags,
|
|
18
18
|
unframeLayoutTables
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-KUC5I5MB.js";
|
|
20
20
|
import {
|
|
21
21
|
MAX_COLS,
|
|
22
22
|
MAX_ROWS,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
mapPuaText,
|
|
33
33
|
markNonLayoutTable,
|
|
34
34
|
romanNumeral
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-WDSTW3BD.js";
|
|
36
36
|
import {
|
|
37
37
|
DEFAULT_CHAR,
|
|
38
38
|
DEFAULT_PARA_GEOM,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
hwpxAppMajor,
|
|
47
47
|
parseRenderStyles,
|
|
48
48
|
readZipEntry
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-RIRPLFPN.js";
|
|
50
50
|
import {
|
|
51
51
|
KordocError,
|
|
52
52
|
compareSectionPaths,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
precheckZipSize,
|
|
55
55
|
sanitizeHref,
|
|
56
56
|
toArrayBuffer
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-LMEF7FN5.js";
|
|
58
58
|
|
|
59
59
|
// src/render/svg-render.ts
|
|
60
60
|
import JSZip from "jszip";
|
|
@@ -130,7 +130,7 @@ function tableColumnBoundaries(constraints, count, total, noExactRow = false) {
|
|
|
130
130
|
const lp = longestPathBoundaries(constraints, count);
|
|
131
131
|
return lp && Math.abs(lp.x[count] - total) <= 2 && (noExactRow || lp.x.every((v, k) => Math.abs(v - prop[k]) <= 2 || lp.tight[k])) ? lp.x : prop;
|
|
132
132
|
}
|
|
133
|
-
function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY) {
|
|
133
|
+
function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY, shrinkLast = false) {
|
|
134
134
|
const h = new Array(rowCount).fill(0);
|
|
135
135
|
for (const c of cells) {
|
|
136
136
|
if (c.rowSpan === 1 && c.rowAddr >= 0 && c.rowAddr < rowCount) {
|
|
@@ -177,6 +177,9 @@ function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY) {
|
|
|
177
177
|
total += add;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
+
const last = rowCount - 1, over = total - maxTotal;
|
|
181
|
+
const lastCells = cells.filter((c) => c.rowAddr + c.rowSpan - 1 === last);
|
|
182
|
+
if (shrinkLast && over > 0 && last >= 0 && lastCells.length && lastCells.every((c) => c.rowSpan === 1 && c.contentH != null && c.contentH <= h[last] - over)) h[last] -= over;
|
|
180
183
|
return h;
|
|
181
184
|
}
|
|
182
185
|
|
|
@@ -11443,9 +11446,9 @@ function cellContentExtent(cell, memo) {
|
|
|
11443
11446
|
const pos = findChildByLocalName(o.el, "pos");
|
|
11444
11447
|
if ((pos?.getAttribute("vertRelTo") ?? "PARA") !== "PARA") continue;
|
|
11445
11448
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
11446
|
-
const pushed = baseV - (num(om, "top") + o.height + num(om, "bottom"));
|
|
11447
|
-
const anchor = pushed >= (paraStart > 0 ? paraStart - 100 : -100) ? pushed : baseV - (memo?.paraGeom?.get(p.getAttribute("paraPrIDRef") ?? "")?.spaceBefore ?? 0);
|
|
11448
11449
|
const vo = num(pos, "vertOffset");
|
|
11450
|
+
const pushed = baseV - (Math.max(0, vo) + num(om, "top") + o.height + num(om, "bottom"));
|
|
11451
|
+
const anchor = pushed >= (paraStart > 0 ? paraStart - 100 : -100) ? pushed : baseV - (memo?.paraGeom?.get(p.getAttribute("paraPrIDRef") ?? "")?.spaceBefore ?? 0);
|
|
11449
11452
|
const oh = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
11450
11453
|
ext = Math.max(ext, anchor + num(om, "top") + Math.max(0, vo) + oh);
|
|
11451
11454
|
}
|
|
@@ -11491,6 +11494,21 @@ function collectCells(tbl) {
|
|
|
11491
11494
|
}
|
|
11492
11495
|
return cells;
|
|
11493
11496
|
}
|
|
11497
|
+
function inCell(el) {
|
|
11498
|
+
for (let n = el.parentNode; n; n = n.parentNode) if (ln(n) === "tc") return true;
|
|
11499
|
+
return false;
|
|
11500
|
+
}
|
|
11501
|
+
function splitSaved(c) {
|
|
11502
|
+
let prev = Number.NEGATIVE_INFINITY;
|
|
11503
|
+
for (const p of c.sub ? elements(c.sub) : []) {
|
|
11504
|
+
if (ln(p) !== "p") continue;
|
|
11505
|
+
for (const s of buildPara(p).segs) {
|
|
11506
|
+
if (s.vertpos < prev) return true;
|
|
11507
|
+
prev = s.vertpos;
|
|
11508
|
+
}
|
|
11509
|
+
}
|
|
11510
|
+
return false;
|
|
11511
|
+
}
|
|
11494
11512
|
function measureTableRowHeights(tbl, memo) {
|
|
11495
11513
|
const cells = collectCells(tbl);
|
|
11496
11514
|
if (cells.length === 0 || cells.length > 4096) return [];
|
|
@@ -11501,7 +11519,8 @@ function measureTableRowHeights(tbl, memo) {
|
|
|
11501
11519
|
// (같은 판 PDF: 두 줄 든 2행 병합 칸 내용 2882 > 저장 2564 → 둘째 행이 318 자라고 첫 행은 그대로)
|
|
11502
11520
|
cells.map((c) => ({ rowAddr: c.ra, rowSpan: c.rs, height: (c.rs > 1 ? Math.max(c.h, cellContentExtent(c, memo) + c.marginT + c.marginB) : c.h) - sp * (c.rs - 1), contentH: c.rs === 1 ? cellContentExtent(c, memo) + c.marginT + c.marginB : void 0 })),
|
|
11503
11521
|
nRows,
|
|
11504
|
-
num(findChildByLocalName(tbl, "sz"), "height") - (sp > 0 ? sp * (nRows + 1) : 0) || Number.POSITIVE_INFINITY
|
|
11522
|
+
num(findChildByLocalName(tbl, "sz"), "height") - (sp > 0 ? sp * (nRows + 1) : 0) || Number.POSITIVE_INFINITY,
|
|
11523
|
+
!inCell(tbl) && !cells.some((c) => c.ra + c.rs === nRows && splitSaved(c))
|
|
11505
11524
|
);
|
|
11506
11525
|
if (sp > 0) {
|
|
11507
11526
|
for (let r = 0; r < rows.length; r++) rows[r] += sp;
|
|
@@ -13461,7 +13480,8 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
|
|
|
13461
13480
|
rem = Math.max(rem, end - ls[k][0] + c.marginT + c.marginB);
|
|
13462
13481
|
}
|
|
13463
13482
|
if (allFit) {
|
|
13464
|
-
|
|
13483
|
+
const spanCells = cells.filter((c) => c.ra === r && c.rs > 1);
|
|
13484
|
+
if (!first && h <= pageBottom - contTop && [...rowCells, ...spanCells].some((c) => cellContentExtent(c) + c.marginT + c.marginB > avail)) {
|
|
13465
13485
|
page++;
|
|
13466
13486
|
y = contTop;
|
|
13467
13487
|
first = true;
|
|
@@ -13659,9 +13679,11 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
|
|
|
13659
13679
|
function linePushedBy(o, lineV, paraTop) {
|
|
13660
13680
|
if (paraTop === void 0) return false;
|
|
13661
13681
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
13662
|
-
|
|
13682
|
+
const pos = findChildByLocalName(o.el, "pos");
|
|
13683
|
+
const raw = num(pos, "vertOffset"), vo = (pos?.getAttribute("vertRelTo") ?? "PARA") === "PARA" ? Math.max(0, raw >= 2 ** 31 ? raw - 2 ** 32 : raw) : 0;
|
|
13684
|
+
return Math.abs(lineV - (vo + num(om, "top") + o.height + num(om, "bottom")) - paraTop) <= 10;
|
|
13663
13685
|
}
|
|
13664
|
-
function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV,
|
|
13686
|
+
function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, lineH, lineSB = 0) {
|
|
13665
13687
|
const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
|
|
13666
13688
|
const pos = findChildByLocalName(o.el, "pos");
|
|
13667
13689
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
@@ -13683,13 +13705,14 @@ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = fals
|
|
|
13683
13705
|
y = va === "BOTTOM" ? MT + BODY_H - h - vo : va === "CENTER" ? MT + (BODY_H - h) / 2 + vo : MT + vo;
|
|
13684
13706
|
} else if (wrap === "TOP_AND_BOTTOM") {
|
|
13685
13707
|
const lineV = anchorLineV ?? baseV;
|
|
13686
|
-
const pushed = lineV - (omT + h + omB);
|
|
13687
|
-
const below =
|
|
13688
|
-
const anchor = below ? lineV : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
|
|
13708
|
+
const pushed = lineV - (vo + omT + h + omB);
|
|
13709
|
+
const below = lineH !== void 0 && vo + omT >= lineH && !(paraStartV !== void 0 && Math.abs(pushed - paraStartV) <= 10);
|
|
13710
|
+
const anchor = below ? lineV - lineSB : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
|
|
13689
13711
|
y = oy + anchor + omT + vo;
|
|
13690
13712
|
} else {
|
|
13691
13713
|
const origin = vrel === "PARA" && wrap === "SQUARE" ? paraStartV ?? baseV : baseV;
|
|
13692
|
-
|
|
13714
|
+
const later = vrel === "PARA" && wrap === "SQUARE" && anchorLineV !== void 0 && anchorLineV > baseV;
|
|
13715
|
+
y = later ? oy + anchorLineV + vo + omT : oy + Math.max(origin + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
|
|
13693
13716
|
}
|
|
13694
13717
|
let x;
|
|
13695
13718
|
const omL = num(om, "left"), omR = num(om, "right");
|
|
@@ -14525,6 +14548,7 @@ function planLines(m, styles, numText = "") {
|
|
|
14525
14548
|
}
|
|
14526
14549
|
if (fixedTo > start) fixedW = lineNaturalWidth(m, styles, start, fixedTo).text + [...tabs.values()].reduce((a, b) => a + b, 0);
|
|
14527
14550
|
let textEnd = Math.min(end, m.chars.length);
|
|
14551
|
+
while (textEnd > fixedTo && m.chars[textEnd - 1].br) textEnd--;
|
|
14528
14552
|
while (textEnd > fixedTo && m.chars[textEnd - 1].ch === " ") textEnd--;
|
|
14529
14553
|
const nat = lineNaturalWidth(m, styles, fixedTo, textEnd);
|
|
14530
14554
|
for (const o of m.objs) if (o.inline && o.index >= textEnd && o.index < end) nat.obj += o.omL + o.width + o.omR;
|
|
@@ -14744,6 +14768,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
14744
14768
|
if (gOpenOn >= 0) ctx.pages[gOpenOn].push("</g>");
|
|
14745
14769
|
if (paraRegionId) ctx.parentStack.push(paraRegionId);
|
|
14746
14770
|
let tbStack;
|
|
14771
|
+
let tbStackTop;
|
|
14747
14772
|
for (const o of m.objs) {
|
|
14748
14773
|
if (o.inline) {
|
|
14749
14774
|
let planIdx = 0;
|
|
@@ -14788,21 +14813,26 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
14788
14813
|
const sbA = m.paraPrId != null ? ctx.styles.paraGeom.get(m.paraPrId)?.spaceBefore ?? 0 : 0;
|
|
14789
14814
|
if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, anchorLineV ?? baseV, pTop ?? (depth > 0 ? cellParaTop(p, ctx.styles.paraGeom) : void 0))) stay = false;
|
|
14790
14815
|
const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
|
|
14791
|
-
let { x, y } = anchorObject(o, ax, oy, objBaseV, aw, ctx, anchorLineV, stay ? sbA : false, (firstLine || wrapA === "SQUARE") && pTop !== void 0 && pTop < baseV ? pTop : void 0, firstLine ?
|
|
14792
|
-
|
|
14816
|
+
let { x, y } = anchorObject(o, ax, oy, objBaseV, aw, ctx, anchorLineV, stay ? sbA : false, (firstLine || wrapA === "SQUARE") && pTop !== void 0 && pTop < baseV ? pTop : void 0, anchorLineH, firstLine ? sbA : 0);
|
|
14817
|
+
let stackTop = depth === 0 ? pTop ?? 0 : cellParaTop(p, ctx.styles.paraGeom);
|
|
14818
|
+
if (tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM" && stackTop !== void 0) {
|
|
14793
14819
|
if (!tbStack) {
|
|
14794
14820
|
tbStack = /* @__PURE__ */ new Map();
|
|
14795
|
-
|
|
14821
|
+
const placed = [];
|
|
14796
14822
|
const stackable = m.objs.filter((q) => !q.inline && (q.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM") === "TOP_AND_BOTTOM" && (findChildByLocalName(q.el, "pos")?.getAttribute("vertRelTo") ?? "PARA") === "PARA" && findChildByLocalName(q.el, "pos")?.getAttribute("allowOverlap") !== "1");
|
|
14797
14823
|
for (const q of stackable.length >= 2 ? stackable.sort((a, b) => a.index - b.index) : []) {
|
|
14798
|
-
const
|
|
14799
|
-
const
|
|
14824
|
+
const posQ = findChildByLocalName(q.el, "pos"), omQ = findChildByLocalName(q.el, "outMargin"), raw = num(posQ, "vertOffset");
|
|
14825
|
+
const x0 = num(posQ, "horzOffset"), x1 = x0 + num(omQ, "left") + q.width + num(omQ, "right");
|
|
14826
|
+
const below = Math.max(0, ...placed.filter((r) => r.x0 < x1 && x0 < r.x1).map((r) => r.bottom));
|
|
14827
|
+
const top = Math.max(below, depth > 0 ? Math.max(0, raw) : raw);
|
|
14800
14828
|
tbStack.set(q.el, top + num(omQ, "top"));
|
|
14801
|
-
|
|
14829
|
+
placed.push({ x0, x1, bottom: top + num(omQ, "top") + (q.tag === "tbl" ? Math.max(q.height, measureTableHeight(q.el, ctx.extentMemo)) : q.height) + num(omQ, "bottom") });
|
|
14802
14830
|
}
|
|
14831
|
+
if (depth > 0 && placed.length) tbStackTop = Math.max(stackTop, baseV - Math.max(...placed.map((r) => r.bottom)));
|
|
14803
14832
|
}
|
|
14833
|
+
if (depth > 0 && tbStackTop !== void 0) stackTop = tbStackTop;
|
|
14804
14834
|
const st = tbStack.get(o.el);
|
|
14805
|
-
if (st !== void 0) y = oy +
|
|
14835
|
+
if (st !== void 0) y = oy + stackTop + st;
|
|
14806
14836
|
}
|
|
14807
14837
|
const moved = ctx.objPlace?.get(o.el);
|
|
14808
14838
|
if (moved) {
|
|
@@ -15025,7 +15055,7 @@ function drawTable(tbl, tx, ty, ctx, depth) {
|
|
|
15025
15055
|
const slack = ctx.geom.PH - ctx.geom.MT - ctx.geom.BODY_H;
|
|
15026
15056
|
const splitHere = depth === 1 || !!ctx.splitCell && findChildByLocalName(tbl, "pos")?.getAttribute("treatAsChar") !== "1";
|
|
15027
15057
|
const plan = splitHere ? planTableRows(tbl, cells, rowH, ty, ctx.geom.MT, ctx.geom.BODY_H, slack, cellFloatSpan(ctx.geom.MT, ctx.geom.BODY_H, ctx.extentMemo, slack), depth !== 1, depth !== 1 && ctx.splitContMT !== void 0 ? ctx.splitContMT : ctx.geom.MT) : rowH.map((h, r) => [{ page: 0, y: ty + rowY[r], h }]);
|
|
15028
|
-
const
|
|
15058
|
+
const splitSaved2 = ctx.splitCell;
|
|
15029
15059
|
ctx.splitCell = false;
|
|
15030
15060
|
for (const pc of plan.flat()) for (const [el, py] of pc.place ?? []) (ctx.objPlace ??= /* @__PURE__ */ new Map()).set(el, { page: startPage + pc.page, y: py });
|
|
15031
15061
|
const contPages = [...new Set(plan.flat().map((pc) => pc.page).filter((pg) => pg > 0))].map((pg) => startPage + pg);
|
|
@@ -15145,7 +15175,7 @@ function drawTable(tbl, tx, ty, ctx, depth) {
|
|
|
15145
15175
|
if (bf.right) emit(ctx, edgeLine(g.x + g.w, g.y, g.x + g.w, g.y + g.h, bf.right));
|
|
15146
15176
|
}
|
|
15147
15177
|
ctx.page = startPage;
|
|
15148
|
-
ctx.splitCell =
|
|
15178
|
+
ctx.splitCell = splitSaved2;
|
|
15149
15179
|
ctx.parentStack.pop();
|
|
15150
15180
|
emit(ctx, "</g>");
|
|
15151
15181
|
}
|
|
@@ -15304,6 +15334,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
15304
15334
|
}
|
|
15305
15335
|
const paraSegPages = /* @__PURE__ */ new Map();
|
|
15306
15336
|
const paraTops = /* @__PURE__ */ new Map();
|
|
15337
|
+
const backPlace = /* @__PURE__ */ new Map();
|
|
15307
15338
|
const geom0 = ctxBase.styles.paraGeom;
|
|
15308
15339
|
let tableEndPage = -1;
|
|
15309
15340
|
let nPages = 1;
|
|
@@ -15315,6 +15346,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
15315
15346
|
let cur = 0, col = 0;
|
|
15316
15347
|
let pendingEnd = 0, pendingEndY = 0;
|
|
15317
15348
|
let lastEnd = 0, lastPage = -1;
|
|
15349
|
+
let lastSA = 0;
|
|
15318
15350
|
let prevSeg;
|
|
15319
15351
|
for (const p of elements(root)) {
|
|
15320
15352
|
if (ln(p) !== "p") continue;
|
|
@@ -15352,6 +15384,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
15352
15384
|
if (prevSeg.p !== p) {
|
|
15353
15385
|
lastPage = cur;
|
|
15354
15386
|
lastEnd = v;
|
|
15387
|
+
lastSA = 0;
|
|
15355
15388
|
}
|
|
15356
15389
|
}
|
|
15357
15390
|
}
|
|
@@ -15365,11 +15398,13 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
15365
15398
|
prevEnd = v + num(s, "vertsize") + num(s, "spacing");
|
|
15366
15399
|
}
|
|
15367
15400
|
paraSegPages.set(p, pagesOf);
|
|
15368
|
-
|
|
15401
|
+
const prevEnd0 = lastEnd, prevPage0 = lastPage;
|
|
15402
|
+
if (segEls.length) paraTops.set(p, pagesOf[0] === lastPage ? lastEnd + lastSA : 0);
|
|
15369
15403
|
if (segEls.length) {
|
|
15370
15404
|
const ls = segEls[segEls.length - 1];
|
|
15371
15405
|
lastEnd = num(ls, "vertpos") + num(ls, "vertsize") + num(ls, "spacing");
|
|
15372
15406
|
lastPage = pagesOf[pagesOf.length - 1];
|
|
15407
|
+
lastSA = geom0.get(p.getAttribute("paraPrIDRef") ?? "")?.spaceAfter ?? 0;
|
|
15373
15408
|
}
|
|
15374
15409
|
if (!localCols && segEls.length) {
|
|
15375
15410
|
const m0 = buildPara(p);
|
|
@@ -15381,6 +15416,13 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
15381
15416
|
const segV = num(segEls[segK], "vertpos");
|
|
15382
15417
|
const h = Math.max(o.height, measureTableHeight(o.el, ctxBase.extentMemo)), omT = num(om, "top"), omB = num(om, "bottom");
|
|
15383
15418
|
const pushed = segV - (omT + h + omB);
|
|
15419
|
+
if (!o.inline && segK === 0 && pushed < -100 && prevPage0 >= 0 && pagesOf[0] === prevPage0 + 1 && (o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM") === "TOP_AND_BOTTOM") {
|
|
15420
|
+
const back = tableContPages(o.el, MT + prevEnd0 + omT, MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H, cellFloatSpan(MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H));
|
|
15421
|
+
if (back.pages === 1 && Math.abs(back.endY - MT + omB - segV) <= 300) {
|
|
15422
|
+
backPlace.set(o.el, { page: prevPage0, y: MT + prevEnd0 + omT });
|
|
15423
|
+
continue;
|
|
15424
|
+
}
|
|
15425
|
+
}
|
|
15384
15426
|
const nTb = m0.objs.filter((q) => !q.inline && (q.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM") === "TOP_AND_BOTTOM").length;
|
|
15385
15427
|
const wrapP = o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM";
|
|
15386
15428
|
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? geom0.get(m0.paraPrId)?.spaceBefore ?? 0 : 0;
|
|
@@ -15388,7 +15430,8 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
15388
15430
|
const nonPush = wrapP !== "TOP_AND_BOTTOM" && pTop !== void 0 && segV > pTop + sbP + 100 ? pTop + sbP : void 0;
|
|
15389
15431
|
const voP = Math.max(0, toInt32(pos?.getAttribute("vertOffset") ?? void 0, 0));
|
|
15390
15432
|
const paraStart = segK === 0 && pTop !== void 0 && pTop < segV ? pTop : segV;
|
|
15391
|
-
const
|
|
15433
|
+
const below = !o.inline && wrapP === "TOP_AND_BOTTOM" && voP + omT >= num(segEls[segK], "textheight") && !linePushedBy(o, segV, pTop);
|
|
15434
|
+
const ty = o.inline ? MT + segV + omT : nonPush !== void 0 ? MT + nonPush + omT + voP : MT + (below ? segV - (segK === 0 ? sbP : 0) : stay ? segV - sbP : pushed - voP >= -100 ? pushed - voP : paraStart) + omT + voP;
|
|
15392
15435
|
const span = tableContPages(o.el, ty, MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H, cellFloatSpan(MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H));
|
|
15393
15436
|
const anchorPage = pagesOf[segK];
|
|
15394
15437
|
const sp = !o.inline && !stay && nonPush === void 0 && segV - (omT + o.height + omB) >= -100 && pagesOf.some((pg, j) => j > segK && pg > anchorPage) ? tableContPages(o.el, MT + segV - o.height - omB, MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H, cellFloatSpan(MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H)) : void 0;
|
|
@@ -15473,6 +15516,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
15473
15516
|
if (geom.mirrorDx) ctx.bodyDx = mirrorDx;
|
|
15474
15517
|
ctx.cols = multiCol ? { w: colW, gap: colGap } : void 0;
|
|
15475
15518
|
ctx.paraTops = paraTops;
|
|
15519
|
+
if (backPlace.size) ctx.objPlace = new Map([...ctx.objPlace ?? [], ...backPlace]);
|
|
15476
15520
|
for (const p of elements(root)) {
|
|
15477
15521
|
if (ln(p) !== "p") continue;
|
|
15478
15522
|
drawPara(p, ML, MT, BODY_W, ctx, 0, paraSegPages.get(p));
|
|
@@ -15592,7 +15636,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
15592
15636
|
const side = decl.el.getAttribute("sideChar") ?? "";
|
|
15593
15637
|
const pnId = ctx.styles.pageNumCharPr ?? decl.prId;
|
|
15594
15638
|
const st = (pnId != null ? ctx.styles.charPr.get(pnId) : void 0) ?? DEFAULT_CHAR;
|
|
15595
|
-
const {
|
|
15639
|
+
const { PH, ML, BODY_W } = ctx.geom;
|
|
15596
15640
|
const pagePr = findFirst(root, "pagePr"), margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
15597
15641
|
const h = 1e3;
|
|
15598
15642
|
for (let page = decl.page; page < ctx.pages.length; page++) {
|
|
@@ -15600,7 +15644,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
15600
15644
|
const n = ctx.pageBase + page + 1;
|
|
15601
15645
|
const text = side ? `${side} ${formatHeadNumber2(n, decl.el.getAttribute("formatType") ?? "DIGIT")} ${side}` : formatHeadNumber2(n, decl.el.getAttribute("formatType") ?? "DIGIT");
|
|
15602
15646
|
const w = measureTextWidth(text, h, 100, { faceClass: faceClassOf(st.face) });
|
|
15603
|
-
const x = /LEFT/.test(pos) ? ML : /RIGHT/.test(pos) ? ML + BODY_W - w : (
|
|
15647
|
+
const x = /LEFT/.test(pos) ? ML : /RIGHT/.test(pos) ? ML + BODY_W - w : ML + (BODY_W - w) / 2;
|
|
15604
15648
|
const y = /^TOP/.test(pos) ? num(margin, "top", 5668) - 225 : num(margin, "footer", 0) > 0 ? PH - num(margin, "bottom", 4252) - 225 : PH - Math.round(num(margin, "bottom", 4252) / 2) - 243;
|
|
15605
15649
|
const attrs = [`x="${pt2(x)}"`, `y="${pt2(y)}"`, `font-size="${pt2(h)}"`];
|
|
15606
15650
|
if (st.fontFamily) attrs.push(`font-family="${escapeXml(st.fontFamily)}"`);
|
|
@@ -19918,4 +19962,4 @@ export {
|
|
|
19918
19962
|
cropRect,
|
|
19919
19963
|
extractRenderedRegions
|
|
19920
19964
|
};
|
|
19921
|
-
//# sourceMappingURL=chunk-
|
|
19965
|
+
//# sourceMappingURL=chunk-DHMBPMKC.js.map
|