@forevka/wordcanvas 0.8.1 → 0.9.0
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/dist-lib/assets/{worker-BFAbWoje.js → worker-VdvO3cMW.js} +1198 -1182
- package/dist-lib/builder.js +5 -5
- package/dist-lib/{editorApp-CQn18PAu.js → editorApp-BGyP48-P.js} +37 -36
- package/dist-lib/{recalcToc-Dzz8cQho.js → engine-Chvebzwr.js} +525 -548
- package/dist-lib/export.js +8 -7
- package/dist-lib/generate-toc.js +7 -6
- package/dist-lib/import.js +2 -2
- package/dist-lib/{lists-DpmgbDyt.js → lists-BVCy5dMa.js} +2 -2
- package/dist-lib/{parse-CIuWi88O.js → parse-PD2rg4oO.js} +28 -28
- package/dist-lib/{pipeline-DQil8qUX.js → pipeline-r7GVSMFb.js} +60 -60
- package/dist-lib/query.js +977 -0
- package/dist-lib/recalc-docx.js +22 -21
- package/dist-lib/recalcToc-CAeOzLr3.js +37 -0
- package/dist-lib/{stylesheet-BeM16Mvj.js → stylesheet-IH4Hyc8o.js} +3 -3
- package/dist-lib/{toc-C-JErW1U.js → toc-B-TzD-Mr.js} +102 -86
- package/dist-lib/{webmcp-B9Q6w0Vl.js → webmcp-CDpzmTtU.js} +2 -2
- package/dist-lib/{wordcanvas-Cla5Ys8Y.js → wordcanvas-CIqBAV2w.js} +3 -3
- package/dist-lib/wordcanvas.js +1 -1
- package/dist-node/{chunk-JVSPB6WM.js → chunk-A53KB3BE.js} +2 -2
- package/dist-node/{chunk-HMBQQDXD.js → chunk-TLGEFCLV.js} +64 -1
- package/dist-node/chunk-TLGEFCLV.js.map +7 -0
- package/dist-node/{chunk-KZHUXFDE.js → chunk-VNDCELYX.js} +5 -45
- package/dist-node/chunk-VNDCELYX.js.map +7 -0
- package/dist-node/{engine-46GL2RKU.js → engine-QKH45ZHY.js} +5 -4
- package/dist-node/export.js +3 -3
- package/dist-node/generate-toc.js +3 -3
- package/dist-node/import.js +2 -2
- package/dist-node/recalc-docx.js +2 -2
- package/package.json +6 -2
- package/types/builder.d.ts +47 -2
- package/types/model.d.ts +34 -0
- package/types/query.d.ts +416 -0
- package/dist-node/chunk-HMBQQDXD.js.map +0 -7
- package/dist-node/chunk-KZHUXFDE.js.map +0 -7
- /package/dist-node/{chunk-JVSPB6WM.js.map → chunk-A53KB3BE.js.map} +0 -0
- /package/dist-node/{engine-46GL2RKU.js.map → engine-QKH45ZHY.js.map} +0 -0
|
@@ -1,8 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { B as Hs, _ as Rn, M as _s } from "./toc-B-TzD-Mr.js";
|
|
2
|
+
import { c as js, f as et } from "./lists-BVCy5dMa.js";
|
|
3
3
|
import { m as de, f as ze, c as le } from "./metrics-DXaHu5bS.js";
|
|
4
|
-
import { B as
|
|
5
|
-
|
|
4
|
+
import { B as Us, V as Tn, M as ot, a1 as zs, a2 as yt, w as Ks, o as qs } from "./paintStyle-OSXohdGT.js";
|
|
5
|
+
function Gn(e, t) {
|
|
6
|
+
const n = {
|
|
7
|
+
pageWidthPx: t.pageWidthPx ?? e.pageWidthPx,
|
|
8
|
+
pageHeightPx: t.pageHeightPx ?? e.pageHeightPx,
|
|
9
|
+
marginPx: t.marginPx ?? e.marginPx
|
|
10
|
+
}, s = t.columns === void 0 ? e.columns : t.columns ?? void 0;
|
|
11
|
+
s && (n.columns = s), t.pageNumberStart !== void 0 && (n.pageNumberStart = t.pageNumberStart);
|
|
12
|
+
const r = t.headerDistancePx ?? e.headerDistancePx;
|
|
13
|
+
r !== void 0 && (n.headerDistancePx = r);
|
|
14
|
+
const i = t.footerDistancePx ?? e.footerDistancePx;
|
|
15
|
+
i !== void 0 && (n.footerDistancePx = i);
|
|
16
|
+
const o = t.pageColorHex ?? e.pageColorHex;
|
|
17
|
+
o !== void 0 && (n.pageColorHex = o);
|
|
18
|
+
const x = t.pageBorders ?? e.pageBorders;
|
|
19
|
+
x !== void 0 && (n.pageBorders = x), t.lineNumbering !== void 0 && (n.lineNumbering = t.lineNumbering);
|
|
20
|
+
for (const a of Hs) {
|
|
21
|
+
const d = t[a] ?? e[a];
|
|
22
|
+
d && (n[a] = d);
|
|
23
|
+
}
|
|
24
|
+
return n;
|
|
25
|
+
}
|
|
26
|
+
function Hn(e) {
|
|
27
|
+
const t = [];
|
|
28
|
+
let n = 0;
|
|
29
|
+
for (let s = 0; s < e.blocks.length; s++) {
|
|
30
|
+
const r = e.blocks[s];
|
|
31
|
+
r.kind === "paragraph" && r.style.sectionBreak && (t.push({
|
|
32
|
+
index: t.length,
|
|
33
|
+
props: Gn(e.section, r.style.sectionBreak.props),
|
|
34
|
+
startBlock: n,
|
|
35
|
+
endBlock: s,
|
|
36
|
+
breakType: r.style.sectionBreak.type
|
|
37
|
+
}), n = s + 1);
|
|
38
|
+
}
|
|
39
|
+
return t.push({
|
|
40
|
+
index: t.length,
|
|
41
|
+
props: e.section,
|
|
42
|
+
startBlock: n,
|
|
43
|
+
endBlock: e.blocks.length - 1,
|
|
44
|
+
breakType: e.section.breakType ?? "nextPage"
|
|
45
|
+
}), t;
|
|
46
|
+
}
|
|
47
|
+
const $s = [
|
|
6
48
|
"BN",
|
|
7
49
|
"BN",
|
|
8
50
|
"BN",
|
|
@@ -259,7 +301,7 @@ const Js = [
|
|
|
259
301
|
"L",
|
|
260
302
|
"L",
|
|
261
303
|
"L"
|
|
262
|
-
],
|
|
304
|
+
], Xt = [
|
|
263
305
|
[697, 698, "ON"],
|
|
264
306
|
[706, 719, "ON"],
|
|
265
307
|
[722, 735, "ON"],
|
|
@@ -975,12 +1017,12 @@ const Js = [
|
|
|
975
1017
|
[1048574, 1048575, "BN"],
|
|
976
1018
|
[1114110, 1114111, "BN"]
|
|
977
1019
|
];
|
|
978
|
-
function
|
|
1020
|
+
function Ys(e) {
|
|
979
1021
|
if (e <= 255)
|
|
980
|
-
return
|
|
981
|
-
let t = 0, n =
|
|
1022
|
+
return $s[e];
|
|
1023
|
+
let t = 0, n = Xt.length - 1;
|
|
982
1024
|
for (; t <= n; ) {
|
|
983
|
-
const s = t + n >> 1, r =
|
|
1025
|
+
const s = t + n >> 1, r = Xt[s];
|
|
984
1026
|
if (e < r[0]) {
|
|
985
1027
|
n = s - 1;
|
|
986
1028
|
continue;
|
|
@@ -993,7 +1035,7 @@ function Vs(e) {
|
|
|
993
1035
|
}
|
|
994
1036
|
return "L";
|
|
995
1037
|
}
|
|
996
|
-
function
|
|
1038
|
+
function Js(e, t) {
|
|
997
1039
|
const n = e.length;
|
|
998
1040
|
if (n === 0)
|
|
999
1041
|
return null;
|
|
@@ -1006,7 +1048,7 @@ function Xs(e, t) {
|
|
|
1006
1048
|
const p = e.charCodeAt(c + 1);
|
|
1007
1049
|
p >= 56320 && p <= 57343 && (h = (l - 55296 << 10) + (p - 56320) + 65536, f = 2);
|
|
1008
1050
|
}
|
|
1009
|
-
const N =
|
|
1051
|
+
const N = Ys(h);
|
|
1010
1052
|
(N === "R" || N === "AL" || N === "AN") && (r = !0);
|
|
1011
1053
|
for (let p = 0; p < f; p++)
|
|
1012
1054
|
s[c + p] = N;
|
|
@@ -1081,8 +1123,8 @@ function Xs(e, t) {
|
|
|
1081
1123
|
}
|
|
1082
1124
|
return o;
|
|
1083
1125
|
}
|
|
1084
|
-
function
|
|
1085
|
-
const s =
|
|
1126
|
+
function _n(e, t, n) {
|
|
1127
|
+
const s = Js(e, n);
|
|
1086
1128
|
if (s === null)
|
|
1087
1129
|
return null;
|
|
1088
1130
|
const r = new Int8Array(t.length);
|
|
@@ -1090,36 +1132,36 @@ function Gn(e, t, n) {
|
|
|
1090
1132
|
r[i] = s[t[i]];
|
|
1091
1133
|
return r;
|
|
1092
1134
|
}
|
|
1093
|
-
const
|
|
1094
|
-
function
|
|
1135
|
+
const Vs = /[ \t\n\r\f]+/g, Qs = /[\t\n\r\f]| {2,}|^ | $/;
|
|
1136
|
+
function Xs(e) {
|
|
1095
1137
|
const t = e ?? "normal";
|
|
1096
1138
|
return t === "pre-wrap" ? { mode: t, preserveOrdinarySpaces: !0, preserveHardBreaks: !0 } : { mode: t, preserveOrdinarySpaces: !1, preserveHardBreaks: !1 };
|
|
1097
1139
|
}
|
|
1098
|
-
function
|
|
1099
|
-
if (!
|
|
1140
|
+
function Zs(e) {
|
|
1141
|
+
if (!Qs.test(e))
|
|
1100
1142
|
return e;
|
|
1101
|
-
let t = e.replace(
|
|
1143
|
+
let t = e.replace(Vs, " ");
|
|
1102
1144
|
return t.charCodeAt(0) === 32 && (t = t.slice(1)), t.length > 0 && t.charCodeAt(t.length - 1) === 32 && (t = t.slice(0, -1)), t;
|
|
1103
1145
|
}
|
|
1104
|
-
function
|
|
1146
|
+
function ei(e) {
|
|
1105
1147
|
return /[\r\f]/.test(e) ? e.replace(/\r\n/g, `
|
|
1106
1148
|
`).replace(/[\r\f]/g, `
|
|
1107
1149
|
`) : e;
|
|
1108
1150
|
}
|
|
1109
1151
|
let _e = null, At;
|
|
1110
|
-
function
|
|
1152
|
+
function ti() {
|
|
1111
1153
|
return _e === null && (_e = new Intl.Segmenter(At, { granularity: "word" })), _e;
|
|
1112
1154
|
}
|
|
1113
|
-
function
|
|
1155
|
+
function ni() {
|
|
1114
1156
|
_e = null;
|
|
1115
1157
|
}
|
|
1116
|
-
function
|
|
1158
|
+
function si(e) {
|
|
1117
1159
|
const t = e && e.length > 0 ? e : void 0;
|
|
1118
1160
|
At !== t && (At = t, _e = null);
|
|
1119
1161
|
}
|
|
1120
|
-
const
|
|
1162
|
+
const ii = /\p{Script=Arabic}/u, De = /\p{M}/u, wt = /\p{Nd}/u;
|
|
1121
1163
|
function Zt(e) {
|
|
1122
|
-
return
|
|
1164
|
+
return ii.test(e);
|
|
1123
1165
|
}
|
|
1124
1166
|
function en(e) {
|
|
1125
1167
|
return e >= 19968 && e <= 40959 || e >= 13312 && e <= 19903 || e >= 131072 && e <= 173791 || e >= 173824 && e <= 177983 || e >= 177984 && e <= 178207 || e >= 178208 && e <= 183983 || e >= 183984 && e <= 191471 || e >= 191472 && e <= 192093 || e >= 194560 && e <= 195103 || e >= 196608 && e <= 201551 || e >= 201552 && e <= 205743 || e >= 205744 && e <= 210041 || e >= 63744 && e <= 64255 || e >= 12288 && e <= 12351 || e >= 12352 && e <= 12447 || e >= 12448 && e <= 12543 || e >= 12592 && e <= 12687 || e >= 44032 && e <= 55215 || e >= 65280 && e <= 65519;
|
|
@@ -1144,31 +1186,31 @@ function fe(e) {
|
|
|
1144
1186
|
}
|
|
1145
1187
|
return !1;
|
|
1146
1188
|
}
|
|
1147
|
-
function
|
|
1189
|
+
function ri(e) {
|
|
1148
1190
|
const t = $e(e);
|
|
1149
1191
|
return t !== null && (Dt.has(t) || we.has(t));
|
|
1150
1192
|
}
|
|
1151
|
-
const
|
|
1193
|
+
const oi = /* @__PURE__ */ new Set([
|
|
1152
1194
|
" ",
|
|
1153
1195
|
" ",
|
|
1154
1196
|
"",
|
|
1155
1197
|
"\uFEFF"
|
|
1156
|
-
]),
|
|
1198
|
+
]), ci = /* @__PURE__ */ new Set([
|
|
1157
1199
|
"-",
|
|
1158
1200
|
"‐",
|
|
1159
1201
|
"–",
|
|
1160
1202
|
"—"
|
|
1161
1203
|
]);
|
|
1162
|
-
function
|
|
1204
|
+
function li(e) {
|
|
1163
1205
|
const t = $e(e);
|
|
1164
|
-
return t !== null &&
|
|
1206
|
+
return t !== null && oi.has(t);
|
|
1165
1207
|
}
|
|
1166
|
-
function
|
|
1208
|
+
function ai(e) {
|
|
1167
1209
|
const t = $e(e);
|
|
1168
|
-
return t !== null &&
|
|
1210
|
+
return t !== null && ci.has(t);
|
|
1169
1211
|
}
|
|
1170
|
-
function
|
|
1171
|
-
return
|
|
1212
|
+
function jn(e, t) {
|
|
1213
|
+
return li(e) ? !1 : t ? !(ri(e) || ai(e)) : !0;
|
|
1172
1214
|
}
|
|
1173
1215
|
const Dt = /* @__PURE__ */ new Set([
|
|
1174
1216
|
",",
|
|
@@ -1251,14 +1293,14 @@ const Dt = /* @__PURE__ */ new Set([
|
|
|
1251
1293
|
"»",
|
|
1252
1294
|
"›",
|
|
1253
1295
|
"…"
|
|
1254
|
-
]),
|
|
1296
|
+
]), xi = /* @__PURE__ */ new Set([
|
|
1255
1297
|
":",
|
|
1256
1298
|
".",
|
|
1257
1299
|
"،",
|
|
1258
1300
|
"؛"
|
|
1259
|
-
]),
|
|
1301
|
+
]), fi = /* @__PURE__ */ new Set([
|
|
1260
1302
|
"၏"
|
|
1261
|
-
]),
|
|
1303
|
+
]), ui = /* @__PURE__ */ new Set([
|
|
1262
1304
|
"”",
|
|
1263
1305
|
"’",
|
|
1264
1306
|
"»",
|
|
@@ -1271,7 +1313,7 @@ const Dt = /* @__PURE__ */ new Set([
|
|
|
1271
1313
|
"〕",
|
|
1272
1314
|
")"
|
|
1273
1315
|
]);
|
|
1274
|
-
function
|
|
1316
|
+
function hi(e) {
|
|
1275
1317
|
if (Ot(e))
|
|
1276
1318
|
return !0;
|
|
1277
1319
|
let t = !1;
|
|
@@ -1285,13 +1327,13 @@ function pi(e) {
|
|
|
1285
1327
|
}
|
|
1286
1328
|
return t;
|
|
1287
1329
|
}
|
|
1288
|
-
function
|
|
1330
|
+
function di(e) {
|
|
1289
1331
|
for (const t of e)
|
|
1290
1332
|
if (!Dt.has(t) && !we.has(t))
|
|
1291
1333
|
return !1;
|
|
1292
1334
|
return e.length > 0;
|
|
1293
1335
|
}
|
|
1294
|
-
function
|
|
1336
|
+
function pi(e) {
|
|
1295
1337
|
if (Ot(e))
|
|
1296
1338
|
return !0;
|
|
1297
1339
|
for (const t of e)
|
|
@@ -1330,13 +1372,13 @@ function $e(e) {
|
|
|
1330
1372
|
const t = lt(e, e.length);
|
|
1331
1373
|
return e.slice(t);
|
|
1332
1374
|
}
|
|
1333
|
-
function
|
|
1375
|
+
function gi(e) {
|
|
1334
1376
|
for (const t of e)
|
|
1335
1377
|
if (!De.test(t))
|
|
1336
1378
|
return t;
|
|
1337
1379
|
return null;
|
|
1338
1380
|
}
|
|
1339
|
-
function
|
|
1381
|
+
function Fi(e) {
|
|
1340
1382
|
for (let t = e.length; t > 0; ) {
|
|
1341
1383
|
const n = lt(e, t), s = e.slice(n, t);
|
|
1342
1384
|
if (!De.test(s))
|
|
@@ -1345,7 +1387,7 @@ function Ni(e) {
|
|
|
1345
1387
|
}
|
|
1346
1388
|
return null;
|
|
1347
1389
|
}
|
|
1348
|
-
const
|
|
1390
|
+
const mi = [
|
|
1349
1391
|
36,
|
|
1350
1392
|
37,
|
|
1351
1393
|
43,
|
|
@@ -1413,7 +1455,7 @@ const Si = [
|
|
|
1413
1455
|
126128,
|
|
1414
1456
|
126128
|
|
1415
1457
|
];
|
|
1416
|
-
function
|
|
1458
|
+
function Ni(e, t) {
|
|
1417
1459
|
for (let n = 0; n < t.length; n += 2)
|
|
1418
1460
|
if (e >= t[n] && e <= t[n + 1])
|
|
1419
1461
|
return !0;
|
|
@@ -1421,17 +1463,17 @@ function Ai(e, t) {
|
|
|
1421
1463
|
}
|
|
1422
1464
|
function at(e) {
|
|
1423
1465
|
const t = e.codePointAt(0);
|
|
1424
|
-
return t !== void 0 &&
|
|
1466
|
+
return t !== void 0 && Ni(t, mi);
|
|
1425
1467
|
}
|
|
1426
|
-
function
|
|
1427
|
-
const t =
|
|
1468
|
+
function Si(e) {
|
|
1469
|
+
const t = Fi(e);
|
|
1428
1470
|
return t !== null && at(t);
|
|
1429
1471
|
}
|
|
1430
|
-
function
|
|
1431
|
-
const t =
|
|
1472
|
+
function Ai(e) {
|
|
1473
|
+
const t = gi(e);
|
|
1432
1474
|
return t !== null && wt.test(t);
|
|
1433
1475
|
}
|
|
1434
|
-
function
|
|
1476
|
+
function Ei(e) {
|
|
1435
1477
|
const t = Array.from(e);
|
|
1436
1478
|
let n = t.length;
|
|
1437
1479
|
for (; n > 0; ) {
|
|
@@ -1451,7 +1493,7 @@ function ki(e) {
|
|
|
1451
1493
|
tail: t.slice(n).join("")
|
|
1452
1494
|
};
|
|
1453
1495
|
}
|
|
1454
|
-
function
|
|
1496
|
+
function Mi(e, t, n) {
|
|
1455
1497
|
return n === "text" && !t && e.length === 1 && e !== "-" && e !== "—" ? e : null;
|
|
1456
1498
|
}
|
|
1457
1499
|
function tn(e, t, n, s) {
|
|
@@ -1465,13 +1507,13 @@ function tn(e, t, n, s) {
|
|
|
1465
1507
|
return e[s] = x, x;
|
|
1466
1508
|
}
|
|
1467
1509
|
function nn(e, t) {
|
|
1468
|
-
return e && t !== null &&
|
|
1510
|
+
return e && t !== null && xi.has(t);
|
|
1469
1511
|
}
|
|
1470
|
-
function
|
|
1512
|
+
function ki(e) {
|
|
1471
1513
|
const t = $e(e);
|
|
1472
|
-
return t !== null &&
|
|
1514
|
+
return t !== null && fi.has(t);
|
|
1473
1515
|
}
|
|
1474
|
-
function
|
|
1516
|
+
function Bi(e) {
|
|
1475
1517
|
if (e.length < 2 || e[0] !== " ")
|
|
1476
1518
|
return null;
|
|
1477
1519
|
const t = e.slice(1);
|
|
@@ -1481,7 +1523,7 @@ function Et(e) {
|
|
|
1481
1523
|
let t = e.length;
|
|
1482
1524
|
for (; t > 0; ) {
|
|
1483
1525
|
const n = lt(e, t), s = e.slice(n, t);
|
|
1484
|
-
if (
|
|
1526
|
+
if (ui.has(s))
|
|
1485
1527
|
return !0;
|
|
1486
1528
|
if (!we.has(s))
|
|
1487
1529
|
return !1;
|
|
@@ -1489,7 +1531,7 @@ function Et(e) {
|
|
|
1489
1531
|
}
|
|
1490
1532
|
return !1;
|
|
1491
1533
|
}
|
|
1492
|
-
function
|
|
1534
|
+
function bi(e, t) {
|
|
1493
1535
|
if (t.preserveOrdinarySpaces || t.preserveHardBreaks) {
|
|
1494
1536
|
if (e === " ")
|
|
1495
1537
|
return "preserved-space";
|
|
@@ -1501,23 +1543,23 @@ function yi(e, t) {
|
|
|
1501
1543
|
}
|
|
1502
1544
|
return e === " " ? "space" : e === " " || e === " " || e === "" || e === "\uFEFF" ? "glue" : e === "" ? "zero-width-break" : e === "" ? "soft-hyphen" : "text";
|
|
1503
1545
|
}
|
|
1504
|
-
const
|
|
1546
|
+
const Ci = /[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;
|
|
1505
1547
|
function pe(e) {
|
|
1506
1548
|
return e.length === 1 ? e[0] : e.join("");
|
|
1507
1549
|
}
|
|
1508
|
-
function
|
|
1550
|
+
function yi(e, t) {
|
|
1509
1551
|
const n = [];
|
|
1510
1552
|
for (let s = e.length - 1; s >= 0; s--)
|
|
1511
1553
|
n.push(e[s]);
|
|
1512
1554
|
return n.push(t), pe(n);
|
|
1513
1555
|
}
|
|
1514
|
-
function
|
|
1515
|
-
if (!
|
|
1556
|
+
function wi(e, t, n, s) {
|
|
1557
|
+
if (!Ci.test(e))
|
|
1516
1558
|
return [{ text: e, isWordLike: t, kind: "text", start: n }];
|
|
1517
1559
|
const r = [];
|
|
1518
1560
|
let i = null, o = [], x = n, a = !1, d = 0;
|
|
1519
1561
|
for (const c of e) {
|
|
1520
|
-
const l =
|
|
1562
|
+
const l = bi(c, s), h = l === "text" && t;
|
|
1521
1563
|
if (i !== null && l === i && h === a) {
|
|
1522
1564
|
o.push(c), d += c.length;
|
|
1523
1565
|
continue;
|
|
@@ -1539,18 +1581,18 @@ function Li(e, t, n, s) {
|
|
|
1539
1581
|
function Mt(e) {
|
|
1540
1582
|
return e === "space" || e === "preserved-space" || e === "zero-width-break" || e === "hard-break";
|
|
1541
1583
|
}
|
|
1542
|
-
const
|
|
1543
|
-
function
|
|
1584
|
+
const Di = /^[A-Za-z][A-Za-z0-9+.-]*:$/;
|
|
1585
|
+
function Li(e, t) {
|
|
1544
1586
|
const n = e.texts[t];
|
|
1545
|
-
return n.startsWith("www.") ? !0 :
|
|
1587
|
+
return n.startsWith("www.") ? !0 : Di.test(n) && t + 1 < e.len && e.kinds[t + 1] === "text" && e.texts[t + 1] === "//";
|
|
1546
1588
|
}
|
|
1547
|
-
function
|
|
1589
|
+
function Oi(e) {
|
|
1548
1590
|
return e.includes("?") && (e.includes("://") || e.startsWith("www."));
|
|
1549
1591
|
}
|
|
1550
|
-
function
|
|
1592
|
+
function Pi(e) {
|
|
1551
1593
|
const t = e.texts.slice(), n = e.isWordLike.slice(), s = e.kinds.slice(), r = e.starts.slice();
|
|
1552
1594
|
for (let o = 0; o < e.len; o++) {
|
|
1553
|
-
if (s[o] !== "text" || !
|
|
1595
|
+
if (s[o] !== "text" || !Li(e, o))
|
|
1554
1596
|
continue;
|
|
1555
1597
|
const x = [t[o]];
|
|
1556
1598
|
let a = o + 1;
|
|
@@ -1575,11 +1617,11 @@ function vi(e) {
|
|
|
1575
1617
|
starts: r
|
|
1576
1618
|
};
|
|
1577
1619
|
}
|
|
1578
|
-
function
|
|
1620
|
+
function Ii(e) {
|
|
1579
1621
|
const t = [], n = [], s = [], r = [];
|
|
1580
1622
|
for (let i = 0; i < e.len; i++) {
|
|
1581
1623
|
const o = e.texts[i];
|
|
1582
|
-
if (t.push(o), n.push(e.isWordLike[i]), s.push(e.kinds[i]), r.push(e.starts[i]), !
|
|
1624
|
+
if (t.push(o), n.push(e.isWordLike[i]), s.push(e.kinds[i]), r.push(e.starts[i]), !Oi(o))
|
|
1583
1625
|
continue;
|
|
1584
1626
|
const x = i + 1;
|
|
1585
1627
|
if (x >= e.len || Mt(e.kinds[x]))
|
|
@@ -1598,7 +1640,7 @@ function Wi(e) {
|
|
|
1598
1640
|
starts: r
|
|
1599
1641
|
};
|
|
1600
1642
|
}
|
|
1601
|
-
const
|
|
1643
|
+
const vi = /* @__PURE__ */ new Set([
|
|
1602
1644
|
":",
|
|
1603
1645
|
"-",
|
|
1604
1646
|
"/",
|
|
@@ -1608,7 +1650,7 @@ const Ri = /* @__PURE__ */ new Set([
|
|
|
1608
1650
|
"+",
|
|
1609
1651
|
"–",
|
|
1610
1652
|
"—"
|
|
1611
|
-
]),
|
|
1653
|
+
]), Wi = /* @__PURE__ */ new Set([".", ",", ":", ";"]);
|
|
1612
1654
|
function sn(e) {
|
|
1613
1655
|
for (let t = e.length; t > 0; ) {
|
|
1614
1656
|
const n = lt(e, t), s = e.slice(n, t);
|
|
@@ -1616,14 +1658,14 @@ function sn(e) {
|
|
|
1616
1658
|
t = n;
|
|
1617
1659
|
continue;
|
|
1618
1660
|
}
|
|
1619
|
-
return
|
|
1661
|
+
return Wi.has(s) || at(s);
|
|
1620
1662
|
}
|
|
1621
1663
|
return !1;
|
|
1622
1664
|
}
|
|
1623
|
-
function
|
|
1665
|
+
function Ri(e, t) {
|
|
1624
1666
|
return t && !fe(e);
|
|
1625
1667
|
}
|
|
1626
|
-
function
|
|
1668
|
+
function Un(e) {
|
|
1627
1669
|
for (const t of e)
|
|
1628
1670
|
if (wt.test(t))
|
|
1629
1671
|
return !0;
|
|
@@ -1633,15 +1675,15 @@ function nt(e) {
|
|
|
1633
1675
|
if (e.length === 0)
|
|
1634
1676
|
return !1;
|
|
1635
1677
|
for (const t of e)
|
|
1636
|
-
if (!(wt.test(t) ||
|
|
1678
|
+
if (!(wt.test(t) || vi.has(t)))
|
|
1637
1679
|
return !1;
|
|
1638
1680
|
return !0;
|
|
1639
1681
|
}
|
|
1640
|
-
function
|
|
1682
|
+
function Ti(e) {
|
|
1641
1683
|
const t = [], n = [], s = [], r = [];
|
|
1642
1684
|
for (let i = 0; i < e.len; i++) {
|
|
1643
1685
|
const o = e.texts[i], x = e.kinds[i];
|
|
1644
|
-
if (x === "text" && nt(o) &&
|
|
1686
|
+
if (x === "text" && nt(o) && Un(o)) {
|
|
1645
1687
|
const a = [o];
|
|
1646
1688
|
let d = i + 1;
|
|
1647
1689
|
for (; d < e.len && e.kinds[d] === "text" && nt(e.texts[d]); )
|
|
@@ -1659,14 +1701,14 @@ function Hi(e) {
|
|
|
1659
1701
|
starts: r
|
|
1660
1702
|
};
|
|
1661
1703
|
}
|
|
1662
|
-
function
|
|
1704
|
+
function Gi(e) {
|
|
1663
1705
|
const t = [], n = [], s = [], r = [];
|
|
1664
1706
|
for (let i = 0; i < e.len; i++) {
|
|
1665
1707
|
const o = e.texts[i], x = e.kinds[i], a = e.isWordLike[i];
|
|
1666
|
-
if (x === "text" && sn(o) && (a ||
|
|
1708
|
+
if (x === "text" && sn(o) && (a || Si(o)) && !fe(o)) {
|
|
1667
1709
|
const d = [o];
|
|
1668
1710
|
let c = !0, l = i + 1;
|
|
1669
|
-
for (; c && l < e.len && e.kinds[l] === "text" &&
|
|
1711
|
+
for (; c && l < e.len && e.kinds[l] === "text" && Ri(e.texts[l], e.isWordLike[l]); ) {
|
|
1670
1712
|
const h = e.texts[l];
|
|
1671
1713
|
d.push(h), c = sn(h), l++;
|
|
1672
1714
|
}
|
|
@@ -1683,7 +1725,7 @@ function _i(e) {
|
|
|
1683
1725
|
starts: r
|
|
1684
1726
|
};
|
|
1685
1727
|
}
|
|
1686
|
-
function
|
|
1728
|
+
function Hi(e) {
|
|
1687
1729
|
const t = [], n = [], s = [], r = [];
|
|
1688
1730
|
for (let i = 0; i < e.len; i++) {
|
|
1689
1731
|
const o = e.texts[i];
|
|
@@ -1694,7 +1736,7 @@ function ji(e) {
|
|
|
1694
1736
|
const c = x[d];
|
|
1695
1737
|
if (!a)
|
|
1696
1738
|
break;
|
|
1697
|
-
(c.length === 0 || !
|
|
1739
|
+
(c.length === 0 || !Un(c) || !nt(c)) && (a = !1);
|
|
1698
1740
|
}
|
|
1699
1741
|
if (a) {
|
|
1700
1742
|
let d = 0;
|
|
@@ -1715,7 +1757,7 @@ function ji(e) {
|
|
|
1715
1757
|
starts: r
|
|
1716
1758
|
};
|
|
1717
1759
|
}
|
|
1718
|
-
function
|
|
1760
|
+
function _i(e) {
|
|
1719
1761
|
const t = [], n = [], s = [], r = [];
|
|
1720
1762
|
let i = 0;
|
|
1721
1763
|
for (; i < e.len; ) {
|
|
@@ -1756,12 +1798,12 @@ function Ui(e) {
|
|
|
1756
1798
|
starts: r
|
|
1757
1799
|
};
|
|
1758
1800
|
}
|
|
1759
|
-
function
|
|
1801
|
+
function ji(e) {
|
|
1760
1802
|
const t = e.texts.slice(), n = e.isWordLike.slice(), s = e.kinds.slice(), r = e.starts.slice();
|
|
1761
1803
|
for (let i = 0; i < t.length - 1; i++) {
|
|
1762
1804
|
if (s[i] !== "text" || s[i + 1] !== "text" || !fe(t[i]) || !fe(t[i + 1]))
|
|
1763
1805
|
continue;
|
|
1764
|
-
const o =
|
|
1806
|
+
const o = Ei(t[i]);
|
|
1765
1807
|
o !== null && (t[i] = o.head, t[i + 1] = o.tail + t[i + 1], r[i + 1] = r[i] + o.head.length);
|
|
1766
1808
|
}
|
|
1767
1809
|
return {
|
|
@@ -1772,19 +1814,19 @@ function zi(e) {
|
|
|
1772
1814
|
starts: r
|
|
1773
1815
|
};
|
|
1774
1816
|
}
|
|
1775
|
-
function
|
|
1776
|
-
const s =
|
|
1817
|
+
function Ui(e, t, n) {
|
|
1818
|
+
const s = ti();
|
|
1777
1819
|
let r = 0;
|
|
1778
1820
|
const i = [], o = [], x = [], a = [], d = [], c = [], l = [], h = [], f = [], N = [], p = [], S = [];
|
|
1779
1821
|
for (const E of s.segment(e))
|
|
1780
|
-
for (const y of
|
|
1822
|
+
for (const y of wi(E.segment, E.isWordLike ?? !1, E.index, n)) {
|
|
1781
1823
|
let L = function() {
|
|
1782
1824
|
c[M] !== null && (o[M] = [
|
|
1783
1825
|
tn(i, c, l, M)
|
|
1784
1826
|
], c[M] = null), o[M].push(y.text), x[M] = x[M] || y.isWordLike, h[M] = h[M] || z, f[M] = f[M] || R, N[M] = D, p[M] = W, S[M] = nn(f[M], j);
|
|
1785
1827
|
};
|
|
1786
|
-
const G = y.kind === "text", C =
|
|
1787
|
-
t.carryCJKAfterClosingQuote && G && r > 0 && a[M] === "text" && z && h[M] && N[M] || G && r > 0 && a[M] === "text" &&
|
|
1828
|
+
const G = y.kind === "text", C = Mi(y.text, y.isWordLike, y.kind), z = fe(y.text), R = Zt(y.text), j = $e(y.text), D = Et(y.text), W = ki(y.text), M = r - 1;
|
|
1829
|
+
t.carryCJKAfterClosingQuote && G && r > 0 && a[M] === "text" && z && h[M] && N[M] || G && r > 0 && a[M] === "text" && di(y.text) && h[M] || G && r > 0 && a[M] === "text" && p[M] ? L() : G && r > 0 && a[M] === "text" && y.isWordLike && R && S[M] ? (L(), x[M] = !0) : C !== null && r > 0 && a[M] === "text" && c[M] === C ? l[M] = (l[M] ?? 1) + 1 : G && !y.isWordLike && r > 0 && a[M] === "text" && !h[M] && (hi(y.text) || y.text === "-" && x[M]) ? L() : (i[r] = y.text, o[r] = [y.text], x[r] = y.isWordLike, a[r] = y.kind, d[r] = y.start, c[r] = C, l[r] = C === null ? 0 : 1, h[r] = z, f[r] = R, N[r] = D, p[r] = W, S[r] = nn(R, j), r++);
|
|
1788
1830
|
}
|
|
1789
1831
|
for (let E = 0; E < r; E++) {
|
|
1790
1832
|
if (c[E] !== null) {
|
|
@@ -1800,7 +1842,7 @@ function Ki(e, t, n) {
|
|
|
1800
1842
|
for (let E = r - 1; E >= 0; E--) {
|
|
1801
1843
|
const y = i[E];
|
|
1802
1844
|
if (y.length !== 0) {
|
|
1803
|
-
if (a[E] === "text" && !x[E] && T >= 0 && a[T] === "text" && (
|
|
1845
|
+
if (a[E] === "text" && !x[E] && T >= 0 && a[T] === "text" && (pi(y) || y === "-" && Ai(i[T]))) {
|
|
1804
1846
|
const G = m[T] ?? [];
|
|
1805
1847
|
G.push(y), m[T] = G, d[T] = d[E], i[E] = "";
|
|
1806
1848
|
continue;
|
|
@@ -1810,7 +1852,7 @@ function Ki(e, t, n) {
|
|
|
1810
1852
|
}
|
|
1811
1853
|
for (let E = 0; E < r; E++) {
|
|
1812
1854
|
const y = m[E];
|
|
1813
|
-
y != null && (i[E] =
|
|
1855
|
+
y != null && (i[E] = yi(y, i[E]));
|
|
1814
1856
|
}
|
|
1815
1857
|
let I = 0;
|
|
1816
1858
|
for (let E = 0; E < r; E++) {
|
|
@@ -1818,20 +1860,20 @@ function Ki(e, t, n) {
|
|
|
1818
1860
|
y.length !== 0 && (I !== E && (i[I] = y, x[I] = x[E], a[I] = a[E], d[I] = d[E]), I++);
|
|
1819
1861
|
}
|
|
1820
1862
|
i.length = I, x.length = I, a.length = I, d.length = I;
|
|
1821
|
-
const b =
|
|
1863
|
+
const b = _i({
|
|
1822
1864
|
len: I,
|
|
1823
1865
|
texts: i,
|
|
1824
1866
|
isWordLike: x,
|
|
1825
1867
|
kinds: a,
|
|
1826
1868
|
starts: d
|
|
1827
|
-
}), O =
|
|
1869
|
+
}), O = ji(Gi(Hi(Ti(Ii(Pi(b))))));
|
|
1828
1870
|
for (let E = 0; E < O.len - 1; E++) {
|
|
1829
|
-
const y =
|
|
1871
|
+
const y = Bi(O.texts[E]);
|
|
1830
1872
|
y !== null && (O.kinds[E] !== "space" && O.kinds[E] !== "preserved-space" || O.kinds[E + 1] !== "text" || !Zt(O.texts[E + 1]) || (O.texts[E] = y.space, O.isWordLike[E] = !1, O.kinds[E] = O.kinds[E] === "preserved-space" ? "preserved-space" : "space", O.texts[E + 1] = y.marks + O.texts[E + 1], O.starts[E + 1] = O.starts[E] + y.space.length));
|
|
1831
1873
|
}
|
|
1832
1874
|
return O;
|
|
1833
1875
|
}
|
|
1834
|
-
function
|
|
1876
|
+
function zi(e, t) {
|
|
1835
1877
|
if (e.len === 0)
|
|
1836
1878
|
return [];
|
|
1837
1879
|
if (!t.preserveHardBreaks)
|
|
@@ -1854,7 +1896,7 @@ function qi(e, t) {
|
|
|
1854
1896
|
consumedEndSegmentIndex: e.len
|
|
1855
1897
|
}), n;
|
|
1856
1898
|
}
|
|
1857
|
-
function
|
|
1899
|
+
function Ki(e, t, n) {
|
|
1858
1900
|
if (t.len <= 1)
|
|
1859
1901
|
return t;
|
|
1860
1902
|
const s = [], r = [], i = [], o = [];
|
|
@@ -1882,7 +1924,7 @@ function $i(e, t, n) {
|
|
|
1882
1924
|
for (let h = 0; h < t.len; h++) {
|
|
1883
1925
|
const f = t.texts[h], N = t.kinds[h];
|
|
1884
1926
|
if (N === "text") {
|
|
1885
|
-
x >= 0 && !
|
|
1927
|
+
x >= 0 && !jn(t.texts[h - 1], n) && l(h), x < 0 && (x = h), a = a || fe(f);
|
|
1886
1928
|
continue;
|
|
1887
1929
|
}
|
|
1888
1930
|
l(h), s.push(f), r.push(t.isWordLike[h]), i.push(N), o.push(t.starts[h]);
|
|
@@ -1895,8 +1937,8 @@ function $i(e, t, n) {
|
|
|
1895
1937
|
starts: o
|
|
1896
1938
|
};
|
|
1897
1939
|
}
|
|
1898
|
-
function
|
|
1899
|
-
const r =
|
|
1940
|
+
function qi(e, t, n = "normal", s = "normal") {
|
|
1941
|
+
const r = Xs(n), i = r.mode === "pre-wrap" ? ei(e) : Zs(e);
|
|
1900
1942
|
if (i.length === 0)
|
|
1901
1943
|
return {
|
|
1902
1944
|
normalized: i,
|
|
@@ -1907,17 +1949,17 @@ function Yi(e, t, n = "normal", s = "normal") {
|
|
|
1907
1949
|
kinds: [],
|
|
1908
1950
|
starts: []
|
|
1909
1951
|
};
|
|
1910
|
-
const o =
|
|
1952
|
+
const o = Ui(i, t, r), x = s === "keep-all" ? Ki(i, o, t.breakKeepAllAfterPunctuation) : o;
|
|
1911
1953
|
return {
|
|
1912
1954
|
normalized: i,
|
|
1913
|
-
chunks:
|
|
1955
|
+
chunks: zi(x, r),
|
|
1914
1956
|
...x
|
|
1915
1957
|
};
|
|
1916
1958
|
}
|
|
1917
1959
|
let Pe = null;
|
|
1918
1960
|
const rn = /* @__PURE__ */ new Map();
|
|
1919
1961
|
let Ie = null;
|
|
1920
|
-
const
|
|
1962
|
+
const $i = 96, Yi = /\p{Emoji_Presentation}/u, Ji = /[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;
|
|
1921
1963
|
let gt = null;
|
|
1922
1964
|
const on = /* @__PURE__ */ new Map();
|
|
1923
1965
|
function Pt() {
|
|
@@ -1929,7 +1971,7 @@ function Pt() {
|
|
|
1929
1971
|
return Pe = document.createElement("canvas").getContext("2d"), Pe;
|
|
1930
1972
|
throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.");
|
|
1931
1973
|
}
|
|
1932
|
-
function
|
|
1974
|
+
function Vi(e) {
|
|
1933
1975
|
let t = rn.get(e);
|
|
1934
1976
|
return t || (t = /* @__PURE__ */ new Map(), rn.set(e, t)), t;
|
|
1935
1977
|
}
|
|
@@ -1960,20 +2002,20 @@ function Ge() {
|
|
|
1960
2002
|
preferEarlySoftHyphenBreak: n
|
|
1961
2003
|
}, Ie;
|
|
1962
2004
|
}
|
|
1963
|
-
function
|
|
2005
|
+
function Qi(e) {
|
|
1964
2006
|
const t = e.match(/(\d+(?:\.\d+)?)\s*px/);
|
|
1965
2007
|
return t ? parseFloat(t[1]) : 16;
|
|
1966
2008
|
}
|
|
1967
|
-
function
|
|
2009
|
+
function zn() {
|
|
1968
2010
|
return gt === null && (gt = new Intl.Segmenter(void 0, { granularity: "grapheme" })), gt;
|
|
1969
2011
|
}
|
|
1970
|
-
function
|
|
1971
|
-
return
|
|
2012
|
+
function Xi(e) {
|
|
2013
|
+
return Yi.test(e) || e.includes("️");
|
|
1972
2014
|
}
|
|
1973
|
-
function
|
|
1974
|
-
return
|
|
2015
|
+
function Zi(e) {
|
|
2016
|
+
return Ji.test(e);
|
|
1975
2017
|
}
|
|
1976
|
-
function
|
|
2018
|
+
function er(e, t) {
|
|
1977
2019
|
let n = on.get(e);
|
|
1978
2020
|
if (n !== void 0)
|
|
1979
2021
|
return n;
|
|
@@ -1988,24 +2030,24 @@ function nr(e, t) {
|
|
|
1988
2030
|
}
|
|
1989
2031
|
return on.set(e, n), n;
|
|
1990
2032
|
}
|
|
1991
|
-
function
|
|
2033
|
+
function tr(e) {
|
|
1992
2034
|
let t = 0;
|
|
1993
|
-
const n =
|
|
2035
|
+
const n = zn();
|
|
1994
2036
|
for (const s of n.segment(e))
|
|
1995
|
-
|
|
2037
|
+
Xi(s.segment) && t++;
|
|
1996
2038
|
return t;
|
|
1997
2039
|
}
|
|
1998
|
-
function
|
|
1999
|
-
return t.emojiCount === void 0 && (t.emojiCount =
|
|
2040
|
+
function nr(e, t) {
|
|
2041
|
+
return t.emojiCount === void 0 && (t.emojiCount = tr(e)), t.emojiCount;
|
|
2000
2042
|
}
|
|
2001
2043
|
function Be(e, t, n) {
|
|
2002
|
-
return n === 0 ? t.width : t.width -
|
|
2044
|
+
return n === 0 ? t.width : t.width - nr(e, t) * n;
|
|
2003
2045
|
}
|
|
2004
|
-
function
|
|
2046
|
+
function sr(e, t, n, s, r) {
|
|
2005
2047
|
if (t.breakableFitAdvances !== void 0 && t.breakableFitMode === r)
|
|
2006
2048
|
return t.breakableFitAdvances;
|
|
2007
2049
|
t.breakableFitMode = r;
|
|
2008
|
-
const i =
|
|
2050
|
+
const i = zn(), o = [];
|
|
2009
2051
|
for (const c of i.segment(e))
|
|
2010
2052
|
o.push(c.segment);
|
|
2011
2053
|
if (o.length <= 1)
|
|
@@ -2018,7 +2060,7 @@ function rr(e, t, n, s, r) {
|
|
|
2018
2060
|
}
|
|
2019
2061
|
return t.breakableFitAdvances = c, t.breakableFitAdvances;
|
|
2020
2062
|
}
|
|
2021
|
-
if (r === "pair-context" || o.length >
|
|
2063
|
+
if (r === "pair-context" || o.length > $i) {
|
|
2022
2064
|
const c = [];
|
|
2023
2065
|
let l = null, h = 0;
|
|
2024
2066
|
for (const f of o) {
|
|
@@ -2042,13 +2084,13 @@ function rr(e, t, n, s, r) {
|
|
|
2042
2084
|
}
|
|
2043
2085
|
return t.breakableFitAdvances = x, t.breakableFitAdvances;
|
|
2044
2086
|
}
|
|
2045
|
-
function
|
|
2087
|
+
function ir(e, t) {
|
|
2046
2088
|
const n = Pt();
|
|
2047
2089
|
n.font = e;
|
|
2048
|
-
const s =
|
|
2090
|
+
const s = Vi(e), r = Qi(e), i = t ? er(e, r) : 0;
|
|
2049
2091
|
return { cache: s, fontSize: r, emojiCorrection: i };
|
|
2050
2092
|
}
|
|
2051
|
-
function
|
|
2093
|
+
function rr(e) {
|
|
2052
2094
|
return e === "space" || e === "zero-width-break" || e === "soft-hyphen";
|
|
2053
2095
|
}
|
|
2054
2096
|
function xt(e) {
|
|
@@ -2057,29 +2099,29 @@ function xt(e) {
|
|
|
2057
2099
|
function It(e, t, n = e.widths.length) {
|
|
2058
2100
|
for (; t < n; ) {
|
|
2059
2101
|
const s = e.kinds[t];
|
|
2060
|
-
if (!
|
|
2102
|
+
if (!rr(s))
|
|
2061
2103
|
break;
|
|
2062
2104
|
t++;
|
|
2063
2105
|
}
|
|
2064
2106
|
return t;
|
|
2065
2107
|
}
|
|
2066
|
-
function
|
|
2108
|
+
function Kn(e, t) {
|
|
2067
2109
|
if (t <= 0)
|
|
2068
2110
|
return 0;
|
|
2069
2111
|
const n = e % t;
|
|
2070
2112
|
return Math.abs(n) <= 1e-6 ? t : t - n;
|
|
2071
2113
|
}
|
|
2072
|
-
function
|
|
2114
|
+
function qn(e, t, n) {
|
|
2073
2115
|
return e.letterSpacing !== 0 && t && e.spacingGraphemeCounts[n] > 0 ? e.letterSpacing : 0;
|
|
2074
2116
|
}
|
|
2075
2117
|
function vt(e, t) {
|
|
2076
2118
|
return t === 0 ? 0 : e + t;
|
|
2077
2119
|
}
|
|
2078
|
-
function
|
|
2120
|
+
function or(e, t) {
|
|
2079
2121
|
return e.letterSpacing !== 0 && e.spacingGraphemeCounts[t] > 0 ? e.letterSpacing : 0;
|
|
2080
2122
|
}
|
|
2081
|
-
function
|
|
2082
|
-
const i = t === "tab" ? r +
|
|
2123
|
+
function $n(e, t, n, s, r) {
|
|
2124
|
+
const i = t === "tab" ? r + or(e, n) : e.lineEndFitAdvances[n];
|
|
2083
2125
|
return vt(s, i);
|
|
2084
2126
|
}
|
|
2085
2127
|
function st(e, t, n, s) {
|
|
@@ -2090,13 +2132,13 @@ function it(e, t, n, s, r) {
|
|
|
2090
2132
|
const i = t === "tab" ? r : e.lineEndPaintAdvances[n];
|
|
2091
2133
|
return vt(s, i);
|
|
2092
2134
|
}
|
|
2093
|
-
function
|
|
2135
|
+
function Yn(e, t, n) {
|
|
2094
2136
|
return e.letterSpacing !== 0 && t ? n + e.letterSpacing : n;
|
|
2095
2137
|
}
|
|
2096
|
-
function
|
|
2138
|
+
function Jn(e, t) {
|
|
2097
2139
|
return e.letterSpacing === 0 ? t : t + e.letterSpacing;
|
|
2098
2140
|
}
|
|
2099
|
-
function
|
|
2141
|
+
function cr(e, t, n, s, r) {
|
|
2100
2142
|
if (e.letterSpacing === 0)
|
|
2101
2143
|
return 0;
|
|
2102
2144
|
if (r > 0)
|
|
@@ -2114,10 +2156,10 @@ function ar(e, t, n, s, r) {
|
|
|
2114
2156
|
}
|
|
2115
2157
|
return 0;
|
|
2116
2158
|
}
|
|
2117
|
-
function
|
|
2118
|
-
return t +
|
|
2159
|
+
function Vn(e, t, n, s, r, i) {
|
|
2160
|
+
return t + cr(e, n, s, r, i);
|
|
2119
2161
|
}
|
|
2120
|
-
function
|
|
2162
|
+
function lr(e, t) {
|
|
2121
2163
|
let n = 0, s = e.chunks.length;
|
|
2122
2164
|
for (; n < s; ) {
|
|
2123
2165
|
const r = Math.floor((n + s) / 2);
|
|
@@ -2125,20 +2167,20 @@ function xr(e, t) {
|
|
|
2125
2167
|
}
|
|
2126
2168
|
return n < e.chunks.length ? n : -1;
|
|
2127
2169
|
}
|
|
2128
|
-
function
|
|
2170
|
+
function ar(e, t, n) {
|
|
2129
2171
|
let s = n.segmentIndex;
|
|
2130
2172
|
if (n.graphemeIndex > 0)
|
|
2131
2173
|
return t;
|
|
2132
2174
|
const r = e.chunks[t];
|
|
2133
2175
|
return r.startSegmentIndex === r.endSegmentIndex && s === r.startSegmentIndex || (s < r.startSegmentIndex && (s = r.startSegmentIndex), s = It(e, s, r.endSegmentIndex), s < r.endSegmentIndex) ? (n.segmentIndex = s, n.graphemeIndex = 0, t) : r.consumedEndSegmentIndex >= e.widths.length ? -1 : (n.segmentIndex = r.consumedEndSegmentIndex, n.graphemeIndex = 0, t + 1);
|
|
2134
2176
|
}
|
|
2135
|
-
function
|
|
2177
|
+
function xr(e, t) {
|
|
2136
2178
|
if (t.segmentIndex >= e.widths.length)
|
|
2137
2179
|
return -1;
|
|
2138
|
-
const n =
|
|
2139
|
-
return n < 0 ? -1 :
|
|
2180
|
+
const n = lr(e, t.segmentIndex);
|
|
2181
|
+
return n < 0 ? -1 : ar(e, n, t);
|
|
2140
2182
|
}
|
|
2141
|
-
function
|
|
2183
|
+
function fr(e, t, n) {
|
|
2142
2184
|
const { widths: s, kinds: r, breakableFitAdvances: i } = e;
|
|
2143
2185
|
if (s.length === 0)
|
|
2144
2186
|
return 0;
|
|
@@ -2202,9 +2244,9 @@ function hr(e, t, n) {
|
|
|
2202
2244
|
}
|
|
2203
2245
|
return l && I(), d;
|
|
2204
2246
|
}
|
|
2205
|
-
function
|
|
2247
|
+
function ur(e, t, n) {
|
|
2206
2248
|
if (e.simpleLineWalkFastPath)
|
|
2207
|
-
return
|
|
2249
|
+
return fr(e, t, n);
|
|
2208
2250
|
const { widths: s, kinds: r, breakableFitAdvances: i, discretionaryHyphenWidth: o, chunks: x } = e;
|
|
2209
2251
|
if (s.length === 0 || x.length === 0)
|
|
2210
2252
|
return 0;
|
|
@@ -2217,7 +2259,7 @@ function dr(e, t, n) {
|
|
|
2217
2259
|
return O === "soft-hyphen" && T === S && m === 0 ? b : h;
|
|
2218
2260
|
}
|
|
2219
2261
|
function G(M = S, L = m, v) {
|
|
2220
|
-
l++, n !== void 0 && n(
|
|
2262
|
+
l++, n !== void 0 && n(Vn(e, v ?? y(), N, p, M, L), N, p, M, L), h = 0, f = !1, E();
|
|
2221
2263
|
}
|
|
2222
2264
|
function C(M, L) {
|
|
2223
2265
|
f = !0, N = M, p = 0, S = M + 1, m = 0, h = L;
|
|
@@ -2245,8 +2287,8 @@ function dr(e, t, n) {
|
|
|
2245
2287
|
if (!f)
|
|
2246
2288
|
z(M, P, J);
|
|
2247
2289
|
else {
|
|
2248
|
-
const $ =
|
|
2249
|
-
|
|
2290
|
+
const $ = Yn(e, !0, J), q = h + $;
|
|
2291
|
+
Jn(e, q) > c ? (G(), z(M, P, J)) : (h = q, S = M, m = P + 1);
|
|
2250
2292
|
}
|
|
2251
2293
|
}
|
|
2252
2294
|
f && S === M && m === v.length && (S = M + 1, m = 0);
|
|
@@ -2263,7 +2305,7 @@ function dr(e, t, n) {
|
|
|
2263
2305
|
f = !1, h = 0, N = L.startSegmentIndex, p = 0, S = L.startSegmentIndex, m = 0, E();
|
|
2264
2306
|
let v = L.startSegmentIndex;
|
|
2265
2307
|
for (; v < L.endSegmentIndex && !(!f && (v = It(e, v, L.endSegmentIndex), v >= L.endSegmentIndex)); ) {
|
|
2266
|
-
const P = r[v], J = xt(P), $ =
|
|
2308
|
+
const P = r[v], J = xt(P), $ = qn(e, f, v), q = P === "tab" ? Kn(h + $, e.tabStopAdvance) : s[v], U = $ + q, ce = $n(e, P, v, $, q);
|
|
2267
2309
|
if (P === "soft-hyphen") {
|
|
2268
2310
|
f && (S = v + 1, m = 0, T = v + 1, I = h + o, b = h + o, O = P), v++;
|
|
2269
2311
|
continue;
|
|
@@ -2307,7 +2349,7 @@ function dr(e, t, n) {
|
|
|
2307
2349
|
}
|
|
2308
2350
|
return l;
|
|
2309
2351
|
}
|
|
2310
|
-
function
|
|
2352
|
+
function hr(e, t, n, s) {
|
|
2311
2353
|
const r = e.chunks[n];
|
|
2312
2354
|
if (r.startSegmentIndex === r.endSegmentIndex)
|
|
2313
2355
|
return t.segmentIndex = r.consumedEndSegmentIndex, t.graphemeIndex = 0, 0;
|
|
@@ -2317,7 +2359,7 @@ function pr(e, t, n, s) {
|
|
|
2317
2359
|
return O === "soft-hyphen" && T === S && m === 0 ? b : N;
|
|
2318
2360
|
}
|
|
2319
2361
|
function y(W = S, M = m, L = E()) {
|
|
2320
|
-
return p ? (t.segmentIndex = W, t.graphemeIndex = M,
|
|
2362
|
+
return p ? (t.segmentIndex = W, t.graphemeIndex = M, Vn(e, L, h, f, W, M)) : null;
|
|
2321
2363
|
}
|
|
2322
2364
|
function G(W, M) {
|
|
2323
2365
|
p = !0, S = W + 1, m = 0, N = M;
|
|
@@ -2345,8 +2387,8 @@ function pr(e, t, n, s) {
|
|
|
2345
2387
|
if (!p)
|
|
2346
2388
|
C(W, v, P);
|
|
2347
2389
|
else {
|
|
2348
|
-
const J =
|
|
2349
|
-
if (
|
|
2390
|
+
const J = Yn(e, !0, P), $ = N + J;
|
|
2391
|
+
if (Jn(e, $) > l)
|
|
2350
2392
|
return y();
|
|
2351
2393
|
N = $, S = W, m = v + 1;
|
|
2352
2394
|
}
|
|
@@ -2357,7 +2399,7 @@ function pr(e, t, n, s) {
|
|
|
2357
2399
|
return O !== "soft-hyphen" || T < 0 ? null : I <= l ? y(T, 0, b) : null;
|
|
2358
2400
|
}
|
|
2359
2401
|
for (let W = t.segmentIndex; W < r.endSegmentIndex; W++) {
|
|
2360
|
-
const M = o[W], L = xt(M), v = W === t.segmentIndex ? t.graphemeIndex : 0, P =
|
|
2402
|
+
const M = o[W], L = xt(M), v = W === t.segmentIndex ? t.graphemeIndex : 0, P = qn(e, p, W), J = M === "tab" ? Kn(N + P, e.tabStopAdvance) : i[W], $ = P + J, q = $n(e, M, W, P, J);
|
|
2361
2403
|
if (M === "soft-hyphen" && v === 0) {
|
|
2362
2404
|
p && (S = W + 1, m = 0, T = W + 1, I = N + a, b = N + a, O = M);
|
|
2363
2405
|
continue;
|
|
@@ -2401,7 +2443,7 @@ function pr(e, t, n, s) {
|
|
|
2401
2443
|
}
|
|
2402
2444
|
return T === r.consumedEndSegmentIndex && m === 0 ? y(r.consumedEndSegmentIndex, 0, b) : y(r.consumedEndSegmentIndex, 0, N);
|
|
2403
2445
|
}
|
|
2404
|
-
function
|
|
2446
|
+
function dr(e, t, n) {
|
|
2405
2447
|
const { widths: s, kinds: r, breakableFitAdvances: i } = e, x = Ge().lineFitEpsilon, a = n + x;
|
|
2406
2448
|
let d = 0, c = !1, l = t.segmentIndex, h = t.graphemeIndex, f = -1, N = 0;
|
|
2407
2449
|
for (let p = t.segmentIndex; p < s.length; p++) {
|
|
@@ -2428,15 +2470,15 @@ function gr(e, t, n) {
|
|
|
2428
2470
|
}
|
|
2429
2471
|
return c ? (t.segmentIndex = l, t.graphemeIndex = h, d) : null;
|
|
2430
2472
|
}
|
|
2431
|
-
function
|
|
2432
|
-
return e.simpleLineWalkFastPath ?
|
|
2473
|
+
function pr(e, t, n, s) {
|
|
2474
|
+
return e.simpleLineWalkFastPath ? dr(e, t, s) : hr(e, t, n, s);
|
|
2433
2475
|
}
|
|
2434
2476
|
function kt(e, t, n) {
|
|
2435
|
-
const s =
|
|
2436
|
-
return s < 0 ? null :
|
|
2477
|
+
const s = xr(e, t);
|
|
2478
|
+
return s < 0 ? null : pr(e, t, s, n);
|
|
2437
2479
|
}
|
|
2438
2480
|
let Ft = null, cn = /* @__PURE__ */ new WeakMap();
|
|
2439
|
-
function
|
|
2481
|
+
function gr() {
|
|
2440
2482
|
return Ft === null && (Ft = new Intl.Segmenter(void 0, { granularity: "grapheme" })), Ft;
|
|
2441
2483
|
}
|
|
2442
2484
|
function ln(e, t, n) {
|
|
@@ -2444,12 +2486,12 @@ function ln(e, t, n) {
|
|
|
2444
2486
|
if (s !== void 0)
|
|
2445
2487
|
return s;
|
|
2446
2488
|
s = [];
|
|
2447
|
-
const r =
|
|
2489
|
+
const r = gr();
|
|
2448
2490
|
for (const i of r.segment(t[e]))
|
|
2449
2491
|
s.push(i.segment);
|
|
2450
2492
|
return n.set(e, s), s;
|
|
2451
2493
|
}
|
|
2452
|
-
function
|
|
2494
|
+
function Fr(e, t, n) {
|
|
2453
2495
|
return n > t && e[n - 1] === "soft-hyphen";
|
|
2454
2496
|
}
|
|
2455
2497
|
function an(e, t, n, s) {
|
|
@@ -2457,13 +2499,13 @@ function an(e, t, n, s) {
|
|
|
2457
2499
|
e += t[r];
|
|
2458
2500
|
return e;
|
|
2459
2501
|
}
|
|
2460
|
-
function
|
|
2502
|
+
function mr(e) {
|
|
2461
2503
|
let t = cn.get(e);
|
|
2462
2504
|
return t !== void 0 || (t = /* @__PURE__ */ new Map(), cn.set(e, t)), t;
|
|
2463
2505
|
}
|
|
2464
|
-
function
|
|
2506
|
+
function Nr(e, t, n, s, r, i) {
|
|
2465
2507
|
let o = "";
|
|
2466
|
-
const x =
|
|
2508
|
+
const x = Fr(e.kinds, n, r);
|
|
2467
2509
|
for (let a = n; a < r; a++)
|
|
2468
2510
|
if (!(e.kinds[a] === "soft-hyphen" || e.kinds[a] === "hard-break"))
|
|
2469
2511
|
if (a === n && s > 0) {
|
|
@@ -2479,10 +2521,10 @@ function Ar(e, t, n, s, r, i) {
|
|
|
2479
2521
|
return o;
|
|
2480
2522
|
}
|
|
2481
2523
|
let mt = null;
|
|
2482
|
-
function
|
|
2524
|
+
function Qn() {
|
|
2483
2525
|
return mt === null && (mt = new Intl.Segmenter(void 0, { granularity: "grapheme" })), mt;
|
|
2484
2526
|
}
|
|
2485
|
-
function
|
|
2527
|
+
function Sr(e) {
|
|
2486
2528
|
return {
|
|
2487
2529
|
widths: [],
|
|
2488
2530
|
lineEndFitAdvances: [],
|
|
@@ -2499,7 +2541,7 @@ function Er(e) {
|
|
|
2499
2541
|
segments: []
|
|
2500
2542
|
};
|
|
2501
2543
|
}
|
|
2502
|
-
function
|
|
2544
|
+
function Ar(e, t) {
|
|
2503
2545
|
const n = [];
|
|
2504
2546
|
let s = [], r = 0, i = !1, o = !1, x = !1;
|
|
2505
2547
|
function a() {
|
|
@@ -2516,7 +2558,7 @@ function Mr(e, t) {
|
|
|
2516
2558
|
const f = Et(l);
|
|
2517
2559
|
l.length === 1 && we.has(l) ? o = o || f : o = f, x = !1;
|
|
2518
2560
|
}
|
|
2519
|
-
for (const l of
|
|
2561
|
+
for (const l of Qn().segment(e)) {
|
|
2520
2562
|
const h = l.segment, f = fe(h);
|
|
2521
2563
|
if (s.length === 0) {
|
|
2522
2564
|
d(h, l.index, f);
|
|
@@ -2534,7 +2576,7 @@ function Mr(e, t) {
|
|
|
2534
2576
|
}
|
|
2535
2577
|
return a(), n;
|
|
2536
2578
|
}
|
|
2537
|
-
function
|
|
2579
|
+
function Er(e, t, n) {
|
|
2538
2580
|
if (t.length <= 1)
|
|
2539
2581
|
return t;
|
|
2540
2582
|
const s = [];
|
|
@@ -2558,7 +2600,7 @@ function kr(e, t, n) {
|
|
|
2558
2600
|
}
|
|
2559
2601
|
for (let a = 0; a < t.length; a++) {
|
|
2560
2602
|
const d = t[a];
|
|
2561
|
-
r >= 0 && !
|
|
2603
|
+
r >= 0 && !jn(t[a - 1].text, n) && x(a), r < 0 && (r = a), i = i || fe(d.text);
|
|
2562
2604
|
}
|
|
2563
2605
|
return x(t.length), s;
|
|
2564
2606
|
}
|
|
@@ -2568,18 +2610,18 @@ function xn(e, t) {
|
|
|
2568
2610
|
if (t === "tab")
|
|
2569
2611
|
return 1;
|
|
2570
2612
|
let n = 0;
|
|
2571
|
-
const s =
|
|
2613
|
+
const s = Qn();
|
|
2572
2614
|
for (const r of s.segment(e))
|
|
2573
2615
|
n++;
|
|
2574
2616
|
return n;
|
|
2575
2617
|
}
|
|
2576
|
-
function
|
|
2618
|
+
function Mr(e, t, n) {
|
|
2577
2619
|
return t > 1 ? e + (t - 1) * n : e;
|
|
2578
2620
|
}
|
|
2579
|
-
function
|
|
2580
|
-
const i = Ge(), { cache: o, emojiCorrection: x } =
|
|
2621
|
+
function kr(e, t, n, s, r) {
|
|
2622
|
+
const i = Ge(), { cache: o, emojiCorrection: x } = ir(t, Zi(e.normalized)), a = Be("-", Se("-", o), x) + (r === 0 ? 0 : r * 2), c = Be(" ", Se(" ", o), x) * 8, l = r !== 0;
|
|
2581
2623
|
if (e.len === 0)
|
|
2582
|
-
return
|
|
2624
|
+
return Sr();
|
|
2583
2625
|
const h = [], f = [], N = [], p = [];
|
|
2584
2626
|
let S = e.chunks.length <= 1 && !l;
|
|
2585
2627
|
const m = n ? [] : null, T = [], I = [], b = n ? [] : null, O = Array.from({ length: e.len });
|
|
@@ -2587,11 +2629,11 @@ function br(e, t, n, s, r) {
|
|
|
2587
2629
|
W !== "text" && W !== "space" && W !== "zero-width-break" && (S = !1), h.push(R), f.push(j), N.push(D), p.push(W), m?.push(M), T.push(L), l && I.push(v), b !== null && b.push(z);
|
|
2588
2630
|
}
|
|
2589
2631
|
function y(z, R, j, D, W) {
|
|
2590
|
-
const M = Se(z, o), L = l ? xn(z, R) : 0, v =
|
|
2632
|
+
const M = Se(z, o), L = l ? xn(z, R) : 0, v = Mr(Be(z, M, x), L, r), P = R === "space" || R === "preserved-space" || R === "zero-width-break" ? 0 : v, J = P === 0 ? 0 : P + (L > 0 ? r : 0), $ = R === "space" || R === "zero-width-break" ? 0 : v;
|
|
2591
2633
|
if (W && D && z.length > 1) {
|
|
2592
2634
|
let q = "sum-graphemes";
|
|
2593
2635
|
r !== 0 ? q = "segment-prefixes" : nt(z) ? q = "pair-context" : i.preferPrefixWidthsForBreakableRuns && (q = "segment-prefixes");
|
|
2594
|
-
const U =
|
|
2636
|
+
const U = sr(z, M, o, x, q);
|
|
2595
2637
|
E(z, v, J, $, R, j, U, L);
|
|
2596
2638
|
return;
|
|
2597
2639
|
}
|
|
@@ -2614,7 +2656,7 @@ function br(e, t, n, s, r) {
|
|
|
2614
2656
|
}
|
|
2615
2657
|
const M = Se(R, o);
|
|
2616
2658
|
if (D === "text" && M.containsCJK) {
|
|
2617
|
-
const L =
|
|
2659
|
+
const L = Ar(R, i), v = s === "keep-all" ? Er(R, L, i.breakKeepAllAfterPunctuation) : L;
|
|
2618
2660
|
for (let P = 0; P < v.length; P++) {
|
|
2619
2661
|
const J = v[P];
|
|
2620
2662
|
y(J.text, "text", W + J.start, j, s === "keep-all" || !fe(J.text));
|
|
@@ -2623,7 +2665,7 @@ function br(e, t, n, s, r) {
|
|
|
2623
2665
|
}
|
|
2624
2666
|
y(R, D, W, j, !0);
|
|
2625
2667
|
}
|
|
2626
|
-
const G =
|
|
2668
|
+
const G = Br(e.chunks, O, h.length), C = m === null ? null : _n(e.normalized, m);
|
|
2627
2669
|
return b !== null ? {
|
|
2628
2670
|
widths: h,
|
|
2629
2671
|
lineEndFitAdvances: f,
|
|
@@ -2653,7 +2695,7 @@ function br(e, t, n, s, r) {
|
|
|
2653
2695
|
chunks: G
|
|
2654
2696
|
};
|
|
2655
2697
|
}
|
|
2656
|
-
function
|
|
2698
|
+
function Br(e, t, n) {
|
|
2657
2699
|
const s = [];
|
|
2658
2700
|
for (let r = 0; r < e.length; r++) {
|
|
2659
2701
|
const i = e[r], o = i.startSegmentIndex < t.length ? t[i.startSegmentIndex] : n, x = i.endSegmentIndex < t.length ? t[i.endSegmentIndex] : n, a = i.consumedEndSegmentIndex < t.length ? t[i.consumedEndSegmentIndex] : n;
|
|
@@ -2665,20 +2707,20 @@ function Cr(e, t, n) {
|
|
|
2665
2707
|
}
|
|
2666
2708
|
return s;
|
|
2667
2709
|
}
|
|
2668
|
-
function
|
|
2669
|
-
const r = s?.wordBreak ?? "normal", i = s?.letterSpacing ?? 0, o =
|
|
2670
|
-
return
|
|
2710
|
+
function br(e, t, n, s) {
|
|
2711
|
+
const r = s?.wordBreak ?? "normal", i = s?.letterSpacing ?? 0, o = qi(e, Ge(), s?.whiteSpace, r);
|
|
2712
|
+
return kr(o, t, n, r, i);
|
|
2671
2713
|
}
|
|
2672
2714
|
function Bt(e, t, n) {
|
|
2673
|
-
return
|
|
2715
|
+
return br(e, t, !0, n);
|
|
2674
2716
|
}
|
|
2675
2717
|
function fn(e) {
|
|
2676
2718
|
let t = 0;
|
|
2677
|
-
return
|
|
2719
|
+
return ur(e, Number.POSITIVE_INFINITY, (n) => {
|
|
2678
2720
|
n > t && (t = n);
|
|
2679
2721
|
}), t;
|
|
2680
2722
|
}
|
|
2681
|
-
const
|
|
2723
|
+
const Cr = /[ \t\n\f\r]+/, un = /^[ \t\n\f\r]+/, hn = /[ \t\n\f\r]+$/, dn = { segmentIndex: 0, graphemeIndex: 0 }, yr = {
|
|
2682
2724
|
itemIndex: 0,
|
|
2683
2725
|
segmentIndex: 0,
|
|
2684
2726
|
graphemeIndex: 0
|
|
@@ -2699,7 +2741,7 @@ function tt(e, t, n) {
|
|
|
2699
2741
|
const i = t === 0 ? void 0 : { letterSpacing: t }, o = fn(Bt("A A", e, i)), x = fn(Bt("AA", e, i)), a = Math.max(0, o - x);
|
|
2700
2742
|
return n.set(s, a), a;
|
|
2701
2743
|
}
|
|
2702
|
-
function
|
|
2744
|
+
function wr(e) {
|
|
2703
2745
|
const t = { segmentIndex: 0, graphemeIndex: 0 }, n = kt(e, t, Number.POSITIVE_INFINITY);
|
|
2704
2746
|
return n === null ? null : {
|
|
2705
2747
|
endGraphemeIndex: t.graphemeIndex,
|
|
@@ -2707,19 +2749,19 @@ function Lr(e) {
|
|
|
2707
2749
|
width: n
|
|
2708
2750
|
};
|
|
2709
2751
|
}
|
|
2710
|
-
function
|
|
2752
|
+
function Dr(e, t) {
|
|
2711
2753
|
return e === 0 && t > 0;
|
|
2712
2754
|
}
|
|
2713
|
-
function
|
|
2755
|
+
function Lr(e) {
|
|
2714
2756
|
const t = [], n = Array.from({ length: e.length }), s = /* @__PURE__ */ new Map();
|
|
2715
2757
|
let r = 0;
|
|
2716
2758
|
for (let i = 0; i < e.length; i++) {
|
|
2717
2759
|
const o = e[i], x = o.letterSpacing ?? 0, a = un.test(o.text), d = hn.test(o.text), c = o.text.replace(un, "").replace(hn, "");
|
|
2718
2760
|
if (c.length === 0) {
|
|
2719
|
-
|
|
2761
|
+
Cr.test(o.text) && r === 0 && (r = tt(o.font, x, s));
|
|
2720
2762
|
continue;
|
|
2721
2763
|
}
|
|
2722
|
-
const l = r > 0 ? r : a ? tt(o.font, x, s) : 0, h = Bt(c, o.font, x === 0 ? void 0 : { letterSpacing: x }), f =
|
|
2764
|
+
const l = r > 0 ? r : a ? tt(o.font, x, s) : 0, h = Bt(c, o.font, x === 0 ? void 0 : { letterSpacing: x }), f = wr(h);
|
|
2723
2765
|
if (f === null) {
|
|
2724
2766
|
r = d ? tt(o.font, x, s) : 0;
|
|
2725
2767
|
continue;
|
|
@@ -2741,7 +2783,7 @@ function Pr(e) {
|
|
|
2741
2783
|
itemsBySourceItemIndex: n
|
|
2742
2784
|
};
|
|
2743
2785
|
}
|
|
2744
|
-
function
|
|
2786
|
+
function Or(e, t, n, s) {
|
|
2745
2787
|
if (e.items.length === 0 || n.itemIndex >= e.items.length)
|
|
2746
2788
|
return null;
|
|
2747
2789
|
const r = Math.max(1, t);
|
|
@@ -2795,7 +2837,7 @@ function Ir(e, t, n, s) {
|
|
|
2795
2837
|
const p = N + a.extraWidth, S = d + p;
|
|
2796
2838
|
if (i > 0 && c && S > o)
|
|
2797
2839
|
break e;
|
|
2798
|
-
if (i > 0 && c && d > 0 &&
|
|
2840
|
+
if (i > 0 && c && d > 0 && Dr(f.segmentIndex, f.graphemeIndex)) {
|
|
2799
2841
|
const m = { segmentIndex: 0, graphemeIndex: 0 };
|
|
2800
2842
|
if (kt(a.prepared, m, Math.max(1, r - a.extraWidth)) !== null && (m.segmentIndex > f.segmentIndex || m.segmentIndex === f.segmentIndex && m.graphemeIndex > f.graphemeIndex))
|
|
2801
2843
|
break e;
|
|
@@ -2812,12 +2854,12 @@ function Ir(e, t, n, s) {
|
|
|
2812
2854
|
}
|
|
2813
2855
|
return i === 0 ? null : (n.itemIndex = x, i);
|
|
2814
2856
|
}
|
|
2815
|
-
function
|
|
2857
|
+
function Pr(e, t, n = yr) {
|
|
2816
2858
|
const s = e, r = {
|
|
2817
2859
|
itemIndex: n.itemIndex,
|
|
2818
2860
|
segmentIndex: n.segmentIndex,
|
|
2819
2861
|
graphemeIndex: n.graphemeIndex
|
|
2820
|
-
}, i = [], o =
|
|
2862
|
+
}, i = [], o = Or(s, t, r, (x, a, d, c, l) => {
|
|
2821
2863
|
i.push({
|
|
2822
2864
|
itemIndex: x.sourceItemIndex,
|
|
2823
2865
|
gapBefore: a,
|
|
@@ -2832,10 +2874,10 @@ function vr(e, t, n = Dr) {
|
|
|
2832
2874
|
end: r
|
|
2833
2875
|
};
|
|
2834
2876
|
}
|
|
2835
|
-
function
|
|
2836
|
-
return
|
|
2877
|
+
function Ir(e, t) {
|
|
2878
|
+
return Nr(e.prepared, mr(e.prepared), t.start.segmentIndex, t.start.graphemeIndex, t.end.segmentIndex, t.end.graphemeIndex);
|
|
2837
2879
|
}
|
|
2838
|
-
function
|
|
2880
|
+
function vr(e, t) {
|
|
2839
2881
|
const n = e, s = [];
|
|
2840
2882
|
for (let r = 0; r < t.fragments.length; r++) {
|
|
2841
2883
|
const i = t.fragments[r], o = n.itemsBySourceItemIndex[i.itemIndex];
|
|
@@ -2843,7 +2885,7 @@ function Rr(e, t) {
|
|
|
2843
2885
|
throw new Error("Missing rich-text inline item for fragment");
|
|
2844
2886
|
s.push({
|
|
2845
2887
|
itemIndex: i.itemIndex,
|
|
2846
|
-
text:
|
|
2888
|
+
text: Ir(o, i),
|
|
2847
2889
|
gapBefore: i.gapBefore,
|
|
2848
2890
|
occupiedWidth: i.occupiedWidth,
|
|
2849
2891
|
start: i.start,
|
|
@@ -2894,7 +2936,7 @@ function We(e, t = "left") {
|
|
|
2894
2936
|
n.push(...a.glyphs), s.push(...a.rules), r = Math.max(r, a.ascent), i = Math.max(i, a.descent), o = Math.max(o, a.width), x = a.italicCorrection;
|
|
2895
2937
|
return { width: o, ascent: r, descent: i, glyphs: n, rules: s, italicCorrection: x };
|
|
2896
2938
|
}
|
|
2897
|
-
function
|
|
2939
|
+
function Xn(e, t, n) {
|
|
2898
2940
|
const s = -n - t, r = -n;
|
|
2899
2941
|
return {
|
|
2900
2942
|
width: e,
|
|
@@ -2905,14 +2947,14 @@ function Vn(e, t, n) {
|
|
|
2905
2947
|
rules: [{ x: 0, y: s, w: e, h: t }]
|
|
2906
2948
|
};
|
|
2907
2949
|
}
|
|
2908
|
-
const
|
|
2950
|
+
const Wr = (e) => ({
|
|
2909
2951
|
width: e,
|
|
2910
2952
|
ascent: 0,
|
|
2911
2953
|
descent: 0,
|
|
2912
2954
|
glyphs: [],
|
|
2913
2955
|
rules: [],
|
|
2914
2956
|
italicCorrection: 0
|
|
2915
|
-
}),
|
|
2957
|
+
}), Zn = 65, Rr = 90, es = 97, Tr = 122, gn = (e) => e >= Zn && e <= Rr, Gr = (e) => e >= es && e <= Tr, Hr = {
|
|
2916
2958
|
bold: 119808,
|
|
2917
2959
|
italic: 119860,
|
|
2918
2960
|
"bold-italic": 119912,
|
|
@@ -2926,7 +2968,7 @@ const Tr = (e) => ({
|
|
|
2926
2968
|
"sans-serif-italic": 120328,
|
|
2927
2969
|
"sans-serif-bold-italic": 120380,
|
|
2928
2970
|
monospace: 120432
|
|
2929
|
-
},
|
|
2971
|
+
}, _r = {
|
|
2930
2972
|
italic: { h: 8462 },
|
|
2931
2973
|
script: {
|
|
2932
2974
|
B: 8492,
|
|
@@ -2943,65 +2985,65 @@ const Tr = (e) => ({
|
|
|
2943
2985
|
},
|
|
2944
2986
|
fraktur: { C: 8493, H: 8460, I: 8465, R: 8476, Z: 8488 },
|
|
2945
2987
|
"double-struck": { C: 8450, H: 8461, N: 8469, P: 8473, Q: 8474, R: 8477, Z: 8484 }
|
|
2946
|
-
}, St = 913, Fn = 945,
|
|
2988
|
+
}, St = 913, Fn = 945, jr = 969, Ur = {
|
|
2947
2989
|
italic: { upper: 120546, lower: 120572 },
|
|
2948
2990
|
"bold-italic": { upper: 120604, lower: 120630 },
|
|
2949
2991
|
bold: { upper: 120488, lower: 120514 }
|
|
2950
2992
|
};
|
|
2951
|
-
function
|
|
2993
|
+
function zr(e, t) {
|
|
2952
2994
|
const n = e.codePointAt(0) ?? 0, s = t ?? "italic";
|
|
2953
2995
|
if (s === "normal") return n;
|
|
2954
|
-
if (gn(n) ||
|
|
2955
|
-
const i =
|
|
2996
|
+
if (gn(n) || Gr(n)) {
|
|
2997
|
+
const i = _r[s]?.[e];
|
|
2956
2998
|
if (i) return i;
|
|
2957
|
-
const o =
|
|
2958
|
-
return o === void 0 ? n : gn(n) ? o + (n -
|
|
2999
|
+
const o = Hr[s];
|
|
3000
|
+
return o === void 0 ? n : gn(n) ? o + (n - Zn) : o + 26 + (n - es);
|
|
2959
3001
|
}
|
|
2960
|
-
const r =
|
|
3002
|
+
const r = Ur[s];
|
|
2961
3003
|
if (r) {
|
|
2962
3004
|
if (n >= St && n <= St + 24) return r.upper + (n - St);
|
|
2963
|
-
if (n >= Fn && n <=
|
|
3005
|
+
if (n >= Fn && n <= jr) return r.lower + (n - Fn);
|
|
2964
3006
|
}
|
|
2965
3007
|
return n;
|
|
2966
3008
|
}
|
|
2967
|
-
function
|
|
2968
|
-
return [...e].length !== 1 ? e : String.fromCodePoint(
|
|
3009
|
+
function Kr(e, t) {
|
|
3010
|
+
return [...e].length !== 1 ? e : String.fromCodePoint(zr(e, t));
|
|
2969
3011
|
}
|
|
2970
3012
|
const je = { italic: !1, bold: !1 };
|
|
2971
|
-
function
|
|
2972
|
-
return
|
|
3013
|
+
function qr(e, t) {
|
|
3014
|
+
return ts(e, t);
|
|
2973
3015
|
}
|
|
2974
3016
|
function ne(e, t) {
|
|
2975
3017
|
switch (e.type) {
|
|
2976
3018
|
case "row":
|
|
2977
|
-
return
|
|
3019
|
+
return ts(e.children, t);
|
|
2978
3020
|
case "ident":
|
|
2979
|
-
return be(
|
|
3021
|
+
return be(Kr(e.text, e.variant), je, t);
|
|
2980
3022
|
case "number":
|
|
2981
3023
|
return be(e.text, je, t);
|
|
2982
3024
|
case "op":
|
|
2983
|
-
return
|
|
3025
|
+
return t0(e.text, t);
|
|
2984
3026
|
case "text":
|
|
2985
3027
|
return be(e.text, je, t);
|
|
2986
3028
|
case "space":
|
|
2987
|
-
return
|
|
3029
|
+
return Wr((e.widthEm ?? 0) * t.style.sizePx);
|
|
2988
3030
|
case "frac":
|
|
2989
|
-
return
|
|
3031
|
+
return s0(e.num, e.den, t, e.thickness === "0", e.bevelled === !0);
|
|
2990
3032
|
case "script":
|
|
2991
3033
|
return t.style.display && e.base.type === "op" && Wt.has(e.base.text) ? ne(
|
|
2992
3034
|
{ type: "limit", base: e.base, ...e.sub ? { under: e.sub } : {}, ...e.sup ? { over: e.sup } : {} },
|
|
2993
3035
|
t
|
|
2994
|
-
) :
|
|
3036
|
+
) : n0(e.base, e.sub, e.sup, t);
|
|
2995
3037
|
case "radical":
|
|
2996
|
-
return
|
|
3038
|
+
return i0(e.radicand, e.index, t);
|
|
2997
3039
|
case "fenced":
|
|
2998
|
-
return
|
|
3040
|
+
return r0(e.open, e.close, e.child, t);
|
|
2999
3041
|
case "limit":
|
|
3000
|
-
return
|
|
3042
|
+
return o0(e.base, e.under, e.over, t);
|
|
3001
3043
|
case "nary":
|
|
3002
|
-
return
|
|
3044
|
+
return c0(e, t);
|
|
3003
3045
|
case "matrix":
|
|
3004
|
-
return
|
|
3046
|
+
return l0(e.rows, t);
|
|
3005
3047
|
case "phantom": {
|
|
3006
3048
|
const n = ne(e.child, t);
|
|
3007
3049
|
return { ...rt(), width: n.width, ascent: n.ascent, descent: n.descent };
|
|
@@ -3022,30 +3064,30 @@ function be(e, t, n) {
|
|
|
3022
3064
|
rules: []
|
|
3023
3065
|
};
|
|
3024
3066
|
}
|
|
3025
|
-
const
|
|
3067
|
+
const $r = new Set("=≠<>≤≥≈≡∈∉⊂⊆⊃⊇→←↔⇒⇐⇔∼≅∝".split("")), Yr = new Set("+−-±∓×÷·∗⋅∪∩∨∧⊕⊗∖".split("")), Jr = new Set(",;".split("")), Vr = new Set("([{⟨".split("")), Qr = new Set(")]}⟩".split(""));
|
|
3026
3068
|
function mn(e) {
|
|
3027
3069
|
if (e.type === "op") {
|
|
3028
3070
|
const t = e.text;
|
|
3029
|
-
if (
|
|
3030
|
-
if (
|
|
3031
|
-
if (
|
|
3032
|
-
if (
|
|
3033
|
-
if (
|
|
3071
|
+
if ($r.has(t)) return "rel";
|
|
3072
|
+
if (Yr.has(t)) return "bin";
|
|
3073
|
+
if (Jr.has(t)) return "punct";
|
|
3074
|
+
if (Vr.has(t)) return "open";
|
|
3075
|
+
if (Qr.has(t)) return "close";
|
|
3034
3076
|
}
|
|
3035
3077
|
return e.type === "fenced" ? "close" : "ord";
|
|
3036
3078
|
}
|
|
3037
|
-
function
|
|
3079
|
+
function Xr(e, t, n) {
|
|
3038
3080
|
let s = mn(e);
|
|
3039
3081
|
const r = mn(t), o = r === "bin" && !(s === "ord" || s === "close" || s === "punct") ? "ord" : r;
|
|
3040
3082
|
return s === "bin" && !["ord", "close"].includes(r) && (s = "ord"), s === "rel" || o === "rel" ? n.thickSpace : s === "bin" || o === "bin" ? n.medSpace : s === "op" || o === "op" || s === "punct" ? n.thinSpace : 0;
|
|
3041
3083
|
}
|
|
3042
|
-
function
|
|
3043
|
-
if (e.length === 0) return
|
|
3084
|
+
function ts(e, t) {
|
|
3085
|
+
if (e.length === 0) return Zr(t);
|
|
3044
3086
|
const n = t.font.constants(t.style.sizePx), s = e.map((i) => ne(i, t)), r = [0];
|
|
3045
|
-
for (let i = 1; i < e.length; i++) r.push(
|
|
3087
|
+
for (let i = 1; i < e.length; i++) r.push(Xr(e[i - 1], e[i], n));
|
|
3046
3088
|
return ft(s, r);
|
|
3047
3089
|
}
|
|
3048
|
-
function
|
|
3090
|
+
function Zr(e) {
|
|
3049
3091
|
const t = e.style.sizePx;
|
|
3050
3092
|
return { width: 0.5 * t, ascent: 0.7 * t, descent: 0, italicCorrection: 0, glyphs: [], rules: [] };
|
|
3051
3093
|
}
|
|
@@ -3061,8 +3103,8 @@ function Ke(e, t) {
|
|
|
3061
3103
|
}
|
|
3062
3104
|
};
|
|
3063
3105
|
}
|
|
3064
|
-
const Wt = new Set("∑∏∐⋀⋁⋂⋃⨀⨁⨂⨄⨆⨅".split("")),
|
|
3065
|
-
function
|
|
3106
|
+
const Wt = new Set("∑∏∐⋀⋁⋂⋃⨀⨁⨂⨄⨆⨅".split("")), e0 = /* @__PURE__ */ new Set([...Wt, ..."∫∬∭∮∯∰∱∲∳⨋⨍⨎⨏"]);
|
|
3107
|
+
function ns(e, t, n, s) {
|
|
3066
3108
|
const r = n.font.measure(e, t, !1, !1), i = (r.ascent - r.descent) / 2 - s.axisHeight;
|
|
3067
3109
|
return {
|
|
3068
3110
|
width: r.width,
|
|
@@ -3073,14 +3115,14 @@ function es(e, t, n, s) {
|
|
|
3073
3115
|
rules: []
|
|
3074
3116
|
};
|
|
3075
3117
|
}
|
|
3076
|
-
function
|
|
3077
|
-
if (t.style.display &&
|
|
3118
|
+
function t0(e, t) {
|
|
3119
|
+
if (t.style.display && e0.has(e)) {
|
|
3078
3120
|
const n = t.font.constants(t.style.sizePx);
|
|
3079
|
-
return
|
|
3121
|
+
return ns(e, n.displayOperatorMinHeight / 0.62, t, n);
|
|
3080
3122
|
}
|
|
3081
3123
|
return be(e, je, t);
|
|
3082
3124
|
}
|
|
3083
|
-
function
|
|
3125
|
+
function n0(e, t, n, s) {
|
|
3084
3126
|
const r = s.font.constants(s.style.sizePx), i = ne(e, s), o = Ke(s), x = n ? ne(n, Ke(s, !0)) : void 0, a = t ? ne(t, o) : void 0, d = [i];
|
|
3085
3127
|
let c = 0;
|
|
3086
3128
|
if (x) {
|
|
@@ -3104,7 +3146,7 @@ function ye(e, t) {
|
|
|
3104
3146
|
rules: e.rules.map((n) => ({ ...n, x: n.x + t }))
|
|
3105
3147
|
};
|
|
3106
3148
|
}
|
|
3107
|
-
function
|
|
3149
|
+
function s0(e, t, n, s, r) {
|
|
3108
3150
|
const i = n.font.constants(n.style.sizePx), o = ne(e, n), x = ne(t, { font: n.font, style: { ...n.style, cramped: !0 } });
|
|
3109
3151
|
if (r)
|
|
3110
3152
|
return ft([o, be("/", { italic: !1, bold: !1 }, n), x]);
|
|
@@ -3115,12 +3157,12 @@ function ro(e, t, n, s, r) {
|
|
|
3115
3157
|
i.fracDenShiftDown,
|
|
3116
3158
|
-(d - a / 2) + i.fracDenGapMin + x.ascent
|
|
3117
3159
|
), f = Ee(ve(o, c), 0, l), N = Ee(ve(x, c), 0, h), p = [f, N];
|
|
3118
|
-
return a > 0 && p.push(
|
|
3160
|
+
return a > 0 && p.push(Xn(c, a, d - a / 2)), { ...We(p, "left"), width: c, italicCorrection: 0 };
|
|
3119
3161
|
}
|
|
3120
3162
|
function ve(e, t) {
|
|
3121
3163
|
return ye(e, (t - e.width) / 2);
|
|
3122
3164
|
}
|
|
3123
|
-
function
|
|
3165
|
+
function i0(e, t, n) {
|
|
3124
3166
|
const s = n.font.constants(n.style.sizePx), r = ne(e, { font: n.font, style: { ...n.style, cramped: !0 } }), i = s.radicalRuleThickness, o = s.radicalVerticalGap, x = s.radicalExtraAscender, a = r.ascent + r.descent + o + i, d = n.font.measure("√", Math.max(n.style.sizePx, a * 0.9), !1, !1), c = {
|
|
3125
3167
|
width: d.width,
|
|
3126
3168
|
ascent: r.ascent + o + i + x,
|
|
@@ -3128,12 +3170,12 @@ function oo(e, t, n) {
|
|
|
3128
3170
|
italicCorrection: 0,
|
|
3129
3171
|
glyphs: [{ x: 0, y: 0, text: "√", sizePx: Math.max(n.style.sizePx, a * 0.9), italic: !1, bold: !1 }],
|
|
3130
3172
|
rules: []
|
|
3131
|
-
}, l = ye(r, d.width), h = ye(
|
|
3173
|
+
}, l = ye(r, d.width), h = ye(Xn(r.width, i, r.ascent + o), d.width), N = { ...We([c, l, h], "left"), width: d.width + r.width };
|
|
3132
3174
|
if (!t) return N;
|
|
3133
3175
|
const p = ne(t, Ke(Ke(n))), S = s.radicalDegreeRaise * a, m = Ee(p, 0, -S), T = ye(N, p.width);
|
|
3134
3176
|
return { ...We([m, T], "left"), width: p.width + N.width };
|
|
3135
3177
|
}
|
|
3136
|
-
function
|
|
3178
|
+
function r0(e, t, n, s) {
|
|
3137
3179
|
const r = s.font.constants(s.style.sizePx), i = ne(n, s), o = [];
|
|
3138
3180
|
return e && o.push(Nn(e, i, s, r)), o.push(i), t && o.push(Nn(t, i, s, r)), ft(o);
|
|
3139
3181
|
}
|
|
@@ -3141,9 +3183,9 @@ function Nn(e, t, n, s) {
|
|
|
3141
3183
|
const r = n.style.sizePx, i = t.ascent + t.descent;
|
|
3142
3184
|
if (i <= r * 1.05) return be(e, je, n);
|
|
3143
3185
|
const o = Math.min(r * 3.5, i + 2 * s.ruleThickness);
|
|
3144
|
-
return
|
|
3186
|
+
return ns(e, o, n, s);
|
|
3145
3187
|
}
|
|
3146
|
-
function
|
|
3188
|
+
function o0(e, t, n, s) {
|
|
3147
3189
|
const r = s.font.constants(s.style.sizePx), i = ne(e, s), o = Ke(s), x = Math.max(i.width, t ? ne(t, o).width : 0, n ? ne(n, o).width : 0), a = [ve(i, x)];
|
|
3148
3190
|
if (n) {
|
|
3149
3191
|
const c = ve(ne(n, o), x);
|
|
@@ -3155,11 +3197,11 @@ function lo(e, t, n, s) {
|
|
|
3155
3197
|
}
|
|
3156
3198
|
return { ...We(a, "left"), width: x };
|
|
3157
3199
|
}
|
|
3158
|
-
function
|
|
3200
|
+
function c0(e, t) {
|
|
3159
3201
|
const n = t.font.constants(t.style.sizePx), s = { type: "op", text: e.hideOp ? "" : e.op }, i = t.style.display === !0 && Wt.has(e.op) ? { type: "limit", base: s, ...e.sub ? { under: e.sub } : {}, ...e.sup ? { over: e.sup } : {} } : { type: "script", base: s, ...e.sub ? { sub: e.sub } : {}, ...e.sup ? { sup: e.sup } : {} };
|
|
3160
3202
|
return ft([ne(i, t), ne(e.body, t)], [0, e.hideOp ? 0 : n.thinSpace]);
|
|
3161
3203
|
}
|
|
3162
|
-
function
|
|
3204
|
+
function l0(e, t) {
|
|
3163
3205
|
const n = t.font.constants(t.style.sizePx), s = 2 * n.thickSpace, r = n.thinSpace * 3;
|
|
3164
3206
|
if (e.length === 0) return rt();
|
|
3165
3207
|
const i = e.map((p) => p.map((S) => ne(S, t))), o = Math.max(...i.map((p) => p.length));
|
|
@@ -3184,7 +3226,7 @@ function xo(e, t) {
|
|
|
3184
3226
|
const f = x.reduce((p, S) => p + S, 0) + s * (o - 1);
|
|
3185
3227
|
return { ...We(h, "left"), width: f };
|
|
3186
3228
|
}
|
|
3187
|
-
const
|
|
3229
|
+
const a0 = {
|
|
3188
3230
|
axisHeight: 0.258,
|
|
3189
3231
|
ruleThickness: 0.068,
|
|
3190
3232
|
scriptPercent: 0.7,
|
|
@@ -3207,7 +3249,7 @@ const fo = {
|
|
|
3207
3249
|
radicalDegreeRaise: 0.55,
|
|
3208
3250
|
displayOperatorMinHeight: 1.8
|
|
3209
3251
|
};
|
|
3210
|
-
function
|
|
3252
|
+
function x0(e) {
|
|
3211
3253
|
const t = e / 18, n = Math.max(0.5, 0.04 * e);
|
|
3212
3254
|
return {
|
|
3213
3255
|
axisHeight: 0.25 * e,
|
|
@@ -3236,8 +3278,8 @@ function uo(e) {
|
|
|
3236
3278
|
lowerLimitBaselineDrop: 0.6 * e
|
|
3237
3279
|
};
|
|
3238
3280
|
}
|
|
3239
|
-
function
|
|
3240
|
-
const t =
|
|
3281
|
+
function f0(e) {
|
|
3282
|
+
const t = a0, n = e / 18;
|
|
3241
3283
|
return {
|
|
3242
3284
|
axisHeight: t.axisHeight * e,
|
|
3243
3285
|
ruleThickness: t.ruleThickness * e,
|
|
@@ -3265,21 +3307,21 @@ function ho(e) {
|
|
|
3265
3307
|
lowerLimitBaselineDrop: t.lowerLimitBaselineDropMin * e
|
|
3266
3308
|
};
|
|
3267
3309
|
}
|
|
3268
|
-
function
|
|
3269
|
-
const t =
|
|
3310
|
+
function u0(e) {
|
|
3311
|
+
const t = Us(Tn(e)).clone, n = (r, i, o) => `${i ? "italic " : ""}${o ? "700" : "400"} ${r}px ${t}`;
|
|
3270
3312
|
return {
|
|
3271
3313
|
family: t,
|
|
3272
3314
|
measure(r, i, o, x) {
|
|
3273
3315
|
const a = n(i, o, x), d = de(r, a), c = ze(a), l = o ? Math.min(0.12 * i, 0.15 * d) : 0;
|
|
3274
3316
|
return { width: d, ascent: c.ascent, descent: c.descent, italicCorrection: l };
|
|
3275
3317
|
},
|
|
3276
|
-
constants: t === ot ?
|
|
3318
|
+
constants: t === ot ? f0 : x0
|
|
3277
3319
|
};
|
|
3278
3320
|
}
|
|
3279
|
-
const
|
|
3280
|
-
function
|
|
3321
|
+
const h0 = 22, Sn = /* @__PURE__ */ new Map(), An = /* @__PURE__ */ new WeakMap();
|
|
3322
|
+
function d0(e) {
|
|
3281
3323
|
let t = Sn.get(e);
|
|
3282
|
-
return t || (t =
|
|
3324
|
+
return t || (t = u0(e), Sn.set(e, t)), t;
|
|
3283
3325
|
}
|
|
3284
3326
|
function Rt(e, t, n) {
|
|
3285
3327
|
const s = `${t}|${n}`;
|
|
@@ -3289,58 +3331,58 @@ function Rt(e, t, n) {
|
|
|
3289
3331
|
if (o) return o;
|
|
3290
3332
|
} else
|
|
3291
3333
|
r = /* @__PURE__ */ new Map(), An.set(e, r);
|
|
3292
|
-
const i =
|
|
3293
|
-
font:
|
|
3334
|
+
const i = qr(e.root.children, {
|
|
3335
|
+
font: d0(t),
|
|
3294
3336
|
style: { sizePx: n, cramped: !1, display: e.display }
|
|
3295
3337
|
});
|
|
3296
3338
|
return r.set(s, i), i;
|
|
3297
3339
|
}
|
|
3298
|
-
let ts = null;
|
|
3299
|
-
function mo(e) {
|
|
3300
|
-
ts = e && e.trim().length > 0 ? e.trim() : null;
|
|
3301
|
-
}
|
|
3302
|
-
let ns = null;
|
|
3303
|
-
function No(e) {
|
|
3304
|
-
ns = e && e.trim().length > 0 ? e.trim() : null;
|
|
3305
|
-
}
|
|
3306
3340
|
let ss = null;
|
|
3307
|
-
function
|
|
3341
|
+
function p0(e) {
|
|
3308
3342
|
ss = e && e.trim().length > 0 ? e.trim() : null;
|
|
3309
3343
|
}
|
|
3344
|
+
let is = null;
|
|
3345
|
+
function g0(e) {
|
|
3346
|
+
is = e && e.trim().length > 0 ? e.trim() : null;
|
|
3347
|
+
}
|
|
3348
|
+
let rs = null;
|
|
3349
|
+
function F0(e) {
|
|
3350
|
+
rs = e && e.trim().length > 0 ? e.trim() : null;
|
|
3351
|
+
}
|
|
3310
3352
|
let En, Mn = !1;
|
|
3311
|
-
function
|
|
3312
|
-
Mn && En === e || (
|
|
3353
|
+
function m0(e) {
|
|
3354
|
+
Mn && En === e || (si(e), ni(), En = e, Mn = !0);
|
|
3313
3355
|
}
|
|
3314
|
-
const
|
|
3356
|
+
const N0 = (e) => {
|
|
3315
3357
|
for (const t of e) if (fe(t)) return !0;
|
|
3316
3358
|
return !1;
|
|
3317
3359
|
};
|
|
3318
|
-
function
|
|
3360
|
+
function os(e) {
|
|
3319
3361
|
const t = e.codePointAt(0);
|
|
3320
3362
|
return t === void 0 ? !1 : t >= 1536 && t <= 1791 || t >= 1872 && t <= 1919 || t >= 2160 && t <= 2207 || t >= 2208 && t <= 2303 || t >= 64336 && t <= 65023 || t >= 65136 && t <= 65279;
|
|
3321
3363
|
}
|
|
3322
|
-
const
|
|
3323
|
-
for (const t of e) if (
|
|
3364
|
+
const S0 = (e) => {
|
|
3365
|
+
for (const t of e) if (os(t)) return !0;
|
|
3324
3366
|
return !1;
|
|
3325
3367
|
};
|
|
3326
|
-
function
|
|
3368
|
+
function cs(e) {
|
|
3327
3369
|
const t = e.codePointAt(0);
|
|
3328
3370
|
return t === void 0 ? !1 : t >= 1424 && t <= 1535 || t >= 64285 && t <= 64335;
|
|
3329
3371
|
}
|
|
3330
|
-
const
|
|
3331
|
-
for (const t of e) if (
|
|
3372
|
+
const A0 = (e) => {
|
|
3373
|
+
for (const t of e) if (cs(t)) return !0;
|
|
3332
3374
|
return !1;
|
|
3333
3375
|
};
|
|
3334
|
-
function
|
|
3335
|
-
return n &&
|
|
3376
|
+
function E0(e, t, n, s) {
|
|
3377
|
+
return n && os(e) ? "arabic" : s && cs(e) ? "hebrew" : t && fe(e) ? "cjk" : "other";
|
|
3336
3378
|
}
|
|
3337
|
-
function
|
|
3338
|
-
const t =
|
|
3379
|
+
function M0(e) {
|
|
3380
|
+
const t = ss, n = is, s = rs;
|
|
3339
3381
|
if (!t && !n && !s) return e;
|
|
3340
3382
|
const r = [];
|
|
3341
3383
|
let i = !1;
|
|
3342
3384
|
for (const o of e) {
|
|
3343
|
-
const x = Tn(o.style.fontFamily), a = t && x !== t &&
|
|
3385
|
+
const x = Tn(o.style.fontFamily), a = t && x !== t && N0(o.text), d = n && x !== n && S0(o.text), c = s && x !== s && A0(o.text);
|
|
3344
3386
|
if (o.text.length === 0 || !a && !d && !c) {
|
|
3345
3387
|
r.push(o);
|
|
3346
3388
|
continue;
|
|
@@ -3353,14 +3395,14 @@ function bo(e) {
|
|
|
3353
3395
|
h === "arabic" && n ? N = n : h === "hebrew" && s ? N = s : h === "cjk" && t && (N = t), r.push({ text: l, style: N === o.style.fontFamily ? o.style : { ...o.style, fontFamily: N } }), l = "";
|
|
3354
3396
|
};
|
|
3355
3397
|
for (const N of o.text) {
|
|
3356
|
-
const p =
|
|
3398
|
+
const p = E0(N, t, n, s);
|
|
3357
3399
|
h !== null && p !== h && f(), h = p, l += N;
|
|
3358
3400
|
}
|
|
3359
3401
|
f();
|
|
3360
3402
|
}
|
|
3361
3403
|
return i ? r : e;
|
|
3362
3404
|
}
|
|
3363
|
-
function
|
|
3405
|
+
function k0(e) {
|
|
3364
3406
|
const t = [];
|
|
3365
3407
|
let n = [], s = 0, r = 0;
|
|
3366
3408
|
for (const i of e) {
|
|
@@ -3376,7 +3418,7 @@ function Co(e) {
|
|
|
3376
3418
|
}
|
|
3377
3419
|
return t.push({ runs: n, startOffset: s }), t;
|
|
3378
3420
|
}
|
|
3379
|
-
function
|
|
3421
|
+
function B0(e) {
|
|
3380
3422
|
return e.map((t) => {
|
|
3381
3423
|
if (t.style.equation && !t.style.hidden) {
|
|
3382
3424
|
const s = le(t.style), r = Rt(t.style.equation, ot, t.style.fontSizePx), i = de(t.text, s);
|
|
@@ -3386,16 +3428,16 @@ function yo(e) {
|
|
|
3386
3428
|
return !t.style.hidden && t.style.letterSpacingPx !== void 0 && (n.letterSpacing = t.style.letterSpacingPx), n;
|
|
3387
3429
|
});
|
|
3388
3430
|
}
|
|
3389
|
-
const
|
|
3431
|
+
const b0 = (e) => Math.round(e * 100) / 100, C0 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
3390
3432
|
function kn(e) {
|
|
3391
3433
|
const t = e.toUpperCase();
|
|
3392
3434
|
return t.length === e.length ? t : e;
|
|
3393
3435
|
}
|
|
3394
|
-
function
|
|
3436
|
+
function y0(e) {
|
|
3395
3437
|
const t = e.toUpperCase();
|
|
3396
3438
|
return t.length === e.length && t !== e;
|
|
3397
3439
|
}
|
|
3398
|
-
function
|
|
3440
|
+
function w0(e) {
|
|
3399
3441
|
let t = !1;
|
|
3400
3442
|
for (const s of e)
|
|
3401
3443
|
if ((s.style.caps || s.style.smallCaps) && !s.style.equation) {
|
|
@@ -3415,29 +3457,29 @@ function Oo(e) {
|
|
|
3415
3457
|
n.push({ text: [...s.text].map(kn).join(""), style: o });
|
|
3416
3458
|
continue;
|
|
3417
3459
|
}
|
|
3418
|
-
const x = { ...o, fontSizePx:
|
|
3460
|
+
const x = { ...o, fontSizePx: b0(s.style.fontSizePx * zs) };
|
|
3419
3461
|
let a = "", d = null;
|
|
3420
3462
|
const c = () => {
|
|
3421
3463
|
a.length !== 0 && (n.push({ text: a, style: d ? x : o }), a = "");
|
|
3422
3464
|
};
|
|
3423
|
-
for (const { segment: l } of
|
|
3424
|
-
const h = String.fromCodePoint(l.codePointAt(0)), f =
|
|
3465
|
+
for (const { segment: l } of C0.segment(s.text)) {
|
|
3466
|
+
const h = String.fromCodePoint(l.codePointAt(0)), f = y0(h);
|
|
3425
3467
|
d !== null && f !== d && c(), d = f, a += f ? [...l].map(kn).join("") : l;
|
|
3426
3468
|
}
|
|
3427
3469
|
c();
|
|
3428
3470
|
}
|
|
3429
3471
|
return n;
|
|
3430
3472
|
}
|
|
3431
|
-
function
|
|
3432
|
-
const t =
|
|
3433
|
-
return { prepared:
|
|
3473
|
+
function ls(e) {
|
|
3474
|
+
const t = M0(w0(e));
|
|
3475
|
+
return { prepared: Lr(B0(t)), runs: t };
|
|
3434
3476
|
}
|
|
3435
3477
|
class bt {
|
|
3436
3478
|
map = /* @__PURE__ */ new Map();
|
|
3437
3479
|
get(t) {
|
|
3438
3480
|
const n = this.map.get(t.id);
|
|
3439
3481
|
if (n && n.revision === t.revision) return n.segments;
|
|
3440
|
-
const s =
|
|
3482
|
+
const s = k0(t.runs).map((r) => ({ ...ls(r.runs), startOffset: r.startOffset }));
|
|
3441
3483
|
return this.map.set(t.id, { revision: t.revision, segments: s }), s;
|
|
3442
3484
|
}
|
|
3443
3485
|
evict(t) {
|
|
@@ -3455,19 +3497,19 @@ class bt {
|
|
|
3455
3497
|
for (const n of this.map.keys()) t.has(n) || this.map.delete(n);
|
|
3456
3498
|
}
|
|
3457
3499
|
}
|
|
3458
|
-
function
|
|
3500
|
+
function as(e) {
|
|
3459
3501
|
return e === "rtl" ? 1 : 0;
|
|
3460
3502
|
}
|
|
3461
|
-
const
|
|
3462
|
-
function
|
|
3463
|
-
return
|
|
3503
|
+
const D0 = /[-ࣿיִ-﷿ﹰ-]/;
|
|
3504
|
+
function L0(e) {
|
|
3505
|
+
return D0.test(e);
|
|
3464
3506
|
}
|
|
3465
|
-
function
|
|
3507
|
+
function O0(e, t) {
|
|
3466
3508
|
const n = e.length;
|
|
3467
3509
|
if (n === 0) return null;
|
|
3468
3510
|
const s = new Array(n);
|
|
3469
3511
|
for (let r = 0; r < n; r++) s[r] = r;
|
|
3470
|
-
return
|
|
3512
|
+
return _n(e, s, t);
|
|
3471
3513
|
}
|
|
3472
3514
|
const Bn = (e, t, n) => {
|
|
3473
3515
|
for (; t < n; ) {
|
|
@@ -3475,7 +3517,7 @@ const Bn = (e, t, n) => {
|
|
|
3475
3517
|
e[t] = e[n], e[n] = s, t++, n--;
|
|
3476
3518
|
}
|
|
3477
3519
|
};
|
|
3478
|
-
function
|
|
3520
|
+
function P0(e) {
|
|
3479
3521
|
const t = e.length, n = Array.from({ length: t }, (o, x) => x);
|
|
3480
3522
|
if (t <= 1) return n;
|
|
3481
3523
|
const s = e.slice();
|
|
@@ -3494,11 +3536,11 @@ function Wo(e) {
|
|
|
3494
3536
|
}
|
|
3495
3537
|
return n;
|
|
3496
3538
|
}
|
|
3497
|
-
function
|
|
3539
|
+
function xs(e, t) {
|
|
3498
3540
|
return t !== "rtl" ? e : e === "left" ? "right" : e === "right" ? "left" : e;
|
|
3499
3541
|
}
|
|
3500
|
-
const Re = (e) => Rt(e.equation, ot,
|
|
3501
|
-
let
|
|
3542
|
+
const Re = (e) => Rt(e.equation, ot, h0), fs = 48;
|
|
3543
|
+
let us = fs;
|
|
3502
3544
|
function Ce(e, t, n) {
|
|
3503
3545
|
const { borders: s, shading: r } = e;
|
|
3504
3546
|
if (!s && !r) return;
|
|
@@ -3511,15 +3553,15 @@ function bn(e) {
|
|
|
3511
3553
|
function Cn(e) {
|
|
3512
3554
|
return e.borders ? (e.borders.bottom?.widthPx ?? 0) + yt : 0;
|
|
3513
3555
|
}
|
|
3514
|
-
const
|
|
3515
|
-
function
|
|
3556
|
+
const I0 = (e) => e.reduce((t, n) => t + n.height, 0);
|
|
3557
|
+
function v0(e, t) {
|
|
3516
3558
|
const n = t?.cjkFallback ?? null, s = t?.cjkLocale, r = t?.arabicFallback ?? null, i = t?.hebrewFallback ?? null, o = new bt(), x = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
3517
3559
|
let d = null;
|
|
3518
3560
|
const c = (b, O) => {
|
|
3519
3561
|
d?.add(b.id);
|
|
3520
3562
|
const E = x.get(b.id);
|
|
3521
3563
|
if (E && E.revision === b.revision && E.width === O) return E.lines;
|
|
3522
|
-
const y =
|
|
3564
|
+
const y = Ss(b, O, o);
|
|
3523
3565
|
return x.set(b.id, { revision: b.revision, width: O, lines: y }), y;
|
|
3524
3566
|
}, l = (b, O, E, y) => {
|
|
3525
3567
|
d?.add(b.id);
|
|
@@ -3534,7 +3576,7 @@ function To(e, t) {
|
|
|
3534
3576
|
return O === void 0 && (O = ++f, h.set(b, O)), O;
|
|
3535
3577
|
}, p = /* @__PURE__ */ new WeakMap(), S = (b) => {
|
|
3536
3578
|
let O = p.get(b);
|
|
3537
|
-
return O === void 0 && (O =
|
|
3579
|
+
return O === void 0 && (O = Y0(b).some((E) => /\{(date|time)\}/.test(E)), p.set(b, O)), O;
|
|
3538
3580
|
}, m = /* @__PURE__ */ new Map();
|
|
3539
3581
|
let T = null;
|
|
3540
3582
|
const I = (b, O, E, y, G, C, z) => {
|
|
@@ -3548,11 +3590,11 @@ function To(e, t) {
|
|
|
3548
3590
|
};
|
|
3549
3591
|
return {
|
|
3550
3592
|
layout(b, O, E) {
|
|
3551
|
-
e &&
|
|
3593
|
+
e && qs(e), p0(n), g0(r), F0(i), m0(s), us = b.defaultTabStopPx && b.defaultTabStopPx > 0 ? b.defaultTabStopPx : fs;
|
|
3552
3594
|
const y = E?.rawBand ?? null;
|
|
3553
3595
|
d = y === null ? /* @__PURE__ */ new Set() : null, T = y === null ? /* @__PURE__ */ new Set() : null;
|
|
3554
3596
|
try {
|
|
3555
|
-
const G =
|
|
3597
|
+
const G = q0(b, c, (C) => (d?.add(C.id), o.get(C)), y, l, I);
|
|
3556
3598
|
if (d) {
|
|
3557
3599
|
for (const C of x.keys()) d.has(C) || x.delete(C);
|
|
3558
3600
|
for (const C of a.keys()) d.has(C) || a.delete(C);
|
|
@@ -3573,12 +3615,12 @@ function To(e, t) {
|
|
|
3573
3615
|
}
|
|
3574
3616
|
};
|
|
3575
3617
|
}
|
|
3576
|
-
function
|
|
3618
|
+
function hs(e) {
|
|
3577
3619
|
let t = 0;
|
|
3578
3620
|
for (let n = 0; n < e.length; n++) e.charCodeAt(n) === 32 && t++;
|
|
3579
3621
|
return t;
|
|
3580
3622
|
}
|
|
3581
|
-
const
|
|
3623
|
+
const W0 = (e) => e === " " || e === " " || e === `
|
|
3582
3624
|
` || e === "\r";
|
|
3583
3625
|
function yn(e, t, n) {
|
|
3584
3626
|
const s = e.indexOf(n, t);
|
|
@@ -3590,7 +3632,7 @@ function yn(e, t, n) {
|
|
|
3590
3632
|
x < 0 && (x = i), r.push(i - x), i++, o++;
|
|
3591
3633
|
continue;
|
|
3592
3634
|
}
|
|
3593
|
-
if (
|
|
3635
|
+
if (W0(e[i])) {
|
|
3594
3636
|
i++;
|
|
3595
3637
|
continue;
|
|
3596
3638
|
}
|
|
@@ -3606,20 +3648,20 @@ function Tt(e, t) {
|
|
|
3606
3648
|
n.push(s), s += r.text.length;
|
|
3607
3649
|
return n;
|
|
3608
3650
|
}
|
|
3609
|
-
function
|
|
3651
|
+
function R0(e) {
|
|
3610
3652
|
return _s(e) && !e.style.sectionBreak && !e.style.pageBreakBefore;
|
|
3611
3653
|
}
|
|
3612
3654
|
function Gt(e, t, n) {
|
|
3613
3655
|
return e.lineRule === "exact" ? e.lineHeightPx ?? n : e.lineRule === "atLeast" ? Math.max(n, e.lineHeightPx ?? 0) : Math.max(n, e.lineHeight * t);
|
|
3614
3656
|
}
|
|
3615
|
-
function
|
|
3657
|
+
function ds(e) {
|
|
3616
3658
|
const t = e.runs[0]?.style, n = t?.fontSizePx ?? 16, s = t ? ze(le(t)) : { ascent: n * 0.8, descent: n * 0.2 }, r = s.ascent + s.descent, i = Gt(e.style, n, r);
|
|
3617
3659
|
return { height: i, ascent: (i - r) / 2 + s.ascent };
|
|
3618
3660
|
}
|
|
3619
3661
|
function Ht(e, t, n, s, r, i) {
|
|
3620
|
-
const o =
|
|
3662
|
+
const o = Pr(t.prepared, n, s);
|
|
3621
3663
|
if (o === null) return null;
|
|
3622
|
-
const x =
|
|
3664
|
+
const x = vr(t.prepared, o), a = [];
|
|
3623
3665
|
let d = 0, c = 0, l = 0, h = 0;
|
|
3624
3666
|
for (const p of x.fragments) {
|
|
3625
3667
|
d += p.gapBefore;
|
|
@@ -3647,7 +3689,7 @@ function Ht(e, t, n, s, r, i) {
|
|
|
3647
3689
|
}
|
|
3648
3690
|
const m = ze(le(S.style));
|
|
3649
3691
|
c = Math.max(c, m.ascent), l = Math.max(l, m.descent), h = Math.max(h, S.style.fontSizePx);
|
|
3650
|
-
const T = p.occupiedWidth *
|
|
3692
|
+
const T = p.occupiedWidth * Ks(S.style);
|
|
3651
3693
|
if (p.text.length > 0) {
|
|
3652
3694
|
const I = yn(S.text, i[p.itemIndex], p.text);
|
|
3653
3695
|
i[p.itemIndex] = I.end;
|
|
@@ -3660,7 +3702,7 @@ function Ht(e, t, n, s, r, i) {
|
|
|
3660
3702
|
x: d,
|
|
3661
3703
|
width: T
|
|
3662
3704
|
};
|
|
3663
|
-
I.map && (b.offsetMap = I.map), a.push({ frag: b, hadGap: p.gapBefore > 0, gap: p.gapBefore, spaces:
|
|
3705
|
+
I.map && (b.offsetMap = I.map), a.push({ frag: b, hadGap: p.gapBefore > 0, gap: p.gapBefore, spaces: hs(p.text) });
|
|
3664
3706
|
}
|
|
3665
3707
|
d += T;
|
|
3666
3708
|
}
|
|
@@ -3672,9 +3714,9 @@ function Ht(e, t, n, s, r, i) {
|
|
|
3672
3714
|
}
|
|
3673
3715
|
}
|
|
3674
3716
|
const f = c + l, N = Gt(e.style, h, f);
|
|
3675
|
-
return { frags: a, width: x.width, height: N, ascent:
|
|
3717
|
+
return { frags: a, width: x.width, height: N, ascent: T0(e.style.textAlignment, N, c, l), end: x.end };
|
|
3676
3718
|
}
|
|
3677
|
-
function
|
|
3719
|
+
function T0(e, t, n, s) {
|
|
3678
3720
|
switch (e) {
|
|
3679
3721
|
case "top":
|
|
3680
3722
|
return n;
|
|
@@ -3684,19 +3726,19 @@ function _o(e, t, n, s) {
|
|
|
3684
3726
|
return (t - (n + s)) / 2 + n;
|
|
3685
3727
|
}
|
|
3686
3728
|
}
|
|
3687
|
-
function
|
|
3729
|
+
function G0(e, t, n) {
|
|
3688
3730
|
for (const i of t) if (i.posPx > e + 0.5) return i;
|
|
3689
|
-
const s =
|
|
3731
|
+
const s = us;
|
|
3690
3732
|
let r = (Math.floor(e / s) + 1) * s;
|
|
3691
3733
|
return r <= e && (r = e + s), { posPx: Math.min(r, Math.max(e + 1, n)), align: "left", leader: "none" };
|
|
3692
3734
|
}
|
|
3693
|
-
function
|
|
3694
|
-
const t = e.map((r) => r.text).join(""), n = le(e[0]?.style ??
|
|
3735
|
+
function H0(e) {
|
|
3736
|
+
const t = e.map((r) => r.text).join(""), n = le(e[0]?.style ?? ps);
|
|
3695
3737
|
let s = t.indexOf(".");
|
|
3696
3738
|
return s < 0 && (s = t.indexOf(",")), de(s < 0 ? t : t.slice(0, s + 1), n);
|
|
3697
3739
|
}
|
|
3698
|
-
const
|
|
3699
|
-
function
|
|
3740
|
+
const ps = { fontFamily: "Georgia, serif", fontSizePx: 16 }, wn = { fontFamily: "Georgia, serif", fontSizePx: 12, color: "#9aa0a6" }, _0 = 18;
|
|
3741
|
+
function j0(e, t, n, s, r) {
|
|
3700
3742
|
const i = [];
|
|
3701
3743
|
let o = [], x = n, a = n;
|
|
3702
3744
|
for (const b of t) {
|
|
@@ -3736,12 +3778,12 @@ function Ko(e, t, n, s, r) {
|
|
|
3736
3778
|
};
|
|
3737
3779
|
return i.forEach((b, O) => {
|
|
3738
3780
|
if (O > 0) {
|
|
3739
|
-
const j =
|
|
3781
|
+
const j = G0(p, d, s), D = j.align ?? "left", W = de(b.runs.map((v) => v.text).join(""), le(b.runs[0]?.style ?? c ?? ps)), M = p + W <= s;
|
|
3740
3782
|
let L = j.posPx;
|
|
3741
|
-
M && D === "right" ? L = j.posPx - W : M && D === "center" ? L = j.posPx - W / 2 : M && D === "decimal" && (L = j.posPx -
|
|
3783
|
+
M && D === "right" ? L = j.posPx - W : M && D === "center" ? L = j.posPx - W / 2 : M && D === "decimal" && (L = j.posPx - H0(b.runs)), L < p && (L = p), (j.leader ?? "none") !== "none" && L > p + 1 && c && f.push({ x1: p, x2: L, kind: j.leader ?? "none", color: c.color, fontSizePx: c.fontSizePx }), N.push({ x1: p, x2: Math.max(L, p) }), p = L, T = !0;
|
|
3742
3784
|
}
|
|
3743
3785
|
if (b.runs.length === 0) return;
|
|
3744
|
-
const E =
|
|
3786
|
+
const E = ls(b.runs), y = { prepared: E.prepared, runs: E.runs, startOffset: b.start }, G = Tt(E.runs, b.start), C = E.runs.map(() => 0);
|
|
3745
3787
|
let z, R = !0;
|
|
3746
3788
|
for (; ; ) {
|
|
3747
3789
|
const j = Math.max(24, s - (R ? p : 0)), D = Ht(e, y, j, z, G, C);
|
|
@@ -3754,7 +3796,7 @@ function Ko(e, t, n, s, r) {
|
|
|
3754
3796
|
}
|
|
3755
3797
|
}), I(!0), l;
|
|
3756
3798
|
}
|
|
3757
|
-
function
|
|
3799
|
+
function gs(e, t) {
|
|
3758
3800
|
if (t <= 0) return;
|
|
3759
3801
|
const n = e.reduce((i, o) => i + o.spaces + (o.hadGap ? 1 : 0), 0);
|
|
3760
3802
|
if (n <= 0) return;
|
|
@@ -3763,16 +3805,16 @@ function ds(e, t) {
|
|
|
3763
3805
|
for (const i of e)
|
|
3764
3806
|
i.hadGap && (r += s), i.frag.x += r, i.spaces > 0 && (i.frag.wordSpacingPx = s, i.frag.width += i.spaces * s, r += i.spaces * s);
|
|
3765
3807
|
}
|
|
3766
|
-
function
|
|
3767
|
-
const t =
|
|
3808
|
+
function Fs(e) {
|
|
3809
|
+
const t = as(e.style.direction);
|
|
3768
3810
|
let n = "";
|
|
3769
3811
|
const s = [];
|
|
3770
3812
|
for (const i of e.runs) {
|
|
3771
3813
|
const o = n.length;
|
|
3772
3814
|
n += i.text, i.style.rtl && s.push([o, n.length]);
|
|
3773
3815
|
}
|
|
3774
|
-
if (t === 0 && s.length === 0 && !
|
|
3775
|
-
let r =
|
|
3816
|
+
if (t === 0 && s.length === 0 && !L0(n)) return null;
|
|
3817
|
+
let r = O0(n, t);
|
|
3776
3818
|
if (r === null) {
|
|
3777
3819
|
if (s.length === 0) return null;
|
|
3778
3820
|
r = new Int8Array(n.length);
|
|
@@ -3781,7 +3823,7 @@ function ps(e) {
|
|
|
3781
3823
|
for (let x = i; x < o; x++) (r[x] & 1) === 0 && (r[x] = r[x] + 1);
|
|
3782
3824
|
return r;
|
|
3783
3825
|
}
|
|
3784
|
-
function
|
|
3826
|
+
function ms(e, t) {
|
|
3785
3827
|
const { frag: n } = e, s = n.startOffset, r = n.endOffset, i = t[s] ?? 0;
|
|
3786
3828
|
if (n.offsetMap || n.style.fieldId !== void 0 || n.text.length !== r - s)
|
|
3787
3829
|
return n.level = i, [e];
|
|
@@ -3796,7 +3838,7 @@ function gs(e, t) {
|
|
|
3796
3838
|
d.push({
|
|
3797
3839
|
hadGap: c === 0 ? e.hadGap : !1,
|
|
3798
3840
|
gap: c === 0 ? e.gap : 0,
|
|
3799
|
-
spaces:
|
|
3841
|
+
spaces: hs(f),
|
|
3800
3842
|
frag: {
|
|
3801
3843
|
...n,
|
|
3802
3844
|
text: f,
|
|
@@ -3809,35 +3851,35 @@ function gs(e, t) {
|
|
|
3809
3851
|
}
|
|
3810
3852
|
return d;
|
|
3811
3853
|
}
|
|
3812
|
-
function
|
|
3854
|
+
function Ns(e, t) {
|
|
3813
3855
|
const n = [];
|
|
3814
|
-
for (const o of e) n.push(...
|
|
3815
|
-
const r =
|
|
3856
|
+
for (const o of e) n.push(...ms(o, t));
|
|
3857
|
+
const r = P0(n.map((o) => o.frag.level ?? 0)).map((o) => n[o]);
|
|
3816
3858
|
let i = 0;
|
|
3817
3859
|
for (const o of r)
|
|
3818
3860
|
i += o.gap, o.frag.x = i, i += o.frag.width;
|
|
3819
3861
|
return { frags: r, width: i };
|
|
3820
3862
|
}
|
|
3821
|
-
function
|
|
3863
|
+
function U0(e, t, n) {
|
|
3822
3864
|
const s = [];
|
|
3823
3865
|
for (const r of e.frags)
|
|
3824
3866
|
if (t) {
|
|
3825
3867
|
let i = r.frag.x;
|
|
3826
|
-
for (const o of
|
|
3868
|
+
for (const o of ms(r, t))
|
|
3827
3869
|
o.frag.x = i, i += o.frag.width, s.push(o);
|
|
3828
3870
|
} else
|
|
3829
3871
|
r.frag.level = 1, s.push(r);
|
|
3830
3872
|
for (const r of s) r.frag.x = n - r.frag.x - r.frag.width;
|
|
3831
3873
|
e.frags = s, e.width = n, e.leaders && (e.leaders = e.leaders.map((r) => ({ ...r, x1: n - r.x2, x2: n - r.x1 }))), e.tabArrows && (e.tabArrows = e.tabArrows.map((r) => ({ x1: n - r.x2, x2: n - r.x1 })));
|
|
3832
3874
|
}
|
|
3833
|
-
function
|
|
3834
|
-
const s = n.get(e), r = [], i =
|
|
3875
|
+
function Ss(e, t, n) {
|
|
3876
|
+
const s = n.get(e), r = [], i = Fs(e), o = e.style.direction, x = [];
|
|
3835
3877
|
let a = !0;
|
|
3836
3878
|
const d = [];
|
|
3837
3879
|
for (let f = 0; f < s.length; f++) {
|
|
3838
3880
|
const N = s[f];
|
|
3839
3881
|
if (N.runs.some((I) => I.text.includes(" "))) {
|
|
3840
|
-
x.push(...
|
|
3882
|
+
x.push(...j0(e, N.runs, N.startOffset, t, a ? e.style.indentFirstLinePx : 0)), a = !1, d[f] = x.length - 1;
|
|
3841
3883
|
continue;
|
|
3842
3884
|
}
|
|
3843
3885
|
const p = Tt(N.runs, N.startOffset), S = N.runs.map(() => 0);
|
|
@@ -3858,7 +3900,7 @@ function ms(e, t, n) {
|
|
|
3858
3900
|
if (T)
|
|
3859
3901
|
x[x.length - 1].lastOfSegment = !0;
|
|
3860
3902
|
else {
|
|
3861
|
-
const I =
|
|
3903
|
+
const I = ds(e);
|
|
3862
3904
|
x.push({
|
|
3863
3905
|
frags: [],
|
|
3864
3906
|
width: 0,
|
|
@@ -3876,66 +3918,33 @@ function ms(e, t, n) {
|
|
|
3876
3918
|
const N = d[f];
|
|
3877
3919
|
N !== void 0 && (f === s.length - 1 ? x[N].paragraphEnd = !0 : x[N].lineBreak = !0);
|
|
3878
3920
|
}
|
|
3879
|
-
const c =
|
|
3921
|
+
const c = xs(e.style.align, o), l = as(o) === 1;
|
|
3880
3922
|
let h = 0;
|
|
3881
3923
|
for (const f of x) {
|
|
3882
3924
|
if (f.tabbed) {
|
|
3883
3925
|
const m = f.frags.length > 0 || (f.leaders?.length ?? 0) > 0 || (f.tabArrows?.length ?? 0) > 0;
|
|
3884
|
-
l && m &&
|
|
3926
|
+
l && m && U0(f, i, t);
|
|
3885
3927
|
} else if (i !== null && f.frags.length > 0) {
|
|
3886
|
-
const m =
|
|
3928
|
+
const m = Ns(f.frags, i);
|
|
3887
3929
|
f.frags = m.frags, f.width = m.width;
|
|
3888
3930
|
}
|
|
3889
3931
|
const N = f.lineMaxWidth - f.width;
|
|
3890
3932
|
let p = f.indent;
|
|
3891
|
-
c === "center" ? p += N / 2 : c === "right" ? p += N : c === "justify" && !f.lastOfSegment &&
|
|
3933
|
+
c === "center" ? p += N / 2 : c === "right" ? p += N : c === "justify" && !f.lastOfSegment && gs(f.frags, N);
|
|
3892
3934
|
for (const m of f.frags) m.frag.x += p;
|
|
3893
3935
|
const S = { y: h, height: f.height, ascent: f.ascent, fragments: f.frags.map((m) => m.frag) };
|
|
3894
3936
|
f.emptyOffset !== void 0 && (S.emptyOffset = f.emptyOffset), f.leaders && f.leaders.length > 0 && (S.leaders = f.leaders.map((m) => ({ ...m, x1: m.x1 + p, x2: m.x2 + p }))), f.tabArrows && f.tabArrows.length > 0 && (S.tabArrows = f.tabArrows.map((m) => ({ x1: m.x1 + p, x2: m.x2 + p }))), f.paragraphEnd && (S.paragraphEnd = !0), f.lineBreak && (S.lineBreak = !0), r.push(S), h += f.height;
|
|
3895
3937
|
}
|
|
3896
3938
|
return r;
|
|
3897
3939
|
}
|
|
3898
|
-
const Dn = 2, Ln = 2,
|
|
3899
|
-
function Ss(e, t) {
|
|
3900
|
-
const n = {
|
|
3901
|
-
pageWidthPx: t.pageWidthPx ?? e.pageWidthPx,
|
|
3902
|
-
pageHeightPx: t.pageHeightPx ?? e.pageHeightPx,
|
|
3903
|
-
marginPx: t.marginPx ?? e.marginPx
|
|
3904
|
-
}, s = t.columns === void 0 ? e.columns : t.columns ?? void 0;
|
|
3905
|
-
s && (n.columns = s), t.pageNumberStart !== void 0 && (n.pageNumberStart = t.pageNumberStart);
|
|
3906
|
-
const r = t.headerDistancePx ?? e.headerDistancePx;
|
|
3907
|
-
r !== void 0 && (n.headerDistancePx = r);
|
|
3908
|
-
const i = t.footerDistancePx ?? e.footerDistancePx;
|
|
3909
|
-
i !== void 0 && (n.footerDistancePx = i);
|
|
3910
|
-
const o = t.pageColorHex ?? e.pageColorHex;
|
|
3911
|
-
o !== void 0 && (n.pageColorHex = o);
|
|
3912
|
-
const x = t.pageBorders ?? e.pageBorders;
|
|
3913
|
-
x !== void 0 && (n.pageBorders = x), t.lineNumbering !== void 0 && (n.lineNumbering = t.lineNumbering);
|
|
3914
|
-
for (const a of Ns) {
|
|
3915
|
-
const d = t[a] ?? e[a];
|
|
3916
|
-
d && (n[a] = d);
|
|
3917
|
-
}
|
|
3918
|
-
return n;
|
|
3919
|
-
}
|
|
3940
|
+
const Dn = 2, Ln = 2, z0 = 48, K0 = ["header", "footer", "headerFirst", "headerEven", "footerFirst", "footerEven"];
|
|
3920
3941
|
function On(e, t) {
|
|
3921
3942
|
return e.headerDistancePx !== void 0 ? e.headerDistancePx : Math.max(8, (e.marginPx.top - t) / 2);
|
|
3922
3943
|
}
|
|
3923
3944
|
function Pn(e, t) {
|
|
3924
3945
|
return e.footerDistancePx !== void 0 ? e.pageHeightPx - e.footerDistancePx - t : e.pageHeightPx - Math.max(8, (e.marginPx.bottom - t) / 2) - t;
|
|
3925
3946
|
}
|
|
3926
|
-
function
|
|
3927
|
-
const t = [];
|
|
3928
|
-
for (let n = 0; n < e.blocks.length; n++) {
|
|
3929
|
-
const s = e.blocks[n];
|
|
3930
|
-
s.kind === "paragraph" && s.style.sectionBreak && t.push({
|
|
3931
|
-
props: Ss(e.section, s.style.sectionBreak.props),
|
|
3932
|
-
endBlock: n,
|
|
3933
|
-
breakType: s.style.sectionBreak.type
|
|
3934
|
-
});
|
|
3935
|
-
}
|
|
3936
|
-
return t.push({ props: e.section, endBlock: e.blocks.length - 1, breakType: e.section.breakType ?? "nextPage" }), t;
|
|
3937
|
-
}
|
|
3938
|
-
function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
3947
|
+
function q0(e, t, n, s, r = Te, i = Ue) {
|
|
3939
3948
|
const x = /* @__PURE__ */ new Map();
|
|
3940
3949
|
let a = null;
|
|
3941
3950
|
const d = (u) => {
|
|
@@ -3945,28 +3954,28 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
3945
3954
|
const k = [u.header, u.headerFirst, u.headerEven].filter((_) => !!_), A = [u.footer, u.footerFirst, u.footerEven].filter((_) => !!_);
|
|
3946
3955
|
if (k.length > 0 || A.length > 0) {
|
|
3947
3956
|
a ??= new bt();
|
|
3948
|
-
const _ = u.pageWidthPx - u.marginPx.left - u.marginPx.right, K = u.marginPx.left, H = (
|
|
3949
|
-
const
|
|
3950
|
-
for (const te of
|
|
3951
|
-
if (!!te.table || !!te.image || !!te.equation || te.lines.some((re) => re.fragments.some((Z) => Z.text.trim().length > 0 || !!Z.equation))) return
|
|
3957
|
+
const _ = u.pageWidthPx - u.marginPx.left - u.marginPx.right, K = u.marginPx.left, H = (X) => Ue(X, _, K, 999, 999, a, !1).height, ee = (X) => {
|
|
3958
|
+
const Q = Ue(X, _, K, 999, 999, a, !1);
|
|
3959
|
+
for (const te of Q.placed)
|
|
3960
|
+
if (!!te.table || !!te.image || !!te.equation || te.lines.some((re) => re.fragments.some((Z) => Z.text.trim().length > 0 || !!Z.equation))) return Q.height - te.y;
|
|
3952
3961
|
return 0;
|
|
3953
|
-
}, V = k.reduce((
|
|
3962
|
+
}, V = k.reduce((X, Q) => Math.max(X, H(Q)), 0);
|
|
3954
3963
|
if (V > 0) {
|
|
3955
|
-
const
|
|
3956
|
-
F = Math.max(F,
|
|
3964
|
+
const X = On(u, V);
|
|
3965
|
+
F = Math.max(F, X + V + 6);
|
|
3957
3966
|
}
|
|
3958
|
-
const Y = A.reduce((
|
|
3967
|
+
const Y = A.reduce((X, Q) => Math.max(X, H(Q)), 0);
|
|
3959
3968
|
if (Y > 0)
|
|
3960
3969
|
if (u.footerDistancePx !== void 0) {
|
|
3961
|
-
const
|
|
3962
|
-
B = Math.min(B,
|
|
3970
|
+
const X = u.pageHeightPx - u.footerDistancePx, Q = A.reduce((te, ie) => Math.max(te, ee(ie)), 0);
|
|
3971
|
+
B = Math.min(B, X - Q);
|
|
3963
3972
|
} else
|
|
3964
3973
|
B = Math.min(B, Pn(u, Y) - 6);
|
|
3965
3974
|
B = Math.max(B, F + 24);
|
|
3966
3975
|
}
|
|
3967
3976
|
const w = { top: F, bottom: B };
|
|
3968
3977
|
return x.set(u, w), w;
|
|
3969
|
-
}, c =
|
|
3978
|
+
}, c = Hn(e);
|
|
3970
3979
|
let l = c[0].props, h = 0, f = 0, N = 0, p = 0, S = 1, m = 0, T = [], I = [];
|
|
3971
3980
|
const b = (u) => {
|
|
3972
3981
|
l = u;
|
|
@@ -3996,7 +4005,7 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
3996
4005
|
if (!g || !F) return;
|
|
3997
4006
|
const B = O[g.listId], k = R.get(g.listId) ?? [];
|
|
3998
4007
|
k[g.level] = (k[g.level] ?? F.start - 1) + 1, k.length = g.level + 1, R.set(g.listId, k);
|
|
3999
|
-
const A =
|
|
4008
|
+
const A = js(B, g.level, k);
|
|
4000
4009
|
if (A.length === 0) return;
|
|
4001
4010
|
const w = u.runs[0]?.style;
|
|
4002
4011
|
w && j.set(u.id, {
|
|
@@ -4016,8 +4025,8 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4016
4025
|
for (; u > c[v].endBlock; ) b(c[++v].props);
|
|
4017
4026
|
const g = e.blocks[u];
|
|
4018
4027
|
if (g.kind === "paragraph") {
|
|
4019
|
-
if (
|
|
4020
|
-
const F = g.style.tocEntry ?
|
|
4028
|
+
if (R0(g)) continue;
|
|
4029
|
+
const F = g.style.tocEntry ? z0 : 0;
|
|
4021
4030
|
L.push({
|
|
4022
4031
|
kind: "para",
|
|
4023
4032
|
block: g,
|
|
@@ -4061,7 +4070,7 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4061
4070
|
const w = t(A, F);
|
|
4062
4071
|
return B += A.style.spaceBeforePx + ge(w) + A.style.spaceAfterPx, { p: A, lines: w };
|
|
4063
4072
|
}), height: B };
|
|
4064
|
-
},
|
|
4073
|
+
}, Bs = (u, g, F) => {
|
|
4065
4074
|
const B = [];
|
|
4066
4075
|
for (let k = g; k < g + F; k++)
|
|
4067
4076
|
for (const A of u[k].fragments) {
|
|
@@ -4071,24 +4080,24 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4071
4080
|
return B;
|
|
4072
4081
|
};
|
|
4073
4082
|
let Oe = 0, Ve = 0;
|
|
4074
|
-
const he = () => T[Oe]?.x ?? h, ae = () => q.blocks.length > Ve,
|
|
4083
|
+
const he = () => T[Oe]?.x ?? h, ae = () => q.blocks.length > Ve, Qe = () => {
|
|
4075
4084
|
Oe = 0, Ve = 0, q = J(), $.push(q), He.push([]), Je.push(0), Ye = 0, U = f, Ne = [];
|
|
4076
4085
|
}, xe = () => {
|
|
4077
|
-
Oe + 1 < S ? (Oe++, Ve = q.blocks.length, U = f, Ne = []) :
|
|
4078
|
-
},
|
|
4086
|
+
Oe + 1 < S ? (Oe++, Ve = q.blocks.length, U = f, Ne = []) : Qe();
|
|
4087
|
+
}, bs = () => {
|
|
4079
4088
|
q.widthPx = l.pageWidthPx, q.heightPx = l.pageHeightPx, q.marginPx = l.marginPx, q.contentTopPx = f, q.contentBottomPx = N, l.pageColorHex !== void 0 ? q.pageColorHex = l.pageColorHex : delete q.pageColorHex, l.pageBorders !== void 0 ? q.pageBorders = l.pageBorders : delete q.pageBorders, I.length ? q.columnSeparatorsX = I.slice() : delete q.columnSeparatorsX, P[q.index] = l, Oe = 0, Ve = 0, U = f, Ne = [];
|
|
4080
|
-
},
|
|
4081
|
-
if (q.blocks.length === 0 ?
|
|
4089
|
+
}, Cs = (u) => {
|
|
4090
|
+
if (q.blocks.length === 0 ? bs() : Qe(), u === "evenPage" || u === "oddPage") {
|
|
4082
4091
|
const g = u === "evenPage";
|
|
4083
|
-
q.number % 2 === 0 !== g &&
|
|
4092
|
+
q.number % 2 === 0 !== g && Qe();
|
|
4084
4093
|
}
|
|
4085
|
-
},
|
|
4094
|
+
}, ys = (u, g, F, B) => {
|
|
4086
4095
|
if (u.style.direction !== "rtl") return g - B.hangingPx;
|
|
4087
4096
|
let k = 0;
|
|
4088
4097
|
for (const w of F?.fragments ?? []) k = Math.max(k, w.x + w.width);
|
|
4089
4098
|
const A = de(B.text, le(B.style));
|
|
4090
4099
|
return g + k + Math.max(0, B.hangingPx - A);
|
|
4091
|
-
},
|
|
4100
|
+
}, ws = (u, g, F, B) => {
|
|
4092
4101
|
const k = {
|
|
4093
4102
|
blockId: u.id,
|
|
4094
4103
|
x: he() + G(u),
|
|
@@ -4096,7 +4105,7 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4096
4105
|
firstLineIndex: F,
|
|
4097
4106
|
lines: []
|
|
4098
4107
|
}, A = F === 0 ? j.get(u.id) : void 0;
|
|
4099
|
-
A && (k.marker = { text: A.text, style: A.style, x:
|
|
4108
|
+
A && (k.marker = { text: A.text, style: A.style, x: ys(u, k.x, g[F], A) }), u.style.tocEntry && ce.set(u.id, { chunk: k, rightEdge: he() + m, para: u }), q.blocks.push(k);
|
|
4100
4109
|
let w = 0;
|
|
4101
4110
|
for (let K = F; K < F + B; K++) {
|
|
4102
4111
|
const H = g[K];
|
|
@@ -4104,7 +4113,7 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4104
4113
|
}
|
|
4105
4114
|
const _ = Ce(u.style, m - G(u) - C(u), w);
|
|
4106
4115
|
_ && (k.paraDecor = _);
|
|
4107
|
-
},
|
|
4116
|
+
}, Ds = (u, g) => {
|
|
4108
4117
|
let F = 0, B = U;
|
|
4109
4118
|
for (; g + F < u.length && B + u[g + F].height <= se(); )
|
|
4110
4119
|
B += u[g + F].height, F++;
|
|
@@ -4121,7 +4130,7 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4121
4130
|
for (const [F, B] of u)
|
|
4122
4131
|
ut.add(F), He[q.index].push(F), Ut.set(F, B);
|
|
4123
4132
|
Ye += g, Je[q.index] = Ye;
|
|
4124
|
-
},
|
|
4133
|
+
}, Ls = (u) => {
|
|
4125
4134
|
const g = [], F = (B) => {
|
|
4126
4135
|
for (const k of B)
|
|
4127
4136
|
if (k.kind === "paragraph") {
|
|
@@ -4135,10 +4144,10 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4135
4144
|
};
|
|
4136
4145
|
for (const B of u) for (const k of B.cells) F(k.blocks);
|
|
4137
4146
|
return g;
|
|
4138
|
-
},
|
|
4147
|
+
}, Os = (u, g, F) => {
|
|
4139
4148
|
for (; ; ) {
|
|
4140
4149
|
if (F <= 0) return F;
|
|
4141
|
-
const B =
|
|
4150
|
+
const B = Bs(u, g, F);
|
|
4142
4151
|
if (B.length === 0) return F;
|
|
4143
4152
|
const { H: k, measures: A } = Kt(B);
|
|
4144
4153
|
if (A.length === 0) return F;
|
|
@@ -4148,14 +4157,14 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4148
4157
|
return qt(A, k), F;
|
|
4149
4158
|
F--;
|
|
4150
4159
|
}
|
|
4151
|
-
},
|
|
4160
|
+
}, Ps = (u, g) => {
|
|
4152
4161
|
if (u.style.keepLinesTogether === !0 && ae()) {
|
|
4153
4162
|
const B = ge(g);
|
|
4154
4163
|
U + B > se() && B <= N - f && xe();
|
|
4155
4164
|
}
|
|
4156
4165
|
let F = 0;
|
|
4157
4166
|
for (; F < g.length; ) {
|
|
4158
|
-
const B = g.length - F, k =
|
|
4167
|
+
const B = g.length - F, k = Ds(g, F);
|
|
4159
4168
|
let A;
|
|
4160
4169
|
if (k >= B)
|
|
4161
4170
|
A = B;
|
|
@@ -4164,7 +4173,7 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4164
4173
|
const w = u.style.widowControl !== !1;
|
|
4165
4174
|
w && B - A === 1 && (A -= Ln - 1), w && F === 0 && A > 0 && A < Dn && (A = 0), A <= 0 && (A = ae() ? 0 : Math.max(1, k));
|
|
4166
4175
|
}
|
|
4167
|
-
if (A > 0 && Me && (A =
|
|
4176
|
+
if (A > 0 && Me && (A = Os(g, F, A)), A > 0 && (ws(u, g, F, A), F += A), F >= g.length) return;
|
|
4168
4177
|
xe();
|
|
4169
4178
|
}
|
|
4170
4179
|
}, ge = (u) => {
|
|
@@ -4173,12 +4182,12 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4173
4182
|
return g;
|
|
4174
4183
|
};
|
|
4175
4184
|
let Ne = [];
|
|
4176
|
-
const $t = 10,
|
|
4185
|
+
const $t = 10, Is = (u) => {
|
|
4177
4186
|
let g = he(), F = he() + m;
|
|
4178
4187
|
for (const B of Ne)
|
|
4179
4188
|
u >= B.bottom || (B.side === "left" ? g = Math.max(g, B.right + $t) : F = Math.min(F, B.left - $t));
|
|
4180
4189
|
return { x0: g, width: Math.max(40, F - g) };
|
|
4181
|
-
},
|
|
4190
|
+
}, vs = (u) => Ne.some((g) => g.bottom > u), Ws = (u) => {
|
|
4182
4191
|
const g = u.anchor;
|
|
4183
4192
|
let F;
|
|
4184
4193
|
switch (g.relFromH) {
|
|
@@ -4225,7 +4234,7 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4225
4234
|
});
|
|
4226
4235
|
}, Yt = (u) => {
|
|
4227
4236
|
if (u.anchor) {
|
|
4228
|
-
|
|
4237
|
+
Ws(u);
|
|
4229
4238
|
return;
|
|
4230
4239
|
}
|
|
4231
4240
|
U + u.heightPx > se() && ae() && xe();
|
|
@@ -4238,7 +4247,7 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4238
4247
|
lines: [],
|
|
4239
4248
|
image: { src: u.src, width: u.widthPx, height: u.heightPx, ...u.crop ? { crop: u.crop } : {} }
|
|
4240
4249
|
}), g ? Ne.push({ left: B, right: B + u.widthPx, bottom: U + u.heightPx, side: u.align === "right" ? "right" : "left" }) : U += u.heightPx;
|
|
4241
|
-
},
|
|
4250
|
+
}, Rs = (u, g) => {
|
|
4242
4251
|
const F = g.ascent + g.descent;
|
|
4243
4252
|
U + F > se() && ae() && xe();
|
|
4244
4253
|
const B = u.align ?? "center", k = m - g.width, A = he() + (B === "center" ? k / 2 : B === "right" ? k : 0);
|
|
@@ -4250,39 +4259,39 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4250
4259
|
lines: [],
|
|
4251
4260
|
equation: { box: g, width: g.width, height: F, baseline: g.ascent }
|
|
4252
4261
|
}), U += F;
|
|
4253
|
-
},
|
|
4254
|
-
const g = n(u), F =
|
|
4262
|
+
}, Ts = (u) => {
|
|
4263
|
+
const g = n(u), F = Fs(u), B = xs(u.style.align, u.style.direction);
|
|
4255
4264
|
let k = !0, A = 0, w = null;
|
|
4256
4265
|
const _ = () => {
|
|
4257
4266
|
if (w && w.lines.length) {
|
|
4258
|
-
const H = Ce(u.style, m - G(u) - C(u),
|
|
4267
|
+
const H = Ce(u.style, m - G(u) - C(u), I0(w.lines));
|
|
4259
4268
|
H && (w.paraDecor = H);
|
|
4260
4269
|
}
|
|
4261
4270
|
}, K = (H, ee, V, Y) => {
|
|
4262
4271
|
if (w === null) {
|
|
4263
4272
|
w = { blockId: u.id, x: he() + G(u), y: U, firstLineIndex: A, lines: [] };
|
|
4264
|
-
const
|
|
4265
|
-
if (
|
|
4273
|
+
const Q = A === 0 ? j.get(u.id) : void 0;
|
|
4274
|
+
if (Q) {
|
|
4266
4275
|
let te;
|
|
4267
4276
|
if (u.style.direction === "rtl") {
|
|
4268
4277
|
let ie = 0;
|
|
4269
4278
|
for (const Z of H) ie = Math.max(ie, Z.frag.x + Z.frag.width);
|
|
4270
|
-
const re = de(
|
|
4271
|
-
te = w.x + ie + Math.max(0,
|
|
4279
|
+
const re = de(Q.text, le(Q.style));
|
|
4280
|
+
te = w.x + ie + Math.max(0, Q.hangingPx - re);
|
|
4272
4281
|
} else
|
|
4273
|
-
te = w.x + (H[0]?.frag.x ?? 0) -
|
|
4274
|
-
w.marker = { text:
|
|
4282
|
+
te = w.x + (H[0]?.frag.x ?? 0) - Q.hangingPx;
|
|
4283
|
+
w.marker = { text: Q.text, style: Q.style, x: te };
|
|
4275
4284
|
}
|
|
4276
4285
|
q.blocks.push(w);
|
|
4277
4286
|
}
|
|
4278
|
-
const
|
|
4279
|
-
Y !== void 0 && (
|
|
4287
|
+
const X = { y: U - w.y, height: ee, ascent: V, fragments: H.map((Q) => Q.frag) };
|
|
4288
|
+
Y !== void 0 && (X.emptyOffset = Y), w.lines.push(X), U += ee, A++;
|
|
4280
4289
|
};
|
|
4281
4290
|
for (const H of g) {
|
|
4282
4291
|
const ee = Tt(H.runs, H.startOffset), V = H.runs.map(() => 0);
|
|
4283
|
-
let Y,
|
|
4292
|
+
let Y, X = !1, Q = null;
|
|
4284
4293
|
for (; ; ) {
|
|
4285
|
-
const te = V.slice(), ie =
|
|
4294
|
+
const te = V.slice(), ie = Is(U), re = k ? u.style.indentFirstLinePx : 0, Z = Ht(
|
|
4286
4295
|
u,
|
|
4287
4296
|
H,
|
|
4288
4297
|
Math.max(24, ie.width - G(u) - re - C(u)),
|
|
@@ -4297,22 +4306,22 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4297
4306
|
continue;
|
|
4298
4307
|
}
|
|
4299
4308
|
if (F !== null && Z.frags.length > 0) {
|
|
4300
|
-
const me =
|
|
4309
|
+
const me = Ns(Z.frags, F);
|
|
4301
4310
|
Z.frags = me.frags, Z.width = me.width;
|
|
4302
4311
|
}
|
|
4303
4312
|
const dt = ie.width - re - C(u) - Z.width;
|
|
4304
4313
|
let pt = ie.x0 - he() + re;
|
|
4305
4314
|
B === "center" ? pt += dt / 2 : B === "right" && (pt += dt);
|
|
4306
4315
|
for (const me of Z.frags) me.frag.x += pt;
|
|
4307
|
-
B === "justify" && (
|
|
4316
|
+
B === "justify" && (Q && gs(Q.frags, Q.slack), Q = { frags: Z.frags, slack: dt }), K(Z.frags, Z.height, Z.ascent), Y = Z.end, k = !1, X = !0;
|
|
4308
4317
|
}
|
|
4309
|
-
if (!
|
|
4310
|
-
const te =
|
|
4318
|
+
if (!X) {
|
|
4319
|
+
const te = ds(u);
|
|
4311
4320
|
U + te.height > se() && ae() && (_(), xe(), w = null), K([], te.height, te.ascent, H.startOffset), k = !1;
|
|
4312
4321
|
}
|
|
4313
4322
|
}
|
|
4314
4323
|
_();
|
|
4315
|
-
},
|
|
4324
|
+
}, Gs = (u) => {
|
|
4316
4325
|
const g = u.block.rows.some((_) => _.cells.some((K) => (K.rowSpan ?? 1) > 1));
|
|
4317
4326
|
g && ae() && U + u.height > se() && u.height <= N - f && xe();
|
|
4318
4327
|
let F = 0;
|
|
@@ -4333,9 +4342,9 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4333
4342
|
}
|
|
4334
4343
|
let V = [], Y = 0;
|
|
4335
4344
|
for (; ; ) {
|
|
4336
|
-
const
|
|
4337
|
-
if (
|
|
4338
|
-
const { H: te, measures: ie } = Kt(
|
|
4345
|
+
const Q = Ls(u.block.rows.slice(w, w + H));
|
|
4346
|
+
if (Q.length === 0) break;
|
|
4347
|
+
const { H: te, measures: ie } = Kt(Q);
|
|
4339
4348
|
if (ie.length === 0) break;
|
|
4340
4349
|
let re = K;
|
|
4341
4350
|
for (let Z = w; Z < w + H; Z++) re += u.rows[Z].height;
|
|
@@ -4350,14 +4359,14 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4350
4359
|
continue;
|
|
4351
4360
|
}
|
|
4352
4361
|
V.length > 0 && qt(V, Y), _ && (q.blocks.push(qe(u.block, k, u.colWidths, he() + u.xOffset, U, u.tableWidth, 0, M)), U += A);
|
|
4353
|
-
const
|
|
4354
|
-
q.blocks.push(qe(u.block,
|
|
4362
|
+
const X = u.rows.slice(w, w + H);
|
|
4363
|
+
q.blocks.push(qe(u.block, X, u.colWidths, he() + u.xOffset, U, u.tableWidth, w, M)), U += X.reduce((Q, te) => Q + te.height, 0), w += H, w < u.rows.length && xe();
|
|
4355
4364
|
}
|
|
4356
|
-
},
|
|
4365
|
+
}, Xe = (u, g) => u?.kind === "para" && g?.kind === "para" && u.block.style.contextualSpacing === !0 && u.block.style.namedStyle === g.block.style.namedStyle;
|
|
4357
4366
|
for (let u = 0; u < L.length; u++) {
|
|
4358
4367
|
if (u > c[v].endBlock) {
|
|
4359
4368
|
for (; u > c[v].endBlock; ) b(c[++v].props);
|
|
4360
|
-
|
|
4369
|
+
Cs(c[v].breakType);
|
|
4361
4370
|
}
|
|
4362
4371
|
const g = L[u], F = (H) => H?.kind === "table" || H?.kind === "equation" || H?.kind === "image" && H.block.anchor === void 0, B = F(L[u - 1]), k = F(L[u + 1]);
|
|
4363
4372
|
if (g.kind === "image") {
|
|
@@ -4371,20 +4380,20 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4371
4380
|
if (g.kind === "equation") {
|
|
4372
4381
|
B || (U += ke);
|
|
4373
4382
|
for (const H of Ne) H.bottom > U && (U = H.bottom);
|
|
4374
|
-
|
|
4383
|
+
Rs(g.block, g.box), k || (U += ke);
|
|
4375
4384
|
continue;
|
|
4376
4385
|
}
|
|
4377
4386
|
if (g.kind === "table") {
|
|
4378
4387
|
B || (U += ke);
|
|
4379
4388
|
for (const H of Ne) H.bottom > U && (U = H.bottom);
|
|
4380
|
-
|
|
4389
|
+
Gs(g), k || (U += ke);
|
|
4381
4390
|
continue;
|
|
4382
4391
|
}
|
|
4383
4392
|
const { block: A, lines: w } = g;
|
|
4384
|
-
A.style.pageBreakBefore === !0 && (q.blocks.length > 0 || Oe > 0) ?
|
|
4385
|
-
const _ =
|
|
4386
|
-
if (_ || (U += A.style.spaceBeforePx), U >= se() && ae() && xe(),
|
|
4387
|
-
U += bn(A.style),
|
|
4393
|
+
A.style.pageBreakBefore === !0 && (q.blocks.length > 0 || Oe > 0) ? Qe() : A.style.columnBreakBefore === !0 && ae() && xe();
|
|
4394
|
+
const _ = Xe(g, L[u - 1]), K = Xe(g, L[u + 1]);
|
|
4395
|
+
if (_ || (U += A.style.spaceBeforePx), U >= se() && ae() && xe(), vs(U)) {
|
|
4396
|
+
U += bn(A.style), Ts(A), U += Cn(A.style), K || (U += A.style.spaceAfterPx);
|
|
4388
4397
|
continue;
|
|
4389
4398
|
}
|
|
4390
4399
|
if (A.style.keepWithNext === !0 && L[u + 1] !== void 0 && ae()) {
|
|
@@ -4397,15 +4406,15 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4397
4406
|
H + ke + Z > se() && (ee = !1);
|
|
4398
4407
|
break;
|
|
4399
4408
|
}
|
|
4400
|
-
|
|
4401
|
-
const
|
|
4402
|
-
if (
|
|
4409
|
+
Xe(Y, L[V - 1]) || (H += Y.block.style.spaceBeforePx);
|
|
4410
|
+
const X = Xe(Y, L[V + 1]) ? 0 : Y.block.style.spaceAfterPx, Q = Y.block.style.keepWithNext === !0 && L[V + 1] !== void 0;
|
|
4411
|
+
if (Q || Y.block.style.keepLinesTogether === !0) {
|
|
4403
4412
|
const Z = ge(Y.lines);
|
|
4404
4413
|
if (H + Z > se()) {
|
|
4405
4414
|
ee = !1;
|
|
4406
4415
|
break;
|
|
4407
4416
|
}
|
|
4408
|
-
if (H += Z +
|
|
4417
|
+
if (H += Z + X, !Q) break;
|
|
4409
4418
|
continue;
|
|
4410
4419
|
}
|
|
4411
4420
|
if (L[V + 1] !== void 0 && Y.block.runs.every((Z) => Z.text.trim().length === 0)) {
|
|
@@ -4414,7 +4423,7 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4414
4423
|
ee = !1;
|
|
4415
4424
|
break;
|
|
4416
4425
|
}
|
|
4417
|
-
H += Z +
|
|
4426
|
+
H += Z + X;
|
|
4418
4427
|
continue;
|
|
4419
4428
|
}
|
|
4420
4429
|
let te = 0, ie = H;
|
|
@@ -4426,7 +4435,7 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4426
4435
|
}
|
|
4427
4436
|
ee || xe();
|
|
4428
4437
|
}
|
|
4429
|
-
U += bn(A.style),
|
|
4438
|
+
U += bn(A.style), Ps(A, w), U += Cn(A.style), K || (U += A.style.spaceAfterPx);
|
|
4430
4439
|
}
|
|
4431
4440
|
if (P.some((u) => u.lineNumbering)) {
|
|
4432
4441
|
const u = le(wn);
|
|
@@ -4439,16 +4448,16 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4439
4448
|
}
|
|
4440
4449
|
const _ = w.start ?? 1, K = Math.max(1, Math.round(w.countBy ?? 1)), H = w.restart ?? "newPage";
|
|
4441
4450
|
H === "newPage" ? g = _ : H === "newSection" ? A !== B && (g = _) : F || (g = _), F = !0;
|
|
4442
|
-
const ee = k.marginPx.left - (w.distancePx ??
|
|
4451
|
+
const ee = k.marginPx.left - (w.distancePx ?? _0), V = [];
|
|
4443
4452
|
for (const Y of k.blocks)
|
|
4444
4453
|
if (!(Y.lines.length === 0 || Y.image || Y.table || Y.equation))
|
|
4445
|
-
for (const
|
|
4454
|
+
for (const X of Y.lines) {
|
|
4446
4455
|
if (g % K === 0) {
|
|
4447
|
-
const
|
|
4456
|
+
const Q = String(g);
|
|
4448
4457
|
V.push({
|
|
4449
|
-
x: ee - de(
|
|
4450
|
-
baseline: Y.y +
|
|
4451
|
-
text:
|
|
4458
|
+
x: ee - de(Q, u),
|
|
4459
|
+
baseline: Y.y + X.y + X.ascent,
|
|
4460
|
+
text: Q,
|
|
4452
4461
|
style: wn
|
|
4453
4462
|
});
|
|
4454
4463
|
}
|
|
@@ -4515,20 +4524,20 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4515
4524
|
for (const V of ht[K]) {
|
|
4516
4525
|
const Y = t(V, B);
|
|
4517
4526
|
_ + V.style.spaceBeforePx + ge(Y) > A.contentBottomPx && A.blocks.length > 0 && (w(), _ = A.contentTopPx), _ += V.style.spaceBeforePx;
|
|
4518
|
-
const
|
|
4527
|
+
const X = {
|
|
4519
4528
|
blockId: V.id,
|
|
4520
4529
|
x: k + ue,
|
|
4521
4530
|
y: _,
|
|
4522
4531
|
firstLineIndex: 0,
|
|
4523
4532
|
lines: Y
|
|
4524
4533
|
};
|
|
4525
|
-
ee && V.runs[0] && (
|
|
4526
|
-
const
|
|
4534
|
+
ee && V.runs[0] && (X.marker = { text: `${H}.`, style: V.runs[0].style, x: k }, ee = !1);
|
|
4535
|
+
const Q = Ce(
|
|
4527
4536
|
V.style,
|
|
4528
4537
|
p - ue - V.style.indentLeftPx - (V.style.indentRightPx ?? 0),
|
|
4529
4538
|
ge(Y)
|
|
4530
4539
|
);
|
|
4531
|
-
|
|
4540
|
+
Q && (X.paraDecor = Q), A.blocks.push(X), _ += ge(Y) + V.style.spaceAfterPx;
|
|
4532
4541
|
}
|
|
4533
4542
|
}
|
|
4534
4543
|
}
|
|
@@ -4567,7 +4576,7 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4567
4576
|
let w = 0;
|
|
4568
4577
|
for (const _ of k.fragments) {
|
|
4569
4578
|
if (w !== 0 && (_.x += w), !u(_.style.fieldId)) continue;
|
|
4570
|
-
const K =
|
|
4579
|
+
const K = As(_.text, A, $.length);
|
|
4571
4580
|
if (K === _.text) continue;
|
|
4572
4581
|
const H = _.endOffset - _.startOffset, ee = _.width;
|
|
4573
4582
|
_.text = K, _.width = de(K, le(_.style)), _.offsetMap = Array.from({ length: K.length + 1 }, (V, Y) => Y === K.length ? H : 0), w += _.width - ee;
|
|
@@ -4605,25 +4614,25 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4605
4614
|
};
|
|
4606
4615
|
}
|
|
4607
4616
|
}
|
|
4608
|
-
const
|
|
4617
|
+
const Qt = (u, g, F, B) => {
|
|
4609
4618
|
const k = g === "header" ? u.headerFirst : u.footerFirst, A = g === "header" ? u.headerEven : u.footerEven;
|
|
4610
4619
|
if (F && k) return { blocks: k, source: g === "header" ? "headerFirst" : "footerFirst" };
|
|
4611
4620
|
if (B && A) return { blocks: A, source: g === "header" ? "headerEven" : "footerEven" };
|
|
4612
4621
|
const w = u[g];
|
|
4613
4622
|
return w ? { blocks: w, source: g } : null;
|
|
4614
4623
|
};
|
|
4615
|
-
if (P.some((u) =>
|
|
4624
|
+
if (P.some((u) => K0.some((g) => u[g]))) {
|
|
4616
4625
|
const u = new bt();
|
|
4617
4626
|
for (const g of $) {
|
|
4618
|
-
const F = P[g.index], B = F.pageWidthPx - F.marginPx.left - F.marginPx.right, k = F.marginPx.left, A = g.index === 0 || P[g.index - 1] !== F, w = Ze[g.index], _ = w % 2 === 0, K =
|
|
4627
|
+
const F = P[g.index], B = F.pageWidthPx - F.marginPx.left - F.marginPx.right, k = F.marginPx.left, A = g.index === 0 || P[g.index - 1] !== F, w = Ze[g.index], _ = w % 2 === 0, K = Qt(F, "header", A, _);
|
|
4619
4628
|
if (K) {
|
|
4620
4629
|
const ee = s === "header", V = i(K.blocks, B, k, w, $.length, u, ee), Y = On(F, V.height);
|
|
4621
|
-
g.header = V.placed.map((
|
|
4630
|
+
g.header = V.placed.map((X) => Ct(X, Y)), g.headerSource = K.source;
|
|
4622
4631
|
}
|
|
4623
|
-
const H =
|
|
4632
|
+
const H = Qt(F, "footer", A, _);
|
|
4624
4633
|
if (H) {
|
|
4625
4634
|
const ee = s === "footer", V = i(H.blocks, B, k, w, $.length, u, ee), Y = Pn(F, V.height);
|
|
4626
|
-
g.footer = V.placed.map((
|
|
4635
|
+
g.footer = V.placed.map((X) => Ct(X, Y)), g.footerSource = H.source;
|
|
4627
4636
|
}
|
|
4628
4637
|
}
|
|
4629
4638
|
}
|
|
@@ -4634,7 +4643,7 @@ function Yo(e, t, n, s, r = Te, i = Ue) {
|
|
|
4634
4643
|
marginPx: e.section.marginPx
|
|
4635
4644
|
};
|
|
4636
4645
|
}
|
|
4637
|
-
function
|
|
4646
|
+
function $0(e, t) {
|
|
4638
4647
|
switch (t) {
|
|
4639
4648
|
case "roman":
|
|
4640
4649
|
return et(e, "lowerRoman");
|
|
@@ -4648,10 +4657,10 @@ function Jo(e, t) {
|
|
|
4648
4657
|
return String(e);
|
|
4649
4658
|
}
|
|
4650
4659
|
}
|
|
4651
|
-
function
|
|
4652
|
-
return e.replace(/\{page(?::(roman|Roman|alpha|Alpha))?\}/g, (s, r) =>
|
|
4660
|
+
function As(e, t, n) {
|
|
4661
|
+
return e.replace(/\{page(?::(roman|Roman|alpha|Alpha))?\}/g, (s, r) => $0(t, r)).replace(/\{pages\}/g, String(n)).replace(/\{date\}/g, () => (/* @__PURE__ */ new Date()).toLocaleDateString()).replace(/\{time\}/g, () => (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }));
|
|
4653
4662
|
}
|
|
4654
|
-
function
|
|
4663
|
+
function Y0(e) {
|
|
4655
4664
|
const t = [], n = (s) => {
|
|
4656
4665
|
for (const r of s)
|
|
4657
4666
|
if (r.kind === "paragraph") for (const i of r.runs) t.push(i.text);
|
|
@@ -4659,12 +4668,12 @@ function Vo(e) {
|
|
|
4659
4668
|
};
|
|
4660
4669
|
return n(e), t;
|
|
4661
4670
|
}
|
|
4662
|
-
function
|
|
4671
|
+
function J0(e, t, n) {
|
|
4663
4672
|
const s = (r) => r.runs.some((i) => i.text.includes("{")) ? {
|
|
4664
4673
|
...r,
|
|
4665
4674
|
id: `${r.id}@p${t}`,
|
|
4666
4675
|
// per-page identity keeps the band prepare-cache honest
|
|
4667
|
-
runs: r.runs.map((i) => ({ ...i, text:
|
|
4676
|
+
runs: r.runs.map((i) => ({ ...i, text: As(i.text, t, n) }))
|
|
4668
4677
|
} : r;
|
|
4669
4678
|
return e.kind === "paragraph" ? s(e) : e.kind === "table" ? {
|
|
4670
4679
|
...e,
|
|
@@ -4677,10 +4686,10 @@ function Xo(e, t, n) {
|
|
|
4677
4686
|
} : e;
|
|
4678
4687
|
}
|
|
4679
4688
|
function Ue(e, t, n, s, r, i, o) {
|
|
4680
|
-
const x = (c, l) =>
|
|
4689
|
+
const x = (c, l) => Ss(c, l, i), a = [];
|
|
4681
4690
|
let d = 0;
|
|
4682
4691
|
for (const c of e) {
|
|
4683
|
-
const l = o ? c :
|
|
4692
|
+
const l = o ? c : J0(c, s, r);
|
|
4684
4693
|
if (l.kind === "paragraph") {
|
|
4685
4694
|
d += l.style.spaceBeforePx;
|
|
4686
4695
|
const h = x(l, t), f = { blockId: l.id, x: n + l.style.indentLeftPx, y: d, firstLineIndex: 0, lines: h }, N = Ce(l.style, t - l.style.indentLeftPx - (l.style.indentRightPx ?? 0), Ae(h));
|
|
@@ -4721,18 +4730,18 @@ function Ct(e, t) {
|
|
|
4721
4730
|
}))
|
|
4722
4731
|
}), n;
|
|
4723
4732
|
}
|
|
4724
|
-
const ke = 12,
|
|
4725
|
-
function
|
|
4733
|
+
const ke = 12, V0 = { top: 0, right: 7.2, bottom: 0, left: 7.2 }, _t = (e) => e.margin ?? V0, jt = 1e6, Q0 = 16;
|
|
4734
|
+
function Es(e) {
|
|
4726
4735
|
let t = 0;
|
|
4727
4736
|
for (const n of e.fragments) t += n.width;
|
|
4728
4737
|
return t;
|
|
4729
4738
|
}
|
|
4730
4739
|
function In(e, t, n) {
|
|
4731
4740
|
let s = 0;
|
|
4732
|
-
for (const r of t(e, n)) s = Math.max(s,
|
|
4741
|
+
for (const r of t(e, n)) s = Math.max(s, Es(r));
|
|
4733
4742
|
return s;
|
|
4734
4743
|
}
|
|
4735
|
-
function
|
|
4744
|
+
function X0(e, t, n, s) {
|
|
4736
4745
|
if (e.kind === "paragraph") {
|
|
4737
4746
|
const i = e.style.indentLeftPx + t.indentOf(e) + (e.style.indentRightPx ?? 0);
|
|
4738
4747
|
return {
|
|
@@ -4746,15 +4755,15 @@ function e0(e, t, n, s) {
|
|
|
4746
4755
|
const i = Re(e).width;
|
|
4747
4756
|
return { min: i, max: i };
|
|
4748
4757
|
}
|
|
4749
|
-
const r =
|
|
4758
|
+
const r = Ms(e, t, n, s);
|
|
4750
4759
|
return {
|
|
4751
4760
|
min: r.reduce((i, o) => i + o.min, 0),
|
|
4752
4761
|
max: r.reduce((i, o) => i + o.max, 0)
|
|
4753
4762
|
};
|
|
4754
4763
|
}
|
|
4755
|
-
function
|
|
4764
|
+
function Z0(e, t, n, s) {
|
|
4756
4765
|
const r = _t(e), i = r.left + r.right;
|
|
4757
|
-
if (
|
|
4766
|
+
if (ks(e.textDirection)) {
|
|
4758
4767
|
let c = 0;
|
|
4759
4768
|
for (const f of e.blocks)
|
|
4760
4769
|
if (f.kind === "paragraph")
|
|
@@ -4776,7 +4785,7 @@ function t0(e, t, n, s) {
|
|
|
4776
4785
|
}
|
|
4777
4786
|
let x = 0, a = 0;
|
|
4778
4787
|
for (const c of e.blocks) {
|
|
4779
|
-
const l =
|
|
4788
|
+
const l = X0(c, t, n, s);
|
|
4780
4789
|
l.min > x && (x = l.min), l.max > a && (a = l.max);
|
|
4781
4790
|
}
|
|
4782
4791
|
x += i, a += i;
|
|
@@ -4796,13 +4805,13 @@ function vn(e, t, n) {
|
|
|
4796
4805
|
for (const o of t) i += e[o] + 1;
|
|
4797
4806
|
for (const o of t) e[o] += r * ((e[o] + 1) / i);
|
|
4798
4807
|
}
|
|
4799
|
-
function
|
|
4808
|
+
function Ms(e, t, n, s) {
|
|
4800
4809
|
const r = Rn(e).length, i = new Array(r).fill(0), o = new Array(r).fill(0), x = [], a = new Array(r).fill(0);
|
|
4801
4810
|
for (const c of e.rows) {
|
|
4802
4811
|
let l = 0;
|
|
4803
4812
|
for (const h of c.cells) {
|
|
4804
4813
|
for (; l < r && a[l] > 0; ) l++;
|
|
4805
|
-
const f = Math.max(1, h.colSpan ?? 1), N = Math.max(1, h.rowSpan ?? 1), p = l, S =
|
|
4814
|
+
const f = Math.max(1, h.colSpan ?? 1), N = Math.max(1, h.rowSpan ?? 1), p = l, S = Z0(h, t, n, s);
|
|
4806
4815
|
if (f === 1)
|
|
4807
4816
|
p < r && (S.min > i[p] && (i[p] = S.min), S.max > o[p] && (o[p] = S.max));
|
|
4808
4817
|
else {
|
|
@@ -4820,12 +4829,12 @@ function ks(e, t, n, s) {
|
|
|
4820
4829
|
vn(i, c.cols, c.mm.min), vn(o, c.cols, c.mm.max);
|
|
4821
4830
|
const d = [];
|
|
4822
4831
|
for (let c = 0; c < r; c++) {
|
|
4823
|
-
const l = Math.max(
|
|
4832
|
+
const l = Math.max(Q0, i[c]);
|
|
4824
4833
|
d.push({ min: l, max: Math.max(l, o[c]) });
|
|
4825
4834
|
}
|
|
4826
4835
|
return d;
|
|
4827
4836
|
}
|
|
4828
|
-
function
|
|
4837
|
+
function eo(e, t, n) {
|
|
4829
4838
|
const s = e.length;
|
|
4830
4839
|
if (s === 0) return [];
|
|
4831
4840
|
const r = e.map((a) => a.min), i = e.map((a) => a.max), o = r.reduce((a, d) => a + d, 0), x = i.reduce((a, d) => a + d, 0);
|
|
@@ -4843,7 +4852,7 @@ function n0(e, t, n) {
|
|
|
4843
4852
|
return r.slice();
|
|
4844
4853
|
}
|
|
4845
4854
|
const oe = 4;
|
|
4846
|
-
function
|
|
4855
|
+
function ks(e) {
|
|
4847
4856
|
switch (e) {
|
|
4848
4857
|
case "tbRl":
|
|
4849
4858
|
case "tbRlV":
|
|
@@ -4855,16 +4864,16 @@ function Bs(e) {
|
|
|
4855
4864
|
return null;
|
|
4856
4865
|
}
|
|
4857
4866
|
}
|
|
4858
|
-
const
|
|
4867
|
+
const to = (e) => e === "cw" ? Math.PI / 2 : -Math.PI / 2, Wn = { indentOf: () => 0, markers: /* @__PURE__ */ new Map() };
|
|
4859
4868
|
function Te(e, t, n, s) {
|
|
4860
4869
|
const r = e.widthMode ?? "fixed";
|
|
4861
4870
|
let i;
|
|
4862
4871
|
if (r === "fixed") {
|
|
4863
|
-
const h = Rn(e), f =
|
|
4872
|
+
const h = Rn(e), f = no(e.preferredWidth, t, h.length);
|
|
4864
4873
|
i = h.map((N) => N * f);
|
|
4865
4874
|
} else {
|
|
4866
|
-
const h =
|
|
4867
|
-
i =
|
|
4875
|
+
const h = Ms(e, s, n, t);
|
|
4876
|
+
i = eo(h, t, r);
|
|
4868
4877
|
}
|
|
4869
4878
|
const o = i.length, x = new Array(o).fill(0), a = e.rows.map((h) => {
|
|
4870
4879
|
let f = 0;
|
|
@@ -4875,14 +4884,14 @@ function Te(e, t, n, s) {
|
|
|
4875
4884
|
for (let C = 0; C < S; C++) I += i[f + C] ?? i[o - 1] ?? 40;
|
|
4876
4885
|
if (m > 1) for (let C = 0; C < S && f + C < o; C++) x[f + C] = m;
|
|
4877
4886
|
f += S;
|
|
4878
|
-
const b = _t(p), O = Math.max(8, I - b.left - b.right), E =
|
|
4887
|
+
const b = _t(p), O = Math.max(8, I - b.left - b.right), E = ks(p.textDirection);
|
|
4879
4888
|
if (E) {
|
|
4880
4889
|
let C = 0;
|
|
4881
4890
|
const z = p.blocks.map((R) => {
|
|
4882
4891
|
if (R.kind === "paragraph") {
|
|
4883
4892
|
const D = n(R, jt);
|
|
4884
4893
|
let W = 0;
|
|
4885
|
-
for (const M of D) W = Math.max(W,
|
|
4894
|
+
for (const M of D) W = Math.max(W, Es(M));
|
|
4886
4895
|
return C = Math.max(C, W + R.style.indentLeftPx + s.indentOf(R) + (R.style.indentRightPx ?? 0)), { kind: "para", block: R, lines: D };
|
|
4887
4896
|
}
|
|
4888
4897
|
if (R.kind === "image")
|
|
@@ -4931,15 +4940,15 @@ function Te(e, t, n, s) {
|
|
|
4931
4940
|
N.height > S && (d[p] += N.height - S);
|
|
4932
4941
|
}
|
|
4933
4942
|
}), a.forEach((h, f) => h.height = d[f]);
|
|
4934
|
-
const c = r === "fixed" && !e.preferredWidth ? t : i.reduce((h, f) => h + f, 0), l =
|
|
4943
|
+
const c = r === "fixed" && !e.preferredWidth ? t : i.reduce((h, f) => h + f, 0), l = so(e.align, t, c) + (e.indentPx ?? 0);
|
|
4935
4944
|
return { rows: a, colWidths: i, height: d.reduce((h, f) => h + f, 0), tableWidth: c, xOffset: l };
|
|
4936
4945
|
}
|
|
4937
|
-
function
|
|
4946
|
+
function no(e, t, n) {
|
|
4938
4947
|
if (!e) return t;
|
|
4939
4948
|
const s = e.type === "pct" ? e.value / 100 * t : e.value, r = Math.min(t, Math.max(1, n) * 24);
|
|
4940
4949
|
return Math.max(r, Math.min(t, s));
|
|
4941
4950
|
}
|
|
4942
|
-
function
|
|
4951
|
+
function so(e, t, n) {
|
|
4943
4952
|
const s = t - n;
|
|
4944
4953
|
return s <= 0 ? 0 : e === "center" ? s / 2 : e === "right" ? s : 0;
|
|
4945
4954
|
}
|
|
@@ -4959,7 +4968,7 @@ function qe(e, t, n, s, r, i, o, x) {
|
|
|
4959
4968
|
for (const m of N.cells) {
|
|
4960
4969
|
const T = a[m.colStart] ?? a[a.length - 1], I = s + (e.bidiVisual ? c - T - m.width : T), b = Math.min(t.length - 1, f + m.rowSpan - 1), O = d[b + 1] - p, E = [], y = _t(m.cell), G = m.width - y.left - y.right;
|
|
4961
4970
|
if (m.rot) {
|
|
4962
|
-
const D = O - y.top - y.bottom, W =
|
|
4971
|
+
const D = O - y.top - y.bottom, W = to(m.rot), M = m.rot === "cw" ? I + y.left + G : I + y.left, L = m.rot === "cw" ? p + y.top : p + y.top + D;
|
|
4963
4972
|
let v = 0;
|
|
4964
4973
|
for (const P of m.items)
|
|
4965
4974
|
if (P.kind === "para") {
|
|
@@ -5097,47 +5106,15 @@ function qe(e, t, n, s, r, i, o, x) {
|
|
|
5097
5106
|
table: { x: s, y: r, width: i, height: h, rows: l, colWidths: n, ...e.bidiVisual ? { bidiVisual: !0 } : {} }
|
|
5098
5107
|
};
|
|
5099
5108
|
}
|
|
5100
|
-
const
|
|
5109
|
+
const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5101
5110
|
__proto__: null,
|
|
5102
|
-
createLayoutEngine:
|
|
5103
|
-
effectiveSection:
|
|
5104
|
-
resolveSections:
|
|
5111
|
+
createLayoutEngine: v0,
|
|
5112
|
+
effectiveSection: Gn,
|
|
5113
|
+
resolveSections: Hn
|
|
5105
5114
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5106
|
-
function o0(e) {
|
|
5107
|
-
const t = /* @__PURE__ */ new Map(), n = (s, r) => {
|
|
5108
|
-
for (const i of s)
|
|
5109
|
-
if (t.has(i.blockId) || t.set(i.blockId, r), i.table) for (const o of i.table.rows) for (const x of o.cells) n(x.blocks, r);
|
|
5110
|
-
};
|
|
5111
|
-
for (const s of e.pages) n(s.blocks, s.number);
|
|
5112
|
-
return t;
|
|
5113
|
-
}
|
|
5114
|
-
function u0(e, t) {
|
|
5115
|
-
const n = o0(t), s = [];
|
|
5116
|
-
for (const r of e.blocks) {
|
|
5117
|
-
if (r.kind !== "paragraph") continue;
|
|
5118
|
-
const i = r.runs.find((l) => l.style.link?.startsWith("#"))?.style.link?.slice(1);
|
|
5119
|
-
if (!i) continue;
|
|
5120
|
-
const o = e.bookmarks?.[i]?.start.blockId;
|
|
5121
|
-
if (!o) continue;
|
|
5122
|
-
const x = n.get(o);
|
|
5123
|
-
if (x === void 0) continue;
|
|
5124
|
-
const a = js(r.runs), d = a.match(/\t(\d+)(\s*)$/);
|
|
5125
|
-
if (!d || d[1] === String(x)) continue;
|
|
5126
|
-
const c = a.length - d[2].length - d[1].length;
|
|
5127
|
-
s.push({
|
|
5128
|
-
blockId: r.id,
|
|
5129
|
-
start: c,
|
|
5130
|
-
end: c + d[1].length,
|
|
5131
|
-
text: String(x),
|
|
5132
|
-
style: Us(r.runs, c) ?? r.runs[0]?.style
|
|
5133
|
-
});
|
|
5134
|
-
}
|
|
5135
|
-
return s;
|
|
5136
|
-
}
|
|
5137
5115
|
export {
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
To as c,
|
|
5116
|
+
lo as a,
|
|
5117
|
+
v0 as c,
|
|
5141
5118
|
Rt as e,
|
|
5142
|
-
|
|
5119
|
+
Hn as r
|
|
5143
5120
|
};
|