textmode.js 0.8.0-beta.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/textmode.esm.js +1134 -1128
- package/dist/textmode.umd.js +15 -15
- package/dist/types/textmode/Textmodifier.d.ts +8 -0
- package/dist/types/textmode/interfaces/ITextmodifier.d.ts +53 -5
- package/dist/types/textmode/layers/LayerManager.d.ts +2 -1
- package/dist/types/textmode/layers/interfaces/ILayerManager.d.ts +1 -1
- package/dist/types/textmode/layers/interfaces/ITextmodeLayer.d.ts +1 -1
- package/dist/types/textmode/layers/types.d.ts +2 -2
- package/dist/types/textmode/loadables/TextmodeImage.d.ts +2 -4
- package/dist/types/textmode/loadables/video/TextmodeVideo.d.ts +2 -4
- package/dist/types/textmode/loading/LoadingPhase.d.ts +2 -2
- package/dist/types/textmode/mixins/interfaces/IRenderingMixin.d.ts +15 -13
- package/package.json +1 -1
package/dist/textmode.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Jt = (n, t, e) => t in n ?
|
|
1
|
+
var Vt = Object.defineProperty;
|
|
2
|
+
var Jt = (n, t, e) => t in n ? Vt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
3
|
var a = (n, t, e) => Jt(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
class U extends Error {
|
|
5
5
|
constructor(t, e = {}) {
|
|
@@ -8,8 +8,8 @@ class U extends Error {
|
|
|
8
8
|
static i(t, e) {
|
|
9
9
|
return `${t}${e && Object.keys(e).length > 0 ? `
|
|
10
10
|
|
|
11
|
-
📋 Context:` + Object.entries(e).map(([i,
|
|
12
|
-
- ${i}: ${U.o(
|
|
11
|
+
📋 Context:` + Object.entries(e).map(([i, s]) => `
|
|
12
|
+
- ${i}: ${U.o(s)}`).join("") : ""}
|
|
13
13
|
|
|
14
14
|
${"↓".repeat(24)}
|
|
15
15
|
`;
|
|
@@ -28,22 +28,22 @@ ${"↓".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 D = class D {
|
|
32
32
|
constructor() {
|
|
33
33
|
a(this, "l", { globalLevel: 3 });
|
|
34
34
|
}
|
|
35
35
|
static u() {
|
|
36
|
-
return
|
|
36
|
+
return D.h || (D.h = new D()), D.h;
|
|
37
37
|
}
|
|
38
38
|
v(t, e) {
|
|
39
|
-
const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.",
|
|
39
|
+
const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.", s = "color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;";
|
|
40
40
|
switch (this.l.globalLevel) {
|
|
41
41
|
case 0:
|
|
42
42
|
return !1;
|
|
43
43
|
case 1:
|
|
44
|
-
return console.group(i,
|
|
44
|
+
return console.group(i, s), console.warn(U.i(t, e)), console.groupEnd(), !1;
|
|
45
45
|
case 2:
|
|
46
|
-
return console.group(i,
|
|
46
|
+
return console.group(i, s), console.error(U.i(t, e)), console.groupEnd(), !1;
|
|
47
47
|
default:
|
|
48
48
|
throw new U(t, e);
|
|
49
49
|
}
|
|
@@ -55,8 +55,8 @@ const I = class I {
|
|
|
55
55
|
this.l.globalLevel = t;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
a(
|
|
59
|
-
let ut =
|
|
58
|
+
a(D, "h", null);
|
|
59
|
+
let ut = D;
|
|
60
60
|
const vt = ut.u();
|
|
61
61
|
class q {
|
|
62
62
|
constructor(t, e, i) {
|
|
@@ -74,24 +74,24 @@ class q {
|
|
|
74
74
|
for (let e = 0; e < t; e++) {
|
|
75
75
|
const i = this.A.getActiveUniform(this.C, e);
|
|
76
76
|
if (i) {
|
|
77
|
-
const
|
|
78
|
-
|
|
77
|
+
const s = i.name.replace(/\[0\]$/, ""), r = this.A.getUniformLocation(this.C, s);
|
|
78
|
+
r && (this.M.set(s, r), this.F.set(s, { type: i.type, size: i.size }));
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
R(t, e) {
|
|
83
|
-
const i = this.k(this.A.VERTEX_SHADER, t),
|
|
84
|
-
if (this.A.attachShader(
|
|
85
|
-
const h = this.A.getProgramInfoLog(
|
|
83
|
+
const i = this.k(this.A.VERTEX_SHADER, t), s = this.k(this.A.FRAGMENT_SHADER, e), r = this.A.createProgram();
|
|
84
|
+
if (this.A.attachShader(r, i), this.A.attachShader(r, s), this.A.linkProgram(r), !this.A.getProgramParameter(r, this.A.LINK_STATUS)) {
|
|
85
|
+
const h = this.A.getProgramInfoLog(r);
|
|
86
86
|
throw Error("Shader program link error: " + h);
|
|
87
87
|
}
|
|
88
|
-
return this.A.deleteShader(i), this.A.deleteShader(
|
|
88
|
+
return this.A.deleteShader(i), this.A.deleteShader(s), r;
|
|
89
89
|
}
|
|
90
90
|
k(t, e) {
|
|
91
91
|
const i = this.A.createShader(t);
|
|
92
92
|
if (this.A.shaderSource(i, e), this.A.compileShader(i), !this.A.getShaderParameter(i, this.A.COMPILE_STATUS)) {
|
|
93
|
-
const
|
|
94
|
-
throw this.A.deleteShader(i), Error("Shader compilation error: " +
|
|
93
|
+
const s = this.A.getShaderInfoLog(i);
|
|
94
|
+
throw this.A.deleteShader(i), Error("Shader compilation error: " + s);
|
|
95
95
|
}
|
|
96
96
|
return i;
|
|
97
97
|
}
|
|
@@ -108,25 +108,25 @@ class q {
|
|
|
108
108
|
var c, l;
|
|
109
109
|
const i = this.M.get(t);
|
|
110
110
|
if (!i) return;
|
|
111
|
-
const
|
|
112
|
-
if (!
|
|
113
|
-
const { type:
|
|
111
|
+
const s = this.F.get(t);
|
|
112
|
+
if (!s) return;
|
|
113
|
+
const { type: r, size: h } = s, o = this.A;
|
|
114
114
|
if (e instanceof WebGLTexture) {
|
|
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 Z) {
|
|
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
|
}
|
|
122
|
-
if (typeof e == "number") return void (
|
|
122
|
+
if (typeof e == "number") return void (r === o.INT || r === o.BOOL ? o.uniform1i(i, e) : o.uniform1f(i, e));
|
|
123
123
|
if (typeof e == "boolean") return void o.uniform1i(i, e ? 1 : 0);
|
|
124
124
|
if (Array.isArray(e[0])) {
|
|
125
125
|
const u = e.flat(), f = { [o.FLOAT_VEC2]: () => o.uniform2fv(i, u), [o.FLOAT_VEC3]: () => o.uniform3fv(i, u), [o.FLOAT_VEC4]: () => o.uniform4fv(i, u) };
|
|
126
|
-
(c = f[
|
|
126
|
+
(c = f[r]) == null || c.call(f);
|
|
127
127
|
} else {
|
|
128
128
|
const u = e, f = { [o.FLOAT]: () => h > 1 ? o.uniform1fv(i, u) : o.uniform1f(i, u[0]), [o.FLOAT_VEC2]: () => o.uniform2fv(i, u), [o.FLOAT_VEC3]: () => o.uniform3fv(i, u), [o.FLOAT_VEC4]: () => o.uniform4fv(i, u), [o.INT]: () => h > 1 ? o.uniform1iv(i, u) : o.uniform1i(i, u[0]), [o.INT_VEC2]: () => o.uniform2iv(i, u), [o.INT_VEC3]: () => o.uniform3iv(i, u), [o.INT_VEC4]: () => o.uniform4iv(i, u), [o.BOOL]: () => o.uniform1iv(i, u), [o.FLOAT_MAT2]: () => o.uniformMatrix2fv(i, !1, u), [o.FLOAT_MAT3]: () => o.uniformMatrix3fv(i, !1, u), [o.FLOAT_MAT4]: () => o.uniformMatrix4fv(i, !1, u) };
|
|
129
|
-
(l = f[
|
|
129
|
+
(l = f[r]) == null || l.call(f);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
H(t) {
|
|
@@ -143,13 +143,13 @@ class q {
|
|
|
143
143
|
this.A.deleteProgram(this.C);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function At(n, t, e, i) {
|
|
147
147
|
return 180 * Math.atan2(i - t, e - n) / Math.PI;
|
|
148
148
|
}
|
|
149
149
|
function Y(n, t, e, i) {
|
|
150
150
|
return Math.hypot(e - n, i - t);
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function I(n, t, e) {
|
|
153
153
|
return Math.min(Math.max(n, t), e);
|
|
154
154
|
}
|
|
155
155
|
function xt(n) {
|
|
@@ -158,18 +158,18 @@ function xt(n) {
|
|
|
158
158
|
function Tt(n, t, e) {
|
|
159
159
|
n.bindTexture(n.TEXTURE_2D, t), n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, 1), n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, e), n.bindTexture(n.TEXTURE_2D, null);
|
|
160
160
|
}
|
|
161
|
-
function pt(n, t, e, i,
|
|
162
|
-
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, t), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, e), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, i), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T,
|
|
161
|
+
function pt(n, t, e, i, s) {
|
|
162
|
+
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, t), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, e), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, i), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, s);
|
|
163
163
|
}
|
|
164
|
-
function ft(n, t, e, i,
|
|
165
|
-
n.enableVertexAttribArray(t), n.vertexAttribPointer(t, e, h, o, i,
|
|
164
|
+
function ft(n, t, e, i, s, r = 0, h = WebGL2RenderingContext.FLOAT, o = !1) {
|
|
165
|
+
n.enableVertexAttribArray(t), n.vertexAttribPointer(t, e, h, o, i, s), n.vertexAttribDivisor(t, r);
|
|
166
166
|
}
|
|
167
|
-
function Rt(n, t, e, i,
|
|
168
|
-
n.bindBuffer(t, e), n.bufferData(t, i,
|
|
167
|
+
function Rt(n, t, e, i, s) {
|
|
168
|
+
n.bindBuffer(t, e), n.bufferData(t, i, s), n.bindBuffer(t, null);
|
|
169
169
|
}
|
|
170
|
-
const
|
|
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);}}`,
|
|
172
|
-
constructor(t, e, i = e,
|
|
170
|
+
const st = `#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);}}`, X = class X {
|
|
172
|
+
constructor(t, e, i = e, s = 1, r = {}, h) {
|
|
173
173
|
a(this, "N");
|
|
174
174
|
a(this, "X");
|
|
175
175
|
a(this, "l");
|
|
@@ -181,16 +181,16 @@ 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 = I(s, 1, 8), this.Z = h, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...r }, X.J || (X.J = new q(t, st, `#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
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
|
-
const t = this.A, e = this.l.filter === "linear" ? t.LINEAR : t.NEAREST, i = this.l.wrap === "repeat" ? t.REPEAT : t.CLAMP_TO_EDGE,
|
|
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, s = this.l.type === "float" ? t.FLOAT : t.UNSIGNED_BYTE, r = s === t.FLOAT ? t.RGBA32F : t.RGBA8, h = t.RGBA;
|
|
191
191
|
for (let o = 0; o < this.W; o++) {
|
|
192
192
|
const c = t.createTexture();
|
|
193
|
-
t.bindTexture(t.TEXTURE_2D, c), pt(t, e, e, i, i), t.texImage2D(t.TEXTURE_2D, 0,
|
|
193
|
+
t.bindTexture(t.TEXTURE_2D, c), pt(t, e, e, i, i), t.texImage2D(t.TEXTURE_2D, 0, r, this.N, this.X, 0, h, s, null), this.j.push(c);
|
|
194
194
|
}
|
|
195
195
|
t.bindTexture(t.TEXTURE_2D, null);
|
|
196
196
|
}
|
|
@@ -200,8 +200,8 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
|
|
|
200
200
|
else {
|
|
201
201
|
const e = [];
|
|
202
202
|
for (let i = 0; i < this.W; i++) {
|
|
203
|
-
const
|
|
204
|
-
t.framebufferTexture2D(t.FRAMEBUFFER,
|
|
203
|
+
const s = t.COLOR_ATTACHMENT0 + i;
|
|
204
|
+
t.framebufferTexture2D(t.FRAMEBUFFER, s, t.TEXTURE_2D, this.j[i], 0), e.push(s);
|
|
205
205
|
}
|
|
206
206
|
t.drawBuffers(e);
|
|
207
207
|
}
|
|
@@ -216,18 +216,18 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
|
|
|
216
216
|
}
|
|
217
217
|
resize(t, e) {
|
|
218
218
|
this.N = t, this.X = e, this.V.clear();
|
|
219
|
-
const i = this.A,
|
|
220
|
-
for (const o of this.j) i.bindTexture(i.TEXTURE_2D, o), i.texImage2D(i.TEXTURE_2D, 0,
|
|
219
|
+
const i = this.A, s = this.l.type === "float" ? i.FLOAT : i.UNSIGNED_BYTE, r = s === i.FLOAT ? i.RGBA32F : i.RGBA8, h = i.RGBA;
|
|
220
|
+
for (const o of this.j) i.bindTexture(i.TEXTURE_2D, o), i.texImage2D(i.TEXTURE_2D, 0, r, this.N, this.X, 0, h, s, null);
|
|
221
221
|
i.bindTexture(i.TEXTURE_2D, null), this.K && (i.bindRenderbuffer(i.RENDERBUFFER, this.K), i.renderbufferStorage(i.RENDERBUFFER, i.DEPTH_COMPONENT24, this.N, this.X), i.bindRenderbuffer(i.RENDERBUFFER, null));
|
|
222
222
|
}
|
|
223
223
|
readPixels(t) {
|
|
224
224
|
const e = this.V.get(t);
|
|
225
225
|
if (e) return e;
|
|
226
|
-
const i = this.A,
|
|
227
|
-
i.bindFramebuffer(i.READ_FRAMEBUFFER, this.Y), i.readBuffer(i.COLOR_ATTACHMENT0 + t), i.readPixels(0, 0,
|
|
228
|
-
const c = 4 *
|
|
229
|
-
for (let u = 0; u <
|
|
230
|
-
const f = (
|
|
226
|
+
const i = this.A, s = this.N, r = this.X, h = new Uint8Array(s * r * 4), o = i.getParameter(i.READ_FRAMEBUFFER_BINDING);
|
|
227
|
+
i.bindFramebuffer(i.READ_FRAMEBUFFER, this.Y), i.readBuffer(i.COLOR_ATTACHMENT0 + t), i.readPixels(0, 0, s, r, i.RGBA, i.UNSIGNED_BYTE, h), i.bindFramebuffer(i.READ_FRAMEBUFFER, o);
|
|
228
|
+
const c = 4 * s, l = new Uint8Array(h.length);
|
|
229
|
+
for (let u = 0; u < r; u++) {
|
|
230
|
+
const f = (r - 1 - u) * c, d = u * c;
|
|
231
231
|
l.set(h.subarray(f, f + c), d);
|
|
232
232
|
}
|
|
233
233
|
return this.V.set(t, l), l;
|
|
@@ -244,8 +244,8 @@ 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,
|
|
248
|
-
this.q = this.Z.vt.dt(
|
|
247
|
+
const t = this.W > 1, e = this.W > 2, i = this.W > 3, s = { 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 }, r = X.J;
|
|
248
|
+
this.q = this.Z.vt.dt(r, s, !0);
|
|
249
249
|
}
|
|
250
250
|
gt() {
|
|
251
251
|
const t = this.A;
|
|
@@ -266,19 +266,19 @@ 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
|
|
271
|
-
const
|
|
269
|
+
a(X, "J", null);
|
|
270
|
+
let Z = X;
|
|
271
|
+
const Ft = /* @__PURE__ */ new WeakMap();
|
|
272
272
|
function ht(n, t) {
|
|
273
|
-
|
|
273
|
+
Ft.set(n, t);
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
return
|
|
275
|
+
function Ct(n) {
|
|
276
|
+
return Ft.get(n);
|
|
277
277
|
}
|
|
278
|
-
function tt(n, t, e, i,
|
|
279
|
-
n[0] = t / 255, n[1] = (e ?? t) / 255, n[2] = (i ?? t) / 255, n[3] =
|
|
278
|
+
function tt(n, t, e, i, s = 255) {
|
|
279
|
+
n[0] = t / 255, n[1] = (e ?? t) / 255, n[2] = (i ?? t) / 255, n[3] = s / 255;
|
|
280
280
|
}
|
|
281
|
-
class
|
|
281
|
+
class rt {
|
|
282
282
|
constructor() {
|
|
283
283
|
a(this, "_t", 1);
|
|
284
284
|
a(this, "yt", 0);
|
|
@@ -300,17 +300,17 @@ class st {
|
|
|
300
300
|
a(this, "Dt", []);
|
|
301
301
|
}
|
|
302
302
|
static Lt() {
|
|
303
|
-
return { Ot: 1,
|
|
303
|
+
return { Ot: 1, It: 0, Bt: 0, Ht: 0, bt: 0, Ct: 0, xt: 0, Rt: 0, Gt: !1, Qt: !1, Et: !1, zt: !1, Nt: [0, 0, 0], Xt: [1, 1, 1, 1], Yt: [0, 0, 0, 1] };
|
|
304
304
|
}
|
|
305
305
|
jt(t) {
|
|
306
|
-
t.Ot = this._t, t.
|
|
306
|
+
t.Ot = this._t, t.It = this.yt, t.Bt = this.At, t.Ht = this.wt, t.bt = this.bt, t.Ct = this.Ct, t.xt = this.xt, t.Gt = this.Pt, t.Qt = this.Tt, t.Et = this.Et, t.Rt = this.Rt, t.zt = this.zt, t.Nt[0] = this.Mt[0], t.Nt[1] = this.Mt[1], t.Nt[2] = this.Mt[2], t.Xt[0] = this.Ft[0], t.Xt[1] = this.Ft[1], t.Xt[2] = this.Ft[2], t.Xt[3] = this.Ft[3], t.Yt[0] = this.$t[0], t.Yt[1] = this.$t[1], t.Yt[2] = this.$t[2], t.Yt[3] = this.$t[3];
|
|
307
307
|
}
|
|
308
308
|
Kt(t) {
|
|
309
|
-
this._t = t.Ot, this.yt = t.
|
|
309
|
+
this._t = t.Ot, this.yt = t.It, this.At = t.Bt, this.wt = t.Ht, this.bt = t.bt, this.Ct = t.Ct, this.xt = t.xt, this.Pt = t.Gt, this.Tt = t.Qt, this.Et = t.Et, this.Rt = t.Rt, this.zt = t.zt, this.Mt[0] = t.Nt[0], this.Mt[1] = t.Nt[1], this.Mt[2] = t.Nt[2], this.Ft[0] = t.Xt[0], this.Ft[1] = t.Xt[1], this.Ft[2] = t.Xt[2], this.Ft[3] = t.Xt[3], this.$t[0] = t.Yt[0], this.$t[1] = t.Yt[1], this.$t[2] = t.Yt[2], this.$t[3] = t.Yt[3];
|
|
310
310
|
}
|
|
311
311
|
ot() {
|
|
312
312
|
let t = this.Dt.pop();
|
|
313
|
-
t || (t =
|
|
313
|
+
t || (t = rt.Lt()), this.jt(t), this.kt.push(t);
|
|
314
314
|
}
|
|
315
315
|
ht() {
|
|
316
316
|
const t = this.kt.pop();
|
|
@@ -349,11 +349,11 @@ class st {
|
|
|
349
349
|
hs(t) {
|
|
350
350
|
this.Mt[0] = t[0], this.Mt[1] = t[1], this.Mt[2] = t[2];
|
|
351
351
|
}
|
|
352
|
-
cs(t, e, i,
|
|
353
|
-
tt(this.Ft, t, e, i,
|
|
352
|
+
cs(t, e, i, s = 255) {
|
|
353
|
+
tt(this.Ft, t, e, i, s);
|
|
354
354
|
}
|
|
355
|
-
ls(t, e, i,
|
|
356
|
-
tt(this.$t, t, e, i,
|
|
355
|
+
ls(t, e, i, s = 255) {
|
|
356
|
+
tt(this.$t, t, e, i, s);
|
|
357
357
|
}
|
|
358
358
|
us(t) {
|
|
359
359
|
this.Pt = t;
|
|
@@ -367,8 +367,8 @@ class st {
|
|
|
367
367
|
vs(t) {
|
|
368
368
|
this.Rt = xt(t);
|
|
369
369
|
}
|
|
370
|
-
ps(t, e, i,
|
|
371
|
-
tt(this.St, t, e, i,
|
|
370
|
+
ps(t, e, i, s) {
|
|
371
|
+
tt(this.St, t, e, i, s);
|
|
372
372
|
}
|
|
373
373
|
gs(t) {
|
|
374
374
|
this.zt = t;
|
|
@@ -397,13 +397,13 @@ class te {
|
|
|
397
397
|
a(this, "Fs");
|
|
398
398
|
this.A = t, this.Ms = t.createBuffer(), this.Fs = new Float32Array(dt.length);
|
|
399
399
|
}
|
|
400
|
-
$s(t, e, i,
|
|
401
|
-
const
|
|
400
|
+
$s(t, e, i, s) {
|
|
401
|
+
const r = this.A, h = Ct(this.A), o = h[2], c = h[3], l = t / o * 2 - 1, u = (t + i) / o * 2 - 1, f = 1 - (e + s) / c * 2, d = 1 - e / c * 2, g = dt, p = this.Fs;
|
|
402
402
|
for (let v = 0; v < g.length; v += 4) {
|
|
403
|
-
const
|
|
403
|
+
const m = g[v], A = g[v + 1], b = g[v + 2], y = g[v + 3], x = l + (m + 0.5) * (u - l), E = f + (A + 0.5) * (d - f);
|
|
404
404
|
p[v] = x, p[v + 1] = E, p[v + 2] = b, p[v + 3] = y;
|
|
405
405
|
}
|
|
406
|
-
|
|
406
|
+
r.bindBuffer(r.ARRAY_BUFFER, this.Ms), r.bufferData(r.ARRAY_BUFFER, p, r.DYNAMIC_DRAW), r.enableVertexAttribArray(0), r.vertexAttribPointer(0, 2, r.FLOAT, !1, 16, 0), r.enableVertexAttribArray(1), r.vertexAttribPointer(1, 2, r.FLOAT, !1, 16, 8), r.drawArrays(r.TRIANGLES, 0, 6), r.disableVertexAttribArray(1), r.disableVertexAttribArray(0), r.bindBuffer(r.ARRAY_BUFFER, null);
|
|
407
407
|
}
|
|
408
408
|
gt() {
|
|
409
409
|
this.A.deleteBuffer(this.Ms);
|
|
@@ -417,19 +417,19 @@ class ie {
|
|
|
417
417
|
a(this, "Ps", /* @__PURE__ */ new Map());
|
|
418
418
|
this.A = t;
|
|
419
419
|
}
|
|
420
|
-
Ts(t, e, i,
|
|
421
|
-
const
|
|
420
|
+
Ts(t, e, i, s) {
|
|
421
|
+
const r = this.A;
|
|
422
422
|
let h = this.Ps.get(t);
|
|
423
423
|
h || (h = /* @__PURE__ */ new Map(), this.Ps.set(t, h));
|
|
424
424
|
let o = h.get(e) || null;
|
|
425
425
|
if (!o) {
|
|
426
|
-
o =
|
|
427
|
-
const c =
|
|
428
|
-
c !== -1 && ft(
|
|
429
|
-
const l =
|
|
430
|
-
l !== -1 && ft(
|
|
426
|
+
o = r.createVertexArray(), h.set(e, o), r.bindVertexArray(o), r.bindBuffer(r.ARRAY_BUFFER, s);
|
|
427
|
+
const c = r.getAttribLocation(t, "A0");
|
|
428
|
+
c !== -1 && ft(r, c, i.ws.bs.size, i._s, i.ws.bs.offset, 0, r.FLOAT, !1);
|
|
429
|
+
const l = r.getAttribLocation(t, "A1");
|
|
430
|
+
l !== -1 && ft(r, l, i.ws.Cs.size, i._s, i.ws.Cs.offset, 0, r.FLOAT, !1);
|
|
431
431
|
}
|
|
432
|
-
|
|
432
|
+
r.bindVertexArray(o);
|
|
433
433
|
}
|
|
434
434
|
Es() {
|
|
435
435
|
this.A.bindVertexArray(null);
|
|
@@ -438,34 +438,34 @@ 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 _ = class _ {
|
|
442
442
|
static Rs(t, e, i = 0) {
|
|
443
|
-
const
|
|
444
|
-
let
|
|
445
|
-
r
|
|
443
|
+
const s = e || new Float32Array(_.FLOATS_PER_INSTANCE);
|
|
444
|
+
let r = i;
|
|
445
|
+
s[r++] = t.bs[0], s[r++] = t.bs[1], s[r++] = t.Ss[0], s[r++] = t.Ss[1], s[r++] = t.Nt[0], s[r++] = t.Nt[1], s[r++] = t.Nt[2], s[r++] = t.Xt[0], s[r++] = t.Xt[1], s[r++] = t.Xt[2], s[r++] = t.Xt[3], s[r++] = t.Yt[0], s[r++] = t.Yt[1], s[r++] = t.Yt[2], s[r++] = t.Yt[3], s[r++] = t.zs[0], s[r++] = t.zs[1], s[r++] = t.zs[2], s[r++] = t.Rt;
|
|
446
446
|
const h = t.ks;
|
|
447
|
-
r
|
|
447
|
+
s[r++] = (h == null ? void 0 : h[0]) ?? 0, s[r++] = (h == null ? void 0 : h[1]) ?? 0, s[r++] = (h == null ? void 0 : h[2]) ?? 0;
|
|
448
448
|
const o = t.Ds;
|
|
449
|
-
r
|
|
450
|
-
const c = t.Ls, l = t.Os, u = t.
|
|
451
|
-
return g ? (r
|
|
449
|
+
s[r++] = (o == null ? void 0 : o[0]) ?? 0, s[r++] = (o == null ? void 0 : o[1]) ?? 0, s[r++] = (o == null ? void 0 : o[2]) ?? 0;
|
|
450
|
+
const c = t.Ls, l = t.Os, u = t.Is, f = t.Bs, d = t.Hs, g = !(!l || !u);
|
|
451
|
+
return g ? (s[r++] = (f == null ? void 0 : f[0]) ?? 0, s[r++] = (f == null ? void 0 : f[1]) ?? 0, s[r++] = (d == null ? void 0 : d[0]) ?? 0, s[r++] = (d == null ? void 0 : d[1]) ?? 0, s[r++] = l[0], s[r++] = l[1], s[r++] = u[0], s[r++] = u[1]) : !g && !!c ? (s[r++] = c[0], s[r++] = c[1], s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0) : (s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0), s[r++] = t.Gs ?? 0, s[r++] = t.Qs ?? 0, s[r++] = t.Ns ?? 0, s;
|
|
452
452
|
}
|
|
453
453
|
static Xs(t, e) {
|
|
454
|
-
const i = t.length *
|
|
455
|
-
for (let
|
|
456
|
-
const h =
|
|
457
|
-
|
|
454
|
+
const i = t.length * _.FLOATS_PER_INSTANCE, s = e || new Float32Array(i);
|
|
455
|
+
for (let r = 0; r < t.length; r++) {
|
|
456
|
+
const h = r * _.FLOATS_PER_INSTANCE;
|
|
457
|
+
_.Rs(t[r], s, h);
|
|
458
458
|
}
|
|
459
|
-
return
|
|
459
|
+
return s;
|
|
460
460
|
}
|
|
461
461
|
};
|
|
462
|
-
a(
|
|
463
|
-
let
|
|
462
|
+
a(_, "BYTES_PER_INSTANCE", 144), a(_, "FLOATS_PER_INSTANCE", 36);
|
|
463
|
+
let B = _;
|
|
464
464
|
const M = class M {
|
|
465
465
|
};
|
|
466
|
-
a(M, "STRIDE",
|
|
466
|
+
a(M, "STRIDE", B.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 } });
|
|
467
467
|
let W = M;
|
|
468
|
-
class
|
|
468
|
+
class se {
|
|
469
469
|
constructor(t = 1e3, e = 1.5) {
|
|
470
470
|
a(this, "Ys");
|
|
471
471
|
a(this, "js");
|
|
@@ -473,15 +473,15 @@ class re {
|
|
|
473
473
|
a(this, "Ws", 0);
|
|
474
474
|
a(this, "Zs", 0);
|
|
475
475
|
this.js = t, this.Ks = e;
|
|
476
|
-
const i = t *
|
|
476
|
+
const i = t * B.FLOATS_PER_INSTANCE;
|
|
477
477
|
this.Ys = new Float32Array(i);
|
|
478
478
|
}
|
|
479
479
|
qs(t) {
|
|
480
480
|
if (t <= this.js) return;
|
|
481
481
|
const e = Math.ceil(t * this.Ks), i = this.js;
|
|
482
482
|
this.js = e;
|
|
483
|
-
const
|
|
484
|
-
|
|
483
|
+
const s = e * B.FLOATS_PER_INSTANCE, r = new Float32Array(s), h = i * B.FLOATS_PER_INSTANCE;
|
|
484
|
+
r.set(this.Ys.subarray(0, Math.min(h, this.Ws))), this.Ys = r;
|
|
485
485
|
}
|
|
486
486
|
Vs() {
|
|
487
487
|
return { buffer: this.Ys, offset: this.Ws };
|
|
@@ -508,7 +508,7 @@ class re {
|
|
|
508
508
|
return this.Zs === 0;
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
class
|
|
511
|
+
class re {
|
|
512
512
|
constructor(t) {
|
|
513
513
|
a(this, "Ys");
|
|
514
514
|
this.Ys = t;
|
|
@@ -517,8 +517,8 @@ class se {
|
|
|
517
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
|
-
const
|
|
521
|
-
return e[i + 25] =
|
|
520
|
+
const s = t.curveParams0, r = t.curveParams1;
|
|
521
|
+
return e[i + 25] = s[0], e[i + 26] = s[1], e[i + 27] = s[2], e[i + 28] = s[3], e[i + 29] = r[0], e[i + 30] = r[1], e[i + 31] = r[2], e[i + 32] = r[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Ys.Js(B.FLOATS_PER_INSTANCE), this.Ys.ii - 1;
|
|
522
522
|
}
|
|
523
523
|
get ii() {
|
|
524
524
|
return this.Ys.ii;
|
|
@@ -535,7 +535,7 @@ class ne {
|
|
|
535
535
|
li(t) {
|
|
536
536
|
const e = this.A;
|
|
537
537
|
this.hi && e.deleteBuffer(this.hi), this.hi = e.createBuffer();
|
|
538
|
-
const i = t *
|
|
538
|
+
const i = t * B.BYTES_PER_INSTANCE;
|
|
539
539
|
Rt(e, e.ARRAY_BUFFER, this.hi, i, e.DYNAMIC_DRAW), this.ai = t;
|
|
540
540
|
}
|
|
541
541
|
ui(t) {
|
|
@@ -548,33 +548,33 @@ class ne {
|
|
|
548
548
|
if (e === 0) return;
|
|
549
549
|
const i = this.A;
|
|
550
550
|
i.bindBuffer(i.ARRAY_BUFFER, this.hi);
|
|
551
|
-
const
|
|
552
|
-
i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0,
|
|
551
|
+
const s = e * B.FLOATS_PER_INSTANCE;
|
|
552
|
+
i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, s);
|
|
553
553
|
}
|
|
554
554
|
di(t) {
|
|
555
555
|
let e = this.ci.get(t);
|
|
556
556
|
if (!e) {
|
|
557
557
|
e = /* @__PURE__ */ new Map();
|
|
558
558
|
const i = this.A;
|
|
559
|
-
for (const
|
|
560
|
-
const
|
|
561
|
-
|
|
559
|
+
for (const s in W.ATTRIBUTES) {
|
|
560
|
+
const r = i.getAttribLocation(t, s);
|
|
561
|
+
r !== -1 && e.set(s, r);
|
|
562
562
|
}
|
|
563
563
|
this.ci.set(t, e);
|
|
564
564
|
}
|
|
565
565
|
return e;
|
|
566
566
|
}
|
|
567
567
|
pi(t) {
|
|
568
|
-
const e = this.A, i = t.G,
|
|
569
|
-
for (const [
|
|
570
|
-
const o = W.ATTRIBUTES[
|
|
568
|
+
const e = this.A, i = t.G, s = this.di(i);
|
|
569
|
+
for (const [r, h] of s) {
|
|
570
|
+
const o = W.ATTRIBUTES[r];
|
|
571
571
|
o && ft(e, h, o.size, o.stride, o.offset, o.divisor, o.type, o.normalized);
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
574
|
gi(t) {
|
|
575
575
|
const e = this.A, i = this.di(t.G);
|
|
576
|
-
for (const [
|
|
577
|
-
W.ATTRIBUTES[
|
|
576
|
+
for (const [s, r] of i)
|
|
577
|
+
W.ATTRIBUTES[s] && (e.disableVertexAttribArray(r), e.vertexAttribDivisor(r, 0));
|
|
578
578
|
}
|
|
579
579
|
gt() {
|
|
580
580
|
this.hi && (this.A.deleteBuffer(this.hi), this.hi = null), this.ci.clear();
|
|
@@ -586,12 +586,12 @@ class he {
|
|
|
586
586
|
a(this, "Ys");
|
|
587
587
|
a(this, "mi");
|
|
588
588
|
a(this, "_i");
|
|
589
|
-
this.A = t, this.Ys = new
|
|
589
|
+
this.A = t, this.Ys = new se(e, i), this.mi = new re(this.Ys), this._i = new ne(t, e);
|
|
590
590
|
}
|
|
591
591
|
yi(t) {
|
|
592
|
-
var
|
|
592
|
+
var s, r, 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.
|
|
594
|
+
return t.Os && t.Is ? (e[0] = ((s = t.Bs) == null ? void 0 : s[0]) ?? 0, e[1] = ((r = t.Bs) == null ? void 0 : r[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.Is[0], i[3] = t.Is[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
596
|
oi(t) {
|
|
597
597
|
const e = this.mi.oi(t);
|
|
@@ -623,16 +623,16 @@ class he {
|
|
|
623
623
|
this._i.gt();
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
class
|
|
627
|
-
constructor(t, e, i,
|
|
626
|
+
class O {
|
|
627
|
+
constructor(t, e, i, s) {
|
|
628
628
|
a(this, "A");
|
|
629
629
|
a(this, "bi");
|
|
630
630
|
a(this, "Ci");
|
|
631
631
|
a(this, "xi");
|
|
632
632
|
a(this, "Mi", null);
|
|
633
|
-
this.A = t, this.bi = e, this.Ci = i, this.xi =
|
|
634
|
-
const
|
|
635
|
-
Rt(this.A, this.A.ARRAY_BUFFER,
|
|
633
|
+
this.A = t, this.bi = e, this.Ci = i, this.xi = s;
|
|
634
|
+
const r = this.A.createBuffer();
|
|
635
|
+
Rt(this.A, this.A.ARRAY_BUFFER, r, this.xi.Fi, this.A.STATIC_DRAW), this.Mi = r;
|
|
636
636
|
}
|
|
637
637
|
get type() {
|
|
638
638
|
return this.Ci;
|
|
@@ -658,17 +658,17 @@ class _ {
|
|
|
658
658
|
Ti(t, e, i) {
|
|
659
659
|
return this.bi.yi(t);
|
|
660
660
|
}
|
|
661
|
-
Ei(t, e, i,
|
|
662
|
-
const o =
|
|
661
|
+
Ei(t, e, i, s, r, h) {
|
|
662
|
+
const o = r.It ?? 0, c = r.Bt ?? 0, l = r.Ht ?? 0, u = r.bt ?? 0, f = r.Ct ?? 0, d = r.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:
|
|
664
|
+
const v = { x: t, y: e, width: i, height: s, char0: r.Nt[0], char1: r.Nt[1], char2: r.Nt[2], r1: r.Xt[0], g1: r.Xt[1], b1: r.Xt[2], a1: r.Xt[3], r2: r.Yt[0], g2: r.Yt[1], b2: r.Yt[2], a2: r.Yt[3], invert: r.Et ? 1 : 0, flipX: r.Gt ? 1 : 0, flipY: r.Qt ? 1 : 0, charRot: r.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
665
|
return this.bi.oi(v);
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
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
|
-
const
|
|
671
|
+
const s = i * e, r = (i + 1) % n * e, h = Math.cos(s), o = Math.sin(s), c = 0.5 * (h + 1), l = 0.5 * (o + 1), u = Math.cos(r), f = Math.sin(r), 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);
|
|
@@ -676,41 +676,41 @@ const oe = { Fi: dt, Ri: 6, ...k }, ae = { Fi: new Float32Array([0, -0.5, 0, 0,
|
|
|
676
676
|
let le = { Fi: function(n) {
|
|
677
677
|
const t = [];
|
|
678
678
|
for (let e = 0; e < n; e++) {
|
|
679
|
-
const i = e / n,
|
|
680
|
-
t.push(i, 0, i, 0, i, 1, i, 1,
|
|
679
|
+
const i = e / n, s = (e + 1) / n;
|
|
680
|
+
t.push(i, 0, i, 0, i, 1, i, 1, s, 1, s, 1);
|
|
681
681
|
}
|
|
682
682
|
return new Float32Array(t);
|
|
683
683
|
}(32), Ri: 96, ...k };
|
|
684
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
|
-
const i = e / n,
|
|
688
|
-
t.push(i, -0.5, i, 0,
|
|
687
|
+
const i = e / n, s = (e + 1) / n;
|
|
688
|
+
t.push(i, -0.5, i, 0, s, -0.5, s, 0, i, 0.5, i, 1, i, 0.5, i, 1, s, -0.5, s, 0, s, 0.5, s, 1);
|
|
689
689
|
}
|
|
690
690
|
return new Float32Array(t);
|
|
691
|
-
}(16), Ri: 96, ...k }, de = { [w.RECTANGLE]: class extends
|
|
691
|
+
}(16), Ri: 96, ...k }, de = { [w.RECTANGLE]: class extends O {
|
|
692
692
|
constructor(n, t) {
|
|
693
693
|
super(n, t, w.RECTANGLE, oe);
|
|
694
694
|
}
|
|
695
695
|
yi(n, t) {
|
|
696
696
|
return this.Ei(0, 0, n.width, n.height, t);
|
|
697
697
|
}
|
|
698
|
-
}, [w.LINE]: class extends
|
|
698
|
+
}, [w.LINE]: class extends O {
|
|
699
699
|
constructor(n, t) {
|
|
700
700
|
super(n, t, w.LINE, ae);
|
|
701
701
|
}
|
|
702
702
|
yi(n, t) {
|
|
703
|
-
const e = n.x2 - n.x1, i = n.y2 - n.y1,
|
|
704
|
-
return this.Ei(o, c,
|
|
703
|
+
const e = n.x2 - n.x1, i = n.y2 - n.y1, s = Math.hypot(e, i), r = Math.atan2(i, e), h = t.Ot || 1, o = n.x1 + e / 2 - s / 2, c = n.y1 + i / 2, l = { ...t, xt: (t.xt || 0) + r };
|
|
704
|
+
return this.Ei(o, c, s, h, l);
|
|
705
705
|
}
|
|
706
|
-
}, [w.ELLIPSE]: class extends
|
|
706
|
+
}, [w.ELLIPSE]: class extends O {
|
|
707
707
|
constructor(n, t) {
|
|
708
708
|
super(n, t, w.ELLIPSE, ce);
|
|
709
709
|
}
|
|
710
710
|
yi(n, t) {
|
|
711
711
|
return this.Ei(0, 0, n.width, n.height, t);
|
|
712
712
|
}
|
|
713
|
-
}, [w.ARC]: class extends
|
|
713
|
+
}, [w.ARC]: class extends O {
|
|
714
714
|
constructor(n, t) {
|
|
715
715
|
super(n, t, w.ARC, le);
|
|
716
716
|
}
|
|
@@ -718,15 +718,15 @@ const ue = { Fi: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ri:
|
|
|
718
718
|
const e = n.start * Math.PI / 180, i = n.stop * Math.PI / 180;
|
|
719
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 O {
|
|
722
722
|
constructor(n, t) {
|
|
723
723
|
super(n, t, w.TRIANGLE, ue);
|
|
724
724
|
}
|
|
725
725
|
yi(n, t) {
|
|
726
|
-
const e = Math.min(n.x1, n.x2, n.x3), i = Math.max(n.x1, n.x2, n.x3),
|
|
727
|
-
return this.Ei(e,
|
|
726
|
+
const e = Math.min(n.x1, n.x2, n.x3), i = Math.max(n.x1, n.x2, n.x3), s = Math.min(n.y1, n.y2, n.y3), r = i - e, h = Math.max(n.y1, n.y2, n.y3) - s;
|
|
727
|
+
return this.Ei(e, s, r, h, t);
|
|
728
728
|
}
|
|
729
|
-
}, [w.BEZIER_CURVE]: class extends
|
|
729
|
+
}, [w.BEZIER_CURVE]: class extends O {
|
|
730
730
|
constructor(n, t) {
|
|
731
731
|
super(n, t, w.BEZIER_CURVE, fe);
|
|
732
732
|
}
|
|
@@ -741,8 +741,8 @@ class ge {
|
|
|
741
741
|
a(this, "zi");
|
|
742
742
|
this.A = t, this.zi = new ie(t), this.Si = /* @__PURE__ */ new Map();
|
|
743
743
|
for (const e of Object.values(w)) {
|
|
744
|
-
const i = new he(t),
|
|
745
|
-
this.Si.set(e,
|
|
744
|
+
const i = new he(t), s = new de[e](t, i);
|
|
745
|
+
this.Si.set(e, s);
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
748
|
ki(t) {
|
|
@@ -752,22 +752,22 @@ class ge {
|
|
|
752
752
|
}
|
|
753
753
|
Di(t) {
|
|
754
754
|
const e = [];
|
|
755
|
-
let i = null,
|
|
756
|
-
for (const h of t)
|
|
757
|
-
return i && i.length > 0 && e.push({ material:
|
|
755
|
+
let i = null, s = null, r = null;
|
|
756
|
+
for (const h of t) s !== h.material || r !== h.type ? (i && i.length > 0 && e.push({ material: s, type: r, commands: i }), i = [h], s = h.material, r = h.type) : i.push(h);
|
|
757
|
+
return i && i.length > 0 && e.push({ material: s, type: r, commands: i }), e;
|
|
758
758
|
}
|
|
759
759
|
Li(t) {
|
|
760
|
-
const { material: e, type: i, commands:
|
|
760
|
+
const { material: e, type: i, commands: s } = t, r = this.Si.get(i);
|
|
761
761
|
e.shader.D(), e.shader.O(e.uniforms);
|
|
762
|
-
const h =
|
|
763
|
-
if (e.shader.O({ Uu: h[2] / h[3], Ur: [h[2], h[3]], Us: 1, Ut: o ? 1 : 0 }),
|
|
764
|
-
|
|
765
|
-
}),
|
|
766
|
-
const c =
|
|
762
|
+
const h = Ct(this.A), o = s.length > 0 && s[0].state.zt;
|
|
763
|
+
if (e.shader.O({ Uu: h[2] / h[3], Ur: [h[2], h[3]], Us: 1, Ut: o ? 1 : 0 }), r.$i(), s.forEach((c) => {
|
|
764
|
+
r.yi(c.params, c.state);
|
|
765
|
+
}), r.Pi()) {
|
|
766
|
+
const c = r.unitGeometry, l = r.unitBuffer;
|
|
767
767
|
try {
|
|
768
|
-
this.zi.Ts(e.shader.G, i + "", c, l),
|
|
768
|
+
this.zi.Ts(e.shader.G, i + "", c, l), r.batch.pi(e.shader), r.batch.$s(c.As, c.Ri);
|
|
769
769
|
} finally {
|
|
770
|
-
|
|
770
|
+
r.batch.gi(e.shader), this.zi.Es(), r.$i();
|
|
771
771
|
}
|
|
772
772
|
}
|
|
773
773
|
}
|
|
@@ -796,53 +796,53 @@ function G(n, t) {
|
|
|
796
796
|
class pe {
|
|
797
797
|
constructor(t) {
|
|
798
798
|
a(this, "Oi", 0);
|
|
799
|
-
a(this, "Bi");
|
|
800
799
|
a(this, "Ii");
|
|
800
|
+
a(this, "Bi");
|
|
801
801
|
a(this, "Hi", /* @__PURE__ */ new Map());
|
|
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.
|
|
802
|
+
this.Ii = new q(t, st, `#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.Bi = { id: this.Oi++, shader: this.Ii, uniforms: Object.freeze({}), hash: this.Gi(this.Ii, {}), isBuiltIn: !0 };
|
|
804
804
|
}
|
|
805
805
|
get Qi() {
|
|
806
|
-
return this.
|
|
806
|
+
return this.Bi;
|
|
807
807
|
}
|
|
808
808
|
dt(t, e = {}, i = !1) {
|
|
809
|
-
const
|
|
810
|
-
if (
|
|
811
|
-
const h = { id: this.Oi++, shader: t, uniforms: Object.freeze({ ...e }), hash:
|
|
812
|
-
return this.Hi.set(
|
|
809
|
+
const s = this.Gi(t, e), r = this.Hi.get(s);
|
|
810
|
+
if (r) return r;
|
|
811
|
+
const h = { id: this.Oi++, shader: t, uniforms: Object.freeze({ ...e }), hash: s, isBuiltIn: i };
|
|
812
|
+
return this.Hi.set(s, h), h;
|
|
813
813
|
}
|
|
814
814
|
Ni(t, e = {}) {
|
|
815
815
|
return { id: this.Oi++, shader: t, uniforms: Object.freeze({ ...e }), hash: 0, isBuiltIn: !1 };
|
|
816
816
|
}
|
|
817
817
|
Gi(t, e) {
|
|
818
|
-
const i = bt(t.G),
|
|
818
|
+
const i = bt(t.G), s = function(r, h) {
|
|
819
819
|
let o = 0;
|
|
820
|
-
const c = Object.keys(
|
|
821
|
-
for (const l of c) o = G(o, Mt(l)), o = G(o, h(
|
|
820
|
+
const c = Object.keys(r).sort();
|
|
821
|
+
for (const l of c) o = G(o, Mt(l)), o = G(o, h(r[l]));
|
|
822
822
|
return o;
|
|
823
823
|
}(e, this.Xi.bind(this));
|
|
824
|
-
return G(i,
|
|
824
|
+
return G(i, s);
|
|
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) {
|
|
830
830
|
let i = 0;
|
|
831
|
-
const
|
|
832
|
-
for (const
|
|
831
|
+
const s = Array.isArray(e[0]) ? e.flat() : e;
|
|
832
|
+
for (const r of s) i = G(i, typeof r == "number" ? r : 0);
|
|
833
833
|
return i;
|
|
834
834
|
}(t) : t instanceof Float32Array || t instanceof Int32Array ? function(e) {
|
|
835
835
|
let i = 0;
|
|
836
|
-
const
|
|
837
|
-
for (let
|
|
836
|
+
const s = Math.min(e.length, 16);
|
|
837
|
+
for (let r = 0; r < s; r++) i = G(i, e[r]);
|
|
838
838
|
return i;
|
|
839
839
|
}(t) : t instanceof WebGLTexture ? bt(t) : 0;
|
|
840
840
|
}
|
|
841
841
|
gt() {
|
|
842
|
-
this.
|
|
842
|
+
this.Ii != this.Ii && this.Ii.dispose(), this.Ii.dispose(), this.Hi.clear();
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
|
-
class
|
|
845
|
+
class me {
|
|
846
846
|
constructor() {
|
|
847
847
|
a(this, "Yi", []);
|
|
848
848
|
a(this, "ji", 1);
|
|
@@ -850,35 +850,35 @@ class Ae {
|
|
|
850
850
|
}
|
|
851
851
|
Ki(t, e) {
|
|
852
852
|
if (this.Ss >= this.Yi.length) {
|
|
853
|
-
const
|
|
854
|
-
this.Yi.push(
|
|
853
|
+
const s = { id: this.ji++, type: t, params: {}, state: rt.Lt(), material: e };
|
|
854
|
+
this.Yi.push(s);
|
|
855
855
|
}
|
|
856
856
|
const i = this.Yi[this.Ss];
|
|
857
857
|
return i.id = this.ji++, i.type = t, i.material = e, this.Ss++, i;
|
|
858
858
|
}
|
|
859
859
|
Wi(t, e, i) {
|
|
860
|
-
const
|
|
861
|
-
return
|
|
860
|
+
const s = this.Ki(w.RECTANGLE, i), r = s.params;
|
|
861
|
+
return r.width = t.width, r.height = t.height, e.Wt(s.state), s.id;
|
|
862
862
|
}
|
|
863
863
|
Zi(t, e, i) {
|
|
864
|
-
const
|
|
865
|
-
return
|
|
864
|
+
const s = this.Ki(w.LINE, i), r = s.params;
|
|
865
|
+
return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, e.Wt(s.state), s.id;
|
|
866
866
|
}
|
|
867
867
|
qi(t, e, i) {
|
|
868
|
-
const
|
|
869
|
-
return
|
|
868
|
+
const s = this.Ki(w.ELLIPSE, i), r = s.params;
|
|
869
|
+
return r.width = t.width, r.height = t.height, r.startAngle = t.startAngle, r.endAngle = t.endAngle, r.segments = t.segments, e.Wt(s.state), s.id;
|
|
870
870
|
}
|
|
871
871
|
Vi(t, e, i) {
|
|
872
|
-
const
|
|
873
|
-
return
|
|
872
|
+
const s = this.Ki(w.ARC, i), r = s.params;
|
|
873
|
+
return r.width = t.width, r.height = t.height, r.start = t.start, r.stop = t.stop, e.Wt(s.state), s.id;
|
|
874
874
|
}
|
|
875
875
|
Ji(t, e, i) {
|
|
876
|
-
const
|
|
877
|
-
return
|
|
876
|
+
const s = this.Ki(w.TRIANGLE, i), r = s.params;
|
|
877
|
+
return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.x3 = t.x3, r.y3 = t.y3, e.Wt(s.state), s.id;
|
|
878
878
|
}
|
|
879
879
|
te(t, e, i) {
|
|
880
|
-
const
|
|
881
|
-
return
|
|
880
|
+
const s = this.Ki(w.BEZIER_CURVE, i), r = s.params;
|
|
881
|
+
return r.x1 = t.x1, r.y1 = t.y1, r.cp1x = t.cp1x, r.cp1y = t.cp1y, r.cp2x = t.cp2x, r.cp2y = t.cp2y, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, r.segments = t.segments, e.Wt(s.state), s.id;
|
|
882
882
|
}
|
|
883
883
|
wi() {
|
|
884
884
|
this.Ss = 0;
|
|
@@ -889,7 +889,7 @@ class Ae {
|
|
|
889
889
|
return { next: () => t < e ? { value: i[t++], done: !1 } : { value: void 0, done: !0 } };
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
|
-
class
|
|
892
|
+
class Ae {
|
|
893
893
|
constructor(t) {
|
|
894
894
|
a(this, "A");
|
|
895
895
|
a(this, "se", null);
|
|
@@ -906,7 +906,7 @@ class me {
|
|
|
906
906
|
a(this, "ue", null);
|
|
907
907
|
a(this, "fe", [0, 0, 0, 0]);
|
|
908
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
|
|
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 rt(), this.vt = new pe(t), this.re = new me(), this.ie = new ge(t), this.ne = new te(t);
|
|
910
910
|
const e = [0, 0, t.canvas.width, t.canvas.height];
|
|
911
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
|
}
|
|
@@ -917,11 +917,11 @@ class me {
|
|
|
917
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
|
-
nt(t, e, i,
|
|
921
|
-
const
|
|
922
|
-
this.ue !== t && (
|
|
920
|
+
nt(t, e, i, s = 1) {
|
|
921
|
+
const r = this.A;
|
|
922
|
+
this.ue !== t && (r.bindFramebuffer(r.FRAMEBUFFER, t), this.ue = t), this.de = s;
|
|
923
923
|
const h = [0, 0, e, i];
|
|
924
|
-
this.fe[0] === h[0] && this.fe[1] === h[1] && this.fe[2] === h[2] && this.fe[3] === h[3] || (
|
|
924
|
+
this.fe[0] === h[0] && this.fe[1] === h[1] && this.fe[2] === h[2] && this.fe[3] === h[3] || (r.viewport(...h), ht(r, h), this.fe = h);
|
|
925
925
|
}
|
|
926
926
|
ve(t) {
|
|
927
927
|
this.se !== t && (this.se = t, t.D());
|
|
@@ -939,13 +939,13 @@ class me {
|
|
|
939
939
|
Object.assign(this.he, t);
|
|
940
940
|
}
|
|
941
941
|
_e(t) {
|
|
942
|
-
return new q(this.A,
|
|
942
|
+
return new q(this.A, st, t);
|
|
943
943
|
}
|
|
944
|
-
ye(t, e, i,
|
|
945
|
-
t instanceof
|
|
944
|
+
ye(t, e, i, s) {
|
|
945
|
+
t instanceof Z || !s || t.Ae(s), this.re.Wi({ width: e ?? t.width, height: i ?? t.height }, this.ee, t.ut());
|
|
946
946
|
}
|
|
947
|
-
we(t, e, i,
|
|
948
|
-
this.ne.$s(t, e, i,
|
|
947
|
+
we(t, e, i, s) {
|
|
948
|
+
this.ne.$s(t, e, i, s);
|
|
949
949
|
}
|
|
950
950
|
be(t, e) {
|
|
951
951
|
if (this.oe) {
|
|
@@ -953,39 +953,39 @@ class me {
|
|
|
953
953
|
this.re.Wi({ width: t, height: e }, this.ee, i), this.oe = null, this.he = {};
|
|
954
954
|
} else this.re.Wi({ width: t, height: e }, this.ee, this.vt.Qi);
|
|
955
955
|
}
|
|
956
|
-
Ce(t, e, i,
|
|
957
|
-
this.re.Zi({ x1: t, y1: e, x2: i, y2:
|
|
956
|
+
Ce(t, e, i, s) {
|
|
957
|
+
this.re.Zi({ x1: t, y1: e, x2: i, y2: s }, this.ee, this.vt.Qi);
|
|
958
958
|
}
|
|
959
959
|
xe(t, e) {
|
|
960
960
|
this.re.qi({ width: t, height: e }, this.ee, this.vt.Qi);
|
|
961
961
|
}
|
|
962
|
-
Me(t, e, i,
|
|
963
|
-
this.re.Ji({ x1: t, y1: e, x2: i, y2:
|
|
962
|
+
Me(t, e, i, s, r, h) {
|
|
963
|
+
this.re.Ji({ x1: t, y1: e, x2: i, y2: s, x3: r, y3: h }, this.ee, this.vt.Qi);
|
|
964
964
|
}
|
|
965
|
-
Fe(t, e, i,
|
|
966
|
-
this.re.te({ x1: t, y1: e, cp1x: i, cp1y:
|
|
965
|
+
Fe(t, e, i, s, r, h, o, c) {
|
|
966
|
+
this.re.te({ x1: t, y1: e, cp1x: i, cp1y: s, cp2x: r, cp2y: h, x2: o, y2: c }, this.ee, this.vt.Qi);
|
|
967
967
|
}
|
|
968
|
-
$e(t, e, i,
|
|
969
|
-
this.re.Vi({ width: t, height: e, start: i, stop:
|
|
968
|
+
$e(t, e, i, s) {
|
|
969
|
+
this.re.Vi({ width: t, height: e, start: i, stop: s }, this.ee, this.vt.Qi);
|
|
970
970
|
}
|
|
971
|
-
Pe(t, e, i = 1,
|
|
972
|
-
return new
|
|
971
|
+
Pe(t, e, i = 1, s = {}) {
|
|
972
|
+
return new Z(this.A, t, e, i, s, this);
|
|
973
973
|
}
|
|
974
|
-
Te(t, e = t, i = t,
|
|
975
|
-
this.ee.ps(t, e ?? t, i ?? t,
|
|
976
|
-
const [
|
|
977
|
-
this.Ee(
|
|
974
|
+
Te(t, e = t, i = t, s = 255) {
|
|
975
|
+
this.ee.ps(t, e ?? t, i ?? t, s);
|
|
976
|
+
const [r, h, o, c] = this.ee.canvasBackgroundColor;
|
|
977
|
+
this.Ee(r, h, o, c, !1);
|
|
978
978
|
}
|
|
979
|
-
wi(t = 0, e = 0, i = 0,
|
|
980
|
-
this.Ee(t, e, i,
|
|
979
|
+
wi(t = 0, e = 0, i = 0, s = 0) {
|
|
980
|
+
this.Ee(t, e, i, s, !0);
|
|
981
981
|
}
|
|
982
|
-
Ee(t, e, i,
|
|
982
|
+
Ee(t, e, i, s, r) {
|
|
983
983
|
const h = this.A;
|
|
984
984
|
if (this.de > 1) {
|
|
985
|
-
const o =
|
|
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,
|
|
985
|
+
const o = r ? [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.de >= 3 && h.clearBufferfv(h.COLOR, 2, new Float32Array([t, e, i, s]));
|
|
987
987
|
for (let c = 3; c < this.de; c++) h.clearBufferfv(h.COLOR, c, new Float32Array([0, 0, 0, 0]));
|
|
988
|
-
} else h.clearColor(t, e, i,
|
|
988
|
+
} else h.clearColor(t, e, i, s), 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];
|
|
@@ -1010,26 +1010,26 @@ class me {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
const R = { readShort: (n, t) => (R.t.uint16[0] = n[t] << 8 | n[t + 1], R.t.int16[0]), readUshort: (n, t) => n[t] << 8 | n[t + 1], readUshorts(n, t, e) {
|
|
1012
1012
|
const i = [];
|
|
1013
|
-
for (let
|
|
1013
|
+
for (let s = 0; s < e; s++) i.push(R.readUshort(n, t + 2 * s));
|
|
1014
1014
|
return i;
|
|
1015
1015
|
}, readUint(n, t) {
|
|
1016
1016
|
const e = R.t.uint8;
|
|
1017
1017
|
return e[3] = n[t], e[2] = n[t + 1], e[1] = n[t + 2], e[0] = n[t + 3], R.t.uint32[0];
|
|
1018
1018
|
}, readASCII(n, t, e) {
|
|
1019
1019
|
let i = "";
|
|
1020
|
-
for (let
|
|
1020
|
+
for (let s = 0; s < e; s++) i += String.fromCharCode(n[t + s]);
|
|
1021
1021
|
return i;
|
|
1022
1022
|
}, t: (() => {
|
|
1023
1023
|
const n = new ArrayBuffer(8);
|
|
1024
1024
|
return { uint8: new Uint8Array(n), int16: new Int16Array(n), uint16: new Uint16Array(n), uint32: new Uint32Array(n) };
|
|
1025
1025
|
})() };
|
|
1026
|
-
function
|
|
1026
|
+
function V(n) {
|
|
1027
1027
|
return n + 3 & -4;
|
|
1028
1028
|
}
|
|
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 N(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) {
|
|
@@ -1037,10 +1037,10 @@ function ye(n, t, e) {
|
|
|
1037
1037
|
}
|
|
1038
1038
|
function ot(n, t, e) {
|
|
1039
1039
|
const i = t + e;
|
|
1040
|
-
let
|
|
1041
|
-
const
|
|
1042
|
-
for (let h = t; h < i; h += 4)
|
|
1043
|
-
return
|
|
1040
|
+
let s = 0;
|
|
1041
|
+
const r = R.t;
|
|
1042
|
+
for (let h = t; h < i; h += 4) r.uint8[3] = n[h] || 0, r.uint8[2] = n[h + 1] || 0, r.uint8[1] = n[h + 2] || 0, r.uint8[0] = n[h + 3] || 0, s = s + (r.uint32[0] >>> 0) >>> 0;
|
|
1043
|
+
return s >>> 0;
|
|
1044
1044
|
}
|
|
1045
1045
|
class be {
|
|
1046
1046
|
constructor(t) {
|
|
@@ -1071,15 +1071,15 @@ function H(n) {
|
|
|
1071
1071
|
if (e === 0) return { min: 0, max: 0, table: /* @__PURE__ */ new Map() };
|
|
1072
1072
|
const i = new Uint32Array(e + 1);
|
|
1073
1073
|
for (const o of n) o && i[o]++;
|
|
1074
|
-
const
|
|
1075
|
-
let
|
|
1074
|
+
const s = new Uint32Array(e + 1);
|
|
1075
|
+
let r = 0;
|
|
1076
1076
|
i[0] = 0;
|
|
1077
|
-
for (let o = 1; o <= e; o++)
|
|
1077
|
+
for (let o = 1; o <= e; o++) r = r + i[o - 1] << 1, s[o] = r;
|
|
1078
1078
|
const h = /* @__PURE__ */ new Map();
|
|
1079
1079
|
for (let o = 0; o < n.length; o++) {
|
|
1080
1080
|
const c = n[o];
|
|
1081
1081
|
if (!c) continue;
|
|
1082
|
-
const l =
|
|
1082
|
+
const l = s[c]++;
|
|
1083
1083
|
let u = h.get(c);
|
|
1084
1084
|
u || (u = [], h.set(c, u)), u[Ee(l, c)] = o;
|
|
1085
1085
|
}
|
|
@@ -1089,10 +1089,10 @@ function at(n, t) {
|
|
|
1089
1089
|
let e = 0;
|
|
1090
1090
|
for (let i = 1; i <= t.max; i++) {
|
|
1091
1091
|
e |= n.readBits(1) << i - 1;
|
|
1092
|
-
const
|
|
1093
|
-
if (
|
|
1094
|
-
const
|
|
1095
|
-
if (
|
|
1092
|
+
const s = t.table.get(i);
|
|
1093
|
+
if (s && e < s.length) {
|
|
1094
|
+
const r = s[e];
|
|
1095
|
+
if (r !== void 0) return r;
|
|
1096
1096
|
}
|
|
1097
1097
|
}
|
|
1098
1098
|
throw Error("Invalid Huffman code");
|
|
@@ -1109,214 +1109,214 @@ function we(n) {
|
|
|
1109
1109
|
if (((t << 8) + e) % 31 != 0) throw Error("Bad ZLIB header check");
|
|
1110
1110
|
let i = 2;
|
|
1111
1111
|
32 & e && (i += 4);
|
|
1112
|
-
const
|
|
1113
|
-
return function(
|
|
1112
|
+
const s = [];
|
|
1113
|
+
return function(r, h) {
|
|
1114
1114
|
const o = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258], c = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], l = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577], u = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13];
|
|
1115
1115
|
let f = 0;
|
|
1116
1116
|
for (; !f; ) {
|
|
1117
|
-
f =
|
|
1118
|
-
const d =
|
|
1117
|
+
f = r.readBits(1);
|
|
1118
|
+
const d = r.readBits(2);
|
|
1119
1119
|
if (d === 0) {
|
|
1120
|
-
|
|
1121
|
-
const g =
|
|
1122
|
-
if ((65535 & (65535 ^ g)) !==
|
|
1123
|
-
for (let p = 0; p < g; p++) h.push(
|
|
1120
|
+
r.alignToByte();
|
|
1121
|
+
const g = r.readBits(16);
|
|
1122
|
+
if ((65535 & (65535 ^ g)) !== r.readBits(16)) throw Error("DEFLATE uncompressed LEN/NLEN mismatch");
|
|
1123
|
+
for (let p = 0; p < g; p++) h.push(r.readBits(8));
|
|
1124
1124
|
} else {
|
|
1125
1125
|
if (d !== 1 && d !== 2) throw Error("Unsupported DEFLATE type");
|
|
1126
1126
|
{
|
|
1127
1127
|
let g, p;
|
|
1128
1128
|
if (d === 1) {
|
|
1129
1129
|
const v = Array(288).fill(0);
|
|
1130
|
-
for (let
|
|
1131
|
-
for (let
|
|
1132
|
-
for (let
|
|
1133
|
-
for (let
|
|
1130
|
+
for (let m = 0; m <= 143; m++) v[m] = 8;
|
|
1131
|
+
for (let m = 144; m <= 255; m++) v[m] = 9;
|
|
1132
|
+
for (let m = 256; m <= 279; m++) v[m] = 7;
|
|
1133
|
+
for (let m = 280; m <= 287; m++) v[m] = 8;
|
|
1134
1134
|
g = H(v), p = H(Array(32).fill(5));
|
|
1135
1135
|
} else {
|
|
1136
|
-
const v =
|
|
1137
|
-
for (let T = 0; T <
|
|
1136
|
+
const v = r.readBits(5) + 257, m = r.readBits(5) + 1, A = r.readBits(4) + 4, b = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], y = Array(19).fill(0);
|
|
1137
|
+
for (let T = 0; T < A; T++) y[b[T]] = r.readBits(3);
|
|
1138
1138
|
const x = H(y), E = [];
|
|
1139
|
-
for (; E.length < v +
|
|
1140
|
-
const T = at(
|
|
1139
|
+
for (; E.length < v + m; ) {
|
|
1140
|
+
const T = at(r, x);
|
|
1141
1141
|
if (T <= 15) E.push(T);
|
|
1142
1142
|
else if (T === 16) {
|
|
1143
|
-
const L =
|
|
1144
|
-
for (let
|
|
1143
|
+
const L = r.readBits(2) + 3, C = E[E.length - 1] || 0;
|
|
1144
|
+
for (let K = 0; K < L; K++) E.push(C);
|
|
1145
1145
|
} else if (T === 17) {
|
|
1146
|
-
const L =
|
|
1147
|
-
for (let
|
|
1146
|
+
const L = r.readBits(3) + 3;
|
|
1147
|
+
for (let C = 0; C < L; C++) E.push(0);
|
|
1148
1148
|
} else {
|
|
1149
1149
|
if (T !== 18) throw Error("Invalid code length symbol");
|
|
1150
1150
|
{
|
|
1151
|
-
const L =
|
|
1152
|
-
for (let
|
|
1151
|
+
const L = r.readBits(7) + 11;
|
|
1152
|
+
for (let C = 0; C < L; C++) E.push(0);
|
|
1153
1153
|
}
|
|
1154
1154
|
}
|
|
1155
1155
|
}
|
|
1156
|
-
const
|
|
1157
|
-
g = H(
|
|
1156
|
+
const F = E.slice(0, v), P = E.slice(v, v + m);
|
|
1157
|
+
g = H(F), p = H(P);
|
|
1158
1158
|
}
|
|
1159
1159
|
for (; ; ) {
|
|
1160
|
-
const v = at(
|
|
1160
|
+
const v = at(r, g);
|
|
1161
1161
|
if (v < 256) h.push(v);
|
|
1162
1162
|
else {
|
|
1163
1163
|
if (v === 256) break;
|
|
1164
1164
|
if (v > 256 && v < 286) {
|
|
1165
|
-
const
|
|
1166
|
-
let
|
|
1167
|
-
const b = c[
|
|
1168
|
-
b && (
|
|
1169
|
-
const y = at(
|
|
1165
|
+
const m = v - 257;
|
|
1166
|
+
let A = o[m];
|
|
1167
|
+
const b = c[m];
|
|
1168
|
+
b && (A += r.readBits(b));
|
|
1169
|
+
const y = at(r, p);
|
|
1170
1170
|
if (y >= 30) throw Error("Invalid distance symbol");
|
|
1171
1171
|
let x = l[y];
|
|
1172
1172
|
const E = u[y];
|
|
1173
|
-
E && (x +=
|
|
1174
|
-
const
|
|
1175
|
-
if (
|
|
1176
|
-
for (let P = 0; P <
|
|
1173
|
+
E && (x += r.readBits(E));
|
|
1174
|
+
const F = h.length - x;
|
|
1175
|
+
if (F < 0) throw Error("Invalid distance");
|
|
1176
|
+
for (let P = 0; P < A; P++) h.push(h[F + P] || 0);
|
|
1177
1177
|
} else if (v === 286 || v === 287) throw Error("Reserved length symbol");
|
|
1178
1178
|
}
|
|
1179
1179
|
}
|
|
1180
1180
|
}
|
|
1181
1181
|
}
|
|
1182
1182
|
}
|
|
1183
|
-
}(new be(n.subarray(i)),
|
|
1183
|
+
}(new be(n.subarray(i)), s), new Uint8Array(s);
|
|
1184
1184
|
}
|
|
1185
1185
|
function xe(n) {
|
|
1186
1186
|
const t = R, e = new Uint8Array(n);
|
|
1187
1187
|
if (t.readASCII(e, 0, 4) !== "wOFF") throw Error("Invalid WOFF signature");
|
|
1188
|
-
const i = t.readUint(e, 4),
|
|
1188
|
+
const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), h = [];
|
|
1189
1189
|
let o = 44;
|
|
1190
|
-
for (let
|
|
1191
|
-
const b = t.readASCII(e, o, 4), y = t.readUint(e, o + 4), x = t.readUint(e, o + 8), E = t.readUint(e, o + 12),
|
|
1192
|
-
h.push({ tag: b, offset: y, compLength: x, origLength: E, checksum:
|
|
1193
|
-
}
|
|
1194
|
-
for (const
|
|
1195
|
-
const b = new Uint8Array(e.buffer,
|
|
1196
|
-
if (
|
|
1197
|
-
else if (
|
|
1198
|
-
const y = new Uint8Array(
|
|
1199
|
-
y.set(
|
|
1200
|
-
} else
|
|
1201
|
-
}
|
|
1202
|
-
const c =
|
|
1190
|
+
for (let A = 0; A < s; A++) {
|
|
1191
|
+
const b = t.readASCII(e, o, 4), y = t.readUint(e, o + 4), x = t.readUint(e, o + 8), E = t.readUint(e, o + 12), F = t.readUint(e, o + 16);
|
|
1192
|
+
h.push({ tag: b, offset: y, compLength: x, origLength: E, checksum: F }), o += 20;
|
|
1193
|
+
}
|
|
1194
|
+
for (const A of h) {
|
|
1195
|
+
const b = new Uint8Array(e.buffer, A.offset, A.compLength);
|
|
1196
|
+
if (A.compLength === A.origLength) A.data = new Uint8Array(b);
|
|
1197
|
+
else if (A.data = we(b), A.data.length !== A.origLength) if (A.data.length < A.origLength) {
|
|
1198
|
+
const y = new Uint8Array(A.origLength);
|
|
1199
|
+
y.set(A.data), A.data = y;
|
|
1200
|
+
} else A.data = A.data.subarray(0, A.origLength);
|
|
1201
|
+
}
|
|
1202
|
+
const c = s;
|
|
1203
1203
|
let l = 1, u = 0;
|
|
1204
1204
|
for (; l << 1 <= c; ) l <<= 1, u++;
|
|
1205
1205
|
const f = 16 * l, d = 16 * c - f;
|
|
1206
1206
|
let g = 12 + 16 * c;
|
|
1207
1207
|
const p = {};
|
|
1208
|
-
for (const
|
|
1209
|
-
const v = new Uint8Array(Math.max(
|
|
1210
|
-
|
|
1211
|
-
let
|
|
1212
|
-
for (const
|
|
1213
|
-
ye(v,
|
|
1214
|
-
let b =
|
|
1215
|
-
if (
|
|
1208
|
+
for (const A of h) p[A.tag] = g, g = V(g + A.data.length);
|
|
1209
|
+
const v = new Uint8Array(Math.max(r || 0, g));
|
|
1210
|
+
N(v, 0, i), J(v, 4, c), J(v, 6, f), J(v, 8, u), J(v, 10, d);
|
|
1211
|
+
let m = 12;
|
|
1212
|
+
for (const A of h) {
|
|
1213
|
+
ye(v, m, A.tag), m += 4;
|
|
1214
|
+
let b = A.data;
|
|
1215
|
+
if (A.tag === "head" && b.length >= 12) {
|
|
1216
1216
|
const y = new Uint8Array(b);
|
|
1217
|
-
|
|
1217
|
+
N(y, 8, 0), N(v, m, ot(y, 0, V(y.length))), m += 4;
|
|
1218
1218
|
} else
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
}
|
|
1222
|
-
for (const
|
|
1223
|
-
const b = p[
|
|
1224
|
-
v.set(
|
|
1225
|
-
}
|
|
1226
|
-
if (h.find((
|
|
1227
|
-
const
|
|
1228
|
-
const E = x + 8,
|
|
1229
|
-
|
|
1230
|
-
const P = 2981146554 - (ot(y, 0,
|
|
1231
|
-
return y[E] =
|
|
1232
|
-
}(v,
|
|
1233
|
-
|
|
1219
|
+
N(v, m, ot(b, 0, V(b.length))), m += 4;
|
|
1220
|
+
N(v, m, p[A.tag]), m += 4, N(v, m, A.data.length), m += 4;
|
|
1221
|
+
}
|
|
1222
|
+
for (const A of h) {
|
|
1223
|
+
const b = p[A.tag];
|
|
1224
|
+
v.set(A.data, b);
|
|
1225
|
+
}
|
|
1226
|
+
if (h.find((A) => A.tag === "head")) {
|
|
1227
|
+
const A = p.head, b = function(y, x) {
|
|
1228
|
+
const E = x + 8, F = [y[E], y[E + 1], y[E + 2], y[E + 3]];
|
|
1229
|
+
N(y, E, 0);
|
|
1230
|
+
const P = 2981146554 - (ot(y, 0, V(y.length)) >>> 0) >>> 0;
|
|
1231
|
+
return y[E] = F[0], y[E + 1] = F[1], y[E + 2] = F[2], y[E + 3] = F[3], P >>> 0;
|
|
1232
|
+
}(v, A);
|
|
1233
|
+
N(v, A + 8, b);
|
|
1234
1234
|
}
|
|
1235
1235
|
return v.buffer;
|
|
1236
1236
|
}
|
|
1237
1237
|
const Te = { parseTab(n, t, e) {
|
|
1238
1238
|
const i = { tables: [], ids: {}, off: t };
|
|
1239
1239
|
n = new Uint8Array(n.buffer, t, e), t = 0;
|
|
1240
|
-
const
|
|
1240
|
+
const s = R, r = s.readUshort, h = r(n, t += 2);
|
|
1241
1241
|
t += 2;
|
|
1242
1242
|
const o = [];
|
|
1243
1243
|
for (let c = 0; c < h; c++) {
|
|
1244
|
-
const l =
|
|
1244
|
+
const l = r(n, t), u = r(n, t += 2);
|
|
1245
1245
|
t += 2;
|
|
1246
|
-
const f =
|
|
1246
|
+
const f = s.readUint(n, t);
|
|
1247
1247
|
t += 4;
|
|
1248
1248
|
const d = `p${l}e${u}`;
|
|
1249
1249
|
let g = o.indexOf(f);
|
|
1250
1250
|
if (g === -1) {
|
|
1251
1251
|
let p;
|
|
1252
1252
|
g = i.tables.length, o.push(f);
|
|
1253
|
-
const v =
|
|
1253
|
+
const v = r(n, f);
|
|
1254
1254
|
p = v === 4 ? this.parse4(n, f) : v === 12 ? this.parse12(n, f) : { format: v }, i.tables.push(p);
|
|
1255
1255
|
}
|
|
1256
1256
|
i.ids[d] = g;
|
|
1257
1257
|
}
|
|
1258
1258
|
return i;
|
|
1259
1259
|
}, parse4(n, t) {
|
|
1260
|
-
const e = R, i = e.readUshort,
|
|
1260
|
+
const e = R, i = e.readUshort, s = e.readUshorts, r = t, h = i(n, t += 2);
|
|
1261
1261
|
t += 2;
|
|
1262
1262
|
const o = i(n, t += 2) >>> 1, c = { format: 4, searchRange: i(n, t += 2), entrySelector: 0, rangeShift: 0, endCount: [], startCount: [], idDelta: [], idRangeOffset: [], glyphIdArray: [] };
|
|
1263
|
-
t += 2, c.entrySelector = i(n, t), t += 2, c.rangeShift = i(n, t), t += 2, c.endCount =
|
|
1263
|
+
t += 2, c.entrySelector = i(n, t), t += 2, c.rangeShift = i(n, t), t += 2, c.endCount = s(n, t, o), t += 2 * o, t += 2, c.startCount = s(n, t, o), t += 2 * o;
|
|
1264
1264
|
for (let l = 0; l < o; l++) c.idDelta.push(e.readShort(n, t)), t += 2;
|
|
1265
|
-
return c.idRangeOffset =
|
|
1265
|
+
return c.idRangeOffset = s(n, t, o), t += 2 * o, c.glyphIdArray = s(n, t, r + h - t >> 1), c;
|
|
1266
1266
|
}, parse12(n, t) {
|
|
1267
1267
|
const e = R.readUint;
|
|
1268
1268
|
e(n, t += 4), e(n, t += 4);
|
|
1269
1269
|
const i = e(n, t += 4);
|
|
1270
1270
|
t += 4;
|
|
1271
|
-
const
|
|
1272
|
-
for (let
|
|
1273
|
-
return { format: 12, groups:
|
|
1271
|
+
const s = new Uint32Array(3 * i);
|
|
1272
|
+
for (let r = 0; r < 3 * i; r += 3) s[r] = e(n, t + (r << 2)), s[r + 1] = e(n, t + (r << 2) + 4), s[r + 2] = e(n, t + (r << 2) + 8);
|
|
1273
|
+
return { format: 12, groups: s };
|
|
1274
1274
|
} }, Re = { parseTab(n, t, e) {
|
|
1275
1275
|
const i = R;
|
|
1276
1276
|
t += 18;
|
|
1277
|
-
const
|
|
1277
|
+
const s = i.readUshort(n, t);
|
|
1278
1278
|
t += 2, t += 16;
|
|
1279
|
-
const
|
|
1279
|
+
const r = i.readShort(n, t);
|
|
1280
1280
|
t += 2;
|
|
1281
1281
|
const h = i.readShort(n, t);
|
|
1282
1282
|
t += 2;
|
|
1283
1283
|
const o = i.readShort(n, t);
|
|
1284
1284
|
t += 2;
|
|
1285
1285
|
const c = i.readShort(n, t);
|
|
1286
|
-
return t += 2, t += 6, { unitsPerEm:
|
|
1287
|
-
} },
|
|
1286
|
+
return t += 2, t += 6, { unitsPerEm: s, xMin: r, yMin: h, xMax: o, yMax: c, indexToLocFormat: i.readShort(n, t) };
|
|
1287
|
+
} }, Fe = { parseTab(n, t, e) {
|
|
1288
1288
|
const i = R;
|
|
1289
1289
|
t += 4;
|
|
1290
|
-
const
|
|
1291
|
-
for (let h = 0; h <
|
|
1292
|
-
const o =
|
|
1293
|
-
|
|
1290
|
+
const s = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], r = {};
|
|
1291
|
+
for (let h = 0; h < s.length; h++) {
|
|
1292
|
+
const o = s[h], c = o === "advanceWidthMax" || o === "numberOfHMetrics" ? i.readUshort : i.readShort;
|
|
1293
|
+
r[o] = c(n, t + 2 * h);
|
|
1294
1294
|
}
|
|
1295
|
-
return
|
|
1296
|
-
} },
|
|
1297
|
-
const
|
|
1295
|
+
return r;
|
|
1296
|
+
} }, Ce = { parseTab(n, t, e, i) {
|
|
1297
|
+
const s = R, r = [], h = [], o = i.maxp.numGlyphs, c = i.hhea.numberOfHMetrics;
|
|
1298
1298
|
let l = 0, u = 0, f = 0;
|
|
1299
|
-
for (; f < c; ) l =
|
|
1300
|
-
for (; f < o; )
|
|
1301
|
-
return { aWidth:
|
|
1302
|
-
} }, Et = { cmap: Te, head: Re, hhea:
|
|
1299
|
+
for (; f < c; ) l = s.readUshort(n, t + (f << 2)), u = s.readShort(n, t + (f << 2) + 2), r.push(l), h.push(u), f++;
|
|
1300
|
+
for (; f < o; ) r.push(l), h.push(u), f++;
|
|
1301
|
+
return { aWidth: r, lsBearing: h };
|
|
1302
|
+
} }, Et = { cmap: Te, head: Re, hhea: Fe, maxp: { parseTab(n, t, e) {
|
|
1303
1303
|
const i = R;
|
|
1304
1304
|
return i.readUint(n, t), t += 4, { numGlyphs: i.readUshort(n, t) };
|
|
1305
|
-
} }, hmtx:
|
|
1306
|
-
const
|
|
1307
|
-
if (h === 0) for (let c = 0; c < o; c++)
|
|
1308
|
-
else if (h === 1) for (let c = 0; c < o; c++)
|
|
1309
|
-
return s;
|
|
1310
|
-
} }, glyf: { parseTab(n, t, e, i) {
|
|
1311
|
-
const r = [], s = i.maxp.numGlyphs;
|
|
1312
|
-
for (let h = 0; h < s; h++) r.push(null);
|
|
1305
|
+
} }, hmtx: Ce, loca: { parseTab(n, t, e, i) {
|
|
1306
|
+
const s = R, r = [], h = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
|
|
1307
|
+
if (h === 0) for (let c = 0; c < o; c++) r.push(s.readUshort(n, t + (c << 1)) << 1);
|
|
1308
|
+
else if (h === 1) for (let c = 0; c < o; c++) r.push(s.readUint(n, t + (c << 2)));
|
|
1313
1309
|
return r;
|
|
1310
|
+
} }, glyf: { parseTab(n, t, e, i) {
|
|
1311
|
+
const s = [], r = i.maxp.numGlyphs;
|
|
1312
|
+
for (let h = 0; h < r; h++) s.push(null);
|
|
1313
|
+
return s;
|
|
1314
1314
|
}, Se(n, t) {
|
|
1315
|
-
const e = R, i = n.ze,
|
|
1316
|
-
if (
|
|
1317
|
-
const
|
|
1318
|
-
if (!
|
|
1319
|
-
let h =
|
|
1315
|
+
const e = R, i = n.ze, s = n.loca;
|
|
1316
|
+
if (s[t] === s[t + 1]) return null;
|
|
1317
|
+
const r = j.findTable(i, "glyf", n.ke);
|
|
1318
|
+
if (!r) return null;
|
|
1319
|
+
let h = r[0] + s[t];
|
|
1320
1320
|
const o = {};
|
|
1321
1321
|
if (o.noc = e.readShort(i, h), h += 2, o.xMin = e.readShort(i, h), h += 2, o.yMin = e.readShort(i, h), h += 2, o.xMax = e.readShort(i, h), h += 2, o.yMax = e.readShort(i, h), h += 2, o.xMin >= o.xMax || o.yMin >= o.yMax) return null;
|
|
1322
1322
|
if (o.noc > 0) {
|
|
@@ -1352,25 +1352,25 @@ 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,
|
|
1355
|
+
const e = new Uint8Array(n), i = Et, s = {}, r = { 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) {
|
|
1359
1359
|
const [l, u] = c;
|
|
1360
|
-
let f =
|
|
1361
|
-
f == null && (f = i[o].parseTab(e, l, u,
|
|
1360
|
+
let f = s[l];
|
|
1361
|
+
f == null && (f = i[o].parseTab(e, l, u, r), s[l] = f), r[o] = f;
|
|
1362
1362
|
}
|
|
1363
1363
|
}
|
|
1364
|
-
return [
|
|
1364
|
+
return [r];
|
|
1365
1365
|
}, findTable(n, t, e) {
|
|
1366
|
-
const i = R,
|
|
1367
|
-
let
|
|
1368
|
-
for (let h = 0; h <
|
|
1369
|
-
const o = i.readASCII(n,
|
|
1370
|
-
i.readUint(n,
|
|
1371
|
-
const c = i.readUint(n,
|
|
1366
|
+
const i = R, s = i.readUshort(n, e + 4);
|
|
1367
|
+
let r = e + 12;
|
|
1368
|
+
for (let h = 0; h < s; h++) {
|
|
1369
|
+
const o = i.readASCII(n, r, 4);
|
|
1370
|
+
i.readUint(n, r + 4);
|
|
1371
|
+
const c = i.readUint(n, r + 8), l = i.readUint(n, r + 12);
|
|
1372
1372
|
if (o === t) return [c, l];
|
|
1373
|
-
|
|
1373
|
+
r += 16;
|
|
1374
1374
|
}
|
|
1375
1375
|
return null;
|
|
1376
1376
|
}, T: Et, B: R };
|
|
@@ -1378,13 +1378,13 @@ class Me {
|
|
|
1378
1378
|
Le(t) {
|
|
1379
1379
|
var i;
|
|
1380
1380
|
const e = [];
|
|
1381
|
-
return (i = t.cmap) != null && i.tables ? (t.cmap.tables.forEach((
|
|
1382
|
-
if (
|
|
1383
|
-
const
|
|
1384
|
-
e.push(...
|
|
1385
|
-
} else if (
|
|
1386
|
-
const
|
|
1387
|
-
e.push(...
|
|
1381
|
+
return (i = t.cmap) != null && i.tables ? (t.cmap.tables.forEach((s) => {
|
|
1382
|
+
if (s.format === 4) {
|
|
1383
|
+
const r = this.Oe(s);
|
|
1384
|
+
e.push(...r);
|
|
1385
|
+
} else if (s.format === 12) {
|
|
1386
|
+
const r = this.Ie(s);
|
|
1387
|
+
e.push(...r);
|
|
1388
1388
|
}
|
|
1389
1389
|
}), [...new Set(e)]) : [];
|
|
1390
1390
|
}
|
|
@@ -1392,10 +1392,10 @@ class Me {
|
|
|
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
|
-
const
|
|
1396
|
-
if (
|
|
1397
|
-
for (let h =
|
|
1398
|
-
if (this.
|
|
1395
|
+
const s = t.startCount[i], r = t.endCount[i];
|
|
1396
|
+
if (s !== 65535 || r !== 65535) {
|
|
1397
|
+
for (let h = s; h <= r; h++)
|
|
1398
|
+
if (this.Be(t, h, i) > 0) try {
|
|
1399
1399
|
const o = String.fromCodePoint(h);
|
|
1400
1400
|
e.push(o);
|
|
1401
1401
|
} catch {
|
|
@@ -1404,13 +1404,13 @@ class Me {
|
|
|
1404
1404
|
}
|
|
1405
1405
|
return e;
|
|
1406
1406
|
}
|
|
1407
|
-
|
|
1407
|
+
Ie(t) {
|
|
1408
1408
|
const e = [];
|
|
1409
1409
|
if (!t.groups) return e;
|
|
1410
1410
|
for (let i = 0; i < t.groups.length; i += 3) {
|
|
1411
|
-
const
|
|
1412
|
-
for (let o =
|
|
1413
|
-
if (h + (o -
|
|
1411
|
+
const s = t.groups[i], r = t.groups[i + 1], h = t.groups[i + 2];
|
|
1412
|
+
for (let o = s; o <= r; o++)
|
|
1413
|
+
if (h + (o - s) > 0) try {
|
|
1414
1414
|
const c = String.fromCodePoint(o);
|
|
1415
1415
|
e.push(c);
|
|
1416
1416
|
} catch {
|
|
@@ -1418,13 +1418,13 @@ class Me {
|
|
|
1418
1418
|
}
|
|
1419
1419
|
return e;
|
|
1420
1420
|
}
|
|
1421
|
-
|
|
1421
|
+
Be(t, e, i) {
|
|
1422
1422
|
if (t.idRangeOffset[i] === 0) return e + t.idDelta[i] & 65535;
|
|
1423
1423
|
{
|
|
1424
|
-
const
|
|
1425
|
-
if (
|
|
1426
|
-
const
|
|
1427
|
-
if (
|
|
1424
|
+
const s = t.idRangeOffset[i] / 2 + (e - t.startCount[i]) - (t.startCount.length - i);
|
|
1425
|
+
if (s >= 0 && t.glyphIdArray && s < t.glyphIdArray.length) {
|
|
1426
|
+
const r = t.glyphIdArray[s];
|
|
1427
|
+
if (r !== 0) return r + t.idDelta[i] & 65535;
|
|
1428
1428
|
}
|
|
1429
1429
|
}
|
|
1430
1430
|
return 0;
|
|
@@ -1437,59 +1437,59 @@ class Pe {
|
|
|
1437
1437
|
a(this, "Z");
|
|
1438
1438
|
this.Z = t, this.He = document.createElement("canvas"), this.Ge = this.He.getContext("2d", { willReadFrequently: !0, alpha: !0 });
|
|
1439
1439
|
}
|
|
1440
|
-
Qe(t, e, i,
|
|
1441
|
-
const
|
|
1442
|
-
this.Ne(c, l), this.Xe(t, e, h, i,
|
|
1440
|
+
Qe(t, e, i, s) {
|
|
1441
|
+
const r = t.length, h = Math.ceil(Math.sqrt(r)), o = Math.ceil(r / h), c = e.width * h, l = e.height * o;
|
|
1442
|
+
this.Ne(c, l), this.Xe(t, e, h, i, s);
|
|
1443
1443
|
const u = this.Z.Pe(c, l, 1, { filter: "nearest" });
|
|
1444
1444
|
return u.et(this.He), { framebuffer: u, columns: h, rows: o };
|
|
1445
1445
|
}
|
|
1446
1446
|
Ne(t, e) {
|
|
1447
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
|
-
Xe(t, e, i,
|
|
1450
|
-
const h =
|
|
1449
|
+
Xe(t, e, i, s, r) {
|
|
1450
|
+
const h = s / r.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
|
-
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,
|
|
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, m = Math.round(p - 0.5 * e.width), A = Math.round(v - 0.5 * s), b = m + 0.5 * (e.width - f), y = A + r.hhea.ascender * h;
|
|
1455
1455
|
this.Ye(u, b, y, h);
|
|
1456
1456
|
}
|
|
1457
1457
|
}
|
|
1458
|
-
Ye(t, e, i,
|
|
1458
|
+
Ye(t, e, i, s) {
|
|
1459
1459
|
if (!t || !t.xs || t.noc === 0) return;
|
|
1460
|
-
let { xs:
|
|
1461
|
-
if (!(
|
|
1460
|
+
let { xs: r, ys: h, endPts: o, flags: c } = t;
|
|
1461
|
+
if (!(r && h && o && c)) return;
|
|
1462
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
|
-
const d = e +
|
|
1468
|
+
const d = e + r[l] * s, g = i - h[l] * s;
|
|
1469
1469
|
this.Ge.moveTo(d, g);
|
|
1470
1470
|
let p = l + 1;
|
|
1471
1471
|
for (; p <= f; )
|
|
1472
1472
|
if (1 & c[p]) {
|
|
1473
|
-
const v = e +
|
|
1474
|
-
this.Ge.lineTo(v,
|
|
1473
|
+
const v = e + r[p] * s, m = i - h[p] * s;
|
|
1474
|
+
this.Ge.lineTo(v, m), p++;
|
|
1475
1475
|
} else {
|
|
1476
|
-
const v = e +
|
|
1476
|
+
const v = e + r[p] * s, m = i - h[p] * s;
|
|
1477
1477
|
if (p + 1 > f) {
|
|
1478
|
-
const b = e +
|
|
1479
|
-
if (1 & c[l]) this.Ge.quadraticCurveTo(v,
|
|
1478
|
+
const b = e + r[l] * s, y = i - h[l] * s;
|
|
1479
|
+
if (1 & c[l]) this.Ge.quadraticCurveTo(v, m, b, y);
|
|
1480
1480
|
else {
|
|
1481
|
-
const x = (v + b) / 2, E = (
|
|
1482
|
-
this.Ge.quadraticCurveTo(v,
|
|
1481
|
+
const x = (v + b) / 2, E = (m + y) / 2;
|
|
1482
|
+
this.Ge.quadraticCurveTo(v, m, x, E);
|
|
1483
1483
|
}
|
|
1484
1484
|
break;
|
|
1485
1485
|
}
|
|
1486
|
-
const
|
|
1487
|
-
if (1 & c[
|
|
1488
|
-
const b = e +
|
|
1489
|
-
this.Ge.quadraticCurveTo(v,
|
|
1486
|
+
const A = p + 1;
|
|
1487
|
+
if (1 & c[A]) {
|
|
1488
|
+
const b = e + r[A] * s, y = i - h[A] * s;
|
|
1489
|
+
this.Ge.quadraticCurveTo(v, m, b, y), p = A + 1;
|
|
1490
1490
|
} else {
|
|
1491
|
-
const b = (v + (e +
|
|
1492
|
-
this.Ge.quadraticCurveTo(v,
|
|
1491
|
+
const b = (v + (e + r[A] * s)) / 2, y = (m + (i - h[A] * s)) / 2;
|
|
1492
|
+
this.Ge.quadraticCurveTo(v, m, b, y), p = A;
|
|
1493
1493
|
}
|
|
1494
1494
|
}
|
|
1495
1495
|
this.Ge.closePath();
|
|
@@ -1504,9 +1504,9 @@ class Pt {
|
|
|
1504
1504
|
je(t, e) {
|
|
1505
1505
|
const i = t.cmap;
|
|
1506
1506
|
if (!i || !i.tables) return 0;
|
|
1507
|
-
let
|
|
1508
|
-
for (const
|
|
1509
|
-
return
|
|
1507
|
+
let s = 0;
|
|
1508
|
+
for (const r of i.tables) if (r.format === 4 ? s = this.Ke(e, r) : r.format === 12 && (s = this.We(e, r)), s > 0) break;
|
|
1509
|
+
return s;
|
|
1510
1510
|
}
|
|
1511
1511
|
Ze(t, e) {
|
|
1512
1512
|
const i = e.codePointAt(0);
|
|
@@ -1517,32 +1517,32 @@ class Pt {
|
|
|
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
|
-
const i = e / t.head.unitsPerEm,
|
|
1521
|
-
return { ascender:
|
|
1520
|
+
const i = e / t.head.unitsPerEm, s = t.hhea.ascender * i, r = t.hhea.descender * i, h = t.hhea.lineGap * i;
|
|
1521
|
+
return { ascender: s, descender: r, lineGap: h, lineHeight: s - r + h, unitsPerEm: t.head.unitsPerEm, scale: i };
|
|
1522
1522
|
}
|
|
1523
1523
|
Ke(t, e) {
|
|
1524
1524
|
const i = e.endCount.length;
|
|
1525
|
-
let
|
|
1526
|
-
for (let
|
|
1527
|
-
|
|
1525
|
+
let s = -1;
|
|
1526
|
+
for (let r = 0; r < i; r++) if (t <= e.endCount[r]) {
|
|
1527
|
+
s = r;
|
|
1528
1528
|
break;
|
|
1529
1529
|
}
|
|
1530
|
-
if (
|
|
1531
|
-
if (e.idRangeOffset[
|
|
1530
|
+
if (s === -1 || t < e.startCount[s]) return 0;
|
|
1531
|
+
if (e.idRangeOffset[s] === 0) return t + e.idDelta[s] & 65535;
|
|
1532
1532
|
{
|
|
1533
|
-
const
|
|
1534
|
-
if (
|
|
1535
|
-
const h = e.glyphIdArray[
|
|
1536
|
-
return h === 0 ? 0 : h + e.idDelta[
|
|
1533
|
+
const r = e.idRangeOffset[s] / 2 + (t - e.startCount[s]) - (i - s);
|
|
1534
|
+
if (r >= 0 && r < e.glyphIdArray.length) {
|
|
1535
|
+
const h = e.glyphIdArray[r];
|
|
1536
|
+
return h === 0 ? 0 : h + e.idDelta[s] & 65535;
|
|
1537
1537
|
}
|
|
1538
1538
|
}
|
|
1539
1539
|
return 0;
|
|
1540
1540
|
}
|
|
1541
1541
|
We(t, e) {
|
|
1542
1542
|
const i = e.groups.length / 3;
|
|
1543
|
-
for (let
|
|
1544
|
-
const
|
|
1545
|
-
if (t >=
|
|
1543
|
+
for (let s = 0; s < i; s++) {
|
|
1544
|
+
const r = e.groups[3 * s], h = e.groups[3 * s + 1], o = e.groups[3 * s + 2];
|
|
1545
|
+
if (t >= r && t <= h) return o + (t - r);
|
|
1546
1546
|
}
|
|
1547
1547
|
return 0;
|
|
1548
1548
|
}
|
|
@@ -1553,15 +1553,15 @@ class Se {
|
|
|
1553
1553
|
this.Je = new Pt();
|
|
1554
1554
|
}
|
|
1555
1555
|
tr(t, e, i) {
|
|
1556
|
-
let
|
|
1557
|
-
const
|
|
1556
|
+
let s = 0;
|
|
1557
|
+
const r = this.Je.Ve(i, e), h = r.lineHeight;
|
|
1558
1558
|
for (const o of t) {
|
|
1559
1559
|
const c = this.Je.Ze(i, o);
|
|
1560
1560
|
if (c === 0) continue;
|
|
1561
|
-
const l = this.Je.qe(i, c) *
|
|
1562
|
-
|
|
1561
|
+
const l = this.Je.qe(i, c) * r.scale;
|
|
1562
|
+
s = Math.max(s, l);
|
|
1563
1563
|
}
|
|
1564
|
-
return { width: Math.ceil(
|
|
1564
|
+
return { width: Math.ceil(s), height: Math.ceil(h) };
|
|
1565
1565
|
}
|
|
1566
1566
|
}
|
|
1567
1567
|
class Ue {
|
|
@@ -1570,22 +1570,22 @@ class Ue {
|
|
|
1570
1570
|
this.sr = new Pt();
|
|
1571
1571
|
}
|
|
1572
1572
|
ir(t, e) {
|
|
1573
|
-
const i = [],
|
|
1574
|
-
return t.forEach((
|
|
1575
|
-
const o =
|
|
1576
|
-
i.push(c),
|
|
1577
|
-
}), { array: i, map:
|
|
1573
|
+
const i = [], s = /* @__PURE__ */ new Map();
|
|
1574
|
+
return t.forEach((r, h) => {
|
|
1575
|
+
const o = r.codePointAt(0) || 0, c = { character: r, unicode: o, color: this.er(h), glyphData: this.rr(e, r) };
|
|
1576
|
+
i.push(c), s.set(r, c);
|
|
1577
|
+
}), { array: i, map: s };
|
|
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,
|
|
1584
|
-
if (
|
|
1585
|
-
let
|
|
1586
|
-
t.hmtx && t.hmtx.aWidth &&
|
|
1587
|
-
const h = j.T.glyf.Se(t,
|
|
1588
|
-
return h ? { ...h, advanceWidth:
|
|
1583
|
+
const i = e.codePointAt(0) || 0, s = this.sr.je(t, i);
|
|
1584
|
+
if (s === 0) return null;
|
|
1585
|
+
let r = 0;
|
|
1586
|
+
t.hmtx && t.hmtx.aWidth && s > 0 && t.hmtx.aWidth[s] !== void 0 && (r = t.hmtx.aWidth[s]);
|
|
1587
|
+
const h = j.T.glyf.Se(t, s);
|
|
1588
|
+
return h ? { ...h, advanceWidth: r } : null;
|
|
1589
1589
|
}
|
|
1590
1590
|
}
|
|
1591
1591
|
class et {
|
|
@@ -1629,9 +1629,9 @@ class et {
|
|
|
1629
1629
|
if (!e.ok) throw new U(`Failed to load font file: ${e.status} ${e.statusText}`);
|
|
1630
1630
|
const i = await e.arrayBuffer();
|
|
1631
1631
|
await this.br(i);
|
|
1632
|
-
const
|
|
1633
|
-
if (!
|
|
1634
|
-
this.nr =
|
|
1632
|
+
const s = j.parse(i);
|
|
1633
|
+
if (!s || s.length === 0) throw Error("Failed to parse font file");
|
|
1634
|
+
this.nr = s[0], await this.Cr();
|
|
1635
1635
|
} catch (e) {
|
|
1636
1636
|
throw new U("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
|
|
1637
1637
|
}
|
|
@@ -1643,8 +1643,8 @@ class et {
|
|
|
1643
1643
|
async Cr() {
|
|
1644
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
|
|
1647
|
-
this.cr =
|
|
1646
|
+
const s = this.mr.Qe(this.hr, this.vr, this.lr, this.nr);
|
|
1647
|
+
this.cr = s.framebuffer, this.ur = s.columns, this.dr = s.rows, this.Ar = !0;
|
|
1648
1648
|
}
|
|
1649
1649
|
$r(t) {
|
|
1650
1650
|
const e = this.ar.get(t);
|
|
@@ -1699,20 +1699,20 @@ class Le {
|
|
|
1699
1699
|
a(this, "Dr");
|
|
1700
1700
|
a(this, "Lr");
|
|
1701
1701
|
a(this, "Or", !1);
|
|
1702
|
-
a(this, "
|
|
1702
|
+
a(this, "Ir", /* @__PURE__ */ new Set());
|
|
1703
1703
|
this.kr = t, this.Dr = e, this.Lr = i, this.ti();
|
|
1704
1704
|
}
|
|
1705
|
-
|
|
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.
|
|
1705
|
+
Br() {
|
|
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.Ir.size > 0) for (const t of this.Ir) t();
|
|
1707
1707
|
}
|
|
1708
1708
|
Hr(t) {
|
|
1709
|
-
this.
|
|
1709
|
+
this.Ir.add(t);
|
|
1710
1710
|
}
|
|
1711
1711
|
Gr(t) {
|
|
1712
|
-
this.
|
|
1712
|
+
this.Ir.delete(t);
|
|
1713
1713
|
}
|
|
1714
1714
|
ti() {
|
|
1715
|
-
this.Or || (this.Er = Math.floor(this.kr.width / this.Dr), this.Rr = Math.floor(this.kr.height / this.Lr)), this.
|
|
1715
|
+
this.Or || (this.Er = Math.floor(this.kr.width / this.Dr), this.Rr = Math.floor(this.kr.height / this.Lr)), this.Br();
|
|
1716
1716
|
}
|
|
1717
1717
|
Qr(t, e) {
|
|
1718
1718
|
this.Dr = t, this.Lr = e, this.ti();
|
|
@@ -1727,13 +1727,13 @@ class Le {
|
|
|
1727
1727
|
return this.Er;
|
|
1728
1728
|
}
|
|
1729
1729
|
set cols(t) {
|
|
1730
|
-
this.Or = !0, this.Er = Math.max(1, Math.floor(t)), typeof this.Rr != "number" && (this.Rr = Math.max(1, Math.floor(this.kr.height / this.Lr))), this.
|
|
1730
|
+
this.Or = !0, this.Er = Math.max(1, Math.floor(t)), typeof this.Rr != "number" && (this.Rr = Math.max(1, Math.floor(this.kr.height / this.Lr))), this.Br();
|
|
1731
1731
|
}
|
|
1732
1732
|
get rows() {
|
|
1733
1733
|
return this.Rr;
|
|
1734
1734
|
}
|
|
1735
1735
|
set rows(t) {
|
|
1736
|
-
this.Or = !0, this.Rr = Math.max(1, Math.floor(t)), typeof this.Er != "number" && (this.Er = Math.max(1, Math.floor(this.kr.width / this.Dr))), this.
|
|
1736
|
+
this.Or = !0, this.Rr = Math.max(1, Math.floor(t)), typeof this.Er != "number" && (this.Er = Math.max(1, Math.floor(this.kr.width / this.Dr))), this.Br();
|
|
1737
1737
|
}
|
|
1738
1738
|
get width() {
|
|
1739
1739
|
return this.N;
|
|
@@ -1751,28 +1751,28 @@ class Le {
|
|
|
1751
1751
|
this.Or = !1;
|
|
1752
1752
|
}
|
|
1753
1753
|
gt() {
|
|
1754
|
-
this.
|
|
1754
|
+
this.Ir.clear();
|
|
1755
1755
|
}
|
|
1756
1756
|
}
|
|
1757
|
-
const
|
|
1757
|
+
const Be = /^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 Ne(n) {
|
|
1762
1762
|
if (!n) return null;
|
|
1763
1763
|
const t = n.trim().toLowerCase();
|
|
1764
1764
|
if (!t) return null;
|
|
1765
1765
|
let e = null;
|
|
1766
1766
|
return t.startsWith("rgb") && (e = function(i) {
|
|
1767
|
-
const
|
|
1768
|
-
if (!
|
|
1769
|
-
const
|
|
1770
|
-
if (
|
|
1771
|
-
const h = ct(parseFloat(
|
|
1767
|
+
const s = Be.exec(i.trim());
|
|
1768
|
+
if (!s) return null;
|
|
1769
|
+
const r = s[1].split(",").map((u) => u.trim());
|
|
1770
|
+
if (r.length < 3) return null;
|
|
1771
|
+
const h = ct(parseFloat(r[0])), o = ct(parseFloat(r[1])), c = ct(parseFloat(r[2])), l = r[3] !== void 0 ? 255 * Math.max(0, Math.min(1, parseFloat(r[3]))) : 255;
|
|
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 _e {
|
|
1776
1776
|
constructor(t = {}) {
|
|
1777
1777
|
a(this, "kr");
|
|
1778
1778
|
a(this, "Nr", null);
|
|
@@ -1788,14 +1788,14 @@ class De {
|
|
|
1788
1788
|
const t = document.createElement("canvas");
|
|
1789
1789
|
t.className = "textmodeCanvas", t.style.imageRendering = "pixelated";
|
|
1790
1790
|
const e = this.Nr.getBoundingClientRect();
|
|
1791
|
-
let i = Math.round(e.width),
|
|
1791
|
+
let i = Math.round(e.width), s = Math.round(e.height);
|
|
1792
1792
|
if (this.Nr instanceof HTMLVideoElement) {
|
|
1793
1793
|
const o = this.Nr;
|
|
1794
|
-
(i === 0 ||
|
|
1794
|
+
(i === 0 || s === 0) && o.videoWidth > 0 && o.videoHeight > 0 && (i = o.videoWidth, s = o.videoHeight);
|
|
1795
1795
|
}
|
|
1796
|
-
t.width = i, t.height =
|
|
1797
|
-
const
|
|
1798
|
-
let h = parseInt(
|
|
1796
|
+
t.width = i, t.height = s, t.style.position = "absolute", t.style.pointerEvents = "none";
|
|
1797
|
+
const r = window.getComputedStyle(this.Nr);
|
|
1798
|
+
let h = parseInt(r.zIndex || "0", 10);
|
|
1799
1799
|
return isNaN(h) && (h = 0), t.style.zIndex = "" + (h + 1), t;
|
|
1800
1800
|
}
|
|
1801
1801
|
Kr() {
|
|
@@ -1810,7 +1810,7 @@ class De {
|
|
|
1810
1810
|
const t = this.qr();
|
|
1811
1811
|
for (const e of t) {
|
|
1812
1812
|
if (!e) continue;
|
|
1813
|
-
const i =
|
|
1813
|
+
const i = Ne(window.getComputedStyle(e).backgroundColor);
|
|
1814
1814
|
if (i) return i;
|
|
1815
1815
|
}
|
|
1816
1816
|
return [255, 255, 255, 255];
|
|
@@ -1857,45 +1857,45 @@ class De {
|
|
|
1857
1857
|
}
|
|
1858
1858
|
}
|
|
1859
1859
|
function $(n) {
|
|
1860
|
-
return
|
|
1860
|
+
return I(parseInt(n, 16), 0, 255);
|
|
1861
1861
|
}
|
|
1862
1862
|
class S {
|
|
1863
|
-
constructor(t, e, i,
|
|
1863
|
+
constructor(t, e, i, s) {
|
|
1864
1864
|
a(this, "sn");
|
|
1865
1865
|
a(this, "en");
|
|
1866
1866
|
a(this, "r");
|
|
1867
1867
|
a(this, "g");
|
|
1868
1868
|
a(this, "b");
|
|
1869
1869
|
a(this, "a");
|
|
1870
|
-
this.r =
|
|
1870
|
+
this.r = I(t, 0, 255), this.g = I(e, 0, 255), this.b = I(i, 0, 255), this.a = I(s, 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
|
-
static rn(t, e, i,
|
|
1872
|
+
static rn(t, e, i, s) {
|
|
1873
1873
|
if (S.nn(t)) return t;
|
|
1874
1874
|
if (Array.isArray(t)) {
|
|
1875
1875
|
if (t.length < 3) throw Error("Component tuples must include at least RGB values.");
|
|
1876
|
-
const [
|
|
1877
|
-
return S.hn(
|
|
1876
|
+
const [r, h, o] = t, c = t.length === 4 ? t[3] : 255;
|
|
1877
|
+
return S.hn(r, h, o, c);
|
|
1878
1878
|
}
|
|
1879
1879
|
if (typeof t == "string") {
|
|
1880
|
-
const
|
|
1881
|
-
if (
|
|
1882
|
-
return S.an(
|
|
1880
|
+
const r = t.trim();
|
|
1881
|
+
if (r.length === 0) throw Error("Color strings cannot be empty.");
|
|
1882
|
+
return S.an(r);
|
|
1883
1883
|
}
|
|
1884
|
-
if (typeof t == "number") return typeof e == "number" && typeof i == "number" ? S.hn(t, e, i,
|
|
1884
|
+
if (typeof t == "number") return typeof e == "number" && typeof i == "number" ? S.hn(t, e, i, s ?? 255) : S.cn(t);
|
|
1885
1885
|
throw Error("Unsupported color input passed to TextmodeColor.$from.");
|
|
1886
1886
|
}
|
|
1887
|
-
static hn(t, e, i,
|
|
1888
|
-
return new S(t, e, i,
|
|
1887
|
+
static hn(t, e, i, s = 255) {
|
|
1888
|
+
return new S(t, e, i, s);
|
|
1889
1889
|
}
|
|
1890
1890
|
static cn(t, e = 255) {
|
|
1891
1891
|
return new S(t, t, t, e);
|
|
1892
1892
|
}
|
|
1893
1893
|
static an(t) {
|
|
1894
1894
|
return new S(...function(e) {
|
|
1895
|
-
const i = e.replace(/^#|0x/gi, ""),
|
|
1896
|
-
var
|
|
1897
|
-
if (
|
|
1898
|
-
return [$(
|
|
1895
|
+
const i = e.replace(/^#|0x/gi, ""), s = (r = i).length === 3 || r.length === 4 ? r.split("").map((h) => h + h).join("") : r;
|
|
1896
|
+
var r;
|
|
1897
|
+
if (s.length !== 6 && s.length !== 8) throw Error("Invalid hex color: " + e);
|
|
1898
|
+
return [$(s.slice(0, 2)), $(s.slice(2, 4)), $(s.slice(4, 6)), s.length === 8 ? $(s.slice(6, 8)) : 255];
|
|
1899
1899
|
}(t));
|
|
1900
1900
|
}
|
|
1901
1901
|
get rgb() {
|
|
@@ -1915,7 +1915,7 @@ class S {
|
|
|
1915
1915
|
}
|
|
1916
1916
|
}
|
|
1917
1917
|
class St {
|
|
1918
|
-
constructor(t, e, i,
|
|
1918
|
+
constructor(t, e, i, s, r, h, o, c) {
|
|
1919
1919
|
a(this, "A");
|
|
1920
1920
|
a(this, "Z");
|
|
1921
1921
|
a(this, "ln");
|
|
@@ -1939,7 +1939,7 @@ class St {
|
|
|
1939
1939
|
a(this, "yn", [0, 0, 0, 1]);
|
|
1940
1940
|
a(this, "An", [[0.1, 0, 0]]);
|
|
1941
1941
|
a(this, "wn", null);
|
|
1942
|
-
this.A = t, this.Z = e, this.ln = i, this.gn =
|
|
1942
|
+
this.A = t, this.Z = e, this.ln = i, this.gn = s, this.un = r, this.fn = h, this.N = o, this.X = c;
|
|
1943
1943
|
}
|
|
1944
1944
|
conversionMode(t) {
|
|
1945
1945
|
return this.vn = t, this.pn = null, this.q = null, this;
|
|
@@ -1965,14 +1965,14 @@ class St {
|
|
|
1965
1965
|
cellColorMode(t) {
|
|
1966
1966
|
return this._n = t, this.q = null, this;
|
|
1967
1967
|
}
|
|
1968
|
-
charColor(t, e, i,
|
|
1969
|
-
return this.bn(this.Xt, t, e, i,
|
|
1968
|
+
charColor(t, e, i, s) {
|
|
1969
|
+
return this.bn(this.Xt, t, e, i, s), this.q = null, this;
|
|
1970
1970
|
}
|
|
1971
|
-
cellColor(t, e, i,
|
|
1972
|
-
return this.bn(this.Yt, t, e, i,
|
|
1971
|
+
cellColor(t, e, i, s) {
|
|
1972
|
+
return this.bn(this.Yt, t, e, i, s), this.q = null, this;
|
|
1973
1973
|
}
|
|
1974
|
-
background(t, e, i,
|
|
1975
|
-
return this.bn(this.yn, t, e, i,
|
|
1974
|
+
background(t, e, i, s) {
|
|
1975
|
+
return this.bn(this.yn, t, e, i, s), this.q = null, this;
|
|
1976
1976
|
}
|
|
1977
1977
|
characters(t) {
|
|
1978
1978
|
return this.wn = t, this.Cn(t), this.q = null, this;
|
|
@@ -2002,11 +2002,11 @@ class St {
|
|
|
2002
2002
|
}
|
|
2003
2003
|
ft() {
|
|
2004
2004
|
this.xn();
|
|
2005
|
-
const t = this.Mn(), e = this.Fn(), i = t.createShader(e),
|
|
2006
|
-
this.q = this.Z.materialManager.Ni(i,
|
|
2005
|
+
const t = this.Mn(), e = this.Fn(), i = t.createShader(e), s = t.createUniforms(e);
|
|
2006
|
+
this.q = this.Z.materialManager.Ni(i, s);
|
|
2007
2007
|
}
|
|
2008
|
-
bn(t, e, i,
|
|
2009
|
-
const h = S.rn(e, i,
|
|
2008
|
+
bn(t, e, i, s, r) {
|
|
2009
|
+
const h = S.rn(e, i, s, r);
|
|
2010
2010
|
tt(t, h.r, h.g, h.b, h.a);
|
|
2011
2011
|
}
|
|
2012
2012
|
Cn(t) {
|
|
@@ -2029,15 +2029,15 @@ class St {
|
|
|
2029
2029
|
}
|
|
2030
2030
|
}
|
|
2031
2031
|
class z extends St {
|
|
2032
|
-
constructor(t, e, i,
|
|
2033
|
-
const l = Math.min(o /
|
|
2034
|
-
super(t, e, i,
|
|
2032
|
+
constructor(t, e, i, s, r, h, o, c) {
|
|
2033
|
+
const l = Math.min(o / r, c / h);
|
|
2034
|
+
super(t, e, i, s, r, h, Math.max(1, Math.floor(r * l)), Math.max(1, Math.floor(h * l)));
|
|
2035
2035
|
}
|
|
2036
|
-
static Tn(t, e, i,
|
|
2036
|
+
static Tn(t, e, i, s, r) {
|
|
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 z(h, t, o, e, c, l,
|
|
2040
|
+
return new z(h, t, o, e, c, l, s, r);
|
|
2041
2041
|
}
|
|
2042
2042
|
$n() {
|
|
2043
2043
|
return this.ln;
|
|
@@ -2053,16 +2053,16 @@ class Ut {
|
|
|
2053
2053
|
a(this, "Dn", 0);
|
|
2054
2054
|
a(this, "Ln", []);
|
|
2055
2055
|
a(this, "On", 10);
|
|
2056
|
-
a(this, "
|
|
2056
|
+
a(this, "In", 0);
|
|
2057
2057
|
this.En = 1e3 / t;
|
|
2058
2058
|
}
|
|
2059
|
-
|
|
2059
|
+
Bn(t) {
|
|
2060
2060
|
if (!this.zn) return;
|
|
2061
2061
|
this.Sn = performance.now();
|
|
2062
2062
|
const e = (i) => {
|
|
2063
2063
|
if (!this.zn) return void (this.Rn = null);
|
|
2064
|
-
const
|
|
2065
|
-
|
|
2064
|
+
const s = i - this.Sn;
|
|
2065
|
+
s >= this.En && (t(), this.Sn = i - s % this.En), this.zn && (this.Rn = requestAnimationFrame(e));
|
|
2066
2066
|
};
|
|
2067
2067
|
this.Rn = requestAnimationFrame(e);
|
|
2068
2068
|
}
|
|
@@ -2073,18 +2073,18 @@ class Ut {
|
|
|
2073
2073
|
this.zn && (this.zn = !1, this.Hn());
|
|
2074
2074
|
}
|
|
2075
2075
|
Qn(t) {
|
|
2076
|
-
this.zn || (this.zn = !0, this.
|
|
2076
|
+
this.zn || (this.zn = !0, this.Bn(t));
|
|
2077
2077
|
}
|
|
2078
2078
|
Nn(t, e) {
|
|
2079
2079
|
if (t === void 0) return this.kn;
|
|
2080
|
-
this.En = 1e3 / t, this.zn && e && (this.Hn(), this.
|
|
2080
|
+
this.En = 1e3 / t, this.zn && e && (this.Hn(), this.Bn(e));
|
|
2081
2081
|
}
|
|
2082
2082
|
Xn() {
|
|
2083
2083
|
const t = performance.now();
|
|
2084
2084
|
if (this.Dn > 0) {
|
|
2085
2085
|
const e = t - this.Dn;
|
|
2086
2086
|
this.Ln.push(e), this.Ln.length > this.On && this.Ln.shift();
|
|
2087
|
-
const i = this.Ln.reduce((
|
|
2087
|
+
const i = this.Ln.reduce((s, r) => s + r, 0) / this.Ln.length;
|
|
2088
2088
|
this.kn = 1e3 / i;
|
|
2089
2089
|
}
|
|
2090
2090
|
this.Dn = t;
|
|
@@ -2096,13 +2096,13 @@ class Ut {
|
|
|
2096
2096
|
return this.kn;
|
|
2097
2097
|
}
|
|
2098
2098
|
get Kn() {
|
|
2099
|
-
return this.
|
|
2099
|
+
return this.In;
|
|
2100
2100
|
}
|
|
2101
2101
|
set Kn(t) {
|
|
2102
|
-
this.
|
|
2102
|
+
this.In = t;
|
|
2103
2103
|
}
|
|
2104
2104
|
Wn() {
|
|
2105
|
-
this.
|
|
2105
|
+
this.In++;
|
|
2106
2106
|
}
|
|
2107
2107
|
}
|
|
2108
2108
|
class Lt {
|
|
@@ -2170,8 +2170,8 @@ class Lt {
|
|
|
2170
2170
|
} else {
|
|
2171
2171
|
const e = Math.floor((t.cols - 1) / 2), i = Math.floor(t.rows / 2);
|
|
2172
2172
|
if (this.qn.x !== -1 / 0 && this.qn.y !== -1 / 0) {
|
|
2173
|
-
const
|
|
2174
|
-
(this.qn.x <
|
|
2173
|
+
const s = -e, r = t.cols - e - 1, h = -i, o = t.rows - i - 1;
|
|
2174
|
+
(this.qn.x < s || this.qn.x > r || this.qn.y < h || this.qn.y > o) && (this.qn.x = -1 / 0, this.qn.y = -1 / 0);
|
|
2175
2175
|
}
|
|
2176
2176
|
}
|
|
2177
2177
|
} catch {
|
|
@@ -2187,13 +2187,13 @@ class Lt {
|
|
|
2187
2187
|
To(t) {
|
|
2188
2188
|
this.uo = t;
|
|
2189
2189
|
}
|
|
2190
|
-
|
|
2190
|
+
Uo(t) {
|
|
2191
2191
|
this.fo = t;
|
|
2192
2192
|
}
|
|
2193
|
-
|
|
2193
|
+
Eo(t) {
|
|
2194
2194
|
this.do = t;
|
|
2195
2195
|
}
|
|
2196
|
-
|
|
2196
|
+
Ro() {
|
|
2197
2197
|
return { x: this.qn.x, y: this.qn.y };
|
|
2198
2198
|
}
|
|
2199
2199
|
Ao(t) {
|
|
@@ -2229,102 +2229,103 @@ class Lt {
|
|
|
2229
2229
|
yo(t) {
|
|
2230
2230
|
const e = this.kr.canvas, i = this.Zn();
|
|
2231
2231
|
if (this.Vn = { ...this.qn }, this.Jn = { x: t.clientX, y: t.clientY }, !i) return this.qn.x = -1 / 0, void (this.qn.y = -1 / 0);
|
|
2232
|
-
const
|
|
2232
|
+
const s = e.getBoundingClientRect(), r = t.clientX - s.left, h = t.clientY - s.top, o = e.width / s.width, c = h * (e.height / s.height), l = r * o - i.offsetX, u = c - i.offsetY, f = Math.floor(l / i.cellWidth), d = Math.floor(u / i.cellHeight);
|
|
2233
2233
|
if (f >= 0 && f < i.cols && d >= 0 && d < i.rows) {
|
|
2234
2234
|
const g = Math.floor((i.cols - 1) / 2);
|
|
2235
2235
|
this.qn.x = f - g, this.qn.y = d - Math.floor(i.rows / 2);
|
|
2236
2236
|
} else this.qn.x = -1 / 0, this.qn.y = -1 / 0;
|
|
2237
2237
|
}
|
|
2238
2238
|
}
|
|
2239
|
-
const
|
|
2240
|
-
class
|
|
2239
|
+
const De = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Lt }, Symbol.toStringTag, { value: "Module" }));
|
|
2240
|
+
class Bt {
|
|
2241
2241
|
constructor() {
|
|
2242
|
-
a(this, "
|
|
2242
|
+
a(this, "So", /* @__PURE__ */ new Map());
|
|
2243
|
+
a(this, "zo", null);
|
|
2243
2244
|
a(this, "ko", null);
|
|
2244
|
-
a(this, "Do"
|
|
2245
|
+
a(this, "Do");
|
|
2245
2246
|
a(this, "Lo");
|
|
2246
|
-
a(this, "Oo");
|
|
2247
2247
|
a(this, "ao", !1);
|
|
2248
|
-
a(this, "
|
|
2248
|
+
a(this, "Oo");
|
|
2249
2249
|
a(this, "Io");
|
|
2250
|
-
a(this, "
|
|
2250
|
+
a(this, "Bo", { ArrowUp: "UP_ARROW", ArrowDown: "DOWN_ARROW", ArrowLeft: "LEFT_ARROW", ArrowRight: "RIGHT_ARROW", F1: "F1", F2: "F2", F3: "F3", F4: "F4", F5: "F5", F6: "F6", F7: "F7", F8: "F8", F9: "F9", F10: "F10", F11: "F11", F12: "F12", Enter: "ENTER", Return: "RETURN", Tab: "TAB", Escape: "ESCAPE", Backspace: "BACKSPACE", Delete: "DELETE", Insert: "INSERT", Home: "HOME", End: "END", PageUp: "PAGE_UP", PageDown: "PAGE_DOWN", Shift: "SHIFT", Control: "CONTROL", Alt: "ALT", Meta: "META", " ": "SPACE" });
|
|
2251
2251
|
}
|
|
2252
2252
|
_o() {
|
|
2253
|
-
this.ao || (this.
|
|
2253
|
+
this.ao || (this.Do = (t) => {
|
|
2254
|
+
this.Ho(t);
|
|
2255
|
+
}, this.Lo = (t) => {
|
|
2254
2256
|
this.Go(t);
|
|
2255
|
-
}, this.
|
|
2256
|
-
this.Qo(t);
|
|
2257
|
-
}, window.addEventListener("keydown", this.Lo, { passive: !1 }), window.addEventListener("keyup", this.Oo, { passive: !1 }), this.ao = !0);
|
|
2257
|
+
}, window.addEventListener("keydown", this.Do, { passive: !1 }), window.addEventListener("keyup", this.Lo, { passive: !1 }), this.ao = !0);
|
|
2258
2258
|
}
|
|
2259
2259
|
Mo() {
|
|
2260
|
-
this.ao && (window.removeEventListener("keydown", this.
|
|
2260
|
+
this.ao && (window.removeEventListener("keydown", this.Do), window.removeEventListener("keyup", this.Lo), this.ao = !1, this.So.clear(), this.zo = null, this.ko = null);
|
|
2261
2261
|
}
|
|
2262
2262
|
Po(t) {
|
|
2263
|
-
this.
|
|
2263
|
+
this.Oo = t;
|
|
2264
2264
|
}
|
|
2265
2265
|
To(t) {
|
|
2266
2266
|
this.Io = t;
|
|
2267
2267
|
}
|
|
2268
|
-
|
|
2269
|
-
const e = this.
|
|
2268
|
+
Qo(t) {
|
|
2269
|
+
const e = this.No(t), i = this.So.get(t) || this.So.get(e);
|
|
2270
2270
|
return (i == null ? void 0 : i.isPressed) || !1;
|
|
2271
2271
|
}
|
|
2272
|
+
Xo() {
|
|
2273
|
+
return this.zo;
|
|
2274
|
+
}
|
|
2272
2275
|
Yo() {
|
|
2273
2276
|
return this.ko;
|
|
2274
2277
|
}
|
|
2275
2278
|
jo() {
|
|
2276
|
-
return this.Do;
|
|
2277
|
-
}
|
|
2278
|
-
Ko() {
|
|
2279
2279
|
const t = [];
|
|
2280
|
-
for (const [e, i] of this.
|
|
2280
|
+
for (const [e, i] of this.So) i.isPressed && t.push(e);
|
|
2281
2281
|
return t;
|
|
2282
2282
|
}
|
|
2283
|
-
|
|
2284
|
-
return { ctrl: this.
|
|
2283
|
+
Ko() {
|
|
2284
|
+
return { ctrl: this.Qo("Control"), shift: this.Qo("Shift"), alt: this.Qo("Alt"), meta: this.Qo("Meta") };
|
|
2285
2285
|
}
|
|
2286
|
-
|
|
2287
|
-
this.
|
|
2286
|
+
Wo() {
|
|
2287
|
+
this.So.clear(), this.zo = null, this.ko = null;
|
|
2288
2288
|
}
|
|
2289
|
-
|
|
2289
|
+
Ho(t) {
|
|
2290
2290
|
const e = t.key, i = Date.now();
|
|
2291
|
-
this.
|
|
2292
|
-
const
|
|
2293
|
-
if (!
|
|
2294
|
-
const
|
|
2295
|
-
this.
|
|
2291
|
+
this.So.has(e) || this.So.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
2292
|
+
const s = this.So.get(e);
|
|
2293
|
+
if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.zo = e, this.Oo)) {
|
|
2294
|
+
const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !0, originalEvent: t };
|
|
2295
|
+
this.Oo(r);
|
|
2296
2296
|
}
|
|
2297
2297
|
}
|
|
2298
|
-
|
|
2298
|
+
Go(t) {
|
|
2299
2299
|
const e = t.key, i = Date.now();
|
|
2300
|
-
this.
|
|
2301
|
-
const
|
|
2302
|
-
if (
|
|
2303
|
-
const
|
|
2304
|
-
this.Io(
|
|
2300
|
+
this.So.has(e) || this.So.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
2301
|
+
const s = this.So.get(e);
|
|
2302
|
+
if (s.isPressed = !1, s.lastReleaseTime = i, this.ko = e, this.Io) {
|
|
2303
|
+
const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !1, originalEvent: t };
|
|
2304
|
+
this.Io(r);
|
|
2305
2305
|
}
|
|
2306
2306
|
}
|
|
2307
|
-
|
|
2308
|
-
return this.
|
|
2307
|
+
No(t) {
|
|
2308
|
+
return this.Bo[t] || t.toLowerCase();
|
|
2309
2309
|
}
|
|
2310
2310
|
}
|
|
2311
|
-
const
|
|
2312
|
-
class
|
|
2311
|
+
const Oe = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Bt }, Symbol.toStringTag, { value: "Module" }));
|
|
2312
|
+
class Nt {
|
|
2313
2313
|
constructor(t, e, i) {
|
|
2314
2314
|
a(this, "kr");
|
|
2315
|
-
a(this, "
|
|
2315
|
+
a(this, "Zo");
|
|
2316
2316
|
a(this, "Zn");
|
|
2317
|
+
a(this, "qo", /* @__PURE__ */ new Map());
|
|
2317
2318
|
a(this, "Vo", /* @__PURE__ */ new Map());
|
|
2318
2319
|
a(this, "Jo", /* @__PURE__ */ new Map());
|
|
2319
|
-
a(this, "th",
|
|
2320
|
-
a(this, "sh"
|
|
2320
|
+
a(this, "th", null);
|
|
2321
|
+
a(this, "sh");
|
|
2321
2322
|
a(this, "ih");
|
|
2322
2323
|
a(this, "eh");
|
|
2323
2324
|
a(this, "rh");
|
|
2324
2325
|
a(this, "nh");
|
|
2325
2326
|
a(this, "oh");
|
|
2326
|
-
a(this, "hh");
|
|
2327
2327
|
a(this, "ao", !1);
|
|
2328
|
+
a(this, "hh");
|
|
2328
2329
|
a(this, "ah");
|
|
2329
2330
|
a(this, "uh");
|
|
2330
2331
|
a(this, "fh");
|
|
@@ -2334,59 +2335,61 @@ class Bt {
|
|
|
2334
2335
|
a(this, "mh");
|
|
2335
2336
|
a(this, "_h");
|
|
2336
2337
|
a(this, "yh");
|
|
2337
|
-
a(this, "Ah");
|
|
2338
|
-
a(this, "wh",
|
|
2339
|
-
a(this, "bh",
|
|
2340
|
-
a(this, "Ch",
|
|
2341
|
-
a(this, "xh",
|
|
2342
|
-
a(this, "Mh",
|
|
2343
|
-
a(this, "Fh",
|
|
2344
|
-
a(this, "$h",
|
|
2345
|
-
a(this, "Ph",
|
|
2346
|
-
a(this, "Th",
|
|
2347
|
-
a(this, "Eh",
|
|
2348
|
-
a(this, "Rh",
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
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");
|
|
2338
|
+
a(this, "Ah", 320);
|
|
2339
|
+
a(this, "wh", 350);
|
|
2340
|
+
a(this, "bh", 10);
|
|
2341
|
+
a(this, "Ch", 550);
|
|
2342
|
+
a(this, "xh", 14);
|
|
2343
|
+
a(this, "Mh", 48);
|
|
2344
|
+
a(this, "Fh", 650);
|
|
2345
|
+
a(this, "$h", 0.02);
|
|
2346
|
+
a(this, "Ph", 2);
|
|
2347
|
+
a(this, "Th", 600);
|
|
2348
|
+
a(this, "Eh", 0);
|
|
2349
|
+
a(this, "Rh", null);
|
|
2350
|
+
this.kr = t, this.Zn = e, this.Zo = i;
|
|
2351
|
+
const s = this.kr.canvas;
|
|
2352
|
+
this.sh = s.style.touchAction, this.ih = s.style.userSelect, s.style.touchAction || (s.style.touchAction = "none"), s.style.userSelect || (s.style.userSelect = "none");
|
|
2353
2353
|
}
|
|
2354
2354
|
_o() {
|
|
2355
2355
|
if (this.ao) return;
|
|
2356
2356
|
const t = this.kr.canvas;
|
|
2357
|
-
this.
|
|
2357
|
+
this.eh = (e) => {
|
|
2358
|
+
this.Sh(e);
|
|
2359
|
+
}, this.rh = (e) => {
|
|
2358
2360
|
this.zh(e);
|
|
2359
2361
|
}, this.nh = (e) => {
|
|
2360
2362
|
this.kh(e);
|
|
2361
2363
|
}, this.oh = (e) => {
|
|
2362
2364
|
this.Dh(e);
|
|
2363
|
-
}, this.
|
|
2364
|
-
this.Lh(e);
|
|
2365
|
-
}, t.addEventListener("touchstart", this.rh, { passive: !1 }), t.addEventListener("touchmove", this.nh, { passive: !1 }), t.addEventListener("touchend", this.oh, { passive: !1 }), t.addEventListener("touchcancel", this.hh, { passive: !1 }), this.ao = !0;
|
|
2365
|
+
}, t.addEventListener("touchstart", this.eh, { passive: !1 }), t.addEventListener("touchmove", this.rh, { passive: !1 }), t.addEventListener("touchend", this.nh, { passive: !1 }), t.addEventListener("touchcancel", this.oh, { passive: !1 }), this.ao = !0;
|
|
2366
2366
|
}
|
|
2367
2367
|
Mo() {
|
|
2368
2368
|
if (!this.ao) return;
|
|
2369
2369
|
const t = this.kr.canvas;
|
|
2370
|
-
t.removeEventListener("touchstart", this.
|
|
2370
|
+
t.removeEventListener("touchstart", this.eh), t.removeEventListener("touchmove", this.rh), t.removeEventListener("touchend", this.nh), t.removeEventListener("touchcancel", this.oh), this.ao = !1, this.th = null, this.qo.clear(), this.Vo.clear(), this.Jo.forEach((e) => {
|
|
2371
2371
|
e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
|
|
2372
|
-
}), this.
|
|
2372
|
+
}), this.Jo.clear(), this.Rh = null, this.Eh = 0, t.style.touchAction = this.sh, t.style.userSelect = this.ih;
|
|
2373
2373
|
}
|
|
2374
2374
|
Fo() {
|
|
2375
|
-
if (!this.Zn() || this.
|
|
2375
|
+
if (!this.Zn() || this.qo.size === 0) return;
|
|
2376
2376
|
const t = /* @__PURE__ */ new Map();
|
|
2377
|
-
for (const e of this.
|
|
2378
|
-
const i = this.
|
|
2377
|
+
for (const e of this.qo.values()) {
|
|
2378
|
+
const i = this.Lh(e.clientX, e.clientY, e.id, e);
|
|
2379
2379
|
t.set(e.id, i);
|
|
2380
2380
|
}
|
|
2381
|
-
this.
|
|
2381
|
+
this.qo = t;
|
|
2382
2382
|
}
|
|
2383
|
-
|
|
2384
|
-
return Array.from(this.
|
|
2383
|
+
Oh() {
|
|
2384
|
+
return Array.from(this.qo.values()).map((t) => ({ ...t }));
|
|
2385
2385
|
}
|
|
2386
2386
|
Ih(t) {
|
|
2387
|
+
this.hh = t;
|
|
2388
|
+
}
|
|
2389
|
+
Uo(t) {
|
|
2387
2390
|
this.ah = t;
|
|
2388
2391
|
}
|
|
2389
|
-
|
|
2392
|
+
Bh(t) {
|
|
2390
2393
|
this.uh = t;
|
|
2391
2394
|
}
|
|
2392
2395
|
Hh(t) {
|
|
@@ -2410,133 +2413,130 @@ class Bt {
|
|
|
2410
2413
|
jh(t) {
|
|
2411
2414
|
this.yh = t;
|
|
2412
2415
|
}
|
|
2413
|
-
|
|
2414
|
-
|
|
2416
|
+
Sh(t) {
|
|
2417
|
+
var s;
|
|
2418
|
+
if (!this.Zn()) return;
|
|
2419
|
+
t.preventDefault(), (s = this.Zo) == null || s.vo(this.Th);
|
|
2420
|
+
const e = performance.now(), i = this.Kh(t.changedTouches);
|
|
2421
|
+
for (const r of i) {
|
|
2422
|
+
const h = this.qo.get(r.id);
|
|
2423
|
+
h && this.Vo.set(r.id, this.Wh(h)), this.qo.set(r.id, r);
|
|
2424
|
+
const o = { id: r.id, startPosition: r, lastPosition: r, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
|
|
2425
|
+
this.gh && (o.longPressTimer = window.setTimeout(() => {
|
|
2426
|
+
const c = this.qo.get(r.id);
|
|
2427
|
+
c && (o.longPressFired = !0, this.gh({ touch: this.Wh(c), duration: performance.now() - o.startTime, originalEvent: t }));
|
|
2428
|
+
}, this.Ch)), this.Jo.set(r.id, o), this.hh && this.hh(this.Zh(r, t, void 0, e));
|
|
2429
|
+
}
|
|
2430
|
+
this.qo.size === 2 && this.qh();
|
|
2415
2431
|
}
|
|
2416
2432
|
zh(t) {
|
|
2417
|
-
var
|
|
2433
|
+
var s;
|
|
2418
2434
|
if (!this.Zn()) return;
|
|
2419
|
-
t.preventDefault(), (
|
|
2420
|
-
const e = performance.now(), i = this.
|
|
2421
|
-
for (const
|
|
2422
|
-
const h = this.
|
|
2423
|
-
|
|
2424
|
-
const
|
|
2425
|
-
|
|
2426
|
-
const c = this.Vo.get(s.id);
|
|
2427
|
-
c && (o.longPressFired = !0, this.mh({ touch: this.Zh(c), duration: performance.now() - o.startTime, originalEvent: t }));
|
|
2428
|
-
}, this.xh)), this.th.set(s.id, o), this.ah && this.ah(this.qh(s, t, void 0, e));
|
|
2435
|
+
t.preventDefault(), (s = this.Zo) == null || s.vo(this.Th);
|
|
2436
|
+
const e = performance.now(), i = this.Kh(t.changedTouches);
|
|
2437
|
+
for (const r of i) {
|
|
2438
|
+
const h = this.qo.get(r.id), o = h ? this.Wh(h) : void 0;
|
|
2439
|
+
o && this.Vo.set(r.id, o), this.qo.set(r.id, r);
|
|
2440
|
+
const c = this.Jo.get(r.id);
|
|
2441
|
+
c && (c.lastPosition = r, c.lastTime = e, o) && Y(o.clientX, o.clientY, r.clientX, r.clientY) > this.xh && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.ah && this.ah(this.Zh(r, t, o, e));
|
|
2429
2442
|
}
|
|
2430
|
-
this.
|
|
2443
|
+
this.qo.size === 2 ? this.Vh(t) : this.th = null;
|
|
2431
2444
|
}
|
|
2432
2445
|
kh(t) {
|
|
2433
|
-
var r;
|
|
2434
2446
|
if (!this.Zn()) return;
|
|
2435
|
-
t.preventDefault()
|
|
2436
|
-
const e = performance.now(), i = this.
|
|
2447
|
+
t.preventDefault();
|
|
2448
|
+
const e = performance.now(), i = this.Kh(t.changedTouches);
|
|
2437
2449
|
for (const s of i) {
|
|
2438
|
-
const
|
|
2439
|
-
o && this.
|
|
2440
|
-
const c = this.th.get(s.id);
|
|
2441
|
-
c && (c.lastPosition = s, c.lastTime = e, o) && Y(o.clientX, o.clientY, s.clientX, s.clientY) > this.Mh && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.uh && this.uh(this.qh(s, t, o, e));
|
|
2450
|
+
const r = this.qo.get(s.id), h = r ? this.Wh(r) : void 0, o = this.Jo.get(s.id);
|
|
2451
|
+
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.uh && this.uh(this.Zh(s, t, h, e)), o && this.Jh(o, t), this.Jo.delete(s.id), this.Vo.delete(s.id), this.qo.delete(s.id);
|
|
2442
2452
|
}
|
|
2443
|
-
this.
|
|
2453
|
+
this.qo.size < 2 && (this.th = null);
|
|
2444
2454
|
}
|
|
2445
2455
|
Dh(t) {
|
|
2446
2456
|
if (!this.Zn()) return;
|
|
2447
2457
|
t.preventDefault();
|
|
2448
|
-
const e = performance.now(), i = this.
|
|
2449
|
-
for (const
|
|
2450
|
-
const
|
|
2451
|
-
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.fh && this.fh(this.
|
|
2452
|
-
}
|
|
2453
|
-
this.Vo.size < 2 && (this.sh = null);
|
|
2454
|
-
}
|
|
2455
|
-
Lh(t) {
|
|
2456
|
-
if (!this.Zn()) return;
|
|
2457
|
-
t.preventDefault();
|
|
2458
|
-
const e = performance.now(), i = this.Wh(t.changedTouches);
|
|
2459
|
-
for (const r of i) {
|
|
2460
|
-
const s = this.Vo.get(r.id), h = s ? this.Zh(s) : void 0, o = this.th.get(r.id);
|
|
2461
|
-
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.dh && this.dh(this.qh(r, t, h, e)), this.th.delete(r.id), this.Jo.delete(r.id), this.Vo.delete(r.id);
|
|
2458
|
+
const e = performance.now(), i = this.Kh(t.changedTouches);
|
|
2459
|
+
for (const s of i) {
|
|
2460
|
+
const r = this.qo.get(s.id), h = r ? this.Wh(r) : void 0, o = this.Jo.get(s.id);
|
|
2461
|
+
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.fh && this.fh(this.Zh(s, t, h, e)), this.Jo.delete(s.id), this.Vo.delete(s.id), this.qo.delete(s.id);
|
|
2462
2462
|
}
|
|
2463
|
-
this.
|
|
2463
|
+
this.qo.size < 2 && (this.th = null);
|
|
2464
2464
|
}
|
|
2465
|
-
|
|
2465
|
+
Kh(t) {
|
|
2466
2466
|
const e = [];
|
|
2467
2467
|
for (let i = 0; i < t.length; i += 1) {
|
|
2468
|
-
const
|
|
2469
|
-
|
|
2468
|
+
const s = t.item(i);
|
|
2469
|
+
s && e.push(this.ta(s));
|
|
2470
2470
|
}
|
|
2471
2471
|
return e;
|
|
2472
2472
|
}
|
|
2473
|
-
|
|
2474
|
-
return this.
|
|
2473
|
+
ta(t) {
|
|
2474
|
+
return this.Lh(t.clientX, t.clientY, t.identifier, { id: t.identifier, x: -1, y: -1, clientX: t.clientX, clientY: t.clientY, pressure: t.force, radiusX: t.radiusX, radiusY: t.radiusY, rotationAngle: t.rotationAngle });
|
|
2475
2475
|
}
|
|
2476
|
-
|
|
2477
|
-
const
|
|
2478
|
-
if (!h) return { id: i, x: -1 / 0, y: -1 / 0, clientX: t, clientY: e, pressure:
|
|
2476
|
+
Lh(t, e, i, s) {
|
|
2477
|
+
const r = this.kr.canvas, h = this.Zn(), o = r.getBoundingClientRect(), c = t - o.left, l = e - o.top, u = c * (r.width / o.width), f = l * (r.height / o.height);
|
|
2478
|
+
if (!h) return { id: i, x: -1 / 0, y: -1 / 0, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
|
|
2479
2479
|
const d = u - h.offsetX, g = f - h.offsetY, p = Math.floor(d / h.cellWidth), v = Math.floor(g / h.cellHeight);
|
|
2480
|
-
return p >= 0 && p < h.cols && v >= 0 && v < h.rows ? { id: i, x: p - Math.floor((h.cols - 1) / 2), y: v - Math.floor(h.rows / 2), clientX: t, clientY: e, pressure:
|
|
2481
|
-
}
|
|
2482
|
-
|
|
2483
|
-
const
|
|
2484
|
-
return { touch: this.
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2487
|
-
if (this.
|
|
2488
|
-
const t = Array.from(this.
|
|
2489
|
-
this.
|
|
2490
|
-
}
|
|
2491
|
-
|
|
2492
|
-
if (this.
|
|
2493
|
-
const [e, i] = this.
|
|
2494
|
-
if (!
|
|
2495
|
-
const h = Y(
|
|
2496
|
-
this.
|
|
2497
|
-
let c =
|
|
2480
|
+
return p >= 0 && p < h.cols && v >= 0 && v < h.rows ? { id: i, x: p - Math.floor((h.cols - 1) / 2), y: v - Math.floor(h.rows / 2), clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle } : { id: i, x: -1 / 0, y: -1 / 0, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
|
|
2481
|
+
}
|
|
2482
|
+
Zh(t, e, i, s) {
|
|
2483
|
+
const r = this.Jo.get(t.id), h = Array.from(this.Vo.values()).map((l) => this.Wh(l)), o = Array.from(this.qo.values()).map((l) => this.Wh(l)), c = this.Kh(e.changedTouches);
|
|
2484
|
+
return { touch: this.Wh(t), previousTouch: i ? this.Wh(i) : void 0, touches: o, previousTouches: h, changedTouches: c, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
|
|
2485
|
+
}
|
|
2486
|
+
qh() {
|
|
2487
|
+
if (this.qo.size !== 2) return void (this.th = null);
|
|
2488
|
+
const t = Array.from(this.qo.values()), [e, i] = t, s = Y(e.x, e.y, i.x, i.y), r = At(e.clientX, e.clientY, i.clientX, i.clientY);
|
|
2489
|
+
this.th = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
|
|
2490
|
+
}
|
|
2491
|
+
Vh(t) {
|
|
2492
|
+
if (this.th || this.qh(), !this.th) return;
|
|
2493
|
+
const [e, i] = this.th.ids, s = this.qo.get(e), r = this.qo.get(i);
|
|
2494
|
+
if (!s || !r) return;
|
|
2495
|
+
const h = Y(s.x, s.y, r.x, r.y) / this.th.initialDistance, o = h - this.th.lastScale;
|
|
2496
|
+
this._h && Math.abs(o) > this.$h && (this._h({ touches: [this.Wh(s), this.Wh(r)], scale: h, deltaScale: o, center: this.sa(s, r), originalEvent: t }), this.th.lastScale = h);
|
|
2497
|
+
let c = At(s.clientX, s.clientY, r.clientX, r.clientY) - this.th.initialAngle;
|
|
2498
2498
|
c = (c + 180) % 360 - 180;
|
|
2499
|
-
const l = c - this.
|
|
2500
|
-
this.
|
|
2499
|
+
const l = c - this.th.lastRotation;
|
|
2500
|
+
this.yh && Math.abs(l) > this.Ph && (this.yh({ touches: [this.Wh(s), this.Wh(r)], rotation: c, deltaRotation: l, center: this.sa(s, r), originalEvent: t }), this.th.lastRotation = c);
|
|
2501
2501
|
}
|
|
2502
|
-
|
|
2503
|
-
const i = (t.clientX + e.clientX) / 2,
|
|
2504
|
-
return { x:
|
|
2502
|
+
sa(t, e) {
|
|
2503
|
+
const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.Lh(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
|
|
2504
|
+
return { x: r.x, y: r.y };
|
|
2505
2505
|
}
|
|
2506
|
-
|
|
2507
|
-
const i = performance.now(),
|
|
2508
|
-
if (!t.longPressFired &&
|
|
2509
|
-
this.
|
|
2510
|
-
else if (!t.longPressFired &&
|
|
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 /
|
|
2512
|
-
this.
|
|
2506
|
+
Jh(t, e) {
|
|
2507
|
+
const i = performance.now(), s = i - t.startTime, r = Y(t.startPosition.clientX, t.startPosition.clientY, t.lastPosition.clientX, t.lastPosition.clientY);
|
|
2508
|
+
if (!t.longPressFired && s <= this.Ah && r <= this.bh)
|
|
2509
|
+
this.ia(t.lastPosition, i) && this.ph ? this.ph({ touch: this.Wh(t.lastPosition), taps: 2, originalEvent: e }) : this.dh && this.dh({ touch: this.Wh(t.lastPosition), taps: 1, originalEvent: e });
|
|
2510
|
+
else if (!t.longPressFired && s <= this.Fh && r >= this.Mh) {
|
|
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 / s, y: h.y / s };
|
|
2512
|
+
this.mh && this.mh({ touch: this.Wh(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
|
|
2513
2513
|
}
|
|
2514
|
-
this.
|
|
2514
|
+
this.Eh = i, this.Rh = this.Wh(t.lastPosition);
|
|
2515
2515
|
}
|
|
2516
|
-
|
|
2517
|
-
return !this.
|
|
2516
|
+
ia(t, e) {
|
|
2517
|
+
return !this.Rh || e - this.Eh > this.wh ? !1 : Y(t.clientX, t.clientY, this.Rh.clientX, this.Rh.clientY) <= this.bh;
|
|
2518
2518
|
}
|
|
2519
|
-
|
|
2519
|
+
Wh(t) {
|
|
2520
2520
|
return { ...t };
|
|
2521
2521
|
}
|
|
2522
2522
|
}
|
|
2523
|
-
const
|
|
2523
|
+
const Ie = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Nt }, Symbol.toStringTag, { value: "Module" }));
|
|
2524
2524
|
class nt extends St {
|
|
2525
|
-
constructor(e, i,
|
|
2525
|
+
constructor(e, i, s, r, h, o, c, l, u) {
|
|
2526
2526
|
const f = o / c;
|
|
2527
2527
|
let d, g;
|
|
2528
2528
|
f > 1 ? (d = l, g = Math.round(l / f)) : (g = u, d = Math.round(u * f));
|
|
2529
|
-
super(e, i,
|
|
2530
|
-
a(this, "
|
|
2531
|
-
this.
|
|
2529
|
+
super(e, i, s, r, o, c, d, g);
|
|
2530
|
+
a(this, "ea");
|
|
2531
|
+
this.ea = h;
|
|
2532
2532
|
}
|
|
2533
2533
|
gt() {
|
|
2534
|
-
super.gt(), this.
|
|
2534
|
+
super.gt(), this.ea.pause(), this.ea.src = "", this.ea.load();
|
|
2535
2535
|
}
|
|
2536
|
-
|
|
2537
|
-
if (this.
|
|
2536
|
+
ra() {
|
|
2537
|
+
if (this.ea.readyState >= this.ea.HAVE_CURRENT_DATA) {
|
|
2538
2538
|
const e = this.A;
|
|
2539
|
-
e.bindTexture(e.TEXTURE_2D, this.ln), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, this.
|
|
2539
|
+
e.bindTexture(e.TEXTURE_2D, this.ln), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, this.ea), e.bindTexture(e.TEXTURE_2D, null);
|
|
2540
2540
|
}
|
|
2541
2541
|
}
|
|
2542
2542
|
$n() {
|
|
@@ -2546,61 +2546,61 @@ class nt extends St {
|
|
|
2546
2546
|
return this.q = null, super.ut();
|
|
2547
2547
|
}
|
|
2548
2548
|
xn() {
|
|
2549
|
-
this.
|
|
2549
|
+
this.ra();
|
|
2550
2550
|
}
|
|
2551
|
-
static async Tn(e, i,
|
|
2551
|
+
static async Tn(e, i, s, r, h) {
|
|
2552
2552
|
const o = e.context;
|
|
2553
2553
|
let c;
|
|
2554
2554
|
c = document.createElement("video"), c.crossOrigin = "anonymous", c.loop = !0, c.muted = !0, c.playsInline = !0, await new Promise((d, g) => {
|
|
2555
2555
|
c.addEventListener("loadedmetadata", () => d(), { once: !0 }), c.addEventListener("error", (p) => {
|
|
2556
|
-
var
|
|
2556
|
+
var m;
|
|
2557
2557
|
const v = p.target;
|
|
2558
|
-
g(Error("Failed to load video: " + (((
|
|
2559
|
-
}, { once: !0 }), c.src =
|
|
2558
|
+
g(Error("Failed to load video: " + (((m = v.error) == null ? void 0 : m.message) || "Unknown error")));
|
|
2559
|
+
}, { once: !0 }), c.src = s;
|
|
2560
2560
|
});
|
|
2561
2561
|
const l = o.createTexture();
|
|
2562
2562
|
o.bindTexture(o.TEXTURE_2D, l), o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL, 1), pt(o, o.LINEAR, o.LINEAR, o.CLAMP_TO_EDGE, o.CLAMP_TO_EDGE), o.texImage2D(o.TEXTURE_2D, 0, o.RGBA, o.RGBA, o.UNSIGNED_BYTE, c), o.bindTexture(o.TEXTURE_2D, null);
|
|
2563
2563
|
const u = c.videoWidth, f = c.videoHeight;
|
|
2564
|
-
return new nt(o, e, l, i, c, u, f,
|
|
2564
|
+
return new nt(o, e, l, i, c, u, f, r, h);
|
|
2565
2565
|
}
|
|
2566
2566
|
async play() {
|
|
2567
|
-
await this.
|
|
2567
|
+
await this.ea.play();
|
|
2568
2568
|
}
|
|
2569
2569
|
pause() {
|
|
2570
|
-
this.
|
|
2570
|
+
this.ea.pause();
|
|
2571
2571
|
}
|
|
2572
2572
|
stop() {
|
|
2573
|
-
this.
|
|
2573
|
+
this.ea.pause(), this.ea.currentTime = 0;
|
|
2574
2574
|
}
|
|
2575
2575
|
speed(e) {
|
|
2576
|
-
return this.
|
|
2576
|
+
return this.ea.playbackRate = e, this;
|
|
2577
2577
|
}
|
|
2578
2578
|
loop(e = !0) {
|
|
2579
|
-
return this.
|
|
2579
|
+
return this.ea.loop = e, this;
|
|
2580
2580
|
}
|
|
2581
2581
|
time(e) {
|
|
2582
|
-
return this.
|
|
2582
|
+
return this.ea.currentTime = e, this;
|
|
2583
2583
|
}
|
|
2584
2584
|
volume(e) {
|
|
2585
|
-
return this.
|
|
2585
|
+
return this.ea.volume = Math.max(0, Math.min(1, e)), this;
|
|
2586
2586
|
}
|
|
2587
2587
|
get videoElement() {
|
|
2588
|
-
return this.
|
|
2588
|
+
return this.ea;
|
|
2589
2589
|
}
|
|
2590
2590
|
get currentTime() {
|
|
2591
|
-
return this.
|
|
2591
|
+
return this.ea.currentTime;
|
|
2592
2592
|
}
|
|
2593
2593
|
get duration() {
|
|
2594
|
-
return this.
|
|
2594
|
+
return this.ea.duration;
|
|
2595
2595
|
}
|
|
2596
2596
|
get isPlaying() {
|
|
2597
|
-
return !this.
|
|
2597
|
+
return !this.ea.paused && !this.ea.ended;
|
|
2598
2598
|
}
|
|
2599
2599
|
}
|
|
2600
|
-
const
|
|
2601
|
-
|
|
2600
|
+
const Xe = (n) => class extends n {
|
|
2601
|
+
na(t, e, i, s) {
|
|
2602
2602
|
if (S.nn(t)) return t;
|
|
2603
|
-
if (typeof t == "number" || typeof t == "string") return this.color(t, e, i,
|
|
2603
|
+
if (typeof t == "number" || typeof t == "string") return this.color(t, e, i, s);
|
|
2604
2604
|
throw Error("Unsupported color input passed to color-capable method.");
|
|
2605
2605
|
}
|
|
2606
2606
|
rotate(t = 0, e = 0, i = 0) {
|
|
@@ -2633,8 +2633,8 @@ const Ze = (n) => class extends n {
|
|
|
2633
2633
|
pop() {
|
|
2634
2634
|
this.Z.state.ht();
|
|
2635
2635
|
}
|
|
2636
|
-
color(t, e, i,
|
|
2637
|
-
return S.rn(t, e, i,
|
|
2636
|
+
color(t, e, i, s) {
|
|
2637
|
+
return S.rn(t, e, i, s);
|
|
2638
2638
|
}
|
|
2639
2639
|
rect(t = 1, e = 1) {
|
|
2640
2640
|
this.Z.be(t, e);
|
|
@@ -2642,28 +2642,28 @@ const Ze = (n) => class extends n {
|
|
|
2642
2642
|
point() {
|
|
2643
2643
|
this.Z.be(1, 1);
|
|
2644
2644
|
}
|
|
2645
|
-
line(t, e, i,
|
|
2646
|
-
this.Z.Ce(t, e, i,
|
|
2645
|
+
line(t, e, i, s) {
|
|
2646
|
+
this.Z.Ce(t, e, i, s);
|
|
2647
2647
|
}
|
|
2648
2648
|
lineWeight(t) {
|
|
2649
2649
|
this.Z.state.Zt(t);
|
|
2650
2650
|
}
|
|
2651
|
-
background(t, e, i,
|
|
2652
|
-
const
|
|
2653
|
-
this.Z.Te(
|
|
2651
|
+
background(t, e, i, s = 255) {
|
|
2652
|
+
const r = this.na(t, e, i, s);
|
|
2653
|
+
this.Z.Te(r.r, r.g, r.b, r.a);
|
|
2654
2654
|
}
|
|
2655
2655
|
char(t) {
|
|
2656
2656
|
const e = Array.from(t);
|
|
2657
2657
|
if (e.length === 0) throw Error("char() requires at least one character.");
|
|
2658
2658
|
this.Z.state.hs(this.dn.$r(e[0]));
|
|
2659
2659
|
}
|
|
2660
|
-
charColor(t, e, i,
|
|
2661
|
-
const
|
|
2662
|
-
this.Z.state.cs(
|
|
2660
|
+
charColor(t, e, i, s) {
|
|
2661
|
+
const r = this.na(t, e, i, s);
|
|
2662
|
+
this.Z.state.cs(r.r, r.g, r.b, r.a);
|
|
2663
2663
|
}
|
|
2664
|
-
cellColor(t, e, i,
|
|
2665
|
-
const
|
|
2666
|
-
this.Z.state.ls(
|
|
2664
|
+
cellColor(t, e, i, s) {
|
|
2665
|
+
const r = this.na(t, e, i, s);
|
|
2666
|
+
this.Z.state.ls(r.r, r.g, r.b, r.a);
|
|
2667
2667
|
}
|
|
2668
2668
|
flipX(t) {
|
|
2669
2669
|
this.Z.state.us(t);
|
|
@@ -2683,14 +2683,14 @@ const Ze = (n) => class extends n {
|
|
|
2683
2683
|
ellipse(t, e) {
|
|
2684
2684
|
this.Z.xe(t / 2, e / 2);
|
|
2685
2685
|
}
|
|
2686
|
-
triangle(t, e, i,
|
|
2687
|
-
this.Z.Me(t, e, i,
|
|
2686
|
+
triangle(t, e, i, s, r, h) {
|
|
2687
|
+
this.Z.Me(t, e, i, s, r, h);
|
|
2688
2688
|
}
|
|
2689
|
-
bezierCurve(t, e, i,
|
|
2690
|
-
this.Z.Fe(t, e, i,
|
|
2689
|
+
bezierCurve(t, e, i, s, r, h, o, c) {
|
|
2690
|
+
this.Z.Fe(t, e, i, s, r, h, o, c);
|
|
2691
2691
|
}
|
|
2692
|
-
arc(t, e, i,
|
|
2693
|
-
this.Z.$e(t / 2, e / 2, i,
|
|
2692
|
+
arc(t, e, i, s) {
|
|
2693
|
+
this.Z.$e(t / 2, e / 2, i, s);
|
|
2694
2694
|
}
|
|
2695
2695
|
shader(t) {
|
|
2696
2696
|
this.Z.ge(t);
|
|
@@ -2714,257 +2714,256 @@ const Ze = (n) => class extends n {
|
|
|
2714
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
|
-
const
|
|
2718
|
-
this.Z.ye(t, e, i,
|
|
2717
|
+
const s = this.dn ?? this.oa.base.font;
|
|
2718
|
+
this.Z.ye(t, e, i, s), t instanceof Z && this.Z.ct();
|
|
2719
2719
|
}
|
|
2720
2720
|
async loadImage(t) {
|
|
2721
2721
|
if (typeof t != "string")
|
|
2722
2722
|
return z.Tn(this.Z, this.gn, t, this.grid.cols, this.grid.rows);
|
|
2723
|
-
const e = t, i = await new Promise((
|
|
2723
|
+
const e = t, i = await new Promise((s, r) => {
|
|
2724
2724
|
const h = new Image();
|
|
2725
|
-
h.crossOrigin = "anonymous", h.onload = () =>
|
|
2725
|
+
h.crossOrigin = "anonymous", h.onload = () => s(h), h.onerror = (o) => r(o), h.src = e;
|
|
2726
2726
|
});
|
|
2727
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
|
+
}, Ze = (n) => class extends n {
|
|
2733
2733
|
get frameCount() {
|
|
2734
|
-
return this.
|
|
2734
|
+
return this.ha.Kn;
|
|
2735
2735
|
}
|
|
2736
2736
|
set frameCount(t) {
|
|
2737
|
-
this.
|
|
2737
|
+
this.ha.Kn = t;
|
|
2738
2738
|
}
|
|
2739
2739
|
frameRate(t) {
|
|
2740
|
-
return t === void 0 ? this.
|
|
2740
|
+
return t === void 0 ? this.ha.jn : this.ha.Nn(t, () => this.aa());
|
|
2741
2741
|
}
|
|
2742
2742
|
noLoop() {
|
|
2743
|
-
this.
|
|
2743
|
+
this.ha.Gn();
|
|
2744
2744
|
}
|
|
2745
2745
|
loop() {
|
|
2746
|
-
this.
|
|
2746
|
+
this.ha.Qn(() => this.aa());
|
|
2747
2747
|
}
|
|
2748
2748
|
redraw(t = 1) {
|
|
2749
|
-
if (vt.m(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.
|
|
2749
|
+
if (vt.m(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.aa();
|
|
2750
2750
|
}
|
|
2751
2751
|
isLooping() {
|
|
2752
|
-
return this.
|
|
2752
|
+
return this.ha.Yn;
|
|
2753
2753
|
}
|
|
2754
2754
|
}, ze = (n) => class extends n {
|
|
2755
2755
|
constructor(...t) {
|
|
2756
2756
|
super(...t);
|
|
2757
2757
|
}
|
|
2758
2758
|
mouseClicked(t) {
|
|
2759
|
-
this.
|
|
2759
|
+
this.Zo.$o(t);
|
|
2760
2760
|
}
|
|
2761
2761
|
mousePressed(t) {
|
|
2762
|
-
this.
|
|
2762
|
+
this.Zo.Po(t);
|
|
2763
2763
|
}
|
|
2764
2764
|
mouseReleased(t) {
|
|
2765
|
-
this.
|
|
2765
|
+
this.Zo.To(t);
|
|
2766
2766
|
}
|
|
2767
2767
|
mouseMoved(t) {
|
|
2768
|
-
this.
|
|
2768
|
+
this.Zo.Uo(t);
|
|
2769
2769
|
}
|
|
2770
2770
|
mouseScrolled(t) {
|
|
2771
|
-
this.
|
|
2771
|
+
this.Zo.Eo(t);
|
|
2772
2772
|
}
|
|
2773
2773
|
get mouse() {
|
|
2774
|
-
return this.
|
|
2774
|
+
return this.Zo.Ro();
|
|
2775
2775
|
}
|
|
2776
2776
|
cursor(t) {
|
|
2777
|
-
this.
|
|
2777
|
+
this.Zo.mo(t);
|
|
2778
2778
|
}
|
|
2779
2779
|
}, ke = (n) => class extends n {
|
|
2780
2780
|
constructor(...t) {
|
|
2781
2781
|
super(...t);
|
|
2782
2782
|
}
|
|
2783
2783
|
touchStarted(t) {
|
|
2784
|
-
this.
|
|
2784
|
+
this.ca.Ih(t);
|
|
2785
2785
|
}
|
|
2786
2786
|
touchMoved(t) {
|
|
2787
|
-
this.
|
|
2787
|
+
this.ca.Uo(t);
|
|
2788
2788
|
}
|
|
2789
2789
|
touchEnded(t) {
|
|
2790
|
-
this.
|
|
2790
|
+
this.ca.Bh(t);
|
|
2791
2791
|
}
|
|
2792
2792
|
touchCancelled(t) {
|
|
2793
|
-
this.
|
|
2793
|
+
this.ca.Hh(t);
|
|
2794
2794
|
}
|
|
2795
2795
|
tap(t) {
|
|
2796
|
-
this.
|
|
2796
|
+
this.ca.Gh(t);
|
|
2797
2797
|
}
|
|
2798
2798
|
doubleTap(t) {
|
|
2799
|
-
this.
|
|
2799
|
+
this.ca.Qh(t);
|
|
2800
2800
|
}
|
|
2801
2801
|
longPress(t) {
|
|
2802
|
-
this.
|
|
2802
|
+
this.ca.Nh(t);
|
|
2803
2803
|
}
|
|
2804
2804
|
swipe(t) {
|
|
2805
|
-
this.
|
|
2805
|
+
this.ca.Xh(t);
|
|
2806
2806
|
}
|
|
2807
2807
|
pinch(t) {
|
|
2808
|
-
this.
|
|
2808
|
+
this.ca.Yh(t);
|
|
2809
2809
|
}
|
|
2810
2810
|
rotateGesture(t) {
|
|
2811
|
-
this.
|
|
2811
|
+
this.ca.jh(t);
|
|
2812
2812
|
}
|
|
2813
2813
|
get touches() {
|
|
2814
|
-
return this.
|
|
2814
|
+
return this.ca.Oh();
|
|
2815
2815
|
}
|
|
2816
2816
|
}, Ye = (n) => class extends n {
|
|
2817
2817
|
constructor(...t) {
|
|
2818
2818
|
super(...t);
|
|
2819
2819
|
}
|
|
2820
2820
|
keyPressed(t) {
|
|
2821
|
-
this.
|
|
2821
|
+
this.la.Po(t);
|
|
2822
2822
|
}
|
|
2823
2823
|
keyReleased(t) {
|
|
2824
|
-
this.
|
|
2824
|
+
this.la.To(t);
|
|
2825
2825
|
}
|
|
2826
2826
|
isKeyPressed(t) {
|
|
2827
|
-
return this.
|
|
2827
|
+
return this.la.Qo(t);
|
|
2828
2828
|
}
|
|
2829
2829
|
get lastKeyPressed() {
|
|
2830
|
-
return this.
|
|
2830
|
+
return this.la.Xo();
|
|
2831
2831
|
}
|
|
2832
2832
|
get lastKeyReleased() {
|
|
2833
|
-
return this.
|
|
2833
|
+
return this.la.Yo();
|
|
2834
2834
|
}
|
|
2835
2835
|
get pressedKeys() {
|
|
2836
|
-
return this.
|
|
2836
|
+
return this.la.jo();
|
|
2837
2837
|
}
|
|
2838
2838
|
get modifierState() {
|
|
2839
|
-
return this.
|
|
2839
|
+
return this.la.Ko();
|
|
2840
2840
|
}
|
|
2841
2841
|
};
|
|
2842
2842
|
class Ge {
|
|
2843
2843
|
constructor(t) {
|
|
2844
|
-
a(this, "
|
|
2845
|
-
a(this, "
|
|
2846
|
-
a(this, "
|
|
2844
|
+
a(this, "ua");
|
|
2845
|
+
a(this, "fa", /* @__PURE__ */ new Map());
|
|
2846
|
+
a(this, "da", []);
|
|
2847
|
+
a(this, "va", /* @__PURE__ */ new Map());
|
|
2847
2848
|
a(this, "pa", /* @__PURE__ */ new Map());
|
|
2848
|
-
|
|
2849
|
-
this.fa = t;
|
|
2849
|
+
this.ua = t;
|
|
2850
2850
|
}
|
|
2851
|
-
async
|
|
2851
|
+
async ga(t) {
|
|
2852
2852
|
for (const e of t) {
|
|
2853
|
-
if (this.
|
|
2854
|
-
const i = this.
|
|
2853
|
+
if (this.fa.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
|
|
2854
|
+
const i = this.ma(e.name);
|
|
2855
2855
|
try {
|
|
2856
|
-
await e.install(this.
|
|
2857
|
-
} catch (
|
|
2858
|
-
throw this.
|
|
2856
|
+
await e.install(this.ua, i);
|
|
2857
|
+
} catch (s) {
|
|
2858
|
+
throw this._a(e.name), s;
|
|
2859
2859
|
}
|
|
2860
|
-
this.
|
|
2860
|
+
this.fa.set(e.name, e), this.da.push(e.name);
|
|
2861
2861
|
}
|
|
2862
2862
|
}
|
|
2863
|
-
async
|
|
2864
|
-
const e = this.
|
|
2863
|
+
async ya(t) {
|
|
2864
|
+
const e = this.fa.get(t);
|
|
2865
2865
|
if (!e) return;
|
|
2866
|
-
const i = this.
|
|
2867
|
-
e.uninstall && await e.uninstall(this.
|
|
2866
|
+
const i = this.ma(t);
|
|
2867
|
+
e.uninstall && await e.uninstall(this.ua, i), this.fa.delete(t), this.da.splice(this.da.indexOf(t), 1), this._a(t);
|
|
2868
2868
|
}
|
|
2869
|
-
|
|
2870
|
-
this.
|
|
2869
|
+
wa() {
|
|
2870
|
+
this.ba(this.va);
|
|
2871
2871
|
}
|
|
2872
|
-
|
|
2873
|
-
this.
|
|
2872
|
+
Ca() {
|
|
2873
|
+
this.ba(this.pa);
|
|
2874
2874
|
}
|
|
2875
|
-
async
|
|
2876
|
-
const t = [...this.
|
|
2877
|
-
for (const e of t) await this.
|
|
2875
|
+
async xa() {
|
|
2876
|
+
const t = [...this.fa.keys()];
|
|
2877
|
+
for (const e of t) await this.ya(e);
|
|
2878
2878
|
}
|
|
2879
|
-
|
|
2880
|
-
const e = this.
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
s && (s.delete(i), s.size === 0 && t.delete(e));
|
|
2879
|
+
ma(t) {
|
|
2880
|
+
const e = this.ua.layers.base, i = e.drawFramebuffer, s = e.asciiFramebuffer;
|
|
2881
|
+
return { renderer: this.ua.Z, font: e.font, grid: e.grid, canvas: this.ua.kr, drawFramebuffer: i, asciiFramebuffer: s, registerPreDrawHook: (r) => this.Ma(this.va, t, r), registerPostDrawHook: (r) => this.Ma(this.pa, t, r) };
|
|
2882
|
+
}
|
|
2883
|
+
Ma(t, e, i) {
|
|
2884
|
+
const s = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
2885
|
+
return s.add(i), t.set(e, s), () => {
|
|
2886
|
+
const r = t.get(e);
|
|
2887
|
+
r && (r.delete(i), r.size === 0 && t.delete(e));
|
|
2889
2888
|
};
|
|
2890
2889
|
}
|
|
2891
|
-
|
|
2892
|
-
this.
|
|
2890
|
+
_a(t) {
|
|
2891
|
+
this.va.delete(t), this.pa.delete(t);
|
|
2893
2892
|
}
|
|
2894
|
-
|
|
2895
|
-
for (const e of this.
|
|
2893
|
+
ba(t) {
|
|
2894
|
+
for (const e of this.da) {
|
|
2896
2895
|
const i = t.get(e);
|
|
2897
|
-
i && i.forEach((
|
|
2896
|
+
i && i.forEach((s) => s());
|
|
2898
2897
|
}
|
|
2899
2898
|
}
|
|
2900
2899
|
}
|
|
2901
|
-
const
|
|
2902
|
-
in vec2 A0;in vec2 A1;out vec2 v_uv;void main(){v_uv=A1;gl_Position=vec4(A0,0.,1.);}`,
|
|
2900
|
+
const Q = `#version 300 es
|
|
2901
|
+
in vec2 A0;in vec2 A1;out vec2 v_uv;void main(){v_uv=A1;gl_Position=vec4(A0,0.,1.);}`, _t = `#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 Dt {
|
|
2905
2904
|
constructor() {
|
|
2906
|
-
a(this, "
|
|
2907
|
-
a(this, "
|
|
2905
|
+
a(this, "Fa", /* @__PURE__ */ new Map());
|
|
2906
|
+
a(this, "$a", []);
|
|
2907
|
+
a(this, "Pa", 0);
|
|
2908
2908
|
a(this, "Ta", 0);
|
|
2909
|
-
a(this, "Ua", 0);
|
|
2910
2909
|
a(this, "Ea");
|
|
2911
2910
|
}
|
|
2912
2911
|
get Ra() {
|
|
2913
|
-
return this.
|
|
2912
|
+
return this.Pa;
|
|
2914
2913
|
}
|
|
2915
2914
|
get Sa() {
|
|
2916
|
-
if (this.
|
|
2915
|
+
if (this.Pa === 0) return 0;
|
|
2917
2916
|
let t = 0;
|
|
2918
|
-
for (const e of this
|
|
2919
|
-
const i = this
|
|
2917
|
+
for (const e of this.$a) {
|
|
2918
|
+
const i = this.Fa.get(e);
|
|
2920
2919
|
i && (t += Math.min(1, Math.max(0, i.progress)) * i.weight);
|
|
2921
2920
|
}
|
|
2922
|
-
return Math.min(1, t / this.
|
|
2921
|
+
return Math.min(1, t / this.Pa);
|
|
2923
2922
|
}
|
|
2924
2923
|
za(t) {
|
|
2925
2924
|
this.Ea = t;
|
|
2926
2925
|
}
|
|
2927
2926
|
ka(t, e = 1) {
|
|
2928
|
-
const i = `phase-${this.
|
|
2929
|
-
return this
|
|
2927
|
+
const i = `phase-${this.$a.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
|
|
2928
|
+
return this.Fa.set(i, s), this.$a.push(i), this.Pa += s.weight, i;
|
|
2930
2929
|
}
|
|
2931
2930
|
Da(t, e) {
|
|
2932
|
-
const i = this
|
|
2931
|
+
const i = this.Fa.get(t);
|
|
2933
2932
|
if (!i) return;
|
|
2934
2933
|
i.progress = Math.max(0, Math.min(1, e)), i.status = i.progress >= 1 ? "complete" : "running";
|
|
2935
|
-
const
|
|
2936
|
-
Math.abs(
|
|
2934
|
+
const s = this.Sa;
|
|
2935
|
+
Math.abs(s - this.Ta) > 1e-3 && (this.Ta = s, this.Ea && this.Ea(s));
|
|
2937
2936
|
}
|
|
2938
2937
|
La(t) {
|
|
2939
|
-
const e = this
|
|
2938
|
+
const e = this.Fa.get(t);
|
|
2940
2939
|
e && (e.progress = 1, e.status = "complete", this.Da(t, 1));
|
|
2941
2940
|
}
|
|
2942
2941
|
Oa(t) {
|
|
2943
|
-
const e = this
|
|
2942
|
+
const e = this.Fa.get(t);
|
|
2944
2943
|
e && (e.status = "failed");
|
|
2945
2944
|
}
|
|
2946
|
-
|
|
2947
|
-
return this.
|
|
2948
|
-
const e = this
|
|
2945
|
+
Ia() {
|
|
2946
|
+
return this.$a.map((t) => {
|
|
2947
|
+
const e = this.Fa.get(t);
|
|
2949
2948
|
return e ? { id: e.id, label: e.label, weight: e.weight, progress: e.progress, status: e.status } : { id: t, label: t, weight: 1, progress: 0, status: "pending" };
|
|
2950
2949
|
});
|
|
2951
2950
|
}
|
|
2952
2951
|
}
|
|
2953
|
-
class
|
|
2952
|
+
class Ot {
|
|
2954
2953
|
constructor(t = "active") {
|
|
2955
|
-
a(this, "
|
|
2954
|
+
a(this, "Ba");
|
|
2956
2955
|
a(this, "Ha", "");
|
|
2957
2956
|
a(this, "Ga", "");
|
|
2958
|
-
this.
|
|
2957
|
+
this.Ba = t;
|
|
2959
2958
|
}
|
|
2960
2959
|
get Qa() {
|
|
2961
|
-
return this.
|
|
2960
|
+
return this.Ba;
|
|
2962
2961
|
}
|
|
2963
2962
|
get Na() {
|
|
2964
|
-
return this.
|
|
2963
|
+
return this.Ba !== "disabled";
|
|
2965
2964
|
}
|
|
2966
2965
|
get Xa() {
|
|
2967
|
-
return this.
|
|
2966
|
+
return this.Ba === "active" || this.Ba === "transitioning" || this.Ba === "error";
|
|
2968
2967
|
}
|
|
2969
2968
|
get Ya() {
|
|
2970
2969
|
return this.Ha;
|
|
@@ -2973,25 +2972,25 @@ class _t {
|
|
|
2973
2972
|
return this.Ga;
|
|
2974
2973
|
}
|
|
2975
2974
|
Ka() {
|
|
2976
|
-
this.
|
|
2975
|
+
this.Ba !== "done" && this.Ba !== "transitioning" || (this.Ba = "active");
|
|
2977
2976
|
}
|
|
2978
2977
|
Wa() {
|
|
2979
|
-
this.
|
|
2978
|
+
this.Ba !== "disabled" && (this.Ba = "done");
|
|
2980
2979
|
}
|
|
2981
2980
|
Za() {
|
|
2982
|
-
this.
|
|
2981
|
+
this.Ba !== "disabled" && (this.Ba = "transitioning");
|
|
2983
2982
|
}
|
|
2984
2983
|
qa() {
|
|
2985
|
-
this.
|
|
2984
|
+
this.Ba === "transitioning" && (this.Ba = "done");
|
|
2986
2985
|
}
|
|
2987
2986
|
Va(t) {
|
|
2988
|
-
this.
|
|
2987
|
+
this.Ba !== "disabled" && (this.Ba = "error", t instanceof Error ? (this.Ha = t.message, this.Ga = t.stack || "") : (this.Ha = t, this.Ga = ""));
|
|
2989
2988
|
}
|
|
2990
2989
|
Ja() {
|
|
2991
|
-
this.
|
|
2990
|
+
this.Ba = "disabled";
|
|
2992
2991
|
}
|
|
2993
2992
|
}
|
|
2994
|
-
class
|
|
2993
|
+
class It {
|
|
2995
2994
|
constructor(t, e) {
|
|
2996
2995
|
a(this, "tc", 0);
|
|
2997
2996
|
a(this, "sc", 1);
|
|
@@ -3005,7 +3004,7 @@ class Ot {
|
|
|
3005
3004
|
get oc() {
|
|
3006
3005
|
return this.sc < 1;
|
|
3007
3006
|
}
|
|
3008
|
-
|
|
3007
|
+
Bn() {
|
|
3009
3008
|
this.ec !== "none" && this.rc > 0 && (this.tc = performance.now());
|
|
3010
3009
|
}
|
|
3011
3010
|
et() {
|
|
@@ -3020,16 +3019,16 @@ class Ot {
|
|
|
3020
3019
|
function gt(n, t) {
|
|
3021
3020
|
const e = n.tone ?? "auto";
|
|
3022
3021
|
let i = "dark";
|
|
3023
|
-
return e === "light" || e === "dark" ? i = e : t && (i = function(
|
|
3024
|
-
if (!
|
|
3025
|
-
const [
|
|
3026
|
-
return 0.2126 * c(
|
|
3022
|
+
return e === "light" || e === "dark" ? i = e : t && (i = function(s) {
|
|
3023
|
+
if (!s) return 0;
|
|
3024
|
+
const [r, h, o] = s.map((l) => l / 255), c = (l) => l <= 0.04045 ? l / 12.92 : Math.pow((l + 0.055) / 1.055, 2.4);
|
|
3025
|
+
return 0.2126 * c(r) + 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 Xt(n) {
|
|
3030
3029
|
return n.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
|
|
3031
3030
|
}
|
|
3032
|
-
function
|
|
3031
|
+
function Zt(n, t) {
|
|
3033
3032
|
return n.length ? n.map((e) => t.color(e)) : [t.color("#FFFFFF")];
|
|
3034
3033
|
}
|
|
3035
3034
|
class zt {
|
|
@@ -3054,46 +3053,46 @@ class zt {
|
|
|
3054
3053
|
}
|
|
3055
3054
|
}
|
|
3056
3055
|
}
|
|
3057
|
-
const He = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message:
|
|
3056
|
+
const He = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: o, transitionOpacity: c, isError: l, errorMessage: u }) => {
|
|
3058
3057
|
const f = "|/-\\", d = Math.floor(i / 6) % 4, g = n.color(h.textColor), p = Math.floor(255 * c), v = n.color(g.r, g.g, g.b, p);
|
|
3059
3058
|
if (n.charColor(v), n.cellColor(0, 0, 0, 0), l) {
|
|
3060
|
-
const
|
|
3061
|
-
n.charColor(
|
|
3062
|
-
const
|
|
3059
|
+
const m = n.color(h.mode === "light" ? "#D32F2F" : "#FF6B6B", p);
|
|
3060
|
+
n.charColor(m), n.push(), n.translate(0, -2, 0), n.char("X"), n.rect(1, 1), n.pop();
|
|
3061
|
+
const A = "SETUP ERROR", b = -Math.floor(A.length / 2);
|
|
3063
3062
|
n.push(), n.translate(b, 0, 0);
|
|
3064
|
-
for (const y of
|
|
3063
|
+
for (const y of A) n.char(y), n.rect(1, 1), n.translateX(1);
|
|
3065
3064
|
if (n.pop(), u) {
|
|
3066
3065
|
const y = n.color(h.subtleColor), x = n.color(y.r, y.g, y.b, p);
|
|
3067
3066
|
n.charColor(x);
|
|
3068
|
-
const E = Math.floor(0.8 * t.cols),
|
|
3067
|
+
const E = Math.floor(0.8 * t.cols), F = u.split(" "), P = [];
|
|
3069
3068
|
let T = "";
|
|
3070
|
-
for (const
|
|
3069
|
+
for (const C of F) (T + " " + C).length <= E ? T = T ? T + " " + C : C : (T && P.push(T), T = C);
|
|
3071
3070
|
T && P.push(T);
|
|
3072
3071
|
const L = P.slice(0, 3);
|
|
3073
|
-
P.length > 3 && (L[2] = L[2].substring(0, E - 3) + "..."), L.forEach((
|
|
3074
|
-
const
|
|
3075
|
-
n.push(), n.translate(
|
|
3076
|
-
for (const
|
|
3072
|
+
P.length > 3 && (L[2] = L[2].substring(0, E - 3) + "..."), L.forEach((C, K) => {
|
|
3073
|
+
const Qt = -Math.floor(C.length / 2);
|
|
3074
|
+
n.push(), n.translate(Qt, 3 + K, 0);
|
|
3075
|
+
for (const Kt of C) n.char(Kt), n.rect(1, 1), n.translateX(1);
|
|
3077
3076
|
n.pop();
|
|
3078
3077
|
});
|
|
3079
3078
|
}
|
|
3080
3079
|
return;
|
|
3081
3080
|
}
|
|
3082
|
-
if (n.push(), n.translate(0, 0, 0), n.char(f[d]), n.rect(1, 1), n.pop(), e > 0 || o.some((
|
|
3083
|
-
const
|
|
3084
|
-
n.push(), n.translate(
|
|
3085
|
-
for (let x = 0; x <
|
|
3086
|
-
const E = x < b ? "*" : ".",
|
|
3081
|
+
if (n.push(), n.translate(0, 0, 0), n.char(f[d]), n.rect(1, 1), n.pop(), e > 0 || o.some((m) => m.status !== "pending")) {
|
|
3082
|
+
const m = Math.max(6, Math.floor(0.6 * t.cols)), A = -Math.floor(m / 2), b = Math.floor(m * e), y = r.length ? r : [n.color("#FFFFFF")];
|
|
3083
|
+
n.push(), n.translate(A, 3, 0);
|
|
3084
|
+
for (let x = 0; x < m; x++) {
|
|
3085
|
+
const E = x < b ? "*" : ".", F = y[x % y.length], P = n.color(F.r, F.g, F.b, p);
|
|
3087
3086
|
n.charColor(P), n.char(E), n.rect(1, 1), n.translateX(1);
|
|
3088
3087
|
}
|
|
3089
3088
|
n.pop();
|
|
3090
3089
|
}
|
|
3091
|
-
if (
|
|
3092
|
-
const
|
|
3093
|
-
n.charColor(
|
|
3094
|
-
const b = -Math.floor(
|
|
3090
|
+
if (s) {
|
|
3091
|
+
const m = n.color(h.subtleColor), A = n.color(m.r, m.g, m.b, p);
|
|
3092
|
+
n.charColor(A);
|
|
3093
|
+
const b = -Math.floor(s.length / 2);
|
|
3095
3094
|
n.push(), n.translate(b, 5, 0);
|
|
3096
|
-
for (const y of
|
|
3095
|
+
for (const y of s) n.char(y), n.rect(1, 1), n.translateX(1);
|
|
3097
3096
|
n.pop();
|
|
3098
3097
|
}
|
|
3099
3098
|
};
|
|
@@ -3117,7 +3116,7 @@ class it {
|
|
|
3117
3116
|
a(this, "Cc", null);
|
|
3118
3117
|
a(this, "xc", !1);
|
|
3119
3118
|
a(this, "Mc", []);
|
|
3120
|
-
this.ac = e.visible ?? !0, this.nc = e.opacity ?? 1, this.cc = e.blendMode ?? "normal", this.lc = e.offsetX ?? 0, this.uc = e.offsetY ?? 0, this.fc = e.
|
|
3119
|
+
this.ac = e.visible ?? !0, this.nc = e.opacity ?? 1, this.cc = e.blendMode ?? "normal", this.lc = e.offsetX ?? 0, this.uc = e.offsetY ?? 0, this.fc = e.rotationZ ?? 0, this.dc = e.fontSize ?? 16, this.vc = e.fontSource, e.fontSource instanceof et ? this.nr = e.fontSource : this.nr = new et(t, this.dc);
|
|
3121
3120
|
}
|
|
3122
3121
|
async Fc(t) {
|
|
3123
3122
|
this.gc = t, this.nr.Tr || await this.nr.wr(this.vc);
|
|
@@ -3125,8 +3124,8 @@ class it {
|
|
|
3125
3124
|
this.mc = new Le(this.gc.canvas.canvas, e.width, e.height);
|
|
3126
3125
|
const i = this.mc;
|
|
3127
3126
|
this._c = this.gc.createFramebuffer(i.cols, i.rows, 3), this.yc = this.gc.createFramebuffer(i.width, i.height, 1), this.wc = this.gc.createFramebuffer(i.width, i.height, 1), this.bc = [this.gc.createFramebuffer(i.width, i.height, 1, { depth: !1 }), this.gc.createFramebuffer(i.width, i.height, 1, { depth: !1 })], this.xc = !1, this.mc.Hr(() => {
|
|
3128
|
-
var
|
|
3129
|
-
this._c.resize(this.mc.cols, this.mc.rows), this.yc.resize(this.mc.width, this.mc.height), (
|
|
3127
|
+
var s, r, h;
|
|
3128
|
+
this._c.resize(this.mc.cols, this.mc.rows), this.yc.resize(this.mc.width, this.mc.height), (s = this.wc) == null || s.resize(this.mc.width, this.mc.height), (r = this.bc) == null || r[0].resize(this.mc.width, this.mc.height), (h = this.bc) == null || h[1].resize(this.mc.width, this.mc.height);
|
|
3130
3129
|
});
|
|
3131
3130
|
}
|
|
3132
3131
|
$c() {
|
|
@@ -3171,30 +3170,30 @@ class it {
|
|
|
3171
3170
|
if (!this.nr) throw Error("Layer font not initialized. Ensure layer is attached before loading fonts.");
|
|
3172
3171
|
return t instanceof et ? (this.nr = t, this.nr.Tr || await this.nr.wr()) : await this.nr.Fr(t), this.Tc(), this.nr;
|
|
3173
3172
|
}
|
|
3174
|
-
|
|
3175
|
-
const
|
|
3173
|
+
aa(t, e, i) {
|
|
3174
|
+
const s = i == null ? void 0 : i.fallbackDraw;
|
|
3176
3175
|
if (!this.ac) return void (this.xc = !1);
|
|
3177
|
-
if (!this.Cc && !
|
|
3178
|
-
const
|
|
3179
|
-
this._c.begin(),
|
|
3176
|
+
if (!this.Cc && !s) return void (this.xc = !1);
|
|
3177
|
+
const r = this.gc.renderer;
|
|
3178
|
+
this._c.begin(), r.state.qt(), t.dn = this.nr, t.Ec = this.mc;
|
|
3180
3179
|
try {
|
|
3181
|
-
this.Cc ? this.Cc.call(t) :
|
|
3180
|
+
this.Cc ? this.Cc.call(t) : s == null || s();
|
|
3182
3181
|
} finally {
|
|
3183
|
-
t.dn = void 0, t.
|
|
3182
|
+
t.dn = void 0, t.Ec = 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(),
|
|
3186
|
+
o.begin(), r.ve(e);
|
|
3188
3187
|
const c = this.mc;
|
|
3189
|
-
e.O({ u_characterTexture: this.nr.fontFramebuffer, u_charsetDimensions: [this.nr.textureColumns, this.nr.textureRows],
|
|
3188
|
+
e.O({ u_characterTexture: this.nr.fontFramebuffer, u_charsetDimensions: [this.nr.textureColumns, this.nr.textureRows], Ug: this._c.textures[0], Uh: this._c.textures[1], Ui: this._c.textures[2], Uj: [c.cols, c.rows], Uk: [o.width, o.height], Ul: [0, 0, 0, 0] }), r.we(0, 0, c.width, c.height), o.end(), h && this.gc.filterManager.Rc(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
3192
|
this._c && this.yc && ((t = this.mc) == null || t.ti());
|
|
3194
3193
|
}
|
|
3195
3194
|
gt() {
|
|
3196
|
-
var t, e, i,
|
|
3197
|
-
(t = this._c) == null || t.gt(), (e = this.yc) == null || e.gt(), (i = this.wc) == null || i.gt(), (
|
|
3195
|
+
var t, e, i, s, r, h, o;
|
|
3196
|
+
(t = this._c) == null || t.gt(), (e = this.yc) == null || e.gt(), (i = this.wc) == null || i.gt(), (s = this.bc) == null || s[0].gt(), (r = this.bc) == null || r[1].gt(), (h = this.nr) == null || h.gt(), (o = this.mc) == null || o.gt();
|
|
3198
3197
|
}
|
|
3199
3198
|
get texture() {
|
|
3200
3199
|
var t;
|
|
@@ -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 Sc() {
|
|
3217
3216
|
return this.xc;
|
|
3218
3217
|
}
|
|
3219
3218
|
get drawFramebuffer() {
|
|
@@ -3231,46 +3230,46 @@ class it {
|
|
|
3231
3230
|
const We = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
|
|
3232
3231
|
class kt {
|
|
3233
3232
|
constructor(t, e, i) {
|
|
3234
|
-
a(this, "
|
|
3233
|
+
a(this, "ua");
|
|
3235
3234
|
a(this, "l");
|
|
3236
|
-
a(this, "Sc");
|
|
3237
|
-
a(this, "hc");
|
|
3238
3235
|
a(this, "zc");
|
|
3236
|
+
a(this, "hc");
|
|
3239
3237
|
a(this, "kc");
|
|
3240
3238
|
a(this, "Dc");
|
|
3241
3239
|
a(this, "Lc");
|
|
3242
|
-
a(this, "Oc"
|
|
3240
|
+
a(this, "Oc");
|
|
3241
|
+
a(this, "Ic", []);
|
|
3243
3242
|
a(this, "Bc");
|
|
3244
|
-
a(this, "
|
|
3245
|
-
a(this, "
|
|
3246
|
-
a(this, "
|
|
3243
|
+
a(this, "Hc", performance.now());
|
|
3244
|
+
a(this, "Gc", 0);
|
|
3245
|
+
a(this, "Qc", !1);
|
|
3247
3246
|
a(this, "Ar", !1);
|
|
3248
|
-
a(this, "
|
|
3249
|
-
this.
|
|
3250
|
-
const
|
|
3251
|
-
this.
|
|
3252
|
-
|
|
3247
|
+
a(this, "Kc");
|
|
3248
|
+
this.ua = t, this.l = { ...We, ...e ?? {} }, this.zc = new Ot("active"), this.hc = new Dt(), this.kc = new It(this.l.transition, this.l.transitionDuration), this.Dc = new Ut(60), this.Bc = gt(this.l, i);
|
|
3249
|
+
const s = Xt(this.Bc);
|
|
3250
|
+
this.Ic = Zt(s, this.ua), this.Oc = this.Nc(), this.hc.za((r) => {
|
|
3251
|
+
r >= 0.999 && this.Wa();
|
|
3253
3252
|
});
|
|
3254
3253
|
}
|
|
3255
3254
|
async wr() {
|
|
3256
3255
|
if (this.Ar) return;
|
|
3257
|
-
const t = this.
|
|
3258
|
-
this.
|
|
3256
|
+
const t = this.ua.Z, e = this.ua.kr, i = this.ua.Xc;
|
|
3257
|
+
this.Lc = new it(t, { visible: !0, opacity: 1, fontSize: 16 }), await this.Lc.Fc({ renderer: t, canvas: e, filterManager: i, createFramebuffer: (s, r, h = 1, o) => t.Pe(s, r, h, o) }), this.Ar = !0;
|
|
3259
3258
|
}
|
|
3260
3259
|
get Xa() {
|
|
3261
|
-
return this.
|
|
3260
|
+
return this.zc.Xa && this.Qc;
|
|
3262
3261
|
}
|
|
3263
|
-
|
|
3264
|
-
this.
|
|
3262
|
+
Bn() {
|
|
3263
|
+
this.Qc || (this.Qc = !0, this.Hc = performance.now(), this.Gc = 0, this.Dc.Bn(() => this.Yc()));
|
|
3265
3264
|
}
|
|
3266
3265
|
Hn() {
|
|
3267
|
-
this.
|
|
3266
|
+
this.Qc && (this.Qc = !1, this.Dc.Hn());
|
|
3268
3267
|
}
|
|
3269
3268
|
Jr() {
|
|
3270
|
-
this.Ar && this.
|
|
3269
|
+
this.Ar && this.Lc.Jr();
|
|
3271
3270
|
}
|
|
3272
3271
|
gt() {
|
|
3273
|
-
this.Hn(), this.Ar && (this.
|
|
3272
|
+
this.Hn(), this.Ar && (this.Lc.gt(), this.Ar = !1);
|
|
3274
3273
|
}
|
|
3275
3274
|
get progress() {
|
|
3276
3275
|
return this.hc.Sa;
|
|
@@ -3279,57 +3278,57 @@ class kt {
|
|
|
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.zc.Ka();
|
|
3283
3282
|
const i = this.hc.ka(t, e);
|
|
3284
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.zc.Za(), this.kc.Bn()) : (this.zc.Wa(), this.Hn(), this.jc());
|
|
3288
3287
|
}
|
|
3289
|
-
|
|
3290
|
-
this.
|
|
3288
|
+
jc() {
|
|
3289
|
+
this.Kc && this.Kc();
|
|
3291
3290
|
}
|
|
3292
|
-
|
|
3293
|
-
this.
|
|
3291
|
+
Wc(t) {
|
|
3292
|
+
this.Kc = t;
|
|
3294
3293
|
}
|
|
3295
3294
|
error(t) {
|
|
3296
|
-
this.
|
|
3295
|
+
this.zc.Va(t);
|
|
3297
3296
|
}
|
|
3298
|
-
|
|
3299
|
-
if (this.
|
|
3300
|
-
if (this.
|
|
3301
|
-
return this.
|
|
3302
|
-
this.
|
|
3297
|
+
Yc() {
|
|
3298
|
+
if (this.zc.Xa) {
|
|
3299
|
+
if (this.Gc++, this.zc.Qa === "transitioning" && this.kc.et())
|
|
3300
|
+
return this.zc.qa(), this.jc(), void this.Hn();
|
|
3301
|
+
this.Zc();
|
|
3303
3302
|
}
|
|
3304
3303
|
}
|
|
3305
|
-
|
|
3304
|
+
Zc() {
|
|
3306
3305
|
if (!this.Ar) return;
|
|
3307
|
-
const t = this.
|
|
3306
|
+
const t = this.Lc, e = t.grid, i = this.ua.Z, s = this.ua.qc, r = this.ua.Vc, h = { textmodifier: this.ua, grid: e, progress: this.progress, elapsedMs: performance.now() - this.Hc, frameCount: this.Gc, message: this.l.message, palette: this.Ic, theme: this.Bc, phases: this.hc.Ia(), transitionOpacity: this.kc.nc, isError: this.zc.Qa === "error", errorMessage: this.zc.Ya || void 0, errorDetails: this.zc.ja || void 0 };
|
|
3308
3307
|
t.draw(() => {
|
|
3309
|
-
this.
|
|
3308
|
+
this.ua.clear(), this.ua.push();
|
|
3310
3309
|
try {
|
|
3311
|
-
this.
|
|
3310
|
+
this.Oc(h);
|
|
3312
3311
|
} finally {
|
|
3313
|
-
this.
|
|
3312
|
+
this.ua.pop();
|
|
3314
3313
|
}
|
|
3315
|
-
}), t.
|
|
3314
|
+
}), t.aa(this.ua, s);
|
|
3316
3315
|
const o = t.texture;
|
|
3317
|
-
o && (i.wi(...i.state.canvasBackgroundColor), i.ve(
|
|
3316
|
+
o && (i.wi(...i.state.canvasBackgroundColor), i.ve(r), r.O({ u_texture: o }), i.we(e.offsetX, e.offsetY, e.width, e.height));
|
|
3318
3317
|
}
|
|
3319
|
-
|
|
3318
|
+
Jc(t) {
|
|
3320
3319
|
this.Bc = gt(this.l, t);
|
|
3321
3320
|
}
|
|
3322
|
-
|
|
3321
|
+
Nc() {
|
|
3323
3322
|
const t = this.l.renderer || He;
|
|
3324
3323
|
return (e) => {
|
|
3325
|
-
t(e), this.
|
|
3324
|
+
t(e), this.tl(e);
|
|
3326
3325
|
};
|
|
3327
3326
|
}
|
|
3328
|
-
|
|
3329
|
-
const { textmodifier: e, grid: i, frameCount:
|
|
3327
|
+
tl(t) {
|
|
3328
|
+
const { textmodifier: e, grid: i, frameCount: s, theme: r, 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 = r.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++) {
|
|
3332
|
-
const d = o[f], g = Math.floor(0.1 *
|
|
3331
|
+
const d = o[f], g = Math.floor(0.1 * s + 0.5 * f) % u.length, [p, v, m] = u[g], A = Math.floor(255 * h), b = e.color(p, v, m, A);
|
|
3333
3332
|
e.charColor(b), e.char(d), e.point(), e.translateX(1);
|
|
3334
3333
|
}
|
|
3335
3334
|
e.pop();
|
|
@@ -3339,150 +3338,150 @@ 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, "sl");
|
|
3343
3342
|
a(this, "bc");
|
|
3344
|
-
a(this, "
|
|
3345
|
-
this.Z = t, this.
|
|
3346
|
-
precision highp float;uniform sampler2D
|
|
3343
|
+
a(this, "il", 0);
|
|
3344
|
+
this.Z = t, this.sl = t.pe(Q, `#version 300 es
|
|
3345
|
+
precision highp float;uniform sampler2D U8;uniform sampler2D U9;uniform vec2 Ua;uniform vec2 Ub;uniform vec2 Uc;uniform float Ud;uniform float Ue;uniform int Uf;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(U9,v_uv);vec2 h=v_uv*Ua;vec2 i=h-Uc;vec2 j=Ub*0.5;vec2 k=i-j;float l=cos(-Ue);float m=sin(-Ue);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,Ub));if(o){fragColor=g;return;}vec2 p=(floor(i)+0.5)/Ub;vec4 q=texture(U8,p);float r=q.a*Ud;if(r<=0.){fragColor=g;return;}vec3 s=e(Uf,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
|
-
|
|
3349
|
-
const e = this.Z.context, { base: i, targetFramebuffer:
|
|
3347
|
+
el(t) {
|
|
3348
|
+
const e = this.Z.context, { base: i, targetFramebuffer: s, backgroundColor: r, 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.wi(...
|
|
3351
|
+
f.begin(), this.Z.wi(...r), f.end(), this.il = 0, i.layer.ac && this.rl(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.Sc && this.rl(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.nl(s, o, c, e), e.depthMask(u), l && e.enable(e.DEPTH_TEST);
|
|
3358
3357
|
}
|
|
3359
|
-
|
|
3360
|
-
const d = this.bc[this.
|
|
3361
|
-
p.begin(), f.disable(f.BLEND), this.Z.ve(this.
|
|
3358
|
+
rl(t, e, i, s, r, h, o, c, l, u, f) {
|
|
3359
|
+
const d = this.bc[this.il], g = this.il === 0 ? 1 : 0, p = this.bc[g], v = l * (Math.PI / 180);
|
|
3360
|
+
p.begin(), f.disable(f.BLEND), this.Z.ve(this.sl), this.sl.O({ U8: t, U9: d.textures[0], Ua: [e, i], Ub: [s, r], Uc: [o, c], Ud: h, Ue: v, Uf: wt[u] }), this.Z.we(0, 0, d.width, d.height), p.end(), this.il = g;
|
|
3362
3361
|
}
|
|
3363
|
-
|
|
3364
|
-
const
|
|
3365
|
-
t.begin(),
|
|
3362
|
+
nl(t, e, i, s) {
|
|
3363
|
+
const r = this.bc[this.il];
|
|
3364
|
+
t.begin(), s.disable(s.BLEND), this.Z.ve(this.sl), this.sl.O({ U8: r.textures[0], U9: r.textures[0], Ua: [e, i], Ub: [r.width, r.height], Uc: [0, 0], Ud: 1, Ue: 0, Uf: 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.sl.dispose(), this.bc[0].gt(), this.bc[1].gt();
|
|
3372
3371
|
}
|
|
3373
3372
|
}
|
|
3374
3373
|
class Gt {
|
|
3375
3374
|
constructor(t, e) {
|
|
3376
|
-
a(this, "
|
|
3375
|
+
a(this, "ua");
|
|
3377
3376
|
a(this, "Z");
|
|
3378
|
-
a(this, "nl");
|
|
3379
3377
|
a(this, "ol");
|
|
3380
|
-
a(this, "hl"
|
|
3378
|
+
a(this, "hl");
|
|
3381
3379
|
a(this, "al", []);
|
|
3382
|
-
a(this, "cl");
|
|
3383
|
-
a(this, "ll"
|
|
3384
|
-
a(this, "ul",
|
|
3385
|
-
|
|
3380
|
+
a(this, "cl", []);
|
|
3381
|
+
a(this, "ll");
|
|
3382
|
+
a(this, "ul", !1);
|
|
3383
|
+
a(this, "fl", /* @__PURE__ */ new Set());
|
|
3384
|
+
this.ua = t, this.Z = t.Z, this.ol = t.qc, this.hl = new Yt(this.Z, this.ua.kr.width, this.ua.kr.height), this.ll = 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.ul) {
|
|
3388
|
+
await this.dl(this.ll);
|
|
3389
|
+
for (const t of this.al) await this.dl(t), this.cl.push(t);
|
|
3390
|
+
this.al = [], this.ul = !0;
|
|
3392
3391
|
}
|
|
3393
3392
|
}
|
|
3394
3393
|
add(t = {}) {
|
|
3395
3394
|
const e = new it(this.Z, t);
|
|
3396
|
-
return this.
|
|
3395
|
+
return this.ul ? (this.dl(e), this.cl.push(e)) : this.al.push(e), e;
|
|
3397
3396
|
}
|
|
3398
3397
|
remove(t) {
|
|
3399
|
-
this.
|
|
3398
|
+
this.vl(this.cl, t) || this.vl(this.al, t);
|
|
3400
3399
|
}
|
|
3401
3400
|
move(t, e) {
|
|
3402
|
-
this.
|
|
3401
|
+
this.pl(this.cl, t, e) || this.pl(this.al, t, e);
|
|
3403
3402
|
}
|
|
3404
3403
|
swap(t, e) {
|
|
3405
|
-
t !== e && (this.
|
|
3404
|
+
t !== e && (this.ml(this.cl, t, e) || this.ml(this.al, t, e));
|
|
3406
3405
|
}
|
|
3407
3406
|
clear() {
|
|
3408
|
-
this.
|
|
3407
|
+
this.ll.gt(), this.cl.forEach((t) => t.gt()), this.cl = [], this.al.forEach((t) => t.gt()), this.al = [];
|
|
3409
3408
|
}
|
|
3410
|
-
|
|
3411
|
-
this.
|
|
3409
|
+
_l(t, e) {
|
|
3410
|
+
this.ll.aa(this.ua, this.ol, { fallbackDraw: e });
|
|
3412
3411
|
const i = [...this.Z.state.canvasBackgroundColor];
|
|
3413
|
-
this.
|
|
3412
|
+
this.yl(), this.Al(t, i);
|
|
3414
3413
|
}
|
|
3415
|
-
|
|
3416
|
-
this.
|
|
3414
|
+
yl() {
|
|
3415
|
+
this.cl.length !== 0 && this.cl.forEach((t) => t.aa(this.ua, this.ol));
|
|
3417
3416
|
}
|
|
3418
|
-
|
|
3419
|
-
const i = this.
|
|
3420
|
-
if (!
|
|
3421
|
-
const h = { layer: this.
|
|
3417
|
+
Al(t, e) {
|
|
3418
|
+
const i = this.ua.kr, s = this.ll.grid, r = this.ll.texture;
|
|
3419
|
+
if (!r) return;
|
|
3420
|
+
const h = { layer: this.ll, texture: r, width: s.width, height: s.height, offsetX: s.offsetX + this.ll.lc, offsetY: s.offsetY + this.ll.uc }, o = this.cl.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.hl.el({ base: h, layers: o, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
|
|
3426
3425
|
}
|
|
3427
3426
|
Jr() {
|
|
3428
|
-
this.
|
|
3427
|
+
this.ul && (this.ll.Jr(), this.cl.forEach((t) => t.Jr()), this.hl.Jr(this.ua.kr.width, this.ua.kr.height));
|
|
3429
3428
|
}
|
|
3430
3429
|
gt() {
|
|
3431
|
-
this.
|
|
3430
|
+
this.cl.forEach((t) => t.gt()), this.al.forEach((t) => t.gt()), this.ll.gt(), this.hl.gt();
|
|
3432
3431
|
}
|
|
3433
3432
|
get all() {
|
|
3434
|
-
return this.
|
|
3433
|
+
return this.cl;
|
|
3435
3434
|
}
|
|
3436
3435
|
get base() {
|
|
3437
|
-
return this.
|
|
3436
|
+
return this.ll;
|
|
3438
3437
|
}
|
|
3439
|
-
|
|
3440
|
-
for (let t = this.
|
|
3441
|
-
const e = this.
|
|
3438
|
+
wl() {
|
|
3439
|
+
for (let t = this.cl.length - 1; t >= 0; t--) {
|
|
3440
|
+
const e = this.cl[t];
|
|
3442
3441
|
if (e.ac && e.grid) return e.grid;
|
|
3443
3442
|
}
|
|
3444
|
-
return this.
|
|
3443
|
+
return this.ll.grid;
|
|
3445
3444
|
}
|
|
3446
|
-
|
|
3447
|
-
this.
|
|
3445
|
+
bl(t) {
|
|
3446
|
+
this.fl.add(t);
|
|
3448
3447
|
}
|
|
3449
|
-
|
|
3450
|
-
for (const t of this.
|
|
3448
|
+
Cl() {
|
|
3449
|
+
for (const t of this.fl) t();
|
|
3451
3450
|
}
|
|
3452
|
-
async
|
|
3451
|
+
async dl(t) {
|
|
3453
3452
|
var i;
|
|
3454
|
-
const e = { renderer: this.Z, canvas: this.
|
|
3455
|
-
await t.Fc(e), (i = t.grid) == null || i.Hr(() => this.
|
|
3453
|
+
const e = { renderer: this.Z, canvas: this.ua.kr, filterManager: this.ua.Xc, createFramebuffer: (s, r, h = 1, o) => this.Z.Pe(s, r, h, o) };
|
|
3454
|
+
await t.Fc(e), (i = t.grid) == null || i.Hr(() => this.Cl());
|
|
3456
3455
|
}
|
|
3457
|
-
|
|
3456
|
+
vl(t, e) {
|
|
3458
3457
|
const i = t.indexOf(e);
|
|
3459
3458
|
if (i === -1) return !1;
|
|
3460
|
-
const [
|
|
3461
|
-
return
|
|
3462
|
-
}
|
|
3463
|
-
vl(t, e, i) {
|
|
3464
|
-
const r = t.indexOf(e);
|
|
3465
|
-
if (r === -1) return !1;
|
|
3466
|
-
t.splice(r, 1);
|
|
3467
|
-
const s = Math.max(0, Math.min(t.length, i));
|
|
3468
|
-
return t.splice(s, 0, e), !0;
|
|
3459
|
+
const [s] = t.splice(i, 1);
|
|
3460
|
+
return s.gt(), !0;
|
|
3469
3461
|
}
|
|
3470
3462
|
pl(t, e, i) {
|
|
3471
|
-
const
|
|
3472
|
-
if (
|
|
3473
|
-
|
|
3474
|
-
|
|
3463
|
+
const s = t.indexOf(e);
|
|
3464
|
+
if (s === -1) return !1;
|
|
3465
|
+
t.splice(s, 1);
|
|
3466
|
+
const r = Math.max(0, Math.min(t.length, i));
|
|
3467
|
+
return t.splice(r, 0, e), !0;
|
|
3468
|
+
}
|
|
3469
|
+
ml(t, e, i) {
|
|
3470
|
+
const s = t.indexOf(e);
|
|
3471
|
+
if (s === -1) return !1;
|
|
3472
|
+
const r = t.indexOf(i);
|
|
3473
|
+
return r !== -1 && (t[s] = i, t[r] = e, !0);
|
|
3475
3474
|
}
|
|
3476
3475
|
}
|
|
3477
3476
|
class Ht {
|
|
3478
3477
|
constructor(t) {
|
|
3479
3478
|
a(this, "Z");
|
|
3480
|
-
a(this, "
|
|
3481
|
-
a(this, "
|
|
3482
|
-
this.Z = t, this.
|
|
3479
|
+
a(this, "xl", /* @__PURE__ */ new Map());
|
|
3480
|
+
a(this, "Ml", /* @__PURE__ */ new Map());
|
|
3481
|
+
this.Z = t, this.Fl();
|
|
3483
3482
|
}
|
|
3484
|
-
async
|
|
3485
|
-
const
|
|
3483
|
+
async $l(t, e, i = {}) {
|
|
3484
|
+
const s = Object.entries(i), r = s.length > 0 ? s[0][1][0] : null;
|
|
3486
3485
|
let h;
|
|
3487
3486
|
if (typeof e == "string") {
|
|
3488
3487
|
let c = e;
|
|
@@ -3491,265 +3490,272 @@ 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.pe(
|
|
3495
|
-
} else h = e, this.
|
|
3493
|
+
h = this.Z.pe(Q, c), this.Ml.set(t, h);
|
|
3494
|
+
} else h = e, this.Ml.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
|
-
for (const [f, [d, g]] of
|
|
3497
|
+
for (const [f, [d, g]] of s) {
|
|
3499
3498
|
let p = g;
|
|
3500
|
-
c != null && (typeof c == "number" && d ===
|
|
3499
|
+
c != null && (typeof c == "number" && d === r ? p = c : typeof c == "object" && d in c && (p = c[d] ?? g)), u[f] = p;
|
|
3501
3500
|
}
|
|
3502
3501
|
return u;
|
|
3503
3502
|
} };
|
|
3504
|
-
this.
|
|
3503
|
+
this.xl.set(t, o);
|
|
3505
3504
|
}
|
|
3506
|
-
|
|
3507
|
-
const e = this.
|
|
3508
|
-
return e && (e.dispose(), this.
|
|
3505
|
+
Pl(t) {
|
|
3506
|
+
const e = this.Ml.get(t);
|
|
3507
|
+
return e && (e.dispose(), this.Ml.delete(t)), this.xl.delete(t);
|
|
3509
3508
|
}
|
|
3510
3509
|
Pn(t) {
|
|
3511
|
-
return this.
|
|
3510
|
+
return this.xl.get(t);
|
|
3512
3511
|
}
|
|
3513
3512
|
gt() {
|
|
3514
|
-
for (const t of this.
|
|
3515
|
-
this.
|
|
3513
|
+
for (const t of this.Ml.values()) t.dispose();
|
|
3514
|
+
this.Ml.clear(), this.xl.clear();
|
|
3516
3515
|
}
|
|
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
|
|
3521
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3522
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3516
|
+
Fl() {
|
|
3517
|
+
this.$l("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.$l("grayscale", `#version 300 es
|
|
3519
|
+
precision highp float;uniform sampler2D u_texture;uniform float Um;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));vec3 C=mix(A.rgb,vec3(B),Um);fragColor=vec4(C,A.a);}`, { Um: ["amount", 1] }), this.$l("sepia", `#version 300 es
|
|
3520
|
+
precision highp float;uniform sampler2D u_texture;uniform float Um;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);vec3 B;B.r=dot(A.rgb,vec3(0.393,0.769,0.189));B.g=dot(A.rgb,vec3(0.349,0.686,0.168));B.b=dot(A.rgb,vec3(0.272,0.534,0.131));vec3 C=mix(A.rgb,B,Um);fragColor=vec4(C,A.a);}`, { Um: ["amount", 1] }), this.$l("threshold", `#version 300 es
|
|
3521
|
+
precision highp float;uniform sampler2D u_texture;uniform float Un;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(Un,B);fragColor=vec4(vec3(C),A.a);}`, { Un: ["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, "Ml", /* @__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, "Tl");
|
|
3532
|
+
this.Z = t, this.Tl = new Ht(this.Z), this.J = t.pe(Q, _t);
|
|
3534
3533
|
}
|
|
3535
3534
|
async register(t, e, i = {}) {
|
|
3536
|
-
await this.$l
|
|
3535
|
+
await this.Tl.$l(t, e, i);
|
|
3537
3536
|
}
|
|
3538
3537
|
unregister(t) {
|
|
3539
|
-
return this
|
|
3538
|
+
return this.Tl.Pl(t) ?? !1;
|
|
3540
3539
|
}
|
|
3541
3540
|
has(t) {
|
|
3542
|
-
return this
|
|
3541
|
+
return this.Tl.Pn(t) !== void 0;
|
|
3543
3542
|
}
|
|
3544
3543
|
wr(t, e) {
|
|
3545
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 ===
|
|
3546
|
+
El(t, e, i, s, r) {
|
|
3547
|
+
this.bc[0].width === s && this.bc[0].height === r || (this.bc[0].resize(s, r), this.bc[1].resize(s, r)), this.Rc(t, e, i, s, r, this.bc);
|
|
3549
3548
|
}
|
|
3550
|
-
|
|
3551
|
-
if (i.length === 0) return void this.
|
|
3549
|
+
Rc(t, e, i, s, r, h) {
|
|
3550
|
+
if (i.length === 0) return void this.Rl(t, e, s, r);
|
|
3552
3551
|
const o = this.Z.context, c = o.isEnabled(o.BLEND);
|
|
3553
|
-
o.disable(o.BLEND), this.
|
|
3552
|
+
o.disable(o.BLEND), this.Rl(t, h[0], s, r);
|
|
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.Sl(f, h[l], p, s, r), 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.
|
|
3560
|
+
Sl(t, e, i, s, r) {
|
|
3561
|
+
const h = this.Tl.Pn(t.name);
|
|
3562
|
+
if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.Rl(e.textures[0], i, s, r);
|
|
3563
|
+
const o = this.zl(t.name, h, s, r), c = { renderer: this.Z, gl: this.Z.context, width: s, height: r };
|
|
3565
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.we(0, 0,
|
|
3566
|
+
o.O(l), this.Z.we(0, 0, s, r), i.end();
|
|
3568
3567
|
}
|
|
3569
|
-
|
|
3570
|
-
let
|
|
3571
|
-
if (!
|
|
3572
|
-
const h = { renderer: this.Z, gl: this.Z.context, width: i, height:
|
|
3573
|
-
|
|
3568
|
+
zl(t, e, i, s) {
|
|
3569
|
+
let r = this.Ml.get(t);
|
|
3570
|
+
if (!r && e) {
|
|
3571
|
+
const h = { renderer: this.Z, gl: this.Z.context, width: i, height: s };
|
|
3572
|
+
r = e.createShader(h), this.Ml.set(t, r);
|
|
3574
3573
|
}
|
|
3575
|
-
return
|
|
3574
|
+
return r;
|
|
3576
3575
|
}
|
|
3577
|
-
|
|
3578
|
-
e.begin(), this.Z.ve(this.J), this.J.O({ u_texture: t, u_resolution: [i,
|
|
3576
|
+
Rl(t, e, i, s) {
|
|
3577
|
+
e.begin(), this.Z.ve(this.J), this.J.O({ u_texture: t, u_resolution: [i, s] }), this.Z.we(0, 0, i, s), 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.Ml.values()) t.dispose();
|
|
3584
|
+
this.Ml.clear(), this.J.dispose(), this.Tl.gt(), this.bc && (this.bc[0].gt(), this.bc[1].gt()), this.Ar = !1;
|
|
3586
3585
|
}
|
|
3587
3586
|
}
|
|
3588
|
-
const
|
|
3587
|
+
const Ke = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: Ht, TextmodeFilterManager: Wt }, Symbol.toStringTag, { value: "Module" }));
|
|
3589
3588
|
let lt = null;
|
|
3590
|
-
const qe = { id: "brightness", createShader: ({ gl: n }) => (lt || (lt = new q(n,
|
|
3589
|
+
const qe = { id: "brightness", createShader: ({ gl: n }) => (lt || (lt = new q(n, st, `#version 300 es
|
|
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.
|
|
3593
|
+
a(this, "kl", /* @__PURE__ */ new Map());
|
|
3594
|
+
a(this, "Ml", /* @__PURE__ */ new Map());
|
|
3595
|
+
this.Dl();
|
|
3597
3596
|
}
|
|
3598
|
-
|
|
3599
|
-
this.
|
|
3597
|
+
$l(t) {
|
|
3598
|
+
this.kl.set(t.id, t);
|
|
3600
3599
|
}
|
|
3601
|
-
|
|
3602
|
-
const e = this.
|
|
3603
|
-
return e && (e.dispose(), this.
|
|
3600
|
+
Pl(t) {
|
|
3601
|
+
const e = this.Ml.get(t);
|
|
3602
|
+
return e && (e.dispose(), this.Ml.delete(t)), this.kl.delete(t);
|
|
3604
3603
|
}
|
|
3605
3604
|
Pn(t) {
|
|
3606
|
-
return this.
|
|
3605
|
+
return this.kl.get(t);
|
|
3607
3606
|
}
|
|
3608
|
-
|
|
3609
|
-
return this.
|
|
3607
|
+
Ll(t) {
|
|
3608
|
+
return this.kl.has(t);
|
|
3610
3609
|
}
|
|
3611
3610
|
gt() {
|
|
3612
|
-
for (const t of this.
|
|
3613
|
-
this.
|
|
3611
|
+
for (const t of this.Ml.values()) t.dispose();
|
|
3612
|
+
this.Ml.clear(), this.kl.clear();
|
|
3614
3613
|
}
|
|
3615
|
-
|
|
3616
|
-
this
|
|
3614
|
+
Dl() {
|
|
3615
|
+
this.$l(qe);
|
|
3617
3616
|
}
|
|
3618
3617
|
}
|
|
3619
3618
|
class jt {
|
|
3620
3619
|
constructor() {
|
|
3621
|
-
a(this, "
|
|
3622
|
-
this.
|
|
3620
|
+
a(this, "Ol");
|
|
3621
|
+
this.Ol = new qt();
|
|
3623
3622
|
}
|
|
3624
3623
|
register(t) {
|
|
3625
|
-
this.
|
|
3624
|
+
this.Ol.$l(t);
|
|
3626
3625
|
}
|
|
3627
3626
|
unregister(t) {
|
|
3628
|
-
return this.
|
|
3627
|
+
return this.Ol.Pl(t);
|
|
3629
3628
|
}
|
|
3630
3629
|
has(t) {
|
|
3631
|
-
return this.
|
|
3630
|
+
return this.Ol.Ll(t);
|
|
3632
3631
|
}
|
|
3633
3632
|
Pn(t) {
|
|
3634
|
-
return this.
|
|
3633
|
+
return this.Ol.Pn(t);
|
|
3635
3634
|
}
|
|
3636
3635
|
gt() {
|
|
3637
|
-
this.
|
|
3636
|
+
this.Ol.gt();
|
|
3638
3637
|
}
|
|
3639
3638
|
}
|
|
3640
|
-
const
|
|
3639
|
+
const Ve = Object.freeze(Object.defineProperty({ __proto__: null, ConversionRegistry: qt, TextmodeConversionManager: jt }, Symbol.toStringTag, { value: "Module" }));
|
|
3641
3640
|
class je extends function(e, ...i) {
|
|
3642
|
-
return i.reduce((
|
|
3641
|
+
return i.reduce((s, r) => r(s), e);
|
|
3643
3642
|
}(class {
|
|
3644
|
-
},
|
|
3643
|
+
}, Xe, Ze, ze, ke, Ye) {
|
|
3645
3644
|
constructor(e = {}) {
|
|
3646
3645
|
super();
|
|
3647
3646
|
a(this, "Z");
|
|
3648
3647
|
a(this, "kr");
|
|
3649
|
-
a(this, "
|
|
3650
|
-
a(this, "
|
|
3648
|
+
a(this, "ha");
|
|
3649
|
+
a(this, "Zo");
|
|
3650
|
+
a(this, "ca");
|
|
3651
3651
|
a(this, "la");
|
|
3652
|
-
a(this, "
|
|
3653
|
-
a(this, "Ll");
|
|
3654
|
-
a(this, "Zc");
|
|
3652
|
+
a(this, "Il");
|
|
3655
3653
|
a(this, "qc");
|
|
3656
|
-
a(this, "
|
|
3654
|
+
a(this, "Vc");
|
|
3655
|
+
a(this, "oa");
|
|
3657
3656
|
a(this, "dn");
|
|
3658
|
-
a(this, "
|
|
3659
|
-
a(this, "
|
|
3657
|
+
a(this, "Ec");
|
|
3658
|
+
a(this, "Xc");
|
|
3660
3659
|
a(this, "gn");
|
|
3661
|
-
a(this, "
|
|
3662
|
-
a(this, "Bl");
|
|
3663
|
-
a(this, "Il");
|
|
3660
|
+
a(this, "Bl", []);
|
|
3664
3661
|
a(this, "Hl");
|
|
3665
|
-
a(this, "Gl"
|
|
3666
|
-
a(this, "Ql"
|
|
3662
|
+
a(this, "Gl");
|
|
3663
|
+
a(this, "Ql");
|
|
3667
3664
|
a(this, "Nl", !1);
|
|
3668
3665
|
a(this, "Xl", !1);
|
|
3669
|
-
a(this, "Yl",
|
|
3666
|
+
a(this, "Yl", !1);
|
|
3667
|
+
a(this, "jl", !1);
|
|
3668
|
+
a(this, "Kl", () => {
|
|
3670
3669
|
});
|
|
3671
3670
|
a(this, "Cc", () => {
|
|
3672
3671
|
});
|
|
3673
|
-
a(this, "
|
|
3672
|
+
a(this, "Wl", () => {
|
|
3674
3673
|
});
|
|
3675
|
-
a(this, "Kl");
|
|
3676
|
-
a(this, "Wl");
|
|
3677
|
-
a(this, "Xr", !1);
|
|
3678
3674
|
a(this, "Zl");
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3675
|
+
a(this, "ql");
|
|
3676
|
+
a(this, "Xr", !1);
|
|
3677
|
+
a(this, "Vl");
|
|
3678
|
+
a(this, "Jl");
|
|
3679
|
+
this.Ql = new Ge(this), this.Xr = e.overlay ?? !1, this.kr = new _e(e), this.Z = new Ae(this.kr.tn()), this.ha = new Ut(e.frameRate ?? 60), this.Il = new kt(this, e.loadingScreen, this.kr.Vr()), this.Il.Wc(() => {
|
|
3680
|
+
this.ha.Kn = 0, this.jl = !0;
|
|
3681
|
+
}), this.qc = this.Z.pe(Q, `#version 300 es
|
|
3682
|
+
precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D Uh;uniform sampler2D Ui;uniform sampler2D Ug;uniform vec2 Uj;uniform vec2 Uk;uniform vec4 Ul;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/Uk;vec2 F=E*Uj;vec2 G=floor(F);vec2 H=(G+0.5)/Uj;vec4 I=texture(Uh,H);vec4 J=texture(Ui,H);vec4 K=texture(Ug,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(Ul,J,J.a);fragColor=mix(d,I,c);}`), this.Vc = this.Z.pe(Q, _t), this.oa = new Gt(this, e);
|
|
3683
|
+
const i = () => this.tu();
|
|
3684
|
+
this.Zo = new Lt(this.kr, i), this.ca = new Nt(this.kr, i, this.Zo), this.la = new Bt(), this.Xc = new Wt(this.Z), this.gn = new jt(), this.Il.Bn(), this.su(e);
|
|
3685
|
+
}
|
|
3686
|
+
async su(e) {
|
|
3687
|
+
await this.oa.wr(), await this.Il.wr();
|
|
3688
|
+
const i = this.oa.base.grid;
|
|
3689
|
+
this.oa.bl(() => {
|
|
3690
|
+
this.Zo.Fo(), this.ca.Fo();
|
|
3691
|
+
}), this.Hl = this.Z.Pe(this.kr.width, this.kr.height, 1), this.Gl = this.Z.Pe(this.kr.width, this.kr.height, 1), this.Xc.wr(this.kr.width, this.kr.height), this.Xr && (this.Vl = z.Tn(this.Z, this.gn, this.kr.targetCanvas, i.cols, i.rows)), this.iu(), this.ha.Bn(() => this.aa()), await this.Ql.ga(e.plugins ?? []);
|
|
3692
3692
|
try {
|
|
3693
|
-
await this.
|
|
3694
|
-
} catch (
|
|
3695
|
-
console.error("Error during setup:",
|
|
3693
|
+
await this.Kl(), this.Il.Wa();
|
|
3694
|
+
} catch (s) {
|
|
3695
|
+
console.error("Error during setup:", s), this.Il.error(s);
|
|
3696
3696
|
}
|
|
3697
3697
|
}
|
|
3698
|
-
|
|
3699
|
-
this.
|
|
3700
|
-
this.Xr && this.resizeCanvas(this.kr.targetCanvas.width, this.kr.targetCanvas.height), this.
|
|
3701
|
-
}, window.addEventListener("resize", this.
|
|
3702
|
-
this.
|
|
3703
|
-
}), this.Xr && (this.
|
|
3698
|
+
iu() {
|
|
3699
|
+
this.Zl = () => {
|
|
3700
|
+
this.Xr && this.resizeCanvas(this.kr.targetCanvas.width, this.kr.targetCanvas.height), this.Wl();
|
|
3701
|
+
}, window.addEventListener("resize", this.Zl), this.Zo._o(), this.ca._o(), this.la._o(), window.addEventListener("blur", () => {
|
|
3702
|
+
this.la.Wo();
|
|
3703
|
+
}), this.Xr && (this.ql = new ResizeObserver(() => {
|
|
3704
3704
|
this.resizeCanvas(this.kr.targetCanvas.width, this.kr.targetCanvas.height);
|
|
3705
|
-
}), this.
|
|
3705
|
+
}), this.ql.observe(this.kr.targetCanvas));
|
|
3706
3706
|
}
|
|
3707
|
-
|
|
3708
|
-
if (!this.
|
|
3709
|
-
this.
|
|
3707
|
+
aa() {
|
|
3708
|
+
if (!this.Il.Xa && this.jl) {
|
|
3709
|
+
this.Xl = !0;
|
|
3710
3710
|
try {
|
|
3711
|
-
this.
|
|
3712
|
-
let e = this.
|
|
3713
|
-
this.
|
|
3711
|
+
this.ha.Xn(), this.ha.Wn(), this.Xr && Tt(this.Z.context, this.Vl.texture, this.kr.targetCanvas), this.Ql.wa(), this.Z.state.qt(), this.oa._l(this.Hl, () => this.Cc());
|
|
3712
|
+
let e = this.Hl.textures[0];
|
|
3713
|
+
this.Bl.length > 0 && (this.Xc.El(this.Hl.textures[0], this.Gl, this.Bl, this.kr.width, this.kr.height), e = this.Gl.textures[0], this.Bl = []), this.Z.wi(0, 0, 0, 0), this.Z.ve(this.Vc), this.Vc.O({ u_texture: e }), this.Z.we(0, 0, this.kr.width, this.kr.height), this.Ql.Ca();
|
|
3714
3714
|
} finally {
|
|
3715
|
-
this.
|
|
3715
|
+
this.Xl = !1, this.Nl && !this.Yl && this.eu();
|
|
3716
3716
|
}
|
|
3717
3717
|
}
|
|
3718
3718
|
}
|
|
3719
3719
|
resizeCanvas(e, i) {
|
|
3720
|
-
var
|
|
3721
|
-
this.kr.Jr(e, i), this.
|
|
3720
|
+
var s, r, h, o;
|
|
3721
|
+
this.kr.Jr(e, i), this.Il.Jc(this.kr.Vr()), this.Il.Jr(), (s = this.Hl) == null || s.resize(this.kr.width, this.kr.height), (r = this.Gl) == null || r.resize(this.kr.width, this.kr.height), (h = this.Xc) == null || h.Jr(this.kr.width, this.kr.height), (o = this.oa) == null || o.Jr(), this.Z.Re(), this.aa();
|
|
3722
3722
|
}
|
|
3723
3723
|
destroy() {
|
|
3724
|
-
this.
|
|
3724
|
+
this.Yl || this.Nl || (this.Nl = !0, this.ha.Gn(), this.Xl || this.eu());
|
|
3725
3725
|
}
|
|
3726
|
-
|
|
3727
|
-
var e, i,
|
|
3728
|
-
this.
|
|
3726
|
+
eu() {
|
|
3727
|
+
var e, i, s, r, h, o, c;
|
|
3728
|
+
this.Nl = !1, this.Il.gt(), this.Ql.xa(), window.removeEventListener("resize", this.Zl), (e = this.ql) == null || e.disconnect(), this.Zo.Mo(), this.ca.Mo(), this.la.Mo(), this.qc.dispose(), (i = this.oa) == null || i.gt(), (s = this.Xc) == null || s.gt(), (r = this.gn) == null || r.gt(), (h = this.Hl) == null || h.gt(), (o = this.Gl) == null || o.gt(), this.Z.gt(), this.Vc.dispose(), (c = this.Vl) == null || c.gt(), this.kr.gt(), this.Yl = !0;
|
|
3729
3729
|
}
|
|
3730
3730
|
filter(e, i) {
|
|
3731
|
-
this.
|
|
3731
|
+
this.Bl.push({ name: e, params: i });
|
|
3732
3732
|
}
|
|
3733
3733
|
async loadFont(e) {
|
|
3734
|
-
return await this.
|
|
3734
|
+
return await this.oa.base.loadFont(e), this.oa.base.font;
|
|
3735
3735
|
}
|
|
3736
3736
|
fontSize(e) {
|
|
3737
|
-
vt.m(typeof e == "number" && e > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: e }) && this.
|
|
3737
|
+
vt.m(typeof e == "number" && e > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: e }) && this.oa.base.font.fontSize !== e && this.oa.base.font.Mr(e);
|
|
3738
|
+
}
|
|
3739
|
+
inputGrid(e) {
|
|
3740
|
+
return e === void 0 ? this.Jl ?? "topmost" : e === "topmost" ? (this.Jl = void 0, this.Zo.Fo(), void this.ca.Fo()) : (this.Jl = e, this.Zo.Fo(), void this.ca.Fo());
|
|
3741
|
+
}
|
|
3742
|
+
tu() {
|
|
3743
|
+
return this.Jl ? this.Jl : this.oa.wl();
|
|
3738
3744
|
}
|
|
3739
3745
|
async setup(e) {
|
|
3740
|
-
this.
|
|
3746
|
+
this.Kl = e;
|
|
3741
3747
|
}
|
|
3742
3748
|
draw(e) {
|
|
3743
3749
|
this.Cc = e;
|
|
3744
3750
|
}
|
|
3745
3751
|
windowResized(e) {
|
|
3746
|
-
this.
|
|
3752
|
+
this.Wl = e;
|
|
3747
3753
|
}
|
|
3748
3754
|
get grid() {
|
|
3749
|
-
return this.
|
|
3755
|
+
return this.Ec ?? this.oa.base.grid;
|
|
3750
3756
|
}
|
|
3751
3757
|
get font() {
|
|
3752
|
-
return this.dn ?? this.
|
|
3758
|
+
return this.dn ?? this.oa.base.font;
|
|
3753
3759
|
}
|
|
3754
3760
|
get width() {
|
|
3755
3761
|
return this.kr.width;
|
|
@@ -3761,25 +3767,25 @@ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charse
|
|
|
3761
3767
|
return this.kr.canvas;
|
|
3762
3768
|
}
|
|
3763
3769
|
get isDisposed() {
|
|
3764
|
-
return this.
|
|
3770
|
+
return this.Yl;
|
|
3765
3771
|
}
|
|
3766
3772
|
get overlay() {
|
|
3767
|
-
return this.
|
|
3773
|
+
return this.Vl;
|
|
3768
3774
|
}
|
|
3769
3775
|
get loading() {
|
|
3770
|
-
return this.
|
|
3776
|
+
return this.Il;
|
|
3771
3777
|
}
|
|
3772
3778
|
get layers() {
|
|
3773
|
-
return this.
|
|
3779
|
+
return this.oa;
|
|
3774
3780
|
}
|
|
3775
3781
|
get filters() {
|
|
3776
|
-
return this.
|
|
3782
|
+
return this.Xc;
|
|
3777
3783
|
}
|
|
3778
3784
|
get conversions() {
|
|
3779
3785
|
return this.gn;
|
|
3780
3786
|
}
|
|
3781
3787
|
}
|
|
3782
|
-
class
|
|
3788
|
+
class mt {
|
|
3783
3789
|
constructor() {
|
|
3784
3790
|
}
|
|
3785
3791
|
static create(t = {}) {
|
|
@@ -3789,25 +3795,25 @@ class At {
|
|
|
3789
3795
|
vt._(t);
|
|
3790
3796
|
}
|
|
3791
3797
|
static get version() {
|
|
3792
|
-
return "0.8.0
|
|
3798
|
+
return "0.8.0";
|
|
3793
3799
|
}
|
|
3794
3800
|
}
|
|
3795
|
-
const Je = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: zt, LoadingPhaseTracker:
|
|
3801
|
+
const Je = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: zt, LoadingPhaseTracker: Dt, LoadingScreenManager: kt, LoadingScreenStateMachine: Ot, LoadingScreenTransition: It, resolveColorInputs: Zt, resolveDefaultPalette: Xt, 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: Oe, mouse: De, touch: Ie }, Symbol.toStringTag, { value: "Module" })), ei = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: Yt, TextmodeLayer: it, TextmodeLayerManager: Gt }, Symbol.toStringTag, { value: "Module" })), ii = mt.create, si = mt.setErrorLevel, ri = mt.version;
|
|
3796
3802
|
export {
|
|
3797
|
-
|
|
3803
|
+
_e as TextmodeCanvas,
|
|
3798
3804
|
S as TextmodeColor,
|
|
3799
3805
|
$t as TextmodeErrorLevel,
|
|
3800
|
-
|
|
3806
|
+
Z as TextmodeFramebuffer,
|
|
3801
3807
|
Le as TextmodeGrid,
|
|
3802
3808
|
je as Textmodifier,
|
|
3803
|
-
|
|
3809
|
+
Ve as conversion,
|
|
3804
3810
|
ii as create,
|
|
3805
|
-
|
|
3811
|
+
Ke as filters,
|
|
3806
3812
|
ti as input,
|
|
3807
3813
|
ei as layering,
|
|
3808
3814
|
$e as loadables,
|
|
3809
3815
|
Je as loading,
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3816
|
+
si as setErrorLevel,
|
|
3817
|
+
mt as textmode,
|
|
3818
|
+
ri as version
|
|
3813
3819
|
};
|