textmode.js 0.8.0 → 0.8.1
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 +1257 -1257
- package/dist/textmode.umd.js +14 -14
- package/dist/types/Textmode.d.ts +14 -2
- package/dist/types/errors/ErrorHandler.d.ts +1 -1
- package/dist/types/index.d.ts +10 -2
- package/dist/types/rendering/webgl/utils/hash.d.ts +6 -6
- package/dist/types/textmode/conversion/ConversionManager.d.ts +2 -2
- package/dist/types/textmode/conversion/ConversionRegistry.d.ts +2 -2
- package/dist/types/textmode/filters/FilterManager.d.ts +2 -7
- package/dist/types/textmode/filters/FilterRegistry.d.ts +2 -2
- package/dist/types/textmode/interfaces/ITextmodifier.d.ts +5 -5
- package/dist/types/textmode/layers/LayerManager.d.ts +2 -2
- package/dist/types/textmode/layers/TextmodeLayer.d.ts +2 -2
- package/dist/types/textmode/layers/interfaces/ITextmodeLayer.d.ts +6 -8
- package/dist/types/textmode/loadables/font/TextmodeFont.d.ts +3 -3
- package/dist/types/textmode/loading/LoadingPhase.d.ts +4 -2
- package/dist/types/textmode/loading/LoadingScreenManager.d.ts +4 -4
- package/dist/types/textmode/loading/types.d.ts +10 -6
- package/dist/types/textmode/mixins/interfaces/IAnimationMixin.d.ts +1 -1
- package/dist/types/textmode/mixins/interfaces/IRenderingMixin.d.ts +0 -2
- package/dist/types/textmode/mixins/interfaces/ITouchMixin.d.ts +11 -11
- 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 Kt = Object.defineProperty;
|
|
2
|
+
var Jt = (n, t, e) => t in n ? Kt(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, r]) => `
|
|
12
|
+
- ${i}: ${U.o(r)}`).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 _ = class _ {
|
|
32
32
|
constructor() {
|
|
33
33
|
a(this, "l", { globalLevel: 3 });
|
|
34
34
|
}
|
|
35
35
|
static u() {
|
|
36
|
-
return
|
|
36
|
+
return _.h || (_.h = new _()), _.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.", r = "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, r), console.warn(U.i(t, e)), console.groupEnd(), !1;
|
|
45
45
|
case 2:
|
|
46
|
-
return console.group(i,
|
|
46
|
+
return console.group(i, r), console.error(U.i(t, e)), console.groupEnd(), !1;
|
|
47
47
|
default:
|
|
48
48
|
throw new U(t, e);
|
|
49
49
|
}
|
|
@@ -55,10 +55,10 @@ const D = class D {
|
|
|
55
55
|
this.l.globalLevel = t;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
a(
|
|
59
|
-
let ut =
|
|
58
|
+
a(_, "h", null);
|
|
59
|
+
let ut = _;
|
|
60
60
|
const vt = ut.u();
|
|
61
|
-
class
|
|
61
|
+
class W {
|
|
62
62
|
constructor(t, e, i) {
|
|
63
63
|
a(this, "A");
|
|
64
64
|
a(this, "C");
|
|
@@ -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 r = i.name.replace(/\[0\]$/, ""), s = this.A.getUniformLocation(this.C, r);
|
|
78
|
+
s && (this.M.set(r, s), this.F.set(r, { 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), r = this.k(this.A.FRAGMENT_SHADER, e), s = this.A.createProgram();
|
|
84
|
+
if (this.A.attachShader(s, i), this.A.attachShader(s, r), this.A.linkProgram(s), !this.A.getProgramParameter(s, this.A.LINK_STATUS)) {
|
|
85
|
+
const h = this.A.getProgramInfoLog(s);
|
|
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(r), s;
|
|
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 r = this.A.getShaderInfoLog(i);
|
|
94
|
+
throw this.A.deleteShader(i), Error("Shader compilation error: " + r);
|
|
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 r = this.F.get(t);
|
|
112
|
+
if (!r) return;
|
|
113
|
+
const { type: s, size: h } = r, 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 X) {
|
|
119
119
|
const u = this.H(t);
|
|
120
120
|
return o.uniform1i(i, u), o.activeTexture(o.TEXTURE0 + u), void o.bindTexture(o.TEXTURE_2D, e.textures[0]);
|
|
121
121
|
}
|
|
122
|
-
if (typeof e == "number") return void (
|
|
122
|
+
if (typeof e == "number") return void (s === o.INT || s === 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[s]) == 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[s]) == 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 mt(n, t, e, i) {
|
|
147
147
|
return 180 * Math.atan2(i - t, e - n) / Math.PI;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function k(n, t, e, i) {
|
|
150
150
|
return Math.hypot(e - n, i - t);
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function Z(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, r) {
|
|
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, r);
|
|
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, r, s = 0, h = WebGL2RenderingContext.FLOAT, o = !1) {
|
|
165
|
+
n.enableVertexAttribArray(t), n.vertexAttribPointer(t, e, h, o, i, r), n.vertexAttribDivisor(t, s);
|
|
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, r) {
|
|
168
|
+
n.bindBuffer(t, e), n.bufferData(t, i, r), 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 rt = `#version 300 es
|
|
171
|
+
in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in vec4 A7;in vec3 A8;in vec3 A9;in vec4 Aa;in vec4 Ab;in vec3 Ac;uniform vec2 Ur;uniform float Us;uniform float Ut;out vec2 v_uv;out vec3 v_glyphIndex;out vec4 v_glyphColor;out vec4 v_cellColor;out vec4 v_glyphFlags;out vec3 v_worldPosition;out vec3 v_normal;out float v_geometryType;const float A=6.28318530718f;const int B=2;const int C=3;const int D=4;vec2 E(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float M=L*K;float N=F*F;float O=N*F;return M*G+3.0f*L*F*H+3.0f*K*N*I+O*J;}vec2 P(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float N=F*F;return-3.0f*L*G+3.0f*(L-2.0f*K*F)*H+3.0f*(2.0f*K*F-N)*I+3.0f*N*J;}vec3 Q(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x,R.y*T-R.z*U,R.y*U+R.z*T);}vec3 V(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T+R.z*U,R.y,-R.x*U+R.z*T);}vec3 W(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T-R.y*U,R.x*U+R.y*T,R.z);}vec3 X(vec3 R,vec3 Y){vec3 Z=R;if(Y.z!=0.0f){Z=W(Z,Y.z);}if(Y.y!=0.0f){Z=V(Z,Y.y);}if(Y.x!=0.0f){Z=Q(Z,Y.x);}return Z;}void main(){v_uv=A1;v_glyphIndex=A4;v_glyphColor=A5;v_cellColor=A6;v_glyphFlags=A7;vec4 a=Aa;vec4 b=Ab;vec2 c=A3;vec2 d=A2;float e=Ac.x;float f=Ac.y;int g=int(Ac.z);vec2 h=d;vec2 i=h+c*0.5f;float j=f+e*0.5f;vec3 k=vec3(i,j);vec3 l;if(g==D){float F=clamp(A0.x,0.0f,1.0f);vec2 G=b.xy;vec2 H=a.xy;vec2 I=a.zw;vec2 J=b.zw;vec2 m=E(F,G,H,I,J);vec2 n=P(F,G,H,I,J);float o=length(n);vec2 p=o>0.0f?n/o:vec2(1.0f,0.0f);vec2 q=vec2(-p.y,p.x);vec2 r=m;vec2 s=r+q*A0.y*c.y;l=vec3(s,f);}else if(g==C){float t=mod(a.x,A);if(t<0.0f){t+=A;}float u=mod(a.y,A);if(u<0.0f){u+=A;}float v=t-u;if(v<=0.0f){v+=A;}float S=t-A0.x*v;vec2 w=vec2(cos(S),sin(S))*A0.y;vec2 s=w*c+h;l=vec3(s,f);}else if(g==B){vec2 s=A0.xy*c+h;l=vec3(s,f);}vec3 x=X(l,A9);vec3 y=x+A8;vec3 z=vec3(0.0f,0.0f,1.0f);v_worldPosition=y;v_normal=z;v_geometryType=float(g);vec2 AA=(y.xy/Ur)*2.0f;AA.y=-AA.y;float AB=y.z/Ur.y;float AC=clamp(-AB*Us,-0.99f,0.99f);if(Ut>0.5f){gl_Position=vec4(AA,AC,1.0f);}else{float AD=0.5f;float AE=1.0f/(1.0f-AB*AD);AA*=AE;gl_Position=vec4(AA,AC,1.0f);}}`, I = class I {
|
|
172
|
+
constructor(t, e, i = e, r = 1, s = {}, 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 =
|
|
185
|
-
precision highp float;in vec2 v_uv;uniform sampler2D
|
|
184
|
+
this.N = e, this.X = i, this.A = t, this.W = Z(r, 1, 8), this.Z = h, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...s }, I.J || (I.J = new W(t, rt, `#version 300 es
|
|
185
|
+
precision highp float;in vec2 v_uv;uniform sampler2D U5;uniform sampler2D U6;uniform sampler2D U7;uniform sampler2D U8;uniform vec2 U9;uniform bool Ua;uniform bool Ub;uniform bool Uc;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*U9;vec2 D=(floor(C)+0.5f)/U9;vec4 E=texture(U5,D);vec4 F=Ua?texture(U6,D):vec4(0.);if(Ua&&F.a==0.){discard;}vec4 G=Ub?texture(U7,D):vec4(0.);vec4 H=Uc?texture(U8,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, r = this.l.type === "float" ? t.FLOAT : t.UNSIGNED_BYTE, s = r === 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, s, this.N, this.X, 0, h, r, 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 r = t.COLOR_ATTACHMENT0 + i;
|
|
204
|
+
t.framebufferTexture2D(t.FRAMEBUFFER, r, t.TEXTURE_2D, this.j[i], 0), e.push(r);
|
|
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, r = this.l.type === "float" ? i.FLOAT : i.UNSIGNED_BYTE, s = r === 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, s, this.N, this.X, 0, h, r, 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, r = this.N, s = this.X, h = new Uint8Array(r * s * 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, r, s, i.RGBA, i.UNSIGNED_BYTE, h), i.bindFramebuffer(i.READ_FRAMEBUFFER, o);
|
|
228
|
+
const c = 4 * r, l = new Uint8Array(h.length);
|
|
229
|
+
for (let u = 0; u < s; u++) {
|
|
230
|
+
const f = (s - 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, r = { U5: this.j[0], U6: t ? this.j[1] : this.j[0], U7: e ? this.j[2] : this.j[0], U8: i ? this.j[3] : this.j[0], U9: [this.N, this.X], Ua: t, Ub: e, Uc: i }, s = I.J;
|
|
248
|
+
this.q = this.Z.vt.dt(s, r, !0);
|
|
249
249
|
}
|
|
250
250
|
gt() {
|
|
251
251
|
const t = this.A;
|
|
@@ -266,8 +266,8 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
|
|
|
266
266
|
return this.W;
|
|
267
267
|
}
|
|
268
268
|
};
|
|
269
|
-
a(
|
|
270
|
-
let
|
|
269
|
+
a(I, "J", null);
|
|
270
|
+
let X = I;
|
|
271
271
|
const Ft = /* @__PURE__ */ new WeakMap();
|
|
272
272
|
function ht(n, t) {
|
|
273
273
|
Ft.set(n, t);
|
|
@@ -275,10 +275,10 @@ function ht(n, t) {
|
|
|
275
275
|
function Ct(n) {
|
|
276
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, r = 255) {
|
|
279
|
+
n[0] = t / 255, n[1] = (e ?? t) / 255, n[2] = (i ?? t) / 255, n[3] = r / 255;
|
|
280
280
|
}
|
|
281
|
-
class
|
|
281
|
+
class st {
|
|
282
282
|
constructor() {
|
|
283
283
|
a(this, "_t", 1);
|
|
284
284
|
a(this, "yt", 0);
|
|
@@ -300,17 +300,17 @@ class rt {
|
|
|
300
300
|
a(this, "Dt", []);
|
|
301
301
|
}
|
|
302
302
|
static Lt() {
|
|
303
|
-
return { Ot: 1,
|
|
303
|
+
return { Ot: 1, Bt: 0, It: 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.Bt = this.yt, t.It = 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.Bt, this.At = t.It, 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 = st.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 rt {
|
|
|
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, r = 255) {
|
|
353
|
+
tt(this.Ft, t, e, i, r);
|
|
354
354
|
}
|
|
355
|
-
ls(t, e, i,
|
|
356
|
-
tt(this.$t, t, e, i,
|
|
355
|
+
ls(t, e, i, r = 255) {
|
|
356
|
+
tt(this.$t, t, e, i, r);
|
|
357
357
|
}
|
|
358
358
|
us(t) {
|
|
359
359
|
this.Pt = t;
|
|
@@ -367,8 +367,8 @@ class rt {
|
|
|
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, r) {
|
|
371
|
+
tt(this.St, t, e, i, r);
|
|
372
372
|
}
|
|
373
373
|
gs(t) {
|
|
374
374
|
this.zt = t;
|
|
@@ -389,7 +389,7 @@ class rt {
|
|
|
389
389
|
return this.xt;
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
const dt = new Float32Array([-0.5, -0.5, 0, 0, 0.5, -0.5, 1, 0, -0.5, 0.5, 0, 1, -0.5, 0.5, 0, 1, 0.5, -0.5, 1, 0, 0.5, 0.5, 1, 1]),
|
|
392
|
+
const dt = new Float32Array([-0.5, -0.5, 0, 0, 0.5, -0.5, 1, 0, -0.5, 0.5, 0, 1, -0.5, 0.5, 0, 1, 0.5, -0.5, 1, 0, 0.5, 0.5, 1, 1]), Y = { _s: 16, As: WebGL2RenderingContext.TRIANGLES, ws: { bs: { size: 2, offset: 0 }, Cs: { size: 2, offset: 8 } } };
|
|
393
393
|
class te {
|
|
394
394
|
constructor(t) {
|
|
395
395
|
a(this, "A");
|
|
@@ -397,19 +397,19 @@ 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, r) {
|
|
401
|
+
const s = 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 + r) / 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
|
|
404
|
-
p[v] = x, p[v + 1] = E, p[v + 2] =
|
|
403
|
+
const A = g[v], m = g[v + 1], w = g[v + 2], y = g[v + 3], x = l + (A + 0.5) * (u - l), E = f + (m + 0.5) * (d - f);
|
|
404
|
+
p[v] = x, p[v + 1] = E, p[v + 2] = w, p[v + 3] = y;
|
|
405
405
|
}
|
|
406
|
-
|
|
406
|
+
s.bindBuffer(s.ARRAY_BUFFER, this.Ms), s.bufferData(s.ARRAY_BUFFER, p, s.DYNAMIC_DRAW), s.enableVertexAttribArray(0), s.vertexAttribPointer(0, 2, s.FLOAT, !1, 16, 0), s.enableVertexAttribArray(1), s.vertexAttribPointer(1, 2, s.FLOAT, !1, 16, 8), s.drawArrays(s.TRIANGLES, 0, 6), s.disableVertexAttribArray(1), s.disableVertexAttribArray(0), s.bindBuffer(s.ARRAY_BUFFER, null);
|
|
407
407
|
}
|
|
408
408
|
gt() {
|
|
409
409
|
this.A.deleteBuffer(this.Ms);
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
var
|
|
412
|
+
var b = ((n) => (n.RECTANGLE = "rectangle", n.LINE = "line", n.ELLIPSE = "ellipse", n.ARC = "arc", n.TRIANGLE = "triangle", n.BEZIER_CURVE = "bezier_curve", n))(b || {});
|
|
413
413
|
const ee = { rectangle: 2, line: 2, ellipse: 2, triangle: 2, arc: 3, bezier_curve: 4 };
|
|
414
414
|
class ie {
|
|
415
415
|
constructor(t) {
|
|
@@ -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, r) {
|
|
421
|
+
const s = 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 = s.createVertexArray(), h.set(e, o), s.bindVertexArray(o), s.bindBuffer(s.ARRAY_BUFFER, r);
|
|
427
|
+
const c = s.getAttribLocation(t, "A0");
|
|
428
|
+
c !== -1 && ft(s, c, i.ws.bs.size, i._s, i.ws.bs.offset, 0, s.FLOAT, !1);
|
|
429
|
+
const l = s.getAttribLocation(t, "A1");
|
|
430
|
+
l !== -1 && ft(s, l, i.ws.Cs.size, i._s, i.ws.Cs.offset, 0, s.FLOAT, !1);
|
|
431
431
|
}
|
|
432
|
-
|
|
432
|
+
s.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 D = class D {
|
|
442
442
|
static Rs(t, e, i = 0) {
|
|
443
|
-
const
|
|
444
|
-
let
|
|
445
|
-
s
|
|
443
|
+
const r = e || new Float32Array(D.FLOATS_PER_INSTANCE);
|
|
444
|
+
let s = i;
|
|
445
|
+
r[s++] = t.bs[0], r[s++] = t.bs[1], r[s++] = t.Ss[0], r[s++] = t.Ss[1], r[s++] = t.Nt[0], r[s++] = t.Nt[1], r[s++] = t.Nt[2], r[s++] = t.Xt[0], r[s++] = t.Xt[1], r[s++] = t.Xt[2], r[s++] = t.Xt[3], r[s++] = t.Yt[0], r[s++] = t.Yt[1], r[s++] = t.Yt[2], r[s++] = t.Yt[3], r[s++] = t.zs[0], r[s++] = t.zs[1], r[s++] = t.zs[2], r[s++] = t.Rt;
|
|
446
446
|
const h = t.ks;
|
|
447
|
-
s
|
|
447
|
+
r[s++] = (h == null ? void 0 : h[0]) ?? 0, r[s++] = (h == null ? void 0 : h[1]) ?? 0, r[s++] = (h == null ? void 0 : h[2]) ?? 0;
|
|
448
448
|
const o = t.Ds;
|
|
449
|
-
s
|
|
450
|
-
const c = t.Ls, l = t.Os, u = t.
|
|
451
|
-
return g ? (s
|
|
449
|
+
r[s++] = (o == null ? void 0 : o[0]) ?? 0, r[s++] = (o == null ? void 0 : o[1]) ?? 0, r[s++] = (o == null ? void 0 : o[2]) ?? 0;
|
|
450
|
+
const c = t.Ls, l = t.Os, u = t.Bs, f = t.Is, d = t.Hs, g = !(!l || !u);
|
|
451
|
+
return g ? (r[s++] = (f == null ? void 0 : f[0]) ?? 0, r[s++] = (f == null ? void 0 : f[1]) ?? 0, r[s++] = (d == null ? void 0 : d[0]) ?? 0, r[s++] = (d == null ? void 0 : d[1]) ?? 0, r[s++] = l[0], r[s++] = l[1], r[s++] = u[0], r[s++] = u[1]) : !g && !!c ? (r[s++] = c[0], r[s++] = c[1], r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0) : (r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0), r[s++] = t.Gs ?? 0, r[s++] = t.Qs ?? 0, r[s++] = t.Ns ?? 0, r;
|
|
452
452
|
}
|
|
453
453
|
static Xs(t, e) {
|
|
454
|
-
const i = t.length *
|
|
455
|
-
for (let
|
|
456
|
-
const h =
|
|
457
|
-
|
|
454
|
+
const i = t.length * D.FLOATS_PER_INSTANCE, r = e || new Float32Array(i);
|
|
455
|
+
for (let s = 0; s < t.length; s++) {
|
|
456
|
+
const h = s * D.FLOATS_PER_INSTANCE;
|
|
457
|
+
D.Rs(t[s], r, h);
|
|
458
458
|
}
|
|
459
|
-
return
|
|
459
|
+
return r;
|
|
460
460
|
}
|
|
461
461
|
};
|
|
462
|
-
a(
|
|
463
|
-
let
|
|
462
|
+
a(D, "BYTES_PER_INSTANCE", 144), a(D, "FLOATS_PER_INSTANCE", 36);
|
|
463
|
+
let N = D;
|
|
464
464
|
const M = class M {
|
|
465
465
|
};
|
|
466
|
-
a(M, "STRIDE",
|
|
467
|
-
let
|
|
468
|
-
class
|
|
466
|
+
a(M, "STRIDE", N.BYTES_PER_INSTANCE), a(M, "ATTRIBUTES", { A2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 0, divisor: 1 }, A3: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 8, divisor: 1 }, A4: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 16, divisor: 1 }, A5: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 28, divisor: 1 }, A6: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 44, divisor: 1 }, A7: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 60, divisor: 1 }, A8: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 76, divisor: 1 }, A9: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 88, divisor: 1 }, Aa: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 100, divisor: 1 }, Ab: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 116, divisor: 1 }, Ac: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 132, divisor: 1 } });
|
|
467
|
+
let q = M;
|
|
468
|
+
class re {
|
|
469
469
|
constructor(t = 1e3, e = 1.5) {
|
|
470
470
|
a(this, "Ys");
|
|
471
471
|
a(this, "js");
|
|
@@ -473,15 +473,15 @@ class se {
|
|
|
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 * N.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 r = e * N.FLOATS_PER_INSTANCE, s = new Float32Array(r), h = i * N.FLOATS_PER_INSTANCE;
|
|
484
|
+
s.set(this.Ys.subarray(0, Math.min(h, this.Ws))), this.Ys = s;
|
|
485
485
|
}
|
|
486
486
|
Vs() {
|
|
487
487
|
return { buffer: this.Ys, offset: this.Ws };
|
|
@@ -508,7 +508,7 @@ class se {
|
|
|
508
508
|
return this.Zs === 0;
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
class
|
|
511
|
+
class se {
|
|
512
512
|
constructor(t) {
|
|
513
513
|
a(this, "Ys");
|
|
514
514
|
this.Ys = t;
|
|
@@ -517,8 +517,8 @@ class re {
|
|
|
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 r = t.curveParams0, s = t.curveParams1;
|
|
521
|
+
return e[i + 25] = r[0], e[i + 26] = r[1], e[i + 27] = r[2], e[i + 28] = r[3], e[i + 29] = s[0], e[i + 30] = s[1], e[i + 31] = s[2], e[i + 32] = s[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Ys.Js(N.FLOATS_PER_INSTANCE), this.Ys.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 * N.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 r = e * N.FLOATS_PER_INSTANCE;
|
|
552
|
+
i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, r);
|
|
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 r in q.ATTRIBUTES) {
|
|
560
|
+
const s = i.getAttribLocation(t, r);
|
|
561
|
+
s !== -1 && e.set(r, s);
|
|
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 =
|
|
568
|
+
const e = this.A, i = t.G, r = this.di(i);
|
|
569
|
+
for (const [s, h] of r) {
|
|
570
|
+
const o = q.ATTRIBUTES[s];
|
|
571
571
|
o && ft(e, h, o.size, o.stride, o.offset, o.divisor, o.type, o.normalized);
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
574
|
gi(t) {
|
|
575
575
|
const e = this.A, i = this.di(t.G);
|
|
576
|
-
for (const [
|
|
577
|
-
|
|
576
|
+
for (const [r, s] of i)
|
|
577
|
+
q.ATTRIBUTES[r] && (e.disableVertexAttribArray(s), e.vertexAttribDivisor(s, 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 re(e, i), this.mi = new se(this.Ys), this._i = new ne(t, e);
|
|
590
590
|
}
|
|
591
591
|
yi(t) {
|
|
592
|
-
var
|
|
592
|
+
var r, s, h, o, c, l, u, f, d, g;
|
|
593
593
|
const e = [0, 0, 0, 0], i = [0, 0, 0, 0];
|
|
594
|
-
return t.Os && t.
|
|
594
|
+
return t.Os && t.Bs ? (e[0] = ((r = t.Is) == null ? void 0 : r[0]) ?? 0, e[1] = ((s = t.Is) == null ? void 0 : s[1]) ?? 0, e[2] = ((h = t.Hs) == null ? void 0 : h[0]) ?? 0, e[3] = ((o = t.Hs) == null ? void 0 : o[1]) ?? 0, i[0] = t.Os[0], i[1] = t.Os[1], i[2] = t.Bs[0], i[3] = t.Bs[1]) : t.Ls && (e[0] = t.Ls[0], e[1] = t.Ls[1]), this.oi({ x: t.bs[0], y: t.bs[1], width: t.Ss[0], height: t.Ss[1], char0: t.Nt[0], char1: t.Nt[1], char2: t.Nt[2], r1: t.Xt[0], g1: t.Xt[1], b1: t.Xt[2], a1: t.Xt[3], r2: t.Yt[0], g2: t.Yt[1], b2: t.Yt[2], a2: t.Yt[3], invert: t.zs[0], flipX: t.zs[1], flipY: t.zs[2], charRot: t.Rt, translationX: ((c = t.ks) == null ? void 0 : c[0]) ?? 0, translationY: ((l = t.ks) == null ? void 0 : l[1]) ?? 0, translationZ: ((u = t.ks) == null ? void 0 : u[2]) ?? 0, rotationX: ((f = t.Ds) == null ? void 0 : f[0]) ?? 0, rotationY: ((d = t.Ds) == null ? void 0 : d[1]) ?? 0, rotationZ: ((g = t.Ds) == null ? void 0 : g[2]) ?? 0, curveParams0: e, curveParams1: i, depth: t.Gs || 0, baseZ: t.Qs || 0, geometryType: t.Ns || 0 });
|
|
595
595
|
}
|
|
596
596
|
oi(t) {
|
|
597
597
|
const e = this.mi.oi(t);
|
|
@@ -624,15 +624,15 @@ class he {
|
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
626
|
class O {
|
|
627
|
-
constructor(t, e, i,
|
|
627
|
+
constructor(t, e, i, r) {
|
|
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 = r;
|
|
634
|
+
const s = this.A.createBuffer();
|
|
635
|
+
Rt(this.A, this.A.ARRAY_BUFFER, s, this.xi.Fi, this.A.STATIC_DRAW), this.Mi = s;
|
|
636
636
|
}
|
|
637
637
|
get type() {
|
|
638
638
|
return this.Ci;
|
|
@@ -658,77 +658,77 @@ class O {
|
|
|
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, r, s, h) {
|
|
662
|
+
const o = s.Bt ?? 0, c = s.It ?? 0, l = s.Ht ?? 0, u = s.bt ?? 0, f = s.Ct ?? 0, d = s.xt ?? 0, g = [0, 0, 0, 0], p = [0, 0, 0, 0];
|
|
663
663
|
h && (h.bezStartX !== void 0 && h.bezStartY !== void 0 && h.bezEndX !== void 0 && h.bezEndY !== void 0 ? (g[0] = h.cp1x ?? 0, g[1] = h.cp1y ?? 0, g[2] = h.cp2x ?? 0, g[3] = h.cp2y ?? 0, p[0] = h.bezStartX ?? 0, p[1] = h.bezStartY ?? 0, p[2] = h.bezEndX ?? 0, p[3] = h.bezEndY ?? 0) : h.arcStart === void 0 && h.arcStop === void 0 || (g[0] = h.arcStart ?? 0, g[1] = h.arcStop ?? 0));
|
|
664
|
-
const v = { x: t, y: e, width: i, height:
|
|
664
|
+
const v = { x: t, y: e, width: i, height: r, char0: s.Nt[0], char1: s.Nt[1], char2: s.Nt[2], r1: s.Xt[0], g1: s.Xt[1], b1: s.Xt[2], a1: s.Xt[3], r2: s.Yt[0], g2: s.Yt[1], b2: s.Yt[2], a2: s.Yt[3], invert: s.Et ? 1 : 0, flipX: s.Gt ? 1 : 0, flipY: s.Qt ? 1 : 0, charRot: s.Rt, translationX: o, translationY: c, translationZ: l, rotationX: u, rotationY: f, rotationZ: d, curveParams0: g, curveParams1: p, depth: (h == null ? void 0 : h.depth) ?? 0, baseZ: (h == null ? void 0 : h.baseZ) ?? 0, geometryType: ee[this.Ci] ?? 0 };
|
|
665
665
|
return this.bi.oi(v);
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
|
-
const oe = { Fi: dt, Ri: 6, ...
|
|
668
|
+
const oe = { Fi: dt, Ri: 6, ...Y }, 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, ...Y }, 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 r = i * e, s = (i + 1) % n * e, h = Math.cos(r), o = Math.sin(r), c = 0.5 * (h + 1), l = 0.5 * (o + 1), u = Math.cos(s), f = Math.sin(s), d = 0.5 * (u + 1), g = 0.5 * (f + 1);
|
|
672
672
|
t.push(0, 0, 0.5, 0.5, h, o, c, l, u, f, d, g);
|
|
673
673
|
}
|
|
674
674
|
return new Float32Array(t);
|
|
675
|
-
}(32), Ri: 96, ...
|
|
675
|
+
}(32), Ri: 96, ...Y };
|
|
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, r = (e + 1) / n;
|
|
680
|
+
t.push(i, 0, i, 0, i, 1, i, 1, r, 1, r, 1);
|
|
681
681
|
}
|
|
682
682
|
return new Float32Array(t);
|
|
683
|
-
}(32), Ri: 96, ...
|
|
684
|
-
const ue = { Fi: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ri: 3, ...
|
|
683
|
+
}(32), Ri: 96, ...Y };
|
|
684
|
+
const ue = { Fi: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ri: 3, ...Y }, 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, r = (e + 1) / n;
|
|
688
|
+
t.push(i, -0.5, i, 0, r, -0.5, r, 0, i, 0.5, i, 1, i, 0.5, i, 1, r, -0.5, r, 0, r, 0.5, r, 1);
|
|
689
689
|
}
|
|
690
690
|
return new Float32Array(t);
|
|
691
|
-
}(16), Ri: 96, ...
|
|
691
|
+
}(16), Ri: 96, ...Y }, de = { [b.RECTANGLE]: class extends O {
|
|
692
692
|
constructor(n, t) {
|
|
693
|
-
super(n, t,
|
|
693
|
+
super(n, t, b.RECTANGLE, oe);
|
|
694
694
|
}
|
|
695
695
|
yi(n, t) {
|
|
696
696
|
return this.Ei(0, 0, n.width, n.height, t);
|
|
697
697
|
}
|
|
698
|
-
}, [
|
|
698
|
+
}, [b.LINE]: class extends O {
|
|
699
699
|
constructor(n, t) {
|
|
700
|
-
super(n, t,
|
|
700
|
+
super(n, t, b.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, r = Math.hypot(e, i), s = Math.atan2(i, e), h = t.Ot || 1, o = n.x1 + e / 2 - r / 2, c = n.y1 + i / 2, l = { ...t, xt: (t.xt || 0) + s };
|
|
704
|
+
return this.Ei(o, c, r, h, l);
|
|
705
705
|
}
|
|
706
|
-
}, [
|
|
706
|
+
}, [b.ELLIPSE]: class extends O {
|
|
707
707
|
constructor(n, t) {
|
|
708
|
-
super(n, t,
|
|
708
|
+
super(n, t, b.ELLIPSE, ce);
|
|
709
709
|
}
|
|
710
710
|
yi(n, t) {
|
|
711
711
|
return this.Ei(0, 0, n.width, n.height, t);
|
|
712
712
|
}
|
|
713
|
-
}, [
|
|
713
|
+
}, [b.ARC]: class extends O {
|
|
714
714
|
constructor(n, t) {
|
|
715
|
-
super(n, t,
|
|
715
|
+
super(n, t, b.ARC, le);
|
|
716
716
|
}
|
|
717
717
|
yi(n, t) {
|
|
718
718
|
const e = n.start * Math.PI / 180, i = n.stop * Math.PI / 180;
|
|
719
719
|
return this.Ei(0, 0, n.width, n.height, t, { arcStart: e, arcStop: i });
|
|
720
720
|
}
|
|
721
|
-
}, [
|
|
721
|
+
}, [b.TRIANGLE]: class extends O {
|
|
722
722
|
constructor(n, t) {
|
|
723
|
-
super(n, t,
|
|
723
|
+
super(n, t, b.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), r = Math.min(n.y1, n.y2, n.y3), s = i - e, h = Math.max(n.y1, n.y2, n.y3) - r;
|
|
727
|
+
return this.Ei(e, r, s, h, t);
|
|
728
728
|
}
|
|
729
|
-
}, [
|
|
729
|
+
}, [b.BEZIER_CURVE]: class extends O {
|
|
730
730
|
constructor(n, t) {
|
|
731
|
-
super(n, t,
|
|
731
|
+
super(n, t, b.BEZIER_CURVE, fe);
|
|
732
732
|
}
|
|
733
733
|
yi(n, t) {
|
|
734
734
|
return this.Ei(0, 0, 1, t.Ot || 1, t, { cp1x: n.cp1x, cp1y: n.cp1y, cp2x: n.cp2x, cp2y: n.cp2y, bezStartX: n.x1, bezStartY: n.y1, bezEndX: n.x2, bezEndY: n.y2 });
|
|
@@ -740,9 +740,9 @@ class ge {
|
|
|
740
740
|
a(this, "Si");
|
|
741
741
|
a(this, "zi");
|
|
742
742
|
this.A = t, this.zi = new ie(t), this.Si = /* @__PURE__ */ new Map();
|
|
743
|
-
for (const e of Object.values(
|
|
744
|
-
const i = new he(t),
|
|
745
|
-
this.Si.set(e,
|
|
743
|
+
for (const e of Object.values(b)) {
|
|
744
|
+
const i = new he(t), r = new de[e](t, i);
|
|
745
|
+
this.Si.set(e, r);
|
|
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, r = null, s = null;
|
|
756
|
+
for (const h of t) r !== h.material || s !== h.type ? (i && i.length > 0 && e.push({ material: r, type: s, commands: i }), i = [h], r = h.material, s = h.type) : i.push(h);
|
|
757
|
+
return i && i.length > 0 && e.push({ material: r, type: s, commands: i }), e;
|
|
758
758
|
}
|
|
759
759
|
Li(t) {
|
|
760
|
-
const { material: e, type: i, commands:
|
|
760
|
+
const { material: e, type: i, commands: r } = t, s = this.Si.get(i);
|
|
761
761
|
e.shader.D(), e.shader.O(e.uniforms);
|
|
762
|
-
const h = Ct(this.A), o =
|
|
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 = r.length > 0 && r[0].state.zt;
|
|
763
|
+
if (e.shader.O({ Uu: h[2] / h[3], Ur: [h[2], h[3]], Us: 1, Ut: o ? 1 : 0 }), s.$i(), r.forEach((c) => {
|
|
764
|
+
s.yi(c.params, c.state);
|
|
765
|
+
}), s.Pi()) {
|
|
766
|
+
const c = s.unitGeometry, l = s.unitBuffer;
|
|
767
767
|
try {
|
|
768
|
-
this.zi.Ts(e.shader.G, i + "", c, l),
|
|
768
|
+
this.zi.Ts(e.shader.G, i + "", c, l), s.batch.pi(e.shader), s.batch.$s(c.As, c.Ri);
|
|
769
769
|
} finally {
|
|
770
|
-
|
|
770
|
+
s.batch.gi(e.shader), this.zi.Es(), s.$i();
|
|
771
771
|
}
|
|
772
772
|
}
|
|
773
773
|
}
|
|
@@ -784,65 +784,65 @@ function Mt(n) {
|
|
|
784
784
|
}
|
|
785
785
|
const yt = /* @__PURE__ */ new WeakMap();
|
|
786
786
|
let ve = 1;
|
|
787
|
-
function
|
|
787
|
+
function wt(n) {
|
|
788
788
|
if (n == null) return 0;
|
|
789
789
|
if (typeof n != "object" && typeof n != "function") return Mt(n + "");
|
|
790
790
|
let t = yt.get(n);
|
|
791
791
|
return t || (t = ve++, yt.set(n, t)), t;
|
|
792
792
|
}
|
|
793
|
-
function
|
|
793
|
+
function H(n, t) {
|
|
794
794
|
return (n << 5) - n + t;
|
|
795
795
|
}
|
|
796
796
|
class pe {
|
|
797
797
|
constructor(t) {
|
|
798
798
|
a(this, "Oi", 0);
|
|
799
|
-
a(this, "Ii");
|
|
800
799
|
a(this, "Bi");
|
|
800
|
+
a(this, "Ii");
|
|
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.Bi = new W(t, rt, `#version 300 es
|
|
803
|
+
precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellColor;in vec4 v_glyphFlags;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){int B=int(v_glyphFlags.r>0.5?1:0);int C=int(v_glyphFlags.g>0.5?1:0);int D=int(v_glyphFlags.b>0.5?1:0);float E=float(B|(C<<1)|(D<<2))/255.;o_character=vec4(v_glyphIndex.xy,E,clamp(v_glyphFlags.a,0.,1.));o_primaryColor=vec4(v_glyphColor.rgb,v_glyphColor.a);o_secondaryColor=vec4(v_cellColor.rgb,v_cellColor.a);A=vec4(0.);}`), this.Ii = { id: this.Oi++, shader: this.Bi, uniforms: Object.freeze({}), hash: this.Gi(this.Bi, {}), isBuiltIn: !0 };
|
|
804
804
|
}
|
|
805
805
|
get Qi() {
|
|
806
|
-
return this.
|
|
806
|
+
return this.Ii;
|
|
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 r = this.Gi(t, e), s = this.Hi.get(r);
|
|
810
|
+
if (s) return s;
|
|
811
|
+
const h = { id: this.Oi++, shader: t, uniforms: Object.freeze({ ...e }), hash: r, isBuiltIn: i };
|
|
812
|
+
return this.Hi.set(r, h), h;
|
|
813
813
|
}
|
|
814
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 =
|
|
818
|
+
const i = wt(t.G), r = function(s, h) {
|
|
819
819
|
let o = 0;
|
|
820
|
-
const c = Object.keys(
|
|
821
|
-
for (const l of c) o =
|
|
820
|
+
const c = Object.keys(s).sort();
|
|
821
|
+
for (const l of c) o = H(o, Mt(l)), o = H(o, h(s[l]));
|
|
822
822
|
return o;
|
|
823
823
|
}(e, this.Xi.bind(this));
|
|
824
|
-
return
|
|
824
|
+
return H(i, r);
|
|
825
825
|
}
|
|
826
826
|
Xi(t) {
|
|
827
827
|
return typeof t == "number" || typeof t == "boolean" ? function(e) {
|
|
828
828
|
return typeof e == "boolean" ? e ? 1 : 0 : Math.floor(e);
|
|
829
829
|
}(t) : Array.isArray(t) ? function(e) {
|
|
830
830
|
let i = 0;
|
|
831
|
-
const
|
|
832
|
-
for (const
|
|
831
|
+
const r = Array.isArray(e[0]) ? e.flat() : e;
|
|
832
|
+
for (const s of r) i = H(i, typeof s == "number" ? s : 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 r = Math.min(e.length, 16);
|
|
837
|
+
for (let s = 0; s < r; s++) i = H(i, e[s]);
|
|
838
838
|
return i;
|
|
839
|
-
}(t) : t instanceof WebGLTexture ?
|
|
839
|
+
}(t) : t instanceof WebGLTexture ? wt(t) : 0;
|
|
840
840
|
}
|
|
841
841
|
gt() {
|
|
842
|
-
this.
|
|
842
|
+
this.Bi != this.Bi && this.Bi.dispose(), this.Bi.dispose(), this.Hi.clear();
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
|
-
class
|
|
845
|
+
class Ae {
|
|
846
846
|
constructor() {
|
|
847
847
|
a(this, "Yi", []);
|
|
848
848
|
a(this, "ji", 1);
|
|
@@ -850,35 +850,35 @@ class me {
|
|
|
850
850
|
}
|
|
851
851
|
Ki(t, e) {
|
|
852
852
|
if (this.Ss >= this.Yi.length) {
|
|
853
|
-
const
|
|
854
|
-
this.Yi.push(
|
|
853
|
+
const r = { id: this.ji++, type: t, params: {}, state: st.Lt(), material: e };
|
|
854
|
+
this.Yi.push(r);
|
|
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 r = this.Ki(b.RECTANGLE, i), s = r.params;
|
|
861
|
+
return s.width = t.width, s.height = t.height, e.Wt(r.state), r.id;
|
|
862
862
|
}
|
|
863
863
|
Zi(t, e, i) {
|
|
864
|
-
const
|
|
865
|
-
return
|
|
864
|
+
const r = this.Ki(b.LINE, i), s = r.params;
|
|
865
|
+
return s.x1 = t.x1, s.y1 = t.y1, s.x2 = t.x2, s.y2 = t.y2, s.thickness = t.thickness, e.Wt(r.state), r.id;
|
|
866
866
|
}
|
|
867
867
|
qi(t, e, i) {
|
|
868
|
-
const
|
|
869
|
-
return
|
|
868
|
+
const r = this.Ki(b.ELLIPSE, i), s = r.params;
|
|
869
|
+
return s.width = t.width, s.height = t.height, s.startAngle = t.startAngle, s.endAngle = t.endAngle, s.segments = t.segments, e.Wt(r.state), r.id;
|
|
870
870
|
}
|
|
871
871
|
Vi(t, e, i) {
|
|
872
|
-
const
|
|
873
|
-
return
|
|
872
|
+
const r = this.Ki(b.ARC, i), s = r.params;
|
|
873
|
+
return s.width = t.width, s.height = t.height, s.start = t.start, s.stop = t.stop, e.Wt(r.state), r.id;
|
|
874
874
|
}
|
|
875
875
|
Ji(t, e, i) {
|
|
876
|
-
const
|
|
877
|
-
return
|
|
876
|
+
const r = this.Ki(b.TRIANGLE, i), s = r.params;
|
|
877
|
+
return s.x1 = t.x1, s.y1 = t.y1, s.x2 = t.x2, s.y2 = t.y2, s.x3 = t.x3, s.y3 = t.y3, e.Wt(r.state), r.id;
|
|
878
878
|
}
|
|
879
879
|
te(t, e, i) {
|
|
880
|
-
const
|
|
881
|
-
return
|
|
880
|
+
const r = this.Ki(b.BEZIER_CURVE, i), s = r.params;
|
|
881
|
+
return s.x1 = t.x1, s.y1 = t.y1, s.cp1x = t.cp1x, s.cp1y = t.cp1y, s.cp2x = t.cp2x, s.cp2y = t.cp2y, s.x2 = t.x2, s.y2 = t.y2, s.thickness = t.thickness, s.segments = t.segments, e.Wt(r.state), r.id;
|
|
882
882
|
}
|
|
883
883
|
wi() {
|
|
884
884
|
this.Ss = 0;
|
|
@@ -889,7 +889,7 @@ class me {
|
|
|
889
889
|
return { next: () => t < e ? { value: i[t++], done: !1 } : { value: void 0, done: !0 } };
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
|
-
class
|
|
892
|
+
class me {
|
|
893
893
|
constructor(t) {
|
|
894
894
|
a(this, "A");
|
|
895
895
|
a(this, "se", null);
|
|
@@ -906,7 +906,7 @@ class Ae {
|
|
|
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 st(), this.vt = new pe(t), this.re = new Ae(), this.ie = new ge(t), this.ne = new te(t);
|
|
910
910
|
const e = [0, 0, t.canvas.width, t.canvas.height];
|
|
911
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,17 +917,17 @@ class Ae {
|
|
|
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, r = 1) {
|
|
921
|
+
const s = this.A;
|
|
922
|
+
this.ue !== t && (s.bindFramebuffer(s.FRAMEBUFFER, t), this.ue = t), this.de = r;
|
|
923
923
|
const h = [0, 0, e, i];
|
|
924
|
-
this.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] || (s.viewport(...h), ht(s, h), this.fe = h);
|
|
925
925
|
}
|
|
926
926
|
ve(t) {
|
|
927
927
|
this.se !== t && (this.se = t, t.D());
|
|
928
928
|
}
|
|
929
929
|
pe(t, e) {
|
|
930
|
-
return new
|
|
930
|
+
return new W(this.A, t, e);
|
|
931
931
|
}
|
|
932
932
|
ge(t) {
|
|
933
933
|
this.oe = t, t && (this.he = {});
|
|
@@ -939,13 +939,13 @@ class Ae {
|
|
|
939
939
|
Object.assign(this.he, t);
|
|
940
940
|
}
|
|
941
941
|
_e(t) {
|
|
942
|
-
return new
|
|
942
|
+
return new W(this.A, rt, t);
|
|
943
943
|
}
|
|
944
|
-
ye(t, e, i,
|
|
945
|
-
t instanceof
|
|
944
|
+
ye(t, e, i, r) {
|
|
945
|
+
t instanceof X || !r || t.Ae(r), this.re.Wi({ width: e ?? t.width, height: i ?? t.height }, this.ee, t.ut());
|
|
946
946
|
}
|
|
947
|
-
we(t, e, i,
|
|
948
|
-
this.ne.$s(t, e, i,
|
|
947
|
+
we(t, e, i, r) {
|
|
948
|
+
this.ne.$s(t, e, i, r);
|
|
949
949
|
}
|
|
950
950
|
be(t, e) {
|
|
951
951
|
if (this.oe) {
|
|
@@ -953,39 +953,39 @@ class Ae {
|
|
|
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, r) {
|
|
957
|
+
this.re.Zi({ x1: t, y1: e, x2: i, y2: r }, 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, r, s, h) {
|
|
963
|
+
this.re.Ji({ x1: t, y1: e, x2: i, y2: r, x3: s, y3: h }, this.ee, this.vt.Qi);
|
|
964
964
|
}
|
|
965
|
-
Fe(t, e, i,
|
|
966
|
-
this.re.te({ x1: t, y1: e, cp1x: i, cp1y:
|
|
965
|
+
Fe(t, e, i, r, s, h, o, c) {
|
|
966
|
+
this.re.te({ x1: t, y1: e, cp1x: i, cp1y: r, cp2x: s, cp2y: h, x2: o, y2: c }, this.ee, this.vt.Qi);
|
|
967
967
|
}
|
|
968
|
-
$e(t, e, i,
|
|
969
|
-
this.re.Vi({ width: t, height: e, start: i, stop:
|
|
968
|
+
$e(t, e, i, r) {
|
|
969
|
+
this.re.Vi({ width: t, height: e, start: i, stop: r }, this.ee, this.vt.Qi);
|
|
970
970
|
}
|
|
971
|
-
Pe(t, e, i = 1,
|
|
972
|
-
return new
|
|
971
|
+
Pe(t, e, i = 1, r = {}) {
|
|
972
|
+
return new X(this.A, t, e, i, r, 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, r = 255) {
|
|
975
|
+
this.ee.ps(t, e ?? t, i ?? t, r);
|
|
976
|
+
const [s, h, o, c] = this.ee.canvasBackgroundColor;
|
|
977
|
+
this.Ee(s, h, o, c, !1);
|
|
978
978
|
}
|
|
979
|
-
wi(t = 0, e = 0, i = 0,
|
|
980
|
-
this.Ee(t, e, i,
|
|
979
|
+
wi(t = 0, e = 0, i = 0, r = 0) {
|
|
980
|
+
this.Ee(t, e, i, r, !0);
|
|
981
981
|
}
|
|
982
|
-
Ee(t, e, i,
|
|
982
|
+
Ee(t, e, i, r, s) {
|
|
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 = s ? [1, 1, 0, 0] : [0, 0, 0, 0];
|
|
986
|
+
h.clearBufferfv(h.COLOR, 0, new Float32Array(o)), h.clearBufferfv(h.COLOR, 1, new Float32Array([0, 0, 0, 0])), this.de >= 3 && h.clearBufferfv(h.COLOR, 2, new Float32Array([t, e, i, r]));
|
|
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, r), h.clear(h.COLOR_BUFFER_BIT);
|
|
989
989
|
}
|
|
990
990
|
Re() {
|
|
991
991
|
const t = [0, 0, this.A.canvas.width, this.A.canvas.height];
|
|
@@ -1010,26 +1010,26 @@ class Ae {
|
|
|
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 r = 0; r < e; r++) i.push(R.readUshort(n, t + 2 * r));
|
|
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 r = 0; r < e; r++) i += String.fromCharCode(n[t + r]);
|
|
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 K(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 B(n, t, e) {
|
|
1033
1033
|
n[t] = e >>> 24 & 255, n[t + 1] = e >>> 16 & 255, n[t + 2] = e >>> 8 & 255, n[t + 3] = 255 & e;
|
|
1034
1034
|
}
|
|
1035
1035
|
function ye(n, t, e) {
|
|
@@ -1037,12 +1037,12 @@ 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 r = 0;
|
|
1041
|
+
const s = R.t;
|
|
1042
|
+
for (let h = t; h < i; h += 4) s.uint8[3] = n[h] || 0, s.uint8[2] = n[h + 1] || 0, s.uint8[1] = n[h + 2] || 0, s.uint8[0] = n[h + 3] || 0, r = r + (s.uint32[0] >>> 0) >>> 0;
|
|
1043
|
+
return r >>> 0;
|
|
1044
1044
|
}
|
|
1045
|
-
class
|
|
1045
|
+
class we {
|
|
1046
1046
|
constructor(t) {
|
|
1047
1047
|
a(this, "b");
|
|
1048
1048
|
a(this, "p", 0);
|
|
@@ -1065,21 +1065,21 @@ class be {
|
|
|
1065
1065
|
return this.p;
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
|
-
function
|
|
1068
|
+
function G(n) {
|
|
1069
1069
|
let t = 32, e = 0;
|
|
1070
1070
|
for (const o of n) o && (o < t && (t = o), o > e && (e = o));
|
|
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 r = new Uint32Array(e + 1);
|
|
1075
|
+
let s = 0;
|
|
1076
1076
|
i[0] = 0;
|
|
1077
|
-
for (let o = 1; o <= e; o++)
|
|
1077
|
+
for (let o = 1; o <= e; o++) s = s + i[o - 1] << 1, r[o] = s;
|
|
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 = r[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 r = t.table.get(i);
|
|
1093
|
+
if (r && e < r.length) {
|
|
1094
|
+
const s = r[e];
|
|
1095
|
+
if (s !== void 0) return s;
|
|
1096
1096
|
}
|
|
1097
1097
|
}
|
|
1098
1098
|
throw Error("Invalid Huffman code");
|
|
@@ -1102,221 +1102,221 @@ function Ee(n, t) {
|
|
|
1102
1102
|
for (let i = 0; i < t; i++) e = e << 1 | 1 & n, n >>>= 1;
|
|
1103
1103
|
return e >>> 0;
|
|
1104
1104
|
}
|
|
1105
|
-
function
|
|
1105
|
+
function be(n) {
|
|
1106
1106
|
if (n.length < 2) throw Error("ZLIB data too short");
|
|
1107
1107
|
const t = n[0], e = n[1];
|
|
1108
1108
|
if ((15 & t) != 8) throw Error("Unsupported ZLIB compression method");
|
|
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 r = [];
|
|
1113
|
+
return function(s, 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 = s.readBits(1);
|
|
1118
|
+
const d = s.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
|
+
s.alignToByte();
|
|
1121
|
+
const g = s.readBits(16);
|
|
1122
|
+
if ((65535 & (65535 ^ g)) !== s.readBits(16)) throw Error("DEFLATE uncompressed LEN/NLEN mismatch");
|
|
1123
|
+
for (let p = 0; p < g; p++) h.push(s.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
|
|
1134
|
-
g =
|
|
1130
|
+
for (let A = 0; A <= 143; A++) v[A] = 8;
|
|
1131
|
+
for (let A = 144; A <= 255; A++) v[A] = 9;
|
|
1132
|
+
for (let A = 256; A <= 279; A++) v[A] = 7;
|
|
1133
|
+
for (let A = 280; A <= 287; A++) v[A] = 8;
|
|
1134
|
+
g = G(v), p = G(Array(32).fill(5));
|
|
1135
1135
|
} else {
|
|
1136
|
-
const v =
|
|
1137
|
-
for (let T = 0; T <
|
|
1138
|
-
const x =
|
|
1139
|
-
for (; E.length < v +
|
|
1140
|
-
const T = at(
|
|
1136
|
+
const v = s.readBits(5) + 257, A = s.readBits(5) + 1, m = s.readBits(4) + 4, w = [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 < m; T++) y[w[T]] = s.readBits(3);
|
|
1138
|
+
const x = G(y), E = [];
|
|
1139
|
+
for (; E.length < v + A; ) {
|
|
1140
|
+
const T = at(s, x);
|
|
1141
1141
|
if (T <= 15) E.push(T);
|
|
1142
1142
|
else if (T === 16) {
|
|
1143
|
-
const L =
|
|
1144
|
-
for (let
|
|
1143
|
+
const L = s.readBits(2) + 3, C = E[E.length - 1] || 0;
|
|
1144
|
+
for (let Q = 0; Q < L; Q++) E.push(C);
|
|
1145
1145
|
} else if (T === 17) {
|
|
1146
|
-
const L =
|
|
1146
|
+
const L = s.readBits(3) + 3;
|
|
1147
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 =
|
|
1151
|
+
const L = s.readBits(7) + 11;
|
|
1152
1152
|
for (let C = 0; C < L; C++) E.push(0);
|
|
1153
1153
|
}
|
|
1154
1154
|
}
|
|
1155
1155
|
}
|
|
1156
|
-
const F = E.slice(0, v), P = E.slice(v, v +
|
|
1157
|
-
g =
|
|
1156
|
+
const F = E.slice(0, v), P = E.slice(v, v + A);
|
|
1157
|
+
g = G(F), p = G(P);
|
|
1158
1158
|
}
|
|
1159
1159
|
for (; ; ) {
|
|
1160
|
-
const v = at(
|
|
1160
|
+
const v = at(s, 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
|
|
1168
|
-
|
|
1169
|
-
const y = at(
|
|
1165
|
+
const A = v - 257;
|
|
1166
|
+
let m = o[A];
|
|
1167
|
+
const w = c[A];
|
|
1168
|
+
w && (m += s.readBits(w));
|
|
1169
|
+
const y = at(s, 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 +=
|
|
1173
|
+
E && (x += s.readBits(E));
|
|
1174
1174
|
const F = h.length - x;
|
|
1175
1175
|
if (F < 0) throw Error("Invalid distance");
|
|
1176
|
-
for (let P = 0; P <
|
|
1176
|
+
for (let P = 0; P < m; 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
|
|
1183
|
+
}(new we(n.subarray(i)), r), new Uint8Array(r);
|
|
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), r = t.readUshort(e, 12), s = t.readUint(e, 16), h = [];
|
|
1189
1189
|
let o = 44;
|
|
1190
|
-
for (let
|
|
1191
|
-
const
|
|
1192
|
-
h.push({ tag:
|
|
1193
|
-
}
|
|
1194
|
-
for (const
|
|
1195
|
-
const
|
|
1196
|
-
if (
|
|
1197
|
-
else if (
|
|
1198
|
-
const y = new Uint8Array(
|
|
1199
|
-
y.set(
|
|
1200
|
-
} else
|
|
1201
|
-
}
|
|
1202
|
-
const c =
|
|
1190
|
+
for (let m = 0; m < r; m++) {
|
|
1191
|
+
const w = 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: w, offset: y, compLength: x, origLength: E, checksum: F }), o += 20;
|
|
1193
|
+
}
|
|
1194
|
+
for (const m of h) {
|
|
1195
|
+
const w = new Uint8Array(e.buffer, m.offset, m.compLength);
|
|
1196
|
+
if (m.compLength === m.origLength) m.data = new Uint8Array(w);
|
|
1197
|
+
else if (m.data = be(w), m.data.length !== m.origLength) if (m.data.length < m.origLength) {
|
|
1198
|
+
const y = new Uint8Array(m.origLength);
|
|
1199
|
+
y.set(m.data), m.data = y;
|
|
1200
|
+
} else m.data = m.data.subarray(0, m.origLength);
|
|
1201
|
+
}
|
|
1202
|
+
const c = r;
|
|
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
|
|
1215
|
-
if (
|
|
1216
|
-
const y = new Uint8Array(
|
|
1217
|
-
|
|
1208
|
+
for (const m of h) p[m.tag] = g, g = K(g + m.data.length);
|
|
1209
|
+
const v = new Uint8Array(Math.max(s || 0, g));
|
|
1210
|
+
B(v, 0, i), J(v, 4, c), J(v, 6, f), J(v, 8, u), J(v, 10, d);
|
|
1211
|
+
let A = 12;
|
|
1212
|
+
for (const m of h) {
|
|
1213
|
+
ye(v, A, m.tag), A += 4;
|
|
1214
|
+
let w = m.data;
|
|
1215
|
+
if (m.tag === "head" && w.length >= 12) {
|
|
1216
|
+
const y = new Uint8Array(w);
|
|
1217
|
+
B(y, 8, 0), B(v, A, ot(y, 0, K(y.length))), A += 4;
|
|
1218
1218
|
} else
|
|
1219
|
-
|
|
1220
|
-
|
|
1219
|
+
B(v, A, ot(w, 0, K(w.length))), A += 4;
|
|
1220
|
+
B(v, A, p[m.tag]), A += 4, B(v, A, m.data.length), A += 4;
|
|
1221
1221
|
}
|
|
1222
|
-
for (const
|
|
1223
|
-
const
|
|
1224
|
-
v.set(
|
|
1222
|
+
for (const m of h) {
|
|
1223
|
+
const w = p[m.tag];
|
|
1224
|
+
v.set(m.data, w);
|
|
1225
1225
|
}
|
|
1226
|
-
if (h.find((
|
|
1227
|
-
const
|
|
1226
|
+
if (h.find((m) => m.tag === "head")) {
|
|
1227
|
+
const m = p.head, w = function(y, x) {
|
|
1228
1228
|
const E = x + 8, F = [y[E], y[E + 1], y[E + 2], y[E + 3]];
|
|
1229
|
-
|
|
1230
|
-
const P = 2981146554 - (ot(y, 0,
|
|
1229
|
+
B(y, E, 0);
|
|
1230
|
+
const P = 2981146554 - (ot(y, 0, K(y.length)) >>> 0) >>> 0;
|
|
1231
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,
|
|
1233
|
-
|
|
1232
|
+
}(v, m);
|
|
1233
|
+
B(v, m + 8, w);
|
|
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 r = R, s = r.readUshort, h = s(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 = s(n, t), u = s(n, t += 2);
|
|
1245
1245
|
t += 2;
|
|
1246
|
-
const f =
|
|
1246
|
+
const f = r.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 = s(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, r = e.readUshorts, s = 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 = r(n, t, o), t += 2 * o, t += 2, c.startCount = r(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 = r(n, t, o), t += 2 * o, c.glyphIdArray = r(n, t, s + 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 r = new Uint32Array(3 * i);
|
|
1272
|
+
for (let s = 0; s < 3 * i; s += 3) r[s] = e(n, t + (s << 2)), r[s + 1] = e(n, t + (s << 2) + 4), r[s + 2] = e(n, t + (s << 2) + 8);
|
|
1273
|
+
return { format: 12, groups: r };
|
|
1274
1274
|
} }, Re = { parseTab(n, t, e) {
|
|
1275
1275
|
const i = R;
|
|
1276
1276
|
t += 18;
|
|
1277
|
-
const
|
|
1277
|
+
const r = i.readUshort(n, t);
|
|
1278
1278
|
t += 2, t += 16;
|
|
1279
|
-
const
|
|
1279
|
+
const s = 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:
|
|
1286
|
+
return t += 2, t += 6, { unitsPerEm: r, xMin: s, yMin: h, xMax: o, yMax: c, indexToLocFormat: i.readShort(n, t) };
|
|
1287
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 r = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], s = {};
|
|
1291
|
+
for (let h = 0; h < r.length; h++) {
|
|
1292
|
+
const o = r[h], c = o === "advanceWidthMax" || o === "numberOfHMetrics" ? i.readUshort : i.readShort;
|
|
1293
|
+
s[o] = c(n, t + 2 * h);
|
|
1294
1294
|
}
|
|
1295
|
-
return
|
|
1295
|
+
return s;
|
|
1296
1296
|
} }, Ce = { parseTab(n, t, e, i) {
|
|
1297
|
-
const
|
|
1297
|
+
const r = R, s = [], 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:
|
|
1299
|
+
for (; f < c; ) l = r.readUshort(n, t + (f << 2)), u = r.readShort(n, t + (f << 2) + 2), s.push(l), h.push(u), f++;
|
|
1300
|
+
for (; f < o; ) s.push(l), h.push(u), f++;
|
|
1301
|
+
return { aWidth: s, lsBearing: h };
|
|
1302
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
1305
|
} }, hmtx: Ce, loca: { parseTab(n, t, e, i) {
|
|
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 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);
|
|
1306
|
+
const r = R, s = [], h = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
|
|
1307
|
+
if (h === 0) for (let c = 0; c < o; c++) s.push(r.readUshort(n, t + (c << 1)) << 1);
|
|
1308
|
+
else if (h === 1) for (let c = 0; c < o; c++) s.push(r.readUint(n, t + (c << 2)));
|
|
1313
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);
|
|
1313
|
+
return r;
|
|
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, r = n.loca;
|
|
1316
|
+
if (r[t] === r[t + 1]) return null;
|
|
1317
|
+
const s = j.findTable(i, "glyf", n.ke);
|
|
1318
|
+
if (!s) return null;
|
|
1319
|
+
let h = s[0] + r[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, r = {}, s = { ze: e, De: 0, ke: 0 };
|
|
1356
1356
|
for (const h in i) {
|
|
1357
1357
|
const o = h, c = j.findTable(e, o, 0);
|
|
1358
1358
|
if (c) {
|
|
1359
1359
|
const [l, u] = c;
|
|
1360
|
-
let f =
|
|
1361
|
-
f == null && (f = i[o].parseTab(e, l, u,
|
|
1360
|
+
let f = r[l];
|
|
1361
|
+
f == null && (f = i[o].parseTab(e, l, u, s), r[l] = f), s[o] = f;
|
|
1362
1362
|
}
|
|
1363
1363
|
}
|
|
1364
|
-
return [
|
|
1364
|
+
return [s];
|
|
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, r = i.readUshort(n, e + 4);
|
|
1367
|
+
let s = e + 12;
|
|
1368
|
+
for (let h = 0; h < r; h++) {
|
|
1369
|
+
const o = i.readASCII(n, s, 4);
|
|
1370
|
+
i.readUint(n, s + 4);
|
|
1371
|
+
const c = i.readUint(n, s + 8), l = i.readUint(n, s + 12);
|
|
1372
1372
|
if (o === t) return [c, l];
|
|
1373
|
-
|
|
1373
|
+
s += 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((r) => {
|
|
1382
|
+
if (r.format === 4) {
|
|
1383
|
+
const s = this.Oe(r);
|
|
1384
|
+
e.push(...s);
|
|
1385
|
+
} else if (r.format === 12) {
|
|
1386
|
+
const s = this.Be(r);
|
|
1387
|
+
e.push(...s);
|
|
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 r = t.startCount[i], s = t.endCount[i];
|
|
1396
|
+
if (r !== 65535 || s !== 65535) {
|
|
1397
|
+
for (let h = r; h <= s; h++)
|
|
1398
|
+
if (this.Ie(t, h, i) > 0) try {
|
|
1399
1399
|
const o = String.fromCodePoint(h);
|
|
1400
1400
|
e.push(o);
|
|
1401
1401
|
} catch {
|
|
@@ -1404,13 +1404,13 @@ class Me {
|
|
|
1404
1404
|
}
|
|
1405
1405
|
return e;
|
|
1406
1406
|
}
|
|
1407
|
-
|
|
1407
|
+
Be(t) {
|
|
1408
1408
|
const e = [];
|
|
1409
1409
|
if (!t.groups) return e;
|
|
1410
1410
|
for (let i = 0; i < t.groups.length; i += 3) {
|
|
1411
|
-
const
|
|
1412
|
-
for (let o =
|
|
1413
|
-
if (h + (o -
|
|
1411
|
+
const r = t.groups[i], s = t.groups[i + 1], h = t.groups[i + 2];
|
|
1412
|
+
for (let o = r; o <= s; o++)
|
|
1413
|
+
if (h + (o - r) > 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
|
+
Ie(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 r = t.idRangeOffset[i] / 2 + (e - t.startCount[i]) - (t.startCount.length - i);
|
|
1425
|
+
if (r >= 0 && t.glyphIdArray && r < t.glyphIdArray.length) {
|
|
1426
|
+
const s = t.glyphIdArray[r];
|
|
1427
|
+
if (s !== 0) return s + 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, r) {
|
|
1441
|
+
const s = t.length, h = Math.ceil(Math.sqrt(s)), o = Math.ceil(s / h), c = e.width * h, l = e.height * o;
|
|
1442
|
+
this.Ne(c, l), this.Xe(t, e, h, i, r);
|
|
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, r, s) {
|
|
1450
|
+
const h = r / s.head.unitsPerEm;
|
|
1451
1451
|
for (let o = 0; o < t.length; o++) {
|
|
1452
1452
|
const c = o % i, l = Math.floor(o / i), u = t[o].glyphData;
|
|
1453
1453
|
if (!u) continue;
|
|
1454
|
-
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,
|
|
1455
|
-
this.Ye(u,
|
|
1454
|
+
const f = u.advanceWidth * h, d = c * e.width, g = l * e.height, p = d + 0.5 * e.width, v = g + 0.5 * e.height, A = Math.round(p - 0.5 * e.width), m = Math.round(v - 0.5 * r), w = A + 0.5 * (e.width - f), y = m + s.hhea.ascender * h;
|
|
1455
|
+
this.Ye(u, w, y, h);
|
|
1456
1456
|
}
|
|
1457
1457
|
}
|
|
1458
|
-
Ye(t, e, i,
|
|
1458
|
+
Ye(t, e, i, r) {
|
|
1459
1459
|
if (!t || !t.xs || t.noc === 0) return;
|
|
1460
|
-
let { xs:
|
|
1461
|
-
if (!(
|
|
1460
|
+
let { xs: s, ys: h, endPts: o, flags: c } = t;
|
|
1461
|
+
if (!(s && 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 + s[l] * r, g = i - h[l] * r;
|
|
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 + s[p] * r, A = i - h[p] * r;
|
|
1474
|
+
this.Ge.lineTo(v, A), p++;
|
|
1475
1475
|
} else {
|
|
1476
|
-
const v = e +
|
|
1476
|
+
const v = e + s[p] * r, A = i - h[p] * r;
|
|
1477
1477
|
if (p + 1 > f) {
|
|
1478
|
-
const
|
|
1479
|
-
if (1 & c[l]) this.Ge.quadraticCurveTo(v,
|
|
1478
|
+
const w = e + s[l] * r, y = i - h[l] * r;
|
|
1479
|
+
if (1 & c[l]) this.Ge.quadraticCurveTo(v, A, w, y);
|
|
1480
1480
|
else {
|
|
1481
|
-
const x = (v +
|
|
1482
|
-
this.Ge.quadraticCurveTo(v,
|
|
1481
|
+
const x = (v + w) / 2, E = (A + y) / 2;
|
|
1482
|
+
this.Ge.quadraticCurveTo(v, A, x, E);
|
|
1483
1483
|
}
|
|
1484
1484
|
break;
|
|
1485
1485
|
}
|
|
1486
|
-
const
|
|
1487
|
-
if (1 & c[
|
|
1488
|
-
const
|
|
1489
|
-
this.Ge.quadraticCurveTo(v,
|
|
1486
|
+
const m = p + 1;
|
|
1487
|
+
if (1 & c[m]) {
|
|
1488
|
+
const w = e + s[m] * r, y = i - h[m] * r;
|
|
1489
|
+
this.Ge.quadraticCurveTo(v, A, w, y), p = m + 1;
|
|
1490
1490
|
} else {
|
|
1491
|
-
const
|
|
1492
|
-
this.Ge.quadraticCurveTo(v,
|
|
1491
|
+
const w = (v + (e + s[m] * r)) / 2, y = (A + (i - h[m] * r)) / 2;
|
|
1492
|
+
this.Ge.quadraticCurveTo(v, A, w, y), p = m;
|
|
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 r = 0;
|
|
1508
|
+
for (const s of i.tables) if (s.format === 4 ? r = this.Ke(e, s) : s.format === 12 && (r = this.We(e, s)), r > 0) break;
|
|
1509
|
+
return r;
|
|
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, r = t.hhea.ascender * i, s = t.hhea.descender * i, h = t.hhea.lineGap * i;
|
|
1521
|
+
return { ascender: r, descender: s, lineGap: h, lineHeight: r - s + h, unitsPerEm: t.head.unitsPerEm, scale: i };
|
|
1522
1522
|
}
|
|
1523
1523
|
Ke(t, e) {
|
|
1524
1524
|
const i = e.endCount.length;
|
|
1525
|
-
let
|
|
1526
|
-
for (let
|
|
1527
|
-
|
|
1525
|
+
let r = -1;
|
|
1526
|
+
for (let s = 0; s < i; s++) if (t <= e.endCount[s]) {
|
|
1527
|
+
r = s;
|
|
1528
1528
|
break;
|
|
1529
1529
|
}
|
|
1530
|
-
if (
|
|
1531
|
-
if (e.idRangeOffset[
|
|
1530
|
+
if (r === -1 || t < e.startCount[r]) return 0;
|
|
1531
|
+
if (e.idRangeOffset[r] === 0) return t + e.idDelta[r] & 65535;
|
|
1532
1532
|
{
|
|
1533
|
-
const
|
|
1534
|
-
if (
|
|
1535
|
-
const h = e.glyphIdArray[
|
|
1536
|
-
return h === 0 ? 0 : h + e.idDelta[
|
|
1533
|
+
const s = e.idRangeOffset[r] / 2 + (t - e.startCount[r]) - (i - r);
|
|
1534
|
+
if (s >= 0 && s < e.glyphIdArray.length) {
|
|
1535
|
+
const h = e.glyphIdArray[s];
|
|
1536
|
+
return h === 0 ? 0 : h + e.idDelta[r] & 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 r = 0; r < i; r++) {
|
|
1544
|
+
const s = e.groups[3 * r], h = e.groups[3 * r + 1], o = e.groups[3 * r + 2];
|
|
1545
|
+
if (t >= s && t <= h) return o + (t - s);
|
|
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 r = 0;
|
|
1557
|
+
const s = this.Je.Ve(i, e), h = s.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) * s.scale;
|
|
1562
|
+
r = Math.max(r, l);
|
|
1563
1563
|
}
|
|
1564
|
-
return { width: Math.ceil(
|
|
1564
|
+
return { width: Math.ceil(r), 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 = [], r = /* @__PURE__ */ new Map();
|
|
1574
|
+
return t.forEach((s, h) => {
|
|
1575
|
+
const o = s.codePointAt(0) || 0, c = { character: s, unicode: o, color: this.er(h), glyphData: this.rr(e, s) };
|
|
1576
|
+
i.push(c), r.set(s, c);
|
|
1577
|
+
}), { array: i, map: r };
|
|
1578
1578
|
}
|
|
1579
1579
|
er(t) {
|
|
1580
1580
|
return [t % 256 / 255, Math.floor(t / 256) % 256 / 255, 0];
|
|
1581
1581
|
}
|
|
1582
1582
|
rr(t, e) {
|
|
1583
|
-
const i = e.codePointAt(0) || 0,
|
|
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, r = this.sr.je(t, i);
|
|
1584
|
+
if (r === 0) return null;
|
|
1585
|
+
let s = 0;
|
|
1586
|
+
t.hmtx && t.hmtx.aWidth && r > 0 && t.hmtx.aWidth[r] !== void 0 && (s = t.hmtx.aWidth[r]);
|
|
1587
|
+
const h = j.T.glyf.Se(t, r);
|
|
1588
|
+
return h ? { ...h, advanceWidth: s } : 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 r = j.parse(i);
|
|
1633
|
+
if (!r || r.length === 0) throw Error("Failed to parse font file");
|
|
1634
|
+
this.nr = r[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 r = this.mr.Qe(this.hr, this.vr, this.lr, this.nr);
|
|
1647
|
+
this.cr = r.framebuffer, this.ur = r.columns, this.dr = r.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, "Br", /* @__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
|
+
Ir() {
|
|
1706
|
+
if (this.N = this.Er * this.Dr, this.X = this.Rr * this.Lr, this.Sr = Math.floor((this.kr.width - this.N) / 2), this.zr = Math.floor((this.kr.height - this.X) / 2), this.Br.size > 0) for (const t of this.Br) t();
|
|
1707
1707
|
}
|
|
1708
1708
|
Hr(t) {
|
|
1709
|
-
this.
|
|
1709
|
+
this.Br.add(t);
|
|
1710
1710
|
}
|
|
1711
1711
|
Gr(t) {
|
|
1712
|
-
this.
|
|
1712
|
+
this.Br.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.Ir();
|
|
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.Ir();
|
|
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.Ir();
|
|
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.Br.clear();
|
|
1755
1755
|
}
|
|
1756
1756
|
}
|
|
1757
|
-
const
|
|
1757
|
+
const Ne = /^rgba?\(([^)]+)\)$/i;
|
|
1758
1758
|
function ct(n) {
|
|
1759
1759
|
return Number.isNaN(n) ? 0 : Math.max(0, Math.min(255, n));
|
|
1760
1760
|
}
|
|
1761
|
-
function
|
|
1761
|
+
function Be(n) {
|
|
1762
1762
|
if (!n) return null;
|
|
1763
1763
|
const t = n.trim().toLowerCase();
|
|
1764
1764
|
if (!t) return null;
|
|
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 r = Ne.exec(i.trim());
|
|
1768
|
+
if (!r) return null;
|
|
1769
|
+
const s = r[1].split(",").map((u) => u.trim());
|
|
1770
|
+
if (s.length < 3) return null;
|
|
1771
|
+
const h = ct(parseFloat(s[0])), o = ct(parseFloat(s[1])), c = ct(parseFloat(s[2])), l = s[3] !== void 0 ? 255 * Math.max(0, Math.min(1, parseFloat(s[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 De {
|
|
1776
1776
|
constructor(t = {}) {
|
|
1777
1777
|
a(this, "kr");
|
|
1778
1778
|
a(this, "Nr", null);
|
|
@@ -1788,14 +1788,14 @@ class _e {
|
|
|
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), r = Math.round(e.height);
|
|
1792
1792
|
if (this.Nr instanceof HTMLVideoElement) {
|
|
1793
1793
|
const o = this.Nr;
|
|
1794
|
-
(i === 0 ||
|
|
1794
|
+
(i === 0 || r === 0) && o.videoWidth > 0 && o.videoHeight > 0 && (i = o.videoWidth, r = o.videoHeight);
|
|
1795
1795
|
}
|
|
1796
|
-
t.width = i, t.height =
|
|
1797
|
-
const
|
|
1798
|
-
let h = parseInt(
|
|
1796
|
+
t.width = i, t.height = r, t.style.position = "absolute", t.style.pointerEvents = "none";
|
|
1797
|
+
const s = window.getComputedStyle(this.Nr);
|
|
1798
|
+
let h = parseInt(s.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 _e {
|
|
|
1810
1810
|
const t = this.qr();
|
|
1811
1811
|
for (const e of t) {
|
|
1812
1812
|
if (!e) continue;
|
|
1813
|
-
const i =
|
|
1813
|
+
const i = Be(window.getComputedStyle(e).backgroundColor);
|
|
1814
1814
|
if (i) return i;
|
|
1815
1815
|
}
|
|
1816
1816
|
return [255, 255, 255, 255];
|
|
@@ -1857,45 +1857,45 @@ class _e {
|
|
|
1857
1857
|
}
|
|
1858
1858
|
}
|
|
1859
1859
|
function $(n) {
|
|
1860
|
-
return
|
|
1860
|
+
return Z(parseInt(n, 16), 0, 255);
|
|
1861
1861
|
}
|
|
1862
1862
|
class S {
|
|
1863
|
-
constructor(t, e, i,
|
|
1863
|
+
constructor(t, e, i, r) {
|
|
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 = Z(t, 0, 255), this.g = Z(e, 0, 255), this.b = Z(i, 0, 255), this.a = Z(r, 0, 255), this.sn = [this.r, this.g, this.b, this.a], this.en = [this.r / 255, this.g / 255, this.b / 255, this.a / 255];
|
|
1871
1871
|
}
|
|
1872
|
-
static rn(t, e, i,
|
|
1872
|
+
static rn(t, e, i, r) {
|
|
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 [s, h, o] = t, c = t.length === 4 ? t[3] : 255;
|
|
1877
|
+
return S.hn(s, h, o, c);
|
|
1878
1878
|
}
|
|
1879
1879
|
if (typeof t == "string") {
|
|
1880
|
-
const
|
|
1881
|
-
if (
|
|
1882
|
-
return S.an(
|
|
1880
|
+
const s = t.trim();
|
|
1881
|
+
if (s.length === 0) throw Error("Color strings cannot be empty.");
|
|
1882
|
+
return S.an(s);
|
|
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, r ?? 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, r = 255) {
|
|
1888
|
+
return new S(t, e, i, r);
|
|
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, ""), r = (s = i).length === 3 || s.length === 4 ? s.split("").map((h) => h + h).join("") : s;
|
|
1896
|
+
var s;
|
|
1897
|
+
if (r.length !== 6 && r.length !== 8) throw Error("Invalid hex color: " + e);
|
|
1898
|
+
return [$(r.slice(0, 2)), $(r.slice(2, 4)), $(r.slice(4, 6)), r.length === 8 ? $(r.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, r, s, 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 = r, this.un = s, 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, r) {
|
|
1969
|
+
return this.bn(this.Xt, t, e, i, r), 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, r) {
|
|
1972
|
+
return this.bn(this.Yt, t, e, i, r), 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, r) {
|
|
1975
|
+
return this.bn(this.yn, t, e, i, r), 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), r = t.createUniforms(e);
|
|
2006
|
+
this.q = this.Z.materialManager.Ni(i, r);
|
|
2007
2007
|
}
|
|
2008
|
-
bn(t, e, i,
|
|
2009
|
-
const h = S.rn(e, i,
|
|
2008
|
+
bn(t, e, i, r, s) {
|
|
2009
|
+
const h = S.rn(e, i, r, s);
|
|
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, r, s, h, o, c) {
|
|
2033
|
+
const l = Math.min(o / s, c / h);
|
|
2034
|
+
super(t, e, i, r, s, h, Math.max(1, Math.floor(s * l)), Math.max(1, Math.floor(h * l)));
|
|
2035
2035
|
}
|
|
2036
|
-
static Tn(t, e, i,
|
|
2036
|
+
static Tn(t, e, i, r, s) {
|
|
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, r, s);
|
|
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, "Bn", 0);
|
|
2057
2057
|
this.En = 1e3 / t;
|
|
2058
2058
|
}
|
|
2059
|
-
|
|
2059
|
+
In(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 r = i - this.Sn;
|
|
2065
|
+
r >= this.En && (t(), this.Sn = i - r % 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.In(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.In(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((r, s) => r + s, 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.Bn;
|
|
2100
2100
|
}
|
|
2101
2101
|
set Kn(t) {
|
|
2102
|
-
this.
|
|
2102
|
+
this.Bn = t;
|
|
2103
2103
|
}
|
|
2104
2104
|
Wn() {
|
|
2105
|
-
this.
|
|
2105
|
+
this.Bn++;
|
|
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 r = -e, s = t.cols - e - 1, h = -i, o = t.rows - i - 1;
|
|
2174
|
+
(this.qn.x < r || this.qn.x > s || 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
|
+
Eo(t) {
|
|
2191
2191
|
this.fo = t;
|
|
2192
2192
|
}
|
|
2193
|
-
|
|
2193
|
+
Ro(t) {
|
|
2194
2194
|
this.do = t;
|
|
2195
2195
|
}
|
|
2196
|
-
|
|
2196
|
+
So() {
|
|
2197
2197
|
return { x: this.qn.x, y: this.qn.y };
|
|
2198
2198
|
}
|
|
2199
2199
|
Ao(t) {
|
|
@@ -2229,103 +2229,102 @@ 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 r = e.getBoundingClientRect(), s = t.clientX - r.left, h = t.clientY - r.top, o = e.width / r.width, c = h * (e.height / r.height), l = s * 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 _e = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Lt }, Symbol.toStringTag, { value: "Module" }));
|
|
2240
|
+
class Nt {
|
|
2241
2241
|
constructor() {
|
|
2242
|
-
a(this, "
|
|
2243
|
-
a(this, "zo", null);
|
|
2242
|
+
a(this, "zo", /* @__PURE__ */ new Map());
|
|
2244
2243
|
a(this, "ko", null);
|
|
2245
|
-
a(this, "Do");
|
|
2244
|
+
a(this, "Do", null);
|
|
2246
2245
|
a(this, "Lo");
|
|
2247
|
-
a(this, "ao", !1);
|
|
2248
2246
|
a(this, "Oo");
|
|
2247
|
+
a(this, "ao", !1);
|
|
2248
|
+
a(this, "Bo");
|
|
2249
2249
|
a(this, "Io");
|
|
2250
|
-
a(this, "
|
|
2250
|
+
a(this, "Ho", { 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.
|
|
2254
|
-
this.Ho(t);
|
|
2255
|
-
}, this.Lo = (t) => {
|
|
2253
|
+
this.ao || (this.Lo = (t) => {
|
|
2256
2254
|
this.Go(t);
|
|
2257
|
-
},
|
|
2255
|
+
}, this.Oo = (t) => {
|
|
2256
|
+
this.Qo(t);
|
|
2257
|
+
}, window.addEventListener("keydown", this.Lo, { passive: !1 }), window.addEventListener("keyup", this.Oo, { passive: !1 }), this.ao = !0);
|
|
2258
2258
|
}
|
|
2259
2259
|
Mo() {
|
|
2260
|
-
this.ao && (window.removeEventListener("keydown", this.
|
|
2260
|
+
this.ao && (window.removeEventListener("keydown", this.Lo), window.removeEventListener("keyup", this.Oo), this.ao = !1, this.zo.clear(), this.ko = null, this.Do = null);
|
|
2261
2261
|
}
|
|
2262
2262
|
Po(t) {
|
|
2263
|
-
this.
|
|
2263
|
+
this.Bo = t;
|
|
2264
2264
|
}
|
|
2265
2265
|
To(t) {
|
|
2266
2266
|
this.Io = t;
|
|
2267
2267
|
}
|
|
2268
|
-
|
|
2269
|
-
const e = this.
|
|
2268
|
+
No(t) {
|
|
2269
|
+
const e = this.Xo(t), i = this.zo.get(t) || this.zo.get(e);
|
|
2270
2270
|
return (i == null ? void 0 : i.isPressed) || !1;
|
|
2271
2271
|
}
|
|
2272
|
-
Xo() {
|
|
2273
|
-
return this.zo;
|
|
2274
|
-
}
|
|
2275
2272
|
Yo() {
|
|
2276
2273
|
return this.ko;
|
|
2277
2274
|
}
|
|
2278
2275
|
jo() {
|
|
2279
|
-
|
|
2280
|
-
for (const [e, i] of this.So) i.isPressed && t.push(e);
|
|
2281
|
-
return t;
|
|
2276
|
+
return this.Do;
|
|
2282
2277
|
}
|
|
2283
2278
|
Ko() {
|
|
2284
|
-
|
|
2279
|
+
const t = [];
|
|
2280
|
+
for (const [e, i] of this.zo) i.isPressed && t.push(e);
|
|
2281
|
+
return t;
|
|
2285
2282
|
}
|
|
2286
2283
|
Wo() {
|
|
2287
|
-
this.
|
|
2284
|
+
return { ctrl: this.No("Control"), shift: this.No("Shift"), alt: this.No("Alt"), meta: this.No("Meta") };
|
|
2288
2285
|
}
|
|
2289
|
-
|
|
2286
|
+
Zo() {
|
|
2287
|
+
this.zo.clear(), this.ko = null, this.Do = null;
|
|
2288
|
+
}
|
|
2289
|
+
Go(t) {
|
|
2290
2290
|
const e = t.key, i = Date.now();
|
|
2291
|
-
this.
|
|
2292
|
-
const
|
|
2293
|
-
if (!
|
|
2294
|
-
const
|
|
2295
|
-
this.
|
|
2291
|
+
this.zo.has(e) || this.zo.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
2292
|
+
const r = this.zo.get(e);
|
|
2293
|
+
if (!r.isPressed && (r.isPressed = !0, r.lastPressTime = i, this.ko = e, this.Bo)) {
|
|
2294
|
+
const s = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !0, originalEvent: t };
|
|
2295
|
+
this.Bo(s);
|
|
2296
2296
|
}
|
|
2297
2297
|
}
|
|
2298
|
-
|
|
2298
|
+
Qo(t) {
|
|
2299
2299
|
const e = t.key, i = Date.now();
|
|
2300
|
-
this.
|
|
2301
|
-
const
|
|
2302
|
-
if (
|
|
2303
|
-
const
|
|
2304
|
-
this.Io(
|
|
2300
|
+
this.zo.has(e) || this.zo.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
2301
|
+
const r = this.zo.get(e);
|
|
2302
|
+
if (r.isPressed = !1, r.lastReleaseTime = i, this.Do = e, this.Io) {
|
|
2303
|
+
const s = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !1, originalEvent: t };
|
|
2304
|
+
this.Io(s);
|
|
2305
2305
|
}
|
|
2306
2306
|
}
|
|
2307
|
-
|
|
2308
|
-
return this.
|
|
2307
|
+
Xo(t) {
|
|
2308
|
+
return this.Ho[t] || t.toLowerCase();
|
|
2309
2309
|
}
|
|
2310
2310
|
}
|
|
2311
|
-
const Oe = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager:
|
|
2312
|
-
class
|
|
2311
|
+
const Oe = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Nt }, Symbol.toStringTag, { value: "Module" }));
|
|
2312
|
+
class Bt {
|
|
2313
2313
|
constructor(t, e, i) {
|
|
2314
2314
|
a(this, "kr");
|
|
2315
|
-
a(this, "
|
|
2315
|
+
a(this, "qo");
|
|
2316
2316
|
a(this, "Zn");
|
|
2317
|
-
a(this, "qo", /* @__PURE__ */ new Map());
|
|
2318
2317
|
a(this, "Vo", /* @__PURE__ */ new Map());
|
|
2319
2318
|
a(this, "Jo", /* @__PURE__ */ new Map());
|
|
2320
|
-
a(this, "th",
|
|
2321
|
-
a(this, "sh");
|
|
2319
|
+
a(this, "th", /* @__PURE__ */ new Map());
|
|
2320
|
+
a(this, "sh", null);
|
|
2322
2321
|
a(this, "ih");
|
|
2323
2322
|
a(this, "eh");
|
|
2324
2323
|
a(this, "rh");
|
|
2325
2324
|
a(this, "nh");
|
|
2326
2325
|
a(this, "oh");
|
|
2327
|
-
a(this, "ao", !1);
|
|
2328
2326
|
a(this, "hh");
|
|
2327
|
+
a(this, "ao", !1);
|
|
2329
2328
|
a(this, "ah");
|
|
2330
2329
|
a(this, "uh");
|
|
2331
2330
|
a(this, "fh");
|
|
@@ -2335,61 +2334,59 @@ class Nt {
|
|
|
2335
2334
|
a(this, "mh");
|
|
2336
2335
|
a(this, "_h");
|
|
2337
2336
|
a(this, "yh");
|
|
2338
|
-
a(this, "Ah"
|
|
2339
|
-
a(this, "wh",
|
|
2340
|
-
a(this, "bh",
|
|
2341
|
-
a(this, "Ch",
|
|
2342
|
-
a(this, "xh",
|
|
2343
|
-
a(this, "Mh",
|
|
2344
|
-
a(this, "Fh",
|
|
2345
|
-
a(this, "$h",
|
|
2346
|
-
a(this, "Ph",
|
|
2347
|
-
a(this, "Th",
|
|
2348
|
-
a(this, "Eh",
|
|
2349
|
-
a(this, "Rh",
|
|
2350
|
-
this
|
|
2351
|
-
|
|
2352
|
-
|
|
2337
|
+
a(this, "Ah");
|
|
2338
|
+
a(this, "wh", 320);
|
|
2339
|
+
a(this, "bh", 350);
|
|
2340
|
+
a(this, "Ch", 10);
|
|
2341
|
+
a(this, "xh", 550);
|
|
2342
|
+
a(this, "Mh", 14);
|
|
2343
|
+
a(this, "Fh", 48);
|
|
2344
|
+
a(this, "$h", 650);
|
|
2345
|
+
a(this, "Ph", 0.02);
|
|
2346
|
+
a(this, "Th", 2);
|
|
2347
|
+
a(this, "Eh", 600);
|
|
2348
|
+
a(this, "Rh", 0);
|
|
2349
|
+
a(this, "Sh", null);
|
|
2350
|
+
this.kr = t, this.Zn = e, this.qo = i;
|
|
2351
|
+
const r = this.kr.canvas;
|
|
2352
|
+
this.ih = r.style.touchAction, this.eh = r.style.userSelect, r.style.touchAction || (r.style.touchAction = "none"), r.style.userSelect || (r.style.userSelect = "none");
|
|
2353
2353
|
}
|
|
2354
2354
|
_o() {
|
|
2355
2355
|
if (this.ao) return;
|
|
2356
2356
|
const t = this.kr.canvas;
|
|
2357
|
-
this.
|
|
2358
|
-
this.Sh(e);
|
|
2359
|
-
}, this.rh = (e) => {
|
|
2357
|
+
this.rh = (e) => {
|
|
2360
2358
|
this.zh(e);
|
|
2361
2359
|
}, this.nh = (e) => {
|
|
2362
2360
|
this.kh(e);
|
|
2363
2361
|
}, this.oh = (e) => {
|
|
2364
2362
|
this.Dh(e);
|
|
2365
|
-
},
|
|
2363
|
+
}, this.hh = (e) => {
|
|
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;
|
|
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.rh), t.removeEventListener("touchmove", this.nh), t.removeEventListener("touchend", this.oh), t.removeEventListener("touchcancel", this.hh), this.ao = !1, this.sh = null, this.Vo.clear(), this.Jo.clear(), this.th.forEach((e) => {
|
|
2371
2371
|
e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
|
|
2372
|
-
}), this.
|
|
2372
|
+
}), this.th.clear(), this.Sh = null, this.Rh = 0, t.style.touchAction = this.ih, t.style.userSelect = this.eh;
|
|
2373
2373
|
}
|
|
2374
2374
|
Fo() {
|
|
2375
|
-
if (!this.Zn() || this.
|
|
2375
|
+
if (!this.Zn() || this.Vo.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.Vo.values()) {
|
|
2378
|
+
const i = this.Oh(e.clientX, e.clientY, e.id, e);
|
|
2379
2379
|
t.set(e.id, i);
|
|
2380
2380
|
}
|
|
2381
|
-
this.
|
|
2381
|
+
this.Vo = t;
|
|
2382
2382
|
}
|
|
2383
|
-
|
|
2384
|
-
return Array.from(this.
|
|
2383
|
+
Bh() {
|
|
2384
|
+
return Array.from(this.Vo.values()).map((t) => ({ ...t }));
|
|
2385
2385
|
}
|
|
2386
2386
|
Ih(t) {
|
|
2387
|
-
this.hh = t;
|
|
2388
|
-
}
|
|
2389
|
-
Uo(t) {
|
|
2390
2387
|
this.ah = t;
|
|
2391
2388
|
}
|
|
2392
|
-
|
|
2389
|
+
Eo(t) {
|
|
2393
2390
|
this.uh = t;
|
|
2394
2391
|
}
|
|
2395
2392
|
Hh(t) {
|
|
@@ -2413,130 +2410,133 @@ class Nt {
|
|
|
2413
2410
|
jh(t) {
|
|
2414
2411
|
this.yh = t;
|
|
2415
2412
|
}
|
|
2416
|
-
|
|
2417
|
-
|
|
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();
|
|
2413
|
+
Kh(t) {
|
|
2414
|
+
this.Ah = t;
|
|
2431
2415
|
}
|
|
2432
2416
|
zh(t) {
|
|
2433
|
-
var
|
|
2417
|
+
var r;
|
|
2434
2418
|
if (!this.Zn()) return;
|
|
2435
|
-
t.preventDefault(), (
|
|
2436
|
-
const e = performance.now(), i = this.
|
|
2437
|
-
for (const
|
|
2438
|
-
const h = this.
|
|
2439
|
-
|
|
2440
|
-
const
|
|
2441
|
-
|
|
2419
|
+
t.preventDefault(), (r = this.qo) == null || r.vo(this.Eh);
|
|
2420
|
+
const e = performance.now(), i = this.Wh(t.changedTouches);
|
|
2421
|
+
for (const s of i) {
|
|
2422
|
+
const h = this.Vo.get(s.id);
|
|
2423
|
+
h && this.Jo.set(s.id, this.Zh(h)), this.Vo.set(s.id, s);
|
|
2424
|
+
const o = { id: s.id, startPosition: s, lastPosition: s, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
|
|
2425
|
+
this.mh && (o.longPressTimer = window.setTimeout(() => {
|
|
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));
|
|
2442
2429
|
}
|
|
2443
|
-
this.
|
|
2430
|
+
this.Vo.size === 2 && this.Vh();
|
|
2444
2431
|
}
|
|
2445
2432
|
kh(t) {
|
|
2433
|
+
var r;
|
|
2446
2434
|
if (!this.Zn()) return;
|
|
2447
|
-
t.preventDefault();
|
|
2448
|
-
const e = performance.now(), i = this.
|
|
2435
|
+
t.preventDefault(), (r = this.qo) == null || r.vo(this.Eh);
|
|
2436
|
+
const e = performance.now(), i = this.Wh(t.changedTouches);
|
|
2449
2437
|
for (const s of i) {
|
|
2450
|
-
const
|
|
2451
|
-
o &&
|
|
2438
|
+
const h = this.Vo.get(s.id), o = h ? this.Zh(h) : void 0;
|
|
2439
|
+
o && this.Jo.set(s.id, o), this.Vo.set(s.id, s);
|
|
2440
|
+
const c = this.th.get(s.id);
|
|
2441
|
+
c && (c.lastPosition = s, c.lastTime = e, o) && k(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));
|
|
2452
2442
|
}
|
|
2453
|
-
this.
|
|
2443
|
+
this.Vo.size === 2 ? this.Jh(t) : this.sh = null;
|
|
2454
2444
|
}
|
|
2455
2445
|
Dh(t) {
|
|
2456
2446
|
if (!this.Zn()) return;
|
|
2457
2447
|
t.preventDefault();
|
|
2458
|
-
const e = performance.now(), i = this.
|
|
2459
|
-
for (const
|
|
2460
|
-
const
|
|
2461
|
-
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.fh && this.fh(this.
|
|
2448
|
+
const e = performance.now(), i = this.Wh(t.changedTouches);
|
|
2449
|
+
for (const r of i) {
|
|
2450
|
+
const s = this.Vo.get(r.id), h = s ? this.Zh(s) : void 0, o = this.th.get(r.id);
|
|
2451
|
+
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.fh && this.fh(this.qh(r, t, h, e)), o && this.ta(o, t), this.th.delete(r.id), this.Jo.delete(r.id), this.Vo.delete(r.id);
|
|
2462
2452
|
}
|
|
2463
|
-
this.
|
|
2453
|
+
this.Vo.size < 2 && (this.sh = null);
|
|
2464
2454
|
}
|
|
2465
|
-
|
|
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);
|
|
2462
|
+
}
|
|
2463
|
+
this.Vo.size < 2 && (this.sh = null);
|
|
2464
|
+
}
|
|
2465
|
+
Wh(t) {
|
|
2466
2466
|
const e = [];
|
|
2467
2467
|
for (let i = 0; i < t.length; i += 1) {
|
|
2468
|
-
const
|
|
2469
|
-
|
|
2468
|
+
const r = t.item(i);
|
|
2469
|
+
r && e.push(this.sa(r));
|
|
2470
2470
|
}
|
|
2471
2471
|
return e;
|
|
2472
2472
|
}
|
|
2473
|
-
|
|
2474
|
-
return this.
|
|
2473
|
+
sa(t) {
|
|
2474
|
+
return this.Oh(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
|
+
Oh(t, e, i, r) {
|
|
2477
|
+
const s = this.kr.canvas, h = this.Zn(), o = s.getBoundingClientRect(), c = t - o.left, l = e - o.top, u = c * (s.width / o.width), f = l * (s.height / o.height);
|
|
2478
|
+
if (!h) return { id: i, x: -1 / 0, y: -1 / 0, clientX: t, clientY: e, pressure: r.pressure, radiusX: r.radiusX, radiusY: r.radiusY, rotationAngle: r.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 =
|
|
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: r.pressure, radiusX: r.radiusX, radiusY: r.radiusY, rotationAngle: r.rotationAngle } : { id: i, x: -1 / 0, y: -1 / 0, clientX: t, clientY: e, pressure: r.pressure, radiusX: r.radiusX, radiusY: r.radiusY, rotationAngle: r.rotationAngle };
|
|
2481
|
+
}
|
|
2482
|
+
qh(t, e, i, r) {
|
|
2483
|
+
const s = this.th.get(t.id), h = Array.from(this.Jo.values()).map((l) => this.Zh(l)), o = Array.from(this.Vo.values()).map((l) => this.Zh(l)), c = this.Wh(e.changedTouches);
|
|
2484
|
+
return { touch: this.Zh(t), previousTouch: i ? this.Zh(i) : void 0, touches: o, previousTouches: h, changedTouches: c, deltaTime: s ? r - s.lastTime : 0, originalEvent: e };
|
|
2485
|
+
}
|
|
2486
|
+
Vh() {
|
|
2487
|
+
if (this.Vo.size !== 2) return void (this.sh = null);
|
|
2488
|
+
const t = Array.from(this.Vo.values()), [e, i] = t, r = k(e.x, e.y, i.x, i.y), s = mt(e.clientX, e.clientY, i.clientX, i.clientY);
|
|
2489
|
+
this.sh = { ids: [e.id, i.id], initialDistance: Math.max(r, 1e-4), initialAngle: s, lastScale: 1, lastRotation: 0 };
|
|
2490
|
+
}
|
|
2491
|
+
Jh(t) {
|
|
2492
|
+
if (this.sh || this.Vh(), !this.sh) return;
|
|
2493
|
+
const [e, i] = this.sh.ids, r = this.Vo.get(e), s = this.Vo.get(i);
|
|
2494
|
+
if (!r || !s) return;
|
|
2495
|
+
const h = k(r.x, r.y, s.x, s.y) / this.sh.initialDistance, o = h - this.sh.lastScale;
|
|
2496
|
+
this.yh && Math.abs(o) > this.Ph && (this.yh({ touches: [this.Zh(r), this.Zh(s)], scale: h, deltaScale: o, center: this.ia(r, s), originalEvent: t }), this.sh.lastScale = h);
|
|
2497
|
+
let c = mt(r.clientX, r.clientY, s.clientX, s.clientY) - this.sh.initialAngle;
|
|
2498
2498
|
c = (c + 180) % 360 - 180;
|
|
2499
|
-
const l = c - this.
|
|
2500
|
-
this.
|
|
2499
|
+
const l = c - this.sh.lastRotation;
|
|
2500
|
+
this.Ah && Math.abs(l) > this.Th && (this.Ah({ touches: [this.Zh(r), this.Zh(s)], rotation: c, deltaRotation: l, center: this.ia(r, s), originalEvent: t }), this.sh.lastRotation = c);
|
|
2501
2501
|
}
|
|
2502
|
-
|
|
2503
|
-
const i = (t.clientX + e.clientX) / 2,
|
|
2504
|
-
return { x:
|
|
2502
|
+
ia(t, e) {
|
|
2503
|
+
const i = (t.clientX + e.clientX) / 2, r = (t.clientY + e.clientY) / 2, s = this.Oh(i, r, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: r });
|
|
2504
|
+
return { x: s.x, y: s.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
|
+
ta(t, e) {
|
|
2507
|
+
const i = performance.now(), r = i - t.startTime, s = k(t.startPosition.clientX, t.startPosition.clientY, t.lastPosition.clientX, t.lastPosition.clientY);
|
|
2508
|
+
if (!t.longPressFired && r <= this.wh && s <= this.Ch)
|
|
2509
|
+
this.ea(t.lastPosition, i) && this.gh ? this.gh({ touch: this.Zh(t.lastPosition), taps: 2, originalEvent: e }) : this.ph && this.ph({ touch: this.Zh(t.lastPosition), taps: 1, originalEvent: e });
|
|
2510
|
+
else if (!t.longPressFired && r <= this.$h && s >= this.Fh) {
|
|
2511
|
+
const h = { x: t.lastPosition.clientX - t.startPosition.clientX, y: t.lastPosition.clientY - t.startPosition.clientY }, o = Math.max(Math.hypot(h.x, h.y), 1e-4), c = { x: h.x / o, y: h.y / o }, l = { x: h.x / r, y: h.y / r };
|
|
2512
|
+
this._h && this._h({ touch: this.Zh(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
|
|
2513
2513
|
}
|
|
2514
|
-
this.
|
|
2514
|
+
this.Rh = i, this.Sh = this.Zh(t.lastPosition);
|
|
2515
2515
|
}
|
|
2516
|
-
|
|
2517
|
-
return !this.
|
|
2516
|
+
ea(t, e) {
|
|
2517
|
+
return !this.Sh || e - this.Rh > this.bh ? !1 : k(t.clientX, t.clientY, this.Sh.clientX, this.Sh.clientY) <= this.Ch;
|
|
2518
2518
|
}
|
|
2519
|
-
|
|
2519
|
+
Zh(t) {
|
|
2520
2520
|
return { ...t };
|
|
2521
2521
|
}
|
|
2522
2522
|
}
|
|
2523
|
-
const
|
|
2523
|
+
const Ze = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Bt }, Symbol.toStringTag, { value: "Module" }));
|
|
2524
2524
|
class nt extends St {
|
|
2525
|
-
constructor(e, i,
|
|
2525
|
+
constructor(e, i, r, s, 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, r, s, o, c, d, g);
|
|
2530
|
+
a(this, "ra");
|
|
2531
|
+
this.ra = h;
|
|
2532
2532
|
}
|
|
2533
2533
|
gt() {
|
|
2534
|
-
super.gt(), this.
|
|
2534
|
+
super.gt(), this.ra.pause(), this.ra.src = "", this.ra.load();
|
|
2535
2535
|
}
|
|
2536
|
-
|
|
2537
|
-
if (this.
|
|
2536
|
+
na() {
|
|
2537
|
+
if (this.ra.readyState >= this.ra.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.ra), 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.na();
|
|
2550
2550
|
}
|
|
2551
|
-
static async Tn(e, i,
|
|
2551
|
+
static async Tn(e, i, r, s, 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 A;
|
|
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: " + (((A = v.error) == null ? void 0 : A.message) || "Unknown error")));
|
|
2559
|
+
}, { once: !0 }), c.src = r;
|
|
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, s, h);
|
|
2565
2565
|
}
|
|
2566
2566
|
async play() {
|
|
2567
|
-
await this.
|
|
2567
|
+
await this.ra.play();
|
|
2568
2568
|
}
|
|
2569
2569
|
pause() {
|
|
2570
|
-
this.
|
|
2570
|
+
this.ra.pause();
|
|
2571
2571
|
}
|
|
2572
2572
|
stop() {
|
|
2573
|
-
this.
|
|
2573
|
+
this.ra.pause(), this.ra.currentTime = 0;
|
|
2574
2574
|
}
|
|
2575
2575
|
speed(e) {
|
|
2576
|
-
return this.
|
|
2576
|
+
return this.ra.playbackRate = e, this;
|
|
2577
2577
|
}
|
|
2578
2578
|
loop(e = !0) {
|
|
2579
|
-
return this.
|
|
2579
|
+
return this.ra.loop = e, this;
|
|
2580
2580
|
}
|
|
2581
2581
|
time(e) {
|
|
2582
|
-
return this.
|
|
2582
|
+
return this.ra.currentTime = e, this;
|
|
2583
2583
|
}
|
|
2584
2584
|
volume(e) {
|
|
2585
|
-
return this.
|
|
2585
|
+
return this.ra.volume = Math.max(0, Math.min(1, e)), this;
|
|
2586
2586
|
}
|
|
2587
2587
|
get videoElement() {
|
|
2588
|
-
return this.
|
|
2588
|
+
return this.ra;
|
|
2589
2589
|
}
|
|
2590
2590
|
get currentTime() {
|
|
2591
|
-
return this.
|
|
2591
|
+
return this.ra.currentTime;
|
|
2592
2592
|
}
|
|
2593
2593
|
get duration() {
|
|
2594
|
-
return this.
|
|
2594
|
+
return this.ra.duration;
|
|
2595
2595
|
}
|
|
2596
2596
|
get isPlaying() {
|
|
2597
|
-
return !this.
|
|
2597
|
+
return !this.ra.paused && !this.ra.ended;
|
|
2598
2598
|
}
|
|
2599
2599
|
}
|
|
2600
|
-
const
|
|
2601
|
-
|
|
2600
|
+
const Ie = (n) => class extends n {
|
|
2601
|
+
oa(t, e, i, r) {
|
|
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, r);
|
|
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 Xe = (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, r) {
|
|
2637
|
+
return S.rn(t, e, i, r);
|
|
2638
2638
|
}
|
|
2639
2639
|
rect(t = 1, e = 1) {
|
|
2640
2640
|
this.Z.be(t, e);
|
|
@@ -2642,28 +2642,28 @@ const Xe = (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, r) {
|
|
2646
|
+
this.Z.Ce(t, e, i, r);
|
|
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, r = 255) {
|
|
2652
|
+
const s = this.oa(t, e, i, r);
|
|
2653
|
+
this.Z.Te(s.r, s.g, s.b, s.a);
|
|
2654
2654
|
}
|
|
2655
2655
|
char(t) {
|
|
2656
2656
|
const e = Array.from(t);
|
|
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, r) {
|
|
2661
|
+
const s = this.oa(t, e, i, r);
|
|
2662
|
+
this.Z.state.cs(s.r, s.g, s.b, s.a);
|
|
2663
2663
|
}
|
|
2664
|
-
cellColor(t, e, i,
|
|
2665
|
-
const
|
|
2666
|
-
this.Z.state.ls(
|
|
2664
|
+
cellColor(t, e, i, r) {
|
|
2665
|
+
const s = this.oa(t, e, i, r);
|
|
2666
|
+
this.Z.state.ls(s.r, s.g, s.b, s.a);
|
|
2667
2667
|
}
|
|
2668
2668
|
flipX(t) {
|
|
2669
2669
|
this.Z.state.us(t);
|
|
@@ -2683,14 +2683,14 @@ const Xe = (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, r, s, h) {
|
|
2687
|
+
this.Z.Me(t, e, i, r, s, h);
|
|
2688
2688
|
}
|
|
2689
|
-
bezierCurve(t, e, i,
|
|
2690
|
-
this.Z.Fe(t, e, i,
|
|
2689
|
+
bezierCurve(t, e, i, r, s, h, o, c) {
|
|
2690
|
+
this.Z.Fe(t, e, i, r, s, h, o, c);
|
|
2691
2691
|
}
|
|
2692
|
-
arc(t, e, i,
|
|
2693
|
-
this.Z.$e(t / 2, e / 2, i,
|
|
2692
|
+
arc(t, e, i, r) {
|
|
2693
|
+
this.Z.$e(t / 2, e / 2, i, r);
|
|
2694
2694
|
}
|
|
2695
2695
|
shader(t) {
|
|
2696
2696
|
this.Z.ge(t);
|
|
@@ -2714,353 +2714,353 @@ const Xe = (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 r = this.dn ?? this.ha.base.font;
|
|
2718
|
+
this.Z.ye(t, e, i, r), t instanceof X && this.Z.ct();
|
|
2719
2719
|
}
|
|
2720
2720
|
async loadImage(t) {
|
|
2721
2721
|
if (typeof t != "string")
|
|
2722
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((r, s) => {
|
|
2724
2724
|
const h = new Image();
|
|
2725
|
-
h.crossOrigin = "anonymous", h.onload = () =>
|
|
2725
|
+
h.crossOrigin = "anonymous", h.onload = () => r(h), h.onerror = (o) => s(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
|
+
}, Xe = (n) => class extends n {
|
|
2733
2733
|
get frameCount() {
|
|
2734
|
-
return this.
|
|
2734
|
+
return this.aa.Kn;
|
|
2735
2735
|
}
|
|
2736
2736
|
set frameCount(t) {
|
|
2737
|
-
this.
|
|
2737
|
+
this.aa.Kn = t;
|
|
2738
2738
|
}
|
|
2739
2739
|
frameRate(t) {
|
|
2740
|
-
return t === void 0 ? this.
|
|
2740
|
+
return t === void 0 ? this.aa.jn : this.aa.Nn(t, () => this.ca());
|
|
2741
2741
|
}
|
|
2742
2742
|
noLoop() {
|
|
2743
|
-
this.
|
|
2743
|
+
this.aa.Gn();
|
|
2744
2744
|
}
|
|
2745
2745
|
loop() {
|
|
2746
|
-
this.
|
|
2746
|
+
this.aa.Qn(() => this.ca());
|
|
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.ca();
|
|
2750
2750
|
}
|
|
2751
2751
|
isLooping() {
|
|
2752
|
-
return this.
|
|
2752
|
+
return this.aa.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.qo.$o(t);
|
|
2760
2760
|
}
|
|
2761
2761
|
mousePressed(t) {
|
|
2762
|
-
this.
|
|
2762
|
+
this.qo.Po(t);
|
|
2763
2763
|
}
|
|
2764
2764
|
mouseReleased(t) {
|
|
2765
|
-
this.
|
|
2765
|
+
this.qo.To(t);
|
|
2766
2766
|
}
|
|
2767
2767
|
mouseMoved(t) {
|
|
2768
|
-
this.
|
|
2768
|
+
this.qo.Eo(t);
|
|
2769
2769
|
}
|
|
2770
2770
|
mouseScrolled(t) {
|
|
2771
|
-
this.
|
|
2771
|
+
this.qo.Ro(t);
|
|
2772
2772
|
}
|
|
2773
2773
|
get mouse() {
|
|
2774
|
-
return this.
|
|
2774
|
+
return this.qo.So();
|
|
2775
2775
|
}
|
|
2776
2776
|
cursor(t) {
|
|
2777
|
-
this.
|
|
2777
|
+
this.qo.mo(t);
|
|
2778
2778
|
}
|
|
2779
|
-
},
|
|
2779
|
+
}, Ye = (n) => class extends n {
|
|
2780
2780
|
constructor(...t) {
|
|
2781
2781
|
super(...t);
|
|
2782
2782
|
}
|
|
2783
2783
|
touchStarted(t) {
|
|
2784
|
-
this.
|
|
2784
|
+
this.la.Ih(t);
|
|
2785
2785
|
}
|
|
2786
2786
|
touchMoved(t) {
|
|
2787
|
-
this.
|
|
2787
|
+
this.la.Eo(t);
|
|
2788
2788
|
}
|
|
2789
2789
|
touchEnded(t) {
|
|
2790
|
-
this.
|
|
2790
|
+
this.la.Hh(t);
|
|
2791
2791
|
}
|
|
2792
2792
|
touchCancelled(t) {
|
|
2793
|
-
this.
|
|
2793
|
+
this.la.Gh(t);
|
|
2794
2794
|
}
|
|
2795
2795
|
tap(t) {
|
|
2796
|
-
this.
|
|
2796
|
+
this.la.Qh(t);
|
|
2797
2797
|
}
|
|
2798
2798
|
doubleTap(t) {
|
|
2799
|
-
this.
|
|
2799
|
+
this.la.Nh(t);
|
|
2800
2800
|
}
|
|
2801
2801
|
longPress(t) {
|
|
2802
|
-
this.
|
|
2802
|
+
this.la.Xh(t);
|
|
2803
2803
|
}
|
|
2804
2804
|
swipe(t) {
|
|
2805
|
-
this.
|
|
2805
|
+
this.la.Yh(t);
|
|
2806
2806
|
}
|
|
2807
2807
|
pinch(t) {
|
|
2808
|
-
this.
|
|
2808
|
+
this.la.jh(t);
|
|
2809
2809
|
}
|
|
2810
2810
|
rotateGesture(t) {
|
|
2811
|
-
this.
|
|
2811
|
+
this.la.Kh(t);
|
|
2812
2812
|
}
|
|
2813
2813
|
get touches() {
|
|
2814
|
-
return this.
|
|
2814
|
+
return this.la.Bh();
|
|
2815
2815
|
}
|
|
2816
|
-
},
|
|
2816
|
+
}, ke = (n) => class extends n {
|
|
2817
2817
|
constructor(...t) {
|
|
2818
2818
|
super(...t);
|
|
2819
2819
|
}
|
|
2820
2820
|
keyPressed(t) {
|
|
2821
|
-
this.
|
|
2821
|
+
this.ua.Po(t);
|
|
2822
2822
|
}
|
|
2823
2823
|
keyReleased(t) {
|
|
2824
|
-
this.
|
|
2824
|
+
this.ua.To(t);
|
|
2825
2825
|
}
|
|
2826
2826
|
isKeyPressed(t) {
|
|
2827
|
-
return this.
|
|
2827
|
+
return this.ua.No(t);
|
|
2828
2828
|
}
|
|
2829
2829
|
get lastKeyPressed() {
|
|
2830
|
-
return this.
|
|
2830
|
+
return this.ua.Yo();
|
|
2831
2831
|
}
|
|
2832
2832
|
get lastKeyReleased() {
|
|
2833
|
-
return this.
|
|
2833
|
+
return this.ua.jo();
|
|
2834
2834
|
}
|
|
2835
2835
|
get pressedKeys() {
|
|
2836
|
-
return this.
|
|
2836
|
+
return this.ua.Ko();
|
|
2837
2837
|
}
|
|
2838
2838
|
get modifierState() {
|
|
2839
|
-
return this.
|
|
2839
|
+
return this.ua.Wo();
|
|
2840
2840
|
}
|
|
2841
2841
|
};
|
|
2842
|
-
class
|
|
2842
|
+
class He {
|
|
2843
2843
|
constructor(t) {
|
|
2844
|
-
a(this, "
|
|
2845
|
-
a(this, "
|
|
2846
|
-
a(this, "
|
|
2847
|
-
a(this, "va", /* @__PURE__ */ new Map());
|
|
2844
|
+
a(this, "fa");
|
|
2845
|
+
a(this, "da", /* @__PURE__ */ new Map());
|
|
2846
|
+
a(this, "va", []);
|
|
2848
2847
|
a(this, "pa", /* @__PURE__ */ new Map());
|
|
2849
|
-
this
|
|
2848
|
+
a(this, "ga", /* @__PURE__ */ new Map());
|
|
2849
|
+
this.fa = t;
|
|
2850
2850
|
}
|
|
2851
|
-
async
|
|
2851
|
+
async ma(t) {
|
|
2852
2852
|
for (const e of t) {
|
|
2853
|
-
if (this.
|
|
2854
|
-
const i = this.
|
|
2853
|
+
if (this.da.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
|
|
2854
|
+
const i = this._a(e.name);
|
|
2855
2855
|
try {
|
|
2856
|
-
await e.install(this.
|
|
2857
|
-
} catch (
|
|
2858
|
-
throw this.
|
|
2856
|
+
await e.install(this.fa, i);
|
|
2857
|
+
} catch (r) {
|
|
2858
|
+
throw this.ya(e.name), r;
|
|
2859
2859
|
}
|
|
2860
|
-
this.
|
|
2860
|
+
this.da.set(e.name, e), this.va.push(e.name);
|
|
2861
2861
|
}
|
|
2862
2862
|
}
|
|
2863
|
-
async
|
|
2864
|
-
const e = this.
|
|
2863
|
+
async wa(t) {
|
|
2864
|
+
const e = this.da.get(t);
|
|
2865
2865
|
if (!e) return;
|
|
2866
|
-
const i = this.
|
|
2867
|
-
e.uninstall && await e.uninstall(this.
|
|
2868
|
-
}
|
|
2869
|
-
wa() {
|
|
2870
|
-
this.ba(this.va);
|
|
2866
|
+
const i = this._a(t);
|
|
2867
|
+
e.uninstall && await e.uninstall(this.fa, i), this.da.delete(t), this.va.splice(this.va.indexOf(t), 1), this.ya(t);
|
|
2871
2868
|
}
|
|
2872
|
-
|
|
2873
|
-
this.
|
|
2869
|
+
ba() {
|
|
2870
|
+
this.Ca(this.pa);
|
|
2874
2871
|
}
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
for (const e of t) await this.ya(e);
|
|
2872
|
+
xa() {
|
|
2873
|
+
this.Ca(this.ga);
|
|
2878
2874
|
}
|
|
2879
|
-
|
|
2880
|
-
const
|
|
2881
|
-
|
|
2875
|
+
async Ma() {
|
|
2876
|
+
const t = [...this.da.keys()];
|
|
2877
|
+
for (const e of t) await this.wa(e);
|
|
2882
2878
|
}
|
|
2883
|
-
|
|
2884
|
-
const
|
|
2885
|
-
return
|
|
2886
|
-
|
|
2887
|
-
|
|
2879
|
+
_a(t) {
|
|
2880
|
+
const e = this.fa.layers.base, i = e.drawFramebuffer, r = e.asciiFramebuffer;
|
|
2881
|
+
return { renderer: this.fa.Z, font: e.font, grid: e.grid, canvas: this.fa.kr, drawFramebuffer: i, asciiFramebuffer: r, registerPreDrawHook: (s) => this.Fa(this.pa, t, s), registerPostDrawHook: (s) => this.Fa(this.ga, t, s) };
|
|
2882
|
+
}
|
|
2883
|
+
Fa(t, e, i) {
|
|
2884
|
+
const r = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
2885
|
+
return r.add(i), t.set(e, r), () => {
|
|
2886
|
+
const s = t.get(e);
|
|
2887
|
+
s && (s.delete(i), s.size === 0 && t.delete(e));
|
|
2888
2888
|
};
|
|
2889
2889
|
}
|
|
2890
|
-
|
|
2891
|
-
this.
|
|
2890
|
+
ya(t) {
|
|
2891
|
+
this.pa.delete(t), this.ga.delete(t);
|
|
2892
2892
|
}
|
|
2893
|
-
|
|
2894
|
-
for (const e of this.
|
|
2893
|
+
Ca(t) {
|
|
2894
|
+
for (const e of this.va) {
|
|
2895
2895
|
const i = t.get(e);
|
|
2896
|
-
i && i.forEach((
|
|
2896
|
+
i && i.forEach((r) => r());
|
|
2897
2897
|
}
|
|
2898
2898
|
}
|
|
2899
2899
|
}
|
|
2900
|
-
const
|
|
2901
|
-
in vec2
|
|
2900
|
+
const V = `#version 300 es
|
|
2901
|
+
layout(location=0)in vec2 A;layout(location=1)in vec2 B;out vec2 v_uv;void main(){v_uv=B;gl_Position=vec4(A,0.,1.);}`, Dt = `#version 300 es
|
|
2902
2902
|
precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`;
|
|
2903
|
-
class
|
|
2903
|
+
class _t {
|
|
2904
2904
|
constructor() {
|
|
2905
|
-
a(this, "
|
|
2906
|
-
a(this, "
|
|
2907
|
-
a(this, "Pa", 0);
|
|
2905
|
+
a(this, "$a", /* @__PURE__ */ new Map());
|
|
2906
|
+
a(this, "Pa", []);
|
|
2908
2907
|
a(this, "Ta", 0);
|
|
2909
|
-
a(this, "Ea");
|
|
2910
|
-
|
|
2911
|
-
get Ra() {
|
|
2912
|
-
return this.Pa;
|
|
2908
|
+
a(this, "Ea", 0);
|
|
2909
|
+
a(this, "Ra");
|
|
2913
2910
|
}
|
|
2914
2911
|
get Sa() {
|
|
2915
|
-
|
|
2912
|
+
return this.Ta;
|
|
2913
|
+
}
|
|
2914
|
+
get za() {
|
|
2915
|
+
if (this.Ta === 0) return 0;
|
|
2916
2916
|
let t = 0;
|
|
2917
|
-
for (const e of this
|
|
2918
|
-
const i = this.
|
|
2917
|
+
for (const e of this.Pa) {
|
|
2918
|
+
const i = this.$a.get(e);
|
|
2919
2919
|
i && (t += Math.min(1, Math.max(0, i.progress)) * i.weight);
|
|
2920
2920
|
}
|
|
2921
|
-
return Math.min(1, t / this.
|
|
2921
|
+
return Math.min(1, t / this.Ta);
|
|
2922
2922
|
}
|
|
2923
|
-
|
|
2924
|
-
this.
|
|
2923
|
+
ka(t) {
|
|
2924
|
+
this.Ra = t;
|
|
2925
2925
|
}
|
|
2926
|
-
|
|
2927
|
-
const i = `phase-${this
|
|
2928
|
-
return this.
|
|
2926
|
+
Da(t, e = 1) {
|
|
2927
|
+
const i = `phase-${this.Pa.length + 1}-${Date.now()}`, r = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
|
|
2928
|
+
return this.$a.set(i, r), this.Pa.push(i), this.Ta += r.weight, i;
|
|
2929
2929
|
}
|
|
2930
|
-
|
|
2931
|
-
const i = this.
|
|
2930
|
+
La(t, e) {
|
|
2931
|
+
const i = this.$a.get(t);
|
|
2932
2932
|
if (!i) return;
|
|
2933
2933
|
i.progress = Math.max(0, Math.min(1, e)), i.status = i.progress >= 1 ? "complete" : "running";
|
|
2934
|
-
const
|
|
2935
|
-
Math.abs(
|
|
2936
|
-
}
|
|
2937
|
-
La(t) {
|
|
2938
|
-
const e = this.Fa.get(t);
|
|
2939
|
-
e && (e.progress = 1, e.status = "complete", this.Da(t, 1));
|
|
2934
|
+
const r = this.za;
|
|
2935
|
+
Math.abs(r - this.Ea) > 1e-3 && (this.Ea = r, this.Ra && this.Ra(r));
|
|
2940
2936
|
}
|
|
2941
2937
|
Oa(t) {
|
|
2942
|
-
const e = this.
|
|
2938
|
+
const e = this.$a.get(t);
|
|
2939
|
+
e && (e.progress = 1, e.status = "complete", this.La(t, 1));
|
|
2940
|
+
}
|
|
2941
|
+
Ba(t) {
|
|
2942
|
+
const e = this.$a.get(t);
|
|
2943
2943
|
e && (e.status = "failed");
|
|
2944
2944
|
}
|
|
2945
2945
|
Ia() {
|
|
2946
|
-
return this
|
|
2947
|
-
const e = this.
|
|
2946
|
+
return this.Pa.map((t) => {
|
|
2947
|
+
const e = this.$a.get(t);
|
|
2948
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" };
|
|
2949
2949
|
});
|
|
2950
2950
|
}
|
|
2951
2951
|
}
|
|
2952
2952
|
class Ot {
|
|
2953
2953
|
constructor(t = "active") {
|
|
2954
|
-
a(this, "
|
|
2955
|
-
a(this, "Ha", "");
|
|
2954
|
+
a(this, "Ha");
|
|
2956
2955
|
a(this, "Ga", "");
|
|
2957
|
-
this
|
|
2958
|
-
|
|
2959
|
-
get Qa() {
|
|
2960
|
-
return this.Ba;
|
|
2956
|
+
a(this, "Qa", "");
|
|
2957
|
+
this.Ha = t;
|
|
2961
2958
|
}
|
|
2962
2959
|
get Na() {
|
|
2963
|
-
return this.
|
|
2960
|
+
return this.Ha;
|
|
2964
2961
|
}
|
|
2965
2962
|
get Xa() {
|
|
2966
|
-
return this.
|
|
2963
|
+
return this.Ha !== "disabled";
|
|
2967
2964
|
}
|
|
2968
2965
|
get Ya() {
|
|
2969
|
-
return this.Ha;
|
|
2966
|
+
return this.Ha === "active" || this.Ha === "transitioning" || this.Ha === "error";
|
|
2970
2967
|
}
|
|
2971
2968
|
get ja() {
|
|
2972
2969
|
return this.Ga;
|
|
2973
2970
|
}
|
|
2974
|
-
Ka() {
|
|
2975
|
-
|
|
2971
|
+
get Ka() {
|
|
2972
|
+
return this.Qa;
|
|
2976
2973
|
}
|
|
2977
2974
|
Wa() {
|
|
2978
|
-
this.
|
|
2975
|
+
this.Ha !== "done" && this.Ha !== "transitioning" || (this.Ha = "active");
|
|
2979
2976
|
}
|
|
2980
2977
|
Za() {
|
|
2981
|
-
this.
|
|
2978
|
+
this.Ha !== "disabled" && (this.Ha = "done");
|
|
2982
2979
|
}
|
|
2983
2980
|
qa() {
|
|
2984
|
-
this.
|
|
2981
|
+
this.Ha !== "disabled" && (this.Ha = "transitioning");
|
|
2985
2982
|
}
|
|
2986
|
-
Va(
|
|
2987
|
-
this.
|
|
2983
|
+
Va() {
|
|
2984
|
+
this.Ha === "transitioning" && (this.Ha = "done");
|
|
2988
2985
|
}
|
|
2989
|
-
Ja() {
|
|
2990
|
-
this.
|
|
2986
|
+
Ja(t) {
|
|
2987
|
+
this.Ha !== "disabled" && (this.Ha = "error", t instanceof Error ? (this.Ga = t.message, this.Qa = t.stack || "") : (this.Ga = t, this.Qa = ""));
|
|
2988
|
+
}
|
|
2989
|
+
tc() {
|
|
2990
|
+
this.Ha = "disabled";
|
|
2991
2991
|
}
|
|
2992
2992
|
}
|
|
2993
|
-
class
|
|
2993
|
+
class Zt {
|
|
2994
2994
|
constructor(t, e) {
|
|
2995
|
-
a(this, "
|
|
2996
|
-
a(this, "
|
|
2997
|
-
a(this, "ec");
|
|
2995
|
+
a(this, "sc", 0);
|
|
2996
|
+
a(this, "ec", 1);
|
|
2998
2997
|
a(this, "rc");
|
|
2999
|
-
this
|
|
3000
|
-
|
|
3001
|
-
get nc() {
|
|
3002
|
-
return this.sc;
|
|
2998
|
+
a(this, "nc");
|
|
2999
|
+
this.rc = t, this.nc = e;
|
|
3003
3000
|
}
|
|
3004
3001
|
get oc() {
|
|
3005
|
-
return this.
|
|
3002
|
+
return this.ec;
|
|
3003
|
+
}
|
|
3004
|
+
get hc() {
|
|
3005
|
+
return this.ec < 1;
|
|
3006
3006
|
}
|
|
3007
|
-
|
|
3008
|
-
this.
|
|
3007
|
+
In() {
|
|
3008
|
+
this.rc !== "none" && this.nc > 0 && (this.sc = performance.now());
|
|
3009
3009
|
}
|
|
3010
3010
|
et() {
|
|
3011
|
-
if (this.
|
|
3012
|
-
const t = performance.now() - this.
|
|
3013
|
-
return e >= 1 ? (this.
|
|
3011
|
+
if (this.rc === "none" || this.nc === 0) return this.ec = 1, !1;
|
|
3012
|
+
const t = performance.now() - this.sc, e = Math.min(1, t / this.nc);
|
|
3013
|
+
return e >= 1 ? (this.ec = 0, !0) : (this.ec = 1 - e, !1);
|
|
3014
3014
|
}
|
|
3015
3015
|
ti() {
|
|
3016
|
-
this.
|
|
3016
|
+
this.ec = 1, this.sc = 0;
|
|
3017
3017
|
}
|
|
3018
3018
|
}
|
|
3019
3019
|
function gt(n, t) {
|
|
3020
3020
|
const e = n.tone ?? "auto";
|
|
3021
3021
|
let i = "dark";
|
|
3022
|
-
return e === "light" || e === "dark" ? i = e : t && (i = function(
|
|
3023
|
-
if (!
|
|
3024
|
-
const [
|
|
3025
|
-
return 0.2126 * c(
|
|
3022
|
+
return e === "light" || e === "dark" ? i = e : t && (i = function(r) {
|
|
3023
|
+
if (!r) return 0;
|
|
3024
|
+
const [s, h, o] = r.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(s) + 0.7152 * c(h) + 0.0722 * c(o);
|
|
3026
3026
|
}(t) > 0.5 ? "light" : "dark"), { mode: i, background: t, textColor: i === "light" ? "#1A1A1A" : "#F8F8F8", subtleColor: i === "light" ? "#4A4A4A" : "#C0C0C0" };
|
|
3027
3027
|
}
|
|
3028
|
-
function
|
|
3028
|
+
function It(n) {
|
|
3029
3029
|
return n.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
|
|
3030
3030
|
}
|
|
3031
|
-
function
|
|
3031
|
+
function Xt(n, t) {
|
|
3032
3032
|
return n.length ? n.map((e) => t.color(e)) : [t.color("#FFFFFF")];
|
|
3033
3033
|
}
|
|
3034
3034
|
class zt {
|
|
3035
|
-
constructor(t, e, i) {
|
|
3036
|
-
this.
|
|
3035
|
+
constructor(t, e, i, r) {
|
|
3036
|
+
this.ac = t, this.id = e, this.label = i, this.cc = r;
|
|
3037
3037
|
}
|
|
3038
3038
|
report(t) {
|
|
3039
|
-
this.
|
|
3039
|
+
this.ac.La(this.id, t);
|
|
3040
3040
|
}
|
|
3041
3041
|
complete() {
|
|
3042
|
-
this.
|
|
3042
|
+
this.ac.Oa(this.id);
|
|
3043
3043
|
}
|
|
3044
3044
|
fail(t) {
|
|
3045
|
-
this.
|
|
3045
|
+
this.ac.Ba(this.id), this.cc && this.cc(t ?? Error(`Loading phase "${this.label}" failed`));
|
|
3046
3046
|
}
|
|
3047
3047
|
async track(t) {
|
|
3048
3048
|
try {
|
|
3049
3049
|
const e = typeof t == "function" ? await t() : await t;
|
|
3050
3050
|
return this.complete(), e;
|
|
3051
3051
|
} catch (e) {
|
|
3052
|
-
throw this.fail(), e;
|
|
3052
|
+
throw this.fail(e instanceof Error ? e : e + ""), e;
|
|
3053
3053
|
}
|
|
3054
3054
|
}
|
|
3055
3055
|
}
|
|
3056
|
-
const
|
|
3056
|
+
const Ge = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: r, palette: s, theme: h, phases: o, transitionOpacity: c, isError: l, errorMessage: u }) => {
|
|
3057
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);
|
|
3058
3058
|
if (n.charColor(v), n.cellColor(0, 0, 0, 0), l) {
|
|
3059
|
-
const
|
|
3060
|
-
n.charColor(
|
|
3061
|
-
const
|
|
3062
|
-
n.push(), n.translate(
|
|
3063
|
-
for (const y of
|
|
3059
|
+
const A = n.color(h.mode === "light" ? "#D32F2F" : "#FF6B6B", p);
|
|
3060
|
+
n.charColor(A), n.push(), n.translate(0, -2, 0), n.char("X"), n.rect(1, 1), n.pop();
|
|
3061
|
+
const m = "SETUP ERROR", w = -Math.floor(m.length / 2);
|
|
3062
|
+
n.push(), n.translate(w, 0, 0);
|
|
3063
|
+
for (const y of m) n.char(y), n.rect(1, 1), n.translateX(1);
|
|
3064
3064
|
if (n.pop(), u) {
|
|
3065
3065
|
const y = n.color(h.subtleColor), x = n.color(y.r, y.g, y.b, p);
|
|
3066
3066
|
n.charColor(x);
|
|
@@ -3069,419 +3069,419 @@ const He = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
|
|
|
3069
3069
|
for (const C of F) (T + " " + C).length <= E ? T = T ? T + " " + C : C : (T && P.push(T), T = C);
|
|
3070
3070
|
T && P.push(T);
|
|
3071
3071
|
const L = P.slice(0, 3);
|
|
3072
|
-
P.length > 3 && (L[2] = L[2].substring(0, E - 3) + "..."), L.forEach((C,
|
|
3073
|
-
const
|
|
3074
|
-
n.push(), n.translate(
|
|
3075
|
-
for (const
|
|
3072
|
+
P.length > 3 && (L[2] = L[2].substring(0, E - 3) + "..."), L.forEach((C, Q) => {
|
|
3073
|
+
const Vt = -Math.floor(C.length / 2);
|
|
3074
|
+
n.push(), n.translate(Vt, 3 + Q, 0);
|
|
3075
|
+
for (const Qt of C) n.char(Qt), n.rect(1, 1), n.translateX(1);
|
|
3076
3076
|
n.pop();
|
|
3077
3077
|
});
|
|
3078
3078
|
}
|
|
3079
3079
|
return;
|
|
3080
3080
|
}
|
|
3081
|
-
if (n.push(), n.translate(0, 0, 0), n.char(f[d]), n.rect(1, 1), n.pop(), e > 0 || o.some((
|
|
3082
|
-
const
|
|
3083
|
-
n.push(), n.translate(
|
|
3084
|
-
for (let x = 0; x <
|
|
3085
|
-
const E = x <
|
|
3081
|
+
if (n.push(), n.translate(0, 0, 0), n.char(f[d]), n.rect(1, 1), n.pop(), e > 0 || o.some((A) => A.status !== "pending")) {
|
|
3082
|
+
const A = Math.max(6, Math.floor(0.6 * t.cols)), m = -Math.floor(A / 2), w = Math.floor(A * e), y = s.length ? s : [n.color("#FFFFFF")];
|
|
3083
|
+
n.push(), n.translate(m, 3, 0);
|
|
3084
|
+
for (let x = 0; x < A; x++) {
|
|
3085
|
+
const E = x < w ? "*" : ".", F = y[x % y.length], P = n.color(F.r, F.g, F.b, p);
|
|
3086
3086
|
n.charColor(P), n.char(E), n.rect(1, 1), n.translateX(1);
|
|
3087
3087
|
}
|
|
3088
3088
|
n.pop();
|
|
3089
3089
|
}
|
|
3090
|
-
if (
|
|
3091
|
-
const
|
|
3092
|
-
n.charColor(
|
|
3093
|
-
const
|
|
3094
|
-
n.push(), n.translate(
|
|
3095
|
-
for (const y of
|
|
3090
|
+
if (r) {
|
|
3091
|
+
const A = n.color(h.subtleColor), m = n.color(A.r, A.g, A.b, p);
|
|
3092
|
+
n.charColor(m);
|
|
3093
|
+
const w = -Math.floor(r.length / 2);
|
|
3094
|
+
n.push(), n.translate(w, 5, 0);
|
|
3095
|
+
for (const y of r) n.char(y), n.rect(1, 1), n.translateX(1);
|
|
3096
3096
|
n.pop();
|
|
3097
3097
|
}
|
|
3098
3098
|
};
|
|
3099
3099
|
class it {
|
|
3100
3100
|
constructor(t, e = {}) {
|
|
3101
|
-
a(this, "ac");
|
|
3102
|
-
a(this, "nc");
|
|
3103
|
-
a(this, "cc");
|
|
3104
3101
|
a(this, "lc");
|
|
3102
|
+
a(this, "oc");
|
|
3105
3103
|
a(this, "uc");
|
|
3106
3104
|
a(this, "fc");
|
|
3107
3105
|
a(this, "dc");
|
|
3108
3106
|
a(this, "vc");
|
|
3109
3107
|
a(this, "gc");
|
|
3110
3108
|
a(this, "mc");
|
|
3111
|
-
a(this, "nr");
|
|
3112
3109
|
a(this, "_c");
|
|
3113
3110
|
a(this, "yc");
|
|
3111
|
+
a(this, "nr");
|
|
3114
3112
|
a(this, "wc");
|
|
3115
3113
|
a(this, "bc");
|
|
3116
|
-
a(this, "Cc"
|
|
3117
|
-
a(this, "xc"
|
|
3118
|
-
a(this, "Mc",
|
|
3119
|
-
this
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3114
|
+
a(this, "Cc");
|
|
3115
|
+
a(this, "xc");
|
|
3116
|
+
a(this, "Mc", null);
|
|
3117
|
+
a(this, "Fc", !1);
|
|
3118
|
+
a(this, "$c", []);
|
|
3119
|
+
this.lc = e.visible ?? !0, this.oc = e.opacity ?? 1, this.uc = e.blendMode ?? "normal", this.fc = e.offsetX ?? 0, this.dc = e.offsetY ?? 0, this.vc = e.rotationZ ?? 0, this.gc = e.fontSize ?? 16, this.mc = e.fontSource, e.fontSource instanceof et ? this.nr = e.fontSource : this.nr = new et(t, this.gc);
|
|
3120
|
+
}
|
|
3121
|
+
async Pc(t) {
|
|
3122
|
+
this._c = t, this.nr.Tr || await this.nr.wr(this.mc);
|
|
3123
3123
|
const e = this.nr.maxGlyphDimensions;
|
|
3124
|
-
this.
|
|
3125
|
-
const i = this.
|
|
3126
|
-
this.
|
|
3127
|
-
var
|
|
3128
|
-
this.
|
|
3124
|
+
this.yc = new Le(this._c.canvas.canvas, e.width, e.height);
|
|
3125
|
+
const i = this.yc;
|
|
3126
|
+
this.wc = this._c.createFramebuffer(i.cols, i.rows, 3), this.bc = this._c.createFramebuffer(i.width, i.height, 1), this.Cc = this._c.createFramebuffer(i.width, i.height, 1), this.xc = [this._c.createFramebuffer(i.width, i.height, 1, { depth: !1 }), this._c.createFramebuffer(i.width, i.height, 1, { depth: !1 })], this.Fc = !1, this.yc.Hr(() => {
|
|
3127
|
+
var r, s, h;
|
|
3128
|
+
this.wc.resize(this.yc.cols, this.yc.rows), this.bc.resize(this.yc.width, this.yc.height), (r = this.Cc) == null || r.resize(this.yc.width, this.yc.height), (s = this.xc) == null || s[0].resize(this.yc.width, this.yc.height), (h = this.xc) == null || h[1].resize(this.yc.width, this.yc.height);
|
|
3129
3129
|
});
|
|
3130
3130
|
}
|
|
3131
|
-
|
|
3132
|
-
return this.
|
|
3131
|
+
Tc() {
|
|
3132
|
+
return this.Mc !== null;
|
|
3133
3133
|
}
|
|
3134
|
-
|
|
3135
|
-
this.
|
|
3134
|
+
Ec(t) {
|
|
3135
|
+
this.Mc && this.Mc.call(t);
|
|
3136
3136
|
}
|
|
3137
3137
|
draw(t) {
|
|
3138
|
-
this.
|
|
3138
|
+
this.Mc = t;
|
|
3139
3139
|
}
|
|
3140
3140
|
show() {
|
|
3141
|
-
this.
|
|
3141
|
+
this.lc = !0;
|
|
3142
3142
|
}
|
|
3143
3143
|
hide() {
|
|
3144
|
-
this.
|
|
3144
|
+
this.lc = !1;
|
|
3145
3145
|
}
|
|
3146
3146
|
opacity(t) {
|
|
3147
|
-
if (t === void 0) return this.
|
|
3148
|
-
this.
|
|
3147
|
+
if (t === void 0) return this.oc;
|
|
3148
|
+
this.oc = Math.min(1, Math.max(0, t));
|
|
3149
3149
|
}
|
|
3150
3150
|
blendMode(t) {
|
|
3151
|
-
if (t === void 0) return this.
|
|
3152
|
-
this.
|
|
3151
|
+
if (t === void 0) return this.uc;
|
|
3152
|
+
this.uc = t;
|
|
3153
3153
|
}
|
|
3154
3154
|
offset(t, e = 0) {
|
|
3155
|
-
if (t === void 0) return { x: this.
|
|
3156
|
-
this.
|
|
3155
|
+
if (t === void 0) return { x: this.fc, y: this.dc };
|
|
3156
|
+
this.fc = t, this.dc = e;
|
|
3157
3157
|
}
|
|
3158
3158
|
rotateZ(t) {
|
|
3159
|
-
if (t === void 0) return this.
|
|
3160
|
-
this.
|
|
3159
|
+
if (t === void 0) return this.vc;
|
|
3160
|
+
this.vc = t;
|
|
3161
3161
|
}
|
|
3162
3162
|
filter(t, e) {
|
|
3163
|
-
this.
|
|
3163
|
+
this.$c.push({ name: t, params: e });
|
|
3164
3164
|
}
|
|
3165
3165
|
fontSize(t) {
|
|
3166
3166
|
if (t === void 0) return this.nr.fontSize;
|
|
3167
|
-
this.nr.Mr(t), this.
|
|
3167
|
+
this.nr.Mr(t), this.Rc();
|
|
3168
3168
|
}
|
|
3169
3169
|
async loadFont(t) {
|
|
3170
3170
|
if (!this.nr) throw Error("Layer font not initialized. Ensure layer is attached before loading fonts.");
|
|
3171
|
-
return t instanceof et ? (this.nr = t, this.nr.Tr || await this.nr.wr()) : await this.nr.Fr(t), this.
|
|
3172
|
-
}
|
|
3173
|
-
|
|
3174
|
-
const
|
|
3175
|
-
if (!this.
|
|
3176
|
-
if (!this.
|
|
3177
|
-
const
|
|
3178
|
-
this.
|
|
3171
|
+
return t instanceof et ? (this.nr = t, this.nr.Tr || await this.nr.wr()) : await this.nr.Fr(t), this.Rc(), this.nr;
|
|
3172
|
+
}
|
|
3173
|
+
ca(t, e, i) {
|
|
3174
|
+
const r = i == null ? void 0 : i.fallbackDraw;
|
|
3175
|
+
if (!this.lc) return void (this.Fc = !1);
|
|
3176
|
+
if (!this.Mc && !r) return void (this.Fc = !1);
|
|
3177
|
+
const s = this._c.renderer;
|
|
3178
|
+
this.wc.begin(), s.state.qt(), t.dn = this.nr, t.Sc = this.yc;
|
|
3179
3179
|
try {
|
|
3180
|
-
this.
|
|
3180
|
+
this.Mc ? this.Mc.call(t) : r == null || r();
|
|
3181
3181
|
} finally {
|
|
3182
|
-
t.dn = void 0, t.
|
|
3182
|
+
t.dn = void 0, t.Sc = void 0;
|
|
3183
3183
|
}
|
|
3184
|
-
this.
|
|
3185
|
-
const h = this.
|
|
3186
|
-
o.begin(),
|
|
3187
|
-
const c = this.
|
|
3188
|
-
e.O({ u_characterTexture: this.nr.fontFramebuffer, u_charsetDimensions: [this.nr.textureColumns, this.nr.textureRows],
|
|
3184
|
+
this.wc.end();
|
|
3185
|
+
const h = this.$c.length > 0, o = h ? this.Cc : this.bc;
|
|
3186
|
+
o.begin(), s.ve(e);
|
|
3187
|
+
const c = this.yc;
|
|
3188
|
+
e.O({ u_characterTexture: this.nr.fontFramebuffer, u_charsetDimensions: [this.nr.textureColumns, this.nr.textureRows], Ud: this.wc.textures[0], Ue: this.wc.textures[1], Uf: this.wc.textures[2], Ug: [c.cols, c.rows], Uh: [o.width, o.height], Ui: [0, 0, 0, 0] }), s.we(0, 0, c.width, c.height), o.end(), h && this._c.filterManager.zc(this.Cc.textures[0], this.bc, this.$c, this.bc.width, this.bc.height, this.xc), this.$c = [], this.Fc = !0;
|
|
3189
3189
|
}
|
|
3190
3190
|
Jr() {
|
|
3191
3191
|
var t;
|
|
3192
|
-
this.
|
|
3192
|
+
this.wc && this.bc && ((t = this.yc) == null || t.ti());
|
|
3193
3193
|
}
|
|
3194
3194
|
gt() {
|
|
3195
|
-
var t, e, i,
|
|
3196
|
-
(t = this.
|
|
3195
|
+
var t, e, i, r, s, h, o;
|
|
3196
|
+
(t = this.wc) == null || t.gt(), (e = this.bc) == null || e.gt(), (i = this.Cc) == null || i.gt(), (r = this.xc) == null || r[0].gt(), (s = this.xc) == null || s[1].gt(), (h = this.nr) == null || h.gt(), (o = this.yc) == null || o.gt();
|
|
3197
3197
|
}
|
|
3198
3198
|
get texture() {
|
|
3199
3199
|
var t;
|
|
3200
|
-
return (t = this.
|
|
3200
|
+
return (t = this.bc) == null ? void 0 : t.textures[0];
|
|
3201
3201
|
}
|
|
3202
3202
|
get grid() {
|
|
3203
|
-
return this.
|
|
3203
|
+
return this.yc;
|
|
3204
3204
|
}
|
|
3205
3205
|
get font() {
|
|
3206
3206
|
if (!this.nr) throw Error("Layer font not initialized. Ensure font is set before accessing.");
|
|
3207
3207
|
return this.nr;
|
|
3208
3208
|
}
|
|
3209
3209
|
get width() {
|
|
3210
|
-
return this.
|
|
3210
|
+
return this.bc ? this.bc.width : 0;
|
|
3211
3211
|
}
|
|
3212
3212
|
get height() {
|
|
3213
|
-
return this.
|
|
3213
|
+
return this.bc ? this.bc.height : 0;
|
|
3214
3214
|
}
|
|
3215
|
-
get
|
|
3216
|
-
return this.
|
|
3215
|
+
get kc() {
|
|
3216
|
+
return this.Fc;
|
|
3217
3217
|
}
|
|
3218
3218
|
get drawFramebuffer() {
|
|
3219
|
-
return this.
|
|
3219
|
+
return this.wc;
|
|
3220
3220
|
}
|
|
3221
3221
|
get asciiFramebuffer() {
|
|
3222
|
-
return this.
|
|
3222
|
+
return this.bc;
|
|
3223
3223
|
}
|
|
3224
|
-
|
|
3225
|
-
if (!this.
|
|
3224
|
+
Rc() {
|
|
3225
|
+
if (!this.yc || !this.nr) return;
|
|
3226
3226
|
const t = this.nr.maxGlyphDimensions;
|
|
3227
|
-
this.
|
|
3227
|
+
this.yc.Qr(t.width, t.height), this.wc && this.bc && this.Jr();
|
|
3228
3228
|
}
|
|
3229
3229
|
}
|
|
3230
|
-
const
|
|
3231
|
-
class
|
|
3230
|
+
const qe = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
|
|
3231
|
+
class Yt {
|
|
3232
3232
|
constructor(t, e, i) {
|
|
3233
|
-
a(this, "
|
|
3233
|
+
a(this, "fa");
|
|
3234
3234
|
a(this, "l");
|
|
3235
|
-
a(this, "zc");
|
|
3236
|
-
a(this, "hc");
|
|
3237
|
-
a(this, "kc");
|
|
3238
3235
|
a(this, "Dc");
|
|
3236
|
+
a(this, "ac");
|
|
3239
3237
|
a(this, "Lc");
|
|
3240
3238
|
a(this, "Oc");
|
|
3241
|
-
a(this, "Ic", []);
|
|
3242
3239
|
a(this, "Bc");
|
|
3243
|
-
a(this, "
|
|
3244
|
-
a(this, "
|
|
3245
|
-
a(this, "
|
|
3240
|
+
a(this, "Ic");
|
|
3241
|
+
a(this, "Hc", []);
|
|
3242
|
+
a(this, "Gc");
|
|
3243
|
+
a(this, "Qc", performance.now());
|
|
3244
|
+
a(this, "Nc", 0);
|
|
3245
|
+
a(this, "Xc", !1);
|
|
3246
3246
|
a(this, "Ar", !1);
|
|
3247
|
-
a(this, "
|
|
3248
|
-
this.
|
|
3249
|
-
const
|
|
3250
|
-
this.
|
|
3251
|
-
|
|
3247
|
+
a(this, "Zc");
|
|
3248
|
+
this.fa = t, this.l = { ...qe, ...e ?? {} }, this.Dc = new Ot("active"), this.ac = new _t(), this.Lc = new Zt(this.l.transition, this.l.transitionDuration), this.Oc = new Ut(60), this.Gc = gt(this.l, i);
|
|
3249
|
+
const r = It(this.Gc);
|
|
3250
|
+
this.Hc = Xt(r, this.fa), this.Ic = this.Yc(), this.ac.ka((s) => {
|
|
3251
|
+
s >= 0.999 && this.Za();
|
|
3252
3252
|
});
|
|
3253
3253
|
}
|
|
3254
3254
|
async wr() {
|
|
3255
3255
|
if (this.Ar) return;
|
|
3256
|
-
const t = this.
|
|
3257
|
-
this.
|
|
3256
|
+
const t = this.fa.Z, e = this.fa.kr, i = this.fa.jc;
|
|
3257
|
+
this.Bc = new it(t, { visible: !0, opacity: 1, fontSize: 16 }), await this.Bc.Pc({ renderer: t, canvas: e, filterManager: i, createFramebuffer: (r, s, h = 1, o) => t.Pe(r, s, h, o) }), this.Ar = !0;
|
|
3258
3258
|
}
|
|
3259
|
-
get
|
|
3260
|
-
return this.
|
|
3259
|
+
get Ya() {
|
|
3260
|
+
return this.Dc.Ya && this.Xc;
|
|
3261
3261
|
}
|
|
3262
|
-
|
|
3263
|
-
this.
|
|
3262
|
+
In() {
|
|
3263
|
+
this.Xc || (this.Xc = !0, this.Qc = performance.now(), this.Nc = 0, this.Oc.In(() => this.Kc()));
|
|
3264
3264
|
}
|
|
3265
3265
|
Hn() {
|
|
3266
|
-
this.
|
|
3266
|
+
this.Xc && (this.Xc = !1, this.Oc.Hn());
|
|
3267
3267
|
}
|
|
3268
3268
|
Jr() {
|
|
3269
|
-
this.Ar && this.
|
|
3269
|
+
this.Ar && this.Bc.Jr();
|
|
3270
3270
|
}
|
|
3271
3271
|
gt() {
|
|
3272
|
-
this.Hn(), this.Ar && (this.
|
|
3272
|
+
this.Hn(), this.Ar && (this.Bc.gt(), this.Ar = !1);
|
|
3273
3273
|
}
|
|
3274
3274
|
get progress() {
|
|
3275
|
-
return this.
|
|
3275
|
+
return this.ac.za;
|
|
3276
3276
|
}
|
|
3277
3277
|
message(t) {
|
|
3278
3278
|
return typeof t == "string" && (this.l.message = t), this.l.message;
|
|
3279
3279
|
}
|
|
3280
3280
|
addPhase(t, e = 1) {
|
|
3281
|
-
this.
|
|
3282
|
-
const i = this.
|
|
3283
|
-
return new zt(this.
|
|
3281
|
+
this.Dc.Wa();
|
|
3282
|
+
const i = this.ac.Da(t, e);
|
|
3283
|
+
return new zt(this.ac, i, t, (r) => this.error(r));
|
|
3284
3284
|
}
|
|
3285
|
-
|
|
3286
|
-
this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.
|
|
3285
|
+
Za() {
|
|
3286
|
+
this.Dc.Na !== "error" && (this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.Dc.qa(), this.Lc.In()) : (this.Dc.Za(), this.Hn(), this.Wc()));
|
|
3287
3287
|
}
|
|
3288
|
-
|
|
3289
|
-
this.
|
|
3288
|
+
Wc() {
|
|
3289
|
+
this.Zc && this.Zc();
|
|
3290
3290
|
}
|
|
3291
|
-
|
|
3292
|
-
this.
|
|
3291
|
+
qc(t) {
|
|
3292
|
+
this.Zc = t;
|
|
3293
3293
|
}
|
|
3294
3294
|
error(t) {
|
|
3295
|
-
this.
|
|
3295
|
+
this.Dc.Ja(t);
|
|
3296
3296
|
}
|
|
3297
|
-
|
|
3298
|
-
if (this.
|
|
3299
|
-
if (this.
|
|
3300
|
-
return this.
|
|
3301
|
-
this.
|
|
3297
|
+
Kc() {
|
|
3298
|
+
if (this.Dc.Ya) {
|
|
3299
|
+
if (this.Nc++, this.Dc.Na === "transitioning" && this.Lc.et())
|
|
3300
|
+
return this.Dc.Va(), this.Wc(), void this.Hn();
|
|
3301
|
+
this.Vc();
|
|
3302
3302
|
}
|
|
3303
3303
|
}
|
|
3304
|
-
|
|
3304
|
+
Vc() {
|
|
3305
3305
|
if (!this.Ar) return;
|
|
3306
|
-
const t = this.
|
|
3306
|
+
const t = this.Bc, e = t.grid, i = this.fa.Z, r = this.fa.Jc, s = this.fa.tl, h = { textmodifier: this.fa, grid: e, progress: this.progress, elapsedMs: performance.now() - this.Qc, frameCount: this.Nc, message: this.l.message, palette: this.Hc, theme: this.Gc, phases: this.ac.Ia(), transitionOpacity: this.Lc.oc, isError: this.Dc.Na === "error", errorMessage: this.Dc.ja || void 0, errorDetails: this.Dc.Ka || void 0 };
|
|
3307
3307
|
t.draw(() => {
|
|
3308
|
-
this.
|
|
3308
|
+
this.fa.clear(), this.fa.push();
|
|
3309
3309
|
try {
|
|
3310
|
-
this.
|
|
3310
|
+
this.Ic(h);
|
|
3311
3311
|
} finally {
|
|
3312
|
-
this.
|
|
3312
|
+
this.fa.pop();
|
|
3313
3313
|
}
|
|
3314
|
-
}), t.
|
|
3314
|
+
}), t.ca(this.fa, r);
|
|
3315
3315
|
const o = t.texture;
|
|
3316
|
-
o && (i.wi(...i.state.canvasBackgroundColor), i.ve(
|
|
3316
|
+
o && (i.wi(...i.state.canvasBackgroundColor), i.ve(s), s.O({ u_texture: o }), i.we(e.offsetX, e.offsetY, e.width, e.height));
|
|
3317
3317
|
}
|
|
3318
|
-
|
|
3319
|
-
this.
|
|
3318
|
+
sl(t) {
|
|
3319
|
+
this.Gc = gt(this.l, t);
|
|
3320
3320
|
}
|
|
3321
|
-
|
|
3322
|
-
const t = this.l.renderer ||
|
|
3321
|
+
Yc() {
|
|
3322
|
+
const t = this.l.renderer || Ge;
|
|
3323
3323
|
return (e) => {
|
|
3324
|
-
t(e), this.
|
|
3324
|
+
t(e), this.il(e);
|
|
3325
3325
|
};
|
|
3326
3326
|
}
|
|
3327
|
-
|
|
3328
|
-
const { textmodifier: e, grid: i, frameCount:
|
|
3327
|
+
il(t) {
|
|
3328
|
+
const { textmodifier: e, grid: i, frameCount: r, theme: s, transitionOpacity: h } = t, o = [116, 101, 120, 116, 109, 111, 100, 101, 46, 106, 115].map((f) => String.fromCharCode(f)).join(""), c = (i.rows + 1 >> 1) - 2, l = 2 - (i.cols + 1 >> 1), u = s.mode === "light" ? [[233, 30, 99], [156, 39, 176], [255, 111, 0]] : [[142, 249, 243], [241, 91, 181], [255, 155, 113]];
|
|
3329
3329
|
e.push(), e.translate(l, c, 0);
|
|
3330
3330
|
for (let f = 0; f < o.length; f++) {
|
|
3331
|
-
const d = o[f], g = Math.floor(0.1 *
|
|
3332
|
-
e.charColor(
|
|
3331
|
+
const d = o[f], g = Math.floor(0.1 * r + 0.5 * f) % u.length, [p, v, A] = u[g], m = Math.floor(255 * h), w = e.color(p, v, A, m);
|
|
3332
|
+
e.charColor(w), e.char(d), e.point(), e.translateX(1);
|
|
3333
3333
|
}
|
|
3334
3334
|
e.pop();
|
|
3335
3335
|
}
|
|
3336
3336
|
}
|
|
3337
|
-
const
|
|
3338
|
-
class
|
|
3337
|
+
const bt = { normal: 0, additive: 1, multiply: 2, screen: 3, subtract: 4, darken: 5, lighten: 6, overlay: 7, softLight: 8, hardLight: 9, colorDodge: 10, colorBurn: 11, difference: 12, exclusion: 13 };
|
|
3338
|
+
class kt {
|
|
3339
3339
|
constructor(t, e, i) {
|
|
3340
3340
|
a(this, "Z");
|
|
3341
|
-
a(this, "
|
|
3342
|
-
a(this, "
|
|
3343
|
-
a(this, "
|
|
3344
|
-
this.Z = t, this.
|
|
3345
|
-
precision highp float;uniform sampler2D
|
|
3346
|
-
}
|
|
3347
|
-
|
|
3348
|
-
const e = this.Z.context, { base: i, targetFramebuffer:
|
|
3341
|
+
a(this, "el");
|
|
3342
|
+
a(this, "xc");
|
|
3343
|
+
a(this, "rl", 0);
|
|
3344
|
+
this.Z = t, this.el = t.pe(V, `#version 300 es
|
|
3345
|
+
precision highp float;uniform sampler2D Uj;uniform sampler2D Uk;uniform vec2 Ul;uniform vec2 Um;uniform vec2 Un;uniform float Uo;uniform float Up;uniform int Uq;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(Uk,v_uv);vec2 h=v_uv*Ul;vec2 i=h-Un;vec2 j=Um*0.5;vec2 k=i-j;float l=cos(-Up);float m=sin(-Up);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,Um));if(o){fragColor=g;return;}vec2 p=(floor(i)+0.5)/Um;vec4 q=texture(Uj,p);float r=q.a*Uo;if(r<=0.){fragColor=g;return;}vec3 s=e(Uq,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`), this.xc = [this.Z.Pe(e, i, 1), this.Z.Pe(e, i, 1)];
|
|
3346
|
+
}
|
|
3347
|
+
nl(t) {
|
|
3348
|
+
const e = this.Z.context, { base: i, targetFramebuffer: r, backgroundColor: s, layers: h, canvasWidth: o, canvasHeight: c } = t, l = e.isEnabled(e.DEPTH_TEST), u = e.getParameter(e.DEPTH_WRITEMASK);
|
|
3349
3349
|
l && e.disable(e.DEPTH_TEST), u && e.depthMask(!1);
|
|
3350
|
-
const f = this.
|
|
3351
|
-
f.begin(), this.Z.wi(...
|
|
3350
|
+
const f = this.xc[0];
|
|
3351
|
+
f.begin(), this.Z.wi(...s), f.end(), this.rl = 0, i.layer.lc && this.ol(i.texture, o, c, i.width, i.height, i.layer.oc, i.offsetX, i.offsetY, i.layer.vc, "normal", e);
|
|
3352
3352
|
for (const d of h) {
|
|
3353
3353
|
const g = d.layer;
|
|
3354
|
-
g.
|
|
3354
|
+
g.lc && g.kc && this.ol(d.texture, o, c, d.width, d.height, g.oc, d.offsetX, d.offsetY, g.vc, g.uc, e);
|
|
3355
3355
|
}
|
|
3356
|
-
this.
|
|
3356
|
+
this.hl(r, o, c, e), e.depthMask(u), l && e.enable(e.DEPTH_TEST);
|
|
3357
3357
|
}
|
|
3358
|
-
|
|
3359
|
-
const d = this.
|
|
3360
|
-
p.begin(), f.disable(f.BLEND), this.Z.ve(this.
|
|
3358
|
+
ol(t, e, i, r, s, h, o, c, l, u, f) {
|
|
3359
|
+
const d = this.xc[this.rl], g = this.rl === 0 ? 1 : 0, p = this.xc[g], v = l * (Math.PI / 180);
|
|
3360
|
+
p.begin(), f.disable(f.BLEND), this.Z.ve(this.el), this.el.O({ Uj: t, Uk: d.textures[0], Ul: [e, i], Um: [r, s], Un: [o, c], Uo: h, Up: v, Uq: bt[u] }), this.Z.we(0, 0, d.width, d.height), p.end(), this.rl = g;
|
|
3361
3361
|
}
|
|
3362
|
-
|
|
3363
|
-
const
|
|
3364
|
-
t.begin(),
|
|
3362
|
+
hl(t, e, i, r) {
|
|
3363
|
+
const s = this.xc[this.rl];
|
|
3364
|
+
t.begin(), r.disable(r.BLEND), this.Z.ve(this.el), this.el.O({ Uj: s.textures[0], Uk: s.textures[0], Ul: [e, i], Um: [s.width, s.height], Un: [0, 0], Uo: 1, Up: 0, Uq: bt.normal }), this.Z.we(0, 0, e, i), t.end();
|
|
3365
3365
|
}
|
|
3366
3366
|
Jr(t, e) {
|
|
3367
|
-
this.
|
|
3367
|
+
this.xc[0].resize(t, e), this.xc[1].resize(t, e);
|
|
3368
3368
|
}
|
|
3369
3369
|
gt() {
|
|
3370
|
-
this.
|
|
3370
|
+
this.el.dispose(), this.xc[0].gt(), this.xc[1].gt();
|
|
3371
3371
|
}
|
|
3372
3372
|
}
|
|
3373
|
-
class
|
|
3373
|
+
class Ht {
|
|
3374
3374
|
constructor(t, e) {
|
|
3375
|
-
a(this, "
|
|
3375
|
+
a(this, "fa");
|
|
3376
3376
|
a(this, "Z");
|
|
3377
|
-
a(this, "
|
|
3378
|
-
a(this, "
|
|
3379
|
-
a(this, "
|
|
3380
|
-
a(this, "
|
|
3381
|
-
a(this, "
|
|
3382
|
-
a(this, "
|
|
3383
|
-
a(this, "
|
|
3384
|
-
this.
|
|
3377
|
+
a(this, "al");
|
|
3378
|
+
a(this, "cl");
|
|
3379
|
+
a(this, "ll", []);
|
|
3380
|
+
a(this, "ul", []);
|
|
3381
|
+
a(this, "fl");
|
|
3382
|
+
a(this, "dl", !1);
|
|
3383
|
+
a(this, "vl", /* @__PURE__ */ new Set());
|
|
3384
|
+
this.fa = t, this.Z = t.Z, this.al = t.Jc, this.cl = new kt(this.Z, this.fa.kr.width, this.fa.kr.height), this.fl = new it(this.Z, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
|
|
3385
3385
|
}
|
|
3386
3386
|
async wr() {
|
|
3387
|
-
if (!this.
|
|
3388
|
-
await this.
|
|
3389
|
-
for (const t of this.
|
|
3390
|
-
this.
|
|
3387
|
+
if (!this.dl) {
|
|
3388
|
+
await this.pl(this.fl);
|
|
3389
|
+
for (const t of this.ll) await this.pl(t), this.ul.push(t);
|
|
3390
|
+
this.ll = [], this.dl = !0;
|
|
3391
3391
|
}
|
|
3392
3392
|
}
|
|
3393
3393
|
add(t = {}) {
|
|
3394
3394
|
const e = new it(this.Z, t);
|
|
3395
|
-
return this.
|
|
3395
|
+
return this.dl ? (this.pl(e), this.ul.push(e)) : this.ll.push(e), e;
|
|
3396
3396
|
}
|
|
3397
3397
|
remove(t) {
|
|
3398
|
-
this.
|
|
3398
|
+
this.ml(this.ul, t) || this.ml(this.ll, t);
|
|
3399
3399
|
}
|
|
3400
3400
|
move(t, e) {
|
|
3401
|
-
this.
|
|
3401
|
+
this._l(this.ul, t, e) || this._l(this.ll, t, e);
|
|
3402
3402
|
}
|
|
3403
3403
|
swap(t, e) {
|
|
3404
|
-
t !== e && (this.
|
|
3404
|
+
t !== e && (this.yl(this.ul, t, e) || this.yl(this.ll, t, e));
|
|
3405
3405
|
}
|
|
3406
3406
|
clear() {
|
|
3407
|
-
this.
|
|
3407
|
+
this.fl.gt(), this.ul.forEach((t) => t.gt()), this.ul = [], this.ll.forEach((t) => t.gt()), this.ll = [];
|
|
3408
3408
|
}
|
|
3409
|
-
|
|
3410
|
-
this.
|
|
3409
|
+
Al(t, e) {
|
|
3410
|
+
this.fl.ca(this.fa, this.al, { fallbackDraw: e });
|
|
3411
3411
|
const i = [...this.Z.state.canvasBackgroundColor];
|
|
3412
|
-
this.
|
|
3412
|
+
this.wl(), this.bl(t, i);
|
|
3413
3413
|
}
|
|
3414
|
-
|
|
3415
|
-
this.
|
|
3414
|
+
wl() {
|
|
3415
|
+
this.ul.length !== 0 && this.ul.forEach((t) => t.ca(this.fa, this.al));
|
|
3416
3416
|
}
|
|
3417
|
-
|
|
3418
|
-
const i = this.
|
|
3419
|
-
if (!
|
|
3420
|
-
const h = { layer: this.
|
|
3417
|
+
bl(t, e) {
|
|
3418
|
+
const i = this.fa.kr, r = this.fl.grid, s = this.fl.texture;
|
|
3419
|
+
if (!s) return;
|
|
3420
|
+
const h = { layer: this.fl, texture: s, width: r.width, height: r.height, offsetX: r.offsetX + this.fl.fc, offsetY: r.offsetY + this.fl.dc }, o = this.ul.map((c) => {
|
|
3421
3421
|
const l = c.grid;
|
|
3422
|
-
return { layer: c, texture: c.texture, width: l.width, height: l.height, offsetX: l.offsetX + c.
|
|
3422
|
+
return { layer: c, texture: c.texture, width: l.width, height: l.height, offsetX: l.offsetX + c.fc, offsetY: l.offsetY + c.dc };
|
|
3423
3423
|
});
|
|
3424
|
-
this.
|
|
3424
|
+
this.cl.nl({ base: h, layers: o, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
|
|
3425
3425
|
}
|
|
3426
3426
|
Jr() {
|
|
3427
|
-
this.
|
|
3427
|
+
this.dl && (this.fl.Jr(), this.ul.forEach((t) => t.Jr()), this.cl.Jr(this.fa.kr.width, this.fa.kr.height));
|
|
3428
3428
|
}
|
|
3429
3429
|
gt() {
|
|
3430
|
-
this.
|
|
3430
|
+
this.ul.forEach((t) => t.gt()), this.ll.forEach((t) => t.gt()), this.fl.gt(), this.cl.gt();
|
|
3431
3431
|
}
|
|
3432
3432
|
get all() {
|
|
3433
|
-
return this.
|
|
3433
|
+
return this.ul;
|
|
3434
3434
|
}
|
|
3435
3435
|
get base() {
|
|
3436
|
-
return this.
|
|
3436
|
+
return this.fl;
|
|
3437
3437
|
}
|
|
3438
|
-
|
|
3439
|
-
for (let t = this.
|
|
3440
|
-
const e = this.
|
|
3441
|
-
if (e.
|
|
3438
|
+
Cl() {
|
|
3439
|
+
for (let t = this.ul.length - 1; t >= 0; t--) {
|
|
3440
|
+
const e = this.ul[t];
|
|
3441
|
+
if (e.lc && e.grid) return e.grid;
|
|
3442
3442
|
}
|
|
3443
|
-
return this.
|
|
3443
|
+
return this.fl.grid;
|
|
3444
3444
|
}
|
|
3445
|
-
|
|
3446
|
-
this.
|
|
3445
|
+
xl(t) {
|
|
3446
|
+
this.vl.add(t);
|
|
3447
3447
|
}
|
|
3448
|
-
|
|
3449
|
-
for (const t of this.
|
|
3448
|
+
Ml() {
|
|
3449
|
+
for (const t of this.vl) t();
|
|
3450
3450
|
}
|
|
3451
|
-
async
|
|
3451
|
+
async pl(t) {
|
|
3452
3452
|
var i;
|
|
3453
|
-
const e = { renderer: this.Z, canvas: this.
|
|
3454
|
-
await t.
|
|
3453
|
+
const e = { renderer: this.Z, canvas: this.fa.kr, filterManager: this.fa.jc, createFramebuffer: (r, s, h = 1, o) => this.Z.Pe(r, s, h, o) };
|
|
3454
|
+
await t.Pc(e), (i = t.grid) == null || i.Hr(() => this.Ml());
|
|
3455
3455
|
}
|
|
3456
|
-
|
|
3456
|
+
ml(t, e) {
|
|
3457
3457
|
const i = t.indexOf(e);
|
|
3458
3458
|
if (i === -1) return !1;
|
|
3459
|
-
const [
|
|
3460
|
-
return
|
|
3459
|
+
const [r] = t.splice(i, 1);
|
|
3460
|
+
return r.gt(), !0;
|
|
3461
3461
|
}
|
|
3462
|
-
|
|
3463
|
-
const
|
|
3464
|
-
if (
|
|
3465
|
-
t.splice(
|
|
3466
|
-
const
|
|
3467
|
-
return t.splice(
|
|
3462
|
+
_l(t, e, i) {
|
|
3463
|
+
const r = t.indexOf(e);
|
|
3464
|
+
if (r === -1) return !1;
|
|
3465
|
+
t.splice(r, 1);
|
|
3466
|
+
const s = Math.max(0, Math.min(t.length, i));
|
|
3467
|
+
return t.splice(s, 0, e), !0;
|
|
3468
3468
|
}
|
|
3469
|
-
|
|
3470
|
-
const
|
|
3471
|
-
if (
|
|
3472
|
-
const
|
|
3473
|
-
return
|
|
3469
|
+
yl(t, e, i) {
|
|
3470
|
+
const r = t.indexOf(e);
|
|
3471
|
+
if (r === -1) return !1;
|
|
3472
|
+
const s = t.indexOf(i);
|
|
3473
|
+
return s !== -1 && (t[r] = i, t[s] = e, !0);
|
|
3474
3474
|
}
|
|
3475
3475
|
}
|
|
3476
|
-
class
|
|
3476
|
+
class Gt {
|
|
3477
3477
|
constructor(t) {
|
|
3478
3478
|
a(this, "Z");
|
|
3479
|
-
a(this, "
|
|
3480
|
-
a(this, "
|
|
3481
|
-
this.Z = t, this.
|
|
3479
|
+
a(this, "Fl", /* @__PURE__ */ new Map());
|
|
3480
|
+
a(this, "$l", /* @__PURE__ */ new Map());
|
|
3481
|
+
this.Z = t, this.Pl();
|
|
3482
3482
|
}
|
|
3483
|
-
async
|
|
3484
|
-
const
|
|
3483
|
+
async Tl(t, e, i = {}) {
|
|
3484
|
+
const r = Object.entries(i), s = r.length > 0 ? r[0][1][0] : null;
|
|
3485
3485
|
let h;
|
|
3486
3486
|
if (typeof e == "string") {
|
|
3487
3487
|
let c = e;
|
|
@@ -3490,272 +3490,272 @@ class Ht {
|
|
|
3490
3490
|
if (!l.ok) throw Error(`Failed to load shader from ${e}: ${l.statusText}`);
|
|
3491
3491
|
c = await l.text();
|
|
3492
3492
|
}
|
|
3493
|
-
h = this.Z.pe(
|
|
3494
|
-
} else h = e, this.
|
|
3493
|
+
h = this.Z.pe(V, c), this.$l.set(t, h);
|
|
3494
|
+
} else h = e, this.$l.set(t, h);
|
|
3495
3495
|
const o = { id: t, createShader: () => h, createUniforms: (c, l) => {
|
|
3496
3496
|
const u = { u_resolution: [l.width, l.height] };
|
|
3497
|
-
for (const [f, [d, g]] of
|
|
3497
|
+
for (const [f, [d, g]] of r) {
|
|
3498
3498
|
let p = g;
|
|
3499
|
-
c != null && (typeof c == "number" && d ===
|
|
3499
|
+
c != null && (typeof c == "number" && d === s ? p = c : typeof c == "object" && d in c && (p = c[d] ?? g)), u[f] = p;
|
|
3500
3500
|
}
|
|
3501
3501
|
return u;
|
|
3502
3502
|
} };
|
|
3503
|
-
this.
|
|
3503
|
+
this.Fl.set(t, o);
|
|
3504
3504
|
}
|
|
3505
|
-
|
|
3506
|
-
const e = this.
|
|
3507
|
-
return e && (e.dispose(), this.
|
|
3505
|
+
El(t) {
|
|
3506
|
+
const e = this.$l.get(t);
|
|
3507
|
+
return e && (e.dispose(), this.$l.delete(t)), this.Fl.delete(t);
|
|
3508
3508
|
}
|
|
3509
3509
|
Pn(t) {
|
|
3510
|
-
return this.
|
|
3510
|
+
return this.Fl.get(t);
|
|
3511
3511
|
}
|
|
3512
3512
|
gt() {
|
|
3513
|
-
for (const t of this.
|
|
3514
|
-
this.
|
|
3513
|
+
for (const t of this.$l.values()) t.dispose();
|
|
3514
|
+
this.$l.clear(), this.Fl.clear();
|
|
3515
3515
|
}
|
|
3516
|
-
|
|
3517
|
-
this
|
|
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
|
|
3519
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3520
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3521
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3516
|
+
Pl() {
|
|
3517
|
+
this.Tl("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.Tl("grayscale", `#version 300 es
|
|
3519
|
+
precision highp float;uniform sampler2D u_texture;uniform float U0;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),U0);fragColor=vec4(C,A.a);}`, { U0: ["amount", 1] }), this.Tl("sepia", `#version 300 es
|
|
3520
|
+
precision highp float;uniform sampler2D u_texture;uniform float U0;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,U0);fragColor=vec4(C,A.a);}`, { U0: ["amount", 1] }), this.Tl("threshold", `#version 300 es
|
|
3521
|
+
precision highp float;uniform sampler2D u_texture;uniform float U1;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(U1,B);fragColor=vec4(vec3(C),A.a);}`, { U1: ["threshold", 0.5] });
|
|
3522
3522
|
}
|
|
3523
3523
|
}
|
|
3524
|
-
class
|
|
3524
|
+
class qt {
|
|
3525
3525
|
constructor(t) {
|
|
3526
3526
|
a(this, "Z");
|
|
3527
|
-
a(this, "
|
|
3527
|
+
a(this, "$l", /* @__PURE__ */ new Map());
|
|
3528
3528
|
a(this, "J");
|
|
3529
|
-
a(this, "
|
|
3529
|
+
a(this, "xc");
|
|
3530
3530
|
a(this, "Ar", !1);
|
|
3531
|
-
a(this, "
|
|
3532
|
-
this.Z = t, this.
|
|
3531
|
+
a(this, "Rl");
|
|
3532
|
+
this.Z = t, this.Rl = new Gt(this.Z), this.J = t.pe(V, Dt);
|
|
3533
3533
|
}
|
|
3534
3534
|
async register(t, e, i = {}) {
|
|
3535
|
-
await this.Tl
|
|
3535
|
+
await this.Rl.Tl(t, e, i);
|
|
3536
3536
|
}
|
|
3537
3537
|
unregister(t) {
|
|
3538
|
-
return this.
|
|
3538
|
+
return this.Rl.El(t) ?? !1;
|
|
3539
3539
|
}
|
|
3540
3540
|
has(t) {
|
|
3541
|
-
return this.
|
|
3541
|
+
return this.Rl.Pn(t) !== void 0;
|
|
3542
3542
|
}
|
|
3543
3543
|
wr(t, e) {
|
|
3544
|
-
this.Ar || (this.
|
|
3544
|
+
this.Ar || (this.xc = [this.Z.Pe(t, e, 1, { depth: !1 }), this.Z.Pe(t, e, 1, { depth: !1 })], this.Ar = !0);
|
|
3545
3545
|
}
|
|
3546
|
-
|
|
3547
|
-
this.
|
|
3546
|
+
Sl(t, e, i, r, s) {
|
|
3547
|
+
this.xc[0].width === r && this.xc[0].height === s || (this.xc[0].resize(r, s), this.xc[1].resize(r, s)), this.zc(t, e, i, r, s, this.xc);
|
|
3548
3548
|
}
|
|
3549
|
-
|
|
3550
|
-
if (i.length === 0) return void this.
|
|
3549
|
+
zc(t, e, i, r, s, h) {
|
|
3550
|
+
if (i.length === 0) return void this.zl(t, e, r, s);
|
|
3551
3551
|
const o = this.Z.context, c = o.isEnabled(o.BLEND);
|
|
3552
|
-
o.disable(o.BLEND), this.
|
|
3552
|
+
o.disable(o.BLEND), this.zl(t, h[0], r, s);
|
|
3553
3553
|
let l = 0;
|
|
3554
3554
|
for (let u = 0; u < i.length; u++) {
|
|
3555
3555
|
const f = i[u], d = u === i.length - 1, g = l === 0 ? 1 : 0, p = d ? e : h[g];
|
|
3556
|
-
this.
|
|
3556
|
+
this.kl(f, h[l], p, r, s), d || (l = g);
|
|
3557
3557
|
}
|
|
3558
3558
|
c && o.enable(o.BLEND);
|
|
3559
3559
|
}
|
|
3560
|
-
|
|
3561
|
-
const h = this.
|
|
3562
|
-
if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.
|
|
3563
|
-
const o = this.
|
|
3560
|
+
kl(t, e, i, r, s) {
|
|
3561
|
+
const h = this.Rl.Pn(t.name);
|
|
3562
|
+
if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.zl(e.textures[0], i, r, s);
|
|
3563
|
+
const o = this.Dl(t.name, h, r, s), c = { renderer: this.Z, gl: this.Z.context, width: r, height: s };
|
|
3564
3564
|
i.begin(), this.Z.ve(o), o.O({ u_texture: e.textures[0] });
|
|
3565
3565
|
const l = h.createUniforms(t.params, c);
|
|
3566
|
-
o.O(l), this.Z.we(0, 0,
|
|
3566
|
+
o.O(l), this.Z.we(0, 0, r, s), i.end();
|
|
3567
3567
|
}
|
|
3568
|
-
|
|
3569
|
-
let
|
|
3570
|
-
if (!
|
|
3571
|
-
const h = { renderer: this.Z, gl: this.Z.context, width: i, height:
|
|
3572
|
-
|
|
3568
|
+
Dl(t, e, i, r) {
|
|
3569
|
+
let s = this.$l.get(t);
|
|
3570
|
+
if (!s && e) {
|
|
3571
|
+
const h = { renderer: this.Z, gl: this.Z.context, width: i, height: r };
|
|
3572
|
+
s = e.createShader(h), this.$l.set(t, s);
|
|
3573
3573
|
}
|
|
3574
|
-
return
|
|
3574
|
+
return s;
|
|
3575
3575
|
}
|
|
3576
|
-
|
|
3577
|
-
e.begin(), this.Z.ve(this.J), this.J.O({ u_texture: t, u_resolution: [i,
|
|
3576
|
+
zl(t, e, i, r) {
|
|
3577
|
+
e.begin(), this.Z.ve(this.J), this.J.O({ u_texture: t, u_resolution: [i, r] }), this.Z.we(0, 0, i, r), e.end();
|
|
3578
3578
|
}
|
|
3579
3579
|
Jr(t, e) {
|
|
3580
|
-
this.
|
|
3580
|
+
this.xc && (this.xc[0].resize(t, e), this.xc[1].resize(t, e));
|
|
3581
3581
|
}
|
|
3582
3582
|
gt() {
|
|
3583
|
-
for (const t of this.
|
|
3584
|
-
this.
|
|
3583
|
+
for (const t of this.$l.values()) t.dispose();
|
|
3584
|
+
this.$l.clear(), this.J.dispose(), this.Rl.gt(), this.xc && (this.xc[0].gt(), this.xc[1].gt()), this.Ar = !1;
|
|
3585
3585
|
}
|
|
3586
3586
|
}
|
|
3587
|
-
const
|
|
3587
|
+
const Qe = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: Gt, TextmodeFilterManager: qt }, Symbol.toStringTag, { value: "Module" }));
|
|
3588
3588
|
let lt = null;
|
|
3589
|
-
const
|
|
3589
|
+
const We = { id: "brightness", createShader: ({ gl: n }) => (lt || (lt = new W(n, rt, `#version 300 es
|
|
3590
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() };
|
|
3591
|
-
class
|
|
3591
|
+
class Wt {
|
|
3592
3592
|
constructor() {
|
|
3593
|
-
a(this, "
|
|
3594
|
-
a(this, "
|
|
3595
|
-
this.
|
|
3593
|
+
a(this, "Ll", /* @__PURE__ */ new Map());
|
|
3594
|
+
a(this, "$l", /* @__PURE__ */ new Map());
|
|
3595
|
+
this.Ol();
|
|
3596
3596
|
}
|
|
3597
|
-
|
|
3598
|
-
this.
|
|
3597
|
+
Tl(t) {
|
|
3598
|
+
this.Ll.set(t.id, t);
|
|
3599
3599
|
}
|
|
3600
|
-
|
|
3601
|
-
const e = this.
|
|
3602
|
-
return e && (e.dispose(), this.
|
|
3600
|
+
El(t) {
|
|
3601
|
+
const e = this.$l.get(t);
|
|
3602
|
+
return e && (e.dispose(), this.$l.delete(t)), this.Ll.delete(t);
|
|
3603
3603
|
}
|
|
3604
3604
|
Pn(t) {
|
|
3605
|
-
return this.
|
|
3605
|
+
return this.Ll.get(t);
|
|
3606
3606
|
}
|
|
3607
|
-
|
|
3608
|
-
return this.
|
|
3607
|
+
Bl(t) {
|
|
3608
|
+
return this.Ll.has(t);
|
|
3609
3609
|
}
|
|
3610
3610
|
gt() {
|
|
3611
|
-
for (const t of this.
|
|
3612
|
-
this.
|
|
3611
|
+
for (const t of this.$l.values()) t.dispose();
|
|
3612
|
+
this.$l.clear(), this.Ll.clear();
|
|
3613
3613
|
}
|
|
3614
|
-
|
|
3615
|
-
this
|
|
3614
|
+
Ol() {
|
|
3615
|
+
this.Tl(We);
|
|
3616
3616
|
}
|
|
3617
3617
|
}
|
|
3618
3618
|
class jt {
|
|
3619
3619
|
constructor() {
|
|
3620
|
-
a(this, "
|
|
3621
|
-
this.
|
|
3620
|
+
a(this, "Il");
|
|
3621
|
+
this.Il = new Wt();
|
|
3622
3622
|
}
|
|
3623
3623
|
register(t) {
|
|
3624
|
-
this.
|
|
3624
|
+
this.Il.Tl(t);
|
|
3625
3625
|
}
|
|
3626
3626
|
unregister(t) {
|
|
3627
|
-
return this.
|
|
3627
|
+
return this.Il.El(t);
|
|
3628
3628
|
}
|
|
3629
3629
|
has(t) {
|
|
3630
|
-
return this.
|
|
3630
|
+
return this.Il.Bl(t);
|
|
3631
3631
|
}
|
|
3632
3632
|
Pn(t) {
|
|
3633
|
-
return this.
|
|
3633
|
+
return this.Il.Pn(t);
|
|
3634
3634
|
}
|
|
3635
3635
|
gt() {
|
|
3636
|
-
this.
|
|
3636
|
+
this.Il.gt();
|
|
3637
3637
|
}
|
|
3638
3638
|
}
|
|
3639
|
-
const
|
|
3639
|
+
const Ke = Object.freeze(Object.defineProperty({ __proto__: null, ConversionRegistry: Wt, TextmodeConversionManager: jt }, Symbol.toStringTag, { value: "Module" }));
|
|
3640
3640
|
class je extends function(e, ...i) {
|
|
3641
|
-
return i.reduce((
|
|
3641
|
+
return i.reduce((r, s) => s(r), e);
|
|
3642
3642
|
}(class {
|
|
3643
|
-
},
|
|
3643
|
+
}, Ie, Xe, ze, Ye, ke) {
|
|
3644
3644
|
constructor(e = {}) {
|
|
3645
3645
|
super();
|
|
3646
3646
|
a(this, "Z");
|
|
3647
3647
|
a(this, "kr");
|
|
3648
|
-
a(this, "
|
|
3649
|
-
a(this, "
|
|
3650
|
-
a(this, "ca");
|
|
3648
|
+
a(this, "aa");
|
|
3649
|
+
a(this, "qo");
|
|
3651
3650
|
a(this, "la");
|
|
3652
|
-
a(this, "
|
|
3653
|
-
a(this, "
|
|
3654
|
-
a(this, "
|
|
3655
|
-
a(this, "
|
|
3651
|
+
a(this, "ua");
|
|
3652
|
+
a(this, "Hl");
|
|
3653
|
+
a(this, "Jc");
|
|
3654
|
+
a(this, "tl");
|
|
3655
|
+
a(this, "ha");
|
|
3656
3656
|
a(this, "dn");
|
|
3657
|
-
a(this, "
|
|
3658
|
-
a(this, "
|
|
3657
|
+
a(this, "Sc");
|
|
3658
|
+
a(this, "jc");
|
|
3659
3659
|
a(this, "gn");
|
|
3660
|
-
a(this, "
|
|
3661
|
-
a(this, "Hl");
|
|
3662
|
-
a(this, "Gl");
|
|
3660
|
+
a(this, "Gl", []);
|
|
3663
3661
|
a(this, "Ql");
|
|
3664
|
-
a(this, "Nl"
|
|
3665
|
-
a(this, "Xl"
|
|
3662
|
+
a(this, "Nl");
|
|
3663
|
+
a(this, "Xl");
|
|
3666
3664
|
a(this, "Yl", !1);
|
|
3667
3665
|
a(this, "jl", !1);
|
|
3668
|
-
a(this, "Kl",
|
|
3666
|
+
a(this, "Kl", !1);
|
|
3667
|
+
a(this, "Wl", !1);
|
|
3668
|
+
a(this, "Zl", () => {
|
|
3669
3669
|
});
|
|
3670
|
-
a(this, "
|
|
3670
|
+
a(this, "Mc", () => {
|
|
3671
3671
|
});
|
|
3672
|
-
a(this, "
|
|
3672
|
+
a(this, "ql", () => {
|
|
3673
3673
|
});
|
|
3674
|
-
a(this, "Zl");
|
|
3675
|
-
a(this, "ql");
|
|
3676
|
-
a(this, "Xr", !1);
|
|
3677
3674
|
a(this, "Vl");
|
|
3678
3675
|
a(this, "Jl");
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3676
|
+
a(this, "Xr", !1);
|
|
3677
|
+
a(this, "tu");
|
|
3678
|
+
a(this, "su");
|
|
3679
|
+
this.Xl = new He(this), this.Xr = e.overlay ?? !1, this.kr = new De(e), this.Z = new me(this.kr.tn()), this.aa = new Ut(e.frameRate ?? 60), this.Hl = new Yt(this, e.loadingScreen, this.kr.Vr()), this.Hl.qc(() => {
|
|
3680
|
+
this.aa.Kn = 0, this.Wl = !0;
|
|
3681
|
+
}), this.Jc = this.Z.pe(V, `#version 300 es
|
|
3682
|
+
precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D Ue;uniform sampler2D Uf;uniform sampler2D Ud;uniform vec2 Ug;uniform vec2 Uh;uniform vec4 Ui;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/Uh;vec2 F=E*Ug;vec2 G=floor(F);vec2 H=(G+0.5)/Ug;vec4 I=texture(Ue,H);vec4 J=texture(Uf,H);vec4 K=texture(Ud,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(Ui,J,J.a);fragColor=mix(d,I,c);}`), this.tl = this.Z.pe(V, Dt), this.ha = new Ht(this, e);
|
|
3683
|
+
const i = () => this.iu();
|
|
3684
|
+
this.qo = new Lt(this.kr, i), this.la = new Bt(this.kr, i, this.qo), this.ua = new Nt(), this.jc = new qt(this.Z), this.gn = new jt(), this.Hl.In(), this.eu(e);
|
|
3685
|
+
}
|
|
3686
|
+
async eu(e) {
|
|
3687
|
+
await this.ha.wr(), await this.Hl.wr();
|
|
3688
|
+
const i = this.ha.base.grid;
|
|
3689
|
+
this.ha.xl(() => {
|
|
3690
|
+
this.qo.Fo(), this.la.Fo();
|
|
3691
|
+
}), this.Ql = this.Z.Pe(this.kr.width, this.kr.height, 1), this.Nl = this.Z.Pe(this.kr.width, this.kr.height, 1), this.jc.wr(this.kr.width, this.kr.height), this.Xr && (this.tu = z.Tn(this.Z, this.gn, this.kr.targetCanvas, i.cols, i.rows)), this.ru(), this.aa.In(() => this.ca()), await this.Xl.ma(e.plugins ?? []);
|
|
3692
3692
|
try {
|
|
3693
|
-
await this.
|
|
3694
|
-
} catch (
|
|
3695
|
-
console.error("Error during setup:",
|
|
3693
|
+
await this.Zl(), this.Hl.Za();
|
|
3694
|
+
} catch (r) {
|
|
3695
|
+
console.error("Error during setup:", r), this.Hl.error(r);
|
|
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
|
+
ru() {
|
|
3699
|
+
this.Vl = () => {
|
|
3700
|
+
this.Xr && this.resizeCanvas(this.kr.targetCanvas.width, this.kr.targetCanvas.height), this.ql();
|
|
3701
|
+
}, window.addEventListener("resize", this.Vl), this.qo._o(), this.la._o(), this.ua._o(), window.addEventListener("blur", () => {
|
|
3702
|
+
this.ua.Zo();
|
|
3703
|
+
}), this.Xr && (this.Jl = new ResizeObserver(() => {
|
|
3704
3704
|
this.resizeCanvas(this.kr.targetCanvas.width, this.kr.targetCanvas.height);
|
|
3705
|
-
}), this.
|
|
3705
|
+
}), this.Jl.observe(this.kr.targetCanvas));
|
|
3706
3706
|
}
|
|
3707
|
-
|
|
3708
|
-
if (!this.
|
|
3709
|
-
this.
|
|
3707
|
+
ca() {
|
|
3708
|
+
if (!this.Hl.Ya && this.Wl) {
|
|
3709
|
+
this.jl = !0;
|
|
3710
3710
|
try {
|
|
3711
|
-
this.
|
|
3712
|
-
let e = this.
|
|
3713
|
-
this.
|
|
3711
|
+
this.aa.Xn(), this.aa.Wn(), this.Xr && Tt(this.Z.context, this.tu.texture, this.kr.targetCanvas), this.Xl.ba(), this.Z.state.qt(), this.ha.Al(this.Ql, () => this.Mc());
|
|
3712
|
+
let e = this.Ql.textures[0];
|
|
3713
|
+
this.Gl.length > 0 && (this.jc.Sl(this.Ql.textures[0], this.Nl, this.Gl, this.kr.width, this.kr.height), e = this.Nl.textures[0], this.Gl = []), this.Z.wi(0, 0, 0, 0), this.Z.ve(this.tl), this.tl.O({ u_texture: e }), this.Z.we(0, 0, this.kr.width, this.kr.height), this.Xl.xa();
|
|
3714
3714
|
} finally {
|
|
3715
|
-
this.
|
|
3715
|
+
this.jl = !1, this.Yl && !this.Kl && this.nu();
|
|
3716
3716
|
}
|
|
3717
3717
|
}
|
|
3718
3718
|
}
|
|
3719
3719
|
resizeCanvas(e, i) {
|
|
3720
|
-
var
|
|
3721
|
-
this.kr.Jr(e, i), this.
|
|
3720
|
+
var r, s, h, o;
|
|
3721
|
+
this.kr.Jr(e, i), this.Hl.sl(this.kr.Vr()), this.Hl.Jr(), (r = this.Ql) == null || r.resize(this.kr.width, this.kr.height), (s = this.Nl) == null || s.resize(this.kr.width, this.kr.height), (h = this.jc) == null || h.Jr(this.kr.width, this.kr.height), (o = this.ha) == null || o.Jr(), this.Z.Re(), this.ca();
|
|
3722
3722
|
}
|
|
3723
3723
|
destroy() {
|
|
3724
|
-
this.
|
|
3724
|
+
this.Kl || this.Yl || (this.Yl = !0, this.aa.Gn(), this.jl || this.nu());
|
|
3725
3725
|
}
|
|
3726
|
-
|
|
3727
|
-
var e, i,
|
|
3728
|
-
this.
|
|
3726
|
+
nu() {
|
|
3727
|
+
var e, i, r, s, h, o, c;
|
|
3728
|
+
this.Yl = !1, this.Hl.gt(), this.Xl.Ma(), window.removeEventListener("resize", this.Vl), (e = this.Jl) == null || e.disconnect(), this.qo.Mo(), this.la.Mo(), this.ua.Mo(), this.Jc.dispose(), (i = this.ha) == null || i.gt(), (r = this.jc) == null || r.gt(), (s = this.gn) == null || s.gt(), (h = this.Ql) == null || h.gt(), (o = this.Nl) == null || o.gt(), this.Z.gt(), this.tl.dispose(), (c = this.tu) == null || c.gt(), this.kr.gt(), this.Kl = !0;
|
|
3729
3729
|
}
|
|
3730
3730
|
filter(e, i) {
|
|
3731
|
-
this.
|
|
3731
|
+
this.Gl.push({ name: e, params: i });
|
|
3732
3732
|
}
|
|
3733
3733
|
async loadFont(e) {
|
|
3734
|
-
return await this.
|
|
3734
|
+
return await this.ha.base.loadFont(e), this.ha.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.ha.base.font.fontSize !== e && this.ha.base.font.Mr(e);
|
|
3738
3738
|
}
|
|
3739
3739
|
inputGrid(e) {
|
|
3740
|
-
return e === void 0 ? this.
|
|
3740
|
+
return e === void 0 ? this.su ?? "topmost" : e === "topmost" ? (this.su = void 0, this.qo.Fo(), void this.la.Fo()) : (this.su = e, this.qo.Fo(), void this.la.Fo());
|
|
3741
3741
|
}
|
|
3742
|
-
|
|
3743
|
-
return this.
|
|
3742
|
+
iu() {
|
|
3743
|
+
return this.su ? this.su : this.ha.Cl();
|
|
3744
3744
|
}
|
|
3745
3745
|
async setup(e) {
|
|
3746
|
-
this.
|
|
3746
|
+
this.Zl = e;
|
|
3747
3747
|
}
|
|
3748
3748
|
draw(e) {
|
|
3749
|
-
this.
|
|
3749
|
+
this.Mc = e;
|
|
3750
3750
|
}
|
|
3751
3751
|
windowResized(e) {
|
|
3752
|
-
this.
|
|
3752
|
+
this.ql = e;
|
|
3753
3753
|
}
|
|
3754
3754
|
get grid() {
|
|
3755
|
-
return this.
|
|
3755
|
+
return this.Sc ?? this.ha.base.grid;
|
|
3756
3756
|
}
|
|
3757
3757
|
get font() {
|
|
3758
|
-
return this.dn ?? this.
|
|
3758
|
+
return this.dn ?? this.ha.base.font;
|
|
3759
3759
|
}
|
|
3760
3760
|
get width() {
|
|
3761
3761
|
return this.kr.width;
|
|
@@ -3767,25 +3767,25 @@ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charse
|
|
|
3767
3767
|
return this.kr.canvas;
|
|
3768
3768
|
}
|
|
3769
3769
|
get isDisposed() {
|
|
3770
|
-
return this.
|
|
3770
|
+
return this.Kl;
|
|
3771
3771
|
}
|
|
3772
3772
|
get overlay() {
|
|
3773
|
-
return this.
|
|
3773
|
+
return this.tu;
|
|
3774
3774
|
}
|
|
3775
3775
|
get loading() {
|
|
3776
|
-
return this.
|
|
3776
|
+
return this.Hl;
|
|
3777
3777
|
}
|
|
3778
3778
|
get layers() {
|
|
3779
|
-
return this.
|
|
3779
|
+
return this.ha;
|
|
3780
3780
|
}
|
|
3781
3781
|
get filters() {
|
|
3782
|
-
return this.
|
|
3782
|
+
return this.jc;
|
|
3783
3783
|
}
|
|
3784
3784
|
get conversions() {
|
|
3785
3785
|
return this.gn;
|
|
3786
3786
|
}
|
|
3787
3787
|
}
|
|
3788
|
-
class
|
|
3788
|
+
class At {
|
|
3789
3789
|
constructor() {
|
|
3790
3790
|
}
|
|
3791
3791
|
static create(t = {}) {
|
|
@@ -3795,25 +3795,25 @@ class mt {
|
|
|
3795
3795
|
vt._(t);
|
|
3796
3796
|
}
|
|
3797
3797
|
static get version() {
|
|
3798
|
-
return "0.8.
|
|
3798
|
+
return "0.8.1";
|
|
3799
3799
|
}
|
|
3800
3800
|
}
|
|
3801
|
-
const Je = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: zt, LoadingPhaseTracker:
|
|
3801
|
+
const Je = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: zt, LoadingPhaseTracker: _t, LoadingScreenManager: Yt, LoadingScreenStateMachine: Ot, LoadingScreenTransition: Zt, resolveColorInputs: Xt, resolveDefaultPalette: It, 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: _e, touch: Ze }, Symbol.toStringTag, { value: "Module" })), ei = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: kt, TextmodeLayer: it, TextmodeLayerManager: Ht }, Symbol.toStringTag, { value: "Module" })), ii = At.create, ri = At.setErrorLevel, si = At.version;
|
|
3802
3802
|
export {
|
|
3803
|
-
|
|
3803
|
+
De as TextmodeCanvas,
|
|
3804
3804
|
S as TextmodeColor,
|
|
3805
3805
|
$t as TextmodeErrorLevel,
|
|
3806
|
-
|
|
3806
|
+
X as TextmodeFramebuffer,
|
|
3807
3807
|
Le as TextmodeGrid,
|
|
3808
3808
|
je as Textmodifier,
|
|
3809
|
-
|
|
3809
|
+
Ke as conversion,
|
|
3810
3810
|
ii as create,
|
|
3811
|
-
|
|
3811
|
+
Qe as filters,
|
|
3812
3812
|
ti as input,
|
|
3813
3813
|
ei as layering,
|
|
3814
3814
|
$e as loadables,
|
|
3815
3815
|
Je as loading,
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3816
|
+
ri as setErrorLevel,
|
|
3817
|
+
At as textmode,
|
|
3818
|
+
si as version
|
|
3819
3819
|
};
|