textmode.js 0.7.1-beta.5 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
- var Vt = Object.defineProperty;
2
- var jt = (n, t, e) => t in n ? Vt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var a = (n, t, e) => jt(n, typeof t != "symbol" ? t + "" : t, e);
4
- class S extends Error {
1
+ var Qt = Object.defineProperty;
2
+ var qt = (n, t, e) => t in n ? Qt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var a = (n, t, e) => qt(n, typeof t != "symbol" ? t + "" : t, e);
4
+ class U extends Error {
5
5
  constructor(t, e = {}) {
6
- super(S.i(t, e)), this.name = "TextmodeError";
6
+ super(U.i(t, e)), this.name = "TextmodeError";
7
7
  }
8
8
  static i(t, e) {
9
9
  return `${t}${e && Object.keys(e).length > 0 ? `
10
10
 
11
11
  📋 Context:` + Object.entries(e).map(([i, s]) => `
12
- - ${i}: ${S.h(s)}`).join("") : ""}
12
+ - ${i}: ${U.h(s)}`).join("") : ""}
13
13
 
14
14
  ${"↓".repeat(24)}
15
15
  `;
@@ -19,21 +19,21 @@ ${"↓".repeat(24)}
19
19
  if (t === void 0) return "undefined";
20
20
  if (typeof t == "string") return `"${t}"`;
21
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) => S.h(e)).join(", ")}]` : `[${t.slice(0, 3).map((e) => S.h(e)).join(", ")}, ... +${t.length - 3} more]`;
22
+ if (Array.isArray(t)) return t.length === 0 ? "[]" : t.length <= 5 ? `[${t.map((e) => U.h(e)).join(", ")}]` : `[${t.slice(0, 3).map((e) => U.h(e)).join(", ")}, ... +${t.length - 3} more]`;
23
23
  if (typeof t == "object") {
24
24
  const e = Object.keys(t);
25
- return e.length === 0 ? "{}" : e.length <= 3 ? `{ ${e.map((i) => `${i}: ${S.h(t[i])}`).join(", ")} }` : `{ ${e.slice(0, 2).map((i) => `${i}: ${S.h(t[i])}`).join(", ")}, ... +${e.length - 2} more }`;
25
+ return e.length === 0 ? "{}" : e.length <= 3 ? `{ ${e.map((i) => `${i}: ${U.h(t[i])}`).join(", ")} }` : `{ ${e.slice(0, 2).map((i) => `${i}: ${U.h(t[i])}`).join(", ")}, ... +${e.length - 2} more }`;
26
26
  }
27
27
  return t + "";
28
28
  }
29
29
  }
30
30
  var Jt = ((n) => (n[n.SILENT = 0] = "SILENT", n[n.WARNING = 1] = "WARNING", n[n.ERROR = 2] = "ERROR", n[n.THROW = 3] = "THROW", n))(Jt || {});
31
- const I = class I {
31
+ const B = class B {
32
32
  constructor() {
33
33
  a(this, "l", { globalLevel: 3 });
34
34
  }
35
35
  static u() {
36
- return I.o || (I.o = new I()), I.o;
36
+ return B.o || (B.o = new B()), B.o;
37
37
  }
38
38
  v(t, e) {
39
39
  const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.", s = "color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;";
@@ -41,11 +41,11 @@ const I = class I {
41
41
  case 0:
42
42
  return !1;
43
43
  case 1:
44
- return console.group(i, s), console.warn(S.i(t, e)), console.groupEnd(), !1;
44
+ return console.group(i, s), console.warn(U.i(t, e)), console.groupEnd(), !1;
45
45
  case 2:
46
- return console.group(i, s), console.error(S.i(t, e)), console.groupEnd(), !1;
46
+ return console.group(i, s), console.error(U.i(t, e)), console.groupEnd(), !1;
47
47
  default:
48
- throw new S(t, e);
48
+ throw new U(t, e);
49
49
  }
50
50
  }
51
51
  m(t, e, i) {
@@ -55,10 +55,10 @@ const I = class I {
55
55
  this.l.globalLevel = t;
56
56
  }
57
57
  };
58
- a(I, "o", null);
59
- let lt = I;
60
- const mt = lt.u();
61
- class k {
58
+ a(B, "o", null);
59
+ let lt = B;
60
+ const vt = lt.u();
61
+ class H {
62
62
  constructor(t, e, i) {
63
63
  a(this, "A");
64
64
  a(this, "C");
@@ -115,7 +115,7 @@ class k {
115
115
  const u = this.H(t);
116
116
  return o.uniform1i(i, u), o.activeTexture(o.TEXTURE0 + u), void o.bindTexture(o.TEXTURE_2D, e);
117
117
  }
118
- if (e instanceof H) {
118
+ if (e instanceof j) {
119
119
  const u = this.H(t);
120
120
  return o.uniform1i(i, u), o.activeTexture(o.TEXTURE0 + u), void o.bindTexture(o.TEXTURE_2D, e.textures[0]);
121
121
  }
@@ -143,19 +143,19 @@ class k {
143
143
  this.A.deleteProgram(this.C);
144
144
  }
145
145
  }
146
- function yt(n, t, e, i) {
146
+ function Et(n, t, e, i) {
147
147
  return 180 * Math.atan2(i - t, e - n) / Math.PI;
148
148
  }
149
149
  function z(n, t, e, i) {
150
150
  return Math.hypot(e - n, i - t);
151
151
  }
152
- function O(n, t, e) {
152
+ function Z(n, t, e) {
153
153
  return Math.min(Math.max(n, t), e);
154
154
  }
155
- function Rt(n) {
155
+ function Tt(n) {
156
156
  return (n % 360 + 360) % 360 / 360;
157
157
  }
158
- function Tt(n, t, e) {
158
+ function Rt(n, t, e) {
159
159
  n.bindTexture(n.TEXTURE_2D, t), n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, 1), n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, e), n.bindTexture(n.TEXTURE_2D, null);
160
160
  }
161
161
  function et(n, t, e, i, s) {
@@ -168,7 +168,7 @@ function Ct(n, t, e, i, s) {
168
168
  n.bindBuffer(t, e), n.bufferData(t, i, s), n.bindBuffer(t, null);
169
169
  }
170
170
  const it = `#version 300 es
171
- in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in vec4 A7;in vec3 A8;in vec3 A9;in vec4 Aa;in vec4 Ab;in vec3 Ac;uniform vec2 U9;uniform float Ua;uniform float Ub;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/U9)*2.0f;AA.y=-AA.y;float AB=y.z/U9.y;float AC=clamp(-AB*Ua,-0.99f,0.99f);if(Ub>0.5f){gl_Position=vec4(AA,AC,1.0f);}else{float AD=0.5f;float AE=1.0f/(1.0f-AB*AD);AA*=AE;gl_Position=vec4(AA,AC,1.0f);}}`, X = class X {
171
+ in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in vec4 A7;in vec3 A8;in vec3 A9;in vec4 Aa;in vec4 Ab;in vec3 Ac;uniform vec2 Ud;uniform float Ue;uniform float Uf;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/Ud)*2.0f;AA.y=-AA.y;float AB=y.z/Ud.y;float AC=clamp(-AB*Ue,-0.99f,0.99f);if(Uf>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 {
172
172
  constructor(t, e, i = e, s = 1, r = {}, h) {
173
173
  a(this, "N");
174
174
  a(this, "X");
@@ -181,8 +181,8 @@ in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in
181
181
  a(this, "Z");
182
182
  a(this, "q", null);
183
183
  a(this, "V", /* @__PURE__ */ new Map());
184
- this.N = e, this.X = i, this.A = t, this.K = O(s, 1, 8), this.Z = h, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...r }, X.J || (X.J = new k(t, it, `#version 300 es
185
- precision highp float;in vec2 v_uv;uniform sampler2D U1;uniform sampler2D U2;uniform sampler2D U3;uniform sampler2D U4;uniform vec2 U5;uniform bool U6;uniform bool U7;uniform bool U8;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){vec2 B=vec2(v_uv.x,1.-v_uv.y);vec2 C=B*U5;vec2 D=(floor(C)+0.5f)/U5;vec4 E=texture(U1,D);vec4 F=U6?texture(U2,D):vec4(0.);if(U6&&F.a==0.){discard;}vec4 G=U7?texture(U3,D):vec4(0.);vec4 H=U8?texture(U4,D):vec4(0.);o_character=E;o_primaryColor=F;o_secondaryColor=G;A=H;}`));
184
+ this.N = e, this.X = i, this.A = t, this.K = Z(s, 1, 8), this.Z = h, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...r }, O.J || (O.J = new H(t, it, `#version 300 es
185
+ precision highp float;in vec2 v_uv;uniform sampler2D U5;uniform sampler2D U6;uniform sampler2D U7;uniform sampler2D U8;uniform vec2 U9;uniform bool Ua;uniform bool Ub;uniform bool Uc;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){vec2 B=vec2(v_uv.x,1.-v_uv.y);vec2 C=B*U9;vec2 D=(floor(C)+0.5f)/U9;vec4 E=texture(U5,D);vec4 F=Ua?texture(U6,D):vec4(0.);if(Ua&&F.a==0.){discard;}vec4 G=Ub?texture(U7,D):vec4(0.);vec4 H=Uc?texture(U8,D):vec4(0.);o_character=E;o_primaryColor=F;o_secondaryColor=G;A=H;}`));
186
186
  const o = t.getParameter(t.MAX_DRAW_BUFFERS), c = t.getParameter(t.MAX_COLOR_ATTACHMENTS);
187
187
  this.K = Math.min(this.K, o, c), this.Y = t.createFramebuffer(), this.tt(), this.st(), this.l.depth && this.it();
188
188
  }
@@ -212,7 +212,7 @@ precision highp float;in vec2 v_uv;uniform sampler2D U1;uniform sampler2D U2;uni
212
212
  this.W = t.createRenderbuffer(), t.bindRenderbuffer(t.RENDERBUFFER, this.W), t.renderbufferStorage(t.RENDERBUFFER, t.DEPTH_COMPONENT24, this.N, this.X), t.bindFramebuffer(t.FRAMEBUFFER, this.Y), t.framebufferRenderbuffer(t.FRAMEBUFFER, t.DEPTH_ATTACHMENT, t.RENDERBUFFER, this.W), t.bindFramebuffer(t.FRAMEBUFFER, null), t.bindRenderbuffer(t.RENDERBUFFER, null);
213
213
  }
214
214
  et(t) {
215
- Tt(this.A, this.j[0], t);
215
+ Rt(this.A, this.j[0], t);
216
216
  }
217
217
  resize(t, e) {
218
218
  this.N = t, this.X = e, this.V.clear();
@@ -244,7 +244,7 @@ precision highp float;in vec2 v_uv;uniform sampler2D U1;uniform sampler2D U2;uni
244
244
  }
245
245
  ft() {
246
246
  if (!this.Z) return;
247
- const t = this.K > 1, e = this.K > 2, i = this.K > 3, s = { U1: this.j[0], U2: t ? this.j[1] : this.j[0], U3: e ? this.j[2] : this.j[0], U4: i ? this.j[3] : this.j[0], U5: [this.N, this.X], U6: t, U7: e, U8: i }, r = X.J;
247
+ const t = this.K > 1, e = this.K > 2, i = this.K > 3, s = { U5: this.j[0], U6: t ? this.j[1] : this.j[0], U7: e ? this.j[2] : this.j[0], U8: i ? this.j[3] : this.j[0], U9: [this.N, this.X], Ua: t, Ub: e, Uc: i }, r = O.J;
248
248
  this.q = this.Z.vt.dt(r, s, !0);
249
249
  }
250
250
  gt() {
@@ -266,8 +266,8 @@ precision highp float;in vec2 v_uv;uniform sampler2D U1;uniform sampler2D U2;uni
266
266
  return this.K;
267
267
  }
268
268
  };
269
- a(X, "J", null);
270
- let H = X;
269
+ a(O, "J", null);
270
+ let j = O;
271
271
  const Ft = /* @__PURE__ */ new WeakMap();
272
272
  function nt(n, t) {
273
273
  Ft.set(n, t);
@@ -365,7 +365,7 @@ class st {
365
365
  this.Rt = t;
366
366
  }
367
367
  vs(t) {
368
- this.Et = Rt(t);
368
+ this.Et = Tt(t);
369
369
  }
370
370
  ps(t, e, i, s) {
371
371
  tt(this.St, t, e, i, s);
@@ -389,7 +389,7 @@ class st {
389
389
  return this.xt;
390
390
  }
391
391
  }
392
- const ft = 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]), Z = { _s: 16, As: WebGL2RenderingContext.TRIANGLES, bs: { ws: { size: 2, offset: 0 }, Cs: { size: 2, offset: 8 } } };
392
+ const ft = new Float32Array([-0.5, -0.5, 0, 0, 0.5, -0.5, 1, 0, -0.5, 0.5, 0, 1, -0.5, 0.5, 0, 1, 0.5, -0.5, 1, 0, 0.5, 0.5, 1, 1]), Y = { _s: 16, As: WebGL2RenderingContext.TRIANGLES, bs: { ws: { size: 2, offset: 0 }, Cs: { size: 2, offset: 8 } } };
393
393
  class $t {
394
394
  constructor(t) {
395
395
  a(this, "A");
@@ -398,18 +398,18 @@ class $t {
398
398
  this.A = t, this.Ms = t.createBuffer(), this.Fs = new Float32Array(ft.length);
399
399
  }
400
400
  Ps(t, e, i, s) {
401
- const r = this.A, h = Pt(this.A), o = h[2], c = h[3], l = t / o * 2 - 1, u = (t + i) / o * 2 - 1, f = 1 - (e + s) / c * 2, d = 1 - e / c * 2, g = ft, v = this.Fs;
402
- for (let m = 0; m < g.length; m += 4) {
403
- const A = g[m], p = g[m + 1], w = g[m + 2], y = g[m + 3], x = l + (A + 0.5) * (u - l), b = f + (p + 0.5) * (d - f);
404
- v[m] = x, v[m + 1] = b, v[m + 2] = w, v[m + 3] = y;
401
+ const r = this.A, h = Pt(this.A), o = h[2], c = h[3], l = t / o * 2 - 1, u = (t + i) / o * 2 - 1, f = 1 - (e + s) / c * 2, d = 1 - e / c * 2, g = ft, m = this.Fs;
402
+ for (let v = 0; v < g.length; v += 4) {
403
+ const A = g[v], p = g[v + 1], y = g[v + 2], E = g[v + 3], b = l + (A + 0.5) * (u - l), x = f + (p + 0.5) * (d - f);
404
+ m[v] = b, m[v + 1] = x, m[v + 2] = y, m[v + 3] = E;
405
405
  }
406
- r.bindBuffer(r.ARRAY_BUFFER, this.Ms), r.bufferData(r.ARRAY_BUFFER, v, r.DYNAMIC_DRAW), r.enableVertexAttribArray(0), r.vertexAttribPointer(0, 2, r.FLOAT, !1, 16, 0), r.enableVertexAttribArray(1), r.vertexAttribPointer(1, 2, r.FLOAT, !1, 16, 8), r.drawArrays(r.TRIANGLES, 0, 6), r.disableVertexAttribArray(1), r.disableVertexAttribArray(0), r.bindBuffer(r.ARRAY_BUFFER, null);
406
+ r.bindBuffer(r.ARRAY_BUFFER, this.Ms), r.bufferData(r.ARRAY_BUFFER, m, r.DYNAMIC_DRAW), r.enableVertexAttribArray(0), r.vertexAttribPointer(0, 2, r.FLOAT, !1, 16, 0), r.enableVertexAttribArray(1), r.vertexAttribPointer(1, 2, r.FLOAT, !1, 16, 8), r.drawArrays(r.TRIANGLES, 0, 6), r.disableVertexAttribArray(1), r.disableVertexAttribArray(0), r.bindBuffer(r.ARRAY_BUFFER, null);
407
407
  }
408
408
  gt() {
409
409
  this.A.deleteBuffer(this.Ms);
410
410
  }
411
411
  }
412
- var E = ((n) => (n.RECTANGLE = "rectangle", n.LINE = "line", n.ELLIPSE = "ellipse", n.ARC = "arc", n.TRIANGLE = "triangle", n.BEZIER_CURVE = "bezier_curve", n))(E || {});
412
+ var w = ((n) => (n.RECTANGLE = "rectangle", n.LINE = "line", n.ELLIPSE = "ellipse", n.ARC = "arc", n.TRIANGLE = "triangle", n.BEZIER_CURVE = "bezier_curve", n))(w || {});
413
413
  const te = { rectangle: 2, line: 2, ellipse: 2, triangle: 2, arc: 3, bezier_curve: 4 };
414
414
  class ee {
415
415
  constructor(t) {
@@ -438,9 +438,9 @@ class ee {
438
438
  for (const [, t] of this.$s) for (const [, e] of t) e && this.A.deleteVertexArray(e);
439
439
  }
440
440
  }
441
- const B = class B {
441
+ const _ = class _ {
442
442
  static Es(t, e, i = 0) {
443
- const s = e || new Float32Array(B.FLOATS_PER_INSTANCE);
443
+ const s = e || new Float32Array(_.FLOATS_PER_INSTANCE);
444
444
  let r = i;
445
445
  s[r++] = t.ws[0], s[r++] = t.ws[1], s[r++] = t.Ss[0], s[r++] = t.Ss[1], s[r++] = t.Nt[0], s[r++] = t.Nt[1], s[r++] = t.Nt[2], s[r++] = t.Xt[0], s[r++] = t.Xt[1], s[r++] = t.Xt[2], s[r++] = t.Xt[3], s[r++] = t.Yt[0], s[r++] = t.Yt[1], s[r++] = t.Yt[2], s[r++] = t.Yt[3], s[r++] = t.ks[0], s[r++] = t.ks[1], s[r++] = t.ks[2], s[r++] = t.Et;
446
446
  const h = t.zs;
@@ -451,20 +451,20 @@ const B = class B {
451
451
  return g ? (s[r++] = (f == null ? void 0 : f[0]) ?? 0, s[r++] = (f == null ? void 0 : f[1]) ?? 0, s[r++] = (d == null ? void 0 : d[0]) ?? 0, s[r++] = (d == null ? void 0 : d[1]) ?? 0, s[r++] = l[0], s[r++] = l[1], s[r++] = u[0], s[r++] = u[1]) : !g && !!c ? (s[r++] = c[0], s[r++] = c[1], s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0) : (s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0), s[r++] = t.Gs ?? 0, s[r++] = t.Qs ?? 0, s[r++] = t.Ns ?? 0, s;
452
452
  }
453
453
  static Xs(t, e) {
454
- const i = t.length * B.FLOATS_PER_INSTANCE, s = e || new Float32Array(i);
454
+ const i = t.length * _.FLOATS_PER_INSTANCE, s = e || new Float32Array(i);
455
455
  for (let r = 0; r < t.length; r++) {
456
- const h = r * B.FLOATS_PER_INSTANCE;
457
- B.Es(t[r], s, h);
456
+ const h = r * _.FLOATS_PER_INSTANCE;
457
+ _.Es(t[r], s, h);
458
458
  }
459
459
  return s;
460
460
  }
461
461
  };
462
- a(B, "BYTES_PER_INSTANCE", 144), a(B, "FLOATS_PER_INSTANCE", 36);
463
- let _ = B;
462
+ a(_, "BYTES_PER_INSTANCE", 144), a(_, "FLOATS_PER_INSTANCE", 36);
463
+ let D = _;
464
464
  const P = class P {
465
465
  };
466
- a(P, "STRIDE", _.BYTES_PER_INSTANCE), a(P, "ATTRIBUTES", { A2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 0, divisor: 1 }, A3: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 8, divisor: 1 }, A4: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 16, divisor: 1 }, A5: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 28, divisor: 1 }, A6: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 44, divisor: 1 }, A7: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 60, divisor: 1 }, A8: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 76, divisor: 1 }, A9: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 88, divisor: 1 }, Aa: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 100, divisor: 1 }, Ab: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 116, divisor: 1 }, Ac: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 132, divisor: 1 } });
467
- let G = P;
466
+ a(P, "STRIDE", D.BYTES_PER_INSTANCE), a(P, "ATTRIBUTES", { A2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 0, divisor: 1 }, A3: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 8, divisor: 1 }, A4: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 16, divisor: 1 }, A5: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 28, divisor: 1 }, A6: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 44, divisor: 1 }, A7: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 60, divisor: 1 }, A8: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 76, divisor: 1 }, A9: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 88, divisor: 1 }, Aa: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 100, divisor: 1 }, Ab: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 116, divisor: 1 }, Ac: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 132, divisor: 1 } });
467
+ let k = P;
468
468
  class ie {
469
469
  constructor(t = 1e3, e = 1.5) {
470
470
  a(this, "Ys");
@@ -473,14 +473,14 @@ class ie {
473
473
  a(this, "Ks", 0);
474
474
  a(this, "Zs", 0);
475
475
  this.js = t, this.Ws = e;
476
- const i = t * _.FLOATS_PER_INSTANCE;
476
+ const i = t * D.FLOATS_PER_INSTANCE;
477
477
  this.Ys = new Float32Array(i);
478
478
  }
479
479
  qs(t) {
480
480
  if (t <= this.js) return;
481
481
  const e = Math.ceil(t * this.Ws), i = this.js;
482
482
  this.js = e;
483
- const s = e * _.FLOATS_PER_INSTANCE, r = new Float32Array(s), h = i * _.FLOATS_PER_INSTANCE;
483
+ const s = e * D.FLOATS_PER_INSTANCE, r = new Float32Array(s), h = i * D.FLOATS_PER_INSTANCE;
484
484
  r.set(this.Ys.subarray(0, Math.min(h, this.Ks))), this.Ys = r;
485
485
  }
486
486
  Vs() {
@@ -518,7 +518,7 @@ class se {
518
518
  const { buffer: e, offset: i } = this.Ys.Vs();
519
519
  e[i + 0] = t.x, e[i + 1] = t.y, e[i + 2] = t.width, e[i + 3] = t.height, e[i + 4] = t.char0, e[i + 5] = t.char1, e[i + 6] = t.char2, e[i + 7] = t.r1, e[i + 8] = t.g1, e[i + 9] = t.b1, e[i + 10] = t.a1, e[i + 11] = t.r2, e[i + 12] = t.g2, e[i + 13] = t.b2, e[i + 14] = t.a2, e[i + 15] = t.invert, e[i + 16] = t.flipX, e[i + 17] = t.flipY, e[i + 18] = t.charRot, e[i + 19] = t.translationX, e[i + 20] = t.translationY, e[i + 21] = t.translationZ, e[i + 22] = t.rotationX, e[i + 23] = t.rotationY, e[i + 24] = t.rotationZ;
520
520
  const s = t.curveParams0, r = t.curveParams1;
521
- return e[i + 25] = s[0], e[i + 26] = s[1], e[i + 27] = s[2], e[i + 28] = s[3], e[i + 29] = r[0], e[i + 30] = r[1], e[i + 31] = r[2], e[i + 32] = r[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Ys.Js(_.FLOATS_PER_INSTANCE), this.Ys.ii - 1;
521
+ return e[i + 25] = s[0], e[i + 26] = s[1], e[i + 27] = s[2], e[i + 28] = s[3], e[i + 29] = r[0], e[i + 30] = r[1], e[i + 31] = r[2], e[i + 32] = r[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Ys.Js(D.FLOATS_PER_INSTANCE), this.Ys.ii - 1;
522
522
  }
523
523
  get ii() {
524
524
  return this.Ys.ii;
@@ -535,7 +535,7 @@ class re {
535
535
  li(t) {
536
536
  const e = this.A;
537
537
  this.oi && e.deleteBuffer(this.oi), this.oi = e.createBuffer();
538
- const i = t * _.BYTES_PER_INSTANCE;
538
+ const i = t * D.BYTES_PER_INSTANCE;
539
539
  Ct(e, e.ARRAY_BUFFER, this.oi, i, e.DYNAMIC_DRAW), this.ai = t;
540
540
  }
541
541
  ui(t) {
@@ -548,7 +548,7 @@ class re {
548
548
  if (e === 0) return;
549
549
  const i = this.A;
550
550
  i.bindBuffer(i.ARRAY_BUFFER, this.oi);
551
- const s = e * _.FLOATS_PER_INSTANCE;
551
+ const s = e * D.FLOATS_PER_INSTANCE;
552
552
  i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, s);
553
553
  }
554
554
  di(t) {
@@ -556,7 +556,7 @@ class re {
556
556
  if (!e) {
557
557
  e = /* @__PURE__ */ new Map();
558
558
  const i = this.A;
559
- for (const s in G.ATTRIBUTES) {
559
+ for (const s in k.ATTRIBUTES) {
560
560
  const r = i.getAttribLocation(t, s);
561
561
  r !== -1 && e.set(s, r);
562
562
  }
@@ -567,14 +567,14 @@ class re {
567
567
  pi(t) {
568
568
  const e = this.A, i = t.G, s = this.di(i);
569
569
  for (const [r, h] of s) {
570
- const o = G.ATTRIBUTES[r];
570
+ const o = k.ATTRIBUTES[r];
571
571
  o && ut(e, h, o.size, o.stride, o.offset, o.divisor, o.type, o.normalized);
572
572
  }
573
573
  }
574
574
  gi(t) {
575
575
  const e = this.A, i = this.di(t.G);
576
576
  for (const [s, r] of i)
577
- G.ATTRIBUTES[s] && (e.disableVertexAttribArray(r), e.vertexAttribDivisor(r, 0));
577
+ k.ATTRIBUTES[s] && (e.disableVertexAttribArray(r), e.vertexAttribDivisor(r, 0));
578
578
  }
579
579
  gt() {
580
580
  this.oi && (this.A.deleteBuffer(this.oi), this.oi = null), this.ci.clear();
@@ -623,7 +623,7 @@ class ne {
623
623
  this._i.gt();
624
624
  }
625
625
  }
626
- class D {
626
+ class X {
627
627
  constructor(t, e, i, s) {
628
628
  a(this, "A");
629
629
  a(this, "wi");
@@ -659,20 +659,20 @@ class D {
659
659
  return this.wi.yi(t);
660
660
  }
661
661
  Ri(t, e, i, s, r, h) {
662
- const o = r.It ?? 0, c = r.Bt ?? 0, l = r.Ht ?? 0, u = r.wt ?? 0, f = r.Ct ?? 0, d = r.xt ?? 0, g = [0, 0, 0, 0], v = [0, 0, 0, 0];
663
- h && (h.bezStartX !== void 0 && h.bezStartY !== void 0 && h.bezEndX !== void 0 && h.bezEndY !== void 0 ? (g[0] = h.cp1x ?? 0, g[1] = h.cp1y ?? 0, g[2] = h.cp2x ?? 0, g[3] = h.cp2y ?? 0, v[0] = h.bezStartX ?? 0, v[1] = h.bezStartY ?? 0, v[2] = h.bezEndX ?? 0, v[3] = h.bezEndY ?? 0) : h.arcStart === void 0 && h.arcStop === void 0 || (g[0] = h.arcStart ?? 0, g[1] = h.arcStop ?? 0));
664
- const m = { x: t, y: e, width: i, height: s, char0: r.Nt[0], char1: r.Nt[1], char2: r.Nt[2], r1: r.Xt[0], g1: r.Xt[1], b1: r.Xt[2], a1: r.Xt[3], r2: r.Yt[0], g2: r.Yt[1], b2: r.Yt[2], a2: r.Yt[3], invert: r.Rt ? 1 : 0, flipX: r.Gt ? 1 : 0, flipY: r.Qt ? 1 : 0, charRot: r.Et, translationX: o, translationY: c, translationZ: l, rotationX: u, rotationY: f, rotationZ: d, curveParams0: g, curveParams1: v, depth: (h == null ? void 0 : h.depth) ?? 0, baseZ: (h == null ? void 0 : h.baseZ) ?? 0, geometryType: te[this.Ci] ?? 0 };
665
- return this.wi.hi(m);
662
+ const o = r.It ?? 0, c = r.Bt ?? 0, l = r.Ht ?? 0, u = r.wt ?? 0, f = r.Ct ?? 0, d = r.xt ?? 0, g = [0, 0, 0, 0], m = [0, 0, 0, 0];
663
+ h && (h.bezStartX !== void 0 && h.bezStartY !== void 0 && h.bezEndX !== void 0 && h.bezEndY !== void 0 ? (g[0] = h.cp1x ?? 0, g[1] = h.cp1y ?? 0, g[2] = h.cp2x ?? 0, g[3] = h.cp2y ?? 0, 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 || (g[0] = h.arcStart ?? 0, g[1] = h.arcStop ?? 0));
664
+ const v = { x: t, y: e, width: i, height: s, char0: r.Nt[0], char1: r.Nt[1], char2: r.Nt[2], r1: r.Xt[0], g1: r.Xt[1], b1: r.Xt[2], a1: r.Xt[3], r2: r.Yt[0], g2: r.Yt[1], b2: r.Yt[2], a2: r.Yt[3], invert: r.Rt ? 1 : 0, flipX: r.Gt ? 1 : 0, flipY: r.Qt ? 1 : 0, charRot: r.Et, translationX: o, translationY: c, translationZ: l, rotationX: u, rotationY: f, rotationZ: d, curveParams0: g, curveParams1: m, depth: (h == null ? void 0 : h.depth) ?? 0, baseZ: (h == null ? void 0 : h.baseZ) ?? 0, geometryType: te[this.Ci] ?? 0 };
665
+ return this.wi.hi(v);
666
666
  }
667
667
  }
668
- const he = { Fi: ft, Ei: 6, ...Z }, oe = { Fi: new Float32Array([0, -0.5, 0, 0, 1, -0.5, 1, 0, 0, 0.5, 0, 1, 0, 0.5, 0, 1, 1, -0.5, 1, 0, 1, 0.5, 1, 1]), Ei: 6, ...Z }, ae = { Fi: function(n = 32) {
668
+ const he = { Fi: ft, Ei: 6, ...Y }, oe = { Fi: new Float32Array([0, -0.5, 0, 0, 1, -0.5, 1, 0, 0, 0.5, 0, 1, 0, 0.5, 0, 1, 1, -0.5, 1, 0, 1, 0.5, 1, 1]), Ei: 6, ...Y }, ae = { Fi: function(n = 32) {
669
669
  const t = [], e = 2 * Math.PI / n;
670
670
  for (let i = 0; i < n; i++) {
671
671
  const s = i * e, r = (i + 1) % n * e, h = Math.cos(s), o = Math.sin(s), c = 0.5 * (h + 1), l = 0.5 * (o + 1), u = Math.cos(r), f = Math.sin(r), d = 0.5 * (u + 1), g = 0.5 * (f + 1);
672
672
  t.push(0, 0, 0.5, 0.5, h, o, c, l, u, f, d, g);
673
673
  }
674
674
  return new Float32Array(t);
675
- }(32), Ei: 96, ...Z };
675
+ }(32), Ei: 96, ...Y };
676
676
  let ce = { Fi: function(n) {
677
677
  const t = [];
678
678
  for (let e = 0; e < n; e++) {
@@ -680,55 +680,55 @@ let ce = { Fi: function(n) {
680
680
  t.push(i, 0, i, 0, i, 1, i, 1, s, 1, s, 1);
681
681
  }
682
682
  return new Float32Array(t);
683
- }(32), Ei: 96, ...Z };
684
- const le = { Fi: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ei: 3, ...Z }, ue = { Fi: function(n = 16) {
683
+ }(32), Ei: 96, ...Y };
684
+ const le = { Fi: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ei: 3, ...Y }, ue = { Fi: function(n = 16) {
685
685
  const t = [];
686
686
  for (let e = 0; e < n; e++) {
687
687
  const i = e / n, s = (e + 1) / n;
688
688
  t.push(i, -0.5, i, 0, s, -0.5, s, 0, i, 0.5, i, 1, i, 0.5, i, 1, s, -0.5, s, 0, s, 0.5, s, 1);
689
689
  }
690
690
  return new Float32Array(t);
691
- }(16), Ei: 96, ...Z }, fe = { [E.RECTANGLE]: class extends D {
691
+ }(16), Ei: 96, ...Y }, fe = { [w.RECTANGLE]: class extends X {
692
692
  constructor(n, t) {
693
- super(n, t, E.RECTANGLE, he);
693
+ super(n, t, w.RECTANGLE, he);
694
694
  }
695
695
  yi(n, t) {
696
696
  return this.Ri(0, 0, n.width, n.height, t);
697
697
  }
698
- }, [E.LINE]: class extends D {
698
+ }, [w.LINE]: class extends X {
699
699
  constructor(n, t) {
700
- super(n, t, E.LINE, oe);
700
+ super(n, t, w.LINE, oe);
701
701
  }
702
702
  yi(n, t) {
703
703
  const e = n.x2 - n.x1, i = n.y2 - n.y1, s = Math.hypot(e, i), r = Math.atan2(i, e), h = t.Ot || 1, o = n.x1 + e / 2 - s / 2, c = n.y1 + i / 2, l = { ...t, xt: (t.xt || 0) + r };
704
704
  return this.Ri(o, c, s, h, l);
705
705
  }
706
- }, [E.ELLIPSE]: class extends D {
706
+ }, [w.ELLIPSE]: class extends X {
707
707
  constructor(n, t) {
708
- super(n, t, E.ELLIPSE, ae);
708
+ super(n, t, w.ELLIPSE, ae);
709
709
  }
710
710
  yi(n, t) {
711
711
  return this.Ri(0, 0, n.width, n.height, t);
712
712
  }
713
- }, [E.ARC]: class extends D {
713
+ }, [w.ARC]: class extends X {
714
714
  constructor(n, t) {
715
- super(n, t, E.ARC, ce);
715
+ super(n, t, w.ARC, ce);
716
716
  }
717
717
  yi(n, t) {
718
718
  const e = n.start * Math.PI / 180, i = n.stop * Math.PI / 180;
719
719
  return this.Ri(0, 0, n.width, n.height, t, { arcStart: e, arcStop: i });
720
720
  }
721
- }, [E.TRIANGLE]: class extends D {
721
+ }, [w.TRIANGLE]: class extends X {
722
722
  constructor(n, t) {
723
- super(n, t, E.TRIANGLE, le);
723
+ super(n, t, w.TRIANGLE, le);
724
724
  }
725
725
  yi(n, t) {
726
726
  const e = Math.min(n.x1, n.x2, n.x3), i = Math.max(n.x1, n.x2, n.x3), s = Math.min(n.y1, n.y2, n.y3), r = i - e, h = Math.max(n.y1, n.y2, n.y3) - s;
727
727
  return this.Ri(e, s, r, h, t);
728
728
  }
729
- }, [E.BEZIER_CURVE]: class extends D {
729
+ }, [w.BEZIER_CURVE]: class extends X {
730
730
  constructor(n, t) {
731
- super(n, t, E.BEZIER_CURVE, ue);
731
+ super(n, t, w.BEZIER_CURVE, ue);
732
732
  }
733
733
  yi(n, t) {
734
734
  return this.Ri(0, 0, 1, t.Ot || 1, t, { cp1x: n.cp1x, cp1y: n.cp1y, cp2x: n.cp2x, cp2y: n.cp2y, bezStartX: n.x1, bezStartY: n.y1, bezEndX: n.x2, bezEndY: n.y2 });
@@ -740,7 +740,7 @@ class de {
740
740
  a(this, "Si");
741
741
  a(this, "ki");
742
742
  this.A = t, this.ki = new ee(t), this.Si = /* @__PURE__ */ new Map();
743
- for (const e of Object.values(E)) {
743
+ for (const e of Object.values(w)) {
744
744
  const i = new ne(t), s = new fe[e](t, i);
745
745
  this.Si.set(e, s);
746
746
  }
@@ -759,7 +759,7 @@ class de {
759
759
  const { material: e, type: i, commands: s } = t, r = this.Si.get(i);
760
760
  e.shader.D(), e.shader.O(e.uniforms);
761
761
  const h = Pt(this.A), o = s.length > 0 && s[0].state.kt;
762
- e.shader.O({ Uv: h[2] / h[3], U9: [h[2], h[3]], Ua: 1, Ub: o ? 1 : 0 }), r.Pi();
762
+ e.shader.O({ Uv: h[2] / h[3], Ud: [h[2], h[3]], Ue: 1, Uf: o ? 1 : 0 }), r.Pi();
763
763
  for (const c of s) r.yi(c.params, c.state);
764
764
  if (r.$i()) {
765
765
  const c = r.unitGeometry, l = r.unitBuffer;
@@ -781,24 +781,24 @@ function Mt(n) {
781
781
  t = (t << 5) - t + n.charCodeAt(e), t &= t;
782
782
  return t;
783
783
  }
784
- const wt = /* @__PURE__ */ new WeakMap();
784
+ const yt = /* @__PURE__ */ new WeakMap();
785
785
  let ge = 1;
786
- function bt(n) {
786
+ function xt(n) {
787
787
  if (n == null) return 0;
788
788
  if (typeof n != "object" && typeof n != "function") return Mt(n + "");
789
- let t = wt.get(n);
790
- return t || (t = ge++, wt.set(n, t)), t;
789
+ let t = yt.get(n);
790
+ return t || (t = ge++, yt.set(n, t)), t;
791
791
  }
792
- function Q(n, t) {
792
+ function G(n, t) {
793
793
  return (n << 5) - n + t;
794
794
  }
795
- class me {
795
+ class ve {
796
796
  constructor(t) {
797
797
  a(this, "Oi", 0);
798
798
  a(this, "Ii");
799
799
  a(this, "Bi");
800
800
  a(this, "Hi", /* @__PURE__ */ new Map());
801
- this.Ii = new k(t, it, `#version 300 es
801
+ this.Ii = new H(t, it, `#version 300 es
802
802
  precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellColor;in vec4 v_glyphFlags;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){int B=int(v_glyphFlags.r>0.5?1:0);int C=int(v_glyphFlags.g>0.5?1:0);int D=int(v_glyphFlags.b>0.5?1:0);float E=float(B|(C<<1)|(D<<2))/255.;o_character=vec4(v_glyphIndex.xy,E,clamp(v_glyphFlags.a,0.,1.));o_primaryColor=vec4(v_glyphColor.rgb,v_glyphColor.a);o_secondaryColor=vec4(v_cellColor.rgb,v_cellColor.a);A=vec4(0.);}`), this.Bi = { id: this.Oi++, shader: this.Ii, uniforms: Object.freeze({}), hash: this.Gi(this.Ii, {}), isBuiltIn: !0 };
803
803
  }
804
804
  get Qi() {
@@ -814,13 +814,13 @@ precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellCo
814
814
  return { id: this.Oi++, shader: t, uniforms: Object.freeze({ ...e }), hash: 0, isBuiltIn: !1 };
815
815
  }
816
816
  Gi(t, e) {
817
- const i = bt(t.G), s = function(r, h) {
817
+ const i = xt(t.G), s = function(r, h) {
818
818
  let o = 0;
819
819
  const c = Object.keys(r).sort();
820
- for (const l of c) o = Q(o, Mt(l)), o = Q(o, h(r[l]));
820
+ for (const l of c) o = G(o, Mt(l)), o = G(o, h(r[l]));
821
821
  return o;
822
822
  }(e, this.Xi.bind(this));
823
- return Q(i, s);
823
+ return G(i, s);
824
824
  }
825
825
  Xi(t) {
826
826
  return typeof t == "number" || typeof t == "boolean" ? function(e) {
@@ -828,20 +828,20 @@ precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellCo
828
828
  }(t) : Array.isArray(t) ? function(e) {
829
829
  let i = 0;
830
830
  const s = Array.isArray(e[0]) ? e.flat() : e;
831
- for (const r of s) i = Q(i, typeof r == "number" ? r : 0);
831
+ for (const r of s) i = G(i, typeof r == "number" ? r : 0);
832
832
  return i;
833
833
  }(t) : t instanceof Float32Array || t instanceof Int32Array ? function(e) {
834
834
  let i = 0;
835
835
  const s = Math.min(e.length, 16);
836
- for (let r = 0; r < s; r++) i = Q(i, e[r]);
836
+ for (let r = 0; r < s; r++) i = G(i, e[r]);
837
837
  return i;
838
- }(t) : t instanceof WebGLTexture ? bt(t) : 0;
838
+ }(t) : t instanceof WebGLTexture ? xt(t) : 0;
839
839
  }
840
840
  gt() {
841
841
  this.Ii != this.Ii && this.Ii.dispose(), this.Ii.dispose(), this.Hi.clear();
842
842
  }
843
843
  }
844
- class ve {
844
+ class me {
845
845
  constructor() {
846
846
  a(this, "Yi", []);
847
847
  a(this, "ji", 1);
@@ -856,27 +856,27 @@ class ve {
856
856
  return i.id = this.ji++, i.type = t, i.material = e, this.Ss++, i;
857
857
  }
858
858
  Ki(t, e, i) {
859
- const s = this.Wi(E.RECTANGLE, i), r = s.params;
859
+ const s = this.Wi(w.RECTANGLE, i), r = s.params;
860
860
  return r.width = t.width, r.height = t.height, e.Kt(s.state), s.id;
861
861
  }
862
862
  Zi(t, e, i) {
863
- const s = this.Wi(E.LINE, i), r = s.params;
863
+ const s = this.Wi(w.LINE, i), r = s.params;
864
864
  return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, e.Kt(s.state), s.id;
865
865
  }
866
866
  qi(t, e, i) {
867
- const s = this.Wi(E.ELLIPSE, i), r = s.params;
867
+ const s = this.Wi(w.ELLIPSE, i), r = s.params;
868
868
  return r.width = t.width, r.height = t.height, r.startAngle = t.startAngle, r.endAngle = t.endAngle, r.segments = t.segments, e.Kt(s.state), s.id;
869
869
  }
870
870
  Vi(t, e, i) {
871
- const s = this.Wi(E.ARC, i), r = s.params;
871
+ const s = this.Wi(w.ARC, i), r = s.params;
872
872
  return r.width = t.width, r.height = t.height, r.start = t.start, r.stop = t.stop, e.Kt(s.state), s.id;
873
873
  }
874
874
  Ji(t, e, i) {
875
- const s = this.Wi(E.TRIANGLE, i), r = s.params;
875
+ const s = this.Wi(w.TRIANGLE, i), r = s.params;
876
876
  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.Kt(s.state), s.id;
877
877
  }
878
878
  te(t, e, i) {
879
- const s = this.Wi(E.BEZIER_CURVE, i), r = s.params;
879
+ const s = this.Wi(w.BEZIER_CURVE, i), r = s.params;
880
880
  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.Kt(s.state), s.id;
881
881
  }
882
882
  bi() {
@@ -905,7 +905,7 @@ class pe {
905
905
  a(this, "ue", null);
906
906
  a(this, "fe", [0, 0, 0, 0]);
907
907
  a(this, "de", 1);
908
- this.A = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.ee = new st(), this.vt = new me(t), this.re = new ve(), this.ie = new de(t), this.ne = new $t(t);
908
+ this.A = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.ee = new st(), this.vt = new ve(t), this.re = new me(), this.ie = new de(t), this.ne = new $t(t);
909
909
  const e = [0, 0, t.canvas.width, t.canvas.height];
910
910
  nt(t, e), this.ae.push(null), this.ce.push(e), this.le.push(1), this.ue = null, this.fe = e, this.de = 1;
911
911
  }
@@ -926,7 +926,7 @@ class pe {
926
926
  this.se !== t && (this.se = t, t.D());
927
927
  }
928
928
  pe(t, e) {
929
- return new k(this.A, t, e);
929
+ return new H(this.A, t, e);
930
930
  }
931
931
  ge(t) {
932
932
  this.he = t, t && (this.oe = {});
@@ -938,7 +938,7 @@ class pe {
938
938
  Object.assign(this.oe, t);
939
939
  }
940
940
  _e(t) {
941
- return new k(this.A, it, t);
941
+ return new H(this.A, it, t);
942
942
  }
943
943
  ye(t, e, i) {
944
944
  this.re.Ki({ width: e ?? t.width, height: i ?? t.height }, this.ee, t.ut());
@@ -968,7 +968,7 @@ class pe {
968
968
  this.re.Vi({ width: t, height: e, start: i, stop: s }, this.ee, this.vt.Qi);
969
969
  }
970
970
  Pe(t, e, i = 1, s = {}) {
971
- return new H(this.A, t, e, i, s, this);
971
+ return new j(this.A, t, e, i, s, this);
972
972
  }
973
973
  $e(t, e = t, i = t, s = 255) {
974
974
  this.ee.ps(t, e ?? t, i ?? t, s);
@@ -986,7 +986,7 @@ class pe {
986
986
  for (let c = 3; c < this.de; c++) h.clearBufferfv(h.COLOR, c, new Float32Array([0, 0, 0, 0]));
987
987
  } else h.clearColor(t, e, i, s), h.clear(h.COLOR_BUFFER_BIT);
988
988
  }
989
- Ue() {
989
+ Re() {
990
990
  const t = [0, 0, this.A.canvas.width, this.A.canvas.height];
991
991
  this.A.viewport(...t), nt(this.A, t), this.fe = t, this.ce.length > 0 && (this.ce[0] = t);
992
992
  }
@@ -1007,13 +1007,13 @@ class pe {
1007
1007
  return this.vt;
1008
1008
  }
1009
1009
  }
1010
- const T = { readShort: (n, t) => (T.t.uint16[0] = n[t] << 8 | n[t + 1], T.t.int16[0]), readUshort: (n, t) => n[t] << 8 | n[t + 1], readUshorts(n, t, e) {
1010
+ const R = { readShort: (n, t) => (R.t.uint16[0] = n[t] << 8 | n[t + 1], R.t.int16[0]), readUshort: (n, t) => n[t] << 8 | n[t + 1], readUshorts(n, t, e) {
1011
1011
  const i = [];
1012
- for (let s = 0; s < e; s++) i.push(T.readUshort(n, t + 2 * s));
1012
+ for (let s = 0; s < e; s++) i.push(R.readUshort(n, t + 2 * s));
1013
1013
  return i;
1014
1014
  }, readUint(n, t) {
1015
- const e = T.t.uint8;
1016
- return e[3] = n[t], e[2] = n[t + 1], e[1] = n[t + 2], e[0] = n[t + 3], T.t.uint32[0];
1015
+ const e = R.t.uint8;
1016
+ return e[3] = n[t], e[2] = n[t + 1], e[1] = n[t + 2], e[0] = n[t + 3], R.t.uint32[0];
1017
1017
  }, readASCII(n, t, e) {
1018
1018
  let i = "";
1019
1019
  for (let s = 0; s < e; s++) i += String.fromCharCode(n[t + s]);
@@ -1022,7 +1022,7 @@ const T = { readShort: (n, t) => (T.t.uint16[0] = n[t] << 8 | n[t + 1], T.t.int1
1022
1022
  const n = new ArrayBuffer(8);
1023
1023
  return { uint8: new Uint8Array(n), int16: new Int16Array(n), uint16: new Uint16Array(n), uint32: new Uint32Array(n) };
1024
1024
  })() };
1025
- function j(n) {
1025
+ function q(n) {
1026
1026
  return n + 3 & -4;
1027
1027
  }
1028
1028
  function J(n, t, e) {
@@ -1037,11 +1037,11 @@ function Ae(n, t, e) {
1037
1037
  function ht(n, t, e) {
1038
1038
  const i = t + e;
1039
1039
  let s = 0;
1040
- const r = T.t;
1040
+ const r = R.t;
1041
1041
  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;
1042
1042
  return s >>> 0;
1043
1043
  }
1044
- class ye {
1044
+ class Ee {
1045
1045
  constructor(t) {
1046
1046
  a(this, "b");
1047
1047
  a(this, "p", 0);
@@ -1064,7 +1064,7 @@ class ye {
1064
1064
  return this.p;
1065
1065
  }
1066
1066
  }
1067
- function q(n) {
1067
+ function V(n) {
1068
1068
  let t = 32, e = 0;
1069
1069
  for (const o of n) o && (o < t && (t = o), o > e && (e = o));
1070
1070
  if (e === 0) return { min: 0, max: 0, table: /* @__PURE__ */ new Map() };
@@ -1080,7 +1080,7 @@ function q(n) {
1080
1080
  if (!c) continue;
1081
1081
  const l = s[c]++;
1082
1082
  let u = h.get(c);
1083
- u || (u = [], h.set(c, u)), u[we(l, c)] = o;
1083
+ u || (u = [], h.set(c, u)), u[ye(l, c)] = o;
1084
1084
  }
1085
1085
  return { min: t, max: e, table: h };
1086
1086
  }
@@ -1096,12 +1096,12 @@ function ot(n, t) {
1096
1096
  }
1097
1097
  throw Error("Invalid Huffman code");
1098
1098
  }
1099
- function we(n, t) {
1099
+ function ye(n, t) {
1100
1100
  let e = 0;
1101
1101
  for (let i = 0; i < t; i++) e = e << 1 | 1 & n, n >>>= 1;
1102
1102
  return e >>> 0;
1103
1103
  }
1104
- function be(n) {
1104
+ function xe(n) {
1105
1105
  if (n.length < 2) throw Error("ZLIB data too short");
1106
1106
  const t = n[0], e = n[1];
1107
1107
  if ((15 & t) != 8) throw Error("Unsupported ZLIB compression method");
@@ -1119,83 +1119,83 @@ function be(n) {
1119
1119
  r.alignToByte();
1120
1120
  const g = r.readBits(16);
1121
1121
  if ((65535 & (65535 ^ g)) !== r.readBits(16)) throw Error("DEFLATE uncompressed LEN/NLEN mismatch");
1122
- for (let v = 0; v < g; v++) h.push(r.readBits(8));
1122
+ for (let m = 0; m < g; m++) h.push(r.readBits(8));
1123
1123
  } else {
1124
1124
  if (d !== 1 && d !== 2) throw Error("Unsupported DEFLATE type");
1125
1125
  {
1126
- let g, v;
1126
+ let g, m;
1127
1127
  if (d === 1) {
1128
- const m = Array(288).fill(0);
1129
- for (let A = 0; A <= 143; A++) m[A] = 8;
1130
- for (let A = 144; A <= 255; A++) m[A] = 9;
1131
- for (let A = 256; A <= 279; A++) m[A] = 7;
1132
- for (let A = 280; A <= 287; A++) m[A] = 8;
1133
- g = q(m), v = q(Array(32).fill(5));
1128
+ const v = Array(288).fill(0);
1129
+ for (let A = 0; A <= 143; A++) v[A] = 8;
1130
+ for (let A = 144; A <= 255; A++) v[A] = 9;
1131
+ for (let A = 256; A <= 279; A++) v[A] = 7;
1132
+ for (let A = 280; A <= 287; A++) v[A] = 8;
1133
+ g = V(v), m = V(Array(32).fill(5));
1134
1134
  } else {
1135
- const m = r.readBits(5) + 257, A = r.readBits(5) + 1, p = r.readBits(4) + 4, w = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], y = Array(19).fill(0);
1136
- for (let R = 0; R < p; R++) y[w[R]] = r.readBits(3);
1137
- const x = q(y), b = [];
1138
- for (; b.length < m + A; ) {
1139
- const R = ot(r, x);
1140
- if (R <= 15) b.push(R);
1141
- else if (R === 16) {
1142
- const N = r.readBits(2) + 3, F = b[b.length - 1] || 0;
1143
- for (let V = 0; V < N; V++) b.push(F);
1144
- } else if (R === 17) {
1145
- const N = r.readBits(3) + 3;
1146
- for (let F = 0; F < N; F++) b.push(0);
1135
+ const v = r.readBits(5) + 257, A = r.readBits(5) + 1, p = r.readBits(4) + 4, y = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], E = Array(19).fill(0);
1136
+ for (let T = 0; T < p; T++) E[y[T]] = r.readBits(3);
1137
+ const b = V(E), x = [];
1138
+ for (; x.length < v + A; ) {
1139
+ const T = ot(r, b);
1140
+ if (T <= 15) x.push(T);
1141
+ else if (T === 16) {
1142
+ const S = r.readBits(2) + 3, F = x[x.length - 1] || 0;
1143
+ for (let Q = 0; Q < S; Q++) x.push(F);
1144
+ } else if (T === 17) {
1145
+ const S = r.readBits(3) + 3;
1146
+ for (let F = 0; F < S; F++) x.push(0);
1147
1147
  } else {
1148
- if (R !== 18) throw Error("Invalid code length symbol");
1148
+ if (T !== 18) throw Error("Invalid code length symbol");
1149
1149
  {
1150
- const N = r.readBits(7) + 11;
1151
- for (let F = 0; F < N; F++) b.push(0);
1150
+ const S = r.readBits(7) + 11;
1151
+ for (let F = 0; F < S; F++) x.push(0);
1152
1152
  }
1153
1153
  }
1154
1154
  }
1155
- const C = b.slice(0, m), U = b.slice(m, m + A);
1156
- g = q(C), v = q(U);
1155
+ const C = x.slice(0, v), N = x.slice(v, v + A);
1156
+ g = V(C), m = V(N);
1157
1157
  }
1158
1158
  for (; ; ) {
1159
- const m = ot(r, g);
1160
- if (m < 256) h.push(m);
1159
+ const v = ot(r, g);
1160
+ if (v < 256) h.push(v);
1161
1161
  else {
1162
- if (m === 256) break;
1163
- if (m > 256 && m < 286) {
1164
- const A = m - 257;
1162
+ if (v === 256) break;
1163
+ if (v > 256 && v < 286) {
1164
+ const A = v - 257;
1165
1165
  let p = o[A];
1166
- const w = c[A];
1167
- w && (p += r.readBits(w));
1168
- const y = ot(r, v);
1169
- if (y >= 30) throw Error("Invalid distance symbol");
1170
- let x = l[y];
1171
- const b = u[y];
1172
- b && (x += r.readBits(b));
1173
- const C = h.length - x;
1166
+ const y = c[A];
1167
+ y && (p += r.readBits(y));
1168
+ const E = ot(r, m);
1169
+ if (E >= 30) throw Error("Invalid distance symbol");
1170
+ let b = l[E];
1171
+ const x = u[E];
1172
+ x && (b += r.readBits(x));
1173
+ const C = h.length - b;
1174
1174
  if (C < 0) throw Error("Invalid distance");
1175
- for (let U = 0; U < p; U++) h.push(h[C + U] || 0);
1176
- } else if (m === 286 || m === 287) throw Error("Reserved length symbol");
1175
+ for (let N = 0; N < p; N++) h.push(h[C + N] || 0);
1176
+ } else if (v === 286 || v === 287) throw Error("Reserved length symbol");
1177
1177
  }
1178
1178
  }
1179
1179
  }
1180
1180
  }
1181
1181
  }
1182
- }(new ye(n.subarray(i)), s), new Uint8Array(s);
1182
+ }(new Ee(n.subarray(i)), s), new Uint8Array(s);
1183
1183
  }
1184
- function Ee(n) {
1185
- const t = T, e = new Uint8Array(n);
1184
+ function we(n) {
1185
+ const t = R, e = new Uint8Array(n);
1186
1186
  if (t.readASCII(e, 0, 4) !== "wOFF") throw Error("Invalid WOFF signature");
1187
1187
  const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), h = [];
1188
1188
  let o = 44;
1189
1189
  for (let p = 0; p < s; p++) {
1190
- const w = t.readASCII(e, o, 4), y = t.readUint(e, o + 4), x = t.readUint(e, o + 8), b = t.readUint(e, o + 12), C = t.readUint(e, o + 16);
1191
- h.push({ tag: w, offset: y, compLength: x, origLength: b, checksum: C }), o += 20;
1190
+ const y = t.readASCII(e, o, 4), E = t.readUint(e, o + 4), b = t.readUint(e, o + 8), x = t.readUint(e, o + 12), C = t.readUint(e, o + 16);
1191
+ h.push({ tag: y, offset: E, compLength: b, origLength: x, checksum: C }), o += 20;
1192
1192
  }
1193
1193
  for (const p of h) {
1194
- const w = new Uint8Array(e.buffer, p.offset, p.compLength);
1195
- if (p.compLength === p.origLength) p.data = new Uint8Array(w);
1196
- else if (p.data = be(w), p.data.length !== p.origLength) if (p.data.length < p.origLength) {
1197
- const y = new Uint8Array(p.origLength);
1198
- y.set(p.data), p.data = y;
1194
+ const y = new Uint8Array(e.buffer, p.offset, p.compLength);
1195
+ if (p.compLength === p.origLength) p.data = new Uint8Array(y);
1196
+ else if (p.data = xe(y), p.data.length !== p.origLength) if (p.data.length < p.origLength) {
1197
+ const E = new Uint8Array(p.origLength);
1198
+ E.set(p.data), p.data = E;
1199
1199
  } else p.data = p.data.subarray(0, p.origLength);
1200
1200
  }
1201
1201
  const c = s;
@@ -1203,40 +1203,40 @@ function Ee(n) {
1203
1203
  for (; l << 1 <= c; ) l <<= 1, u++;
1204
1204
  const f = 16 * l, d = 16 * c - f;
1205
1205
  let g = 12 + 16 * c;
1206
- const v = {};
1207
- for (const p of h) v[p.tag] = g, g = j(g + p.data.length);
1208
- const m = new Uint8Array(Math.max(r || 0, g));
1209
- L(m, 0, i), J(m, 4, c), J(m, 6, f), J(m, 8, u), J(m, 10, d);
1206
+ const m = {};
1207
+ for (const p of h) m[p.tag] = g, g = q(g + p.data.length);
1208
+ const v = new Uint8Array(Math.max(r || 0, g));
1209
+ L(v, 0, i), J(v, 4, c), J(v, 6, f), J(v, 8, u), J(v, 10, d);
1210
1210
  let A = 12;
1211
1211
  for (const p of h) {
1212
- Ae(m, A, p.tag), A += 4;
1213
- let w = p.data;
1214
- if (p.tag === "head" && w.length >= 12) {
1215
- const y = new Uint8Array(w);
1216
- L(y, 8, 0), L(m, A, ht(y, 0, j(y.length))), A += 4;
1212
+ Ae(v, A, p.tag), A += 4;
1213
+ let y = p.data;
1214
+ if (p.tag === "head" && y.length >= 12) {
1215
+ const E = new Uint8Array(y);
1216
+ L(E, 8, 0), L(v, A, ht(E, 0, q(E.length))), A += 4;
1217
1217
  } else
1218
- L(m, A, ht(w, 0, j(w.length))), A += 4;
1219
- L(m, A, v[p.tag]), A += 4, L(m, A, p.data.length), A += 4;
1218
+ L(v, A, ht(y, 0, q(y.length))), A += 4;
1219
+ L(v, A, m[p.tag]), A += 4, L(v, A, p.data.length), A += 4;
1220
1220
  }
1221
1221
  for (const p of h) {
1222
- const w = v[p.tag];
1223
- m.set(p.data, w);
1222
+ const y = m[p.tag];
1223
+ v.set(p.data, y);
1224
1224
  }
1225
1225
  if (h.find((p) => p.tag === "head")) {
1226
- const p = v.head, w = function(y, x) {
1227
- const b = x + 8, C = [y[b], y[b + 1], y[b + 2], y[b + 3]];
1228
- L(y, b, 0);
1229
- const U = 2981146554 - (ht(y, 0, j(y.length)) >>> 0) >>> 0;
1230
- return y[b] = C[0], y[b + 1] = C[1], y[b + 2] = C[2], y[b + 3] = C[3], U >>> 0;
1231
- }(m, p);
1232
- L(m, p + 8, w);
1226
+ const p = m.head, y = function(E, b) {
1227
+ const x = b + 8, C = [E[x], E[x + 1], E[x + 2], E[x + 3]];
1228
+ L(E, x, 0);
1229
+ const N = 2981146554 - (ht(E, 0, q(E.length)) >>> 0) >>> 0;
1230
+ return E[x] = C[0], E[x + 1] = C[1], E[x + 2] = C[2], E[x + 3] = C[3], N >>> 0;
1231
+ }(v, p);
1232
+ L(v, p + 8, y);
1233
1233
  }
1234
- return m.buffer;
1234
+ return v.buffer;
1235
1235
  }
1236
- const xe = { parseTab(n, t, e) {
1236
+ const be = { parseTab(n, t, e) {
1237
1237
  const i = { tables: [], ids: {}, off: t };
1238
1238
  n = new Uint8Array(n.buffer, t, e), t = 0;
1239
- const s = T, r = s.readUshort, h = r(n, t += 2);
1239
+ const s = R, r = s.readUshort, h = r(n, t += 2);
1240
1240
  t += 2;
1241
1241
  const o = [];
1242
1242
  for (let c = 0; c < h; c++) {
@@ -1247,31 +1247,31 @@ const xe = { parseTab(n, t, e) {
1247
1247
  const d = `p${l}e${u}`;
1248
1248
  let g = o.indexOf(f);
1249
1249
  if (g === -1) {
1250
- let v;
1250
+ let m;
1251
1251
  g = i.tables.length, o.push(f);
1252
- const m = r(n, f);
1253
- v = m === 4 ? this.parse4(n, f) : m === 12 ? this.parse12(n, f) : { format: m }, i.tables.push(v);
1252
+ const v = r(n, f);
1253
+ m = v === 4 ? this.parse4(n, f) : v === 12 ? this.parse12(n, f) : { format: v }, i.tables.push(m);
1254
1254
  }
1255
1255
  i.ids[d] = g;
1256
1256
  }
1257
1257
  return i;
1258
1258
  }, parse4(n, t) {
1259
- const e = T, i = e.readUshort, s = e.readUshorts, r = t, h = i(n, t += 2);
1259
+ const e = R, i = e.readUshort, s = e.readUshorts, r = t, h = i(n, t += 2);
1260
1260
  t += 2;
1261
1261
  const o = i(n, t += 2) >>> 1, c = { format: 4, searchRange: i(n, t += 2), entrySelector: 0, rangeShift: 0, endCount: [], startCount: [], idDelta: [], idRangeOffset: [], glyphIdArray: [] };
1262
1262
  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;
1263
1263
  for (let l = 0; l < o; l++) c.idDelta.push(e.readShort(n, t)), t += 2;
1264
1264
  return c.idRangeOffset = s(n, t, o), t += 2 * o, c.glyphIdArray = s(n, t, r + h - t >> 1), c;
1265
1265
  }, parse12(n, t) {
1266
- const e = T.readUint;
1266
+ const e = R.readUint;
1267
1267
  e(n, t += 4), e(n, t += 4);
1268
1268
  const i = e(n, t += 4);
1269
1269
  t += 4;
1270
1270
  const s = new Uint32Array(3 * i);
1271
1271
  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);
1272
1272
  return { format: 12, groups: s };
1273
- } }, Re = { parseTab(n, t, e) {
1274
- const i = T;
1273
+ } }, Te = { parseTab(n, t, e) {
1274
+ const i = R;
1275
1275
  t += 18;
1276
1276
  const s = i.readUshort(n, t);
1277
1277
  t += 2, t += 16;
@@ -1283,8 +1283,8 @@ const xe = { parseTab(n, t, e) {
1283
1283
  t += 2;
1284
1284
  const c = i.readShort(n, t);
1285
1285
  return t += 2, t += 6, { unitsPerEm: s, xMin: r, yMin: h, xMax: o, yMax: c, indexToLocFormat: i.readShort(n, t) };
1286
- } }, Te = { parseTab(n, t, e) {
1287
- const i = T;
1286
+ } }, Re = { parseTab(n, t, e) {
1287
+ const i = R;
1288
1288
  t += 4;
1289
1289
  const s = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], r = {};
1290
1290
  for (let h = 0; h < s.length; h++) {
@@ -1293,16 +1293,16 @@ const xe = { parseTab(n, t, e) {
1293
1293
  }
1294
1294
  return r;
1295
1295
  } }, Ce = { parseTab(n, t, e, i) {
1296
- const s = T, r = [], h = [], o = i.maxp.numGlyphs, c = i.hhea.numberOfHMetrics;
1296
+ const s = R, r = [], h = [], o = i.maxp.numGlyphs, c = i.hhea.numberOfHMetrics;
1297
1297
  let l = 0, u = 0, f = 0;
1298
1298
  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++;
1299
1299
  for (; f < o; ) r.push(l), h.push(u), f++;
1300
1300
  return { aWidth: r, lsBearing: h };
1301
- } }, Et = { cmap: xe, head: Re, hhea: Te, maxp: { parseTab(n, t, e) {
1302
- const i = T;
1301
+ } }, wt = { cmap: be, head: Te, hhea: Re, maxp: { parseTab(n, t, e) {
1302
+ const i = R;
1303
1303
  return i.readUint(n, t), t += 4, { numGlyphs: i.readUshort(n, t) };
1304
1304
  } }, hmtx: Ce, loca: { parseTab(n, t, e, i) {
1305
- const s = T, r = [], h = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
1305
+ const s = R, r = [], h = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
1306
1306
  if (h === 0) for (let c = 0; c < o; c++) r.push(s.readUshort(n, t + (c << 1)) << 1);
1307
1307
  else if (h === 1) for (let c = 0; c < o; c++) r.push(s.readUint(n, t + (c << 2)));
1308
1308
  return r;
@@ -1310,10 +1310,10 @@ const xe = { parseTab(n, t, e) {
1310
1310
  const s = [], r = i.maxp.numGlyphs;
1311
1311
  for (let h = 0; h < r; h++) s.push(null);
1312
1312
  return s;
1313
- }, Re(n, t) {
1314
- const e = T, i = n.Ee, s = n.loca;
1313
+ }, Ee(n, t) {
1314
+ const e = R, i = n.Se, s = n.loca;
1315
1315
  if (s[t] === s[t + 1]) return null;
1316
- const r = K.findTable(i, "glyf", n.Se);
1316
+ const r = W.findTable(i, "glyf", n.ke);
1317
1317
  if (!r) return null;
1318
1318
  let h = r[0] + s[t];
1319
1319
  const o = {};
@@ -1329,31 +1329,31 @@ const xe = { parseTab(n, t, e) {
1329
1329
  for (let d = 0; d < l; d++) {
1330
1330
  const g = i[h];
1331
1331
  if (h++, o.flags.push(g), 8 & g) {
1332
- const v = i[h];
1332
+ const m = i[h];
1333
1333
  h++;
1334
- for (let m = 0; m < v; m++) o.flags.push(g), d++;
1334
+ for (let v = 0; v < m; v++) o.flags.push(g), d++;
1335
1335
  }
1336
1336
  }
1337
1337
  o.xs = [];
1338
1338
  for (let d = 0; d < l; d++) {
1339
- const g = o.flags[d], v = !!(16 & g);
1340
- 2 & g ? (o.xs.push(v ? i[h] : -i[h]), h++) : v ? o.xs.push(0) : (o.xs.push(e.readShort(i, h)), h += 2);
1339
+ const g = o.flags[d], m = !!(16 & g);
1340
+ 2 & g ? (o.xs.push(m ? i[h] : -i[h]), h++) : m ? o.xs.push(0) : (o.xs.push(e.readShort(i, h)), h += 2);
1341
1341
  }
1342
1342
  o.ys = [];
1343
1343
  for (let d = 0; d < l; d++) {
1344
- const g = o.flags[d], v = !!(32 & g);
1345
- 4 & g ? (o.ys.push(v ? i[h] : -i[h]), h++) : v ? o.ys.push(0) : (o.ys.push(e.readShort(i, h)), h += 2);
1344
+ const g = o.flags[d], m = !!(32 & g);
1345
+ 4 & g ? (o.ys.push(m ? i[h] : -i[h]), h++) : m ? o.ys.push(0) : (o.ys.push(e.readShort(i, h)), h += 2);
1346
1346
  }
1347
1347
  let u = 0, f = 0;
1348
1348
  for (let d = 0; d < l; d++) u += o.xs[d], f += o.ys[d], o.xs[d] = u, o.ys[d] = f;
1349
1349
  } else o.parts = [], o.endPts = [], o.flags = [], o.xs = [], o.ys = [];
1350
1350
  return o;
1351
- } } }, K = { parse(n) {
1351
+ } } }, W = { parse(n) {
1352
1352
  const t = new Uint8Array(n);
1353
- T.readASCII(t, 0, 4) === "wOFF" && (n = Ee(n));
1354
- const e = new Uint8Array(n), i = Et, s = {}, r = { Ee: e, ke: 0, Se: 0 };
1353
+ R.readASCII(t, 0, 4) === "wOFF" && (n = we(n));
1354
+ const e = new Uint8Array(n), i = wt, s = {}, r = { Se: e, ze: 0, ke: 0 };
1355
1355
  for (const h in i) {
1356
- const o = h, c = K.findTable(e, o, 0);
1356
+ const o = h, c = W.findTable(e, o, 0);
1357
1357
  if (c) {
1358
1358
  const [l, u] = c;
1359
1359
  let f = s[l];
@@ -1362,7 +1362,7 @@ const xe = { parseTab(n, t, e) {
1362
1362
  }
1363
1363
  return [r];
1364
1364
  }, findTable(n, t, e) {
1365
- const i = T, s = i.readUshort(n, e + 4);
1365
+ const i = R, s = i.readUshort(n, e + 4);
1366
1366
  let r = e + 12;
1367
1367
  for (let h = 0; h < s; h++) {
1368
1368
  const o = i.readASCII(n, r, 4);
@@ -1372,29 +1372,29 @@ const xe = { parseTab(n, t, e) {
1372
1372
  r += 16;
1373
1373
  }
1374
1374
  return null;
1375
- }, T: Et, B: T };
1375
+ }, T: wt, B: R };
1376
1376
  class Fe {
1377
- ze(t) {
1377
+ De(t) {
1378
1378
  var i;
1379
1379
  const e = [];
1380
1380
  return (i = t.cmap) != null && i.tables ? (t.cmap.tables.forEach((s) => {
1381
1381
  if (s.format === 4) {
1382
- const r = this.De(s);
1382
+ const r = this.Le(s);
1383
1383
  e.push(...r);
1384
1384
  } else if (s.format === 12) {
1385
- const r = this.Le(s);
1385
+ const r = this.Oe(s);
1386
1386
  e.push(...r);
1387
1387
  }
1388
1388
  }), [...new Set(e)]) : [];
1389
1389
  }
1390
- De(t) {
1390
+ Le(t) {
1391
1391
  const e = [];
1392
1392
  if (!(t.startCount && t.endCount && t.idRangeOffset && t.idDelta)) return e;
1393
1393
  for (let i = 0; i < t.startCount.length; i++) {
1394
1394
  const s = t.startCount[i], r = t.endCount[i];
1395
1395
  if (s !== 65535 || r !== 65535) {
1396
1396
  for (let h = s; h <= r; h++)
1397
- if (this.Oe(t, h, i) > 0) try {
1397
+ if (this.Ie(t, h, i) > 0) try {
1398
1398
  const o = String.fromCodePoint(h);
1399
1399
  e.push(o);
1400
1400
  } catch {
@@ -1403,7 +1403,7 @@ class Fe {
1403
1403
  }
1404
1404
  return e;
1405
1405
  }
1406
- Le(t) {
1406
+ Oe(t) {
1407
1407
  const e = [];
1408
1408
  if (!t.groups) return e;
1409
1409
  for (let i = 0; i < t.groups.length; i += 3) {
@@ -1417,7 +1417,7 @@ class Fe {
1417
1417
  }
1418
1418
  return e;
1419
1419
  }
1420
- Oe(t, e, i) {
1420
+ Ie(t, e, i) {
1421
1421
  if (t.idRangeOffset[i] === 0) return e + t.idDelta[i] & 65535;
1422
1422
  {
1423
1423
  const s = t.idRangeOffset[i] / 2 + (e - t.startCount[i]) - (t.startCount.length - i);
@@ -1431,95 +1431,95 @@ class Fe {
1431
1431
  }
1432
1432
  class Pe {
1433
1433
  constructor(t) {
1434
- a(this, "Ie");
1435
1434
  a(this, "Be");
1435
+ a(this, "He");
1436
1436
  a(this, "Z");
1437
- this.Z = t, this.Ie = document.createElement("canvas"), this.Be = this.Ie.getContext("2d", { willReadFrequently: !0, alpha: !0 });
1437
+ this.Z = t, this.Be = document.createElement("canvas"), this.He = this.Be.getContext("2d", { willReadFrequently: !0, alpha: !0 });
1438
1438
  }
1439
- He(t, e, i, s) {
1439
+ Ge(t, e, i, s) {
1440
1440
  const r = t.length, h = Math.ceil(Math.sqrt(r)), o = Math.ceil(r / h), c = e.width * h, l = e.height * o;
1441
- this.Ge(c, l), this.Qe(t, e, h, i, s);
1441
+ this.Qe(c, l), this.Ne(t, e, h, i, s);
1442
1442
  const u = this.Z.Pe(c, l, 1, { filter: "nearest" });
1443
- return u.et(this.Ie), { framebuffer: u, columns: h, rows: o };
1443
+ return u.et(this.Be), { framebuffer: u, columns: h, rows: o };
1444
1444
  }
1445
- Ge(t, e) {
1446
- this.Ie.width = t, this.Ie.height = e, this.Ie.style.width = t + "px", this.Ie.style.height = e + "px", this.Be.imageSmoothingEnabled = !1, this.Ie.style.imageRendering = "pixelated", this.Be.clearRect(0, 0, t, e), this.Be.textBaseline = "top", this.Be.textAlign = "left", this.Be.fillStyle = "white";
1445
+ Qe(t, e) {
1446
+ this.Be.width = t, this.Be.height = e, this.Be.style.width = t + "px", this.Be.style.height = e + "px", this.He.imageSmoothingEnabled = !1, this.Be.style.imageRendering = "pixelated", this.He.clearRect(0, 0, t, e), this.He.textBaseline = "top", this.He.textAlign = "left", this.He.fillStyle = "white";
1447
1447
  }
1448
- Qe(t, e, i, s, r) {
1448
+ Ne(t, e, i, s, r) {
1449
1449
  const h = s / r.head.unitsPerEm;
1450
1450
  for (let o = 0; o < t.length; o++) {
1451
1451
  const c = o % i, l = Math.floor(o / i), u = t[o].glyphData;
1452
1452
  if (!u) continue;
1453
- const f = u.advanceWidth * h, d = c * e.width, g = l * e.height, v = d + 0.5 * e.width, m = g + 0.5 * e.height, A = Math.round(v - 0.5 * e.width), p = Math.round(m - 0.5 * s), w = A + 0.5 * (e.width - f), y = p + r.hhea.ascender * h;
1454
- this.Ne(u, w, y, h);
1453
+ const f = u.advanceWidth * h, d = c * e.width, g = l * e.height, m = d + 0.5 * e.width, v = g + 0.5 * e.height, A = Math.round(m - 0.5 * e.width), p = Math.round(v - 0.5 * s), y = A + 0.5 * (e.width - f), E = p + r.hhea.ascender * h;
1454
+ this.Xe(u, y, E, h);
1455
1455
  }
1456
1456
  }
1457
- Ne(t, e, i, s) {
1457
+ Xe(t, e, i, s) {
1458
1458
  if (!t || !t.xs || t.noc === 0) return;
1459
1459
  let { xs: r, ys: h, endPts: o, flags: c } = t;
1460
1460
  if (!(r && h && o && c)) return;
1461
- this.Be.beginPath();
1461
+ this.He.beginPath();
1462
1462
  let l = 0;
1463
1463
  for (let u = 0; u < o.length; u++) {
1464
1464
  const f = o[u];
1465
1465
  if (!(f < l)) {
1466
1466
  if (f >= l) {
1467
1467
  const d = e + r[l] * s, g = i - h[l] * s;
1468
- this.Be.moveTo(d, g);
1469
- let v = l + 1;
1470
- for (; v <= f; )
1471
- if (1 & c[v]) {
1472
- const m = e + r[v] * s, A = i - h[v] * s;
1473
- this.Be.lineTo(m, A), v++;
1468
+ this.He.moveTo(d, g);
1469
+ let m = l + 1;
1470
+ for (; m <= f; )
1471
+ if (1 & c[m]) {
1472
+ const v = e + r[m] * s, A = i - h[m] * s;
1473
+ this.He.lineTo(v, A), m++;
1474
1474
  } else {
1475
- const m = e + r[v] * s, A = i - h[v] * s;
1476
- if (v + 1 > f) {
1477
- const w = e + r[l] * s, y = i - h[l] * s;
1478
- if (1 & c[l]) this.Be.quadraticCurveTo(m, A, w, y);
1475
+ const v = e + r[m] * s, A = i - h[m] * s;
1476
+ if (m + 1 > f) {
1477
+ const y = e + r[l] * s, E = i - h[l] * s;
1478
+ if (1 & c[l]) this.He.quadraticCurveTo(v, A, y, E);
1479
1479
  else {
1480
- const x = (m + w) / 2, b = (A + y) / 2;
1481
- this.Be.quadraticCurveTo(m, A, x, b);
1480
+ const b = (v + y) / 2, x = (A + E) / 2;
1481
+ this.He.quadraticCurveTo(v, A, b, x);
1482
1482
  }
1483
1483
  break;
1484
1484
  }
1485
- const p = v + 1;
1485
+ const p = m + 1;
1486
1486
  if (1 & c[p]) {
1487
- const w = e + r[p] * s, y = i - h[p] * s;
1488
- this.Be.quadraticCurveTo(m, A, w, y), v = p + 1;
1487
+ const y = e + r[p] * s, E = i - h[p] * s;
1488
+ this.He.quadraticCurveTo(v, A, y, E), m = p + 1;
1489
1489
  } else {
1490
- const w = (m + (e + r[p] * s)) / 2, y = (A + (i - h[p] * s)) / 2;
1491
- this.Be.quadraticCurveTo(m, A, w, y), v = p;
1490
+ const y = (v + (e + r[p] * s)) / 2, E = (A + (i - h[p] * s)) / 2;
1491
+ this.He.quadraticCurveTo(v, A, y, E), m = p;
1492
1492
  }
1493
1493
  }
1494
- this.Be.closePath();
1494
+ this.He.closePath();
1495
1495
  }
1496
1496
  l = f + 1;
1497
1497
  }
1498
1498
  }
1499
- this.Be.fill();
1499
+ this.He.fill();
1500
1500
  }
1501
1501
  }
1502
- class Ut {
1503
- Xe(t, e) {
1502
+ class Nt {
1503
+ Ye(t, e) {
1504
1504
  const i = t.cmap;
1505
1505
  if (!i || !i.tables) return 0;
1506
1506
  let s = 0;
1507
- for (const r of i.tables) if (r.format === 4 ? s = this.Ye(e, r) : r.format === 12 && (s = this.je(e, r)), s > 0) break;
1507
+ for (const r of i.tables) if (r.format === 4 ? s = this.je(e, r) : r.format === 12 && (s = this.We(e, r)), s > 0) break;
1508
1508
  return s;
1509
1509
  }
1510
- We(t, e) {
1510
+ Ke(t, e) {
1511
1511
  const i = e.codePointAt(0);
1512
- return i === void 0 ? 0 : this.Xe(t, i);
1512
+ return i === void 0 ? 0 : this.Ye(t, i);
1513
1513
  }
1514
- Ke(t, e) {
1514
+ Ze(t, e) {
1515
1515
  const i = t.hmtx;
1516
1516
  return i && i.aWidth && i.aWidth.length !== 0 ? e < i.aWidth.length ? i.aWidth[e] : i.aWidth[i.aWidth.length - 1] : 0;
1517
1517
  }
1518
- Ze(t, e) {
1518
+ qe(t, e) {
1519
1519
  const i = e / t.head.unitsPerEm, s = t.hhea.ascender * i, r = t.hhea.descender * i, h = t.hhea.lineGap * i;
1520
1520
  return { ascender: s, descender: r, lineGap: h, lineHeight: s - r + h, unitsPerEm: t.head.unitsPerEm, scale: i };
1521
1521
  }
1522
- Ye(t, e) {
1522
+ je(t, e) {
1523
1523
  const i = e.endCount.length;
1524
1524
  let s = -1;
1525
1525
  for (let r = 0; r < i; r++) if (t <= e.endCount[r]) {
@@ -1537,7 +1537,7 @@ class Ut {
1537
1537
  }
1538
1538
  return 0;
1539
1539
  }
1540
- je(t, e) {
1540
+ We(t, e) {
1541
1541
  const i = e.groups.length / 3;
1542
1542
  for (let s = 0; s < i; s++) {
1543
1543
  const r = e.groups[3 * s], h = e.groups[3 * s + 1], o = e.groups[3 * s + 2];
@@ -1548,169 +1548,169 @@ class Ut {
1548
1548
  }
1549
1549
  class Me {
1550
1550
  constructor() {
1551
- a(this, "qe");
1552
- this.qe = new Ut();
1551
+ a(this, "Ve");
1552
+ this.Ve = new Nt();
1553
1553
  }
1554
- Ve(t, e, i) {
1554
+ Je(t, e, i) {
1555
1555
  let s = 0;
1556
- const r = this.qe.Ze(i, e), h = r.lineHeight;
1556
+ const r = this.Ve.qe(i, e), h = r.lineHeight;
1557
1557
  for (const o of t) {
1558
- const c = this.qe.We(i, o);
1558
+ const c = this.Ve.Ke(i, o);
1559
1559
  if (c === 0) continue;
1560
- const l = this.qe.Ke(i, c) * r.scale;
1560
+ const l = this.Ve.Ze(i, c) * r.scale;
1561
1561
  s = Math.max(s, l);
1562
1562
  }
1563
1563
  return { width: Math.ceil(s), height: Math.ceil(h) };
1564
1564
  }
1565
1565
  }
1566
- class Ue {
1566
+ class Ne {
1567
1567
  constructor() {
1568
- a(this, "Je");
1569
- this.Je = new Ut();
1568
+ a(this, "tr");
1569
+ this.tr = new Nt();
1570
1570
  }
1571
- tr(t, e) {
1571
+ sr(t, e) {
1572
1572
  const i = [], s = /* @__PURE__ */ new Map();
1573
1573
  return t.forEach((r, h) => {
1574
- const o = r.codePointAt(0) || 0, c = { character: r, unicode: o, color: this.sr(h), glyphData: this.ir(e, r) };
1574
+ const o = r.codePointAt(0) || 0, c = { character: r, unicode: o, color: this.ir(h), glyphData: this.er(e, r) };
1575
1575
  i.push(c), s.set(r, c);
1576
1576
  }), { array: i, map: s };
1577
1577
  }
1578
- sr(t) {
1578
+ ir(t) {
1579
1579
  return [t % 256 / 255, Math.floor(t / 256) % 256 / 255, 0];
1580
1580
  }
1581
- ir(t, e) {
1582
- const i = e.codePointAt(0) || 0, s = this.Je.Xe(t, i);
1581
+ er(t, e) {
1582
+ const i = e.codePointAt(0) || 0, s = this.tr.Ye(t, i);
1583
1583
  if (s === 0) return null;
1584
1584
  let r = 0;
1585
1585
  t.hmtx && t.hmtx.aWidth && s > 0 && t.hmtx.aWidth[s] !== void 0 && (r = t.hmtx.aWidth[s]);
1586
- const h = K.T.glyf.Re(t, s);
1586
+ const h = W.T.glyf.Ee(t, s);
1587
1587
  return h ? { ...h, advanceWidth: r } : null;
1588
1588
  }
1589
1589
  }
1590
- class vt {
1590
+ class mt {
1591
1591
  constructor(t, e = 16) {
1592
- a(this, "er");
1593
- a(this, "rr", []);
1594
- a(this, "nr", /* @__PURE__ */ new Map());
1595
- a(this, "hr");
1596
- a(this, "ar", 16);
1597
- a(this, "cr", 0);
1592
+ a(this, "rr");
1593
+ a(this, "nr", []);
1594
+ a(this, "hr", /* @__PURE__ */ new Map());
1595
+ a(this, "ar");
1596
+ a(this, "cr", 16);
1598
1597
  a(this, "lr", 0);
1599
- a(this, "ur", { width: 0, height: 0 });
1600
- a(this, "dr");
1598
+ a(this, "ur", 0);
1599
+ a(this, "dr", { width: 0, height: 0 });
1601
1600
  a(this, "vr");
1602
1601
  a(this, "pr");
1603
1602
  a(this, "gr");
1604
1603
  a(this, "mr");
1605
- this.ar = e, this.vr = new Fe(), this.pr = new Pe(t), this.gr = new Me(), this.mr = new Ue();
1604
+ a(this, "_r");
1605
+ this.cr = e, this.pr = new Fe(), this.gr = new Pe(t), this.mr = new Me(), this._r = new Ne();
1606
1606
  }
1607
- async _r(t) {
1607
+ async yr(t) {
1608
1608
  let e;
1609
1609
  if (t) {
1610
1610
  const i = await fetch(t);
1611
- if (!i.ok) throw new S(`Failed to load font file: ${i.status} ${i.statusText}`);
1611
+ if (!i.ok) throw new U(`Failed to load font file: ${i.status} ${i.statusText}`);
1612
1612
  e = await i.arrayBuffer();
1613
1613
  } else
1614
1614
  e = await (await fetch("data:font/woff;base64,d09GRgABAAAAABbwAAoAAAAAfywAAQABAAAAAAAAAAAAAAAAAAAAAAAAAABjbWFwAAAA9AAAAbsAAAkgIO8lSWdseWYAAAKwAAAOfgAAaLS4ctN0aGVhZAAAETAAAAAsAAAAOCi8/PVoaGVhAAARXAAAABkAAAAkCwEFAmhtdHgAABF4AAAAhQAABAQEAIOAbG9jYQAAEgAAAAKUAAAECAAy54BtYXhwAAAUlAAAABgAAAAgASIAgm5hbWUAABSsAAAB5wAAA6RWz85KT1MvMgAAFpQAAABFAAAAYM+QEyRwb3N0AAAW3AAAABQAAAAgAGkANHja7dRPSFRRFMfx38wdXblw4cJC7M0bz60gWlULGUFctWgR0UIQQkmDyn27kpAQaaEO2jhWJuafiQFtcDJtSqGhiFZtot5x3jzEVQQhlRJcOb0khiRc1+J94R64uw8cOADCAJT/avwZAiIpRCK3/P999KAS9biOSUxhBhlksYjnWMFrvME7vMca1vEF37ANAwkNqYRKqkk1rdLqscqpVVVQryzbils3rJnocHTWPmgfso/ap+0OuysWjlXHogQKUxVVUw3VUh010DE6QXHqph7qpT66TQmaoAxlaZnyVKC39FHHdbNu0e36or6kr4r4TgsTu75HmEcOy76vUPaVsIFNbOHHX74F3/fyD9+A7ztg1//2de76rH18Z8u+AXqwx/dBN5Z9XfqKiKzLqqzIC8nLkixKThZkXuZkVh7KuNyTuzImKRmVO1KxU7ETMtvmu/lqPptPxjOuKXo3vcveYQ+l2lKlO+Im3H632z3vnis+KaaLKc7zM87yHGc4zdM8zkke5H6+xp3cwRe4jVv5DLdwE5/ik3ycj3Cdk3eWnKfOmDPqJJ3hX9sOCvpPC65QcIWCgv5pPwGY9ak7AHja3V07ryQ5FT62axjQaDWsVmiCFQJpA4QINiAgICDYgICAgICAgICAgICAgIAA//AuF9Xlsn2etqv67iIY6apv3+6yj31e33nYA95FiD4uAAHeA7jyLzoA2Paf/Lp/Dun5W8x/Be/AxyCfO79fnj+e25/ZZzlewcM+3wIhwpfwE/Sc9e8YDyLU1ycF5XUD+to+L98O/An8VKQj0lnOtYdM776OJ71fTVC8//N1rLKDGsXl863OjSl5/iyIUu0HjJ+d+uO3rX3rXd33d/DjfR0/h6/n1iK5kWf36Hf2AxpVa6zU7ZLTnt3Q3wN7+tK6MVcBjUP/3vj56diHuT3YxVbKSvl9FdJHeFE4jfmJn2DSSOS9fuJ27SH7umuoL3oLWGOLxh3f2b8bnn/5Ql8n5SEYFD33q/0lKXxwjQfDOZtGgyEz+W8X5txl2zVb9MXO2S8HfD3ncbHousP6WPV2i/R7C+c06HK5ye/lfdl3Bj5Q2qitaLYhgLQWZY+fr/65A9Ly1r10jI783HOffJWZJ6ee8uuB0nmMXeSqWvRz5Dx/tiWf7H0OF+1DuK7vhy4ffP8An/doofqbQNXTqmlNT1c0v4/Eqpy29eBMLHty0PKZoCMW6VqRlDXNwvbD4RW2MYfyjNdXV3LaJuEdKgXcHvX2nHiz27RxHmC9w/qn0AbS+mJbSeX8pO1zlbbogPK7zJxAs3iFtrV8W/LHsHVZvxJ6Rlt7gum1nvjpnHNO4gFJqaoBWOKFVwKqAangorb2j5KKvG5N31O1ownZdhcZH7FuT9nznoxRv4ylrbfvzA9D88GO8uGDtgN0/1O09ntFlv3YhbIf/ml3/dPGqvi6rCMw6jNd53PM07BnK2eCJXmnzxrruI8ObOuxmZ/dxbd5nS77U7I/xaMdLm5/DXzuLLcwXlOLIVQ0an722pou6raGnpp/QYiwR0V5nwDL0Gk/f2TSUalIGOkSvfNAcVNCesV9a2q675FtsVAk4c5GPEfZT27XVqT9PmpxXtVn0577KO3MGrkXs+xKkHZk6EMUS440uO01t+Ark8yGYYjtsleqoPQksLuF0kOd/7TtbZ3XvNalNRNLqK+90fEDTAfy1FWWOBcT9fkTmrExe+viDNccYF+JqHeIbyBtlYxhStbmSc8DSX9/rICoXkkGSMfEJR7QsYAjNlhgn6iNS7T0AtakNnvaJ+W1TeQdeIxHaHtXaMtU+GP3CL5v+2RqHfc5JC6k9DJ6HhFaHHfu9Lc1Z5HlB5JWNOc8NupiUSlpa/7NIx0W0Ra10YcOVWnDfqhodmgI1CM5nrJS1DYKlMmyeAmoZaLrQnmNSRxAV7qZ0u0sr2Q8WbzUrRivE200nZ+x371Yj+idQH+bsOAFD16woZXuheBJI85UYyA+Ht17bJsTKLHHG+tuQpJX/AGX4eu2lq+vh8gQPgaLUpk1h7fcb1SJ4LEnGb+rdUHRHw96riVV36L5EgdqHNByqCTy82hnkrSSk3k5KTNWnJZ/buTlOvQngiceAkd4OHPz0K+tdOmGUYwJht2kcuBEntSRPOmZfyc40tFqD40IQeb2goGZvKIVzW4G5DMcQ4qOY3zVRzpmo1sMg+U1VemumtLofjFeCcxqJIUnM2vJuQeCHiOOwx4ss7pF6u+PtXxmZApbjCti22JtA+hVxUw7z6Xs2sSzMkeklSLPfwalYkjjt/0bHye4gKkXeaig5MpILVRiAd1vCrtP5Aj5uaN2PF1zxrE7koOgaY2PPL9FkccCKlprUZGr+zr0tw56iCvwGBTs+MFFxVbWeTaCQTj2WCBM1NnoWNxOBpBZU8f00hPsFDr+15wPevNsJG4IN+OGwKyWzKnW8S/GDUHZOd+44SsvbDvCuhYUTQSaQSFeWtoR4Xc833VimVzRvgm58QwZFQTthQ+awgQTeuVI7gLrF638Yixi+ot4RVZ5niDPFxBediyXNj++jUWDgkU3Zc96fDKwv4iiylyA4nalMkLX9C1hf24DNNkZyNDkflOPF4BqwdYbv1vLG9VX03W96PVKiCq+A01i5utY2d9YfSMP0qvQ7eFQUHSKvNfpCl21nqNafqf1UQksqfVe1PEPPNiJpY81iZoP119ZTUHojdpseMYqec5zr/2Jgo695rmycZWzSgOpXzMpbFrHu1Zmq/xA8pX3cgEQZU1/YzaexuQbXIoxF9THdaEzz9VaE5fgNVIPR/sIS8fQyipam9JXqHdOtPEIRllqzP7Ewh9063Z2IYH+GiLNUPFXJIcEM4RYc7bEkjwQL4/1fx+aHL8/62Of5vo3y+p92QX2fh18zrNFcPX9sfZAdBDZu8vxCM4clX31Qr9RrLPkDDDau8v8LZRar2N8lSOj1NGsLJeBZam1TIuwpzwepL3CJAvyANsPnj3BAzsD3a5X6ydEaZUSs50b7g2JrYcyG2lRL+xl+jD+Gfod33w82P0FTuYREa3c70CRS82XCtxIueJHXuIMB6tMt+x7lf7m5U4tyK9L3smuLrxqDxYPI30rYzk2h2NzgPXqAvPrQdqUxvdWF2zVwDrHCq0RoI0Hcrzcn9D8BMxYEMszZBzooqa/jsTxSeTthXTm9FC2n+pYEh8uVqyL9436quMD6pnK7njZM6msy4uYsunVquBSi4clVn8gblYc96TFyF04ll2oqCB300cDIbPxrZoqXZ1DHWvNh2irrNxstSaZYa2VB333tOr9mRcx7ETmXKmSFz6GkidstKjZFE8qIX26eG8KoS/b9uij9GFOiwFIVj5NyErT8rZGstdmD4lc4/xaNevd1uwOPCLX7Ems2TTc81MrUVmzyqdOr1v1PCPat9jmQfUYJEEbzNCSse4DevSYCIXal+bDCC3I2+EeTFKd7ltnFNN0sGLIfRcGfSWKD0BPANWTQIqcNtsaAON/1A/BeywPGhybs2ZEA1sH9FbgDMpTQx5L5k4fN/RR8lBHvif2ftB7oa8isVdrdWDxp/Hp6N8MsdUgqdS0M12EZrhC7TpJZZLZOZelRdeDUyffq3s6xPhztK4Xd9h6f4pIieNu4lI/jEN1XEMjbafK6lry/jkOYedyVMyp2vaHGlM8zBjCkdi28NdrNldgLa/a0orYtN6OwoMh7vPAsxb9eNTDrOdJBWuXsb6En8Evb5yTrJw1Y1XTHnmCFNtPkhHnuN+8QwHGi3JUJf4zeaTJsBpFdnik5V4fZq510ifEHMf7M55f2fteR1DJ73gzf4vyO42Or3Z5mZcWdlY6wb3sRvd0olKfGeaCWm5yGEtDwzLH6yPS95wmcVb2BBrYzig5tGb7Bvb5fkyfvW2nRhlxF3cyz8qGOF//eVLXq7P4oQTop9UASTKPr91h1zu5wu753DbqtXUO8pOT6wzdnQfWn2X3Csr5ktxP4FUmlBHHPThBO0mQ6wTFVxbM5mPCeXWP7ha4YDf8BdvAeaGd/XntlgHlW2eMFAR2CBPYAQzPrGeVy1ieYCOQdtpXGZyss4F2rkr5W8tJh06NTd/HGi+1vbiPN6JTeSfP5k0ihAhRQwgad9wQ1dhoKAntU87DfZy/K8SuEsPg82VQRU5xUGU+ZVrp8SMYtOHiwFC+Z1jLG2dqRuhAw01cZ2qeXBk/ROjaAS1TIuKHVp+Fi5YMrHqqahlY3YbJ0E/N2uUTq/0Cvt717Vfwa/gNfAO/hd/B7+EP8Ef4E/wZ/gJ/hb/B3+Ef8E/4F/z7nla+5T+Afp1wHdQRH/F/+/lF6VrSbuP4v/18VHMVmm7q6TX/Czha0mxJrf+YyNyOfRcYeKSap3+b8UufB8GnJSdec6Iu+toF6nHkaeZxvJ5h4PVgj3ILMz5teArdxnr8/PPoCXqiuvR91zoh2pvS8b0SqUD1FLPubHPaK9Q5lU+GzwI3PgfCOsB9NORgqm5OqfVxLMd1L9+A/s2s+0/0a93MTd3NNRHapruGQLnhZTSzpBMuYFNaz7N5RffPo/MnV2zac3wfRX6Vng0As1cTmE5M38U0eS+H0rvZxXtg6460jlQTZ3Snxw+pO9TKz+mOB5vffTs6umGj+UjMb3/QKfndvlP47UsVAO9Drzo11h+T/rF09Po0st98jHsKh31Ruj2UnbYWLuEd/pM9wOwpZ+KqccfWNZsc4F6c3jtf2ou7Ca6akqXRPThzsadua+/4hq7vgmn6uqux6bXw6AjnLMJbXMM5Ixwi8mR2rc3AOfg2nrs4zZlnDFaChbCtk/bwilwMfBxc0iMYy0MX40x2o/ft9D2Znn9Kl+3MO90HUb747jnzjpyCKVeTuij6DllsctyiUzXN0dgE9We1yK54WBffFqtew9TXpbYfy7dILWH/SXxmqeg4zlvRsZfIbuFnic0SHfRtfj4vsaVq532jl/QpYBykzpe/jec7n1uOmhuETi2xzM5vfy01xQC0vkp6PiKpDd07x6qcUc719K0A1YZjpvLivftqNpzxV/tDtXPTWFrbaowzXj+czsG+nmMt/bQspzj7fnvxeeuG4O/s/Xe412VW3+5VuPT+EV97/r++14Gc3ZvQRHrXMz91IrWHZ4FnK7WOVGjJPfAO3R0BczdLKuevQd5LPVsXd/X8PK6Ll2jK0/NM7P4V1PuI51FvsEMV+KhV4T2+22IQF85a0FlLWXs/IHTOX1B5CGCeEDh6V2ZiTK+eee/dnNjOa2xXz2zndd7sq+XYEZ/Gx/exoK5PoOceWNdnef9W9KCT9EYXqkrPxuhC9GA7faMXpHef1smLTDe1qaDY1N4ozLI4fqsHlwpf+3Cu9F1E/Z4AajG3V8430/6bCdq8QQs9b4OqJyQa1+6BACWaTPI8zrROa//7QGJ19U4tHeTTtePNqu3PnVhXJFSjzZFz4eo3Ndqidi/O6J5Z7X+VsS3cYki51T35Iv+merFeuGe69cbJM3Jq1Fn4kUA5rze4o9CRs22iy5jMsYLMS8g5/wOjbDW/AAB42mNgZGBgAOIzT9tXxvPbfGVgYGEAgZokCXVkmgUizsHABFLNwAAACJYG1HjaY2BkYGBhAAEIyc7AwMiAAhgZAQHPABQAAAB42r1TwRaAIAgD88P59PRA0hxUlw578mBDQOwi0i+oDUzb7nC/xyKH8SuwHH/jSx83jnE745c1RO44G9E1WTE14AQtYvKO6PN6BXRW5EONgCazSS4VXiere+sp7F7cQeSp7Pe2YkaxN7fVFhg/8z/1hfnfaBXnZ8k7wNzp/y13+wRWwErCAAAAeNpl0ylUVVEUBuCtoiKgoiIzAjIIMj9mZBZYMsmMjwcuBhEIBoPBYDAYDAaDwWA0GAwGgsFgMBgMBoPBYDAYDAaDweBnlrX+9e6955x/2oeI//664HbEgTL4HnHwZ8Sh1/AlIm0W3kUc3oN9+BFxJBva4E3E0SvwLCIdR/qniGO98Coiw3vG04hMv5n/fj9GZBUD3iz8xx9FnMiBJxEn0+E+/IrIppNt/VQzvITfEadH4HnEmUG4BV8jchaBn7NZgCMXdy7uXGfzeMjjKZ/PfBwF9hTYU/AhotC5QtpFtIt4K7oLnyOK6RXTKP4TUcJDCe5zNXAHcJTiKOWxlEZZPeAo00U5b+XyltM9vw24KvBWyFzpTOWLiCr5qu6BPdV0qx+Cni+sAc4a3mvw1nqu/RZxsRJkrEsDWeo2wAzq8dY/iGgwpwbfGvTdaA6NOmnUb5PnpiTY00S3SXfN/DU/BustdFrMq8VagqcE/YReEjK3+t4qayuPbTTbdNH2PqJdL+06a5e33VoHjg7vHdY7cXTK2ekedPHWha+b5279ddPo1ndPPuDrkbkH3yX5e/XXy3OvzH34+sy132+//P14B/AO6GuA3qBOB3U6hH/It2Haw2Y2rI9hHV6WdcSsR6eAl1GZx3Qwpr9xcxv3PqGDCbyTvE3KM+muT+lwypkpe6bNaZqfaX6v8j7D8wyNGbwzbyNmdTMrzxxfc9bndDFn5vM8zds37x4smMeCHhf5WTKHJb0uuc/L/C7bs4zrGr2kO5m0ntRZkv8VfazIkvI9RSelg5ReUrKvOrvqHq7p4Lr5retx3fcN/5Mb+Dfs25RpE/8mji0etqzfwLHteZufmzrZobfj/K5ednna0/fe/l+Pca7seNpjYGRgYGRkaGBQYAABJgY0AAAP+ACmeNp1ksFO20AQhv8NgRJaUApSy61LDxVc4uAjNxoJReoNKdCrYy8hZb1rrTcIuPMKfaY+QM899RH6AP3tDJEKqlcefzvzz/xrywD21ScoLK9N3ktW5E3hDl6hL7zG7HvhLrMfhNfxGonwBjUnwj2uz8JbzH4R3sZbPArvIMV34T28wQ+6qG6Puz5+Civyb+EOO/4Ir6GvOsJdaLUrvI53KhXeoGYs3MOu+iq8hai+CW/jo/olvIOiA+E97HeKw/xIp8M0nYQ6O/MunpvZwmbhafv01JK/MKGee6ePB8N/JCFzN6dO+8o4bee5cbnRM+NMyKyuFqHytdHR3MXSF0ZfNQOn93rVORoNm4l64ua3NMjsdYxVfZIkeTBZZC73ZeldPfBhllSLKR0KX2ZzlzyY4BO2JmNjrdeXPtjiAIfIcQTNbz/knWKCgBoZzuDhEHEOgxkWsMyFF9Xne/1Mf8Fdo5i3dY1jDOjz/ymB0eEGp63ao2J/Q5YT8pabqOnQsGn1lvuKjoHRc05Tj4x3jCUzRZu5Wp1winvGl54jruHqjI3C0fVW3qDxuWZ/pEvNPzjhylkxrETR5fQoW09HzYDPwJMm7emm8g5Fq8nIjpWHdronLV0TjJmxXJ4nuGwnWPYcAH8BoeumrAB42mNgYmFgnMDAysDCxMDEAAIQGoiNGc6A+CwMENDAwNDNwFDwGMpliHT00WNwYFBQy4aogJCMgSCSGcJTYGAAAEBYBpIAAAB42mNgZoCANAZjIMnIgAYADecAng==")).arrayBuffer();
1615
- await this.yr(e), this.er = K.parse(e)[0], await this.Ar();
1615
+ await this.Ar(e), this.rr = W.parse(e)[0], await this.br();
1616
1616
  }
1617
- br(t) {
1618
- if (t === void 0) return this.ar;
1619
- this.ar = t, this.ur = this.gr.Ve(this.rr.map((i) => i.character), this.ar, this.er);
1620
- const e = this.pr.He(this.rr, this.ur, this.ar, this.er);
1621
- this.hr = e.framebuffer, this.cr = e.columns, this.lr = e.rows;
1617
+ wr(t) {
1618
+ if (t === void 0) return this.cr;
1619
+ this.cr = t, this.dr = this.mr.Je(this.nr.map((i) => i.character), this.cr, this.rr);
1620
+ const e = this.gr.Ge(this.nr, this.dr, this.cr, this.rr);
1621
+ this.ar = e.framebuffer, this.lr = e.columns, this.ur = e.rows;
1622
1622
  }
1623
- async wr(t) {
1623
+ async Cr(t) {
1624
1624
  try {
1625
1625
  const e = await fetch(t);
1626
- if (!e.ok) throw new S(`Failed to load font file: ${e.status} ${e.statusText}`);
1626
+ if (!e.ok) throw new U(`Failed to load font file: ${e.status} ${e.statusText}`);
1627
1627
  const i = await e.arrayBuffer();
1628
- await this.yr(i);
1629
- const s = K.parse(i);
1628
+ await this.Ar(i);
1629
+ const s = W.parse(i);
1630
1630
  if (!s || s.length === 0) throw Error("Failed to parse font file");
1631
- this.er = s[0], await this.Ar();
1631
+ this.rr = s[0], await this.br();
1632
1632
  } catch (e) {
1633
- throw new S("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
1633
+ throw new U("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
1634
1634
  }
1635
1635
  }
1636
- async yr(t) {
1636
+ async Ar(t) {
1637
1637
  const e = Date.now();
1638
- this.dr = new FontFace("CustomFont_" + e, t), await this.dr.load(), document.fonts.add(this.dr);
1638
+ this.vr = new FontFace("CustomFont_" + e, t), await this.vr.load(), document.fonts.add(this.vr);
1639
1639
  }
1640
- async Ar() {
1641
- const t = this.vr.ze(this.er), { array: e, map: i } = this.mr.tr(t, this.er);
1642
- this.rr = e, this.nr = i, this.ur = this.gr.Ve(t, this.ar, this.er);
1643
- const s = this.pr.He(this.rr, this.ur, this.ar, this.er);
1644
- this.hr = s.framebuffer, this.cr = s.columns, this.lr = s.rows;
1640
+ async br() {
1641
+ const t = this.pr.De(this.rr), { array: e, map: i } = this._r.sr(t, this.rr);
1642
+ this.nr = e, this.hr = i, this.dr = this.mr.Je(t, this.cr, this.rr);
1643
+ const s = this.gr.Ge(this.nr, this.dr, this.cr, this.rr);
1644
+ this.ar = s.framebuffer, this.lr = s.columns, this.ur = s.rows;
1645
1645
  }
1646
- Cr(t) {
1647
- const e = this.nr.get(t);
1646
+ Mr(t) {
1647
+ const e = this.hr.get(t);
1648
1648
  return e ? e.color : [0, 0, 0];
1649
1649
  }
1650
- Mr(t) {
1650
+ Fr(t) {
1651
1651
  return Array.from(t).map((e) => {
1652
- const i = this.nr.get(e);
1652
+ const i = this.hr.get(e);
1653
1653
  return i ? i.color : [0, 0, 0];
1654
1654
  });
1655
1655
  }
1656
1656
  gt() {
1657
- this.hr.gt(), document.fonts.delete(this.dr);
1657
+ this.ar.gt(), document.fonts.delete(this.vr);
1658
1658
  }
1659
1659
  get fontFramebuffer() {
1660
- return this.hr;
1660
+ return this.ar;
1661
1661
  }
1662
1662
  get characterMap() {
1663
- return this.nr;
1663
+ return this.hr;
1664
1664
  }
1665
1665
  get characters() {
1666
- return this.rr;
1666
+ return this.nr;
1667
1667
  }
1668
1668
  get textureColumns() {
1669
- return this.cr;
1669
+ return this.lr;
1670
1670
  }
1671
1671
  get textureRows() {
1672
- return this.lr;
1672
+ return this.ur;
1673
1673
  }
1674
1674
  get maxGlyphDimensions() {
1675
- return this.ur;
1675
+ return this.dr;
1676
1676
  }
1677
1677
  get fontSize() {
1678
- return this.ar;
1678
+ return this.cr;
1679
1679
  }
1680
1680
  get font() {
1681
- return this.er;
1681
+ return this.rr;
1682
1682
  }
1683
1683
  }
1684
- class St {
1684
+ class Ut {
1685
1685
  constructor(t, e, i) {
1686
- a(this, "Fr");
1687
1686
  a(this, "Pr");
1687
+ a(this, "$r");
1688
1688
  a(this, "N");
1689
1689
  a(this, "X");
1690
- a(this, "$r");
1691
1690
  a(this, "Tr");
1692
1691
  a(this, "Rr");
1693
1692
  a(this, "Er");
1694
1693
  a(this, "Sr");
1695
- this.Rr = t, this.Er = e, this.Sr = i, this.ti();
1694
+ a(this, "kr");
1695
+ this.Er = t, this.Sr = e, this.kr = i, this.ti();
1696
1696
  }
1697
1697
  ti() {
1698
- this.Fr = Math.floor(this.Rr.width / this.Er), this.Pr = Math.floor(this.Rr.height / this.Sr), this.N = this.Fr * this.Er, this.X = this.Pr * this.Sr, this.$r = Math.floor((this.Rr.width - this.N) / 2), this.Tr = Math.floor((this.Rr.height - this.X) / 2);
1698
+ this.Pr = Math.floor(this.Er.width / this.Sr), this.$r = Math.floor(this.Er.height / this.kr), this.N = this.Pr * this.Sr, this.X = this.$r * this.kr, this.Tr = Math.floor((this.Er.width - this.N) / 2), this.Rr = Math.floor((this.Er.height - this.X) / 2);
1699
1699
  }
1700
- kr(t, e) {
1701
- this.Er = t, this.Sr = e, this.ti();
1700
+ zr(t, e) {
1701
+ this.Sr = t, this.kr = e, this.ti();
1702
1702
  }
1703
1703
  get cellWidth() {
1704
- return this.Er;
1704
+ return this.Sr;
1705
1705
  }
1706
1706
  get cellHeight() {
1707
- return this.Sr;
1707
+ return this.kr;
1708
1708
  }
1709
1709
  get cols() {
1710
- return this.Fr;
1710
+ return this.Pr;
1711
1711
  }
1712
1712
  get rows() {
1713
- return this.Pr;
1713
+ return this.$r;
1714
1714
  }
1715
1715
  get width() {
1716
1716
  return this.N;
@@ -1719,23 +1719,23 @@ class St {
1719
1719
  return this.X;
1720
1720
  }
1721
1721
  get offsetX() {
1722
- return this.$r;
1722
+ return this.Tr;
1723
1723
  }
1724
1724
  get offsetY() {
1725
- return this.Tr;
1725
+ return this.Rr;
1726
1726
  }
1727
1727
  }
1728
- const Se = /^rgba?\(([^)]+)\)$/i;
1728
+ const Ue = /^rgba?\(([^)]+)\)$/i;
1729
1729
  function at(n) {
1730
1730
  return Number.isNaN(n) ? 0 : Math.max(0, Math.min(255, n));
1731
1731
  }
1732
- function Ne(n) {
1732
+ function Se(n) {
1733
1733
  if (!n) return null;
1734
1734
  const t = n.trim().toLowerCase();
1735
1735
  if (!t) return null;
1736
1736
  let e = null;
1737
1737
  return t.startsWith("rgb") && (e = function(i) {
1738
- const s = Se.exec(i.trim());
1738
+ const s = Ue.exec(i.trim());
1739
1739
  if (!s) return null;
1740
1740
  const r = s[1].split(",").map((u) => u.trim());
1741
1741
  if (r.length < 3) return null;
@@ -1743,125 +1743,125 @@ function Ne(n) {
1743
1743
  return [h, o, c, Math.round(l)];
1744
1744
  }(t)), e ? e[3] === 0 ? null : e : null;
1745
1745
  }
1746
- class _e {
1746
+ class De {
1747
1747
  constructor(t = {}) {
1748
- a(this, "Rr");
1749
- a(this, "zr", null);
1750
- a(this, "Dr", !1);
1751
- a(this, "Lr");
1752
- this.Dr = t.overlay ?? !1, this.Dr && t.canvas ? (this.zr = t.canvas, this.Rr = this.Or(), this.Lr = !0, this.Ir()) : t.canvas ? (this.Rr = t.canvas, this.Lr = !1) : (this.Rr = this.Br(t.width, t.height), this.Lr = !0), this.Rr.style.imageRendering = "pixelated";
1748
+ a(this, "Er");
1749
+ a(this, "Dr", null);
1750
+ a(this, "Lr", !1);
1751
+ a(this, "Or");
1752
+ this.Lr = t.overlay ?? !1, this.Lr && t.canvas ? (this.Dr = t.canvas, this.Er = this.Ir(), this.Or = !0, this.Br()) : t.canvas ? (this.Er = t.canvas, this.Or = !1) : (this.Er = this.Hr(t.width, t.height), this.Or = !0), this.Er.style.imageRendering = "pixelated";
1753
1753
  }
1754
- Br(t, e) {
1754
+ Hr(t, e) {
1755
1755
  const i = document.createElement("canvas");
1756
1756
  return i.className = "textmodeCanvas", i.style.imageRendering = "pixelated", i.width = t || 800, i.height = e || 600, document.body.appendChild(i), i;
1757
1757
  }
1758
- Or() {
1758
+ Ir() {
1759
1759
  const t = document.createElement("canvas");
1760
1760
  t.className = "textmodeCanvas", t.style.imageRendering = "pixelated";
1761
- const e = this.zr.getBoundingClientRect();
1761
+ const e = this.Dr.getBoundingClientRect();
1762
1762
  let i = Math.round(e.width), s = Math.round(e.height);
1763
- if (this.zr instanceof HTMLVideoElement) {
1764
- const o = this.zr;
1763
+ if (this.Dr instanceof HTMLVideoElement) {
1764
+ const o = this.Dr;
1765
1765
  (i === 0 || s === 0) && o.videoWidth > 0 && o.videoHeight > 0 && (i = o.videoWidth, s = o.videoHeight);
1766
1766
  }
1767
1767
  t.width = i, t.height = s, t.style.position = "absolute", t.style.pointerEvents = "none";
1768
- const r = window.getComputedStyle(this.zr);
1768
+ const r = window.getComputedStyle(this.Dr);
1769
1769
  let h = parseInt(r.zIndex || "0", 10);
1770
1770
  return isNaN(h) && (h = 0), t.style.zIndex = "" + (h + 1), t;
1771
1771
  }
1772
- Ir() {
1772
+ Br() {
1773
1773
  var t;
1774
- this.Hr(), (t = this.zr.parentNode) == null || t.insertBefore(this.Rr, this.zr.nextSibling);
1774
+ this.Gr(), (t = this.Dr.parentNode) == null || t.insertBefore(this.Er, this.Dr.nextSibling);
1775
1775
  }
1776
- Gr() {
1776
+ Qr() {
1777
1777
  const t = [];
1778
- return this.Dr && this.zr instanceof HTMLElement && (t.push(this.zr), this.zr.parentElement && t.push(this.zr.parentElement)), this.Rr.parentElement && t.push(this.Rr.parentElement), t.push(this.Rr), t.push(document.body), t.push(document.documentElement), t;
1778
+ return this.Lr && this.Dr instanceof HTMLElement && (t.push(this.Dr), this.Dr.parentElement && t.push(this.Dr.parentElement)), this.Er.parentElement && t.push(this.Er.parentElement), t.push(this.Er), t.push(document.body), t.push(document.documentElement), t;
1779
1779
  }
1780
- Qr() {
1781
- const t = this.Gr();
1780
+ Nr() {
1781
+ const t = this.Qr();
1782
1782
  for (const e of t) {
1783
1783
  if (!e) continue;
1784
- const i = Ne(window.getComputedStyle(e).backgroundColor);
1784
+ const i = Se(window.getComputedStyle(e).backgroundColor);
1785
1785
  if (i) return i;
1786
1786
  }
1787
1787
  return [255, 255, 255, 255];
1788
1788
  }
1789
- Hr() {
1790
- if (!this.zr) return;
1791
- const t = this.zr.getBoundingClientRect();
1792
- let e = this.zr.offsetParent;
1789
+ Gr() {
1790
+ if (!this.Dr) return;
1791
+ const t = this.Dr.getBoundingClientRect();
1792
+ let e = this.Dr.offsetParent;
1793
1793
  if (e && e !== document.body) {
1794
1794
  const i = e.getBoundingClientRect();
1795
- this.Rr.style.top = t.top - i.top + "px", this.Rr.style.left = t.left - i.left + "px";
1796
- } else this.Rr.style.top = t.top + window.scrollY + "px", this.Rr.style.left = t.left + window.scrollX + "px";
1797
- }
1798
- Nr(t, e) {
1799
- if (this.Dr) {
1800
- const i = this.zr.getBoundingClientRect();
1801
- this.Rr.width = Math.round(i.width), this.Rr.height = Math.round(i.height), this.Hr();
1802
- } else this.Rr.width = t ?? this.Rr.width, this.Rr.height = e ?? this.Rr.height;
1803
- }
1804
- Xr() {
1805
- const t = this.Rr.getContext("webgl2", { alpha: !0, premultipliedAlpha: !1, preserveDrawingBuffer: !0, antialias: !1, depth: !0, stencil: !1, powerPreference: "high-performance" });
1806
- if (!t) throw new S("`textmode.js` requires WebGL2 support.");
1795
+ this.Er.style.top = t.top - i.top + "px", this.Er.style.left = t.left - i.left + "px";
1796
+ } else this.Er.style.top = t.top + window.scrollY + "px", this.Er.style.left = t.left + window.scrollX + "px";
1797
+ }
1798
+ Xr(t, e) {
1799
+ if (this.Lr) {
1800
+ const i = this.Dr.getBoundingClientRect();
1801
+ this.Er.width = Math.round(i.width), this.Er.height = Math.round(i.height), this.Gr();
1802
+ } else this.Er.width = t ?? this.Er.width, this.Er.height = e ?? this.Er.height;
1803
+ }
1804
+ Yr() {
1805
+ const t = this.Er.getContext("webgl2", { alpha: !0, premultipliedAlpha: !1, preserveDrawingBuffer: !0, antialias: !1, depth: !0, stencil: !1, powerPreference: "high-performance" });
1806
+ if (!t) throw new U("`textmode.js` requires WebGL2 support.");
1807
1807
  return t;
1808
1808
  }
1809
1809
  gt() {
1810
- const t = this.Rr.getContext("webgl") || this.Rr.getContext("webgl2");
1810
+ const t = this.Er.getContext("webgl") || this.Er.getContext("webgl2");
1811
1811
  if (t) {
1812
1812
  const e = t.getExtension("WEBGL_lose_context");
1813
1813
  e == null || e.loseContext();
1814
1814
  }
1815
- this.Lr && this.Rr.parentNode && this.Rr.parentNode.removeChild(this.Rr);
1815
+ this.Or && this.Er.parentNode && this.Er.parentNode.removeChild(this.Er);
1816
1816
  }
1817
1817
  get canvas() {
1818
- return this.Rr;
1818
+ return this.Er;
1819
1819
  }
1820
1820
  get targetCanvas() {
1821
- return this.zr;
1821
+ return this.Dr;
1822
1822
  }
1823
1823
  get width() {
1824
- return this.Rr.width;
1824
+ return this.Er.width;
1825
1825
  }
1826
1826
  get height() {
1827
- return this.Rr.height;
1827
+ return this.Er.height;
1828
1828
  }
1829
1829
  }
1830
1830
  function $(n) {
1831
- return O(parseInt(n, 16), 0, 255);
1831
+ return Z(parseInt(n, 16), 0, 255);
1832
1832
  }
1833
1833
  class M {
1834
1834
  constructor(t, e, i, s) {
1835
- a(this, "Yr");
1836
1835
  a(this, "jr");
1836
+ a(this, "Wr");
1837
1837
  a(this, "r");
1838
1838
  a(this, "g");
1839
1839
  a(this, "b");
1840
1840
  a(this, "a");
1841
- this.r = O(t, 0, 255), this.g = O(e, 0, 255), this.b = O(i, 0, 255), this.a = O(s, 0, 255), this.Yr = [this.r, this.g, this.b, this.a], this.jr = [this.r / 255, this.g / 255, this.b / 255, this.a / 255];
1841
+ this.r = Z(t, 0, 255), this.g = Z(e, 0, 255), this.b = Z(i, 0, 255), this.a = Z(s, 0, 255), this.jr = [this.r, this.g, this.b, this.a], this.Wr = [this.r / 255, this.g / 255, this.b / 255, this.a / 255];
1842
1842
  }
1843
- static Wr(t, e, i, s) {
1844
- if (M.Kr(t)) return t;
1843
+ static Kr(t, e, i, s) {
1844
+ if (M.Zr(t)) return t;
1845
1845
  if (Array.isArray(t)) {
1846
1846
  if (t.length < 3) throw Error("Component tuples must include at least RGB values.");
1847
1847
  const [r, h, o] = t, c = t.length === 4 ? t[3] : 255;
1848
- return M.Zr(r, h, o, c);
1848
+ return M.qr(r, h, o, c);
1849
1849
  }
1850
1850
  if (typeof t == "string") {
1851
1851
  const r = t.trim();
1852
1852
  if (r.length === 0) throw Error("Color strings cannot be empty.");
1853
- return M.qr(r);
1853
+ return M.Vr(r);
1854
1854
  }
1855
- if (typeof t == "number") return typeof e == "number" && typeof i == "number" ? M.Zr(t, e, i, s ?? 255) : M.Vr(t);
1855
+ if (typeof t == "number") return typeof e == "number" && typeof i == "number" ? M.qr(t, e, i, s ?? 255) : M.Jr(t);
1856
1856
  throw Error("Unsupported color input passed to TextmodeColor.$from.");
1857
1857
  }
1858
- static Zr(t, e, i, s = 255) {
1858
+ static qr(t, e, i, s = 255) {
1859
1859
  return new M(t, e, i, s);
1860
1860
  }
1861
- static Vr(t, e = 255) {
1861
+ static Jr(t, e = 255) {
1862
1862
  return new M(t, t, t, e);
1863
1863
  }
1864
- static qr(t) {
1864
+ static Vr(t) {
1865
1865
  return new M(...function(e) {
1866
1866
  const i = e.replace(/^#|0x/gi, ""), s = (r = i).length === 3 || r.length === 4 ? r.split("").map((h) => h + h).join("") : r;
1867
1867
  var r;
@@ -1873,15 +1873,15 @@ class M {
1873
1873
  return [this.r, this.g, this.b];
1874
1874
  }
1875
1875
  get rgba() {
1876
- return [...this.Yr];
1876
+ return [...this.jr];
1877
1877
  }
1878
1878
  get normalized() {
1879
- return [...this.jr];
1879
+ return [...this.Wr];
1880
1880
  }
1881
1881
  withAlpha(t) {
1882
1882
  return new M(this.r, this.g, this.b, t);
1883
1883
  }
1884
- static Kr(t) {
1884
+ static Zr(t) {
1885
1885
  return t instanceof M;
1886
1886
  }
1887
1887
  }
@@ -1892,48 +1892,48 @@ function Le(n) {
1892
1892
  function $e(n) {
1893
1893
  pt.delete(n);
1894
1894
  }
1895
- function Be(n) {
1895
+ function _e(n) {
1896
1896
  return pt.get(n);
1897
1897
  }
1898
- class Nt {
1898
+ class St {
1899
1899
  constructor(t, e, i, s, r, h, o, c) {
1900
1900
  a(this, "A");
1901
1901
  a(this, "Z");
1902
- a(this, "Jr");
1903
1902
  a(this, "tn");
1904
1903
  a(this, "sn");
1904
+ a(this, "en");
1905
1905
  a(this, "N");
1906
1906
  a(this, "X");
1907
1907
  a(this, "q", null);
1908
- a(this, "er");
1909
- a(this, "en", "brightness");
1910
- a(this, "rn", null);
1908
+ a(this, "rr");
1909
+ a(this, "rn", "brightness");
1910
+ a(this, "nn", null);
1911
1911
  a(this, "Rt", 0);
1912
1912
  a(this, "Gt", 0);
1913
1913
  a(this, "Qt", 0);
1914
1914
  a(this, "Et", 0);
1915
- a(this, "nn", "sampled");
1916
- a(this, "hn", "fixed");
1915
+ a(this, "hn", "sampled");
1916
+ a(this, "an", "fixed");
1917
1917
  a(this, "Xt", [1, 1, 1, 1]);
1918
1918
  a(this, "Yt", [0, 0, 0, 1]);
1919
- a(this, "an", [0, 0, 0, 1]);
1920
- a(this, "cn", [[0.1, 0, 0]]);
1921
- a(this, "ln", null);
1922
- a(this, "un", /* @__PURE__ */ new Set());
1923
- a(this, "fn", [[0, 0, 0, 0]]);
1924
- a(this, "dn", 0);
1925
- this.A = t, this.Z = e, this.Jr = i, this.er = s, this.tn = r, this.sn = h, this.N = o, this.X = c;
1919
+ a(this, "cn", [0, 0, 0, 1]);
1920
+ a(this, "ln", [[0.1, 0, 0]]);
1921
+ a(this, "un", null);
1922
+ a(this, "fn", /* @__PURE__ */ new Set());
1923
+ a(this, "dn", [[0, 0, 0, 0]]);
1924
+ a(this, "vn", 0);
1925
+ this.A = t, this.Z = e, this.tn = i, this.rr = s, this.sn = r, this.en = h, this.N = o, this.X = c;
1926
1926
  }
1927
1927
  conversionMode(t) {
1928
- return this.en = t, this.rn = null, this.q = null, this;
1928
+ return this.rn = t, this.nn = null, this.q = null, this;
1929
1929
  }
1930
1930
  gt() {
1931
- this.A.deleteTexture(this.Jr);
1932
- for (const t of this.un) t();
1933
- this.un.clear();
1931
+ this.A.deleteTexture(this.tn);
1932
+ for (const t of this.fn) t();
1933
+ this.fn.clear();
1934
1934
  }
1935
- vn(t) {
1936
- this.un.add(t);
1935
+ pn(t) {
1936
+ this.fn.add(t);
1937
1937
  }
1938
1938
  invert(t = !0) {
1939
1939
  return this.Rt = t ? 1 : 0, this.q = null, this;
@@ -1945,41 +1945,41 @@ class Nt {
1945
1945
  return this.Qt = t ? 1 : 0, this.q = null, this;
1946
1946
  }
1947
1947
  charRotation(t) {
1948
- return this.Et = Rt(t), this.q = null, this;
1948
+ return this.Et = Tt(t), this.q = null, this;
1949
1949
  }
1950
1950
  charColorMode(t) {
1951
- return this.nn = t, this.q = null, this;
1951
+ return this.hn = t, this.q = null, this;
1952
1952
  }
1953
1953
  cellColorMode(t) {
1954
- return this.hn = t, this.q = null, this;
1954
+ return this.an = t, this.q = null, this;
1955
1955
  }
1956
1956
  charColor(t, e, i, s) {
1957
- return this.pn(this.Xt, t, e, i, s), this.q = null, this;
1957
+ return this.gn(this.Xt, t, e, i, s), this.q = null, this;
1958
1958
  }
1959
1959
  cellColor(t, e, i, s) {
1960
- return this.pn(this.Yt, t, e, i, s), this.q = null, this;
1960
+ return this.gn(this.Yt, t, e, i, s), this.q = null, this;
1961
1961
  }
1962
1962
  background(t, e, i, s) {
1963
- return this.pn(this.an, t, e, i, s), this.q = null, this;
1963
+ return this.gn(this.cn, t, e, i, s), this.q = null, this;
1964
1964
  }
1965
1965
  colorFilter(t) {
1966
- if (!t || t.length === 0) return this.dn = 0, this.fn = [[0, 0, 0, 0]], this.q = null, this;
1966
+ if (!t || t.length === 0) return this.vn = 0, this.dn = [[0, 0, 0, 0]], this.q = null, this;
1967
1967
  const e = [];
1968
1968
  for (const i of t) {
1969
1969
  if (e.length >= 64) break;
1970
- let s = M.Wr(i);
1970
+ let s = M.Kr(i);
1971
1971
  e.push(s.normalized);
1972
1972
  }
1973
- return this.fn = e, this.dn = e.length, this.q = null, this;
1973
+ return this.dn = e, this.vn = e.length, this.q = null, this;
1974
1974
  }
1975
1975
  characters(t) {
1976
- return this.ln = t, this.gn(t), this.q = null, this;
1976
+ return this.un = t, this.mn(t), this.q = null, this;
1977
1977
  }
1978
- mn(t) {
1979
- this.er = t, this.ln && this.gn(this.ln), this.q = null;
1978
+ _n(t) {
1979
+ this.rr = t, this.un && this.mn(this.un), this.q = null;
1980
1980
  }
1981
1981
  get texture() {
1982
- return this.Jr;
1982
+ return this.tn;
1983
1983
  }
1984
1984
  get width() {
1985
1985
  return this.N;
@@ -1988,191 +1988,188 @@ class Nt {
1988
1988
  return this.X;
1989
1989
  }
1990
1990
  get originalWidth() {
1991
- return this.tn;
1991
+ return this.sn;
1992
1992
  }
1993
1993
  get originalHeight() {
1994
- return this.sn;
1994
+ return this.en;
1995
1995
  }
1996
1996
  ut() {
1997
1997
  return this.q || this.ft(), this.q;
1998
1998
  }
1999
- _n() {
1999
+ yn() {
2000
2000
  }
2001
2001
  ft() {
2002
- this._n();
2003
- const t = this.yn(), e = this.An(), i = t.createShader(e), s = t.createUniforms(e);
2002
+ this.yn();
2003
+ const t = this.An(), e = this.bn(), i = t.createShader(e), s = t.createUniforms(e);
2004
2004
  this.q = this.Z.materialManager.Ni(i, s);
2005
2005
  }
2006
- pn(t, e, i, s, r) {
2007
- const h = M.Wr(e, i, s, r);
2006
+ gn(t, e, i, s, r) {
2007
+ const h = M.Kr(e, i, s, r);
2008
2008
  tt(t, h.r, h.g, h.b, h.a);
2009
2009
  }
2010
- gn(t) {
2011
- const e = this.er.Mr(t).filter((i) => Array.isArray(i)).slice(0, 255);
2012
- this.cn = e.length > 0 ? e : this.cn;
2010
+ mn(t) {
2011
+ const e = this.rr.Fr(t).filter((i) => Array.isArray(i)).slice(0, 255);
2012
+ this.ln = e.length > 0 ? e : this.ln;
2013
2013
  }
2014
2014
  createBaseConversionUniforms() {
2015
- const t = this.dn > 0;
2016
- return { u_image: this.bn(), u_invert: !!this.Rt, u_flipX: !!this.Gt, u_flipY: !!this.Qt, u_charRotation: this.Et, u_charColorFixed: this.nn === "fixed", u_charColor: this.Xt, u_cellColorFixed: this.hn === "fixed", u_cellColor: this.Yt, u_backgroundColor: this.an, u_charCount: this.cn.length, u_charList: this.cn, u_colorFilterEnabled: t, u_colorFilterSize: t ? this.dn : 0, u_colorFilterPalette: this.fn };
2017
- }
2018
- yn() {
2019
- if (this.rn && this.rn.id === this.en) return this.rn;
2020
- const t = Be(this.en);
2021
- if (!t) throw Error(`[textmode.js] Conversion mode "${this.en}" is not registered. If this mode is provided by an add-on, make sure its plugin is installed before loading sources.`);
2022
- return this.rn = t, t;
2015
+ const t = this.vn > 0;
2016
+ return { u_image: this.wn(), u_invert: !!this.Rt, u_flipX: !!this.Gt, u_flipY: !!this.Qt, u_charRotation: this.Et, u_charColorFixed: this.hn === "fixed", u_charColor: this.Xt, u_cellColorFixed: this.an === "fixed", u_cellColor: this.Yt, u_backgroundColor: this.cn, u_charCount: this.ln.length, u_charList: this.ln, u_colorFilterEnabled: t, u_colorFilterSize: t ? this.vn : 0, u_colorFilterPalette: this.dn };
2023
2017
  }
2024
2018
  An() {
2025
- return { renderer: this.Z, gl: this.A, font: this.er, source: this, gridWidth: this.N, gridHeight: this.X };
2019
+ if (this.nn && this.nn.id === this.rn) return this.nn;
2020
+ const t = _e(this.rn);
2021
+ if (!t) throw Error(`[textmode.js] Conversion mode "${this.rn}" is not registered. If this mode is provided by an add-on, make sure its plugin is installed before loading sources.`);
2022
+ return this.nn = t, t;
2023
+ }
2024
+ bn() {
2025
+ return { renderer: this.Z, gl: this.A, font: this.rr, source: this, gridWidth: this.N, gridHeight: this.X };
2026
2026
  }
2027
2027
  }
2028
- class Y extends Nt {
2028
+ class I extends St {
2029
2029
  constructor(t, e, i, s, r, h, o, c) {
2030
2030
  const l = Math.min(o / r, c / h);
2031
2031
  super(t, e, i, s, r, h, Math.max(1, Math.floor(r * l)), Math.max(1, Math.floor(h * l)));
2032
2032
  }
2033
- static wn(t, e, i, s, r) {
2033
+ static Cn(t, e, i, s, r) {
2034
2034
  const h = t.context, o = h.createTexture();
2035
2035
  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, i), h.bindTexture(h.TEXTURE_2D, null);
2036
2036
  const c = i.naturalWidth ?? i.width ?? i.videoWidth ?? 0, l = i.naturalHeight ?? i.height ?? i.videoHeight ?? 0;
2037
- return new Y(h, t, o, e, c, l, s, r);
2037
+ return new I(h, t, o, e, c, l, s, r);
2038
2038
  }
2039
- bn() {
2040
- return this.Jr;
2039
+ wn() {
2040
+ return this.tn;
2041
2041
  }
2042
2042
  }
2043
- class _t {
2043
+ class Dt {
2044
2044
  constructor(t = 60) {
2045
- a(this, "Cn");
2046
- a(this, "xn", null);
2047
- a(this, "Mn", 0);
2048
- a(this, "Fn", !0);
2049
- a(this, "Pn", 0);
2045
+ a(this, "xn");
2046
+ a(this, "Mn", null);
2047
+ a(this, "Fn", 0);
2048
+ a(this, "Pn", !0);
2050
2049
  a(this, "$n", 0);
2051
- a(this, "Tn", []);
2052
- a(this, "Rn", 10);
2053
- a(this, "En", 0);
2054
- this.Cn = 1e3 / t;
2055
- }
2056
- Sn(t) {
2057
- if (!this.Fn) return;
2058
- this.Mn = performance.now();
2050
+ a(this, "Tn", 0);
2051
+ a(this, "Rn", []);
2052
+ a(this, "En", 10);
2053
+ a(this, "Sn", 0);
2054
+ this.xn = 1e3 / t;
2055
+ }
2056
+ kn(t) {
2057
+ if (!this.Pn) return;
2058
+ this.Fn = performance.now();
2059
2059
  const e = (i) => {
2060
- if (!this.Fn) return void (this.xn = null);
2061
- const s = i - this.Mn;
2062
- s >= this.Cn && (t(), this.Mn = i - s % this.Cn), this.Fn && (this.xn = requestAnimationFrame(e));
2060
+ if (!this.Pn) return void (this.Mn = null);
2061
+ const s = i - this.Fn;
2062
+ s >= this.xn && (t(), this.Fn = i - s % this.xn), this.Pn && (this.Mn = requestAnimationFrame(e));
2063
2063
  };
2064
- this.xn = requestAnimationFrame(e);
2065
- }
2066
- kn() {
2067
- this.xn && (cancelAnimationFrame(this.xn), this.xn = null);
2064
+ this.Mn = requestAnimationFrame(e);
2068
2065
  }
2069
2066
  zn() {
2070
- this.Fn && (this.Fn = !1, this.kn());
2067
+ this.Mn && (cancelAnimationFrame(this.Mn), this.Mn = null);
2068
+ }
2069
+ Dn() {
2070
+ this.Pn && (this.Pn = !1, this.zn());
2071
2071
  }
2072
- Dn(t) {
2073
- this.Fn || (this.Fn = !0, this.Sn(t));
2072
+ Ln(t) {
2073
+ this.Pn || (this.Pn = !0, this.kn(t));
2074
2074
  }
2075
- Ln(t, e) {
2076
- if (t === void 0) return this.Pn;
2077
- this.Cn = 1e3 / t, this.Fn && e && (this.kn(), this.Sn(e));
2075
+ On(t, e) {
2076
+ if (t === void 0) return this.$n;
2077
+ this.xn = 1e3 / t, this.Pn && e && (this.zn(), this.kn(e));
2078
2078
  }
2079
- On() {
2079
+ In() {
2080
2080
  const t = performance.now();
2081
- if (this.$n > 0) {
2082
- const e = t - this.$n;
2083
- this.Tn.push(e), this.Tn.length > this.Rn && this.Tn.shift();
2084
- const i = this.Tn.reduce((s, r) => s + r, 0) / this.Tn.length;
2085
- this.Pn = 1e3 / i;
2081
+ if (this.Tn > 0) {
2082
+ const e = t - this.Tn;
2083
+ this.Rn.push(e), this.Rn.length > this.En && this.Rn.shift();
2084
+ const i = this.Rn.reduce((s, r) => s + r, 0) / this.Rn.length;
2085
+ this.$n = 1e3 / i;
2086
2086
  }
2087
- this.$n = t;
2088
- }
2089
- get In() {
2090
- return this.Fn;
2087
+ this.Tn = t;
2091
2088
  }
2092
2089
  get Bn() {
2093
2090
  return this.Pn;
2094
2091
  }
2095
2092
  get Hn() {
2096
- return this.En;
2093
+ return this.$n;
2094
+ }
2095
+ get Gn() {
2096
+ return this.Sn;
2097
2097
  }
2098
- set Hn(t) {
2099
- this.En = t;
2098
+ set Gn(t) {
2099
+ this.Sn = t;
2100
2100
  }
2101
- Gn() {
2102
- this.En++;
2101
+ Qn() {
2102
+ this.Sn++;
2103
2103
  }
2104
2104
  }
2105
2105
  class Lt {
2106
2106
  constructor(t) {
2107
- a(this, "Rr");
2108
- a(this, "Qn");
2109
- a(this, "Nn", { x: -1, y: -1 });
2107
+ a(this, "Er");
2108
+ a(this, "Nn");
2110
2109
  a(this, "Xn", { x: -1, y: -1 });
2111
- a(this, "Yn", null);
2112
- a(this, "jn", 0);
2113
- a(this, "Wn");
2110
+ a(this, "Yn", { x: -1, y: -1 });
2111
+ a(this, "jn", null);
2112
+ a(this, "Wn", 0);
2114
2113
  a(this, "Kn");
2115
2114
  a(this, "Zn");
2116
2115
  a(this, "qn");
2117
2116
  a(this, "Vn");
2118
2117
  a(this, "Jn");
2119
- a(this, "th", !1);
2120
- a(this, "sh");
2118
+ a(this, "th");
2119
+ a(this, "sh", !1);
2121
2120
  a(this, "ih");
2122
2121
  a(this, "eh");
2123
2122
  a(this, "rh");
2124
2123
  a(this, "nh");
2125
- this.Rr = t;
2124
+ a(this, "hh");
2125
+ this.Er = t;
2126
2126
  }
2127
- hh(t) {
2127
+ oh(t) {
2128
2128
  const e = performance.now() + Math.max(0, t);
2129
- e > this.jn && (this.jn = e);
2129
+ e > this.Wn && (this.Wn = e);
2130
2130
  }
2131
- oh() {
2132
- return performance.now() < this.jn;
2131
+ ah() {
2132
+ return performance.now() < this.Wn;
2133
2133
  }
2134
- ah(t) {
2135
- const e = this.Rr.canvas;
2134
+ uh(t) {
2135
+ const e = this.Er.canvas;
2136
2136
  e.style.cursor = t == null || t === "" ? "" : t;
2137
2137
  }
2138
- _r(t) {
2139
- this.Qn = t, this.uh();
2138
+ yr(t) {
2139
+ this.Nn = t, this.fh();
2140
2140
  }
2141
- fh() {
2142
- if (this.th) return;
2143
- const t = this.Rr.canvas;
2144
- this.Wn = (e) => {
2145
- this.dh(e), this.ph(e);
2146
- }, this.Kn = () => {
2147
- this.Xn = { ...this.Nn }, this.Nn.x = -1, this.Nn.y = -1, this.Yn = null;
2148
- }, this.Zn = (e) => {
2149
- this.dh(e), this.gh(e);
2141
+ dh() {
2142
+ if (this.sh) return;
2143
+ const t = this.Er.canvas;
2144
+ this.Kn = (e) => {
2145
+ this.ph(e), this.gh(e);
2146
+ }, this.Zn = () => {
2147
+ this.Yn = { ...this.Xn }, this.Xn.x = -1, this.Xn.y = -1, this.jn = null;
2150
2148
  }, this.qn = (e) => {
2151
- this.dh(e), this.mh(e);
2149
+ this.ph(e), this.mh(e);
2152
2150
  }, this.Vn = (e) => {
2153
- this.dh(e), this._h(e);
2151
+ this.ph(e), this._h(e);
2154
2152
  }, this.Jn = (e) => {
2155
- this.dh(e), this.yh(e);
2156
- }, t.addEventListener("mousemove", this.Wn, { passive: !0 }), t.addEventListener("mouseleave", this.Kn, { passive: !0 }), t.addEventListener("mousedown", this.Zn, { passive: !0 }), t.addEventListener("mouseup", this.qn, { passive: !0 }), t.addEventListener("click", this.Vn, { passive: !0 }), t.addEventListener("wheel", this.Jn, { passive: !1 }), this.th = !0;
2157
- }
2158
- Ah() {
2159
- if (!this.th) return;
2160
- const t = this.Rr.canvas;
2161
- t.removeEventListener("mousemove", this.Wn), t.removeEventListener("mouseleave", this.Kn), t.removeEventListener("mousedown", this.Zn), t.removeEventListener("mouseup", this.qn), t.removeEventListener("click", this.Vn), t.removeEventListener("wheel", this.Jn), this.th = !1;
2162
- }
2163
- uh() {
2164
- if (this.th) try {
2165
- if (this.Yn) {
2166
- const t = new MouseEvent("mousemove", { clientX: this.Yn.x, clientY: this.Yn.y, bubbles: !1, cancelable: !1 });
2167
- this.dh(t);
2168
- } else this.Nn.x !== -1 && this.Nn.y !== -1 && (this.Nn.x >= this.Qn.cols || this.Nn.y >= this.Qn.rows) && (this.Nn.x = -1, this.Nn.y = -1);
2153
+ this.ph(e), this.yh(e);
2154
+ }, this.th = (e) => {
2155
+ this.ph(e), this.Ah(e);
2156
+ }, t.addEventListener("mousemove", this.Kn, { passive: !0 }), t.addEventListener("mouseleave", this.Zn, { passive: !0 }), t.addEventListener("mousedown", this.qn, { passive: !0 }), t.addEventListener("mouseup", this.Vn, { passive: !0 }), t.addEventListener("click", this.Jn, { passive: !0 }), t.addEventListener("wheel", this.th, { passive: !1 }), this.sh = !0;
2157
+ }
2158
+ bh() {
2159
+ if (!this.sh) return;
2160
+ const t = this.Er.canvas;
2161
+ t.removeEventListener("mousemove", this.Kn), t.removeEventListener("mouseleave", this.Zn), t.removeEventListener("mousedown", this.qn), t.removeEventListener("mouseup", this.Vn), t.removeEventListener("click", this.Jn), t.removeEventListener("wheel", this.th), this.sh = !1;
2162
+ }
2163
+ fh() {
2164
+ if (this.sh) try {
2165
+ if (this.jn) {
2166
+ const t = new MouseEvent("mousemove", { clientX: this.jn.x, clientY: this.jn.y, bubbles: !1, cancelable: !1 });
2167
+ this.ph(t);
2168
+ } else this.Xn.x !== -1 && this.Xn.y !== -1 && (this.Xn.x >= this.Nn.cols || this.Xn.y >= this.Nn.rows) && (this.Xn.x = -1, this.Xn.y = -1);
2169
2169
  } catch {
2170
- this.Nn.x = -1, this.Nn.y = -1;
2170
+ this.Xn.x = -1, this.Xn.y = -1;
2171
2171
  }
2172
2172
  }
2173
- bh(t) {
2174
- this.sh = t;
2175
- }
2176
2173
  wh(t) {
2177
2174
  this.ih = t;
2178
2175
  }
@@ -2185,136 +2182,138 @@ class Lt {
2185
2182
  Mh(t) {
2186
2183
  this.nh = t;
2187
2184
  }
2188
- Fh() {
2189
- return { x: this.Nn.x, y: this.Nn.y };
2185
+ Fh(t) {
2186
+ this.hh = t;
2190
2187
  }
2191
- ph(t) {
2192
- if (this.rh && !this.oh()) {
2193
- const e = { position: { ...this.Nn }, previousPosition: { ...this.Xn }, originalEvent: t };
2194
- this.rh(e);
2195
- }
2188
+ Ph() {
2189
+ return { x: this.Xn.x, y: this.Xn.y };
2196
2190
  }
2197
2191
  gh(t) {
2198
- if (this.ih && !this.oh()) {
2199
- const e = { position: { ...this.Nn }, previousPosition: { ...this.Xn }, button: t.button, originalEvent: t };
2200
- this.ih(e);
2192
+ if (this.nh && !this.ah()) {
2193
+ const e = { position: { ...this.Xn }, previousPosition: { ...this.Yn }, originalEvent: t };
2194
+ this.nh(e);
2201
2195
  }
2202
2196
  }
2203
2197
  mh(t) {
2204
- if (this.eh && !this.oh()) {
2205
- const e = { position: { ...this.Nn }, previousPosition: { ...this.Xn }, button: t.button, originalEvent: t };
2198
+ if (this.eh && !this.ah()) {
2199
+ const e = { position: { ...this.Xn }, previousPosition: { ...this.Yn }, button: t.button, originalEvent: t };
2206
2200
  this.eh(e);
2207
2201
  }
2208
2202
  }
2209
2203
  _h(t) {
2210
- if (this.sh && !this.oh()) {
2211
- const e = { position: { ...this.Nn }, previousPosition: { ...this.Xn }, button: t.button, originalEvent: t };
2212
- this.sh(e);
2204
+ if (this.rh && !this.ah()) {
2205
+ const e = { position: { ...this.Xn }, previousPosition: { ...this.Yn }, button: t.button, originalEvent: t };
2206
+ this.rh(e);
2213
2207
  }
2214
2208
  }
2215
2209
  yh(t) {
2216
- if (this.nh && !this.oh()) {
2217
- const e = { position: { ...this.Nn }, previousPosition: { ...this.Xn }, delta: { x: t.deltaX, y: t.deltaY }, originalEvent: t };
2218
- this.nh(e);
2210
+ if (this.ih && !this.ah()) {
2211
+ const e = { position: { ...this.Xn }, previousPosition: { ...this.Yn }, button: t.button, originalEvent: t };
2212
+ this.ih(e);
2213
+ }
2214
+ }
2215
+ Ah(t) {
2216
+ if (this.hh && !this.ah()) {
2217
+ const e = { position: { ...this.Xn }, previousPosition: { ...this.Yn }, delta: { x: t.deltaX, y: t.deltaY }, originalEvent: t };
2218
+ this.hh(e);
2219
2219
  }
2220
2220
  }
2221
- dh(t) {
2222
- const e = this.Rr.canvas;
2223
- this.Xn = { ...this.Nn }, this.Yn = { x: t.clientX, y: t.clientY };
2224
- 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.Qn.offsetX, l = o - this.Qn.offsetY, u = Math.floor(c / this.Qn.cellWidth), f = Math.floor(l / this.Qn.cellHeight);
2225
- u >= 0 && u < this.Qn.cols && f >= 0 && f < this.Qn.rows ? (this.Nn.x = u, this.Nn.y = f) : (this.Nn.x = -1, this.Nn.y = -1);
2221
+ ph(t) {
2222
+ const e = this.Er.canvas;
2223
+ this.Yn = { ...this.Xn }, this.jn = { x: t.clientX, y: t.clientY };
2224
+ 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.Nn.offsetX, l = o - this.Nn.offsetY, u = Math.floor(c / this.Nn.cellWidth), f = Math.floor(l / this.Nn.cellHeight);
2225
+ u >= 0 && u < this.Nn.cols && f >= 0 && f < this.Nn.rows ? (this.Xn.x = u, this.Xn.y = f) : (this.Xn.x = -1, this.Xn.y = -1);
2226
2226
  }
2227
2227
  }
2228
- const Ie = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Lt }, Symbol.toStringTag, { value: "Module" }));
2229
- class Bt {
2228
+ const Be = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Lt }, Symbol.toStringTag, { value: "Module" }));
2229
+ class _t {
2230
2230
  constructor() {
2231
- a(this, "Ph", /* @__PURE__ */ new Map());
2232
- a(this, "$h", null);
2231
+ a(this, "$h", /* @__PURE__ */ new Map());
2233
2232
  a(this, "Th", null);
2234
- a(this, "Rh");
2233
+ a(this, "Rh", null);
2235
2234
  a(this, "Eh");
2236
- a(this, "th", !1);
2237
2235
  a(this, "Sh");
2236
+ a(this, "sh", !1);
2238
2237
  a(this, "kh");
2239
- a(this, "zh", { 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" });
2238
+ a(this, "zh");
2239
+ a(this, "Dh", { 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" });
2240
2240
  }
2241
- fh() {
2242
- this.th || (this.Rh = (t) => {
2243
- this.Dh(t);
2244
- }, this.Eh = (t) => {
2241
+ dh() {
2242
+ this.sh || (this.Eh = (t) => {
2245
2243
  this.Lh(t);
2246
- }, window.addEventListener("keydown", this.Rh, { passive: !1 }), window.addEventListener("keyup", this.Eh, { passive: !1 }), this.th = !0);
2247
- }
2248
- Ah() {
2249
- this.th && (window.removeEventListener("keydown", this.Rh), window.removeEventListener("keyup", this.Eh), this.th = !1, this.Ph.clear(), this.$h = null, this.Th = null);
2244
+ }, this.Sh = (t) => {
2245
+ this.Oh(t);
2246
+ }, window.addEventListener("keydown", this.Eh, { passive: !1 }), window.addEventListener("keyup", this.Sh, { passive: !1 }), this.sh = !0);
2250
2247
  }
2251
- wh(t) {
2252
- this.Sh = t;
2248
+ bh() {
2249
+ this.sh && (window.removeEventListener("keydown", this.Eh), window.removeEventListener("keyup", this.Sh), this.sh = !1, this.$h.clear(), this.Th = null, this.Rh = null);
2253
2250
  }
2254
2251
  Ch(t) {
2255
2252
  this.kh = t;
2256
2253
  }
2257
- Oh(t) {
2258
- const e = this.Ih(t), i = this.Ph.get(t) || this.Ph.get(e);
2259
- return (i == null ? void 0 : i.isPressed) || !1;
2254
+ xh(t) {
2255
+ this.zh = t;
2260
2256
  }
2261
- Bh() {
2262
- return this.$h;
2257
+ Ih(t) {
2258
+ const e = this.Bh(t), i = this.$h.get(t) || this.$h.get(e);
2259
+ return (i == null ? void 0 : i.isPressed) || !1;
2263
2260
  }
2264
2261
  Hh() {
2265
2262
  return this.Th;
2266
2263
  }
2267
2264
  Gh() {
2268
- const t = [];
2269
- for (const [e, i] of this.Ph) i.isPressed && t.push(e);
2270
- return t;
2265
+ return this.Rh;
2271
2266
  }
2272
2267
  Qh() {
2273
- return { ctrl: this.Oh("Control"), shift: this.Oh("Shift"), alt: this.Oh("Alt"), meta: this.Oh("Meta") };
2268
+ const t = [];
2269
+ for (const [e, i] of this.$h) i.isPressed && t.push(e);
2270
+ return t;
2274
2271
  }
2275
2272
  Nh() {
2276
- this.Ph.clear(), this.$h = null, this.Th = null;
2273
+ return { ctrl: this.Ih("Control"), shift: this.Ih("Shift"), alt: this.Ih("Alt"), meta: this.Ih("Meta") };
2274
+ }
2275
+ Xh() {
2276
+ this.$h.clear(), this.Th = null, this.Rh = null;
2277
2277
  }
2278
- Dh(t) {
2278
+ Lh(t) {
2279
2279
  const e = t.key, i = Date.now();
2280
- this.Ph.has(e) || this.Ph.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2281
- const s = this.Ph.get(e);
2282
- if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.$h = e, this.Sh)) {
2280
+ this.$h.has(e) || this.$h.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2281
+ const s = this.$h.get(e);
2282
+ if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.Th = e, this.kh)) {
2283
2283
  const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !0, originalEvent: t };
2284
- this.Sh(r);
2284
+ this.kh(r);
2285
2285
  }
2286
2286
  }
2287
- Lh(t) {
2287
+ Oh(t) {
2288
2288
  const e = t.key, i = Date.now();
2289
- this.Ph.has(e) || this.Ph.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2290
- const s = this.Ph.get(e);
2291
- if (s.isPressed = !1, s.lastReleaseTime = i, this.Th = e, this.kh) {
2289
+ this.$h.has(e) || this.$h.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2290
+ const s = this.$h.get(e);
2291
+ if (s.isPressed = !1, s.lastReleaseTime = i, this.Rh = e, this.zh) {
2292
2292
  const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !1, originalEvent: t };
2293
- this.kh(r);
2293
+ this.zh(r);
2294
2294
  }
2295
2295
  }
2296
- Ih(t) {
2297
- return this.zh[t] || t.toLowerCase();
2296
+ Bh(t) {
2297
+ return this.Dh[t] || t.toLowerCase();
2298
2298
  }
2299
2299
  }
2300
- const De = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Bt }, Symbol.toStringTag, { value: "Module" }));
2301
- class It {
2300
+ const Xe = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: _t }, Symbol.toStringTag, { value: "Module" }));
2301
+ class Bt {
2302
2302
  constructor(t, e) {
2303
- a(this, "Rr");
2304
- a(this, "Xh");
2305
- a(this, "Qn");
2306
- a(this, "Yh", /* @__PURE__ */ new Map());
2303
+ a(this, "Er");
2304
+ a(this, "Yh");
2305
+ a(this, "Nn");
2307
2306
  a(this, "jh", /* @__PURE__ */ new Map());
2308
2307
  a(this, "Wh", /* @__PURE__ */ new Map());
2309
- a(this, "Kh", null);
2310
- a(this, "Zh");
2308
+ a(this, "Kh", /* @__PURE__ */ new Map());
2309
+ a(this, "Zh", null);
2311
2310
  a(this, "qh");
2312
2311
  a(this, "Vh");
2313
2312
  a(this, "Jh");
2314
2313
  a(this, "so");
2315
2314
  a(this, "io");
2316
- a(this, "th", !1);
2317
2315
  a(this, "eo");
2316
+ a(this, "sh", !1);
2318
2317
  a(this, "ro");
2319
2318
  a(this, "no");
2320
2319
  a(this, "ho");
@@ -2324,64 +2323,62 @@ class It {
2324
2323
  a(this, "lo");
2325
2324
  a(this, "uo");
2326
2325
  a(this, "fo");
2327
- a(this, "do", 320);
2328
- a(this, "vo", 350);
2329
- a(this, "po", 10);
2330
- a(this, "mo", 550);
2331
- a(this, "_o", 14);
2332
- a(this, "yo", 48);
2333
- a(this, "Ao", 650);
2334
- a(this, "bo", 0.02);
2335
- a(this, "wo", 2);
2336
- a(this, "Co", 600);
2337
- a(this, "xo", 0);
2338
- a(this, "Mo", null);
2339
- this.Rr = t, this.Xh = e;
2340
- const i = this.Rr.canvas;
2341
- this.Zh = i.style.touchAction, this.qh = i.style.userSelect, i.style.touchAction || (i.style.touchAction = "none"), i.style.userSelect || (i.style.userSelect = "none");
2342
- }
2343
- _r(t) {
2344
- this.Qn = t, this.uh();
2345
- }
2346
- fh() {
2347
- if (this.th) return;
2348
- const t = this.Rr.canvas;
2349
- this.Vh = (e) => {
2350
- this.Fo(e);
2351
- }, this.Jh = (e) => {
2326
+ a(this, "do");
2327
+ a(this, "vo", 320);
2328
+ a(this, "po", 350);
2329
+ a(this, "mo", 10);
2330
+ a(this, "_o", 550);
2331
+ a(this, "yo", 14);
2332
+ a(this, "Ao", 48);
2333
+ a(this, "bo", 650);
2334
+ a(this, "wo", 0.02);
2335
+ a(this, "Co", 2);
2336
+ a(this, "xo", 600);
2337
+ a(this, "Mo", 0);
2338
+ a(this, "Fo", null);
2339
+ this.Er = t, this.Yh = e;
2340
+ const i = this.Er.canvas;
2341
+ this.qh = i.style.touchAction, this.Vh = i.style.userSelect, i.style.touchAction || (i.style.touchAction = "none"), i.style.userSelect || (i.style.userSelect = "none");
2342
+ }
2343
+ yr(t) {
2344
+ this.Nn = t, this.fh();
2345
+ }
2346
+ dh() {
2347
+ if (this.sh) return;
2348
+ const t = this.Er.canvas;
2349
+ this.Jh = (e) => {
2352
2350
  this.Po(e);
2353
2351
  }, this.so = (e) => {
2354
2352
  this.$o(e);
2355
2353
  }, this.io = (e) => {
2356
2354
  this.To(e);
2357
- }, t.addEventListener("touchstart", this.Vh, { passive: !1 }), t.addEventListener("touchmove", this.Jh, { passive: !1 }), t.addEventListener("touchend", this.so, { passive: !1 }), t.addEventListener("touchcancel", this.io, { passive: !1 }), this.th = !0;
2358
- }
2359
- Ah() {
2360
- if (!this.th) return;
2361
- const t = this.Rr.canvas;
2362
- t.removeEventListener("touchstart", this.Vh), t.removeEventListener("touchmove", this.Jh), t.removeEventListener("touchend", this.so), t.removeEventListener("touchcancel", this.io), this.th = !1, this.Kh = null, this.Yh.clear(), this.jh.clear(), this.Wh.forEach((e) => {
2355
+ }, this.eo = (e) => {
2356
+ this.Ro(e);
2357
+ }, t.addEventListener("touchstart", this.Jh, { passive: !1 }), t.addEventListener("touchmove", this.so, { passive: !1 }), t.addEventListener("touchend", this.io, { passive: !1 }), t.addEventListener("touchcancel", this.eo, { passive: !1 }), this.sh = !0;
2358
+ }
2359
+ bh() {
2360
+ if (!this.sh) return;
2361
+ const t = this.Er.canvas;
2362
+ t.removeEventListener("touchstart", this.Jh), t.removeEventListener("touchmove", this.so), t.removeEventListener("touchend", this.io), t.removeEventListener("touchcancel", this.eo), this.sh = !1, this.Zh = null, this.jh.clear(), this.Wh.clear(), this.Kh.forEach((e) => {
2363
2363
  e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
2364
- }), this.Wh.clear(), this.Mo = null, this.xo = 0, t.style.touchAction = this.Zh, t.style.userSelect = this.qh;
2364
+ }), this.Kh.clear(), this.Fo = null, this.Mo = 0, t.style.touchAction = this.qh, t.style.userSelect = this.Vh;
2365
2365
  }
2366
- uh() {
2367
- if (!this.Qn || this.Yh.size === 0) return;
2366
+ fh() {
2367
+ if (!this.Nn || this.jh.size === 0) return;
2368
2368
  const t = /* @__PURE__ */ new Map();
2369
- for (const e of this.Yh.values()) {
2370
- const i = this.Ro(e.clientX, e.clientY, e.id, e);
2369
+ for (const e of this.jh.values()) {
2370
+ const i = this.Eo(e.clientX, e.clientY, e.id, e);
2371
2371
  t.set(e.id, i);
2372
2372
  }
2373
- this.Yh = t;
2373
+ this.jh = t;
2374
2374
  }
2375
- Eo() {
2376
- return Array.from(this.Yh.values()).map((t) => ({ ...t }));
2375
+ So() {
2376
+ return Array.from(this.jh.values()).map((t) => ({ ...t }));
2377
2377
  }
2378
- So(t) {
2379
- this.eo = t;
2380
- }
2381
- xh(t) {
2378
+ ko(t) {
2382
2379
  this.ro = t;
2383
2380
  }
2384
- ko(t) {
2381
+ Mh(t) {
2385
2382
  this.no = t;
2386
2383
  }
2387
2384
  zo(t) {
@@ -2405,213 +2402,216 @@ class It {
2405
2402
  Ho(t) {
2406
2403
  this.fo = t;
2407
2404
  }
2408
- Fo(t) {
2405
+ Go(t) {
2406
+ this.do = t;
2407
+ }
2408
+ Po(t) {
2409
2409
  var s;
2410
- if (!this.Qn) return;
2411
- t.preventDefault(), (s = this.Xh) == null || s.hh(this.Co);
2412
- const e = performance.now(), i = this.Go(t.changedTouches);
2410
+ if (!this.Nn) return;
2411
+ t.preventDefault(), (s = this.Yh) == null || s.oh(this.xo);
2412
+ const e = performance.now(), i = this.Qo(t.changedTouches);
2413
2413
  for (const r of i) {
2414
- const h = this.Yh.get(r.id);
2415
- h && this.jh.set(r.id, this.Qo(h)), this.Yh.set(r.id, r);
2414
+ const h = this.jh.get(r.id);
2415
+ h && this.Wh.set(r.id, this.No(h)), this.jh.set(r.id, r);
2416
2416
  const o = { id: r.id, startPosition: r, lastPosition: r, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
2417
- this.co && (o.longPressTimer = window.setTimeout(() => {
2418
- const c = this.Yh.get(r.id);
2419
- c && (o.longPressFired = !0, this.co({ touch: this.Qo(c), duration: performance.now() - o.startTime, originalEvent: t }));
2420
- }, this.mo)), this.Wh.set(r.id, o), this.eo && this.eo(this.No(r, t, void 0, e));
2417
+ this.lo && (o.longPressTimer = window.setTimeout(() => {
2418
+ const c = this.jh.get(r.id);
2419
+ c && (o.longPressFired = !0, this.lo({ touch: this.No(c), duration: performance.now() - o.startTime, originalEvent: t }));
2420
+ }, this._o)), this.Kh.set(r.id, o), this.ro && this.ro(this.Xo(r, t, void 0, e));
2421
2421
  }
2422
- this.Yh.size === 2 && this.Xo();
2422
+ this.jh.size === 2 && this.Yo();
2423
2423
  }
2424
- Po(t) {
2424
+ $o(t) {
2425
2425
  var s;
2426
- if (!this.Qn) return;
2427
- t.preventDefault(), (s = this.Xh) == null || s.hh(this.Co);
2428
- const e = performance.now(), i = this.Go(t.changedTouches);
2426
+ if (!this.Nn) return;
2427
+ t.preventDefault(), (s = this.Yh) == null || s.oh(this.xo);
2428
+ const e = performance.now(), i = this.Qo(t.changedTouches);
2429
2429
  for (const r of i) {
2430
- const h = this.Yh.get(r.id), o = h ? this.Qo(h) : void 0;
2431
- o && this.jh.set(r.id, o), this.Yh.set(r.id, r);
2432
- const c = this.Wh.get(r.id);
2433
- c && (c.lastPosition = r, c.lastTime = e, o) && z(o.clientX, o.clientY, r.clientX, r.clientY) > this._o && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.ro && this.ro(this.No(r, t, o, e));
2430
+ const h = this.jh.get(r.id), o = h ? this.No(h) : void 0;
2431
+ o && this.Wh.set(r.id, o), this.jh.set(r.id, r);
2432
+ const c = this.Kh.get(r.id);
2433
+ c && (c.lastPosition = r, c.lastTime = e, o) && z(o.clientX, o.clientY, r.clientX, r.clientY) > this.yo && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.no && this.no(this.Xo(r, t, o, e));
2434
2434
  }
2435
- this.Yh.size === 2 ? this.Yo(t) : this.Kh = null;
2435
+ this.jh.size === 2 ? this.jo(t) : this.Zh = null;
2436
2436
  }
2437
- $o(t) {
2438
- if (!this.Qn) return;
2437
+ To(t) {
2438
+ if (!this.Nn) return;
2439
2439
  t.preventDefault();
2440
- const e = performance.now(), i = this.Go(t.changedTouches);
2440
+ const e = performance.now(), i = this.Qo(t.changedTouches);
2441
2441
  for (const s of i) {
2442
- const r = this.Yh.get(s.id), h = r ? this.Qo(r) : void 0, o = this.Wh.get(s.id);
2443
- o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.no && this.no(this.No(s, t, h, e)), o && this.jo(o, t), this.Wh.delete(s.id), this.jh.delete(s.id), this.Yh.delete(s.id);
2442
+ const r = this.jh.get(s.id), h = r ? this.No(r) : void 0, o = this.Kh.get(s.id);
2443
+ o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.ho && this.ho(this.Xo(s, t, h, e)), o && this.Wo(o, t), this.Kh.delete(s.id), this.Wh.delete(s.id), this.jh.delete(s.id);
2444
2444
  }
2445
- this.Yh.size < 2 && (this.Kh = null);
2445
+ this.jh.size < 2 && (this.Zh = null);
2446
2446
  }
2447
- To(t) {
2448
- if (!this.Qn) return;
2447
+ Ro(t) {
2448
+ if (!this.Nn) return;
2449
2449
  t.preventDefault();
2450
- const e = performance.now(), i = this.Go(t.changedTouches);
2450
+ const e = performance.now(), i = this.Qo(t.changedTouches);
2451
2451
  for (const s of i) {
2452
- const r = this.Yh.get(s.id), h = r ? this.Qo(r) : void 0, o = this.Wh.get(s.id);
2453
- o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.ho && this.ho(this.No(s, t, h, e)), this.Wh.delete(s.id), this.jh.delete(s.id), this.Yh.delete(s.id);
2452
+ const r = this.jh.get(s.id), h = r ? this.No(r) : void 0, o = this.Kh.get(s.id);
2453
+ o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.oo && this.oo(this.Xo(s, t, h, e)), this.Kh.delete(s.id), this.Wh.delete(s.id), this.jh.delete(s.id);
2454
2454
  }
2455
- this.Yh.size < 2 && (this.Kh = null);
2455
+ this.jh.size < 2 && (this.Zh = null);
2456
2456
  }
2457
- Go(t) {
2457
+ Qo(t) {
2458
2458
  const e = [];
2459
2459
  for (let i = 0; i < t.length; i += 1) {
2460
2460
  const s = t.item(i);
2461
- s && e.push(this.Wo(s));
2461
+ s && e.push(this.Ko(s));
2462
2462
  }
2463
2463
  return e;
2464
2464
  }
2465
- Wo(t) {
2466
- return this.Ro(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 });
2465
+ Ko(t) {
2466
+ return this.Eo(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 });
2467
2467
  }
2468
- Ro(t, e, i, s) {
2469
- 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.Qn.offsetX, d = u - this.Qn.offsetY, g = Math.floor(f / this.Qn.cellWidth), v = Math.floor(d / this.Qn.cellHeight), m = g >= 0 && g < this.Qn.cols && v >= 0 && v < this.Qn.rows;
2470
- return { id: i, x: m ? g : -1, y: m ? v : -1, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
2468
+ Eo(t, e, i, s) {
2469
+ const r = this.Er.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.Nn.offsetX, d = u - this.Nn.offsetY, g = Math.floor(f / this.Nn.cellWidth), m = Math.floor(d / this.Nn.cellHeight), v = g >= 0 && g < this.Nn.cols && m >= 0 && m < this.Nn.rows;
2470
+ return { id: i, x: v ? g : -1, y: v ? m : -1, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
2471
2471
  }
2472
- No(t, e, i, s) {
2473
- const r = this.Wh.get(t.id), h = Array.from(this.jh.values()).map((l) => this.Qo(l)), o = Array.from(this.Yh.values()).map((l) => this.Qo(l)), c = this.Go(e.changedTouches);
2474
- return { touch: this.Qo(t), previousTouch: i ? this.Qo(i) : void 0, touches: o, previousTouches: h, changedTouches: c, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
2472
+ Xo(t, e, i, s) {
2473
+ const r = this.Kh.get(t.id), h = Array.from(this.Wh.values()).map((l) => this.No(l)), o = Array.from(this.jh.values()).map((l) => this.No(l)), c = this.Qo(e.changedTouches);
2474
+ return { touch: this.No(t), previousTouch: i ? this.No(i) : void 0, touches: o, previousTouches: h, changedTouches: c, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
2475
2475
  }
2476
- Xo() {
2477
- if (this.Yh.size !== 2) return void (this.Kh = null);
2478
- const t = Array.from(this.Yh.values()), [e, i] = t, s = z(e.x, e.y, i.x, i.y), r = yt(e.clientX, e.clientY, i.clientX, i.clientY);
2479
- this.Kh = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
2476
+ Yo() {
2477
+ if (this.jh.size !== 2) return void (this.Zh = null);
2478
+ const t = Array.from(this.jh.values()), [e, i] = t, s = z(e.x, e.y, i.x, i.y), r = Et(e.clientX, e.clientY, i.clientX, i.clientY);
2479
+ this.Zh = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
2480
2480
  }
2481
- Yo(t) {
2482
- if (this.Kh || this.Xo(), !this.Kh) return;
2483
- const [e, i] = this.Kh.ids, s = this.Yh.get(e), r = this.Yh.get(i);
2481
+ jo(t) {
2482
+ if (this.Zh || this.Yo(), !this.Zh) return;
2483
+ const [e, i] = this.Zh.ids, s = this.jh.get(e), r = this.jh.get(i);
2484
2484
  if (!s || !r) return;
2485
- const h = z(s.x, s.y, r.x, r.y) / this.Kh.initialDistance, o = h - this.Kh.lastScale;
2486
- this.uo && Math.abs(o) > this.bo && (this.uo({ touches: [this.Qo(s), this.Qo(r)], scale: h, deltaScale: o, center: this.Ko(s, r), originalEvent: t }), this.Kh.lastScale = h);
2487
- let c = yt(s.clientX, s.clientY, r.clientX, r.clientY) - this.Kh.initialAngle;
2485
+ const h = z(s.x, s.y, r.x, r.y) / this.Zh.initialDistance, o = h - this.Zh.lastScale;
2486
+ this.fo && Math.abs(o) > this.wo && (this.fo({ touches: [this.No(s), this.No(r)], scale: h, deltaScale: o, center: this.Zo(s, r), originalEvent: t }), this.Zh.lastScale = h);
2487
+ let c = Et(s.clientX, s.clientY, r.clientX, r.clientY) - this.Zh.initialAngle;
2488
2488
  c = (c + 180) % 360 - 180;
2489
- const l = c - this.Kh.lastRotation;
2490
- this.fo && Math.abs(l) > this.wo && (this.fo({ touches: [this.Qo(s), this.Qo(r)], rotation: c, deltaRotation: l, center: this.Ko(s, r), originalEvent: t }), this.Kh.lastRotation = c);
2489
+ const l = c - this.Zh.lastRotation;
2490
+ this.do && Math.abs(l) > this.Co && (this.do({ touches: [this.No(s), this.No(r)], rotation: c, deltaRotation: l, center: this.Zo(s, r), originalEvent: t }), this.Zh.lastRotation = c);
2491
2491
  }
2492
- Ko(t, e) {
2493
- const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.Ro(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
2492
+ Zo(t, e) {
2493
+ const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.Eo(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
2494
2494
  return { x: r.x, y: r.y };
2495
2495
  }
2496
- jo(t, e) {
2496
+ Wo(t, e) {
2497
2497
  const i = performance.now(), s = i - t.startTime, r = z(t.startPosition.clientX, t.startPosition.clientY, t.lastPosition.clientX, t.lastPosition.clientY);
2498
- if (!t.longPressFired && s <= this.do && r <= this.po)
2499
- this.Zo(t.lastPosition, i) && this.ao ? this.ao({ touch: this.Qo(t.lastPosition), taps: 2, originalEvent: e }) : this.oo && this.oo({ touch: this.Qo(t.lastPosition), taps: 1, originalEvent: e });
2500
- else if (!t.longPressFired && s <= this.Ao && r >= this.yo) {
2498
+ if (!t.longPressFired && s <= this.vo && r <= this.mo)
2499
+ this.qo(t.lastPosition, i) && this.co ? this.co({ touch: this.No(t.lastPosition), taps: 2, originalEvent: e }) : this.ao && this.ao({ touch: this.No(t.lastPosition), taps: 1, originalEvent: e });
2500
+ else if (!t.longPressFired && s <= this.bo && r >= this.Ao) {
2501
2501
  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 };
2502
- this.lo && this.lo({ touch: this.Qo(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
2502
+ this.uo && this.uo({ touch: this.No(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
2503
2503
  }
2504
- this.xo = i, this.Mo = this.Qo(t.lastPosition);
2504
+ this.Mo = i, this.Fo = this.No(t.lastPosition);
2505
2505
  }
2506
- Zo(t, e) {
2507
- return !this.Mo || e - this.xo > this.vo ? !1 : z(t.clientX, t.clientY, this.Mo.clientX, this.Mo.clientY) <= this.po;
2506
+ qo(t, e) {
2507
+ return !this.Fo || e - this.Mo > this.po ? !1 : z(t.clientX, t.clientY, this.Fo.clientX, this.Fo.clientY) <= this.mo;
2508
2508
  }
2509
- Qo(t) {
2509
+ No(t) {
2510
2510
  return { ...t };
2511
2511
  }
2512
2512
  }
2513
- const Oe = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: It }, Symbol.toStringTag, { value: "Module" }));
2514
- class Xe {
2513
+ const Ze = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Bt }, Symbol.toStringTag, { value: "Module" }));
2514
+ class Oe {
2515
2515
  constructor(t, e) {
2516
2516
  a(this, "A");
2517
- a(this, "qo");
2518
- a(this, "Pn", null);
2519
- a(this, "Vo", 0);
2520
- a(this, "Jo", !1);
2521
- a(this, "ta", []);
2522
- a(this, "sa", -1);
2523
- this.A = t, this.qo = e;
2517
+ a(this, "Vo");
2518
+ a(this, "$n", null);
2519
+ a(this, "Jo", 0);
2520
+ a(this, "ta", !1);
2521
+ a(this, "sa", []);
2522
+ a(this, "ia", -1);
2523
+ this.A = t, this.Vo = e;
2524
2524
  }
2525
2525
  get isPreloaded() {
2526
- return this.Jo;
2526
+ return this.ta;
2527
2527
  }
2528
2528
  get totalFrames() {
2529
- return this.Vo;
2529
+ return this.Jo;
2530
2530
  }
2531
2531
  get frameRate() {
2532
- return this.Pn;
2532
+ return this.$n;
2533
2533
  }
2534
2534
  get textures() {
2535
- return this.ta;
2535
+ return this.sa;
2536
2536
  }
2537
2537
  dispose() {
2538
- this.ia(), this.ta = [], this.Pn = null, this.Vo = 0, this.Jo = !1, this.sa = -1;
2538
+ this.ea(), this.sa = [], this.$n = null, this.Jo = 0, this.ta = !1, this.ia = -1;
2539
2539
  }
2540
2540
  async preload(t, e) {
2541
2541
  var i;
2542
2542
  try {
2543
2543
  if (t <= 0) throw Error("Video preload requires a frameRate greater than 0.");
2544
- const s = this.qo.duration;
2544
+ const s = this.Vo.duration;
2545
2545
  if (!isFinite(s) || s <= 0) throw Error("Video duration is invalid, cannot preload frames.");
2546
2546
  const r = Math.max(1, Math.ceil(s * t));
2547
- return this.ea(t, r), await this.ra(t, e) ? (this.na("captureStream", e), "captureStream") : (await this.ha(t, e), this.na("seeking", e), "seeking");
2547
+ return this.ra(t, r), await this.na(t, e) ? (this.ha("captureStream", e), "captureStream") : (await this.oa(t, e), this.ha("seeking", e), "seeking");
2548
2548
  } catch (s) {
2549
2549
  const r = s instanceof Error ? s : Error(s + "");
2550
2550
  throw (i = e == null ? void 0 : e.onError) == null || i.call(e, r), this.dispose(), r;
2551
2551
  }
2552
2552
  }
2553
- ea(t, e) {
2554
- this.ia(), this.Pn = t, this.Vo = e, this.ta = [], this.Jo = !1, this.sa = -1;
2553
+ ra(t, e) {
2554
+ this.ea(), this.$n = t, this.Jo = e, this.sa = [], this.ta = !1, this.ia = -1;
2555
2555
  }
2556
- na(t, e) {
2556
+ ha(t, e) {
2557
2557
  var i;
2558
- if (this.ta.length === 0) throw Error(`Video preload via ${t} completed but produced 0 frames.`);
2559
- this.Vo = this.ta.length, this.Jo = !0, this.sa = -1, this.qo.pause(), this.qo.currentTime = 0, e != null && e.onProgress && e.onProgress({ percent: 100, loadedFrames: this.Vo, totalFrames: this.Vo, strategy: t }), (i = e == null ? void 0 : e.onComplete) == null || i.call(e, { totalFrames: this.Vo, strategy: t });
2558
+ if (this.sa.length === 0) throw Error(`Video preload via ${t} completed but produced 0 frames.`);
2559
+ this.Jo = this.sa.length, this.ta = !0, this.ia = -1, this.Vo.pause(), this.Vo.currentTime = 0, e != null && e.onProgress && e.onProgress({ percent: 100, loadedFrames: this.Jo, totalFrames: this.Jo, strategy: t }), (i = e == null ? void 0 : e.onComplete) == null || i.call(e, { totalFrames: this.Jo, strategy: t });
2560
2560
  }
2561
- oa(t) {
2561
+ aa(t) {
2562
2562
  const e = this.A, i = e.createTexture();
2563
2563
  return e.bindTexture(e.TEXTURE_2D, i), e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, 1), et(e, e.LINEAR, e.LINEAR, e.CLAMP_TO_EDGE, e.CLAMP_TO_EDGE), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, t), e.bindTexture(e.TEXTURE_2D, null), i;
2564
2564
  }
2565
- aa(t, e) {
2566
- if (!(e != null && e.onProgress) || this.Vo === 0) return;
2567
- const i = Math.min(99, Math.floor(this.ta.length / this.Vo * 100)), s = 10 * Math.floor(i / 10);
2568
- s > this.sa && (this.sa = s, e.onProgress({ percent: i, loadedFrames: this.ta.length, totalFrames: this.Vo, strategy: t }));
2565
+ ca(t, e) {
2566
+ if (!(e != null && e.onProgress) || this.Jo === 0) return;
2567
+ const i = Math.min(99, Math.floor(this.sa.length / this.Jo * 100)), s = 10 * Math.floor(i / 10);
2568
+ s > this.ia && (this.ia = s, e.onProgress({ percent: i, loadedFrames: this.sa.length, totalFrames: this.Jo, strategy: t }));
2569
2569
  }
2570
- async ra(t, e) {
2571
- const i = globalThis, s = i == null ? void 0 : i.MediaStreamTrackProcessor, r = this.qo.captureStream;
2570
+ async na(t, e) {
2571
+ const i = globalThis, s = i == null ? void 0 : i.MediaStreamTrackProcessor, r = this.Vo.captureStream;
2572
2572
  if (typeof s != "function" || typeof r != "function") return !1;
2573
2573
  let h, o = null;
2574
2574
  try {
2575
- const c = r.call(this.qo);
2575
+ const c = r.call(this.Vo);
2576
2576
  if (h = c.getVideoTracks()[0], !h) return c.getTracks().forEach((f) => f.stop()), !1;
2577
- if (o = new s({ track: h }).readable.getReader(), this.qo.currentTime = 0, this.qo.muted = !0, await this.qo.play().catch(() => {
2578
- }), this.qo.paused) return !1;
2577
+ if (o = new s({ track: h }).readable.getReader(), this.Vo.currentTime = 0, this.Vo.muted = !0, await this.Vo.play().catch(() => {
2578
+ }), this.Vo.paused) return !1;
2579
2579
  const l = 1e6 / t;
2580
2580
  let u = 0;
2581
- for (; this.ta.length < this.Vo; ) {
2581
+ for (; this.sa.length < this.Jo; ) {
2582
2582
  const f = await o.read();
2583
2583
  if (f.done) break;
2584
2584
  const d = f.value;
2585
2585
  if (d) try {
2586
2586
  const g = typeof d.timestamp == "number" ? d.timestamp : u;
2587
- (this.ta.length === 0 || g >= u) && (this.ta.push(this.oa(d)), u = g + l, this.aa("captureStream", e));
2587
+ (this.sa.length === 0 || g >= u) && (this.sa.push(this.aa(d)), u = g + l, this.ca("captureStream", e));
2588
2588
  } finally {
2589
2589
  d.close();
2590
2590
  }
2591
2591
  }
2592
- return o.releaseLock(), h.stop(), o = null, h = void 0, this.qo.pause(), this.qo.currentTime = 0, this.ta.length !== 0;
2592
+ return o.releaseLock(), h.stop(), o = null, h = void 0, this.Vo.pause(), this.Vo.currentTime = 0, this.sa.length !== 0;
2593
2593
  } catch {
2594
- return this.ia(), this.ta = [], this.sa = -1, !1;
2594
+ return this.ea(), this.sa = [], this.ia = -1, !1;
2595
2595
  } finally {
2596
2596
  if (o) try {
2597
2597
  await o.cancel();
2598
2598
  } catch {
2599
2599
  }
2600
- h && h.stop(), this.qo.pause(), this.qo.currentTime = 0;
2600
+ h && h.stop(), this.Vo.pause(), this.Vo.currentTime = 0;
2601
2601
  }
2602
2602
  }
2603
- async ha(t, e) {
2604
- const i = 1 / t, s = this.Vo, r = this.qo;
2603
+ async oa(t, e) {
2604
+ const i = 1 / t, s = this.Jo, r = this.Vo;
2605
2605
  r.pause();
2606
2606
  for (let h = 0; h < s; h++) {
2607
2607
  const o = Math.min(r.duration, h * i);
2608
- await this.ca(o), this.ta.push(this.oa(r)), this.aa("seeking", e);
2608
+ await this.la(o), this.sa.push(this.aa(r)), this.ca("seeking", e);
2609
2609
  }
2610
2610
  r.currentTime = 0;
2611
2611
  }
2612
- ca(t) {
2612
+ la(t) {
2613
2613
  return new Promise((e, i) => {
2614
- const s = this.qo, r = () => {
2614
+ const s = this.Vo, r = () => {
2615
2615
  s.removeEventListener("seeked", h), s.removeEventListener("error", o);
2616
2616
  }, h = () => {
2617
2617
  r(), e();
@@ -2624,86 +2624,86 @@ class Xe {
2624
2624
  s.currentTime = l;
2625
2625
  });
2626
2626
  }
2627
- ia() {
2628
- for (const t of this.ta) this.A.deleteTexture(t);
2627
+ ea() {
2628
+ for (const t of this.sa) this.A.deleteTexture(t);
2629
2629
  }
2630
2630
  }
2631
- class rt extends Nt {
2631
+ class rt extends St {
2632
2632
  constructor(e, i, s, r, h, o, c, l, u) {
2633
2633
  const f = o / c;
2634
2634
  let d, g;
2635
2635
  f > 1 ? (d = l, g = Math.round(l / f)) : (g = u, d = Math.round(u * f));
2636
2636
  super(e, i, s, r, o, c, d, g);
2637
- a(this, "qo");
2638
- a(this, "la", 0);
2639
- a(this, "ua", null);
2640
- this.qo = h;
2637
+ a(this, "Vo");
2638
+ a(this, "ua", 0);
2639
+ a(this, "fa", null);
2640
+ this.Vo = h;
2641
2641
  }
2642
2642
  gt() {
2643
2643
  var e;
2644
- super.gt(), (e = this.ua) == null || e.dispose(), this.ua = null, this.qo.pause(), this.qo.src = "", this.qo.load();
2644
+ super.gt(), (e = this.fa) == null || e.dispose(), this.fa = null, this.Vo.pause(), this.Vo.src = "", this.Vo.load();
2645
2645
  }
2646
- fa() {
2646
+ da() {
2647
2647
  var e;
2648
- if (!((e = this.ua) != null && e.isPreloaded) && this.qo.readyState >= this.qo.HAVE_CURRENT_DATA) {
2648
+ if (!((e = this.fa) != null && e.isPreloaded) && this.Vo.readyState >= this.Vo.HAVE_CURRENT_DATA) {
2649
2649
  const i = this.A;
2650
- i.bindTexture(i.TEXTURE_2D, this.Jr), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, i.RGBA, i.UNSIGNED_BYTE, this.qo), i.bindTexture(i.TEXTURE_2D, null);
2650
+ i.bindTexture(i.TEXTURE_2D, this.tn), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, i.RGBA, i.UNSIGNED_BYTE, this.Vo), i.bindTexture(i.TEXTURE_2D, null);
2651
2651
  }
2652
2652
  }
2653
- bn() {
2653
+ wn() {
2654
2654
  var i, s;
2655
- const e = (i = this.ua) == null ? void 0 : i.textures;
2656
- return e && e.length > 0 && ((s = this.ua) != null && s.isPreloaded) ? e[this.la % e.length] : this.Jr;
2655
+ const e = (i = this.fa) == null ? void 0 : i.textures;
2656
+ return e && e.length > 0 && ((s = this.fa) != null && s.isPreloaded) ? e[this.ua % e.length] : this.tn;
2657
2657
  }
2658
2658
  ut() {
2659
2659
  return this.q = null, super.ut();
2660
2660
  }
2661
- _n() {
2662
- this.fa();
2661
+ yn() {
2662
+ this.da();
2663
2663
  }
2664
2664
  frame(e) {
2665
2665
  var s, r;
2666
- const i = ((s = this.ua) == null ? void 0 : s.totalFrames) ?? 0;
2667
- return (r = this.ua) != null && r.isPreloaded && e !== void 0 && i > 0 && (this.la = (e % i + i) % i, this.q = null), this;
2666
+ const i = ((s = this.fa) == null ? void 0 : s.totalFrames) ?? 0;
2667
+ return (r = this.fa) != null && r.isPreloaded && e !== void 0 && i > 0 && (this.ua = (e % i + i) % i, this.q = null), this;
2668
2668
  }
2669
- static async wn(e, i, s, r, h, o) {
2669
+ static async Cn(e, i, s, r, h, o) {
2670
2670
  const c = e.context, l = o == null ? void 0 : o.frameRate;
2671
2671
  let u;
2672
- u = document.createElement("video"), u.crossOrigin = "anonymous", u.loop = !0, u.muted = !0, u.playsInline = !0, await new Promise((m, A) => {
2673
- u.addEventListener("loadedmetadata", () => m(), { once: !0 }), u.addEventListener("error", (p) => {
2674
- var y;
2675
- const w = p.target;
2676
- A(Error("Failed to load video: " + (((y = w.error) == null ? void 0 : y.message) || "Unknown error")));
2672
+ u = document.createElement("video"), u.crossOrigin = "anonymous", u.loop = !0, u.muted = !0, u.playsInline = !0, await new Promise((v, A) => {
2673
+ u.addEventListener("loadedmetadata", () => v(), { once: !0 }), u.addEventListener("error", (p) => {
2674
+ var E;
2675
+ const y = p.target;
2676
+ A(Error("Failed to load video: " + (((E = y.error) == null ? void 0 : E.message) || "Unknown error")));
2677
2677
  }, { once: !0 }), u.src = s;
2678
2678
  });
2679
2679
  const f = c.createTexture();
2680
2680
  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);
2681
- const d = u.videoWidth, g = u.videoHeight, v = new rt(c, e, f, i, u, d, g, r, h);
2682
- return l && l > 0 && (v.ua = new Xe(c, u), await v.ua.preload(l, o), v.la = 0), v;
2681
+ const d = u.videoWidth, g = u.videoHeight, m = new rt(c, e, f, i, u, d, g, r, h);
2682
+ return l && l > 0 && (m.fa = new Oe(c, u), await m.fa.preload(l, o), m.ua = 0), m;
2683
2683
  }
2684
2684
  async play() {
2685
- await this.qo.play();
2685
+ await this.Vo.play();
2686
2686
  }
2687
2687
  pause() {
2688
- this.qo.pause();
2688
+ this.Vo.pause();
2689
2689
  }
2690
2690
  stop() {
2691
- this.qo.pause(), this.qo.currentTime = 0;
2691
+ this.Vo.pause(), this.Vo.currentTime = 0;
2692
2692
  }
2693
2693
  speed(e) {
2694
- return this.qo.playbackRate = e, this;
2694
+ return this.Vo.playbackRate = e, this;
2695
2695
  }
2696
2696
  loop(e = !0) {
2697
- return this.qo.loop = e, this;
2697
+ return this.Vo.loop = e, this;
2698
2698
  }
2699
2699
  time(e) {
2700
- return this.qo.currentTime = e, this;
2700
+ return this.Vo.currentTime = e, this;
2701
2701
  }
2702
2702
  volume(e) {
2703
- return this.qo.volume = Math.max(0, Math.min(1, e)), this;
2703
+ return this.Vo.volume = Math.max(0, Math.min(1, e)), this;
2704
2704
  }
2705
2705
  get texture() {
2706
- return this.Jr;
2706
+ return this.tn;
2707
2707
  }
2708
2708
  get width() {
2709
2709
  return this.N;
@@ -2712,31 +2712,31 @@ class rt extends Nt {
2712
2712
  return this.X;
2713
2713
  }
2714
2714
  get originalWidth() {
2715
- return this.tn;
2715
+ return this.sn;
2716
2716
  }
2717
2717
  get originalHeight() {
2718
- return this.sn;
2718
+ return this.en;
2719
2719
  }
2720
2720
  get videoElement() {
2721
- return this.qo;
2721
+ return this.Vo;
2722
2722
  }
2723
2723
  get currentTime() {
2724
- return this.qo.currentTime;
2724
+ return this.Vo.currentTime;
2725
2725
  }
2726
2726
  get duration() {
2727
- return this.qo.duration;
2727
+ return this.Vo.duration;
2728
2728
  }
2729
2729
  get isPlaying() {
2730
- return !this.qo.paused && !this.qo.ended;
2730
+ return !this.Vo.paused && !this.Vo.ended;
2731
2731
  }
2732
2732
  get totalFrames() {
2733
2733
  var e;
2734
- return ((e = this.ua) == null ? void 0 : e.totalFrames) ?? 0;
2734
+ return ((e = this.fa) == null ? void 0 : e.totalFrames) ?? 0;
2735
2735
  }
2736
2736
  }
2737
- const Ye = (n) => class extends n {
2738
- da(t, e, i, s) {
2739
- if (M.Kr(t)) return t;
2737
+ const Ie = (n) => class extends n {
2738
+ va(t, e, i, s) {
2739
+ if (M.Zr(t)) return t;
2740
2740
  if (typeof t == "number" || typeof t == "string") return this.color(t, e, i, s);
2741
2741
  throw Error("Unsupported color input passed to color-capable method.");
2742
2742
  }
@@ -2771,7 +2771,7 @@ const Ye = (n) => class extends n {
2771
2771
  this.Z.state.ot();
2772
2772
  }
2773
2773
  color(t, e, i, s) {
2774
- return M.Wr(t, e, i, s);
2774
+ return M.Kr(t, e, i, s);
2775
2775
  }
2776
2776
  rect(t = 1, e = 1) {
2777
2777
  this.Z.be(t, e);
@@ -2786,20 +2786,20 @@ const Ye = (n) => class extends n {
2786
2786
  this.Z.state.Zt(t);
2787
2787
  }
2788
2788
  background(t, e, i, s = 255) {
2789
- const r = this.da(t, e, i, s);
2789
+ const r = this.va(t, e, i, s);
2790
2790
  this.Z.$e(r.r, r.g, r.b, r.a);
2791
2791
  }
2792
2792
  char(t) {
2793
2793
  const e = Array.from(t);
2794
2794
  if (e.length === 0) throw Error("char() requires at least one character.");
2795
- this.Z.state.hs(this.er.Cr(e[0]));
2795
+ this.Z.state.hs(this.rr.Mr(e[0]));
2796
2796
  }
2797
2797
  charColor(t, e, i, s) {
2798
- const r = this.da(t, e, i, s);
2798
+ const r = this.va(t, e, i, s);
2799
2799
  this.Z.state.cs(r.r, r.g, r.b, r.a);
2800
2800
  }
2801
2801
  cellColor(t, e, i, s) {
2802
- const r = this.da(t, e, i, s);
2802
+ const r = this.va(t, e, i, s);
2803
2803
  this.Z.state.ls(r.r, r.g, r.b, r.a);
2804
2804
  }
2805
2805
  flipX(t) {
@@ -2851,324 +2851,324 @@ const Ye = (n) => class extends n {
2851
2851
  return this.Z.Pe(t.width ?? this.grid.cols, t.height ?? this.grid.rows, t.attachments ?? 3);
2852
2852
  }
2853
2853
  image(t, e, i) {
2854
- this.Z.ye(t, e, i), t instanceof H && this.Z.ct();
2854
+ this.Z.ye(t, e, i), t instanceof j && this.Z.ct();
2855
2855
  }
2856
2856
  ortho() {
2857
2857
  this.Z.state.gs(!0);
2858
2858
  }
2859
2859
  async loadImage(t) {
2860
2860
  if (typeof t != "string") {
2861
- const r = Y.wn(this.Z, this.er, t, this.Qn.cols, this.Qn.rows);
2862
- return this.va(r), r;
2861
+ const r = I.Cn(this.Z, this.rr, t, this.Nn.cols, this.Nn.rows);
2862
+ return this.pa(r), r;
2863
2863
  }
2864
2864
  const e = t, i = await new Promise((r, h) => {
2865
2865
  const o = new Image();
2866
2866
  o.crossOrigin = "anonymous", o.onload = () => r(o), o.onerror = (c) => h(c), o.src = e;
2867
- }), s = Y.wn(this.Z, this.er, i, this.Qn.cols, this.Qn.rows);
2868
- return this.va(s), s;
2867
+ }), s = I.Cn(this.Z, this.rr, i, this.Nn.cols, this.Nn.rows);
2868
+ return this.pa(s), s;
2869
2869
  }
2870
2870
  async loadVideo(t, e) {
2871
- const i = await rt.wn(this.Z, this.er, t, this.Qn.cols, this.Qn.rows, e);
2872
- return this.va(i), i;
2871
+ const i = await rt.Cn(this.Z, this.rr, t, this.Nn.cols, this.Nn.rows, e);
2872
+ return this.pa(i), i;
2873
2873
  }
2874
- }, Ze = (n) => class extends n {
2874
+ }, Ye = (n) => class extends n {
2875
2875
  async loadFont(t) {
2876
- return this.er.wr(t).then(() => {
2877
- const e = this.er.maxGlyphDimensions;
2878
- this.Qn.kr(e.width, e.height), this.pa.resize(this.Qn.cols, this.Qn.rows), this.ga.Nr(), this.Z.Ue(), this.Xh.uh(), this.ma.uh();
2879
- for (const i of this._a) i.mn(this.er);
2876
+ return this.rr.Cr(t).then(() => {
2877
+ const e = this.rr.maxGlyphDimensions;
2878
+ this.Nn.zr(e.width, e.height), this.ga.resize(this.Nn.cols, this.Nn.rows), this.ma.Xr(), this.Z.Re(), this.Yh.fh(), this._a.fh();
2879
+ for (const i of this.ya) i._n(this.rr);
2880
2880
  });
2881
2881
  }
2882
2882
  fontSize(t) {
2883
- if (!mt.m(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) || this.er.fontSize === t) return;
2884
- this.er.br(t);
2885
- const e = this.er.maxGlyphDimensions;
2886
- this.Qn.kr(e.width, e.height), this.pa.resize(this.Qn.cols, this.Qn.rows), this.ga.Nr(), this.Z.Ue(), this.Xh.uh(), this.ma.uh();
2883
+ if (!vt.m(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) || this.rr.fontSize === t) return;
2884
+ this.rr.wr(t);
2885
+ const e = this.rr.maxGlyphDimensions;
2886
+ this.Nn.zr(e.width, e.height), this.ga.resize(this.Nn.cols, this.Nn.rows), this.ma.Xr(), this.Z.Re(), this.Yh.fh(), this._a.fh();
2887
2887
  }
2888
2888
  }, ze = (n) => class extends n {
2889
2889
  get frameCount() {
2890
- return this.ya.Hn;
2890
+ return this.ba.Gn;
2891
2891
  }
2892
2892
  set frameCount(t) {
2893
- this.ya.Hn = t;
2893
+ this.ba.Gn = t;
2894
2894
  }
2895
2895
  frameRate(t) {
2896
- return t === void 0 ? this.ya.Bn : this.ya.Ln(t, () => this.ba());
2896
+ return t === void 0 ? this.ba.Hn : this.ba.On(t, () => this.wa());
2897
2897
  }
2898
2898
  noLoop() {
2899
- this.ya.zn();
2899
+ this.ba.Dn();
2900
2900
  }
2901
2901
  loop() {
2902
- this.ya.Dn(() => this.ba());
2902
+ this.ba.Ln(() => this.wa());
2903
2903
  }
2904
2904
  redraw(t = 1) {
2905
- if (mt.m(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.ba();
2905
+ if (vt.m(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.wa();
2906
2906
  }
2907
2907
  isLooping() {
2908
- return this.ya.In;
2908
+ return this.ba.Bn;
2909
2909
  }
2910
- }, Qe = (n) => class extends n {
2910
+ }, Ge = (n) => class extends n {
2911
2911
  constructor(...t) {
2912
2912
  super(...t);
2913
2913
  }
2914
2914
  mouseClicked(t) {
2915
- this.Xh.bh(t);
2915
+ this.Yh.wh(t);
2916
2916
  }
2917
2917
  mousePressed(t) {
2918
- this.Xh.wh(t);
2918
+ this.Yh.Ch(t);
2919
2919
  }
2920
2920
  mouseReleased(t) {
2921
- this.Xh.Ch(t);
2921
+ this.Yh.xh(t);
2922
2922
  }
2923
2923
  mouseMoved(t) {
2924
- this.Xh.xh(t);
2924
+ this.Yh.Mh(t);
2925
2925
  }
2926
2926
  mouseScrolled(t) {
2927
- this.Xh.Mh(t);
2927
+ this.Yh.Fh(t);
2928
2928
  }
2929
2929
  get mouse() {
2930
- return this.Xh.Fh();
2930
+ return this.Yh.Ph();
2931
2931
  }
2932
2932
  cursor(t) {
2933
- this.Xh.ah(t);
2933
+ this.Yh.uh(t);
2934
2934
  }
2935
- }, qe = (n) => class extends n {
2935
+ }, Ve = (n) => class extends n {
2936
2936
  constructor(...t) {
2937
2937
  super(...t);
2938
2938
  }
2939
2939
  touchStarted(t) {
2940
- this.ma.So(t);
2940
+ this._a.ko(t);
2941
2941
  }
2942
2942
  touchMoved(t) {
2943
- this.ma.xh(t);
2943
+ this._a.Mh(t);
2944
2944
  }
2945
2945
  touchEnded(t) {
2946
- this.ma.ko(t);
2946
+ this._a.zo(t);
2947
2947
  }
2948
2948
  touchCancelled(t) {
2949
- this.ma.zo(t);
2949
+ this._a.Do(t);
2950
2950
  }
2951
2951
  tap(t) {
2952
- this.ma.Do(t);
2952
+ this._a.Lo(t);
2953
2953
  }
2954
2954
  doubleTap(t) {
2955
- this.ma.Lo(t);
2955
+ this._a.Oo(t);
2956
2956
  }
2957
2957
  longPress(t) {
2958
- this.ma.Oo(t);
2958
+ this._a.Io(t);
2959
2959
  }
2960
2960
  swipe(t) {
2961
- this.ma.Io(t);
2961
+ this._a.Bo(t);
2962
2962
  }
2963
2963
  pinch(t) {
2964
- this.ma.Bo(t);
2964
+ this._a.Ho(t);
2965
2965
  }
2966
2966
  rotateGesture(t) {
2967
- this.ma.Ho(t);
2967
+ this._a.Go(t);
2968
2968
  }
2969
2969
  get touches() {
2970
- return this.ma.Eo();
2970
+ return this._a.So();
2971
2971
  }
2972
- }, Ge = (n) => class extends n {
2972
+ }, ke = (n) => class extends n {
2973
2973
  constructor(...t) {
2974
2974
  super(...t);
2975
2975
  }
2976
2976
  keyPressed(t) {
2977
- this.wa.wh(t);
2977
+ this.Ca.Ch(t);
2978
2978
  }
2979
2979
  keyReleased(t) {
2980
- this.wa.Ch(t);
2980
+ this.Ca.xh(t);
2981
2981
  }
2982
2982
  isKeyPressed(t) {
2983
- return this.wa.Oh(t);
2983
+ return this.Ca.Ih(t);
2984
2984
  }
2985
2985
  get lastKeyPressed() {
2986
- return this.wa.Bh();
2986
+ return this.Ca.Hh();
2987
2987
  }
2988
2988
  get lastKeyReleased() {
2989
- return this.wa.Hh();
2989
+ return this.Ca.Gh();
2990
2990
  }
2991
2991
  get pressedKeys() {
2992
- return this.wa.Gh();
2992
+ return this.Ca.Qh();
2993
2993
  }
2994
2994
  get modifierState() {
2995
- return this.wa.Qh();
2995
+ return this.Ca.Nh();
2996
2996
  }
2997
2997
  };
2998
- class ke {
2998
+ class He {
2999
2999
  constructor(t) {
3000
- a(this, "Ca");
3001
- a(this, "xa", /* @__PURE__ */ new Map());
3002
- a(this, "Ma", []);
3003
- a(this, "Fa", /* @__PURE__ */ new Map());
3000
+ a(this, "xa");
3001
+ a(this, "Ma", /* @__PURE__ */ new Map());
3002
+ a(this, "Fa", []);
3004
3003
  a(this, "Pa", /* @__PURE__ */ new Map());
3005
- this.Ca = t;
3004
+ a(this, "$a", /* @__PURE__ */ new Map());
3005
+ this.xa = t;
3006
3006
  }
3007
- async $a(t) {
3007
+ async Ta(t) {
3008
3008
  for (const e of t) {
3009
- if (this.xa.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3010
- const i = this.Ta(e.name);
3009
+ if (this.Ma.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3010
+ const i = this.Ra(e.name);
3011
3011
  try {
3012
- await e.install(this.Ca, i);
3012
+ await e.install(this.xa, i);
3013
3013
  } catch (s) {
3014
- throw this.Ra(e.name), s;
3014
+ throw this.Ea(e.name), s;
3015
3015
  }
3016
- this.xa.set(e.name, e), this.Ma.push(e.name);
3016
+ this.Ma.set(e.name, e), this.Fa.push(e.name);
3017
3017
  }
3018
3018
  }
3019
- async Ea(t) {
3020
- const e = this.xa.get(t);
3019
+ async Sa(t) {
3020
+ const e = this.Ma.get(t);
3021
3021
  if (!e) return;
3022
- const i = this.Ta(t);
3023
- e.uninstall && await e.uninstall(this.Ca, i), this.xa.delete(t), this.Ma.splice(this.Ma.indexOf(t), 1), this.Ra(t);
3022
+ const i = this.Ra(t);
3023
+ e.uninstall && await e.uninstall(this.xa, i), this.Ma.delete(t), this.Fa.splice(this.Fa.indexOf(t), 1), this.Ea(t);
3024
3024
  }
3025
- Sa() {
3026
- this.ka(this.Fa);
3025
+ ka() {
3026
+ this.za(this.Pa);
3027
3027
  }
3028
- za() {
3029
- this.ka(this.Pa);
3028
+ Da() {
3029
+ this.za(this.$a);
3030
3030
  }
3031
- async Da() {
3032
- const t = [...this.xa.keys()];
3033
- for (const e of t) await this.Ea(e);
3031
+ async La() {
3032
+ const t = [...this.Ma.keys()];
3033
+ for (const e of t) await this.Sa(e);
3034
3034
  }
3035
- Ta(t) {
3036
- return { renderer: this.Ca.Z, font: this.Ca.er, grid: this.Ca.Qn, canvas: this.Ca.Rr, drawFramebuffer: this.Ca.pa, asciiFramebuffer: this.Ca.La, registerPreDrawHook: (e) => this.Oa(this.Fa, t, e), registerPostDrawHook: (e) => this.Oa(this.Pa, t, e) };
3035
+ Ra(t) {
3036
+ return { renderer: this.xa.Z, font: this.xa.rr, grid: this.xa.Nn, canvas: this.xa.Er, drawFramebuffer: this.xa.ga, asciiFramebuffer: this.xa.Oa, registerPreDrawHook: (e) => this.Ia(this.Pa, t, e), registerPostDrawHook: (e) => this.Ia(this.$a, t, e) };
3037
3037
  }
3038
- Oa(t, e, i) {
3038
+ Ia(t, e, i) {
3039
3039
  const s = t.get(e) ?? /* @__PURE__ */ new Set();
3040
3040
  return s.add(i), t.set(e, s), () => {
3041
3041
  const r = t.get(e);
3042
3042
  r && (r.delete(i), r.size === 0 && t.delete(e));
3043
3043
  };
3044
3044
  }
3045
- Ra(t) {
3046
- this.Fa.delete(t), this.Pa.delete(t);
3045
+ Ea(t) {
3046
+ this.Pa.delete(t), this.$a.delete(t);
3047
3047
  }
3048
- ka(t) {
3049
- for (const e of this.Ma) {
3048
+ za(t) {
3049
+ for (const e of this.Fa) {
3050
3050
  const i = t.get(e);
3051
3051
  i && i.forEach((s) => s());
3052
3052
  }
3053
3053
  }
3054
3054
  }
3055
- const W = `#version 300 es
3056
- in vec2 A0;in vec2 A1;out vec2 v_uv;void main(){v_uv=A1;gl_Position=vec4(A0,0.,1.);}`, Dt = `#version 300 es
3055
+ const K = `#version 300 es
3056
+ in vec2 A0;in vec2 A1;out vec2 v_uv;void main(){v_uv=A1;gl_Position=vec4(A0,0.,1.);}`, Xt = `#version 300 es
3057
3057
  precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`;
3058
- class Ot {
3058
+ class Zt {
3059
3059
  constructor() {
3060
- a(this, "Ia", /* @__PURE__ */ new Map());
3061
- a(this, "Ba", []);
3062
- a(this, "Ha", 0);
3060
+ a(this, "Ba", /* @__PURE__ */ new Map());
3061
+ a(this, "Ha", []);
3063
3062
  a(this, "Ga", 0);
3064
- a(this, "Qa");
3065
- }
3066
- get Na() {
3067
- return this.Ha;
3063
+ a(this, "Qa", 0);
3064
+ a(this, "Na");
3068
3065
  }
3069
3066
  get Xa() {
3070
- if (this.Ha === 0) return 0;
3067
+ return this.Ga;
3068
+ }
3069
+ get Ya() {
3070
+ if (this.Ga === 0) return 0;
3071
3071
  let t = 0;
3072
- for (const e of this.Ba) {
3073
- const i = this.Ia.get(e);
3072
+ for (const e of this.Ha) {
3073
+ const i = this.Ba.get(e);
3074
3074
  i && (t += Math.min(1, Math.max(0, i.progress)) * i.weight);
3075
3075
  }
3076
- return Math.min(1, t / this.Ha);
3076
+ return Math.min(1, t / this.Ga);
3077
3077
  }
3078
- Ya(t) {
3079
- this.Qa = t;
3078
+ ja(t) {
3079
+ this.Na = t;
3080
3080
  }
3081
- ja(t, e = 1) {
3082
- const i = `phase-${this.Ba.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
3083
- return this.Ia.set(i, s), this.Ba.push(i), this.Ha += s.weight, i;
3081
+ Wa(t, e = 1) {
3082
+ const i = `phase-${this.Ha.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
3083
+ return this.Ba.set(i, s), this.Ha.push(i), this.Ga += s.weight, i;
3084
3084
  }
3085
- Wa(t, e) {
3086
- const i = this.Ia.get(t);
3085
+ Ka(t, e) {
3086
+ const i = this.Ba.get(t);
3087
3087
  if (!i) return;
3088
3088
  i.progress = Math.max(0, Math.min(1, e)), i.status = i.progress >= 1 ? "complete" : "running";
3089
- const s = this.Xa;
3090
- Math.abs(s - this.Ga) > 1e-3 && (this.Ga = s, this.Qa && this.Qa(s));
3091
- }
3092
- Ka(t) {
3093
- const e = this.Ia.get(t);
3094
- e && (e.progress = 1, e.status = "complete", this.Wa(t, 1));
3089
+ const s = this.Ya;
3090
+ Math.abs(s - this.Qa) > 1e-3 && (this.Qa = s, this.Na && this.Na(s));
3095
3091
  }
3096
3092
  Za(t) {
3097
- const e = this.Ia.get(t);
3093
+ const e = this.Ba.get(t);
3094
+ e && (e.progress = 1, e.status = "complete", this.Ka(t, 1));
3095
+ }
3096
+ qa(t) {
3097
+ const e = this.Ba.get(t);
3098
3098
  e && (e.status = "failed");
3099
3099
  }
3100
- qa() {
3101
- return this.Ba.map((t) => {
3102
- const e = this.Ia.get(t);
3100
+ Va() {
3101
+ return this.Ha.map((t) => {
3102
+ const e = this.Ba.get(t);
3103
3103
  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" };
3104
3104
  });
3105
3105
  }
3106
3106
  }
3107
- class Xt {
3107
+ class Ot {
3108
3108
  constructor(t = "active") {
3109
- a(this, "Va");
3110
- a(this, "Ja", "");
3109
+ a(this, "Ja");
3111
3110
  a(this, "tc", "");
3112
- this.Va = t;
3113
- }
3114
- get sc() {
3115
- return this.Va;
3111
+ a(this, "sc", "");
3112
+ this.Ja = t;
3116
3113
  }
3117
3114
  get ec() {
3118
- return this.Va !== "disabled";
3115
+ return this.Ja;
3119
3116
  }
3120
3117
  get rc() {
3121
- return this.Va === "active" || this.Va === "transitioning" || this.Va === "error";
3118
+ return this.Ja !== "disabled";
3122
3119
  }
3123
3120
  get nc() {
3124
- return this.Ja;
3121
+ return this.Ja === "active" || this.Ja === "transitioning" || this.Ja === "error";
3125
3122
  }
3126
3123
  get hc() {
3127
3124
  return this.tc;
3128
3125
  }
3129
- oc() {
3130
- this.Va !== "done" && this.Va !== "transitioning" || (this.Va = "active");
3126
+ get oc() {
3127
+ return this.sc;
3131
3128
  }
3132
3129
  ac() {
3133
- this.Va !== "disabled" && (this.Va = "done");
3130
+ this.Ja !== "done" && this.Ja !== "transitioning" || (this.Ja = "active");
3134
3131
  }
3135
3132
  cc() {
3136
- this.Va !== "disabled" && (this.Va = "transitioning");
3133
+ this.Ja !== "disabled" && (this.Ja = "done");
3137
3134
  }
3138
3135
  lc() {
3139
- this.Va === "transitioning" && (this.Va = "done");
3136
+ this.Ja !== "disabled" && (this.Ja = "transitioning");
3137
+ }
3138
+ uc() {
3139
+ this.Ja === "transitioning" && (this.Ja = "done");
3140
3140
  }
3141
- uc(t) {
3142
- this.Va !== "disabled" && (this.Va = "error", t instanceof Error ? (this.Ja = t.message, this.tc = t.stack || "") : (this.Ja = t, this.tc = ""));
3141
+ fc(t) {
3142
+ this.Ja !== "disabled" && (this.Ja = "error", t instanceof Error ? (this.tc = t.message, this.sc = t.stack || "") : (this.tc = t, this.sc = ""));
3143
3143
  }
3144
- fc() {
3145
- this.Va = "disabled";
3144
+ dc() {
3145
+ this.Ja = "disabled";
3146
3146
  }
3147
3147
  }
3148
- class Yt {
3148
+ class It {
3149
3149
  constructor(t, e) {
3150
- a(this, "dc", 0);
3151
- a(this, "vc", 1);
3152
- a(this, "gc");
3150
+ a(this, "vc", 0);
3151
+ a(this, "gc", 1);
3153
3152
  a(this, "mc");
3154
- this.gc = t, this.mc = e;
3155
- }
3156
- get _c() {
3157
- return this.vc;
3153
+ a(this, "_c");
3154
+ this.mc = t, this._c = e;
3158
3155
  }
3159
3156
  get yc() {
3160
- return this.vc < 1;
3157
+ return this.gc;
3158
+ }
3159
+ get bc() {
3160
+ return this.gc < 1;
3161
3161
  }
3162
- Sn() {
3163
- this.gc !== "none" && this.mc > 0 && (this.dc = performance.now());
3162
+ kn() {
3163
+ this.mc !== "none" && this._c > 0 && (this.vc = performance.now());
3164
3164
  }
3165
3165
  et() {
3166
- if (this.gc === "none" || this.mc === 0) return this.vc = 1, !1;
3167
- const t = performance.now() - this.dc, e = Math.min(1, t / this.mc);
3168
- return e >= 1 ? (this.vc = 0, !0) : (this.vc = 1 - e, !1);
3166
+ if (this.mc === "none" || this._c === 0) return this.gc = 1, !1;
3167
+ const t = performance.now() - this.vc, e = Math.min(1, t / this._c);
3168
+ return e >= 1 ? (this.gc = 0, !0) : (this.gc = 1 - e, !1);
3169
3169
  }
3170
3170
  ti() {
3171
- this.vc = 1, this.dc = 0;
3171
+ this.gc = 1, this.vc = 0;
3172
3172
  }
3173
3173
  }
3174
3174
  function dt(n, t) {
@@ -3180,67 +3180,67 @@ function dt(n, t) {
3180
3180
  return 0.2126 * c(r) + 0.7152 * c(h) + 0.0722 * c(o);
3181
3181
  }(t) > 0.5 ? "light" : "dark"), { mode: i, background: t, textColor: i === "light" ? "#1A1A1A" : "#F8F8F8", subtleColor: i === "light" ? "#4A4A4A" : "#C0C0C0" };
3182
3182
  }
3183
- function Zt(n) {
3183
+ function Yt(n) {
3184
3184
  return n.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
3185
3185
  }
3186
3186
  function zt(n, t) {
3187
3187
  return n.length ? n.map((e) => t.color(e)) : [t.color("#FFFFFF")];
3188
3188
  }
3189
- const He = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: o, transitionOpacity: c, isError: l, errorMessage: u }) => {
3190
- const f = "|/-\\", d = Math.floor(i / 6) % 4, g = n.color(h.textColor), v = Math.floor(255 * c), m = n.color(g.r, g.g, g.b, v);
3191
- if (n.charColor(m), n.cellColor(0, 0, 0, 0), l) {
3192
- const A = n.color(h.mode === "light" ? "#D32F2F" : "#FF6B6B", v);
3189
+ const je = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: o, transitionOpacity: c, isError: l, errorMessage: u }) => {
3190
+ const f = "|/-\\", d = Math.floor(i / 6) % 4, g = n.color(h.textColor), m = Math.floor(255 * c), v = n.color(g.r, g.g, g.b, m);
3191
+ if (n.charColor(v), n.cellColor(0, 0, 0, 0), l) {
3192
+ const A = n.color(h.mode === "light" ? "#D32F2F" : "#FF6B6B", m);
3193
3193
  n.charColor(A), n.push(), n.translate(0, -2, 0), n.char("X"), n.rect(1, 1), n.pop();
3194
- const p = "SETUP ERROR", w = -Math.floor(p.length / 2);
3195
- n.push(), n.translate(w, 0, 0);
3196
- for (const y of p) n.char(y), n.rect(1, 1), n.translateX(1);
3194
+ const p = "SETUP ERROR", y = -Math.floor(p.length / 2);
3195
+ n.push(), n.translate(y, 0, 0);
3196
+ for (const E of p) n.char(E), n.rect(1, 1), n.translateX(1);
3197
3197
  if (n.pop(), u) {
3198
- const y = n.color(h.subtleColor), x = n.color(y.r, y.g, y.b, v);
3199
- n.charColor(x);
3200
- const b = Math.floor(0.8 * t.cols), C = u.split(" "), U = [];
3201
- let R = "";
3202
- for (const F of C) (R + " " + F).length <= b ? R = R ? R + " " + F : F : (R && U.push(R), R = F);
3203
- R && U.push(R);
3204
- const N = U.slice(0, 3);
3205
- U.length > 3 && (N[2] = N[2].substring(0, b - 3) + "..."), N.forEach((F, V) => {
3206
- const Kt = -Math.floor(F.length / 2);
3207
- n.push(), n.translate(Kt, 3 + V, 0);
3208
- for (const Wt of F) n.char(Wt), n.rect(1, 1), n.translateX(1);
3198
+ const E = n.color(h.subtleColor), b = n.color(E.r, E.g, E.b, m);
3199
+ n.charColor(b);
3200
+ const x = Math.floor(0.8 * t.cols), C = u.split(" "), N = [];
3201
+ let T = "";
3202
+ for (const F of C) (T + " " + F).length <= x ? T = T ? T + " " + F : F : (T && N.push(T), T = F);
3203
+ T && N.push(T);
3204
+ const S = N.slice(0, 3);
3205
+ N.length > 3 && (S[2] = S[2].substring(0, x - 3) + "..."), S.forEach((F, Q) => {
3206
+ const Wt = -Math.floor(F.length / 2);
3207
+ n.push(), n.translate(Wt, 3 + Q, 0);
3208
+ for (const Kt of F) n.char(Kt), n.rect(1, 1), n.translateX(1);
3209
3209
  n.pop();
3210
3210
  });
3211
3211
  }
3212
3212
  return;
3213
3213
  }
3214
3214
  if (n.push(), n.translate(0, 0, 0), n.char(f[d]), n.rect(1, 1), n.pop(), e > 0 || o.some((A) => A.status !== "pending")) {
3215
- const A = Math.max(6, Math.floor(0.6 * t.cols)), p = -Math.floor(A / 2), w = Math.floor(A * e), y = r.length ? r : [n.color("#FFFFFF")];
3215
+ const A = Math.max(6, Math.floor(0.6 * t.cols)), p = -Math.floor(A / 2), y = Math.floor(A * e), E = r.length ? r : [n.color("#FFFFFF")];
3216
3216
  n.push(), n.translate(p, 3, 0);
3217
- for (let x = 0; x < A; x++) {
3218
- const b = x < w ? "*" : ".", C = y[x % y.length], U = n.color(C.r, C.g, C.b, v);
3219
- n.charColor(U), n.char(b), n.rect(1, 1), n.translateX(1);
3217
+ for (let b = 0; b < A; b++) {
3218
+ const x = b < y ? "*" : ".", C = E[b % E.length], N = n.color(C.r, C.g, C.b, m);
3219
+ n.charColor(N), n.char(x), n.rect(1, 1), n.translateX(1);
3220
3220
  }
3221
3221
  n.pop();
3222
3222
  }
3223
3223
  if (s) {
3224
- const A = n.color(h.subtleColor), p = n.color(A.r, A.g, A.b, v);
3224
+ const A = n.color(h.subtleColor), p = n.color(A.r, A.g, A.b, m);
3225
3225
  n.charColor(p);
3226
- const w = -Math.floor(s.length / 2);
3227
- n.push(), n.translate(w, 5, 0);
3228
- for (const y of s) n.char(y), n.rect(1, 1), n.translateX(1);
3226
+ const y = -Math.floor(s.length / 2);
3227
+ n.push(), n.translate(y, 5, 0);
3228
+ for (const E of s) n.char(E), n.rect(1, 1), n.translateX(1);
3229
3229
  n.pop();
3230
3230
  }
3231
- }, Ke = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
3232
- class We {
3231
+ }, We = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
3232
+ class Ke {
3233
3233
  constructor(t, e, i) {
3234
- this.bc = t, this.id = e, this.label = i;
3234
+ this.wc = t, this.id = e, this.label = i;
3235
3235
  }
3236
3236
  report(t) {
3237
- this.bc.Wa(this.id, t);
3237
+ this.wc.Ka(this.id, t);
3238
3238
  }
3239
3239
  complete() {
3240
- this.bc.Ka(this.id);
3240
+ this.wc.Za(this.id);
3241
3241
  }
3242
3242
  fail(t) {
3243
- this.bc.Za(this.id);
3243
+ this.wc.qa(this.id);
3244
3244
  }
3245
3245
  async track(t) {
3246
3246
  try {
@@ -3251,120 +3251,119 @@ class We {
3251
3251
  }
3252
3252
  }
3253
3253
  }
3254
- class Qt {
3254
+ class Gt {
3255
3255
  constructor(t, e, i) {
3256
- a(this, "Ca");
3256
+ a(this, "xa");
3257
3257
  a(this, "l");
3258
- a(this, "wc");
3259
- a(this, "bc");
3260
3258
  a(this, "Cc");
3259
+ a(this, "wc");
3261
3260
  a(this, "xc");
3262
3261
  a(this, "Mc");
3263
3262
  a(this, "Fc");
3264
3263
  a(this, "Pc");
3265
3264
  a(this, "$c");
3265
+ a(this, "Tc");
3266
3266
  a(this, "Z");
3267
- a(this, "Tc", []);
3268
- a(this, "Rc");
3269
- a(this, "Ec", performance.now());
3270
- a(this, "Sc", 0);
3271
- a(this, "kc", !1);
3267
+ a(this, "Rc", []);
3268
+ a(this, "Ec");
3269
+ a(this, "Sc", performance.now());
3270
+ a(this, "kc", 0);
3272
3271
  a(this, "zc", !1);
3273
- a(this, "Ic");
3274
- this.Ca = t, this.l = { ...Ke, ...e ?? {} }, this.wc = new Xt("active"), this.bc = new Ot(), this.Cc = new Yt(this.l.transition, this.l.transitionDuration), this.xc = new _t(60), this.Rc = dt(this.l, i);
3275
- const s = Zt(this.Rc);
3276
- this.Tc = zt(s, this.Ca), this.Z = this.Dc(), this.bc.Ya((r) => {
3277
- r >= 0.999 && this.ac();
3272
+ a(this, "Dc", !1);
3273
+ a(this, "Bc");
3274
+ this.xa = t, this.l = { ...We, ...e ?? {} }, this.Cc = new Ot("active"), this.wc = new Zt(), this.xc = new It(this.l.transition, this.l.transitionDuration), this.Mc = new Dt(60), this.Ec = dt(this.l, i);
3275
+ const s = Yt(this.Ec);
3276
+ this.Rc = zt(s, this.xa), this.Z = this.Lc(), this.wc.ja((r) => {
3277
+ r >= 0.999 && this.cc();
3278
3278
  });
3279
3279
  }
3280
- async _r(t) {
3281
- if (this.zc) return;
3282
- const e = this.Ca.Z, i = this.Ca.Rr;
3283
- this.Mc = new vt(e, 16), await this.Mc._r(t);
3284
- const s = this.Mc.maxGlyphDimensions;
3285
- this.Fc = new St(i.canvas, s.width, s.height), this.Pc = e.Pe(this.Fc.cols, this.Fc.rows, 3), this.$c = e.Pe(this.Fc.width, this.Fc.height, 1), this.zc = !0;
3286
- }
3287
- get rc() {
3288
- return this.wc.rc && this.kc;
3280
+ async yr(t) {
3281
+ if (this.Dc) return;
3282
+ const e = this.xa.Z, i = this.xa.Er;
3283
+ this.Fc = new mt(e, 16), await this.Fc.yr(t);
3284
+ const s = this.Fc.maxGlyphDimensions;
3285
+ this.Pc = new Ut(i.canvas, s.width, s.height), this.$c = e.Pe(this.Pc.cols, this.Pc.rows, 3), this.Tc = e.Pe(this.Pc.width, this.Pc.height, 1), this.Dc = !0;
3289
3286
  }
3290
- Sn() {
3291
- this.kc || (this.kc = !0, this.Ec = performance.now(), this.Sc = 0, this.xc.Sn(() => this.Lc()));
3287
+ get nc() {
3288
+ return this.Cc.nc && this.zc;
3292
3289
  }
3293
3290
  kn() {
3294
- this.kc && (this.kc = !1, this.xc.kn());
3291
+ this.zc || (this.zc = !0, this.Sc = performance.now(), this.kc = 0, this.Mc.kn(() => this.Oc()));
3295
3292
  }
3296
- Nr() {
3297
- this.zc && (this.Fc.ti(), this.Pc.resize(this.Fc.cols, this.Fc.rows), this.$c.resize(this.Fc.width, this.Fc.height));
3293
+ zn() {
3294
+ this.zc && (this.zc = !1, this.Mc.zn());
3295
+ }
3296
+ Xr() {
3297
+ this.Dc && (this.Pc.ti(), this.$c.resize(this.Pc.cols, this.Pc.rows), this.Tc.resize(this.Pc.width, this.Pc.height));
3298
3298
  }
3299
3299
  gt() {
3300
- this.kn(), this.zc && (this.Mc.gt(), this.Pc.gt(), this.$c.gt(), this.zc = !1);
3300
+ this.zn(), this.Dc && (this.Fc.gt(), this.$c.gt(), this.Tc.gt(), this.Dc = !1);
3301
3301
  }
3302
3302
  get progress() {
3303
- return this.bc.Xa;
3303
+ return this.wc.Ya;
3304
3304
  }
3305
3305
  message(t) {
3306
3306
  return typeof t == "string" && (this.l.message = t), this.l.message;
3307
3307
  }
3308
3308
  addPhase(t, e = 1) {
3309
- this.wc.oc();
3310
- const i = this.bc.ja(t, e);
3311
- return new We(this.bc, i, t);
3309
+ this.Cc.ac();
3310
+ const i = this.wc.Wa(t, e);
3311
+ return new Ke(this.wc, i, t);
3312
3312
  }
3313
- ac() {
3314
- this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.wc.cc(), this.Cc.Sn()) : (this.wc.ac(), this.kn(), this.Oc());
3313
+ cc() {
3314
+ this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.Cc.lc(), this.xc.kn()) : (this.Cc.cc(), this.zn(), this.Ic());
3315
3315
  }
3316
- Oc() {
3317
- this.Ic && this.Ic();
3316
+ Ic() {
3317
+ this.Bc && this.Bc();
3318
3318
  }
3319
- Bc(t) {
3320
- this.Ic = t;
3319
+ Hc(t) {
3320
+ this.Bc = t;
3321
3321
  }
3322
3322
  error(t) {
3323
- this.wc.uc(t);
3323
+ this.Cc.fc(t);
3324
3324
  }
3325
- Lc() {
3326
- if (this.wc.rc) {
3327
- if (this.Sc++, this.wc.sc === "transitioning" && this.Cc.et())
3328
- return this.wc.lc(), this.Oc(), void this.kn();
3329
- this.Hc();
3325
+ Oc() {
3326
+ if (this.Cc.nc) {
3327
+ if (this.kc++, this.Cc.ec === "transitioning" && this.xc.et())
3328
+ return this.Cc.uc(), this.Ic(), void this.zn();
3329
+ this.Gc();
3330
3330
  }
3331
3331
  }
3332
- Hc() {
3333
- if (!this.zc) return;
3334
- const t = this.Pc, e = this.Mc, i = this.Fc, s = this.$c, r = this.Ca.Z, h = this.Ca.Rr, o = this.Ca.Gc, c = this.Ca.Qc;
3335
- r.state.qt(), t.begin(), this.Ca.clear(), this.Ca.push();
3332
+ Gc() {
3333
+ if (!this.Dc) return;
3334
+ const t = this.$c, e = this.Fc, i = this.Pc, s = this.Tc, r = this.xa.Z, h = this.xa.Er, o = this.xa.Qc, c = this.xa.Nc;
3335
+ r.state.qt(), t.begin(), this.xa.clear(), this.xa.push();
3336
3336
  try {
3337
- const l = { textmodifier: this.Ca, grid: i, progress: this.progress, elapsedMs: performance.now() - this.Ec, frameCount: this.Sc, message: this.l.message, palette: this.Tc, theme: this.Rc, phases: this.bc.qa(), transitionOpacity: this.Cc._c, isError: this.wc.sc === "error", errorMessage: this.wc.nc || void 0, errorDetails: this.wc.hc || void 0 };
3337
+ const l = { textmodifier: this.xa, grid: i, progress: this.progress, elapsedMs: performance.now() - this.Sc, frameCount: this.kc, message: this.l.message, palette: this.Rc, theme: this.Ec, phases: this.wc.Va(), transitionOpacity: this.xc.yc, isError: this.Cc.ec === "error", errorMessage: this.Cc.hc || void 0, errorDetails: this.Cc.oc || void 0 };
3338
3338
  this.Z(l);
3339
3339
  } finally {
3340
- this.Ca.pop();
3340
+ this.xa.pop();
3341
3341
  }
3342
3342
  t.end(), s.begin(), r.ve(o), o.O({ u_characterTexture: e.fontFramebuffer, u_charsetDimensions: [e.textureColumns, e.textureRows], Ug: t.textures[0], Uh: t.textures[1], Ui: t.textures[2], Uj: [i.cols, i.rows], Uk: [s.width, s.height], Ul: r.state.canvasBackgroundColor }), r.Ae(0, 0, h.width, h.height), s.end(), r.bi(...r.state.canvasBackgroundColor), r.ve(c), c.O({ u_texture: s.textures[0] }), r.Ae(i.offsetX, i.offsetY, i.width, i.height);
3343
3343
  }
3344
- Nc(t) {
3345
- this.Rc = dt(this.l, t);
3344
+ Xc(t) {
3345
+ this.Ec = dt(this.l, t);
3346
3346
  }
3347
- Dc() {
3348
- const t = this.l.renderer || He;
3347
+ Lc() {
3348
+ const t = this.l.renderer || je;
3349
3349
  return (e) => {
3350
- t(e), this.Xc(e);
3350
+ t(e), this.Yc(e);
3351
3351
  };
3352
3352
  }
3353
- Xc(t) {
3353
+ Yc(t) {
3354
3354
  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]];
3355
3355
  e.push(), e.translate(l, c, 0);
3356
3356
  for (let f = 0; f < o.length; f++) {
3357
- const d = o[f], g = Math.floor(0.1 * s + 0.5 * f) % u.length, [v, m, A] = u[g], p = Math.floor(255 * h), w = e.color(v, m, A, p);
3358
- e.charColor(w), e.char(d), e.point(), e.translateX(1);
3357
+ const d = o[f], g = Math.floor(0.1 * s + 0.5 * f) % u.length, [m, v, A] = u[g], p = Math.floor(255 * h), y = e.color(m, v, A, p);
3358
+ e.charColor(y), e.char(d), e.point(), e.translateX(1);
3359
3359
  }
3360
3360
  e.pop();
3361
3361
  }
3362
3362
  }
3363
3363
  class gt {
3364
3364
  constructor(t = {}) {
3365
- a(this, "Yc");
3366
- a(this, "_c");
3367
3365
  a(this, "jc");
3366
+ a(this, "yc");
3368
3367
  a(this, "Wc");
3369
3368
  a(this, "Kc");
3370
3369
  a(this, "Zc");
@@ -3372,231 +3371,232 @@ class gt {
3372
3371
  a(this, "Vc");
3373
3372
  a(this, "Jc");
3374
3373
  a(this, "tl");
3375
- a(this, "sl", null);
3376
- a(this, "il", !1);
3377
- a(this, "el", !0);
3378
- a(this, "rl", []);
3379
- this.Yc = t.visible ?? !0, this._c = Math.min(1, Math.max(0, t.opacity ?? 1)), this.jc = t.blendMode ?? "normal", this.Wc = Math.round(t.offsetX ?? 0), this.Kc = Math.round(t.offsetY ?? 0), this.Zc = t.rotation ?? 0;
3380
- }
3381
- nl() {
3382
- return this.sl !== null;
3374
+ a(this, "sl");
3375
+ a(this, "il", null);
3376
+ a(this, "el", !1);
3377
+ a(this, "rl", !0);
3378
+ a(this, "nl", []);
3379
+ this.jc = t.visible ?? !0, this.yc = Math.min(1, Math.max(0, t.opacity ?? 1)), this.Wc = t.blendMode ?? "normal", this.Kc = Math.round(t.offsetX ?? 0), this.Zc = Math.round(t.offsetY ?? 0), this.qc = t.rotation ?? 0;
3383
3380
  }
3384
3381
  hl() {
3385
- const t = this.rl;
3386
- return this.rl = [], t;
3382
+ return this.il !== null;
3387
3383
  }
3388
- ol(t) {
3389
- this.sl && this.sl.call(t);
3384
+ ol() {
3385
+ const t = this.nl;
3386
+ return this.nl = [], t;
3387
+ }
3388
+ al(t) {
3389
+ this.il && this.il.call(t);
3390
3390
  }
3391
3391
  draw(t) {
3392
- this.sl = t;
3392
+ this.il = t;
3393
3393
  }
3394
3394
  show() {
3395
- this.Yc = !0;
3395
+ this.jc = !0;
3396
3396
  }
3397
3397
  hide() {
3398
- this.Yc = !1;
3398
+ this.jc = !1;
3399
3399
  }
3400
3400
  opacity(t) {
3401
- if (t === void 0) return this._c;
3402
- this._c = Math.min(1, Math.max(0, t));
3401
+ if (t === void 0) return this.yc;
3402
+ this.yc = Math.min(1, Math.max(0, t));
3403
3403
  }
3404
3404
  blendMode(t) {
3405
- if (t === void 0) return this.jc;
3406
- this.jc = t;
3405
+ if (t === void 0) return this.Wc;
3406
+ this.Wc = t;
3407
3407
  }
3408
3408
  offset(t, e = 0) {
3409
- if (t === void 0) return { x: this.Wc, y: this.Kc };
3410
- this.Wc = Math.round(t), this.Kc = Math.round(e);
3409
+ if (t === void 0) return { x: this.Kc, y: this.Zc };
3410
+ this.Kc = Math.round(t), this.Zc = Math.round(e);
3411
3411
  }
3412
3412
  rotateZ(t) {
3413
- if (t === void 0) return this.Zc;
3414
- this.Zc = t;
3413
+ if (t === void 0) return this.qc;
3414
+ this.qc = t;
3415
3415
  }
3416
3416
  filter(t, e) {
3417
- this.rl.push({ name: t, params: e });
3417
+ this.nl.push({ name: t, params: e });
3418
3418
  }
3419
- al(t) {
3420
- this.qc = t, this.cl(t.grid);
3419
+ cl(t) {
3420
+ this.Vc = t, this.ll(t.grid);
3421
3421
  }
3422
- ba(t, e) {
3423
- if (!this.Yc || !this.sl) return void (this.il = !1);
3424
- const i = this.qc.renderer;
3425
- this.rl = [], this.Vc.begin(), i.state.qt(), this.sl.call(t), this.Vc.end();
3426
- const s = this.rl.length > 0, r = s ? this.tl : this.Jc;
3427
- r.begin(), i.ve(e), e.O({ u_characterTexture: this.qc.font.fontFramebuffer, u_charsetDimensions: [this.qc.font.textureColumns, this.qc.font.textureRows], Ug: this.Vc.textures[0], Uh: this.Vc.textures[1], Ui: this.Vc.textures[2], Uj: [this.qc.grid.cols, this.qc.grid.rows], Uk: [r.width, r.height], Ul: [0, 0, 0, 0] }), i.Ae(0, 0, this.qc.grid.width, this.qc.grid.height), r.end(), s && this.qc.filterManager.ll(this.tl.textures[0], this.Jc, this.rl, this.Jc.width, this.Jc.height, this.qc.layerPingPongBuffers), this.il = !0;
3422
+ wa(t, e) {
3423
+ if (!this.jc || !this.il) return void (this.el = !1);
3424
+ const i = this.Vc.renderer;
3425
+ this.nl = [], this.Jc.begin(), i.state.qt(), this.il.call(t), this.Jc.end();
3426
+ const s = this.nl.length > 0, r = s ? this.sl : this.tl;
3427
+ r.begin(), i.ve(e), e.O({ u_characterTexture: this.Vc.font.fontFramebuffer, u_charsetDimensions: [this.Vc.font.textureColumns, this.Vc.font.textureRows], Ug: this.Jc.textures[0], Uh: this.Jc.textures[1], Ui: this.Jc.textures[2], Uj: [this.Vc.grid.cols, this.Vc.grid.rows], Uk: [r.width, r.height], Ul: [0, 0, 0, 0] }), i.Ae(0, 0, this.Vc.grid.width, this.Vc.grid.height), r.end(), s && this.Vc.filterManager.ul(this.sl.textures[0], this.tl, this.nl, this.tl.width, this.tl.height, this.Vc.layerPingPongBuffers), this.el = !0;
3428
3428
  }
3429
- Nr(t) {
3429
+ Xr(t) {
3430
3430
  var e;
3431
- this.qc && (this.qc = { ...this.qc, grid: t }), this.Vc && this.Jc && (this.Vc.resize(t.cols, t.rows), this.Jc.resize(t.width, t.height), (e = this.tl) == null || e.resize(t.width, t.height));
3431
+ this.Vc && (this.Vc = { ...this.Vc, grid: t }), this.Jc && this.tl && (this.Jc.resize(t.cols, t.rows), this.tl.resize(t.width, t.height), (e = this.sl) == null || e.resize(t.width, t.height));
3432
3432
  }
3433
3433
  gt() {
3434
3434
  var t, e, i;
3435
- this.el && ((t = this.Vc) == null || t.gt(), (e = this.Jc) == null || e.gt(), (i = this.tl) == null || i.gt());
3435
+ this.rl && ((t = this.Jc) == null || t.gt(), (e = this.tl) == null || e.gt(), (i = this.sl) == null || i.gt());
3436
3436
  }
3437
3437
  get texture() {
3438
3438
  var t;
3439
- return (t = this.Jc) == null ? void 0 : t.textures[0];
3439
+ return (t = this.tl) == null ? void 0 : t.textures[0];
3440
3440
  }
3441
3441
  get width() {
3442
- return this.Jc ? this.Jc.width : 0;
3442
+ return this.tl ? this.tl.width : 0;
3443
3443
  }
3444
3444
  get height() {
3445
- return this.Jc ? this.Jc.height : 0;
3445
+ return this.tl ? this.tl.height : 0;
3446
3446
  }
3447
- get ul() {
3448
- return this.il;
3447
+ get fl() {
3448
+ return this.el;
3449
3449
  }
3450
3450
  get drawFramebuffer() {
3451
- return this.Vc;
3451
+ return this.Jc;
3452
3452
  }
3453
- cl(t) {
3454
- this.qc && (this.Vc = this.qc.externalDrawFramebuffer ?? this.qc.createFramebuffer(t.cols, t.rows, 4), this.Jc = this.qc.externalAsciiFramebuffer ?? this.qc.createFramebuffer(t.width, t.height, 1), this.qc.externalAsciiFramebuffer || (this.tl = this.qc.createFramebuffer(t.width, t.height, 1)), this.el = !this.qc.externalDrawFramebuffer && !this.qc.externalAsciiFramebuffer, this.il = !1);
3453
+ ll(t) {
3454
+ this.Vc && (this.Jc = this.Vc.externalDrawFramebuffer ?? this.Vc.createFramebuffer(t.cols, t.rows, 4), this.tl = this.Vc.externalAsciiFramebuffer ?? this.Vc.createFramebuffer(t.width, t.height, 1), this.Vc.externalAsciiFramebuffer || (this.sl = this.Vc.createFramebuffer(t.width, t.height, 1)), this.rl = !this.Vc.externalDrawFramebuffer && !this.Vc.externalAsciiFramebuffer, this.el = !1);
3455
3455
  }
3456
3456
  }
3457
- const xt = { normal: 0, additive: 1, multiply: 2, screen: 3, subtract: 4, darken: 5, lighten: 6, overlay: 7, softLight: 8, hardLight: 9, colorDodge: 10, colorBurn: 11, difference: 12, exclusion: 13 };
3458
- class qt {
3457
+ const bt = { normal: 0, additive: 1, multiply: 2, screen: 3, subtract: 4, darken: 5, lighten: 6, overlay: 7, softLight: 8, hardLight: 9, colorDodge: 10, colorBurn: 11, difference: 12, exclusion: 13 };
3458
+ class Vt {
3459
3459
  constructor(t) {
3460
3460
  a(this, "Z");
3461
- a(this, "fl");
3462
- a(this, "dl", null);
3463
- a(this, "vl", 0);
3464
- this.Z = t, this.fl = t.pe(W, `#version 300 es
3461
+ a(this, "dl");
3462
+ a(this, "vl", null);
3463
+ a(this, "pl", 0);
3464
+ this.Z = t, this.dl = t.pe(K, `#version 300 es
3465
3465
  precision highp float;uniform sampler2D Um;uniform sampler2D Un;uniform vec2 Uo;uniform vec2 Up;uniform vec2 Uq;uniform float Ur;uniform vec2 Us;uniform float Ut;uniform int Uu;in vec2 v_uv;out vec4 fragColor;const int A=0;const int B=1;const int C=2;const int D=3;const int E=4;const int F=5;const int G=6;const int H=7;const int I=8;const int J=9;const int K=10;const int L=11;const int M=12;const int N=13;vec3 O(vec3 P,vec3 Q){return Q;}vec3 R(vec3 P,vec3 Q){return P+Q;}vec3 S(vec3 P,vec3 Q){return P*Q;}vec3 T(vec3 P,vec3 Q){return 1.-(1.-P)*(1.-Q);}vec3 U(vec3 P,vec3 Q){return max(P-Q,0.);}vec3 V(vec3 P,vec3 Q){return min(P,Q);}vec3 W(vec3 P,vec3 Q){return max(P,Q);}vec3 X(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,P));}vec3 Y(vec3 P,vec3 Q){return mix(P-(1.-2.*Q)*P*(1.-P),mix(P+(2.*Q-1.)*(P*(3.-2.*P)-P),P+(2.*Q-1.)*(sqrt(P)-P),step(0.25,P)),step(0.5,Q));}vec3 Z(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,Q));}vec3 a(vec3 P,vec3 Q){return mix(min(vec3(1.),P/max(1.-Q,0.0001)),vec3(1.),step(1.,Q));}vec3 b(vec3 P,vec3 Q){return mix(1.-min(vec3(1.),(1.-P)/max(Q,0.0001)),vec3(0.),step(Q,vec3(0.)));}vec3 c(vec3 P,vec3 Q){return abs(P-Q);}vec3 d(vec3 P,vec3 Q){return P+Q-2.*P*Q;}vec3 e(int f,vec3 P,vec3 Q){if(f==A)return O(P,Q);if(f==B)return R(P,Q);if(f==C)return S(P,Q);if(f==D)return T(P,Q);if(f==E)return U(P,Q);if(f==F)return V(P,Q);if(f==G)return W(P,Q);if(f==H)return X(P,Q);if(f==I)return Y(P,Q);if(f==J)return Z(P,Q);if(f==K)return a(P,Q);if(f==L)return b(P,Q);if(f==M)return c(P,Q);if(f==N)return d(P,Q);return O(P,Q);}void main(){vec4 g=texture(Un,v_uv);vec2 h=v_uv*Uo;vec2 i=h-Uq-Us;vec2 j=Up*0.5;vec2 k=i-j;float l=cos(-Ut);float m=sin(-Ut);vec2 n=vec2(k.x*l-k.y*m,k.x*m+k.y*l);i=n+j;bool o=any(lessThan(i,vec2(0.)))||any(greaterThanEqual(i,Up));if(o){fragColor=g;return;}vec2 p=(floor(i)+0.5)/Up;vec4 q=texture(Um,p);float r=q.a*Ur;if(r<=0.){fragColor=g;return;}vec3 s=e(Uu,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`);
3466
3466
  }
3467
- _r(t, e) {
3468
- this.dl || (this.dl = [this.Z.Pe(t, e, 1), this.Z.Pe(t, e, 1)]);
3467
+ yr(t, e) {
3468
+ this.vl || (this.vl = [this.Z.Pe(t, e, 1), this.Z.Pe(t, e, 1)]);
3469
3469
  }
3470
- pl(t) {
3471
- const e = this.Z.context, { baseTexture: i, targetFramebuffer: s, backgroundColor: r, baseLayer: h, layers: o, canvasWidth: c, canvasHeight: l, gridWidth: u, gridHeight: f, baseOffsetX: d, baseOffsetY: g } = t, v = e.isEnabled(e.DEPTH_TEST), m = e.getParameter(e.DEPTH_WRITEMASK);
3472
- v && e.disable(e.DEPTH_TEST), m && e.depthMask(!1);
3473
- const A = this.dl[0];
3474
- A.begin(), this.Z.bi(...r), A.end(), this.vl = 0, h.Yc && this.ml(i, c, l, u, f, h._c, d + h.Wc, g + h.Kc, h.Zc, "normal", e);
3475
- for (const p of o) p.Yc && p.ul && this.ml(p.texture, c, l, p.width, p.height, p._c, d + p.Wc, g + p.Kc, p.Zc, p.jc, e);
3476
- this._l(s, c, l, e), e.depthMask(m), v && e.enable(e.DEPTH_TEST);
3470
+ ml(t) {
3471
+ const e = this.Z.context, { baseTexture: i, targetFramebuffer: s, backgroundColor: r, baseLayer: h, layers: o, canvasWidth: c, canvasHeight: l, gridWidth: u, gridHeight: f, baseOffsetX: d, baseOffsetY: g } = t, m = e.isEnabled(e.DEPTH_TEST), v = e.getParameter(e.DEPTH_WRITEMASK);
3472
+ m && e.disable(e.DEPTH_TEST), v && e.depthMask(!1);
3473
+ const A = this.vl[0];
3474
+ A.begin(), this.Z.bi(...r), A.end(), this.pl = 0, h.jc && this._l(i, c, l, u, f, h.yc, d + h.Kc, g + h.Zc, h.qc, "normal", e);
3475
+ for (const p of o) p.jc && p.fl && this._l(p.texture, c, l, p.width, p.height, p.yc, d + p.Kc, g + p.Zc, p.qc, p.Wc, e);
3476
+ this.yl(s, c, l, e), e.depthMask(v), m && e.enable(e.DEPTH_TEST);
3477
3477
  }
3478
- ml(t, e, i, s, r, h, o, c, l, u, f) {
3479
- const d = this.dl[this.vl], g = this.vl === 0 ? 1 : 0, v = this.dl[g], m = l * (Math.PI / 180);
3480
- v.begin(), f.disable(f.BLEND), this.Z.ve(this.fl), this.fl.O({ Um: t, Un: d.textures[0], Uo: [e, i], Up: [s, r], Uq: [o, c], Ur: h, Us: [0, 0], Ut: m, Uu: xt[u] }), this.Z.Ae(0, 0, d.width, d.height), v.end(), this.vl = g;
3478
+ _l(t, e, i, s, r, h, o, c, l, u, f) {
3479
+ const d = this.vl[this.pl], g = this.pl === 0 ? 1 : 0, m = this.vl[g], v = l * (Math.PI / 180);
3480
+ m.begin(), f.disable(f.BLEND), this.Z.ve(this.dl), this.dl.O({ Um: t, Un: d.textures[0], Uo: [e, i], Up: [s, r], Uq: [o, c], Ur: h, Us: [0, 0], Ut: v, Uu: bt[u] }), this.Z.Ae(0, 0, d.width, d.height), m.end(), this.pl = g;
3481
3481
  }
3482
- _l(t, e, i, s) {
3483
- const r = this.dl[this.vl];
3484
- t.begin(), s.disable(s.BLEND), this.Z.ve(this.fl), this.fl.O({ Um: r.textures[0], Un: r.textures[0], Uo: [e, i], Up: [r.width, r.height], Uq: [0, 0], Ur: 1, Us: [0, 0], Ut: 0, Uu: xt.normal }), this.Z.Ae(0, 0, e, i), t.end();
3482
+ yl(t, e, i, s) {
3483
+ const r = this.vl[this.pl];
3484
+ t.begin(), s.disable(s.BLEND), this.Z.ve(this.dl), this.dl.O({ Um: r.textures[0], Un: r.textures[0], Uo: [e, i], Up: [r.width, r.height], Uq: [0, 0], Ur: 1, Us: [0, 0], Ut: 0, Uu: bt.normal }), this.Z.Ae(0, 0, e, i), t.end();
3485
3485
  }
3486
- Nr(t, e) {
3487
- this.dl && (this.dl[0].resize(t, e), this.dl[1].resize(t, e));
3486
+ Xr(t, e) {
3487
+ this.vl && (this.vl[0].resize(t, e), this.vl[1].resize(t, e));
3488
3488
  }
3489
3489
  gt() {
3490
- this.fl.dispose(), this.dl && (this.dl[0].gt(), this.dl[1].gt(), this.dl = null);
3490
+ this.dl.dispose(), this.vl && (this.vl[0].gt(), this.vl[1].gt(), this.vl = null);
3491
3491
  }
3492
3492
  }
3493
- class Gt {
3493
+ class kt {
3494
3494
  constructor(t) {
3495
- a(this, "Ca");
3495
+ a(this, "xa");
3496
3496
  a(this, "Z");
3497
- a(this, "yl");
3498
3497
  a(this, "Al");
3499
- a(this, "bl", []);
3498
+ a(this, "bl");
3500
3499
  a(this, "wl", []);
3501
- a(this, "Cl");
3500
+ a(this, "Cl", []);
3502
3501
  a(this, "xl");
3503
3502
  a(this, "Ml");
3504
3503
  a(this, "Fl");
3505
- a(this, "Pl", !1);
3506
- this.Ca = t, this.Z = t.Z, this.yl = t.Gc, this.Al = new qt(this.Z), this.Cl = new gt({ visible: !0, opacity: 1 });
3504
+ a(this, "Pl");
3505
+ a(this, "$l", !1);
3506
+ this.xa = t, this.Z = t.Z, this.Al = t.Qc, this.bl = new Vt(this.Z), this.xl = new gt({ visible: !0, opacity: 1 });
3507
3507
  }
3508
3508
  add(t = {}) {
3509
3509
  const e = new gt(t);
3510
- return this.Pl ? (this.$l(e), this.wl.push(e)) : this.bl.push(e), e;
3510
+ return this.$l ? (this.Tl(e), this.Cl.push(e)) : this.wl.push(e), e;
3511
3511
  }
3512
3512
  remove(t) {
3513
- this.Tl(this.wl, t) || this.Tl(this.bl, t);
3513
+ this.Rl(this.Cl, t) || this.Rl(this.wl, t);
3514
3514
  }
3515
3515
  move(t, e) {
3516
- this.Rl(this.wl, t, e) || this.Rl(this.bl, t, e);
3516
+ this.El(this.Cl, t, e) || this.El(this.wl, t, e);
3517
3517
  }
3518
3518
  swap(t, e) {
3519
- t !== e && (this.El(this.wl, t, e) || this.El(this.bl, t, e));
3519
+ t !== e && (this.Sl(this.Cl, t, e) || this.Sl(this.wl, t, e));
3520
3520
  }
3521
3521
  clear() {
3522
+ for (const t of this.Cl) t.gt();
3523
+ this.Cl.length = 0;
3522
3524
  for (const t of this.wl) t.gt();
3523
3525
  this.wl.length = 0;
3524
- for (const t of this.bl) t.gt();
3525
- this.bl.length = 0;
3526
3526
  }
3527
- _r() {
3528
- if (this.Pl) return;
3529
- const t = this.Ca.Qn;
3530
- this.xl = this.Z.Pe(t.width, t.height, 1), this.Ml = this.Z.Pe(t.width, t.height, 1), this.Fl = [this.Z.Pe(t.width, t.height, 1, { depth: !1 }), this.Z.Pe(t.width, t.height, 1, { depth: !1 })], this.Sl(), this.Al._r(this.Ca.Rr.width, this.Ca.Rr.height);
3531
- for (const e of this.bl) this.$l(e), this.wl.push(e);
3532
- this.bl.length = 0, this.Pl = !0;
3527
+ yr() {
3528
+ if (this.$l) return;
3529
+ const t = this.xa.Nn;
3530
+ this.Ml = this.Z.Pe(t.width, t.height, 1), this.Fl = this.Z.Pe(t.width, t.height, 1), this.Pl = [this.Z.Pe(t.width, t.height, 1, { depth: !1 }), this.Z.Pe(t.width, t.height, 1, { depth: !1 })], this.kl(), this.bl.yr(this.xa.Er.width, this.xa.Er.height);
3531
+ for (const e of this.wl) this.Tl(e), this.Cl.push(e);
3532
+ this.wl.length = 0, this.$l = !0;
3533
3533
  }
3534
- kl(t, e) {
3535
- const i = this.Ca.Qn, s = this.Ca.font, r = this.Ca.pa, h = this.Cl.hl(), o = h.length > 0, c = o ? this.Ml : this.xl;
3536
- c.begin(), this.Z.ve(this.yl), this.yl.O({ u_characterTexture: s.fontFramebuffer, u_charsetDimensions: [s.textureColumns, s.textureRows], Ug: r.textures[0], Uh: r.textures[1], Ui: r.textures[2], Uj: [i.cols, i.rows], Uk: [c.width, c.height], Ul: this.Z.state.canvasBackgroundColor }), this.Z.Ae(0, 0, i.width, i.height), c.end(), o && this.Ca.zl.ll(this.Ml.textures[0], this.xl, h, this.xl.width, this.xl.height, this.Fl), this.Dl(), this.Ll(t, e);
3534
+ zl(t, e) {
3535
+ const i = this.xa.Nn, s = this.xa.font, r = this.xa.ga, h = this.xl.ol(), o = h.length > 0, c = o ? this.Fl : this.Ml;
3536
+ c.begin(), this.Z.ve(this.Al), this.Al.O({ u_characterTexture: s.fontFramebuffer, u_charsetDimensions: [s.textureColumns, s.textureRows], Ug: r.textures[0], Uh: r.textures[1], Ui: r.textures[2], Uj: [i.cols, i.rows], Uk: [c.width, c.height], Ul: this.Z.state.canvasBackgroundColor }), this.Z.Ae(0, 0, i.width, i.height), c.end(), o && this.xa.Dl.ul(this.Fl.textures[0], this.Ml, h, this.Ml.width, this.Ml.height, this.Pl), this.Ll(), this.Ol(t, e);
3537
3537
  }
3538
- Dl() {
3539
- if (this.wl.length !== 0) for (const t of this.wl) t.ba(this.Ca, this.yl);
3538
+ Ll() {
3539
+ if (this.Cl.length !== 0) for (const t of this.Cl) t.wa(this.xa, this.Al);
3540
3540
  }
3541
- Ll(t, e) {
3542
- const i = this.Ca.Qn, s = this.Ca.Rr;
3543
- this.Al.pl({ baseTexture: this.xl.textures[0], targetFramebuffer: t, backgroundColor: e, baseLayer: this.Cl, layers: this.wl, canvasWidth: s.width, canvasHeight: s.height, gridWidth: i.width, gridHeight: i.height, baseOffsetX: i.offsetX, baseOffsetY: i.offsetY });
3541
+ Ol(t, e) {
3542
+ const i = this.xa.Nn, s = this.xa.Er;
3543
+ this.bl.ml({ baseTexture: this.Ml.textures[0], targetFramebuffer: t, backgroundColor: e, baseLayer: this.xl, layers: this.Cl, canvasWidth: s.width, canvasHeight: s.height, gridWidth: i.width, gridHeight: i.height, baseOffsetX: i.offsetX, baseOffsetY: i.offsetY });
3544
3544
  }
3545
- Nr() {
3546
- if (!this.Pl) return;
3547
- const t = this.Ca.Qn;
3548
- this.xl.resize(t.width, t.height), this.Ml.resize(t.width, t.height), this.Cl.Nr(t), this.Fl && (this.Fl[0].resize(t.width, t.height), this.Fl[1].resize(t.width, t.height));
3549
- for (const e of this.wl) e.Nr(t);
3550
- this.Al.Nr(this.Ca.Rr.width, this.Ca.Rr.height);
3545
+ Xr() {
3546
+ if (!this.$l) return;
3547
+ const t = this.xa.Nn;
3548
+ this.Ml.resize(t.width, t.height), this.Fl.resize(t.width, t.height), this.xl.Xr(t), this.Pl && (this.Pl[0].resize(t.width, t.height), this.Pl[1].resize(t.width, t.height));
3549
+ for (const e of this.Cl) e.Xr(t);
3550
+ this.bl.Xr(this.xa.Er.width, this.xa.Er.height);
3551
3551
  }
3552
3552
  gt() {
3553
3553
  var t, e, i, s;
3554
+ for (const r of this.Cl) r.gt();
3554
3555
  for (const r of this.wl) r.gt();
3555
- for (const r of this.bl) r.gt();
3556
- this.wl.length = 0, this.bl.length = 0, this.Cl.gt(), (t = this.xl) == null || t.gt(), (e = this.Ml) == null || e.gt(), (i = this.Fl) == null || i[0].gt(), (s = this.Fl) == null || s[1].gt(), this.Al.gt();
3556
+ this.Cl.length = 0, this.wl.length = 0, this.xl.gt(), (t = this.Ml) == null || t.gt(), (e = this.Fl) == null || e.gt(), (i = this.Pl) == null || i[0].gt(), (s = this.Pl) == null || s[1].gt(), this.bl.gt();
3557
3557
  }
3558
3558
  get all() {
3559
- return this.wl;
3559
+ return this.Cl;
3560
3560
  }
3561
3561
  get base() {
3562
- return this.Cl;
3562
+ return this.xl;
3563
3563
  }
3564
- $l(t) {
3565
- const e = { renderer: this.Z, grid: this.Ca.Qn, font: this.Ca.font, filterManager: this.Ca.zl, layerPingPongBuffers: this.Fl, createFramebuffer: (i, s, r = 1) => this.Z.Pe(i, s, r) };
3566
- t.al(e);
3564
+ Tl(t) {
3565
+ const e = { renderer: this.Z, grid: this.xa.Nn, font: this.xa.font, filterManager: this.xa.Dl, layerPingPongBuffers: this.Pl, createFramebuffer: (i, s, r = 1) => this.Z.Pe(i, s, r) };
3566
+ t.cl(e);
3567
3567
  }
3568
- Sl() {
3569
- const t = { renderer: this.Z, grid: this.Ca.Qn, font: this.Ca.font, filterManager: this.Ca.zl, layerPingPongBuffers: this.Fl, createFramebuffer: (e, i, s = 1) => this.Z.Pe(e, i, s), externalDrawFramebuffer: this.Ca.pa, externalAsciiFramebuffer: this.xl };
3570
- this.Cl.al(t);
3568
+ kl() {
3569
+ const t = { renderer: this.Z, grid: this.xa.Nn, font: this.xa.font, filterManager: this.xa.Dl, layerPingPongBuffers: this.Pl, createFramebuffer: (e, i, s = 1) => this.Z.Pe(e, i, s), externalDrawFramebuffer: this.xa.ga, externalAsciiFramebuffer: this.Ml };
3570
+ this.xl.cl(t);
3571
3571
  }
3572
- Tl(t, e) {
3572
+ Rl(t, e) {
3573
3573
  const i = t.indexOf(e);
3574
3574
  if (i === -1) return !1;
3575
3575
  const [s] = t.splice(i, 1);
3576
3576
  return s.gt(), !0;
3577
3577
  }
3578
- Rl(t, e, i) {
3578
+ El(t, e, i) {
3579
3579
  const s = t.indexOf(e);
3580
3580
  if (s === -1) return !1;
3581
3581
  t.splice(s, 1);
3582
3582
  const r = Math.max(0, Math.min(t.length, i));
3583
3583
  return t.splice(r, 0, e), !0;
3584
3584
  }
3585
- El(t, e, i) {
3585
+ Sl(t, e, i) {
3586
3586
  const s = t.indexOf(e);
3587
3587
  if (s === -1) return !1;
3588
3588
  const r = t.indexOf(i);
3589
3589
  return r !== -1 && (t[s] = i, t[r] = e, !0);
3590
3590
  }
3591
3591
  }
3592
- class kt {
3592
+ class Ht {
3593
3593
  constructor(t) {
3594
3594
  a(this, "Z");
3595
- a(this, "Ol", /* @__PURE__ */ new Map());
3596
3595
  a(this, "Il", /* @__PURE__ */ new Map());
3597
- this.Z = t, this.Bl();
3596
+ a(this, "Bl", /* @__PURE__ */ new Map());
3597
+ this.Z = t, this.Hl();
3598
3598
  }
3599
- async Hl(t, e, i = {}) {
3599
+ async Gl(t, e, i = {}) {
3600
3600
  const s = Object.entries(i), r = s.length > 0 ? s[0][1][0] : null;
3601
3601
  let h;
3602
3602
  if (typeof e == "string") {
@@ -3606,267 +3606,267 @@ class kt {
3606
3606
  if (!l.ok) throw Error(`Failed to load shader from ${e}: ${l.statusText}`);
3607
3607
  c = await l.text();
3608
3608
  }
3609
- h = this.Z.pe(W, c), this.Il.set(t, h);
3610
- } else h = e, this.Il.set(t, h);
3609
+ h = this.Z.pe(K, c), this.Bl.set(t, h);
3610
+ } else h = e, this.Bl.set(t, h);
3611
3611
  const o = { id: t, createShader: () => h, createUniforms: (c, l) => {
3612
3612
  const u = { u_resolution: [l.width, l.height] };
3613
3613
  for (const [f, [d, g]] of s) {
3614
- let v = g;
3615
- c != null && (typeof c == "number" && d === r ? v = c : typeof c == "object" && d in c && (v = c[d] ?? g)), u[f] = v;
3614
+ let m = g;
3615
+ c != null && (typeof c == "number" && d === r ? m = c : typeof c == "object" && d in c && (m = c[d] ?? g)), u[f] = m;
3616
3616
  }
3617
3617
  return u;
3618
3618
  } };
3619
- this.Ol.set(t, o);
3620
- }
3621
- Gl(t) {
3622
- const e = this.Il.get(t);
3623
- return e && (e.dispose(), this.Il.delete(t)), this.Ol.delete(t);
3619
+ this.Il.set(t, o);
3624
3620
  }
3625
3621
  Ql(t) {
3626
- return this.Ol.get(t);
3622
+ const e = this.Bl.get(t);
3623
+ return e && (e.dispose(), this.Bl.delete(t)), this.Il.delete(t);
3624
+ }
3625
+ Nl(t) {
3626
+ return this.Il.get(t);
3627
3627
  }
3628
3628
  gt() {
3629
- for (const t of this.Il.values()) t.dispose();
3630
- this.Il.clear(), this.Ol.clear();
3629
+ for (const t of this.Bl.values()) t.dispose();
3630
+ this.Bl.clear(), this.Il.clear();
3631
3631
  }
3632
- Bl() {
3633
- this.Hl("invert", `#version 300 es
3634
- precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);fragColor=vec4(1.-A.rgb,A.a);}`, {}), this.Hl("grayscale", `#version 300 es
3635
- precision highp float;uniform sampler2D u_texture;uniform float Uc;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));vec3 C=mix(A.rgb,vec3(B),Uc);fragColor=vec4(C,A.a);}`, { Uc: ["amount", 1] }), this.Hl("sepia", `#version 300 es
3636
- precision highp float;uniform sampler2D u_texture;uniform float Uc;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);vec3 B;B.r=dot(A.rgb,vec3(0.393,0.769,0.189));B.g=dot(A.rgb,vec3(0.349,0.686,0.168));B.b=dot(A.rgb,vec3(0.272,0.534,0.131));vec3 C=mix(A.rgb,B,Uc);fragColor=vec4(C,A.a);}`, { Uc: ["amount", 1] }), this.Hl("threshold", `#version 300 es
3637
- precision highp float;uniform sampler2D u_texture;uniform float Uf;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));float C=step(Uf,B);fragColor=vec4(vec3(C),A.a);}`, { Uf: ["threshold", 0.5] });
3632
+ Hl() {
3633
+ this.Gl("invert", `#version 300 es
3634
+ precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);fragColor=vec4(1.-A.rgb,A.a);}`, {}), this.Gl("grayscale", `#version 300 es
3635
+ precision highp float;uniform sampler2D u_texture;uniform float U1;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));vec3 C=mix(A.rgb,vec3(B),U1);fragColor=vec4(C,A.a);}`, { U1: ["amount", 1] }), this.Gl("sepia", `#version 300 es
3636
+ precision highp float;uniform sampler2D u_texture;uniform float U1;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);vec3 B;B.r=dot(A.rgb,vec3(0.393,0.769,0.189));B.g=dot(A.rgb,vec3(0.349,0.686,0.168));B.b=dot(A.rgb,vec3(0.272,0.534,0.131));vec3 C=mix(A.rgb,B,U1);fragColor=vec4(C,A.a);}`, { U1: ["amount", 1] }), this.Gl("threshold", `#version 300 es
3637
+ precision highp float;uniform sampler2D u_texture;uniform float U2;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));float C=step(U2,B);fragColor=vec4(vec3(C),A.a);}`, { U2: ["threshold", 0.5] });
3638
3638
  }
3639
3639
  }
3640
- class Ht {
3640
+ class jt {
3641
3641
  constructor(t) {
3642
3642
  a(this, "Z");
3643
- a(this, "Il", /* @__PURE__ */ new Map());
3643
+ a(this, "Bl", /* @__PURE__ */ new Map());
3644
3644
  a(this, "J");
3645
- a(this, "dl");
3646
- a(this, "zc", !1);
3647
- a(this, "Nl");
3648
- this.Z = t, this.Nl = new kt(this.Z), this.J = t.pe(W, Dt);
3645
+ a(this, "vl");
3646
+ a(this, "Dc", !1);
3647
+ a(this, "Xl");
3648
+ this.Z = t, this.Xl = new Ht(this.Z), this.J = t.pe(K, Xt);
3649
3649
  }
3650
3650
  async register(t, e, i = {}) {
3651
- await this.Nl.Hl(t, e, i);
3651
+ await this.Xl.Gl(t, e, i);
3652
3652
  }
3653
3653
  unregister(t) {
3654
- return this.Nl.Gl(t) ?? !1;
3654
+ return this.Xl.Ql(t) ?? !1;
3655
3655
  }
3656
3656
  has(t) {
3657
- return this.Nl.Ql(t) !== void 0;
3657
+ return this.Xl.Nl(t) !== void 0;
3658
3658
  }
3659
- _r(t, e) {
3660
- this.zc || (this.dl = [this.Z.Pe(t, e, 1, { depth: !1 }), this.Z.Pe(t, e, 1, { depth: !1 })], this.zc = !0);
3659
+ yr(t, e) {
3660
+ this.Dc || (this.vl = [this.Z.Pe(t, e, 1, { depth: !1 }), this.Z.Pe(t, e, 1, { depth: !1 })], this.Dc = !0);
3661
3661
  }
3662
- Xl(t, e, i, s, r) {
3663
- this.dl[0].width === s && this.dl[0].height === r || (this.dl[0].resize(s, r), this.dl[1].resize(s, r)), this.ll(t, e, i, s, r, this.dl);
3662
+ Yl(t, e, i, s, r) {
3663
+ this.vl[0].width === s && this.vl[0].height === r || (this.vl[0].resize(s, r), this.vl[1].resize(s, r)), this.ul(t, e, i, s, r, this.vl);
3664
3664
  }
3665
- ll(t, e, i, s, r, h) {
3666
- if (i.length === 0) return void this.Yl(t, e, s, r);
3665
+ ul(t, e, i, s, r, h) {
3666
+ if (i.length === 0) return void this.jl(t, e, s, r);
3667
3667
  const o = this.Z.context, c = o.isEnabled(o.BLEND);
3668
- o.disable(o.BLEND), this.Yl(t, h[0], s, r);
3668
+ o.disable(o.BLEND), this.jl(t, h[0], s, r);
3669
3669
  let l = 0;
3670
3670
  for (let u = 0; u < i.length; u++) {
3671
- const f = i[u], d = u === i.length - 1, g = l === 0 ? 1 : 0, v = d ? e : h[g];
3672
- this.jl(f, h[l], v, s, r), d || (l = g);
3671
+ const f = i[u], d = u === i.length - 1, g = l === 0 ? 1 : 0, m = d ? e : h[g];
3672
+ this.Wl(f, h[l], m, s, r), d || (l = g);
3673
3673
  }
3674
3674
  c && o.enable(o.BLEND);
3675
3675
  }
3676
- jl(t, e, i, s, r) {
3677
- const h = this.Nl.Ql(t.name);
3678
- if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.Yl(e.textures[0], i, s, r);
3679
- const o = this.Wl(t.name, h, s, r), c = { renderer: this.Z, gl: this.Z.context, width: s, height: r };
3676
+ Wl(t, e, i, s, r) {
3677
+ const h = this.Xl.Nl(t.name);
3678
+ if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.jl(e.textures[0], i, s, r);
3679
+ const o = this.Kl(t.name, h, s, r), c = { renderer: this.Z, gl: this.Z.context, width: s, height: r };
3680
3680
  i.begin(), this.Z.ve(o), o.O({ u_texture: e.textures[0] });
3681
3681
  const l = h.createUniforms(t.params, c);
3682
3682
  o.O(l), this.Z.Ae(0, 0, s, r), i.end();
3683
3683
  }
3684
- Wl(t, e, i, s) {
3685
- let r = this.Il.get(t);
3684
+ Kl(t, e, i, s) {
3685
+ let r = this.Bl.get(t);
3686
3686
  if (!r && e) {
3687
3687
  const h = { renderer: this.Z, gl: this.Z.context, width: i, height: s };
3688
- r = e.createShader(h), this.Il.set(t, r);
3688
+ r = e.createShader(h), this.Bl.set(t, r);
3689
3689
  }
3690
3690
  return r;
3691
3691
  }
3692
- Yl(t, e, i, s) {
3692
+ jl(t, e, i, s) {
3693
3693
  e.begin(), this.Z.ve(this.J), this.J.O({ u_texture: t, u_resolution: [i, s] }), this.Z.Ae(0, 0, i, s), e.end();
3694
3694
  }
3695
- Nr(t, e) {
3696
- this.dl && (this.dl[0].resize(t, e), this.dl[1].resize(t, e));
3695
+ Xr(t, e) {
3696
+ this.vl && (this.vl[0].resize(t, e), this.vl[1].resize(t, e));
3697
3697
  }
3698
3698
  gt() {
3699
- for (const t of this.Il.values()) t.dispose();
3700
- this.Il.clear(), this.J.dispose(), this.Nl.gt(), this.dl && (this.dl[0].gt(), this.dl[1].gt()), this.zc = !1;
3699
+ for (const t of this.Bl.values()) t.dispose();
3700
+ this.Bl.clear(), this.J.dispose(), this.Xl.gt(), this.vl && (this.vl[0].gt(), this.vl[1].gt()), this.Dc = !1;
3701
3701
  }
3702
3702
  }
3703
- const ti = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: kt, TextmodeFilterManager: Ht }, Symbol.toStringTag, { value: "Module" }));
3704
- class Ve extends function(e, ...i) {
3703
+ const ti = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: Ht, TextmodeFilterManager: jt }, Symbol.toStringTag, { value: "Module" }));
3704
+ class Qe extends function(e, ...i) {
3705
3705
  return i.reduce((s, r) => r(s), e);
3706
3706
  }(class {
3707
- }, Ye, Ze, ze, Qe, qe, Ge) {
3707
+ }, Ie, Ye, ze, Ge, Ve, ke) {
3708
3708
  constructor(e = {}) {
3709
3709
  super();
3710
3710
  a(this, "Z");
3711
- a(this, "er");
3712
- a(this, "Rr");
3713
- a(this, "Qn");
3714
- a(this, "ya");
3715
- a(this, "Xh");
3716
- a(this, "ma");
3717
- a(this, "wa");
3718
- a(this, "Kl");
3719
- a(this, "pa");
3720
- a(this, "Gc");
3721
- a(this, "La");
3722
- a(this, "Qc");
3711
+ a(this, "rr");
3712
+ a(this, "Er");
3713
+ a(this, "Nn");
3714
+ a(this, "ba");
3715
+ a(this, "Yh");
3716
+ a(this, "_a");
3717
+ a(this, "Ca");
3718
+ a(this, "Zl");
3723
3719
  a(this, "ga");
3724
- a(this, "zl");
3725
- a(this, "Zl", []);
3726
- a(this, "ql");
3720
+ a(this, "Qc");
3721
+ a(this, "Oa");
3722
+ a(this, "Nc");
3723
+ a(this, "ma");
3724
+ a(this, "Dl");
3725
+ a(this, "ql", []);
3727
3726
  a(this, "Vl");
3728
3727
  a(this, "Jl");
3729
- a(this, "tu", !1);
3728
+ a(this, "tu");
3730
3729
  a(this, "su", !1);
3731
3730
  a(this, "iu", !1);
3732
3731
  a(this, "eu", !1);
3733
- a(this, "ru", () => {
3732
+ a(this, "ru", !1);
3733
+ a(this, "nu", () => {
3734
3734
  });
3735
- a(this, "sl", () => {
3735
+ a(this, "il", () => {
3736
3736
  });
3737
- a(this, "nu", () => {
3737
+ a(this, "hu", () => {
3738
3738
  });
3739
- a(this, "hu");
3740
3739
  a(this, "ou");
3741
- a(this, "Dr", !1);
3742
3740
  a(this, "au");
3743
- a(this, "_a", /* @__PURE__ */ new Set());
3744
- this.Jl = new ke(this), this.Dr = e.overlay ?? !1, this.Rr = new _e(e), this.Z = new pe(this.Rr.Xr()), this.er = new vt(this.Z, e.fontSize ?? 16), this.ya = new _t(e.frameRate ?? 60), this.Kl = new Qt(this, e.loadingScreen, this.Rr.Qr()), this.Kl.Bc(() => {
3745
- this.ya.Hn = 0, this.eu = !0;
3746
- }), this.Xh = new Lt(this.Rr), this.ma = new It(this.Rr, this.Xh), this.wa = new Bt(), this.Gc = this.Z.pe(W, `#version 300 es
3747
- precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D Uh;uniform sampler2D Ui;uniform sampler2D Ug;uniform vec2 Uj;uniform vec2 Uk;uniform vec4 Ul;in vec2 v_uv;out vec4 fragColor;mat2 A(float B){float C=sin(B);float D=cos(B);return mat2(D,-C,C,D);}void main(){vec2 E=gl_FragCoord.xy/Uk;vec2 F=E*Uj;vec2 G=floor(F);vec2 H=(G+0.5)/Uj;vec4 I=texture(Uh,H);vec4 J=texture(Ui,H);vec4 K=texture(Ug,H);int L=int(K.b*255.+0.5);bool M=(L&1)!=0;bool N=(L&2)!=0;bool O=(L&4)!=0;int P=int(K.r*255.+0.5)+int(K.g*255.+0.5)*256;int Q=int(u_charsetDimensions.x);int R=P/Q;int S=P-(R*Q);float T=(u_charsetDimensions.y-1.)-float(R);vec2 U=1./u_charsetDimensions;vec2 V=vec2(float(S),T)*U;vec2 W=V+U;float X=-K.a*360.*0.017453292;vec2 Y=fract(F)-0.5f;vec2 Z=vec2(N?-1.:1.,O?-1.:1.);Y*=Z;Y=A(X)*Y+0.5;vec2 a=V+clamp(Y,0.,1.)*U;const float b=0.0001;if(any(lessThan(a,V-b))||any(greaterThan(a,W+b))){fragColor=M?I:J;return;}vec4 c=texture(u_characterTexture,a);if(M)c.rgb=mix(c.rgb,1.-c.rgb,float(M));vec4 d=mix(Ul,J,J.a);fragColor=mix(d,I,c);}`), this.ga = new Gt(this), this.zl = new Ht(this.Z), this.Kl.Sn(), this.cu(e);
3748
- }
3749
- async cu(e) {
3750
- await Promise.all([this.er._r(e.fontSource), this.Kl._r(e.fontSource)]);
3751
- const i = this.er.maxGlyphDimensions;
3752
- this.Qn = new St(this.Rr.canvas, i.width, i.height), this.Xh._r(this.Qn), this.ma._r(this.Qn), this.pa = this.Z.Pe(this.Qn.cols, this.Qn.rows, 3), this.La = this.Z.Pe(this.Qn.width, this.Qn.height, 1), this.ql = this.Z.Pe(this.Rr.width, this.Rr.height, 1), this.Vl = this.Z.Pe(this.Rr.width, this.Rr.height, 1), this.zl._r(this.Rr.width, this.Rr.height), this.ga._r(), this.Dr && (this.au = Y.wn(this.Z, this.er, this.Rr.targetCanvas, this.Qn.cols, this.Qn.rows), this.va(this.au)), this.Qc = this.Z.pe(W, Dt), this.lu(), this.ya.Sn(() => this.ba()), await this.Jl.$a(e.plugins ?? []);
3741
+ a(this, "Lr", !1);
3742
+ a(this, "cu");
3743
+ a(this, "ya", /* @__PURE__ */ new Set());
3744
+ this.tu = new He(this), this.Lr = e.overlay ?? !1, this.Er = new De(e), this.Z = new pe(this.Er.Yr()), this.rr = new mt(this.Z, e.fontSize ?? 16), this.ba = new Dt(e.frameRate ?? 60), this.Zl = new Gt(this, e.loadingScreen, this.Er.Nr()), this.Zl.Hc(() => {
3745
+ this.ba.Gn = 0, this.ru = !0;
3746
+ }), this.Yh = new Lt(this.Er), this._a = new Bt(this.Er, this.Yh), this.Ca = new _t(), this.Qc = this.Z.pe(K, `#version 300 es
3747
+ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D Uh;uniform sampler2D Ui;uniform sampler2D Ug;uniform vec2 Uj;uniform vec2 Uk;uniform vec4 Ul;in vec2 v_uv;out vec4 fragColor;mat2 A(float B){float C=sin(B);float D=cos(B);return mat2(D,-C,C,D);}void main(){vec2 E=gl_FragCoord.xy/Uk;vec2 F=E*Uj;vec2 G=floor(F);vec2 H=(G+0.5)/Uj;vec4 I=texture(Uh,H);vec4 J=texture(Ui,H);vec4 K=texture(Ug,H);int L=int(K.b*255.+0.5);bool M=(L&1)!=0;bool N=(L&2)!=0;bool O=(L&4)!=0;int P=int(K.r*255.+0.5)+int(K.g*255.+0.5)*256;int Q=int(u_charsetDimensions.x);int R=P/Q;int S=P-(R*Q);float T=(u_charsetDimensions.y-1.)-float(R);vec2 U=1./u_charsetDimensions;vec2 V=vec2(float(S),T)*U;vec2 W=V+U;float X=-K.a*360.*0.017453292;vec2 Y=fract(F)-0.5f;vec2 Z=vec2(N?-1.:1.,O?-1.:1.);Y*=Z;Y=A(X)*Y+0.5;vec2 a=V+clamp(Y,0.,1.)*U;const float b=0.0001;if(any(lessThan(a,V-b))||any(greaterThan(a,W+b))){fragColor=M?I:J;return;}vec4 c=texture(u_characterTexture,a);if(M)c.rgb=mix(c.rgb,1.-c.rgb,float(M));vec4 d=mix(Ul,J,J.a);fragColor=mix(d,I,c);}`), this.ma = new kt(this), this.Dl = new jt(this.Z), this.Zl.kn(), this.lu(e);
3748
+ }
3749
+ async lu(e) {
3750
+ await Promise.all([this.rr.yr(e.fontSource), this.Zl.yr(e.fontSource)]);
3751
+ const i = this.rr.maxGlyphDimensions;
3752
+ this.Nn = new Ut(this.Er.canvas, i.width, i.height), this.Yh.yr(this.Nn), this._a.yr(this.Nn), this.ga = this.Z.Pe(this.Nn.cols, this.Nn.rows, 3), this.Oa = this.Z.Pe(this.Nn.width, this.Nn.height, 1), this.Vl = this.Z.Pe(this.Er.width, this.Er.height, 1), this.Jl = this.Z.Pe(this.Er.width, this.Er.height, 1), this.Dl.yr(this.Er.width, this.Er.height), this.ma.yr(), this.Lr && (this.cu = I.Cn(this.Z, this.rr, this.Er.targetCanvas, this.Nn.cols, this.Nn.rows), this.pa(this.cu)), this.Nc = this.Z.pe(K, Xt), this.uu(), this.ba.kn(() => this.wa()), await this.tu.Ta(e.plugins ?? []);
3753
3753
  try {
3754
- await this.ru(), this.Kl.ac();
3754
+ await this.nu(), this.Zl.cc();
3755
3755
  } catch (s) {
3756
- console.error("Error during setup:", s), this.Kl.error(s);
3756
+ console.error("Error during setup:", s), this.Zl.error(s);
3757
3757
  }
3758
3758
  }
3759
- lu() {
3760
- this.hu = () => {
3761
- this.Dr && this.resizeCanvas(this.Rr.targetCanvas.width, this.Rr.targetCanvas.height), this.nu();
3762
- }, window.addEventListener("resize", this.hu), this.Xh.fh(), this.ma.fh(), this.wa.fh(), window.addEventListener("blur", () => {
3763
- this.wa.Nh();
3764
- }), this.Dr && (this.ou = new ResizeObserver(() => {
3765
- this.resizeCanvas(this.Rr.targetCanvas.width, this.Rr.targetCanvas.height);
3766
- }), this.ou.observe(this.Rr.targetCanvas));
3767
- }
3768
- ba() {
3769
- if (!this.Kl.rc && this.eu) {
3770
- this.su = !0;
3759
+ uu() {
3760
+ this.ou = () => {
3761
+ this.Lr && this.resizeCanvas(this.Er.targetCanvas.width, this.Er.targetCanvas.height), this.hu();
3762
+ }, window.addEventListener("resize", this.ou), this.Yh.dh(), this._a.dh(), this.Ca.dh(), window.addEventListener("blur", () => {
3763
+ this.Ca.Xh();
3764
+ }), this.Lr && (this.au = new ResizeObserver(() => {
3765
+ this.resizeCanvas(this.Er.targetCanvas.width, this.Er.targetCanvas.height);
3766
+ }), this.au.observe(this.Er.targetCanvas));
3767
+ }
3768
+ wa() {
3769
+ if (!this.Zl.nc && this.ru) {
3770
+ this.iu = !0;
3771
3771
  try {
3772
- this.ya.On(), this.ya.Gn(), this.Dr && Tt(this.Z.context, this.au.texture, this.Rr.targetCanvas), this.Jl.Sa(), this.Z.state.qt(), this.pa.begin(), this.ga.base.nl() ? this.ga.base.ol(this) : this.sl(), this.pa.end();
3772
+ this.ba.In(), this.ba.Qn(), this.Lr && Rt(this.Z.context, this.cu.texture, this.Er.targetCanvas), this.tu.ka(), this.Z.state.qt(), this.ga.begin(), this.ma.base.hl() ? this.ma.base.al(this) : this.il(), this.ga.end();
3773
3773
  const e = [...this.Z.state.canvasBackgroundColor];
3774
- this.ga.kl(this.ql, e);
3775
- let i = this.ql.textures[0];
3776
- this.Zl.length > 0 && (this.zl.Xl(this.ql.textures[0], this.Vl, this.Zl, this.Rr.width, this.Rr.height), i = this.Vl.textures[0], this.Zl = []), this.Z.bi(0, 0, 0, 0), this.Z.ve(this.Qc), this.Qc.O({ u_texture: i }), this.Z.Ae(0, 0, this.Rr.width, this.Rr.height), this.Jl.za();
3774
+ this.ma.zl(this.Vl, e);
3775
+ let i = this.Vl.textures[0];
3776
+ this.ql.length > 0 && (this.Dl.Yl(this.Vl.textures[0], this.Jl, this.ql, this.Er.width, this.Er.height), i = this.Jl.textures[0], this.ql = []), this.Z.bi(0, 0, 0, 0), this.Z.ve(this.Nc), this.Nc.O({ u_texture: i }), this.Z.Ae(0, 0, this.Er.width, this.Er.height), this.tu.Da();
3777
3777
  } finally {
3778
- this.su = !1, this.tu && !this.iu && this.uu();
3778
+ this.iu = !1, this.su && !this.eu && this.fu();
3779
3779
  }
3780
3780
  }
3781
3781
  }
3782
3782
  resizeCanvas(e, i) {
3783
3783
  var s, r, h, o;
3784
- this.Rr.Nr(e, i), this.Kl.Nc(this.Rr.Qr()), this.Qn.ti(), this.Kl.Nr(), this.pa.resize(this.Qn.cols, this.Qn.rows), this.La.resize(this.Qn.width, this.Qn.height), (s = this.ql) == null || s.resize(this.Rr.width, this.Rr.height), (r = this.Vl) == null || r.resize(this.Rr.width, this.Rr.height), (h = this.zl) == null || h.Nr(this.Rr.width, this.Rr.height), (o = this.ga) == null || o.Nr(), this.Z.Ue(), this.Xh.uh(), this.ma.uh(), this.ba();
3784
+ this.Er.Xr(e, i), this.Zl.Xc(this.Er.Nr()), this.Nn.ti(), this.Zl.Xr(), this.ga.resize(this.Nn.cols, this.Nn.rows), this.Oa.resize(this.Nn.width, this.Nn.height), (s = this.Vl) == null || s.resize(this.Er.width, this.Er.height), (r = this.Jl) == null || r.resize(this.Er.width, this.Er.height), (h = this.Dl) == null || h.Xr(this.Er.width, this.Er.height), (o = this.ma) == null || o.Xr(), this.Z.Re(), this.Yh.fh(), this._a.fh(), this.wa();
3785
3785
  }
3786
3786
  destroy() {
3787
- this.iu || this.tu || (this.tu = !0, this.ya.zn(), this.su || this.uu());
3787
+ this.eu || this.su || (this.su = !0, this.ba.Dn(), this.iu || this.fu());
3788
3788
  }
3789
- uu() {
3789
+ fu() {
3790
3790
  var e, i, s, r, h, o;
3791
- this.tu = !1, this.Kl.gt(), this.Jl.Da(), window.removeEventListener("resize", this.hu), (e = this.ou) == null || e.disconnect(), this.Xh.Ah(), this.ma.Ah(), this.wa.Ah(), this.pa.gt(), this.Gc.dispose(), (i = this.ga) == null || i.gt(), (s = this.zl) == null || s.gt(), (r = this.ql) == null || r.gt(), (h = this.Vl) == null || h.gt(), this.er.gt(), this.Z.gt(), this.La.gt(), this.Qc.dispose(), (o = this.au) == null || o.gt(), this.Rr.gt(), this.iu = !0;
3791
+ this.su = !1, this.Zl.gt(), this.tu.La(), window.removeEventListener("resize", this.ou), (e = this.au) == null || e.disconnect(), this.Yh.bh(), this._a.bh(), this.Ca.bh(), this.ga.gt(), this.Qc.dispose(), (i = this.ma) == null || i.gt(), (s = this.Dl) == null || s.gt(), (r = this.Vl) == null || r.gt(), (h = this.Jl) == null || h.gt(), this.rr.gt(), this.Z.gt(), this.Oa.gt(), this.Nc.dispose(), (o = this.cu) == null || o.gt(), this.Er.gt(), this.eu = !0;
3792
3792
  }
3793
3793
  setup(e) {
3794
- this.ru = e;
3794
+ this.nu = e;
3795
3795
  }
3796
3796
  draw(e) {
3797
- this.sl = e;
3797
+ this.il = e;
3798
3798
  }
3799
3799
  windowResized(e) {
3800
- this.nu = e;
3800
+ this.hu = e;
3801
3801
  }
3802
3802
  get grid() {
3803
- return this.Qn;
3803
+ return this.Nn;
3804
3804
  }
3805
3805
  get font() {
3806
- return this.er;
3806
+ return this.rr;
3807
3807
  }
3808
3808
  get width() {
3809
- return this.Rr.width;
3809
+ return this.Er.width;
3810
3810
  }
3811
3811
  get height() {
3812
- return this.Rr.height;
3812
+ return this.Er.height;
3813
3813
  }
3814
3814
  get canvas() {
3815
- return this.Rr.canvas;
3815
+ return this.Er.canvas;
3816
3816
  }
3817
3817
  get drawFramebuffer() {
3818
- return this.pa;
3818
+ return this.ga;
3819
3819
  }
3820
3820
  get isDisposed() {
3821
- return this.iu;
3821
+ return this.eu;
3822
3822
  }
3823
3823
  get overlay() {
3824
- return this.au;
3824
+ return this.cu;
3825
3825
  }
3826
3826
  get loading() {
3827
- return this.Kl;
3827
+ return this.Zl;
3828
3828
  }
3829
3829
  get layers() {
3830
- return this.ga;
3830
+ return this.ma;
3831
3831
  }
3832
3832
  get filters() {
3833
- return this.zl;
3833
+ return this.Dl;
3834
3834
  }
3835
3835
  filter(e, i) {
3836
- this.Zl.push({ name: e, params: i });
3836
+ this.ql.push({ name: e, params: i });
3837
3837
  }
3838
- va(e) {
3839
- this._a.has(e) || this._a.add(e);
3838
+ pa(e) {
3839
+ this.ya.has(e) || this.ya.add(e);
3840
3840
  }
3841
3841
  }
3842
3842
  class At {
3843
3843
  constructor() {
3844
3844
  }
3845
3845
  static create(t = {}) {
3846
- return new Ve(t);
3846
+ return new Qe(t);
3847
3847
  }
3848
3848
  static setErrorLevel(t) {
3849
- mt._(t);
3849
+ vt._(t);
3850
3850
  }
3851
3851
  static get version() {
3852
- return "0.7.1-beta.5";
3852
+ return "0.7.1";
3853
3853
  }
3854
3854
  }
3855
3855
  let ct = null;
3856
- const je = { id: "brightness", createShader: ({ gl: n }) => (ct || (ct = new k(n, it, `#version 300 es
3857
- precision highp float;in vec2 v_uv;uniform sampler2D u_image;uniform bool u_invert;uniform bool u_flipX;uniform bool u_flipY;uniform float u_charRotation;uniform bool u_charColorFixed;uniform vec4 u_charColor;uniform bool u_cellColorFixed;uniform vec4 u_cellColor;uniform vec4 u_backgroundColor;uniform int u_charCount;uniform vec3 u_charList[255];uniform bool u_colorFilterEnabled;uniform int u_colorFilterSize;uniform vec4 u_colorFilterPalette[64];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;float B(vec3 C){return dot(C,vec3(0.299f,0.587f,0.114f));}float D(vec3 E,vec3 F){vec3 G=E-F;return dot(G,G);}vec4 H(vec4 I){if(!u_colorFilterEnabled||u_colorFilterSize<=0){return I;}int J=min(u_colorFilterSize,64);vec3 K=u_colorFilterPalette[0].rgb;float L=D(I.rgb,K);for(int M=1;M<64;++M){if(M>=J){break;}vec3 N=u_colorFilterPalette[M].rgb;float O=D(I.rgb,N);if(O<L){L=O;K=N;}}return vec4(K,I.a);}void main(){vec2 P=vec2(v_uv.x,1.0f-v_uv.y);vec4 I=texture(u_image,P);I=H(I);float F=B(I.rgb);vec2 Q=vec2(0.);if(u_charCount>0){float R=float(u_charCount);float S=clamp(F*(R-1.0f),0.0f,R-1.0f);int T=int(floor(S+0.5f));vec3 U=u_charList[T];Q=U.xy;}else{Q=vec2(0.0f,0.0f);}vec4 V=u_charColorFixed?u_charColor:I;vec4 W=u_cellColorFixed?u_cellColor:I;if(I.a<0.01f){discard;}o_primaryColor=vec4(V.rgb,V.a);o_secondaryColor=vec4(W.rgb,W.a);A=vec4(0.);int X=int(u_invert?1:0);int Y=int(u_flipX?1:0);int Z=int(u_flipY?1:0);float a=float(X|(Y<<1)|(Z<<2))/255.;o_character=vec4(Q,a,clamp(u_charRotation,0.0f,1.0f));}`)), ct), createUniforms: ({ source: n }) => n.createBaseConversionUniforms() }, ei = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhaseTracker: Ot, LoadingScreenManager: Qt, LoadingScreenStateMachine: Xt, LoadingScreenTransition: Yt, resolveColorInputs: zt, resolveDefaultPalette: Zt, resolveTheme: dt }, Symbol.toStringTag, { value: "Module" })), ii = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: vt, TextmodeImage: Y, TextmodeVideo: rt }, Symbol.toStringTag, { value: "Module" })), si = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: De, mouse: Ie, touch: Oe }, Symbol.toStringTag, { value: "Module" })), ri = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: qt, TextmodeLayer: gt, TextmodeLayerManager: Gt }, Symbol.toStringTag, { value: "Module" }));
3858
- Le(je);
3856
+ const qe = { id: "brightness", createShader: ({ gl: n }) => (ct || (ct = new H(n, it, `#version 300 es
3857
+ precision highp float;in vec2 v_uv;uniform sampler2D u_image;uniform bool u_invert;uniform bool u_flipX;uniform bool u_flipY;uniform float u_charRotation;uniform bool u_charColorFixed;uniform vec4 u_charColor;uniform bool u_cellColorFixed;uniform vec4 u_cellColor;uniform vec4 u_backgroundColor;uniform int u_charCount;uniform vec3 u_charList[255];uniform bool u_colorFilterEnabled;uniform int u_colorFilterSize;uniform vec4 u_colorFilterPalette[64];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;float B(vec3 C){return dot(C,vec3(0.299f,0.587f,0.114f));}float D(vec3 E,vec3 F){vec3 G=E-F;return dot(G,G);}vec4 H(vec4 I){if(!u_colorFilterEnabled||u_colorFilterSize<=0){return I;}int J=min(u_colorFilterSize,64);vec3 K=u_colorFilterPalette[0].rgb;float L=D(I.rgb,K);for(int M=1;M<64;++M){if(M>=J){break;}vec3 N=u_colorFilterPalette[M].rgb;float O=D(I.rgb,N);if(O<L){L=O;K=N;}}return vec4(K,I.a);}void main(){vec2 P=vec2(v_uv.x,1.0f-v_uv.y);vec4 I=texture(u_image,P);I=H(I);float F=B(I.rgb);vec2 Q=vec2(0.);if(u_charCount>0){float R=float(u_charCount);float S=clamp(F*(R-1.0f),0.0f,R-1.0f);int T=int(floor(S+0.5f));vec3 U=u_charList[T];Q=U.xy;}else{Q=vec2(0.0f,0.0f);}vec4 V=u_charColorFixed?u_charColor:I;vec4 W=u_cellColorFixed?u_cellColor:I;if(I.a<0.01f){discard;}o_primaryColor=vec4(V.rgb,V.a);o_secondaryColor=vec4(W.rgb,W.a);A=vec4(0.);int X=int(u_invert?1:0);int Y=int(u_flipX?1:0);int Z=int(u_flipY?1:0);float a=float(X|(Y<<1)|(Z<<2))/255.;o_character=vec4(Q,a,clamp(u_charRotation,0.0f,1.0f));}`)), ct), createUniforms: ({ source: n }) => n.createBaseConversionUniforms() }, ei = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhaseTracker: Zt, LoadingScreenManager: Gt, LoadingScreenStateMachine: Ot, LoadingScreenTransition: It, resolveColorInputs: zt, resolveDefaultPalette: Yt, resolveTheme: dt }, Symbol.toStringTag, { value: "Module" })), ii = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: mt, TextmodeImage: I, TextmodeVideo: rt }, Symbol.toStringTag, { value: "Module" })), si = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: Xe, mouse: Be, touch: Ze }, Symbol.toStringTag, { value: "Module" })), ri = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: Vt, TextmodeLayer: gt, TextmodeLayerManager: kt }, Symbol.toStringTag, { value: "Module" }));
3858
+ Le(qe);
3859
3859
  const ni = At.create, hi = At.setErrorLevel, oi = At.version;
3860
3860
  export {
3861
- _e as TextmodeCanvas,
3861
+ De as TextmodeCanvas,
3862
3862
  M as TextmodeColor,
3863
3863
  Jt as TextmodeErrorLevel,
3864
- H as TextmodeFramebuffer,
3865
- St as TextmodeGrid,
3866
- Ve as Textmodifier,
3864
+ j as TextmodeFramebuffer,
3865
+ Ut as TextmodeGrid,
3866
+ Qe as Textmodifier,
3867
3867
  ni as create,
3868
3868
  ti as filters,
3869
- Be as getConversionStrategy,
3869
+ _e as getConversionStrategy,
3870
3870
  si as input,
3871
3871
  ri as layering,
3872
3872
  ii as loadables,