textmode.js 0.3.2-beta.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/textmode.esm.js +383 -401
- package/dist/textmode.esm.min.js +60 -78
- package/dist/textmode.umd.js +6 -6
- package/dist/textmode.umd.min.js +4 -4
- package/dist/types/index.d.ts +1 -4
- package/dist/types/textmode/Textmodifier.d.ts +0 -14
- package/dist/types/textmode/font/typr/types.d.ts +0 -16
- package/dist/types/textmode/mixins/FontMixin.d.ts +2 -2
- package/dist/types/textmode/plugins/PluginManager.d.ts +45 -14
- package/package.json +1 -1
- package/dist/types/export/base/DataExtractor.d.ts +0 -34
- package/dist/types/export/base/FileHandler.d.ts +0 -46
- package/dist/types/export/base/index.d.ts +0 -2
- package/dist/types/export/index.d.ts +0 -1
- package/dist/types/export/svg/SVGContentGenerator.d.ts +0 -76
- package/dist/types/export/svg/SVGDataExtractor.d.ts +0 -33
- package/dist/types/export/svg/SVGExporter.d.ts +0 -31
- package/dist/types/export/svg/SVGFileHandler.d.ts +0 -25
- package/dist/types/export/svg/SVGPathGenerator.d.ts +0 -49
- package/dist/types/export/svg/index.d.ts +0 -6
- package/dist/types/export/svg/types.d.ts +0 -129
package/dist/textmode.esm.js
CHANGED
|
@@ -76,25 +76,25 @@ class it {
|
|
|
76
76
|
h(this, "$", !1);
|
|
77
77
|
h(this, "D", !1);
|
|
78
78
|
h(this, "k", !1);
|
|
79
|
-
h(this, "
|
|
80
|
-
h(this, "
|
|
79
|
+
h(this, "L", [0, 0]);
|
|
80
|
+
h(this, "O", [0, 0, 0, 1]);
|
|
81
81
|
h(this, "H", []);
|
|
82
82
|
}
|
|
83
83
|
G() {
|
|
84
|
-
this.H.push({ I: this.C, N: this.M, X: this.U, W: this.F,
|
|
84
|
+
this.H.push({ I: this.C, N: this.M, X: this.U, W: this.F, L: [...this.L], K: this.$, j: this.D, k: this.k, Y: [...this.R], V: [...this.P], q: [...this.S] });
|
|
85
85
|
}
|
|
86
86
|
Z() {
|
|
87
87
|
const t = this.H.pop();
|
|
88
|
-
t ? (this.C = t.I, this.M = t.N, this.U = t.X, this.F = t.W, this.
|
|
88
|
+
t ? (this.C = t.I, this.M = t.N, this.U = t.X, this.F = t.W, this.L = t.L, this.$ = t.K, this.D = t.j, this.k = t.k, this.R = t.Y, this.P = t.V, this.S = t.q) : console.warn("pop() called without matching push()");
|
|
89
89
|
}
|
|
90
90
|
J(t) {
|
|
91
|
-
t.I = this.C, t.N = this.M, t.X = this.U, t.W = this.F, t.Y[0] = this.R[0], t.Y[1] = this.R[1], t.Y[2] = this.R[2], t.V[0] = this.P[0], t.V[1] = this.P[1], t.V[2] = this.P[2], t.V[3] = this.P[3], t.q[0] = this.S[0], t.q[1] = this.S[1], t.q[2] = this.S[2], t.q[3] = this.S[3], t.K = this.$, t.j = this.D, t.k = this.k, t.
|
|
91
|
+
t.I = this.C, t.N = this.M, t.X = this.U, t.W = this.F, t.Y[0] = this.R[0], t.Y[1] = this.R[1], t.Y[2] = this.R[2], t.V[0] = this.P[0], t.V[1] = this.P[1], t.V[2] = this.P[2], t.V[3] = this.P[3], t.q[0] = this.S[0], t.q[1] = this.S[1], t.q[2] = this.S[2], t.q[3] = this.S[3], t.K = this.$, t.j = this.D, t.k = this.k, t.L[0] = this.L[0], t.L[1] = this.L[1];
|
|
92
92
|
}
|
|
93
93
|
get lineWeight() {
|
|
94
94
|
return this.C;
|
|
95
95
|
}
|
|
96
96
|
get canvasBackgroundColor() {
|
|
97
|
-
return this.
|
|
97
|
+
return this.O;
|
|
98
98
|
}
|
|
99
99
|
tt(t) {
|
|
100
100
|
this.C = Math.abs(t);
|
|
@@ -128,10 +128,10 @@ class it {
|
|
|
128
128
|
}
|
|
129
129
|
ut(t) {
|
|
130
130
|
const e = 255 * t / 360, i = Math.floor(e) / 255, s = Math.round(e - Math.floor(e));
|
|
131
|
-
this.
|
|
131
|
+
this.L = [i, s];
|
|
132
132
|
}
|
|
133
133
|
ft(t, e, i, s) {
|
|
134
|
-
this.
|
|
134
|
+
this.O = [t / 255, e / 255, i / 255, s / 255];
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
class j {
|
|
@@ -141,8 +141,8 @@ class j {
|
|
|
141
141
|
h(this, "u");
|
|
142
142
|
h(this, "vt", null);
|
|
143
143
|
h(this, "gt");
|
|
144
|
-
h(this, "
|
|
145
|
-
h(this, "
|
|
144
|
+
h(this, "At");
|
|
145
|
+
h(this, "yt", []);
|
|
146
146
|
h(this, "Ct");
|
|
147
147
|
h(this, "wt", null);
|
|
148
148
|
h(this, "bt", []);
|
|
@@ -151,24 +151,24 @@ class j {
|
|
|
151
151
|
h(this, "Ft", null);
|
|
152
152
|
this.dt = e, this._t = i, this.u = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", ...r }, this.gt = t, this.Ct = Math.min(Math.max(1, s), 8), this.xt = n, this.Mt = !!o, this.Ft = this.Mt ? new it() : null;
|
|
153
153
|
const c = t.getParameter(t.MAX_DRAW_BUFFERS), l = t.getParameter(t.MAX_COLOR_ATTACHMENTS);
|
|
154
|
-
this.Ct = Math.min(this.Ct, c, l), this.
|
|
154
|
+
this.Ct = Math.min(this.Ct, c, l), this.At = t.createFramebuffer(), this.zt(), this.Rt(), this.bt = Array(this.Ct).fill(null);
|
|
155
155
|
}
|
|
156
156
|
zt() {
|
|
157
157
|
const t = this.gt, e = this.u.filter === "linear" ? t.LINEAR : t.NEAREST, i = this.u.wrap === "repeat" ? t.REPEAT : t.CLAMP_TO_EDGE, s = this.u.type === "float" ? t.FLOAT : t.UNSIGNED_BYTE;
|
|
158
158
|
for (let r = 0; r < this.Ct; r++) {
|
|
159
159
|
const n = t.createTexture();
|
|
160
|
-
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.dt, this._t, 0, t.RGBA, s, null), this.
|
|
160
|
+
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.dt, this._t, 0, t.RGBA, s, null), this.yt.push(n);
|
|
161
161
|
}
|
|
162
162
|
t.bindTexture(t.TEXTURE_2D, null);
|
|
163
163
|
}
|
|
164
164
|
Rt() {
|
|
165
165
|
const t = this.gt;
|
|
166
|
-
if (t.bindFramebuffer(t.FRAMEBUFFER, this.
|
|
166
|
+
if (t.bindFramebuffer(t.FRAMEBUFFER, this.At), this.Ct === 1) t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, this.yt[0], 0);
|
|
167
167
|
else {
|
|
168
168
|
const i = [];
|
|
169
169
|
for (let s = 0; s < this.Ct; s++) {
|
|
170
170
|
const r = t.COLOR_ATTACHMENT0 + s;
|
|
171
|
-
t.framebufferTexture2D(t.FRAMEBUFFER, r, t.TEXTURE_2D, this.
|
|
171
|
+
t.framebufferTexture2D(t.FRAMEBUFFER, r, t.TEXTURE_2D, this.yt[s], 0), i.push(r);
|
|
172
172
|
}
|
|
173
173
|
t.drawBuffers(i);
|
|
174
174
|
}
|
|
@@ -177,19 +177,19 @@ class j {
|
|
|
177
177
|
}
|
|
178
178
|
Tt(t) {
|
|
179
179
|
const e = this.gt;
|
|
180
|
-
e.bindTexture(e.TEXTURE_2D, this.
|
|
180
|
+
e.bindTexture(e.TEXTURE_2D, this.yt[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);
|
|
181
181
|
}
|
|
182
182
|
resize(t, e) {
|
|
183
183
|
this.dt = t, this._t = e, this.vt = null, this.bt = Array(this.Ct).fill(null);
|
|
184
184
|
const i = this.gt, s = this.u.type === "float" ? i.FLOAT : i.UNSIGNED_BYTE;
|
|
185
|
-
for (const r of this.
|
|
185
|
+
for (const r of this.yt) i.bindTexture(i.TEXTURE_2D, r), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, this.dt, this._t, 0, i.RGBA, s, null);
|
|
186
186
|
i.bindTexture(i.TEXTURE_2D, null);
|
|
187
187
|
}
|
|
188
188
|
readPixels(t) {
|
|
189
189
|
const e = this.gt, i = this.bt[t];
|
|
190
190
|
if (i) return i;
|
|
191
191
|
const s = this.dt, r = this._t, n = new Uint8Array(s * r * 4), o = e.getParameter(e.READ_FRAMEBUFFER_BINDING);
|
|
192
|
-
e.bindFramebuffer(e.READ_FRAMEBUFFER, this.
|
|
192
|
+
e.bindFramebuffer(e.READ_FRAMEBUFFER, this.At), e.readBuffer(e.COLOR_ATTACHMENT0 + t), e.readPixels(0, 0, s, r, e.RGBA, e.UNSIGNED_BYTE, n), e.bindFramebuffer(e.READ_FRAMEBUFFER, o);
|
|
193
193
|
const c = 4 * s, l = new Uint8Array(n.length);
|
|
194
194
|
for (let f = 0; f < r; f++) {
|
|
195
195
|
const u = (r - 1 - f) * c, m = f * c;
|
|
@@ -202,9 +202,9 @@ class j {
|
|
|
202
202
|
const t = this.gt;
|
|
203
203
|
if (this.xt) {
|
|
204
204
|
const n = ((i = (e = this.xt).Pt) == null ? void 0 : i.call(e)) ?? null;
|
|
205
|
-
n && this.xt.St(n), this.Mt && this.Ft && ((r = (s = this.xt)
|
|
205
|
+
n && this.xt.St(n), this.Mt && this.Ft && ((r = (s = this.xt).$t) == null || r.call(s, this.Ft));
|
|
206
206
|
}
|
|
207
|
-
this.wt = { framebuffer: t.getParameter(t.FRAMEBUFFER_BINDING), viewport: t.getParameter(t.VIEWPORT) }, t.bindFramebuffer(t.FRAMEBUFFER, this.
|
|
207
|
+
this.wt = { framebuffer: t.getParameter(t.FRAMEBUFFER_BINDING), viewport: t.getParameter(t.VIEWPORT) }, t.bindFramebuffer(t.FRAMEBUFFER, this.At), this.bt = Array(this.Ct).fill(null);
|
|
208
208
|
for (let n = 0; n < this.Ct; n++) t.clearBufferfv(t.COLOR, n, new Float32Array([0, 0, 0, 0]));
|
|
209
209
|
t.viewport(0, 0, this.dt, this._t), Y(t, [0, 0, this.dt, this._t]);
|
|
210
210
|
}
|
|
@@ -216,12 +216,12 @@ class j {
|
|
|
216
216
|
const n = ((i = (e = this.xt).Pt) == null ? void 0 : i.call(e)) ?? null;
|
|
217
217
|
n && this.xt.St(n);
|
|
218
218
|
}
|
|
219
|
-
t.bindFramebuffer(t.FRAMEBUFFER, this.wt.framebuffer), t.viewport(...this.wt.viewport), Y(t, this.wt.viewport), this.wt = null, this.xt && this.Mt && this.Ft && ((r = (s = this.xt)
|
|
219
|
+
t.bindFramebuffer(t.FRAMEBUFFER, this.wt.framebuffer), t.viewport(...this.wt.viewport), Y(t, this.wt.viewport), this.wt = null, this.xt && this.Mt && this.Ft && ((r = (s = this.xt).Et) == null || r.call(s));
|
|
220
220
|
}
|
|
221
221
|
Dt() {
|
|
222
222
|
const t = this.gt;
|
|
223
|
-
t.deleteFramebuffer(this.
|
|
224
|
-
for (const e of this.
|
|
223
|
+
t.deleteFramebuffer(this.At);
|
|
224
|
+
for (const e of this.yt) t.deleteTexture(e);
|
|
225
225
|
}
|
|
226
226
|
get width() {
|
|
227
227
|
return this.dt;
|
|
@@ -230,16 +230,16 @@ class j {
|
|
|
230
230
|
return this._t;
|
|
231
231
|
}
|
|
232
232
|
get textures() {
|
|
233
|
-
return [...this.
|
|
233
|
+
return [...this.yt];
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
class
|
|
236
|
+
class S {
|
|
237
237
|
constructor(t, e, i) {
|
|
238
238
|
h(this, "gt");
|
|
239
239
|
h(this, "kt");
|
|
240
240
|
h(this, "Bt", /* @__PURE__ */ new Map());
|
|
241
|
-
h(this, "
|
|
242
|
-
h(this, "
|
|
241
|
+
h(this, "Lt", /* @__PURE__ */ new Map());
|
|
242
|
+
h(this, "Ot", 0);
|
|
243
243
|
this.gt = t, this.kt = this.Ht(e, i), this.Gt();
|
|
244
244
|
}
|
|
245
245
|
Gt() {
|
|
@@ -248,9 +248,9 @@ class B {
|
|
|
248
248
|
const i = this.gt.getActiveUniform(this.kt, e);
|
|
249
249
|
if (i) {
|
|
250
250
|
const s = this.gt.getUniformLocation(this.kt, i.name);
|
|
251
|
-
if (s && (this.Bt.set(i.name, s), this.
|
|
251
|
+
if (s && (this.Bt.set(i.name, s), this.Lt.set(i.name, { type: i.type, size: i.size }), i.size > 1)) {
|
|
252
252
|
const r = i.name.replace(/\[.*\]$/, "");
|
|
253
|
-
this.Bt.has(r) || (this.Bt.set(r, s), this.
|
|
253
|
+
this.Bt.has(r) || (this.Bt.set(r, s), this.Lt.set(r, { type: i.type, size: i.size }));
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
}
|
|
@@ -275,7 +275,7 @@ class B {
|
|
|
275
275
|
this.gt.useProgram(this.kt), this.Xt();
|
|
276
276
|
}
|
|
277
277
|
Xt() {
|
|
278
|
-
this.
|
|
278
|
+
this.Ot = 0;
|
|
279
279
|
}
|
|
280
280
|
Wt(t) {
|
|
281
281
|
for (const [e, i] of Object.entries(t)) this.Kt(e, i);
|
|
@@ -284,18 +284,18 @@ class B {
|
|
|
284
284
|
return this.Bt.has(t);
|
|
285
285
|
}
|
|
286
286
|
Yt(t) {
|
|
287
|
-
return this.
|
|
287
|
+
return this.Lt.get(t) || null;
|
|
288
288
|
}
|
|
289
289
|
Vt() {
|
|
290
290
|
const t = [];
|
|
291
|
-
for (const [e, i] of this.
|
|
291
|
+
for (const [e, i] of this.Lt.entries()) t.push({ name: e, ...i });
|
|
292
292
|
return t;
|
|
293
293
|
}
|
|
294
294
|
Kt(t, e) {
|
|
295
295
|
var c;
|
|
296
296
|
const i = this.Bt.get(t);
|
|
297
297
|
if (!i) return;
|
|
298
|
-
const s = this.
|
|
298
|
+
const s = this.Lt.get(t);
|
|
299
299
|
if (!s) return void console.warn(`No type information found for uniform '${t}'`);
|
|
300
300
|
const { type: r, size: n } = s, o = this.gt;
|
|
301
301
|
if (typeof e == "number") switch (r) {
|
|
@@ -353,7 +353,7 @@ class B {
|
|
|
353
353
|
} else console.warn(`Unsupported uniform type for '${t}':`, typeof e);
|
|
354
354
|
}
|
|
355
355
|
qt() {
|
|
356
|
-
return this.
|
|
356
|
+
return this.Ot++;
|
|
357
357
|
}
|
|
358
358
|
get Zt() {
|
|
359
359
|
return this.kt;
|
|
@@ -371,9 +371,9 @@ class lt {
|
|
|
371
371
|
h(this, "Jt");
|
|
372
372
|
h(this, "ts");
|
|
373
373
|
h(this, "ss");
|
|
374
|
-
this.gt = t, this.Jt = new
|
|
375
|
-
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.);}`), this.Qt = new
|
|
376
|
-
precision highp float;in vec2 v_uv;uniform sampler2D Ue;uniform sampler2D Uf;uniform sampler2D Ug;uniform sampler2D Uh;uniform sampler2D Ui;uniform vec2 Uj;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*Uj;vec2 C=(floor(B)+0.5f)/Uj;vec4 D=texture(Ue,C);vec4 E=texture(Uf,C);if(E.a==0.){discard;}vec4 F=texture(Ug,C);vec4 G=texture(Uh,C);vec4 H=texture(Ui,C);o_character=D;o_primaryColor=E;o_secondaryColor=F;o_rotation=G;o_transform=H;}`), this.ts = new
|
|
374
|
+
this.gt = t, this.Jt = new S(this.gt, H, `#version 300 es
|
|
375
|
+
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.);}`), this.Qt = new S(this.gt, H, `#version 300 es
|
|
376
|
+
precision highp float;in vec2 v_uv;uniform sampler2D Ue;uniform sampler2D Uf;uniform sampler2D Ug;uniform sampler2D Uh;uniform sampler2D Ui;uniform vec2 Uj;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*Uj;vec2 C=(floor(B)+0.5f)/Uj;vec4 D=texture(Ue,C);vec4 E=texture(Uf,C);if(E.a==0.){discard;}vec4 F=texture(Ug,C);vec4 G=texture(Uh,C);vec4 H=texture(Ui,C);o_character=D;o_primaryColor=E;o_secondaryColor=F;o_rotation=G;o_transform=H;}`), this.ts = new S(this.gt, st, "precision mediump float;uniform sampler2D U0;uniform vec2 U1;uniform sampler2D U3;uniform sampler2D U4;uniform sampler2D U5;uniform sampler2D U2;uniform sampler2D U6;uniform vec2 U7;uniform vec2 U8;mat2 A(float B){float C=sin(B);float D=cos(B);return mat2(D,-C,C,D);}void main(){vec2 E=gl_FragCoord.xy/U8;vec2 F=E*U7;vec2 G=floor(F);vec2 H=(G+0.5)/U7;vec4 I=texture2D(U3,H);vec4 J=texture2D(U4,H);vec4 K=texture2D(U5,H);bool L=K.r>0.5;bool M=K.g>0.5;bool N=K.b>0.5;vec4 O=texture2D(U2,H);int P=int(O.r*255.+0.5)+int(O.g*255.+0.5)*256;int Q=int(mod(float(P),U1.x));int R=P/int(U1.x);float S=(U1.y-1.)-float(R);vec2 T=vec2(float(Q),S)/U1;vec4 U=texture2D(U6,H);float V=U.r*255.+U.g;float W=-(V*360./255.)*0.017453292;vec2 X=fract(F)-0.5;if(M)X.x=-X.x;if(N)X.y=-X.y;X=A(W)*X+0.5;vec2 Y=1./U1;vec2 Z=T+X*Y;vec2 a=T+Y;if(any(lessThan(Z,T))||any(greaterThan(Z,a))){gl_FragColor=L?I:J;return;}vec4 b=texture2D(U0,Z);if(L)b.rgb=1.-b.rgb;gl_FragColor=mix(J,I,b);}"), this.ss = new S(this.gt, H, `#version 300 es
|
|
377
377
|
precision highp float;in vec2 v_uv;uniform sampler2D Uk;uniform bool Ul;uniform bool Um;uniform bool Un;uniform vec2 Uo;uniform bool Up;uniform vec4 Uq;uniform bool Ur;uniform vec4 Us;uniform vec4 Ut;uniform int Uu;uniform vec3 Uv[64];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;float A(vec3 B){return dot(B,vec3(0.299f,0.587f,0.114f));}void main(){vec2 C=vec2(v_uv.x,1.0f-v_uv.y);vec4 D=texture(Uk,C);float E=A(D.rgb);if(Uu>0){float F=float(Uu);float G=clamp(E*(F-1.0f),0.0f,F-1.0f);int H=int(floor(G+0.5f));vec3 I=Uv[H];o_character=vec4(I,1.0f);}else{o_character=vec4(E,0.0f,0.0f,1.0f);}vec4 J=Up?Uq:D;vec4 K=Ur?Us:D;if(D.a<0.01f){J=Ut;K=Ut;}else{}o_primaryColor=vec4(J);o_secondaryColor=vec4(K);o_rotation=vec4(Uo.xy,0.0f,1.0f);o_transform=vec4(float(Ul),float(Um),float(Un),1.0f);}`);
|
|
378
378
|
}
|
|
379
379
|
es() {
|
|
@@ -389,16 +389,16 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uk;uniform bool Ul;uniform
|
|
|
389
389
|
return this.ss;
|
|
390
390
|
}
|
|
391
391
|
hs(t) {
|
|
392
|
-
return new
|
|
392
|
+
return new S(this.gt, H, t);
|
|
393
393
|
}
|
|
394
394
|
cs(t, e) {
|
|
395
|
-
return new
|
|
395
|
+
return new S(this.gt, t, e);
|
|
396
396
|
}
|
|
397
397
|
Dt() {
|
|
398
398
|
this.Qt.Dt(), this.Jt.Dt(), this.ts.Dt(), this.ss.Dt();
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
|
-
var
|
|
401
|
+
var x = ((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))(x || {});
|
|
402
402
|
class ut {
|
|
403
403
|
constructor(t) {
|
|
404
404
|
h(this, "gt");
|
|
@@ -449,18 +449,18 @@ class ft {
|
|
|
449
449
|
};
|
|
450
450
|
let o = null, c = null;
|
|
451
451
|
for (const l of e) {
|
|
452
|
-
if (l.type ===
|
|
453
|
-
c && (n(c), o = null, c = null), this.Ss(t, l.params, l.state, i.get(
|
|
452
|
+
if (l.type === x.CUSTOM) {
|
|
453
|
+
c && (n(c), o = null, c = null), this.Ss(t, l.params, l.state, i.get(x.RECTANGLE));
|
|
454
454
|
continue;
|
|
455
455
|
}
|
|
456
456
|
o !== null && l.type !== o && (n(c), o = null, c = null);
|
|
457
457
|
let f = c;
|
|
458
|
-
f && l.type === o || (f = i.get(l.type) || null, c = f, o = l.type), f && f
|
|
458
|
+
f && l.type === o || (f = i.get(l.type) || null, c = f, o = l.type), f && f.$s(l.params, l.state);
|
|
459
459
|
}
|
|
460
460
|
n(c);
|
|
461
461
|
}
|
|
462
462
|
Ss(t, e, i, s) {
|
|
463
|
-
const { x: r, y: n, width: o, height: c, shader: l, uniforms: f } = e, u = this
|
|
463
|
+
const { x: r, y: n, width: o, height: c, shader: l, uniforms: f } = e, u = this.Es(Math.max(1, Math.floor(o)), Math.max(1, Math.floor(c)));
|
|
464
464
|
u.begin(), this.Ds(s, l, f, 0, 0, u.width, u.height, {}), u.end();
|
|
465
465
|
const m = this.ks(), p = { Ue: u.textures[0], Uf: u.textures[1], Ug: u.textures[2], Uh: u.textures[3], Ui: u.textures[4], Uj: [u.width, u.height] };
|
|
466
466
|
this.Ds(s, m, p, Math.floor(r), Math.floor(n), Math.max(1, Math.floor(o)), Math.max(1, Math.floor(c)), i), t.shader.Nt();
|
|
@@ -468,7 +468,7 @@ class ft {
|
|
|
468
468
|
Ds(t, e, i, s, r, n, o, c) {
|
|
469
469
|
e.Nt(), e.Wt(i);
|
|
470
470
|
const l = this.gt.getParameter(this.gt.VIEWPORT);
|
|
471
|
-
if (e.Wt({ U9: l[2] / l[3], Uy: [l[2], l[3]] }), t.Ps(), t
|
|
471
|
+
if (e.Wt({ U9: l[2] / l[3], Uy: [l[2], l[3]] }), t.Ps(), t.$s({ x: s, y: r, width: n, height: o }, c), t.bs()) {
|
|
472
472
|
const f = t.unitGeometry, u = t.unitBuffer;
|
|
473
473
|
try {
|
|
474
474
|
this.gs.us(e.Zt, t.type + "", f, u), t.batch.Ms(e), t.batch.Fs(f.zs, f.Rs);
|
|
@@ -480,7 +480,7 @@ class ft {
|
|
|
480
480
|
ks() {
|
|
481
481
|
return this.xt.es();
|
|
482
482
|
}
|
|
483
|
-
|
|
483
|
+
Es(t, e) {
|
|
484
484
|
return this.As && this.Cs && this.Cs.w === t && this.Cs.h === e || (this.As && this.As.Dt(), this.As = new j(this.gt, t, e, 5), this.Cs = { w: t, h: e }), this.As;
|
|
485
485
|
}
|
|
486
486
|
Dt() {
|
|
@@ -490,57 +490,57 @@ class ft {
|
|
|
490
490
|
class dt {
|
|
491
491
|
constructor() {
|
|
492
492
|
h(this, "Bs", []);
|
|
493
|
-
h(this, "
|
|
494
|
-
h(this, "
|
|
493
|
+
h(this, "Ls", 1);
|
|
494
|
+
h(this, "Os", 0);
|
|
495
495
|
}
|
|
496
496
|
Hs(t) {
|
|
497
|
-
if (this.
|
|
498
|
-
const i = { id: this.
|
|
497
|
+
if (this.Os >= this.Bs.length) {
|
|
498
|
+
const i = { id: this.Ls++, type: t, params: {}, state: { I: 1, N: 0, X: 0, W: 0, Y: [0, 0, 0], V: [1, 1, 1, 1], q: [0, 0, 0, 1], K: !1, j: !1, k: !1, L: [0, 0] } };
|
|
499
499
|
this.Bs.push(i);
|
|
500
500
|
}
|
|
501
|
-
const e = this.Bs[this.
|
|
502
|
-
return e.id = this.
|
|
501
|
+
const e = this.Bs[this.Os];
|
|
502
|
+
return e.id = this.Ls++, e.type = t, this.Os++, e;
|
|
503
503
|
}
|
|
504
504
|
Gs(t, e, i, s, r) {
|
|
505
|
-
const n = this.Hs(
|
|
505
|
+
const n = this.Hs(x.RECTANGLE);
|
|
506
506
|
return n.params.x = t, n.params.y = e, n.params.width = i, n.params.height = s, r.J(n.state), n.id;
|
|
507
507
|
}
|
|
508
508
|
Is(t, e, i, s, r, n, o) {
|
|
509
|
-
const c = this.Hs(
|
|
509
|
+
const c = this.Hs(x.CUSTOM);
|
|
510
510
|
return c.params.x = t, c.params.y = e, c.params.width = i, c.params.height = s, c.params.shader = r, c.params.uniforms = n, o.J(c.state), c.id;
|
|
511
511
|
}
|
|
512
512
|
Ns(t, e, i, s, r, n) {
|
|
513
|
-
const o = this.Hs(
|
|
513
|
+
const o = this.Hs(x.LINE);
|
|
514
514
|
return o.params.x1 = t, o.params.y1 = e, o.params.x2 = i, o.params.y2 = s, o.params.thickness = r, n.J(o.state), o.id;
|
|
515
515
|
}
|
|
516
516
|
Xs(t, e, i, s, r) {
|
|
517
|
-
const n = this.Hs(
|
|
517
|
+
const n = this.Hs(x.ELLIPSE);
|
|
518
518
|
return n.params.x = t, n.params.y = e, n.params.width = i, n.params.height = s, r.J(n.state), n.id;
|
|
519
519
|
}
|
|
520
520
|
Ws(t, e, i, s, r, n, o) {
|
|
521
|
-
const c = this.Hs(
|
|
521
|
+
const c = this.Hs(x.ARC);
|
|
522
522
|
return c.params.x = t, c.params.y = e, c.params.width = i, c.params.height = s, c.params.start = r, c.params.stop = n, o.J(c.state), c.id;
|
|
523
523
|
}
|
|
524
524
|
Ks(t, e, i, s, r, n, o) {
|
|
525
|
-
const c = this.Hs(
|
|
525
|
+
const c = this.Hs(x.TRIANGLE);
|
|
526
526
|
return c.params.x1 = t, c.params.y1 = e, c.params.x2 = i, c.params.y2 = s, c.params.x3 = r, c.params.y3 = n, o.J(c.state), c.id;
|
|
527
527
|
}
|
|
528
528
|
js(t, e, i, s, r, n, o, c, l, f) {
|
|
529
|
-
const u = this.Hs(
|
|
529
|
+
const u = this.Hs(x.BEZIER_CURVE);
|
|
530
530
|
return u.params.x1 = t, u.params.y1 = e, u.params.cp1x = i, u.params.cp1y = s, u.params.cp2x = r, u.params.cp2y = n, u.params.x2 = o, u.params.y2 = c, u.params.thickness = l, f.J(u.state), u.id;
|
|
531
531
|
}
|
|
532
532
|
get length() {
|
|
533
|
-
return this.
|
|
533
|
+
return this.Os;
|
|
534
534
|
}
|
|
535
535
|
get isEmpty() {
|
|
536
|
-
return this.
|
|
536
|
+
return this.Os === 0;
|
|
537
537
|
}
|
|
538
538
|
Ys() {
|
|
539
|
-
this.
|
|
539
|
+
this.Os = 0;
|
|
540
540
|
}
|
|
541
541
|
[Symbol.iterator]() {
|
|
542
542
|
let t = 0;
|
|
543
|
-
const e = this.
|
|
543
|
+
const e = this.Os, i = this.Bs;
|
|
544
544
|
return { next: () => t < e ? { value: i[t++], done: !1 } : { value: void 0, done: !0 } };
|
|
545
545
|
}
|
|
546
546
|
}
|
|
@@ -549,7 +549,7 @@ const M = class M {
|
|
|
549
549
|
var n, o, c, l, f, u, m, p, g, d;
|
|
550
550
|
const s = e || new Float32Array(M.FLOATS_PER_INSTANCE);
|
|
551
551
|
let r = i;
|
|
552
|
-
return s[r++] = t.fs[0], s[r++] = t.fs[1], s[r++] = t.
|
|
552
|
+
return s[r++] = t.fs[0], s[r++] = t.fs[1], s[r++] = t.Os[0], s[r++] = t.Os[1], s[r++] = t.Y[0], s[r++] = t.Y[1], s[r++] = t.Y[2], s[r++] = t.V[0], s[r++] = t.V[1], s[r++] = t.V[2], s[r++] = t.V[3], s[r++] = t.q[0], s[r++] = t.q[1], s[r++] = t.q[2], s[r++] = t.q[3], s[r++] = t.L[0], s[r++] = t.L[1], s[r++] = t.qs[0], s[r++] = t.qs[1], s[r++] = t.qs[2], s[r++] = t.N, s[r++] = t.X, s[r++] = t.W, s[r++] = t.Zs[0], s[r++] = t.Zs[1], s[r++] = ((n = t.Qs) == null ? void 0 : n[0]) || 0, s[r++] = ((o = t.Qs) == null ? void 0 : o[1]) || 0, s[r++] = ((c = t.Js) == null ? void 0 : c[0]) || 0, s[r++] = ((l = t.Js) == null ? void 0 : l[1]) || 0, s[r++] = ((f = t.te) == null ? void 0 : f[0]) || 0, s[r++] = ((u = t.te) == null ? void 0 : u[1]) || 0, s[r++] = ((m = t.se) == null ? void 0 : m[0]) || 0, s[r++] = ((p = t.se) == null ? void 0 : p[1]) || 0, s[r++] = ((g = t.ee) == null ? void 0 : g[0]) || 0, s[r++] = ((d = t.ee) == null ? void 0 : d[1]) || 0, s;
|
|
553
553
|
}
|
|
554
554
|
static ie(t) {
|
|
555
555
|
const e = t.length * M.FLOATS_PER_INSTANCE, i = new Float32Array(e);
|
|
@@ -561,10 +561,10 @@ const M = class M {
|
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
h(M, "BYTES_PER_INSTANCE", 140), h(M, "FLOATS_PER_INSTANCE", 35);
|
|
564
|
-
let
|
|
564
|
+
let _ = M;
|
|
565
565
|
const b = class b {
|
|
566
566
|
};
|
|
567
|
-
h(b, "STRIDE",
|
|
567
|
+
h(b, "STRIDE", _.BYTES_PER_INSTANCE), h(b, "ATTRIBUTES", { a_instancePosition: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 0, divisor: 1 }, a_instanceSize: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 8, divisor: 1 }, a_instanceCharacter: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 16, divisor: 1 }, a_instancePrimaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 28, divisor: 1 }, a_instanceSecondaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 44, divisor: 1 }, a_instanceRotation: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 60, divisor: 1 }, a_instanceTransform: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 68, divisor: 1 }, a_instanceGlobalRotation: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 80, divisor: 1 }, a_instanceRotationCenter: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 92, divisor: 1 }, a_instanceArcAngles: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 100, divisor: 1 }, a_instanceBezierCP1: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 108, divisor: 1 }, a_instanceBezierCP2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 116, divisor: 1 }, a_instanceBezierStart: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 124, divisor: 1 }, a_instanceBezierEnd: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 132, divisor: 1 } });
|
|
568
568
|
let k = b;
|
|
569
569
|
class gt {
|
|
570
570
|
constructor(t, e = 1e3, i = 1.5) {
|
|
@@ -579,7 +579,7 @@ class gt {
|
|
|
579
579
|
h(this, "ue", null);
|
|
580
580
|
this.gt = t, this.ne = e, this.oe = i, this.fe();
|
|
581
581
|
}
|
|
582
|
-
|
|
582
|
+
$s(t) {
|
|
583
583
|
const e = this.re.length;
|
|
584
584
|
return this.re.push(t), this.ae = !0, e;
|
|
585
585
|
}
|
|
@@ -600,14 +600,14 @@ class gt {
|
|
|
600
600
|
fe() {
|
|
601
601
|
const t = this.gt;
|
|
602
602
|
this.he && t.deleteBuffer(this.he), this.he = t.createBuffer();
|
|
603
|
-
const e = this.ne *
|
|
603
|
+
const e = this.ne * _.BYTES_PER_INSTANCE;
|
|
604
604
|
t.bindBuffer(t.ARRAY_BUFFER, this.he), t.bufferData(t.ARRAY_BUFFER, e, t.DYNAMIC_DRAW), t.bindBuffer(t.ARRAY_BUFFER, null), this.ae = !0, this.ce = 0;
|
|
605
605
|
}
|
|
606
606
|
pe() {
|
|
607
607
|
if (!this.ae || this.re.length === 0) return;
|
|
608
608
|
const t = this.gt, e = this.re.length;
|
|
609
|
-
this.de(e), (!this.ue || this.ue.length < e *
|
|
610
|
-
const i =
|
|
609
|
+
this.de(e), (!this.ue || this.ue.length < e * _.FLOATS_PER_INSTANCE) && (this.ue = new Float32Array(e * _.FLOATS_PER_INSTANCE));
|
|
610
|
+
const i = _.ie(this.re);
|
|
611
611
|
t.bindBuffer(t.ARRAY_BUFFER, this.he), e <= this.ce ? t.bufferSubData(t.ARRAY_BUFFER, 0, i) : t.bufferData(t.ARRAY_BUFFER, i, t.DYNAMIC_DRAW), t.bindBuffer(t.ARRAY_BUFFER, null), this.ae = !1, this.ce = e;
|
|
612
612
|
}
|
|
613
613
|
_e(t) {
|
|
@@ -645,17 +645,17 @@ class gt {
|
|
|
645
645
|
this.he && this.gt.deleteBuffer(this.he);
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
|
-
class
|
|
648
|
+
class B {
|
|
649
649
|
constructor(t, e, i, s) {
|
|
650
650
|
h(this, "gt");
|
|
651
651
|
h(this, "me");
|
|
652
652
|
h(this, "ve");
|
|
653
653
|
h(this, "ge");
|
|
654
|
-
h(this, "
|
|
654
|
+
h(this, "Ae", null);
|
|
655
655
|
this.gt = t, this.me = e, this.ve = i, this.ge = s;
|
|
656
656
|
const r = this.gt.createBuffer();
|
|
657
657
|
if (!r) throw Error("Failed to create unit geometry buffer");
|
|
658
|
-
this.gt.bindBuffer(this.gt.ARRAY_BUFFER, r), this.gt.bufferData(this.gt.ARRAY_BUFFER, this.ge.
|
|
658
|
+
this.gt.bindBuffer(this.gt.ARRAY_BUFFER, r), this.gt.bufferData(this.gt.ARRAY_BUFFER, this.ge.ye, this.gt.STATIC_DRAW), this.gt.bindBuffer(this.gt.ARRAY_BUFFER, null), this.Ae = r;
|
|
659
659
|
}
|
|
660
660
|
get type() {
|
|
661
661
|
return this.ve;
|
|
@@ -664,7 +664,7 @@ class O {
|
|
|
664
664
|
return this.ge;
|
|
665
665
|
}
|
|
666
666
|
get unitBuffer() {
|
|
667
|
-
return this.
|
|
667
|
+
return this.Ae;
|
|
668
668
|
}
|
|
669
669
|
get batch() {
|
|
670
670
|
return this.me;
|
|
@@ -676,11 +676,11 @@ class O {
|
|
|
676
676
|
return !this.me.isEmpty;
|
|
677
677
|
}
|
|
678
678
|
Dt() {
|
|
679
|
-
this.me.Dt(), this.gt.deleteBuffer(this.
|
|
679
|
+
this.me.Dt(), this.gt.deleteBuffer(this.Ae);
|
|
680
680
|
}
|
|
681
681
|
Ce(t, e, i, s, r) {
|
|
682
682
|
const n = this.we(t, e, i, s, r.N || 0, r.X || 0, r.W || 0);
|
|
683
|
-
return { fs: [t, e],
|
|
683
|
+
return { fs: [t, e], Os: [i, s], Y: r.Y || [0, 0, 0], V: r.V || [1, 1, 1, 1], q: r.q || [0, 0, 0, 1], L: r.L || [0, 0], qs: [r.k ? 1 : 0, r.K ? 1 : 0, r.j ? 1 : 0], N: n.radiansX, X: n.radiansY, W: n.radiansZ, Zs: [n.centerX, n.centerY] };
|
|
684
684
|
}
|
|
685
685
|
be(t, e) {
|
|
686
686
|
const i = W(this.gt) || [0, 0, this.gt.canvas.width, this.gt.canvas.height];
|
|
@@ -695,27 +695,27 @@ class O {
|
|
|
695
695
|
return { centerX: (t + i / 2) / l * 2 - 1, centerY: 1 - (e + s / 2) / f * 2, radiansX: -r * Math.PI / 180, radiansY: -n * Math.PI / 180, radiansZ: -o * Math.PI / 180, aspectRatio: l / f };
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
|
-
const mt = {
|
|
699
|
-
class At extends
|
|
698
|
+
const mt = { ye: 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]), Rs: 6, zs: WebGL2RenderingContext.TRIANGLES, ps: 16, ds: { fs: { size: 2, offset: 0 }, _s: { size: 2, offset: 8 } } };
|
|
699
|
+
class At extends B {
|
|
700
700
|
constructor(t, e) {
|
|
701
|
-
super(t, e,
|
|
701
|
+
super(t, e, x.RECTANGLE, mt);
|
|
702
702
|
}
|
|
703
|
-
|
|
703
|
+
$s(t, e) {
|
|
704
704
|
const i = this.Ce(t.x, t.y, t.width, t.height, e);
|
|
705
|
-
return this.me
|
|
705
|
+
return this.me.$s(i);
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
const pt = {
|
|
709
|
-
class vt extends
|
|
708
|
+
const pt = { ye: 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]), Rs: 6, zs: WebGL2RenderingContext.TRIANGLES, ps: 16, ds: { fs: { size: 2, offset: 0 }, _s: { size: 2, offset: 8 } } };
|
|
709
|
+
class vt extends B {
|
|
710
710
|
constructor(t, e) {
|
|
711
|
-
super(t, e,
|
|
711
|
+
super(t, e, x.LINE, pt);
|
|
712
712
|
}
|
|
713
|
-
|
|
713
|
+
$s(t, e) {
|
|
714
714
|
const i = t.x2 - t.x1, s = t.y2 - t.y1, r = Math.hypot(i, s), n = t.thickness || e.I || 1, o = t.x1 + i / 2, c = t.y1 + s / 2, l = o - r / 2, f = c, u = this.Ce(l, f, r, n, e);
|
|
715
|
-
return this.xe(u, o, c), this.me
|
|
715
|
+
return this.xe(u, o, c), this.me.$s(u);
|
|
716
716
|
}
|
|
717
717
|
}
|
|
718
|
-
const yt = {
|
|
718
|
+
const yt = { ye: function(a = 32) {
|
|
719
719
|
const t = [], e = 2 * Math.PI / a;
|
|
720
720
|
for (let i = 0; i < a; i++) {
|
|
721
721
|
const s = i * e, r = (i + 1) % a * e, n = Math.cos(s), o = Math.sin(s), c = 0.5 * (n + 1), l = 0.5 * (o + 1), f = Math.cos(r), u = Math.sin(r), m = 0.5 * (f + 1), p = 0.5 * (u + 1);
|
|
@@ -723,16 +723,16 @@ const yt = { Ae: function(a = 32) {
|
|
|
723
723
|
}
|
|
724
724
|
return new Float32Array(t);
|
|
725
725
|
}(32), Rs: 96, zs: WebGL2RenderingContext.TRIANGLES, ps: 16, ds: { fs: { size: 2, offset: 0 }, _s: { size: 2, offset: 8 } } };
|
|
726
|
-
class
|
|
726
|
+
class xt extends B {
|
|
727
727
|
constructor(t, e) {
|
|
728
|
-
super(t, e,
|
|
728
|
+
super(t, e, x.ELLIPSE, yt);
|
|
729
729
|
}
|
|
730
|
-
|
|
730
|
+
$s(t, e) {
|
|
731
731
|
const i = this.Ce(t.x, t.y, t.width, t.height, e);
|
|
732
|
-
return this.xe(i, t.x, t.y), this.me
|
|
732
|
+
return this.xe(i, t.x, t.y), this.me.$s(i);
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
|
-
let
|
|
735
|
+
let Et = { ye: function(a) {
|
|
736
736
|
const t = [];
|
|
737
737
|
for (let e = 0; e < a; e++) {
|
|
738
738
|
const i = e / a, s = (e + 1) / a;
|
|
@@ -740,30 +740,30 @@ let xt = { Ae: function(a) {
|
|
|
740
740
|
}
|
|
741
741
|
return new Float32Array(t);
|
|
742
742
|
}(32), Rs: 96, zs: WebGL2RenderingContext.TRIANGLES, ps: 16, ds: { fs: { size: 2, offset: 0 }, _s: { size: 2, offset: 8 } } };
|
|
743
|
-
class wt extends
|
|
743
|
+
class wt extends B {
|
|
744
744
|
constructor(t, e) {
|
|
745
|
-
super(t, e,
|
|
745
|
+
super(t, e, x.ARC, Et);
|
|
746
746
|
}
|
|
747
|
-
|
|
747
|
+
$s(t, e) {
|
|
748
748
|
const i = t.x - t.width / 2, s = t.y - t.height / 2, r = t.start * Math.PI / 180, n = t.stop * Math.PI / 180, o = this.Ce(i, s, t.width, t.height, e);
|
|
749
|
-
return this.xe(o, t.x, t.y), o.Qs = [r, n], this.me
|
|
749
|
+
return this.xe(o, t.x, t.y), o.Qs = [r, n], this.me.$s(o);
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
|
-
const Tt = {
|
|
753
|
-
class Rt extends
|
|
752
|
+
const Tt = { ye: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Rs: 3, zs: WebGL2RenderingContext.TRIANGLES, ps: 16, ds: { fs: { size: 2, offset: 0 }, _s: { size: 2, offset: 8 } } };
|
|
753
|
+
class Rt extends B {
|
|
754
754
|
constructor(t, e) {
|
|
755
|
-
super(t, e,
|
|
755
|
+
super(t, e, x.TRIANGLE, Tt);
|
|
756
756
|
}
|
|
757
|
-
|
|
757
|
+
$s(t, e) {
|
|
758
758
|
const i = Math.min(t.x1, t.x2, t.x3), s = Math.max(t.x1, t.x2, t.x3), r = Math.min(t.y1, t.y2, t.y3), n = s - i, o = Math.max(t.y1, t.y2, t.y3) - r, c = this.Ce(i, r, n, o, e), l = i + 0.5 * n, f = r + o * (1 / 3);
|
|
759
|
-
return this.xe(c, l, f), this.me
|
|
759
|
+
return this.xe(c, l, f), this.me.$s(c);
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
762
|
function $(a, t, e, i, s) {
|
|
763
763
|
const r = 1 - a, n = r * r, o = a * a;
|
|
764
764
|
return n * r * t + 3 * n * a * e + 3 * r * o * i + o * a * s;
|
|
765
765
|
}
|
|
766
|
-
const bt = {
|
|
766
|
+
const bt = { ye: function(a = 16) {
|
|
767
767
|
const t = [];
|
|
768
768
|
for (let e = 0; e < a; e++) {
|
|
769
769
|
const i = e / a, s = (e + 1) / a;
|
|
@@ -771,16 +771,16 @@ const bt = { Ae: function(a = 16) {
|
|
|
771
771
|
}
|
|
772
772
|
return new Float32Array(t);
|
|
773
773
|
}(16), Rs: 96, zs: WebGL2RenderingContext.TRIANGLES, ps: 16, ds: { fs: { size: 2, offset: 0 }, _s: { size: 2, offset: 8 } } };
|
|
774
|
-
class Ct extends
|
|
774
|
+
class Ct extends B {
|
|
775
775
|
constructor(t, e) {
|
|
776
|
-
super(t, e,
|
|
776
|
+
super(t, e, x.BEZIER_CURVE, bt);
|
|
777
777
|
}
|
|
778
|
-
|
|
778
|
+
$s(t, e) {
|
|
779
779
|
const i = e.I || 1, s = $(0.5, t.x1, t.cp1x, t.cp2x, t.x2), r = $(0.5, t.y1, t.cp1y, t.cp2y, t.y2), n = this.Ce(0, 0, 1, i, e);
|
|
780
|
-
return this.xe(n, s, r), n.se = [t.x1, t.y1], n.Js = [t.cp1x, t.cp1y], n.te = [t.cp2x, t.cp2y], n.ee = [t.x2, t.y2], this.me
|
|
780
|
+
return this.xe(n, s, r), n.se = [t.x1, t.y1], n.Js = [t.cp1x, t.cp1y], n.te = [t.cp2x, t.cp2y], n.ee = [t.x2, t.y2], this.me.$s(n);
|
|
781
781
|
}
|
|
782
782
|
}
|
|
783
|
-
class
|
|
783
|
+
class Ut {
|
|
784
784
|
constructor(t) {
|
|
785
785
|
h(this, "gt");
|
|
786
786
|
h(this, "Me", null);
|
|
@@ -790,16 +790,16 @@ class Lt {
|
|
|
790
790
|
h(this, "Te", null);
|
|
791
791
|
h(this, "Pe", /* @__PURE__ */ new Map());
|
|
792
792
|
h(this, "Se");
|
|
793
|
-
h(this, "Ee");
|
|
794
793
|
h(this, "$e");
|
|
794
|
+
h(this, "Ee");
|
|
795
795
|
h(this, "H", []);
|
|
796
|
-
this.gt = t, this.Fe = new lt(t), this
|
|
796
|
+
this.gt = t, this.Fe = new lt(t), this.Ee = new it(), this.Se = new ft(t, this), this.$e = new dt(), this.Te = t.createBuffer(), Y(this.gt, [0, 0, this.gt.canvas.width, this.gt.canvas.height]);
|
|
797
797
|
}
|
|
798
798
|
De(t) {
|
|
799
799
|
let e = this.Pe.get(t);
|
|
800
800
|
if (e) return e;
|
|
801
801
|
const i = new gt(this.gt);
|
|
802
|
-
return e = (0, { [
|
|
802
|
+
return e = (0, { [x.RECTANGLE]: () => new At(this.gt, i), [x.LINE]: () => new vt(this.gt, i), [x.ELLIPSE]: () => new xt(this.gt, i), [x.ARC]: () => new wt(this.gt, i), [x.TRIANGLE]: () => new Rt(this.gt, i), [x.BEZIER_CURVE]: () => new Ct(this.gt, i) }[t])(), this.Pe.set(t, e), e;
|
|
803
803
|
}
|
|
804
804
|
ke(t) {
|
|
805
805
|
this.Me !== t && (this.Me = t, t.Nt());
|
|
@@ -825,19 +825,19 @@ class Lt {
|
|
|
825
825
|
Kt(t, e) {
|
|
826
826
|
this.Re[t] = e;
|
|
827
827
|
}
|
|
828
|
-
|
|
828
|
+
Le(t) {
|
|
829
829
|
Object.assign(this.Re, t);
|
|
830
830
|
}
|
|
831
831
|
hs(t) {
|
|
832
832
|
return this.Fe.hs(t);
|
|
833
833
|
}
|
|
834
|
-
|
|
834
|
+
Oe(t, e, i, s, r) {
|
|
835
835
|
const n = this.es(), o = { Ue: t.textures[0], Uf: t.textures[1], Ug: t.textures[2], Uh: t.textures[3], Ui: t.textures[4], Uj: [t.width, t.height] };
|
|
836
|
-
this.
|
|
836
|
+
this.$e.Is(e, i, s, r, n, o, this.Ee);
|
|
837
837
|
}
|
|
838
838
|
He(t, e, i, s, r) {
|
|
839
839
|
const n = this.ns(), o = t.Ge(), c = { Uk: o.texture, Ul: !!o.invert, Um: !!o.flipX, Un: !!o.flipY, Uo: o.charRotation, Up: o.charColorFixed, Uq: o.charColor, Ur: o.cellColorFixed, Us: o.cellColor, Ut: o.backgroundColor, Uu: o.charCount, Uv: o.charList };
|
|
840
|
-
this.
|
|
840
|
+
this.$e.Is(e, i, s, r, n, c, this.Ee);
|
|
841
841
|
}
|
|
842
842
|
Ie(t, e, i, s) {
|
|
843
843
|
var d;
|
|
@@ -847,29 +847,29 @@ class Lt {
|
|
|
847
847
|
g !== -1 && (r.enableVertexAttribArray(g), r.vertexAttribPointer(g, 2, r.FLOAT, !1, 8, 0)), r.drawArrays(r.TRIANGLES, 0, 6), g !== -1 && r.disableVertexAttribArray(g);
|
|
848
848
|
}
|
|
849
849
|
Ne(t, e, i, s) {
|
|
850
|
-
this.ze ? (this.
|
|
850
|
+
this.ze ? (this.$e.Is(t, e, i, s, this.ze, { ...this.Re }, this.Ee), this.ze = null, this.Re = {}) : this.$e.Gs(t, e, i, s, this.Ee);
|
|
851
851
|
}
|
|
852
852
|
Xe(t, e, i, s) {
|
|
853
|
-
this.
|
|
853
|
+
this.$e.Ns(t, e, i, s, this.Ee.lineWeight, this.Ee);
|
|
854
854
|
}
|
|
855
855
|
We(t, e, i, s) {
|
|
856
|
-
this.
|
|
856
|
+
this.$e.Xs(t, e, i, s, this.Ee);
|
|
857
857
|
}
|
|
858
858
|
Ke(t, e, i, s, r, n) {
|
|
859
|
-
this.
|
|
859
|
+
this.$e.Ks(t, e, i, s, r, n, this.Ee);
|
|
860
860
|
}
|
|
861
861
|
je(t, e, i, s, r, n, o, c) {
|
|
862
|
-
const l = this
|
|
863
|
-
this.
|
|
862
|
+
const l = this.Ee.lineWeight;
|
|
863
|
+
this.$e.js(t, e, i, s, r, n, o, c, l, this.Ee);
|
|
864
864
|
}
|
|
865
865
|
Ye(t, e, i = 1, s = {}) {
|
|
866
866
|
return new j(this.gt, t, e, i, s, this, !0);
|
|
867
867
|
}
|
|
868
868
|
Ve(t, e, i, s, r, n) {
|
|
869
|
-
this.
|
|
869
|
+
this.$e.Ws(t, e, i, s, r, n, this.Ee);
|
|
870
870
|
}
|
|
871
871
|
qe(t, e = t, i = t, s = 255) {
|
|
872
|
-
this
|
|
872
|
+
this.Ee.ft(t, e, i, s), this.Ys(t / 255, e / 255, i / 255, s / 255);
|
|
873
873
|
}
|
|
874
874
|
Ys(t = 0, e = 0, i = 0, s = 0) {
|
|
875
875
|
this.gt.clearColor(t, e, i, s), this.gt.clear(this.gt.COLOR_BUFFER_BIT);
|
|
@@ -881,25 +881,25 @@ class Lt {
|
|
|
881
881
|
return this.gt;
|
|
882
882
|
}
|
|
883
883
|
get state() {
|
|
884
|
-
return this
|
|
884
|
+
return this.Ee;
|
|
885
885
|
}
|
|
886
|
-
|
|
887
|
-
this.H.push(this
|
|
886
|
+
$t(t) {
|
|
887
|
+
this.H.push(this.Ee), this.Ee = t;
|
|
888
888
|
}
|
|
889
|
-
|
|
889
|
+
Et() {
|
|
890
890
|
const t = this.H.pop();
|
|
891
|
-
t && (this
|
|
891
|
+
t && (this.Ee = t);
|
|
892
892
|
}
|
|
893
893
|
St(t) {
|
|
894
894
|
const e = t, i = W(this.gt) ?? this.gt.getParameter(this.gt.VIEWPORT), s = { shader: e, gl: this.gt, viewport: i };
|
|
895
895
|
this.ke(e);
|
|
896
896
|
const r = /* @__PURE__ */ new Set();
|
|
897
|
-
for (const n of this
|
|
898
|
-
for (const n of r) n !==
|
|
899
|
-
this.Se.ws(s, this
|
|
897
|
+
for (const n of this.$e) n.type === x.CUSTOM ? r.add(x.RECTANGLE) : r.add(n.type);
|
|
898
|
+
for (const n of r) n !== x.CUSTOM && this.De(n);
|
|
899
|
+
this.Se.ws(s, this.$e, this.Pe), this.$e.Ys();
|
|
900
900
|
}
|
|
901
901
|
Dt() {
|
|
902
|
-
this.gt.deleteBuffer(this.Te), this.
|
|
902
|
+
this.gt.deleteBuffer(this.Te), this.$e.Ys();
|
|
903
903
|
for (const t of this.Pe.values()) t.Dt();
|
|
904
904
|
this.Fe.Dt(), this.Se.Dt();
|
|
905
905
|
}
|
|
@@ -935,7 +935,7 @@ function V(a, t, e) {
|
|
|
935
935
|
for (let n = t; n < i; n += 4) r.uint8[3] = a[n] || 0, r.uint8[2] = a[n + 1] || 0, r.uint8[1] = a[n + 2] || 0, r.uint8[0] = a[n + 3] || 0, s = s + (r.uint32[0] >>> 0) >>> 0;
|
|
936
936
|
return s >>> 0;
|
|
937
937
|
}
|
|
938
|
-
class
|
|
938
|
+
class Ft {
|
|
939
939
|
constructor(t) {
|
|
940
940
|
h(this, "b");
|
|
941
941
|
h(this, "p", 0);
|
|
@@ -974,7 +974,7 @@ function N(a) {
|
|
|
974
974
|
if (!c) continue;
|
|
975
975
|
const l = s[c]++;
|
|
976
976
|
let f = n.get(c);
|
|
977
|
-
f || (f = [], n.set(c, f)), f[
|
|
977
|
+
f || (f = [], n.set(c, f)), f[Pt(l, c)] = o;
|
|
978
978
|
}
|
|
979
979
|
return { min: t, max: e, table: n };
|
|
980
980
|
}
|
|
@@ -990,12 +990,12 @@ function q(a, t) {
|
|
|
990
990
|
}
|
|
991
991
|
throw Error("Invalid Huffman code");
|
|
992
992
|
}
|
|
993
|
-
function
|
|
993
|
+
function Pt(a, t) {
|
|
994
994
|
let e = 0;
|
|
995
995
|
for (let i = 0; i < t; i++) e = e << 1 | 1 & a, a >>>= 1;
|
|
996
996
|
return e >>> 0;
|
|
997
997
|
}
|
|
998
|
-
function
|
|
998
|
+
function Ot(a) {
|
|
999
999
|
if (a.length < 2) throw Error("ZLIB data too short");
|
|
1000
1000
|
const t = a[0], e = a[1];
|
|
1001
1001
|
if ((15 & t) != 8) throw Error("Unsupported ZLIB compression method");
|
|
@@ -1026,28 +1026,28 @@ function Pt(a) {
|
|
|
1026
1026
|
for (let v = 280; v <= 287; v++) d[v] = 8;
|
|
1027
1027
|
p = N(d), g = N(Array(32).fill(5));
|
|
1028
1028
|
} else {
|
|
1029
|
-
const d = r.readBits(5) + 257, v = r.readBits(5) + 1, A = r.readBits(4) + 4,
|
|
1030
|
-
for (let
|
|
1031
|
-
const
|
|
1029
|
+
const d = r.readBits(5) + 257, v = r.readBits(5) + 1, A = r.readBits(4) + 4, E = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], y = Array(19).fill(0);
|
|
1030
|
+
for (let F = 0; F < A; F++) y[E[F]] = r.readBits(3);
|
|
1031
|
+
const U = N(y), T = [];
|
|
1032
1032
|
for (; T.length < d + v; ) {
|
|
1033
|
-
const
|
|
1034
|
-
if (
|
|
1035
|
-
else if (
|
|
1036
|
-
const I = r.readBits(2) + 3,
|
|
1037
|
-
for (let J = 0; J < I; J++) T.push(
|
|
1038
|
-
} else if (
|
|
1033
|
+
const F = q(r, U);
|
|
1034
|
+
if (F <= 15) T.push(F);
|
|
1035
|
+
else if (F === 16) {
|
|
1036
|
+
const I = r.readBits(2) + 3, L = T[T.length - 1] || 0;
|
|
1037
|
+
for (let J = 0; J < I; J++) T.push(L);
|
|
1038
|
+
} else if (F === 17) {
|
|
1039
1039
|
const I = r.readBits(3) + 3;
|
|
1040
|
-
for (let
|
|
1040
|
+
for (let L = 0; L < I; L++) T.push(0);
|
|
1041
1041
|
} else {
|
|
1042
|
-
if (
|
|
1042
|
+
if (F !== 18) throw Error("Invalid code length symbol");
|
|
1043
1043
|
{
|
|
1044
1044
|
const I = r.readBits(7) + 11;
|
|
1045
|
-
for (let
|
|
1045
|
+
for (let L = 0; L < I; L++) T.push(0);
|
|
1046
1046
|
}
|
|
1047
1047
|
}
|
|
1048
1048
|
}
|
|
1049
|
-
const R = T.slice(0, d),
|
|
1050
|
-
p = N(R), g = N(
|
|
1049
|
+
const R = T.slice(0, d), P = T.slice(d, d + v);
|
|
1050
|
+
p = N(R), g = N(P);
|
|
1051
1051
|
}
|
|
1052
1052
|
for (; ; ) {
|
|
1053
1053
|
const d = q(r, p);
|
|
@@ -1057,23 +1057,23 @@ function Pt(a) {
|
|
|
1057
1057
|
if (d > 256 && d < 286) {
|
|
1058
1058
|
const v = d - 257;
|
|
1059
1059
|
let A = o[v];
|
|
1060
|
-
const
|
|
1061
|
-
|
|
1060
|
+
const E = c[v];
|
|
1061
|
+
E && (A += r.readBits(E));
|
|
1062
1062
|
const y = q(r, g);
|
|
1063
1063
|
if (y >= 30) throw Error("Invalid distance symbol");
|
|
1064
|
-
let
|
|
1064
|
+
let U = l[y];
|
|
1065
1065
|
const T = f[y];
|
|
1066
|
-
T && (
|
|
1067
|
-
const R = n.length -
|
|
1066
|
+
T && (U += r.readBits(T));
|
|
1067
|
+
const R = n.length - U;
|
|
1068
1068
|
if (R < 0) throw Error("Invalid distance");
|
|
1069
|
-
for (let
|
|
1069
|
+
for (let P = 0; P < A; P++) n.push(n[R + P] || 0);
|
|
1070
1070
|
} else if (d === 286 || d === 287) throw Error("Reserved length symbol");
|
|
1071
1071
|
}
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
1076
|
-
}(new
|
|
1076
|
+
}(new Ft(a.subarray(i)), s), new Uint8Array(s);
|
|
1077
1077
|
}
|
|
1078
1078
|
function Mt(a) {
|
|
1079
1079
|
const t = w, e = new Uint8Array(a);
|
|
@@ -1081,13 +1081,13 @@ function Mt(a) {
|
|
|
1081
1081
|
const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), n = [];
|
|
1082
1082
|
let o = 44;
|
|
1083
1083
|
for (let A = 0; A < s; A++) {
|
|
1084
|
-
const
|
|
1085
|
-
n.push({ tag:
|
|
1084
|
+
const E = t.readASCII(e, o, 4), y = t.readUint(e, o + 4), U = t.readUint(e, o + 8), T = t.readUint(e, o + 12), R = t.readUint(e, o + 16);
|
|
1085
|
+
n.push({ tag: E, offset: y, compLength: U, origLength: T, checksum: R }), o += 20;
|
|
1086
1086
|
}
|
|
1087
1087
|
for (const A of n) {
|
|
1088
|
-
const
|
|
1089
|
-
if (A.compLength === A.origLength) A.data = new Uint8Array(
|
|
1090
|
-
else if (A.data =
|
|
1088
|
+
const E = new Uint8Array(e.buffer, A.offset, A.compLength);
|
|
1089
|
+
if (A.compLength === A.origLength) A.data = new Uint8Array(E);
|
|
1090
|
+
else if (A.data = Ot(E), A.data.length !== A.origLength) if (A.data.length < A.origLength) {
|
|
1091
1091
|
const y = new Uint8Array(A.origLength);
|
|
1092
1092
|
y.set(A.data), A.data = y;
|
|
1093
1093
|
} else A.data = A.data.subarray(0, A.origLength);
|
|
@@ -1104,34 +1104,34 @@ function Mt(a) {
|
|
|
1104
1104
|
let v = 12;
|
|
1105
1105
|
for (const A of n) {
|
|
1106
1106
|
t.writeASCII(d, v, A.tag), v += 4;
|
|
1107
|
-
let
|
|
1108
|
-
if (A.tag === "head" &&
|
|
1109
|
-
const y = new Uint8Array(
|
|
1107
|
+
let E = A.data;
|
|
1108
|
+
if (A.tag === "head" && E.length >= 12) {
|
|
1109
|
+
const y = new Uint8Array(E);
|
|
1110
1110
|
t.writeUint(y, 8, 0);
|
|
1111
|
-
const
|
|
1112
|
-
t.writeUint(d, v,
|
|
1111
|
+
const U = V(y, 0, X(y.length));
|
|
1112
|
+
t.writeUint(d, v, U), v += 4;
|
|
1113
1113
|
} else {
|
|
1114
|
-
const y = V(
|
|
1114
|
+
const y = V(E, 0, X(E.length));
|
|
1115
1115
|
t.writeUint(d, v, y), v += 4;
|
|
1116
1116
|
}
|
|
1117
1117
|
t.writeUint(d, v, g[A.tag]), v += 4, t.writeUint(d, v, A.data.length), v += 4;
|
|
1118
1118
|
}
|
|
1119
1119
|
for (const A of n) {
|
|
1120
|
-
const
|
|
1121
|
-
d.set(A.data,
|
|
1120
|
+
const E = g[A.tag];
|
|
1121
|
+
d.set(A.data, E);
|
|
1122
1122
|
}
|
|
1123
1123
|
if (n.find((A) => A.tag === "head")) {
|
|
1124
|
-
const A = g.head,
|
|
1125
|
-
const T = w, R =
|
|
1124
|
+
const A = g.head, E = function(y, U) {
|
|
1125
|
+
const T = w, R = U + 8, P = [y[R], y[R + 1], y[R + 2], y[R + 3]];
|
|
1126
1126
|
T.writeUint(y, R, 0);
|
|
1127
|
-
const
|
|
1128
|
-
return y[R] =
|
|
1127
|
+
const F = 2981146554 - (V(y, 0, X(y.length)) >>> 0) >>> 0;
|
|
1128
|
+
return y[R] = P[0], y[R + 1] = P[1], y[R + 2] = P[2], y[R + 3] = P[3], F >>> 0;
|
|
1129
1129
|
}(d, A);
|
|
1130
|
-
t.writeUint(d, A + 8,
|
|
1130
|
+
t.writeUint(d, A + 8, E);
|
|
1131
1131
|
}
|
|
1132
1132
|
return d.buffer;
|
|
1133
1133
|
}
|
|
1134
|
-
const
|
|
1134
|
+
const Lt = { parseTab(a, t, e) {
|
|
1135
1135
|
const i = { tables: [], ids: {}, off: t };
|
|
1136
1136
|
a = new Uint8Array(a.buffer, t, e), t = 0;
|
|
1137
1137
|
const s = w, r = s.readUshort, n = r(a, t += 2);
|
|
@@ -1181,7 +1181,7 @@ const _t = { parseTab(a, t, e) {
|
|
|
1181
1181
|
t += 2;
|
|
1182
1182
|
const c = i.readShort(a, t);
|
|
1183
1183
|
return t += 2, t += 6, { unitsPerEm: s, xMin: r, yMin: n, xMax: o, yMax: c, indexToLocFormat: i.readShort(a, t) };
|
|
1184
|
-
} },
|
|
1184
|
+
} }, _t = { parseTab(a, t, e) {
|
|
1185
1185
|
const i = w;
|
|
1186
1186
|
t += 4;
|
|
1187
1187
|
const s = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], r = {};
|
|
@@ -1190,16 +1190,16 @@ const _t = { parseTab(a, t, e) {
|
|
|
1190
1190
|
r[o] = c(a, t + 2 * n);
|
|
1191
1191
|
}
|
|
1192
1192
|
return r;
|
|
1193
|
-
} },
|
|
1193
|
+
} }, St = { parseTab(a, t, e, i) {
|
|
1194
1194
|
const s = w, r = [], n = [], o = i.maxp.numGlyphs, c = i.hhea.numberOfHMetrics;
|
|
1195
1195
|
let l = 0, f = 0, u = 0;
|
|
1196
1196
|
for (; u < c; ) l = s.readUshort(a, t + (u << 2)), f = s.readShort(a, t + (u << 2) + 2), r.push(l), n.push(f), u++;
|
|
1197
1197
|
for (; u < o; ) r.push(l), n.push(f), u++;
|
|
1198
1198
|
return { aWidth: r, lsBearing: n };
|
|
1199
|
-
} }, tt = { cmap:
|
|
1199
|
+
} }, tt = { cmap: Lt, head: Dt, hhea: _t, maxp: { parseTab(a, t, e) {
|
|
1200
1200
|
const i = w;
|
|
1201
1201
|
return i.readUint(a, t), t += 4, { numGlyphs: i.readUshort(a, t) };
|
|
1202
|
-
} }, hmtx:
|
|
1202
|
+
} }, hmtx: St, loca: { parseTab(a, t, e, i) {
|
|
1203
1203
|
const s = w, r = [], n = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
|
|
1204
1204
|
if (n === 0) for (let c = 0; c < o; c++) r.push(s.readUshort(a, t + (c << 1)) << 1);
|
|
1205
1205
|
else if (n === 1) for (let c = 0; c < o; c++) r.push(s.readUint(a, t + (c << 2)));
|
|
@@ -1211,7 +1211,7 @@ const _t = { parseTab(a, t, e) {
|
|
|
1211
1211
|
}, Qe(a, t) {
|
|
1212
1212
|
const e = w, i = a.Je, s = a.loca;
|
|
1213
1213
|
if (s[t] === s[t + 1]) return null;
|
|
1214
|
-
const r =
|
|
1214
|
+
const r = O.findTable(i, "glyf", a.ti);
|
|
1215
1215
|
if (!r) return null;
|
|
1216
1216
|
let n = r[0] + s[t];
|
|
1217
1217
|
const o = {};
|
|
@@ -1246,14 +1246,14 @@ const _t = { parseTab(a, t, e) {
|
|
|
1246
1246
|
for (let m = 0; m < l; m++) f += o.xs[m], u += o.ys[m], o.xs[m] = f, o.ys[m] = u;
|
|
1247
1247
|
} else o.parts = [], o.endPts = [], o.flags = [], o.xs = [], o.ys = [];
|
|
1248
1248
|
return o;
|
|
1249
|
-
} } },
|
|
1249
|
+
} } }, O = { parse(a) {
|
|
1250
1250
|
const t = new Uint8Array(a), e = w.readASCII(t, 0, 4);
|
|
1251
1251
|
if (e === "wOFF") a = Mt(a);
|
|
1252
1252
|
else if (e === "wOF2") throw Error("WOFF2 is not supported in this build (Brotli + WOFF2 transforms required)");
|
|
1253
1253
|
return [((i, s, r, n) => {
|
|
1254
1254
|
const o = tt, c = { Je: i, si: s, ti: r };
|
|
1255
1255
|
for (const l in o) {
|
|
1256
|
-
const f = l, u =
|
|
1256
|
+
const f = l, u = O.findTable(i, f, r);
|
|
1257
1257
|
if (u) {
|
|
1258
1258
|
const [m, p] = u;
|
|
1259
1259
|
let g = n[m];
|
|
@@ -1274,7 +1274,7 @@ const _t = { parseTab(a, t, e) {
|
|
|
1274
1274
|
}
|
|
1275
1275
|
return null;
|
|
1276
1276
|
}, T: tt, B: w };
|
|
1277
|
-
class
|
|
1277
|
+
class Bt {
|
|
1278
1278
|
ei(t) {
|
|
1279
1279
|
var i;
|
|
1280
1280
|
const e = [];
|
|
@@ -1398,27 +1398,27 @@ class Z {
|
|
|
1398
1398
|
}
|
|
1399
1399
|
class It {
|
|
1400
1400
|
constructor(t) {
|
|
1401
|
-
h(this, "yi");
|
|
1402
1401
|
h(this, "Ai");
|
|
1402
|
+
h(this, "yi");
|
|
1403
1403
|
h(this, "xt");
|
|
1404
1404
|
h(this, "Ci");
|
|
1405
|
-
this.xt = t, this.Ci = new Z(), this.
|
|
1405
|
+
this.xt = t, this.Ci = new Z(), this.Ai = document.createElement("canvas"), this.yi = this.Ai.getContext("2d", { willReadFrequently: !0, alpha: !0 });
|
|
1406
1406
|
}
|
|
1407
1407
|
createTextureAtlas(t, e, i, s) {
|
|
1408
1408
|
const r = t.length, n = Math.ceil(Math.sqrt(r)), o = Math.ceil(r / n), c = e.width * n, l = e.height * o, f = typeof s == "object" ? s : null;
|
|
1409
1409
|
this.wi(c, l), this.bi(t, e, n, i, f);
|
|
1410
1410
|
const u = this.xt.Ye(c, l, 1, { filter: "nearest" });
|
|
1411
|
-
return u.Tt(this.
|
|
1411
|
+
return u.Tt(this.Ai), { framebuffer: u, columns: n, rows: o };
|
|
1412
1412
|
}
|
|
1413
1413
|
wi(t, e) {
|
|
1414
|
-
this.
|
|
1414
|
+
this.Ai.width = t, this.Ai.height = e, this.Ai.style.width = t + "px", this.Ai.style.height = e + "px", this.yi.imageSmoothingEnabled = !1, this.Ai.style.imageRendering = "pixelated", this.yi.clearRect(0, 0, t, e), this.yi.textBaseline = "top", this.yi.textAlign = "left", this.yi.fillStyle = "white";
|
|
1415
1415
|
}
|
|
1416
1416
|
bi(t, e, i, s, r) {
|
|
1417
1417
|
const n = s / r.head.unitsPerEm;
|
|
1418
1418
|
for (let o = 0; o < t.length; o++) {
|
|
1419
1419
|
const c = o % i, l = Math.floor(o / i), f = t[o].character, u = this.xi(r, f);
|
|
1420
1420
|
if (!u) continue;
|
|
1421
|
-
const m = f.codePointAt(0) || 0, p = this.Ci.li(r, m), g = this.Mi(r, p) * n, d = c * e.width, v = l * e.height, A = d + 0.5 * e.width,
|
|
1421
|
+
const m = f.codePointAt(0) || 0, p = this.Ci.li(r, m), g = this.Mi(r, p) * n, d = c * e.width, v = l * e.height, A = d + 0.5 * e.width, E = v + 0.5 * e.height, y = Math.round(A - 0.5 * e.width), U = Math.round(E - 0.5 * s), T = y + 0.5 * (e.width - g), R = U + r.hhea.ascender * n;
|
|
1422
1422
|
this.Fi(u, T, R, n);
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
@@ -1426,8 +1426,8 @@ class It {
|
|
|
1426
1426
|
const i = e.codePointAt(0) || 0, s = this.Ci.li(t, i);
|
|
1427
1427
|
if (s === 0) return null;
|
|
1428
1428
|
if (t.glyf && t.glyf[s] !== null) return t.glyf[s];
|
|
1429
|
-
if (
|
|
1430
|
-
const r =
|
|
1429
|
+
if (O && O.T && O.T.glyf) {
|
|
1430
|
+
const r = O.T.glyf.Qe(t, s);
|
|
1431
1431
|
return t.glyf && r && (t.glyf[s] = r), r;
|
|
1432
1432
|
}
|
|
1433
1433
|
return null;
|
|
@@ -1440,36 +1440,36 @@ class It {
|
|
|
1440
1440
|
if (!t || !t.xs || t.noc === 0) return;
|
|
1441
1441
|
const { xs: r, ys: n, endPts: o, flags: c } = t;
|
|
1442
1442
|
if (!(r && n && o && c)) return;
|
|
1443
|
-
this.
|
|
1443
|
+
this.yi.beginPath();
|
|
1444
1444
|
let l = 0;
|
|
1445
1445
|
for (let f = 0; f < o.length; f++) {
|
|
1446
1446
|
const u = o[f];
|
|
1447
1447
|
if (!(u < l)) {
|
|
1448
1448
|
if (u >= l) {
|
|
1449
1449
|
const m = e + r[l] * s, p = i - n[l] * s;
|
|
1450
|
-
this.
|
|
1450
|
+
this.yi.moveTo(m, p);
|
|
1451
1451
|
let g = l + 1;
|
|
1452
1452
|
for (; g <= u; )
|
|
1453
1453
|
if (1 & c[g]) {
|
|
1454
1454
|
const d = e + r[g] * s, v = i - n[g] * s;
|
|
1455
|
-
this.
|
|
1455
|
+
this.yi.lineTo(d, v), g++;
|
|
1456
1456
|
} else {
|
|
1457
1457
|
const d = e + r[g] * s, v = i - n[g] * s;
|
|
1458
1458
|
let A = g + 1 > u ? l : g + 1;
|
|
1459
1459
|
if (1 & c[A]) {
|
|
1460
|
-
const
|
|
1461
|
-
this.
|
|
1460
|
+
const E = e + r[A] * s, y = i - n[A] * s;
|
|
1461
|
+
this.yi.quadraticCurveTo(d, v, E, y), g = A + 1;
|
|
1462
1462
|
} else {
|
|
1463
|
-
const
|
|
1464
|
-
this.
|
|
1463
|
+
const E = (d + (e + r[A] * s)) / 2, y = (v + (i - n[A] * s)) / 2;
|
|
1464
|
+
this.yi.quadraticCurveTo(d, v, E, y), g = A;
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
|
-
this.
|
|
1467
|
+
this.yi.closePath();
|
|
1468
1468
|
}
|
|
1469
1469
|
l = u + 1;
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
|
-
this.
|
|
1472
|
+
this.yi.fill();
|
|
1473
1473
|
}
|
|
1474
1474
|
}
|
|
1475
1475
|
class Nt {
|
|
@@ -1522,20 +1522,20 @@ class zt {
|
|
|
1522
1522
|
}
|
|
1523
1523
|
class Gt {
|
|
1524
1524
|
constructor(t, e = 16) {
|
|
1525
|
-
h(this, "
|
|
1526
|
-
h(this, "
|
|
1525
|
+
h(this, "$i");
|
|
1526
|
+
h(this, "Ei", []);
|
|
1527
1527
|
h(this, "Di");
|
|
1528
1528
|
h(this, "ki", 16);
|
|
1529
1529
|
h(this, "Bi", 0);
|
|
1530
|
-
h(this, "
|
|
1531
|
-
h(this, "
|
|
1530
|
+
h(this, "Li", 0);
|
|
1531
|
+
h(this, "Oi", { width: 0, height: 0 });
|
|
1532
1532
|
h(this, "Hi");
|
|
1533
1533
|
h(this, "Gi", /* @__PURE__ */ new Map());
|
|
1534
1534
|
h(this, "Ii");
|
|
1535
1535
|
h(this, "Ni");
|
|
1536
1536
|
h(this, "Xi");
|
|
1537
1537
|
h(this, "Wi");
|
|
1538
|
-
this.ki = e, this.Ii = new
|
|
1538
|
+
this.ki = e, this.Ii = new Bt(), this.Ni = new It(t), this.Xi = new Nt(), this.Wi = new zt();
|
|
1539
1539
|
}
|
|
1540
1540
|
async Ki(t) {
|
|
1541
1541
|
let e;
|
|
@@ -1545,13 +1545,13 @@ class Gt {
|
|
|
1545
1545
|
e = await i.arrayBuffer();
|
|
1546
1546
|
} else
|
|
1547
1547
|
e = await (await fetch("data:font/woff;base64,d09GRgABAAAAABbwAAoAAAAAfywAAQABAAAAAAAAAAAAAAAAAAAAAAAAAABjbWFwAAAA9AAAAbsAAAkgIO8lSWdseWYAAAKwAAAOfgAAaLS4ctN0aGVhZAAAETAAAAAsAAAAOCi8/PVoaGVhAAARXAAAABkAAAAkCwEFAmhtdHgAABF4AAAAhQAABAQEAIOAbG9jYQAAEgAAAAKUAAAECAAy54BtYXhwAAAUlAAAABgAAAAgASIAgm5hbWUAABSsAAAB5wAAA6RWz85KT1MvMgAAFpQAAABFAAAAYM+QEyRwb3N0AAAW3AAAABQAAAAgAGkANHja7dRPSFRRFMfx38wdXblw4cJC7M0bz60gWlULGUFctWgR0UIQQkmDyn27kpAQaaEO2jhWJuafiQFtcDJtSqGhiFZtot5x3jzEVQQhlRJcOb0khiRc1+J94R64uw8cOADCAJT/avwZAiIpRCK3/P999KAS9biOSUxhBhlksYjnWMFrvME7vMca1vEF37ANAwkNqYRKqkk1rdLqscqpVVVQryzbils3rJnocHTWPmgfso/ap+0OuysWjlXHogQKUxVVUw3VUh010DE6QXHqph7qpT66TQmaoAxlaZnyVKC39FHHdbNu0e36or6kr4r4TgsTu75HmEcOy76vUPaVsIFNbOHHX74F3/fyD9+A7ztg1//2de76rH18Z8u+AXqwx/dBN5Z9XfqKiKzLqqzIC8nLkixKThZkXuZkVh7KuNyTuzImKRmVO1KxU7ETMtvmu/lqPptPxjOuKXo3vcveYQ+l2lKlO+Im3H632z3vnis+KaaLKc7zM87yHGc4zdM8zkke5H6+xp3cwRe4jVv5DLdwE5/ik3ycj3Cdk3eWnKfOmDPqJJ3hX9sOCvpPC65QcIWCgv5pPwGY9ak7AHja3V07ryQ5FT62axjQaDWsVmiCFQJpA4QINiAgICDYgICAgICAgICAgICAgIAA//AuF9Xlsn2etqv67iIY6apv3+6yj31e33nYA95FiD4uAAHeA7jyLzoA2Paf/Lp/Dun5W8x/Be/AxyCfO79fnj+e25/ZZzlewcM+3wIhwpfwE/Sc9e8YDyLU1ycF5XUD+to+L98O/An8VKQj0lnOtYdM776OJ71fTVC8//N1rLKDGsXl863OjSl5/iyIUu0HjJ+d+uO3rX3rXd33d/DjfR0/h6/n1iK5kWf36Hf2AxpVa6zU7ZLTnt3Q3wN7+tK6MVcBjUP/3vj56diHuT3YxVbKSvl9FdJHeFE4jfmJn2DSSOS9fuJ27SH7umuoL3oLWGOLxh3f2b8bnn/5Ql8n5SEYFD33q/0lKXxwjQfDOZtGgyEz+W8X5txl2zVb9MXO2S8HfD3ncbHousP6WPV2i/R7C+c06HK5ye/lfdl3Bj5Q2qitaLYhgLQWZY+fr/65A9Ly1r10jI783HOffJWZJ6ee8uuB0nmMXeSqWvRz5Dx/tiWf7H0OF+1DuK7vhy4ffP8An/doofqbQNXTqmlNT1c0v4/Eqpy29eBMLHty0PKZoCMW6VqRlDXNwvbD4RW2MYfyjNdXV3LaJuEdKgXcHvX2nHiz27RxHmC9w/qn0AbS+mJbSeX8pO1zlbbogPK7zJxAs3iFtrV8W/LHsHVZvxJ6Rlt7gum1nvjpnHNO4gFJqaoBWOKFVwKqAangorb2j5KKvG5N31O1ownZdhcZH7FuT9nznoxRv4ylrbfvzA9D88GO8uGDtgN0/1O09ntFlv3YhbIf/ml3/dPGqvi6rCMw6jNd53PM07BnK2eCJXmnzxrruI8ObOuxmZ/dxbd5nS77U7I/xaMdLm5/DXzuLLcwXlOLIVQ0an722pou6raGnpp/QYiwR0V5nwDL0Gk/f2TSUalIGOkSvfNAcVNCesV9a2q675FtsVAk4c5GPEfZT27XVqT9PmpxXtVn0577KO3MGrkXs+xKkHZk6EMUS440uO01t+Ark8yGYYjtsleqoPQksLuF0kOd/7TtbZ3XvNalNRNLqK+90fEDTAfy1FWWOBcT9fkTmrExe+viDNccYF+JqHeIbyBtlYxhStbmSc8DSX9/rICoXkkGSMfEJR7QsYAjNlhgn6iNS7T0AtakNnvaJ+W1TeQdeIxHaHtXaMtU+GP3CL5v+2RqHfc5JC6k9DJ6HhFaHHfu9Lc1Z5HlB5JWNOc8NupiUSlpa/7NIx0W0Ra10YcOVWnDfqhodmgI1CM5nrJS1DYKlMmyeAmoZaLrQnmNSRxAV7qZ0u0sr2Q8WbzUrRivE200nZ+x371Yj+idQH+bsOAFD16woZXuheBJI85UYyA+Ht17bJsTKLHHG+tuQpJX/AGX4eu2lq+vh8gQPgaLUpk1h7fcb1SJ4LEnGb+rdUHRHw96riVV36L5EgdqHNByqCTy82hnkrSSk3k5KTNWnJZ/buTlOvQngiceAkd4OHPz0K+tdOmGUYwJht2kcuBEntSRPOmZfyc40tFqD40IQeb2goGZvKIVzW4G5DMcQ4qOY3zVRzpmo1sMg+U1VemumtLofjFeCcxqJIUnM2vJuQeCHiOOwx4ss7pF6u+PtXxmZApbjCti22JtA+hVxUw7z6Xs2sSzMkeklSLPfwalYkjjt/0bHye4gKkXeaig5MpILVRiAd1vCrtP5Aj5uaN2PF1zxrE7koOgaY2PPL9FkccCKlprUZGr+zr0tw56iCvwGBTs+MFFxVbWeTaCQTj2WCBM1NnoWNxOBpBZU8f00hPsFDr+15wPevNsJG4IN+OGwKyWzKnW8S/GDUHZOd+44SsvbDvCuhYUTQSaQSFeWtoR4Xc833VimVzRvgm58QwZFQTthQ+awgQTeuVI7gLrF638Yixi+ot4RVZ5niDPFxBediyXNj++jUWDgkU3Zc96fDKwv4iiylyA4nalMkLX9C1hf24DNNkZyNDkflOPF4BqwdYbv1vLG9VX03W96PVKiCq+A01i5utY2d9YfSMP0qvQ7eFQUHSKvNfpCl21nqNafqf1UQksqfVe1PEPPNiJpY81iZoP119ZTUHojdpseMYqec5zr/2Jgo695rmycZWzSgOpXzMpbFrHu1Zmq/xA8pX3cgEQZU1/YzaexuQbXIoxF9THdaEzz9VaE5fgNVIPR/sIS8fQyipam9JXqHdOtPEIRllqzP7Ewh9063Z2IYH+GiLNUPFXJIcEM4RYc7bEkjwQL4/1fx+aHL8/62Of5vo3y+p92QX2fh18zrNFcPX9sfZAdBDZu8vxCM4clX31Qr9RrLPkDDDau8v8LZRar2N8lSOj1NGsLJeBZam1TIuwpzwepL3CJAvyANsPnj3BAzsD3a5X6ydEaZUSs50b7g2JrYcyG2lRL+xl+jD+Gfod33w82P0FTuYREa3c70CRS82XCtxIueJHXuIMB6tMt+x7lf7m5U4tyK9L3smuLrxqDxYPI30rYzk2h2NzgPXqAvPrQdqUxvdWF2zVwDrHCq0RoI0Hcrzcn9D8BMxYEMszZBzooqa/jsTxSeTthXTm9FC2n+pYEh8uVqyL9436quMD6pnK7njZM6msy4uYsunVquBSi4clVn8gblYc96TFyF04ll2oqCB300cDIbPxrZoqXZ1DHWvNh2irrNxstSaZYa2VB333tOr9mRcx7ETmXKmSFz6GkidstKjZFE8qIX26eG8KoS/b9uij9GFOiwFIVj5NyErT8rZGstdmD4lc4/xaNevd1uwOPCLX7Ems2TTc81MrUVmzyqdOr1v1PCPat9jmQfUYJEEbzNCSse4DevSYCIXal+bDCC3I2+EeTFKd7ltnFNN0sGLIfRcGfSWKD0BPANWTQIqcNtsaAON/1A/BeywPGhybs2ZEA1sH9FbgDMpTQx5L5k4fN/RR8lBHvif2ftB7oa8isVdrdWDxp/Hp6N8MsdUgqdS0M12EZrhC7TpJZZLZOZelRdeDUyffq3s6xPhztK4Xd9h6f4pIieNu4lI/jEN1XEMjbafK6lry/jkOYedyVMyp2vaHGlM8zBjCkdi28NdrNldgLa/a0orYtN6OwoMh7vPAsxb9eNTDrOdJBWuXsb6En8Evb5yTrJw1Y1XTHnmCFNtPkhHnuN+8QwHGi3JUJf4zeaTJsBpFdnik5V4fZq510ifEHMf7M55f2fteR1DJ73gzf4vyO42Or3Z5mZcWdlY6wb3sRvd0olKfGeaCWm5yGEtDwzLH6yPS95wmcVb2BBrYzig5tGb7Bvb5fkyfvW2nRhlxF3cyz8qGOF//eVLXq7P4oQTop9UASTKPr91h1zu5wu753DbqtXUO8pOT6wzdnQfWn2X3Csr5ktxP4FUmlBHHPThBO0mQ6wTFVxbM5mPCeXWP7ha4YDf8BdvAeaGd/XntlgHlW2eMFAR2CBPYAQzPrGeVy1ieYCOQdtpXGZyss4F2rkr5W8tJh06NTd/HGi+1vbiPN6JTeSfP5k0ihAhRQwgad9wQ1dhoKAntU87DfZy/K8SuEsPg82VQRU5xUGU+ZVrp8SMYtOHiwFC+Z1jLG2dqRuhAw01cZ2qeXBk/ROjaAS1TIuKHVp+Fi5YMrHqqahlY3YbJ0E/N2uUTq/0Cvt717Vfwa/gNfAO/hd/B7+EP8Ef4E/wZ/gJ/hb/B3+Ef8E/4F/z7nla+5T+Afp1wHdQRH/F/+/lF6VrSbuP4v/18VHMVmm7q6TX/Czha0mxJrf+YyNyOfRcYeKSap3+b8UufB8GnJSdec6Iu+toF6nHkaeZxvJ5h4PVgj3ILMz5teArdxnr8/PPoCXqiuvR91zoh2pvS8b0SqUD1FLPubHPaK9Q5lU+GzwI3PgfCOsB9NORgqm5OqfVxLMd1L9+A/s2s+0/0a93MTd3NNRHapruGQLnhZTSzpBMuYFNaz7N5RffPo/MnV2zac3wfRX6Vng0As1cTmE5M38U0eS+H0rvZxXtg6460jlQTZ3Snxw+pO9TKz+mOB5vffTs6umGj+UjMb3/QKfndvlP47UsVAO9Drzo11h+T/rF09Po0st98jHsKh31Ruj2UnbYWLuEd/pM9wOwpZ+KqccfWNZsc4F6c3jtf2ou7Ca6akqXRPThzsadua+/4hq7vgmn6uqux6bXw6AjnLMJbXMM5Ixwi8mR2rc3AOfg2nrs4zZlnDFaChbCtk/bwilwMfBxc0iMYy0MX40x2o/ft9D2Znn9Kl+3MO90HUb747jnzjpyCKVeTuij6DllsctyiUzXN0dgE9We1yK54WBffFqtew9TXpbYfy7dILWH/SXxmqeg4zlvRsZfIbuFnic0SHfRtfj4vsaVq532jl/QpYBykzpe/jec7n1uOmhuETi2xzM5vfy01xQC0vkp6PiKpDd07x6qcUc719K0A1YZjpvLivftqNpzxV/tDtXPTWFrbaowzXj+czsG+nmMt/bQspzj7fnvxeeuG4O/s/Xe412VW3+5VuPT+EV97/r++14Gc3ZvQRHrXMz91IrWHZ4FnK7WOVGjJPfAO3R0BczdLKuevQd5LPVsXd/X8PK6Ll2jK0/NM7P4V1PuI51FvsEMV+KhV4T2+22IQF85a0FlLWXs/IHTOX1B5CGCeEDh6V2ZiTK+eee/dnNjOa2xXz2zndd7sq+XYEZ/Gx/exoK5PoOceWNdnef9W9KCT9EYXqkrPxuhC9GA7faMXpHef1smLTDe1qaDY1N4ozLI4fqsHlwpf+3Cu9F1E/Z4AajG3V8430/6bCdq8QQs9b4OqJyQa1+6BACWaTPI8zrROa//7QGJ19U4tHeTTtePNqu3PnVhXJFSjzZFz4eo3Ndqidi/O6J5Z7X+VsS3cYki51T35Iv+merFeuGe69cbJM3Jq1Fn4kUA5rze4o9CRs22iy5jMsYLMS8g5/wOjbDW/AAB42mNgZGBgAOIzT9tXxvPbfGVgYGEAgZokCXVkmgUizsHABFLNwAAACJYG1HjaY2BkYGBhAAEIyc7AwMiAAhgZAQHPABQAAAB42r1TwRaAIAgD88P59PRA0hxUlw578mBDQOwi0i+oDUzb7nC/xyKH8SuwHH/jSx83jnE745c1RO44G9E1WTE14AQtYvKO6PN6BXRW5EONgCazSS4VXiere+sp7F7cQeSp7Pe2YkaxN7fVFhg/8z/1hfnfaBXnZ8k7wNzp/y13+wRWwErCAAAAeNpl0ylUVVEUBuCtoiKgoiIzAjIIMj9mZBZYMsmMjwcuBhEIBoPBYDAYDAaDwWA0GAwGgsFgMBgMBoPBYDAYDAaDweBnlrX+9e6955x/2oeI//664HbEgTL4HnHwZ8Sh1/AlIm0W3kUc3oN9+BFxJBva4E3E0SvwLCIdR/qniGO98Coiw3vG04hMv5n/fj9GZBUD3iz8xx9FnMiBJxEn0+E+/IrIppNt/VQzvITfEadH4HnEmUG4BV8jchaBn7NZgCMXdy7uXGfzeMjjKZ/PfBwF9hTYU/AhotC5QtpFtIt4K7oLnyOK6RXTKP4TUcJDCe5zNXAHcJTiKOWxlEZZPeAo00U5b+XyltM9vw24KvBWyFzpTOWLiCr5qu6BPdV0qx+Cni+sAc4a3mvw1nqu/RZxsRJkrEsDWeo2wAzq8dY/iGgwpwbfGvTdaA6NOmnUb5PnpiTY00S3SXfN/DU/BustdFrMq8VagqcE/YReEjK3+t4qayuPbTTbdNH2PqJdL+06a5e33VoHjg7vHdY7cXTK2ekedPHWha+b5279ddPo1ndPPuDrkbkH3yX5e/XXy3OvzH34+sy132+//P14B/AO6GuA3qBOB3U6hH/It2Haw2Y2rI9hHV6WdcSsR6eAl1GZx3Qwpr9xcxv3PqGDCbyTvE3KM+muT+lwypkpe6bNaZqfaX6v8j7D8wyNGbwzbyNmdTMrzxxfc9bndDFn5vM8zds37x4smMeCHhf5WTKHJb0uuc/L/C7bs4zrGr2kO5m0ntRZkv8VfazIkvI9RSelg5ReUrKvOrvqHq7p4Lr5retx3fcN/5Mb+Dfs25RpE/8mji0etqzfwLHteZufmzrZobfj/K5ednna0/fe/l+Pca7seNpjYGRgYGRkaGBQYAABJgY0AAAP+ACmeNp1ksFO20AQhv8NgRJaUApSy61LDxVc4uAjNxoJReoNKdCrYy8hZb1rrTcIuPMKfaY+QM899RH6AP3tDJEKqlcefzvzz/xrywD21ScoLK9N3ktW5E3hDl6hL7zG7HvhLrMfhNfxGonwBjUnwj2uz8JbzH4R3sZbPArvIMV34T28wQ+6qG6Puz5+Civyb+EOO/4Ir6GvOsJdaLUrvI53KhXeoGYs3MOu+iq8hai+CW/jo/olvIOiA+E97HeKw/xIp8M0nYQ6O/MunpvZwmbhafv01JK/MKGee6ePB8N/JCFzN6dO+8o4bee5cbnRM+NMyKyuFqHytdHR3MXSF0ZfNQOn93rVORoNm4l64ua3NMjsdYxVfZIkeTBZZC73ZeldPfBhllSLKR0KX2ZzlzyY4BO2JmNjrdeXPtjiAIfIcQTNbz/knWKCgBoZzuDhEHEOgxkWsMyFF9Xne/1Mf8Fdo5i3dY1jDOjz/ymB0eEGp63ao2J/Q5YT8pabqOnQsGn1lvuKjoHRc05Tj4x3jCUzRZu5Wp1winvGl54jruHqjI3C0fVW3qDxuWZ/pEvNPzjhylkxrETR5fQoW09HzYDPwJMm7emm8g5Fq8nIjpWHdronLV0TjJmxXJ4nuGwnWPYcAH8BoeumrAB42mNgYmFgnMDAysDCxMDEAAIQGoiNGc6A+CwMENDAwNDNwFDwGMpliHT00WNwYFBQy4aogJCMgSCSGcJTYGAAAEBYBpIAAAB42mNgZoCANAZjIMnIgAYADecAng==")).arrayBuffer();
|
|
1548
|
-
await this.ji(e), this
|
|
1548
|
+
await this.ji(e), this.$i = O.parse(e)[0], await this.Yi();
|
|
1549
1549
|
}
|
|
1550
1550
|
Vi(t) {
|
|
1551
1551
|
if (t === void 0) return this.ki;
|
|
1552
|
-
this.ki = t, this.
|
|
1553
|
-
const e = this.Ni.createTextureAtlas(this
|
|
1554
|
-
this.Di = e.framebuffer, this.Bi = e.columns, this.
|
|
1552
|
+
this.ki = t, this.Oi = this.Xi.Ri(this.Ei.map((i) => i.character), this.ki, this.$i);
|
|
1553
|
+
const e = this.Ni.createTextureAtlas(this.Ei, this.Oi, this.ki, this.$i);
|
|
1554
|
+
this.Di = e.framebuffer, this.Bi = e.columns, this.Li = e.rows;
|
|
1555
1555
|
}
|
|
1556
1556
|
async qi(t) {
|
|
1557
1557
|
try {
|
|
@@ -1559,9 +1559,9 @@ class Gt {
|
|
|
1559
1559
|
if (!e.ok) throw new C(`Failed to load font file: ${e.status} ${e.statusText}`);
|
|
1560
1560
|
const i = await e.arrayBuffer();
|
|
1561
1561
|
await this.ji(i);
|
|
1562
|
-
const s =
|
|
1562
|
+
const s = O.parse(i);
|
|
1563
1563
|
if (!s || s.length === 0) throw Error("Failed to parse font file");
|
|
1564
|
-
this
|
|
1564
|
+
this.$i = s[0], await this.Yi();
|
|
1565
1565
|
} catch (e) {
|
|
1566
1566
|
throw new C("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
|
|
1567
1567
|
}
|
|
@@ -1571,16 +1571,16 @@ class Gt {
|
|
|
1571
1571
|
this.Hi = new FontFace("CustomFont_" + e, t), await this.Hi.load(), document.fonts.add(this.Hi);
|
|
1572
1572
|
}
|
|
1573
1573
|
async Yi() {
|
|
1574
|
-
const t = this.Ii.ei(this
|
|
1575
|
-
this.Gi.clear(), this
|
|
1576
|
-
const i = this.Ni.createTextureAtlas(this
|
|
1577
|
-
this.Di = i.framebuffer, this.Bi = i.columns, this.
|
|
1574
|
+
const t = this.Ii.ei(this.$i), e = this.Ii.ni(t);
|
|
1575
|
+
this.Gi.clear(), this.Ei = this.Wi.createCharacterObjects(e, this.$i), this.Oi = this.Xi.Ri(e, this.ki, this.$i);
|
|
1576
|
+
const i = this.Ni.createTextureAtlas(this.Ei, this.Oi, this.ki, this.$i);
|
|
1577
|
+
this.Di = i.framebuffer, this.Bi = i.columns, this.Li = i.rows;
|
|
1578
1578
|
}
|
|
1579
1579
|
Pi(t) {
|
|
1580
|
-
return this.Wi.Pi(t, this
|
|
1580
|
+
return this.Wi.Pi(t, this.Ei);
|
|
1581
1581
|
}
|
|
1582
1582
|
Si(t) {
|
|
1583
|
-
return this.Wi.Si(t, this
|
|
1583
|
+
return this.Wi.Si(t, this.Ei);
|
|
1584
1584
|
}
|
|
1585
1585
|
getGlyphData(t) {
|
|
1586
1586
|
if (!Number.isFinite(t)) return null;
|
|
@@ -1588,13 +1588,13 @@ class Gt {
|
|
|
1588
1588
|
if (e !== void 0) return e;
|
|
1589
1589
|
const i = this.Zi(t);
|
|
1590
1590
|
if (i < 0) return this.Gi.set(t, null), null;
|
|
1591
|
-
const s = this.
|
|
1591
|
+
const s = this.$i.glyf;
|
|
1592
1592
|
if (!s) return this.Gi.set(t, null), null;
|
|
1593
1593
|
let r = s[i] ?? null;
|
|
1594
|
-
return r == null && (r =
|
|
1594
|
+
return r == null && (r = O.T.glyf.Qe(this.$i, i) ?? null, s[i] = r), this.Gi.set(t, r), r;
|
|
1595
1595
|
}
|
|
1596
1596
|
Zi(t) {
|
|
1597
|
-
const e = this.
|
|
1597
|
+
const e = this.$i.cmap;
|
|
1598
1598
|
for (const i of e.tables) if (i.format === 4) {
|
|
1599
1599
|
const s = i;
|
|
1600
1600
|
for (let r = 0; r < s.startCount.length; r++) if (t >= s.startCount[r] && t <= s.endCount[r]) {
|
|
@@ -1623,22 +1623,22 @@ class Gt {
|
|
|
1623
1623
|
return this.Di;
|
|
1624
1624
|
}
|
|
1625
1625
|
get characters() {
|
|
1626
|
-
return this
|
|
1626
|
+
return this.Ei;
|
|
1627
1627
|
}
|
|
1628
1628
|
get textureColumns() {
|
|
1629
1629
|
return this.Bi;
|
|
1630
1630
|
}
|
|
1631
1631
|
get textureRows() {
|
|
1632
|
-
return this.
|
|
1632
|
+
return this.Li;
|
|
1633
1633
|
}
|
|
1634
1634
|
get maxGlyphDimensions() {
|
|
1635
|
-
return this.
|
|
1635
|
+
return this.Oi;
|
|
1636
1636
|
}
|
|
1637
1637
|
get fontSize() {
|
|
1638
1638
|
return this.ki;
|
|
1639
1639
|
}
|
|
1640
1640
|
get font() {
|
|
1641
|
-
return this
|
|
1641
|
+
return this.$i;
|
|
1642
1642
|
}
|
|
1643
1643
|
}
|
|
1644
1644
|
class Ht {
|
|
@@ -1769,25 +1769,25 @@ class Xt {
|
|
|
1769
1769
|
}
|
|
1770
1770
|
class G {
|
|
1771
1771
|
constructor(t, e, i, s) {
|
|
1772
|
-
h(this, "
|
|
1772
|
+
h(this, "Ar");
|
|
1773
1773
|
h(this, "dt");
|
|
1774
1774
|
h(this, "_t");
|
|
1775
1775
|
h(this, "gt");
|
|
1776
1776
|
h(this, "k", 0);
|
|
1777
1777
|
h(this, "K", 0);
|
|
1778
1778
|
h(this, "j", 0);
|
|
1779
|
-
h(this, "
|
|
1780
|
-
h(this, "
|
|
1779
|
+
h(this, "L", [0, 0]);
|
|
1780
|
+
h(this, "yr", "sampled");
|
|
1781
1781
|
h(this, "Cr", "fixed");
|
|
1782
1782
|
h(this, "V", [1, 1, 1, 1]);
|
|
1783
1783
|
h(this, "q", [0, 0, 0, 1]);
|
|
1784
1784
|
h(this, "wr", [0, 0, 0, 1]);
|
|
1785
1785
|
h(this, "br", [[0.1, 0, 0]]);
|
|
1786
1786
|
h(this, "Mr");
|
|
1787
|
-
this.gt = t, this.
|
|
1787
|
+
this.gt = t, this.Ar = e, this.dt = i, this._t = s;
|
|
1788
1788
|
}
|
|
1789
1789
|
Dt() {
|
|
1790
|
-
this.gt.deleteTexture(this.
|
|
1790
|
+
this.gt.deleteTexture(this.Ar);
|
|
1791
1791
|
}
|
|
1792
1792
|
Fr(t) {
|
|
1793
1793
|
return typeof t == "boolean" ? t ? 1 : 0 : (t == null ? 0 : Number(t)) > 0 ? 1 : 0;
|
|
@@ -1803,13 +1803,13 @@ class G {
|
|
|
1803
1803
|
}
|
|
1804
1804
|
charRotation(t) {
|
|
1805
1805
|
const e = 255 * t / 360, i = Math.floor(e) / 255, s = Math.round(e - Math.floor(e));
|
|
1806
|
-
return this.
|
|
1806
|
+
return this.L = [i, s], this;
|
|
1807
1807
|
}
|
|
1808
1808
|
Ge() {
|
|
1809
|
-
return { texture: this.
|
|
1809
|
+
return { texture: this.Ar, invert: this.k, flipX: this.K, flipY: this.j, charRotation: this.L, charColorFixed: this.yr === "fixed", charColor: this.V, cellColorFixed: this.Cr === "fixed", cellColor: this.q, backgroundColor: this.wr, charCount: this.br.length, charList: this.br };
|
|
1810
1810
|
}
|
|
1811
1811
|
charColorMode(t) {
|
|
1812
|
-
return this.
|
|
1812
|
+
return this.yr = t, this;
|
|
1813
1813
|
}
|
|
1814
1814
|
cellColorMode(t) {
|
|
1815
1815
|
return this.Cr = t, this;
|
|
@@ -1834,7 +1834,7 @@ class G {
|
|
|
1834
1834
|
return c.Mr = i, c;
|
|
1835
1835
|
}
|
|
1836
1836
|
get texture() {
|
|
1837
|
-
return this.
|
|
1837
|
+
return this.Ar;
|
|
1838
1838
|
}
|
|
1839
1839
|
get width() {
|
|
1840
1840
|
return this.dt;
|
|
@@ -1849,21 +1849,21 @@ class Yt {
|
|
|
1849
1849
|
h(this, "Tr");
|
|
1850
1850
|
h(this, "Pr", null);
|
|
1851
1851
|
h(this, "Sr", 0);
|
|
1852
|
-
h(this, "
|
|
1853
|
-
h(this, "
|
|
1852
|
+
h(this, "$r", !0);
|
|
1853
|
+
h(this, "Er", 0);
|
|
1854
1854
|
h(this, "Dr", 0);
|
|
1855
1855
|
h(this, "kr", []);
|
|
1856
1856
|
h(this, "Br", 10);
|
|
1857
|
-
h(this, "
|
|
1857
|
+
h(this, "Lr", 0);
|
|
1858
1858
|
this.Rr = t, this.Tr = 1e3 / t;
|
|
1859
1859
|
}
|
|
1860
1860
|
start(t) {
|
|
1861
|
-
if (!this
|
|
1861
|
+
if (!this.$r) return;
|
|
1862
1862
|
this.Sr = performance.now();
|
|
1863
1863
|
const e = (i) => {
|
|
1864
|
-
if (!this
|
|
1864
|
+
if (!this.$r) return void (this.Pr = null);
|
|
1865
1865
|
const s = i - this.Sr;
|
|
1866
|
-
s >= this.Tr && (t(), this.Sr = i - s % this.Tr), this
|
|
1866
|
+
s >= this.Tr && (t(), this.Sr = i - s % this.Tr), this.$r && (this.Pr = requestAnimationFrame(e));
|
|
1867
1867
|
};
|
|
1868
1868
|
this.Pr = requestAnimationFrame(e);
|
|
1869
1869
|
}
|
|
@@ -1871,14 +1871,14 @@ class Yt {
|
|
|
1871
1871
|
this.Pr && (cancelAnimationFrame(this.Pr), this.Pr = null);
|
|
1872
1872
|
}
|
|
1873
1873
|
pause() {
|
|
1874
|
-
this
|
|
1874
|
+
this.$r && (this.$r = !1, this.stop());
|
|
1875
1875
|
}
|
|
1876
1876
|
resume(t) {
|
|
1877
|
-
this
|
|
1877
|
+
this.$r || (this.$r = !0, this.start(t));
|
|
1878
1878
|
}
|
|
1879
1879
|
frameRate(t, e) {
|
|
1880
|
-
if (t === void 0) return this
|
|
1881
|
-
this.Rr = t, this.Tr = 1e3 / t, this
|
|
1880
|
+
if (t === void 0) return this.Er;
|
|
1881
|
+
this.Rr = t, this.Tr = 1e3 / t, this.$r && e && (this.stop(), this.start(e));
|
|
1882
1882
|
}
|
|
1883
1883
|
measureFrameRate() {
|
|
1884
1884
|
const t = performance.now();
|
|
@@ -1886,36 +1886,36 @@ class Yt {
|
|
|
1886
1886
|
const e = t - this.Dr;
|
|
1887
1887
|
this.kr.push(e), this.kr.length > this.Br && this.kr.shift();
|
|
1888
1888
|
const i = this.kr.reduce((s, r) => s + r, 0) / this.kr.length;
|
|
1889
|
-
this
|
|
1889
|
+
this.Er = 1e3 / i;
|
|
1890
1890
|
}
|
|
1891
1891
|
this.Dr = t;
|
|
1892
1892
|
}
|
|
1893
1893
|
get isLooping() {
|
|
1894
|
-
return this
|
|
1894
|
+
return this.$r;
|
|
1895
1895
|
}
|
|
1896
1896
|
get frameRateLimit() {
|
|
1897
1897
|
return this.Rr;
|
|
1898
1898
|
}
|
|
1899
1899
|
get currentFrameRate() {
|
|
1900
|
-
return this
|
|
1900
|
+
return this.Er;
|
|
1901
1901
|
}
|
|
1902
1902
|
get frameCount() {
|
|
1903
|
-
return this.
|
|
1903
|
+
return this.Lr;
|
|
1904
1904
|
}
|
|
1905
1905
|
set frameCount(t) {
|
|
1906
|
-
this.
|
|
1906
|
+
this.Lr = t;
|
|
1907
1907
|
}
|
|
1908
1908
|
incrementFrame() {
|
|
1909
|
-
this.
|
|
1909
|
+
this.Lr++;
|
|
1910
1910
|
}
|
|
1911
1911
|
resetFrameCount() {
|
|
1912
|
-
this.
|
|
1912
|
+
this.Lr = 0;
|
|
1913
1913
|
}
|
|
1914
1914
|
}
|
|
1915
1915
|
class rt {
|
|
1916
1916
|
constructor(t) {
|
|
1917
1917
|
h(this, "er");
|
|
1918
|
-
h(this, "
|
|
1918
|
+
h(this, "Or");
|
|
1919
1919
|
h(this, "Hr", { x: -1, y: -1 });
|
|
1920
1920
|
h(this, "Gr", { x: -1, y: -1 });
|
|
1921
1921
|
h(this, "Ir", null);
|
|
@@ -1946,7 +1946,7 @@ class rt {
|
|
|
1946
1946
|
e.style.cursor = t == null || t === "" ? "" : t;
|
|
1947
1947
|
}
|
|
1948
1948
|
Ki(t) {
|
|
1949
|
-
this.
|
|
1949
|
+
this.Or = t, this.hn();
|
|
1950
1950
|
}
|
|
1951
1951
|
an() {
|
|
1952
1952
|
if (this.qr) return;
|
|
@@ -1975,7 +1975,7 @@ class rt {
|
|
|
1975
1975
|
if (this.Ir) {
|
|
1976
1976
|
const t = new MouseEvent("mousemove", { clientX: this.Ir.x, clientY: this.Ir.y, bubbles: !1, cancelable: !1 });
|
|
1977
1977
|
this.cn(t);
|
|
1978
|
-
} else this.Hr.x !== -1 && this.Hr.y !== -1 && (this.Hr.x >= this.
|
|
1978
|
+
} else this.Hr.x !== -1 && this.Hr.y !== -1 && (this.Hr.x >= this.Or.cols || this.Hr.y >= this.Or.rows) && (this.Hr.x = -1, this.Hr.y = -1);
|
|
1979
1979
|
} catch {
|
|
1980
1980
|
this.Hr.x = -1, this.Hr.y = -1;
|
|
1981
1981
|
}
|
|
@@ -1989,10 +1989,10 @@ class rt {
|
|
|
1989
1989
|
gn(t) {
|
|
1990
1990
|
this.Jr = t;
|
|
1991
1991
|
}
|
|
1992
|
-
|
|
1992
|
+
An(t) {
|
|
1993
1993
|
this.tn = t;
|
|
1994
1994
|
}
|
|
1995
|
-
|
|
1995
|
+
yn(t) {
|
|
1996
1996
|
this.sn = t;
|
|
1997
1997
|
}
|
|
1998
1998
|
Cn() {
|
|
@@ -2031,8 +2031,8 @@ class rt {
|
|
|
2031
2031
|
cn(t) {
|
|
2032
2032
|
const e = this.er.canvas;
|
|
2033
2033
|
this.Gr = { ...this.Hr }, this.Ir = { x: t.clientX, y: t.clientY };
|
|
2034
|
-
const i = e.getBoundingClientRect(), s = t.clientX - i.left, r = t.clientY - i.top, n = e.width / i.width, o = r * (e.height / i.height), c = s * n - this.
|
|
2035
|
-
f >= 0 && f < this.
|
|
2034
|
+
const i = e.getBoundingClientRect(), s = t.clientX - i.left, r = t.clientY - i.top, n = e.width / i.width, o = r * (e.height / i.height), c = s * n - this.Or.offsetX, l = o - this.Or.offsetY, f = Math.floor(c / this.Or.cellWidth), u = Math.floor(l / this.Or.cellHeight);
|
|
2035
|
+
f >= 0 && f < this.Or.cols && u >= 0 && u < this.Or.rows ? (this.Hr.x = f, this.Hr.y = u) : (this.Hr.x = -1, this.Hr.y = -1);
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
2038
|
const Wt = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: rt }, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -2064,8 +2064,8 @@ class nt {
|
|
|
2064
2064
|
gn(t) {
|
|
2065
2065
|
this.Rn = t;
|
|
2066
2066
|
}
|
|
2067
|
-
|
|
2068
|
-
const e = this
|
|
2067
|
+
$n(t) {
|
|
2068
|
+
const e = this.En(t), i = this.wn.get(t) || this.wn.get(e);
|
|
2069
2069
|
return (i == null ? void 0 : i.isPressed) || !1;
|
|
2070
2070
|
}
|
|
2071
2071
|
Dn() {
|
|
@@ -2079,10 +2079,10 @@ class nt {
|
|
|
2079
2079
|
for (const [e, i] of this.wn) i.isPressed && t.push(e);
|
|
2080
2080
|
return t;
|
|
2081
2081
|
}
|
|
2082
|
-
On() {
|
|
2083
|
-
return { ctrl: this.En("Control"), shift: this.En("Shift"), alt: this.En("Alt"), meta: this.En("Meta") };
|
|
2084
|
-
}
|
|
2085
2082
|
Ln() {
|
|
2083
|
+
return { ctrl: this.$n("Control"), shift: this.$n("Shift"), alt: this.$n("Alt"), meta: this.$n("Meta") };
|
|
2084
|
+
}
|
|
2085
|
+
On() {
|
|
2086
2086
|
this.wn.clear(), this.bn = null, this.xn = null;
|
|
2087
2087
|
}
|
|
2088
2088
|
Pn(t) {
|
|
@@ -2103,7 +2103,7 @@ class nt {
|
|
|
2103
2103
|
this.Rn(r);
|
|
2104
2104
|
}
|
|
2105
2105
|
}
|
|
2106
|
-
|
|
2106
|
+
En(t) {
|
|
2107
2107
|
return this.Tn[t] || t.toLowerCase();
|
|
2108
2108
|
}
|
|
2109
2109
|
}
|
|
@@ -2112,7 +2112,7 @@ class ot {
|
|
|
2112
2112
|
constructor(t, e) {
|
|
2113
2113
|
h(this, "er");
|
|
2114
2114
|
h(this, "Hn");
|
|
2115
|
-
h(this, "
|
|
2115
|
+
h(this, "Or");
|
|
2116
2116
|
h(this, "Gn", /* @__PURE__ */ new Map());
|
|
2117
2117
|
h(this, "In", /* @__PURE__ */ new Map());
|
|
2118
2118
|
h(this, "Nn", /* @__PURE__ */ new Map());
|
|
@@ -2144,14 +2144,14 @@ class ot {
|
|
|
2144
2144
|
h(this, "_o", 0.02);
|
|
2145
2145
|
h(this, "mo", 2);
|
|
2146
2146
|
h(this, "vo", 600);
|
|
2147
|
-
h(this, "
|
|
2148
|
-
h(this, "
|
|
2147
|
+
h(this, "Ao", 0);
|
|
2148
|
+
h(this, "yo", null);
|
|
2149
2149
|
this.er = t, this.Hn = e;
|
|
2150
2150
|
const i = this.er.canvas;
|
|
2151
2151
|
this.Wn = i.style.touchAction, this.Kn = i.style.userSelect, i.style.touchAction || (i.style.touchAction = "none"), i.style.userSelect || (i.style.userSelect = "none");
|
|
2152
2152
|
}
|
|
2153
2153
|
Ki(t) {
|
|
2154
|
-
this.
|
|
2154
|
+
this.Or = t, this.Co();
|
|
2155
2155
|
}
|
|
2156
2156
|
an() {
|
|
2157
2157
|
if (this.qr) return;
|
|
@@ -2171,10 +2171,10 @@ class ot {
|
|
|
2171
2171
|
const t = this.er.canvas;
|
|
2172
2172
|
t.removeEventListener("touchstart", this.jn), t.removeEventListener("touchmove", this.Yn), t.removeEventListener("touchend", this.Vn), t.removeEventListener("touchcancel", this.qn), this.qr = !1, this.Xn = null, this.Gn.clear(), this.In.clear(), this.Nn.forEach((e) => {
|
|
2173
2173
|
e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
|
|
2174
|
-
}), this.Nn.clear(), this.
|
|
2174
|
+
}), this.Nn.clear(), this.yo = null, this.Ao = 0, t.style.touchAction = this.Wn, t.style.userSelect = this.Kn;
|
|
2175
2175
|
}
|
|
2176
2176
|
Co() {
|
|
2177
|
-
if (!this.
|
|
2177
|
+
if (!this.Or || this.Gn.size === 0) return;
|
|
2178
2178
|
const t = /* @__PURE__ */ new Map();
|
|
2179
2179
|
for (const e of this.Gn.values()) {
|
|
2180
2180
|
const i = this.Fo(e.clientX, e.clientY, e.id, e);
|
|
@@ -2188,7 +2188,7 @@ class ot {
|
|
|
2188
2188
|
Ro(t) {
|
|
2189
2189
|
this.Zn = t;
|
|
2190
2190
|
}
|
|
2191
|
-
|
|
2191
|
+
An(t) {
|
|
2192
2192
|
this.Qn = t;
|
|
2193
2193
|
}
|
|
2194
2194
|
To(t) {
|
|
@@ -2200,10 +2200,10 @@ class ot {
|
|
|
2200
2200
|
So(t) {
|
|
2201
2201
|
this.eo = t;
|
|
2202
2202
|
}
|
|
2203
|
-
|
|
2203
|
+
$o(t) {
|
|
2204
2204
|
this.io = t;
|
|
2205
2205
|
}
|
|
2206
|
-
|
|
2206
|
+
Eo(t) {
|
|
2207
2207
|
this.ro = t;
|
|
2208
2208
|
}
|
|
2209
2209
|
Do(t) {
|
|
@@ -2217,27 +2217,27 @@ class ot {
|
|
|
2217
2217
|
}
|
|
2218
2218
|
wo(t) {
|
|
2219
2219
|
var s;
|
|
2220
|
-
if (!this.
|
|
2220
|
+
if (!this.Or) return;
|
|
2221
2221
|
t.preventDefault(), (s = this.Hn) == null || s.en(this.vo);
|
|
2222
|
-
const e = performance.now(), i = this.
|
|
2222
|
+
const e = performance.now(), i = this.Lo(t.changedTouches);
|
|
2223
2223
|
for (const r of i) {
|
|
2224
2224
|
const n = this.Gn.get(r.id);
|
|
2225
|
-
n && this.In.set(r.id, this.
|
|
2225
|
+
n && this.In.set(r.id, this.Oo(n)), this.Gn.set(r.id, r);
|
|
2226
2226
|
const o = { id: r.id, startPosition: r, lastPosition: r, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
|
|
2227
2227
|
this.ro && (o.longPressTimer = window.setTimeout(() => {
|
|
2228
2228
|
const c = this.Gn.get(r.id);
|
|
2229
|
-
c && (o.longPressFired = !0, this.ro({ touch: this.
|
|
2229
|
+
c && (o.longPressFired = !0, this.ro({ touch: this.Oo(c), duration: performance.now() - o.startTime, originalEvent: t }));
|
|
2230
2230
|
}, this.uo)), this.Nn.set(r.id, o), this.Zn && this.Zn(this.Ho(r, t, void 0, e));
|
|
2231
2231
|
}
|
|
2232
2232
|
this.Gn.size === 2 && this.Go();
|
|
2233
2233
|
}
|
|
2234
2234
|
bo(t) {
|
|
2235
2235
|
var s;
|
|
2236
|
-
if (!this.
|
|
2236
|
+
if (!this.Or) return;
|
|
2237
2237
|
t.preventDefault(), (s = this.Hn) == null || s.en(this.vo);
|
|
2238
|
-
const e = performance.now(), i = this.
|
|
2238
|
+
const e = performance.now(), i = this.Lo(t.changedTouches);
|
|
2239
2239
|
for (const r of i) {
|
|
2240
|
-
const n = this.Gn.get(r.id), o = n ? this.
|
|
2240
|
+
const n = this.Gn.get(r.id), o = n ? this.Oo(n) : void 0;
|
|
2241
2241
|
o && this.In.set(r.id, o), this.Gn.set(r.id, r);
|
|
2242
2242
|
const c = this.Nn.get(r.id);
|
|
2243
2243
|
c && (c.lastPosition = r, c.lastTime = e, o) && this.Io(o, r, !0) > this.fo && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.Qn && this.Qn(this.Ho(r, t, o, e));
|
|
@@ -2245,26 +2245,26 @@ class ot {
|
|
|
2245
2245
|
this.Gn.size === 2 ? this.No(t) : this.Xn = null;
|
|
2246
2246
|
}
|
|
2247
2247
|
xo(t) {
|
|
2248
|
-
if (!this.
|
|
2248
|
+
if (!this.Or) return;
|
|
2249
2249
|
t.preventDefault();
|
|
2250
|
-
const e = performance.now(), i = this.
|
|
2250
|
+
const e = performance.now(), i = this.Lo(t.changedTouches);
|
|
2251
2251
|
for (const s of i) {
|
|
2252
|
-
const r = this.Gn.get(s.id), n = r ? this.
|
|
2252
|
+
const r = this.Gn.get(s.id), n = r ? this.Oo(r) : void 0, o = this.Nn.get(s.id);
|
|
2253
2253
|
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.Jn && this.Jn(this.Ho(s, t, n, e)), o && this.Xo(o, t), this.Nn.delete(s.id), this.In.delete(s.id), this.Gn.delete(s.id);
|
|
2254
2254
|
}
|
|
2255
2255
|
this.Gn.size < 2 && (this.Xn = null);
|
|
2256
2256
|
}
|
|
2257
2257
|
Mo(t) {
|
|
2258
|
-
if (!this.
|
|
2258
|
+
if (!this.Or) return;
|
|
2259
2259
|
t.preventDefault();
|
|
2260
|
-
const e = performance.now(), i = this.
|
|
2260
|
+
const e = performance.now(), i = this.Lo(t.changedTouches);
|
|
2261
2261
|
for (const s of i) {
|
|
2262
|
-
const r = this.Gn.get(s.id), n = r ? this.
|
|
2262
|
+
const r = this.Gn.get(s.id), n = r ? this.Oo(r) : void 0, o = this.Nn.get(s.id);
|
|
2263
2263
|
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.so && this.so(this.Ho(s, t, n, e)), this.Nn.delete(s.id), this.In.delete(s.id), this.Gn.delete(s.id);
|
|
2264
2264
|
}
|
|
2265
2265
|
this.Gn.size < 2 && (this.Xn = null);
|
|
2266
2266
|
}
|
|
2267
|
-
|
|
2267
|
+
Lo(t) {
|
|
2268
2268
|
const e = [];
|
|
2269
2269
|
for (let i = 0; i < t.length; i += 1) {
|
|
2270
2270
|
const s = t.item(i);
|
|
@@ -2276,12 +2276,12 @@ class ot {
|
|
|
2276
2276
|
return this.Fo(t.clientX, t.clientY, t.identifier, { id: t.identifier, x: -1, y: -1, clientX: t.clientX, clientY: t.clientY, pressure: t.force, radiusX: t.radiusX, radiusY: t.radiusY, rotationAngle: t.rotationAngle });
|
|
2277
2277
|
}
|
|
2278
2278
|
Fo(t, e, i, s) {
|
|
2279
|
-
const r = this.er.canvas, n = r.getBoundingClientRect(), o = t - n.left, c = e - n.top, l = r.width / n.width, f = c * (r.height / n.height), u = o * l - this.
|
|
2279
|
+
const r = this.er.canvas, n = r.getBoundingClientRect(), o = t - n.left, c = e - n.top, l = r.width / n.width, f = c * (r.height / n.height), u = o * l - this.Or.offsetX, m = f - this.Or.offsetY, p = Math.floor(u / this.Or.cellWidth), g = Math.floor(m / this.Or.cellHeight), d = p >= 0 && p < this.Or.cols && g >= 0 && g < this.Or.rows;
|
|
2280
2280
|
return { id: i, x: d ? p : -1, y: d ? g : -1, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
|
|
2281
2281
|
}
|
|
2282
2282
|
Ho(t, e, i, s) {
|
|
2283
|
-
const r = this.Nn.get(t.id), n = Array.from(this.In.values()).map((l) => this.
|
|
2284
|
-
return { touch: this.
|
|
2283
|
+
const r = this.Nn.get(t.id), n = Array.from(this.In.values()).map((l) => this.Oo(l)), o = Array.from(this.Gn.values()).map((l) => this.Oo(l)), c = this.Lo(e.changedTouches);
|
|
2284
|
+
return { touch: this.Oo(t), previousTouch: i ? this.Oo(i) : void 0, touches: o, previousTouches: n, changedTouches: c, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
|
|
2285
2285
|
}
|
|
2286
2286
|
Go() {
|
|
2287
2287
|
if (this.Gn.size !== 2) return void (this.Xn = null);
|
|
@@ -2293,11 +2293,11 @@ class ot {
|
|
|
2293
2293
|
const [e, i] = this.Xn.ids, s = this.Gn.get(e), r = this.Gn.get(i);
|
|
2294
2294
|
if (!s || !r) return;
|
|
2295
2295
|
const n = this.Io(s, r, !1) / this.Xn.initialDistance, o = n - this.Xn.lastScale;
|
|
2296
|
-
this.oo && Math.abs(o) > this._o && (this.oo({ touches: [this.
|
|
2296
|
+
this.oo && Math.abs(o) > this._o && (this.oo({ touches: [this.Oo(s), this.Oo(r)], scale: n, deltaScale: o, center: this.jo(s, r), originalEvent: t }), this.Xn.lastScale = n);
|
|
2297
2297
|
let c = this.Ko(s, r) - this.Xn.initialAngle;
|
|
2298
2298
|
c = (c + 180) % 360 - 180;
|
|
2299
2299
|
const l = c - this.Xn.lastRotation;
|
|
2300
|
-
this.ho && Math.abs(l) > this.mo && (this.ho({ touches: [this.
|
|
2300
|
+
this.ho && Math.abs(l) > this.mo && (this.ho({ touches: [this.Oo(s), this.Oo(r)], rotation: c, deltaRotation: l, center: this.jo(s, r), originalEvent: t }), this.Xn.lastRotation = c);
|
|
2301
2301
|
}
|
|
2302
2302
|
jo(t, e) {
|
|
2303
2303
|
const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.Fo(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
|
|
@@ -2306,17 +2306,17 @@ class ot {
|
|
|
2306
2306
|
Xo(t, e) {
|
|
2307
2307
|
const i = performance.now(), s = i - t.startTime, r = this.Io(t.startPosition, t.lastPosition, !0);
|
|
2308
2308
|
if (!t.longPressFired && s <= this.ao && r <= this.lo)
|
|
2309
|
-
this.Yo(t.lastPosition, i) && this.io ? this.io({ touch: this.
|
|
2309
|
+
this.Yo(t.lastPosition, i) && this.io ? this.io({ touch: this.Oo(t.lastPosition), taps: 2, originalEvent: e }) : this.eo && this.eo({ touch: this.Oo(t.lastPosition), taps: 1, originalEvent: e });
|
|
2310
2310
|
else if (!t.longPressFired && s <= this.po && r >= this.do) {
|
|
2311
2311
|
const n = { x: t.lastPosition.clientX - t.startPosition.clientX, y: t.lastPosition.clientY - t.startPosition.clientY }, o = Math.max(Math.hypot(n.x, n.y), 1e-4), c = { x: n.x / o, y: n.y / o }, l = { x: n.x / s, y: n.y / s };
|
|
2312
|
-
this.no && this.no({ touch: this.
|
|
2312
|
+
this.no && this.no({ touch: this.Oo(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
|
|
2313
2313
|
}
|
|
2314
|
-
this.
|
|
2314
|
+
this.Ao = i, this.yo = this.Oo(t.lastPosition);
|
|
2315
2315
|
}
|
|
2316
2316
|
Yo(t, e) {
|
|
2317
|
-
return !this.
|
|
2317
|
+
return !this.yo || e - this.Ao > this.co ? !1 : this.Io(t, this.yo, !0) <= this.lo;
|
|
2318
2318
|
}
|
|
2319
|
-
|
|
2319
|
+
Oo(t) {
|
|
2320
2320
|
return { ...t };
|
|
2321
2321
|
}
|
|
2322
2322
|
Io(t, e, i) {
|
|
@@ -2361,7 +2361,7 @@ const Vt = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
|
|
|
2361
2361
|
this.xt.qe(t, e, i, s);
|
|
2362
2362
|
}
|
|
2363
2363
|
char(t) {
|
|
2364
|
-
this.xt.state.rt(this.
|
|
2364
|
+
this.xt.state.rt(this.$i.Pi(t));
|
|
2365
2365
|
}
|
|
2366
2366
|
charColor(t, e, i, s = 255) {
|
|
2367
2367
|
this.xt.state.nt(t, e, i, s);
|
|
@@ -2403,7 +2403,7 @@ const Vt = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
|
|
|
2403
2403
|
this.xt.Kt(t, e);
|
|
2404
2404
|
}
|
|
2405
2405
|
setUniforms(t) {
|
|
2406
|
-
this.xt.
|
|
2406
|
+
this.xt.Le(t);
|
|
2407
2407
|
}
|
|
2408
2408
|
createFilterShader(t) {
|
|
2409
2409
|
return this.xt.hs(t);
|
|
@@ -2414,38 +2414,38 @@ const Vt = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
|
|
|
2414
2414
|
image(t, e, i, s, r) {
|
|
2415
2415
|
if (t.textures) {
|
|
2416
2416
|
const n = t;
|
|
2417
|
-
this.xt.
|
|
2417
|
+
this.xt.Oe(n, e, i, s ?? n.width, r ?? n.height);
|
|
2418
2418
|
} else {
|
|
2419
2419
|
const n = t;
|
|
2420
|
-
this.xt.He(n, e, i, s ?? Math.floor(this.
|
|
2420
|
+
this.xt.He(n, e, i, s ?? Math.floor(this.Or.cols / 2), r ?? Math.floor(this.Or.rows / 2));
|
|
2421
2421
|
}
|
|
2422
2422
|
}
|
|
2423
2423
|
async loadImage(t) {
|
|
2424
|
-
if (typeof t != "string") return G.zr(this.xt, t, (s) => this.
|
|
2424
|
+
if (typeof t != "string") return G.zr(this.xt, t, (s) => this.$i.Si(s));
|
|
2425
2425
|
const e = t, i = await new Promise((s, r) => {
|
|
2426
2426
|
const n = new Image();
|
|
2427
2427
|
n.crossOrigin = "anonymous", n.onload = () => s(n), n.onerror = (o) => r(o), n.src = e;
|
|
2428
2428
|
});
|
|
2429
|
-
return G.zr(this.xt, i, (s) => this.
|
|
2429
|
+
return G.zr(this.xt, i, (s) => this.$i.Si(s));
|
|
2430
2430
|
}
|
|
2431
2431
|
}, Kt = (a) => class extends a {
|
|
2432
2432
|
async loadFont(t) {
|
|
2433
|
-
return this.
|
|
2434
|
-
const e = this.
|
|
2435
|
-
this.
|
|
2433
|
+
return this.$i.qi(t).then(() => {
|
|
2434
|
+
const e = this.$i.maxGlyphDimensions;
|
|
2435
|
+
this.Or.hr(e.width, e.height), this.Vo.resize(this.Or.cols, this.Or.rows), this.xt.Ze(), this.Hn.hn();
|
|
2436
2436
|
});
|
|
2437
2437
|
}
|
|
2438
2438
|
fontSize(t) {
|
|
2439
|
-
if (!z.v(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) || this.
|
|
2440
|
-
this.
|
|
2441
|
-
const e = this.
|
|
2442
|
-
this.
|
|
2439
|
+
if (!z.v(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) || this.$i.fontSize === t) return;
|
|
2440
|
+
this.$i.Vi(t);
|
|
2441
|
+
const e = this.$i.maxGlyphDimensions;
|
|
2442
|
+
this.Or.hr(e.width, e.height), this.Vo.resize(this.Or.cols, this.Or.rows), this.xt.Ze(), this.Hn.hn();
|
|
2443
2443
|
}
|
|
2444
2444
|
glyphColor(t) {
|
|
2445
|
-
return this.
|
|
2445
|
+
return this.$i.Pi(t);
|
|
2446
2446
|
}
|
|
2447
2447
|
glyphColors(t) {
|
|
2448
|
-
return this.
|
|
2448
|
+
return this.$i.Si(t);
|
|
2449
2449
|
}
|
|
2450
2450
|
}, jt = (a) => class extends a {
|
|
2451
2451
|
get frameCount() {
|
|
@@ -2483,10 +2483,10 @@ const Vt = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
|
|
|
2483
2483
|
this.Hn.gn(t);
|
|
2484
2484
|
}
|
|
2485
2485
|
mouseMoved(t) {
|
|
2486
|
-
this.Hn.
|
|
2486
|
+
this.Hn.An(t);
|
|
2487
2487
|
}
|
|
2488
2488
|
mouseScrolled(t) {
|
|
2489
|
-
this.Hn.
|
|
2489
|
+
this.Hn.yn(t);
|
|
2490
2490
|
}
|
|
2491
2491
|
get mouse() {
|
|
2492
2492
|
return this.Hn.Cn();
|
|
@@ -2502,7 +2502,7 @@ const Vt = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
|
|
|
2502
2502
|
this.Qo.Ro(t);
|
|
2503
2503
|
}
|
|
2504
2504
|
touchMoved(t) {
|
|
2505
|
-
this.Qo.
|
|
2505
|
+
this.Qo.An(t);
|
|
2506
2506
|
}
|
|
2507
2507
|
touchEnded(t) {
|
|
2508
2508
|
this.Qo.To(t);
|
|
@@ -2514,10 +2514,10 @@ const Vt = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
|
|
|
2514
2514
|
this.Qo.So(t);
|
|
2515
2515
|
}
|
|
2516
2516
|
doubleTap(t) {
|
|
2517
|
-
this.Qo
|
|
2517
|
+
this.Qo.$o(t);
|
|
2518
2518
|
}
|
|
2519
2519
|
longPress(t) {
|
|
2520
|
-
this.Qo
|
|
2520
|
+
this.Qo.Eo(t);
|
|
2521
2521
|
}
|
|
2522
2522
|
swipe(t) {
|
|
2523
2523
|
this.Qo.Do(t);
|
|
@@ -2542,7 +2542,7 @@ const Vt = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
|
|
|
2542
2542
|
this.Jo.gn(t);
|
|
2543
2543
|
}
|
|
2544
2544
|
isKeyPressed(t) {
|
|
2545
|
-
return this.Jo
|
|
2545
|
+
return this.Jo.$n(t);
|
|
2546
2546
|
}
|
|
2547
2547
|
get lastKeyPressed() {
|
|
2548
2548
|
return this.Jo.Dn();
|
|
@@ -2554,7 +2554,7 @@ const Vt = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
|
|
|
2554
2554
|
return this.Jo.Bn();
|
|
2555
2555
|
}
|
|
2556
2556
|
get modifierState() {
|
|
2557
|
-
return this.Jo.
|
|
2557
|
+
return this.Jo.Ln();
|
|
2558
2558
|
}
|
|
2559
2559
|
};
|
|
2560
2560
|
class $t {
|
|
@@ -2566,57 +2566,53 @@ class $t {
|
|
|
2566
2566
|
h(this, "rh", /* @__PURE__ */ new Map());
|
|
2567
2567
|
this.th = t;
|
|
2568
2568
|
}
|
|
2569
|
-
async
|
|
2570
|
-
for (const e of t)
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2569
|
+
async nh(t) {
|
|
2570
|
+
for (const e of t) {
|
|
2571
|
+
if (this.sh.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
|
|
2572
|
+
const i = this.oh(e.name);
|
|
2573
|
+
try {
|
|
2574
|
+
await e.install(this.th, i);
|
|
2575
|
+
} catch (s) {
|
|
2576
|
+
throw this.hh(e.name), s;
|
|
2577
|
+
}
|
|
2578
|
+
this.sh.set(e.name, e), this.eh.push(e.name);
|
|
2579
2579
|
}
|
|
2580
|
-
this.sh.set(t.name, t), this.eh.push(t.name);
|
|
2581
2580
|
}
|
|
2582
|
-
async
|
|
2581
|
+
async ah(t) {
|
|
2583
2582
|
const e = this.sh.get(t);
|
|
2584
2583
|
if (!e) return;
|
|
2585
|
-
const i = this.
|
|
2584
|
+
const i = this.oh(t);
|
|
2586
2585
|
if (e.uninstall) try {
|
|
2587
2586
|
await e.uninstall(this.th, i);
|
|
2588
2587
|
} catch (s) {
|
|
2589
2588
|
console.error(`[textmode.js] Error while uninstalling plugin "${t}":`, s);
|
|
2590
2589
|
}
|
|
2591
|
-
this.sh.delete(t), this.eh.splice(this.eh.indexOf(t), 1), this.
|
|
2592
|
-
}
|
|
2593
|
-
has(t) {
|
|
2594
|
-
return this.sh.has(t);
|
|
2590
|
+
this.sh.delete(t), this.eh.splice(this.eh.indexOf(t), 1), this.hh(t);
|
|
2595
2591
|
}
|
|
2596
2592
|
runPreDrawHooks() {
|
|
2597
|
-
this.
|
|
2593
|
+
this.uh(this.ih, "preDraw");
|
|
2598
2594
|
}
|
|
2599
2595
|
runPostDrawHooks() {
|
|
2600
|
-
this.
|
|
2596
|
+
this.uh(this.rh, "postDraw");
|
|
2601
2597
|
}
|
|
2602
|
-
async
|
|
2598
|
+
async fh() {
|
|
2603
2599
|
const t = [...this.sh.keys()];
|
|
2604
|
-
for (const e of t) await this.
|
|
2600
|
+
for (const e of t) await this.ah(e);
|
|
2605
2601
|
}
|
|
2606
|
-
|
|
2607
|
-
return { ...this.th.
|
|
2602
|
+
oh(t) {
|
|
2603
|
+
return { ...this.th.dh(), registerPreDrawHook: (e) => this.ph(this.ih, t, e), registerPostDrawHook: (e) => this.ph(this.rh, t, e) };
|
|
2608
2604
|
}
|
|
2609
|
-
|
|
2605
|
+
ph(t, e, i) {
|
|
2610
2606
|
const s = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
2611
2607
|
return s.add(i), t.set(e, s), () => {
|
|
2612
2608
|
const r = t.get(e);
|
|
2613
2609
|
r && (r.delete(i), r.size === 0 && t.delete(e));
|
|
2614
2610
|
};
|
|
2615
2611
|
}
|
|
2616
|
-
|
|
2612
|
+
hh(t) {
|
|
2617
2613
|
this.ih.delete(t), this.rh.delete(t);
|
|
2618
2614
|
}
|
|
2619
|
-
|
|
2615
|
+
uh(t, e) {
|
|
2620
2616
|
for (const i of this.eh) {
|
|
2621
2617
|
const s = t.get(i);
|
|
2622
2618
|
if (s) for (const r of s) try {
|
|
@@ -2630,18 +2626,18 @@ class $t {
|
|
|
2630
2626
|
class te {
|
|
2631
2627
|
constructor() {
|
|
2632
2628
|
h(this, "xt");
|
|
2633
|
-
h(this, "
|
|
2629
|
+
h(this, "$i");
|
|
2634
2630
|
h(this, "er");
|
|
2635
|
-
h(this, "
|
|
2631
|
+
h(this, "Or");
|
|
2636
2632
|
h(this, "qo");
|
|
2637
2633
|
h(this, "Hn");
|
|
2638
2634
|
h(this, "Qo");
|
|
2639
2635
|
h(this, "Jo");
|
|
2640
|
-
h(this, "fh");
|
|
2641
|
-
h(this, "Vo");
|
|
2642
|
-
h(this, "dh");
|
|
2643
|
-
h(this, "ph");
|
|
2644
2636
|
h(this, "_h");
|
|
2637
|
+
h(this, "Vo");
|
|
2638
|
+
h(this, "mh");
|
|
2639
|
+
h(this, "gh");
|
|
2640
|
+
h(this, "Ah");
|
|
2645
2641
|
}
|
|
2646
2642
|
Zo() {
|
|
2647
2643
|
}
|
|
@@ -2650,84 +2646,72 @@ class ee extends function(e, ...i) {
|
|
|
2650
2646
|
return i.reduce((s, r) => r(s), e);
|
|
2651
2647
|
}(te, qt, Kt, jt, Zt, Qt, Jt) {
|
|
2652
2648
|
constructor(e = {}) {
|
|
2653
|
-
var i;
|
|
2654
2649
|
super();
|
|
2655
|
-
h(this, "
|
|
2656
|
-
h(this, "
|
|
2657
|
-
h(this, "yh", !1);
|
|
2658
|
-
h(this, "Ah", !1);
|
|
2659
|
-
h(this, "Ch", () => {
|
|
2660
|
-
});
|
|
2650
|
+
h(this, "yh");
|
|
2651
|
+
h(this, "Ch", !1);
|
|
2661
2652
|
h(this, "wh", () => {
|
|
2662
2653
|
});
|
|
2663
2654
|
h(this, "bh", () => {
|
|
2664
2655
|
});
|
|
2665
|
-
h(this, "xh")
|
|
2656
|
+
h(this, "xh", () => {
|
|
2657
|
+
});
|
|
2658
|
+
h(this, "Mh");
|
|
2666
2659
|
h(this, "lr");
|
|
2667
2660
|
h(this, "cr", !1);
|
|
2668
|
-
h(this, "
|
|
2669
|
-
this.
|
|
2661
|
+
h(this, "Fh");
|
|
2662
|
+
this.yh = new $t(this), this.cr = e.overlay ?? !1, this.er = new Xt(e), this.xt = new Ut(this.er.gr()), this.$i = new Gt(this.xt, e.fontSize ?? 16), this.qo = new Yt(e.frameRate ?? 60), this.Hn = new rt(this.er), this.Qo = new ot(this.er, this.Hn), this.Jo = new nt(), this._h = this.xt.Pt(), this.mh = this.xt.rs(), this.zh(e);
|
|
2670
2663
|
}
|
|
2671
|
-
async
|
|
2672
|
-
await this.
|
|
2673
|
-
const i = this.
|
|
2674
|
-
this.
|
|
2664
|
+
async zh(e) {
|
|
2665
|
+
await this.$i.Ki(e.fontSource);
|
|
2666
|
+
const i = this.$i.maxGlyphDimensions;
|
|
2667
|
+
this.Or = new Ht(this.er.canvas, i.width, i.height), this.Hn.Ki(this.Or), this.Qo.Ki(this.Or), this.Vo = this.xt.Ye(this.Or.cols, this.Or.rows, 5), this.gh = this.xt.Ye(this.Or.width, this.Or.height, 1), this.cr && (this.Fh = G.zr(this.xt, this.er.targetCanvas, (s) => this.$i.Si(s))), this.Ah = this.xt.cs(st, "precision mediump float;uniform sampler2D Ua;uniform vec2 Ub;uniform vec2 Uc;uniform vec2 Ud;void main(){vec2 A=gl_FragCoord.xy-Uc;vec2 B=A*(Ub/Ud);vec2 C=(floor(B)+0.5)/Ub;gl_FragColor=texture2D(Ua,C);}"), this.Rh(), await this.yh.nh(e.plugins ?? []), this.wh(), this.qo.start(() => this.Zo());
|
|
2675
2668
|
}
|
|
2676
|
-
|
|
2677
|
-
return this.
|
|
2678
|
-
|
|
2679
|
-
async unuse(e) {
|
|
2680
|
-
return this.yh ? (await this.mh.unuse(e), this) : (this.gh = this.gh.filter((i) => i.name !== e), this);
|
|
2681
|
-
}
|
|
2682
|
-
hasPlugin(e) {
|
|
2683
|
-
return this.yh ? this.mh.has(e) : this.gh.some((i) => i.name === e);
|
|
2684
|
-
}
|
|
2685
|
-
ah() {
|
|
2686
|
-
return { renderer: this.xt, font: this.Ei, grid: this.Lr, canvas: this.er, drawFramebuffer: this.Vo, asciiFramebuffer: this.ph, flushDrawCommands: () => {
|
|
2687
|
-
this.xt.St(this.fh);
|
|
2669
|
+
dh() {
|
|
2670
|
+
return { renderer: this.xt, font: this.$i, grid: this.Or, canvas: this.er, drawFramebuffer: this.Vo, asciiFramebuffer: this.gh, flushDrawCommands: () => {
|
|
2671
|
+
this.xt.St(this._h);
|
|
2688
2672
|
} };
|
|
2689
2673
|
}
|
|
2690
|
-
|
|
2691
|
-
this.
|
|
2692
|
-
this.cr && this.resizeCanvas(this.er.targetCanvas.width, this.er.targetCanvas.height), this.
|
|
2693
|
-
}, window.addEventListener("resize", this.
|
|
2694
|
-
this.Jo.
|
|
2674
|
+
Rh() {
|
|
2675
|
+
this.Mh = () => {
|
|
2676
|
+
this.cr && this.resizeCanvas(this.er.targetCanvas.width, this.er.targetCanvas.height), this.xh();
|
|
2677
|
+
}, window.addEventListener("resize", this.Mh), this.Hn.an(), this.Qo.an(), this.Jo.an(), window.addEventListener("blur", () => {
|
|
2678
|
+
this.Jo.On();
|
|
2695
2679
|
}), window.ResizeObserver && this.cr && (this.lr = new ResizeObserver(() => {
|
|
2696
2680
|
this.resizeCanvas(this.er.targetCanvas.width, this.er.targetCanvas.height);
|
|
2697
2681
|
}), this.lr.observe(this.er.targetCanvas));
|
|
2698
2682
|
}
|
|
2699
2683
|
Zo() {
|
|
2700
|
-
if (this.qo.measureFrameRate(), this.qo.incrementFrame(), this.
|
|
2684
|
+
if (this.qo.measureFrameRate(), this.qo.incrementFrame(), this.Ch) return;
|
|
2701
2685
|
if (this.cr) {
|
|
2702
2686
|
const i = this.xt.context;
|
|
2703
|
-
i.bindTexture(i.TEXTURE_2D, this.
|
|
2687
|
+
i.bindTexture(i.TEXTURE_2D, this.Fh.texture), i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, 1), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, i.RGBA, i.UNSIGNED_BYTE, this.er.targetCanvas), i.bindTexture(i.TEXTURE_2D, null);
|
|
2704
2688
|
}
|
|
2705
|
-
this.
|
|
2689
|
+
this.yh.runPreDrawHooks(), this.Vo.begin(), this.xt.ke(this._h), this.bh(), this.xt.St(this._h), this.Vo.end(), this.gh.begin(), this.xt.ke(this.mh), this.mh.Wt({ U0: this.$i.fontFramebuffer, U1: [this.$i.textureColumns, this.$i.textureRows], U2: this.Vo.textures[0], U3: this.Vo.textures[1], U4: this.Vo.textures[2], U5: this.Vo.textures[4], U6: this.Vo.textures[3], U7: [this.Or.cols, this.Or.rows], U8: [this.gh.width, this.gh.height], U9: this.gh.width / this.gh.height }), this.xt.Ie(0, 0, this.er.width, this.er.height), this.gh.end();
|
|
2706
2690
|
const e = this.xt.state.canvasBackgroundColor;
|
|
2707
|
-
this.xt.Ys(e[0], e[1], e[2], e[3]), this.xt.ke(this.
|
|
2691
|
+
this.xt.Ys(e[0], e[1], e[2], e[3]), this.xt.ke(this.Ah), this.Ah.Wt({ Ua: this.gh.textures[0], Ub: [this.gh.width, this.gh.height], Uc: [this.Or.offsetX, this.Or.offsetY], Ud: [this.Or.width, this.Or.height] }), this.xt.Ie(this.Or.offsetX, this.Or.offsetY, this.Or.width, this.Or.height), this.yh.runPostDrawHooks();
|
|
2708
2692
|
}
|
|
2709
2693
|
setup(e) {
|
|
2710
|
-
this.
|
|
2694
|
+
this.wh = e;
|
|
2711
2695
|
}
|
|
2712
2696
|
draw(e) {
|
|
2713
|
-
this.
|
|
2697
|
+
this.bh = e;
|
|
2714
2698
|
}
|
|
2715
2699
|
windowResized(e) {
|
|
2716
|
-
this.
|
|
2700
|
+
this.xh = e;
|
|
2717
2701
|
}
|
|
2718
2702
|
resizeCanvas(e, i) {
|
|
2719
|
-
this.er.vr(e, i), this.
|
|
2703
|
+
this.er.vr(e, i), this.Or.nr(), this.Vo.resize(this.Or.cols, this.Or.rows), this.gh.resize(this.Or.width, this.Or.height), this.xt.Ze(), this.Hn.hn(), this.Qo.Co(), this.Zo();
|
|
2720
2704
|
}
|
|
2721
2705
|
destroy() {
|
|
2722
|
-
this.
|
|
2706
|
+
this.Ch || (this.qo.stop(), this.yh.fh().catch((e) => {
|
|
2723
2707
|
console.error("[textmode.js] Error while disposing plugins:", e);
|
|
2724
|
-
}), window.removeEventListener("resize", this.
|
|
2708
|
+
}), window.removeEventListener("resize", this.Mh), this.Hn._n(), this.Qo._n(), this.Jo._n(), this.$i.Dt(), this.xt.Dt(), this.gh.Dt(), this.Ah.Dt(), this.Fh && this.Fh.Dt(), this.Ch = !0);
|
|
2725
2709
|
}
|
|
2726
2710
|
get grid() {
|
|
2727
|
-
return this.
|
|
2711
|
+
return this.Or;
|
|
2728
2712
|
}
|
|
2729
2713
|
get font() {
|
|
2730
|
-
return this
|
|
2714
|
+
return this.$i;
|
|
2731
2715
|
}
|
|
2732
2716
|
get width() {
|
|
2733
2717
|
return this.er.width;
|
|
@@ -2742,10 +2726,10 @@ class ee extends function(e, ...i) {
|
|
|
2742
2726
|
return this.Vo;
|
|
2743
2727
|
}
|
|
2744
2728
|
get isDisposed() {
|
|
2745
|
-
return this.
|
|
2729
|
+
return this.Ch;
|
|
2746
2730
|
}
|
|
2747
2731
|
get overlay() {
|
|
2748
|
-
return this.
|
|
2732
|
+
return this.Fh;
|
|
2749
2733
|
}
|
|
2750
2734
|
}
|
|
2751
2735
|
class Q {
|
|
@@ -2758,12 +2742,11 @@ class Q {
|
|
|
2758
2742
|
z.A(t);
|
|
2759
2743
|
}
|
|
2760
2744
|
static get version() {
|
|
2761
|
-
return "0.
|
|
2745
|
+
return "0.4.0";
|
|
2762
2746
|
}
|
|
2763
2747
|
}
|
|
2764
|
-
const se = Object.freeze(Object.defineProperty({ __proto__: null
|
|
2748
|
+
const se = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: kt, mouse: Wt, touch: Vt }, Symbol.toStringTag, { value: "Module" })), re = Q.create, ne = Q.setErrorLevel, oe = Q.version;
|
|
2765
2749
|
export {
|
|
2766
|
-
$t as PluginManager,
|
|
2767
2750
|
Xt as TextmodeCanvas,
|
|
2768
2751
|
ct as TextmodeErrorLevel,
|
|
2769
2752
|
Gt as TextmodeFont,
|
|
@@ -2771,10 +2754,9 @@ export {
|
|
|
2771
2754
|
Ht as TextmodeGrid,
|
|
2772
2755
|
G as TextmodeImage,
|
|
2773
2756
|
ee as Textmodifier,
|
|
2774
|
-
|
|
2775
|
-
se as
|
|
2776
|
-
|
|
2777
|
-
oe as setErrorLevel,
|
|
2757
|
+
re as create,
|
|
2758
|
+
se as input,
|
|
2759
|
+
ne as setErrorLevel,
|
|
2778
2760
|
Q as textmode,
|
|
2779
|
-
|
|
2761
|
+
oe as version
|
|
2780
2762
|
};
|