textmode.js 0.6.0-beta.2 → 0.6.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -19
- package/dist/textmode.esm.js +1670 -1595
- package/dist/textmode.umd.js +10 -10
- package/dist/types/index.d.ts +3 -1
- package/dist/types/rendering/webgl/core/Renderer.d.ts +4 -2
- package/dist/types/textmode/TextmodeColor.d.ts +16 -1
- package/dist/types/textmode/Textmodifier.d.ts +4 -0
- package/dist/types/textmode/conversion/ConversionRegistry.d.ts +21 -0
- package/dist/types/textmode/conversion/index.d.ts +1 -0
- package/dist/types/textmode/conversion/strategies/brightness.d.ts +2 -0
- package/dist/types/textmode/interfaces/ITextmodifier.d.ts +5 -0
- package/dist/types/textmode/loadables/TextmodeImage.d.ts +2 -1
- package/dist/types/textmode/loadables/TextmodeSource.d.ts +36 -5
- package/dist/types/textmode/loadables/TextmodeVideo.d.ts +3 -2
- package/dist/types/textmode/loadables/index.d.ts +3 -0
- package/dist/types/textmode/mixins/interfaces/IRenderingMixin.d.ts +3 -2
- package/dist/types/utils/color.d.ts +1 -0
- package/package.json +2 -3
- package/dist/textmode.esm.min.js +0 -3490
- package/dist/textmode.umd.min.js +0 -14
package/dist/textmode.esm.min.js
DELETED
|
@@ -1,3490 +0,0 @@
|
|
|
1
|
-
var Gt = Object.defineProperty;
|
|
2
|
-
var Yt = (n, t, e) => t in n ? Gt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
-
var a = (n, t, e) => Yt(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
class M extends Error {
|
|
5
|
-
constructor(t, e = {}) {
|
|
6
|
-
super(M.i(t, e)), this.name = "TextmodeError";
|
|
7
|
-
}
|
|
8
|
-
static i(t, e) {
|
|
9
|
-
return `${t}${e && Object.keys(e).length > 0 ? `
|
|
10
|
-
|
|
11
|
-
📋 Context:` + Object.entries(e).map(([i, s]) => `
|
|
12
|
-
- ${i}: ${M.o(s)}`).join("") : ""}
|
|
13
|
-
|
|
14
|
-
${"↓".repeat(24)}
|
|
15
|
-
`;
|
|
16
|
-
}
|
|
17
|
-
static o(t) {
|
|
18
|
-
if (t === null) return "null";
|
|
19
|
-
if (t === void 0) return "undefined";
|
|
20
|
-
if (typeof t == "string") return `"${t}"`;
|
|
21
|
-
if (typeof t == "number" || typeof t == "boolean") return t + "";
|
|
22
|
-
if (Array.isArray(t)) return t.length === 0 ? "[]" : t.length <= 5 ? `[${t.map((e) => M.o(e)).join(", ")}]` : `[${t.slice(0, 3).map((e) => M.o(e)).join(", ")}, ... +${t.length - 3} more]`;
|
|
23
|
-
if (typeof t == "object") {
|
|
24
|
-
const e = Object.keys(t);
|
|
25
|
-
return e.length === 0 ? "{}" : e.length <= 3 ? `{ ${e.map((i) => `${i}: ${M.o(t[i])}`).join(", ")} }` : `{ ${e.slice(0, 2).map((i) => `${i}: ${M.o(t[i])}`).join(", ")}, ... +${e.length - 2} more }`;
|
|
26
|
-
}
|
|
27
|
-
return t + "";
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
var Xt = ((n) => (n[n.SILENT = 0] = "SILENT", n[n.WARNING = 1] = "WARNING", n[n.ERROR = 2] = "ERROR", n[n.THROW = 3] = "THROW", n))(Xt || {});
|
|
31
|
-
const B = class B {
|
|
32
|
-
constructor() {
|
|
33
|
-
a(this, "l", { globalLevel: 3 });
|
|
34
|
-
}
|
|
35
|
-
static u() {
|
|
36
|
-
return B.h || (B.h = new B()), B.h;
|
|
37
|
-
}
|
|
38
|
-
_(t, e) {
|
|
39
|
-
const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.", s = "color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;";
|
|
40
|
-
switch (this.l.globalLevel) {
|
|
41
|
-
case 0:
|
|
42
|
-
return !1;
|
|
43
|
-
case 1:
|
|
44
|
-
return console.group(i, s), console.warn(M.i(t, e)), console.groupEnd(), !1;
|
|
45
|
-
case 2:
|
|
46
|
-
return console.group(i, s), console.error(M.i(t, e)), console.groupEnd(), !1;
|
|
47
|
-
default:
|
|
48
|
-
throw new M(t, e);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
v(t, e, i) {
|
|
52
|
-
return !!t || (this._(e, i), !1);
|
|
53
|
-
}
|
|
54
|
-
m(t) {
|
|
55
|
-
this.l.globalLevel = t;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
a(B, "h", null);
|
|
59
|
-
let ut = B;
|
|
60
|
-
const V = ut.u();
|
|
61
|
-
class Z {
|
|
62
|
-
constructor(t, e, i) {
|
|
63
|
-
a(this, "$");
|
|
64
|
-
a(this, "C");
|
|
65
|
-
a(this, "M", /* @__PURE__ */ new Map());
|
|
66
|
-
a(this, "A", /* @__PURE__ */ new Map());
|
|
67
|
-
a(this, "F", 0);
|
|
68
|
-
this.$ = t, this.C = this.U(e, i), this.R();
|
|
69
|
-
}
|
|
70
|
-
R() {
|
|
71
|
-
const t = this.$.getProgramParameter(this.C, this.$.ACTIVE_UNIFORMS);
|
|
72
|
-
for (let e = 0; e < t; e++) {
|
|
73
|
-
const i = this.$.getActiveUniform(this.C, e);
|
|
74
|
-
if (i) {
|
|
75
|
-
const s = i.name.replace(/\[0\]$/, ""), r = this.$.getUniformLocation(this.C, s);
|
|
76
|
-
r && (this.M.set(s, r), this.A.set(s, { type: i.type, size: i.size }));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
U(t, e) {
|
|
81
|
-
const i = this.S(this.$.VERTEX_SHADER, t), s = this.S(this.$.FRAGMENT_SHADER, e), r = this.$.createProgram();
|
|
82
|
-
if (this.$.attachShader(r, i), this.$.attachShader(r, s), this.$.linkProgram(r), !this.$.getProgramParameter(r, this.$.LINK_STATUS)) {
|
|
83
|
-
const h = this.$.getProgramInfoLog(r);
|
|
84
|
-
throw Error("Shader program link error: " + h);
|
|
85
|
-
}
|
|
86
|
-
return this.$.deleteShader(i), this.$.deleteShader(s), r;
|
|
87
|
-
}
|
|
88
|
-
S(t, e) {
|
|
89
|
-
const i = this.$.createShader(t);
|
|
90
|
-
if (this.$.shaderSource(i, e), this.$.compileShader(i), !this.$.getShaderParameter(i, this.$.COMPILE_STATUS)) {
|
|
91
|
-
const s = this.$.getShaderInfoLog(i);
|
|
92
|
-
throw this.$.deleteShader(i), Error("Shader compilation error: " + s);
|
|
93
|
-
}
|
|
94
|
-
return i;
|
|
95
|
-
}
|
|
96
|
-
k() {
|
|
97
|
-
this.$.useProgram(this.C), this.P();
|
|
98
|
-
}
|
|
99
|
-
P() {
|
|
100
|
-
this.F = 0;
|
|
101
|
-
}
|
|
102
|
-
L(t) {
|
|
103
|
-
for (const e in t) this.I(e, t[e]);
|
|
104
|
-
}
|
|
105
|
-
I(t, e) {
|
|
106
|
-
var c, l;
|
|
107
|
-
const i = this.M.get(t);
|
|
108
|
-
if (!i) return;
|
|
109
|
-
const s = this.A.get(t);
|
|
110
|
-
if (!s) return;
|
|
111
|
-
const { type: r, size: h } = s, o = this.$;
|
|
112
|
-
if (e instanceof WebGLTexture) {
|
|
113
|
-
const u = this.F++;
|
|
114
|
-
return o.uniform1i(i, u), o.activeTexture(o.TEXTURE0 + u), void o.bindTexture(o.TEXTURE_2D, e);
|
|
115
|
-
}
|
|
116
|
-
if (e instanceof it) {
|
|
117
|
-
const u = this.F++;
|
|
118
|
-
return o.uniform1i(i, u), o.activeTexture(o.TEXTURE0 + u), void o.bindTexture(o.TEXTURE_2D, e.textures[0]);
|
|
119
|
-
}
|
|
120
|
-
if (typeof e == "number") return void (r === o.INT || r === o.BOOL ? o.uniform1i(i, e) : o.uniform1f(i, e));
|
|
121
|
-
if (typeof e == "boolean") return void o.uniform1i(i, e ? 1 : 0);
|
|
122
|
-
if (Array.isArray(e[0])) {
|
|
123
|
-
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) };
|
|
124
|
-
(c = f[r]) == null || c.call(f);
|
|
125
|
-
} else {
|
|
126
|
-
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) };
|
|
127
|
-
(l = f[r]) == null || l.call(f);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
get D() {
|
|
131
|
-
return this.C;
|
|
132
|
-
}
|
|
133
|
-
O() {
|
|
134
|
-
this.$.deleteProgram(this.C);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
function yt(n, t, e, i) {
|
|
138
|
-
return 180 * Math.atan2(i - t, e - n) / Math.PI;
|
|
139
|
-
}
|
|
140
|
-
function z(n, t, e, i) {
|
|
141
|
-
return Math.hypot(e - n, i - t);
|
|
142
|
-
}
|
|
143
|
-
function Rt(n) {
|
|
144
|
-
return (n % 360 + 360) % 360 / 360;
|
|
145
|
-
}
|
|
146
|
-
function bt(n, t, e) {
|
|
147
|
-
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);
|
|
148
|
-
}
|
|
149
|
-
function et(n, t, e, i, s) {
|
|
150
|
-
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, t), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, e), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, i), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, s);
|
|
151
|
-
}
|
|
152
|
-
function ft(n, t, e, i, s, r = 0, h = WebGL2RenderingContext.FLOAT, o = !1) {
|
|
153
|
-
n.enableVertexAttribArray(t), n.vertexAttribPointer(t, e, h, o, i, s), n.vertexAttribDivisor(t, r);
|
|
154
|
-
}
|
|
155
|
-
function At(n, t, e, i, s) {
|
|
156
|
-
n.bindBuffer(t, e), n.bufferData(t, i, s), n.bindBuffer(t, null);
|
|
157
|
-
}
|
|
158
|
-
const st = `#version 300 es
|
|
159
|
-
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 Us;uniform float Ut;uniform float Uu;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/Us)*2.0f;AA.y=-AA.y;float AB=y.z/Us.y;float AC=clamp(-AB*Ut,-0.99f,0.99f);if(Uu>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);}}`, O = class O {
|
|
160
|
-
constructor(t, e, i = e, s = 1, r = {}, h) {
|
|
161
|
-
a(this, "G");
|
|
162
|
-
a(this, "W");
|
|
163
|
-
a(this, "l");
|
|
164
|
-
a(this, "$");
|
|
165
|
-
a(this, "H");
|
|
166
|
-
a(this, "K", []);
|
|
167
|
-
a(this, "Y", null);
|
|
168
|
-
a(this, "j");
|
|
169
|
-
a(this, "N");
|
|
170
|
-
a(this, "X", null);
|
|
171
|
-
a(this, "Z", /* @__PURE__ */ new Map());
|
|
172
|
-
var o;
|
|
173
|
-
this.G = e, this.W = i, this.$ = t, this.j = (o = 8, Math.min(Math.max(s, 1), o)), this.N = h, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...r }, O.V || (O.V = new Z(t, st, `#version 300 es
|
|
174
|
-
precision highp float;in vec2 v_uv;uniform sampler2D Uc;uniform sampler2D Ud;uniform sampler2D Ue;uniform vec2 Uf;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;void main(){vec2 A=vec2(v_uv.x,1.-v_uv.y);vec2 B=A*Uf;vec2 C=(floor(B)+0.5f)/Uf;vec4 D=texture(Uc,C);vec4 E=texture(Ud,C);if(E.a==0.){discard;}vec4 F=texture(Ue,C);o_character=D;o_primaryColor=E;o_secondaryColor=F;}`));
|
|
175
|
-
const c = t.getParameter(t.MAX_DRAW_BUFFERS), l = t.getParameter(t.MAX_COLOR_ATTACHMENTS);
|
|
176
|
-
this.j = Math.min(this.j, c, l), this.H = t.createFramebuffer(), this.q(), this.J(), this.l.depth && this.tt();
|
|
177
|
-
}
|
|
178
|
-
q() {
|
|
179
|
-
const t = this.$, e = this.l.filter === "linear" ? t.LINEAR : t.NEAREST, i = this.l.wrap === "repeat" ? t.REPEAT : t.CLAMP_TO_EDGE, s = this.l.type === "float" ? t.FLOAT : t.UNSIGNED_BYTE, r = s === t.FLOAT ? t.RGBA32F : t.RGBA8, h = t.RGBA;
|
|
180
|
-
for (let o = 0; o < this.j; o++) {
|
|
181
|
-
const c = t.createTexture();
|
|
182
|
-
t.bindTexture(t.TEXTURE_2D, c), et(t, e, e, i, i), t.texImage2D(t.TEXTURE_2D, 0, r, this.G, this.W, 0, h, s, null), this.K.push(c);
|
|
183
|
-
}
|
|
184
|
-
t.bindTexture(t.TEXTURE_2D, null);
|
|
185
|
-
}
|
|
186
|
-
J() {
|
|
187
|
-
const t = this.$;
|
|
188
|
-
if (t.bindFramebuffer(t.FRAMEBUFFER, this.H), this.j === 1) t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, this.K[0], 0);
|
|
189
|
-
else {
|
|
190
|
-
const e = [];
|
|
191
|
-
for (let i = 0; i < this.j; i++) {
|
|
192
|
-
const s = t.COLOR_ATTACHMENT0 + i;
|
|
193
|
-
t.framebufferTexture2D(t.FRAMEBUFFER, s, t.TEXTURE_2D, this.K[i], 0), e.push(s);
|
|
194
|
-
}
|
|
195
|
-
t.drawBuffers(e);
|
|
196
|
-
}
|
|
197
|
-
t.bindFramebuffer(t.FRAMEBUFFER, null);
|
|
198
|
-
}
|
|
199
|
-
tt() {
|
|
200
|
-
const t = this.$;
|
|
201
|
-
this.Y = t.createRenderbuffer(), t.bindRenderbuffer(t.RENDERBUFFER, this.Y), t.renderbufferStorage(t.RENDERBUFFER, t.DEPTH_COMPONENT24, this.G, this.W), t.bindFramebuffer(t.FRAMEBUFFER, this.H), t.framebufferRenderbuffer(t.FRAMEBUFFER, t.DEPTH_ATTACHMENT, t.RENDERBUFFER, this.Y), t.bindFramebuffer(t.FRAMEBUFFER, null), t.bindRenderbuffer(t.RENDERBUFFER, null);
|
|
202
|
-
}
|
|
203
|
-
st(t) {
|
|
204
|
-
bt(this.$, this.K[0], t);
|
|
205
|
-
}
|
|
206
|
-
resize(t, e) {
|
|
207
|
-
this.G = t, this.W = e, this.Z.clear();
|
|
208
|
-
const i = this.$, s = this.l.type === "float" ? i.FLOAT : i.UNSIGNED_BYTE, r = s === i.FLOAT ? i.RGBA32F : i.RGBA8, h = i.RGBA;
|
|
209
|
-
for (const o of this.K) i.bindTexture(i.TEXTURE_2D, o), i.texImage2D(i.TEXTURE_2D, 0, r, this.G, this.W, 0, h, s, null);
|
|
210
|
-
i.bindTexture(i.TEXTURE_2D, null), this.Y && (i.bindRenderbuffer(i.RENDERBUFFER, this.Y), i.renderbufferStorage(i.RENDERBUFFER, i.DEPTH_COMPONENT24, this.G, this.W), i.bindRenderbuffer(i.RENDERBUFFER, null));
|
|
211
|
-
}
|
|
212
|
-
readPixels(t) {
|
|
213
|
-
const e = this.Z.get(t);
|
|
214
|
-
if (e) return e;
|
|
215
|
-
const i = this.$, s = this.G, r = this.W, h = new Uint8Array(s * r * 4), o = i.getParameter(i.READ_FRAMEBUFFER_BINDING);
|
|
216
|
-
i.bindFramebuffer(i.READ_FRAMEBUFFER, this.H), i.readBuffer(i.COLOR_ATTACHMENT0 + t), i.readPixels(0, 0, s, r, i.RGBA, i.UNSIGNED_BYTE, h), i.bindFramebuffer(i.READ_FRAMEBUFFER, o);
|
|
217
|
-
const c = 4 * s, l = new Uint8Array(h.length);
|
|
218
|
-
for (let u = 0; u < r; u++) {
|
|
219
|
-
const f = (r - 1 - u) * c, g = u * c;
|
|
220
|
-
l.set(h.subarray(f, f + c), g);
|
|
221
|
-
}
|
|
222
|
-
return this.Z.set(t, l), l;
|
|
223
|
-
}
|
|
224
|
-
begin() {
|
|
225
|
-
const t = this.$;
|
|
226
|
-
this.Z.clear(), this.N.it(), this.N.et(this.H, this.G, this.W), this.l.depth && t.clear(t.DEPTH_BUFFER_BIT), this.N.state.rt();
|
|
227
|
-
}
|
|
228
|
-
end() {
|
|
229
|
-
this.N.state.nt(), this.N.ot();
|
|
230
|
-
const t = this.N.ht();
|
|
231
|
-
this.N.et(t.framebuffer, t.viewport[2], t.viewport[3]);
|
|
232
|
-
}
|
|
233
|
-
ct() {
|
|
234
|
-
return this.X || this.lt(), this.X;
|
|
235
|
-
}
|
|
236
|
-
lt() {
|
|
237
|
-
if (!this.N) return;
|
|
238
|
-
const t = { Uc: this.K[0], Ud: this.K[1], Ue: this.K[2], Uf: [this.G, this.W] }, e = O.V;
|
|
239
|
-
this.X = this.N.ft.ut(e, t, !0);
|
|
240
|
-
}
|
|
241
|
-
O() {
|
|
242
|
-
const t = this.$;
|
|
243
|
-
t.deleteFramebuffer(this.H);
|
|
244
|
-
for (const e of this.K) t.deleteTexture(e);
|
|
245
|
-
this.Y && t.deleteRenderbuffer(this.Y);
|
|
246
|
-
}
|
|
247
|
-
get width() {
|
|
248
|
-
return this.G;
|
|
249
|
-
}
|
|
250
|
-
get height() {
|
|
251
|
-
return this.W;
|
|
252
|
-
}
|
|
253
|
-
get textures() {
|
|
254
|
-
return this.K;
|
|
255
|
-
}
|
|
256
|
-
get attachmentCount() {
|
|
257
|
-
return this.j;
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
a(O, "V", null);
|
|
261
|
-
let it = O;
|
|
262
|
-
const xt = /* @__PURE__ */ new WeakMap();
|
|
263
|
-
function ot(n, t) {
|
|
264
|
-
xt.set(n, t);
|
|
265
|
-
}
|
|
266
|
-
function Lt(n) {
|
|
267
|
-
return xt.get(n);
|
|
268
|
-
}
|
|
269
|
-
function $(n, t, e, i, s = 255) {
|
|
270
|
-
n[0] = t / 255, n[1] = (e ?? t) / 255, n[2] = (i ?? t) / 255, n[3] = s / 255;
|
|
271
|
-
}
|
|
272
|
-
class nt {
|
|
273
|
-
constructor() {
|
|
274
|
-
a(this, "dt", 1);
|
|
275
|
-
a(this, "_t", 0);
|
|
276
|
-
a(this, "gt", 0);
|
|
277
|
-
a(this, "vt", 0);
|
|
278
|
-
a(this, "yt", 0);
|
|
279
|
-
a(this, "wt", 0);
|
|
280
|
-
a(this, "bt", 0);
|
|
281
|
-
a(this, "$t", [0, 0, 0]);
|
|
282
|
-
a(this, "Ct", [1, 1, 1, 1]);
|
|
283
|
-
a(this, "Mt", [0, 0, 0, 1]);
|
|
284
|
-
a(this, "xt", !1);
|
|
285
|
-
a(this, "At", !1);
|
|
286
|
-
a(this, "Ft", !1);
|
|
287
|
-
a(this, "Tt", 0);
|
|
288
|
-
a(this, "Rt", [0, 0, 0, 1]);
|
|
289
|
-
a(this, "Et", !1);
|
|
290
|
-
a(this, "St", []);
|
|
291
|
-
a(this, "kt", []);
|
|
292
|
-
}
|
|
293
|
-
static Pt() {
|
|
294
|
-
return { Lt: 1, It: 0, zt: 0, Dt: 0, yt: 0, wt: 0, bt: 0, Tt: 0, Ot: !1, Bt: !1, Ft: !1, Et: !1, Gt: [0, 0, 0], Wt: [1, 1, 1, 1], Ht: [0, 0, 0, 1] };
|
|
295
|
-
}
|
|
296
|
-
Kt(t) {
|
|
297
|
-
t.Lt = this.dt, t.It = this._t, t.zt = this.gt, t.Dt = this.vt, t.yt = this.yt, t.wt = this.wt, t.bt = this.bt, t.Ot = this.xt, t.Bt = this.At, t.Ft = this.Ft, t.Tt = this.Tt, t.Et = this.Et, t.Gt[0] = this.$t[0], t.Gt[1] = this.$t[1], t.Gt[2] = this.$t[2], t.Wt[0] = this.Ct[0], t.Wt[1] = this.Ct[1], t.Wt[2] = this.Ct[2], t.Wt[3] = this.Ct[3], t.Ht[0] = this.Mt[0], t.Ht[1] = this.Mt[1], t.Ht[2] = this.Mt[2], t.Ht[3] = this.Mt[3];
|
|
298
|
-
}
|
|
299
|
-
Yt(t) {
|
|
300
|
-
this.dt = t.Lt, this._t = t.It, this.gt = t.zt, this.vt = t.Dt, this.yt = t.yt, this.wt = t.wt, this.bt = t.bt, this.xt = t.Ot, this.At = t.Bt, this.Ft = t.Ft, this.Tt = t.Tt, this.Et = t.Et, this.$t[0] = t.Gt[0], this.$t[1] = t.Gt[1], this.$t[2] = t.Gt[2], this.Ct[0] = t.Wt[0], this.Ct[1] = t.Wt[1], this.Ct[2] = t.Wt[2], this.Ct[3] = t.Wt[3], this.Mt[0] = t.Ht[0], this.Mt[1] = t.Ht[1], this.Mt[2] = t.Ht[2], this.Mt[3] = t.Ht[3];
|
|
301
|
-
}
|
|
302
|
-
rt() {
|
|
303
|
-
let t = this.kt.pop();
|
|
304
|
-
t || (t = nt.Pt()), this.Kt(t), this.St.push(t);
|
|
305
|
-
}
|
|
306
|
-
nt() {
|
|
307
|
-
const t = this.St.pop();
|
|
308
|
-
t ? (this.Yt(t), this.kt.push(t)) : console.warn("pop() called without matching push()");
|
|
309
|
-
}
|
|
310
|
-
jt(t) {
|
|
311
|
-
this.Kt(t);
|
|
312
|
-
}
|
|
313
|
-
Nt(t) {
|
|
314
|
-
this.dt = Math.abs(t);
|
|
315
|
-
}
|
|
316
|
-
Xt() {
|
|
317
|
-
this._t = 0, this.gt = 0, this.vt = 0, this.yt = 0, this.wt = 0, this.bt = 0, this.Et = !1;
|
|
318
|
-
}
|
|
319
|
-
Zt(t) {
|
|
320
|
-
t !== 0 && (this.yt += t * Math.PI / 180);
|
|
321
|
-
}
|
|
322
|
-
Vt(t) {
|
|
323
|
-
t !== 0 && (this.wt += t * Math.PI / 180);
|
|
324
|
-
}
|
|
325
|
-
qt(t) {
|
|
326
|
-
t !== 0 && (this.bt += t * Math.PI / 180);
|
|
327
|
-
}
|
|
328
|
-
Jt(t = 0, e = 0, i = 0) {
|
|
329
|
-
t === 0 && e === 0 && i === 0 || (this._t += t, this.gt += e, this.vt += i);
|
|
330
|
-
}
|
|
331
|
-
Qt(t) {
|
|
332
|
-
this.Jt(t, 0, 0);
|
|
333
|
-
}
|
|
334
|
-
ts(t) {
|
|
335
|
-
this.Jt(0, t, 0);
|
|
336
|
-
}
|
|
337
|
-
ss(t) {
|
|
338
|
-
this.Jt(0, 0, t);
|
|
339
|
-
}
|
|
340
|
-
es(t) {
|
|
341
|
-
this.$t[0] = t[0], this.$t[1] = t[1], this.$t[2] = t[2];
|
|
342
|
-
}
|
|
343
|
-
rs(t, e, i, s = 255) {
|
|
344
|
-
$(this.Ct, t, e, i, s);
|
|
345
|
-
}
|
|
346
|
-
ns(t, e, i, s = 255) {
|
|
347
|
-
$(this.Mt, t, e, i, s);
|
|
348
|
-
}
|
|
349
|
-
hs(t) {
|
|
350
|
-
this.xt = t;
|
|
351
|
-
}
|
|
352
|
-
cs(t) {
|
|
353
|
-
this.At = t;
|
|
354
|
-
}
|
|
355
|
-
ls(t) {
|
|
356
|
-
this.Ft = t;
|
|
357
|
-
}
|
|
358
|
-
us(t) {
|
|
359
|
-
this.Tt = Rt(t);
|
|
360
|
-
}
|
|
361
|
-
fs(t, e, i, s) {
|
|
362
|
-
$(this.Rt, t, e, i, s);
|
|
363
|
-
}
|
|
364
|
-
ds(t) {
|
|
365
|
-
this.Et = t;
|
|
366
|
-
}
|
|
367
|
-
get canvasBackgroundColor() {
|
|
368
|
-
return this.Rt;
|
|
369
|
-
}
|
|
370
|
-
get useOrtho() {
|
|
371
|
-
return this.Et;
|
|
372
|
-
}
|
|
373
|
-
get rotationX() {
|
|
374
|
-
return this.yt;
|
|
375
|
-
}
|
|
376
|
-
get rotationY() {
|
|
377
|
-
return this.wt;
|
|
378
|
-
}
|
|
379
|
-
get rotationZ() {
|
|
380
|
-
return this.bt;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
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]), X = { ps: 16, _s: WebGL2RenderingContext.TRIANGLES, gs: { vs: { size: 2, offset: 0 }, ws: { size: 2, offset: 8 } } };
|
|
384
|
-
class zt {
|
|
385
|
-
constructor(t) {
|
|
386
|
-
a(this, "$");
|
|
387
|
-
a(this, "bs");
|
|
388
|
-
a(this, "$s");
|
|
389
|
-
this.$ = t, this.bs = t.createBuffer(), this.$s = new Float32Array(dt.length);
|
|
390
|
-
}
|
|
391
|
-
Cs(t, e, i, s) {
|
|
392
|
-
const r = this.$, h = Lt(this.$), o = h[2], c = h[3], l = t / o * 2 - 1, u = (t + i) / o * 2 - 1, f = 1 - (e + s) / c * 2, g = 1 - e / c * 2, p = dt, m = this.$s;
|
|
393
|
-
for (let d = 0; d < p.length; d += 4) {
|
|
394
|
-
const y = p[d], v = p[d + 1], w = p[d + 2], E = p[d + 3], R = l + (y + 0.5) * (u - l), T = f + (v + 0.5) * (g - f);
|
|
395
|
-
m[d] = R, m[d + 1] = T, m[d + 2] = w, m[d + 3] = E;
|
|
396
|
-
}
|
|
397
|
-
r.bindBuffer(r.ARRAY_BUFFER, this.bs), r.bufferData(r.ARRAY_BUFFER, m, r.DYNAMIC_DRAW), r.enableVertexAttribArray(0), r.vertexAttribPointer(0, 2, r.FLOAT, !1, 16, 0), r.drawArrays(r.TRIANGLES, 0, 6), r.disableVertexAttribArray(0), r.bindBuffer(r.ARRAY_BUFFER, null);
|
|
398
|
-
}
|
|
399
|
-
O() {
|
|
400
|
-
this.$.deleteBuffer(this.bs);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
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 || {});
|
|
404
|
-
const Wt = { rectangle: 2, line: 2, ellipse: 2, triangle: 2, arc: 3, bezier_curve: 4 };
|
|
405
|
-
class jt {
|
|
406
|
-
constructor(t) {
|
|
407
|
-
a(this, "$");
|
|
408
|
-
a(this, "Ms", /* @__PURE__ */ new Map());
|
|
409
|
-
this.$ = t;
|
|
410
|
-
}
|
|
411
|
-
As(t, e, i, s) {
|
|
412
|
-
const r = this.$;
|
|
413
|
-
let h = this.Ms.get(t);
|
|
414
|
-
h || (h = /* @__PURE__ */ new Map(), this.Ms.set(t, h));
|
|
415
|
-
let o = h.get(e) || null;
|
|
416
|
-
if (!o) {
|
|
417
|
-
o = r.createVertexArray(), h.set(e, o), r.bindVertexArray(o), r.bindBuffer(r.ARRAY_BUFFER, s);
|
|
418
|
-
const c = r.getAttribLocation(t, "A0");
|
|
419
|
-
c !== -1 && ft(r, c, i.gs.vs.size, i.ps, i.gs.vs.offset, 0, r.FLOAT, !1);
|
|
420
|
-
const l = r.getAttribLocation(t, "A1");
|
|
421
|
-
l !== -1 && ft(r, l, i.gs.ws.size, i.ps, i.gs.ws.offset, 0, r.FLOAT, !1);
|
|
422
|
-
}
|
|
423
|
-
r.bindVertexArray(o);
|
|
424
|
-
}
|
|
425
|
-
Fs() {
|
|
426
|
-
this.$.bindVertexArray(null);
|
|
427
|
-
}
|
|
428
|
-
O() {
|
|
429
|
-
for (const [, t] of this.Ms) for (const [, e] of t) e && this.$.deleteVertexArray(e);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
const S = class S {
|
|
433
|
-
static Ts(t, e, i = 0) {
|
|
434
|
-
const s = e || new Float32Array(S.FLOATS_PER_INSTANCE);
|
|
435
|
-
let r = i;
|
|
436
|
-
s[r++] = t.vs[0], s[r++] = t.vs[1], s[r++] = t.Rs[0], s[r++] = t.Rs[1], s[r++] = t.Gt[0], s[r++] = t.Gt[1], s[r++] = t.Gt[2], s[r++] = t.Wt[0], s[r++] = t.Wt[1], s[r++] = t.Wt[2], s[r++] = t.Wt[3], s[r++] = t.Ht[0], s[r++] = t.Ht[1], s[r++] = t.Ht[2], s[r++] = t.Ht[3], s[r++] = t.Es[0], s[r++] = t.Es[1], s[r++] = t.Es[2], s[r++] = t.Tt;
|
|
437
|
-
const h = t.Ss;
|
|
438
|
-
s[r++] = (h == null ? void 0 : h[0]) ?? 0, s[r++] = (h == null ? void 0 : h[1]) ?? 0, s[r++] = (h == null ? void 0 : h[2]) ?? 0;
|
|
439
|
-
const o = t.ks;
|
|
440
|
-
s[r++] = (o == null ? void 0 : o[0]) ?? 0, s[r++] = (o == null ? void 0 : o[1]) ?? 0, s[r++] = (o == null ? void 0 : o[2]) ?? 0;
|
|
441
|
-
const c = t.Ps, l = t.Ls, u = t.Is, f = t.zs, g = t.Ds, p = !(!l || !u);
|
|
442
|
-
return p ? (s[r++] = (f == null ? void 0 : f[0]) ?? 0, s[r++] = (f == null ? void 0 : f[1]) ?? 0, s[r++] = (g == null ? void 0 : g[0]) ?? 0, s[r++] = (g == null ? void 0 : g[1]) ?? 0, s[r++] = l[0], s[r++] = l[1], s[r++] = u[0], s[r++] = u[1]) : !p && !!c ? (s[r++] = c[0], s[r++] = c[1], s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0) : (s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0), s[r++] = t.Os ?? 0, s[r++] = t.Bs ?? 0, s[r++] = t.Gs ?? 0, s;
|
|
443
|
-
}
|
|
444
|
-
static Ws(t, e) {
|
|
445
|
-
const i = t.length * S.FLOATS_PER_INSTANCE, s = e || new Float32Array(i);
|
|
446
|
-
for (let r = 0; r < t.length; r++) {
|
|
447
|
-
const h = r * S.FLOATS_PER_INSTANCE;
|
|
448
|
-
S.Ts(t[r], s, h);
|
|
449
|
-
}
|
|
450
|
-
return s;
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
a(S, "BYTES_PER_INSTANCE", 144), a(S, "FLOATS_PER_INSTANCE", 36);
|
|
454
|
-
let P = S;
|
|
455
|
-
const U = class U {
|
|
456
|
-
};
|
|
457
|
-
a(U, "STRIDE", P.BYTES_PER_INSTANCE), a(U, "ATTRIBUTES", { A2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: U.STRIDE, offset: 0, divisor: 1 }, A3: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: U.STRIDE, offset: 8, divisor: 1 }, A4: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: U.STRIDE, offset: 16, divisor: 1 }, A5: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: U.STRIDE, offset: 28, divisor: 1 }, A6: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: U.STRIDE, offset: 44, divisor: 1 }, A7: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: U.STRIDE, offset: 60, divisor: 1 }, A8: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: U.STRIDE, offset: 76, divisor: 1 }, A9: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: U.STRIDE, offset: 88, divisor: 1 }, Aa: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: U.STRIDE, offset: 100, divisor: 1 }, Ab: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: U.STRIDE, offset: 116, divisor: 1 }, Ac: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: U.STRIDE, offset: 132, divisor: 1 } });
|
|
458
|
-
let K = U;
|
|
459
|
-
class kt {
|
|
460
|
-
constructor(t = 1e3, e = 1.5) {
|
|
461
|
-
a(this, "Hs");
|
|
462
|
-
a(this, "Ks");
|
|
463
|
-
a(this, "Ys");
|
|
464
|
-
a(this, "js", 0);
|
|
465
|
-
a(this, "Ns", 0);
|
|
466
|
-
this.Ks = t, this.Ys = e;
|
|
467
|
-
const i = t * P.FLOATS_PER_INSTANCE;
|
|
468
|
-
this.Hs = new Float32Array(i);
|
|
469
|
-
}
|
|
470
|
-
Xs(t) {
|
|
471
|
-
if (t <= this.Ks) return;
|
|
472
|
-
const e = Math.ceil(t * this.Ys), i = this.Ks;
|
|
473
|
-
this.Ks = e;
|
|
474
|
-
const s = e * P.FLOATS_PER_INSTANCE, r = new Float32Array(s), h = i * P.FLOATS_PER_INSTANCE;
|
|
475
|
-
r.set(this.Hs.subarray(0, Math.min(h, this.js))), this.Hs = r;
|
|
476
|
-
}
|
|
477
|
-
Zs() {
|
|
478
|
-
return { buffer: this.Hs, offset: this.js };
|
|
479
|
-
}
|
|
480
|
-
Vs(t) {
|
|
481
|
-
this.js += t, this.Ns++;
|
|
482
|
-
}
|
|
483
|
-
qs() {
|
|
484
|
-
this.js = 0, this.Ns = 0;
|
|
485
|
-
}
|
|
486
|
-
Js(t = 0, e) {
|
|
487
|
-
return this.Hs.subarray(t, e ?? this.js);
|
|
488
|
-
}
|
|
489
|
-
get Qs() {
|
|
490
|
-
return this.Ns;
|
|
491
|
-
}
|
|
492
|
-
get ti() {
|
|
493
|
-
return this.Ks;
|
|
494
|
-
}
|
|
495
|
-
get si() {
|
|
496
|
-
return this.js;
|
|
497
|
-
}
|
|
498
|
-
get ii() {
|
|
499
|
-
return this.Ns === 0;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
class Kt {
|
|
503
|
-
constructor(t) {
|
|
504
|
-
a(this, "Hs");
|
|
505
|
-
this.Hs = t;
|
|
506
|
-
}
|
|
507
|
-
ei(t) {
|
|
508
|
-
this.Hs.Xs(this.Hs.Qs + 1);
|
|
509
|
-
const { buffer: e, offset: i } = this.Hs.Zs();
|
|
510
|
-
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;
|
|
511
|
-
const s = t.curveParams0, r = t.curveParams1;
|
|
512
|
-
return e[i + 25] = s[0], e[i + 26] = s[1], e[i + 27] = s[2], e[i + 28] = s[3], e[i + 29] = r[0], e[i + 30] = r[1], e[i + 31] = r[2], e[i + 32] = r[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Hs.Vs(P.FLOATS_PER_INSTANCE), this.Hs.Qs - 1;
|
|
513
|
-
}
|
|
514
|
-
get Qs() {
|
|
515
|
-
return this.Hs.Qs;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
class Vt {
|
|
519
|
-
constructor(t, e = 1e3) {
|
|
520
|
-
a(this, "$");
|
|
521
|
-
a(this, "ri", null);
|
|
522
|
-
a(this, "ni", 0);
|
|
523
|
-
a(this, "oi", /* @__PURE__ */ new Map());
|
|
524
|
-
this.$ = t, this.hi(e);
|
|
525
|
-
}
|
|
526
|
-
hi(t) {
|
|
527
|
-
const e = this.$;
|
|
528
|
-
this.ri && e.deleteBuffer(this.ri), this.ri = e.createBuffer();
|
|
529
|
-
const i = t * P.BYTES_PER_INSTANCE;
|
|
530
|
-
At(e, e.ARRAY_BUFFER, this.ri, i, e.DYNAMIC_DRAW), this.ni = t;
|
|
531
|
-
}
|
|
532
|
-
ai(t) {
|
|
533
|
-
this.hi(t);
|
|
534
|
-
}
|
|
535
|
-
get ti() {
|
|
536
|
-
return this.ni;
|
|
537
|
-
}
|
|
538
|
-
ci(t, e) {
|
|
539
|
-
if (e === 0) return;
|
|
540
|
-
const i = this.$;
|
|
541
|
-
i.bindBuffer(i.ARRAY_BUFFER, this.ri);
|
|
542
|
-
const s = e * P.FLOATS_PER_INSTANCE;
|
|
543
|
-
i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, s);
|
|
544
|
-
}
|
|
545
|
-
li(t) {
|
|
546
|
-
let e = this.oi.get(t);
|
|
547
|
-
if (!e) {
|
|
548
|
-
e = /* @__PURE__ */ new Map();
|
|
549
|
-
const i = this.$;
|
|
550
|
-
for (const s in K.ATTRIBUTES) {
|
|
551
|
-
const r = i.getAttribLocation(t, s);
|
|
552
|
-
r !== -1 && e.set(s, r);
|
|
553
|
-
}
|
|
554
|
-
this.oi.set(t, e);
|
|
555
|
-
}
|
|
556
|
-
return e;
|
|
557
|
-
}
|
|
558
|
-
ui(t) {
|
|
559
|
-
const e = this.$, i = t.D, s = this.li(i);
|
|
560
|
-
for (const [r, h] of s) {
|
|
561
|
-
const o = K.ATTRIBUTES[r];
|
|
562
|
-
o && ft(e, h, o.size, o.stride, o.offset, o.divisor, o.type, o.normalized);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
fi(t) {
|
|
566
|
-
const e = this.$, i = this.li(t.D);
|
|
567
|
-
for (const [s, r] of i)
|
|
568
|
-
K.ATTRIBUTES[s] && (e.disableVertexAttribArray(r), e.vertexAttribDivisor(r, 0));
|
|
569
|
-
}
|
|
570
|
-
O() {
|
|
571
|
-
this.ri && (this.$.deleteBuffer(this.ri), this.ri = null), this.oi.clear();
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
class Zt {
|
|
575
|
-
constructor(t, e = 1e3, i = 1.5) {
|
|
576
|
-
a(this, "$");
|
|
577
|
-
a(this, "Hs");
|
|
578
|
-
a(this, "di");
|
|
579
|
-
a(this, "pi");
|
|
580
|
-
this.$ = t, this.Hs = new kt(e, i), this.di = new Kt(this.Hs), this.pi = new Vt(t, e);
|
|
581
|
-
}
|
|
582
|
-
_i(t) {
|
|
583
|
-
var s, r, h, o, c, l, u, f, g, p;
|
|
584
|
-
const e = [0, 0, 0, 0], i = [0, 0, 0, 0];
|
|
585
|
-
return t.Ls && t.Is ? (e[0] = ((s = t.zs) == null ? void 0 : s[0]) ?? 0, e[1] = ((r = t.zs) == null ? void 0 : r[1]) ?? 0, e[2] = ((h = t.Ds) == null ? void 0 : h[0]) ?? 0, e[3] = ((o = t.Ds) == null ? void 0 : o[1]) ?? 0, i[0] = t.Ls[0], i[1] = t.Ls[1], i[2] = t.Is[0], i[3] = t.Is[1]) : t.Ps && (e[0] = t.Ps[0], e[1] = t.Ps[1]), this.ei({ x: t.vs[0], y: t.vs[1], width: t.Rs[0], height: t.Rs[1], char0: t.Gt[0], char1: t.Gt[1], char2: t.Gt[2], r1: t.Wt[0], g1: t.Wt[1], b1: t.Wt[2], a1: t.Wt[3], r2: t.Ht[0], g2: t.Ht[1], b2: t.Ht[2], a2: t.Ht[3], invert: t.Es[0], flipX: t.Es[1], flipY: t.Es[2], charRot: t.Tt, translationX: ((c = t.Ss) == null ? void 0 : c[0]) ?? 0, translationY: ((l = t.Ss) == null ? void 0 : l[1]) ?? 0, translationZ: ((u = t.Ss) == null ? void 0 : u[2]) ?? 0, rotationX: ((f = t.ks) == null ? void 0 : f[0]) ?? 0, rotationY: ((g = t.ks) == null ? void 0 : g[1]) ?? 0, rotationZ: ((p = t.ks) == null ? void 0 : p[2]) ?? 0, curveParams0: e, curveParams1: i, depth: t.Os || 0, baseZ: t.Bs || 0, geometryType: t.Gs || 0 });
|
|
586
|
-
}
|
|
587
|
-
ei(t) {
|
|
588
|
-
const e = this.di.ei(t);
|
|
589
|
-
return this.Hs.ti > this.pi.ti && this.pi.ai(this.Hs.ti), e;
|
|
590
|
-
}
|
|
591
|
-
get gi() {
|
|
592
|
-
return this.Hs.Qs;
|
|
593
|
-
}
|
|
594
|
-
get ii() {
|
|
595
|
-
return this.Hs.ii;
|
|
596
|
-
}
|
|
597
|
-
mi() {
|
|
598
|
-
this.Hs.qs();
|
|
599
|
-
}
|
|
600
|
-
ui(t) {
|
|
601
|
-
const e = this.Hs.Qs;
|
|
602
|
-
if (e === 0) return;
|
|
603
|
-
const i = this.Hs.Js();
|
|
604
|
-
this.pi.ci(i, e), this.pi.ui(t);
|
|
605
|
-
}
|
|
606
|
-
fi(t) {
|
|
607
|
-
this.pi.fi(t);
|
|
608
|
-
}
|
|
609
|
-
Cs(t, e) {
|
|
610
|
-
const i = this.Hs.Qs;
|
|
611
|
-
i !== 0 && this.$.drawArraysInstanced(t, 0, e, i);
|
|
612
|
-
}
|
|
613
|
-
O() {
|
|
614
|
-
this.pi.O();
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
class D {
|
|
618
|
-
constructor(t, e, i, s) {
|
|
619
|
-
a(this, "$");
|
|
620
|
-
a(this, "yi");
|
|
621
|
-
a(this, "wi");
|
|
622
|
-
a(this, "bi");
|
|
623
|
-
a(this, "$i", null);
|
|
624
|
-
this.$ = t, this.yi = e, this.wi = i, this.bi = s;
|
|
625
|
-
const r = this.$.createBuffer();
|
|
626
|
-
At(this.$, this.$.ARRAY_BUFFER, r, this.bi.Ci, this.$.STATIC_DRAW), this.$i = r;
|
|
627
|
-
}
|
|
628
|
-
get type() {
|
|
629
|
-
return this.wi;
|
|
630
|
-
}
|
|
631
|
-
get unitGeometry() {
|
|
632
|
-
return this.bi;
|
|
633
|
-
}
|
|
634
|
-
get unitBuffer() {
|
|
635
|
-
return this.$i;
|
|
636
|
-
}
|
|
637
|
-
get batch() {
|
|
638
|
-
return this.yi;
|
|
639
|
-
}
|
|
640
|
-
Mi() {
|
|
641
|
-
this.yi.mi();
|
|
642
|
-
}
|
|
643
|
-
xi() {
|
|
644
|
-
return !this.yi.ii;
|
|
645
|
-
}
|
|
646
|
-
O() {
|
|
647
|
-
this.yi.O(), this.$.deleteBuffer(this.$i);
|
|
648
|
-
}
|
|
649
|
-
Ai(t, e, i) {
|
|
650
|
-
return this.yi._i(t);
|
|
651
|
-
}
|
|
652
|
-
Fi(t, e, i, s, r, h) {
|
|
653
|
-
const o = r.It ?? 0, c = r.zt ?? 0, l = r.Dt ?? 0, u = r.yt ?? 0, f = r.wt ?? 0, g = r.bt ?? 0, p = [0, 0, 0, 0], m = [0, 0, 0, 0];
|
|
654
|
-
h && (h.bezStartX !== void 0 && h.bezStartY !== void 0 && h.bezEndX !== void 0 && h.bezEndY !== void 0 ? (p[0] = h.cp1x ?? 0, p[1] = h.cp1y ?? 0, p[2] = h.cp2x ?? 0, p[3] = h.cp2y ?? 0, m[0] = h.bezStartX ?? 0, m[1] = h.bezStartY ?? 0, m[2] = h.bezEndX ?? 0, m[3] = h.bezEndY ?? 0) : h.arcStart === void 0 && h.arcStop === void 0 || (p[0] = h.arcStart ?? 0, p[1] = h.arcStop ?? 0));
|
|
655
|
-
const d = { x: t, y: e, width: i, height: s, char0: r.Gt[0], char1: r.Gt[1], char2: r.Gt[2], r1: r.Wt[0], g1: r.Wt[1], b1: r.Wt[2], a1: r.Wt[3], r2: r.Ht[0], g2: r.Ht[1], b2: r.Ht[2], a2: r.Ht[3], invert: r.Ft ? 1 : 0, flipX: r.Ot ? 1 : 0, flipY: r.Bt ? 1 : 0, charRot: r.Tt, translationX: o, translationY: c, translationZ: l, rotationX: u, rotationY: f, rotationZ: g, curveParams0: p, curveParams1: m, depth: (h == null ? void 0 : h.depth) ?? 0, baseZ: (h == null ? void 0 : h.baseZ) ?? 0, geometryType: Wt[this.wi] ?? 0 };
|
|
656
|
-
return this.yi.ei(d);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
const Jt = { Ci: dt, Ti: 6, ...X }, qt = { Ci: 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]), Ti: 6, ...X }, Qt = { Ci: function(n = 32) {
|
|
660
|
-
const t = [], e = 2 * Math.PI / n;
|
|
661
|
-
for (let i = 0; i < n; i++) {
|
|
662
|
-
const s = i * e, r = (i + 1) % n * e, h = Math.cos(s), o = Math.sin(s), c = 0.5 * (h + 1), l = 0.5 * (o + 1), u = Math.cos(r), f = Math.sin(r), g = 0.5 * (u + 1), p = 0.5 * (f + 1);
|
|
663
|
-
t.push(0, 0, 0.5, 0.5, h, o, c, l, u, f, g, p);
|
|
664
|
-
}
|
|
665
|
-
return new Float32Array(t);
|
|
666
|
-
}(32), Ti: 96, ...X };
|
|
667
|
-
let te = { Ci: function(n) {
|
|
668
|
-
const t = [];
|
|
669
|
-
for (let e = 0; e < n; e++) {
|
|
670
|
-
const i = e / n, s = (e + 1) / n;
|
|
671
|
-
t.push(i, 0, i, 0, i, 1, i, 1, s, 1, s, 1);
|
|
672
|
-
}
|
|
673
|
-
return new Float32Array(t);
|
|
674
|
-
}(32), Ti: 96, ...X };
|
|
675
|
-
const ee = { Ci: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ti: 3, ...X }, ie = { Ci: function(n = 16) {
|
|
676
|
-
const t = [];
|
|
677
|
-
for (let e = 0; e < n; e++) {
|
|
678
|
-
const i = e / n, s = (e + 1) / n;
|
|
679
|
-
t.push(i, -0.5, i, 0, s, -0.5, s, 0, i, 0.5, i, 1, i, 0.5, i, 1, s, -0.5, s, 0, s, 0.5, s, 1);
|
|
680
|
-
}
|
|
681
|
-
return new Float32Array(t);
|
|
682
|
-
}(16), Ti: 96, ...X }, re = { [b.RECTANGLE]: class extends D {
|
|
683
|
-
constructor(n, t) {
|
|
684
|
-
super(n, t, b.RECTANGLE, Jt);
|
|
685
|
-
}
|
|
686
|
-
_i(n, t) {
|
|
687
|
-
return this.Fi(0, 0, n.width, n.height, t);
|
|
688
|
-
}
|
|
689
|
-
}, [b.LINE]: class extends D {
|
|
690
|
-
constructor(n, t) {
|
|
691
|
-
super(n, t, b.LINE, qt);
|
|
692
|
-
}
|
|
693
|
-
_i(n, t) {
|
|
694
|
-
const e = n.x2 - n.x1, i = n.y2 - n.y1, s = Math.hypot(e, i), r = Math.atan2(i, e), h = t.Lt || 1, o = n.x1 + e / 2 - s / 2, c = n.y1 + i / 2, l = { ...t, bt: (t.bt || 0) + r };
|
|
695
|
-
return this.Fi(o, c, s, h, l);
|
|
696
|
-
}
|
|
697
|
-
}, [b.ELLIPSE]: class extends D {
|
|
698
|
-
constructor(n, t) {
|
|
699
|
-
super(n, t, b.ELLIPSE, Qt);
|
|
700
|
-
}
|
|
701
|
-
_i(n, t) {
|
|
702
|
-
return this.Fi(0, 0, n.width, n.height, t);
|
|
703
|
-
}
|
|
704
|
-
}, [b.ARC]: class extends D {
|
|
705
|
-
constructor(n, t) {
|
|
706
|
-
super(n, t, b.ARC, te);
|
|
707
|
-
}
|
|
708
|
-
_i(n, t) {
|
|
709
|
-
const e = n.start * Math.PI / 180, i = n.stop * Math.PI / 180;
|
|
710
|
-
return this.Fi(0, 0, n.width, n.height, t, { arcStart: e, arcStop: i });
|
|
711
|
-
}
|
|
712
|
-
}, [b.TRIANGLE]: class extends D {
|
|
713
|
-
constructor(n, t) {
|
|
714
|
-
super(n, t, b.TRIANGLE, ee);
|
|
715
|
-
}
|
|
716
|
-
_i(n, t) {
|
|
717
|
-
const e = Math.min(n.x1, n.x2, n.x3), i = Math.max(n.x1, n.x2, n.x3), s = Math.min(n.y1, n.y2, n.y3), r = i - e, h = Math.max(n.y1, n.y2, n.y3) - s;
|
|
718
|
-
return this.Fi(e, s, r, h, t);
|
|
719
|
-
}
|
|
720
|
-
}, [b.BEZIER_CURVE]: class extends D {
|
|
721
|
-
constructor(n, t) {
|
|
722
|
-
super(n, t, b.BEZIER_CURVE, ie);
|
|
723
|
-
}
|
|
724
|
-
_i(n, t) {
|
|
725
|
-
return this.Fi(0, 0, 1, t.Lt || 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 });
|
|
726
|
-
}
|
|
727
|
-
} };
|
|
728
|
-
class se {
|
|
729
|
-
constructor(t) {
|
|
730
|
-
a(this, "$");
|
|
731
|
-
a(this, "Ri");
|
|
732
|
-
a(this, "Ei");
|
|
733
|
-
this.$ = t, this.Ei = new jt(t), this.Ri = /* @__PURE__ */ new Map();
|
|
734
|
-
for (const e of Object.values(b)) {
|
|
735
|
-
const i = new Zt(t), s = new re[e](t, i);
|
|
736
|
-
this.Ri.set(e, s);
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
Si(t) {
|
|
740
|
-
const e = this.ki(t);
|
|
741
|
-
for (const i of e) this.Pi(i);
|
|
742
|
-
}
|
|
743
|
-
ki(t) {
|
|
744
|
-
const e = [];
|
|
745
|
-
let i = null, s = null, r = null;
|
|
746
|
-
for (const h of t) s !== h.material || r !== h.type ? (i && i.length > 0 && e.push({ material: s, type: r, commands: i }), i = [h], s = h.material, r = h.type) : i.push(h);
|
|
747
|
-
return i && i.length > 0 && e.push({ material: s, type: r, commands: i }), e;
|
|
748
|
-
}
|
|
749
|
-
Pi(t) {
|
|
750
|
-
const { material: e, type: i, commands: s } = t, r = this.Ri.get(i);
|
|
751
|
-
e.shader.k(), e.shader.L(e.uniforms);
|
|
752
|
-
const h = Lt(this.$), o = s.length > 0 && s[0].state.Et;
|
|
753
|
-
e.shader.L({ Uv: h[2] / h[3], Us: [h[2], h[3]], Ut: 1, Uu: o ? 1 : 0 }), r.Mi();
|
|
754
|
-
for (const c of s) r._i(c.params, c.state);
|
|
755
|
-
if (r.xi()) {
|
|
756
|
-
const c = r.unitGeometry, l = r.unitBuffer;
|
|
757
|
-
try {
|
|
758
|
-
this.Ei.As(e.shader.D, i + "", c, l), r.batch.ui(e.shader), r.batch.Cs(c._s, c.Ti);
|
|
759
|
-
} finally {
|
|
760
|
-
r.batch.fi(e.shader), this.Ei.Fs(), r.Mi();
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
O() {
|
|
765
|
-
for (const t of this.Ri.values()) t.O();
|
|
766
|
-
this.Ri.clear(), this.Ei.O();
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
function Ct(n) {
|
|
770
|
-
let t = 0;
|
|
771
|
-
for (let e = 0; e < n.length; e++)
|
|
772
|
-
t = (t << 5) - t + n.charCodeAt(e), t &= t;
|
|
773
|
-
return t;
|
|
774
|
-
}
|
|
775
|
-
function Et(n) {
|
|
776
|
-
return Ct(n + "");
|
|
777
|
-
}
|
|
778
|
-
function W(n, t) {
|
|
779
|
-
return (n << 5) - n + t;
|
|
780
|
-
}
|
|
781
|
-
class ne {
|
|
782
|
-
constructor(t) {
|
|
783
|
-
a(this, "$");
|
|
784
|
-
a(this, "Li", 0);
|
|
785
|
-
a(this, "Ii");
|
|
786
|
-
a(this, "zi");
|
|
787
|
-
a(this, "Di", /* @__PURE__ */ new Map());
|
|
788
|
-
this.$ = t, this.Ii = new Z(t, st, `#version 300 es
|
|
789
|
-
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;void main(){int A=int(v_glyphFlags.r>0.5?1:0);int B=int(v_glyphFlags.g>0.5?1:0);int C=int(v_glyphFlags.b>0.5?1:0);float D=float(A|(B<<1)|(C<<2))/255.;o_character=vec4(v_glyphIndex.xy,D,clamp(v_glyphFlags.a,0.,1.));o_primaryColor=vec4(v_glyphColor.rgb,v_glyphColor.a);o_secondaryColor=vec4(v_cellColor.rgb,v_cellColor.a);}`), this.zi = { id: this.Li++, shader: this.Ii, uniforms: Object.freeze({}), hash: this.Oi(this.Ii, {}), isBuiltIn: !0 };
|
|
790
|
-
}
|
|
791
|
-
get Bi() {
|
|
792
|
-
return this.zi;
|
|
793
|
-
}
|
|
794
|
-
ut(t, e = {}, i = !1) {
|
|
795
|
-
const s = this.Oi(t, e), r = this.Di.get(s);
|
|
796
|
-
if (r) return r;
|
|
797
|
-
const h = { id: this.Li++, shader: t, uniforms: Object.freeze({ ...e }), hash: s, isBuiltIn: i };
|
|
798
|
-
return this.Di.set(s, h), h;
|
|
799
|
-
}
|
|
800
|
-
Gi(t, e = {}) {
|
|
801
|
-
return { id: this.Li++, shader: t, uniforms: Object.freeze({ ...e }), hash: 0, isBuiltIn: !1 };
|
|
802
|
-
}
|
|
803
|
-
Oi(t, e) {
|
|
804
|
-
const i = Et(t.D), s = function(r, h) {
|
|
805
|
-
let o = 0;
|
|
806
|
-
const c = Object.keys(r).sort();
|
|
807
|
-
for (const l of c) o = W(o, Ct(l)), o = W(o, h(r[l]));
|
|
808
|
-
return o;
|
|
809
|
-
}(e, this.Wi.bind(this));
|
|
810
|
-
return W(i, s);
|
|
811
|
-
}
|
|
812
|
-
Wi(t) {
|
|
813
|
-
return typeof t == "number" || typeof t == "boolean" ? function(e) {
|
|
814
|
-
return typeof e == "boolean" ? e ? 1 : 0 : Math.floor(e);
|
|
815
|
-
}(t) : Array.isArray(t) ? function(e) {
|
|
816
|
-
let i = 0;
|
|
817
|
-
const s = Array.isArray(e[0]) ? e.flat() : e;
|
|
818
|
-
for (const r of s) i = W(i, typeof r == "number" ? r : 0);
|
|
819
|
-
return i;
|
|
820
|
-
}(t) : t instanceof Float32Array || t instanceof Int32Array ? function(e) {
|
|
821
|
-
let i = 0;
|
|
822
|
-
const s = Math.min(e.length, 16);
|
|
823
|
-
for (let r = 0; r < s; r++) i = W(i, e[r]);
|
|
824
|
-
return i;
|
|
825
|
-
}(t) : t instanceof WebGLTexture ? Et(t) : 0;
|
|
826
|
-
}
|
|
827
|
-
O() {
|
|
828
|
-
this.Ii != this.Ii && this.Ii.O(), this.Ii.O(), this.Di.clear();
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
class he {
|
|
832
|
-
constructor() {
|
|
833
|
-
a(this, "Hi", []);
|
|
834
|
-
a(this, "Ki", 1);
|
|
835
|
-
a(this, "Rs", 0);
|
|
836
|
-
}
|
|
837
|
-
Yi(t, e) {
|
|
838
|
-
if (this.Rs >= this.Hi.length) {
|
|
839
|
-
const s = { id: this.Ki++, type: t, params: {}, state: nt.Pt(), material: e };
|
|
840
|
-
this.Hi.push(s);
|
|
841
|
-
}
|
|
842
|
-
const i = this.Hi[this.Rs];
|
|
843
|
-
return i.id = this.Ki++, i.type = t, i.material = e, this.Rs++, i;
|
|
844
|
-
}
|
|
845
|
-
ji(t, e, i) {
|
|
846
|
-
const s = this.Yi(b.RECTANGLE, i), r = s.params;
|
|
847
|
-
return r.width = t.width, r.height = t.height, e.jt(s.state), s.id;
|
|
848
|
-
}
|
|
849
|
-
Ni(t, e, i) {
|
|
850
|
-
const s = this.Yi(b.LINE, i), r = s.params;
|
|
851
|
-
return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, e.jt(s.state), s.id;
|
|
852
|
-
}
|
|
853
|
-
Xi(t, e, i) {
|
|
854
|
-
const s = this.Yi(b.ELLIPSE, i), r = s.params;
|
|
855
|
-
return r.width = t.width, r.height = t.height, r.startAngle = t.startAngle, r.endAngle = t.endAngle, r.segments = t.segments, e.jt(s.state), s.id;
|
|
856
|
-
}
|
|
857
|
-
Zi(t, e, i) {
|
|
858
|
-
const s = this.Yi(b.ARC, i), r = s.params;
|
|
859
|
-
return r.width = t.width, r.height = t.height, r.start = t.start, r.stop = t.stop, e.jt(s.state), s.id;
|
|
860
|
-
}
|
|
861
|
-
Vi(t, e, i) {
|
|
862
|
-
const s = this.Yi(b.TRIANGLE, i), r = s.params;
|
|
863
|
-
return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.x3 = t.x3, r.y3 = t.y3, e.jt(s.state), s.id;
|
|
864
|
-
}
|
|
865
|
-
qi(t, e, i) {
|
|
866
|
-
const s = this.Yi(b.BEZIER_CURVE, i), r = s.params;
|
|
867
|
-
return r.x1 = t.x1, r.y1 = t.y1, r.cp1x = t.cp1x, r.cp1y = t.cp1y, r.cp2x = t.cp2x, r.cp2y = t.cp2y, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, r.segments = t.segments, e.jt(s.state), s.id;
|
|
868
|
-
}
|
|
869
|
-
mi() {
|
|
870
|
-
this.Rs = 0;
|
|
871
|
-
}
|
|
872
|
-
[Symbol.iterator]() {
|
|
873
|
-
let t = 0;
|
|
874
|
-
const e = this.Rs, i = this.Hi;
|
|
875
|
-
return { next: () => t < e ? { value: i[t++], done: !1 } : { value: void 0, done: !0 } };
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
class oe {
|
|
879
|
-
constructor(t) {
|
|
880
|
-
a(this, "$");
|
|
881
|
-
a(this, "Ji", null);
|
|
882
|
-
a(this, "Qi");
|
|
883
|
-
a(this, "ft");
|
|
884
|
-
a(this, "te");
|
|
885
|
-
a(this, "se");
|
|
886
|
-
a(this, "ie");
|
|
887
|
-
a(this, "ee", null);
|
|
888
|
-
a(this, "re", {});
|
|
889
|
-
a(this, "ne", []);
|
|
890
|
-
a(this, "oe", []);
|
|
891
|
-
a(this, "he", null);
|
|
892
|
-
a(this, "ae", [0, 0, 0, 0]);
|
|
893
|
-
this.$ = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.te = new nt(), this.ft = new ne(t), this.se = new he(), this.Qi = new se(t), this.ie = new zt(t);
|
|
894
|
-
const e = [0, 0, t.canvas.width, t.canvas.height];
|
|
895
|
-
ot(t, e), this.ne.push(null), this.oe.push(e), this.he = null, this.ae = e;
|
|
896
|
-
}
|
|
897
|
-
it() {
|
|
898
|
-
this.ne.push(this.he), this.oe.push([...this.ae]);
|
|
899
|
-
}
|
|
900
|
-
ht() {
|
|
901
|
-
return { framebuffer: this.ne.pop() ?? null, viewport: this.oe.pop() ?? [0, 0, this.$.canvas.width, this.$.canvas.height] };
|
|
902
|
-
}
|
|
903
|
-
et(t, e, i) {
|
|
904
|
-
const s = this.$;
|
|
905
|
-
this.he !== t && (s.bindFramebuffer(s.FRAMEBUFFER, t), this.he = t);
|
|
906
|
-
const r = [0, 0, e, i];
|
|
907
|
-
this.ae[0] === r[0] && this.ae[1] === r[1] && this.ae[2] === r[2] && this.ae[3] === r[3] || (s.viewport(...r), ot(s, r), this.ae = r);
|
|
908
|
-
}
|
|
909
|
-
ce(t) {
|
|
910
|
-
this.Ji !== t && (this.Ji = t, t.k());
|
|
911
|
-
}
|
|
912
|
-
le(t, e) {
|
|
913
|
-
return new Z(this.$, t, e);
|
|
914
|
-
}
|
|
915
|
-
ue(t) {
|
|
916
|
-
this.ee = t, t && (this.re = {});
|
|
917
|
-
}
|
|
918
|
-
I(t, e) {
|
|
919
|
-
this.re[t] = e;
|
|
920
|
-
}
|
|
921
|
-
fe(t) {
|
|
922
|
-
Object.assign(this.re, t);
|
|
923
|
-
}
|
|
924
|
-
de(t) {
|
|
925
|
-
return new Z(this.$, st, t);
|
|
926
|
-
}
|
|
927
|
-
pe(t, e, i) {
|
|
928
|
-
this.se.ji({ width: e ?? t.width, height: i ?? t.height }, this.te, t.ct());
|
|
929
|
-
}
|
|
930
|
-
_e(t, e, i, s) {
|
|
931
|
-
this.ie.Cs(t, e, i, s);
|
|
932
|
-
}
|
|
933
|
-
ge(t, e) {
|
|
934
|
-
if (this.ee) {
|
|
935
|
-
const i = this.ft.Gi(this.ee, this.re);
|
|
936
|
-
this.se.ji({ width: t, height: e }, this.te, i), this.ee = null, this.re = {};
|
|
937
|
-
} else this.se.ji({ width: t, height: e }, this.te, this.ft.Bi);
|
|
938
|
-
}
|
|
939
|
-
ve(t, e, i, s) {
|
|
940
|
-
this.se.Ni({ x1: t, y1: e, x2: i, y2: s }, this.te, this.ft.Bi);
|
|
941
|
-
}
|
|
942
|
-
me(t, e) {
|
|
943
|
-
this.se.Xi({ width: t, height: e }, this.te, this.ft.Bi);
|
|
944
|
-
}
|
|
945
|
-
ye(t, e, i, s, r, h) {
|
|
946
|
-
this.se.Vi({ x1: t, y1: e, x2: i, y2: s, x3: r, y3: h }, this.te, this.ft.Bi);
|
|
947
|
-
}
|
|
948
|
-
we(t, e, i, s, r, h, o, c) {
|
|
949
|
-
this.se.qi({ x1: t, y1: e, cp1x: i, cp1y: s, cp2x: r, cp2y: h, x2: o, y2: c }, this.te, this.ft.Bi);
|
|
950
|
-
}
|
|
951
|
-
be(t, e, i, s) {
|
|
952
|
-
this.se.Zi({ width: t, height: e, start: i, stop: s }, this.te, this.ft.Bi);
|
|
953
|
-
}
|
|
954
|
-
$e(t, e, i = 1, s = {}) {
|
|
955
|
-
return new it(this.$, t, e, i, s, this);
|
|
956
|
-
}
|
|
957
|
-
Ce(t, e = t, i = t, s = 255) {
|
|
958
|
-
this.te.fs(t, e ?? t, i ?? t, s);
|
|
959
|
-
const [r, h, o, c] = this.te.canvasBackgroundColor;
|
|
960
|
-
this.mi(r, h, o, c);
|
|
961
|
-
}
|
|
962
|
-
mi(t = 0, e = 0, i = 0, s = 0) {
|
|
963
|
-
this.$.clearColor(t, e, i, s), this.$.clear(this.$.COLOR_BUFFER_BIT);
|
|
964
|
-
}
|
|
965
|
-
Me() {
|
|
966
|
-
const t = [0, 0, this.$.canvas.width, this.$.canvas.height];
|
|
967
|
-
this.$.viewport(...t), ot(this.$, t), this.ae = t, this.oe.length > 0 && (this.oe[0] = t);
|
|
968
|
-
}
|
|
969
|
-
ot() {
|
|
970
|
-
const t = this.se;
|
|
971
|
-
this.Qi.Si(t), t.mi();
|
|
972
|
-
}
|
|
973
|
-
O() {
|
|
974
|
-
this.ft.O(), this.Qi.O(), this.ie.O();
|
|
975
|
-
}
|
|
976
|
-
get context() {
|
|
977
|
-
return this.$;
|
|
978
|
-
}
|
|
979
|
-
get state() {
|
|
980
|
-
return this.te;
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
const L = { readShort: (n, t) => (L.t.uint16[0] = n[t] << 8 | n[t + 1], L.t.int16[0]), readUshort: (n, t) => n[t] << 8 | n[t + 1], readUshorts(n, t, e) {
|
|
984
|
-
const i = [];
|
|
985
|
-
for (let s = 0; s < e; s++) i.push(L.readUshort(n, t + 2 * s));
|
|
986
|
-
return i;
|
|
987
|
-
}, readUint(n, t) {
|
|
988
|
-
const e = L.t.uint8;
|
|
989
|
-
return e[3] = n[t], e[2] = n[t + 1], e[1] = n[t + 2], e[0] = n[t + 3], L.t.uint32[0];
|
|
990
|
-
}, readASCII(n, t, e) {
|
|
991
|
-
let i = "";
|
|
992
|
-
for (let s = 0; s < e; s++) i += String.fromCharCode(n[t + s]);
|
|
993
|
-
return i;
|
|
994
|
-
}, t: (() => {
|
|
995
|
-
const n = new ArrayBuffer(8);
|
|
996
|
-
return { uint8: new Uint8Array(n), int16: new Int16Array(n), uint16: new Uint16Array(n), uint32: new Uint32Array(n) };
|
|
997
|
-
})() };
|
|
998
|
-
function q(n) {
|
|
999
|
-
return n + 3 & -4;
|
|
1000
|
-
}
|
|
1001
|
-
function Q(n, t, e) {
|
|
1002
|
-
n[t] = e >>> 8 & 255, n[t + 1] = 255 & e;
|
|
1003
|
-
}
|
|
1004
|
-
function _(n, t, e) {
|
|
1005
|
-
n[t] = e >>> 24 & 255, n[t + 1] = e >>> 16 & 255, n[t + 2] = e >>> 8 & 255, n[t + 3] = 255 & e;
|
|
1006
|
-
}
|
|
1007
|
-
function ae(n, t, e) {
|
|
1008
|
-
for (let i = 0; i < e.length; i++) n[t + i] = 255 & e.charCodeAt(i);
|
|
1009
|
-
}
|
|
1010
|
-
function at(n, t, e) {
|
|
1011
|
-
const i = t + e;
|
|
1012
|
-
let s = 0;
|
|
1013
|
-
const r = L.t;
|
|
1014
|
-
for (let h = t; h < i; h += 4) r.uint8[3] = n[h] || 0, r.uint8[2] = n[h + 1] || 0, r.uint8[1] = n[h + 2] || 0, r.uint8[0] = n[h + 3] || 0, s = s + (r.uint32[0] >>> 0) >>> 0;
|
|
1015
|
-
return s >>> 0;
|
|
1016
|
-
}
|
|
1017
|
-
class ce {
|
|
1018
|
-
constructor(t) {
|
|
1019
|
-
a(this, "b");
|
|
1020
|
-
a(this, "p", 0);
|
|
1021
|
-
a(this, "bitbuf", 0);
|
|
1022
|
-
a(this, "bitcnt", 0);
|
|
1023
|
-
this.b = t;
|
|
1024
|
-
}
|
|
1025
|
-
readBits(t) {
|
|
1026
|
-
for (; this.bitcnt < t; ) {
|
|
1027
|
-
const i = this.b[this.p++] || 0;
|
|
1028
|
-
this.bitbuf |= i << this.bitcnt, this.bitcnt += 8;
|
|
1029
|
-
}
|
|
1030
|
-
const e = this.bitbuf & (1 << t) - 1;
|
|
1031
|
-
return this.bitbuf >>>= t, this.bitcnt -= t, e;
|
|
1032
|
-
}
|
|
1033
|
-
alignToByte() {
|
|
1034
|
-
this.bitbuf = 0, this.bitcnt = 0;
|
|
1035
|
-
}
|
|
1036
|
-
get offset() {
|
|
1037
|
-
return this.p;
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
function j(n) {
|
|
1041
|
-
let t = 32, e = 0;
|
|
1042
|
-
for (const o of n) o && (o < t && (t = o), o > e && (e = o));
|
|
1043
|
-
if (e === 0) return { min: 0, max: 0, table: /* @__PURE__ */ new Map() };
|
|
1044
|
-
const i = new Uint32Array(e + 1);
|
|
1045
|
-
for (const o of n) o && i[o]++;
|
|
1046
|
-
const s = new Uint32Array(e + 1);
|
|
1047
|
-
let r = 0;
|
|
1048
|
-
i[0] = 0;
|
|
1049
|
-
for (let o = 1; o <= e; o++) r = r + i[o - 1] << 1, s[o] = r;
|
|
1050
|
-
const h = /* @__PURE__ */ new Map();
|
|
1051
|
-
for (let o = 0; o < n.length; o++) {
|
|
1052
|
-
const c = n[o];
|
|
1053
|
-
if (!c) continue;
|
|
1054
|
-
const l = s[c]++;
|
|
1055
|
-
let u = h.get(c);
|
|
1056
|
-
u || (u = [], h.set(c, u)), u[le(l, c)] = o;
|
|
1057
|
-
}
|
|
1058
|
-
return { min: t, max: e, table: h };
|
|
1059
|
-
}
|
|
1060
|
-
function ct(n, t) {
|
|
1061
|
-
let e = 0;
|
|
1062
|
-
for (let i = 1; i <= t.max; i++) {
|
|
1063
|
-
e |= n.readBits(1) << i - 1;
|
|
1064
|
-
const s = t.table.get(i);
|
|
1065
|
-
if (s && e < s.length) {
|
|
1066
|
-
const r = s[e];
|
|
1067
|
-
if (r !== void 0) return r;
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
throw Error("Invalid Huffman code");
|
|
1071
|
-
}
|
|
1072
|
-
function le(n, t) {
|
|
1073
|
-
let e = 0;
|
|
1074
|
-
for (let i = 0; i < t; i++) e = e << 1 | 1 & n, n >>>= 1;
|
|
1075
|
-
return e >>> 0;
|
|
1076
|
-
}
|
|
1077
|
-
function ue(n) {
|
|
1078
|
-
if (n.length < 2) throw Error("ZLIB data too short");
|
|
1079
|
-
const t = n[0], e = n[1];
|
|
1080
|
-
if ((15 & t) != 8) throw Error("Unsupported ZLIB compression method");
|
|
1081
|
-
if (((t << 8) + e) % 31 != 0) throw Error("Bad ZLIB header check");
|
|
1082
|
-
let i = 2;
|
|
1083
|
-
32 & e && (i += 4);
|
|
1084
|
-
const s = [];
|
|
1085
|
-
return function(r, h) {
|
|
1086
|
-
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];
|
|
1087
|
-
let f = 0;
|
|
1088
|
-
for (; !f; ) {
|
|
1089
|
-
f = r.readBits(1);
|
|
1090
|
-
const g = r.readBits(2);
|
|
1091
|
-
if (g === 0) {
|
|
1092
|
-
r.alignToByte();
|
|
1093
|
-
const p = r.readBits(16);
|
|
1094
|
-
if ((65535 & (65535 ^ p)) !== r.readBits(16)) throw Error("DEFLATE uncompressed LEN/NLEN mismatch");
|
|
1095
|
-
for (let m = 0; m < p; m++) h.push(r.readBits(8));
|
|
1096
|
-
} else {
|
|
1097
|
-
if (g !== 1 && g !== 2) throw Error("Unsupported DEFLATE type");
|
|
1098
|
-
{
|
|
1099
|
-
let p, m;
|
|
1100
|
-
if (g === 1) {
|
|
1101
|
-
const d = Array(288).fill(0);
|
|
1102
|
-
for (let y = 0; y <= 143; y++) d[y] = 8;
|
|
1103
|
-
for (let y = 144; y <= 255; y++) d[y] = 9;
|
|
1104
|
-
for (let y = 256; y <= 279; y++) d[y] = 7;
|
|
1105
|
-
for (let y = 280; y <= 287; y++) d[y] = 8;
|
|
1106
|
-
p = j(d), m = j(Array(32).fill(5));
|
|
1107
|
-
} else {
|
|
1108
|
-
const d = r.readBits(5) + 257, y = r.readBits(5) + 1, v = r.readBits(4) + 4, w = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], E = Array(19).fill(0);
|
|
1109
|
-
for (let x = 0; x < v; x++) E[w[x]] = r.readBits(3);
|
|
1110
|
-
const R = j(E), T = [];
|
|
1111
|
-
for (; T.length < d + y; ) {
|
|
1112
|
-
const x = ct(r, R);
|
|
1113
|
-
if (x <= 15) T.push(x);
|
|
1114
|
-
else if (x === 16) {
|
|
1115
|
-
const N = r.readBits(2) + 3, F = T[T.length - 1] || 0;
|
|
1116
|
-
for (let J = 0; J < N; J++) T.push(F);
|
|
1117
|
-
} else if (x === 17) {
|
|
1118
|
-
const N = r.readBits(3) + 3;
|
|
1119
|
-
for (let F = 0; F < N; F++) T.push(0);
|
|
1120
|
-
} else {
|
|
1121
|
-
if (x !== 18) throw Error("Invalid code length symbol");
|
|
1122
|
-
{
|
|
1123
|
-
const N = r.readBits(7) + 11;
|
|
1124
|
-
for (let F = 0; F < N; F++) T.push(0);
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
const A = T.slice(0, d), I = T.slice(d, d + y);
|
|
1129
|
-
p = j(A), m = j(I);
|
|
1130
|
-
}
|
|
1131
|
-
for (; ; ) {
|
|
1132
|
-
const d = ct(r, p);
|
|
1133
|
-
if (d < 256) h.push(d);
|
|
1134
|
-
else {
|
|
1135
|
-
if (d === 256) break;
|
|
1136
|
-
if (d > 256 && d < 286) {
|
|
1137
|
-
const y = d - 257;
|
|
1138
|
-
let v = o[y];
|
|
1139
|
-
const w = c[y];
|
|
1140
|
-
w && (v += r.readBits(w));
|
|
1141
|
-
const E = ct(r, m);
|
|
1142
|
-
if (E >= 30) throw Error("Invalid distance symbol");
|
|
1143
|
-
let R = l[E];
|
|
1144
|
-
const T = u[E];
|
|
1145
|
-
T && (R += r.readBits(T));
|
|
1146
|
-
const A = h.length - R;
|
|
1147
|
-
if (A < 0) throw Error("Invalid distance");
|
|
1148
|
-
for (let I = 0; I < v; I++) h.push(h[A + I] || 0);
|
|
1149
|
-
} else if (d === 286 || d === 287) throw Error("Reserved length symbol");
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
}(new ce(n.subarray(i)), s), new Uint8Array(s);
|
|
1156
|
-
}
|
|
1157
|
-
function fe(n) {
|
|
1158
|
-
const t = L, e = new Uint8Array(n);
|
|
1159
|
-
if (t.readASCII(e, 0, 4) !== "wOFF") throw Error("Invalid WOFF signature");
|
|
1160
|
-
const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), h = [];
|
|
1161
|
-
let o = 44;
|
|
1162
|
-
for (let v = 0; v < s; v++) {
|
|
1163
|
-
const w = t.readASCII(e, o, 4), E = t.readUint(e, o + 4), R = t.readUint(e, o + 8), T = t.readUint(e, o + 12), A = t.readUint(e, o + 16);
|
|
1164
|
-
h.push({ tag: w, offset: E, compLength: R, origLength: T, checksum: A }), o += 20;
|
|
1165
|
-
}
|
|
1166
|
-
for (const v of h) {
|
|
1167
|
-
const w = new Uint8Array(e.buffer, v.offset, v.compLength);
|
|
1168
|
-
if (v.compLength === v.origLength) v.data = new Uint8Array(w);
|
|
1169
|
-
else if (v.data = ue(w), v.data.length !== v.origLength) if (v.data.length < v.origLength) {
|
|
1170
|
-
const E = new Uint8Array(v.origLength);
|
|
1171
|
-
E.set(v.data), v.data = E;
|
|
1172
|
-
} else v.data = v.data.subarray(0, v.origLength);
|
|
1173
|
-
}
|
|
1174
|
-
const c = s;
|
|
1175
|
-
let l = 1, u = 0;
|
|
1176
|
-
for (; l << 1 <= c; ) l <<= 1, u++;
|
|
1177
|
-
const f = 16 * l, g = 16 * c - f;
|
|
1178
|
-
let p = 12 + 16 * c;
|
|
1179
|
-
const m = {};
|
|
1180
|
-
for (const v of h) m[v.tag] = p, p = q(p + v.data.length);
|
|
1181
|
-
const d = new Uint8Array(Math.max(r || 0, p));
|
|
1182
|
-
_(d, 0, i), Q(d, 4, c), Q(d, 6, f), Q(d, 8, u), Q(d, 10, g);
|
|
1183
|
-
let y = 12;
|
|
1184
|
-
for (const v of h) {
|
|
1185
|
-
ae(d, y, v.tag), y += 4;
|
|
1186
|
-
let w = v.data;
|
|
1187
|
-
if (v.tag === "head" && w.length >= 12) {
|
|
1188
|
-
const E = new Uint8Array(w);
|
|
1189
|
-
_(E, 8, 0), _(d, y, at(E, 0, q(E.length))), y += 4;
|
|
1190
|
-
} else
|
|
1191
|
-
_(d, y, at(w, 0, q(w.length))), y += 4;
|
|
1192
|
-
_(d, y, m[v.tag]), y += 4, _(d, y, v.data.length), y += 4;
|
|
1193
|
-
}
|
|
1194
|
-
for (const v of h) {
|
|
1195
|
-
const w = m[v.tag];
|
|
1196
|
-
d.set(v.data, w);
|
|
1197
|
-
}
|
|
1198
|
-
if (h.find((v) => v.tag === "head")) {
|
|
1199
|
-
const v = m.head, w = function(E, R) {
|
|
1200
|
-
const T = R + 8, A = [E[T], E[T + 1], E[T + 2], E[T + 3]];
|
|
1201
|
-
_(E, T, 0);
|
|
1202
|
-
const I = 2981146554 - (at(E, 0, q(E.length)) >>> 0) >>> 0;
|
|
1203
|
-
return E[T] = A[0], E[T + 1] = A[1], E[T + 2] = A[2], E[T + 3] = A[3], I >>> 0;
|
|
1204
|
-
}(d, v);
|
|
1205
|
-
_(d, v + 8, w);
|
|
1206
|
-
}
|
|
1207
|
-
return d.buffer;
|
|
1208
|
-
}
|
|
1209
|
-
const de = { parseTab(n, t, e) {
|
|
1210
|
-
const i = { tables: [], ids: {}, off: t };
|
|
1211
|
-
n = new Uint8Array(n.buffer, t, e), t = 0;
|
|
1212
|
-
const s = L, r = s.readUshort, h = r(n, t += 2);
|
|
1213
|
-
t += 2;
|
|
1214
|
-
const o = [];
|
|
1215
|
-
for (let c = 0; c < h; c++) {
|
|
1216
|
-
const l = r(n, t), u = r(n, t += 2);
|
|
1217
|
-
t += 2;
|
|
1218
|
-
const f = s.readUint(n, t);
|
|
1219
|
-
t += 4;
|
|
1220
|
-
const g = `p${l}e${u}`;
|
|
1221
|
-
let p = o.indexOf(f);
|
|
1222
|
-
if (p === -1) {
|
|
1223
|
-
let m;
|
|
1224
|
-
p = i.tables.length, o.push(f);
|
|
1225
|
-
const d = r(n, f);
|
|
1226
|
-
m = d === 4 ? this.parse4(n, f) : d === 12 ? this.parse12(n, f) : { format: d }, i.tables.push(m);
|
|
1227
|
-
}
|
|
1228
|
-
i.ids[g] = p;
|
|
1229
|
-
}
|
|
1230
|
-
return i;
|
|
1231
|
-
}, parse4(n, t) {
|
|
1232
|
-
const e = L, i = e.readUshort, s = e.readUshorts, r = t, h = i(n, t += 2);
|
|
1233
|
-
t += 2;
|
|
1234
|
-
const o = i(n, t += 2) >>> 1, c = { format: 4, searchRange: i(n, t += 2), entrySelector: 0, rangeShift: 0, endCount: [], startCount: [], idDelta: [], idRangeOffset: [], glyphIdArray: [] };
|
|
1235
|
-
t += 2, c.entrySelector = i(n, t), t += 2, c.rangeShift = i(n, t), t += 2, c.endCount = s(n, t, o), t += 2 * o, t += 2, c.startCount = s(n, t, o), t += 2 * o;
|
|
1236
|
-
for (let l = 0; l < o; l++) c.idDelta.push(e.readShort(n, t)), t += 2;
|
|
1237
|
-
return c.idRangeOffset = s(n, t, o), t += 2 * o, c.glyphIdArray = s(n, t, r + h - t >> 1), c;
|
|
1238
|
-
}, parse12(n, t) {
|
|
1239
|
-
const e = L.readUint;
|
|
1240
|
-
e(n, t += 4), e(n, t += 4);
|
|
1241
|
-
const i = e(n, t += 4);
|
|
1242
|
-
t += 4;
|
|
1243
|
-
const s = new Uint32Array(3 * i);
|
|
1244
|
-
for (let r = 0; r < 3 * i; r += 3) s[r] = e(n, t + (r << 2)), s[r + 1] = e(n, t + (r << 2) + 4), s[r + 2] = e(n, t + (r << 2) + 8);
|
|
1245
|
-
return { format: 12, groups: s };
|
|
1246
|
-
} }, ge = { parseTab(n, t, e) {
|
|
1247
|
-
const i = L;
|
|
1248
|
-
t += 18;
|
|
1249
|
-
const s = i.readUshort(n, t);
|
|
1250
|
-
t += 2, t += 16;
|
|
1251
|
-
const r = i.readShort(n, t);
|
|
1252
|
-
t += 2;
|
|
1253
|
-
const h = i.readShort(n, t);
|
|
1254
|
-
t += 2;
|
|
1255
|
-
const o = i.readShort(n, t);
|
|
1256
|
-
t += 2;
|
|
1257
|
-
const c = i.readShort(n, t);
|
|
1258
|
-
return t += 2, t += 6, { unitsPerEm: s, xMin: r, yMin: h, xMax: o, yMax: c, indexToLocFormat: i.readShort(n, t) };
|
|
1259
|
-
} }, pe = { parseTab(n, t, e) {
|
|
1260
|
-
const i = L;
|
|
1261
|
-
t += 4;
|
|
1262
|
-
const s = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], r = {};
|
|
1263
|
-
for (let h = 0; h < s.length; h++) {
|
|
1264
|
-
const o = s[h], c = o === "advanceWidthMax" || o === "numberOfHMetrics" ? i.readUshort : i.readShort;
|
|
1265
|
-
r[o] = c(n, t + 2 * h);
|
|
1266
|
-
}
|
|
1267
|
-
return r;
|
|
1268
|
-
} }, me = { parseTab(n, t, e, i) {
|
|
1269
|
-
const s = L, r = [], h = [], o = i.maxp.numGlyphs, c = i.hhea.numberOfHMetrics;
|
|
1270
|
-
let l = 0, u = 0, f = 0;
|
|
1271
|
-
for (; f < c; ) l = s.readUshort(n, t + (f << 2)), u = s.readShort(n, t + (f << 2) + 2), r.push(l), h.push(u), f++;
|
|
1272
|
-
for (; f < o; ) r.push(l), h.push(u), f++;
|
|
1273
|
-
return { aWidth: r, lsBearing: h };
|
|
1274
|
-
} }, wt = { cmap: de, head: ge, hhea: pe, maxp: { parseTab(n, t, e) {
|
|
1275
|
-
const i = L;
|
|
1276
|
-
return i.readUint(n, t), t += 4, { numGlyphs: i.readUshort(n, t) };
|
|
1277
|
-
} }, hmtx: me, loca: { parseTab(n, t, e, i) {
|
|
1278
|
-
const s = L, r = [], h = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
|
|
1279
|
-
if (h === 0) for (let c = 0; c < o; c++) r.push(s.readUshort(n, t + (c << 1)) << 1);
|
|
1280
|
-
else if (h === 1) for (let c = 0; c < o; c++) r.push(s.readUint(n, t + (c << 2)));
|
|
1281
|
-
return r;
|
|
1282
|
-
} }, glyf: { parseTab(n, t, e, i) {
|
|
1283
|
-
const s = [], r = i.maxp.numGlyphs;
|
|
1284
|
-
for (let h = 0; h < r; h++) s.push(null);
|
|
1285
|
-
return s;
|
|
1286
|
-
}, xe(n, t) {
|
|
1287
|
-
const e = L, i = n.Ae, s = n.loca;
|
|
1288
|
-
if (s[t] === s[t + 1]) return null;
|
|
1289
|
-
const r = G.findTable(i, "glyf", n.Fe);
|
|
1290
|
-
if (!r) return null;
|
|
1291
|
-
let h = r[0] + s[t];
|
|
1292
|
-
const o = {};
|
|
1293
|
-
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;
|
|
1294
|
-
if (o.noc > 0) {
|
|
1295
|
-
o.endPts = [];
|
|
1296
|
-
for (let g = 0; g < o.noc; g++) o.endPts.push(e.readUshort(i, h)), h += 2;
|
|
1297
|
-
const c = e.readUshort(i, h);
|
|
1298
|
-
if (h += 2, i.length - h < c) return null;
|
|
1299
|
-
h += c;
|
|
1300
|
-
const l = o.endPts[o.noc - 1] + 1;
|
|
1301
|
-
o.flags = [];
|
|
1302
|
-
for (let g = 0; g < l; g++) {
|
|
1303
|
-
const p = i[h];
|
|
1304
|
-
if (h++, o.flags.push(p), 8 & p) {
|
|
1305
|
-
const m = i[h];
|
|
1306
|
-
h++;
|
|
1307
|
-
for (let d = 0; d < m; d++) o.flags.push(p), g++;
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
o.xs = [];
|
|
1311
|
-
for (let g = 0; g < l; g++) {
|
|
1312
|
-
const p = o.flags[g], m = !!(16 & p);
|
|
1313
|
-
2 & p ? (o.xs.push(m ? i[h] : -i[h]), h++) : m ? o.xs.push(0) : (o.xs.push(e.readShort(i, h)), h += 2);
|
|
1314
|
-
}
|
|
1315
|
-
o.ys = [];
|
|
1316
|
-
for (let g = 0; g < l; g++) {
|
|
1317
|
-
const p = o.flags[g], m = !!(32 & p);
|
|
1318
|
-
4 & p ? (o.ys.push(m ? i[h] : -i[h]), h++) : m ? o.ys.push(0) : (o.ys.push(e.readShort(i, h)), h += 2);
|
|
1319
|
-
}
|
|
1320
|
-
let u = 0, f = 0;
|
|
1321
|
-
for (let g = 0; g < l; g++) u += o.xs[g], f += o.ys[g], o.xs[g] = u, o.ys[g] = f;
|
|
1322
|
-
} else o.parts = [], o.endPts = [], o.flags = [], o.xs = [], o.ys = [];
|
|
1323
|
-
return o;
|
|
1324
|
-
} } }, G = { parse(n) {
|
|
1325
|
-
const t = new Uint8Array(n);
|
|
1326
|
-
L.readASCII(t, 0, 4) === "wOFF" && (n = fe(n));
|
|
1327
|
-
const e = new Uint8Array(n), i = wt, s = {}, r = { Ae: e, Te: 0, Fe: 0 };
|
|
1328
|
-
for (const h in i) {
|
|
1329
|
-
const o = h, c = G.findTable(e, o, 0);
|
|
1330
|
-
if (c) {
|
|
1331
|
-
const [l, u] = c;
|
|
1332
|
-
let f = s[l];
|
|
1333
|
-
f == null && (f = i[o].parseTab(e, l, u, r), s[l] = f), r[o] = f;
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
return [r];
|
|
1337
|
-
}, findTable(n, t, e) {
|
|
1338
|
-
const i = L, s = i.readUshort(n, e + 4);
|
|
1339
|
-
let r = e + 12;
|
|
1340
|
-
for (let h = 0; h < s; h++) {
|
|
1341
|
-
const o = i.readASCII(n, r, 4);
|
|
1342
|
-
i.readUint(n, r + 4);
|
|
1343
|
-
const c = i.readUint(n, r + 8), l = i.readUint(n, r + 12);
|
|
1344
|
-
if (o === t) return [c, l];
|
|
1345
|
-
r += 16;
|
|
1346
|
-
}
|
|
1347
|
-
return null;
|
|
1348
|
-
}, T: wt, B: L };
|
|
1349
|
-
class ve {
|
|
1350
|
-
Re(t) {
|
|
1351
|
-
var i;
|
|
1352
|
-
const e = [];
|
|
1353
|
-
return (i = t.cmap) != null && i.tables ? (t.cmap.tables.forEach((s) => {
|
|
1354
|
-
if (s.format === 4) {
|
|
1355
|
-
const r = this.Ee(s);
|
|
1356
|
-
e.push(...r);
|
|
1357
|
-
} else if (s.format === 12) {
|
|
1358
|
-
const r = this.Se(s);
|
|
1359
|
-
e.push(...r);
|
|
1360
|
-
}
|
|
1361
|
-
}), [...new Set(e)]) : [];
|
|
1362
|
-
}
|
|
1363
|
-
Ee(t) {
|
|
1364
|
-
const e = [];
|
|
1365
|
-
if (!(t.startCount && t.endCount && t.idRangeOffset && t.idDelta)) return e;
|
|
1366
|
-
for (let i = 0; i < t.startCount.length; i++) {
|
|
1367
|
-
const s = t.startCount[i], r = t.endCount[i];
|
|
1368
|
-
if (s !== 65535 || r !== 65535) {
|
|
1369
|
-
for (let h = s; h <= r; h++)
|
|
1370
|
-
if (this.ke(t, h, i) > 0) try {
|
|
1371
|
-
const o = String.fromCodePoint(h);
|
|
1372
|
-
e.push(o);
|
|
1373
|
-
} catch {
|
|
1374
|
-
}
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
return e;
|
|
1378
|
-
}
|
|
1379
|
-
Se(t) {
|
|
1380
|
-
const e = [];
|
|
1381
|
-
if (!t.groups) return e;
|
|
1382
|
-
for (let i = 0; i < t.groups.length; i += 3) {
|
|
1383
|
-
const s = t.groups[i], r = t.groups[i + 1], h = t.groups[i + 2];
|
|
1384
|
-
for (let o = s; o <= r; o++)
|
|
1385
|
-
if (h + (o - s) > 0) try {
|
|
1386
|
-
const c = String.fromCodePoint(o);
|
|
1387
|
-
e.push(c);
|
|
1388
|
-
} catch {
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
return e;
|
|
1392
|
-
}
|
|
1393
|
-
ke(t, e, i) {
|
|
1394
|
-
if (t.idRangeOffset[i] === 0) return e + t.idDelta[i] & 65535;
|
|
1395
|
-
{
|
|
1396
|
-
const s = t.idRangeOffset[i] / 2 + (e - t.startCount[i]) - (t.startCount.length - i);
|
|
1397
|
-
if (s >= 0 && t.glyphIdArray && s < t.glyphIdArray.length) {
|
|
1398
|
-
const r = t.glyphIdArray[s];
|
|
1399
|
-
if (r !== 0) return r + t.idDelta[i] & 65535;
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
return 0;
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
class pt {
|
|
1406
|
-
constructor() {
|
|
1407
|
-
a(this, "Pe", /* @__PURE__ */ new Map());
|
|
1408
|
-
a(this, "Le", /* @__PURE__ */ new Map());
|
|
1409
|
-
}
|
|
1410
|
-
Ie(t, e) {
|
|
1411
|
-
const i = `${this.ze(t)}_${e}`;
|
|
1412
|
-
if (this.Pe.has(i)) return this.Pe.get(i);
|
|
1413
|
-
const s = t.cmap;
|
|
1414
|
-
if (!s || !s.tables) return this.Pe.set(i, 0), 0;
|
|
1415
|
-
let r = 0;
|
|
1416
|
-
for (const h of s.tables) if (h.format === 4 ? r = this.De(e, h) : h.format === 12 && (r = this.Oe(e, h)), r > 0) break;
|
|
1417
|
-
return this.Pe.set(i, r), r;
|
|
1418
|
-
}
|
|
1419
|
-
Be(t, e) {
|
|
1420
|
-
const i = e.codePointAt(0);
|
|
1421
|
-
return i === void 0 ? 0 : this.Ie(t, i);
|
|
1422
|
-
}
|
|
1423
|
-
Ge(t, e) {
|
|
1424
|
-
const i = t.hmtx;
|
|
1425
|
-
return i && i.aWidth && i.aWidth.length !== 0 ? e < i.aWidth.length ? i.aWidth[e] : i.aWidth[i.aWidth.length - 1] : 0;
|
|
1426
|
-
}
|
|
1427
|
-
We(t, e) {
|
|
1428
|
-
const i = e / t.head.unitsPerEm, s = t.hhea.ascender * i, r = t.hhea.descender * i, h = t.hhea.lineGap * i;
|
|
1429
|
-
return { ascender: s, descender: r, lineGap: h, lineHeight: s - r + h, unitsPerEm: t.head.unitsPerEm, scale: i };
|
|
1430
|
-
}
|
|
1431
|
-
He() {
|
|
1432
|
-
this.Pe.clear(), this.Le.clear();
|
|
1433
|
-
}
|
|
1434
|
-
ze(t) {
|
|
1435
|
-
return `${t.Fe}_${t.Ae.length}`;
|
|
1436
|
-
}
|
|
1437
|
-
De(t, e) {
|
|
1438
|
-
const i = e.endCount.length;
|
|
1439
|
-
let s = -1;
|
|
1440
|
-
for (let r = 0; r < i; r++) if (t <= e.endCount[r]) {
|
|
1441
|
-
s = r;
|
|
1442
|
-
break;
|
|
1443
|
-
}
|
|
1444
|
-
if (s === -1 || t < e.startCount[s]) return 0;
|
|
1445
|
-
if (e.idRangeOffset[s] === 0) return t + e.idDelta[s] & 65535;
|
|
1446
|
-
{
|
|
1447
|
-
const r = e.idRangeOffset[s] / 2 + (t - e.startCount[s]) - (i - s);
|
|
1448
|
-
if (r >= 0 && r < e.glyphIdArray.length) {
|
|
1449
|
-
const h = e.glyphIdArray[r];
|
|
1450
|
-
return h === 0 ? 0 : h + e.idDelta[s] & 65535;
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
return 0;
|
|
1454
|
-
}
|
|
1455
|
-
Oe(t, e) {
|
|
1456
|
-
const i = e.groups.length / 3;
|
|
1457
|
-
for (let s = 0; s < i; s++) {
|
|
1458
|
-
const r = e.groups[3 * s], h = e.groups[3 * s + 1], o = e.groups[3 * s + 2];
|
|
1459
|
-
if (t >= r && t <= h) return o + (t - r);
|
|
1460
|
-
}
|
|
1461
|
-
return 0;
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
class ye {
|
|
1465
|
-
constructor(t) {
|
|
1466
|
-
a(this, "Ke");
|
|
1467
|
-
a(this, "Ye");
|
|
1468
|
-
a(this, "N");
|
|
1469
|
-
a(this, "je");
|
|
1470
|
-
this.N = t, this.je = new pt(), this.Ke = document.createElement("canvas"), this.Ye = this.Ke.getContext("2d", { willReadFrequently: !0, alpha: !0 });
|
|
1471
|
-
}
|
|
1472
|
-
Ne(t, e, i, s) {
|
|
1473
|
-
const r = t.length, h = Math.ceil(Math.sqrt(r)), o = Math.ceil(r / h), c = e.width * h, l = e.height * o;
|
|
1474
|
-
this.Xe(c, l), this.Ze(t, e, h, i, s);
|
|
1475
|
-
const u = this.N.$e(c, l, 1, { filter: "nearest" });
|
|
1476
|
-
return u.st(this.Ke), { framebuffer: u, columns: h, rows: o };
|
|
1477
|
-
}
|
|
1478
|
-
Xe(t, e) {
|
|
1479
|
-
this.Ke.width = t, this.Ke.height = e, this.Ke.style.width = t + "px", this.Ke.style.height = e + "px", this.Ye.imageSmoothingEnabled = !1, this.Ke.style.imageRendering = "pixelated", this.Ye.clearRect(0, 0, t, e), this.Ye.textBaseline = "top", this.Ye.textAlign = "left", this.Ye.fillStyle = "white";
|
|
1480
|
-
}
|
|
1481
|
-
Ze(t, e, i, s, r) {
|
|
1482
|
-
const h = s / r.head.unitsPerEm;
|
|
1483
|
-
for (let o = 0; o < t.length; o++) {
|
|
1484
|
-
const c = o % i, l = Math.floor(o / i), u = t[o].character, f = this.Ve(r, u);
|
|
1485
|
-
if (!f) continue;
|
|
1486
|
-
const g = u.codePointAt(0) || 0, p = this.je.Ie(r, g), m = this.je.Ge(r, p) * h, d = c * e.width, y = l * e.height, v = d + 0.5 * e.width, w = y + 0.5 * e.height, E = Math.round(v - 0.5 * e.width), R = Math.round(w - 0.5 * s), T = E + 0.5 * (e.width - m), A = R + r.hhea.ascender * h;
|
|
1487
|
-
this.qe(f, T, A, h);
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
Ve(t, e) {
|
|
1491
|
-
const i = e.codePointAt(0) || 0, s = this.je.Ie(t, i);
|
|
1492
|
-
return s === 0 ? null : G.T.glyf.xe(t, s);
|
|
1493
|
-
}
|
|
1494
|
-
qe(t, e, i, s) {
|
|
1495
|
-
if (!t || !t.xs || t.noc === 0) return;
|
|
1496
|
-
let { xs: r, ys: h, endPts: o, flags: c } = t;
|
|
1497
|
-
if (!(r && h && o && c)) return;
|
|
1498
|
-
this.Ye.beginPath();
|
|
1499
|
-
let l = 0;
|
|
1500
|
-
for (let u = 0; u < o.length; u++) {
|
|
1501
|
-
const f = o[u];
|
|
1502
|
-
if (!(f < l)) {
|
|
1503
|
-
if (f >= l) {
|
|
1504
|
-
const g = e + r[l] * s, p = i - h[l] * s;
|
|
1505
|
-
this.Ye.moveTo(g, p);
|
|
1506
|
-
let m = l + 1;
|
|
1507
|
-
for (; m <= f; )
|
|
1508
|
-
if (1 & c[m]) {
|
|
1509
|
-
const d = e + r[m] * s, y = i - h[m] * s;
|
|
1510
|
-
this.Ye.lineTo(d, y), m++;
|
|
1511
|
-
} else {
|
|
1512
|
-
const d = e + r[m] * s, y = i - h[m] * s;
|
|
1513
|
-
if (m + 1 > f) {
|
|
1514
|
-
const w = e + r[l] * s, E = i - h[l] * s;
|
|
1515
|
-
if (1 & c[l]) this.Ye.quadraticCurveTo(d, y, w, E);
|
|
1516
|
-
else {
|
|
1517
|
-
const R = (d + w) / 2, T = (y + E) / 2;
|
|
1518
|
-
this.Ye.quadraticCurveTo(d, y, R, T);
|
|
1519
|
-
}
|
|
1520
|
-
break;
|
|
1521
|
-
}
|
|
1522
|
-
const v = m + 1;
|
|
1523
|
-
if (1 & c[v]) {
|
|
1524
|
-
const w = e + r[v] * s, E = i - h[v] * s;
|
|
1525
|
-
this.Ye.quadraticCurveTo(d, y, w, E), m = v + 1;
|
|
1526
|
-
} else {
|
|
1527
|
-
const w = (d + (e + r[v] * s)) / 2, E = (y + (i - h[v] * s)) / 2;
|
|
1528
|
-
this.Ye.quadraticCurveTo(d, y, w, E), m = v;
|
|
1529
|
-
}
|
|
1530
|
-
}
|
|
1531
|
-
this.Ye.closePath();
|
|
1532
|
-
}
|
|
1533
|
-
l = f + 1;
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
this.Ye.fill();
|
|
1537
|
-
}
|
|
1538
|
-
}
|
|
1539
|
-
class Ee {
|
|
1540
|
-
constructor() {
|
|
1541
|
-
a(this, "Je");
|
|
1542
|
-
this.Je = new pt();
|
|
1543
|
-
}
|
|
1544
|
-
Qe(t, e, i) {
|
|
1545
|
-
let s = 0;
|
|
1546
|
-
const r = this.Je.We(i, e), h = r.lineHeight;
|
|
1547
|
-
for (const o of t) {
|
|
1548
|
-
const c = this.Je.Be(i, o);
|
|
1549
|
-
if (c === 0) continue;
|
|
1550
|
-
const l = this.Je.Ge(i, c) * r.scale;
|
|
1551
|
-
s = Math.max(s, l);
|
|
1552
|
-
}
|
|
1553
|
-
return { width: Math.ceil(s), height: Math.ceil(h) };
|
|
1554
|
-
}
|
|
1555
|
-
He() {
|
|
1556
|
-
this.Je.He();
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
class we {
|
|
1560
|
-
constructor() {
|
|
1561
|
-
a(this, "je");
|
|
1562
|
-
this.je = new pt();
|
|
1563
|
-
}
|
|
1564
|
-
createCharacterObjects(t, e) {
|
|
1565
|
-
return t.map((i, s) => {
|
|
1566
|
-
const r = i.codePointAt(0) || 0, h = this.tr(s);
|
|
1567
|
-
let o = 0;
|
|
1568
|
-
if (e.hmtx && e.hmtx.aWidth) {
|
|
1569
|
-
const c = this.je.Ie(e, r);
|
|
1570
|
-
c > 0 && e.hmtx.aWidth[c] !== void 0 && (o = e.hmtx.aWidth[c]);
|
|
1571
|
-
}
|
|
1572
|
-
return { character: i, unicode: r, color: h, advanceWidth: o };
|
|
1573
|
-
});
|
|
1574
|
-
}
|
|
1575
|
-
tr(t) {
|
|
1576
|
-
return [t % 256 / 255, Math.floor(t / 256) % 256 / 255, 0];
|
|
1577
|
-
}
|
|
1578
|
-
sr(t, e) {
|
|
1579
|
-
if (!V.v(typeof t == "string", "Character must be a string.", { method: "getCharacterColor", providedValue: t })) return [0, 0, 0];
|
|
1580
|
-
const i = e.find((s) => s.character === t);
|
|
1581
|
-
return i ? i.color : [0, 0, 0];
|
|
1582
|
-
}
|
|
1583
|
-
ir(t, e) {
|
|
1584
|
-
return V.v(typeof t == "string" && t.length > 0, "Characters must be a string with at least one character.", { method: "getCharacterColors", providedValue: t }) ? Array.from(t).map((i) => this.sr(i, e) || [0, 0, 0]) : [[0, 0, 0]];
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
class mt {
|
|
1588
|
-
constructor(t, e = 16) {
|
|
1589
|
-
a(this, "er");
|
|
1590
|
-
a(this, "rr", []);
|
|
1591
|
-
a(this, "nr");
|
|
1592
|
-
a(this, "hr", 16);
|
|
1593
|
-
a(this, "ar", 0);
|
|
1594
|
-
a(this, "cr", 0);
|
|
1595
|
-
a(this, "lr", { width: 0, height: 0 });
|
|
1596
|
-
a(this, "ur");
|
|
1597
|
-
a(this, "dr", /* @__PURE__ */ new Map());
|
|
1598
|
-
a(this, "pr");
|
|
1599
|
-
a(this, "_r");
|
|
1600
|
-
a(this, "gr");
|
|
1601
|
-
a(this, "vr");
|
|
1602
|
-
this.hr = e, this.pr = new ve(), this._r = new ye(t), this.gr = new Ee(), this.vr = new we();
|
|
1603
|
-
}
|
|
1604
|
-
async mr(t) {
|
|
1605
|
-
let e;
|
|
1606
|
-
if (!t) throw new M("Embedded font not available. This appears to be a minified build - please provide `fontSource` or use the non-minified version.");
|
|
1607
|
-
{
|
|
1608
|
-
const i = await fetch(t);
|
|
1609
|
-
if (!i.ok) throw new M(`Failed to load font file: ${i.status} ${i.statusText}`);
|
|
1610
|
-
e = await i.arrayBuffer();
|
|
1611
|
-
}
|
|
1612
|
-
await this.yr(e), this.er = G.parse(e)[0], await this.wr();
|
|
1613
|
-
}
|
|
1614
|
-
br(t) {
|
|
1615
|
-
if (t === void 0) return this.hr;
|
|
1616
|
-
this.hr = t, this.lr = this.gr.Qe(this.rr.map((i) => i.character), this.hr, this.er);
|
|
1617
|
-
const e = this._r.Ne(this.rr, this.lr, this.hr, this.er);
|
|
1618
|
-
this.nr = e.framebuffer, this.ar = e.columns, this.cr = e.rows;
|
|
1619
|
-
}
|
|
1620
|
-
async $r(t) {
|
|
1621
|
-
try {
|
|
1622
|
-
const e = await fetch(t);
|
|
1623
|
-
if (!e.ok) throw new M(`Failed to load font file: ${e.status} ${e.statusText}`);
|
|
1624
|
-
const i = await e.arrayBuffer();
|
|
1625
|
-
await this.yr(i);
|
|
1626
|
-
const s = G.parse(i);
|
|
1627
|
-
if (!s || s.length === 0) throw Error("Failed to parse font file");
|
|
1628
|
-
this.er = s[0], await this.wr();
|
|
1629
|
-
} catch (e) {
|
|
1630
|
-
throw new M("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
async yr(t) {
|
|
1634
|
-
const e = Date.now();
|
|
1635
|
-
this.ur = new FontFace("CustomFont_" + e, t), await this.ur.load(), document.fonts.add(this.ur);
|
|
1636
|
-
}
|
|
1637
|
-
async wr() {
|
|
1638
|
-
const t = this.pr.Re(this.er);
|
|
1639
|
-
this.dr.clear(), this.rr = this.vr.createCharacterObjects(t, this.er), this.lr = this.gr.Qe(t, this.hr, this.er);
|
|
1640
|
-
const e = this._r.Ne(this.rr, this.lr, this.hr, this.er);
|
|
1641
|
-
this.nr = e.framebuffer, this.ar = e.columns, this.cr = e.rows;
|
|
1642
|
-
}
|
|
1643
|
-
sr(t) {
|
|
1644
|
-
return this.vr.sr(t, this.rr);
|
|
1645
|
-
}
|
|
1646
|
-
ir(t) {
|
|
1647
|
-
return this.vr.ir(t, this.rr);
|
|
1648
|
-
}
|
|
1649
|
-
getGlyphData(t) {
|
|
1650
|
-
if (!Number.isFinite(t)) return null;
|
|
1651
|
-
const e = this.dr.get(t);
|
|
1652
|
-
if (e !== void 0) return e;
|
|
1653
|
-
const i = this.Cr(t);
|
|
1654
|
-
if (i < 0) return this.dr.set(t, null), null;
|
|
1655
|
-
const s = this.er.glyf;
|
|
1656
|
-
if (!s) return this.dr.set(t, null), null;
|
|
1657
|
-
let r = s[i] ?? null;
|
|
1658
|
-
return r == null && (r = G.T.glyf.xe(this.er, i) ?? null, s[i] = r), this.dr.set(t, r), r;
|
|
1659
|
-
}
|
|
1660
|
-
Cr(t) {
|
|
1661
|
-
const e = this.er.cmap;
|
|
1662
|
-
for (const i of e.tables) if (i.format === 4) {
|
|
1663
|
-
const s = i;
|
|
1664
|
-
for (let r = 0; r < s.startCount.length; r++) if (t >= s.startCount[r] && t <= s.endCount[r]) {
|
|
1665
|
-
if (s.idRangeOffset[r] === 0) return t + s.idDelta[r] & 65535;
|
|
1666
|
-
{
|
|
1667
|
-
const h = s.idRangeOffset[r] / 2 + (t - s.startCount[r]) - (s.startCount.length - r);
|
|
1668
|
-
if (h >= 0 && h < s.glyphIdArray.length) {
|
|
1669
|
-
const o = s.glyphIdArray[h];
|
|
1670
|
-
if (o !== 0) return o + s.idDelta[r] & 65535;
|
|
1671
|
-
}
|
|
1672
|
-
}
|
|
1673
|
-
}
|
|
1674
|
-
} else if (i.format === 12) {
|
|
1675
|
-
const s = i;
|
|
1676
|
-
for (let r = 0; r < s.groups.length; r += 3) {
|
|
1677
|
-
const h = s.groups[r], o = s.groups[r + 1], c = s.groups[r + 2];
|
|
1678
|
-
if (t >= h && t <= o) return c + (t - h);
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1681
|
-
return 0;
|
|
1682
|
-
}
|
|
1683
|
-
O() {
|
|
1684
|
-
this.nr.O(), document.fonts.delete(this.ur);
|
|
1685
|
-
}
|
|
1686
|
-
get fontFramebuffer() {
|
|
1687
|
-
return this.nr;
|
|
1688
|
-
}
|
|
1689
|
-
get characters() {
|
|
1690
|
-
return this.rr;
|
|
1691
|
-
}
|
|
1692
|
-
get textureColumns() {
|
|
1693
|
-
return this.ar;
|
|
1694
|
-
}
|
|
1695
|
-
get textureRows() {
|
|
1696
|
-
return this.cr;
|
|
1697
|
-
}
|
|
1698
|
-
get maxGlyphDimensions() {
|
|
1699
|
-
return this.lr;
|
|
1700
|
-
}
|
|
1701
|
-
get fontSize() {
|
|
1702
|
-
return this.hr;
|
|
1703
|
-
}
|
|
1704
|
-
get font() {
|
|
1705
|
-
return this.er;
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
class Ft {
|
|
1709
|
-
constructor(t, e, i) {
|
|
1710
|
-
a(this, "Mr");
|
|
1711
|
-
a(this, "Ar");
|
|
1712
|
-
a(this, "G");
|
|
1713
|
-
a(this, "W");
|
|
1714
|
-
a(this, "Fr");
|
|
1715
|
-
a(this, "Tr");
|
|
1716
|
-
a(this, "Rr");
|
|
1717
|
-
a(this, "Er");
|
|
1718
|
-
a(this, "Sr");
|
|
1719
|
-
this.Rr = t, this.Er = e, this.Sr = i, this.qs();
|
|
1720
|
-
}
|
|
1721
|
-
qs() {
|
|
1722
|
-
this.Mr = Math.floor(this.Rr.width / this.Er), this.Ar = Math.floor(this.Rr.height / this.Sr), this.G = this.Mr * this.Er, this.W = this.Ar * this.Sr, this.Fr = Math.floor((this.Rr.width - this.G) / 2), this.Tr = Math.floor((this.Rr.height - this.W) / 2);
|
|
1723
|
-
}
|
|
1724
|
-
kr(t, e) {
|
|
1725
|
-
this.Er = t, this.Sr = e, this.qs();
|
|
1726
|
-
}
|
|
1727
|
-
get cellWidth() {
|
|
1728
|
-
return this.Er;
|
|
1729
|
-
}
|
|
1730
|
-
get cellHeight() {
|
|
1731
|
-
return this.Sr;
|
|
1732
|
-
}
|
|
1733
|
-
get cols() {
|
|
1734
|
-
return this.Mr;
|
|
1735
|
-
}
|
|
1736
|
-
get rows() {
|
|
1737
|
-
return this.Ar;
|
|
1738
|
-
}
|
|
1739
|
-
get width() {
|
|
1740
|
-
return this.G;
|
|
1741
|
-
}
|
|
1742
|
-
get height() {
|
|
1743
|
-
return this.W;
|
|
1744
|
-
}
|
|
1745
|
-
get offsetX() {
|
|
1746
|
-
return this.Fr;
|
|
1747
|
-
}
|
|
1748
|
-
get offsetY() {
|
|
1749
|
-
return this.Tr;
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
const Te = /^#([0-9a-f]{3,8})$/i, Re = /^rgba?\(([^)]+)\)$/i;
|
|
1753
|
-
function lt(n) {
|
|
1754
|
-
return Number.isNaN(n) ? 0 : Math.max(0, Math.min(255, n));
|
|
1755
|
-
}
|
|
1756
|
-
function be(n) {
|
|
1757
|
-
if (!n) return null;
|
|
1758
|
-
const t = n.trim().toLowerCase();
|
|
1759
|
-
if (!t || t === "transparent") return null;
|
|
1760
|
-
let e = null;
|
|
1761
|
-
return t.startsWith("#") ? e = function(i) {
|
|
1762
|
-
const s = Te.exec(i.trim());
|
|
1763
|
-
if (!s) return null;
|
|
1764
|
-
const r = s[1];
|
|
1765
|
-
return r.length === 3 ? [parseInt(r[0] + r[0], 16), parseInt(r[1] + r[1], 16), parseInt(r[2] + r[2], 16), 255] : r.length === 4 ? [parseInt(r[0] + r[0], 16), parseInt(r[1] + r[1], 16), parseInt(r[2] + r[2], 16), parseInt(r[3] + r[3], 16)] : r.length === 6 || r.length === 8 ? [parseInt(r.slice(0, 2), 16), parseInt(r.slice(2, 4), 16), parseInt(r.slice(4, 6), 16), r.length === 8 ? parseInt(r.slice(6, 8), 16) : 255] : null;
|
|
1766
|
-
}(t) : t.startsWith("rgb") && (e = function(i) {
|
|
1767
|
-
const s = Re.exec(i.trim());
|
|
1768
|
-
if (!s) return null;
|
|
1769
|
-
const r = s[1].split(",").map((u) => u.trim());
|
|
1770
|
-
if (r.length < 3) return null;
|
|
1771
|
-
const h = lt(parseFloat(r[0])), o = lt(parseFloat(r[1])), c = lt(parseFloat(r[2])), l = r[3] !== void 0 ? 255 * Math.max(0, Math.min(1, parseFloat(r[3]))) : 255;
|
|
1772
|
-
return [h, o, c, Math.round(l)];
|
|
1773
|
-
}(t)), e ? e[3] === 0 ? null : e : null;
|
|
1774
|
-
}
|
|
1775
|
-
class Ae {
|
|
1776
|
-
constructor(t = {}) {
|
|
1777
|
-
a(this, "Rr");
|
|
1778
|
-
a(this, "Pr", null);
|
|
1779
|
-
a(this, "Lr", !1);
|
|
1780
|
-
a(this, "Ir");
|
|
1781
|
-
this.Lr = t.overlay ?? !1, this.Lr && t.canvas ? (this.Pr = t.canvas, this.Rr = this.zr(), this.Ir = !0, this.Dr()) : t.canvas ? (this.Rr = t.canvas, this.Ir = !1) : (this.Rr = this.Or(t.width, t.height), this.Ir = !0), this.Rr.style.imageRendering = "pixelated";
|
|
1782
|
-
}
|
|
1783
|
-
Or(t, e) {
|
|
1784
|
-
const i = document.createElement("canvas");
|
|
1785
|
-
return i.className = "textmodeCanvas", i.style.imageRendering = "pixelated", i.width = t || 800, i.height = e || 600, document.body.appendChild(i), i;
|
|
1786
|
-
}
|
|
1787
|
-
zr() {
|
|
1788
|
-
const t = document.createElement("canvas");
|
|
1789
|
-
t.className = "textmodeCanvas", t.style.imageRendering = "pixelated";
|
|
1790
|
-
const e = this.Pr.getBoundingClientRect();
|
|
1791
|
-
let i = Math.round(e.width), s = Math.round(e.height);
|
|
1792
|
-
if (this.Pr instanceof HTMLVideoElement) {
|
|
1793
|
-
const o = this.Pr;
|
|
1794
|
-
(i === 0 || s === 0) && o.videoWidth > 0 && o.videoHeight > 0 && (i = o.videoWidth, s = o.videoHeight);
|
|
1795
|
-
}
|
|
1796
|
-
t.width = i, t.height = s, t.style.position = "absolute", t.style.pointerEvents = "none";
|
|
1797
|
-
const r = window.getComputedStyle(this.Pr);
|
|
1798
|
-
let h = parseInt(r.zIndex || "0", 10);
|
|
1799
|
-
return isNaN(h) && (h = 0), t.style.zIndex = "" + (h + 1), t;
|
|
1800
|
-
}
|
|
1801
|
-
Dr() {
|
|
1802
|
-
var t;
|
|
1803
|
-
this.Br(), (t = this.Pr.parentNode) == null || t.insertBefore(this.Rr, this.Pr.nextSibling);
|
|
1804
|
-
}
|
|
1805
|
-
Gr() {
|
|
1806
|
-
const t = [];
|
|
1807
|
-
return this.Lr && this.Pr instanceof HTMLElement && (t.push(this.Pr), this.Pr.parentElement && t.push(this.Pr.parentElement)), this.Rr.parentElement && t.push(this.Rr.parentElement), t.push(this.Rr), t.push(document.body), t.push(document.documentElement), t;
|
|
1808
|
-
}
|
|
1809
|
-
Wr() {
|
|
1810
|
-
const t = this.Gr();
|
|
1811
|
-
for (const e of t) {
|
|
1812
|
-
if (!e) continue;
|
|
1813
|
-
const i = be(window.getComputedStyle(e).backgroundColor);
|
|
1814
|
-
if (i) return i;
|
|
1815
|
-
}
|
|
1816
|
-
return [255, 255, 255, 255];
|
|
1817
|
-
}
|
|
1818
|
-
Br() {
|
|
1819
|
-
if (!this.Pr) return;
|
|
1820
|
-
const t = this.Pr.getBoundingClientRect();
|
|
1821
|
-
let e = this.Pr.offsetParent;
|
|
1822
|
-
if (e && e !== document.body) {
|
|
1823
|
-
const i = e.getBoundingClientRect();
|
|
1824
|
-
this.Rr.style.top = t.top - i.top + "px", this.Rr.style.left = t.left - i.left + "px";
|
|
1825
|
-
} else this.Rr.style.top = t.top + window.scrollY + "px", this.Rr.style.left = t.left + window.scrollX + "px";
|
|
1826
|
-
}
|
|
1827
|
-
Hr(t, e) {
|
|
1828
|
-
if (this.Lr) {
|
|
1829
|
-
const i = this.Pr.getBoundingClientRect();
|
|
1830
|
-
this.Rr.width = Math.round(i.width), this.Rr.height = Math.round(i.height), this.Br();
|
|
1831
|
-
} else this.Rr.width = t ?? this.Rr.width, this.Rr.height = e ?? this.Rr.height;
|
|
1832
|
-
}
|
|
1833
|
-
Kr() {
|
|
1834
|
-
const t = this.Rr.getContext("webgl2", { alpha: !0, premultipliedAlpha: !1, preserveDrawingBuffer: !0, antialias: !1, depth: !0, stencil: !1, powerPreference: "high-performance" });
|
|
1835
|
-
if (!t) throw new M("`textmode.js` requires WebGL2 support.");
|
|
1836
|
-
return t;
|
|
1837
|
-
}
|
|
1838
|
-
O() {
|
|
1839
|
-
const t = this.Rr.getContext("webgl") || this.Rr.getContext("webgl2");
|
|
1840
|
-
if (t) {
|
|
1841
|
-
const e = t.getExtension("WEBGL_lose_context");
|
|
1842
|
-
e == null || e.loseContext();
|
|
1843
|
-
}
|
|
1844
|
-
this.Ir && this.Rr.parentNode && this.Rr.parentNode.removeChild(this.Rr);
|
|
1845
|
-
}
|
|
1846
|
-
get canvas() {
|
|
1847
|
-
return this.Rr;
|
|
1848
|
-
}
|
|
1849
|
-
get targetCanvas() {
|
|
1850
|
-
return this.Pr;
|
|
1851
|
-
}
|
|
1852
|
-
get width() {
|
|
1853
|
-
return this.Rr.width;
|
|
1854
|
-
}
|
|
1855
|
-
get height() {
|
|
1856
|
-
return this.Rr.height;
|
|
1857
|
-
}
|
|
1858
|
-
}
|
|
1859
|
-
const xe = /^#|0x/gi;
|
|
1860
|
-
function k(n) {
|
|
1861
|
-
return Number.isNaN(n) || !Number.isFinite(n) || n <= 0 ? 0 : n >= 255 ? 255 : Math.round(n);
|
|
1862
|
-
}
|
|
1863
|
-
function tt(n) {
|
|
1864
|
-
return k(parseInt(n, 16));
|
|
1865
|
-
}
|
|
1866
|
-
class C {
|
|
1867
|
-
constructor(t, e, i, s, r) {
|
|
1868
|
-
a(this, "Yr");
|
|
1869
|
-
a(this, "jr");
|
|
1870
|
-
a(this, "Gt");
|
|
1871
|
-
a(this, "r");
|
|
1872
|
-
a(this, "g");
|
|
1873
|
-
a(this, "b");
|
|
1874
|
-
a(this, "a");
|
|
1875
|
-
this.r = k(t), this.g = k(e), this.b = k(i), this.a = k(s), this.Yr = [this.r, this.g, this.b, this.a], this.jr = [this.r / 255, this.g / 255, this.b / 255, this.a / 255], this.Gt = r ? [...r] : void 0;
|
|
1876
|
-
}
|
|
1877
|
-
static Nr(t, e, i, s = 255) {
|
|
1878
|
-
return new C(t, e, i, s);
|
|
1879
|
-
}
|
|
1880
|
-
static Xr(t, e = 255) {
|
|
1881
|
-
return new C(t, t, t, e);
|
|
1882
|
-
}
|
|
1883
|
-
static Zr(t) {
|
|
1884
|
-
const [e, i, s, r] = function(h) {
|
|
1885
|
-
const o = h.replace(xe, ""), c = (l = o).length === 3 || l.length === 4 ? l.split("").map((u) => u + u).join("") : l;
|
|
1886
|
-
var l;
|
|
1887
|
-
if (c.length !== 6 && c.length !== 8) throw Error("Invalid hex color: " + h);
|
|
1888
|
-
return [tt(c.slice(0, 2)), tt(c.slice(2, 4)), tt(c.slice(4, 6)), c.length === 8 ? tt(c.slice(6, 8)) : 255];
|
|
1889
|
-
}(t);
|
|
1890
|
-
return new C(e, i, s, r);
|
|
1891
|
-
}
|
|
1892
|
-
static Vr(t) {
|
|
1893
|
-
const [e, i, s] = t;
|
|
1894
|
-
return new C(255 * e, 255 * i, 255 * s, 255, t);
|
|
1895
|
-
}
|
|
1896
|
-
get rgb() {
|
|
1897
|
-
return [this.r, this.g, this.b];
|
|
1898
|
-
}
|
|
1899
|
-
get rgba() {
|
|
1900
|
-
return [...this.Yr];
|
|
1901
|
-
}
|
|
1902
|
-
get normalized() {
|
|
1903
|
-
return [...this.jr];
|
|
1904
|
-
}
|
|
1905
|
-
get character() {
|
|
1906
|
-
return this.Gt ? [...this.Gt] : void 0;
|
|
1907
|
-
}
|
|
1908
|
-
static qr(t) {
|
|
1909
|
-
return t instanceof C;
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
|
-
const H = class H {
|
|
1913
|
-
constructor(t, e, i, s, r, h, o) {
|
|
1914
|
-
a(this, "$");
|
|
1915
|
-
a(this, "N");
|
|
1916
|
-
a(this, "Jr");
|
|
1917
|
-
a(this, "Qr");
|
|
1918
|
-
a(this, "tn");
|
|
1919
|
-
a(this, "G");
|
|
1920
|
-
a(this, "W");
|
|
1921
|
-
a(this, "X", null);
|
|
1922
|
-
a(this, "Ft", 0);
|
|
1923
|
-
a(this, "Ot", 0);
|
|
1924
|
-
a(this, "Bt", 0);
|
|
1925
|
-
a(this, "Tt", 0);
|
|
1926
|
-
a(this, "sn", "sampled");
|
|
1927
|
-
a(this, "en", "fixed");
|
|
1928
|
-
a(this, "Wt", [1, 1, 1, 1]);
|
|
1929
|
-
a(this, "Ht", [0, 0, 0, 1]);
|
|
1930
|
-
a(this, "rn", [0, 0, 0, 1]);
|
|
1931
|
-
a(this, "nn", [[0.1, 0, 0]]);
|
|
1932
|
-
a(this, "hn");
|
|
1933
|
-
this.$ = t, this.N = e, this.Jr = i, this.Qr = s, this.tn = r, this.G = h, this.W = o;
|
|
1934
|
-
}
|
|
1935
|
-
O() {
|
|
1936
|
-
this.$.deleteTexture(this.Jr);
|
|
1937
|
-
}
|
|
1938
|
-
invert(t = !0) {
|
|
1939
|
-
return this.Ft = t ? 1 : 0, this.X = null, this;
|
|
1940
|
-
}
|
|
1941
|
-
flipX(t = !0) {
|
|
1942
|
-
return this.Ot = t ? 1 : 0, this.X = null, this;
|
|
1943
|
-
}
|
|
1944
|
-
flipY(t = !0) {
|
|
1945
|
-
return this.Bt = t ? 1 : 0, this.X = null, this;
|
|
1946
|
-
}
|
|
1947
|
-
charRotation(t) {
|
|
1948
|
-
return this.Tt = Rt(t), this.X = null, this;
|
|
1949
|
-
}
|
|
1950
|
-
charColorMode(t) {
|
|
1951
|
-
return this.sn = t, this.X = null, this;
|
|
1952
|
-
}
|
|
1953
|
-
cellColorMode(t) {
|
|
1954
|
-
return this.en = t, this.X = null, this;
|
|
1955
|
-
}
|
|
1956
|
-
charColor(t, e, i, s) {
|
|
1957
|
-
return this.cn(this.Wt, t, e, i, s), this.X = null, this;
|
|
1958
|
-
}
|
|
1959
|
-
cellColor(t, e, i, s) {
|
|
1960
|
-
return this.cn(this.Ht, t, e, i, s), this.X = null, this;
|
|
1961
|
-
}
|
|
1962
|
-
background(t, e, i, s) {
|
|
1963
|
-
return this.cn(this.rn, t, e, i, s), this.X = null, this;
|
|
1964
|
-
}
|
|
1965
|
-
characters(t) {
|
|
1966
|
-
if (!this.hn) throw Error("Glyph color resolver not initialized");
|
|
1967
|
-
const e = this.hn(t).filter((i) => Array.isArray(i)).slice(0, 64);
|
|
1968
|
-
return this.nn = e, this.X = null, this;
|
|
1969
|
-
}
|
|
1970
|
-
get texture() {
|
|
1971
|
-
return this.Jr;
|
|
1972
|
-
}
|
|
1973
|
-
get width() {
|
|
1974
|
-
return this.G;
|
|
1975
|
-
}
|
|
1976
|
-
get height() {
|
|
1977
|
-
return this.W;
|
|
1978
|
-
}
|
|
1979
|
-
get originalWidth() {
|
|
1980
|
-
return this.Qr;
|
|
1981
|
-
}
|
|
1982
|
-
get originalHeight() {
|
|
1983
|
-
return this.tn;
|
|
1984
|
-
}
|
|
1985
|
-
ct() {
|
|
1986
|
-
return this.X || this.lt(), this.X;
|
|
1987
|
-
}
|
|
1988
|
-
ln() {
|
|
1989
|
-
}
|
|
1990
|
-
lt() {
|
|
1991
|
-
this.ln();
|
|
1992
|
-
const t = this.un(), e = this.fn();
|
|
1993
|
-
this.X = this.N.ft.Gi(t, e);
|
|
1994
|
-
}
|
|
1995
|
-
cn(t, e, i, s, r) {
|
|
1996
|
-
if (C.qr(e)) $(t, e.r, e.g, e.b, e.a);
|
|
1997
|
-
else {
|
|
1998
|
-
if (typeof e == "string") {
|
|
1999
|
-
const h = C.Zr(e);
|
|
2000
|
-
return void $(t, h.r, h.g, h.b, h.a);
|
|
2001
|
-
}
|
|
2002
|
-
$(t, e, i, s, r);
|
|
2003
|
-
}
|
|
2004
|
-
}
|
|
2005
|
-
un() {
|
|
2006
|
-
return H.an || (H.an = new Z(this.$, st, `#version 300 es
|
|
2007
|
-
precision highp float;in vec2 v_uv;uniform sampler2D Ug;uniform bool Uh;uniform bool Ui;uniform bool Uj;uniform float Uk;uniform bool Ul;uniform vec4 Um;uniform bool Un;uniform vec4 Uo;uniform vec4 Up;uniform int Uq;uniform vec3 Ur[64];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;float A(vec3 B){return dot(B,vec3(0.299f,0.587f,0.114f));}void main(){vec2 C=vec2(v_uv.x,1.0f-v_uv.y);vec4 D=texture(Ug,C);float E=A(D.rgb);vec2 F=vec2(0.);if(Uq>0){float G=float(Uq);float H=clamp(E*(G-1.0f),0.0f,G-1.0f);int I=int(floor(H+0.5f));vec3 J=Ur[I];F=J.xy;}else{F=vec2(E,0.0f);}vec4 K=Ul?Um:D;vec4 L=Un?Uo:D;if(D.a<0.01f){K=Up;L=Up;}else{}o_primaryColor=vec4(K.rgb,K.a);o_secondaryColor=vec4(L.rgb,L.a);int M=int(Uh?1:0);int N=int(Ui?1:0);int O=int(Uj?1:0);float P=float(M|(N<<1)|(O<<2))/255.;o_character=vec4(F,P,clamp(Uk,0.0f,1.0f));}`)), H.an;
|
|
2008
|
-
}
|
|
2009
|
-
fn() {
|
|
2010
|
-
return { Ug: this.dn(), Uh: !!this.Ft, Ui: !!this.Ot, Uj: !!this.Bt, Uk: this.Tt, Ul: this.sn === "fixed", Um: this.Wt, Un: this.en === "fixed", Uo: this.Ht, Up: this.rn, Uq: this.nn.length, Ur: this.nn };
|
|
2011
|
-
}
|
|
2012
|
-
};
|
|
2013
|
-
a(H, "an", null);
|
|
2014
|
-
let rt = H;
|
|
2015
|
-
class Y extends rt {
|
|
2016
|
-
constructor(t, e, i, s, r, h, o) {
|
|
2017
|
-
const c = Math.min(h / s, o / r);
|
|
2018
|
-
super(t, e, i, s, r, Math.max(1, Math.floor(s * c)), Math.max(1, Math.floor(r * c)));
|
|
2019
|
-
}
|
|
2020
|
-
static pn(t, e, i, s, r) {
|
|
2021
|
-
const h = t.context, o = h.createTexture();
|
|
2022
|
-
h.bindTexture(h.TEXTURE_2D, o), h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL, 1), et(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, e), h.bindTexture(h.TEXTURE_2D, null);
|
|
2023
|
-
const c = e.naturalWidth ?? e.width ?? e.videoWidth ?? 0, l = e.naturalHeight ?? e.height ?? e.videoHeight ?? 0, u = new Y(h, t, o, c, l, i, s);
|
|
2024
|
-
return u.hn = r, u;
|
|
2025
|
-
}
|
|
2026
|
-
dn() {
|
|
2027
|
-
return this.Jr;
|
|
2028
|
-
}
|
|
2029
|
-
}
|
|
2030
|
-
class Ut {
|
|
2031
|
-
constructor(t = 60) {
|
|
2032
|
-
a(this, "_n");
|
|
2033
|
-
a(this, "gn", null);
|
|
2034
|
-
a(this, "vn", 0);
|
|
2035
|
-
a(this, "mn", !0);
|
|
2036
|
-
a(this, "yn", 0);
|
|
2037
|
-
a(this, "wn", 0);
|
|
2038
|
-
a(this, "bn", []);
|
|
2039
|
-
a(this, "$n", 10);
|
|
2040
|
-
a(this, "Cn", 0);
|
|
2041
|
-
this._n = 1e3 / t;
|
|
2042
|
-
}
|
|
2043
|
-
Mn(t) {
|
|
2044
|
-
if (!this.mn) return;
|
|
2045
|
-
this.vn = performance.now();
|
|
2046
|
-
const e = (i) => {
|
|
2047
|
-
if (!this.mn) return void (this.gn = null);
|
|
2048
|
-
const s = i - this.vn;
|
|
2049
|
-
s >= this._n && (t(), this.vn = i - s % this._n), this.mn && (this.gn = requestAnimationFrame(e));
|
|
2050
|
-
};
|
|
2051
|
-
this.gn = requestAnimationFrame(e);
|
|
2052
|
-
}
|
|
2053
|
-
xn() {
|
|
2054
|
-
this.gn && (cancelAnimationFrame(this.gn), this.gn = null);
|
|
2055
|
-
}
|
|
2056
|
-
An() {
|
|
2057
|
-
this.mn && (this.mn = !1, this.xn());
|
|
2058
|
-
}
|
|
2059
|
-
Fn(t) {
|
|
2060
|
-
this.mn || (this.mn = !0, this.Mn(t));
|
|
2061
|
-
}
|
|
2062
|
-
Tn(t, e) {
|
|
2063
|
-
if (t === void 0) return this.yn;
|
|
2064
|
-
this._n = 1e3 / t, this.mn && e && (this.xn(), this.Mn(e));
|
|
2065
|
-
}
|
|
2066
|
-
Rn() {
|
|
2067
|
-
const t = performance.now();
|
|
2068
|
-
if (this.wn > 0) {
|
|
2069
|
-
const e = t - this.wn;
|
|
2070
|
-
this.bn.push(e), this.bn.length > this.$n && this.bn.shift();
|
|
2071
|
-
const i = this.bn.reduce((s, r) => s + r, 0) / this.bn.length;
|
|
2072
|
-
this.yn = 1e3 / i;
|
|
2073
|
-
}
|
|
2074
|
-
this.wn = t;
|
|
2075
|
-
}
|
|
2076
|
-
get En() {
|
|
2077
|
-
return this.mn;
|
|
2078
|
-
}
|
|
2079
|
-
get Sn() {
|
|
2080
|
-
return this.yn;
|
|
2081
|
-
}
|
|
2082
|
-
get kn() {
|
|
2083
|
-
return this.Cn;
|
|
2084
|
-
}
|
|
2085
|
-
set kn(t) {
|
|
2086
|
-
this.Cn = t;
|
|
2087
|
-
}
|
|
2088
|
-
Pn() {
|
|
2089
|
-
this.Cn++;
|
|
2090
|
-
}
|
|
2091
|
-
}
|
|
2092
|
-
class Mt {
|
|
2093
|
-
constructor(t) {
|
|
2094
|
-
a(this, "Rr");
|
|
2095
|
-
a(this, "Ln");
|
|
2096
|
-
a(this, "In", { x: -1, y: -1 });
|
|
2097
|
-
a(this, "zn", { x: -1, y: -1 });
|
|
2098
|
-
a(this, "Dn", null);
|
|
2099
|
-
a(this, "On", 0);
|
|
2100
|
-
a(this, "Bn");
|
|
2101
|
-
a(this, "Gn");
|
|
2102
|
-
a(this, "Wn");
|
|
2103
|
-
a(this, "Hn");
|
|
2104
|
-
a(this, "Kn");
|
|
2105
|
-
a(this, "Yn");
|
|
2106
|
-
a(this, "jn", !1);
|
|
2107
|
-
a(this, "Nn");
|
|
2108
|
-
a(this, "Xn");
|
|
2109
|
-
a(this, "Zn");
|
|
2110
|
-
a(this, "Vn");
|
|
2111
|
-
a(this, "qn");
|
|
2112
|
-
this.Rr = t;
|
|
2113
|
-
}
|
|
2114
|
-
Jn(t) {
|
|
2115
|
-
const e = performance.now() + Math.max(0, t);
|
|
2116
|
-
e > this.On && (this.On = e);
|
|
2117
|
-
}
|
|
2118
|
-
Qn() {
|
|
2119
|
-
return performance.now() < this.On;
|
|
2120
|
-
}
|
|
2121
|
-
so(t) {
|
|
2122
|
-
const e = this.Rr.canvas;
|
|
2123
|
-
e.style.cursor = t == null || t === "" ? "" : t;
|
|
2124
|
-
}
|
|
2125
|
-
mr(t) {
|
|
2126
|
-
this.Ln = t, this.io();
|
|
2127
|
-
}
|
|
2128
|
-
eo() {
|
|
2129
|
-
if (this.jn) return;
|
|
2130
|
-
const t = this.Rr.canvas;
|
|
2131
|
-
this.Bn = (e) => {
|
|
2132
|
-
this.ro(e), this.no(e);
|
|
2133
|
-
}, this.Gn = () => {
|
|
2134
|
-
this.zn = { ...this.In }, this.In.x = -1, this.In.y = -1, this.Dn = null;
|
|
2135
|
-
}, this.Wn = (e) => {
|
|
2136
|
-
this.ro(e), this.oo(e);
|
|
2137
|
-
}, this.Hn = (e) => {
|
|
2138
|
-
this.ro(e), this.ho(e);
|
|
2139
|
-
}, this.Kn = (e) => {
|
|
2140
|
-
this.ro(e), this.ao(e);
|
|
2141
|
-
}, this.Yn = (e) => {
|
|
2142
|
-
this.ro(e), this.co(e);
|
|
2143
|
-
}, t.addEventListener("mousemove", this.Bn, { passive: !0 }), t.addEventListener("mouseleave", this.Gn, { passive: !0 }), t.addEventListener("mousedown", this.Wn, { passive: !0 }), t.addEventListener("mouseup", this.Hn, { passive: !0 }), t.addEventListener("click", this.Kn, { passive: !0 }), t.addEventListener("wheel", this.Yn, { passive: !1 }), this.jn = !0;
|
|
2144
|
-
}
|
|
2145
|
-
lo() {
|
|
2146
|
-
if (!this.jn) return;
|
|
2147
|
-
const t = this.Rr.canvas;
|
|
2148
|
-
t.removeEventListener("mousemove", this.Bn), t.removeEventListener("mouseleave", this.Gn), t.removeEventListener("mousedown", this.Wn), t.removeEventListener("mouseup", this.Hn), t.removeEventListener("click", this.Kn), t.removeEventListener("wheel", this.Yn), this.jn = !1;
|
|
2149
|
-
}
|
|
2150
|
-
io() {
|
|
2151
|
-
if (this.jn) try {
|
|
2152
|
-
if (this.Dn) {
|
|
2153
|
-
const t = new MouseEvent("mousemove", { clientX: this.Dn.x, clientY: this.Dn.y, bubbles: !1, cancelable: !1 });
|
|
2154
|
-
this.ro(t);
|
|
2155
|
-
} else this.In.x !== -1 && this.In.y !== -1 && (this.In.x >= this.Ln.cols || this.In.y >= this.Ln.rows) && (this.In.x = -1, this.In.y = -1);
|
|
2156
|
-
} catch {
|
|
2157
|
-
this.In.x = -1, this.In.y = -1;
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
uo(t) {
|
|
2161
|
-
this.Nn = t;
|
|
2162
|
-
}
|
|
2163
|
-
fo(t) {
|
|
2164
|
-
this.Xn = t;
|
|
2165
|
-
}
|
|
2166
|
-
do(t) {
|
|
2167
|
-
this.Zn = t;
|
|
2168
|
-
}
|
|
2169
|
-
po(t) {
|
|
2170
|
-
this.Vn = t;
|
|
2171
|
-
}
|
|
2172
|
-
_o(t) {
|
|
2173
|
-
this.qn = t;
|
|
2174
|
-
}
|
|
2175
|
-
vo() {
|
|
2176
|
-
return { x: this.In.x, y: this.In.y };
|
|
2177
|
-
}
|
|
2178
|
-
no(t) {
|
|
2179
|
-
if (this.Vn && !this.Qn()) {
|
|
2180
|
-
const e = { position: { ...this.In }, previousPosition: { ...this.zn }, originalEvent: t };
|
|
2181
|
-
this.Vn(e);
|
|
2182
|
-
}
|
|
2183
|
-
}
|
|
2184
|
-
oo(t) {
|
|
2185
|
-
if (this.Xn && !this.Qn()) {
|
|
2186
|
-
const e = { position: { ...this.In }, previousPosition: { ...this.zn }, button: t.button, originalEvent: t };
|
|
2187
|
-
this.Xn(e);
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
ho(t) {
|
|
2191
|
-
if (this.Zn && !this.Qn()) {
|
|
2192
|
-
const e = { position: { ...this.In }, previousPosition: { ...this.zn }, button: t.button, originalEvent: t };
|
|
2193
|
-
this.Zn(e);
|
|
2194
|
-
}
|
|
2195
|
-
}
|
|
2196
|
-
ao(t) {
|
|
2197
|
-
if (this.Nn && !this.Qn()) {
|
|
2198
|
-
const e = { position: { ...this.In }, previousPosition: { ...this.zn }, button: t.button, originalEvent: t };
|
|
2199
|
-
this.Nn(e);
|
|
2200
|
-
}
|
|
2201
|
-
}
|
|
2202
|
-
co(t) {
|
|
2203
|
-
if (this.qn && !this.Qn()) {
|
|
2204
|
-
const e = { position: { ...this.In }, previousPosition: { ...this.zn }, delta: { x: t.deltaX, y: t.deltaY }, originalEvent: t };
|
|
2205
|
-
this.qn(e);
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
ro(t) {
|
|
2209
|
-
const e = this.Rr.canvas;
|
|
2210
|
-
this.zn = { ...this.In }, this.Dn = { x: t.clientX, y: t.clientY };
|
|
2211
|
-
const i = e.getBoundingClientRect(), s = t.clientX - i.left, r = t.clientY - i.top, h = e.width / i.width, o = r * (e.height / i.height), c = s * h - this.Ln.offsetX, l = o - this.Ln.offsetY, u = Math.floor(c / this.Ln.cellWidth), f = Math.floor(l / this.Ln.cellHeight);
|
|
2212
|
-
u >= 0 && u < this.Ln.cols && f >= 0 && f < this.Ln.rows ? (this.In.x = u, this.In.y = f) : (this.In.x = -1, this.In.y = -1);
|
|
2213
|
-
}
|
|
2214
|
-
}
|
|
2215
|
-
const Le = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Mt }, Symbol.toStringTag, { value: "Module" }));
|
|
2216
|
-
class It {
|
|
2217
|
-
constructor() {
|
|
2218
|
-
a(this, "mo", /* @__PURE__ */ new Map());
|
|
2219
|
-
a(this, "yo", null);
|
|
2220
|
-
a(this, "wo", null);
|
|
2221
|
-
a(this, "bo");
|
|
2222
|
-
a(this, "$o");
|
|
2223
|
-
a(this, "jn", !1);
|
|
2224
|
-
a(this, "Co");
|
|
2225
|
-
a(this, "Mo");
|
|
2226
|
-
a(this, "xo", { 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" });
|
|
2227
|
-
}
|
|
2228
|
-
eo() {
|
|
2229
|
-
this.jn || (this.bo = (t) => {
|
|
2230
|
-
this.Ao(t);
|
|
2231
|
-
}, this.$o = (t) => {
|
|
2232
|
-
this.Fo(t);
|
|
2233
|
-
}, window.addEventListener("keydown", this.bo, { passive: !1 }), window.addEventListener("keyup", this.$o, { passive: !1 }), this.jn = !0);
|
|
2234
|
-
}
|
|
2235
|
-
lo() {
|
|
2236
|
-
this.jn && (window.removeEventListener("keydown", this.bo), window.removeEventListener("keyup", this.$o), this.jn = !1, this.mo.clear(), this.yo = null, this.wo = null);
|
|
2237
|
-
}
|
|
2238
|
-
fo(t) {
|
|
2239
|
-
this.Co = t;
|
|
2240
|
-
}
|
|
2241
|
-
do(t) {
|
|
2242
|
-
this.Mo = t;
|
|
2243
|
-
}
|
|
2244
|
-
To(t) {
|
|
2245
|
-
const e = this.Ro(t), i = this.mo.get(t) || this.mo.get(e);
|
|
2246
|
-
return (i == null ? void 0 : i.isPressed) || !1;
|
|
2247
|
-
}
|
|
2248
|
-
Eo() {
|
|
2249
|
-
return this.yo;
|
|
2250
|
-
}
|
|
2251
|
-
So() {
|
|
2252
|
-
return this.wo;
|
|
2253
|
-
}
|
|
2254
|
-
ko() {
|
|
2255
|
-
const t = [];
|
|
2256
|
-
for (const [e, i] of this.mo) i.isPressed && t.push(e);
|
|
2257
|
-
return t;
|
|
2258
|
-
}
|
|
2259
|
-
Po() {
|
|
2260
|
-
return { ctrl: this.To("Control"), shift: this.To("Shift"), alt: this.To("Alt"), meta: this.To("Meta") };
|
|
2261
|
-
}
|
|
2262
|
-
Lo() {
|
|
2263
|
-
this.mo.clear(), this.yo = null, this.wo = null;
|
|
2264
|
-
}
|
|
2265
|
-
Ao(t) {
|
|
2266
|
-
const e = t.key, i = Date.now();
|
|
2267
|
-
this.mo.has(e) || this.mo.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
2268
|
-
const s = this.mo.get(e);
|
|
2269
|
-
if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.yo = e, this.Co)) {
|
|
2270
|
-
const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !0, originalEvent: t };
|
|
2271
|
-
this.Co(r);
|
|
2272
|
-
}
|
|
2273
|
-
}
|
|
2274
|
-
Fo(t) {
|
|
2275
|
-
const e = t.key, i = Date.now();
|
|
2276
|
-
this.mo.has(e) || this.mo.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
2277
|
-
const s = this.mo.get(e);
|
|
2278
|
-
if (s.isPressed = !1, s.lastReleaseTime = i, this.wo = e, this.Mo) {
|
|
2279
|
-
const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !1, originalEvent: t };
|
|
2280
|
-
this.Mo(r);
|
|
2281
|
-
}
|
|
2282
|
-
}
|
|
2283
|
-
Ro(t) {
|
|
2284
|
-
return this.xo[t] || t.toLowerCase();
|
|
2285
|
-
}
|
|
2286
|
-
}
|
|
2287
|
-
const Ce = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: It }, Symbol.toStringTag, { value: "Module" }));
|
|
2288
|
-
class Nt {
|
|
2289
|
-
constructor(t, e) {
|
|
2290
|
-
a(this, "Rr");
|
|
2291
|
-
a(this, "Io");
|
|
2292
|
-
a(this, "Ln");
|
|
2293
|
-
a(this, "zo", /* @__PURE__ */ new Map());
|
|
2294
|
-
a(this, "Do", /* @__PURE__ */ new Map());
|
|
2295
|
-
a(this, "Oo", /* @__PURE__ */ new Map());
|
|
2296
|
-
a(this, "Bo", null);
|
|
2297
|
-
a(this, "Go");
|
|
2298
|
-
a(this, "Wo");
|
|
2299
|
-
a(this, "Ho");
|
|
2300
|
-
a(this, "Ko");
|
|
2301
|
-
a(this, "Yo");
|
|
2302
|
-
a(this, "jo");
|
|
2303
|
-
a(this, "jn", !1);
|
|
2304
|
-
a(this, "No");
|
|
2305
|
-
a(this, "Xo");
|
|
2306
|
-
a(this, "Zo");
|
|
2307
|
-
a(this, "Vo");
|
|
2308
|
-
a(this, "qo");
|
|
2309
|
-
a(this, "Jo");
|
|
2310
|
-
a(this, "Qo");
|
|
2311
|
-
a(this, "th");
|
|
2312
|
-
a(this, "sh");
|
|
2313
|
-
a(this, "ih");
|
|
2314
|
-
a(this, "eh", 320);
|
|
2315
|
-
a(this, "rh", 350);
|
|
2316
|
-
a(this, "nh", 10);
|
|
2317
|
-
a(this, "oh", 550);
|
|
2318
|
-
a(this, "hh", 14);
|
|
2319
|
-
a(this, "ah", 48);
|
|
2320
|
-
a(this, "uh", 650);
|
|
2321
|
-
a(this, "fh", 0.02);
|
|
2322
|
-
a(this, "dh", 2);
|
|
2323
|
-
a(this, "ph", 600);
|
|
2324
|
-
a(this, "_h", 0);
|
|
2325
|
-
a(this, "gh", null);
|
|
2326
|
-
this.Rr = t, this.Io = e;
|
|
2327
|
-
const i = this.Rr.canvas;
|
|
2328
|
-
this.Go = i.style.touchAction, this.Wo = i.style.userSelect, i.style.touchAction || (i.style.touchAction = "none"), i.style.userSelect || (i.style.userSelect = "none");
|
|
2329
|
-
}
|
|
2330
|
-
mr(t) {
|
|
2331
|
-
this.Ln = t, this.io();
|
|
2332
|
-
}
|
|
2333
|
-
eo() {
|
|
2334
|
-
if (this.jn) return;
|
|
2335
|
-
const t = this.Rr.canvas;
|
|
2336
|
-
this.Ho = (e) => {
|
|
2337
|
-
this.mh(e);
|
|
2338
|
-
}, this.Ko = (e) => {
|
|
2339
|
-
this.yh(e);
|
|
2340
|
-
}, this.Yo = (e) => {
|
|
2341
|
-
this.wh(e);
|
|
2342
|
-
}, this.jo = (e) => {
|
|
2343
|
-
this.bh(e);
|
|
2344
|
-
}, t.addEventListener("touchstart", this.Ho, { passive: !1 }), t.addEventListener("touchmove", this.Ko, { passive: !1 }), t.addEventListener("touchend", this.Yo, { passive: !1 }), t.addEventListener("touchcancel", this.jo, { passive: !1 }), this.jn = !0;
|
|
2345
|
-
}
|
|
2346
|
-
lo() {
|
|
2347
|
-
if (!this.jn) return;
|
|
2348
|
-
const t = this.Rr.canvas;
|
|
2349
|
-
t.removeEventListener("touchstart", this.Ho), t.removeEventListener("touchmove", this.Ko), t.removeEventListener("touchend", this.Yo), t.removeEventListener("touchcancel", this.jo), this.jn = !1, this.Bo = null, this.zo.clear(), this.Do.clear(), this.Oo.forEach((e) => {
|
|
2350
|
-
e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
|
|
2351
|
-
}), this.Oo.clear(), this.gh = null, this._h = 0, t.style.touchAction = this.Go, t.style.userSelect = this.Wo;
|
|
2352
|
-
}
|
|
2353
|
-
io() {
|
|
2354
|
-
if (!this.Ln || this.zo.size === 0) return;
|
|
2355
|
-
const t = /* @__PURE__ */ new Map();
|
|
2356
|
-
for (const e of this.zo.values()) {
|
|
2357
|
-
const i = this.$h(e.clientX, e.clientY, e.id, e);
|
|
2358
|
-
t.set(e.id, i);
|
|
2359
|
-
}
|
|
2360
|
-
this.zo = t;
|
|
2361
|
-
}
|
|
2362
|
-
Ch() {
|
|
2363
|
-
return Array.from(this.zo.values()).map((t) => ({ ...t }));
|
|
2364
|
-
}
|
|
2365
|
-
Mh(t) {
|
|
2366
|
-
this.No = t;
|
|
2367
|
-
}
|
|
2368
|
-
po(t) {
|
|
2369
|
-
this.Xo = t;
|
|
2370
|
-
}
|
|
2371
|
-
xh(t) {
|
|
2372
|
-
this.Zo = t;
|
|
2373
|
-
}
|
|
2374
|
-
Ah(t) {
|
|
2375
|
-
this.Vo = t;
|
|
2376
|
-
}
|
|
2377
|
-
Fh(t) {
|
|
2378
|
-
this.qo = t;
|
|
2379
|
-
}
|
|
2380
|
-
Th(t) {
|
|
2381
|
-
this.Jo = t;
|
|
2382
|
-
}
|
|
2383
|
-
Rh(t) {
|
|
2384
|
-
this.Qo = t;
|
|
2385
|
-
}
|
|
2386
|
-
Eh(t) {
|
|
2387
|
-
this.th = t;
|
|
2388
|
-
}
|
|
2389
|
-
Sh(t) {
|
|
2390
|
-
this.sh = t;
|
|
2391
|
-
}
|
|
2392
|
-
kh(t) {
|
|
2393
|
-
this.ih = t;
|
|
2394
|
-
}
|
|
2395
|
-
mh(t) {
|
|
2396
|
-
var s;
|
|
2397
|
-
if (!this.Ln) return;
|
|
2398
|
-
t.preventDefault(), (s = this.Io) == null || s.Jn(this.ph);
|
|
2399
|
-
const e = performance.now(), i = this.Ph(t.changedTouches);
|
|
2400
|
-
for (const r of i) {
|
|
2401
|
-
const h = this.zo.get(r.id);
|
|
2402
|
-
h && this.Do.set(r.id, this.Lh(h)), this.zo.set(r.id, r);
|
|
2403
|
-
const o = { id: r.id, startPosition: r, lastPosition: r, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
|
|
2404
|
-
this.Qo && (o.longPressTimer = window.setTimeout(() => {
|
|
2405
|
-
const c = this.zo.get(r.id);
|
|
2406
|
-
c && (o.longPressFired = !0, this.Qo({ touch: this.Lh(c), duration: performance.now() - o.startTime, originalEvent: t }));
|
|
2407
|
-
}, this.oh)), this.Oo.set(r.id, o), this.No && this.No(this.Ih(r, t, void 0, e));
|
|
2408
|
-
}
|
|
2409
|
-
this.zo.size === 2 && this.zh();
|
|
2410
|
-
}
|
|
2411
|
-
yh(t) {
|
|
2412
|
-
var s;
|
|
2413
|
-
if (!this.Ln) return;
|
|
2414
|
-
t.preventDefault(), (s = this.Io) == null || s.Jn(this.ph);
|
|
2415
|
-
const e = performance.now(), i = this.Ph(t.changedTouches);
|
|
2416
|
-
for (const r of i) {
|
|
2417
|
-
const h = this.zo.get(r.id), o = h ? this.Lh(h) : void 0;
|
|
2418
|
-
o && this.Do.set(r.id, o), this.zo.set(r.id, r);
|
|
2419
|
-
const c = this.Oo.get(r.id);
|
|
2420
|
-
c && (c.lastPosition = r, c.lastTime = e, o) && z(o.clientX, o.clientY, r.clientX, r.clientY) > this.hh && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.Xo && this.Xo(this.Ih(r, t, o, e));
|
|
2421
|
-
}
|
|
2422
|
-
this.zo.size === 2 ? this.Dh(t) : this.Bo = null;
|
|
2423
|
-
}
|
|
2424
|
-
wh(t) {
|
|
2425
|
-
if (!this.Ln) return;
|
|
2426
|
-
t.preventDefault();
|
|
2427
|
-
const e = performance.now(), i = this.Ph(t.changedTouches);
|
|
2428
|
-
for (const s of i) {
|
|
2429
|
-
const r = this.zo.get(s.id), h = r ? this.Lh(r) : void 0, o = this.Oo.get(s.id);
|
|
2430
|
-
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.Zo && this.Zo(this.Ih(s, t, h, e)), o && this.Oh(o, t), this.Oo.delete(s.id), this.Do.delete(s.id), this.zo.delete(s.id);
|
|
2431
|
-
}
|
|
2432
|
-
this.zo.size < 2 && (this.Bo = null);
|
|
2433
|
-
}
|
|
2434
|
-
bh(t) {
|
|
2435
|
-
if (!this.Ln) return;
|
|
2436
|
-
t.preventDefault();
|
|
2437
|
-
const e = performance.now(), i = this.Ph(t.changedTouches);
|
|
2438
|
-
for (const s of i) {
|
|
2439
|
-
const r = this.zo.get(s.id), h = r ? this.Lh(r) : void 0, o = this.Oo.get(s.id);
|
|
2440
|
-
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.Vo && this.Vo(this.Ih(s, t, h, e)), this.Oo.delete(s.id), this.Do.delete(s.id), this.zo.delete(s.id);
|
|
2441
|
-
}
|
|
2442
|
-
this.zo.size < 2 && (this.Bo = null);
|
|
2443
|
-
}
|
|
2444
|
-
Ph(t) {
|
|
2445
|
-
const e = [];
|
|
2446
|
-
for (let i = 0; i < t.length; i += 1) {
|
|
2447
|
-
const s = t.item(i);
|
|
2448
|
-
s && e.push(this.Bh(s));
|
|
2449
|
-
}
|
|
2450
|
-
return e;
|
|
2451
|
-
}
|
|
2452
|
-
Bh(t) {
|
|
2453
|
-
return this.$h(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 });
|
|
2454
|
-
}
|
|
2455
|
-
$h(t, e, i, s) {
|
|
2456
|
-
const r = this.Rr.canvas, h = r.getBoundingClientRect(), o = t - h.left, c = e - h.top, l = r.width / h.width, u = c * (r.height / h.height), f = o * l - this.Ln.offsetX, g = u - this.Ln.offsetY, p = Math.floor(f / this.Ln.cellWidth), m = Math.floor(g / this.Ln.cellHeight), d = p >= 0 && p < this.Ln.cols && m >= 0 && m < this.Ln.rows;
|
|
2457
|
-
return { id: i, x: d ? p : -1, y: d ? m : -1, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
|
|
2458
|
-
}
|
|
2459
|
-
Ih(t, e, i, s) {
|
|
2460
|
-
const r = this.Oo.get(t.id), h = Array.from(this.Do.values()).map((l) => this.Lh(l)), o = Array.from(this.zo.values()).map((l) => this.Lh(l)), c = this.Ph(e.changedTouches);
|
|
2461
|
-
return { touch: this.Lh(t), previousTouch: i ? this.Lh(i) : void 0, touches: o, previousTouches: h, changedTouches: c, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
|
|
2462
|
-
}
|
|
2463
|
-
zh() {
|
|
2464
|
-
if (this.zo.size !== 2) return void (this.Bo = null);
|
|
2465
|
-
const t = Array.from(this.zo.values()), [e, i] = t, s = z(e.x, e.y, i.x, i.y), r = yt(e.clientX, e.clientY, i.clientX, i.clientY);
|
|
2466
|
-
this.Bo = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
|
|
2467
|
-
}
|
|
2468
|
-
Dh(t) {
|
|
2469
|
-
if (this.Bo || this.zh(), !this.Bo) return;
|
|
2470
|
-
const [e, i] = this.Bo.ids, s = this.zo.get(e), r = this.zo.get(i);
|
|
2471
|
-
if (!s || !r) return;
|
|
2472
|
-
const h = z(s.x, s.y, r.x, r.y) / this.Bo.initialDistance, o = h - this.Bo.lastScale;
|
|
2473
|
-
this.sh && Math.abs(o) > this.fh && (this.sh({ touches: [this.Lh(s), this.Lh(r)], scale: h, deltaScale: o, center: this.Gh(s, r), originalEvent: t }), this.Bo.lastScale = h);
|
|
2474
|
-
let c = yt(s.clientX, s.clientY, r.clientX, r.clientY) - this.Bo.initialAngle;
|
|
2475
|
-
c = (c + 180) % 360 - 180;
|
|
2476
|
-
const l = c - this.Bo.lastRotation;
|
|
2477
|
-
this.ih && Math.abs(l) > this.dh && (this.ih({ touches: [this.Lh(s), this.Lh(r)], rotation: c, deltaRotation: l, center: this.Gh(s, r), originalEvent: t }), this.Bo.lastRotation = c);
|
|
2478
|
-
}
|
|
2479
|
-
Gh(t, e) {
|
|
2480
|
-
const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.$h(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
|
|
2481
|
-
return { x: r.x, y: r.y };
|
|
2482
|
-
}
|
|
2483
|
-
Oh(t, e) {
|
|
2484
|
-
const i = performance.now(), s = i - t.startTime, r = z(t.startPosition.clientX, t.startPosition.clientY, t.lastPosition.clientX, t.lastPosition.clientY);
|
|
2485
|
-
if (!t.longPressFired && s <= this.eh && r <= this.nh)
|
|
2486
|
-
this.Wh(t.lastPosition, i) && this.Jo ? this.Jo({ touch: this.Lh(t.lastPosition), taps: 2, originalEvent: e }) : this.qo && this.qo({ touch: this.Lh(t.lastPosition), taps: 1, originalEvent: e });
|
|
2487
|
-
else if (!t.longPressFired && s <= this.uh && r >= this.ah) {
|
|
2488
|
-
const h = { x: t.lastPosition.clientX - t.startPosition.clientX, y: t.lastPosition.clientY - t.startPosition.clientY }, o = Math.max(Math.hypot(h.x, h.y), 1e-4), c = { x: h.x / o, y: h.y / o }, l = { x: h.x / s, y: h.y / s };
|
|
2489
|
-
this.th && this.th({ touch: this.Lh(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
|
|
2490
|
-
}
|
|
2491
|
-
this._h = i, this.gh = this.Lh(t.lastPosition);
|
|
2492
|
-
}
|
|
2493
|
-
Wh(t, e) {
|
|
2494
|
-
return !this.gh || e - this._h > this.rh ? !1 : z(t.clientX, t.clientY, this.gh.clientX, this.gh.clientY) <= this.nh;
|
|
2495
|
-
}
|
|
2496
|
-
Lh(t) {
|
|
2497
|
-
return { ...t };
|
|
2498
|
-
}
|
|
2499
|
-
}
|
|
2500
|
-
const Fe = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Nt }, Symbol.toStringTag, { value: "Module" }));
|
|
2501
|
-
class ht extends rt {
|
|
2502
|
-
constructor(e, i, s, r, h, o, c, l) {
|
|
2503
|
-
const u = h / o;
|
|
2504
|
-
let f, g;
|
|
2505
|
-
u > 1 ? (f = c, g = Math.round(c / u)) : (g = l, f = Math.round(l * u));
|
|
2506
|
-
super(e, i, s, h, o, f, g);
|
|
2507
|
-
a(this, "Hh");
|
|
2508
|
-
a(this, "Kh", !1);
|
|
2509
|
-
a(this, "Yh", []);
|
|
2510
|
-
a(this, "yn", null);
|
|
2511
|
-
a(this, "jh", 0);
|
|
2512
|
-
a(this, "Nh", 0);
|
|
2513
|
-
a(this, "Xh", -1);
|
|
2514
|
-
this.Hh = r;
|
|
2515
|
-
}
|
|
2516
|
-
O() {
|
|
2517
|
-
super.O();
|
|
2518
|
-
for (const e of this.Yh) this.$.deleteTexture(e);
|
|
2519
|
-
this.Yh = [], this.Hh.pause(), this.Hh.src = "", this.Hh.load();
|
|
2520
|
-
}
|
|
2521
|
-
Zh() {
|
|
2522
|
-
if (!this.Kh && this.Hh.readyState >= this.Hh.HAVE_CURRENT_DATA) {
|
|
2523
|
-
const e = this.$;
|
|
2524
|
-
e.bindTexture(e.TEXTURE_2D, this.Jr), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, this.Hh), e.bindTexture(e.TEXTURE_2D, null);
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
|
-
dn() {
|
|
2528
|
-
if (this.Kh && this.Yh.length > 0) {
|
|
2529
|
-
const e = this.Nh % this.Yh.length;
|
|
2530
|
-
return this.Yh[e];
|
|
2531
|
-
}
|
|
2532
|
-
return this.Jr;
|
|
2533
|
-
}
|
|
2534
|
-
ct() {
|
|
2535
|
-
return this.X = null, super.ct();
|
|
2536
|
-
}
|
|
2537
|
-
ln() {
|
|
2538
|
-
this.Zh();
|
|
2539
|
-
}
|
|
2540
|
-
async Vh(e, i) {
|
|
2541
|
-
var s;
|
|
2542
|
-
try {
|
|
2543
|
-
if (e <= 0) throw Error("Video preload requires a frameRate greater than 0.");
|
|
2544
|
-
const r = this.Hh.duration;
|
|
2545
|
-
if (!isFinite(r) || r <= 0) throw Error("Video duration is invalid, cannot preload frames.");
|
|
2546
|
-
const h = Math.max(1, Math.ceil(r * e));
|
|
2547
|
-
if (this.qh(e, h), await this.Jh(e, i)) return void this.Qh("captureStream", i);
|
|
2548
|
-
await this.ta(e, i), this.Qh("seeking", i);
|
|
2549
|
-
} catch (r) {
|
|
2550
|
-
const h = r instanceof Error ? r : Error(r + "");
|
|
2551
|
-
throw (s = i == null ? void 0 : i.onError) == null || s.call(i, h), h;
|
|
2552
|
-
}
|
|
2553
|
-
}
|
|
2554
|
-
qh(e, i) {
|
|
2555
|
-
this.yn = e, this.jh = i, this.Yh = [], this.Kh = !1, this.Nh = 0, this.Xh = -1;
|
|
2556
|
-
}
|
|
2557
|
-
Qh(e, i) {
|
|
2558
|
-
var s;
|
|
2559
|
-
if (this.Yh.length === 0) throw Error(`Video preload via ${e} completed but produced 0 frames.`);
|
|
2560
|
-
this.jh = this.Yh.length, this.Kh = !0, this.Nh = 0, this.Xh = -1, this.Hh.pause(), this.Hh.currentTime = 0, i != null && i.onProgress && i.onProgress({ percent: 100, loadedFrames: this.jh, totalFrames: this.jh, strategy: e }), (s = i == null ? void 0 : i.onComplete) == null || s.call(i, { totalFrames: this.jh, strategy: e });
|
|
2561
|
-
}
|
|
2562
|
-
sa(e) {
|
|
2563
|
-
const i = this.$, s = i.createTexture();
|
|
2564
|
-
return i.bindTexture(i.TEXTURE_2D, s), i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, 1), et(i, i.LINEAR, i.LINEAR, i.CLAMP_TO_EDGE, i.CLAMP_TO_EDGE), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, i.RGBA, i.UNSIGNED_BYTE, e), i.bindTexture(i.TEXTURE_2D, null), s;
|
|
2565
|
-
}
|
|
2566
|
-
ia(e, i) {
|
|
2567
|
-
if (!(i != null && i.onProgress) || this.jh === 0) return;
|
|
2568
|
-
const s = Math.min(99, Math.floor(this.Yh.length / this.jh * 100)), r = 10 * Math.floor(s / 10);
|
|
2569
|
-
r > this.Xh && (this.Xh = r, i.onProgress({ percent: s, loadedFrames: this.Yh.length, totalFrames: this.jh, strategy: e }));
|
|
2570
|
-
}
|
|
2571
|
-
async Jh(e, i) {
|
|
2572
|
-
const s = globalThis, r = s == null ? void 0 : s.MediaStreamTrackProcessor, h = this.Hh.captureStream;
|
|
2573
|
-
if (typeof r != "function" || typeof h != "function") return !1;
|
|
2574
|
-
let o, c = null;
|
|
2575
|
-
try {
|
|
2576
|
-
const l = h.call(this.Hh);
|
|
2577
|
-
if (o = l.getVideoTracks()[0], !o) return l.getTracks().forEach((g) => g.stop()), !1;
|
|
2578
|
-
if (c = new r({ track: o }).readable.getReader(), this.Hh.currentTime = 0, this.Hh.muted = !0, await this.Hh.play().catch(() => {
|
|
2579
|
-
}), this.Hh.paused) return !1;
|
|
2580
|
-
const u = 1e6 / e;
|
|
2581
|
-
let f = 0;
|
|
2582
|
-
for (; this.Yh.length < this.jh; ) {
|
|
2583
|
-
const g = await c.read();
|
|
2584
|
-
if (g.done) break;
|
|
2585
|
-
const p = g.value;
|
|
2586
|
-
if (p) try {
|
|
2587
|
-
const m = typeof p.timestamp == "number" ? p.timestamp : f;
|
|
2588
|
-
(this.Yh.length === 0 || m >= f) && (this.Yh.push(this.sa(p)), f = m + u, this.ia("captureStream", i));
|
|
2589
|
-
} finally {
|
|
2590
|
-
p.close();
|
|
2591
|
-
}
|
|
2592
|
-
}
|
|
2593
|
-
return c.releaseLock(), o.stop(), c = null, o = void 0, this.Hh.pause(), this.Hh.currentTime = 0, this.Yh.length !== 0;
|
|
2594
|
-
} catch {
|
|
2595
|
-
return this.Yh = [], this.Xh = -1, !1;
|
|
2596
|
-
} finally {
|
|
2597
|
-
if (c) try {
|
|
2598
|
-
await c.cancel();
|
|
2599
|
-
} catch {
|
|
2600
|
-
}
|
|
2601
|
-
o && o.stop(), this.Hh.pause(), this.Hh.currentTime = 0;
|
|
2602
|
-
}
|
|
2603
|
-
}
|
|
2604
|
-
async ta(e, i) {
|
|
2605
|
-
const s = 1 / e, r = this.jh, h = this.Hh;
|
|
2606
|
-
h.pause();
|
|
2607
|
-
for (let o = 0; o < r; o++) {
|
|
2608
|
-
const c = Math.min(h.duration, o * s);
|
|
2609
|
-
await this.ea(c), this.Yh.push(this.sa(h)), this.ia("seeking", i);
|
|
2610
|
-
}
|
|
2611
|
-
h.currentTime = 0;
|
|
2612
|
-
}
|
|
2613
|
-
ea(e) {
|
|
2614
|
-
return new Promise((i, s) => {
|
|
2615
|
-
const r = this.Hh, h = () => {
|
|
2616
|
-
r.removeEventListener("seeked", o), r.removeEventListener("error", c);
|
|
2617
|
-
}, o = () => {
|
|
2618
|
-
h(), i();
|
|
2619
|
-
}, c = () => {
|
|
2620
|
-
h(), s(Error("Video seek failed while preloading frames."));
|
|
2621
|
-
};
|
|
2622
|
-
r.addEventListener("seeked", o, { once: !0 }), r.addEventListener("error", c, { once: !0 });
|
|
2623
|
-
const l = isFinite(r.duration) ? r.duration : e, u = Math.min(Math.max(e, 0), l);
|
|
2624
|
-
if (Math.abs(r.currentTime - u) < 1e-4) return h(), void i();
|
|
2625
|
-
r.currentTime = u;
|
|
2626
|
-
});
|
|
2627
|
-
}
|
|
2628
|
-
frame(e) {
|
|
2629
|
-
return this.Kh && e !== void 0 && this.jh > 0 && (this.Nh = (e % this.jh + this.jh) % this.jh, this.X = null), this;
|
|
2630
|
-
}
|
|
2631
|
-
static async pn(e, i, s, r, h, o) {
|
|
2632
|
-
const c = e.context, l = o == null ? void 0 : o.frameRate;
|
|
2633
|
-
let u;
|
|
2634
|
-
typeof i == "string" ? (u = document.createElement("video"), u.crossOrigin = "anonymous", u.loop = !0, u.muted = !0, u.playsInline = !0, await new Promise((d, y) => {
|
|
2635
|
-
u.addEventListener("loadedmetadata", () => d(), { once: !0 }), u.addEventListener("error", (v) => {
|
|
2636
|
-
var E;
|
|
2637
|
-
const w = v.target;
|
|
2638
|
-
y(Error("Failed to load video: " + (((E = w.error) == null ? void 0 : E.message) || "Unknown error")));
|
|
2639
|
-
}, { once: !0 }), u.src = i;
|
|
2640
|
-
})) : (u = i, u.readyState < u.HAVE_METADATA && await new Promise((d, y) => {
|
|
2641
|
-
u.addEventListener("loadedmetadata", () => d(), { once: !0 }), u.addEventListener("error", (v) => {
|
|
2642
|
-
var w;
|
|
2643
|
-
return y(Error("Video error: " + ((w = v.target.error) == null ? void 0 : w.message)));
|
|
2644
|
-
}, { once: !0 });
|
|
2645
|
-
}));
|
|
2646
|
-
const f = c.createTexture();
|
|
2647
|
-
c.bindTexture(c.TEXTURE_2D, f), c.pixelStorei(c.UNPACK_FLIP_Y_WEBGL, 1), et(c, c.LINEAR, c.LINEAR, c.CLAMP_TO_EDGE, c.CLAMP_TO_EDGE), c.texImage2D(c.TEXTURE_2D, 0, c.RGBA, c.RGBA, c.UNSIGNED_BYTE, u), c.bindTexture(c.TEXTURE_2D, null);
|
|
2648
|
-
const g = u.videoWidth, p = u.videoHeight, m = new ht(c, e, f, u, g, p, s, r);
|
|
2649
|
-
return m.hn = h, l && l > 0 && await m.Vh(l, o), m;
|
|
2650
|
-
}
|
|
2651
|
-
async play() {
|
|
2652
|
-
await this.Hh.play();
|
|
2653
|
-
}
|
|
2654
|
-
pause() {
|
|
2655
|
-
this.Hh.pause();
|
|
2656
|
-
}
|
|
2657
|
-
stop() {
|
|
2658
|
-
this.Hh.pause(), this.Hh.currentTime = 0;
|
|
2659
|
-
}
|
|
2660
|
-
speed(e) {
|
|
2661
|
-
return this.Hh.playbackRate = e, this;
|
|
2662
|
-
}
|
|
2663
|
-
loop(e = !0) {
|
|
2664
|
-
return this.Hh.loop = e, this;
|
|
2665
|
-
}
|
|
2666
|
-
time(e) {
|
|
2667
|
-
return this.Hh.currentTime = e, this;
|
|
2668
|
-
}
|
|
2669
|
-
volume(e) {
|
|
2670
|
-
return this.Hh.volume = Math.max(0, Math.min(1, e)), this;
|
|
2671
|
-
}
|
|
2672
|
-
get texture() {
|
|
2673
|
-
return this.Jr;
|
|
2674
|
-
}
|
|
2675
|
-
get width() {
|
|
2676
|
-
return this.G;
|
|
2677
|
-
}
|
|
2678
|
-
get height() {
|
|
2679
|
-
return this.W;
|
|
2680
|
-
}
|
|
2681
|
-
get originalWidth() {
|
|
2682
|
-
return this.Qr;
|
|
2683
|
-
}
|
|
2684
|
-
get originalHeight() {
|
|
2685
|
-
return this.tn;
|
|
2686
|
-
}
|
|
2687
|
-
get videoElement() {
|
|
2688
|
-
return this.Hh;
|
|
2689
|
-
}
|
|
2690
|
-
get currentTime() {
|
|
2691
|
-
return this.Hh.currentTime;
|
|
2692
|
-
}
|
|
2693
|
-
get duration() {
|
|
2694
|
-
return this.Hh.duration;
|
|
2695
|
-
}
|
|
2696
|
-
get isPlaying() {
|
|
2697
|
-
return !this.Hh.paused && !this.Hh.ended;
|
|
2698
|
-
}
|
|
2699
|
-
get isPreloaded() {
|
|
2700
|
-
return this.Kh;
|
|
2701
|
-
}
|
|
2702
|
-
get totalFrames() {
|
|
2703
|
-
return this.jh;
|
|
2704
|
-
}
|
|
2705
|
-
get preloadFrameRate() {
|
|
2706
|
-
return this.yn;
|
|
2707
|
-
}
|
|
2708
|
-
get currentFrameIndex() {
|
|
2709
|
-
return this.Nh;
|
|
2710
|
-
}
|
|
2711
|
-
}
|
|
2712
|
-
const Ue = (n) => class extends n {
|
|
2713
|
-
ra(t, e, i, s) {
|
|
2714
|
-
if (C.qr(t)) return t;
|
|
2715
|
-
if (typeof t == "number" || typeof t == "string") return this.color(t, e, i, s);
|
|
2716
|
-
throw Error("Unsupported color input passed to color-capable method.");
|
|
2717
|
-
}
|
|
2718
|
-
rotate(t = 0, e = 0, i = 0) {
|
|
2719
|
-
this.N.state.Zt(t), this.N.state.Vt(e), this.N.state.qt(i);
|
|
2720
|
-
}
|
|
2721
|
-
rotateX(t) {
|
|
2722
|
-
this.N.state.Zt(t);
|
|
2723
|
-
}
|
|
2724
|
-
rotateY(t) {
|
|
2725
|
-
this.N.state.Vt(t);
|
|
2726
|
-
}
|
|
2727
|
-
rotateZ(t) {
|
|
2728
|
-
this.N.state.qt(t);
|
|
2729
|
-
}
|
|
2730
|
-
translate(t = 0, e = 0, i = 0) {
|
|
2731
|
-
this.N.state.Jt(t, e, i);
|
|
2732
|
-
}
|
|
2733
|
-
translateX(t) {
|
|
2734
|
-
this.N.state.Jt(t, 0, 0);
|
|
2735
|
-
}
|
|
2736
|
-
translateY(t) {
|
|
2737
|
-
this.N.state.Jt(0, t, 0);
|
|
2738
|
-
}
|
|
2739
|
-
translateZ(t) {
|
|
2740
|
-
this.N.state.Jt(0, 0, t);
|
|
2741
|
-
}
|
|
2742
|
-
push() {
|
|
2743
|
-
this.N.state.rt();
|
|
2744
|
-
}
|
|
2745
|
-
pop() {
|
|
2746
|
-
this.N.state.nt();
|
|
2747
|
-
}
|
|
2748
|
-
color(t, e, i, s) {
|
|
2749
|
-
if (C.qr(t)) return t;
|
|
2750
|
-
if (typeof t == "string") {
|
|
2751
|
-
const r = Array.from(t);
|
|
2752
|
-
if (r.length === 1) {
|
|
2753
|
-
const h = r[0], o = this.er.sr(h);
|
|
2754
|
-
return C.Vr(o);
|
|
2755
|
-
}
|
|
2756
|
-
return C.Zr(t);
|
|
2757
|
-
}
|
|
2758
|
-
if (typeof t == "number") return typeof e == "number" && typeof i == "number" ? C.Nr(t, e, i, s ?? 255) : typeof e == "number" && i === void 0 ? C.Xr(t, e) : C.Xr(t, s ?? 255);
|
|
2759
|
-
throw Error("Unsupported color input passed to color().");
|
|
2760
|
-
}
|
|
2761
|
-
rect(t = 1, e = 1) {
|
|
2762
|
-
this.N.ge(t, e);
|
|
2763
|
-
}
|
|
2764
|
-
point() {
|
|
2765
|
-
this.N.ge(1, 1);
|
|
2766
|
-
}
|
|
2767
|
-
line(t, e, i, s) {
|
|
2768
|
-
this.N.ve(t, e, i, s);
|
|
2769
|
-
}
|
|
2770
|
-
lineWeight(t) {
|
|
2771
|
-
this.N.state.Nt(t);
|
|
2772
|
-
}
|
|
2773
|
-
background(t, e, i, s = 255) {
|
|
2774
|
-
const r = this.ra(t, e, i, s);
|
|
2775
|
-
this.N.Ce(r.r, r.g, r.b, r.a);
|
|
2776
|
-
}
|
|
2777
|
-
char(t) {
|
|
2778
|
-
if (C.qr(t)) {
|
|
2779
|
-
const i = t.character;
|
|
2780
|
-
return void (i && this.N.state.es(i));
|
|
2781
|
-
}
|
|
2782
|
-
const e = Array.from(t);
|
|
2783
|
-
if (e.length === 0) throw Error("char() requires at least one character.");
|
|
2784
|
-
this.N.state.es(this.er.sr(e[0]));
|
|
2785
|
-
}
|
|
2786
|
-
charColor(t, e, i, s) {
|
|
2787
|
-
const r = this.ra(t, e, i, s);
|
|
2788
|
-
this.N.state.rs(r.r, r.g, r.b, r.a);
|
|
2789
|
-
}
|
|
2790
|
-
cellColor(t, e, i, s) {
|
|
2791
|
-
const r = this.ra(t, e, i, s);
|
|
2792
|
-
this.N.state.ns(r.r, r.g, r.b, r.a);
|
|
2793
|
-
}
|
|
2794
|
-
flipX(t) {
|
|
2795
|
-
this.N.state.hs(t);
|
|
2796
|
-
}
|
|
2797
|
-
flipY(t) {
|
|
2798
|
-
this.N.state.cs(t);
|
|
2799
|
-
}
|
|
2800
|
-
charRotation(t) {
|
|
2801
|
-
this.N.state.us(t);
|
|
2802
|
-
}
|
|
2803
|
-
invert(t) {
|
|
2804
|
-
this.N.state.ls(t);
|
|
2805
|
-
}
|
|
2806
|
-
clear() {
|
|
2807
|
-
this.N.Ce(0, 0, 0, 0);
|
|
2808
|
-
}
|
|
2809
|
-
ellipse(t, e) {
|
|
2810
|
-
this.N.me(t / 2, e / 2);
|
|
2811
|
-
}
|
|
2812
|
-
triangle(t, e, i, s, r, h) {
|
|
2813
|
-
this.N.ye(t, e, i, s, r, h);
|
|
2814
|
-
}
|
|
2815
|
-
bezierCurve(t, e, i, s, r, h, o, c) {
|
|
2816
|
-
this.N.we(t, e, i, s, r, h, o, c);
|
|
2817
|
-
}
|
|
2818
|
-
arc(t, e, i, s) {
|
|
2819
|
-
this.N.be(t / 2, e / 2, i, s);
|
|
2820
|
-
}
|
|
2821
|
-
shader(t) {
|
|
2822
|
-
this.N.ue(t);
|
|
2823
|
-
}
|
|
2824
|
-
setUniform(t, e) {
|
|
2825
|
-
this.N.I(t, e);
|
|
2826
|
-
}
|
|
2827
|
-
setUniforms(t) {
|
|
2828
|
-
this.N.fe(t);
|
|
2829
|
-
}
|
|
2830
|
-
async createFilterShader(t) {
|
|
2831
|
-
if (typeof t == "string" && (t.includes("/") || t.startsWith("./") || t.startsWith("../") || t.endsWith(".frag") || t.endsWith(".glsl"))) {
|
|
2832
|
-
const e = await fetch(t);
|
|
2833
|
-
if (!e.ok) throw Error(`Failed to load shader from ${t}: ${e.statusText}`);
|
|
2834
|
-
const i = await e.text();
|
|
2835
|
-
return this.N.de(i);
|
|
2836
|
-
}
|
|
2837
|
-
return this.N.de(t);
|
|
2838
|
-
}
|
|
2839
|
-
createFramebuffer(t) {
|
|
2840
|
-
return this.N.$e(t.width ?? this.grid.cols, t.height ?? this.grid.rows, 3);
|
|
2841
|
-
}
|
|
2842
|
-
image(t, e, i) {
|
|
2843
|
-
this.N.pe(t, e, i);
|
|
2844
|
-
}
|
|
2845
|
-
ortho() {
|
|
2846
|
-
this.N.state.ds(!0);
|
|
2847
|
-
}
|
|
2848
|
-
async loadImage(t) {
|
|
2849
|
-
if (typeof t != "string") return Y.pn(this.N, t, this.Ln.cols, this.Ln.rows, (s) => this.er.ir(s));
|
|
2850
|
-
const e = t, i = await new Promise((s, r) => {
|
|
2851
|
-
const h = new Image();
|
|
2852
|
-
h.crossOrigin = "anonymous", h.onload = () => s(h), h.onerror = (o) => r(o), h.src = e;
|
|
2853
|
-
});
|
|
2854
|
-
return Y.pn(this.N, i, this.Ln.cols, this.Ln.rows, (s) => this.er.ir(s));
|
|
2855
|
-
}
|
|
2856
|
-
async loadVideo(t, e) {
|
|
2857
|
-
return ht.pn(this.N, t, this.Ln.cols, this.Ln.rows, (i) => this.er.ir(i), e);
|
|
2858
|
-
}
|
|
2859
|
-
}, Me = (n) => class extends n {
|
|
2860
|
-
async loadFont(t) {
|
|
2861
|
-
return this.er.$r(t).then(() => {
|
|
2862
|
-
const e = this.er.maxGlyphDimensions;
|
|
2863
|
-
this.Ln.kr(e.width, e.height), this.na.resize(this.Ln.cols, this.Ln.rows), this.N.Me(), this.Io.io(), this.oa.io();
|
|
2864
|
-
});
|
|
2865
|
-
}
|
|
2866
|
-
fontSize(t) {
|
|
2867
|
-
if (!V.v(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) || this.er.fontSize === t) return;
|
|
2868
|
-
this.er.br(t);
|
|
2869
|
-
const e = this.er.maxGlyphDimensions;
|
|
2870
|
-
this.Ln.kr(e.width, e.height), this.na.resize(this.Ln.cols, this.Ln.rows), this.N.Me(), this.Io.io(), this.oa.io();
|
|
2871
|
-
}
|
|
2872
|
-
}, Ie = (n) => class extends n {
|
|
2873
|
-
get frameCount() {
|
|
2874
|
-
return this.ha.kn;
|
|
2875
|
-
}
|
|
2876
|
-
set frameCount(t) {
|
|
2877
|
-
this.ha.kn = t;
|
|
2878
|
-
}
|
|
2879
|
-
frameRate(t) {
|
|
2880
|
-
return t === void 0 ? this.ha.Sn : this.ha.Tn(t, () => this.aa());
|
|
2881
|
-
}
|
|
2882
|
-
noLoop() {
|
|
2883
|
-
this.ha.An();
|
|
2884
|
-
}
|
|
2885
|
-
loop() {
|
|
2886
|
-
this.ha.Fn(() => this.aa());
|
|
2887
|
-
}
|
|
2888
|
-
redraw(t = 1) {
|
|
2889
|
-
if (V.v(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.aa();
|
|
2890
|
-
}
|
|
2891
|
-
isLooping() {
|
|
2892
|
-
return this.ha.En;
|
|
2893
|
-
}
|
|
2894
|
-
}, Ne = (n) => class extends n {
|
|
2895
|
-
constructor(...t) {
|
|
2896
|
-
super(...t);
|
|
2897
|
-
}
|
|
2898
|
-
mouseClicked(t) {
|
|
2899
|
-
this.Io.uo(t);
|
|
2900
|
-
}
|
|
2901
|
-
mousePressed(t) {
|
|
2902
|
-
this.Io.fo(t);
|
|
2903
|
-
}
|
|
2904
|
-
mouseReleased(t) {
|
|
2905
|
-
this.Io.do(t);
|
|
2906
|
-
}
|
|
2907
|
-
mouseMoved(t) {
|
|
2908
|
-
this.Io.po(t);
|
|
2909
|
-
}
|
|
2910
|
-
mouseScrolled(t) {
|
|
2911
|
-
this.Io._o(t);
|
|
2912
|
-
}
|
|
2913
|
-
get mouse() {
|
|
2914
|
-
return this.Io.vo();
|
|
2915
|
-
}
|
|
2916
|
-
cursor(t) {
|
|
2917
|
-
this.Io.so(t);
|
|
2918
|
-
}
|
|
2919
|
-
}, Pe = (n) => class extends n {
|
|
2920
|
-
constructor(...t) {
|
|
2921
|
-
super(...t);
|
|
2922
|
-
}
|
|
2923
|
-
touchStarted(t) {
|
|
2924
|
-
this.oa.Mh(t);
|
|
2925
|
-
}
|
|
2926
|
-
touchMoved(t) {
|
|
2927
|
-
this.oa.po(t);
|
|
2928
|
-
}
|
|
2929
|
-
touchEnded(t) {
|
|
2930
|
-
this.oa.xh(t);
|
|
2931
|
-
}
|
|
2932
|
-
touchCancelled(t) {
|
|
2933
|
-
this.oa.Ah(t);
|
|
2934
|
-
}
|
|
2935
|
-
tap(t) {
|
|
2936
|
-
this.oa.Fh(t);
|
|
2937
|
-
}
|
|
2938
|
-
doubleTap(t) {
|
|
2939
|
-
this.oa.Th(t);
|
|
2940
|
-
}
|
|
2941
|
-
longPress(t) {
|
|
2942
|
-
this.oa.Rh(t);
|
|
2943
|
-
}
|
|
2944
|
-
swipe(t) {
|
|
2945
|
-
this.oa.Eh(t);
|
|
2946
|
-
}
|
|
2947
|
-
pinch(t) {
|
|
2948
|
-
this.oa.Sh(t);
|
|
2949
|
-
}
|
|
2950
|
-
rotateGesture(t) {
|
|
2951
|
-
this.oa.kh(t);
|
|
2952
|
-
}
|
|
2953
|
-
get touches() {
|
|
2954
|
-
return this.oa.Ch();
|
|
2955
|
-
}
|
|
2956
|
-
}, _e = (n) => class extends n {
|
|
2957
|
-
constructor(...t) {
|
|
2958
|
-
super(...t);
|
|
2959
|
-
}
|
|
2960
|
-
keyPressed(t) {
|
|
2961
|
-
this.ca.fo(t);
|
|
2962
|
-
}
|
|
2963
|
-
keyReleased(t) {
|
|
2964
|
-
this.ca.do(t);
|
|
2965
|
-
}
|
|
2966
|
-
isKeyPressed(t) {
|
|
2967
|
-
return this.ca.To(t);
|
|
2968
|
-
}
|
|
2969
|
-
get lastKeyPressed() {
|
|
2970
|
-
return this.ca.Eo();
|
|
2971
|
-
}
|
|
2972
|
-
get lastKeyReleased() {
|
|
2973
|
-
return this.ca.So();
|
|
2974
|
-
}
|
|
2975
|
-
get pressedKeys() {
|
|
2976
|
-
return this.ca.ko();
|
|
2977
|
-
}
|
|
2978
|
-
get modifierState() {
|
|
2979
|
-
return this.ca.Po();
|
|
2980
|
-
}
|
|
2981
|
-
};
|
|
2982
|
-
class Se {
|
|
2983
|
-
constructor(t) {
|
|
2984
|
-
a(this, "la");
|
|
2985
|
-
a(this, "ua", /* @__PURE__ */ new Map());
|
|
2986
|
-
a(this, "fa", []);
|
|
2987
|
-
a(this, "da", /* @__PURE__ */ new Map());
|
|
2988
|
-
a(this, "pa", /* @__PURE__ */ new Map());
|
|
2989
|
-
this.la = t;
|
|
2990
|
-
}
|
|
2991
|
-
async _a(t) {
|
|
2992
|
-
for (const e of t) {
|
|
2993
|
-
if (this.ua.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
|
|
2994
|
-
const i = this.ga(e.name);
|
|
2995
|
-
try {
|
|
2996
|
-
await e.install(this.la, i);
|
|
2997
|
-
} catch (s) {
|
|
2998
|
-
throw this.va(e.name), s;
|
|
2999
|
-
}
|
|
3000
|
-
this.ua.set(e.name, e), this.fa.push(e.name);
|
|
3001
|
-
}
|
|
3002
|
-
}
|
|
3003
|
-
async ma(t) {
|
|
3004
|
-
const e = this.ua.get(t);
|
|
3005
|
-
if (!e) return;
|
|
3006
|
-
const i = this.ga(t);
|
|
3007
|
-
e.uninstall && await e.uninstall(this.la, i), this.ua.delete(t), this.fa.splice(this.fa.indexOf(t), 1), this.va(t);
|
|
3008
|
-
}
|
|
3009
|
-
ya() {
|
|
3010
|
-
this.wa(this.da);
|
|
3011
|
-
}
|
|
3012
|
-
ba() {
|
|
3013
|
-
this.wa(this.pa);
|
|
3014
|
-
}
|
|
3015
|
-
async $a() {
|
|
3016
|
-
const t = [...this.ua.keys()];
|
|
3017
|
-
for (const e of t) await this.ma(e);
|
|
3018
|
-
}
|
|
3019
|
-
ga(t) {
|
|
3020
|
-
return { renderer: this.la.N, font: this.la.er, grid: this.la.Ln, canvas: this.la.Rr, drawFramebuffer: this.la.na, asciiFramebuffer: this.la.Ca, registerPreDrawHook: (e) => this.Ma(this.da, t, e), registerPostDrawHook: (e) => this.Ma(this.pa, t, e) };
|
|
3021
|
-
}
|
|
3022
|
-
Ma(t, e, i) {
|
|
3023
|
-
const s = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
3024
|
-
return s.add(i), t.set(e, s), () => {
|
|
3025
|
-
const r = t.get(e);
|
|
3026
|
-
r && (r.delete(i), r.size === 0 && t.delete(e));
|
|
3027
|
-
};
|
|
3028
|
-
}
|
|
3029
|
-
va(t) {
|
|
3030
|
-
this.da.delete(t), this.pa.delete(t);
|
|
3031
|
-
}
|
|
3032
|
-
wa(t) {
|
|
3033
|
-
for (const e of this.fa) {
|
|
3034
|
-
const i = t.get(e);
|
|
3035
|
-
i && i.forEach((s) => s());
|
|
3036
|
-
}
|
|
3037
|
-
}
|
|
3038
|
-
}
|
|
3039
|
-
const Tt = `#version 300 es
|
|
3040
|
-
in vec2 A0;in vec2 A1;out vec2 v_uv;void main(){v_uv=A1;gl_Position=vec4(A0,0.,1.);}`;
|
|
3041
|
-
class Pt {
|
|
3042
|
-
constructor() {
|
|
3043
|
-
a(this, "xa", /* @__PURE__ */ new Map());
|
|
3044
|
-
a(this, "Fa", []);
|
|
3045
|
-
a(this, "Ta", 0);
|
|
3046
|
-
a(this, "Ra", 0);
|
|
3047
|
-
a(this, "Ea");
|
|
3048
|
-
}
|
|
3049
|
-
get Sa() {
|
|
3050
|
-
return this.Ta;
|
|
3051
|
-
}
|
|
3052
|
-
get ka() {
|
|
3053
|
-
if (this.Ta === 0) return 0;
|
|
3054
|
-
let t = 0;
|
|
3055
|
-
for (const e of this.Fa) {
|
|
3056
|
-
const i = this.xa.get(e);
|
|
3057
|
-
i && (t += Math.min(1, Math.max(0, i.progress)) * i.weight);
|
|
3058
|
-
}
|
|
3059
|
-
return Math.min(1, t / this.Ta);
|
|
3060
|
-
}
|
|
3061
|
-
Pa(t) {
|
|
3062
|
-
this.Ea = t;
|
|
3063
|
-
}
|
|
3064
|
-
La(t, e = 1) {
|
|
3065
|
-
const i = `phase-${this.Fa.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
|
|
3066
|
-
return this.xa.set(i, s), this.Fa.push(i), this.Ta += s.weight, i;
|
|
3067
|
-
}
|
|
3068
|
-
Ia(t, e) {
|
|
3069
|
-
const i = this.xa.get(t);
|
|
3070
|
-
if (!i) return;
|
|
3071
|
-
i.progress = Math.max(0, Math.min(1, e)), i.status = i.progress >= 1 ? "complete" : "running";
|
|
3072
|
-
const s = this.ka;
|
|
3073
|
-
Math.abs(s - this.Ra) > 1e-3 && (this.Ra = s, this.Ea && this.Ea(s));
|
|
3074
|
-
}
|
|
3075
|
-
za(t) {
|
|
3076
|
-
const e = this.xa.get(t);
|
|
3077
|
-
e && (e.progress = 1, e.status = "complete", this.Ia(t, 1));
|
|
3078
|
-
}
|
|
3079
|
-
Da(t) {
|
|
3080
|
-
const e = this.xa.get(t);
|
|
3081
|
-
e && (e.status = "failed");
|
|
3082
|
-
}
|
|
3083
|
-
Oa() {
|
|
3084
|
-
return this.Fa.map((t) => {
|
|
3085
|
-
const e = this.xa.get(t);
|
|
3086
|
-
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" };
|
|
3087
|
-
});
|
|
3088
|
-
}
|
|
3089
|
-
}
|
|
3090
|
-
class _t {
|
|
3091
|
-
constructor(t = "active") {
|
|
3092
|
-
a(this, "Ba");
|
|
3093
|
-
a(this, "Ga", "");
|
|
3094
|
-
a(this, "Wa", "");
|
|
3095
|
-
this.Ba = t;
|
|
3096
|
-
}
|
|
3097
|
-
get Ha() {
|
|
3098
|
-
return this.Ba;
|
|
3099
|
-
}
|
|
3100
|
-
get Ka() {
|
|
3101
|
-
return this.Ba !== "disabled";
|
|
3102
|
-
}
|
|
3103
|
-
get Ya() {
|
|
3104
|
-
return this.Ba === "active" || this.Ba === "transitioning" || this.Ba === "error";
|
|
3105
|
-
}
|
|
3106
|
-
get ja() {
|
|
3107
|
-
return this.Ga;
|
|
3108
|
-
}
|
|
3109
|
-
get Na() {
|
|
3110
|
-
return this.Wa;
|
|
3111
|
-
}
|
|
3112
|
-
Xa() {
|
|
3113
|
-
this.Ba !== "done" && this.Ba !== "transitioning" || (this.Ba = "active");
|
|
3114
|
-
}
|
|
3115
|
-
Za() {
|
|
3116
|
-
this.Ba !== "disabled" && (this.Ba = "done");
|
|
3117
|
-
}
|
|
3118
|
-
Va() {
|
|
3119
|
-
this.Ba !== "disabled" && (this.Ba = "transitioning");
|
|
3120
|
-
}
|
|
3121
|
-
qa() {
|
|
3122
|
-
this.Ba === "transitioning" && (this.Ba = "done");
|
|
3123
|
-
}
|
|
3124
|
-
Ja(t) {
|
|
3125
|
-
this.Ba !== "disabled" && (this.Ba = "error", t instanceof Error ? (this.Ga = t.message, this.Wa = t.stack || "") : (this.Ga = t, this.Wa = ""));
|
|
3126
|
-
}
|
|
3127
|
-
Qa() {
|
|
3128
|
-
this.Ba = "disabled";
|
|
3129
|
-
}
|
|
3130
|
-
}
|
|
3131
|
-
class St {
|
|
3132
|
-
constructor(t, e) {
|
|
3133
|
-
a(this, "tc", 0);
|
|
3134
|
-
a(this, "sc", 1);
|
|
3135
|
-
a(this, "ec");
|
|
3136
|
-
a(this, "rc");
|
|
3137
|
-
this.ec = t, this.rc = e;
|
|
3138
|
-
}
|
|
3139
|
-
get nc() {
|
|
3140
|
-
return this.sc;
|
|
3141
|
-
}
|
|
3142
|
-
get oc() {
|
|
3143
|
-
return this.sc < 1;
|
|
3144
|
-
}
|
|
3145
|
-
Mn() {
|
|
3146
|
-
this.ec !== "none" && this.rc > 0 && (this.tc = performance.now());
|
|
3147
|
-
}
|
|
3148
|
-
st() {
|
|
3149
|
-
if (this.ec === "none" || this.rc === 0) return this.sc = 1, !1;
|
|
3150
|
-
const t = performance.now() - this.tc, e = Math.min(1, t / this.rc);
|
|
3151
|
-
return e >= 1 ? (this.sc = 0, !0) : (this.sc = 1 - e, !1);
|
|
3152
|
-
}
|
|
3153
|
-
qs() {
|
|
3154
|
-
this.sc = 1, this.tc = 0;
|
|
3155
|
-
}
|
|
3156
|
-
}
|
|
3157
|
-
function gt(n, t) {
|
|
3158
|
-
const e = n.tone ?? "auto";
|
|
3159
|
-
let i = "dark";
|
|
3160
|
-
return e === "light" || e === "dark" ? i = e : t && (i = function(s) {
|
|
3161
|
-
if (!s) return 0;
|
|
3162
|
-
const [r, h, o] = s.map((l) => l / 255), c = (l) => l <= 0.04045 ? l / 12.92 : Math.pow((l + 0.055) / 1.055, 2.4);
|
|
3163
|
-
return 0.2126 * c(r) + 0.7152 * c(h) + 0.0722 * c(o);
|
|
3164
|
-
}(t) > 0.5 ? "light" : "dark"), { mode: i, background: t, textColor: i === "light" ? "#1A1A1A" : "#F8F8F8", subtleColor: i === "light" ? "#4A4A4A" : "#C0C0C0" };
|
|
3165
|
-
}
|
|
3166
|
-
function Bt(n) {
|
|
3167
|
-
return n.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
|
|
3168
|
-
}
|
|
3169
|
-
function Dt(n, t) {
|
|
3170
|
-
return n.length ? n.map((e) => t.color(e)) : [t.color("#FFFFFF")];
|
|
3171
|
-
}
|
|
3172
|
-
const Be = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: o, transitionOpacity: c, isError: l, errorMessage: u }) => {
|
|
3173
|
-
const f = "|/-\\", g = Math.floor(i / 6) % 4, p = n.color(h.textColor), m = Math.floor(255 * c), d = n.color(p.r, p.g, p.b, m);
|
|
3174
|
-
if (n.charColor(d), n.cellColor(0, 0, 0, 0), l) {
|
|
3175
|
-
const y = n.color(h.mode === "light" ? "#D32F2F" : "#FF6B6B", m);
|
|
3176
|
-
n.charColor(y), n.push(), n.translate(0, -2, 0), n.char("X"), n.rect(1, 1), n.pop();
|
|
3177
|
-
const v = "SETUP ERROR", w = -Math.floor(v.length / 2);
|
|
3178
|
-
n.push(), n.translate(w, 0, 0);
|
|
3179
|
-
for (const E of v) n.char(E), n.rect(1, 1), n.translateX(1);
|
|
3180
|
-
if (n.pop(), u) {
|
|
3181
|
-
const E = n.color(h.subtleColor), R = n.color(E.r, E.g, E.b, m);
|
|
3182
|
-
n.charColor(R);
|
|
3183
|
-
const T = Math.floor(0.8 * t.cols), A = u.split(" "), I = [];
|
|
3184
|
-
let x = "";
|
|
3185
|
-
for (const F of A) (x + " " + F).length <= T ? x = x ? x + " " + F : F : (x && I.push(x), x = F);
|
|
3186
|
-
x && I.push(x);
|
|
3187
|
-
const N = I.slice(0, 3);
|
|
3188
|
-
I.length > 3 && (N[2] = N[2].substring(0, T - 3) + "..."), N.forEach((F, J) => {
|
|
3189
|
-
const Ht = -Math.floor(F.length / 2);
|
|
3190
|
-
n.push(), n.translate(Ht, 3 + J, 0);
|
|
3191
|
-
for (const $t of F) n.char($t), n.rect(1, 1), n.translateX(1);
|
|
3192
|
-
n.pop();
|
|
3193
|
-
});
|
|
3194
|
-
}
|
|
3195
|
-
return;
|
|
3196
|
-
}
|
|
3197
|
-
if (n.push(), n.translate(0, 0, 0), n.char(f[g]), n.rect(1, 1), n.pop(), e > 0 || o.some((y) => y.status !== "pending")) {
|
|
3198
|
-
const y = Math.max(6, Math.floor(0.6 * t.cols)), v = -Math.floor(y / 2), w = Math.floor(y * e), E = r.length ? r : [n.color("#FFFFFF")];
|
|
3199
|
-
n.push(), n.translate(v, 3, 0);
|
|
3200
|
-
for (let R = 0; R < y; R++) {
|
|
3201
|
-
const T = R < w ? "*" : ".", A = E[R % E.length], I = n.color(A.r, A.g, A.b, m);
|
|
3202
|
-
n.charColor(I), n.char(T), n.rect(1, 1), n.translateX(1);
|
|
3203
|
-
}
|
|
3204
|
-
n.pop();
|
|
3205
|
-
}
|
|
3206
|
-
if (s) {
|
|
3207
|
-
const y = n.color(h.subtleColor), v = n.color(y.r, y.g, y.b, m);
|
|
3208
|
-
n.charColor(v);
|
|
3209
|
-
const w = -Math.floor(s.toUpperCase().length / 2);
|
|
3210
|
-
n.push(), n.translate(w, 5, 0);
|
|
3211
|
-
for (const E of s.toUpperCase()) n.char(E), n.rect(1, 1), n.translateX(1);
|
|
3212
|
-
n.pop();
|
|
3213
|
-
}
|
|
3214
|
-
}, De = { message: "loading...", tone: "auto", transition: "fade", transitionDuration: 500 };
|
|
3215
|
-
class Oe {
|
|
3216
|
-
constructor(t, e, i) {
|
|
3217
|
-
this.hc = t, this.id = e, this.label = i;
|
|
3218
|
-
}
|
|
3219
|
-
report(t) {
|
|
3220
|
-
this.hc.Ia(this.id, t);
|
|
3221
|
-
}
|
|
3222
|
-
complete() {
|
|
3223
|
-
this.hc.za(this.id);
|
|
3224
|
-
}
|
|
3225
|
-
fail(t) {
|
|
3226
|
-
this.hc.Da(this.id);
|
|
3227
|
-
}
|
|
3228
|
-
async track(t) {
|
|
3229
|
-
try {
|
|
3230
|
-
const e = typeof t == "function" ? await t() : await t;
|
|
3231
|
-
return this.complete(), e;
|
|
3232
|
-
} catch (e) {
|
|
3233
|
-
throw this.fail(), e;
|
|
3234
|
-
}
|
|
3235
|
-
}
|
|
3236
|
-
}
|
|
3237
|
-
class Ot {
|
|
3238
|
-
constructor(t, e, i) {
|
|
3239
|
-
a(this, "la");
|
|
3240
|
-
a(this, "l");
|
|
3241
|
-
a(this, "ac");
|
|
3242
|
-
a(this, "hc");
|
|
3243
|
-
a(this, "cc");
|
|
3244
|
-
a(this, "lc");
|
|
3245
|
-
a(this, "uc");
|
|
3246
|
-
a(this, "fc");
|
|
3247
|
-
a(this, "dc");
|
|
3248
|
-
a(this, "_c");
|
|
3249
|
-
a(this, "N");
|
|
3250
|
-
a(this, "gc", []);
|
|
3251
|
-
a(this, "vc");
|
|
3252
|
-
a(this, "mc", performance.now());
|
|
3253
|
-
a(this, "yc", 0);
|
|
3254
|
-
a(this, "wc", !1);
|
|
3255
|
-
a(this, "bc", !1);
|
|
3256
|
-
a(this, "xc");
|
|
3257
|
-
this.la = t, this.l = { ...De, ...e ?? {} }, this.ac = new _t("active"), this.hc = new Pt(), this.cc = new St(this.l.transition, this.l.transitionDuration), this.lc = new Ut(60), this.vc = gt(this.l, i);
|
|
3258
|
-
const s = Bt(this.vc);
|
|
3259
|
-
this.gc = Dt(s, this.la), this.N = this.$c(), this.hc.Pa((r) => {
|
|
3260
|
-
r >= 0.999 && this.Za();
|
|
3261
|
-
});
|
|
3262
|
-
}
|
|
3263
|
-
async mr(t) {
|
|
3264
|
-
if (this.bc) return;
|
|
3265
|
-
const e = this.la.N, i = this.la.Rr;
|
|
3266
|
-
this.uc = new mt(e, 16), await this.uc.mr(t);
|
|
3267
|
-
const s = this.uc.maxGlyphDimensions;
|
|
3268
|
-
this.fc = new Ft(i.canvas, s.width, s.height), this.dc = e.$e(this.fc.cols, this.fc.rows, 3), this._c = e.$e(this.fc.width, this.fc.height, 1), this.bc = !0;
|
|
3269
|
-
}
|
|
3270
|
-
get Ya() {
|
|
3271
|
-
return this.ac.Ya && this.wc;
|
|
3272
|
-
}
|
|
3273
|
-
Mn() {
|
|
3274
|
-
this.wc || (this.wc = !0, this.mc = performance.now(), this.yc = 0, this.lc.Mn(() => this.Cc()));
|
|
3275
|
-
}
|
|
3276
|
-
xn() {
|
|
3277
|
-
this.wc && (this.wc = !1, this.lc.xn());
|
|
3278
|
-
}
|
|
3279
|
-
Hr() {
|
|
3280
|
-
this.bc && (this.fc.qs(), this.dc.resize(this.fc.cols, this.fc.rows), this._c.resize(this.fc.width, this.fc.height));
|
|
3281
|
-
}
|
|
3282
|
-
O() {
|
|
3283
|
-
this.xn(), this.bc && (this.uc.O(), this.dc.O(), this._c.O(), this.bc = !1);
|
|
3284
|
-
}
|
|
3285
|
-
get progress() {
|
|
3286
|
-
return this.hc.ka;
|
|
3287
|
-
}
|
|
3288
|
-
message(t) {
|
|
3289
|
-
return typeof t == "string" && (this.l.message = t), this.l.message;
|
|
3290
|
-
}
|
|
3291
|
-
addPhase(t, e = 1) {
|
|
3292
|
-
this.ac.Xa();
|
|
3293
|
-
const i = this.hc.La(t, e);
|
|
3294
|
-
return new Oe(this.hc, i, t);
|
|
3295
|
-
}
|
|
3296
|
-
Za() {
|
|
3297
|
-
this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.ac.Va(), this.cc.Mn()) : (this.ac.Za(), this.xn(), this.Mc());
|
|
3298
|
-
}
|
|
3299
|
-
Mc() {
|
|
3300
|
-
this.xc && this.xc();
|
|
3301
|
-
}
|
|
3302
|
-
Fc(t) {
|
|
3303
|
-
this.xc = t;
|
|
3304
|
-
}
|
|
3305
|
-
error(t) {
|
|
3306
|
-
this.ac.Ja(t);
|
|
3307
|
-
}
|
|
3308
|
-
Cc() {
|
|
3309
|
-
if (this.ac.Ya) {
|
|
3310
|
-
if (this.yc++, this.ac.Ha === "transitioning" && this.cc.st())
|
|
3311
|
-
return this.ac.qa(), this.Mc(), void this.xn();
|
|
3312
|
-
this.Tc();
|
|
3313
|
-
}
|
|
3314
|
-
}
|
|
3315
|
-
Tc() {
|
|
3316
|
-
if (!this.bc) return;
|
|
3317
|
-
const t = this.dc, e = this.uc, i = this.fc, s = this._c, r = this.la.N, h = this.la.Rr, o = this.la.Rc, c = this.la.Ec;
|
|
3318
|
-
r.state.Xt(), t.begin(), this.la.clear(), this.la.push();
|
|
3319
|
-
try {
|
|
3320
|
-
const l = { textmodifier: this.la, grid: i, progress: this.progress, elapsedMs: performance.now() - this.mc, frameCount: this.yc, message: this.l.message, palette: this.gc, theme: this.vc, phases: this.hc.Oa(), transitionOpacity: this.cc.nc, isError: this.ac.Ha === "error", errorMessage: this.ac.ja || void 0, errorDetails: this.ac.Na || void 0 };
|
|
3321
|
-
this.N(l);
|
|
3322
|
-
} finally {
|
|
3323
|
-
this.la.pop();
|
|
3324
|
-
}
|
|
3325
|
-
t.end(), s.begin(), r.ce(o), o.L({ U0: e.fontFramebuffer, U1: [e.textureColumns, e.textureRows], U2: t.textures[0], U3: t.textures[1], U4: t.textures[2], U5: [i.cols, i.rows], U6: [s.width, s.height], U7: r.state.canvasBackgroundColor }), r._e(0, 0, h.width, h.height), s.end(), r.mi(...r.state.canvasBackgroundColor), r.ce(c), c.L({ U8: s.textures[0], U9: [s.width, s.height], Ua: [i.offsetX, i.offsetY], Ub: [i.width, i.height] }), r._e(i.offsetX, i.offsetY, i.width, i.height);
|
|
3326
|
-
}
|
|
3327
|
-
Sc(t) {
|
|
3328
|
-
this.vc = gt(this.l, t);
|
|
3329
|
-
}
|
|
3330
|
-
$c() {
|
|
3331
|
-
const t = this.l.renderer || Be;
|
|
3332
|
-
return (e) => {
|
|
3333
|
-
t(e), this.kc(e);
|
|
3334
|
-
};
|
|
3335
|
-
}
|
|
3336
|
-
kc(t) {
|
|
3337
|
-
const { textmodifier: e, grid: i, frameCount: s, theme: r, transitionOpacity: h } = t, o = [116, 101, 120, 116, 109, 111, 100, 101, 46, 106, 115].map((f) => String.fromCharCode(f)).join(""), c = (i.rows + 1 >> 1) - 2, l = 2 - (i.cols + 1 >> 1), u = r.mode === "light" ? [[233, 30, 99], [156, 39, 176], [255, 111, 0]] : [[142, 249, 243], [241, 91, 181], [255, 155, 113]];
|
|
3338
|
-
e.push(), e.translate(l, c, 0);
|
|
3339
|
-
for (let f = 0; f < o.length; f++) {
|
|
3340
|
-
const g = o[f], p = Math.floor(0.1 * s + 0.5 * f) % u.length, [m, d, y] = u[p], v = Math.floor(255 * h), w = e.color(m, d, y, v);
|
|
3341
|
-
e.charColor(w), e.char(g), e.point(), e.translateX(1);
|
|
3342
|
-
}
|
|
3343
|
-
e.pop();
|
|
3344
|
-
}
|
|
3345
|
-
}
|
|
3346
|
-
class He extends function(e, ...i) {
|
|
3347
|
-
return i.reduce((s, r) => r(s), e);
|
|
3348
|
-
}(class {
|
|
3349
|
-
}, Ue, Me, Ie, Ne, Pe, _e) {
|
|
3350
|
-
constructor(e = {}) {
|
|
3351
|
-
super();
|
|
3352
|
-
a(this, "N");
|
|
3353
|
-
a(this, "er");
|
|
3354
|
-
a(this, "Rr");
|
|
3355
|
-
a(this, "Ln");
|
|
3356
|
-
a(this, "ha");
|
|
3357
|
-
a(this, "Io");
|
|
3358
|
-
a(this, "oa");
|
|
3359
|
-
a(this, "ca");
|
|
3360
|
-
a(this, "Pc");
|
|
3361
|
-
a(this, "na");
|
|
3362
|
-
a(this, "Rc");
|
|
3363
|
-
a(this, "Ca");
|
|
3364
|
-
a(this, "Ec");
|
|
3365
|
-
a(this, "Lc");
|
|
3366
|
-
a(this, "Ic", !1);
|
|
3367
|
-
a(this, "zc", !1);
|
|
3368
|
-
a(this, "Dc", !1);
|
|
3369
|
-
a(this, "Oc", !1);
|
|
3370
|
-
a(this, "Bc", () => {
|
|
3371
|
-
});
|
|
3372
|
-
a(this, "Gc", () => {
|
|
3373
|
-
});
|
|
3374
|
-
a(this, "Wc", () => {
|
|
3375
|
-
});
|
|
3376
|
-
a(this, "Hc");
|
|
3377
|
-
a(this, "Kc");
|
|
3378
|
-
a(this, "Lr", !1);
|
|
3379
|
-
a(this, "Yc");
|
|
3380
|
-
this.Lc = new Se(this), this.Lr = e.overlay ?? !1, this.Rr = new Ae(e), this.N = new oe(this.Rr.Kr()), this.er = new mt(this.N, e.fontSize ?? 16), this.ha = new Ut(e.frameRate ?? 60), this.Pc = new Ot(this, e.loadingScreen, this.Rr.Wr()), this.Pc.Fc(() => {
|
|
3381
|
-
this.ha.kn = 0, this.Oc = !0;
|
|
3382
|
-
}), this.Io = new Mt(this.Rr), this.oa = new Nt(this.Rr, this.Io), this.ca = new It(), this.Rc = this.N.le(Tt, `#version 300 es
|
|
3383
|
-
precision highp float;uniform sampler2D U0;uniform vec2 U1;uniform sampler2D U3;uniform sampler2D U4;uniform sampler2D U2;uniform vec2 U5;uniform vec2 U6;uniform vec4 U7;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/U6;vec2 F=E*U5;vec2 G=floor(F);vec2 H=(G+0.5)/U5;vec4 I=texture(U3,H);vec4 J=texture(U4,H);vec4 K=texture(U2,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(U1.x);int R=P/Q;int S=P-(R*Q);float T=(U1.y-1.)-float(R);vec2 U=1./U1;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(U0,a);if(M)c.rgb=mix(c.rgb,1.-c.rgb,float(M));vec4 d=mix(U7,J,J.a);fragColor=mix(d,I,c);}`), this.Pc.Mn(), this.jc(e);
|
|
3384
|
-
}
|
|
3385
|
-
async jc(e) {
|
|
3386
|
-
await Promise.all([this.er.mr(e.fontSource), this.Pc.mr(e.fontSource)]);
|
|
3387
|
-
const i = this.er.maxGlyphDimensions;
|
|
3388
|
-
this.Ln = new Ft(this.Rr.canvas, i.width, i.height), this.Io.mr(this.Ln), this.oa.mr(this.Ln), this.na = this.N.$e(this.Ln.cols, this.Ln.rows, 3), this.Ca = this.N.$e(this.Ln.width, this.Ln.height, 1), this.Lr && (this.Yc = Y.pn(this.N, this.Rr.targetCanvas, this.Ln.cols, this.Ln.rows, (s) => this.er.ir(s))), this.Ec = this.N.le(Tt, `#version 300 es
|
|
3389
|
-
precision highp float;uniform sampler2D U8;uniform vec2 U9;uniform vec2 Ua;uniform vec2 Ub;in vec2 v_uv;out vec4 fragColor;void main(){vec2 A=gl_FragCoord.xy-Ua;vec2 B=A*(U9/Ub);vec2 C=(floor(B)+0.5)/U9;fragColor=texture(U8,C);}`), this.Nc(), this.ha.Mn(() => this.aa()), await this.Lc._a(e.plugins ?? []);
|
|
3390
|
-
try {
|
|
3391
|
-
await this.Bc(), this.Pc.Za();
|
|
3392
|
-
} catch (s) {
|
|
3393
|
-
console.error("Error during setup:", s), this.Pc.error(s);
|
|
3394
|
-
}
|
|
3395
|
-
}
|
|
3396
|
-
Nc() {
|
|
3397
|
-
this.Hc = () => {
|
|
3398
|
-
this.Lr && this.resizeCanvas(this.Rr.targetCanvas.width, this.Rr.targetCanvas.height), this.Wc();
|
|
3399
|
-
}, window.addEventListener("resize", this.Hc), this.Io.eo(), this.oa.eo(), this.ca.eo(), window.addEventListener("blur", () => {
|
|
3400
|
-
this.ca.Lo();
|
|
3401
|
-
}), this.Lr && (this.Kc = new ResizeObserver(() => {
|
|
3402
|
-
this.resizeCanvas(this.Rr.targetCanvas.width, this.Rr.targetCanvas.height);
|
|
3403
|
-
}), this.Kc.observe(this.Rr.targetCanvas));
|
|
3404
|
-
}
|
|
3405
|
-
aa() {
|
|
3406
|
-
if (!this.Pc.Ya && this.Oc) {
|
|
3407
|
-
this.zc = !0;
|
|
3408
|
-
try {
|
|
3409
|
-
this.ha.Rn(), this.ha.Pn(), this.Lr && bt(this.N.context, this.Yc.texture, this.Rr.targetCanvas), this.Lc.ya(), this.N.state.Xt(), this.na.begin(), this.Gc(), this.na.end(), this.Ca.begin(), this.N.ce(this.Rc), this.Rc.L({ U0: this.er.fontFramebuffer, U1: [this.er.textureColumns, this.er.textureRows], U2: this.na.textures[0], U3: this.na.textures[1], U4: this.na.textures[2], U5: [this.Ln.cols, this.Ln.rows], U6: [this.Ca.width, this.Ca.height], U7: this.N.state.canvasBackgroundColor }), this.N._e(0, 0, this.Rr.width, this.Rr.height), this.Ca.end(), this.N.mi(...this.N.state.canvasBackgroundColor), this.N.ce(this.Ec), this.Ec.L({ U8: this.Ca.textures[0], U9: [this.Ca.width, this.Ca.height], Ua: [this.Ln.offsetX, this.Ln.offsetY], Ub: [this.Ln.width, this.Ln.height] }), this.N._e(this.Ln.offsetX, this.Ln.offsetY, this.Ln.width, this.Ln.height), this.Lc.ba();
|
|
3410
|
-
} finally {
|
|
3411
|
-
this.zc = !1, this.Ic && !this.Dc && this.Xc();
|
|
3412
|
-
}
|
|
3413
|
-
}
|
|
3414
|
-
}
|
|
3415
|
-
resizeCanvas(e, i) {
|
|
3416
|
-
this.Rr.Hr(e, i), this.Pc.Sc(this.Rr.Wr()), this.Ln.qs(), this.Pc.Hr(), this.na.resize(this.Ln.cols, this.Ln.rows), this.Ca.resize(this.Ln.width, this.Ln.height), this.N.Me(), this.Io.io(), this.oa.io(), this.aa();
|
|
3417
|
-
}
|
|
3418
|
-
destroy() {
|
|
3419
|
-
this.Dc || this.Ic || (this.Ic = !0, this.ha.An(), this.zc || this.Xc());
|
|
3420
|
-
}
|
|
3421
|
-
Xc() {
|
|
3422
|
-
var e, i;
|
|
3423
|
-
this.Ic = !1, this.Pc.O(), this.Lc.$a(), window.removeEventListener("resize", this.Hc), (e = this.Kc) == null || e.disconnect(), this.Io.lo(), this.oa.lo(), this.ca.lo(), this.na.O(), this.Rc.O(), this.er.O(), this.N.O(), this.Ca.O(), this.Ec.O(), (i = this.Yc) == null || i.O(), this.Rr.O(), this.Dc = !0;
|
|
3424
|
-
}
|
|
3425
|
-
setup(e) {
|
|
3426
|
-
this.Bc = e;
|
|
3427
|
-
}
|
|
3428
|
-
draw(e) {
|
|
3429
|
-
this.Gc = e;
|
|
3430
|
-
}
|
|
3431
|
-
windowResized(e) {
|
|
3432
|
-
this.Wc = e;
|
|
3433
|
-
}
|
|
3434
|
-
get grid() {
|
|
3435
|
-
return this.Ln;
|
|
3436
|
-
}
|
|
3437
|
-
get font() {
|
|
3438
|
-
return this.er;
|
|
3439
|
-
}
|
|
3440
|
-
get width() {
|
|
3441
|
-
return this.Rr.width;
|
|
3442
|
-
}
|
|
3443
|
-
get height() {
|
|
3444
|
-
return this.Rr.height;
|
|
3445
|
-
}
|
|
3446
|
-
get canvas() {
|
|
3447
|
-
return this.Rr.canvas;
|
|
3448
|
-
}
|
|
3449
|
-
get drawFramebuffer() {
|
|
3450
|
-
return this.na;
|
|
3451
|
-
}
|
|
3452
|
-
get isDisposed() {
|
|
3453
|
-
return this.Dc;
|
|
3454
|
-
}
|
|
3455
|
-
get overlay() {
|
|
3456
|
-
return this.Yc;
|
|
3457
|
-
}
|
|
3458
|
-
get loading() {
|
|
3459
|
-
return this.Pc;
|
|
3460
|
-
}
|
|
3461
|
-
}
|
|
3462
|
-
class vt {
|
|
3463
|
-
constructor() {
|
|
3464
|
-
}
|
|
3465
|
-
static create(t = {}) {
|
|
3466
|
-
return new He(t);
|
|
3467
|
-
}
|
|
3468
|
-
static setErrorLevel(t) {
|
|
3469
|
-
V.m(t);
|
|
3470
|
-
}
|
|
3471
|
-
static get version() {
|
|
3472
|
-
return "0.6.0-beta.2";
|
|
3473
|
-
}
|
|
3474
|
-
}
|
|
3475
|
-
const Ge = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhaseTracker: Pt, LoadingScreenManager: Ot, LoadingScreenStateMachine: _t, LoadingScreenTransition: St, resolveColorInputs: Dt, resolveDefaultPalette: Bt, resolveTheme: gt }, Symbol.toStringTag, { value: "Module" })), Ye = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: mt, TextmodeImage: Y, TextmodeVideo: ht }, Symbol.toStringTag, { value: "Module" })), Xe = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: Ce, mouse: Le, touch: Fe }, Symbol.toStringTag, { value: "Module" })), ze = vt.create, We = vt.setErrorLevel, je = vt.version;
|
|
3476
|
-
export {
|
|
3477
|
-
Ae as TextmodeCanvas,
|
|
3478
|
-
C as TextmodeColor,
|
|
3479
|
-
Xt as TextmodeErrorLevel,
|
|
3480
|
-
it as TextmodeFramebuffer,
|
|
3481
|
-
Ft as TextmodeGrid,
|
|
3482
|
-
He as Textmodifier,
|
|
3483
|
-
ze as create,
|
|
3484
|
-
Xe as input,
|
|
3485
|
-
Ye as loadables,
|
|
3486
|
-
Ge as loading,
|
|
3487
|
-
We as setErrorLevel,
|
|
3488
|
-
vt as textmode,
|
|
3489
|
-
je as version
|
|
3490
|
-
};
|