textmode.js 0.2.1-beta.3 → 0.2.1-beta.4
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 +1107 -1069
- package/dist/textmode.esm.min.js +1356 -1318
- package/dist/textmode.umd.js +7 -7
- package/dist/textmode.umd.min.js +7 -7
- package/dist/types/rendering/webgl/Shader.d.ts +17 -1
- package/dist/types/textmode/mixins/AnimationMixin.d.ts +2 -0
- package/package.json +1 -1
package/dist/textmode.esm.min.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var Q = Object.defineProperty;
|
|
2
2
|
var tt = (a, t, e) => t in a ? Q(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
|
-
var
|
|
4
|
-
class
|
|
3
|
+
var c = (a, t, e) => tt(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
class E extends Error {
|
|
5
5
|
constructor(t, e = {}) {
|
|
6
|
-
super(
|
|
6
|
+
super(E.u(t, e)), this.name = "TextmodeError";
|
|
7
7
|
}
|
|
8
8
|
static u(t, e) {
|
|
9
9
|
return `${t}${e && Object.keys(e).length > 0 ? `
|
|
10
10
|
|
|
11
|
-
📋 Context:` + Object.entries(e).map(([i,
|
|
12
|
-
- ${i}: ${
|
|
11
|
+
📋 Context:` + Object.entries(e).map(([i, r]) => `
|
|
12
|
+
- ${i}: ${E._(r)}`).join("") : ""}
|
|
13
13
|
|
|
14
14
|
${"↓".repeat(24)}
|
|
15
15
|
`;
|
|
@@ -19,79 +19,79 @@ ${"↓".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) => E._(e)).join(", ")}]` : `[${t.slice(0, 3).map((e) => E._(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}: ${E._(t[i])}`).join(", ")} }` : `{ ${e.slice(0, 2).map((i) => `${i}: ${E._(t[i])}`).join(", ")}, ... +${e.length - 2} more }`;
|
|
26
26
|
}
|
|
27
27
|
return t + "";
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
var et = ((a) => (a[a.SILENT = 0] = "SILENT", a[a.WARNING = 1] = "WARNING", a[a.ERROR = 2] = "ERROR", a[a.THROW = 3] = "THROW", a))(et || {});
|
|
31
|
-
const
|
|
31
|
+
const F = class F {
|
|
32
32
|
constructor() {
|
|
33
|
-
|
|
33
|
+
c(this, "$", { globalLevel: 3 });
|
|
34
34
|
}
|
|
35
|
-
static
|
|
36
|
-
return
|
|
35
|
+
static C() {
|
|
36
|
+
return F.v || (F.v = new F()), F.v;
|
|
37
37
|
}
|
|
38
38
|
R(t, e) {
|
|
39
|
-
const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.",
|
|
40
|
-
switch (this
|
|
39
|
+
const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.", r = "color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;";
|
|
40
|
+
switch (this.$.globalLevel) {
|
|
41
41
|
case 0:
|
|
42
42
|
return !1;
|
|
43
43
|
case 1:
|
|
44
|
-
return console.group(i,
|
|
44
|
+
return console.group(i, r), console.warn(E.u(t, e)), console.groupEnd(), !1;
|
|
45
45
|
case 2:
|
|
46
|
-
return console.group(i,
|
|
46
|
+
return console.group(i, r), console.error(E.u(t, e)), console.groupEnd(), !1;
|
|
47
47
|
default:
|
|
48
|
-
throw new
|
|
48
|
+
throw new E(t, e);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
M(t, e, i) {
|
|
52
52
|
return !!t || (this.R(e, i), !1);
|
|
53
53
|
}
|
|
54
54
|
S(t) {
|
|
55
|
-
this
|
|
55
|
+
this.$.globalLevel = t;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
|
|
59
|
-
let
|
|
60
|
-
const
|
|
58
|
+
c(F, "v", null);
|
|
59
|
+
let B = F;
|
|
60
|
+
const M = B.C(), Z = /* @__PURE__ */ new WeakMap();
|
|
61
61
|
function U(a, t) {
|
|
62
|
-
|
|
62
|
+
Z.set(a, t);
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
return
|
|
64
|
+
function I(a) {
|
|
65
|
+
return Z.get(a);
|
|
66
66
|
}
|
|
67
|
-
class
|
|
67
|
+
class j {
|
|
68
68
|
constructor() {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
69
|
+
c(this, "F", 1);
|
|
70
|
+
c(this, "P", 0);
|
|
71
|
+
c(this, "A", 0);
|
|
72
|
+
c(this, "G", 0);
|
|
73
|
+
c(this, "L", [0, 0, 0]);
|
|
74
|
+
c(this, "D", [1, 1, 1, 1]);
|
|
75
|
+
c(this, "W", [0, 0, 0, 1]);
|
|
76
|
+
c(this, "I", !1);
|
|
77
|
+
c(this, "U", !1);
|
|
78
|
+
c(this, "V", !1);
|
|
79
|
+
c(this, "O", [0, 0]);
|
|
80
|
+
c(this, "H", [0, 0, 0, 1]);
|
|
81
|
+
c(this, "K", []);
|
|
82
82
|
}
|
|
83
83
|
N() {
|
|
84
|
-
this.K.push({ X: this.F, Y: this.P, Z: this.
|
|
84
|
+
this.K.push({ X: this.F, Y: this.P, Z: this.A, J: this.G, O: [...this.O], I: this.I, U: this.U, V: this.V, tt: [...this.L], et: [...this.D], st: [...this.W] });
|
|
85
85
|
}
|
|
86
86
|
it() {
|
|
87
87
|
const t = this.K.pop();
|
|
88
|
-
t ? (this.F = t.X, this.P = t.Y, this.
|
|
88
|
+
t ? (this.F = t.X, this.P = t.Y, this.A = t.Z, this.G = t.J, this.O = t.O, this.I = t.I, this.U = t.U, this.V = t.V, this.L = t.tt, this.D = t.et, this.W = t.st) : console.warn("pop() called without matching push()");
|
|
89
89
|
}
|
|
90
90
|
rt() {
|
|
91
|
-
this.K = [], this.P = 0, this.
|
|
91
|
+
this.K = [], this.P = 0, this.A = 0, this.G = 0;
|
|
92
92
|
}
|
|
93
93
|
nt(t) {
|
|
94
|
-
t.lineWeight = this.F, t.rotationX = this.P, t.rotationY = this.
|
|
94
|
+
t.lineWeight = this.F, t.rotationX = this.P, t.rotationY = this.A, t.rotationZ = this.G, t.character[0] = this.L[0], t.character[1] = this.L[1], t.character[2] = this.L[2], t.charColor[0] = this.D[0], t.charColor[1] = this.D[1], t.charColor[2] = this.D[2], t.charColor[3] = this.D[3], t.bgColor[0] = this.W[0], t.bgColor[1] = this.W[1], t.bgColor[2] = this.W[2], t.bgColor[3] = this.W[3], t.flipHorizontally = this.I, t.flipVertically = this.U, t.invert = this.V, t.charRotation[0] = this.O[0], t.charRotation[1] = this.O[1];
|
|
95
95
|
}
|
|
96
96
|
get lineWeight() {
|
|
97
97
|
return this.F;
|
|
@@ -106,19 +106,19 @@ class Z {
|
|
|
106
106
|
this.P = t;
|
|
107
107
|
}
|
|
108
108
|
ct(t) {
|
|
109
|
-
this.
|
|
109
|
+
this.A = t;
|
|
110
110
|
}
|
|
111
111
|
lt(t) {
|
|
112
|
-
this.
|
|
112
|
+
this.G = t;
|
|
113
113
|
}
|
|
114
114
|
ut(t) {
|
|
115
115
|
this.L = t;
|
|
116
116
|
}
|
|
117
|
-
ft(t, e, i,
|
|
118
|
-
this.D = [t / 255, e / 255, i / 255,
|
|
117
|
+
ft(t, e, i, r = 255) {
|
|
118
|
+
this.D = [t / 255, e / 255, i / 255, r / 255];
|
|
119
119
|
}
|
|
120
|
-
dt(t, e, i,
|
|
121
|
-
this.W = [t / 255, e / 255, i / 255,
|
|
120
|
+
dt(t, e, i, r = 255) {
|
|
121
|
+
this.W = [t / 255, e / 255, i / 255, r / 255];
|
|
122
122
|
}
|
|
123
123
|
_t(t) {
|
|
124
124
|
this.I = t;
|
|
@@ -127,51 +127,51 @@ class Z {
|
|
|
127
127
|
this.U = t;
|
|
128
128
|
}
|
|
129
129
|
vt(t) {
|
|
130
|
-
this.
|
|
130
|
+
this.V = t;
|
|
131
131
|
}
|
|
132
132
|
yt(t) {
|
|
133
|
-
const e = 255 * t / 360, i = Math.floor(e) / 255,
|
|
134
|
-
this.
|
|
133
|
+
const e = 255 * t / 360, i = Math.floor(e) / 255, r = Math.round(e - Math.floor(e));
|
|
134
|
+
this.O = [i, r];
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
this.H = [t / 255, e / 255, i / 255,
|
|
136
|
+
$t(t, e, i, r) {
|
|
137
|
+
this.H = [t / 255, e / 255, i / 255, r / 255];
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
class
|
|
141
|
-
constructor(t, e, i = e,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
this
|
|
156
|
-
const
|
|
157
|
-
this.St = Math.min(this.St,
|
|
140
|
+
class D {
|
|
141
|
+
constructor(t, e, i = e, r = 1, s = {}, n = null, o = !1) {
|
|
142
|
+
c(this, "Ct");
|
|
143
|
+
c(this, "wt");
|
|
144
|
+
c(this, "$");
|
|
145
|
+
c(this, "xt", null);
|
|
146
|
+
c(this, "bt");
|
|
147
|
+
c(this, "Rt");
|
|
148
|
+
c(this, "Mt", []);
|
|
149
|
+
c(this, "St");
|
|
150
|
+
c(this, "Ft", null);
|
|
151
|
+
c(this, "zt", []);
|
|
152
|
+
c(this, "kt", null);
|
|
153
|
+
c(this, "Pt", !1);
|
|
154
|
+
c(this, "Tt", null);
|
|
155
|
+
this.Ct = e, this.wt = i, this.$ = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", ...s }, this.bt = t, this.St = Math.min(Math.max(1, r), 8), this.kt = n, this.Pt = !!o, this.Tt = this.Pt ? new j() : null;
|
|
156
|
+
const h = t.getParameter(t.MAX_DRAW_BUFFERS), l = t.getParameter(t.MAX_COLOR_ATTACHMENTS);
|
|
157
|
+
this.St = Math.min(this.St, h, l), this.Rt = t.createFramebuffer(), this.At(), this.Gt(), this.zt = Array(this.St).fill(null);
|
|
158
158
|
}
|
|
159
|
-
|
|
160
|
-
const t = this.bt, e = this
|
|
161
|
-
for (let
|
|
159
|
+
At() {
|
|
160
|
+
const t = this.bt, e = this.$.filter === "linear" ? t.LINEAR : t.NEAREST, i = this.$.wrap === "repeat" ? t.REPEAT : t.CLAMP_TO_EDGE, r = this.$.type === "float" ? t.FLOAT : t.UNSIGNED_BYTE;
|
|
161
|
+
for (let s = 0; s < this.St; s++) {
|
|
162
162
|
const n = t.createTexture();
|
|
163
|
-
t.bindTexture(t.TEXTURE_2D, n), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, e), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, e), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, i), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, i), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, this
|
|
163
|
+
t.bindTexture(t.TEXTURE_2D, n), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, e), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, e), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, i), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, i), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, this.Ct, this.wt, 0, t.RGBA, r, null), this.Mt.push(n);
|
|
164
164
|
}
|
|
165
165
|
t.bindTexture(t.TEXTURE_2D, null);
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
Gt() {
|
|
168
168
|
const t = this.bt;
|
|
169
169
|
if (t.bindFramebuffer(t.FRAMEBUFFER, this.Rt), this.St === 1) t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, this.Mt[0], 0);
|
|
170
170
|
else {
|
|
171
171
|
const i = [];
|
|
172
|
-
for (let
|
|
173
|
-
const
|
|
174
|
-
t.framebufferTexture2D(t.FRAMEBUFFER,
|
|
172
|
+
for (let r = 0; r < this.St; r++) {
|
|
173
|
+
const s = t.COLOR_ATTACHMENT0 + r;
|
|
174
|
+
t.framebufferTexture2D(t.FRAMEBUFFER, s, t.TEXTURE_2D, this.Mt[r], 0), i.push(s);
|
|
175
175
|
}
|
|
176
176
|
t.drawBuffers(i);
|
|
177
177
|
}
|
|
@@ -183,43 +183,43 @@ class G {
|
|
|
183
183
|
e.bindTexture(e.TEXTURE_2D, this.Mt[0]), e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, 1), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, t), e.bindTexture(e.TEXTURE_2D, null);
|
|
184
184
|
}
|
|
185
185
|
resize(t, e) {
|
|
186
|
-
this
|
|
187
|
-
const i = this.bt,
|
|
188
|
-
for (const
|
|
186
|
+
this.Ct = t, this.wt = e, this.xt = null, this.zt = Array(this.St).fill(null);
|
|
187
|
+
const i = this.bt, r = this.$.type === "float" ? i.FLOAT : i.UNSIGNED_BYTE;
|
|
188
|
+
for (const s of this.Mt) i.bindTexture(i.TEXTURE_2D, s), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, this.Ct, this.wt, 0, i.RGBA, r, null);
|
|
189
189
|
i.bindTexture(i.TEXTURE_2D, null);
|
|
190
190
|
}
|
|
191
191
|
Et(t) {
|
|
192
192
|
const e = this.bt, i = this.zt[t];
|
|
193
193
|
if (i) return i;
|
|
194
|
-
const
|
|
195
|
-
e.bindFramebuffer(e.READ_FRAMEBUFFER, this.Rt), e.readBuffer(e.COLOR_ATTACHMENT0 + t), e.readPixels(0, 0,
|
|
196
|
-
const
|
|
197
|
-
for (let
|
|
198
|
-
const
|
|
199
|
-
l.set(n.subarray(
|
|
194
|
+
const r = this.Ct, s = this.wt, n = new Uint8Array(r * s * 4), o = e.getParameter(e.READ_FRAMEBUFFER_BINDING);
|
|
195
|
+
e.bindFramebuffer(e.READ_FRAMEBUFFER, this.Rt), e.readBuffer(e.COLOR_ATTACHMENT0 + t), e.readPixels(0, 0, r, s, e.RGBA, e.UNSIGNED_BYTE, n), e.bindFramebuffer(e.READ_FRAMEBUFFER, o);
|
|
196
|
+
const h = 4 * r, l = new Uint8Array(n.length);
|
|
197
|
+
for (let u = 0; u < s; u++) {
|
|
198
|
+
const f = (s - 1 - u) * h, d = u * h;
|
|
199
|
+
l.set(n.subarray(f, f + h), d);
|
|
200
200
|
}
|
|
201
201
|
return this.zt[t] = l, l;
|
|
202
202
|
}
|
|
203
203
|
begin() {
|
|
204
|
-
var e, i,
|
|
204
|
+
var e, i, r, s;
|
|
205
205
|
const t = this.bt;
|
|
206
|
-
if (this.
|
|
207
|
-
const n = ((i = (e = this.
|
|
208
|
-
n && this.
|
|
206
|
+
if (this.kt) {
|
|
207
|
+
const n = ((i = (e = this.kt).Bt) == null ? void 0 : i.call(e)) ?? null;
|
|
208
|
+
n && this.kt.Dt(n), this.Pt && this.Tt && ((s = (r = this.kt).Wt) == null || s.call(r, this.Tt));
|
|
209
209
|
}
|
|
210
210
|
this.Ft = { framebuffer: t.getParameter(t.FRAMEBUFFER_BINDING), viewport: t.getParameter(t.VIEWPORT) }, t.bindFramebuffer(t.FRAMEBUFFER, this.Rt), this.zt = Array(this.St).fill(null);
|
|
211
211
|
for (let n = 0; n < this.St; n++) t.clearBufferfv(t.COLOR, n, new Float32Array([0, 0, 0, 0]));
|
|
212
|
-
t.viewport(0, 0, this
|
|
212
|
+
t.viewport(0, 0, this.Ct, this.wt), U(t, [0, 0, this.Ct, this.wt]);
|
|
213
213
|
}
|
|
214
214
|
end() {
|
|
215
|
-
var e, i,
|
|
215
|
+
var e, i, r, s;
|
|
216
216
|
if (!this.Ft) return;
|
|
217
217
|
const t = this.bt;
|
|
218
|
-
if (this.
|
|
219
|
-
const n = ((i = (e = this.
|
|
220
|
-
n && this.
|
|
218
|
+
if (this.kt) {
|
|
219
|
+
const n = ((i = (e = this.kt).Bt) == null ? void 0 : i.call(e)) ?? null;
|
|
220
|
+
n && this.kt.Dt(n);
|
|
221
221
|
}
|
|
222
|
-
t.bindFramebuffer(t.FRAMEBUFFER, this.Ft.framebuffer), t.viewport(...this.Ft.viewport), U(t, this.Ft.viewport), this.Ft = null, this.
|
|
222
|
+
t.bindFramebuffer(t.FRAMEBUFFER, this.Ft.framebuffer), t.viewport(...this.Ft.viewport), U(t, this.Ft.viewport), this.Ft = null, this.kt && this.Pt && this.Tt && ((s = (r = this.kt).It) == null || s.call(r));
|
|
223
223
|
}
|
|
224
224
|
Ut() {
|
|
225
225
|
const t = this.bt;
|
|
@@ -227,7 +227,7 @@ class G {
|
|
|
227
227
|
for (const e of this.Mt) t.deleteTexture(e);
|
|
228
228
|
}
|
|
229
229
|
get width() {
|
|
230
|
-
return this
|
|
230
|
+
return this.Ct;
|
|
231
231
|
}
|
|
232
232
|
get height() {
|
|
233
233
|
return this.wt;
|
|
@@ -236,246 +236,278 @@ class G {
|
|
|
236
236
|
return [...this.Mt];
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function Y(a) {
|
|
240
240
|
return typeof a == "string" ? a : a.sourceCode;
|
|
241
241
|
}
|
|
242
|
-
class
|
|
242
|
+
class P {
|
|
243
243
|
constructor(t, e, i) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
this
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
244
|
+
c(this, "bt");
|
|
245
|
+
c(this, "Vt");
|
|
246
|
+
c(this, "Ot", /* @__PURE__ */ new Map());
|
|
247
|
+
c(this, "Ht", /* @__PURE__ */ new Map());
|
|
248
|
+
c(this, "Kt", 0);
|
|
249
|
+
this.bt = t, this.Vt = this.Nt(Y(e), Y(i)), this.Xt();
|
|
250
|
+
}
|
|
251
|
+
Xt() {
|
|
252
|
+
const t = this.bt.getProgramParameter(this.Vt, this.bt.ACTIVE_UNIFORMS);
|
|
252
253
|
for (let e = 0; e < t; e++) {
|
|
253
|
-
const i = this.bt.getActiveUniform(this.
|
|
254
|
+
const i = this.bt.getActiveUniform(this.Vt, e);
|
|
254
255
|
if (i) {
|
|
255
|
-
const
|
|
256
|
-
|
|
256
|
+
const r = this.bt.getUniformLocation(this.Vt, i.name);
|
|
257
|
+
if (r && (this.Ot.set(i.name, r), this.Ht.set(i.name, { type: i.type, size: i.size }), i.size > 1)) {
|
|
258
|
+
const s = i.name.replace(/\[.*\]$/, "");
|
|
259
|
+
this.Ot.has(s) || (this.Ot.set(s, r), this.Ht.set(s, { type: i.type, size: i.size }));
|
|
260
|
+
}
|
|
257
261
|
}
|
|
258
262
|
}
|
|
259
263
|
}
|
|
260
|
-
|
|
261
|
-
const i = this.
|
|
262
|
-
if (this.bt.attachShader(
|
|
263
|
-
const n = this.bt.getProgramInfoLog(
|
|
264
|
+
Nt(t, e) {
|
|
265
|
+
const i = this.jt(this.bt.VERTEX_SHADER, t), r = this.jt(this.bt.FRAGMENT_SHADER, e), s = this.bt.createProgram();
|
|
266
|
+
if (this.bt.attachShader(s, i), this.bt.attachShader(s, r), this.bt.linkProgram(s), !this.bt.getProgramParameter(s, this.bt.LINK_STATUS)) {
|
|
267
|
+
const n = this.bt.getProgramInfoLog(s);
|
|
264
268
|
throw Error("Shader program link error: " + n);
|
|
265
269
|
}
|
|
266
|
-
return this.bt.deleteShader(i), this.bt.deleteShader(
|
|
270
|
+
return this.bt.deleteShader(i), this.bt.deleteShader(r), s;
|
|
267
271
|
}
|
|
268
|
-
|
|
272
|
+
jt(t, e) {
|
|
269
273
|
const i = this.bt.createShader(t);
|
|
270
274
|
if (this.bt.shaderSource(i, e), this.bt.compileShader(i), !this.bt.getShaderParameter(i, this.bt.COMPILE_STATUS)) {
|
|
271
|
-
const
|
|
272
|
-
throw this.bt.deleteShader(i), Error("Shader compilation error: " +
|
|
275
|
+
const r = this.bt.getShaderInfoLog(i);
|
|
276
|
+
throw this.bt.deleteShader(i), Error("Shader compilation error: " + r);
|
|
273
277
|
}
|
|
274
278
|
return i;
|
|
275
279
|
}
|
|
276
|
-
jt() {
|
|
277
|
-
this.bt.useProgram(this.Ot), this.Yt();
|
|
278
|
-
}
|
|
279
280
|
Yt() {
|
|
280
|
-
this.
|
|
281
|
+
this.bt.useProgram(this.Vt), this.qt();
|
|
281
282
|
}
|
|
282
|
-
qt(
|
|
283
|
-
|
|
283
|
+
qt() {
|
|
284
|
+
this.Kt = 0;
|
|
284
285
|
}
|
|
285
|
-
|
|
286
|
-
|
|
286
|
+
Zt(t) {
|
|
287
|
+
for (const [e, i] of Object.entries(t)) this.Jt(e, i);
|
|
287
288
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
289
|
+
Qt(t) {
|
|
290
|
+
return this.Ot.has(t);
|
|
291
|
+
}
|
|
292
|
+
te(t) {
|
|
293
|
+
return this.Ht.get(t) || null;
|
|
294
|
+
}
|
|
295
|
+
ee() {
|
|
296
|
+
const t = [];
|
|
297
|
+
for (const [e, i] of this.Ht.entries()) t.push({ name: e, ...i });
|
|
298
|
+
return t;
|
|
299
|
+
}
|
|
300
|
+
Jt(t, e) {
|
|
301
|
+
var h;
|
|
302
|
+
const i = this.Ot.get(t);
|
|
303
|
+
if (!i) return;
|
|
304
|
+
const r = this.Ht.get(t);
|
|
305
|
+
if (!r) return void console.warn(`No type information found for uniform '${t}'`);
|
|
306
|
+
const { type: s, size: n } = r, o = this.bt;
|
|
307
|
+
if (typeof e == "number") switch (s) {
|
|
308
|
+
case o.INT:
|
|
309
|
+
case o.BOOL:
|
|
310
|
+
o.uniform1i(i, e);
|
|
311
|
+
break;
|
|
312
|
+
case o.FLOAT:
|
|
313
|
+
o.uniform1f(i, e);
|
|
314
|
+
break;
|
|
315
|
+
default:
|
|
316
|
+
console.warn(`Unexpected uniform type for scalar '${t}': ${s}`), o.uniform1f(i, e);
|
|
317
|
+
}
|
|
318
|
+
else if (typeof e == "boolean") o.uniform1i(i, e ? 1 : 0);
|
|
293
319
|
else if (Array.isArray(e)) if (Array.isArray(e[0])) {
|
|
294
|
-
const
|
|
295
|
-
switch (
|
|
296
|
-
case
|
|
297
|
-
|
|
320
|
+
const l = e, u = ((h = l[0]) == null ? void 0 : h.length) || 0, f = l.flat();
|
|
321
|
+
switch (s) {
|
|
322
|
+
case o.FLOAT_VEC2:
|
|
323
|
+
u === 2 ? o.uniform2fv(i, f) : console.warn(`Vector length mismatch for '${t}': expected 2, got ${u}`);
|
|
298
324
|
break;
|
|
299
|
-
case
|
|
300
|
-
|
|
325
|
+
case o.FLOAT_VEC3:
|
|
326
|
+
u === 3 ? o.uniform3fv(i, f) : console.warn(`Vector length mismatch for '${t}': expected 3, got ${u}`);
|
|
301
327
|
break;
|
|
302
|
-
case
|
|
303
|
-
|
|
328
|
+
case o.FLOAT_VEC4:
|
|
329
|
+
u === 4 ? o.uniform4fv(i, f) : console.warn(`Vector length mismatch for '${t}': expected 4, got ${u}`);
|
|
304
330
|
break;
|
|
305
331
|
default:
|
|
306
|
-
|
|
332
|
+
console.warn(`Unsupported uniform type for vector array '${t}': ${s}`);
|
|
307
333
|
}
|
|
308
|
-
} else switch (
|
|
309
|
-
case
|
|
310
|
-
|
|
334
|
+
} else switch (s) {
|
|
335
|
+
case o.FLOAT_VEC2:
|
|
336
|
+
e.length === 2 ? o.uniform2f(i, e[0], e[1]) : console.warn(`Vector length mismatch for '${t}': expected 2, got ${e.length}`);
|
|
337
|
+
break;
|
|
338
|
+
case o.FLOAT_VEC3:
|
|
339
|
+
e.length === 3 ? o.uniform3f(i, e[0], e[1], e[2]) : console.warn(`Vector length mismatch for '${t}': expected 3, got ${e.length}`);
|
|
311
340
|
break;
|
|
312
|
-
case
|
|
313
|
-
|
|
341
|
+
case o.FLOAT_VEC4:
|
|
342
|
+
e.length === 4 ? o.uniform4f(i, e[0], e[1], e[2], e[3]) : console.warn(`Vector length mismatch for '${t}': expected 4, got ${e.length}`);
|
|
314
343
|
break;
|
|
315
|
-
case
|
|
316
|
-
|
|
344
|
+
case o.INT:
|
|
345
|
+
n > 1 ? o.uniform1iv(i, e) : console.warn(`Array provided for scalar uniform '${t}'`);
|
|
346
|
+
break;
|
|
347
|
+
case o.FLOAT:
|
|
348
|
+
n > 1 ? o.uniform1fv(i, e) : console.warn(`Array provided for scalar uniform '${t}'`);
|
|
317
349
|
break;
|
|
318
350
|
default:
|
|
319
|
-
|
|
351
|
+
console.warn(`Unsupported uniform type for array '${t}': ${s}`);
|
|
320
352
|
}
|
|
321
353
|
else if (e instanceof WebGLTexture) {
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
} else if (e instanceof
|
|
325
|
-
const
|
|
326
|
-
|
|
354
|
+
const l = this.se();
|
|
355
|
+
o.uniform1i(i, l), o.activeTexture(o.TEXTURE0 + l), o.bindTexture(o.TEXTURE_2D, e);
|
|
356
|
+
} else if (e instanceof D) {
|
|
357
|
+
const l = this.se();
|
|
358
|
+
o.uniform1i(i, l), o.activeTexture(o.TEXTURE0 + l), o.bindTexture(o.TEXTURE_2D, e.textures[0]);
|
|
327
359
|
} else console.warn(`Unsupported uniform type for '${t}':`, typeof e);
|
|
328
360
|
}
|
|
329
|
-
|
|
330
|
-
return this.
|
|
361
|
+
se() {
|
|
362
|
+
return this.Kt++;
|
|
331
363
|
}
|
|
332
|
-
get
|
|
333
|
-
return this.
|
|
364
|
+
get ie() {
|
|
365
|
+
return this.Vt;
|
|
334
366
|
}
|
|
335
367
|
Ut() {
|
|
336
|
-
this.bt.deleteProgram(this.
|
|
368
|
+
this.bt.deleteProgram(this.Vt);
|
|
337
369
|
}
|
|
338
370
|
}
|
|
339
|
-
const
|
|
371
|
+
const W = `#version 300 es
|
|
340
372
|
in vec2 a_position;in vec2 a_texCoord;in vec2 a_instancePosition;in vec2 a_instanceSize;in vec3 a_instanceCharacter;in vec4 a_instancePrimaryColor;in vec4 a_instanceSecondaryColor;in vec2 a_instanceRotation;in vec3 a_instanceTransform;in vec3 a_instanceGlobalRotation;in vec2 a_instanceRotationCenter;in vec2 a_instanceBezierCP1;in vec2 a_instanceBezierCP2;in vec2 a_instanceBezierStart;in vec2 a_instanceBezierEnd;in vec2 a_instanceArcAngles;uniform float k;uniform vec2 t;out vec2 v_uv;out vec3 v_character;out vec4 v_primaryColor;out vec4 v_secondaryColor;out vec2 v_rotation;out vec3 v_transform;mat3 A(float B){float C=sin(B),D=cos(B);return mat3(1,0,0,0,D,-C,0,C,D);}mat3 E(float B){float C=sin(B),D=cos(B);return mat3(D,0,C,0,1,0,-C,0,D);}mat3 F(float B){float C=sin(B),D=cos(B);return mat3(D,-C,0,C,D,0,0,0,1);}vec2 G(float t,vec2 H,vec2 I,vec2 J,vec2 K){float L=1.-t,M=L*L,N=t*t;return M*L*H+3.*M*t*I+3.*L*N*J+N*t*K;}vec2 O(float t,vec2 H,vec2 I,vec2 J,vec2 K){float L=1.-t,M=L*L,N=t*t;return-3.*M*H+3.*M*I-6.*L*t*I+6.*L*t*J-3.*N*J+3.*N*K;}void main(){v_uv=a_texCoord;v_character=a_instanceCharacter;v_primaryColor=a_instancePrimaryColor;v_secondaryColor=a_instanceSecondaryColor;v_rotation=a_instanceRotation;v_transform=a_instanceTransform;vec2 P;bool Q=length(a_instanceBezierCP1)+length(a_instanceBezierCP2)+length(a_instanceBezierStart)+length(a_instanceBezierEnd)>0.;bool R=a_instanceArcAngles.x!=0.||a_instanceArcAngles.y!=0.;if(Q){float t=a_position.x;vec2 S=G(t,a_instanceBezierStart,a_instanceBezierCP1,a_instanceBezierCP2,a_instanceBezierEnd);vec2 T=O(t,a_instanceBezierStart,a_instanceBezierCP1,a_instanceBezierCP2,a_instanceBezierEnd);float U=length(T);T=U>0.?T/U:vec2(1,0);P=S+vec2(-T.y,T.x)*a_position.y*a_instanceSize.y;}else if(R){float C=a_instanceArcAngles.x,V=a_instanceArcAngles.y;C=mod(C,6.28318530718);if(C<0.)C+=6.28318530718;V=mod(V,6.28318530718);if(V<0.)V+=6.28318530718;float W=C-V;if(W<=0.)W+=6.28318530718;float X=C-a_position.x*W;vec2 Y=vec2(cos(X),sin(X))*a_position.y;P=Y*a_instanceSize*.5+a_instanceSize*.5+a_instancePosition;}else{P=a_position*a_instanceSize+a_instancePosition;}vec2 Z=(P/t)*2.-1.;Z.y=-Z.y;if(length(a_instanceGlobalRotation)>0.){vec3 a=vec3(Z-a_instanceRotationCenter,0);a.x*=k;if(a_instanceGlobalRotation.x!=0.)a=A(-a_instanceGlobalRotation.x)*a;if(a_instanceGlobalRotation.y!=0.)a=E(-a_instanceGlobalRotation.y)*a;if(a_instanceGlobalRotation.z!=0.)a=F(-a_instanceGlobalRotation.z)*a;a.x/=k;Z=a.xy+a_instanceRotationCenter;}gl_Position=vec4(Z,0,1);}`;
|
|
341
373
|
class it {
|
|
342
374
|
constructor(t) {
|
|
343
|
-
|
|
344
|
-
|
|
375
|
+
c(this, "re", /* @__PURE__ */ new Map());
|
|
376
|
+
c(this, "bt");
|
|
345
377
|
this.bt = t;
|
|
346
378
|
}
|
|
347
|
-
|
|
348
|
-
if (!this.
|
|
379
|
+
ne(t, e) {
|
|
380
|
+
if (!this.re.has(t)) {
|
|
349
381
|
const i = e();
|
|
350
|
-
this.
|
|
382
|
+
this.re.set(t, i);
|
|
351
383
|
}
|
|
352
|
-
return this.
|
|
384
|
+
return this.re.get(t);
|
|
353
385
|
}
|
|
354
|
-
|
|
355
|
-
return this.
|
|
386
|
+
oe() {
|
|
387
|
+
return this.ne("mrt-copy", () => new P(this.bt, W, `#version 300 es
|
|
356
388
|
precision highp float;in vec2 v_uv;uniform sampler2D l;uniform sampler2D m;uniform sampler2D n;uniform sampler2D o;uniform sampler2D p;uniform vec2 q;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 o_rotation;layout(location=4)out vec4 o_transform;void main(){vec2 A=vec2(v_uv.x,1.-v_uv.y);vec2 B=A*q;vec2 C=(floor(B)+0.5f)/q;vec4 D=texture(l,C);vec4 E=texture(m,C);if(E.a==0.){discard;}vec4 F=texture(n,C);vec4 G=texture(o,C);vec4 H=texture(p,C);o_character=D;o_primaryColor=E;o_secondaryColor=F;o_rotation=G;o_transform=H;}`));
|
|
357
389
|
}
|
|
358
390
|
Bt() {
|
|
359
|
-
return this.
|
|
391
|
+
return this.ne("mrt-draw", () => new P(this.bt, W, `#version 300 es
|
|
360
392
|
precision highp float;in vec2 v_uv;in vec3 v_character;in vec4 v_primaryColor;in vec4 v_secondaryColor;in vec2 v_rotation;in vec3 v_transform;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 o_rotation;layout(location=4)out vec4 o_transform;void main(){o_character=vec4(v_character,1.);o_primaryColor=v_primaryColor;o_secondaryColor=v_secondaryColor;o_rotation=vec4(v_rotation,0.,1.);o_transform=vec4(v_transform,1.);}`));
|
|
361
393
|
}
|
|
362
|
-
|
|
363
|
-
return this.
|
|
394
|
+
ae() {
|
|
395
|
+
return this.ne("ascii-conversion", () => new P(this.bt, "attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_uv;void main(){v_uv=a_texCoord;gl_Position=vec4(a_position,0.,1.);}", "precision mediump float;uniform sampler2D a;uniform vec2 b;uniform sampler2D d;uniform sampler2D e;uniform sampler2D f;uniform sampler2D c;uniform sampler2D g;uniform vec2 h;uniform vec2 i;uniform vec2 j;mat2 A(float B){float C=sin(B);float c=cos(B);return mat2(c,-C,C,c);}void main(){vec2 D=(gl_FragCoord.xy-j)/i;vec2 E=D*h;vec2 F=floor(E);vec2 G=(F+0.5)/h;vec4 H=texture2D(d,G);vec4 I=texture2D(e,G);vec4 J=texture2D(f,G);bool K=J.r>0.5;bool L=J.g>0.5;bool M=J.b>0.5;vec4 N=texture2D(c,G);int O=int(N.r*255.+0.5)+int(N.g*255.+0.5)*256;int P=int(mod(float(O),b.x));int Q=O/int(b.x);float R=(b.y-1.)-float(Q);vec2 S=vec2(float(P),R)/b;vec4 T=texture2D(g,G);float U=T.r*255.+T.g;float V=-(U*360./255.)*0.017453292;vec2 W=fract(E)-0.5;if(L)W.x=-W.x;if(M)W.y=-W.y;W=A(V)*W+0.5;vec2 X=1./b;vec2 Y=S+W*X;vec2 Z=S+X;if(any(lessThan(Y,S))||any(greaterThan(Y,Z))){gl_FragColor=K?H:I;return;}vec4 a=texture2D(a,Y);if(K)a.rgb=1.-a.rgb;gl_FragColor=mix(I,H,a);}"));
|
|
364
396
|
}
|
|
365
|
-
|
|
366
|
-
return new
|
|
397
|
+
he(t) {
|
|
398
|
+
return new P(this.bt, W, t);
|
|
367
399
|
}
|
|
368
|
-
|
|
369
|
-
return new
|
|
400
|
+
ce(t, e) {
|
|
401
|
+
return new P(this.bt, t, e);
|
|
370
402
|
}
|
|
371
403
|
Ut() {
|
|
372
|
-
for (const t of this.
|
|
373
|
-
this.
|
|
404
|
+
for (const t of this.re.values()) t.Ut();
|
|
405
|
+
this.re.clear();
|
|
374
406
|
}
|
|
375
407
|
}
|
|
376
408
|
var b = ((a) => (a.RECTANGLE = "rectangle", a.LINE = "line", a.ELLIPSE = "ellipse", a.ARC = "arc", a.TRIANGLE = "triangle", a.BEZIER_CURVE = "bezier_curve", a.CUSTOM = "custom", a))(b || {});
|
|
377
|
-
class
|
|
409
|
+
class rt {
|
|
378
410
|
constructor(t) {
|
|
379
|
-
|
|
380
|
-
|
|
411
|
+
c(this, "bt");
|
|
412
|
+
c(this, "le", /* @__PURE__ */ new Map());
|
|
381
413
|
this.bt = t;
|
|
382
414
|
}
|
|
383
|
-
|
|
384
|
-
const
|
|
385
|
-
let n = this.
|
|
386
|
-
n || (n = /* @__PURE__ */ new Map(), this.
|
|
415
|
+
ue(t, e, i, r) {
|
|
416
|
+
const s = this.bt;
|
|
417
|
+
let n = this.le.get(t);
|
|
418
|
+
n || (n = /* @__PURE__ */ new Map(), this.le.set(t, n));
|
|
387
419
|
let o = n.get(e) || null;
|
|
388
420
|
if (!o) {
|
|
389
|
-
o =
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
const l =
|
|
393
|
-
l !== -1 && (
|
|
421
|
+
o = s.createVertexArray(), n.set(e, o), s.bindVertexArray(o), s.bindBuffer(s.ARRAY_BUFFER, r);
|
|
422
|
+
const h = s.getAttribLocation(t, "a_position");
|
|
423
|
+
h !== -1 && (s.enableVertexAttribArray(h), s.vertexAttribPointer(h, i.de.fe.size, s.FLOAT, !1, i._e, i.de.fe.offset), s.vertexAttribDivisor(h, 0));
|
|
424
|
+
const l = s.getAttribLocation(t, "a_texCoord");
|
|
425
|
+
l !== -1 && (s.enableVertexAttribArray(l), s.vertexAttribPointer(l, i.de.pe.size, s.FLOAT, !1, i._e, i.de.pe.offset), s.vertexAttribDivisor(l, 0));
|
|
394
426
|
}
|
|
395
|
-
|
|
427
|
+
s.bindVertexArray(o);
|
|
396
428
|
}
|
|
397
|
-
|
|
429
|
+
ge() {
|
|
398
430
|
this.bt.bindVertexArray(null);
|
|
399
431
|
}
|
|
400
432
|
Ut() {
|
|
401
433
|
const t = this.bt;
|
|
402
|
-
for (const [, e] of this.
|
|
403
|
-
this.
|
|
434
|
+
for (const [, e] of this.le) for (const [, i] of e) i && t.deleteVertexArray(i);
|
|
435
|
+
this.le.clear();
|
|
404
436
|
}
|
|
405
437
|
}
|
|
406
|
-
class
|
|
438
|
+
class st {
|
|
407
439
|
constructor(t, e) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
this.bt = t, this.
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
const { shader:
|
|
417
|
-
|
|
440
|
+
c(this, "me");
|
|
441
|
+
c(this, "bt");
|
|
442
|
+
c(this, "kt");
|
|
443
|
+
c(this, "ve", null);
|
|
444
|
+
c(this, "ye", null);
|
|
445
|
+
this.bt = t, this.me = new rt(t), this.kt = e;
|
|
446
|
+
}
|
|
447
|
+
$e(t, e, i) {
|
|
448
|
+
const { shader: r } = t, s = I(this.bt) || this.bt.getParameter(this.bt.VIEWPORT);
|
|
449
|
+
r.Zt({ k: s[2] / s[3], t: [s[2], s[3]] });
|
|
418
450
|
const n = (l) => {
|
|
419
|
-
if (!l || !l.
|
|
420
|
-
const
|
|
451
|
+
if (!l || !l.Ce()) return;
|
|
452
|
+
const u = l.unitGeometry, f = l.unitBuffer;
|
|
421
453
|
try {
|
|
422
|
-
this.
|
|
454
|
+
this.me.ue(r.ie, l.type + "", u, f), l.batch.we(r), l.batch.xe(u.be, u.Re);
|
|
423
455
|
} finally {
|
|
424
|
-
l.batch.
|
|
456
|
+
l.batch.Me(r), this.me.ge(), l.Se();
|
|
425
457
|
}
|
|
426
458
|
};
|
|
427
|
-
let o = null,
|
|
459
|
+
let o = null, h = null;
|
|
428
460
|
for (const l of e) {
|
|
429
461
|
if (l.type === b.CUSTOM) {
|
|
430
|
-
|
|
462
|
+
h && (n(h), o = null, h = null), this.Fe(t, l.params, l.state, i.get(b.RECTANGLE));
|
|
431
463
|
continue;
|
|
432
464
|
}
|
|
433
|
-
o !== null && l.type !== o && (n(
|
|
434
|
-
let
|
|
435
|
-
|
|
465
|
+
o !== null && l.type !== o && (n(h), o = null, h = null);
|
|
466
|
+
let u = h;
|
|
467
|
+
u && l.type === o || (u = i.get(l.type) || null, h = u, o = l.type), u && u.ze(l.params, l.state);
|
|
436
468
|
}
|
|
437
|
-
n(
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
const { x:
|
|
441
|
-
if (l === this.
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
const d = this.
|
|
445
|
-
this.
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
e.
|
|
469
|
+
n(h);
|
|
470
|
+
}
|
|
471
|
+
Fe(t, e, i, r) {
|
|
472
|
+
const { x: s, y: n, width: o, height: h, shader: l, uniforms: u } = e;
|
|
473
|
+
if (l === this.ke()) return this.Pe(r, l, u, Math.floor(s), Math.floor(n), Math.max(1, Math.floor(o)), Math.max(1, Math.floor(h)), i), void t.shader.Yt();
|
|
474
|
+
const f = this.Te(Math.max(1, Math.floor(o)), Math.max(1, Math.floor(h)));
|
|
475
|
+
f.begin(), this.Pe(r, l, u, 0, 0, f.width, f.height, {}), f.end();
|
|
476
|
+
const d = this.ke(), p = { l: f.textures[0], m: f.textures[1], n: f.textures[2], o: f.textures[3], p: f.textures[4], q: [f.width, f.height] };
|
|
477
|
+
this.Pe(r, d, p, Math.floor(s), Math.floor(n), Math.max(1, Math.floor(o)), Math.max(1, Math.floor(h)), i), t.shader.Yt();
|
|
478
|
+
}
|
|
479
|
+
Pe(t, e, i, r, s, n, o, h) {
|
|
480
|
+
e.Yt(), e.Zt(i);
|
|
449
481
|
const l = this.bt.getParameter(this.bt.VIEWPORT);
|
|
450
|
-
if (e.
|
|
451
|
-
const
|
|
482
|
+
if (e.Zt({ k: l[2] / l[3], t: [l[2], l[3]] }), t.Se(), t.ze({ x: r, y: s, width: n, height: o }, h), t.Ce()) {
|
|
483
|
+
const u = t.unitGeometry, f = t.unitBuffer;
|
|
452
484
|
try {
|
|
453
|
-
this.
|
|
485
|
+
this.me.ue(e.ie, t.type + "", u, f), t.batch.we(e), t.batch.xe(u.be, u.Re);
|
|
454
486
|
} finally {
|
|
455
|
-
t.batch.
|
|
487
|
+
t.batch.Me(e), this.me.ge(), t.Se();
|
|
456
488
|
}
|
|
457
489
|
}
|
|
458
490
|
}
|
|
459
|
-
|
|
460
|
-
return this.
|
|
491
|
+
ke() {
|
|
492
|
+
return this.kt.oe();
|
|
461
493
|
}
|
|
462
|
-
|
|
463
|
-
return this.
|
|
494
|
+
Te(t, e) {
|
|
495
|
+
return this.ve && this.ye && this.ye.w === t && this.ye.h === e || (this.ve && this.ve.Ut(), this.ve = new D(this.bt, t, e, 5), this.ye = { w: t, h: e }), this.ve;
|
|
464
496
|
}
|
|
465
497
|
}
|
|
466
498
|
class nt {
|
|
467
499
|
constructor() {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
if (this.
|
|
474
|
-
const i = { id: this.
|
|
475
|
-
this.
|
|
500
|
+
c(this, "Ae", []);
|
|
501
|
+
c(this, "Ge", 1);
|
|
502
|
+
c(this, "Le", 0);
|
|
503
|
+
}
|
|
504
|
+
Ee(t) {
|
|
505
|
+
if (this.Le >= this.Ae.length) {
|
|
506
|
+
const i = { id: this.Ge++, type: t, params: {}, state: { X: 1, Y: 0, Z: 0, J: 0, character: [0, 0, 0], charColor: [1, 1, 1, 1], bgColor: [0, 0, 0, 1], flipHorizontally: !1, flipVertically: !1, invert: !1, charRotation: [0, 0] } };
|
|
507
|
+
this.Ae.push(i);
|
|
476
508
|
}
|
|
477
|
-
const e = this.
|
|
478
|
-
switch (e.id = this.
|
|
509
|
+
const e = this.Ae[this.Le];
|
|
510
|
+
switch (e.id = this.Ge++, e.type = t, t) {
|
|
479
511
|
case b.RECTANGLE:
|
|
480
512
|
case b.ELLIPSE:
|
|
481
513
|
e.params && "width" in e.params || (e.params = { x: 0, y: 0, width: 0, height: 0 });
|
|
@@ -498,510 +530,510 @@ class nt {
|
|
|
498
530
|
default:
|
|
499
531
|
e.params || (e.params = {});
|
|
500
532
|
}
|
|
501
|
-
return this.
|
|
533
|
+
return this.Le++, e;
|
|
502
534
|
}
|
|
503
|
-
|
|
504
|
-
const n = this.
|
|
505
|
-
return n.params.x = t, n.params.y = e, n.params.width = i, n.params.height =
|
|
535
|
+
Be(t, e, i, r, s) {
|
|
536
|
+
const n = this.Ee(b.RECTANGLE);
|
|
537
|
+
return n.params.x = t, n.params.y = e, n.params.width = i, n.params.height = r, s.nt(n.state), n.id;
|
|
506
538
|
}
|
|
507
|
-
|
|
508
|
-
const
|
|
509
|
-
return
|
|
539
|
+
De(t, e, i, r, s, n, o) {
|
|
540
|
+
const h = this.Ee(b.CUSTOM);
|
|
541
|
+
return h.params.x = t, h.params.y = e, h.params.width = i, h.params.height = r, h.params.shader = s, h.params.uniforms = n, o.nt(h.state), h.id;
|
|
510
542
|
}
|
|
511
|
-
|
|
512
|
-
const o = this.
|
|
513
|
-
return o.params.x1 = t, o.params.y1 = e, o.params.x2 = i, o.params.y2 =
|
|
543
|
+
We(t, e, i, r, s, n) {
|
|
544
|
+
const o = this.Ee(b.LINE);
|
|
545
|
+
return o.params.x1 = t, o.params.y1 = e, o.params.x2 = i, o.params.y2 = r, o.params.thickness = s, n.nt(o.state), o.id;
|
|
514
546
|
}
|
|
515
|
-
|
|
516
|
-
const n = this.
|
|
517
|
-
return n.params.x = t, n.params.y = e, n.params.width = i, n.params.height =
|
|
547
|
+
Ie(t, e, i, r, s) {
|
|
548
|
+
const n = this.Ee(b.ELLIPSE);
|
|
549
|
+
return n.params.x = t, n.params.y = e, n.params.width = i, n.params.height = r, s.nt(n.state), n.id;
|
|
518
550
|
}
|
|
519
|
-
|
|
520
|
-
const
|
|
521
|
-
return
|
|
551
|
+
Ue(t, e, i, r, s, n, o) {
|
|
552
|
+
const h = this.Ee(b.ARC);
|
|
553
|
+
return h.params.x = t, h.params.y = e, h.params.width = i, h.params.height = r, h.params.start = s, h.params.stop = n, o.nt(h.state), h.id;
|
|
522
554
|
}
|
|
523
|
-
|
|
524
|
-
const
|
|
525
|
-
return
|
|
555
|
+
Ve(t, e, i, r, s, n, o) {
|
|
556
|
+
const h = this.Ee(b.TRIANGLE);
|
|
557
|
+
return h.params.x1 = t, h.params.y1 = e, h.params.x2 = i, h.params.y2 = r, h.params.x3 = s, h.params.y3 = n, o.nt(h.state), h.id;
|
|
526
558
|
}
|
|
527
|
-
|
|
528
|
-
const
|
|
529
|
-
return
|
|
559
|
+
Oe(t, e, i, r, s, n, o, h, l, u) {
|
|
560
|
+
const f = this.Ee(b.BEZIER_CURVE);
|
|
561
|
+
return f.params.x1 = t, f.params.y1 = e, f.params.cp1x = i, f.params.cp1y = r, f.params.cp2x = s, f.params.cp2y = n, f.params.x2 = o, f.params.y2 = h, f.params.thickness = l, u.nt(f.state), f.id;
|
|
530
562
|
}
|
|
531
563
|
get length() {
|
|
532
|
-
return this.
|
|
564
|
+
return this.Le;
|
|
533
565
|
}
|
|
534
566
|
get isEmpty() {
|
|
535
|
-
return this.
|
|
567
|
+
return this.Le === 0;
|
|
536
568
|
}
|
|
537
|
-
|
|
538
|
-
this.
|
|
569
|
+
He() {
|
|
570
|
+
this.Le = 0;
|
|
539
571
|
}
|
|
540
572
|
[Symbol.iterator]() {
|
|
541
573
|
let t = 0;
|
|
542
|
-
const e = this.
|
|
574
|
+
const e = this.Le, i = this.Ae;
|
|
543
575
|
return { next: () => t < e ? { value: i[t++], done: !1 } : { value: void 0, done: !0 } };
|
|
544
576
|
}
|
|
545
577
|
}
|
|
546
578
|
const T = class T {
|
|
547
|
-
static
|
|
548
|
-
var n, o,
|
|
549
|
-
const
|
|
550
|
-
let
|
|
551
|
-
return s
|
|
579
|
+
static Ke(t, e, i = 0) {
|
|
580
|
+
var n, o, h, l, u, f, d, p, g, m;
|
|
581
|
+
const r = e || new Float32Array(T.FLOATS_PER_INSTANCE);
|
|
582
|
+
let s = i;
|
|
583
|
+
return r[s++] = t.position[0], r[s++] = t.position[1], r[s++] = t.size[0], r[s++] = t.size[1], r[s++] = t.tt[0], r[s++] = t.tt[1], r[s++] = t.tt[2], r[s++] = t.primaryColor[0], r[s++] = t.primaryColor[1], r[s++] = t.primaryColor[2], r[s++] = t.primaryColor[3], r[s++] = t.secondaryColor[0], r[s++] = t.secondaryColor[1], r[s++] = t.secondaryColor[2], r[s++] = t.secondaryColor[3], r[s++] = t.rotation[0], r[s++] = t.rotation[1], r[s++] = t.transform[0], r[s++] = t.transform[1], r[s++] = t.transform[2], r[s++] = t.globalRotationX, r[s++] = t.globalRotationY, r[s++] = t.globalRotationZ, r[s++] = t.rotationCenter[0], r[s++] = t.rotationCenter[1], r[s++] = ((n = t.arcAngles) == null ? void 0 : n[0]) || 0, r[s++] = ((o = t.arcAngles) == null ? void 0 : o[1]) || 0, r[s++] = ((h = t.bezierControlPoint1) == null ? void 0 : h[0]) || 0, r[s++] = ((l = t.bezierControlPoint1) == null ? void 0 : l[1]) || 0, r[s++] = ((u = t.bezierControlPoint2) == null ? void 0 : u[0]) || 0, r[s++] = ((f = t.bezierControlPoint2) == null ? void 0 : f[1]) || 0, r[s++] = ((d = t.bezierStartPoint) == null ? void 0 : d[0]) || 0, r[s++] = ((p = t.bezierStartPoint) == null ? void 0 : p[1]) || 0, r[s++] = ((g = t.bezierEndPoint) == null ? void 0 : g[0]) || 0, r[s++] = ((m = t.bezierEndPoint) == null ? void 0 : m[1]) || 0, r;
|
|
552
584
|
}
|
|
553
|
-
static
|
|
585
|
+
static Ne(t) {
|
|
554
586
|
const e = t.length * T.FLOATS_PER_INSTANCE, i = new Float32Array(e);
|
|
555
|
-
for (let
|
|
556
|
-
const
|
|
557
|
-
T.
|
|
587
|
+
for (let r = 0; r < t.length; r++) {
|
|
588
|
+
const s = r * T.FLOATS_PER_INSTANCE;
|
|
589
|
+
T.Ke(t[r], i, s);
|
|
558
590
|
}
|
|
559
591
|
return i;
|
|
560
592
|
}
|
|
561
593
|
};
|
|
562
|
-
|
|
563
|
-
let
|
|
594
|
+
c(T, "BYTES_PER_INSTANCE", 140), c(T, "FLOATS_PER_INSTANCE", 35);
|
|
595
|
+
let _ = T;
|
|
564
596
|
const y = class y {
|
|
565
597
|
};
|
|
566
|
-
|
|
567
|
-
let
|
|
598
|
+
c(y, "STRIDE", _.BYTES_PER_INSTANCE), c(y, "ATTRIBUTES", { a_instancePosition: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: y.STRIDE, offset: 0, divisor: 1 }, a_instanceSize: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: y.STRIDE, offset: 8, divisor: 1 }, a_instanceCharacter: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: y.STRIDE, offset: 16, divisor: 1 }, a_instancePrimaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: y.STRIDE, offset: 28, divisor: 1 }, a_instanceSecondaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: y.STRIDE, offset: 44, divisor: 1 }, a_instanceRotation: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: y.STRIDE, offset: 60, divisor: 1 }, a_instanceTransform: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: y.STRIDE, offset: 68, divisor: 1 }, a_instanceGlobalRotation: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: y.STRIDE, offset: 80, divisor: 1 }, a_instanceRotationCenter: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: y.STRIDE, offset: 92, divisor: 1 }, a_instanceArcAngles: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: y.STRIDE, offset: 100, divisor: 1 }, a_instanceBezierCP1: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: y.STRIDE, offset: 108, divisor: 1 }, a_instanceBezierCP2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: y.STRIDE, offset: 116, divisor: 1 }, a_instanceBezierStart: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: y.STRIDE, offset: 124, divisor: 1 }, a_instanceBezierEnd: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: y.STRIDE, offset: 132, divisor: 1 } });
|
|
599
|
+
let k = y;
|
|
568
600
|
class ot {
|
|
569
601
|
constructor(t, e = 1e3, i = 1.5) {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
this.bt = t, this.
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
const e = this.
|
|
583
|
-
return this.
|
|
602
|
+
c(this, "bt");
|
|
603
|
+
c(this, "Xe", []);
|
|
604
|
+
c(this, "je");
|
|
605
|
+
c(this, "Ye");
|
|
606
|
+
c(this, "qe", null);
|
|
607
|
+
c(this, "Ze", !0);
|
|
608
|
+
c(this, "Je", 0);
|
|
609
|
+
c(this, "Qe", /* @__PURE__ */ new Map());
|
|
610
|
+
c(this, "ts", null);
|
|
611
|
+
this.bt = t, this.je = e, this.Ye = i, this.es();
|
|
612
|
+
}
|
|
613
|
+
ze(t) {
|
|
614
|
+
const e = this.Xe.length;
|
|
615
|
+
return this.Xe.push(t), this.Ze = !0, e;
|
|
584
616
|
}
|
|
585
617
|
get count() {
|
|
586
|
-
return this.
|
|
618
|
+
return this.Xe.length;
|
|
587
619
|
}
|
|
588
620
|
get isEmpty() {
|
|
589
|
-
return this.
|
|
621
|
+
return this.Xe.length === 0;
|
|
590
622
|
}
|
|
591
623
|
clear() {
|
|
592
|
-
this.
|
|
624
|
+
this.Xe.length = 0, this.Ze = !0;
|
|
593
625
|
}
|
|
594
|
-
|
|
595
|
-
if (t <= this.
|
|
596
|
-
const e = Math.ceil(t * this.
|
|
597
|
-
this.
|
|
626
|
+
ss(t) {
|
|
627
|
+
if (t <= this.je) return;
|
|
628
|
+
const e = Math.ceil(t * this.Ye);
|
|
629
|
+
this.je = e, this.es();
|
|
598
630
|
}
|
|
599
|
-
|
|
631
|
+
es() {
|
|
600
632
|
const t = this.bt;
|
|
601
|
-
this.
|
|
602
|
-
const e = this.
|
|
603
|
-
t.bindBuffer(t.ARRAY_BUFFER, this.
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
if (!this.
|
|
607
|
-
const t = this.bt, e = this.
|
|
608
|
-
this.
|
|
609
|
-
const i =
|
|
610
|
-
t.bindBuffer(t.ARRAY_BUFFER, this.
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
let e = this.
|
|
633
|
+
this.qe && t.deleteBuffer(this.qe), this.qe = t.createBuffer();
|
|
634
|
+
const e = this.je * _.BYTES_PER_INSTANCE;
|
|
635
|
+
t.bindBuffer(t.ARRAY_BUFFER, this.qe), t.bufferData(t.ARRAY_BUFFER, e, t.DYNAMIC_DRAW), t.bindBuffer(t.ARRAY_BUFFER, null), this.Ze = !0, this.Je = 0;
|
|
636
|
+
}
|
|
637
|
+
rs() {
|
|
638
|
+
if (!this.Ze || this.Xe.length === 0) return;
|
|
639
|
+
const t = this.bt, e = this.Xe.length;
|
|
640
|
+
this.ss(e), (!this.ts || this.ts.length < e * _.FLOATS_PER_INSTANCE) && (this.ts = new Float32Array(e * _.FLOATS_PER_INSTANCE));
|
|
641
|
+
const i = _.Ne(this.Xe);
|
|
642
|
+
t.bindBuffer(t.ARRAY_BUFFER, this.qe), e <= this.Je ? t.bufferSubData(t.ARRAY_BUFFER, 0, i) : t.bufferData(t.ARRAY_BUFFER, i, t.DYNAMIC_DRAW), t.bindBuffer(t.ARRAY_BUFFER, null), this.Ze = !1, this.Je = e;
|
|
643
|
+
}
|
|
644
|
+
ns(t) {
|
|
645
|
+
let e = this.Qe.get(t);
|
|
614
646
|
if (!e) {
|
|
615
647
|
e = /* @__PURE__ */ new Map();
|
|
616
648
|
const i = this.bt;
|
|
617
|
-
for (const
|
|
618
|
-
const
|
|
619
|
-
|
|
649
|
+
for (const r in k.ATTRIBUTES) {
|
|
650
|
+
const s = i.getAttribLocation(t, r);
|
|
651
|
+
s !== -1 && e.set(r, s);
|
|
620
652
|
}
|
|
621
|
-
this.
|
|
653
|
+
this.Qe.set(t, e);
|
|
622
654
|
}
|
|
623
655
|
return e;
|
|
624
656
|
}
|
|
625
|
-
|
|
626
|
-
if (!this.
|
|
627
|
-
const e = this.bt, i = t.
|
|
628
|
-
this.
|
|
629
|
-
const
|
|
630
|
-
e.bindBuffer(e.ARRAY_BUFFER, this.
|
|
631
|
-
for (const [
|
|
632
|
-
const o =
|
|
657
|
+
we(t) {
|
|
658
|
+
if (!this.qe || this.Xe.length === 0) return;
|
|
659
|
+
const e = this.bt, i = t.ie;
|
|
660
|
+
this.rs();
|
|
661
|
+
const r = this.ns(i);
|
|
662
|
+
e.bindBuffer(e.ARRAY_BUFFER, this.qe);
|
|
663
|
+
for (const [s, n] of r) {
|
|
664
|
+
const o = k.ATTRIBUTES[s];
|
|
633
665
|
o && (e.enableVertexAttribArray(n), e.vertexAttribPointer(n, o.size, o.type, o.normalized, o.stride, o.offset), e.vertexAttribDivisor(n, o.divisor));
|
|
634
666
|
}
|
|
635
667
|
}
|
|
636
|
-
|
|
637
|
-
const e = this.bt, i = this.
|
|
638
|
-
for (const [,
|
|
668
|
+
Me(t) {
|
|
669
|
+
const e = this.bt, i = this.ns(t.ie);
|
|
670
|
+
for (const [, r] of i) e.disableVertexAttribArray(r), e.vertexAttribDivisor(r, 0);
|
|
639
671
|
}
|
|
640
|
-
|
|
641
|
-
this.
|
|
672
|
+
xe(t, e) {
|
|
673
|
+
this.Xe.length !== 0 && this.bt.drawArraysInstanced(t, 0, e, this.Xe.length);
|
|
642
674
|
}
|
|
643
675
|
Ut() {
|
|
644
676
|
const t = this.bt;
|
|
645
|
-
this.
|
|
677
|
+
this.qe && (t.deleteBuffer(this.qe), this.qe = null), this.Xe.length = 0, this.Qe.clear(), this.ts = null;
|
|
646
678
|
}
|
|
647
679
|
}
|
|
648
|
-
class
|
|
649
|
-
constructor(t, e, i,
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
this.bt = t, this.
|
|
656
|
-
const
|
|
657
|
-
if (!
|
|
658
|
-
this.bt.bindBuffer(this.bt.ARRAY_BUFFER,
|
|
680
|
+
class S {
|
|
681
|
+
constructor(t, e, i, r) {
|
|
682
|
+
c(this, "bt");
|
|
683
|
+
c(this, "hs");
|
|
684
|
+
c(this, "cs");
|
|
685
|
+
c(this, "ls");
|
|
686
|
+
c(this, "us", null);
|
|
687
|
+
this.bt = t, this.hs = e, this.cs = i, this.ls = r;
|
|
688
|
+
const s = this.bt.createBuffer();
|
|
689
|
+
if (!s) throw Error("Failed to create unit geometry buffer");
|
|
690
|
+
this.bt.bindBuffer(this.bt.ARRAY_BUFFER, s), this.bt.bufferData(this.bt.ARRAY_BUFFER, this.ls.fs, this.bt.STATIC_DRAW), this.bt.bindBuffer(this.bt.ARRAY_BUFFER, null), this.us = s;
|
|
659
691
|
}
|
|
660
692
|
get type() {
|
|
661
|
-
return this.
|
|
693
|
+
return this.cs;
|
|
662
694
|
}
|
|
663
695
|
get unitGeometry() {
|
|
664
|
-
return this.
|
|
696
|
+
return this.ls;
|
|
665
697
|
}
|
|
666
698
|
get unitBuffer() {
|
|
667
|
-
return this.
|
|
699
|
+
return this.us;
|
|
668
700
|
}
|
|
669
701
|
get batch() {
|
|
670
|
-
return this.
|
|
702
|
+
return this.hs;
|
|
671
703
|
}
|
|
672
|
-
|
|
673
|
-
this.
|
|
704
|
+
Se() {
|
|
705
|
+
this.hs.clear();
|
|
674
706
|
}
|
|
675
|
-
|
|
676
|
-
return !this.
|
|
707
|
+
Ce() {
|
|
708
|
+
return !this.hs.isEmpty;
|
|
677
709
|
}
|
|
678
710
|
Ut() {
|
|
679
|
-
this.
|
|
711
|
+
this.hs.Ut(), this.us && (this.bt.deleteBuffer(this.us), this.us = null);
|
|
680
712
|
}
|
|
681
|
-
|
|
682
|
-
const n = this.
|
|
683
|
-
return { position: [t, e], size: [i,
|
|
713
|
+
ds(t, e, i, r, s) {
|
|
714
|
+
const n = this._s(t, e, i, r, s.rotationX || 0, s.rotationY || 0, s.rotationZ || 0);
|
|
715
|
+
return { position: [t, e], size: [i, r], tt: s.character || [0, 0, 0], primaryColor: s.charColor || [1, 1, 1, 1], secondaryColor: s.bgColor || [0, 0, 0, 1], rotation: s.charRotation || [0, 0], transform: [s.invert ? 1 : 0, s.flipHorizontally ? 1 : 0, s.flipVertically ? 1 : 0], globalRotationX: n.radiansX, globalRotationY: n.radiansY, globalRotationZ: n.radiansZ, rotationCenter: [n.centerX, n.centerY] };
|
|
684
716
|
}
|
|
685
|
-
|
|
686
|
-
const i =
|
|
717
|
+
ps(t, e) {
|
|
718
|
+
const i = I(this.bt) || [0, 0, this.bt.canvas.width, this.bt.canvas.height];
|
|
687
719
|
return { nx: t / i[2] * 2 - 1, ny: 1 - e / i[3] * 2 };
|
|
688
720
|
}
|
|
689
|
-
|
|
690
|
-
const
|
|
691
|
-
t.rotationCenter = [
|
|
721
|
+
gs(t, e, i) {
|
|
722
|
+
const r = this.ps(e, i);
|
|
723
|
+
t.rotationCenter = [r.nx, r.ny];
|
|
692
724
|
}
|
|
693
|
-
|
|
694
|
-
const
|
|
695
|
-
return { centerX: (t + i / 2) / l * 2 - 1, centerY: 1 - (e +
|
|
725
|
+
_s(t, e, i, r, s, n, o) {
|
|
726
|
+
const h = I(this.bt) || [0, 0, this.bt.canvas.width, this.bt.canvas.height], l = h[2], u = h[3];
|
|
727
|
+
return { centerX: (t + i / 2) / l * 2 - 1, centerY: 1 - (e + r / 2) / u * 2, radiansX: -s * Math.PI / 180, radiansY: -n * Math.PI / 180, radiansZ: -o * Math.PI / 180, aspectRatio: l / u };
|
|
696
728
|
}
|
|
697
729
|
}
|
|
698
|
-
const at = {
|
|
699
|
-
class ht extends
|
|
730
|
+
const at = { fs: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1]), Re: 6, be: WebGL2RenderingContext.TRIANGLES, _e: 16, de: { fe: { size: 2, offset: 0 }, pe: { size: 2, offset: 8 } } };
|
|
731
|
+
class ht extends S {
|
|
700
732
|
constructor(t, e) {
|
|
701
733
|
super(t, e, b.RECTANGLE, at);
|
|
702
734
|
}
|
|
703
|
-
|
|
704
|
-
const i = this.
|
|
705
|
-
return this.
|
|
735
|
+
ze(t, e) {
|
|
736
|
+
const i = this.ds(t.x, t.y, t.width, t.height, e);
|
|
737
|
+
return this.hs.ze(i);
|
|
706
738
|
}
|
|
707
739
|
}
|
|
708
|
-
const ct = {
|
|
709
|
-
class lt extends
|
|
740
|
+
const ct = { fs: 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]), Re: 6, be: WebGL2RenderingContext.TRIANGLES, _e: 16, de: { fe: { size: 2, offset: 0 }, pe: { size: 2, offset: 8 } } };
|
|
741
|
+
class lt extends S {
|
|
710
742
|
constructor(t, e) {
|
|
711
743
|
super(t, e, b.LINE, ct);
|
|
712
744
|
}
|
|
713
|
-
|
|
714
|
-
const i = t.x2 - t.x1,
|
|
715
|
-
return this.
|
|
745
|
+
ze(t, e) {
|
|
746
|
+
const i = t.x2 - t.x1, r = t.y2 - t.y1, s = Math.hypot(i, r), n = Math.atan2(r, i), o = t.thickness || e.lineWeight || 1, h = t.x1 + i / 2, l = t.y1 + r / 2, u = h - s / 2, f = l, d = { character: e.character, charColor: e.charColor, bgColor: e.bgColor, charRotation: e.charRotation, flipHorizontally: e.flipHorizontally, flipVertically: e.flipVertically, invert: e.invert, rotationX: e.rotationX || 0, rotationY: e.rotationY || 0, rotationZ: (e.rotationZ || 0) + 180 * n / Math.PI, lineWeight: o }, p = this.ds(u, f, s, o, d);
|
|
747
|
+
return this.gs(p, h, l), this.hs.ze(p);
|
|
716
748
|
}
|
|
717
749
|
}
|
|
718
|
-
const ut = {
|
|
750
|
+
const ut = { fs: function(a = 32) {
|
|
719
751
|
const t = [], e = 2 * Math.PI / a;
|
|
720
752
|
for (let i = 0; i < a; i++) {
|
|
721
|
-
const
|
|
722
|
-
t.push(0, 0, 0.5, 0.5, n, o,
|
|
753
|
+
const r = i * e, s = (i + 1) % a * e, n = Math.cos(r), o = Math.sin(r), h = 0.5 * (n + 1), l = 0.5 * (o + 1), u = Math.cos(s), f = Math.sin(s), d = 0.5 * (u + 1), p = 0.5 * (f + 1);
|
|
754
|
+
t.push(0, 0, 0.5, 0.5, n, o, h, l, u, f, d, p);
|
|
723
755
|
}
|
|
724
756
|
return new Float32Array(t);
|
|
725
|
-
}(32),
|
|
726
|
-
class ft extends
|
|
757
|
+
}(32), Re: 96, be: WebGL2RenderingContext.TRIANGLES, _e: 16, de: { fe: { size: 2, offset: 0 }, pe: { size: 2, offset: 8 } } };
|
|
758
|
+
class ft extends S {
|
|
727
759
|
constructor(t, e) {
|
|
728
760
|
super(t, e, b.ELLIPSE, ut);
|
|
729
761
|
}
|
|
730
|
-
|
|
731
|
-
const i = this.
|
|
732
|
-
return this.
|
|
762
|
+
ze(t, e) {
|
|
763
|
+
const i = this.ds(t.x, t.y, t.width, t.height, e);
|
|
764
|
+
return this.gs(i, t.x, t.y), this.hs.ze(i);
|
|
733
765
|
}
|
|
734
766
|
}
|
|
735
|
-
let dt = {
|
|
767
|
+
let dt = { fs: function(a) {
|
|
736
768
|
const t = [];
|
|
737
769
|
for (let e = 0; e < a; e++) {
|
|
738
|
-
const i = e / a,
|
|
739
|
-
t.push(i, 0, i, 0, i, 1, i, 1,
|
|
770
|
+
const i = e / a, r = (e + 1) / a;
|
|
771
|
+
t.push(i, 0, i, 0, i, 1, i, 1, r, 1, r, 1);
|
|
740
772
|
}
|
|
741
773
|
return new Float32Array(t);
|
|
742
|
-
}(32),
|
|
743
|
-
class pt extends
|
|
774
|
+
}(32), Re: 96, be: WebGL2RenderingContext.TRIANGLES, _e: 16, de: { fe: { size: 2, offset: 0 }, pe: { size: 2, offset: 8 } } };
|
|
775
|
+
class pt extends S {
|
|
744
776
|
constructor(t, e) {
|
|
745
777
|
super(t, e, b.ARC, dt);
|
|
746
778
|
}
|
|
747
|
-
|
|
748
|
-
const i = t.x - t.width / 2,
|
|
749
|
-
return this.
|
|
779
|
+
ze(t, e) {
|
|
780
|
+
const i = t.x - t.width / 2, r = t.y - t.height / 2, s = t.start * Math.PI / 180, n = t.stop * Math.PI / 180, o = this.ds(i, r, t.width, t.height, e);
|
|
781
|
+
return this.gs(o, t.x, t.y), o.arcAngles = [s, n], this.hs.ze(o);
|
|
750
782
|
}
|
|
751
783
|
}
|
|
752
|
-
const gt = {
|
|
753
|
-
class mt extends
|
|
784
|
+
const gt = { fs: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Re: 3, be: WebGL2RenderingContext.TRIANGLES, _e: 16, de: { fe: { size: 2, offset: 0 }, pe: { size: 2, offset: 8 } } };
|
|
785
|
+
class mt extends S {
|
|
754
786
|
constructor(t, e) {
|
|
755
787
|
super(t, e, b.TRIANGLE, gt);
|
|
756
788
|
}
|
|
757
|
-
|
|
758
|
-
const i = Math.min(t.x1, t.x2, t.x3),
|
|
759
|
-
return this.
|
|
789
|
+
ze(t, e) {
|
|
790
|
+
const i = Math.min(t.x1, t.x2, t.x3), r = Math.max(t.x1, t.x2, t.x3), s = Math.min(t.y1, t.y2, t.y3), n = r - i, o = Math.max(t.y1, t.y2, t.y3) - s, h = this.ds(i, s, n, o, e), l = i + 0.5 * n, u = s + o * (1 / 3);
|
|
791
|
+
return this.gs(h, l, u), this.hs.ze(h);
|
|
760
792
|
}
|
|
761
793
|
}
|
|
762
|
-
function
|
|
763
|
-
const
|
|
764
|
-
return n *
|
|
794
|
+
function N(a, t, e, i, r) {
|
|
795
|
+
const s = 1 - a, n = s * s, o = a * a;
|
|
796
|
+
return n * s * t + 3 * n * a * e + 3 * s * o * i + o * a * r;
|
|
765
797
|
}
|
|
766
|
-
const bt = {
|
|
798
|
+
const bt = { fs: function(a = 16) {
|
|
767
799
|
const t = [];
|
|
768
800
|
for (let e = 0; e < a; e++) {
|
|
769
|
-
const i = e / a,
|
|
770
|
-
t.push(i, -0.5, i, 0), t.push(
|
|
801
|
+
const i = e / a, r = (e + 1) / a;
|
|
802
|
+
t.push(i, -0.5, i, 0), t.push(r, -0.5, r, 0), t.push(i, 0.5, i, 1), t.push(i, 0.5, i, 1), t.push(r, -0.5, r, 0), t.push(r, 0.5, r, 1);
|
|
771
803
|
}
|
|
772
804
|
return new Float32Array(t);
|
|
773
|
-
}(16),
|
|
774
|
-
class yt extends
|
|
805
|
+
}(16), Re: 96, be: WebGL2RenderingContext.TRIANGLES, _e: 16, de: { fe: { size: 2, offset: 0 }, pe: { size: 2, offset: 8 } } };
|
|
806
|
+
class yt extends S {
|
|
775
807
|
constructor(t, e) {
|
|
776
808
|
super(t, e, b.BEZIER_CURVE, bt);
|
|
777
809
|
}
|
|
778
|
-
|
|
779
|
-
const i = e.lineWeight || 1,
|
|
780
|
-
return this.
|
|
810
|
+
ze(t, e) {
|
|
811
|
+
const i = e.lineWeight || 1, r = N(0.5, t.x1, t.cp1x, t.cp2x, t.x2), s = N(0.5, t.y1, t.cp1y, t.cp2y, t.y2), n = { character: e.character, charColor: e.charColor, bgColor: e.bgColor, charRotation: e.charRotation, flipHorizontally: e.flipHorizontally, flipVertically: e.flipVertically, invert: e.invert, rotationX: e.rotationX || 0, rotationY: e.rotationY || 0, rotationZ: e.rotationZ || 0, lineWeight: i }, o = this.ds(0, 0, 1, i, n);
|
|
812
|
+
return this.gs(o, r, s), o.bezierStartPoint = [t.x1, t.y1], o.bezierControlPoint1 = [t.cp1x, t.cp1y], o.bezierControlPoint2 = [t.cp2x, t.cp2y], o.bezierEndPoint = [t.x2, t.y2], this.hs.ze(o);
|
|
781
813
|
}
|
|
782
814
|
}
|
|
783
|
-
class
|
|
815
|
+
class vt {
|
|
784
816
|
constructor(t) {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
this.bt = t, this
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
let e = this
|
|
817
|
+
c(this, "bt");
|
|
818
|
+
c(this, "vs", null);
|
|
819
|
+
c(this, "$s");
|
|
820
|
+
c(this, "Cs", null);
|
|
821
|
+
c(this, "ws", {});
|
|
822
|
+
c(this, "bs", null);
|
|
823
|
+
c(this, "Rs", /* @__PURE__ */ new Map());
|
|
824
|
+
c(this, "Ms");
|
|
825
|
+
c(this, "Ss");
|
|
826
|
+
c(this, "Fs");
|
|
827
|
+
c(this, "K", []);
|
|
828
|
+
this.bt = t, this.$s = new it(t), this.Fs = new j(), this.Ms = new st(t, this), this.Ss = new nt(), this.bs = t.createBuffer(), U(this.bt, [0, 0, this.bt.canvas.width, this.bt.canvas.height]);
|
|
829
|
+
}
|
|
830
|
+
zs(t) {
|
|
831
|
+
let e = this.Rs.get(t);
|
|
800
832
|
if (e) return e;
|
|
801
833
|
const i = new ot(this.bt);
|
|
802
|
-
return e = (0, { [b.RECTANGLE]: () => new ht(this.bt, i), [b.LINE]: () => new lt(this.bt, i), [b.ELLIPSE]: () => new ft(this.bt, i), [b.ARC]: () => new pt(this.bt, i), [b.TRIANGLE]: () => new mt(this.bt, i), [b.BEZIER_CURVE]: () => new yt(this.bt, i) }[t])(), this
|
|
834
|
+
return e = (0, { [b.RECTANGLE]: () => new ht(this.bt, i), [b.LINE]: () => new lt(this.bt, i), [b.ELLIPSE]: () => new ft(this.bt, i), [b.ARC]: () => new pt(this.bt, i), [b.TRIANGLE]: () => new mt(this.bt, i), [b.BEZIER_CURVE]: () => new yt(this.bt, i) }[t])(), this.Rs.set(t, e), e;
|
|
803
835
|
}
|
|
804
|
-
|
|
805
|
-
this.
|
|
836
|
+
ks(t) {
|
|
837
|
+
this.vs !== t && (this.vs = t, t.Yt());
|
|
806
838
|
}
|
|
807
|
-
|
|
808
|
-
return this.
|
|
839
|
+
Ps(t, e) {
|
|
840
|
+
return this.$s.ce(t, e);
|
|
809
841
|
}
|
|
810
|
-
|
|
811
|
-
return this.
|
|
842
|
+
oe() {
|
|
843
|
+
return this.$s.oe();
|
|
812
844
|
}
|
|
813
845
|
Bt() {
|
|
814
|
-
return this.
|
|
846
|
+
return this.$s.Bt();
|
|
815
847
|
}
|
|
816
|
-
|
|
817
|
-
return this.
|
|
848
|
+
ae() {
|
|
849
|
+
return this.$s.ae();
|
|
818
850
|
}
|
|
819
|
-
|
|
820
|
-
this.
|
|
851
|
+
Ts(t) {
|
|
852
|
+
this.Cs = t, t && (this.ws = {});
|
|
821
853
|
}
|
|
822
|
-
|
|
823
|
-
this.
|
|
854
|
+
Jt(t, e) {
|
|
855
|
+
this.ws[t] = e;
|
|
824
856
|
}
|
|
825
|
-
|
|
826
|
-
Object.assign(this.
|
|
857
|
+
As(t) {
|
|
858
|
+
Object.assign(this.ws, t);
|
|
827
859
|
}
|
|
828
|
-
|
|
829
|
-
return this.
|
|
860
|
+
he(t) {
|
|
861
|
+
return this.$s.he(t);
|
|
830
862
|
}
|
|
831
|
-
|
|
832
|
-
const n = this.
|
|
833
|
-
this.
|
|
863
|
+
Gs(t, e, i, r, s) {
|
|
864
|
+
const n = this.oe(), o = { l: t.textures[0], m: t.textures[1], n: t.textures[2], o: t.textures[3], p: t.textures[4], q: [t.width, t.height] };
|
|
865
|
+
this.Ss.De(e, i, r, s, n, o, this.Fs);
|
|
834
866
|
}
|
|
835
|
-
|
|
867
|
+
Ls(t, e, i, r) {
|
|
836
868
|
var m;
|
|
837
|
-
const
|
|
838
|
-
|
|
839
|
-
const p = ((m = this.
|
|
840
|
-
g !== -1 && (
|
|
869
|
+
const s = this.bt, n = s.canvas.width, o = s.canvas.height, h = t / n * 2 - 1, l = (t + i) / n * 2 - 1, u = 1 - e / o * 2, f = 1 - (e + r) / o * 2, d = new Float32Array([h, f, l, f, h, u, l, f, l, u, h, u]);
|
|
870
|
+
s.bindBuffer(s.ARRAY_BUFFER, this.bs), s.bufferData(s.ARRAY_BUFFER, d, s.DYNAMIC_DRAW);
|
|
871
|
+
const p = ((m = this.vs) == null ? void 0 : m.ie) || s.getParameter(s.CURRENT_PROGRAM), g = p ? s.getAttribLocation(p, "a_position") : -1;
|
|
872
|
+
g !== -1 && (s.enableVertexAttribArray(g), s.vertexAttribPointer(g, 2, s.FLOAT, !1, 8, 0)), s.drawArrays(s.TRIANGLES, 0, 6), g !== -1 && s.disableVertexAttribArray(g);
|
|
841
873
|
}
|
|
842
|
-
|
|
843
|
-
this.
|
|
874
|
+
Es(t, e, i, r) {
|
|
875
|
+
this.Cs ? (this.Ss.De(t, e, i, r, this.Cs, { ...this.ws }, this.Fs), this.Cs = null, this.ws = {}) : this.Ss.Be(t, e, i, r, this.Fs);
|
|
844
876
|
}
|
|
845
|
-
|
|
846
|
-
this.
|
|
877
|
+
Bs(t, e, i, r) {
|
|
878
|
+
this.Ss.We(t, e, i, r, this.Fs.lineWeight, this.Fs);
|
|
847
879
|
}
|
|
848
|
-
|
|
849
|
-
this.
|
|
880
|
+
Ds(t, e, i, r) {
|
|
881
|
+
this.Ss.Ie(t, e, i, r, this.Fs);
|
|
850
882
|
}
|
|
851
|
-
|
|
852
|
-
this.
|
|
883
|
+
Ws(t, e, i, r, s, n) {
|
|
884
|
+
this.Ss.Ve(t, e, i, r, s, n, this.Fs);
|
|
853
885
|
}
|
|
854
|
-
|
|
855
|
-
const l = this.
|
|
856
|
-
this.
|
|
886
|
+
Is(t, e, i, r, s, n, o, h) {
|
|
887
|
+
const l = this.Fs.lineWeight;
|
|
888
|
+
this.Ss.Oe(t, e, i, r, s, n, o, h, l, this.Fs);
|
|
857
889
|
}
|
|
858
|
-
|
|
859
|
-
return new
|
|
890
|
+
Us(t, e, i = 1, r = {}) {
|
|
891
|
+
return new D(this.bt, t, e, i, r, this, !0);
|
|
860
892
|
}
|
|
861
|
-
|
|
862
|
-
this.
|
|
893
|
+
Vs(t, e, i, r, s, n) {
|
|
894
|
+
this.Ss.Ue(t, e, i, r, s, n, this.Fs);
|
|
863
895
|
}
|
|
864
|
-
|
|
865
|
-
this.state
|
|
896
|
+
Os(t, e = t, i = t, r = 255) {
|
|
897
|
+
this.state.$t(t, e, i, r), this.He(t / 255, e / 255, i / 255, r / 255);
|
|
866
898
|
}
|
|
867
|
-
|
|
868
|
-
this.bt.clearColor(t, e, i,
|
|
899
|
+
He(t = 0, e = 0, i = 0, r = 0) {
|
|
900
|
+
this.bt.clearColor(t, e, i, r), this.bt.clear(this.bt.COLOR_BUFFER_BIT);
|
|
869
901
|
}
|
|
870
|
-
|
|
902
|
+
Hs() {
|
|
871
903
|
this.bt.viewport(0, 0, this.bt.canvas.width, this.bt.canvas.height), U(this.bt, [0, 0, this.bt.canvas.width, this.bt.canvas.height]);
|
|
872
904
|
}
|
|
873
905
|
get context() {
|
|
874
906
|
return this.bt;
|
|
875
907
|
}
|
|
876
908
|
get state() {
|
|
877
|
-
return this.
|
|
909
|
+
return this.Fs;
|
|
878
910
|
}
|
|
879
911
|
Wt(t) {
|
|
880
|
-
this.K.push(this.
|
|
912
|
+
this.K.push(this.Fs), this.Fs = t;
|
|
881
913
|
}
|
|
882
914
|
It() {
|
|
883
915
|
const t = this.K.pop();
|
|
884
|
-
t && (this.
|
|
916
|
+
t && (this.Fs = t);
|
|
885
917
|
}
|
|
886
918
|
Dt(t) {
|
|
887
|
-
const e = t, i =
|
|
888
|
-
this.
|
|
889
|
-
const
|
|
890
|
-
for (const n of this.
|
|
891
|
-
for (const n of
|
|
892
|
-
this.
|
|
919
|
+
const e = t, i = I(this.bt) ?? this.bt.getParameter(this.bt.VIEWPORT), r = { shader: e, gl: this.bt, viewport: i };
|
|
920
|
+
this.ks(e);
|
|
921
|
+
const s = /* @__PURE__ */ new Set();
|
|
922
|
+
for (const n of this.Ss) n.type === b.CUSTOM ? s.add(b.RECTANGLE) : s.add(n.type);
|
|
923
|
+
for (const n of s) n !== b.CUSTOM && this.zs(n);
|
|
924
|
+
this.Ms.$e(r, this.Ss, this.Rs), this.Ss.He();
|
|
893
925
|
}
|
|
894
926
|
Ut() {
|
|
895
|
-
this.bt.deleteBuffer(this.
|
|
896
|
-
for (const t of this
|
|
897
|
-
this.
|
|
927
|
+
this.bt.deleteBuffer(this.bs), this.Ss.He();
|
|
928
|
+
for (const t of this.Rs.values()) t.Ut();
|
|
929
|
+
this.$s.Ut();
|
|
898
930
|
}
|
|
899
931
|
}
|
|
900
|
-
const
|
|
932
|
+
const v = { readShort: (a, t) => (v.t.uint16[0] = a[t] << 8 | a[t + 1], v.t.int16[0]), readUshort: (a, t) => a[t] << 8 | a[t + 1], readUshorts(a, t, e) {
|
|
901
933
|
const i = [];
|
|
902
|
-
for (let
|
|
934
|
+
for (let r = 0; r < e; r++) i.push(v.readUshort(a, t + 2 * r));
|
|
903
935
|
return i;
|
|
904
936
|
}, readUint(a, t) {
|
|
905
|
-
const e =
|
|
906
|
-
return e[3] = a[t], e[2] = a[t + 1], e[1] = a[t + 2], e[0] = a[t + 3],
|
|
937
|
+
const e = v.t.uint8;
|
|
938
|
+
return e[3] = a[t], e[2] = a[t + 1], e[1] = a[t + 2], e[0] = a[t + 3], v.t.uint32[0];
|
|
907
939
|
}, readASCII(a, t, e) {
|
|
908
940
|
let i = "";
|
|
909
|
-
for (let
|
|
941
|
+
for (let r = 0; r < e; r++) i += String.fromCharCode(a[t + r]);
|
|
910
942
|
return i;
|
|
911
943
|
}, t: (() => {
|
|
912
944
|
const a = new ArrayBuffer(8);
|
|
913
945
|
return { uint8: new Uint8Array(a), int16: new Int16Array(a), uint16: new Uint16Array(a), uint32: new Uint32Array(a) };
|
|
914
|
-
})() },
|
|
946
|
+
})() }, xt = { parseTab(a, t, e) {
|
|
915
947
|
const i = { tables: [], ids: {}, off: t };
|
|
916
948
|
a = new Uint8Array(a.buffer, t, e), t = 0;
|
|
917
|
-
const
|
|
949
|
+
const r = v, s = r.readUshort, n = s(a, t += 2);
|
|
918
950
|
t += 2;
|
|
919
951
|
const o = [];
|
|
920
|
-
for (let
|
|
921
|
-
const l =
|
|
952
|
+
for (let h = 0; h < n; h++) {
|
|
953
|
+
const l = s(a, t), u = s(a, t += 2);
|
|
922
954
|
t += 2;
|
|
923
|
-
const
|
|
955
|
+
const f = r.readUint(a, t);
|
|
924
956
|
t += 4;
|
|
925
|
-
const d = `p${l}e${
|
|
926
|
-
let p = o.indexOf(
|
|
957
|
+
const d = `p${l}e${u}`;
|
|
958
|
+
let p = o.indexOf(f);
|
|
927
959
|
if (p === -1) {
|
|
928
960
|
let g;
|
|
929
|
-
p = i.tables.length, o.push(
|
|
930
|
-
const m =
|
|
931
|
-
g = m === 4 ? this.parse4(a,
|
|
961
|
+
p = i.tables.length, o.push(f);
|
|
962
|
+
const m = s(a, f);
|
|
963
|
+
g = m === 4 ? this.parse4(a, f) : m === 12 ? this.parse12(a, f) : { format: m }, i.tables.push(g);
|
|
932
964
|
}
|
|
933
965
|
i.ids[d] = p;
|
|
934
966
|
}
|
|
935
967
|
return i;
|
|
936
968
|
}, parse4(a, t) {
|
|
937
|
-
const e =
|
|
969
|
+
const e = v, i = e.readUshort, r = e.readUshorts, s = t, n = i(a, t += 2);
|
|
938
970
|
t += 2;
|
|
939
|
-
const o = i(a, t += 2) >>> 1,
|
|
940
|
-
t += 2,
|
|
941
|
-
for (let l = 0; l < o; l++)
|
|
942
|
-
return
|
|
971
|
+
const o = i(a, t += 2) >>> 1, h = { format: 4, searchRange: i(a, t += 2), entrySelector: 0, rangeShift: 0, endCount: [], startCount: [], idDelta: [], idRangeOffset: [], glyphIdArray: [] };
|
|
972
|
+
t += 2, h.entrySelector = i(a, t), t += 2, h.rangeShift = i(a, t), t += 2, h.endCount = r(a, t, o), t += 2 * o, t += 2, h.startCount = r(a, t, o), t += 2 * o;
|
|
973
|
+
for (let l = 0; l < o; l++) h.idDelta.push(e.readShort(a, t)), t += 2;
|
|
974
|
+
return h.idRangeOffset = r(a, t, o), t += 2 * o, h.glyphIdArray = r(a, t, s + n - t >> 1), h;
|
|
943
975
|
}, parse12(a, t) {
|
|
944
|
-
const e =
|
|
976
|
+
const e = v.readUint;
|
|
945
977
|
e(a, t += 4), e(a, t += 4);
|
|
946
978
|
const i = e(a, t += 4);
|
|
947
979
|
t += 4;
|
|
948
|
-
const
|
|
949
|
-
for (let
|
|
950
|
-
return { format: 12, groups:
|
|
951
|
-
} },
|
|
952
|
-
const i =
|
|
980
|
+
const r = new Uint32Array(3 * i);
|
|
981
|
+
for (let s = 0; s < 3 * i; s += 3) r[s] = e(a, t + (s << 2)), r[s + 1] = e(a, t + (s << 2) + 4), r[s + 2] = e(a, t + (s << 2) + 8);
|
|
982
|
+
return { format: 12, groups: r };
|
|
983
|
+
} }, Et = { parseTab(a, t, e) {
|
|
984
|
+
const i = v;
|
|
953
985
|
t += 18;
|
|
954
|
-
const
|
|
986
|
+
const r = i.readUshort(a, t);
|
|
955
987
|
t += 2, t += 16;
|
|
956
|
-
const
|
|
988
|
+
const s = i.readShort(a, t);
|
|
957
989
|
t += 2;
|
|
958
990
|
const n = i.readShort(a, t);
|
|
959
991
|
t += 2;
|
|
960
992
|
const o = i.readShort(a, t);
|
|
961
993
|
t += 2;
|
|
962
|
-
const
|
|
963
|
-
return t += 2, t += 6, { unitsPerEm:
|
|
964
|
-
} },
|
|
965
|
-
const i =
|
|
994
|
+
const h = i.readShort(a, t);
|
|
995
|
+
return t += 2, t += 6, { unitsPerEm: r, xMin: s, yMin: n, xMax: o, yMax: h, indexToLocFormat: i.readShort(a, t) };
|
|
996
|
+
} }, Rt = { parseTab(a, t, e) {
|
|
997
|
+
const i = v;
|
|
966
998
|
t += 4;
|
|
967
|
-
const
|
|
968
|
-
for (let n = 0; n <
|
|
969
|
-
const o =
|
|
970
|
-
|
|
999
|
+
const r = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], s = {};
|
|
1000
|
+
for (let n = 0; n < r.length; n++) {
|
|
1001
|
+
const o = r[n], h = o === "advanceWidthMax" || o === "numberOfHMetrics" ? i.readUshort : i.readShort;
|
|
1002
|
+
s[o] = h(a, t + 2 * n);
|
|
971
1003
|
}
|
|
972
|
-
return
|
|
1004
|
+
return s;
|
|
973
1005
|
} }, wt = { parseTab(a, t, e, i) {
|
|
974
|
-
const
|
|
975
|
-
let l = 0,
|
|
976
|
-
for (;
|
|
977
|
-
for (;
|
|
978
|
-
return { aWidth:
|
|
979
|
-
} },
|
|
980
|
-
const i =
|
|
1006
|
+
const r = v, s = [], n = [], o = i.maxp.numGlyphs, h = i.hhea.numberOfHMetrics;
|
|
1007
|
+
let l = 0, u = 0, f = 0;
|
|
1008
|
+
for (; f < h; ) l = r.readUshort(a, t + (f << 2)), u = r.readShort(a, t + (f << 2) + 2), s.push(l), n.push(u), f++;
|
|
1009
|
+
for (; f < o; ) s.push(l), n.push(u), f++;
|
|
1010
|
+
return { aWidth: s, lsBearing: n };
|
|
1011
|
+
} }, V = { cmap: xt, head: Et, hhea: Rt, maxp: { parseTab(a, t, e) {
|
|
1012
|
+
const i = v;
|
|
981
1013
|
return i.readUint(a, t), t += 4, { numGlyphs: i.readUshort(a, t) };
|
|
982
1014
|
} }, hmtx: wt, loca: { parseTab(a, t, e, i) {
|
|
983
|
-
const
|
|
984
|
-
if (n === 0) for (let
|
|
985
|
-
else if (n === 1) for (let
|
|
986
|
-
return r;
|
|
987
|
-
} }, glyf: { parseTab(a, t, e, i) {
|
|
988
|
-
const s = [], r = i.maxp.numGlyphs;
|
|
989
|
-
for (let n = 0; n < r; n++) s.push(null);
|
|
1015
|
+
const r = v, s = [], n = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
|
|
1016
|
+
if (n === 0) for (let h = 0; h < o; h++) s.push(r.readUshort(a, t + (h << 1)) << 1);
|
|
1017
|
+
else if (n === 1) for (let h = 0; h < o; h++) s.push(r.readUint(a, t + (h << 2)));
|
|
990
1018
|
return s;
|
|
991
|
-
},
|
|
992
|
-
const
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1019
|
+
} }, glyf: { parseTab(a, t, e, i) {
|
|
1020
|
+
const r = [], s = i.maxp.numGlyphs;
|
|
1021
|
+
for (let n = 0; n < s; n++) r.push(null);
|
|
1022
|
+
return r;
|
|
1023
|
+
}, Ks(a, t) {
|
|
1024
|
+
const e = v, i = a.Ns, r = a.loca;
|
|
1025
|
+
if (r[t] === r[t + 1]) return null;
|
|
1026
|
+
const s = A.findTable(i, "glyf", a.Xs);
|
|
1027
|
+
if (!s) return null;
|
|
1028
|
+
let n = s[0] + r[t];
|
|
997
1029
|
const o = {};
|
|
998
1030
|
if (o.noc = e.readShort(i, n), n += 2, o.xMin = e.readShort(i, n), n += 2, o.yMin = e.readShort(i, n), n += 2, o.xMax = e.readShort(i, n), n += 2, o.yMax = e.readShort(i, n), n += 2, o.xMin >= o.xMax || o.yMin >= o.yMax) return null;
|
|
999
1031
|
if (o.noc > 0) {
|
|
1000
1032
|
o.endPts = [];
|
|
1001
1033
|
for (let d = 0; d < o.noc; d++) o.endPts.push(e.readUshort(i, n)), n += 2;
|
|
1002
|
-
const
|
|
1003
|
-
if (n += 2, i.length - n <
|
|
1004
|
-
n +=
|
|
1034
|
+
const h = e.readUshort(i, n);
|
|
1035
|
+
if (n += 2, i.length - n < h) return null;
|
|
1036
|
+
n += h;
|
|
1005
1037
|
const l = o.endPts[o.noc - 1] + 1;
|
|
1006
1038
|
o.flags = [];
|
|
1007
1039
|
for (let d = 0; d < l; d++) {
|
|
@@ -1022,131 +1054,131 @@ const E = { readShort: (a, t) => (E.t.uint16[0] = a[t] << 8 | a[t + 1], E.t.int1
|
|
|
1022
1054
|
const p = o.flags[d], g = !!(32 & p);
|
|
1023
1055
|
4 & p ? (o.ys.push(g ? i[n] : -i[n]), n++) : g ? o.ys.push(0) : (o.ys.push(e.readShort(i, n)), n += 2);
|
|
1024
1056
|
}
|
|
1025
|
-
let
|
|
1026
|
-
for (let d = 0; d < l; d++)
|
|
1057
|
+
let u = 0, f = 0;
|
|
1058
|
+
for (let d = 0; d < l; d++) u += o.xs[d], f += o.ys[d], o.xs[d] = u, o.ys[d] = f;
|
|
1027
1059
|
} else o.parts = [], o.endPts = [], o.flags = [], o.xs = [], o.ys = [];
|
|
1028
1060
|
return o;
|
|
1029
|
-
} } }, A = { parse: (a) => [((t, e, i,
|
|
1030
|
-
const
|
|
1031
|
-
for (const o in
|
|
1032
|
-
const
|
|
1061
|
+
} } }, A = { parse: (a) => [((t, e, i, r) => {
|
|
1062
|
+
const s = V, n = { Ns: t, js: e, Xs: i };
|
|
1063
|
+
for (const o in s) {
|
|
1064
|
+
const h = o, l = A.findTable(t, h, i);
|
|
1033
1065
|
if (l) {
|
|
1034
|
-
const [
|
|
1035
|
-
let d =
|
|
1036
|
-
d == null && (d =
|
|
1066
|
+
const [u, f] = l;
|
|
1067
|
+
let d = r[u];
|
|
1068
|
+
d == null && (d = s[h].parseTab(t, u, f, n), r[u] = d), n[h] = d;
|
|
1037
1069
|
}
|
|
1038
1070
|
}
|
|
1039
1071
|
return n;
|
|
1040
1072
|
})(new Uint8Array(a), 0, 0, {})], findTable(a, t, e) {
|
|
1041
|
-
const i =
|
|
1042
|
-
let
|
|
1043
|
-
for (let n = 0; n <
|
|
1044
|
-
const o = i.readASCII(a,
|
|
1045
|
-
i.readUint(a,
|
|
1046
|
-
const
|
|
1047
|
-
if (o === t) return [
|
|
1048
|
-
|
|
1073
|
+
const i = v, r = i.readUshort(a, e + 4);
|
|
1074
|
+
let s = e + 12;
|
|
1075
|
+
for (let n = 0; n < r; n++) {
|
|
1076
|
+
const o = i.readASCII(a, s, 4);
|
|
1077
|
+
i.readUint(a, s + 4);
|
|
1078
|
+
const h = i.readUint(a, s + 8), l = i.readUint(a, s + 12);
|
|
1079
|
+
if (o === t) return [h, l];
|
|
1080
|
+
s += 16;
|
|
1049
1081
|
}
|
|
1050
1082
|
return null;
|
|
1051
|
-
}, T:
|
|
1052
|
-
class
|
|
1083
|
+
}, T: V, B: v };
|
|
1084
|
+
class z {
|
|
1053
1085
|
constructor() {
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
const i = `${this.
|
|
1059
|
-
if (this.
|
|
1060
|
-
const
|
|
1061
|
-
if (!
|
|
1062
|
-
let
|
|
1063
|
-
for (const n of
|
|
1064
|
-
return this.
|
|
1086
|
+
c(this, "Ys", /* @__PURE__ */ new Map());
|
|
1087
|
+
c(this, "qs", /* @__PURE__ */ new Map());
|
|
1088
|
+
}
|
|
1089
|
+
Zs(t, e) {
|
|
1090
|
+
const i = `${this.Js(t)}_${e}`;
|
|
1091
|
+
if (this.Ys.has(i)) return this.Ys.get(i);
|
|
1092
|
+
const r = t.cmap;
|
|
1093
|
+
if (!r || !r.tables) return this.Ys.set(i, 0), 0;
|
|
1094
|
+
let s = 0;
|
|
1095
|
+
for (const n of r.tables) if (n.format === 4 ? s = this.Qs(e, n) : n.format === 12 && (s = this.ti(e, n)), s > 0) break;
|
|
1096
|
+
return this.Ys.set(i, s), s;
|
|
1065
1097
|
}
|
|
1066
|
-
|
|
1098
|
+
ei(t, e) {
|
|
1067
1099
|
const i = e.codePointAt(0);
|
|
1068
|
-
return i === void 0 ? 0 : this.
|
|
1100
|
+
return i === void 0 ? 0 : this.Zs(t, i);
|
|
1069
1101
|
}
|
|
1070
|
-
|
|
1102
|
+
si(t, e) {
|
|
1071
1103
|
const i = t.hmtx;
|
|
1072
1104
|
return i && i.aWidth && i.aWidth.length !== 0 ? e < i.aWidth.length ? i.aWidth[e] : i.aWidth[i.aWidth.length - 1] : 0;
|
|
1073
1105
|
}
|
|
1074
|
-
|
|
1075
|
-
const i = e / t.head.unitsPerEm,
|
|
1076
|
-
return { ascender:
|
|
1106
|
+
ii(t, e) {
|
|
1107
|
+
const i = e / t.head.unitsPerEm, r = t.hhea.ascender * i, s = t.hhea.descender * i, n = t.hhea.lineGap * i;
|
|
1108
|
+
return { ascender: r, descender: s, lineGap: n, lineHeight: r - s + n, unitsPerEm: t.head.unitsPerEm, scale: i };
|
|
1077
1109
|
}
|
|
1078
|
-
|
|
1079
|
-
this.
|
|
1110
|
+
ri() {
|
|
1111
|
+
this.Ys.clear(), this.qs.clear();
|
|
1080
1112
|
}
|
|
1081
|
-
|
|
1082
|
-
return `${t.
|
|
1113
|
+
Js(t) {
|
|
1114
|
+
return `${t.Xs}_${t.Ns.length}`;
|
|
1083
1115
|
}
|
|
1084
|
-
|
|
1116
|
+
Qs(t, e) {
|
|
1085
1117
|
const i = e.endCount.length;
|
|
1086
|
-
let
|
|
1087
|
-
for (let
|
|
1088
|
-
|
|
1118
|
+
let r = -1;
|
|
1119
|
+
for (let s = 0; s < i; s++) if (t <= e.endCount[s]) {
|
|
1120
|
+
r = s;
|
|
1089
1121
|
break;
|
|
1090
1122
|
}
|
|
1091
|
-
if (
|
|
1092
|
-
if (e.idRangeOffset[
|
|
1123
|
+
if (r === -1 || t < e.startCount[r]) return 0;
|
|
1124
|
+
if (e.idRangeOffset[r] === 0) return t + e.idDelta[r] & 65535;
|
|
1093
1125
|
{
|
|
1094
|
-
const
|
|
1095
|
-
if (
|
|
1096
|
-
const n = e.glyphIdArray[
|
|
1097
|
-
return n === 0 ? 0 : n + e.idDelta[
|
|
1126
|
+
const s = e.idRangeOffset[r] / 2 + (t - e.startCount[r]) - (i - r);
|
|
1127
|
+
if (s >= 0 && s < e.glyphIdArray.length) {
|
|
1128
|
+
const n = e.glyphIdArray[s];
|
|
1129
|
+
return n === 0 ? 0 : n + e.idDelta[r] & 65535;
|
|
1098
1130
|
}
|
|
1099
1131
|
}
|
|
1100
1132
|
return 0;
|
|
1101
1133
|
}
|
|
1102
|
-
|
|
1134
|
+
ti(t, e) {
|
|
1103
1135
|
const i = e.groups.length / 3;
|
|
1104
|
-
for (let
|
|
1105
|
-
const
|
|
1106
|
-
if (t >=
|
|
1136
|
+
for (let r = 0; r < i; r++) {
|
|
1137
|
+
const s = e.groups[3 * r], n = e.groups[3 * r + 1], o = e.groups[3 * r + 2];
|
|
1138
|
+
if (t >= s && t <= n) return o + (t - s);
|
|
1107
1139
|
}
|
|
1108
1140
|
return 0;
|
|
1109
1141
|
}
|
|
1110
1142
|
}
|
|
1111
1143
|
class Ct {
|
|
1112
1144
|
constructor(t) {
|
|
1113
|
-
|
|
1114
|
-
this.
|
|
1145
|
+
c(this, "ni");
|
|
1146
|
+
this.ni = t;
|
|
1115
1147
|
}
|
|
1116
|
-
|
|
1148
|
+
oi(t) {
|
|
1117
1149
|
var i;
|
|
1118
1150
|
const e = [];
|
|
1119
|
-
return (i = t.cmap) != null && i.tables ? (t.cmap.tables.forEach((
|
|
1120
|
-
if (
|
|
1121
|
-
const
|
|
1122
|
-
e.push(...
|
|
1123
|
-
} else if (
|
|
1124
|
-
const
|
|
1125
|
-
e.push(...
|
|
1151
|
+
return (i = t.cmap) != null && i.tables ? (t.cmap.tables.forEach((r) => {
|
|
1152
|
+
if (r.format === 4) {
|
|
1153
|
+
const s = this.ai(r);
|
|
1154
|
+
e.push(...s);
|
|
1155
|
+
} else if (r.format === 12) {
|
|
1156
|
+
const s = this.hi(r);
|
|
1157
|
+
e.push(...s);
|
|
1126
1158
|
}
|
|
1127
1159
|
}), [...new Set(e)]) : [];
|
|
1128
1160
|
}
|
|
1129
|
-
|
|
1130
|
-
return this.
|
|
1161
|
+
ci(t, e) {
|
|
1162
|
+
return this.ni.ei(t, e) > 0;
|
|
1131
1163
|
}
|
|
1132
|
-
|
|
1133
|
-
for (const i of e) if (!this.
|
|
1164
|
+
li(t, e) {
|
|
1165
|
+
for (const i of e) if (!this.ci(t, i)) return !1;
|
|
1134
1166
|
return !0;
|
|
1135
1167
|
}
|
|
1136
|
-
|
|
1137
|
-
return e.filter((i) => this.
|
|
1168
|
+
ui(t, e) {
|
|
1169
|
+
return e.filter((i) => this.ci(t, i));
|
|
1138
1170
|
}
|
|
1139
|
-
|
|
1140
|
-
return t.filter((e) => this.
|
|
1171
|
+
fi(t) {
|
|
1172
|
+
return t.filter((e) => this.di(e));
|
|
1141
1173
|
}
|
|
1142
|
-
|
|
1174
|
+
ai(t) {
|
|
1143
1175
|
const e = [];
|
|
1144
1176
|
if (!(t.startCount && t.endCount && t.idRangeOffset && t.idDelta)) return e;
|
|
1145
1177
|
for (let i = 0; i < t.startCount.length; i++) {
|
|
1146
|
-
const
|
|
1147
|
-
if (
|
|
1148
|
-
for (let n =
|
|
1149
|
-
if (this.
|
|
1178
|
+
const r = t.startCount[i], s = t.endCount[i];
|
|
1179
|
+
if (r !== 65535 || s !== 65535) {
|
|
1180
|
+
for (let n = r; n <= s; n++)
|
|
1181
|
+
if (this._i(t, n, i) > 0) try {
|
|
1150
1182
|
const o = String.fromCodePoint(n);
|
|
1151
1183
|
e.push(o);
|
|
1152
1184
|
} catch {
|
|
@@ -1155,996 +1187,996 @@ class Ct {
|
|
|
1155
1187
|
}
|
|
1156
1188
|
return e;
|
|
1157
1189
|
}
|
|
1158
|
-
|
|
1190
|
+
hi(t) {
|
|
1159
1191
|
const e = [];
|
|
1160
1192
|
if (!t.groups) return e;
|
|
1161
1193
|
for (let i = 0; i < t.groups.length; i += 3) {
|
|
1162
|
-
const
|
|
1163
|
-
for (let o =
|
|
1164
|
-
if (n + (o -
|
|
1165
|
-
const
|
|
1166
|
-
e.push(
|
|
1194
|
+
const r = t.groups[i], s = t.groups[i + 1], n = t.groups[i + 2];
|
|
1195
|
+
for (let o = r; o <= s; o++)
|
|
1196
|
+
if (n + (o - r) > 0) try {
|
|
1197
|
+
const h = String.fromCodePoint(o);
|
|
1198
|
+
e.push(h);
|
|
1167
1199
|
} catch {
|
|
1168
1200
|
}
|
|
1169
1201
|
}
|
|
1170
1202
|
return e;
|
|
1171
1203
|
}
|
|
1172
|
-
|
|
1204
|
+
_i(t, e, i) {
|
|
1173
1205
|
if (t.idRangeOffset[i] === 0) return e + t.idDelta[i] & 65535;
|
|
1174
1206
|
{
|
|
1175
|
-
const
|
|
1176
|
-
if (
|
|
1177
|
-
const
|
|
1178
|
-
if (
|
|
1207
|
+
const r = t.idRangeOffset[i] / 2 + (e - t.startCount[i]) - (t.startCount.length - i);
|
|
1208
|
+
if (r >= 0 && t.glyphIdArray && r < t.glyphIdArray.length) {
|
|
1209
|
+
const s = t.glyphIdArray[r];
|
|
1210
|
+
if (s !== 0) return s + t.idDelta[i] & 65535;
|
|
1179
1211
|
}
|
|
1180
1212
|
}
|
|
1181
1213
|
return 0;
|
|
1182
1214
|
}
|
|
1183
|
-
|
|
1215
|
+
di(t) {
|
|
1184
1216
|
const e = t.codePointAt(0) || 0;
|
|
1185
1217
|
return !(e >= 0 && e <= 31 && e !== 9 && e !== 10 && e !== 13 || e >= 127 && e <= 159);
|
|
1186
1218
|
}
|
|
1187
1219
|
}
|
|
1188
1220
|
class At {
|
|
1189
1221
|
constructor() {
|
|
1190
|
-
|
|
1191
|
-
const t = new
|
|
1192
|
-
this.
|
|
1222
|
+
c(this, "pi");
|
|
1223
|
+
const t = new z();
|
|
1224
|
+
this.pi = new Ct(t);
|
|
1193
1225
|
}
|
|
1194
1226
|
extractCharacters(t) {
|
|
1195
|
-
return this.
|
|
1227
|
+
return this.pi.oi(t);
|
|
1196
1228
|
}
|
|
1197
1229
|
filterProblematicCharacters(t) {
|
|
1198
|
-
return this.fi
|
|
1230
|
+
return this.pi.fi(t);
|
|
1199
1231
|
}
|
|
1200
1232
|
characterExists(t, e) {
|
|
1201
|
-
return this.
|
|
1233
|
+
return this.pi.ci(t, e);
|
|
1202
1234
|
}
|
|
1203
1235
|
allCharactersExist(t, e) {
|
|
1204
|
-
return this.
|
|
1236
|
+
return this.pi.li(t, e);
|
|
1205
1237
|
}
|
|
1206
1238
|
}
|
|
1207
1239
|
class Tt {
|
|
1208
1240
|
constructor(t) {
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
this.
|
|
1214
|
-
}
|
|
1215
|
-
createTextureAtlas(t, e, i,
|
|
1216
|
-
const
|
|
1217
|
-
this
|
|
1218
|
-
const
|
|
1219
|
-
return
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
this.
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
const n =
|
|
1241
|
+
c(this, "gi");
|
|
1242
|
+
c(this, "mi");
|
|
1243
|
+
c(this, "kt");
|
|
1244
|
+
c(this, "yi");
|
|
1245
|
+
this.kt = t, this.yi = new z(), this.gi = document.createElement("canvas"), this.mi = this.gi.getContext("2d", { willReadFrequently: !0, alpha: !1 });
|
|
1246
|
+
}
|
|
1247
|
+
createTextureAtlas(t, e, i, r) {
|
|
1248
|
+
const s = t.length, n = Math.ceil(Math.sqrt(s)), o = Math.ceil(s / n), h = e.width * n, l = e.height * o, u = typeof r == "object" ? r : null;
|
|
1249
|
+
this.$i(h, l), this.Ci(t, e, n, i, u);
|
|
1250
|
+
const f = this.kt.Us(h, l, 1, { filter: "nearest" });
|
|
1251
|
+
return f.Lt(this.gi), { framebuffer: f, columns: n, rows: o };
|
|
1252
|
+
}
|
|
1253
|
+
$i(t, e) {
|
|
1254
|
+
this.gi.width = t, this.gi.height = e, this.gi.style.width = t + "px", this.gi.style.height = t + "px", this.mi.imageSmoothingEnabled = !1, this.gi.style.imageRendering = "pixelated", this.mi.fillStyle = "black", this.mi.fillRect(0, 0, t, e), this.mi.textBaseline = "top", this.mi.textAlign = "left", this.mi.fillStyle = "white";
|
|
1255
|
+
}
|
|
1256
|
+
Ci(t, e, i, r, s) {
|
|
1257
|
+
const n = r / s.head.unitsPerEm;
|
|
1226
1258
|
for (let o = 0; o < t.length; o++) {
|
|
1227
|
-
const
|
|
1228
|
-
if (!
|
|
1229
|
-
const d =
|
|
1230
|
-
this
|
|
1259
|
+
const h = o % i, l = Math.floor(o / i), u = t[o].character, f = this.wi(s, u);
|
|
1260
|
+
if (!f) continue;
|
|
1261
|
+
const d = u.codePointAt(0) || 0, p = this.yi.Zs(s, d), g = this.xi(s, p) * n, m = h * e.width, R = l * e.height, x = m + 0.5 * e.width, w = R + 0.5 * e.height, C = Math.round(x - 0.5 * e.width), L = Math.round(w - 0.5 * r), q = C + 0.5 * (e.width - g), J = L + s.hhea.ascender * n;
|
|
1262
|
+
this.bi(f, q, J, n);
|
|
1231
1263
|
}
|
|
1232
1264
|
}
|
|
1233
|
-
|
|
1234
|
-
const i = e.codePointAt(0) || 0,
|
|
1235
|
-
if (
|
|
1236
|
-
if (t.glyf && t.glyf[
|
|
1265
|
+
wi(t, e) {
|
|
1266
|
+
const i = e.codePointAt(0) || 0, r = this.yi.Zs(t, i);
|
|
1267
|
+
if (r === 0) return null;
|
|
1268
|
+
if (t.glyf && t.glyf[r] !== null) return t.glyf[r];
|
|
1237
1269
|
if (A && A.T && A.T.glyf) {
|
|
1238
|
-
const
|
|
1239
|
-
return t.glyf &&
|
|
1270
|
+
const s = A.T.glyf.Ks(t, r);
|
|
1271
|
+
return t.glyf && s && (t.glyf[r] = s), s;
|
|
1240
1272
|
}
|
|
1241
1273
|
return null;
|
|
1242
1274
|
}
|
|
1243
|
-
|
|
1275
|
+
xi(t, e) {
|
|
1244
1276
|
const i = t.hmtx;
|
|
1245
1277
|
return i && i.aWidth ? e < i.aWidth.length ? i.aWidth[e] : i.aWidth[i.aWidth.length - 1] : 0;
|
|
1246
1278
|
}
|
|
1247
|
-
|
|
1279
|
+
bi(t, e, i, r) {
|
|
1248
1280
|
if (!t || !t.xs || t.noc === 0) return;
|
|
1249
|
-
const { xs:
|
|
1250
|
-
if (!(
|
|
1251
|
-
this.
|
|
1281
|
+
const { xs: s, ys: n, endPts: o, flags: h } = t;
|
|
1282
|
+
if (!(s && n && o && h)) return;
|
|
1283
|
+
this.mi.beginPath();
|
|
1252
1284
|
let l = 0;
|
|
1253
|
-
for (let
|
|
1254
|
-
const
|
|
1255
|
-
if (!(
|
|
1256
|
-
if (
|
|
1257
|
-
const d = e +
|
|
1258
|
-
this.
|
|
1285
|
+
for (let u = 0; u < o.length; u++) {
|
|
1286
|
+
const f = o[u];
|
|
1287
|
+
if (!(f < l)) {
|
|
1288
|
+
if (f >= l) {
|
|
1289
|
+
const d = e + s[l] * r, p = i - n[l] * r;
|
|
1290
|
+
this.mi.moveTo(d, p);
|
|
1259
1291
|
let g = l + 1;
|
|
1260
|
-
for (; g <=
|
|
1261
|
-
if (1 &
|
|
1262
|
-
const m = e +
|
|
1263
|
-
this.
|
|
1292
|
+
for (; g <= f; )
|
|
1293
|
+
if (1 & h[g]) {
|
|
1294
|
+
const m = e + s[g] * r, R = i - n[g] * r;
|
|
1295
|
+
this.mi.lineTo(m, R), g++;
|
|
1264
1296
|
} else {
|
|
1265
|
-
const m = e +
|
|
1266
|
-
let
|
|
1267
|
-
if (1 &
|
|
1268
|
-
const w = e +
|
|
1269
|
-
this.
|
|
1297
|
+
const m = e + s[g] * r, R = i - n[g] * r;
|
|
1298
|
+
let x = g + 1 > f ? l : g + 1;
|
|
1299
|
+
if (1 & h[x]) {
|
|
1300
|
+
const w = e + s[x] * r, C = i - n[x] * r;
|
|
1301
|
+
this.mi.quadraticCurveTo(m, R, w, C), g = x + 1;
|
|
1270
1302
|
} else {
|
|
1271
|
-
const w = (m + (e +
|
|
1272
|
-
this.
|
|
1303
|
+
const w = (m + (e + s[x] * r)) / 2, C = (R + (i - n[x] * r)) / 2;
|
|
1304
|
+
this.mi.quadraticCurveTo(m, R, w, C), g = x;
|
|
1273
1305
|
}
|
|
1274
1306
|
}
|
|
1275
|
-
this.
|
|
1307
|
+
this.mi.closePath();
|
|
1276
1308
|
}
|
|
1277
|
-
l =
|
|
1309
|
+
l = f + 1;
|
|
1278
1310
|
}
|
|
1279
1311
|
}
|
|
1280
|
-
this.
|
|
1312
|
+
this.mi.fill();
|
|
1281
1313
|
}
|
|
1282
1314
|
}
|
|
1283
|
-
class
|
|
1315
|
+
class Ft {
|
|
1284
1316
|
constructor() {
|
|
1285
|
-
|
|
1286
|
-
this.
|
|
1317
|
+
c(this, "ni");
|
|
1318
|
+
this.ni = new z();
|
|
1287
1319
|
}
|
|
1288
1320
|
calculateMaxGlyphDimensions(t, e, i) {
|
|
1289
|
-
let
|
|
1290
|
-
const
|
|
1321
|
+
let r = 0;
|
|
1322
|
+
const s = this.ni.ii(i, e), n = s.lineHeight;
|
|
1291
1323
|
for (const o of t) {
|
|
1292
|
-
const
|
|
1293
|
-
if (
|
|
1294
|
-
const l = this.si
|
|
1295
|
-
|
|
1324
|
+
const h = this.ni.ei(i, o);
|
|
1325
|
+
if (h === 0) continue;
|
|
1326
|
+
const l = this.ni.si(i, h) * s.scale;
|
|
1327
|
+
r = Math.max(r, l);
|
|
1296
1328
|
}
|
|
1297
|
-
return { width: Math.ceil(
|
|
1329
|
+
return { width: Math.ceil(r), height: Math.ceil(n) };
|
|
1298
1330
|
}
|
|
1299
1331
|
getCharacterAdvanceWidth(t, e, i) {
|
|
1300
|
-
const
|
|
1301
|
-
return this.si
|
|
1332
|
+
const r = this.ni.ii(i, e), s = this.ni.ei(i, t);
|
|
1333
|
+
return this.ni.si(i, s) * r.scale;
|
|
1302
1334
|
}
|
|
1303
1335
|
getFontMetrics(t, e) {
|
|
1304
|
-
return this.
|
|
1336
|
+
return this.ni.ii(e, t);
|
|
1305
1337
|
}
|
|
1306
|
-
|
|
1307
|
-
this.
|
|
1338
|
+
ri() {
|
|
1339
|
+
this.ni.ri();
|
|
1308
1340
|
}
|
|
1309
1341
|
}
|
|
1310
|
-
class
|
|
1342
|
+
class _t {
|
|
1311
1343
|
constructor() {
|
|
1312
|
-
|
|
1313
|
-
this.
|
|
1344
|
+
c(this, "yi");
|
|
1345
|
+
this.yi = new z();
|
|
1314
1346
|
}
|
|
1315
1347
|
createCharacterObjects(t, e) {
|
|
1316
|
-
return t.map((i,
|
|
1317
|
-
const
|
|
1348
|
+
return t.map((i, r) => {
|
|
1349
|
+
const s = i.codePointAt(0) || 0, n = this.Ri(r);
|
|
1318
1350
|
let o = 0;
|
|
1319
1351
|
if (e.hmtx && e.hmtx.aWidth) {
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1352
|
+
const h = this.yi.Zs(e, s);
|
|
1353
|
+
h > 0 && e.hmtx.aWidth[h] !== void 0 && (o = e.hmtx.aWidth[h]);
|
|
1322
1354
|
}
|
|
1323
|
-
return { character: i, unicode:
|
|
1355
|
+
return { character: i, unicode: s, color: n, advanceWidth: o };
|
|
1324
1356
|
});
|
|
1325
1357
|
}
|
|
1326
|
-
|
|
1358
|
+
Ri(t) {
|
|
1327
1359
|
return [t % 256 / 255, Math.floor(t / 256) % 256 / 255, Math.floor(t / 65536) % 256 / 255];
|
|
1328
1360
|
}
|
|
1329
|
-
|
|
1330
|
-
if (!
|
|
1331
|
-
const i = e.find((
|
|
1361
|
+
Mi(t, e) {
|
|
1362
|
+
if (!M.M(typeof t == "string", "Character must be a string.", { method: "getCharacterColor", providedValue: t })) return [0, 0, 0];
|
|
1363
|
+
const i = e.find((r) => r.character === t);
|
|
1332
1364
|
return i ? i.color : [0, 0, 0];
|
|
1333
1365
|
}
|
|
1334
|
-
|
|
1335
|
-
return
|
|
1366
|
+
Si(t, e) {
|
|
1367
|
+
return M.M(typeof t == "string" && t.length > 0, "Characters must be a string with at least one character.", { method: "getCharacterColors", providedValue: t }) ? Array.from(t).map((i) => this.Mi(i, e) || [0, 0, 0]) : [[0, 0, 0]];
|
|
1336
1368
|
}
|
|
1337
1369
|
}
|
|
1338
|
-
class
|
|
1370
|
+
class St {
|
|
1339
1371
|
constructor(t, e = 16) {
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
this.
|
|
1353
|
-
}
|
|
1354
|
-
async
|
|
1372
|
+
c(this, "Fi");
|
|
1373
|
+
c(this, "zi", []);
|
|
1374
|
+
c(this, "ki");
|
|
1375
|
+
c(this, "Pi", 16);
|
|
1376
|
+
c(this, "Ti", 0);
|
|
1377
|
+
c(this, "Ai", 0);
|
|
1378
|
+
c(this, "Gi", { width: 0, height: 0 });
|
|
1379
|
+
c(this, "Li");
|
|
1380
|
+
c(this, "Ei");
|
|
1381
|
+
c(this, "Bi");
|
|
1382
|
+
c(this, "Di");
|
|
1383
|
+
c(this, "Wi");
|
|
1384
|
+
this.Pi = e, this.Ei = new At(), this.Bi = new Tt(t), this.Di = new Ft(), this.Wi = new _t();
|
|
1385
|
+
}
|
|
1386
|
+
async Ii(t) {
|
|
1355
1387
|
let e;
|
|
1356
|
-
if (!t) throw new
|
|
1388
|
+
if (!t) throw new E("Embedded font not available. This appears to be a minified build - please provide `fontSource`.");
|
|
1357
1389
|
{
|
|
1358
1390
|
const i = await fetch(t);
|
|
1359
|
-
if (!i.ok) throw new
|
|
1391
|
+
if (!i.ok) throw new E(`Failed to load font file: ${i.status} ${i.statusText}`);
|
|
1360
1392
|
e = await i.arrayBuffer();
|
|
1361
1393
|
}
|
|
1362
|
-
await this.
|
|
1394
|
+
await this.Ui(e), this.Fi = A.parse(e)[0], await this.Vi();
|
|
1363
1395
|
}
|
|
1364
|
-
|
|
1365
|
-
if (t === void 0) return this.
|
|
1366
|
-
this.
|
|
1367
|
-
const e = this.
|
|
1368
|
-
this.
|
|
1396
|
+
Oi(t) {
|
|
1397
|
+
if (t === void 0) return this.Pi;
|
|
1398
|
+
this.Pi = t, this.Gi = this.Di.calculateMaxGlyphDimensions(this.zi.map((i) => i.character), this.Pi, this.Fi);
|
|
1399
|
+
const e = this.Bi.createTextureAtlas(this.zi, this.Gi, this.Pi, this.Fi);
|
|
1400
|
+
this.ki = e.framebuffer, this.Ti = e.columns, this.Ai = e.rows;
|
|
1369
1401
|
}
|
|
1370
|
-
async
|
|
1402
|
+
async Hi(t) {
|
|
1371
1403
|
try {
|
|
1372
1404
|
const e = await fetch(t);
|
|
1373
|
-
if (!e.ok) throw new
|
|
1405
|
+
if (!e.ok) throw new E(`Failed to load font file: ${e.status} ${e.statusText}`);
|
|
1374
1406
|
const i = await e.arrayBuffer();
|
|
1375
|
-
await this.
|
|
1376
|
-
const
|
|
1377
|
-
if (!
|
|
1378
|
-
this.
|
|
1407
|
+
await this.Ui(i);
|
|
1408
|
+
const r = A.parse(i);
|
|
1409
|
+
if (!r || r.length === 0) throw Error("Failed to parse font file");
|
|
1410
|
+
this.Fi = r[0], await this.Vi();
|
|
1379
1411
|
} catch (e) {
|
|
1380
|
-
throw new
|
|
1412
|
+
throw new E("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
|
|
1381
1413
|
}
|
|
1382
1414
|
}
|
|
1383
|
-
async
|
|
1415
|
+
async Ui(t) {
|
|
1384
1416
|
const e = Date.now();
|
|
1385
|
-
this.
|
|
1417
|
+
this.Li = new FontFace("CustomFont_" + e, t), await this.Li.load(), document.fonts.add(this.Li);
|
|
1386
1418
|
}
|
|
1387
|
-
async
|
|
1388
|
-
const t = this.
|
|
1389
|
-
this.
|
|
1390
|
-
const i = this.
|
|
1391
|
-
this.
|
|
1419
|
+
async Vi() {
|
|
1420
|
+
const t = this.Ei.extractCharacters(this.Fi), e = this.Ei.filterProblematicCharacters(t);
|
|
1421
|
+
this.zi = this.Wi.createCharacterObjects(e, this.Fi), this.Gi = this.Di.calculateMaxGlyphDimensions(e, this.Pi, this.Fi);
|
|
1422
|
+
const i = this.Bi.createTextureAtlas(this.zi, this.Gi, this.Pi, this.Fi);
|
|
1423
|
+
this.ki = i.framebuffer, this.Ti = i.columns, this.Ai = i.rows;
|
|
1392
1424
|
}
|
|
1393
|
-
|
|
1394
|
-
return this.
|
|
1425
|
+
Mi(t) {
|
|
1426
|
+
return this.Wi.Mi(t, this.zi);
|
|
1395
1427
|
}
|
|
1396
|
-
|
|
1397
|
-
return this.
|
|
1428
|
+
Si(t) {
|
|
1429
|
+
return this.Wi.Si(t, this.zi);
|
|
1398
1430
|
}
|
|
1399
1431
|
Ut() {
|
|
1400
|
-
this.
|
|
1432
|
+
this.ki.Ut(), document.fonts.delete(this.Li);
|
|
1401
1433
|
}
|
|
1402
1434
|
get fontFramebuffer() {
|
|
1403
|
-
return this.
|
|
1435
|
+
return this.ki;
|
|
1404
1436
|
}
|
|
1405
1437
|
get characters() {
|
|
1406
|
-
return this.
|
|
1438
|
+
return this.zi;
|
|
1407
1439
|
}
|
|
1408
1440
|
get textureColumns() {
|
|
1409
|
-
return this.
|
|
1441
|
+
return this.Ti;
|
|
1410
1442
|
}
|
|
1411
1443
|
get textureRows() {
|
|
1412
|
-
return this.
|
|
1444
|
+
return this.Ai;
|
|
1413
1445
|
}
|
|
1414
1446
|
get maxGlyphDimensions() {
|
|
1415
|
-
return this.
|
|
1447
|
+
return this.Gi;
|
|
1416
1448
|
}
|
|
1417
1449
|
get fontSize() {
|
|
1418
|
-
return this.
|
|
1450
|
+
return this.Pi;
|
|
1419
1451
|
}
|
|
1420
1452
|
get font() {
|
|
1421
|
-
return this.
|
|
1453
|
+
return this.Fi;
|
|
1422
1454
|
}
|
|
1423
1455
|
}
|
|
1424
|
-
class
|
|
1456
|
+
class Lt {
|
|
1425
1457
|
constructor(t, e, i) {
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
this.
|
|
1458
|
+
c(this, "Ki");
|
|
1459
|
+
c(this, "Ni");
|
|
1460
|
+
c(this, "Ct");
|
|
1461
|
+
c(this, "wt");
|
|
1462
|
+
c(this, "Xi");
|
|
1463
|
+
c(this, "ji");
|
|
1464
|
+
c(this, "Yi");
|
|
1465
|
+
c(this, "qi");
|
|
1466
|
+
c(this, "Zi");
|
|
1467
|
+
this.Yi = t, this.qi = e, this.Zi = i, this.rt();
|
|
1436
1468
|
}
|
|
1437
1469
|
rt() {
|
|
1438
|
-
this.
|
|
1470
|
+
this.Ki = Math.floor(this.Yi.width / this.qi), this.Ni = Math.floor(this.Yi.height / this.Zi), this.Ct = this.Ki * this.qi, this.wt = this.Ni * this.Zi, this.Xi = Math.floor((this.Yi.width - this.Ct) / 2), this.ji = Math.floor((this.Yi.height - this.wt) / 2);
|
|
1439
1471
|
}
|
|
1440
|
-
|
|
1441
|
-
this.
|
|
1472
|
+
Ji(t, e) {
|
|
1473
|
+
this.qi = t, this.Zi = e, this.rt();
|
|
1442
1474
|
}
|
|
1443
1475
|
get cellWidth() {
|
|
1444
|
-
return this.
|
|
1476
|
+
return this.qi;
|
|
1445
1477
|
}
|
|
1446
1478
|
get cellHeight() {
|
|
1447
|
-
return this.
|
|
1479
|
+
return this.Zi;
|
|
1448
1480
|
}
|
|
1449
1481
|
get cols() {
|
|
1450
|
-
return this.
|
|
1482
|
+
return this.Ki;
|
|
1451
1483
|
}
|
|
1452
1484
|
get rows() {
|
|
1453
|
-
return this.
|
|
1485
|
+
return this.Ni;
|
|
1454
1486
|
}
|
|
1455
1487
|
get width() {
|
|
1456
|
-
return this
|
|
1488
|
+
return this.Ct;
|
|
1457
1489
|
}
|
|
1458
1490
|
get height() {
|
|
1459
1491
|
return this.wt;
|
|
1460
1492
|
}
|
|
1461
1493
|
get offsetX() {
|
|
1462
|
-
return this.
|
|
1494
|
+
return this.Xi;
|
|
1463
1495
|
}
|
|
1464
1496
|
get offsetY() {
|
|
1465
|
-
return this.
|
|
1497
|
+
return this.ji;
|
|
1466
1498
|
}
|
|
1467
1499
|
}
|
|
1468
|
-
class
|
|
1500
|
+
class Pt {
|
|
1469
1501
|
constructor(t = {}) {
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
t.canvas ? (this.
|
|
1502
|
+
c(this, "Yi");
|
|
1503
|
+
c(this, "Qi");
|
|
1504
|
+
c(this, "tr");
|
|
1505
|
+
t.canvas ? (this.Yi = t.canvas, this.tr = !1) : (this.Yi = this.er(t.width, t.height), this.tr = !0), this.Yi.style.imageRendering = "pixelated";
|
|
1474
1506
|
}
|
|
1475
|
-
|
|
1507
|
+
er(t, e) {
|
|
1476
1508
|
const i = document.createElement("canvas");
|
|
1477
1509
|
return i.className = "textmodeCanvas", i.style.imageRendering = "pixelated", i.width = t || 800, i.height = e || 600, document.body.appendChild(i), i;
|
|
1478
1510
|
}
|
|
1479
|
-
|
|
1480
|
-
this.
|
|
1511
|
+
sr(t, e) {
|
|
1512
|
+
this.Yi.width = t ?? this.Yi.width, this.Yi.height = e ?? this.Yi.height;
|
|
1481
1513
|
}
|
|
1482
|
-
|
|
1483
|
-
const t = this.
|
|
1484
|
-
if (!t) throw new
|
|
1514
|
+
ir() {
|
|
1515
|
+
const t = this.Yi.getContext("webgl2", { alpha: !0, premultipliedAlpha: !1, preserveDrawingBuffer: !0, antialias: !1, depth: !1, stencil: !1, powerPreference: "high-performance" });
|
|
1516
|
+
if (!t) throw new E("`textmode.js` requires WebGL2 support.");
|
|
1485
1517
|
return t;
|
|
1486
1518
|
}
|
|
1487
1519
|
Ut() {
|
|
1488
|
-
this.
|
|
1489
|
-
const t = this.
|
|
1520
|
+
this.Qi && this.Qi.disconnect();
|
|
1521
|
+
const t = this.Yi.getContext("webgl") || this.Yi.getContext("webgl2");
|
|
1490
1522
|
if (t) {
|
|
1491
1523
|
const e = t.getExtension("WEBGL_lose_context");
|
|
1492
1524
|
e && e.loseContext();
|
|
1493
1525
|
}
|
|
1494
|
-
this.
|
|
1526
|
+
this.tr && this.Yi.parentNode && this.Yi.parentNode.removeChild(this.Yi);
|
|
1495
1527
|
}
|
|
1496
1528
|
get canvas() {
|
|
1497
|
-
return this.
|
|
1529
|
+
return this.Yi;
|
|
1498
1530
|
}
|
|
1499
1531
|
get width() {
|
|
1500
|
-
return this.
|
|
1532
|
+
return this.Yi.width;
|
|
1501
1533
|
}
|
|
1502
1534
|
get height() {
|
|
1503
|
-
return this.
|
|
1535
|
+
return this.Yi.height;
|
|
1504
1536
|
}
|
|
1505
1537
|
}
|
|
1506
|
-
class
|
|
1538
|
+
class Mt {
|
|
1507
1539
|
constructor(t = 60) {
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
this.
|
|
1540
|
+
c(this, "rr");
|
|
1541
|
+
c(this, "nr");
|
|
1542
|
+
c(this, "ar", null);
|
|
1543
|
+
c(this, "hr", 0);
|
|
1544
|
+
c(this, "cr", !0);
|
|
1545
|
+
c(this, "lr", 0);
|
|
1546
|
+
c(this, "ur", 0);
|
|
1547
|
+
c(this, "dr", []);
|
|
1548
|
+
c(this, "_r", 10);
|
|
1549
|
+
c(this, "pr", 0);
|
|
1550
|
+
this.rr = t, this.nr = 1e3 / t;
|
|
1519
1551
|
}
|
|
1520
1552
|
start(t) {
|
|
1521
|
-
if (!this.
|
|
1522
|
-
this.
|
|
1553
|
+
if (!this.cr) return;
|
|
1554
|
+
this.hr = performance.now();
|
|
1523
1555
|
const e = (i) => {
|
|
1524
|
-
if (!this.
|
|
1525
|
-
const
|
|
1526
|
-
|
|
1556
|
+
if (!this.cr) return void (this.ar = null);
|
|
1557
|
+
const r = i - this.hr;
|
|
1558
|
+
r >= this.nr && (t(), this.hr = i - r % this.nr), this.cr && (this.ar = requestAnimationFrame(e));
|
|
1527
1559
|
};
|
|
1528
|
-
this.
|
|
1560
|
+
this.ar = requestAnimationFrame(e);
|
|
1529
1561
|
}
|
|
1530
1562
|
stop() {
|
|
1531
|
-
this.
|
|
1563
|
+
this.ar && (cancelAnimationFrame(this.ar), this.ar = null);
|
|
1532
1564
|
}
|
|
1533
1565
|
pause() {
|
|
1534
|
-
this.
|
|
1566
|
+
this.cr && (this.cr = !1, this.stop());
|
|
1535
1567
|
}
|
|
1536
1568
|
resume(t) {
|
|
1537
|
-
this.
|
|
1569
|
+
this.cr || (this.cr = !0, this.start(t));
|
|
1538
1570
|
}
|
|
1539
1571
|
frameRate(t, e) {
|
|
1540
|
-
if (t === void 0) return this.
|
|
1541
|
-
this.
|
|
1572
|
+
if (t === void 0) return this.lr;
|
|
1573
|
+
this.rr = t, this.nr = 1e3 / t, this.cr && e && (this.stop(), this.start(e));
|
|
1542
1574
|
}
|
|
1543
1575
|
measureFrameRate() {
|
|
1544
1576
|
const t = performance.now();
|
|
1545
|
-
if (this.
|
|
1546
|
-
const e = t - this.
|
|
1547
|
-
this.
|
|
1548
|
-
const i = this.
|
|
1549
|
-
this.
|
|
1577
|
+
if (this.ur > 0) {
|
|
1578
|
+
const e = t - this.ur;
|
|
1579
|
+
this.dr.push(e), this.dr.length > this._r && this.dr.shift();
|
|
1580
|
+
const i = this.dr.reduce((r, s) => r + s, 0) / this.dr.length;
|
|
1581
|
+
this.lr = 1e3 / i;
|
|
1550
1582
|
}
|
|
1551
|
-
this.
|
|
1583
|
+
this.ur = t;
|
|
1552
1584
|
}
|
|
1553
1585
|
get isLooping() {
|
|
1554
|
-
return this.
|
|
1586
|
+
return this.cr;
|
|
1555
1587
|
}
|
|
1556
1588
|
get frameRateLimit() {
|
|
1557
|
-
return this.
|
|
1589
|
+
return this.rr;
|
|
1558
1590
|
}
|
|
1559
1591
|
get currentFrameRate() {
|
|
1560
|
-
return this.
|
|
1592
|
+
return this.lr;
|
|
1561
1593
|
}
|
|
1562
1594
|
get frameCount() {
|
|
1563
|
-
return this.
|
|
1595
|
+
return this.pr;
|
|
1564
1596
|
}
|
|
1565
1597
|
set frameCount(t) {
|
|
1566
|
-
this.
|
|
1598
|
+
this.pr = t;
|
|
1567
1599
|
}
|
|
1568
1600
|
incrementFrame() {
|
|
1569
|
-
this.
|
|
1601
|
+
this.pr++;
|
|
1570
1602
|
}
|
|
1571
1603
|
resetFrameCount() {
|
|
1572
|
-
this.
|
|
1604
|
+
this.pr = 0;
|
|
1573
1605
|
}
|
|
1574
1606
|
}
|
|
1575
1607
|
class Ut {
|
|
1576
1608
|
constructor() {
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
}
|
|
1587
|
-
wr() {
|
|
1588
|
-
this.vr || (this.gr = (t) => {
|
|
1589
|
-
this.br(t);
|
|
1590
|
-
}, this.mr = (t) => {
|
|
1591
|
-
this.Rr(t);
|
|
1592
|
-
}, window.addEventListener("keydown", this.gr, { passive: !1 }), window.addEventListener("keyup", this.mr, { passive: !1 }), this.vr = !0);
|
|
1609
|
+
c(this, "gr", /* @__PURE__ */ new Map());
|
|
1610
|
+
c(this, "mr", null);
|
|
1611
|
+
c(this, "vr", null);
|
|
1612
|
+
c(this, "yr");
|
|
1613
|
+
c(this, "$r");
|
|
1614
|
+
c(this, "Cr", !1);
|
|
1615
|
+
c(this, "wr");
|
|
1616
|
+
c(this, "br");
|
|
1617
|
+
c(this, "Rr", { 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" });
|
|
1593
1618
|
}
|
|
1594
1619
|
Mr() {
|
|
1595
|
-
this.
|
|
1620
|
+
this.Cr || (this.yr = (t) => {
|
|
1621
|
+
this.Sr(t);
|
|
1622
|
+
}, this.$r = (t) => {
|
|
1623
|
+
this.Fr(t);
|
|
1624
|
+
}, window.addEventListener("keydown", this.yr, { passive: !1 }), window.addEventListener("keyup", this.$r, { passive: !1 }), this.Cr = !0);
|
|
1596
1625
|
}
|
|
1597
|
-
|
|
1598
|
-
this.yr =
|
|
1626
|
+
zr() {
|
|
1627
|
+
this.Cr && (window.removeEventListener("keydown", this.yr), window.removeEventListener("keyup", this.$r), this.Cr = !1, this.gr.clear(), this.mr = null, this.vr = null);
|
|
1599
1628
|
}
|
|
1600
|
-
|
|
1601
|
-
this.
|
|
1629
|
+
kr(t) {
|
|
1630
|
+
this.wr = t;
|
|
1631
|
+
}
|
|
1632
|
+
Pr(t) {
|
|
1633
|
+
this.br = t;
|
|
1602
1634
|
}
|
|
1603
|
-
|
|
1604
|
-
const e = this.
|
|
1635
|
+
Tr(t) {
|
|
1636
|
+
const e = this.Ar(t), i = this.gr.get(t) || this.gr.get(e);
|
|
1605
1637
|
return (i == null ? void 0 : i.isPressed) || !1;
|
|
1606
1638
|
}
|
|
1607
|
-
|
|
1608
|
-
return this.
|
|
1639
|
+
Gr() {
|
|
1640
|
+
return this.mr;
|
|
1609
1641
|
}
|
|
1610
|
-
|
|
1611
|
-
return this.
|
|
1642
|
+
Lr() {
|
|
1643
|
+
return this.vr;
|
|
1612
1644
|
}
|
|
1613
|
-
|
|
1645
|
+
Er() {
|
|
1614
1646
|
const t = [];
|
|
1615
|
-
for (const [e, i] of this.
|
|
1647
|
+
for (const [e, i] of this.gr) i.isPressed && t.push(e);
|
|
1616
1648
|
return t;
|
|
1617
1649
|
}
|
|
1618
|
-
|
|
1619
|
-
return { ctrl: this.
|
|
1650
|
+
Br() {
|
|
1651
|
+
return { ctrl: this.Tr("Control"), shift: this.Tr("Shift"), alt: this.Tr("Alt"), meta: this.Tr("Meta") };
|
|
1620
1652
|
}
|
|
1621
|
-
|
|
1622
|
-
this.
|
|
1653
|
+
Dr() {
|
|
1654
|
+
this.gr.clear(), this.mr = null, this.vr = null;
|
|
1623
1655
|
}
|
|
1624
|
-
|
|
1656
|
+
Sr(t) {
|
|
1625
1657
|
const e = t.key, i = Date.now();
|
|
1626
|
-
this.
|
|
1627
|
-
const
|
|
1628
|
-
if (!
|
|
1629
|
-
const
|
|
1630
|
-
this.
|
|
1658
|
+
this.gr.has(e) || this.gr.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
1659
|
+
const r = this.gr.get(e);
|
|
1660
|
+
if (!r.isPressed && (r.isPressed = !0, r.lastPressTime = i, this.mr = e, this.wr)) {
|
|
1661
|
+
const s = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !0, originalEvent: t };
|
|
1662
|
+
this.wr(s);
|
|
1631
1663
|
}
|
|
1632
1664
|
}
|
|
1633
|
-
|
|
1665
|
+
Fr(t) {
|
|
1634
1666
|
const e = t.key, i = Date.now();
|
|
1635
|
-
this.
|
|
1636
|
-
const
|
|
1637
|
-
if (
|
|
1638
|
-
const
|
|
1639
|
-
this.
|
|
1667
|
+
this.gr.has(e) || this.gr.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
1668
|
+
const r = this.gr.get(e);
|
|
1669
|
+
if (r.isPressed = !1, r.lastReleaseTime = i, this.vr = e, this.br) {
|
|
1670
|
+
const s = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !1, originalEvent: t };
|
|
1671
|
+
this.br(s);
|
|
1640
1672
|
}
|
|
1641
1673
|
}
|
|
1642
|
-
|
|
1643
|
-
return this
|
|
1674
|
+
Ar(t) {
|
|
1675
|
+
return this.Rr[t] || t.toLowerCase();
|
|
1644
1676
|
}
|
|
1645
1677
|
}
|
|
1646
|
-
class
|
|
1678
|
+
class It {
|
|
1647
1679
|
constructor(t) {
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
this.
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1668
|
-
this.
|
|
1669
|
-
}
|
|
1670
|
-
wr() {
|
|
1671
|
-
if (this.vr) return;
|
|
1672
|
-
const t = this.Ni.canvas;
|
|
1673
|
-
this.Ir = (e) => {
|
|
1674
|
-
this.Jr(e), this.Qr(e);
|
|
1675
|
-
}, this.Ur = () => {
|
|
1676
|
-
this.Dr = { ...this.Br }, this.Br.x = -1, this.Br.y = -1, this.Wr = null;
|
|
1677
|
-
}, this.Or = (e) => {
|
|
1678
|
-
this.Jr(e), this.tn(e);
|
|
1679
|
-
}, this.Vr = (e) => {
|
|
1680
|
-
this.Jr(e), this.en(e);
|
|
1681
|
-
}, this.Hr = (e) => {
|
|
1682
|
-
this.Jr(e), this.sn(e);
|
|
1683
|
-
}, this.Kr = (e) => {
|
|
1684
|
-
this.Jr(e), this.rn(e);
|
|
1685
|
-
}, t.addEventListener("mousemove", this.Ir, { passive: !0 }), t.addEventListener("mouseleave", this.Ur, { passive: !0 }), t.addEventListener("mousedown", this.Or, { passive: !0 }), t.addEventListener("mouseup", this.Vr, { passive: !0 }), t.addEventListener("click", this.Hr, { passive: !0 }), t.addEventListener("wheel", this.Kr, { passive: !1 }), this.vr = !0;
|
|
1680
|
+
c(this, "Yi");
|
|
1681
|
+
c(this, "Wr");
|
|
1682
|
+
c(this, "Ir", { x: -1, y: -1 });
|
|
1683
|
+
c(this, "Ur", { x: -1, y: -1 });
|
|
1684
|
+
c(this, "Vr", null);
|
|
1685
|
+
c(this, "Or");
|
|
1686
|
+
c(this, "Hr");
|
|
1687
|
+
c(this, "Kr");
|
|
1688
|
+
c(this, "Nr");
|
|
1689
|
+
c(this, "Xr");
|
|
1690
|
+
c(this, "jr");
|
|
1691
|
+
c(this, "Cr", !1);
|
|
1692
|
+
c(this, "Yr");
|
|
1693
|
+
c(this, "qr");
|
|
1694
|
+
c(this, "Zr");
|
|
1695
|
+
c(this, "Jr");
|
|
1696
|
+
c(this, "Qr");
|
|
1697
|
+
this.Yi = t;
|
|
1698
|
+
}
|
|
1699
|
+
Ii(t) {
|
|
1700
|
+
this.Wr = t, this.tn();
|
|
1686
1701
|
}
|
|
1687
1702
|
Mr() {
|
|
1688
|
-
if (
|
|
1689
|
-
const t = this.
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1703
|
+
if (this.Cr) return;
|
|
1704
|
+
const t = this.Yi.canvas;
|
|
1705
|
+
this.Or = (e) => {
|
|
1706
|
+
this.en(e), this.sn(e);
|
|
1707
|
+
}, this.Hr = () => {
|
|
1708
|
+
this.Ur = { ...this.Ir }, this.Ir.x = -1, this.Ir.y = -1, this.Vr = null;
|
|
1709
|
+
}, this.Kr = (e) => {
|
|
1710
|
+
this.en(e), this.rn(e);
|
|
1711
|
+
}, this.Nr = (e) => {
|
|
1712
|
+
this.en(e), this.nn(e);
|
|
1713
|
+
}, this.Xr = (e) => {
|
|
1714
|
+
this.en(e), this.an(e);
|
|
1715
|
+
}, this.jr = (e) => {
|
|
1716
|
+
this.en(e), this.hn(e);
|
|
1717
|
+
}, t.addEventListener("mousemove", this.Or, { passive: !0 }), t.addEventListener("mouseleave", this.Hr, { passive: !0 }), t.addEventListener("mousedown", this.Kr, { passive: !0 }), t.addEventListener("mouseup", this.Nr, { passive: !0 }), t.addEventListener("click", this.Xr, { passive: !0 }), t.addEventListener("wheel", this.jr, { passive: !1 }), this.Cr = !0;
|
|
1718
|
+
}
|
|
1719
|
+
zr() {
|
|
1720
|
+
if (!this.Cr) return;
|
|
1721
|
+
const t = this.Yi.canvas;
|
|
1722
|
+
t.removeEventListener("mousemove", this.Or), t.removeEventListener("mouseleave", this.Hr), t.removeEventListener("mousedown", this.Kr), t.removeEventListener("mouseup", this.Nr), t.removeEventListener("click", this.Xr), t.removeEventListener("wheel", this.jr), this.Cr = !1;
|
|
1723
|
+
}
|
|
1724
|
+
tn() {
|
|
1725
|
+
if (this.Cr) try {
|
|
1726
|
+
if (this.Vr) {
|
|
1727
|
+
const t = new MouseEvent("mousemove", { clientX: this.Vr.x, clientY: this.Vr.y, bubbles: !1, cancelable: !1 });
|
|
1728
|
+
this.en(t);
|
|
1729
|
+
} else this.Ir.x !== -1 && this.Ir.y !== -1 && (this.Ir.x >= this.Wr.cols || this.Ir.y >= this.Wr.rows) && (this.Ir.x = -1, this.Ir.y = -1);
|
|
1698
1730
|
} catch {
|
|
1699
|
-
this.
|
|
1731
|
+
this.Ir.x = -1, this.Ir.y = -1;
|
|
1700
1732
|
}
|
|
1701
1733
|
}
|
|
1702
|
-
|
|
1703
|
-
this.Nr = t;
|
|
1704
|
-
}
|
|
1705
|
-
Sr(t) {
|
|
1706
|
-
this.Xr = t;
|
|
1707
|
-
}
|
|
1708
|
-
Fr(t) {
|
|
1709
|
-
this.jr = t;
|
|
1710
|
-
}
|
|
1711
|
-
an(t) {
|
|
1734
|
+
cn(t) {
|
|
1712
1735
|
this.Yr = t;
|
|
1713
1736
|
}
|
|
1714
|
-
|
|
1737
|
+
kr(t) {
|
|
1715
1738
|
this.qr = t;
|
|
1716
1739
|
}
|
|
1717
|
-
|
|
1718
|
-
|
|
1740
|
+
Pr(t) {
|
|
1741
|
+
this.Zr = t;
|
|
1719
1742
|
}
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
const e = { position: { ...this.Br }, previousPosition: { ...this.Dr }, originalEvent: t };
|
|
1723
|
-
this.Yr(e);
|
|
1724
|
-
}
|
|
1743
|
+
ln(t) {
|
|
1744
|
+
this.Jr = t;
|
|
1725
1745
|
}
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
const e = { position: { ...this.Br }, previousPosition: { ...this.Dr }, button: t.button, originalEvent: t };
|
|
1729
|
-
this.Xr(e);
|
|
1730
|
-
}
|
|
1746
|
+
un(t) {
|
|
1747
|
+
this.Qr = t;
|
|
1731
1748
|
}
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
const e = { position: { ...this.Br }, previousPosition: { ...this.Dr }, button: t.button, originalEvent: t };
|
|
1735
|
-
this.jr(e);
|
|
1736
|
-
}
|
|
1749
|
+
fn() {
|
|
1750
|
+
return { x: this.Ir.x, y: this.Ir.y };
|
|
1737
1751
|
}
|
|
1738
1752
|
sn(t) {
|
|
1739
|
-
if (this.
|
|
1740
|
-
const e = { position: { ...this.
|
|
1741
|
-
this.
|
|
1753
|
+
if (this.Jr) {
|
|
1754
|
+
const e = { position: { ...this.Ir }, previousPosition: { ...this.Ur }, originalEvent: t };
|
|
1755
|
+
this.Jr(e);
|
|
1742
1756
|
}
|
|
1743
1757
|
}
|
|
1744
1758
|
rn(t) {
|
|
1745
1759
|
if (this.qr) {
|
|
1746
|
-
const e = { position: { ...this.
|
|
1760
|
+
const e = { position: { ...this.Ir }, previousPosition: { ...this.Ur }, button: t.button, originalEvent: t };
|
|
1747
1761
|
this.qr(e);
|
|
1748
1762
|
}
|
|
1749
1763
|
}
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1764
|
+
nn(t) {
|
|
1765
|
+
if (this.Zr) {
|
|
1766
|
+
const e = { position: { ...this.Ir }, previousPosition: { ...this.Ur }, button: t.button, originalEvent: t };
|
|
1767
|
+
this.Zr(e);
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
an(t) {
|
|
1771
|
+
if (this.Yr) {
|
|
1772
|
+
const e = { position: { ...this.Ir }, previousPosition: { ...this.Ur }, button: t.button, originalEvent: t };
|
|
1773
|
+
this.Yr(e);
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
hn(t) {
|
|
1777
|
+
if (this.Qr) {
|
|
1778
|
+
const e = { position: { ...this.Ir }, previousPosition: { ...this.Ur }, delta: { x: t.deltaX, y: t.deltaY }, originalEvent: t };
|
|
1779
|
+
this.Qr(e);
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
en(t) {
|
|
1783
|
+
const e = this.Yi.canvas;
|
|
1784
|
+
this.Ur = { ...this.Ir }, this.Vr = { x: t.clientX, y: t.clientY };
|
|
1785
|
+
const i = e.getBoundingClientRect(), r = t.clientX - i.left, s = t.clientY - i.top, n = e.width / i.width, o = s * (e.height / i.height), h = r * n - this.Wr.offsetX, l = o - this.Wr.offsetY, u = Math.floor(h / this.Wr.cellWidth), f = Math.floor(l / this.Wr.cellHeight);
|
|
1786
|
+
u >= 0 && u < this.Wr.cols && f >= 0 && f < this.Wr.rows ? (this.Ir.x = u, this.Ir.y = f) : (this.Ir.x = -1, this.Ir.y = -1);
|
|
1755
1787
|
}
|
|
1756
1788
|
}
|
|
1757
|
-
const
|
|
1789
|
+
const kt = (a) => class extends a {
|
|
1758
1790
|
rotate(t = 0, e = 0, i = 0) {
|
|
1759
|
-
this.
|
|
1791
|
+
this.kt.state.ht(t), this.kt.state.ct(e), this.kt.state.lt(i);
|
|
1760
1792
|
}
|
|
1761
1793
|
rotateX(t) {
|
|
1762
|
-
this.
|
|
1794
|
+
this.kt.state.ht(t);
|
|
1763
1795
|
}
|
|
1764
1796
|
rotateY(t) {
|
|
1765
|
-
this.
|
|
1797
|
+
this.kt.state.ct(t);
|
|
1766
1798
|
}
|
|
1767
1799
|
rotateZ(t) {
|
|
1768
|
-
this.
|
|
1800
|
+
this.kt.state.lt(t);
|
|
1769
1801
|
}
|
|
1770
1802
|
push() {
|
|
1771
|
-
this.
|
|
1803
|
+
this.kt.state.N();
|
|
1772
1804
|
}
|
|
1773
1805
|
pop() {
|
|
1774
|
-
this.
|
|
1806
|
+
this.kt.state.it();
|
|
1775
1807
|
}
|
|
1776
|
-
rect(t, e, i = 1,
|
|
1777
|
-
this.
|
|
1808
|
+
rect(t, e, i = 1, r = 1) {
|
|
1809
|
+
this.kt.Es(t, e, i, r);
|
|
1778
1810
|
}
|
|
1779
1811
|
point(t, e) {
|
|
1780
|
-
this.
|
|
1812
|
+
this.kt.Es(t, e, 1, 1);
|
|
1781
1813
|
}
|
|
1782
|
-
line(t, e, i,
|
|
1783
|
-
this.
|
|
1814
|
+
line(t, e, i, r) {
|
|
1815
|
+
this.kt.Bs(t, e, i, r);
|
|
1784
1816
|
}
|
|
1785
1817
|
lineWeight(t) {
|
|
1786
|
-
this.
|
|
1818
|
+
this.kt.state.ot(t);
|
|
1787
1819
|
}
|
|
1788
|
-
background(t, e = t, i = t,
|
|
1789
|
-
this.
|
|
1820
|
+
background(t, e = t, i = t, r = 255) {
|
|
1821
|
+
this.kt.Os(t, e, i, r);
|
|
1790
1822
|
}
|
|
1791
1823
|
char(t) {
|
|
1792
|
-
this.
|
|
1824
|
+
this.kt.state.ut(this.Fi.Mi(t));
|
|
1793
1825
|
}
|
|
1794
1826
|
charColor(t, e, i) {
|
|
1795
|
-
this.
|
|
1827
|
+
this.kt.state.ft(t, e, i);
|
|
1796
1828
|
}
|
|
1797
1829
|
cellColor(t, e, i) {
|
|
1798
|
-
this.
|
|
1830
|
+
this.kt.state.dt(t, e, i);
|
|
1799
1831
|
}
|
|
1800
1832
|
flipX(t) {
|
|
1801
|
-
this.
|
|
1833
|
+
this.kt.state._t(t);
|
|
1802
1834
|
}
|
|
1803
1835
|
flipY(t) {
|
|
1804
|
-
this.
|
|
1836
|
+
this.kt.state.gt(t);
|
|
1805
1837
|
}
|
|
1806
1838
|
charRotation(t) {
|
|
1807
|
-
this.
|
|
1839
|
+
this.kt.state.yt(t);
|
|
1808
1840
|
}
|
|
1809
1841
|
invert(t) {
|
|
1810
|
-
this.
|
|
1842
|
+
this.kt.state.vt(t);
|
|
1811
1843
|
}
|
|
1812
1844
|
clear() {
|
|
1813
|
-
this.
|
|
1845
|
+
this.kt.Os(0, 0, 0, 0);
|
|
1814
1846
|
}
|
|
1815
|
-
ellipse(t, e, i,
|
|
1816
|
-
this.
|
|
1847
|
+
ellipse(t, e, i, r) {
|
|
1848
|
+
this.kt.Ds(t, e, i / 2, r / 2);
|
|
1817
1849
|
}
|
|
1818
|
-
triangle(t, e, i,
|
|
1819
|
-
this.
|
|
1850
|
+
triangle(t, e, i, r, s, n) {
|
|
1851
|
+
this.kt.Ws(t, e, i, r, s, n);
|
|
1820
1852
|
}
|
|
1821
|
-
bezierCurve(t, e, i,
|
|
1822
|
-
this.
|
|
1853
|
+
bezierCurve(t, e, i, r, s, n, o, h) {
|
|
1854
|
+
this.kt.Is(t, e, i, r, s, n, o, h);
|
|
1823
1855
|
}
|
|
1824
|
-
arc(t, e, i,
|
|
1825
|
-
this.
|
|
1856
|
+
arc(t, e, i, r, s, n) {
|
|
1857
|
+
this.kt.Vs(t, e, i, r, s, n);
|
|
1826
1858
|
}
|
|
1827
1859
|
shader(t) {
|
|
1828
|
-
this.
|
|
1860
|
+
this.kt.Ts(t);
|
|
1829
1861
|
}
|
|
1830
1862
|
setUniform(t, e) {
|
|
1831
|
-
this.
|
|
1863
|
+
this.kt.Jt(t, e);
|
|
1832
1864
|
}
|
|
1833
1865
|
setUniforms(t) {
|
|
1834
|
-
this.
|
|
1866
|
+
this.kt.As(t);
|
|
1835
1867
|
}
|
|
1836
1868
|
createFilterShader(t) {
|
|
1837
|
-
return this.
|
|
1869
|
+
return this.kt.he(t);
|
|
1838
1870
|
}
|
|
1839
1871
|
createFramebuffer(t) {
|
|
1840
|
-
return this.
|
|
1872
|
+
return this.kt.Us(t.width, t.height, 5, { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte" });
|
|
1841
1873
|
}
|
|
1842
|
-
image(t, e, i,
|
|
1843
|
-
this.
|
|
1874
|
+
image(t, e, i, r, s) {
|
|
1875
|
+
this.kt.Gs(t, e, i, r ?? t.width, s ?? t.height);
|
|
1844
1876
|
}
|
|
1845
1877
|
};
|
|
1846
|
-
class
|
|
1847
|
-
|
|
1848
|
-
const e = t.Et(0), i = t.Et(1),
|
|
1849
|
-
return { characterPixels: e, primaryColorPixels: i, secondaryColorPixels:
|
|
1878
|
+
class $ {
|
|
1879
|
+
dn(t) {
|
|
1880
|
+
const e = t.Et(0), i = t.Et(1), r = t.Et(2), s = t.Et(3);
|
|
1881
|
+
return { characterPixels: e, primaryColorPixels: i, secondaryColorPixels: r, transformPixels: t.Et(4), rotationPixels: s };
|
|
1850
1882
|
}
|
|
1851
|
-
|
|
1883
|
+
_n(t, e) {
|
|
1852
1884
|
return t[e] + (t[e + 1] << 8);
|
|
1853
1885
|
}
|
|
1854
|
-
|
|
1886
|
+
pn(t, e) {
|
|
1855
1887
|
return { r: t[e], g: t[e + 1], b: t[e + 2], a: t[e + 3] };
|
|
1856
1888
|
}
|
|
1857
1889
|
}
|
|
1858
|
-
class
|
|
1859
|
-
|
|
1890
|
+
class O {
|
|
1891
|
+
gn(t, e) {
|
|
1860
1892
|
return new Blob([t], { type: e });
|
|
1861
1893
|
}
|
|
1862
|
-
|
|
1894
|
+
mn(t, e, i) {
|
|
1863
1895
|
try {
|
|
1864
|
-
const
|
|
1865
|
-
n.href =
|
|
1866
|
-
} catch (
|
|
1867
|
-
throw console.error("Failed to download file:",
|
|
1896
|
+
const r = this.gn(t, i), s = URL.createObjectURL(r), n = document.createElement("a");
|
|
1897
|
+
n.href = s, n.download = e, n.style.display = "none", n.rel = "noopener", document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(s);
|
|
1898
|
+
} catch (r) {
|
|
1899
|
+
throw console.error("Failed to download file:", r), Error("File download failed: " + (r instanceof Error ? r.message : "Unknown error"));
|
|
1868
1900
|
}
|
|
1869
1901
|
}
|
|
1870
|
-
|
|
1902
|
+
vn() {
|
|
1871
1903
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace(/:/g, "-");
|
|
1872
1904
|
}
|
|
1873
|
-
|
|
1905
|
+
yn() {
|
|
1874
1906
|
const t = /* @__PURE__ */ new Date();
|
|
1875
1907
|
return { date: t.toISOString().split("T")[0], time: t.toTimeString().split(" ")[0].replace(/:/g, "-") };
|
|
1876
1908
|
}
|
|
1877
|
-
|
|
1909
|
+
$n(t) {
|
|
1878
1910
|
return t.replace(/[<>:"/\\|?*]/g, "_").replace(/\s+/g, "_").replace(/_{2,}/g, "_").replace(/^_+|_+$/g, "").substring(0, 255);
|
|
1879
1911
|
}
|
|
1880
|
-
|
|
1881
|
-
return "textmode-export-" + this.
|
|
1912
|
+
Cn() {
|
|
1913
|
+
return "textmode-export-" + this.vn();
|
|
1882
1914
|
}
|
|
1883
1915
|
}
|
|
1884
|
-
class
|
|
1885
|
-
|
|
1886
|
-
const
|
|
1887
|
-
return { isInverted:
|
|
1916
|
+
class zt extends $ {
|
|
1917
|
+
wn(t, e, i) {
|
|
1918
|
+
const r = t[i] === 255, s = t[i + 1] === 255, n = t[i + 2] === 255, o = e[i], h = e[i + 1];
|
|
1919
|
+
return { isInverted: r, flipHorizontal: s, flipVertical: n, rotation: Math.round(360 * (o + h / 255) / 255 * 100) / 100 };
|
|
1888
1920
|
}
|
|
1889
|
-
|
|
1921
|
+
xn(t, e, i) {
|
|
1890
1922
|
return { x: t, y: e, cellX: t * i.cellWidth, cellY: e * i.cellHeight };
|
|
1891
1923
|
}
|
|
1892
|
-
|
|
1924
|
+
bn(t, e) {
|
|
1893
1925
|
const i = [];
|
|
1894
|
-
let
|
|
1895
|
-
for (let
|
|
1896
|
-
const o = 4 *
|
|
1897
|
-
let l = this.
|
|
1898
|
-
const
|
|
1899
|
-
if (
|
|
1926
|
+
let r = 0;
|
|
1927
|
+
for (let s = 0; s < e.rows; s++) for (let n = 0; n < e.cols; n++) {
|
|
1928
|
+
const o = 4 * r, h = this._n(t.characterPixels, o);
|
|
1929
|
+
let l = this.pn(t.primaryColorPixels, o), u = this.pn(t.secondaryColorPixels, o);
|
|
1930
|
+
const f = this.wn(t.transformPixels, t.rotationPixels, o);
|
|
1931
|
+
if (f.isInverted) {
|
|
1900
1932
|
const p = l;
|
|
1901
|
-
l =
|
|
1933
|
+
l = u, u = p;
|
|
1902
1934
|
}
|
|
1903
|
-
const d = this.
|
|
1904
|
-
i.push({ charIndex:
|
|
1935
|
+
const d = this.xn(n, s, e);
|
|
1936
|
+
i.push({ charIndex: h, primaryColor: l, secondaryColor: u, transform: f, position: d }), r++;
|
|
1905
1937
|
}
|
|
1906
1938
|
return i;
|
|
1907
1939
|
}
|
|
1908
1940
|
}
|
|
1909
|
-
class
|
|
1910
|
-
|
|
1941
|
+
class Wt {
|
|
1942
|
+
Rn(t, e) {
|
|
1911
1943
|
const i = t.cmap;
|
|
1912
|
-
for (const
|
|
1913
|
-
const
|
|
1914
|
-
for (let n = 0; n <
|
|
1915
|
-
if (
|
|
1944
|
+
for (const r of i.tables) if (r.format === 4) {
|
|
1945
|
+
const s = r;
|
|
1946
|
+
for (let n = 0; n < s.startCount.length; n++) if (e >= s.startCount[n] && e <= s.endCount[n]) {
|
|
1947
|
+
if (s.idRangeOffset[n] === 0) return e + s.idDelta[n] & 65535;
|
|
1916
1948
|
{
|
|
1917
|
-
const o =
|
|
1918
|
-
if (o >= 0 && o <
|
|
1919
|
-
const
|
|
1920
|
-
if (
|
|
1949
|
+
const o = s.idRangeOffset[n] / 2 + (e - s.startCount[n]) - (s.startCount.length - n);
|
|
1950
|
+
if (o >= 0 && o < s.glyphIdArray.length) {
|
|
1951
|
+
const h = s.glyphIdArray[o];
|
|
1952
|
+
if (h !== 0) return h + s.idDelta[n] & 65535;
|
|
1921
1953
|
}
|
|
1922
1954
|
}
|
|
1923
1955
|
}
|
|
1924
|
-
} else if (
|
|
1925
|
-
const
|
|
1926
|
-
for (let n = 0; n <
|
|
1927
|
-
const o =
|
|
1928
|
-
if (e >= o && e <=
|
|
1956
|
+
} else if (r.format === 12) {
|
|
1957
|
+
const s = r;
|
|
1958
|
+
for (let n = 0; n < s.groups.length; n += 3) {
|
|
1959
|
+
const o = s.groups[n], h = s.groups[n + 1], l = s.groups[n + 2];
|
|
1960
|
+
if (e >= o && e <= h) return l + (e - o);
|
|
1929
1961
|
}
|
|
1930
1962
|
}
|
|
1931
1963
|
return 0;
|
|
1932
1964
|
}
|
|
1933
|
-
|
|
1934
|
-
const n =
|
|
1935
|
-
return { getBoundingBox: () => ({ x1: i + e.xMin * n, y1:
|
|
1965
|
+
Mn(t, e, i, r, s) {
|
|
1966
|
+
const n = s / t.head.unitsPerEm;
|
|
1967
|
+
return { getBoundingBox: () => ({ x1: i + e.xMin * n, y1: r + -e.yMax * n, x2: i + e.xMax * n, y2: r + -e.yMin * n }), toSVG: () => this.Sn(e, i, r, n) };
|
|
1936
1968
|
}
|
|
1937
|
-
|
|
1969
|
+
Sn(t, e, i, r) {
|
|
1938
1970
|
if (!t || !t.xs) return "";
|
|
1939
|
-
const { xs:
|
|
1940
|
-
if (!(
|
|
1941
|
-
let l = "",
|
|
1942
|
-
for (let
|
|
1943
|
-
const d = o[
|
|
1944
|
-
if (!(d <
|
|
1945
|
-
if (d >=
|
|
1946
|
-
const p = e +
|
|
1971
|
+
const { xs: s, ys: n, endPts: o, flags: h } = t;
|
|
1972
|
+
if (!(s && n && o && h)) return "";
|
|
1973
|
+
let l = "", u = 0;
|
|
1974
|
+
for (let f = 0; f < o.length; f++) {
|
|
1975
|
+
const d = o[f];
|
|
1976
|
+
if (!(d < u)) {
|
|
1977
|
+
if (d >= u) {
|
|
1978
|
+
const p = e + s[u] * r, g = i - n[u] * r;
|
|
1947
1979
|
l += `M${p.toFixed(2)},${g.toFixed(2)}`;
|
|
1948
|
-
let m =
|
|
1980
|
+
let m = u + 1;
|
|
1949
1981
|
for (; m <= d; )
|
|
1950
|
-
if (1 &
|
|
1951
|
-
const
|
|
1952
|
-
l += `L${
|
|
1982
|
+
if (1 & h[m]) {
|
|
1983
|
+
const R = e + s[m] * r, x = i - n[m] * r;
|
|
1984
|
+
l += `L${R.toFixed(2)},${x.toFixed(2)}`, m++;
|
|
1953
1985
|
} else {
|
|
1954
|
-
const
|
|
1955
|
-
let w = m + 1 > d ?
|
|
1956
|
-
if (1 &
|
|
1957
|
-
const C = e +
|
|
1958
|
-
l += `Q${
|
|
1986
|
+
const R = e + s[m] * r, x = i - n[m] * r;
|
|
1987
|
+
let w = m + 1 > d ? u : m + 1;
|
|
1988
|
+
if (1 & h[w]) {
|
|
1989
|
+
const C = e + s[w] * r, L = i - n[w] * r;
|
|
1990
|
+
l += `Q${R.toFixed(2)},${x.toFixed(2)} ${C.toFixed(2)},${L.toFixed(2)}`, m = w + 1;
|
|
1959
1991
|
} else {
|
|
1960
|
-
const C = (
|
|
1961
|
-
l += `Q${
|
|
1992
|
+
const C = (R + (e + s[w] * r)) / 2, L = (x + (i - n[w] * r)) / 2;
|
|
1993
|
+
l += `Q${R.toFixed(2)},${x.toFixed(2)} ${C.toFixed(2)},${L.toFixed(2)}`, m = w;
|
|
1962
1994
|
}
|
|
1963
1995
|
}
|
|
1964
1996
|
l += "Z";
|
|
1965
1997
|
}
|
|
1966
|
-
|
|
1998
|
+
u = d + 1;
|
|
1967
1999
|
}
|
|
1968
2000
|
}
|
|
1969
2001
|
return l;
|
|
1970
2002
|
}
|
|
1971
|
-
|
|
1972
|
-
const n = t.codePointAt(0) || 0, o = this.
|
|
1973
|
-
let
|
|
1974
|
-
return e.glyf && e.glyf[o] !== null ?
|
|
2003
|
+
Fn(t, e, i, r, s) {
|
|
2004
|
+
const n = t.codePointAt(0) || 0, o = this.Rn(e, n);
|
|
2005
|
+
let h = null;
|
|
2006
|
+
return e.glyf && e.glyf[o] !== null ? h = e.glyf[o] : (h = A.T.glyf.Ks(e, o), e.glyf[o] = h), this.Mn(e, h, i, r, s);
|
|
1975
2007
|
}
|
|
1976
|
-
|
|
1977
|
-
const l = i + (
|
|
1978
|
-
return this.
|
|
2008
|
+
zn(t, e, i, r, s, n, o, h) {
|
|
2009
|
+
const l = i + (s - h * (o / e.head.unitsPerEm)) / 2, u = r + (n + 0.7 * o) / 2;
|
|
2010
|
+
return this.Fn(t, e, l, u, o).toSVG() || null;
|
|
1979
2011
|
}
|
|
1980
2012
|
}
|
|
1981
|
-
class
|
|
2013
|
+
class Bt {
|
|
1982
2014
|
constructor() {
|
|
1983
|
-
|
|
1984
|
-
this.
|
|
2015
|
+
c(this, "kn");
|
|
2016
|
+
this.kn = new Wt();
|
|
1985
2017
|
}
|
|
1986
|
-
|
|
2018
|
+
Pn(t) {
|
|
1987
2019
|
const { width: e, height: i } = t;
|
|
1988
2020
|
return `<?xml version="1.0" encoding="UTF-8"?><svg width="${e}" height="${i}" viewBox="0 0 ${e} ${i}" xmlns="http://www.w3.org/2000/svg"><title>textmode.js sketch</title>`;
|
|
1989
2021
|
}
|
|
1990
|
-
|
|
2022
|
+
Tn() {
|
|
1991
2023
|
return "</g></svg>";
|
|
1992
2024
|
}
|
|
1993
|
-
|
|
2025
|
+
An(t, e) {
|
|
1994
2026
|
if (!e.includeBackgroundRectangles) return "";
|
|
1995
|
-
const [i,
|
|
1996
|
-
return `<rect width="${t.width}" height="${t.height}" fill="rgba(${i},${
|
|
2027
|
+
const [i, r, s, n] = e.backgroundColor;
|
|
2028
|
+
return `<rect width="${t.width}" height="${t.height}" fill="rgba(${i},${r},${s},${n / 255})"/>`;
|
|
1997
2029
|
}
|
|
1998
|
-
|
|
1999
|
-
const { transform: i, position:
|
|
2030
|
+
Gn(t, e) {
|
|
2031
|
+
const { transform: i, position: r } = t;
|
|
2000
2032
|
if (!i.flipHorizontal && !i.flipVertical && !i.rotation) return "";
|
|
2001
|
-
const
|
|
2033
|
+
const s = r.cellX + e.cellWidth / 2, n = r.cellY + e.cellHeight / 2, o = [];
|
|
2002
2034
|
if (i.flipHorizontal || i.flipVertical) {
|
|
2003
|
-
const
|
|
2004
|
-
o.push(`translate(${
|
|
2035
|
+
const h = i.flipHorizontal ? -1 : 1, l = i.flipVertical ? -1 : 1;
|
|
2036
|
+
o.push(`translate(${s} ${n})scale(${h} ${l})translate(${-s} ${-n})`);
|
|
2005
2037
|
}
|
|
2006
|
-
return i.rotation && o.push(`rotate(${i.rotation} ${
|
|
2038
|
+
return i.rotation && o.push(`rotate(${i.rotation} ${s} ${n})`), ` transform="${o.join(" ")}"`;
|
|
2007
2039
|
}
|
|
2008
|
-
|
|
2040
|
+
Ln(t, e, i) {
|
|
2009
2041
|
if (!i.includeBackgroundRectangles || t.secondaryColor.a === 0) return "";
|
|
2010
|
-
const { position:
|
|
2011
|
-
return i.drawMode === "stroke" ? `<rect x="${
|
|
2042
|
+
const { position: r } = t, { r: s, g: n, b: o, a: h } = t.secondaryColor, l = `rgba(${s},${n},${o},${h / 255})`;
|
|
2043
|
+
return i.drawMode === "stroke" ? `<rect x="${r.cellX}" y="${r.cellY}" width="${e.cellWidth}" height="${e.cellHeight}" stroke="${l}" fill="none" stroke-width="${i.strokeWidth}"/>` : `<rect x="${r.cellX}" y="${r.cellY}" width="${e.cellWidth}" height="${e.cellHeight}" fill="${l}"/>`;
|
|
2012
2044
|
}
|
|
2013
|
-
|
|
2014
|
-
const
|
|
2015
|
-
if (!
|
|
2016
|
-
const n = this.
|
|
2045
|
+
Fn(t, e, i, r) {
|
|
2046
|
+
const s = i.characters[t.charIndex];
|
|
2047
|
+
if (!s) return "";
|
|
2048
|
+
const n = this.kn.zn(s.character, i.font, t.position.cellX, t.position.cellY, e.cellWidth, e.cellHeight, i.fontSize, s.advanceWidth);
|
|
2017
2049
|
if (!n) return "";
|
|
2018
|
-
const { r: o, g:
|
|
2019
|
-
return
|
|
2050
|
+
const { r: o, g: h, b: l, a: u } = t.primaryColor, f = `rgba(${o},${h},${l},${u / 255})`;
|
|
2051
|
+
return r.drawMode === "stroke" ? `<path d="${n}" stroke="${f}" stroke-width="${r.strokeWidth}" fill="none"/>` : `<path d="${n}" fill="${f}"/>`;
|
|
2020
2052
|
}
|
|
2021
|
-
|
|
2022
|
-
const
|
|
2023
|
-
n &&
|
|
2024
|
-
const o = this.
|
|
2053
|
+
En(t, e, i, r) {
|
|
2054
|
+
const s = [], n = this.Ln(t, e, r);
|
|
2055
|
+
n && s.push(n);
|
|
2056
|
+
const o = this.Fn(t, e, i, r);
|
|
2025
2057
|
if (o) {
|
|
2026
|
-
const
|
|
2027
|
-
|
|
2058
|
+
const h = this.Gn(t, e);
|
|
2059
|
+
s.push(h ? `<g${h}>${o}</g>` : o);
|
|
2028
2060
|
}
|
|
2029
|
-
return
|
|
2061
|
+
return s.join("");
|
|
2030
2062
|
}
|
|
2031
|
-
|
|
2032
|
-
const
|
|
2033
|
-
for (const n of t)
|
|
2034
|
-
return
|
|
2063
|
+
Bn(t, e, i, r) {
|
|
2064
|
+
const s = [this.Pn(e), this.An(e, r), '<g id="ascii-cells">'];
|
|
2065
|
+
for (const n of t) s.push(this.En(n, e, i, r));
|
|
2066
|
+
return s.push(this.Tn()), s.join("");
|
|
2035
2067
|
}
|
|
2036
|
-
|
|
2068
|
+
Dn(t) {
|
|
2037
2069
|
return t.replace(/<path[^>]*d=""[^>]*\/>/g, "").replace(/\s+/g, " ").replace(/> </g, "><");
|
|
2038
2070
|
}
|
|
2039
2071
|
}
|
|
2040
|
-
class
|
|
2041
|
-
|
|
2042
|
-
return this.
|
|
2072
|
+
class Dt extends O {
|
|
2073
|
+
Wn(t) {
|
|
2074
|
+
return this.gn(t, "image/svg+xml;charset=utf-8");
|
|
2043
2075
|
}
|
|
2044
|
-
|
|
2045
|
-
this.
|
|
2076
|
+
In(t, e) {
|
|
2077
|
+
this.mn(t, this.$n(e) + ".svg", "image/svg+xml;charset=utf-8");
|
|
2046
2078
|
}
|
|
2047
|
-
|
|
2048
|
-
this.
|
|
2079
|
+
Un(t, e) {
|
|
2080
|
+
this.In(t, e || this.Cn());
|
|
2049
2081
|
}
|
|
2050
2082
|
}
|
|
2051
|
-
class
|
|
2083
|
+
class X {
|
|
2052
2084
|
constructor() {
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
this.
|
|
2085
|
+
c(this, "Vn");
|
|
2086
|
+
c(this, "On");
|
|
2087
|
+
c(this, "Hn");
|
|
2088
|
+
this.Vn = new zt(), this.On = new Bt(), this.Hn = new Dt();
|
|
2057
2089
|
}
|
|
2058
|
-
|
|
2059
|
-
return { includeBackgroundRectangles: t.includeBackgroundRectangles ?? !0, drawMode: t.drawMode ?? "fill", strokeWidth: t.strokeWidth ?? 1, backgroundColor: t.backgroundColor ?? [0, 0, 0, 0], filename: t.filename || this.
|
|
2090
|
+
Kn(t) {
|
|
2091
|
+
return { includeBackgroundRectangles: t.includeBackgroundRectangles ?? !0, drawMode: t.drawMode ?? "fill", strokeWidth: t.strokeWidth ?? 1, backgroundColor: t.backgroundColor ?? [0, 0, 0, 0], filename: t.filename || this.Hn.Cn() };
|
|
2060
2092
|
}
|
|
2061
|
-
|
|
2062
|
-
const i = this.
|
|
2063
|
-
return this.
|
|
2093
|
+
Nn(t, e = {}) {
|
|
2094
|
+
const i = this.Vn.bn(this.Vn.dn(t.pipeline), t.grid), r = this.On.Bn(i, t.grid, t.font, this.Kn(e));
|
|
2095
|
+
return this.On.Dn(r);
|
|
2064
2096
|
}
|
|
2065
|
-
|
|
2066
|
-
this.Un
|
|
2097
|
+
Un(t, e = {}) {
|
|
2098
|
+
this.Hn.Un(this.Nn(t, e), e.filename);
|
|
2067
2099
|
}
|
|
2068
2100
|
}
|
|
2069
|
-
class
|
|
2070
|
-
|
|
2101
|
+
class $t extends $ {
|
|
2102
|
+
Xn(t, e, i, r = " ") {
|
|
2071
2103
|
var o;
|
|
2072
|
-
const
|
|
2104
|
+
const s = [];
|
|
2073
2105
|
let n = 0;
|
|
2074
|
-
for (let
|
|
2106
|
+
for (let h = 0; h < e.rows; h++) {
|
|
2075
2107
|
const l = [];
|
|
2076
|
-
for (let
|
|
2077
|
-
const
|
|
2108
|
+
for (let u = 0; u < e.cols; u++) {
|
|
2109
|
+
const f = 4 * n, d = this._n(t.characterPixels, f), p = ((o = i.characters[d]) == null ? void 0 : o.character) || r;
|
|
2078
2110
|
l.push(p), n++;
|
|
2079
2111
|
}
|
|
2080
|
-
|
|
2112
|
+
s.push(l);
|
|
2081
2113
|
}
|
|
2082
|
-
return
|
|
2114
|
+
return s;
|
|
2083
2115
|
}
|
|
2084
2116
|
}
|
|
2085
|
-
class
|
|
2086
|
-
|
|
2117
|
+
class Ot {
|
|
2118
|
+
jn(t, e) {
|
|
2087
2119
|
const i = [];
|
|
2088
|
-
for (const
|
|
2089
|
-
let n =
|
|
2120
|
+
for (const s of t) {
|
|
2121
|
+
let n = s.join("");
|
|
2090
2122
|
e.preserveTrailingSpaces || (n = n.replace(/\s+$/, "")), i.push(n);
|
|
2091
2123
|
}
|
|
2092
|
-
const
|
|
2124
|
+
const r = e.lineEnding === "crlf" ? `\r
|
|
2093
2125
|
` : `
|
|
2094
2126
|
`;
|
|
2095
|
-
return i.join(
|
|
2127
|
+
return i.join(r);
|
|
2096
2128
|
}
|
|
2097
2129
|
}
|
|
2098
|
-
class
|
|
2099
|
-
|
|
2100
|
-
const i = this.
|
|
2101
|
-
this.
|
|
2130
|
+
class Gt extends O {
|
|
2131
|
+
Yn(t, e) {
|
|
2132
|
+
const i = this.qn(e);
|
|
2133
|
+
this.mn(t, i, "text/plain;charset=utf-8");
|
|
2102
2134
|
}
|
|
2103
|
-
|
|
2104
|
-
let e = this
|
|
2105
|
-
return e === ".txt" || e.length <= 4 ? this.
|
|
2135
|
+
qn(t) {
|
|
2136
|
+
let e = this.$n(t);
|
|
2137
|
+
return e === ".txt" || e.length <= 4 ? this.Cn() : e;
|
|
2106
2138
|
}
|
|
2107
2139
|
}
|
|
2108
2140
|
class H {
|
|
2109
2141
|
constructor() {
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
this.
|
|
2142
|
+
c(this, "Vn");
|
|
2143
|
+
c(this, "On");
|
|
2144
|
+
c(this, "Hn");
|
|
2145
|
+
this.Vn = new $t(), this.On = new Ot(), this.Hn = new Gt();
|
|
2114
2146
|
}
|
|
2115
|
-
|
|
2116
|
-
return { preserveTrailingSpaces: t.preserveTrailingSpaces ?? !1, lineEnding: t.lineEnding ?? "lf", emptyCharacter: t.emptyCharacter ?? " ", filename: t.filename || this.
|
|
2147
|
+
Kn(t) {
|
|
2148
|
+
return { preserveTrailingSpaces: t.preserveTrailingSpaces ?? !1, lineEnding: t.lineEnding ?? "lf", emptyCharacter: t.emptyCharacter ?? " ", filename: t.filename || this.Hn.Cn() };
|
|
2117
2149
|
}
|
|
2118
|
-
|
|
2119
|
-
const i = this.
|
|
2120
|
-
return this.
|
|
2150
|
+
Zn(t, e = {}) {
|
|
2151
|
+
const i = this.Kn(e), r = this.Vn.Xn(this.Vn.dn(t.pipeline), t.grid, t.font, i.emptyCharacter);
|
|
2152
|
+
return this.On.jn(r, i);
|
|
2121
2153
|
}
|
|
2122
|
-
|
|
2123
|
-
this.
|
|
2154
|
+
Yn(t, e = {}) {
|
|
2155
|
+
this.Hn.Yn(this.Zn(t, e), e.filename);
|
|
2124
2156
|
}
|
|
2125
2157
|
}
|
|
2126
|
-
class
|
|
2127
|
-
|
|
2128
|
-
const
|
|
2129
|
-
if (e === 1 && i === "transparent") return
|
|
2130
|
-
const
|
|
2131
|
-
return
|
|
2158
|
+
class Yt extends $ {
|
|
2159
|
+
Jn(t, e = 1, i = "transparent") {
|
|
2160
|
+
const r = t.canvas;
|
|
2161
|
+
if (e === 1 && i === "transparent") return r;
|
|
2162
|
+
const s = document.createElement("canvas"), n = s.getContext("2d"), o = Math.round(r.width * e), h = Math.round(r.height * e);
|
|
2163
|
+
return s.width = o, s.height = h, i !== "transparent" && (n.fillStyle = i, n.fillRect(0, 0, o, h)), n.imageSmoothingEnabled = !1, n.drawImage(r, 0, 0, r.width, r.height, 0, 0, o, h), s;
|
|
2132
2164
|
}
|
|
2133
2165
|
}
|
|
2134
|
-
class
|
|
2135
|
-
|
|
2136
|
-
const i = this.
|
|
2166
|
+
class Nt {
|
|
2167
|
+
Qn(t, e) {
|
|
2168
|
+
const i = this.eo(e.format);
|
|
2137
2169
|
return e.format === "png" ? t.toDataURL(i) : t.toDataURL(i, e.quality);
|
|
2138
2170
|
}
|
|
2139
|
-
async
|
|
2140
|
-
return new Promise((i,
|
|
2141
|
-
const
|
|
2142
|
-
o ? i(o) :
|
|
2171
|
+
async so(t, e) {
|
|
2172
|
+
return new Promise((i, r) => {
|
|
2173
|
+
const s = this.eo(e.format), n = (o) => {
|
|
2174
|
+
o ? i(o) : r(Error(`Failed to generate ${e.format.toUpperCase()} blob`));
|
|
2143
2175
|
};
|
|
2144
|
-
e.format === "png" ? t.toBlob(n,
|
|
2176
|
+
e.format === "png" ? t.toBlob(n, s) : t.toBlob(n, s, e.quality);
|
|
2145
2177
|
});
|
|
2146
2178
|
}
|
|
2147
|
-
|
|
2179
|
+
eo(t) {
|
|
2148
2180
|
switch (t) {
|
|
2149
2181
|
case "png":
|
|
2150
2182
|
return "image/png";
|
|
@@ -2157,264 +2189,270 @@ class Xt {
|
|
|
2157
2189
|
}
|
|
2158
2190
|
}
|
|
2159
2191
|
}
|
|
2160
|
-
const
|
|
2161
|
-
class
|
|
2162
|
-
|
|
2163
|
-
this.
|
|
2192
|
+
const Vt = { png: "image/png", jpg: "image/jpeg", webp: "image/webp" }, K = { png: ".png", jpg: ".jpg", webp: ".webp" };
|
|
2193
|
+
class Xt extends O {
|
|
2194
|
+
io(t, e, i) {
|
|
2195
|
+
this.ro(t, this.$n(e) + K[i]);
|
|
2164
2196
|
}
|
|
2165
|
-
|
|
2197
|
+
ro(t, e) {
|
|
2166
2198
|
const i = URL.createObjectURL(t);
|
|
2167
2199
|
try {
|
|
2168
|
-
const
|
|
2169
|
-
|
|
2200
|
+
const r = document.createElement("a");
|
|
2201
|
+
r.href = i, r.download = e, r.style.display = "none", r.rel = "noopener", document.body.appendChild(r), r.click(), document.body.removeChild(r);
|
|
2170
2202
|
} finally {
|
|
2171
2203
|
URL.revokeObjectURL(i);
|
|
2172
2204
|
}
|
|
2173
2205
|
}
|
|
2174
|
-
|
|
2175
|
-
return t in
|
|
2206
|
+
no(t) {
|
|
2207
|
+
return t in Vt && t in K;
|
|
2176
2208
|
}
|
|
2177
2209
|
}
|
|
2178
2210
|
class Ht {
|
|
2179
2211
|
constructor() {
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
this.
|
|
2212
|
+
c(this, "Vn");
|
|
2213
|
+
c(this, "On");
|
|
2214
|
+
c(this, "Hn");
|
|
2215
|
+
this.Vn = new Yt(), this.On = new Nt(), this.Hn = new Xt();
|
|
2184
2216
|
}
|
|
2185
|
-
|
|
2186
|
-
return { format: t.format ?? "png", quality: t.quality ?? 1, scale: t.scale ?? 1, backgroundColor: t.backgroundColor ?? "transparent", filename: t.filename || this.
|
|
2217
|
+
Kn(t) {
|
|
2218
|
+
return { format: t.format ?? "png", quality: t.quality ?? 1, scale: t.scale ?? 1, backgroundColor: t.backgroundColor ?? "transparent", filename: t.filename || this.Hn.Cn() };
|
|
2187
2219
|
}
|
|
2188
|
-
|
|
2189
|
-
if (!this.
|
|
2220
|
+
oo(t) {
|
|
2221
|
+
if (!this.Hn.no(t.format)) throw Error(`Saving '${t.format}' files is not supported`);
|
|
2190
2222
|
if (t.quality < 0 || t.quality > 1) throw Error("Image quality must be between 0.0 and 1.0");
|
|
2191
2223
|
if (t.scale <= 0) throw Error("Scale factor must be greater than 0");
|
|
2192
2224
|
t.format === "jpg" && t.backgroundColor === "transparent" && (t.backgroundColor = "black");
|
|
2193
2225
|
}
|
|
2194
|
-
async
|
|
2195
|
-
if (e.scale === 1 && e.backgroundColor === "transparent") return await this.
|
|
2196
|
-
const i = this.
|
|
2197
|
-
return await this.
|
|
2226
|
+
async so(t, e) {
|
|
2227
|
+
if (e.scale === 1 && e.backgroundColor === "transparent") return await this.On.so(t.canvas, e);
|
|
2228
|
+
const i = this.Vn.Jn(t, e.scale, e.backgroundColor);
|
|
2229
|
+
return await this.On.so(i, e);
|
|
2198
2230
|
}
|
|
2199
|
-
async
|
|
2200
|
-
const i = this.
|
|
2201
|
-
this.
|
|
2202
|
-
const
|
|
2203
|
-
this.
|
|
2231
|
+
async io(t, e = {}) {
|
|
2232
|
+
const i = this.Kn(e);
|
|
2233
|
+
this.oo(i);
|
|
2234
|
+
const r = await this.so(t, i);
|
|
2235
|
+
this.Hn.io(r, i.filename, i.format);
|
|
2204
2236
|
}
|
|
2205
2237
|
}
|
|
2206
|
-
const
|
|
2207
|
-
|
|
2208
|
-
this.
|
|
2238
|
+
const Kt = (a) => class extends a {
|
|
2239
|
+
ao() {
|
|
2240
|
+
this.kt.Dt(this.ho);
|
|
2209
2241
|
}
|
|
2210
2242
|
toString(t = {}) {
|
|
2211
|
-
return this.
|
|
2243
|
+
return this.ao(), new H().Zn({ pipeline: this.co, grid: this.Wr, font: this.Fi }, t);
|
|
2212
2244
|
}
|
|
2213
2245
|
saveStrings(t = {}) {
|
|
2214
|
-
this.
|
|
2246
|
+
this.ao(), new H().Yn({ pipeline: this.co, grid: this.Wr, font: this.Fi }, t);
|
|
2215
2247
|
}
|
|
2216
2248
|
toSVG(t = {}) {
|
|
2217
|
-
return this.
|
|
2249
|
+
return this.ao(), new X().Nn({ pipeline: this.co, grid: this.Wr, font: this.Fi }, t);
|
|
2218
2250
|
}
|
|
2219
2251
|
saveSVG(t = {}) {
|
|
2220
|
-
this.
|
|
2252
|
+
this.ao(), new X().Un({ pipeline: this.co, grid: this.Wr, font: this.Fi }, t);
|
|
2221
2253
|
}
|
|
2222
2254
|
async saveCanvas(t = {}) {
|
|
2223
|
-
await new Ht().
|
|
2255
|
+
await new Ht().io(this.Yi, t);
|
|
2224
2256
|
}
|
|
2225
|
-
},
|
|
2257
|
+
}, Zt = (a) => class extends a {
|
|
2226
2258
|
async loadFont(t) {
|
|
2227
|
-
return this.
|
|
2228
|
-
const e = this.
|
|
2229
|
-
this.
|
|
2259
|
+
return this.Fi.Hi(t).then(() => {
|
|
2260
|
+
const e = this.Fi.maxGlyphDimensions;
|
|
2261
|
+
this.Wr.Ji(e.width, e.height), this.co.resize(this.Wr.cols, this.Wr.rows), this.kt.Hs(), this.lo.tn();
|
|
2230
2262
|
});
|
|
2231
2263
|
}
|
|
2232
2264
|
fontSize(t) {
|
|
2233
|
-
if (!
|
|
2234
|
-
this.
|
|
2235
|
-
const e = this.
|
|
2236
|
-
this.
|
|
2265
|
+
if (!M.M(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) || this.Fi.fontSize === t) return;
|
|
2266
|
+
this.Fi.Oi(t);
|
|
2267
|
+
const e = this.Fi.maxGlyphDimensions;
|
|
2268
|
+
this.Wr.Ji(e.width, e.height), this.co.resize(this.Wr.cols, this.Wr.rows), this.kt.Hs(), this.lo.tn();
|
|
2237
2269
|
}
|
|
2238
|
-
|
|
2270
|
+
glyphColor(t) {
|
|
2271
|
+
return this.Fi.Mi(t);
|
|
2272
|
+
}
|
|
2273
|
+
glyphColors(t) {
|
|
2274
|
+
return this.Fi.Si(t);
|
|
2275
|
+
}
|
|
2276
|
+
}, jt = (a) => class extends a {
|
|
2239
2277
|
get frameCount() {
|
|
2240
|
-
return this.
|
|
2278
|
+
return this.uo.frameCount;
|
|
2241
2279
|
}
|
|
2242
2280
|
set frameCount(t) {
|
|
2243
|
-
this.
|
|
2281
|
+
this.uo.frameCount = t;
|
|
2244
2282
|
}
|
|
2245
2283
|
frameRate(t) {
|
|
2246
|
-
return t === void 0 ? this.
|
|
2284
|
+
return t === void 0 ? this.uo.currentFrameRate : this.uo.frameRate(t, () => this.fo());
|
|
2247
2285
|
}
|
|
2248
2286
|
noLoop() {
|
|
2249
|
-
this.
|
|
2287
|
+
this.uo.pause();
|
|
2250
2288
|
}
|
|
2251
2289
|
loop() {
|
|
2252
|
-
this.
|
|
2290
|
+
this.uo.resume(() => this.fo());
|
|
2253
2291
|
}
|
|
2254
2292
|
redraw(t = 1) {
|
|
2255
|
-
if (
|
|
2293
|
+
if (M.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.fo();
|
|
2256
2294
|
}
|
|
2257
2295
|
isLooping() {
|
|
2258
|
-
return this.
|
|
2296
|
+
return this.uo.isLooping;
|
|
2259
2297
|
}
|
|
2260
2298
|
}, qt = (a) => class extends a {
|
|
2261
2299
|
constructor(...t) {
|
|
2262
2300
|
super(...t);
|
|
2263
2301
|
}
|
|
2264
2302
|
mouseClicked(t) {
|
|
2265
|
-
this.
|
|
2303
|
+
this.lo.cn(t);
|
|
2266
2304
|
}
|
|
2267
2305
|
mousePressed(t) {
|
|
2268
|
-
this.
|
|
2306
|
+
this.lo.kr(t);
|
|
2269
2307
|
}
|
|
2270
2308
|
mouseReleased(t) {
|
|
2271
|
-
this.
|
|
2309
|
+
this.lo.Pr(t);
|
|
2272
2310
|
}
|
|
2273
2311
|
mouseMoved(t) {
|
|
2274
|
-
this.
|
|
2312
|
+
this.lo.ln(t);
|
|
2275
2313
|
}
|
|
2276
2314
|
mouseScrolled(t) {
|
|
2277
|
-
this.
|
|
2315
|
+
this.lo.un(t);
|
|
2278
2316
|
}
|
|
2279
2317
|
get mouse() {
|
|
2280
|
-
return this.
|
|
2318
|
+
return this.lo.fn();
|
|
2281
2319
|
}
|
|
2282
2320
|
}, Jt = (a) => class extends a {
|
|
2283
2321
|
constructor(...t) {
|
|
2284
2322
|
super(...t);
|
|
2285
2323
|
}
|
|
2286
2324
|
keyPressed(t) {
|
|
2287
|
-
this.
|
|
2325
|
+
this.do.kr(t);
|
|
2288
2326
|
}
|
|
2289
2327
|
keyReleased(t) {
|
|
2290
|
-
this.
|
|
2328
|
+
this.do.Pr(t);
|
|
2291
2329
|
}
|
|
2292
2330
|
isKeyPressed(t) {
|
|
2293
|
-
return this.
|
|
2331
|
+
return this.do.Tr(t);
|
|
2294
2332
|
}
|
|
2295
2333
|
get lastKeyPressed() {
|
|
2296
|
-
return this.
|
|
2334
|
+
return this.do.Gr();
|
|
2297
2335
|
}
|
|
2298
2336
|
get lastKeyReleased() {
|
|
2299
|
-
return this.
|
|
2337
|
+
return this.do.Lr();
|
|
2300
2338
|
}
|
|
2301
2339
|
get pressedKeys() {
|
|
2302
|
-
return this.
|
|
2340
|
+
return this.do.Er();
|
|
2303
2341
|
}
|
|
2304
2342
|
get modifierState() {
|
|
2305
|
-
return this.
|
|
2343
|
+
return this.do.Br();
|
|
2306
2344
|
}
|
|
2307
2345
|
};
|
|
2308
2346
|
class Qt {
|
|
2309
2347
|
constructor() {
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
}
|
|
2321
|
-
|
|
2348
|
+
c(this, "kt");
|
|
2349
|
+
c(this, "Fi");
|
|
2350
|
+
c(this, "Yi");
|
|
2351
|
+
c(this, "Wr");
|
|
2352
|
+
c(this, "uo");
|
|
2353
|
+
c(this, "lo");
|
|
2354
|
+
c(this, "do");
|
|
2355
|
+
c(this, "ho");
|
|
2356
|
+
c(this, "co");
|
|
2357
|
+
c(this, "_o");
|
|
2358
|
+
}
|
|
2359
|
+
fo() {
|
|
2322
2360
|
}
|
|
2323
2361
|
}
|
|
2324
2362
|
class te extends function(e, ...i) {
|
|
2325
|
-
return i.reduce((
|
|
2326
|
-
}(Qt,
|
|
2363
|
+
return i.reduce((r, s) => s(r), e);
|
|
2364
|
+
}(Qt, kt, Kt, Zt, jt, qt, Jt) {
|
|
2327
2365
|
constructor(e = {}) {
|
|
2328
2366
|
super();
|
|
2329
|
-
|
|
2330
|
-
|
|
2367
|
+
c(this, "po", !1);
|
|
2368
|
+
c(this, "mo", () => {
|
|
2331
2369
|
});
|
|
2332
|
-
|
|
2370
|
+
c(this, "vo", () => {
|
|
2333
2371
|
});
|
|
2334
|
-
|
|
2372
|
+
c(this, "yo", () => {
|
|
2335
2373
|
});
|
|
2336
|
-
|
|
2337
|
-
this.
|
|
2338
|
-
}
|
|
2339
|
-
async
|
|
2340
|
-
await this.
|
|
2341
|
-
const i = this.
|
|
2342
|
-
this.
|
|
2343
|
-
}
|
|
2344
|
-
|
|
2345
|
-
this
|
|
2346
|
-
this.
|
|
2347
|
-
}, window.addEventListener("resize", this
|
|
2348
|
-
this.
|
|
2374
|
+
c(this, "$o");
|
|
2375
|
+
this.Yi = new Pt(e), this.kt = new vt(this.Yi.ir()), this.Fi = new St(this.kt, e.fontSize ?? 16), this.uo = new Mt(e.frameRate ?? 60), this.lo = new It(this.Yi), this.do = new Ut(), this.ho = this.kt.Bt(), this._o = this.kt.ae(), this.Co(e);
|
|
2376
|
+
}
|
|
2377
|
+
async Co(e) {
|
|
2378
|
+
await this.Fi.Ii(e.fontSource);
|
|
2379
|
+
const i = this.Fi.maxGlyphDimensions;
|
|
2380
|
+
this.Wr = new Lt(this.Yi.canvas, i.width, i.height), this.lo.Ii(this.Wr), this.co = this.kt.Us(this.Wr.cols, this.Wr.rows, 5), this.wo(), this.mo(), this.uo.start(() => this.fo());
|
|
2381
|
+
}
|
|
2382
|
+
wo() {
|
|
2383
|
+
this.$o = () => {
|
|
2384
|
+
this.yo();
|
|
2385
|
+
}, window.addEventListener("resize", this.$o), this.lo.Mr(), this.do.Mr(), window.addEventListener("blur", () => {
|
|
2386
|
+
this.do.Dr();
|
|
2349
2387
|
});
|
|
2350
2388
|
}
|
|
2351
|
-
|
|
2352
|
-
if (this.
|
|
2353
|
-
this.
|
|
2354
|
-
const e = this.
|
|
2355
|
-
this.
|
|
2389
|
+
fo() {
|
|
2390
|
+
if (this.uo.measureFrameRate(), this.uo.incrementFrame(), this.po) return;
|
|
2391
|
+
this.co.begin(), this.kt.ks(this.ho), this.vo(), this.kt.Dt(this.ho), this.co.end();
|
|
2392
|
+
const e = this.kt.state.canvasBackgroundColor;
|
|
2393
|
+
this.kt.He(e[0], e[1], e[2], e[3]), this.kt.ks(this._o), this._o.Zt({ a: this.Fi.fontFramebuffer, b: [this.Fi.textureColumns, this.Fi.textureRows], c: this.co.textures[0], d: this.co.textures[1], e: this.co.textures[2], f: this.co.textures[4], g: this.co.textures[3], h: [this.Wr.cols, this.Wr.rows], i: [this.Wr.width, this.Wr.height], j: [this.Wr.offsetX, this.Wr.offsetY], k: this.Wr.width / this.Wr.height }), this.kt.Ls(this.Wr.offsetX, this.Wr.offsetY, this.Wr.width, this.Wr.height);
|
|
2356
2394
|
}
|
|
2357
2395
|
setup(e) {
|
|
2358
|
-
this.
|
|
2396
|
+
this.mo = e;
|
|
2359
2397
|
}
|
|
2360
2398
|
draw(e) {
|
|
2361
|
-
this.
|
|
2399
|
+
this.vo = e;
|
|
2362
2400
|
}
|
|
2363
2401
|
windowResized(e) {
|
|
2364
|
-
this.
|
|
2402
|
+
this.yo = e;
|
|
2365
2403
|
}
|
|
2366
2404
|
resizeCanvas(e, i) {
|
|
2367
|
-
this.
|
|
2405
|
+
this.Yi.sr(e, i), this.Wr.rt(), this.co.resize(this.Wr.cols, this.Wr.rows), this.kt.Hs(), this.lo.tn(), this.fo();
|
|
2368
2406
|
}
|
|
2369
2407
|
destroy() {
|
|
2370
|
-
this.
|
|
2408
|
+
this.po || (this.uo.stop(), window.removeEventListener("resize", this.$o), this.lo.zr(), this.do.zr(), this.Fi.Ut(), this.kt.Ut(), this.po = !0);
|
|
2371
2409
|
}
|
|
2372
2410
|
get grid() {
|
|
2373
|
-
return this.
|
|
2411
|
+
return this.Wr;
|
|
2374
2412
|
}
|
|
2375
2413
|
get font() {
|
|
2376
|
-
return this.
|
|
2414
|
+
return this.Fi;
|
|
2377
2415
|
}
|
|
2378
2416
|
get width() {
|
|
2379
|
-
return this.
|
|
2417
|
+
return this.Yi.width;
|
|
2380
2418
|
}
|
|
2381
2419
|
get height() {
|
|
2382
|
-
return this.
|
|
2420
|
+
return this.Yi.height;
|
|
2383
2421
|
}
|
|
2384
2422
|
get canvas() {
|
|
2385
|
-
return this.
|
|
2423
|
+
return this.Yi.canvas;
|
|
2386
2424
|
}
|
|
2387
2425
|
get isDisposed() {
|
|
2388
|
-
return this.
|
|
2426
|
+
return this.po;
|
|
2389
2427
|
}
|
|
2390
2428
|
get drawFramebuffer() {
|
|
2391
|
-
return this.
|
|
2429
|
+
return this.co;
|
|
2392
2430
|
}
|
|
2393
2431
|
}
|
|
2394
|
-
class
|
|
2432
|
+
class G {
|
|
2395
2433
|
constructor() {
|
|
2396
2434
|
}
|
|
2397
2435
|
static create(t = {}) {
|
|
2398
2436
|
return new te(t);
|
|
2399
2437
|
}
|
|
2400
2438
|
static setErrorLevel(t) {
|
|
2401
|
-
|
|
2439
|
+
M.S(t);
|
|
2402
2440
|
}
|
|
2403
2441
|
static get version() {
|
|
2404
|
-
return "0.2.1-beta.
|
|
2442
|
+
return "0.2.1-beta.4";
|
|
2405
2443
|
}
|
|
2406
2444
|
}
|
|
2407
|
-
const ie = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })),
|
|
2445
|
+
const ie = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), re = G.create, se = G.setErrorLevel, ne = G.version;
|
|
2408
2446
|
export {
|
|
2409
|
-
|
|
2447
|
+
Pt as TextmodeCanvas,
|
|
2410
2448
|
et as TextmodeErrorLevel,
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2449
|
+
St as TextmodeFont,
|
|
2450
|
+
D as TextmodeFramebuffer,
|
|
2451
|
+
Lt as TextmodeGrid,
|
|
2414
2452
|
te as Textmodifier,
|
|
2415
|
-
|
|
2453
|
+
re as create,
|
|
2416
2454
|
ie as export,
|
|
2417
|
-
|
|
2418
|
-
|
|
2455
|
+
se as setErrorLevel,
|
|
2456
|
+
G as textmode,
|
|
2419
2457
|
ne as version
|
|
2420
2458
|
};
|