textmode.js 0.9.1 → 0.9.2-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/textmode.esm.js +1009 -1009
- package/dist/textmode.umd.js +13 -13
- package/package.json +1 -1
package/dist/textmode.esm.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var he = Object.defineProperty;
|
|
2
2
|
var oe = (n, t, e) => t in n ? he(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
3
|
var o = (n, t, e) => oe(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
class
|
|
4
|
+
class P extends Error {
|
|
5
5
|
constructor(t, e) {
|
|
6
|
-
super(
|
|
6
|
+
super(P.i(t, e)), this.name = "TextmodeError";
|
|
7
7
|
}
|
|
8
8
|
static i(t, e) {
|
|
9
9
|
return `${t}${e && Object.keys(e).length > 0 ? `
|
|
10
10
|
|
|
11
11
|
📋 Context:` + Object.entries(e).map(([i, s]) => `
|
|
12
|
-
- ${i}: ${
|
|
12
|
+
- ${i}: ${P.h(s)}`).join("") : ""}
|
|
13
13
|
|
|
14
14
|
${"↓".repeat(24)}
|
|
15
15
|
`;
|
|
@@ -19,21 +19,21 @@ ${"↓".repeat(24)}
|
|
|
19
19
|
if (t === void 0) return "undefined";
|
|
20
20
|
if (typeof t == "string") return `"${t}"`;
|
|
21
21
|
if (typeof t == "number" || typeof t == "boolean") return t + "";
|
|
22
|
-
if (Array.isArray(t)) return t.length === 0 ? "[]" : t.length <= 5 ? `[${t.map((e) =>
|
|
22
|
+
if (Array.isArray(t)) return t.length === 0 ? "[]" : t.length <= 5 ? `[${t.map((e) => P.h(e)).join(", ")}]` : `[${t.slice(0, 3).map((e) => P.h(e)).join(", ")}, ... +${t.length - 3} more]`;
|
|
23
23
|
if (typeof t == "object") {
|
|
24
24
|
const e = Object.keys(t);
|
|
25
|
-
return e.length === 0 ? "{}" : e.length <= 3 ? `{ ${e.map((i) => `${i}: ${
|
|
25
|
+
return e.length === 0 ? "{}" : e.length <= 3 ? `{ ${e.map((i) => `${i}: ${P.h(t[i])}`).join(", ")} }` : `{ ${e.slice(0, 2).map((i) => `${i}: ${P.h(t[i])}`).join(", ")}, ... +${e.length - 2} more }`;
|
|
26
26
|
}
|
|
27
27
|
return t + "";
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
var ae = ((n) => (n[n.SILENT = 0] = "SILENT", n[n.WARNING = 1] = "WARNING", n[n.ERROR = 2] = "ERROR", n[n.THROW = 3] = "THROW", n))(ae || {});
|
|
31
|
-
const
|
|
31
|
+
const B = class B {
|
|
32
32
|
constructor() {
|
|
33
33
|
o(this, "l", { globalLevel: 3 });
|
|
34
34
|
}
|
|
35
35
|
static u() {
|
|
36
|
-
return
|
|
36
|
+
return B.o || (B.o = new B()), B.o;
|
|
37
37
|
}
|
|
38
38
|
v(t, e) {
|
|
39
39
|
const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.", s = "color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;";
|
|
@@ -41,11 +41,11 @@ const _ = class _ {
|
|
|
41
41
|
case 0:
|
|
42
42
|
return !1;
|
|
43
43
|
case 1:
|
|
44
|
-
return console.group(i, s), console.warn(
|
|
44
|
+
return console.group(i, s), console.warn(P.i(t, e)), console.groupEnd(), !1;
|
|
45
45
|
case 2:
|
|
46
|
-
return console.group(i, s), console.error(
|
|
46
|
+
return console.group(i, s), console.error(P.i(t, e)), console.groupEnd(), !1;
|
|
47
47
|
default:
|
|
48
|
-
throw new
|
|
48
|
+
throw new P(t, e);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
m(t, e, i) {
|
|
@@ -55,8 +55,8 @@ const _ = class _ {
|
|
|
55
55
|
this.l.globalLevel = t;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
o(
|
|
59
|
-
let pt =
|
|
58
|
+
o(B, "o", null);
|
|
59
|
+
let pt = B;
|
|
60
60
|
const yt = pt.u();
|
|
61
61
|
class at {
|
|
62
62
|
constructor() {
|
|
@@ -82,29 +82,29 @@ function Rt(n, t, e, i) {
|
|
|
82
82
|
function q(n, t, e, i) {
|
|
83
83
|
return Math.hypot(e - n, i - t);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function X(n, t, e) {
|
|
86
86
|
return Math.min(Math.max(n, t), e);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function St(n) {
|
|
89
89
|
return (n % 360 + 360) % 360 / 360;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function Pt(n, t) {
|
|
92
92
|
n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, 1), n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, t);
|
|
93
93
|
}
|
|
94
94
|
function rt(n, t, e) {
|
|
95
|
-
n.bindTexture(n.TEXTURE_2D, t),
|
|
95
|
+
n.bindTexture(n.TEXTURE_2D, t), Pt(n, e), n.bindTexture(n.TEXTURE_2D, null);
|
|
96
96
|
}
|
|
97
97
|
function wt(n, t, e = n.NEAREST, i = n.NEAREST, s = n.CLAMP_TO_EDGE, r = n.CLAMP_TO_EDGE) {
|
|
98
98
|
const h = n.createTexture();
|
|
99
|
-
return n.bindTexture(n.TEXTURE_2D, h), Ot(n, e, i, s, r),
|
|
99
|
+
return n.bindTexture(n.TEXTURE_2D, h), Ot(n, e, i, s, r), Pt(n, t), n.bindTexture(n.TEXTURE_2D, null), h;
|
|
100
100
|
}
|
|
101
101
|
function Ot(n, t, e, i, s) {
|
|
102
102
|
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, t), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, e), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, i), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, s);
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function V(n, t, e, i, s, r = 0, h = WebGL2RenderingContext.FLOAT, a = !1) {
|
|
105
105
|
n.enableVertexAttribArray(t), n.vertexAttribPointer(t, e, h, a, i, s), n.vertexAttribDivisor(t, r);
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function Lt(n, t, e, i, s) {
|
|
108
108
|
n.bindBuffer(t, e), n.bufferData(t, i, s), n.bindBuffer(t, null);
|
|
109
109
|
}
|
|
110
110
|
function bt(n) {
|
|
@@ -123,9 +123,9 @@ class vt extends at {
|
|
|
123
123
|
o(this, "U", null);
|
|
124
124
|
o(this, "k");
|
|
125
125
|
o(this, "R");
|
|
126
|
-
o(this, "
|
|
127
|
-
o(this, "
|
|
128
|
-
this.M = i, this.F = s, this.$ = e, this.k =
|
|
126
|
+
o(this, "L", null);
|
|
127
|
+
o(this, "D", /* @__PURE__ */ new Map());
|
|
128
|
+
this.M = i, this.F = s, this.$ = e, this.k = X(r, 1, 8), this.R = a, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...h };
|
|
129
129
|
const l = e.getParameter(e.MAX_DRAW_BUFFERS), u = e.getParameter(e.MAX_COLOR_ATTACHMENTS);
|
|
130
130
|
this.k = Math.min(this.k, l, u), this.P = e.createFramebuffer(), this.O(), this.H(), this.l.depth && this.I();
|
|
131
131
|
}
|
|
@@ -167,13 +167,13 @@ class vt extends at {
|
|
|
167
167
|
rt(this.$, this.S[0], e);
|
|
168
168
|
}
|
|
169
169
|
resize(e, i) {
|
|
170
|
-
this.M = e, this.F = i, this.
|
|
170
|
+
this.M = e, this.F = i, this.D.clear();
|
|
171
171
|
const s = this.$;
|
|
172
172
|
for (const r of this.S) this.G(r, !0);
|
|
173
|
-
s.bindTexture(s.TEXTURE_2D, null), this.j(), this.
|
|
173
|
+
s.bindTexture(s.TEXTURE_2D, null), this.j(), this.L = null;
|
|
174
174
|
}
|
|
175
175
|
readPixels(e) {
|
|
176
|
-
const i = this.
|
|
176
|
+
const i = this.D.get(e);
|
|
177
177
|
if (i) return i;
|
|
178
178
|
const s = this.$, r = this.M, h = this.F, a = new Uint8Array(r * h * 4), l = s.getParameter(s.READ_FRAMEBUFFER_BINDING);
|
|
179
179
|
s.bindFramebuffer(s.READ_FRAMEBUFFER, this.P), s.readBuffer(s.COLOR_ATTACHMENT0 + e), s.readPixels(0, 0, r, h, s.RGBA, s.UNSIGNED_BYTE, a), s.bindFramebuffer(s.READ_FRAMEBUFFER, l);
|
|
@@ -182,22 +182,22 @@ class vt extends at {
|
|
|
182
182
|
const g = (h - 1 - f) * u, p = f * u;
|
|
183
183
|
c.set(a.subarray(g, g + u), p);
|
|
184
184
|
}
|
|
185
|
-
return this.
|
|
185
|
+
return this.D.set(e, c), c;
|
|
186
186
|
}
|
|
187
187
|
begin() {
|
|
188
188
|
const e = this.$;
|
|
189
|
-
this.
|
|
189
|
+
this.D.clear(), this.R.X(), this.R.Y(this.P, this.M, this.F, this.k), this.l.depth && e.clear(e.DEPTH_BUFFER_BIT), this.R.state.K();
|
|
190
190
|
}
|
|
191
191
|
end() {
|
|
192
192
|
this.R.state.W(), this.R.Z(), this.R.q();
|
|
193
193
|
}
|
|
194
194
|
V() {
|
|
195
|
-
return this.
|
|
195
|
+
return this.L || this.J(), this.L;
|
|
196
196
|
}
|
|
197
197
|
J() {
|
|
198
198
|
if (!this.R) return;
|
|
199
|
-
const e = this.k > 1, i = this.k > 2, s = this.k > 3, r = {
|
|
200
|
-
this.
|
|
199
|
+
const e = this.k > 1, i = this.k > 2, s = this.k > 3, r = { Ue: this.S[0], Uf: e ? this.S[1] : this.S[0], Ug: i ? this.S[2] : this.S[0], Uh: s ? this.S[3] : this.S[0], Ui: [this.M, this.F], Uj: e, Uk: i, Ul: s }, h = this.R.materialManager.tt;
|
|
200
|
+
this.L = this.R.materialManager.st(h, r);
|
|
201
201
|
}
|
|
202
202
|
dispose() {
|
|
203
203
|
const e = this.$;
|
|
@@ -221,7 +221,7 @@ class vt extends at {
|
|
|
221
221
|
return this.k;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function D(n) {
|
|
225
225
|
return typeof n == "object" && n !== null && "textures" in n && Array.isArray(n.textures);
|
|
226
226
|
}
|
|
227
227
|
function Ut(n) {
|
|
@@ -231,7 +231,7 @@ function Ut(n) {
|
|
|
231
231
|
const t = n[0];
|
|
232
232
|
return typeof t == "number" || !!Array.isArray(t);
|
|
233
233
|
}
|
|
234
|
-
return n instanceof Float32Array || n instanceof Int32Array || !!
|
|
234
|
+
return n instanceof Float32Array || n instanceof Int32Array || !!D(n) || typeof WebGLTexture < "u" && n instanceof WebGLTexture;
|
|
235
235
|
}
|
|
236
236
|
class j extends at {
|
|
237
237
|
constructor(e, i, s) {
|
|
@@ -279,7 +279,7 @@ class j extends at {
|
|
|
279
279
|
}
|
|
280
280
|
vt() {
|
|
281
281
|
this.ht = 0, this.ot.clear();
|
|
282
|
-
for (const [e, i] of this.nt) (i instanceof WebGLTexture ||
|
|
282
|
+
for (const [e, i] of this.nt) (i instanceof WebGLTexture || D(i)) && this.nt.delete(e);
|
|
283
283
|
}
|
|
284
284
|
gt(e) {
|
|
285
285
|
for (const i in e) this._t(i, e[i]);
|
|
@@ -289,8 +289,8 @@ class j extends at {
|
|
|
289
289
|
if (!s) return;
|
|
290
290
|
const r = this.nt.get(e);
|
|
291
291
|
let h = !0;
|
|
292
|
-
if (r !== void 0 && (typeof i == "number" || typeof i == "boolean" ? r === i && (h = !1) : (i instanceof WebGLTexture ||
|
|
293
|
-
typeof i == "number" || typeof i == "boolean" || i instanceof WebGLTexture ||
|
|
292
|
+
if (r !== void 0 && (typeof i == "number" || typeof i == "boolean" ? r === i && (h = !1) : (i instanceof WebGLTexture || D(i)) && r === i && (h = !1)), !h) return;
|
|
293
|
+
typeof i == "number" || typeof i == "boolean" || i instanceof WebGLTexture || D(i) ? this.nt.set(e, i) : this.nt.delete(e);
|
|
294
294
|
const a = this.rt.get(e);
|
|
295
295
|
if (!a) return;
|
|
296
296
|
const { type: l, size: u } = a, c = this.$;
|
|
@@ -298,7 +298,7 @@ class j extends at {
|
|
|
298
298
|
const f = this.yt(e);
|
|
299
299
|
return c.uniform1i(s, f), c.activeTexture(c.TEXTURE0 + f), void c.bindTexture(c.TEXTURE_2D, i);
|
|
300
300
|
}
|
|
301
|
-
if (
|
|
301
|
+
if (D(i)) {
|
|
302
302
|
const f = this.yt(e);
|
|
303
303
|
return c.uniform1i(s, f), c.activeTexture(c.TEXTURE0 + f), void c.bindTexture(c.TEXTURE_2D, i.textures[0]);
|
|
304
304
|
}
|
|
@@ -371,12 +371,12 @@ class j extends at {
|
|
|
371
371
|
this.$.deleteProgram(this.et), super.dispose();
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
|
-
const
|
|
374
|
+
const Xt = /* @__PURE__ */ new WeakMap();
|
|
375
375
|
function ft(n, t) {
|
|
376
|
-
|
|
376
|
+
Xt.set(n, t);
|
|
377
377
|
}
|
|
378
|
-
function
|
|
379
|
-
return
|
|
378
|
+
function _t(n) {
|
|
379
|
+
return Xt.get(n);
|
|
380
380
|
}
|
|
381
381
|
function it(n, t, e, i, s = 255) {
|
|
382
382
|
n[0] = t / 255, n[1] = (e ?? t) / 255, n[2] = (i ?? t) / 255, n[3] = s / 255;
|
|
@@ -397,20 +397,20 @@ class lt {
|
|
|
397
397
|
o(this, "Et", !1);
|
|
398
398
|
o(this, "kt", !1);
|
|
399
399
|
o(this, "Rt", !1);
|
|
400
|
-
o(this, "
|
|
401
|
-
o(this, "
|
|
400
|
+
o(this, "Lt", 0);
|
|
401
|
+
o(this, "Dt", [0, 0, 0, 1]);
|
|
402
402
|
o(this, "Ot", !1);
|
|
403
403
|
o(this, "zt", []);
|
|
404
404
|
o(this, "Ht", []);
|
|
405
405
|
}
|
|
406
406
|
static Bt() {
|
|
407
|
-
return { It: 1, wt: 0, bt: 0, Ct: 0, xt: 0, Mt: 0, Ft: 0,
|
|
407
|
+
return { It: 1, wt: 0, bt: 0, Ct: 0, xt: 0, Mt: 0, Ft: 0, Lt: 0, Gt: !1, jt: !1, Rt: !1, Ot: !1, Qt: [0, 0, 0], Nt: "", Xt: [1, 1, 1, 1], Yt: [0, 0, 0, 1] };
|
|
408
408
|
}
|
|
409
409
|
Kt(t) {
|
|
410
|
-
t.It = this.At, t.wt = this.wt, t.bt = this.bt, t.Ct = this.Ct, t.xt = this.xt, t.Mt = this.Mt, t.Ft = this.Ft, t.Gt = this.Et, t.jt = this.kt, t.Rt = this.Rt, t.
|
|
410
|
+
t.It = this.At, t.wt = this.wt, t.bt = this.bt, t.Ct = this.Ct, t.xt = this.xt, t.Mt = this.Mt, t.Ft = this.Ft, t.Gt = this.Et, t.jt = this.kt, t.Rt = this.Rt, t.Lt = this.Lt, t.Ot = this.Ot, t.Qt[0] = this.$t[0], t.Qt[1] = this.$t[1], t.Qt[2] = this.$t[2], t.Nt = this.Pt, t.Xt[0] = this.Tt[0], t.Xt[1] = this.Tt[1], t.Xt[2] = this.Tt[2], t.Xt[3] = this.Tt[3], t.Yt[0] = this.St[0], t.Yt[1] = this.St[1], t.Yt[2] = this.St[2], t.Yt[3] = this.St[3];
|
|
411
411
|
}
|
|
412
412
|
Wt(t) {
|
|
413
|
-
this.At = t.It, this.wt = t.wt, this.bt = t.bt, this.Ct = t.Ct, this.xt = t.xt, this.Mt = t.Mt, this.Ft = t.Ft, this.Et = t.Gt, this.kt = t.jt, this.Rt = t.Rt, this.
|
|
413
|
+
this.At = t.It, this.wt = t.wt, this.bt = t.bt, this.Ct = t.Ct, this.xt = t.xt, this.Mt = t.Mt, this.Ft = t.Ft, this.Et = t.Gt, this.kt = t.jt, this.Rt = t.Rt, this.Lt = t.Lt, this.Ot = t.Ot, this.$t[0] = t.Qt[0], this.$t[1] = t.Qt[1], this.$t[2] = t.Qt[2], this.Pt = t.Nt, this.Tt[0] = t.Xt[0], this.Tt[1] = t.Xt[1], this.Tt[2] = t.Xt[2], this.Tt[3] = t.Xt[3], this.St[0] = t.Yt[0], this.St[1] = t.Yt[1], this.St[2] = t.Yt[2], this.St[3] = t.Yt[3];
|
|
414
414
|
}
|
|
415
415
|
K() {
|
|
416
416
|
let t = this.Ht.pop();
|
|
@@ -472,16 +472,16 @@ class lt {
|
|
|
472
472
|
this.Rt = t;
|
|
473
473
|
}
|
|
474
474
|
gs(t) {
|
|
475
|
-
this.
|
|
475
|
+
this.Lt = St(t);
|
|
476
476
|
}
|
|
477
477
|
_s(t, e, i, s) {
|
|
478
|
-
it(this.
|
|
478
|
+
it(this.Dt, t, e, i, s);
|
|
479
479
|
}
|
|
480
480
|
As(t) {
|
|
481
481
|
this.Ot = t;
|
|
482
482
|
}
|
|
483
483
|
get canvasBackgroundColor() {
|
|
484
|
-
return this.
|
|
484
|
+
return this.Dt;
|
|
485
485
|
}
|
|
486
486
|
get charColor() {
|
|
487
487
|
return this.Tt;
|
|
@@ -520,7 +520,7 @@ class lt {
|
|
|
520
520
|
return this.Ct;
|
|
521
521
|
}
|
|
522
522
|
get charRotation() {
|
|
523
|
-
return this.
|
|
523
|
+
return this.Lt;
|
|
524
524
|
}
|
|
525
525
|
get flipX() {
|
|
526
526
|
return this.Et;
|
|
@@ -541,12 +541,12 @@ class le {
|
|
|
541
541
|
this.$ = t, this.$s = t.createBuffer(), this.Ps = new Float32Array(mt.length);
|
|
542
542
|
}
|
|
543
543
|
Ts(t, e, i, s) {
|
|
544
|
-
const r = this.$, h =
|
|
544
|
+
const r = this.$, h = _t(this.$), a = h[2], l = h[3], u = t / a * 2 - 1, c = (t + i) / a * 2 - 1, f = 1 - (e + s) / l * 2, g = 1 - e / l * 2, p = mt, v = this.Ps;
|
|
545
545
|
for (let d = 0; d < p.length; d += 4) {
|
|
546
546
|
const m = p[d], A = p[d + 1], w = p[d + 2], y = p[d + 3], R = u + (m + 0.5) * (c - u), b = f + (A + 0.5) * (g - f);
|
|
547
547
|
v[d] = R, v[d + 1] = b, v[d + 2] = w, v[d + 3] = y;
|
|
548
548
|
}
|
|
549
|
-
r.bindBuffer(r.ARRAY_BUFFER, this.$s), r.bufferData(r.ARRAY_BUFFER, v, r.DYNAMIC_DRAW),
|
|
549
|
+
r.bindBuffer(r.ARRAY_BUFFER, this.$s), r.bufferData(r.ARRAY_BUFFER, v, r.DYNAMIC_DRAW), V(r, 0, 2, 16, 0), V(r, 1, 2, 16, 8), r.drawArrays(r.TRIANGLES, 0, 6), r.disableVertexAttribArray(1), r.disableVertexAttribArray(0), r.bindBuffer(r.ARRAY_BUFFER, null);
|
|
550
550
|
}
|
|
551
551
|
Ss() {
|
|
552
552
|
this.$.deleteBuffer(this.$s);
|
|
@@ -564,25 +564,25 @@ class ue {
|
|
|
564
564
|
Rs(t, e, i, s) {
|
|
565
565
|
const r = this.$, h = t.program;
|
|
566
566
|
let a = this.Es.get(t);
|
|
567
|
-
a || (a = /* @__PURE__ */ new Map(), this.Es.set(t, a), t.C(() => this.
|
|
567
|
+
a || (a = /* @__PURE__ */ new Map(), this.Es.set(t, a), t.C(() => this.Ls(t)));
|
|
568
568
|
let l = a.get(e) || null;
|
|
569
569
|
if (l) this.ks !== l && (r.bindVertexArray(l), this.ks = l);
|
|
570
570
|
else {
|
|
571
571
|
l = r.createVertexArray(), a.set(e, l), r.bindVertexArray(l), this.ks = l, r.bindBuffer(r.ARRAY_BUFFER, s);
|
|
572
572
|
const u = r.getAttribLocation(h, "A0");
|
|
573
|
-
u !== -1 &&
|
|
573
|
+
u !== -1 && V(r, u, i.Cs.Ms.size, i.ws, i.Cs.Ms.offset, 0, r.FLOAT, !1);
|
|
574
574
|
const c = r.getAttribLocation(h, "A1");
|
|
575
|
-
c !== -1 &&
|
|
575
|
+
c !== -1 && V(r, c, i.Cs.Fs.size, i.ws, i.Cs.Fs.offset, 0, r.FLOAT, !1);
|
|
576
576
|
}
|
|
577
577
|
}
|
|
578
|
-
|
|
578
|
+
Ls(t) {
|
|
579
579
|
const e = this.Es.get(t);
|
|
580
580
|
if (e) {
|
|
581
581
|
for (const [, i] of e) i && this.$.deleteVertexArray(i);
|
|
582
582
|
this.Es.delete(t);
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
|
-
|
|
585
|
+
Ds() {
|
|
586
586
|
this.ks !== null && (this.$.bindVertexArray(null), this.ks = null);
|
|
587
587
|
}
|
|
588
588
|
Ss() {
|
|
@@ -590,15 +590,15 @@ class ue {
|
|
|
590
590
|
this.Es.clear();
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
|
-
class
|
|
593
|
+
class L {
|
|
594
594
|
}
|
|
595
|
-
o(
|
|
595
|
+
o(L, "BYTES_PER_INSTANCE", 144), o(L, "FLOATS_PER_INSTANCE", 36);
|
|
596
596
|
function O(n, t) {
|
|
597
|
-
return { location: -1, size: n, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride:
|
|
597
|
+
return { location: -1, size: n, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: L.BYTES_PER_INSTANCE, offset: t, divisor: 1 };
|
|
598
598
|
}
|
|
599
599
|
class nt {
|
|
600
600
|
}
|
|
601
|
-
o(nt, "STRIDE",
|
|
601
|
+
o(nt, "STRIDE", L.BYTES_PER_INSTANCE), o(nt, "ATTRIBUTES", { A2: O(2, 0), A3: O(2, 8), A4: O(3, 16), A5: O(4, 28), A6: O(4, 44), A7: O(4, 60), A8: O(3, 76), A9: O(3, 88), Aa: O(4, 100), Ab: O(4, 116), Ac: O(3, 132) });
|
|
602
602
|
class fe {
|
|
603
603
|
constructor(t = 1e3, e = 1.5) {
|
|
604
604
|
o(this, "Os");
|
|
@@ -607,14 +607,14 @@ class fe {
|
|
|
607
607
|
o(this, "Bs", 0);
|
|
608
608
|
o(this, "Is", 0);
|
|
609
609
|
this.zs = t, this.Hs = e;
|
|
610
|
-
const i = t *
|
|
610
|
+
const i = t * L.FLOATS_PER_INSTANCE;
|
|
611
611
|
this.Os = new Float32Array(i);
|
|
612
612
|
}
|
|
613
613
|
Gs(t) {
|
|
614
614
|
if (t <= this.zs) return;
|
|
615
615
|
const e = Math.ceil(t * this.Hs), i = this.zs;
|
|
616
616
|
this.zs = e;
|
|
617
|
-
const s = new Float32Array(e *
|
|
617
|
+
const s = new Float32Array(e * L.FLOATS_PER_INSTANCE), r = i * L.FLOATS_PER_INSTANCE;
|
|
618
618
|
s.set(this.Os.subarray(0, Math.min(r, this.Bs))), this.Os = s;
|
|
619
619
|
}
|
|
620
620
|
js(t) {
|
|
@@ -649,7 +649,7 @@ class de {
|
|
|
649
649
|
const e = this.Os.Os, i = this.Os.Bs;
|
|
650
650
|
e[i + 0] = t.x, e[i + 1] = t.y, e[i + 2] = t.width, e[i + 3] = t.height, e[i + 4] = t.char0, e[i + 5] = t.char1, e[i + 6] = t.char2, e[i + 7] = t.r1, e[i + 8] = t.g1, e[i + 9] = t.b1, e[i + 10] = t.a1, e[i + 11] = t.r2, e[i + 12] = t.g2, e[i + 13] = t.b2, e[i + 14] = t.a2, e[i + 15] = t.invert, e[i + 16] = t.flipX, e[i + 17] = t.flipY, e[i + 18] = t.charRot, e[i + 19] = t.translationX, e[i + 20] = t.translationY, e[i + 21] = t.translationZ, e[i + 22] = t.rotationX, e[i + 23] = t.rotationY, e[i + 24] = t.rotationZ;
|
|
651
651
|
const s = t.curveParams0, r = t.curveParams1;
|
|
652
|
-
return e[i + 25] = s[0], e[i + 26] = s[1], e[i + 27] = s[2], e[i + 28] = s[3], e[i + 29] = r[0], e[i + 30] = r[1], e[i + 31] = r[2], e[i + 32] = r[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Os.js(
|
|
652
|
+
return e[i + 25] = s[0], e[i + 26] = s[1], e[i + 27] = s[2], e[i + 28] = s[3], e[i + 29] = r[0], e[i + 30] = r[1], e[i + 31] = r[2], e[i + 32] = r[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Os.js(L.FLOATS_PER_INSTANCE), this.Os.Is - 1;
|
|
653
653
|
}
|
|
654
654
|
get Xs() {
|
|
655
655
|
return this.Os.Xs;
|
|
@@ -668,8 +668,8 @@ class ge {
|
|
|
668
668
|
ee(t) {
|
|
669
669
|
const e = this.$;
|
|
670
670
|
this.qs && e.deleteBuffer(this.qs), this.te++, this.qs = e.createBuffer();
|
|
671
|
-
const i = t *
|
|
672
|
-
|
|
671
|
+
const i = t * L.BYTES_PER_INSTANCE;
|
|
672
|
+
Lt(e, e.ARRAY_BUFFER, this.qs, i, e.DYNAMIC_DRAW), this.Vs = t;
|
|
673
673
|
}
|
|
674
674
|
ie(t) {
|
|
675
675
|
this.ee(t);
|
|
@@ -681,7 +681,7 @@ class ge {
|
|
|
681
681
|
if (e === 0) return;
|
|
682
682
|
const i = this.$;
|
|
683
683
|
i.bindBuffer(i.ARRAY_BUFFER, this.qs);
|
|
684
|
-
const s = e *
|
|
684
|
+
const s = e * L.FLOATS_PER_INSTANCE;
|
|
685
685
|
i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, s);
|
|
686
686
|
}
|
|
687
687
|
ne(t) {
|
|
@@ -703,7 +703,7 @@ class ge {
|
|
|
703
703
|
const s = this.ne(i);
|
|
704
704
|
for (const [r, h] of s) {
|
|
705
705
|
const a = nt.ATTRIBUTES[r];
|
|
706
|
-
a &&
|
|
706
|
+
a && V(e, h, a.size, a.stride, a.offset, a.divisor, a.type, a.normalized);
|
|
707
707
|
}
|
|
708
708
|
this.se.set(i, this.te);
|
|
709
709
|
}
|
|
@@ -724,7 +724,7 @@ class pe {
|
|
|
724
724
|
const e = this.Os;
|
|
725
725
|
e.Is >= e.zs && e.Gs(e.Is + 1);
|
|
726
726
|
const i = e.Os, s = e.Bs;
|
|
727
|
-
return i[s + 0] = t.Ms[0], i[s + 1] = t.Ms[1], i[s + 2] = t.le[0], i[s + 3] = t.le[1], i[s + 4] = t.Qt[0], i[s + 5] = t.Qt[1], i[s + 6] = t.Qt[2], i[s + 7] = t.Xt[0], i[s + 8] = t.Xt[1], i[s + 9] = t.Xt[2], i[s + 10] = t.Xt[3], i[s + 11] = t.Yt[0], i[s + 12] = t.Yt[1], i[s + 13] = t.Yt[2], i[s + 14] = t.Yt[3], i[s + 15] = t.ue[0], i[s + 16] = t.ue[1], i[s + 17] = t.ue[2], i[s + 18] = t.
|
|
727
|
+
return i[s + 0] = t.Ms[0], i[s + 1] = t.Ms[1], i[s + 2] = t.le[0], i[s + 3] = t.le[1], i[s + 4] = t.Qt[0], i[s + 5] = t.Qt[1], i[s + 6] = t.Qt[2], i[s + 7] = t.Xt[0], i[s + 8] = t.Xt[1], i[s + 9] = t.Xt[2], i[s + 10] = t.Xt[3], i[s + 11] = t.Yt[0], i[s + 12] = t.Yt[1], i[s + 13] = t.Yt[2], i[s + 14] = t.Yt[3], i[s + 15] = t.ue[0], i[s + 16] = t.ue[1], i[s + 17] = t.ue[2], i[s + 18] = t.Lt, i[s + 19] = ((r = t.fe) == null ? void 0 : r[0]) ?? 0, i[s + 20] = ((h = t.fe) == null ? void 0 : h[1]) ?? 0, i[s + 21] = ((a = t.fe) == null ? void 0 : a[2]) ?? 0, i[s + 22] = ((l = t.de) == null ? void 0 : l[0]) ?? 0, i[s + 23] = ((u = t.de) == null ? void 0 : u[1]) ?? 0, i[s + 24] = ((c = t.de) == null ? void 0 : c[2]) ?? 0, t.pe && t.ve ? (i[s + 25] = ((f = t.ge) == null ? void 0 : f[0]) ?? 0, i[s + 26] = ((g = t.ge) == null ? void 0 : g[1]) ?? 0, i[s + 27] = ((p = t.me) == null ? void 0 : p[0]) ?? 0, i[s + 28] = ((v = t.me) == null ? void 0 : v[1]) ?? 0, i[s + 29] = t.pe[0], i[s + 30] = t.pe[1], i[s + 31] = t.ve[0], i[s + 32] = t.ve[1]) : t._e ? (i[s + 25] = t._e[0], i[s + 26] = t._e[1], i[s + 27] = 0, i[s + 28] = 0, i[s + 29] = 0, i[s + 30] = 0, i[s + 31] = 0, i[s + 32] = 0) : (i[s + 25] = 0, i[s + 26] = 0, i[s + 27] = 0, i[s + 28] = 0, i[s + 29] = 0, i[s + 30] = 0, i[s + 31] = 0, i[s + 32] = 0), i[s + 33] = t.ye || 0, i[s + 34] = t.Ae || 0, i[s + 35] = t.we || 0, e.js(L.FLOATS_PER_INSTANCE), e.Is - 1;
|
|
728
728
|
}
|
|
729
729
|
be() {
|
|
730
730
|
this.Os.Ys > this.ae.Ys && this.ae.ie(this.Os.Ys);
|
|
@@ -772,7 +772,7 @@ class I {
|
|
|
772
772
|
var r, h;
|
|
773
773
|
this.$ = t, this.Me = e, this.Fe = i, this.$e = s, this.Ee = (r = this.Te, h = this.Se, { x: 0, y: 0, width: 0, height: 0, char0: 0, char1: 0, char2: 0, r1: 0, g1: 0, b1: 0, a1: 0, r2: 0, g2: 0, b2: 0, a2: 0, invert: 0, flipX: 0, flipY: 0, charRot: 0, translationX: 0, translationY: 0, translationZ: 0, rotationX: 0, rotationY: 0, rotationZ: 0, curveParams0: r, curveParams1: h, depth: 0, baseZ: 0, geometryType: 0 });
|
|
774
774
|
const a = this.$.createBuffer();
|
|
775
|
-
|
|
775
|
+
Lt(this.$, this.$.ARRAY_BUFFER, a, this.$e.ke, this.$.STATIC_DRAW), this.Pe = a;
|
|
776
776
|
}
|
|
777
777
|
get type() {
|
|
778
778
|
return this.Fe;
|
|
@@ -789,20 +789,20 @@ class I {
|
|
|
789
789
|
Re() {
|
|
790
790
|
this.Me.xe();
|
|
791
791
|
}
|
|
792
|
-
|
|
792
|
+
Le() {
|
|
793
793
|
return !this.Me.Ws;
|
|
794
794
|
}
|
|
795
795
|
Ss() {
|
|
796
796
|
this.Me.Ss(), this.$.deleteBuffer(this.Pe);
|
|
797
797
|
}
|
|
798
|
-
|
|
798
|
+
De(t, e, i) {
|
|
799
799
|
return this.Me.ce(t);
|
|
800
800
|
}
|
|
801
801
|
Oe(t, e, i, s, r, h) {
|
|
802
802
|
const a = r.wt ?? 0, l = r.bt ?? 0, u = r.Ct ?? 0, c = r.xt ?? 0, f = r.Mt ?? 0, g = r.Ft ?? 0, p = this.Te, v = this.Se;
|
|
803
803
|
p[0] = 0, p[1] = 0, p[2] = 0, p[3] = 0, v[0] = 0, v[1] = 0, v[2] = 0, v[3] = 0, h && (h.bezStartX !== void 0 && h.bezStartY !== void 0 && h.bezEndX !== void 0 && h.bezEndY !== void 0 ? (p[0] = h.cp1x ?? 0, p[1] = h.cp1y ?? 0, p[2] = h.cp2x ?? 0, p[3] = h.cp2y ?? 0, v[0] = h.bezStartX ?? 0, v[1] = h.bezStartY ?? 0, v[2] = h.bezEndX ?? 0, v[3] = h.bezEndY ?? 0) : h.arcStart === void 0 && h.arcStop === void 0 || (p[0] = h.arcStart ?? 0, p[1] = h.arcStop ?? 0));
|
|
804
804
|
const d = this.Ee;
|
|
805
|
-
return d.x = t, d.y = e, d.width = i, d.height = s, d.char0 = r.Qt[0], d.char1 = r.Qt[1], d.char2 = r.Qt[2], d.r1 = r.Xt[0], d.g1 = r.Xt[1], d.b1 = r.Xt[2], d.a1 = r.Xt[3], d.r2 = r.Yt[0], d.g2 = r.Yt[1], d.b2 = r.Yt[2], d.a2 = r.Yt[3], d.invert = r.Rt ? 1 : 0, d.flipX = r.Gt ? 1 : 0, d.flipY = r.jt ? 1 : 0, d.charRot = r.
|
|
805
|
+
return d.x = t, d.y = e, d.width = i, d.height = s, d.char0 = r.Qt[0], d.char1 = r.Qt[1], d.char2 = r.Qt[2], d.r1 = r.Xt[0], d.g1 = r.Xt[1], d.b1 = r.Xt[2], d.a1 = r.Xt[3], d.r2 = r.Yt[0], d.g2 = r.Yt[1], d.b2 = r.Yt[2], d.a2 = r.Yt[3], d.invert = r.Rt ? 1 : 0, d.flipX = r.Gt ? 1 : 0, d.flipY = r.jt ? 1 : 0, d.charRot = r.Lt, d.translationX = a, d.translationY = l, d.translationZ = u, d.rotationX = c, d.rotationY = f, d.rotationZ = g, d.depth = (h == null ? void 0 : h.depth) ?? 0, d.baseZ = (h == null ? void 0 : h.baseZ) ?? 0, d.geometryType = ce[this.Fe] ?? 0, this.Me.writer.Zs(d);
|
|
806
806
|
}
|
|
807
807
|
}
|
|
808
808
|
const ve = { ke: mt, ze: 6, ...k }, me = { ke: new Float32Array([0, -0.5, 0, 0, 1, -0.5, 1, 0, 0, 0.5, 0, 1, 0, 0.5, 0, 1, 1, -0.5, 1, 0, 1, 0.5, 1, 1]), ze: 6, ...k }, Ae = { ke: function(n = 32) {
|
|
@@ -891,12 +891,12 @@ class Ee {
|
|
|
891
891
|
Qe(t) {
|
|
892
892
|
this.Ie = null, this.Ge.clear(), this.je = null;
|
|
893
893
|
let e = null, i = null, s = null, r = !1;
|
|
894
|
-
for (const h of t) e === h.material && i === h.type && r === h.state.Ot || (s && s.
|
|
895
|
-
s && s.
|
|
894
|
+
for (const h of t) e === h.material && i === h.type && r === h.state.Ot || (s && s.Le() && this.Ne(s, e, i, r), e = h.material, i = h.type, s = this.He.get(i), r = h.state.Ot, s.Re()), s.ce(h.params, h.state);
|
|
895
|
+
s && s.Le() && this.Ne(s, e, i, r), this.Be.Ds();
|
|
896
896
|
}
|
|
897
897
|
Ne(t, e, i, s) {
|
|
898
898
|
if (this.Ie !== e.shader && (e.shader.dt(), this.Ie = e.shader), this.je !== e && (e.shader.gt(e.uniforms), this.je = e), this.Ge.get(e.shader) !== s) {
|
|
899
|
-
const a =
|
|
899
|
+
const a = _t(this.$);
|
|
900
900
|
e.shader.gt({ Ur: a[2] / a[3], Us: [a[2], a[3]], Ut: 1, Uu: s ? 1 : 0 }), this.Ge.set(e.shader, s);
|
|
901
901
|
}
|
|
902
902
|
const r = t.unitGeometry, h = t.unitBuffer;
|
|
@@ -911,7 +911,7 @@ class Ee {
|
|
|
911
911
|
this.He.clear(), this.Be.Ss();
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
|
-
function
|
|
914
|
+
function Bt(n) {
|
|
915
915
|
let t = 0;
|
|
916
916
|
for (let e = 0; e < n.length; e++)
|
|
917
917
|
t = (t << 5) - t + n.charCodeAt(e), t &= t;
|
|
@@ -921,11 +921,11 @@ const Tt = /* @__PURE__ */ new WeakMap();
|
|
|
921
921
|
let Re = 1;
|
|
922
922
|
function Ft(n) {
|
|
923
923
|
if (n == null) return 0;
|
|
924
|
-
if (typeof n != "object" && typeof n != "function") return
|
|
924
|
+
if (typeof n != "object" && typeof n != "function") return Bt(n + "");
|
|
925
925
|
let t = Tt.get(n);
|
|
926
926
|
return t || (t = Re++, Tt.set(n, t)), t;
|
|
927
927
|
}
|
|
928
|
-
function
|
|
928
|
+
function H(n, t) {
|
|
929
929
|
return (n << 5) - n + t;
|
|
930
930
|
}
|
|
931
931
|
const ht = `#version 300 es
|
|
@@ -939,7 +939,7 @@ class Te {
|
|
|
939
939
|
o(this, "Ze", /* @__PURE__ */ new Map());
|
|
940
940
|
this.Ye = new j(t, ht, `#version 300 es
|
|
941
941
|
precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellColor;in vec4 v_glyphFlags;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){int B=int(v_glyphFlags.r>0.5?1:0);int C=int(v_glyphFlags.g>0.5?1:0);int D=int(v_glyphFlags.b>0.5?1:0);float E=float(B|(C<<1)|(D<<2))/255.;o_character=vec4(v_glyphIndex.xy,E,clamp(v_glyphFlags.a,0.,1.));o_primaryColor=vec4(v_glyphColor.rgb,v_glyphColor.a);o_secondaryColor=vec4(v_cellColor.rgb,v_cellColor.a);A=vec4(0.);}`), this.Ke = new j(t, ht, `#version 300 es
|
|
942
|
-
precision highp float;in vec2 v_uv;uniform sampler2D
|
|
942
|
+
precision highp float;in vec2 v_uv;uniform sampler2D Ue;uniform sampler2D Uf;uniform sampler2D Ug;uniform sampler2D Uh;uniform vec2 Ui;uniform bool Uj;uniform bool Uk;uniform bool Ul;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){vec2 B=vec2(v_uv.x,1.-v_uv.y);vec2 C=B*Ui;vec2 D=(floor(C)+0.5f)/Ui;vec4 E=texture(Ue,D);vec4 F=Uj?texture(Uf,D):vec4(0.);if(Uj&&F.a==0.){discard;}vec4 G=Uk?texture(Ug,D):vec4(0.);vec4 H=Ul?texture(Uh,D):vec4(0.);o_character=E;o_primaryColor=F;o_secondaryColor=G;A=H;}`), this.We = { id: this.Xe++, shader: this.Ye, uniforms: Object.freeze({}), hash: this.qe(this.Ye, {}), isBuiltIn: !0 };
|
|
943
943
|
}
|
|
944
944
|
get Ve() {
|
|
945
945
|
return this.We;
|
|
@@ -954,10 +954,10 @@ precision highp float;in vec2 v_uv;uniform sampler2D Ub;uniform sampler2D Uc;uni
|
|
|
954
954
|
const i = Ft(t.program), s = function(r, h) {
|
|
955
955
|
let a = 0;
|
|
956
956
|
const l = Object.keys(r).sort();
|
|
957
|
-
for (const u of l) a =
|
|
957
|
+
for (const u of l) a = H(a, Bt(u)), a = H(a, h(r[u]));
|
|
958
958
|
return a;
|
|
959
959
|
}(e, this.Je.bind(this));
|
|
960
|
-
return
|
|
960
|
+
return H(i, s);
|
|
961
961
|
}
|
|
962
962
|
Je(t) {
|
|
963
963
|
return typeof t == "number" || typeof t == "boolean" ? function(e) {
|
|
@@ -965,14 +965,14 @@ precision highp float;in vec2 v_uv;uniform sampler2D Ub;uniform sampler2D Uc;uni
|
|
|
965
965
|
}(t) : Array.isArray(t) ? function(e) {
|
|
966
966
|
let i = 0;
|
|
967
967
|
const s = Array.isArray(e[0]) ? e.flat() : e;
|
|
968
|
-
for (const r of s) i =
|
|
968
|
+
for (const r of s) i = H(i, typeof r == "number" ? r : 0);
|
|
969
969
|
return i;
|
|
970
970
|
}(t) : t instanceof Float32Array || t instanceof Int32Array ? function(e) {
|
|
971
971
|
let i = 0;
|
|
972
972
|
const s = Math.min(e.length, 16);
|
|
973
|
-
for (let r = 0; r < s; r++) i =
|
|
973
|
+
for (let r = 0; r < s; r++) i = H(i, e[r]);
|
|
974
974
|
return i;
|
|
975
|
-
}(t) : t instanceof WebGLTexture ||
|
|
975
|
+
}(t) : t instanceof WebGLTexture || D(t) ? Ft(t) : 0;
|
|
976
976
|
}
|
|
977
977
|
Ss() {
|
|
978
978
|
this.Ye.dispose(), this.Ke.dispose(), this.Ze.clear();
|
|
@@ -1096,10 +1096,10 @@ class Me {
|
|
|
1096
1096
|
Ri(t, e, i, s) {
|
|
1097
1097
|
this.fi.ri({ x1: t, y1: e, x2: i, y2: s }, this.ui, this.li.Ve);
|
|
1098
1098
|
}
|
|
1099
|
-
|
|
1099
|
+
Li(t, e) {
|
|
1100
1100
|
this.fi.ni({ width: t, height: e }, this.ui, this.li.Ve);
|
|
1101
1101
|
}
|
|
1102
|
-
|
|
1102
|
+
Di(t, e, i, s, r, h) {
|
|
1103
1103
|
this.fi.oi({ x1: t, y1: e, x2: i, y2: s, x3: r, y3: h }, this.ui, this.li.Ve);
|
|
1104
1104
|
}
|
|
1105
1105
|
Oi(t, e, i, s, r, h, a, l) {
|
|
@@ -1162,13 +1162,13 @@ const F = { readShort: (n, t) => (F.t.uint16[0] = n[t] << 8 | n[t + 1], F.t.int1
|
|
|
1162
1162
|
const n = new ArrayBuffer(8);
|
|
1163
1163
|
return { uint8: new Uint8Array(n), int16: new Int16Array(n), uint16: new Uint16Array(n), uint32: new Uint32Array(n) };
|
|
1164
1164
|
})() };
|
|
1165
|
-
function
|
|
1165
|
+
function $(n) {
|
|
1166
1166
|
return n + 3 & -4;
|
|
1167
1167
|
}
|
|
1168
1168
|
function J(n, t, e) {
|
|
1169
1169
|
n[t] = e >>> 8 & 255, n[t + 1] = 255 & e;
|
|
1170
1170
|
}
|
|
1171
|
-
function
|
|
1171
|
+
function _(n, t, e) {
|
|
1172
1172
|
n[t] = e >>> 24 & 255, n[t + 1] = e >>> 16 & 255, n[t + 2] = e >>> 8 & 255, n[t + 3] = 255 & e;
|
|
1173
1173
|
}
|
|
1174
1174
|
function Ce(n, t, e) {
|
|
@@ -1181,7 +1181,7 @@ function dt(n, t, e) {
|
|
|
1181
1181
|
for (let h = t; h < i; h += 4) r.uint8[3] = n[h] || 0, r.uint8[2] = n[h + 1] || 0, r.uint8[1] = n[h + 2] || 0, r.uint8[0] = n[h + 3] || 0, s = s + (r.uint32[0] >>> 0) >>> 0;
|
|
1182
1182
|
return s >>> 0;
|
|
1183
1183
|
}
|
|
1184
|
-
class
|
|
1184
|
+
class Se {
|
|
1185
1185
|
constructor(t) {
|
|
1186
1186
|
o(this, "b");
|
|
1187
1187
|
o(this, "p", 0);
|
|
@@ -1220,7 +1220,7 @@ function G(n) {
|
|
|
1220
1220
|
if (!l) continue;
|
|
1221
1221
|
const u = s[l]++;
|
|
1222
1222
|
let c = h.get(l);
|
|
1223
|
-
c || (c = [], h.set(l, c)), c[
|
|
1223
|
+
c || (c = [], h.set(l, c)), c[Pe(u, l)] = a;
|
|
1224
1224
|
}
|
|
1225
1225
|
return { min: t, max: e, table: h };
|
|
1226
1226
|
}
|
|
@@ -1236,7 +1236,7 @@ function gt(n, t) {
|
|
|
1236
1236
|
}
|
|
1237
1237
|
throw Error("Invalid Huffman code");
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1239
|
+
function Pe(n, t) {
|
|
1240
1240
|
let e = 0;
|
|
1241
1241
|
for (let i = 0; i < t; i++) e = e << 1 | 1 & n, n >>>= 1;
|
|
1242
1242
|
return e >>> 0;
|
|
@@ -1280,7 +1280,7 @@ function Oe(n) {
|
|
|
1280
1280
|
if (T <= 15) b.push(T);
|
|
1281
1281
|
else if (T === 16) {
|
|
1282
1282
|
const U = r.readBits(2) + 3, C = b[b.length - 1] || 0;
|
|
1283
|
-
for (let
|
|
1283
|
+
for (let Z = 0; Z < U; Z++) b.push(C);
|
|
1284
1284
|
} else if (T === 17) {
|
|
1285
1285
|
const U = r.readBits(3) + 3;
|
|
1286
1286
|
for (let C = 0; C < U; C++) b.push(0);
|
|
@@ -1292,8 +1292,8 @@ function Oe(n) {
|
|
|
1292
1292
|
}
|
|
1293
1293
|
}
|
|
1294
1294
|
}
|
|
1295
|
-
const M = b.slice(0, d),
|
|
1296
|
-
p = G(M), v = G(
|
|
1295
|
+
const M = b.slice(0, d), S = b.slice(d, d + m);
|
|
1296
|
+
p = G(M), v = G(S);
|
|
1297
1297
|
}
|
|
1298
1298
|
for (; ; ) {
|
|
1299
1299
|
const d = gt(r, p);
|
|
@@ -1312,16 +1312,16 @@ function Oe(n) {
|
|
|
1312
1312
|
b && (R += r.readBits(b));
|
|
1313
1313
|
const M = h.length - R;
|
|
1314
1314
|
if (M < 0) throw Error("Invalid distance");
|
|
1315
|
-
for (let
|
|
1315
|
+
for (let S = 0; S < A; S++) h.push(h[M + S] || 0);
|
|
1316
1316
|
} else if (d === 286 || d === 287) throw Error("Reserved length symbol");
|
|
1317
1317
|
}
|
|
1318
1318
|
}
|
|
1319
1319
|
}
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
|
-
}(new
|
|
1322
|
+
}(new Se(n.subarray(i)), s), new Uint8Array(s);
|
|
1323
1323
|
}
|
|
1324
|
-
function
|
|
1324
|
+
function Le(n) {
|
|
1325
1325
|
const t = F, e = new Uint8Array(n);
|
|
1326
1326
|
if (t.readASCII(e, 0, 4) !== "wOFF") throw Error("Invalid WOFF signature");
|
|
1327
1327
|
const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), h = [];
|
|
@@ -1344,19 +1344,19 @@ function Xe(n) {
|
|
|
1344
1344
|
const f = 16 * u, g = 16 * l - f;
|
|
1345
1345
|
let p = 12 + 16 * l;
|
|
1346
1346
|
const v = {};
|
|
1347
|
-
for (const A of h) v[A.tag] = p, p =
|
|
1347
|
+
for (const A of h) v[A.tag] = p, p = $(p + A.data.length);
|
|
1348
1348
|
const d = new Uint8Array(Math.max(r || 0, p));
|
|
1349
|
-
|
|
1349
|
+
_(d, 0, i), J(d, 4, l), J(d, 6, f), J(d, 8, c), J(d, 10, g);
|
|
1350
1350
|
let m = 12;
|
|
1351
1351
|
for (const A of h) {
|
|
1352
1352
|
Ce(d, m, A.tag), m += 4;
|
|
1353
1353
|
const w = A.data;
|
|
1354
1354
|
if (A.tag === "head" && w.length >= 12) {
|
|
1355
1355
|
const y = new Uint8Array(w);
|
|
1356
|
-
|
|
1356
|
+
_(y, 8, 0), _(d, m, dt(y, 0, $(y.length))), m += 4;
|
|
1357
1357
|
} else
|
|
1358
|
-
|
|
1359
|
-
|
|
1358
|
+
_(d, m, dt(w, 0, $(w.length))), m += 4;
|
|
1359
|
+
_(d, m, v[A.tag]), m += 4, _(d, m, A.data.length), m += 4;
|
|
1360
1360
|
}
|
|
1361
1361
|
for (const A of h) {
|
|
1362
1362
|
const w = v[A.tag];
|
|
@@ -1365,11 +1365,11 @@ function Xe(n) {
|
|
|
1365
1365
|
if (h.find((A) => A.tag === "head")) {
|
|
1366
1366
|
const A = v.head, w = function(y, R) {
|
|
1367
1367
|
const b = R + 8, M = [y[b], y[b + 1], y[b + 2], y[b + 3]];
|
|
1368
|
-
|
|
1369
|
-
const
|
|
1370
|
-
return y[b] = M[0], y[b + 1] = M[1], y[b + 2] = M[2], y[b + 3] = M[3],
|
|
1368
|
+
_(y, b, 0);
|
|
1369
|
+
const S = 2981146554 - (dt(y, 0, $(y.length)) >>> 0) >>> 0;
|
|
1370
|
+
return y[b] = M[0], y[b + 1] = M[1], y[b + 2] = M[2], y[b + 3] = M[3], S >>> 0;
|
|
1371
1371
|
}(d, A);
|
|
1372
|
-
|
|
1372
|
+
_(d, A + 8, w);
|
|
1373
1373
|
}
|
|
1374
1374
|
return d.buffer;
|
|
1375
1375
|
}
|
|
@@ -1412,7 +1412,7 @@ const Ue = { parseTab(n, t, e) {
|
|
|
1412
1412
|
const s = new Uint32Array(3 * i);
|
|
1413
1413
|
for (let r = 0; r < 3 * i; r += 3) s[r] = e(n, t + (r << 2)), s[r + 1] = e(n, t + (r << 2) + 4), s[r + 2] = e(n, t + (r << 2) + 8);
|
|
1414
1414
|
return { format: 12, groups: s };
|
|
1415
|
-
} },
|
|
1415
|
+
} }, Xe = { parseTab(n, t, e) {
|
|
1416
1416
|
const i = F;
|
|
1417
1417
|
t += 18;
|
|
1418
1418
|
const s = i.readUshort(n, t);
|
|
@@ -1425,21 +1425,21 @@ const Ue = { parseTab(n, t, e) {
|
|
|
1425
1425
|
t += 2;
|
|
1426
1426
|
const l = i.readShort(n, t);
|
|
1427
1427
|
return t += 2, t += 6, { unitsPerEm: s, xMin: r, yMin: h, xMax: a, yMax: l, indexToLocFormat: i.readShort(n, t) };
|
|
1428
|
-
} },
|
|
1428
|
+
} }, _e = { parseTab(n, t, e) {
|
|
1429
1429
|
const i = F;
|
|
1430
1430
|
t += 4;
|
|
1431
1431
|
const s = i.readShort, r = i.readUshort;
|
|
1432
1432
|
return { ascender: s(n, t), descender: s(n, t + 2), lineGap: s(n, t + 4), advanceWidthMax: r(n, t + 6), minLeftSideBearing: s(n, t + 8), minRightSideBearing: s(n, t + 10), xMaxExtent: s(n, t + 12), caretSlopeRise: s(n, t + 14), caretSlopeRun: s(n, t + 16), caretOffset: s(n, t + 18), res0: s(n, t + 20), res1: s(n, t + 22), res2: s(n, t + 24), res3: s(n, t + 26), metricDataFormat: s(n, t + 28), numberOfHMetrics: r(n, t + 30) };
|
|
1433
|
-
} },
|
|
1433
|
+
} }, Be = { parseTab(n, t, e, i) {
|
|
1434
1434
|
const s = F, r = [], h = [], a = i.maxp.numGlyphs, l = i.hhea.numberOfHMetrics;
|
|
1435
1435
|
let u = 0, c = 0, f = 0;
|
|
1436
1436
|
for (; f < l; ) u = s.readUshort(n, t + (f << 2)), c = s.readShort(n, t + (f << 2) + 2), r.push(u), h.push(c), f++;
|
|
1437
1437
|
for (; f < a; ) r.push(u), h.push(c), f++;
|
|
1438
1438
|
return { aWidth: r, lsBearing: h };
|
|
1439
|
-
} }, Mt = { cmap: Ue, head:
|
|
1439
|
+
} }, Mt = { cmap: Ue, head: Xe, hhea: _e, maxp: { parseTab(n, t, e) {
|
|
1440
1440
|
const i = F;
|
|
1441
1441
|
return i.readUint(n, t), t += 4, { numGlyphs: i.readUshort(n, t) };
|
|
1442
|
-
} }, hmtx:
|
|
1442
|
+
} }, hmtx: Be, loca: { parseTab(n, t, e, i) {
|
|
1443
1443
|
const s = F, r = [], h = i.head.indexToLocFormat, a = i.maxp.numGlyphs + 1;
|
|
1444
1444
|
if (h === 0) for (let l = 0; l < a; l++) r.push(s.readUshort(n, t + (l << 1)) << 1);
|
|
1445
1445
|
else if (h === 1) for (let l = 0; l < a; l++) r.push(s.readUint(n, t + (l << 2)));
|
|
@@ -1488,7 +1488,7 @@ const Ue = { parseTab(n, t, e) {
|
|
|
1488
1488
|
return a;
|
|
1489
1489
|
} } }, ct = { parse(n) {
|
|
1490
1490
|
const t = new Uint8Array(n);
|
|
1491
|
-
F.readASCII(t, 0, 4) === "wOFF" && (n =
|
|
1491
|
+
F.readASCII(t, 0, 4) === "wOFF" && (n = Le(n));
|
|
1492
1492
|
const e = new Uint8Array(n), i = Mt, s = {}, r = { Qi: e, Xi: 0, Ni: 0 };
|
|
1493
1493
|
for (const h in i) {
|
|
1494
1494
|
const a = h, l = ct.findTable(e, a, 0);
|
|
@@ -1511,7 +1511,7 @@ const Ue = { parseTab(n, t, e) {
|
|
|
1511
1511
|
}
|
|
1512
1512
|
return null;
|
|
1513
1513
|
}, T: Mt, B: F };
|
|
1514
|
-
function
|
|
1514
|
+
function Yt(n, t, e) {
|
|
1515
1515
|
if (n.idRangeOffset[e] === 0) return t + n.idDelta[e] & 65535;
|
|
1516
1516
|
{
|
|
1517
1517
|
const i = n.startCount.length, s = n.idRangeOffset[e] / 2 + (t - n.startCount[e]) - (i - e);
|
|
@@ -1522,7 +1522,7 @@ function Bt(n, t, e) {
|
|
|
1522
1522
|
}
|
|
1523
1523
|
return 0;
|
|
1524
1524
|
}
|
|
1525
|
-
class
|
|
1525
|
+
class Ye {
|
|
1526
1526
|
Yi(t) {
|
|
1527
1527
|
var i;
|
|
1528
1528
|
const e = [];
|
|
@@ -1542,7 +1542,7 @@ class Be {
|
|
|
1542
1542
|
for (let i = 0; i < t.startCount.length; i++) {
|
|
1543
1543
|
const s = t.startCount[i], r = t.endCount[i];
|
|
1544
1544
|
if (s !== 65535 || r !== 65535) for (let h = s; h <= r; h++)
|
|
1545
|
-
|
|
1545
|
+
Yt(t, h, i) > 0 && this.Zi(e, h);
|
|
1546
1546
|
}
|
|
1547
1547
|
return e;
|
|
1548
1548
|
}
|
|
@@ -1677,7 +1677,7 @@ class It {
|
|
|
1677
1677
|
s = r;
|
|
1678
1678
|
break;
|
|
1679
1679
|
}
|
|
1680
|
-
return s === -1 || t < e.startCount[s] ? 0 :
|
|
1680
|
+
return s === -1 || t < e.startCount[s] ? 0 : Yt(e, t, s);
|
|
1681
1681
|
}
|
|
1682
1682
|
ar(t, e) {
|
|
1683
1683
|
const i = e.groups.length / 3;
|
|
@@ -1688,7 +1688,7 @@ class It {
|
|
|
1688
1688
|
return 0;
|
|
1689
1689
|
}
|
|
1690
1690
|
}
|
|
1691
|
-
class
|
|
1691
|
+
class De {
|
|
1692
1692
|
constructor() {
|
|
1693
1693
|
o(this, "dr");
|
|
1694
1694
|
this.dr = new It();
|
|
@@ -1741,18 +1741,18 @@ class z extends at {
|
|
|
1741
1741
|
o(this, "Pr");
|
|
1742
1742
|
o(this, "Tr");
|
|
1743
1743
|
o(this, "Sr", !1);
|
|
1744
|
-
this.br = i, this.Fr = new
|
|
1744
|
+
this.br = i, this.Fr = new Ye(), this.$r = new Ie(e), this.Pr = new De(), this.Tr = new Ne();
|
|
1745
1745
|
}
|
|
1746
1746
|
async Er(e) {
|
|
1747
1747
|
if (this.Sr) return;
|
|
1748
1748
|
const i = e || "data:font/woff;base64,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", s = await this.kr(i);
|
|
1749
1749
|
await this.Rr(s);
|
|
1750
1750
|
}
|
|
1751
|
-
|
|
1751
|
+
Lr(e) {
|
|
1752
1752
|
if (e === void 0) return this.br;
|
|
1753
|
-
this.br = e, this.
|
|
1753
|
+
this.br = e, this.Dr();
|
|
1754
1754
|
}
|
|
1755
|
-
|
|
1755
|
+
Dr() {
|
|
1756
1756
|
const e = this.Ar.map((i) => i.character);
|
|
1757
1757
|
this.Cr = this.Pr.pr(e, this.br, this.yr), this.$r.sr(this.Ar, this.Cr, this.br, this.yr);
|
|
1758
1758
|
}
|
|
@@ -1761,12 +1761,12 @@ class z extends at {
|
|
|
1761
1761
|
const i = await this.kr(e);
|
|
1762
1762
|
await this.Rr(i);
|
|
1763
1763
|
} catch (i) {
|
|
1764
|
-
throw new
|
|
1764
|
+
throw new P("Failed to load font: " + (i instanceof Error ? i.message : "Unknown error"), { originalError: i });
|
|
1765
1765
|
}
|
|
1766
1766
|
}
|
|
1767
1767
|
async kr(e) {
|
|
1768
1768
|
const i = await fetch(e);
|
|
1769
|
-
if (!i.ok) throw new
|
|
1769
|
+
if (!i.ok) throw new P(`Failed to load font file: ${i.status} ${i.statusText}`);
|
|
1770
1770
|
return i.arrayBuffer();
|
|
1771
1771
|
}
|
|
1772
1772
|
async Rr(e) {
|
|
@@ -1782,7 +1782,7 @@ class z extends at {
|
|
|
1782
1782
|
}
|
|
1783
1783
|
async Hr() {
|
|
1784
1784
|
const e = this.Fr.Yi(this.yr), { array: i, map: s } = this.Tr.gr(e, this.yr);
|
|
1785
|
-
this.Ar = i, this.wr = s, this.
|
|
1785
|
+
this.Ar = i, this.wr = s, this.Dr(), this.Sr = !0;
|
|
1786
1786
|
}
|
|
1787
1787
|
Br(e) {
|
|
1788
1788
|
const i = this.wr.get(e);
|
|
@@ -1900,10 +1900,10 @@ function tt(n) {
|
|
|
1900
1900
|
return parseInt(n, 16);
|
|
1901
1901
|
}
|
|
1902
1902
|
const ke = /^rgba?\(([^)]+)\)$/i;
|
|
1903
|
-
function
|
|
1904
|
-
return Number.isNaN(n = Math.round(n)) ? 0 :
|
|
1903
|
+
function Y(n) {
|
|
1904
|
+
return Number.isNaN(n = Math.round(n)) ? 0 : X(n, 0, 255);
|
|
1905
1905
|
}
|
|
1906
|
-
function
|
|
1906
|
+
function Dt(n, t = !1) {
|
|
1907
1907
|
if (!n) return null;
|
|
1908
1908
|
const e = n.trim().toLowerCase();
|
|
1909
1909
|
if (!e) return null;
|
|
@@ -1913,17 +1913,17 @@ function Ht(n, t = !1) {
|
|
|
1913
1913
|
if (!r) return null;
|
|
1914
1914
|
const h = r[1].split(",").map((f) => f.trim());
|
|
1915
1915
|
if (h.length < 3) return null;
|
|
1916
|
-
const a =
|
|
1916
|
+
const a = Y(parseFloat(h[0])), l = Y(parseFloat(h[1])), u = Y(parseFloat(h[2]));
|
|
1917
1917
|
let c = 255;
|
|
1918
1918
|
if (h[3] !== void 0) {
|
|
1919
1919
|
const f = h[3].trim();
|
|
1920
1920
|
let g = parseFloat(f);
|
|
1921
|
-
f.endsWith("%") && (g /= 100), c = 255 *
|
|
1921
|
+
f.endsWith("%") && (g /= 100), c = 255 * X(g, 0, 1);
|
|
1922
1922
|
}
|
|
1923
1923
|
return [a, l, u, Math.round(c)];
|
|
1924
1924
|
}(e)), i && (t || i[3] !== 0) ? i : null;
|
|
1925
1925
|
}
|
|
1926
|
-
class
|
|
1926
|
+
class He {
|
|
1927
1927
|
constructor(t = {}) {
|
|
1928
1928
|
o(this, "Xr");
|
|
1929
1929
|
o(this, "en", null);
|
|
@@ -1935,7 +1935,7 @@ class Ye {
|
|
|
1935
1935
|
if (this.rn = t.overlay ?? !1, t.gl) this.hn = t.gl, this.Xr = t.gl.canvas, this.nn = !1, this.an = !1;
|
|
1936
1936
|
else if (this.rn && t.canvas) this.en = t.canvas, this.Xr = this.cn(), this.nn = !0, this.ln();
|
|
1937
1937
|
else if (t.canvas) {
|
|
1938
|
-
if (t.canvas instanceof HTMLVideoElement) throw new
|
|
1938
|
+
if (typeof HTMLVideoElement < "u" && t.canvas instanceof HTMLVideoElement) throw new P("Video elements are only supported in overlay mode.");
|
|
1939
1939
|
this.Xr = t.canvas, this.nn = !1;
|
|
1940
1940
|
} else this.Xr = this.un(t.width, t.height), this.nn = !0;
|
|
1941
1941
|
this.Xr.style.imageRendering = "pixelated";
|
|
@@ -1949,7 +1949,7 @@ class Ye {
|
|
|
1949
1949
|
t.className = "textmodeCanvas", t.style.imageRendering = "pixelated";
|
|
1950
1950
|
const e = this.en.getBoundingClientRect();
|
|
1951
1951
|
let i = Math.round(e.width), s = Math.round(e.height);
|
|
1952
|
-
if (this.en instanceof HTMLVideoElement) {
|
|
1952
|
+
if (typeof HTMLVideoElement < "u" && this.en instanceof HTMLVideoElement) {
|
|
1953
1953
|
const a = this.en;
|
|
1954
1954
|
(i === 0 || s === 0) && a.videoWidth > 0 && a.videoHeight > 0 && (i = a.videoWidth, s = a.videoHeight);
|
|
1955
1955
|
}
|
|
@@ -1970,7 +1970,7 @@ class Ye {
|
|
|
1970
1970
|
const t = this.dn();
|
|
1971
1971
|
for (const e of t) {
|
|
1972
1972
|
if (!e) continue;
|
|
1973
|
-
const i =
|
|
1973
|
+
const i = Dt(window.getComputedStyle(e).backgroundColor);
|
|
1974
1974
|
if (i) return i;
|
|
1975
1975
|
}
|
|
1976
1976
|
return [255, 255, 255, 255];
|
|
@@ -1993,7 +1993,7 @@ class Ye {
|
|
|
1993
1993
|
gn() {
|
|
1994
1994
|
if (this.hn) return this.hn;
|
|
1995
1995
|
const t = this.Xr.getContext("webgl2", { alpha: !0, premultipliedAlpha: !1, preserveDrawingBuffer: !0, antialias: !1, depth: !0, stencil: !1, powerPreference: "high-performance" });
|
|
1996
|
-
if (!t) throw new
|
|
1996
|
+
if (!t) throw new P("`textmode.js` requires WebGL2 support.");
|
|
1997
1997
|
return this.$ = t, t;
|
|
1998
1998
|
}
|
|
1999
1999
|
Ss() {
|
|
@@ -2029,7 +2029,7 @@ class x {
|
|
|
2029
2029
|
o(this, "g");
|
|
2030
2030
|
o(this, "b");
|
|
2031
2031
|
o(this, "a");
|
|
2032
|
-
this.r =
|
|
2032
|
+
this.r = Y(t), this.g = Y(e), this.b = Y(i), this.a = Y(s);
|
|
2033
2033
|
}
|
|
2034
2034
|
static yn(t, e, i, s) {
|
|
2035
2035
|
if (x.An(t)) return t;
|
|
@@ -2041,7 +2041,7 @@ class x {
|
|
|
2041
2041
|
if (typeof t == "string") {
|
|
2042
2042
|
const r = t.trim();
|
|
2043
2043
|
if (r.length === 0) throw Error("Color strings cannot be empty.");
|
|
2044
|
-
const h =
|
|
2044
|
+
const h = Dt(r, !0);
|
|
2045
2045
|
return h ? x.wn(...h) : x.bn(r);
|
|
2046
2046
|
}
|
|
2047
2047
|
if (typeof t == "number") return typeof e == "number" && typeof i == "number" ? x.wn(t, e, i, s ?? 255) : typeof e == "number" ? x.Cn(t, e) : x.Cn(t, s ?? 255);
|
|
@@ -2092,23 +2092,23 @@ class xt extends at {
|
|
|
2092
2092
|
o(this, "$n");
|
|
2093
2093
|
o(this, "M");
|
|
2094
2094
|
o(this, "F");
|
|
2095
|
-
o(this, "
|
|
2095
|
+
o(this, "L", null);
|
|
2096
2096
|
o(this, "Pn", null);
|
|
2097
2097
|
o(this, "Tn", "brightness");
|
|
2098
2098
|
o(this, "Sn", null);
|
|
2099
|
-
o(this, "
|
|
2099
|
+
o(this, "Un");
|
|
2100
2100
|
o(this, "Rt", 0);
|
|
2101
2101
|
o(this, "Gt", 0);
|
|
2102
2102
|
o(this, "jt", 0);
|
|
2103
|
-
o(this, "
|
|
2104
|
-
o(this, "
|
|
2105
|
-
o(this, "
|
|
2103
|
+
o(this, "Lt", 0);
|
|
2104
|
+
o(this, "En", "sampled");
|
|
2105
|
+
o(this, "kn", "fixed");
|
|
2106
2106
|
o(this, "Xt", [1, 1, 1, 1]);
|
|
2107
2107
|
o(this, "Yt", [0, 0, 0, 1]);
|
|
2108
|
-
o(this, "
|
|
2108
|
+
o(this, "Rn", [0, 0, 0, 1]);
|
|
2109
2109
|
o(this, "Ln", [[0.1, 0, 0]]);
|
|
2110
2110
|
o(this, "Nt", null);
|
|
2111
|
-
this.$ = e, this.R = i, this.Mn = s, this.
|
|
2111
|
+
this.$ = e, this.R = i, this.Mn = s, this.Un = r, this.Fn = h, this.$n = a;
|
|
2112
2112
|
const { width: c, height: f } = function(g, p, v, d) {
|
|
2113
2113
|
const m = Math.min(v / g, d / p);
|
|
2114
2114
|
return { width: Math.max(1, Math.floor(g * m)), height: Math.max(1, Math.floor(p * m)), scale: m };
|
|
@@ -2116,43 +2116,43 @@ class xt extends at {
|
|
|
2116
2116
|
this.M = c, this.F = f;
|
|
2117
2117
|
}
|
|
2118
2118
|
conversionMode(e) {
|
|
2119
|
-
return this.Tn = e, this.Sn = null, this.
|
|
2119
|
+
return this.Tn = e, this.Sn = null, this.L = null, this;
|
|
2120
2120
|
}
|
|
2121
2121
|
dispose() {
|
|
2122
2122
|
this.Mn && (this.$.deleteTexture(this.Mn), this.Mn = null), super.dispose();
|
|
2123
2123
|
}
|
|
2124
2124
|
invert(e = !0) {
|
|
2125
|
-
return this.Rt = e ? 1 : 0, this.
|
|
2125
|
+
return this.Rt = e ? 1 : 0, this.L = null, this;
|
|
2126
2126
|
}
|
|
2127
2127
|
flipX(e = !0) {
|
|
2128
|
-
return this.Gt = e ? 1 : 0, this.
|
|
2128
|
+
return this.Gt = e ? 1 : 0, this.L = null, this;
|
|
2129
2129
|
}
|
|
2130
2130
|
flipY(e = !0) {
|
|
2131
|
-
return this.jt = e ? 1 : 0, this.
|
|
2131
|
+
return this.jt = e ? 1 : 0, this.L = null, this;
|
|
2132
2132
|
}
|
|
2133
2133
|
charRotation(e) {
|
|
2134
|
-
return this.
|
|
2134
|
+
return this.Lt = St(e), this.L = null, this;
|
|
2135
2135
|
}
|
|
2136
2136
|
charColorMode(e) {
|
|
2137
|
-
return this.
|
|
2137
|
+
return this.En = e, this.L = null, this;
|
|
2138
2138
|
}
|
|
2139
2139
|
cellColorMode(e) {
|
|
2140
|
-
return this.
|
|
2140
|
+
return this.kn = e, this.L = null, this;
|
|
2141
2141
|
}
|
|
2142
2142
|
charColor(e, i, s, r) {
|
|
2143
|
-
return this.
|
|
2143
|
+
return this.Dn(this.Xt, e, i, s, r), this.L = null, this;
|
|
2144
2144
|
}
|
|
2145
2145
|
cellColor(e, i, s, r) {
|
|
2146
|
-
return this.
|
|
2146
|
+
return this.Dn(this.Yt, e, i, s, r), this.L = null, this;
|
|
2147
2147
|
}
|
|
2148
2148
|
background(e, i, s, r) {
|
|
2149
|
-
return this.
|
|
2149
|
+
return this.Dn(this.Rn, e, i, s, r), this.L = null, this;
|
|
2150
2150
|
}
|
|
2151
2151
|
characters(e) {
|
|
2152
|
-
return this.Nt = e, this.
|
|
2152
|
+
return this.Nt = e, this.On(e), this.L = null, this;
|
|
2153
2153
|
}
|
|
2154
2154
|
Si(e) {
|
|
2155
|
-
this.Pn !== e && (this.Pn = e, this.Nt && this.
|
|
2155
|
+
this.Pn !== e && (this.Pn = e, this.Nt && this.On(this.Nt), this.L = null);
|
|
2156
2156
|
}
|
|
2157
2157
|
get texture() {
|
|
2158
2158
|
return this.Mn;
|
|
@@ -2170,134 +2170,134 @@ class xt extends at {
|
|
|
2170
2170
|
return this.$n;
|
|
2171
2171
|
}
|
|
2172
2172
|
V() {
|
|
2173
|
-
return this.
|
|
2173
|
+
return this.L || this.J(), this.L;
|
|
2174
2174
|
}
|
|
2175
|
-
|
|
2175
|
+
zn() {
|
|
2176
2176
|
}
|
|
2177
|
-
|
|
2177
|
+
Hn() {
|
|
2178
2178
|
return this.Mn;
|
|
2179
2179
|
}
|
|
2180
2180
|
J() {
|
|
2181
|
-
this.
|
|
2182
|
-
const e = this.
|
|
2183
|
-
this.
|
|
2181
|
+
this.zn();
|
|
2182
|
+
const e = this.Bn(), i = this.In(), s = this.Un.Gn(this.Tn, i), r = e.createUniforms(i);
|
|
2183
|
+
this.L = this.R.materialManager.st(s, r);
|
|
2184
2184
|
}
|
|
2185
|
-
|
|
2185
|
+
Dn(e, i, s, r, h) {
|
|
2186
2186
|
const a = x.yn(i, s, r, h);
|
|
2187
2187
|
it(e, a.r, a.g, a.b, a.a);
|
|
2188
2188
|
}
|
|
2189
|
-
|
|
2189
|
+
On(e) {
|
|
2190
2190
|
if (!this.Pn) return;
|
|
2191
2191
|
const i = this.Pn.Ir(e).filter((s) => Array.isArray(s)).slice(0, 255);
|
|
2192
2192
|
this.Ln = i.length > 0 ? i : this.Ln;
|
|
2193
2193
|
}
|
|
2194
2194
|
createBaseConversionUniforms() {
|
|
2195
|
-
return { u_image: this.
|
|
2195
|
+
return { u_image: this.Hn(), u_invert: !!this.Rt, u_flipX: !!this.Gt, u_flipY: !!this.jt, u_charRotation: this.Lt, u_charColorFixed: this.En === "fixed", u_charColor: this.Xt, u_cellColorFixed: this.kn === "fixed", u_cellColor: this.Yt, u_backgroundColor: this.Rn, u_charCount: this.Ln.length, u_charList: this.Ln };
|
|
2196
2196
|
}
|
|
2197
|
-
|
|
2197
|
+
Bn() {
|
|
2198
2198
|
if (this.Sn && this.Sn.id === this.Tn) return this.Sn;
|
|
2199
|
-
const e = this.
|
|
2199
|
+
const e = this.Un.jn(this.Tn);
|
|
2200
2200
|
if (!e) throw Error(`[textmode.js] Conversion mode "${this.Tn}" is not registered. If this mode is provided by an add-on, make sure its plugin is installed before loading sources.`);
|
|
2201
2201
|
return this.Sn = e, e;
|
|
2202
2202
|
}
|
|
2203
|
-
|
|
2203
|
+
In() {
|
|
2204
2204
|
if (!this.Pn) throw Error("[textmode.js] Cannot create conversion context: no active font set. Ensure $setActiveFont() is called before rendering.");
|
|
2205
2205
|
return { renderer: this.R, gl: this.$, font: this.Pn, source: this };
|
|
2206
2206
|
}
|
|
2207
2207
|
}
|
|
2208
|
-
class
|
|
2208
|
+
class K extends xt {
|
|
2209
2209
|
constructor(t, e, i, s, r, h, a, l) {
|
|
2210
2210
|
super(t, e, i, s, r, h, a, l);
|
|
2211
2211
|
}
|
|
2212
|
-
static
|
|
2212
|
+
static Qn(t, e, i, s, r) {
|
|
2213
2213
|
const h = t.context, a = wt(h, i), { width: l, height: u } = bt(i);
|
|
2214
|
-
return new
|
|
2214
|
+
return new K(h, t, a, e, l, u, s, r);
|
|
2215
2215
|
}
|
|
2216
2216
|
}
|
|
2217
2217
|
class Nt {
|
|
2218
2218
|
constructor(t = 60) {
|
|
2219
|
+
o(this, "Nn");
|
|
2219
2220
|
o(this, "Xn");
|
|
2220
|
-
o(this, "Yn");
|
|
2221
|
-
o(this, "Kn",
|
|
2222
|
-
o(this, "Wn", 0);
|
|
2223
|
-
o(this, "Zn",
|
|
2221
|
+
o(this, "Yn", null);
|
|
2222
|
+
o(this, "Kn", 0);
|
|
2223
|
+
o(this, "Wn", !0);
|
|
2224
|
+
o(this, "Zn", 0);
|
|
2224
2225
|
o(this, "qn", 0);
|
|
2225
|
-
o(this, "Vn",
|
|
2226
|
-
o(this, "Jn",
|
|
2227
|
-
o(this, "th",
|
|
2226
|
+
o(this, "Vn", []);
|
|
2227
|
+
o(this, "Jn", 10);
|
|
2228
|
+
o(this, "th", 0);
|
|
2228
2229
|
o(this, "sh", 0);
|
|
2229
|
-
o(this, "eh",
|
|
2230
|
-
|
|
2231
|
-
this.Yn = t, this.Xn = 1e3 / t;
|
|
2230
|
+
o(this, "eh", -1);
|
|
2231
|
+
this.Xn = t, this.Nn = 1e3 / t;
|
|
2232
2232
|
}
|
|
2233
|
-
|
|
2234
|
-
if (!this.
|
|
2235
|
-
this.
|
|
2233
|
+
ih(t) {
|
|
2234
|
+
if (!this.Wn) return;
|
|
2235
|
+
this.eh === -1 && (this.eh = performance.now()), this.Kn = performance.now();
|
|
2236
2236
|
const e = (i) => {
|
|
2237
|
-
if (!this.
|
|
2238
|
-
const s = i - this.
|
|
2239
|
-
s >= this.
|
|
2237
|
+
if (!this.Wn) return void (this.Yn = null);
|
|
2238
|
+
const s = i - this.Kn;
|
|
2239
|
+
s >= this.Nn && (t(), this.Kn = i - s % this.Nn), this.Wn && (this.Yn = requestAnimationFrame(e));
|
|
2240
2240
|
};
|
|
2241
|
-
this.
|
|
2241
|
+
this.Yn = requestAnimationFrame(e);
|
|
2242
2242
|
}
|
|
2243
|
-
|
|
2244
|
-
this.
|
|
2243
|
+
rh() {
|
|
2244
|
+
this.Yn && (cancelAnimationFrame(this.Yn), this.Yn = null);
|
|
2245
2245
|
}
|
|
2246
|
-
|
|
2247
|
-
this.
|
|
2246
|
+
nh() {
|
|
2247
|
+
this.Wn && (this.Wn = !1, this.rh());
|
|
2248
2248
|
}
|
|
2249
|
-
|
|
2250
|
-
this.
|
|
2249
|
+
hh(t) {
|
|
2250
|
+
this.Wn || (this.Wn = !0, this.ih(t));
|
|
2251
2251
|
}
|
|
2252
|
-
|
|
2253
|
-
if (t === void 0) return this.
|
|
2254
|
-
this.
|
|
2252
|
+
oh(t, e) {
|
|
2253
|
+
if (t === void 0) return this.Zn;
|
|
2254
|
+
this.Xn = t, this.Nn = 1e3 / t, this.Wn && e && (this.rh(), this.ih(e));
|
|
2255
2255
|
}
|
|
2256
|
-
|
|
2256
|
+
ah() {
|
|
2257
2257
|
const t = performance.now();
|
|
2258
|
-
if (this.
|
|
2259
|
-
const e = t - this.
|
|
2260
|
-
this.
|
|
2261
|
-
const i = this.
|
|
2262
|
-
this.
|
|
2258
|
+
if (this.qn > 0) {
|
|
2259
|
+
const e = t - this.qn;
|
|
2260
|
+
this.th = e, this.Vn.push(e), this.Vn.length > this.Jn && this.Vn.shift();
|
|
2261
|
+
const i = this.Vn.reduce((s, r) => s + r, 0) / this.Vn.length;
|
|
2262
|
+
this.Zn = 1e3 / i;
|
|
2263
2263
|
}
|
|
2264
|
-
this.
|
|
2264
|
+
this.qn = t;
|
|
2265
|
+
}
|
|
2266
|
+
get uh() {
|
|
2267
|
+
return this.Wn;
|
|
2265
2268
|
}
|
|
2266
2269
|
get fh() {
|
|
2267
2270
|
return this.Zn;
|
|
2268
2271
|
}
|
|
2269
2272
|
get dh() {
|
|
2270
|
-
return this.
|
|
2273
|
+
return this.Xn;
|
|
2274
|
+
}
|
|
2275
|
+
set dh(t) {
|
|
2276
|
+
this.Xn = t, this.Nn = 1e3 / t;
|
|
2271
2277
|
}
|
|
2272
2278
|
get ph() {
|
|
2273
|
-
return this.
|
|
2279
|
+
return this.sh;
|
|
2274
2280
|
}
|
|
2275
2281
|
set ph(t) {
|
|
2276
|
-
this.
|
|
2282
|
+
this.sh = t;
|
|
2277
2283
|
}
|
|
2278
|
-
|
|
2279
|
-
|
|
2284
|
+
gh() {
|
|
2285
|
+
this.sh++;
|
|
2280
2286
|
}
|
|
2281
|
-
|
|
2282
|
-
this.eh
|
|
2287
|
+
get mh() {
|
|
2288
|
+
return this.eh === -1 ? 0 : performance.now() - this.eh;
|
|
2283
2289
|
}
|
|
2284
|
-
mh() {
|
|
2285
|
-
this.eh
|
|
2290
|
+
set mh(t) {
|
|
2291
|
+
this.eh = performance.now() - t;
|
|
2286
2292
|
}
|
|
2287
2293
|
get _h() {
|
|
2288
|
-
return this.
|
|
2294
|
+
return this.mh / 1e3;
|
|
2289
2295
|
}
|
|
2290
2296
|
set _h(t) {
|
|
2291
|
-
this.
|
|
2297
|
+
this.mh = 1e3 * t;
|
|
2292
2298
|
}
|
|
2293
2299
|
get yh() {
|
|
2294
|
-
return this.
|
|
2295
|
-
}
|
|
2296
|
-
set yh(t) {
|
|
2297
|
-
this._h = 1e3 * t;
|
|
2298
|
-
}
|
|
2299
|
-
get Ah() {
|
|
2300
|
-
return this.sh;
|
|
2300
|
+
return this.th;
|
|
2301
2301
|
}
|
|
2302
2302
|
}
|
|
2303
2303
|
function zt(n, t, e) {
|
|
@@ -2306,261 +2306,267 @@ function zt(n, t, e) {
|
|
|
2306
2306
|
class kt {
|
|
2307
2307
|
constructor(t, e) {
|
|
2308
2308
|
o(this, "Xr");
|
|
2309
|
-
o(this, "
|
|
2309
|
+
o(this, "Ah");
|
|
2310
|
+
o(this, "wh", { x: -1 / 0, y: -1 / 0 });
|
|
2310
2311
|
o(this, "bh", { x: -1 / 0, y: -1 / 0 });
|
|
2311
|
-
o(this, "Ch",
|
|
2312
|
-
o(this, "xh",
|
|
2313
|
-
o(this, "Mh"
|
|
2312
|
+
o(this, "Ch", null);
|
|
2313
|
+
o(this, "xh", 0);
|
|
2314
|
+
o(this, "Mh");
|
|
2314
2315
|
o(this, "Fh");
|
|
2315
2316
|
o(this, "$h");
|
|
2316
2317
|
o(this, "Ph");
|
|
2317
2318
|
o(this, "Th");
|
|
2318
2319
|
o(this, "Sh");
|
|
2319
|
-
o(this, "Eh");
|
|
2320
|
-
o(this, "kh"
|
|
2320
|
+
o(this, "Eh", !1);
|
|
2321
|
+
o(this, "kh");
|
|
2321
2322
|
o(this, "Rh");
|
|
2322
|
-
o(this, "Dh");
|
|
2323
2323
|
o(this, "Lh");
|
|
2324
|
+
o(this, "Dh");
|
|
2324
2325
|
o(this, "Oh");
|
|
2325
|
-
|
|
2326
|
-
this.Xr = t, this.wh = e;
|
|
2326
|
+
this.Xr = t, this.Ah = e;
|
|
2327
2327
|
}
|
|
2328
|
-
|
|
2328
|
+
zh(t) {
|
|
2329
2329
|
const e = performance.now() + Math.max(0, t);
|
|
2330
|
-
e > this.
|
|
2330
|
+
e > this.xh && (this.xh = e);
|
|
2331
2331
|
}
|
|
2332
|
-
|
|
2333
|
-
return performance.now() < this.
|
|
2332
|
+
Hh() {
|
|
2333
|
+
return performance.now() < this.xh;
|
|
2334
2334
|
}
|
|
2335
|
-
|
|
2335
|
+
Bh(t) {
|
|
2336
2336
|
const e = this.Xr.canvas;
|
|
2337
2337
|
e.style.cursor = t == null || t === "" ? "" : t;
|
|
2338
2338
|
}
|
|
2339
|
-
|
|
2340
|
-
if (this.
|
|
2339
|
+
Ih() {
|
|
2340
|
+
if (this.Eh) return;
|
|
2341
2341
|
const t = this.Xr.canvas;
|
|
2342
|
-
this.
|
|
2343
|
-
this.
|
|
2344
|
-
}, this
|
|
2345
|
-
this.
|
|
2342
|
+
this.Mh = (e) => {
|
|
2343
|
+
this.Gh(e), this.jh(e);
|
|
2344
|
+
}, this.Fh = () => {
|
|
2345
|
+
this.bh = { ...this.wh }, this.wh.x = -1 / 0, this.wh.y = -1 / 0, this.Ch = null;
|
|
2346
|
+
}, this.$h = (e) => {
|
|
2347
|
+
this.Gh(e), this.Qh(e);
|
|
2346
2348
|
}, this.Ph = (e) => {
|
|
2347
|
-
this.
|
|
2349
|
+
this.Gh(e), this.Nh(e);
|
|
2348
2350
|
}, this.Th = (e) => {
|
|
2349
|
-
this.
|
|
2351
|
+
this.Gh(e), this.Xh(e);
|
|
2350
2352
|
}, this.Sh = (e) => {
|
|
2351
|
-
this.
|
|
2352
|
-
}, this.
|
|
2353
|
-
this.jh(e), this.Kh(e);
|
|
2354
|
-
}, t.addEventListener("mousemove", this.Fh, { passive: !0 }), t.addEventListener("mouseleave", this.$h, { passive: !0 }), t.addEventListener("mousedown", this.Ph, { passive: !0 }), t.addEventListener("mouseup", this.Th, { passive: !0 }), t.addEventListener("click", this.Sh, { passive: !0 }), t.addEventListener("wheel", this.Eh, { passive: !1 }), this.kh = !0;
|
|
2353
|
+
this.Gh(e), this.Yh(e);
|
|
2354
|
+
}, t.addEventListener("mousemove", this.Mh, { passive: !0 }), t.addEventListener("mouseleave", this.Fh, { passive: !0 }), t.addEventListener("mousedown", this.$h, { passive: !0 }), t.addEventListener("mouseup", this.Ph, { passive: !0 }), t.addEventListener("click", this.Th, { passive: !0 }), t.addEventListener("wheel", this.Sh, { passive: !1 }), this.Eh = !0;
|
|
2355
2355
|
}
|
|
2356
|
-
|
|
2357
|
-
if (!this.
|
|
2356
|
+
Kh() {
|
|
2357
|
+
if (!this.Eh) return;
|
|
2358
2358
|
const t = this.Xr.canvas;
|
|
2359
|
-
t.removeEventListener("mousemove", this.
|
|
2359
|
+
t.removeEventListener("mousemove", this.Mh), t.removeEventListener("mouseleave", this.Fh), t.removeEventListener("mousedown", this.$h), t.removeEventListener("mouseup", this.Ph), t.removeEventListener("click", this.Th), t.removeEventListener("wheel", this.Sh), this.Eh = !1;
|
|
2360
2360
|
}
|
|
2361
|
-
|
|
2362
|
-
if (this.
|
|
2363
|
-
if (this.
|
|
2364
|
-
const t = new MouseEvent("mousemove", { clientX: this.
|
|
2365
|
-
this.
|
|
2361
|
+
Wh() {
|
|
2362
|
+
if (this.Eh) try {
|
|
2363
|
+
if (this.Ch) {
|
|
2364
|
+
const t = new MouseEvent("mousemove", { clientX: this.Ch.x, clientY: this.Ch.y, bubbles: !1, cancelable: !1 });
|
|
2365
|
+
this.Gh(t);
|
|
2366
2366
|
}
|
|
2367
2367
|
} catch {
|
|
2368
|
-
this.
|
|
2368
|
+
this.wh.x = -1 / 0, this.wh.y = -1 / 0;
|
|
2369
2369
|
}
|
|
2370
2370
|
}
|
|
2371
|
+
Zh(t) {
|
|
2372
|
+
this.kh = t;
|
|
2373
|
+
}
|
|
2371
2374
|
qh(t) {
|
|
2372
2375
|
this.Rh = t;
|
|
2373
2376
|
}
|
|
2374
2377
|
Vh(t) {
|
|
2375
|
-
this.
|
|
2378
|
+
this.Lh = t;
|
|
2376
2379
|
}
|
|
2377
2380
|
Jh(t) {
|
|
2378
|
-
this.
|
|
2381
|
+
this.Dh = t;
|
|
2379
2382
|
}
|
|
2380
2383
|
so(t) {
|
|
2381
2384
|
this.Oh = t;
|
|
2382
2385
|
}
|
|
2383
|
-
eo(
|
|
2384
|
-
this.
|
|
2386
|
+
eo() {
|
|
2387
|
+
return { x: this.wh.x, y: this.wh.y };
|
|
2385
2388
|
}
|
|
2386
|
-
io() {
|
|
2387
|
-
return {
|
|
2389
|
+
io(t, e = {}) {
|
|
2390
|
+
return { position: { ...this.wh }, previousPosition: { ...this.bh }, originalEvent: t, ...e };
|
|
2388
2391
|
}
|
|
2389
|
-
|
|
2390
|
-
|
|
2392
|
+
jh(t) {
|
|
2393
|
+
this.Dh && !this.Hh() && this.Dh(this.io(t));
|
|
2391
2394
|
}
|
|
2392
2395
|
Qh(t) {
|
|
2393
|
-
this.
|
|
2396
|
+
this.Rh && !this.Hh() && this.Rh(this.io(t, { button: t.button }));
|
|
2394
2397
|
}
|
|
2395
2398
|
Nh(t) {
|
|
2396
|
-
this.
|
|
2399
|
+
this.Lh && !this.Hh() && this.Lh(this.io(t, { button: t.button }));
|
|
2397
2400
|
}
|
|
2398
2401
|
Xh(t) {
|
|
2399
|
-
this.
|
|
2402
|
+
this.kh && !this.Hh() && this.kh(this.io(t, { button: t.button }));
|
|
2400
2403
|
}
|
|
2401
2404
|
Yh(t) {
|
|
2402
|
-
this.
|
|
2405
|
+
this.Oh && !this.Hh() && this.Oh(this.io(t, { delta: { x: t.deltaX, y: t.deltaY } }));
|
|
2403
2406
|
}
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
jh(t) {
|
|
2408
|
-
const e = this.wh();
|
|
2409
|
-
this.Ch = { ...this.bh }, this.xh = { x: t.clientX, y: t.clientY };
|
|
2407
|
+
Gh(t) {
|
|
2408
|
+
const e = this.Ah();
|
|
2409
|
+
this.bh = { ...this.wh }, this.Ch = { x: t.clientX, y: t.clientY };
|
|
2410
2410
|
const i = zt(e, t.clientX, t.clientY);
|
|
2411
|
-
this.
|
|
2411
|
+
this.wh.x = i.x, this.wh.y = i.y;
|
|
2412
2412
|
}
|
|
2413
2413
|
}
|
|
2414
2414
|
const Ge = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: kt }, Symbol.toStringTag, { value: "Module" }));
|
|
2415
|
-
class
|
|
2415
|
+
class Ht {
|
|
2416
2416
|
constructor() {
|
|
2417
|
-
o(this, "
|
|
2417
|
+
o(this, "ro", /* @__PURE__ */ new Map());
|
|
2418
|
+
o(this, "no", null);
|
|
2418
2419
|
o(this, "ho", null);
|
|
2419
|
-
o(this, "oo"
|
|
2420
|
+
o(this, "oo");
|
|
2420
2421
|
o(this, "ao");
|
|
2422
|
+
o(this, "Eh", !1);
|
|
2421
2423
|
o(this, "co");
|
|
2422
|
-
o(this, "kh", !1);
|
|
2423
2424
|
o(this, "lo");
|
|
2424
|
-
o(this, "uo");
|
|
2425
|
-
o(this, "fo", { ArrowUp: "UP_ARROW", ArrowDown: "DOWN_ARROW", ArrowLeft: "LEFT_ARROW", ArrowRight: "RIGHT_ARROW", F1: "F1", F2: "F2", F3: "F3", F4: "F4", F5: "F5", F6: "F6", F7: "F7", F8: "F8", F9: "F9", F10: "F10", F11: "F11", F12: "F12", Enter: "ENTER", Return: "RETURN", Tab: "TAB", Escape: "ESCAPE", Backspace: "BACKSPACE", Delete: "DELETE", Insert: "INSERT", Home: "HOME", End: "END", PageUp: "PAGE_UP", PageDown: "PAGE_DOWN", Shift: "SHIFT", Control: "CONTROL", Alt: "ALT", Meta: "META", " ": "SPACE" });
|
|
2425
|
+
o(this, "uo", { ArrowUp: "UP_ARROW", ArrowDown: "DOWN_ARROW", ArrowLeft: "LEFT_ARROW", ArrowRight: "RIGHT_ARROW", F1: "F1", F2: "F2", F3: "F3", F4: "F4", F5: "F5", F6: "F6", F7: "F7", F8: "F8", F9: "F9", F10: "F10", F11: "F11", F12: "F12", Enter: "ENTER", Return: "RETURN", Tab: "TAB", Escape: "ESCAPE", Backspace: "BACKSPACE", Delete: "DELETE", Insert: "INSERT", Home: "HOME", End: "END", PageUp: "PAGE_UP", PageDown: "PAGE_DOWN", Shift: "SHIFT", Control: "CONTROL", Alt: "ALT", Meta: "META", " ": "SPACE" });
|
|
2426
2426
|
}
|
|
2427
|
-
|
|
2428
|
-
this.
|
|
2427
|
+
Ih() {
|
|
2428
|
+
this.Eh || (this.oo = (t) => {
|
|
2429
|
+
this.fo(t);
|
|
2430
|
+
}, this.ao = (t) => {
|
|
2429
2431
|
this.do(t);
|
|
2430
|
-
}, this.
|
|
2431
|
-
this.po(t);
|
|
2432
|
-
}, window.addEventListener("keydown", this.ao, { passive: !1 }), window.addEventListener("keyup", this.co, { passive: !1 }), this.kh = !0);
|
|
2432
|
+
}, window.addEventListener("keydown", this.oo, { passive: !1 }), window.addEventListener("keyup", this.ao, { passive: !1 }), this.Eh = !0);
|
|
2433
2433
|
}
|
|
2434
|
-
|
|
2435
|
-
this.
|
|
2434
|
+
Kh() {
|
|
2435
|
+
this.Eh && (window.removeEventListener("keydown", this.oo), window.removeEventListener("keyup", this.ao), this.Eh = !1, this.ro.clear(), this.no = null, this.ho = null);
|
|
2436
|
+
}
|
|
2437
|
+
qh(t) {
|
|
2438
|
+
this.co = t;
|
|
2436
2439
|
}
|
|
2437
2440
|
Vh(t) {
|
|
2438
2441
|
this.lo = t;
|
|
2439
2442
|
}
|
|
2440
|
-
|
|
2441
|
-
this.
|
|
2442
|
-
}
|
|
2443
|
-
vo(t) {
|
|
2444
|
-
const e = this.mo(t), i = this.no.get(t) || this.no.get(e);
|
|
2443
|
+
po(t) {
|
|
2444
|
+
const e = this.vo(t), i = this.ro.get(t) || this.ro.get(e);
|
|
2445
2445
|
return (i == null ? void 0 : i.isPressed) || !1;
|
|
2446
2446
|
}
|
|
2447
|
+
mo() {
|
|
2448
|
+
return this.no;
|
|
2449
|
+
}
|
|
2447
2450
|
_o() {
|
|
2448
2451
|
return this.ho;
|
|
2449
2452
|
}
|
|
2450
2453
|
yo() {
|
|
2451
|
-
return this.oo;
|
|
2452
|
-
}
|
|
2453
|
-
Ao() {
|
|
2454
2454
|
const t = [];
|
|
2455
|
-
for (const [e, i] of this.
|
|
2455
|
+
for (const [e, i] of this.ro) i.isPressed && t.push(e);
|
|
2456
2456
|
return t;
|
|
2457
2457
|
}
|
|
2458
|
-
|
|
2459
|
-
return { ctrl: this.
|
|
2458
|
+
Ao() {
|
|
2459
|
+
return { ctrl: this.po("Control"), shift: this.po("Shift"), alt: this.po("Alt"), meta: this.po("Meta") };
|
|
2460
2460
|
}
|
|
2461
|
-
|
|
2462
|
-
this.
|
|
2461
|
+
wo() {
|
|
2462
|
+
this.ro.clear(), this.no = null, this.ho = null;
|
|
2463
2463
|
}
|
|
2464
|
-
|
|
2464
|
+
fo(t) {
|
|
2465
2465
|
const e = t.key, i = Date.now();
|
|
2466
|
-
this.
|
|
2467
|
-
const s = this.
|
|
2468
|
-
s.isPressed || (s.isPressed = !0, s.lastPressTime = i, this.
|
|
2466
|
+
this.ro.has(e) || this.ro.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
2467
|
+
const s = this.ro.get(e);
|
|
2468
|
+
s.isPressed || (s.isPressed = !0, s.lastPressTime = i, this.no = e, this.co && this.co(this.io(e, !0, t)));
|
|
2469
2469
|
}
|
|
2470
|
-
|
|
2470
|
+
io(t, e, i) {
|
|
2471
2471
|
return { key: t, keyCode: i.keyCode, ctrlKey: i.ctrlKey, shiftKey: i.shiftKey, altKey: i.altKey, metaKey: i.metaKey, isPressed: e, originalEvent: i };
|
|
2472
2472
|
}
|
|
2473
|
-
|
|
2473
|
+
do(t) {
|
|
2474
2474
|
const e = t.key, i = Date.now();
|
|
2475
|
-
this.
|
|
2476
|
-
const s = this.
|
|
2477
|
-
s.isPressed = !1, s.lastReleaseTime = i, this.
|
|
2475
|
+
this.ro.has(e) || this.ro.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
2476
|
+
const s = this.ro.get(e);
|
|
2477
|
+
s.isPressed = !1, s.lastReleaseTime = i, this.ho = e, this.lo && this.lo(this.io(e, !1, t));
|
|
2478
2478
|
}
|
|
2479
|
-
|
|
2480
|
-
return this.
|
|
2479
|
+
vo(t) {
|
|
2480
|
+
return this.uo[t] || t.toLowerCase();
|
|
2481
2481
|
}
|
|
2482
2482
|
}
|
|
2483
|
-
const
|
|
2483
|
+
const Ve = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Ht }, Symbol.toStringTag, { value: "Module" }));
|
|
2484
2484
|
class Gt {
|
|
2485
2485
|
constructor(t, e, i) {
|
|
2486
2486
|
o(this, "Xr");
|
|
2487
|
-
o(this, "
|
|
2488
|
-
o(this, "
|
|
2487
|
+
o(this, "bo");
|
|
2488
|
+
o(this, "Ah");
|
|
2489
|
+
o(this, "Co", /* @__PURE__ */ new Map());
|
|
2489
2490
|
o(this, "xo", /* @__PURE__ */ new Map());
|
|
2490
2491
|
o(this, "Mo", /* @__PURE__ */ new Map());
|
|
2491
|
-
o(this, "Fo",
|
|
2492
|
-
o(this, "$o"
|
|
2492
|
+
o(this, "Fo", null);
|
|
2493
|
+
o(this, "$o");
|
|
2493
2494
|
o(this, "Po");
|
|
2494
2495
|
o(this, "To");
|
|
2495
2496
|
o(this, "So");
|
|
2497
|
+
o(this, "Uo");
|
|
2496
2498
|
o(this, "Eo");
|
|
2499
|
+
o(this, "Eh", !1);
|
|
2497
2500
|
o(this, "ko");
|
|
2498
2501
|
o(this, "Ro");
|
|
2499
|
-
o(this, "kh", !1);
|
|
2500
|
-
o(this, "Do");
|
|
2501
2502
|
o(this, "Lo");
|
|
2503
|
+
o(this, "Do");
|
|
2502
2504
|
o(this, "Oo");
|
|
2503
2505
|
o(this, "zo");
|
|
2504
2506
|
o(this, "Ho");
|
|
2505
2507
|
o(this, "Bo");
|
|
2506
2508
|
o(this, "Io");
|
|
2507
2509
|
o(this, "Go");
|
|
2508
|
-
o(this, "jo");
|
|
2509
|
-
o(this, "Qo");
|
|
2510
|
-
o(this, "No",
|
|
2511
|
-
o(this, "Xo",
|
|
2512
|
-
o(this, "Yo",
|
|
2513
|
-
o(this, "Ko",
|
|
2514
|
-
o(this, "Wo",
|
|
2515
|
-
o(this, "Zo",
|
|
2516
|
-
o(this, "qo",
|
|
2517
|
-
o(this, "Vo",
|
|
2518
|
-
o(this, "Jo",
|
|
2519
|
-
o(this, "ta",
|
|
2520
|
-
|
|
2521
|
-
o(this, "ea", null);
|
|
2522
|
-
this.Xr = t, this.wh = e, this.Co = i;
|
|
2510
|
+
o(this, "jo", 320);
|
|
2511
|
+
o(this, "Qo", 350);
|
|
2512
|
+
o(this, "No", 10);
|
|
2513
|
+
o(this, "Xo", 550);
|
|
2514
|
+
o(this, "Yo", 14);
|
|
2515
|
+
o(this, "Ko", 48);
|
|
2516
|
+
o(this, "Wo", 650);
|
|
2517
|
+
o(this, "Zo", 0.02);
|
|
2518
|
+
o(this, "qo", 2);
|
|
2519
|
+
o(this, "Vo", 600);
|
|
2520
|
+
o(this, "Jo", 0);
|
|
2521
|
+
o(this, "ta", null);
|
|
2522
|
+
this.Xr = t, this.Ah = e, this.bo = i;
|
|
2523
2523
|
const s = this.Xr.canvas;
|
|
2524
|
-
this
|
|
2524
|
+
this.$o = s.style.touchAction, this.Po = s.style.userSelect, s.style.touchAction || (s.style.touchAction = "none"), s.style.userSelect || (s.style.userSelect = "none");
|
|
2525
2525
|
}
|
|
2526
|
-
|
|
2527
|
-
if (this.
|
|
2526
|
+
Ih() {
|
|
2527
|
+
if (this.Eh) return;
|
|
2528
2528
|
const t = this.Xr.canvas;
|
|
2529
|
-
this.
|
|
2529
|
+
this.To = (e) => {
|
|
2530
|
+
this.sa(e);
|
|
2531
|
+
}, this.So = (e) => {
|
|
2532
|
+
this.ea(e);
|
|
2533
|
+
}, this.Uo = (e) => {
|
|
2530
2534
|
this.ia(e);
|
|
2531
2535
|
}, this.Eo = (e) => {
|
|
2532
2536
|
this.ra(e);
|
|
2533
|
-
}, this.
|
|
2534
|
-
this.na(e);
|
|
2535
|
-
}, this.Ro = (e) => {
|
|
2536
|
-
this.ha(e);
|
|
2537
|
-
}, t.addEventListener("touchstart", this.So, { passive: !1 }), t.addEventListener("touchmove", this.Eo, { passive: !1 }), t.addEventListener("touchend", this.ko, { passive: !1 }), t.addEventListener("touchcancel", this.Ro, { passive: !1 }), this.kh = !0;
|
|
2537
|
+
}, t.addEventListener("touchstart", this.To, { passive: !1 }), t.addEventListener("touchmove", this.So, { passive: !1 }), t.addEventListener("touchend", this.Uo, { passive: !1 }), t.addEventListener("touchcancel", this.Eo, { passive: !1 }), this.Eh = !0;
|
|
2538
2538
|
}
|
|
2539
|
-
|
|
2540
|
-
if (!this.
|
|
2539
|
+
Kh() {
|
|
2540
|
+
if (!this.Eh) return;
|
|
2541
2541
|
const t = this.Xr.canvas;
|
|
2542
|
-
t.removeEventListener("touchstart", this.
|
|
2542
|
+
t.removeEventListener("touchstart", this.To), t.removeEventListener("touchmove", this.So), t.removeEventListener("touchend", this.Uo), t.removeEventListener("touchcancel", this.Eo), this.Eh = !1, this.Fo = null, this.Co.clear(), this.xo.clear(), this.Mo.forEach((e) => {
|
|
2543
2543
|
e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
|
|
2544
|
-
}), this.
|
|
2544
|
+
}), this.Mo.clear(), this.ta = null, this.Jo = 0, t.style.touchAction = this.$o, t.style.userSelect = this.Po;
|
|
2545
2545
|
}
|
|
2546
|
-
|
|
2547
|
-
if (!this.
|
|
2546
|
+
Wh() {
|
|
2547
|
+
if (!this.Ah() || this.Co.size === 0) return;
|
|
2548
2548
|
const t = /* @__PURE__ */ new Map();
|
|
2549
|
-
for (const e of this.
|
|
2550
|
-
const i = this.
|
|
2549
|
+
for (const e of this.Co.values()) {
|
|
2550
|
+
const i = this.na(e.clientX, e.clientY, e.id, e);
|
|
2551
2551
|
t.set(e.id, i);
|
|
2552
2552
|
}
|
|
2553
|
-
this.
|
|
2553
|
+
this.Co = t;
|
|
2554
2554
|
}
|
|
2555
|
-
|
|
2556
|
-
return Array.from(this.
|
|
2555
|
+
ha() {
|
|
2556
|
+
return Array.from(this.Co.values()).map((t) => ({ ...t }));
|
|
2557
2557
|
}
|
|
2558
|
-
|
|
2559
|
-
this.
|
|
2558
|
+
oa(t) {
|
|
2559
|
+
this.ko = t;
|
|
2560
2560
|
}
|
|
2561
|
-
|
|
2561
|
+
Jh(t) {
|
|
2562
|
+
this.Ro = t;
|
|
2563
|
+
}
|
|
2564
|
+
aa(t) {
|
|
2562
2565
|
this.Lo = t;
|
|
2563
2566
|
}
|
|
2567
|
+
ca(t) {
|
|
2568
|
+
this.Do = t;
|
|
2569
|
+
}
|
|
2564
2570
|
la(t) {
|
|
2565
2571
|
this.Oo = t;
|
|
2566
2572
|
}
|
|
@@ -2579,114 +2585,108 @@ class Gt {
|
|
|
2579
2585
|
va(t) {
|
|
2580
2586
|
this.Go = t;
|
|
2581
2587
|
}
|
|
2582
|
-
|
|
2583
|
-
this.jo = t;
|
|
2584
|
-
}
|
|
2585
|
-
ma(t) {
|
|
2586
|
-
this.Qo = t;
|
|
2587
|
-
}
|
|
2588
|
-
ia(t) {
|
|
2588
|
+
sa(t) {
|
|
2589
2589
|
var s;
|
|
2590
|
-
if (!this.
|
|
2591
|
-
t.preventDefault(), (s = this.
|
|
2592
|
-
const e = performance.now(), i = this.
|
|
2590
|
+
if (!this.Ah()) return;
|
|
2591
|
+
t.preventDefault(), (s = this.bo) == null || s.zh(this.Vo);
|
|
2592
|
+
const e = performance.now(), i = this.ga(t.changedTouches);
|
|
2593
2593
|
for (const r of i) {
|
|
2594
|
-
const h = this.
|
|
2595
|
-
h && this.
|
|
2594
|
+
const h = this.Co.get(r.id);
|
|
2595
|
+
h && this.xo.set(r.id, this.ma(h)), this.Co.set(r.id, r);
|
|
2596
2596
|
const a = { id: r.id, startPosition: r, lastPosition: r, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
|
|
2597
|
-
this.
|
|
2598
|
-
const l = this.
|
|
2599
|
-
l && (a.longPressFired = !0, this.
|
|
2600
|
-
}, this.
|
|
2597
|
+
this.Ho && (a.longPressTimer = window.setTimeout(() => {
|
|
2598
|
+
const l = this.Co.get(r.id);
|
|
2599
|
+
l && (a.longPressFired = !0, this.Ho({ touch: this.ma(l), duration: performance.now() - a.startTime, originalEvent: t }));
|
|
2600
|
+
}, this.Xo)), this.Mo.set(r.id, a), this.ko && this.ko(this._a(r, t, void 0, e));
|
|
2601
2601
|
}
|
|
2602
|
-
this.
|
|
2602
|
+
this.Co.size === 2 && this.ya();
|
|
2603
2603
|
}
|
|
2604
|
-
|
|
2604
|
+
ea(t) {
|
|
2605
2605
|
var s;
|
|
2606
|
-
if (!this.
|
|
2607
|
-
t.preventDefault(), (s = this.
|
|
2608
|
-
const e = performance.now(), i = this.
|
|
2606
|
+
if (!this.Ah()) return;
|
|
2607
|
+
t.preventDefault(), (s = this.bo) == null || s.zh(this.Vo);
|
|
2608
|
+
const e = performance.now(), i = this.ga(t.changedTouches);
|
|
2609
2609
|
for (const r of i) {
|
|
2610
|
-
const h = this.
|
|
2611
|
-
a && this.
|
|
2612
|
-
const l = this.
|
|
2613
|
-
l && (l.lastPosition = r, l.lastTime = e, a) && q(a.clientX, a.clientY, r.clientX, r.clientY) > this.
|
|
2610
|
+
const h = this.Co.get(r.id), a = h ? this.ma(h) : void 0;
|
|
2611
|
+
a && this.xo.set(r.id, a), this.Co.set(r.id, r);
|
|
2612
|
+
const l = this.Mo.get(r.id);
|
|
2613
|
+
l && (l.lastPosition = r, l.lastTime = e, a) && q(a.clientX, a.clientY, r.clientX, r.clientY) > this.Yo && l.longPressTimer !== null && (window.clearTimeout(l.longPressTimer), l.longPressTimer = null), this.Ro && this.Ro(this._a(r, t, a, e));
|
|
2614
2614
|
}
|
|
2615
|
-
this.
|
|
2615
|
+
this.Co.size === 2 ? this.wa(t) : this.Fo = null;
|
|
2616
2616
|
}
|
|
2617
|
-
|
|
2618
|
-
if (!this.
|
|
2617
|
+
ia(t) {
|
|
2618
|
+
if (!this.Ah()) return;
|
|
2619
2619
|
t.preventDefault();
|
|
2620
|
-
const e = performance.now(), i = this.
|
|
2620
|
+
const e = performance.now(), i = this.ga(t.changedTouches);
|
|
2621
2621
|
for (const s of i) {
|
|
2622
|
-
const r = this.
|
|
2623
|
-
a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.
|
|
2622
|
+
const r = this.Co.get(s.id), h = r ? this.ma(r) : void 0, a = this.Mo.get(s.id);
|
|
2623
|
+
a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.Lo && this.Lo(this._a(s, t, h, e)), a && this.ba(a, t), this.Mo.delete(s.id), this.xo.delete(s.id), this.Co.delete(s.id);
|
|
2624
2624
|
}
|
|
2625
|
-
this.
|
|
2625
|
+
this.Co.size < 2 && (this.Fo = null);
|
|
2626
2626
|
}
|
|
2627
|
-
|
|
2628
|
-
if (!this.
|
|
2627
|
+
ra(t) {
|
|
2628
|
+
if (!this.Ah()) return;
|
|
2629
2629
|
t.preventDefault();
|
|
2630
|
-
const e = performance.now(), i = this.
|
|
2630
|
+
const e = performance.now(), i = this.ga(t.changedTouches);
|
|
2631
2631
|
for (const s of i) {
|
|
2632
|
-
const r = this.
|
|
2633
|
-
a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.
|
|
2632
|
+
const r = this.Co.get(s.id), h = r ? this.ma(r) : void 0, a = this.Mo.get(s.id);
|
|
2633
|
+
a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.Do && this.Do(this._a(s, t, h, e)), this.Mo.delete(s.id), this.xo.delete(s.id), this.Co.delete(s.id);
|
|
2634
2634
|
}
|
|
2635
|
-
this.
|
|
2635
|
+
this.Co.size < 2 && (this.Fo = null);
|
|
2636
2636
|
}
|
|
2637
|
-
|
|
2637
|
+
ga(t) {
|
|
2638
2638
|
const e = [];
|
|
2639
2639
|
for (let i = 0; i < t.length; i += 1) {
|
|
2640
2640
|
const s = t.item(i);
|
|
2641
|
-
s && e.push(this.
|
|
2641
|
+
s && e.push(this.Ca(s));
|
|
2642
2642
|
}
|
|
2643
2643
|
return e;
|
|
2644
2644
|
}
|
|
2645
|
-
|
|
2646
|
-
return this.
|
|
2645
|
+
Ca(t) {
|
|
2646
|
+
return this.na(t.clientX, t.clientY, t.identifier, { id: t.identifier, x: -1, y: -1, clientX: t.clientX, clientY: t.clientY, pressure: t.force, radiusX: t.radiusX, radiusY: t.radiusY, rotationAngle: t.rotationAngle });
|
|
2647
2647
|
}
|
|
2648
|
-
|
|
2649
|
-
const r = zt(this.
|
|
2648
|
+
na(t, e, i, s) {
|
|
2649
|
+
const r = zt(this.Ah(), t, e);
|
|
2650
2650
|
return { id: i, x: r.x, y: r.y, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
|
|
2651
2651
|
}
|
|
2652
|
-
|
|
2653
|
-
const r = this.
|
|
2654
|
-
return { touch: this.
|
|
2652
|
+
_a(t, e, i, s) {
|
|
2653
|
+
const r = this.Mo.get(t.id), h = Array.from(this.xo.values()).map((u) => this.ma(u)), a = Array.from(this.Co.values()).map((u) => this.ma(u)), l = this.ga(e.changedTouches);
|
|
2654
|
+
return { touch: this.ma(t), previousTouch: i ? this.ma(i) : void 0, touches: a, previousTouches: h, changedTouches: l, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
|
|
2655
2655
|
}
|
|
2656
|
-
|
|
2657
|
-
if (this.
|
|
2658
|
-
const t = Array.from(this.
|
|
2659
|
-
this
|
|
2656
|
+
ya() {
|
|
2657
|
+
if (this.Co.size !== 2) return void (this.Fo = null);
|
|
2658
|
+
const t = Array.from(this.Co.values()), [e, i] = t, s = q(e.x, e.y, i.x, i.y), r = Rt(e.clientX, e.clientY, i.clientX, i.clientY);
|
|
2659
|
+
this.Fo = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
|
|
2660
2660
|
}
|
|
2661
|
-
|
|
2662
|
-
if (this
|
|
2663
|
-
const [e, i] = this
|
|
2661
|
+
wa(t) {
|
|
2662
|
+
if (this.Fo || this.ya(), !this.Fo) return;
|
|
2663
|
+
const [e, i] = this.Fo.ids, s = this.Co.get(e), r = this.Co.get(i);
|
|
2664
2664
|
if (!s || !r) return;
|
|
2665
|
-
const h = q(s.x, s.y, r.x, r.y) / this
|
|
2666
|
-
this.
|
|
2667
|
-
let l = Rt(s.clientX, s.clientY, r.clientX, r.clientY) - this
|
|
2665
|
+
const h = q(s.x, s.y, r.x, r.y) / this.Fo.initialDistance, a = h - this.Fo.lastScale;
|
|
2666
|
+
this.Io && Math.abs(a) > this.Zo && (this.Io({ touches: [this.ma(s), this.ma(r)], scale: h, deltaScale: a, center: this.xa(s, r), originalEvent: t }), this.Fo.lastScale = h);
|
|
2667
|
+
let l = Rt(s.clientX, s.clientY, r.clientX, r.clientY) - this.Fo.initialAngle;
|
|
2668
2668
|
l = (l + 180) % 360 - 180;
|
|
2669
|
-
const u = l - this
|
|
2670
|
-
this.
|
|
2669
|
+
const u = l - this.Fo.lastRotation;
|
|
2670
|
+
this.Go && Math.abs(u) > this.qo && (this.Go({ touches: [this.ma(s), this.ma(r)], rotation: l, deltaRotation: u, center: this.xa(s, r), originalEvent: t }), this.Fo.lastRotation = l);
|
|
2671
2671
|
}
|
|
2672
|
-
|
|
2673
|
-
const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.
|
|
2672
|
+
xa(t, e) {
|
|
2673
|
+
const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.na(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
|
|
2674
2674
|
return { x: r.x, y: r.y };
|
|
2675
2675
|
}
|
|
2676
|
-
|
|
2676
|
+
ba(t, e) {
|
|
2677
2677
|
const i = performance.now(), s = i - t.startTime, r = t.lastPosition.clientX - t.startPosition.clientX, h = t.lastPosition.clientY - t.startPosition.clientY, a = Math.hypot(r, h);
|
|
2678
|
-
if (!t.longPressFired && s <= this.
|
|
2679
|
-
this
|
|
2680
|
-
else if (!t.longPressFired && s <= this.
|
|
2678
|
+
if (!t.longPressFired && s <= this.jo && a <= this.No)
|
|
2679
|
+
this.Ma(t.lastPosition, i) && this.zo ? this.zo({ touch: this.ma(t.lastPosition), taps: 2, originalEvent: e }) : this.Oo && this.Oo({ touch: this.ma(t.lastPosition), taps: 1, originalEvent: e });
|
|
2680
|
+
else if (!t.longPressFired && s <= this.Wo && a >= this.Ko) {
|
|
2681
2681
|
const l = Math.max(a, 1e-4), u = { x: r / l, y: h / l }, c = { x: r / s, y: h / s };
|
|
2682
|
-
this.
|
|
2682
|
+
this.Bo && this.Bo({ touch: this.ma(t.lastPosition), direction: u, distance: l, velocity: c, originalEvent: e });
|
|
2683
2683
|
}
|
|
2684
|
-
this.
|
|
2684
|
+
this.Jo = i, this.ta = this.ma(t.lastPosition);
|
|
2685
2685
|
}
|
|
2686
|
-
|
|
2687
|
-
return !this.
|
|
2686
|
+
Ma(t, e) {
|
|
2687
|
+
return !this.ta || e - this.Jo > this.Qo ? !1 : q(t.clientX, t.clientY, this.ta.clientX, this.ta.clientY) <= this.No;
|
|
2688
2688
|
}
|
|
2689
|
-
|
|
2689
|
+
ma(t) {
|
|
2690
2690
|
return { ...t };
|
|
2691
2691
|
}
|
|
2692
2692
|
}
|
|
@@ -2694,24 +2694,24 @@ const je = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
|
|
|
2694
2694
|
class Q extends xt {
|
|
2695
2695
|
constructor(e, i, s, r, h, a, l, u, c) {
|
|
2696
2696
|
super(e, i, s, r, h, a, l, u);
|
|
2697
|
-
o(this, "
|
|
2698
|
-
this.
|
|
2697
|
+
o(this, "Fa");
|
|
2698
|
+
this.Fa = c;
|
|
2699
2699
|
}
|
|
2700
|
-
static
|
|
2700
|
+
static $a(e, i, s, r, h) {
|
|
2701
2701
|
const a = e.context, l = wt(a, s), { width: u, height: c } = bt(s);
|
|
2702
2702
|
return new Q(a, e, l, i, u, c, r, h, s);
|
|
2703
2703
|
}
|
|
2704
|
-
|
|
2705
|
-
this.
|
|
2704
|
+
Pa() {
|
|
2705
|
+
this.Fa instanceof HTMLVideoElement ? this.Fa.readyState >= this.Fa.HAVE_CURRENT_DATA && rt(this.$, this.Mn, this.Fa) : rt(this.$, this.Mn, this.Fa);
|
|
2706
2706
|
}
|
|
2707
2707
|
V() {
|
|
2708
|
-
return this.
|
|
2708
|
+
return this.L = null, super.V();
|
|
2709
2709
|
}
|
|
2710
|
-
|
|
2711
|
-
this.
|
|
2710
|
+
zn() {
|
|
2711
|
+
this.Pa();
|
|
2712
2712
|
}
|
|
2713
2713
|
get source() {
|
|
2714
|
-
return this.
|
|
2714
|
+
return this.Fa;
|
|
2715
2715
|
}
|
|
2716
2716
|
}
|
|
2717
2717
|
class ut extends Q {
|
|
@@ -2719,12 +2719,12 @@ class ut extends Q {
|
|
|
2719
2719
|
super(t, e, i, s, h, a, l, u, r);
|
|
2720
2720
|
}
|
|
2721
2721
|
dispose() {
|
|
2722
|
-
super.dispose(), this.
|
|
2722
|
+
super.dispose(), this.Ta.pause(), this.Ta.src = "", this.Ta.load();
|
|
2723
2723
|
}
|
|
2724
|
-
|
|
2725
|
-
this.
|
|
2724
|
+
Sa() {
|
|
2725
|
+
this.Pa();
|
|
2726
2726
|
}
|
|
2727
|
-
static async
|
|
2727
|
+
static async Qn(t, e, i, s, r) {
|
|
2728
2728
|
const h = t.context, a = document.createElement("video");
|
|
2729
2729
|
a.crossOrigin = "anonymous", a.loop = !0, a.muted = !0, a.playsInline = !0, await new Promise((f, g) => {
|
|
2730
2730
|
a.addEventListener("loadedmetadata", () => f(), { once: !0 }), a.addEventListener("error", (p) => {
|
|
@@ -2737,40 +2737,40 @@ class ut extends Q {
|
|
|
2737
2737
|
return new ut(h, t, l, e, a, u, c, s, r);
|
|
2738
2738
|
}
|
|
2739
2739
|
async play() {
|
|
2740
|
-
await this.
|
|
2740
|
+
await this.Ta.play();
|
|
2741
2741
|
}
|
|
2742
2742
|
pause() {
|
|
2743
|
-
this.
|
|
2743
|
+
this.Ta.pause();
|
|
2744
2744
|
}
|
|
2745
2745
|
stop() {
|
|
2746
|
-
this.
|
|
2746
|
+
this.Ta.pause(), this.Ta.currentTime = 0;
|
|
2747
2747
|
}
|
|
2748
2748
|
speed(t) {
|
|
2749
|
-
return this.
|
|
2749
|
+
return this.Ta.playbackRate = t, this;
|
|
2750
2750
|
}
|
|
2751
2751
|
loop(t = !0) {
|
|
2752
|
-
return this.
|
|
2752
|
+
return this.Ta.loop = t, this;
|
|
2753
2753
|
}
|
|
2754
2754
|
time(t) {
|
|
2755
|
-
return this.
|
|
2755
|
+
return this.Ta.currentTime = t, this;
|
|
2756
2756
|
}
|
|
2757
2757
|
volume(t) {
|
|
2758
|
-
return this.
|
|
2758
|
+
return this.Ta.volume = X(t, 0, 1), this;
|
|
2759
2759
|
}
|
|
2760
2760
|
get videoElement() {
|
|
2761
|
-
return this.
|
|
2761
|
+
return this.Ta;
|
|
2762
2762
|
}
|
|
2763
2763
|
get currentTime() {
|
|
2764
|
-
return this.
|
|
2764
|
+
return this.Ta.currentTime;
|
|
2765
2765
|
}
|
|
2766
2766
|
get duration() {
|
|
2767
|
-
return this.
|
|
2767
|
+
return this.Ta.duration;
|
|
2768
2768
|
}
|
|
2769
2769
|
get isPlaying() {
|
|
2770
|
-
return !this.
|
|
2770
|
+
return !this.Ta.paused && !this.Ta.ended;
|
|
2771
2771
|
}
|
|
2772
|
-
get
|
|
2773
|
-
return this.
|
|
2772
|
+
get Ta() {
|
|
2773
|
+
return this.Fa;
|
|
2774
2774
|
}
|
|
2775
2775
|
}
|
|
2776
2776
|
async function st(n) {
|
|
@@ -2781,7 +2781,7 @@ async function st(n) {
|
|
|
2781
2781
|
}
|
|
2782
2782
|
return n;
|
|
2783
2783
|
}
|
|
2784
|
-
const
|
|
2784
|
+
const We = (n) => class extends n {
|
|
2785
2785
|
rotate(t = 0, e = 0, i = 0) {
|
|
2786
2786
|
this.R.state.Jt(t), this.R.state.ts(e), this.R.state.ss(i);
|
|
2787
2787
|
}
|
|
@@ -2902,10 +2902,10 @@ const Ze = (n) => class extends n {
|
|
|
2902
2902
|
this.R.xe(0, 0, 0, 0);
|
|
2903
2903
|
}
|
|
2904
2904
|
ellipse(t = 1, e = 1) {
|
|
2905
|
-
this.R.
|
|
2905
|
+
this.R.Li(t / 2, e / 2);
|
|
2906
2906
|
}
|
|
2907
2907
|
triangle(t, e, i, s, r, h) {
|
|
2908
|
-
this.R.
|
|
2908
|
+
this.R.Di(t, e, i, s, r, h);
|
|
2909
2909
|
}
|
|
2910
2910
|
bezierCurve(t, e, i, s, r, h, a, l) {
|
|
2911
2911
|
this.R.Oi(t, e, i, s, r, h, a, l);
|
|
@@ -2927,15 +2927,15 @@ const Ze = (n) => class extends n {
|
|
|
2927
2927
|
}
|
|
2928
2928
|
async createFilterShader(t) {
|
|
2929
2929
|
const e = await st(t), i = this.R.Pi(e);
|
|
2930
|
-
return this.
|
|
2930
|
+
return this.Ea(i), i;
|
|
2931
2931
|
}
|
|
2932
2932
|
async createShader(t, e) {
|
|
2933
2933
|
const i = await st(t), s = await st(e), r = this.R.Mi(i, s);
|
|
2934
|
-
return this.
|
|
2934
|
+
return this.Ea(r), r;
|
|
2935
2935
|
}
|
|
2936
2936
|
createFramebuffer(t) {
|
|
2937
2937
|
const e = this.R.Hi(t.width ?? this.grid.cols, t.height ?? this.grid.rows, t.attachments ?? 3);
|
|
2938
|
-
return this.
|
|
2938
|
+
return this.Ea(e), e;
|
|
2939
2939
|
}
|
|
2940
2940
|
image(t, e, i) {
|
|
2941
2941
|
this.R.Ti(t, e, i, this.font), t instanceof vt && this.R.Z();
|
|
@@ -2944,221 +2944,221 @@ const Ze = (n) => class extends n {
|
|
|
2944
2944
|
const e = t, i = await new Promise((r, h) => {
|
|
2945
2945
|
const a = new Image();
|
|
2946
2946
|
a.crossOrigin = "anonymous", a.onload = () => r(a), a.onerror = (l) => h(l), a.src = e;
|
|
2947
|
-
}), s =
|
|
2948
|
-
return this.
|
|
2947
|
+
}), s = K.Qn(this.R, this.Un, i, this.grid.cols, this.grid.rows);
|
|
2948
|
+
return this.Ea(s), s;
|
|
2949
2949
|
}
|
|
2950
2950
|
async loadVideo(t) {
|
|
2951
|
-
const e = await ut.
|
|
2952
|
-
return this.
|
|
2951
|
+
const e = await ut.Qn(this.R, this.Un, t, this.grid.cols, this.grid.rows);
|
|
2952
|
+
return this.Ea(e), e;
|
|
2953
2953
|
}
|
|
2954
2954
|
createTexture(t) {
|
|
2955
|
-
const e = Q
|
|
2956
|
-
return this.
|
|
2955
|
+
const e = Q.$a(this.R, this.Un, t, this.grid.cols, this.grid.rows);
|
|
2956
|
+
return this.Ea(e), e;
|
|
2957
2957
|
}
|
|
2958
|
-
},
|
|
2958
|
+
}, Ke = (n) => class extends n {
|
|
2959
2959
|
get frameCount() {
|
|
2960
|
-
return this.
|
|
2960
|
+
return this.ka.ph;
|
|
2961
2961
|
}
|
|
2962
2962
|
set frameCount(t) {
|
|
2963
|
-
this.
|
|
2963
|
+
this.ka.ph = t;
|
|
2964
2964
|
}
|
|
2965
2965
|
frameRate(t) {
|
|
2966
|
-
return t === void 0 ? this.
|
|
2966
|
+
return t === void 0 ? this.ka.fh : this.ka.oh(t, () => this.Ra());
|
|
2967
2967
|
}
|
|
2968
2968
|
targetFrameRate(t) {
|
|
2969
|
-
if (t === void 0) return this.
|
|
2970
|
-
this.
|
|
2969
|
+
if (t === void 0) return this.ka.dh;
|
|
2970
|
+
this.ka.dh = t;
|
|
2971
2971
|
}
|
|
2972
2972
|
noLoop() {
|
|
2973
|
-
this.
|
|
2973
|
+
this.ka.nh();
|
|
2974
2974
|
}
|
|
2975
2975
|
loop() {
|
|
2976
|
-
this.
|
|
2976
|
+
this.ka.hh(() => this.Ra());
|
|
2977
2977
|
}
|
|
2978
2978
|
redraw(t = 1) {
|
|
2979
|
-
if (yt.m(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.
|
|
2979
|
+
if (yt.m(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.Ra();
|
|
2980
2980
|
}
|
|
2981
2981
|
isLooping() {
|
|
2982
|
-
return this.
|
|
2982
|
+
return this.ka.uh;
|
|
2983
2983
|
}
|
|
2984
2984
|
get millis() {
|
|
2985
|
-
return this.
|
|
2985
|
+
return this.ka.mh;
|
|
2986
2986
|
}
|
|
2987
2987
|
set millis(t) {
|
|
2988
|
-
this.
|
|
2988
|
+
this.ka.mh = t;
|
|
2989
2989
|
}
|
|
2990
2990
|
get secs() {
|
|
2991
|
-
return this.
|
|
2991
|
+
return this.ka._h;
|
|
2992
2992
|
}
|
|
2993
2993
|
set secs(t) {
|
|
2994
|
-
this.
|
|
2994
|
+
this.ka._h = t;
|
|
2995
2995
|
}
|
|
2996
2996
|
deltaTime() {
|
|
2997
|
-
return this.
|
|
2997
|
+
return this.ka.yh;
|
|
2998
2998
|
}
|
|
2999
2999
|
}, Qe = (n) => class extends n {
|
|
3000
3000
|
constructor(...t) {
|
|
3001
3001
|
super(...t);
|
|
3002
3002
|
}
|
|
3003
3003
|
mouseClicked(t) {
|
|
3004
|
-
this.
|
|
3004
|
+
this.bo.Zh(t);
|
|
3005
3005
|
}
|
|
3006
3006
|
mousePressed(t) {
|
|
3007
|
-
this.
|
|
3007
|
+
this.bo.qh(t);
|
|
3008
3008
|
}
|
|
3009
3009
|
mouseReleased(t) {
|
|
3010
|
-
this.
|
|
3010
|
+
this.bo.Vh(t);
|
|
3011
3011
|
}
|
|
3012
3012
|
mouseMoved(t) {
|
|
3013
|
-
this.
|
|
3013
|
+
this.bo.Jh(t);
|
|
3014
3014
|
}
|
|
3015
3015
|
mouseScrolled(t) {
|
|
3016
|
-
this.
|
|
3016
|
+
this.bo.so(t);
|
|
3017
3017
|
}
|
|
3018
3018
|
get mouse() {
|
|
3019
|
-
return this.
|
|
3019
|
+
return this.bo.eo();
|
|
3020
3020
|
}
|
|
3021
3021
|
cursor(t) {
|
|
3022
|
-
this.
|
|
3022
|
+
this.bo.Bh(t);
|
|
3023
3023
|
}
|
|
3024
|
-
},
|
|
3024
|
+
}, Ze = (n) => class extends n {
|
|
3025
3025
|
constructor(...t) {
|
|
3026
3026
|
super(...t);
|
|
3027
3027
|
}
|
|
3028
3028
|
touchStarted(t) {
|
|
3029
|
-
this.
|
|
3029
|
+
this.La.oa(t);
|
|
3030
3030
|
}
|
|
3031
3031
|
touchMoved(t) {
|
|
3032
|
-
this.
|
|
3032
|
+
this.La.Jh(t);
|
|
3033
3033
|
}
|
|
3034
3034
|
touchEnded(t) {
|
|
3035
|
-
this.
|
|
3035
|
+
this.La.aa(t);
|
|
3036
3036
|
}
|
|
3037
3037
|
touchCancelled(t) {
|
|
3038
|
-
this.
|
|
3038
|
+
this.La.ca(t);
|
|
3039
3039
|
}
|
|
3040
3040
|
tap(t) {
|
|
3041
|
-
this.
|
|
3041
|
+
this.La.la(t);
|
|
3042
3042
|
}
|
|
3043
3043
|
doubleTap(t) {
|
|
3044
|
-
this.
|
|
3044
|
+
this.La.ua(t);
|
|
3045
3045
|
}
|
|
3046
3046
|
longPress(t) {
|
|
3047
|
-
this.
|
|
3047
|
+
this.La.fa(t);
|
|
3048
3048
|
}
|
|
3049
3049
|
swipe(t) {
|
|
3050
|
-
this.
|
|
3050
|
+
this.La.da(t);
|
|
3051
3051
|
}
|
|
3052
3052
|
pinch(t) {
|
|
3053
|
-
this.
|
|
3053
|
+
this.La.pa(t);
|
|
3054
3054
|
}
|
|
3055
3055
|
rotateGesture(t) {
|
|
3056
|
-
this.
|
|
3056
|
+
this.La.va(t);
|
|
3057
3057
|
}
|
|
3058
3058
|
get touches() {
|
|
3059
|
-
return this.
|
|
3059
|
+
return this.La.ha();
|
|
3060
3060
|
}
|
|
3061
3061
|
}, qe = (n) => class extends n {
|
|
3062
3062
|
constructor(...t) {
|
|
3063
3063
|
super(...t);
|
|
3064
3064
|
}
|
|
3065
3065
|
keyPressed(t) {
|
|
3066
|
-
this.
|
|
3066
|
+
this.Da.qh(t);
|
|
3067
3067
|
}
|
|
3068
3068
|
keyReleased(t) {
|
|
3069
|
-
this.
|
|
3069
|
+
this.Da.Vh(t);
|
|
3070
3070
|
}
|
|
3071
3071
|
isKeyPressed(t) {
|
|
3072
|
-
return this.
|
|
3072
|
+
return this.Da.po(t);
|
|
3073
3073
|
}
|
|
3074
3074
|
get lastKeyPressed() {
|
|
3075
|
-
return this.
|
|
3075
|
+
return this.Da.mo();
|
|
3076
3076
|
}
|
|
3077
3077
|
get lastKeyReleased() {
|
|
3078
|
-
return this.
|
|
3078
|
+
return this.Da._o();
|
|
3079
3079
|
}
|
|
3080
3080
|
get pressedKeys() {
|
|
3081
|
-
return this.
|
|
3081
|
+
return this.Da.yo();
|
|
3082
3082
|
}
|
|
3083
3083
|
get modifierState() {
|
|
3084
|
-
return this.
|
|
3084
|
+
return this.Da.Ao();
|
|
3085
3085
|
}
|
|
3086
3086
|
};
|
|
3087
|
-
class
|
|
3087
|
+
class Vt {
|
|
3088
3088
|
constructor(t) {
|
|
3089
|
-
o(this, "
|
|
3089
|
+
o(this, "Oa");
|
|
3090
|
+
o(this, "za", /* @__PURE__ */ new Map());
|
|
3091
|
+
o(this, "Ha", []);
|
|
3090
3092
|
o(this, "Ba", /* @__PURE__ */ new Map());
|
|
3091
|
-
o(this, "Ia",
|
|
3093
|
+
o(this, "Ia", /* @__PURE__ */ new Map());
|
|
3092
3094
|
o(this, "Ga", /* @__PURE__ */ new Map());
|
|
3093
3095
|
o(this, "ja", /* @__PURE__ */ new Map());
|
|
3094
3096
|
o(this, "Qa", /* @__PURE__ */ new Map());
|
|
3095
3097
|
o(this, "Na", /* @__PURE__ */ new Map());
|
|
3096
3098
|
o(this, "Xa", /* @__PURE__ */ new Map());
|
|
3097
3099
|
o(this, "Ya", /* @__PURE__ */ new Map());
|
|
3098
|
-
|
|
3099
|
-
o(this, "Wa", /* @__PURE__ */ new Map());
|
|
3100
|
-
this.Ha = t;
|
|
3100
|
+
this.Oa = t;
|
|
3101
3101
|
}
|
|
3102
|
-
|
|
3102
|
+
Ka(t) {
|
|
3103
3103
|
for (const e of t) {
|
|
3104
|
-
if (this.
|
|
3105
|
-
const i = this.
|
|
3104
|
+
if (this.za.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
|
|
3105
|
+
const i = this.Wa(e.name);
|
|
3106
3106
|
try {
|
|
3107
|
-
const s = e.install(this.
|
|
3107
|
+
const s = e.install(this.Oa, i);
|
|
3108
3108
|
s instanceof Promise && s.catch((r) => {
|
|
3109
|
-
console.error(`[textmode.js] Async plugin "${e.name}" installation error:`, r), this.
|
|
3109
|
+
console.error(`[textmode.js] Async plugin "${e.name}" installation error:`, r), this.Za(e.name);
|
|
3110
3110
|
});
|
|
3111
3111
|
} catch (s) {
|
|
3112
|
-
throw this.
|
|
3112
|
+
throw this.Za(e.name), s;
|
|
3113
3113
|
}
|
|
3114
|
-
this.
|
|
3114
|
+
this.za.set(e.name, e), this.Ha.push(e.name);
|
|
3115
3115
|
}
|
|
3116
3116
|
}
|
|
3117
|
-
async
|
|
3117
|
+
async qa(t) {
|
|
3118
3118
|
for (const e of t) {
|
|
3119
|
-
if (this.
|
|
3120
|
-
const i = this.
|
|
3119
|
+
if (this.za.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
|
|
3120
|
+
const i = this.Wa(e.name);
|
|
3121
3121
|
try {
|
|
3122
|
-
await e.install(this.
|
|
3122
|
+
await e.install(this.Oa, i);
|
|
3123
3123
|
} catch (s) {
|
|
3124
|
-
throw this.
|
|
3124
|
+
throw this.Za(e.name), s;
|
|
3125
3125
|
}
|
|
3126
|
-
this.
|
|
3126
|
+
this.za.set(e.name, e), this.Ha.push(e.name);
|
|
3127
3127
|
}
|
|
3128
3128
|
}
|
|
3129
|
-
async
|
|
3130
|
-
const e = this.
|
|
3129
|
+
async Va(t) {
|
|
3130
|
+
const e = this.za.get(t);
|
|
3131
3131
|
if (!e) return;
|
|
3132
|
-
const i = this.
|
|
3133
|
-
e.uninstall && await e.uninstall(this.
|
|
3132
|
+
const i = this.Wa(t);
|
|
3133
|
+
e.uninstall && await e.uninstall(this.Oa, i), this.za.delete(t), this.Ha.splice(this.Ha.indexOf(t), 1), this.Za(t);
|
|
3134
|
+
}
|
|
3135
|
+
Ja() {
|
|
3136
|
+
this.tc(this.Ba, (t) => t());
|
|
3134
3137
|
}
|
|
3135
3138
|
sc() {
|
|
3136
|
-
this.
|
|
3139
|
+
this.tc(this.Ia, (t) => t());
|
|
3137
3140
|
}
|
|
3138
|
-
|
|
3139
|
-
this.
|
|
3141
|
+
ec(t) {
|
|
3142
|
+
this.tc(this.Ga, (e) => e(t));
|
|
3140
3143
|
}
|
|
3141
|
-
|
|
3142
|
-
this.
|
|
3144
|
+
rc(t) {
|
|
3145
|
+
this.tc(this.ja, (e) => e(t));
|
|
3143
3146
|
}
|
|
3144
|
-
|
|
3145
|
-
this.
|
|
3147
|
+
nc(t) {
|
|
3148
|
+
this.tc(this.Qa, (e) => e(t));
|
|
3146
3149
|
}
|
|
3147
|
-
|
|
3148
|
-
this.
|
|
3150
|
+
async hc() {
|
|
3151
|
+
await this.oc(this.Na, (t) => t());
|
|
3149
3152
|
}
|
|
3150
3153
|
async ac() {
|
|
3151
|
-
await this.
|
|
3152
|
-
}
|
|
3153
|
-
async lc() {
|
|
3154
|
-
await this.cc(this.Ka, (t) => t());
|
|
3154
|
+
await this.oc(this.Xa, (t) => t());
|
|
3155
3155
|
}
|
|
3156
|
-
async
|
|
3157
|
-
const t = [...this.
|
|
3158
|
-
for (const e of t) await this.
|
|
3156
|
+
async cc() {
|
|
3157
|
+
const t = [...this.za.keys()];
|
|
3158
|
+
for (const e of t) await this.Va(e);
|
|
3159
3159
|
}
|
|
3160
|
-
|
|
3161
|
-
const e = this.
|
|
3160
|
+
Wa(t) {
|
|
3161
|
+
const e = this.Oa, i = this;
|
|
3162
3162
|
return { get renderer() {
|
|
3163
3163
|
return e.R;
|
|
3164
3164
|
}, get canvas() {
|
|
@@ -3173,184 +3173,184 @@ class Wt {
|
|
|
3173
3173
|
return e.layers.base.drawFramebuffer;
|
|
3174
3174
|
}, get asciiFramebuffer() {
|
|
3175
3175
|
return e.layers.base.asciiFramebuffer;
|
|
3176
|
-
}, registerPreDrawHook: (s) => i.
|
|
3177
|
-
i.
|
|
3176
|
+
}, registerPreDrawHook: (s) => i.lc(i.Ba, t, s), registerPostDrawHook: (s) => i.lc(i.Ia, t, s), registerLayerDisposedHook: (s) => i.lc(i.Ga, t, s), registerLayerPreRenderHook: (s) => i.lc(i.ja, t, s), registerLayerPostRenderHook: (s) => i.lc(i.Qa, t, s), registerPreSetupHook: (s) => i.lc(i.Na, t, s), registerPostSetupHook: (s) => i.lc(i.Xa, t, s), extendLayer: (s, r) => {
|
|
3177
|
+
i.uc(t, s, r);
|
|
3178
3178
|
}, removeLayerExtension: (s) => {
|
|
3179
|
-
i.
|
|
3179
|
+
i.fc(t, s);
|
|
3180
3180
|
} };
|
|
3181
3181
|
}
|
|
3182
|
-
|
|
3182
|
+
lc(t, e, i) {
|
|
3183
3183
|
const s = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
3184
3184
|
return s.add(i), t.set(e, s), () => {
|
|
3185
3185
|
const r = t.get(e);
|
|
3186
3186
|
r && (r.delete(i), r.size === 0 && t.delete(e));
|
|
3187
3187
|
};
|
|
3188
3188
|
}
|
|
3189
|
-
|
|
3190
|
-
this.
|
|
3191
|
-
const e = this.
|
|
3189
|
+
Za(t) {
|
|
3190
|
+
this.Ba.delete(t), this.Ia.delete(t), this.Ga.delete(t), this.ja.delete(t), this.Qa.delete(t), this.Na.delete(t), this.Xa.delete(t);
|
|
3191
|
+
const e = this.Ya.get(t);
|
|
3192
3192
|
if (e) {
|
|
3193
|
-
for (const i of e.keys()) this.
|
|
3194
|
-
this.
|
|
3193
|
+
for (const i of e.keys()) this.dc(i);
|
|
3194
|
+
this.Ya.delete(t);
|
|
3195
3195
|
}
|
|
3196
3196
|
}
|
|
3197
|
-
|
|
3198
|
-
for (const i of this.
|
|
3197
|
+
tc(t, e) {
|
|
3198
|
+
for (const i of this.Ha) {
|
|
3199
3199
|
const s = t.get(i);
|
|
3200
3200
|
s && s.forEach(e);
|
|
3201
3201
|
}
|
|
3202
3202
|
}
|
|
3203
|
-
async
|
|
3204
|
-
for (const i of this.
|
|
3203
|
+
async oc(t, e) {
|
|
3204
|
+
for (const i of this.Ha) {
|
|
3205
3205
|
const s = t.get(i);
|
|
3206
3206
|
if (s) for (const r of s) await e(r);
|
|
3207
3207
|
}
|
|
3208
3208
|
}
|
|
3209
|
-
|
|
3210
|
-
let s = this.
|
|
3211
|
-
s || (s = /* @__PURE__ */ new Map(), this.
|
|
3212
|
-
for (const [r, h] of this.
|
|
3213
|
-
s.set(e, i), this.
|
|
3209
|
+
uc(t, e, i) {
|
|
3210
|
+
let s = this.Ya.get(t);
|
|
3211
|
+
s || (s = /* @__PURE__ */ new Map(), this.Ya.set(t, s));
|
|
3212
|
+
for (const [r, h] of this.Ya) r !== t && h.has(e) && console.warn(`[textmode.js] Plugin "${t}" is overwriting layer method "${e}" previously added by plugin "${r}".`);
|
|
3213
|
+
s.set(e, i), this.vc(e, i);
|
|
3214
3214
|
}
|
|
3215
|
-
|
|
3216
|
-
const i = this.
|
|
3215
|
+
fc(t, e) {
|
|
3216
|
+
const i = this.Ya.get(t);
|
|
3217
3217
|
if (!i) return;
|
|
3218
3218
|
i.delete(e);
|
|
3219
3219
|
let s = !1;
|
|
3220
|
-
for (const [r, h] of this.
|
|
3220
|
+
for (const [r, h] of this.Ya) if (r !== t && h.has(e)) {
|
|
3221
3221
|
s = !0;
|
|
3222
3222
|
const a = h.get(e);
|
|
3223
|
-
this.
|
|
3223
|
+
this.vc(e, a);
|
|
3224
3224
|
break;
|
|
3225
3225
|
}
|
|
3226
|
-
s || this.
|
|
3226
|
+
s || this.dc(e);
|
|
3227
3227
|
}
|
|
3228
|
-
|
|
3229
|
-
const i = Object.getPrototypeOf(this.
|
|
3228
|
+
vc(t, e) {
|
|
3229
|
+
const i = Object.getPrototypeOf(this.Oa.layers.base);
|
|
3230
3230
|
Object.defineProperty(i, t, { value: e, writable: !0, configurable: !0, enumerable: !1 });
|
|
3231
3231
|
}
|
|
3232
|
-
|
|
3233
|
-
const e = Object.getPrototypeOf(this.
|
|
3232
|
+
dc(t) {
|
|
3233
|
+
const e = Object.getPrototypeOf(this.Oa.layers.base), i = Object.getOwnPropertyDescriptor(e, t);
|
|
3234
3234
|
i && i.configurable && delete e[t];
|
|
3235
3235
|
}
|
|
3236
3236
|
}
|
|
3237
|
-
const ri = Object.freeze(Object.defineProperty({ __proto__: null, TextmodePluginManager:
|
|
3237
|
+
const ri = Object.freeze(Object.defineProperty({ __proto__: null, TextmodePluginManager: Vt }, Symbol.toStringTag, { value: "Module" })), W = `#version 300 es
|
|
3238
3238
|
layout(location=0)in vec2 A;layout(location=1)in vec2 B;out vec2 v_uv;void main(){v_uv=B;gl_Position=vec4(A,0.,1.);}`, jt = `#version 300 es
|
|
3239
3239
|
precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`;
|
|
3240
|
-
class
|
|
3240
|
+
class Wt {
|
|
3241
3241
|
constructor() {
|
|
3242
|
-
o(this, "
|
|
3243
|
-
o(this, "
|
|
3244
|
-
o(this, "
|
|
3245
|
-
o(this, "
|
|
3246
|
-
o(this, "
|
|
3242
|
+
o(this, "gc", /* @__PURE__ */ new Map());
|
|
3243
|
+
o(this, "mc", []);
|
|
3244
|
+
o(this, "_c", 0);
|
|
3245
|
+
o(this, "yc", 0);
|
|
3246
|
+
o(this, "wc");
|
|
3247
3247
|
}
|
|
3248
|
-
get
|
|
3249
|
-
return this.
|
|
3248
|
+
get bc() {
|
|
3249
|
+
return this._c;
|
|
3250
3250
|
}
|
|
3251
|
-
get
|
|
3252
|
-
if (this.
|
|
3251
|
+
get Cc() {
|
|
3252
|
+
if (this._c === 0) return 0;
|
|
3253
3253
|
let t = 0;
|
|
3254
|
-
for (const e of this.
|
|
3255
|
-
const i = this.
|
|
3256
|
-
i && (t +=
|
|
3254
|
+
for (const e of this.mc) {
|
|
3255
|
+
const i = this.gc.get(e);
|
|
3256
|
+
i && (t += X(i.progress, 0, 1) * i.weight);
|
|
3257
3257
|
}
|
|
3258
|
-
return Math.min(1, t / this.
|
|
3258
|
+
return Math.min(1, t / this._c);
|
|
3259
3259
|
}
|
|
3260
|
-
|
|
3261
|
-
this.
|
|
3260
|
+
xc(t) {
|
|
3261
|
+
this.wc = t;
|
|
3262
3262
|
}
|
|
3263
|
-
|
|
3264
|
-
const i = `phase-${this.
|
|
3265
|
-
return this.
|
|
3263
|
+
Mc(t, e = 1) {
|
|
3264
|
+
const i = `phase-${this.mc.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
|
|
3265
|
+
return this.gc.set(i, s), this.mc.push(i), this._c += s.weight, i;
|
|
3266
3266
|
}
|
|
3267
|
-
|
|
3268
|
-
const i = this.
|
|
3267
|
+
Fc(t, e) {
|
|
3268
|
+
const i = this.gc.get(t);
|
|
3269
3269
|
if (!i) return;
|
|
3270
|
-
i.progress =
|
|
3271
|
-
const s = this.
|
|
3272
|
-
Math.abs(s - this.
|
|
3270
|
+
i.progress = X(e, 0, 1), i.status = i.progress >= 1 ? "complete" : "running";
|
|
3271
|
+
const s = this.Cc;
|
|
3272
|
+
Math.abs(s - this.yc) > 1e-3 && (this.yc = s, this.wc && this.wc(s));
|
|
3273
3273
|
}
|
|
3274
|
-
|
|
3275
|
-
const e = this.
|
|
3276
|
-
e && (e.progress = 1, e.status = "complete", this.
|
|
3274
|
+
$c(t) {
|
|
3275
|
+
const e = this.gc.get(t);
|
|
3276
|
+
e && (e.progress = 1, e.status = "complete", this.Fc(t, 1));
|
|
3277
3277
|
}
|
|
3278
|
-
|
|
3279
|
-
const e = this.
|
|
3278
|
+
Pc(t) {
|
|
3279
|
+
const e = this.gc.get(t);
|
|
3280
3280
|
e && (e.status = "failed");
|
|
3281
3281
|
}
|
|
3282
|
-
|
|
3283
|
-
return this.
|
|
3284
|
-
const e = this.
|
|
3282
|
+
Tc() {
|
|
3283
|
+
return this.mc.map((t) => {
|
|
3284
|
+
const e = this.gc.get(t);
|
|
3285
3285
|
return e ? { id: e.id, label: e.label, weight: e.weight, progress: e.progress, status: e.status } : { id: t, label: t, weight: 1, progress: 0, status: "pending" };
|
|
3286
3286
|
});
|
|
3287
3287
|
}
|
|
3288
3288
|
}
|
|
3289
|
-
class
|
|
3289
|
+
class Kt {
|
|
3290
3290
|
constructor(t = "active") {
|
|
3291
|
-
o(this, "
|
|
3292
|
-
o(this, "
|
|
3293
|
-
o(this, "
|
|
3294
|
-
this.
|
|
3291
|
+
o(this, "Sc");
|
|
3292
|
+
o(this, "Ec", "");
|
|
3293
|
+
o(this, "kc", "");
|
|
3294
|
+
this.Sc = t;
|
|
3295
|
+
}
|
|
3296
|
+
get Rc() {
|
|
3297
|
+
return this.Sc;
|
|
3295
3298
|
}
|
|
3296
3299
|
get Lc() {
|
|
3297
|
-
return this.
|
|
3300
|
+
return this.Sc !== "disabled";
|
|
3301
|
+
}
|
|
3302
|
+
get Dc() {
|
|
3303
|
+
return this.Sc === "active" || this.Sc === "transitioning" || this.Sc === "error";
|
|
3298
3304
|
}
|
|
3299
3305
|
get Oc() {
|
|
3300
|
-
return this.
|
|
3306
|
+
return this.Ec;
|
|
3301
3307
|
}
|
|
3302
3308
|
get zc() {
|
|
3303
|
-
return this.kc
|
|
3309
|
+
return this.kc;
|
|
3304
3310
|
}
|
|
3305
|
-
|
|
3306
|
-
|
|
3311
|
+
Hc() {
|
|
3312
|
+
this.Sc !== "done" && this.Sc !== "transitioning" || (this.Sc = "active");
|
|
3307
3313
|
}
|
|
3308
|
-
|
|
3309
|
-
|
|
3314
|
+
Bc() {
|
|
3315
|
+
this.Sc !== "disabled" && (this.Sc = "done");
|
|
3310
3316
|
}
|
|
3311
3317
|
Ic() {
|
|
3312
|
-
this.
|
|
3318
|
+
this.Sc !== "disabled" && (this.Sc = "transitioning");
|
|
3313
3319
|
}
|
|
3314
3320
|
Gc() {
|
|
3315
|
-
this.
|
|
3321
|
+
this.Sc === "transitioning" && (this.Sc = "done");
|
|
3316
3322
|
}
|
|
3317
|
-
jc() {
|
|
3318
|
-
this.
|
|
3323
|
+
jc(t) {
|
|
3324
|
+
this.Sc !== "disabled" && (this.Sc = "error", t instanceof Error ? (this.Ec = t.message, this.kc = t.stack || "") : (this.Ec = t, this.kc = ""));
|
|
3319
3325
|
}
|
|
3320
3326
|
Qc() {
|
|
3321
|
-
this.
|
|
3322
|
-
}
|
|
3323
|
-
Nc(t) {
|
|
3324
|
-
this.kc !== "disabled" && (this.kc = "error", t instanceof Error ? (this.Rc = t.message, this.Dc = t.stack || "") : (this.Rc = t, this.Dc = ""));
|
|
3325
|
-
}
|
|
3326
|
-
Xc() {
|
|
3327
|
-
this.kc = "disabled";
|
|
3327
|
+
this.Sc = "disabled";
|
|
3328
3328
|
}
|
|
3329
3329
|
}
|
|
3330
3330
|
class Qt {
|
|
3331
3331
|
constructor(t, e) {
|
|
3332
|
-
o(this, "
|
|
3333
|
-
o(this, "
|
|
3334
|
-
o(this, "
|
|
3335
|
-
o(this, "
|
|
3336
|
-
this.
|
|
3332
|
+
o(this, "Nc", 0);
|
|
3333
|
+
o(this, "Xc", 1);
|
|
3334
|
+
o(this, "Yc");
|
|
3335
|
+
o(this, "Kc");
|
|
3336
|
+
this.Yc = t, this.Kc = e;
|
|
3337
3337
|
}
|
|
3338
|
-
get
|
|
3339
|
-
return this.
|
|
3338
|
+
get Wc() {
|
|
3339
|
+
return this.Xc;
|
|
3340
3340
|
}
|
|
3341
|
-
get
|
|
3342
|
-
return this.
|
|
3341
|
+
get Zc() {
|
|
3342
|
+
return this.Xc < 1;
|
|
3343
3343
|
}
|
|
3344
|
-
|
|
3345
|
-
this.
|
|
3344
|
+
ih() {
|
|
3345
|
+
this.Yc !== "none" && this.Kc > 0 && (this.Nc = performance.now());
|
|
3346
3346
|
}
|
|
3347
3347
|
N() {
|
|
3348
|
-
if (this.
|
|
3349
|
-
const t = performance.now() - this.
|
|
3350
|
-
return e >= 1 ? (this.
|
|
3348
|
+
if (this.Yc === "none" || this.Kc === 0) return this.Xc = 1, !1;
|
|
3349
|
+
const t = performance.now() - this.Nc, e = Math.min(1, t / this.Kc);
|
|
3350
|
+
return e >= 1 ? (this.Xc = 0, !0) : (this.Xc = 1 - e, !1);
|
|
3351
3351
|
}
|
|
3352
3352
|
Qs() {
|
|
3353
|
-
this.
|
|
3353
|
+
this.Xc = 1, this.Nc = 0;
|
|
3354
3354
|
}
|
|
3355
3355
|
}
|
|
3356
3356
|
function At(n, t) {
|
|
@@ -3362,24 +3362,24 @@ function At(n, t) {
|
|
|
3362
3362
|
return 0.2126 * l(r) + 0.7152 * l(h) + 0.0722 * l(a);
|
|
3363
3363
|
}(t) > 0.5 ? "light" : "dark"), { mode: i, background: t, textColor: i === "light" ? "#1A1A1A" : "#F8F8F8", subtleColor: i === "light" ? "#4A4A4A" : "#C0C0C0" };
|
|
3364
3364
|
}
|
|
3365
|
-
function
|
|
3365
|
+
function Zt(n) {
|
|
3366
3366
|
return n.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
|
|
3367
3367
|
}
|
|
3368
3368
|
function qt(n, t) {
|
|
3369
3369
|
return n.length ? n.map((e) => x.yn(e)) : [t.color("#FFFFFF")];
|
|
3370
3370
|
}
|
|
3371
|
-
class
|
|
3371
|
+
class $t {
|
|
3372
3372
|
constructor(t, e, i, s) {
|
|
3373
|
-
this.
|
|
3373
|
+
this.qc = t, this.id = e, this.label = i, this.Vc = s;
|
|
3374
3374
|
}
|
|
3375
3375
|
report(t) {
|
|
3376
|
-
this.
|
|
3376
|
+
this.qc.Fc(this.id, t);
|
|
3377
3377
|
}
|
|
3378
3378
|
complete() {
|
|
3379
|
-
this.
|
|
3379
|
+
this.qc.$c(this.id);
|
|
3380
3380
|
}
|
|
3381
3381
|
fail(t) {
|
|
3382
|
-
this.
|
|
3382
|
+
this.qc.Pc(this.id), this.Vc && this.Vc(t ?? Error(`Loading phase "${this.label}" failed`));
|
|
3383
3383
|
}
|
|
3384
3384
|
async track(t) {
|
|
3385
3385
|
try {
|
|
@@ -3390,7 +3390,7 @@ class Kt {
|
|
|
3390
3390
|
}
|
|
3391
3391
|
}
|
|
3392
3392
|
}
|
|
3393
|
-
const
|
|
3393
|
+
const $e = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: a, transitionOpacity: l, isError: u, errorMessage: c }) => {
|
|
3394
3394
|
const f = "|/-\\", g = Math.floor(i / 6) % 4, p = x.yn(h.textColor), v = Math.floor(255 * l), d = n.color(p.r, p.g, p.b, v);
|
|
3395
3395
|
if (n.charColor(d), n.cellColor(0, 0, 0, 0), u) {
|
|
3396
3396
|
const m = x.yn(h.mode === "light" ? "#D32F2F" : "#FF6B6B").withAlpha(v);
|
|
@@ -3401,14 +3401,14 @@ const Ke = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
|
|
|
3401
3401
|
if (n.pop(), c) {
|
|
3402
3402
|
const y = x.yn(h.subtleColor), R = n.color(y.r, y.g, y.b, v);
|
|
3403
3403
|
n.charColor(R);
|
|
3404
|
-
const b = Math.floor(0.8 * t.cols), M = c.split(" "),
|
|
3404
|
+
const b = Math.floor(0.8 * t.cols), M = c.split(" "), S = [];
|
|
3405
3405
|
let T = "";
|
|
3406
|
-
for (const C of M) (T + " " + C).length <= b ? T = T ? T + " " + C : C : (T &&
|
|
3407
|
-
T &&
|
|
3408
|
-
const U =
|
|
3409
|
-
|
|
3406
|
+
for (const C of M) (T + " " + C).length <= b ? T = T ? T + " " + C : C : (T && S.push(T), T = C);
|
|
3407
|
+
T && S.push(T);
|
|
3408
|
+
const U = S.slice(0, 3);
|
|
3409
|
+
S.length > 3 && (U[2] = U[2].substring(0, b - 3) + "..."), U.forEach((C, Z) => {
|
|
3410
3410
|
const re = -Math.floor(C.length / 2);
|
|
3411
|
-
n.push(), n.translate(re, 3 +
|
|
3411
|
+
n.push(), n.translate(re, 3 + Z, 0);
|
|
3412
3412
|
for (const ne of C) n.char(ne), n.rect(1, 1), n.translateX(1);
|
|
3413
3413
|
n.pop();
|
|
3414
3414
|
});
|
|
@@ -3419,8 +3419,8 @@ const Ke = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
|
|
|
3419
3419
|
const m = Math.max(6, Math.floor(0.6 * t.cols)), A = -Math.floor(m / 2), w = Math.floor(m * e), y = r.length ? r : [n.color("#FFFFFF")];
|
|
3420
3420
|
n.push(), n.translate(A, 3, 0);
|
|
3421
3421
|
for (let R = 0; R < m; R++) {
|
|
3422
|
-
const b = R < w ? "*" : ".", M = y[R % y.length],
|
|
3423
|
-
n.charColor(
|
|
3422
|
+
const b = R < w ? "*" : ".", M = y[R % y.length], S = n.color(M.r, M.g, M.b, v);
|
|
3423
|
+
n.charColor(S), n.char(b), n.rect(1, 1), n.translateX(1);
|
|
3424
3424
|
}
|
|
3425
3425
|
n.pop();
|
|
3426
3426
|
}
|
|
@@ -3435,232 +3435,232 @@ const Ke = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
|
|
|
3435
3435
|
};
|
|
3436
3436
|
class ot {
|
|
3437
3437
|
constructor(t, e = {}) {
|
|
3438
|
+
o(this, "Jc");
|
|
3439
|
+
o(this, "Wc");
|
|
3440
|
+
o(this, "tl");
|
|
3438
3441
|
o(this, "sl");
|
|
3439
|
-
o(this, "qc");
|
|
3440
3442
|
o(this, "el");
|
|
3441
3443
|
o(this, "il");
|
|
3442
3444
|
o(this, "rl");
|
|
3443
3445
|
o(this, "nl");
|
|
3444
3446
|
o(this, "hl");
|
|
3445
3447
|
o(this, "ol");
|
|
3448
|
+
o(this, "yr");
|
|
3446
3449
|
o(this, "al");
|
|
3447
3450
|
o(this, "cl");
|
|
3448
|
-
o(this, "yr");
|
|
3449
3451
|
o(this, "ll");
|
|
3450
3452
|
o(this, "ul");
|
|
3451
|
-
o(this, "fl")
|
|
3452
|
-
o(this, "dl");
|
|
3453
|
-
o(this, "pl", () => {
|
|
3453
|
+
o(this, "fl", () => {
|
|
3454
3454
|
});
|
|
3455
|
-
o(this, "
|
|
3456
|
-
o(this, "
|
|
3457
|
-
this.
|
|
3455
|
+
o(this, "dl", []);
|
|
3456
|
+
o(this, "pl", /* @__PURE__ */ new Map());
|
|
3457
|
+
this.Jc = e.visible ?? !0, this.Wc = e.opacity ?? 1, this.tl = e.blendMode ?? "normal", this.sl = e.offsetX ?? 0, this.el = e.offsetY ?? 0, this.il = e.rotationZ ?? 0, this.rl = e.fontSize ?? 16, this.nl = e.fontSource, e.fontSource instanceof z ? this.yr = e.fontSource : this.yr = new z(t, this.rl);
|
|
3458
3458
|
}
|
|
3459
|
-
async
|
|
3460
|
-
this.
|
|
3459
|
+
async vl(t) {
|
|
3460
|
+
this.hl = t, this.yr.Gr || await this.yr.Er(this.nl);
|
|
3461
3461
|
const e = this.yr.maxGlyphDimensions;
|
|
3462
|
-
this.
|
|
3463
|
-
const i = this.
|
|
3464
|
-
this.
|
|
3462
|
+
this.ol = new ze(this.hl.canvas.canvas, e.width, e.height);
|
|
3463
|
+
const i = this.ol;
|
|
3464
|
+
this.al = this.hl.createFramebuffer(i.cols, i.rows, 3), this.cl = this.hl.createFramebuffer(i.width, i.height, 1), this.ll = this.hl.createFramebuffer(i.width, i.height, 1), this.ul = [this.hl.createFramebuffer(i.width, i.height, 1, { depth: !1 }), this.hl.createFramebuffer(i.width, i.height, 1, { depth: !1 })], this.ol.Vr(() => {
|
|
3465
3465
|
var s, r, h;
|
|
3466
|
-
this.
|
|
3466
|
+
this.al.resize(this.ol.cols, this.ol.rows), this.cl.resize(this.ol.width, this.ol.height), (s = this.ll) == null || s.resize(this.ol.width, this.ol.height), (r = this.ul) == null || r[0].resize(this.ol.width, this.ol.height), (h = this.ul) == null || h[1].resize(this.ol.width, this.ol.height);
|
|
3467
3467
|
});
|
|
3468
3468
|
}
|
|
3469
3469
|
draw(t) {
|
|
3470
|
-
this.
|
|
3470
|
+
this.fl = t;
|
|
3471
3471
|
}
|
|
3472
3472
|
show() {
|
|
3473
|
-
this.
|
|
3473
|
+
this.Jc = !0;
|
|
3474
3474
|
}
|
|
3475
3475
|
hide() {
|
|
3476
|
-
this.
|
|
3476
|
+
this.Jc = !1;
|
|
3477
3477
|
}
|
|
3478
3478
|
opacity(t) {
|
|
3479
|
-
if (t === void 0) return this.
|
|
3480
|
-
this.
|
|
3479
|
+
if (t === void 0) return this.Wc;
|
|
3480
|
+
this.Wc = X(t, 0, 1);
|
|
3481
3481
|
}
|
|
3482
3482
|
blendMode(t) {
|
|
3483
|
-
if (t === void 0) return this.
|
|
3484
|
-
this.
|
|
3483
|
+
if (t === void 0) return this.tl;
|
|
3484
|
+
this.tl = t;
|
|
3485
3485
|
}
|
|
3486
3486
|
offset(t, e = 0) {
|
|
3487
|
-
if (t === void 0) return { x: this.
|
|
3488
|
-
this.
|
|
3487
|
+
if (t === void 0) return { x: this.sl, y: this.el };
|
|
3488
|
+
this.sl = t, this.el = e;
|
|
3489
3489
|
}
|
|
3490
3490
|
rotateZ(t) {
|
|
3491
|
-
if (t === void 0) return this.
|
|
3492
|
-
this.
|
|
3491
|
+
if (t === void 0) return this.il;
|
|
3492
|
+
this.il = t;
|
|
3493
3493
|
}
|
|
3494
3494
|
filter(t, e) {
|
|
3495
|
-
this.
|
|
3495
|
+
this.dl.push({ name: t, params: e });
|
|
3496
3496
|
}
|
|
3497
3497
|
setPluginState(t, e) {
|
|
3498
|
-
this.
|
|
3498
|
+
this.pl.set(t, e);
|
|
3499
3499
|
}
|
|
3500
3500
|
getPluginState(t) {
|
|
3501
|
-
return this.
|
|
3501
|
+
return this.pl.get(t);
|
|
3502
3502
|
}
|
|
3503
3503
|
hasPluginState(t) {
|
|
3504
|
-
return this.
|
|
3504
|
+
return this.pl.has(t);
|
|
3505
3505
|
}
|
|
3506
3506
|
deletePluginState(t) {
|
|
3507
|
-
return this.
|
|
3507
|
+
return this.pl.delete(t);
|
|
3508
3508
|
}
|
|
3509
3509
|
fontSize(t) {
|
|
3510
3510
|
if (t === void 0) return this.yr.fontSize;
|
|
3511
|
-
yt.m(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) && this.yr.fontSize !== t && (this.yr.
|
|
3511
|
+
yt.m(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) && this.yr.fontSize !== t && (this.yr.Lr(t), this.ml());
|
|
3512
3512
|
}
|
|
3513
3513
|
async loadFont(t) {
|
|
3514
3514
|
if (!this.yr) throw Error("Layer font not initialized. Ensure layer is attached before loading fonts.");
|
|
3515
|
-
return t instanceof z ? (this.yr !== t && this.yr.dispose(), this.yr = t, this.yr.Gr || await this.yr.Er()) : await this.yr.Or(t), this.
|
|
3515
|
+
return t instanceof z ? (this.yr !== t && this.yr.dispose(), this.yr = t, this.yr.Gr || await this.yr.Er()) : await this.yr.Or(t), this.ml(), this.yr;
|
|
3516
3516
|
}
|
|
3517
|
-
|
|
3518
|
-
if (!this.
|
|
3519
|
-
const i = this.
|
|
3520
|
-
t.
|
|
3517
|
+
Ra(t, e) {
|
|
3518
|
+
if (!this.Jc || !this.al || !this.cl) return;
|
|
3519
|
+
const i = this.hl.renderer, s = this.ol;
|
|
3520
|
+
t._l.rc(this), this.al.begin(), i.state.Vt(), t.yl = this;
|
|
3521
3521
|
try {
|
|
3522
|
-
this.
|
|
3522
|
+
this.fl.call(t);
|
|
3523
3523
|
} finally {
|
|
3524
|
-
t.
|
|
3524
|
+
t.yl = void 0;
|
|
3525
3525
|
}
|
|
3526
|
-
this.
|
|
3527
|
-
const r = this.
|
|
3528
|
-
h.begin(), i.xi(e), e.gt({ u_characterTexture: this.yr.fontFramebuffer, u_charsetDimensions: [this.yr.textureColumns, this.yr.textureRows], U2: this.
|
|
3526
|
+
this.al.end(), t._l.nc(this);
|
|
3527
|
+
const r = this.dl.length > 0, h = r ? this.ll : this.cl;
|
|
3528
|
+
h.begin(), i.xi(e), e.gt({ u_characterTexture: this.yr.fontFramebuffer, u_charsetDimensions: [this.yr.textureColumns, this.yr.textureRows], U2: this.al.textures[0], U0: this.al.textures[1], U1: this.al.textures[2], U3: [s.cols, s.rows], U4: [h.width, h.height], U5: [0, 0, 0, 0] }), i.Ei(0, 0, s.width, s.height), h.end(), r && this.hl.filterManager.Al(this.ll.textures[0], this.cl, this.dl, this.cl.width, this.cl.height, this.ul), this.dl = [];
|
|
3529
3529
|
}
|
|
3530
3530
|
vn() {
|
|
3531
3531
|
var t;
|
|
3532
|
-
this.
|
|
3532
|
+
this.al && this.cl && ((t = this.ol) == null || t.reset());
|
|
3533
3533
|
}
|
|
3534
3534
|
Ss() {
|
|
3535
3535
|
var t, e, i, s, r, h, a;
|
|
3536
|
-
(t = this.
|
|
3536
|
+
(t = this.al) == null || t.dispose(), (e = this.cl) == null || e.dispose(), (i = this.ll) == null || i.dispose(), (s = this.ul) == null || s[0].dispose(), (r = this.ul) == null || r[1].dispose(), (h = this.yr) == null || h.dispose(), (a = this.ol) == null || a.Ss();
|
|
3537
3537
|
}
|
|
3538
3538
|
get texture() {
|
|
3539
3539
|
var t;
|
|
3540
|
-
return (t = this.
|
|
3540
|
+
return (t = this.cl) == null ? void 0 : t.textures[0];
|
|
3541
3541
|
}
|
|
3542
3542
|
get grid() {
|
|
3543
|
-
return this.
|
|
3543
|
+
return this.ol;
|
|
3544
3544
|
}
|
|
3545
3545
|
get font() {
|
|
3546
3546
|
return this.yr;
|
|
3547
3547
|
}
|
|
3548
3548
|
get width() {
|
|
3549
|
-
return this.
|
|
3549
|
+
return this.cl ? this.cl.width : 0;
|
|
3550
3550
|
}
|
|
3551
3551
|
get height() {
|
|
3552
|
-
return this.
|
|
3552
|
+
return this.cl ? this.cl.height : 0;
|
|
3553
3553
|
}
|
|
3554
3554
|
get drawFramebuffer() {
|
|
3555
|
-
return this.
|
|
3555
|
+
return this.al;
|
|
3556
3556
|
}
|
|
3557
3557
|
get asciiFramebuffer() {
|
|
3558
|
-
return this.
|
|
3558
|
+
return this.cl;
|
|
3559
3559
|
}
|
|
3560
|
-
|
|
3561
|
-
if (!this.
|
|
3560
|
+
ml() {
|
|
3561
|
+
if (!this.ol || !this.yr) return;
|
|
3562
3562
|
const t = this.yr.maxGlyphDimensions;
|
|
3563
|
-
this.
|
|
3563
|
+
this.ol.tn(t.width, t.height), this.al && this.cl && this.vn();
|
|
3564
3564
|
}
|
|
3565
3565
|
}
|
|
3566
3566
|
const Je = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
|
|
3567
3567
|
class Jt {
|
|
3568
3568
|
constructor(t, e, i) {
|
|
3569
|
-
o(this, "
|
|
3569
|
+
o(this, "Oa");
|
|
3570
3570
|
o(this, "l");
|
|
3571
|
+
o(this, "wl");
|
|
3572
|
+
o(this, "qc");
|
|
3573
|
+
o(this, "bl");
|
|
3571
3574
|
o(this, "Cl");
|
|
3572
|
-
o(this, "Jc");
|
|
3573
3575
|
o(this, "xl");
|
|
3574
3576
|
o(this, "Ml");
|
|
3575
|
-
o(this, "Fl");
|
|
3577
|
+
o(this, "Fl", []);
|
|
3576
3578
|
o(this, "$l");
|
|
3577
|
-
o(this, "Pl",
|
|
3578
|
-
o(this, "Tl");
|
|
3579
|
-
o(this, "Sl",
|
|
3580
|
-
o(this, "El", 0);
|
|
3581
|
-
o(this, "kl", !1);
|
|
3579
|
+
o(this, "Pl", performance.now());
|
|
3580
|
+
o(this, "Tl", 0);
|
|
3581
|
+
o(this, "Sl", !1);
|
|
3582
3582
|
o(this, "Sr", !1);
|
|
3583
|
-
o(this, "
|
|
3584
|
-
this.
|
|
3585
|
-
const s =
|
|
3586
|
-
this.
|
|
3587
|
-
r >= 0.999 && this.
|
|
3583
|
+
o(this, "Ll");
|
|
3584
|
+
this.Oa = t, this.l = { ...Je, ...e ?? {} }, this.wl = new Kt("active"), this.qc = new Wt(), this.bl = new Qt(this.l.transition, this.l.transitionDuration), this.Cl = new Nt(60), this.$l = At(this.l, i);
|
|
3585
|
+
const s = Zt(this.$l);
|
|
3586
|
+
this.Fl = qt(s, this.Oa), this.Ml = this.El(), this.qc.xc((r) => {
|
|
3587
|
+
r >= 0.999 && this.Bc();
|
|
3588
3588
|
});
|
|
3589
3589
|
}
|
|
3590
3590
|
async Er() {
|
|
3591
3591
|
if (this.Sr) return;
|
|
3592
|
-
const t = this.
|
|
3593
|
-
this.
|
|
3592
|
+
const t = this.Oa.R, e = this.Oa.Xr;
|
|
3593
|
+
this.xl = new ot(t, { visible: !0, opacity: 1, fontSize: 16 }), await this.xl.vl({ renderer: t, canvas: e, filterManager: null, createFramebuffer: (i, s, r = 1, h) => t.Hi(i, s, r, h) }), this.Sr = !0;
|
|
3594
3594
|
}
|
|
3595
|
-
get
|
|
3596
|
-
return this.
|
|
3595
|
+
get Dc() {
|
|
3596
|
+
return this.wl.Dc && this.Sl;
|
|
3597
3597
|
}
|
|
3598
|
-
|
|
3599
|
-
this.
|
|
3598
|
+
ih() {
|
|
3599
|
+
this.Sl || (this.Sl = !0, this.Pl = performance.now(), this.Tl = 0, this.Cl.ih(() => this.kl()));
|
|
3600
3600
|
}
|
|
3601
|
-
|
|
3602
|
-
this.
|
|
3601
|
+
rh() {
|
|
3602
|
+
this.Sl && (this.Sl = !1, this.Cl.rh());
|
|
3603
3603
|
}
|
|
3604
3604
|
vn() {
|
|
3605
|
-
this.Sr && this.
|
|
3605
|
+
this.Sr && this.xl.vn();
|
|
3606
3606
|
}
|
|
3607
3607
|
Ss() {
|
|
3608
|
-
this.
|
|
3608
|
+
this.rh(), this.Sr && (this.xl.Ss(), this.Sr = !1);
|
|
3609
3609
|
}
|
|
3610
3610
|
get progress() {
|
|
3611
|
-
return this.
|
|
3611
|
+
return this.qc.Cc;
|
|
3612
3612
|
}
|
|
3613
3613
|
message(t) {
|
|
3614
3614
|
return typeof t == "string" && (this.l.message = t), this.l.message;
|
|
3615
3615
|
}
|
|
3616
3616
|
addPhase(t, e = 1) {
|
|
3617
|
-
this.
|
|
3618
|
-
const i = this.
|
|
3619
|
-
return new
|
|
3617
|
+
this.wl.Hc();
|
|
3618
|
+
const i = this.qc.Mc(t, e);
|
|
3619
|
+
return new $t(this.qc, i, t, (s) => this.error(s));
|
|
3620
3620
|
}
|
|
3621
|
-
|
|
3622
|
-
this.
|
|
3621
|
+
Bc() {
|
|
3622
|
+
this.wl.Rc !== "error" && (this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.wl.Ic(), this.bl.ih()) : (this.wl.Bc(), this.rh(), this.Rl()));
|
|
3623
3623
|
}
|
|
3624
|
-
|
|
3625
|
-
this.
|
|
3624
|
+
Rl() {
|
|
3625
|
+
this.Ll && this.Ll();
|
|
3626
3626
|
}
|
|
3627
|
-
|
|
3628
|
-
this.
|
|
3627
|
+
Dl(t) {
|
|
3628
|
+
this.Ll = t;
|
|
3629
3629
|
}
|
|
3630
3630
|
error(t) {
|
|
3631
|
-
this.
|
|
3631
|
+
this.wl.jc(t);
|
|
3632
3632
|
}
|
|
3633
|
-
|
|
3634
|
-
if (this.
|
|
3635
|
-
if (this.
|
|
3636
|
-
return this.
|
|
3637
|
-
this.
|
|
3633
|
+
kl() {
|
|
3634
|
+
if (this.wl.Dc) {
|
|
3635
|
+
if (this.Tl++, this.wl.Rc === "transitioning" && this.bl.N())
|
|
3636
|
+
return this.wl.Gc(), this.Rl(), void this.rh();
|
|
3637
|
+
this.Ol();
|
|
3638
3638
|
}
|
|
3639
3639
|
}
|
|
3640
|
-
|
|
3640
|
+
Ol() {
|
|
3641
3641
|
if (!this.Sr) return;
|
|
3642
|
-
const t = this.
|
|
3642
|
+
const t = this.xl, e = t.grid, i = this.Oa.R, s = { textmodifier: this.Oa, grid: e, progress: this.progress, elapsedMs: performance.now() - this.Pl, frameCount: this.Tl, message: this.l.message, palette: this.Fl, theme: this.$l, phases: this.qc.Tc(), transitionOpacity: this.bl.Wc, isError: this.wl.Rc === "error", errorMessage: this.wl.Oc || void 0, errorDetails: this.wl.zc || void 0 };
|
|
3643
3643
|
t.draw(() => {
|
|
3644
|
-
this.
|
|
3644
|
+
this.Oa.resetShader(), this.Oa.clear(), this.Oa.push();
|
|
3645
3645
|
try {
|
|
3646
|
-
this
|
|
3646
|
+
this.Ml(s);
|
|
3647
3647
|
} finally {
|
|
3648
|
-
this.
|
|
3648
|
+
this.Oa.pop();
|
|
3649
3649
|
}
|
|
3650
|
-
}), t.
|
|
3650
|
+
}), t.Ra(this.Oa, this.Oa.zl);
|
|
3651
3651
|
const r = t.texture;
|
|
3652
|
-
r && (i.xe(...i.state.canvasBackgroundColor), i.xi(this.
|
|
3652
|
+
r && (i.xe(...i.state.canvasBackgroundColor), i.xi(this.Oa.Hl), this.Oa.Hl.gt({ u_texture: r }), i.Ei(e.offsetX, e.offsetY, e.width, e.height));
|
|
3653
3653
|
}
|
|
3654
|
-
|
|
3655
|
-
this
|
|
3654
|
+
Bl(t) {
|
|
3655
|
+
this.$l = At(this.l, t);
|
|
3656
3656
|
}
|
|
3657
|
-
|
|
3658
|
-
const t = this.l.renderer ||
|
|
3657
|
+
El() {
|
|
3658
|
+
const t = this.l.renderer || $e;
|
|
3659
3659
|
return (e) => {
|
|
3660
|
-
t(e), this.
|
|
3660
|
+
t(e), this.Il(e);
|
|
3661
3661
|
};
|
|
3662
3662
|
}
|
|
3663
|
-
|
|
3663
|
+
Il(t) {
|
|
3664
3664
|
const { textmodifier: e, grid: i, frameCount: s, theme: r, transitionOpacity: h } = t, a = [116, 101, 120, 116, 109, 111, 100, 101, 46, 106, 115].map((f) => String.fromCharCode(f)).join(""), l = (i.rows + 1 >> 1) - 2, u = 2 - (i.cols + 1 >> 1), c = r.mode === "light" ? [[233, 30, 99], [156, 39, 176], [255, 111, 0]] : [[142, 249, 243], [241, 91, 181], [255, 155, 113]];
|
|
3665
3665
|
e.push(), e.translate(u, l, 0);
|
|
3666
3666
|
for (let f = 0; f < a.length; f++) {
|
|
@@ -3674,140 +3674,140 @@ const Ct = { normal: 0, additive: 1, multiply: 2, screen: 3, subtract: 4, darken
|
|
|
3674
3674
|
class te {
|
|
3675
3675
|
constructor(t, e, i) {
|
|
3676
3676
|
o(this, "R");
|
|
3677
|
-
o(this, "
|
|
3678
|
-
o(this, "
|
|
3679
|
-
o(this, "
|
|
3680
|
-
this.R = t, this.
|
|
3681
|
-
precision highp float;uniform sampler2D
|
|
3677
|
+
o(this, "Gl");
|
|
3678
|
+
o(this, "ul");
|
|
3679
|
+
o(this, "jl", 0);
|
|
3680
|
+
this.R = t, this.Gl = t.Mi(W, `#version 300 es
|
|
3681
|
+
precision highp float;uniform sampler2D U6;uniform sampler2D U7;uniform vec2 U8;uniform vec2 U9;uniform vec2 Ua;uniform float Ub;uniform float Uc;uniform int Ud;in vec2 v_uv;out vec4 fragColor;const int A=0;const int B=1;const int C=2;const int D=3;const int E=4;const int F=5;const int G=6;const int H=7;const int I=8;const int J=9;const int K=10;const int L=11;const int M=12;const int N=13;vec3 O(vec3 P,vec3 Q){return Q;}vec3 R(vec3 P,vec3 Q){return P+Q;}vec3 S(vec3 P,vec3 Q){return P*Q;}vec3 T(vec3 P,vec3 Q){return 1.-(1.-P)*(1.-Q);}vec3 U(vec3 P,vec3 Q){return max(P-Q,0.);}vec3 V(vec3 P,vec3 Q){return min(P,Q);}vec3 W(vec3 P,vec3 Q){return max(P,Q);}vec3 X(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,P));}vec3 Y(vec3 P,vec3 Q){return mix(P-(1.-2.*Q)*P*(1.-P),mix(P+(2.*Q-1.)*(P*(3.-2.*P)-P),P+(2.*Q-1.)*(sqrt(P)-P),step(0.25,P)),step(0.5,Q));}vec3 Z(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,Q));}vec3 a(vec3 P,vec3 Q){return mix(min(vec3(1.),P/max(1.-Q,0.0001)),vec3(1.),step(1.,Q));}vec3 b(vec3 P,vec3 Q){return mix(1.-min(vec3(1.),(1.-P)/max(Q,0.0001)),vec3(0.),step(Q,vec3(0.)));}vec3 c(vec3 P,vec3 Q){return abs(P-Q);}vec3 d(vec3 P,vec3 Q){return P+Q-2.*P*Q;}vec3 e(int f,vec3 P,vec3 Q){if(f==A)return O(P,Q);if(f==B)return R(P,Q);if(f==C)return S(P,Q);if(f==D)return T(P,Q);if(f==E)return U(P,Q);if(f==F)return V(P,Q);if(f==G)return W(P,Q);if(f==H)return X(P,Q);if(f==I)return Y(P,Q);if(f==J)return Z(P,Q);if(f==K)return a(P,Q);if(f==L)return b(P,Q);if(f==M)return c(P,Q);if(f==N)return d(P,Q);return O(P,Q);}void main(){vec4 g=texture(U7,v_uv);vec2 h=v_uv*U8;vec2 i=h-Ua;vec2 j=U9*0.5;vec2 k=i-j;float l=cos(-Uc);float m=sin(-Uc);vec2 n=vec2(k.x*l-k.y*m,k.x*m+k.y*l);i=n+j;bool o=any(lessThan(i,vec2(0.)))||any(greaterThanEqual(i,U9));if(o){fragColor=g;return;}vec2 p=(floor(i)+0.5)/U9;vec4 q=texture(U6,p);float r=q.a*Ub;if(r<=0.){fragColor=g;return;}vec3 s=e(Ud,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`), this.ul = [this.R.Hi(e, i, 1), this.R.Hi(e, i, 1)];
|
|
3682
3682
|
}
|
|
3683
|
-
|
|
3683
|
+
Ql(t) {
|
|
3684
3684
|
const e = this.R.context, { base: i, targetFramebuffer: s, backgroundColor: r, layers: h, canvasWidth: a, canvasHeight: l } = t, u = e.isEnabled(e.DEPTH_TEST), c = e.getParameter(e.DEPTH_WRITEMASK);
|
|
3685
3685
|
u && e.disable(e.DEPTH_TEST), c && e.depthMask(!1);
|
|
3686
|
-
const f = this.
|
|
3687
|
-
f.begin(), this.R.xe(...r), f.end(), this.
|
|
3686
|
+
const f = this.ul[0];
|
|
3687
|
+
f.begin(), this.R.xe(...r), f.end(), this.jl = 0, i.layer.Jc && this.Nl(i.texture, a, l, i.width, i.height, i.layer.Wc, i.offsetX, i.offsetY, i.layer.il, "normal");
|
|
3688
3688
|
for (const g of h) {
|
|
3689
3689
|
const p = g.layer;
|
|
3690
|
-
p.
|
|
3690
|
+
p.Jc && this.Nl(g.texture, a, l, g.width, g.height, p.Wc, g.offsetX, g.offsetY, p.il, p.tl);
|
|
3691
3691
|
}
|
|
3692
|
-
this.
|
|
3692
|
+
this.Xl(s, a, l), e.depthMask(c), u && e.enable(e.DEPTH_TEST);
|
|
3693
3693
|
}
|
|
3694
|
-
|
|
3695
|
-
const f = this.
|
|
3696
|
-
p.begin(), this.R.xi(this.
|
|
3694
|
+
Nl(t, e, i, s, r, h, a, l, u, c) {
|
|
3695
|
+
const f = this.ul[this.jl], g = this.jl === 0 ? 1 : 0, p = this.ul[g], v = N(u);
|
|
3696
|
+
p.begin(), this.R.xi(this.Gl), this.Gl.gt({ U6: t, U7: f.textures[0], U8: [e, i], U9: [s, r], Ua: [a, l], Ub: h, Uc: v, Ud: Ct[c] }), this.R.Ei(0, 0, f.width, f.height), p.end(), this.jl = g;
|
|
3697
3697
|
}
|
|
3698
|
-
|
|
3699
|
-
const s = this.
|
|
3700
|
-
t.begin(), this.R.xi(this.
|
|
3698
|
+
Xl(t, e, i) {
|
|
3699
|
+
const s = this.ul[this.jl];
|
|
3700
|
+
t.begin(), this.R.xi(this.Gl), this.Gl.gt({ U6: s.textures[0], U7: s.textures[0], U8: [e, i], U9: [s.width, s.height], Ua: [0, 0], Ub: 1, Uc: 0, Ud: Ct.normal }), this.R.Ei(0, 0, e, i), t.end();
|
|
3701
3701
|
}
|
|
3702
3702
|
vn(t, e) {
|
|
3703
|
-
this.
|
|
3703
|
+
this.ul[0].resize(t, e), this.ul[1].resize(t, e);
|
|
3704
3704
|
}
|
|
3705
3705
|
Ss() {
|
|
3706
|
-
this.
|
|
3706
|
+
this.Gl.dispose(), this.ul[0].dispose(), this.ul[1].dispose();
|
|
3707
3707
|
}
|
|
3708
3708
|
}
|
|
3709
3709
|
class ti {
|
|
3710
3710
|
constructor(t = {}) {
|
|
3711
|
-
o(this, "
|
|
3712
|
-
o(this, "
|
|
3713
|
-
o(this, "
|
|
3711
|
+
o(this, "Yl", []);
|
|
3712
|
+
o(this, "Kl", []);
|
|
3713
|
+
o(this, "Wl", !1);
|
|
3714
3714
|
o(this, "l");
|
|
3715
3715
|
this.l = t;
|
|
3716
3716
|
}
|
|
3717
3717
|
async initialize(t) {
|
|
3718
3718
|
var e, i;
|
|
3719
|
-
for (const s of this.
|
|
3720
|
-
this.
|
|
3719
|
+
for (const s of this.Kl) t && await t(s), this.Yl.push(s), (i = (e = this.l).onAdd) == null || i.call(e, s);
|
|
3720
|
+
this.Kl = [], this.Wl = !0;
|
|
3721
3721
|
}
|
|
3722
3722
|
get isReady() {
|
|
3723
|
-
return this.
|
|
3723
|
+
return this.Wl;
|
|
3724
3724
|
}
|
|
3725
3725
|
add(t) {
|
|
3726
3726
|
var e, i;
|
|
3727
|
-
return this.
|
|
3727
|
+
return this.Wl ? (this.Yl.push(t), (i = (e = this.l).onAdd) == null || i.call(e, t)) : this.Kl.push(t), t;
|
|
3728
3728
|
}
|
|
3729
3729
|
addMany(t) {
|
|
3730
3730
|
for (const e of t) this.add(e);
|
|
3731
3731
|
return t;
|
|
3732
3732
|
}
|
|
3733
3733
|
remove(t) {
|
|
3734
|
-
const e = this.
|
|
3735
|
-
if (e !== -1) return this.
|
|
3736
|
-
const i = this.
|
|
3737
|
-
return i !== -1 && (this.
|
|
3734
|
+
const e = this.Yl.indexOf(t);
|
|
3735
|
+
if (e !== -1) return this.Yl.splice(e, 1), this.Zl(t), !0;
|
|
3736
|
+
const i = this.Kl.indexOf(t);
|
|
3737
|
+
return i !== -1 && (this.Kl.splice(i, 1), this.Zl(t), !0);
|
|
3738
3738
|
}
|
|
3739
3739
|
removeAt(t) {
|
|
3740
|
-
if (t < 0 || t >= this.
|
|
3741
|
-
const [e] = this.
|
|
3742
|
-
return this.
|
|
3740
|
+
if (t < 0 || t >= this.Yl.length) return;
|
|
3741
|
+
const [e] = this.Yl.splice(t, 1);
|
|
3742
|
+
return this.Zl(e), e;
|
|
3743
3743
|
}
|
|
3744
3744
|
move(t, e) {
|
|
3745
3745
|
var r, h;
|
|
3746
|
-
const i = this.
|
|
3746
|
+
const i = this.Yl.indexOf(t);
|
|
3747
3747
|
if (i !== -1) {
|
|
3748
|
-
this.
|
|
3749
|
-
const a =
|
|
3750
|
-
return this.
|
|
3748
|
+
this.Yl.splice(i, 1);
|
|
3749
|
+
const a = X(e, 0, this.Yl.length);
|
|
3750
|
+
return this.Yl.splice(a, 0, t), (h = (r = this.l).onMove) == null || h.call(r, t, i, a), !0;
|
|
3751
3751
|
}
|
|
3752
|
-
const s = this.
|
|
3752
|
+
const s = this.Kl.indexOf(t);
|
|
3753
3753
|
if (s !== -1) {
|
|
3754
|
-
this.
|
|
3755
|
-
const a =
|
|
3756
|
-
return this.
|
|
3754
|
+
this.Kl.splice(s, 1);
|
|
3755
|
+
const a = X(e, 0, this.Kl.length);
|
|
3756
|
+
return this.Kl.splice(a, 0, t), !0;
|
|
3757
3757
|
}
|
|
3758
3758
|
return !1;
|
|
3759
3759
|
}
|
|
3760
3760
|
swap(t, e) {
|
|
3761
3761
|
var a, l;
|
|
3762
3762
|
if (t === e) return !0;
|
|
3763
|
-
const i = this.
|
|
3764
|
-
if (i !== -1 && s !== -1) return this.
|
|
3765
|
-
const r = this.
|
|
3766
|
-
return r !== -1 && h !== -1 && (this.
|
|
3763
|
+
const i = this.Yl.indexOf(t), s = this.Yl.indexOf(e);
|
|
3764
|
+
if (i !== -1 && s !== -1) return this.Yl[i] = e, this.Yl[s] = t, (l = (a = this.l).onSwap) == null || l.call(a, t, e, i, s), !0;
|
|
3765
|
+
const r = this.Kl.indexOf(t), h = this.Kl.indexOf(e);
|
|
3766
|
+
return r !== -1 && h !== -1 && (this.Kl[r] = e, this.Kl[h] = t, !0);
|
|
3767
3767
|
}
|
|
3768
3768
|
clear() {
|
|
3769
|
-
for (const t of this.
|
|
3770
|
-
this.
|
|
3771
|
-
for (const t of this.
|
|
3772
|
-
this.
|
|
3769
|
+
for (const t of this.Yl) this.Zl(t);
|
|
3770
|
+
this.Yl = [];
|
|
3771
|
+
for (const t of this.Kl) this.Zl(t);
|
|
3772
|
+
this.Kl = [];
|
|
3773
3773
|
}
|
|
3774
3774
|
dispose() {
|
|
3775
|
-
this.clear(), this.
|
|
3775
|
+
this.clear(), this.Wl = !1;
|
|
3776
3776
|
}
|
|
3777
3777
|
get all() {
|
|
3778
|
-
return this.
|
|
3778
|
+
return this.Yl;
|
|
3779
3779
|
}
|
|
3780
3780
|
get pending() {
|
|
3781
|
-
return this.
|
|
3781
|
+
return this.Kl;
|
|
3782
3782
|
}
|
|
3783
3783
|
get length() {
|
|
3784
|
-
return this.
|
|
3784
|
+
return this.Yl.length;
|
|
3785
3785
|
}
|
|
3786
3786
|
get totalLength() {
|
|
3787
|
-
return this.
|
|
3787
|
+
return this.Yl.length + this.Kl.length;
|
|
3788
3788
|
}
|
|
3789
3789
|
get isEmpty() {
|
|
3790
|
-
return this.
|
|
3790
|
+
return this.Yl.length === 0;
|
|
3791
3791
|
}
|
|
3792
3792
|
get(t) {
|
|
3793
|
-
return this.
|
|
3793
|
+
return this.Yl[t];
|
|
3794
3794
|
}
|
|
3795
3795
|
get first() {
|
|
3796
|
-
return this.
|
|
3796
|
+
return this.Yl[0];
|
|
3797
3797
|
}
|
|
3798
3798
|
get last() {
|
|
3799
|
-
return this.
|
|
3799
|
+
return this.Yl[this.Yl.length - 1];
|
|
3800
3800
|
}
|
|
3801
3801
|
indexOf(t) {
|
|
3802
|
-
return this.
|
|
3802
|
+
return this.Yl.indexOf(t);
|
|
3803
3803
|
}
|
|
3804
3804
|
has(t) {
|
|
3805
|
-
return this.
|
|
3805
|
+
return this.Yl.includes(t) || this.Kl.includes(t);
|
|
3806
3806
|
}
|
|
3807
3807
|
[Symbol.iterator]() {
|
|
3808
|
-
return this.
|
|
3808
|
+
return this.Yl[Symbol.iterator]();
|
|
3809
3809
|
}
|
|
3810
|
-
|
|
3810
|
+
Zl(t) {
|
|
3811
3811
|
var e, i, s, r;
|
|
3812
3812
|
(i = (e = this.l).onRemove) == null || i.call(e, t), (r = (s = this.l).onDispose) == null || r.call(s, t);
|
|
3813
3813
|
}
|
|
@@ -3815,20 +3815,20 @@ class ti {
|
|
|
3815
3815
|
class ee {
|
|
3816
3816
|
constructor(t) {
|
|
3817
3817
|
o(this, "R");
|
|
3818
|
-
o(this, "
|
|
3819
|
-
o(this, "
|
|
3818
|
+
o(this, "ql", /* @__PURE__ */ new Map());
|
|
3819
|
+
o(this, "Vl", /* @__PURE__ */ new Map());
|
|
3820
3820
|
o(this, "Ke");
|
|
3821
|
-
o(this, "
|
|
3821
|
+
o(this, "ul");
|
|
3822
3822
|
o(this, "Sr", !1);
|
|
3823
|
-
this.R = t, this.Ke = t.Mi(
|
|
3823
|
+
this.R = t, this.Ke = t.Mi(W, jt), this.Jl();
|
|
3824
3824
|
}
|
|
3825
3825
|
async register(t, e, i = {}) {
|
|
3826
3826
|
const s = Object.entries(i), r = s.length > 0 ? s[0][1][0] : null;
|
|
3827
3827
|
let h;
|
|
3828
3828
|
if (typeof e == "string") {
|
|
3829
3829
|
const l = await st(e);
|
|
3830
|
-
h = this.R.Mi(
|
|
3831
|
-
} else h = e, this.
|
|
3830
|
+
h = this.R.Mi(W, l), this.Vl.set(t, h);
|
|
3831
|
+
} else h = e, this.Vl.set(t, h);
|
|
3832
3832
|
const a = { id: t, createShader: () => h, createUniforms: (l, u) => {
|
|
3833
3833
|
const c = { u_resolution: [u.width, u.height] };
|
|
3834
3834
|
for (const [f, [g, p]] of s) {
|
|
@@ -3844,208 +3844,208 @@ class ee {
|
|
|
3844
3844
|
}
|
|
3845
3845
|
return c;
|
|
3846
3846
|
} };
|
|
3847
|
-
this.
|
|
3847
|
+
this.ql.set(t, a);
|
|
3848
3848
|
}
|
|
3849
3849
|
unregister(t) {
|
|
3850
|
-
const e = this.
|
|
3851
|
-
return e && (e.dispose(), this.
|
|
3850
|
+
const e = this.Vl.get(t);
|
|
3851
|
+
return e && (e.dispose(), this.Vl.delete(t)), this.ql.delete(t);
|
|
3852
3852
|
}
|
|
3853
3853
|
has(t) {
|
|
3854
|
-
return this.
|
|
3854
|
+
return this.ql.has(t);
|
|
3855
3855
|
}
|
|
3856
3856
|
Er(t, e) {
|
|
3857
|
-
this.Sr || (this.
|
|
3857
|
+
this.Sr || (this.ul = [this.R.Hi(t, e, 1, { depth: !1 }), this.R.Hi(t, e, 1, { depth: !1 })], this.Sr = !0);
|
|
3858
3858
|
}
|
|
3859
|
-
|
|
3860
|
-
this.
|
|
3859
|
+
tu(t, e, i, s, r) {
|
|
3860
|
+
this.ul[0].width === s && this.ul[0].height === r || (this.ul[0].resize(s, r), this.ul[1].resize(s, r)), this.Al(t, e, i, s, r, this.ul);
|
|
3861
3861
|
}
|
|
3862
|
-
|
|
3863
|
-
if (i.length === 0) return void this.
|
|
3864
|
-
this.
|
|
3862
|
+
Al(t, e, i, s, r, h) {
|
|
3863
|
+
if (i.length === 0) return void this.su(t, e, s, r);
|
|
3864
|
+
this.su(t, h[0], s, r);
|
|
3865
3865
|
let a = 0;
|
|
3866
3866
|
for (let l = 0; l < i.length; l++) {
|
|
3867
3867
|
const u = i[l], c = l === i.length - 1, f = a === 0 ? 1 : 0, g = c ? e : h[f];
|
|
3868
|
-
this.
|
|
3868
|
+
this.eu(u, h[a], g, s, r), c || (a = f);
|
|
3869
3869
|
}
|
|
3870
3870
|
}
|
|
3871
|
-
|
|
3872
|
-
const h = this.
|
|
3873
|
-
if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.
|
|
3874
|
-
const a = this.
|
|
3871
|
+
eu(t, e, i, s, r) {
|
|
3872
|
+
const h = this.ql.get(t.name);
|
|
3873
|
+
if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.su(e.textures[0], i, s, r);
|
|
3874
|
+
const a = this.iu(t.name, h, s, r), l = { renderer: this.R, gl: this.R.context, width: s, height: r };
|
|
3875
3875
|
i.begin(), this.R.xi(a), a.gt({ u_texture: e.textures[0] });
|
|
3876
3876
|
const u = h.createUniforms(t.params, l);
|
|
3877
3877
|
a.gt(u), this.R.Ei(0, 0, s, r), i.end();
|
|
3878
3878
|
}
|
|
3879
|
-
|
|
3880
|
-
let r = this.
|
|
3879
|
+
iu(t, e, i, s) {
|
|
3880
|
+
let r = this.Vl.get(t);
|
|
3881
3881
|
if (!r && e) {
|
|
3882
3882
|
const h = { renderer: this.R, gl: this.R.context, width: i, height: s };
|
|
3883
|
-
r = e.createShader(h), this.
|
|
3883
|
+
r = e.createShader(h), this.Vl.set(t, r);
|
|
3884
3884
|
}
|
|
3885
3885
|
return r;
|
|
3886
3886
|
}
|
|
3887
|
-
|
|
3887
|
+
su(t, e, i, s) {
|
|
3888
3888
|
e.begin(), this.R.xi(this.Ke), this.Ke.gt({ u_texture: t, u_resolution: [i, s] }), this.R.Ei(0, 0, i, s), e.end();
|
|
3889
3889
|
}
|
|
3890
3890
|
vn(t, e) {
|
|
3891
|
-
this.
|
|
3891
|
+
this.ul && (this.ul[0].resize(t, e), this.ul[1].resize(t, e));
|
|
3892
3892
|
}
|
|
3893
3893
|
Ss() {
|
|
3894
|
-
for (const t of this.
|
|
3895
|
-
this.
|
|
3894
|
+
for (const t of this.Vl.values()) t.dispose();
|
|
3895
|
+
this.Vl.clear(), this.ql.clear(), this.Ke.dispose(), this.ul && (this.ul[0].dispose(), this.ul[1].dispose()), this.Sr = !1;
|
|
3896
3896
|
}
|
|
3897
|
-
|
|
3897
|
+
Jl() {
|
|
3898
3898
|
this.register("invert", `#version 300 es
|
|
3899
3899
|
precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);fragColor=vec4(1.-A.rgb,A.a);}`, {}), this.register("grayscale", `#version 300 es
|
|
3900
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3901
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3902
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3900
|
+
precision highp float;uniform sampler2D u_texture;uniform float Um;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));vec3 C=mix(A.rgb,vec3(B),Um);fragColor=vec4(C,A.a);}`, { Um: ["amount", 1] }), this.register("sepia", `#version 300 es
|
|
3901
|
+
precision highp float;uniform sampler2D u_texture;uniform float Um;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);vec3 B;B.r=dot(A.rgb,vec3(0.393,0.769,0.189));B.g=dot(A.rgb,vec3(0.349,0.686,0.168));B.b=dot(A.rgb,vec3(0.272,0.534,0.131));vec3 C=mix(A.rgb,B,Um);fragColor=vec4(C,A.a);}`, { Um: ["amount", 1] }), this.register("threshold", `#version 300 es
|
|
3902
|
+
precision highp float;uniform sampler2D u_texture;uniform float Uq;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));float C=step(Uq,B);fragColor=vec4(vec3(C),A.a);}`, { Uq: ["threshold", 0.5] });
|
|
3903
3903
|
}
|
|
3904
3904
|
}
|
|
3905
3905
|
const ni = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFilterManager: ee }, Symbol.toStringTag, { value: "Module" }));
|
|
3906
3906
|
class ie {
|
|
3907
3907
|
constructor(t, e) {
|
|
3908
|
-
o(this, "
|
|
3908
|
+
o(this, "Oa");
|
|
3909
3909
|
o(this, "R");
|
|
3910
|
+
o(this, "ru");
|
|
3911
|
+
o(this, "nu");
|
|
3910
3912
|
o(this, "hu");
|
|
3911
3913
|
o(this, "ou");
|
|
3912
|
-
o(this, "
|
|
3913
|
-
o(this, "
|
|
3914
|
-
o(this, "
|
|
3915
|
-
o(this, "lu"
|
|
3916
|
-
o(this, "uu"
|
|
3917
|
-
|
|
3918
|
-
o(this, "du");
|
|
3919
|
-
this.Ha = t, this.R = t.R, this.ou = new ee(this.R), this.hu = new te(this.R, this.Ha.Xr.width, this.Ha.Xr.height), this.au = new ti({ onRemove: (i) => this.Ha.Al.nc(i), onDispose: (i) => i == null ? void 0 : i.Ss() }), this.cu = new ot(this.R, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
|
|
3914
|
+
o(this, "Wl", !1);
|
|
3915
|
+
o(this, "au", /* @__PURE__ */ new Set());
|
|
3916
|
+
o(this, "cu", []);
|
|
3917
|
+
o(this, "lu");
|
|
3918
|
+
o(this, "uu");
|
|
3919
|
+
this.Oa = t, this.R = t.R, this.nu = new ee(this.R), this.ru = new te(this.R, this.Oa.Xr.width, this.Oa.Xr.height), this.hu = new ti({ onRemove: (i) => this.Oa._l.ec(i), onDispose: (i) => i == null ? void 0 : i.Ss() }), this.ou = new ot(this.R, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
|
|
3920
3920
|
}
|
|
3921
3921
|
async Er() {
|
|
3922
|
-
await this.
|
|
3923
|
-
const t = this.
|
|
3924
|
-
this.
|
|
3922
|
+
await this.fu(this.ou);
|
|
3923
|
+
const t = this.Oa.Xr;
|
|
3924
|
+
this.lu = this.R.Hi(t.width, t.height, 1), this.uu = this.R.Hi(t.width, t.height, 1), this.nu.Er(t.width, t.height), await this.hu.initialize((e) => this.fu(e)), this.Wl = !0;
|
|
3925
3925
|
}
|
|
3926
|
-
|
|
3927
|
-
this.
|
|
3926
|
+
du(t, e) {
|
|
3927
|
+
this.cu.push({ name: t, params: e });
|
|
3928
3928
|
}
|
|
3929
|
-
|
|
3930
|
-
this.
|
|
3929
|
+
pu() {
|
|
3930
|
+
this.cu = [];
|
|
3931
3931
|
}
|
|
3932
3932
|
add(t = {}) {
|
|
3933
3933
|
const e = new ot(this.R, t);
|
|
3934
|
-
return this.
|
|
3934
|
+
return this.hu.isReady && this.fu(e), this.hu.add(e), e;
|
|
3935
3935
|
}
|
|
3936
3936
|
remove(t) {
|
|
3937
|
-
this.
|
|
3937
|
+
this.hu.remove(t);
|
|
3938
3938
|
}
|
|
3939
3939
|
move(t, e) {
|
|
3940
|
-
this.
|
|
3940
|
+
this.hu.move(t, e);
|
|
3941
3941
|
}
|
|
3942
3942
|
swap(t, e) {
|
|
3943
|
-
this.
|
|
3943
|
+
this.hu.swap(t, e);
|
|
3944
3944
|
}
|
|
3945
3945
|
clear() {
|
|
3946
|
-
this.
|
|
3946
|
+
this.hu.clear();
|
|
3947
3947
|
}
|
|
3948
|
-
|
|
3949
|
-
this.
|
|
3948
|
+
vu(t) {
|
|
3949
|
+
this.Oa._l.Ja(), this.ou.Ra(this.Oa, this.Oa.zl);
|
|
3950
3950
|
const e = [...this.R.state.canvasBackgroundColor];
|
|
3951
|
-
this.
|
|
3952
|
-
}
|
|
3953
|
-
|
|
3954
|
-
this.
|
|
3955
|
-
let t = this.
|
|
3956
|
-
if (this.
|
|
3957
|
-
const i = this.
|
|
3958
|
-
this.
|
|
3951
|
+
this.hu.all.forEach((i) => i.Ra(this.Oa, this.Oa.zl)), this.gu(t, e);
|
|
3952
|
+
}
|
|
3953
|
+
mu() {
|
|
3954
|
+
this.vu(this.lu);
|
|
3955
|
+
let t = this.lu.textures[0];
|
|
3956
|
+
if (this.cu.length > 0) {
|
|
3957
|
+
const i = this.Oa.Xr;
|
|
3958
|
+
this.nu.tu(this.lu.textures[0], this.uu, this.cu, i.width, i.height), t = this.uu.textures[0], this.cu = [];
|
|
3959
3959
|
}
|
|
3960
|
-
const e = this.
|
|
3961
|
-
this.R.xe(0, 0, 0, 0), this.R.xi(this.
|
|
3960
|
+
const e = this.Oa.Xr;
|
|
3961
|
+
this.R.xe(0, 0, 0, 0), this.R.xi(this.Oa.Hl), this.Oa.Hl.gt({ u_texture: t }), this.R.Ei(0, 0, e.width, e.height), this.Oa._l.sc();
|
|
3962
3962
|
}
|
|
3963
|
-
|
|
3964
|
-
const i = this.
|
|
3963
|
+
gu(t, e) {
|
|
3964
|
+
const i = this.Oa.Xr, s = this.ou.grid, r = this.ou.texture;
|
|
3965
3965
|
if (!r) return;
|
|
3966
|
-
const h = { layer: this.
|
|
3966
|
+
const h = { layer: this.ou, texture: r, width: s.width, height: s.height, offsetX: s.offsetX + this.ou.sl, offsetY: s.offsetY + this.ou.el }, a = this.hu.all.filter((l) => !!l.grid && !!l.texture).map((l) => {
|
|
3967
3967
|
const u = l.grid;
|
|
3968
|
-
return { layer: l, texture: l.texture, width: u.width, height: u.height, offsetX: u.offsetX + l.
|
|
3968
|
+
return { layer: l, texture: l.texture, width: u.width, height: u.height, offsetX: u.offsetX + l.sl, offsetY: u.offsetY + l.el };
|
|
3969
3969
|
});
|
|
3970
|
-
this.
|
|
3970
|
+
this.ru.Ql({ base: h, layers: a, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
|
|
3971
3971
|
}
|
|
3972
3972
|
vn() {
|
|
3973
3973
|
var e, i, s;
|
|
3974
|
-
if (!this.
|
|
3975
|
-
const t = this.
|
|
3976
|
-
this.
|
|
3974
|
+
if (!this.Wl) return;
|
|
3975
|
+
const t = this.Oa.Xr;
|
|
3976
|
+
this.ou.vn(), this.hu.all.forEach((r) => r.vn()), this.ru.vn(t.width, t.height), (e = this.lu) == null || e.resize(t.width, t.height), (i = this.uu) == null || i.resize(t.width, t.height), (s = this.nu) == null || s.vn(t.width, t.height);
|
|
3977
3977
|
}
|
|
3978
3978
|
Ss() {
|
|
3979
3979
|
var t, e;
|
|
3980
|
-
this.
|
|
3980
|
+
this.hu.dispose(), this.Oa._l.ec(this.ou), this.ou.Ss(), this.nu.Ss(), this.ru.Ss(), (t = this.lu) == null || t.dispose(), (e = this.uu) == null || e.dispose(), this.cu = [];
|
|
3981
3981
|
}
|
|
3982
3982
|
get all() {
|
|
3983
|
-
return this.
|
|
3983
|
+
return this.hu.all;
|
|
3984
3984
|
}
|
|
3985
3985
|
get base() {
|
|
3986
|
-
return this.
|
|
3986
|
+
return this.ou;
|
|
3987
3987
|
}
|
|
3988
3988
|
get filters() {
|
|
3989
|
-
return this.
|
|
3989
|
+
return this.nu;
|
|
3990
3990
|
}
|
|
3991
3991
|
get resultFramebuffer() {
|
|
3992
|
-
return this.
|
|
3992
|
+
return this.uu;
|
|
3993
3993
|
}
|
|
3994
|
-
|
|
3995
|
-
const t = this.
|
|
3994
|
+
_u() {
|
|
3995
|
+
const t = this.hu.all;
|
|
3996
3996
|
for (let e = t.length - 1; e >= 0; e--) {
|
|
3997
3997
|
const i = t[e];
|
|
3998
|
-
if (i.
|
|
3998
|
+
if (i.Jc && i.grid) return i.grid;
|
|
3999
3999
|
}
|
|
4000
|
-
return this.
|
|
4000
|
+
return this.ou.grid;
|
|
4001
4001
|
}
|
|
4002
|
-
|
|
4003
|
-
this.
|
|
4002
|
+
yu(t) {
|
|
4003
|
+
this.au.add(t);
|
|
4004
4004
|
}
|
|
4005
|
-
|
|
4006
|
-
for (const t of this.
|
|
4005
|
+
Au() {
|
|
4006
|
+
for (const t of this.au) t();
|
|
4007
4007
|
}
|
|
4008
|
-
async
|
|
4008
|
+
async fu(t) {
|
|
4009
4009
|
var i;
|
|
4010
|
-
const e = { renderer: this.R, canvas: this.
|
|
4011
|
-
await t.
|
|
4010
|
+
const e = { renderer: this.R, canvas: this.Oa.Xr, filterManager: this.nu, createFramebuffer: (s, r, h = 1, a) => this.R.Hi(s, r, h, a) };
|
|
4011
|
+
await t.vl(e), (i = t.grid) == null || i.Vr(() => this.Au());
|
|
4012
4012
|
}
|
|
4013
4013
|
}
|
|
4014
4014
|
const ei = { id: "brightness", createShader: ({ gl: n }) => new j(n, ht, `#version 300 es
|
|
4015
4015
|
precision highp float;in vec2 v_uv;uniform sampler2D u_image;uniform bool u_invert;uniform bool u_flipX;uniform bool u_flipY;uniform float u_charRotation;uniform bool u_charColorFixed;uniform vec4 u_charColor;uniform bool u_cellColorFixed;uniform vec4 u_cellColor;uniform vec4 u_backgroundColor;uniform int u_charCount;uniform vec3 u_charList[255];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;float B(vec3 C){return dot(C,vec3(0.299f,0.587f,0.114f));}void main(){vec2 D=vec2(v_uv.x,1.0f-v_uv.y);vec4 E=texture(u_image,D);float F=B(E.rgb);vec2 G=vec2(0.);if(u_charCount>0){float H=float(u_charCount);float I=clamp(F*(H-1.0f),0.0f,H-1.0f);int J=int(floor(I+0.5f));vec3 K=u_charList[J];G=K.xy;}else{G=vec2(0.0f,0.0f);}vec4 L=u_charColorFixed?u_charColor:E;vec4 M=u_cellColorFixed?u_cellColor:E;if(E.a<0.01f){discard;}o_primaryColor=vec4(L.rgb,L.a);o_secondaryColor=vec4(M.rgb,M.a);A=vec4(0.);int N=int(u_invert?1:0);int O=int(u_flipX?1:0);int P=int(u_flipY?1:0);float Q=float(N|(O<<1)|(P<<2))/255.;o_character=vec4(G,Q,clamp(u_charRotation,0.0f,1.0f));}`), createUniforms: ({ source: n }) => n.createBaseConversionUniforms() };
|
|
4016
4016
|
class se {
|
|
4017
4017
|
constructor() {
|
|
4018
|
-
o(this, "
|
|
4019
|
-
o(this, "
|
|
4020
|
-
this.
|
|
4018
|
+
o(this, "wu", /* @__PURE__ */ new Map());
|
|
4019
|
+
o(this, "Vl", /* @__PURE__ */ new Map());
|
|
4020
|
+
this.bu();
|
|
4021
4021
|
}
|
|
4022
4022
|
register(t) {
|
|
4023
|
-
this.
|
|
4023
|
+
this.wu.set(t.id, t);
|
|
4024
4024
|
}
|
|
4025
4025
|
unregister(t) {
|
|
4026
|
-
const e = this.
|
|
4027
|
-
return e && (e.dispose(), this.
|
|
4026
|
+
const e = this.Vl.get(t);
|
|
4027
|
+
return e && (e.dispose(), this.Vl.delete(t)), this.wu.delete(t);
|
|
4028
4028
|
}
|
|
4029
4029
|
has(t) {
|
|
4030
|
-
return this.
|
|
4030
|
+
return this.wu.has(t);
|
|
4031
4031
|
}
|
|
4032
|
-
|
|
4033
|
-
return this.
|
|
4032
|
+
jn(t) {
|
|
4033
|
+
return this.wu.get(t);
|
|
4034
4034
|
}
|
|
4035
|
-
|
|
4036
|
-
let i = this.
|
|
4035
|
+
Gn(t, e) {
|
|
4036
|
+
let i = this.Vl.get(t);
|
|
4037
4037
|
if (!i) {
|
|
4038
|
-
const s = this.
|
|
4038
|
+
const s = this.wu.get(t);
|
|
4039
4039
|
if (!s) throw Error(`[textmode.js] Conversion mode "${t}" is not registered.`);
|
|
4040
|
-
i = s.createShader(e), this.
|
|
4040
|
+
i = s.createShader(e), this.Vl.set(t, i);
|
|
4041
4041
|
}
|
|
4042
4042
|
return i;
|
|
4043
4043
|
}
|
|
4044
4044
|
Ss() {
|
|
4045
|
-
for (const t of this.
|
|
4046
|
-
this.
|
|
4045
|
+
for (const t of this.Vl.values()) t.dispose();
|
|
4046
|
+
this.Vl.clear(), this.wu.clear();
|
|
4047
4047
|
}
|
|
4048
|
-
|
|
4048
|
+
bu() {
|
|
4049
4049
|
this.register(ei);
|
|
4050
4050
|
}
|
|
4051
4051
|
}
|
|
@@ -4053,128 +4053,128 @@ const hi = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeConver
|
|
|
4053
4053
|
class ii extends function(e, ...i) {
|
|
4054
4054
|
return i.reduce((s, r) => r(s), e);
|
|
4055
4055
|
}(class {
|
|
4056
|
-
},
|
|
4056
|
+
}, We, Ke, Qe, Ze, qe) {
|
|
4057
4057
|
constructor(e = {}) {
|
|
4058
4058
|
super();
|
|
4059
4059
|
o(this, "R");
|
|
4060
|
-
o(this, "
|
|
4061
|
-
o(this, "
|
|
4060
|
+
o(this, "zl");
|
|
4061
|
+
o(this, "Hl");
|
|
4062
4062
|
o(this, "Xr");
|
|
4063
|
+
o(this, "ka");
|
|
4064
|
+
o(this, "bo");
|
|
4065
|
+
o(this, "La");
|
|
4063
4066
|
o(this, "Da");
|
|
4064
|
-
o(this, "
|
|
4065
|
-
o(this, "
|
|
4066
|
-
o(this, "
|
|
4067
|
-
o(this, "
|
|
4068
|
-
o(this, "
|
|
4069
|
-
o(this, "
|
|
4070
|
-
o(this, "
|
|
4071
|
-
o(this, "$u",
|
|
4072
|
-
o(this, "Al");
|
|
4067
|
+
o(this, "Cu");
|
|
4068
|
+
o(this, "xu");
|
|
4069
|
+
o(this, "yl");
|
|
4070
|
+
o(this, "Un");
|
|
4071
|
+
o(this, "Mu", /* @__PURE__ */ new Set());
|
|
4072
|
+
o(this, "_l");
|
|
4073
|
+
o(this, "Fu", !1);
|
|
4074
|
+
o(this, "$u", !1);
|
|
4073
4075
|
o(this, "Pu", !1);
|
|
4074
4076
|
o(this, "Tu", !1);
|
|
4075
|
-
o(this, "Su",
|
|
4076
|
-
o(this, "Eu", !1);
|
|
4077
|
-
o(this, "ku", () => {
|
|
4077
|
+
o(this, "Su", () => {
|
|
4078
4078
|
});
|
|
4079
|
-
o(this, "
|
|
4079
|
+
o(this, "Eu", () => {
|
|
4080
4080
|
});
|
|
4081
|
-
o(this, "
|
|
4081
|
+
o(this, "ku");
|
|
4082
|
+
o(this, "Ru");
|
|
4082
4083
|
o(this, "Lu");
|
|
4083
|
-
o(this, "Ou");
|
|
4084
4084
|
o(this, "rn", !1);
|
|
4085
|
-
o(this, "
|
|
4086
|
-
o(this, "
|
|
4087
|
-
this.
|
|
4088
|
-
precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D U0;uniform sampler2D U1;uniform sampler2D U2;uniform vec2 U3;uniform vec2 U4;uniform vec4 U5;in vec2 v_uv;out vec4 fragColor;mat2 A(float B){float C=sin(B);float D=cos(B);return mat2(D,-C,C,D);}void main(){vec2 E=gl_FragCoord.xy/U4;vec2 F=E*U3;vec2 G=floor(F);vec2 H=(G+0.5)/U3;vec4 I=texture(U0,H);vec4 J=texture(U1,H);vec4 K=texture(U2,H);int L=int(K.b*255.+0.5);bool M=(L&1)!=0;bool N=(L&2)!=0;bool O=(L&4)!=0;int P=int(K.r*255.+0.5)+int(K.g*255.+0.5)*256;int Q=int(u_charsetDimensions.x);int R=P/Q;int S=P-(R*Q);float T=(u_charsetDimensions.y-1.)-float(R);vec2 U=1./u_charsetDimensions;vec2 V=vec2(float(S),T)*U;vec2 W=V+U;float X=-K.a*360.*0.017453292;vec2 Y=fract(F)-0.5f;vec2 Z=vec2(N?-1.:1.,O?-1.:1.);Y*=Z;Y=A(X)*Y+0.5;vec2 a=V+clamp(Y,0.,1.)*U;const float b=0.0001;if(any(lessThan(a,V-b))||any(greaterThan(a,W+b))){fragColor=M?I:J;return;}vec4 c=texture(u_characterTexture,a);if(M)c.rgb=mix(c.rgb,1.-c.rgb,float(M));vec4 d=mix(U5,J,J.a);fragColor=mix(d,I,c);}`), this.
|
|
4089
|
-
this.
|
|
4090
|
-
}), this.
|
|
4091
|
-
const i = () => this.
|
|
4092
|
-
this.
|
|
4093
|
-
}
|
|
4094
|
-
|
|
4085
|
+
o(this, "Du");
|
|
4086
|
+
o(this, "Ou");
|
|
4087
|
+
this._l = new Vt(this), this.rn = e.overlay ?? !1, this.Xr = new He(e), this.R = new Me(this.Xr.gn()), this.zl = this.R.Mi(W, `#version 300 es
|
|
4088
|
+
precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D U0;uniform sampler2D U1;uniform sampler2D U2;uniform vec2 U3;uniform vec2 U4;uniform vec4 U5;in vec2 v_uv;out vec4 fragColor;mat2 A(float B){float C=sin(B);float D=cos(B);return mat2(D,-C,C,D);}void main(){vec2 E=gl_FragCoord.xy/U4;vec2 F=E*U3;vec2 G=floor(F);vec2 H=(G+0.5)/U3;vec4 I=texture(U0,H);vec4 J=texture(U1,H);vec4 K=texture(U2,H);int L=int(K.b*255.+0.5);bool M=(L&1)!=0;bool N=(L&2)!=0;bool O=(L&4)!=0;int P=int(K.r*255.+0.5)+int(K.g*255.+0.5)*256;int Q=int(u_charsetDimensions.x);int R=P/Q;int S=P-(R*Q);float T=(u_charsetDimensions.y-1.)-float(R);vec2 U=1./u_charsetDimensions;vec2 V=vec2(float(S),T)*U;vec2 W=V+U;float X=-K.a*360.*0.017453292;vec2 Y=fract(F)-0.5f;vec2 Z=vec2(N?-1.:1.,O?-1.:1.);Y*=Z;Y=A(X)*Y+0.5;vec2 a=V+clamp(Y,0.,1.)*U;const float b=0.0001;if(any(lessThan(a,V-b))||any(greaterThan(a,W+b))){fragColor=M?I:J;return;}vec4 c=texture(u_characterTexture,a);if(M)c.rgb=mix(c.rgb,1.-c.rgb,float(M));vec4 d=mix(U5,J,J.a);fragColor=mix(d,I,c);}`), this.Hl = this.R.Mi(W, jt), this.ka = new Nt(e.frameRate ?? 60), this.Cu = new Jt(this, e.loadingScreen, this.Xr.pn()), this.Cu.Dl(() => {
|
|
4089
|
+
this.ka.ph = 0, this.Tu = !0;
|
|
4090
|
+
}), this.xu = new ie(this, e);
|
|
4091
|
+
const i = () => this.zu();
|
|
4092
|
+
this.bo = new kt(this.Xr, i), this.La = new Gt(this.Xr, i, this.bo), this.Da = new Ht(), this.Un = new se(), this._l.Ka(e.plugins ?? []), this.Cu.ih(), this.Hu();
|
|
4093
|
+
}
|
|
4094
|
+
Ea(e) {
|
|
4095
4095
|
var i;
|
|
4096
|
-
this
|
|
4097
|
-
this
|
|
4096
|
+
this.Mu.add(e), (i = e.C) == null || i.call(e, () => {
|
|
4097
|
+
this.Mu.delete(e);
|
|
4098
4098
|
});
|
|
4099
4099
|
}
|
|
4100
|
-
async
|
|
4101
|
-
await this.
|
|
4102
|
-
const e = this.
|
|
4103
|
-
this.
|
|
4104
|
-
this.
|
|
4105
|
-
}), this.rn && (this.
|
|
4100
|
+
async Hu() {
|
|
4101
|
+
await this.xu.Er(), await this.Cu.Er();
|
|
4102
|
+
const e = this.xu.base.grid;
|
|
4103
|
+
this.xu.yu(() => {
|
|
4104
|
+
this.bo.Wh(), this.La.Wh();
|
|
4105
|
+
}), this.rn && (this.Du = K.Qn(this.R, this.Un, this.Xr.targetCanvas, e.cols, e.rows)), this.Bu(), this.ka.ih(() => this.Ra());
|
|
4106
4106
|
try {
|
|
4107
|
-
await this.
|
|
4107
|
+
await this._l.hc(), await this.Su(), await this._l.ac(), this.Cu.Bc();
|
|
4108
4108
|
} catch (i) {
|
|
4109
|
-
console.error("Error during setup:", i), this.
|
|
4109
|
+
console.error("Error during setup:", i), this.Cu.error(i);
|
|
4110
4110
|
}
|
|
4111
4111
|
}
|
|
4112
|
-
|
|
4113
|
-
this.
|
|
4114
|
-
this.rn && this.resizeCanvas(this.Xr.targetCanvas.width, this.Xr.targetCanvas.height), this.
|
|
4115
|
-
}, window.addEventListener("resize", this.
|
|
4116
|
-
this.
|
|
4117
|
-
}, window.addEventListener("blur", this.
|
|
4112
|
+
Bu() {
|
|
4113
|
+
this.ku = () => {
|
|
4114
|
+
this.rn && this.resizeCanvas(this.Xr.targetCanvas.width, this.Xr.targetCanvas.height), this.Eu();
|
|
4115
|
+
}, window.addEventListener("resize", this.ku), this.bo.Ih(), this.La.Ih(), this.Da.Ih(), this.Ru = () => {
|
|
4116
|
+
this.Da.wo();
|
|
4117
|
+
}, window.addEventListener("blur", this.Ru), this.rn && (this.Lu = new ResizeObserver(() => {
|
|
4118
4118
|
this.resizeCanvas(this.Xr.targetCanvas.width, this.Xr.targetCanvas.height);
|
|
4119
|
-
}), this.
|
|
4119
|
+
}), this.Lu.observe(this.Xr.targetCanvas));
|
|
4120
4120
|
}
|
|
4121
|
-
|
|
4122
|
-
if (!this.
|
|
4123
|
-
this
|
|
4121
|
+
Ra() {
|
|
4122
|
+
if (!this.Cu.Dc && this.Tu) {
|
|
4123
|
+
this.$u = !0;
|
|
4124
4124
|
try {
|
|
4125
|
-
this.
|
|
4125
|
+
this.ka.ah(), this.ka.gh(), this.rn && rt(this.R.context, this.Du.texture, this.Xr.targetCanvas), this.xu.mu();
|
|
4126
4126
|
} finally {
|
|
4127
|
-
this
|
|
4127
|
+
this.$u = !1, this.Fu && !this.Pu && this.Iu();
|
|
4128
4128
|
}
|
|
4129
4129
|
}
|
|
4130
4130
|
}
|
|
4131
4131
|
resizeCanvas(e, i) {
|
|
4132
4132
|
var s;
|
|
4133
|
-
this.Xr.vn(e, i), this.
|
|
4133
|
+
this.Xr.vn(e, i), this.Cu.Bl(this.Xr.pn()), this.Cu.vn(), (s = this.xu) == null || s.vn(), this.R.Gi(), this.Ra();
|
|
4134
4134
|
}
|
|
4135
4135
|
destroy() {
|
|
4136
|
-
this.
|
|
4136
|
+
this.Pu || this.Fu || (this.Fu = !0, this.ka.nh(), this.$u || this.Iu());
|
|
4137
4137
|
}
|
|
4138
|
-
|
|
4138
|
+
Iu() {
|
|
4139
4139
|
var e, i, s, r;
|
|
4140
|
-
this.
|
|
4141
|
-
for (const h of this
|
|
4142
|
-
this
|
|
4140
|
+
this.Fu = !1, this.Xr.Ss(), this.Cu.Ss(), this._l.cc(), window.removeEventListener("resize", this.ku), window.removeEventListener("blur", this.Ru), (e = this.Lu) == null || e.disconnect(), this.bo.Kh(), this.La.Kh(), this.Da.Kh(), (i = this.xu) == null || i.Ss(), (s = this.Un) == null || s.Ss();
|
|
4141
|
+
for (const h of this.Mu) h.dispose();
|
|
4142
|
+
this.Mu.clear(), this.zl.dispose(), this.Hl.dispose(), this.R.Ss(), (r = this.Du) == null || r.dispose(), this.Pu = !0;
|
|
4143
4143
|
}
|
|
4144
4144
|
filter(e, i) {
|
|
4145
|
-
this.
|
|
4145
|
+
this.xu.du(e, i);
|
|
4146
4146
|
}
|
|
4147
4147
|
draw(e) {
|
|
4148
|
-
this.
|
|
4148
|
+
this.xu.base.draw(e);
|
|
4149
4149
|
}
|
|
4150
4150
|
async loadFont(e, i = !0) {
|
|
4151
|
-
if (i) return await this.
|
|
4151
|
+
if (i) return await this.xu.base.loadFont(e), this.xu.base.font;
|
|
4152
4152
|
if (e instanceof z) return e.Gr || await e.Er(), e;
|
|
4153
4153
|
const s = new z(this.R);
|
|
4154
|
-
return await s.Er(e), this.
|
|
4154
|
+
return await s.Er(e), this.Ea(s), s;
|
|
4155
4155
|
}
|
|
4156
4156
|
fontSize(e) {
|
|
4157
|
-
return this.
|
|
4157
|
+
return this.xu.base.fontSize(e);
|
|
4158
4158
|
}
|
|
4159
4159
|
inputGrid(e) {
|
|
4160
|
-
return e === void 0 ? this.
|
|
4160
|
+
return e === void 0 ? this.Ou ?? "topmost" : e === "topmost" ? (this.Ou = void 0, this.bo.Wh(), void this.La.Wh()) : (this.Ou = e, this.bo.Wh(), void this.La.Wh());
|
|
4161
4161
|
}
|
|
4162
|
-
|
|
4163
|
-
return this.
|
|
4162
|
+
zu() {
|
|
4163
|
+
return this.Ou ? this.Ou : this.xu._u();
|
|
4164
4164
|
}
|
|
4165
4165
|
async setup(e) {
|
|
4166
|
-
this.
|
|
4166
|
+
this.Su = e;
|
|
4167
4167
|
}
|
|
4168
4168
|
windowResized(e) {
|
|
4169
|
-
this.
|
|
4169
|
+
this.Eu = e;
|
|
4170
4170
|
}
|
|
4171
4171
|
get grid() {
|
|
4172
4172
|
var e;
|
|
4173
|
-
return ((e = this.
|
|
4173
|
+
return ((e = this.yl) == null ? void 0 : e.grid) ?? this.xu.base.grid;
|
|
4174
4174
|
}
|
|
4175
4175
|
get font() {
|
|
4176
4176
|
var e;
|
|
4177
|
-
return ((e = this.
|
|
4177
|
+
return ((e = this.yl) == null ? void 0 : e.font) ?? this.xu.base.font;
|
|
4178
4178
|
}
|
|
4179
4179
|
get width() {
|
|
4180
4180
|
return this.Xr.width;
|
|
@@ -4186,25 +4186,25 @@ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charse
|
|
|
4186
4186
|
return this.Xr.canvas;
|
|
4187
4187
|
}
|
|
4188
4188
|
get isDisposed() {
|
|
4189
|
-
return this.
|
|
4189
|
+
return this.Pu;
|
|
4190
4190
|
}
|
|
4191
4191
|
get overlay() {
|
|
4192
|
-
return this.
|
|
4192
|
+
return this.Du;
|
|
4193
4193
|
}
|
|
4194
4194
|
get loading() {
|
|
4195
|
-
return this.
|
|
4195
|
+
return this.Cu;
|
|
4196
4196
|
}
|
|
4197
4197
|
get layers() {
|
|
4198
|
-
return this.
|
|
4198
|
+
return this.xu;
|
|
4199
4199
|
}
|
|
4200
4200
|
get filters() {
|
|
4201
|
-
return this.
|
|
4201
|
+
return this.xu.filters;
|
|
4202
4202
|
}
|
|
4203
4203
|
get conversions() {
|
|
4204
|
-
return this.
|
|
4204
|
+
return this.Un;
|
|
4205
4205
|
}
|
|
4206
4206
|
get isRenderingFrame() {
|
|
4207
|
-
return this
|
|
4207
|
+
return this.$u;
|
|
4208
4208
|
}
|
|
4209
4209
|
}
|
|
4210
4210
|
class Et {
|
|
@@ -4217,14 +4217,14 @@ class Et {
|
|
|
4217
4217
|
yt._(t);
|
|
4218
4218
|
}
|
|
4219
4219
|
static get version() {
|
|
4220
|
-
return "0.9.
|
|
4220
|
+
return "0.9.2-beta.2";
|
|
4221
4221
|
}
|
|
4222
4222
|
}
|
|
4223
|
-
const oi = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase:
|
|
4223
|
+
const oi = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: $t, LoadingPhaseTracker: Wt, LoadingScreenManager: Jt, LoadingScreenStateMachine: Kt, LoadingScreenTransition: Qt, resolveColorInputs: qt, resolveDefaultPalette: Zt, resolveTheme: At }, Symbol.toStringTag, { value: "Module" })), ai = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: z, TextmodeImage: K, TextmodeSource: xt, TextmodeTexture: Q, TextmodeVideo: ut }, Symbol.toStringTag, { value: "Module" })), li = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: Ve, mouse: Ge, touch: je }, Symbol.toStringTag, { value: "Module" })), ci = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: te, TextmodeLayer: ot, TextmodeLayerManager: ie }, Symbol.toStringTag, { value: "Module" })), ui = Et.create, fi = Et.setErrorLevel, di = Et.version;
|
|
4224
4224
|
export {
|
|
4225
|
-
|
|
4225
|
+
He as TextmodeCanvas,
|
|
4226
4226
|
x as TextmodeColor,
|
|
4227
|
-
|
|
4227
|
+
P as TextmodeError,
|
|
4228
4228
|
ae as TextmodeErrorLevel,
|
|
4229
4229
|
vt as TextmodeFramebuffer,
|
|
4230
4230
|
ze as TextmodeGrid,
|