textmode.js 0.1.4-beta.4 → 0.1.4-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
1
  var se = Object.defineProperty;
2
2
  var ae = (l, e, t) => e in l ? se(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
- var o = (l, e, t) => ae(l, typeof e != "symbol" ? e + "" : e, t);
3
+ var n = (l, e, t) => ae(l, typeof e != "symbol" ? e + "" : e, t);
4
4
  class F extends Error {
5
5
  constructor(t, r, i = {}) {
6
6
  const s = F.createFormattedMessage(t, i);
7
7
  super(s);
8
- o(this, "originalError");
9
- o(this, "context");
8
+ n(this, "originalError");
9
+ n(this, "context");
10
10
  this.name = "TextmodeError", this.originalError = r, this.context = i;
11
11
  }
12
12
  /**
@@ -19,9 +19,9 @@ class F extends Error {
19
19
 
20
20
  📋 Context:`;
21
21
  for (const [s, a] of Object.entries(r)) {
22
- const n = F.formatValue(a);
22
+ const o = F.formatValue(a);
23
23
  i += `
24
- - ${s}: ${n}`;
24
+ - ${s}: ${o}`;
25
25
  }
26
26
  }
27
27
  return i += `
@@ -46,10 +46,10 @@ class F extends Error {
46
46
  return String(t);
47
47
  }
48
48
  }
49
- var ne = /* @__PURE__ */ ((l) => (l[l.SILENT = 0] = "SILENT", l[l.WARNING = 1] = "WARNING", l[l.ERROR = 2] = "ERROR", l[l.THROW = 3] = "THROW", l))(ne || {});
49
+ var oe = /* @__PURE__ */ ((l) => (l[l.SILENT = 0] = "SILENT", l[l.WARNING = 1] = "WARNING", l[l.ERROR = 2] = "ERROR", l[l.THROW = 3] = "THROW", l))(oe || {});
50
50
  const E = class E {
51
51
  constructor() {
52
- o(this, "_options", {
52
+ n(this, "_options", {
53
53
  globalLevel: 3
54
54
  /* THROW */
55
55
  });
@@ -103,19 +103,19 @@ const E = class E {
103
103
  this._options.globalLevel = e;
104
104
  }
105
105
  };
106
- o(E, "_instance", null);
106
+ n(E, "_instance", null);
107
107
  let $ = E;
108
108
  const x = $.getInstance();
109
- class oe {
109
+ class ne {
110
110
  constructor(e, t, r = t, i = {}) {
111
- o(this, "gl");
112
- o(this, "_framebuffer");
113
- o(this, "_texture");
114
- o(this, "_width");
115
- o(this, "_height");
116
- o(this, "options");
117
- o(this, "previousState", null);
118
- o(this, "_pixels", null);
111
+ n(this, "gl");
112
+ n(this, "_framebuffer");
113
+ n(this, "_texture");
114
+ n(this, "_width");
115
+ n(this, "_height");
116
+ n(this, "options");
117
+ n(this, "previousState", null);
118
+ n(this, "_pixels", null);
119
119
  this.gl = e, this._width = t, this._height = r, this.options = {
120
120
  filter: "nearest",
121
121
  wrap: "clamp",
@@ -189,16 +189,16 @@ class oe {
189
189
  get(e, t, r, i) {
190
190
  const { gl: s } = this;
191
191
  if (e === void 0 && t === void 0) {
192
- const a = new Uint8Array(this._width * this._height * 4), n = s.getParameter(s.FRAMEBUFFER_BINDING);
193
- return s.bindFramebuffer(s.FRAMEBUFFER, this._framebuffer), s.readPixels(0, 0, this._width, this._height, s.RGBA, s.UNSIGNED_BYTE, a), s.bindFramebuffer(s.FRAMEBUFFER, n), a;
192
+ const a = new Uint8Array(this._width * this._height * 4), o = s.getParameter(s.FRAMEBUFFER_BINDING);
193
+ return s.bindFramebuffer(s.FRAMEBUFFER, this._framebuffer), s.readPixels(0, 0, this._width, this._height, s.RGBA, s.UNSIGNED_BYTE, a), s.bindFramebuffer(s.FRAMEBUFFER, o), a;
194
194
  } else if (r === void 0 && i === void 0) {
195
195
  (e < 0 || t < 0 || e >= this._width || t >= this._height) && (console.warn("The x and y values passed to Framebuffer.get are outside of its range and will be clamped."), e = Math.max(0, Math.min(e, this._width - 1)), t = Math.max(0, Math.min(t, this._height - 1)));
196
- const a = new Uint8Array(4), n = s.getParameter(s.FRAMEBUFFER_BINDING);
197
- return s.bindFramebuffer(s.FRAMEBUFFER, this._framebuffer), s.readPixels(e, t, 1, 1, s.RGBA, s.UNSIGNED_BYTE, a), s.bindFramebuffer(s.FRAMEBUFFER, n), [a[0], a[1], a[2], a[3]];
196
+ const a = new Uint8Array(4), o = s.getParameter(s.FRAMEBUFFER_BINDING);
197
+ return s.bindFramebuffer(s.FRAMEBUFFER, this._framebuffer), s.readPixels(e, t, 1, 1, s.RGBA, s.UNSIGNED_BYTE, a), s.bindFramebuffer(s.FRAMEBUFFER, o), [a[0], a[1], a[2], a[3]];
198
198
  } else {
199
199
  e = Math.max(0, Math.min(e, this._width - 1)), t = Math.max(0, Math.min(t, this._height - 1)), r = Math.max(1, Math.min(r, this._width - e)), i = Math.max(1, Math.min(i, this._height - t));
200
- const a = new Uint8Array(r * i * 4), n = s.getParameter(s.FRAMEBUFFER_BINDING);
201
- return s.bindFramebuffer(s.FRAMEBUFFER, this._framebuffer), s.readPixels(e, t, r, i, s.RGBA, s.UNSIGNED_BYTE, a), s.bindFramebuffer(s.FRAMEBUFFER, n), a;
200
+ const a = new Uint8Array(r * i * 4), o = s.getParameter(s.FRAMEBUFFER_BINDING);
201
+ return s.bindFramebuffer(s.FRAMEBUFFER, this._framebuffer), s.readPixels(e, t, r, i, s.RGBA, s.UNSIGNED_BYTE, a), s.bindFramebuffer(s.FRAMEBUFFER, o), a;
202
202
  }
203
203
  }
204
204
  /**
@@ -227,24 +227,24 @@ class oe {
227
227
  }
228
228
  class Q {
229
229
  constructor(e, t, r) {
230
- o(this, "gl");
231
- o(this, "x");
232
- o(this, "y");
230
+ n(this, "gl");
231
+ n(this, "x");
232
+ n(this, "y");
233
233
  this.gl = e, this.x = t, this.y = r;
234
234
  }
235
235
  }
236
236
  class M {
237
237
  constructor(e, t, r, i, s) {
238
238
  /** The WebGL rendering context */
239
- o(this, "gl");
239
+ n(this, "gl");
240
240
  /** The vertex buffer containing position and texture coordinates */
241
- o(this, "vertexBuffer");
241
+ n(this, "vertexBuffer");
242
242
  /** The number of vertices in this geometry (always 6 for two triangles) */
243
- o(this, "vertexCount", 6);
243
+ n(this, "vertexCount", 6);
244
244
  /** Bytes per vertex: depends on position format (vec2 vs vec3) */
245
- o(this, "bytesPerVertex");
245
+ n(this, "bytesPerVertex");
246
246
  this.gl = e, this.bytesPerVertex = 16;
247
- const a = e.getParameter(e.VIEWPORT), n = a[2], h = a[3], c = e.getParameter(e.FRAMEBUFFER_BINDING) !== null, u = t / n * 2 - 1, d = (t + i) / n * 2 - 1;
247
+ const a = e.getParameter(e.VIEWPORT), o = a[2], h = a[3], c = e.getParameter(e.FRAMEBUFFER_BINDING) !== null, u = t / o * 2 - 1, d = (t + i) / o * 2 - 1;
248
248
  let f, g;
249
249
  c ? (f = r / h * 2 - 1, g = (r + s) / h * 2 - 1) : (f = 1 - r / h * 2, g = 1 - (r + s) / h * 2);
250
250
  let _, p, b, C;
@@ -303,8 +303,8 @@ class M {
303
303
  class le extends Q {
304
304
  constructor(t, r, i, s, a) {
305
305
  super(t, r, i);
306
- o(this, "width");
307
- o(this, "height");
306
+ n(this, "width");
307
+ n(this, "height");
308
308
  this.width = s, this.height = a;
309
309
  }
310
310
  /**
@@ -327,23 +327,23 @@ class le extends Q {
327
327
  class he {
328
328
  constructor(e, t, r, i, s, a) {
329
329
  /** The WebGL rendering context */
330
- o(this, "gl");
330
+ n(this, "gl");
331
331
  /** The vertex buffer containing position and texture coordinates */
332
- o(this, "vertexBuffer");
332
+ n(this, "vertexBuffer");
333
333
  /** The number of vertices in this geometry (always 6 for two triangles) */
334
- o(this, "vertexCount", 6);
334
+ n(this, "vertexCount", 6);
335
335
  /** Bytes per vertex: vec2+vec2 = 16 bytes */
336
- o(this, "bytesPerVertex");
336
+ n(this, "bytesPerVertex");
337
337
  this.gl = e, this.bytesPerVertex = 16;
338
- const n = e.getParameter(e.VIEWPORT), h = n[2], c = n[3], u = e.getParameter(e.FRAMEBUFFER_BINDING) !== null, d = i - t, f = s - r, g = Math.sqrt(d * d + f * f);
338
+ const o = e.getParameter(e.VIEWPORT), h = o[2], c = o[3], u = e.getParameter(e.FRAMEBUFFER_BINDING) !== null, d = i - t, f = s - r, g = Math.sqrt(d * d + f * f);
339
339
  if (g === 0) {
340
340
  const ie = this.generateVertices(0, 0, 0, 0);
341
341
  this.vertexBuffer = e.createBuffer(), e.bindBuffer(e.ARRAY_BUFFER, this.vertexBuffer), e.bufferData(e.ARRAY_BUFFER, ie, e.STATIC_DRAW);
342
342
  return;
343
343
  }
344
- const _ = d / g, b = -(f / g), C = _, v = a / 2, w = t + b * v, A = r + C * v, R = t - b * v, y = r - C * v, P = i + b * v, D = s + C * v, Z = i - b * v, W = s - C * v, J = w / h * 2 - 1, K = R / h * 2 - 1, ee = P / h * 2 - 1, te = Z / h * 2 - 1;
344
+ const _ = d / g, b = -(f / g), C = _, v = a / 2, w = t + b * v, A = r + C * v, R = t - b * v, S = r - C * v, P = i + b * v, D = s + C * v, Z = i - b * v, W = s - C * v, J = w / h * 2 - 1, K = R / h * 2 - 1, ee = P / h * 2 - 1, te = Z / h * 2 - 1;
345
345
  let B, G, V, k;
346
- u ? (B = A / c * 2 - 1, G = y / c * 2 - 1, V = D / c * 2 - 1, k = W / c * 2 - 1) : (B = 1 - A / c * 2, G = 1 - y / c * 2, V = 1 - D / c * 2, k = 1 - W / c * 2);
346
+ u ? (B = A / c * 2 - 1, G = S / c * 2 - 1, V = D / c * 2 - 1, k = W / c * 2 - 1) : (B = 1 - A / c * 2, G = 1 - S / c * 2, V = 1 - D / c * 2, k = 1 - W / c * 2);
347
347
  const re = this.generateLineVertices(
348
348
  J,
349
349
  B,
@@ -399,7 +399,7 @@ class he {
399
399
  * Uses the four corners calculated based on line direction and thickness
400
400
  * @private
401
401
  */
402
- generateLineVertices(e, t, r, i, s, a, n, h) {
402
+ generateLineVertices(e, t, r, i, s, a, o, h) {
403
403
  return new Float32Array([
404
404
  e,
405
405
  t,
@@ -421,7 +421,7 @@ class he {
421
421
  0,
422
422
  1,
423
423
  // corner2 (start - perpendicular)
424
- n,
424
+ o,
425
425
  h,
426
426
  1,
427
427
  1,
@@ -446,8 +446,8 @@ class he {
446
446
  class ce extends Q {
447
447
  constructor(t, r, i, s, a) {
448
448
  super(t, r, i);
449
- o(this, "x2");
450
- o(this, "y2");
449
+ n(this, "x2");
450
+ n(this, "y2");
451
451
  this.x2 = s, this.y2 = a;
452
452
  }
453
453
  /**
@@ -465,13 +465,13 @@ class ce extends Q {
465
465
  new he(this.gl, this.x, this.y, this.x2, this.y2, t).render();
466
466
  }
467
467
  }
468
- class T {
468
+ class y {
469
469
  constructor(e, t, r) {
470
- o(this, "gl");
471
- o(this, "program");
472
- o(this, "uniformLocations", /* @__PURE__ */ new Map());
473
- o(this, "attributeLocations", /* @__PURE__ */ new Map());
474
- o(this, "textureUnitCounter", 0);
470
+ n(this, "gl");
471
+ n(this, "program");
472
+ n(this, "uniformLocations", /* @__PURE__ */ new Map());
473
+ n(this, "attributeLocations", /* @__PURE__ */ new Map());
474
+ n(this, "textureUnitCounter", 0);
475
475
  this.gl = e, this.program = this.createProgram(t, r), this.cacheLocations();
476
476
  }
477
477
  createProgram(e, t) {
@@ -612,26 +612,26 @@ class T {
612
612
  this.textureUnitCounter = 0;
613
613
  }
614
614
  }
615
- var S = "attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_uv;uniform float u_rotation;uniform vec2 u_center;uniform float u_aspectRatio;mat2 rotate2D(float angle){float s=sin(angle);float c=cos(angle);return mat2(c,-s,s,c);}void main(){v_uv=a_texCoord;vec2 pos=a_position;pos-=u_center;pos.x*=u_aspectRatio;pos=rotate2D(-u_rotation)*pos;pos.x/=u_aspectRatio;pos+=u_center;gl_Position=vec4(pos,0.0,1.0);}", ue = "precision lowp float;uniform sampler2D u_texture;varying vec2 v_uv;void main(){gl_FragColor=texture2D(u_texture,v_uv);}", de = "precision lowp float;uniform vec4 u_color;void main(){gl_FragColor=u_color;}";
615
+ var T = "attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_uv;uniform float u_rotation;uniform vec2 u_center;uniform float u_aspectRatio;mat2 rotate2D(float angle){float s=sin(angle);float c=cos(angle);return mat2(c,-s,s,c);}void main(){v_uv=a_texCoord;vec2 pos=a_position;pos-=u_center;pos.x*=u_aspectRatio;pos=rotate2D(-u_rotation)*pos;pos.x/=u_aspectRatio;pos+=u_center;gl_Position=vec4(pos,0.0,1.0);}", ue = "precision lowp float;uniform sampler2D u_texture;varying vec2 v_uv;void main(){gl_FragColor=texture2D(u_texture,v_uv);}", de = "precision lowp float;uniform vec4 u_color;void main(){gl_FragColor=u_color;}";
616
616
  class fe {
617
617
  constructor(e) {
618
- o(this, "gl");
619
- o(this, "imageShader");
620
- o(this, "solidColorShader");
621
- o(this, "currentShader", null);
618
+ n(this, "gl");
619
+ n(this, "imageShader");
620
+ n(this, "solidColorShader");
621
+ n(this, "currentShader", null);
622
622
  // Fill state management - default: white fill enabled
623
- o(this, "currentFillColor", [1, 1, 1, 1]);
624
- o(this, "fillMode", !0);
623
+ n(this, "currentFillColor", [1, 1, 1, 1]);
624
+ n(this, "fillMode", !0);
625
625
  // Stroke state management - default: black stroke enabled, weight 1
626
- o(this, "currentStrokeColor", [0, 0, 0, 1]);
627
- o(this, "currentStrokeWeight", 1);
628
- o(this, "strokeMode", !0);
626
+ n(this, "currentStrokeColor", [0, 0, 0, 1]);
627
+ n(this, "currentStrokeWeight", 1);
628
+ n(this, "strokeMode", !0);
629
629
  // Transformation state management
630
- o(this, "currentRotation", 0);
630
+ n(this, "currentRotation", 0);
631
631
  // in degrees
632
632
  // State stack for push/pop functionality
633
- o(this, "stateStack", []);
634
- this.gl = e, this.imageShader = new T(this.gl, S, ue), this.solidColorShader = new T(this.gl, S, de), this.gl.enable(this.gl.BLEND), this.gl.blendEquation(this.gl.FUNC_ADD), this.gl.blendFunc(this.gl.ONE, this.gl.ONE_MINUS_SRC_ALPHA);
633
+ n(this, "stateStack", []);
634
+ this.gl = e, this.imageShader = new y(this.gl, T, ue), this.solidColorShader = new y(this.gl, T, de), this.gl.enable(this.gl.BLEND), this.gl.blendEquation(this.gl.FUNC_ADD), this.gl.blendFunc(this.gl.ONE, this.gl.ONE_MINUS_SRC_ALPHA);
635
635
  }
636
636
  /**
637
637
  * Set the current shader
@@ -732,7 +732,10 @@ class fe {
732
732
  this.currentShader = null, this.stateStack = [], this.currentRotation = 0, this.fillMode = !0, this.strokeMode = !0, this.currentFillColor = [1, 1, 1, 1], this.currentStrokeColor = [0, 0, 0, 1], this.currentStrokeWeight = 1;
733
733
  }
734
734
  createShader(e, t) {
735
- return new T(this.gl, e, t);
735
+ return new y(this.gl, e, t);
736
+ }
737
+ createFilterShader(e) {
738
+ return new y(this.gl, T, e);
736
739
  }
737
740
  /**
738
741
  * Set a uniform value for the current shader
@@ -754,8 +757,8 @@ class fe {
754
757
  s.renderFill(), this.currentShader = null;
755
758
  return;
756
759
  }
757
- const a = this.solidColorShader, { centerX: n, centerY: h, radians: c, aspectRatio: u } = this.calculateRotationParams(e, t, r, i);
758
- this.fillMode && (this.shader(a), this.setUniform("u_color", this.currentFillColor), this.setUniform("u_rotation", c), this.setUniform("u_center", [n, h]), this.setUniform("u_aspectRatio", u), s.renderFill()), this.strokeMode && (this.shader(a), this.setUniform("u_color", this.currentStrokeColor), this.setUniform("u_rotation", c), this.setUniform("u_center", [n, h]), this.setUniform("u_aspectRatio", u), s.renderStroke(this.currentStrokeWeight)), this.currentShader = null;
760
+ const a = this.solidColorShader, { centerX: o, centerY: h, radians: c, aspectRatio: u } = this.calculateRotationParams(e, t, r, i);
761
+ this.fillMode && (this.shader(a), this.setUniform("u_color", this.currentFillColor), this.setUniform("u_rotation", c), this.setUniform("u_center", [o, h]), this.setUniform("u_aspectRatio", u), s.renderFill()), this.strokeMode && (this.shader(a), this.setUniform("u_color", this.currentStrokeColor), this.setUniform("u_rotation", c), this.setUniform("u_center", [o, h]), this.setUniform("u_aspectRatio", u), s.renderStroke(this.currentStrokeWeight)), this.currentShader = null;
759
762
  }
760
763
  /**
761
764
  * Draw a line from (x1, y1) to (x2, y2) with the current stroke settings.
@@ -770,23 +773,23 @@ class fe {
770
773
  const s = new ce(this.gl, e, t, r, i);
771
774
  if (this.currentShader !== null) {
772
775
  if (this.currentRotation !== 0) {
773
- const p = (e + r) / 2, b = (t + i) / 2, C = Math.abs(r - e), v = Math.abs(i - t), { centerX: w, centerY: A, radians: R, aspectRatio: y } = this.calculateRotationParams(p - C / 2, b - v / 2, C, v);
774
- this.setUniform("u_rotation", R), this.setUniform("u_center", [w, A]), this.setUniform("u_aspectRatio", y);
776
+ const p = (e + r) / 2, b = (t + i) / 2, C = Math.abs(r - e), v = Math.abs(i - t), { centerX: w, centerY: A, radians: R, aspectRatio: S } = this.calculateRotationParams(p - C / 2, b - v / 2, C, v);
777
+ this.setUniform("u_rotation", R), this.setUniform("u_center", [w, A]), this.setUniform("u_aspectRatio", S);
775
778
  } else
776
779
  this.setUniform("u_rotation", 0), this.setUniform("u_center", [0, 0]), this.setUniform("u_aspectRatio", 1);
777
780
  s.renderStroke(this.currentStrokeWeight), this.currentShader = null;
778
781
  return;
779
782
  }
780
- const a = this.solidColorShader, n = (e + r) / 2, h = (t + i) / 2, c = Math.abs(r - e), u = Math.abs(i - t), { centerX: d, centerY: f, radians: g, aspectRatio: _ } = this.calculateRotationParams(n - c / 2, h - u / 2, c, u);
783
+ const a = this.solidColorShader, o = (e + r) / 2, h = (t + i) / 2, c = Math.abs(r - e), u = Math.abs(i - t), { centerX: d, centerY: f, radians: g, aspectRatio: _ } = this.calculateRotationParams(o - c / 2, h - u / 2, c, u);
781
784
  this.shader(a), this.setUniform("u_color", this.currentStrokeColor), this.setUniform("u_rotation", g), this.setUniform("u_center", [d, f]), this.setUniform("u_aspectRatio", _), s.renderStroke(this.currentStrokeWeight), this.currentShader = null;
782
785
  }
783
786
  /**
784
787
  * Calculate rotation parameters for built-in shaders (NDC coordinates)
785
788
  */
786
789
  calculateRotationParams(e, t, r, i) {
787
- const s = this.gl.getParameter(this.gl.VIEWPORT), a = s[2], n = s[3], h = a / n, c = this.gl.getParameter(this.gl.FRAMEBUFFER_BINDING) !== null, u = e + r / 2, d = t + i / 2, f = u / a * 2 - 1;
790
+ const s = this.gl.getParameter(this.gl.VIEWPORT), a = s[2], o = s[3], h = a / o, c = this.gl.getParameter(this.gl.FRAMEBUFFER_BINDING) !== null, u = e + r / 2, d = t + i / 2, f = u / a * 2 - 1;
788
791
  let g;
789
- c ? g = d / n * 2 - 1 : g = 1 - d / n * 2;
792
+ c ? g = d / o * 2 - 1 : g = 1 - d / o * 2;
790
793
  const _ = this.currentRotation * Math.PI / 180;
791
794
  return { centerX: f, centerY: g, radians: _, aspectRatio: h };
792
795
  }
@@ -794,7 +797,7 @@ class fe {
794
797
  * Create a new framebuffer
795
798
  */
796
799
  createFramebuffer(e, t, r = {}) {
797
- return new oe(this.gl, e, t, r);
800
+ return new ne(this.gl, e, t, r);
798
801
  }
799
802
  /**
800
803
  * Fill the current framebuffer with a solid color
@@ -832,18 +835,18 @@ class fe {
832
835
  */
833
836
  image(e, t, r, i, s) {
834
837
  this.shader(this.imageShader), this.setUniform("u_texture", e.texture);
835
- const { centerX: a, centerY: n, radians: h, aspectRatio: c } = this.calculateRotationParams(
838
+ const { centerX: a, centerY: o, radians: h, aspectRatio: c } = this.calculateRotationParams(
836
839
  t,
837
840
  r,
838
841
  i ?? e.width,
839
842
  s ?? e.height
840
843
  );
841
- this.setUniform("u_rotation", h), this.setUniform("u_center", [a, n]), this.setUniform("u_aspectRatio", c), this.rect(t, r, i ?? e.width, s ?? e.height);
844
+ this.setUniform("u_rotation", h), this.setUniform("u_center", [a, o]), this.setUniform("u_aspectRatio", c), this.rect(t, r, i ?? e.width, s ?? e.height);
842
845
  }
843
846
  }
844
847
  var m = {};
845
848
  m.parse = function(l) {
846
- var e = function(s, a, n, h) {
849
+ var e = function(s, a, o, h) {
847
850
  var c = m.T, u = {
848
851
  cmap: c.cmap,
849
852
  head: c.head,
@@ -852,9 +855,9 @@ m.parse = function(l) {
852
855
  hmtx: c.hmtx,
853
856
  loca: c.loca,
854
857
  glyf: c.glyf
855
- }, d = { _data: s, _index: a, _offset: n };
858
+ }, d = { _data: s, _index: a, _offset: o };
856
859
  for (var f in u) {
857
- var g = m.findTable(s, f, n);
860
+ var g = m.findTable(s, f, o);
858
861
  if (g) {
859
862
  var _ = g[0], p = h[_];
860
863
  p == null && (p = u[f].parseTab(s, _, g[1], d)), d[f] = h[_] = p;
@@ -866,10 +869,10 @@ m.parse = function(l) {
866
869
  };
867
870
  m.findTable = function(l, e, t) {
868
871
  for (var r = m.B, i = r.readUshort(l, t + 4), s = t + 12, a = 0; a < i; a++) {
869
- var n = r.readASCII(l, s, 4);
872
+ var o = r.readASCII(l, s, 4);
870
873
  r.readUint(l, s + 4);
871
874
  var h = r.readUint(l, s + 8), c = r.readUint(l, s + 12);
872
- if (n == e) return [h, c];
875
+ if (o == e) return [h, c];
873
876
  s += 16;
874
877
  }
875
878
  return null;
@@ -913,9 +916,9 @@ m.T.cmap = {
913
916
  l = new Uint8Array(l.buffer, e, t), e = 0;
914
917
  var i = m.B, s = i.readUshort, a = m.T.cmap;
915
918
  s(l, e), e += 2;
916
- var n = s(l, e);
919
+ var o = s(l, e);
917
920
  e += 2;
918
- for (var h = [], c = 0; c < n; c++) {
921
+ for (var h = [], c = 0; c < o; c++) {
919
922
  var u = s(l, e);
920
923
  e += 2;
921
924
  var d = s(l, e);
@@ -937,7 +940,7 @@ m.T.cmap = {
937
940
  parse4: function(l, e, t) {
938
941
  var r = m.B, i = r.readUshort, s = r.readUshorts, a = e;
939
942
  e += 2;
940
- var n = i(l, e);
943
+ var o = i(l, e);
941
944
  e += 2, i(l, e), e += 2;
942
945
  var h = i(l, e);
943
946
  e += 2;
@@ -945,15 +948,15 @@ m.T.cmap = {
945
948
  t.searchRange = i(l, e), e += 2, t.entrySelector = i(l, e), e += 2, t.rangeShift = i(l, e), e += 2, t.endCount = s(l, e, c), e += c * 2, e += 2, t.startCount = s(l, e, c), e += c * 2, t.idDelta = [];
946
949
  for (var u = 0; u < c; u++)
947
950
  t.idDelta.push(r.readShort(l, e)), e += 2;
948
- return t.idRangeOffset = s(l, e, c), e += c * 2, t.glyphIdArray = s(l, e, a + n - e >> 1), t;
951
+ return t.idRangeOffset = s(l, e, c), e += c * 2, t.glyphIdArray = s(l, e, a + o - e >> 1), t;
949
952
  },
950
953
  parse12: function(l, e, t) {
951
954
  var r = m.B, i = r.readUint;
952
955
  e += 4, i(l, e), e += 4, i(l, e), e += 4;
953
956
  var s = i(l, e) * 3;
954
957
  e += 4;
955
- for (var a = t.groups = new Uint32Array(s), n = 0; n < s; n += 3)
956
- a[n] = i(l, e + (n << 2)), a[n + 1] = i(l, e + (n << 2) + 4), a[n + 2] = i(l, e + (n << 2) + 8);
958
+ for (var a = t.groups = new Uint32Array(s), o = 0; o < s; o += 3)
959
+ a[o] = i(l, e + (o << 2)), a[o + 1] = i(l, e + (o << 2) + 4), a[o + 2] = i(l, e + (o << 2) + 8);
957
960
  return t;
958
961
  }
959
962
  };
@@ -985,17 +988,17 @@ m.T.hhea = {
985
988
  "metricDataFormat",
986
989
  "numberOfHMetrics"
987
990
  ], a = 0; a < s.length; a++) {
988
- var n = s[a], h = n == "advanceWidthMax" || n == "numberOfHMetrics" ? r.readUshort : r.readShort;
989
- i[n] = h(l, e + a * 2);
991
+ var o = s[a], h = o == "advanceWidthMax" || o == "numberOfHMetrics" ? r.readUshort : r.readShort;
992
+ i[o] = h(l, e + a * 2);
990
993
  }
991
994
  return i;
992
995
  }
993
996
  };
994
997
  m.T.hmtx = {
995
998
  parseTab: function(l, e, t, r) {
996
- for (var i = m.B, s = [], a = [], n = r.maxp.numGlyphs, h = r.hhea.numberOfHMetrics, c = 0, u = 0, d = 0; d < h; )
999
+ for (var i = m.B, s = [], a = [], o = r.maxp.numGlyphs, h = r.hhea.numberOfHMetrics, c = 0, u = 0, d = 0; d < h; )
997
1000
  c = i.readUshort(l, e + (d << 2)), u = i.readShort(l, e + (d << 2) + 2), s.push(c), a.push(u), d++;
998
- for (; d < n; )
1001
+ for (; d < o; )
999
1002
  s.push(c), a.push(u), d++;
1000
1003
  return { aWidth: s, lsBearing: a };
1001
1004
  }
@@ -1008,9 +1011,9 @@ m.T.maxp = {
1008
1011
  };
1009
1012
  m.T.loca = {
1010
1013
  parseTab: function(l, e, t, r) {
1011
- var i = m.B, s = [], a = r.head.indexToLocFormat, n = r.maxp.numGlyphs + 1;
1012
- if (a == 0) for (var h = 0; h < n; h++) s.push(i.readUshort(l, e + (h << 1)) << 1);
1013
- if (a == 1) for (var h = 0; h < n; h++) s.push(i.readUint(l, e + (h << 2)));
1014
+ var i = m.B, s = [], a = r.head.indexToLocFormat, o = r.maxp.numGlyphs + 1;
1015
+ if (a == 0) for (var h = 0; h < o; h++) s.push(i.readUshort(l, e + (h << 1)) << 1);
1016
+ if (a == 1) for (var h = 0; h < o; h++) s.push(i.readUint(l, e + (h << 2)));
1014
1017
  return s;
1015
1018
  }
1016
1019
  };
@@ -1026,34 +1029,34 @@ m.T.glyf = {
1026
1029
  if (a.noc = t.readShort(r, s), s += 2, a.xMin = t.readShort(r, s), s += 2, a.yMin = t.readShort(r, s), s += 2, a.xMax = t.readShort(r, s), s += 2, a.yMax = t.readShort(r, s), s += 2, a.xMin >= a.xMax || a.yMin >= a.yMax) return null;
1027
1030
  if (a.noc > 0) {
1028
1031
  a.endPts = [];
1029
- for (var n = 0; n < a.noc; n++)
1032
+ for (var o = 0; o < a.noc; o++)
1030
1033
  a.endPts.push(t.readUshort(r, s)), s += 2;
1031
1034
  var h = t.readUshort(r, s);
1032
1035
  if (s += 2, r.length - s < h) return null;
1033
1036
  s += h;
1034
1037
  var c = a.endPts[a.noc - 1] + 1;
1035
1038
  a.flags = [];
1036
- for (var n = 0; n < c; n++) {
1039
+ for (var o = 0; o < c; o++) {
1037
1040
  var u = r[s];
1038
1041
  if (s++, a.flags.push(u), u & 8) {
1039
1042
  var d = r[s];
1040
1043
  s++;
1041
1044
  for (var f = 0; f < d; f++)
1042
- a.flags.push(u), n++;
1045
+ a.flags.push(u), o++;
1043
1046
  }
1044
1047
  }
1045
1048
  a.xs = [];
1046
- for (var n = 0; n < c; n++) {
1047
- var g = (a.flags[n] & 2) != 0, _ = (a.flags[n] & 16) != 0;
1049
+ for (var o = 0; o < c; o++) {
1050
+ var g = (a.flags[o] & 2) != 0, _ = (a.flags[o] & 16) != 0;
1048
1051
  g ? (a.xs.push(_ ? r[s] : -r[s]), s++) : _ ? a.xs.push(0) : (a.xs.push(t.readShort(r, s)), s += 2);
1049
1052
  }
1050
1053
  a.ys = [];
1051
- for (var n = 0; n < c; n++) {
1052
- var g = (a.flags[n] & 4) != 0, _ = (a.flags[n] & 32) != 0;
1054
+ for (var o = 0; o < c; o++) {
1055
+ var g = (a.flags[o] & 4) != 0, _ = (a.flags[o] & 32) != 0;
1053
1056
  g ? (a.ys.push(_ ? r[s] : -r[s]), s++) : _ ? a.ys.push(0) : (a.ys.push(t.readShort(r, s)), s += 2);
1054
1057
  }
1055
- for (var p = 0, b = 0, n = 0; n < c; n++)
1056
- p += a.xs[n], b += a.ys[n], a.xs[n] = p, a.ys[n] = b;
1058
+ for (var p = 0, b = 0, o = 0; o < c; o++)
1059
+ p += a.xs[o], b += a.ys[o], a.xs[o] = p, a.ys[o] = b;
1057
1060
  } else
1058
1061
  a.parts = [];
1059
1062
  return a;
@@ -1111,9 +1114,9 @@ class me {
1111
1114
  return t;
1112
1115
  for (let r = 0; r < e.groups.length; r += 3) {
1113
1116
  const i = e.groups[r], s = e.groups[r + 1], a = e.groups[r + 2];
1114
- for (let n = i; n <= s; n++)
1115
- if (a + (n - i) > 0) {
1116
- const c = String.fromCodePoint(n);
1117
+ for (let o = i; o <= s; o++)
1118
+ if (a + (o - i) > 0) {
1119
+ const c = String.fromCodePoint(o);
1117
1120
  t.push(c);
1118
1121
  }
1119
1122
  }
@@ -1163,9 +1166,9 @@ class ge {
1163
1166
  * @param renderer The WebGL renderer instance
1164
1167
  */
1165
1168
  constructor(e) {
1166
- o(this, "_textureCanvas");
1167
- o(this, "_textureContext");
1168
- o(this, "_renderer");
1169
+ n(this, "_textureCanvas");
1170
+ n(this, "_textureContext");
1171
+ n(this, "_renderer");
1169
1172
  this._renderer = e, this._textureCanvas = document.createElement("canvas"), this._textureContext = this._textureCanvas.getContext("2d", { willReadFrequently: !0, alpha: !1 });
1170
1173
  }
1171
1174
  /**
@@ -1177,13 +1180,13 @@ class ge {
1177
1180
  * @returns Object containing framebuffer, columns, and rows
1178
1181
  */
1179
1182
  createTextureAtlas(e, t, r, i) {
1180
- const s = e.length, a = Math.ceil(Math.sqrt(s)), n = Math.ceil(s / a), h = t.width * a, c = t.height * n;
1183
+ const s = e.length, a = Math.ceil(Math.sqrt(s)), o = Math.ceil(s / a), h = t.width * a, c = t.height * o;
1181
1184
  this._setupCanvas(h, c, r, i), this._renderCharactersToCanvas(e, t, a, r), this._applyBlackWhiteThreshold();
1182
1185
  const u = this._renderer.createFramebuffer(h, c, { filter: "nearest" });
1183
1186
  return u.update(this._textureCanvas), {
1184
1187
  framebuffer: u,
1185
1188
  columns: a,
1186
- rows: n
1189
+ rows: o
1187
1190
  };
1188
1191
  }
1189
1192
  /**
@@ -1207,7 +1210,7 @@ class ge {
1207
1210
  */
1208
1211
  _renderCharactersToCanvas(e, t, r, i) {
1209
1212
  for (let s = 0; s < e.length; s++) {
1210
- const a = s % r, n = Math.floor(s / r), h = a * t.width + t.width * 0.5, c = n * t.height + t.height * 0.5, u = Math.round(h - t.width * 0.5), d = Math.round(c - i * 0.5);
1213
+ const a = s % r, o = Math.floor(s / r), h = a * t.width + t.width * 0.5, c = o * t.height + t.height * 0.5, u = Math.round(h - t.width * 0.5), d = Math.round(c - i * 0.5);
1211
1214
  this._textureContext.fillText(e[s].character, u, d);
1212
1215
  }
1213
1216
  }
@@ -1220,8 +1223,8 @@ class ge {
1220
1223
  _applyBlackWhiteThreshold(e = 128) {
1221
1224
  const t = this._textureContext.getImageData(0, 0, this._textureCanvas.width, this._textureCanvas.height), r = t.data;
1222
1225
  for (let i = 0; i < r.length; i += 4) {
1223
- const s = 0.299 * r[i] + 0.587 * r[i + 1] + 0.114 * r[i + 2], a = e + 32, n = s > a ? 255 : 0;
1224
- r[i] = n, r[i + 1] = n, r[i + 2] = n;
1226
+ const s = 0.299 * r[i] + 0.587 * r[i + 1] + 0.114 * r[i + 2], a = e + 32, o = s > a ? 255 : 0;
1227
+ r[i] = o, r[i + 1] = o, r[i + 2] = o;
1225
1228
  }
1226
1229
  this._textureContext.putImageData(t, 0, 0);
1227
1230
  }
@@ -1231,8 +1234,8 @@ class pe {
1231
1234
  * Creates a new MetricsCalculation instance.
1232
1235
  */
1233
1236
  constructor() {
1234
- o(this, "_tempCanvas");
1235
- o(this, "_tempContext");
1237
+ n(this, "_tempCanvas");
1238
+ n(this, "_tempContext");
1236
1239
  this._tempCanvas = document.createElement("canvas"), this._tempContext = this._tempCanvas.getContext("2d");
1237
1240
  }
1238
1241
  /**
@@ -1247,7 +1250,7 @@ class pe {
1247
1250
  this._tempContext.font = `${t}px ${r}`;
1248
1251
  let i = 0, s = 0;
1249
1252
  for (const a of e) {
1250
- const n = this._tempContext.measureText(a), h = n.width, c = n.actualBoundingBoxAscent + n.actualBoundingBoxDescent;
1253
+ const o = this._tempContext.measureText(a), h = o.width, c = o.actualBoundingBoxAscent + o.actualBoundingBoxDescent;
1251
1254
  h > 0 && (i = Math.max(i, h), s = Math.max(s, c));
1252
1255
  }
1253
1256
  return {
@@ -1266,16 +1269,16 @@ class _e {
1266
1269
  createCharacterObjects(e, t) {
1267
1270
  return e.map((r, i) => {
1268
1271
  const s = r.codePointAt(0) || 0, a = this._generateCharacterColor(i);
1269
- let n = 0;
1272
+ let o = 0;
1270
1273
  if (t.hmtx && t.hmtx.aWidth) {
1271
1274
  const h = this._getGlyphIndex(t, s);
1272
- h > 0 && t.hmtx.aWidth[h] !== void 0 && (n = t.hmtx.aWidth[h]);
1275
+ h > 0 && t.hmtx.aWidth[h] !== void 0 && (o = t.hmtx.aWidth[h]);
1273
1276
  }
1274
1277
  return {
1275
1278
  character: r,
1276
1279
  unicode: s,
1277
1280
  color: a,
1278
- advanceWidth: n
1281
+ advanceWidth: o
1279
1282
  };
1280
1283
  });
1281
1284
  }
@@ -1298,9 +1301,9 @@ class _e {
1298
1301
  {
1299
1302
  const a = i.idRangeOffset[s] / 2 + (t - i.startCount[s]) - (i.startCount.length - s);
1300
1303
  if (a >= 0 && a < i.glyphIdArray.length) {
1301
- const n = i.glyphIdArray[a];
1302
- if (n !== 0)
1303
- return n + i.idDelta[s] & 65535;
1304
+ const o = i.glyphIdArray[a];
1305
+ if (o !== 0)
1306
+ return o + i.idDelta[s] & 65535;
1304
1307
  }
1305
1308
  }
1306
1309
  }
@@ -1354,20 +1357,20 @@ class xe {
1354
1357
  * @ignore
1355
1358
  */
1356
1359
  constructor(e, t = 16) {
1357
- o(this, "_font");
1358
- o(this, "_characters", []);
1359
- o(this, "_fontFramebuffer");
1360
- o(this, "_fontSize", 16);
1361
- o(this, "_textureColumns", 0);
1362
- o(this, "_textureRows", 0);
1363
- o(this, "_maxGlyphDimensions", { width: 0, height: 0 });
1364
- o(this, "_fontFace");
1365
- o(this, "_fontFamilyName", "UrsaFont");
1360
+ n(this, "_font");
1361
+ n(this, "_characters", []);
1362
+ n(this, "_fontFramebuffer");
1363
+ n(this, "_fontSize", 16);
1364
+ n(this, "_textureColumns", 0);
1365
+ n(this, "_textureRows", 0);
1366
+ n(this, "_maxGlyphDimensions", { width: 0, height: 0 });
1367
+ n(this, "_fontFace");
1368
+ n(this, "_fontFamilyName", "UrsaFont");
1366
1369
  // Component classes
1367
- o(this, "_characterExtractor");
1368
- o(this, "_textureAtlas");
1369
- o(this, "_metricsCalculator");
1370
- o(this, "_characterColorMapper");
1370
+ n(this, "_characterExtractor");
1371
+ n(this, "_textureAtlas");
1372
+ n(this, "_metricsCalculator");
1373
+ n(this, "_characterColorMapper");
1371
1374
  this._fontSize = t, this._characterExtractor = new me(), this._textureAtlas = new ge(e), this._metricsCalculator = new pe(), this._characterColorMapper = new _e();
1372
1375
  }
1373
1376
  /**
@@ -1532,25 +1535,25 @@ class ve {
1532
1535
  */
1533
1536
  constructor(e, t, r) {
1534
1537
  /** The number of columns in the grid. */
1535
- o(this, "_cols");
1538
+ n(this, "_cols");
1536
1539
  /** The number of rows in the grid. */
1537
- o(this, "_rows");
1540
+ n(this, "_rows");
1538
1541
  /** The total width of the grid in pixels. */
1539
- o(this, "_width");
1542
+ n(this, "_width");
1540
1543
  /** The total height of the grid in pixels. */
1541
- o(this, "_height");
1544
+ n(this, "_height");
1542
1545
  /** The offset to the outer canvas on the x-axis when centering the grid. */
1543
- o(this, "_offsetX");
1546
+ n(this, "_offsetX");
1544
1547
  /** The offset to the outer canvas on the y-axis when centering the grid. */
1545
- o(this, "_offsetY");
1548
+ n(this, "_offsetY");
1546
1549
  /** Whether the grid dimensions are fixed, or responsive based on the canvas dimensions. */
1547
- o(this, "_fixedDimensions", !1);
1550
+ n(this, "_fixedDimensions", !1);
1548
1551
  /** The canvas element used to determine the grid dimensions. */
1549
- o(this, "_canvas");
1552
+ n(this, "_canvas");
1550
1553
  /** The width of each cell in the grid. */
1551
- o(this, "_cellWidth");
1554
+ n(this, "_cellWidth");
1552
1555
  /** The height of each cell in the grid. */
1553
- o(this, "_cellHeight");
1556
+ n(this, "_cellHeight");
1554
1557
  this._canvas = e, this._cellWidth = t, this._cellHeight = r, this.reset();
1555
1558
  }
1556
1559
  /**
@@ -1661,9 +1664,9 @@ class ve {
1661
1664
  }
1662
1665
  class be {
1663
1666
  constructor(e, t = !1, r = {}) {
1664
- o(this, "_canvas");
1665
- o(this, "captureSource");
1666
- o(this, "_isStandalone");
1667
+ n(this, "_canvas");
1668
+ n(this, "captureSource");
1669
+ n(this, "_isStandalone");
1667
1670
  this.captureSource = e, this._isStandalone = t, this._canvas = this.createCanvas(r.width, r.height);
1668
1671
  }
1669
1672
  createCanvas(e, t) {
@@ -1673,12 +1676,12 @@ class be {
1673
1676
  r.width = e || 800, r.height = t || 600, document.body.appendChild(r);
1674
1677
  else {
1675
1678
  const s = this.captureSource.getBoundingClientRect();
1676
- let a = Math.round(s.width), n = Math.round(s.height);
1679
+ let a = Math.round(s.width), o = Math.round(s.height);
1677
1680
  if (this.captureSource instanceof HTMLVideoElement) {
1678
1681
  const u = this.captureSource;
1679
- (a === 0 || n === 0) && u.videoWidth > 0 && u.videoHeight > 0 && (a = u.videoWidth, n = u.videoHeight);
1682
+ (a === 0 || o === 0) && u.videoWidth > 0 && u.videoHeight > 0 && (a = u.videoWidth, o = u.videoHeight);
1680
1683
  }
1681
- r.width = a, r.height = n, r.style.position = "absolute", r.style.pointerEvents = "none";
1684
+ r.width = a, r.height = o, r.style.position = "absolute", r.style.pointerEvents = "none";
1682
1685
  const h = window.getComputedStyle(this.captureSource);
1683
1686
  let c = parseInt(h.zIndex || "0", 10);
1684
1687
  isNaN(c) && (c = 0), r.style.zIndex = (c + 1).toString(), this.positionOverlayCanvas(r), (i = this.captureSource.parentNode) == null || i.insertBefore(r, this.captureSource.nextSibling);
@@ -1759,15 +1762,15 @@ class U {
1759
1762
  * @ignore
1760
1763
  */
1761
1764
  constructor(e, t, r, i = {}) {
1762
- o(this, "renderer");
1763
- o(this, "fontManager");
1764
- o(this, "grid");
1765
- o(this, "_characterFramebuffer");
1766
- o(this, "_primaryColorFramebuffer");
1767
- o(this, "_secondaryColorFramebuffer");
1768
- o(this, "_rotationFramebuffer");
1769
- o(this, "_transformFramebuffer");
1770
- o(this, "_options");
1765
+ n(this, "renderer");
1766
+ n(this, "fontManager");
1767
+ n(this, "grid");
1768
+ n(this, "_characterFramebuffer");
1769
+ n(this, "_primaryColorFramebuffer");
1770
+ n(this, "_secondaryColorFramebuffer");
1771
+ n(this, "_rotationFramebuffer");
1772
+ n(this, "_transformFramebuffer");
1773
+ n(this, "_options");
1771
1774
  this.renderer = e, this.fontManager = t, this.grid = r, this._options = i, this._characterFramebuffer = this.renderer.createFramebuffer(this.grid.cols, this.grid.rows), this._primaryColorFramebuffer = this.renderer.createFramebuffer(this.grid.cols, this.grid.rows), this._secondaryColorFramebuffer = this.renderer.createFramebuffer(this.grid.cols, this.grid.rows), this._rotationFramebuffer = this.renderer.createFramebuffer(this.grid.cols, this.grid.rows), this._transformFramebuffer = this.renderer.createFramebuffer(this.grid.cols, this.grid.rows);
1772
1775
  }
1773
1776
  /**
@@ -1836,9 +1839,9 @@ class Ce {
1836
1839
  */
1837
1840
  constructor(e, t) {
1838
1841
  /** The framebuffer used to store the color palette. */
1839
- o(this, "_framebuffer");
1840
- o(this, "_renderer");
1841
- o(this, "_colors");
1842
+ n(this, "_framebuffer");
1843
+ n(this, "_renderer");
1844
+ n(this, "_colors");
1842
1845
  this._renderer = e, this._colors = t;
1843
1846
  const r = Math.max(this._colors.length, 1);
1844
1847
  this._framebuffer = this._renderer.createFramebuffer(r, 1), this._updateFramebuffer();
@@ -1886,7 +1889,7 @@ class Ce {
1886
1889
  class H extends U {
1887
1890
  constructor(t, r, i, s = {}) {
1888
1891
  super(t, r, i, s);
1889
- o(this, "palette");
1892
+ n(this, "palette");
1890
1893
  this.palette = new Ce(this.renderer, this.fontManager.getCharacterColors(" .:-=+*%@#"));
1891
1894
  }
1892
1895
  /**
@@ -1909,7 +1912,7 @@ class H extends U {
1909
1912
  * @param a Alpha component (0-255).
1910
1913
  */
1911
1914
  characterColor(t, r, i, s = 255) {
1912
- let a, n, h, c;
1915
+ let a, o, h, c;
1913
1916
  if (typeof t == "string") {
1914
1917
  const u = this.parseHexColor(t);
1915
1918
  if (!u) {
@@ -1920,14 +1923,14 @@ class H extends U {
1920
1923
  );
1921
1924
  return;
1922
1925
  }
1923
- [a, n, h, c] = u;
1924
- } else if (a = t, n = r !== void 0 ? r : t, h = i !== void 0 ? i : t, c = s, !x.validate(
1925
- [a, n, h, c].every((u) => u >= 0 && u <= 255),
1926
+ [a, o, h, c] = u;
1927
+ } else if (a = t, o = r !== void 0 ? r : t, h = i !== void 0 ? i : t, c = s, !x.validate(
1928
+ [a, o, h, c].every((u) => u >= 0 && u <= 255),
1926
1929
  "Character color values must be between 0 and 255",
1927
- { method: "characterColor", providedValues: { r: a, g: n, b: h, a: c } }
1930
+ { method: "characterColor", providedValues: { r: a, g: o, b: h, a: c } }
1928
1931
  ))
1929
1932
  return;
1930
- this._options.characterColor = [a, n, h, c];
1933
+ this._options.characterColor = [a, o, h, c];
1931
1934
  }
1932
1935
  /**
1933
1936
  * Sets the character color mode.
@@ -1951,7 +1954,7 @@ class H extends U {
1951
1954
  * @param a Alpha component (0-255).
1952
1955
  */
1953
1956
  cellColor(t, r, i, s = 255) {
1954
- let a, n, h, c;
1957
+ let a, o, h, c;
1955
1958
  if (typeof t == "string") {
1956
1959
  const u = this.parseHexColor(t);
1957
1960
  if (!u) {
@@ -1962,14 +1965,14 @@ class H extends U {
1962
1965
  );
1963
1966
  return;
1964
1967
  }
1965
- [a, n, h, c] = u;
1966
- } else if (a = t, n = r !== void 0 ? r : t, h = i !== void 0 ? i : t, c = s, !x.validate(
1967
- [a, n, h, c].every((u) => u >= 0 && u <= 255),
1968
+ [a, o, h, c] = u;
1969
+ } else if (a = t, o = r !== void 0 ? r : t, h = i !== void 0 ? i : t, c = s, !x.validate(
1970
+ [a, o, h, c].every((u) => u >= 0 && u <= 255),
1968
1971
  "Cell color values must be between 0 and 255",
1969
- { method: "cellColor", providedValues: { r: a, g: n, b: h, a: c } }
1972
+ { method: "cellColor", providedValues: { r: a, g: o, b: h, a: c } }
1970
1973
  ))
1971
1974
  return;
1972
- this._options.cellColor = [a, n, h, c];
1975
+ this._options.cellColor = [a, o, h, c];
1973
1976
  }
1974
1977
  /**
1975
1978
  * Sets the cell color mode.
@@ -2080,16 +2083,16 @@ class L extends H {
2080
2083
  */
2081
2084
  constructor(t, r, i) {
2082
2085
  super(t, r, i, { ...Re });
2083
- o(this, "sampleShader");
2084
- o(this, "colorFillShader");
2085
- o(this, "charMappingShader");
2086
- o(this, "transformFillShader");
2087
- o(this, "rotationFillShader");
2088
- o(this, "sampleFramebuffer");
2089
- this.sampleShader = new T(t.context, S, Fe), this.colorFillShader = new T(t.context, S, we), this.transformFillShader = new T(t.context, S, ye), this.rotationFillShader = new T(t.context, S, Te), this.charMappingShader = new T(t.context, S, Se), this.sampleFramebuffer = this.renderer.createFramebuffer(this.grid.cols, this.grid.rows);
2086
+ n(this, "sampleShader");
2087
+ n(this, "colorFillShader");
2088
+ n(this, "charMappingShader");
2089
+ n(this, "transformFillShader");
2090
+ n(this, "rotationFillShader");
2091
+ n(this, "sampleFramebuffer");
2092
+ this.sampleShader = new y(t.context, T, Fe), this.colorFillShader = new y(t.context, T, we), this.transformFillShader = new y(t.context, T, ye), this.rotationFillShader = new y(t.context, T, Te), this.charMappingShader = new y(t.context, T, Se), this.sampleFramebuffer = this.renderer.createFramebuffer(this.grid.cols, this.grid.rows);
2090
2093
  }
2091
2094
  convert(t) {
2092
- this.sampleFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.sampleShader), this.renderer.setUniform("u_sketchTexture", t), this.renderer.setUniform("u_gridCellDimensions", [this.grid.cols, this.grid.rows]), this.renderer.setUniform("u_brightnessRange", this._options.brightnessRange), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this.sampleFramebuffer.end(), this._primaryColorFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.colorFillShader), this.renderer.setUniform("u_sampleTexture", this.sampleFramebuffer.texture), this.renderer.setUniform("u_fillColor", this._options.characterColor), this.renderer.setUniform("u_useFixedColor", this._options.characterColorMode === "fixed"), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._primaryColorFramebuffer.end(), this._secondaryColorFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.colorFillShader), this.renderer.setUniform("u_sampleTexture", this.sampleFramebuffer.texture), this.renderer.setUniform("u_fillColor", this._options.cellColor), this.renderer.setUniform("u_useFixedColor", this._options.cellColorMode === "fixed"), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._secondaryColorFramebuffer.end(), this._transformFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.transformFillShader), this.renderer.setUniform("u_sampleTexture", this.sampleFramebuffer.texture), this.renderer.setUniform("u_invert", this._options.invert), this.renderer.setUniform("u_flipHorizontally", this._options.flipHorizontally), this.renderer.setUniform("u_flipVertically", this._options.flipVertically), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._transformFramebuffer.end(), this._rotationFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.rotationFillShader), this.renderer.setUniform("u_sampleTexture", this.sampleFramebuffer.texture), this.renderer.setUniform("u_rotationColor", this._options.rotation), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._rotationFramebuffer.end(), this._characterFramebuffer.begin(), this.renderer.clear(0, 0, 0, 0), this.renderer.shader(this.charMappingShader), this.renderer.setUniform("u_colorSampleFramebuffer", this.sampleFramebuffer.texture), this.renderer.setUniform("u_charPaletteTexture", this.palette.texture), this.renderer.setUniform("u_charPaletteSize", [this.palette.colors.length, 1]), this.renderer.setUniform("u_brightnessRange", this._options.brightnessRange), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._characterFramebuffer.end();
2095
+ this.sampleFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.sampleShader), this.renderer.setUniform("u_sketchTexture", t), this.renderer.setUniform("u_gridCellDimensions", [this.grid.cols, this.grid.rows]), this.renderer.setUniform("u_brightnessRange", this._options.brightnessRange), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this.sampleFramebuffer.end(), console.log("this.options.characterColor:", this._options.characterColor), this._primaryColorFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.colorFillShader), this.renderer.setUniform("u_sampleTexture", this.sampleFramebuffer.texture), this.renderer.setUniform("u_fillColor", this._options.characterColor), this.renderer.setUniform("u_useFixedColor", this._options.characterColorMode === "fixed"), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._primaryColorFramebuffer.end(), this._secondaryColorFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.colorFillShader), this.renderer.setUniform("u_sampleTexture", this.sampleFramebuffer.texture), this.renderer.setUniform("u_fillColor", this._options.cellColor), this.renderer.setUniform("u_useFixedColor", this._options.cellColorMode === "fixed"), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._secondaryColorFramebuffer.end(), this._transformFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.transformFillShader), this.renderer.setUniform("u_sampleTexture", this.sampleFramebuffer.texture), this.renderer.setUniform("u_invert", this._options.invert), this.renderer.setUniform("u_flipHorizontally", this._options.flipHorizontally), this.renderer.setUniform("u_flipVertically", this._options.flipVertically), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._transformFramebuffer.end(), this._rotationFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.rotationFillShader), this.renderer.setUniform("u_sampleTexture", this.sampleFramebuffer.texture), this.renderer.setUniform("u_rotationColor", this._options.rotation), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._rotationFramebuffer.end(), this._characterFramebuffer.begin(), this.renderer.clear(0, 0, 0, 0), this.renderer.shader(this.charMappingShader), this.renderer.setUniform("u_colorSampleFramebuffer", this.sampleFramebuffer.texture), this.renderer.setUniform("u_charPaletteTexture", this.palette.texture), this.renderer.setUniform("u_charPaletteSize", [this.palette.colors.length, 1]), this.renderer.setUniform("u_brightnessRange", this._options.brightnessRange), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._characterFramebuffer.end();
2093
2096
  }
2094
2097
  resize() {
2095
2098
  super.resize(), this.sampleFramebuffer.resize(this.grid.cols, this.grid.rows);
@@ -2125,18 +2128,18 @@ class Ue {
2125
2128
  * @ignore
2126
2129
  */
2127
2130
  constructor(e, t, r) {
2128
- o(this, "renderer");
2129
- o(this, "font");
2130
- o(this, "grid");
2131
- o(this, "converters");
2132
- o(this, "_resultFramebuffer");
2133
- o(this, "_asciiShader");
2134
- o(this, "_characterFramebuffer");
2135
- o(this, "_primaryColorFramebuffer");
2136
- o(this, "_secondaryColorFramebuffer");
2137
- o(this, "_rotationFramebuffer");
2138
- o(this, "_transformFramebuffer");
2139
- this.renderer = e, this.font = t, this.grid = r, this._asciiShader = this.renderer.createShader(S, Ee), this.converters = [
2131
+ n(this, "renderer");
2132
+ n(this, "font");
2133
+ n(this, "grid");
2134
+ n(this, "converters");
2135
+ n(this, "_resultFramebuffer");
2136
+ n(this, "_asciiShader");
2137
+ n(this, "_characterFramebuffer");
2138
+ n(this, "_primaryColorFramebuffer");
2139
+ n(this, "_secondaryColorFramebuffer");
2140
+ n(this, "_rotationFramebuffer");
2141
+ n(this, "_transformFramebuffer");
2142
+ this.renderer = e, this.font = t, this.grid = r, this._asciiShader = this.renderer.createShader(T, Ee), this.converters = [
2140
2143
  { name: "brightness", converter: new L(e, t, r) },
2141
2144
  { name: "custom", converter: new U(e, t, r) }
2142
2145
  ], this._characterFramebuffer = this.renderer.createFramebuffer(r.cols, r.rows), this._primaryColorFramebuffer = this.renderer.createFramebuffer(r.cols, r.rows), this._secondaryColorFramebuffer = this.renderer.createFramebuffer(r.cols, r.rows), this._rotationFramebuffer = this.renderer.createFramebuffer(r.cols, r.rows), this._transformFramebuffer = this.renderer.createFramebuffer(r.cols, r.rows), this._resultFramebuffer = this.renderer.createFramebuffer(this.grid.width, this.grid.height);
@@ -2302,13 +2305,13 @@ class X {
2302
2305
  * @returns Object containing all pixel data arrays
2303
2306
  */
2304
2307
  extractFramebufferData(e) {
2305
- const t = e.get("brightness"), r = t == null ? void 0 : t.characterFramebuffer, i = t == null ? void 0 : t.primaryColorFramebuffer, s = t == null ? void 0 : t.secondaryColorFramebuffer, a = t == null ? void 0 : t.transformFramebuffer, n = t == null ? void 0 : t.rotationFramebuffer;
2306
- return r == null || r.loadPixels(), i == null || i.loadPixels(), s == null || s.loadPixels(), a == null || a.loadPixels(), n == null || n.loadPixels(), {
2308
+ const t = e.get("brightness"), r = t == null ? void 0 : t.characterFramebuffer, i = t == null ? void 0 : t.primaryColorFramebuffer, s = t == null ? void 0 : t.secondaryColorFramebuffer, a = t == null ? void 0 : t.transformFramebuffer, o = t == null ? void 0 : t.rotationFramebuffer;
2309
+ return r == null || r.loadPixels(), i == null || i.loadPixels(), s == null || s.loadPixels(), a == null || a.loadPixels(), o == null || o.loadPixels(), {
2307
2310
  characterPixels: (r == null ? void 0 : r.pixels) || new Uint8Array(0),
2308
2311
  primaryColorPixels: (i == null ? void 0 : i.pixels) || new Uint8Array(0),
2309
2312
  secondaryColorPixels: (s == null ? void 0 : s.pixels) || new Uint8Array(0),
2310
2313
  transformPixels: (a == null ? void 0 : a.pixels) || new Uint8Array(0),
2311
- rotationPixels: (n == null ? void 0 : n.pixels) || new Uint8Array(0)
2314
+ rotationPixels: (o == null ? void 0 : o.pixels) || new Uint8Array(0)
2312
2315
  };
2313
2316
  }
2314
2317
  /**
@@ -2403,9 +2406,9 @@ class Ae extends X {
2403
2406
  * @returns Transform data object
2404
2407
  */
2405
2408
  extractTransformData(e, t, r) {
2406
- const i = e[r], s = e[r + 1], a = e[r + 2], n = i === 255, h = s === 255, c = a === 255, u = t[r], d = t[r + 1], f = u + d / 255, g = Math.round(f * 360 / 255 * 100) / 100;
2409
+ const i = e[r], s = e[r + 1], a = e[r + 2], o = i === 255, h = s === 255, c = a === 255, u = t[r], d = t[r + 1], f = u + d / 255, g = Math.round(f * 360 / 255 * 100) / 100;
2407
2410
  return {
2408
- isInverted: n,
2411
+ isInverted: o,
2409
2412
  flipHorizontal: h,
2410
2413
  flipVertical: c,
2411
2414
  rotation: g
@@ -2438,15 +2441,15 @@ class Ae extends X {
2438
2441
  let i = 0;
2439
2442
  for (let s = 0; s < t.rows; s++)
2440
2443
  for (let a = 0; a < t.cols; a++) {
2441
- const n = i * 4, h = this.getCharacterIndex(
2444
+ const o = i * 4, h = this.getCharacterIndex(
2442
2445
  e.characterPixels,
2443
- n
2446
+ o
2444
2447
  );
2445
- let c = this.pixelsToRGBA(e.primaryColorPixels, n), u = this.pixelsToRGBA(e.secondaryColorPixels, n);
2448
+ let c = this.pixelsToRGBA(e.primaryColorPixels, o), u = this.pixelsToRGBA(e.secondaryColorPixels, o);
2446
2449
  const d = this.extractTransformData(
2447
2450
  e.transformPixels,
2448
2451
  e.rotationPixels,
2449
- n
2452
+ o
2450
2453
  );
2451
2454
  if (d.isInverted) {
2452
2455
  const g = c;
@@ -2483,9 +2486,9 @@ class Me {
2483
2486
  {
2484
2487
  const a = i.idRangeOffset[s] / 2 + (t - i.startCount[s]) - (i.startCount.length - s);
2485
2488
  if (a >= 0 && a < i.glyphIdArray.length) {
2486
- const n = i.glyphIdArray[a];
2487
- if (n !== 0)
2488
- return n + i.idDelta[s] & 65535;
2489
+ const o = i.glyphIdArray[a];
2490
+ if (o !== 0)
2491
+ return o + i.idDelta[s] & 65535;
2489
2492
  }
2490
2493
  }
2491
2494
  }
@@ -2535,11 +2538,11 @@ class Me {
2535
2538
  */
2536
2539
  glyphToSVGPath(e, t, r, i) {
2537
2540
  if (!e || !e.xs) return "";
2538
- const { xs: s, ys: a, endPts: n, flags: h } = e;
2539
- if (!s || !a || !n || !h) return "";
2541
+ const { xs: s, ys: a, endPts: o, flags: h } = e;
2542
+ if (!s || !a || !o || !h) return "";
2540
2543
  let c = "", u = 0;
2541
- for (let d = 0; d < n.length; d++) {
2542
- const f = n[d];
2544
+ for (let d = 0; d < o.length; d++) {
2545
+ const f = o[d];
2543
2546
  if (!(f < u)) {
2544
2547
  if (f >= u) {
2545
2548
  const g = t + s[u] * i, _ = r - a[u] * i;
@@ -2553,10 +2556,10 @@ class Me {
2553
2556
  const C = t + s[p] * i, v = r - a[p] * i;
2554
2557
  let w = p + 1 > f ? u : p + 1;
2555
2558
  if ((h[w] & 1) !== 0) {
2556
- const R = t + s[w] * i, y = r - a[w] * i;
2557
- c += `Q${C.toFixed(2)},${v.toFixed(2)} ${R.toFixed(2)},${y.toFixed(2)}`, p = w + 1;
2559
+ const R = t + s[w] * i, S = r - a[w] * i;
2560
+ c += `Q${C.toFixed(2)},${v.toFixed(2)} ${R.toFixed(2)},${S.toFixed(2)}`, p = w + 1;
2558
2561
  } else {
2559
- const R = t + s[w] * i, y = r - a[w] * i, P = (C + R) / 2, D = (v + y) / 2;
2562
+ const R = t + s[w] * i, S = r - a[w] * i, P = (C + R) / 2, D = (v + S) / 2;
2560
2563
  c += `Q${C.toFixed(2)},${v.toFixed(2)} ${P.toFixed(2)},${D.toFixed(2)}`, p = w;
2561
2564
  }
2562
2565
  }
@@ -2578,14 +2581,14 @@ class Me {
2578
2581
  */
2579
2582
  generateCharacterPath(e, t, r, i, s) {
2580
2583
  try {
2581
- const a = e.codePointAt(0) || 0, n = this.getGlyphIndex(t, a);
2582
- if (n === 0)
2584
+ const a = e.codePointAt(0) || 0, o = this.getGlyphIndex(t, a);
2585
+ if (o === 0)
2583
2586
  return this.createEmptyPath();
2584
2587
  let h = null;
2585
2588
  try {
2586
- t.glyf && t.glyf[n] !== null ? h = t.glyf[n] : m && m.T && m.T.glyf && m.T.glyf._parseGlyf && (h = m.T.glyf._parseGlyf(t, n), t.glyf && h && (t.glyf[n] = h));
2589
+ t.glyf && t.glyf[o] !== null ? h = t.glyf[o] : m && m.T && m.T.glyf && m.T.glyf._parseGlyf && (h = m.T.glyf._parseGlyf(t, o), t.glyf && h && (t.glyf[o] = h));
2587
2590
  } catch (c) {
2588
- console.warn(`Failed to parse glyph ${n}:`, c);
2591
+ console.warn(`Failed to parse glyph ${o}:`, c);
2589
2592
  }
2590
2593
  return h ? this.createGlyphPath(t, h, r, i, s) : this.createEmptyPath();
2591
2594
  } catch (a) {
@@ -2604,10 +2607,10 @@ class Me {
2604
2607
  * @param advanceWidth Character advance width
2605
2608
  * @returns SVG path data string or null if generation fails
2606
2609
  */
2607
- generatePositionedCharacterPath(e, t, r, i, s, a, n, h) {
2610
+ generatePositionedCharacterPath(e, t, r, i, s, a, o, h) {
2608
2611
  try {
2609
- const c = n / t.head.unitsPerEm, u = h * c, d = r + (s - u) / 2, f = i + (a + n * 0.7) / 2;
2610
- return this.generateCharacterPath(e, t, d, f, n).toSVG() || null;
2612
+ const c = o / t.head.unitsPerEm, u = h * c, d = r + (s - u) / 2, f = i + (a + o * 0.7) / 2;
2613
+ return this.generateCharacterPath(e, t, d, f, o).toSVG() || null;
2611
2614
  } catch (c) {
2612
2615
  return console.warn(`Failed to generate positioned character path for "${e}":`, c), null;
2613
2616
  }
@@ -2615,7 +2618,7 @@ class Me {
2615
2618
  }
2616
2619
  class De {
2617
2620
  constructor() {
2618
- o(this, "pathGenerator");
2621
+ n(this, "pathGenerator");
2619
2622
  this.pathGenerator = new Me();
2620
2623
  }
2621
2624
  /**
@@ -2668,12 +2671,12 @@ class De {
2668
2671
  * @returns Transform attribute string or empty string
2669
2672
  */
2670
2673
  generateTransformAttribute(e, t) {
2671
- const { transform: r, position: i } = e, s = i.cellX + t.cellWidth / 2, a = i.cellY + t.cellHeight / 2, n = [];
2674
+ const { transform: r, position: i } = e, s = i.cellX + t.cellWidth / 2, a = i.cellY + t.cellHeight / 2, o = [];
2672
2675
  if (r.flipHorizontal || r.flipVertical) {
2673
2676
  const h = r.flipHorizontal ? -1 : 1, c = r.flipVertical ? -1 : 1;
2674
- n.push(`translate(${s} ${a})`), n.push(`scale(${h} ${c})`), n.push(`translate(${-s} ${-a})`);
2677
+ o.push(`translate(${s} ${a})`), o.push(`scale(${h} ${c})`), o.push(`translate(${-s} ${-a})`);
2675
2678
  }
2676
- return r.rotation && n.push(`rotate(${r.rotation} ${s} ${a})`), n.length ? ` transform="${n.join(" ")}"` : "";
2679
+ return r.rotation && o.push(`rotate(${r.rotation} ${s} ${a})`), o.length ? ` transform="${o.join(" ")}"` : "";
2677
2680
  }
2678
2681
  /**
2679
2682
  * Generates background rectangle for a cell
@@ -2714,10 +2717,10 @@ class De {
2714
2717
  );
2715
2718
  if (!a)
2716
2719
  return "";
2717
- const n = this.rgbaToColorString(e.primaryColor);
2720
+ const o = this.rgbaToColorString(e.primaryColor);
2718
2721
  return i.drawMode === "stroke" ? `
2719
- <path id="${`path-${e.charIndex}-${e.position.cellX}-${e.position.cellY}`.replace(/\./g, "-")}" d="${a}" stroke="${n}" stroke-width="${i.strokeWidth}" fill="none" />` : `
2720
- <path d="${a}" fill="${n}" />`;
2722
+ <path id="${`path-${e.charIndex}-${e.position.cellX}-${e.position.cellY}`.replace(/\./g, "-")}" d="${a}" stroke="${o}" stroke-width="${i.strokeWidth}" fill="none" />` : `
2723
+ <path d="${a}" fill="${o}" />`;
2721
2724
  }
2722
2725
  /**
2723
2726
  * Generates complete SVG content for a single cell
@@ -2730,10 +2733,10 @@ class De {
2730
2733
  generateCellContent(e, t, r, i) {
2731
2734
  let s = "";
2732
2735
  s += this.generateCellBackground(e, t, i);
2733
- const a = this.generateTransformAttribute(e, t), n = this.generateCharacterPath(e, t, r, i);
2734
- return n && (a ? (s += `
2735
- <g${a}>`, s += n, s += `
2736
- </g>`) : s += n), s;
2736
+ const a = this.generateTransformAttribute(e, t), o = this.generateCharacterPath(e, t, r, i);
2737
+ return o && (a ? (s += `
2738
+ <g${a}>`, s += o, s += `
2739
+ </g>`) : s += o), s;
2737
2740
  }
2738
2741
  /**
2739
2742
  * Generates the complete SVG content from cell data
@@ -2793,9 +2796,9 @@ class Ie extends N {
2793
2796
  }
2794
2797
  class Y {
2795
2798
  constructor() {
2796
- o(this, "dataExtractor");
2797
- o(this, "contentGenerator");
2798
- o(this, "fileHandler");
2799
+ n(this, "dataExtractor");
2800
+ n(this, "contentGenerator");
2801
+ n(this, "fileHandler");
2799
2802
  this.dataExtractor = new Ae(), this.contentGenerator = new De(), this.fileHandler = new Ie();
2800
2803
  }
2801
2804
  /**
@@ -2853,7 +2856,7 @@ class Pe extends X {
2853
2856
  * @returns 2D array of characters (rows x columns)
2854
2857
  */
2855
2858
  extractCharacterGrid(e, t, r, i = " ") {
2856
- var n;
2859
+ var o;
2857
2860
  const s = [];
2858
2861
  let a = 0;
2859
2862
  for (let h = 0; h < t.rows; h++) {
@@ -2862,7 +2865,7 @@ class Pe extends X {
2862
2865
  const d = a * 4, f = this.getCharacterIndex(
2863
2866
  e.characterPixels,
2864
2867
  d
2865
- ), g = ((n = r.characters[f]) == null ? void 0 : n.character) || i;
2868
+ ), g = ((o = r.characters[f]) == null ? void 0 : o.character) || i;
2866
2869
  c.push(g), a++;
2867
2870
  }
2868
2871
  s.push(c);
@@ -2915,9 +2918,9 @@ class Ge extends N {
2915
2918
  }
2916
2919
  class j {
2917
2920
  constructor() {
2918
- o(this, "dataExtractor");
2919
- o(this, "contentGenerator");
2920
- o(this, "fileHandler");
2921
+ n(this, "dataExtractor");
2922
+ n(this, "contentGenerator");
2923
+ n(this, "fileHandler");
2921
2924
  this.dataExtractor = new Pe(), this.contentGenerator = new Be(), this.fileHandler = new Ge();
2922
2925
  }
2923
2926
  /**
@@ -2976,8 +2979,8 @@ class Ve extends X {
2976
2979
  const i = e.canvas;
2977
2980
  if (t === 1 && r === "transparent")
2978
2981
  return i;
2979
- const s = document.createElement("canvas"), a = s.getContext("2d"), n = Math.round(i.width * t), h = Math.round(i.height * t);
2980
- return s.width = n, s.height = h, r !== "transparent" && (a.fillStyle = r, a.fillRect(0, 0, n, h)), a.imageSmoothingEnabled = !1, a.drawImage(
2982
+ const s = document.createElement("canvas"), a = s.getContext("2d"), o = Math.round(i.width * t), h = Math.round(i.height * t);
2983
+ return s.width = o, s.height = h, r !== "transparent" && (a.fillStyle = r, a.fillRect(0, 0, o, h)), a.imageSmoothingEnabled = !1, a.drawImage(
2981
2984
  i,
2982
2985
  0,
2983
2986
  0,
@@ -2985,7 +2988,7 @@ class Ve extends X {
2985
2988
  i.height,
2986
2989
  0,
2987
2990
  0,
2988
- n,
2991
+ o,
2989
2992
  h
2990
2993
  ), s;
2991
2994
  }
@@ -3009,8 +3012,8 @@ class ke {
3009
3012
  */
3010
3013
  async generateImageBlob(e, t) {
3011
3014
  return new Promise((r, i) => {
3012
- const s = this.getMimeType(t.format), a = (n) => {
3013
- n ? r(n) : i(new Error(`Failed to generate ${t.format.toUpperCase()} blob`));
3015
+ const s = this.getMimeType(t.format), a = (o) => {
3016
+ o ? r(o) : i(new Error(`Failed to generate ${t.format.toUpperCase()} blob`));
3014
3017
  };
3015
3018
  t.format === "png" ? e.toBlob(a, s) : e.toBlob(a, s, t.quality);
3016
3019
  });
@@ -3107,9 +3110,9 @@ class ze extends N {
3107
3110
  }
3108
3111
  class $e {
3109
3112
  constructor() {
3110
- o(this, "dataExtractor");
3111
- o(this, "contentGenerator");
3112
- o(this, "fileHandler");
3113
+ n(this, "dataExtractor");
3114
+ n(this, "contentGenerator");
3115
+ n(this, "fileHandler");
3113
3116
  this.dataExtractor = new Ve(), this.contentGenerator = new ke(), this.fileHandler = new ze();
3114
3117
  }
3115
3118
  /**
@@ -3196,37 +3199,37 @@ class $e {
3196
3199
  class I {
3197
3200
  constructor(e = null, t = {}) {
3198
3201
  /** The element to capture content from (optional for standalone mode) */
3199
- o(this, "captureSource");
3202
+ n(this, "captureSource");
3200
3203
  /** Our WebGL overlay canvas manager */
3201
- o(this, "textmodeCanvas");
3204
+ n(this, "textmodeCanvas");
3202
3205
  /** Core WebGL renderer */
3203
- o(this, "_renderer");
3204
- o(this, "_canvasFramebuffer");
3205
- o(this, "_font");
3206
- o(this, "_grid");
3207
- o(this, "resizeObserver");
3206
+ n(this, "_renderer");
3207
+ n(this, "_canvasFramebuffer");
3208
+ n(this, "_font");
3209
+ n(this, "_grid");
3210
+ n(this, "resizeObserver");
3208
3211
  // Auto-rendering properties
3209
- o(this, "_mode");
3210
- o(this, "_frameRateLimit");
3211
- o(this, "animationFrameId", null);
3212
- o(this, "lastFrameTime", 0);
3213
- o(this, "frameInterval");
3214
- o(this, "_isLooping", !0);
3215
- o(this, "_frameRate", 0);
3216
- o(this, "lastRenderTime", 0);
3217
- o(this, "_frameCount", 0);
3212
+ n(this, "_mode");
3213
+ n(this, "_frameRateLimit");
3214
+ n(this, "animationFrameId", null);
3215
+ n(this, "lastFrameTime", 0);
3216
+ n(this, "frameInterval");
3217
+ n(this, "_isLooping", !0);
3218
+ n(this, "_frameRate", 0);
3219
+ n(this, "lastRenderTime", 0);
3220
+ n(this, "_frameCount", 0);
3218
3221
  // Frame rate measurement smoothing
3219
- o(this, "frameTimeHistory", []);
3220
- o(this, "frameTimeHistorySize", 10);
3221
- o(this, "_pipeline");
3222
- o(this, "_isDisposed", !1);
3222
+ n(this, "frameTimeHistory", []);
3223
+ n(this, "frameTimeHistorySize", 10);
3224
+ n(this, "_pipeline");
3225
+ n(this, "_isDisposed", !1);
3223
3226
  // Standalone canvas properties
3224
- o(this, "_standalone", !1);
3225
- o(this, "_drawCallback", () => {
3227
+ n(this, "_standalone", !1);
3228
+ n(this, "_drawCallback", () => {
3226
3229
  });
3227
- o(this, "_resizedCallback", () => {
3230
+ n(this, "_resizedCallback", () => {
3228
3231
  });
3229
- o(this, "_windowResizeListener", null);
3232
+ n(this, "_windowResizeListener", null);
3230
3233
  this.captureSource = e, this._standalone = e === null, this._mode = t.renderMode ?? "auto", this._frameRateLimit = t.frameRate ?? 60, this.frameInterval = 1e3 / this._frameRateLimit;
3231
3234
  }
3232
3235
  /**
@@ -3240,8 +3243,8 @@ class I {
3240
3243
  r.textmodeCanvas = new be(r.captureSource, r._standalone, i), r._renderer = new fe(r.textmodeCanvas.getWebGLContext());
3241
3244
  let s, a;
3242
3245
  r._standalone ? (s = t.width || 800, a = t.height || 600) : (s = r.textmodeCanvas.width || 800, a = r.textmodeCanvas.height || 600), r._canvasFramebuffer = r._renderer.createFramebuffer(s, a), r._font = new xe(r._renderer, t.fontSize ?? 16), await r._font.initialize(t.fontSource);
3243
- const n = r._font.maxGlyphDimensions;
3244
- return r._grid = new ve(r.textmodeCanvas.canvas, n.width, n.height), r._pipeline = new Ue(r._renderer, r._font, r._grid), r.setupEventListeners(), r.startAutoRendering(), r;
3246
+ const o = r._font.maxGlyphDimensions;
3247
+ return r._grid = new ve(r.textmodeCanvas.canvas, o.width, o.height), r._pipeline = new Ue(r._renderer, r._font, r._grid), r.setupEventListeners(), r.startAutoRendering(), r;
3245
3248
  }
3246
3249
  setupEventListeners() {
3247
3250
  this._windowResizeListener = () => {
@@ -4170,6 +4173,14 @@ class I {
4170
4173
  createShader(e, t) {
4171
4174
  return this._renderer.createShader(e, t);
4172
4175
  }
4176
+ /**
4177
+ * Create a filter shader program from a fragment source code.
4178
+ * @param fragmentSource The GLSL source code for the fragment shader.
4179
+ * @returns The created filter shader program for use in `textmode.js`.
4180
+ */
4181
+ createFilterShader(e) {
4182
+ return this._renderer.createFilterShader(e);
4183
+ }
4173
4184
  /**
4174
4185
  * Set the current shader for rendering.
4175
4186
  * @param shader The shader program to use for rendering.
@@ -4343,7 +4354,7 @@ class O {
4343
4354
  * ```
4344
4355
  */
4345
4356
  static get version() {
4346
- return "0.1.4-beta.3";
4357
+ return "0.1.4-beta.5";
4347
4358
  }
4348
4359
  constructor() {
4349
4360
  throw new Error("Textmode is a static class and cannot be instantiated.");
@@ -4355,7 +4366,7 @@ const Xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4355
4366
  export {
4356
4367
  be as TextmodeCanvas,
4357
4368
  Ue as TextmodeConversionPipeline,
4358
- ne as TextmodeErrorLevel,
4369
+ oe as TextmodeErrorLevel,
4359
4370
  xe as TextmodeFont,
4360
4371
  ve as TextmodeGrid,
4361
4372
  I as Textmodifier,