textmode.js 0.9.0 → 0.9.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.
Files changed (129) hide show
  1. package/dist/textmode.esm.js +965 -965
  2. package/dist/textmode.umd.js +13 -13
  3. package/dist/types/Textmode.d.ts +133 -0
  4. package/dist/types/errors/Error.d.ts +24 -0
  5. package/dist/types/errors/ErrorHandler.d.ts +77 -0
  6. package/dist/types/errors/index.d.ts +2 -0
  7. package/dist/types/exports/conversion.d.ts +1 -0
  8. package/dist/types/exports/filters.d.ts +1 -0
  9. package/dist/types/exports/input.d.ts +1 -0
  10. package/dist/types/exports/layering.d.ts +1 -0
  11. package/dist/types/exports/loadables.d.ts +1 -0
  12. package/dist/types/exports/loading.d.ts +1 -0
  13. package/dist/types/exports/plugins.d.ts +1 -0
  14. package/dist/types/index.d.ts +85 -0
  15. package/dist/types/rendering/index.d.ts +4 -0
  16. package/dist/types/rendering/webgl/batching/DrawQueue.d.ts +89 -0
  17. package/dist/types/rendering/webgl/batching/GeometryAttributeCache.d.ts +18 -0
  18. package/dist/types/rendering/webgl/batching/InstanceAttributeBinder.d.ts +83 -0
  19. package/dist/types/rendering/webgl/batching/InstanceBatch.d.ts +87 -0
  20. package/dist/types/rendering/webgl/batching/InstanceBuffer.d.ts +68 -0
  21. package/dist/types/rendering/webgl/batching/InstanceData.d.ts +56 -0
  22. package/dist/types/rendering/webgl/batching/InstanceWriter.d.ts +78 -0
  23. package/dist/types/rendering/webgl/core/Framebuffer.d.ts +94 -0
  24. package/dist/types/rendering/webgl/core/Renderer.d.ts +78 -0
  25. package/dist/types/rendering/webgl/core/Shader.d.ts +62 -0
  26. package/dist/types/rendering/webgl/core/interfaces/IFramebuffer.d.ts +101 -0
  27. package/dist/types/rendering/webgl/core/interfaces/IRenderer.d.ts +214 -0
  28. package/dist/types/rendering/webgl/geometries/2d/Arc.d.ts +17 -0
  29. package/dist/types/rendering/webgl/geometries/2d/BezierCurve.d.ts +23 -0
  30. package/dist/types/rendering/webgl/geometries/2d/Ellipse.d.ts +21 -0
  31. package/dist/types/rendering/webgl/geometries/2d/Line.d.ts +21 -0
  32. package/dist/types/rendering/webgl/geometries/2d/Rectangle.d.ts +21 -0
  33. package/dist/types/rendering/webgl/geometries/2d/Triangle.d.ts +21 -0
  34. package/dist/types/rendering/webgl/geometries/BaseGeometry.d.ts +57 -0
  35. package/dist/types/rendering/webgl/geometries/immediate/ImmediateQuad.d.ts +33 -0
  36. package/dist/types/rendering/webgl/geometries/index.d.ts +6 -0
  37. package/dist/types/rendering/webgl/geometries/utils/GeometryDescriptors.d.ts +31 -0
  38. package/dist/types/rendering/webgl/geometries/utils/GeometryGenerator.d.ts +16 -0
  39. package/dist/types/rendering/webgl/index.d.ts +19 -0
  40. package/dist/types/rendering/webgl/materials/Material.d.ts +23 -0
  41. package/dist/types/rendering/webgl/materials/MaterialManager.d.ts +56 -0
  42. package/dist/types/rendering/webgl/materials/index.d.ts +2 -0
  43. package/dist/types/rendering/webgl/pipeline/MaterialBatchPipeline.d.ts +54 -0
  44. package/dist/types/rendering/webgl/pipeline/index.d.ts +7 -0
  45. package/dist/types/rendering/webgl/state/RenderState.d.ts +159 -0
  46. package/dist/types/rendering/webgl/types/DrawCommand.d.ts +29 -0
  47. package/dist/types/rendering/webgl/types/GeometryTypes.d.ts +147 -0
  48. package/dist/types/rendering/webgl/types/RenderTypes.d.ts +18 -0
  49. package/dist/types/rendering/webgl/types/UniformTypes.d.ts +11 -0
  50. package/dist/types/rendering/webgl/utils/GLUtils.d.ts +68 -0
  51. package/dist/types/rendering/webgl/utils/ViewportCache.d.ts +3 -0
  52. package/dist/types/rendering/webgl/utils/hash.d.ts +102 -0
  53. package/dist/types/textmode/AnimationController.d.ts +110 -0
  54. package/dist/types/textmode/Canvas.d.ts +58 -0
  55. package/dist/types/textmode/Grid.d.ts +563 -0
  56. package/dist/types/textmode/TextmodeColor.d.ts +405 -0
  57. package/dist/types/textmode/Textmodifier.d.ts +113 -0
  58. package/dist/types/textmode/conversion/ConversionManager.d.ts +89 -0
  59. package/dist/types/textmode/conversion/ConversionRegistry.d.ts +78 -0
  60. package/dist/types/textmode/conversion/index.d.ts +2 -0
  61. package/dist/types/textmode/conversion/strategies/brightness.d.ts +2 -0
  62. package/dist/types/textmode/filters/FilterManager.d.ts +132 -0
  63. package/dist/types/textmode/filters/index.d.ts +2 -0
  64. package/dist/types/textmode/filters/types.d.ts +78 -0
  65. package/dist/types/textmode/interfaces/IDisposable.d.ts +14 -0
  66. package/dist/types/textmode/interfaces/ITextmodifier.d.ts +753 -0
  67. package/dist/types/textmode/interfaces/index.d.ts +2 -0
  68. package/dist/types/textmode/layers/Layer2DCompositor.d.ts +89 -0
  69. package/dist/types/textmode/layers/LayerManager.d.ts +115 -0
  70. package/dist/types/textmode/layers/TextmodeLayer.d.ts +105 -0
  71. package/dist/types/textmode/layers/index.d.ts +4 -0
  72. package/dist/types/textmode/layers/interfaces/ILayerManager.d.ts +158 -0
  73. package/dist/types/textmode/layers/interfaces/ITextmodeLayer.d.ts +821 -0
  74. package/dist/types/textmode/layers/types.d.ts +78 -0
  75. package/dist/types/textmode/loadables/ITextmodeSource.d.ts +541 -0
  76. package/dist/types/textmode/loadables/TextmodeImage.d.ts +45 -0
  77. package/dist/types/textmode/loadables/TextmodeSource.d.ts +65 -0
  78. package/dist/types/textmode/loadables/TextmodeTexture.d.ts +95 -0
  79. package/dist/types/textmode/loadables/font/CharacterColorMapper.d.ts +34 -0
  80. package/dist/types/textmode/loadables/font/CharacterExtractor.d.ts +22 -0
  81. package/dist/types/textmode/loadables/font/MetricsCalculator.d.ts +23 -0
  82. package/dist/types/textmode/loadables/font/TextmodeFont.d.ts +176 -0
  83. package/dist/types/textmode/loadables/font/TextureAtlas.d.ts +66 -0
  84. package/dist/types/textmode/loadables/font/index.d.ts +8 -0
  85. package/dist/types/textmode/loadables/font/types.d.ts +28 -0
  86. package/dist/types/textmode/loadables/font/typr/Typr.d.ts +20 -0
  87. package/dist/types/textmode/loadables/font/typr/types.d.ts +241 -0
  88. package/dist/types/textmode/loadables/font/utils/CmapUtils.d.ts +11 -0
  89. package/dist/types/textmode/loadables/font/utils/FontTableReader.d.ts +40 -0
  90. package/dist/types/textmode/loadables/font/utils/index.d.ts +7 -0
  91. package/dist/types/textmode/loadables/index.d.ts +6 -0
  92. package/dist/types/textmode/loadables/video/ITextmodeVideo.d.ts +339 -0
  93. package/dist/types/textmode/loadables/video/TextmodeVideo.d.ts +81 -0
  94. package/dist/types/textmode/loading/LoadingPhase.d.ts +28 -0
  95. package/dist/types/textmode/loading/LoadingPhaseTracker.d.ts +20 -0
  96. package/dist/types/textmode/loading/LoadingScreenManager.d.ts +208 -0
  97. package/dist/types/textmode/loading/LoadingScreenState.d.ts +22 -0
  98. package/dist/types/textmode/loading/LoadingScreenTheme.d.ts +26 -0
  99. package/dist/types/textmode/loading/LoadingScreenTransition.d.ts +17 -0
  100. package/dist/types/textmode/loading/index.d.ts +7 -0
  101. package/dist/types/textmode/loading/templates/SpinnerTemplate.d.ts +2 -0
  102. package/dist/types/textmode/loading/templates/index.d.ts +1 -0
  103. package/dist/types/textmode/loading/types.d.ts +255 -0
  104. package/dist/types/textmode/managers/KeyboardManager.d.ts +128 -0
  105. package/dist/types/textmode/managers/MouseManager.d.ts +159 -0
  106. package/dist/types/textmode/managers/PluginManager.d.ts +220 -0
  107. package/dist/types/textmode/managers/TouchManager.d.ts +237 -0
  108. package/dist/types/textmode/managers/index.d.ts +12 -0
  109. package/dist/types/textmode/mixins/AnimationMixin.d.ts +8 -0
  110. package/dist/types/textmode/mixins/KeyboardMixin.d.ts +13 -0
  111. package/dist/types/textmode/mixins/MouseMixin.d.ts +10 -0
  112. package/dist/types/textmode/mixins/RenderingMixin.d.ts +8 -0
  113. package/dist/types/textmode/mixins/TextmodifierMixin.d.ts +19 -0
  114. package/dist/types/textmode/mixins/TouchMixin.d.ts +6 -0
  115. package/dist/types/textmode/mixins/index.d.ts +9 -0
  116. package/dist/types/textmode/mixins/interfaces/IAnimationMixin.d.ts +674 -0
  117. package/dist/types/textmode/mixins/interfaces/IKeyboardMixin.d.ts +234 -0
  118. package/dist/types/textmode/mixins/interfaces/IMouseMixin.d.ts +425 -0
  119. package/dist/types/textmode/mixins/interfaces/IRenderingMixin.d.ts +2147 -0
  120. package/dist/types/textmode/mixins/interfaces/ITouchMixin.d.ts +509 -0
  121. package/dist/types/textmode/types.d.ts +52 -0
  122. package/dist/types/utils/Disposable.d.ts +18 -0
  123. package/dist/types/utils/TextmodeCollection.d.ts +172 -0
  124. package/dist/types/utils/array.d.ts +34 -0
  125. package/dist/types/utils/color.d.ts +61 -0
  126. package/dist/types/utils/input.d.ts +11 -0
  127. package/dist/types/utils/math.d.ts +118 -0
  128. package/dist/types/utils/shader.d.ts +12 -0
  129. package/package.json +2 -2
@@ -1,15 +1,15 @@
1
1
  var he = Object.defineProperty;
2
2
  var oe = (n, t, e) => t in n ? he(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
3
  var o = (n, t, e) => oe(n, typeof t != "symbol" ? t + "" : t, e);
4
- class P extends Error {
4
+ class S extends Error {
5
5
  constructor(t, e) {
6
- super(P.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}: ${P.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) => P.h(e)).join(", ")}]` : `[${t.slice(0, 3).map((e) => P.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}: ${P.h(t[i])}`).join(", ")} }` : `{ ${e.slice(0, 2).map((i) => `${i}: ${P.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
30
  var ae = ((n) => (n[n.SILENT = 0] = "SILENT", n[n.WARNING = 1] = "WARNING", n[n.ERROR = 2] = "ERROR", n[n.THROW = 3] = "THROW", n))(ae || {});
31
- const L = class L {
31
+ const _ = class _ {
32
32
  constructor() {
33
33
  o(this, "l", { globalLevel: 3 });
34
34
  }
35
35
  static u() {
36
- return L.o || (L.o = new L()), L.o;
36
+ return _.o || (_.o = new _()), _.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 L = class L {
41
41
  case 0:
42
42
  return !1;
43
43
  case 1:
44
- return console.group(i, s), console.warn(P.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(P.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 P(t, e);
48
+ throw new S(t, e);
49
49
  }
50
50
  }
51
51
  m(t, e, i) {
@@ -55,8 +55,8 @@ const L = class L {
55
55
  this.l.globalLevel = t;
56
56
  }
57
57
  };
58
- o(L, "o", null);
59
- let pt = L;
58
+ o(_, "o", null);
59
+ let pt = _;
60
60
  const yt = pt.u();
61
61
  class at {
62
62
  constructor() {
@@ -85,26 +85,26 @@ function q(n, t, e, i) {
85
85
  function D(n, t, e) {
86
86
  return Math.min(Math.max(n, t), e);
87
87
  }
88
- function St(n) {
88
+ function Pt(n) {
89
89
  return (n % 360 + 360) % 360 / 360;
90
90
  }
91
- function Pt(n, t) {
91
+ function St(n, t) {
92
92
  n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, 1), n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, t);
93
93
  }
94
94
  function rt(n, t, e) {
95
- n.bindTexture(n.TEXTURE_2D, t), Pt(n, e), n.bindTexture(n.TEXTURE_2D, null);
95
+ n.bindTexture(n.TEXTURE_2D, t), St(n, e), n.bindTexture(n.TEXTURE_2D, null);
96
96
  }
97
97
  function wt(n, t, e = n.NEAREST, i = n.NEAREST, s = n.CLAMP_TO_EDGE, r = n.CLAMP_TO_EDGE) {
98
98
  const h = n.createTexture();
99
- return n.bindTexture(n.TEXTURE_2D, h), Ot(n, e, i, s, r), Pt(n, t), n.bindTexture(n.TEXTURE_2D, null), h;
99
+ return n.bindTexture(n.TEXTURE_2D, h), Ot(n, e, i, s, r), St(n, t), n.bindTexture(n.TEXTURE_2D, null), h;
100
100
  }
101
101
  function Ot(n, t, e, i, s) {
102
102
  n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, t), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, e), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, i), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, s);
103
103
  }
104
- function V(n, t, e, i, s, r = 0, h = WebGL2RenderingContext.FLOAT, a = !1) {
104
+ function W(n, t, e, i, s, r = 0, h = WebGL2RenderingContext.FLOAT, a = !1) {
105
105
  n.enableVertexAttribArray(t), n.vertexAttribPointer(t, e, h, a, i, s), n.vertexAttribDivisor(t, r);
106
106
  }
107
- function Ut(n, t, e, i, s) {
107
+ function Xt(n, t, e, i, s) {
108
108
  n.bindBuffer(t, e), n.bufferData(t, i, s), n.bindBuffer(t, null);
109
109
  }
110
110
  function bt(n) {
@@ -196,7 +196,7 @@ class vt extends at {
196
196
  }
197
197
  J() {
198
198
  if (!this.R) return;
199
- const e = this.k > 1, i = this.k > 2, s = this.k > 3, r = { U6: this.S[0], U7: e ? this.S[1] : this.S[0], U8: i ? this.S[2] : this.S[0], U9: s ? this.S[3] : this.S[0], Ua: [this.M, this.F], Ub: e, Uc: i, Ud: s }, h = this.R.materialManager.tt;
199
+ const e = this.k > 1, i = this.k > 2, s = this.k > 3, r = { Ub: this.S[0], Uc: e ? this.S[1] : this.S[0], Ud: i ? this.S[2] : this.S[0], Ue: s ? this.S[3] : this.S[0], Uf: [this.M, this.F], Ug: e, Uh: i, Ui: s }, h = this.R.materialManager.tt;
200
200
  this.D = this.R.materialManager.st(h, r);
201
201
  }
202
202
  dispose() {
@@ -221,17 +221,17 @@ class vt extends at {
221
221
  return this.k;
222
222
  }
223
223
  }
224
- function I(n) {
224
+ function H(n) {
225
225
  return typeof n == "object" && n !== null && "textures" in n && Array.isArray(n.textures);
226
226
  }
227
- function Xt(n) {
227
+ function Ut(n) {
228
228
  if (typeof n == "number" || typeof n == "boolean") return !0;
229
229
  if (Array.isArray(n)) {
230
230
  if (n.length === 0) return !0;
231
231
  const t = n[0];
232
232
  return typeof t == "number" || !!Array.isArray(t);
233
233
  }
234
- return n instanceof Float32Array || n instanceof Int32Array || !!I(n) || typeof WebGLTexture < "u" && n instanceof WebGLTexture;
234
+ return n instanceof Float32Array || n instanceof Int32Array || !!H(n) || typeof WebGLTexture < "u" && n instanceof WebGLTexture;
235
235
  }
236
236
  class j extends at {
237
237
  constructor(e, i, s) {
@@ -279,7 +279,7 @@ class j extends at {
279
279
  }
280
280
  vt() {
281
281
  this.ht = 0, this.ot.clear();
282
- for (const [e, i] of this.nt) (i instanceof WebGLTexture || I(i)) && this.nt.delete(e);
282
+ for (const [e, i] of this.nt) (i instanceof WebGLTexture || H(i)) && this.nt.delete(e);
283
283
  }
284
284
  gt(e) {
285
285
  for (const i in e) this._t(i, e[i]);
@@ -289,8 +289,8 @@ class j extends at {
289
289
  if (!s) return;
290
290
  const r = this.nt.get(e);
291
291
  let h = !0;
292
- if (r !== void 0 && (typeof i == "number" || typeof i == "boolean" ? r === i && (h = !1) : (i instanceof WebGLTexture || I(i)) && r === i && (h = !1)), !h) return;
293
- typeof i == "number" || typeof i == "boolean" || i instanceof WebGLTexture || I(i) ? this.nt.set(e, i) : this.nt.delete(e);
292
+ if (r !== void 0 && (typeof i == "number" || typeof i == "boolean" ? r === i && (h = !1) : (i instanceof WebGLTexture || H(i)) && r === i && (h = !1)), !h) return;
293
+ typeof i == "number" || typeof i == "boolean" || i instanceof WebGLTexture || H(i) ? this.nt.set(e, i) : this.nt.delete(e);
294
294
  const a = this.rt.get(e);
295
295
  if (!a) return;
296
296
  const { type: l, size: u } = a, c = this.$;
@@ -298,11 +298,11 @@ class j extends at {
298
298
  const f = this.yt(e);
299
299
  return c.uniform1i(s, f), c.activeTexture(c.TEXTURE0 + f), void c.bindTexture(c.TEXTURE_2D, i);
300
300
  }
301
- if (I(i)) {
301
+ if (H(i)) {
302
302
  const f = this.yt(e);
303
303
  return c.uniform1i(s, f), c.activeTexture(c.TEXTURE0 + f), void c.bindTexture(c.TEXTURE_2D, i.textures[0]);
304
304
  }
305
- if (Xt(i), typeof i != "number") if (typeof i != "boolean") if (Array.isArray(i) && Array.isArray(i[0])) {
305
+ if (Ut(i), typeof i != "number") if (typeof i != "boolean") if (Array.isArray(i) && Array.isArray(i[0])) {
306
306
  const f = i.flat();
307
307
  switch (l) {
308
308
  case c.FLOAT_VEC2:
@@ -375,7 +375,7 @@ const Dt = /* @__PURE__ */ new WeakMap();
375
375
  function ft(n, t) {
376
376
  Dt.set(n, t);
377
377
  }
378
- function _t(n) {
378
+ function Lt(n) {
379
379
  return Dt.get(n);
380
380
  }
381
381
  function it(n, t, e, i, s = 255) {
@@ -472,7 +472,7 @@ class lt {
472
472
  this.Rt = t;
473
473
  }
474
474
  gs(t) {
475
- this.Dt = St(t);
475
+ this.Dt = Pt(t);
476
476
  }
477
477
  _s(t, e, i, s) {
478
478
  it(this.Lt, t, e, i, s);
@@ -541,12 +541,12 @@ class le {
541
541
  this.$ = t, this.$s = t.createBuffer(), this.Ps = new Float32Array(mt.length);
542
542
  }
543
543
  Ts(t, e, i, s) {
544
- const r = this.$, h = _t(this.$), a = h[2], l = h[3], u = t / a * 2 - 1, c = (t + i) / a * 2 - 1, f = 1 - (e + s) / l * 2, g = 1 - e / l * 2, p = mt, v = this.Ps;
544
+ const r = this.$, h = Lt(this.$), a = h[2], l = h[3], u = t / a * 2 - 1, c = (t + i) / a * 2 - 1, f = 1 - (e + s) / l * 2, g = 1 - e / l * 2, p = mt, v = this.Ps;
545
545
  for (let d = 0; d < p.length; d += 4) {
546
546
  const m = p[d], A = p[d + 1], w = p[d + 2], y = p[d + 3], R = u + (m + 0.5) * (c - u), b = f + (A + 0.5) * (g - f);
547
547
  v[d] = R, v[d + 1] = b, v[d + 2] = w, v[d + 3] = y;
548
548
  }
549
- r.bindBuffer(r.ARRAY_BUFFER, this.$s), r.bufferData(r.ARRAY_BUFFER, v, r.DYNAMIC_DRAW), V(r, 0, 2, 16, 0), V(r, 1, 2, 16, 8), r.drawArrays(r.TRIANGLES, 0, 6), r.disableVertexAttribArray(1), r.disableVertexAttribArray(0), r.bindBuffer(r.ARRAY_BUFFER, null);
549
+ r.bindBuffer(r.ARRAY_BUFFER, this.$s), r.bufferData(r.ARRAY_BUFFER, v, r.DYNAMIC_DRAW), W(r, 0, 2, 16, 0), W(r, 1, 2, 16, 8), r.drawArrays(r.TRIANGLES, 0, 6), r.disableVertexAttribArray(1), r.disableVertexAttribArray(0), r.bindBuffer(r.ARRAY_BUFFER, null);
550
550
  }
551
551
  Ss() {
552
552
  this.$.deleteBuffer(this.$s);
@@ -570,9 +570,9 @@ class ue {
570
570
  else {
571
571
  l = r.createVertexArray(), a.set(e, l), r.bindVertexArray(l), this.ks = l, r.bindBuffer(r.ARRAY_BUFFER, s);
572
572
  const u = r.getAttribLocation(h, "A0");
573
- u !== -1 && V(r, u, i.Cs.Ms.size, i.ws, i.Cs.Ms.offset, 0, r.FLOAT, !1);
573
+ u !== -1 && W(r, u, i.Cs.Ms.size, i.ws, i.Cs.Ms.offset, 0, r.FLOAT, !1);
574
574
  const c = r.getAttribLocation(h, "A1");
575
- c !== -1 && V(r, c, i.Cs.Fs.size, i.ws, i.Cs.Fs.offset, 0, r.FLOAT, !1);
575
+ c !== -1 && W(r, c, i.Cs.Fs.size, i.ws, i.Cs.Fs.offset, 0, r.FLOAT, !1);
576
576
  }
577
577
  }
578
578
  Ds(t) {
@@ -590,15 +590,15 @@ class ue {
590
590
  this.Es.clear();
591
591
  }
592
592
  }
593
- class U {
593
+ class X {
594
594
  }
595
- o(U, "BYTES_PER_INSTANCE", 144), o(U, "FLOATS_PER_INSTANCE", 36);
595
+ o(X, "BYTES_PER_INSTANCE", 144), o(X, "FLOATS_PER_INSTANCE", 36);
596
596
  function O(n, t) {
597
- return { location: -1, size: n, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: U.BYTES_PER_INSTANCE, offset: t, divisor: 1 };
597
+ return { location: -1, size: n, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: X.BYTES_PER_INSTANCE, offset: t, divisor: 1 };
598
598
  }
599
599
  class nt {
600
600
  }
601
- o(nt, "STRIDE", U.BYTES_PER_INSTANCE), o(nt, "ATTRIBUTES", { A2: O(2, 0), A3: O(2, 8), A4: O(3, 16), A5: O(4, 28), A6: O(4, 44), A7: O(4, 60), A8: O(3, 76), A9: O(3, 88), Aa: O(4, 100), Ab: O(4, 116), Ac: O(3, 132) });
601
+ o(nt, "STRIDE", X.BYTES_PER_INSTANCE), o(nt, "ATTRIBUTES", { A2: O(2, 0), A3: O(2, 8), A4: O(3, 16), A5: O(4, 28), A6: O(4, 44), A7: O(4, 60), A8: O(3, 76), A9: O(3, 88), Aa: O(4, 100), Ab: O(4, 116), Ac: O(3, 132) });
602
602
  class fe {
603
603
  constructor(t = 1e3, e = 1.5) {
604
604
  o(this, "Os");
@@ -607,14 +607,14 @@ class fe {
607
607
  o(this, "Bs", 0);
608
608
  o(this, "Is", 0);
609
609
  this.zs = t, this.Hs = e;
610
- const i = t * U.FLOATS_PER_INSTANCE;
610
+ const i = t * X.FLOATS_PER_INSTANCE;
611
611
  this.Os = new Float32Array(i);
612
612
  }
613
613
  Gs(t) {
614
614
  if (t <= this.zs) return;
615
615
  const e = Math.ceil(t * this.Hs), i = this.zs;
616
616
  this.zs = e;
617
- const s = new Float32Array(e * U.FLOATS_PER_INSTANCE), r = i * U.FLOATS_PER_INSTANCE;
617
+ const s = new Float32Array(e * X.FLOATS_PER_INSTANCE), r = i * X.FLOATS_PER_INSTANCE;
618
618
  s.set(this.Os.subarray(0, Math.min(r, this.Bs))), this.Os = s;
619
619
  }
620
620
  js(t) {
@@ -649,7 +649,7 @@ class de {
649
649
  const e = this.Os.Os, i = this.Os.Bs;
650
650
  e[i + 0] = t.x, e[i + 1] = t.y, e[i + 2] = t.width, e[i + 3] = t.height, e[i + 4] = t.char0, e[i + 5] = t.char1, e[i + 6] = t.char2, e[i + 7] = t.r1, e[i + 8] = t.g1, e[i + 9] = t.b1, e[i + 10] = t.a1, e[i + 11] = t.r2, e[i + 12] = t.g2, e[i + 13] = t.b2, e[i + 14] = t.a2, e[i + 15] = t.invert, e[i + 16] = t.flipX, e[i + 17] = t.flipY, e[i + 18] = t.charRot, e[i + 19] = t.translationX, e[i + 20] = t.translationY, e[i + 21] = t.translationZ, e[i + 22] = t.rotationX, e[i + 23] = t.rotationY, e[i + 24] = t.rotationZ;
651
651
  const s = t.curveParams0, r = t.curveParams1;
652
- return e[i + 25] = s[0], e[i + 26] = s[1], e[i + 27] = s[2], e[i + 28] = s[3], e[i + 29] = r[0], e[i + 30] = r[1], e[i + 31] = r[2], e[i + 32] = r[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Os.js(U.FLOATS_PER_INSTANCE), this.Os.Is - 1;
652
+ return e[i + 25] = s[0], e[i + 26] = s[1], e[i + 27] = s[2], e[i + 28] = s[3], e[i + 29] = r[0], e[i + 30] = r[1], e[i + 31] = r[2], e[i + 32] = r[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Os.js(X.FLOATS_PER_INSTANCE), this.Os.Is - 1;
653
653
  }
654
654
  get Xs() {
655
655
  return this.Os.Xs;
@@ -668,8 +668,8 @@ class ge {
668
668
  ee(t) {
669
669
  const e = this.$;
670
670
  this.qs && e.deleteBuffer(this.qs), this.te++, this.qs = e.createBuffer();
671
- const i = t * U.BYTES_PER_INSTANCE;
672
- Ut(e, e.ARRAY_BUFFER, this.qs, i, e.DYNAMIC_DRAW), this.Vs = t;
671
+ const i = t * X.BYTES_PER_INSTANCE;
672
+ Xt(e, e.ARRAY_BUFFER, this.qs, i, e.DYNAMIC_DRAW), this.Vs = t;
673
673
  }
674
674
  ie(t) {
675
675
  this.ee(t);
@@ -681,7 +681,7 @@ class ge {
681
681
  if (e === 0) return;
682
682
  const i = this.$;
683
683
  i.bindBuffer(i.ARRAY_BUFFER, this.qs);
684
- const s = e * U.FLOATS_PER_INSTANCE;
684
+ const s = e * X.FLOATS_PER_INSTANCE;
685
685
  i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, s);
686
686
  }
687
687
  ne(t) {
@@ -703,7 +703,7 @@ class ge {
703
703
  const s = this.ne(i);
704
704
  for (const [r, h] of s) {
705
705
  const a = nt.ATTRIBUTES[r];
706
- a && V(e, h, a.size, a.stride, a.offset, a.divisor, a.type, a.normalized);
706
+ a && W(e, h, a.size, a.stride, a.offset, a.divisor, a.type, a.normalized);
707
707
  }
708
708
  this.se.set(i, this.te);
709
709
  }
@@ -724,7 +724,7 @@ class pe {
724
724
  const e = this.Os;
725
725
  e.Is >= e.zs && e.Gs(e.Is + 1);
726
726
  const i = e.Os, s = e.Bs;
727
- return i[s + 0] = t.Ms[0], i[s + 1] = t.Ms[1], i[s + 2] = t.le[0], i[s + 3] = t.le[1], i[s + 4] = t.Qt[0], i[s + 5] = t.Qt[1], i[s + 6] = t.Qt[2], i[s + 7] = t.Xt[0], i[s + 8] = t.Xt[1], i[s + 9] = t.Xt[2], i[s + 10] = t.Xt[3], i[s + 11] = t.Yt[0], i[s + 12] = t.Yt[1], i[s + 13] = t.Yt[2], i[s + 14] = t.Yt[3], i[s + 15] = t.ue[0], i[s + 16] = t.ue[1], i[s + 17] = t.ue[2], i[s + 18] = t.Dt, i[s + 19] = ((r = t.fe) == null ? void 0 : r[0]) ?? 0, i[s + 20] = ((h = t.fe) == null ? void 0 : h[1]) ?? 0, i[s + 21] = ((a = t.fe) == null ? void 0 : a[2]) ?? 0, i[s + 22] = ((l = t.de) == null ? void 0 : l[0]) ?? 0, i[s + 23] = ((u = t.de) == null ? void 0 : u[1]) ?? 0, i[s + 24] = ((c = t.de) == null ? void 0 : c[2]) ?? 0, t.pe && t.ve ? (i[s + 25] = ((f = t.ge) == null ? void 0 : f[0]) ?? 0, i[s + 26] = ((g = t.ge) == null ? void 0 : g[1]) ?? 0, i[s + 27] = ((p = t.me) == null ? void 0 : p[0]) ?? 0, i[s + 28] = ((v = t.me) == null ? void 0 : v[1]) ?? 0, i[s + 29] = t.pe[0], i[s + 30] = t.pe[1], i[s + 31] = t.ve[0], i[s + 32] = t.ve[1]) : t._e ? (i[s + 25] = t._e[0], i[s + 26] = t._e[1], i[s + 27] = 0, i[s + 28] = 0, i[s + 29] = 0, i[s + 30] = 0, i[s + 31] = 0, i[s + 32] = 0) : (i[s + 25] = 0, i[s + 26] = 0, i[s + 27] = 0, i[s + 28] = 0, i[s + 29] = 0, i[s + 30] = 0, i[s + 31] = 0, i[s + 32] = 0), i[s + 33] = t.ye || 0, i[s + 34] = t.Ae || 0, i[s + 35] = t.we || 0, e.js(U.FLOATS_PER_INSTANCE), e.Is - 1;
727
+ return i[s + 0] = t.Ms[0], i[s + 1] = t.Ms[1], i[s + 2] = t.le[0], i[s + 3] = t.le[1], i[s + 4] = t.Qt[0], i[s + 5] = t.Qt[1], i[s + 6] = t.Qt[2], i[s + 7] = t.Xt[0], i[s + 8] = t.Xt[1], i[s + 9] = t.Xt[2], i[s + 10] = t.Xt[3], i[s + 11] = t.Yt[0], i[s + 12] = t.Yt[1], i[s + 13] = t.Yt[2], i[s + 14] = t.Yt[3], i[s + 15] = t.ue[0], i[s + 16] = t.ue[1], i[s + 17] = t.ue[2], i[s + 18] = t.Dt, i[s + 19] = ((r = t.fe) == null ? void 0 : r[0]) ?? 0, i[s + 20] = ((h = t.fe) == null ? void 0 : h[1]) ?? 0, i[s + 21] = ((a = t.fe) == null ? void 0 : a[2]) ?? 0, i[s + 22] = ((l = t.de) == null ? void 0 : l[0]) ?? 0, i[s + 23] = ((u = t.de) == null ? void 0 : u[1]) ?? 0, i[s + 24] = ((c = t.de) == null ? void 0 : c[2]) ?? 0, t.pe && t.ve ? (i[s + 25] = ((f = t.ge) == null ? void 0 : f[0]) ?? 0, i[s + 26] = ((g = t.ge) == null ? void 0 : g[1]) ?? 0, i[s + 27] = ((p = t.me) == null ? void 0 : p[0]) ?? 0, i[s + 28] = ((v = t.me) == null ? void 0 : v[1]) ?? 0, i[s + 29] = t.pe[0], i[s + 30] = t.pe[1], i[s + 31] = t.ve[0], i[s + 32] = t.ve[1]) : t._e ? (i[s + 25] = t._e[0], i[s + 26] = t._e[1], i[s + 27] = 0, i[s + 28] = 0, i[s + 29] = 0, i[s + 30] = 0, i[s + 31] = 0, i[s + 32] = 0) : (i[s + 25] = 0, i[s + 26] = 0, i[s + 27] = 0, i[s + 28] = 0, i[s + 29] = 0, i[s + 30] = 0, i[s + 31] = 0, i[s + 32] = 0), i[s + 33] = t.ye || 0, i[s + 34] = t.Ae || 0, i[s + 35] = t.we || 0, e.js(X.FLOATS_PER_INSTANCE), e.Is - 1;
728
728
  }
729
729
  be() {
730
730
  this.Os.Ys > this.ae.Ys && this.ae.ie(this.Os.Ys);
@@ -759,7 +759,7 @@ class pe {
759
759
  this.ae.Ss();
760
760
  }
761
761
  }
762
- class Y {
762
+ class I {
763
763
  constructor(t, e, i, s) {
764
764
  o(this, "$");
765
765
  o(this, "Me");
@@ -772,7 +772,7 @@ class Y {
772
772
  var r, h;
773
773
  this.$ = t, this.Me = e, this.Fe = i, this.$e = s, this.Ee = (r = this.Te, h = this.Se, { x: 0, y: 0, width: 0, height: 0, char0: 0, char1: 0, char2: 0, r1: 0, g1: 0, b1: 0, a1: 0, r2: 0, g2: 0, b2: 0, a2: 0, invert: 0, flipX: 0, flipY: 0, charRot: 0, translationX: 0, translationY: 0, translationZ: 0, rotationX: 0, rotationY: 0, rotationZ: 0, curveParams0: r, curveParams1: h, depth: 0, baseZ: 0, geometryType: 0 });
774
774
  const a = this.$.createBuffer();
775
- Ut(this.$, this.$.ARRAY_BUFFER, a, this.$e.ke, this.$.STATIC_DRAW), this.Pe = a;
775
+ Xt(this.$, this.$.ARRAY_BUFFER, a, this.$e.ke, this.$.STATIC_DRAW), this.Pe = a;
776
776
  }
777
777
  get type() {
778
778
  return this.Fe;
@@ -828,14 +828,14 @@ const we = { ke: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), ze:
828
828
  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);
829
829
  }
830
830
  return new Float32Array(t);
831
- }(16), ze: 96, ...k }, xe = { [E.RECTANGLE]: class extends Y {
831
+ }(16), ze: 96, ...k }, xe = { [E.RECTANGLE]: class extends I {
832
832
  constructor(n, t) {
833
833
  super(n, t, E.RECTANGLE, ve);
834
834
  }
835
835
  ce(n, t) {
836
836
  return this.Oe(0, 0, n.width, n.height, t);
837
837
  }
838
- }, [E.LINE]: class extends Y {
838
+ }, [E.LINE]: class extends I {
839
839
  constructor(n, t) {
840
840
  super(n, t, E.LINE, me);
841
841
  }
@@ -843,14 +843,14 @@ const we = { ke: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), ze:
843
843
  const e = n.x2 - n.x1, i = n.y2 - n.y1, s = Math.hypot(e, i), r = Math.atan2(i, e), h = t.It || 1, a = Math.cos(-r), l = Math.sin(-r), u = n.x1 * a - n.y1 * l, c = n.x1 * l + n.y1 * a, f = { ...t, Ft: (t.Ft || 0) + r };
844
844
  return this.Oe(u, c, s, h, f);
845
845
  }
846
- }, [E.ELLIPSE]: class extends Y {
846
+ }, [E.ELLIPSE]: class extends I {
847
847
  constructor(n, t) {
848
848
  super(n, t, E.ELLIPSE, Ae);
849
849
  }
850
850
  ce(n, t) {
851
851
  return this.Oe(0, 0, n.width, n.height, t);
852
852
  }
853
- }, [E.ARC]: class extends Y {
853
+ }, [E.ARC]: class extends I {
854
854
  constructor(n, t) {
855
855
  super(n, t, E.ARC, ye);
856
856
  }
@@ -858,7 +858,7 @@ const we = { ke: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), ze:
858
858
  const e = N(n.start), i = N(n.stop);
859
859
  return this.Oe(0, 0, n.width, n.height, t, { arcStart: e, arcStop: i });
860
860
  }
861
- }, [E.TRIANGLE]: class extends Y {
861
+ }, [E.TRIANGLE]: class extends I {
862
862
  constructor(n, t) {
863
863
  super(n, t, E.TRIANGLE, we);
864
864
  }
@@ -866,7 +866,7 @@ const we = { ke: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), ze:
866
866
  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;
867
867
  return this.Oe(e, s, r, h, t);
868
868
  }
869
- }, [E.BEZIER_CURVE]: class extends Y {
869
+ }, [E.BEZIER_CURVE]: class extends I {
870
870
  constructor(n, t) {
871
871
  super(n, t, E.BEZIER_CURVE, be);
872
872
  }
@@ -896,7 +896,7 @@ class Ee {
896
896
  }
897
897
  Ne(t, e, i, s) {
898
898
  if (this.Ie !== e.shader && (e.shader.dt(), this.Ie = e.shader), this.je !== e && (e.shader.gt(e.uniforms), this.je = e), this.Ge.get(e.shader) !== s) {
899
- const a = _t(this.$);
899
+ const a = Lt(this.$);
900
900
  e.shader.gt({ Ur: a[2] / a[3], Us: [a[2], a[3]], Ut: 1, Uu: s ? 1 : 0 }), this.Ge.set(e.shader, s);
901
901
  }
902
902
  const r = t.unitGeometry, h = t.unitBuffer;
@@ -911,7 +911,7 @@ class Ee {
911
911
  this.He.clear(), this.Be.Ss();
912
912
  }
913
913
  }
914
- function Lt(n) {
914
+ function _t(n) {
915
915
  let t = 0;
916
916
  for (let e = 0; e < n.length; e++)
917
917
  t = (t << 5) - t + n.charCodeAt(e), t &= t;
@@ -921,11 +921,11 @@ const Tt = /* @__PURE__ */ new WeakMap();
921
921
  let Re = 1;
922
922
  function Ft(n) {
923
923
  if (n == null) return 0;
924
- if (typeof n != "object" && typeof n != "function") return Lt(n + "");
924
+ if (typeof n != "object" && typeof n != "function") return _t(n + "");
925
925
  let t = Tt.get(n);
926
926
  return t || (t = Re++, Tt.set(n, t)), t;
927
927
  }
928
- function H(n, t) {
928
+ function Y(n, t) {
929
929
  return (n << 5) - n + t;
930
930
  }
931
931
  const ht = `#version 300 es
@@ -939,7 +939,7 @@ class Te {
939
939
  o(this, "Ze", /* @__PURE__ */ new Map());
940
940
  this.Ye = new j(t, ht, `#version 300 es
941
941
  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.Ke = new j(t, ht, `#version 300 es
942
- precision highp float;in vec2 v_uv;uniform sampler2D U6;uniform sampler2D U7;uniform sampler2D U8;uniform sampler2D U9;uniform vec2 Ua;uniform bool Ub;uniform bool Uc;uniform bool Ud;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*Ua;vec2 D=(floor(C)+0.5f)/Ua;vec4 E=texture(U6,D);vec4 F=Ub?texture(U7,D):vec4(0.);if(Ub&&F.a==0.){discard;}vec4 G=Uc?texture(U8,D):vec4(0.);vec4 H=Ud?texture(U9,D):vec4(0.);o_character=E;o_primaryColor=F;o_secondaryColor=G;A=H;}`), this.We = { id: this.Xe++, shader: this.Ye, uniforms: Object.freeze({}), hash: this.qe(this.Ye, {}), isBuiltIn: !0 };
942
+ precision highp float;in vec2 v_uv;uniform sampler2D Ub;uniform sampler2D Uc;uniform sampler2D Ud;uniform sampler2D Ue;uniform vec2 Uf;uniform bool Ug;uniform bool Uh;uniform bool Ui;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*Uf;vec2 D=(floor(C)+0.5f)/Uf;vec4 E=texture(Ub,D);vec4 F=Ug?texture(Uc,D):vec4(0.);if(Ug&&F.a==0.){discard;}vec4 G=Uh?texture(Ud,D):vec4(0.);vec4 H=Ui?texture(Ue,D):vec4(0.);o_character=E;o_primaryColor=F;o_secondaryColor=G;A=H;}`), this.We = { id: this.Xe++, shader: this.Ye, uniforms: Object.freeze({}), hash: this.qe(this.Ye, {}), isBuiltIn: !0 };
943
943
  }
944
944
  get Ve() {
945
945
  return this.We;
@@ -954,10 +954,10 @@ precision highp float;in vec2 v_uv;uniform sampler2D U6;uniform sampler2D U7;uni
954
954
  const i = Ft(t.program), s = function(r, h) {
955
955
  let a = 0;
956
956
  const l = Object.keys(r).sort();
957
- for (const u of l) a = H(a, Lt(u)), a = H(a, h(r[u]));
957
+ for (const u of l) a = Y(a, _t(u)), a = Y(a, h(r[u]));
958
958
  return a;
959
959
  }(e, this.Je.bind(this));
960
- return H(i, s);
960
+ return Y(i, s);
961
961
  }
962
962
  Je(t) {
963
963
  return typeof t == "number" || typeof t == "boolean" ? function(e) {
@@ -965,14 +965,14 @@ precision highp float;in vec2 v_uv;uniform sampler2D U6;uniform sampler2D U7;uni
965
965
  }(t) : Array.isArray(t) ? function(e) {
966
966
  let i = 0;
967
967
  const s = Array.isArray(e[0]) ? e.flat() : e;
968
- for (const r of s) i = H(i, typeof r == "number" ? r : 0);
968
+ for (const r of s) i = Y(i, typeof r == "number" ? r : 0);
969
969
  return i;
970
970
  }(t) : t instanceof Float32Array || t instanceof Int32Array ? function(e) {
971
971
  let i = 0;
972
972
  const s = Math.min(e.length, 16);
973
- for (let r = 0; r < s; r++) i = H(i, e[r]);
973
+ for (let r = 0; r < s; r++) i = Y(i, e[r]);
974
974
  return i;
975
- }(t) : t instanceof WebGLTexture || I(t) ? Ft(t) : 0;
975
+ }(t) : t instanceof WebGLTexture || H(t) ? Ft(t) : 0;
976
976
  }
977
977
  Ss() {
978
978
  this.Ye.dispose(), this.Ke.dispose(), this.Ze.clear();
@@ -1162,13 +1162,13 @@ const F = { readShort: (n, t) => (F.t.uint16[0] = n[t] << 8 | n[t + 1], F.t.int1
1162
1162
  const n = new ArrayBuffer(8);
1163
1163
  return { uint8: new Uint8Array(n), int16: new Int16Array(n), uint16: new Uint16Array(n), uint32: new Uint32Array(n) };
1164
1164
  })() };
1165
- function $(n) {
1165
+ function K(n) {
1166
1166
  return n + 3 & -4;
1167
1167
  }
1168
1168
  function J(n, t, e) {
1169
1169
  n[t] = e >>> 8 & 255, n[t + 1] = 255 & e;
1170
1170
  }
1171
- function _(n, t, e) {
1171
+ function L(n, t, e) {
1172
1172
  n[t] = e >>> 24 & 255, n[t + 1] = e >>> 16 & 255, n[t + 2] = e >>> 8 & 255, n[t + 3] = 255 & e;
1173
1173
  }
1174
1174
  function Ce(n, t, e) {
@@ -1181,7 +1181,7 @@ function dt(n, t, e) {
1181
1181
  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;
1182
1182
  return s >>> 0;
1183
1183
  }
1184
- class Se {
1184
+ class Pe {
1185
1185
  constructor(t) {
1186
1186
  o(this, "b");
1187
1187
  o(this, "p", 0);
@@ -1220,7 +1220,7 @@ function G(n) {
1220
1220
  if (!l) continue;
1221
1221
  const u = s[l]++;
1222
1222
  let c = h.get(l);
1223
- c || (c = [], h.set(l, c)), c[Pe(u, l)] = a;
1223
+ c || (c = [], h.set(l, c)), c[Se(u, l)] = a;
1224
1224
  }
1225
1225
  return { min: t, max: e, table: h };
1226
1226
  }
@@ -1236,7 +1236,7 @@ function gt(n, t) {
1236
1236
  }
1237
1237
  throw Error("Invalid Huffman code");
1238
1238
  }
1239
- function Pe(n, t) {
1239
+ function Se(n, t) {
1240
1240
  let e = 0;
1241
1241
  for (let i = 0; i < t; i++) e = e << 1 | 1 & n, n >>>= 1;
1242
1242
  return e >>> 0;
@@ -1279,21 +1279,21 @@ function Oe(n) {
1279
1279
  const T = gt(r, R);
1280
1280
  if (T <= 15) b.push(T);
1281
1281
  else if (T === 16) {
1282
- const X = r.readBits(2) + 3, C = b[b.length - 1] || 0;
1283
- for (let Z = 0; Z < X; Z++) b.push(C);
1282
+ const U = r.readBits(2) + 3, C = b[b.length - 1] || 0;
1283
+ for (let $ = 0; $ < U; $++) b.push(C);
1284
1284
  } else if (T === 17) {
1285
- const X = r.readBits(3) + 3;
1286
- for (let C = 0; C < X; C++) b.push(0);
1285
+ const U = r.readBits(3) + 3;
1286
+ for (let C = 0; C < U; C++) b.push(0);
1287
1287
  } else {
1288
1288
  if (T !== 18) throw Error("Invalid code length symbol");
1289
1289
  {
1290
- const X = r.readBits(7) + 11;
1291
- for (let C = 0; C < X; C++) b.push(0);
1290
+ const U = r.readBits(7) + 11;
1291
+ for (let C = 0; C < U; C++) b.push(0);
1292
1292
  }
1293
1293
  }
1294
1294
  }
1295
- const M = b.slice(0, d), S = b.slice(d, d + m);
1296
- p = G(M), v = G(S);
1295
+ const M = b.slice(0, d), P = b.slice(d, d + m);
1296
+ p = G(M), v = G(P);
1297
1297
  }
1298
1298
  for (; ; ) {
1299
1299
  const d = gt(r, p);
@@ -1312,16 +1312,16 @@ function Oe(n) {
1312
1312
  b && (R += r.readBits(b));
1313
1313
  const M = h.length - R;
1314
1314
  if (M < 0) throw Error("Invalid distance");
1315
- for (let S = 0; S < A; S++) h.push(h[M + S] || 0);
1315
+ for (let P = 0; P < A; P++) h.push(h[M + P] || 0);
1316
1316
  } else if (d === 286 || d === 287) throw Error("Reserved length symbol");
1317
1317
  }
1318
1318
  }
1319
1319
  }
1320
1320
  }
1321
1321
  }
1322
- }(new Se(n.subarray(i)), s), new Uint8Array(s);
1322
+ }(new Pe(n.subarray(i)), s), new Uint8Array(s);
1323
1323
  }
1324
- function Ue(n) {
1324
+ function Xe(n) {
1325
1325
  const t = F, e = new Uint8Array(n);
1326
1326
  if (t.readASCII(e, 0, 4) !== "wOFF") throw Error("Invalid WOFF signature");
1327
1327
  const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), h = [];
@@ -1344,19 +1344,19 @@ function Ue(n) {
1344
1344
  const f = 16 * u, g = 16 * l - f;
1345
1345
  let p = 12 + 16 * l;
1346
1346
  const v = {};
1347
- for (const A of h) v[A.tag] = p, p = $(p + A.data.length);
1347
+ for (const A of h) v[A.tag] = p, p = K(p + A.data.length);
1348
1348
  const d = new Uint8Array(Math.max(r || 0, p));
1349
- _(d, 0, i), J(d, 4, l), J(d, 6, f), J(d, 8, c), J(d, 10, g);
1349
+ L(d, 0, i), J(d, 4, l), J(d, 6, f), J(d, 8, c), J(d, 10, g);
1350
1350
  let m = 12;
1351
1351
  for (const A of h) {
1352
1352
  Ce(d, m, A.tag), m += 4;
1353
1353
  const w = A.data;
1354
1354
  if (A.tag === "head" && w.length >= 12) {
1355
1355
  const y = new Uint8Array(w);
1356
- _(y, 8, 0), _(d, m, dt(y, 0, $(y.length))), m += 4;
1356
+ L(y, 8, 0), L(d, m, dt(y, 0, K(y.length))), m += 4;
1357
1357
  } else
1358
- _(d, m, dt(w, 0, $(w.length))), m += 4;
1359
- _(d, m, v[A.tag]), m += 4, _(d, m, A.data.length), m += 4;
1358
+ L(d, m, dt(w, 0, K(w.length))), m += 4;
1359
+ L(d, m, v[A.tag]), m += 4, L(d, m, A.data.length), m += 4;
1360
1360
  }
1361
1361
  for (const A of h) {
1362
1362
  const w = v[A.tag];
@@ -1365,15 +1365,15 @@ function Ue(n) {
1365
1365
  if (h.find((A) => A.tag === "head")) {
1366
1366
  const A = v.head, w = function(y, R) {
1367
1367
  const b = R + 8, M = [y[b], y[b + 1], y[b + 2], y[b + 3]];
1368
- _(y, b, 0);
1369
- const S = 2981146554 - (dt(y, 0, $(y.length)) >>> 0) >>> 0;
1370
- return y[b] = M[0], y[b + 1] = M[1], y[b + 2] = M[2], y[b + 3] = M[3], S >>> 0;
1368
+ L(y, b, 0);
1369
+ const P = 2981146554 - (dt(y, 0, K(y.length)) >>> 0) >>> 0;
1370
+ return y[b] = M[0], y[b + 1] = M[1], y[b + 2] = M[2], y[b + 3] = M[3], P >>> 0;
1371
1371
  }(d, A);
1372
- _(d, A + 8, w);
1372
+ L(d, A + 8, w);
1373
1373
  }
1374
1374
  return d.buffer;
1375
1375
  }
1376
- const Xe = { parseTab(n, t, e) {
1376
+ const Ue = { parseTab(n, t, e) {
1377
1377
  const i = { tables: [], ids: {}, off: t };
1378
1378
  n = new Uint8Array(n.buffer, t, e), t = 0;
1379
1379
  const s = F, r = s.readUshort;
@@ -1425,21 +1425,21 @@ const Xe = { parseTab(n, t, e) {
1425
1425
  t += 2;
1426
1426
  const l = i.readShort(n, t);
1427
1427
  return t += 2, t += 6, { unitsPerEm: s, xMin: r, yMin: h, xMax: a, yMax: l, indexToLocFormat: i.readShort(n, t) };
1428
- } }, _e = { parseTab(n, t, e) {
1428
+ } }, Le = { parseTab(n, t, e) {
1429
1429
  const i = F;
1430
1430
  t += 4;
1431
1431
  const s = i.readShort, r = i.readUshort;
1432
1432
  return { ascender: s(n, t), descender: s(n, t + 2), lineGap: s(n, t + 4), advanceWidthMax: r(n, t + 6), minLeftSideBearing: s(n, t + 8), minRightSideBearing: s(n, t + 10), xMaxExtent: s(n, t + 12), caretSlopeRise: s(n, t + 14), caretSlopeRun: s(n, t + 16), caretOffset: s(n, t + 18), res0: s(n, t + 20), res1: s(n, t + 22), res2: s(n, t + 24), res3: s(n, t + 26), metricDataFormat: s(n, t + 28), numberOfHMetrics: r(n, t + 30) };
1433
- } }, Le = { parseTab(n, t, e, i) {
1433
+ } }, _e = { parseTab(n, t, e, i) {
1434
1434
  const s = F, r = [], h = [], a = i.maxp.numGlyphs, l = i.hhea.numberOfHMetrics;
1435
1435
  let u = 0, c = 0, f = 0;
1436
1436
  for (; f < l; ) u = s.readUshort(n, t + (f << 2)), c = s.readShort(n, t + (f << 2) + 2), r.push(u), h.push(c), f++;
1437
1437
  for (; f < a; ) r.push(u), h.push(c), f++;
1438
1438
  return { aWidth: r, lsBearing: h };
1439
- } }, Mt = { cmap: Xe, head: De, hhea: _e, maxp: { parseTab(n, t, e) {
1439
+ } }, Mt = { cmap: Ue, head: De, hhea: Le, maxp: { parseTab(n, t, e) {
1440
1440
  const i = F;
1441
1441
  return i.readUint(n, t), t += 4, { numGlyphs: i.readUshort(n, t) };
1442
- } }, hmtx: Le, loca: { parseTab(n, t, e, i) {
1442
+ } }, hmtx: _e, loca: { parseTab(n, t, e, i) {
1443
1443
  const s = F, r = [], h = i.head.indexToLocFormat, a = i.maxp.numGlyphs + 1;
1444
1444
  if (h === 0) for (let l = 0; l < a; l++) r.push(s.readUshort(n, t + (l << 1)) << 1);
1445
1445
  else if (h === 1) for (let l = 0; l < a; l++) r.push(s.readUint(n, t + (l << 2)));
@@ -1488,7 +1488,7 @@ const Xe = { parseTab(n, t, e) {
1488
1488
  return a;
1489
1489
  } } }, ct = { parse(n) {
1490
1490
  const t = new Uint8Array(n);
1491
- F.readASCII(t, 0, 4) === "wOFF" && (n = Ue(n));
1491
+ F.readASCII(t, 0, 4) === "wOFF" && (n = Xe(n));
1492
1492
  const e = new Uint8Array(n), i = Mt, s = {}, r = { Qi: e, Xi: 0, Ni: 0 };
1493
1493
  for (const h in i) {
1494
1494
  const a = h, l = ct.findTable(e, a, 0);
@@ -1564,7 +1564,7 @@ class Be {
1564
1564
  }
1565
1565
  }
1566
1566
  }
1567
- class Ye {
1567
+ class Ie {
1568
1568
  constructor(t) {
1569
1569
  o(this, "qi");
1570
1570
  o(this, "Vi");
@@ -1650,7 +1650,7 @@ class Ye {
1650
1650
  return this.tr;
1651
1651
  }
1652
1652
  }
1653
- class Yt {
1653
+ class It {
1654
1654
  nr(t, e) {
1655
1655
  const i = t.cmap;
1656
1656
  if (!i || !i.tables) return 0;
@@ -1688,10 +1688,10 @@ class Yt {
1688
1688
  return 0;
1689
1689
  }
1690
1690
  }
1691
- class Ie {
1691
+ class He {
1692
1692
  constructor() {
1693
1693
  o(this, "dr");
1694
- this.dr = new Yt();
1694
+ this.dr = new It();
1695
1695
  }
1696
1696
  pr(t, e, i) {
1697
1697
  let s = 0;
@@ -1708,7 +1708,7 @@ class Ie {
1708
1708
  class Ne {
1709
1709
  constructor() {
1710
1710
  o(this, "vr");
1711
- this.vr = new Yt();
1711
+ this.vr = new It();
1712
1712
  }
1713
1713
  gr(t, e) {
1714
1714
  const i = [], s = /* @__PURE__ */ new Map();
@@ -1741,7 +1741,7 @@ class z extends at {
1741
1741
  o(this, "Pr");
1742
1742
  o(this, "Tr");
1743
1743
  o(this, "Sr", !1);
1744
- this.br = i, this.Fr = new Be(), this.$r = new Ye(e), this.Pr = new Ie(), this.Tr = new Ne();
1744
+ this.br = i, this.Fr = new Be(), this.$r = new Ie(e), this.Pr = new He(), this.Tr = new Ne();
1745
1745
  }
1746
1746
  async Er(e) {
1747
1747
  if (this.Sr) return;
@@ -1761,12 +1761,12 @@ class z extends at {
1761
1761
  const i = await this.kr(e);
1762
1762
  await this.Rr(i);
1763
1763
  } catch (i) {
1764
- throw new P("Failed to load font: " + (i instanceof Error ? i.message : "Unknown error"), { originalError: i });
1764
+ throw new S("Failed to load font: " + (i instanceof Error ? i.message : "Unknown error"), { originalError: i });
1765
1765
  }
1766
1766
  }
1767
1767
  async kr(e) {
1768
1768
  const i = await fetch(e);
1769
- if (!i.ok) throw new P(`Failed to load font file: ${i.status} ${i.statusText}`);
1769
+ if (!i.ok) throw new S(`Failed to load font file: ${i.status} ${i.statusText}`);
1770
1770
  return i.arrayBuffer();
1771
1771
  }
1772
1772
  async Rr(e) {
@@ -1903,7 +1903,7 @@ const ke = /^rgba?\(([^)]+)\)$/i;
1903
1903
  function B(n) {
1904
1904
  return Number.isNaN(n = Math.round(n)) ? 0 : D(n, 0, 255);
1905
1905
  }
1906
- function It(n, t = !1) {
1906
+ function Ht(n, t = !1) {
1907
1907
  if (!n) return null;
1908
1908
  const e = n.trim().toLowerCase();
1909
1909
  if (!e) return null;
@@ -1923,7 +1923,7 @@ function It(n, t = !1) {
1923
1923
  return [a, l, u, Math.round(c)];
1924
1924
  }(e)), i && (t || i[3] !== 0) ? i : null;
1925
1925
  }
1926
- class He {
1926
+ class Ye {
1927
1927
  constructor(t = {}) {
1928
1928
  o(this, "Xr");
1929
1929
  o(this, "en", null);
@@ -1935,7 +1935,7 @@ class He {
1935
1935
  if (this.rn = t.overlay ?? !1, t.gl) this.hn = t.gl, this.Xr = t.gl.canvas, this.nn = !1, this.an = !1;
1936
1936
  else if (this.rn && t.canvas) this.en = t.canvas, this.Xr = this.cn(), this.nn = !0, this.ln();
1937
1937
  else if (t.canvas) {
1938
- if (t.canvas instanceof HTMLVideoElement) throw new P("Video elements are only supported in overlay mode.");
1938
+ if (t.canvas instanceof HTMLVideoElement) throw new S("Video elements are only supported in overlay mode.");
1939
1939
  this.Xr = t.canvas, this.nn = !1;
1940
1940
  } else this.Xr = this.un(t.width, t.height), this.nn = !0;
1941
1941
  this.Xr.style.imageRendering = "pixelated";
@@ -1970,7 +1970,7 @@ class He {
1970
1970
  const t = this.dn();
1971
1971
  for (const e of t) {
1972
1972
  if (!e) continue;
1973
- const i = It(window.getComputedStyle(e).backgroundColor);
1973
+ const i = Ht(window.getComputedStyle(e).backgroundColor);
1974
1974
  if (i) return i;
1975
1975
  }
1976
1976
  return [255, 255, 255, 255];
@@ -1993,7 +1993,7 @@ class He {
1993
1993
  gn() {
1994
1994
  if (this.hn) return this.hn;
1995
1995
  const t = this.Xr.getContext("webgl2", { alpha: !0, premultipliedAlpha: !1, preserveDrawingBuffer: !0, antialias: !1, depth: !0, stencil: !1, powerPreference: "high-performance" });
1996
- if (!t) throw new P("`textmode.js` requires WebGL2 support.");
1996
+ if (!t) throw new S("`textmode.js` requires WebGL2 support.");
1997
1997
  return this.$ = t, t;
1998
1998
  }
1999
1999
  Ss() {
@@ -2041,7 +2041,7 @@ class x {
2041
2041
  if (typeof t == "string") {
2042
2042
  const r = t.trim();
2043
2043
  if (r.length === 0) throw Error("Color strings cannot be empty.");
2044
- const h = It(r, !0);
2044
+ const h = Ht(r, !0);
2045
2045
  return h ? x.wn(...h) : x.bn(r);
2046
2046
  }
2047
2047
  if (typeof t == "number") return typeof e == "number" && typeof i == "number" ? x.wn(t, e, i, s ?? 255) : typeof e == "number" ? x.Cn(t, e) : x.Cn(t, s ?? 255);
@@ -2096,19 +2096,19 @@ class xt extends at {
2096
2096
  o(this, "Pn", null);
2097
2097
  o(this, "Tn", "brightness");
2098
2098
  o(this, "Sn", null);
2099
- o(this, "Un");
2099
+ o(this, "En");
2100
2100
  o(this, "Rt", 0);
2101
2101
  o(this, "Gt", 0);
2102
2102
  o(this, "jt", 0);
2103
2103
  o(this, "Dt", 0);
2104
- o(this, "En", "sampled");
2105
- o(this, "kn", "fixed");
2104
+ o(this, "kn", "sampled");
2105
+ o(this, "Rn", "fixed");
2106
2106
  o(this, "Xt", [1, 1, 1, 1]);
2107
2107
  o(this, "Yt", [0, 0, 0, 1]);
2108
- o(this, "Rn", [0, 0, 0, 1]);
2109
- o(this, "Dn", [[0.1, 0, 0]]);
2108
+ o(this, "Dn", [0, 0, 0, 1]);
2109
+ o(this, "Ln", [[0.1, 0, 0]]);
2110
2110
  o(this, "Nt", null);
2111
- this.$ = e, this.R = i, this.Mn = s, this.Un = r, this.Fn = h, this.$n = a;
2111
+ this.$ = e, this.R = i, this.Mn = s, this.En = r, this.Fn = h, this.$n = a;
2112
2112
  const { width: c, height: f } = function(g, p, v, d) {
2113
2113
  const m = Math.min(v / g, d / p);
2114
2114
  return { width: Math.max(1, Math.floor(g * m)), height: Math.max(1, Math.floor(p * m)), scale: m };
@@ -2131,28 +2131,28 @@ class xt extends at {
2131
2131
  return this.jt = e ? 1 : 0, this.D = null, this;
2132
2132
  }
2133
2133
  charRotation(e) {
2134
- return this.Dt = St(e), this.D = null, this;
2134
+ return this.Dt = Pt(e), this.D = null, this;
2135
2135
  }
2136
2136
  charColorMode(e) {
2137
- return this.En = e, this.D = null, this;
2137
+ return this.kn = e, this.D = null, this;
2138
2138
  }
2139
2139
  cellColorMode(e) {
2140
- return this.kn = e, this.D = null, this;
2140
+ return this.Rn = e, this.D = null, this;
2141
2141
  }
2142
2142
  charColor(e, i, s, r) {
2143
- return this.Ln(this.Xt, e, i, s, r), this.D = null, this;
2143
+ return this.On(this.Xt, e, i, s, r), this.D = null, this;
2144
2144
  }
2145
2145
  cellColor(e, i, s, r) {
2146
- return this.Ln(this.Yt, e, i, s, r), this.D = null, this;
2146
+ return this.On(this.Yt, e, i, s, r), this.D = null, this;
2147
2147
  }
2148
2148
  background(e, i, s, r) {
2149
- return this.Ln(this.Rn, e, i, s, r), this.D = null, this;
2149
+ return this.On(this.Dn, e, i, s, r), this.D = null, this;
2150
2150
  }
2151
2151
  characters(e) {
2152
- return this.Nt = e, this.On(e), this.D = null, this;
2152
+ return this.Nt = e, this.zn(e), this.D = null, this;
2153
2153
  }
2154
2154
  Si(e) {
2155
- this.Pn !== e && (this.Pn = e, this.Nt && this.On(this.Nt), this.D = null);
2155
+ this.Pn !== e && (this.Pn = e, this.Nt && this.zn(this.Nt), this.D = null);
2156
2156
  }
2157
2157
  get texture() {
2158
2158
  return this.Mn;
@@ -2172,132 +2172,132 @@ class xt extends at {
2172
2172
  V() {
2173
2173
  return this.D || this.J(), this.D;
2174
2174
  }
2175
- zn() {
2176
- }
2177
2175
  Hn() {
2176
+ }
2177
+ Bn() {
2178
2178
  return this.Mn;
2179
2179
  }
2180
2180
  J() {
2181
- this.zn();
2182
- const e = this.Bn(), i = this.In(), s = this.Un.Gn(this.Tn, i), r = e.createUniforms(i);
2181
+ this.Hn();
2182
+ const e = this.In(), i = this.Gn(), s = this.En.jn(this.Tn, i), r = e.createUniforms(i);
2183
2183
  this.D = this.R.materialManager.st(s, r);
2184
2184
  }
2185
- Ln(e, i, s, r, h) {
2185
+ On(e, i, s, r, h) {
2186
2186
  const a = x.yn(i, s, r, h);
2187
2187
  it(e, a.r, a.g, a.b, a.a);
2188
2188
  }
2189
- On(e) {
2189
+ zn(e) {
2190
2190
  if (!this.Pn) return;
2191
2191
  const i = this.Pn.Ir(e).filter((s) => Array.isArray(s)).slice(0, 255);
2192
- this.Dn = i.length > 0 ? i : this.Dn;
2192
+ this.Ln = i.length > 0 ? i : this.Ln;
2193
2193
  }
2194
2194
  createBaseConversionUniforms() {
2195
- return { u_image: this.Hn(), u_invert: !!this.Rt, u_flipX: !!this.Gt, u_flipY: !!this.jt, u_charRotation: this.Dt, u_charColorFixed: this.En === "fixed", u_charColor: this.Xt, u_cellColorFixed: this.kn === "fixed", u_cellColor: this.Yt, u_backgroundColor: this.Rn, u_charCount: this.Dn.length, u_charList: this.Dn };
2195
+ return { u_image: this.Bn(), u_invert: !!this.Rt, u_flipX: !!this.Gt, u_flipY: !!this.jt, u_charRotation: this.Dt, u_charColorFixed: this.kn === "fixed", u_charColor: this.Xt, u_cellColorFixed: this.Rn === "fixed", u_cellColor: this.Yt, u_backgroundColor: this.Dn, u_charCount: this.Ln.length, u_charList: this.Ln };
2196
2196
  }
2197
- Bn() {
2197
+ In() {
2198
2198
  if (this.Sn && this.Sn.id === this.Tn) return this.Sn;
2199
- const e = this.Un.jn(this.Tn);
2199
+ const e = this.En.Qn(this.Tn);
2200
2200
  if (!e) throw Error(`[textmode.js] Conversion mode "${this.Tn}" is not registered. If this mode is provided by an add-on, make sure its plugin is installed before loading sources.`);
2201
2201
  return this.Sn = e, e;
2202
2202
  }
2203
- In() {
2203
+ Gn() {
2204
2204
  if (!this.Pn) throw Error("[textmode.js] Cannot create conversion context: no active font set. Ensure $setActiveFont() is called before rendering.");
2205
2205
  return { renderer: this.R, gl: this.$, font: this.Pn, source: this };
2206
2206
  }
2207
2207
  }
2208
- class K extends xt {
2208
+ class V extends xt {
2209
2209
  constructor(t, e, i, s, r, h, a, l) {
2210
2210
  super(t, e, i, s, r, h, a, l);
2211
2211
  }
2212
- static Qn(t, e, i, s, r) {
2212
+ static Nn(t, e, i, s, r) {
2213
2213
  const h = t.context, a = wt(h, i), { width: l, height: u } = bt(i);
2214
- return new K(h, t, a, e, l, u, s, r);
2214
+ return new V(h, t, a, e, l, u, s, r);
2215
2215
  }
2216
2216
  }
2217
2217
  class Nt {
2218
2218
  constructor(t = 60) {
2219
- o(this, "Nn");
2220
2219
  o(this, "Xn");
2221
- o(this, "Yn", null);
2222
- o(this, "Kn", 0);
2223
- o(this, "Wn", !0);
2224
- o(this, "Zn", 0);
2220
+ o(this, "Yn");
2221
+ o(this, "Kn", null);
2222
+ o(this, "Wn", 0);
2223
+ o(this, "Zn", !0);
2225
2224
  o(this, "qn", 0);
2226
- o(this, "Vn", []);
2227
- o(this, "Jn", 10);
2228
- o(this, "th", 0);
2225
+ o(this, "Vn", 0);
2226
+ o(this, "Jn", []);
2227
+ o(this, "th", 10);
2229
2228
  o(this, "sh", 0);
2230
- o(this, "eh", -1);
2231
- this.Xn = t, this.Nn = 1e3 / t;
2229
+ o(this, "eh", 0);
2230
+ o(this, "ih", -1);
2231
+ this.Yn = t, this.Xn = 1e3 / t;
2232
2232
  }
2233
- ih(t) {
2234
- if (!this.Wn) return;
2235
- this.eh === -1 && (this.eh = performance.now()), this.Kn = performance.now();
2233
+ rh(t) {
2234
+ if (!this.Zn) return;
2235
+ this.ih === -1 && (this.ih = performance.now()), this.Wn = performance.now();
2236
2236
  const e = (i) => {
2237
- if (!this.Wn) return void (this.Yn = null);
2238
- const s = i - this.Kn;
2239
- s >= this.Nn && (t(), this.Kn = i - s % this.Nn), this.Wn && (this.Yn = requestAnimationFrame(e));
2237
+ if (!this.Zn) return void (this.Kn = null);
2238
+ const s = i - this.Wn;
2239
+ s >= this.Xn && (t(), this.Wn = i - s % this.Xn), this.Zn && (this.Kn = requestAnimationFrame(e));
2240
2240
  };
2241
- this.Yn = requestAnimationFrame(e);
2242
- }
2243
- rh() {
2244
- this.Yn && (cancelAnimationFrame(this.Yn), this.Yn = null);
2241
+ this.Kn = requestAnimationFrame(e);
2245
2242
  }
2246
2243
  nh() {
2247
- this.Wn && (this.Wn = !1, this.rh());
2244
+ this.Kn && (cancelAnimationFrame(this.Kn), this.Kn = null);
2248
2245
  }
2249
- hh(t) {
2250
- this.Wn || (this.Wn = !0, this.ih(t));
2246
+ hh() {
2247
+ this.Zn && (this.Zn = !1, this.nh());
2251
2248
  }
2252
- oh(t, e) {
2253
- if (t === void 0) return this.Zn;
2254
- this.Xn = t, this.Nn = 1e3 / t, this.Wn && e && (this.rh(), this.ih(e));
2249
+ oh(t) {
2250
+ this.Zn || (this.Zn = !0, this.rh(t));
2255
2251
  }
2256
- ah() {
2252
+ ah(t, e) {
2253
+ if (t === void 0) return this.qn;
2254
+ this.Yn = t, this.Xn = 1e3 / t, this.Zn && e && (this.nh(), this.rh(e));
2255
+ }
2256
+ uh() {
2257
2257
  const t = performance.now();
2258
- if (this.qn > 0) {
2259
- const e = t - this.qn;
2260
- this.th = e, this.Vn.push(e), this.Vn.length > this.Jn && this.Vn.shift();
2261
- const i = this.Vn.reduce((s, r) => s + r, 0) / this.Vn.length;
2262
- this.Zn = 1e3 / i;
2258
+ if (this.Vn > 0) {
2259
+ const e = t - this.Vn;
2260
+ this.sh = e, this.Jn.push(e), this.Jn.length > this.th && this.Jn.shift();
2261
+ const i = this.Jn.reduce((s, r) => s + r, 0) / this.Jn.length;
2262
+ this.qn = 1e3 / i;
2263
2263
  }
2264
- this.qn = t;
2265
- }
2266
- get uh() {
2267
- return this.Wn;
2264
+ this.Vn = t;
2268
2265
  }
2269
2266
  get fh() {
2270
2267
  return this.Zn;
2271
2268
  }
2272
2269
  get dh() {
2273
- return this.Xn;
2274
- }
2275
- set dh(t) {
2276
- this.Xn = t, this.Nn = 1e3 / t;
2270
+ return this.qn;
2277
2271
  }
2278
2272
  get ph() {
2279
- return this.sh;
2273
+ return this.Yn;
2280
2274
  }
2281
2275
  set ph(t) {
2282
- this.sh = t;
2276
+ this.Yn = t, this.Xn = 1e3 / t;
2283
2277
  }
2284
- gh() {
2285
- this.sh++;
2278
+ get gh() {
2279
+ return this.eh;
2286
2280
  }
2287
- get mh() {
2288
- return this.eh === -1 ? 0 : performance.now() - this.eh;
2281
+ set gh(t) {
2282
+ this.eh = t;
2289
2283
  }
2290
- set mh(t) {
2291
- this.eh = performance.now() - t;
2284
+ mh() {
2285
+ this.eh++;
2292
2286
  }
2293
2287
  get _h() {
2294
- return this.mh / 1e3;
2288
+ return this.ih === -1 ? 0 : performance.now() - this.ih;
2295
2289
  }
2296
2290
  set _h(t) {
2297
- this.mh = 1e3 * t;
2291
+ this.ih = performance.now() - t;
2298
2292
  }
2299
2293
  get yh() {
2300
- return this.th;
2294
+ return this._h / 1e3;
2295
+ }
2296
+ set yh(t) {
2297
+ this._h = 1e3 * t;
2298
+ }
2299
+ get Ah() {
2300
+ return this.sh;
2301
2301
  }
2302
2302
  }
2303
2303
  function zt(n, t, e) {
@@ -2306,71 +2306,68 @@ function zt(n, t, e) {
2306
2306
  class kt {
2307
2307
  constructor(t, e) {
2308
2308
  o(this, "Xr");
2309
- o(this, "Ah");
2310
- o(this, "wh", { x: -1 / 0, y: -1 / 0 });
2309
+ o(this, "wh");
2311
2310
  o(this, "bh", { x: -1 / 0, y: -1 / 0 });
2312
- o(this, "Ch", null);
2313
- o(this, "xh", 0);
2314
- o(this, "Mh");
2311
+ o(this, "Ch", { x: -1 / 0, y: -1 / 0 });
2312
+ o(this, "xh", null);
2313
+ o(this, "Mh", 0);
2315
2314
  o(this, "Fh");
2316
2315
  o(this, "$h");
2317
2316
  o(this, "Ph");
2318
2317
  o(this, "Th");
2319
2318
  o(this, "Sh");
2320
- o(this, "Eh", !1);
2321
- o(this, "kh");
2319
+ o(this, "Eh");
2320
+ o(this, "kh", !1);
2322
2321
  o(this, "Rh");
2323
2322
  o(this, "Dh");
2324
2323
  o(this, "Lh");
2325
2324
  o(this, "Oh");
2326
- this.Xr = t, this.Ah = e;
2325
+ o(this, "zh");
2326
+ this.Xr = t, this.wh = e;
2327
2327
  }
2328
- zh(t) {
2328
+ Hh(t) {
2329
2329
  const e = performance.now() + Math.max(0, t);
2330
- e > this.xh && (this.xh = e);
2330
+ e > this.Mh && (this.Mh = e);
2331
2331
  }
2332
- Hh() {
2333
- return performance.now() < this.xh;
2332
+ Bh() {
2333
+ return performance.now() < this.Mh;
2334
2334
  }
2335
- Bh(t) {
2335
+ Ih(t) {
2336
2336
  const e = this.Xr.canvas;
2337
2337
  e.style.cursor = t == null || t === "" ? "" : t;
2338
2338
  }
2339
- Ih() {
2340
- if (this.Eh) return;
2339
+ Gh() {
2340
+ if (this.kh) return;
2341
2341
  const t = this.Xr.canvas;
2342
- this.Mh = (e) => {
2343
- this.Gh(e), this.jh(e);
2344
- }, this.Fh = () => {
2345
- this.bh = { ...this.wh }, this.wh.x = -1 / 0, this.wh.y = -1 / 0, this.Ch = null;
2346
- }, this.$h = (e) => {
2347
- this.Gh(e), this.Qh(e);
2342
+ this.Fh = (e) => {
2343
+ this.jh(e), this.Qh(e);
2344
+ }, this.$h = () => {
2345
+ this.Ch = { ...this.bh }, this.bh.x = -1 / 0, this.bh.y = -1 / 0, this.xh = null;
2348
2346
  }, this.Ph = (e) => {
2349
- this.Gh(e), this.Nh(e);
2347
+ this.jh(e), this.Nh(e);
2350
2348
  }, this.Th = (e) => {
2351
- this.Gh(e), this.Xh(e);
2349
+ this.jh(e), this.Xh(e);
2352
2350
  }, this.Sh = (e) => {
2353
- this.Gh(e), this.Yh(e);
2354
- }, t.addEventListener("mousemove", this.Mh, { passive: !0 }), t.addEventListener("mouseleave", this.Fh, { passive: !0 }), t.addEventListener("mousedown", this.$h, { passive: !0 }), t.addEventListener("mouseup", this.Ph, { passive: !0 }), t.addEventListener("click", this.Th, { passive: !0 }), t.addEventListener("wheel", this.Sh, { passive: !1 }), this.Eh = !0;
2351
+ this.jh(e), this.Yh(e);
2352
+ }, this.Eh = (e) => {
2353
+ this.jh(e), this.Kh(e);
2354
+ }, t.addEventListener("mousemove", this.Fh, { passive: !0 }), t.addEventListener("mouseleave", this.$h, { passive: !0 }), t.addEventListener("mousedown", this.Ph, { passive: !0 }), t.addEventListener("mouseup", this.Th, { passive: !0 }), t.addEventListener("click", this.Sh, { passive: !0 }), t.addEventListener("wheel", this.Eh, { passive: !1 }), this.kh = !0;
2355
2355
  }
2356
- Kh() {
2357
- if (!this.Eh) return;
2356
+ Wh() {
2357
+ if (!this.kh) return;
2358
2358
  const t = this.Xr.canvas;
2359
- t.removeEventListener("mousemove", this.Mh), t.removeEventListener("mouseleave", this.Fh), t.removeEventListener("mousedown", this.$h), t.removeEventListener("mouseup", this.Ph), t.removeEventListener("click", this.Th), t.removeEventListener("wheel", this.Sh), this.Eh = !1;
2359
+ t.removeEventListener("mousemove", this.Fh), t.removeEventListener("mouseleave", this.$h), t.removeEventListener("mousedown", this.Ph), t.removeEventListener("mouseup", this.Th), t.removeEventListener("click", this.Sh), t.removeEventListener("wheel", this.Eh), this.kh = !1;
2360
2360
  }
2361
- Wh() {
2362
- if (this.Eh) try {
2363
- if (this.Ch) {
2364
- const t = new MouseEvent("mousemove", { clientX: this.Ch.x, clientY: this.Ch.y, bubbles: !1, cancelable: !1 });
2365
- this.Gh(t);
2361
+ Zh() {
2362
+ if (this.kh) try {
2363
+ if (this.xh) {
2364
+ const t = new MouseEvent("mousemove", { clientX: this.xh.x, clientY: this.xh.y, bubbles: !1, cancelable: !1 });
2365
+ this.jh(t);
2366
2366
  }
2367
2367
  } catch {
2368
- this.wh.x = -1 / 0, this.wh.y = -1 / 0;
2368
+ this.bh.x = -1 / 0, this.bh.y = -1 / 0;
2369
2369
  }
2370
2370
  }
2371
- Zh(t) {
2372
- this.kh = t;
2373
- }
2374
2371
  qh(t) {
2375
2372
  this.Rh = t;
2376
2373
  }
@@ -2383,122 +2380,123 @@ class kt {
2383
2380
  so(t) {
2384
2381
  this.Oh = t;
2385
2382
  }
2386
- eo() {
2387
- return { x: this.wh.x, y: this.wh.y };
2383
+ eo(t) {
2384
+ this.zh = t;
2388
2385
  }
2389
- io(t, e = {}) {
2390
- return { position: { ...this.wh }, previousPosition: { ...this.bh }, originalEvent: t, ...e };
2386
+ io() {
2387
+ return { x: this.bh.x, y: this.bh.y };
2391
2388
  }
2392
- jh(t) {
2393
- this.Lh && !this.Hh() && this.Lh(this.io(t));
2389
+ ro(t, e = {}) {
2390
+ return { position: { ...this.bh }, previousPosition: { ...this.Ch }, originalEvent: t, ...e };
2394
2391
  }
2395
2392
  Qh(t) {
2396
- this.Rh && !this.Hh() && this.Rh(this.io(t, { button: t.button }));
2393
+ this.Oh && !this.Bh() && this.Oh(this.ro(t));
2397
2394
  }
2398
2395
  Nh(t) {
2399
- this.Dh && !this.Hh() && this.Dh(this.io(t, { button: t.button }));
2396
+ this.Dh && !this.Bh() && this.Dh(this.ro(t, { button: t.button }));
2400
2397
  }
2401
2398
  Xh(t) {
2402
- this.kh && !this.Hh() && this.kh(this.io(t, { button: t.button }));
2399
+ this.Lh && !this.Bh() && this.Lh(this.ro(t, { button: t.button }));
2403
2400
  }
2404
2401
  Yh(t) {
2405
- this.Oh && !this.Hh() && this.Oh(this.io(t, { delta: { x: t.deltaX, y: t.deltaY } }));
2402
+ this.Rh && !this.Bh() && this.Rh(this.ro(t, { button: t.button }));
2403
+ }
2404
+ Kh(t) {
2405
+ this.zh && !this.Bh() && this.zh(this.ro(t, { delta: { x: t.deltaX, y: t.deltaY } }));
2406
2406
  }
2407
- Gh(t) {
2408
- const e = this.Ah();
2409
- this.bh = { ...this.wh }, this.Ch = { x: t.clientX, y: t.clientY };
2407
+ jh(t) {
2408
+ const e = this.wh();
2409
+ this.Ch = { ...this.bh }, this.xh = { x: t.clientX, y: t.clientY };
2410
2410
  const i = zt(e, t.clientX, t.clientY);
2411
- this.wh.x = i.x, this.wh.y = i.y;
2411
+ this.bh.x = i.x, this.bh.y = i.y;
2412
2412
  }
2413
2413
  }
2414
2414
  const Ge = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: kt }, Symbol.toStringTag, { value: "Module" }));
2415
- class Ht {
2415
+ class Yt {
2416
2416
  constructor() {
2417
- o(this, "ro", /* @__PURE__ */ new Map());
2418
- o(this, "no", null);
2417
+ o(this, "no", /* @__PURE__ */ new Map());
2419
2418
  o(this, "ho", null);
2420
- o(this, "oo");
2419
+ o(this, "oo", null);
2421
2420
  o(this, "ao");
2422
- o(this, "Eh", !1);
2423
2421
  o(this, "co");
2422
+ o(this, "kh", !1);
2424
2423
  o(this, "lo");
2425
- o(this, "uo", { 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" });
2424
+ o(this, "uo");
2425
+ o(this, "fo", { 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" });
2426
2426
  }
2427
- Ih() {
2428
- this.Eh || (this.oo = (t) => {
2429
- this.fo(t);
2430
- }, this.ao = (t) => {
2427
+ Gh() {
2428
+ this.kh || (this.ao = (t) => {
2431
2429
  this.do(t);
2432
- }, window.addEventListener("keydown", this.oo, { passive: !1 }), window.addEventListener("keyup", this.ao, { passive: !1 }), this.Eh = !0);
2430
+ }, this.co = (t) => {
2431
+ this.po(t);
2432
+ }, window.addEventListener("keydown", this.ao, { passive: !1 }), window.addEventListener("keyup", this.co, { passive: !1 }), this.kh = !0);
2433
2433
  }
2434
- Kh() {
2435
- this.Eh && (window.removeEventListener("keydown", this.oo), window.removeEventListener("keyup", this.ao), this.Eh = !1, this.ro.clear(), this.no = null, this.ho = null);
2436
- }
2437
- qh(t) {
2438
- this.co = t;
2434
+ Wh() {
2435
+ this.kh && (window.removeEventListener("keydown", this.ao), window.removeEventListener("keyup", this.co), this.kh = !1, this.no.clear(), this.ho = null, this.oo = null);
2439
2436
  }
2440
2437
  Vh(t) {
2441
2438
  this.lo = t;
2442
2439
  }
2443
- po(t) {
2444
- const e = this.vo(t), i = this.ro.get(t) || this.ro.get(e);
2445
- return (i == null ? void 0 : i.isPressed) || !1;
2440
+ Jh(t) {
2441
+ this.uo = t;
2446
2442
  }
2447
- mo() {
2448
- return this.no;
2443
+ vo(t) {
2444
+ const e = this.mo(t), i = this.no.get(t) || this.no.get(e);
2445
+ return (i == null ? void 0 : i.isPressed) || !1;
2449
2446
  }
2450
2447
  _o() {
2451
2448
  return this.ho;
2452
2449
  }
2453
2450
  yo() {
2454
- const t = [];
2455
- for (const [e, i] of this.ro) i.isPressed && t.push(e);
2456
- return t;
2451
+ return this.oo;
2457
2452
  }
2458
2453
  Ao() {
2459
- return { ctrl: this.po("Control"), shift: this.po("Shift"), alt: this.po("Alt"), meta: this.po("Meta") };
2454
+ const t = [];
2455
+ for (const [e, i] of this.no) i.isPressed && t.push(e);
2456
+ return t;
2460
2457
  }
2461
2458
  wo() {
2462
- this.ro.clear(), this.no = null, this.ho = null;
2459
+ return { ctrl: this.vo("Control"), shift: this.vo("Shift"), alt: this.vo("Alt"), meta: this.vo("Meta") };
2463
2460
  }
2464
- fo(t) {
2461
+ bo() {
2462
+ this.no.clear(), this.ho = null, this.oo = null;
2463
+ }
2464
+ do(t) {
2465
2465
  const e = t.key, i = Date.now();
2466
- this.ro.has(e) || this.ro.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2467
- const s = this.ro.get(e);
2468
- s.isPressed || (s.isPressed = !0, s.lastPressTime = i, this.no = e, this.co && this.co(this.io(e, !0, t)));
2466
+ this.no.has(e) || this.no.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2467
+ const s = this.no.get(e);
2468
+ s.isPressed || (s.isPressed = !0, s.lastPressTime = i, this.ho = e, this.lo && this.lo(this.ro(e, !0, t)));
2469
2469
  }
2470
- io(t, e, i) {
2470
+ ro(t, e, i) {
2471
2471
  return { key: t, keyCode: i.keyCode, ctrlKey: i.ctrlKey, shiftKey: i.shiftKey, altKey: i.altKey, metaKey: i.metaKey, isPressed: e, originalEvent: i };
2472
2472
  }
2473
- do(t) {
2473
+ po(t) {
2474
2474
  const e = t.key, i = Date.now();
2475
- this.ro.has(e) || this.ro.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2476
- const s = this.ro.get(e);
2477
- s.isPressed = !1, s.lastReleaseTime = i, this.ho = e, this.lo && this.lo(this.io(e, !1, t));
2475
+ this.no.has(e) || this.no.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2476
+ const s = this.no.get(e);
2477
+ s.isPressed = !1, s.lastReleaseTime = i, this.oo = e, this.uo && this.uo(this.ro(e, !1, t));
2478
2478
  }
2479
- vo(t) {
2480
- return this.uo[t] || t.toLowerCase();
2479
+ mo(t) {
2480
+ return this.fo[t] || t.toLowerCase();
2481
2481
  }
2482
2482
  }
2483
- const Ve = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Ht }, Symbol.toStringTag, { value: "Module" }));
2483
+ const We = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Yt }, Symbol.toStringTag, { value: "Module" }));
2484
2484
  class Gt {
2485
2485
  constructor(t, e, i) {
2486
2486
  o(this, "Xr");
2487
- o(this, "bo");
2488
- o(this, "Ah");
2489
- o(this, "Co", /* @__PURE__ */ new Map());
2487
+ o(this, "Co");
2488
+ o(this, "wh");
2490
2489
  o(this, "xo", /* @__PURE__ */ new Map());
2491
2490
  o(this, "Mo", /* @__PURE__ */ new Map());
2492
- o(this, "Fo", null);
2493
- o(this, "$o");
2491
+ o(this, "Fo", /* @__PURE__ */ new Map());
2492
+ o(this, "$o", null);
2494
2493
  o(this, "Po");
2495
2494
  o(this, "To");
2496
2495
  o(this, "So");
2497
- o(this, "Uo");
2498
2496
  o(this, "Eo");
2499
- o(this, "Eh", !1);
2500
2497
  o(this, "ko");
2501
2498
  o(this, "Ro");
2499
+ o(this, "kh", !1);
2502
2500
  o(this, "Do");
2503
2501
  o(this, "Lo");
2504
2502
  o(this, "Oo");
@@ -2507,64 +2505,60 @@ class Gt {
2507
2505
  o(this, "Bo");
2508
2506
  o(this, "Io");
2509
2507
  o(this, "Go");
2510
- o(this, "jo", 320);
2511
- o(this, "Qo", 350);
2512
- o(this, "No", 10);
2513
- o(this, "Xo", 550);
2514
- o(this, "Yo", 14);
2515
- o(this, "Ko", 48);
2516
- o(this, "Wo", 650);
2517
- o(this, "Zo", 0.02);
2518
- o(this, "qo", 2);
2519
- o(this, "Vo", 600);
2520
- o(this, "Jo", 0);
2521
- o(this, "ta", null);
2522
- this.Xr = t, this.Ah = e, this.bo = i;
2508
+ o(this, "jo");
2509
+ o(this, "Qo");
2510
+ o(this, "No", 320);
2511
+ o(this, "Xo", 350);
2512
+ o(this, "Yo", 10);
2513
+ o(this, "Ko", 550);
2514
+ o(this, "Wo", 14);
2515
+ o(this, "Zo", 48);
2516
+ o(this, "qo", 650);
2517
+ o(this, "Vo", 0.02);
2518
+ o(this, "Jo", 2);
2519
+ o(this, "ta", 600);
2520
+ o(this, "sa", 0);
2521
+ o(this, "ea", null);
2522
+ this.Xr = t, this.wh = e, this.Co = i;
2523
2523
  const s = this.Xr.canvas;
2524
- this.$o = s.style.touchAction, this.Po = s.style.userSelect, s.style.touchAction || (s.style.touchAction = "none"), s.style.userSelect || (s.style.userSelect = "none");
2524
+ this.Po = s.style.touchAction, this.To = s.style.userSelect, s.style.touchAction || (s.style.touchAction = "none"), s.style.userSelect || (s.style.userSelect = "none");
2525
2525
  }
2526
- Ih() {
2527
- if (this.Eh) return;
2526
+ Gh() {
2527
+ if (this.kh) return;
2528
2528
  const t = this.Xr.canvas;
2529
- this.To = (e) => {
2530
- this.sa(e);
2531
- }, this.So = (e) => {
2532
- this.ea(e);
2533
- }, this.Uo = (e) => {
2529
+ this.So = (e) => {
2534
2530
  this.ia(e);
2535
2531
  }, this.Eo = (e) => {
2536
2532
  this.ra(e);
2537
- }, t.addEventListener("touchstart", this.To, { passive: !1 }), t.addEventListener("touchmove", this.So, { passive: !1 }), t.addEventListener("touchend", this.Uo, { passive: !1 }), t.addEventListener("touchcancel", this.Eo, { passive: !1 }), this.Eh = !0;
2533
+ }, this.ko = (e) => {
2534
+ this.na(e);
2535
+ }, this.Ro = (e) => {
2536
+ this.ha(e);
2537
+ }, t.addEventListener("touchstart", this.So, { passive: !1 }), t.addEventListener("touchmove", this.Eo, { passive: !1 }), t.addEventListener("touchend", this.ko, { passive: !1 }), t.addEventListener("touchcancel", this.Ro, { passive: !1 }), this.kh = !0;
2538
2538
  }
2539
- Kh() {
2540
- if (!this.Eh) return;
2539
+ Wh() {
2540
+ if (!this.kh) return;
2541
2541
  const t = this.Xr.canvas;
2542
- t.removeEventListener("touchstart", this.To), t.removeEventListener("touchmove", this.So), t.removeEventListener("touchend", this.Uo), t.removeEventListener("touchcancel", this.Eo), this.Eh = !1, this.Fo = null, this.Co.clear(), this.xo.clear(), this.Mo.forEach((e) => {
2542
+ t.removeEventListener("touchstart", this.So), t.removeEventListener("touchmove", this.Eo), t.removeEventListener("touchend", this.ko), t.removeEventListener("touchcancel", this.Ro), this.kh = !1, this.$o = null, this.xo.clear(), this.Mo.clear(), this.Fo.forEach((e) => {
2543
2543
  e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
2544
- }), this.Mo.clear(), this.ta = null, this.Jo = 0, t.style.touchAction = this.$o, t.style.userSelect = this.Po;
2544
+ }), this.Fo.clear(), this.ea = null, this.sa = 0, t.style.touchAction = this.Po, t.style.userSelect = this.To;
2545
2545
  }
2546
- Wh() {
2547
- if (!this.Ah() || this.Co.size === 0) return;
2546
+ Zh() {
2547
+ if (!this.wh() || this.xo.size === 0) return;
2548
2548
  const t = /* @__PURE__ */ new Map();
2549
- for (const e of this.Co.values()) {
2550
- const i = this.na(e.clientX, e.clientY, e.id, e);
2549
+ for (const e of this.xo.values()) {
2550
+ const i = this.oa(e.clientX, e.clientY, e.id, e);
2551
2551
  t.set(e.id, i);
2552
2552
  }
2553
- this.Co = t;
2554
- }
2555
- ha() {
2556
- return Array.from(this.Co.values()).map((t) => ({ ...t }));
2553
+ this.xo = t;
2557
2554
  }
2558
- oa(t) {
2559
- this.ko = t;
2555
+ aa() {
2556
+ return Array.from(this.xo.values()).map((t) => ({ ...t }));
2560
2557
  }
2561
- Jh(t) {
2562
- this.Ro = t;
2563
- }
2564
- aa(t) {
2558
+ ca(t) {
2565
2559
  this.Do = t;
2566
2560
  }
2567
- ca(t) {
2561
+ so(t) {
2568
2562
  this.Lo = t;
2569
2563
  }
2570
2564
  la(t) {
@@ -2585,108 +2579,114 @@ class Gt {
2585
2579
  va(t) {
2586
2580
  this.Go = t;
2587
2581
  }
2588
- sa(t) {
2582
+ ga(t) {
2583
+ this.jo = t;
2584
+ }
2585
+ ma(t) {
2586
+ this.Qo = t;
2587
+ }
2588
+ ia(t) {
2589
2589
  var s;
2590
- if (!this.Ah()) return;
2591
- t.preventDefault(), (s = this.bo) == null || s.zh(this.Vo);
2592
- const e = performance.now(), i = this.ga(t.changedTouches);
2590
+ if (!this.wh()) return;
2591
+ t.preventDefault(), (s = this.Co) == null || s.Hh(this.ta);
2592
+ const e = performance.now(), i = this._a(t.changedTouches);
2593
2593
  for (const r of i) {
2594
- const h = this.Co.get(r.id);
2595
- h && this.xo.set(r.id, this.ma(h)), this.Co.set(r.id, r);
2594
+ const h = this.xo.get(r.id);
2595
+ h && this.Mo.set(r.id, this.ya(h)), this.xo.set(r.id, r);
2596
2596
  const a = { id: r.id, startPosition: r, lastPosition: r, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
2597
- this.Ho && (a.longPressTimer = window.setTimeout(() => {
2598
- const l = this.Co.get(r.id);
2599
- l && (a.longPressFired = !0, this.Ho({ touch: this.ma(l), duration: performance.now() - a.startTime, originalEvent: t }));
2600
- }, this.Xo)), this.Mo.set(r.id, a), this.ko && this.ko(this._a(r, t, void 0, e));
2597
+ this.Io && (a.longPressTimer = window.setTimeout(() => {
2598
+ const l = this.xo.get(r.id);
2599
+ l && (a.longPressFired = !0, this.Io({ touch: this.ya(l), duration: performance.now() - a.startTime, originalEvent: t }));
2600
+ }, this.Ko)), this.Fo.set(r.id, a), this.Do && this.Do(this.wa(r, t, void 0, e));
2601
2601
  }
2602
- this.Co.size === 2 && this.ya();
2602
+ this.xo.size === 2 && this.ba();
2603
2603
  }
2604
- ea(t) {
2604
+ ra(t) {
2605
2605
  var s;
2606
- if (!this.Ah()) return;
2607
- t.preventDefault(), (s = this.bo) == null || s.zh(this.Vo);
2608
- const e = performance.now(), i = this.ga(t.changedTouches);
2606
+ if (!this.wh()) return;
2607
+ t.preventDefault(), (s = this.Co) == null || s.Hh(this.ta);
2608
+ const e = performance.now(), i = this._a(t.changedTouches);
2609
2609
  for (const r of i) {
2610
- const h = this.Co.get(r.id), a = h ? this.ma(h) : void 0;
2611
- a && this.xo.set(r.id, a), this.Co.set(r.id, r);
2612
- const l = this.Mo.get(r.id);
2613
- l && (l.lastPosition = r, l.lastTime = e, a) && q(a.clientX, a.clientY, r.clientX, r.clientY) > this.Yo && l.longPressTimer !== null && (window.clearTimeout(l.longPressTimer), l.longPressTimer = null), this.Ro && this.Ro(this._a(r, t, a, e));
2610
+ const h = this.xo.get(r.id), a = h ? this.ya(h) : void 0;
2611
+ a && this.Mo.set(r.id, a), this.xo.set(r.id, r);
2612
+ const l = this.Fo.get(r.id);
2613
+ l && (l.lastPosition = r, l.lastTime = e, a) && q(a.clientX, a.clientY, r.clientX, r.clientY) > this.Wo && l.longPressTimer !== null && (window.clearTimeout(l.longPressTimer), l.longPressTimer = null), this.Lo && this.Lo(this.wa(r, t, a, e));
2614
2614
  }
2615
- this.Co.size === 2 ? this.wa(t) : this.Fo = null;
2615
+ this.xo.size === 2 ? this.Ca(t) : this.$o = null;
2616
2616
  }
2617
- ia(t) {
2618
- if (!this.Ah()) return;
2617
+ na(t) {
2618
+ if (!this.wh()) return;
2619
2619
  t.preventDefault();
2620
- const e = performance.now(), i = this.ga(t.changedTouches);
2620
+ const e = performance.now(), i = this._a(t.changedTouches);
2621
2621
  for (const s of i) {
2622
- const r = this.Co.get(s.id), h = r ? this.ma(r) : void 0, a = this.Mo.get(s.id);
2623
- a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.Do && this.Do(this._a(s, t, h, e)), a && this.ba(a, t), this.Mo.delete(s.id), this.xo.delete(s.id), this.Co.delete(s.id);
2622
+ const r = this.xo.get(s.id), h = r ? this.ya(r) : void 0, a = this.Fo.get(s.id);
2623
+ a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.Oo && this.Oo(this.wa(s, t, h, e)), a && this.xa(a, t), this.Fo.delete(s.id), this.Mo.delete(s.id), this.xo.delete(s.id);
2624
2624
  }
2625
- this.Co.size < 2 && (this.Fo = null);
2625
+ this.xo.size < 2 && (this.$o = null);
2626
2626
  }
2627
- ra(t) {
2628
- if (!this.Ah()) return;
2627
+ ha(t) {
2628
+ if (!this.wh()) return;
2629
2629
  t.preventDefault();
2630
- const e = performance.now(), i = this.ga(t.changedTouches);
2630
+ const e = performance.now(), i = this._a(t.changedTouches);
2631
2631
  for (const s of i) {
2632
- const r = this.Co.get(s.id), h = r ? this.ma(r) : void 0, a = this.Mo.get(s.id);
2633
- a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.Lo && this.Lo(this._a(s, t, h, e)), this.Mo.delete(s.id), this.xo.delete(s.id), this.Co.delete(s.id);
2632
+ const r = this.xo.get(s.id), h = r ? this.ya(r) : void 0, a = this.Fo.get(s.id);
2633
+ a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.zo && this.zo(this.wa(s, t, h, e)), this.Fo.delete(s.id), this.Mo.delete(s.id), this.xo.delete(s.id);
2634
2634
  }
2635
- this.Co.size < 2 && (this.Fo = null);
2635
+ this.xo.size < 2 && (this.$o = null);
2636
2636
  }
2637
- ga(t) {
2637
+ _a(t) {
2638
2638
  const e = [];
2639
2639
  for (let i = 0; i < t.length; i += 1) {
2640
2640
  const s = t.item(i);
2641
- s && e.push(this.Ca(s));
2641
+ s && e.push(this.Ma(s));
2642
2642
  }
2643
2643
  return e;
2644
2644
  }
2645
- Ca(t) {
2646
- return this.na(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 });
2645
+ Ma(t) {
2646
+ return this.oa(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 });
2647
2647
  }
2648
- na(t, e, i, s) {
2649
- const r = zt(this.Ah(), t, e);
2648
+ oa(t, e, i, s) {
2649
+ const r = zt(this.wh(), t, e);
2650
2650
  return { id: i, x: r.x, y: r.y, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
2651
2651
  }
2652
- _a(t, e, i, s) {
2653
- const r = this.Mo.get(t.id), h = Array.from(this.xo.values()).map((u) => this.ma(u)), a = Array.from(this.Co.values()).map((u) => this.ma(u)), l = this.ga(e.changedTouches);
2654
- return { touch: this.ma(t), previousTouch: i ? this.ma(i) : void 0, touches: a, previousTouches: h, changedTouches: l, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
2652
+ wa(t, e, i, s) {
2653
+ const r = this.Fo.get(t.id), h = Array.from(this.Mo.values()).map((u) => this.ya(u)), a = Array.from(this.xo.values()).map((u) => this.ya(u)), l = this._a(e.changedTouches);
2654
+ return { touch: this.ya(t), previousTouch: i ? this.ya(i) : void 0, touches: a, previousTouches: h, changedTouches: l, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
2655
2655
  }
2656
- ya() {
2657
- if (this.Co.size !== 2) return void (this.Fo = null);
2658
- const t = Array.from(this.Co.values()), [e, i] = t, s = q(e.x, e.y, i.x, i.y), r = Rt(e.clientX, e.clientY, i.clientX, i.clientY);
2659
- this.Fo = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
2656
+ ba() {
2657
+ if (this.xo.size !== 2) return void (this.$o = null);
2658
+ const t = Array.from(this.xo.values()), [e, i] = t, s = q(e.x, e.y, i.x, i.y), r = Rt(e.clientX, e.clientY, i.clientX, i.clientY);
2659
+ this.$o = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
2660
2660
  }
2661
- wa(t) {
2662
- if (this.Fo || this.ya(), !this.Fo) return;
2663
- const [e, i] = this.Fo.ids, s = this.Co.get(e), r = this.Co.get(i);
2661
+ Ca(t) {
2662
+ if (this.$o || this.ba(), !this.$o) return;
2663
+ const [e, i] = this.$o.ids, s = this.xo.get(e), r = this.xo.get(i);
2664
2664
  if (!s || !r) return;
2665
- const h = q(s.x, s.y, r.x, r.y) / this.Fo.initialDistance, a = h - this.Fo.lastScale;
2666
- this.Io && Math.abs(a) > this.Zo && (this.Io({ touches: [this.ma(s), this.ma(r)], scale: h, deltaScale: a, center: this.xa(s, r), originalEvent: t }), this.Fo.lastScale = h);
2667
- let l = Rt(s.clientX, s.clientY, r.clientX, r.clientY) - this.Fo.initialAngle;
2665
+ const h = q(s.x, s.y, r.x, r.y) / this.$o.initialDistance, a = h - this.$o.lastScale;
2666
+ this.jo && Math.abs(a) > this.Vo && (this.jo({ touches: [this.ya(s), this.ya(r)], scale: h, deltaScale: a, center: this.Fa(s, r), originalEvent: t }), this.$o.lastScale = h);
2667
+ let l = Rt(s.clientX, s.clientY, r.clientX, r.clientY) - this.$o.initialAngle;
2668
2668
  l = (l + 180) % 360 - 180;
2669
- const u = l - this.Fo.lastRotation;
2670
- this.Go && Math.abs(u) > this.qo && (this.Go({ touches: [this.ma(s), this.ma(r)], rotation: l, deltaRotation: u, center: this.xa(s, r), originalEvent: t }), this.Fo.lastRotation = l);
2669
+ const u = l - this.$o.lastRotation;
2670
+ this.Qo && Math.abs(u) > this.Jo && (this.Qo({ touches: [this.ya(s), this.ya(r)], rotation: l, deltaRotation: u, center: this.Fa(s, r), originalEvent: t }), this.$o.lastRotation = l);
2671
2671
  }
2672
- xa(t, e) {
2673
- const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.na(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
2672
+ Fa(t, e) {
2673
+ const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.oa(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
2674
2674
  return { x: r.x, y: r.y };
2675
2675
  }
2676
- ba(t, e) {
2676
+ xa(t, e) {
2677
2677
  const i = performance.now(), s = i - t.startTime, r = t.lastPosition.clientX - t.startPosition.clientX, h = t.lastPosition.clientY - t.startPosition.clientY, a = Math.hypot(r, h);
2678
- if (!t.longPressFired && s <= this.jo && a <= this.No)
2679
- this.Ma(t.lastPosition, i) && this.zo ? this.zo({ touch: this.ma(t.lastPosition), taps: 2, originalEvent: e }) : this.Oo && this.Oo({ touch: this.ma(t.lastPosition), taps: 1, originalEvent: e });
2680
- else if (!t.longPressFired && s <= this.Wo && a >= this.Ko) {
2678
+ if (!t.longPressFired && s <= this.No && a <= this.Yo)
2679
+ this.$a(t.lastPosition, i) && this.Bo ? this.Bo({ touch: this.ya(t.lastPosition), taps: 2, originalEvent: e }) : this.Ho && this.Ho({ touch: this.ya(t.lastPosition), taps: 1, originalEvent: e });
2680
+ else if (!t.longPressFired && s <= this.qo && a >= this.Zo) {
2681
2681
  const l = Math.max(a, 1e-4), u = { x: r / l, y: h / l }, c = { x: r / s, y: h / s };
2682
- this.Bo && this.Bo({ touch: this.ma(t.lastPosition), direction: u, distance: l, velocity: c, originalEvent: e });
2682
+ this.Go && this.Go({ touch: this.ya(t.lastPosition), direction: u, distance: l, velocity: c, originalEvent: e });
2683
2683
  }
2684
- this.Jo = i, this.ta = this.ma(t.lastPosition);
2684
+ this.sa = i, this.ea = this.ya(t.lastPosition);
2685
2685
  }
2686
- Ma(t, e) {
2687
- return !this.ta || e - this.Jo > this.Qo ? !1 : q(t.clientX, t.clientY, this.ta.clientX, this.ta.clientY) <= this.No;
2686
+ $a(t, e) {
2687
+ return !this.ea || e - this.sa > this.Xo ? !1 : q(t.clientX, t.clientY, this.ea.clientX, this.ea.clientY) <= this.Yo;
2688
2688
  }
2689
- ma(t) {
2689
+ ya(t) {
2690
2690
  return { ...t };
2691
2691
  }
2692
2692
  }
@@ -2694,24 +2694,24 @@ const je = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
2694
2694
  class Q extends xt {
2695
2695
  constructor(e, i, s, r, h, a, l, u, c) {
2696
2696
  super(e, i, s, r, h, a, l, u);
2697
- o(this, "Fa");
2698
- this.Fa = c;
2697
+ o(this, "Pa");
2698
+ this.Pa = c;
2699
2699
  }
2700
- static $a(e, i, s, r, h) {
2700
+ static Ta(e, i, s, r, h) {
2701
2701
  const a = e.context, l = wt(a, s), { width: u, height: c } = bt(s);
2702
2702
  return new Q(a, e, l, i, u, c, r, h, s);
2703
2703
  }
2704
- Pa() {
2705
- this.Fa instanceof HTMLVideoElement ? this.Fa.readyState >= this.Fa.HAVE_CURRENT_DATA && rt(this.$, this.Mn, this.Fa) : rt(this.$, this.Mn, this.Fa);
2704
+ Sa() {
2705
+ this.Pa instanceof HTMLVideoElement ? this.Pa.readyState >= this.Pa.HAVE_CURRENT_DATA && rt(this.$, this.Mn, this.Pa) : rt(this.$, this.Mn, this.Pa);
2706
2706
  }
2707
2707
  V() {
2708
2708
  return this.D = null, super.V();
2709
2709
  }
2710
- zn() {
2711
- this.Pa();
2710
+ Hn() {
2711
+ this.Sa();
2712
2712
  }
2713
2713
  get source() {
2714
- return this.Fa;
2714
+ return this.Pa;
2715
2715
  }
2716
2716
  }
2717
2717
  class ut extends Q {
@@ -2719,12 +2719,12 @@ class ut extends Q {
2719
2719
  super(t, e, i, s, h, a, l, u, r);
2720
2720
  }
2721
2721
  dispose() {
2722
- super.dispose(), this.Ta.pause(), this.Ta.src = "", this.Ta.load();
2722
+ super.dispose(), this.Ea.pause(), this.Ea.src = "", this.Ea.load();
2723
2723
  }
2724
- Sa() {
2725
- this.Pa();
2724
+ ka() {
2725
+ this.Sa();
2726
2726
  }
2727
- static async Qn(t, e, i, s, r) {
2727
+ static async Nn(t, e, i, s, r) {
2728
2728
  const h = t.context, a = document.createElement("video");
2729
2729
  a.crossOrigin = "anonymous", a.loop = !0, a.muted = !0, a.playsInline = !0, await new Promise((f, g) => {
2730
2730
  a.addEventListener("loadedmetadata", () => f(), { once: !0 }), a.addEventListener("error", (p) => {
@@ -2737,40 +2737,40 @@ class ut extends Q {
2737
2737
  return new ut(h, t, l, e, a, u, c, s, r);
2738
2738
  }
2739
2739
  async play() {
2740
- await this.Ta.play();
2740
+ await this.Ea.play();
2741
2741
  }
2742
2742
  pause() {
2743
- this.Ta.pause();
2743
+ this.Ea.pause();
2744
2744
  }
2745
2745
  stop() {
2746
- this.Ta.pause(), this.Ta.currentTime = 0;
2746
+ this.Ea.pause(), this.Ea.currentTime = 0;
2747
2747
  }
2748
2748
  speed(t) {
2749
- return this.Ta.playbackRate = t, this;
2749
+ return this.Ea.playbackRate = t, this;
2750
2750
  }
2751
2751
  loop(t = !0) {
2752
- return this.Ta.loop = t, this;
2752
+ return this.Ea.loop = t, this;
2753
2753
  }
2754
2754
  time(t) {
2755
- return this.Ta.currentTime = t, this;
2755
+ return this.Ea.currentTime = t, this;
2756
2756
  }
2757
2757
  volume(t) {
2758
- return this.Ta.volume = D(t, 0, 1), this;
2758
+ return this.Ea.volume = D(t, 0, 1), this;
2759
2759
  }
2760
2760
  get videoElement() {
2761
- return this.Ta;
2761
+ return this.Ea;
2762
2762
  }
2763
2763
  get currentTime() {
2764
- return this.Ta.currentTime;
2764
+ return this.Ea.currentTime;
2765
2765
  }
2766
2766
  get duration() {
2767
- return this.Ta.duration;
2767
+ return this.Ea.duration;
2768
2768
  }
2769
2769
  get isPlaying() {
2770
- return !this.Ta.paused && !this.Ta.ended;
2770
+ return !this.Ea.paused && !this.Ea.ended;
2771
2771
  }
2772
- get Ta() {
2773
- return this.Fa;
2772
+ get Ea() {
2773
+ return this.Pa;
2774
2774
  }
2775
2775
  }
2776
2776
  async function st(n) {
@@ -2781,7 +2781,7 @@ async function st(n) {
2781
2781
  }
2782
2782
  return n;
2783
2783
  }
2784
- const We = (n) => class extends n {
2784
+ const Ze = (n) => class extends n {
2785
2785
  rotate(t = 0, e = 0, i = 0) {
2786
2786
  this.R.state.Jt(t), this.R.state.ts(e), this.R.state.ss(i);
2787
2787
  }
@@ -2927,15 +2927,15 @@ const We = (n) => class extends n {
2927
2927
  }
2928
2928
  async createFilterShader(t) {
2929
2929
  const e = await st(t), i = this.R.Pi(e);
2930
- return this.Ea(i), i;
2930
+ return this.Ra(i), i;
2931
2931
  }
2932
2932
  async createShader(t, e) {
2933
2933
  const i = await st(t), s = await st(e), r = this.R.Mi(i, s);
2934
- return this.Ea(r), r;
2934
+ return this.Ra(r), r;
2935
2935
  }
2936
2936
  createFramebuffer(t) {
2937
2937
  const e = this.R.Hi(t.width ?? this.grid.cols, t.height ?? this.grid.rows, t.attachments ?? 3);
2938
- return this.Ea(e), e;
2938
+ return this.Ra(e), e;
2939
2939
  }
2940
2940
  image(t, e, i) {
2941
2941
  this.R.Ti(t, e, i, this.font), t instanceof vt && this.R.Z();
@@ -2944,221 +2944,221 @@ const We = (n) => class extends n {
2944
2944
  const e = t, i = await new Promise((r, h) => {
2945
2945
  const a = new Image();
2946
2946
  a.crossOrigin = "anonymous", a.onload = () => r(a), a.onerror = (l) => h(l), a.src = e;
2947
- }), s = K.Qn(this.R, this.Un, i, this.grid.cols, this.grid.rows);
2948
- return this.Ea(s), s;
2947
+ }), s = V.Nn(this.R, this.En, i, this.grid.cols, this.grid.rows);
2948
+ return this.Ra(s), s;
2949
2949
  }
2950
2950
  async loadVideo(t) {
2951
- const e = await ut.Qn(this.R, this.Un, t, this.grid.cols, this.grid.rows);
2952
- return this.Ea(e), e;
2951
+ const e = await ut.Nn(this.R, this.En, t, this.grid.cols, this.grid.rows);
2952
+ return this.Ra(e), e;
2953
2953
  }
2954
2954
  createTexture(t) {
2955
- const e = Q.$a(this.R, this.Un, t, this.grid.cols, this.grid.rows);
2956
- return this.Ea(e), e;
2955
+ const e = Q.Ta(this.R, this.En, t, this.grid.cols, this.grid.rows);
2956
+ return this.Ra(e), e;
2957
2957
  }
2958
- }, Ke = (n) => class extends n {
2958
+ }, Ve = (n) => class extends n {
2959
2959
  get frameCount() {
2960
- return this.ka.ph;
2960
+ return this.Da.gh;
2961
2961
  }
2962
2962
  set frameCount(t) {
2963
- this.ka.ph = t;
2963
+ this.Da.gh = t;
2964
2964
  }
2965
2965
  frameRate(t) {
2966
- return t === void 0 ? this.ka.fh : this.ka.oh(t, () => this.Ra());
2966
+ return t === void 0 ? this.Da.dh : this.Da.ah(t, () => this.La());
2967
2967
  }
2968
2968
  targetFrameRate(t) {
2969
- if (t === void 0) return this.ka.dh;
2970
- this.ka.dh = t;
2969
+ if (t === void 0) return this.Da.ph;
2970
+ this.Da.ph = t;
2971
2971
  }
2972
2972
  noLoop() {
2973
- this.ka.nh();
2973
+ this.Da.hh();
2974
2974
  }
2975
2975
  loop() {
2976
- this.ka.hh(() => this.Ra());
2976
+ this.Da.oh(() => this.La());
2977
2977
  }
2978
2978
  redraw(t = 1) {
2979
- if (yt.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.Ra();
2979
+ if (yt.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.La();
2980
2980
  }
2981
2981
  isLooping() {
2982
- return this.ka.uh;
2982
+ return this.Da.fh;
2983
2983
  }
2984
2984
  get millis() {
2985
- return this.ka.mh;
2985
+ return this.Da._h;
2986
2986
  }
2987
2987
  set millis(t) {
2988
- this.ka.mh = t;
2988
+ this.Da._h = t;
2989
2989
  }
2990
2990
  get secs() {
2991
- return this.ka._h;
2991
+ return this.Da.yh;
2992
2992
  }
2993
2993
  set secs(t) {
2994
- this.ka._h = t;
2994
+ this.Da.yh = t;
2995
2995
  }
2996
2996
  deltaTime() {
2997
- return this.ka.yh;
2997
+ return this.Da.Ah;
2998
2998
  }
2999
2999
  }, Qe = (n) => class extends n {
3000
3000
  constructor(...t) {
3001
3001
  super(...t);
3002
3002
  }
3003
3003
  mouseClicked(t) {
3004
- this.bo.Zh(t);
3004
+ this.Co.qh(t);
3005
3005
  }
3006
3006
  mousePressed(t) {
3007
- this.bo.qh(t);
3007
+ this.Co.Vh(t);
3008
3008
  }
3009
3009
  mouseReleased(t) {
3010
- this.bo.Vh(t);
3010
+ this.Co.Jh(t);
3011
3011
  }
3012
3012
  mouseMoved(t) {
3013
- this.bo.Jh(t);
3013
+ this.Co.so(t);
3014
3014
  }
3015
3015
  mouseScrolled(t) {
3016
- this.bo.so(t);
3016
+ this.Co.eo(t);
3017
3017
  }
3018
3018
  get mouse() {
3019
- return this.bo.eo();
3019
+ return this.Co.io();
3020
3020
  }
3021
3021
  cursor(t) {
3022
- this.bo.Bh(t);
3022
+ this.Co.Ih(t);
3023
3023
  }
3024
- }, Ze = (n) => class extends n {
3024
+ }, $e = (n) => class extends n {
3025
3025
  constructor(...t) {
3026
3026
  super(...t);
3027
3027
  }
3028
3028
  touchStarted(t) {
3029
- this.Da.oa(t);
3029
+ this.Oa.ca(t);
3030
3030
  }
3031
3031
  touchMoved(t) {
3032
- this.Da.Jh(t);
3032
+ this.Oa.so(t);
3033
3033
  }
3034
3034
  touchEnded(t) {
3035
- this.Da.aa(t);
3035
+ this.Oa.la(t);
3036
3036
  }
3037
3037
  touchCancelled(t) {
3038
- this.Da.ca(t);
3038
+ this.Oa.ua(t);
3039
3039
  }
3040
3040
  tap(t) {
3041
- this.Da.la(t);
3041
+ this.Oa.fa(t);
3042
3042
  }
3043
3043
  doubleTap(t) {
3044
- this.Da.ua(t);
3044
+ this.Oa.da(t);
3045
3045
  }
3046
3046
  longPress(t) {
3047
- this.Da.fa(t);
3047
+ this.Oa.pa(t);
3048
3048
  }
3049
3049
  swipe(t) {
3050
- this.Da.da(t);
3050
+ this.Oa.va(t);
3051
3051
  }
3052
3052
  pinch(t) {
3053
- this.Da.pa(t);
3053
+ this.Oa.ga(t);
3054
3054
  }
3055
3055
  rotateGesture(t) {
3056
- this.Da.va(t);
3056
+ this.Oa.ma(t);
3057
3057
  }
3058
3058
  get touches() {
3059
- return this.Da.ha();
3059
+ return this.Oa.aa();
3060
3060
  }
3061
3061
  }, qe = (n) => class extends n {
3062
3062
  constructor(...t) {
3063
3063
  super(...t);
3064
3064
  }
3065
3065
  keyPressed(t) {
3066
- this.La.qh(t);
3066
+ this.za.Vh(t);
3067
3067
  }
3068
3068
  keyReleased(t) {
3069
- this.La.Vh(t);
3069
+ this.za.Jh(t);
3070
3070
  }
3071
3071
  isKeyPressed(t) {
3072
- return this.La.po(t);
3072
+ return this.za.vo(t);
3073
3073
  }
3074
3074
  get lastKeyPressed() {
3075
- return this.La.mo();
3075
+ return this.za._o();
3076
3076
  }
3077
3077
  get lastKeyReleased() {
3078
- return this.La._o();
3078
+ return this.za.yo();
3079
3079
  }
3080
3080
  get pressedKeys() {
3081
- return this.La.yo();
3081
+ return this.za.Ao();
3082
3082
  }
3083
3083
  get modifierState() {
3084
- return this.La.Ao();
3084
+ return this.za.wo();
3085
3085
  }
3086
3086
  };
3087
- class Vt {
3087
+ class Wt {
3088
3088
  constructor(t) {
3089
- o(this, "Oa");
3090
- o(this, "za", /* @__PURE__ */ new Map());
3091
- o(this, "Ha", []);
3089
+ o(this, "Ha");
3092
3090
  o(this, "Ba", /* @__PURE__ */ new Map());
3093
- o(this, "Ia", /* @__PURE__ */ new Map());
3091
+ o(this, "Ia", []);
3094
3092
  o(this, "Ga", /* @__PURE__ */ new Map());
3095
3093
  o(this, "ja", /* @__PURE__ */ new Map());
3096
3094
  o(this, "Qa", /* @__PURE__ */ new Map());
3097
3095
  o(this, "Na", /* @__PURE__ */ new Map());
3098
3096
  o(this, "Xa", /* @__PURE__ */ new Map());
3099
3097
  o(this, "Ya", /* @__PURE__ */ new Map());
3100
- this.Oa = t;
3098
+ o(this, "Ka", /* @__PURE__ */ new Map());
3099
+ o(this, "Wa", /* @__PURE__ */ new Map());
3100
+ this.Ha = t;
3101
3101
  }
3102
- Ka(t) {
3102
+ Za(t) {
3103
3103
  for (const e of t) {
3104
- if (this.za.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3105
- const i = this.Wa(e.name);
3104
+ if (this.Ba.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3105
+ const i = this.qa(e.name);
3106
3106
  try {
3107
- const s = e.install(this.Oa, i);
3107
+ const s = e.install(this.Ha, i);
3108
3108
  s instanceof Promise && s.catch((r) => {
3109
- console.error(`[textmode.js] Async plugin "${e.name}" installation error:`, r), this.Za(e.name);
3109
+ console.error(`[textmode.js] Async plugin "${e.name}" installation error:`, r), this.Va(e.name);
3110
3110
  });
3111
3111
  } catch (s) {
3112
- throw this.Za(e.name), s;
3112
+ throw this.Va(e.name), s;
3113
3113
  }
3114
- this.za.set(e.name, e), this.Ha.push(e.name);
3114
+ this.Ba.set(e.name, e), this.Ia.push(e.name);
3115
3115
  }
3116
3116
  }
3117
- async qa(t) {
3117
+ async Ja(t) {
3118
3118
  for (const e of t) {
3119
- if (this.za.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3120
- const i = this.Wa(e.name);
3119
+ if (this.Ba.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3120
+ const i = this.qa(e.name);
3121
3121
  try {
3122
- await e.install(this.Oa, i);
3122
+ await e.install(this.Ha, i);
3123
3123
  } catch (s) {
3124
- throw this.Za(e.name), s;
3124
+ throw this.Va(e.name), s;
3125
3125
  }
3126
- this.za.set(e.name, e), this.Ha.push(e.name);
3126
+ this.Ba.set(e.name, e), this.Ia.push(e.name);
3127
3127
  }
3128
3128
  }
3129
- async Va(t) {
3130
- const e = this.za.get(t);
3129
+ async tc(t) {
3130
+ const e = this.Ba.get(t);
3131
3131
  if (!e) return;
3132
- const i = this.Wa(t);
3133
- e.uninstall && await e.uninstall(this.Oa, i), this.za.delete(t), this.Ha.splice(this.Ha.indexOf(t), 1), this.Za(t);
3134
- }
3135
- Ja() {
3136
- this.tc(this.Ba, (t) => t());
3132
+ const i = this.qa(t);
3133
+ e.uninstall && await e.uninstall(this.Ha, i), this.Ba.delete(t), this.Ia.splice(this.Ia.indexOf(t), 1), this.Va(t);
3137
3134
  }
3138
3135
  sc() {
3139
- this.tc(this.Ia, (t) => t());
3136
+ this.ec(this.Ga, (t) => t());
3140
3137
  }
3141
- ec(t) {
3142
- this.tc(this.Ga, (e) => e(t));
3143
- }
3144
- rc(t) {
3145
- this.tc(this.ja, (e) => e(t));
3138
+ rc() {
3139
+ this.ec(this.ja, (t) => t());
3146
3140
  }
3147
3141
  nc(t) {
3148
- this.tc(this.Qa, (e) => e(t));
3142
+ this.ec(this.Qa, (e) => e(t));
3143
+ }
3144
+ hc(t) {
3145
+ this.ec(this.Na, (e) => e(t));
3149
3146
  }
3150
- async hc() {
3151
- await this.oc(this.Na, (t) => t());
3147
+ oc(t) {
3148
+ this.ec(this.Xa, (e) => e(t));
3152
3149
  }
3153
3150
  async ac() {
3154
- await this.oc(this.Xa, (t) => t());
3151
+ await this.cc(this.Ya, (t) => t());
3155
3152
  }
3156
- async cc() {
3157
- const t = [...this.za.keys()];
3158
- for (const e of t) await this.Va(e);
3153
+ async lc() {
3154
+ await this.cc(this.Ka, (t) => t());
3159
3155
  }
3160
- Wa(t) {
3161
- const e = this.Oa, i = this;
3156
+ async uc() {
3157
+ const t = [...this.Ba.keys()];
3158
+ for (const e of t) await this.tc(e);
3159
+ }
3160
+ qa(t) {
3161
+ const e = this.Ha, i = this;
3162
3162
  return { get renderer() {
3163
3163
  return e.R;
3164
3164
  }, get canvas() {
@@ -3173,184 +3173,184 @@ class Vt {
3173
3173
  return e.layers.base.drawFramebuffer;
3174
3174
  }, get asciiFramebuffer() {
3175
3175
  return e.layers.base.asciiFramebuffer;
3176
- }, registerPreDrawHook: (s) => i.lc(i.Ba, t, s), registerPostDrawHook: (s) => i.lc(i.Ia, t, s), registerLayerDisposedHook: (s) => i.lc(i.Ga, t, s), registerLayerPreRenderHook: (s) => i.lc(i.ja, t, s), registerLayerPostRenderHook: (s) => i.lc(i.Qa, t, s), registerPreSetupHook: (s) => i.lc(i.Na, t, s), registerPostSetupHook: (s) => i.lc(i.Xa, t, s), extendLayer: (s, r) => {
3177
- i.uc(t, s, r);
3176
+ }, registerPreDrawHook: (s) => i.fc(i.Ga, t, s), registerPostDrawHook: (s) => i.fc(i.ja, t, s), registerLayerDisposedHook: (s) => i.fc(i.Qa, t, s), registerLayerPreRenderHook: (s) => i.fc(i.Na, t, s), registerLayerPostRenderHook: (s) => i.fc(i.Xa, t, s), registerPreSetupHook: (s) => i.fc(i.Ya, t, s), registerPostSetupHook: (s) => i.fc(i.Ka, t, s), extendLayer: (s, r) => {
3177
+ i.dc(t, s, r);
3178
3178
  }, removeLayerExtension: (s) => {
3179
- i.fc(t, s);
3179
+ i.vc(t, s);
3180
3180
  } };
3181
3181
  }
3182
- lc(t, e, i) {
3182
+ fc(t, e, i) {
3183
3183
  const s = t.get(e) ?? /* @__PURE__ */ new Set();
3184
3184
  return s.add(i), t.set(e, s), () => {
3185
3185
  const r = t.get(e);
3186
3186
  r && (r.delete(i), r.size === 0 && t.delete(e));
3187
3187
  };
3188
3188
  }
3189
- Za(t) {
3190
- this.Ba.delete(t), this.Ia.delete(t), this.Ga.delete(t), this.ja.delete(t), this.Qa.delete(t), this.Na.delete(t), this.Xa.delete(t);
3191
- const e = this.Ya.get(t);
3189
+ Va(t) {
3190
+ this.Ga.delete(t), this.ja.delete(t), this.Qa.delete(t), this.Na.delete(t), this.Xa.delete(t), this.Ya.delete(t), this.Ka.delete(t);
3191
+ const e = this.Wa.get(t);
3192
3192
  if (e) {
3193
- for (const i of e.keys()) this.dc(i);
3194
- this.Ya.delete(t);
3193
+ for (const i of e.keys()) this.gc(i);
3194
+ this.Wa.delete(t);
3195
3195
  }
3196
3196
  }
3197
- tc(t, e) {
3198
- for (const i of this.Ha) {
3197
+ ec(t, e) {
3198
+ for (const i of this.Ia) {
3199
3199
  const s = t.get(i);
3200
3200
  s && s.forEach(e);
3201
3201
  }
3202
3202
  }
3203
- async oc(t, e) {
3204
- for (const i of this.Ha) {
3203
+ async cc(t, e) {
3204
+ for (const i of this.Ia) {
3205
3205
  const s = t.get(i);
3206
3206
  if (s) for (const r of s) await e(r);
3207
3207
  }
3208
3208
  }
3209
- uc(t, e, i) {
3210
- let s = this.Ya.get(t);
3211
- s || (s = /* @__PURE__ */ new Map(), this.Ya.set(t, s));
3212
- for (const [r, h] of this.Ya) r !== t && h.has(e) && console.warn(`[textmode.js] Plugin "${t}" is overwriting layer method "${e}" previously added by plugin "${r}".`);
3213
- s.set(e, i), this.vc(e, i);
3209
+ dc(t, e, i) {
3210
+ let s = this.Wa.get(t);
3211
+ s || (s = /* @__PURE__ */ new Map(), this.Wa.set(t, s));
3212
+ for (const [r, h] of this.Wa) r !== t && h.has(e) && console.warn(`[textmode.js] Plugin "${t}" is overwriting layer method "${e}" previously added by plugin "${r}".`);
3213
+ s.set(e, i), this.mc(e, i);
3214
3214
  }
3215
- fc(t, e) {
3216
- const i = this.Ya.get(t);
3215
+ vc(t, e) {
3216
+ const i = this.Wa.get(t);
3217
3217
  if (!i) return;
3218
3218
  i.delete(e);
3219
3219
  let s = !1;
3220
- for (const [r, h] of this.Ya) if (r !== t && h.has(e)) {
3220
+ for (const [r, h] of this.Wa) if (r !== t && h.has(e)) {
3221
3221
  s = !0;
3222
3222
  const a = h.get(e);
3223
- this.vc(e, a);
3223
+ this.mc(e, a);
3224
3224
  break;
3225
3225
  }
3226
- s || this.dc(e);
3226
+ s || this.gc(e);
3227
3227
  }
3228
- vc(t, e) {
3229
- const i = Object.getPrototypeOf(this.Oa.layers.base);
3228
+ mc(t, e) {
3229
+ const i = Object.getPrototypeOf(this.Ha.layers.base);
3230
3230
  Object.defineProperty(i, t, { value: e, writable: !0, configurable: !0, enumerable: !1 });
3231
3231
  }
3232
- dc(t) {
3233
- const e = Object.getPrototypeOf(this.Oa.layers.base), i = Object.getOwnPropertyDescriptor(e, t);
3232
+ gc(t) {
3233
+ const e = Object.getPrototypeOf(this.Ha.layers.base), i = Object.getOwnPropertyDescriptor(e, t);
3234
3234
  i && i.configurable && delete e[t];
3235
3235
  }
3236
3236
  }
3237
- const ri = Object.freeze(Object.defineProperty({ __proto__: null, TextmodePluginManager: Vt }, Symbol.toStringTag, { value: "Module" })), W = `#version 300 es
3237
+ const ri = Object.freeze(Object.defineProperty({ __proto__: null, TextmodePluginManager: Wt }, Symbol.toStringTag, { value: "Module" })), Z = `#version 300 es
3238
3238
  layout(location=0)in vec2 A;layout(location=1)in vec2 B;out vec2 v_uv;void main(){v_uv=B;gl_Position=vec4(A,0.,1.);}`, jt = `#version 300 es
3239
3239
  precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`;
3240
- class Wt {
3240
+ class Zt {
3241
3241
  constructor() {
3242
- o(this, "gc", /* @__PURE__ */ new Map());
3243
- o(this, "mc", []);
3244
- o(this, "_c", 0);
3245
- o(this, "yc", 0);
3246
- o(this, "wc");
3242
+ o(this, "_c", /* @__PURE__ */ new Map());
3243
+ o(this, "yc", []);
3244
+ o(this, "wc", 0);
3245
+ o(this, "bc", 0);
3246
+ o(this, "Cc");
3247
3247
  }
3248
- get bc() {
3249
- return this._c;
3248
+ get xc() {
3249
+ return this.wc;
3250
3250
  }
3251
- get Cc() {
3252
- if (this._c === 0) return 0;
3251
+ get Mc() {
3252
+ if (this.wc === 0) return 0;
3253
3253
  let t = 0;
3254
- for (const e of this.mc) {
3255
- const i = this.gc.get(e);
3254
+ for (const e of this.yc) {
3255
+ const i = this._c.get(e);
3256
3256
  i && (t += D(i.progress, 0, 1) * i.weight);
3257
3257
  }
3258
- return Math.min(1, t / this._c);
3258
+ return Math.min(1, t / this.wc);
3259
3259
  }
3260
- xc(t) {
3261
- this.wc = t;
3260
+ Fc(t) {
3261
+ this.Cc = t;
3262
3262
  }
3263
- Mc(t, e = 1) {
3264
- const i = `phase-${this.mc.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
3265
- return this.gc.set(i, s), this.mc.push(i), this._c += s.weight, i;
3263
+ $c(t, e = 1) {
3264
+ const i = `phase-${this.yc.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
3265
+ return this._c.set(i, s), this.yc.push(i), this.wc += s.weight, i;
3266
3266
  }
3267
- Fc(t, e) {
3268
- const i = this.gc.get(t);
3267
+ Pc(t, e) {
3268
+ const i = this._c.get(t);
3269
3269
  if (!i) return;
3270
3270
  i.progress = D(e, 0, 1), i.status = i.progress >= 1 ? "complete" : "running";
3271
- const s = this.Cc;
3272
- Math.abs(s - this.yc) > 1e-3 && (this.yc = s, this.wc && this.wc(s));
3271
+ const s = this.Mc;
3272
+ Math.abs(s - this.bc) > 1e-3 && (this.bc = s, this.Cc && this.Cc(s));
3273
3273
  }
3274
- $c(t) {
3275
- const e = this.gc.get(t);
3276
- e && (e.progress = 1, e.status = "complete", this.Fc(t, 1));
3274
+ Tc(t) {
3275
+ const e = this._c.get(t);
3276
+ e && (e.progress = 1, e.status = "complete", this.Pc(t, 1));
3277
3277
  }
3278
- Pc(t) {
3279
- const e = this.gc.get(t);
3278
+ Sc(t) {
3279
+ const e = this._c.get(t);
3280
3280
  e && (e.status = "failed");
3281
3281
  }
3282
- Tc() {
3283
- return this.mc.map((t) => {
3284
- const e = this.gc.get(t);
3282
+ Ec() {
3283
+ return this.yc.map((t) => {
3284
+ const e = this._c.get(t);
3285
3285
  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" };
3286
3286
  });
3287
3287
  }
3288
3288
  }
3289
- class Kt {
3289
+ class Vt {
3290
3290
  constructor(t = "active") {
3291
- o(this, "Sc");
3292
- o(this, "Ec", "");
3293
- o(this, "kc", "");
3294
- this.Sc = t;
3295
- }
3296
- get Rc() {
3297
- return this.Sc;
3298
- }
3299
- get Dc() {
3300
- return this.Sc !== "disabled";
3291
+ o(this, "kc");
3292
+ o(this, "Rc", "");
3293
+ o(this, "Dc", "");
3294
+ this.kc = t;
3301
3295
  }
3302
3296
  get Lc() {
3303
- return this.Sc === "active" || this.Sc === "transitioning" || this.Sc === "error";
3297
+ return this.kc;
3304
3298
  }
3305
3299
  get Oc() {
3306
- return this.Ec;
3300
+ return this.kc !== "disabled";
3307
3301
  }
3308
3302
  get zc() {
3309
- return this.kc;
3303
+ return this.kc === "active" || this.kc === "transitioning" || this.kc === "error";
3310
3304
  }
3311
- Hc() {
3312
- this.Sc !== "done" && this.Sc !== "transitioning" || (this.Sc = "active");
3305
+ get Hc() {
3306
+ return this.Rc;
3313
3307
  }
3314
- Bc() {
3315
- this.Sc !== "disabled" && (this.Sc = "done");
3308
+ get Bc() {
3309
+ return this.Dc;
3316
3310
  }
3317
3311
  Ic() {
3318
- this.Sc !== "disabled" && (this.Sc = "transitioning");
3312
+ this.kc !== "done" && this.kc !== "transitioning" || (this.kc = "active");
3319
3313
  }
3320
3314
  Gc() {
3321
- this.Sc === "transitioning" && (this.Sc = "done");
3315
+ this.kc !== "disabled" && (this.kc = "done");
3322
3316
  }
3323
- jc(t) {
3324
- this.Sc !== "disabled" && (this.Sc = "error", t instanceof Error ? (this.Ec = t.message, this.kc = t.stack || "") : (this.Ec = t, this.kc = ""));
3317
+ jc() {
3318
+ this.kc !== "disabled" && (this.kc = "transitioning");
3325
3319
  }
3326
3320
  Qc() {
3327
- this.Sc = "disabled";
3321
+ this.kc === "transitioning" && (this.kc = "done");
3322
+ }
3323
+ Nc(t) {
3324
+ this.kc !== "disabled" && (this.kc = "error", t instanceof Error ? (this.Rc = t.message, this.Dc = t.stack || "") : (this.Rc = t, this.Dc = ""));
3325
+ }
3326
+ Xc() {
3327
+ this.kc = "disabled";
3328
3328
  }
3329
3329
  }
3330
3330
  class Qt {
3331
3331
  constructor(t, e) {
3332
- o(this, "Nc", 0);
3333
- o(this, "Xc", 1);
3334
- o(this, "Yc");
3335
- o(this, "Kc");
3336
- this.Yc = t, this.Kc = e;
3332
+ o(this, "Yc", 0);
3333
+ o(this, "Kc", 1);
3334
+ o(this, "Wc");
3335
+ o(this, "Zc");
3336
+ this.Wc = t, this.Zc = e;
3337
3337
  }
3338
- get Wc() {
3339
- return this.Xc;
3338
+ get qc() {
3339
+ return this.Kc;
3340
3340
  }
3341
- get Zc() {
3342
- return this.Xc < 1;
3341
+ get Vc() {
3342
+ return this.Kc < 1;
3343
3343
  }
3344
- ih() {
3345
- this.Yc !== "none" && this.Kc > 0 && (this.Nc = performance.now());
3344
+ rh() {
3345
+ this.Wc !== "none" && this.Zc > 0 && (this.Yc = performance.now());
3346
3346
  }
3347
3347
  N() {
3348
- if (this.Yc === "none" || this.Kc === 0) return this.Xc = 1, !1;
3349
- const t = performance.now() - this.Nc, e = Math.min(1, t / this.Kc);
3350
- return e >= 1 ? (this.Xc = 0, !0) : (this.Xc = 1 - e, !1);
3348
+ if (this.Wc === "none" || this.Zc === 0) return this.Kc = 1, !1;
3349
+ const t = performance.now() - this.Yc, e = Math.min(1, t / this.Zc);
3350
+ return e >= 1 ? (this.Kc = 0, !0) : (this.Kc = 1 - e, !1);
3351
3351
  }
3352
3352
  Qs() {
3353
- this.Xc = 1, this.Nc = 0;
3353
+ this.Kc = 1, this.Yc = 0;
3354
3354
  }
3355
3355
  }
3356
3356
  function At(n, t) {
@@ -3362,24 +3362,24 @@ function At(n, t) {
3362
3362
  return 0.2126 * l(r) + 0.7152 * l(h) + 0.0722 * l(a);
3363
3363
  }(t) > 0.5 ? "light" : "dark"), { mode: i, background: t, textColor: i === "light" ? "#1A1A1A" : "#F8F8F8", subtleColor: i === "light" ? "#4A4A4A" : "#C0C0C0" };
3364
3364
  }
3365
- function Zt(n) {
3365
+ function $t(n) {
3366
3366
  return n.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
3367
3367
  }
3368
3368
  function qt(n, t) {
3369
3369
  return n.length ? n.map((e) => x.yn(e)) : [t.color("#FFFFFF")];
3370
3370
  }
3371
- class $t {
3371
+ class Kt {
3372
3372
  constructor(t, e, i, s) {
3373
- this.qc = t, this.id = e, this.label = i, this.Vc = s;
3373
+ this.Jc = t, this.id = e, this.label = i, this.tl = s;
3374
3374
  }
3375
3375
  report(t) {
3376
- this.qc.Fc(this.id, t);
3376
+ this.Jc.Pc(this.id, t);
3377
3377
  }
3378
3378
  complete() {
3379
- this.qc.$c(this.id);
3379
+ this.Jc.Tc(this.id);
3380
3380
  }
3381
3381
  fail(t) {
3382
- this.qc.Pc(this.id), this.Vc && this.Vc(t ?? Error(`Loading phase "${this.label}" failed`));
3382
+ this.Jc.Sc(this.id), this.tl && this.tl(t ?? Error(`Loading phase "${this.label}" failed`));
3383
3383
  }
3384
3384
  async track(t) {
3385
3385
  try {
@@ -3390,7 +3390,7 @@ class $t {
3390
3390
  }
3391
3391
  }
3392
3392
  }
3393
- const $e = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: a, transitionOpacity: l, isError: u, errorMessage: c }) => {
3393
+ const Ke = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: a, transitionOpacity: l, isError: u, errorMessage: c }) => {
3394
3394
  const f = "|/-\\", g = Math.floor(i / 6) % 4, p = x.yn(h.textColor), v = Math.floor(255 * l), d = n.color(p.r, p.g, p.b, v);
3395
3395
  if (n.charColor(d), n.cellColor(0, 0, 0, 0), u) {
3396
3396
  const m = x.yn(h.mode === "light" ? "#D32F2F" : "#FF6B6B").withAlpha(v);
@@ -3401,14 +3401,14 @@ const $e = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
3401
3401
  if (n.pop(), c) {
3402
3402
  const y = x.yn(h.subtleColor), R = n.color(y.r, y.g, y.b, v);
3403
3403
  n.charColor(R);
3404
- const b = Math.floor(0.8 * t.cols), M = c.split(" "), S = [];
3404
+ const b = Math.floor(0.8 * t.cols), M = c.split(" "), P = [];
3405
3405
  let T = "";
3406
- for (const C of M) (T + " " + C).length <= b ? T = T ? T + " " + C : C : (T && S.push(T), T = C);
3407
- T && S.push(T);
3408
- const X = S.slice(0, 3);
3409
- S.length > 3 && (X[2] = X[2].substring(0, b - 3) + "..."), X.forEach((C, Z) => {
3406
+ for (const C of M) (T + " " + C).length <= b ? T = T ? T + " " + C : C : (T && P.push(T), T = C);
3407
+ T && P.push(T);
3408
+ const U = P.slice(0, 3);
3409
+ P.length > 3 && (U[2] = U[2].substring(0, b - 3) + "..."), U.forEach((C, $) => {
3410
3410
  const re = -Math.floor(C.length / 2);
3411
- n.push(), n.translate(re, 3 + Z, 0);
3411
+ n.push(), n.translate(re, 3 + $, 0);
3412
3412
  for (const ne of C) n.char(ne), n.rect(1, 1), n.translateX(1);
3413
3413
  n.pop();
3414
3414
  });
@@ -3419,8 +3419,8 @@ const $e = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
3419
3419
  const m = Math.max(6, Math.floor(0.6 * t.cols)), A = -Math.floor(m / 2), w = Math.floor(m * e), y = r.length ? r : [n.color("#FFFFFF")];
3420
3420
  n.push(), n.translate(A, 3, 0);
3421
3421
  for (let R = 0; R < m; R++) {
3422
- const b = R < w ? "*" : ".", M = y[R % y.length], S = n.color(M.r, M.g, M.b, v);
3423
- n.charColor(S), n.char(b), n.rect(1, 1), n.translateX(1);
3422
+ const b = R < w ? "*" : ".", M = y[R % y.length], P = n.color(M.r, M.g, M.b, v);
3423
+ n.charColor(P), n.char(b), n.rect(1, 1), n.translateX(1);
3424
3424
  }
3425
3425
  n.pop();
3426
3426
  }
@@ -3435,232 +3435,232 @@ const $e = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
3435
3435
  };
3436
3436
  class ot {
3437
3437
  constructor(t, e = {}) {
3438
- o(this, "Jc");
3439
- o(this, "Wc");
3440
- o(this, "tl");
3441
3438
  o(this, "sl");
3439
+ o(this, "qc");
3442
3440
  o(this, "el");
3443
3441
  o(this, "il");
3444
3442
  o(this, "rl");
3445
3443
  o(this, "nl");
3446
3444
  o(this, "hl");
3447
3445
  o(this, "ol");
3448
- o(this, "yr");
3449
3446
  o(this, "al");
3450
3447
  o(this, "cl");
3448
+ o(this, "yr");
3451
3449
  o(this, "ll");
3452
3450
  o(this, "ul");
3453
- o(this, "fl", () => {
3451
+ o(this, "fl");
3452
+ o(this, "dl");
3453
+ o(this, "pl", () => {
3454
3454
  });
3455
- o(this, "dl", []);
3456
- o(this, "pl", /* @__PURE__ */ new Map());
3457
- this.Jc = e.visible ?? !0, this.Wc = e.opacity ?? 1, this.tl = e.blendMode ?? "normal", this.sl = e.offsetX ?? 0, this.el = e.offsetY ?? 0, this.il = e.rotationZ ?? 0, this.rl = e.fontSize ?? 16, this.nl = e.fontSource, e.fontSource instanceof z ? this.yr = e.fontSource : this.yr = new z(t, this.rl);
3455
+ o(this, "vl", []);
3456
+ o(this, "ml", /* @__PURE__ */ new Map());
3457
+ this.sl = e.visible ?? !0, this.qc = e.opacity ?? 1, this.el = e.blendMode ?? "normal", this.il = e.offsetX ?? 0, this.rl = e.offsetY ?? 0, this.nl = e.rotationZ ?? 0, this.hl = e.fontSize ?? 16, this.ol = e.fontSource, e.fontSource instanceof z ? this.yr = e.fontSource : this.yr = new z(t, this.hl);
3458
3458
  }
3459
- async vl(t) {
3460
- this.hl = t, this.yr.Gr || await this.yr.Er(this.nl);
3459
+ async _l(t) {
3460
+ this.al = t, this.yr.Gr || await this.yr.Er(this.ol);
3461
3461
  const e = this.yr.maxGlyphDimensions;
3462
- this.ol = new ze(this.hl.canvas.canvas, e.width, e.height);
3463
- const i = this.ol;
3464
- this.al = this.hl.createFramebuffer(i.cols, i.rows, 3), this.cl = this.hl.createFramebuffer(i.width, i.height, 1), this.ll = this.hl.createFramebuffer(i.width, i.height, 1), this.ul = [this.hl.createFramebuffer(i.width, i.height, 1, { depth: !1 }), this.hl.createFramebuffer(i.width, i.height, 1, { depth: !1 })], this.ol.Vr(() => {
3462
+ this.cl = new ze(this.al.canvas.canvas, e.width, e.height);
3463
+ const i = this.cl;
3464
+ this.ll = this.al.createFramebuffer(i.cols, i.rows, 3), this.ul = this.al.createFramebuffer(i.width, i.height, 1), this.fl = this.al.createFramebuffer(i.width, i.height, 1), this.dl = [this.al.createFramebuffer(i.width, i.height, 1, { depth: !1 }), this.al.createFramebuffer(i.width, i.height, 1, { depth: !1 })], this.cl.Vr(() => {
3465
3465
  var s, r, h;
3466
- this.al.resize(this.ol.cols, this.ol.rows), this.cl.resize(this.ol.width, this.ol.height), (s = this.ll) == null || s.resize(this.ol.width, this.ol.height), (r = this.ul) == null || r[0].resize(this.ol.width, this.ol.height), (h = this.ul) == null || h[1].resize(this.ol.width, this.ol.height);
3466
+ this.ll.resize(this.cl.cols, this.cl.rows), this.ul.resize(this.cl.width, this.cl.height), (s = this.fl) == null || s.resize(this.cl.width, this.cl.height), (r = this.dl) == null || r[0].resize(this.cl.width, this.cl.height), (h = this.dl) == null || h[1].resize(this.cl.width, this.cl.height);
3467
3467
  });
3468
3468
  }
3469
3469
  draw(t) {
3470
- this.fl = t;
3470
+ this.pl = t;
3471
3471
  }
3472
3472
  show() {
3473
- this.Jc = !0;
3473
+ this.sl = !0;
3474
3474
  }
3475
3475
  hide() {
3476
- this.Jc = !1;
3476
+ this.sl = !1;
3477
3477
  }
3478
3478
  opacity(t) {
3479
- if (t === void 0) return this.Wc;
3480
- this.Wc = D(t, 0, 1);
3479
+ if (t === void 0) return this.qc;
3480
+ this.qc = D(t, 0, 1);
3481
3481
  }
3482
3482
  blendMode(t) {
3483
- if (t === void 0) return this.tl;
3484
- this.tl = t;
3483
+ if (t === void 0) return this.el;
3484
+ this.el = t;
3485
3485
  }
3486
3486
  offset(t, e = 0) {
3487
- if (t === void 0) return { x: this.sl, y: this.el };
3488
- this.sl = t, this.el = e;
3487
+ if (t === void 0) return { x: this.il, y: this.rl };
3488
+ this.il = t, this.rl = e;
3489
3489
  }
3490
3490
  rotateZ(t) {
3491
- if (t === void 0) return this.il;
3492
- this.il = t;
3491
+ if (t === void 0) return this.nl;
3492
+ this.nl = t;
3493
3493
  }
3494
3494
  filter(t, e) {
3495
- this.dl.push({ name: t, params: e });
3495
+ this.vl.push({ name: t, params: e });
3496
3496
  }
3497
3497
  setPluginState(t, e) {
3498
- this.pl.set(t, e);
3498
+ this.ml.set(t, e);
3499
3499
  }
3500
3500
  getPluginState(t) {
3501
- return this.pl.get(t);
3501
+ return this.ml.get(t);
3502
3502
  }
3503
3503
  hasPluginState(t) {
3504
- return this.pl.has(t);
3504
+ return this.ml.has(t);
3505
3505
  }
3506
3506
  deletePluginState(t) {
3507
- return this.pl.delete(t);
3507
+ return this.ml.delete(t);
3508
3508
  }
3509
3509
  fontSize(t) {
3510
3510
  if (t === void 0) return this.yr.fontSize;
3511
- yt.m(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) && this.yr.fontSize !== t && (this.yr.Dr(t), this.ml());
3511
+ yt.m(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) && this.yr.fontSize !== t && (this.yr.Dr(t), this.yl());
3512
3512
  }
3513
3513
  async loadFont(t) {
3514
3514
  if (!this.yr) throw Error("Layer font not initialized. Ensure layer is attached before loading fonts.");
3515
- return t instanceof z ? (this.yr !== t && this.yr.dispose(), this.yr = t, this.yr.Gr || await this.yr.Er()) : await this.yr.Or(t), this.ml(), this.yr;
3515
+ return t instanceof z ? (this.yr !== t && this.yr.dispose(), this.yr = t, this.yr.Gr || await this.yr.Er()) : await this.yr.Or(t), this.yl(), this.yr;
3516
3516
  }
3517
- Ra(t, e) {
3518
- if (!this.Jc || !this.al || !this.cl) return;
3519
- const i = this.hl.renderer, s = this.ol;
3520
- t._l.rc(this), this.al.begin(), i.state.Vt(), t.yl = this;
3517
+ La(t, e) {
3518
+ if (!this.sl || !this.ll || !this.ul) return;
3519
+ const i = this.al.renderer, s = this.cl;
3520
+ t.Al.hc(this), this.ll.begin(), i.state.Vt(), t.wl = this;
3521
3521
  try {
3522
- this.fl.call(t);
3522
+ this.pl.call(t);
3523
3523
  } finally {
3524
- t.yl = void 0;
3524
+ t.wl = void 0;
3525
3525
  }
3526
- this.al.end(), t._l.nc(this);
3527
- const r = this.dl.length > 0, h = r ? this.ll : this.cl;
3528
- h.begin(), i.xi(e), e.gt({ u_characterTexture: this.yr.fontFramebuffer, u_charsetDimensions: [this.yr.textureColumns, this.yr.textureRows], U2: this.al.textures[0], U0: this.al.textures[1], U1: this.al.textures[2], U3: [s.cols, s.rows], U4: [h.width, h.height], U5: [0, 0, 0, 0] }), i.Ei(0, 0, s.width, s.height), h.end(), r && this.hl.filterManager.Al(this.ll.textures[0], this.cl, this.dl, this.cl.width, this.cl.height, this.ul), this.dl = [];
3526
+ this.ll.end(), t.Al.oc(this);
3527
+ const r = this.vl.length > 0, h = r ? this.fl : this.ul;
3528
+ h.begin(), i.xi(e), e.gt({ u_characterTexture: this.yr.fontFramebuffer, u_charsetDimensions: [this.yr.textureColumns, this.yr.textureRows], U2: this.ll.textures[0], U0: this.ll.textures[1], U1: this.ll.textures[2], U3: [s.cols, s.rows], U4: [h.width, h.height], U5: [0, 0, 0, 0] }), i.Ei(0, 0, s.width, s.height), h.end(), r && this.al.filterManager.bl(this.fl.textures[0], this.ul, this.vl, this.ul.width, this.ul.height, this.dl), this.vl = [];
3529
3529
  }
3530
3530
  vn() {
3531
3531
  var t;
3532
- this.al && this.cl && ((t = this.ol) == null || t.reset());
3532
+ this.ll && this.ul && ((t = this.cl) == null || t.reset());
3533
3533
  }
3534
3534
  Ss() {
3535
3535
  var t, e, i, s, r, h, a;
3536
- (t = this.al) == null || t.dispose(), (e = this.cl) == null || e.dispose(), (i = this.ll) == null || i.dispose(), (s = this.ul) == null || s[0].dispose(), (r = this.ul) == null || r[1].dispose(), (h = this.yr) == null || h.dispose(), (a = this.ol) == null || a.Ss();
3536
+ (t = this.ll) == null || t.dispose(), (e = this.ul) == null || e.dispose(), (i = this.fl) == null || i.dispose(), (s = this.dl) == null || s[0].dispose(), (r = this.dl) == null || r[1].dispose(), (h = this.yr) == null || h.dispose(), (a = this.cl) == null || a.Ss();
3537
3537
  }
3538
3538
  get texture() {
3539
3539
  var t;
3540
- return (t = this.cl) == null ? void 0 : t.textures[0];
3540
+ return (t = this.ul) == null ? void 0 : t.textures[0];
3541
3541
  }
3542
3542
  get grid() {
3543
- return this.ol;
3543
+ return this.cl;
3544
3544
  }
3545
3545
  get font() {
3546
3546
  return this.yr;
3547
3547
  }
3548
3548
  get width() {
3549
- return this.cl ? this.cl.width : 0;
3549
+ return this.ul ? this.ul.width : 0;
3550
3550
  }
3551
3551
  get height() {
3552
- return this.cl ? this.cl.height : 0;
3552
+ return this.ul ? this.ul.height : 0;
3553
3553
  }
3554
3554
  get drawFramebuffer() {
3555
- return this.al;
3555
+ return this.ll;
3556
3556
  }
3557
3557
  get asciiFramebuffer() {
3558
- return this.cl;
3558
+ return this.ul;
3559
3559
  }
3560
- ml() {
3561
- if (!this.ol || !this.yr) return;
3560
+ yl() {
3561
+ if (!this.cl || !this.yr) return;
3562
3562
  const t = this.yr.maxGlyphDimensions;
3563
- this.ol.tn(t.width, t.height), this.al && this.cl && this.vn();
3563
+ this.cl.tn(t.width, t.height), this.ll && this.ul && this.vn();
3564
3564
  }
3565
3565
  }
3566
3566
  const Je = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
3567
3567
  class Jt {
3568
3568
  constructor(t, e, i) {
3569
- o(this, "Oa");
3569
+ o(this, "Ha");
3570
3570
  o(this, "l");
3571
- o(this, "wl");
3572
- o(this, "qc");
3573
- o(this, "bl");
3574
3571
  o(this, "Cl");
3572
+ o(this, "Jc");
3575
3573
  o(this, "xl");
3576
3574
  o(this, "Ml");
3577
- o(this, "Fl", []);
3575
+ o(this, "Fl");
3578
3576
  o(this, "$l");
3579
- o(this, "Pl", performance.now());
3580
- o(this, "Tl", 0);
3581
- o(this, "Sl", !1);
3577
+ o(this, "Pl", []);
3578
+ o(this, "Tl");
3579
+ o(this, "Sl", performance.now());
3580
+ o(this, "El", 0);
3581
+ o(this, "kl", !1);
3582
3582
  o(this, "Sr", !1);
3583
- o(this, "Dl");
3584
- this.Oa = t, this.l = { ...Je, ...e ?? {} }, this.wl = new Kt("active"), this.qc = new Wt(), this.bl = new Qt(this.l.transition, this.l.transitionDuration), this.Cl = new Nt(60), this.$l = At(this.l, i);
3585
- const s = Zt(this.$l);
3586
- this.Fl = qt(s, this.Oa), this.Ml = this.El(), this.qc.xc((r) => {
3587
- r >= 0.999 && this.Bc();
3583
+ o(this, "Ol");
3584
+ this.Ha = t, this.l = { ...Je, ...e ?? {} }, this.Cl = new Vt("active"), this.Jc = new Zt(), this.xl = new Qt(this.l.transition, this.l.transitionDuration), this.Ml = new Nt(60), this.Tl = At(this.l, i);
3585
+ const s = $t(this.Tl);
3586
+ this.Pl = qt(s, this.Ha), this.$l = this.Rl(), this.Jc.Fc((r) => {
3587
+ r >= 0.999 && this.Gc();
3588
3588
  });
3589
3589
  }
3590
3590
  async Er() {
3591
3591
  if (this.Sr) return;
3592
- const t = this.Oa.R, e = this.Oa.Xr;
3593
- this.xl = new ot(t, { visible: !0, opacity: 1, fontSize: 16 }), await this.xl.vl({ renderer: t, canvas: e, filterManager: null, createFramebuffer: (i, s, r = 1, h) => t.Hi(i, s, r, h) }), this.Sr = !0;
3594
- }
3595
- get Lc() {
3596
- return this.wl.Lc && this.Sl;
3592
+ const t = this.Ha.R, e = this.Ha.Xr;
3593
+ this.Fl = new ot(t, { visible: !0, opacity: 1, fontSize: 16 }), await this.Fl._l({ renderer: t, canvas: e, filterManager: null, createFramebuffer: (i, s, r = 1, h) => t.Hi(i, s, r, h) }), this.Sr = !0;
3597
3594
  }
3598
- ih() {
3599
- this.Sl || (this.Sl = !0, this.Pl = performance.now(), this.Tl = 0, this.Cl.ih(() => this.kl()));
3595
+ get zc() {
3596
+ return this.Cl.zc && this.kl;
3600
3597
  }
3601
3598
  rh() {
3602
- this.Sl && (this.Sl = !1, this.Cl.rh());
3599
+ this.kl || (this.kl = !0, this.Sl = performance.now(), this.El = 0, this.Ml.rh(() => this.Dl()));
3600
+ }
3601
+ nh() {
3602
+ this.kl && (this.kl = !1, this.Ml.nh());
3603
3603
  }
3604
3604
  vn() {
3605
- this.Sr && this.xl.vn();
3605
+ this.Sr && this.Fl.vn();
3606
3606
  }
3607
3607
  Ss() {
3608
- this.rh(), this.Sr && (this.xl.Ss(), this.Sr = !1);
3608
+ this.nh(), this.Sr && (this.Fl.Ss(), this.Sr = !1);
3609
3609
  }
3610
3610
  get progress() {
3611
- return this.qc.Cc;
3611
+ return this.Jc.Mc;
3612
3612
  }
3613
3613
  message(t) {
3614
3614
  return typeof t == "string" && (this.l.message = t), this.l.message;
3615
3615
  }
3616
3616
  addPhase(t, e = 1) {
3617
- this.wl.Hc();
3618
- const i = this.qc.Mc(t, e);
3619
- return new $t(this.qc, i, t, (s) => this.error(s));
3617
+ this.Cl.Ic();
3618
+ const i = this.Jc.$c(t, e);
3619
+ return new Kt(this.Jc, i, t, (s) => this.error(s));
3620
3620
  }
3621
- Bc() {
3622
- this.wl.Rc !== "error" && (this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.wl.Ic(), this.bl.ih()) : (this.wl.Bc(), this.rh(), this.Rl()));
3621
+ Gc() {
3622
+ this.Cl.Lc !== "error" && (this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.Cl.jc(), this.xl.rh()) : (this.Cl.Gc(), this.nh(), this.Ll()));
3623
3623
  }
3624
- Rl() {
3625
- this.Dl && this.Dl();
3624
+ Ll() {
3625
+ this.Ol && this.Ol();
3626
3626
  }
3627
- Ll(t) {
3628
- this.Dl = t;
3627
+ zl(t) {
3628
+ this.Ol = t;
3629
3629
  }
3630
3630
  error(t) {
3631
- this.wl.jc(t);
3631
+ this.Cl.Nc(t);
3632
3632
  }
3633
- kl() {
3634
- if (this.wl.Lc) {
3635
- if (this.Tl++, this.wl.Rc === "transitioning" && this.bl.N())
3636
- return this.wl.Gc(), this.Rl(), void this.rh();
3637
- this.Ol();
3633
+ Dl() {
3634
+ if (this.Cl.zc) {
3635
+ if (this.El++, this.Cl.Lc === "transitioning" && this.xl.N())
3636
+ return this.Cl.Qc(), this.Ll(), void this.nh();
3637
+ this.Hl();
3638
3638
  }
3639
3639
  }
3640
- Ol() {
3640
+ Hl() {
3641
3641
  if (!this.Sr) return;
3642
- const t = this.xl, e = t.grid, i = this.Oa.R, s = { textmodifier: this.Oa, grid: e, progress: this.progress, elapsedMs: performance.now() - this.Pl, frameCount: this.Tl, message: this.l.message, palette: this.Fl, theme: this.$l, phases: this.qc.Tc(), transitionOpacity: this.bl.Wc, isError: this.wl.Rc === "error", errorMessage: this.wl.Oc || void 0, errorDetails: this.wl.zc || void 0 };
3642
+ const t = this.Fl, e = t.grid, i = this.Ha.R, s = { textmodifier: this.Ha, grid: e, progress: this.progress, elapsedMs: performance.now() - this.Sl, frameCount: this.El, message: this.l.message, palette: this.Pl, theme: this.Tl, phases: this.Jc.Ec(), transitionOpacity: this.xl.qc, isError: this.Cl.Lc === "error", errorMessage: this.Cl.Hc || void 0, errorDetails: this.Cl.Bc || void 0 };
3643
3643
  t.draw(() => {
3644
- this.Oa.resetShader(), this.Oa.clear(), this.Oa.push();
3644
+ this.Ha.resetShader(), this.Ha.clear(), this.Ha.push();
3645
3645
  try {
3646
- this.Ml(s);
3646
+ this.$l(s);
3647
3647
  } finally {
3648
- this.Oa.pop();
3648
+ this.Ha.pop();
3649
3649
  }
3650
- }), t.Ra(this.Oa, this.Oa.zl);
3650
+ }), t.La(this.Ha, this.Ha.Bl);
3651
3651
  const r = t.texture;
3652
- r && (i.xe(...i.state.canvasBackgroundColor), i.xi(this.Oa.Hl), this.Oa.Hl.gt({ u_texture: r }), i.Ei(e.offsetX, e.offsetY, e.width, e.height));
3652
+ r && (i.xe(...i.state.canvasBackgroundColor), i.xi(this.Ha.Il), this.Ha.Il.gt({ u_texture: r }), i.Ei(e.offsetX, e.offsetY, e.width, e.height));
3653
3653
  }
3654
- Bl(t) {
3655
- this.$l = At(this.l, t);
3654
+ Gl(t) {
3655
+ this.Tl = At(this.l, t);
3656
3656
  }
3657
- El() {
3658
- const t = this.l.renderer || $e;
3657
+ Rl() {
3658
+ const t = this.l.renderer || Ke;
3659
3659
  return (e) => {
3660
- t(e), this.Il(e);
3660
+ t(e), this.jl(e);
3661
3661
  };
3662
3662
  }
3663
- Il(t) {
3663
+ jl(t) {
3664
3664
  const { textmodifier: e, grid: i, frameCount: s, theme: r, transitionOpacity: h } = t, a = [116, 101, 120, 116, 109, 111, 100, 101, 46, 106, 115].map((f) => String.fromCharCode(f)).join(""), l = (i.rows + 1 >> 1) - 2, u = 2 - (i.cols + 1 >> 1), c = r.mode === "light" ? [[233, 30, 99], [156, 39, 176], [255, 111, 0]] : [[142, 249, 243], [241, 91, 181], [255, 155, 113]];
3665
3665
  e.push(), e.translate(u, l, 0);
3666
3666
  for (let f = 0; f < a.length; f++) {
@@ -3674,140 +3674,140 @@ const Ct = { normal: 0, additive: 1, multiply: 2, screen: 3, subtract: 4, darken
3674
3674
  class te {
3675
3675
  constructor(t, e, i) {
3676
3676
  o(this, "R");
3677
- o(this, "Gl");
3678
- o(this, "ul");
3679
- o(this, "jl", 0);
3680
- this.R = t, this.Gl = t.Mi(W, `#version 300 es
3681
- precision highp float;uniform sampler2D Ue;uniform sampler2D Uf;uniform vec2 Ug;uniform vec2 Uh;uniform vec2 Ui;uniform float Uj;uniform float Uk;uniform int Ul;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(Uf,v_uv);vec2 h=v_uv*Ug;vec2 i=h-Ui;vec2 j=Uh*0.5;vec2 k=i-j;float l=cos(-Uk);float m=sin(-Uk);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,Uh));if(o){fragColor=g;return;}vec2 p=(floor(i)+0.5)/Uh;vec4 q=texture(Ue,p);float r=q.a*Uj;if(r<=0.){fragColor=g;return;}vec3 s=e(Ul,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`), this.ul = [this.R.Hi(e, i, 1), this.R.Hi(e, i, 1)];
3677
+ o(this, "Ql");
3678
+ o(this, "dl");
3679
+ o(this, "Nl", 0);
3680
+ this.R = t, this.Ql = t.Mi(Z, `#version 300 es
3681
+ precision highp float;uniform sampler2D Uj;uniform sampler2D Uk;uniform vec2 Ul;uniform vec2 Um;uniform vec2 Un;uniform float Uo;uniform float Up;uniform int Uq;in vec2 v_uv;out vec4 fragColor;const int A=0;const int B=1;const int C=2;const int D=3;const int E=4;const int F=5;const int G=6;const int H=7;const int I=8;const int J=9;const int K=10;const int L=11;const int M=12;const int N=13;vec3 O(vec3 P,vec3 Q){return Q;}vec3 R(vec3 P,vec3 Q){return P+Q;}vec3 S(vec3 P,vec3 Q){return P*Q;}vec3 T(vec3 P,vec3 Q){return 1.-(1.-P)*(1.-Q);}vec3 U(vec3 P,vec3 Q){return max(P-Q,0.);}vec3 V(vec3 P,vec3 Q){return min(P,Q);}vec3 W(vec3 P,vec3 Q){return max(P,Q);}vec3 X(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,P));}vec3 Y(vec3 P,vec3 Q){return mix(P-(1.-2.*Q)*P*(1.-P),mix(P+(2.*Q-1.)*(P*(3.-2.*P)-P),P+(2.*Q-1.)*(sqrt(P)-P),step(0.25,P)),step(0.5,Q));}vec3 Z(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,Q));}vec3 a(vec3 P,vec3 Q){return mix(min(vec3(1.),P/max(1.-Q,0.0001)),vec3(1.),step(1.,Q));}vec3 b(vec3 P,vec3 Q){return mix(1.-min(vec3(1.),(1.-P)/max(Q,0.0001)),vec3(0.),step(Q,vec3(0.)));}vec3 c(vec3 P,vec3 Q){return abs(P-Q);}vec3 d(vec3 P,vec3 Q){return P+Q-2.*P*Q;}vec3 e(int f,vec3 P,vec3 Q){if(f==A)return O(P,Q);if(f==B)return R(P,Q);if(f==C)return S(P,Q);if(f==D)return T(P,Q);if(f==E)return U(P,Q);if(f==F)return V(P,Q);if(f==G)return W(P,Q);if(f==H)return X(P,Q);if(f==I)return Y(P,Q);if(f==J)return Z(P,Q);if(f==K)return a(P,Q);if(f==L)return b(P,Q);if(f==M)return c(P,Q);if(f==N)return d(P,Q);return O(P,Q);}void main(){vec4 g=texture(Uk,v_uv);vec2 h=v_uv*Ul;vec2 i=h-Un;vec2 j=Um*0.5;vec2 k=i-j;float l=cos(-Up);float m=sin(-Up);vec2 n=vec2(k.x*l-k.y*m,k.x*m+k.y*l);i=n+j;bool o=any(lessThan(i,vec2(0.)))||any(greaterThanEqual(i,Um));if(o){fragColor=g;return;}vec2 p=(floor(i)+0.5)/Um;vec4 q=texture(Uj,p);float r=q.a*Uo;if(r<=0.){fragColor=g;return;}vec3 s=e(Uq,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`), this.dl = [this.R.Hi(e, i, 1), this.R.Hi(e, i, 1)];
3682
3682
  }
3683
- Ql(t) {
3683
+ Xl(t) {
3684
3684
  const e = this.R.context, { base: i, targetFramebuffer: s, backgroundColor: r, layers: h, canvasWidth: a, canvasHeight: l } = t, u = e.isEnabled(e.DEPTH_TEST), c = e.getParameter(e.DEPTH_WRITEMASK);
3685
3685
  u && e.disable(e.DEPTH_TEST), c && e.depthMask(!1);
3686
- const f = this.ul[0];
3687
- f.begin(), this.R.xe(...r), f.end(), this.jl = 0, i.layer.Jc && this.Nl(i.texture, a, l, i.width, i.height, i.layer.Wc, i.offsetX, i.offsetY, i.layer.il, "normal");
3686
+ const f = this.dl[0];
3687
+ f.begin(), this.R.xe(...r), f.end(), this.Nl = 0, i.layer.sl && this.Yl(i.texture, a, l, i.width, i.height, i.layer.qc, i.offsetX, i.offsetY, i.layer.nl, "normal");
3688
3688
  for (const g of h) {
3689
3689
  const p = g.layer;
3690
- p.Jc && this.Nl(g.texture, a, l, g.width, g.height, p.Wc, g.offsetX, g.offsetY, p.il, p.tl);
3690
+ p.sl && this.Yl(g.texture, a, l, g.width, g.height, p.qc, g.offsetX, g.offsetY, p.nl, p.el);
3691
3691
  }
3692
- this.Xl(s, a, l), e.depthMask(c), u && e.enable(e.DEPTH_TEST);
3692
+ this.Kl(s, a, l), e.depthMask(c), u && e.enable(e.DEPTH_TEST);
3693
3693
  }
3694
- Nl(t, e, i, s, r, h, a, l, u, c) {
3695
- const f = this.ul[this.jl], g = this.jl === 0 ? 1 : 0, p = this.ul[g], v = N(u);
3696
- p.begin(), this.R.xi(this.Gl), this.Gl.gt({ Ue: t, Uf: f.textures[0], Ug: [e, i], Uh: [s, r], Ui: [a, l], Uj: h, Uk: v, Ul: Ct[c] }), this.R.Ei(0, 0, f.width, f.height), p.end(), this.jl = g;
3694
+ Yl(t, e, i, s, r, h, a, l, u, c) {
3695
+ const f = this.dl[this.Nl], g = this.Nl === 0 ? 1 : 0, p = this.dl[g], v = N(u);
3696
+ p.begin(), this.R.xi(this.Ql), this.Ql.gt({ Uj: t, Uk: f.textures[0], Ul: [e, i], Um: [s, r], Un: [a, l], Uo: h, Up: v, Uq: Ct[c] }), this.R.Ei(0, 0, f.width, f.height), p.end(), this.Nl = g;
3697
3697
  }
3698
- Xl(t, e, i) {
3699
- const s = this.ul[this.jl];
3700
- t.begin(), this.R.xi(this.Gl), this.Gl.gt({ Ue: s.textures[0], Uf: s.textures[0], Ug: [e, i], Uh: [s.width, s.height], Ui: [0, 0], Uj: 1, Uk: 0, Ul: Ct.normal }), this.R.Ei(0, 0, e, i), t.end();
3698
+ Kl(t, e, i) {
3699
+ const s = this.dl[this.Nl];
3700
+ t.begin(), this.R.xi(this.Ql), this.Ql.gt({ Uj: s.textures[0], Uk: s.textures[0], Ul: [e, i], Um: [s.width, s.height], Un: [0, 0], Uo: 1, Up: 0, Uq: Ct.normal }), this.R.Ei(0, 0, e, i), t.end();
3701
3701
  }
3702
3702
  vn(t, e) {
3703
- this.ul[0].resize(t, e), this.ul[1].resize(t, e);
3703
+ this.dl[0].resize(t, e), this.dl[1].resize(t, e);
3704
3704
  }
3705
3705
  Ss() {
3706
- this.Gl.dispose(), this.ul[0].dispose(), this.ul[1].dispose();
3706
+ this.Ql.dispose(), this.dl[0].dispose(), this.dl[1].dispose();
3707
3707
  }
3708
3708
  }
3709
3709
  class ti {
3710
3710
  constructor(t = {}) {
3711
- o(this, "Yl", []);
3712
- o(this, "Kl", []);
3713
- o(this, "Wl", !1);
3711
+ o(this, "Wl", []);
3712
+ o(this, "Zl", []);
3713
+ o(this, "ql", !1);
3714
3714
  o(this, "l");
3715
3715
  this.l = t;
3716
3716
  }
3717
3717
  async initialize(t) {
3718
3718
  var e, i;
3719
- for (const s of this.Kl) t && await t(s), this.Yl.push(s), (i = (e = this.l).onAdd) == null || i.call(e, s);
3720
- this.Kl = [], this.Wl = !0;
3719
+ for (const s of this.Zl) t && await t(s), this.Wl.push(s), (i = (e = this.l).onAdd) == null || i.call(e, s);
3720
+ this.Zl = [], this.ql = !0;
3721
3721
  }
3722
3722
  get isReady() {
3723
- return this.Wl;
3723
+ return this.ql;
3724
3724
  }
3725
3725
  add(t) {
3726
3726
  var e, i;
3727
- return this.Wl ? (this.Yl.push(t), (i = (e = this.l).onAdd) == null || i.call(e, t)) : this.Kl.push(t), t;
3727
+ return this.ql ? (this.Wl.push(t), (i = (e = this.l).onAdd) == null || i.call(e, t)) : this.Zl.push(t), t;
3728
3728
  }
3729
3729
  addMany(t) {
3730
3730
  for (const e of t) this.add(e);
3731
3731
  return t;
3732
3732
  }
3733
3733
  remove(t) {
3734
- const e = this.Yl.indexOf(t);
3735
- if (e !== -1) return this.Yl.splice(e, 1), this.Zl(t), !0;
3736
- const i = this.Kl.indexOf(t);
3737
- return i !== -1 && (this.Kl.splice(i, 1), this.Zl(t), !0);
3734
+ const e = this.Wl.indexOf(t);
3735
+ if (e !== -1) return this.Wl.splice(e, 1), this.Vl(t), !0;
3736
+ const i = this.Zl.indexOf(t);
3737
+ return i !== -1 && (this.Zl.splice(i, 1), this.Vl(t), !0);
3738
3738
  }
3739
3739
  removeAt(t) {
3740
- if (t < 0 || t >= this.Yl.length) return;
3741
- const [e] = this.Yl.splice(t, 1);
3742
- return this.Zl(e), e;
3740
+ if (t < 0 || t >= this.Wl.length) return;
3741
+ const [e] = this.Wl.splice(t, 1);
3742
+ return this.Vl(e), e;
3743
3743
  }
3744
3744
  move(t, e) {
3745
3745
  var r, h;
3746
- const i = this.Yl.indexOf(t);
3746
+ const i = this.Wl.indexOf(t);
3747
3747
  if (i !== -1) {
3748
- this.Yl.splice(i, 1);
3749
- const a = D(e, 0, this.Yl.length);
3750
- return this.Yl.splice(a, 0, t), (h = (r = this.l).onMove) == null || h.call(r, t, i, a), !0;
3748
+ this.Wl.splice(i, 1);
3749
+ const a = D(e, 0, this.Wl.length);
3750
+ return this.Wl.splice(a, 0, t), (h = (r = this.l).onMove) == null || h.call(r, t, i, a), !0;
3751
3751
  }
3752
- const s = this.Kl.indexOf(t);
3752
+ const s = this.Zl.indexOf(t);
3753
3753
  if (s !== -1) {
3754
- this.Kl.splice(s, 1);
3755
- const a = D(e, 0, this.Kl.length);
3756
- return this.Kl.splice(a, 0, t), !0;
3754
+ this.Zl.splice(s, 1);
3755
+ const a = D(e, 0, this.Zl.length);
3756
+ return this.Zl.splice(a, 0, t), !0;
3757
3757
  }
3758
3758
  return !1;
3759
3759
  }
3760
3760
  swap(t, e) {
3761
3761
  var a, l;
3762
3762
  if (t === e) return !0;
3763
- const i = this.Yl.indexOf(t), s = this.Yl.indexOf(e);
3764
- if (i !== -1 && s !== -1) return this.Yl[i] = e, this.Yl[s] = t, (l = (a = this.l).onSwap) == null || l.call(a, t, e, i, s), !0;
3765
- const r = this.Kl.indexOf(t), h = this.Kl.indexOf(e);
3766
- return r !== -1 && h !== -1 && (this.Kl[r] = e, this.Kl[h] = t, !0);
3763
+ const i = this.Wl.indexOf(t), s = this.Wl.indexOf(e);
3764
+ if (i !== -1 && s !== -1) return this.Wl[i] = e, this.Wl[s] = t, (l = (a = this.l).onSwap) == null || l.call(a, t, e, i, s), !0;
3765
+ const r = this.Zl.indexOf(t), h = this.Zl.indexOf(e);
3766
+ return r !== -1 && h !== -1 && (this.Zl[r] = e, this.Zl[h] = t, !0);
3767
3767
  }
3768
3768
  clear() {
3769
- for (const t of this.Yl) this.Zl(t);
3770
- this.Yl = [];
3771
- for (const t of this.Kl) this.Zl(t);
3772
- this.Kl = [];
3769
+ for (const t of this.Wl) this.Vl(t);
3770
+ this.Wl = [];
3771
+ for (const t of this.Zl) this.Vl(t);
3772
+ this.Zl = [];
3773
3773
  }
3774
3774
  dispose() {
3775
- this.clear(), this.Wl = !1;
3775
+ this.clear(), this.ql = !1;
3776
3776
  }
3777
3777
  get all() {
3778
- return this.Yl;
3778
+ return this.Wl;
3779
3779
  }
3780
3780
  get pending() {
3781
- return this.Kl;
3781
+ return this.Zl;
3782
3782
  }
3783
3783
  get length() {
3784
- return this.Yl.length;
3784
+ return this.Wl.length;
3785
3785
  }
3786
3786
  get totalLength() {
3787
- return this.Yl.length + this.Kl.length;
3787
+ return this.Wl.length + this.Zl.length;
3788
3788
  }
3789
3789
  get isEmpty() {
3790
- return this.Yl.length === 0;
3790
+ return this.Wl.length === 0;
3791
3791
  }
3792
3792
  get(t) {
3793
- return this.Yl[t];
3793
+ return this.Wl[t];
3794
3794
  }
3795
3795
  get first() {
3796
- return this.Yl[0];
3796
+ return this.Wl[0];
3797
3797
  }
3798
3798
  get last() {
3799
- return this.Yl[this.Yl.length - 1];
3799
+ return this.Wl[this.Wl.length - 1];
3800
3800
  }
3801
3801
  indexOf(t) {
3802
- return this.Yl.indexOf(t);
3802
+ return this.Wl.indexOf(t);
3803
3803
  }
3804
3804
  has(t) {
3805
- return this.Yl.includes(t) || this.Kl.includes(t);
3805
+ return this.Wl.includes(t) || this.Zl.includes(t);
3806
3806
  }
3807
3807
  [Symbol.iterator]() {
3808
- return this.Yl[Symbol.iterator]();
3808
+ return this.Wl[Symbol.iterator]();
3809
3809
  }
3810
- Zl(t) {
3810
+ Vl(t) {
3811
3811
  var e, i, s, r;
3812
3812
  (i = (e = this.l).onRemove) == null || i.call(e, t), (r = (s = this.l).onDispose) == null || r.call(s, t);
3813
3813
  }
@@ -3815,20 +3815,20 @@ class ti {
3815
3815
  class ee {
3816
3816
  constructor(t) {
3817
3817
  o(this, "R");
3818
- o(this, "ql", /* @__PURE__ */ new Map());
3819
- o(this, "Vl", /* @__PURE__ */ new Map());
3818
+ o(this, "Jl", /* @__PURE__ */ new Map());
3819
+ o(this, "tu", /* @__PURE__ */ new Map());
3820
3820
  o(this, "Ke");
3821
- o(this, "ul");
3821
+ o(this, "dl");
3822
3822
  o(this, "Sr", !1);
3823
- this.R = t, this.Ke = t.Mi(W, jt), this.Jl();
3823
+ this.R = t, this.Ke = t.Mi(Z, jt), this.su();
3824
3824
  }
3825
3825
  async register(t, e, i = {}) {
3826
3826
  const s = Object.entries(i), r = s.length > 0 ? s[0][1][0] : null;
3827
3827
  let h;
3828
3828
  if (typeof e == "string") {
3829
3829
  const l = await st(e);
3830
- h = this.R.Mi(W, l), this.Vl.set(t, h);
3831
- } else h = e, this.Vl.set(t, h);
3830
+ h = this.R.Mi(Z, l), this.tu.set(t, h);
3831
+ } else h = e, this.tu.set(t, h);
3832
3832
  const a = { id: t, createShader: () => h, createUniforms: (l, u) => {
3833
3833
  const c = { u_resolution: [u.width, u.height] };
3834
3834
  for (const [f, [g, p]] of s) {
@@ -3837,215 +3837,215 @@ class ee {
3837
3837
  if (typeof l == "number" && g === r) v = l;
3838
3838
  else if (typeof l == "object" && g in l) {
3839
3839
  const d = l[g];
3840
- Xt(d) && (v = d);
3840
+ Ut(d) && (v = d);
3841
3841
  }
3842
3842
  }
3843
3843
  c[f] = v;
3844
3844
  }
3845
3845
  return c;
3846
3846
  } };
3847
- this.ql.set(t, a);
3847
+ this.Jl.set(t, a);
3848
3848
  }
3849
3849
  unregister(t) {
3850
- const e = this.Vl.get(t);
3851
- return e && (e.dispose(), this.Vl.delete(t)), this.ql.delete(t);
3850
+ const e = this.tu.get(t);
3851
+ return e && (e.dispose(), this.tu.delete(t)), this.Jl.delete(t);
3852
3852
  }
3853
3853
  has(t) {
3854
- return this.ql.has(t);
3854
+ return this.Jl.has(t);
3855
3855
  }
3856
3856
  Er(t, e) {
3857
- this.Sr || (this.ul = [this.R.Hi(t, e, 1, { depth: !1 }), this.R.Hi(t, e, 1, { depth: !1 })], this.Sr = !0);
3857
+ this.Sr || (this.dl = [this.R.Hi(t, e, 1, { depth: !1 }), this.R.Hi(t, e, 1, { depth: !1 })], this.Sr = !0);
3858
3858
  }
3859
- tu(t, e, i, s, r) {
3860
- this.ul[0].width === s && this.ul[0].height === r || (this.ul[0].resize(s, r), this.ul[1].resize(s, r)), this.Al(t, e, i, s, r, this.ul);
3859
+ eu(t, e, i, s, r) {
3860
+ this.dl[0].width === s && this.dl[0].height === r || (this.dl[0].resize(s, r), this.dl[1].resize(s, r)), this.bl(t, e, i, s, r, this.dl);
3861
3861
  }
3862
- Al(t, e, i, s, r, h) {
3863
- if (i.length === 0) return void this.su(t, e, s, r);
3864
- this.su(t, h[0], s, r);
3862
+ bl(t, e, i, s, r, h) {
3863
+ if (i.length === 0) return void this.iu(t, e, s, r);
3864
+ this.iu(t, h[0], s, r);
3865
3865
  let a = 0;
3866
3866
  for (let l = 0; l < i.length; l++) {
3867
3867
  const u = i[l], c = l === i.length - 1, f = a === 0 ? 1 : 0, g = c ? e : h[f];
3868
- this.eu(u, h[a], g, s, r), c || (a = f);
3868
+ this.ru(u, h[a], g, s, r), c || (a = f);
3869
3869
  }
3870
3870
  }
3871
- eu(t, e, i, s, r) {
3872
- const h = this.ql.get(t.name);
3873
- if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.su(e.textures[0], i, s, r);
3874
- const a = this.iu(t.name, h, s, r), l = { renderer: this.R, gl: this.R.context, width: s, height: r };
3871
+ ru(t, e, i, s, r) {
3872
+ const h = this.Jl.get(t.name);
3873
+ if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.iu(e.textures[0], i, s, r);
3874
+ const a = this.nu(t.name, h, s, r), l = { renderer: this.R, gl: this.R.context, width: s, height: r };
3875
3875
  i.begin(), this.R.xi(a), a.gt({ u_texture: e.textures[0] });
3876
3876
  const u = h.createUniforms(t.params, l);
3877
3877
  a.gt(u), this.R.Ei(0, 0, s, r), i.end();
3878
3878
  }
3879
- iu(t, e, i, s) {
3880
- let r = this.Vl.get(t);
3879
+ nu(t, e, i, s) {
3880
+ let r = this.tu.get(t);
3881
3881
  if (!r && e) {
3882
3882
  const h = { renderer: this.R, gl: this.R.context, width: i, height: s };
3883
- r = e.createShader(h), this.Vl.set(t, r);
3883
+ r = e.createShader(h), this.tu.set(t, r);
3884
3884
  }
3885
3885
  return r;
3886
3886
  }
3887
- su(t, e, i, s) {
3887
+ iu(t, e, i, s) {
3888
3888
  e.begin(), this.R.xi(this.Ke), this.Ke.gt({ u_texture: t, u_resolution: [i, s] }), this.R.Ei(0, 0, i, s), e.end();
3889
3889
  }
3890
3890
  vn(t, e) {
3891
- this.ul && (this.ul[0].resize(t, e), this.ul[1].resize(t, e));
3891
+ this.dl && (this.dl[0].resize(t, e), this.dl[1].resize(t, e));
3892
3892
  }
3893
3893
  Ss() {
3894
- for (const t of this.Vl.values()) t.dispose();
3895
- this.Vl.clear(), this.ql.clear(), this.Ke.dispose(), this.ul && (this.ul[0].dispose(), this.ul[1].dispose()), this.Sr = !1;
3894
+ for (const t of this.tu.values()) t.dispose();
3895
+ this.tu.clear(), this.Jl.clear(), this.Ke.dispose(), this.dl && (this.dl[0].dispose(), this.dl[1].dispose()), this.Sr = !1;
3896
3896
  }
3897
- Jl() {
3897
+ su() {
3898
3898
  this.register("invert", `#version 300 es
3899
3899
  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.register("grayscale", `#version 300 es
3900
- 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.register("sepia", `#version 300 es
3901
- 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.register("threshold", `#version 300 es
3902
- precision highp float;uniform sampler2D u_texture;uniform float Uq;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(Uq,B);fragColor=vec4(vec3(C),A.a);}`, { Uq: ["threshold", 0.5] });
3900
+ precision highp float;uniform sampler2D u_texture;uniform float U6;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),U6);fragColor=vec4(C,A.a);}`, { U6: ["amount", 1] }), this.register("sepia", `#version 300 es
3901
+ precision highp float;uniform sampler2D u_texture;uniform float U6;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,U6);fragColor=vec4(C,A.a);}`, { U6: ["amount", 1] }), this.register("threshold", `#version 300 es
3902
+ precision highp float;uniform sampler2D u_texture;uniform float Ua;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(Ua,B);fragColor=vec4(vec3(C),A.a);}`, { Ua: ["threshold", 0.5] });
3903
3903
  }
3904
3904
  }
3905
3905
  const ni = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFilterManager: ee }, Symbol.toStringTag, { value: "Module" }));
3906
3906
  class ie {
3907
3907
  constructor(t, e) {
3908
- o(this, "Oa");
3908
+ o(this, "Ha");
3909
3909
  o(this, "R");
3910
- o(this, "ru");
3911
- o(this, "nu");
3912
3910
  o(this, "hu");
3913
3911
  o(this, "ou");
3914
- o(this, "Wl", !1);
3915
- o(this, "au", /* @__PURE__ */ new Set());
3916
- o(this, "cu", []);
3917
- o(this, "lu");
3918
- o(this, "uu");
3919
- this.Oa = t, this.R = t.R, this.nu = new ee(this.R), this.ru = new te(this.R, this.Oa.Xr.width, this.Oa.Xr.height), this.hu = new ti({ onRemove: (i) => this.Oa._l.ec(i), onDispose: (i) => i == null ? void 0 : i.Ss() }), this.ou = new ot(this.R, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
3912
+ o(this, "au");
3913
+ o(this, "cu");
3914
+ o(this, "ql", !1);
3915
+ o(this, "lu", /* @__PURE__ */ new Set());
3916
+ o(this, "uu", []);
3917
+ o(this, "fu");
3918
+ o(this, "du");
3919
+ this.Ha = t, this.R = t.R, this.ou = new ee(this.R), this.hu = new te(this.R, this.Ha.Xr.width, this.Ha.Xr.height), this.au = new ti({ onRemove: (i) => this.Ha.Al.nc(i), onDispose: (i) => i == null ? void 0 : i.Ss() }), this.cu = new ot(this.R, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
3920
3920
  }
3921
3921
  async Er() {
3922
- await this.fu(this.ou);
3923
- const t = this.Oa.Xr;
3924
- this.lu = this.R.Hi(t.width, t.height, 1), this.uu = this.R.Hi(t.width, t.height, 1), this.nu.Er(t.width, t.height), await this.hu.initialize((e) => this.fu(e)), this.Wl = !0;
3922
+ await this.pu(this.cu);
3923
+ const t = this.Ha.Xr;
3924
+ this.fu = this.R.Hi(t.width, t.height, 1), this.du = this.R.Hi(t.width, t.height, 1), this.ou.Er(t.width, t.height), await this.au.initialize((e) => this.pu(e)), this.ql = !0;
3925
3925
  }
3926
- du(t, e) {
3927
- this.cu.push({ name: t, params: e });
3926
+ vu(t, e) {
3927
+ this.uu.push({ name: t, params: e });
3928
3928
  }
3929
- pu() {
3930
- this.cu = [];
3929
+ gu() {
3930
+ this.uu = [];
3931
3931
  }
3932
3932
  add(t = {}) {
3933
3933
  const e = new ot(this.R, t);
3934
- return this.hu.isReady && this.fu(e), this.hu.add(e), e;
3934
+ return this.au.isReady && this.pu(e), this.au.add(e), e;
3935
3935
  }
3936
3936
  remove(t) {
3937
- this.hu.remove(t);
3937
+ this.au.remove(t);
3938
3938
  }
3939
3939
  move(t, e) {
3940
- this.hu.move(t, e);
3940
+ this.au.move(t, e);
3941
3941
  }
3942
3942
  swap(t, e) {
3943
- this.hu.swap(t, e);
3943
+ this.au.swap(t, e);
3944
3944
  }
3945
3945
  clear() {
3946
- this.hu.clear();
3946
+ this.au.clear();
3947
3947
  }
3948
- vu(t) {
3949
- this.Oa._l.Ja(), this.ou.Ra(this.Oa, this.Oa.zl);
3948
+ mu(t) {
3949
+ this.Ha.Al.sc(), this.cu.La(this.Ha, this.Ha.Bl);
3950
3950
  const e = [...this.R.state.canvasBackgroundColor];
3951
- this.hu.all.forEach((i) => i.Ra(this.Oa, this.Oa.zl)), this.gu(t, e);
3952
- }
3953
- mu() {
3954
- this.vu(this.lu);
3955
- let t = this.lu.textures[0];
3956
- if (this.cu.length > 0) {
3957
- const i = this.Oa.Xr;
3958
- this.nu.tu(this.lu.textures[0], this.uu, this.cu, i.width, i.height), t = this.uu.textures[0], this.cu = [];
3951
+ this.au.all.forEach((i) => i.La(this.Ha, this.Ha.Bl)), this._u(t, e);
3952
+ }
3953
+ yu() {
3954
+ this.mu(this.fu);
3955
+ let t = this.fu.textures[0];
3956
+ if (this.uu.length > 0) {
3957
+ const i = this.Ha.Xr;
3958
+ this.ou.eu(this.fu.textures[0], this.du, this.uu, i.width, i.height), t = this.du.textures[0], this.uu = [];
3959
3959
  }
3960
- const e = this.Oa.Xr;
3961
- this.R.xe(0, 0, 0, 0), this.R.xi(this.Oa.Hl), this.Oa.Hl.gt({ u_texture: t }), this.R.Ei(0, 0, e.width, e.height), this.Oa._l.sc();
3960
+ const e = this.Ha.Xr;
3961
+ this.R.xe(0, 0, 0, 0), this.R.xi(this.Ha.Il), this.Ha.Il.gt({ u_texture: t }), this.R.Ei(0, 0, e.width, e.height), this.Ha.Al.rc();
3962
3962
  }
3963
- gu(t, e) {
3964
- const i = this.Oa.Xr, s = this.ou.grid, r = this.ou.texture;
3963
+ _u(t, e) {
3964
+ const i = this.Ha.Xr, s = this.cu.grid, r = this.cu.texture;
3965
3965
  if (!r) return;
3966
- const h = { layer: this.ou, texture: r, width: s.width, height: s.height, offsetX: s.offsetX + this.ou.sl, offsetY: s.offsetY + this.ou.el }, a = this.hu.all.filter((l) => !!l.grid && !!l.texture).map((l) => {
3966
+ const h = { layer: this.cu, texture: r, width: s.width, height: s.height, offsetX: s.offsetX + this.cu.il, offsetY: s.offsetY + this.cu.rl }, a = this.au.all.filter((l) => !!l.grid && !!l.texture).map((l) => {
3967
3967
  const u = l.grid;
3968
- return { layer: l, texture: l.texture, width: u.width, height: u.height, offsetX: u.offsetX + l.sl, offsetY: u.offsetY + l.el };
3968
+ return { layer: l, texture: l.texture, width: u.width, height: u.height, offsetX: u.offsetX + l.il, offsetY: u.offsetY + l.rl };
3969
3969
  });
3970
- this.ru.Ql({ base: h, layers: a, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
3970
+ this.hu.Xl({ base: h, layers: a, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
3971
3971
  }
3972
3972
  vn() {
3973
3973
  var e, i, s;
3974
- if (!this.Wl) return;
3975
- const t = this.Oa.Xr;
3976
- this.ou.vn(), this.hu.all.forEach((r) => r.vn()), this.ru.vn(t.width, t.height), (e = this.lu) == null || e.resize(t.width, t.height), (i = this.uu) == null || i.resize(t.width, t.height), (s = this.nu) == null || s.vn(t.width, t.height);
3974
+ if (!this.ql) return;
3975
+ const t = this.Ha.Xr;
3976
+ this.cu.vn(), this.au.all.forEach((r) => r.vn()), this.hu.vn(t.width, t.height), (e = this.fu) == null || e.resize(t.width, t.height), (i = this.du) == null || i.resize(t.width, t.height), (s = this.ou) == null || s.vn(t.width, t.height);
3977
3977
  }
3978
3978
  Ss() {
3979
3979
  var t, e;
3980
- this.hu.dispose(), this.Oa._l.ec(this.ou), this.ou.Ss(), this.nu.Ss(), this.ru.Ss(), (t = this.lu) == null || t.dispose(), (e = this.uu) == null || e.dispose(), this.cu = [];
3980
+ this.au.dispose(), this.Ha.Al.nc(this.cu), this.cu.Ss(), this.ou.Ss(), this.hu.Ss(), (t = this.fu) == null || t.dispose(), (e = this.du) == null || e.dispose(), this.uu = [];
3981
3981
  }
3982
3982
  get all() {
3983
- return this.hu.all;
3983
+ return this.au.all;
3984
3984
  }
3985
3985
  get base() {
3986
- return this.ou;
3986
+ return this.cu;
3987
3987
  }
3988
3988
  get filters() {
3989
- return this.nu;
3989
+ return this.ou;
3990
3990
  }
3991
3991
  get resultFramebuffer() {
3992
- return this.uu;
3992
+ return this.du;
3993
3993
  }
3994
- _u() {
3995
- const t = this.hu.all;
3994
+ Au() {
3995
+ const t = this.au.all;
3996
3996
  for (let e = t.length - 1; e >= 0; e--) {
3997
3997
  const i = t[e];
3998
- if (i.Jc && i.grid) return i.grid;
3998
+ if (i.sl && i.grid) return i.grid;
3999
3999
  }
4000
- return this.ou.grid;
4000
+ return this.cu.grid;
4001
4001
  }
4002
- yu(t) {
4003
- this.au.add(t);
4002
+ wu(t) {
4003
+ this.lu.add(t);
4004
4004
  }
4005
- Au() {
4006
- for (const t of this.au) t();
4005
+ bu() {
4006
+ for (const t of this.lu) t();
4007
4007
  }
4008
- async fu(t) {
4008
+ async pu(t) {
4009
4009
  var i;
4010
- const e = { renderer: this.R, canvas: this.Oa.Xr, filterManager: this.nu, createFramebuffer: (s, r, h = 1, a) => this.R.Hi(s, r, h, a) };
4011
- await t.vl(e), (i = t.grid) == null || i.Vr(() => this.Au());
4010
+ const e = { renderer: this.R, canvas: this.Ha.Xr, filterManager: this.ou, createFramebuffer: (s, r, h = 1, a) => this.R.Hi(s, r, h, a) };
4011
+ await t._l(e), (i = t.grid) == null || i.Vr(() => this.bu());
4012
4012
  }
4013
4013
  }
4014
4014
  const ei = { id: "brightness", createShader: ({ gl: n }) => new j(n, ht, `#version 300 es
4015
4015
  precision highp float;in vec2 v_uv;uniform sampler2D u_image;uniform bool u_invert;uniform bool u_flipX;uniform bool u_flipY;uniform float u_charRotation;uniform bool u_charColorFixed;uniform vec4 u_charColor;uniform bool u_cellColorFixed;uniform vec4 u_cellColor;uniform vec4 u_backgroundColor;uniform int u_charCount;uniform vec3 u_charList[255];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;float B(vec3 C){return dot(C,vec3(0.299f,0.587f,0.114f));}void main(){vec2 D=vec2(v_uv.x,1.0f-v_uv.y);vec4 E=texture(u_image,D);float F=B(E.rgb);vec2 G=vec2(0.);if(u_charCount>0){float H=float(u_charCount);float I=clamp(F*(H-1.0f),0.0f,H-1.0f);int J=int(floor(I+0.5f));vec3 K=u_charList[J];G=K.xy;}else{G=vec2(0.0f,0.0f);}vec4 L=u_charColorFixed?u_charColor:E;vec4 M=u_cellColorFixed?u_cellColor:E;if(E.a<0.01f){discard;}o_primaryColor=vec4(L.rgb,L.a);o_secondaryColor=vec4(M.rgb,M.a);A=vec4(0.);int N=int(u_invert?1:0);int O=int(u_flipX?1:0);int P=int(u_flipY?1:0);float Q=float(N|(O<<1)|(P<<2))/255.;o_character=vec4(G,Q,clamp(u_charRotation,0.0f,1.0f));}`), createUniforms: ({ source: n }) => n.createBaseConversionUniforms() };
4016
4016
  class se {
4017
4017
  constructor() {
4018
- o(this, "wu", /* @__PURE__ */ new Map());
4019
- o(this, "Vl", /* @__PURE__ */ new Map());
4020
- this.bu();
4018
+ o(this, "Cu", /* @__PURE__ */ new Map());
4019
+ o(this, "tu", /* @__PURE__ */ new Map());
4020
+ this.xu();
4021
4021
  }
4022
4022
  register(t) {
4023
- this.wu.set(t.id, t);
4023
+ this.Cu.set(t.id, t);
4024
4024
  }
4025
4025
  unregister(t) {
4026
- const e = this.Vl.get(t);
4027
- return e && (e.dispose(), this.Vl.delete(t)), this.wu.delete(t);
4026
+ const e = this.tu.get(t);
4027
+ return e && (e.dispose(), this.tu.delete(t)), this.Cu.delete(t);
4028
4028
  }
4029
4029
  has(t) {
4030
- return this.wu.has(t);
4030
+ return this.Cu.has(t);
4031
4031
  }
4032
- jn(t) {
4033
- return this.wu.get(t);
4032
+ Qn(t) {
4033
+ return this.Cu.get(t);
4034
4034
  }
4035
- Gn(t, e) {
4036
- let i = this.Vl.get(t);
4035
+ jn(t, e) {
4036
+ let i = this.tu.get(t);
4037
4037
  if (!i) {
4038
- const s = this.wu.get(t);
4038
+ const s = this.Cu.get(t);
4039
4039
  if (!s) throw Error(`[textmode.js] Conversion mode "${t}" is not registered.`);
4040
- i = s.createShader(e), this.Vl.set(t, i);
4040
+ i = s.createShader(e), this.tu.set(t, i);
4041
4041
  }
4042
4042
  return i;
4043
4043
  }
4044
4044
  Ss() {
4045
- for (const t of this.Vl.values()) t.dispose();
4046
- this.Vl.clear(), this.wu.clear();
4045
+ for (const t of this.tu.values()) t.dispose();
4046
+ this.tu.clear(), this.Cu.clear();
4047
4047
  }
4048
- bu() {
4048
+ xu() {
4049
4049
  this.register(ei);
4050
4050
  }
4051
4051
  }
@@ -4053,128 +4053,128 @@ const hi = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeConver
4053
4053
  class ii extends function(e, ...i) {
4054
4054
  return i.reduce((s, r) => r(s), e);
4055
4055
  }(class {
4056
- }, We, Ke, Qe, Ze, qe) {
4056
+ }, Ze, Ve, Qe, $e, qe) {
4057
4057
  constructor(e = {}) {
4058
4058
  super();
4059
4059
  o(this, "R");
4060
- o(this, "zl");
4061
- o(this, "Hl");
4060
+ o(this, "Bl");
4061
+ o(this, "Il");
4062
4062
  o(this, "Xr");
4063
- o(this, "ka");
4064
- o(this, "bo");
4065
4063
  o(this, "Da");
4066
- o(this, "La");
4067
- o(this, "Cu");
4068
- o(this, "xu");
4069
- o(this, "yl");
4070
- o(this, "Un");
4071
- o(this, "Mu", /* @__PURE__ */ new Set());
4072
- o(this, "_l");
4073
- o(this, "Fu", !1);
4074
- o(this, "$u", !1);
4064
+ o(this, "Co");
4065
+ o(this, "Oa");
4066
+ o(this, "za");
4067
+ o(this, "Mu");
4068
+ o(this, "Fu");
4069
+ o(this, "wl");
4070
+ o(this, "En");
4071
+ o(this, "$u", /* @__PURE__ */ new Set());
4072
+ o(this, "Al");
4075
4073
  o(this, "Pu", !1);
4076
4074
  o(this, "Tu", !1);
4077
- o(this, "Su", () => {
4075
+ o(this, "Su", !1);
4076
+ o(this, "Eu", !1);
4077
+ o(this, "ku", () => {
4078
4078
  });
4079
- o(this, "Eu", () => {
4079
+ o(this, "Ru", () => {
4080
4080
  });
4081
- o(this, "ku");
4082
- o(this, "Ru");
4083
4081
  o(this, "Du");
4084
- o(this, "rn", !1);
4085
4082
  o(this, "Lu");
4086
4083
  o(this, "Ou");
4087
- this._l = new Vt(this), this.rn = e.overlay ?? !1, this.Xr = new He(e), this.R = new Me(this.Xr.gn()), this.zl = this.R.Mi(W, `#version 300 es
4088
- precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D U0;uniform sampler2D U1;uniform sampler2D U2;uniform vec2 U3;uniform vec2 U4;uniform vec4 U5;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/U4;vec2 F=E*U3;vec2 G=floor(F);vec2 H=(G+0.5)/U3;vec4 I=texture(U0,H);vec4 J=texture(U1,H);vec4 K=texture(U2,H);int L=int(K.b*255.+0.5);bool M=(L&1)!=0;bool N=(L&2)!=0;bool O=(L&4)!=0;int P=int(K.r*255.+0.5)+int(K.g*255.+0.5)*256;int Q=int(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(U5,J,J.a);fragColor=mix(d,I,c);}`), this.Hl = this.R.Mi(W, jt), this.ka = new Nt(e.frameRate ?? 60), this.Cu = new Jt(this, e.loadingScreen, this.Xr.pn()), this.Cu.Ll(() => {
4089
- this.ka.ph = 0, this.Tu = !0;
4090
- }), this.xu = new ie(this, e);
4091
- const i = () => this.zu();
4092
- this.bo = new kt(this.Xr, i), this.Da = new Gt(this.Xr, i, this.bo), this.La = new Ht(), this.Un = new se(), this._l.Ka(e.plugins ?? []), this.Cu.ih(), this.Hu();
4093
- }
4094
- Ea(e) {
4084
+ o(this, "rn", !1);
4085
+ o(this, "zu");
4086
+ o(this, "Hu");
4087
+ this.Al = new Wt(this), this.rn = e.overlay ?? !1, this.Xr = new Ye(e), this.R = new Me(this.Xr.gn()), this.Bl = this.R.Mi(Z, `#version 300 es
4088
+ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D U0;uniform sampler2D U1;uniform sampler2D U2;uniform vec2 U3;uniform vec2 U4;uniform vec4 U5;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/U4;vec2 F=E*U3;vec2 G=floor(F);vec2 H=(G+0.5)/U3;vec4 I=texture(U0,H);vec4 J=texture(U1,H);vec4 K=texture(U2,H);int L=int(K.b*255.+0.5);bool M=(L&1)!=0;bool N=(L&2)!=0;bool O=(L&4)!=0;int P=int(K.r*255.+0.5)+int(K.g*255.+0.5)*256;int Q=int(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(U5,J,J.a);fragColor=mix(d,I,c);}`), this.Il = this.R.Mi(Z, jt), this.Da = new Nt(e.frameRate ?? 60), this.Mu = new Jt(this, e.loadingScreen, this.Xr.pn()), this.Mu.zl(() => {
4089
+ this.Da.gh = 0, this.Eu = !0;
4090
+ }), this.Fu = new ie(this, e);
4091
+ const i = () => this.Bu();
4092
+ this.Co = new kt(this.Xr, i), this.Oa = new Gt(this.Xr, i, this.Co), this.za = new Yt(), this.En = new se(), this.Al.Za(e.plugins ?? []), this.Mu.rh(), this.Iu();
4093
+ }
4094
+ Ra(e) {
4095
4095
  var i;
4096
- this.Mu.add(e), (i = e.C) == null || i.call(e, () => {
4097
- this.Mu.delete(e);
4096
+ this.$u.add(e), (i = e.C) == null || i.call(e, () => {
4097
+ this.$u.delete(e);
4098
4098
  });
4099
4099
  }
4100
- async Hu() {
4101
- await this.xu.Er(), await this.Cu.Er();
4102
- const e = this.xu.base.grid;
4103
- this.xu.yu(() => {
4104
- this.bo.Wh(), this.Da.Wh();
4105
- }), this.rn && (this.Lu = K.Qn(this.R, this.Un, this.Xr.targetCanvas, e.cols, e.rows)), this.Bu(), this.ka.ih(() => this.Ra());
4100
+ async Iu() {
4101
+ await this.Fu.Er(), await this.Mu.Er();
4102
+ const e = this.Fu.base.grid;
4103
+ this.Fu.wu(() => {
4104
+ this.Co.Zh(), this.Oa.Zh();
4105
+ }), this.rn && (this.zu = V.Nn(this.R, this.En, this.Xr.targetCanvas, e.cols, e.rows)), this.Gu(), this.Da.rh(() => this.La());
4106
4106
  try {
4107
- await this._l.hc(), await this.Su(), await this._l.ac(), this.Cu.Bc();
4107
+ await this.Al.ac(), await this.ku(), await this.Al.lc(), this.Mu.Gc();
4108
4108
  } catch (i) {
4109
- console.error("Error during setup:", i), this.Cu.error(i);
4109
+ console.error("Error during setup:", i), this.Mu.error(i);
4110
4110
  }
4111
4111
  }
4112
- Bu() {
4113
- this.ku = () => {
4114
- this.rn && this.resizeCanvas(this.Xr.targetCanvas.width, this.Xr.targetCanvas.height), this.Eu();
4115
- }, window.addEventListener("resize", this.ku), this.bo.Ih(), this.Da.Ih(), this.La.Ih(), this.Ru = () => {
4116
- this.La.wo();
4117
- }, window.addEventListener("blur", this.Ru), this.rn && (this.Du = new ResizeObserver(() => {
4112
+ Gu() {
4113
+ this.Du = () => {
4114
+ this.rn && this.resizeCanvas(this.Xr.targetCanvas.width, this.Xr.targetCanvas.height), this.Ru();
4115
+ }, window.addEventListener("resize", this.Du), this.Co.Gh(), this.Oa.Gh(), this.za.Gh(), this.Lu = () => {
4116
+ this.za.bo();
4117
+ }, window.addEventListener("blur", this.Lu), this.rn && (this.Ou = new ResizeObserver(() => {
4118
4118
  this.resizeCanvas(this.Xr.targetCanvas.width, this.Xr.targetCanvas.height);
4119
- }), this.Du.observe(this.Xr.targetCanvas));
4119
+ }), this.Ou.observe(this.Xr.targetCanvas));
4120
4120
  }
4121
- Ra() {
4122
- if (!this.Cu.Lc && this.Tu) {
4123
- this.$u = !0;
4121
+ La() {
4122
+ if (!this.Mu.zc && this.Eu) {
4123
+ this.Tu = !0;
4124
4124
  try {
4125
- this.ka.ah(), this.ka.gh(), this.rn && rt(this.R.context, this.Lu.texture, this.Xr.targetCanvas), this.xu.mu();
4125
+ this.Da.uh(), this.Da.mh(), this.rn && rt(this.R.context, this.zu.texture, this.Xr.targetCanvas), this.Fu.yu();
4126
4126
  } finally {
4127
- this.$u = !1, this.Fu && !this.Pu && this.Iu();
4127
+ this.Tu = !1, this.Pu && !this.Su && this.ju();
4128
4128
  }
4129
4129
  }
4130
4130
  }
4131
4131
  resizeCanvas(e, i) {
4132
4132
  var s;
4133
- this.Xr.vn(e, i), this.Cu.Bl(this.Xr.pn()), this.Cu.vn(), (s = this.xu) == null || s.vn(), this.R.Gi(), this.Ra();
4133
+ this.Xr.vn(e, i), this.Mu.Gl(this.Xr.pn()), this.Mu.vn(), (s = this.Fu) == null || s.vn(), this.R.Gi(), this.La();
4134
4134
  }
4135
4135
  destroy() {
4136
- this.Pu || this.Fu || (this.Fu = !0, this.ka.nh(), this.$u || this.Iu());
4136
+ this.Su || this.Pu || (this.Pu = !0, this.Da.hh(), this.Tu || this.ju());
4137
4137
  }
4138
- Iu() {
4138
+ ju() {
4139
4139
  var e, i, s, r;
4140
- this.Fu = !1, this.Xr.Ss(), this.Cu.Ss(), this._l.cc(), window.removeEventListener("resize", this.ku), window.removeEventListener("blur", this.Ru), (e = this.Du) == null || e.disconnect(), this.bo.Kh(), this.Da.Kh(), this.La.Kh(), (i = this.xu) == null || i.Ss(), (s = this.Un) == null || s.Ss();
4141
- for (const h of this.Mu) h.dispose();
4142
- this.Mu.clear(), this.zl.dispose(), this.Hl.dispose(), this.R.Ss(), (r = this.Lu) == null || r.dispose(), this.Pu = !0;
4140
+ this.Pu = !1, this.Xr.Ss(), this.Mu.Ss(), this.Al.uc(), window.removeEventListener("resize", this.Du), window.removeEventListener("blur", this.Lu), (e = this.Ou) == null || e.disconnect(), this.Co.Wh(), this.Oa.Wh(), this.za.Wh(), (i = this.Fu) == null || i.Ss(), (s = this.En) == null || s.Ss();
4141
+ for (const h of this.$u) h.dispose();
4142
+ this.$u.clear(), this.Bl.dispose(), this.Il.dispose(), this.R.Ss(), (r = this.zu) == null || r.dispose(), this.Su = !0;
4143
4143
  }
4144
4144
  filter(e, i) {
4145
- this.xu.du(e, i);
4145
+ this.Fu.vu(e, i);
4146
4146
  }
4147
4147
  draw(e) {
4148
- this.xu.base.draw(e);
4148
+ this.Fu.base.draw(e);
4149
4149
  }
4150
4150
  async loadFont(e, i = !0) {
4151
- if (i) return await this.xu.base.loadFont(e), this.xu.base.font;
4151
+ if (i) return await this.Fu.base.loadFont(e), this.Fu.base.font;
4152
4152
  if (e instanceof z) return e.Gr || await e.Er(), e;
4153
4153
  const s = new z(this.R);
4154
- return await s.Er(e), this.Ea(s), s;
4154
+ return await s.Er(e), this.Ra(s), s;
4155
4155
  }
4156
4156
  fontSize(e) {
4157
- return this.xu.base.fontSize(e);
4157
+ return this.Fu.base.fontSize(e);
4158
4158
  }
4159
4159
  inputGrid(e) {
4160
- return e === void 0 ? this.Ou ?? "topmost" : e === "topmost" ? (this.Ou = void 0, this.bo.Wh(), void this.Da.Wh()) : (this.Ou = e, this.bo.Wh(), void this.Da.Wh());
4160
+ return e === void 0 ? this.Hu ?? "topmost" : e === "topmost" ? (this.Hu = void 0, this.Co.Zh(), void this.Oa.Zh()) : (this.Hu = e, this.Co.Zh(), void this.Oa.Zh());
4161
4161
  }
4162
- zu() {
4163
- return this.Ou ? this.Ou : this.xu._u();
4162
+ Bu() {
4163
+ return this.Hu ? this.Hu : this.Fu.Au();
4164
4164
  }
4165
4165
  async setup(e) {
4166
- this.Su = e;
4166
+ this.ku = e;
4167
4167
  }
4168
4168
  windowResized(e) {
4169
- this.Eu = e;
4169
+ this.Ru = e;
4170
4170
  }
4171
4171
  get grid() {
4172
4172
  var e;
4173
- return ((e = this.yl) == null ? void 0 : e.grid) ?? this.xu.base.grid;
4173
+ return ((e = this.wl) == null ? void 0 : e.grid) ?? this.Fu.base.grid;
4174
4174
  }
4175
4175
  get font() {
4176
4176
  var e;
4177
- return ((e = this.yl) == null ? void 0 : e.font) ?? this.xu.base.font;
4177
+ return ((e = this.wl) == null ? void 0 : e.font) ?? this.Fu.base.font;
4178
4178
  }
4179
4179
  get width() {
4180
4180
  return this.Xr.width;
@@ -4186,25 +4186,25 @@ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charse
4186
4186
  return this.Xr.canvas;
4187
4187
  }
4188
4188
  get isDisposed() {
4189
- return this.Pu;
4189
+ return this.Su;
4190
4190
  }
4191
4191
  get overlay() {
4192
- return this.Lu;
4192
+ return this.zu;
4193
4193
  }
4194
4194
  get loading() {
4195
- return this.Cu;
4195
+ return this.Mu;
4196
4196
  }
4197
4197
  get layers() {
4198
- return this.xu;
4198
+ return this.Fu;
4199
4199
  }
4200
4200
  get filters() {
4201
- return this.xu.filters;
4201
+ return this.Fu.filters;
4202
4202
  }
4203
4203
  get conversions() {
4204
- return this.Un;
4204
+ return this.En;
4205
4205
  }
4206
4206
  get isRenderingFrame() {
4207
- return this.$u;
4207
+ return this.Tu;
4208
4208
  }
4209
4209
  }
4210
4210
  class Et {
@@ -4217,14 +4217,14 @@ class Et {
4217
4217
  yt._(t);
4218
4218
  }
4219
4219
  static get version() {
4220
- return "0.9.0";
4220
+ return "0.9.1";
4221
4221
  }
4222
4222
  }
4223
- const oi = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: $t, LoadingPhaseTracker: Wt, LoadingScreenManager: Jt, LoadingScreenStateMachine: Kt, LoadingScreenTransition: Qt, resolveColorInputs: qt, resolveDefaultPalette: Zt, resolveTheme: At }, Symbol.toStringTag, { value: "Module" })), ai = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: z, TextmodeImage: K, TextmodeSource: xt, TextmodeTexture: Q, TextmodeVideo: ut }, Symbol.toStringTag, { value: "Module" })), li = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: Ve, mouse: Ge, touch: je }, Symbol.toStringTag, { value: "Module" })), ci = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: te, TextmodeLayer: ot, TextmodeLayerManager: ie }, Symbol.toStringTag, { value: "Module" })), ui = Et.create, fi = Et.setErrorLevel, di = Et.version;
4223
+ const oi = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: Kt, LoadingPhaseTracker: Zt, LoadingScreenManager: Jt, LoadingScreenStateMachine: Vt, LoadingScreenTransition: Qt, resolveColorInputs: qt, resolveDefaultPalette: $t, resolveTheme: At }, Symbol.toStringTag, { value: "Module" })), ai = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: z, TextmodeImage: V, TextmodeSource: xt, TextmodeTexture: Q, TextmodeVideo: ut }, Symbol.toStringTag, { value: "Module" })), li = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: We, mouse: Ge, touch: je }, Symbol.toStringTag, { value: "Module" })), ci = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: te, TextmodeLayer: ot, TextmodeLayerManager: ie }, Symbol.toStringTag, { value: "Module" })), ui = Et.create, fi = Et.setErrorLevel, di = Et.version;
4224
4224
  export {
4225
- He as TextmodeCanvas,
4225
+ Ye as TextmodeCanvas,
4226
4226
  x as TextmodeColor,
4227
- P as TextmodeError,
4227
+ S as TextmodeError,
4228
4228
  ae as TextmodeErrorLevel,
4229
4229
  vt as TextmodeFramebuffer,
4230
4230
  ze as TextmodeGrid,