textmode.js 0.2.1-beta.6 → 0.2.1-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/textmode.esm.js +823 -827
- package/dist/textmode.esm.min.js +885 -889
- package/dist/textmode.umd.js +7 -7
- package/dist/textmode.umd.min.js +7 -7
- package/dist/types/rendering/webgl/Framebuffer.d.ts +13 -1
- package/dist/types/textmode/TextmodeImage.d.ts +112 -43
- package/dist/types/textmode/Textmodifier.d.ts +15 -2
- package/dist/types/textmode/mixins/ExportMixin.d.ts +5 -18
- package/dist/types/textmode/mixins/RenderingMixin.d.ts +7 -16
- package/dist/types/textmode/mixins/TextmodifierMixin.d.ts +4 -0
- package/package.json +1 -1
- package/dist/types/assets/shaders-minified/frag/ascii.d.ts +0 -14
- package/dist/types/assets/shaders-minified/frag/copy-mrt.d.ts +0 -14
- package/dist/types/assets/shaders-minified/frag/image-to-mrt.d.ts +0 -14
- package/dist/types/assets/shaders-minified/frag/instanced-ascii-mrt.d.ts +0 -14
- package/dist/types/assets/shaders-minified/frag/present.d.ts +0 -14
- package/dist/types/assets/shaders-minified/index.d.ts +0 -7
- package/dist/types/assets/shaders-minified/vert/instanced-ascii-mrt.d.ts +0 -14
- package/dist/types/assets/shaders-minified/vert/shader.d.ts +0 -14
package/dist/textmode.esm.js
CHANGED
|
@@ -28,12 +28,12 @@ ${"↓".repeat(24)}
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
var ut = ((a) => (a[a.SILENT = 0] = "SILENT", a[a.WARNING = 1] = "WARNING", a[a.ERROR = 2] = "ERROR", a[a.THROW = 3] = "THROW", a))(ut || {});
|
|
31
|
-
const
|
|
31
|
+
const D = class D {
|
|
32
32
|
constructor() {
|
|
33
33
|
h(this, "u", { globalLevel: 3 });
|
|
34
34
|
}
|
|
35
35
|
static m() {
|
|
36
|
-
return
|
|
36
|
+
return D.l || (D.l = new D()), D.l;
|
|
37
37
|
}
|
|
38
38
|
_(t, e) {
|
|
39
39
|
const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.", s = "color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;";
|
|
@@ -55,9 +55,9 @@ const M = class M {
|
|
|
55
55
|
this.u.globalLevel = t;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
h(
|
|
59
|
-
let K =
|
|
60
|
-
const
|
|
58
|
+
h(D, "l", null);
|
|
59
|
+
let K = D;
|
|
60
|
+
const G = K.m(), ot = /* @__PURE__ */ new WeakMap();
|
|
61
61
|
function H(a, t) {
|
|
62
62
|
ot.set(a, t);
|
|
63
63
|
}
|
|
@@ -74,27 +74,27 @@ class at {
|
|
|
74
74
|
h(this, "R", [1, 1, 1, 1]);
|
|
75
75
|
h(this, "P", [0, 0, 0, 1]);
|
|
76
76
|
h(this, "S", !1);
|
|
77
|
-
h(this, "G", !1);
|
|
78
77
|
h(this, "D", !1);
|
|
78
|
+
h(this, "G", !1);
|
|
79
79
|
h(this, "L", [0, 0]);
|
|
80
|
-
h(this, "
|
|
81
|
-
h(this, "
|
|
80
|
+
h(this, "O", [0, 0, 0, 1]);
|
|
81
|
+
h(this, "k", []);
|
|
82
82
|
}
|
|
83
83
|
H() {
|
|
84
|
-
this.
|
|
84
|
+
this.k.push({ I: this.C, N: this.U, X: this.$, W: this.M, L: [...this.L], V: this.S, K: this.D, G: this.G, j: [...this.F], Y: [...this.R], q: [...this.P] });
|
|
85
85
|
}
|
|
86
86
|
Z() {
|
|
87
|
-
const t = this.
|
|
88
|
-
t ? (this.C = t.I, this.U = t.N, this.$ = t.X, this.M = t.W, this.L = t.L, this.S = t.V, this.
|
|
87
|
+
const t = this.k.pop();
|
|
88
|
+
t ? (this.C = t.I, this.U = t.N, this.$ = t.X, this.M = t.W, this.L = t.L, this.S = t.V, this.D = t.K, this.G = t.G, this.F = t.j, this.R = t.Y, this.P = t.q) : console.warn("pop() called without matching push()");
|
|
89
89
|
}
|
|
90
90
|
J(t) {
|
|
91
|
-
t.I = this.C, t.N = this.U, t.X = this.$, t.W = this.M, t.j[0] = this.F[0], t.j[1] = this.F[1], t.j[2] = this.F[2], t.Y[0] = this.R[0], t.Y[1] = this.R[1], t.Y[2] = this.R[2], t.Y[3] = this.R[3], t.q[0] = this.P[0], t.q[1] = this.P[1], t.q[2] = this.P[2], t.q[3] = this.P[3], t.V = this.S, t.K = this.
|
|
91
|
+
t.I = this.C, t.N = this.U, t.X = this.$, t.W = this.M, t.j[0] = this.F[0], t.j[1] = this.F[1], t.j[2] = this.F[2], t.Y[0] = this.R[0], t.Y[1] = this.R[1], t.Y[2] = this.R[2], t.Y[3] = this.R[3], t.q[0] = this.P[0], t.q[1] = this.P[1], t.q[2] = this.P[2], t.q[3] = this.P[3], t.V = this.S, t.K = this.D, t.G = this.G, 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);
|
|
@@ -121,17 +121,17 @@ class at {
|
|
|
121
121
|
this.S = t;
|
|
122
122
|
}
|
|
123
123
|
ct(t) {
|
|
124
|
-
this.
|
|
124
|
+
this.D = t;
|
|
125
125
|
}
|
|
126
126
|
lt(t) {
|
|
127
|
-
this.
|
|
127
|
+
this.G = t;
|
|
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
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 q {
|
|
@@ -191,9 +191,9 @@ class q {
|
|
|
191
191
|
const s = this.dt, r = this.gt, n = new Uint8Array(s * r * 4), o = e.getParameter(e.READ_FRAMEBUFFER_BINDING);
|
|
192
192
|
e.bindFramebuffer(e.READ_FRAMEBUFFER, this.yt), 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
|
-
for (let
|
|
195
|
-
const
|
|
196
|
-
l.set(n.subarray(
|
|
194
|
+
for (let u = 0; u < r; u++) {
|
|
195
|
+
const f = (r - 1 - u) * c, g = u * c;
|
|
196
|
+
l.set(n.subarray(f, f + c), g);
|
|
197
197
|
}
|
|
198
198
|
return this.bt[t] = l, l;
|
|
199
199
|
}
|
|
@@ -218,7 +218,7 @@ class q {
|
|
|
218
218
|
}
|
|
219
219
|
t.bindFramebuffer(t.FRAMEBUFFER, this.Ct.framebuffer), t.viewport(...this.Ct.viewport), H(t, this.Ct.viewport), this.Ct = null, this.xt && this.$t && this.Mt && ((r = (s = this.xt).Bt) == null || r.call(s));
|
|
220
220
|
}
|
|
221
|
-
|
|
221
|
+
Dt() {
|
|
222
222
|
const t = this.vt;
|
|
223
223
|
t.deleteFramebuffer(this.yt);
|
|
224
224
|
for (const e of this.At) t.deleteTexture(e);
|
|
@@ -233,24 +233,24 @@ class q {
|
|
|
233
233
|
return [...this.At];
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
class
|
|
236
|
+
class I {
|
|
237
237
|
constructor(t, e, i) {
|
|
238
238
|
h(this, "vt");
|
|
239
|
-
h(this, "
|
|
239
|
+
h(this, "Gt");
|
|
240
240
|
h(this, "Lt", /* @__PURE__ */ new Map());
|
|
241
|
-
h(this, "
|
|
242
|
-
h(this, "
|
|
243
|
-
this.vt = t, this.
|
|
241
|
+
h(this, "Ot", /* @__PURE__ */ new Map());
|
|
242
|
+
h(this, "kt", 0);
|
|
243
|
+
this.vt = t, this.Gt = this.Ht(e, i), this.It();
|
|
244
244
|
}
|
|
245
245
|
It() {
|
|
246
|
-
const t = this.vt.getProgramParameter(this.
|
|
246
|
+
const t = this.vt.getProgramParameter(this.Gt, this.vt.ACTIVE_UNIFORMS);
|
|
247
247
|
for (let e = 0; e < t; e++) {
|
|
248
|
-
const i = this.vt.getActiveUniform(this.
|
|
248
|
+
const i = this.vt.getActiveUniform(this.Gt, e);
|
|
249
249
|
if (i) {
|
|
250
|
-
const s = this.vt.getUniformLocation(this.
|
|
251
|
-
if (s && (this.Lt.set(i.name, s), this.
|
|
250
|
+
const s = this.vt.getUniformLocation(this.Gt, i.name);
|
|
251
|
+
if (s && (this.Lt.set(i.name, s), this.Ot.set(i.name, { type: i.type, size: i.size }), i.size > 1)) {
|
|
252
252
|
const r = i.name.replace(/\[.*\]$/, "");
|
|
253
|
-
this.Lt.has(r) || (this.Lt.set(r, s), this.
|
|
253
|
+
this.Lt.has(r) || (this.Lt.set(r, s), this.Ot.set(r, { type: i.type, size: i.size }));
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
}
|
|
@@ -272,10 +272,10 @@ class _ {
|
|
|
272
272
|
return i;
|
|
273
273
|
}
|
|
274
274
|
Xt() {
|
|
275
|
-
this.vt.useProgram(this.
|
|
275
|
+
this.vt.useProgram(this.Gt), this.Wt();
|
|
276
276
|
}
|
|
277
277
|
Wt() {
|
|
278
|
-
this.
|
|
278
|
+
this.kt = 0;
|
|
279
279
|
}
|
|
280
280
|
Vt(t) {
|
|
281
281
|
for (const [e, i] of Object.entries(t)) this.Kt(e, i);
|
|
@@ -284,18 +284,18 @@ class _ {
|
|
|
284
284
|
return this.Lt.has(t);
|
|
285
285
|
}
|
|
286
286
|
Yt(t) {
|
|
287
|
-
return this.
|
|
287
|
+
return this.Ot.get(t) || null;
|
|
288
288
|
}
|
|
289
289
|
qt() {
|
|
290
290
|
const t = [];
|
|
291
|
-
for (const [e, i] of this.
|
|
291
|
+
for (const [e, i] of this.Ot.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.Lt.get(t);
|
|
297
297
|
if (!i) return;
|
|
298
|
-
const s = this.
|
|
298
|
+
const s = this.Ot.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.vt;
|
|
301
301
|
if (typeof e == "number") switch (r) {
|
|
@@ -311,16 +311,16 @@ class _ {
|
|
|
311
311
|
}
|
|
312
312
|
else if (typeof e == "boolean") o.uniform1i(i, e ? 1 : 0);
|
|
313
313
|
else if (Array.isArray(e)) if (Array.isArray(e[0])) {
|
|
314
|
-
const l = e,
|
|
314
|
+
const l = e, u = ((c = l[0]) == null ? void 0 : c.length) || 0, f = l.flat();
|
|
315
315
|
switch (r) {
|
|
316
316
|
case o.FLOAT_VEC2:
|
|
317
|
-
|
|
317
|
+
u === 2 ? o.uniform2fv(i, f) : console.warn(`Vector length mismatch for '${t}': expected 2, got ${u}`);
|
|
318
318
|
break;
|
|
319
319
|
case o.FLOAT_VEC3:
|
|
320
|
-
|
|
320
|
+
u === 3 ? o.uniform3fv(i, f) : console.warn(`Vector length mismatch for '${t}': expected 3, got ${u}`);
|
|
321
321
|
break;
|
|
322
322
|
case o.FLOAT_VEC4:
|
|
323
|
-
|
|
323
|
+
u === 4 ? o.uniform4fv(i, f) : console.warn(`Vector length mismatch for '${t}': expected 4, got ${u}`);
|
|
324
324
|
break;
|
|
325
325
|
default:
|
|
326
326
|
console.warn(`Unsupported uniform type for vector array '${t}': ${r}`);
|
|
@@ -353,16 +353,16 @@ class _ {
|
|
|
353
353
|
} else console.warn(`Unsupported uniform type for '${t}':`, typeof e);
|
|
354
354
|
}
|
|
355
355
|
Zt() {
|
|
356
|
-
return this.
|
|
356
|
+
return this.kt++;
|
|
357
357
|
}
|
|
358
358
|
get Qt() {
|
|
359
|
-
return this.
|
|
359
|
+
return this.Gt;
|
|
360
360
|
}
|
|
361
|
-
|
|
362
|
-
this.vt.deleteProgram(this.
|
|
361
|
+
Dt() {
|
|
362
|
+
this.vt.deleteProgram(this.Gt);
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
-
const
|
|
365
|
+
const W = `#version 300 es
|
|
366
366
|
in vec2 a_position;in vec2 a_texCoord;in vec2 a_instancePosition;in vec2 a_instanceSize;in vec3 a_instanceCharacter;in vec4 a_instancePrimaryColor;in vec4 a_instanceSecondaryColor;in vec2 a_instanceRotation;in vec3 a_instanceTransform;in vec3 a_instanceGlobalRotation;in vec2 a_instanceRotationCenter;in vec2 a_instanceBezierCP1;in vec2 a_instanceBezierCP2;in vec2 a_instanceBezierStart;in vec2 a_instanceBezierEnd;in vec2 a_instanceArcAngles;uniform float U9;uniform vec2 Uy;out vec2 v_uv;out vec3 v_character;out vec4 v_primaryColor;out vec4 v_secondaryColor;out vec2 v_rotation;out vec3 v_transform;mat3 A(float B){float C=sin(B),D=cos(B);return mat3(1,0,0,0,D,-C,0,C,D);}mat3 E(float B){float C=sin(B),D=cos(B);return mat3(D,0,C,0,1,0,-C,0,D);}mat3 F(float B){float C=sin(B),D=cos(B);return mat3(D,-C,0,C,D,0,0,0,1);}vec2 G(float H,vec2 I,vec2 J,vec2 K,vec2 L){float M=1.-H,N=M*M,O=H*H;return N*M*I+3.*N*H*J+3.*M*O*K+O*H*L;}vec2 P(float H,vec2 I,vec2 J,vec2 K,vec2 L){float M=1.-H,N=M*M,O=H*H;return-3.*N*I+3.*N*J-6.*M*H*J+6.*M*H*K-3.*O*K+3.*O*L;}void main(){v_uv=a_texCoord;v_character=a_instanceCharacter;v_primaryColor=a_instancePrimaryColor;v_secondaryColor=a_instanceSecondaryColor;v_rotation=a_instanceRotation;v_transform=a_instanceTransform;vec2 Q;bool R=length(a_instanceBezierCP1)+length(a_instanceBezierCP2)+length(a_instanceBezierStart)+length(a_instanceBezierEnd)>0.;bool S=a_instanceArcAngles.x!=0.||a_instanceArcAngles.y!=0.;if(R){float H=a_position.x;vec2 T=G(H,a_instanceBezierStart,a_instanceBezierCP1,a_instanceBezierCP2,a_instanceBezierEnd);vec2 U=P(H,a_instanceBezierStart,a_instanceBezierCP1,a_instanceBezierCP2,a_instanceBezierEnd);float V=length(U);U=V>0.?U/V:vec2(1,0);Q=T+vec2(-U.y,U.x)*a_position.y*a_instanceSize.y;}else if(S){float C=a_instanceArcAngles.x,W=a_instanceArcAngles.y;C=mod(C,6.28318530718);if(C<0.)C+=6.28318530718;W=mod(W,6.28318530718);if(W<0.)W+=6.28318530718;float X=C-W;if(X<=0.)X+=6.28318530718;float Y=C-a_position.x*X;vec2 Z=vec2(cos(Y),sin(Y))*a_position.y;Q=Z*a_instanceSize*.5+a_instanceSize*.5+a_instancePosition;}else{Q=a_position*a_instanceSize+a_instancePosition;}vec2 a=(Q/Uy)*2.-1.;a.y=-a.y;if(length(a_instanceGlobalRotation)>0.){vec3 b=vec3(a-a_instanceRotationCenter,0);b.x*=U9;if(a_instanceGlobalRotation.x!=0.)b=A(-a_instanceGlobalRotation.x)*b;if(a_instanceGlobalRotation.y!=0.)b=E(-a_instanceGlobalRotation.y)*b;if(a_instanceGlobalRotation.z!=0.)b=F(-a_instanceGlobalRotation.z)*b;b.x/=U9;a=b.xy+a_instanceRotationCenter;}gl_Position=vec4(a,0,1);}`, ht = "attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_uv;void main(){v_uv=a_texCoord;gl_Position=vec4(a_position,0.,1.);}";
|
|
367
367
|
class ft {
|
|
368
368
|
constructor(t) {
|
|
@@ -371,9 +371,9 @@ class ft {
|
|
|
371
371
|
h(this, "te");
|
|
372
372
|
h(this, "ee");
|
|
373
373
|
h(this, "se");
|
|
374
|
-
this.vt = t, this.te = 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.Jt = 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.ee = new
|
|
374
|
+
this.vt = t, this.te = new I(this.vt, W, `#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.Jt = new I(this.vt, W, `#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.ee = new I(this.vt, ht, "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.se = new I(this.vt, W, `#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 vec3 Uq;uniform bool Ur;uniform vec3 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.299,0.587,0.114));}void main(){vec2 C=vec2(v_uv.x,1.-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.),0.,F-1.);int H=int(floor(G+0.5));vec3 I=Uv[H];o_character=vec4(I,1.);}else{o_character=vec4(E,0.,0.,1.);}vec3 J=D.rgb;vec3 K=Up?Uq:J;vec3 L=Ur?Us:J;float M=Up?1.:D.a;float N;if(D.a<0.01){K=Ut.rgb;L=Ut.rgb;M=Ut.a;N=Ut.a;}else{N=Ur?1.:D.a;}o_primaryColor=vec4(K,M);o_secondaryColor=vec4(L,N);o_rotation=vec4(Uo.xy,0.,1.);o_transform=vec4(float(Ul),float(Um),float(Un),1.);}`);
|
|
378
378
|
}
|
|
379
379
|
ie() {
|
|
@@ -389,16 +389,16 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uk;uniform bool Ul;uniform
|
|
|
389
389
|
return this.se;
|
|
390
390
|
}
|
|
391
391
|
oe(t) {
|
|
392
|
-
return new
|
|
392
|
+
return new I(this.vt, W, t);
|
|
393
393
|
}
|
|
394
394
|
ae(t, e) {
|
|
395
|
-
return new
|
|
395
|
+
return new I(this.vt, t, e);
|
|
396
396
|
}
|
|
397
|
-
|
|
398
|
-
this.Jt.
|
|
397
|
+
Dt() {
|
|
398
|
+
this.Jt.Dt(), this.te.Dt(), this.ee.Dt(), this.se.Dt();
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
|
-
var
|
|
401
|
+
var y = ((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))(y || {});
|
|
402
402
|
class dt {
|
|
403
403
|
constructor(t) {
|
|
404
404
|
h(this, "vt");
|
|
@@ -422,7 +422,7 @@ class dt {
|
|
|
422
422
|
pe() {
|
|
423
423
|
this.vt.bindVertexArray(null);
|
|
424
424
|
}
|
|
425
|
-
|
|
425
|
+
Dt() {
|
|
426
426
|
for (const [, t] of this.he) for (const [, e] of t) e && this.vt.deleteVertexArray(e);
|
|
427
427
|
}
|
|
428
428
|
}
|
|
@@ -440,38 +440,38 @@ class gt {
|
|
|
440
440
|
s.Vt({ U9: r[2] / r[3], Uy: [r[2], r[3]] });
|
|
441
441
|
const n = (l) => {
|
|
442
442
|
if (!l || !l.ye()) return;
|
|
443
|
-
const
|
|
443
|
+
const u = l.unitGeometry, f = l.unitBuffer;
|
|
444
444
|
try {
|
|
445
|
-
this.me.ce(s.Qt, l.type + "",
|
|
445
|
+
this.me.ce(s.Qt, l.type + "", u, f), l.batch.Ae(s), l.batch.we(u.Ce, u.be);
|
|
446
446
|
} finally {
|
|
447
447
|
l.batch.xe(s), this.me.pe(), l.$e();
|
|
448
448
|
}
|
|
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.Me(t, l.params, l.state, i.get(
|
|
452
|
+
if (l.type === y.CUSTOM) {
|
|
453
|
+
c && (n(c), o = null, c = null), this.Me(t, l.params, l.state, i.get(y.RECTANGLE));
|
|
454
454
|
continue;
|
|
455
455
|
}
|
|
456
456
|
o !== null && l.type !== o && (n(c), o = null, c = null);
|
|
457
|
-
let
|
|
458
|
-
|
|
457
|
+
let u = c;
|
|
458
|
+
u && l.type === o || (u = i.get(l.type) || null, c = u, o = l.type), u && u.Fe(l.params, l.state);
|
|
459
459
|
}
|
|
460
460
|
n(c);
|
|
461
461
|
}
|
|
462
462
|
Me(t, e, i, s) {
|
|
463
|
-
const { x: r, y: n, width: o, height: c, shader: l, uniforms:
|
|
464
|
-
|
|
465
|
-
const g = this.Pe(), v = { Ue:
|
|
463
|
+
const { x: r, y: n, width: o, height: c, shader: l, uniforms: u } = e, f = this.Re(Math.max(1, Math.floor(o)), Math.max(1, Math.floor(c)));
|
|
464
|
+
f.begin(), this.ze(s, l, u, 0, 0, f.width, f.height, {}), f.end();
|
|
465
|
+
const g = this.Pe(), v = { Ue: f.textures[0], Uf: f.textures[1], Ug: f.textures[2], Uh: f.textures[3], Ui: f.textures[4], Uj: [f.width, f.height] };
|
|
466
466
|
this.ze(s, g, v, Math.floor(r), Math.floor(n), Math.max(1, Math.floor(o)), Math.max(1, Math.floor(c)), i), t.shader.Xt();
|
|
467
467
|
}
|
|
468
468
|
ze(t, e, i, s, r, n, o, c) {
|
|
469
469
|
e.Xt(), e.Vt(i);
|
|
470
470
|
const l = this.vt.getParameter(this.vt.VIEWPORT);
|
|
471
471
|
if (e.Vt({ U9: l[2] / l[3], Uy: [l[2], l[3]] }), t.$e(), t.Fe({ x: s, y: r, width: n, height: o }, c), t.ye()) {
|
|
472
|
-
const
|
|
472
|
+
const u = t.unitGeometry, f = t.unitBuffer;
|
|
473
473
|
try {
|
|
474
|
-
this.me.ce(e.Qt, t.type + "",
|
|
474
|
+
this.me.ce(e.Qt, t.type + "", u, f), t.batch.Ae(e), t.batch.we(u.Ce, u.be);
|
|
475
475
|
} finally {
|
|
476
476
|
t.batch.xe(e), this.me.pe(), t.$e();
|
|
477
477
|
}
|
|
@@ -481,10 +481,10 @@ class gt {
|
|
|
481
481
|
return this.xt.ie();
|
|
482
482
|
}
|
|
483
483
|
Re(t, e) {
|
|
484
|
-
return this.ge && this._e && this._e.w === t && this._e.h === e || (this.ge && this.ge.
|
|
484
|
+
return this.ge && this._e && this._e.w === t && this._e.h === e || (this.ge && this.ge.Dt(), this.ge = new q(this.vt, t, e, 5), this._e = { w: t, h: e }), this.ge;
|
|
485
485
|
}
|
|
486
|
-
|
|
487
|
-
this.me.
|
|
486
|
+
Dt() {
|
|
487
|
+
this.me.Dt(), this.ge && this.ge.Dt();
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
490
|
class pt {
|
|
@@ -495,39 +495,39 @@ class pt {
|
|
|
495
495
|
}
|
|
496
496
|
Be(t) {
|
|
497
497
|
if (this.Ee >= this.Te.length) {
|
|
498
|
-
const i = { id: this.Se++, type: t, params: {}, state: { I: 1, N: 0, X: 0, W: 0, j: [0, 0, 0], Y: [1, 1, 1, 1], q: [0, 0, 0, 1], V: !1, K: !1,
|
|
498
|
+
const i = { id: this.Se++, type: t, params: {}, state: { I: 1, N: 0, X: 0, W: 0, j: [0, 0, 0], Y: [1, 1, 1, 1], q: [0, 0, 0, 1], V: !1, K: !1, G: !1, L: [0, 0] } };
|
|
499
499
|
this.Te.push(i);
|
|
500
500
|
}
|
|
501
501
|
const e = this.Te[this.Ee];
|
|
502
502
|
return e.id = this.Se++, e.type = t, this.Ee++, e;
|
|
503
503
|
}
|
|
504
|
-
|
|
505
|
-
const n = this.Be(
|
|
504
|
+
De(t, e, i, s, r) {
|
|
505
|
+
const n = this.Be(y.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
|
-
|
|
509
|
-
const c = this.Be(
|
|
508
|
+
Ge(t, e, i, s, r, n, o) {
|
|
509
|
+
const c = this.Be(y.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
|
Le(t, e, i, s, r, n) {
|
|
513
|
-
const o = this.Be(
|
|
513
|
+
const o = this.Be(y.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
|
-
|
|
517
|
-
const n = this.Be(
|
|
516
|
+
Oe(t, e, i, s, r) {
|
|
517
|
+
const n = this.Be(y.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
|
-
|
|
521
|
-
const c = this.Be(
|
|
520
|
+
ke(t, e, i, s, r, n, o) {
|
|
521
|
+
const c = this.Be(y.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
|
He(t, e, i, s, r, n, o) {
|
|
525
|
-
const c = this.Be(
|
|
525
|
+
const c = this.Be(y.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
|
-
Ie(t, e, i, s, r, n, o, c, l,
|
|
529
|
-
const
|
|
530
|
-
return
|
|
528
|
+
Ie(t, e, i, s, r, n, o, c, l, u) {
|
|
529
|
+
const f = this.Be(y.BEZIER_CURVE);
|
|
530
|
+
return f.params.x1 = t, f.params.y1 = e, f.params.cp1x = i, f.params.cp1y = s, f.params.cp2x = r, f.params.cp2y = n, f.params.x2 = o, f.params.y2 = c, f.params.thickness = l, u.J(f.state), f.id;
|
|
531
531
|
}
|
|
532
532
|
get length() {
|
|
533
533
|
return this.Ee;
|
|
@@ -546,10 +546,10 @@ class pt {
|
|
|
546
546
|
}
|
|
547
547
|
const P = class P {
|
|
548
548
|
static Xe(t, e, i = 0) {
|
|
549
|
-
var n, o, c, l,
|
|
549
|
+
var n, o, c, l, u, f, g, v, m, d;
|
|
550
550
|
const s = e || new Float32Array(P.FLOATS_PER_INSTANCE);
|
|
551
551
|
let r = i;
|
|
552
|
-
return s[r++] = t.le[0], s[r++] = t.le[1], s[r++] = t.Ee[0], s[r++] = t.Ee[1], s[r++] = t.j[0], s[r++] = t.j[1], s[r++] = t.j[2], s[r++] = t.Y[0], s[r++] = t.Y[1], s[r++] = t.Y[2], s[r++] = t.Y[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.We[0], s[r++] = t.We[1], s[r++] = t.We[2], s[r++] = t.N, s[r++] = t.X, s[r++] = t.W, s[r++] = t.Ve[0], s[r++] = t.Ve[1], s[r++] = ((n = t.Ke) == null ? void 0 : n[0]) || 0, s[r++] = ((o = t.Ke) == null ? void 0 : o[1]) || 0, s[r++] = ((c = t.je) == null ? void 0 : c[0]) || 0, s[r++] = ((l = t.je) == null ? void 0 : l[1]) || 0, s[r++] = ((
|
|
552
|
+
return s[r++] = t.le[0], s[r++] = t.le[1], s[r++] = t.Ee[0], s[r++] = t.Ee[1], s[r++] = t.j[0], s[r++] = t.j[1], s[r++] = t.j[2], s[r++] = t.Y[0], s[r++] = t.Y[1], s[r++] = t.Y[2], s[r++] = t.Y[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.We[0], s[r++] = t.We[1], s[r++] = t.We[2], s[r++] = t.N, s[r++] = t.X, s[r++] = t.W, s[r++] = t.Ve[0], s[r++] = t.Ve[1], s[r++] = ((n = t.Ke) == null ? void 0 : n[0]) || 0, s[r++] = ((o = t.Ke) == null ? void 0 : o[1]) || 0, s[r++] = ((c = t.je) == null ? void 0 : c[0]) || 0, s[r++] = ((l = t.je) == null ? void 0 : l[1]) || 0, s[r++] = ((u = t.Ye) == null ? void 0 : u[0]) || 0, s[r++] = ((f = t.Ye) == null ? void 0 : f[1]) || 0, s[r++] = ((g = t.qe) == null ? void 0 : g[0]) || 0, s[r++] = ((v = t.qe) == null ? void 0 : v[1]) || 0, s[r++] = ((m = t.Ze) == null ? void 0 : m[0]) || 0, s[r++] = ((d = t.Ze) == null ? void 0 : d[1]) || 0, s;
|
|
553
553
|
}
|
|
554
554
|
static Qe(t) {
|
|
555
555
|
const e = t.length * P.FLOATS_PER_INSTANCE, i = new Float32Array(e);
|
|
@@ -561,10 +561,10 @@ const P = class P {
|
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
h(P, "BYTES_PER_INSTANCE", 140), h(P, "FLOATS_PER_INSTANCE", 35);
|
|
564
|
-
let
|
|
564
|
+
let M = P;
|
|
565
565
|
const T = class T {
|
|
566
566
|
};
|
|
567
|
-
h(T, "STRIDE",
|
|
567
|
+
h(T, "STRIDE", M.BYTES_PER_INSTANCE), h(T, "ATTRIBUTES", { a_instancePosition: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 0, divisor: 1 }, a_instanceSize: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 8, divisor: 1 }, a_instanceCharacter: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 16, divisor: 1 }, a_instancePrimaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 28, divisor: 1 }, a_instanceSecondaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 44, divisor: 1 }, a_instanceRotation: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 60, divisor: 1 }, a_instanceTransform: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 68, divisor: 1 }, a_instanceGlobalRotation: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 80, divisor: 1 }, a_instanceRotationCenter: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 92, divisor: 1 }, a_instanceArcAngles: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 100, divisor: 1 }, a_instanceBezierCP1: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 108, divisor: 1 }, a_instanceBezierCP2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 116, divisor: 1 }, a_instanceBezierStart: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 124, divisor: 1 }, a_instanceBezierEnd: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 132, divisor: 1 } });
|
|
568
568
|
let Y = T;
|
|
569
569
|
class mt {
|
|
570
570
|
constructor(t, e = 1e3, i = 1.5) {
|
|
@@ -600,14 +600,14 @@ class mt {
|
|
|
600
600
|
ls() {
|
|
601
601
|
const t = this.vt;
|
|
602
602
|
this.ss && t.deleteBuffer(this.ss), this.ss = t.createBuffer();
|
|
603
|
-
const e = this.ts *
|
|
603
|
+
const e = this.ts * M.BYTES_PER_INSTANCE;
|
|
604
604
|
t.bindBuffer(t.ARRAY_BUFFER, this.ss), t.bufferData(t.ARRAY_BUFFER, e, t.DYNAMIC_DRAW), t.bindBuffer(t.ARRAY_BUFFER, null), this.rs = !0, this.ns = 0;
|
|
605
605
|
}
|
|
606
606
|
fs() {
|
|
607
607
|
if (!this.rs || this.Je.length === 0) return;
|
|
608
608
|
const t = this.vt, e = this.Je.length;
|
|
609
|
-
this.us(e), (!this.cs || this.cs.length < e *
|
|
610
|
-
const i =
|
|
609
|
+
this.us(e), (!this.cs || this.cs.length < e * M.FLOATS_PER_INSTANCE) && (this.cs = new Float32Array(e * M.FLOATS_PER_INSTANCE));
|
|
610
|
+
const i = M.Qe(this.Je);
|
|
611
611
|
t.bindBuffer(t.ARRAY_BUFFER, this.ss), e <= this.ns ? t.bufferSubData(t.ARRAY_BUFFER, 0, i) : t.bufferData(t.ARRAY_BUFFER, i, t.DYNAMIC_DRAW), t.bindBuffer(t.ARRAY_BUFFER, null), this.rs = !1, this.ns = e;
|
|
612
612
|
}
|
|
613
613
|
ds(t) {
|
|
@@ -641,11 +641,11 @@ class mt {
|
|
|
641
641
|
we(t, e) {
|
|
642
642
|
this.Je.length !== 0 && this.vt.drawArraysInstanced(t, 0, e, this.Je.length);
|
|
643
643
|
}
|
|
644
|
-
|
|
644
|
+
Dt() {
|
|
645
645
|
this.ss && this.vt.deleteBuffer(this.ss);
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
|
-
class
|
|
648
|
+
class _ {
|
|
649
649
|
constructor(t, e, i, s) {
|
|
650
650
|
h(this, "vt");
|
|
651
651
|
h(this, "ps");
|
|
@@ -675,12 +675,12 @@ class I {
|
|
|
675
675
|
ye() {
|
|
676
676
|
return !this.ps.isEmpty;
|
|
677
677
|
}
|
|
678
|
-
|
|
679
|
-
this.ps.
|
|
678
|
+
Dt() {
|
|
679
|
+
this.ps.Dt(), this.vt.deleteBuffer(this.vs);
|
|
680
680
|
}
|
|
681
681
|
ws(t, e, i, s, r) {
|
|
682
682
|
const n = this.Cs(t, e, i, s, r.N || 0, r.X || 0, r.W || 0);
|
|
683
|
-
return { le: [t, e], Ee: [i, s], j: r.j || [0, 0, 0], Y: r.Y || [1, 1, 1, 1], q: r.q || [0, 0, 0, 1], L: r.L || [0, 0], We: [r.
|
|
683
|
+
return { le: [t, e], Ee: [i, s], j: r.j || [0, 0, 0], Y: r.Y || [1, 1, 1, 1], q: r.q || [0, 0, 0, 1], L: r.L || [0, 0], We: [r.G ? 1 : 0, r.V ? 1 : 0, r.K ? 1 : 0], N: n.radiansX, X: n.radiansY, W: n.radiansZ, Ve: [n.centerX, n.centerY] };
|
|
684
684
|
}
|
|
685
685
|
bs(t, e) {
|
|
686
686
|
const i = k(this.vt) || [0, 0, this.vt.canvas.width, this.vt.canvas.height];
|
|
@@ -691,14 +691,14 @@ class I {
|
|
|
691
691
|
t.Ve = [s.nx, s.ny];
|
|
692
692
|
}
|
|
693
693
|
Cs(t, e, i, s, r, n, o) {
|
|
694
|
-
const c = k(this.vt) || [0, 0, this.vt.canvas.width, this.vt.canvas.height], l = c[2],
|
|
695
|
-
return { centerX: (t + i / 2) / l * 2 - 1, centerY: 1 - (e + s / 2) /
|
|
694
|
+
const c = k(this.vt) || [0, 0, this.vt.canvas.width, this.vt.canvas.height], l = c[2], u = c[3];
|
|
695
|
+
return { centerX: (t + i / 2) / l * 2 - 1, centerY: 1 - (e + s / 2) / u * 2, radiansX: -r * Math.PI / 180, radiansY: -n * Math.PI / 180, radiansZ: -o * Math.PI / 180, aspectRatio: l / u };
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
698
|
const vt = { As: 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]), be: 6, Ce: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
|
|
699
|
-
class At extends
|
|
699
|
+
class At extends _ {
|
|
700
700
|
constructor(t, e) {
|
|
701
|
-
super(t, e,
|
|
701
|
+
super(t, e, y.RECTANGLE, vt);
|
|
702
702
|
}
|
|
703
703
|
Fe(t, e) {
|
|
704
704
|
const i = this.ws(t.x, t.y, t.width, t.height, e);
|
|
@@ -706,33 +706,33 @@ class At extends I {
|
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
708
|
const xt = { As: 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]), be: 6, Ce: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
|
|
709
|
-
class
|
|
709
|
+
class Et extends _ {
|
|
710
710
|
constructor(t, e) {
|
|
711
|
-
super(t, e,
|
|
711
|
+
super(t, e, y.LINE, xt);
|
|
712
712
|
}
|
|
713
713
|
Fe(t, e) {
|
|
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,
|
|
715
|
-
return this.$s(
|
|
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, u = c, f = this.ws(l, u, r, n, e);
|
|
715
|
+
return this.$s(f, o, c), this.ps.Fe(f);
|
|
716
716
|
}
|
|
717
717
|
}
|
|
718
|
-
const
|
|
718
|
+
const yt = { As: function(a = 32) {
|
|
719
719
|
const t = [], e = 2 * Math.PI / a;
|
|
720
720
|
for (let i = 0; i < a; i++) {
|
|
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),
|
|
722
|
-
t.push(0, 0, 0.5, 0.5, n, o, c, l,
|
|
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), u = Math.cos(r), f = Math.sin(r), g = 0.5 * (u + 1), v = 0.5 * (f + 1);
|
|
722
|
+
t.push(0, 0, 0.5, 0.5, n, o, c, l, u, f, g, v);
|
|
723
723
|
}
|
|
724
724
|
return new Float32Array(t);
|
|
725
725
|
}(32), be: 96, Ce: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
|
|
726
|
-
class wt extends
|
|
726
|
+
class wt extends _ {
|
|
727
727
|
constructor(t, e) {
|
|
728
|
-
super(t, e,
|
|
728
|
+
super(t, e, y.ELLIPSE, yt);
|
|
729
729
|
}
|
|
730
730
|
Fe(t, e) {
|
|
731
731
|
const i = this.ws(t.x, t.y, t.width, t.height, e);
|
|
732
732
|
return this.$s(i, t.x, t.y), this.ps.Fe(i);
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
|
-
let
|
|
735
|
+
let bt = { As: 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,9 +740,9 @@ let Rt = { As: function(a) {
|
|
|
740
740
|
}
|
|
741
741
|
return new Float32Array(t);
|
|
742
742
|
}(32), be: 96, Ce: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
|
|
743
|
-
class
|
|
743
|
+
class Rt extends _ {
|
|
744
744
|
constructor(t, e) {
|
|
745
|
-
super(t, e,
|
|
745
|
+
super(t, e, y.ARC, bt);
|
|
746
746
|
}
|
|
747
747
|
Fe(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.ws(i, s, t.width, t.height, e);
|
|
@@ -750,13 +750,13 @@ class bt extends I {
|
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
752
|
const Tt = { As: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), be: 3, Ce: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
|
|
753
|
-
class Ct extends
|
|
753
|
+
class Ct extends _ {
|
|
754
754
|
constructor(t, e) {
|
|
755
|
-
super(t, e,
|
|
755
|
+
super(t, e, y.TRIANGLE, Tt);
|
|
756
756
|
}
|
|
757
757
|
Fe(t, e) {
|
|
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.ws(i, r, n, o, e), l = i + 0.5 * n,
|
|
759
|
-
return this.$s(c, l,
|
|
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.ws(i, r, n, o, e), l = i + 0.5 * n, u = r + o * (1 / 3);
|
|
759
|
+
return this.$s(c, l, u), this.ps.Fe(c);
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
762
|
function et(a, t, e, i, s) {
|
|
@@ -771,16 +771,16 @@ const Ut = { As: function(a = 16) {
|
|
|
771
771
|
}
|
|
772
772
|
return new Float32Array(t);
|
|
773
773
|
}(16), be: 96, Ce: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
|
|
774
|
-
class Ft extends
|
|
774
|
+
class Ft extends _ {
|
|
775
775
|
constructor(t, e) {
|
|
776
|
-
super(t, e,
|
|
776
|
+
super(t, e, y.BEZIER_CURVE, Ut);
|
|
777
777
|
}
|
|
778
778
|
Fe(t, e) {
|
|
779
779
|
const i = e.I || 1, s = et(0.5, t.x1, t.cp1x, t.cp2x, t.x2), r = et(0.5, t.y1, t.cp1y, t.cp2y, t.y2), n = this.ws(0, 0, 1, i, e);
|
|
780
780
|
return this.$s(n, s, r), n.qe = [t.x1, t.y1], n.je = [t.cp1x, t.cp1y], n.Ye = [t.cp2x, t.cp2y], n.Ze = [t.x2, t.y2], this.ps.Fe(n);
|
|
781
781
|
}
|
|
782
782
|
}
|
|
783
|
-
class
|
|
783
|
+
class Bt {
|
|
784
784
|
constructor(t) {
|
|
785
785
|
h(this, "vt");
|
|
786
786
|
h(this, "Ms", null);
|
|
@@ -792,16 +792,16 @@ class St {
|
|
|
792
792
|
h(this, "Ss");
|
|
793
793
|
h(this, "Es");
|
|
794
794
|
h(this, "Bs");
|
|
795
|
-
h(this, "
|
|
795
|
+
h(this, "k", []);
|
|
796
796
|
this.vt = t, this.Fs = new ft(t), this.Bs = new at(), this.Ss = new gt(t, this), this.Es = new pt(), this.Ps = t.createBuffer(), H(this.vt, [0, 0, this.vt.canvas.width, this.vt.canvas.height]);
|
|
797
797
|
}
|
|
798
|
-
|
|
798
|
+
Ds(t) {
|
|
799
799
|
let e = this.Ts.get(t);
|
|
800
800
|
if (e) return e;
|
|
801
801
|
const i = new mt(this.vt);
|
|
802
|
-
return e = (0, { [
|
|
802
|
+
return e = (0, { [y.RECTANGLE]: () => new At(this.vt, i), [y.LINE]: () => new Et(this.vt, i), [y.ELLIPSE]: () => new wt(this.vt, i), [y.ARC]: () => new Rt(this.vt, i), [y.TRIANGLE]: () => new Ct(this.vt, i), [y.BEZIER_CURVE]: () => new Ft(this.vt, i) }[t])(), this.Ts.set(t, e), e;
|
|
803
803
|
}
|
|
804
|
-
|
|
804
|
+
Gs(t) {
|
|
805
805
|
this.Ms !== t && (this.Ms = t, t.Xt());
|
|
806
806
|
}
|
|
807
807
|
ae(t, e) {
|
|
@@ -825,56 +825,56 @@ class St {
|
|
|
825
825
|
Kt(t, e) {
|
|
826
826
|
this.zs[t] = e;
|
|
827
827
|
}
|
|
828
|
-
|
|
828
|
+
Os(t) {
|
|
829
829
|
Object.assign(this.zs, t);
|
|
830
830
|
}
|
|
831
831
|
oe(t) {
|
|
832
832
|
return this.Fs.oe(t);
|
|
833
833
|
}
|
|
834
|
-
|
|
834
|
+
ks(t, e, i, s, r) {
|
|
835
835
|
const n = this.ie(), 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.Es.
|
|
836
|
+
this.Es.Ge(e, i, s, r, n, o, this.Bs);
|
|
837
837
|
}
|
|
838
838
|
Hs(t, e, i, s, r) {
|
|
839
|
-
const n = this.ne(), o = t.
|
|
840
|
-
this.Es.
|
|
839
|
+
const n = this.ne(), o = t.Is(), 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.Es.Ge(e, i, s, r, n, c, this.Bs);
|
|
841
841
|
}
|
|
842
|
-
|
|
842
|
+
Ns(t, e, i, s) {
|
|
843
843
|
var d;
|
|
844
|
-
const r = this.vt, n = r.canvas.width, o = r.canvas.height, c = t / n * 2 - 1, l = (t + i) / n * 2 - 1,
|
|
844
|
+
const r = this.vt, n = r.canvas.width, o = r.canvas.height, c = t / n * 2 - 1, l = (t + i) / n * 2 - 1, u = 1 - e / o * 2, f = 1 - (e + s) / o * 2, g = new Float32Array([c, f, l, f, c, u, l, f, l, u, c, u]);
|
|
845
845
|
r.bindBuffer(r.ARRAY_BUFFER, this.Ps), r.bufferData(r.ARRAY_BUFFER, g, r.DYNAMIC_DRAW);
|
|
846
846
|
const v = ((d = this.Ms) == null ? void 0 : d.Qt) || r.getParameter(r.CURRENT_PROGRAM), m = v ? r.getAttribLocation(v, "a_position") : -1;
|
|
847
847
|
m !== -1 && (r.enableVertexAttribArray(m), r.vertexAttribPointer(m, 2, r.FLOAT, !1, 8, 0)), r.drawArrays(r.TRIANGLES, 0, 6), m !== -1 && r.disableVertexAttribArray(m);
|
|
848
848
|
}
|
|
849
|
-
Ns(t, e, i, s) {
|
|
850
|
-
this.Rs ? (this.Es.De(t, e, i, s, this.Rs, { ...this.zs }, this.Bs), this.Rs = null, this.zs = {}) : this.Es.Ge(t, e, i, s, this.Bs);
|
|
851
|
-
}
|
|
852
849
|
Xs(t, e, i, s) {
|
|
853
|
-
this.Es.
|
|
850
|
+
this.Rs ? (this.Es.Ge(t, e, i, s, this.Rs, { ...this.zs }, this.Bs), this.Rs = null, this.zs = {}) : this.Es.De(t, e, i, s, this.Bs);
|
|
854
851
|
}
|
|
855
852
|
Ws(t, e, i, s) {
|
|
856
|
-
this.Es.
|
|
853
|
+
this.Es.Le(t, e, i, s, this.Bs.lineWeight, this.Bs);
|
|
857
854
|
}
|
|
858
|
-
Vs(t, e, i, s
|
|
855
|
+
Vs(t, e, i, s) {
|
|
856
|
+
this.Es.Oe(t, e, i, s, this.Bs);
|
|
857
|
+
}
|
|
858
|
+
Ks(t, e, i, s, r, n) {
|
|
859
859
|
this.Es.He(t, e, i, s, r, n, this.Bs);
|
|
860
860
|
}
|
|
861
|
-
|
|
861
|
+
js(t, e, i, s, r, n, o, c) {
|
|
862
862
|
const l = this.Bs.lineWeight;
|
|
863
863
|
this.Es.Ie(t, e, i, s, r, n, o, c, l, this.Bs);
|
|
864
864
|
}
|
|
865
|
-
|
|
865
|
+
Ys(t, e, i = 1, s = {}) {
|
|
866
866
|
return new q(this.vt, t, e, i, s, this, !0);
|
|
867
867
|
}
|
|
868
|
-
|
|
869
|
-
this.Es.
|
|
868
|
+
qs(t, e, i, s, r, n) {
|
|
869
|
+
this.Es.ke(t, e, i, s, r, n, this.Bs);
|
|
870
870
|
}
|
|
871
|
-
|
|
871
|
+
Zs(t, e = t, i = t, s = 255) {
|
|
872
872
|
this.state.ft(t, e, i, s), this.Ne(t / 255, e / 255, i / 255, s / 255);
|
|
873
873
|
}
|
|
874
874
|
Ne(t = 0, e = 0, i = 0, s = 0) {
|
|
875
875
|
this.vt.clearColor(t, e, i, s), this.vt.clear(this.vt.COLOR_BUFFER_BIT);
|
|
876
876
|
}
|
|
877
|
-
|
|
877
|
+
Qs() {
|
|
878
878
|
this.vt.viewport(0, 0, this.vt.canvas.width, this.vt.canvas.height), H(this.vt, [0, 0, this.vt.canvas.width, this.vt.canvas.height]);
|
|
879
879
|
}
|
|
880
880
|
get context() {
|
|
@@ -884,24 +884,24 @@ class St {
|
|
|
884
884
|
return this.Bs;
|
|
885
885
|
}
|
|
886
886
|
Et(t) {
|
|
887
|
-
this.
|
|
887
|
+
this.k.push(this.Bs), this.Bs = t;
|
|
888
888
|
}
|
|
889
889
|
Bt() {
|
|
890
|
-
const t = this.
|
|
890
|
+
const t = this.k.pop();
|
|
891
891
|
t && (this.Bs = t);
|
|
892
892
|
}
|
|
893
893
|
St(t) {
|
|
894
894
|
const e = t, i = k(this.vt) ?? this.vt.getParameter(this.vt.VIEWPORT), s = { shader: e, gl: this.vt, viewport: i };
|
|
895
|
-
this.
|
|
895
|
+
this.Gs(e);
|
|
896
896
|
const r = /* @__PURE__ */ new Set();
|
|
897
|
-
for (const n of this.Es) n.type ===
|
|
898
|
-
for (const n of r) n !==
|
|
897
|
+
for (const n of this.Es) n.type === y.CUSTOM ? r.add(y.RECTANGLE) : r.add(n.type);
|
|
898
|
+
for (const n of r) n !== y.CUSTOM && this.Ds(n);
|
|
899
899
|
this.Ss.ve(s, this.Es, this.Ts), this.Es.Ne();
|
|
900
900
|
}
|
|
901
|
-
|
|
901
|
+
Dt() {
|
|
902
902
|
this.vt.deleteBuffer(this.Ps), this.Es.Ne();
|
|
903
|
-
for (const t of this.Ts.values()) t.
|
|
904
|
-
this.Fs.
|
|
903
|
+
for (const t of this.Ts.values()) t.Dt();
|
|
904
|
+
this.Fs.Dt(), this.Ss.Dt();
|
|
905
905
|
}
|
|
906
906
|
}
|
|
907
907
|
const w = { readShort: (a, t) => (w.t.uint16[0] = a[t] << 8 | a[t + 1], w.t.int16[0]), readUshort: (a, t) => a[t] << 8 | a[t + 1], readUshorts(a, t, e) {
|
|
@@ -925,7 +925,7 @@ const w = { readShort: (a, t) => (w.t.uint16[0] = a[t] << 8 | a[t + 1], w.t.int1
|
|
|
925
925
|
const a = new ArrayBuffer(8);
|
|
926
926
|
return { uint8: new Uint8Array(a), int16: new Int16Array(a), uint16: new Uint16Array(a), uint32: new Uint32Array(a) };
|
|
927
927
|
})() };
|
|
928
|
-
function
|
|
928
|
+
function X(a) {
|
|
929
929
|
return a + 3 & -4;
|
|
930
930
|
}
|
|
931
931
|
function V(a, t, e) {
|
|
@@ -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 Lt {
|
|
939
939
|
constructor(t) {
|
|
940
940
|
h(this, "b");
|
|
941
941
|
h(this, "p", 0);
|
|
@@ -958,7 +958,7 @@ class Bt {
|
|
|
958
958
|
return this.p;
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
|
-
function
|
|
961
|
+
function N(a) {
|
|
962
962
|
let t = 32, e = 0;
|
|
963
963
|
for (const o of a) o && (o < t && (t = o), o > e && (e = o));
|
|
964
964
|
if (e === 0) return { min: 0, max: 0, table: /* @__PURE__ */ new Map() };
|
|
@@ -973,8 +973,8 @@ function G(a) {
|
|
|
973
973
|
const c = a[o];
|
|
974
974
|
if (!c) continue;
|
|
975
975
|
const l = s[c]++;
|
|
976
|
-
let
|
|
977
|
-
|
|
976
|
+
let u = n.get(c);
|
|
977
|
+
u || (u = [], n.set(c, u)), u[Pt(l, c)] = o;
|
|
978
978
|
}
|
|
979
979
|
return { min: t, max: e, table: n };
|
|
980
980
|
}
|
|
@@ -995,7 +995,7 @@ function Pt(a, t) {
|
|
|
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 St(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");
|
|
@@ -1004,10 +1004,10 @@ function Lt(a) {
|
|
|
1004
1004
|
32 & e && (i += 4);
|
|
1005
1005
|
const s = [];
|
|
1006
1006
|
return function(r, n) {
|
|
1007
|
-
const o = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258], c = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], l = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577],
|
|
1008
|
-
let
|
|
1009
|
-
for (; !
|
|
1010
|
-
|
|
1007
|
+
const o = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258], c = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], l = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577], u = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13];
|
|
1008
|
+
let f = 0;
|
|
1009
|
+
for (; !f; ) {
|
|
1010
|
+
f = r.readBits(1);
|
|
1011
1011
|
const g = r.readBits(2);
|
|
1012
1012
|
if (g === 0) {
|
|
1013
1013
|
r.alignToByte();
|
|
@@ -1024,30 +1024,30 @@ function Lt(a) {
|
|
|
1024
1024
|
for (let A = 144; A <= 255; A++) d[A] = 9;
|
|
1025
1025
|
for (let A = 256; A <= 279; A++) d[A] = 7;
|
|
1026
1026
|
for (let A = 280; A <= 287; A++) d[A] = 8;
|
|
1027
|
-
v =
|
|
1027
|
+
v = N(d), m = N(Array(32).fill(5));
|
|
1028
1028
|
} else {
|
|
1029
|
-
const d = r.readBits(5) + 257, A = r.readBits(5) + 1, p = r.readBits(4) + 4,
|
|
1030
|
-
for (let F = 0; F < p; F++) x[
|
|
1031
|
-
const C =
|
|
1032
|
-
for (;
|
|
1029
|
+
const d = r.readBits(5) + 257, A = r.readBits(5) + 1, p = r.readBits(4) + 4, E = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], x = Array(19).fill(0);
|
|
1030
|
+
for (let F = 0; F < p; F++) x[E[F]] = r.readBits(3);
|
|
1031
|
+
const C = N(x), b = [];
|
|
1032
|
+
for (; b.length < d + A; ) {
|
|
1033
1033
|
const F = j(r, C);
|
|
1034
|
-
if (F <= 15)
|
|
1034
|
+
if (F <= 15) b.push(F);
|
|
1035
1035
|
else if (F === 16) {
|
|
1036
|
-
const O = r.readBits(2) + 3,
|
|
1037
|
-
for (let tt = 0; tt < O; tt++)
|
|
1036
|
+
const O = r.readBits(2) + 3, S = b[b.length - 1] || 0;
|
|
1037
|
+
for (let tt = 0; tt < O; tt++) b.push(S);
|
|
1038
1038
|
} else if (F === 17) {
|
|
1039
1039
|
const O = r.readBits(3) + 3;
|
|
1040
|
-
for (let
|
|
1040
|
+
for (let S = 0; S < O; S++) b.push(0);
|
|
1041
1041
|
} else {
|
|
1042
1042
|
if (F !== 18) throw Error("Invalid code length symbol");
|
|
1043
1043
|
{
|
|
1044
1044
|
const O = r.readBits(7) + 11;
|
|
1045
|
-
for (let
|
|
1045
|
+
for (let S = 0; S < O; S++) b.push(0);
|
|
1046
1046
|
}
|
|
1047
1047
|
}
|
|
1048
1048
|
}
|
|
1049
|
-
const
|
|
1050
|
-
v =
|
|
1049
|
+
const R = b.slice(0, d), B = b.slice(d, d + A);
|
|
1050
|
+
v = N(R), m = N(B);
|
|
1051
1051
|
}
|
|
1052
1052
|
for (; ; ) {
|
|
1053
1053
|
const d = j(r, v);
|
|
@@ -1057,98 +1057,98 @@ function Lt(a) {
|
|
|
1057
1057
|
if (d > 256 && d < 286) {
|
|
1058
1058
|
const A = d - 257;
|
|
1059
1059
|
let p = o[A];
|
|
1060
|
-
const
|
|
1061
|
-
|
|
1060
|
+
const E = c[A];
|
|
1061
|
+
E && (p += r.readBits(E));
|
|
1062
1062
|
const x = j(r, m);
|
|
1063
1063
|
if (x >= 30) throw Error("Invalid distance symbol");
|
|
1064
1064
|
let C = l[x];
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1067
|
-
const
|
|
1068
|
-
if (
|
|
1069
|
-
for (let
|
|
1065
|
+
const b = u[x];
|
|
1066
|
+
b && (C += r.readBits(b));
|
|
1067
|
+
const R = n.length - C;
|
|
1068
|
+
if (R < 0) throw Error("Invalid distance");
|
|
1069
|
+
for (let B = 0; B < p; B++) n.push(n[R + B] || 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 Lt(a.subarray(i)), s), new Uint8Array(s);
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function Dt(a) {
|
|
1079
1079
|
const t = w, e = new Uint8Array(a);
|
|
1080
1080
|
if (t.readASCII(e, 0, 4) !== "wOFF") throw Error("Invalid WOFF signature");
|
|
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 p = 0; p < s; p++) {
|
|
1084
|
-
const
|
|
1085
|
-
n.push({ tag:
|
|
1084
|
+
const E = t.readASCII(e, o, 4), x = t.readUint(e, o + 4), C = t.readUint(e, o + 8), b = t.readUint(e, o + 12), R = t.readUint(e, o + 16);
|
|
1085
|
+
n.push({ tag: E, offset: x, compLength: C, origLength: b, checksum: R }), o += 20;
|
|
1086
1086
|
}
|
|
1087
1087
|
for (const p of n) {
|
|
1088
|
-
const
|
|
1089
|
-
if (p.compLength === p.origLength) p.data = new Uint8Array(
|
|
1090
|
-
else if (p.data =
|
|
1088
|
+
const E = new Uint8Array(e.buffer, p.offset, p.compLength);
|
|
1089
|
+
if (p.compLength === p.origLength) p.data = new Uint8Array(E);
|
|
1090
|
+
else if (p.data = St(E), p.data.length !== p.origLength) if (p.data.length < p.origLength) {
|
|
1091
1091
|
const x = new Uint8Array(p.origLength);
|
|
1092
1092
|
x.set(p.data), p.data = x;
|
|
1093
1093
|
} else p.data = p.data.subarray(0, p.origLength);
|
|
1094
1094
|
}
|
|
1095
1095
|
const c = s;
|
|
1096
|
-
let l = 1,
|
|
1097
|
-
for (; l << 1 <= c; ) l <<= 1,
|
|
1098
|
-
const
|
|
1096
|
+
let l = 1, u = 0;
|
|
1097
|
+
for (; l << 1 <= c; ) l <<= 1, u++;
|
|
1098
|
+
const f = 16 * l, g = 16 * c - f;
|
|
1099
1099
|
let v = 12 + 16 * c;
|
|
1100
1100
|
const m = {};
|
|
1101
|
-
for (const p of n) m[p.tag] = v, v =
|
|
1101
|
+
for (const p of n) m[p.tag] = v, v = X(v + p.data.length);
|
|
1102
1102
|
const d = new Uint8Array(Math.max(r || 0, v));
|
|
1103
|
-
t.writeUint(d, 0, i), t.writeUshort(d, 4, c), t.writeUshort(d, 6,
|
|
1103
|
+
t.writeUint(d, 0, i), t.writeUshort(d, 4, c), t.writeUshort(d, 6, f), t.writeUshort(d, 8, u), t.writeUshort(d, 10, g);
|
|
1104
1104
|
let A = 12;
|
|
1105
1105
|
for (const p of n) {
|
|
1106
1106
|
t.writeASCII(d, A, p.tag), A += 4;
|
|
1107
|
-
let
|
|
1108
|
-
if (p.tag === "head" &&
|
|
1109
|
-
const x = new Uint8Array(
|
|
1107
|
+
let E = p.data;
|
|
1108
|
+
if (p.tag === "head" && E.length >= 12) {
|
|
1109
|
+
const x = new Uint8Array(E);
|
|
1110
1110
|
t.writeUint(x, 8, 0);
|
|
1111
|
-
const C = V(x, 0,
|
|
1111
|
+
const C = V(x, 0, X(x.length));
|
|
1112
1112
|
t.writeUint(d, A, C), A += 4;
|
|
1113
1113
|
} else {
|
|
1114
|
-
const x = V(
|
|
1114
|
+
const x = V(E, 0, X(E.length));
|
|
1115
1115
|
t.writeUint(d, A, x), A += 4;
|
|
1116
1116
|
}
|
|
1117
1117
|
t.writeUint(d, A, m[p.tag]), A += 4, t.writeUint(d, A, p.data.length), A += 4;
|
|
1118
1118
|
}
|
|
1119
1119
|
for (const p of n) {
|
|
1120
|
-
const
|
|
1121
|
-
d.set(p.data,
|
|
1120
|
+
const E = m[p.tag];
|
|
1121
|
+
d.set(p.data, E);
|
|
1122
1122
|
}
|
|
1123
1123
|
if (n.find((p) => p.tag === "head")) {
|
|
1124
|
-
const p = m.head,
|
|
1125
|
-
const
|
|
1126
|
-
|
|
1127
|
-
const F = 2981146554 - (V(x, 0,
|
|
1128
|
-
return x[
|
|
1124
|
+
const p = m.head, E = function(x, C) {
|
|
1125
|
+
const b = w, R = C + 8, B = [x[R], x[R + 1], x[R + 2], x[R + 3]];
|
|
1126
|
+
b.writeUint(x, R, 0);
|
|
1127
|
+
const F = 2981146554 - (V(x, 0, X(x.length)) >>> 0) >>> 0;
|
|
1128
|
+
return x[R] = B[0], x[R + 1] = B[1], x[R + 2] = B[2], x[R + 3] = B[3], F >>> 0;
|
|
1129
1129
|
}(d, p);
|
|
1130
|
-
t.writeUint(d, p + 8,
|
|
1130
|
+
t.writeUint(d, p + 8, E);
|
|
1131
1131
|
}
|
|
1132
1132
|
return d.buffer;
|
|
1133
1133
|
}
|
|
1134
|
-
const
|
|
1134
|
+
const Mt = { 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);
|
|
1138
1138
|
t += 2;
|
|
1139
1139
|
const o = [];
|
|
1140
1140
|
for (let c = 0; c < n; c++) {
|
|
1141
|
-
const l = r(a, t),
|
|
1141
|
+
const l = r(a, t), u = r(a, t += 2);
|
|
1142
1142
|
t += 2;
|
|
1143
|
-
const
|
|
1143
|
+
const f = s.readUint(a, t);
|
|
1144
1144
|
t += 4;
|
|
1145
|
-
const g = `p${l}e${
|
|
1146
|
-
let v = o.indexOf(
|
|
1145
|
+
const g = `p${l}e${u}`;
|
|
1146
|
+
let v = o.indexOf(f);
|
|
1147
1147
|
if (v === -1) {
|
|
1148
1148
|
let m;
|
|
1149
|
-
v = i.tables.length, o.push(
|
|
1150
|
-
const d = r(a,
|
|
1151
|
-
m = d === 4 ? this.parse4(a,
|
|
1149
|
+
v = i.tables.length, o.push(f);
|
|
1150
|
+
const d = r(a, f);
|
|
1151
|
+
m = d === 4 ? this.parse4(a, f) : d === 12 ? this.parse12(a, f) : { format: d }, i.tables.push(m);
|
|
1152
1152
|
}
|
|
1153
1153
|
i.ids[g] = v;
|
|
1154
1154
|
}
|
|
@@ -1168,7 +1168,7 @@ const Dt = { parseTab(a, t, e) {
|
|
|
1168
1168
|
const s = new Uint32Array(3 * i);
|
|
1169
1169
|
for (let r = 0; r < 3 * i; r += 3) s[r] = e(a, t + (r << 2)), s[r + 1] = e(a, t + (r << 2) + 4), s[r + 2] = e(a, t + (r << 2) + 8);
|
|
1170
1170
|
return { format: 12, groups: s };
|
|
1171
|
-
} },
|
|
1171
|
+
} }, It = { parseTab(a, t, e) {
|
|
1172
1172
|
const i = w;
|
|
1173
1173
|
t += 18;
|
|
1174
1174
|
const s = i.readUshort(a, t);
|
|
@@ -1181,7 +1181,7 @@ const Dt = { 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 = {};
|
|
@@ -1192,11 +1192,11 @@ const Dt = { parseTab(a, t, e) {
|
|
|
1192
1192
|
return r;
|
|
1193
1193
|
} }, Ot = { parseTab(a, t, e, i) {
|
|
1194
1194
|
const s = w, r = [], n = [], o = i.maxp.numGlyphs, c = i.hhea.numberOfHMetrics;
|
|
1195
|
-
let l = 0,
|
|
1196
|
-
for (;
|
|
1197
|
-
for (;
|
|
1195
|
+
let l = 0, u = 0, f = 0;
|
|
1196
|
+
for (; f < c; ) l = s.readUshort(a, t + (f << 2)), u = s.readShort(a, t + (f << 2) + 2), r.push(l), n.push(u), f++;
|
|
1197
|
+
for (; f < o; ) r.push(l), n.push(u), f++;
|
|
1198
1198
|
return { aWidth: r, lsBearing: n };
|
|
1199
|
-
} }, it = { cmap:
|
|
1199
|
+
} }, it = { cmap: Mt, head: It, 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
1202
|
} }, hmtx: Ot, loca: { parseTab(a, t, e, i) {
|
|
@@ -1208,10 +1208,10 @@ const Dt = { parseTab(a, t, e) {
|
|
|
1208
1208
|
const s = [], r = i.maxp.numGlyphs;
|
|
1209
1209
|
for (let n = 0; n < r; n++) s.push(null);
|
|
1210
1210
|
return s;
|
|
1211
|
-
},
|
|
1212
|
-
const e = w, i = a.
|
|
1211
|
+
}, Js(a, t) {
|
|
1212
|
+
const e = w, i = a.ti, s = a.loca;
|
|
1213
1213
|
if (s[t] === s[t + 1]) return null;
|
|
1214
|
-
const r =
|
|
1214
|
+
const r = L.findTable(i, "glyf", a.ei);
|
|
1215
1215
|
if (!r) return null;
|
|
1216
1216
|
let n = r[0] + s[t];
|
|
1217
1217
|
const o = {};
|
|
@@ -1242,22 +1242,22 @@ const Dt = { parseTab(a, t, e) {
|
|
|
1242
1242
|
const v = o.flags[g], m = !!(32 & v);
|
|
1243
1243
|
4 & v ? (o.ys.push(m ? i[n] : -i[n]), n++) : m ? o.ys.push(0) : (o.ys.push(e.readShort(i, n)), n += 2);
|
|
1244
1244
|
}
|
|
1245
|
-
let
|
|
1246
|
-
for (let g = 0; g < l; g++)
|
|
1245
|
+
let u = 0, f = 0;
|
|
1246
|
+
for (let g = 0; g < l; g++) u += o.xs[g], f += o.ys[g], o.xs[g] = u, o.ys[g] = f;
|
|
1247
1247
|
} else o.parts = [], o.endPts = [], o.flags = [], o.xs = [], o.ys = [];
|
|
1248
1248
|
return o;
|
|
1249
|
-
} } },
|
|
1249
|
+
} } }, L = { parse(a) {
|
|
1250
1250
|
const t = new Uint8Array(a), e = w.readASCII(t, 0, 4);
|
|
1251
|
-
if (e === "wOFF") a =
|
|
1251
|
+
if (e === "wOFF") a = Dt(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
|
-
const o = it, c = {
|
|
1254
|
+
const o = it, c = { ti: i, si: s, ei: r };
|
|
1255
1255
|
for (const l in o) {
|
|
1256
|
-
const
|
|
1257
|
-
if (
|
|
1258
|
-
const [g, v] =
|
|
1256
|
+
const u = l, f = L.findTable(i, u, r);
|
|
1257
|
+
if (f) {
|
|
1258
|
+
const [g, v] = f;
|
|
1259
1259
|
let m = n[g];
|
|
1260
|
-
m == null && (m = o[
|
|
1260
|
+
m == null && (m = o[u].parseTab(i, g, v, c), n[g] = m), c[u] = m;
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
1263
|
return c;
|
|
@@ -1274,31 +1274,31 @@ const Dt = { parseTab(a, t, e) {
|
|
|
1274
1274
|
}
|
|
1275
1275
|
return null;
|
|
1276
1276
|
}, T: it, B: w };
|
|
1277
|
-
class
|
|
1278
|
-
|
|
1277
|
+
class Nt {
|
|
1278
|
+
ii(t) {
|
|
1279
1279
|
var i;
|
|
1280
1280
|
const e = [];
|
|
1281
1281
|
return (i = t.cmap) != null && i.tables ? (t.cmap.tables.forEach((s) => {
|
|
1282
1282
|
if (s.format === 4) {
|
|
1283
|
-
const r = this.
|
|
1283
|
+
const r = this.ri(s);
|
|
1284
1284
|
e.push(...r);
|
|
1285
1285
|
} else if (s.format === 12) {
|
|
1286
|
-
const r = this.
|
|
1286
|
+
const r = this.ni(s);
|
|
1287
1287
|
e.push(...r);
|
|
1288
1288
|
}
|
|
1289
1289
|
}), [...new Set(e)]) : [];
|
|
1290
1290
|
}
|
|
1291
|
-
|
|
1292
|
-
return t.filter((e) => this.
|
|
1291
|
+
oi(t) {
|
|
1292
|
+
return t.filter((e) => this.ai(e));
|
|
1293
1293
|
}
|
|
1294
|
-
|
|
1294
|
+
ri(t) {
|
|
1295
1295
|
const e = [];
|
|
1296
1296
|
if (!(t.startCount && t.endCount && t.idRangeOffset && t.idDelta)) return e;
|
|
1297
1297
|
for (let i = 0; i < t.startCount.length; i++) {
|
|
1298
1298
|
const s = t.startCount[i], r = t.endCount[i];
|
|
1299
1299
|
if (s !== 65535 || r !== 65535) {
|
|
1300
1300
|
for (let n = s; n <= r; n++)
|
|
1301
|
-
if (this.
|
|
1301
|
+
if (this.hi(t, n, i) > 0) try {
|
|
1302
1302
|
const o = String.fromCodePoint(n);
|
|
1303
1303
|
e.push(o);
|
|
1304
1304
|
} catch {
|
|
@@ -1307,7 +1307,7 @@ class Gt {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
return e;
|
|
1309
1309
|
}
|
|
1310
|
-
|
|
1310
|
+
ni(t) {
|
|
1311
1311
|
const e = [];
|
|
1312
1312
|
if (!t.groups) return e;
|
|
1313
1313
|
for (let i = 0; i < t.groups.length; i += 3) {
|
|
@@ -1321,7 +1321,7 @@ class Gt {
|
|
|
1321
1321
|
}
|
|
1322
1322
|
return e;
|
|
1323
1323
|
}
|
|
1324
|
-
|
|
1324
|
+
hi(t, e, i) {
|
|
1325
1325
|
if (t.idRangeOffset[i] === 0) return e + t.idDelta[i] & 65535;
|
|
1326
1326
|
{
|
|
1327
1327
|
const s = t.idRangeOffset[i] / 2 + (e - t.startCount[i]) - (t.startCount.length - i);
|
|
@@ -1332,44 +1332,44 @@ class Gt {
|
|
|
1332
1332
|
}
|
|
1333
1333
|
return 0;
|
|
1334
1334
|
}
|
|
1335
|
-
|
|
1335
|
+
ai(t) {
|
|
1336
1336
|
const e = t.codePointAt(0) || 0;
|
|
1337
1337
|
return !(e >= 0 && e <= 31 && e !== 9 && e !== 10 && e !== 13 || e >= 127 && e <= 159);
|
|
1338
1338
|
}
|
|
1339
1339
|
}
|
|
1340
1340
|
class Z {
|
|
1341
1341
|
constructor() {
|
|
1342
|
-
h(this, "hi", /* @__PURE__ */ new Map());
|
|
1343
1342
|
h(this, "ci", /* @__PURE__ */ new Map());
|
|
1343
|
+
h(this, "li", /* @__PURE__ */ new Map());
|
|
1344
1344
|
}
|
|
1345
|
-
|
|
1346
|
-
const i = `${this.
|
|
1347
|
-
if (this.
|
|
1345
|
+
ui(t, e) {
|
|
1346
|
+
const i = `${this.fi(t)}_${e}`;
|
|
1347
|
+
if (this.ci.has(i)) return this.ci.get(i);
|
|
1348
1348
|
const s = t.cmap;
|
|
1349
|
-
if (!s || !s.tables) return this.
|
|
1349
|
+
if (!s || !s.tables) return this.ci.set(i, 0), 0;
|
|
1350
1350
|
let r = 0;
|
|
1351
|
-
for (const n of s.tables) if (n.format === 4 ? r = this.
|
|
1352
|
-
return this.
|
|
1351
|
+
for (const n of s.tables) if (n.format === 4 ? r = this.di(e, n) : n.format === 12 && (r = this.pi(e, n)), r > 0) break;
|
|
1352
|
+
return this.ci.set(i, r), r;
|
|
1353
1353
|
}
|
|
1354
|
-
|
|
1354
|
+
mi(t, e) {
|
|
1355
1355
|
const i = e.codePointAt(0);
|
|
1356
|
-
return i === void 0 ? 0 : this.
|
|
1356
|
+
return i === void 0 ? 0 : this.ui(t, i);
|
|
1357
1357
|
}
|
|
1358
|
-
|
|
1358
|
+
gi(t, e) {
|
|
1359
1359
|
const i = t.hmtx;
|
|
1360
1360
|
return i && i.aWidth && i.aWidth.length !== 0 ? e < i.aWidth.length ? i.aWidth[e] : i.aWidth[i.aWidth.length - 1] : 0;
|
|
1361
1361
|
}
|
|
1362
|
-
|
|
1362
|
+
_i(t, e) {
|
|
1363
1363
|
const i = e / t.head.unitsPerEm, s = t.hhea.ascender * i, r = t.hhea.descender * i, n = t.hhea.lineGap * i;
|
|
1364
1364
|
return { ascender: s, descender: r, lineGap: n, lineHeight: s - r + n, unitsPerEm: t.head.unitsPerEm, scale: i };
|
|
1365
1365
|
}
|
|
1366
|
-
|
|
1367
|
-
this.
|
|
1366
|
+
yi() {
|
|
1367
|
+
this.ci.clear(), this.li.clear();
|
|
1368
1368
|
}
|
|
1369
|
-
|
|
1370
|
-
return `${t.
|
|
1369
|
+
fi(t) {
|
|
1370
|
+
return `${t.ei}_${t.ti.length}`;
|
|
1371
1371
|
}
|
|
1372
|
-
|
|
1372
|
+
di(t, e) {
|
|
1373
1373
|
const i = e.endCount.length;
|
|
1374
1374
|
let s = -1;
|
|
1375
1375
|
for (let r = 0; r < i; r++) if (t <= e.endCount[r]) {
|
|
@@ -1387,7 +1387,7 @@ class Z {
|
|
|
1387
1387
|
}
|
|
1388
1388
|
return 0;
|
|
1389
1389
|
}
|
|
1390
|
-
|
|
1390
|
+
pi(t, e) {
|
|
1391
1391
|
const i = e.groups.length / 3;
|
|
1392
1392
|
for (let s = 0; s < i; s++) {
|
|
1393
1393
|
const r = e.groups[3 * s], n = e.groups[3 * s + 1], o = e.groups[3 * s + 2];
|
|
@@ -1396,147 +1396,147 @@ class Z {
|
|
|
1396
1396
|
return 0;
|
|
1397
1397
|
}
|
|
1398
1398
|
}
|
|
1399
|
-
class
|
|
1399
|
+
class Gt {
|
|
1400
1400
|
constructor(t) {
|
|
1401
|
-
h(this, "yi");
|
|
1402
1401
|
h(this, "Ai");
|
|
1403
|
-
h(this, "xt");
|
|
1404
1402
|
h(this, "wi");
|
|
1405
|
-
|
|
1403
|
+
h(this, "xt");
|
|
1404
|
+
h(this, "Ci");
|
|
1405
|
+
this.xt = t, this.Ci = new Z(), this.Ai = document.createElement("canvas"), this.wi = this.Ai.getContext("2d", { willReadFrequently: !0, alpha: !1 });
|
|
1406
1406
|
}
|
|
1407
1407
|
createTextureAtlas(t, e, i, s) {
|
|
1408
|
-
const r = t.length, n = Math.ceil(Math.sqrt(r)), o = Math.ceil(r / n), c = e.width * n, l = e.height * o,
|
|
1409
|
-
this.
|
|
1410
|
-
const
|
|
1411
|
-
return
|
|
1408
|
+
const r = t.length, n = Math.ceil(Math.sqrt(r)), o = Math.ceil(r / n), c = e.width * n, l = e.height * o, u = typeof s == "object" ? s : null;
|
|
1409
|
+
this.bi(c, l), this.xi(t, e, n, i, u);
|
|
1410
|
+
const f = this.xt.Ys(c, l, 1, { filter: "nearest" });
|
|
1411
|
+
return f.zt(this.Ai), { framebuffer: f, columns: n, rows: o };
|
|
1412
1412
|
}
|
|
1413
|
-
|
|
1414
|
-
this.
|
|
1413
|
+
bi(t, e) {
|
|
1414
|
+
this.Ai.width = t, this.Ai.height = e, this.Ai.style.width = t + "px", this.Ai.style.height = t + "px", this.wi.imageSmoothingEnabled = !1, this.Ai.style.imageRendering = "pixelated", this.wi.fillStyle = "black", this.wi.fillRect(0, 0, t, e), this.wi.textBaseline = "top", this.wi.textAlign = "left", this.wi.fillStyle = "white";
|
|
1415
1415
|
}
|
|
1416
|
-
|
|
1416
|
+
xi(t, e, i, s, r) {
|
|
1417
1417
|
const n = s / r.head.unitsPerEm;
|
|
1418
1418
|
for (let o = 0; o < t.length; o++) {
|
|
1419
|
-
const c = o % i, l = Math.floor(o / i),
|
|
1420
|
-
if (!
|
|
1421
|
-
const g =
|
|
1422
|
-
this.
|
|
1419
|
+
const c = o % i, l = Math.floor(o / i), u = t[o].character, f = this.$i(r, u);
|
|
1420
|
+
if (!f) continue;
|
|
1421
|
+
const g = u.codePointAt(0) || 0, v = this.Ci.ui(r, g), m = this.Mi(r, v) * n, d = c * e.width, A = l * e.height, p = d + 0.5 * e.width, E = A + 0.5 * e.height, x = Math.round(p - 0.5 * e.width), C = Math.round(E - 0.5 * s), b = x + 0.5 * (e.width - m), R = C + r.hhea.ascender * n;
|
|
1422
|
+
this.Fi(f, b, R, n);
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
1425
|
-
|
|
1426
|
-
const i = e.codePointAt(0) || 0, s = this.
|
|
1425
|
+
$i(t, e) {
|
|
1426
|
+
const i = e.codePointAt(0) || 0, s = this.Ci.ui(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 (L && L.T && L.T.glyf) {
|
|
1430
|
+
const r = L.T.glyf.Js(t, s);
|
|
1431
1431
|
return t.glyf && r && (t.glyf[s] = r), r;
|
|
1432
1432
|
}
|
|
1433
1433
|
return null;
|
|
1434
1434
|
}
|
|
1435
|
-
|
|
1435
|
+
Mi(t, e) {
|
|
1436
1436
|
const i = t.hmtx;
|
|
1437
1437
|
return i && i.aWidth ? e < i.aWidth.length ? i.aWidth[e] : i.aWidth[i.aWidth.length - 1] : 0;
|
|
1438
1438
|
}
|
|
1439
|
-
|
|
1439
|
+
Fi(t, e, i, s) {
|
|
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.wi.beginPath();
|
|
1444
1444
|
let l = 0;
|
|
1445
|
-
for (let
|
|
1446
|
-
const
|
|
1447
|
-
if (!(
|
|
1448
|
-
if (
|
|
1445
|
+
for (let u = 0; u < o.length; u++) {
|
|
1446
|
+
const f = o[u];
|
|
1447
|
+
if (!(f < l)) {
|
|
1448
|
+
if (f >= l) {
|
|
1449
1449
|
const g = e + r[l] * s, v = i - n[l] * s;
|
|
1450
|
-
this.
|
|
1450
|
+
this.wi.moveTo(g, v);
|
|
1451
1451
|
let m = l + 1;
|
|
1452
|
-
for (; m <=
|
|
1452
|
+
for (; m <= f; )
|
|
1453
1453
|
if (1 & c[m]) {
|
|
1454
1454
|
const d = e + r[m] * s, A = i - n[m] * s;
|
|
1455
|
-
this.
|
|
1455
|
+
this.wi.lineTo(d, A), m++;
|
|
1456
1456
|
} else {
|
|
1457
1457
|
const d = e + r[m] * s, A = i - n[m] * s;
|
|
1458
|
-
let p = m + 1 >
|
|
1458
|
+
let p = m + 1 > f ? l : m + 1;
|
|
1459
1459
|
if (1 & c[p]) {
|
|
1460
|
-
const
|
|
1461
|
-
this.
|
|
1460
|
+
const E = e + r[p] * s, x = i - n[p] * s;
|
|
1461
|
+
this.wi.quadraticCurveTo(d, A, E, x), m = p + 1;
|
|
1462
1462
|
} else {
|
|
1463
|
-
const
|
|
1464
|
-
this.
|
|
1463
|
+
const E = (d + (e + r[p] * s)) / 2, x = (A + (i - n[p] * s)) / 2;
|
|
1464
|
+
this.wi.quadraticCurveTo(d, A, E, x), m = p;
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
|
-
this.
|
|
1467
|
+
this.wi.closePath();
|
|
1468
1468
|
}
|
|
1469
|
-
l =
|
|
1469
|
+
l = f + 1;
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
|
-
this.
|
|
1472
|
+
this.wi.fill();
|
|
1473
1473
|
}
|
|
1474
1474
|
}
|
|
1475
1475
|
class zt {
|
|
1476
1476
|
constructor() {
|
|
1477
|
-
h(this, "
|
|
1478
|
-
this.
|
|
1477
|
+
h(this, "Ri");
|
|
1478
|
+
this.Ri = new Z();
|
|
1479
1479
|
}
|
|
1480
|
-
|
|
1480
|
+
zi(t, e, i) {
|
|
1481
1481
|
let s = 0;
|
|
1482
|
-
const r = this.
|
|
1482
|
+
const r = this.Ri._i(i, e), n = r.lineHeight;
|
|
1483
1483
|
for (const o of t) {
|
|
1484
|
-
const c = this.
|
|
1484
|
+
const c = this.Ri.mi(i, o);
|
|
1485
1485
|
if (c === 0) continue;
|
|
1486
|
-
const l = this.
|
|
1486
|
+
const l = this.Ri.gi(i, c) * r.scale;
|
|
1487
1487
|
s = Math.max(s, l);
|
|
1488
1488
|
}
|
|
1489
1489
|
return { width: Math.ceil(s), height: Math.ceil(n) };
|
|
1490
1490
|
}
|
|
1491
|
-
|
|
1492
|
-
this.
|
|
1491
|
+
yi() {
|
|
1492
|
+
this.Ri.yi();
|
|
1493
1493
|
}
|
|
1494
1494
|
}
|
|
1495
|
-
class
|
|
1495
|
+
class Wt {
|
|
1496
1496
|
constructor() {
|
|
1497
|
-
h(this, "
|
|
1498
|
-
this.
|
|
1497
|
+
h(this, "Ci");
|
|
1498
|
+
this.Ci = new Z();
|
|
1499
1499
|
}
|
|
1500
1500
|
createCharacterObjects(t, e) {
|
|
1501
1501
|
return t.map((i, s) => {
|
|
1502
|
-
const r = i.codePointAt(0) || 0, n = this.
|
|
1502
|
+
const r = i.codePointAt(0) || 0, n = this.Pi(s);
|
|
1503
1503
|
let o = 0;
|
|
1504
1504
|
if (e.hmtx && e.hmtx.aWidth) {
|
|
1505
|
-
const c = this.
|
|
1505
|
+
const c = this.Ci.ui(e, r);
|
|
1506
1506
|
c > 0 && e.hmtx.aWidth[c] !== void 0 && (o = e.hmtx.aWidth[c]);
|
|
1507
1507
|
}
|
|
1508
1508
|
return { character: i, unicode: r, color: n, advanceWidth: o };
|
|
1509
1509
|
});
|
|
1510
1510
|
}
|
|
1511
|
-
|
|
1511
|
+
Pi(t) {
|
|
1512
1512
|
return [t % 256 / 255, Math.floor(t / 256) % 256 / 255, Math.floor(t / 65536) % 256 / 255];
|
|
1513
1513
|
}
|
|
1514
|
-
|
|
1515
|
-
if (!
|
|
1514
|
+
Ti(t, e) {
|
|
1515
|
+
if (!G.v(typeof t == "string", "Character must be a string.", { method: "getCharacterColor", providedValue: t })) return [0, 0, 0];
|
|
1516
1516
|
const i = e.find((s) => s.character === t);
|
|
1517
1517
|
return i ? i.color : [0, 0, 0];
|
|
1518
1518
|
}
|
|
1519
|
-
|
|
1520
|
-
return
|
|
1519
|
+
Si(t, e) {
|
|
1520
|
+
return G.v(typeof t == "string" && t.length > 0, "Characters must be a string with at least one character.", { method: "getCharacterColors", providedValue: t }) ? Array.from(t).map((i) => this.Ti(i, e) || [0, 0, 0]) : [[0, 0, 0]];
|
|
1521
1521
|
}
|
|
1522
1522
|
}
|
|
1523
|
-
class
|
|
1523
|
+
class Xt {
|
|
1524
1524
|
constructor(t, e = 16) {
|
|
1525
|
-
h(this, "
|
|
1526
|
-
h(this, "
|
|
1527
|
-
h(this, "
|
|
1525
|
+
h(this, "Ei");
|
|
1526
|
+
h(this, "Bi", []);
|
|
1527
|
+
h(this, "Di");
|
|
1528
1528
|
h(this, "Gi", 16);
|
|
1529
|
-
h(this, "Di", 0);
|
|
1530
1529
|
h(this, "Li", 0);
|
|
1530
|
+
h(this, "Oi", 0);
|
|
1531
1531
|
h(this, "ki", { width: 0, height: 0 });
|
|
1532
|
-
h(this, "Oi");
|
|
1533
1532
|
h(this, "Hi");
|
|
1534
1533
|
h(this, "Ii");
|
|
1535
1534
|
h(this, "Ni");
|
|
1536
1535
|
h(this, "Xi");
|
|
1537
|
-
|
|
1536
|
+
h(this, "Wi");
|
|
1537
|
+
this.Gi = e, this.Ii = new Nt(), this.Ni = new Gt(t), this.Xi = new zt(), this.Wi = new Wt();
|
|
1538
1538
|
}
|
|
1539
|
-
async
|
|
1539
|
+
async Vi(t) {
|
|
1540
1540
|
let e;
|
|
1541
1541
|
if (t) {
|
|
1542
1542
|
const i = await fetch(t);
|
|
@@ -1544,57 +1544,57 @@ class Wt {
|
|
|
1544
1544
|
e = await i.arrayBuffer();
|
|
1545
1545
|
} else
|
|
1546
1546
|
e = await (await fetch("data:font/woff;base64,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")).arrayBuffer();
|
|
1547
|
-
await this.
|
|
1547
|
+
await this.Ki(e), this.Ei = L.parse(e)[0], await this.ji();
|
|
1548
1548
|
}
|
|
1549
|
-
|
|
1549
|
+
Yi(t) {
|
|
1550
1550
|
if (t === void 0) return this.Gi;
|
|
1551
|
-
this.Gi = t, this.ki = this.
|
|
1552
|
-
const e = this.
|
|
1553
|
-
this.
|
|
1551
|
+
this.Gi = t, this.ki = this.Xi.zi(this.Bi.map((i) => i.character), this.Gi, this.Ei);
|
|
1552
|
+
const e = this.Ni.createTextureAtlas(this.Bi, this.ki, this.Gi, this.Ei);
|
|
1553
|
+
this.Di = e.framebuffer, this.Li = e.columns, this.Oi = e.rows;
|
|
1554
1554
|
}
|
|
1555
|
-
async
|
|
1555
|
+
async qi(t) {
|
|
1556
1556
|
try {
|
|
1557
1557
|
const e = await fetch(t);
|
|
1558
1558
|
if (!e.ok) throw new U(`Failed to load font file: ${e.status} ${e.statusText}`);
|
|
1559
1559
|
const i = await e.arrayBuffer();
|
|
1560
|
-
await this.
|
|
1561
|
-
const s =
|
|
1560
|
+
await this.Ki(i);
|
|
1561
|
+
const s = L.parse(i);
|
|
1562
1562
|
if (!s || s.length === 0) throw Error("Failed to parse font file");
|
|
1563
|
-
this.
|
|
1563
|
+
this.Ei = s[0], await this.ji();
|
|
1564
1564
|
} catch (e) {
|
|
1565
1565
|
throw new U("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
|
|
1566
1566
|
}
|
|
1567
1567
|
}
|
|
1568
|
-
async
|
|
1568
|
+
async Ki(t) {
|
|
1569
1569
|
const e = Date.now();
|
|
1570
|
-
this.
|
|
1570
|
+
this.Hi = new FontFace("CustomFont_" + e, t), await this.Hi.load(), document.fonts.add(this.Hi);
|
|
1571
1571
|
}
|
|
1572
|
-
async
|
|
1573
|
-
const t = this.
|
|
1574
|
-
this.
|
|
1575
|
-
const i = this.
|
|
1576
|
-
this.
|
|
1577
|
-
}
|
|
1578
|
-
Pi(t) {
|
|
1579
|
-
return this.Xi.Pi(t, this.Ei);
|
|
1572
|
+
async ji() {
|
|
1573
|
+
const t = this.Ii.ii(this.Ei), e = this.Ii.oi(t);
|
|
1574
|
+
this.Bi = this.Wi.createCharacterObjects(e, this.Ei), this.ki = this.Xi.zi(e, this.Gi, this.Ei);
|
|
1575
|
+
const i = this.Ni.createTextureAtlas(this.Bi, this.ki, this.Gi, this.Ei);
|
|
1576
|
+
this.Di = i.framebuffer, this.Li = i.columns, this.Oi = i.rows;
|
|
1580
1577
|
}
|
|
1581
1578
|
Ti(t) {
|
|
1582
|
-
return this.
|
|
1579
|
+
return this.Wi.Ti(t, this.Bi);
|
|
1583
1580
|
}
|
|
1584
|
-
|
|
1585
|
-
this.
|
|
1581
|
+
Si(t) {
|
|
1582
|
+
return this.Wi.Si(t, this.Bi);
|
|
1583
|
+
}
|
|
1584
|
+
Dt() {
|
|
1585
|
+
this.Di.Dt(), document.fonts.delete(this.Hi);
|
|
1586
1586
|
}
|
|
1587
1587
|
get fontFramebuffer() {
|
|
1588
|
-
return this.
|
|
1588
|
+
return this.Di;
|
|
1589
1589
|
}
|
|
1590
1590
|
get characters() {
|
|
1591
|
-
return this.
|
|
1591
|
+
return this.Bi;
|
|
1592
1592
|
}
|
|
1593
1593
|
get textureColumns() {
|
|
1594
|
-
return this.
|
|
1594
|
+
return this.Li;
|
|
1595
1595
|
}
|
|
1596
1596
|
get textureRows() {
|
|
1597
|
-
return this.
|
|
1597
|
+
return this.Oi;
|
|
1598
1598
|
}
|
|
1599
1599
|
get maxGlyphDimensions() {
|
|
1600
1600
|
return this.ki;
|
|
@@ -1603,39 +1603,39 @@ class Wt {
|
|
|
1603
1603
|
return this.Gi;
|
|
1604
1604
|
}
|
|
1605
1605
|
get font() {
|
|
1606
|
-
return this.
|
|
1606
|
+
return this.Ei;
|
|
1607
1607
|
}
|
|
1608
1608
|
}
|
|
1609
1609
|
class Ht {
|
|
1610
1610
|
constructor(t, e, i) {
|
|
1611
|
-
h(this, "qi");
|
|
1612
1611
|
h(this, "Zi");
|
|
1612
|
+
h(this, "Qi");
|
|
1613
1613
|
h(this, "dt");
|
|
1614
1614
|
h(this, "gt");
|
|
1615
|
-
h(this, "Qi");
|
|
1616
1615
|
h(this, "Ji");
|
|
1617
1616
|
h(this, "tr");
|
|
1618
1617
|
h(this, "er");
|
|
1619
1618
|
h(this, "sr");
|
|
1620
|
-
this
|
|
1619
|
+
h(this, "ir");
|
|
1620
|
+
this.er = t, this.sr = e, this.ir = i, this.rr();
|
|
1621
1621
|
}
|
|
1622
|
-
|
|
1623
|
-
this.
|
|
1622
|
+
rr() {
|
|
1623
|
+
this.Zi = Math.floor(this.er.width / this.sr), this.Qi = Math.floor(this.er.height / this.ir), this.dt = this.Zi * this.sr, this.gt = this.Qi * this.ir, this.Ji = Math.floor((this.er.width - this.dt) / 2), this.tr = Math.floor((this.er.height - this.gt) / 2);
|
|
1624
1624
|
}
|
|
1625
|
-
|
|
1626
|
-
this.
|
|
1625
|
+
nr(t, e) {
|
|
1626
|
+
this.sr = t, this.ir = e, this.rr();
|
|
1627
1627
|
}
|
|
1628
1628
|
get cellWidth() {
|
|
1629
|
-
return this.
|
|
1629
|
+
return this.sr;
|
|
1630
1630
|
}
|
|
1631
1631
|
get cellHeight() {
|
|
1632
|
-
return this.
|
|
1632
|
+
return this.ir;
|
|
1633
1633
|
}
|
|
1634
1634
|
get cols() {
|
|
1635
|
-
return this.
|
|
1635
|
+
return this.Zi;
|
|
1636
1636
|
}
|
|
1637
1637
|
get rows() {
|
|
1638
|
-
return this.
|
|
1638
|
+
return this.Qi;
|
|
1639
1639
|
}
|
|
1640
1640
|
get width() {
|
|
1641
1641
|
return this.dt;
|
|
@@ -1644,143 +1644,140 @@ class Ht {
|
|
|
1644
1644
|
return this.gt;
|
|
1645
1645
|
}
|
|
1646
1646
|
get offsetX() {
|
|
1647
|
-
return this.
|
|
1647
|
+
return this.Ji;
|
|
1648
1648
|
}
|
|
1649
1649
|
get offsetY() {
|
|
1650
|
-
return this.
|
|
1650
|
+
return this.tr;
|
|
1651
1651
|
}
|
|
1652
1652
|
}
|
|
1653
1653
|
class kt {
|
|
1654
1654
|
constructor(t = {}) {
|
|
1655
|
-
h(this, "
|
|
1656
|
-
h(this, "
|
|
1657
|
-
h(this, "
|
|
1658
|
-
h(this, "hr");
|
|
1655
|
+
h(this, "er");
|
|
1656
|
+
h(this, "ar", null);
|
|
1657
|
+
h(this, "hr", !1);
|
|
1659
1658
|
h(this, "cr");
|
|
1660
|
-
|
|
1659
|
+
h(this, "lr");
|
|
1660
|
+
this.hr = t.overlay ?? !1, this.hr && t.canvas ? (this.ar = t.canvas, this.er = this.ur(), this.lr = !0, this.dr()) : t.canvas ? (this.er = t.canvas, this.lr = !1) : (this.er = this.pr(t.width, t.height), this.lr = !0), this.er.style.imageRendering = "pixelated";
|
|
1661
1661
|
}
|
|
1662
|
-
|
|
1662
|
+
pr(t, e) {
|
|
1663
1663
|
const i = document.createElement("canvas");
|
|
1664
1664
|
return i.className = "textmodeCanvas", i.style.imageRendering = "pixelated", i.width = t || 800, i.height = e || 600, document.body.appendChild(i), i;
|
|
1665
1665
|
}
|
|
1666
|
-
|
|
1666
|
+
ur() {
|
|
1667
1667
|
const t = document.createElement("canvas");
|
|
1668
1668
|
t.className = "textmodeCanvas", t.style.imageRendering = "pixelated";
|
|
1669
|
-
const e = this.
|
|
1669
|
+
const e = this.ar.getBoundingClientRect();
|
|
1670
1670
|
let i = Math.round(e.width), s = Math.round(e.height);
|
|
1671
|
-
if (this.
|
|
1672
|
-
const o = this.
|
|
1671
|
+
if (this.ar instanceof HTMLVideoElement) {
|
|
1672
|
+
const o = this.ar;
|
|
1673
1673
|
(i === 0 || s === 0) && o.videoWidth > 0 && o.videoHeight > 0 && (i = o.videoWidth, s = o.videoHeight);
|
|
1674
1674
|
}
|
|
1675
1675
|
t.width = i, t.height = s, t.style.position = "absolute", t.style.pointerEvents = "none";
|
|
1676
|
-
const r = window.getComputedStyle(this.
|
|
1676
|
+
const r = window.getComputedStyle(this.ar);
|
|
1677
1677
|
let n = parseInt(r.zIndex || "0", 10);
|
|
1678
1678
|
return isNaN(n) && (n = 0), t.style.zIndex = "" + (n + 1), t;
|
|
1679
1679
|
}
|
|
1680
|
-
|
|
1680
|
+
dr() {
|
|
1681
1681
|
var t;
|
|
1682
|
-
this.
|
|
1683
|
-
this.
|
|
1684
|
-
}), this.
|
|
1685
|
-
this.
|
|
1682
|
+
this.mr(), (t = this.ar.parentNode) == null || t.insertBefore(this.er, this.ar.nextSibling), window.ResizeObserver && (this.cr = new ResizeObserver(() => {
|
|
1683
|
+
this.gr();
|
|
1684
|
+
}), this.cr.observe(this.ar)), window.addEventListener("resize", () => {
|
|
1685
|
+
this.gr();
|
|
1686
1686
|
});
|
|
1687
1687
|
}
|
|
1688
|
-
|
|
1689
|
-
if (!this.
|
|
1690
|
-
const t = this.
|
|
1691
|
-
let e = this.
|
|
1688
|
+
mr() {
|
|
1689
|
+
if (!this.ar) return;
|
|
1690
|
+
const t = this.ar.getBoundingClientRect();
|
|
1691
|
+
let e = this.ar.offsetParent;
|
|
1692
1692
|
if (e && e !== document.body) {
|
|
1693
1693
|
const i = e.getBoundingClientRect();
|
|
1694
|
-
this.
|
|
1695
|
-
} else this.
|
|
1694
|
+
this.er.style.top = t.top - i.top + "px", this.er.style.left = t.left - i.left + "px";
|
|
1695
|
+
} else this.er.style.top = t.top + window.scrollY + "px", this.er.style.left = t.left + window.scrollX + "px";
|
|
1696
1696
|
}
|
|
1697
|
-
|
|
1698
|
-
if (this.
|
|
1699
|
-
const i = this.
|
|
1697
|
+
gr(t, e) {
|
|
1698
|
+
if (this.hr) {
|
|
1699
|
+
const i = this.ar.getBoundingClientRect();
|
|
1700
1700
|
let s = Math.round(i.width), r = Math.round(i.height);
|
|
1701
|
-
if (this.
|
|
1702
|
-
const n = this.
|
|
1701
|
+
if (this.ar instanceof HTMLVideoElement) {
|
|
1702
|
+
const n = this.ar;
|
|
1703
1703
|
(s === 0 || r === 0) && n.videoWidth > 0 && n.videoHeight > 0 && (s = n.videoWidth, r = n.videoHeight);
|
|
1704
1704
|
}
|
|
1705
|
-
this.
|
|
1706
|
-
} else this.
|
|
1705
|
+
this.er.width = s, this.er.height = r, this.mr();
|
|
1706
|
+
} else this.er.width = t ?? this.er.width, this.er.height = e ?? this.er.height;
|
|
1707
1707
|
}
|
|
1708
|
-
|
|
1709
|
-
const t = this.
|
|
1708
|
+
_r() {
|
|
1709
|
+
const t = this.er.getContext("webgl2", { alpha: !0, premultipliedAlpha: !1, preserveDrawingBuffer: !0, antialias: !1, depth: !1, stencil: !1, powerPreference: "high-performance" });
|
|
1710
1710
|
if (!t) throw new U("`textmode.js` requires WebGL2 support.");
|
|
1711
1711
|
return t;
|
|
1712
1712
|
}
|
|
1713
|
-
|
|
1714
|
-
this.
|
|
1715
|
-
const t = this.
|
|
1713
|
+
Dt() {
|
|
1714
|
+
this.cr && this.cr.disconnect();
|
|
1715
|
+
const t = this.er.getContext("webgl") || this.er.getContext("webgl2");
|
|
1716
1716
|
if (t) {
|
|
1717
1717
|
const e = t.getExtension("WEBGL_lose_context");
|
|
1718
1718
|
e && e.loseContext();
|
|
1719
1719
|
}
|
|
1720
|
-
this.
|
|
1720
|
+
this.lr && this.er.parentNode && this.er.parentNode.removeChild(this.er);
|
|
1721
1721
|
}
|
|
1722
1722
|
get canvas() {
|
|
1723
|
-
return this.
|
|
1723
|
+
return this.er;
|
|
1724
1724
|
}
|
|
1725
1725
|
get targetCanvas() {
|
|
1726
|
-
return this.
|
|
1726
|
+
return this.ar;
|
|
1727
1727
|
}
|
|
1728
1728
|
get width() {
|
|
1729
|
-
return this.
|
|
1729
|
+
return this.er.width;
|
|
1730
1730
|
}
|
|
1731
1731
|
get height() {
|
|
1732
|
-
return this.
|
|
1732
|
+
return this.er.height;
|
|
1733
1733
|
}
|
|
1734
1734
|
}
|
|
1735
1735
|
class z {
|
|
1736
1736
|
constructor(t, e, i, s) {
|
|
1737
|
-
h(this, "
|
|
1738
|
-
h(this, "
|
|
1739
|
-
h(this, "
|
|
1737
|
+
h(this, "vr");
|
|
1738
|
+
h(this, "dt");
|
|
1739
|
+
h(this, "gt");
|
|
1740
1740
|
h(this, "vt");
|
|
1741
|
-
h(this, "
|
|
1741
|
+
h(this, "G", 0);
|
|
1742
1742
|
h(this, "V", 0);
|
|
1743
1743
|
h(this, "K", 0);
|
|
1744
1744
|
h(this, "L", [0, 0]);
|
|
1745
|
-
h(this, "
|
|
1746
|
-
h(this, "
|
|
1745
|
+
h(this, "yr", "sampled");
|
|
1746
|
+
h(this, "Ar", "fixed");
|
|
1747
1747
|
h(this, "Y", [1, 1, 1]);
|
|
1748
1748
|
h(this, "q", [0, 0, 0]);
|
|
1749
|
-
h(this, "
|
|
1750
|
-
h(this, "
|
|
1751
|
-
h(this, "
|
|
1752
|
-
this.vt = t, this.
|
|
1749
|
+
h(this, "wr", [0, 0, 0, 1]);
|
|
1750
|
+
h(this, "Cr", [[0.1, 0, 0]]);
|
|
1751
|
+
h(this, "br");
|
|
1752
|
+
this.vt = t, this.vr = e, this.dt = i, this.gt = s;
|
|
1753
1753
|
}
|
|
1754
|
-
|
|
1755
|
-
this.vt.deleteTexture(this.
|
|
1754
|
+
Dt() {
|
|
1755
|
+
this.vt.deleteTexture(this.vr);
|
|
1756
1756
|
}
|
|
1757
|
-
|
|
1757
|
+
$r(t) {
|
|
1758
1758
|
return typeof t == "boolean" ? t ? 1 : 0 : (t == null ? 0 : Number(t)) > 0 ? 1 : 0;
|
|
1759
1759
|
}
|
|
1760
1760
|
invert(t = !0) {
|
|
1761
|
-
return this.
|
|
1761
|
+
return this.G = this.$r(t), this;
|
|
1762
1762
|
}
|
|
1763
1763
|
flipX(t = !0) {
|
|
1764
|
-
return this.V = this
|
|
1764
|
+
return this.V = this.$r(t), this;
|
|
1765
1765
|
}
|
|
1766
1766
|
flipY(t = !0) {
|
|
1767
|
-
return this.K = this
|
|
1767
|
+
return this.K = this.$r(t), this;
|
|
1768
1768
|
}
|
|
1769
1769
|
charRotation(t) {
|
|
1770
1770
|
const e = 255 * t / 360, i = Math.floor(e) / 255, s = Math.round(e - Math.floor(e));
|
|
1771
1771
|
return this.L = [i, s], this;
|
|
1772
1772
|
}
|
|
1773
|
-
|
|
1774
|
-
return { invert: this.
|
|
1775
|
-
}
|
|
1776
|
-
get charRotationRG() {
|
|
1777
|
-
return this.L;
|
|
1773
|
+
Is() {
|
|
1774
|
+
return { texture: this.vr, invert: this.G, flipX: this.V, flipY: this.K, charRotation: this.L, charColorFixed: this.yr === "fixed", charColor: this.Y, cellColorFixed: this.Ar === "fixed", cellColor: this.q, backgroundColor: this.wr, charCount: this.Cr.length, charList: this.Cr };
|
|
1778
1775
|
}
|
|
1779
1776
|
charColorMode(t) {
|
|
1780
|
-
return this.
|
|
1777
|
+
return this.yr = t, this;
|
|
1781
1778
|
}
|
|
1782
1779
|
cellColorMode(t) {
|
|
1783
|
-
return this.
|
|
1780
|
+
return this.Ar = t, this;
|
|
1784
1781
|
}
|
|
1785
1782
|
charColor(t, e, i) {
|
|
1786
1783
|
return this.Y = [(t ?? 0) / 255, (e ?? t ?? 0) / 255, (i ?? t ?? 0) / 255], this;
|
|
@@ -1789,278 +1786,277 @@ class z {
|
|
|
1789
1786
|
return this.q = [(t ?? 0) / 255, (e ?? t ?? 0) / 255, (i ?? t ?? 0) / 255], this;
|
|
1790
1787
|
}
|
|
1791
1788
|
background(t, e, i, s) {
|
|
1792
|
-
return this.
|
|
1793
|
-
}
|
|
1794
|
-
charactersFromColors(t) {
|
|
1795
|
-
const e = t.filter((i) => Array.isArray(i)).slice(0, 64);
|
|
1796
|
-
return this.Ar = e, this;
|
|
1789
|
+
return this.wr = [(t ?? 0) / 255, (e ?? t ?? 0) / 255, (i ?? t ?? 0) / 255, (s ?? 255) / 255], this;
|
|
1797
1790
|
}
|
|
1798
1791
|
characters(t) {
|
|
1799
|
-
const e = this.
|
|
1800
|
-
return this.
|
|
1792
|
+
const e = this.br(t).filter((i) => Array.isArray(i)).slice(0, 64);
|
|
1793
|
+
return this.Cr = e, this;
|
|
1801
1794
|
}
|
|
1802
|
-
|
|
1803
|
-
return { count: this.Ar.length, list: this.Ar };
|
|
1804
|
-
}
|
|
1805
|
-
get colorUniforms() {
|
|
1806
|
-
return { charColorFixed: this._r === "fixed", Y: this.Y, cellColorFixed: this.vr === "fixed", cellColor: this.q, backgroundColor: this.yr };
|
|
1807
|
-
}
|
|
1808
|
-
static fromSource(t, e, i) {
|
|
1795
|
+
static Mr(t, e, i) {
|
|
1809
1796
|
const s = t.context, r = s.createTexture();
|
|
1810
1797
|
s.bindTexture(s.TEXTURE_2D, r), s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL, 1), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MIN_FILTER, s.NEAREST), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MAG_FILTER, s.NEAREST), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_S, s.CLAMP_TO_EDGE), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_T, s.CLAMP_TO_EDGE), s.texImage2D(s.TEXTURE_2D, 0, s.RGBA, s.RGBA, s.UNSIGNED_BYTE, e), s.bindTexture(s.TEXTURE_2D, null);
|
|
1811
1798
|
const n = e.naturalWidth ?? e.width ?? e.videoWidth ?? 0, o = e.naturalHeight ?? e.height ?? e.videoHeight ?? 0, c = new z(s, r, n, o);
|
|
1812
|
-
return c.
|
|
1799
|
+
return c.br = i, c;
|
|
1800
|
+
}
|
|
1801
|
+
get texture() {
|
|
1802
|
+
return this.vr;
|
|
1803
|
+
}
|
|
1804
|
+
get width() {
|
|
1805
|
+
return this.dt;
|
|
1806
|
+
}
|
|
1807
|
+
get height() {
|
|
1808
|
+
return this.gt;
|
|
1813
1809
|
}
|
|
1814
1810
|
}
|
|
1815
1811
|
class Yt {
|
|
1816
1812
|
constructor(t = 60) {
|
|
1817
|
-
h(this, "
|
|
1818
|
-
h(this, "
|
|
1819
|
-
h(this, "
|
|
1820
|
-
h(this, "Fr", 0);
|
|
1821
|
-
h(this, "Rr", !0);
|
|
1822
|
-
h(this, "zr", 0);
|
|
1813
|
+
h(this, "Fr");
|
|
1814
|
+
h(this, "Rr");
|
|
1815
|
+
h(this, "zr", null);
|
|
1823
1816
|
h(this, "Pr", 0);
|
|
1824
|
-
h(this, "Tr",
|
|
1825
|
-
h(this, "Sr",
|
|
1817
|
+
h(this, "Tr", !0);
|
|
1818
|
+
h(this, "Sr", 0);
|
|
1826
1819
|
h(this, "Er", 0);
|
|
1827
|
-
this
|
|
1820
|
+
h(this, "Br", []);
|
|
1821
|
+
h(this, "Dr", 10);
|
|
1822
|
+
h(this, "Gr", 0);
|
|
1823
|
+
this.Fr = t, this.Rr = 1e3 / t;
|
|
1828
1824
|
}
|
|
1829
1825
|
start(t) {
|
|
1830
|
-
if (!this.
|
|
1831
|
-
this.
|
|
1826
|
+
if (!this.Tr) return;
|
|
1827
|
+
this.Pr = performance.now();
|
|
1832
1828
|
const e = (i) => {
|
|
1833
|
-
if (!this.
|
|
1834
|
-
const s = i - this.
|
|
1835
|
-
s >= this
|
|
1829
|
+
if (!this.Tr) return void (this.zr = null);
|
|
1830
|
+
const s = i - this.Pr;
|
|
1831
|
+
s >= this.Rr && (t(), this.Pr = i - s % this.Rr), this.Tr && (this.zr = requestAnimationFrame(e));
|
|
1836
1832
|
};
|
|
1837
|
-
this.
|
|
1833
|
+
this.zr = requestAnimationFrame(e);
|
|
1838
1834
|
}
|
|
1839
1835
|
stop() {
|
|
1840
|
-
this.
|
|
1836
|
+
this.zr && (cancelAnimationFrame(this.zr), this.zr = null);
|
|
1841
1837
|
}
|
|
1842
1838
|
pause() {
|
|
1843
|
-
this.
|
|
1839
|
+
this.Tr && (this.Tr = !1, this.stop());
|
|
1844
1840
|
}
|
|
1845
1841
|
resume(t) {
|
|
1846
|
-
this.
|
|
1842
|
+
this.Tr || (this.Tr = !0, this.start(t));
|
|
1847
1843
|
}
|
|
1848
1844
|
frameRate(t, e) {
|
|
1849
|
-
if (t === void 0) return this.
|
|
1850
|
-
this.
|
|
1845
|
+
if (t === void 0) return this.Sr;
|
|
1846
|
+
this.Fr = t, this.Rr = 1e3 / t, this.Tr && e && (this.stop(), this.start(e));
|
|
1851
1847
|
}
|
|
1852
1848
|
measureFrameRate() {
|
|
1853
1849
|
const t = performance.now();
|
|
1854
|
-
if (this.
|
|
1855
|
-
const e = t - this.
|
|
1856
|
-
this.
|
|
1857
|
-
const i = this.
|
|
1858
|
-
this.
|
|
1850
|
+
if (this.Er > 0) {
|
|
1851
|
+
const e = t - this.Er;
|
|
1852
|
+
this.Br.push(e), this.Br.length > this.Dr && this.Br.shift();
|
|
1853
|
+
const i = this.Br.reduce((s, r) => s + r, 0) / this.Br.length;
|
|
1854
|
+
this.Sr = 1e3 / i;
|
|
1859
1855
|
}
|
|
1860
|
-
this.
|
|
1856
|
+
this.Er = t;
|
|
1861
1857
|
}
|
|
1862
1858
|
get isLooping() {
|
|
1863
|
-
return this.
|
|
1859
|
+
return this.Tr;
|
|
1864
1860
|
}
|
|
1865
1861
|
get frameRateLimit() {
|
|
1866
|
-
return this.
|
|
1862
|
+
return this.Fr;
|
|
1867
1863
|
}
|
|
1868
1864
|
get currentFrameRate() {
|
|
1869
|
-
return this.
|
|
1865
|
+
return this.Sr;
|
|
1870
1866
|
}
|
|
1871
1867
|
get frameCount() {
|
|
1872
|
-
return this.
|
|
1868
|
+
return this.Gr;
|
|
1873
1869
|
}
|
|
1874
1870
|
set frameCount(t) {
|
|
1875
|
-
this.
|
|
1871
|
+
this.Gr = t;
|
|
1876
1872
|
}
|
|
1877
1873
|
incrementFrame() {
|
|
1878
|
-
this.
|
|
1874
|
+
this.Gr++;
|
|
1879
1875
|
}
|
|
1880
1876
|
resetFrameCount() {
|
|
1881
|
-
this.
|
|
1877
|
+
this.Gr = 0;
|
|
1882
1878
|
}
|
|
1883
1879
|
}
|
|
1884
1880
|
class Vt {
|
|
1885
1881
|
constructor() {
|
|
1886
|
-
h(this, "
|
|
1887
|
-
h(this, "
|
|
1888
|
-
h(this, "
|
|
1889
|
-
h(this, "Lr");
|
|
1890
|
-
h(this, "kr");
|
|
1891
|
-
h(this, "Or", !1);
|
|
1882
|
+
h(this, "Lr", /* @__PURE__ */ new Map());
|
|
1883
|
+
h(this, "Or", null);
|
|
1884
|
+
h(this, "kr", null);
|
|
1892
1885
|
h(this, "Hr");
|
|
1893
1886
|
h(this, "Ir");
|
|
1894
|
-
h(this, "Nr",
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
this
|
|
1898
|
-
this.Wr(t);
|
|
1899
|
-
}, this.kr = (t) => {
|
|
1900
|
-
this.Vr(t);
|
|
1901
|
-
}, window.addEventListener("keydown", this.Lr, { passive: !1 }), window.addEventListener("keyup", this.kr, { passive: !1 }), this.Or = !0);
|
|
1887
|
+
h(this, "Nr", !1);
|
|
1888
|
+
h(this, "Xr");
|
|
1889
|
+
h(this, "Wr");
|
|
1890
|
+
h(this, "Vr", { ArrowUp: "UP_ARROW", ArrowDown: "DOWN_ARROW", ArrowLeft: "LEFT_ARROW", ArrowRight: "RIGHT_ARROW", F1: "F1", F2: "F2", F3: "F3", F4: "F4", F5: "F5", F6: "F6", F7: "F7", F8: "F8", F9: "F9", F10: "F10", F11: "F11", F12: "F12", Enter: "ENTER", Return: "RETURN", Tab: "TAB", Escape: "ESCAPE", Backspace: "BACKSPACE", Delete: "DELETE", Insert: "INSERT", Home: "HOME", End: "END", PageUp: "PAGE_UP", PageDown: "PAGE_DOWN", Shift: "SHIFT", Control: "CONTROL", Alt: "ALT", Meta: "META", " ": "SPACE" });
|
|
1902
1891
|
}
|
|
1903
1892
|
Kr() {
|
|
1904
|
-
this.
|
|
1893
|
+
this.Nr || (this.Hr = (t) => {
|
|
1894
|
+
this.jr(t);
|
|
1895
|
+
}, this.Ir = (t) => {
|
|
1896
|
+
this.Yr(t);
|
|
1897
|
+
}, window.addEventListener("keydown", this.Hr, { passive: !1 }), window.addEventListener("keyup", this.Ir, { passive: !1 }), this.Nr = !0);
|
|
1905
1898
|
}
|
|
1906
|
-
|
|
1907
|
-
this.Hr =
|
|
1899
|
+
qr() {
|
|
1900
|
+
this.Nr && (window.removeEventListener("keydown", this.Hr), window.removeEventListener("keyup", this.Ir), this.Nr = !1, this.Lr.clear(), this.Or = null, this.kr = null);
|
|
1908
1901
|
}
|
|
1909
|
-
|
|
1910
|
-
this.
|
|
1902
|
+
Zr(t) {
|
|
1903
|
+
this.Xr = t;
|
|
1911
1904
|
}
|
|
1912
|
-
|
|
1913
|
-
|
|
1905
|
+
Qr(t) {
|
|
1906
|
+
this.Wr = t;
|
|
1907
|
+
}
|
|
1908
|
+
Jr(t) {
|
|
1909
|
+
const e = this.tn(t), i = this.Lr.get(t) || this.Lr.get(e);
|
|
1914
1910
|
return (i == null ? void 0 : i.isPressed) || !1;
|
|
1915
1911
|
}
|
|
1916
|
-
|
|
1917
|
-
return this.
|
|
1912
|
+
en() {
|
|
1913
|
+
return this.Or;
|
|
1918
1914
|
}
|
|
1919
|
-
|
|
1920
|
-
return this.
|
|
1915
|
+
sn() {
|
|
1916
|
+
return this.kr;
|
|
1921
1917
|
}
|
|
1922
|
-
|
|
1918
|
+
rn() {
|
|
1923
1919
|
const t = [];
|
|
1924
|
-
for (const [e, i] of this.
|
|
1920
|
+
for (const [e, i] of this.Lr) i.isPressed && t.push(e);
|
|
1925
1921
|
return t;
|
|
1926
1922
|
}
|
|
1927
|
-
|
|
1928
|
-
return { ctrl: this.
|
|
1923
|
+
nn() {
|
|
1924
|
+
return { ctrl: this.Jr("Control"), shift: this.Jr("Shift"), alt: this.Jr("Alt"), meta: this.Jr("Meta") };
|
|
1929
1925
|
}
|
|
1930
|
-
|
|
1931
|
-
this.
|
|
1926
|
+
an() {
|
|
1927
|
+
this.Lr.clear(), this.Or = null, this.kr = null;
|
|
1932
1928
|
}
|
|
1933
|
-
|
|
1929
|
+
jr(t) {
|
|
1934
1930
|
const e = t.key, i = Date.now();
|
|
1935
|
-
this.
|
|
1936
|
-
const s = this.
|
|
1937
|
-
if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.
|
|
1931
|
+
this.Lr.has(e) || this.Lr.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
1932
|
+
const s = this.Lr.get(e);
|
|
1933
|
+
if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.Or = e, this.Xr)) {
|
|
1938
1934
|
const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !0, originalEvent: t };
|
|
1939
|
-
this.
|
|
1935
|
+
this.Xr(r);
|
|
1940
1936
|
}
|
|
1941
1937
|
}
|
|
1942
|
-
|
|
1938
|
+
Yr(t) {
|
|
1943
1939
|
const e = t.key, i = Date.now();
|
|
1944
|
-
this.
|
|
1945
|
-
const s = this.
|
|
1946
|
-
if (s.isPressed = !1, s.lastReleaseTime = i, this.
|
|
1940
|
+
this.Lr.has(e) || this.Lr.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
1941
|
+
const s = this.Lr.get(e);
|
|
1942
|
+
if (s.isPressed = !1, s.lastReleaseTime = i, this.kr = e, this.Wr) {
|
|
1947
1943
|
const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !1, originalEvent: t };
|
|
1948
|
-
this.
|
|
1944
|
+
this.Wr(r);
|
|
1949
1945
|
}
|
|
1950
1946
|
}
|
|
1951
|
-
|
|
1952
|
-
return this.
|
|
1947
|
+
tn(t) {
|
|
1948
|
+
return this.Vr[t] || t.toLowerCase();
|
|
1953
1949
|
}
|
|
1954
1950
|
}
|
|
1955
1951
|
class jt {
|
|
1956
1952
|
constructor(t) {
|
|
1957
|
-
h(this, "
|
|
1958
|
-
h(this, "
|
|
1959
|
-
h(this, "
|
|
1960
|
-
h(this, "
|
|
1961
|
-
h(this, "
|
|
1962
|
-
h(this, "cn");
|
|
1963
|
-
h(this, "ln");
|
|
1964
|
-
h(this, "un");
|
|
1953
|
+
h(this, "er");
|
|
1954
|
+
h(this, "hn");
|
|
1955
|
+
h(this, "cn", { x: -1, y: -1 });
|
|
1956
|
+
h(this, "ln", { x: -1, y: -1 });
|
|
1957
|
+
h(this, "un", null);
|
|
1965
1958
|
h(this, "fn");
|
|
1966
1959
|
h(this, "dn");
|
|
1967
1960
|
h(this, "pn");
|
|
1968
|
-
h(this, "Or", !1);
|
|
1969
1961
|
h(this, "mn");
|
|
1970
1962
|
h(this, "gn");
|
|
1971
1963
|
h(this, "_n");
|
|
1964
|
+
h(this, "Nr", !1);
|
|
1972
1965
|
h(this, "vn");
|
|
1973
1966
|
h(this, "yn");
|
|
1974
|
-
this
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
this.
|
|
1978
|
-
}
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
const t = this.tr.canvas;
|
|
1982
|
-
this.cn = (e) => {
|
|
1983
|
-
this.wn(e), this.Cn(e);
|
|
1984
|
-
}, this.ln = () => {
|
|
1985
|
-
this.an = { ...this.nn }, this.nn.x = -1, this.nn.y = -1, this.hn = null;
|
|
1986
|
-
}, this.un = (e) => {
|
|
1987
|
-
this.wn(e), this.bn(e);
|
|
1988
|
-
}, this.fn = (e) => {
|
|
1989
|
-
this.wn(e), this.xn(e);
|
|
1990
|
-
}, this.dn = (e) => {
|
|
1991
|
-
this.wn(e), this.$n(e);
|
|
1992
|
-
}, this.pn = (e) => {
|
|
1993
|
-
this.wn(e), this.Mn(e);
|
|
1994
|
-
}, t.addEventListener("mousemove", this.cn, { passive: !0 }), t.addEventListener("mouseleave", this.ln, { passive: !0 }), t.addEventListener("mousedown", this.un, { passive: !0 }), t.addEventListener("mouseup", this.fn, { passive: !0 }), t.addEventListener("click", this.dn, { passive: !0 }), t.addEventListener("wheel", this.pn, { passive: !1 }), this.Or = !0;
|
|
1967
|
+
h(this, "An");
|
|
1968
|
+
h(this, "wn");
|
|
1969
|
+
h(this, "Cn");
|
|
1970
|
+
this.er = t;
|
|
1971
|
+
}
|
|
1972
|
+
Vi(t) {
|
|
1973
|
+
this.hn = t, this.bn();
|
|
1995
1974
|
}
|
|
1996
1975
|
Kr() {
|
|
1997
|
-
if (
|
|
1998
|
-
const t = this.
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
1976
|
+
if (this.Nr) return;
|
|
1977
|
+
const t = this.er.canvas;
|
|
1978
|
+
this.fn = (e) => {
|
|
1979
|
+
this.xn(e), this.$n(e);
|
|
1980
|
+
}, this.dn = () => {
|
|
1981
|
+
this.ln = { ...this.cn }, this.cn.x = -1, this.cn.y = -1, this.un = null;
|
|
1982
|
+
}, this.pn = (e) => {
|
|
1983
|
+
this.xn(e), this.Mn(e);
|
|
1984
|
+
}, this.mn = (e) => {
|
|
1985
|
+
this.xn(e), this.Fn(e);
|
|
1986
|
+
}, this.gn = (e) => {
|
|
1987
|
+
this.xn(e), this.Rn(e);
|
|
1988
|
+
}, this._n = (e) => {
|
|
1989
|
+
this.xn(e), this.zn(e);
|
|
1990
|
+
}, t.addEventListener("mousemove", this.fn, { passive: !0 }), t.addEventListener("mouseleave", this.dn, { passive: !0 }), t.addEventListener("mousedown", this.pn, { passive: !0 }), t.addEventListener("mouseup", this.mn, { passive: !0 }), t.addEventListener("click", this.gn, { passive: !0 }), t.addEventListener("wheel", this._n, { passive: !1 }), this.Nr = !0;
|
|
1991
|
+
}
|
|
1992
|
+
qr() {
|
|
1993
|
+
if (!this.Nr) return;
|
|
1994
|
+
const t = this.er.canvas;
|
|
1995
|
+
t.removeEventListener("mousemove", this.fn), t.removeEventListener("mouseleave", this.dn), t.removeEventListener("mousedown", this.pn), t.removeEventListener("mouseup", this.mn), t.removeEventListener("click", this.gn), t.removeEventListener("wheel", this._n), this.Nr = !1;
|
|
1996
|
+
}
|
|
1997
|
+
bn() {
|
|
1998
|
+
if (this.Nr) try {
|
|
1999
|
+
if (this.un) {
|
|
2000
|
+
const t = new MouseEvent("mousemove", { clientX: this.un.x, clientY: this.un.y, bubbles: !1, cancelable: !1 });
|
|
2001
|
+
this.xn(t);
|
|
2002
|
+
} else this.cn.x !== -1 && this.cn.y !== -1 && (this.cn.x >= this.hn.cols || this.cn.y >= this.hn.rows) && (this.cn.x = -1, this.cn.y = -1);
|
|
2007
2003
|
} catch {
|
|
2008
|
-
this.
|
|
2004
|
+
this.cn.x = -1, this.cn.y = -1;
|
|
2009
2005
|
}
|
|
2010
2006
|
}
|
|
2011
|
-
|
|
2012
|
-
this.mn = t;
|
|
2013
|
-
}
|
|
2014
|
-
jr(t) {
|
|
2015
|
-
this.gn = t;
|
|
2016
|
-
}
|
|
2017
|
-
Yr(t) {
|
|
2018
|
-
this._n = t;
|
|
2019
|
-
}
|
|
2020
|
-
Rn(t) {
|
|
2007
|
+
Pn(t) {
|
|
2021
2008
|
this.vn = t;
|
|
2022
2009
|
}
|
|
2023
|
-
|
|
2010
|
+
Zr(t) {
|
|
2024
2011
|
this.yn = t;
|
|
2025
2012
|
}
|
|
2026
|
-
|
|
2027
|
-
|
|
2013
|
+
Qr(t) {
|
|
2014
|
+
this.An = t;
|
|
2028
2015
|
}
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
const e = { position: { ...this.nn }, previousPosition: { ...this.an }, originalEvent: t };
|
|
2032
|
-
this.vn(e);
|
|
2033
|
-
}
|
|
2016
|
+
Tn(t) {
|
|
2017
|
+
this.wn = t;
|
|
2034
2018
|
}
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
const e = { position: { ...this.nn }, previousPosition: { ...this.an }, button: t.button, originalEvent: t };
|
|
2038
|
-
this.gn(e);
|
|
2039
|
-
}
|
|
2019
|
+
Sn(t) {
|
|
2020
|
+
this.Cn = t;
|
|
2040
2021
|
}
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
const e = { position: { ...this.nn }, previousPosition: { ...this.an }, button: t.button, originalEvent: t };
|
|
2044
|
-
this._n(e);
|
|
2045
|
-
}
|
|
2022
|
+
En() {
|
|
2023
|
+
return { x: this.cn.x, y: this.cn.y };
|
|
2046
2024
|
}
|
|
2047
2025
|
$n(t) {
|
|
2048
|
-
if (this.
|
|
2049
|
-
const e = { position: { ...this.
|
|
2050
|
-
this.
|
|
2026
|
+
if (this.wn) {
|
|
2027
|
+
const e = { position: { ...this.cn }, previousPosition: { ...this.ln }, originalEvent: t };
|
|
2028
|
+
this.wn(e);
|
|
2051
2029
|
}
|
|
2052
2030
|
}
|
|
2053
2031
|
Mn(t) {
|
|
2054
2032
|
if (this.yn) {
|
|
2055
|
-
const e = { position: { ...this.
|
|
2033
|
+
const e = { position: { ...this.cn }, previousPosition: { ...this.ln }, button: t.button, originalEvent: t };
|
|
2056
2034
|
this.yn(e);
|
|
2057
2035
|
}
|
|
2058
2036
|
}
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2037
|
+
Fn(t) {
|
|
2038
|
+
if (this.An) {
|
|
2039
|
+
const e = { position: { ...this.cn }, previousPosition: { ...this.ln }, button: t.button, originalEvent: t };
|
|
2040
|
+
this.An(e);
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
Rn(t) {
|
|
2044
|
+
if (this.vn) {
|
|
2045
|
+
const e = { position: { ...this.cn }, previousPosition: { ...this.ln }, button: t.button, originalEvent: t };
|
|
2046
|
+
this.vn(e);
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
zn(t) {
|
|
2050
|
+
if (this.Cn) {
|
|
2051
|
+
const e = { position: { ...this.cn }, previousPosition: { ...this.ln }, delta: { x: t.deltaX, y: t.deltaY }, originalEvent: t };
|
|
2052
|
+
this.Cn(e);
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
xn(t) {
|
|
2056
|
+
const e = this.er.canvas;
|
|
2057
|
+
this.ln = { ...this.cn }, this.un = { x: t.clientX, y: t.clientY };
|
|
2058
|
+
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.hn.offsetX, l = o - this.hn.offsetY, u = Math.floor(c / this.hn.cellWidth), f = Math.floor(l / this.hn.cellHeight);
|
|
2059
|
+
u >= 0 && u < this.hn.cols && f >= 0 && f < this.hn.rows ? (this.cn.x = u, this.cn.y = f) : (this.cn.x = -1, this.cn.y = -1);
|
|
2064
2060
|
}
|
|
2065
2061
|
}
|
|
2066
2062
|
const Kt = (a) => class extends a {
|
|
@@ -2083,22 +2079,22 @@ const Kt = (a) => class extends a {
|
|
|
2083
2079
|
this.xt.state.Z();
|
|
2084
2080
|
}
|
|
2085
2081
|
rect(t, e, i = 1, s = 1) {
|
|
2086
|
-
this.xt.
|
|
2082
|
+
this.xt.Xs(t, e, i, s);
|
|
2087
2083
|
}
|
|
2088
2084
|
point(t, e) {
|
|
2089
|
-
this.xt.
|
|
2085
|
+
this.xt.Xs(t, e, 1, 1);
|
|
2090
2086
|
}
|
|
2091
2087
|
line(t, e, i, s) {
|
|
2092
|
-
this.xt.
|
|
2088
|
+
this.xt.Ws(t, e, i, s);
|
|
2093
2089
|
}
|
|
2094
2090
|
lineWeight(t) {
|
|
2095
2091
|
this.xt.state.tt(t);
|
|
2096
2092
|
}
|
|
2097
2093
|
background(t, e = t, i = t, s = 255) {
|
|
2098
|
-
this.xt.
|
|
2094
|
+
this.xt.Zs(t, e, i, s);
|
|
2099
2095
|
}
|
|
2100
2096
|
char(t) {
|
|
2101
|
-
this.xt.state.rt(this.
|
|
2097
|
+
this.xt.state.rt(this.Ei.Ti(t));
|
|
2102
2098
|
}
|
|
2103
2099
|
charColor(t, e, i) {
|
|
2104
2100
|
this.xt.state.nt(t, e, i);
|
|
@@ -2119,19 +2115,19 @@ const Kt = (a) => class extends a {
|
|
|
2119
2115
|
this.xt.state.lt(t);
|
|
2120
2116
|
}
|
|
2121
2117
|
clear() {
|
|
2122
|
-
this.xt.
|
|
2118
|
+
this.xt.Zs(0, 0, 0, 0);
|
|
2123
2119
|
}
|
|
2124
2120
|
ellipse(t, e, i, s) {
|
|
2125
|
-
this.xt.
|
|
2121
|
+
this.xt.Vs(t, e, i / 2, s / 2);
|
|
2126
2122
|
}
|
|
2127
2123
|
triangle(t, e, i, s, r, n) {
|
|
2128
|
-
this.xt.
|
|
2124
|
+
this.xt.Ks(t, e, i, s, r, n);
|
|
2129
2125
|
}
|
|
2130
2126
|
bezierCurve(t, e, i, s, r, n, o, c) {
|
|
2131
|
-
this.xt.
|
|
2127
|
+
this.xt.js(t, e, i, s, r, n, o, c);
|
|
2132
2128
|
}
|
|
2133
2129
|
arc(t, e, i, s, r, n) {
|
|
2134
|
-
this.xt.
|
|
2130
|
+
this.xt.qs(t, e, i, s, r, n);
|
|
2135
2131
|
}
|
|
2136
2132
|
shader(t) {
|
|
2137
2133
|
this.xt.Ls(t);
|
|
@@ -2140,97 +2136,97 @@ const Kt = (a) => class extends a {
|
|
|
2140
2136
|
this.xt.Kt(t, e);
|
|
2141
2137
|
}
|
|
2142
2138
|
setUniforms(t) {
|
|
2143
|
-
this.xt.
|
|
2139
|
+
this.xt.Os(t);
|
|
2144
2140
|
}
|
|
2145
2141
|
createFilterShader(t) {
|
|
2146
2142
|
return this.xt.oe(t);
|
|
2147
2143
|
}
|
|
2148
2144
|
createFramebuffer(t) {
|
|
2149
|
-
return this.xt.
|
|
2145
|
+
return this.xt.Ys(t.width, t.height, 5, { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte" });
|
|
2150
2146
|
}
|
|
2151
2147
|
image(t, e, i, s, r) {
|
|
2152
2148
|
if (t.textures) {
|
|
2153
2149
|
const n = t;
|
|
2154
|
-
this.xt.
|
|
2150
|
+
this.xt.ks(n, e, i, s ?? n.width, r ?? n.height);
|
|
2155
2151
|
} else {
|
|
2156
2152
|
const n = t;
|
|
2157
|
-
this.xt.Hs(n, e, i, s ??
|
|
2153
|
+
this.xt.Hs(n, e, i, s ?? Math.floor(this.hn.cols / 2), r ?? Math.floor(this.hn.rows / 2));
|
|
2158
2154
|
}
|
|
2159
2155
|
}
|
|
2160
2156
|
async loadImage(t) {
|
|
2161
|
-
if (typeof t != "string") return z.
|
|
2157
|
+
if (typeof t != "string") return z.Mr(this.xt, t, (s) => this.Ei.Si(s));
|
|
2162
2158
|
const e = t, i = await new Promise((s, r) => {
|
|
2163
2159
|
const n = new Image();
|
|
2164
2160
|
n.crossOrigin = "anonymous", n.onload = () => s(n), n.onerror = (o) => r(o), n.src = e;
|
|
2165
2161
|
});
|
|
2166
|
-
return z.
|
|
2162
|
+
return z.Mr(this.xt, i, (s) => this.Ei.Si(s));
|
|
2167
2163
|
}
|
|
2168
2164
|
};
|
|
2169
2165
|
class $ {
|
|
2170
|
-
|
|
2166
|
+
Bn(t) {
|
|
2171
2167
|
const e = t.Pt(0), i = t.Pt(1), s = t.Pt(2), r = t.Pt(3);
|
|
2172
2168
|
return { characterPixels: e, primaryColorPixels: i, secondaryColorPixels: s, transformPixels: t.Pt(4), rotationPixels: r };
|
|
2173
2169
|
}
|
|
2174
|
-
|
|
2170
|
+
Dn(t, e) {
|
|
2175
2171
|
return t[e] + (t[e + 1] << 8);
|
|
2176
2172
|
}
|
|
2177
|
-
|
|
2173
|
+
Gn(t, e) {
|
|
2178
2174
|
return { r: t[e], g: t[e + 1], b: t[e + 2], a: t[e + 3] };
|
|
2179
2175
|
}
|
|
2180
2176
|
}
|
|
2181
2177
|
class J {
|
|
2182
|
-
|
|
2178
|
+
Ln(t, e) {
|
|
2183
2179
|
return new Blob([t], { type: e });
|
|
2184
2180
|
}
|
|
2185
|
-
|
|
2181
|
+
On(t, e, i) {
|
|
2186
2182
|
try {
|
|
2187
|
-
const s = this.
|
|
2183
|
+
const s = this.Ln(t, i), r = URL.createObjectURL(s), n = document.createElement("a");
|
|
2188
2184
|
n.href = r, n.download = e, n.style.display = "none", n.rel = "noopener", document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(r);
|
|
2189
2185
|
} catch (s) {
|
|
2190
2186
|
console.error("Failed to download file:", s);
|
|
2191
2187
|
}
|
|
2192
2188
|
}
|
|
2193
|
-
|
|
2189
|
+
kn() {
|
|
2194
2190
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace(/:/g, "-");
|
|
2195
2191
|
}
|
|
2196
|
-
|
|
2192
|
+
Hn() {
|
|
2197
2193
|
const t = /* @__PURE__ */ new Date();
|
|
2198
2194
|
return { date: t.toISOString().split("T")[0], time: t.toTimeString().split(" ")[0].replace(/:/g, "-") };
|
|
2199
2195
|
}
|
|
2200
|
-
|
|
2196
|
+
In(t) {
|
|
2201
2197
|
return t.replace(/[<>:"/\\|?*]/g, "_").replace(/\s+/g, "_").replace(/_{2,}/g, "_").replace(/^_+|_+$/g, "").substring(0, 255);
|
|
2202
2198
|
}
|
|
2203
|
-
|
|
2204
|
-
return "textmode-export-" + this.
|
|
2199
|
+
Nn() {
|
|
2200
|
+
return "textmode-export-" + this.kn();
|
|
2205
2201
|
}
|
|
2206
2202
|
}
|
|
2207
2203
|
class qt extends $ {
|
|
2208
|
-
|
|
2204
|
+
Xn(t, e, i) {
|
|
2209
2205
|
const s = t[i] === 255, r = t[i + 1] === 255, n = t[i + 2] === 255, o = e[i], c = e[i + 1];
|
|
2210
2206
|
return { isInverted: s, flipHorizontal: r, flipVertical: n, rotation: Math.round(360 * (o + c / 255) / 255 * 100) / 100 };
|
|
2211
2207
|
}
|
|
2212
|
-
|
|
2208
|
+
Wn(t, e, i) {
|
|
2213
2209
|
return { x: t, y: e, cellX: t * i.cellWidth, cellY: e * i.cellHeight };
|
|
2214
2210
|
}
|
|
2215
|
-
|
|
2211
|
+
Vn(t, e) {
|
|
2216
2212
|
const i = [];
|
|
2217
2213
|
let s = 0;
|
|
2218
2214
|
for (let r = 0; r < e.rows; r++) for (let n = 0; n < e.cols; n++) {
|
|
2219
|
-
const o = 4 * s, c = this.
|
|
2220
|
-
let l = this.
|
|
2221
|
-
const
|
|
2222
|
-
if (
|
|
2215
|
+
const o = 4 * s, c = this.Dn(t.characterPixels, o);
|
|
2216
|
+
let l = this.Gn(t.primaryColorPixels, o), u = this.Gn(t.secondaryColorPixels, o);
|
|
2217
|
+
const f = this.Xn(t.transformPixels, t.rotationPixels, o);
|
|
2218
|
+
if (f.isInverted) {
|
|
2223
2219
|
const v = l;
|
|
2224
|
-
l =
|
|
2220
|
+
l = u, u = v;
|
|
2225
2221
|
}
|
|
2226
|
-
const g = this.
|
|
2227
|
-
i.push({ charIndex: c, primaryColor: l, secondaryColor:
|
|
2222
|
+
const g = this.Wn(n, r, e);
|
|
2223
|
+
i.push({ charIndex: c, primaryColor: l, secondaryColor: u, transform: f, position: g }), s++;
|
|
2228
2224
|
}
|
|
2229
2225
|
return i;
|
|
2230
2226
|
}
|
|
2231
2227
|
}
|
|
2232
2228
|
class Zt {
|
|
2233
|
-
|
|
2229
|
+
Kn(t, e) {
|
|
2234
2230
|
const i = t.cmap;
|
|
2235
2231
|
for (const s of i.tables) if (s.format === 4) {
|
|
2236
2232
|
const r = s;
|
|
@@ -2253,72 +2249,72 @@ class Zt {
|
|
|
2253
2249
|
}
|
|
2254
2250
|
return 0;
|
|
2255
2251
|
}
|
|
2256
|
-
|
|
2252
|
+
jn(t, e, i, s, r) {
|
|
2257
2253
|
const n = r / t.head.unitsPerEm;
|
|
2258
|
-
return { getBoundingBox: () => ({ x1: i + e.xMin * n, y1: s + -e.yMax * n, x2: i + e.xMax * n, y2: s + -e.yMin * n }), toSVG: () => this.
|
|
2254
|
+
return { getBoundingBox: () => ({ x1: i + e.xMin * n, y1: s + -e.yMax * n, x2: i + e.xMax * n, y2: s + -e.yMin * n }), toSVG: () => this.Yn(e, i, s, n) };
|
|
2259
2255
|
}
|
|
2260
|
-
|
|
2256
|
+
Yn(t, e, i, s) {
|
|
2261
2257
|
if (!t || !t.xs) return "";
|
|
2262
2258
|
const { xs: r, ys: n, endPts: o, flags: c } = t;
|
|
2263
2259
|
if (!(r && n && o && c)) return "";
|
|
2264
|
-
let l = "",
|
|
2265
|
-
for (let
|
|
2266
|
-
const g = o[
|
|
2267
|
-
if (!(g <
|
|
2268
|
-
if (g >=
|
|
2269
|
-
const v = e + r[
|
|
2260
|
+
let l = "", u = 0;
|
|
2261
|
+
for (let f = 0; f < o.length; f++) {
|
|
2262
|
+
const g = o[f];
|
|
2263
|
+
if (!(g < u)) {
|
|
2264
|
+
if (g >= u) {
|
|
2265
|
+
const v = e + r[u] * s, m = i - n[u] * s;
|
|
2270
2266
|
l += `M${v.toFixed(2)},${m.toFixed(2)}`;
|
|
2271
|
-
let d =
|
|
2267
|
+
let d = u + 1;
|
|
2272
2268
|
for (; d <= g; )
|
|
2273
2269
|
if (1 & c[d]) {
|
|
2274
2270
|
const A = e + r[d] * s, p = i - n[d] * s;
|
|
2275
2271
|
l += `L${A.toFixed(2)},${p.toFixed(2)}`, d++;
|
|
2276
2272
|
} else {
|
|
2277
2273
|
const A = e + r[d] * s, p = i - n[d] * s;
|
|
2278
|
-
let
|
|
2279
|
-
if (1 & c[
|
|
2280
|
-
const x = e + r[
|
|
2281
|
-
l += `Q${A.toFixed(2)},${p.toFixed(2)} ${x.toFixed(2)},${C.toFixed(2)}`, d =
|
|
2274
|
+
let E = d + 1 > g ? u : d + 1;
|
|
2275
|
+
if (1 & c[E]) {
|
|
2276
|
+
const x = e + r[E] * s, C = i - n[E] * s;
|
|
2277
|
+
l += `Q${A.toFixed(2)},${p.toFixed(2)} ${x.toFixed(2)},${C.toFixed(2)}`, d = E + 1;
|
|
2282
2278
|
} else {
|
|
2283
|
-
const x = (A + (e + r[
|
|
2284
|
-
l += `Q${A.toFixed(2)},${p.toFixed(2)} ${x.toFixed(2)},${C.toFixed(2)}`, d =
|
|
2279
|
+
const x = (A + (e + r[E] * s)) / 2, C = (p + (i - n[E] * s)) / 2;
|
|
2280
|
+
l += `Q${A.toFixed(2)},${p.toFixed(2)} ${x.toFixed(2)},${C.toFixed(2)}`, d = E;
|
|
2285
2281
|
}
|
|
2286
2282
|
}
|
|
2287
2283
|
l += "Z";
|
|
2288
2284
|
}
|
|
2289
|
-
|
|
2285
|
+
u = g + 1;
|
|
2290
2286
|
}
|
|
2291
2287
|
}
|
|
2292
2288
|
return l;
|
|
2293
2289
|
}
|
|
2294
|
-
|
|
2295
|
-
const n = t.codePointAt(0) || 0, o = this.
|
|
2290
|
+
qn(t, e, i, s, r) {
|
|
2291
|
+
const n = t.codePointAt(0) || 0, o = this.Kn(e, n);
|
|
2296
2292
|
let c = null;
|
|
2297
|
-
return e.glyf && e.glyf[o] !== null ? c = e.glyf[o] : (c =
|
|
2293
|
+
return e.glyf && e.glyf[o] !== null ? c = e.glyf[o] : (c = L.T.glyf.Js(e, o), e.glyf[o] = c), this.jn(e, c, i, s, r);
|
|
2298
2294
|
}
|
|
2299
|
-
|
|
2300
|
-
const l = i + (r - c * (o / e.head.unitsPerEm)) / 2,
|
|
2301
|
-
return this.
|
|
2295
|
+
Zn(t, e, i, s, r, n, o, c) {
|
|
2296
|
+
const l = i + (r - c * (o / e.head.unitsPerEm)) / 2, u = s + (n + 0.7 * o) / 2;
|
|
2297
|
+
return this.qn(t, e, l, u, o).toSVG() || null;
|
|
2302
2298
|
}
|
|
2303
2299
|
}
|
|
2304
2300
|
class $t {
|
|
2305
2301
|
constructor() {
|
|
2306
|
-
h(this, "
|
|
2307
|
-
this.
|
|
2302
|
+
h(this, "Qn");
|
|
2303
|
+
this.Qn = new Zt();
|
|
2308
2304
|
}
|
|
2309
|
-
|
|
2305
|
+
Jn(t) {
|
|
2310
2306
|
const { width: e, height: i } = t;
|
|
2311
2307
|
return `<?xml version="1.0" encoding="UTF-8"?><svg width="${e}" height="${i}" viewBox="0 0 ${e} ${i}" xmlns="http://www.w3.org/2000/svg"><title>textmode.js sketch</title>`;
|
|
2312
2308
|
}
|
|
2313
|
-
|
|
2309
|
+
eo() {
|
|
2314
2310
|
return "</g></svg>";
|
|
2315
2311
|
}
|
|
2316
|
-
|
|
2312
|
+
so(t, e) {
|
|
2317
2313
|
if (!e.includeBackgroundRectangles) return "";
|
|
2318
2314
|
const [i, s, r, n] = e.backgroundColor;
|
|
2319
2315
|
return `<rect width="${t.width}" height="${t.height}" fill="rgba(${i},${s},${r},${n / 255})"/>`;
|
|
2320
2316
|
}
|
|
2321
|
-
|
|
2317
|
+
io(t, e) {
|
|
2322
2318
|
const { transform: i, position: s } = t;
|
|
2323
2319
|
if (!i.flipHorizontal && !i.flipVertical && !i.rotation) return "";
|
|
2324
2320
|
const r = s.cellX + e.cellWidth / 2, n = s.cellY + e.cellHeight / 2, o = [];
|
|
@@ -2328,76 +2324,76 @@ class $t {
|
|
|
2328
2324
|
}
|
|
2329
2325
|
return i.rotation && o.push(`rotate(${i.rotation} ${r} ${n})`), ` transform="${o.join(" ")}"`;
|
|
2330
2326
|
}
|
|
2331
|
-
|
|
2327
|
+
ro(t, e, i) {
|
|
2332
2328
|
if (!i.includeBackgroundRectangles || t.secondaryColor.a === 0) return "";
|
|
2333
2329
|
const { position: s } = t, { r, g: n, b: o, a: c } = t.secondaryColor, l = `rgba(${r},${n},${o},${c / 255})`;
|
|
2334
2330
|
return i.drawMode === "stroke" ? `<rect x="${s.cellX}" y="${s.cellY}" width="${e.cellWidth}" height="${e.cellHeight}" stroke="${l}" fill="none" stroke-width="${i.strokeWidth}"/>` : `<rect x="${s.cellX}" y="${s.cellY}" width="${e.cellWidth}" height="${e.cellHeight}" fill="${l}"/>`;
|
|
2335
2331
|
}
|
|
2336
|
-
|
|
2332
|
+
qn(t, e, i, s) {
|
|
2337
2333
|
const r = i.characters[t.charIndex];
|
|
2338
2334
|
if (!r) return "";
|
|
2339
|
-
const n = this.
|
|
2335
|
+
const n = this.Qn.Zn(r.character, i.font, t.position.cellX, t.position.cellY, e.cellWidth, e.cellHeight, i.fontSize, r.advanceWidth);
|
|
2340
2336
|
if (!n) return "";
|
|
2341
|
-
const { r: o, g: c, b: l, a:
|
|
2342
|
-
return s.drawMode === "stroke" ? `<path d="${n}" stroke="${
|
|
2337
|
+
const { r: o, g: c, b: l, a: u } = t.primaryColor, f = `rgba(${o},${c},${l},${u / 255})`;
|
|
2338
|
+
return s.drawMode === "stroke" ? `<path d="${n}" stroke="${f}" stroke-width="${s.strokeWidth}" fill="none"/>` : `<path d="${n}" fill="${f}"/>`;
|
|
2343
2339
|
}
|
|
2344
|
-
|
|
2345
|
-
const r = [], n = this.
|
|
2340
|
+
no(t, e, i, s) {
|
|
2341
|
+
const r = [], n = this.ro(t, e, s);
|
|
2346
2342
|
n && r.push(n);
|
|
2347
|
-
const o = this.
|
|
2343
|
+
const o = this.qn(t, e, i, s);
|
|
2348
2344
|
if (o) {
|
|
2349
|
-
const c = this.
|
|
2345
|
+
const c = this.io(t, e);
|
|
2350
2346
|
r.push(c ? `<g${c}>${o}</g>` : o);
|
|
2351
2347
|
}
|
|
2352
2348
|
return r.join("");
|
|
2353
2349
|
}
|
|
2354
|
-
|
|
2355
|
-
const r = [this.
|
|
2356
|
-
for (const n of t) r.push(this.
|
|
2357
|
-
return r.push(this.
|
|
2350
|
+
oo(t, e, i, s) {
|
|
2351
|
+
const r = [this.Jn(e), this.so(e, s), '<g id="ascii-cells">'];
|
|
2352
|
+
for (const n of t) r.push(this.no(n, e, i, s));
|
|
2353
|
+
return r.push(this.eo()), r.join("");
|
|
2358
2354
|
}
|
|
2359
|
-
|
|
2355
|
+
ao(t) {
|
|
2360
2356
|
return t.replace(/<path[^>]*d=""[^>]*\/>/g, "").replace(/\s+/g, " ").replace(/> </g, "><");
|
|
2361
2357
|
}
|
|
2362
2358
|
}
|
|
2363
2359
|
class Jt extends J {
|
|
2364
|
-
|
|
2365
|
-
return this.
|
|
2360
|
+
ho(t) {
|
|
2361
|
+
return this.Ln(t, "image/svg+xml;charset=utf-8");
|
|
2366
2362
|
}
|
|
2367
|
-
|
|
2368
|
-
this.
|
|
2363
|
+
co(t, e) {
|
|
2364
|
+
this.On(t, this.In(e) + ".svg", "image/svg+xml;charset=utf-8");
|
|
2369
2365
|
}
|
|
2370
|
-
|
|
2371
|
-
this.
|
|
2366
|
+
lo(t, e) {
|
|
2367
|
+
this.co(t, e || this.Nn());
|
|
2372
2368
|
}
|
|
2373
2369
|
}
|
|
2374
2370
|
class st {
|
|
2375
2371
|
constructor() {
|
|
2376
|
-
h(this, "
|
|
2377
|
-
h(this, "
|
|
2378
|
-
h(this, "
|
|
2379
|
-
this.
|
|
2372
|
+
h(this, "uo");
|
|
2373
|
+
h(this, "fo");
|
|
2374
|
+
h(this, "do");
|
|
2375
|
+
this.uo = new qt(), this.fo = new $t(), this.do = new Jt();
|
|
2380
2376
|
}
|
|
2381
|
-
|
|
2382
|
-
return { includeBackgroundRectangles: t.includeBackgroundRectangles ?? !0, drawMode: t.drawMode ?? "fill", strokeWidth: t.strokeWidth ?? 1, backgroundColor: t.backgroundColor ?? [0, 0, 0, 0], filename: t.filename || this.
|
|
2377
|
+
po(t) {
|
|
2378
|
+
return { includeBackgroundRectangles: t.includeBackgroundRectangles ?? !0, drawMode: t.drawMode ?? "fill", strokeWidth: t.strokeWidth ?? 1, backgroundColor: t.backgroundColor ?? [0, 0, 0, 0], filename: t.filename || this.do.Nn() };
|
|
2383
2379
|
}
|
|
2384
|
-
|
|
2385
|
-
const i = this.
|
|
2386
|
-
return this.
|
|
2380
|
+
mo(t, e = {}) {
|
|
2381
|
+
const i = this.uo.Vn(this.uo.Bn(t.pipeline), t.grid), s = this.fo.oo(i, t.grid, t.font, this.po(e));
|
|
2382
|
+
return this.fo.ao(s);
|
|
2387
2383
|
}
|
|
2388
|
-
|
|
2389
|
-
this.lo
|
|
2384
|
+
lo(t, e = {}) {
|
|
2385
|
+
this.do.lo(this.mo(t, e), e.filename);
|
|
2390
2386
|
}
|
|
2391
2387
|
}
|
|
2392
2388
|
class Qt extends $ {
|
|
2393
|
-
|
|
2389
|
+
_o(t, e, i, s = " ") {
|
|
2394
2390
|
var o;
|
|
2395
2391
|
const r = [];
|
|
2396
2392
|
let n = 0;
|
|
2397
2393
|
for (let c = 0; c < e.rows; c++) {
|
|
2398
2394
|
const l = [];
|
|
2399
|
-
for (let
|
|
2400
|
-
const
|
|
2395
|
+
for (let u = 0; u < e.cols; u++) {
|
|
2396
|
+
const f = 4 * n, g = this.Dn(t.characterPixels, f), v = ((o = i.characters[g]) == null ? void 0 : o.character) || s;
|
|
2401
2397
|
l.push(v), n++;
|
|
2402
2398
|
}
|
|
2403
2399
|
r.push(l);
|
|
@@ -2406,7 +2402,7 @@ class Qt extends $ {
|
|
|
2406
2402
|
}
|
|
2407
2403
|
}
|
|
2408
2404
|
class te {
|
|
2409
|
-
|
|
2405
|
+
vo(t, e) {
|
|
2410
2406
|
const i = [];
|
|
2411
2407
|
for (const r of t) {
|
|
2412
2408
|
let n = r.join("");
|
|
@@ -2419,35 +2415,35 @@ class te {
|
|
|
2419
2415
|
}
|
|
2420
2416
|
}
|
|
2421
2417
|
class ee extends J {
|
|
2422
|
-
|
|
2423
|
-
const i = this.
|
|
2424
|
-
this.
|
|
2418
|
+
yo(t, e) {
|
|
2419
|
+
const i = this.Ao(e);
|
|
2420
|
+
this.On(t, i, "text/plain;charset=utf-8");
|
|
2425
2421
|
}
|
|
2426
|
-
|
|
2427
|
-
let e = this.
|
|
2428
|
-
return e === ".txt" || e.length <= 4 ? this.
|
|
2422
|
+
Ao(t) {
|
|
2423
|
+
let e = this.In(t);
|
|
2424
|
+
return e === ".txt" || e.length <= 4 ? this.Nn() : e;
|
|
2429
2425
|
}
|
|
2430
2426
|
}
|
|
2431
2427
|
class rt {
|
|
2432
2428
|
constructor() {
|
|
2433
|
-
h(this, "
|
|
2434
|
-
h(this, "
|
|
2435
|
-
h(this, "
|
|
2436
|
-
this.
|
|
2429
|
+
h(this, "uo");
|
|
2430
|
+
h(this, "fo");
|
|
2431
|
+
h(this, "do");
|
|
2432
|
+
this.uo = new Qt(), this.fo = new te(), this.do = new ee();
|
|
2437
2433
|
}
|
|
2438
|
-
|
|
2439
|
-
return { preserveTrailingSpaces: t.preserveTrailingSpaces ?? !1, lineEnding: t.lineEnding ?? "lf", emptyCharacter: t.emptyCharacter ?? " ", filename: t.filename || this.
|
|
2434
|
+
po(t) {
|
|
2435
|
+
return { preserveTrailingSpaces: t.preserveTrailingSpaces ?? !1, lineEnding: t.lineEnding ?? "lf", emptyCharacter: t.emptyCharacter ?? " ", filename: t.filename || this.do.Nn() };
|
|
2440
2436
|
}
|
|
2441
|
-
|
|
2442
|
-
const i = this.
|
|
2443
|
-
return this.
|
|
2437
|
+
wo(t, e = {}) {
|
|
2438
|
+
const i = this.po(e), s = this.uo._o(this.uo.Bn(t.pipeline), t.grid, t.font, i.emptyCharacter);
|
|
2439
|
+
return this.fo.vo(s, i);
|
|
2444
2440
|
}
|
|
2445
|
-
|
|
2446
|
-
this.
|
|
2441
|
+
yo(t, e = {}) {
|
|
2442
|
+
this.do.yo(this.wo(t, e), e.filename);
|
|
2447
2443
|
}
|
|
2448
2444
|
}
|
|
2449
2445
|
class ie extends $ {
|
|
2450
|
-
|
|
2446
|
+
Co(t, e = 1, i = "transparent") {
|
|
2451
2447
|
const s = t.canvas;
|
|
2452
2448
|
if (e === 1 && i === "transparent") return s;
|
|
2453
2449
|
const r = document.createElement("canvas"), n = r.getContext("2d"), o = Math.round(s.width * e), c = Math.round(s.height * e);
|
|
@@ -2455,19 +2451,19 @@ class ie extends $ {
|
|
|
2455
2451
|
}
|
|
2456
2452
|
}
|
|
2457
2453
|
class se {
|
|
2458
|
-
|
|
2459
|
-
const i = this.
|
|
2454
|
+
bo(t, e) {
|
|
2455
|
+
const i = this.xo(e.format);
|
|
2460
2456
|
return e.format === "png" ? t.toDataURL(i) : t.toDataURL(i, e.quality);
|
|
2461
2457
|
}
|
|
2462
|
-
async
|
|
2458
|
+
async $o(t, e) {
|
|
2463
2459
|
return new Promise((i, s) => {
|
|
2464
|
-
const r = this.
|
|
2460
|
+
const r = this.xo(e.format), n = (o) => {
|
|
2465
2461
|
o ? i(o) : s(Error(`Failed to generate ${e.format.toUpperCase()} blob`));
|
|
2466
2462
|
};
|
|
2467
2463
|
e.format === "png" ? t.toBlob(n, r) : t.toBlob(n, r, e.quality);
|
|
2468
2464
|
});
|
|
2469
2465
|
}
|
|
2470
|
-
|
|
2466
|
+
xo(t) {
|
|
2471
2467
|
switch (t) {
|
|
2472
2468
|
case "png":
|
|
2473
2469
|
return "image/png";
|
|
@@ -2482,10 +2478,10 @@ class se {
|
|
|
2482
2478
|
}
|
|
2483
2479
|
const re = { png: "image/png", jpg: "image/jpeg", webp: "image/webp" }, nt = { png: ".png", jpg: ".jpg", webp: ".webp" };
|
|
2484
2480
|
class ne extends J {
|
|
2485
|
-
|
|
2486
|
-
this.
|
|
2481
|
+
Mo(t, e, i) {
|
|
2482
|
+
this.Fo(t, this.In(e) + nt[i]);
|
|
2487
2483
|
}
|
|
2488
|
-
|
|
2484
|
+
Fo(t, e) {
|
|
2489
2485
|
const i = URL.createObjectURL(t);
|
|
2490
2486
|
try {
|
|
2491
2487
|
const s = document.createElement("a");
|
|
@@ -2494,162 +2490,162 @@ class ne extends J {
|
|
|
2494
2490
|
URL.revokeObjectURL(i);
|
|
2495
2491
|
}
|
|
2496
2492
|
}
|
|
2497
|
-
|
|
2493
|
+
Ro(t) {
|
|
2498
2494
|
return t in re && t in nt;
|
|
2499
2495
|
}
|
|
2500
2496
|
}
|
|
2501
2497
|
class oe {
|
|
2502
2498
|
constructor() {
|
|
2503
|
-
h(this, "
|
|
2504
|
-
h(this, "
|
|
2505
|
-
h(this, "
|
|
2506
|
-
this.
|
|
2499
|
+
h(this, "uo");
|
|
2500
|
+
h(this, "fo");
|
|
2501
|
+
h(this, "do");
|
|
2502
|
+
this.uo = new ie(), this.fo = new se(), this.do = new ne();
|
|
2507
2503
|
}
|
|
2508
|
-
|
|
2509
|
-
return { format: t.format ?? "png", quality: t.quality ?? 1, scale: t.scale ?? 1, backgroundColor: t.backgroundColor ?? "transparent", filename: t.filename || this.
|
|
2504
|
+
po(t) {
|
|
2505
|
+
return { format: t.format ?? "png", quality: t.quality ?? 1, scale: t.scale ?? 1, backgroundColor: t.backgroundColor ?? "transparent", filename: t.filename || this.do.Nn() };
|
|
2510
2506
|
}
|
|
2511
|
-
|
|
2512
|
-
if (!this.
|
|
2507
|
+
zo(t) {
|
|
2508
|
+
if (!this.do.Ro(t.format)) throw Error(`Saving '${t.format}' files is not supported`);
|
|
2513
2509
|
if (t.quality < 0 || t.quality > 1) throw Error("Image quality must be between 0.0 and 1.0");
|
|
2514
2510
|
if (t.scale <= 0) throw Error("Scale factor must be greater than 0");
|
|
2515
2511
|
t.format === "jpg" && t.backgroundColor === "transparent" && (t.backgroundColor = "black");
|
|
2516
2512
|
}
|
|
2517
|
-
async
|
|
2518
|
-
if (e.scale === 1 && e.backgroundColor === "transparent") return await this.
|
|
2519
|
-
const i = this.
|
|
2520
|
-
return await this.
|
|
2513
|
+
async $o(t, e) {
|
|
2514
|
+
if (e.scale === 1 && e.backgroundColor === "transparent") return await this.fo.$o(t.canvas, e);
|
|
2515
|
+
const i = this.uo.Co(t, e.scale, e.backgroundColor);
|
|
2516
|
+
return await this.fo.$o(i, e);
|
|
2521
2517
|
}
|
|
2522
|
-
async
|
|
2523
|
-
const i = this.
|
|
2524
|
-
this.
|
|
2525
|
-
const s = await this
|
|
2526
|
-
this.
|
|
2518
|
+
async Mo(t, e = {}) {
|
|
2519
|
+
const i = this.po(e);
|
|
2520
|
+
this.zo(i);
|
|
2521
|
+
const s = await this.$o(t, i);
|
|
2522
|
+
this.do.Mo(s, i.filename, i.format);
|
|
2527
2523
|
}
|
|
2528
2524
|
}
|
|
2529
2525
|
const ae = (a) => class extends a {
|
|
2530
|
-
|
|
2531
|
-
this.xt.St(this.
|
|
2526
|
+
Po() {
|
|
2527
|
+
this.xt.St(this.To);
|
|
2532
2528
|
}
|
|
2533
2529
|
toString(t = {}) {
|
|
2534
|
-
return this.
|
|
2530
|
+
return this.Po(), new rt().wo({ pipeline: this.So, grid: this.hn, font: this.Ei }, t);
|
|
2535
2531
|
}
|
|
2536
2532
|
saveStrings(t = {}) {
|
|
2537
|
-
this.
|
|
2533
|
+
this.Po(), new rt().yo({ pipeline: this.So, grid: this.hn, font: this.Ei }, t);
|
|
2538
2534
|
}
|
|
2539
2535
|
toSVG(t = {}) {
|
|
2540
|
-
return this.
|
|
2536
|
+
return this.Po(), new st().mo({ pipeline: this.So, grid: this.hn, font: this.Ei }, t);
|
|
2541
2537
|
}
|
|
2542
2538
|
saveSVG(t = {}) {
|
|
2543
|
-
this.
|
|
2539
|
+
this.Po(), new st().lo({ pipeline: this.So, grid: this.hn, font: this.Ei }, t);
|
|
2544
2540
|
}
|
|
2545
2541
|
async saveCanvas(t = {}) {
|
|
2546
|
-
await new oe().
|
|
2542
|
+
await new oe().Mo(this.er, t);
|
|
2547
2543
|
}
|
|
2548
2544
|
}, he = (a) => class extends a {
|
|
2549
2545
|
async loadFont(t) {
|
|
2550
|
-
return this.
|
|
2551
|
-
const e = this.
|
|
2552
|
-
this.
|
|
2546
|
+
return this.Ei.qi(t).then(() => {
|
|
2547
|
+
const e = this.Ei.maxGlyphDimensions;
|
|
2548
|
+
this.hn.nr(e.width, e.height), this.So.resize(this.hn.cols, this.hn.rows), this.xt.Qs(), this.Eo.bn();
|
|
2553
2549
|
});
|
|
2554
2550
|
}
|
|
2555
2551
|
fontSize(t) {
|
|
2556
|
-
if (!
|
|
2557
|
-
this.
|
|
2558
|
-
const e = this.
|
|
2559
|
-
this.
|
|
2552
|
+
if (!G.v(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) || this.Ei.fontSize === t) return;
|
|
2553
|
+
this.Ei.Yi(t);
|
|
2554
|
+
const e = this.Ei.maxGlyphDimensions;
|
|
2555
|
+
this.hn.nr(e.width, e.height), this.So.resize(this.hn.cols, this.hn.rows), this.xt.Qs(), this.Eo.bn();
|
|
2560
2556
|
}
|
|
2561
2557
|
glyphColor(t) {
|
|
2562
|
-
return this.
|
|
2558
|
+
return this.Ei.Ti(t);
|
|
2563
2559
|
}
|
|
2564
2560
|
glyphColors(t) {
|
|
2565
|
-
return this.Si
|
|
2561
|
+
return this.Ei.Si(t);
|
|
2566
2562
|
}
|
|
2567
2563
|
}, ce = (a) => class extends a {
|
|
2568
2564
|
get frameCount() {
|
|
2569
|
-
return this.
|
|
2565
|
+
return this.Bo.frameCount;
|
|
2570
2566
|
}
|
|
2571
2567
|
set frameCount(t) {
|
|
2572
|
-
this.
|
|
2568
|
+
this.Bo.frameCount = t;
|
|
2573
2569
|
}
|
|
2574
2570
|
frameRate(t) {
|
|
2575
|
-
return t === void 0 ? this.
|
|
2571
|
+
return t === void 0 ? this.Bo.currentFrameRate : this.Bo.frameRate(t, () => this.Do());
|
|
2576
2572
|
}
|
|
2577
2573
|
noLoop() {
|
|
2578
|
-
this.
|
|
2574
|
+
this.Bo.pause();
|
|
2579
2575
|
}
|
|
2580
2576
|
loop() {
|
|
2581
|
-
this.
|
|
2577
|
+
this.Bo.resume(() => this.Do());
|
|
2582
2578
|
}
|
|
2583
2579
|
redraw(t = 1) {
|
|
2584
|
-
if (
|
|
2580
|
+
if (G.v(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.Do();
|
|
2585
2581
|
}
|
|
2586
2582
|
isLooping() {
|
|
2587
|
-
return this.
|
|
2583
|
+
return this.Bo.isLooping;
|
|
2588
2584
|
}
|
|
2589
2585
|
}, le = (a) => class extends a {
|
|
2590
2586
|
constructor(...t) {
|
|
2591
2587
|
super(...t);
|
|
2592
2588
|
}
|
|
2593
2589
|
mouseClicked(t) {
|
|
2594
|
-
this.
|
|
2590
|
+
this.Eo.Pn(t);
|
|
2595
2591
|
}
|
|
2596
2592
|
mousePressed(t) {
|
|
2597
|
-
this.
|
|
2593
|
+
this.Eo.Zr(t);
|
|
2598
2594
|
}
|
|
2599
2595
|
mouseReleased(t) {
|
|
2600
|
-
this.
|
|
2596
|
+
this.Eo.Qr(t);
|
|
2601
2597
|
}
|
|
2602
2598
|
mouseMoved(t) {
|
|
2603
|
-
this.
|
|
2599
|
+
this.Eo.Tn(t);
|
|
2604
2600
|
}
|
|
2605
2601
|
mouseScrolled(t) {
|
|
2606
|
-
this.
|
|
2602
|
+
this.Eo.Sn(t);
|
|
2607
2603
|
}
|
|
2608
2604
|
get mouse() {
|
|
2609
|
-
return this.
|
|
2605
|
+
return this.Eo.En();
|
|
2610
2606
|
}
|
|
2611
2607
|
}, ue = (a) => class extends a {
|
|
2612
2608
|
constructor(...t) {
|
|
2613
2609
|
super(...t);
|
|
2614
2610
|
}
|
|
2615
2611
|
keyPressed(t) {
|
|
2616
|
-
this.
|
|
2612
|
+
this.Go.Zr(t);
|
|
2617
2613
|
}
|
|
2618
2614
|
keyReleased(t) {
|
|
2619
|
-
this.
|
|
2615
|
+
this.Go.Qr(t);
|
|
2620
2616
|
}
|
|
2621
2617
|
isKeyPressed(t) {
|
|
2622
|
-
return this.
|
|
2618
|
+
return this.Go.Jr(t);
|
|
2623
2619
|
}
|
|
2624
2620
|
get lastKeyPressed() {
|
|
2625
|
-
return this.
|
|
2621
|
+
return this.Go.en();
|
|
2626
2622
|
}
|
|
2627
2623
|
get lastKeyReleased() {
|
|
2628
|
-
return this.
|
|
2624
|
+
return this.Go.sn();
|
|
2629
2625
|
}
|
|
2630
2626
|
get pressedKeys() {
|
|
2631
|
-
return this.
|
|
2627
|
+
return this.Go.rn();
|
|
2632
2628
|
}
|
|
2633
2629
|
get modifierState() {
|
|
2634
|
-
return this.
|
|
2630
|
+
return this.Go.nn();
|
|
2635
2631
|
}
|
|
2636
2632
|
};
|
|
2637
2633
|
class fe {
|
|
2638
2634
|
constructor() {
|
|
2639
2635
|
h(this, "xt");
|
|
2640
|
-
h(this, "
|
|
2641
|
-
h(this, "
|
|
2642
|
-
h(this, "
|
|
2643
|
-
h(this, "To");
|
|
2644
|
-
h(this, "Po");
|
|
2645
|
-
h(this, "Eo");
|
|
2646
|
-
h(this, "Ro");
|
|
2647
|
-
h(this, "zo");
|
|
2636
|
+
h(this, "Ei");
|
|
2637
|
+
h(this, "er");
|
|
2638
|
+
h(this, "hn");
|
|
2648
2639
|
h(this, "Bo");
|
|
2640
|
+
h(this, "Eo");
|
|
2649
2641
|
h(this, "Go");
|
|
2650
|
-
h(this, "
|
|
2642
|
+
h(this, "To");
|
|
2643
|
+
h(this, "So");
|
|
2644
|
+
h(this, "Lo");
|
|
2645
|
+
h(this, "Oo");
|
|
2646
|
+
h(this, "ko");
|
|
2651
2647
|
}
|
|
2652
|
-
|
|
2648
|
+
Do() {
|
|
2653
2649
|
}
|
|
2654
2650
|
}
|
|
2655
2651
|
class de extends function(e, ...i) {
|
|
@@ -2657,78 +2653,78 @@ class de extends function(e, ...i) {
|
|
|
2657
2653
|
}(fe, Kt, ae, he, ce, le, ue) {
|
|
2658
2654
|
constructor(e = {}) {
|
|
2659
2655
|
super();
|
|
2660
|
-
h(this, "
|
|
2661
|
-
h(this, "
|
|
2656
|
+
h(this, "Ho", !1);
|
|
2657
|
+
h(this, "Io", () => {
|
|
2662
2658
|
});
|
|
2663
|
-
h(this, "
|
|
2659
|
+
h(this, "No", () => {
|
|
2664
2660
|
});
|
|
2665
|
-
h(this, "
|
|
2661
|
+
h(this, "Xo", () => {
|
|
2666
2662
|
});
|
|
2667
|
-
h(this, "
|
|
2668
|
-
h(this, "
|
|
2669
|
-
h(this, "
|
|
2670
|
-
h(this, "
|
|
2671
|
-
this.
|
|
2672
|
-
}
|
|
2673
|
-
async
|
|
2674
|
-
await this.
|
|
2675
|
-
const i = this.
|
|
2676
|
-
this.
|
|
2677
|
-
}
|
|
2678
|
-
|
|
2679
|
-
this.
|
|
2680
|
-
this.
|
|
2681
|
-
}, window.addEventListener("resize", this.
|
|
2682
|
-
this.
|
|
2683
|
-
}), window.ResizeObserver && this.
|
|
2684
|
-
this.resizeCanvas(this.
|
|
2685
|
-
}), this.
|
|
2686
|
-
}
|
|
2687
|
-
|
|
2688
|
-
if (this.
|
|
2689
|
-
if (this.
|
|
2663
|
+
h(this, "Wo");
|
|
2664
|
+
h(this, "cr");
|
|
2665
|
+
h(this, "hr", !1);
|
|
2666
|
+
h(this, "Vo");
|
|
2667
|
+
this.hr = e.overlay ?? !1, this.er = new kt(e), this.xt = new Bt(this.er._r()), this.Ei = new Xt(this.xt, e.fontSize ?? 16), this.Bo = new Yt(e.frameRate ?? 60), this.Eo = new jt(this.er), this.Go = new Vt(), this.To = this.xt.Tt(), this.Lo = this.xt.re(), this.Ko(e);
|
|
2668
|
+
}
|
|
2669
|
+
async Ko(e) {
|
|
2670
|
+
await this.Ei.Vi(e.fontSource);
|
|
2671
|
+
const i = this.Ei.maxGlyphDimensions;
|
|
2672
|
+
this.hn = new Ht(this.er.canvas, i.width, i.height), this.Eo.Vi(this.hn), this.So = this.xt.Ys(this.hn.cols, this.hn.rows, 5), this.Oo = this.xt.Ys(this.hn.width, this.hn.height, 1), this.hr && (this.Vo = z.Mr(this.xt, this.er.targetCanvas, (s) => this.Ei.Si(s))), this.ko = this.xt.ae(ht, "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.jo(), this.Io(), this.Bo.start(() => this.Do());
|
|
2673
|
+
}
|
|
2674
|
+
jo() {
|
|
2675
|
+
this.Wo = () => {
|
|
2676
|
+
this.hr && this.resizeCanvas(this.er.targetCanvas.width, this.er.targetCanvas.height), this.Xo();
|
|
2677
|
+
}, window.addEventListener("resize", this.Wo), this.Eo.Kr(), this.Go.Kr(), window.addEventListener("blur", () => {
|
|
2678
|
+
this.Go.an();
|
|
2679
|
+
}), window.ResizeObserver && this.hr && (this.cr = new ResizeObserver(() => {
|
|
2680
|
+
this.resizeCanvas(this.er.targetCanvas.width, this.er.targetCanvas.height);
|
|
2681
|
+
}), this.cr.observe(this.er.targetCanvas));
|
|
2682
|
+
}
|
|
2683
|
+
Do() {
|
|
2684
|
+
if (this.Bo.measureFrameRate(), this.Bo.incrementFrame(), this.Ho) return;
|
|
2685
|
+
if (this.hr) {
|
|
2690
2686
|
const i = this.xt.context;
|
|
2691
|
-
i.bindTexture(i.TEXTURE_2D, this.
|
|
2692
|
-
}
|
|
2693
|
-
this.
|
|
2687
|
+
i.bindTexture(i.TEXTURE_2D, this.Vo.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);
|
|
2688
|
+
}
|
|
2689
|
+
this.So.begin(), this.xt.Gs(this.To), this.No(), this.xt.St(this.To), this.So.end(), this.Oo.begin(), this.xt.Gs(this.Lo), this.Lo.Vt({ U0: this.Ei.fontFramebuffer, U1: [this.Ei.textureColumns, this.Ei.textureRows], U2: this.So.textures[0], U3: this.So.textures[1], U4: this.So.textures[2], U5: this.So.textures[4], U6: this.So.textures[3], U7: [this.hn.cols, this.hn.rows], U8: [this.Oo.width, this.Oo.height], U9: this.Oo.width / this.Oo.height }), this.xt.Ns(0, 0, this.er.width, this.er.height), this.Oo.end();
|
|
2694
2690
|
const e = this.xt.state.canvasBackgroundColor;
|
|
2695
|
-
this.xt.Ne(e[0], e[1], e[2], e[3]), this.xt.
|
|
2691
|
+
this.xt.Ne(e[0], e[1], e[2], e[3]), this.xt.Gs(this.ko), this.ko.Vt({ Ua: this.Oo.textures[0], Ub: [this.Oo.width, this.Oo.height], Uc: [this.hn.offsetX, this.hn.offsetY], Ud: [this.hn.width, this.hn.height] }), this.xt.Ns(this.hn.offsetX, this.hn.offsetY, this.hn.width, this.hn.height);
|
|
2696
2692
|
}
|
|
2697
2693
|
setup(e) {
|
|
2698
|
-
this.
|
|
2694
|
+
this.Io = e;
|
|
2699
2695
|
}
|
|
2700
2696
|
draw(e) {
|
|
2701
|
-
this.
|
|
2697
|
+
this.No = e;
|
|
2702
2698
|
}
|
|
2703
2699
|
windowResized(e) {
|
|
2704
|
-
this.
|
|
2700
|
+
this.Xo = e;
|
|
2705
2701
|
}
|
|
2706
2702
|
resizeCanvas(e, i) {
|
|
2707
|
-
this.
|
|
2703
|
+
this.er.gr(e, i), this.hn.rr(), this.So.resize(this.hn.cols, this.hn.rows), this.Oo.resize(this.hn.width, this.hn.height), this.xt.Qs(), this.Eo.bn(), this.Do();
|
|
2708
2704
|
}
|
|
2709
2705
|
destroy() {
|
|
2710
|
-
this.
|
|
2706
|
+
this.Ho || (this.Bo.stop(), window.removeEventListener("resize", this.Wo), this.Eo.qr(), this.Go.qr(), this.Ei.Dt(), this.xt.Dt(), this.Oo.Dt(), this.ko.Dt(), this.Vo && this.Vo.Dt(), this.Ho = !0);
|
|
2711
2707
|
}
|
|
2712
2708
|
get grid() {
|
|
2713
|
-
return this.
|
|
2709
|
+
return this.hn;
|
|
2714
2710
|
}
|
|
2715
2711
|
get font() {
|
|
2716
|
-
return this.
|
|
2712
|
+
return this.Ei;
|
|
2717
2713
|
}
|
|
2718
2714
|
get width() {
|
|
2719
|
-
return this.
|
|
2715
|
+
return this.er.width;
|
|
2720
2716
|
}
|
|
2721
2717
|
get height() {
|
|
2722
|
-
return this.
|
|
2718
|
+
return this.er.height;
|
|
2723
2719
|
}
|
|
2724
2720
|
get canvas() {
|
|
2725
|
-
return this.
|
|
2721
|
+
return this.er.canvas;
|
|
2726
2722
|
}
|
|
2727
2723
|
get isDisposed() {
|
|
2728
|
-
return this.
|
|
2724
|
+
return this.Ho;
|
|
2729
2725
|
}
|
|
2730
2726
|
get overlay() {
|
|
2731
|
-
return this.
|
|
2727
|
+
return this.Vo;
|
|
2732
2728
|
}
|
|
2733
2729
|
}
|
|
2734
2730
|
class Q {
|
|
@@ -2738,17 +2734,17 @@ class Q {
|
|
|
2738
2734
|
return new de(t);
|
|
2739
2735
|
}
|
|
2740
2736
|
static setErrorLevel(t) {
|
|
2741
|
-
|
|
2737
|
+
G.A(t);
|
|
2742
2738
|
}
|
|
2743
2739
|
static get version() {
|
|
2744
|
-
return "0.2.1-beta.
|
|
2740
|
+
return "0.2.1-beta.7";
|
|
2745
2741
|
}
|
|
2746
2742
|
}
|
|
2747
2743
|
const pe = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), me = Q.create, ve = Q.setErrorLevel, Ae = Q.version;
|
|
2748
2744
|
export {
|
|
2749
2745
|
kt as TextmodeCanvas,
|
|
2750
2746
|
ut as TextmodeErrorLevel,
|
|
2751
|
-
|
|
2747
|
+
Xt as TextmodeFont,
|
|
2752
2748
|
q as TextmodeFramebuffer,
|
|
2753
2749
|
Ht as TextmodeGrid,
|
|
2754
2750
|
z as TextmodeImage,
|