textmode.js 0.7.0 → 0.7.1-beta.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 Qt = Object.defineProperty;
2
- var Kt = (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) => Kt(n, typeof t != "symbol" ? t + "" : t, e);
4
- class U extends Error {
1
+ var jt = Object.defineProperty;
2
+ var Vt = (n, t, e) => t in n ? jt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var a = (n, t, e) => Vt(n, typeof t != "symbol" ? t + "" : t, e);
4
+ class S extends Error {
5
5
  constructor(t, e = {}) {
6
- super(U.i(t, e)), this.name = "TextmodeError";
6
+ super(S.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}: ${U.h(s)}`).join("") : ""}
12
+ - ${i}: ${S.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) => U.h(e)).join(", ")}]` : `[${t.slice(0, 3).map((e) => U.h(e)).join(", ")}, ... +${t.length - 3} more]`;
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]`;
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}: ${U.h(t[i])}`).join(", ")} }` : `{ ${e.slice(0, 2).map((i) => `${i}: ${U.h(t[i])}`).join(", ")}, ... +${e.length - 2} more }`;
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 }`;
26
26
  }
27
27
  return t + "";
28
28
  }
29
29
  }
30
- var qt = ((n) => (n[n.SILENT = 0] = "SILENT", n[n.WARNING = 1] = "WARNING", n[n.ERROR = 2] = "ERROR", n[n.THROW = 3] = "THROW", n))(qt || {});
31
- const B = class B {
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 O = class O {
32
32
  constructor() {
33
33
  a(this, "l", { globalLevel: 3 });
34
34
  }
35
35
  static u() {
36
- return B.o || (B.o = new B()), B.o;
36
+ return O.o || (O.o = new O()), O.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 B = class B {
41
41
  case 0:
42
42
  return !1;
43
43
  case 1:
44
- return console.group(i, s), console.warn(U.i(t, e)), console.groupEnd(), !1;
44
+ return console.group(i, s), console.warn(S.i(t, e)), console.groupEnd(), !1;
45
45
  case 2:
46
- return console.group(i, s), console.error(U.i(t, e)), console.groupEnd(), !1;
46
+ return console.group(i, s), console.error(S.i(t, e)), console.groupEnd(), !1;
47
47
  default:
48
- throw new U(t, e);
48
+ throw new S(t, e);
49
49
  }
50
50
  }
51
51
  m(t, e, i) {
@@ -55,10 +55,10 @@ const B = class B {
55
55
  this.l.globalLevel = t;
56
56
  }
57
57
  };
58
- a(B, "o", null);
59
- let lt = B;
60
- const mt = lt.u();
61
- class W {
58
+ a(O, "o", null);
59
+ let lt = O;
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 W {
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 W) {
119
119
  const u = this.H(t);
120
120
  return o.uniform1i(i, u), o.activeTexture(o.TEXTURE0 + u), void o.bindTexture(o.TEXTURE_2D, e.textures[0]);
121
121
  }
@@ -149,13 +149,13 @@ function Et(n, t, e, i) {
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 B(n, t, e) {
153
153
  return Math.min(Math.max(n, t), e);
154
154
  }
155
155
  function Tt(n) {
156
156
  return (n % 360 + 360) % 360 / 360;
157
157
  }
158
- function Ct(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) {
@@ -164,7 +164,7 @@ function et(n, t, e, i, s) {
164
164
  function ut(n, t, e, i, s, r = 0, h = WebGL2RenderingContext.FLOAT, o = !1) {
165
165
  n.enableVertexAttribArray(t), n.vertexAttribPointer(t, e, h, o, i, s), n.vertexAttribDivisor(t, r);
166
166
  }
167
- function Rt(n, t, e, i, s) {
167
+ function Ft(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
@@ -175,33 +175,33 @@ in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in
175
175
  a(this, "l");
176
176
  a(this, "A");
177
177
  a(this, "Y");
178
- a(this, "j", []);
179
- a(this, "K", null);
180
- a(this, "W");
178
+ a(this, "W", []);
179
+ a(this, "j", null);
180
+ a(this, "K");
181
181
  a(this, "Z");
182
182
  a(this, "q", null);
183
183
  a(this, "V", /* @__PURE__ */ new Map());
184
- this.N = e, this.X = i, this.A = t, this.W = 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 W(t, it, `#version 300 es
185
- precision highp float;in vec2 v_uv;uniform sampler2D Uc;uniform sampler2D Ud;uniform sampler2D Ue;uniform sampler2D Uf;uniform vec2 Ug;uniform bool Uh;uniform bool Ui;uniform bool Uj;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*Ug;vec2 D=(floor(C)+0.5f)/Ug;vec4 E=texture(Uc,D);vec4 F=Uh?texture(Ud,D):vec4(0.);if(Uh&&F.a==0.){discard;}vec4 G=Ui?texture(Ue,D):vec4(0.);vec4 H=Uj?texture(Uf,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 = B(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 H(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;}`));
186
186
  const o = t.getParameter(t.MAX_DRAW_BUFFERS), c = t.getParameter(t.MAX_COLOR_ATTACHMENTS);
187
- this.W = Math.min(this.W, o, c), this.Y = t.createFramebuffer(), this.tt(), this.st(), this.l.depth && this.it();
187
+ this.K = Math.min(this.K, o, c), this.Y = t.createFramebuffer(), this.tt(), this.st(), this.l.depth && this.it();
188
188
  }
189
189
  tt() {
190
190
  const t = this.A, e = this.l.filter === "linear" ? t.LINEAR : t.NEAREST, i = this.l.wrap === "repeat" ? t.REPEAT : t.CLAMP_TO_EDGE, s = this.l.type === "float" ? t.FLOAT : t.UNSIGNED_BYTE, r = s === t.FLOAT ? t.RGBA32F : t.RGBA8, h = t.RGBA;
191
- for (let o = 0; o < this.W; o++) {
191
+ for (let o = 0; o < this.K; o++) {
192
192
  const c = t.createTexture();
193
- t.bindTexture(t.TEXTURE_2D, c), et(t, e, e, i, i), t.texImage2D(t.TEXTURE_2D, 0, r, this.N, this.X, 0, h, s, null), this.j.push(c);
193
+ t.bindTexture(t.TEXTURE_2D, c), et(t, e, e, i, i), t.texImage2D(t.TEXTURE_2D, 0, r, this.N, this.X, 0, h, s, null), this.W.push(c);
194
194
  }
195
195
  t.bindTexture(t.TEXTURE_2D, null);
196
196
  }
197
197
  st() {
198
198
  const t = this.A;
199
- if (t.bindFramebuffer(t.FRAMEBUFFER, this.Y), this.W === 1) t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, this.j[0], 0);
199
+ if (t.bindFramebuffer(t.FRAMEBUFFER, this.Y), this.K === 1) t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, this.W[0], 0);
200
200
  else {
201
201
  const e = [];
202
- for (let i = 0; i < this.W; i++) {
202
+ for (let i = 0; i < this.K; i++) {
203
203
  const s = t.COLOR_ATTACHMENT0 + i;
204
- t.framebufferTexture2D(t.FRAMEBUFFER, s, t.TEXTURE_2D, this.j[i], 0), e.push(s);
204
+ t.framebufferTexture2D(t.FRAMEBUFFER, s, t.TEXTURE_2D, this.W[i], 0), e.push(s);
205
205
  }
206
206
  t.drawBuffers(e);
207
207
  }
@@ -209,16 +209,16 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uc;uniform sampler2D Ud;uni
209
209
  }
210
210
  it() {
211
211
  const t = this.A;
212
- this.K = t.createRenderbuffer(), t.bindRenderbuffer(t.RENDERBUFFER, this.K), t.renderbufferStorage(t.RENDERBUFFER, t.DEPTH_COMPONENT24, this.N, this.X), t.bindFramebuffer(t.FRAMEBUFFER, this.Y), t.framebufferRenderbuffer(t.FRAMEBUFFER, t.DEPTH_ATTACHMENT, t.RENDERBUFFER, this.K), t.bindFramebuffer(t.FRAMEBUFFER, null), t.bindRenderbuffer(t.RENDERBUFFER, null);
212
+ this.j = t.createRenderbuffer(), t.bindRenderbuffer(t.RENDERBUFFER, this.j), 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.j), t.bindFramebuffer(t.FRAMEBUFFER, null), t.bindRenderbuffer(t.RENDERBUFFER, null);
213
213
  }
214
214
  et(t) {
215
- Ct(this.A, this.j[0], t);
215
+ Rt(this.A, this.W[0], t);
216
216
  }
217
217
  resize(t, e) {
218
218
  this.N = t, this.X = e, this.V.clear();
219
219
  const i = this.A, s = this.l.type === "float" ? i.FLOAT : i.UNSIGNED_BYTE, r = s === i.FLOAT ? i.RGBA32F : i.RGBA8, h = i.RGBA;
220
- for (const o of this.j) i.bindTexture(i.TEXTURE_2D, o), i.texImage2D(i.TEXTURE_2D, 0, r, this.N, this.X, 0, h, s, null);
221
- i.bindTexture(i.TEXTURE_2D, null), this.K && (i.bindRenderbuffer(i.RENDERBUFFER, this.K), i.renderbufferStorage(i.RENDERBUFFER, i.DEPTH_COMPONENT24, this.N, this.X), i.bindRenderbuffer(i.RENDERBUFFER, null));
220
+ for (const o of this.W) i.bindTexture(i.TEXTURE_2D, o), i.texImage2D(i.TEXTURE_2D, 0, r, this.N, this.X, 0, h, s, null);
221
+ i.bindTexture(i.TEXTURE_2D, null), this.j && (i.bindRenderbuffer(i.RENDERBUFFER, this.j), i.renderbufferStorage(i.RENDERBUFFER, i.DEPTH_COMPONENT24, this.N, this.X), i.bindRenderbuffer(i.RENDERBUFFER, null));
222
222
  }
223
223
  readPixels(t) {
224
224
  const e = this.V.get(t);
@@ -227,14 +227,14 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uc;uniform sampler2D Ud;uni
227
227
  i.bindFramebuffer(i.READ_FRAMEBUFFER, this.Y), i.readBuffer(i.COLOR_ATTACHMENT0 + t), i.readPixels(0, 0, s, r, i.RGBA, i.UNSIGNED_BYTE, h), i.bindFramebuffer(i.READ_FRAMEBUFFER, o);
228
228
  const c = 4 * s, l = new Uint8Array(h.length);
229
229
  for (let u = 0; u < r; u++) {
230
- const f = (r - 1 - u) * c, g = u * c;
231
- l.set(h.subarray(f, f + c), g);
230
+ const f = (r - 1 - u) * c, d = u * c;
231
+ l.set(h.subarray(f, f + c), d);
232
232
  }
233
233
  return this.V.set(t, l), l;
234
234
  }
235
235
  begin() {
236
236
  const t = this.A;
237
- this.V.clear(), this.Z.rt(), this.Z.nt(this.Y, this.N, this.X, this.W), this.l.depth && t.clear(t.DEPTH_BUFFER_BIT), this.Z.state.ht();
237
+ this.V.clear(), this.Z.rt(), this.Z.nt(this.Y, this.N, this.X, this.K), this.l.depth && t.clear(t.DEPTH_BUFFER_BIT), this.Z.state.ht();
238
238
  }
239
239
  end() {
240
240
  this.Z.state.ot(), this.Z.ct(), this.Z.lt();
@@ -244,14 +244,14 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uc;uniform sampler2D Ud;uni
244
244
  }
245
245
  ft() {
246
246
  if (!this.Z) return;
247
- const t = this.W > 1, e = this.W > 2, i = this.W > 3, s = { Uc: this.j[0], Ud: t ? this.j[1] : this.j[0], Ue: e ? this.j[2] : this.j[0], Uf: i ? this.j[3] : this.j[0], Ug: [this.N, this.X], Uh: t, Ui: e, Uj: i }, r = X.J;
247
+ const t = this.K > 1, e = this.K > 2, i = this.K > 3, s = { U1: this.W[0], U2: t ? this.W[1] : this.W[0], U3: e ? this.W[2] : this.W[0], U4: i ? this.W[3] : this.W[0], U5: [this.N, this.X], U6: t, U7: e, U8: i }, r = X.J;
248
248
  this.q = this.Z.vt.dt(r, s, !0);
249
249
  }
250
250
  gt() {
251
251
  const t = this.A;
252
252
  t.deleteFramebuffer(this.Y);
253
- for (const e of this.j) t.deleteTexture(e);
254
- this.K && t.deleteRenderbuffer(this.K);
253
+ for (const e of this.W) t.deleteTexture(e);
254
+ this.j && t.deleteRenderbuffer(this.j);
255
255
  }
256
256
  get width() {
257
257
  return this.N;
@@ -260,20 +260,20 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uc;uniform sampler2D Ud;uni
260
260
  return this.X;
261
261
  }
262
262
  get textures() {
263
- return this.j;
263
+ return this.W;
264
264
  }
265
265
  get attachmentCount() {
266
- return this.W;
266
+ return this.K;
267
267
  }
268
268
  };
269
269
  a(X, "J", null);
270
- let H = X;
271
- const Ft = /* @__PURE__ */ new WeakMap();
270
+ let W = X;
271
+ const Pt = /* @__PURE__ */ new WeakMap();
272
272
  function nt(n, t) {
273
- Ft.set(n, t);
273
+ Pt.set(n, t);
274
274
  }
275
- function Pt(n) {
276
- return Ft.get(n);
275
+ function Ct(n) {
276
+ return Pt.get(n);
277
277
  }
278
278
  function tt(n, t, e, i, s = 255) {
279
279
  n[0] = t / 255, n[1] = (e ?? t) / 255, n[2] = (i ?? t) / 255, n[3] = s / 255;
@@ -302,22 +302,22 @@ class st {
302
302
  static Lt() {
303
303
  return { Ot: 1, It: 0, Bt: 0, Ht: 0, bt: 0, Ct: 0, xt: 0, Et: 0, Gt: !1, Qt: !1, Rt: !1, kt: !1, Nt: [0, 0, 0], Xt: [1, 1, 1, 1], Yt: [0, 0, 0, 1] };
304
304
  }
305
- jt(t) {
305
+ Wt(t) {
306
306
  t.Ot = this._t, t.It = this.yt, t.Bt = this.At, t.Ht = this.wt, t.bt = this.bt, t.Ct = this.Ct, t.xt = this.xt, t.Gt = this.$t, t.Qt = this.Tt, t.Rt = this.Rt, t.Et = this.Et, t.kt = this.kt, t.Nt[0] = this.Mt[0], t.Nt[1] = this.Mt[1], t.Nt[2] = this.Mt[2], t.Xt[0] = this.Ft[0], t.Xt[1] = this.Ft[1], t.Xt[2] = this.Ft[2], t.Xt[3] = this.Ft[3], t.Yt[0] = this.Pt[0], t.Yt[1] = this.Pt[1], t.Yt[2] = this.Pt[2], t.Yt[3] = this.Pt[3];
307
307
  }
308
- Kt(t) {
308
+ jt(t) {
309
309
  this._t = t.Ot, this.yt = t.It, this.At = t.Bt, this.wt = t.Ht, this.bt = t.bt, this.Ct = t.Ct, this.xt = t.xt, this.$t = t.Gt, this.Tt = t.Qt, this.Rt = t.Rt, this.Et = t.Et, this.kt = t.kt, this.Mt[0] = t.Nt[0], this.Mt[1] = t.Nt[1], this.Mt[2] = t.Nt[2], this.Ft[0] = t.Xt[0], this.Ft[1] = t.Xt[1], this.Ft[2] = t.Xt[2], this.Ft[3] = t.Xt[3], this.Pt[0] = t.Yt[0], this.Pt[1] = t.Yt[1], this.Pt[2] = t.Yt[2], this.Pt[3] = t.Yt[3];
310
310
  }
311
311
  ht() {
312
312
  let t = this.Dt.pop();
313
- t || (t = st.Lt()), this.jt(t), this.zt.push(t);
313
+ t || (t = st.Lt()), this.Wt(t), this.zt.push(t);
314
314
  }
315
315
  ot() {
316
316
  const t = this.zt.pop();
317
- t ? (this.Kt(t), this.Dt.push(t)) : console.warn("pop() called without matching push()");
317
+ t ? (this.jt(t), this.Dt.push(t)) : console.warn("pop() called without matching push()");
318
318
  }
319
- Wt(t) {
320
- this.jt(t);
319
+ Kt(t) {
320
+ this.Wt(t);
321
321
  }
322
322
  Zt(t) {
323
323
  this._t = Math.abs(t);
@@ -390,7 +390,7 @@ class st {
390
390
  }
391
391
  }
392
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, ws: { bs: { size: 2, offset: 0 }, Cs: { size: 2, offset: 8 } } };
393
- class Jt {
393
+ class $t {
394
394
  constructor(t) {
395
395
  a(this, "A");
396
396
  a(this, "Ms");
@@ -398,20 +398,20 @@ class Jt {
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, g = 1 - e / c * 2, m = ft, d = this.Fs;
402
- for (let v = 0; v < m.length; v += 4) {
403
- const A = m[v], p = m[v + 1], y = m[v + 2], E = m[v + 3], x = l + (A + 0.5) * (u - l), w = f + (p + 0.5) * (g - f);
404
- d[v] = x, d[v + 1] = w, d[v + 2] = y, d[v + 3] = E;
401
+ const r = this.A, h = Ct(this.A), o = h[2], c = h[3], l = t / o * 2 - 1, u = (t + i) / o * 2 - 1, f = 1 - (e + s) / c * 2, d = 1 - e / c * 2, g = 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], x = l + (A + 0.5) * (u - l), b = f + (p + 0.5) * (d - f);
404
+ m[v] = x, m[v + 1] = b, m[v + 2] = y, m[v + 3] = E;
405
405
  }
406
- r.bindBuffer(r.ARRAY_BUFFER, this.Ms), r.bufferData(r.ARRAY_BUFFER, d, 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 b = ((n) => (n.RECTANGLE = "rectangle", n.LINE = "line", n.ELLIPSE = "ellipse", n.ARC = "arc", n.TRIANGLE = "triangle", n.BEZIER_CURVE = "bezier_curve", n))(b || {});
413
- const $t = { rectangle: 2, line: 2, ellipse: 2, triangle: 2, arc: 3, bezier_curve: 4 };
414
- class te {
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
+ const te = { rectangle: 2, line: 2, ellipse: 2, triangle: 2, arc: 3, bezier_curve: 4 };
414
+ class ee {
415
415
  constructor(t) {
416
416
  a(this, "A");
417
417
  a(this, "$s", /* @__PURE__ */ new Map());
@@ -438,77 +438,77 @@ class te {
438
438
  for (const [, t] of this.$s) for (const [, e] of t) e && this.A.deleteVertexArray(e);
439
439
  }
440
440
  }
441
- const Z = class Z {
441
+ const D = class D {
442
442
  static Es(t, e, i = 0) {
443
- const s = e || new Float32Array(Z.FLOATS_PER_INSTANCE);
443
+ const s = e || new Float32Array(D.FLOATS_PER_INSTANCE);
444
444
  let r = i;
445
445
  s[r++] = t.bs[0], s[r++] = t.bs[1], s[r++] = t.Ss[0], s[r++] = t.Ss[1], s[r++] = t.Nt[0], s[r++] = t.Nt[1], s[r++] = t.Nt[2], s[r++] = t.Xt[0], s[r++] = t.Xt[1], s[r++] = t.Xt[2], s[r++] = t.Xt[3], s[r++] = t.Yt[0], s[r++] = t.Yt[1], s[r++] = t.Yt[2], s[r++] = t.Yt[3], s[r++] = t.ks[0], s[r++] = t.ks[1], s[r++] = t.ks[2], s[r++] = t.Et;
446
446
  const h = t.zs;
447
447
  s[r++] = (h == null ? void 0 : h[0]) ?? 0, s[r++] = (h == null ? void 0 : h[1]) ?? 0, s[r++] = (h == null ? void 0 : h[2]) ?? 0;
448
448
  const o = t.Ds;
449
449
  s[r++] = (o == null ? void 0 : o[0]) ?? 0, s[r++] = (o == null ? void 0 : o[1]) ?? 0, s[r++] = (o == null ? void 0 : o[2]) ?? 0;
450
- const c = t.Ls, l = t.Os, u = t.Is, f = t.Bs, g = t.Hs, m = !(!l || !u);
451
- return m ? (s[r++] = (f == null ? void 0 : f[0]) ?? 0, s[r++] = (f == null ? void 0 : f[1]) ?? 0, s[r++] = (g == null ? void 0 : g[0]) ?? 0, s[r++] = (g == null ? void 0 : g[1]) ?? 0, s[r++] = l[0], s[r++] = l[1], s[r++] = u[0], s[r++] = u[1]) : !m && !!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;
450
+ const c = t.Ls, l = t.Os, u = t.Is, f = t.Bs, d = t.Hs, g = !(!l || !u);
451
+ return g ? (s[r++] = (f == null ? void 0 : f[0]) ?? 0, s[r++] = (f == null ? void 0 : f[1]) ?? 0, s[r++] = (d == null ? void 0 : d[0]) ?? 0, s[r++] = (d == null ? void 0 : d[1]) ?? 0, s[r++] = l[0], s[r++] = l[1], s[r++] = u[0], s[r++] = u[1]) : !g && !!c ? (s[r++] = c[0], s[r++] = c[1], s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0) : (s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0), s[r++] = t.Gs ?? 0, s[r++] = t.Qs ?? 0, s[r++] = t.Ns ?? 0, s;
452
452
  }
453
453
  static Xs(t, e) {
454
- const i = t.length * Z.FLOATS_PER_INSTANCE, s = e || new Float32Array(i);
454
+ const i = t.length * D.FLOATS_PER_INSTANCE, s = e || new Float32Array(i);
455
455
  for (let r = 0; r < t.length; r++) {
456
- const h = r * Z.FLOATS_PER_INSTANCE;
457
- Z.Es(t[r], s, h);
456
+ const h = r * D.FLOATS_PER_INSTANCE;
457
+ D.Es(t[r], s, h);
458
458
  }
459
459
  return s;
460
460
  }
461
461
  };
462
- a(Z, "BYTES_PER_INSTANCE", 144), a(Z, "FLOATS_PER_INSTANCE", 36);
463
- let L = Z;
464
- const P = class P {
462
+ a(D, "BYTES_PER_INSTANCE", 144), a(D, "FLOATS_PER_INSTANCE", 36);
463
+ let L = D;
464
+ const C = class C {
465
465
  };
466
- a(P, "STRIDE", L.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
- class ee {
466
+ a(C, "STRIDE", L.BYTES_PER_INSTANCE), a(C, "ATTRIBUTES", { A2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 0, divisor: 1 }, A3: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 8, divisor: 1 }, A4: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 16, divisor: 1 }, A5: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 28, divisor: 1 }, A6: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 44, divisor: 1 }, A7: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 60, divisor: 1 }, A8: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 76, divisor: 1 }, A9: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 88, divisor: 1 }, Aa: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 100, divisor: 1 }, Ab: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 116, divisor: 1 }, Ac: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 132, divisor: 1 } });
467
+ let k = C;
468
+ class ie {
469
469
  constructor(t = 1e3, e = 1.5) {
470
470
  a(this, "Ys");
471
+ a(this, "Ws");
471
472
  a(this, "js");
472
- a(this, "Ks");
473
- a(this, "Ws", 0);
473
+ a(this, "Ks", 0);
474
474
  a(this, "Zs", 0);
475
- this.js = t, this.Ks = e;
475
+ this.Ws = t, this.js = e;
476
476
  const i = t * L.FLOATS_PER_INSTANCE;
477
477
  this.Ys = new Float32Array(i);
478
478
  }
479
479
  qs(t) {
480
- if (t <= this.js) return;
481
- const e = Math.ceil(t * this.Ks), i = this.js;
482
- this.js = e;
480
+ if (t <= this.Ws) return;
481
+ const e = Math.ceil(t * this.js), i = this.Ws;
482
+ this.Ws = e;
483
483
  const s = e * L.FLOATS_PER_INSTANCE, r = new Float32Array(s), h = i * L.FLOATS_PER_INSTANCE;
484
- r.set(this.Ys.subarray(0, Math.min(h, this.Ws))), this.Ys = r;
484
+ r.set(this.Ys.subarray(0, Math.min(h, this.Ks))), this.Ys = r;
485
485
  }
486
486
  Vs() {
487
- return { buffer: this.Ys, offset: this.Ws };
487
+ return { buffer: this.Ys, offset: this.Ks };
488
488
  }
489
489
  Js(t) {
490
- this.Ws += t, this.Zs++;
490
+ this.Ks += t, this.Zs++;
491
491
  }
492
492
  ti() {
493
- this.Ws = 0, this.Zs = 0;
493
+ this.Ks = 0, this.Zs = 0;
494
494
  }
495
495
  si(t = 0, e) {
496
- return this.Ys.subarray(t, e ?? this.Ws);
496
+ return this.Ys.subarray(t, e ?? this.Ks);
497
497
  }
498
498
  get ii() {
499
499
  return this.Zs;
500
500
  }
501
501
  get ei() {
502
- return this.js;
502
+ return this.Ws;
503
503
  }
504
504
  get ri() {
505
- return this.Ws;
505
+ return this.Ks;
506
506
  }
507
507
  get ni() {
508
508
  return this.Zs === 0;
509
509
  }
510
510
  }
511
- class ie {
511
+ class se {
512
512
  constructor(t) {
513
513
  a(this, "Ys");
514
514
  this.Ys = t;
@@ -524,7 +524,7 @@ class ie {
524
524
  return this.Ys.ii;
525
525
  }
526
526
  }
527
- class se {
527
+ class re {
528
528
  constructor(t, e = 1e3) {
529
529
  a(this, "A");
530
530
  a(this, "oi", null);
@@ -536,7 +536,7 @@ class se {
536
536
  const e = this.A;
537
537
  this.oi && e.deleteBuffer(this.oi), this.oi = e.createBuffer();
538
538
  const i = t * L.BYTES_PER_INSTANCE;
539
- Rt(e, e.ARRAY_BUFFER, this.oi, i, e.DYNAMIC_DRAW), this.ai = t;
539
+ Ft(e, e.ARRAY_BUFFER, this.oi, i, e.DYNAMIC_DRAW), this.ai = t;
540
540
  }
541
541
  ui(t) {
542
542
  this.li(t);
@@ -580,18 +580,18 @@ class se {
580
580
  this.oi && (this.A.deleteBuffer(this.oi), this.oi = null), this.ci.clear();
581
581
  }
582
582
  }
583
- class re {
583
+ class ne {
584
584
  constructor(t, e = 1e3, i = 1.5) {
585
585
  a(this, "A");
586
586
  a(this, "Ys");
587
587
  a(this, "mi");
588
588
  a(this, "_i");
589
- this.A = t, this.Ys = new ee(e, i), this.mi = new ie(this.Ys), this._i = new se(t, e);
589
+ this.A = t, this.Ys = new ie(e, i), this.mi = new se(this.Ys), this._i = new re(t, e);
590
590
  }
591
591
  yi(t) {
592
- var s, r, h, o, c, l, u, f, g, m;
592
+ var s, r, h, o, c, l, u, f, d, g;
593
593
  const e = [0, 0, 0, 0], i = [0, 0, 0, 0];
594
- return t.Os && t.Is ? (e[0] = ((s = t.Bs) == null ? void 0 : s[0]) ?? 0, e[1] = ((r = t.Bs) == null ? void 0 : r[1]) ?? 0, e[2] = ((h = t.Hs) == null ? void 0 : h[0]) ?? 0, e[3] = ((o = t.Hs) == null ? void 0 : o[1]) ?? 0, i[0] = t.Os[0], i[1] = t.Os[1], i[2] = t.Is[0], i[3] = t.Is[1]) : t.Ls && (e[0] = t.Ls[0], e[1] = t.Ls[1]), this.hi({ x: t.bs[0], y: t.bs[1], width: t.Ss[0], height: t.Ss[1], char0: t.Nt[0], char1: t.Nt[1], char2: t.Nt[2], r1: t.Xt[0], g1: t.Xt[1], b1: t.Xt[2], a1: t.Xt[3], r2: t.Yt[0], g2: t.Yt[1], b2: t.Yt[2], a2: t.Yt[3], invert: t.ks[0], flipX: t.ks[1], flipY: t.ks[2], charRot: t.Et, translationX: ((c = t.zs) == null ? void 0 : c[0]) ?? 0, translationY: ((l = t.zs) == null ? void 0 : l[1]) ?? 0, translationZ: ((u = t.zs) == null ? void 0 : u[2]) ?? 0, rotationX: ((f = t.Ds) == null ? void 0 : f[0]) ?? 0, rotationY: ((g = t.Ds) == null ? void 0 : g[1]) ?? 0, rotationZ: ((m = t.Ds) == null ? void 0 : m[2]) ?? 0, curveParams0: e, curveParams1: i, depth: t.Gs || 0, baseZ: t.Qs || 0, geometryType: t.Ns || 0 });
594
+ return t.Os && t.Is ? (e[0] = ((s = t.Bs) == null ? void 0 : s[0]) ?? 0, e[1] = ((r = t.Bs) == null ? void 0 : r[1]) ?? 0, e[2] = ((h = t.Hs) == null ? void 0 : h[0]) ?? 0, e[3] = ((o = t.Hs) == null ? void 0 : o[1]) ?? 0, i[0] = t.Os[0], i[1] = t.Os[1], i[2] = t.Is[0], i[3] = t.Is[1]) : t.Ls && (e[0] = t.Ls[0], e[1] = t.Ls[1]), this.hi({ x: t.bs[0], y: t.bs[1], width: t.Ss[0], height: t.Ss[1], char0: t.Nt[0], char1: t.Nt[1], char2: t.Nt[2], r1: t.Xt[0], g1: t.Xt[1], b1: t.Xt[2], a1: t.Xt[3], r2: t.Yt[0], g2: t.Yt[1], b2: t.Yt[2], a2: t.Yt[3], invert: t.ks[0], flipX: t.ks[1], flipY: t.ks[2], charRot: t.Et, translationX: ((c = t.zs) == null ? void 0 : c[0]) ?? 0, translationY: ((l = t.zs) == null ? void 0 : l[1]) ?? 0, translationZ: ((u = t.zs) == null ? void 0 : u[2]) ?? 0, rotationX: ((f = t.Ds) == null ? void 0 : f[0]) ?? 0, rotationY: ((d = t.Ds) == null ? void 0 : d[1]) ?? 0, rotationZ: ((g = t.Ds) == null ? void 0 : g[2]) ?? 0, curveParams0: e, curveParams1: i, depth: t.Gs || 0, baseZ: t.Qs || 0, geometryType: t.Ns || 0 });
595
595
  }
596
596
  hi(t) {
597
597
  const e = this.mi.hi(t);
@@ -632,7 +632,7 @@ class _ {
632
632
  a(this, "Mi", null);
633
633
  this.A = t, this.bi = e, this.Ci = i, this.xi = s;
634
634
  const r = this.A.createBuffer();
635
- Rt(this.A, this.A.ARRAY_BUFFER, r, this.xi.Fi, this.A.STATIC_DRAW), this.Mi = r;
635
+ Ft(this.A, this.A.ARRAY_BUFFER, r, this.xi.Fi, this.A.STATIC_DRAW), this.Mi = r;
636
636
  }
637
637
  get type() {
638
638
  return this.Ci;
@@ -659,21 +659,21 @@ class _ {
659
659
  return this.bi.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.bt ?? 0, f = r.Ct ?? 0, g = r.xt ?? 0, m = [0, 0, 0, 0], d = [0, 0, 0, 0];
663
- h && (h.bezStartX !== void 0 && h.bezStartY !== void 0 && h.bezEndX !== void 0 && h.bezEndY !== void 0 ? (m[0] = h.cp1x ?? 0, m[1] = h.cp1y ?? 0, m[2] = h.cp2x ?? 0, m[3] = h.cp2y ?? 0, d[0] = h.bezStartX ?? 0, d[1] = h.bezStartY ?? 0, d[2] = h.bezEndX ?? 0, d[3] = h.bezEndY ?? 0) : h.arcStart === void 0 && h.arcStop === void 0 || (m[0] = h.arcStart ?? 0, m[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: g, curveParams0: m, curveParams1: d, depth: (h == null ? void 0 : h.depth) ?? 0, baseZ: (h == null ? void 0 : h.baseZ) ?? 0, geometryType: $t[this.Ci] ?? 0 };
662
+ const o = r.It ?? 0, c = r.Bt ?? 0, l = r.Ht ?? 0, u = r.bt ?? 0, f = r.Ct ?? 0, d = r.xt ?? 0, g = [0, 0, 0, 0], 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
665
  return this.bi.hi(v);
666
666
  }
667
667
  }
668
- const ne = { Fi: ft, Ei: 6, ...Y }, he = { 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 }, oe = { 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
- const s = i * e, r = (i + 1) % n * e, h = Math.cos(s), o = Math.sin(s), c = 0.5 * (h + 1), l = 0.5 * (o + 1), u = Math.cos(r), f = Math.sin(r), g = 0.5 * (u + 1), m = 0.5 * (f + 1);
672
- t.push(0, 0, 0.5, 0.5, h, o, c, l, u, f, g, m);
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
+ 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
675
  }(32), Ei: 96, ...Y };
676
- let ae = { Fi: function(n) {
676
+ let ce = { Fi: function(n) {
677
677
  const t = [];
678
678
  for (let e = 0; e < n; e++) {
679
679
  const i = e / n, s = (e + 1) / n;
@@ -681,67 +681,67 @@ let ae = { Fi: function(n) {
681
681
  }
682
682
  return new Float32Array(t);
683
683
  }(32), Ei: 96, ...Y };
684
- const ce = { Fi: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ei: 3, ...Y }, le = { Fi: function(n = 16) {
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, ...Y }, ue = { [b.RECTANGLE]: class extends _ {
691
+ }(16), Ei: 96, ...Y }, fe = { [w.RECTANGLE]: class extends _ {
692
692
  constructor(n, t) {
693
- super(n, t, b.RECTANGLE, ne);
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
- }, [b.LINE]: class extends _ {
698
+ }, [w.LINE]: class extends _ {
699
699
  constructor(n, t) {
700
- super(n, t, b.LINE, he);
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
- }, [b.ELLIPSE]: class extends _ {
706
+ }, [w.ELLIPSE]: class extends _ {
707
707
  constructor(n, t) {
708
- super(n, t, b.ELLIPSE, oe);
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
- }, [b.ARC]: class extends _ {
713
+ }, [w.ARC]: class extends _ {
714
714
  constructor(n, t) {
715
- super(n, t, b.ARC, ae);
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
- }, [b.TRIANGLE]: class extends _ {
721
+ }, [w.TRIANGLE]: class extends _ {
722
722
  constructor(n, t) {
723
- super(n, t, b.TRIANGLE, ce);
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
- }, [b.BEZIER_CURVE]: class extends _ {
729
+ }, [w.BEZIER_CURVE]: class extends _ {
730
730
  constructor(n, t) {
731
- super(n, t, b.BEZIER_CURVE, le);
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 });
735
735
  }
736
736
  } };
737
- class fe {
737
+ class de {
738
738
  constructor(t) {
739
739
  a(this, "A");
740
740
  a(this, "Si");
741
741
  a(this, "ki");
742
- this.A = t, this.ki = new te(t), this.Si = /* @__PURE__ */ new Map();
743
- for (const e of Object.values(b)) {
744
- const i = new re(t), s = new ue[e](t, i);
742
+ this.A = t, this.ki = new ee(t), this.Si = /* @__PURE__ */ new Map();
743
+ for (const e of Object.values(w)) {
744
+ const i = new ne(t), s = new fe[e](t, i);
745
745
  this.Si.set(e, s);
746
746
  }
747
747
  }
@@ -758,8 +758,8 @@ class fe {
758
758
  Li(t) {
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
- const h = Pt(this.A), o = s.length > 0 && s[0].state.kt;
762
- e.shader.O({ Uw: h[2] / h[3], U9: [h[2], h[3]], Ua: 1, Ub: o ? 1 : 0 }), r.Pi();
761
+ const h = Ct(this.A), o = s.length > 0 && s[0].state.kt;
762
+ e.shader.O({ Uz: h[2] / h[3], U9: [h[2], h[3]], Ua: 1, Ub: 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;
@@ -782,23 +782,23 @@ function Mt(n) {
782
782
  return t;
783
783
  }
784
784
  const yt = /* @__PURE__ */ new WeakMap();
785
- let de = 1;
786
- function wt(n) {
785
+ let ge = 1;
786
+ function bt(n) {
787
787
  if (n == null) return 0;
788
788
  if (typeof n != "object" && typeof n != "function") return Mt(n + "");
789
789
  let t = yt.get(n);
790
- return t || (t = de++, yt.set(n, t)), t;
790
+ return t || (t = ge++, yt.set(n, t)), t;
791
791
  }
792
- function V(n, t) {
792
+ function G(n, t) {
793
793
  return (n << 5) - n + t;
794
794
  }
795
- class ge {
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 W(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 = wt(t.G), s = function(r, h) {
817
+ const i = bt(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 = V(o, Mt(l)), o = V(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 V(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,14 +828,14 @@ 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 = V(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 = V(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 ? wt(t) : 0;
838
+ }(t) : t instanceof WebGLTexture ? bt(t) : 0;
839
839
  }
840
840
  gt() {
841
841
  this.Ii != this.Ii && this.Ii.dispose(), this.Ii.dispose(), this.Hi.clear();
@@ -844,40 +844,40 @@ precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellCo
844
844
  class me {
845
845
  constructor() {
846
846
  a(this, "Yi", []);
847
- a(this, "ji", 1);
847
+ a(this, "Wi", 1);
848
848
  a(this, "Ss", 0);
849
849
  }
850
- Ki(t, e) {
850
+ ji(t, e) {
851
851
  if (this.Ss >= this.Yi.length) {
852
- const s = { id: this.ji++, type: t, params: {}, state: st.Lt(), material: e };
852
+ const s = { id: this.Wi++, type: t, params: {}, state: st.Lt(), material: e };
853
853
  this.Yi.push(s);
854
854
  }
855
855
  const i = this.Yi[this.Ss];
856
- return i.id = this.ji++, i.type = t, i.material = e, this.Ss++, i;
856
+ return i.id = this.Wi++, i.type = t, i.material = e, this.Ss++, i;
857
857
  }
858
- Wi(t, e, i) {
859
- const s = this.Ki(b.RECTANGLE, i), r = s.params;
860
- return r.width = t.width, r.height = t.height, e.Wt(s.state), s.id;
858
+ Ki(t, e, i) {
859
+ const s = this.ji(w.RECTANGLE, i), r = s.params;
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.Ki(b.LINE, i), r = s.params;
864
- return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, e.Wt(s.state), s.id;
863
+ const s = this.ji(w.LINE, i), r = s.params;
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.Ki(b.ELLIPSE, i), r = s.params;
868
- return r.width = t.width, r.height = t.height, r.startAngle = t.startAngle, r.endAngle = t.endAngle, r.segments = t.segments, e.Wt(s.state), s.id;
867
+ const s = this.ji(w.ELLIPSE, i), r = s.params;
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.Ki(b.ARC, i), r = s.params;
872
- return r.width = t.width, r.height = t.height, r.start = t.start, r.stop = t.stop, e.Wt(s.state), s.id;
871
+ const s = this.ji(w.ARC, i), r = s.params;
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.Ki(b.TRIANGLE, i), r = s.params;
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.Wt(s.state), s.id;
875
+ const s = this.ji(w.TRIANGLE, i), r = s.params;
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.Ki(b.BEZIER_CURVE, i), r = s.params;
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.Wt(s.state), s.id;
879
+ const s = this.ji(w.BEZIER_CURVE, i), r = s.params;
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
  wi() {
883
883
  this.Ss = 0;
@@ -888,7 +888,7 @@ class me {
888
888
  return { next: () => t < e ? { value: i[t++], done: !1 } : { value: void 0, done: !0 } };
889
889
  }
890
890
  }
891
- class ve {
891
+ class pe {
892
892
  constructor(t) {
893
893
  a(this, "A");
894
894
  a(this, "se", null);
@@ -905,7 +905,7 @@ class ve {
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 ge(t), this.re = new me(), this.ie = new fe(t), this.ne = new Jt(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 ve {
926
926
  this.se !== t && (this.se = t, t.D());
927
927
  }
928
928
  pe(t, e) {
929
- return new W(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,10 +938,10 @@ class ve {
938
938
  Object.assign(this.oe, t);
939
939
  }
940
940
  _e(t) {
941
- return new W(this.A, it, t);
941
+ return new H(this.A, it, t);
942
942
  }
943
943
  ye(t, e, i) {
944
- this.re.Wi({ width: e ?? t.width, height: i ?? t.height }, this.ee, t.ut());
944
+ this.re.Ki({ width: e ?? t.width, height: i ?? t.height }, this.ee, t.ut());
945
945
  }
946
946
  Ae(t, e, i, s) {
947
947
  this.ne.Ps(t, e, i, s);
@@ -949,8 +949,8 @@ class ve {
949
949
  we(t, e) {
950
950
  if (this.he) {
951
951
  const i = this.vt.Ni(this.he, this.oe);
952
- this.re.Wi({ width: t, height: e }, this.ee, i), this.he = null, this.oe = {};
953
- } else this.re.Wi({ width: t, height: e }, this.ee, this.vt.Qi);
952
+ this.re.Ki({ width: t, height: e }, this.ee, i), this.he = null, this.oe = {};
953
+ } else this.re.Ki({ width: t, height: e }, this.ee, this.vt.Qi);
954
954
  }
955
955
  be(t, e, i, s) {
956
956
  this.re.Zi({ x1: t, y1: e, x2: i, y2: s }, this.ee, this.vt.Qi);
@@ -968,7 +968,7 @@ class ve {
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 W(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);
@@ -1007,13 +1007,13 @@ class ve {
1007
1007
  return this.vt;
1008
1008
  }
1009
1009
  }
1010
- const C = { readShort: (n, t) => (C.t.uint16[0] = n[t] << 8 | n[t + 1], C.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(C.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 = C.t.uint8;
1016
- return e[3] = n[t], e[2] = n[t + 1], e[1] = n[t + 2], e[0] = n[t + 3], C.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,26 +1022,26 @@ const C = { readShort: (n, t) => (C.t.uint16[0] = n[t] << 8 | n[t + 1], C.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 q(n) {
1025
+ function V(n) {
1026
1026
  return n + 3 & -4;
1027
1027
  }
1028
1028
  function J(n, t, e) {
1029
1029
  n[t] = e >>> 8 & 255, n[t + 1] = 255 & e;
1030
1030
  }
1031
- function D(n, t, e) {
1031
+ function N(n, t, e) {
1032
1032
  n[t] = e >>> 24 & 255, n[t + 1] = e >>> 16 & 255, n[t + 2] = e >>> 8 & 255, n[t + 3] = 255 & e;
1033
1033
  }
1034
- function pe(n, t, e) {
1034
+ function Ae(n, t, e) {
1035
1035
  for (let i = 0; i < e.length; i++) n[t + i] = 255 & e.charCodeAt(i);
1036
1036
  }
1037
1037
  function ht(n, t, e) {
1038
1038
  const i = t + e;
1039
1039
  let s = 0;
1040
- const r = C.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 Ae {
1044
+ class Ee {
1045
1045
  constructor(t) {
1046
1046
  a(this, "b");
1047
1047
  a(this, "p", 0);
@@ -1064,7 +1064,7 @@ class Ae {
1064
1064
  return this.p;
1065
1065
  }
1066
1066
  }
1067
- function G(n) {
1067
+ function Q(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 G(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[Ee(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 Ee(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 ye(n) {
1104
+ function be(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");
@@ -1114,49 +1114,49 @@ function ye(n) {
1114
1114
  let f = 0;
1115
1115
  for (; !f; ) {
1116
1116
  f = r.readBits(1);
1117
- const g = r.readBits(2);
1118
- if (g === 0) {
1117
+ const d = r.readBits(2);
1118
+ if (d === 0) {
1119
1119
  r.alignToByte();
1120
- const m = r.readBits(16);
1121
- if ((65535 & (65535 ^ m)) !== r.readBits(16)) throw Error("DEFLATE uncompressed LEN/NLEN mismatch");
1122
- for (let d = 0; d < m; d++) h.push(r.readBits(8));
1120
+ const g = r.readBits(16);
1121
+ if ((65535 & (65535 ^ g)) !== r.readBits(16)) throw Error("DEFLATE uncompressed LEN/NLEN mismatch");
1122
+ for (let m = 0; m < g; m++) h.push(r.readBits(8));
1123
1123
  } else {
1124
- if (g !== 1 && g !== 2) throw Error("Unsupported DEFLATE type");
1124
+ if (d !== 1 && d !== 2) throw Error("Unsupported DEFLATE type");
1125
1125
  {
1126
- let m, d;
1127
- if (g === 1) {
1126
+ let g, m;
1127
+ if (d === 1) {
1128
1128
  const v = Array(288).fill(0);
1129
1129
  for (let A = 0; A <= 143; A++) v[A] = 8;
1130
1130
  for (let A = 144; A <= 255; A++) v[A] = 9;
1131
1131
  for (let A = 256; A <= 279; A++) v[A] = 7;
1132
1132
  for (let A = 280; A <= 287; A++) v[A] = 8;
1133
- m = G(v), d = G(Array(32).fill(5));
1133
+ g = Q(v), m = Q(Array(32).fill(5));
1134
1134
  } else {
1135
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
1136
  for (let T = 0; T < p; T++) E[y[T]] = r.readBits(3);
1137
- const x = G(E), w = [];
1138
- for (; w.length < v + A; ) {
1137
+ const x = Q(E), b = [];
1138
+ for (; b.length < v + A; ) {
1139
1139
  const T = ot(r, x);
1140
- if (T <= 15) w.push(T);
1140
+ if (T <= 15) b.push(T);
1141
1141
  else if (T === 16) {
1142
- const S = r.readBits(2) + 3, F = w[w.length - 1] || 0;
1143
- for (let K = 0; K < S; K++) w.push(F);
1142
+ const Z = r.readBits(2) + 3, P = b[b.length - 1] || 0;
1143
+ for (let j = 0; j < Z; j++) b.push(P);
1144
1144
  } else if (T === 17) {
1145
- const S = r.readBits(3) + 3;
1146
- for (let F = 0; F < S; F++) w.push(0);
1145
+ const Z = r.readBits(3) + 3;
1146
+ for (let P = 0; P < Z; P++) b.push(0);
1147
1147
  } else {
1148
1148
  if (T !== 18) throw Error("Invalid code length symbol");
1149
1149
  {
1150
- const S = r.readBits(7) + 11;
1151
- for (let F = 0; F < S; F++) w.push(0);
1150
+ const Z = r.readBits(7) + 11;
1151
+ for (let P = 0; P < Z; P++) b.push(0);
1152
1152
  }
1153
1153
  }
1154
1154
  }
1155
- const R = w.slice(0, v), N = w.slice(v, v + A);
1156
- m = G(R), d = G(N);
1155
+ const F = b.slice(0, v), U = b.slice(v, v + A);
1156
+ g = Q(F), m = Q(U);
1157
1157
  }
1158
1158
  for (; ; ) {
1159
- const v = ot(r, m);
1159
+ const v = ot(r, g);
1160
1160
  if (v < 256) h.push(v);
1161
1161
  else {
1162
1162
  if (v === 256) break;
@@ -1165,35 +1165,35 @@ function ye(n) {
1165
1165
  let p = o[A];
1166
1166
  const y = c[A];
1167
1167
  y && (p += r.readBits(y));
1168
- const E = ot(r, d);
1168
+ const E = ot(r, m);
1169
1169
  if (E >= 30) throw Error("Invalid distance symbol");
1170
1170
  let x = l[E];
1171
- const w = u[E];
1172
- w && (x += r.readBits(w));
1173
- const R = h.length - x;
1174
- if (R < 0) throw Error("Invalid distance");
1175
- for (let N = 0; N < p; N++) h.push(h[R + N] || 0);
1171
+ const b = u[E];
1172
+ b && (x += r.readBits(b));
1173
+ const F = h.length - x;
1174
+ if (F < 0) throw Error("Invalid distance");
1175
+ for (let U = 0; U < p; U++) h.push(h[F + U] || 0);
1176
1176
  } else if (v === 286 || v === 287) throw Error("Reserved length symbol");
1177
1177
  }
1178
1178
  }
1179
1179
  }
1180
1180
  }
1181
1181
  }
1182
- }(new Ae(n.subarray(i)), s), new Uint8Array(s);
1182
+ }(new Ee(n.subarray(i)), s), new Uint8Array(s);
1183
1183
  }
1184
1184
  function we(n) {
1185
- const t = C, e = new Uint8Array(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 y = t.readASCII(e, o, 4), E = t.readUint(e, o + 4), x = t.readUint(e, o + 8), w = t.readUint(e, o + 12), R = t.readUint(e, o + 16);
1191
- h.push({ tag: y, offset: E, compLength: x, origLength: w, checksum: R }), o += 20;
1190
+ const y = t.readASCII(e, o, 4), E = t.readUint(e, o + 4), x = t.readUint(e, o + 8), b = t.readUint(e, o + 12), F = t.readUint(e, o + 16);
1191
+ h.push({ tag: y, offset: E, compLength: x, origLength: b, checksum: F }), o += 20;
1192
1192
  }
1193
1193
  for (const p of h) {
1194
1194
  const y = new Uint8Array(e.buffer, p.offset, p.compLength);
1195
1195
  if (p.compLength === p.origLength) p.data = new Uint8Array(y);
1196
- else if (p.data = ye(y), p.data.length !== p.origLength) if (p.data.length < p.origLength) {
1196
+ else if (p.data = be(y), p.data.length !== p.origLength) if (p.data.length < p.origLength) {
1197
1197
  const E = new Uint8Array(p.origLength);
1198
1198
  E.set(p.data), p.data = E;
1199
1199
  } else p.data = p.data.subarray(0, p.origLength);
@@ -1201,42 +1201,42 @@ function we(n) {
1201
1201
  const c = s;
1202
1202
  let l = 1, u = 0;
1203
1203
  for (; l << 1 <= c; ) l <<= 1, u++;
1204
- const f = 16 * l, g = 16 * c - f;
1205
- let m = 12 + 16 * c;
1206
- const d = {};
1207
- for (const p of h) d[p.tag] = m, m = q(m + p.data.length);
1208
- const v = new Uint8Array(Math.max(r || 0, m));
1209
- D(v, 0, i), J(v, 4, c), J(v, 6, f), J(v, 8, u), J(v, 10, g);
1204
+ const f = 16 * l, d = 16 * c - f;
1205
+ let g = 12 + 16 * c;
1206
+ const m = {};
1207
+ for (const p of h) m[p.tag] = g, g = V(g + p.data.length);
1208
+ const v = new Uint8Array(Math.max(r || 0, g));
1209
+ N(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
- pe(v, A, p.tag), A += 4;
1212
+ Ae(v, A, p.tag), A += 4;
1213
1213
  let y = p.data;
1214
1214
  if (p.tag === "head" && y.length >= 12) {
1215
1215
  const E = new Uint8Array(y);
1216
- D(E, 8, 0), D(v, A, ht(E, 0, q(E.length))), A += 4;
1216
+ N(E, 8, 0), N(v, A, ht(E, 0, V(E.length))), A += 4;
1217
1217
  } else
1218
- D(v, A, ht(y, 0, q(y.length))), A += 4;
1219
- D(v, A, d[p.tag]), A += 4, D(v, A, p.data.length), A += 4;
1218
+ N(v, A, ht(y, 0, V(y.length))), A += 4;
1219
+ N(v, A, m[p.tag]), A += 4, N(v, A, p.data.length), A += 4;
1220
1220
  }
1221
1221
  for (const p of h) {
1222
- const y = d[p.tag];
1222
+ const y = m[p.tag];
1223
1223
  v.set(p.data, y);
1224
1224
  }
1225
1225
  if (h.find((p) => p.tag === "head")) {
1226
- const p = d.head, y = function(E, x) {
1227
- const w = x + 8, R = [E[w], E[w + 1], E[w + 2], E[w + 3]];
1228
- D(E, w, 0);
1229
- const N = 2981146554 - (ht(E, 0, q(E.length)) >>> 0) >>> 0;
1230
- return E[w] = R[0], E[w + 1] = R[1], E[w + 2] = R[2], E[w + 3] = R[3], N >>> 0;
1226
+ const p = m.head, y = function(E, x) {
1227
+ const b = x + 8, F = [E[b], E[b + 1], E[b + 2], E[b + 3]];
1228
+ N(E, b, 0);
1229
+ const U = 2981146554 - (ht(E, 0, V(E.length)) >>> 0) >>> 0;
1230
+ return E[b] = F[0], E[b + 1] = F[1], E[b + 2] = F[2], E[b + 3] = F[3], U >>> 0;
1231
1231
  }(v, p);
1232
- D(v, p + 8, y);
1232
+ N(v, p + 8, y);
1233
1233
  }
1234
1234
  return v.buffer;
1235
1235
  }
1236
- const be = { parseTab(n, t, e) {
1236
+ const xe = { 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 = C, 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++) {
@@ -1244,34 +1244,34 @@ const be = { parseTab(n, t, e) {
1244
1244
  t += 2;
1245
1245
  const f = s.readUint(n, t);
1246
1246
  t += 4;
1247
- const g = `p${l}e${u}`;
1248
- let m = o.indexOf(f);
1249
- if (m === -1) {
1250
- let d;
1251
- m = i.tables.length, o.push(f);
1247
+ const d = `p${l}e${u}`;
1248
+ let g = o.indexOf(f);
1249
+ if (g === -1) {
1250
+ let m;
1251
+ g = i.tables.length, o.push(f);
1252
1252
  const v = r(n, f);
1253
- d = v === 4 ? this.parse4(n, f) : v === 12 ? this.parse12(n, f) : { format: v }, i.tables.push(d);
1253
+ m = v === 4 ? this.parse4(n, f) : v === 12 ? this.parse12(n, f) : { format: v }, i.tables.push(m);
1254
1254
  }
1255
- i.ids[g] = m;
1255
+ i.ids[d] = g;
1256
1256
  }
1257
1257
  return i;
1258
1258
  }, parse4(n, t) {
1259
- const e = C, 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 = C.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
- } }, xe = { parseTab(n, t, e) {
1274
- const i = C;
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 be = { 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 = C;
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++) {
@@ -1292,17 +1292,17 @@ const be = { parseTab(n, t, e) {
1292
1292
  r[o] = c(n, t + 2 * h);
1293
1293
  }
1294
1294
  return r;
1295
- } }, Ce = { parseTab(n, t, e, i) {
1296
- const s = C, r = [], h = [], o = i.maxp.numGlyphs, c = i.hhea.numberOfHMetrics;
1295
+ } }, Fe = { parseTab(n, t, e, i) {
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
- } }, bt = { cmap: be, head: xe, hhea: Te, maxp: { parseTab(n, t, e) {
1302
- const i = C;
1301
+ } }, wt = { cmap: xe, 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
- } }, hmtx: Ce, loca: { parseTab(n, t, e, i) {
1305
- const s = C, r = [], h = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
1304
+ } }, hmtx: Fe, loca: { parseTab(n, t, e, i) {
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;
@@ -1311,49 +1311,49 @@ const be = { parseTab(n, t, e) {
1311
1311
  for (let h = 0; h < r; h++) s.push(null);
1312
1312
  return s;
1313
1313
  }, Ee(n, t) {
1314
- const e = C, i = n.Se, s = n.loca;
1314
+ const e = R, i = n.Se, s = n.loca;
1315
1315
  if (s[t] === s[t + 1]) return null;
1316
- const r = j.findTable(i, "glyf", n.ke);
1316
+ const r = q.findTable(i, "glyf", n.ke);
1317
1317
  if (!r) return null;
1318
1318
  let h = r[0] + s[t];
1319
1319
  const o = {};
1320
1320
  if (o.noc = e.readShort(i, h), h += 2, o.xMin = e.readShort(i, h), h += 2, o.yMin = e.readShort(i, h), h += 2, o.xMax = e.readShort(i, h), h += 2, o.yMax = e.readShort(i, h), h += 2, o.xMin >= o.xMax || o.yMin >= o.yMax) return null;
1321
1321
  if (o.noc > 0) {
1322
1322
  o.endPts = [];
1323
- for (let g = 0; g < o.noc; g++) o.endPts.push(e.readUshort(i, h)), h += 2;
1323
+ for (let d = 0; d < o.noc; d++) o.endPts.push(e.readUshort(i, h)), h += 2;
1324
1324
  const c = e.readUshort(i, h);
1325
1325
  if (h += 2, i.length - h < c) return null;
1326
1326
  h += c;
1327
1327
  const l = o.endPts[o.noc - 1] + 1;
1328
1328
  o.flags = [];
1329
- for (let g = 0; g < l; g++) {
1330
- const m = i[h];
1331
- if (h++, o.flags.push(m), 8 & m) {
1332
- const d = i[h];
1329
+ for (let d = 0; d < l; d++) {
1330
+ const g = i[h];
1331
+ if (h++, o.flags.push(g), 8 & g) {
1332
+ const m = i[h];
1333
1333
  h++;
1334
- for (let v = 0; v < d; v++) o.flags.push(m), g++;
1334
+ for (let v = 0; v < m; v++) o.flags.push(g), d++;
1335
1335
  }
1336
1336
  }
1337
1337
  o.xs = [];
1338
- for (let g = 0; g < l; g++) {
1339
- const m = o.flags[g], d = !!(16 & m);
1340
- 2 & m ? (o.xs.push(d ? i[h] : -i[h]), h++) : d ? o.xs.push(0) : (o.xs.push(e.readShort(i, h)), h += 2);
1338
+ for (let d = 0; d < l; d++) {
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
- for (let g = 0; g < l; g++) {
1344
- const m = o.flags[g], d = !!(32 & m);
1345
- 4 & m ? (o.ys.push(d ? i[h] : -i[h]), h++) : d ? o.ys.push(0) : (o.ys.push(e.readShort(i, h)), h += 2);
1343
+ for (let d = 0; d < l; d++) {
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
- for (let g = 0; g < l; g++) u += o.xs[g], f += o.ys[g], o.xs[g] = u, o.ys[g] = f;
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
- } } }, j = { parse(n) {
1351
+ } } }, q = { parse(n) {
1352
1352
  const t = new Uint8Array(n);
1353
- C.readASCII(t, 0, 4) === "wOFF" && (n = we(n));
1354
- const e = new Uint8Array(n), i = bt, s = {}, r = { Se: e, ze: 0, ke: 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 = j.findTable(e, o, 0);
1356
+ const o = h, c = q.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 be = { parseTab(n, t, e) {
1362
1362
  }
1363
1363
  return [r];
1364
1364
  }, findTable(n, t, e) {
1365
- const i = C, 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,8 +1372,8 @@ const be = { parseTab(n, t, e) {
1372
1372
  r += 16;
1373
1373
  }
1374
1374
  return null;
1375
- }, T: bt, B: C };
1376
- class Re {
1375
+ }, T: wt, B: R };
1376
+ class Pe {
1377
1377
  De(t) {
1378
1378
  var i;
1379
1379
  const e = [];
@@ -1429,7 +1429,7 @@ class Re {
1429
1429
  return 0;
1430
1430
  }
1431
1431
  }
1432
- class Fe {
1432
+ class Ce {
1433
1433
  constructor(t) {
1434
1434
  a(this, "Be");
1435
1435
  a(this, "He");
@@ -1450,7 +1450,7 @@ class Fe {
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, g = c * e.width, m = l * e.height, d = g + 0.5 * e.width, v = m + 0.5 * e.height, A = Math.round(d - 0.5 * e.width), p = Math.round(v - 0.5 * s), y = A + 0.5 * (e.width - f), E = p + r.hhea.ascender * 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
1454
  this.Xe(u, y, E, h);
1455
1455
  }
1456
1456
  }
@@ -1464,31 +1464,31 @@ class Fe {
1464
1464
  const f = o[u];
1465
1465
  if (!(f < l)) {
1466
1466
  if (f >= l) {
1467
- const g = e + r[l] * s, m = i - h[l] * s;
1468
- this.He.moveTo(g, m);
1469
- let d = l + 1;
1470
- for (; d <= f; )
1471
- if (1 & c[d]) {
1472
- const v = e + r[d] * s, A = i - h[d] * s;
1473
- this.He.lineTo(v, A), d++;
1467
+ const d = e + r[l] * s, g = i - h[l] * s;
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 v = e + r[d] * s, A = i - h[d] * s;
1476
- if (d + 1 > f) {
1475
+ const v = e + r[m] * s, A = i - h[m] * s;
1476
+ if (m + 1 > f) {
1477
1477
  const y = e + r[l] * s, E = i - h[l] * s;
1478
1478
  if (1 & c[l]) this.He.quadraticCurveTo(v, A, y, E);
1479
1479
  else {
1480
- const x = (v + y) / 2, w = (A + E) / 2;
1481
- this.He.quadraticCurveTo(v, A, x, w);
1480
+ const x = (v + y) / 2, b = (A + E) / 2;
1481
+ this.He.quadraticCurveTo(v, A, x, b);
1482
1482
  }
1483
1483
  break;
1484
1484
  }
1485
- const p = d + 1;
1485
+ const p = m + 1;
1486
1486
  if (1 & c[p]) {
1487
1487
  const y = e + r[p] * s, E = i - h[p] * s;
1488
- this.He.quadraticCurveTo(v, A, y, E), d = p + 1;
1488
+ this.He.quadraticCurveTo(v, A, y, E), m = p + 1;
1489
1489
  } else {
1490
1490
  const y = (v + (e + r[p] * s)) / 2, E = (A + (i - h[p] * s)) / 2;
1491
- this.He.quadraticCurveTo(v, A, y, E), d = p;
1491
+ this.He.quadraticCurveTo(v, A, y, E), m = p;
1492
1492
  }
1493
1493
  }
1494
1494
  this.He.closePath();
@@ -1499,15 +1499,15 @@ class Fe {
1499
1499
  this.He.fill();
1500
1500
  }
1501
1501
  }
1502
- class Nt {
1502
+ class Ut {
1503
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.je(e, r) : r.format === 12 && (s = this.Ke(e, r)), s > 0) break;
1507
+ for (const r of i.tables) if (r.format === 4 ? s = this.We(e, r) : r.format === 12 && (s = this.je(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
1512
  return i === void 0 ? 0 : this.Ye(t, i);
1513
1513
  }
@@ -1519,7 +1519,7 @@ class Nt {
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
- je(t, e) {
1522
+ We(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 Nt {
1537
1537
  }
1538
1538
  return 0;
1539
1539
  }
1540
- Ke(t, e) {
1540
+ je(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];
@@ -1546,16 +1546,16 @@ class Nt {
1546
1546
  return 0;
1547
1547
  }
1548
1548
  }
1549
- class Pe {
1549
+ class Me {
1550
1550
  constructor() {
1551
1551
  a(this, "Ve");
1552
- this.Ve = new Nt();
1552
+ this.Ve = new Ut();
1553
1553
  }
1554
1554
  Je(t, e, i) {
1555
1555
  let s = 0;
1556
1556
  const r = this.Ve.qe(i, e), h = r.lineHeight;
1557
1557
  for (const o of t) {
1558
- const c = this.Ve.We(i, o);
1558
+ const c = this.Ve.Ke(i, o);
1559
1559
  if (c === 0) continue;
1560
1560
  const l = this.Ve.Ze(i, c) * r.scale;
1561
1561
  s = Math.max(s, l);
@@ -1563,10 +1563,10 @@ class Pe {
1563
1563
  return { width: Math.ceil(s), height: Math.ceil(h) };
1564
1564
  }
1565
1565
  }
1566
- class Me {
1566
+ class Ue {
1567
1567
  constructor() {
1568
1568
  a(this, "tr");
1569
- this.tr = new Nt();
1569
+ this.tr = new Ut();
1570
1570
  }
1571
1571
  sr(t, e) {
1572
1572
  const i = [], s = /* @__PURE__ */ new Map();
@@ -1583,11 +1583,11 @@ class Me {
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 = j.T.glyf.Ee(t, s);
1586
+ const h = q.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
1592
  a(this, "rr");
1593
1593
  a(this, "nr", []);
@@ -1602,17 +1602,17 @@ class vt {
1602
1602
  a(this, "gr");
1603
1603
  a(this, "mr");
1604
1604
  a(this, "_r");
1605
- this.cr = e, this.pr = new Re(), this.gr = new Fe(t), this.mr = new Pe(), this._r = new Me();
1605
+ this.cr = e, this.pr = new Pe(), this.gr = new Ce(t), this.mr = new Me(), this._r = new Ue();
1606
1606
  }
1607
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 U(`Failed to load font file: ${i.status} ${i.statusText}`);
1611
+ if (!i.ok) throw new S(`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.Ar(e), this.rr = j.parse(e)[0], await this.wr();
1615
+ await this.Ar(e), this.rr = q.parse(e)[0], await this.wr();
1616
1616
  }
1617
1617
  br(t) {
1618
1618
  if (t === void 0) return this.cr;
@@ -1623,14 +1623,14 @@ class vt {
1623
1623
  async Cr(t) {
1624
1624
  try {
1625
1625
  const e = await fetch(t);
1626
- if (!e.ok) throw new U(`Failed to load font file: ${e.status} ${e.statusText}`);
1626
+ if (!e.ok) throw new S(`Failed to load font file: ${e.status} ${e.statusText}`);
1627
1627
  const i = await e.arrayBuffer();
1628
1628
  await this.Ar(i);
1629
- const s = j.parse(i);
1629
+ const s = q.parse(i);
1630
1630
  if (!s || s.length === 0) throw Error("Failed to parse font file");
1631
1631
  this.rr = s[0], await this.wr();
1632
1632
  } catch (e) {
1633
- throw new U("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
1633
+ throw new S("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
1634
1634
  }
1635
1635
  }
1636
1636
  async Ar(t) {
@@ -1681,7 +1681,7 @@ class vt {
1681
1681
  return this.rr;
1682
1682
  }
1683
1683
  }
1684
- class Ut {
1684
+ class St {
1685
1685
  constructor(t, e, i) {
1686
1686
  a(this, "Pr");
1687
1687
  a(this, "$r");
@@ -1725,17 +1725,17 @@ class Ut {
1725
1725
  return this.Rr;
1726
1726
  }
1727
1727
  }
1728
- const Ne = /^rgba?\(([^)]+)\)$/i;
1728
+ const Se = /^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 Ue(n) {
1732
+ function Ze(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 = Ne.exec(i.trim());
1738
+ const s = Se.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,7 +1743,7 @@ function Ue(n) {
1743
1743
  return [h, o, c, Math.round(l)];
1744
1744
  }(t)), e ? e[3] === 0 ? null : e : null;
1745
1745
  }
1746
- class Se {
1746
+ class Le {
1747
1747
  constructor(t = {}) {
1748
1748
  a(this, "Er");
1749
1749
  a(this, "Dr", null);
@@ -1781,7 +1781,7 @@ class Se {
1781
1781
  const t = this.Qr();
1782
1782
  for (const e of t) {
1783
1783
  if (!e) continue;
1784
- const i = Ue(window.getComputedStyle(e).backgroundColor);
1784
+ const i = Ze(window.getComputedStyle(e).backgroundColor);
1785
1785
  if (i) return i;
1786
1786
  }
1787
1787
  return [255, 255, 255, 255];
@@ -1803,7 +1803,7 @@ class Se {
1803
1803
  }
1804
1804
  Yr() {
1805
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.");
1806
+ if (!t) throw new S("`textmode.js` requires WebGL2 support.");
1807
1807
  return t;
1808
1808
  }
1809
1809
  gt() {
@@ -1828,19 +1828,19 @@ class Se {
1828
1828
  }
1829
1829
  }
1830
1830
  function $(n) {
1831
- return O(parseInt(n, 16), 0, 255);
1831
+ return B(parseInt(n, 16), 0, 255);
1832
1832
  }
1833
1833
  class M {
1834
1834
  constructor(t, e, i, s) {
1835
+ a(this, "Wr");
1835
1836
  a(this, "jr");
1836
- a(this, "Kr");
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.jr = [this.r, this.g, this.b, this.a], this.Kr = [this.r / 255, this.g / 255, this.b / 255, this.a / 255];
1841
+ this.r = B(t, 0, 255), this.g = B(e, 0, 255), this.b = B(i, 0, 255), this.a = B(s, 0, 255), this.Wr = [this.r, this.g, this.b, this.a], this.jr = [this.r / 255, this.g / 255, this.b / 255, this.a / 255];
1842
1842
  }
1843
- static Wr(t, e, i, s) {
1843
+ static Kr(t, e, i, s) {
1844
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.");
@@ -1873,10 +1873,10 @@ class M {
1873
1873
  return [this.r, this.g, this.b];
1874
1874
  }
1875
1875
  get rgba() {
1876
- return [...this.jr];
1876
+ return [...this.Wr];
1877
1877
  }
1878
1878
  get normalized() {
1879
- return [...this.Kr];
1879
+ return [...this.jr];
1880
1880
  }
1881
1881
  withAlpha(t) {
1882
1882
  return new M(this.r, this.g, this.b, t);
@@ -1886,16 +1886,16 @@ class M {
1886
1886
  }
1887
1887
  }
1888
1888
  const pt = /* @__PURE__ */ new Map();
1889
- function Le(n) {
1889
+ function Ne(n) {
1890
1890
  pt.set(n.id, n);
1891
1891
  }
1892
- function Je(n) {
1892
+ function $e(n) {
1893
1893
  pt.delete(n);
1894
1894
  }
1895
1895
  function De(n) {
1896
1896
  return pt.get(n);
1897
1897
  }
1898
- class St {
1898
+ class Zt {
1899
1899
  constructor(t, e, i, s, r, h, o, c) {
1900
1900
  a(this, "A");
1901
1901
  a(this, "Z");
@@ -1967,7 +1967,7 @@ class St {
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
1973
  return this.dn = e, this.vn = e.length, this.q = null, this;
@@ -2004,7 +2004,7 @@ class St {
2004
2004
  this.q = this.Z.materialManager.Ni(i, s);
2005
2005
  }
2006
2006
  gn(t, e, i, s, r) {
2007
- const h = M.Wr(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
2010
  mn(t) {
@@ -2025,7 +2025,7 @@ class St {
2025
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 I extends St {
2028
+ class I extends Zt {
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)));
@@ -2047,13 +2047,13 @@ class Lt {
2047
2047
  a(this, "Fn", 0);
2048
2048
  a(this, "Pn", !0);
2049
2049
  a(this, "$n", 0);
2050
- a(this, "Tn", 0);
2051
- a(this, "Rn", []);
2052
- a(this, "En", 10);
2053
- a(this, "Sn", 0);
2050
+ a(this, "Un", 0);
2051
+ a(this, "Tn", []);
2052
+ a(this, "Rn", 10);
2053
+ a(this, "En", 0);
2054
2054
  this.xn = 1e3 / t;
2055
2055
  }
2056
- kn(t) {
2056
+ Sn(t) {
2057
2057
  if (!this.Pn) return;
2058
2058
  this.Fn = performance.now();
2059
2059
  const e = (i) => {
@@ -2063,113 +2063,116 @@ class Lt {
2063
2063
  };
2064
2064
  this.Mn = requestAnimationFrame(e);
2065
2065
  }
2066
- zn() {
2066
+ kn() {
2067
2067
  this.Mn && (cancelAnimationFrame(this.Mn), this.Mn = null);
2068
2068
  }
2069
- Dn() {
2070
- this.Pn && (this.Pn = !1, this.zn());
2069
+ zn() {
2070
+ this.Pn && (this.Pn = !1, this.kn());
2071
2071
  }
2072
- Ln(t) {
2073
- this.Pn || (this.Pn = !0, this.kn(t));
2072
+ Dn(t) {
2073
+ this.Pn || (this.Pn = !0, this.Sn(t));
2074
2074
  }
2075
- On(t, e) {
2075
+ Ln(t, e) {
2076
2076
  if (t === void 0) return this.$n;
2077
- this.xn = 1e3 / t, this.Pn && e && (this.zn(), this.kn(e));
2077
+ this.xn = 1e3 / t, this.Pn && e && (this.kn(), this.Sn(e));
2078
2078
  }
2079
- In() {
2079
+ On() {
2080
2080
  const t = performance.now();
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;
2081
+ if (this.Un > 0) {
2082
+ const e = t - this.Un;
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
2085
  this.$n = 1e3 / i;
2086
2086
  }
2087
- this.Tn = t;
2087
+ this.Un = t;
2088
2088
  }
2089
- get Bn() {
2089
+ get In() {
2090
2090
  return this.Pn;
2091
2091
  }
2092
- get Hn() {
2092
+ get Bn() {
2093
2093
  return this.$n;
2094
2094
  }
2095
- get Gn() {
2096
- return this.Sn;
2095
+ get Hn() {
2096
+ return this.En;
2097
2097
  }
2098
- set Gn(t) {
2099
- this.Sn = t;
2098
+ set Hn(t) {
2099
+ this.En = t;
2100
2100
  }
2101
- Qn() {
2102
- this.Sn++;
2101
+ Gn() {
2102
+ this.En++;
2103
2103
  }
2104
2104
  }
2105
- class Dt {
2105
+ class Nt {
2106
2106
  constructor(t) {
2107
2107
  a(this, "Er");
2108
- a(this, "Nn");
2108
+ a(this, "Qn");
2109
+ a(this, "Nn", { x: -1, y: -1 });
2109
2110
  a(this, "Xn", { x: -1, y: -1 });
2110
- a(this, "Yn", { x: -1, y: -1 });
2111
- a(this, "jn", null);
2112
- a(this, "Kn", 0);
2113
- a(this, "Wn");
2111
+ a(this, "Yn", null);
2112
+ a(this, "Wn", 0);
2113
+ a(this, "jn");
2114
+ a(this, "Kn");
2114
2115
  a(this, "Zn");
2115
2116
  a(this, "qn");
2116
2117
  a(this, "Vn");
2117
2118
  a(this, "Jn");
2118
- a(this, "th");
2119
- a(this, "sh", !1);
2119
+ a(this, "th", !1);
2120
+ a(this, "sh");
2120
2121
  a(this, "ih");
2121
2122
  a(this, "eh");
2122
2123
  a(this, "rh");
2123
2124
  a(this, "nh");
2124
- a(this, "hh");
2125
2125
  this.Er = t;
2126
2126
  }
2127
- oh(t) {
2127
+ hh(t) {
2128
2128
  const e = performance.now() + Math.max(0, t);
2129
- e > this.Kn && (this.Kn = e);
2129
+ e > this.Wn && (this.Wn = e);
2130
2130
  }
2131
- ah() {
2132
- return performance.now() < this.Kn;
2131
+ oh() {
2132
+ return performance.now() < this.Wn;
2133
2133
  }
2134
- uh(t) {
2134
+ ah(t) {
2135
2135
  const e = this.Er.canvas;
2136
2136
  e.style.cursor = t == null || t === "" ? "" : t;
2137
2137
  }
2138
2138
  yr(t) {
2139
- this.Nn = t, this.fh();
2139
+ this.Qn = t, this.uh();
2140
2140
  }
2141
- dh() {
2142
- if (this.sh) return;
2141
+ fh() {
2142
+ if (this.th) return;
2143
2143
  const t = this.Er.canvas;
2144
- this.Wn = (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;
2144
+ this.jn = (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);
2148
2150
  }, this.qn = (e) => {
2149
- this.ph(e), this.mh(e);
2151
+ this.dh(e), this.mh(e);
2150
2152
  }, this.Vn = (e) => {
2151
- this.ph(e), this._h(e);
2153
+ this.dh(e), this._h(e);
2152
2154
  }, this.Jn = (e) => {
2153
- this.ph(e), this.yh(e);
2154
- }, this.th = (e) => {
2155
- this.ph(e), this.Ah(e);
2156
- }, t.addEventListener("mousemove", this.Wn, { 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;
2155
+ this.dh(e), this.yh(e);
2156
+ }, t.addEventListener("mousemove", this.jn, { 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
2157
  }
2158
- wh() {
2159
- if (!this.sh) return;
2158
+ Ah() {
2159
+ if (!this.th) return;
2160
2160
  const t = this.Er.canvas;
2161
- t.removeEventListener("mousemove", this.Wn), 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);
2161
+ t.removeEventListener("mousemove", this.jn), 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);
2169
2169
  } catch {
2170
- this.Xn.x = -1, this.Xn.y = -1;
2170
+ this.Nn.x = -1, this.Nn.y = -1;
2171
2171
  }
2172
2172
  }
2173
+ wh(t) {
2174
+ this.sh = t;
2175
+ }
2173
2176
  bh(t) {
2174
2177
  this.ih = t;
2175
2178
  }
@@ -2182,138 +2185,136 @@ class Dt {
2182
2185
  Mh(t) {
2183
2186
  this.nh = t;
2184
2187
  }
2185
- Fh(t) {
2186
- this.hh = t;
2188
+ Fh() {
2189
+ return { x: this.Nn.x, y: this.Nn.y };
2187
2190
  }
2188
- Ph() {
2189
- return { x: this.Xn.x, y: this.Xn.y };
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
+ }
2190
2196
  }
2191
2197
  gh(t) {
2192
- if (this.nh && !this.ah()) {
2193
- const e = { position: { ...this.Xn }, previousPosition: { ...this.Yn }, originalEvent: t };
2194
- this.nh(e);
2198
+ if (this.ih && !this.oh()) {
2199
+ const e = { position: { ...this.Nn }, previousPosition: { ...this.Xn }, button: t.button, originalEvent: t };
2200
+ this.ih(e);
2195
2201
  }
2196
2202
  }
2197
2203
  mh(t) {
2198
- if (this.eh && !this.ah()) {
2199
- const e = { position: { ...this.Xn }, previousPosition: { ...this.Yn }, button: t.button, originalEvent: t };
2204
+ if (this.eh && !this.oh()) {
2205
+ const e = { position: { ...this.Nn }, previousPosition: { ...this.Xn }, button: t.button, originalEvent: t };
2200
2206
  this.eh(e);
2201
2207
  }
2202
2208
  }
2203
2209
  _h(t) {
2204
- if (this.rh && !this.ah()) {
2205
- const e = { position: { ...this.Xn }, previousPosition: { ...this.Yn }, button: t.button, originalEvent: t };
2206
- this.rh(e);
2210
+ if (this.sh && !this.oh()) {
2211
+ const e = { position: { ...this.Nn }, previousPosition: { ...this.Xn }, button: t.button, originalEvent: t };
2212
+ this.sh(e);
2207
2213
  }
2208
2214
  }
2209
2215
  yh(t) {
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);
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);
2219
2219
  }
2220
2220
  }
2221
- ph(t) {
2221
+ dh(t) {
2222
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);
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);
2226
2226
  }
2227
2227
  }
2228
- const Ze = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Dt }, Symbol.toStringTag, { value: "Module" }));
2229
- class Zt {
2228
+ const Oe = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Nt }, Symbol.toStringTag, { value: "Module" }));
2229
+ class Dt {
2230
2230
  constructor() {
2231
- a(this, "$h", /* @__PURE__ */ new Map());
2231
+ a(this, "Ph", /* @__PURE__ */ new Map());
2232
+ a(this, "$h", null);
2232
2233
  a(this, "Th", null);
2233
- a(this, "Rh", null);
2234
+ a(this, "Rh");
2234
2235
  a(this, "Eh");
2236
+ a(this, "th", !1);
2235
2237
  a(this, "Sh");
2236
- a(this, "sh", !1);
2237
2238
  a(this, "kh");
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" });
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" });
2240
2240
  }
2241
- dh() {
2242
- this.sh || (this.Eh = (t) => {
2241
+ fh() {
2242
+ this.th || (this.Rh = (t) => {
2243
+ this.Dh(t);
2244
+ }, this.Eh = (t) => {
2243
2245
  this.Lh(t);
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);
2246
+ }, window.addEventListener("keydown", this.Rh, { passive: !1 }), window.addEventListener("keyup", this.Eh, { passive: !1 }), this.th = !0);
2247
2247
  }
2248
- wh() {
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);
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);
2250
+ }
2251
+ bh(t) {
2252
+ this.Sh = t;
2250
2253
  }
2251
2254
  Ch(t) {
2252
2255
  this.kh = t;
2253
2256
  }
2254
- xh(t) {
2255
- this.zh = t;
2256
- }
2257
- Ih(t) {
2258
- const e = this.Bh(t), i = this.$h.get(t) || this.$h.get(e);
2257
+ Oh(t) {
2258
+ const e = this.Ih(t), i = this.Ph.get(t) || this.Ph.get(e);
2259
2259
  return (i == null ? void 0 : i.isPressed) || !1;
2260
2260
  }
2261
+ Bh() {
2262
+ return this.$h;
2263
+ }
2261
2264
  Hh() {
2262
2265
  return this.Th;
2263
2266
  }
2264
2267
  Gh() {
2265
- return this.Rh;
2266
- }
2267
- Qh() {
2268
2268
  const t = [];
2269
- for (const [e, i] of this.$h) i.isPressed && t.push(e);
2269
+ for (const [e, i] of this.Ph) i.isPressed && t.push(e);
2270
2270
  return t;
2271
2271
  }
2272
- Nh() {
2273
- return { ctrl: this.Ih("Control"), shift: this.Ih("Shift"), alt: this.Ih("Alt"), meta: this.Ih("Meta") };
2272
+ Qh() {
2273
+ return { ctrl: this.Oh("Control"), shift: this.Oh("Shift"), alt: this.Oh("Alt"), meta: this.Oh("Meta") };
2274
2274
  }
2275
- Xh() {
2276
- this.$h.clear(), this.Th = null, this.Rh = null;
2275
+ Nh() {
2276
+ this.Ph.clear(), this.$h = null, this.Th = null;
2277
2277
  }
2278
- Lh(t) {
2278
+ Dh(t) {
2279
2279
  const e = t.key, i = Date.now();
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)) {
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)) {
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.kh(r);
2284
+ this.Sh(r);
2285
2285
  }
2286
2286
  }
2287
- Oh(t) {
2287
+ Lh(t) {
2288
2288
  const e = t.key, i = Date.now();
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) {
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) {
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.zh(r);
2293
+ this.kh(r);
2294
2294
  }
2295
2295
  }
2296
- Bh(t) {
2297
- return this.Dh[t] || t.toLowerCase();
2296
+ Ih(t) {
2297
+ return this.zh[t] || t.toLowerCase();
2298
2298
  }
2299
2299
  }
2300
- const Be = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Zt }, Symbol.toStringTag, { value: "Module" }));
2301
- class Bt {
2300
+ const _e = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Dt }, Symbol.toStringTag, { value: "Module" }));
2301
+ class Ot {
2302
2302
  constructor(t, e) {
2303
2303
  a(this, "Er");
2304
- a(this, "Yh");
2305
- a(this, "Nn");
2306
- a(this, "jh", /* @__PURE__ */ new Map());
2307
- a(this, "Kh", /* @__PURE__ */ new Map());
2304
+ a(this, "Xh");
2305
+ a(this, "Qn");
2306
+ a(this, "Yh", /* @__PURE__ */ new Map());
2308
2307
  a(this, "Wh", /* @__PURE__ */ new Map());
2309
- a(this, "Zh", null);
2308
+ a(this, "jh", /* @__PURE__ */ new Map());
2309
+ a(this, "Kh", null);
2310
+ a(this, "Zh");
2310
2311
  a(this, "qh");
2311
2312
  a(this, "Vh");
2312
2313
  a(this, "Jh");
2313
2314
  a(this, "so");
2314
2315
  a(this, "io");
2316
+ a(this, "th", !1);
2315
2317
  a(this, "eo");
2316
- a(this, "sh", !1);
2317
2318
  a(this, "ro");
2318
2319
  a(this, "no");
2319
2320
  a(this, "ho");
@@ -2323,138 +2324,137 @@ class Bt {
2323
2324
  a(this, "lo");
2324
2325
  a(this, "uo");
2325
2326
  a(this, "fo");
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, "wo", 650);
2334
- a(this, "bo", 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;
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, "wo", 0.02);
2335
+ a(this, "bo", 2);
2336
+ a(this, "Co", 600);
2337
+ a(this, "xo", 0);
2338
+ a(this, "Mo", null);
2339
+ this.Er = t, this.Xh = e;
2340
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");
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
2342
  }
2343
2343
  yr(t) {
2344
- this.Nn = t, this.fh();
2344
+ this.Qn = t, this.uh();
2345
2345
  }
2346
- dh() {
2347
- if (this.sh) return;
2346
+ fh() {
2347
+ if (this.th) return;
2348
2348
  const t = this.Er.canvas;
2349
- this.Jh = (e) => {
2349
+ this.Vh = (e) => {
2350
+ this.Fo(e);
2351
+ }, this.Jh = (e) => {
2350
2352
  this.Po(e);
2351
2353
  }, this.so = (e) => {
2352
2354
  this.$o(e);
2353
2355
  }, this.io = (e) => {
2354
- this.To(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;
2356
+ this.Uo(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
2358
  }
2359
- wh() {
2360
- if (!this.sh) return;
2359
+ Ah() {
2360
+ if (!this.th) return;
2361
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.Kh.clear(), this.Wh.forEach((e) => {
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.Wh.clear(), this.jh.forEach((e) => {
2363
2363
  e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
2364
- }), this.Wh.clear(), this.Fo = null, this.Mo = 0, t.style.touchAction = this.qh, t.style.userSelect = this.Vh;
2364
+ }), this.jh.clear(), this.Mo = null, this.xo = 0, t.style.touchAction = this.Zh, t.style.userSelect = this.qh;
2365
2365
  }
2366
- fh() {
2367
- if (!this.Nn || this.jh.size === 0) return;
2366
+ uh() {
2367
+ if (!this.Qn || this.Yh.size === 0) return;
2368
2368
  const t = /* @__PURE__ */ new Map();
2369
- for (const e of this.jh.values()) {
2370
- const i = this.Eo(e.clientX, e.clientY, e.id, e);
2369
+ for (const e of this.Yh.values()) {
2370
+ const i = this.To(e.clientX, e.clientY, e.id, e);
2371
2371
  t.set(e.id, i);
2372
2372
  }
2373
- this.jh = t;
2373
+ this.Yh = t;
2374
2374
  }
2375
- So() {
2376
- return Array.from(this.jh.values()).map((t) => ({ ...t }));
2375
+ Ro() {
2376
+ return Array.from(this.Yh.values()).map((t) => ({ ...t }));
2377
2377
  }
2378
- ko(t) {
2378
+ Eo(t) {
2379
+ this.eo = t;
2380
+ }
2381
+ xh(t) {
2379
2382
  this.ro = t;
2380
2383
  }
2381
- Mh(t) {
2384
+ So(t) {
2382
2385
  this.no = t;
2383
2386
  }
2384
- zo(t) {
2387
+ ko(t) {
2385
2388
  this.ho = t;
2386
2389
  }
2387
- Do(t) {
2390
+ zo(t) {
2388
2391
  this.oo = t;
2389
2392
  }
2390
- Lo(t) {
2393
+ Do(t) {
2391
2394
  this.ao = t;
2392
2395
  }
2393
- Oo(t) {
2396
+ Lo(t) {
2394
2397
  this.co = t;
2395
2398
  }
2396
- Io(t) {
2399
+ Oo(t) {
2397
2400
  this.lo = t;
2398
2401
  }
2399
- Bo(t) {
2402
+ Io(t) {
2400
2403
  this.uo = t;
2401
2404
  }
2402
- Ho(t) {
2405
+ Bo(t) {
2403
2406
  this.fo = t;
2404
2407
  }
2405
- Go(t) {
2406
- this.do = t;
2407
- }
2408
- Po(t) {
2408
+ Fo(t) {
2409
2409
  var s;
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);
2410
+ if (!this.Qn) return;
2411
+ t.preventDefault(), (s = this.Xh) == null || s.hh(this.Co);
2412
+ const e = performance.now(), i = this.Ho(t.changedTouches);
2413
2413
  for (const r of i) {
2414
- const h = this.jh.get(r.id);
2415
- h && this.Kh.set(r.id, this.No(h)), this.jh.set(r.id, r);
2414
+ const h = this.Yh.get(r.id);
2415
+ h && this.Wh.set(r.id, this.Go(h)), this.Yh.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.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.Wh.set(r.id, o), this.ro && this.ro(this.Xo(r, t, void 0, e));
2417
+ this.co && (o.longPressTimer = window.setTimeout(() => {
2418
+ const c = this.Yh.get(r.id);
2419
+ c && (o.longPressFired = !0, this.co({ touch: this.Go(c), duration: performance.now() - o.startTime, originalEvent: t }));
2420
+ }, this.mo)), this.jh.set(r.id, o), this.eo && this.eo(this.Qo(r, t, void 0, e));
2421
2421
  }
2422
- this.jh.size === 2 && this.Yo();
2422
+ this.Yh.size === 2 && this.No();
2423
2423
  }
2424
- $o(t) {
2424
+ Po(t) {
2425
2425
  var s;
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);
2426
+ if (!this.Qn) return;
2427
+ t.preventDefault(), (s = this.Xh) == null || s.hh(this.Co);
2428
+ const e = performance.now(), i = this.Ho(t.changedTouches);
2429
2429
  for (const r of i) {
2430
- const h = this.jh.get(r.id), o = h ? this.No(h) : void 0;
2431
- o && this.Kh.set(r.id, o), this.jh.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.yo && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.no && this.no(this.Xo(r, t, o, e));
2430
+ const h = this.Yh.get(r.id), o = h ? this.Go(h) : void 0;
2431
+ o && this.Wh.set(r.id, o), this.Yh.set(r.id, r);
2432
+ const c = this.jh.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.Qo(r, t, o, e));
2434
2434
  }
2435
- this.jh.size === 2 ? this.jo(t) : this.Zh = null;
2435
+ this.Yh.size === 2 ? this.Xo(t) : this.Kh = null;
2436
2436
  }
2437
- To(t) {
2438
- if (!this.Nn) return;
2437
+ $o(t) {
2438
+ if (!this.Qn) return;
2439
2439
  t.preventDefault();
2440
- const e = performance.now(), i = this.Qo(t.changedTouches);
2440
+ const e = performance.now(), i = this.Ho(t.changedTouches);
2441
2441
  for (const s of i) {
2442
- const r = this.jh.get(s.id), h = r ? this.No(r) : void 0, o = this.Wh.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.Ko(o, t), this.Wh.delete(s.id), this.Kh.delete(s.id), this.jh.delete(s.id);
2442
+ const r = this.Yh.get(s.id), h = r ? this.Go(r) : void 0, o = this.jh.get(s.id);
2443
+ o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.no && this.no(this.Qo(s, t, h, e)), o && this.Yo(o, t), this.jh.delete(s.id), this.Wh.delete(s.id), this.Yh.delete(s.id);
2444
2444
  }
2445
- this.jh.size < 2 && (this.Zh = null);
2445
+ this.Yh.size < 2 && (this.Kh = null);
2446
2446
  }
2447
- Ro(t) {
2448
- if (!this.Nn) return;
2447
+ Uo(t) {
2448
+ if (!this.Qn) return;
2449
2449
  t.preventDefault();
2450
- const e = performance.now(), i = this.Qo(t.changedTouches);
2450
+ const e = performance.now(), i = this.Ho(t.changedTouches);
2451
2451
  for (const s of i) {
2452
- const r = this.jh.get(s.id), h = r ? this.No(r) : void 0, o = this.Wh.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.Wh.delete(s.id), this.Kh.delete(s.id), this.jh.delete(s.id);
2452
+ const r = this.Yh.get(s.id), h = r ? this.Go(r) : void 0, o = this.jh.get(s.id);
2453
+ o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.ho && this.ho(this.Qo(s, t, h, e)), this.jh.delete(s.id), this.Wh.delete(s.id), this.Yh.delete(s.id);
2454
2454
  }
2455
- this.jh.size < 2 && (this.Zh = null);
2455
+ this.Yh.size < 2 && (this.Kh = null);
2456
2456
  }
2457
- Qo(t) {
2457
+ Ho(t) {
2458
2458
  const e = [];
2459
2459
  for (let i = 0; i < t.length; i += 1) {
2460
2460
  const s = t.item(i);
@@ -2463,155 +2463,155 @@ class Bt {
2463
2463
  return e;
2464
2464
  }
2465
2465
  Wo(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 });
2466
+ return this.To(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
- 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, g = u - this.Nn.offsetY, m = Math.floor(f / this.Nn.cellWidth), d = Math.floor(g / this.Nn.cellHeight), v = m >= 0 && m < this.Nn.cols && d >= 0 && d < this.Nn.rows;
2470
- return { id: i, x: v ? m : -1, y: v ? d : -1, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
2468
+ To(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.Qn.offsetX, d = u - this.Qn.offsetY, g = Math.floor(f / this.Qn.cellWidth), m = Math.floor(d / this.Qn.cellHeight), v = g >= 0 && g < this.Qn.cols && m >= 0 && m < this.Qn.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
- Xo(t, e, i, s) {
2473
- const r = this.Wh.get(t.id), h = Array.from(this.Kh.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 };
2472
+ Qo(t, e, i, s) {
2473
+ const r = this.jh.get(t.id), h = Array.from(this.Wh.values()).map((l) => this.Go(l)), o = Array.from(this.Yh.values()).map((l) => this.Go(l)), c = this.Ho(e.changedTouches);
2474
+ return { touch: this.Go(t), previousTouch: i ? this.Go(i) : void 0, touches: o, previousTouches: h, changedTouches: c, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
2475
2475
  }
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 };
2476
+ No() {
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 = Et(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 };
2480
2480
  }
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);
2481
+ Xo(t) {
2482
+ if (this.Kh || this.No(), !this.Kh) return;
2483
+ const [e, i] = this.Kh.ids, s = this.Yh.get(e), r = this.Yh.get(i);
2484
2484
  if (!s || !r) return;
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.bo && (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;
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.wo && (this.uo({ touches: [this.Go(s), this.Go(r)], scale: h, deltaScale: o, center: this.jo(s, r), originalEvent: t }), this.Kh.lastScale = h);
2487
+ let c = Et(s.clientX, s.clientY, r.clientX, r.clientY) - this.Kh.initialAngle;
2488
2488
  c = (c + 180) % 360 - 180;
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);
2489
+ const l = c - this.Kh.lastRotation;
2490
+ this.fo && Math.abs(l) > this.bo && (this.fo({ touches: [this.Go(s), this.Go(r)], rotation: c, deltaRotation: l, center: this.jo(s, r), originalEvent: t }), this.Kh.lastRotation = c);
2491
2491
  }
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 });
2492
+ jo(t, e) {
2493
+ const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.To(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
- Ko(t, e) {
2496
+ Yo(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.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.wo && r >= this.Ao) {
2498
+ if (!t.longPressFired && s <= this.do && r <= this.po)
2499
+ this.Ko(t.lastPosition, i) && this.ao ? this.ao({ touch: this.Go(t.lastPosition), taps: 2, originalEvent: e }) : this.oo && this.oo({ touch: this.Go(t.lastPosition), taps: 1, originalEvent: e });
2500
+ else if (!t.longPressFired && s <= this.Ao && r >= this.yo) {
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.uo && this.uo({ touch: this.No(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
2502
+ this.lo && this.lo({ touch: this.Go(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
2503
2503
  }
2504
- this.Mo = i, this.Fo = this.No(t.lastPosition);
2504
+ this.xo = i, this.Mo = this.Go(t.lastPosition);
2505
2505
  }
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;
2506
+ Ko(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;
2508
2508
  }
2509
- No(t) {
2509
+ Go(t) {
2510
2510
  return { ...t };
2511
2511
  }
2512
2512
  }
2513
- const _e = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Bt }, Symbol.toStringTag, { value: "Module" }));
2514
- class Oe {
2513
+ const Be = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Ot }, Symbol.toStringTag, { value: "Module" }));
2514
+ class Xe {
2515
2515
  constructor(t, e) {
2516
2516
  a(this, "A");
2517
- a(this, "Vo");
2517
+ a(this, "Zo");
2518
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;
2519
+ a(this, "qo", 0);
2520
+ a(this, "Vo", !1);
2521
+ a(this, "Jo", []);
2522
+ a(this, "ta", -1);
2523
+ this.A = t, this.Zo = e;
2524
2524
  }
2525
2525
  get isPreloaded() {
2526
- return this.ta;
2526
+ return this.Vo;
2527
2527
  }
2528
2528
  get totalFrames() {
2529
- return this.Jo;
2529
+ return this.qo;
2530
2530
  }
2531
2531
  get frameRate() {
2532
2532
  return this.$n;
2533
2533
  }
2534
2534
  get textures() {
2535
- return this.sa;
2535
+ return this.Jo;
2536
2536
  }
2537
2537
  dispose() {
2538
- this.ea(), this.sa = [], this.$n = null, this.Jo = 0, this.ta = !1, this.ia = -1;
2538
+ this.sa(), this.Jo = [], this.$n = null, this.qo = 0, this.Vo = !1, this.ta = -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.Vo.duration;
2544
+ const s = this.Zo.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.ra(t, r), await this.na(t, e) ? (this.ha("captureStream", e), "captureStream") : (await this.oa(t, e), this.ha("seeking", e), "seeking");
2547
+ return this.ia(t, r), await this.ea(t, e) ? (this.ra("captureStream", e), "captureStream") : (await this.na(t, e), this.ra("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
- ra(t, e) {
2554
- this.ea(), this.$n = t, this.Jo = e, this.sa = [], this.ta = !1, this.ia = -1;
2553
+ ia(t, e) {
2554
+ this.sa(), this.$n = t, this.qo = e, this.Jo = [], this.Vo = !1, this.ta = -1;
2555
2555
  }
2556
- ha(t, e) {
2556
+ ra(t, e) {
2557
2557
  var i;
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 });
2558
+ if (this.Jo.length === 0) throw Error(`Video preload via ${t} completed but produced 0 frames.`);
2559
+ this.qo = this.Jo.length, this.Vo = !0, this.ta = -1, this.Zo.pause(), this.Zo.currentTime = 0, e != null && e.onProgress && e.onProgress({ percent: 100, loadedFrames: this.qo, totalFrames: this.qo, strategy: t }), (i = e == null ? void 0 : e.onComplete) == null || i.call(e, { totalFrames: this.qo, strategy: t });
2560
2560
  }
2561
- aa(t) {
2561
+ ha(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
- 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 }));
2565
+ oa(t, e) {
2566
+ if (!(e != null && e.onProgress) || this.qo === 0) return;
2567
+ const i = Math.min(99, Math.floor(this.Jo.length / this.qo * 100)), s = 10 * Math.floor(i / 10);
2568
+ s > this.ta && (this.ta = s, e.onProgress({ percent: i, loadedFrames: this.Jo.length, totalFrames: this.qo, strategy: t }));
2569
2569
  }
2570
- async na(t, e) {
2571
- const i = globalThis, s = i == null ? void 0 : i.MediaStreamTrackProcessor, r = this.Vo.captureStream;
2570
+ async ea(t, e) {
2571
+ const i = globalThis, s = i == null ? void 0 : i.MediaStreamTrackProcessor, r = this.Zo.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.Vo);
2575
+ const c = r.call(this.Zo);
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.Vo.currentTime = 0, this.Vo.muted = !0, await this.Vo.play().catch(() => {
2578
- }), this.Vo.paused) return !1;
2577
+ if (o = new s({ track: h }).readable.getReader(), this.Zo.currentTime = 0, this.Zo.muted = !0, await this.Zo.play().catch(() => {
2578
+ }), this.Zo.paused) return !1;
2579
2579
  const l = 1e6 / t;
2580
2580
  let u = 0;
2581
- for (; this.sa.length < this.Jo; ) {
2581
+ for (; this.Jo.length < this.qo; ) {
2582
2582
  const f = await o.read();
2583
2583
  if (f.done) break;
2584
- const g = f.value;
2585
- if (g) try {
2586
- const m = typeof g.timestamp == "number" ? g.timestamp : u;
2587
- (this.sa.length === 0 || m >= u) && (this.sa.push(this.aa(g)), u = m + l, this.ca("captureStream", e));
2584
+ const d = f.value;
2585
+ if (d) try {
2586
+ const g = typeof d.timestamp == "number" ? d.timestamp : u;
2587
+ (this.Jo.length === 0 || g >= u) && (this.Jo.push(this.ha(d)), u = g + l, this.oa("captureStream", e));
2588
2588
  } finally {
2589
- g.close();
2589
+ d.close();
2590
2590
  }
2591
2591
  }
2592
- return o.releaseLock(), h.stop(), o = null, h = void 0, this.Vo.pause(), this.Vo.currentTime = 0, this.sa.length !== 0;
2592
+ return o.releaseLock(), h.stop(), o = null, h = void 0, this.Zo.pause(), this.Zo.currentTime = 0, this.Jo.length !== 0;
2593
2593
  } catch {
2594
- return this.ea(), this.sa = [], this.ia = -1, !1;
2594
+ return this.sa(), this.Jo = [], this.ta = -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.Vo.pause(), this.Vo.currentTime = 0;
2600
+ h && h.stop(), this.Zo.pause(), this.Zo.currentTime = 0;
2601
2601
  }
2602
2602
  }
2603
- async oa(t, e) {
2604
- const i = 1 / t, s = this.Jo, r = this.Vo;
2603
+ async na(t, e) {
2604
+ const i = 1 / t, s = this.qo, r = this.Zo;
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.la(o), this.sa.push(this.aa(r)), this.ca("seeking", e);
2608
+ await this.aa(o), this.Jo.push(this.ha(r)), this.oa("seeking", e);
2609
2609
  }
2610
2610
  r.currentTime = 0;
2611
2611
  }
2612
- la(t) {
2612
+ aa(t) {
2613
2613
  return new Promise((e, i) => {
2614
- const s = this.Vo, r = () => {
2614
+ const s = this.Zo, r = () => {
2615
2615
  s.removeEventListener("seeked", h), s.removeEventListener("error", o);
2616
2616
  }, h = () => {
2617
2617
  r(), e();
@@ -2624,47 +2624,47 @@ class Oe {
2624
2624
  s.currentTime = l;
2625
2625
  });
2626
2626
  }
2627
- ea() {
2628
- for (const t of this.sa) this.A.deleteTexture(t);
2627
+ sa() {
2628
+ for (const t of this.Jo) this.A.deleteTexture(t);
2629
2629
  }
2630
2630
  }
2631
- class rt extends St {
2631
+ class rt extends Zt {
2632
2632
  constructor(e, i, s, r, h, o, c, l, u) {
2633
2633
  const f = o / c;
2634
- let g, m;
2635
- f > 1 ? (g = l, m = Math.round(l / f)) : (m = u, g = Math.round(u * f));
2636
- super(e, i, s, r, o, c, g, m);
2637
- a(this, "Vo");
2638
- a(this, "ua", 0);
2639
- a(this, "fa", null);
2640
- this.Vo = h;
2634
+ let d, g;
2635
+ f > 1 ? (d = l, g = Math.round(l / f)) : (g = u, d = Math.round(u * f));
2636
+ super(e, i, s, r, o, c, d, g);
2637
+ a(this, "Zo");
2638
+ a(this, "ca", 0);
2639
+ a(this, "la", null);
2640
+ this.Zo = h;
2641
2641
  }
2642
2642
  gt() {
2643
2643
  var e;
2644
- super.gt(), (e = this.fa) == null || e.dispose(), this.fa = null, this.Vo.pause(), this.Vo.src = "", this.Vo.load();
2644
+ super.gt(), (e = this.la) == null || e.dispose(), this.la = null, this.Zo.pause(), this.Zo.src = "", this.Zo.load();
2645
2645
  }
2646
- da() {
2646
+ ua() {
2647
2647
  var e;
2648
- if (!((e = this.fa) != null && e.isPreloaded) && this.Vo.readyState >= this.Vo.HAVE_CURRENT_DATA) {
2648
+ if (!((e = this.la) != null && e.isPreloaded) && this.Zo.readyState >= this.Zo.HAVE_CURRENT_DATA) {
2649
2649
  const i = this.A;
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);
2650
+ i.bindTexture(i.TEXTURE_2D, this.tn), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, i.RGBA, i.UNSIGNED_BYTE, this.Zo), i.bindTexture(i.TEXTURE_2D, null);
2651
2651
  }
2652
2652
  }
2653
2653
  bn() {
2654
2654
  var i, s;
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;
2655
+ const e = (i = this.la) == null ? void 0 : i.textures;
2656
+ return e && e.length > 0 && ((s = this.la) != null && s.isPreloaded) ? e[this.ca % e.length] : this.tn;
2657
2657
  }
2658
2658
  ut() {
2659
2659
  return this.q = null, super.ut();
2660
2660
  }
2661
2661
  yn() {
2662
- this.da();
2662
+ this.ua();
2663
2663
  }
2664
2664
  frame(e) {
2665
2665
  var s, r;
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;
2666
+ const i = ((s = this.la) == null ? void 0 : s.totalFrames) ?? 0;
2667
+ return (r = this.la) != null && r.isPreloaded && e !== void 0 && i > 0 && (this.ca = (e % i + i) % i, this.q = null), this;
2668
2668
  }
2669
2669
  static async Cn(e, i, s, r, h, o) {
2670
2670
  const c = e.context, l = o == null ? void 0 : o.frameRate;
@@ -2678,29 +2678,29 @@ class rt extends St {
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 g = u.videoWidth, m = u.videoHeight, d = new rt(c, e, f, i, u, g, m, r, h);
2682
- return l && l > 0 && (d.fa = new Oe(c, u), await d.fa.preload(l, o), d.ua = 0), d;
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.la = new Xe(c, u), await m.la.preload(l, o), m.ca = 0), m;
2683
2683
  }
2684
2684
  async play() {
2685
- await this.Vo.play();
2685
+ await this.Zo.play();
2686
2686
  }
2687
2687
  pause() {
2688
- this.Vo.pause();
2688
+ this.Zo.pause();
2689
2689
  }
2690
2690
  stop() {
2691
- this.Vo.pause(), this.Vo.currentTime = 0;
2691
+ this.Zo.pause(), this.Zo.currentTime = 0;
2692
2692
  }
2693
2693
  speed(e) {
2694
- return this.Vo.playbackRate = e, this;
2694
+ return this.Zo.playbackRate = e, this;
2695
2695
  }
2696
2696
  loop(e = !0) {
2697
- return this.Vo.loop = e, this;
2697
+ return this.Zo.loop = e, this;
2698
2698
  }
2699
2699
  time(e) {
2700
- return this.Vo.currentTime = e, this;
2700
+ return this.Zo.currentTime = e, this;
2701
2701
  }
2702
2702
  volume(e) {
2703
- return this.Vo.volume = Math.max(0, Math.min(1, e)), this;
2703
+ return this.Zo.volume = Math.max(0, Math.min(1, e)), this;
2704
2704
  }
2705
2705
  get texture() {
2706
2706
  return this.tn;
@@ -2718,24 +2718,24 @@ class rt extends St {
2718
2718
  return this.en;
2719
2719
  }
2720
2720
  get videoElement() {
2721
- return this.Vo;
2721
+ return this.Zo;
2722
2722
  }
2723
2723
  get currentTime() {
2724
- return this.Vo.currentTime;
2724
+ return this.Zo.currentTime;
2725
2725
  }
2726
2726
  get duration() {
2727
- return this.Vo.duration;
2727
+ return this.Zo.duration;
2728
2728
  }
2729
2729
  get isPlaying() {
2730
- return !this.Vo.paused && !this.Vo.ended;
2730
+ return !this.Zo.paused && !this.Zo.ended;
2731
2731
  }
2732
2732
  get totalFrames() {
2733
2733
  var e;
2734
- return ((e = this.fa) == null ? void 0 : e.totalFrames) ?? 0;
2734
+ return ((e = this.la) == null ? void 0 : e.totalFrames) ?? 0;
2735
2735
  }
2736
2736
  }
2737
- const Xe = (n) => class extends n {
2738
- va(t, e, i, s) {
2737
+ const Ie = (n) => class extends n {
2738
+ fa(t, e, i, s) {
2739
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.");
@@ -2771,7 +2771,7 @@ const Xe = (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.we(t, e);
@@ -2786,7 +2786,7 @@ const Xe = (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.va(t, e, i, s);
2789
+ const r = this.fa(t, e, i, s);
2790
2790
  this.Z.$e(r.r, r.g, r.b, r.a);
2791
2791
  }
2792
2792
  char(t) {
@@ -2795,11 +2795,11 @@ const Xe = (n) => class extends n {
2795
2795
  this.Z.state.hs(this.rr.Mr(e[0]));
2796
2796
  }
2797
2797
  charColor(t, e, i, s) {
2798
- const r = this.va(t, e, i, s);
2798
+ const r = this.fa(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.va(t, e, i, s);
2802
+ const r = this.fa(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,323 +2851,324 @@ const Xe = (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 W && 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 = I.Cn(this.Z, this.rr, t, this.Nn.cols, this.Nn.rows);
2862
- return this.pa(r), r;
2861
+ const r = I.Cn(this.Z, this.rr, t, this.Qn.cols, this.Qn.rows);
2862
+ return this.da(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 = I.Cn(this.Z, this.rr, i, this.Nn.cols, this.Nn.rows);
2868
- return this.pa(s), s;
2867
+ }), s = I.Cn(this.Z, this.rr, i, this.Qn.cols, this.Qn.rows);
2868
+ return this.da(s), s;
2869
2869
  }
2870
2870
  async loadVideo(t, e) {
2871
- const i = await rt.Cn(this.Z, this.rr, t, this.Nn.cols, this.Nn.rows, e);
2872
- return this.pa(i), i;
2871
+ const i = await rt.Cn(this.Z, this.rr, t, this.Qn.cols, this.Qn.rows, e);
2872
+ return this.da(i), i;
2873
2873
  }
2874
- }, Ie = (n) => class extends n {
2874
+ }, Ye = (n) => class extends n {
2875
2875
  async loadFont(t) {
2876
2876
  return this.rr.Cr(t).then(() => {
2877
2877
  const e = this.rr.maxGlyphDimensions;
2878
- this.Nn.zr(e.width, e.height), this.ga.resize(this.Nn.cols, this.Nn.rows), this.Z.Re(), this.Yh.fh(), this.ma.fh();
2879
- for (const i of this._a) i._n(this.rr);
2878
+ this.Qn.zr(e.width, e.height), this.va.resize(this.Qn.cols, this.Qn.rows), this.pa.Xr(), this.Z.Re(), this.Xh.uh(), this.ga.uh();
2879
+ for (const i of this.ma) 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.rr.fontSize === t) return;
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
2884
  this.rr.br(t);
2885
2885
  const e = this.rr.maxGlyphDimensions;
2886
- this.Nn.zr(e.width, e.height), this.ga.resize(this.Nn.cols, this.Nn.rows), this.Z.Re(), this.Yh.fh(), this.ma.fh();
2886
+ this.Qn.zr(e.width, e.height), this.va.resize(this.Qn.cols, this.Qn.rows), this.pa.Xr(), this.Z.Re(), this.Xh.uh(), this.ga.uh();
2887
2887
  }
2888
- }, Ye = (n) => class extends n {
2888
+ }, ze = (n) => class extends n {
2889
2889
  get frameCount() {
2890
- return this.ya.Gn;
2890
+ return this._a.Hn;
2891
2891
  }
2892
2892
  set frameCount(t) {
2893
- this.ya.Gn = t;
2893
+ this._a.Hn = t;
2894
2894
  }
2895
2895
  frameRate(t) {
2896
- return t === void 0 ? this.ya.Hn : this.ya.On(t, () => this.wa());
2896
+ return t === void 0 ? this._a.Bn : this._a.Ln(t, () => this.ya());
2897
2897
  }
2898
2898
  noLoop() {
2899
- this.ya.Dn();
2899
+ this._a.zn();
2900
2900
  }
2901
2901
  loop() {
2902
- this.ya.Ln(() => this.wa());
2902
+ this._a.Dn(() => this.ya());
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.wa();
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.ya();
2906
2906
  }
2907
2907
  isLooping() {
2908
- return this.ya.Bn;
2908
+ return this._a.In;
2909
2909
  }
2910
- }, ze = (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.Yh.bh(t);
2915
+ this.Xh.wh(t);
2916
2916
  }
2917
2917
  mousePressed(t) {
2918
- this.Yh.Ch(t);
2918
+ this.Xh.bh(t);
2919
2919
  }
2920
2920
  mouseReleased(t) {
2921
- this.Yh.xh(t);
2921
+ this.Xh.Ch(t);
2922
2922
  }
2923
2923
  mouseMoved(t) {
2924
- this.Yh.Mh(t);
2924
+ this.Xh.xh(t);
2925
2925
  }
2926
2926
  mouseScrolled(t) {
2927
- this.Yh.Fh(t);
2927
+ this.Xh.Mh(t);
2928
2928
  }
2929
2929
  get mouse() {
2930
- return this.Yh.Ph();
2930
+ return this.Xh.Fh();
2931
2931
  }
2932
2932
  cursor(t) {
2933
- this.Yh.uh(t);
2933
+ this.Xh.ah(t);
2934
2934
  }
2935
- }, Ve = (n) => class extends n {
2935
+ }, Qe = (n) => class extends n {
2936
2936
  constructor(...t) {
2937
2937
  super(...t);
2938
2938
  }
2939
2939
  touchStarted(t) {
2940
- this.ma.ko(t);
2940
+ this.ga.Eo(t);
2941
2941
  }
2942
2942
  touchMoved(t) {
2943
- this.ma.Mh(t);
2943
+ this.ga.xh(t);
2944
2944
  }
2945
2945
  touchEnded(t) {
2946
- this.ma.zo(t);
2946
+ this.ga.So(t);
2947
2947
  }
2948
2948
  touchCancelled(t) {
2949
- this.ma.Do(t);
2949
+ this.ga.ko(t);
2950
2950
  }
2951
2951
  tap(t) {
2952
- this.ma.Lo(t);
2952
+ this.ga.zo(t);
2953
2953
  }
2954
2954
  doubleTap(t) {
2955
- this.ma.Oo(t);
2955
+ this.ga.Do(t);
2956
2956
  }
2957
2957
  longPress(t) {
2958
- this.ma.Io(t);
2958
+ this.ga.Lo(t);
2959
2959
  }
2960
2960
  swipe(t) {
2961
- this.ma.Bo(t);
2961
+ this.ga.Oo(t);
2962
2962
  }
2963
2963
  pinch(t) {
2964
- this.ma.Ho(t);
2964
+ this.ga.Io(t);
2965
2965
  }
2966
2966
  rotateGesture(t) {
2967
- this.ma.Go(t);
2967
+ this.ga.Bo(t);
2968
2968
  }
2969
2969
  get touches() {
2970
- return this.ma.So();
2970
+ return this.ga.Ro();
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.ba.Ch(t);
2977
+ this.wa.bh(t);
2978
2978
  }
2979
2979
  keyReleased(t) {
2980
- this.ba.xh(t);
2980
+ this.wa.Ch(t);
2981
2981
  }
2982
2982
  isKeyPressed(t) {
2983
- return this.ba.Ih(t);
2983
+ return this.wa.Oh(t);
2984
2984
  }
2985
2985
  get lastKeyPressed() {
2986
- return this.ba.Hh();
2986
+ return this.wa.Bh();
2987
2987
  }
2988
2988
  get lastKeyReleased() {
2989
- return this.ba.Gh();
2989
+ return this.wa.Hh();
2990
2990
  }
2991
2991
  get pressedKeys() {
2992
- return this.ba.Qh();
2992
+ return this.wa.Gh();
2993
2993
  }
2994
2994
  get modifierState() {
2995
- return this.ba.Nh();
2995
+ return this.wa.Qh();
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", []);
3000
+ a(this, "ba");
3001
+ a(this, "Ca", /* @__PURE__ */ new Map());
3002
+ a(this, "xa", []);
3003
+ a(this, "Ma", /* @__PURE__ */ new Map());
3003
3004
  a(this, "Fa", /* @__PURE__ */ new Map());
3004
- a(this, "Pa", /* @__PURE__ */ new Map());
3005
- this.Ca = t;
3005
+ this.ba = t;
3006
3006
  }
3007
- async $a(t) {
3007
+ async Pa(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.Ca.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3010
+ const i = this.$a(e.name);
3011
3011
  try {
3012
- await e.install(this.Ca, i);
3012
+ await e.install(this.ba, i);
3013
3013
  } catch (s) {
3014
- throw this.Ra(e.name), s;
3014
+ throw this.Ta(e.name), s;
3015
3015
  }
3016
- this.xa.set(e.name, e), this.Ma.push(e.name);
3016
+ this.Ca.set(e.name, e), this.xa.push(e.name);
3017
3017
  }
3018
3018
  }
3019
- async Ea(t) {
3020
- const e = this.xa.get(t);
3019
+ async Ra(t) {
3020
+ const e = this.Ca.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.$a(t);
3023
+ e.uninstall && await e.uninstall(this.ba, i), this.Ca.delete(t), this.xa.splice(this.xa.indexOf(t), 1), this.Ta(t);
3024
3024
  }
3025
- Sa() {
3026
- this.ka(this.Fa);
3025
+ Ea() {
3026
+ this.Sa(this.Ma);
3027
3027
  }
3028
- za() {
3029
- this.ka(this.Pa);
3028
+ ka() {
3029
+ this.Sa(this.Fa);
3030
3030
  }
3031
- async Da() {
3032
- const t = [...this.xa.keys()];
3033
- for (const e of t) await this.Ea(e);
3031
+ async za() {
3032
+ const t = [...this.Ca.keys()];
3033
+ for (const e of t) await this.Ra(e);
3034
3034
  }
3035
- Ta(t) {
3036
- return { renderer: this.Ca.Z, font: this.Ca.rr, grid: this.Ca.Nn, canvas: this.Ca.Er, drawFramebuffer: this.Ca.ga, asciiFramebuffer: this.Ca.La, registerPreDrawHook: (e) => this.Oa(this.Fa, t, e), registerPostDrawHook: (e) => this.Oa(this.Pa, t, e) };
3035
+ $a(t) {
3036
+ return { renderer: this.ba.Z, font: this.ba.rr, grid: this.ba.Qn, canvas: this.ba.Er, drawFramebuffer: this.ba.va, asciiFramebuffer: this.ba.Da, registerPreDrawHook: (e) => this.La(this.Ma, t, e), registerPostDrawHook: (e) => this.La(this.Fa, t, e) };
3037
3037
  }
3038
- Oa(t, e, i) {
3038
+ La(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
+ Ta(t) {
3046
+ this.Ma.delete(t), this.Fa.delete(t);
3047
3047
  }
3048
- ka(t) {
3049
- for (const e of this.Ma) {
3048
+ Sa(t) {
3049
+ for (const e of this.xa) {
3050
3050
  const i = t.get(e);
3051
3051
  i && i.forEach((s) => s());
3052
3052
  }
3053
3053
  }
3054
3054
  }
3055
- const Q = `#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.);}`;
3057
- class _t {
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.);}`, _t = `#version 300 es
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 Bt {
3058
3059
  constructor() {
3059
- a(this, "Ia", /* @__PURE__ */ new Map());
3060
- a(this, "Ba", []);
3060
+ a(this, "Oa", /* @__PURE__ */ new Map());
3061
+ a(this, "Ia", []);
3062
+ a(this, "Ba", 0);
3061
3063
  a(this, "Ha", 0);
3062
- a(this, "Ga", 0);
3063
- a(this, "Qa");
3064
+ a(this, "Ga");
3064
3065
  }
3065
- get Na() {
3066
- return this.Ha;
3066
+ get Qa() {
3067
+ return this.Ba;
3067
3068
  }
3068
- get Xa() {
3069
- if (this.Ha === 0) return 0;
3069
+ get Na() {
3070
+ if (this.Ba === 0) return 0;
3070
3071
  let t = 0;
3071
- for (const e of this.Ba) {
3072
- const i = this.Ia.get(e);
3072
+ for (const e of this.Ia) {
3073
+ const i = this.Oa.get(e);
3073
3074
  i && (t += Math.min(1, Math.max(0, i.progress)) * i.weight);
3074
3075
  }
3075
- return Math.min(1, t / this.Ha);
3076
+ return Math.min(1, t / this.Ba);
3076
3077
  }
3077
- Ya(t) {
3078
- this.Qa = t;
3078
+ Xa(t) {
3079
+ this.Ga = t;
3079
3080
  }
3080
- ja(t, e = 1) {
3081
- const i = `phase-${this.Ba.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
3082
- return this.Ia.set(i, s), this.Ba.push(i), this.Ha += s.weight, i;
3081
+ Ya(t, e = 1) {
3082
+ const i = `phase-${this.Ia.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
3083
+ return this.Oa.set(i, s), this.Ia.push(i), this.Ba += s.weight, i;
3083
3084
  }
3084
- Ka(t, e) {
3085
- const i = this.Ia.get(t);
3085
+ Wa(t, e) {
3086
+ const i = this.Oa.get(t);
3086
3087
  if (!i) return;
3087
3088
  i.progress = Math.max(0, Math.min(1, e)), i.status = i.progress >= 1 ? "complete" : "running";
3088
- const s = this.Xa;
3089
- Math.abs(s - this.Ga) > 1e-3 && (this.Ga = s, this.Qa && this.Qa(s));
3089
+ const s = this.Na;
3090
+ Math.abs(s - this.Ha) > 1e-3 && (this.Ha = s, this.Ga && this.Ga(s));
3090
3091
  }
3091
- Wa(t) {
3092
- const e = this.Ia.get(t);
3093
- e && (e.progress = 1, e.status = "complete", this.Ka(t, 1));
3092
+ ja(t) {
3093
+ const e = this.Oa.get(t);
3094
+ e && (e.progress = 1, e.status = "complete", this.Wa(t, 1));
3094
3095
  }
3095
- Za(t) {
3096
- const e = this.Ia.get(t);
3096
+ Ka(t) {
3097
+ const e = this.Oa.get(t);
3097
3098
  e && (e.status = "failed");
3098
3099
  }
3099
- qa() {
3100
- return this.Ba.map((t) => {
3101
- const e = this.Ia.get(t);
3100
+ Za() {
3101
+ return this.Ia.map((t) => {
3102
+ const e = this.Oa.get(t);
3102
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" };
3103
3104
  });
3104
3105
  }
3105
3106
  }
3106
- class Ot {
3107
+ class Xt {
3107
3108
  constructor(t = "active") {
3108
- a(this, "Va");
3109
+ a(this, "qa");
3110
+ a(this, "Va", "");
3109
3111
  a(this, "Ja", "");
3110
- a(this, "tc", "");
3111
- this.Va = t;
3112
+ this.qa = t;
3113
+ }
3114
+ get tc() {
3115
+ return this.qa;
3112
3116
  }
3113
3117
  get sc() {
3114
- return this.Va;
3118
+ return this.qa !== "disabled";
3115
3119
  }
3116
3120
  get ec() {
3117
- return this.Va !== "disabled";
3121
+ return this.qa === "active" || this.qa === "transitioning" || this.qa === "error";
3118
3122
  }
3119
3123
  get rc() {
3120
- return this.Va === "active" || this.Va === "transitioning" || this.Va === "error";
3124
+ return this.Va;
3121
3125
  }
3122
3126
  get nc() {
3123
3127
  return this.Ja;
3124
3128
  }
3125
- get hc() {
3126
- return this.tc;
3129
+ hc() {
3130
+ this.qa !== "done" && this.qa !== "transitioning" || (this.qa = "active");
3127
3131
  }
3128
3132
  oc() {
3129
- this.Va !== "done" && this.Va !== "transitioning" || (this.Va = "active");
3133
+ this.qa !== "disabled" && (this.qa = "done");
3130
3134
  }
3131
3135
  ac() {
3132
- this.Va !== "disabled" && (this.Va = "done");
3136
+ this.qa !== "disabled" && (this.qa = "transitioning");
3133
3137
  }
3134
3138
  cc() {
3135
- this.Va !== "disabled" && (this.Va = "transitioning");
3136
- }
3137
- lc() {
3138
- this.Va === "transitioning" && (this.Va = "done");
3139
+ this.qa === "transitioning" && (this.qa = "done");
3139
3140
  }
3140
- uc(t) {
3141
- this.Va !== "disabled" && (this.Va = "error", t instanceof Error ? (this.Ja = t.message, this.tc = t.stack || "") : (this.Ja = t, this.tc = ""));
3141
+ lc(t) {
3142
+ this.qa !== "disabled" && (this.qa = "error", t instanceof Error ? (this.Va = t.message, this.Ja = t.stack || "") : (this.Va = t, this.Ja = ""));
3142
3143
  }
3143
- fc() {
3144
- this.Va = "disabled";
3144
+ uc() {
3145
+ this.qa = "disabled";
3145
3146
  }
3146
3147
  }
3147
- class Xt {
3148
+ class It {
3148
3149
  constructor(t, e) {
3149
- a(this, "dc", 0);
3150
- a(this, "vc", 1);
3150
+ a(this, "fc", 0);
3151
+ a(this, "dc", 1);
3152
+ a(this, "vc");
3151
3153
  a(this, "gc");
3152
- a(this, "mc");
3153
- this.gc = t, this.mc = e;
3154
+ this.vc = t, this.gc = e;
3154
3155
  }
3155
- get _c() {
3156
- return this.vc;
3156
+ get mc() {
3157
+ return this.dc;
3157
3158
  }
3158
- get yc() {
3159
- return this.vc < 1;
3159
+ get _c() {
3160
+ return this.dc < 1;
3160
3161
  }
3161
- kn() {
3162
- this.gc !== "none" && this.mc > 0 && (this.dc = performance.now());
3162
+ Sn() {
3163
+ this.vc !== "none" && this.gc > 0 && (this.fc = performance.now());
3163
3164
  }
3164
3165
  et() {
3165
- if (this.gc === "none" || this.mc === 0) return this.vc = 1, !1;
3166
- const t = performance.now() - this.dc, e = Math.min(1, t / this.mc);
3167
- return e >= 1 ? (this.vc = 0, !0) : (this.vc = 1 - e, !1);
3166
+ if (this.vc === "none" || this.gc === 0) return this.dc = 1, !1;
3167
+ const t = performance.now() - this.fc, e = Math.min(1, t / this.gc);
3168
+ return e >= 1 ? (this.dc = 0, !0) : (this.dc = 1 - e, !1);
3168
3169
  }
3169
3170
  ti() {
3170
- this.vc = 1, this.dc = 0;
3171
+ this.dc = 1, this.fc = 0;
3171
3172
  }
3172
3173
  }
3173
3174
  function dt(n, t) {
@@ -3179,67 +3180,67 @@ function dt(n, t) {
3179
3180
  return 0.2126 * c(r) + 0.7152 * c(h) + 0.0722 * c(o);
3180
3181
  }(t) > 0.5 ? "light" : "dark"), { mode: i, background: t, textColor: i === "light" ? "#1A1A1A" : "#F8F8F8", subtleColor: i === "light" ? "#4A4A4A" : "#C0C0C0" };
3181
3182
  }
3182
- function It(n) {
3183
+ function Yt(n) {
3183
3184
  return n.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
3184
3185
  }
3185
- function Yt(n, t) {
3186
+ function zt(n, t) {
3186
3187
  return n.length ? n.map((e) => t.color(e)) : [t.color("#FFFFFF")];
3187
3188
  }
3188
3189
  const We = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: o, transitionOpacity: c, isError: l, errorMessage: u }) => {
3189
- const f = "|/-\\", g = Math.floor(i / 6) % 4, m = n.color(h.textColor), d = Math.floor(255 * c), v = n.color(m.r, m.g, m.b, d);
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);
3190
3191
  if (n.charColor(v), n.cellColor(0, 0, 0, 0), l) {
3191
- const A = n.color(h.mode === "light" ? "#D32F2F" : "#FF6B6B", d);
3192
+ const A = n.color(h.mode === "light" ? "#D32F2F" : "#FF6B6B", m);
3192
3193
  n.charColor(A), n.push(), n.translate(0, -2, 0), n.char("X"), n.rect(1, 1), n.pop();
3193
3194
  const p = "SETUP ERROR", y = -Math.floor(p.length / 2);
3194
3195
  n.push(), n.translate(y, 0, 0);
3195
3196
  for (const E of p) n.char(E), n.rect(1, 1), n.translateX(1);
3196
3197
  if (n.pop(), u) {
3197
- const E = n.color(h.subtleColor), x = n.color(E.r, E.g, E.b, d);
3198
+ const E = n.color(h.subtleColor), x = n.color(E.r, E.g, E.b, m);
3198
3199
  n.charColor(x);
3199
- const w = Math.floor(0.8 * t.cols), R = u.split(" "), N = [];
3200
+ const b = Math.floor(0.8 * t.cols), F = u.split(" "), U = [];
3200
3201
  let T = "";
3201
- for (const F of R) (T + " " + F).length <= w ? T = T ? T + " " + F : F : (T && N.push(T), T = F);
3202
- T && N.push(T);
3203
- const S = N.slice(0, 3);
3204
- N.length > 3 && (S[2] = S[2].substring(0, w - 3) + "..."), S.forEach((F, K) => {
3205
- const Ht = -Math.floor(F.length / 2);
3206
- n.push(), n.translate(Ht, 3 + K, 0);
3207
- for (const jt of F) n.char(jt), n.rect(1, 1), n.translateX(1);
3202
+ for (const P of F) (T + " " + P).length <= b ? T = T ? T + " " + P : P : (T && U.push(T), T = P);
3203
+ T && U.push(T);
3204
+ const Z = U.slice(0, 3);
3205
+ U.length > 3 && (Z[2] = Z[2].substring(0, b - 3) + "..."), Z.forEach((P, j) => {
3206
+ const qt = -Math.floor(P.length / 2);
3207
+ n.push(), n.translate(qt, 3 + j, 0);
3208
+ for (const Kt of P) n.char(Kt), n.rect(1, 1), n.translateX(1);
3208
3209
  n.pop();
3209
3210
  });
3210
3211
  }
3211
3212
  return;
3212
3213
  }
3213
- if (n.push(), n.translate(0, 0, 0), n.char(f[g]), n.rect(1, 1), n.pop(), e > 0 || o.some((A) => A.status !== "pending")) {
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")) {
3214
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")];
3215
3216
  n.push(), n.translate(p, 3, 0);
3216
3217
  for (let x = 0; x < A; x++) {
3217
- const w = x < y ? "*" : ".", R = E[x % E.length], N = n.color(R.r, R.g, R.b, d);
3218
- n.charColor(N), n.char(w), n.rect(1, 1), n.translateX(1);
3218
+ const b = x < y ? "*" : ".", F = E[x % E.length], U = n.color(F.r, F.g, F.b, m);
3219
+ n.charColor(U), n.char(b), n.rect(1, 1), n.translateX(1);
3219
3220
  }
3220
3221
  n.pop();
3221
3222
  }
3222
3223
  if (s) {
3223
- const A = n.color(h.subtleColor), p = n.color(A.r, A.g, A.b, d);
3224
+ const A = n.color(h.subtleColor), p = n.color(A.r, A.g, A.b, m);
3224
3225
  n.charColor(p);
3225
3226
  const y = -Math.floor(s.length / 2);
3226
3227
  n.push(), n.translate(y, 5, 0);
3227
3228
  for (const E of s) n.char(E), n.rect(1, 1), n.translateX(1);
3228
3229
  n.pop();
3229
3230
  }
3230
- }, He = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
3231
- class je {
3231
+ }, qe = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
3232
+ class Ke {
3232
3233
  constructor(t, e, i) {
3233
- this.wc = t, this.id = e, this.label = i;
3234
+ this.yc = t, this.id = e, this.label = i;
3234
3235
  }
3235
3236
  report(t) {
3236
- this.wc.Ka(this.id, t);
3237
+ this.yc.Wa(this.id, t);
3237
3238
  }
3238
3239
  complete() {
3239
- this.wc.Wa(this.id);
3240
+ this.yc.ja(this.id);
3240
3241
  }
3241
3242
  fail(t) {
3242
- this.wc.Za(this.id);
3243
+ this.yc.Ka(this.id);
3243
3244
  }
3244
3245
  async track(t) {
3245
3246
  try {
@@ -3250,122 +3251,123 @@ class je {
3250
3251
  }
3251
3252
  }
3252
3253
  }
3253
- class zt {
3254
+ class Gt {
3254
3255
  constructor(t, e, i) {
3255
- a(this, "Ca");
3256
+ a(this, "ba");
3256
3257
  a(this, "l");
3257
- a(this, "bc");
3258
3258
  a(this, "wc");
3259
+ a(this, "yc");
3260
+ a(this, "bc");
3259
3261
  a(this, "Cc");
3260
3262
  a(this, "xc");
3261
3263
  a(this, "Mc");
3262
3264
  a(this, "Fc");
3263
3265
  a(this, "Pc");
3264
- a(this, "$c");
3265
3266
  a(this, "Z");
3266
- a(this, "Tc", []);
3267
- a(this, "Rc");
3268
- a(this, "Ec", performance.now());
3269
- a(this, "Sc", 0);
3267
+ a(this, "$c", []);
3268
+ a(this, "Tc");
3269
+ a(this, "Rc", performance.now());
3270
+ a(this, "Ec", 0);
3271
+ a(this, "Sc", !1);
3270
3272
  a(this, "kc", !1);
3271
- a(this, "zc", !1);
3272
- a(this, "Ic");
3273
- this.Ca = t, this.l = { ...He, ...e ?? {} }, this.bc = new Ot("active"), this.wc = new _t(), this.Cc = new Xt(this.l.transition, this.l.transitionDuration), this.xc = new Lt(60), this.Rc = dt(this.l, i);
3274
- const s = It(this.Rc);
3275
- this.Tc = Yt(s, this.Ca), this.Z = this.Dc(), this.wc.Ya((r) => {
3276
- r >= 0.999 && this.ac();
3273
+ a(this, "Oc");
3274
+ this.ba = t, this.l = { ...qe, ...e ?? {} }, this.wc = new Xt("active"), this.yc = new Bt(), this.bc = new It(this.l.transition, this.l.transitionDuration), this.Cc = new Lt(60), this.Tc = dt(this.l, i);
3275
+ const s = Yt(this.Tc);
3276
+ this.$c = zt(s, this.ba), this.Z = this.zc(), this.yc.Xa((r) => {
3277
+ r >= 0.999 && this.oc();
3277
3278
  });
3278
3279
  }
3279
3280
  async yr(t) {
3280
- if (this.zc) return;
3281
- const e = this.Ca.Z, i = this.Ca.Er;
3282
- this.Mc = new vt(e, 16), await this.Mc.yr(t);
3283
- const s = this.Mc.maxGlyphDimensions;
3284
- this.Fc = new Ut(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;
3281
+ if (this.kc) return;
3282
+ const e = this.ba.Z, i = this.ba.Er;
3283
+ this.xc = new mt(e, 16), await this.xc.yr(t);
3284
+ const s = this.xc.maxGlyphDimensions;
3285
+ this.Mc = new St(i.canvas, s.width, s.height), this.Fc = e.Pe(this.Mc.cols, this.Mc.rows, 3), this.Pc = e.Pe(this.Mc.width, this.Mc.height, 1), this.kc = !0;
3285
3286
  }
3286
- get rc() {
3287
- return this.bc.rc && this.kc;
3287
+ get ec() {
3288
+ return this.wc.ec && this.Sc;
3288
3289
  }
3289
- kn() {
3290
- this.kc || (this.kc = !0, this.Ec = performance.now(), this.Sc = 0, this.xc.kn(() => this.Lc()));
3290
+ Sn() {
3291
+ this.Sc || (this.Sc = !0, this.Rc = performance.now(), this.Ec = 0, this.Cc.Sn(() => this.Dc()));
3291
3292
  }
3292
- zn() {
3293
- this.kc && (this.kc = !1, this.xc.zn());
3293
+ kn() {
3294
+ this.Sc && (this.Sc = !1, this.Cc.kn());
3294
3295
  }
3295
3296
  Xr() {
3296
- this.zc && (this.Fc.ti(), this.Pc.resize(this.Fc.cols, this.Fc.rows), this.$c.resize(this.Fc.width, this.Fc.height));
3297
+ this.kc && (this.Mc.ti(), this.Fc.resize(this.Mc.cols, this.Mc.rows), this.Pc.resize(this.Mc.width, this.Mc.height));
3297
3298
  }
3298
3299
  gt() {
3299
- this.zn(), this.zc && (this.Mc.gt(), this.Pc.gt(), this.$c.gt(), this.zc = !1);
3300
+ this.kn(), this.kc && (this.xc.gt(), this.Fc.gt(), this.Pc.gt(), this.kc = !1);
3300
3301
  }
3301
3302
  get progress() {
3302
- return this.wc.Xa;
3303
+ return this.yc.Na;
3303
3304
  }
3304
3305
  message(t) {
3305
3306
  return typeof t == "string" && (this.l.message = t), this.l.message;
3306
3307
  }
3307
3308
  addPhase(t, e = 1) {
3308
- this.bc.oc();
3309
- const i = this.wc.ja(t, e);
3310
- return new je(this.wc, i, t);
3309
+ this.wc.hc();
3310
+ const i = this.yc.Ya(t, e);
3311
+ return new Ke(this.yc, i, t);
3311
3312
  }
3312
- ac() {
3313
- this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.bc.cc(), this.Cc.kn()) : (this.bc.ac(), this.zn(), this.Oc());
3313
+ oc() {
3314
+ this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.wc.ac(), this.bc.Sn()) : (this.wc.oc(), this.kn(), this.Lc());
3314
3315
  }
3315
- Oc() {
3316
- this.Ic && this.Ic();
3316
+ Lc() {
3317
+ this.Oc && this.Oc();
3317
3318
  }
3318
- Bc(t) {
3319
- this.Ic = t;
3319
+ Ic(t) {
3320
+ this.Oc = t;
3320
3321
  }
3321
3322
  error(t) {
3322
- this.bc.uc(t);
3323
+ this.wc.lc(t);
3323
3324
  }
3324
- Lc() {
3325
- if (this.bc.rc) {
3326
- if (this.Sc++, this.bc.sc === "transitioning" && this.Cc.et())
3327
- return this.bc.lc(), this.Oc(), void this.zn();
3328
- this.Hc();
3325
+ Dc() {
3326
+ if (this.wc.ec) {
3327
+ if (this.Ec++, this.wc.tc === "transitioning" && this.bc.et())
3328
+ return this.wc.cc(), this.Lc(), void this.kn();
3329
+ this.Bc();
3329
3330
  }
3330
3331
  }
3331
- Hc() {
3332
- if (!this.zc) return;
3333
- const t = this.Pc, e = this.Mc, i = this.Fc, s = this.$c, r = this.Ca.Z, h = this.Ca.Er, o = this.Ca.Gc, c = this.Ca.Qc;
3334
- r.state.qt(), t.begin(), this.Ca.clear(), this.Ca.push();
3332
+ Bc() {
3333
+ if (!this.kc) return;
3334
+ const t = this.Fc, e = this.xc, i = this.Mc, s = this.Pc, r = this.ba.Z, h = this.ba.Er, o = this.ba.Hc, c = this.ba.Gc;
3335
+ r.state.qt(), t.begin(), this.ba.clear(), this.ba.push();
3335
3336
  try {
3336
- 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.wc.qa(), transitionOpacity: this.Cc._c, isError: this.bc.sc === "error", errorMessage: this.bc.nc || void 0, errorDetails: this.bc.hc || void 0 };
3337
+ const l = { textmodifier: this.ba, grid: i, progress: this.progress, elapsedMs: performance.now() - this.Rc, frameCount: this.Ec, message: this.l.message, palette: this.$c, theme: this.Tc, phases: this.yc.Za(), transitionOpacity: this.bc.mc, isError: this.wc.tc === "error", errorMessage: this.wc.rc || void 0, errorDetails: this.wc.nc || void 0 };
3337
3338
  this.Z(l);
3338
3339
  } finally {
3339
- this.Ca.pop();
3340
+ this.ba.pop();
3340
3341
  }
3341
- t.end(), s.begin(), r.ve(o), o.O({ u_characterTexture: e.fontFramebuffer, u_charsetDimensions: [e.textureColumns, e.textureRows], Uk: t.textures[0], Ul: t.textures[1], Um: t.textures[2], Un: [i.cols, i.rows], Uo: [s.width, s.height], Up: r.state.canvasBackgroundColor }), r.Ae(0, 0, h.width, h.height), s.end(), r.wi(...r.state.canvasBackgroundColor), r.ve(c), c.O({ U0: s.textures[0], U1: [s.width, s.height], U2: [i.offsetX, i.offsetY], U3: [i.width, i.height] }), r.Ae(i.offsetX, i.offsetY, i.width, i.height);
3342
+ t.end(), s.begin(), r.ve(o), o.O({ u_characterTexture: e.fontFramebuffer, u_charsetDimensions: [e.textureColumns, e.textureRows], Ue: t.textures[0], Uc: t.textures[1], Ud: t.textures[2], Uf: [i.cols, i.rows], Ug: [s.width, s.height], Uh: r.state.canvasBackgroundColor }), r.Ae(0, 0, h.width, h.height), s.end(), r.wi(...r.state.canvasBackgroundColor), r.ve(c), c.O({ Ui: s.textures[0], Uj: [s.width, s.height], Uk: [i.offsetX, i.offsetY], Ul: [i.width, i.height] }), r.Ae(i.offsetX, i.offsetY, i.width, i.height);
3342
3343
  }
3343
- Nc(t) {
3344
- this.Rc = dt(this.l, t);
3344
+ Qc(t) {
3345
+ this.Tc = dt(this.l, t);
3345
3346
  }
3346
- Dc() {
3347
+ zc() {
3347
3348
  const t = this.l.renderer || We;
3348
3349
  return (e) => {
3349
- t(e), this.Xc(e);
3350
+ t(e), this.Nc(e);
3350
3351
  };
3351
3352
  }
3352
- Xc(t) {
3353
+ Nc(t) {
3353
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]];
3354
3355
  e.push(), e.translate(l, c, 0);
3355
3356
  for (let f = 0; f < o.length; f++) {
3356
- const g = o[f], m = Math.floor(0.1 * s + 0.5 * f) % u.length, [d, v, A] = u[m], p = Math.floor(255 * h), y = e.color(d, v, A, p);
3357
- e.charColor(y), e.char(g), 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);
3358
3359
  }
3359
3360
  e.pop();
3360
3361
  }
3361
3362
  }
3362
3363
  class gt {
3363
3364
  constructor(t = {}) {
3365
+ a(this, "Xc");
3366
+ a(this, "mc");
3364
3367
  a(this, "Yc");
3365
- a(this, "_c");
3368
+ a(this, "Wc");
3366
3369
  a(this, "jc");
3367
3370
  a(this, "Kc");
3368
- a(this, "Wc");
3369
3371
  a(this, "Zc");
3370
3372
  a(this, "qc");
3371
3373
  a(this, "Vc");
@@ -3374,7 +3376,7 @@ class gt {
3374
3376
  a(this, "sl", !1);
3375
3377
  a(this, "il", !0);
3376
3378
  a(this, "el", []);
3377
- this.Yc = t.visible ?? !0, this._c = Math.min(1, Math.max(0, t.opacity ?? 1)), this.jc = t.blendMode ?? "normal", this.Kc = Math.round(t.offsetX ?? 0), this.Wc = Math.round(t.offsetY ?? 0);
3379
+ this.Xc = t.visible ?? !0, this.mc = Math.min(1, Math.max(0, t.opacity ?? 1)), this.Yc = t.blendMode ?? "normal", this.Wc = Math.round(t.offsetX ?? 0), this.jc = Math.round(t.offsetY ?? 0), this.Kc = t.rotation ?? 0;
3378
3380
  }
3379
3381
  rl() {
3380
3382
  return this.tl !== null;
@@ -3390,22 +3392,26 @@ class gt {
3390
3392
  this.tl = t;
3391
3393
  }
3392
3394
  show() {
3393
- this.Yc = !0;
3395
+ this.Xc = !0;
3394
3396
  }
3395
3397
  hide() {
3396
- this.Yc = !1;
3398
+ this.Xc = !1;
3397
3399
  }
3398
3400
  opacity(t) {
3399
- if (t === void 0) return this._c;
3400
- this._c = Math.min(1, Math.max(0, t));
3401
+ if (t === void 0) return this.mc;
3402
+ this.mc = Math.min(1, Math.max(0, t));
3401
3403
  }
3402
3404
  blendMode(t) {
3403
- if (t === void 0) return this.jc;
3404
- this.jc = t;
3405
+ if (t === void 0) return this.Yc;
3406
+ this.Yc = t;
3405
3407
  }
3406
3408
  offset(t, e = 0) {
3407
- if (t === void 0) return { x: this.Kc, y: this.Wc };
3408
- this.Kc = Math.round(t), this.Wc = Math.round(e);
3409
+ if (t === void 0) return { x: this.Wc, y: this.jc };
3410
+ this.Wc = Math.round(t), this.jc = Math.round(e);
3411
+ }
3412
+ rotateZ(t) {
3413
+ if (t === void 0) return this.Kc;
3414
+ this.Kc = t;
3409
3415
  }
3410
3416
  filter(t, e) {
3411
3417
  this.el.push({ name: t, params: e });
@@ -3413,12 +3419,12 @@ class gt {
3413
3419
  ol(t) {
3414
3420
  this.Zc = t, this.al(t.grid);
3415
3421
  }
3416
- wa(t, e) {
3417
- if (!this.Yc || !this.tl) return void (this.sl = !1);
3422
+ ya(t, e) {
3423
+ if (!this.Xc || !this.tl) return void (this.sl = !1);
3418
3424
  const i = this.Zc.renderer;
3419
3425
  this.el = [], this.qc.begin(), i.state.qt(), this.tl.call(t), this.qc.end();
3420
3426
  const s = this.el.length > 0, r = s ? this.Jc : this.Vc;
3421
- r.begin(), i.ve(e), e.O({ u_characterTexture: this.Zc.font.fontFramebuffer, u_charsetDimensions: [this.Zc.font.textureColumns, this.Zc.font.textureRows], Uk: this.qc.textures[0], Ul: this.qc.textures[1], Um: this.qc.textures[2], Un: [this.Zc.grid.cols, this.Zc.grid.rows], Uo: [r.width, r.height], Up: [0, 0, 0, 0] }), i.Ae(0, 0, this.Zc.grid.width, this.Zc.grid.height), r.end(), s && this.Zc.filterManager.cl(this.Jc.textures[0], this.Vc, this.el, this.Vc.width, this.Vc.height, this.Zc.layerPingPongBuffers), this.sl = !0;
3427
+ r.begin(), i.ve(e), e.O({ u_characterTexture: this.Zc.font.fontFramebuffer, u_charsetDimensions: [this.Zc.font.textureColumns, this.Zc.font.textureRows], Ue: this.qc.textures[0], Uc: this.qc.textures[1], Ud: this.qc.textures[2], Uf: [this.Zc.grid.cols, this.Zc.grid.rows], Ug: [r.width, r.height], Uh: [0, 0, 0, 0] }), i.Ae(0, 0, this.Zc.grid.width, this.Zc.grid.height), r.end(), s && this.Zc.filterManager.cl(this.Jc.textures[0], this.Vc, this.el, this.Vc.width, this.Vc.height, this.Zc.layerPingPongBuffers), this.sl = !0;
3422
3428
  }
3423
3429
  Xr(t) {
3424
3430
  var e;
@@ -3449,44 +3455,44 @@ class gt {
3449
3455
  }
3450
3456
  }
3451
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 };
3452
- class Vt {
3458
+ class Qt {
3453
3459
  constructor(t) {
3454
3460
  a(this, "Z");
3455
3461
  a(this, "ul");
3456
3462
  a(this, "fl", null);
3457
3463
  a(this, "dl", 0);
3458
- this.Z = t, this.ul = t.pe(Q, `#version 300 es
3459
- precision highp float;uniform sampler2D Uq;uniform sampler2D Ur;uniform vec2 Us;uniform float Ut;uniform vec2 Uu;uniform int Uv;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(Ur,v_uv);vec2 h=v_uv*Us-Uu;bool i=any(lessThan(h,vec2(0.)))||any(greaterThanEqual(h,Us));if(i){fragColor=g;return;}vec2 j=(floor(h)+0.5)/Us;vec4 k=texture(Uq,j);float l=k.a*Ut;if(l<=0.){fragColor=g;return;}vec3 m=e(Uv,g.rgb,k.rgb);vec3 n=mix(g.rgb,m,l);float o=g.a+l*(1.-g.a);fragColor=vec4(n,o);}`);
3464
+ this.Z = t, this.ul = t.pe(K, `#version 300 es
3465
+ precision highp float;uniform sampler2D Uq;uniform sampler2D Ur;uniform vec2 Us;uniform vec2 Ut;uniform vec2 Uu;uniform float Uv;uniform vec2 Uw;uniform float Ux;uniform int Uy;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(Ur,v_uv);vec2 h=v_uv*Us;vec2 i=h-Uu-Uw;vec2 j=Ut*0.5;vec2 k=i-j;float l=cos(-Ux);float m=sin(-Ux);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,Ut));if(o){fragColor=g;return;}vec2 p=(floor(i)+0.5)/Ut;vec4 q=texture(Uq,p);float r=q.a*Uv;if(r<=0.){fragColor=g;return;}vec3 s=e(Uy,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`);
3460
3466
  }
3461
- yr(t) {
3462
- this.fl || (this.fl = [this.Z.Pe(t.width, t.height, 1), this.Z.Pe(t.width, t.height, 1)]);
3467
+ yr(t, e) {
3468
+ this.fl || (this.fl = [this.Z.Pe(t, e, 1), this.Z.Pe(t, e, 1)]);
3463
3469
  }
3464
- vl(t, e) {
3465
- const i = this.Z.context, { baseTexture: s, targetFramebuffer: r, backgroundColor: h, baseLayer: o, layers: c } = t, l = i.isEnabled(i.DEPTH_TEST), u = i.getParameter(i.DEPTH_WRITEMASK);
3466
- l && i.disable(i.DEPTH_TEST), u && i.depthMask(!1);
3467
- const f = e.width, g = e.height, m = this.fl[0];
3468
- m.begin(), this.Z.wi(...h), m.end(), this.dl = 0, o.Yc && this.pl(s, f, g, o._c, o.Kc, o.Wc, "normal", i);
3469
- for (const d of c) d.Yc && d.ll && this.pl(d.texture, d.width, d.height, d._c, d.Kc, d.Wc, d.jc, i);
3470
- this.ml(r, f, g, i), i.depthMask(u), l && i.enable(i.DEPTH_TEST);
3470
+ vl(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.fl[0];
3474
+ A.begin(), this.Z.wi(...r), A.end(), this.dl = 0, h.Xc && this.pl(i, c, l, u, f, h.mc, d + h.Wc, g + h.jc, h.Kc, "normal", e);
3475
+ for (const p of o) p.Xc && p.ll && this.pl(p.texture, c, l, p.width, p.height, p.mc, d + p.Wc, g + p.jc, p.Kc, p.Yc, e);
3476
+ this.ml(s, c, l, e), e.depthMask(v), m && e.enable(e.DEPTH_TEST);
3471
3477
  }
3472
- pl(t, e, i, s, r, h, o, c) {
3473
- const l = this.fl[this.dl], u = this.dl === 0 ? 1 : 0, f = this.fl[u];
3474
- f.begin(), c.disable(c.BLEND), this.Z.ve(this.ul), this.ul.O({ Uq: t, Ur: l.textures[0], Us: [e, i], Ut: s, Uu: [r, h], Uv: xt[o] }), this.Z.Ae(0, 0, l.width, l.height), f.end(), this.dl = u;
3478
+ pl(t, e, i, s, r, h, o, c, l, u, f) {
3479
+ const d = this.fl[this.dl], g = this.dl === 0 ? 1 : 0, m = this.fl[g], v = l * (Math.PI / 180);
3480
+ m.begin(), f.disable(f.BLEND), this.Z.ve(this.ul), this.ul.O({ Uq: t, Ur: d.textures[0], Us: [e, i], Ut: [s, r], Uu: [o, c], Uv: h, Uw: [0, 0], Ux: v, Uy: xt[u] }), this.Z.Ae(0, 0, d.width, d.height), m.end(), this.dl = g;
3475
3481
  }
3476
3482
  ml(t, e, i, s) {
3477
3483
  const r = this.fl[this.dl];
3478
- t.begin(), s.disable(s.BLEND), this.Z.ve(this.ul), this.ul.O({ Uq: r.textures[0], Ur: r.textures[0], Us: [r.width, r.height], Ut: 1, Uu: [0, 0], Uv: xt.normal }), this.Z.Ae(0, 0, e, i), t.end();
3484
+ t.begin(), s.disable(s.BLEND), this.Z.ve(this.ul), this.ul.O({ Uq: r.textures[0], Ur: r.textures[0], Us: [e, i], Ut: [r.width, r.height], Uu: [0, 0], Uv: 1, Uw: [0, 0], Ux: 0, Uy: xt.normal }), this.Z.Ae(0, 0, e, i), t.end();
3479
3485
  }
3480
- Xr(t) {
3481
- this.fl && (this.fl[0].resize(t.width, t.height), this.fl[1].resize(t.width, t.height));
3486
+ Xr(t, e) {
3487
+ this.fl && (this.fl[0].resize(t, e), this.fl[1].resize(t, e));
3482
3488
  }
3483
3489
  gt() {
3484
3490
  this.ul.dispose(), this.fl && (this.fl[0].gt(), this.fl[1].gt(), this.fl = null);
3485
3491
  }
3486
3492
  }
3487
- class Gt {
3493
+ class kt {
3488
3494
  constructor(t) {
3489
- a(this, "Ca");
3495
+ a(this, "ba");
3490
3496
  a(this, "Z");
3491
3497
  a(this, "_l");
3492
3498
  a(this, "yl");
@@ -3497,7 +3503,7 @@ class Gt {
3497
3503
  a(this, "xl");
3498
3504
  a(this, "Ml");
3499
3505
  a(this, "Fl", !1);
3500
- this.Ca = t, this.Z = t.Z, this._l = t.Gc, this.yl = new Vt(this.Z), this.bl = new gt({ visible: !0, opacity: 1 });
3506
+ this.ba = t, this.Z = t.Z, this._l = t.Hc, this.yl = new Qt(this.Z), this.bl = new gt({ visible: !0, opacity: 1 });
3501
3507
  }
3502
3508
  add(t = {}) {
3503
3509
  const e = new gt(t);
@@ -3514,27 +3520,28 @@ class Gt {
3514
3520
  }
3515
3521
  yr() {
3516
3522
  if (this.Fl) return;
3517
- const t = this.Ca.Nn;
3518
- this.Cl = this.Z.Pe(t.width, t.height, 1), this.xl = this.Z.Pe(t.width, t.height, 1), this.Ml = [this.Z.Pe(t.width, t.height, 1, { depth: !1 }), this.Z.Pe(t.width, t.height, 1, { depth: !1 })], this.El(), this.yl.yr(t);
3523
+ const t = this.ba.Qn;
3524
+ this.Cl = this.Z.Pe(t.width, t.height, 1), this.xl = this.Z.Pe(t.width, t.height, 1), this.Ml = [this.Z.Pe(t.width, t.height, 1, { depth: !1 }), this.Z.Pe(t.width, t.height, 1, { depth: !1 })], this.El(), this.yl.yr(this.ba.Er.width, this.ba.Er.height);
3519
3525
  for (const e of this.Al) this.Pl(e), this.wl.push(e);
3520
3526
  this.Al.length = 0, this.Fl = !0;
3521
3527
  }
3522
3528
  Sl(t, e) {
3523
- const i = this.Ca.Nn, s = this.Ca.font, r = this.Ca.ga, h = this.bl.nl(), o = h.length > 0, c = o ? this.xl : this.Cl;
3524
- c.begin(), this.Z.ve(this._l), this._l.O({ u_characterTexture: s.fontFramebuffer, u_charsetDimensions: [s.textureColumns, s.textureRows], Uk: r.textures[0], Ul: r.textures[1], Um: r.textures[2], Un: [i.cols, i.rows], Uo: [c.width, c.height], Up: this.Z.state.canvasBackgroundColor }), this.Z.Ae(0, 0, i.width, i.height), c.end(), o && this.Ca.kl.cl(this.xl.textures[0], this.Cl, h, this.Cl.width, this.Cl.height, this.Ml), this.zl(), this.Dl(t, e);
3529
+ const i = this.ba.Qn, s = this.ba.font, r = this.ba.va, h = this.bl.nl(), o = h.length > 0, c = o ? this.xl : this.Cl;
3530
+ c.begin(), this.Z.ve(this._l), this._l.O({ u_characterTexture: s.fontFramebuffer, u_charsetDimensions: [s.textureColumns, s.textureRows], Ue: r.textures[0], Uc: r.textures[1], Ud: r.textures[2], Uf: [i.cols, i.rows], Ug: [c.width, c.height], Uh: this.Z.state.canvasBackgroundColor }), this.Z.Ae(0, 0, i.width, i.height), c.end(), o && this.ba.kl.cl(this.xl.textures[0], this.Cl, h, this.Cl.width, this.Cl.height, this.Ml), this.zl(), this.Dl(t, e);
3525
3531
  }
3526
3532
  zl() {
3527
- if (this.wl.length !== 0) for (const t of this.wl) t.wa(this.Ca, this._l);
3533
+ if (this.wl.length !== 0) for (const t of this.wl) t.ya(this.ba, this._l);
3528
3534
  }
3529
3535
  Dl(t, e) {
3530
- this.yl.vl({ baseTexture: this.Cl.textures[0], targetFramebuffer: t, backgroundColor: e, baseLayer: this.bl, layers: this.wl }, this.Ca.Nn);
3536
+ const i = this.ba.Qn, s = this.ba.Er;
3537
+ this.yl.vl({ baseTexture: this.Cl.textures[0], targetFramebuffer: t, backgroundColor: e, baseLayer: this.bl, layers: this.wl, canvasWidth: s.width, canvasHeight: s.height, gridWidth: i.width, gridHeight: i.height, baseOffsetX: i.offsetX, baseOffsetY: i.offsetY });
3531
3538
  }
3532
3539
  Xr() {
3533
3540
  if (!this.Fl) return;
3534
- const t = this.Ca.Nn;
3541
+ const t = this.ba.Qn;
3535
3542
  this.Cl.resize(t.width, t.height), this.xl.resize(t.width, t.height), this.bl.Xr(t), this.Ml && (this.Ml[0].resize(t.width, t.height), this.Ml[1].resize(t.width, t.height));
3536
3543
  for (const e of this.wl) e.Xr(t);
3537
- this.yl.Xr(t);
3544
+ this.yl.Xr(this.ba.Er.width, this.ba.Er.height);
3538
3545
  }
3539
3546
  gt() {
3540
3547
  var t, e, i, s;
@@ -3549,11 +3556,11 @@ class Gt {
3549
3556
  return this.bl;
3550
3557
  }
3551
3558
  Pl(t) {
3552
- const e = { renderer: this.Z, grid: this.Ca.Nn, font: this.Ca.font, filterManager: this.Ca.kl, layerPingPongBuffers: this.Ml, createFramebuffer: (i, s, r = 1) => this.Z.Pe(i, s, r) };
3559
+ const e = { renderer: this.Z, grid: this.ba.Qn, font: this.ba.font, filterManager: this.ba.kl, layerPingPongBuffers: this.Ml, createFramebuffer: (i, s, r = 1) => this.Z.Pe(i, s, r) };
3553
3560
  t.ol(e);
3554
3561
  }
3555
3562
  El() {
3556
- const t = { renderer: this.Z, grid: this.Ca.Nn, font: this.Ca.font, filterManager: this.Ca.kl, layerPingPongBuffers: this.Ml, createFramebuffer: (e, i, s = 1) => this.Z.Pe(e, i, s), externalDrawFramebuffer: this.Ca.ga, externalAsciiFramebuffer: this.Cl };
3563
+ const t = { renderer: this.Z, grid: this.ba.Qn, font: this.ba.font, filterManager: this.ba.kl, layerPingPongBuffers: this.Ml, createFramebuffer: (e, i, s = 1) => this.Z.Pe(e, i, s), externalDrawFramebuffer: this.ba.va, externalAsciiFramebuffer: this.Cl };
3557
3564
  this.bl.ol(t);
3558
3565
  }
3559
3566
  $l(t, e) {
@@ -3576,7 +3583,7 @@ class Gt {
3576
3583
  return r !== -1 && (t[s] = i, t[r] = e, !0);
3577
3584
  }
3578
3585
  }
3579
- class kt {
3586
+ class Ht {
3580
3587
  constructor(t) {
3581
3588
  a(this, "Z");
3582
3589
  a(this, "Ll", /* @__PURE__ */ new Map());
@@ -3593,13 +3600,13 @@ class kt {
3593
3600
  if (!l.ok) throw Error(`Failed to load shader from ${e}: ${l.statusText}`);
3594
3601
  c = await l.text();
3595
3602
  }
3596
- h = this.Z.pe(Q, c), this.Ol.set(t, h);
3603
+ h = this.Z.pe(K, c), this.Ol.set(t, h);
3597
3604
  } else h = e, this.Ol.set(t, h);
3598
3605
  const o = { id: t, createShader: () => h, createUniforms: (c, l) => {
3599
3606
  const u = { u_resolution: [l.width, l.height] };
3600
- for (const [f, [g, m]] of s) {
3601
- let d = m;
3602
- c != null && (typeof c == "number" && g === r ? d = c : typeof c == "object" && g in c && (d = c[g] ?? m)), u[f] = d;
3607
+ for (const [f, [d, g]] of s) {
3608
+ let m = g;
3609
+ c != null && (typeof c == "number" && d === r ? m = c : typeof c == "object" && d in c && (m = c[d] ?? g)), u[f] = m;
3603
3610
  }
3604
3611
  return u;
3605
3612
  } };
@@ -3619,9 +3626,9 @@ class kt {
3619
3626
  Il() {
3620
3627
  this.Bl("invert", `#version 300 es
3621
3628
  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.Bl("grayscale", `#version 300 es
3622
- precision highp float;uniform sampler2D u_texture;uniform float U5;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),U5);fragColor=vec4(C,A.a);}`, { U5: ["amount", 1] }), this.Bl("sepia", `#version 300 es
3623
- precision highp float;uniform sampler2D u_texture;uniform float U5;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,U5);fragColor=vec4(C,A.a);}`, { U5: ["amount", 1] }), this.Bl("threshold", `#version 300 es
3624
- precision highp float;uniform sampler2D u_texture;uniform float U8;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));float C=step(U8,B);fragColor=vec4(vec3(C),A.a);}`, { U8: ["threshold", 0.5] });
3629
+ precision highp float;uniform sampler2D u_texture;uniform float Um;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));vec3 C=mix(A.rgb,vec3(B),Um);fragColor=vec4(C,A.a);}`, { Um: ["amount", 1] }), this.Bl("sepia", `#version 300 es
3630
+ precision highp float;uniform sampler2D u_texture;uniform float Um;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);vec3 B;B.r=dot(A.rgb,vec3(0.393,0.769,0.189));B.g=dot(A.rgb,vec3(0.349,0.686,0.168));B.b=dot(A.rgb,vec3(0.272,0.534,0.131));vec3 C=mix(A.rgb,B,Um);fragColor=vec4(C,A.a);}`, { Um: ["amount", 1] }), this.Bl("threshold", `#version 300 es
3631
+ precision highp float;uniform sampler2D u_texture;uniform float Up;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(Up,B);fragColor=vec4(vec3(C),A.a);}`, { Up: ["threshold", 0.5] });
3625
3632
  }
3626
3633
  }
3627
3634
  class Wt {
@@ -3630,10 +3637,9 @@ class Wt {
3630
3637
  a(this, "Ol", /* @__PURE__ */ new Map());
3631
3638
  a(this, "J");
3632
3639
  a(this, "fl");
3633
- a(this, "zc", !1);
3640
+ a(this, "kc", !1);
3634
3641
  a(this, "Ql");
3635
- this.Z = t, this.Ql = new kt(this.Z), this.J = t.pe(Q, `#version 300 es
3636
- precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`);
3642
+ this.Z = t, this.Ql = new Ht(this.Z), this.J = t.pe(K, _t);
3637
3643
  }
3638
3644
  async register(t, e, i = {}) {
3639
3645
  await this.Ql.Bl(t, e, i);
@@ -3645,7 +3651,7 @@ precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColo
3645
3651
  return this.Ql.Gl(t) !== void 0;
3646
3652
  }
3647
3653
  yr(t, e) {
3648
- this.zc || (this.fl = [this.Z.Pe(t, e, 1, { depth: !1 }), this.Z.Pe(t, e, 1, { depth: !1 })], this.zc = !0);
3654
+ this.kc || (this.fl = [this.Z.Pe(t, e, 1, { depth: !1 }), this.Z.Pe(t, e, 1, { depth: !1 })], this.kc = !0);
3649
3655
  }
3650
3656
  Nl(t, e, i, s, r) {
3651
3657
  this.fl[0].width === s && this.fl[0].height === r || (this.fl[0].resize(s, r), this.fl[1].resize(s, r)), this.cl(t, e, i, s, r, this.fl);
@@ -3656,20 +3662,20 @@ precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColo
3656
3662
  o.disable(o.BLEND), this.Xl(t, h[0], s, r);
3657
3663
  let l = 0;
3658
3664
  for (let u = 0; u < i.length; u++) {
3659
- const f = i[u], g = u === i.length - 1, m = l === 0 ? 1 : 0, d = g ? e : h[m];
3660
- this.Yl(f, h[l], d, s, r), g || (l = m);
3665
+ const f = i[u], d = u === i.length - 1, g = l === 0 ? 1 : 0, m = d ? e : h[g];
3666
+ this.Yl(f, h[l], m, s, r), d || (l = g);
3661
3667
  }
3662
3668
  c && o.enable(o.BLEND);
3663
3669
  }
3664
3670
  Yl(t, e, i, s, r) {
3665
3671
  const h = this.Ql.Gl(t.name);
3666
3672
  if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.Xl(e.textures[0], i, s, r);
3667
- const o = this.jl(t.name, h, s, r), c = { renderer: this.Z, gl: this.Z.context, width: s, height: r };
3673
+ const o = this.Wl(t.name, h, s, r), c = { renderer: this.Z, gl: this.Z.context, width: s, height: r };
3668
3674
  i.begin(), this.Z.ve(o), o.O({ u_texture: e.textures[0] });
3669
3675
  const l = h.createUniforms(t.params, c);
3670
3676
  o.O(l), this.Z.Ae(0, 0, s, r), i.end();
3671
3677
  }
3672
- jl(t, e, i, s) {
3678
+ Wl(t, e, i, s) {
3673
3679
  let r = this.Ol.get(t);
3674
3680
  if (!r && e) {
3675
3681
  const h = { renderer: this.Z, gl: this.Z.context, width: i, height: s };
@@ -3685,111 +3691,110 @@ precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColo
3685
3691
  }
3686
3692
  gt() {
3687
3693
  for (const t of this.Ol.values()) t.dispose();
3688
- this.Ol.clear(), this.J.dispose(), this.Ql.gt(), this.fl && (this.fl[0].gt(), this.fl[1].gt()), this.zc = !1;
3694
+ this.Ol.clear(), this.J.dispose(), this.Ql.gt(), this.fl && (this.fl[0].gt(), this.fl[1].gt()), this.kc = !1;
3689
3695
  }
3690
3696
  }
3691
- const $e = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: kt, TextmodeFilterManager: Wt }, Symbol.toStringTag, { value: "Module" }));
3692
- class Qe extends function(e, ...i) {
3697
+ const ti = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: Ht, TextmodeFilterManager: Wt }, Symbol.toStringTag, { value: "Module" }));
3698
+ class je extends function(e, ...i) {
3693
3699
  return i.reduce((s, r) => r(s), e);
3694
3700
  }(class {
3695
- }, Xe, Ie, Ye, ze, Ve, Ge) {
3701
+ }, Ie, Ye, ze, Ge, Qe, ke) {
3696
3702
  constructor(e = {}) {
3697
3703
  super();
3698
3704
  a(this, "Z");
3699
3705
  a(this, "rr");
3700
3706
  a(this, "Er");
3701
- a(this, "Nn");
3702
- a(this, "ya");
3703
- a(this, "Yh");
3704
- a(this, "ma");
3705
- a(this, "ba");
3706
- a(this, "Kl");
3707
+ a(this, "Qn");
3708
+ a(this, "_a");
3709
+ a(this, "Xh");
3707
3710
  a(this, "ga");
3711
+ a(this, "wa");
3712
+ a(this, "jl");
3713
+ a(this, "va");
3714
+ a(this, "Hc");
3715
+ a(this, "Da");
3708
3716
  a(this, "Gc");
3709
- a(this, "La");
3710
- a(this, "Qc");
3711
- a(this, "Wl");
3717
+ a(this, "pa");
3712
3718
  a(this, "kl");
3713
- a(this, "Zl", []);
3719
+ a(this, "Kl", []);
3720
+ a(this, "Zl");
3714
3721
  a(this, "ql");
3715
3722
  a(this, "Vl");
3716
- a(this, "Jl");
3723
+ a(this, "Jl", !1);
3717
3724
  a(this, "tu", !1);
3718
3725
  a(this, "su", !1);
3719
3726
  a(this, "iu", !1);
3720
- a(this, "eu", !1);
3721
- a(this, "ru", () => {
3727
+ a(this, "eu", () => {
3722
3728
  });
3723
3729
  a(this, "tl", () => {
3724
3730
  });
3725
- a(this, "nu", () => {
3731
+ a(this, "ru", () => {
3726
3732
  });
3733
+ a(this, "nu");
3727
3734
  a(this, "hu");
3728
- a(this, "ou");
3729
3735
  a(this, "Lr", !1);
3730
- a(this, "au");
3731
- a(this, "_a", /* @__PURE__ */ new Set());
3732
- this.Jl = new ke(this), this.Lr = e.overlay ?? !1, this.Er = new Se(e), this.Z = new ve(this.Er.Yr()), this.rr = new vt(this.Z, e.fontSize ?? 16), this.ya = new Lt(e.frameRate ?? 60), this.Kl = new zt(this, e.loadingScreen, this.Er.Nr()), this.Kl.Bc(() => {
3733
- this.ya.Gn = 0, this.eu = !0;
3734
- }), this.Yh = new Dt(this.Er), this.ma = new Bt(this.Er, this.Yh), this.ba = new Zt(), this.Gc = this.Z.pe(Q, `#version 300 es
3735
- precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D Ul;uniform sampler2D Um;uniform sampler2D Uk;uniform vec2 Un;uniform vec2 Uo;uniform vec4 Up;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/Uo;vec2 F=E*Un;vec2 G=floor(F);vec2 H=(G+0.5)/Un;vec4 I=texture(Ul,H);vec4 J=texture(Um,H);vec4 K=texture(Uk,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(Up,J,J.a);fragColor=mix(d,I,c);}`), this.Wl = new Gt(this), this.kl = new Wt(this.Z), this.Kl.kn(), this.cu(e);
3736
- }
3737
- async cu(e) {
3738
- await Promise.all([this.rr.yr(e.fontSource), this.Kl.yr(e.fontSource)]);
3736
+ a(this, "ou");
3737
+ a(this, "ma", /* @__PURE__ */ new Set());
3738
+ this.Vl = new He(this), this.Lr = e.overlay ?? !1, this.Er = new Le(e), this.Z = new pe(this.Er.Yr()), this.rr = new mt(this.Z, e.fontSize ?? 16), this._a = new Lt(e.frameRate ?? 60), this.jl = new Gt(this, e.loadingScreen, this.Er.Nr()), this.jl.Ic(() => {
3739
+ this._a.Hn = 0, this.iu = !0;
3740
+ }), this.Xh = new Nt(this.Er), this.ga = new Ot(this.Er, this.Xh), this.wa = new Dt(), this.Hc = this.Z.pe(K, `#version 300 es
3741
+ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D Uc;uniform sampler2D Ud;uniform sampler2D Ue;uniform vec2 Uf;uniform vec2 Ug;uniform vec4 Uh;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/Ug;vec2 F=E*Uf;vec2 G=floor(F);vec2 H=(G+0.5)/Uf;vec4 I=texture(Uc,H);vec4 J=texture(Ud,H);vec4 K=texture(Ue,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(Uh,J,J.a);fragColor=mix(d,I,c);}`), this.pa = new kt(this), this.kl = new Wt(this.Z), this.jl.Sn(), this.au(e);
3742
+ }
3743
+ async au(e) {
3744
+ await Promise.all([this.rr.yr(e.fontSource), this.jl.yr(e.fontSource)]);
3739
3745
  const i = this.rr.maxGlyphDimensions;
3740
- this.Nn = new Ut(this.Er.canvas, i.width, i.height), this.Yh.yr(this.Nn), this.ma.yr(this.Nn), this.ga = this.Z.Pe(this.Nn.cols, this.Nn.rows, 3), this.La = this.Z.Pe(this.Nn.width, this.Nn.height, 1), this.ql = this.Z.Pe(this.Er.width, this.Er.height, 1), this.Vl = this.Z.Pe(this.Er.width, this.Er.height, 1), this.kl.yr(this.Er.width, this.Er.height), this.Wl.yr(), this.Lr && (this.au = I.Cn(this.Z, this.rr, this.Er.targetCanvas, this.Nn.cols, this.Nn.rows), this.pa(this.au)), this.Qc = this.Z.pe(Q, `#version 300 es
3741
- precision highp float;uniform sampler2D U0;uniform vec2 U1;uniform vec2 U2;uniform vec2 U3;in vec2 v_uv;out vec4 fragColor;void main(){vec2 A=gl_FragCoord.xy-U2;vec2 B=A*(U1/U3);vec2 C=(floor(B)+0.5)/U1;fragColor=texture(U0,C);}`), this.lu(), this.ya.kn(() => this.wa()), await this.Jl.$a(e.plugins ?? []);
3746
+ this.Qn = new St(this.Er.canvas, i.width, i.height), this.Xh.yr(this.Qn), this.ga.yr(this.Qn), this.va = this.Z.Pe(this.Qn.cols, this.Qn.rows, 3), this.Da = this.Z.Pe(this.Qn.width, this.Qn.height, 1), this.Zl = this.Z.Pe(this.Er.width, this.Er.height, 1), this.ql = this.Z.Pe(this.Er.width, this.Er.height, 1), this.kl.yr(this.Er.width, this.Er.height), this.pa.yr(), this.Lr && (this.ou = I.Cn(this.Z, this.rr, this.Er.targetCanvas, this.Qn.cols, this.Qn.rows), this.da(this.ou)), this.Gc = this.Z.pe(K, _t), this.cu(), this._a.Sn(() => this.ya()), await this.Vl.Pa(e.plugins ?? []);
3742
3747
  try {
3743
- await this.ru(), this.Kl.ac();
3748
+ await this.eu(), this.jl.oc();
3744
3749
  } catch (s) {
3745
- console.error("Error during setup:", s), this.Kl.error(s);
3750
+ console.error("Error during setup:", s), this.jl.error(s);
3746
3751
  }
3747
3752
  }
3748
- lu() {
3749
- this.hu = () => {
3750
- this.Lr && this.resizeCanvas(this.Er.targetCanvas.width, this.Er.targetCanvas.height), this.nu();
3751
- }, window.addEventListener("resize", this.hu), this.Yh.dh(), this.ma.dh(), this.ba.dh(), window.addEventListener("blur", () => {
3752
- this.ba.Xh();
3753
- }), this.Lr && (this.ou = new ResizeObserver(() => {
3753
+ cu() {
3754
+ this.nu = () => {
3755
+ this.Lr && this.resizeCanvas(this.Er.targetCanvas.width, this.Er.targetCanvas.height), this.ru();
3756
+ }, window.addEventListener("resize", this.nu), this.Xh.fh(), this.ga.fh(), this.wa.fh(), window.addEventListener("blur", () => {
3757
+ this.wa.Nh();
3758
+ }), this.Lr && (this.hu = new ResizeObserver(() => {
3754
3759
  this.resizeCanvas(this.Er.targetCanvas.width, this.Er.targetCanvas.height);
3755
- }), this.ou.observe(this.Er.targetCanvas));
3760
+ }), this.hu.observe(this.Er.targetCanvas));
3756
3761
  }
3757
- wa() {
3758
- if (!this.Kl.rc && this.eu) {
3759
- this.su = !0;
3762
+ ya() {
3763
+ if (!this.jl.ec && this.iu) {
3764
+ this.tu = !0;
3760
3765
  try {
3761
- this.ya.In(), this.ya.Qn(), this.Lr && Ct(this.Z.context, this.au.texture, this.Er.targetCanvas), this.Jl.Sa(), this.Z.state.qt(), this.ga.begin(), this.Wl.base.rl() ? this.Wl.base.hl(this) : this.tl(), this.ga.end();
3766
+ this._a.On(), this._a.Gn(), this.Lr && Rt(this.Z.context, this.ou.texture, this.Er.targetCanvas), this.Vl.Ea(), this.Z.state.qt(), this.va.begin(), this.pa.base.rl() ? this.pa.base.hl(this) : this.tl(), this.va.end();
3762
3767
  const e = [...this.Z.state.canvasBackgroundColor];
3763
- this.Wl.Sl(this.La, e), this.ql.begin(), this.Z.wi(...e), this.Z.ve(this.Qc), this.Qc.O({ U0: this.La.textures[0], U1: [this.La.width, this.La.height], U2: [this.Nn.offsetX, this.Nn.offsetY], U3: [this.Nn.width, this.Nn.height] }), this.Z.Ae(this.Nn.offsetX, this.Nn.offsetY, this.Nn.width, this.Nn.height), this.ql.end();
3764
- let i = this.ql.textures[0];
3765
- this.Zl.length > 0 && (this.kl.Nl(this.ql.textures[0], this.Vl, this.Zl, this.Er.width, this.Er.height), i = this.Vl.textures[0], this.Zl = []), this.Z.wi(0, 0, 0, 0), this.Z.ve(this.Qc), this.Qc.O({ U0: i, U1: [this.Er.width, this.Er.height], U2: [0, 0], U3: [this.Er.width, this.Er.height] }), this.Z.Ae(0, 0, this.Er.width, this.Er.height), this.Jl.za();
3768
+ this.pa.Sl(this.Zl, e);
3769
+ let i = this.Zl.textures[0];
3770
+ this.Kl.length > 0 && (this.kl.Nl(this.Zl.textures[0], this.ql, this.Kl, this.Er.width, this.Er.height), i = this.ql.textures[0], this.Kl = []), this.Z.wi(0, 0, 0, 0), this.Z.ve(this.Gc), this.Gc.O({ u_texture: i }), this.Z.Ae(0, 0, this.Er.width, this.Er.height), this.Vl.ka();
3766
3771
  } finally {
3767
- this.su = !1, this.tu && !this.iu && this.uu();
3772
+ this.tu = !1, this.Jl && !this.su && this.lu();
3768
3773
  }
3769
3774
  }
3770
3775
  }
3771
3776
  resizeCanvas(e, i) {
3772
3777
  var s, r, h, o;
3773
- this.Er.Xr(e, i), this.Kl.Nc(this.Er.Nr()), this.Nn.ti(), this.Kl.Xr(), this.ga.resize(this.Nn.cols, this.Nn.rows), this.La.resize(this.Nn.width, this.Nn.height), (s = this.ql) == null || s.resize(this.Er.width, this.Er.height), (r = this.Vl) == null || r.resize(this.Er.width, this.Er.height), (h = this.kl) == null || h.Xr(this.Er.width, this.Er.height), (o = this.Wl) == null || o.Xr(), this.Z.Re(), this.Yh.fh(), this.ma.fh(), this.wa();
3778
+ this.Er.Xr(e, i), this.jl.Qc(this.Er.Nr()), this.Qn.ti(), this.jl.Xr(), this.va.resize(this.Qn.cols, this.Qn.rows), this.Da.resize(this.Qn.width, this.Qn.height), (s = this.Zl) == null || s.resize(this.Er.width, this.Er.height), (r = this.ql) == null || r.resize(this.Er.width, this.Er.height), (h = this.kl) == null || h.Xr(this.Er.width, this.Er.height), (o = this.pa) == null || o.Xr(), this.Z.Re(), this.Xh.uh(), this.ga.uh(), this.ya();
3774
3779
  }
3775
3780
  destroy() {
3776
- this.iu || this.tu || (this.tu = !0, this.ya.Dn(), this.su || this.uu());
3781
+ this.su || this.Jl || (this.Jl = !0, this._a.zn(), this.tu || this.lu());
3777
3782
  }
3778
- uu() {
3783
+ lu() {
3779
3784
  var e, i, s, r, h, o;
3780
- this.tu = !1, this.Kl.gt(), this.Jl.Da(), window.removeEventListener("resize", this.hu), (e = this.ou) == null || e.disconnect(), this.Yh.wh(), this.ma.wh(), this.ba.wh(), this.ga.gt(), this.Gc.dispose(), (i = this.Wl) == null || i.gt(), (s = this.kl) == null || s.gt(), (r = this.ql) == null || r.gt(), (h = this.Vl) == null || h.gt(), this.rr.gt(), this.Z.gt(), this.La.gt(), this.Qc.dispose(), (o = this.au) == null || o.gt(), this.Er.gt(), this.iu = !0;
3785
+ this.Jl = !1, this.jl.gt(), this.Vl.za(), window.removeEventListener("resize", this.nu), (e = this.hu) == null || e.disconnect(), this.Xh.Ah(), this.ga.Ah(), this.wa.Ah(), this.va.gt(), this.Hc.dispose(), (i = this.pa) == null || i.gt(), (s = this.kl) == null || s.gt(), (r = this.Zl) == null || r.gt(), (h = this.ql) == null || h.gt(), this.rr.gt(), this.Z.gt(), this.Da.gt(), this.Gc.dispose(), (o = this.ou) == null || o.gt(), this.Er.gt(), this.su = !0;
3781
3786
  }
3782
3787
  setup(e) {
3783
- this.ru = e;
3788
+ this.eu = e;
3784
3789
  }
3785
3790
  draw(e) {
3786
3791
  this.tl = e;
3787
3792
  }
3788
3793
  windowResized(e) {
3789
- this.nu = e;
3794
+ this.ru = e;
3790
3795
  }
3791
3796
  get grid() {
3792
- return this.Nn;
3797
+ return this.Qn;
3793
3798
  }
3794
3799
  get font() {
3795
3800
  return this.rr;
@@ -3804,65 +3809,65 @@ precision highp float;uniform sampler2D U0;uniform vec2 U1;uniform vec2 U2;unifo
3804
3809
  return this.Er.canvas;
3805
3810
  }
3806
3811
  get drawFramebuffer() {
3807
- return this.ga;
3812
+ return this.va;
3808
3813
  }
3809
3814
  get isDisposed() {
3810
- return this.iu;
3815
+ return this.su;
3811
3816
  }
3812
3817
  get overlay() {
3813
- return this.au;
3818
+ return this.ou;
3814
3819
  }
3815
3820
  get loading() {
3816
- return this.Kl;
3821
+ return this.jl;
3817
3822
  }
3818
3823
  get layers() {
3819
- return this.Wl;
3824
+ return this.pa;
3820
3825
  }
3821
3826
  get filters() {
3822
3827
  return this.kl;
3823
3828
  }
3824
3829
  filter(e, i) {
3825
- this.Zl.push({ name: e, params: i });
3830
+ this.Kl.push({ name: e, params: i });
3826
3831
  }
3827
- pa(e) {
3828
- this._a.has(e) || this._a.add(e);
3832
+ da(e) {
3833
+ this.ma.has(e) || this.ma.add(e);
3829
3834
  }
3830
3835
  }
3831
3836
  class At {
3832
3837
  constructor() {
3833
3838
  }
3834
3839
  static create(t = {}) {
3835
- return new Qe(t);
3840
+ return new je(t);
3836
3841
  }
3837
3842
  static setErrorLevel(t) {
3838
- mt._(t);
3843
+ vt._(t);
3839
3844
  }
3840
3845
  static get version() {
3841
- return "0.7.0";
3846
+ return "0.7.1-beta.1";
3842
3847
  }
3843
3848
  }
3844
3849
  let ct = null;
3845
- const Ke = { id: "brightness", createShader: ({ gl: n }) => (ct || (ct = new W(n, it, `#version 300 es
3846
- 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() }, ti = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhaseTracker: _t, LoadingScreenManager: zt, LoadingScreenStateMachine: Ot, LoadingScreenTransition: Xt, resolveColorInputs: Yt, resolveDefaultPalette: It, resolveTheme: dt }, Symbol.toStringTag, { value: "Module" })), ei = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: vt, TextmodeImage: I, TextmodeVideo: rt }, Symbol.toStringTag, { value: "Module" })), ii = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: Be, mouse: Ze, touch: _e }, Symbol.toStringTag, { value: "Module" })), si = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: Vt, TextmodeLayer: gt, TextmodeLayerManager: Gt }, Symbol.toStringTag, { value: "Module" }));
3847
- Le(Ke);
3848
- const ri = At.create, ni = At.setErrorLevel, hi = At.version;
3850
+ const Ve = { id: "brightness", createShader: ({ gl: n }) => (ct || (ct = new H(n, it, `#version 300 es
3851
+ 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: Bt, LoadingScreenManager: Gt, LoadingScreenStateMachine: Xt, 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: _e, mouse: Oe, touch: Be }, Symbol.toStringTag, { value: "Module" })), ri = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: Qt, TextmodeLayer: gt, TextmodeLayerManager: kt }, Symbol.toStringTag, { value: "Module" }));
3852
+ Ne(Ve);
3853
+ const ni = At.create, hi = At.setErrorLevel, oi = At.version;
3849
3854
  export {
3850
- Se as TextmodeCanvas,
3855
+ Le as TextmodeCanvas,
3851
3856
  M as TextmodeColor,
3852
- qt as TextmodeErrorLevel,
3853
- H as TextmodeFramebuffer,
3854
- Ut as TextmodeGrid,
3855
- Qe as Textmodifier,
3856
- ri as create,
3857
- $e as filters,
3857
+ Jt as TextmodeErrorLevel,
3858
+ W as TextmodeFramebuffer,
3859
+ St as TextmodeGrid,
3860
+ je as Textmodifier,
3861
+ ni as create,
3862
+ ti as filters,
3858
3863
  De as getConversionStrategy,
3859
- ii as input,
3860
- si as layering,
3861
- ei as loadables,
3862
- ti as loading,
3863
- Le as registerConversionStrategy,
3864
- ni as setErrorLevel,
3864
+ si as input,
3865
+ ri as layering,
3866
+ ii as loadables,
3867
+ ei as loading,
3868
+ Ne as registerConversionStrategy,
3869
+ hi as setErrorLevel,
3865
3870
  At as textmode,
3866
- Je as unregisterConversionStrategy,
3867
- hi as version
3871
+ $e as unregisterConversionStrategy,
3872
+ oi as version
3868
3873
  };