textmode.js 0.8.0-beta.1 → 0.8.0-beta.3
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
CHANGED
|
@@ -28,12 +28,12 @@ ${"↓".repeat(24)}
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
var $t = ((n) => (n[n.SILENT = 0] = "SILENT", n[n.WARNING = 1] = "WARNING", n[n.ERROR = 2] = "ERROR", n[n.THROW = 3] = "THROW", n))($t || {});
|
|
31
|
-
const
|
|
31
|
+
const I = class I {
|
|
32
32
|
constructor() {
|
|
33
33
|
a(this, "l", { globalLevel: 3 });
|
|
34
34
|
}
|
|
35
35
|
static u() {
|
|
36
|
-
return
|
|
36
|
+
return I.h || (I.h = new I()), I.h;
|
|
37
37
|
}
|
|
38
38
|
v(t, e) {
|
|
39
39
|
const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.", r = "color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;";
|
|
@@ -55,8 +55,8 @@ const B = class B {
|
|
|
55
55
|
this.l.globalLevel = t;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
a(
|
|
59
|
-
let ut =
|
|
58
|
+
a(I, "h", null);
|
|
59
|
+
let ut = I;
|
|
60
60
|
const vt = ut.u();
|
|
61
61
|
class q {
|
|
62
62
|
constructor(t, e, i) {
|
|
@@ -115,7 +115,7 @@ class q {
|
|
|
115
115
|
const u = this.H(t);
|
|
116
116
|
return o.uniform1i(i, u), o.activeTexture(o.TEXTURE0 + u), void o.bindTexture(o.TEXTURE_2D, e);
|
|
117
117
|
}
|
|
118
|
-
if (e instanceof
|
|
118
|
+
if (e instanceof X) {
|
|
119
119
|
const u = this.H(t);
|
|
120
120
|
return o.uniform1i(i, u), o.activeTexture(o.TEXTURE0 + u), void o.bindTexture(o.TEXTURE_2D, e.textures[0]);
|
|
121
121
|
}
|
|
@@ -149,7 +149,7 @@ function mt(n, t, e, i) {
|
|
|
149
149
|
function Y(n, t, e, i) {
|
|
150
150
|
return Math.hypot(e - n, i - t);
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function O(n, t, e) {
|
|
153
153
|
return Math.min(Math.max(n, t), e);
|
|
154
154
|
}
|
|
155
155
|
function xt(n) {
|
|
@@ -168,7 +168,7 @@ function Rt(n, t, e, i, r) {
|
|
|
168
168
|
n.bindBuffer(t, e), n.bufferData(t, i, r), n.bindBuffer(t, null);
|
|
169
169
|
}
|
|
170
170
|
const rt = `#version 300 es
|
|
171
|
-
in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in vec4 A7;in vec3 A8;in vec3 A9;in vec4 Aa;in vec4 Ab;in vec3 Ac;uniform vec2 Ur;uniform float Us;uniform float Ut;out vec2 v_uv;out vec3 v_glyphIndex;out vec4 v_glyphColor;out vec4 v_cellColor;out vec4 v_glyphFlags;out vec3 v_worldPosition;out vec3 v_normal;out float v_geometryType;const float A=6.28318530718f;const int B=2;const int C=3;const int D=4;vec2 E(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float M=L*K;float N=F*F;float O=N*F;return M*G+3.0f*L*F*H+3.0f*K*N*I+O*J;}vec2 P(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float N=F*F;return-3.0f*L*G+3.0f*(L-2.0f*K*F)*H+3.0f*(2.0f*K*F-N)*I+3.0f*N*J;}vec3 Q(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x,R.y*T-R.z*U,R.y*U+R.z*T);}vec3 V(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T+R.z*U,R.y,-R.x*U+R.z*T);}vec3 W(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T-R.y*U,R.x*U+R.y*T,R.z);}vec3 X(vec3 R,vec3 Y){vec3 Z=R;if(Y.z!=0.0f){Z=W(Z,Y.z);}if(Y.y!=0.0f){Z=V(Z,Y.y);}if(Y.x!=0.0f){Z=Q(Z,Y.x);}return Z;}void main(){v_uv=A1;v_glyphIndex=A4;v_glyphColor=A5;v_cellColor=A6;v_glyphFlags=A7;vec4 a=Aa;vec4 b=Ab;vec2 c=A3;vec2 d=A2;float e=Ac.x;float f=Ac.y;int g=int(Ac.z);vec2 h=d;vec2 i=h+c*0.5f;float j=f+e*0.5f;vec3 k=vec3(i,j);vec3 l;if(g==D){float F=clamp(A0.x,0.0f,1.0f);vec2 G=b.xy;vec2 H=a.xy;vec2 I=a.zw;vec2 J=b.zw;vec2 m=E(F,G,H,I,J);vec2 n=P(F,G,H,I,J);float o=length(n);vec2 p=o>0.0f?n/o:vec2(1.0f,0.0f);vec2 q=vec2(-p.y,p.x);vec2 r=m;vec2 s=r+q*A0.y*c.y;l=vec3(s,f);}else if(g==C){float t=mod(a.x,A);if(t<0.0f){t+=A;}float u=mod(a.y,A);if(u<0.0f){u+=A;}float v=t-u;if(v<=0.0f){v+=A;}float S=t-A0.x*v;vec2 w=vec2(cos(S),sin(S))*A0.y;vec2 s=w*c+h;l=vec3(s,f);}else if(g==B){vec2 s=A0.xy*c+h;l=vec3(s,f);}vec3 x=X(l,A9);vec3 y=x+A8;vec3 z=vec3(0.0f,0.0f,1.0f);v_worldPosition=y;v_normal=z;v_geometryType=float(g);vec2 AA=(y.xy/Ur)*2.0f;AA.y=-AA.y;float AB=y.z/Ur.y;float AC=clamp(-AB*Us,-0.99f,0.99f);if(Ut>0.5f){gl_Position=vec4(AA,AC,1.0f);}else{float AD=0.5f;float AE=1.0f/(1.0f-AB*AD);AA*=AE;gl_Position=vec4(AA,AC,1.0f);}}`,
|
|
171
|
+
in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in vec4 A7;in vec3 A8;in vec3 A9;in vec4 Aa;in vec4 Ab;in vec3 Ac;uniform vec2 Ur;uniform float Us;uniform float Ut;out vec2 v_uv;out vec3 v_glyphIndex;out vec4 v_glyphColor;out vec4 v_cellColor;out vec4 v_glyphFlags;out vec3 v_worldPosition;out vec3 v_normal;out float v_geometryType;const float A=6.28318530718f;const int B=2;const int C=3;const int D=4;vec2 E(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float M=L*K;float N=F*F;float O=N*F;return M*G+3.0f*L*F*H+3.0f*K*N*I+O*J;}vec2 P(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float N=F*F;return-3.0f*L*G+3.0f*(L-2.0f*K*F)*H+3.0f*(2.0f*K*F-N)*I+3.0f*N*J;}vec3 Q(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x,R.y*T-R.z*U,R.y*U+R.z*T);}vec3 V(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T+R.z*U,R.y,-R.x*U+R.z*T);}vec3 W(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T-R.y*U,R.x*U+R.y*T,R.z);}vec3 X(vec3 R,vec3 Y){vec3 Z=R;if(Y.z!=0.0f){Z=W(Z,Y.z);}if(Y.y!=0.0f){Z=V(Z,Y.y);}if(Y.x!=0.0f){Z=Q(Z,Y.x);}return Z;}void main(){v_uv=A1;v_glyphIndex=A4;v_glyphColor=A5;v_cellColor=A6;v_glyphFlags=A7;vec4 a=Aa;vec4 b=Ab;vec2 c=A3;vec2 d=A2;float e=Ac.x;float f=Ac.y;int g=int(Ac.z);vec2 h=d;vec2 i=h+c*0.5f;float j=f+e*0.5f;vec3 k=vec3(i,j);vec3 l;if(g==D){float F=clamp(A0.x,0.0f,1.0f);vec2 G=b.xy;vec2 H=a.xy;vec2 I=a.zw;vec2 J=b.zw;vec2 m=E(F,G,H,I,J);vec2 n=P(F,G,H,I,J);float o=length(n);vec2 p=o>0.0f?n/o:vec2(1.0f,0.0f);vec2 q=vec2(-p.y,p.x);vec2 r=m;vec2 s=r+q*A0.y*c.y;l=vec3(s,f);}else if(g==C){float t=mod(a.x,A);if(t<0.0f){t+=A;}float u=mod(a.y,A);if(u<0.0f){u+=A;}float v=t-u;if(v<=0.0f){v+=A;}float S=t-A0.x*v;vec2 w=vec2(cos(S),sin(S))*A0.y;vec2 s=w*c+h;l=vec3(s,f);}else if(g==B){vec2 s=A0.xy*c+h;l=vec3(s,f);}vec3 x=X(l,A9);vec3 y=x+A8;vec3 z=vec3(0.0f,0.0f,1.0f);v_worldPosition=y;v_normal=z;v_geometryType=float(g);vec2 AA=(y.xy/Ur)*2.0f;AA.y=-AA.y;float AB=y.z/Ur.y;float AC=clamp(-AB*Us,-0.99f,0.99f);if(Ut>0.5f){gl_Position=vec4(AA,AC,1.0f);}else{float AD=0.5f;float AE=1.0f/(1.0f-AB*AD);AA*=AE;gl_Position=vec4(AA,AC,1.0f);}}`, Z = class Z {
|
|
172
172
|
constructor(t, e, i = e, r = 1, s = {}, h) {
|
|
173
173
|
a(this, "N");
|
|
174
174
|
a(this, "X");
|
|
@@ -181,10 +181,10 @@ in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in
|
|
|
181
181
|
a(this, "Z");
|
|
182
182
|
a(this, "q", null);
|
|
183
183
|
a(this, "V", /* @__PURE__ */ new Map());
|
|
184
|
-
this.N = e, this.X = i, this.A = t, this.W =
|
|
184
|
+
this.N = e, this.X = i, this.A = t, this.W = O(r, 1, 8), this.Z = h, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...s }, Z.J || (Z.J = new q(t, rt, `#version 300 es
|
|
185
185
|
precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uniform sampler2D U2;uniform sampler2D U3;uniform vec2 U4;uniform bool U5;uniform bool U6;uniform bool U7;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){vec2 B=vec2(v_uv.x,1.-v_uv.y);vec2 C=B*U4;vec2 D=(floor(C)+0.5f)/U4;vec4 E=texture(U0,D);vec4 F=U5?texture(U1,D):vec4(0.);if(U5&&F.a==0.){discard;}vec4 G=U6?texture(U2,D):vec4(0.);vec4 H=U7?texture(U3,D):vec4(0.);o_character=E;o_primaryColor=F;o_secondaryColor=G;A=H;}`));
|
|
186
186
|
const o = t.getParameter(t.MAX_DRAW_BUFFERS), c = t.getParameter(t.MAX_COLOR_ATTACHMENTS);
|
|
187
|
-
this.W = Math.min(this.W, o, c), this.Y = t.createFramebuffer(), this.tt(), this.st(), this.l.depth && this.
|
|
187
|
+
this.W = Math.min(this.W, o, c), this.Y = t.createFramebuffer(), this.tt(), this.st(), this.l.depth && this.it();
|
|
188
188
|
}
|
|
189
189
|
tt() {
|
|
190
190
|
const t = this.A, e = this.l.filter === "linear" ? t.LINEAR : t.NEAREST, i = this.l.wrap === "repeat" ? t.REPEAT : t.CLAMP_TO_EDGE, r = this.l.type === "float" ? t.FLOAT : t.UNSIGNED_BYTE, s = r === t.FLOAT ? t.RGBA32F : t.RGBA8, h = t.RGBA;
|
|
@@ -207,11 +207,11 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
|
|
|
207
207
|
}
|
|
208
208
|
t.bindFramebuffer(t.FRAMEBUFFER, null);
|
|
209
209
|
}
|
|
210
|
-
|
|
210
|
+
it() {
|
|
211
211
|
const t = this.A;
|
|
212
212
|
this.K = t.createRenderbuffer(), t.bindRenderbuffer(t.RENDERBUFFER, this.K), t.renderbufferStorage(t.RENDERBUFFER, t.DEPTH_COMPONENT24, this.N, this.X), t.bindFramebuffer(t.FRAMEBUFFER, this.Y), t.framebufferRenderbuffer(t.FRAMEBUFFER, t.DEPTH_ATTACHMENT, t.RENDERBUFFER, this.K), t.bindFramebuffer(t.FRAMEBUFFER, null), t.bindRenderbuffer(t.RENDERBUFFER, null);
|
|
213
213
|
}
|
|
214
|
-
|
|
214
|
+
et(t) {
|
|
215
215
|
Tt(this.A, this.j[0], t);
|
|
216
216
|
}
|
|
217
217
|
resize(t, e) {
|
|
@@ -244,7 +244,7 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
|
|
|
244
244
|
}
|
|
245
245
|
ft() {
|
|
246
246
|
if (!this.Z) return;
|
|
247
|
-
const t = this.W > 1, e = this.W > 2, i = this.W > 3, r = { U0: this.j[0], U1: t ? this.j[1] : this.j[0], U2: e ? this.j[2] : this.j[0], U3: i ? this.j[3] : this.j[0], U4: [this.N, this.X], U5: t, U6: e, U7: i }, s =
|
|
247
|
+
const t = this.W > 1, e = this.W > 2, i = this.W > 3, r = { U0: this.j[0], U1: t ? this.j[1] : this.j[0], U2: e ? this.j[2] : this.j[0], U3: i ? this.j[3] : this.j[0], U4: [this.N, this.X], U5: t, U6: e, U7: i }, s = Z.J;
|
|
248
248
|
this.q = this.Z.vt.dt(s, r, !0);
|
|
249
249
|
}
|
|
250
250
|
gt() {
|
|
@@ -266,8 +266,8 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
|
|
|
266
266
|
return this.W;
|
|
267
267
|
}
|
|
268
268
|
};
|
|
269
|
-
a(
|
|
270
|
-
let
|
|
269
|
+
a(Z, "J", null);
|
|
270
|
+
let X = Z;
|
|
271
271
|
const Ct = /* @__PURE__ */ new WeakMap();
|
|
272
272
|
function ht(n, t) {
|
|
273
273
|
Ct.set(n, t);
|
|
@@ -389,7 +389,7 @@ class st {
|
|
|
389
389
|
return this.xt;
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
const dt = new Float32Array([-0.5, -0.5, 0, 0, 0.5, -0.5, 1, 0, -0.5, 0.5, 0, 1, -0.5, 0.5, 0, 1, 0.5, -0.5, 1, 0, 0.5, 0.5, 1, 1]),
|
|
392
|
+
const dt = new Float32Array([-0.5, -0.5, 0, 0, 0.5, -0.5, 1, 0, -0.5, 0.5, 0, 1, -0.5, 0.5, 0, 1, 0.5, -0.5, 1, 0, 0.5, 0.5, 1, 1]), k = { _s: 16, As: WebGL2RenderingContext.TRIANGLES, ws: { bs: { size: 2, offset: 0 }, Cs: { size: 2, offset: 8 } } };
|
|
393
393
|
class te {
|
|
394
394
|
constructor(t) {
|
|
395
395
|
a(this, "A");
|
|
@@ -438,9 +438,9 @@ class ie {
|
|
|
438
438
|
for (const [, t] of this.Ps) for (const [, e] of t) e && this.A.deleteVertexArray(e);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
const
|
|
441
|
+
const D = class D {
|
|
442
442
|
static Rs(t, e, i = 0) {
|
|
443
|
-
const r = e || new Float32Array(
|
|
443
|
+
const r = e || new Float32Array(D.FLOATS_PER_INSTANCE);
|
|
444
444
|
let s = i;
|
|
445
445
|
r[s++] = t.bs[0], r[s++] = t.bs[1], r[s++] = t.Ss[0], r[s++] = t.Ss[1], r[s++] = t.Nt[0], r[s++] = t.Nt[1], r[s++] = t.Nt[2], r[s++] = t.Xt[0], r[s++] = t.Xt[1], r[s++] = t.Xt[2], r[s++] = t.Xt[3], r[s++] = t.Yt[0], r[s++] = t.Yt[1], r[s++] = t.Yt[2], r[s++] = t.Yt[3], r[s++] = t.zs[0], r[s++] = t.zs[1], r[s++] = t.zs[2], r[s++] = t.Rt;
|
|
446
446
|
const h = t.ks;
|
|
@@ -451,16 +451,16 @@ const O = class O {
|
|
|
451
451
|
return g ? (r[s++] = (f == null ? void 0 : f[0]) ?? 0, r[s++] = (f == null ? void 0 : f[1]) ?? 0, r[s++] = (d == null ? void 0 : d[0]) ?? 0, r[s++] = (d == null ? void 0 : d[1]) ?? 0, r[s++] = l[0], r[s++] = l[1], r[s++] = u[0], r[s++] = u[1]) : !g && !!c ? (r[s++] = c[0], r[s++] = c[1], r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0) : (r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0), r[s++] = t.Gs ?? 0, r[s++] = t.Qs ?? 0, r[s++] = t.Ns ?? 0, r;
|
|
452
452
|
}
|
|
453
453
|
static Xs(t, e) {
|
|
454
|
-
const i = t.length *
|
|
454
|
+
const i = t.length * D.FLOATS_PER_INSTANCE, r = e || new Float32Array(i);
|
|
455
455
|
for (let s = 0; s < t.length; s++) {
|
|
456
|
-
const h = s *
|
|
457
|
-
|
|
456
|
+
const h = s * D.FLOATS_PER_INSTANCE;
|
|
457
|
+
D.Rs(t[s], r, h);
|
|
458
458
|
}
|
|
459
459
|
return r;
|
|
460
460
|
}
|
|
461
461
|
};
|
|
462
|
-
a(
|
|
463
|
-
let N =
|
|
462
|
+
a(D, "BYTES_PER_INSTANCE", 144), a(D, "FLOATS_PER_INSTANCE", 36);
|
|
463
|
+
let N = D;
|
|
464
464
|
const M = class M {
|
|
465
465
|
};
|
|
466
466
|
a(M, "STRIDE", N.BYTES_PER_INSTANCE), a(M, "ATTRIBUTES", { A2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 0, divisor: 1 }, A3: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 8, divisor: 1 }, A4: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 16, divisor: 1 }, A5: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 28, divisor: 1 }, A6: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 44, divisor: 1 }, A7: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 60, divisor: 1 }, A8: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 76, divisor: 1 }, A9: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 88, divisor: 1 }, Aa: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 100, divisor: 1 }, Ab: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 116, divisor: 1 }, Ac: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 132, divisor: 1 } });
|
|
@@ -489,22 +489,22 @@ class re {
|
|
|
489
489
|
Js(t) {
|
|
490
490
|
this.Ws += t, this.Zs++;
|
|
491
491
|
}
|
|
492
|
-
|
|
492
|
+
ti() {
|
|
493
493
|
this.Ws = 0, this.Zs = 0;
|
|
494
494
|
}
|
|
495
|
-
|
|
495
|
+
si(t = 0, e) {
|
|
496
496
|
return this.Ys.subarray(t, e ?? this.Ws);
|
|
497
497
|
}
|
|
498
|
-
get
|
|
498
|
+
get ii() {
|
|
499
499
|
return this.Zs;
|
|
500
500
|
}
|
|
501
|
-
get
|
|
501
|
+
get ei() {
|
|
502
502
|
return this.js;
|
|
503
503
|
}
|
|
504
|
-
get
|
|
504
|
+
get ri() {
|
|
505
505
|
return this.Ws;
|
|
506
506
|
}
|
|
507
|
-
get
|
|
507
|
+
get ni() {
|
|
508
508
|
return this.Zs === 0;
|
|
509
509
|
}
|
|
510
510
|
}
|
|
@@ -513,46 +513,46 @@ class se {
|
|
|
513
513
|
a(this, "Ys");
|
|
514
514
|
this.Ys = t;
|
|
515
515
|
}
|
|
516
|
-
|
|
517
|
-
this.Ys.qs(this.Ys.
|
|
516
|
+
oi(t) {
|
|
517
|
+
this.Ys.qs(this.Ys.ii + 1);
|
|
518
518
|
const { buffer: e, offset: i } = this.Ys.Vs();
|
|
519
519
|
e[i + 0] = t.x, e[i + 1] = t.y, e[i + 2] = t.width, e[i + 3] = t.height, e[i + 4] = t.char0, e[i + 5] = t.char1, e[i + 6] = t.char2, e[i + 7] = t.r1, e[i + 8] = t.g1, e[i + 9] = t.b1, e[i + 10] = t.a1, e[i + 11] = t.r2, e[i + 12] = t.g2, e[i + 13] = t.b2, e[i + 14] = t.a2, e[i + 15] = t.invert, e[i + 16] = t.flipX, e[i + 17] = t.flipY, e[i + 18] = t.charRot, e[i + 19] = t.translationX, e[i + 20] = t.translationY, e[i + 21] = t.translationZ, e[i + 22] = t.rotationX, e[i + 23] = t.rotationY, e[i + 24] = t.rotationZ;
|
|
520
520
|
const r = t.curveParams0, s = t.curveParams1;
|
|
521
|
-
return e[i + 25] = r[0], e[i + 26] = r[1], e[i + 27] = r[2], e[i + 28] = r[3], e[i + 29] = s[0], e[i + 30] = s[1], e[i + 31] = s[2], e[i + 32] = s[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Ys.Js(N.FLOATS_PER_INSTANCE), this.Ys.
|
|
521
|
+
return e[i + 25] = r[0], e[i + 26] = r[1], e[i + 27] = r[2], e[i + 28] = r[3], e[i + 29] = s[0], e[i + 30] = s[1], e[i + 31] = s[2], e[i + 32] = s[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Ys.Js(N.FLOATS_PER_INSTANCE), this.Ys.ii - 1;
|
|
522
522
|
}
|
|
523
|
-
get
|
|
524
|
-
return this.Ys.
|
|
523
|
+
get ii() {
|
|
524
|
+
return this.Ys.ii;
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
527
|
class ne {
|
|
528
528
|
constructor(t, e = 1e3) {
|
|
529
529
|
a(this, "A");
|
|
530
|
-
a(this, "
|
|
531
|
-
a(this, "
|
|
532
|
-
a(this, "
|
|
533
|
-
this.A = t, this.
|
|
530
|
+
a(this, "hi", null);
|
|
531
|
+
a(this, "ai", 0);
|
|
532
|
+
a(this, "ci", /* @__PURE__ */ new Map());
|
|
533
|
+
this.A = t, this.li(e);
|
|
534
534
|
}
|
|
535
|
-
|
|
535
|
+
li(t) {
|
|
536
536
|
const e = this.A;
|
|
537
|
-
this.
|
|
537
|
+
this.hi && e.deleteBuffer(this.hi), this.hi = e.createBuffer();
|
|
538
538
|
const i = t * N.BYTES_PER_INSTANCE;
|
|
539
|
-
Rt(e, e.ARRAY_BUFFER, this.
|
|
539
|
+
Rt(e, e.ARRAY_BUFFER, this.hi, i, e.DYNAMIC_DRAW), this.ai = t;
|
|
540
540
|
}
|
|
541
|
-
|
|
542
|
-
this.
|
|
541
|
+
ui(t) {
|
|
542
|
+
this.li(t);
|
|
543
543
|
}
|
|
544
|
-
get
|
|
545
|
-
return this.
|
|
544
|
+
get ei() {
|
|
545
|
+
return this.ai;
|
|
546
546
|
}
|
|
547
|
-
|
|
547
|
+
fi(t, e) {
|
|
548
548
|
if (e === 0) return;
|
|
549
549
|
const i = this.A;
|
|
550
|
-
i.bindBuffer(i.ARRAY_BUFFER, this.
|
|
550
|
+
i.bindBuffer(i.ARRAY_BUFFER, this.hi);
|
|
551
551
|
const r = e * N.FLOATS_PER_INSTANCE;
|
|
552
552
|
i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, r);
|
|
553
553
|
}
|
|
554
|
-
|
|
555
|
-
let e = this.
|
|
554
|
+
di(t) {
|
|
555
|
+
let e = this.ci.get(t);
|
|
556
556
|
if (!e) {
|
|
557
557
|
e = /* @__PURE__ */ new Map();
|
|
558
558
|
const i = this.A;
|
|
@@ -560,220 +560,220 @@ class ne {
|
|
|
560
560
|
const s = i.getAttribLocation(t, r);
|
|
561
561
|
s !== -1 && e.set(r, s);
|
|
562
562
|
}
|
|
563
|
-
this.
|
|
563
|
+
this.ci.set(t, e);
|
|
564
564
|
}
|
|
565
565
|
return e;
|
|
566
566
|
}
|
|
567
|
-
|
|
568
|
-
const e = this.A, i = t.G, r = this.
|
|
567
|
+
pi(t) {
|
|
568
|
+
const e = this.A, i = t.G, r = this.di(i);
|
|
569
569
|
for (const [s, h] of r) {
|
|
570
570
|
const o = W.ATTRIBUTES[s];
|
|
571
571
|
o && ft(e, h, o.size, o.stride, o.offset, o.divisor, o.type, o.normalized);
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
|
-
|
|
575
|
-
const e = this.A, i = this.
|
|
574
|
+
gi(t) {
|
|
575
|
+
const e = this.A, i = this.di(t.G);
|
|
576
576
|
for (const [r, s] of i)
|
|
577
577
|
W.ATTRIBUTES[r] && (e.disableVertexAttribArray(s), e.vertexAttribDivisor(s, 0));
|
|
578
578
|
}
|
|
579
579
|
gt() {
|
|
580
|
-
this.
|
|
580
|
+
this.hi && (this.A.deleteBuffer(this.hi), this.hi = null), this.ci.clear();
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
class he {
|
|
584
584
|
constructor(t, e = 1e3, i = 1.5) {
|
|
585
585
|
a(this, "A");
|
|
586
586
|
a(this, "Ys");
|
|
587
|
-
a(this, "
|
|
588
|
-
a(this, "
|
|
589
|
-
this.A = t, this.Ys = new re(e, i), this.
|
|
587
|
+
a(this, "mi");
|
|
588
|
+
a(this, "_i");
|
|
589
|
+
this.A = t, this.Ys = new re(e, i), this.mi = new se(this.Ys), this._i = new ne(t, e);
|
|
590
590
|
}
|
|
591
|
-
|
|
591
|
+
yi(t) {
|
|
592
592
|
var r, s, h, o, c, l, u, f, d, g;
|
|
593
593
|
const e = [0, 0, 0, 0], i = [0, 0, 0, 0];
|
|
594
|
-
return t.Os && t.Bs ? (e[0] = ((r = t.Is) == null ? void 0 : r[0]) ?? 0, e[1] = ((s = t.Is) == null ? void 0 : s[1]) ?? 0, e[2] = ((h = t.Hs) == null ? void 0 : h[0]) ?? 0, e[3] = ((o = t.Hs) == null ? void 0 : o[1]) ?? 0, i[0] = t.Os[0], i[1] = t.Os[1], i[2] = t.Bs[0], i[3] = t.Bs[1]) : t.Ls && (e[0] = t.Ls[0], e[1] = t.Ls[1]), this.
|
|
594
|
+
return t.Os && t.Bs ? (e[0] = ((r = t.Is) == null ? void 0 : r[0]) ?? 0, e[1] = ((s = t.Is) == null ? void 0 : s[1]) ?? 0, e[2] = ((h = t.Hs) == null ? void 0 : h[0]) ?? 0, e[3] = ((o = t.Hs) == null ? void 0 : o[1]) ?? 0, i[0] = t.Os[0], i[1] = t.Os[1], i[2] = t.Bs[0], i[3] = t.Bs[1]) : t.Ls && (e[0] = t.Ls[0], e[1] = t.Ls[1]), this.oi({ x: t.bs[0], y: t.bs[1], width: t.Ss[0], height: t.Ss[1], char0: t.Nt[0], char1: t.Nt[1], char2: t.Nt[2], r1: t.Xt[0], g1: t.Xt[1], b1: t.Xt[2], a1: t.Xt[3], r2: t.Yt[0], g2: t.Yt[1], b2: t.Yt[2], a2: t.Yt[3], invert: t.zs[0], flipX: t.zs[1], flipY: t.zs[2], charRot: t.Rt, translationX: ((c = t.ks) == null ? void 0 : c[0]) ?? 0, translationY: ((l = t.ks) == null ? void 0 : l[1]) ?? 0, translationZ: ((u = t.ks) == null ? void 0 : u[2]) ?? 0, rotationX: ((f = t.Ds) == null ? void 0 : f[0]) ?? 0, rotationY: ((d = t.Ds) == null ? void 0 : d[1]) ?? 0, rotationZ: ((g = t.Ds) == null ? void 0 : g[2]) ?? 0, curveParams0: e, curveParams1: i, depth: t.Gs || 0, baseZ: t.Qs || 0, geometryType: t.Ns || 0 });
|
|
595
595
|
}
|
|
596
|
-
|
|
597
|
-
const e = this.
|
|
598
|
-
return this.Ys.
|
|
596
|
+
oi(t) {
|
|
597
|
+
const e = this.mi.oi(t);
|
|
598
|
+
return this.Ys.ei > this._i.ei && this._i.ui(this.Ys.ei), e;
|
|
599
599
|
}
|
|
600
|
-
get
|
|
601
|
-
return this.Ys.
|
|
600
|
+
get Ai() {
|
|
601
|
+
return this.Ys.ii;
|
|
602
602
|
}
|
|
603
|
-
get
|
|
604
|
-
return this.Ys.
|
|
603
|
+
get ni() {
|
|
604
|
+
return this.Ys.ni;
|
|
605
605
|
}
|
|
606
|
-
|
|
607
|
-
this.Ys.
|
|
606
|
+
wi() {
|
|
607
|
+
this.Ys.ti();
|
|
608
608
|
}
|
|
609
|
-
|
|
610
|
-
const e = this.Ys.
|
|
609
|
+
pi(t) {
|
|
610
|
+
const e = this.Ys.ii;
|
|
611
611
|
if (e === 0) return;
|
|
612
|
-
const i = this.Ys.
|
|
613
|
-
this.
|
|
612
|
+
const i = this.Ys.si();
|
|
613
|
+
this._i.fi(i, e), this._i.pi(t);
|
|
614
614
|
}
|
|
615
|
-
|
|
616
|
-
this.
|
|
615
|
+
gi(t) {
|
|
616
|
+
this._i.gi(t);
|
|
617
617
|
}
|
|
618
618
|
$s(t, e) {
|
|
619
|
-
const i = this.Ys.
|
|
619
|
+
const i = this.Ys.ii;
|
|
620
620
|
i !== 0 && this.A.drawArraysInstanced(t, 0, e, i);
|
|
621
621
|
}
|
|
622
622
|
gt() {
|
|
623
|
-
this.
|
|
623
|
+
this._i.gt();
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
class
|
|
626
|
+
class _ {
|
|
627
627
|
constructor(t, e, i, r) {
|
|
628
628
|
a(this, "A");
|
|
629
|
-
a(this, "
|
|
630
|
-
a(this, "
|
|
631
|
-
a(this, "
|
|
632
|
-
a(this, "
|
|
633
|
-
this.A = t, this.
|
|
629
|
+
a(this, "bi");
|
|
630
|
+
a(this, "Ci");
|
|
631
|
+
a(this, "xi");
|
|
632
|
+
a(this, "Mi", null);
|
|
633
|
+
this.A = t, this.bi = e, this.Ci = i, this.xi = r;
|
|
634
634
|
const s = this.A.createBuffer();
|
|
635
|
-
Rt(this.A, this.A.ARRAY_BUFFER, s, this.
|
|
635
|
+
Rt(this.A, this.A.ARRAY_BUFFER, s, this.xi.Fi, this.A.STATIC_DRAW), this.Mi = s;
|
|
636
636
|
}
|
|
637
637
|
get type() {
|
|
638
|
-
return this.
|
|
638
|
+
return this.Ci;
|
|
639
639
|
}
|
|
640
640
|
get unitGeometry() {
|
|
641
|
-
return this.
|
|
641
|
+
return this.xi;
|
|
642
642
|
}
|
|
643
643
|
get unitBuffer() {
|
|
644
|
-
return this.
|
|
644
|
+
return this.Mi;
|
|
645
645
|
}
|
|
646
646
|
get batch() {
|
|
647
|
-
return this.
|
|
647
|
+
return this.bi;
|
|
648
648
|
}
|
|
649
|
-
|
|
650
|
-
this.
|
|
649
|
+
$i() {
|
|
650
|
+
this.bi.wi();
|
|
651
651
|
}
|
|
652
|
-
|
|
653
|
-
return !this.
|
|
652
|
+
Pi() {
|
|
653
|
+
return !this.bi.ni;
|
|
654
654
|
}
|
|
655
655
|
gt() {
|
|
656
|
-
this.
|
|
656
|
+
this.bi.gt(), this.A.deleteBuffer(this.Mi);
|
|
657
657
|
}
|
|
658
|
-
|
|
659
|
-
return this.
|
|
658
|
+
Ti(t, e, i) {
|
|
659
|
+
return this.bi.yi(t);
|
|
660
660
|
}
|
|
661
|
-
|
|
661
|
+
Ei(t, e, i, r, s, h) {
|
|
662
662
|
const o = s.Bt ?? 0, c = s.It ?? 0, l = s.Ht ?? 0, u = s.bt ?? 0, f = s.Ct ?? 0, d = s.xt ?? 0, g = [0, 0, 0, 0], p = [0, 0, 0, 0];
|
|
663
663
|
h && (h.bezStartX !== void 0 && h.bezStartY !== void 0 && h.bezEndX !== void 0 && h.bezEndY !== void 0 ? (g[0] = h.cp1x ?? 0, g[1] = h.cp1y ?? 0, g[2] = h.cp2x ?? 0, g[3] = h.cp2y ?? 0, p[0] = h.bezStartX ?? 0, p[1] = h.bezStartY ?? 0, p[2] = h.bezEndX ?? 0, p[3] = h.bezEndY ?? 0) : h.arcStart === void 0 && h.arcStop === void 0 || (g[0] = h.arcStart ?? 0, g[1] = h.arcStop ?? 0));
|
|
664
|
-
const v = { x: t, y: e, width: i, height: r, char0: s.Nt[0], char1: s.Nt[1], char2: s.Nt[2], r1: s.Xt[0], g1: s.Xt[1], b1: s.Xt[2], a1: s.Xt[3], r2: s.Yt[0], g2: s.Yt[1], b2: s.Yt[2], a2: s.Yt[3], invert: s.Et ? 1 : 0, flipX: s.Gt ? 1 : 0, flipY: s.Qt ? 1 : 0, charRot: s.Rt, translationX: o, translationY: c, translationZ: l, rotationX: u, rotationY: f, rotationZ: d, curveParams0: g, curveParams1: p, depth: (h == null ? void 0 : h.depth) ?? 0, baseZ: (h == null ? void 0 : h.baseZ) ?? 0, geometryType: ee[this.
|
|
665
|
-
return this.
|
|
664
|
+
const v = { x: t, y: e, width: i, height: r, char0: s.Nt[0], char1: s.Nt[1], char2: s.Nt[2], r1: s.Xt[0], g1: s.Xt[1], b1: s.Xt[2], a1: s.Xt[3], r2: s.Yt[0], g2: s.Yt[1], b2: s.Yt[2], a2: s.Yt[3], invert: s.Et ? 1 : 0, flipX: s.Gt ? 1 : 0, flipY: s.Qt ? 1 : 0, charRot: s.Rt, translationX: o, translationY: c, translationZ: l, rotationX: u, rotationY: f, rotationZ: d, curveParams0: g, curveParams1: p, depth: (h == null ? void 0 : h.depth) ?? 0, baseZ: (h == null ? void 0 : h.baseZ) ?? 0, geometryType: ee[this.Ci] ?? 0 };
|
|
665
|
+
return this.bi.oi(v);
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
|
-
const oe = {
|
|
668
|
+
const oe = { Fi: dt, Ri: 6, ...k }, ae = { Fi: 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]), Ri: 6, ...k }, ce = { Fi: function(n = 32) {
|
|
669
669
|
const t = [], e = 2 * Math.PI / n;
|
|
670
670
|
for (let i = 0; i < n; i++) {
|
|
671
671
|
const r = i * e, s = (i + 1) % n * e, h = Math.cos(r), o = Math.sin(r), c = 0.5 * (h + 1), l = 0.5 * (o + 1), u = Math.cos(s), f = Math.sin(s), d = 0.5 * (u + 1), g = 0.5 * (f + 1);
|
|
672
672
|
t.push(0, 0, 0.5, 0.5, h, o, c, l, u, f, d, g);
|
|
673
673
|
}
|
|
674
674
|
return new Float32Array(t);
|
|
675
|
-
}(32),
|
|
676
|
-
let le = {
|
|
675
|
+
}(32), Ri: 96, ...k };
|
|
676
|
+
let le = { Fi: function(n) {
|
|
677
677
|
const t = [];
|
|
678
678
|
for (let e = 0; e < n; e++) {
|
|
679
679
|
const i = e / n, r = (e + 1) / n;
|
|
680
680
|
t.push(i, 0, i, 0, i, 1, i, 1, r, 1, r, 1);
|
|
681
681
|
}
|
|
682
682
|
return new Float32Array(t);
|
|
683
|
-
}(32),
|
|
684
|
-
const ue = {
|
|
683
|
+
}(32), Ri: 96, ...k };
|
|
684
|
+
const ue = { Fi: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ri: 3, ...k }, fe = { Fi: function(n = 16) {
|
|
685
685
|
const t = [];
|
|
686
686
|
for (let e = 0; e < n; e++) {
|
|
687
687
|
const i = e / n, r = (e + 1) / n;
|
|
688
688
|
t.push(i, -0.5, i, 0, r, -0.5, r, 0, i, 0.5, i, 1, i, 0.5, i, 1, r, -0.5, r, 0, r, 0.5, r, 1);
|
|
689
689
|
}
|
|
690
690
|
return new Float32Array(t);
|
|
691
|
-
}(16),
|
|
691
|
+
}(16), Ri: 96, ...k }, de = { [w.RECTANGLE]: class extends _ {
|
|
692
692
|
constructor(n, t) {
|
|
693
693
|
super(n, t, w.RECTANGLE, oe);
|
|
694
694
|
}
|
|
695
|
-
|
|
696
|
-
return this.
|
|
695
|
+
yi(n, t) {
|
|
696
|
+
return this.Ei(0, 0, n.width, n.height, t);
|
|
697
697
|
}
|
|
698
|
-
}, [w.LINE]: class extends
|
|
698
|
+
}, [w.LINE]: class extends _ {
|
|
699
699
|
constructor(n, t) {
|
|
700
700
|
super(n, t, w.LINE, ae);
|
|
701
701
|
}
|
|
702
|
-
|
|
702
|
+
yi(n, t) {
|
|
703
703
|
const e = n.x2 - n.x1, i = n.y2 - n.y1, r = Math.hypot(e, i), s = Math.atan2(i, e), h = t.Ot || 1, o = n.x1 + e / 2 - r / 2, c = n.y1 + i / 2, l = { ...t, xt: (t.xt || 0) + s };
|
|
704
|
-
return this.
|
|
704
|
+
return this.Ei(o, c, r, h, l);
|
|
705
705
|
}
|
|
706
|
-
}, [w.ELLIPSE]: class extends
|
|
706
|
+
}, [w.ELLIPSE]: class extends _ {
|
|
707
707
|
constructor(n, t) {
|
|
708
708
|
super(n, t, w.ELLIPSE, ce);
|
|
709
709
|
}
|
|
710
|
-
|
|
711
|
-
return this.
|
|
710
|
+
yi(n, t) {
|
|
711
|
+
return this.Ei(0, 0, n.width, n.height, t);
|
|
712
712
|
}
|
|
713
|
-
}, [w.ARC]: class extends
|
|
713
|
+
}, [w.ARC]: class extends _ {
|
|
714
714
|
constructor(n, t) {
|
|
715
715
|
super(n, t, w.ARC, le);
|
|
716
716
|
}
|
|
717
|
-
|
|
717
|
+
yi(n, t) {
|
|
718
718
|
const e = n.start * Math.PI / 180, i = n.stop * Math.PI / 180;
|
|
719
|
-
return this.
|
|
719
|
+
return this.Ei(0, 0, n.width, n.height, t, { arcStart: e, arcStop: i });
|
|
720
720
|
}
|
|
721
|
-
}, [w.TRIANGLE]: class extends
|
|
721
|
+
}, [w.TRIANGLE]: class extends _ {
|
|
722
722
|
constructor(n, t) {
|
|
723
723
|
super(n, t, w.TRIANGLE, ue);
|
|
724
724
|
}
|
|
725
|
-
|
|
725
|
+
yi(n, t) {
|
|
726
726
|
const e = Math.min(n.x1, n.x2, n.x3), i = Math.max(n.x1, n.x2, n.x3), r = Math.min(n.y1, n.y2, n.y3), s = i - e, h = Math.max(n.y1, n.y2, n.y3) - r;
|
|
727
|
-
return this.
|
|
727
|
+
return this.Ei(e, r, s, h, t);
|
|
728
728
|
}
|
|
729
|
-
}, [w.BEZIER_CURVE]: class extends
|
|
729
|
+
}, [w.BEZIER_CURVE]: class extends _ {
|
|
730
730
|
constructor(n, t) {
|
|
731
731
|
super(n, t, w.BEZIER_CURVE, fe);
|
|
732
732
|
}
|
|
733
|
-
|
|
734
|
-
return this.
|
|
733
|
+
yi(n, t) {
|
|
734
|
+
return this.Ei(0, 0, 1, t.Ot || 1, t, { cp1x: n.cp1x, cp1y: n.cp1y, cp2x: n.cp2x, cp2y: n.cp2y, bezStartX: n.x1, bezStartY: n.y1, bezEndX: n.x2, bezEndY: n.y2 });
|
|
735
735
|
}
|
|
736
736
|
} };
|
|
737
737
|
class ge {
|
|
738
738
|
constructor(t) {
|
|
739
739
|
a(this, "A");
|
|
740
|
-
a(this, "
|
|
741
|
-
a(this, "
|
|
742
|
-
this.A = t, this.
|
|
740
|
+
a(this, "Si");
|
|
741
|
+
a(this, "zi");
|
|
742
|
+
this.A = t, this.zi = new ie(t), this.Si = /* @__PURE__ */ new Map();
|
|
743
743
|
for (const e of Object.values(w)) {
|
|
744
744
|
const i = new he(t), r = new de[e](t, i);
|
|
745
|
-
this.
|
|
745
|
+
this.Si.set(e, r);
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
|
-
|
|
749
|
-
this.
|
|
750
|
-
this.
|
|
748
|
+
ki(t) {
|
|
749
|
+
this.Di(t).forEach((e) => {
|
|
750
|
+
this.Li(e);
|
|
751
751
|
});
|
|
752
752
|
}
|
|
753
|
-
|
|
753
|
+
Di(t) {
|
|
754
754
|
const e = [];
|
|
755
755
|
let i = null, r = null, s = null;
|
|
756
756
|
for (const h of t) r !== h.material || s !== h.type ? (i && i.length > 0 && e.push({ material: r, type: s, commands: i }), i = [h], r = h.material, s = h.type) : i.push(h);
|
|
757
757
|
return i && i.length > 0 && e.push({ material: r, type: s, commands: i }), e;
|
|
758
758
|
}
|
|
759
|
-
|
|
760
|
-
const { material: e, type: i, commands: r } = t, s = this.
|
|
759
|
+
Li(t) {
|
|
760
|
+
const { material: e, type: i, commands: r } = t, s = this.Si.get(i);
|
|
761
761
|
e.shader.D(), e.shader.O(e.uniforms);
|
|
762
762
|
const h = Ft(this.A), o = r.length > 0 && r[0].state.zt;
|
|
763
|
-
if (e.shader.O({ Uu: h[2] / h[3], Ur: [h[2], h[3]], Us: 1, Ut: o ? 1 : 0 }), s
|
|
764
|
-
s.
|
|
765
|
-
}), s
|
|
763
|
+
if (e.shader.O({ Uu: h[2] / h[3], Ur: [h[2], h[3]], Us: 1, Ut: o ? 1 : 0 }), s.$i(), r.forEach((c) => {
|
|
764
|
+
s.yi(c.params, c.state);
|
|
765
|
+
}), s.Pi()) {
|
|
766
766
|
const c = s.unitGeometry, l = s.unitBuffer;
|
|
767
767
|
try {
|
|
768
|
-
this.
|
|
768
|
+
this.zi.Ts(e.shader.G, i + "", c, l), s.batch.pi(e.shader), s.batch.$s(c.As, c.Ri);
|
|
769
769
|
} finally {
|
|
770
|
-
s.batch.
|
|
770
|
+
s.batch.gi(e.shader), this.zi.Es(), s.$i();
|
|
771
771
|
}
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
774
|
gt() {
|
|
775
|
-
for (const t of this.
|
|
776
|
-
this.
|
|
775
|
+
for (const t of this.Si.values()) t.gt();
|
|
776
|
+
this.Si.clear(), this.zi.gt();
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
779
|
function Mt(n) {
|
|
@@ -795,35 +795,35 @@ function G(n, t) {
|
|
|
795
795
|
}
|
|
796
796
|
class pe {
|
|
797
797
|
constructor(t) {
|
|
798
|
-
a(this, "
|
|
799
|
-
a(this, "
|
|
800
|
-
a(this, "
|
|
801
|
-
a(this, "
|
|
802
|
-
this.
|
|
803
|
-
precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellColor;in vec4 v_glyphFlags;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){int B=int(v_glyphFlags.r>0.5?1:0);int C=int(v_glyphFlags.g>0.5?1:0);int D=int(v_glyphFlags.b>0.5?1:0);float E=float(B|(C<<1)|(D<<2))/255.;o_character=vec4(v_glyphIndex.xy,E,clamp(v_glyphFlags.a,0.,1.));o_primaryColor=vec4(v_glyphColor.rgb,v_glyphColor.a);o_secondaryColor=vec4(v_cellColor.rgb,v_cellColor.a);A=vec4(0.);}`), this.
|
|
798
|
+
a(this, "Oi", 0);
|
|
799
|
+
a(this, "Bi");
|
|
800
|
+
a(this, "Ii");
|
|
801
|
+
a(this, "Hi", /* @__PURE__ */ new Map());
|
|
802
|
+
this.Bi = new q(t, rt, `#version 300 es
|
|
803
|
+
precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellColor;in vec4 v_glyphFlags;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){int B=int(v_glyphFlags.r>0.5?1:0);int C=int(v_glyphFlags.g>0.5?1:0);int D=int(v_glyphFlags.b>0.5?1:0);float E=float(B|(C<<1)|(D<<2))/255.;o_character=vec4(v_glyphIndex.xy,E,clamp(v_glyphFlags.a,0.,1.));o_primaryColor=vec4(v_glyphColor.rgb,v_glyphColor.a);o_secondaryColor=vec4(v_cellColor.rgb,v_cellColor.a);A=vec4(0.);}`), this.Ii = { id: this.Oi++, shader: this.Bi, uniforms: Object.freeze({}), hash: this.Gi(this.Bi, {}), isBuiltIn: !0 };
|
|
804
804
|
}
|
|
805
|
-
get
|
|
806
|
-
return this.
|
|
805
|
+
get Qi() {
|
|
806
|
+
return this.Ii;
|
|
807
807
|
}
|
|
808
808
|
dt(t, e = {}, i = !1) {
|
|
809
|
-
const r = this.
|
|
809
|
+
const r = this.Gi(t, e), s = this.Hi.get(r);
|
|
810
810
|
if (s) return s;
|
|
811
|
-
const h = { id: this.
|
|
812
|
-
return this.
|
|
811
|
+
const h = { id: this.Oi++, shader: t, uniforms: Object.freeze({ ...e }), hash: r, isBuiltIn: i };
|
|
812
|
+
return this.Hi.set(r, h), h;
|
|
813
813
|
}
|
|
814
|
-
|
|
815
|
-
return { id: this.
|
|
814
|
+
Ni(t, e = {}) {
|
|
815
|
+
return { id: this.Oi++, shader: t, uniforms: Object.freeze({ ...e }), hash: 0, isBuiltIn: !1 };
|
|
816
816
|
}
|
|
817
|
-
|
|
817
|
+
Gi(t, e) {
|
|
818
818
|
const i = bt(t.G), r = function(s, h) {
|
|
819
819
|
let o = 0;
|
|
820
820
|
const c = Object.keys(s).sort();
|
|
821
821
|
for (const l of c) o = G(o, Mt(l)), o = G(o, h(s[l]));
|
|
822
822
|
return o;
|
|
823
|
-
}(e, this.
|
|
823
|
+
}(e, this.Xi.bind(this));
|
|
824
824
|
return G(i, r);
|
|
825
825
|
}
|
|
826
|
-
|
|
826
|
+
Xi(t) {
|
|
827
827
|
return typeof t == "number" || typeof t == "boolean" ? function(e) {
|
|
828
828
|
return typeof e == "boolean" ? e ? 1 : 0 : Math.floor(e);
|
|
829
829
|
}(t) : Array.isArray(t) ? function(e) {
|
|
@@ -839,170 +839,170 @@ precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellCo
|
|
|
839
839
|
}(t) : t instanceof WebGLTexture ? bt(t) : 0;
|
|
840
840
|
}
|
|
841
841
|
gt() {
|
|
842
|
-
this.
|
|
842
|
+
this.Bi != this.Bi && this.Bi.dispose(), this.Bi.dispose(), this.Hi.clear();
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
845
|
class Ae {
|
|
846
846
|
constructor() {
|
|
847
|
-
a(this, "
|
|
848
|
-
a(this, "
|
|
847
|
+
a(this, "Yi", []);
|
|
848
|
+
a(this, "ji", 1);
|
|
849
849
|
a(this, "Ss", 0);
|
|
850
850
|
}
|
|
851
|
-
|
|
852
|
-
if (this.Ss >= this.
|
|
853
|
-
const r = { id: this.
|
|
854
|
-
this.
|
|
851
|
+
Ki(t, e) {
|
|
852
|
+
if (this.Ss >= this.Yi.length) {
|
|
853
|
+
const r = { id: this.ji++, type: t, params: {}, state: st.Lt(), material: e };
|
|
854
|
+
this.Yi.push(r);
|
|
855
855
|
}
|
|
856
|
-
const i = this.
|
|
857
|
-
return i.id = this.
|
|
856
|
+
const i = this.Yi[this.Ss];
|
|
857
|
+
return i.id = this.ji++, i.type = t, i.material = e, this.Ss++, i;
|
|
858
858
|
}
|
|
859
|
-
|
|
860
|
-
const r = this.
|
|
859
|
+
Wi(t, e, i) {
|
|
860
|
+
const r = this.Ki(w.RECTANGLE, i), s = r.params;
|
|
861
861
|
return s.width = t.width, s.height = t.height, e.Wt(r.state), r.id;
|
|
862
862
|
}
|
|
863
|
-
|
|
864
|
-
const r = this.
|
|
863
|
+
Zi(t, e, i) {
|
|
864
|
+
const r = this.Ki(w.LINE, i), s = r.params;
|
|
865
865
|
return s.x1 = t.x1, s.y1 = t.y1, s.x2 = t.x2, s.y2 = t.y2, s.thickness = t.thickness, e.Wt(r.state), r.id;
|
|
866
866
|
}
|
|
867
|
-
|
|
868
|
-
const r = this.
|
|
867
|
+
qi(t, e, i) {
|
|
868
|
+
const r = this.Ki(w.ELLIPSE, i), s = r.params;
|
|
869
869
|
return s.width = t.width, s.height = t.height, s.startAngle = t.startAngle, s.endAngle = t.endAngle, s.segments = t.segments, e.Wt(r.state), r.id;
|
|
870
870
|
}
|
|
871
|
-
|
|
872
|
-
const r = this.
|
|
871
|
+
Vi(t, e, i) {
|
|
872
|
+
const r = this.Ki(w.ARC, i), s = r.params;
|
|
873
873
|
return s.width = t.width, s.height = t.height, s.start = t.start, s.stop = t.stop, e.Wt(r.state), r.id;
|
|
874
874
|
}
|
|
875
|
-
|
|
876
|
-
const r = this.
|
|
875
|
+
Ji(t, e, i) {
|
|
876
|
+
const r = this.Ki(w.TRIANGLE, i), s = r.params;
|
|
877
877
|
return s.x1 = t.x1, s.y1 = t.y1, s.x2 = t.x2, s.y2 = t.y2, s.x3 = t.x3, s.y3 = t.y3, e.Wt(r.state), r.id;
|
|
878
878
|
}
|
|
879
|
-
|
|
880
|
-
const r = this.
|
|
879
|
+
te(t, e, i) {
|
|
880
|
+
const r = this.Ki(w.BEZIER_CURVE, i), s = r.params;
|
|
881
881
|
return s.x1 = t.x1, s.y1 = t.y1, s.cp1x = t.cp1x, s.cp1y = t.cp1y, s.cp2x = t.cp2x, s.cp2y = t.cp2y, s.x2 = t.x2, s.y2 = t.y2, s.thickness = t.thickness, s.segments = t.segments, e.Wt(r.state), r.id;
|
|
882
882
|
}
|
|
883
|
-
|
|
883
|
+
wi() {
|
|
884
884
|
this.Ss = 0;
|
|
885
885
|
}
|
|
886
886
|
[Symbol.iterator]() {
|
|
887
887
|
let t = 0;
|
|
888
|
-
const e = this.Ss, i = this.
|
|
888
|
+
const e = this.Ss, i = this.Yi;
|
|
889
889
|
return { next: () => t < e ? { value: i[t++], done: !1 } : { value: void 0, done: !0 } };
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
892
|
class me {
|
|
893
893
|
constructor(t) {
|
|
894
894
|
a(this, "A");
|
|
895
|
-
a(this, "
|
|
896
|
-
a(this, "
|
|
895
|
+
a(this, "se", null);
|
|
896
|
+
a(this, "ie");
|
|
897
897
|
a(this, "vt");
|
|
898
|
-
a(this, "
|
|
899
|
-
a(this, "
|
|
900
|
-
a(this, "
|
|
901
|
-
a(this, "
|
|
902
|
-
a(this, "
|
|
903
|
-
a(this, "
|
|
904
|
-
a(this, "
|
|
905
|
-
a(this, "
|
|
906
|
-
a(this, "
|
|
907
|
-
a(this, "
|
|
908
|
-
a(this, "
|
|
909
|
-
this.A = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.
|
|
898
|
+
a(this, "ee");
|
|
899
|
+
a(this, "re");
|
|
900
|
+
a(this, "ne");
|
|
901
|
+
a(this, "oe", null);
|
|
902
|
+
a(this, "he", {});
|
|
903
|
+
a(this, "ae", []);
|
|
904
|
+
a(this, "ce", []);
|
|
905
|
+
a(this, "le", []);
|
|
906
|
+
a(this, "ue", null);
|
|
907
|
+
a(this, "fe", [0, 0, 0, 0]);
|
|
908
|
+
a(this, "de", 1);
|
|
909
|
+
this.A = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.ee = new st(), this.vt = new pe(t), this.re = new Ae(), this.ie = new ge(t), this.ne = new te(t);
|
|
910
910
|
const e = [0, 0, t.canvas.width, t.canvas.height];
|
|
911
|
-
ht(t, e), this.
|
|
911
|
+
ht(t, e), this.ae.push(null), this.ce.push(e), this.le.push(1), this.ue = null, this.fe = e, this.de = 1;
|
|
912
912
|
}
|
|
913
913
|
rt() {
|
|
914
|
-
this.
|
|
914
|
+
this.ae.push(this.ue), this.ce.push([...this.fe]), this.le.push(this.de);
|
|
915
915
|
}
|
|
916
916
|
lt() {
|
|
917
|
-
const t = this.
|
|
917
|
+
const t = this.ae.pop() ?? null, e = this.ce.pop() ?? [0, 0, this.A.canvas.width, this.A.canvas.height], i = this.le.pop() ?? 1;
|
|
918
918
|
this.nt(t, e[2], e[3], i);
|
|
919
919
|
}
|
|
920
920
|
nt(t, e, i, r = 1) {
|
|
921
921
|
const s = this.A;
|
|
922
|
-
this.
|
|
922
|
+
this.ue !== t && (s.bindFramebuffer(s.FRAMEBUFFER, t), this.ue = t), this.de = r;
|
|
923
923
|
const h = [0, 0, e, i];
|
|
924
|
-
this.
|
|
924
|
+
this.fe[0] === h[0] && this.fe[1] === h[1] && this.fe[2] === h[2] && this.fe[3] === h[3] || (s.viewport(...h), ht(s, h), this.fe = h);
|
|
925
925
|
}
|
|
926
|
-
|
|
927
|
-
this.
|
|
926
|
+
ve(t) {
|
|
927
|
+
this.se !== t && (this.se = t, t.D());
|
|
928
928
|
}
|
|
929
|
-
|
|
929
|
+
pe(t, e) {
|
|
930
930
|
return new q(this.A, t, e);
|
|
931
931
|
}
|
|
932
|
-
|
|
933
|
-
this.
|
|
932
|
+
ge(t) {
|
|
933
|
+
this.oe = t, t && (this.he = {});
|
|
934
934
|
}
|
|
935
935
|
I(t, e) {
|
|
936
|
-
this.
|
|
936
|
+
this.he[t] = e;
|
|
937
937
|
}
|
|
938
|
-
|
|
939
|
-
Object.assign(this.
|
|
938
|
+
me(t) {
|
|
939
|
+
Object.assign(this.he, t);
|
|
940
940
|
}
|
|
941
|
-
|
|
941
|
+
_e(t) {
|
|
942
942
|
return new q(this.A, rt, t);
|
|
943
943
|
}
|
|
944
|
-
|
|
945
|
-
t instanceof
|
|
944
|
+
ye(t, e, i, r) {
|
|
945
|
+
t instanceof X || !r || t.Ae(r), this.re.Wi({ width: e ?? t.width, height: i ?? t.height }, this.ee, t.ut());
|
|
946
946
|
}
|
|
947
|
-
|
|
948
|
-
this.
|
|
947
|
+
we(t, e, i, r) {
|
|
948
|
+
this.ne.$s(t, e, i, r);
|
|
949
949
|
}
|
|
950
|
-
|
|
951
|
-
if (this.
|
|
952
|
-
const i = this.vt.
|
|
953
|
-
this.
|
|
954
|
-
} else this.
|
|
950
|
+
be(t, e) {
|
|
951
|
+
if (this.oe) {
|
|
952
|
+
const i = this.vt.Ni(this.oe, this.he);
|
|
953
|
+
this.re.Wi({ width: t, height: e }, this.ee, i), this.oe = null, this.he = {};
|
|
954
|
+
} else this.re.Wi({ width: t, height: e }, this.ee, this.vt.Qi);
|
|
955
955
|
}
|
|
956
|
-
|
|
957
|
-
this.
|
|
956
|
+
Ce(t, e, i, r) {
|
|
957
|
+
this.re.Zi({ x1: t, y1: e, x2: i, y2: r }, this.ee, this.vt.Qi);
|
|
958
958
|
}
|
|
959
|
-
|
|
960
|
-
this.
|
|
959
|
+
xe(t, e) {
|
|
960
|
+
this.re.qi({ width: t, height: e }, this.ee, this.vt.Qi);
|
|
961
961
|
}
|
|
962
|
-
|
|
963
|
-
this.
|
|
962
|
+
Me(t, e, i, r, s, h) {
|
|
963
|
+
this.re.Ji({ x1: t, y1: e, x2: i, y2: r, x3: s, y3: h }, this.ee, this.vt.Qi);
|
|
964
964
|
}
|
|
965
|
-
|
|
966
|
-
this.
|
|
965
|
+
Fe(t, e, i, r, s, h, o, c) {
|
|
966
|
+
this.re.te({ x1: t, y1: e, cp1x: i, cp1y: r, cp2x: s, cp2y: h, x2: o, y2: c }, this.ee, this.vt.Qi);
|
|
967
967
|
}
|
|
968
|
-
$
|
|
969
|
-
this.
|
|
968
|
+
$e(t, e, i, r) {
|
|
969
|
+
this.re.Vi({ width: t, height: e, start: i, stop: r }, this.ee, this.vt.Qi);
|
|
970
970
|
}
|
|
971
|
-
|
|
972
|
-
return new
|
|
971
|
+
Pe(t, e, i = 1, r = {}) {
|
|
972
|
+
return new X(this.A, t, e, i, r, this);
|
|
973
973
|
}
|
|
974
|
-
|
|
975
|
-
this.
|
|
976
|
-
const [s, h, o, c] = this.
|
|
977
|
-
this.
|
|
974
|
+
Te(t, e = t, i = t, r = 255) {
|
|
975
|
+
this.ee.ps(t, e ?? t, i ?? t, r);
|
|
976
|
+
const [s, h, o, c] = this.ee.canvasBackgroundColor;
|
|
977
|
+
this.Ee(s, h, o, c, !1);
|
|
978
978
|
}
|
|
979
|
-
|
|
980
|
-
this.
|
|
979
|
+
wi(t = 0, e = 0, i = 0, r = 0) {
|
|
980
|
+
this.Ee(t, e, i, r, !0);
|
|
981
981
|
}
|
|
982
|
-
|
|
982
|
+
Ee(t, e, i, r, s) {
|
|
983
983
|
const h = this.A;
|
|
984
|
-
if (this.
|
|
984
|
+
if (this.de > 1) {
|
|
985
985
|
const o = s ? [1, 1, 0, 0] : [0, 0, 0, 0];
|
|
986
|
-
h.clearBufferfv(h.COLOR, 0, new Float32Array(o)), h.clearBufferfv(h.COLOR, 1, new Float32Array([0, 0, 0, 0])), this.
|
|
987
|
-
for (let c = 3; c < this.
|
|
986
|
+
h.clearBufferfv(h.COLOR, 0, new Float32Array(o)), h.clearBufferfv(h.COLOR, 1, new Float32Array([0, 0, 0, 0])), this.de >= 3 && h.clearBufferfv(h.COLOR, 2, new Float32Array([t, e, i, r]));
|
|
987
|
+
for (let c = 3; c < this.de; c++) h.clearBufferfv(h.COLOR, c, new Float32Array([0, 0, 0, 0]));
|
|
988
988
|
} else h.clearColor(t, e, i, r), h.clear(h.COLOR_BUFFER_BIT);
|
|
989
989
|
}
|
|
990
|
-
|
|
990
|
+
Re() {
|
|
991
991
|
const t = [0, 0, this.A.canvas.width, this.A.canvas.height];
|
|
992
|
-
this.A.viewport(...t), ht(this.A, t), this.
|
|
992
|
+
this.A.viewport(...t), ht(this.A, t), this.fe = t, this.ce.length > 0 && (this.ce[0] = t);
|
|
993
993
|
}
|
|
994
994
|
ct() {
|
|
995
|
-
const t = this.
|
|
996
|
-
this.
|
|
995
|
+
const t = this.re;
|
|
996
|
+
this.ie.ki(t), t.wi(), this.se = null;
|
|
997
997
|
}
|
|
998
998
|
gt() {
|
|
999
|
-
this.vt.gt(), this.
|
|
999
|
+
this.vt.gt(), this.ie.gt(), this.ne.gt();
|
|
1000
1000
|
}
|
|
1001
1001
|
get context() {
|
|
1002
1002
|
return this.A;
|
|
1003
1003
|
}
|
|
1004
1004
|
get state() {
|
|
1005
|
-
return this.
|
|
1005
|
+
return this.ee;
|
|
1006
1006
|
}
|
|
1007
1007
|
get materialManager() {
|
|
1008
1008
|
return this.vt;
|
|
@@ -1029,7 +1029,7 @@ function K(n) {
|
|
|
1029
1029
|
function J(n, t, e) {
|
|
1030
1030
|
n[t] = e >>> 8 & 255, n[t + 1] = 255 & e;
|
|
1031
1031
|
}
|
|
1032
|
-
function
|
|
1032
|
+
function B(n, t, e) {
|
|
1033
1033
|
n[t] = e >>> 24 & 255, n[t + 1] = e >>> 16 & 255, n[t + 2] = e >>> 8 & 255, n[t + 3] = 255 & e;
|
|
1034
1034
|
}
|
|
1035
1035
|
function ye(n, t, e) {
|
|
@@ -1207,17 +1207,17 @@ function xe(n) {
|
|
|
1207
1207
|
const p = {};
|
|
1208
1208
|
for (const m of h) p[m.tag] = g, g = K(g + m.data.length);
|
|
1209
1209
|
const v = new Uint8Array(Math.max(s || 0, g));
|
|
1210
|
-
|
|
1210
|
+
B(v, 0, i), J(v, 4, c), J(v, 6, f), J(v, 8, u), J(v, 10, d);
|
|
1211
1211
|
let A = 12;
|
|
1212
1212
|
for (const m of h) {
|
|
1213
1213
|
ye(v, A, m.tag), A += 4;
|
|
1214
1214
|
let b = m.data;
|
|
1215
1215
|
if (m.tag === "head" && b.length >= 12) {
|
|
1216
1216
|
const y = new Uint8Array(b);
|
|
1217
|
-
|
|
1217
|
+
B(y, 8, 0), B(v, A, ot(y, 0, K(y.length))), A += 4;
|
|
1218
1218
|
} else
|
|
1219
|
-
|
|
1220
|
-
|
|
1219
|
+
B(v, A, ot(b, 0, K(b.length))), A += 4;
|
|
1220
|
+
B(v, A, p[m.tag]), A += 4, B(v, A, m.data.length), A += 4;
|
|
1221
1221
|
}
|
|
1222
1222
|
for (const m of h) {
|
|
1223
1223
|
const b = p[m.tag];
|
|
@@ -1226,11 +1226,11 @@ function xe(n) {
|
|
|
1226
1226
|
if (h.find((m) => m.tag === "head")) {
|
|
1227
1227
|
const m = p.head, b = function(y, x) {
|
|
1228
1228
|
const E = x + 8, C = [y[E], y[E + 1], y[E + 2], y[E + 3]];
|
|
1229
|
-
|
|
1229
|
+
B(y, E, 0);
|
|
1230
1230
|
const P = 2981146554 - (ot(y, 0, K(y.length)) >>> 0) >>> 0;
|
|
1231
1231
|
return y[E] = C[0], y[E + 1] = C[1], y[E + 2] = C[2], y[E + 3] = C[3], P >>> 0;
|
|
1232
1232
|
}(v, m);
|
|
1233
|
-
|
|
1233
|
+
B(v, m + 8, b);
|
|
1234
1234
|
}
|
|
1235
1235
|
return v.buffer;
|
|
1236
1236
|
}
|
|
@@ -1311,10 +1311,10 @@ const Te = { parseTab(n, t, e) {
|
|
|
1311
1311
|
const r = [], s = i.maxp.numGlyphs;
|
|
1312
1312
|
for (let h = 0; h < s; h++) r.push(null);
|
|
1313
1313
|
return r;
|
|
1314
|
-
},
|
|
1315
|
-
const e = R, i = n.
|
|
1314
|
+
}, Se(n, t) {
|
|
1315
|
+
const e = R, i = n.ze, r = n.loca;
|
|
1316
1316
|
if (r[t] === r[t + 1]) return null;
|
|
1317
|
-
const s = j.findTable(i, "glyf", n.
|
|
1317
|
+
const s = j.findTable(i, "glyf", n.ke);
|
|
1318
1318
|
if (!s) return null;
|
|
1319
1319
|
let h = s[0] + r[t];
|
|
1320
1320
|
const o = {};
|
|
@@ -1352,7 +1352,7 @@ const Te = { parseTab(n, t, e) {
|
|
|
1352
1352
|
} } }, j = { parse(n) {
|
|
1353
1353
|
const t = new Uint8Array(n);
|
|
1354
1354
|
R.readASCII(t, 0, 4) === "wOFF" && (n = xe(n));
|
|
1355
|
-
const e = new Uint8Array(n), i = Et, r = {}, s = {
|
|
1355
|
+
const e = new Uint8Array(n), i = Et, r = {}, s = { ze: e, De: 0, ke: 0 };
|
|
1356
1356
|
for (const h in i) {
|
|
1357
1357
|
const o = h, c = j.findTable(e, o, 0);
|
|
1358
1358
|
if (c) {
|
|
@@ -1375,27 +1375,27 @@ const Te = { parseTab(n, t, e) {
|
|
|
1375
1375
|
return null;
|
|
1376
1376
|
}, T: Et, B: R };
|
|
1377
1377
|
class Me {
|
|
1378
|
-
|
|
1378
|
+
Le(t) {
|
|
1379
1379
|
var i;
|
|
1380
1380
|
const e = [];
|
|
1381
1381
|
return (i = t.cmap) != null && i.tables ? (t.cmap.tables.forEach((r) => {
|
|
1382
1382
|
if (r.format === 4) {
|
|
1383
|
-
const s = this.
|
|
1383
|
+
const s = this.Oe(r);
|
|
1384
1384
|
e.push(...s);
|
|
1385
1385
|
} else if (r.format === 12) {
|
|
1386
|
-
const s = this.
|
|
1386
|
+
const s = this.Be(r);
|
|
1387
1387
|
e.push(...s);
|
|
1388
1388
|
}
|
|
1389
1389
|
}), [...new Set(e)]) : [];
|
|
1390
1390
|
}
|
|
1391
|
-
|
|
1391
|
+
Oe(t) {
|
|
1392
1392
|
const e = [];
|
|
1393
1393
|
if (!(t.startCount && t.endCount && t.idRangeOffset && t.idDelta)) return e;
|
|
1394
1394
|
for (let i = 0; i < t.startCount.length; i++) {
|
|
1395
1395
|
const r = t.startCount[i], s = t.endCount[i];
|
|
1396
1396
|
if (r !== 65535 || s !== 65535) {
|
|
1397
1397
|
for (let h = r; h <= s; h++)
|
|
1398
|
-
if (this.
|
|
1398
|
+
if (this.Ie(t, h, i) > 0) try {
|
|
1399
1399
|
const o = String.fromCodePoint(h);
|
|
1400
1400
|
e.push(o);
|
|
1401
1401
|
} catch {
|
|
@@ -1404,7 +1404,7 @@ class Me {
|
|
|
1404
1404
|
}
|
|
1405
1405
|
return e;
|
|
1406
1406
|
}
|
|
1407
|
-
|
|
1407
|
+
Be(t) {
|
|
1408
1408
|
const e = [];
|
|
1409
1409
|
if (!t.groups) return e;
|
|
1410
1410
|
for (let i = 0; i < t.groups.length; i += 3) {
|
|
@@ -1418,7 +1418,7 @@ class Me {
|
|
|
1418
1418
|
}
|
|
1419
1419
|
return e;
|
|
1420
1420
|
}
|
|
1421
|
-
|
|
1421
|
+
Ie(t, e, i) {
|
|
1422
1422
|
if (t.idRangeOffset[i] === 0) return e + t.idDelta[i] & 65535;
|
|
1423
1423
|
{
|
|
1424
1424
|
const r = t.idRangeOffset[i] / 2 + (e - t.startCount[i]) - (t.startCount.length - i);
|
|
@@ -1432,95 +1432,95 @@ class Me {
|
|
|
1432
1432
|
}
|
|
1433
1433
|
class Pe {
|
|
1434
1434
|
constructor(t) {
|
|
1435
|
-
a(this, "
|
|
1436
|
-
a(this, "
|
|
1435
|
+
a(this, "He");
|
|
1436
|
+
a(this, "Ge");
|
|
1437
1437
|
a(this, "Z");
|
|
1438
|
-
this.Z = t, this.
|
|
1438
|
+
this.Z = t, this.He = document.createElement("canvas"), this.Ge = this.He.getContext("2d", { willReadFrequently: !0, alpha: !0 });
|
|
1439
1439
|
}
|
|
1440
|
-
|
|
1440
|
+
Qe(t, e, i, r) {
|
|
1441
1441
|
const s = t.length, h = Math.ceil(Math.sqrt(s)), o = Math.ceil(s / h), c = e.width * h, l = e.height * o;
|
|
1442
|
-
this.
|
|
1443
|
-
const u = this.Z.
|
|
1444
|
-
return u.
|
|
1442
|
+
this.Ne(c, l), this.Xe(t, e, h, i, r);
|
|
1443
|
+
const u = this.Z.Pe(c, l, 1, { filter: "nearest" });
|
|
1444
|
+
return u.et(this.He), { framebuffer: u, columns: h, rows: o };
|
|
1445
1445
|
}
|
|
1446
|
-
|
|
1447
|
-
this.
|
|
1446
|
+
Ne(t, e) {
|
|
1447
|
+
this.He.width = t, this.He.height = e, this.He.style.width = t + "px", this.He.style.height = e + "px", this.Ge.imageSmoothingEnabled = !1, this.He.style.imageRendering = "pixelated", this.Ge.clearRect(0, 0, t, e), this.Ge.textBaseline = "top", this.Ge.textAlign = "left", this.Ge.fillStyle = "white";
|
|
1448
1448
|
}
|
|
1449
|
-
|
|
1449
|
+
Xe(t, e, i, r, s) {
|
|
1450
1450
|
const h = r / s.head.unitsPerEm;
|
|
1451
1451
|
for (let o = 0; o < t.length; o++) {
|
|
1452
1452
|
const c = o % i, l = Math.floor(o / i), u = t[o].glyphData;
|
|
1453
1453
|
if (!u) continue;
|
|
1454
1454
|
const f = u.advanceWidth * h, d = c * e.width, g = l * e.height, p = d + 0.5 * e.width, v = g + 0.5 * e.height, A = Math.round(p - 0.5 * e.width), m = Math.round(v - 0.5 * r), b = A + 0.5 * (e.width - f), y = m + s.hhea.ascender * h;
|
|
1455
|
-
this.
|
|
1455
|
+
this.Ye(u, b, y, h);
|
|
1456
1456
|
}
|
|
1457
1457
|
}
|
|
1458
|
-
|
|
1458
|
+
Ye(t, e, i, r) {
|
|
1459
1459
|
if (!t || !t.xs || t.noc === 0) return;
|
|
1460
1460
|
let { xs: s, ys: h, endPts: o, flags: c } = t;
|
|
1461
1461
|
if (!(s && h && o && c)) return;
|
|
1462
|
-
this.
|
|
1462
|
+
this.Ge.beginPath();
|
|
1463
1463
|
let l = 0;
|
|
1464
1464
|
for (let u = 0; u < o.length; u++) {
|
|
1465
1465
|
const f = o[u];
|
|
1466
1466
|
if (!(f < l)) {
|
|
1467
1467
|
if (f >= l) {
|
|
1468
1468
|
const d = e + s[l] * r, g = i - h[l] * r;
|
|
1469
|
-
this.
|
|
1469
|
+
this.Ge.moveTo(d, g);
|
|
1470
1470
|
let p = l + 1;
|
|
1471
1471
|
for (; p <= f; )
|
|
1472
1472
|
if (1 & c[p]) {
|
|
1473
1473
|
const v = e + s[p] * r, A = i - h[p] * r;
|
|
1474
|
-
this.
|
|
1474
|
+
this.Ge.lineTo(v, A), p++;
|
|
1475
1475
|
} else {
|
|
1476
1476
|
const v = e + s[p] * r, A = i - h[p] * r;
|
|
1477
1477
|
if (p + 1 > f) {
|
|
1478
1478
|
const b = e + s[l] * r, y = i - h[l] * r;
|
|
1479
|
-
if (1 & c[l]) this.
|
|
1479
|
+
if (1 & c[l]) this.Ge.quadraticCurveTo(v, A, b, y);
|
|
1480
1480
|
else {
|
|
1481
1481
|
const x = (v + b) / 2, E = (A + y) / 2;
|
|
1482
|
-
this.
|
|
1482
|
+
this.Ge.quadraticCurveTo(v, A, x, E);
|
|
1483
1483
|
}
|
|
1484
1484
|
break;
|
|
1485
1485
|
}
|
|
1486
1486
|
const m = p + 1;
|
|
1487
1487
|
if (1 & c[m]) {
|
|
1488
1488
|
const b = e + s[m] * r, y = i - h[m] * r;
|
|
1489
|
-
this.
|
|
1489
|
+
this.Ge.quadraticCurveTo(v, A, b, y), p = m + 1;
|
|
1490
1490
|
} else {
|
|
1491
1491
|
const b = (v + (e + s[m] * r)) / 2, y = (A + (i - h[m] * r)) / 2;
|
|
1492
|
-
this.
|
|
1492
|
+
this.Ge.quadraticCurveTo(v, A, b, y), p = m;
|
|
1493
1493
|
}
|
|
1494
1494
|
}
|
|
1495
|
-
this.
|
|
1495
|
+
this.Ge.closePath();
|
|
1496
1496
|
}
|
|
1497
1497
|
l = f + 1;
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
1500
|
-
this.
|
|
1500
|
+
this.Ge.fill();
|
|
1501
1501
|
}
|
|
1502
1502
|
}
|
|
1503
1503
|
class Pt {
|
|
1504
|
-
|
|
1504
|
+
je(t, e) {
|
|
1505
1505
|
const i = t.cmap;
|
|
1506
1506
|
if (!i || !i.tables) return 0;
|
|
1507
1507
|
let r = 0;
|
|
1508
|
-
for (const s of i.tables) if (s.format === 4 ? r = this.
|
|
1508
|
+
for (const s of i.tables) if (s.format === 4 ? r = this.Ke(e, s) : s.format === 12 && (r = this.We(e, s)), r > 0) break;
|
|
1509
1509
|
return r;
|
|
1510
1510
|
}
|
|
1511
|
-
|
|
1511
|
+
Ze(t, e) {
|
|
1512
1512
|
const i = e.codePointAt(0);
|
|
1513
|
-
return i === void 0 ? 0 : this.
|
|
1513
|
+
return i === void 0 ? 0 : this.je(t, i);
|
|
1514
1514
|
}
|
|
1515
|
-
|
|
1515
|
+
qe(t, e) {
|
|
1516
1516
|
const i = t.hmtx;
|
|
1517
1517
|
return i && i.aWidth && i.aWidth.length !== 0 ? e < i.aWidth.length ? i.aWidth[e] : i.aWidth[i.aWidth.length - 1] : 0;
|
|
1518
1518
|
}
|
|
1519
|
-
|
|
1519
|
+
Ve(t, e) {
|
|
1520
1520
|
const i = e / t.head.unitsPerEm, r = t.hhea.ascender * i, s = t.hhea.descender * i, h = t.hhea.lineGap * i;
|
|
1521
1521
|
return { ascender: r, descender: s, lineGap: h, lineHeight: r - s + h, unitsPerEm: t.head.unitsPerEm, scale: i };
|
|
1522
1522
|
}
|
|
1523
|
-
|
|
1523
|
+
Ke(t, e) {
|
|
1524
1524
|
const i = e.endCount.length;
|
|
1525
1525
|
let r = -1;
|
|
1526
1526
|
for (let s = 0; s < i; s++) if (t <= e.endCount[s]) {
|
|
@@ -1538,7 +1538,7 @@ class Pt {
|
|
|
1538
1538
|
}
|
|
1539
1539
|
return 0;
|
|
1540
1540
|
}
|
|
1541
|
-
|
|
1541
|
+
We(t, e) {
|
|
1542
1542
|
const i = e.groups.length / 3;
|
|
1543
1543
|
for (let r = 0; r < i; r++) {
|
|
1544
1544
|
const s = e.groups[3 * r], h = e.groups[3 * r + 1], o = e.groups[3 * r + 2];
|
|
@@ -1549,16 +1549,16 @@ class Pt {
|
|
|
1549
1549
|
}
|
|
1550
1550
|
class Se {
|
|
1551
1551
|
constructor() {
|
|
1552
|
-
a(this, "
|
|
1553
|
-
this.
|
|
1552
|
+
a(this, "Je");
|
|
1553
|
+
this.Je = new Pt();
|
|
1554
1554
|
}
|
|
1555
1555
|
tr(t, e, i) {
|
|
1556
1556
|
let r = 0;
|
|
1557
|
-
const s = this.
|
|
1557
|
+
const s = this.Je.Ve(i, e), h = s.lineHeight;
|
|
1558
1558
|
for (const o of t) {
|
|
1559
|
-
const c = this.
|
|
1559
|
+
const c = this.Je.Ze(i, o);
|
|
1560
1560
|
if (c === 0) continue;
|
|
1561
|
-
const l = this.
|
|
1561
|
+
const l = this.Je.qe(i, c) * s.scale;
|
|
1562
1562
|
r = Math.max(r, l);
|
|
1563
1563
|
}
|
|
1564
1564
|
return { width: Math.ceil(r), height: Math.ceil(h) };
|
|
@@ -1569,22 +1569,22 @@ class Ue {
|
|
|
1569
1569
|
a(this, "sr");
|
|
1570
1570
|
this.sr = new Pt();
|
|
1571
1571
|
}
|
|
1572
|
-
|
|
1572
|
+
ir(t, e) {
|
|
1573
1573
|
const i = [], r = /* @__PURE__ */ new Map();
|
|
1574
1574
|
return t.forEach((s, h) => {
|
|
1575
|
-
const o = s.codePointAt(0) || 0, c = { character: s, unicode: o, color: this.
|
|
1575
|
+
const o = s.codePointAt(0) || 0, c = { character: s, unicode: o, color: this.er(h), glyphData: this.rr(e, s) };
|
|
1576
1576
|
i.push(c), r.set(s, c);
|
|
1577
1577
|
}), { array: i, map: r };
|
|
1578
1578
|
}
|
|
1579
|
-
|
|
1579
|
+
er(t) {
|
|
1580
1580
|
return [t % 256 / 255, Math.floor(t / 256) % 256 / 255, 0];
|
|
1581
1581
|
}
|
|
1582
1582
|
rr(t, e) {
|
|
1583
|
-
const i = e.codePointAt(0) || 0, r = this.sr.
|
|
1583
|
+
const i = e.codePointAt(0) || 0, r = this.sr.je(t, i);
|
|
1584
1584
|
if (r === 0) return null;
|
|
1585
1585
|
let s = 0;
|
|
1586
1586
|
t.hmtx && t.hmtx.aWidth && r > 0 && t.hmtx.aWidth[r] !== void 0 && (s = t.hmtx.aWidth[r]);
|
|
1587
|
-
const h = j.T.glyf.
|
|
1587
|
+
const h = j.T.glyf.Se(t, r);
|
|
1588
1588
|
return h ? { ...h, advanceWidth: s } : null;
|
|
1589
1589
|
}
|
|
1590
1590
|
}
|
|
@@ -1620,7 +1620,7 @@ class et {
|
|
|
1620
1620
|
Mr(t) {
|
|
1621
1621
|
if (t === void 0) return this.lr;
|
|
1622
1622
|
this.lr = t, this.vr = this._r.tr(this.hr.map((i) => i.character), this.lr, this.nr);
|
|
1623
|
-
const e = this.mr.
|
|
1623
|
+
const e = this.mr.Qe(this.hr, this.vr, this.lr, this.nr);
|
|
1624
1624
|
this.cr = e.framebuffer, this.ur = e.columns, this.dr = e.rows;
|
|
1625
1625
|
}
|
|
1626
1626
|
async Fr(t) {
|
|
@@ -1641,9 +1641,9 @@ class et {
|
|
|
1641
1641
|
this.pr = new FontFace("CustomFont_" + e, t), await this.pr.load(), document.fonts.add(this.pr);
|
|
1642
1642
|
}
|
|
1643
1643
|
async Cr() {
|
|
1644
|
-
const t = this.gr.
|
|
1644
|
+
const t = this.gr.Le(this.nr), { array: e, map: i } = this.yr.ir(t, this.nr);
|
|
1645
1645
|
this.hr = e, this.ar = i, this.vr = this._r.tr(t, this.lr, this.nr);
|
|
1646
|
-
const r = this.mr.
|
|
1646
|
+
const r = this.mr.Qe(this.hr, this.vr, this.lr, this.nr);
|
|
1647
1647
|
this.cr = r.framebuffer, this.ur = r.columns, this.dr = r.rows, this.Ar = !0;
|
|
1648
1648
|
}
|
|
1649
1649
|
$r(t) {
|
|
@@ -1700,7 +1700,7 @@ class Le {
|
|
|
1700
1700
|
a(this, "Lr");
|
|
1701
1701
|
a(this, "Or", !1);
|
|
1702
1702
|
a(this, "Br", /* @__PURE__ */ new Set());
|
|
1703
|
-
this.kr = t, this.Dr = e, this.Lr = i, this.
|
|
1703
|
+
this.kr = t, this.Dr = e, this.Lr = i, this.ti();
|
|
1704
1704
|
}
|
|
1705
1705
|
Ir() {
|
|
1706
1706
|
if (this.N = this.Er * this.Dr, this.X = this.Rr * this.Lr, this.Sr = Math.floor((this.kr.width - this.N) / 2), this.zr = Math.floor((this.kr.height - this.X) / 2), this.Br.size > 0) for (const t of this.Br) t();
|
|
@@ -1711,11 +1711,11 @@ class Le {
|
|
|
1711
1711
|
Gr(t) {
|
|
1712
1712
|
this.Br.delete(t);
|
|
1713
1713
|
}
|
|
1714
|
-
|
|
1714
|
+
ti() {
|
|
1715
1715
|
this.Or || (this.Er = Math.floor(this.kr.width / this.Dr), this.Rr = Math.floor(this.kr.height / this.Lr)), this.Ir();
|
|
1716
1716
|
}
|
|
1717
1717
|
Qr(t, e) {
|
|
1718
|
-
this.Dr = t, this.Lr = e, this.
|
|
1718
|
+
this.Dr = t, this.Lr = e, this.ti();
|
|
1719
1719
|
}
|
|
1720
1720
|
get cellWidth() {
|
|
1721
1721
|
return this.Dr;
|
|
@@ -1758,7 +1758,7 @@ const Ne = /^rgba?\(([^)]+)\)$/i;
|
|
|
1758
1758
|
function ct(n) {
|
|
1759
1759
|
return Number.isNaN(n) ? 0 : Math.max(0, Math.min(255, n));
|
|
1760
1760
|
}
|
|
1761
|
-
function
|
|
1761
|
+
function Be(n) {
|
|
1762
1762
|
if (!n) return null;
|
|
1763
1763
|
const t = n.trim().toLowerCase();
|
|
1764
1764
|
if (!t) return null;
|
|
@@ -1772,7 +1772,7 @@ function De(n) {
|
|
|
1772
1772
|
return [h, o, c, Math.round(l)];
|
|
1773
1773
|
}(t)), e ? e[3] === 0 ? null : e : null;
|
|
1774
1774
|
}
|
|
1775
|
-
class
|
|
1775
|
+
class De {
|
|
1776
1776
|
constructor(t = {}) {
|
|
1777
1777
|
a(this, "kr");
|
|
1778
1778
|
a(this, "Nr", null);
|
|
@@ -1810,7 +1810,7 @@ class Oe {
|
|
|
1810
1810
|
const t = this.qr();
|
|
1811
1811
|
for (const e of t) {
|
|
1812
1812
|
if (!e) continue;
|
|
1813
|
-
const i =
|
|
1813
|
+
const i = Be(window.getComputedStyle(e).backgroundColor);
|
|
1814
1814
|
if (i) return i;
|
|
1815
1815
|
}
|
|
1816
1816
|
return [255, 255, 255, 255];
|
|
@@ -1857,7 +1857,7 @@ class Oe {
|
|
|
1857
1857
|
}
|
|
1858
1858
|
}
|
|
1859
1859
|
function $(n) {
|
|
1860
|
-
return
|
|
1860
|
+
return O(parseInt(n, 16), 0, 255);
|
|
1861
1861
|
}
|
|
1862
1862
|
class S {
|
|
1863
1863
|
constructor(t, e, i, r) {
|
|
@@ -1867,7 +1867,7 @@ class S {
|
|
|
1867
1867
|
a(this, "g");
|
|
1868
1868
|
a(this, "b");
|
|
1869
1869
|
a(this, "a");
|
|
1870
|
-
this.r =
|
|
1870
|
+
this.r = O(t, 0, 255), this.g = O(e, 0, 255), this.b = O(i, 0, 255), this.a = O(r, 0, 255), this.sn = [this.r, this.g, this.b, this.a], this.en = [this.r / 255, this.g / 255, this.b / 255, this.a / 255];
|
|
1871
1871
|
}
|
|
1872
1872
|
static rn(t, e, i, r) {
|
|
1873
1873
|
if (S.nn(t)) return t;
|
|
@@ -1977,7 +1977,7 @@ class St {
|
|
|
1977
1977
|
characters(t) {
|
|
1978
1978
|
return this.wn = t, this.Cn(t), this.q = null, this;
|
|
1979
1979
|
}
|
|
1980
|
-
|
|
1980
|
+
Ae(t) {
|
|
1981
1981
|
this.dn !== t && (this.dn = t, this.wn && this.Cn(this.wn), this.q = null);
|
|
1982
1982
|
}
|
|
1983
1983
|
get texture() {
|
|
@@ -2003,7 +2003,7 @@ class St {
|
|
|
2003
2003
|
ft() {
|
|
2004
2004
|
this.xn();
|
|
2005
2005
|
const t = this.Mn(), e = this.Fn(), i = t.createShader(e), r = t.createUniforms(e);
|
|
2006
|
-
this.q = this.Z.materialManager.
|
|
2006
|
+
this.q = this.Z.materialManager.Ni(i, r);
|
|
2007
2007
|
}
|
|
2008
2008
|
bn(t, e, i, r, s) {
|
|
2009
2009
|
const h = S.rn(e, i, r, s);
|
|
@@ -2028,7 +2028,7 @@ class St {
|
|
|
2028
2028
|
return { renderer: this.Z, gl: this.A, font: this.dn, source: this, gridWidth: this.N, gridHeight: this.X };
|
|
2029
2029
|
}
|
|
2030
2030
|
}
|
|
2031
|
-
class
|
|
2031
|
+
class z extends St {
|
|
2032
2032
|
constructor(t, e, i, r, s, h, o, c) {
|
|
2033
2033
|
const l = Math.min(o / s, c / h);
|
|
2034
2034
|
super(t, e, i, r, s, h, Math.max(1, Math.floor(s * l)), Math.max(1, Math.floor(h * l)));
|
|
@@ -2037,7 +2037,7 @@ class k extends St {
|
|
|
2037
2037
|
const h = t.context, o = h.createTexture();
|
|
2038
2038
|
h.bindTexture(h.TEXTURE_2D, o), h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL, 1), pt(h, h.NEAREST, h.NEAREST, h.CLAMP_TO_EDGE, h.CLAMP_TO_EDGE), h.texImage2D(h.TEXTURE_2D, 0, h.RGBA, h.RGBA, h.UNSIGNED_BYTE, i), h.bindTexture(h.TEXTURE_2D, null);
|
|
2039
2039
|
const c = i.naturalWidth ?? i.width ?? i.videoWidth ?? 0, l = i.naturalHeight ?? i.height ?? i.videoHeight ?? 0;
|
|
2040
|
-
return new
|
|
2040
|
+
return new z(h, t, o, e, c, l, r, s);
|
|
2041
2041
|
}
|
|
2042
2042
|
$n() {
|
|
2043
2043
|
return this.ln;
|
|
@@ -2113,8 +2113,8 @@ class Lt {
|
|
|
2113
2113
|
a(this, "Vn", { x: -1 / 0, y: -1 / 0 });
|
|
2114
2114
|
a(this, "Jn", null);
|
|
2115
2115
|
a(this, "so", 0);
|
|
2116
|
-
a(this, "eo");
|
|
2117
2116
|
a(this, "io");
|
|
2117
|
+
a(this, "eo");
|
|
2118
2118
|
a(this, "ro");
|
|
2119
2119
|
a(this, "no");
|
|
2120
2120
|
a(this, "oo");
|
|
@@ -2141,9 +2141,9 @@ class Lt {
|
|
|
2141
2141
|
_o() {
|
|
2142
2142
|
if (this.ao) return;
|
|
2143
2143
|
const t = this.kr.canvas;
|
|
2144
|
-
this.
|
|
2144
|
+
this.io = (e) => {
|
|
2145
2145
|
this.yo(e), this.Ao(e);
|
|
2146
|
-
}, this.
|
|
2146
|
+
}, this.eo = () => {
|
|
2147
2147
|
this.Vn = { ...this.qn }, this.qn.x = -1 / 0, this.qn.y = -1 / 0, this.Jn = null;
|
|
2148
2148
|
}, this.ro = (e) => {
|
|
2149
2149
|
this.yo(e), this.wo(e);
|
|
@@ -2153,12 +2153,12 @@ class Lt {
|
|
|
2153
2153
|
this.yo(e), this.Co(e);
|
|
2154
2154
|
}, this.ho = (e) => {
|
|
2155
2155
|
this.yo(e), this.xo(e);
|
|
2156
|
-
}, t.addEventListener("mousemove", this.
|
|
2156
|
+
}, t.addEventListener("mousemove", this.io, { passive: !0 }), t.addEventListener("mouseleave", this.eo, { passive: !0 }), t.addEventListener("mousedown", this.ro, { passive: !0 }), t.addEventListener("mouseup", this.no, { passive: !0 }), t.addEventListener("click", this.oo, { passive: !0 }), t.addEventListener("wheel", this.ho, { passive: !1 }), this.ao = !0;
|
|
2157
2157
|
}
|
|
2158
2158
|
Mo() {
|
|
2159
2159
|
if (!this.ao) return;
|
|
2160
2160
|
const t = this.kr.canvas;
|
|
2161
|
-
t.removeEventListener("mousemove", this.
|
|
2161
|
+
t.removeEventListener("mousemove", this.io), t.removeEventListener("mouseleave", this.eo), t.removeEventListener("mousedown", this.ro), t.removeEventListener("mouseup", this.no), t.removeEventListener("click", this.oo), t.removeEventListener("wheel", this.ho), this.ao = !1;
|
|
2162
2162
|
}
|
|
2163
2163
|
Fo() {
|
|
2164
2164
|
if (!this.ao) return;
|
|
@@ -2236,7 +2236,7 @@ class Lt {
|
|
|
2236
2236
|
} else this.qn.x = -1 / 0, this.qn.y = -1 / 0;
|
|
2237
2237
|
}
|
|
2238
2238
|
}
|
|
2239
|
-
const
|
|
2239
|
+
const Ie = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Lt }, Symbol.toStringTag, { value: "Module" }));
|
|
2240
2240
|
class Nt {
|
|
2241
2241
|
constructor() {
|
|
2242
2242
|
a(this, "zo", /* @__PURE__ */ new Map());
|
|
@@ -2308,8 +2308,8 @@ class Nt {
|
|
|
2308
2308
|
return this.Ho[t] || t.toLowerCase();
|
|
2309
2309
|
}
|
|
2310
2310
|
}
|
|
2311
|
-
const
|
|
2312
|
-
class
|
|
2311
|
+
const _e = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Nt }, Symbol.toStringTag, { value: "Module" }));
|
|
2312
|
+
class Bt {
|
|
2313
2313
|
constructor(t, e, i) {
|
|
2314
2314
|
a(this, "kr");
|
|
2315
2315
|
a(this, "qo");
|
|
@@ -2318,8 +2318,8 @@ class Dt {
|
|
|
2318
2318
|
a(this, "Jo", /* @__PURE__ */ new Map());
|
|
2319
2319
|
a(this, "th", /* @__PURE__ */ new Map());
|
|
2320
2320
|
a(this, "sh", null);
|
|
2321
|
-
a(this, "eh");
|
|
2322
2321
|
a(this, "ih");
|
|
2322
|
+
a(this, "eh");
|
|
2323
2323
|
a(this, "rh");
|
|
2324
2324
|
a(this, "nh");
|
|
2325
2325
|
a(this, "oh");
|
|
@@ -2349,7 +2349,7 @@ class Dt {
|
|
|
2349
2349
|
a(this, "Sh", null);
|
|
2350
2350
|
this.kr = t, this.Zn = e, this.qo = i;
|
|
2351
2351
|
const r = this.kr.canvas;
|
|
2352
|
-
this.
|
|
2352
|
+
this.ih = r.style.touchAction, this.eh = r.style.userSelect, r.style.touchAction || (r.style.touchAction = "none"), r.style.userSelect || (r.style.userSelect = "none");
|
|
2353
2353
|
}
|
|
2354
2354
|
_o() {
|
|
2355
2355
|
if (this.ao) return;
|
|
@@ -2369,7 +2369,7 @@ class Dt {
|
|
|
2369
2369
|
const t = this.kr.canvas;
|
|
2370
2370
|
t.removeEventListener("touchstart", this.rh), t.removeEventListener("touchmove", this.nh), t.removeEventListener("touchend", this.oh), t.removeEventListener("touchcancel", this.hh), this.ao = !1, this.sh = null, this.Vo.clear(), this.Jo.clear(), this.th.forEach((e) => {
|
|
2371
2371
|
e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
|
|
2372
|
-
}), this.th.clear(), this.Sh = null, this.Rh = 0, t.style.touchAction = this.
|
|
2372
|
+
}), this.th.clear(), this.Sh = null, this.Rh = 0, t.style.touchAction = this.ih, t.style.userSelect = this.eh;
|
|
2373
2373
|
}
|
|
2374
2374
|
Fo() {
|
|
2375
2375
|
if (!this.Zn() || this.Vo.size === 0) return;
|
|
@@ -2493,34 +2493,34 @@ class Dt {
|
|
|
2493
2493
|
const [e, i] = this.sh.ids, r = this.Vo.get(e), s = this.Vo.get(i);
|
|
2494
2494
|
if (!r || !s) return;
|
|
2495
2495
|
const h = Y(r.x, r.y, s.x, s.y) / this.sh.initialDistance, o = h - this.sh.lastScale;
|
|
2496
|
-
this.yh && Math.abs(o) > this.Ph && (this.yh({ touches: [this.Zh(r), this.Zh(s)], scale: h, deltaScale: o, center: this.
|
|
2496
|
+
this.yh && Math.abs(o) > this.Ph && (this.yh({ touches: [this.Zh(r), this.Zh(s)], scale: h, deltaScale: o, center: this.ia(r, s), originalEvent: t }), this.sh.lastScale = h);
|
|
2497
2497
|
let c = mt(r.clientX, r.clientY, s.clientX, s.clientY) - this.sh.initialAngle;
|
|
2498
2498
|
c = (c + 180) % 360 - 180;
|
|
2499
2499
|
const l = c - this.sh.lastRotation;
|
|
2500
|
-
this.Ah && Math.abs(l) > this.Th && (this.Ah({ touches: [this.Zh(r), this.Zh(s)], rotation: c, deltaRotation: l, center: this.
|
|
2500
|
+
this.Ah && Math.abs(l) > this.Th && (this.Ah({ touches: [this.Zh(r), this.Zh(s)], rotation: c, deltaRotation: l, center: this.ia(r, s), originalEvent: t }), this.sh.lastRotation = c);
|
|
2501
2501
|
}
|
|
2502
|
-
|
|
2502
|
+
ia(t, e) {
|
|
2503
2503
|
const i = (t.clientX + e.clientX) / 2, r = (t.clientY + e.clientY) / 2, s = this.Oh(i, r, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: r });
|
|
2504
2504
|
return { x: s.x, y: s.y };
|
|
2505
2505
|
}
|
|
2506
2506
|
ta(t, e) {
|
|
2507
2507
|
const i = performance.now(), r = i - t.startTime, s = Y(t.startPosition.clientX, t.startPosition.clientY, t.lastPosition.clientX, t.lastPosition.clientY);
|
|
2508
2508
|
if (!t.longPressFired && r <= this.wh && s <= this.Ch)
|
|
2509
|
-
this.
|
|
2509
|
+
this.ea(t.lastPosition, i) && this.gh ? this.gh({ touch: this.Zh(t.lastPosition), taps: 2, originalEvent: e }) : this.ph && this.ph({ touch: this.Zh(t.lastPosition), taps: 1, originalEvent: e });
|
|
2510
2510
|
else if (!t.longPressFired && r <= this.$h && s >= this.Fh) {
|
|
2511
2511
|
const h = { x: t.lastPosition.clientX - t.startPosition.clientX, y: t.lastPosition.clientY - t.startPosition.clientY }, o = Math.max(Math.hypot(h.x, h.y), 1e-4), c = { x: h.x / o, y: h.y / o }, l = { x: h.x / r, y: h.y / r };
|
|
2512
2512
|
this._h && this._h({ touch: this.Zh(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
|
|
2513
2513
|
}
|
|
2514
2514
|
this.Rh = i, this.Sh = this.Zh(t.lastPosition);
|
|
2515
2515
|
}
|
|
2516
|
-
|
|
2516
|
+
ea(t, e) {
|
|
2517
2517
|
return !this.Sh || e - this.Rh > this.bh ? !1 : Y(t.clientX, t.clientY, this.Sh.clientX, this.Sh.clientY) <= this.Ch;
|
|
2518
2518
|
}
|
|
2519
2519
|
Zh(t) {
|
|
2520
2520
|
return { ...t };
|
|
2521
2521
|
}
|
|
2522
2522
|
}
|
|
2523
|
-
const
|
|
2523
|
+
const Oe = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Bt }, Symbol.toStringTag, { value: "Module" }));
|
|
2524
2524
|
class nt extends St {
|
|
2525
2525
|
constructor(e, i, r, s, h, o, c, l, u) {
|
|
2526
2526
|
const f = o / c;
|
|
@@ -2597,7 +2597,7 @@ class nt extends St {
|
|
|
2597
2597
|
return !this.ra.paused && !this.ra.ended;
|
|
2598
2598
|
}
|
|
2599
2599
|
}
|
|
2600
|
-
const
|
|
2600
|
+
const Ze = (n) => class extends n {
|
|
2601
2601
|
oa(t, e, i, r) {
|
|
2602
2602
|
if (S.nn(t)) return t;
|
|
2603
2603
|
if (typeof t == "number" || typeof t == "string") return this.color(t, e, i, r);
|
|
@@ -2637,20 +2637,20 @@ const Xe = (n) => class extends n {
|
|
|
2637
2637
|
return S.rn(t, e, i, r);
|
|
2638
2638
|
}
|
|
2639
2639
|
rect(t = 1, e = 1) {
|
|
2640
|
-
this.Z.
|
|
2640
|
+
this.Z.be(t, e);
|
|
2641
2641
|
}
|
|
2642
2642
|
point() {
|
|
2643
|
-
this.Z.
|
|
2643
|
+
this.Z.be(1, 1);
|
|
2644
2644
|
}
|
|
2645
2645
|
line(t, e, i, r) {
|
|
2646
|
-
this.Z.
|
|
2646
|
+
this.Z.Ce(t, e, i, r);
|
|
2647
2647
|
}
|
|
2648
2648
|
lineWeight(t) {
|
|
2649
2649
|
this.Z.state.Zt(t);
|
|
2650
2650
|
}
|
|
2651
2651
|
background(t, e, i, r = 255) {
|
|
2652
2652
|
const s = this.oa(t, e, i, r);
|
|
2653
|
-
this.Z.
|
|
2653
|
+
this.Z.Te(s.r, s.g, s.b, s.a);
|
|
2654
2654
|
}
|
|
2655
2655
|
char(t) {
|
|
2656
2656
|
const e = Array.from(t);
|
|
@@ -2678,58 +2678,58 @@ const Xe = (n) => class extends n {
|
|
|
2678
2678
|
this.Z.state.ds(t);
|
|
2679
2679
|
}
|
|
2680
2680
|
clear() {
|
|
2681
|
-
this.Z.
|
|
2681
|
+
this.Z.wi(0, 0, 0, 0);
|
|
2682
2682
|
}
|
|
2683
2683
|
ellipse(t, e) {
|
|
2684
|
-
this.Z.
|
|
2684
|
+
this.Z.xe(t / 2, e / 2);
|
|
2685
2685
|
}
|
|
2686
2686
|
triangle(t, e, i, r, s, h) {
|
|
2687
|
-
this.Z.
|
|
2687
|
+
this.Z.Me(t, e, i, r, s, h);
|
|
2688
2688
|
}
|
|
2689
2689
|
bezierCurve(t, e, i, r, s, h, o, c) {
|
|
2690
|
-
this.Z.
|
|
2690
|
+
this.Z.Fe(t, e, i, r, s, h, o, c);
|
|
2691
2691
|
}
|
|
2692
2692
|
arc(t, e, i, r) {
|
|
2693
|
-
this.Z.$
|
|
2693
|
+
this.Z.$e(t / 2, e / 2, i, r);
|
|
2694
2694
|
}
|
|
2695
2695
|
shader(t) {
|
|
2696
|
-
this.Z.
|
|
2696
|
+
this.Z.ge(t);
|
|
2697
2697
|
}
|
|
2698
2698
|
setUniform(t, e) {
|
|
2699
2699
|
this.Z.I(t, e);
|
|
2700
2700
|
}
|
|
2701
2701
|
setUniforms(t) {
|
|
2702
|
-
this.Z.
|
|
2702
|
+
this.Z.me(t);
|
|
2703
2703
|
}
|
|
2704
2704
|
async createFilterShader(t) {
|
|
2705
2705
|
if (typeof t == "string" && (t.startsWith("./") || t.startsWith("../") || t.endsWith(".frag") || t.endsWith(".glsl"))) {
|
|
2706
2706
|
const e = await fetch(t);
|
|
2707
2707
|
if (!e.ok) throw Error(`Failed to load shader from ${t}: ${e.statusText}`);
|
|
2708
2708
|
const i = await e.text();
|
|
2709
|
-
return this.Z.
|
|
2709
|
+
return this.Z._e(i);
|
|
2710
2710
|
}
|
|
2711
|
-
return this.Z.
|
|
2711
|
+
return this.Z._e(t);
|
|
2712
2712
|
}
|
|
2713
2713
|
createFramebuffer(t) {
|
|
2714
|
-
return this.Z.
|
|
2714
|
+
return this.Z.Pe(t.width ?? this.grid.cols, t.height ?? this.grid.rows, t.attachments ?? 3);
|
|
2715
2715
|
}
|
|
2716
2716
|
image(t, e, i) {
|
|
2717
2717
|
const r = this.dn ?? this.ha.base.font;
|
|
2718
|
-
this.Z.
|
|
2718
|
+
this.Z.ye(t, e, i, r), t instanceof X && this.Z.ct();
|
|
2719
2719
|
}
|
|
2720
2720
|
async loadImage(t) {
|
|
2721
2721
|
if (typeof t != "string")
|
|
2722
|
-
return
|
|
2722
|
+
return z.Tn(this.Z, this.gn, t, this.grid.cols, this.grid.rows);
|
|
2723
2723
|
const e = t, i = await new Promise((r, s) => {
|
|
2724
2724
|
const h = new Image();
|
|
2725
2725
|
h.crossOrigin = "anonymous", h.onload = () => r(h), h.onerror = (o) => s(o), h.src = e;
|
|
2726
2726
|
});
|
|
2727
|
-
return
|
|
2727
|
+
return z.Tn(this.Z, this.gn, i, this.grid.cols, this.grid.rows);
|
|
2728
2728
|
}
|
|
2729
2729
|
async loadVideo(t) {
|
|
2730
2730
|
return await nt.Tn(this.Z, this.gn, t, this.grid.cols, this.grid.rows);
|
|
2731
2731
|
}
|
|
2732
|
-
},
|
|
2732
|
+
}, Xe = (n) => class extends n {
|
|
2733
2733
|
get frameCount() {
|
|
2734
2734
|
return this.aa.Kn;
|
|
2735
2735
|
}
|
|
@@ -2751,7 +2751,7 @@ const Xe = (n) => class extends n {
|
|
|
2751
2751
|
isLooping() {
|
|
2752
2752
|
return this.aa.Yn;
|
|
2753
2753
|
}
|
|
2754
|
-
},
|
|
2754
|
+
}, ze = (n) => class extends n {
|
|
2755
2755
|
constructor(...t) {
|
|
2756
2756
|
super(...t);
|
|
2757
2757
|
}
|
|
@@ -2776,7 +2776,7 @@ const Xe = (n) => class extends n {
|
|
|
2776
2776
|
cursor(t) {
|
|
2777
2777
|
this.qo.mo(t);
|
|
2778
2778
|
}
|
|
2779
|
-
},
|
|
2779
|
+
}, ke = (n) => class extends n {
|
|
2780
2780
|
constructor(...t) {
|
|
2781
2781
|
super(...t);
|
|
2782
2782
|
}
|
|
@@ -2878,8 +2878,7 @@ class Ge {
|
|
|
2878
2878
|
}
|
|
2879
2879
|
_a(t) {
|
|
2880
2880
|
const e = this.fa.layers.base, i = e.drawFramebuffer, r = e.asciiFramebuffer;
|
|
2881
|
-
|
|
2882
|
-
return { renderer: this.fa.Z, font: e.font, grid: this.fa.grid, canvas: this.fa.kr, drawFramebuffer: i, asciiFramebuffer: r, registerPreDrawHook: (s) => this.Fa(this.pa, t, s), registerPostDrawHook: (s) => this.Fa(this.ga, t, s) };
|
|
2881
|
+
return { renderer: this.fa.Z, font: e.font, grid: e.grid, canvas: this.fa.kr, drawFramebuffer: i, asciiFramebuffer: r, registerPreDrawHook: (s) => this.Fa(this.pa, t, s), registerPostDrawHook: (s) => this.Fa(this.ga, t, s) };
|
|
2883
2882
|
}
|
|
2884
2883
|
Fa(t, e, i) {
|
|
2885
2884
|
const r = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
@@ -2899,9 +2898,9 @@ class Ge {
|
|
|
2899
2898
|
}
|
|
2900
2899
|
}
|
|
2901
2900
|
const V = `#version 300 es
|
|
2902
|
-
in vec2 A0;in vec2 A1;out vec2 v_uv;void main(){v_uv=A1;gl_Position=vec4(A0,0.,1.);}`,
|
|
2901
|
+
in vec2 A0;in vec2 A1;out vec2 v_uv;void main(){v_uv=A1;gl_Position=vec4(A0,0.,1.);}`, Dt = `#version 300 es
|
|
2903
2902
|
precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`;
|
|
2904
|
-
class
|
|
2903
|
+
class It {
|
|
2905
2904
|
constructor() {
|
|
2906
2905
|
a(this, "$a", /* @__PURE__ */ new Map());
|
|
2907
2906
|
a(this, "Pa", []);
|
|
@@ -2950,7 +2949,7 @@ class Bt {
|
|
|
2950
2949
|
});
|
|
2951
2950
|
}
|
|
2952
2951
|
}
|
|
2953
|
-
class
|
|
2952
|
+
class _t {
|
|
2954
2953
|
constructor(t = "active") {
|
|
2955
2954
|
a(this, "Ia");
|
|
2956
2955
|
a(this, "Ha", "");
|
|
@@ -2991,7 +2990,7 @@ class It {
|
|
|
2991
2990
|
this.Ia = "disabled";
|
|
2992
2991
|
}
|
|
2993
2992
|
}
|
|
2994
|
-
class
|
|
2993
|
+
class Ot {
|
|
2995
2994
|
constructor(t, e) {
|
|
2996
2995
|
a(this, "tc", 0);
|
|
2997
2996
|
a(this, "sc", 1);
|
|
@@ -3008,12 +3007,12 @@ class _t {
|
|
|
3008
3007
|
In() {
|
|
3009
3008
|
this.ec !== "none" && this.rc > 0 && (this.tc = performance.now());
|
|
3010
3009
|
}
|
|
3011
|
-
|
|
3010
|
+
et() {
|
|
3012
3011
|
if (this.ec === "none" || this.rc === 0) return this.sc = 1, !1;
|
|
3013
3012
|
const t = performance.now() - this.tc, e = Math.min(1, t / this.rc);
|
|
3014
3013
|
return e >= 1 ? (this.sc = 0, !0) : (this.sc = 1 - e, !1);
|
|
3015
3014
|
}
|
|
3016
|
-
|
|
3015
|
+
ti() {
|
|
3017
3016
|
this.sc = 1, this.tc = 0;
|
|
3018
3017
|
}
|
|
3019
3018
|
}
|
|
@@ -3026,13 +3025,13 @@ function gt(n, t) {
|
|
|
3026
3025
|
return 0.2126 * c(s) + 0.7152 * c(h) + 0.0722 * c(o);
|
|
3027
3026
|
}(t) > 0.5 ? "light" : "dark"), { mode: i, background: t, textColor: i === "light" ? "#1A1A1A" : "#F8F8F8", subtleColor: i === "light" ? "#4A4A4A" : "#C0C0C0" };
|
|
3028
3027
|
}
|
|
3029
|
-
function
|
|
3028
|
+
function Zt(n) {
|
|
3030
3029
|
return n.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
|
|
3031
3030
|
}
|
|
3032
|
-
function
|
|
3031
|
+
function Xt(n, t) {
|
|
3033
3032
|
return n.length ? n.map((e) => t.color(e)) : [t.color("#FFFFFF")];
|
|
3034
3033
|
}
|
|
3035
|
-
class
|
|
3034
|
+
class zt {
|
|
3036
3035
|
constructor(t, e, i) {
|
|
3037
3036
|
this.hc = t, this.id = e, this.label = i;
|
|
3038
3037
|
}
|
|
@@ -3176,21 +3175,21 @@ class it {
|
|
|
3176
3175
|
if (!this.ac) return void (this.xc = !1);
|
|
3177
3176
|
if (!this.Cc && !r) return void (this.xc = !1);
|
|
3178
3177
|
const s = this.gc.renderer;
|
|
3179
|
-
this._c.begin(), s.state.qt(), t.dn = this.nr;
|
|
3178
|
+
this._c.begin(), s.state.qt(), t.dn = this.nr, t.Uc = this.mc;
|
|
3180
3179
|
try {
|
|
3181
3180
|
this.Cc ? this.Cc.call(t) : r == null || r();
|
|
3182
3181
|
} finally {
|
|
3183
|
-
t.dn = void 0;
|
|
3182
|
+
t.dn = void 0, t.Uc = void 0;
|
|
3184
3183
|
}
|
|
3185
3184
|
this._c.end();
|
|
3186
3185
|
const h = this.Mc.length > 0, o = h ? this.wc : this.yc;
|
|
3187
|
-
o.begin(), s.
|
|
3186
|
+
o.begin(), s.ve(e);
|
|
3188
3187
|
const c = this.mc;
|
|
3189
|
-
e.O({ u_characterTexture: this.nr.fontFramebuffer, u_charsetDimensions: [this.nr.textureColumns, this.nr.textureRows], Ul: this._c.textures[0], Um: this._c.textures[1], Un: this._c.textures[2], Uo: [c.cols, c.rows], Up: [o.width, o.height], Uq: [0, 0, 0, 0] }), s.
|
|
3188
|
+
e.O({ u_characterTexture: this.nr.fontFramebuffer, u_charsetDimensions: [this.nr.textureColumns, this.nr.textureRows], Ul: this._c.textures[0], Um: this._c.textures[1], Un: this._c.textures[2], Uo: [c.cols, c.rows], Up: [o.width, o.height], Uq: [0, 0, 0, 0] }), s.we(0, 0, c.width, c.height), o.end(), h && this.gc.filterManager.Ec(this.wc.textures[0], this.yc, this.Mc, this.yc.width, this.yc.height, this.bc), this.Mc = [], this.xc = !0;
|
|
3190
3189
|
}
|
|
3191
3190
|
Jr() {
|
|
3192
3191
|
var t;
|
|
3193
|
-
this._c && this.yc && ((t = this.mc) == null || t.
|
|
3192
|
+
this._c && this.yc && ((t = this.mc) == null || t.ti());
|
|
3194
3193
|
}
|
|
3195
3194
|
gt() {
|
|
3196
3195
|
var t, e, i, r, s, h, o;
|
|
@@ -3213,7 +3212,7 @@ class it {
|
|
|
3213
3212
|
get height() {
|
|
3214
3213
|
return this.yc ? this.yc.height : 0;
|
|
3215
3214
|
}
|
|
3216
|
-
get
|
|
3215
|
+
get Rc() {
|
|
3217
3216
|
return this.xc;
|
|
3218
3217
|
}
|
|
3219
3218
|
get drawFramebuffer() {
|
|
@@ -3229,48 +3228,48 @@ class it {
|
|
|
3229
3228
|
}
|
|
3230
3229
|
}
|
|
3231
3230
|
const We = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
|
|
3232
|
-
class
|
|
3231
|
+
class kt {
|
|
3233
3232
|
constructor(t, e, i) {
|
|
3234
3233
|
a(this, "fa");
|
|
3235
3234
|
a(this, "l");
|
|
3236
|
-
a(this, "Rc");
|
|
3237
|
-
a(this, "hc");
|
|
3238
3235
|
a(this, "Sc");
|
|
3236
|
+
a(this, "hc");
|
|
3239
3237
|
a(this, "zc");
|
|
3240
3238
|
a(this, "kc");
|
|
3241
3239
|
a(this, "Dc");
|
|
3242
|
-
a(this, "Lc"
|
|
3243
|
-
a(this, "Oc");
|
|
3244
|
-
a(this, "Bc"
|
|
3245
|
-
a(this, "Ic",
|
|
3246
|
-
a(this, "Hc",
|
|
3240
|
+
a(this, "Lc");
|
|
3241
|
+
a(this, "Oc", []);
|
|
3242
|
+
a(this, "Bc");
|
|
3243
|
+
a(this, "Ic", performance.now());
|
|
3244
|
+
a(this, "Hc", 0);
|
|
3245
|
+
a(this, "Gc", !1);
|
|
3247
3246
|
a(this, "Ar", !1);
|
|
3248
|
-
a(this, "
|
|
3249
|
-
this.fa = t, this.l = { ...We, ...e ?? {} }, this.
|
|
3250
|
-
const r =
|
|
3251
|
-
this.
|
|
3247
|
+
a(this, "jc");
|
|
3248
|
+
this.fa = t, this.l = { ...We, ...e ?? {} }, this.Sc = new _t("active"), this.hc = new It(), this.zc = new Ot(this.l.transition, this.l.transitionDuration), this.kc = new Ut(60), this.Bc = gt(this.l, i);
|
|
3249
|
+
const r = Zt(this.Bc);
|
|
3250
|
+
this.Oc = Xt(r, this.fa), this.Lc = this.Qc(), this.hc.za((s) => {
|
|
3252
3251
|
s >= 0.999 && this.Wa();
|
|
3253
3252
|
});
|
|
3254
3253
|
}
|
|
3255
3254
|
async wr() {
|
|
3256
3255
|
if (this.Ar) return;
|
|
3257
|
-
const t = this.fa.Z, e = this.fa.kr, i = this.fa.
|
|
3258
|
-
this.
|
|
3256
|
+
const t = this.fa.Z, e = this.fa.kr, i = this.fa.Nc;
|
|
3257
|
+
this.Dc = new it(t, { visible: !0, opacity: 1, fontSize: 16 }), await this.Dc.Fc({ renderer: t, canvas: e, filterManager: i, createFramebuffer: (r, s, h = 1, o) => t.Pe(r, s, h, o) }), this.Ar = !0;
|
|
3259
3258
|
}
|
|
3260
3259
|
get Xa() {
|
|
3261
|
-
return this.
|
|
3260
|
+
return this.Sc.Xa && this.Gc;
|
|
3262
3261
|
}
|
|
3263
3262
|
In() {
|
|
3264
|
-
this.
|
|
3263
|
+
this.Gc || (this.Gc = !0, this.Ic = performance.now(), this.Hc = 0, this.kc.In(() => this.Xc()));
|
|
3265
3264
|
}
|
|
3266
3265
|
Hn() {
|
|
3267
|
-
this.
|
|
3266
|
+
this.Gc && (this.Gc = !1, this.kc.Hn());
|
|
3268
3267
|
}
|
|
3269
3268
|
Jr() {
|
|
3270
|
-
this.Ar && this.
|
|
3269
|
+
this.Ar && this.Dc.Jr();
|
|
3271
3270
|
}
|
|
3272
3271
|
gt() {
|
|
3273
|
-
this.Hn(), this.Ar && (this.
|
|
3272
|
+
this.Hn(), this.Ar && (this.Dc.gt(), this.Ar = !1);
|
|
3274
3273
|
}
|
|
3275
3274
|
get progress() {
|
|
3276
3275
|
return this.hc.Sa;
|
|
@@ -3279,53 +3278,53 @@ class zt {
|
|
|
3279
3278
|
return typeof t == "string" && (this.l.message = t), this.l.message;
|
|
3280
3279
|
}
|
|
3281
3280
|
addPhase(t, e = 1) {
|
|
3282
|
-
this.
|
|
3281
|
+
this.Sc.Ka();
|
|
3283
3282
|
const i = this.hc.ka(t, e);
|
|
3284
|
-
return new
|
|
3283
|
+
return new zt(this.hc, i, t);
|
|
3285
3284
|
}
|
|
3286
3285
|
Wa() {
|
|
3287
|
-
this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.
|
|
3286
|
+
this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.Sc.Za(), this.zc.In()) : (this.Sc.Wa(), this.Hn(), this.Yc());
|
|
3288
3287
|
}
|
|
3289
|
-
|
|
3290
|
-
this.
|
|
3288
|
+
Yc() {
|
|
3289
|
+
this.jc && this.jc();
|
|
3291
3290
|
}
|
|
3292
|
-
|
|
3293
|
-
this.
|
|
3291
|
+
Kc(t) {
|
|
3292
|
+
this.jc = t;
|
|
3294
3293
|
}
|
|
3295
3294
|
error(t) {
|
|
3296
|
-
this.
|
|
3295
|
+
this.Sc.Va(t);
|
|
3297
3296
|
}
|
|
3298
|
-
|
|
3299
|
-
if (this.
|
|
3300
|
-
if (this.
|
|
3301
|
-
return this.
|
|
3302
|
-
this.
|
|
3297
|
+
Xc() {
|
|
3298
|
+
if (this.Sc.Xa) {
|
|
3299
|
+
if (this.Hc++, this.Sc.Qa === "transitioning" && this.zc.et())
|
|
3300
|
+
return this.Sc.qa(), this.Yc(), void this.Hn();
|
|
3301
|
+
this.Wc();
|
|
3303
3302
|
}
|
|
3304
3303
|
}
|
|
3305
|
-
|
|
3304
|
+
Wc() {
|
|
3306
3305
|
if (!this.Ar) return;
|
|
3307
|
-
const t = this.
|
|
3306
|
+
const t = this.Dc, e = t.grid, i = this.fa.Z, r = this.fa.Zc, s = this.fa.qc, h = { textmodifier: this.fa, grid: e, progress: this.progress, elapsedMs: performance.now() - this.Ic, frameCount: this.Hc, message: this.l.message, palette: this.Oc, theme: this.Bc, phases: this.hc.Ba(), transitionOpacity: this.zc.nc, isError: this.Sc.Qa === "error", errorMessage: this.Sc.Ya || void 0, errorDetails: this.Sc.ja || void 0 };
|
|
3308
3307
|
t.draw(() => {
|
|
3309
3308
|
this.fa.clear(), this.fa.push();
|
|
3310
3309
|
try {
|
|
3311
|
-
this.
|
|
3310
|
+
this.Lc(h);
|
|
3312
3311
|
} finally {
|
|
3313
3312
|
this.fa.pop();
|
|
3314
3313
|
}
|
|
3315
3314
|
}), t.ca(this.fa, r);
|
|
3316
3315
|
const o = t.texture;
|
|
3317
|
-
o && (i.
|
|
3316
|
+
o && (i.wi(...i.state.canvasBackgroundColor), i.ve(s), s.O({ u_texture: o }), i.we(e.offsetX, e.offsetY, e.width, e.height));
|
|
3318
3317
|
}
|
|
3319
|
-
|
|
3320
|
-
this.
|
|
3318
|
+
Vc(t) {
|
|
3319
|
+
this.Bc = gt(this.l, t);
|
|
3321
3320
|
}
|
|
3322
|
-
|
|
3321
|
+
Qc() {
|
|
3323
3322
|
const t = this.l.renderer || He;
|
|
3324
3323
|
return (e) => {
|
|
3325
|
-
t(e), this.
|
|
3324
|
+
t(e), this.Jc(e);
|
|
3326
3325
|
};
|
|
3327
3326
|
}
|
|
3328
|
-
|
|
3327
|
+
Jc(t) {
|
|
3329
3328
|
const { textmodifier: e, grid: i, frameCount: r, theme: s, transitionOpacity: h } = t, o = [116, 101, 120, 116, 109, 111, 100, 101, 46, 106, 115].map((f) => String.fromCharCode(f)).join(""), c = (i.rows + 1 >> 1) - 2, l = 2 - (i.cols + 1 >> 1), u = s.mode === "light" ? [[233, 30, 99], [156, 39, 176], [255, 111, 0]] : [[142, 249, 243], [241, 91, 181], [255, 155, 113]];
|
|
3330
3329
|
e.push(), e.translate(l, c, 0);
|
|
3331
3330
|
for (let f = 0; f < o.length; f++) {
|
|
@@ -3339,135 +3338,135 @@ const wt = { normal: 0, additive: 1, multiply: 2, screen: 3, subtract: 4, darken
|
|
|
3339
3338
|
class Yt {
|
|
3340
3339
|
constructor(t, e, i) {
|
|
3341
3340
|
a(this, "Z");
|
|
3342
|
-
a(this, "
|
|
3341
|
+
a(this, "tl");
|
|
3343
3342
|
a(this, "bc");
|
|
3344
|
-
a(this, "
|
|
3345
|
-
this.Z = t, this.
|
|
3346
|
-
precision highp float;uniform sampler2D Ud;uniform sampler2D Ue;uniform vec2 Uf;uniform vec2 Ug;uniform vec2 Uh;uniform float Ui;uniform float Uj;uniform int Uk;in vec2 v_uv;out vec4 fragColor;const int A=0;const int B=1;const int C=2;const int D=3;const int E=4;const int F=5;const int G=6;const int H=7;const int I=8;const int J=9;const int K=10;const int L=11;const int M=12;const int N=13;vec3 O(vec3 P,vec3 Q){return Q;}vec3 R(vec3 P,vec3 Q){return P+Q;}vec3 S(vec3 P,vec3 Q){return P*Q;}vec3 T(vec3 P,vec3 Q){return 1.-(1.-P)*(1.-Q);}vec3 U(vec3 P,vec3 Q){return max(P-Q,0.);}vec3 V(vec3 P,vec3 Q){return min(P,Q);}vec3 W(vec3 P,vec3 Q){return max(P,Q);}vec3 X(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,P));}vec3 Y(vec3 P,vec3 Q){return mix(P-(1.-2.*Q)*P*(1.-P),mix(P+(2.*Q-1.)*(P*(3.-2.*P)-P),P+(2.*Q-1.)*(sqrt(P)-P),step(0.25,P)),step(0.5,Q));}vec3 Z(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,Q));}vec3 a(vec3 P,vec3 Q){return mix(min(vec3(1.),P/max(1.-Q,0.0001)),vec3(1.),step(1.,Q));}vec3 b(vec3 P,vec3 Q){return mix(1.-min(vec3(1.),(1.-P)/max(Q,0.0001)),vec3(0.),step(Q,vec3(0.)));}vec3 c(vec3 P,vec3 Q){return abs(P-Q);}vec3 d(vec3 P,vec3 Q){return P+Q-2.*P*Q;}vec3 e(int f,vec3 P,vec3 Q){if(f==A)return O(P,Q);if(f==B)return R(P,Q);if(f==C)return S(P,Q);if(f==D)return T(P,Q);if(f==E)return U(P,Q);if(f==F)return V(P,Q);if(f==G)return W(P,Q);if(f==H)return X(P,Q);if(f==I)return Y(P,Q);if(f==J)return Z(P,Q);if(f==K)return a(P,Q);if(f==L)return b(P,Q);if(f==M)return c(P,Q);if(f==N)return d(P,Q);return O(P,Q);}void main(){vec4 g=texture(Ue,v_uv);vec2 h=v_uv*Uf;vec2 i=h-Uh;vec2 j=Ug*0.5;vec2 k=i-j;float l=cos(-Uj);float m=sin(-Uj);vec2 n=vec2(k.x*l-k.y*m,k.x*m+k.y*l);i=n+j;bool o=any(lessThan(i,vec2(0.)))||any(greaterThanEqual(i,Ug));if(o){fragColor=g;return;}vec2 p=(floor(i)+0.5)/Ug;vec4 q=texture(Ud,p);float r=q.a*Ui;if(r<=0.){fragColor=g;return;}vec3 s=e(Uk,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`), this.bc = [this.Z.
|
|
3343
|
+
a(this, "sl", 0);
|
|
3344
|
+
this.Z = t, this.tl = t.pe(V, `#version 300 es
|
|
3345
|
+
precision highp float;uniform sampler2D Ud;uniform sampler2D Ue;uniform vec2 Uf;uniform vec2 Ug;uniform vec2 Uh;uniform float Ui;uniform float Uj;uniform int Uk;in vec2 v_uv;out vec4 fragColor;const int A=0;const int B=1;const int C=2;const int D=3;const int E=4;const int F=5;const int G=6;const int H=7;const int I=8;const int J=9;const int K=10;const int L=11;const int M=12;const int N=13;vec3 O(vec3 P,vec3 Q){return Q;}vec3 R(vec3 P,vec3 Q){return P+Q;}vec3 S(vec3 P,vec3 Q){return P*Q;}vec3 T(vec3 P,vec3 Q){return 1.-(1.-P)*(1.-Q);}vec3 U(vec3 P,vec3 Q){return max(P-Q,0.);}vec3 V(vec3 P,vec3 Q){return min(P,Q);}vec3 W(vec3 P,vec3 Q){return max(P,Q);}vec3 X(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,P));}vec3 Y(vec3 P,vec3 Q){return mix(P-(1.-2.*Q)*P*(1.-P),mix(P+(2.*Q-1.)*(P*(3.-2.*P)-P),P+(2.*Q-1.)*(sqrt(P)-P),step(0.25,P)),step(0.5,Q));}vec3 Z(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,Q));}vec3 a(vec3 P,vec3 Q){return mix(min(vec3(1.),P/max(1.-Q,0.0001)),vec3(1.),step(1.,Q));}vec3 b(vec3 P,vec3 Q){return mix(1.-min(vec3(1.),(1.-P)/max(Q,0.0001)),vec3(0.),step(Q,vec3(0.)));}vec3 c(vec3 P,vec3 Q){return abs(P-Q);}vec3 d(vec3 P,vec3 Q){return P+Q-2.*P*Q;}vec3 e(int f,vec3 P,vec3 Q){if(f==A)return O(P,Q);if(f==B)return R(P,Q);if(f==C)return S(P,Q);if(f==D)return T(P,Q);if(f==E)return U(P,Q);if(f==F)return V(P,Q);if(f==G)return W(P,Q);if(f==H)return X(P,Q);if(f==I)return Y(P,Q);if(f==J)return Z(P,Q);if(f==K)return a(P,Q);if(f==L)return b(P,Q);if(f==M)return c(P,Q);if(f==N)return d(P,Q);return O(P,Q);}void main(){vec4 g=texture(Ue,v_uv);vec2 h=v_uv*Uf;vec2 i=h-Uh;vec2 j=Ug*0.5;vec2 k=i-j;float l=cos(-Uj);float m=sin(-Uj);vec2 n=vec2(k.x*l-k.y*m,k.x*m+k.y*l);i=n+j;bool o=any(lessThan(i,vec2(0.)))||any(greaterThanEqual(i,Ug));if(o){fragColor=g;return;}vec2 p=(floor(i)+0.5)/Ug;vec4 q=texture(Ud,p);float r=q.a*Ui;if(r<=0.){fragColor=g;return;}vec3 s=e(Uk,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`), this.bc = [this.Z.Pe(e, i, 1), this.Z.Pe(e, i, 1)];
|
|
3347
3346
|
}
|
|
3348
|
-
|
|
3347
|
+
il(t) {
|
|
3349
3348
|
const e = this.Z.context, { base: i, targetFramebuffer: r, backgroundColor: s, layers: h, canvasWidth: o, canvasHeight: c } = t, l = e.isEnabled(e.DEPTH_TEST), u = e.getParameter(e.DEPTH_WRITEMASK);
|
|
3350
3349
|
l && e.disable(e.DEPTH_TEST), u && e.depthMask(!1);
|
|
3351
3350
|
const f = this.bc[0];
|
|
3352
|
-
f.begin(), this.Z.
|
|
3351
|
+
f.begin(), this.Z.wi(...s), f.end(), this.sl = 0, i.layer.ac && this.el(i.texture, o, c, i.width, i.height, i.layer.nc, i.offsetX, i.offsetY, i.layer.fc, "normal", e);
|
|
3353
3352
|
for (const d of h) {
|
|
3354
3353
|
const g = d.layer;
|
|
3355
|
-
g.ac && g.
|
|
3354
|
+
g.ac && g.Rc && this.el(d.texture, o, c, d.width, d.height, g.nc, d.offsetX, d.offsetY, g.fc, g.cc, e);
|
|
3356
3355
|
}
|
|
3357
|
-
this.
|
|
3356
|
+
this.rl(r, o, c, e), e.depthMask(u), l && e.enable(e.DEPTH_TEST);
|
|
3358
3357
|
}
|
|
3359
3358
|
el(t, e, i, r, s, h, o, c, l, u, f) {
|
|
3360
|
-
const d = this.bc[this.
|
|
3361
|
-
p.begin(), f.disable(f.BLEND), this.Z.
|
|
3359
|
+
const d = this.bc[this.sl], g = this.sl === 0 ? 1 : 0, p = this.bc[g], v = l * (Math.PI / 180);
|
|
3360
|
+
p.begin(), f.disable(f.BLEND), this.Z.ve(this.tl), this.tl.O({ Ud: t, Ue: d.textures[0], Uf: [e, i], Ug: [r, s], Uh: [o, c], Ui: h, Uj: v, Uk: wt[u] }), this.Z.we(0, 0, d.width, d.height), p.end(), this.sl = g;
|
|
3362
3361
|
}
|
|
3363
|
-
|
|
3364
|
-
const s = this.bc[this.
|
|
3365
|
-
t.begin(), r.disable(r.BLEND), this.Z.
|
|
3362
|
+
rl(t, e, i, r) {
|
|
3363
|
+
const s = this.bc[this.sl];
|
|
3364
|
+
t.begin(), r.disable(r.BLEND), this.Z.ve(this.tl), this.tl.O({ Ud: s.textures[0], Ue: s.textures[0], Uf: [e, i], Ug: [s.width, s.height], Uh: [0, 0], Ui: 1, Uj: 0, Uk: wt.normal }), this.Z.we(0, 0, e, i), t.end();
|
|
3366
3365
|
}
|
|
3367
3366
|
Jr(t, e) {
|
|
3368
3367
|
this.bc[0].resize(t, e), this.bc[1].resize(t, e);
|
|
3369
3368
|
}
|
|
3370
3369
|
gt() {
|
|
3371
|
-
this.
|
|
3370
|
+
this.tl.dispose(), this.bc[0].gt(), this.bc[1].gt();
|
|
3372
3371
|
}
|
|
3373
3372
|
}
|
|
3374
3373
|
class Gt {
|
|
3375
3374
|
constructor(t, e) {
|
|
3376
3375
|
a(this, "fa");
|
|
3377
3376
|
a(this, "Z");
|
|
3378
|
-
a(this, "rl");
|
|
3379
3377
|
a(this, "nl");
|
|
3380
|
-
a(this, "ol"
|
|
3378
|
+
a(this, "ol");
|
|
3381
3379
|
a(this, "hl", []);
|
|
3382
|
-
a(this, "al");
|
|
3383
|
-
a(this, "cl"
|
|
3384
|
-
a(this, "ll",
|
|
3385
|
-
|
|
3380
|
+
a(this, "al", []);
|
|
3381
|
+
a(this, "cl");
|
|
3382
|
+
a(this, "ll", !1);
|
|
3383
|
+
a(this, "ul", /* @__PURE__ */ new Set());
|
|
3384
|
+
this.fa = t, this.Z = t.Z, this.nl = t.Zc, this.ol = new Yt(this.Z, this.fa.kr.width, this.fa.kr.height), this.cl = new it(this.Z, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
|
|
3386
3385
|
}
|
|
3387
3386
|
async wr() {
|
|
3388
|
-
if (!this.
|
|
3389
|
-
await this.
|
|
3390
|
-
for (const t of this.
|
|
3391
|
-
this.
|
|
3387
|
+
if (!this.ll) {
|
|
3388
|
+
await this.fl(this.cl);
|
|
3389
|
+
for (const t of this.hl) await this.fl(t), this.al.push(t);
|
|
3390
|
+
this.hl = [], this.ll = !0;
|
|
3392
3391
|
}
|
|
3393
3392
|
}
|
|
3394
3393
|
add(t = {}) {
|
|
3395
3394
|
const e = new it(this.Z, t);
|
|
3396
|
-
return this.
|
|
3395
|
+
return this.ll ? (this.fl(e), this.al.push(e)) : this.hl.push(e), e;
|
|
3397
3396
|
}
|
|
3398
3397
|
remove(t) {
|
|
3399
|
-
this.
|
|
3398
|
+
this.dl(this.al, t) || this.dl(this.hl, t);
|
|
3400
3399
|
}
|
|
3401
3400
|
move(t, e) {
|
|
3402
|
-
this.
|
|
3401
|
+
this.vl(this.al, t, e) || this.vl(this.hl, t, e);
|
|
3403
3402
|
}
|
|
3404
3403
|
swap(t, e) {
|
|
3405
|
-
t !== e && (this.
|
|
3404
|
+
t !== e && (this.pl(this.al, t, e) || this.pl(this.hl, t, e));
|
|
3406
3405
|
}
|
|
3407
3406
|
clear() {
|
|
3408
|
-
this.
|
|
3407
|
+
this.cl.gt(), this.al.forEach((t) => t.gt()), this.al = [], this.hl.forEach((t) => t.gt()), this.hl = [];
|
|
3409
3408
|
}
|
|
3410
|
-
|
|
3411
|
-
this.
|
|
3409
|
+
ml(t, e) {
|
|
3410
|
+
this.cl.ca(this.fa, this.nl, { fallbackDraw: e });
|
|
3412
3411
|
const i = [...this.Z.state.canvasBackgroundColor];
|
|
3413
|
-
this.
|
|
3412
|
+
this._l(), this.yl(t, i);
|
|
3414
3413
|
}
|
|
3415
|
-
|
|
3416
|
-
this.
|
|
3414
|
+
_l() {
|
|
3415
|
+
this.al.length !== 0 && this.al.forEach((t) => t.ca(this.fa, this.nl));
|
|
3417
3416
|
}
|
|
3418
|
-
|
|
3419
|
-
const i = this.fa.kr, r = this.
|
|
3417
|
+
yl(t, e) {
|
|
3418
|
+
const i = this.fa.kr, r = this.cl.grid, s = this.cl.texture;
|
|
3420
3419
|
if (!s) return;
|
|
3421
|
-
const h = { layer: this.
|
|
3420
|
+
const h = { layer: this.cl, texture: s, width: r.width, height: r.height, offsetX: r.offsetX + this.cl.lc, offsetY: r.offsetY + this.cl.uc }, o = this.al.map((c) => {
|
|
3422
3421
|
const l = c.grid;
|
|
3423
3422
|
return { layer: c, texture: c.texture, width: l.width, height: l.height, offsetX: l.offsetX + c.lc, offsetY: l.offsetY + c.uc };
|
|
3424
3423
|
});
|
|
3425
|
-
this.
|
|
3424
|
+
this.ol.il({ base: h, layers: o, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
|
|
3426
3425
|
}
|
|
3427
3426
|
Jr() {
|
|
3428
|
-
this.
|
|
3427
|
+
this.ll && (this.cl.Jr(), this.al.forEach((t) => t.Jr()), this.ol.Jr(this.fa.kr.width, this.fa.kr.height));
|
|
3429
3428
|
}
|
|
3430
3429
|
gt() {
|
|
3431
|
-
this.
|
|
3430
|
+
this.al.forEach((t) => t.gt()), this.hl.forEach((t) => t.gt()), this.cl.gt(), this.ol.gt();
|
|
3432
3431
|
}
|
|
3433
3432
|
get all() {
|
|
3434
|
-
return this.
|
|
3433
|
+
return this.al;
|
|
3435
3434
|
}
|
|
3436
3435
|
get base() {
|
|
3437
|
-
return this.
|
|
3436
|
+
return this.cl;
|
|
3438
3437
|
}
|
|
3439
3438
|
getTopmostGrid() {
|
|
3440
|
-
for (let t = this.
|
|
3441
|
-
const e = this.
|
|
3439
|
+
for (let t = this.al.length - 1; t >= 0; t--) {
|
|
3440
|
+
const e = this.al[t];
|
|
3442
3441
|
if (e.ac && e.grid) return e.grid;
|
|
3443
3442
|
}
|
|
3444
|
-
return this.
|
|
3443
|
+
return this.cl.grid;
|
|
3445
3444
|
}
|
|
3446
|
-
|
|
3447
|
-
this.
|
|
3445
|
+
Al(t) {
|
|
3446
|
+
this.ul.add(t);
|
|
3448
3447
|
}
|
|
3449
|
-
|
|
3450
|
-
for (const t of this.
|
|
3448
|
+
wl() {
|
|
3449
|
+
for (const t of this.ul) t();
|
|
3451
3450
|
}
|
|
3452
|
-
async
|
|
3451
|
+
async fl(t) {
|
|
3453
3452
|
var i;
|
|
3454
|
-
const e = { renderer: this.Z, canvas: this.fa.kr, filterManager: this.fa.
|
|
3455
|
-
await t.Fc(e), (i = t.grid) == null || i.Hr(() => this.
|
|
3453
|
+
const e = { renderer: this.Z, canvas: this.fa.kr, filterManager: this.fa.Nc, createFramebuffer: (r, s, h = 1, o) => this.Z.Pe(r, s, h, o) };
|
|
3454
|
+
await t.Fc(e), (i = t.grid) == null || i.Hr(() => this.wl());
|
|
3456
3455
|
}
|
|
3457
|
-
|
|
3456
|
+
dl(t, e) {
|
|
3458
3457
|
const i = t.indexOf(e);
|
|
3459
3458
|
if (i === -1) return !1;
|
|
3460
3459
|
const [r] = t.splice(i, 1);
|
|
3461
3460
|
return r.gt(), !0;
|
|
3462
3461
|
}
|
|
3463
|
-
|
|
3462
|
+
vl(t, e, i) {
|
|
3464
3463
|
const r = t.indexOf(e);
|
|
3465
3464
|
if (r === -1) return !1;
|
|
3466
3465
|
t.splice(r, 1);
|
|
3467
3466
|
const s = Math.max(0, Math.min(t.length, i));
|
|
3468
3467
|
return t.splice(s, 0, e), !0;
|
|
3469
3468
|
}
|
|
3470
|
-
|
|
3469
|
+
pl(t, e, i) {
|
|
3471
3470
|
const r = t.indexOf(e);
|
|
3472
3471
|
if (r === -1) return !1;
|
|
3473
3472
|
const s = t.indexOf(i);
|
|
@@ -3477,11 +3476,11 @@ class Gt {
|
|
|
3477
3476
|
class Ht {
|
|
3478
3477
|
constructor(t) {
|
|
3479
3478
|
a(this, "Z");
|
|
3480
|
-
a(this, "wl", /* @__PURE__ */ new Map());
|
|
3481
3479
|
a(this, "bl", /* @__PURE__ */ new Map());
|
|
3482
|
-
this
|
|
3480
|
+
a(this, "Cl", /* @__PURE__ */ new Map());
|
|
3481
|
+
this.Z = t, this.xl();
|
|
3483
3482
|
}
|
|
3484
|
-
async
|
|
3483
|
+
async Ml(t, e, i = {}) {
|
|
3485
3484
|
const r = Object.entries(i), s = r.length > 0 ? r[0][1][0] : null;
|
|
3486
3485
|
let h;
|
|
3487
3486
|
if (typeof e == "string") {
|
|
@@ -3491,8 +3490,8 @@ class Ht {
|
|
|
3491
3490
|
if (!l.ok) throw Error(`Failed to load shader from ${e}: ${l.statusText}`);
|
|
3492
3491
|
c = await l.text();
|
|
3493
3492
|
}
|
|
3494
|
-
h = this.Z.
|
|
3495
|
-
} else h = e, this.
|
|
3493
|
+
h = this.Z.pe(V, c), this.Cl.set(t, h);
|
|
3494
|
+
} else h = e, this.Cl.set(t, h);
|
|
3496
3495
|
const o = { id: t, createShader: () => h, createUniforms: (c, l) => {
|
|
3497
3496
|
const u = { u_resolution: [l.width, l.height] };
|
|
3498
3497
|
for (const [f, [d, g]] of r) {
|
|
@@ -3501,88 +3500,88 @@ class Ht {
|
|
|
3501
3500
|
}
|
|
3502
3501
|
return u;
|
|
3503
3502
|
} };
|
|
3504
|
-
this.
|
|
3503
|
+
this.bl.set(t, o);
|
|
3505
3504
|
}
|
|
3506
|
-
|
|
3507
|
-
const e = this.
|
|
3508
|
-
return e && (e.dispose(), this.
|
|
3505
|
+
Fl(t) {
|
|
3506
|
+
const e = this.Cl.get(t);
|
|
3507
|
+
return e && (e.dispose(), this.Cl.delete(t)), this.bl.delete(t);
|
|
3509
3508
|
}
|
|
3510
3509
|
Pn(t) {
|
|
3511
|
-
return this.
|
|
3510
|
+
return this.bl.get(t);
|
|
3512
3511
|
}
|
|
3513
3512
|
gt() {
|
|
3514
|
-
for (const t of this.
|
|
3515
|
-
this.
|
|
3516
|
-
}
|
|
3517
|
-
|
|
3518
|
-
this.
|
|
3519
|
-
precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);fragColor=vec4(1.-A.rgb,A.a);}`, {}), this.
|
|
3520
|
-
precision highp float;uniform sampler2D u_texture;uniform float U8;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));vec3 C=mix(A.rgb,vec3(B),U8);fragColor=vec4(C,A.a);}`, { U8: ["amount", 1] }), this.
|
|
3521
|
-
precision highp float;uniform sampler2D u_texture;uniform float U8;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);vec3 B;B.r=dot(A.rgb,vec3(0.393,0.769,0.189));B.g=dot(A.rgb,vec3(0.349,0.686,0.168));B.b=dot(A.rgb,vec3(0.272,0.534,0.131));vec3 C=mix(A.rgb,B,U8);fragColor=vec4(C,A.a);}`, { U8: ["amount", 1] }), this.
|
|
3513
|
+
for (const t of this.Cl.values()) t.dispose();
|
|
3514
|
+
this.Cl.clear(), this.bl.clear();
|
|
3515
|
+
}
|
|
3516
|
+
xl() {
|
|
3517
|
+
this.Ml("invert", `#version 300 es
|
|
3518
|
+
precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);fragColor=vec4(1.-A.rgb,A.a);}`, {}), this.Ml("grayscale", `#version 300 es
|
|
3519
|
+
precision highp float;uniform sampler2D u_texture;uniform float U8;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));vec3 C=mix(A.rgb,vec3(B),U8);fragColor=vec4(C,A.a);}`, { U8: ["amount", 1] }), this.Ml("sepia", `#version 300 es
|
|
3520
|
+
precision highp float;uniform sampler2D u_texture;uniform float U8;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);vec3 B;B.r=dot(A.rgb,vec3(0.393,0.769,0.189));B.g=dot(A.rgb,vec3(0.349,0.686,0.168));B.b=dot(A.rgb,vec3(0.272,0.534,0.131));vec3 C=mix(A.rgb,B,U8);fragColor=vec4(C,A.a);}`, { U8: ["amount", 1] }), this.Ml("threshold", `#version 300 es
|
|
3522
3521
|
precision highp float;uniform sampler2D u_texture;uniform float U9;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));float C=step(U9,B);fragColor=vec4(vec3(C),A.a);}`, { U9: ["threshold", 0.5] });
|
|
3523
3522
|
}
|
|
3524
3523
|
}
|
|
3525
3524
|
class Wt {
|
|
3526
3525
|
constructor(t) {
|
|
3527
3526
|
a(this, "Z");
|
|
3528
|
-
a(this, "
|
|
3527
|
+
a(this, "Cl", /* @__PURE__ */ new Map());
|
|
3529
3528
|
a(this, "J");
|
|
3530
3529
|
a(this, "bc");
|
|
3531
3530
|
a(this, "Ar", !1);
|
|
3532
|
-
a(this, "
|
|
3533
|
-
this.Z = t, this
|
|
3531
|
+
a(this, "$l");
|
|
3532
|
+
this.Z = t, this.$l = new Ht(this.Z), this.J = t.pe(V, Dt);
|
|
3534
3533
|
}
|
|
3535
3534
|
async register(t, e, i = {}) {
|
|
3536
|
-
await this.
|
|
3535
|
+
await this.$l.Ml(t, e, i);
|
|
3537
3536
|
}
|
|
3538
3537
|
unregister(t) {
|
|
3539
|
-
return this.Fl
|
|
3538
|
+
return this.$l.Fl(t) ?? !1;
|
|
3540
3539
|
}
|
|
3541
3540
|
has(t) {
|
|
3542
|
-
return this.
|
|
3541
|
+
return this.$l.Pn(t) !== void 0;
|
|
3543
3542
|
}
|
|
3544
3543
|
wr(t, e) {
|
|
3545
|
-
this.Ar || (this.bc = [this.Z.
|
|
3544
|
+
this.Ar || (this.bc = [this.Z.Pe(t, e, 1, { depth: !1 }), this.Z.Pe(t, e, 1, { depth: !1 })], this.Ar = !0);
|
|
3546
3545
|
}
|
|
3547
|
-
|
|
3548
|
-
this.bc[0].width === r && this.bc[0].height === s || (this.bc[0].resize(r, s), this.bc[1].resize(r, s)), this.
|
|
3546
|
+
Pl(t, e, i, r, s) {
|
|
3547
|
+
this.bc[0].width === r && this.bc[0].height === s || (this.bc[0].resize(r, s), this.bc[1].resize(r, s)), this.Ec(t, e, i, r, s, this.bc);
|
|
3549
3548
|
}
|
|
3550
|
-
|
|
3551
|
-
if (i.length === 0) return void this.
|
|
3549
|
+
Ec(t, e, i, r, s, h) {
|
|
3550
|
+
if (i.length === 0) return void this.Tl(t, e, r, s);
|
|
3552
3551
|
const o = this.Z.context, c = o.isEnabled(o.BLEND);
|
|
3553
|
-
o.disable(o.BLEND), this.
|
|
3552
|
+
o.disable(o.BLEND), this.Tl(t, h[0], r, s);
|
|
3554
3553
|
let l = 0;
|
|
3555
3554
|
for (let u = 0; u < i.length; u++) {
|
|
3556
3555
|
const f = i[u], d = u === i.length - 1, g = l === 0 ? 1 : 0, p = d ? e : h[g];
|
|
3557
|
-
this.
|
|
3556
|
+
this.El(f, h[l], p, r, s), d || (l = g);
|
|
3558
3557
|
}
|
|
3559
3558
|
c && o.enable(o.BLEND);
|
|
3560
3559
|
}
|
|
3561
|
-
|
|
3562
|
-
const h = this.
|
|
3563
|
-
if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.
|
|
3564
|
-
const o = this.
|
|
3565
|
-
i.begin(), this.Z.
|
|
3560
|
+
El(t, e, i, r, s) {
|
|
3561
|
+
const h = this.$l.Pn(t.name);
|
|
3562
|
+
if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.Tl(e.textures[0], i, r, s);
|
|
3563
|
+
const o = this.Rl(t.name, h, r, s), c = { renderer: this.Z, gl: this.Z.context, width: r, height: s };
|
|
3564
|
+
i.begin(), this.Z.ve(o), o.O({ u_texture: e.textures[0] });
|
|
3566
3565
|
const l = h.createUniforms(t.params, c);
|
|
3567
|
-
o.O(l), this.Z.
|
|
3566
|
+
o.O(l), this.Z.we(0, 0, r, s), i.end();
|
|
3568
3567
|
}
|
|
3569
|
-
|
|
3570
|
-
let s = this.
|
|
3568
|
+
Rl(t, e, i, r) {
|
|
3569
|
+
let s = this.Cl.get(t);
|
|
3571
3570
|
if (!s && e) {
|
|
3572
3571
|
const h = { renderer: this.Z, gl: this.Z.context, width: i, height: r };
|
|
3573
|
-
s = e.createShader(h), this.
|
|
3572
|
+
s = e.createShader(h), this.Cl.set(t, s);
|
|
3574
3573
|
}
|
|
3575
3574
|
return s;
|
|
3576
3575
|
}
|
|
3577
|
-
|
|
3578
|
-
e.begin(), this.Z.
|
|
3576
|
+
Tl(t, e, i, r) {
|
|
3577
|
+
e.begin(), this.Z.ve(this.J), this.J.O({ u_texture: t, u_resolution: [i, r] }), this.Z.we(0, 0, i, r), e.end();
|
|
3579
3578
|
}
|
|
3580
3579
|
Jr(t, e) {
|
|
3581
3580
|
this.bc && (this.bc[0].resize(t, e), this.bc[1].resize(t, e));
|
|
3582
3581
|
}
|
|
3583
3582
|
gt() {
|
|
3584
|
-
for (const t of this.
|
|
3585
|
-
this.
|
|
3583
|
+
for (const t of this.Cl.values()) t.dispose();
|
|
3584
|
+
this.Cl.clear(), this.J.dispose(), this.$l.gt(), this.bc && (this.bc[0].gt(), this.bc[1].gt()), this.Ar = !1;
|
|
3586
3585
|
}
|
|
3587
3586
|
}
|
|
3588
3587
|
const Qe = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: Ht, TextmodeFilterManager: Wt }, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -3591,57 +3590,57 @@ const qe = { id: "brightness", createShader: ({ gl: n }) => (lt || (lt = new q(n
|
|
|
3591
3590
|
precision highp float;in vec2 v_uv;uniform sampler2D u_image;uniform bool u_invert;uniform bool u_flipX;uniform bool u_flipY;uniform float u_charRotation;uniform bool u_charColorFixed;uniform vec4 u_charColor;uniform bool u_cellColorFixed;uniform vec4 u_cellColor;uniform vec4 u_backgroundColor;uniform int u_charCount;uniform vec3 u_charList[255];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;float B(vec3 C){return dot(C,vec3(0.299f,0.587f,0.114f));}void main(){vec2 D=vec2(v_uv.x,1.0f-v_uv.y);vec4 E=texture(u_image,D);float F=B(E.rgb);vec2 G=vec2(0.);if(u_charCount>0){float H=float(u_charCount);float I=clamp(F*(H-1.0f),0.0f,H-1.0f);int J=int(floor(I+0.5f));vec3 K=u_charList[J];G=K.xy;}else{G=vec2(0.0f,0.0f);}vec4 L=u_charColorFixed?u_charColor:E;vec4 M=u_cellColorFixed?u_cellColor:E;if(E.a<0.01f){discard;}o_primaryColor=vec4(L.rgb,L.a);o_secondaryColor=vec4(M.rgb,M.a);A=vec4(0.);int N=int(u_invert?1:0);int O=int(u_flipX?1:0);int P=int(u_flipY?1:0);float Q=float(N|(O<<1)|(P<<2))/255.;o_character=vec4(G,Q,clamp(u_charRotation,0.0f,1.0f));}`)), lt), createUniforms: ({ source: n }) => n.createBaseConversionUniforms() };
|
|
3592
3591
|
class qt {
|
|
3593
3592
|
constructor() {
|
|
3594
|
-
a(this, "
|
|
3595
|
-
a(this, "
|
|
3596
|
-
this.
|
|
3597
|
-
}
|
|
3598
|
-
xl(t) {
|
|
3599
|
-
this.Rl.set(t.id, t);
|
|
3593
|
+
a(this, "Sl", /* @__PURE__ */ new Map());
|
|
3594
|
+
a(this, "Cl", /* @__PURE__ */ new Map());
|
|
3595
|
+
this.zl();
|
|
3600
3596
|
}
|
|
3601
3597
|
Ml(t) {
|
|
3602
|
-
|
|
3603
|
-
|
|
3598
|
+
this.Sl.set(t.id, t);
|
|
3599
|
+
}
|
|
3600
|
+
Fl(t) {
|
|
3601
|
+
const e = this.Cl.get(t);
|
|
3602
|
+
return e && (e.dispose(), this.Cl.delete(t)), this.Sl.delete(t);
|
|
3604
3603
|
}
|
|
3605
3604
|
Pn(t) {
|
|
3606
|
-
return this.
|
|
3605
|
+
return this.Sl.get(t);
|
|
3607
3606
|
}
|
|
3608
|
-
|
|
3609
|
-
return this.
|
|
3607
|
+
kl(t) {
|
|
3608
|
+
return this.Sl.has(t);
|
|
3610
3609
|
}
|
|
3611
3610
|
gt() {
|
|
3612
|
-
for (const t of this.
|
|
3613
|
-
this.
|
|
3611
|
+
for (const t of this.Cl.values()) t.dispose();
|
|
3612
|
+
this.Cl.clear(), this.Sl.clear();
|
|
3614
3613
|
}
|
|
3615
|
-
|
|
3616
|
-
this.
|
|
3614
|
+
zl() {
|
|
3615
|
+
this.Ml(qe);
|
|
3617
3616
|
}
|
|
3618
3617
|
}
|
|
3619
3618
|
class jt {
|
|
3620
3619
|
constructor() {
|
|
3621
|
-
a(this, "
|
|
3622
|
-
this.
|
|
3620
|
+
a(this, "Dl");
|
|
3621
|
+
this.Dl = new qt();
|
|
3623
3622
|
}
|
|
3624
3623
|
register(t) {
|
|
3625
|
-
this.
|
|
3624
|
+
this.Dl.Ml(t);
|
|
3626
3625
|
}
|
|
3627
3626
|
unregister(t) {
|
|
3628
|
-
return this.
|
|
3627
|
+
return this.Dl.Fl(t);
|
|
3629
3628
|
}
|
|
3630
3629
|
has(t) {
|
|
3631
|
-
return this.kl
|
|
3630
|
+
return this.Dl.kl(t);
|
|
3632
3631
|
}
|
|
3633
3632
|
Pn(t) {
|
|
3634
|
-
return this.
|
|
3633
|
+
return this.Dl.Pn(t);
|
|
3635
3634
|
}
|
|
3636
3635
|
gt() {
|
|
3637
|
-
this.
|
|
3636
|
+
this.Dl.gt();
|
|
3638
3637
|
}
|
|
3639
3638
|
}
|
|
3640
3639
|
const Ke = Object.freeze(Object.defineProperty({ __proto__: null, ConversionRegistry: qt, TextmodeConversionManager: jt }, Symbol.toStringTag, { value: "Module" }));
|
|
3641
3640
|
class je extends function(e, ...i) {
|
|
3642
3641
|
return i.reduce((r, s) => s(r), e);
|
|
3643
3642
|
}(class {
|
|
3644
|
-
}, Xe,
|
|
3643
|
+
}, Ze, Xe, ze, ke, Ye) {
|
|
3645
3644
|
constructor(e = {}) {
|
|
3646
3645
|
super();
|
|
3647
3646
|
a(this, "Z");
|
|
@@ -3650,84 +3649,85 @@ class je extends function(e, ...i) {
|
|
|
3650
3649
|
a(this, "qo");
|
|
3651
3650
|
a(this, "la");
|
|
3652
3651
|
a(this, "ua");
|
|
3653
|
-
a(this, "
|
|
3654
|
-
a(this, "Wc");
|
|
3652
|
+
a(this, "Ll");
|
|
3655
3653
|
a(this, "Zc");
|
|
3654
|
+
a(this, "qc");
|
|
3656
3655
|
a(this, "ha");
|
|
3657
3656
|
a(this, "dn");
|
|
3658
|
-
a(this, "
|
|
3657
|
+
a(this, "Uc");
|
|
3658
|
+
a(this, "Nc");
|
|
3659
3659
|
a(this, "gn");
|
|
3660
|
-
a(this, "
|
|
3661
|
-
a(this, "Ol");
|
|
3660
|
+
a(this, "Ol", []);
|
|
3662
3661
|
a(this, "Bl");
|
|
3663
3662
|
a(this, "Il");
|
|
3664
|
-
a(this, "Hl"
|
|
3663
|
+
a(this, "Hl");
|
|
3665
3664
|
a(this, "Gl", !1);
|
|
3666
3665
|
a(this, "Ql", !1);
|
|
3667
3666
|
a(this, "Nl", !1);
|
|
3668
|
-
a(this, "Xl",
|
|
3667
|
+
a(this, "Xl", !1);
|
|
3668
|
+
a(this, "Yl", () => {
|
|
3669
3669
|
});
|
|
3670
3670
|
a(this, "Cc", () => {
|
|
3671
3671
|
});
|
|
3672
|
-
a(this, "
|
|
3672
|
+
a(this, "jl", () => {
|
|
3673
3673
|
});
|
|
3674
|
-
a(this, "jl");
|
|
3675
3674
|
a(this, "Kl");
|
|
3676
|
-
a(this, "Xr", !1);
|
|
3677
3675
|
a(this, "Wl");
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3676
|
+
a(this, "Xr", !1);
|
|
3677
|
+
a(this, "Zl");
|
|
3678
|
+
this.Hl = new Ge(this), this.Xr = e.overlay ?? !1, this.kr = new De(e), this.Z = new me(this.kr.tn()), this.aa = new Ut(e.frameRate ?? 60), this.Ll = new kt(this, e.loadingScreen, this.kr.Vr()), this.Ll.Kc(() => {
|
|
3679
|
+
this.aa.Kn = 0, this.Xl = !0;
|
|
3680
|
+
}), this.Zc = this.Z.pe(V, `#version 300 es
|
|
3681
|
+
precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D Um;uniform sampler2D Un;uniform sampler2D Ul;uniform vec2 Uo;uniform vec2 Up;uniform vec4 Uq;in vec2 v_uv;out vec4 fragColor;mat2 A(float B){float C=sin(B);float D=cos(B);return mat2(D,-C,C,D);}void main(){vec2 E=gl_FragCoord.xy/Up;vec2 F=E*Uo;vec2 G=floor(F);vec2 H=(G+0.5)/Uo;vec4 I=texture(Um,H);vec4 J=texture(Un,H);vec4 K=texture(Ul,H);int L=int(K.b*255.+0.5);bool M=(L&1)!=0;bool N=(L&2)!=0;bool O=(L&4)!=0;int P=int(K.r*255.+0.5)+int(K.g*255.+0.5)*256;int Q=int(u_charsetDimensions.x);int R=P/Q;int S=P-(R*Q);float T=(u_charsetDimensions.y-1.)-float(R);vec2 U=1./u_charsetDimensions;vec2 V=vec2(float(S),T)*U;vec2 W=V+U;float X=-K.a*360.*0.017453292;vec2 Y=fract(F)-0.5f;vec2 Z=vec2(N?-1.:1.,O?-1.:1.);Y*=Z;Y=A(X)*Y+0.5;vec2 a=V+clamp(Y,0.,1.)*U;const float b=0.0001;if(any(lessThan(a,V-b))||any(greaterThan(a,W+b))){fragColor=M?I:J;return;}vec4 c=texture(u_characterTexture,a);if(M)c.rgb=mix(c.rgb,1.-c.rgb,float(M));vec4 d=mix(Uq,J,J.a);fragColor=mix(d,I,c);}`), this.qc = this.Z.pe(V, Dt), this.ha = new Gt(this, e);
|
|
3682
3682
|
const i = () => this.ha.getTopmostGrid();
|
|
3683
|
-
this.qo = new Lt(this.kr, i), this.la = new
|
|
3683
|
+
this.qo = new Lt(this.kr, i), this.la = new Bt(this.kr, i, this.qo), this.ua = new Nt(), this.Nc = new Wt(this.Z), this.gn = new jt(), this.Ll.In(), this.ql(e);
|
|
3684
3684
|
}
|
|
3685
|
-
async
|
|
3686
|
-
await this.ha.wr(), await this.
|
|
3685
|
+
async ql(e) {
|
|
3686
|
+
await this.ha.wr(), await this.Ll.wr();
|
|
3687
3687
|
const i = this.ha.base.grid;
|
|
3688
|
-
this.ha.
|
|
3688
|
+
this.ha.Al(() => {
|
|
3689
3689
|
this.qo.Fo(), this.la.Fo();
|
|
3690
|
-
}), this.
|
|
3690
|
+
}), this.Bl = this.Z.Pe(this.kr.width, this.kr.height, 1), this.Il = this.Z.Pe(this.kr.width, this.kr.height, 1), this.Nc.wr(this.kr.width, this.kr.height), this.Xr && (this.Zl = z.Tn(this.Z, this.gn, this.kr.targetCanvas, i.cols, i.rows)), this.Vl(), this.aa.In(() => this.ca()), await this.Hl.ma(e.plugins ?? []);
|
|
3691
3691
|
try {
|
|
3692
|
-
await this.
|
|
3692
|
+
await this.Yl(), this.Ll.Wa();
|
|
3693
3693
|
} catch (r) {
|
|
3694
|
-
console.error("Error during setup:", r), this.
|
|
3694
|
+
console.error("Error during setup:", r), this.Ll.error(r);
|
|
3695
3695
|
}
|
|
3696
3696
|
}
|
|
3697
|
-
|
|
3698
|
-
this.
|
|
3699
|
-
this.Xr && this.resizeCanvas(this.kr.targetCanvas.width, this.kr.targetCanvas.height), this.
|
|
3700
|
-
}, window.addEventListener("resize", this.
|
|
3697
|
+
Vl() {
|
|
3698
|
+
this.Kl = () => {
|
|
3699
|
+
this.Xr && this.resizeCanvas(this.kr.targetCanvas.width, this.kr.targetCanvas.height), this.jl();
|
|
3700
|
+
}, window.addEventListener("resize", this.Kl), this.qo._o(), this.la._o(), this.ua._o(), window.addEventListener("blur", () => {
|
|
3701
3701
|
this.ua.Zo();
|
|
3702
|
-
}), this.Xr && (this.
|
|
3702
|
+
}), this.Xr && (this.Wl = new ResizeObserver(() => {
|
|
3703
3703
|
this.resizeCanvas(this.kr.targetCanvas.width, this.kr.targetCanvas.height);
|
|
3704
|
-
}), this.
|
|
3704
|
+
}), this.Wl.observe(this.kr.targetCanvas));
|
|
3705
3705
|
}
|
|
3706
3706
|
ca() {
|
|
3707
|
-
if (!this.
|
|
3708
|
-
this.
|
|
3707
|
+
if (!this.Ll.Xa && this.Xl) {
|
|
3708
|
+
this.Ql = !0;
|
|
3709
3709
|
try {
|
|
3710
|
-
this.aa.Xn(), this.aa.Wn(), this.Xr && Tt(this.Z.context, this.
|
|
3711
|
-
let e = this.
|
|
3712
|
-
this.
|
|
3710
|
+
this.aa.Xn(), this.aa.Wn(), this.Xr && Tt(this.Z.context, this.Zl.texture, this.kr.targetCanvas), this.Hl.ba(), this.Z.state.qt(), this.ha.ml(this.Bl, () => this.Cc());
|
|
3711
|
+
let e = this.Bl.textures[0];
|
|
3712
|
+
this.Ol.length > 0 && (this.Nc.Pl(this.Bl.textures[0], this.Il, this.Ol, this.kr.width, this.kr.height), e = this.Il.textures[0], this.Ol = []), this.Z.wi(0, 0, 0, 0), this.Z.ve(this.qc), this.qc.O({ u_texture: e }), this.Z.we(0, 0, this.kr.width, this.kr.height), this.Hl.xa();
|
|
3713
3713
|
} finally {
|
|
3714
|
-
this.
|
|
3714
|
+
this.Ql = !1, this.Gl && !this.Nl && this.Jl();
|
|
3715
3715
|
}
|
|
3716
3716
|
}
|
|
3717
3717
|
}
|
|
3718
3718
|
resizeCanvas(e, i) {
|
|
3719
3719
|
var r, s, h, o;
|
|
3720
|
-
this.kr.Jr(e, i), this.
|
|
3720
|
+
this.kr.Jr(e, i), this.Ll.Vc(this.kr.Vr()), this.Ll.Jr(), (r = this.Bl) == null || r.resize(this.kr.width, this.kr.height), (s = this.Il) == null || s.resize(this.kr.width, this.kr.height), (h = this.Nc) == null || h.Jr(this.kr.width, this.kr.height), (o = this.ha) == null || o.Jr(), this.Z.Re(), this.ca();
|
|
3721
3721
|
}
|
|
3722
3722
|
destroy() {
|
|
3723
|
-
this.
|
|
3723
|
+
this.Nl || this.Gl || (this.Gl = !0, this.aa.Gn(), this.Ql || this.Jl());
|
|
3724
3724
|
}
|
|
3725
|
-
|
|
3725
|
+
Jl() {
|
|
3726
3726
|
var e, i, r, s, h, o, c;
|
|
3727
|
-
this.
|
|
3727
|
+
this.Gl = !1, this.Ll.gt(), this.Hl.Ma(), window.removeEventListener("resize", this.Kl), (e = this.Wl) == null || e.disconnect(), this.qo.Mo(), this.la.Mo(), this.ua.Mo(), this.Zc.dispose(), (i = this.ha) == null || i.gt(), (r = this.Nc) == null || r.gt(), (s = this.gn) == null || s.gt(), (h = this.Bl) == null || h.gt(), (o = this.Il) == null || o.gt(), this.Z.gt(), this.qc.dispose(), (c = this.Zl) == null || c.gt(), this.kr.gt(), this.Nl = !0;
|
|
3728
3728
|
}
|
|
3729
3729
|
filter(e, i) {
|
|
3730
|
-
this.
|
|
3730
|
+
this.Ol.push({ name: e, params: i });
|
|
3731
3731
|
}
|
|
3732
3732
|
async loadFont(e) {
|
|
3733
3733
|
return await this.ha.base.loadFont(e), this.ha.base.font;
|
|
@@ -3736,19 +3736,19 @@ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charse
|
|
|
3736
3736
|
vt.m(typeof e == "number" && e > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: e }) && this.ha.base.font.fontSize !== e && this.ha.base.font.Mr(e);
|
|
3737
3737
|
}
|
|
3738
3738
|
async setup(e) {
|
|
3739
|
-
this.
|
|
3739
|
+
this.Yl = e;
|
|
3740
3740
|
}
|
|
3741
3741
|
draw(e) {
|
|
3742
3742
|
this.Cc = e;
|
|
3743
3743
|
}
|
|
3744
3744
|
windowResized(e) {
|
|
3745
|
-
this.
|
|
3745
|
+
this.jl = e;
|
|
3746
3746
|
}
|
|
3747
3747
|
get grid() {
|
|
3748
|
-
return this.ha.
|
|
3748
|
+
return this.Uc ?? this.ha.base.grid;
|
|
3749
3749
|
}
|
|
3750
3750
|
get font() {
|
|
3751
|
-
return this.ha.base.font;
|
|
3751
|
+
return this.dn ?? this.ha.base.font;
|
|
3752
3752
|
}
|
|
3753
3753
|
get width() {
|
|
3754
3754
|
return this.kr.width;
|
|
@@ -3760,19 +3760,19 @@ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charse
|
|
|
3760
3760
|
return this.kr.canvas;
|
|
3761
3761
|
}
|
|
3762
3762
|
get isDisposed() {
|
|
3763
|
-
return this.
|
|
3763
|
+
return this.Nl;
|
|
3764
3764
|
}
|
|
3765
3765
|
get overlay() {
|
|
3766
|
-
return this.
|
|
3766
|
+
return this.Zl;
|
|
3767
3767
|
}
|
|
3768
3768
|
get loading() {
|
|
3769
|
-
return this.
|
|
3769
|
+
return this.Ll;
|
|
3770
3770
|
}
|
|
3771
3771
|
get layers() {
|
|
3772
3772
|
return this.ha;
|
|
3773
3773
|
}
|
|
3774
3774
|
get filters() {
|
|
3775
|
-
return this.
|
|
3775
|
+
return this.Nc;
|
|
3776
3776
|
}
|
|
3777
3777
|
get conversions() {
|
|
3778
3778
|
return this.gn;
|
|
@@ -3788,15 +3788,15 @@ class At {
|
|
|
3788
3788
|
vt._(t);
|
|
3789
3789
|
}
|
|
3790
3790
|
static get version() {
|
|
3791
|
-
return "0.8.0-beta.
|
|
3791
|
+
return "0.8.0-beta.3";
|
|
3792
3792
|
}
|
|
3793
3793
|
}
|
|
3794
|
-
const Je = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase:
|
|
3794
|
+
const Je = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: zt, LoadingPhaseTracker: It, LoadingScreenManager: kt, LoadingScreenStateMachine: _t, LoadingScreenTransition: Ot, resolveColorInputs: Xt, resolveDefaultPalette: Zt, resolveTheme: gt }, Symbol.toStringTag, { value: "Module" })), $e = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: et, TextmodeImage: z, TextmodeVideo: nt }, Symbol.toStringTag, { value: "Module" })), ti = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: _e, mouse: Ie, touch: Oe }, Symbol.toStringTag, { value: "Module" })), ei = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: Yt, TextmodeLayer: it, TextmodeLayerManager: Gt }, Symbol.toStringTag, { value: "Module" })), ii = At.create, ri = At.setErrorLevel, si = At.version;
|
|
3795
3795
|
export {
|
|
3796
|
-
|
|
3796
|
+
De as TextmodeCanvas,
|
|
3797
3797
|
S as TextmodeColor,
|
|
3798
3798
|
$t as TextmodeErrorLevel,
|
|
3799
|
-
|
|
3799
|
+
X as TextmodeFramebuffer,
|
|
3800
3800
|
Le as TextmodeGrid,
|
|
3801
3801
|
je as Textmodifier,
|
|
3802
3802
|
Ke as conversion,
|