textmode.js 0.3.2-beta.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/textmode.esm.js +841 -755
- package/dist/textmode.esm.min.js +854 -768
- package/dist/textmode.umd.js +6 -6
- package/dist/textmode.umd.min.js +7 -7
- package/dist/types/index.d.ts +1 -3
- package/dist/types/textmode/Textmodifier.d.ts +5 -43
- package/dist/types/textmode/font/TextmodeFont.d.ts +10 -1
- package/dist/types/textmode/font/typr/types.d.ts +0 -16
- package/dist/types/textmode/mixins/FontMixin.d.ts +2 -2
- package/dist/types/textmode/mixins/index.d.ts +0 -1
- package/dist/types/textmode/plugins/PluginManager.d.ts +76 -0
- package/package.json +3 -3
- package/dist/types/export/base/DataExtractor.d.ts +0 -34
- package/dist/types/export/base/FileHandler.d.ts +0 -46
- package/dist/types/export/base/index.d.ts +0 -2
- package/dist/types/export/image/ImageContentGenerator.d.ts +0 -27
- package/dist/types/export/image/ImageDataExtractor.d.ts +0 -16
- package/dist/types/export/image/ImageExporter.d.ts +0 -38
- package/dist/types/export/image/ImageFileHandler.d.ts +0 -27
- package/dist/types/export/image/index.d.ts +0 -6
- package/dist/types/export/image/types.d.ts +0 -62
- package/dist/types/export/index.d.ts +0 -3
- package/dist/types/export/svg/SVGContentGenerator.d.ts +0 -76
- package/dist/types/export/svg/SVGDataExtractor.d.ts +0 -33
- package/dist/types/export/svg/SVGExporter.d.ts +0 -31
- package/dist/types/export/svg/SVGFileHandler.d.ts +0 -25
- package/dist/types/export/svg/SVGPathGenerator.d.ts +0 -56
- package/dist/types/export/svg/index.d.ts +0 -6
- package/dist/types/export/svg/types.d.ts +0 -129
- package/dist/types/export/txt/TXTContentGenerator.d.ts +0 -14
- package/dist/types/export/txt/TXTDataExtractor.d.ts +0 -19
- package/dist/types/export/txt/TXTExporter.d.ts +0 -31
- package/dist/types/export/txt/TXTFileHandler.d.ts +0 -19
- package/dist/types/export/txt/index.d.ts +0 -5
- package/dist/types/export/txt/types.d.ts +0 -55
- package/dist/types/textmode/mixins/ExportMixin.d.ts +0 -128
package/dist/textmode.esm.js
CHANGED
|
@@ -28,14 +28,14 @@ ${"↓".repeat(24)}
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
var ct = ((a) => (a[a.SILENT = 0] = "SILENT", a[a.WARNING = 1] = "WARNING", a[a.ERROR = 2] = "ERROR", a[a.THROW = 3] = "THROW", a))(ct || {});
|
|
31
|
-
const
|
|
31
|
+
const D = class D {
|
|
32
32
|
constructor() {
|
|
33
33
|
h(this, "u", { globalLevel: 3 });
|
|
34
34
|
}
|
|
35
35
|
static _() {
|
|
36
|
-
return
|
|
36
|
+
return D.l || (D.l = new D()), D.l;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
m(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;";
|
|
40
40
|
switch (this.u.globalLevel) {
|
|
41
41
|
case 0:
|
|
@@ -48,20 +48,20 @@ const _ = class _ {
|
|
|
48
48
|
throw new C(t, e);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
return !!t || (this.
|
|
51
|
+
v(t, e, i) {
|
|
52
|
+
return !!t || (this.m(e, i), !1);
|
|
53
53
|
}
|
|
54
54
|
A(t) {
|
|
55
55
|
this.u.globalLevel = t;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
h(
|
|
59
|
-
let
|
|
60
|
-
const
|
|
61
|
-
function
|
|
58
|
+
h(D, "l", null);
|
|
59
|
+
let K = D;
|
|
60
|
+
const z = K._(), et = /* @__PURE__ */ new WeakMap();
|
|
61
|
+
function Y(a, t) {
|
|
62
62
|
et.set(a, t);
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function W(a) {
|
|
65
65
|
return et.get(a);
|
|
66
66
|
}
|
|
67
67
|
class it {
|
|
@@ -78,17 +78,17 @@ class it {
|
|
|
78
78
|
h(this, "k", !1);
|
|
79
79
|
h(this, "L", [0, 0]);
|
|
80
80
|
h(this, "O", [0, 0, 0, 1]);
|
|
81
|
-
h(this, "
|
|
81
|
+
h(this, "H", []);
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
this.
|
|
83
|
+
G() {
|
|
84
|
+
this.H.push({ I: this.C, N: this.M, X: this.U, W: this.F, L: [...this.L], K: this.$, j: this.D, k: this.k, Y: [...this.R], V: [...this.P], q: [...this.S] });
|
|
85
85
|
}
|
|
86
86
|
Z() {
|
|
87
|
-
const t = this.
|
|
88
|
-
t ? (this.C = t.I, this.M = t.N, this.U = t.X, this.F = t.W, this.L = t.L, this.$ = t.K, this.D = t.
|
|
87
|
+
const t = this.H.pop();
|
|
88
|
+
t ? (this.C = t.I, this.M = t.N, this.U = t.X, this.F = t.W, this.L = t.L, this.$ = t.K, this.D = t.j, this.k = t.k, this.R = t.Y, this.P = t.V, this.S = t.q) : console.warn("pop() called without matching push()");
|
|
89
89
|
}
|
|
90
90
|
J(t) {
|
|
91
|
-
t.I = this.C, t.N = this.M, t.X = this.U, t.W = this.F, t.
|
|
91
|
+
t.I = this.C, t.N = this.M, t.X = this.U, t.W = this.F, t.Y[0] = this.R[0], t.Y[1] = this.R[1], t.Y[2] = this.R[2], t.V[0] = this.P[0], t.V[1] = this.P[1], t.V[2] = this.P[2], t.V[3] = this.P[3], t.q[0] = this.S[0], t.q[1] = this.S[1], t.q[2] = this.S[2], t.q[3] = this.S[3], t.K = this.$, t.j = this.D, t.k = this.k, t.L[0] = this.L[0], t.L[1] = this.L[1];
|
|
92
92
|
}
|
|
93
93
|
get lineWeight() {
|
|
94
94
|
return this.C;
|
|
@@ -134,7 +134,7 @@ class it {
|
|
|
134
134
|
this.O = [t / 255, e / 255, i / 255, s / 255];
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
class
|
|
137
|
+
class j {
|
|
138
138
|
constructor(t, e, i = e, s = 1, r = {}, n = null, o = !1) {
|
|
139
139
|
h(this, "dt");
|
|
140
140
|
h(this, "_t");
|
|
@@ -202,11 +202,11 @@ class K {
|
|
|
202
202
|
const t = this.gt;
|
|
203
203
|
if (this.xt) {
|
|
204
204
|
const n = ((i = (e = this.xt).Pt) == null ? void 0 : i.call(e)) ?? null;
|
|
205
|
-
n && this.xt.St(n), this.Mt && this.Ft && ((r = (s = this.xt)
|
|
205
|
+
n && this.xt.St(n), this.Mt && this.Ft && ((r = (s = this.xt).$t) == null || r.call(s, this.Ft));
|
|
206
206
|
}
|
|
207
207
|
this.wt = { framebuffer: t.getParameter(t.FRAMEBUFFER_BINDING), viewport: t.getParameter(t.VIEWPORT) }, t.bindFramebuffer(t.FRAMEBUFFER, this.At), this.bt = Array(this.Ct).fill(null);
|
|
208
208
|
for (let n = 0; n < this.Ct; n++) t.clearBufferfv(t.COLOR, n, new Float32Array([0, 0, 0, 0]));
|
|
209
|
-
t.viewport(0, 0, this.dt, this._t),
|
|
209
|
+
t.viewport(0, 0, this.dt, this._t), Y(t, [0, 0, this.dt, this._t]);
|
|
210
210
|
}
|
|
211
211
|
end() {
|
|
212
212
|
var e, i, s, r;
|
|
@@ -216,7 +216,7 @@ class K {
|
|
|
216
216
|
const n = ((i = (e = this.xt).Pt) == null ? void 0 : i.call(e)) ?? null;
|
|
217
217
|
n && this.xt.St(n);
|
|
218
218
|
}
|
|
219
|
-
t.bindFramebuffer(t.FRAMEBUFFER, this.wt.framebuffer), t.viewport(...this.wt.viewport),
|
|
219
|
+
t.bindFramebuffer(t.FRAMEBUFFER, this.wt.framebuffer), t.viewport(...this.wt.viewport), Y(t, this.wt.viewport), this.wt = null, this.xt && this.Mt && this.Ft && ((r = (s = this.xt).Et) == null || r.call(s));
|
|
220
220
|
}
|
|
221
221
|
Dt() {
|
|
222
222
|
const t = this.gt;
|
|
@@ -233,16 +233,16 @@ class K {
|
|
|
233
233
|
return [...this.yt];
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
class
|
|
236
|
+
class S {
|
|
237
237
|
constructor(t, e, i) {
|
|
238
238
|
h(this, "gt");
|
|
239
239
|
h(this, "kt");
|
|
240
240
|
h(this, "Bt", /* @__PURE__ */ new Map());
|
|
241
241
|
h(this, "Lt", /* @__PURE__ */ new Map());
|
|
242
242
|
h(this, "Ot", 0);
|
|
243
|
-
this.gt = t, this.kt = this.
|
|
243
|
+
this.gt = t, this.kt = this.Ht(e, i), this.Gt();
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
Gt() {
|
|
246
246
|
const t = this.gt.getProgramParameter(this.kt, this.gt.ACTIVE_UNIFORMS);
|
|
247
247
|
for (let e = 0; e < t; e++) {
|
|
248
248
|
const i = this.gt.getActiveUniform(this.kt, e);
|
|
@@ -255,7 +255,7 @@ class O {
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
|
-
|
|
258
|
+
Ht(t, e) {
|
|
259
259
|
const i = this.It(this.gt.VERTEX_SHADER, t), s = this.It(this.gt.FRAGMENT_SHADER, e), r = this.gt.createProgram();
|
|
260
260
|
if (this.gt.attachShader(r, i), this.gt.attachShader(r, s), this.gt.linkProgram(r), !this.gt.getProgramParameter(r, this.gt.LINK_STATUS)) {
|
|
261
261
|
const n = this.gt.getProgramInfoLog(r);
|
|
@@ -280,10 +280,10 @@ class O {
|
|
|
280
280
|
Wt(t) {
|
|
281
281
|
for (const [e, i] of Object.entries(t)) this.Kt(e, i);
|
|
282
282
|
}
|
|
283
|
-
|
|
283
|
+
jt(t) {
|
|
284
284
|
return this.Bt.has(t);
|
|
285
285
|
}
|
|
286
|
-
|
|
286
|
+
Yt(t) {
|
|
287
287
|
return this.Lt.get(t) || null;
|
|
288
288
|
}
|
|
289
289
|
Vt() {
|
|
@@ -347,7 +347,7 @@ class O {
|
|
|
347
347
|
else if (e instanceof WebGLTexture) {
|
|
348
348
|
const l = this.qt();
|
|
349
349
|
o.uniform1i(i, l), o.activeTexture(o.TEXTURE0 + l), o.bindTexture(o.TEXTURE_2D, e);
|
|
350
|
-
} else if (e instanceof
|
|
350
|
+
} else if (e instanceof j) {
|
|
351
351
|
const l = this.qt();
|
|
352
352
|
o.uniform1i(i, l), o.activeTexture(o.TEXTURE0 + l), o.bindTexture(o.TEXTURE_2D, e.textures[0]);
|
|
353
353
|
} else console.warn(`Unsupported uniform type for '${t}':`, typeof e);
|
|
@@ -362,8 +362,8 @@ class O {
|
|
|
362
362
|
this.gt.deleteProgram(this.kt);
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
-
const
|
|
366
|
-
in vec2 a_position;in vec2 a_texCoord;in vec2 a_instancePosition;in vec2 a_instanceSize;in vec3 a_instanceCharacter;in vec4 a_instancePrimaryColor;in vec4 a_instanceSecondaryColor;in vec2 a_instanceRotation;in vec3 a_instanceTransform;in vec3 a_instanceGlobalRotation;in vec2 a_instanceRotationCenter;in vec2 a_instanceBezierCP1;in vec2 a_instanceBezierCP2;in vec2 a_instanceBezierStart;in vec2 a_instanceBezierEnd;in vec2 a_instanceArcAngles;uniform float U9;uniform vec2
|
|
365
|
+
const H = `#version 300 es
|
|
366
|
+
in vec2 a_position;in vec2 a_texCoord;in vec2 a_instancePosition;in vec2 a_instanceSize;in vec3 a_instanceCharacter;in vec4 a_instancePrimaryColor;in vec4 a_instanceSecondaryColor;in vec2 a_instanceRotation;in vec3 a_instanceTransform;in vec3 a_instanceGlobalRotation;in vec2 a_instanceRotationCenter;in vec2 a_instanceBezierCP1;in vec2 a_instanceBezierCP2;in vec2 a_instanceBezierStart;in vec2 a_instanceBezierEnd;in vec2 a_instanceArcAngles;uniform float U9;uniform vec2 Uy;out vec2 v_uv;out vec3 v_character;out vec4 v_primaryColor;out vec4 v_secondaryColor;out vec2 v_rotation;out vec3 v_transform;mat3 A(float B){float C=sin(B),D=cos(B);return mat3(1,0,0,0,D,-C,0,C,D);}mat3 E(float B){float C=sin(B),D=cos(B);return mat3(D,0,C,0,1,0,-C,0,D);}mat3 F(float B){float C=sin(B),D=cos(B);return mat3(D,-C,0,C,D,0,0,0,1);}vec2 G(float H,vec2 I,vec2 J,vec2 K,vec2 L){float M=1.-H,N=M*M,O=H*H;return N*M*I+3.*N*H*J+3.*M*O*K+O*H*L;}vec2 P(float H,vec2 I,vec2 J,vec2 K,vec2 L){float M=1.-H,N=M*M,O=H*H;return-3.*N*I+3.*N*J-6.*M*H*J+6.*M*H*K-3.*O*K+3.*O*L;}void main(){v_uv=a_texCoord;v_character=a_instanceCharacter;v_primaryColor=a_instancePrimaryColor;v_secondaryColor=a_instanceSecondaryColor;v_rotation=a_instanceRotation;v_transform=a_instanceTransform;vec2 Q;bool R=length(a_instanceBezierCP1)+length(a_instanceBezierCP2)+length(a_instanceBezierStart)+length(a_instanceBezierEnd)>0.;bool S=a_instanceArcAngles.x!=0.||a_instanceArcAngles.y!=0.;if(R){float H=a_position.x;vec2 T=G(H,a_instanceBezierStart,a_instanceBezierCP1,a_instanceBezierCP2,a_instanceBezierEnd);vec2 U=P(H,a_instanceBezierStart,a_instanceBezierCP1,a_instanceBezierCP2,a_instanceBezierEnd);float V=length(U);U=V>0.?U/V:vec2(1,0);Q=T+vec2(-U.y,U.x)*a_position.y*a_instanceSize.y;}else if(S){float C=a_instanceArcAngles.x,W=a_instanceArcAngles.y;C=mod(C,6.28318530718);if(C<0.)C+=6.28318530718;W=mod(W,6.28318530718);if(W<0.)W+=6.28318530718;float X=C-W;if(X<=0.)X+=6.28318530718;float Y=C-a_position.x*X;vec2 Z=vec2(cos(Y),sin(Y))*a_position.y;Q=Z*a_instanceSize*.5+a_instanceSize*.5+a_instancePosition;}else{Q=a_position*a_instanceSize+a_instancePosition;}vec2 a=(Q/Uy)*2.-1.;a.y=-a.y;if(length(a_instanceGlobalRotation)>0.){vec3 b=vec3(a-a_instanceRotationCenter,0);b.x*=U9;if(a_instanceGlobalRotation.x!=0.)b=A(-a_instanceGlobalRotation.x)*b;if(a_instanceGlobalRotation.y!=0.)b=E(-a_instanceGlobalRotation.y)*b;if(a_instanceGlobalRotation.z!=0.)b=F(-a_instanceGlobalRotation.z)*b;b.x/=U9;a=b.xy+a_instanceRotationCenter;}gl_Position=vec4(a,0,1);}`, st = "attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_uv;void main(){v_uv=a_texCoord;gl_Position=vec4(a_position,0.,1.);}";
|
|
367
367
|
class lt {
|
|
368
368
|
constructor(t) {
|
|
369
369
|
h(this, "gt");
|
|
@@ -371,9 +371,9 @@ class lt {
|
|
|
371
371
|
h(this, "Jt");
|
|
372
372
|
h(this, "ts");
|
|
373
373
|
h(this, "ss");
|
|
374
|
-
this.gt = t, this.Jt = new
|
|
375
|
-
precision highp float;in vec2 v_uv;in vec3 v_character;in vec4 v_primaryColor;in vec4 v_secondaryColor;in vec2 v_rotation;in vec3 v_transform;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 o_rotation;layout(location=4)out vec4 o_transform;void main(){o_character=vec4(v_character,1.);o_primaryColor=v_primaryColor;o_secondaryColor=v_secondaryColor;o_rotation=vec4(v_rotation,0.,1.);o_transform=vec4(v_transform,1.);}`), this.Qt = new
|
|
376
|
-
precision highp float;in vec2 v_uv;uniform sampler2D Ue;uniform sampler2D Uf;uniform sampler2D Ug;uniform sampler2D Uh;uniform sampler2D Ui;uniform vec2 Uj;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 o_rotation;layout(location=4)out vec4 o_transform;void main(){vec2 A=vec2(v_uv.x,1.-v_uv.y);vec2 B=A*Uj;vec2 C=(floor(B)+0.5f)/Uj;vec4 D=texture(Ue,C);vec4 E=texture(Uf,C);if(E.a==0.){discard;}vec4 F=texture(Ug,C);vec4 G=texture(Uh,C);vec4 H=texture(Ui,C);o_character=D;o_primaryColor=E;o_secondaryColor=F;o_rotation=G;o_transform=H;}`), this.ts = new
|
|
374
|
+
this.gt = t, this.Jt = new S(this.gt, H, `#version 300 es
|
|
375
|
+
precision highp float;in vec2 v_uv;in vec3 v_character;in vec4 v_primaryColor;in vec4 v_secondaryColor;in vec2 v_rotation;in vec3 v_transform;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 o_rotation;layout(location=4)out vec4 o_transform;void main(){o_character=vec4(v_character,1.);o_primaryColor=v_primaryColor;o_secondaryColor=v_secondaryColor;o_rotation=vec4(v_rotation,0.,1.);o_transform=vec4(v_transform,1.);}`), this.Qt = new S(this.gt, H, `#version 300 es
|
|
376
|
+
precision highp float;in vec2 v_uv;uniform sampler2D Ue;uniform sampler2D Uf;uniform sampler2D Ug;uniform sampler2D Uh;uniform sampler2D Ui;uniform vec2 Uj;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 o_rotation;layout(location=4)out vec4 o_transform;void main(){vec2 A=vec2(v_uv.x,1.-v_uv.y);vec2 B=A*Uj;vec2 C=(floor(B)+0.5f)/Uj;vec4 D=texture(Ue,C);vec4 E=texture(Uf,C);if(E.a==0.){discard;}vec4 F=texture(Ug,C);vec4 G=texture(Uh,C);vec4 H=texture(Ui,C);o_character=D;o_primaryColor=E;o_secondaryColor=F;o_rotation=G;o_transform=H;}`), this.ts = new S(this.gt, st, "precision mediump float;uniform sampler2D U0;uniform vec2 U1;uniform sampler2D U3;uniform sampler2D U4;uniform sampler2D U5;uniform sampler2D U2;uniform sampler2D U6;uniform vec2 U7;uniform vec2 U8;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/U8;vec2 F=E*U7;vec2 G=floor(F);vec2 H=(G+0.5)/U7;vec4 I=texture2D(U3,H);vec4 J=texture2D(U4,H);vec4 K=texture2D(U5,H);bool L=K.r>0.5;bool M=K.g>0.5;bool N=K.b>0.5;vec4 O=texture2D(U2,H);int P=int(O.r*255.+0.5)+int(O.g*255.+0.5)*256;int Q=int(mod(float(P),U1.x));int R=P/int(U1.x);float S=(U1.y-1.)-float(R);vec2 T=vec2(float(Q),S)/U1;vec4 U=texture2D(U6,H);float V=U.r*255.+U.g;float W=-(V*360./255.)*0.017453292;vec2 X=fract(F)-0.5;if(M)X.x=-X.x;if(N)X.y=-X.y;X=A(W)*X+0.5;vec2 Y=1./U1;vec2 Z=T+X*Y;vec2 a=T+Y;if(any(lessThan(Z,T))||any(greaterThan(Z,a))){gl_FragColor=L?I:J;return;}vec4 b=texture2D(U0,Z);if(L)b.rgb=1.-b.rgb;gl_FragColor=mix(J,I,b);}"), this.ss = new S(this.gt, H, `#version 300 es
|
|
377
377
|
precision highp float;in vec2 v_uv;uniform sampler2D Uk;uniform bool Ul;uniform bool Um;uniform bool Un;uniform vec2 Uo;uniform bool Up;uniform vec4 Uq;uniform bool Ur;uniform vec4 Us;uniform vec4 Ut;uniform int Uu;uniform vec3 Uv[64];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 o_rotation;layout(location=4)out vec4 o_transform;float A(vec3 B){return dot(B,vec3(0.299f,0.587f,0.114f));}void main(){vec2 C=vec2(v_uv.x,1.0f-v_uv.y);vec4 D=texture(Uk,C);float E=A(D.rgb);if(Uu>0){float F=float(Uu);float G=clamp(E*(F-1.0f),0.0f,F-1.0f);int H=int(floor(G+0.5f));vec3 I=Uv[H];o_character=vec4(I,1.0f);}else{o_character=vec4(E,0.0f,0.0f,1.0f);}vec4 J=Up?Uq:D;vec4 K=Ur?Us:D;if(D.a<0.01f){J=Ut;K=Ut;}else{}o_primaryColor=vec4(J);o_secondaryColor=vec4(K);o_rotation=vec4(Uo.xy,0.0f,1.0f);o_transform=vec4(float(Ul),float(Um),float(Un),1.0f);}`);
|
|
378
378
|
}
|
|
379
379
|
es() {
|
|
@@ -389,16 +389,16 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uk;uniform bool Ul;uniform
|
|
|
389
389
|
return this.ss;
|
|
390
390
|
}
|
|
391
391
|
hs(t) {
|
|
392
|
-
return new
|
|
392
|
+
return new S(this.gt, H, t);
|
|
393
393
|
}
|
|
394
394
|
cs(t, e) {
|
|
395
|
-
return new
|
|
395
|
+
return new S(this.gt, t, e);
|
|
396
396
|
}
|
|
397
397
|
Dt() {
|
|
398
398
|
this.Qt.Dt(), this.Jt.Dt(), this.ts.Dt(), this.ss.Dt();
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
|
-
var
|
|
401
|
+
var x = ((a) => (a.RECTANGLE = "rectangle", a.LINE = "line", a.ELLIPSE = "ellipse", a.ARC = "arc", a.TRIANGLE = "triangle", a.BEZIER_CURVE = "bezier_curve", a.CUSTOM = "custom", a))(x || {});
|
|
402
402
|
class ut {
|
|
403
403
|
constructor(t) {
|
|
404
404
|
h(this, "gt");
|
|
@@ -413,9 +413,9 @@ class ut {
|
|
|
413
413
|
if (!o) {
|
|
414
414
|
o = r.createVertexArray(), n.set(e, o), r.bindVertexArray(o), r.bindBuffer(r.ARRAY_BUFFER, s);
|
|
415
415
|
const c = r.getAttribLocation(t, "a_position");
|
|
416
|
-
c !== -1 && (r.enableVertexAttribArray(c), r.vertexAttribPointer(c, i.ds.fs.size, r.FLOAT, !1, i.
|
|
416
|
+
c !== -1 && (r.enableVertexAttribArray(c), r.vertexAttribPointer(c, i.ds.fs.size, r.FLOAT, !1, i.ps, i.ds.fs.offset), r.vertexAttribDivisor(c, 0));
|
|
417
417
|
const l = r.getAttribLocation(t, "a_texCoord");
|
|
418
|
-
l !== -1 && (r.enableVertexAttribArray(l), r.vertexAttribPointer(l, i.ds.
|
|
418
|
+
l !== -1 && (r.enableVertexAttribArray(l), r.vertexAttribPointer(l, i.ds._s.size, r.FLOAT, !1, i.ps, i.ds._s.offset), r.vertexAttribDivisor(l, 0));
|
|
419
419
|
}
|
|
420
420
|
r.bindVertexArray(o);
|
|
421
421
|
}
|
|
@@ -436,8 +436,8 @@ class ft {
|
|
|
436
436
|
this.gt = t, this.gs = new ut(t), this.xt = e;
|
|
437
437
|
}
|
|
438
438
|
ws(t, e, i) {
|
|
439
|
-
const { shader: s } = t, r =
|
|
440
|
-
s.Wt({ U9: r[2] / r[3],
|
|
439
|
+
const { shader: s } = t, r = W(this.gt) || this.gt.getParameter(this.gt.VIEWPORT);
|
|
440
|
+
s.Wt({ U9: r[2] / r[3], Uy: [r[2], r[3]] });
|
|
441
441
|
const n = (l) => {
|
|
442
442
|
if (!l || !l.bs()) return;
|
|
443
443
|
const f = l.unitGeometry, u = l.unitBuffer;
|
|
@@ -449,18 +449,18 @@ class ft {
|
|
|
449
449
|
};
|
|
450
450
|
let o = null, c = null;
|
|
451
451
|
for (const l of e) {
|
|
452
|
-
if (l.type ===
|
|
453
|
-
c && (n(c), o = null, c = null), this.Ss(t, l.params, l.state, i.get(
|
|
452
|
+
if (l.type === x.CUSTOM) {
|
|
453
|
+
c && (n(c), o = null, c = null), this.Ss(t, l.params, l.state, i.get(x.RECTANGLE));
|
|
454
454
|
continue;
|
|
455
455
|
}
|
|
456
456
|
o !== null && l.type !== o && (n(c), o = null, c = null);
|
|
457
457
|
let f = c;
|
|
458
|
-
f && l.type === o || (f = i.get(l.type) || null, c = f, o = l.type), f && f
|
|
458
|
+
f && l.type === o || (f = i.get(l.type) || null, c = f, o = l.type), f && f.$s(l.params, l.state);
|
|
459
459
|
}
|
|
460
460
|
n(c);
|
|
461
461
|
}
|
|
462
462
|
Ss(t, e, i, s) {
|
|
463
|
-
const { x: r, y: n, width: o, height: c, shader: l, uniforms: f } = e, u = this
|
|
463
|
+
const { x: r, y: n, width: o, height: c, shader: l, uniforms: f } = e, u = this.Es(Math.max(1, Math.floor(o)), Math.max(1, Math.floor(c)));
|
|
464
464
|
u.begin(), this.Ds(s, l, f, 0, 0, u.width, u.height, {}), u.end();
|
|
465
465
|
const m = this.ks(), p = { Ue: u.textures[0], Uf: u.textures[1], Ug: u.textures[2], Uh: u.textures[3], Ui: u.textures[4], Uj: [u.width, u.height] };
|
|
466
466
|
this.Ds(s, m, p, Math.floor(r), Math.floor(n), Math.max(1, Math.floor(o)), Math.max(1, Math.floor(c)), i), t.shader.Nt();
|
|
@@ -468,7 +468,7 @@ class ft {
|
|
|
468
468
|
Ds(t, e, i, s, r, n, o, c) {
|
|
469
469
|
e.Nt(), e.Wt(i);
|
|
470
470
|
const l = this.gt.getParameter(this.gt.VIEWPORT);
|
|
471
|
-
if (e.Wt({ U9: l[2] / l[3],
|
|
471
|
+
if (e.Wt({ U9: l[2] / l[3], Uy: [l[2], l[3]] }), t.Ps(), t.$s({ x: s, y: r, width: n, height: o }, c), t.bs()) {
|
|
472
472
|
const f = t.unitGeometry, u = t.unitBuffer;
|
|
473
473
|
try {
|
|
474
474
|
this.gs.us(e.Zt, t.type + "", f, u), t.batch.Ms(e), t.batch.Fs(f.zs, f.Rs);
|
|
@@ -480,8 +480,8 @@ class ft {
|
|
|
480
480
|
ks() {
|
|
481
481
|
return this.xt.es();
|
|
482
482
|
}
|
|
483
|
-
|
|
484
|
-
return this.As && this.Cs && this.Cs.w === t && this.Cs.h === e || (this.As && this.As.Dt(), this.As = new
|
|
483
|
+
Es(t, e) {
|
|
484
|
+
return this.As && this.Cs && this.Cs.w === t && this.Cs.h === e || (this.As && this.As.Dt(), this.As = new j(this.gt, t, e, 5), this.Cs = { w: t, h: e }), this.As;
|
|
485
485
|
}
|
|
486
486
|
Dt() {
|
|
487
487
|
this.gs.Dt(), this.As && this.As.Dt();
|
|
@@ -493,40 +493,40 @@ class dt {
|
|
|
493
493
|
h(this, "Ls", 1);
|
|
494
494
|
h(this, "Os", 0);
|
|
495
495
|
}
|
|
496
|
-
|
|
496
|
+
Hs(t) {
|
|
497
497
|
if (this.Os >= this.Bs.length) {
|
|
498
|
-
const i = { id: this.Ls++, type: t, params: {}, state: { I: 1, N: 0, X: 0, W: 0,
|
|
498
|
+
const i = { id: this.Ls++, type: t, params: {}, state: { I: 1, N: 0, X: 0, W: 0, Y: [0, 0, 0], V: [1, 1, 1, 1], q: [0, 0, 0, 1], K: !1, j: !1, k: !1, L: [0, 0] } };
|
|
499
499
|
this.Bs.push(i);
|
|
500
500
|
}
|
|
501
501
|
const e = this.Bs[this.Os];
|
|
502
502
|
return e.id = this.Ls++, e.type = t, this.Os++, e;
|
|
503
503
|
}
|
|
504
|
-
|
|
505
|
-
const n = this.
|
|
504
|
+
Gs(t, e, i, s, r) {
|
|
505
|
+
const n = this.Hs(x.RECTANGLE);
|
|
506
506
|
return n.params.x = t, n.params.y = e, n.params.width = i, n.params.height = s, r.J(n.state), n.id;
|
|
507
507
|
}
|
|
508
508
|
Is(t, e, i, s, r, n, o) {
|
|
509
|
-
const c = this.
|
|
509
|
+
const c = this.Hs(x.CUSTOM);
|
|
510
510
|
return c.params.x = t, c.params.y = e, c.params.width = i, c.params.height = s, c.params.shader = r, c.params.uniforms = n, o.J(c.state), c.id;
|
|
511
511
|
}
|
|
512
512
|
Ns(t, e, i, s, r, n) {
|
|
513
|
-
const o = this.
|
|
513
|
+
const o = this.Hs(x.LINE);
|
|
514
514
|
return o.params.x1 = t, o.params.y1 = e, o.params.x2 = i, o.params.y2 = s, o.params.thickness = r, n.J(o.state), o.id;
|
|
515
515
|
}
|
|
516
516
|
Xs(t, e, i, s, r) {
|
|
517
|
-
const n = this.
|
|
517
|
+
const n = this.Hs(x.ELLIPSE);
|
|
518
518
|
return n.params.x = t, n.params.y = e, n.params.width = i, n.params.height = s, r.J(n.state), n.id;
|
|
519
519
|
}
|
|
520
520
|
Ws(t, e, i, s, r, n, o) {
|
|
521
|
-
const c = this.
|
|
521
|
+
const c = this.Hs(x.ARC);
|
|
522
522
|
return c.params.x = t, c.params.y = e, c.params.width = i, c.params.height = s, c.params.start = r, c.params.stop = n, o.J(c.state), c.id;
|
|
523
523
|
}
|
|
524
524
|
Ks(t, e, i, s, r, n, o) {
|
|
525
|
-
const c = this.
|
|
525
|
+
const c = this.Hs(x.TRIANGLE);
|
|
526
526
|
return c.params.x1 = t, c.params.y1 = e, c.params.x2 = i, c.params.y2 = s, c.params.x3 = r, c.params.y3 = n, o.J(c.state), c.id;
|
|
527
527
|
}
|
|
528
|
-
|
|
529
|
-
const u = this.
|
|
528
|
+
js(t, e, i, s, r, n, o, c, l, f) {
|
|
529
|
+
const u = this.Hs(x.BEZIER_CURVE);
|
|
530
530
|
return u.params.x1 = t, u.params.y1 = e, u.params.cp1x = i, u.params.cp1y = s, u.params.cp2x = r, u.params.cp2y = n, u.params.x2 = o, u.params.y2 = c, u.params.thickness = l, f.J(u.state), u.id;
|
|
531
531
|
}
|
|
532
532
|
get length() {
|
|
@@ -535,7 +535,7 @@ class dt {
|
|
|
535
535
|
get isEmpty() {
|
|
536
536
|
return this.Os === 0;
|
|
537
537
|
}
|
|
538
|
-
|
|
538
|
+
Ys() {
|
|
539
539
|
this.Os = 0;
|
|
540
540
|
}
|
|
541
541
|
[Symbol.iterator]() {
|
|
@@ -544,28 +544,28 @@ class dt {
|
|
|
544
544
|
return { next: () => t < e ? { value: i[t++], done: !1 } : { value: void 0, done: !0 } };
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
|
-
const
|
|
547
|
+
const M = class M {
|
|
548
548
|
static Vs(t, e, i = 0) {
|
|
549
549
|
var n, o, c, l, f, u, m, p, g, d;
|
|
550
|
-
const s = e || new Float32Array(
|
|
550
|
+
const s = e || new Float32Array(M.FLOATS_PER_INSTANCE);
|
|
551
551
|
let r = i;
|
|
552
|
-
return s[r++] = t.fs[0], s[r++] = t.fs[1], s[r++] = t.Os[0], s[r++] = t.Os[1], s[r++] = t.
|
|
552
|
+
return s[r++] = t.fs[0], s[r++] = t.fs[1], s[r++] = t.Os[0], s[r++] = t.Os[1], s[r++] = t.Y[0], s[r++] = t.Y[1], s[r++] = t.Y[2], s[r++] = t.V[0], s[r++] = t.V[1], s[r++] = t.V[2], s[r++] = t.V[3], s[r++] = t.q[0], s[r++] = t.q[1], s[r++] = t.q[2], s[r++] = t.q[3], s[r++] = t.L[0], s[r++] = t.L[1], s[r++] = t.qs[0], s[r++] = t.qs[1], s[r++] = t.qs[2], s[r++] = t.N, s[r++] = t.X, s[r++] = t.W, s[r++] = t.Zs[0], s[r++] = t.Zs[1], s[r++] = ((n = t.Qs) == null ? void 0 : n[0]) || 0, s[r++] = ((o = t.Qs) == null ? void 0 : o[1]) || 0, s[r++] = ((c = t.Js) == null ? void 0 : c[0]) || 0, s[r++] = ((l = t.Js) == null ? void 0 : l[1]) || 0, s[r++] = ((f = t.te) == null ? void 0 : f[0]) || 0, s[r++] = ((u = t.te) == null ? void 0 : u[1]) || 0, s[r++] = ((m = t.se) == null ? void 0 : m[0]) || 0, s[r++] = ((p = t.se) == null ? void 0 : p[1]) || 0, s[r++] = ((g = t.ee) == null ? void 0 : g[0]) || 0, s[r++] = ((d = t.ee) == null ? void 0 : d[1]) || 0, s;
|
|
553
553
|
}
|
|
554
554
|
static ie(t) {
|
|
555
|
-
const e = t.length *
|
|
555
|
+
const e = t.length * M.FLOATS_PER_INSTANCE, i = new Float32Array(e);
|
|
556
556
|
for (let s = 0; s < t.length; s++) {
|
|
557
|
-
const r = s *
|
|
558
|
-
|
|
557
|
+
const r = s * M.FLOATS_PER_INSTANCE;
|
|
558
|
+
M.Vs(t[s], i, r);
|
|
559
559
|
}
|
|
560
560
|
return i;
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
|
-
h(
|
|
564
|
-
let
|
|
563
|
+
h(M, "BYTES_PER_INSTANCE", 140), h(M, "FLOATS_PER_INSTANCE", 35);
|
|
564
|
+
let _ = M;
|
|
565
565
|
const b = class b {
|
|
566
566
|
};
|
|
567
|
-
h(b, "STRIDE",
|
|
568
|
-
let
|
|
567
|
+
h(b, "STRIDE", _.BYTES_PER_INSTANCE), h(b, "ATTRIBUTES", { a_instancePosition: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 0, divisor: 1 }, a_instanceSize: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 8, divisor: 1 }, a_instanceCharacter: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 16, divisor: 1 }, a_instancePrimaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 28, divisor: 1 }, a_instanceSecondaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 44, divisor: 1 }, a_instanceRotation: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 60, divisor: 1 }, a_instanceTransform: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 68, divisor: 1 }, a_instanceGlobalRotation: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 80, divisor: 1 }, a_instanceRotationCenter: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 92, divisor: 1 }, a_instanceArcAngles: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 100, divisor: 1 }, a_instanceBezierCP1: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 108, divisor: 1 }, a_instanceBezierCP2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 116, divisor: 1 }, a_instanceBezierStart: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 124, divisor: 1 }, a_instanceBezierEnd: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: b.STRIDE, offset: 132, divisor: 1 } });
|
|
568
|
+
let k = b;
|
|
569
569
|
class gt {
|
|
570
570
|
constructor(t, e = 1e3, i = 1.5) {
|
|
571
571
|
h(this, "gt");
|
|
@@ -579,7 +579,7 @@ class gt {
|
|
|
579
579
|
h(this, "ue", null);
|
|
580
580
|
this.gt = t, this.ne = e, this.oe = i, this.fe();
|
|
581
581
|
}
|
|
582
|
-
|
|
582
|
+
$s(t) {
|
|
583
583
|
const e = this.re.length;
|
|
584
584
|
return this.re.push(t), this.ae = !0, e;
|
|
585
585
|
}
|
|
@@ -600,22 +600,22 @@ class gt {
|
|
|
600
600
|
fe() {
|
|
601
601
|
const t = this.gt;
|
|
602
602
|
this.he && t.deleteBuffer(this.he), this.he = t.createBuffer();
|
|
603
|
-
const e = this.ne *
|
|
603
|
+
const e = this.ne * _.BYTES_PER_INSTANCE;
|
|
604
604
|
t.bindBuffer(t.ARRAY_BUFFER, this.he), t.bufferData(t.ARRAY_BUFFER, e, t.DYNAMIC_DRAW), t.bindBuffer(t.ARRAY_BUFFER, null), this.ae = !0, this.ce = 0;
|
|
605
605
|
}
|
|
606
|
-
|
|
606
|
+
pe() {
|
|
607
607
|
if (!this.ae || this.re.length === 0) return;
|
|
608
608
|
const t = this.gt, e = this.re.length;
|
|
609
|
-
this.de(e), (!this.ue || this.ue.length < e *
|
|
610
|
-
const i =
|
|
609
|
+
this.de(e), (!this.ue || this.ue.length < e * _.FLOATS_PER_INSTANCE) && (this.ue = new Float32Array(e * _.FLOATS_PER_INSTANCE));
|
|
610
|
+
const i = _.ie(this.re);
|
|
611
611
|
t.bindBuffer(t.ARRAY_BUFFER, this.he), e <= this.ce ? t.bufferSubData(t.ARRAY_BUFFER, 0, i) : t.bufferData(t.ARRAY_BUFFER, i, t.DYNAMIC_DRAW), t.bindBuffer(t.ARRAY_BUFFER, null), this.ae = !1, this.ce = e;
|
|
612
612
|
}
|
|
613
|
-
|
|
613
|
+
_e(t) {
|
|
614
614
|
let e = this.le.get(t);
|
|
615
615
|
if (!e) {
|
|
616
616
|
e = /* @__PURE__ */ new Map();
|
|
617
617
|
const i = this.gt;
|
|
618
|
-
for (const s in
|
|
618
|
+
for (const s in k.ATTRIBUTES) {
|
|
619
619
|
const r = i.getAttribLocation(t, s);
|
|
620
620
|
r !== -1 && e.set(s, r);
|
|
621
621
|
}
|
|
@@ -626,16 +626,16 @@ class gt {
|
|
|
626
626
|
Ms(t) {
|
|
627
627
|
if (!this.he || this.re.length === 0) return;
|
|
628
628
|
const e = this.gt, i = t.Zt;
|
|
629
|
-
this.
|
|
630
|
-
const s = this.
|
|
629
|
+
this.pe();
|
|
630
|
+
const s = this._e(i);
|
|
631
631
|
e.bindBuffer(e.ARRAY_BUFFER, this.he);
|
|
632
632
|
for (const [r, n] of s) {
|
|
633
|
-
const o =
|
|
633
|
+
const o = k.ATTRIBUTES[r];
|
|
634
634
|
o && (e.enableVertexAttribArray(n), e.vertexAttribPointer(n, o.size, o.type, o.normalized, o.stride, o.offset), e.vertexAttribDivisor(n, o.divisor));
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
637
|
Ts(t) {
|
|
638
|
-
const e = this.gt, i = this.
|
|
638
|
+
const e = this.gt, i = this._e(t.Zt);
|
|
639
639
|
for (const [, s] of i) e.disableVertexAttribArray(s), e.vertexAttribDivisor(s, 0);
|
|
640
640
|
}
|
|
641
641
|
Fs(t, e) {
|
|
@@ -645,20 +645,20 @@ class gt {
|
|
|
645
645
|
this.he && this.gt.deleteBuffer(this.he);
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
|
-
class
|
|
648
|
+
class B {
|
|
649
649
|
constructor(t, e, i, s) {
|
|
650
650
|
h(this, "gt");
|
|
651
|
-
h(this, "ve");
|
|
652
651
|
h(this, "me");
|
|
652
|
+
h(this, "ve");
|
|
653
653
|
h(this, "ge");
|
|
654
654
|
h(this, "Ae", null);
|
|
655
|
-
this.gt = t, this.
|
|
655
|
+
this.gt = t, this.me = e, this.ve = i, this.ge = s;
|
|
656
656
|
const r = this.gt.createBuffer();
|
|
657
657
|
if (!r) throw Error("Failed to create unit geometry buffer");
|
|
658
658
|
this.gt.bindBuffer(this.gt.ARRAY_BUFFER, r), this.gt.bufferData(this.gt.ARRAY_BUFFER, this.ge.ye, this.gt.STATIC_DRAW), this.gt.bindBuffer(this.gt.ARRAY_BUFFER, null), this.Ae = r;
|
|
659
659
|
}
|
|
660
660
|
get type() {
|
|
661
|
-
return this.
|
|
661
|
+
return this.ve;
|
|
662
662
|
}
|
|
663
663
|
get unitGeometry() {
|
|
664
664
|
return this.ge;
|
|
@@ -667,23 +667,23 @@ class S {
|
|
|
667
667
|
return this.Ae;
|
|
668
668
|
}
|
|
669
669
|
get batch() {
|
|
670
|
-
return this.
|
|
670
|
+
return this.me;
|
|
671
671
|
}
|
|
672
672
|
Ps() {
|
|
673
|
-
this.
|
|
673
|
+
this.me.clear();
|
|
674
674
|
}
|
|
675
675
|
bs() {
|
|
676
|
-
return !this.
|
|
676
|
+
return !this.me.isEmpty;
|
|
677
677
|
}
|
|
678
678
|
Dt() {
|
|
679
|
-
this.
|
|
679
|
+
this.me.Dt(), this.gt.deleteBuffer(this.Ae);
|
|
680
680
|
}
|
|
681
681
|
Ce(t, e, i, s, r) {
|
|
682
682
|
const n = this.we(t, e, i, s, r.N || 0, r.X || 0, r.W || 0);
|
|
683
|
-
return { fs: [t, e], Os: [i, s],
|
|
683
|
+
return { fs: [t, e], Os: [i, s], Y: r.Y || [0, 0, 0], V: r.V || [1, 1, 1, 1], q: r.q || [0, 0, 0, 1], L: r.L || [0, 0], qs: [r.k ? 1 : 0, r.K ? 1 : 0, r.j ? 1 : 0], N: n.radiansX, X: n.radiansY, W: n.radiansZ, Zs: [n.centerX, n.centerY] };
|
|
684
684
|
}
|
|
685
685
|
be(t, e) {
|
|
686
|
-
const i =
|
|
686
|
+
const i = W(this.gt) || [0, 0, this.gt.canvas.width, this.gt.canvas.height];
|
|
687
687
|
return { nx: t / i[2] * 2 - 1, ny: 1 - e / i[3] * 2 };
|
|
688
688
|
}
|
|
689
689
|
xe(t, e, i) {
|
|
@@ -691,28 +691,28 @@ class S {
|
|
|
691
691
|
t.Zs = [s.nx, s.ny];
|
|
692
692
|
}
|
|
693
693
|
we(t, e, i, s, r, n, o) {
|
|
694
|
-
const c =
|
|
694
|
+
const c = W(this.gt) || [0, 0, this.gt.canvas.width, this.gt.canvas.height], l = c[2], f = c[3];
|
|
695
695
|
return { centerX: (t + i / 2) / l * 2 - 1, centerY: 1 - (e + s / 2) / f * 2, radiansX: -r * Math.PI / 180, radiansY: -n * Math.PI / 180, radiansZ: -o * Math.PI / 180, aspectRatio: l / f };
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
|
-
const mt = { ye: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1]), Rs: 6, zs: WebGL2RenderingContext.TRIANGLES,
|
|
699
|
-
class At extends
|
|
698
|
+
const mt = { ye: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1]), Rs: 6, zs: WebGL2RenderingContext.TRIANGLES, ps: 16, ds: { fs: { size: 2, offset: 0 }, _s: { size: 2, offset: 8 } } };
|
|
699
|
+
class At extends B {
|
|
700
700
|
constructor(t, e) {
|
|
701
|
-
super(t, e,
|
|
701
|
+
super(t, e, x.RECTANGLE, mt);
|
|
702
702
|
}
|
|
703
|
-
|
|
703
|
+
$s(t, e) {
|
|
704
704
|
const i = this.Ce(t.x, t.y, t.width, t.height, e);
|
|
705
|
-
return this.
|
|
705
|
+
return this.me.$s(i);
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
const pt = { ye: new Float32Array([0, -0.5, 0, 0, 1, -0.5, 1, 0, 0, 0.5, 0, 1, 0, 0.5, 0, 1, 1, -0.5, 1, 0, 1, 0.5, 1, 1]), Rs: 6, zs: WebGL2RenderingContext.TRIANGLES,
|
|
709
|
-
class vt extends
|
|
708
|
+
const pt = { ye: new Float32Array([0, -0.5, 0, 0, 1, -0.5, 1, 0, 0, 0.5, 0, 1, 0, 0.5, 0, 1, 1, -0.5, 1, 0, 1, 0.5, 1, 1]), Rs: 6, zs: WebGL2RenderingContext.TRIANGLES, ps: 16, ds: { fs: { size: 2, offset: 0 }, _s: { size: 2, offset: 8 } } };
|
|
709
|
+
class vt extends B {
|
|
710
710
|
constructor(t, e) {
|
|
711
|
-
super(t, e,
|
|
711
|
+
super(t, e, x.LINE, pt);
|
|
712
712
|
}
|
|
713
|
-
|
|
713
|
+
$s(t, e) {
|
|
714
714
|
const i = t.x2 - t.x1, s = t.y2 - t.y1, r = Math.hypot(i, s), n = t.thickness || e.I || 1, o = t.x1 + i / 2, c = t.y1 + s / 2, l = o - r / 2, f = c, u = this.Ce(l, f, r, n, e);
|
|
715
|
-
return this.xe(u, o, c), this.
|
|
715
|
+
return this.xe(u, o, c), this.me.$s(u);
|
|
716
716
|
}
|
|
717
717
|
}
|
|
718
718
|
const yt = { ye: function(a = 32) {
|
|
@@ -722,41 +722,41 @@ const yt = { ye: function(a = 32) {
|
|
|
722
722
|
t.push(0, 0, 0.5, 0.5, n, o, c, l, f, u, m, p);
|
|
723
723
|
}
|
|
724
724
|
return new Float32Array(t);
|
|
725
|
-
}(32), Rs: 96, zs: WebGL2RenderingContext.TRIANGLES,
|
|
726
|
-
class
|
|
725
|
+
}(32), Rs: 96, zs: WebGL2RenderingContext.TRIANGLES, ps: 16, ds: { fs: { size: 2, offset: 0 }, _s: { size: 2, offset: 8 } } };
|
|
726
|
+
class xt extends B {
|
|
727
727
|
constructor(t, e) {
|
|
728
|
-
super(t, e,
|
|
728
|
+
super(t, e, x.ELLIPSE, yt);
|
|
729
729
|
}
|
|
730
|
-
|
|
730
|
+
$s(t, e) {
|
|
731
731
|
const i = this.Ce(t.x, t.y, t.width, t.height, e);
|
|
732
|
-
return this.xe(i, t.x, t.y), this.
|
|
732
|
+
return this.xe(i, t.x, t.y), this.me.$s(i);
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
|
-
let
|
|
735
|
+
let Et = { ye: function(a) {
|
|
736
736
|
const t = [];
|
|
737
737
|
for (let e = 0; e < a; e++) {
|
|
738
738
|
const i = e / a, s = (e + 1) / a;
|
|
739
739
|
t.push(i, 0, i, 0, i, 1, i, 1, s, 1, s, 1);
|
|
740
740
|
}
|
|
741
741
|
return new Float32Array(t);
|
|
742
|
-
}(32), Rs: 96, zs: WebGL2RenderingContext.TRIANGLES,
|
|
743
|
-
class wt extends
|
|
742
|
+
}(32), Rs: 96, zs: WebGL2RenderingContext.TRIANGLES, ps: 16, ds: { fs: { size: 2, offset: 0 }, _s: { size: 2, offset: 8 } } };
|
|
743
|
+
class wt extends B {
|
|
744
744
|
constructor(t, e) {
|
|
745
|
-
super(t, e,
|
|
745
|
+
super(t, e, x.ARC, Et);
|
|
746
746
|
}
|
|
747
|
-
|
|
747
|
+
$s(t, e) {
|
|
748
748
|
const i = t.x - t.width / 2, s = t.y - t.height / 2, r = t.start * Math.PI / 180, n = t.stop * Math.PI / 180, o = this.Ce(i, s, t.width, t.height, e);
|
|
749
|
-
return this.xe(o, t.x, t.y), o.Qs = [r, n], this.
|
|
749
|
+
return this.xe(o, t.x, t.y), o.Qs = [r, n], this.me.$s(o);
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
|
-
const Tt = { ye: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Rs: 3, zs: WebGL2RenderingContext.TRIANGLES,
|
|
753
|
-
class Rt extends
|
|
752
|
+
const Tt = { ye: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Rs: 3, zs: WebGL2RenderingContext.TRIANGLES, ps: 16, ds: { fs: { size: 2, offset: 0 }, _s: { size: 2, offset: 8 } } };
|
|
753
|
+
class Rt extends B {
|
|
754
754
|
constructor(t, e) {
|
|
755
|
-
super(t, e,
|
|
755
|
+
super(t, e, x.TRIANGLE, Tt);
|
|
756
756
|
}
|
|
757
|
-
|
|
757
|
+
$s(t, e) {
|
|
758
758
|
const i = Math.min(t.x1, t.x2, t.x3), s = Math.max(t.x1, t.x2, t.x3), r = Math.min(t.y1, t.y2, t.y3), n = s - i, o = Math.max(t.y1, t.y2, t.y3) - r, c = this.Ce(i, r, n, o, e), l = i + 0.5 * n, f = r + o * (1 / 3);
|
|
759
|
-
return this.xe(c, l, f), this.
|
|
759
|
+
return this.xe(c, l, f), this.me.$s(c);
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
762
|
function $(a, t, e, i, s) {
|
|
@@ -770,14 +770,14 @@ const bt = { ye: function(a = 16) {
|
|
|
770
770
|
t.push(i, -0.5, i, 0), t.push(s, -0.5, s, 0), t.push(i, 0.5, i, 1), t.push(i, 0.5, i, 1), t.push(s, -0.5, s, 0), t.push(s, 0.5, s, 1);
|
|
771
771
|
}
|
|
772
772
|
return new Float32Array(t);
|
|
773
|
-
}(16), Rs: 96, zs: WebGL2RenderingContext.TRIANGLES,
|
|
774
|
-
class Ct extends
|
|
773
|
+
}(16), Rs: 96, zs: WebGL2RenderingContext.TRIANGLES, ps: 16, ds: { fs: { size: 2, offset: 0 }, _s: { size: 2, offset: 8 } } };
|
|
774
|
+
class Ct extends B {
|
|
775
775
|
constructor(t, e) {
|
|
776
|
-
super(t, e,
|
|
776
|
+
super(t, e, x.BEZIER_CURVE, bt);
|
|
777
777
|
}
|
|
778
|
-
|
|
778
|
+
$s(t, e) {
|
|
779
779
|
const i = e.I || 1, s = $(0.5, t.x1, t.cp1x, t.cp2x, t.x2), r = $(0.5, t.y1, t.cp1y, t.cp2y, t.y2), n = this.Ce(0, 0, 1, i, e);
|
|
780
|
-
return this.xe(n, s, r), n.se = [t.x1, t.y1], n.Js = [t.cp1x, t.cp1y], n.te = [t.cp2x, t.cp2y], n.ee = [t.x2, t.y2], this.
|
|
780
|
+
return this.xe(n, s, r), n.se = [t.x1, t.y1], n.Js = [t.cp1x, t.cp1y], n.te = [t.cp2x, t.cp2y], n.ee = [t.x2, t.y2], this.me.$s(n);
|
|
781
781
|
}
|
|
782
782
|
}
|
|
783
783
|
class Ut {
|
|
@@ -790,16 +790,16 @@ class Ut {
|
|
|
790
790
|
h(this, "Te", null);
|
|
791
791
|
h(this, "Pe", /* @__PURE__ */ new Map());
|
|
792
792
|
h(this, "Se");
|
|
793
|
-
h(this, "Ee");
|
|
794
793
|
h(this, "$e");
|
|
795
|
-
h(this, "
|
|
796
|
-
|
|
794
|
+
h(this, "Ee");
|
|
795
|
+
h(this, "H", []);
|
|
796
|
+
this.gt = t, this.Fe = new lt(t), this.Ee = new it(), this.Se = new ft(t, this), this.$e = new dt(), this.Te = t.createBuffer(), Y(this.gt, [0, 0, this.gt.canvas.width, this.gt.canvas.height]);
|
|
797
797
|
}
|
|
798
798
|
De(t) {
|
|
799
799
|
let e = this.Pe.get(t);
|
|
800
800
|
if (e) return e;
|
|
801
801
|
const i = new gt(this.gt);
|
|
802
|
-
return e = (0, { [
|
|
802
|
+
return e = (0, { [x.RECTANGLE]: () => new At(this.gt, i), [x.LINE]: () => new vt(this.gt, i), [x.ELLIPSE]: () => new xt(this.gt, i), [x.ARC]: () => new wt(this.gt, i), [x.TRIANGLE]: () => new Rt(this.gt, i), [x.BEZIER_CURVE]: () => new Ct(this.gt, i) }[t])(), this.Pe.set(t, e), e;
|
|
803
803
|
}
|
|
804
804
|
ke(t) {
|
|
805
805
|
this.Me !== t && (this.Me = t, t.Nt());
|
|
@@ -833,11 +833,11 @@ class Ut {
|
|
|
833
833
|
}
|
|
834
834
|
Oe(t, e, i, s, r) {
|
|
835
835
|
const n = this.es(), o = { Ue: t.textures[0], Uf: t.textures[1], Ug: t.textures[2], Uh: t.textures[3], Ui: t.textures[4], Uj: [t.width, t.height] };
|
|
836
|
-
this.
|
|
836
|
+
this.$e.Is(e, i, s, r, n, o, this.Ee);
|
|
837
837
|
}
|
|
838
|
-
|
|
839
|
-
const n = this.ns(), o = t.
|
|
840
|
-
this.
|
|
838
|
+
He(t, e, i, s, r) {
|
|
839
|
+
const n = this.ns(), o = t.Ge(), c = { Uk: o.texture, Ul: !!o.invert, Um: !!o.flipX, Un: !!o.flipY, Uo: o.charRotation, Up: o.charColorFixed, Uq: o.charColor, Ur: o.cellColorFixed, Us: o.cellColor, Ut: o.backgroundColor, Uu: o.charCount, Uv: o.charList };
|
|
840
|
+
this.$e.Is(e, i, s, r, n, c, this.Ee);
|
|
841
841
|
}
|
|
842
842
|
Ie(t, e, i, s) {
|
|
843
843
|
var d;
|
|
@@ -847,59 +847,59 @@ class Ut {
|
|
|
847
847
|
g !== -1 && (r.enableVertexAttribArray(g), r.vertexAttribPointer(g, 2, r.FLOAT, !1, 8, 0)), r.drawArrays(r.TRIANGLES, 0, 6), g !== -1 && r.disableVertexAttribArray(g);
|
|
848
848
|
}
|
|
849
849
|
Ne(t, e, i, s) {
|
|
850
|
-
this.ze ? (this.
|
|
850
|
+
this.ze ? (this.$e.Is(t, e, i, s, this.ze, { ...this.Re }, this.Ee), this.ze = null, this.Re = {}) : this.$e.Gs(t, e, i, s, this.Ee);
|
|
851
851
|
}
|
|
852
852
|
Xe(t, e, i, s) {
|
|
853
|
-
this.
|
|
853
|
+
this.$e.Ns(t, e, i, s, this.Ee.lineWeight, this.Ee);
|
|
854
854
|
}
|
|
855
855
|
We(t, e, i, s) {
|
|
856
|
-
this.
|
|
856
|
+
this.$e.Xs(t, e, i, s, this.Ee);
|
|
857
857
|
}
|
|
858
858
|
Ke(t, e, i, s, r, n) {
|
|
859
|
-
this.
|
|
859
|
+
this.$e.Ks(t, e, i, s, r, n, this.Ee);
|
|
860
860
|
}
|
|
861
|
-
|
|
862
|
-
const l = this
|
|
863
|
-
this.
|
|
861
|
+
je(t, e, i, s, r, n, o, c) {
|
|
862
|
+
const l = this.Ee.lineWeight;
|
|
863
|
+
this.$e.js(t, e, i, s, r, n, o, c, l, this.Ee);
|
|
864
864
|
}
|
|
865
|
-
|
|
866
|
-
return new
|
|
865
|
+
Ye(t, e, i = 1, s = {}) {
|
|
866
|
+
return new j(this.gt, t, e, i, s, this, !0);
|
|
867
867
|
}
|
|
868
868
|
Ve(t, e, i, s, r, n) {
|
|
869
|
-
this.
|
|
869
|
+
this.$e.Ws(t, e, i, s, r, n, this.Ee);
|
|
870
870
|
}
|
|
871
871
|
qe(t, e = t, i = t, s = 255) {
|
|
872
|
-
this
|
|
872
|
+
this.Ee.ft(t, e, i, s), this.Ys(t / 255, e / 255, i / 255, s / 255);
|
|
873
873
|
}
|
|
874
|
-
|
|
874
|
+
Ys(t = 0, e = 0, i = 0, s = 0) {
|
|
875
875
|
this.gt.clearColor(t, e, i, s), this.gt.clear(this.gt.COLOR_BUFFER_BIT);
|
|
876
876
|
}
|
|
877
877
|
Ze() {
|
|
878
|
-
this.gt.viewport(0, 0, this.gt.canvas.width, this.gt.canvas.height),
|
|
878
|
+
this.gt.viewport(0, 0, this.gt.canvas.width, this.gt.canvas.height), Y(this.gt, [0, 0, this.gt.canvas.width, this.gt.canvas.height]);
|
|
879
879
|
}
|
|
880
880
|
get context() {
|
|
881
881
|
return this.gt;
|
|
882
882
|
}
|
|
883
883
|
get state() {
|
|
884
|
-
return this
|
|
884
|
+
return this.Ee;
|
|
885
885
|
}
|
|
886
|
-
|
|
887
|
-
this.
|
|
886
|
+
$t(t) {
|
|
887
|
+
this.H.push(this.Ee), this.Ee = t;
|
|
888
888
|
}
|
|
889
|
-
|
|
890
|
-
const t = this.
|
|
891
|
-
t && (this
|
|
889
|
+
Et() {
|
|
890
|
+
const t = this.H.pop();
|
|
891
|
+
t && (this.Ee = t);
|
|
892
892
|
}
|
|
893
893
|
St(t) {
|
|
894
|
-
const e = t, i =
|
|
894
|
+
const e = t, i = W(this.gt) ?? this.gt.getParameter(this.gt.VIEWPORT), s = { shader: e, gl: this.gt, viewport: i };
|
|
895
895
|
this.ke(e);
|
|
896
896
|
const r = /* @__PURE__ */ new Set();
|
|
897
|
-
for (const n of this
|
|
898
|
-
for (const n of r) n !==
|
|
899
|
-
this.Se.ws(s, this
|
|
897
|
+
for (const n of this.$e) n.type === x.CUSTOM ? r.add(x.RECTANGLE) : r.add(n.type);
|
|
898
|
+
for (const n of r) n !== x.CUSTOM && this.De(n);
|
|
899
|
+
this.Se.ws(s, this.$e, this.Pe), this.$e.Ys();
|
|
900
900
|
}
|
|
901
901
|
Dt() {
|
|
902
|
-
this.gt.deleteBuffer(this.Te), this.
|
|
902
|
+
this.gt.deleteBuffer(this.Te), this.$e.Ys();
|
|
903
903
|
for (const t of this.Pe.values()) t.Dt();
|
|
904
904
|
this.Fe.Dt(), this.Se.Dt();
|
|
905
905
|
}
|
|
@@ -925,17 +925,17 @@ const w = { readShort: (a, t) => (w.t.uint16[0] = a[t] << 8 | a[t + 1], w.t.int1
|
|
|
925
925
|
const a = new ArrayBuffer(8);
|
|
926
926
|
return { uint8: new Uint8Array(a), int16: new Int16Array(a), uint16: new Uint16Array(a), uint32: new Uint32Array(a) };
|
|
927
927
|
})() };
|
|
928
|
-
function
|
|
928
|
+
function X(a) {
|
|
929
929
|
return a + 3 & -4;
|
|
930
930
|
}
|
|
931
|
-
function
|
|
931
|
+
function V(a, t, e) {
|
|
932
932
|
const i = t + e;
|
|
933
933
|
let s = 0;
|
|
934
934
|
const r = w.t;
|
|
935
935
|
for (let n = t; n < i; n += 4) r.uint8[3] = a[n] || 0, r.uint8[2] = a[n + 1] || 0, r.uint8[1] = a[n + 2] || 0, r.uint8[0] = a[n + 3] || 0, s = s + (r.uint32[0] >>> 0) >>> 0;
|
|
936
936
|
return s >>> 0;
|
|
937
937
|
}
|
|
938
|
-
class
|
|
938
|
+
class Ft {
|
|
939
939
|
constructor(t) {
|
|
940
940
|
h(this, "b");
|
|
941
941
|
h(this, "p", 0);
|
|
@@ -958,7 +958,7 @@ class Bt {
|
|
|
958
958
|
return this.p;
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
|
-
function
|
|
961
|
+
function N(a) {
|
|
962
962
|
let t = 32, e = 0;
|
|
963
963
|
for (const o of a) o && (o < t && (t = o), o > e && (e = o));
|
|
964
964
|
if (e === 0) return { min: 0, max: 0, table: /* @__PURE__ */ new Map() };
|
|
@@ -974,11 +974,11 @@ function z(a) {
|
|
|
974
974
|
if (!c) continue;
|
|
975
975
|
const l = s[c]++;
|
|
976
976
|
let f = n.get(c);
|
|
977
|
-
f || (f = [], n.set(c, f)), f[
|
|
977
|
+
f || (f = [], n.set(c, f)), f[Pt(l, c)] = o;
|
|
978
978
|
}
|
|
979
979
|
return { min: t, max: e, table: n };
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function q(a, t) {
|
|
982
982
|
let e = 0;
|
|
983
983
|
for (let i = 1; i <= t.max; i++) {
|
|
984
984
|
e |= a.readBits(1) << i - 1;
|
|
@@ -990,12 +990,12 @@ function V(a, t) {
|
|
|
990
990
|
}
|
|
991
991
|
throw Error("Invalid Huffman code");
|
|
992
992
|
}
|
|
993
|
-
function
|
|
993
|
+
function Pt(a, t) {
|
|
994
994
|
let e = 0;
|
|
995
995
|
for (let i = 0; i < t; i++) e = e << 1 | 1 & a, a >>>= 1;
|
|
996
996
|
return e >>> 0;
|
|
997
997
|
}
|
|
998
|
-
function
|
|
998
|
+
function Ot(a) {
|
|
999
999
|
if (a.length < 2) throw Error("ZLIB data too short");
|
|
1000
1000
|
const t = a[0], e = a[1];
|
|
1001
1001
|
if ((15 & t) != 8) throw Error("Unsupported ZLIB compression method");
|
|
@@ -1024,70 +1024,70 @@ function Lt(a) {
|
|
|
1024
1024
|
for (let v = 144; v <= 255; v++) d[v] = 9;
|
|
1025
1025
|
for (let v = 256; v <= 279; v++) d[v] = 7;
|
|
1026
1026
|
for (let v = 280; v <= 287; v++) d[v] = 8;
|
|
1027
|
-
p =
|
|
1027
|
+
p = N(d), g = N(Array(32).fill(5));
|
|
1028
1028
|
} else {
|
|
1029
|
-
const d = r.readBits(5) + 257, v = r.readBits(5) + 1, A = r.readBits(4) + 4,
|
|
1030
|
-
for (let
|
|
1031
|
-
const U =
|
|
1029
|
+
const d = r.readBits(5) + 257, v = r.readBits(5) + 1, A = r.readBits(4) + 4, E = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], y = Array(19).fill(0);
|
|
1030
|
+
for (let F = 0; F < A; F++) y[E[F]] = r.readBits(3);
|
|
1031
|
+
const U = N(y), T = [];
|
|
1032
1032
|
for (; T.length < d + v; ) {
|
|
1033
|
-
const
|
|
1034
|
-
if (
|
|
1035
|
-
else if (
|
|
1036
|
-
const I = r.readBits(2) + 3,
|
|
1037
|
-
for (let J = 0; J < I; J++) T.push(
|
|
1038
|
-
} else if (
|
|
1033
|
+
const F = q(r, U);
|
|
1034
|
+
if (F <= 15) T.push(F);
|
|
1035
|
+
else if (F === 16) {
|
|
1036
|
+
const I = r.readBits(2) + 3, L = T[T.length - 1] || 0;
|
|
1037
|
+
for (let J = 0; J < I; J++) T.push(L);
|
|
1038
|
+
} else if (F === 17) {
|
|
1039
1039
|
const I = r.readBits(3) + 3;
|
|
1040
|
-
for (let
|
|
1040
|
+
for (let L = 0; L < I; L++) T.push(0);
|
|
1041
1041
|
} else {
|
|
1042
|
-
if (
|
|
1042
|
+
if (F !== 18) throw Error("Invalid code length symbol");
|
|
1043
1043
|
{
|
|
1044
1044
|
const I = r.readBits(7) + 11;
|
|
1045
|
-
for (let
|
|
1045
|
+
for (let L = 0; L < I; L++) T.push(0);
|
|
1046
1046
|
}
|
|
1047
1047
|
}
|
|
1048
1048
|
}
|
|
1049
|
-
const R = T.slice(0, d),
|
|
1050
|
-
p =
|
|
1049
|
+
const R = T.slice(0, d), P = T.slice(d, d + v);
|
|
1050
|
+
p = N(R), g = N(P);
|
|
1051
1051
|
}
|
|
1052
1052
|
for (; ; ) {
|
|
1053
|
-
const d =
|
|
1053
|
+
const d = q(r, p);
|
|
1054
1054
|
if (d < 256) n.push(d);
|
|
1055
1055
|
else {
|
|
1056
1056
|
if (d === 256) break;
|
|
1057
1057
|
if (d > 256 && d < 286) {
|
|
1058
1058
|
const v = d - 257;
|
|
1059
1059
|
let A = o[v];
|
|
1060
|
-
const
|
|
1061
|
-
|
|
1062
|
-
const y =
|
|
1060
|
+
const E = c[v];
|
|
1061
|
+
E && (A += r.readBits(E));
|
|
1062
|
+
const y = q(r, g);
|
|
1063
1063
|
if (y >= 30) throw Error("Invalid distance symbol");
|
|
1064
1064
|
let U = l[y];
|
|
1065
1065
|
const T = f[y];
|
|
1066
1066
|
T && (U += r.readBits(T));
|
|
1067
1067
|
const R = n.length - U;
|
|
1068
1068
|
if (R < 0) throw Error("Invalid distance");
|
|
1069
|
-
for (let
|
|
1069
|
+
for (let P = 0; P < A; P++) n.push(n[R + P] || 0);
|
|
1070
1070
|
} else if (d === 286 || d === 287) throw Error("Reserved length symbol");
|
|
1071
1071
|
}
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
1076
|
-
}(new
|
|
1076
|
+
}(new Ft(a.subarray(i)), s), new Uint8Array(s);
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function Mt(a) {
|
|
1079
1079
|
const t = w, e = new Uint8Array(a);
|
|
1080
1080
|
if (t.readASCII(e, 0, 4) !== "wOFF") throw Error("Invalid WOFF signature");
|
|
1081
1081
|
const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), n = [];
|
|
1082
1082
|
let o = 44;
|
|
1083
1083
|
for (let A = 0; A < s; A++) {
|
|
1084
|
-
const
|
|
1085
|
-
n.push({ tag:
|
|
1084
|
+
const E = t.readASCII(e, o, 4), y = t.readUint(e, o + 4), U = t.readUint(e, o + 8), T = t.readUint(e, o + 12), R = t.readUint(e, o + 16);
|
|
1085
|
+
n.push({ tag: E, offset: y, compLength: U, origLength: T, checksum: R }), o += 20;
|
|
1086
1086
|
}
|
|
1087
1087
|
for (const A of n) {
|
|
1088
|
-
const
|
|
1089
|
-
if (A.compLength === A.origLength) A.data = new Uint8Array(
|
|
1090
|
-
else if (A.data =
|
|
1088
|
+
const E = new Uint8Array(e.buffer, A.offset, A.compLength);
|
|
1089
|
+
if (A.compLength === A.origLength) A.data = new Uint8Array(E);
|
|
1090
|
+
else if (A.data = Ot(E), A.data.length !== A.origLength) if (A.data.length < A.origLength) {
|
|
1091
1091
|
const y = new Uint8Array(A.origLength);
|
|
1092
1092
|
y.set(A.data), A.data = y;
|
|
1093
1093
|
} else A.data = A.data.subarray(0, A.origLength);
|
|
@@ -1098,40 +1098,40 @@ function Pt(a) {
|
|
|
1098
1098
|
const u = 16 * l, m = 16 * c - u;
|
|
1099
1099
|
let p = 12 + 16 * c;
|
|
1100
1100
|
const g = {};
|
|
1101
|
-
for (const A of n) g[A.tag] = p, p =
|
|
1101
|
+
for (const A of n) g[A.tag] = p, p = X(p + A.data.length);
|
|
1102
1102
|
const d = new Uint8Array(Math.max(r || 0, p));
|
|
1103
1103
|
t.writeUint(d, 0, i), t.writeUshort(d, 4, c), t.writeUshort(d, 6, u), t.writeUshort(d, 8, f), t.writeUshort(d, 10, m);
|
|
1104
1104
|
let v = 12;
|
|
1105
1105
|
for (const A of n) {
|
|
1106
1106
|
t.writeASCII(d, v, A.tag), v += 4;
|
|
1107
|
-
let
|
|
1108
|
-
if (A.tag === "head" &&
|
|
1109
|
-
const y = new Uint8Array(
|
|
1107
|
+
let E = A.data;
|
|
1108
|
+
if (A.tag === "head" && E.length >= 12) {
|
|
1109
|
+
const y = new Uint8Array(E);
|
|
1110
1110
|
t.writeUint(y, 8, 0);
|
|
1111
|
-
const U =
|
|
1111
|
+
const U = V(y, 0, X(y.length));
|
|
1112
1112
|
t.writeUint(d, v, U), v += 4;
|
|
1113
1113
|
} else {
|
|
1114
|
-
const y =
|
|
1114
|
+
const y = V(E, 0, X(E.length));
|
|
1115
1115
|
t.writeUint(d, v, y), v += 4;
|
|
1116
1116
|
}
|
|
1117
1117
|
t.writeUint(d, v, g[A.tag]), v += 4, t.writeUint(d, v, A.data.length), v += 4;
|
|
1118
1118
|
}
|
|
1119
1119
|
for (const A of n) {
|
|
1120
|
-
const
|
|
1121
|
-
d.set(A.data,
|
|
1120
|
+
const E = g[A.tag];
|
|
1121
|
+
d.set(A.data, E);
|
|
1122
1122
|
}
|
|
1123
1123
|
if (n.find((A) => A.tag === "head")) {
|
|
1124
|
-
const A = g.head,
|
|
1125
|
-
const T = w, R = U + 8,
|
|
1124
|
+
const A = g.head, E = function(y, U) {
|
|
1125
|
+
const T = w, R = U + 8, P = [y[R], y[R + 1], y[R + 2], y[R + 3]];
|
|
1126
1126
|
T.writeUint(y, R, 0);
|
|
1127
|
-
const
|
|
1128
|
-
return y[R] =
|
|
1127
|
+
const F = 2981146554 - (V(y, 0, X(y.length)) >>> 0) >>> 0;
|
|
1128
|
+
return y[R] = P[0], y[R + 1] = P[1], y[R + 2] = P[2], y[R + 3] = P[3], F >>> 0;
|
|
1129
1129
|
}(d, A);
|
|
1130
|
-
t.writeUint(d, A + 8,
|
|
1130
|
+
t.writeUint(d, A + 8, E);
|
|
1131
1131
|
}
|
|
1132
1132
|
return d.buffer;
|
|
1133
1133
|
}
|
|
1134
|
-
const
|
|
1134
|
+
const Lt = { parseTab(a, t, e) {
|
|
1135
1135
|
const i = { tables: [], ids: {}, off: t };
|
|
1136
1136
|
a = new Uint8Array(a.buffer, t, e), t = 0;
|
|
1137
1137
|
const s = w, r = s.readUshort, n = r(a, t += 2);
|
|
@@ -1168,7 +1168,7 @@ const Mt = { parseTab(a, t, e) {
|
|
|
1168
1168
|
const s = new Uint32Array(3 * i);
|
|
1169
1169
|
for (let r = 0; r < 3 * i; r += 3) s[r] = e(a, t + (r << 2)), s[r + 1] = e(a, t + (r << 2) + 4), s[r + 2] = e(a, t + (r << 2) + 8);
|
|
1170
1170
|
return { format: 12, groups: s };
|
|
1171
|
-
} },
|
|
1171
|
+
} }, Dt = { parseTab(a, t, e) {
|
|
1172
1172
|
const i = w;
|
|
1173
1173
|
t += 18;
|
|
1174
1174
|
const s = i.readUshort(a, t);
|
|
@@ -1181,7 +1181,7 @@ const Mt = { parseTab(a, t, e) {
|
|
|
1181
1181
|
t += 2;
|
|
1182
1182
|
const c = i.readShort(a, t);
|
|
1183
1183
|
return t += 2, t += 6, { unitsPerEm: s, xMin: r, yMin: n, xMax: o, yMax: c, indexToLocFormat: i.readShort(a, t) };
|
|
1184
|
-
} },
|
|
1184
|
+
} }, _t = { parseTab(a, t, e) {
|
|
1185
1185
|
const i = w;
|
|
1186
1186
|
t += 4;
|
|
1187
1187
|
const s = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], r = {};
|
|
@@ -1190,16 +1190,16 @@ const Mt = { parseTab(a, t, e) {
|
|
|
1190
1190
|
r[o] = c(a, t + 2 * n);
|
|
1191
1191
|
}
|
|
1192
1192
|
return r;
|
|
1193
|
-
} },
|
|
1193
|
+
} }, St = { parseTab(a, t, e, i) {
|
|
1194
1194
|
const s = w, r = [], n = [], o = i.maxp.numGlyphs, c = i.hhea.numberOfHMetrics;
|
|
1195
1195
|
let l = 0, f = 0, u = 0;
|
|
1196
1196
|
for (; u < c; ) l = s.readUshort(a, t + (u << 2)), f = s.readShort(a, t + (u << 2) + 2), r.push(l), n.push(f), u++;
|
|
1197
1197
|
for (; u < o; ) r.push(l), n.push(f), u++;
|
|
1198
1198
|
return { aWidth: r, lsBearing: n };
|
|
1199
|
-
} }, tt = { cmap:
|
|
1199
|
+
} }, tt = { cmap: Lt, head: Dt, hhea: _t, maxp: { parseTab(a, t, e) {
|
|
1200
1200
|
const i = w;
|
|
1201
1201
|
return i.readUint(a, t), t += 4, { numGlyphs: i.readUshort(a, t) };
|
|
1202
|
-
} }, hmtx:
|
|
1202
|
+
} }, hmtx: St, loca: { parseTab(a, t, e, i) {
|
|
1203
1203
|
const s = w, r = [], n = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
|
|
1204
1204
|
if (n === 0) for (let c = 0; c < o; c++) r.push(s.readUshort(a, t + (c << 1)) << 1);
|
|
1205
1205
|
else if (n === 1) for (let c = 0; c < o; c++) r.push(s.readUint(a, t + (c << 2)));
|
|
@@ -1211,7 +1211,7 @@ const Mt = { parseTab(a, t, e) {
|
|
|
1211
1211
|
}, Qe(a, t) {
|
|
1212
1212
|
const e = w, i = a.Je, s = a.loca;
|
|
1213
1213
|
if (s[t] === s[t + 1]) return null;
|
|
1214
|
-
const r =
|
|
1214
|
+
const r = O.findTable(i, "glyf", a.ti);
|
|
1215
1215
|
if (!r) return null;
|
|
1216
1216
|
let n = r[0] + s[t];
|
|
1217
1217
|
const o = {};
|
|
@@ -1246,14 +1246,14 @@ const Mt = { parseTab(a, t, e) {
|
|
|
1246
1246
|
for (let m = 0; m < l; m++) f += o.xs[m], u += o.ys[m], o.xs[m] = f, o.ys[m] = u;
|
|
1247
1247
|
} else o.parts = [], o.endPts = [], o.flags = [], o.xs = [], o.ys = [];
|
|
1248
1248
|
return o;
|
|
1249
|
-
} } },
|
|
1249
|
+
} } }, O = { parse(a) {
|
|
1250
1250
|
const t = new Uint8Array(a), e = w.readASCII(t, 0, 4);
|
|
1251
|
-
if (e === "wOFF") a =
|
|
1251
|
+
if (e === "wOFF") a = Mt(a);
|
|
1252
1252
|
else if (e === "wOF2") throw Error("WOFF2 is not supported in this build (Brotli + WOFF2 transforms required)");
|
|
1253
1253
|
return [((i, s, r, n) => {
|
|
1254
1254
|
const o = tt, c = { Je: i, si: s, ti: r };
|
|
1255
1255
|
for (const l in o) {
|
|
1256
|
-
const f = l, u =
|
|
1256
|
+
const f = l, u = O.findTable(i, f, r);
|
|
1257
1257
|
if (u) {
|
|
1258
1258
|
const [m, p] = u;
|
|
1259
1259
|
let g = n[m];
|
|
@@ -1274,7 +1274,7 @@ const Mt = { parseTab(a, t, e) {
|
|
|
1274
1274
|
}
|
|
1275
1275
|
return null;
|
|
1276
1276
|
}, T: tt, B: w };
|
|
1277
|
-
class
|
|
1277
|
+
class Bt {
|
|
1278
1278
|
ei(t) {
|
|
1279
1279
|
var i;
|
|
1280
1280
|
const e = [];
|
|
@@ -1351,11 +1351,11 @@ class Z {
|
|
|
1351
1351
|
for (const n of s.tables) if (n.format === 4 ? r = this.fi(e, n) : n.format === 12 && (r = this.di(e, n)), r > 0) break;
|
|
1352
1352
|
return this.ai.set(i, r), r;
|
|
1353
1353
|
}
|
|
1354
|
-
|
|
1354
|
+
pi(t, e) {
|
|
1355
1355
|
const i = e.codePointAt(0);
|
|
1356
1356
|
return i === void 0 ? 0 : this.li(t, i);
|
|
1357
1357
|
}
|
|
1358
|
-
|
|
1358
|
+
_i(t, e) {
|
|
1359
1359
|
const i = t.hmtx;
|
|
1360
1360
|
return i && i.aWidth && i.aWidth.length !== 0 ? e < i.aWidth.length ? i.aWidth[e] : i.aWidth[i.aWidth.length - 1] : 0;
|
|
1361
1361
|
}
|
|
@@ -1407,7 +1407,7 @@ class It {
|
|
|
1407
1407
|
createTextureAtlas(t, e, i, s) {
|
|
1408
1408
|
const r = t.length, n = Math.ceil(Math.sqrt(r)), o = Math.ceil(r / n), c = e.width * n, l = e.height * o, f = typeof s == "object" ? s : null;
|
|
1409
1409
|
this.wi(c, l), this.bi(t, e, n, i, f);
|
|
1410
|
-
const u = this.xt.
|
|
1410
|
+
const u = this.xt.Ye(c, l, 1, { filter: "nearest" });
|
|
1411
1411
|
return u.Tt(this.Ai), { framebuffer: u, columns: n, rows: o };
|
|
1412
1412
|
}
|
|
1413
1413
|
wi(t, e) {
|
|
@@ -1418,7 +1418,7 @@ class It {
|
|
|
1418
1418
|
for (let o = 0; o < t.length; o++) {
|
|
1419
1419
|
const c = o % i, l = Math.floor(o / i), f = t[o].character, u = this.xi(r, f);
|
|
1420
1420
|
if (!u) continue;
|
|
1421
|
-
const m = f.codePointAt(0) || 0, p = this.Ci.li(r, m), g = this.Mi(r, p) * n, d = c * e.width, v = l * e.height, A = d + 0.5 * e.width,
|
|
1421
|
+
const m = f.codePointAt(0) || 0, p = this.Ci.li(r, m), g = this.Mi(r, p) * n, d = c * e.width, v = l * e.height, A = d + 0.5 * e.width, E = v + 0.5 * e.height, y = Math.round(A - 0.5 * e.width), U = Math.round(E - 0.5 * s), T = y + 0.5 * (e.width - g), R = U + r.hhea.ascender * n;
|
|
1422
1422
|
this.Fi(u, T, R, n);
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
@@ -1426,8 +1426,8 @@ class It {
|
|
|
1426
1426
|
const i = e.codePointAt(0) || 0, s = this.Ci.li(t, i);
|
|
1427
1427
|
if (s === 0) return null;
|
|
1428
1428
|
if (t.glyf && t.glyf[s] !== null) return t.glyf[s];
|
|
1429
|
-
if (
|
|
1430
|
-
const r =
|
|
1429
|
+
if (O && O.T && O.T.glyf) {
|
|
1430
|
+
const r = O.T.glyf.Qe(t, s);
|
|
1431
1431
|
return t.glyf && r && (t.glyf[s] = r), r;
|
|
1432
1432
|
}
|
|
1433
1433
|
return null;
|
|
@@ -1457,11 +1457,11 @@ class It {
|
|
|
1457
1457
|
const d = e + r[g] * s, v = i - n[g] * s;
|
|
1458
1458
|
let A = g + 1 > u ? l : g + 1;
|
|
1459
1459
|
if (1 & c[A]) {
|
|
1460
|
-
const
|
|
1461
|
-
this.yi.quadraticCurveTo(d, v,
|
|
1460
|
+
const E = e + r[A] * s, y = i - n[A] * s;
|
|
1461
|
+
this.yi.quadraticCurveTo(d, v, E, y), g = A + 1;
|
|
1462
1462
|
} else {
|
|
1463
|
-
const
|
|
1464
|
-
this.yi.quadraticCurveTo(d, v,
|
|
1463
|
+
const E = (d + (e + r[A] * s)) / 2, y = (v + (i - n[A] * s)) / 2;
|
|
1464
|
+
this.yi.quadraticCurveTo(d, v, E, y), g = A;
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
1467
|
this.yi.closePath();
|
|
@@ -1472,7 +1472,7 @@ class It {
|
|
|
1472
1472
|
this.yi.fill();
|
|
1473
1473
|
}
|
|
1474
1474
|
}
|
|
1475
|
-
class
|
|
1475
|
+
class Nt {
|
|
1476
1476
|
constructor() {
|
|
1477
1477
|
h(this, "zi");
|
|
1478
1478
|
this.zi = new Z();
|
|
@@ -1481,9 +1481,9 @@ class zt {
|
|
|
1481
1481
|
let s = 0;
|
|
1482
1482
|
const r = this.zi.mi(i, e), n = r.lineHeight;
|
|
1483
1483
|
for (const o of t) {
|
|
1484
|
-
const c = this.zi.
|
|
1484
|
+
const c = this.zi.pi(i, o);
|
|
1485
1485
|
if (c === 0) continue;
|
|
1486
|
-
const l = this.zi.
|
|
1486
|
+
const l = this.zi._i(i, c) * r.scale;
|
|
1487
1487
|
s = Math.max(s, l);
|
|
1488
1488
|
}
|
|
1489
1489
|
return { width: Math.ceil(s), height: Math.ceil(n) };
|
|
@@ -1492,7 +1492,7 @@ class zt {
|
|
|
1492
1492
|
this.zi.gi();
|
|
1493
1493
|
}
|
|
1494
1494
|
}
|
|
1495
|
-
class
|
|
1495
|
+
class zt {
|
|
1496
1496
|
constructor() {
|
|
1497
1497
|
h(this, "Ci");
|
|
1498
1498
|
this.Ci = new Z();
|
|
@@ -1512,31 +1512,32 @@ class Nt {
|
|
|
1512
1512
|
return [t % 256 / 255, Math.floor(t / 256) % 256 / 255, Math.floor(t / 65536) % 256 / 255];
|
|
1513
1513
|
}
|
|
1514
1514
|
Pi(t, e) {
|
|
1515
|
-
if (!
|
|
1515
|
+
if (!z.v(typeof t == "string", "Character must be a string.", { method: "getCharacterColor", providedValue: t })) return [0, 0, 0];
|
|
1516
1516
|
const i = e.find((s) => s.character === t);
|
|
1517
1517
|
return i ? i.color : [0, 0, 0];
|
|
1518
1518
|
}
|
|
1519
1519
|
Si(t, e) {
|
|
1520
|
-
return
|
|
1520
|
+
return z.v(typeof t == "string" && t.length > 0, "Characters must be a string with at least one character.", { method: "getCharacterColors", providedValue: t }) ? Array.from(t).map((i) => this.Pi(i, e) || [0, 0, 0]) : [[0, 0, 0]];
|
|
1521
1521
|
}
|
|
1522
1522
|
}
|
|
1523
1523
|
class Gt {
|
|
1524
1524
|
constructor(t, e = 16) {
|
|
1525
|
-
h(this, "
|
|
1526
|
-
h(this, "
|
|
1525
|
+
h(this, "$i");
|
|
1526
|
+
h(this, "Ei", []);
|
|
1527
1527
|
h(this, "Di");
|
|
1528
1528
|
h(this, "ki", 16);
|
|
1529
1529
|
h(this, "Bi", 0);
|
|
1530
1530
|
h(this, "Li", 0);
|
|
1531
1531
|
h(this, "Oi", { width: 0, height: 0 });
|
|
1532
|
-
h(this, "Gi");
|
|
1533
1532
|
h(this, "Hi");
|
|
1533
|
+
h(this, "Gi", /* @__PURE__ */ new Map());
|
|
1534
1534
|
h(this, "Ii");
|
|
1535
1535
|
h(this, "Ni");
|
|
1536
1536
|
h(this, "Xi");
|
|
1537
|
-
|
|
1537
|
+
h(this, "Wi");
|
|
1538
|
+
this.ki = e, this.Ii = new Bt(), this.Ni = new It(t), this.Xi = new Nt(), this.Wi = new zt();
|
|
1538
1539
|
}
|
|
1539
|
-
async
|
|
1540
|
+
async Ki(t) {
|
|
1540
1541
|
let e;
|
|
1541
1542
|
if (t) {
|
|
1542
1543
|
const i = await fetch(t);
|
|
@@ -1544,51 +1545,85 @@ class Gt {
|
|
|
1544
1545
|
e = await i.arrayBuffer();
|
|
1545
1546
|
} else
|
|
1546
1547
|
e = await (await fetch("data:font/woff;base64,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")).arrayBuffer();
|
|
1547
|
-
await this.
|
|
1548
|
+
await this.ji(e), this.$i = O.parse(e)[0], await this.Yi();
|
|
1548
1549
|
}
|
|
1549
|
-
|
|
1550
|
+
Vi(t) {
|
|
1550
1551
|
if (t === void 0) return this.ki;
|
|
1551
|
-
this.ki = t, this.Oi = this.
|
|
1552
|
-
const e = this.
|
|
1552
|
+
this.ki = t, this.Oi = this.Xi.Ri(this.Ei.map((i) => i.character), this.ki, this.$i);
|
|
1553
|
+
const e = this.Ni.createTextureAtlas(this.Ei, this.Oi, this.ki, this.$i);
|
|
1553
1554
|
this.Di = e.framebuffer, this.Bi = e.columns, this.Li = e.rows;
|
|
1554
1555
|
}
|
|
1555
|
-
async
|
|
1556
|
+
async qi(t) {
|
|
1556
1557
|
try {
|
|
1557
1558
|
const e = await fetch(t);
|
|
1558
1559
|
if (!e.ok) throw new C(`Failed to load font file: ${e.status} ${e.statusText}`);
|
|
1559
1560
|
const i = await e.arrayBuffer();
|
|
1560
|
-
await this.
|
|
1561
|
-
const s =
|
|
1561
|
+
await this.ji(i);
|
|
1562
|
+
const s = O.parse(i);
|
|
1562
1563
|
if (!s || s.length === 0) throw Error("Failed to parse font file");
|
|
1563
|
-
this
|
|
1564
|
+
this.$i = s[0], await this.Yi();
|
|
1564
1565
|
} catch (e) {
|
|
1565
1566
|
throw new C("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
|
|
1566
1567
|
}
|
|
1567
1568
|
}
|
|
1568
|
-
async
|
|
1569
|
+
async ji(t) {
|
|
1569
1570
|
const e = Date.now();
|
|
1570
|
-
this.
|
|
1571
|
+
this.Hi = new FontFace("CustomFont_" + e, t), await this.Hi.load(), document.fonts.add(this.Hi);
|
|
1571
1572
|
}
|
|
1572
1573
|
async Yi() {
|
|
1573
|
-
const t = this.
|
|
1574
|
-
this
|
|
1575
|
-
const i = this.
|
|
1574
|
+
const t = this.Ii.ei(this.$i), e = this.Ii.ni(t);
|
|
1575
|
+
this.Gi.clear(), this.Ei = this.Wi.createCharacterObjects(e, this.$i), this.Oi = this.Xi.Ri(e, this.ki, this.$i);
|
|
1576
|
+
const i = this.Ni.createTextureAtlas(this.Ei, this.Oi, this.ki, this.$i);
|
|
1576
1577
|
this.Di = i.framebuffer, this.Bi = i.columns, this.Li = i.rows;
|
|
1577
1578
|
}
|
|
1578
1579
|
Pi(t) {
|
|
1579
|
-
return this.
|
|
1580
|
+
return this.Wi.Pi(t, this.Ei);
|
|
1580
1581
|
}
|
|
1581
1582
|
Si(t) {
|
|
1582
|
-
return this.
|
|
1583
|
+
return this.Wi.Si(t, this.Ei);
|
|
1584
|
+
}
|
|
1585
|
+
getGlyphData(t) {
|
|
1586
|
+
if (!Number.isFinite(t)) return null;
|
|
1587
|
+
const e = this.Gi.get(t);
|
|
1588
|
+
if (e !== void 0) return e;
|
|
1589
|
+
const i = this.Zi(t);
|
|
1590
|
+
if (i < 0) return this.Gi.set(t, null), null;
|
|
1591
|
+
const s = this.$i.glyf;
|
|
1592
|
+
if (!s) return this.Gi.set(t, null), null;
|
|
1593
|
+
let r = s[i] ?? null;
|
|
1594
|
+
return r == null && (r = O.T.glyf.Qe(this.$i, i) ?? null, s[i] = r), this.Gi.set(t, r), r;
|
|
1595
|
+
}
|
|
1596
|
+
Zi(t) {
|
|
1597
|
+
const e = this.$i.cmap;
|
|
1598
|
+
for (const i of e.tables) if (i.format === 4) {
|
|
1599
|
+
const s = i;
|
|
1600
|
+
for (let r = 0; r < s.startCount.length; r++) if (t >= s.startCount[r] && t <= s.endCount[r]) {
|
|
1601
|
+
if (s.idRangeOffset[r] === 0) return t + s.idDelta[r] & 65535;
|
|
1602
|
+
{
|
|
1603
|
+
const n = s.idRangeOffset[r] / 2 + (t - s.startCount[r]) - (s.startCount.length - r);
|
|
1604
|
+
if (n >= 0 && n < s.glyphIdArray.length) {
|
|
1605
|
+
const o = s.glyphIdArray[n];
|
|
1606
|
+
if (o !== 0) return o + s.idDelta[r] & 65535;
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
} else if (i.format === 12) {
|
|
1611
|
+
const s = i;
|
|
1612
|
+
for (let r = 0; r < s.groups.length; r += 3) {
|
|
1613
|
+
const n = s.groups[r], o = s.groups[r + 1], c = s.groups[r + 2];
|
|
1614
|
+
if (t >= n && t <= o) return c + (t - n);
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
return 0;
|
|
1583
1618
|
}
|
|
1584
1619
|
Dt() {
|
|
1585
|
-
this.Di.Dt(), document.fonts.delete(this.
|
|
1620
|
+
this.Di.Dt(), document.fonts.delete(this.Hi);
|
|
1586
1621
|
}
|
|
1587
1622
|
get fontFramebuffer() {
|
|
1588
1623
|
return this.Di;
|
|
1589
1624
|
}
|
|
1590
1625
|
get characters() {
|
|
1591
|
-
return this
|
|
1626
|
+
return this.Ei;
|
|
1592
1627
|
}
|
|
1593
1628
|
get textureColumns() {
|
|
1594
1629
|
return this.Bi;
|
|
@@ -1603,39 +1638,39 @@ class Gt {
|
|
|
1603
1638
|
return this.ki;
|
|
1604
1639
|
}
|
|
1605
1640
|
get font() {
|
|
1606
|
-
return this
|
|
1641
|
+
return this.$i;
|
|
1607
1642
|
}
|
|
1608
1643
|
}
|
|
1609
|
-
class
|
|
1644
|
+
class Ht {
|
|
1610
1645
|
constructor(t, e, i) {
|
|
1611
|
-
h(this, "qi");
|
|
1612
|
-
h(this, "Zi");
|
|
1613
|
-
h(this, "dt");
|
|
1614
|
-
h(this, "_t");
|
|
1615
1646
|
h(this, "Qi");
|
|
1616
1647
|
h(this, "Ji");
|
|
1648
|
+
h(this, "dt");
|
|
1649
|
+
h(this, "_t");
|
|
1617
1650
|
h(this, "tr");
|
|
1618
1651
|
h(this, "sr");
|
|
1619
1652
|
h(this, "er");
|
|
1620
|
-
this
|
|
1653
|
+
h(this, "ir");
|
|
1654
|
+
h(this, "rr");
|
|
1655
|
+
this.er = t, this.ir = e, this.rr = i, this.nr();
|
|
1621
1656
|
}
|
|
1622
|
-
|
|
1623
|
-
this.
|
|
1657
|
+
nr() {
|
|
1658
|
+
this.Qi = Math.floor(this.er.width / this.ir), this.Ji = Math.floor(this.er.height / this.rr), this.dt = this.Qi * this.ir, this._t = this.Ji * this.rr, this.tr = Math.floor((this.er.width - this.dt) / 2), this.sr = Math.floor((this.er.height - this._t) / 2);
|
|
1624
1659
|
}
|
|
1625
|
-
|
|
1626
|
-
this.
|
|
1660
|
+
hr(t, e) {
|
|
1661
|
+
this.ir = t, this.rr = e, this.nr();
|
|
1627
1662
|
}
|
|
1628
1663
|
get cellWidth() {
|
|
1629
|
-
return this.
|
|
1664
|
+
return this.ir;
|
|
1630
1665
|
}
|
|
1631
1666
|
get cellHeight() {
|
|
1632
|
-
return this.
|
|
1667
|
+
return this.rr;
|
|
1633
1668
|
}
|
|
1634
1669
|
get cols() {
|
|
1635
|
-
return this.
|
|
1670
|
+
return this.Qi;
|
|
1636
1671
|
}
|
|
1637
1672
|
get rows() {
|
|
1638
|
-
return this.
|
|
1673
|
+
return this.Ji;
|
|
1639
1674
|
}
|
|
1640
1675
|
get width() {
|
|
1641
1676
|
return this.dt;
|
|
@@ -1644,140 +1679,140 @@ class Xt {
|
|
|
1644
1679
|
return this._t;
|
|
1645
1680
|
}
|
|
1646
1681
|
get offsetX() {
|
|
1647
|
-
return this.
|
|
1682
|
+
return this.tr;
|
|
1648
1683
|
}
|
|
1649
1684
|
get offsetY() {
|
|
1650
|
-
return this.
|
|
1685
|
+
return this.sr;
|
|
1651
1686
|
}
|
|
1652
1687
|
}
|
|
1653
|
-
class
|
|
1688
|
+
class Xt {
|
|
1654
1689
|
constructor(t = {}) {
|
|
1655
|
-
h(this, "
|
|
1656
|
-
h(this, "
|
|
1657
|
-
h(this, "
|
|
1658
|
-
h(this, "
|
|
1659
|
-
h(this, "
|
|
1660
|
-
this.
|
|
1690
|
+
h(this, "er");
|
|
1691
|
+
h(this, "ar", null);
|
|
1692
|
+
h(this, "cr", !1);
|
|
1693
|
+
h(this, "lr");
|
|
1694
|
+
h(this, "ur");
|
|
1695
|
+
this.cr = t.overlay ?? !1, this.cr && t.canvas ? (this.ar = t.canvas, this.er = this.dr(), this.ur = !0, this.pr()) : t.canvas ? (this.er = t.canvas, this.ur = !1) : (this.er = this._r(t.width, t.height), this.ur = !0), this.er.style.imageRendering = "pixelated";
|
|
1661
1696
|
}
|
|
1662
|
-
|
|
1697
|
+
_r(t, e) {
|
|
1663
1698
|
const i = document.createElement("canvas");
|
|
1664
1699
|
return i.className = "textmodeCanvas", i.style.imageRendering = "pixelated", i.width = t || 800, i.height = e || 600, document.body.appendChild(i), i;
|
|
1665
1700
|
}
|
|
1666
|
-
|
|
1701
|
+
dr() {
|
|
1667
1702
|
const t = document.createElement("canvas");
|
|
1668
1703
|
t.className = "textmodeCanvas", t.style.imageRendering = "pixelated";
|
|
1669
|
-
const e = this.
|
|
1704
|
+
const e = this.ar.getBoundingClientRect();
|
|
1670
1705
|
let i = Math.round(e.width), s = Math.round(e.height);
|
|
1671
|
-
if (this.
|
|
1672
|
-
const o = this.
|
|
1706
|
+
if (this.ar instanceof HTMLVideoElement) {
|
|
1707
|
+
const o = this.ar;
|
|
1673
1708
|
(i === 0 || s === 0) && o.videoWidth > 0 && o.videoHeight > 0 && (i = o.videoWidth, s = o.videoHeight);
|
|
1674
1709
|
}
|
|
1675
1710
|
t.width = i, t.height = s, t.style.position = "absolute", t.style.pointerEvents = "none";
|
|
1676
|
-
const r = window.getComputedStyle(this.
|
|
1711
|
+
const r = window.getComputedStyle(this.ar);
|
|
1677
1712
|
let n = parseInt(r.zIndex || "0", 10);
|
|
1678
1713
|
return isNaN(n) && (n = 0), t.style.zIndex = "" + (n + 1), t;
|
|
1679
1714
|
}
|
|
1680
|
-
|
|
1715
|
+
pr() {
|
|
1681
1716
|
var t;
|
|
1682
|
-
this.
|
|
1683
|
-
this.
|
|
1684
|
-
}), this.
|
|
1685
|
-
this.
|
|
1717
|
+
this.mr(), (t = this.ar.parentNode) == null || t.insertBefore(this.er, this.ar.nextSibling), window.ResizeObserver && (this.lr = new ResizeObserver(() => {
|
|
1718
|
+
this.vr();
|
|
1719
|
+
}), this.lr.observe(this.ar)), window.addEventListener("resize", () => {
|
|
1720
|
+
this.vr();
|
|
1686
1721
|
});
|
|
1687
1722
|
}
|
|
1688
|
-
|
|
1689
|
-
if (!this.
|
|
1690
|
-
const t = this.
|
|
1691
|
-
let e = this.
|
|
1723
|
+
mr() {
|
|
1724
|
+
if (!this.ar) return;
|
|
1725
|
+
const t = this.ar.getBoundingClientRect();
|
|
1726
|
+
let e = this.ar.offsetParent;
|
|
1692
1727
|
if (e && e !== document.body) {
|
|
1693
1728
|
const i = e.getBoundingClientRect();
|
|
1694
|
-
this.
|
|
1695
|
-
} else this.
|
|
1729
|
+
this.er.style.top = t.top - i.top + "px", this.er.style.left = t.left - i.left + "px";
|
|
1730
|
+
} else this.er.style.top = t.top + window.scrollY + "px", this.er.style.left = t.left + window.scrollX + "px";
|
|
1696
1731
|
}
|
|
1697
|
-
|
|
1698
|
-
if (this.
|
|
1699
|
-
const i = this.
|
|
1732
|
+
vr(t, e) {
|
|
1733
|
+
if (this.cr) {
|
|
1734
|
+
const i = this.ar.getBoundingClientRect();
|
|
1700
1735
|
let s = Math.round(i.width), r = Math.round(i.height);
|
|
1701
|
-
if (this.
|
|
1702
|
-
const n = this.
|
|
1736
|
+
if (this.ar instanceof HTMLVideoElement) {
|
|
1737
|
+
const n = this.ar;
|
|
1703
1738
|
(s === 0 || r === 0) && n.videoWidth > 0 && n.videoHeight > 0 && (s = n.videoWidth, r = n.videoHeight);
|
|
1704
1739
|
}
|
|
1705
|
-
this.
|
|
1706
|
-
} else this.
|
|
1740
|
+
this.er.width = s, this.er.height = r, this.mr();
|
|
1741
|
+
} else this.er.width = t ?? this.er.width, this.er.height = e ?? this.er.height;
|
|
1707
1742
|
}
|
|
1708
|
-
|
|
1709
|
-
const t = this.
|
|
1743
|
+
gr() {
|
|
1744
|
+
const t = this.er.getContext("webgl2", { alpha: !0, premultipliedAlpha: !1, preserveDrawingBuffer: !0, antialias: !1, depth: !1, stencil: !1, powerPreference: "high-performance" });
|
|
1710
1745
|
if (!t) throw new C("`textmode.js` requires WebGL2 support.");
|
|
1711
1746
|
return t;
|
|
1712
1747
|
}
|
|
1713
1748
|
Dt() {
|
|
1714
|
-
this.
|
|
1715
|
-
const t = this.
|
|
1749
|
+
this.lr && this.lr.disconnect();
|
|
1750
|
+
const t = this.er.getContext("webgl") || this.er.getContext("webgl2");
|
|
1716
1751
|
if (t) {
|
|
1717
1752
|
const e = t.getExtension("WEBGL_lose_context");
|
|
1718
1753
|
e && e.loseContext();
|
|
1719
1754
|
}
|
|
1720
|
-
this.
|
|
1755
|
+
this.ur && this.er.parentNode && this.er.parentNode.removeChild(this.er);
|
|
1721
1756
|
}
|
|
1722
1757
|
get canvas() {
|
|
1723
|
-
return this.
|
|
1758
|
+
return this.er;
|
|
1724
1759
|
}
|
|
1725
1760
|
get targetCanvas() {
|
|
1726
|
-
return this.
|
|
1761
|
+
return this.ar;
|
|
1727
1762
|
}
|
|
1728
1763
|
get width() {
|
|
1729
|
-
return this.
|
|
1764
|
+
return this.er.width;
|
|
1730
1765
|
}
|
|
1731
1766
|
get height() {
|
|
1732
|
-
return this.
|
|
1767
|
+
return this.er.height;
|
|
1733
1768
|
}
|
|
1734
1769
|
}
|
|
1735
1770
|
class G {
|
|
1736
1771
|
constructor(t, e, i, s) {
|
|
1737
|
-
h(this, "
|
|
1772
|
+
h(this, "Ar");
|
|
1738
1773
|
h(this, "dt");
|
|
1739
1774
|
h(this, "_t");
|
|
1740
1775
|
h(this, "gt");
|
|
1741
1776
|
h(this, "k", 0);
|
|
1742
1777
|
h(this, "K", 0);
|
|
1743
|
-
h(this, "
|
|
1778
|
+
h(this, "j", 0);
|
|
1744
1779
|
h(this, "L", [0, 0]);
|
|
1745
|
-
h(this, "
|
|
1746
|
-
h(this, "
|
|
1780
|
+
h(this, "yr", "sampled");
|
|
1781
|
+
h(this, "Cr", "fixed");
|
|
1747
1782
|
h(this, "V", [1, 1, 1, 1]);
|
|
1748
1783
|
h(this, "q", [0, 0, 0, 1]);
|
|
1749
|
-
h(this, "
|
|
1750
|
-
h(this, "
|
|
1751
|
-
h(this, "
|
|
1752
|
-
this.gt = t, this.
|
|
1784
|
+
h(this, "wr", [0, 0, 0, 1]);
|
|
1785
|
+
h(this, "br", [[0.1, 0, 0]]);
|
|
1786
|
+
h(this, "Mr");
|
|
1787
|
+
this.gt = t, this.Ar = e, this.dt = i, this._t = s;
|
|
1753
1788
|
}
|
|
1754
1789
|
Dt() {
|
|
1755
|
-
this.gt.deleteTexture(this.
|
|
1790
|
+
this.gt.deleteTexture(this.Ar);
|
|
1756
1791
|
}
|
|
1757
|
-
|
|
1792
|
+
Fr(t) {
|
|
1758
1793
|
return typeof t == "boolean" ? t ? 1 : 0 : (t == null ? 0 : Number(t)) > 0 ? 1 : 0;
|
|
1759
1794
|
}
|
|
1760
1795
|
invert(t = !0) {
|
|
1761
|
-
return this.k = this.
|
|
1796
|
+
return this.k = this.Fr(t), this;
|
|
1762
1797
|
}
|
|
1763
1798
|
flipX(t = !0) {
|
|
1764
|
-
return this.K = this.
|
|
1799
|
+
return this.K = this.Fr(t), this;
|
|
1765
1800
|
}
|
|
1766
1801
|
flipY(t = !0) {
|
|
1767
|
-
return this.
|
|
1802
|
+
return this.j = this.Fr(t), this;
|
|
1768
1803
|
}
|
|
1769
1804
|
charRotation(t) {
|
|
1770
1805
|
const e = 255 * t / 360, i = Math.floor(e) / 255, s = Math.round(e - Math.floor(e));
|
|
1771
1806
|
return this.L = [i, s], this;
|
|
1772
1807
|
}
|
|
1773
|
-
|
|
1774
|
-
return { texture: this.
|
|
1808
|
+
Ge() {
|
|
1809
|
+
return { texture: this.Ar, invert: this.k, flipX: this.K, flipY: this.j, charRotation: this.L, charColorFixed: this.yr === "fixed", charColor: this.V, cellColorFixed: this.Cr === "fixed", cellColor: this.q, backgroundColor: this.wr, charCount: this.br.length, charList: this.br };
|
|
1775
1810
|
}
|
|
1776
1811
|
charColorMode(t) {
|
|
1777
|
-
return this.
|
|
1812
|
+
return this.yr = t, this;
|
|
1778
1813
|
}
|
|
1779
1814
|
cellColorMode(t) {
|
|
1780
|
-
return this.
|
|
1815
|
+
return this.Cr = t, this;
|
|
1781
1816
|
}
|
|
1782
1817
|
charColor(t, e, i, s) {
|
|
1783
1818
|
return this.V = [(t ?? 0) / 255, (e ?? t ?? 0) / 255, (i ?? t ?? 0) / 255, (s ?? 255) / 255], this;
|
|
@@ -1786,20 +1821,20 @@ class G {
|
|
|
1786
1821
|
return this.q = [(t ?? 0) / 255, (e ?? t ?? 0) / 255, (i ?? t ?? 0) / 255, (s ?? 255) / 255], this;
|
|
1787
1822
|
}
|
|
1788
1823
|
background(t, e, i, s) {
|
|
1789
|
-
return this.
|
|
1824
|
+
return this.wr = [(t ?? 0) / 255, (e ?? t ?? 0) / 255, (i ?? t ?? 0) / 255, (s ?? 255) / 255], this;
|
|
1790
1825
|
}
|
|
1791
1826
|
characters(t) {
|
|
1792
|
-
const e = this.
|
|
1793
|
-
return this.
|
|
1827
|
+
const e = this.Mr(t).filter((i) => Array.isArray(i)).slice(0, 64);
|
|
1828
|
+
return this.br = e, this;
|
|
1794
1829
|
}
|
|
1795
|
-
static
|
|
1830
|
+
static zr(t, e, i) {
|
|
1796
1831
|
const s = t.context, r = s.createTexture();
|
|
1797
1832
|
s.bindTexture(s.TEXTURE_2D, r), s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL, 1), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MIN_FILTER, s.NEAREST), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MAG_FILTER, s.NEAREST), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_S, s.CLAMP_TO_EDGE), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_T, s.CLAMP_TO_EDGE), s.texImage2D(s.TEXTURE_2D, 0, s.RGBA, s.RGBA, s.UNSIGNED_BYTE, e), s.bindTexture(s.TEXTURE_2D, null);
|
|
1798
1833
|
const n = e.naturalWidth ?? e.width ?? e.videoWidth ?? 0, o = e.naturalHeight ?? e.height ?? e.videoHeight ?? 0, c = new G(s, r, n, o);
|
|
1799
|
-
return c.
|
|
1834
|
+
return c.Mr = i, c;
|
|
1800
1835
|
}
|
|
1801
1836
|
get texture() {
|
|
1802
|
-
return this.
|
|
1837
|
+
return this.Ar;
|
|
1803
1838
|
}
|
|
1804
1839
|
get width() {
|
|
1805
1840
|
return this.dt;
|
|
@@ -1808,289 +1843,287 @@ class G {
|
|
|
1808
1843
|
return this._t;
|
|
1809
1844
|
}
|
|
1810
1845
|
}
|
|
1811
|
-
class
|
|
1846
|
+
class Yt {
|
|
1812
1847
|
constructor(t = 60) {
|
|
1813
|
-
h(this, "
|
|
1814
|
-
h(this, "
|
|
1815
|
-
h(this, "
|
|
1816
|
-
h(this, "Tr", 0);
|
|
1817
|
-
h(this, "Pr", !0);
|
|
1848
|
+
h(this, "Rr");
|
|
1849
|
+
h(this, "Tr");
|
|
1850
|
+
h(this, "Pr", null);
|
|
1818
1851
|
h(this, "Sr", 0);
|
|
1852
|
+
h(this, "$r", !0);
|
|
1819
1853
|
h(this, "Er", 0);
|
|
1820
|
-
h(this, "
|
|
1821
|
-
h(this, "
|
|
1822
|
-
h(this, "
|
|
1823
|
-
this
|
|
1854
|
+
h(this, "Dr", 0);
|
|
1855
|
+
h(this, "kr", []);
|
|
1856
|
+
h(this, "Br", 10);
|
|
1857
|
+
h(this, "Lr", 0);
|
|
1858
|
+
this.Rr = t, this.Tr = 1e3 / t;
|
|
1824
1859
|
}
|
|
1825
1860
|
start(t) {
|
|
1826
|
-
if (!this
|
|
1827
|
-
this.
|
|
1861
|
+
if (!this.$r) return;
|
|
1862
|
+
this.Sr = performance.now();
|
|
1828
1863
|
const e = (i) => {
|
|
1829
|
-
if (!this
|
|
1830
|
-
const s = i - this.
|
|
1831
|
-
s >= this.
|
|
1864
|
+
if (!this.$r) return void (this.Pr = null);
|
|
1865
|
+
const s = i - this.Sr;
|
|
1866
|
+
s >= this.Tr && (t(), this.Sr = i - s % this.Tr), this.$r && (this.Pr = requestAnimationFrame(e));
|
|
1832
1867
|
};
|
|
1833
|
-
this.
|
|
1868
|
+
this.Pr = requestAnimationFrame(e);
|
|
1834
1869
|
}
|
|
1835
1870
|
stop() {
|
|
1836
|
-
this.
|
|
1871
|
+
this.Pr && (cancelAnimationFrame(this.Pr), this.Pr = null);
|
|
1837
1872
|
}
|
|
1838
1873
|
pause() {
|
|
1839
|
-
this
|
|
1874
|
+
this.$r && (this.$r = !1, this.stop());
|
|
1840
1875
|
}
|
|
1841
1876
|
resume(t) {
|
|
1842
|
-
this
|
|
1877
|
+
this.$r || (this.$r = !0, this.start(t));
|
|
1843
1878
|
}
|
|
1844
1879
|
frameRate(t, e) {
|
|
1845
|
-
if (t === void 0) return this.
|
|
1846
|
-
this.
|
|
1880
|
+
if (t === void 0) return this.Er;
|
|
1881
|
+
this.Rr = t, this.Tr = 1e3 / t, this.$r && e && (this.stop(), this.start(e));
|
|
1847
1882
|
}
|
|
1848
1883
|
measureFrameRate() {
|
|
1849
1884
|
const t = performance.now();
|
|
1850
|
-
if (this.
|
|
1851
|
-
const e = t - this.
|
|
1852
|
-
this
|
|
1853
|
-
const i = this
|
|
1854
|
-
this.
|
|
1885
|
+
if (this.Dr > 0) {
|
|
1886
|
+
const e = t - this.Dr;
|
|
1887
|
+
this.kr.push(e), this.kr.length > this.Br && this.kr.shift();
|
|
1888
|
+
const i = this.kr.reduce((s, r) => s + r, 0) / this.kr.length;
|
|
1889
|
+
this.Er = 1e3 / i;
|
|
1855
1890
|
}
|
|
1856
|
-
this.
|
|
1891
|
+
this.Dr = t;
|
|
1857
1892
|
}
|
|
1858
1893
|
get isLooping() {
|
|
1859
|
-
return this
|
|
1894
|
+
return this.$r;
|
|
1860
1895
|
}
|
|
1861
1896
|
get frameRateLimit() {
|
|
1862
|
-
return this.
|
|
1897
|
+
return this.Rr;
|
|
1863
1898
|
}
|
|
1864
1899
|
get currentFrameRate() {
|
|
1865
|
-
return this.
|
|
1900
|
+
return this.Er;
|
|
1866
1901
|
}
|
|
1867
1902
|
get frameCount() {
|
|
1868
|
-
return this.
|
|
1903
|
+
return this.Lr;
|
|
1869
1904
|
}
|
|
1870
1905
|
set frameCount(t) {
|
|
1871
|
-
this.
|
|
1906
|
+
this.Lr = t;
|
|
1872
1907
|
}
|
|
1873
1908
|
incrementFrame() {
|
|
1874
|
-
this.
|
|
1909
|
+
this.Lr++;
|
|
1875
1910
|
}
|
|
1876
1911
|
resetFrameCount() {
|
|
1877
|
-
this.
|
|
1912
|
+
this.Lr = 0;
|
|
1878
1913
|
}
|
|
1879
1914
|
}
|
|
1880
1915
|
class rt {
|
|
1881
1916
|
constructor(t) {
|
|
1882
|
-
h(this, "
|
|
1883
|
-
h(this, "
|
|
1884
|
-
h(this, "
|
|
1885
|
-
h(this, "
|
|
1886
|
-
h(this, "
|
|
1887
|
-
h(this, "
|
|
1888
|
-
h(this, "Ir");
|
|
1889
|
-
h(this, "Nr");
|
|
1917
|
+
h(this, "er");
|
|
1918
|
+
h(this, "Or");
|
|
1919
|
+
h(this, "Hr", { x: -1, y: -1 });
|
|
1920
|
+
h(this, "Gr", { x: -1, y: -1 });
|
|
1921
|
+
h(this, "Ir", null);
|
|
1922
|
+
h(this, "Nr", 0);
|
|
1890
1923
|
h(this, "Xr");
|
|
1891
1924
|
h(this, "Wr");
|
|
1892
1925
|
h(this, "Kr");
|
|
1926
|
+
h(this, "jr");
|
|
1893
1927
|
h(this, "Yr");
|
|
1894
|
-
h(this, "jr", !1);
|
|
1895
1928
|
h(this, "Vr");
|
|
1896
|
-
h(this, "qr");
|
|
1929
|
+
h(this, "qr", !1);
|
|
1897
1930
|
h(this, "Zr");
|
|
1898
1931
|
h(this, "Qr");
|
|
1899
1932
|
h(this, "Jr");
|
|
1900
|
-
this
|
|
1933
|
+
h(this, "tn");
|
|
1934
|
+
h(this, "sn");
|
|
1935
|
+
this.er = t;
|
|
1901
1936
|
}
|
|
1902
|
-
|
|
1937
|
+
en(t) {
|
|
1903
1938
|
const e = performance.now() + Math.max(0, t);
|
|
1904
|
-
e > this.
|
|
1939
|
+
e > this.Nr && (this.Nr = e);
|
|
1905
1940
|
}
|
|
1906
|
-
|
|
1907
|
-
return performance.now() < this.
|
|
1941
|
+
rn() {
|
|
1942
|
+
return performance.now() < this.Nr;
|
|
1908
1943
|
}
|
|
1909
|
-
|
|
1910
|
-
const e = this.
|
|
1944
|
+
nn(t) {
|
|
1945
|
+
const e = this.er.canvas;
|
|
1911
1946
|
e.style.cursor = t == null || t === "" ? "" : t;
|
|
1912
1947
|
}
|
|
1913
|
-
|
|
1914
|
-
this.
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
|
-
if (this.
|
|
1918
|
-
const t = this.
|
|
1919
|
-
this.
|
|
1920
|
-
this.
|
|
1921
|
-
}, this.
|
|
1922
|
-
this.
|
|
1923
|
-
}, this.Xr = (e) => {
|
|
1924
|
-
this.hn(e), this.cn(e);
|
|
1925
|
-
}, this.Wr = (e) => {
|
|
1926
|
-
this.hn(e), this.ln(e);
|
|
1948
|
+
Ki(t) {
|
|
1949
|
+
this.Or = t, this.hn();
|
|
1950
|
+
}
|
|
1951
|
+
an() {
|
|
1952
|
+
if (this.qr) return;
|
|
1953
|
+
const t = this.er.canvas;
|
|
1954
|
+
this.Xr = (e) => {
|
|
1955
|
+
this.cn(e), this.ln(e);
|
|
1956
|
+
}, this.Wr = () => {
|
|
1957
|
+
this.Gr = { ...this.Hr }, this.Hr.x = -1, this.Hr.y = -1, this.Ir = null;
|
|
1927
1958
|
}, this.Kr = (e) => {
|
|
1928
|
-
this.
|
|
1959
|
+
this.cn(e), this.un(e);
|
|
1960
|
+
}, this.jr = (e) => {
|
|
1961
|
+
this.cn(e), this.fn(e);
|
|
1929
1962
|
}, this.Yr = (e) => {
|
|
1930
|
-
this.
|
|
1931
|
-
},
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1963
|
+
this.cn(e), this.dn(e);
|
|
1964
|
+
}, this.Vr = (e) => {
|
|
1965
|
+
this.cn(e), this.pn(e);
|
|
1966
|
+
}, t.addEventListener("mousemove", this.Xr, { passive: !0 }), t.addEventListener("mouseleave", this.Wr, { passive: !0 }), t.addEventListener("mousedown", this.Kr, { passive: !0 }), t.addEventListener("mouseup", this.jr, { passive: !0 }), t.addEventListener("click", this.Yr, { passive: !0 }), t.addEventListener("wheel", this.Vr, { passive: !1 }), this.qr = !0;
|
|
1967
|
+
}
|
|
1968
|
+
_n() {
|
|
1969
|
+
if (!this.qr) return;
|
|
1970
|
+
const t = this.er.canvas;
|
|
1971
|
+
t.removeEventListener("mousemove", this.Xr), t.removeEventListener("mouseleave", this.Wr), t.removeEventListener("mousedown", this.Kr), t.removeEventListener("mouseup", this.jr), t.removeEventListener("click", this.Yr), t.removeEventListener("wheel", this.Vr), this.qr = !1;
|
|
1972
|
+
}
|
|
1973
|
+
hn() {
|
|
1974
|
+
if (this.qr) try {
|
|
1975
|
+
if (this.Ir) {
|
|
1976
|
+
const t = new MouseEvent("mousemove", { clientX: this.Ir.x, clientY: this.Ir.y, bubbles: !1, cancelable: !1 });
|
|
1977
|
+
this.cn(t);
|
|
1978
|
+
} else this.Hr.x !== -1 && this.Hr.y !== -1 && (this.Hr.x >= this.Or.cols || this.Hr.y >= this.Or.rows) && (this.Hr.x = -1, this.Hr.y = -1);
|
|
1944
1979
|
} catch {
|
|
1945
|
-
this.
|
|
1980
|
+
this.Hr.x = -1, this.Hr.y = -1;
|
|
1946
1981
|
}
|
|
1947
1982
|
}
|
|
1948
|
-
|
|
1949
|
-
this.Vr = t;
|
|
1950
|
-
}
|
|
1951
|
-
pn(t) {
|
|
1952
|
-
this.qr = t;
|
|
1953
|
-
}
|
|
1954
|
-
vn(t) {
|
|
1983
|
+
mn(t) {
|
|
1955
1984
|
this.Zr = t;
|
|
1956
1985
|
}
|
|
1957
|
-
|
|
1986
|
+
vn(t) {
|
|
1958
1987
|
this.Qr = t;
|
|
1959
1988
|
}
|
|
1960
1989
|
gn(t) {
|
|
1961
1990
|
this.Jr = t;
|
|
1962
1991
|
}
|
|
1963
|
-
An() {
|
|
1964
|
-
|
|
1992
|
+
An(t) {
|
|
1993
|
+
this.tn = t;
|
|
1965
1994
|
}
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
const e = { position: { ...this.Lr }, previousPosition: { ...this.Or }, originalEvent: t };
|
|
1969
|
-
this.Qr(e);
|
|
1970
|
-
}
|
|
1995
|
+
yn(t) {
|
|
1996
|
+
this.sn = t;
|
|
1971
1997
|
}
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
const e = { position: { ...this.Lr }, previousPosition: { ...this.Or }, button: t.button, originalEvent: t };
|
|
1975
|
-
this.qr(e);
|
|
1976
|
-
}
|
|
1998
|
+
Cn() {
|
|
1999
|
+
return { x: this.Hr.x, y: this.Hr.y };
|
|
1977
2000
|
}
|
|
1978
2001
|
ln(t) {
|
|
1979
|
-
if (this.
|
|
1980
|
-
const e = { position: { ...this.
|
|
1981
|
-
this.
|
|
2002
|
+
if (this.tn && !this.rn()) {
|
|
2003
|
+
const e = { position: { ...this.Hr }, previousPosition: { ...this.Gr }, originalEvent: t };
|
|
2004
|
+
this.tn(e);
|
|
1982
2005
|
}
|
|
1983
2006
|
}
|
|
1984
2007
|
un(t) {
|
|
1985
|
-
if (this.
|
|
1986
|
-
const e = { position: { ...this.
|
|
1987
|
-
this.
|
|
2008
|
+
if (this.Qr && !this.rn()) {
|
|
2009
|
+
const e = { position: { ...this.Hr }, previousPosition: { ...this.Gr }, button: t.button, originalEvent: t };
|
|
2010
|
+
this.Qr(e);
|
|
1988
2011
|
}
|
|
1989
2012
|
}
|
|
1990
2013
|
fn(t) {
|
|
1991
|
-
if (this.Jr && !this.
|
|
1992
|
-
const e = { position: { ...this.
|
|
2014
|
+
if (this.Jr && !this.rn()) {
|
|
2015
|
+
const e = { position: { ...this.Hr }, previousPosition: { ...this.Gr }, button: t.button, originalEvent: t };
|
|
1993
2016
|
this.Jr(e);
|
|
1994
2017
|
}
|
|
1995
2018
|
}
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2019
|
+
dn(t) {
|
|
2020
|
+
if (this.Zr && !this.rn()) {
|
|
2021
|
+
const e = { position: { ...this.Hr }, previousPosition: { ...this.Gr }, button: t.button, originalEvent: t };
|
|
2022
|
+
this.Zr(e);
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
pn(t) {
|
|
2026
|
+
if (this.sn && !this.rn()) {
|
|
2027
|
+
const e = { position: { ...this.Hr }, previousPosition: { ...this.Gr }, delta: { x: t.deltaX, y: t.deltaY }, originalEvent: t };
|
|
2028
|
+
this.sn(e);
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
cn(t) {
|
|
2032
|
+
const e = this.er.canvas;
|
|
2033
|
+
this.Gr = { ...this.Hr }, this.Ir = { x: t.clientX, y: t.clientY };
|
|
2034
|
+
const i = e.getBoundingClientRect(), s = t.clientX - i.left, r = t.clientY - i.top, n = e.width / i.width, o = r * (e.height / i.height), c = s * n - this.Or.offsetX, l = o - this.Or.offsetY, f = Math.floor(c / this.Or.cellWidth), u = Math.floor(l / this.Or.cellHeight);
|
|
2035
|
+
f >= 0 && f < this.Or.cols && u >= 0 && u < this.Or.rows ? (this.Hr.x = f, this.Hr.y = u) : (this.Hr.x = -1, this.Hr.y = -1);
|
|
2001
2036
|
}
|
|
2002
2037
|
}
|
|
2003
|
-
const
|
|
2038
|
+
const Wt = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: rt }, Symbol.toStringTag, { value: "Module" }));
|
|
2004
2039
|
class nt {
|
|
2005
2040
|
constructor() {
|
|
2006
|
-
h(this, "
|
|
2007
|
-
h(this, "
|
|
2008
|
-
h(this, "
|
|
2009
|
-
h(this, "bn");
|
|
2010
|
-
h(this, "xn");
|
|
2011
|
-
h(this, "jr", !1);
|
|
2041
|
+
h(this, "wn", /* @__PURE__ */ new Map());
|
|
2042
|
+
h(this, "bn", null);
|
|
2043
|
+
h(this, "xn", null);
|
|
2012
2044
|
h(this, "Mn");
|
|
2013
2045
|
h(this, "Fn");
|
|
2014
|
-
h(this, "
|
|
2046
|
+
h(this, "qr", !1);
|
|
2047
|
+
h(this, "zn");
|
|
2048
|
+
h(this, "Rn");
|
|
2049
|
+
h(this, "Tn", { 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" });
|
|
2015
2050
|
}
|
|
2016
|
-
|
|
2017
|
-
this.
|
|
2018
|
-
this.
|
|
2019
|
-
}, this.
|
|
2020
|
-
this.
|
|
2021
|
-
}, window.addEventListener("keydown", this.
|
|
2051
|
+
an() {
|
|
2052
|
+
this.qr || (this.Mn = (t) => {
|
|
2053
|
+
this.Pn(t);
|
|
2054
|
+
}, this.Fn = (t) => {
|
|
2055
|
+
this.Sn(t);
|
|
2056
|
+
}, window.addEventListener("keydown", this.Mn, { passive: !1 }), window.addEventListener("keyup", this.Fn, { passive: !1 }), this.qr = !0);
|
|
2022
2057
|
}
|
|
2023
|
-
|
|
2024
|
-
this.
|
|
2025
|
-
}
|
|
2026
|
-
pn(t) {
|
|
2027
|
-
this.Mn = t;
|
|
2058
|
+
_n() {
|
|
2059
|
+
this.qr && (window.removeEventListener("keydown", this.Mn), window.removeEventListener("keyup", this.Fn), this.qr = !1, this.wn.clear(), this.bn = null, this.xn = null);
|
|
2028
2060
|
}
|
|
2029
2061
|
vn(t) {
|
|
2030
|
-
this.
|
|
2062
|
+
this.zn = t;
|
|
2031
2063
|
}
|
|
2032
|
-
|
|
2033
|
-
|
|
2064
|
+
gn(t) {
|
|
2065
|
+
this.Rn = t;
|
|
2066
|
+
}
|
|
2067
|
+
$n(t) {
|
|
2068
|
+
const e = this.En(t), i = this.wn.get(t) || this.wn.get(e);
|
|
2034
2069
|
return (i == null ? void 0 : i.isPressed) || !1;
|
|
2035
2070
|
}
|
|
2036
|
-
|
|
2037
|
-
return this.
|
|
2071
|
+
Dn() {
|
|
2072
|
+
return this.bn;
|
|
2038
2073
|
}
|
|
2039
|
-
|
|
2040
|
-
return this.
|
|
2074
|
+
kn() {
|
|
2075
|
+
return this.xn;
|
|
2041
2076
|
}
|
|
2042
|
-
|
|
2077
|
+
Bn() {
|
|
2043
2078
|
const t = [];
|
|
2044
|
-
for (const [e, i] of this.
|
|
2079
|
+
for (const [e, i] of this.wn) i.isPressed && t.push(e);
|
|
2045
2080
|
return t;
|
|
2046
2081
|
}
|
|
2047
|
-
|
|
2048
|
-
return { ctrl: this
|
|
2082
|
+
Ln() {
|
|
2083
|
+
return { ctrl: this.$n("Control"), shift: this.$n("Shift"), alt: this.$n("Alt"), meta: this.$n("Meta") };
|
|
2049
2084
|
}
|
|
2050
|
-
|
|
2051
|
-
this.
|
|
2085
|
+
On() {
|
|
2086
|
+
this.wn.clear(), this.bn = null, this.xn = null;
|
|
2052
2087
|
}
|
|
2053
|
-
|
|
2088
|
+
Pn(t) {
|
|
2054
2089
|
const e = t.key, i = Date.now();
|
|
2055
|
-
this.
|
|
2056
|
-
const s = this.
|
|
2057
|
-
if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.
|
|
2090
|
+
this.wn.has(e) || this.wn.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
2091
|
+
const s = this.wn.get(e);
|
|
2092
|
+
if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.bn = e, this.zn)) {
|
|
2058
2093
|
const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !0, originalEvent: t };
|
|
2059
|
-
this.
|
|
2094
|
+
this.zn(r);
|
|
2060
2095
|
}
|
|
2061
2096
|
}
|
|
2062
|
-
|
|
2097
|
+
Sn(t) {
|
|
2063
2098
|
const e = t.key, i = Date.now();
|
|
2064
|
-
this.
|
|
2065
|
-
const s = this.
|
|
2066
|
-
if (s.isPressed = !1, s.lastReleaseTime = i, this.
|
|
2099
|
+
this.wn.has(e) || this.wn.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
2100
|
+
const s = this.wn.get(e);
|
|
2101
|
+
if (s.isPressed = !1, s.lastReleaseTime = i, this.xn = e, this.Rn) {
|
|
2067
2102
|
const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !1, originalEvent: t };
|
|
2068
|
-
this.
|
|
2103
|
+
this.Rn(r);
|
|
2069
2104
|
}
|
|
2070
2105
|
}
|
|
2071
|
-
|
|
2072
|
-
return this.
|
|
2106
|
+
En(t) {
|
|
2107
|
+
return this.Tn[t] || t.toLowerCase();
|
|
2073
2108
|
}
|
|
2074
2109
|
}
|
|
2075
|
-
const
|
|
2110
|
+
const kt = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: nt }, Symbol.toStringTag, { value: "Module" }));
|
|
2076
2111
|
class ot {
|
|
2077
2112
|
constructor(t, e) {
|
|
2078
|
-
h(this, "
|
|
2079
|
-
h(this, "
|
|
2080
|
-
h(this, "
|
|
2081
|
-
h(this, "On", /* @__PURE__ */ new Map());
|
|
2113
|
+
h(this, "er");
|
|
2114
|
+
h(this, "Hn");
|
|
2115
|
+
h(this, "Or");
|
|
2082
2116
|
h(this, "Gn", /* @__PURE__ */ new Map());
|
|
2083
|
-
h(this, "
|
|
2084
|
-
h(this, "
|
|
2085
|
-
h(this, "
|
|
2086
|
-
h(this, "Xn");
|
|
2117
|
+
h(this, "In", /* @__PURE__ */ new Map());
|
|
2118
|
+
h(this, "Nn", /* @__PURE__ */ new Map());
|
|
2119
|
+
h(this, "Xn", null);
|
|
2087
2120
|
h(this, "Wn");
|
|
2088
2121
|
h(this, "Kn");
|
|
2089
|
-
h(this, "Yn");
|
|
2090
2122
|
h(this, "jn");
|
|
2091
|
-
h(this, "
|
|
2123
|
+
h(this, "Yn");
|
|
2092
2124
|
h(this, "Vn");
|
|
2093
2125
|
h(this, "qn");
|
|
2126
|
+
h(this, "qr", !1);
|
|
2094
2127
|
h(this, "Zn");
|
|
2095
2128
|
h(this, "Qn");
|
|
2096
2129
|
h(this, "Jn");
|
|
@@ -2099,67 +2132,63 @@ class ot {
|
|
|
2099
2132
|
h(this, "io");
|
|
2100
2133
|
h(this, "ro");
|
|
2101
2134
|
h(this, "no");
|
|
2102
|
-
h(this, "oo"
|
|
2103
|
-
h(this, "ho"
|
|
2104
|
-
h(this, "ao",
|
|
2105
|
-
h(this, "co",
|
|
2106
|
-
h(this, "lo",
|
|
2107
|
-
h(this, "uo",
|
|
2108
|
-
h(this, "fo",
|
|
2109
|
-
h(this, "do",
|
|
2110
|
-
h(this, "
|
|
2111
|
-
h(this, "
|
|
2112
|
-
h(this, "
|
|
2113
|
-
h(this, "
|
|
2114
|
-
this
|
|
2115
|
-
|
|
2116
|
-
this.
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
this.
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
this.Co(e);
|
|
2128
|
-
}, this.Yn = (e) => {
|
|
2135
|
+
h(this, "oo");
|
|
2136
|
+
h(this, "ho");
|
|
2137
|
+
h(this, "ao", 320);
|
|
2138
|
+
h(this, "co", 350);
|
|
2139
|
+
h(this, "lo", 10);
|
|
2140
|
+
h(this, "uo", 550);
|
|
2141
|
+
h(this, "fo", 14);
|
|
2142
|
+
h(this, "do", 48);
|
|
2143
|
+
h(this, "po", 650);
|
|
2144
|
+
h(this, "_o", 0.02);
|
|
2145
|
+
h(this, "mo", 2);
|
|
2146
|
+
h(this, "vo", 600);
|
|
2147
|
+
h(this, "Ao", 0);
|
|
2148
|
+
h(this, "yo", null);
|
|
2149
|
+
this.er = t, this.Hn = e;
|
|
2150
|
+
const i = this.er.canvas;
|
|
2151
|
+
this.Wn = i.style.touchAction, this.Kn = i.style.userSelect, i.style.touchAction || (i.style.touchAction = "none"), i.style.userSelect || (i.style.userSelect = "none");
|
|
2152
|
+
}
|
|
2153
|
+
Ki(t) {
|
|
2154
|
+
this.Or = t, this.Co();
|
|
2155
|
+
}
|
|
2156
|
+
an() {
|
|
2157
|
+
if (this.qr) return;
|
|
2158
|
+
const t = this.er.canvas;
|
|
2159
|
+
this.jn = (e) => {
|
|
2129
2160
|
this.wo(e);
|
|
2130
|
-
}, this.
|
|
2161
|
+
}, this.Yn = (e) => {
|
|
2131
2162
|
this.bo(e);
|
|
2132
|
-
},
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2163
|
+
}, this.Vn = (e) => {
|
|
2164
|
+
this.xo(e);
|
|
2165
|
+
}, this.qn = (e) => {
|
|
2166
|
+
this.Mo(e);
|
|
2167
|
+
}, t.addEventListener("touchstart", this.jn, { passive: !1 }), t.addEventListener("touchmove", this.Yn, { passive: !1 }), t.addEventListener("touchend", this.Vn, { passive: !1 }), t.addEventListener("touchcancel", this.qn, { passive: !1 }), this.qr = !0;
|
|
2168
|
+
}
|
|
2169
|
+
_n() {
|
|
2170
|
+
if (!this.qr) return;
|
|
2171
|
+
const t = this.er.canvas;
|
|
2172
|
+
t.removeEventListener("touchstart", this.jn), t.removeEventListener("touchmove", this.Yn), t.removeEventListener("touchend", this.Vn), t.removeEventListener("touchcancel", this.qn), this.qr = !1, this.Xn = null, this.Gn.clear(), this.In.clear(), this.Nn.forEach((e) => {
|
|
2138
2173
|
e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
|
|
2139
|
-
}), this.
|
|
2174
|
+
}), this.Nn.clear(), this.yo = null, this.Ao = 0, t.style.touchAction = this.Wn, t.style.userSelect = this.Kn;
|
|
2140
2175
|
}
|
|
2141
|
-
|
|
2142
|
-
if (!this.
|
|
2176
|
+
Co() {
|
|
2177
|
+
if (!this.Or || this.Gn.size === 0) return;
|
|
2143
2178
|
const t = /* @__PURE__ */ new Map();
|
|
2144
|
-
for (const e of this.
|
|
2145
|
-
const i = this.
|
|
2179
|
+
for (const e of this.Gn.values()) {
|
|
2180
|
+
const i = this.Fo(e.clientX, e.clientY, e.id, e);
|
|
2146
2181
|
t.set(e.id, i);
|
|
2147
2182
|
}
|
|
2148
|
-
this.
|
|
2183
|
+
this.Gn = t;
|
|
2149
2184
|
}
|
|
2150
|
-
|
|
2151
|
-
return Array.from(this.
|
|
2152
|
-
}
|
|
2153
|
-
Fo(t) {
|
|
2154
|
-
this.Vn = t;
|
|
2155
|
-
}
|
|
2156
|
-
mn(t) {
|
|
2157
|
-
this.qn = t;
|
|
2185
|
+
zo() {
|
|
2186
|
+
return Array.from(this.Gn.values()).map((t) => ({ ...t }));
|
|
2158
2187
|
}
|
|
2159
|
-
|
|
2188
|
+
Ro(t) {
|
|
2160
2189
|
this.Zn = t;
|
|
2161
2190
|
}
|
|
2162
|
-
|
|
2191
|
+
An(t) {
|
|
2163
2192
|
this.Qn = t;
|
|
2164
2193
|
}
|
|
2165
2194
|
To(t) {
|
|
@@ -2171,127 +2200,133 @@ class ot {
|
|
|
2171
2200
|
So(t) {
|
|
2172
2201
|
this.eo = t;
|
|
2173
2202
|
}
|
|
2174
|
-
|
|
2203
|
+
$o(t) {
|
|
2175
2204
|
this.io = t;
|
|
2176
2205
|
}
|
|
2177
|
-
|
|
2206
|
+
Eo(t) {
|
|
2178
2207
|
this.ro = t;
|
|
2179
2208
|
}
|
|
2180
2209
|
Do(t) {
|
|
2181
2210
|
this.no = t;
|
|
2182
2211
|
}
|
|
2183
|
-
|
|
2212
|
+
ko(t) {
|
|
2213
|
+
this.oo = t;
|
|
2214
|
+
}
|
|
2215
|
+
Bo(t) {
|
|
2216
|
+
this.ho = t;
|
|
2217
|
+
}
|
|
2218
|
+
wo(t) {
|
|
2184
2219
|
var s;
|
|
2185
|
-
if (!this.
|
|
2186
|
-
t.preventDefault(), (s = this.
|
|
2187
|
-
const e = performance.now(), i = this.
|
|
2220
|
+
if (!this.Or) return;
|
|
2221
|
+
t.preventDefault(), (s = this.Hn) == null || s.en(this.vo);
|
|
2222
|
+
const e = performance.now(), i = this.Lo(t.changedTouches);
|
|
2188
2223
|
for (const r of i) {
|
|
2189
|
-
const n = this.
|
|
2190
|
-
n && this.
|
|
2224
|
+
const n = this.Gn.get(r.id);
|
|
2225
|
+
n && this.In.set(r.id, this.Oo(n)), this.Gn.set(r.id, r);
|
|
2191
2226
|
const o = { id: r.id, startPosition: r, lastPosition: r, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
|
|
2192
|
-
this.
|
|
2193
|
-
const c = this.
|
|
2194
|
-
c && (o.longPressFired = !0, this.
|
|
2195
|
-
}, this.
|
|
2227
|
+
this.ro && (o.longPressTimer = window.setTimeout(() => {
|
|
2228
|
+
const c = this.Gn.get(r.id);
|
|
2229
|
+
c && (o.longPressFired = !0, this.ro({ touch: this.Oo(c), duration: performance.now() - o.startTime, originalEvent: t }));
|
|
2230
|
+
}, this.uo)), this.Nn.set(r.id, o), this.Zn && this.Zn(this.Ho(r, t, void 0, e));
|
|
2196
2231
|
}
|
|
2197
|
-
this.
|
|
2232
|
+
this.Gn.size === 2 && this.Go();
|
|
2198
2233
|
}
|
|
2199
|
-
|
|
2234
|
+
bo(t) {
|
|
2200
2235
|
var s;
|
|
2201
|
-
if (!this.
|
|
2202
|
-
t.preventDefault(), (s = this.
|
|
2203
|
-
const e = performance.now(), i = this.
|
|
2236
|
+
if (!this.Or) return;
|
|
2237
|
+
t.preventDefault(), (s = this.Hn) == null || s.en(this.vo);
|
|
2238
|
+
const e = performance.now(), i = this.Lo(t.changedTouches);
|
|
2204
2239
|
for (const r of i) {
|
|
2205
|
-
const n = this.
|
|
2206
|
-
o && this.
|
|
2207
|
-
const c = this.
|
|
2208
|
-
c && (c.lastPosition = r, c.lastTime = e, o) && this.
|
|
2240
|
+
const n = this.Gn.get(r.id), o = n ? this.Oo(n) : void 0;
|
|
2241
|
+
o && this.In.set(r.id, o), this.Gn.set(r.id, r);
|
|
2242
|
+
const c = this.Nn.get(r.id);
|
|
2243
|
+
c && (c.lastPosition = r, c.lastTime = e, o) && this.Io(o, r, !0) > this.fo && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.Qn && this.Qn(this.Ho(r, t, o, e));
|
|
2209
2244
|
}
|
|
2210
|
-
this.
|
|
2245
|
+
this.Gn.size === 2 ? this.No(t) : this.Xn = null;
|
|
2211
2246
|
}
|
|
2212
|
-
|
|
2213
|
-
if (!this.
|
|
2247
|
+
xo(t) {
|
|
2248
|
+
if (!this.Or) return;
|
|
2214
2249
|
t.preventDefault();
|
|
2215
|
-
const e = performance.now(), i = this.
|
|
2250
|
+
const e = performance.now(), i = this.Lo(t.changedTouches);
|
|
2216
2251
|
for (const s of i) {
|
|
2217
|
-
const r = this.
|
|
2218
|
-
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.
|
|
2252
|
+
const r = this.Gn.get(s.id), n = r ? this.Oo(r) : void 0, o = this.Nn.get(s.id);
|
|
2253
|
+
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.Jn && this.Jn(this.Ho(s, t, n, e)), o && this.Xo(o, t), this.Nn.delete(s.id), this.In.delete(s.id), this.Gn.delete(s.id);
|
|
2219
2254
|
}
|
|
2220
|
-
this.
|
|
2255
|
+
this.Gn.size < 2 && (this.Xn = null);
|
|
2221
2256
|
}
|
|
2222
|
-
|
|
2223
|
-
if (!this.
|
|
2257
|
+
Mo(t) {
|
|
2258
|
+
if (!this.Or) return;
|
|
2224
2259
|
t.preventDefault();
|
|
2225
|
-
const e = performance.now(), i = this.
|
|
2260
|
+
const e = performance.now(), i = this.Lo(t.changedTouches);
|
|
2226
2261
|
for (const s of i) {
|
|
2227
|
-
const r = this.
|
|
2228
|
-
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.
|
|
2262
|
+
const r = this.Gn.get(s.id), n = r ? this.Oo(r) : void 0, o = this.Nn.get(s.id);
|
|
2263
|
+
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.so && this.so(this.Ho(s, t, n, e)), this.Nn.delete(s.id), this.In.delete(s.id), this.Gn.delete(s.id);
|
|
2229
2264
|
}
|
|
2230
|
-
this.
|
|
2265
|
+
this.Gn.size < 2 && (this.Xn = null);
|
|
2231
2266
|
}
|
|
2232
|
-
|
|
2267
|
+
Lo(t) {
|
|
2233
2268
|
const e = [];
|
|
2234
2269
|
for (let i = 0; i < t.length; i += 1) {
|
|
2235
2270
|
const s = t.item(i);
|
|
2236
|
-
s && e.push(this.
|
|
2271
|
+
s && e.push(this.Wo(s));
|
|
2237
2272
|
}
|
|
2238
2273
|
return e;
|
|
2239
2274
|
}
|
|
2240
|
-
|
|
2241
|
-
return this.
|
|
2275
|
+
Wo(t) {
|
|
2276
|
+
return this.Fo(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 });
|
|
2242
2277
|
}
|
|
2243
|
-
|
|
2244
|
-
const r = this.
|
|
2278
|
+
Fo(t, e, i, s) {
|
|
2279
|
+
const r = this.er.canvas, n = r.getBoundingClientRect(), o = t - n.left, c = e - n.top, l = r.width / n.width, f = c * (r.height / n.height), u = o * l - this.Or.offsetX, m = f - this.Or.offsetY, p = Math.floor(u / this.Or.cellWidth), g = Math.floor(m / this.Or.cellHeight), d = p >= 0 && p < this.Or.cols && g >= 0 && g < this.Or.rows;
|
|
2245
2280
|
return { id: i, x: d ? p : -1, y: d ? g : -1, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
|
|
2246
2281
|
}
|
|
2247
|
-
|
|
2248
|
-
const r = this.
|
|
2249
|
-
return { touch: this.
|
|
2282
|
+
Ho(t, e, i, s) {
|
|
2283
|
+
const r = this.Nn.get(t.id), n = Array.from(this.In.values()).map((l) => this.Oo(l)), o = Array.from(this.Gn.values()).map((l) => this.Oo(l)), c = this.Lo(e.changedTouches);
|
|
2284
|
+
return { touch: this.Oo(t), previousTouch: i ? this.Oo(i) : void 0, touches: o, previousTouches: n, changedTouches: c, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
|
|
2250
2285
|
}
|
|
2251
|
-
|
|
2252
|
-
if (this.
|
|
2253
|
-
const t = Array.from(this.
|
|
2254
|
-
this.
|
|
2286
|
+
Go() {
|
|
2287
|
+
if (this.Gn.size !== 2) return void (this.Xn = null);
|
|
2288
|
+
const t = Array.from(this.Gn.values()), [e, i] = t, s = this.Io(e, i, !1), r = this.Ko(e, i);
|
|
2289
|
+
this.Xn = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
|
|
2255
2290
|
}
|
|
2256
|
-
|
|
2257
|
-
if (this.
|
|
2258
|
-
const [e, i] = this.
|
|
2291
|
+
No(t) {
|
|
2292
|
+
if (this.Xn || this.Go(), !this.Xn) return;
|
|
2293
|
+
const [e, i] = this.Xn.ids, s = this.Gn.get(e), r = this.Gn.get(i);
|
|
2259
2294
|
if (!s || !r) return;
|
|
2260
|
-
const n = this.
|
|
2261
|
-
this.
|
|
2262
|
-
let c = this.
|
|
2295
|
+
const n = this.Io(s, r, !1) / this.Xn.initialDistance, o = n - this.Xn.lastScale;
|
|
2296
|
+
this.oo && Math.abs(o) > this._o && (this.oo({ touches: [this.Oo(s), this.Oo(r)], scale: n, deltaScale: o, center: this.jo(s, r), originalEvent: t }), this.Xn.lastScale = n);
|
|
2297
|
+
let c = this.Ko(s, r) - this.Xn.initialAngle;
|
|
2263
2298
|
c = (c + 180) % 360 - 180;
|
|
2264
|
-
const l = c - this.
|
|
2265
|
-
this.
|
|
2299
|
+
const l = c - this.Xn.lastRotation;
|
|
2300
|
+
this.ho && Math.abs(l) > this.mo && (this.ho({ touches: [this.Oo(s), this.Oo(r)], rotation: c, deltaRotation: l, center: this.jo(s, r), originalEvent: t }), this.Xn.lastRotation = c);
|
|
2266
2301
|
}
|
|
2267
|
-
|
|
2268
|
-
const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.
|
|
2302
|
+
jo(t, e) {
|
|
2303
|
+
const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.Fo(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
|
|
2269
2304
|
return { x: r.x, y: r.y };
|
|
2270
2305
|
}
|
|
2271
|
-
|
|
2272
|
-
const i = performance.now(), s = i - t.startTime, r = this.
|
|
2273
|
-
if (!t.longPressFired && s <= this.
|
|
2274
|
-
this.
|
|
2275
|
-
else if (!t.longPressFired && s <= this.
|
|
2306
|
+
Xo(t, e) {
|
|
2307
|
+
const i = performance.now(), s = i - t.startTime, r = this.Io(t.startPosition, t.lastPosition, !0);
|
|
2308
|
+
if (!t.longPressFired && s <= this.ao && r <= this.lo)
|
|
2309
|
+
this.Yo(t.lastPosition, i) && this.io ? this.io({ touch: this.Oo(t.lastPosition), taps: 2, originalEvent: e }) : this.eo && this.eo({ touch: this.Oo(t.lastPosition), taps: 1, originalEvent: e });
|
|
2310
|
+
else if (!t.longPressFired && s <= this.po && r >= this.do) {
|
|
2276
2311
|
const n = { x: t.lastPosition.clientX - t.startPosition.clientX, y: t.lastPosition.clientY - t.startPosition.clientY }, o = Math.max(Math.hypot(n.x, n.y), 1e-4), c = { x: n.x / o, y: n.y / o }, l = { x: n.x / s, y: n.y / s };
|
|
2277
|
-
this.
|
|
2312
|
+
this.no && this.no({ touch: this.Oo(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
|
|
2278
2313
|
}
|
|
2279
|
-
this.
|
|
2314
|
+
this.Ao = i, this.yo = this.Oo(t.lastPosition);
|
|
2280
2315
|
}
|
|
2281
|
-
|
|
2282
|
-
return !this.
|
|
2316
|
+
Yo(t, e) {
|
|
2317
|
+
return !this.yo || e - this.Ao > this.co ? !1 : this.Io(t, this.yo, !0) <= this.lo;
|
|
2283
2318
|
}
|
|
2284
|
-
|
|
2319
|
+
Oo(t) {
|
|
2285
2320
|
return { ...t };
|
|
2286
2321
|
}
|
|
2287
|
-
|
|
2322
|
+
Io(t, e, i) {
|
|
2288
2323
|
return i ? Math.hypot(t.clientX - e.clientX, t.clientY - e.clientY) : Math.hypot(t.x - e.x, t.y - e.y);
|
|
2289
2324
|
}
|
|
2290
|
-
|
|
2325
|
+
Ko(t, e) {
|
|
2291
2326
|
return 180 * Math.atan2(e.clientY - t.clientY, e.clientX - t.clientX) / Math.PI;
|
|
2292
2327
|
}
|
|
2293
2328
|
}
|
|
2294
|
-
const
|
|
2329
|
+
const Vt = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: ot }, Symbol.toStringTag, { value: "Module" })), qt = (a) => class extends a {
|
|
2295
2330
|
rotate(t = 0, e = 0, i = 0) {
|
|
2296
2331
|
this.xt.state.st(t), this.xt.state.et(e), this.xt.state.it(i);
|
|
2297
2332
|
}
|
|
@@ -2305,7 +2340,7 @@ const kt = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
|
|
|
2305
2340
|
this.xt.state.it(t);
|
|
2306
2341
|
}
|
|
2307
2342
|
push() {
|
|
2308
|
-
this.xt.state.
|
|
2343
|
+
this.xt.state.G();
|
|
2309
2344
|
}
|
|
2310
2345
|
pop() {
|
|
2311
2346
|
this.xt.state.Z();
|
|
@@ -2326,7 +2361,7 @@ const kt = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
|
|
|
2326
2361
|
this.xt.qe(t, e, i, s);
|
|
2327
2362
|
}
|
|
2328
2363
|
char(t) {
|
|
2329
|
-
this.xt.state.rt(this.
|
|
2364
|
+
this.xt.state.rt(this.$i.Pi(t));
|
|
2330
2365
|
}
|
|
2331
2366
|
charColor(t, e, i, s = 255) {
|
|
2332
2367
|
this.xt.state.nt(t, e, i, s);
|
|
@@ -2356,7 +2391,7 @@ const kt = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
|
|
|
2356
2391
|
this.xt.Ke(t, e, i, s, r, n);
|
|
2357
2392
|
}
|
|
2358
2393
|
bezierCurve(t, e, i, s, r, n, o, c) {
|
|
2359
|
-
this.xt.
|
|
2394
|
+
this.xt.je(t, e, i, s, r, n, o, c);
|
|
2360
2395
|
}
|
|
2361
2396
|
arc(t, e, i, s, r, n) {
|
|
2362
2397
|
this.xt.Ve(t, e, i, s, r, n);
|
|
@@ -2374,7 +2409,7 @@ const kt = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
|
|
|
2374
2409
|
return this.xt.hs(t);
|
|
2375
2410
|
}
|
|
2376
2411
|
createFramebuffer(t) {
|
|
2377
|
-
return this.xt.
|
|
2412
|
+
return this.xt.Ye(t.width, t.height, 5, { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte" });
|
|
2378
2413
|
}
|
|
2379
2414
|
image(t, e, i, s, r) {
|
|
2380
2415
|
if (t.textures) {
|
|
@@ -2382,293 +2417,344 @@ const kt = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager:
|
|
|
2382
2417
|
this.xt.Oe(n, e, i, s ?? n.width, r ?? n.height);
|
|
2383
2418
|
} else {
|
|
2384
2419
|
const n = t;
|
|
2385
|
-
this.xt.
|
|
2420
|
+
this.xt.He(n, e, i, s ?? Math.floor(this.Or.cols / 2), r ?? Math.floor(this.Or.rows / 2));
|
|
2386
2421
|
}
|
|
2387
2422
|
}
|
|
2388
2423
|
async loadImage(t) {
|
|
2389
|
-
if (typeof t != "string") return G.
|
|
2424
|
+
if (typeof t != "string") return G.zr(this.xt, t, (s) => this.$i.Si(s));
|
|
2390
2425
|
const e = t, i = await new Promise((s, r) => {
|
|
2391
2426
|
const n = new Image();
|
|
2392
2427
|
n.crossOrigin = "anonymous", n.onload = () => s(n), n.onerror = (o) => r(o), n.src = e;
|
|
2393
2428
|
});
|
|
2394
|
-
return G.
|
|
2429
|
+
return G.zr(this.xt, i, (s) => this.$i.Si(s));
|
|
2395
2430
|
}
|
|
2396
|
-
},
|
|
2431
|
+
}, Kt = (a) => class extends a {
|
|
2397
2432
|
async loadFont(t) {
|
|
2398
|
-
return this.
|
|
2399
|
-
const e = this.
|
|
2400
|
-
this.
|
|
2433
|
+
return this.$i.qi(t).then(() => {
|
|
2434
|
+
const e = this.$i.maxGlyphDimensions;
|
|
2435
|
+
this.Or.hr(e.width, e.height), this.Vo.resize(this.Or.cols, this.Or.rows), this.xt.Ze(), this.Hn.hn();
|
|
2401
2436
|
});
|
|
2402
2437
|
}
|
|
2403
2438
|
fontSize(t) {
|
|
2404
|
-
if (!
|
|
2405
|
-
this.
|
|
2406
|
-
const e = this.
|
|
2407
|
-
this.
|
|
2439
|
+
if (!z.v(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) || this.$i.fontSize === t) return;
|
|
2440
|
+
this.$i.Vi(t);
|
|
2441
|
+
const e = this.$i.maxGlyphDimensions;
|
|
2442
|
+
this.Or.hr(e.width, e.height), this.Vo.resize(this.Or.cols, this.Or.rows), this.xt.Ze(), this.Hn.hn();
|
|
2408
2443
|
}
|
|
2409
2444
|
glyphColor(t) {
|
|
2410
|
-
return this.
|
|
2445
|
+
return this.$i.Pi(t);
|
|
2411
2446
|
}
|
|
2412
2447
|
glyphColors(t) {
|
|
2413
|
-
return this.
|
|
2448
|
+
return this.$i.Si(t);
|
|
2414
2449
|
}
|
|
2415
|
-
},
|
|
2450
|
+
}, jt = (a) => class extends a {
|
|
2416
2451
|
get frameCount() {
|
|
2417
|
-
return this.
|
|
2452
|
+
return this.qo.frameCount;
|
|
2418
2453
|
}
|
|
2419
2454
|
set frameCount(t) {
|
|
2420
|
-
this.
|
|
2455
|
+
this.qo.frameCount = t;
|
|
2421
2456
|
}
|
|
2422
2457
|
frameRate(t) {
|
|
2423
|
-
return t === void 0 ? this.
|
|
2458
|
+
return t === void 0 ? this.qo.currentFrameRate : this.qo.frameRate(t, () => this.Zo());
|
|
2424
2459
|
}
|
|
2425
2460
|
noLoop() {
|
|
2426
|
-
this.
|
|
2461
|
+
this.qo.pause();
|
|
2427
2462
|
}
|
|
2428
2463
|
loop() {
|
|
2429
|
-
this.
|
|
2464
|
+
this.qo.resume(() => this.Zo());
|
|
2430
2465
|
}
|
|
2431
2466
|
redraw(t = 1) {
|
|
2432
|
-
if (
|
|
2467
|
+
if (z.v(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.Zo();
|
|
2433
2468
|
}
|
|
2434
2469
|
isLooping() {
|
|
2435
|
-
return this.
|
|
2470
|
+
return this.qo.isLooping;
|
|
2436
2471
|
}
|
|
2437
2472
|
}, Zt = (a) => class extends a {
|
|
2438
2473
|
constructor(...t) {
|
|
2439
2474
|
super(...t);
|
|
2440
2475
|
}
|
|
2441
2476
|
mouseClicked(t) {
|
|
2442
|
-
this.
|
|
2477
|
+
this.Hn.mn(t);
|
|
2443
2478
|
}
|
|
2444
2479
|
mousePressed(t) {
|
|
2445
|
-
this.
|
|
2480
|
+
this.Hn.vn(t);
|
|
2446
2481
|
}
|
|
2447
2482
|
mouseReleased(t) {
|
|
2448
|
-
this.
|
|
2483
|
+
this.Hn.gn(t);
|
|
2449
2484
|
}
|
|
2450
2485
|
mouseMoved(t) {
|
|
2451
|
-
this.
|
|
2486
|
+
this.Hn.An(t);
|
|
2452
2487
|
}
|
|
2453
2488
|
mouseScrolled(t) {
|
|
2454
|
-
this.
|
|
2489
|
+
this.Hn.yn(t);
|
|
2455
2490
|
}
|
|
2456
2491
|
get mouse() {
|
|
2457
|
-
return this.
|
|
2492
|
+
return this.Hn.Cn();
|
|
2458
2493
|
}
|
|
2459
2494
|
cursor(t) {
|
|
2460
|
-
this.
|
|
2495
|
+
this.Hn.nn(t);
|
|
2461
2496
|
}
|
|
2462
2497
|
}, Qt = (a) => class extends a {
|
|
2463
2498
|
constructor(...t) {
|
|
2464
2499
|
super(...t);
|
|
2465
2500
|
}
|
|
2466
2501
|
touchStarted(t) {
|
|
2467
|
-
this.
|
|
2502
|
+
this.Qo.Ro(t);
|
|
2468
2503
|
}
|
|
2469
2504
|
touchMoved(t) {
|
|
2470
|
-
this.
|
|
2505
|
+
this.Qo.An(t);
|
|
2471
2506
|
}
|
|
2472
2507
|
touchEnded(t) {
|
|
2473
|
-
this.
|
|
2508
|
+
this.Qo.To(t);
|
|
2474
2509
|
}
|
|
2475
2510
|
touchCancelled(t) {
|
|
2476
|
-
this.
|
|
2511
|
+
this.Qo.Po(t);
|
|
2477
2512
|
}
|
|
2478
2513
|
tap(t) {
|
|
2479
|
-
this.
|
|
2514
|
+
this.Qo.So(t);
|
|
2480
2515
|
}
|
|
2481
2516
|
doubleTap(t) {
|
|
2482
|
-
this.
|
|
2517
|
+
this.Qo.$o(t);
|
|
2483
2518
|
}
|
|
2484
2519
|
longPress(t) {
|
|
2485
|
-
this.
|
|
2520
|
+
this.Qo.Eo(t);
|
|
2486
2521
|
}
|
|
2487
2522
|
swipe(t) {
|
|
2488
|
-
this.
|
|
2523
|
+
this.Qo.Do(t);
|
|
2489
2524
|
}
|
|
2490
2525
|
pinch(t) {
|
|
2491
|
-
this.
|
|
2526
|
+
this.Qo.ko(t);
|
|
2492
2527
|
}
|
|
2493
2528
|
rotateGesture(t) {
|
|
2494
|
-
this.
|
|
2529
|
+
this.Qo.Bo(t);
|
|
2495
2530
|
}
|
|
2496
2531
|
get touches() {
|
|
2497
|
-
return this.
|
|
2532
|
+
return this.Qo.zo();
|
|
2498
2533
|
}
|
|
2499
2534
|
}, Jt = (a) => class extends a {
|
|
2500
2535
|
constructor(...t) {
|
|
2501
2536
|
super(...t);
|
|
2502
2537
|
}
|
|
2503
2538
|
keyPressed(t) {
|
|
2504
|
-
this.
|
|
2539
|
+
this.Jo.vn(t);
|
|
2505
2540
|
}
|
|
2506
2541
|
keyReleased(t) {
|
|
2507
|
-
this.
|
|
2542
|
+
this.Jo.gn(t);
|
|
2508
2543
|
}
|
|
2509
2544
|
isKeyPressed(t) {
|
|
2510
|
-
return this.
|
|
2545
|
+
return this.Jo.$n(t);
|
|
2511
2546
|
}
|
|
2512
2547
|
get lastKeyPressed() {
|
|
2513
|
-
return this.
|
|
2548
|
+
return this.Jo.Dn();
|
|
2514
2549
|
}
|
|
2515
2550
|
get lastKeyReleased() {
|
|
2516
|
-
return this.
|
|
2551
|
+
return this.Jo.kn();
|
|
2517
2552
|
}
|
|
2518
2553
|
get pressedKeys() {
|
|
2519
|
-
return this.
|
|
2554
|
+
return this.Jo.Bn();
|
|
2520
2555
|
}
|
|
2521
2556
|
get modifierState() {
|
|
2522
|
-
return this.
|
|
2557
|
+
return this.Jo.Ln();
|
|
2523
2558
|
}
|
|
2524
2559
|
};
|
|
2525
2560
|
class $t {
|
|
2561
|
+
constructor(t) {
|
|
2562
|
+
h(this, "th");
|
|
2563
|
+
h(this, "sh", /* @__PURE__ */ new Map());
|
|
2564
|
+
h(this, "eh", []);
|
|
2565
|
+
h(this, "ih", /* @__PURE__ */ new Map());
|
|
2566
|
+
h(this, "rh", /* @__PURE__ */ new Map());
|
|
2567
|
+
this.th = t;
|
|
2568
|
+
}
|
|
2569
|
+
async nh(t) {
|
|
2570
|
+
for (const e of t) {
|
|
2571
|
+
if (this.sh.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
|
|
2572
|
+
const i = this.oh(e.name);
|
|
2573
|
+
try {
|
|
2574
|
+
await e.install(this.th, i);
|
|
2575
|
+
} catch (s) {
|
|
2576
|
+
throw this.hh(e.name), s;
|
|
2577
|
+
}
|
|
2578
|
+
this.sh.set(e.name, e), this.eh.push(e.name);
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
async ah(t) {
|
|
2582
|
+
const e = this.sh.get(t);
|
|
2583
|
+
if (!e) return;
|
|
2584
|
+
const i = this.oh(t);
|
|
2585
|
+
if (e.uninstall) try {
|
|
2586
|
+
await e.uninstall(this.th, i);
|
|
2587
|
+
} catch (s) {
|
|
2588
|
+
console.error(`[textmode.js] Error while uninstalling plugin "${t}":`, s);
|
|
2589
|
+
}
|
|
2590
|
+
this.sh.delete(t), this.eh.splice(this.eh.indexOf(t), 1), this.hh(t);
|
|
2591
|
+
}
|
|
2592
|
+
runPreDrawHooks() {
|
|
2593
|
+
this.uh(this.ih, "preDraw");
|
|
2594
|
+
}
|
|
2595
|
+
runPostDrawHooks() {
|
|
2596
|
+
this.uh(this.rh, "postDraw");
|
|
2597
|
+
}
|
|
2598
|
+
async fh() {
|
|
2599
|
+
const t = [...this.sh.keys()];
|
|
2600
|
+
for (const e of t) await this.ah(e);
|
|
2601
|
+
}
|
|
2602
|
+
oh(t) {
|
|
2603
|
+
return { ...this.th.dh(), registerPreDrawHook: (e) => this.ph(this.ih, t, e), registerPostDrawHook: (e) => this.ph(this.rh, t, e) };
|
|
2604
|
+
}
|
|
2605
|
+
ph(t, e, i) {
|
|
2606
|
+
const s = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
2607
|
+
return s.add(i), t.set(e, s), () => {
|
|
2608
|
+
const r = t.get(e);
|
|
2609
|
+
r && (r.delete(i), r.size === 0 && t.delete(e));
|
|
2610
|
+
};
|
|
2611
|
+
}
|
|
2612
|
+
hh(t) {
|
|
2613
|
+
this.ih.delete(t), this.rh.delete(t);
|
|
2614
|
+
}
|
|
2615
|
+
uh(t, e) {
|
|
2616
|
+
for (const i of this.eh) {
|
|
2617
|
+
const s = t.get(i);
|
|
2618
|
+
if (s) for (const r of s) try {
|
|
2619
|
+
r();
|
|
2620
|
+
} catch (n) {
|
|
2621
|
+
console.error(`[textmode.js] Plugin "${i}" ${e} hook failed:`, n);
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
class te {
|
|
2526
2627
|
constructor() {
|
|
2527
2628
|
h(this, "xt");
|
|
2528
|
-
h(this, "
|
|
2529
|
-
h(this, "
|
|
2530
|
-
h(this, "
|
|
2531
|
-
h(this, "jo");
|
|
2532
|
-
h(this, "Ln");
|
|
2629
|
+
h(this, "$i");
|
|
2630
|
+
h(this, "er");
|
|
2631
|
+
h(this, "Or");
|
|
2533
2632
|
h(this, "qo");
|
|
2534
|
-
h(this, "
|
|
2633
|
+
h(this, "Hn");
|
|
2535
2634
|
h(this, "Qo");
|
|
2536
|
-
h(this, "Yo");
|
|
2537
2635
|
h(this, "Jo");
|
|
2538
|
-
h(this, "
|
|
2539
|
-
h(this, "
|
|
2636
|
+
h(this, "_h");
|
|
2637
|
+
h(this, "Vo");
|
|
2638
|
+
h(this, "mh");
|
|
2639
|
+
h(this, "gh");
|
|
2640
|
+
h(this, "Ah");
|
|
2540
2641
|
}
|
|
2541
|
-
|
|
2642
|
+
Zo() {
|
|
2542
2643
|
}
|
|
2543
2644
|
}
|
|
2544
|
-
class
|
|
2645
|
+
class ee extends function(e, ...i) {
|
|
2545
2646
|
return i.reduce((s, r) => r(s), e);
|
|
2546
|
-
}(
|
|
2647
|
+
}(te, qt, Kt, jt, Zt, Qt, Jt) {
|
|
2547
2648
|
constructor(e = {}) {
|
|
2548
|
-
var i;
|
|
2549
2649
|
super();
|
|
2550
|
-
h(this, "
|
|
2551
|
-
h(this, "
|
|
2552
|
-
h(this, "
|
|
2553
|
-
h(this, "nh", !1);
|
|
2554
|
-
h(this, "oh", () => {
|
|
2650
|
+
h(this, "yh");
|
|
2651
|
+
h(this, "Ch", !1);
|
|
2652
|
+
h(this, "wh", () => {
|
|
2555
2653
|
});
|
|
2556
|
-
h(this, "
|
|
2654
|
+
h(this, "bh", () => {
|
|
2557
2655
|
});
|
|
2558
|
-
h(this, "
|
|
2656
|
+
h(this, "xh", () => {
|
|
2559
2657
|
});
|
|
2560
|
-
h(this, "
|
|
2561
|
-
h(this, "
|
|
2562
|
-
h(this, "
|
|
2563
|
-
h(this, "
|
|
2564
|
-
this.
|
|
2565
|
-
}
|
|
2566
|
-
async
|
|
2567
|
-
await this.
|
|
2568
|
-
const i = this.
|
|
2569
|
-
this.
|
|
2570
|
-
}
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
async gh(e) {
|
|
2575
|
-
const i = this.eh.get(e);
|
|
2576
|
-
i && (i.uninstall && await i.uninstall(this, this.mh()), this.eh.delete(e));
|
|
2577
|
-
}
|
|
2578
|
-
async use(e) {
|
|
2579
|
-
return this.rh ? await this.ph([e]) : this.ih.push(e), this;
|
|
2580
|
-
}
|
|
2581
|
-
async unuse(e) {
|
|
2582
|
-
return this.rh ? (await this.gh(e), this) : (this.ih = this.ih.filter((i) => i.name !== e), this);
|
|
2583
|
-
}
|
|
2584
|
-
hasPlugin(e) {
|
|
2585
|
-
return this.rh ? this.eh.has(e) : this.ih.some((i) => i.name === e) || this.eh.has(e);
|
|
2586
|
-
}
|
|
2587
|
-
mh() {
|
|
2588
|
-
return { renderer: this.xt, font: this.Ei, grid: this.Br, canvas: this.tr, drawFramebuffer: this.Yo, asciiFramebuffer: this.th, flushDrawCommands: () => {
|
|
2589
|
-
this.xt.St(this.Qo);
|
|
2658
|
+
h(this, "Mh");
|
|
2659
|
+
h(this, "lr");
|
|
2660
|
+
h(this, "cr", !1);
|
|
2661
|
+
h(this, "Fh");
|
|
2662
|
+
this.yh = new $t(this), this.cr = e.overlay ?? !1, this.er = new Xt(e), this.xt = new Ut(this.er.gr()), this.$i = new Gt(this.xt, e.fontSize ?? 16), this.qo = new Yt(e.frameRate ?? 60), this.Hn = new rt(this.er), this.Qo = new ot(this.er, this.Hn), this.Jo = new nt(), this._h = this.xt.Pt(), this.mh = this.xt.rs(), this.zh(e);
|
|
2663
|
+
}
|
|
2664
|
+
async zh(e) {
|
|
2665
|
+
await this.$i.Ki(e.fontSource);
|
|
2666
|
+
const i = this.$i.maxGlyphDimensions;
|
|
2667
|
+
this.Or = new Ht(this.er.canvas, i.width, i.height), this.Hn.Ki(this.Or), this.Qo.Ki(this.Or), this.Vo = this.xt.Ye(this.Or.cols, this.Or.rows, 5), this.gh = this.xt.Ye(this.Or.width, this.Or.height, 1), this.cr && (this.Fh = G.zr(this.xt, this.er.targetCanvas, (s) => this.$i.Si(s))), this.Ah = this.xt.cs(st, "precision mediump float;uniform sampler2D Ua;uniform vec2 Ub;uniform vec2 Uc;uniform vec2 Ud;void main(){vec2 A=gl_FragCoord.xy-Uc;vec2 B=A*(Ub/Ud);vec2 C=(floor(B)+0.5)/Ub;gl_FragColor=texture2D(Ua,C);}"), this.Rh(), await this.yh.nh(e.plugins ?? []), this.wh(), this.qo.start(() => this.Zo());
|
|
2668
|
+
}
|
|
2669
|
+
dh() {
|
|
2670
|
+
return { renderer: this.xt, font: this.$i, grid: this.Or, canvas: this.er, drawFramebuffer: this.Vo, asciiFramebuffer: this.gh, flushDrawCommands: () => {
|
|
2671
|
+
this.xt.St(this._h);
|
|
2590
2672
|
} };
|
|
2591
2673
|
}
|
|
2592
|
-
|
|
2593
|
-
this.
|
|
2594
|
-
this.
|
|
2595
|
-
}, window.addEventListener("resize", this.
|
|
2596
|
-
this.
|
|
2597
|
-
}), window.ResizeObserver && this.
|
|
2598
|
-
this.resizeCanvas(this.
|
|
2599
|
-
}), this.
|
|
2600
|
-
}
|
|
2601
|
-
|
|
2602
|
-
if (this.
|
|
2603
|
-
if (this.
|
|
2674
|
+
Rh() {
|
|
2675
|
+
this.Mh = () => {
|
|
2676
|
+
this.cr && this.resizeCanvas(this.er.targetCanvas.width, this.er.targetCanvas.height), this.xh();
|
|
2677
|
+
}, window.addEventListener("resize", this.Mh), this.Hn.an(), this.Qo.an(), this.Jo.an(), window.addEventListener("blur", () => {
|
|
2678
|
+
this.Jo.On();
|
|
2679
|
+
}), window.ResizeObserver && this.cr && (this.lr = new ResizeObserver(() => {
|
|
2680
|
+
this.resizeCanvas(this.er.targetCanvas.width, this.er.targetCanvas.height);
|
|
2681
|
+
}), this.lr.observe(this.er.targetCanvas));
|
|
2682
|
+
}
|
|
2683
|
+
Zo() {
|
|
2684
|
+
if (this.qo.measureFrameRate(), this.qo.incrementFrame(), this.Ch) return;
|
|
2685
|
+
if (this.cr) {
|
|
2604
2686
|
const i = this.xt.context;
|
|
2605
|
-
i.bindTexture(i.TEXTURE_2D, this.
|
|
2687
|
+
i.bindTexture(i.TEXTURE_2D, this.Fh.texture), i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, 1), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, i.RGBA, i.UNSIGNED_BYTE, this.er.targetCanvas), i.bindTexture(i.TEXTURE_2D, null);
|
|
2606
2688
|
}
|
|
2607
|
-
this.
|
|
2689
|
+
this.yh.runPreDrawHooks(), this.Vo.begin(), this.xt.ke(this._h), this.bh(), this.xt.St(this._h), this.Vo.end(), this.gh.begin(), this.xt.ke(this.mh), this.mh.Wt({ U0: this.$i.fontFramebuffer, U1: [this.$i.textureColumns, this.$i.textureRows], U2: this.Vo.textures[0], U3: this.Vo.textures[1], U4: this.Vo.textures[2], U5: this.Vo.textures[4], U6: this.Vo.textures[3], U7: [this.Or.cols, this.Or.rows], U8: [this.gh.width, this.gh.height], U9: this.gh.width / this.gh.height }), this.xt.Ie(0, 0, this.er.width, this.er.height), this.gh.end();
|
|
2608
2690
|
const e = this.xt.state.canvasBackgroundColor;
|
|
2609
|
-
this.xt.
|
|
2691
|
+
this.xt.Ys(e[0], e[1], e[2], e[3]), this.xt.ke(this.Ah), this.Ah.Wt({ Ua: this.gh.textures[0], Ub: [this.gh.width, this.gh.height], Uc: [this.Or.offsetX, this.Or.offsetY], Ud: [this.Or.width, this.Or.height] }), this.xt.Ie(this.Or.offsetX, this.Or.offsetY, this.Or.width, this.Or.height), this.yh.runPostDrawHooks();
|
|
2610
2692
|
}
|
|
2611
2693
|
setup(e) {
|
|
2612
|
-
this.
|
|
2694
|
+
this.wh = e;
|
|
2613
2695
|
}
|
|
2614
2696
|
draw(e) {
|
|
2615
|
-
this.
|
|
2697
|
+
this.bh = e;
|
|
2616
2698
|
}
|
|
2617
2699
|
windowResized(e) {
|
|
2618
|
-
this.
|
|
2700
|
+
this.xh = e;
|
|
2619
2701
|
}
|
|
2620
2702
|
resizeCanvas(e, i) {
|
|
2621
|
-
this.
|
|
2703
|
+
this.er.vr(e, i), this.Or.nr(), this.Vo.resize(this.Or.cols, this.Or.rows), this.gh.resize(this.Or.width, this.Or.height), this.xt.Ze(), this.Hn.hn(), this.Qo.Co(), this.Zo();
|
|
2622
2704
|
}
|
|
2623
2705
|
destroy() {
|
|
2624
|
-
this.
|
|
2706
|
+
this.Ch || (this.qo.stop(), this.yh.fh().catch((e) => {
|
|
2707
|
+
console.error("[textmode.js] Error while disposing plugins:", e);
|
|
2708
|
+
}), window.removeEventListener("resize", this.Mh), this.Hn._n(), this.Qo._n(), this.Jo._n(), this.$i.Dt(), this.xt.Dt(), this.gh.Dt(), this.Ah.Dt(), this.Fh && this.Fh.Dt(), this.Ch = !0);
|
|
2625
2709
|
}
|
|
2626
2710
|
get grid() {
|
|
2627
|
-
return this.
|
|
2711
|
+
return this.Or;
|
|
2628
2712
|
}
|
|
2629
2713
|
get font() {
|
|
2630
|
-
return this
|
|
2714
|
+
return this.$i;
|
|
2631
2715
|
}
|
|
2632
2716
|
get width() {
|
|
2633
|
-
return this.
|
|
2717
|
+
return this.er.width;
|
|
2634
2718
|
}
|
|
2635
2719
|
get height() {
|
|
2636
|
-
return this.
|
|
2720
|
+
return this.er.height;
|
|
2637
2721
|
}
|
|
2638
2722
|
get canvas() {
|
|
2639
|
-
return this.
|
|
2723
|
+
return this.er.canvas;
|
|
2724
|
+
}
|
|
2725
|
+
get drawFramebuffer() {
|
|
2726
|
+
return this.Vo;
|
|
2640
2727
|
}
|
|
2641
2728
|
get isDisposed() {
|
|
2642
|
-
return this.
|
|
2729
|
+
return this.Ch;
|
|
2643
2730
|
}
|
|
2644
2731
|
get overlay() {
|
|
2645
|
-
return this.
|
|
2732
|
+
return this.Fh;
|
|
2646
2733
|
}
|
|
2647
2734
|
}
|
|
2648
2735
|
class Q {
|
|
2649
2736
|
constructor() {
|
|
2650
2737
|
}
|
|
2651
2738
|
static create(t = {}) {
|
|
2652
|
-
return new
|
|
2739
|
+
return new ee(t);
|
|
2653
2740
|
}
|
|
2654
2741
|
static setErrorLevel(t) {
|
|
2655
|
-
|
|
2742
|
+
z.A(t);
|
|
2656
2743
|
}
|
|
2657
2744
|
static get version() {
|
|
2658
|
-
return "0.
|
|
2745
|
+
return "0.4.0";
|
|
2659
2746
|
}
|
|
2660
2747
|
}
|
|
2661
|
-
const
|
|
2748
|
+
const se = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: kt, mouse: Wt, touch: Vt }, Symbol.toStringTag, { value: "Module" })), re = Q.create, ne = Q.setErrorLevel, oe = Q.version;
|
|
2662
2749
|
export {
|
|
2663
|
-
|
|
2750
|
+
Xt as TextmodeCanvas,
|
|
2664
2751
|
ct as TextmodeErrorLevel,
|
|
2665
2752
|
Gt as TextmodeFont,
|
|
2666
|
-
|
|
2667
|
-
|
|
2753
|
+
j as TextmodeFramebuffer,
|
|
2754
|
+
Ht as TextmodeGrid,
|
|
2668
2755
|
G as TextmodeImage,
|
|
2669
|
-
|
|
2756
|
+
ee as Textmodifier,
|
|
2670
2757
|
re as create,
|
|
2671
|
-
ie as export,
|
|
2672
2758
|
se as input,
|
|
2673
2759
|
ne as setErrorLevel,
|
|
2674
2760
|
Q as textmode,
|