monowind 0.1.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/index.js ADDED
@@ -0,0 +1,987 @@
1
+ //#region src/metrics.ts
2
+ function e(e) {
3
+ return (e >= 0 ? Math.floor(e + .5) : -Math.floor(-e + .5)) || 0;
4
+ }
5
+ function t(t, n) {
6
+ return n <= 0 ? 0 : e(t / (.25 * n));
7
+ }
8
+ function n(t, n) {
9
+ return e(n * t / 100);
10
+ }
11
+ function r(e) {
12
+ let t = document.createElement("span");
13
+ t.setAttribute("aria-hidden", "true"), t.style.cssText = "position:absolute!important;visibility:hidden!important;pointer-events:none!important;white-space:pre!important;overflow-wrap:normal!important;top:0!important;left:0!important;padding:0!important;margin:0!important;border:0!important;", t.textContent = "M".repeat(100), e.appendChild(t);
14
+ let n = t.getBoundingClientRect();
15
+ return e.removeChild(t), {
16
+ width: n.width / 100,
17
+ height: n.height
18
+ };
19
+ }
20
+ function i() {
21
+ return parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
22
+ }
23
+ //#endregion
24
+ //#region src/wrap.ts
25
+ function a(e, t) {
26
+ return e.trim() === "" ? [] : e.split("\n").flatMap((e) => c(e, t));
27
+ }
28
+ function o(e, t) {
29
+ return a(e, t).length;
30
+ }
31
+ function s(e) {
32
+ let t = [], n = 0, r = /-+/g, i;
33
+ for (; (i = r.exec(e)) !== null;) {
34
+ let r = i.index + i[0].length;
35
+ r < e.length && !/[0-9]/.test(e[r]) && (t.push(e.slice(n, r)), n = r);
36
+ }
37
+ return t.push(e.slice(n)), t;
38
+ }
39
+ function c(e, t) {
40
+ let n = e.split(/[ \t\r\n\f]+/).filter(Boolean);
41
+ if (n.length === 0) return [""];
42
+ if (t <= 0) return [n.join(" ")];
43
+ let r = [], i = "";
44
+ for (let e of n) {
45
+ let n = !1;
46
+ for (let a of s(e)) {
47
+ let e = +(!n && i !== "");
48
+ if (i !== "" && i.length + e + a.length <= t) i += e ? ` ${a}` : a;
49
+ else {
50
+ for (i !== "" && r.push(i); a.length > t;) r.push(a.slice(0, t)), a = a.slice(t);
51
+ i = a;
52
+ }
53
+ n = !0;
54
+ }
55
+ }
56
+ return r.push(i), r;
57
+ }
58
+ //#endregion
59
+ //#region src/layout.ts
60
+ function l(e, t) {
61
+ return u(e, t, void 0, 0, 0, "fill", {
62
+ maxContent: /* @__PURE__ */ new WeakMap(),
63
+ minContent: /* @__PURE__ */ new WeakMap()
64
+ }), { height: e.localRect.height };
65
+ }
66
+ function u(e, t, n, r, i, a, s, c) {
67
+ let l = e.style, u = c?.height, p = h(l.minWidth, t) ?? 0, m = h(l.maxWidth, t), _ = h(l.minHeight, n) ?? 0, b = h(l.maxHeight, n), x = {
68
+ top: f(l.padding.top, t),
69
+ right: f(l.padding.right, t),
70
+ bottom: f(l.padding.bottom, t),
71
+ left: f(l.padding.left, t)
72
+ };
73
+ e.resolvedPadding = x;
74
+ let S = c?.width ?? d(E(l, t, a, e, s), p, m), C = D(l, n), w = L(S, u ?? C ?? (_ > 0 ? _ : void 0) ?? Infinity, l.border, x), T;
75
+ if (e.children.length === 0) T = e.text ? l.whiteSpace === "nowrap" ? e.text.split("\n").length : o(e.text, w.width) : e.intrinsicHeight;
76
+ else if (l.display === "flex" && l.flexDirection === "row") T = v(e, w.width, w.height, l.border, x, s);
77
+ else if (l.display === "flex" && l.flexDirection === "column") {
78
+ let t = u !== void 0 || C !== void 0;
79
+ T = y(e, w.width, w.height, t, l.border, x, s);
80
+ } else T = g(e, w.width, l.border, x, s);
81
+ let O = T + l.border.top + l.border.bottom + x.top + x.bottom, k = u ?? C ?? O;
82
+ e.unclampedHeight = k, e.localRect = {
83
+ x: r,
84
+ y: i,
85
+ width: S,
86
+ height: d(k, _, b)
87
+ };
88
+ }
89
+ function d(e, t, n) {
90
+ return Math.max(t, n === void 0 ? e : Math.min(e, n));
91
+ }
92
+ function f(e, t) {
93
+ return typeof e == "number" ? e : t === void 0 || !Number.isFinite(t) ? 0 : n(e.percent, t);
94
+ }
95
+ function p(e, t) {
96
+ let n = (e) => e === null ? null : f(e, t);
97
+ return {
98
+ top: n(e.top),
99
+ right: n(e.right),
100
+ bottom: n(e.bottom),
101
+ left: n(e.left)
102
+ };
103
+ }
104
+ function m(e) {
105
+ return typeof e == "number" ? e : 0;
106
+ }
107
+ function h(e, t) {
108
+ if (e !== void 0 && e !== "auto") return typeof e == "number" ? e : t === void 0 ? void 0 : n(e.percent, t);
109
+ }
110
+ function g(e, t, n, r, i) {
111
+ let a = n.left + r.left, o = n.top + r.top, s = o, c = null;
112
+ for (let n of e.children) {
113
+ let e = p(n.style.margin, t), r = e.top ?? 0, o = e.bottom ?? 0, l = e.left ?? 0, d = e.right ?? 0;
114
+ u(n, Math.max(0, t - l - d), void 0, 0, 0, "fill", i);
115
+ let f = t - n.localRect.width, m = e.left === null && e.right === null, h = e.left === null && e.right !== null;
116
+ e.right === null && e.left;
117
+ let g;
118
+ g = m ? Math.floor(f / 2) : h ? f - d : l, s += c === null ? r : _(c, r), n.localRect = {
119
+ ...n.localRect,
120
+ x: a + g,
121
+ y: s
122
+ }, s += n.localRect.height, c = o;
123
+ }
124
+ return c !== null && (s += c), s - o;
125
+ }
126
+ function _(e, t) {
127
+ return e >= 0 && t >= 0 ? Math.max(e, t) : e <= 0 && t <= 0 ? Math.min(e, t) : e + t;
128
+ }
129
+ function v(e, t, n, r, i, a) {
130
+ let o = f(e.style.gapX, t), s = f(e.style.gapY, n), c = A(e).map((e) => {
131
+ let n = p(e.style.margin, t);
132
+ return {
133
+ node: e,
134
+ intrinsic: O(e, t, a),
135
+ grow: e.style.flexGrow,
136
+ shrink: e.style.flexShrink,
137
+ min: M(e, t, a),
138
+ max: h(e.style.maxWidth, t),
139
+ margin: n,
140
+ marginLeft: n.left,
141
+ marginRight: n.right
142
+ };
143
+ }), l = [];
144
+ if (e.style.flexWrap === "wrap") {
145
+ let n = [], r = 0;
146
+ for (let e of c) {
147
+ let i = Math.max(0, d(e.intrinsic, e.min, e.max)) + (e.marginLeft ?? 0) + (e.marginRight ?? 0), a = n.length === 0 ? i : r + o + i;
148
+ n.length > 0 && a > t && (l.push(n), n = [], r = 0), n.push(e), r = n.length === 1 ? i : r + o + i;
149
+ }
150
+ n.length > 0 && l.push(n), e.style.wrapReverse && l.reverse();
151
+ } else l.push(c);
152
+ let m = r.left + i.left, g = r.top + i.top, _ = 0, v = 0;
153
+ for (let r = 0; r < l.length; r++) {
154
+ let i = l[r], c = o * Math.max(0, i.length - 1), f = i.reduce((e, t) => e + (t.marginLeft ?? 0) + (t.marginRight ?? 0), 0), p = Math.max(0, t - c - f), y = i.some((e) => e.marginLeft === null || e.marginRight === null), x = i.reduce((e, t) => e + t.intrinsic, 0), T = y && x <= p ? i.map((e) => e.intrinsic) : C(i, p);
155
+ for (let e = 0; e < i.length; e++) u(i[e].node, t, void 0, 0, 0, "fill", a, { width: T[e] });
156
+ let E = i.reduce((e, t) => Math.max(e, t.node.localRect.height), 0), D = l.length === 1 && Number.isFinite(n) ? Math.max(n, E) : E;
157
+ for (let r = 0; r < i.length; r++) {
158
+ let o = i[r].node, s = o.style.alignSelf === "auto" ? e.style.alignItems : o.style.alignSelf, c = i[r].margin, l = c.top === null || c.bottom === null, f = o.style.height !== void 0 && o.style.height.kind !== "auto";
159
+ if (s === "stretch" && !l && !f && D > o.localRect.height) {
160
+ let e = c.top ?? 0, i = c.bottom ?? 0, s = Number.isFinite(n) ? n : void 0, l = d(Math.max(0, D - e - i), h(o.style.minHeight, s) ?? 0, h(o.style.maxHeight, s));
161
+ if (l === o.localRect.height) continue;
162
+ u(o, t, void 0, 0, 0, "fill", a, {
163
+ width: T[r],
164
+ height: l
165
+ });
166
+ }
167
+ }
168
+ let O = T.reduce((e, t) => e + t, 0), k = Math.max(0, p - O), A = i.reduce((e, t) => e + +(t.marginLeft === null) + +(t.marginRight === null), 0), M = Array.from({ length: i.length }, () => 0), N = Array.from({ length: i.length }, () => 0), P;
169
+ if (A > 0 && k > 0) {
170
+ let e = w(Array.from({ length: A }, () => 1), k), t = 0;
171
+ for (let n = 0; n < i.length; n++) i[n].marginLeft === null && (M[n] = e[t++]), i[n].marginRight === null && (N[n] = e[t++]);
172
+ P = S("start", T, 0);
173
+ } else P = S(j(e.style), T, k);
174
+ let F = 0;
175
+ for (let t = 0; t < i.length; t++) {
176
+ let n = i[t], r = n.node, a = n.marginLeft ?? 0, s = n.marginRight ?? 0;
177
+ F += M[t] + a, r.localRect = {
178
+ ...r.localRect,
179
+ x: m + P[t] + t * o + F,
180
+ y: g + _ + b(r, e.style.alignItems, D, n.margin)
181
+ }, F += N[t] + s;
182
+ }
183
+ let I = r < l.length - 1 ? s : 0;
184
+ _ += D + I, v += D + I;
185
+ }
186
+ return Number.isFinite(n) ? Math.max(n, v) : v;
187
+ }
188
+ function y(e, t, r, i, a, o, s) {
189
+ let c = f(e.style.gapY, r), l = A(e).map((i) => {
190
+ let a = p(i.style.margin, t), o = a.left ?? 0, c = a.right ?? 0;
191
+ u(i, Math.max(0, t - o - c), void 0, 0, 0, (i.style.alignSelf === "auto" ? e.style.alignItems : i.style.alignSelf) === "stretch" ? "fill" : "shrink", s);
192
+ let l = Number.isFinite(r) ? r : void 0, d = i.style.flexBasis, f = d === void 0 || d.kind === "auto" ? i.unclampedHeight : d.kind === "cells" ? d.value : d.kind === "percent" && l !== void 0 ? n(d.value, l) : i.unclampedHeight, m = i.style.minHeight === "auto" ? i.style.overflow === "visible" ? i.localRect.height : 0 : void 0;
193
+ return {
194
+ node: i,
195
+ intrinsic: f,
196
+ grow: i.style.flexGrow,
197
+ shrink: i.style.flexShrink,
198
+ min: m ?? h(i.style.minHeight, l) ?? 0,
199
+ max: h(i.style.maxHeight, l),
200
+ margin: a,
201
+ marginTop: a.top,
202
+ marginBottom: a.bottom,
203
+ marginLeft: o,
204
+ marginRight: c
205
+ };
206
+ }), d = c * Math.max(0, l.length - 1), m = l.reduce((e, t) => e + (t.marginTop ?? 0) + (t.marginBottom ?? 0), 0), g = Number.isFinite(r), _ = l.reduce((e, t) => e + t.intrinsic, 0), v = g ? Math.max(0, r - d - m) : _, y = i ? v : Math.max(v, _), b = l.some((e) => e.marginTop === null || e.marginBottom === null), T = g && !(g && b && _ <= y) ? C(l, y) : l.map((e) => e.intrinsic);
207
+ for (let n = 0; n < l.length; n++) if (T[n] !== l[n].intrinsic) {
208
+ let r = l[n], i = Math.max(0, t - r.marginLeft - r.marginRight), a = (r.node.style.alignSelf === "auto" ? e.style.alignItems : r.node.style.alignSelf) === "stretch";
209
+ u(r.node, i, T[n], 0, 0, a ? "fill" : "shrink", s, { height: T[n] });
210
+ }
211
+ let E = T.reduce((e, t) => e + t, 0), D = Math.max(0, y - E), O = l.reduce((e, t) => e + +(t.marginTop === null) + +(t.marginBottom === null), 0), k = Array.from({ length: l.length }, () => 0), M = Array.from({ length: l.length }, () => 0), N;
212
+ if (O > 0 && D > 0) {
213
+ let e = w(Array.from({ length: O }, () => 1), D), t = 0;
214
+ for (let n = 0; n < l.length; n++) l[n].marginTop === null && (k[n] = e[t++]), l[n].marginBottom === null && (M[n] = e[t++]);
215
+ N = S("start", T, 0);
216
+ } else N = S(j(e.style), T, D);
217
+ let P = a.left + o.left, F = a.top + o.top, I = 0;
218
+ for (let n = 0; n < l.length; n++) {
219
+ let r = l[n], i = r.node, a = r.marginTop ?? 0, o = r.marginBottom ?? 0;
220
+ I += k[n] + a, i.localRect = {
221
+ ...i.localRect,
222
+ x: P + x(i, e.style.alignItems, t, r.margin),
223
+ y: F + N[n] + n * c + I
224
+ }, I += M[n] + o;
225
+ }
226
+ let L = E + d + m;
227
+ return g ? Math.max(r, L) : L;
228
+ }
229
+ function b(e, t, n, r) {
230
+ let i = e.style.alignSelf === "auto" ? t : e.style.alignSelf, a = r.top ?? 0, o = r.bottom ?? 0, s = n - e.localRect.height, c = r.top === null && r.bottom === null, l = r.top === null && r.bottom !== null, u = r.bottom === null && r.top !== null;
231
+ return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + T(i, n, e.localRect.height);
232
+ }
233
+ function x(e, t, n, r) {
234
+ let i = e.style.alignSelf === "auto" ? t : e.style.alignSelf, a = r.left ?? 0, o = r.right ?? 0, s = n - e.localRect.width, c = r.left === null && r.right === null, l = r.left === null && r.right !== null, u = r.right === null && r.left !== null;
235
+ return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + T(i, n, e.localRect.width);
236
+ }
237
+ function S(e, t, n) {
238
+ let r = t.length;
239
+ if (r === 0) return [];
240
+ let i = [], a = 0;
241
+ if (e === "space-between" && r > 1) {
242
+ let e = Math.floor(n / (r - 1)), o = n - e * (r - 1);
243
+ for (let n = 0; n < r; n++) i.push(a), a += t[n] + e + +(n < o);
244
+ return i;
245
+ }
246
+ if ((e === "space-around" || e === "space-evenly") && n > 0) {
247
+ let o = w(Array.from({ length: r + 1 }, (t, n) => e === "space-evenly" || n === 0 || n === r ? 1 : 2), n);
248
+ for (let e = 0; e < r; e++) a += o[e], i.push(a), a += t[e];
249
+ return i;
250
+ }
251
+ e === "center" ? a = Math.floor(n / 2) : e === "end" && (a = n);
252
+ for (let e = 0; e < r; e++) i.push(a), a += t[e];
253
+ return i;
254
+ }
255
+ function C(e, t) {
256
+ let n = e.length, r = (t, n) => Math.max(0, d(t, e[n].min ?? 0, e[n].max)), i = e.map((e) => e.intrinsic), a = t >= i.reduce((e, t, n) => e + r(t, n), 0), o = Array.from({ length: n }, () => 0), s = Array.from({ length: n }, () => !1);
257
+ for (let t = 0; t < n; t++) {
258
+ let n = r(i[t], t);
259
+ ((a ? e[t].grow : e[t].shrink) === 0 || a && i[t] > n || !a && i[t] < n) && (o[t] = n, s[t] = !0);
260
+ }
261
+ for (;;) {
262
+ let c = [];
263
+ for (let e = 0; e < n; e++) s[e] || c.push(e);
264
+ if (c.length === 0) break;
265
+ let l = o.reduce((e, t, n) => s[n] ? e + t : e, 0), u = c.reduce((e, t) => e + i[t], 0), d = t - l - u, f = a ? Math.max(0, d) : Math.max(0, -d), p = w(c.map((t) => a ? e[t].grow : i[t] * e[t].shrink), f), m = c.map((e, t) => i[e] + (a ? p[t] : -p[t])), h = c.map((e, t) => r(m[t], e)), g = h.reduce((e, t, n) => e + (t - m[n]), 0);
266
+ if (g === 0) {
267
+ for (let e = 0; e < c.length; e++) o[c[e]] = h[e];
268
+ break;
269
+ }
270
+ for (let e = 0; e < c.length; e++) {
271
+ let t = h[e] - m[e];
272
+ (g > 0 ? t > 0 : t < 0) && (o[c[e]] = h[e], s[c[e]] = !0);
273
+ }
274
+ }
275
+ return o;
276
+ }
277
+ function w(e, t) {
278
+ let n = e.reduce((e, t) => e + t, 0);
279
+ if (n === 0 || t <= 0) return e.map(() => 0);
280
+ let r = e.map((e) => e / n * t), i = r.map(Math.floor), a = t - i.reduce((e, t) => e + t, 0);
281
+ if (a > 0) {
282
+ let e = r.map((e, t) => [t, e - Math.floor(e)]).sort((e, t) => t[1] === e[1] ? e[0] - t[0] : t[1] - e[1]);
283
+ for (let [t] of e) {
284
+ if (a <= 0) break;
285
+ i[t] += 1, --a;
286
+ }
287
+ }
288
+ return i;
289
+ }
290
+ function T(e, t, n) {
291
+ return e === "center" ? Math.max(0, Math.floor((t - n) / 2)) : e === "end" ? Math.max(0, t - n) : 0;
292
+ }
293
+ function E(e, t, n, r, i) {
294
+ let a = e.width;
295
+ return a !== void 0 && a.kind !== "auto" ? k(a, t, r, i) : n === "shrink" ? Math.min(t, N(r, i)) : t;
296
+ }
297
+ function D(e, t) {
298
+ if (e.height?.kind === "cells") return e.height.value;
299
+ if (e.height?.kind === "percent" && t != null) return n(e.height.value, t);
300
+ }
301
+ function O(e, t, n) {
302
+ let r = e.style.flexBasis, i = e.style.width;
303
+ return r !== void 0 && r.kind !== "auto" ? k(r, t, e, n) : i !== void 0 && i.kind !== "auto" ? k(i, t, e, n) : N(e, n);
304
+ }
305
+ function k(e, t, r, i) {
306
+ switch (e.kind) {
307
+ case "cells": return e.value;
308
+ case "percent": return n(e.value, t);
309
+ case "min-content": return F(r, i);
310
+ case "max-content": return N(r, i);
311
+ case "fit-content": return Math.min(N(r, i), Math.max(F(r, i), t));
312
+ case "auto": return N(r, i);
313
+ }
314
+ }
315
+ function A(e) {
316
+ let t = [...e.children].sort((e, t) => e.style.order - t.style.order);
317
+ return e.style.flexReverse && t.reverse(), t;
318
+ }
319
+ function j(e) {
320
+ return e.flexReverse ? e.justifyContent === "start" ? "end" : e.justifyContent === "end" ? "start" : e.justifyContent : e.justifyContent;
321
+ }
322
+ function M(e, t, n) {
323
+ return e.style.minWidth === "auto" ? e.style.overflow === "visible" ? F(e, n) : 0 : h(e.style.minWidth, t) ?? 0;
324
+ }
325
+ function N(e, t) {
326
+ let n = t.maxContent.get(e);
327
+ if (n !== void 0) return n;
328
+ let r = e.style, i = P(e, t) + r.border.left + r.border.right + m(r.padding.left) + m(r.padding.right);
329
+ return t.maxContent.set(e, i), i;
330
+ }
331
+ function P(e, t) {
332
+ if (e.children.length === 0) return e.intrinsicWidth;
333
+ if (e.style.display === "flex" && e.style.flexDirection === "row") {
334
+ let n = m(e.style.gapX) * Math.max(0, e.children.length - 1);
335
+ return e.children.reduce((e, n) => e + N(n, t), 0) + n;
336
+ }
337
+ return e.children.reduce((e, n) => Math.max(e, N(n, t)), 0);
338
+ }
339
+ function F(e, t) {
340
+ let n = t.minContent.get(e);
341
+ if (n !== void 0) return n;
342
+ let r = e.style, i = I(e, t) + r.border.left + r.border.right + m(r.padding.left) + m(r.padding.right);
343
+ return t.minContent.set(e, i), i;
344
+ }
345
+ function I(e, t) {
346
+ if (e.children.length === 0) {
347
+ if (!e.text || e.style.whiteSpace === "nowrap") return e.intrinsicWidth;
348
+ let t = 0;
349
+ for (let n of e.text.split(/[ \t\r\n\f]+/)) for (let e of s(n)) e.length > t && (t = e.length);
350
+ return t;
351
+ }
352
+ if (e.style.display === "flex" && e.style.flexDirection === "row" && e.style.flexWrap === "nowrap") {
353
+ let n = m(e.style.gapX) * Math.max(0, e.children.length - 1);
354
+ return e.children.reduce((e, n) => e + F(n, t), 0) + n;
355
+ }
356
+ return e.children.reduce((e, n) => Math.max(e, F(n, t)), 0);
357
+ }
358
+ function L(e, t, n, r) {
359
+ return {
360
+ width: Math.max(0, e - n.left - n.right - r.left - r.right),
361
+ height: Math.max(0, t - n.top - n.bottom - r.top - r.bottom)
362
+ };
363
+ }
364
+ //#endregion
365
+ //#region src/borders.ts
366
+ function R(e, t, n) {
367
+ let r = e.border;
368
+ if (r.top === 0 && r.right === 0 && r.bottom === 0 && r.left === 0) return;
369
+ let i = Math.max(r.top, r.right, r.bottom, r.left);
370
+ for (let a = 0; a < i; a++) {
371
+ let i = {
372
+ top: a < r.top,
373
+ right: a < r.right,
374
+ bottom: a < r.bottom,
375
+ left: a < r.left
376
+ }, o = {
377
+ x: t.x + (i.left ? a : 0),
378
+ y: t.y + (i.top ? a : 0),
379
+ width: t.width - (i.left ? a : 0) - (i.right ? a : 0),
380
+ height: t.height - (i.top ? a : 0) - (i.bottom ? a : 0)
381
+ };
382
+ o.width <= 0 || o.height <= 0 || z(n, e.borderStyle, e.borderColor, o, i);
383
+ }
384
+ }
385
+ function z(e, t, n, r, i) {
386
+ let a = B(t.top), o = B(t.right), s = B(t.bottom), c = B(t.left), l = (e, t, n) => n(B(e === t ? e : "solid")), { x: u, y: d, width: f, height: p } = r, m = f >= 2 && p >= 2, h = u + +!!i.left, g = u + f - +!!i.right, _ = d + +!!i.top, v = d + p - +!!i.bottom;
387
+ if (i.top && g > h && e.push({
388
+ glyph: a.h,
389
+ x: h,
390
+ y: d,
391
+ length: g - h,
392
+ color: n.top
393
+ }), i.bottom && p > +!!i.top && g > h && e.push({
394
+ glyph: s.h,
395
+ x: h,
396
+ y: d + p - 1,
397
+ length: g - h,
398
+ color: n.bottom
399
+ }), i.left) for (let t = _; t < v; t++) e.push({
400
+ glyph: c.v,
401
+ x: u,
402
+ y: t,
403
+ length: 1,
404
+ color: n.left
405
+ });
406
+ if (i.right && f > +!!i.left) for (let t = _; t < v; t++) e.push({
407
+ glyph: o.v,
408
+ x: u + f - 1,
409
+ y: t,
410
+ length: 1,
411
+ color: n.right
412
+ });
413
+ m && (i.top && i.left && e.push({
414
+ glyph: l(t.top, t.left, (e) => e.tl),
415
+ x: u,
416
+ y: d,
417
+ length: 1,
418
+ color: n.top
419
+ }), i.top && i.right && e.push({
420
+ glyph: l(t.top, t.right, (e) => e.tr),
421
+ x: u + f - 1,
422
+ y: d,
423
+ length: 1,
424
+ color: n.top
425
+ }), i.bottom && i.left && e.push({
426
+ glyph: l(t.bottom, t.left, (e) => e.bl),
427
+ x: u,
428
+ y: d + p - 1,
429
+ length: 1,
430
+ color: n.bottom
431
+ }), i.bottom && i.right && e.push({
432
+ glyph: l(t.bottom, t.right, (e) => e.br),
433
+ x: u + f - 1,
434
+ y: d + p - 1,
435
+ length: 1,
436
+ color: n.bottom
437
+ }));
438
+ }
439
+ function B(e) {
440
+ switch (e) {
441
+ case "double": return {
442
+ h: "═",
443
+ v: "║",
444
+ tl: "╔",
445
+ tr: "╗",
446
+ bl: "╚",
447
+ br: "╝"
448
+ };
449
+ case "dashed": return {
450
+ h: "╌",
451
+ v: "╎",
452
+ tl: "┌",
453
+ tr: "┐",
454
+ bl: "└",
455
+ br: "┘"
456
+ };
457
+ case "dotted": return {
458
+ h: "┄",
459
+ v: "┊",
460
+ tl: "┌",
461
+ tr: "┐",
462
+ bl: "└",
463
+ br: "┘"
464
+ };
465
+ default: return {
466
+ h: "─",
467
+ v: "│",
468
+ tl: "┌",
469
+ tr: "┐",
470
+ bl: "└",
471
+ br: "┘"
472
+ };
473
+ }
474
+ }
475
+ //#endregion
476
+ //#region src/render.ts
477
+ function ee(e, t) {
478
+ let n = [];
479
+ V(e, 0, 0, n, !0), ne(t, n);
480
+ }
481
+ function V(e, t, n, r, i) {
482
+ let a = t + e.localRect.x, o = n + e.localRect.y;
483
+ i || te(e.source, e.localRect, e.resolvedPadding, e.style.border, e.style.textAlignBlocked, e.style.overflow, e.style.whiteSpace), R(e.style, {
484
+ x: a,
485
+ y: o,
486
+ width: e.localRect.width,
487
+ height: e.localRect.height
488
+ }, r);
489
+ for (let t of e.children) V(t, a, o, r, !1);
490
+ }
491
+ function te(e, t, n, r, i, a, o) {
492
+ e.setAttribute("data-mw-laid-out", ""), o === "nowrap" ? e.setAttribute("data-mw-nowrap", "") : e.removeAttribute("data-mw-nowrap"), e.style.setProperty("--mw-x", String(t.x)), e.style.setProperty("--mw-y", String(t.y)), e.style.setProperty("--mw-w", String(t.width)), e.style.setProperty("--mw-h", String(t.height)), a === "clip" ? e.setAttribute("data-mw-clip", "") : e.removeAttribute("data-mw-clip"), e.style.setProperty("--mw-pt", String(n.top)), e.style.setProperty("--mw-pr", String(n.right)), e.style.setProperty("--mw-pb", String(n.bottom)), e.style.setProperty("--mw-pl", String(n.left)), e.style.setProperty("--mw-bt", String(r.top)), e.style.setProperty("--mw-br", String(r.right)), e.style.setProperty("--mw-bb", String(r.bottom)), e.style.setProperty("--mw-bl", String(r.left)), i ? e.setAttribute("data-mw-text-align-blocked", "") : e.removeAttribute("data-mw-text-align-blocked");
493
+ }
494
+ function ne(e, t) {
495
+ e.replaceChildren();
496
+ for (let n of t) for (let t = 0; t < n.length; t++) {
497
+ let r = document.createElement("span");
498
+ r.setAttribute("aria-hidden", "true"), r.style.position = "absolute", r.style.left = `calc(${n.x + t} * var(--mw-cw))`, r.style.top = `calc(${n.y} * var(--mw-ch))`, r.style.font = "inherit", r.style.lineHeight = "inherit", r.style.whiteSpace = "pre", r.style.pointerEvents = "none", r.style.userSelect = "none", n.color && (r.style.color = n.color), r.textContent = n.glyph, e.appendChild(r);
499
+ }
500
+ }
501
+ //#endregion
502
+ //#region src/style.ts
503
+ function re(e, t) {
504
+ let n = getComputedStyle(e), r = ae(e) ? e.computedStyleMap() : null, i = e.getAttribute("class") ?? "", a = e.style, o = n.display;
505
+ return {
506
+ display: o === "flex" ? "flex" : o === "grid" ? "grid" : o === "none" ? "none" : (o.startsWith("inline"), "block"),
507
+ flexDirection: n.flexDirection.startsWith("column") ? "column" : "row",
508
+ flexReverse: n.flexDirection.endsWith("-reverse"),
509
+ flexWrap: n.flexWrap.startsWith("wrap") ? "wrap" : "nowrap",
510
+ wrapReverse: n.flexWrap === "wrap-reverse",
511
+ flexGrow: Number(n.flexGrow) || 0,
512
+ flexShrink: n.flexShrink === "" ? 1 : Number(n.flexShrink) || 0,
513
+ flexBasis: le(n.flexBasis, t),
514
+ order: Number(n.order) || 0,
515
+ justifyContent: oe(n.justifyContent),
516
+ alignItems: U(n.alignItems),
517
+ alignSelf: se(n.alignSelf),
518
+ width: q(r, n.width, "width", t, i, a),
519
+ height: q(r, n.height, "height", t, i, a),
520
+ minWidth: G(n.minWidth, t) ?? "auto",
521
+ minHeight: G(n.minHeight, t) ?? "auto",
522
+ maxWidth: G(n.maxWidth, t),
523
+ maxHeight: G(n.maxHeight, t),
524
+ padding: de(n, t),
525
+ margin: ce(n, r, i, t),
526
+ gapX: K(n.columnGap === "normal" ? "0px" : n.columnGap, t),
527
+ gapY: K(n.rowGap === "normal" ? "0px" : n.rowGap, t),
528
+ border: fe(n),
529
+ borderStyle: {
530
+ top: W(n.borderTopStyle),
531
+ right: W(n.borderRightStyle),
532
+ bottom: W(n.borderBottomStyle),
533
+ left: W(n.borderLeftStyle)
534
+ },
535
+ overflow: H(n.overflow) || H(n.overflowX) || H(n.overflowY) ? "clip" : "visible",
536
+ whiteSpace: n.whiteSpace === "nowrap" || n.whiteSpace === "pre" ? "nowrap" : "normal",
537
+ textOverflow: n.textOverflow === "ellipsis" ? "ellipsis" : "clip",
538
+ color: n.color,
539
+ backgroundColor: n.backgroundColor === "rgba(0, 0, 0, 0)" ? void 0 : n.backgroundColor,
540
+ borderColor: {
541
+ top: n.borderTopColor,
542
+ right: n.borderRightColor,
543
+ bottom: n.borderBottomColor,
544
+ left: n.borderLeftColor
545
+ },
546
+ textAlignBlocked: ie(i, a)
547
+ };
548
+ }
549
+ function H(e) {
550
+ return e === "hidden" || e === "clip";
551
+ }
552
+ function ie(e, t) {
553
+ if (/(?:^|[\s:.[!])text-(?:center|justify)/.test(e)) return !0;
554
+ let n = t.textAlign;
555
+ return n === "center" || n === "justify";
556
+ }
557
+ function ae(e) {
558
+ return typeof e.computedStyleMap == "function";
559
+ }
560
+ function oe(e) {
561
+ switch (e) {
562
+ case "center": return "center";
563
+ case "flex-end":
564
+ case "end":
565
+ case "right": return "end";
566
+ case "space-between": return "space-between";
567
+ case "space-around": return "space-around";
568
+ case "space-evenly": return "space-evenly";
569
+ default: return "start";
570
+ }
571
+ }
572
+ function U(e) {
573
+ switch (e) {
574
+ case "center": return "center";
575
+ case "flex-end":
576
+ case "end": return "end";
577
+ case "stretch":
578
+ case "normal":
579
+ case "": return "stretch";
580
+ default: return "start";
581
+ }
582
+ }
583
+ function se(e) {
584
+ return e === "auto" || e === "" || e === "normal" ? "auto" : U(e);
585
+ }
586
+ function ce(e, t, n, r) {
587
+ let i = (i, a, o) => {
588
+ if (t) {
589
+ let e = t.get(i)?.toString().trim();
590
+ if (e === "auto" || t.get(a)?.toString().trim() === "auto") return null;
591
+ if (e?.endsWith("%")) {
592
+ let t = parseFloat(e);
593
+ if (Number.isFinite(t) && t !== 0) return { percent: t };
594
+ }
595
+ } else if (o.test(n)) return null;
596
+ let s = e.getPropertyValue(i);
597
+ if (s === "auto") return null;
598
+ let c = K(s, r);
599
+ if (c !== 0) return c;
600
+ let l = e.getPropertyValue(a);
601
+ return l === "auto" ? null : K(l, r);
602
+ };
603
+ return {
604
+ top: i("margin-top", "margin-block-start", /(?:^|[\s:.[!])(?:m|my|mt)-auto\b/),
605
+ right: i("margin-right", "margin-inline-end", /(?:^|[\s:.[!])(?:m|mx|mr|me)-auto\b/),
606
+ bottom: i("margin-bottom", "margin-block-end", /(?:^|[\s:.[!])(?:m|my|mb)-auto\b/),
607
+ left: i("margin-left", "margin-inline-start", /(?:^|[\s:.[!])(?:m|mx|ml|ms)-auto\b/)
608
+ };
609
+ }
610
+ function W(e) {
611
+ switch (e) {
612
+ case "double": return "double";
613
+ case "dashed": return "dashed";
614
+ case "dotted": return "dotted";
615
+ default: return "solid";
616
+ }
617
+ }
618
+ function G(e, n) {
619
+ if (!e || e === "none" || e === "auto") return;
620
+ if (e.endsWith("%")) {
621
+ let t = parseFloat(e);
622
+ return Number.isFinite(t) ? { percent: t } : void 0;
623
+ }
624
+ let r = parseFloat(e);
625
+ return Number.isFinite(r) ? t(r, n) : void 0;
626
+ }
627
+ function K(e, n) {
628
+ if (!e || e === "auto" || e === "none") return 0;
629
+ if (e.endsWith("%")) {
630
+ let t = parseFloat(e);
631
+ return Number.isFinite(t) && t !== 0 ? { percent: t } : 0;
632
+ }
633
+ let r = parseFloat(e);
634
+ return Number.isFinite(r) ? t(r, n) : 0;
635
+ }
636
+ function q(n, r, i, a, o, s) {
637
+ if (n) {
638
+ let r = n.get(i);
639
+ if (r == null) return;
640
+ let o = r.toString().trim();
641
+ if (o === "auto") return { kind: "auto" };
642
+ let s = J(o);
643
+ if (s) return s;
644
+ if (o.endsWith("%")) return {
645
+ kind: "percent",
646
+ value: parseFloat(o)
647
+ };
648
+ if (o.endsWith("px")) return {
649
+ kind: "cells",
650
+ value: t(parseFloat(o), a)
651
+ };
652
+ if (o.endsWith("rem")) return {
653
+ kind: "cells",
654
+ value: e(parseFloat(o) / .25)
655
+ };
656
+ }
657
+ let c = i === "width" ? s.width : s.height;
658
+ if (c) {
659
+ if (c === "auto") return { kind: "auto" };
660
+ let e = J(c);
661
+ if (e) return e;
662
+ if (c.endsWith("%")) return {
663
+ kind: "percent",
664
+ value: parseFloat(c)
665
+ };
666
+ let n = parseFloat(c);
667
+ if (Number.isFinite(n)) return {
668
+ kind: "cells",
669
+ value: t(n, a)
670
+ };
671
+ }
672
+ let l = i === "width" ? "w" : "h";
673
+ if (RegExp(`(?:^|[\\s:.[!])${l}-min\\b`).test(o)) return { kind: "min-content" };
674
+ if (RegExp(`(?:^|[\\s:.[!])${l}-max\\b`).test(o)) return { kind: "max-content" };
675
+ if (RegExp(`(?:^|[\\s:.[!])${l}-fit\\b`).test(o)) return { kind: "fit-content" };
676
+ if (!ue(o, l) || r === "auto") return { kind: "auto" };
677
+ if (r.endsWith("%")) return {
678
+ kind: "percent",
679
+ value: parseFloat(r)
680
+ };
681
+ let u = parseFloat(r);
682
+ if (Number.isFinite(u)) return {
683
+ kind: "cells",
684
+ value: t(u, a)
685
+ };
686
+ }
687
+ function le(e, n) {
688
+ if (!e || e === "auto" || e === "content") return;
689
+ let r = J(e);
690
+ if (r) return r;
691
+ if (e.endsWith("%")) {
692
+ let t = parseFloat(e);
693
+ return Number.isFinite(t) ? {
694
+ kind: "percent",
695
+ value: t
696
+ } : void 0;
697
+ }
698
+ let i = parseFloat(e);
699
+ return Number.isFinite(i) ? {
700
+ kind: "cells",
701
+ value: t(i, n)
702
+ } : void 0;
703
+ }
704
+ function J(e) {
705
+ if (e === "min-content") return { kind: "min-content" };
706
+ if (e === "max-content") return { kind: "max-content" };
707
+ if (e === "fit-content") return { kind: "fit-content" };
708
+ }
709
+ function ue(e, t) {
710
+ return (t === "w" ? /(?:^|[\s:.[!])w-/ : /(?:^|[\s:.[!])h-/).test(e);
711
+ }
712
+ function de(e, t) {
713
+ return {
714
+ top: K(e.getPropertyValue("padding-top"), t),
715
+ right: K(e.getPropertyValue("padding-right"), t),
716
+ bottom: K(e.getPropertyValue("padding-bottom"), t),
717
+ left: K(e.getPropertyValue("padding-left"), t)
718
+ };
719
+ }
720
+ function fe(t) {
721
+ let n = (n, r) => t.getPropertyValue(r) === "none" ? 0 : e(parseFloat(t.getPropertyValue(n)) || 0);
722
+ return {
723
+ top: n("border-top-width", "border-top-style"),
724
+ right: n("border-right-width", "border-right-style"),
725
+ bottom: n("border-bottom-width", "border-bottom-style"),
726
+ left: n("border-left-width", "border-left-style")
727
+ };
728
+ }
729
+ //#endregion
730
+ //#region src/types.ts
731
+ function pe() {
732
+ return {
733
+ display: "block",
734
+ flexDirection: "row",
735
+ flexReverse: !1,
736
+ flexWrap: "nowrap",
737
+ wrapReverse: !1,
738
+ flexGrow: 0,
739
+ flexShrink: 0,
740
+ flexBasis: void 0,
741
+ order: 0,
742
+ justifyContent: "start",
743
+ alignItems: "start",
744
+ alignSelf: "auto",
745
+ width: void 0,
746
+ height: void 0,
747
+ minWidth: "auto",
748
+ minHeight: "auto",
749
+ maxWidth: void 0,
750
+ maxHeight: void 0,
751
+ padding: Y(),
752
+ margin: {
753
+ top: 0,
754
+ right: 0,
755
+ bottom: 0,
756
+ left: 0
757
+ },
758
+ gapX: 0,
759
+ gapY: 0,
760
+ border: Y(),
761
+ borderStyle: {
762
+ top: "solid",
763
+ right: "solid",
764
+ bottom: "solid",
765
+ left: "solid"
766
+ },
767
+ overflow: "visible",
768
+ whiteSpace: "normal",
769
+ textOverflow: "clip",
770
+ color: void 0,
771
+ backgroundColor: void 0,
772
+ borderColor: {
773
+ top: void 0,
774
+ right: void 0,
775
+ bottom: void 0,
776
+ left: void 0
777
+ },
778
+ textAlignBlocked: !1
779
+ };
780
+ }
781
+ function Y() {
782
+ return {
783
+ top: 0,
784
+ right: 0,
785
+ bottom: 0,
786
+ left: 0
787
+ };
788
+ }
789
+ //#endregion
790
+ //#region src/tree.ts
791
+ function X(e, t) {
792
+ let n = re(e, t);
793
+ if (n.display === "none") return null;
794
+ let r = Array.from(e.children);
795
+ if (r.every(he)) {
796
+ let t = Z(e).split("\n").map((e) => e.trim()).join("\n").trim(), r = ge(t), i = t.length > 0 ? _e(t) : 0;
797
+ return {
798
+ source: e,
799
+ style: n,
800
+ children: [],
801
+ text: t,
802
+ intrinsicWidth: r,
803
+ intrinsicHeight: i,
804
+ localRect: {
805
+ x: 0,
806
+ y: 0,
807
+ width: r,
808
+ height: i
809
+ },
810
+ unclampedHeight: 0,
811
+ resolvedPadding: Y()
812
+ };
813
+ }
814
+ let i = [];
815
+ for (let e of r) {
816
+ let n = X(e, t);
817
+ n && i.push(n);
818
+ }
819
+ return {
820
+ source: e,
821
+ style: n,
822
+ children: i,
823
+ text: "",
824
+ intrinsicWidth: 0,
825
+ intrinsicHeight: 0,
826
+ localRect: {
827
+ x: 0,
828
+ y: 0,
829
+ width: 0,
830
+ height: 0
831
+ },
832
+ unclampedHeight: 0,
833
+ resolvedPadding: Y()
834
+ };
835
+ }
836
+ var me = /* @__PURE__ */ new Set(/* @__PURE__ */ "A.ABBR.B.BDI.BDO.BR.CITE.CODE.DATA.DFN.EM.I.KBD.MARK.Q.S.SAMP.SMALL.SPAN.STRONG.SUB.SUP.TIME.U.VAR.WBR".split("."));
837
+ function he(e) {
838
+ if (me.has(e.tagName)) return !0;
839
+ let t = getComputedStyle(e).display;
840
+ return t.startsWith("inline") || t === "contents";
841
+ }
842
+ function Z(e) {
843
+ let t = [];
844
+ for (let n of Array.from(e.childNodes)) if (n.nodeType === Node.TEXT_NODE) t.push((n.textContent ?? "").replace(/[ \t\r\n\f]+/g, " "));
845
+ else if (n.nodeType === Node.ELEMENT_NODE) {
846
+ let e = n;
847
+ e.tagName === "BR" ? t.push("\n") : t.push(Z(e));
848
+ }
849
+ return t.join("");
850
+ }
851
+ function ge(e) {
852
+ let t = 0;
853
+ for (let n of e.split("\n")) n.length > t && (t = n.length);
854
+ return t;
855
+ }
856
+ function _e(e) {
857
+ return e.split("\n").length;
858
+ }
859
+ //#endregion
860
+ //#region src/element.ts
861
+ var ve = "\n<style>\n :host { display: block; position: relative; contain: layout style; }\n #viewport { position: relative; width: 100%; height: 100%; }\n #decorations { position: absolute; inset: 0; pointer-events: none; user-select: none; white-space: pre; }\n</style>\n<div id=\"viewport\">\n <div id=\"decorations\" aria-hidden=\"true\"></div>\n <slot></slot>\n</div>\n", Q = class extends HTMLElement {
862
+ #e;
863
+ #t;
864
+ #n = null;
865
+ #r = null;
866
+ #i = !1;
867
+ #a = 0;
868
+ #o = null;
869
+ constructor() {
870
+ super(), this.#e = this.attachShadow({ mode: "open" }), this.#e.innerHTML = ve, this.#t = this.#e.getElementById("decorations");
871
+ }
872
+ connectedCallback() {
873
+ this.#n = new ResizeObserver(() => this.#l()), this.#n.observe(this), this.#r = new MutationObserver((e) => {
874
+ this.#a > 0 || e.every(this.#c) || (e.some((e) => e.target === this && e.type === "attributes") && (this.#o = null), this.#l());
875
+ }), this.#r.observe(this, {
876
+ childList: !0,
877
+ subtree: !0,
878
+ characterData: !0,
879
+ attributes: !0,
880
+ attributeFilter: ["class", "style"]
881
+ }), document.fonts?.ready.then(this.#s).catch((e) => {
882
+ console.warn("[monowind] document.fonts.ready failed:", e);
883
+ }), document.fonts?.addEventListener("loadingdone", this.#s), this.#l();
884
+ }
885
+ disconnectedCallback() {
886
+ this.#n?.disconnect(), this.#r?.disconnect(), this.#n = null, this.#r = null, document.fonts?.removeEventListener("loadingdone", this.#s), this.#o = null;
887
+ }
888
+ #s = () => {
889
+ this.#o = null, this.#l();
890
+ };
891
+ #c = (e) => {
892
+ if (e.type !== "attributes") return !1;
893
+ let t = e.attributeName;
894
+ return t === "data-mw-laid-out" || t === "data-mw-ready" || t === "data-mw-text-align-blocked" || t === "data-mw-clip" || t === "data-mw-nowrap" || t === "style" && this.#a > 0;
895
+ };
896
+ #l() {
897
+ this.#i || (this.#i = !0, requestAnimationFrame(() => {
898
+ this.#i = !1;
899
+ try {
900
+ this.#u();
901
+ } catch (e) {
902
+ console.error("[monowind] layout failed:", e);
903
+ }
904
+ }));
905
+ }
906
+ #u() {
907
+ this.#a++, this.setAttribute("measuring", "");
908
+ try {
909
+ this.#o || (this.#o = r(this), this.style.setProperty("--mw-cw", `${this.#o.width}px`), this.style.setProperty("--mw-ch", `${this.#o.height}px`));
910
+ let e = this.#o, t = Math.max(0, Math.floor(this.clientWidth / e.width));
911
+ if (t === 0) return;
912
+ let n = i(), a = [];
913
+ for (let e of Array.from(this.children)) {
914
+ let t = X(e, n);
915
+ t && a.push(t);
916
+ }
917
+ if (a.length === 0) {
918
+ this.#t.replaceChildren(), this.setAttribute("data-mw-ready", "");
919
+ return;
920
+ }
921
+ let o = {
922
+ source: this,
923
+ style: pe(),
924
+ children: a,
925
+ text: "",
926
+ intrinsicWidth: 0,
927
+ intrinsicHeight: 0,
928
+ localRect: {
929
+ x: 0,
930
+ y: 0,
931
+ width: 0,
932
+ height: 0
933
+ },
934
+ unclampedHeight: 0,
935
+ resolvedPadding: {
936
+ top: 0,
937
+ right: 0,
938
+ bottom: 0,
939
+ left: 0
940
+ }
941
+ }, { height: s } = l(o, t);
942
+ ee(o, this.#t), this.style.height = `${s * e.height}px`, this.setAttribute("data-mw-ready", "");
943
+ } finally {
944
+ this.removeAttribute("measuring"), queueMicrotask(() => {
945
+ this.#r?.takeRecords(), this.#a--;
946
+ });
947
+ }
948
+ }
949
+ };
950
+ function ye() {
951
+ customElements.get("mono-wind") || customElements.define("mono-wind", Q);
952
+ }
953
+ //#endregion
954
+ //#region src/ascii.ts
955
+ function be(e) {
956
+ let t = e.localRect.width, n = e.localRect.height;
957
+ if (t <= 0 || n <= 0) return "";
958
+ let r = Array.from({ length: n }, () => Array.from({ length: t }, () => " "));
959
+ return $(e, 0, 0, (e, i, a) => {
960
+ e >= 0 && e < t && i >= 0 && i < n && (r[i][e] = a);
961
+ }), r.map((e) => e.join("").trimEnd()).join("\n");
962
+ }
963
+ function $(e, t, n, r) {
964
+ let i = t + e.localRect.x, o = n + e.localRect.y, s = e.style, c = [];
965
+ R(s, {
966
+ x: i,
967
+ y: o,
968
+ width: e.localRect.width,
969
+ height: e.localRect.height
970
+ }, c);
971
+ for (let e of c) for (let t = 0; t < e.length; t++) r(e.x + t, e.y, e.glyph);
972
+ if (e.children.length === 0 && e.text) {
973
+ let t = e.resolvedPadding, n = i + s.border.left + t.left, c = o + s.border.top + t.top, l = e.localRect.width - s.border.left - s.border.right - t.left - t.right, u = s.whiteSpace === "nowrap" ? e.text.split("\n").map((e) => xe(e, l, s)) : a(e.text, l);
974
+ for (let e = 0; e < u.length; e++) {
975
+ let t = u[e];
976
+ for (let i = 0; i < t.length; i++) r(n + i, c + e, t[i]);
977
+ }
978
+ }
979
+ for (let t of e.children) $(t, i, o, r);
980
+ }
981
+ function xe(e, t, n) {
982
+ return n.overflow !== "clip" || e.length <= t ? e : t <= 0 ? "" : n.textOverflow === "ellipsis" ? `${e.slice(0, t - 1)}…` : e.slice(0, t);
983
+ }
984
+ //#endregion
985
+ export { Q as MonoWindElement, ye as defineMonoWind, be as renderAscii };
986
+
987
+ //# sourceMappingURL=index.js.map