render-tag 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -32
- package/lib/index.js.map +1 -1
- package/lib/layout.d.ts +6 -1
- package/lib/layout.d.ts.map +1 -1
- package/lib/layout.js +99 -29
- package/lib/layout.js.map +1 -1
- package/lib/path/glyph-layout.d.ts +71 -0
- package/lib/path/glyph-layout.d.ts.map +1 -0
- package/lib/path/glyph-layout.js +155 -0
- package/lib/path/glyph-layout.js.map +1 -0
- package/lib/path/grapheme.d.ts +2 -0
- package/lib/path/grapheme.d.ts.map +1 -0
- package/lib/path/grapheme.js +39 -0
- package/lib/path/grapheme.js.map +1 -0
- package/lib/path/index.d.ts +96 -0
- package/lib/path/index.d.ts.map +1 -0
- package/lib/path/index.js +145 -0
- package/lib/path/index.js.map +1 -0
- package/lib/path/svg-path.d.ts +68 -0
- package/lib/path/svg-path.d.ts.map +1 -0
- package/lib/path/svg-path.js +393 -0
- package/lib/path/svg-path.js.map +1 -0
- package/lib/render-tag.umd.js +3 -3
- package/lib/render-tag.umd.js.map +1 -1
- package/lib/types.d.ts +12 -0
- package/lib/types.d.ts.map +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal SVG path 'd' attribute parser + arc-length tabulation.
|
|
3
|
+
* Supports: M m L l H h V v C c S s Q q T t A a Z z.
|
|
4
|
+
*
|
|
5
|
+
* Curves are sampled uniformly in parameter space and the cumulative
|
|
6
|
+
* arc-length is tabulated. `getPointAtLength` binary-searches that table
|
|
7
|
+
* and lerps between adjacent samples. Accuracy is "good enough for visual
|
|
8
|
+
* rendering" — not for hit-testing or precise length math.
|
|
9
|
+
*/
|
|
10
|
+
// ─── Tokenizer ─────────────────────────────────────────────────────────
|
|
11
|
+
const COMMAND_RE = /[MmLlHhVvCcSsQqTtAaZz]/;
|
|
12
|
+
const NUMBER_RE = /-?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-+]?\d+)?/g;
|
|
13
|
+
/** Split a path string into a sequence of (command, args) tuples. */
|
|
14
|
+
function tokenize(d) {
|
|
15
|
+
const out = [];
|
|
16
|
+
let i = 0;
|
|
17
|
+
while (i < d.length) {
|
|
18
|
+
const c = d[i];
|
|
19
|
+
if (COMMAND_RE.test(c)) {
|
|
20
|
+
// Slice until the next command
|
|
21
|
+
let j = i + 1;
|
|
22
|
+
while (j < d.length && !COMMAND_RE.test(d[j]))
|
|
23
|
+
j++;
|
|
24
|
+
const argString = d.slice(i + 1, j);
|
|
25
|
+
const args = [];
|
|
26
|
+
let m;
|
|
27
|
+
NUMBER_RE.lastIndex = 0;
|
|
28
|
+
while ((m = NUMBER_RE.exec(argString)))
|
|
29
|
+
args.push(Number(m[0]));
|
|
30
|
+
out.push({ cmd: c, args });
|
|
31
|
+
i = j;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
i++;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
// ─── Normalize to absolute segments ───────────────────────────────────
|
|
40
|
+
/**
|
|
41
|
+
* Parse path data into an array of normalized absolute-coordinate segments.
|
|
42
|
+
* Drops moveTo commands (they don't draw); inserts a closing line for Z.
|
|
43
|
+
*/
|
|
44
|
+
export function parsePathData(d) {
|
|
45
|
+
const tokens = tokenize(d);
|
|
46
|
+
const segs = [];
|
|
47
|
+
let cx = 0, cy = 0; // current point
|
|
48
|
+
let sx = 0, sy = 0; // subpath start
|
|
49
|
+
// Last cubic control reflection point (for S/s)
|
|
50
|
+
let lastCubicCtrl = null;
|
|
51
|
+
// Last quadratic control reflection point (for T/t)
|
|
52
|
+
let lastQuadCtrl = null;
|
|
53
|
+
for (const tok of tokens) {
|
|
54
|
+
const cmd = tok.cmd;
|
|
55
|
+
const upper = cmd.toUpperCase();
|
|
56
|
+
const rel = cmd !== upper;
|
|
57
|
+
const a = tok.args;
|
|
58
|
+
// Helpers
|
|
59
|
+
const ax = (v) => (rel ? cx + v : v);
|
|
60
|
+
const ay = (v) => (rel ? cy + v : v);
|
|
61
|
+
let resetCubic = true;
|
|
62
|
+
let resetQuad = true;
|
|
63
|
+
switch (upper) {
|
|
64
|
+
case 'M': {
|
|
65
|
+
// M arglist: first pair = moveto, subsequent pairs = lineto
|
|
66
|
+
for (let i = 0; i < a.length; i += 2) {
|
|
67
|
+
const x = rel && i > 0 ? cx + a[i] : ax(a[i]);
|
|
68
|
+
const y = rel && i > 0 ? cy + a[i + 1] : ay(a[i + 1]);
|
|
69
|
+
if (i === 0) {
|
|
70
|
+
cx = x;
|
|
71
|
+
cy = y;
|
|
72
|
+
sx = x;
|
|
73
|
+
sy = y;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
segs.push({ type: 'L', x0: cx, y0: cy, x1: x, y1: y });
|
|
77
|
+
cx = x;
|
|
78
|
+
cy = y;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
case 'L': {
|
|
84
|
+
for (let i = 0; i < a.length; i += 2) {
|
|
85
|
+
const x = ax(a[i]);
|
|
86
|
+
const y = ay(a[i + 1]);
|
|
87
|
+
segs.push({ type: 'L', x0: cx, y0: cy, x1: x, y1: y });
|
|
88
|
+
cx = x;
|
|
89
|
+
cy = y;
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case 'H': {
|
|
94
|
+
for (let i = 0; i < a.length; i++) {
|
|
95
|
+
const x = rel ? cx + a[i] : a[i];
|
|
96
|
+
segs.push({ type: 'L', x0: cx, y0: cy, x1: x, y1: cy });
|
|
97
|
+
cx = x;
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case 'V': {
|
|
102
|
+
for (let i = 0; i < a.length; i++) {
|
|
103
|
+
const y = rel ? cy + a[i] : a[i];
|
|
104
|
+
segs.push({ type: 'L', x0: cx, y0: cy, x1: cx, y1: y });
|
|
105
|
+
cy = y;
|
|
106
|
+
}
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
case 'C': {
|
|
110
|
+
for (let i = 0; i < a.length; i += 6) {
|
|
111
|
+
const c1x = ax(a[i]);
|
|
112
|
+
const c1y = ay(a[i + 1]);
|
|
113
|
+
const c2x = ax(a[i + 2]);
|
|
114
|
+
const c2y = ay(a[i + 3]);
|
|
115
|
+
const x = ax(a[i + 4]);
|
|
116
|
+
const y = ay(a[i + 5]);
|
|
117
|
+
segs.push({ type: 'C', x0: cx, y0: cy, c1x, c1y, c2x, c2y, x1: x, y1: y });
|
|
118
|
+
lastCubicCtrl = { x: c2x, y: c2y };
|
|
119
|
+
cx = x;
|
|
120
|
+
cy = y;
|
|
121
|
+
}
|
|
122
|
+
resetCubic = false;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
case 'S': {
|
|
126
|
+
for (let i = 0; i < a.length; i += 4) {
|
|
127
|
+
// Reflect previous cubic c2 about current point. If previous was not C/S, use cx,cy.
|
|
128
|
+
const c1x = lastCubicCtrl ? 2 * cx - lastCubicCtrl.x : cx;
|
|
129
|
+
const c1y = lastCubicCtrl ? 2 * cy - lastCubicCtrl.y : cy;
|
|
130
|
+
const c2x = ax(a[i]);
|
|
131
|
+
const c2y = ay(a[i + 1]);
|
|
132
|
+
const x = ax(a[i + 2]);
|
|
133
|
+
const y = ay(a[i + 3]);
|
|
134
|
+
segs.push({ type: 'C', x0: cx, y0: cy, c1x, c1y, c2x, c2y, x1: x, y1: y });
|
|
135
|
+
lastCubicCtrl = { x: c2x, y: c2y };
|
|
136
|
+
cx = x;
|
|
137
|
+
cy = y;
|
|
138
|
+
}
|
|
139
|
+
resetCubic = false;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
case 'Q': {
|
|
143
|
+
for (let i = 0; i < a.length; i += 4) {
|
|
144
|
+
const ctlx = ax(a[i]);
|
|
145
|
+
const ctly = ay(a[i + 1]);
|
|
146
|
+
const x = ax(a[i + 2]);
|
|
147
|
+
const y = ay(a[i + 3]);
|
|
148
|
+
segs.push({ type: 'Q', x0: cx, y0: cy, cx: ctlx, cy: ctly, x1: x, y1: y });
|
|
149
|
+
lastQuadCtrl = { x: ctlx, y: ctly };
|
|
150
|
+
cx = x;
|
|
151
|
+
cy = y;
|
|
152
|
+
}
|
|
153
|
+
resetQuad = false;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
case 'T': {
|
|
157
|
+
for (let i = 0; i < a.length; i += 2) {
|
|
158
|
+
const ctlx = lastQuadCtrl ? 2 * cx - lastQuadCtrl.x : cx;
|
|
159
|
+
const ctly = lastQuadCtrl ? 2 * cy - lastQuadCtrl.y : cy;
|
|
160
|
+
const x = ax(a[i]);
|
|
161
|
+
const y = ay(a[i + 1]);
|
|
162
|
+
segs.push({ type: 'Q', x0: cx, y0: cy, cx: ctlx, cy: ctly, x1: x, y1: y });
|
|
163
|
+
lastQuadCtrl = { x: ctlx, y: ctly };
|
|
164
|
+
cx = x;
|
|
165
|
+
cy = y;
|
|
166
|
+
}
|
|
167
|
+
resetQuad = false;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
case 'A': {
|
|
171
|
+
for (let i = 0; i < a.length; i += 7) {
|
|
172
|
+
const rx = a[i];
|
|
173
|
+
const ry = a[i + 1];
|
|
174
|
+
const xAxisRotation = a[i + 2];
|
|
175
|
+
const largeArc = a[i + 3] !== 0;
|
|
176
|
+
const sweep = a[i + 4] !== 0;
|
|
177
|
+
const x = ax(a[i + 5]);
|
|
178
|
+
const y = ay(a[i + 6]);
|
|
179
|
+
// SVG spec §B.2.5: arcs with rx=0 or ry=0 degenerate to a straight
|
|
180
|
+
// line, and arcs whose endpoints coincide are not rendered at all
|
|
181
|
+
// (skip emitting a segment). Without these guards arcToCenter
|
|
182
|
+
// produces NaN sample points, poisoning the entire path.
|
|
183
|
+
if (rx === 0 || ry === 0) {
|
|
184
|
+
if (cx !== x || cy !== y) {
|
|
185
|
+
segs.push({ type: 'L', x0: cx, y0: cy, x1: x, y1: y });
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
else if (cx === x && cy === y) {
|
|
189
|
+
// identical endpoints — skip
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
segs.push({
|
|
193
|
+
type: 'A', x0: cx, y0: cy, rx, ry, xAxisRotation, largeArc, sweep,
|
|
194
|
+
x1: x, y1: y,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
cx = x;
|
|
198
|
+
cy = y;
|
|
199
|
+
}
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
case 'Z': {
|
|
203
|
+
if (cx !== sx || cy !== sy) {
|
|
204
|
+
segs.push({ type: 'L', x0: cx, y0: cy, x1: sx, y1: sy });
|
|
205
|
+
}
|
|
206
|
+
cx = sx;
|
|
207
|
+
cy = sy;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
default:
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
if (resetCubic)
|
|
214
|
+
lastCubicCtrl = null;
|
|
215
|
+
if (resetQuad)
|
|
216
|
+
lastQuadCtrl = null;
|
|
217
|
+
}
|
|
218
|
+
return segs;
|
|
219
|
+
}
|
|
220
|
+
// ─── Curve evaluation + length tabulation ─────────────────────────────
|
|
221
|
+
function evalCubic(s, t) {
|
|
222
|
+
const mt = 1 - t;
|
|
223
|
+
const mt2 = mt * mt;
|
|
224
|
+
const t2 = t * t;
|
|
225
|
+
return {
|
|
226
|
+
x: mt * mt2 * s.x0 + 3 * mt2 * t * s.c1x + 3 * mt * t2 * s.c2x + t2 * t * s.x1,
|
|
227
|
+
y: mt * mt2 * s.y0 + 3 * mt2 * t * s.c1y + 3 * mt * t2 * s.c2y + t2 * t * s.y1,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function evalQuadratic(s, t) {
|
|
231
|
+
const mt = 1 - t;
|
|
232
|
+
return {
|
|
233
|
+
x: mt * mt * s.x0 + 2 * mt * t * s.cx + t * t * s.x1,
|
|
234
|
+
y: mt * mt * s.y0 + 2 * mt * t * s.cy + t * t * s.y1,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Endpoint-to-center arc conversion (SVG spec).
|
|
239
|
+
* Returns { cx, cy, theta1, deltaTheta } in the rotated frame.
|
|
240
|
+
*/
|
|
241
|
+
function arcToCenter(s) {
|
|
242
|
+
let rx = Math.abs(s.rx);
|
|
243
|
+
let ry = Math.abs(s.ry);
|
|
244
|
+
const phi = (s.xAxisRotation * Math.PI) / 180;
|
|
245
|
+
const cosPhi = Math.cos(phi);
|
|
246
|
+
const sinPhi = Math.sin(phi);
|
|
247
|
+
const dx = (s.x0 - s.x1) / 2;
|
|
248
|
+
const dy = (s.y0 - s.y1) / 2;
|
|
249
|
+
const x1p = cosPhi * dx + sinPhi * dy;
|
|
250
|
+
const y1p = -sinPhi * dx + cosPhi * dy;
|
|
251
|
+
// Ensure radii are large enough
|
|
252
|
+
const lambda = (x1p * x1p) / (rx * rx) + (y1p * y1p) / (ry * ry);
|
|
253
|
+
if (lambda > 1) {
|
|
254
|
+
const s2 = Math.sqrt(lambda);
|
|
255
|
+
rx *= s2;
|
|
256
|
+
ry *= s2;
|
|
257
|
+
}
|
|
258
|
+
const sign = s.largeArc === s.sweep ? -1 : 1;
|
|
259
|
+
const num = rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p;
|
|
260
|
+
const den = rx * rx * y1p * y1p + ry * ry * x1p * x1p;
|
|
261
|
+
const factor = Math.sqrt(Math.max(0, num / den));
|
|
262
|
+
const cxp = sign * factor * ((rx * y1p) / ry);
|
|
263
|
+
const cyp = sign * factor * (-(ry * x1p) / rx);
|
|
264
|
+
const cx = cosPhi * cxp - sinPhi * cyp + (s.x0 + s.x1) / 2;
|
|
265
|
+
const cy = sinPhi * cxp + cosPhi * cyp + (s.y0 + s.y1) / 2;
|
|
266
|
+
const angle = (ux, uy, vx, vy) => {
|
|
267
|
+
const dot = ux * vx + uy * vy;
|
|
268
|
+
const len = Math.sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy));
|
|
269
|
+
let ang = Math.acos(Math.min(1, Math.max(-1, dot / len)));
|
|
270
|
+
if (ux * vy - uy * vx < 0)
|
|
271
|
+
ang = -ang;
|
|
272
|
+
return ang;
|
|
273
|
+
};
|
|
274
|
+
const theta1 = angle(1, 0, (x1p - cxp) / rx, (y1p - cyp) / ry);
|
|
275
|
+
let deltaTheta = angle((x1p - cxp) / rx, (y1p - cyp) / ry, (-x1p - cxp) / rx, (-y1p - cyp) / ry);
|
|
276
|
+
deltaTheta = deltaTheta % (2 * Math.PI);
|
|
277
|
+
if (!s.sweep && deltaTheta > 0)
|
|
278
|
+
deltaTheta -= 2 * Math.PI;
|
|
279
|
+
else if (s.sweep && deltaTheta < 0)
|
|
280
|
+
deltaTheta += 2 * Math.PI;
|
|
281
|
+
return { cx, cy, rx, ry, phi, theta1, deltaTheta, cosPhi, sinPhi };
|
|
282
|
+
}
|
|
283
|
+
function evalArc(s, t) {
|
|
284
|
+
const { cx, cy, rx, ry, cosPhi, sinPhi, theta1, deltaTheta } = arcToCenter(s);
|
|
285
|
+
const theta = theta1 + t * deltaTheta;
|
|
286
|
+
const px = rx * Math.cos(theta);
|
|
287
|
+
const py = ry * Math.sin(theta);
|
|
288
|
+
return {
|
|
289
|
+
x: cosPhi * px - sinPhi * py + cx,
|
|
290
|
+
y: sinPhi * px + cosPhi * py + cy,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
const CURVE_SAMPLES = 40;
|
|
294
|
+
/**
|
|
295
|
+
* Build a PathLike interface from normalized segments.
|
|
296
|
+
* Tabulates cumulative arc-length per segment for O(log N) length-to-point lookup.
|
|
297
|
+
*/
|
|
298
|
+
export function buildPathLike(segs) {
|
|
299
|
+
const entries = [];
|
|
300
|
+
let totalLen = 0;
|
|
301
|
+
for (const seg of segs) {
|
|
302
|
+
if (seg.type === 'L') {
|
|
303
|
+
const len = Math.hypot(seg.x1 - seg.x0, seg.y1 - seg.y0);
|
|
304
|
+
entries.push({ startLen: totalLen, length: len, seg });
|
|
305
|
+
totalLen += len;
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
// Sample CURVE_SAMPLES + 1 points and accumulate cumulative arc length.
|
|
309
|
+
const samples = [];
|
|
310
|
+
let cumLen = 0;
|
|
311
|
+
let prev;
|
|
312
|
+
if (seg.type === 'C')
|
|
313
|
+
prev = { x: seg.x0, y: seg.y0 };
|
|
314
|
+
else if (seg.type === 'Q')
|
|
315
|
+
prev = { x: seg.x0, y: seg.y0 };
|
|
316
|
+
else
|
|
317
|
+
prev = evalArc(seg, 0);
|
|
318
|
+
samples.push({ t: 0, len: 0 });
|
|
319
|
+
for (let i = 1; i <= CURVE_SAMPLES; i++) {
|
|
320
|
+
const t = i / CURVE_SAMPLES;
|
|
321
|
+
let p;
|
|
322
|
+
if (seg.type === 'C')
|
|
323
|
+
p = evalCubic(seg, t);
|
|
324
|
+
else if (seg.type === 'Q')
|
|
325
|
+
p = evalQuadratic(seg, t);
|
|
326
|
+
else
|
|
327
|
+
p = evalArc(seg, t);
|
|
328
|
+
cumLen += Math.hypot(p.x - prev.x, p.y - prev.y);
|
|
329
|
+
samples.push({ t, len: cumLen });
|
|
330
|
+
prev = p;
|
|
331
|
+
}
|
|
332
|
+
entries.push({ startLen: totalLen, length: cumLen, seg, samples });
|
|
333
|
+
totalLen += cumLen;
|
|
334
|
+
}
|
|
335
|
+
function getPointAtLength(t) {
|
|
336
|
+
// Reject NaN / Infinity — `t < 0` etc. silently pass NaN through.
|
|
337
|
+
if (!Number.isFinite(t))
|
|
338
|
+
return null;
|
|
339
|
+
if (t < 0 || t > totalLen + 1e-6)
|
|
340
|
+
return null;
|
|
341
|
+
if (t === 0 && entries.length > 0) {
|
|
342
|
+
const first = entries[0].seg;
|
|
343
|
+
if (first.type === 'L' || first.type === 'C' || first.type === 'Q') {
|
|
344
|
+
return { x: first.x0, y: first.y0 };
|
|
345
|
+
}
|
|
346
|
+
return evalArc(first, 0);
|
|
347
|
+
}
|
|
348
|
+
// Find the segment via linear scan (segment count is usually small).
|
|
349
|
+
// Could binary-search for very large paths.
|
|
350
|
+
for (let i = 0; i < entries.length; i++) {
|
|
351
|
+
const e = entries[i];
|
|
352
|
+
if (t > e.startLen + e.length + 1e-6)
|
|
353
|
+
continue;
|
|
354
|
+
const local = t - e.startLen;
|
|
355
|
+
if (e.seg.type === 'L') {
|
|
356
|
+
const frac = e.length === 0 ? 0 : Math.max(0, Math.min(1, local / e.length));
|
|
357
|
+
return {
|
|
358
|
+
x: e.seg.x0 + (e.seg.x1 - e.seg.x0) * frac,
|
|
359
|
+
y: e.seg.y0 + (e.seg.y1 - e.seg.y0) * frac,
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
// Binary search the sample table for the bracketing pair.
|
|
363
|
+
const samples = e.samples;
|
|
364
|
+
let lo = 0, hi = samples.length - 1;
|
|
365
|
+
while (hi - lo > 1) {
|
|
366
|
+
const mid = (lo + hi) >> 1;
|
|
367
|
+
if (samples[mid].len <= local)
|
|
368
|
+
lo = mid;
|
|
369
|
+
else
|
|
370
|
+
hi = mid;
|
|
371
|
+
}
|
|
372
|
+
const a = samples[lo];
|
|
373
|
+
const b = samples[hi];
|
|
374
|
+
const span = b.len - a.len;
|
|
375
|
+
const frac = span === 0 ? 0 : (local - a.len) / span;
|
|
376
|
+
// Clamp to [0, 1] — float drift in the polyline-sum vs true arc length
|
|
377
|
+
// can push frac past 1.0 when t lands just past the last sample.
|
|
378
|
+
const tt = Math.max(0, Math.min(1, a.t + (b.t - a.t) * frac));
|
|
379
|
+
if (e.seg.type === 'C')
|
|
380
|
+
return evalCubic(e.seg, tt);
|
|
381
|
+
if (e.seg.type === 'Q')
|
|
382
|
+
return evalQuadratic(e.seg, tt);
|
|
383
|
+
return evalArc(e.seg, tt);
|
|
384
|
+
}
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
return { length: totalLen, getPointAtLength };
|
|
388
|
+
}
|
|
389
|
+
/** Convenience: parse a path string and build a PathLike in one call. */
|
|
390
|
+
export function pathFromString(d) {
|
|
391
|
+
return buildPathLike(parsePathData(d));
|
|
392
|
+
}
|
|
393
|
+
//# sourceMappingURL=svg-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg-path.js","sourceRoot":"","sources":["../../src/path/svg-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsCH,0EAA0E;AAE1E,MAAM,UAAU,GAAG,wBAAwB,CAAC;AAC5C,MAAM,SAAS,GAAG,kDAAkD,CAAC;AAErE,qEAAqE;AACrE,SAAS,QAAQ,CAAC,CAAS;IACzB,MAAM,GAAG,GAAsC,EAAE,CAAC;IAClD,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACf,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YACvB,+BAA+B;YAC/B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAAE,CAAC,EAAE,CAAC;YACnD,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YACpC,MAAM,IAAI,GAAa,EAAE,CAAC;YAC1B,IAAI,CAAyB,CAAC;YAC9B,SAAS,CAAC,SAAS,GAAG,CAAC,CAAC;YACxB,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,IAA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AAC,EAAE,CAAC,CAAC;YACtB,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC;YAC3B,MAAM,IAAI,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;YACrD,uEAAuE;YACvE,iEAAiE;YACjE,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;YAC9D,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,GAAG;gBAAE,OAAO,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACpD,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,GAAG;gBAAE,OAAO,aAAa,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACxD,OAAO,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;AAChD,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,cAAc,CAAC,CAAS;IACtC,OAAO,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
package/lib/render-tag.umd.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
`,e.remove();let i=document.createDocumentFragment();for(;t.body.firstChild;)i.appendChild(document.adoptNode(t.body.firstChild));return{fragment:i,css:r}}function n(e){let t=[],n=[];e=e.replace(/\/\*[\s\S]*?\*\//g,``);let r=0;for(;r<e.length;){for(;r<e.length&&/\s/.test(e[r]);)r++;if(r>=e.length)break;if(e[r]===`@`){let t=r,i=0;for(;r<e.length;){if(e[r]===`{`&&i++,e[r]===`}`&&(i--,i<=0)){r++;break}r++}let a=e.slice(t,r);a.startsWith(`@font-face`)&&n.push(a);continue}let i=r;for(;r<e.length&&e[r]!==`{`;)r++;if(r>=e.length)break;let a=e.slice(i,r).trim();r++;let o=r;for(;r<e.length&&e[r]!==`}`;)r++;let s=e.slice(o,r).trim();if(r++,!a)continue;let c=a.split(`,`).map(e=>e.trim()).filter(Boolean),l=[];for(let e of s.split(`;`)){let t=e.indexOf(`:`);if(t===-1)continue;let n=e.slice(0,t).trim().toLowerCase(),r=e.slice(t+1).trim();n&&r&&l.push({property:n,value:r})}c.length>0&&l.length>0&&t.push({selectors:c,declarations:l})}return{rules:t,fontFaceRules:n}}function r(e){let t=e.replace(/::[\w-]+/g,``).split(/\s*>\s*|\s+/),n=0,r=0,i=0;for(let e of t){let t=e.match(/#[\w-]+/g);t&&(n+=t.length);let a=e.match(/\.[\w-]+/g);a&&(r+=a.length);let o=e.replace(/[#.][\w-]+/g,``).replace(/:[\w-]+/g,``).trim();o&&o!==`*`&&i++}return[n,r,i]}function i(e){let t=e.match(/\.[\w-]+/g)||[],n=e.replace(/\.[\w-]+/g,``).replace(/:[\w-]+/g,``).trim();return{tag:n&&n!==`*`?n:``,classes:t.map(e=>e.slice(1))}}function a(e,t){if(e.tag&&e.tag!==t.tagName)return!1;for(let n of e.classes)if(!t.classes.has(n))return!1;return!0}function o(e){let t;if(e.includes(`::`)){if(e.replace(/::marker\b/g,``).includes(`::`))return null;if(/::marker\b/.test(e))t=`marker`,e=e.replace(/(^|[\s>])::marker\b/g,`$1*`),e=e.replace(/::marker\b/g,``);else return null}if(/:(?:nth-|hover|focus|active|visited|first-child|last-child)/.test(e))return null;let n=[],a=[],o=e.trim().split(/\s+/);for(let e=0;e<o.length;e++)o[e]===`>`?a.push(`>`):(n.length>a.length+1&&a.push(` `),n.push(o[e]));for(;a.length<n.length-1;)a.push(` `);if(n.length===0)return null;let s=n.map(i),c=s[s.length-1],l=c.tag;return{parts:s,combinators:a,rightmost:c,rightmostIsRoot:l===`html`||l===`body`,spec:r(e),pseudoElement:t}}function s(e,t){if(e.rightmostIsRoot){if(t.parent!==null)return!1}else if(!a(e.rightmost,t))return!1;if(e.parts.length===1)return!0;let n=t.parent;for(let t=e.parts.length-2;t>=0;t--){if(!n)return!1;let r=e.parts[t];if(e.combinators[t]===`>`)if(n.parent===null&&(r.tag===`html`||r.tag===`body`))n=n.parent;else if(a(r,n))n=n.parent;else return!1;else{let e=!1;for(;n;){if(n.parent===null&&(r.tag===`html`||r.tag===`body`)){n=n.parent,e=!0;break}if(a(r,n)){n=n.parent,e=!0;break}n=n.parent}if(!e)return!1}}return!0}function c(){return{fontFamily:`sans-serif`,fontSize:16,fontWeight:400,fontStyle:`normal`,color:`rgb(0, 0, 0)`,textAlign:`start`,textAlignLast:`auto`,textIndent:0,textTransform:`none`,textDecorationLine:`none`,textDecorationStyle:`solid`,textDecorationColor:`rgb(0, 0, 0)`,textShadow:`none`,webkitTextStrokeWidth:0,webkitTextStrokeColor:``,webkitTextFillColor:``,paintOrder:`normal`,webkitBackgroundClip:``,backgroundImage:`none`,letterSpacing:0,wordSpacing:0,fontKerning:`auto`,lineHeight:0,verticalAlign:`baseline`,whiteSpace:`normal`,wordBreak:`normal`,overflowWrap:`normal`,direction:`ltr`,display:`block`,width:0,minHeight:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,backgroundColor:`rgba(0, 0, 0, 0)`,borderTopWidth:0,borderTopColor:`rgb(0, 0, 0)`,borderTopStyle:`none`,borderRightWidth:0,borderRightColor:`rgb(0, 0, 0)`,borderRightStyle:`none`,borderBottomWidth:0,borderBottomColor:`rgb(0, 0, 0)`,borderBottomStyle:`none`,borderLeftWidth:0,borderLeftColor:`rgb(0, 0, 0)`,borderLeftStyle:`none`,flexDirection:`row`,gap:0,flexGrow:0,listStyleType:`disc`}}var l={span:{display:`inline`},a:{display:`inline`},strong:{display:`inline`,fontWeight:700},b:{display:`inline`,fontWeight:700},em:{display:`inline`,fontStyle:`italic`},i:{display:`inline`,fontStyle:`italic`},u:{display:`inline`,textDecorationLine:`underline`},s:{display:`inline`,textDecorationLine:`line-through`},strike:{display:`inline`,textDecorationLine:`line-through`},del:{display:`inline`,textDecorationLine:`line-through`},sub:{display:`inline`,verticalAlign:`sub`,fontSize:.83},sup:{display:`inline`,verticalAlign:`super`,fontSize:.83},code:{display:`inline`,fontFamily:`monospace`},cite:{display:`inline`,fontStyle:`italic`},p:{display:`block`,marginTop:-1,marginBottom:-1},div:{display:`block`},h1:{display:`block`,fontSize:2,fontWeight:700,marginTop:-.67,marginBottom:-.67},h2:{display:`block`,fontSize:1.5,fontWeight:700,marginTop:-.83,marginBottom:-.83},h3:{display:`block`,fontSize:1.17,fontWeight:700,marginTop:-1,marginBottom:-1},h4:{display:`block`,fontSize:1,fontWeight:700,marginTop:-1.33,marginBottom:-1.33},h5:{display:`block`,fontSize:.83,fontWeight:700,marginTop:-1.67,marginBottom:-1.67},h6:{display:`block`,fontSize:.67,fontWeight:700,marginTop:-2.33,marginBottom:-2.33},ul:{display:`block`,listStyleType:`disc`,marginTop:-1,marginBottom:-1},ol:{display:`block`,listStyleType:`decimal`,marginTop:-1,marginBottom:-1},li:{display:`list-item`},blockquote:{display:`block`,marginTop:-1,marginBottom:-1,marginLeft:40,marginRight:40},pre:{display:`block`,whiteSpace:`pre`,fontFamily:`monospace`,marginTop:-1,marginBottom:-1},table:{display:`table`},tr:{display:`table-row`},td:{display:`table-cell`},th:{display:`table-cell`,fontWeight:700},br:{display:`inline`},hr:{display:`block`,borderTopWidth:1,borderTopStyle:`solid`,borderTopColor:`gray`,marginTop:-.5,marginBottom:-.5}};function u(e,t,n){if(!e||e===`normal`||e===`auto`||e===`none`)return 0;let r=e.trim();if(r.endsWith(`em`)){let e=parseFloat(r);return isNaN(e)?0:e*t}if(r.endsWith(`%`)){let e=parseFloat(r);return isNaN(e)?0:e/100*n}if(r.endsWith(`px`)){let e=parseFloat(r);return isNaN(e)?0:e}let i=parseFloat(r);return isNaN(i)?0:i}function d(e){if(e===`bold`)return 700;if(e===`normal`)return 400;let t=parseInt(e,10);return isNaN(t)?400:t}function f(e){let t=e.trim().toLowerCase();if(!t||t===`normal`)return!1;let n=t.split(/\s+/).filter(e=>e===`fill`||e===`stroke`),r=n.indexOf(`stroke`),i=n.indexOf(`fill`);return r===-1?!1:i===-1?!0:r<i}function p(e){let t=[],n=0,r=``;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?(n++,r+=a):a===`)`?(n=Math.max(0,n-1),r+=a):n===0&&/\s/.test(a)?r&&=(t.push(r),``):r+=a}return r&&t.push(r),t}function m(e,t){if(e===`margin`||e===`padding`){let n=t.trim().split(/\s+/),r,i,a,o;return n.length===1?r=i=a=o=n[0]:n.length===2?(r=a=n[0],i=o=n[1]):n.length===3?(r=n[0],i=o=n[1],a=n[2]):(r=n[0],i=n[1],a=n[2],o=n[3]),[{property:`${e}-top`,value:r},{property:`${e}-right`,value:i},{property:`${e}-bottom`,value:a},{property:`${e}-left`,value:o}]}if(e===`border`||e===`border-top`||e===`border-right`||e===`border-bottom`||e===`border-left`){let n=t.trim().split(/\s+/),r=[`solid`,`dashed`,`dotted`,`double`,`none`,`hidden`],i=n.find(e=>e.endsWith(`px`)||/^\d/.test(e))||`0`,a=n.find(e=>r.includes(e))||`none`,o=n.find(e=>!e.endsWith(`px`)&&!/^\d/.test(e)&&!r.includes(e))||`currentColor`,s=[],c=e===`border`?[`top`,`right`,`bottom`,`left`]:[e.replace(`border-`,``)];for(let e of c)s.push({property:`border-${e}-width`,value:i}),s.push({property:`border-${e}-style`,value:a}),s.push({property:`border-${e}-color`,value:o});return s}if(e===`list-style`)return t===`none`?[{property:`list-style-type`,value:`none`}]:[{property:`list-style-type`,value:t}];if(e===`text-decoration`){let e=t.trim();if(e===`inherit`||e===`none`)return[{property:`text-decoration-line`,value:`none`}];let n=``,r=e.replace(/\b(rgba?\([^)]*\)|hsla?\([^)]*\))/i,e=>(n=e,``)).split(/\s+/).filter(Boolean),i=[`underline`,`overline`,`line-through`],a=[`solid`,`double`,`dotted`,`dashed`,`wavy`],o=[],s=[];for(let e of r)i.includes(e)?s.push(e):a.includes(e)?o.push({property:`text-decoration-style`,value:e}):e.startsWith(`#`)&&o.push({property:`text-decoration-color`,value:e});return n&&o.push({property:`text-decoration-color`,value:n}),s.length>0&&o.unshift({property:`text-decoration-line`,value:s.join(` `)}),o}if(e===`-webkit-text-stroke`){let e=p(t.trim()),n=e.find(e=>e.endsWith(`px`)||/^\d/.test(e))||`0`,r=e.find(e=>!e.endsWith(`px`)&&!/^\d/.test(e))||`currentColor`;return[{property:`-webkit-text-stroke-width`,value:n},{property:`-webkit-text-stroke-color`,value:r}]}if(e===`flex`){let e=t.trim().split(/\s+/),n=parseFloat(e[0]);return isNaN(n)?[]:[{property:`flex-grow`,value:String(n)}]}return e===`border-collapse`||e===`border-spacing`?[]:[{property:e,value:t}]}function h(e,t,n,r,i,a){let o=e.fontSize||r;switch(t){case`font-family`:e.fontFamily=n.trim();break;case`font-size`:{let t=n.trim();t.endsWith(`em`)?e.fontSize=parseFloat(t)*r:t.endsWith(`%`)?e.fontSize=parseFloat(t)/100*r:e.fontSize=parseFloat(t)||r;break}case`font-weight`:e.fontWeight=d(n);break;case`font-style`:e.fontStyle=n.trim();break;case`color`:e.color=n.trim();break;case`text-align`:e.textAlign=n.trim();break;case`text-align-last`:e.textAlignLast=n.trim();break;case`text-indent`:e.textIndent=u(n,o,i);break;case`text-transform`:e.textTransform=n.trim();break;case`text-decoration-line`:e.textDecorationLine=n.trim();break;case`text-decoration`:break;case`text-decoration-style`:e.textDecorationStyle=n.trim();break;case`text-decoration-color`:e.textDecorationColor=n.trim();break;case`text-shadow`:e.textShadow=n.trim();break;case`-webkit-text-stroke-width`:e.webkitTextStrokeWidth=u(n,o,i);break;case`-webkit-text-stroke-color`:e.webkitTextStrokeColor=n.trim();break;case`-webkit-text-fill-color`:e.webkitTextFillColor=n.trim();break;case`paint-order`:e.paintOrder=n.trim();break;case`-webkit-background-clip`:case`background-clip`:e.webkitBackgroundClip=n.trim();break;case`background-image`:e.backgroundImage=n.trim();break;case`letter-spacing`:e.letterSpacing=n.trim()===`normal`?0:u(n,o,i);break;case`word-spacing`:e.wordSpacing=n.trim()===`normal`?0:u(n,o,i);break;case`font-kerning`:e.fontKerning=n.trim();break;case`line-height`:{let t=n.trim();if(t===`normal`)e.lineHeight=0;else if(t.endsWith(`px`))e.lineHeight=parseFloat(t)||0;else if(t.endsWith(`em`))e.lineHeight=parseFloat(t)*o;else{let n=parseFloat(t);isNaN(n)||(e.lineHeight=n*o,e._lineHeightMultiplier=n)}break}case`vertical-align`:e.verticalAlign=n.trim();break;case`white-space`:e.whiteSpace=n.trim();break;case`word-break`:e.wordBreak=n.trim();break;case`overflow-wrap`:case`word-wrap`:e.overflowWrap=n.trim();break;case`direction`:e.direction=n.trim();break;case`display`:e.display=n.trim();break;case`width`:{let t=n.trim();t===`100%`?e.width=i:t!==`auto`&&(e.width=u(t,o,i));break}case`min-height`:e.minHeight=u(n,o,i);break;case`padding-top`:e.paddingTop=u(n,o,i);break;case`padding-right`:e.paddingRight=u(n,o,i);break;case`padding-bottom`:e.paddingBottom=u(n,o,i);break;case`padding-left`:e.paddingLeft=u(n,o,i);break;case`margin-top`:e.marginTop=u(n,o,i);break;case`margin-right`:e.marginRight=u(n,o,i);break;case`margin-bottom`:e.marginBottom=u(n,o,i);break;case`margin-left`:e.marginLeft=u(n,o,i);break;case`background-color`:e.backgroundColor=n.trim();break;case`background`:{let t=n.trim();t.includes(`gradient(`)?e.backgroundImage=t:(t.startsWith(`#`)||t.startsWith(`rgb`)||t.startsWith(`hsl`)||[`transparent`,`none`,`inherit`].includes(t)||/^[a-z]+$/.test(t))&&(e.backgroundColor=t);break}case`padding-inline-start`:a===`rtl`?e.paddingRight=u(n,o,i):e.paddingLeft=u(n,o,i);break;case`padding-inline-end`:a===`rtl`?e.paddingLeft=u(n,o,i):e.paddingRight=u(n,o,i);break;case`margin-inline-start`:a===`rtl`?e.marginRight=u(n,o,i):e.marginLeft=u(n,o,i);break;case`margin-inline-end`:a===`rtl`?e.marginLeft=u(n,o,i):e.marginRight=u(n,o,i);break;case`border-top-width`:e.borderTopWidth=u(n,o,i);break;case`border-top-color`:e.borderTopColor=n.trim();break;case`border-top-style`:e.borderTopStyle=n.trim();break;case`border-right-width`:e.borderRightWidth=u(n,o,i);break;case`border-right-color`:e.borderRightColor=n.trim();break;case`border-right-style`:e.borderRightStyle=n.trim();break;case`border-bottom-width`:e.borderBottomWidth=u(n,o,i);break;case`border-bottom-color`:e.borderBottomColor=n.trim();break;case`border-bottom-style`:e.borderBottomStyle=n.trim();break;case`border-left-width`:e.borderLeftWidth=u(n,o,i);break;case`border-left-color`:e.borderLeftColor=n.trim();break;case`border-left-style`:e.borderLeftStyle=n.trim();break;case`flex-direction`:e.flexDirection=n.trim();break;case`gap`:e.gap=u(n,o,i);break;case`flex-grow`:e.flexGrow=parseFloat(n)||0;break;case`list-style-type`:e.listStyleType=n.trim();break;case`position`:case`top`:case`left`:case`right`:case`bottom`:case`inset-inline-start`:case`inset-inline-end`:case`content`:case`counter-reset`:case`counter-increment`:case`border-radius`:case`border-top-left-radius`:case`border-top-right-radius`:case`border-bottom-left-radius`:case`border-bottom-right-radius`:case`cursor`:case`opacity`:case`overflow`:case`box-sizing`:case`outline`:case`transition`:case`transform`:case`font-stretch`:case`font-display`:case`src`:case`unicode-range`:break}}var g=[[`font-family`,`fontFamily`],[`font-size`,`fontSize`],[`font-weight`,`fontWeight`],[`font-style`,`fontStyle`],[`color`,`color`],[`text-align`,`textAlign`],[`text-align-last`,`textAlignLast`],[`text-indent`,`textIndent`],[`text-transform`,`textTransform`],[`white-space`,`whiteSpace`],[`word-break`,`wordBreak`],[`overflow-wrap`,`overflowWrap`],[`direction`,`direction`],[`letter-spacing`,`letterSpacing`],[`word-spacing`,`wordSpacing`],[`line-height`,`lineHeight`],[`text-shadow`,`textShadow`],[`font-kerning`,`fontKerning`],[`list-style-type`,`listStyleType`],[`vertical-align`,`verticalAlign`],[`paint-order`,`paintOrder`]];function _(e,t,n){for(let[r,i]of g)if(!n.has(r))if(i===`lineHeight`){let n=t._lineHeightMultiplier;n===void 0?e.lineHeight=t.lineHeight:(e.lineHeight=n*e.fontSize,e._lineHeightMultiplier=n)}else e[i]=t[i]}function v(e){let t=new Map,n=new Map,r=[],i=0;for(let a of e){let e=[];for(let t of a.declarations){let n=t.value.includes(`!important`),r=n?t.value.replace(/\s*!important\s*/g,``).trim():t.value,i=m(t.property,r);for(let t of i)e.push({property:t.property,value:t.value,important:n})}for(let s of a.selectors){let a=o(s);if(!a)continue;let c={selector:a,declarations:e,orderBase:i++},l=a.rightmost;if(l.tag&&!a.rightmostIsRoot){let e=t.get(l.tag);e?e.push(c):t.set(l.tag,[c])}if(l.classes.length>0){let e=l.classes[0],t=n.get(e);t?t.push(c):n.set(e,[c])}!l.tag&&l.classes.length===0&&r.push(c),a.rightmostIsRoot&&r.push(c)}}return{byTag:t,byClass:n,universal:r}}function y(e,t){switch(t){case`disc`:return`•`;case`circle`:return`○`;case`square`:return`■`;case`none`:return``;case`decimal-leading-zero`:return`${e<10&&e>=0?`0`+e:e}.`;case`lower-roman`:return`${b(e).toLowerCase()}.`;case`upper-roman`:return`${b(e)}.`;case`lower-alpha`:case`lower-latin`:return`${x(e).toLowerCase()}.`;case`upper-alpha`:case`upper-latin`:return`${x(e)}.`;default:return`${e}.`}}function b(e){if(e<1||e>3999)return`${e}`;let t=[[1e3,`M`],[900,`CM`],[500,`D`],[400,`CD`],[100,`C`],[90,`XC`],[50,`L`],[40,`XL`],[10,`X`],[9,`IX`],[5,`V`],[4,`IV`],[1,`I`]],n=``;for(let[r,i]of t)for(;e>=r;)n+=i,e-=r;return n}function x(e){if(e<1)return`${e}`;let t=``;for(;e>0;){let n=(e-1)%26;t=String.fromCharCode(65+n)+t,e=Math.floor((e-1)/26)}return t}function S(e,t){if(e.tagName.toLowerCase()!==`li`)return;if(t===`none`)return``;let n=e.parentElement,r=n?.tagName.toLowerCase();if(t===`disc`||t===`circle`||t===`square`)return y(0,t);if(r===`ol`||r===`ul`||!n){let r=n?Array.from(n.children).filter(e=>e.tagName.toLowerCase()===`li`):[e],i=n?.getAttribute(`start`),a=n?.hasAttribute(`reversed`)??!1,o=i?parseInt(i,10):a?r.length:1,s=a?-1:1,c=o;for(let n of r){let r=n.getAttribute(`value`);if(r){let e=parseInt(r,10);Number.isNaN(e)||(c=e)}if(n===e)return y(c,t||`decimal`);c+=s}return y(c,t||`decimal`)}}function C(e){let t=[];for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e===-1)continue;let r=n.slice(0,e).trim().toLowerCase(),i=n.slice(e+1).trim();r&&i&&t.push({property:r,value:i})}return t}function w(e,t,r){let{rules:i,fontFaceRules:a}=n(t),o=null;a.length>0&&(o=document.createElement(`style`),o.textContent=a.join(`
|
|
3
3
|
`),document.head.appendChild(o));let u=v(i),d=document.createElement(`div`);d.appendChild(e);function f(e,t){let n=new Set,r=e.getAttribute(`class`);if(r)for(let e of r.split(/\s+/))e&&n.add(e);return{tagName:e.tagName.toLowerCase(),classes:n,parent:t,el:e}}function p(e,t,n){let i=e.tagName.toLowerCase(),a=f(e,n),o=c(),d=new Set,p=[],v=new Set,y=u.byTag.get(i);if(y)for(let e of y)v.add(e),p.push(e);for(let e of a.classes){let t=u.byClass.get(e);if(t)for(let e of t)v.has(e)||(v.add(e),p.push(e))}for(let e of u.universal)v.has(e)||(v.add(e),p.push(e));let b=[],x=[];for(let e of p)if(s(e.selector,a)){let t=e.selector.pseudoElement===`marker`?x:b;for(let n of e.declarations)t.push({property:n.property,value:n.value,specificity:e.selector.spec,order:e.orderBase,important:n.important})}let w=l[i],T=!1;if(w?.fontSize!==void 0){let e=w.fontSize;e<10?o.fontSize=e*t.fontSize:o.fontSize=e,T=!0,d.add(`font-size`)}b.length>1&&b.sort((e,t)=>{if(e.important!==t.important)return e.important?1:-1;let n=e.specificity,r=t.specificity;return n[0]===r[0]?n[1]===r[1]?n[2]===r[2]?e.order-t.order:n[2]-r[2]:n[1]-r[1]:n[0]-r[0]});for(let e of b)e.property===`font-size`&&(h(o,e.property,e.value,t.fontSize,r,t.direction),T=!0);if(e instanceof HTMLElement&&e.style.cssText){let n=C(e.style.cssText);for(let e of n)e.property===`font-size`&&(h(o,e.property,e.value,t.fontSize,r,t.direction),T=!0)}T||(o.fontSize=t.fontSize);let E=o.fontSize;if(w){for(let[e,t]of Object.entries(w)){if(e===`fontSize`)continue;o[e]=t;let n=e.replace(/[A-Z]/g,e=>`-`+e.toLowerCase());d.add(n)}o.marginTop<0&&(o.marginTop=Math.abs(o.marginTop)*E),o.marginBottom<0&&(o.marginBottom=Math.abs(o.marginBottom)*E),(i===`ul`||i===`ol`)&&(t.direction===`rtl`?(o.paddingRight=40,d.add(`padding-right`)):(o.paddingLeft=40,d.add(`padding-left`)))}let D=t.direction,O={"word-wrap":`overflow-wrap`};for(let e of b)e.property!==`font-size`&&(h(o,e.property,e.value,E,r,D),d.add(O[e.property]||e.property));let k=e instanceof HTMLElement&&!!e.style.width;if(e instanceof HTMLElement&&e.style.cssText){let t=C(e.style.cssText);for(let e of t){if(e.property===`font-size`){d.add(`font-size`);continue}let t=m(e.property,e.value);for(let e of t)h(o,e.property,e.value,E,r,D),d.add(O[e.property]||e.property)}}k||(o.width=0);let A=e.getAttribute(`dir`);A&&(o.direction=A,d.add(`direction`)),d.add(`font-size`),_(o,t,d),d.has(`text-decoration-color`)||(o.textDecorationColor=o.color),d.has(`-webkit-text-stroke-color`)?o.webkitTextStrokeColor===`currentColor`&&(o.webkitTextStrokeColor=o.color):(o.webkitTextStrokeColor===``||o.webkitTextStrokeColor===`currentColor`)&&(o.webkitTextStrokeColor=o.color);for(let e of[`Top`,`Right`,`Bottom`,`Left`]){let t=`border${e}Color`,n=`border-${e.toLowerCase()}-color`;d.has(n)?o[t]===`currentColor`&&(o[t]=o.color):o[t]=o.color}let j=new Set(o.textDecorationLine.split(/\s+/).filter(e=>e&&e!==`none`));if(t.textDecorationLine&&t.textDecorationLine!==`none`)for(let e of t.textDecorationLine.split(/\s+/))e&&e!==`none`&&j.add(e);j.size>0&&(o.textDecorationLine=[...j].join(` `));let M=S(e,o.listStyleType),N,P=!1;if(i===`li`&&x.length>0){x.length>1&&x.sort((e,t)=>{if(e.important!==t.important)return e.important?1:-1;let n=e.specificity,r=t.specificity;return n[0]===r[0]?n[1]===r[1]?n[2]===r[2]?e.order-t.order:n[2]-r[2]:n[1]-r[1]:n[0]-r[0]});let e=[`paddingLeft`,`paddingRight`,`fontSize`,`fontFamily`,`fontWeight`,`fontStyle`,`color`,`letterSpacing`],t={...o},n=new Set;for(let i of x){if(i.property===`content`){let e=i.value.trim().toLowerCase();(e===`none`||e===`""`||e===`''`||e===`normal`)&&(P=e===`none`||e===`""`||e===`''`);continue}let a=e.map(e=>t[e]);h(t,i.property,i.value,E,r,D),e.forEach((e,r)=>{t[e]!==a[r]&&n.add(e)})}if(n.size>0){N={};for(let e of n)N[e]=t[e]}}let F=[];for(let t of e.childNodes){let e=g(t,o,a);e&&F.push(e)}return{element:e,tagName:i,style:o,children:F,textContent:null,listMarker:M,markerStyle:N,markerHidden:P||void 0}}function g(e,t,n){if(e.nodeType===Node.TEXT_NODE){let n=e.textContent;if(!n)return null;if(n.trim()===``&&!n.includes(`\xA0`)){let r=t.whiteSpace,i=e.previousSibling,a=e.nextSibling,o=e=>{if(!e||e.nodeType!==Node.ELEMENT_NODE)return e?.nodeType===Node.TEXT_NODE;let t=l[e.tagName.toLowerCase()]?.display||`block`;return t===`inline`||t===`inline-block`};if(i&&a&&!o(i)&&!o(a)&&!(r===`pre`||r===`pre-wrap`||r===`pre-line`)||r!==`pre`&&r!==`pre-wrap`&&r!==`pre-line`&&n.includes(`
|
|
4
4
|
`))return null}let r={...t},i=t.whiteSpace,a=n;return i!==`pre`&&i!==`pre-wrap`&&i!==`pre-line`&&i!==`break-spaces`&&(a=n.replace(/[\n\r]/g,` `)),{element:null,tagName:`#text`,style:r,children:[],textContent:a}}if(e.nodeType!==Node.ELEMENT_NODE)return null;let r=e,i=r.tagName.toLowerCase();return i===`style`||i===`script`?null:i===`br`?{element:null,tagName:`#text`,style:{...t},children:[],textContent:`
|
|
5
|
-
`}:p(r,t,n)}return{tree:p(d,c(),null),cleanup:()=>{o&&o.remove()}}}var T=!0,E,D=new Map;function
|
|
5
|
+
`}:p(r,t,n)}return{tree:p(d,c(),null),cleanup:()=>{o&&o.remove()}}}var T=!0,E,D=[],O=new Map;function k(e,t){let n=e.font+`\0`+t,r=O.get(n);if(r!==void 0)return r;let i=e.measureText(t).width;return O.set(n,i),i}function A(e){let t=``;for(let n of e){if(!n.text||n.isSpace)continue;let e=N(n.style);if(t&&e!==t)return!0;t=e}return!1}function j(e,t){e.font=N(t),e.fontKerning=t.fontKerning===`none`?`none`:`normal`}var M=new Map;function N(e){let t=`${e.fontStyle}|${e.fontWeight}|${e.fontSize}|${e.fontFamily}`,n=M.get(t);if(n)return n;let r=[];e.fontStyle!==`normal`&&r.push(e.fontStyle),e.fontWeight!==400&&r.push(String(e.fontWeight)),r.push(`${e.fontSize}px`),r.push(e.fontFamily);let i=r.join(` `);return M.set(t,i),i}var P=new Map,F=null,I=null,L=null,R=new Set([`disc`,`circle`,`square`]);function ee(e,t,n=!1){let r=`${e}|${t}|${n?`ul-li`:`block`}`,i=P.get(r);if(i!==void 0)return i;let a;n?(I||(I=document.createElement(`ul`),I.style.cssText=`position:absolute;top:-9999px;left:-9999px;visibility:hidden;padding:0;margin:0;border:0;list-style:disc;`,L=document.createElement(`li`),L.style.cssText=`white-space:nowrap;padding:0;margin:0;border:0;`,L.textContent=`Mg`,I.appendChild(L),document.body.appendChild(I)),a=L):(F||(F=document.createElement(`div`),F.style.cssText=`position:absolute;top:-9999px;left:-9999px;visibility:hidden;white-space:nowrap;padding:0;margin:0;border:0;`,F.textContent=`Mg`,document.body.appendChild(F)),a=F),a.style.font=e,a.style.lineHeight=t;let o=a.getBoundingClientRect().height;return P.set(r,o),o}function z(e,t,n=!1){if(t.lineHeight>0)return T?ee(N(t),`${t.lineHeight}px`,n):t.lineHeight;if(T)return ee(N(t),`normal`,n);let{ascent:r,descent:i}=W(e,t);return r+i}function te(e,t,n){let{ascent:r,descent:i}=W(e,t);return(r-i)/2+n/2}function B(e,t){switch(t){case`uppercase`:return e.toUpperCase();case`lowercase`:return e.toLowerCase();case`capitalize`:return e.replace(/(^|[\s\p{P}])(\p{L})/gu,(e,t,n)=>t+n.toUpperCase());default:return e}}function V(e){if(e.tagName===`#text`)return!0;let t=e.style.display;return t===`inline`||t===`inline-block`}function ne(e){return e.children.length>0&&e.children.every(V)}function H(e){return!e||e===`transparent`||e===`rgba(0, 0, 0, 0)`}var U=new Map;function W(e,t){let n=N(t),r=U.get(n);if(r)return r;e.font=n;let i=e.measureText(`M`),a={ascent:i.fontBoundingBoxAscent??i.actualBoundingBoxAscent,descent:i.fontBoundingBoxDescent??i.actualBoundingBoxDescent};return U.set(n,a),a}function G(e,t){return e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontStyle===t.fontStyle&&e.color===t.color&&e.textDecorationLine===t.textDecorationLine&&e.backgroundColor===t.backgroundColor}function K(e){return!H(e.backgroundColor)||e.borderTopWidth>0&&e.borderTopStyle!==`none`||e.borderRightWidth>0&&e.borderRightStyle!==`none`||e.borderBottomWidth>0&&e.borderBottomStyle!==`none`||e.borderLeftWidth>0&&e.borderLeftStyle!==`none`}function re(e){let t=[];function n(e,r){if(e.tagName===`#text`&&e.textContent){t.push({text:e.textContent,style:e.style,boxStyle:r});return}let i=e.style.display===`inline-block`,a=i||V(e)&&K(e.style),o=a?e.style:r,s=a&&(e.style.paddingLeft>0||e.style.paddingRight>0||e.style.borderLeftWidth>0||e.style.borderRightWidth>0);if(i){let n=e.element?.textContent||``;t.push({text:n,style:e.style,boxStyle:o,boxOpen:e.style,boxClose:e.style});return}s&&t.push({text:``,style:e.style,boxStyle:o,boxOpen:e.style});for(let t of e.children)n(t,a?o:r);s&&t.push({text:``,style:e.style,boxStyle:o,boxClose:e.style})}for(let t of e.children)n(t);return t}function ie(e){for(let t=0;t<e.length;t++){let n=e.codePointAt(t);if(n>=3584&&n<=3711||n>=3712&&n<=3839||n>=4096&&n<=4255||n>=6016&&n<=6143)return!0;n>65535&&t++}return!1}var q;function ae(){return q||(typeof Intl<`u`&&Intl.Segmenter?(q=new Intl.Segmenter(void 0,{granularity:`word`}),q):null)}function J(e,t,n,r,i){if(t.includes(``)||t.includes(``)){let a=t.split(/(\u200B|\u00AD)/),o=i??{cumText:``,cumWidth:0},s=!1;for(let t of a){if(t===``){s=!0;continue}if(t===``||t===``){s=!1;continue}let i=r.length;J(e,t,n,r,o),s&&i>0&&(r[i-1].isSoftHyphenBreak=!0),s=!1}s&&r.length>0&&(r[r.length-1].isSoftHyphenBreak=!0);return}if(n.style.whiteSpace===`pre`||n.style.whiteSpace===`pre-wrap`||n.style.whiteSpace===`break-spaces`){let i=t.split(/( +|\t)/),a=k(e,` `)*8;for(let t of i){if(t===``)continue;if(t===` `){r.push({text:` `,width:a,style:n.style,isSpace:!0,isTab:!0,boxStyle:n.boxStyle});continue}let i=/^ +$/.test(t);r.push({text:t,width:k(e,t),style:n.style,isSpace:i,boxStyle:n.boxStyle})}}else{let a=t.split(/([ \t\n\r\f\v]+)/),o=i?.cumText??``,s=i?.cumWidth??0;for(let t of a){if(t===``)continue;if(/^[ \t\n\r\f\v]+$/.test(t)){let t=s;o+=` `,s=e.measureText(o).width;let i=s-t+(n.style.wordSpacing||0);r.push({text:` `,width:i,style:n.style,isSpace:!0,boxStyle:n.boxStyle});continue}if(ie(t)){let i=ae();if(i){for(let a of i.segment(t)){let t=a.segment,i=s;o+=t,s=e.measureText(o).width,r.push({text:t,width:s-i,style:n.style,isSpace:!1,boxStyle:n.boxStyle})}continue}}let i=s;o+=t,s=e.measureText(o).width;let a=s-i,c=k(e,t);E&&E({type:`measure-word`,message:`"${t}" delta=${a.toFixed(2)} direct=${c.toFixed(2)} diff=${(a-c).toFixed(2)} cumText="${o}"`,data:{text:t,deltaWidth:a,directWidth:c,cumWidth:s,prevCum:i,font:n.style.fontFamily,fontSize:n.style.fontSize}}),r.push({text:t,width:a,style:n.style,isSpace:!1,boxStyle:n.boxStyle})}i&&(i.cumText=o,i.cumWidth=s)}}function oe(e,t){let n=[];for(let r of t){if(r.text===``&&!r.boxOpen&&!r.boxClose){let e=r.style.display===`inline-block`&&(r.style.marginLeft||r.style.marginRight)||0;e>0&&n.push({text:``,width:e,style:r.style,isSpace:!1,boxStyle:r.boxStyle});continue}if(r.boxOpen&&r.boxClose&&r.text){j(e,r.style),e.letterSpacing=r.style.letterSpacing>0?`${r.style.letterSpacing}px`:`0px`;let t=B(r.text,r.style.textTransform),i=r.style,a=k(e,t),o=i.marginLeft+i.borderLeftWidth+i.paddingLeft+a+i.paddingRight+i.borderRightWidth+i.marginRight;n.push({text:t,width:o,style:r.style,isSpace:!1,boxStyle:r.boxStyle,boxOpen:r.boxOpen,boxClose:r.boxClose});continue}if(r.boxOpen){let e=r.boxOpen.paddingLeft+r.boxOpen.borderLeftWidth;e>0&&n.push({text:``,width:e,style:r.style,isSpace:!1,boxStyle:r.boxStyle,boxOpen:r.boxOpen});continue}if(r.boxClose){let e=r.boxClose.paddingRight+r.boxClose.borderRightWidth;e>0&&n.push({text:``,width:e,style:r.style,isSpace:!1,boxStyle:r.boxStyle,boxClose:r.boxClose});continue}j(e,r.style),e.letterSpacing=r.style.letterSpacing>0?`${r.style.letterSpacing}px`:`0px`;let t=B(r.text,r.style.textTransform);if(t.includes(`
|
|
6
6
|
`)){let i=t.split(`
|
|
7
7
|
`);for(let t=0;t<i.length;t++)t>0&&n.push({text:`
|
|
8
|
-
`,width:0,style:r.style,isSpace:!1,boxStyle:r.boxStyle}),i[t]&&J(e,i[t],r,n)}else J(e,t,r,n)}return n}function Y(e){let t=e.codePointAt(0)||0;return t>=19968&&t<=40959||t>=13312&&t<=19903||t>=12288&&t<=12351||t>=12352&&t<=12447||t>=12448&&t<=12543||t>=44032&&t<=55215||t>=65280&&t<=65519||t>=131072&&t<=173791}function
|
|
9
|
-
`){s.words.length===0?(s.lineHeight=t,s.endedByHardBreak=!0,o.push(s),s={words:[],totalWidth:0,lineHeight:0}):(s.endedByHardBreak=!0,f()),p=!0;continue}if(c){s.words.push(r),s.totalWidth+=r.width,s.lineHeight=Math.max(s.lineHeight,t);continue}let a=!r.isSpace&&r.text.length>1?oe(e,r,l(),s.totalWidth):[r];for(let r of a){let i=!r.isSpace&&r.text.length>0&&/^[,.\;:!?\)\]\}'"»›]+$/.test(r.text)&&s.words.length>0&&!s.words[s.words.length-1].isSpace;if(!r.isSpace&&!i&&s.words.length>0&&s.totalWidth+r.width>l()){let i=s.totalWidth+r.width-l(),a=!0;if(i<1&&!k([...s.words,r])&&(A(e,r.style),O(e,s.words.map(e=>e.text).join(``)+r.text)<=l()+.1&&(a=!1)),a&&r.text.includes(`-`)){let n=r.text.split(/(?<=-)/);if(n.length>1){A(e,r.style);let i=``,a=0,o=0,c=l()-s.totalWidth;for(;o<n.length;o++){let t=i+n[o],r=O(e,t);if(r>c)break;i=t,a=r}if(o>0&&o<n.length){s.words.push({...r,text:i,width:a}),s.totalWidth+=a,s.lineHeight=Math.max(s.lineHeight,t),f(!0),p=!1;let c=n.slice(o).join(``),l=O(e,c);s.words.push({...r,text:c,width:l}),s.totalWidth+=l,s.lineHeight=Math.max(s.lineHeight,t);continue}}}if(a){if(E){let e=s.words.map(e=>e.text).join(``);E({type:`line-wrap`,message:`"${r.text}" overflow=${i.toFixed(2)} wrap=true lineWidth=${s.totalWidth.toFixed(2)} pieceWidth=${r.width.toFixed(2)} contentWidth=${n} line="${e}"`,data:{text:r.text,overflow:i,lineWidth:s.totalWidth,pieceWidth:r.width,contentWidth:n,lineText:e}})}f(!0),p=!1}}if(r.isSpace&&s.words.length===0&&(!p||!d))continue;let a=r.width;if(r.isTab){let e=r.width,t=s.totalWidth;a=Math.ceil((t+.1)/e)*e-t,r.width=a}if(s.words.length===0&&a>l()&&!r.isSpace&&r.text.includes(`-`)){let n=r.text.split(/(?<=-)/);if(n.length>1){A(e,r.style);let i=n.filter(e=>e).map(t=>({...r,text:t,width:O(e,t)})),a=!0;for(let e of i)a?(a=!1,s.words.push(e),s.totalWidth+=e.width,s.lineHeight=Math.max(s.lineHeight,t)):s.totalWidth+e.width>l()?(f(!0),p=!1,s.words.push(e),s.totalWidth+=e.width,s.lineHeight=Math.max(s.lineHeight,t)):(s.words.push(e),s.totalWidth+=e.width,s.lineHeight=Math.max(s.lineHeight,t));continue}}s.words.push(r),s.totalWidth+=a,s.lineHeight=Math.max(s.lineHeight,t),r.isSpace||(p=!1)}}return f(),o}function X(e,t,n,r,i,a=!1){let o=[],s=ne(t);if(s.length===0)return{nodes:o,height:0};let c=ae(e,s),l=t.style.textIndent||0,u=se(e,c,i,t.style.whiteSpace,a,l),d=t.style.direction===`rtl`,f=e=>e===`start`?d?`right`:`left`:e===`end`?d?`left`:`right`:e,p=f(t.style.textAlign),m=t.style.textAlignLast||`auto`;m=m===`auto`?t.style.textAlign===`justify`?d?`right`:`left`:p:f(m);let h=r;for(let t=0;t<u.length;t++){let r=u[t];if(r.words.length===0){h+=r.lineHeight;continue}let a=r.lineHeight,s=t===u.length-1,c=t===0,f=s||r.endedByHardBreak?m:p,g=c?l:0,_=i-g,v=0;if(f===`justify`&&r.totalWidth<_){let e=r.words.filter(e=>e.isSpace).length;e>0&&(v=(_-r.totalWidth)/e)}let y=n+g;f===`center`?y=n+g+(_-r.totalWidth)/2:(f===`right`||f!==`justify`&&d||d)&&(y=n+g+_-r.totalWidth);let b=0,x=0;for(let t of r.words){if(t.text===``)continue;let n=t.style.verticalAlign;if(n===`super`||n===`sub`)continue;let{ascent:r,descent:i}=W(e,t.style);r>b&&(b=r),i>x&&(x=i)}if(b===0)for(let t of r.words){if(t.text===``)continue;let{ascent:n,descent:r}=W(e,t.style);b=n,x=r;break}let S=b+x,C=h+(a-S)/2+b,w=r.words.filter(e=>e.text!==``&&e.style.verticalAlign!==`super`&&e.style.verticalAlign!==`sub`),T=w.length>0?Math.max(...w.map(e=>e.style.fontSize)):0,E=a;{let t=h,n=h+a;for(let i of r.words){if(i.text===``)continue;let r=i.style.verticalAlign;if(r!==`super`&&r!==`sub`)continue;if(T===0)break;let{ascent:a,descent:o}=W(e,i.style),s=C;r===`super`?s-=T*.4:s+=T*.26;let c=s-a,l=s+o;c<t&&(t=c),l>n&&(n=l)}E=n-t}let D=(t,n,r)=>{let{ascent:i,descent:a}=W(e,t),s=t.paddingTop+t.borderTopWidth,c=t.paddingBottom+t.borderBottomWidth,l=i+a+s+c,u;u=t.display===`inline-block`?h+t.marginTop:C-i-s,o.push({type:`box`,style:t,x:n,y:u,width:r,height:l,tagName:`span`,children:[]})};if(!d){let e=y,t=e,n,i=!1;for(let a of r.words){if(a.boxOpen&&a.boxClose&&a.text){n&&(i&&D(n,t,e-t),n=void 0,i=!1);let r=a.style,o=a.width-r.marginLeft-r.borderLeftWidth-r.paddingLeft-r.paddingRight-r.borderRightWidth-r.marginRight;D(r,e+r.marginLeft,r.borderLeftWidth+r.paddingLeft+o+r.paddingRight+r.borderRightWidth),i=!1,e+=a.width;continue}a.boxStyle!==n&&(n&&i&&D(n,t,e-t),n=a.boxStyle,t=e,i=!1),a.text&&!a.isSpace&&(i=!0),e+=a.width+(a.isSpace?v:0)}n&&i&&D(n,t,e-t)}let k=r.words.filter(e=>e.text!==``),j=k.length>0&&k.every(e=>G(e.style,k[0].style));if(d){let t=[],n=null,i=0;for(let e of r.words){if(e.text===``){n&&=(t.push(n),null),i+=e.width;continue}n&&G(n.style,e.style)?(n.text+=e.text,n.width+=e.width):(n&&t.push(n),n={text:e.text,style:e.style,width:e.width,boxStyle:e.boxStyle,x:0,padBefore:i},i=0)}n&&t.push(n);let a=y+r.totalWidth;for(let n of t){a-=n.padBefore,A(e,n.style);let t=O(e,n.text);a-=t,n.x=a,n.width=t}for(let e of t)if(e.boxStyle&&K(e.boxStyle)){let t=e.boxStyle,n=t.paddingLeft+t.borderLeftWidth,r=t.paddingRight+t.borderRightWidth;D(t,e.x-n,e.width+n+r)}for(let e of t)o.push({type:`text`,text:e.text,x:e.x+e.width,y:C,width:e.width,style:{...e.style,direction:`rtl`}})}else{let t=r.words.map(e=>e.text).join(``);if(j&&/[\u0590-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/.test(t)&&!r.words.some(e=>e.boxOpen||e.boxClose||e.style.verticalAlign===`super`||e.style.verticalAlign===`sub`)){A(e,k[0].style);let n=O(e,t);o.push({type:`text`,text:t,x:y,y:C,width:n,style:k[0].style})}else for(let t of r.words){if(t.text===``){y+=t.width;continue}if(t.boxOpen&&t.boxClose){let n=t.style,r=y+n.marginLeft+n.borderLeftWidth+n.paddingLeft;o.push({type:`text`,text:t.text,x:r,y:C,width:O(e,t.text),style:t.style}),y+=t.width;continue}let n=C,r=t.style.verticalAlign;if(r===`super`||r===`sub`){let e=T||t.style.fontSize;r===`super`?n-=e*.4:n+=e*.26}let i=t.width+(t.isSpace?v:0);o.push({type:`text`,text:t.text,x:y,y:n,width:i,style:t.style}),y+=i}}h+=E}return{nodes:o,height:h-r}}function ce(e,t){return e>=0&&t>=0?Math.max(e,t):e<0&&t<0?Math.min(e,t):e+t}function Z(e,t,n,r,i){let a=t.style,o=a.marginLeft,s=a.marginRight,c=a.borderLeftWidth,l=a.borderRightWidth,u=a.borderTopWidth,d=a.borderBottomWidth,f=a.paddingLeft,p=a.paddingRight,m=a.paddingTop,h=a.paddingBottom,g=n+o,_=a.width>0?a.width:i-o-s,v=g+c+f,y=Math.max(0,_-c-l-f-p),b=r,x=b+u+m,S={type:`box`,style:a,x:g,y:b,width:_,height:0,tagName:t.tagName,children:[],listMarker:t.listMarker};if(a.display===`flex`){let n=ue(e,t,v,x,y);return S.children=n.children,S.height=u+m+n.height+h+d,{box:S,height:S.height,marginBottomOut:a.marginBottom}}if(a.display===`table`){let n=le(e,t,v,x,y);return S.children=n.children,S.height=u+m+n.height+h+d,{box:S,height:S.height,marginBottomOut:a.marginBottom}}if(t.children.length===0)return S.height=u+m+h+d,a.minHeight>0&&(S.height=Math.max(S.height,a.minHeight)),{box:S,height:S.height,marginBottomOut:a.marginBottom};if(te(t)){let{nodes:n,height:r}=X(e,t,v,x,y,t.tagName===`li`&&L.has(a.listStyleType));S.children=n,S.height=u+m+r+h+d}else{let n=x,r=0,i=!1,o=t.tagName===`li`||t.tagName===`ul`||t.tagName===`ol`||t.tagName===`dd`||t.tagName===`dt`;for(let s=0;s<t.children.length;s++){let c=t.children[s];if(c.tagName===`#text`||V(c)){let o=[c];for(;s+1<t.children.length;){let e=t.children[s+1];if(e.tagName===`#text`||V(e))o.push(e),s++;else break}r>0&&(n+=r,r=0);let l={element:null,tagName:`div`,style:{...t.style,display:`block`,marginTop:0,marginBottom:0,paddingTop:0,paddingBottom:0,borderTopWidth:0,borderBottomWidth:0},children:o,textContent:null},u=t.tagName===`li`&&L.has(a.listStyleType),{nodes:d,height:f}=X(e,l,v,n,y,u);S.children.push(...d),n+=f,r=0,i=!0;continue}let l=c.style.marginTop;if(!(!i&&m===0&&u===0&&o)){let e=ce(r,l);n+=e}let{box:d,height:f,marginBottomOut:p}=Z(e,c,v,n,y);S.children.push(d),n+=f,r=p,i=!0}let s=a.marginBottom,c=h===0&&d===0&&o;c&&r>0&&(s=Math.max(a.marginBottom,r));let l=n-x;return!c&&r>0&&(l+=r),S.height=u+m+l+h+d,a.minHeight>0&&(S.height=Math.max(S.height,a.minHeight)),{box:S,height:S.height,marginBottomOut:s}}return a.minHeight>0&&(S.height=Math.max(S.height,a.minHeight)),{box:S,height:S.height,marginBottomOut:a.marginBottom}}function le(e,t,n,r,i){let a=[],o=[];for(let e of t.children)if(e.tagName===`tr`)o.push(e);else if([`thead`,`tbody`,`tfoot`].includes(e.tagName))for(let t of e.children)t.tagName===`tr`&&o.push(t);if(o.length===0)return{children:a,height:0};let s=Math.max(...o.map(e=>e.children.filter(e=>e.tagName===`td`||e.tagName===`th`).length));if(s===0)return{children:a,height:0};let c=i/s,l=r;for(let t of o){let r=t.children.filter(e=>e.tagName===`td`||e.tagName===`th`),i=0,o=[];for(let t=0;t<r.length;t++){let a=r[t],{box:s,height:u}=Z(e,a,n+t*c,l,c);o.push(s),i=Math.max(i,u)}for(let e of o)e.height=i,a.push(e);l+=i}return{children:a,height:l-r}}function ue(e,t,n,r,i){let a=t.style,o=a.gap,s=[],c=t.children.filter(e=>e.tagName!==`#text`||e.textContent?.trim());if(c.length===0)return{children:s,height:0};if(a.flexDirection===`row`||a.flexDirection===``){let t=o*(c.length-1),a=c.reduce((e,t)=>e+(t.style.flexGrow||0),0),l=(i-t)/(a||c.length),u=n,d=0;for(let t of c){if(t.tagName===`#text`)continue;let n=l*(t.style.flexGrow||(a===0?1:0)),{box:i,height:c}=Z(e,t,u,r,n);s.push(i),d=Math.max(d,c),u+=n+o}return{children:s,height:d}}let l=r;for(let t of c){if(t.tagName===`#text`)continue;let{box:r,height:a}=Z(e,t,n,l,i);s.push(r),l+=a+o}return{children:s,height:l-r}}function de(e,t,n){if(!n.listMarker||n.markerHidden)return;let r=n.style,i=n.markerStyle,a=i?{...r,...i}:r;e.font=M(a);let o=z(e,r),s=t.y+r.borderTopWidth+r.paddingTop+ee(e,r,o),c=O(e,n.listMarker),l=r.direction===`rtl`,u=l?i?.paddingLeft:i?.paddingRight,d=u===void 0?a.fontSize*.15:u,f,p=`ltr`;if(l){let e=t.x+t.width;/\d/.test(n.listMarker)?(p=`rtl`,f=e+d+c):f=e+d}else f=t.x+r.borderLeftWidth+r.paddingLeft-c-d;t.children.unshift({type:`text`,text:n.listMarker,x:f,y:s,width:c,style:{...a,textDecorationLine:`none`,fontWeight:i?.fontWeight??400,fontStyle:i?.fontStyle??`normal`,direction:p}})}function fe(e,t,n,r=!0,i){T=r,E=i,N.clear(),U.clear(),j.clear(),D.clear();let{box:a,height:o}=Z(e,t,0,0,n);return Q(e,a,t),{root:a,height:o}}function Q(e,t,n){de(e,t,n);let r=0;for(let i of n.children)if(!(i.tagName===`#text`||V(i)))for(;r<t.children.length;){let n=t.children[r];if(n.type===`box`&&n.tagName===i.tagName){Q(e,n,i),r++;break}r++}}function pe(e){if(!e||e===`none`)return[];let t=[],n=e.split(/,(?![^(]*\))/);for(let e of n){let n=e.trim(),r=n.match(/(rgb[a]?\([^)]+\)|#[0-9a-fA-F]+|\b[a-z]+\b)(?:\s|$)/i),i=n.match(/-?[\d.]+px/g);if(i&&i.length>=2){let e=i.map(e=>parseFloat(e));t.push({offsetX:e[0],offsetY:e[1],blur:e[2]||0,color:r?r[1]:`rgba(0,0,0,1)`})}}return t}function me(e,t){return e[`border${t}Width`]>0&&e[`border${t}Style`]!==`none`}function $(e,t,n,r,i,a,o){if(e.save(),e.strokeStyle=o,e.lineWidth=i,a===`double`){let a=Math.max(i,2);e.lineWidth=Math.max(.5,i*.5),e.beginPath(),e.moveTo(t,n-a/2),e.lineTo(t+r,n-a/2),e.moveTo(t,n+a/2),e.lineTo(t+r,n+a/2),e.stroke()}else if(a===`wavy`){let a=Math.max(1.5,i),o=a*4;e.beginPath(),e.moveTo(t,n);for(let i=t;i<t+r;i+=o)e.quadraticCurveTo(i+o/4,n-a,i+o/2,n),e.quadraticCurveTo(i+o*3/4,n+a,i+o,n);e.stroke()}else a===`dotted`?e.setLineDash([i,i*2]):a===`dashed`&&e.setLineDash([i*3,i*2]),e.beginPath(),e.moveTo(t,n),e.lineTo(t+r,n),e.stroke();e.setLineDash([]),e.restore()}function he(e,t,n,r,i,a){let o=t.indexOf(`linear-gradient(`);if(o===-1)return null;let s=0,c=-1;for(let e=o+16;e<t.length;e++)if(t[e]===`(`)s++;else if(t[e]===`)`){if(s===0){c=e;break}s--}if(c===-1)return null;let l=t.slice(o+16,c),u=[];s=0;let d=0,f=l;for(let e=0;e<f.length;e++)f[e]===`(`?s++:f[e]===`)`?s--:f[e]===`,`&&s===0&&(u.push(f.slice(d,e).trim()),d=e+1);u.push(f.slice(d).trim());let p=180,m=0,h=u[0];h.endsWith(`deg`)?(p=parseFloat(h),m=1):h===`to right`?(p=90,m=1):h===`to left`?(p=270,m=1):h===`to bottom`?(p=180,m=1):h===`to top`&&(p=0,m=1);let g=(p-90)*Math.PI/180,_=n+r/2,v=i+a/2,y=Math.abs(r*Math.cos(g))+Math.abs(a*Math.sin(g)),b=Math.cos(g)*y/2,x=Math.sin(g)*y/2,S=e.createLinearGradient(_-b,v-x,_+b,v+x),C=u.slice(m);for(let e=0;e<C.length;e++){let t=C[e].trim(),n=t,r=e/Math.max(1,C.length-1),i=t.match(/\s+([\d.]+%)\s*$/);i&&(r=parseFloat(i[1])/100,n=t.slice(0,t.length-i[0].length).trim());try{S.addColorStop(r,n)}catch{}}return S}function ge(e,t,n){let{style:r}=t;e.save(),e.font=M(r),e.textBaseline=`alphabetic`,e.fontKerning=r.fontKerning===`none`?`none`:`normal`,r.letterSpacing>0&&(e.letterSpacing=`${r.letterSpacing}px`),r.wordSpacing&&(e.wordSpacing=`${r.wordSpacing}px`),r.direction===`rtl`&&(e.direction=`rtl`,e.textAlign=`right`);let i=r.webkitBackgroundClip===`text`&&r.backgroundImage&&r.backgroundImage!==`none`,a=r.webkitTextStrokeWidth>0,o=r.webkitTextFillColor===`transparent`||r.color===`transparent`,s=pe(r.textShadow);if(s.length>0)for(let n of s)e.save(),e.shadowOffsetX=n.offsetX,e.shadowOffsetY=n.offsetY,e.shadowBlur=n.blur,e.shadowColor=n.color,e.fillStyle=r.color,e.fillText(t.text,t.x,t.y),e.restore();let c=()=>{if(i){if(e.save(),n)e.fillStyle=n;else{let{ascent:n,descent:i}=W(e,r);e.fillStyle=he(e,r.backgroundImage,t.x,t.width,t.y-n,n+i)||r.color}e.fillText(t.text,t.x,t.y),e.restore()}else (!o||!a)&&(e.fillStyle=r.webkitTextFillColor&&r.webkitTextFillColor!==`transparent`?r.webkitTextFillColor:r.color,e.fillText(t.text,t.x,t.y))},l=()=>{a&&(e.save(),e.strokeStyle=r.webkitTextStrokeColor||r.color,e.lineWidth=r.webkitTextStrokeWidth,e.lineJoin=`round`,e.strokeText(t.text,t.x,t.y),e.restore())};f(r.paintOrder)?(l(),c()):(c(),l());let u=t.width,d=r.fontSize,p=r.textDecorationColor||r.color,m=r.textDecorationStyle||`solid`,h=Math.max(1,d/15),g=r.direction===`rtl`?t.x-u:t.x;if(r.textDecorationLine!==`none`){let{ascent:n}=W(e,r);e.font=M(r);let i=e.measureText(`x`).actualBoundingBoxAscent;if(r.textDecorationLine.includes(`underline`)){let n=d*.1;$(e,g,t.y+n,u,h,m,p)}if(r.textDecorationLine.includes(`line-through`)){let n=-(i*.5);$(e,g,t.y+n,u,h,m,p)}r.textDecorationLine.includes(`overline`)&&$(e,g,t.y-n,u,h,m,p)}e.restore()}function _e(e,t){let{style:n}=t;H(n.backgroundColor)||(e.fillStyle=n.backgroundColor,e.fillRect(t.x,t.y,t.width,t.height));let r=[[`Top`,t.x,t.y+n.borderTopWidth/2,t.x+t.width,t.y+n.borderTopWidth/2],[`Right`,t.x+t.width-n.borderRightWidth/2,t.y,t.x+t.width-n.borderRightWidth/2,t.y+t.height],[`Bottom`,t.x,t.y+t.height-n.borderBottomWidth/2,t.x+t.width,t.y+t.height-n.borderBottomWidth/2],[`Left`,t.x+n.borderLeftWidth/2,t.y,t.x+n.borderLeftWidth/2,t.y+t.height]];for(let[t,i,a,o,s]of r)me(n,t)&&(e.strokeStyle=n[`border${t}Color`],e.lineWidth=n[`border${t}Width`],e.beginPath(),e.moveTo(i,a),e.lineTo(o,s),e.stroke());let i=null;n.webkitBackgroundClip===`text`&&n.backgroundImage&&n.backgroundImage!==`none`&&(i=he(e,n.backgroundImage,t.x,t.width,t.y,t.height));for(let n of t.children)ve(e,n,i)}function ve(e,t,n){t.type===`text`?ge(e,t,n):_e(e,t)}function ye(e){let t=[];function n(e){if(e.type===`text`&&e.text.trim()&&t.push({y:e.y,fontSize:e.style.fontSize,text:e.text}),e.type===`box`)for(let t of e.children)n(t)}n(e),t.sort((e,t)=>e.y-t.y);let r=[],i=0;for(let e of t){let t=r[r.length-1],n=Math.max(i,e.fontSize)*.5;t&&Math.abs(e.y-t.y)<n?(t.text+=e.text,i=Math.max(i,e.fontSize)):(r.push({y:Math.round(e.y),text:e.text}),i=e.fontSize)}return r}function be(e){let{html:n,width:r,height:i,accuracy:a=`performance`,debug:o}=e;if(!r||r<=0||Number.isNaN(r))throw TypeError(`layout: width must be a positive number, got ${r}`);let s=a===`balanced`,{fragment:c,css:l}=t(n),{tree:u,cleanup:d}=w(c,l,r),f=document.createElement(`canvas`).getContext(`2d`);f.fontKerning=`normal`;let{root:p,height:m}=fe(f,u,r,s,o),h=i||m,g=ye(p);return d(),{layoutRoot:p,height:h,lines:g}}function xe(e){let{layout:t,width:n,pixelRatio:r=globalThis.devicePixelRatio??1}=e;if(e.ctx&&e.canvas)throw TypeError(`drawLayout: ctx and canvas are mutually exclusive — provide one or neither`);let i=t.height,a,o;return e.ctx?(o=e.ctx,a=e.ctx.canvas):(a=e.canvas??document.createElement(`canvas`),a.width=Math.ceil(n*r),a.height=Math.ceil(i*r),`style`in a&&(a.style.width=`${n}px`,a.style.height=`${i}px`),o=a.getContext(`2d`),o.scale(r,r)),ve(o,t.layoutRoot),{canvas:a}}function Se(e){if(e.ctx&&e.canvas)throw TypeError(`render: ctx and canvas are mutually exclusive — provide one or neither`);let t=be({html:e.html,width:e.width,height:e.height,accuracy:e.accuracy,debug:e.debug}),{canvas:n}=xe({layout:t,width:e.width,ctx:e.ctx,canvas:e.canvas,pixelRatio:e.pixelRatio});return{canvas:n,height:t.height,layoutRoot:t.layoutRoot,lines:t.lines}}e.drawLayout=xe,e.layout=be,e.render=Se});
|
|
8
|
+
`,width:0,style:r.style,isSpace:!1,boxStyle:r.boxStyle}),i[t]&&J(e,i[t],r,n)}else J(e,t,r,n)}return n}function Y(e){let t=e.codePointAt(0)||0;return t>=19968&&t<=40959||t>=13312&&t<=19903||t>=12288&&t<=12351||t>=12352&&t<=12447||t>=12448&&t<=12543||t>=44032&&t<=55215||t>=65280&&t<=65519||t>=131072&&t<=173791}function se(e,t,n,r){let i=[...t.text].some(Y),a=t.width>n&&(t.style.overflowWrap===`break-word`||t.style.wordBreak===`break-all`);if(!i&&!a)return[t];e.font=N(t.style);let o=[...t.text],s=[],c=``,l=0;for(let r of o){if(Y(r)){c&&(s.push({...t,text:c,width:l}),c=``,l=0);let n=k(e,r);s.push({...t,text:r,width:n});continue}let i=c+r,o=k(e,i);if(a&&o>n&&c){s.push({...t,text:c,width:l}),c=r,l=k(e,r);continue}c=i,l=o}return c&&s.push({...t,text:c,width:l}),s}function ce(e,t,n,r,i=!1,a=0){let o=[],s={words:[],totalWidth:0,lineHeight:0},c=r===`nowrap`||r===`pre`,l=()=>n-(o.length===0?a:0),u=r===`pre-wrap`||r===`pre`||r===`pre-line`,d=r===`pre`||r===`pre-wrap`||r===`break-spaces`;function f(t=!1){let i=s.words.length>0;if(!(r===`break-spaces`||d&&!t))for(;s.words.length>0&&s.words[s.words.length-1].isSpace;)s.totalWidth-=s.words[s.words.length-1].width,s.words.pop();if(t&&s.words.length>0){let t=s.words[s.words.length-1];if(t.isSoftHyphenBreak){j(e,t.style);let n=k(e,`-`);s.words.push({text:`-`,width:n,style:t.style,isSpace:!1}),s.totalWidth+=n}}if(s.words.length>0||i&&u){if(E){let e=s.words.map(e=>e.text).join(``);E({type:`line-commit`,message:`Line ${o.length}: "${e}" width=${s.totalWidth.toFixed(2)} / ${n}`,data:{lineIndex:o.length,text:e,totalWidth:s.totalWidth,contentWidth:n}})}o.push(s)}s={words:[],totalWidth:0,lineHeight:0}}let p=!0;for(let r of t){let t=z(e,r.style,i);if(r.boxStyle&&r.boxStyle.display===`inline-block`){let e=r.boxStyle;t=Math.max(t,t+e.paddingTop+e.paddingBottom+e.marginTop+e.marginBottom+e.borderTopWidth+e.borderBottomWidth)}if(r.text===`
|
|
9
|
+
`){s.words.length===0?(s.lineHeight=t,s.endedByHardBreak=!0,o.push(s),s={words:[],totalWidth:0,lineHeight:0}):(s.endedByHardBreak=!0,f()),p=!0;continue}if(c){s.words.push(r),s.totalWidth+=r.width,s.lineHeight=Math.max(s.lineHeight,t);continue}let a=!r.isSpace&&r.text.length>1?se(e,r,l(),s.totalWidth):[r];for(let r of a){let i=!r.isSpace&&r.text.length>0&&/^[,.\;:!?\)\]\}'"»›]+$/.test(r.text)&&s.words.length>0&&!s.words[s.words.length-1].isSpace;if(!r.isSpace&&!i&&s.words.length>0&&s.totalWidth+r.width>l()){let i=s.totalWidth+r.width-l(),a=!0;if(i<1&&!A([...s.words,r])&&(j(e,r.style),k(e,s.words.map(e=>e.text).join(``)+r.text)<=l()+.1&&(a=!1)),a&&r.text.includes(`-`)){let n=r.text.split(/(?<=-)/);if(n.length>1){j(e,r.style);let i=``,a=0,o=0,c=l()-s.totalWidth;for(;o<n.length;o++){let t=i+n[o],r=k(e,t);if(r>c)break;i=t,a=r}if(o>0&&o<n.length){s.words.push({...r,text:i,width:a}),s.totalWidth+=a,s.lineHeight=Math.max(s.lineHeight,t),f(!0),p=!1;let c=n.slice(o).join(``),l=k(e,c);s.words.push({...r,text:c,width:l}),s.totalWidth+=l,s.lineHeight=Math.max(s.lineHeight,t);continue}}}if(a){if(E){let e=s.words.map(e=>e.text).join(``);E({type:`line-wrap`,message:`"${r.text}" overflow=${i.toFixed(2)} wrap=true lineWidth=${s.totalWidth.toFixed(2)} pieceWidth=${r.width.toFixed(2)} contentWidth=${n} line="${e}"`,data:{text:r.text,overflow:i,lineWidth:s.totalWidth,pieceWidth:r.width,contentWidth:n,lineText:e}})}f(!0),p=!1}}if(r.isSpace&&s.words.length===0&&(!p||!d))continue;let a=r.width;if(r.isTab){let e=r.width,t=s.totalWidth;a=Math.ceil((t+.1)/e)*e-t,r.width=a}if(s.words.length===0&&a>l()&&!r.isSpace&&r.text.includes(`-`)){let n=r.text.split(/(?<=-)/);if(n.length>1){j(e,r.style);let i=n.filter(e=>e).map(t=>({...r,text:t,width:k(e,t)})),a=!0;for(let e of i)a?(a=!1,s.words.push(e),s.totalWidth+=e.width,s.lineHeight=Math.max(s.lineHeight,t)):s.totalWidth+e.width>l()?(f(!0),p=!1,s.words.push(e),s.totalWidth+=e.width,s.lineHeight=Math.max(s.lineHeight,t)):(s.words.push(e),s.totalWidth+=e.width,s.lineHeight=Math.max(s.lineHeight,t));continue}}s.words.push(r),s.totalWidth+=a,s.lineHeight=Math.max(s.lineHeight,t),r.isSpace||(p=!1)}}return f(),o}function X(e,t,n,r,i,a=!1){let o=[],s=re(t);if(s.length===0)return{nodes:o,height:0};let c=oe(e,s),l=t.style.textIndent||0,u=ce(e,c,i,t.style.whiteSpace,a,l),d=t.style.direction===`rtl`,f=e=>e===`start`?d?`right`:`left`:e===`end`?d?`left`:`right`:e,p=f(t.style.textAlign),m=t.style.textAlignLast||`auto`;m=m===`auto`?t.style.textAlign===`justify`?d?`right`:`left`:p:f(m);let h=r;for(let t=0;t<u.length;t++){let r=u[t];if(r.words.length===0){h+=r.lineHeight;continue}let a=r.lineHeight,s=t===u.length-1,c=t===0,f=s||r.endedByHardBreak?m:p,g=c?l:0,_=i-g,v=0;if(f===`justify`&&r.totalWidth<_){let e=r.words.filter(e=>e.isSpace).length;e>0&&(v=(_-r.totalWidth)/e)}let y=n+g;f===`center`?y=n+g+(_-r.totalWidth)/2:(f===`right`||f!==`justify`&&d||d)&&(y=n+g+_-r.totalWidth);let b=y,x=0,S=0;for(let t of r.words){if(t.text===``)continue;let n=t.style.verticalAlign;if(n===`super`||n===`sub`)continue;let{ascent:r,descent:i}=W(e,t.style);r>x&&(x=r),i>S&&(S=i)}if(x===0)for(let t of r.words){if(t.text===``)continue;let{ascent:n,descent:r}=W(e,t.style);x=n,S=r;break}let C=x+S,w=h+(a-C)/2+x,T=r.words.filter(e=>e.text!==``&&e.style.verticalAlign!==`super`&&e.style.verticalAlign!==`sub`),E=T.length>0?Math.max(...T.map(e=>e.style.fontSize)):0,O=h,A=h+a;for(let t of r.words){if(t.text===``)continue;let n=t.style.verticalAlign;if(n!==`super`&&n!==`sub`)continue;if(E===0)break;let{ascent:r,descent:i}=W(e,t.style),a=w;n===`super`?a-=E*.4:a+=E*.26;let o=a-r,s=a+i;o<O&&(O=o),s>A&&(A=s)}let M=A-O,N=(t,n,r)=>{let{ascent:i,descent:a}=W(e,t),s=t.paddingTop+t.borderTopWidth,c=t.paddingBottom+t.borderBottomWidth,l=i+a+s+c,u;u=t.display===`inline-block`?h+t.marginTop:w-i-s,o.push({type:`box`,style:t,x:n,y:u,width:r,height:l,tagName:`span`,children:[]})};if(!d){let e=y,t=e,n,i=!1;for(let a of r.words){if(a.boxOpen&&a.boxClose&&a.text){n&&(i&&N(n,t,e-t),n=void 0,i=!1);let r=a.style,o=a.width-r.marginLeft-r.borderLeftWidth-r.paddingLeft-r.paddingRight-r.borderRightWidth-r.marginRight;N(r,e+r.marginLeft,r.borderLeftWidth+r.paddingLeft+o+r.paddingRight+r.borderRightWidth),i=!1,e+=a.width;continue}a.boxStyle!==n&&(n&&i&&N(n,t,e-t),n=a.boxStyle,t=e,i=!1),a.text&&!a.isSpace&&(i=!0),e+=a.width+(a.isSpace?v:0)}n&&i&&N(n,t,e-t)}let P=r.words.filter(e=>e.text!==``),F=P.length>0&&P.every(e=>G(e.style,P[0].style));if(d){let t=[],n=null,i=0;for(let e of r.words){if(e.text===``){n&&=(t.push(n),null),i+=e.width;continue}n&&G(n.style,e.style)?(n.text+=e.text,n.width+=e.width):(n&&t.push(n),n={text:e.text,style:e.style,width:e.width,boxStyle:e.boxStyle,x:0,padBefore:i},i=0)}n&&t.push(n);let a=y+r.totalWidth;for(let n of t){a-=n.padBefore,j(e,n.style);let t=k(e,n.text);a-=t,n.x=a,n.width=t}for(let e of t)if(e.boxStyle&&K(e.boxStyle)){let t=e.boxStyle,n=t.paddingLeft+t.borderLeftWidth,r=t.paddingRight+t.borderRightWidth;N(t,e.x-n,e.width+n+r)}for(let e of t)o.push({type:`text`,text:e.text,x:e.x+e.width,y:w,width:e.width,style:{...e.style,direction:`rtl`}})}else{let t=r.words.map(e=>e.text).join(``);if(F&&/[\u0590-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/.test(t)&&!r.words.some(e=>e.boxOpen||e.boxClose||e.style.verticalAlign===`super`||e.style.verticalAlign===`sub`)){j(e,P[0].style);let n=k(e,t);o.push({type:`text`,text:t,x:y,y:w,width:n,style:P[0].style})}else for(let t of r.words){if(t.text===``){y+=t.width;continue}if(t.boxOpen&&t.boxClose){let n=t.style,r=y+n.marginLeft+n.borderLeftWidth+n.paddingLeft;o.push({type:`text`,text:t.text,x:r,y:w,width:k(e,t.text),style:t.style}),y+=t.width;continue}let n=w,r=t.style.verticalAlign;if(r===`super`||r===`sub`){let e=E||t.style.fontSize;r===`super`?n-=e*.4:n+=e*.26}let i=t.width+(t.isSpace?v:0);o.push({type:`text`,text:t.text,x:y,y:n,width:i,style:t.style}),y+=i}}let I=f===`justify`&&v>0?_:r.totalWidth;D.push({y:Math.round(w),text:r.words.map(e=>e.text).join(``),bounds:{x:b,y:O,width:I,height:M}}),h+=M}return{nodes:o,height:h-r}}function le(e,t){return e>=0&&t>=0?Math.max(e,t):e<0&&t<0?Math.min(e,t):e+t}function Z(e,t,n,r,i){let a=t.style,o=a.marginLeft,s=a.marginRight,c=a.borderLeftWidth,l=a.borderRightWidth,u=a.borderTopWidth,d=a.borderBottomWidth,f=a.paddingLeft,p=a.paddingRight,m=a.paddingTop,h=a.paddingBottom,g=n+o,_=a.width>0?a.width:i-o-s,v=g+c+f,y=Math.max(0,_-c-l-f-p),b=r,x=b+u+m,S={type:`box`,style:a,x:g,y:b,width:_,height:0,tagName:t.tagName,children:[],listMarker:t.listMarker};if(a.display===`flex`){let n=de(e,t,v,x,y);return S.children=n.children,S.height=u+m+n.height+h+d,{box:S,height:S.height,marginBottomOut:a.marginBottom}}if(a.display===`table`){let n=ue(e,t,v,x,y);return S.children=n.children,S.height=u+m+n.height+h+d,{box:S,height:S.height,marginBottomOut:a.marginBottom}}if(t.children.length===0)return S.height=u+m+h+d,a.minHeight>0&&(S.height=Math.max(S.height,a.minHeight)),{box:S,height:S.height,marginBottomOut:a.marginBottom};if(ne(t)){let{nodes:n,height:r}=X(e,t,v,x,y,t.tagName===`li`&&R.has(a.listStyleType));S.children=n,S.height=u+m+r+h+d}else{let n=x,r=0,i=!1,o=t.tagName===`li`||t.tagName===`ul`||t.tagName===`ol`||t.tagName===`dd`||t.tagName===`dt`;for(let s=0;s<t.children.length;s++){let c=t.children[s];if(c.tagName===`#text`||V(c)){let o=[c];for(;s+1<t.children.length;){let e=t.children[s+1];if(e.tagName===`#text`||V(e))o.push(e),s++;else break}r>0&&(n+=r,r=0);let l={element:null,tagName:`div`,style:{...t.style,display:`block`,marginTop:0,marginBottom:0,paddingTop:0,paddingBottom:0,borderTopWidth:0,borderBottomWidth:0},children:o,textContent:null},u=t.tagName===`li`&&R.has(a.listStyleType),{nodes:d,height:f}=X(e,l,v,n,y,u);S.children.push(...d),n+=f,r=0,i=!0;continue}let l=c.style.marginTop;if(!(!i&&m===0&&u===0&&o)){let e=le(r,l);n+=e}let{box:d,height:f,marginBottomOut:p}=Z(e,c,v,n,y);S.children.push(d),n+=f,r=p,i=!0}let s=a.marginBottom,c=h===0&&d===0&&o;c&&r>0&&(s=Math.max(a.marginBottom,r));let l=n-x;return!c&&r>0&&(l+=r),S.height=u+m+l+h+d,a.minHeight>0&&(S.height=Math.max(S.height,a.minHeight)),{box:S,height:S.height,marginBottomOut:s}}return a.minHeight>0&&(S.height=Math.max(S.height,a.minHeight)),{box:S,height:S.height,marginBottomOut:a.marginBottom}}function ue(e,t,n,r,i){let a=[],o=[];for(let e of t.children)if(e.tagName===`tr`)o.push(e);else if([`thead`,`tbody`,`tfoot`].includes(e.tagName))for(let t of e.children)t.tagName===`tr`&&o.push(t);if(o.length===0)return{children:a,height:0};let s=Math.max(...o.map(e=>e.children.filter(e=>e.tagName===`td`||e.tagName===`th`).length));if(s===0)return{children:a,height:0};let c=i/s,l=r;for(let t of o){let r=t.children.filter(e=>e.tagName===`td`||e.tagName===`th`),i=0,o=[];for(let t=0;t<r.length;t++){let a=r[t],{box:s,height:u}=Z(e,a,n+t*c,l,c);o.push(s),i=Math.max(i,u)}for(let e of o)e.height=i,a.push(e);l+=i}return{children:a,height:l-r}}function de(e,t,n,r,i){let a=t.style,o=a.gap,s=[],c=t.children.filter(e=>e.tagName!==`#text`||e.textContent?.trim());if(c.length===0)return{children:s,height:0};if(a.flexDirection===`row`||a.flexDirection===``){let t=o*(c.length-1),a=c.reduce((e,t)=>e+(t.style.flexGrow||0),0),l=(i-t)/(a||c.length),u=n,d=0;for(let t of c){if(t.tagName===`#text`)continue;let n=l*(t.style.flexGrow||(a===0?1:0)),{box:i,height:c}=Z(e,t,u,r,n);s.push(i),d=Math.max(d,c),u+=n+o}return{children:s,height:d}}let l=r;for(let t of c){if(t.tagName===`#text`)continue;let{box:r,height:a}=Z(e,t,n,l,i);s.push(r),l+=a+o}return{children:s,height:l-r}}function fe(e,t,n){if(!n.listMarker||n.markerHidden)return;let r=n.style,i=n.markerStyle,a=i?{...r,...i}:r;e.font=N(a);let o=z(e,r),s=t.y+r.borderTopWidth+r.paddingTop+te(e,r,o),c=k(e,n.listMarker),l=r.direction===`rtl`,u=l?i?.paddingLeft:i?.paddingRight,d=u===void 0?a.fontSize*.15:u,f,p=`ltr`;if(l){let e=t.x+t.width;/\d/.test(n.listMarker)?(p=`rtl`,f=e+d+c):f=e+d}else f=t.x+r.borderLeftWidth+r.paddingLeft-c-d;t.children.unshift({type:`text`,text:n.listMarker,x:f,y:s,width:c,style:{...a,textDecorationLine:`none`,fontWeight:i?.fontWeight??400,fontStyle:i?.fontStyle??`normal`,direction:p}});let m=l&&/\d/.test(n.listMarker)?f-c:f;D.push({y:Math.round(s),text:n.listMarker,bounds:{x:m,y:t.y+r.borderTopWidth+r.paddingTop,width:c,height:o}})}function pe(e,t,n,r=!0,i){T=r,E=i,P.clear(),U.clear(),M.clear(),O.clear(),D=[];let{box:a,height:o}=Z(e,t,0,0,n);Q(e,a,t);let s=D.slice().sort((e,t)=>e.y-t.y||e.bounds.x-t.bounds.x),c=[];for(let e of s){let t=c[c.length-1],n=e.bounds.height*.5;if(t&&Math.abs(e.y-t.y)<n){let n=t.text.length>0&&e.text.length>0&&!/\s$/.test(t.text)&&!/^\s/.test(e.text);t.text+=(n?` `:``)+e.text,t.y=Math.max(t.y,e.y);let r=Math.min(t.bounds.x,e.bounds.x),i=Math.min(t.bounds.y,e.bounds.y),a=Math.max(t.bounds.x+t.bounds.width,e.bounds.x+e.bounds.width),o=Math.max(t.bounds.y+t.bounds.height,e.bounds.y+e.bounds.height);t.bounds={x:r,y:i,width:a-r,height:o-i}}else c.push({y:e.y,text:e.text,bounds:{...e.bounds}})}return{root:a,height:o,lines:c}}function Q(e,t,n){fe(e,t,n);let r=0;for(let i of n.children)if(!(i.tagName===`#text`||V(i)))for(;r<t.children.length;){let n=t.children[r];if(n.type===`box`&&n.tagName===i.tagName){Q(e,n,i),r++;break}r++}}function me(e){if(!e||e===`none`)return[];let t=[],n=e.split(/,(?![^(]*\))/);for(let e of n){let n=e.trim(),r=n.match(/(rgb[a]?\([^)]+\)|#[0-9a-fA-F]+|\b[a-z]+\b)(?:\s|$)/i),i=n.match(/-?[\d.]+px/g);if(i&&i.length>=2){let e=i.map(e=>parseFloat(e));t.push({offsetX:e[0],offsetY:e[1],blur:e[2]||0,color:r?r[1]:`rgba(0,0,0,1)`})}}return t}function he(e,t){return e[`border${t}Width`]>0&&e[`border${t}Style`]!==`none`}function $(e,t,n,r,i,a,o){if(e.save(),e.strokeStyle=o,e.lineWidth=i,a===`double`){let a=Math.max(i,2);e.lineWidth=Math.max(.5,i*.5),e.beginPath(),e.moveTo(t,n-a/2),e.lineTo(t+r,n-a/2),e.moveTo(t,n+a/2),e.lineTo(t+r,n+a/2),e.stroke()}else if(a===`wavy`){let a=Math.max(1.5,i),o=a*4;e.beginPath(),e.moveTo(t,n);for(let i=t;i<t+r;i+=o)e.quadraticCurveTo(i+o/4,n-a,i+o/2,n),e.quadraticCurveTo(i+o*3/4,n+a,i+o,n);e.stroke()}else a===`dotted`?e.setLineDash([i,i*2]):a===`dashed`&&e.setLineDash([i*3,i*2]),e.beginPath(),e.moveTo(t,n),e.lineTo(t+r,n),e.stroke();e.setLineDash([]),e.restore()}function ge(e,t,n,r,i,a){let o=t.indexOf(`linear-gradient(`);if(o===-1)return null;let s=0,c=-1;for(let e=o+16;e<t.length;e++)if(t[e]===`(`)s++;else if(t[e]===`)`){if(s===0){c=e;break}s--}if(c===-1)return null;let l=t.slice(o+16,c),u=[];s=0;let d=0,f=l;for(let e=0;e<f.length;e++)f[e]===`(`?s++:f[e]===`)`?s--:f[e]===`,`&&s===0&&(u.push(f.slice(d,e).trim()),d=e+1);u.push(f.slice(d).trim());let p=180,m=0,h=u[0];h.endsWith(`deg`)?(p=parseFloat(h),m=1):h===`to right`?(p=90,m=1):h===`to left`?(p=270,m=1):h===`to bottom`?(p=180,m=1):h===`to top`&&(p=0,m=1);let g=(p-90)*Math.PI/180,_=n+r/2,v=i+a/2,y=Math.abs(r*Math.cos(g))+Math.abs(a*Math.sin(g)),b=Math.cos(g)*y/2,x=Math.sin(g)*y/2,S=e.createLinearGradient(_-b,v-x,_+b,v+x),C=u.slice(m);for(let e=0;e<C.length;e++){let t=C[e].trim(),n=t,r=e/Math.max(1,C.length-1),i=t.match(/\s+([\d.]+%)\s*$/);i&&(r=parseFloat(i[1])/100,n=t.slice(0,t.length-i[0].length).trim());try{S.addColorStop(r,n)}catch{}}return S}function _e(e,t,n){let{style:r}=t;e.save(),e.font=N(r),e.textBaseline=`alphabetic`,e.fontKerning=r.fontKerning===`none`?`none`:`normal`,r.letterSpacing>0&&(e.letterSpacing=`${r.letterSpacing}px`),r.wordSpacing&&(e.wordSpacing=`${r.wordSpacing}px`),r.direction===`rtl`&&(e.direction=`rtl`,e.textAlign=`right`);let i=r.webkitBackgroundClip===`text`&&r.backgroundImage&&r.backgroundImage!==`none`,a=r.webkitTextStrokeWidth>0,o=r.webkitTextFillColor===`transparent`||r.color===`transparent`,s=me(r.textShadow);if(s.length>0)for(let n of s)e.save(),e.shadowOffsetX=n.offsetX,e.shadowOffsetY=n.offsetY,e.shadowBlur=n.blur,e.shadowColor=n.color,e.fillStyle=r.color,e.fillText(t.text,t.x,t.y),e.restore();let c=()=>{if(i){if(e.save(),n)e.fillStyle=n;else{let{ascent:n,descent:i}=W(e,r);e.fillStyle=ge(e,r.backgroundImage,t.x,t.width,t.y-n,n+i)||r.color}e.fillText(t.text,t.x,t.y),e.restore()}else (!o||!a)&&(e.fillStyle=r.webkitTextFillColor&&r.webkitTextFillColor!==`transparent`?r.webkitTextFillColor:r.color,e.fillText(t.text,t.x,t.y))},l=()=>{a&&(e.save(),e.strokeStyle=r.webkitTextStrokeColor||r.color,e.lineWidth=r.webkitTextStrokeWidth,e.lineJoin=`round`,e.strokeText(t.text,t.x,t.y),e.restore())};f(r.paintOrder)?(l(),c()):(c(),l());let u=t.width,d=r.fontSize,p=r.textDecorationColor||r.color,m=r.textDecorationStyle||`solid`,h=Math.max(1,d/15),g=r.direction===`rtl`?t.x-u:t.x;if(r.textDecorationLine!==`none`){let{ascent:n}=W(e,r);e.font=N(r);let i=e.measureText(`x`).actualBoundingBoxAscent;if(r.textDecorationLine.includes(`underline`)){let n=d*.1;$(e,g,t.y+n,u,h,m,p)}if(r.textDecorationLine.includes(`line-through`)){let n=-(i*.5);$(e,g,t.y+n,u,h,m,p)}r.textDecorationLine.includes(`overline`)&&$(e,g,t.y-n,u,h,m,p)}e.restore()}function ve(e,t){let{style:n}=t;H(n.backgroundColor)||(e.fillStyle=n.backgroundColor,e.fillRect(t.x,t.y,t.width,t.height));let r=[[`Top`,t.x,t.y+n.borderTopWidth/2,t.x+t.width,t.y+n.borderTopWidth/2],[`Right`,t.x+t.width-n.borderRightWidth/2,t.y,t.x+t.width-n.borderRightWidth/2,t.y+t.height],[`Bottom`,t.x,t.y+t.height-n.borderBottomWidth/2,t.x+t.width,t.y+t.height-n.borderBottomWidth/2],[`Left`,t.x+n.borderLeftWidth/2,t.y,t.x+n.borderLeftWidth/2,t.y+t.height]];for(let[t,i,a,o,s]of r)he(n,t)&&(e.strokeStyle=n[`border${t}Color`],e.lineWidth=n[`border${t}Width`],e.beginPath(),e.moveTo(i,a),e.lineTo(o,s),e.stroke());let i=null;n.webkitBackgroundClip===`text`&&n.backgroundImage&&n.backgroundImage!==`none`&&(i=ge(e,n.backgroundImage,t.x,t.width,t.y,t.height));for(let n of t.children)ye(e,n,i)}function ye(e,t,n){t.type===`text`?_e(e,t,n):ve(e,t)}function be(e){let{html:n,width:r,height:i,accuracy:a=`performance`,debug:o}=e;if(!r||r<=0||Number.isNaN(r))throw TypeError(`layout: width must be a positive number, got ${r}`);let s=a===`balanced`,{fragment:c,css:l}=t(n),{tree:u,cleanup:d}=w(c,l,r),f=document.createElement(`canvas`).getContext(`2d`);f.fontKerning=`normal`;let{root:p,height:m,lines:h}=pe(f,u,r,s,o),g=i||m;return d(),{layoutRoot:p,height:g,lines:h}}function xe(e){let{layout:t,width:n,pixelRatio:r=globalThis.devicePixelRatio??1}=e;if(e.ctx&&e.canvas)throw TypeError(`drawLayout: ctx and canvas are mutually exclusive — provide one or neither`);let i=t.height,a,o;return e.ctx?(o=e.ctx,a=e.ctx.canvas):(a=e.canvas??document.createElement(`canvas`),a.width=Math.ceil(n*r),a.height=Math.ceil(i*r),`style`in a&&(a.style.width=`${n}px`,a.style.height=`${i}px`),o=a.getContext(`2d`),o.scale(r,r)),ye(o,t.layoutRoot),{canvas:a}}function Se(e){if(e.ctx&&e.canvas)throw TypeError(`render: ctx and canvas are mutually exclusive — provide one or neither`);let t=be({html:e.html,width:e.width,height:e.height,accuracy:e.accuracy,debug:e.debug}),{canvas:n}=xe({layout:t,width:e.width,ctx:e.ctx,canvas:e.canvas,pixelRatio:e.pixelRatio});return{canvas:n,height:t.height,layoutRoot:t.layoutRoot,lines:t.lines}}e.drawLayout=xe,e.layout=be,e.render=Se});
|
|
10
10
|
//# sourceMappingURL=render-tag.umd.js.map
|