@factorialco/f0-react 1.415.0 → 1.416.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{F0HILActionConfirmation-Bu877U3G.js → F0HILActionConfirmation-BSTBAAeF.js} +381 -448
- package/dist/ai.d.ts +189 -447
- package/dist/ai.js +27 -60
- package/dist/experimental.d.ts +52 -7
- package/dist/experimental.js +1782 -1796
- package/dist/f0.d.ts +206 -447
- package/dist/f0.js +13030 -4020
- package/dist/i18n-provider-defaults.d.ts +20 -7
- package/dist/i18n-provider-defaults.js +17 -4
- package/dist/index-uiINov39.js +48074 -0
- package/dist/{F0AiChat.css → index.css} +1 -1
- package/dist/{F0Input-Ctwd5zZH.js → registry-B2RMtJNl.js} +160862 -68438
- package/dist/{F0AnalyticsDashboard.css → registry.css} +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/F0AiChat-CrcLUV-I.js +0 -63788
- package/dist/F0AnalyticsDashboard-BhvG-yU1.js +0 -54136
- package/dist/F0ChatDashboard.d.ts +0 -364
- package/dist/F0ChatDashboard.js +0 -292
- package/dist/index-BZMnPkIB.js +0 -22909
- package/dist/useDataCollectionSource-BH2-U4PN.js +0 -8206
- package/dist/useDataCollectionSource.css +0 -1
|
@@ -1,42 +1,42 @@
|
|
|
1
|
+
import { defaultTranslations as ke } from "./i18n-provider-defaults.js";
|
|
1
2
|
import { jsx as q, jsxs as le } from "react/jsx-runtime";
|
|
2
|
-
import { useInsertionEffect as
|
|
3
|
-
import { r as
|
|
4
|
-
import { useTrackVolume as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
ze(() => t.on(e, r), [t, e, r]);
|
|
3
|
+
import { useInsertionEffect as Xe, createContext as Ye, useContext as $e, useRef as B, useEffect as ie, useState as Ue, useCallback as qe, useMemo as He } from "react";
|
|
4
|
+
import { r as Ke, l as je, m as Qe, n as Je, o as Me, p as Ze, q as et, s as tt, t as rt, v as nt, w as Ne, x as ot, V as it, y as st, z as at, A as ct, S as ut, H as lt, B as se, D as ft, E as dt, G as ht, J as mt, K as pt, L as vt, M as fe, N as gt } from "./registry-B2RMtJNl.js";
|
|
5
|
+
import { useTrackVolume as wt } from "@livekit/components-react";
|
|
6
|
+
function Tt(t, e, r) {
|
|
7
|
+
Xe(() => t.on(e, r), [t, e, r]);
|
|
8
8
|
}
|
|
9
9
|
function ue(t) {
|
|
10
10
|
return typeof t == "object" && !Array.isArray(t);
|
|
11
11
|
}
|
|
12
12
|
function Oe(t, e, r, n) {
|
|
13
|
-
return typeof t == "string" && ue(e) ?
|
|
13
|
+
return typeof t == "string" && ue(e) ? Ke(t, r, n) : t instanceof NodeList ? Array.from(t) : Array.isArray(t) ? t : [t];
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function yt(t, e, r) {
|
|
16
16
|
return t * (e + 1);
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function de(t, e, r, n) {
|
|
19
19
|
return typeof e == "number" ? e : e.startsWith("-") || e.startsWith("+") ? Math.max(0, t + parseFloat(e)) : e === "<" ? r : n.get(e) ?? t;
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const Et = (t, e, r) => {
|
|
22
22
|
const n = e - t;
|
|
23
23
|
return ((r - t) % n + n) % n + t;
|
|
24
24
|
};
|
|
25
25
|
function Be(t, e) {
|
|
26
|
-
return je(t) ? t[
|
|
26
|
+
return je(t) ? t[Et(0, t.length, e)] : t;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function At(t, e, r) {
|
|
29
29
|
for (let n = 0; n < t.length; n++) {
|
|
30
30
|
const o = t[n];
|
|
31
|
-
o.at > e && o.at < r && (
|
|
31
|
+
o.at > e && o.at < r && (Je(t, o), n--);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
34
|
+
function bt(t, e, r, n, o, c) {
|
|
35
|
+
At(t, o, c);
|
|
36
36
|
for (let m = 0; m < e.length; m++)
|
|
37
37
|
t.push({
|
|
38
38
|
value: e[m],
|
|
39
|
-
at:
|
|
39
|
+
at: Qe(o, c, n[m]),
|
|
40
40
|
easing: Be(r, m)
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -47,114 +47,114 @@ function Rt(t, e) {
|
|
|
47
47
|
function xt(t, e) {
|
|
48
48
|
return t.at === e.at ? t.value === null ? 1 : e.value === null ? -1 : 0 : t.at - e.at;
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
function
|
|
52
|
-
const c = e.duration || 0.3, m = /* @__PURE__ */ new Map(),
|
|
50
|
+
const Lt = "easeInOut", St = 20;
|
|
51
|
+
function It(t, { defaultTransition: e = {}, ...r } = {}, n, o) {
|
|
52
|
+
const c = e.duration || 0.3, m = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), v = {}, R = /* @__PURE__ */ new Map();
|
|
53
53
|
let p = 0, g = 0, x = 0;
|
|
54
54
|
for (let l = 0; l < t.length; l++) {
|
|
55
|
-
const
|
|
56
|
-
if (typeof
|
|
57
|
-
R.set(
|
|
55
|
+
const T = t[l];
|
|
56
|
+
if (typeof T == "string") {
|
|
57
|
+
R.set(T, g);
|
|
58
58
|
continue;
|
|
59
|
-
} else if (!Array.isArray(
|
|
60
|
-
R.set(
|
|
59
|
+
} else if (!Array.isArray(T)) {
|
|
60
|
+
R.set(T.name, de(g, T.at, p, R));
|
|
61
61
|
continue;
|
|
62
62
|
}
|
|
63
|
-
let [
|
|
64
|
-
|
|
65
|
-
let
|
|
66
|
-
const U = (
|
|
67
|
-
const
|
|
68
|
-
let { ease: M = e.ease || "easeOut", duration:
|
|
69
|
-
const N = typeof f == "function" ? f(P,
|
|
70
|
-
if (
|
|
71
|
-
let
|
|
72
|
-
if (
|
|
73
|
-
const J =
|
|
74
|
-
|
|
63
|
+
let [C, h, L = {}] = T;
|
|
64
|
+
L.at !== void 0 && (g = de(g, L.at, p, R));
|
|
65
|
+
let I = 0;
|
|
66
|
+
const U = (y, w, _, P = 0, V = 0) => {
|
|
67
|
+
const b = _t(y), { delay: f = 0, times: F = Ze(b), type: O = "keyframes", repeat: z, repeatType: W, repeatDelay: H = 0, ...k } = w;
|
|
68
|
+
let { ease: M = e.ease || "easeOut", duration: S } = w;
|
|
69
|
+
const N = typeof f == "function" ? f(P, V) : f, K = b.length, Z = rt(O) ? O : o?.[O];
|
|
70
|
+
if (K <= 2 && Z) {
|
|
71
|
+
let j = 100;
|
|
72
|
+
if (K === 2 && Pt(b)) {
|
|
73
|
+
const J = b[1] - b[0];
|
|
74
|
+
j = Math.abs(J);
|
|
75
75
|
}
|
|
76
|
-
const Q = { ...
|
|
77
|
-
|
|
78
|
-
const ee =
|
|
79
|
-
M = ee.ease,
|
|
76
|
+
const Q = { ...k };
|
|
77
|
+
S !== void 0 && (Q.duration = nt(S));
|
|
78
|
+
const ee = et(Q, j, Z);
|
|
79
|
+
M = ee.ease, S = ee.duration;
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
S ?? (S = c);
|
|
82
82
|
const $ = g + N;
|
|
83
|
-
|
|
84
|
-
const re =
|
|
85
|
-
if (re > 0 &&
|
|
86
|
-
Ne(
|
|
87
|
-
const
|
|
83
|
+
F.length === 1 && F[0] === 0 && (F[1] = 1);
|
|
84
|
+
const re = F.length - b.length;
|
|
85
|
+
if (re > 0 && tt(F, re), b.length === 1 && b.unshift(null), z) {
|
|
86
|
+
Ne(z < St, "Repeat count too high, must be less than 20"), S = yt(S, z);
|
|
87
|
+
const j = [...b], Q = [...F];
|
|
88
88
|
M = Array.isArray(M) ? [...M] : [M];
|
|
89
89
|
const ee = [...M];
|
|
90
|
-
for (let J = 0; J <
|
|
91
|
-
|
|
92
|
-
for (let i = 0; i <
|
|
93
|
-
|
|
90
|
+
for (let J = 0; J < z; J++) {
|
|
91
|
+
b.push(...j);
|
|
92
|
+
for (let i = 0; i < j.length; i++)
|
|
93
|
+
F.push(Q[i] + (J + 1)), M.push(i === 0 ? "linear" : Be(ee, i - 1));
|
|
94
94
|
}
|
|
95
|
-
Rt(
|
|
95
|
+
Rt(F, z);
|
|
96
96
|
}
|
|
97
|
-
const ne = $ +
|
|
98
|
-
|
|
97
|
+
const ne = $ + S;
|
|
98
|
+
bt(_, b, M, F, $, ne), I = Math.max(N + S, I), x = Math.max(ne, x);
|
|
99
99
|
};
|
|
100
|
-
if (Me(
|
|
101
|
-
const
|
|
102
|
-
U(
|
|
100
|
+
if (Me(C)) {
|
|
101
|
+
const y = he(C, E);
|
|
102
|
+
U(h, L, me("default", y));
|
|
103
103
|
} else {
|
|
104
|
-
const
|
|
105
|
-
for (let
|
|
106
|
-
|
|
107
|
-
const P =
|
|
108
|
-
for (const
|
|
109
|
-
U(
|
|
104
|
+
const y = Oe(C, h, n, v), w = y.length;
|
|
105
|
+
for (let _ = 0; _ < w; _++) {
|
|
106
|
+
h = h, L = L;
|
|
107
|
+
const P = y[_], V = he(P, E);
|
|
108
|
+
for (const b in h)
|
|
109
|
+
U(h[b], Ft(L, b), me(b, V), _, w);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
p = g, g +=
|
|
112
|
+
p = g, g += I;
|
|
113
113
|
}
|
|
114
|
-
return
|
|
115
|
-
for (const
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
for (let w = 0; w <
|
|
120
|
-
const { at:
|
|
121
|
-
|
|
114
|
+
return E.forEach((l, T) => {
|
|
115
|
+
for (const C in l) {
|
|
116
|
+
const h = l[C];
|
|
117
|
+
h.sort(xt);
|
|
118
|
+
const L = [], I = [], U = [];
|
|
119
|
+
for (let w = 0; w < h.length; w++) {
|
|
120
|
+
const { at: _, value: P, easing: V } = h[w];
|
|
121
|
+
L.push(P), I.push(ot(0, x, _)), U.push(V || "easeOut");
|
|
122
122
|
}
|
|
123
|
-
|
|
123
|
+
I[0] !== 0 && (I.unshift(0), L.unshift(L[0]), U.unshift(Lt)), I[I.length - 1] !== 1 && (I.push(1), L.push(null)), m.has(T) || m.set(T, {
|
|
124
124
|
keyframes: {},
|
|
125
125
|
transition: {}
|
|
126
126
|
});
|
|
127
|
-
const
|
|
128
|
-
|
|
127
|
+
const y = m.get(T);
|
|
128
|
+
y.keyframes[C] = L, y.transition[C] = {
|
|
129
129
|
...e,
|
|
130
130
|
duration: x,
|
|
131
131
|
ease: U,
|
|
132
|
-
times:
|
|
132
|
+
times: I,
|
|
133
133
|
...r
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
}), m;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function he(t, e) {
|
|
139
139
|
return !e.has(t) && e.set(t, {}), e.get(t);
|
|
140
140
|
}
|
|
141
141
|
function me(t, e) {
|
|
142
142
|
return e[t] || (e[t] = []), e[t];
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function _t(t) {
|
|
145
145
|
return Array.isArray(t) ? t : [t];
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function Ft(t, e) {
|
|
148
148
|
return t && t[e] ? {
|
|
149
149
|
...t,
|
|
150
150
|
...t[e]
|
|
151
151
|
} : { ...t };
|
|
152
152
|
}
|
|
153
|
-
const
|
|
153
|
+
const Ct = (t) => typeof t == "number", Pt = (t) => t.every(Ct);
|
|
154
154
|
function Ut(t, e) {
|
|
155
155
|
return t in e;
|
|
156
156
|
}
|
|
157
|
-
class Mt extends
|
|
157
|
+
class Mt extends it {
|
|
158
158
|
constructor() {
|
|
159
159
|
super(...arguments), this.type = "object";
|
|
160
160
|
}
|
|
@@ -171,7 +171,7 @@ class Mt extends ot {
|
|
|
171
171
|
delete r.output[e];
|
|
172
172
|
}
|
|
173
173
|
measureInstanceViewportBox() {
|
|
174
|
-
return
|
|
174
|
+
return st();
|
|
175
175
|
}
|
|
176
176
|
build(e, r) {
|
|
177
177
|
Object.assign(e.output, r);
|
|
@@ -197,7 +197,7 @@ function Nt(t) {
|
|
|
197
197
|
},
|
|
198
198
|
latestValues: {}
|
|
199
199
|
}
|
|
200
|
-
}, r =
|
|
200
|
+
}, r = at(t) && !ct(t) ? new ut(e) : new lt(e);
|
|
201
201
|
r.mount(t), se.set(t, r);
|
|
202
202
|
}
|
|
203
203
|
function Ot(t) {
|
|
@@ -216,29 +216,29 @@ function Ot(t) {
|
|
|
216
216
|
function Bt(t, e) {
|
|
217
217
|
return Me(t) || typeof t == "number" || typeof t == "string" && !ue(e);
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function Ve(t, e, r, n) {
|
|
220
220
|
const o = [];
|
|
221
221
|
if (Bt(t, e))
|
|
222
|
-
o.push(
|
|
222
|
+
o.push(ft(t, ue(e) && e.default || e, r && (r.default || r)));
|
|
223
223
|
else {
|
|
224
224
|
const c = Oe(t, e, n), m = c.length;
|
|
225
225
|
Ne(!!m, "No valid elements provided.");
|
|
226
|
-
for (let
|
|
227
|
-
const v = c[
|
|
226
|
+
for (let E = 0; E < m; E++) {
|
|
227
|
+
const v = c[E], R = v instanceof Element ? Nt : Ot;
|
|
228
228
|
se.has(v) || R(v);
|
|
229
229
|
const p = se.get(v), g = { ...r };
|
|
230
|
-
"delay" in g && typeof g.delay == "function" && (g.delay = g.delay(
|
|
230
|
+
"delay" in g && typeof g.delay == "function" && (g.delay = g.delay(E, m)), o.push(...dt(p, { ...e, transition: g }, {}));
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
return o;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function Vt(t, e, r) {
|
|
236
236
|
const n = [];
|
|
237
|
-
return
|
|
238
|
-
n.push(...
|
|
237
|
+
return It(t, e, r, { spring: ht }).forEach(({ keyframes: c, transition: m }, E) => {
|
|
238
|
+
n.push(...Ve(E, c, m));
|
|
239
239
|
}), n;
|
|
240
240
|
}
|
|
241
|
-
class
|
|
241
|
+
class Dt {
|
|
242
242
|
constructor(e) {
|
|
243
243
|
this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean);
|
|
244
244
|
}
|
|
@@ -303,101 +303,37 @@ class Vt {
|
|
|
303
303
|
this.runAll("complete");
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
class Gt extends
|
|
306
|
+
class Gt extends Dt {
|
|
307
307
|
then(e, r) {
|
|
308
308
|
return this.finished.finally(e).then(() => {
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function Wt(t) {
|
|
313
313
|
return Array.isArray(t) && t.some(Array.isArray);
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function zt(t) {
|
|
316
316
|
function e(r, n, o) {
|
|
317
317
|
let c = [];
|
|
318
|
-
return
|
|
318
|
+
return Wt(r) ? c = Vt(r, n, t) : c = Ve(r, n, o, t), new Gt(c);
|
|
319
319
|
}
|
|
320
320
|
return e;
|
|
321
321
|
}
|
|
322
|
-
const
|
|
322
|
+
const kt = zt(), Er = ["xs", "sm", "md", "lg"], Ar = [
|
|
323
323
|
"inProgress",
|
|
324
324
|
"executing",
|
|
325
325
|
"completed"
|
|
326
|
-
],
|
|
327
|
-
ai:
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
startNewChat: "Start new chat",
|
|
331
|
-
scrollToBottom: "Scroll to bottom",
|
|
332
|
-
welcome: "Ask or create with One",
|
|
333
|
-
defaultInitialMessage: "How can I help you today?",
|
|
334
|
-
inputPlaceholder: "Ask about time, people, or company info and a lot of other things...",
|
|
335
|
-
stopAnswerGeneration: "Stop generating",
|
|
336
|
-
responseStopped: "You stopped this response",
|
|
337
|
-
sendMessage: "Send message",
|
|
338
|
-
thoughtsGroupTitle: "Reflection",
|
|
339
|
-
resourcesGroupTitle: "Resources",
|
|
340
|
-
thinking: "Thinking...",
|
|
341
|
-
closeDashboard: "Close dashboard",
|
|
342
|
-
exportTable: "Download table",
|
|
343
|
-
generatedTableFilename: "OneGeneratedTable",
|
|
344
|
-
feedbackModal: {
|
|
345
|
-
positive: {
|
|
346
|
-
title: "What did you like about this response?",
|
|
347
|
-
label: "Your feedback helps us make Factorial AI better",
|
|
348
|
-
placeholder: "Share what worked well"
|
|
349
|
-
},
|
|
350
|
-
negative: {
|
|
351
|
-
title: "What could have been better?",
|
|
352
|
-
label: "Your feedback helps us improve future answers",
|
|
353
|
-
placeholder: "Share what didn't work"
|
|
354
|
-
}
|
|
355
|
-
},
|
|
356
|
-
dataDownloadPreview: "Preview {{shown}} of {{total}} rows — download to see all data.",
|
|
357
|
-
expandChat: "Expand chat",
|
|
358
|
-
collapseChat: "Collapse chat",
|
|
359
|
-
chatHistory: "Chat history",
|
|
360
|
-
noPreviousChats: "No previous conversations",
|
|
361
|
-
newConversation: "New conversation",
|
|
362
|
-
today: "Today",
|
|
363
|
-
yesterday: "Yesterday",
|
|
364
|
-
thisMonth: "This month",
|
|
365
|
-
older: "Older",
|
|
366
|
-
searchChats: "Search conversations...",
|
|
367
|
-
pinnedChats: "Pinned",
|
|
368
|
-
threadOptions: "Thread options",
|
|
369
|
-
pinChat: "Pin chat",
|
|
370
|
-
unpinChat: "Unpin chat",
|
|
371
|
-
deleteChat: "Delete chat",
|
|
372
|
-
ask: "Ask One",
|
|
373
|
-
viewProfile: "View profile",
|
|
374
|
-
tools: "Tools",
|
|
375
|
-
reportCard: {
|
|
376
|
-
reportLabel: "Report",
|
|
377
|
-
openButton: "Open"
|
|
378
|
-
},
|
|
379
|
-
dataDownload: {
|
|
380
|
-
download: "Download {{format}}"
|
|
381
|
-
},
|
|
382
|
-
pong: {
|
|
383
|
-
ai: "AI",
|
|
384
|
-
you: "YOU",
|
|
385
|
-
youWin: "You win!",
|
|
386
|
-
youLose: "You lose!"
|
|
387
|
-
},
|
|
388
|
-
unsavedChanges: "Unsaved changes",
|
|
389
|
-
saveChanges: "Save changes",
|
|
390
|
-
discardChanges: "Discard"
|
|
391
|
-
}
|
|
392
|
-
}, Ve = Ye(null);
|
|
393
|
-
function xr({
|
|
326
|
+
], br = {
|
|
327
|
+
ai: ke.ai
|
|
328
|
+
}, De = Ye(null);
|
|
329
|
+
function Rr({
|
|
394
330
|
children: t,
|
|
395
331
|
translations: e
|
|
396
332
|
}) {
|
|
397
|
-
return /* @__PURE__ */ q(
|
|
333
|
+
return /* @__PURE__ */ q(De.Provider, { value: e, children: t });
|
|
398
334
|
}
|
|
399
|
-
function
|
|
400
|
-
const t =
|
|
335
|
+
function xr() {
|
|
336
|
+
const t = $e(De);
|
|
401
337
|
if (t === null)
|
|
402
338
|
throw new Error(
|
|
403
339
|
"useAiChatTranslations must be used within an AiChatTranslationsProvider"
|
|
@@ -405,114 +341,114 @@ function Sr() {
|
|
|
405
341
|
return t;
|
|
406
342
|
}
|
|
407
343
|
function pe(t, e, r, n) {
|
|
408
|
-
const o = Math.max(1, Math.min(t, e)), c = Math.min(r, 20),
|
|
344
|
+
const o = Math.max(1, Math.min(t, e)), c = Math.min(r, 20), E = Math.min(c + n, o), v = Math.min(E, Math.floor(t / 2)), R = Math.min(E, Math.floor(e / 2)), p = ($) => $ / t * 2 - 1, g = ($) => $ / e * 2 - 1, x = 0, l = t, T = 0, C = e, h = v, L = t - v, I = R, U = e - R, y = p(x), w = p(l), _ = g(T), P = g(C), V = p(h), b = p(L), f = g(I), F = g(U), O = 0, z = 0, W = 1, H = 1, k = v / t, M = 1 - v / t, S = R / e, N = 1 - R / e, K = new Float32Array([
|
|
409
345
|
// Top strip
|
|
410
|
-
|
|
411
|
-
|
|
346
|
+
y,
|
|
347
|
+
_,
|
|
412
348
|
w,
|
|
413
|
-
|
|
414
|
-
|
|
349
|
+
_,
|
|
350
|
+
y,
|
|
415
351
|
f,
|
|
416
|
-
|
|
352
|
+
y,
|
|
417
353
|
f,
|
|
418
354
|
w,
|
|
419
|
-
|
|
355
|
+
_,
|
|
420
356
|
w,
|
|
421
357
|
f,
|
|
422
358
|
// Bottom strip
|
|
423
|
-
|
|
424
|
-
|
|
359
|
+
y,
|
|
360
|
+
F,
|
|
425
361
|
w,
|
|
426
|
-
|
|
427
|
-
|
|
362
|
+
F,
|
|
363
|
+
y,
|
|
428
364
|
P,
|
|
429
|
-
|
|
365
|
+
y,
|
|
430
366
|
P,
|
|
431
367
|
w,
|
|
432
|
-
|
|
368
|
+
F,
|
|
433
369
|
w,
|
|
434
370
|
P,
|
|
435
371
|
// Left strip
|
|
436
|
-
|
|
372
|
+
y,
|
|
437
373
|
f,
|
|
438
|
-
|
|
374
|
+
V,
|
|
439
375
|
f,
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
376
|
+
y,
|
|
377
|
+
F,
|
|
378
|
+
y,
|
|
379
|
+
F,
|
|
380
|
+
V,
|
|
445
381
|
f,
|
|
446
|
-
|
|
447
|
-
|
|
382
|
+
V,
|
|
383
|
+
F,
|
|
448
384
|
// Right strip
|
|
449
|
-
|
|
385
|
+
b,
|
|
450
386
|
f,
|
|
451
387
|
w,
|
|
452
388
|
f,
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
389
|
+
b,
|
|
390
|
+
F,
|
|
391
|
+
b,
|
|
392
|
+
F,
|
|
457
393
|
w,
|
|
458
394
|
f,
|
|
459
395
|
w,
|
|
460
|
-
|
|
396
|
+
F
|
|
461
397
|
]), Z = new Float32Array([
|
|
462
398
|
// Top strip
|
|
463
399
|
O,
|
|
400
|
+
z,
|
|
464
401
|
W,
|
|
465
|
-
|
|
466
|
-
W,
|
|
402
|
+
z,
|
|
467
403
|
O,
|
|
468
|
-
|
|
404
|
+
S,
|
|
469
405
|
O,
|
|
470
|
-
|
|
471
|
-
k,
|
|
406
|
+
S,
|
|
472
407
|
W,
|
|
473
|
-
|
|
474
|
-
|
|
408
|
+
z,
|
|
409
|
+
W,
|
|
410
|
+
S,
|
|
475
411
|
// Bottom strip
|
|
476
412
|
O,
|
|
477
413
|
N,
|
|
478
|
-
|
|
414
|
+
W,
|
|
479
415
|
N,
|
|
480
416
|
O,
|
|
481
417
|
H,
|
|
482
418
|
O,
|
|
483
419
|
H,
|
|
484
|
-
|
|
420
|
+
W,
|
|
485
421
|
N,
|
|
486
|
-
|
|
422
|
+
W,
|
|
487
423
|
H,
|
|
488
424
|
// Left strip
|
|
489
425
|
O,
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
426
|
+
S,
|
|
427
|
+
k,
|
|
428
|
+
S,
|
|
493
429
|
O,
|
|
494
430
|
N,
|
|
495
431
|
O,
|
|
496
432
|
N,
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
433
|
+
k,
|
|
434
|
+
S,
|
|
435
|
+
k,
|
|
500
436
|
N,
|
|
501
437
|
// Right strip
|
|
502
438
|
M,
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
439
|
+
S,
|
|
440
|
+
W,
|
|
441
|
+
S,
|
|
506
442
|
M,
|
|
507
443
|
N,
|
|
508
444
|
M,
|
|
509
445
|
N,
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
446
|
+
W,
|
|
447
|
+
S,
|
|
448
|
+
W,
|
|
513
449
|
N
|
|
514
450
|
]);
|
|
515
|
-
return { positions:
|
|
451
|
+
return { positions: K, uvs: Z };
|
|
516
452
|
}
|
|
517
453
|
function ve(t, e, r) {
|
|
518
454
|
const n = t.createShader(e);
|
|
@@ -523,7 +459,7 @@ function ve(t, e, r) {
|
|
|
523
459
|
}
|
|
524
460
|
return n;
|
|
525
461
|
}
|
|
526
|
-
function
|
|
462
|
+
function Xt(t, e, r) {
|
|
527
463
|
const n = ve(t, t.VERTEX_SHADER, e), o = ve(t, t.FRAGMENT_SHADER, r), c = t.createProgram();
|
|
528
464
|
if (!c) throw new Error("Failed to create program");
|
|
529
465
|
if (t.attachShader(c, n), t.attachShader(c, o), t.linkProgram(c), !t.getProgramParameter(c, t.LINK_STATUS)) {
|
|
@@ -532,7 +468,7 @@ function Yt(t, e, r) {
|
|
|
532
468
|
}
|
|
533
469
|
return t.deleteShader(n), t.deleteShader(o), c;
|
|
534
470
|
}
|
|
535
|
-
const
|
|
471
|
+
const Yt = `#version 300 es
|
|
536
472
|
precision lowp float;
|
|
537
473
|
|
|
538
474
|
in vec2 vUV;
|
|
@@ -828,23 +764,23 @@ class Lr {
|
|
|
828
764
|
resize(e, r, n) {
|
|
829
765
|
if (this.disposed) throw new Error("Mask instance has been disposed.");
|
|
830
766
|
if (this.options.width = e, this.options.height = r, n && (this.options.ratio = n), !this.running) return;
|
|
831
|
-
const { gl: o, program: c, vao: m, positionBuffer:
|
|
767
|
+
const { gl: o, program: c, vao: m, positionBuffer: E, uvBuffer: v, uResolution: R } = this.glr, p = n ?? this.options.ratio ?? window.devicePixelRatio ?? 1, g = Math.max(1, Math.floor(e * p)), x = Math.max(1, Math.floor(r * p));
|
|
832
768
|
this.canvas.style.width = `${e}px`, this.canvas.style.height = `${r}px`, (this.canvas.width !== g || this.canvas.height !== x) && (this.canvas.width = g, this.canvas.height = x), o.viewport(0, 0, this.canvas.width, this.canvas.height), this.checkGLError(o, "resize: after viewport setup");
|
|
833
|
-
const { positions: l, uvs:
|
|
769
|
+
const { positions: l, uvs: T } = pe(
|
|
834
770
|
this.canvas.width,
|
|
835
771
|
this.canvas.height,
|
|
836
772
|
this.options.borderWidth * p,
|
|
837
773
|
this.options.glowWidth * p
|
|
838
774
|
);
|
|
839
|
-
o.bindVertexArray(m), o.bindBuffer(o.ARRAY_BUFFER,
|
|
840
|
-
const
|
|
841
|
-
o.enableVertexAttribArray(
|
|
842
|
-
const
|
|
843
|
-
o.enableVertexAttribArray(
|
|
844
|
-
const
|
|
845
|
-
this.lastTime =
|
|
846
|
-
const
|
|
847
|
-
this.render(
|
|
775
|
+
o.bindVertexArray(m), o.bindBuffer(o.ARRAY_BUFFER, E), o.bufferData(o.ARRAY_BUFFER, l, o.STATIC_DRAW);
|
|
776
|
+
const C = o.getAttribLocation(c, "aPosition");
|
|
777
|
+
o.enableVertexAttribArray(C), o.vertexAttribPointer(C, 2, o.FLOAT, !1, 0, 0), this.checkGLError(o, "resize: after position buffer update"), o.bindBuffer(o.ARRAY_BUFFER, v), o.bufferData(o.ARRAY_BUFFER, T, o.STATIC_DRAW);
|
|
778
|
+
const h = o.getAttribLocation(c, "aUV");
|
|
779
|
+
o.enableVertexAttribArray(h), o.vertexAttribPointer(h, 2, o.FLOAT, !1, 0, 0), this.checkGLError(o, "resize: after UV buffer update"), o.useProgram(c), o.uniform2f(R, this.canvas.width, this.canvas.height), o.uniform1f(this.glr.uBorderWidth, this.options.borderWidth * p), o.uniform1f(this.glr.uGlowWidth, this.options.glowWidth * p), o.uniform1f(this.glr.uBorderRadius, this.options.borderRadius * p), this.checkGLError(o, "resize: after uniform updates");
|
|
780
|
+
const L = performance.now();
|
|
781
|
+
this.lastTime = L;
|
|
782
|
+
const I = (L - this.startTime) * 1e-3;
|
|
783
|
+
this.render(I);
|
|
848
784
|
}
|
|
849
785
|
/**
|
|
850
786
|
* Automatically resizes the canvas to match the dimensions of the given element.
|
|
@@ -915,11 +851,11 @@ class Lr {
|
|
|
915
851
|
});
|
|
916
852
|
if (!e)
|
|
917
853
|
throw new Error("WebGL2 is required but not available.");
|
|
918
|
-
const r =
|
|
854
|
+
const r = Xt(e, $t, Yt);
|
|
919
855
|
this.checkGLError(e, "setupGL: after createProgram");
|
|
920
856
|
const n = e.createVertexArray();
|
|
921
857
|
e.bindVertexArray(n), this.checkGLError(e, "setupGL: after VAO creation");
|
|
922
|
-
const o = this.canvas.width || 2, c = this.canvas.height || 2, { positions: m, uvs:
|
|
858
|
+
const o = this.canvas.width || 2, c = this.canvas.height || 2, { positions: m, uvs: E } = pe(
|
|
923
859
|
o,
|
|
924
860
|
c,
|
|
925
861
|
this.options.borderWidth,
|
|
@@ -929,16 +865,16 @@ class Lr {
|
|
|
929
865
|
const R = e.getAttribLocation(r, "aPosition");
|
|
930
866
|
e.enableVertexAttribArray(R), e.vertexAttribPointer(R, 2, e.FLOAT, !1, 0, 0), this.checkGLError(e, "setupGL: after position buffer setup");
|
|
931
867
|
const p = e.createBuffer();
|
|
932
|
-
e.bindBuffer(e.ARRAY_BUFFER, p), e.bufferData(e.ARRAY_BUFFER,
|
|
868
|
+
e.bindBuffer(e.ARRAY_BUFFER, p), e.bufferData(e.ARRAY_BUFFER, E, e.STATIC_DRAW);
|
|
933
869
|
const g = e.getAttribLocation(r, "aUV");
|
|
934
870
|
e.enableVertexAttribArray(g), e.vertexAttribPointer(g, 2, e.FLOAT, !1, 0, 0), this.checkGLError(e, "setupGL: after UV buffer setup");
|
|
935
|
-
const x = e.getUniformLocation(r, "uResolution"), l = e.getUniformLocation(r, "uTime"),
|
|
936
|
-
e.useProgram(r), e.uniform1f(
|
|
937
|
-
const
|
|
938
|
-
for (let w = 0; w <
|
|
871
|
+
const x = e.getUniformLocation(r, "uResolution"), l = e.getUniformLocation(r, "uTime"), T = e.getUniformLocation(r, "uBorderWidth"), C = e.getUniformLocation(r, "uGlowWidth"), h = e.getUniformLocation(r, "uBorderRadius"), L = e.getUniformLocation(r, "uColors"), I = e.getUniformLocation(r, "uGlowExponent"), U = e.getUniformLocation(r, "uGlowFactor");
|
|
872
|
+
e.useProgram(r), e.uniform1f(T, this.options.borderWidth), e.uniform1f(C, this.options.glowWidth), e.uniform1f(h, this.options.borderRadius), this.options.mode === "dark" ? (e.uniform1f(I, 2), e.uniform1f(U, 1.8)) : (e.uniform1f(I, 1), e.uniform1f(U, 1));
|
|
873
|
+
const y = (this.options.colors || qt).map(Ht);
|
|
874
|
+
for (let w = 0; w < y.length; w++)
|
|
939
875
|
e.uniform3f(
|
|
940
876
|
e.getUniformLocation(r, `uColors[${w}]`),
|
|
941
|
-
...
|
|
877
|
+
...y[w]
|
|
942
878
|
);
|
|
943
879
|
this.checkGLError(e, "setupGL: after uniform setup"), e.bindVertexArray(null), e.bindBuffer(e.ARRAY_BUFFER, null), this.glr = {
|
|
944
880
|
gl: e,
|
|
@@ -948,10 +884,10 @@ class Lr {
|
|
|
948
884
|
uvBuffer: p,
|
|
949
885
|
uResolution: x,
|
|
950
886
|
uTime: l,
|
|
951
|
-
uBorderWidth:
|
|
952
|
-
uGlowWidth:
|
|
953
|
-
uBorderRadius:
|
|
954
|
-
uColors:
|
|
887
|
+
uBorderWidth: T,
|
|
888
|
+
uGlowWidth: C,
|
|
889
|
+
uBorderRadius: h,
|
|
890
|
+
uColors: L
|
|
955
891
|
};
|
|
956
892
|
}
|
|
957
893
|
render(e) {
|
|
@@ -960,19 +896,19 @@ class Lr {
|
|
|
960
896
|
r.useProgram(n), r.bindVertexArray(o), r.uniform1f(c, e), r.disable(r.DEPTH_TEST), r.disable(r.CULL_FACE), r.disable(r.BLEND), r.clearColor(0, 0, 0, 0), r.clear(r.COLOR_BUFFER_BIT), r.drawArrays(r.TRIANGLES, 0, 24), this.checkGLError(r, "render: after draw call"), r.bindVertexArray(null);
|
|
961
897
|
}
|
|
962
898
|
}
|
|
963
|
-
const ge = ["lowp", "mediump", "highp"],
|
|
899
|
+
const ge = ["lowp", "mediump", "highp"], Kt = `
|
|
964
900
|
void main(void){
|
|
965
901
|
vec4 color = vec4(0.0,0.0,0.0,1.0);
|
|
966
902
|
mainImage( color, gl_FragCoord.xy );
|
|
967
903
|
gl_FragColor = color;
|
|
968
|
-
}`,
|
|
904
|
+
}`, jt = `void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
|
|
969
905
|
vec2 uv = fragCoord/iResolution.xy;
|
|
970
906
|
vec3 col = 0.5 + 0.5*cos(iTime+uv.xyx+vec3(0,2,4));
|
|
971
907
|
fragColor = vec4(col,1.0);
|
|
972
908
|
}`, we = `attribute vec3 aVertexPosition;
|
|
973
909
|
void main(void) {
|
|
974
910
|
gl_Position = vec4(aVertexPosition, 1.0);
|
|
975
|
-
}`,
|
|
911
|
+
}`, Te = "iTime", ye = "iTimeDelta", Ee = "iDate", Ae = "iFrame", be = "iMouse", Re = "iResolution", Qt = "iChannel", xe = "iChannelResolution", Le = "iDeviceOrientation";
|
|
976
912
|
function Jt(t, e) {
|
|
977
913
|
return t.includes("Matrix") && Array.isArray(e);
|
|
978
914
|
}
|
|
@@ -1066,12 +1002,12 @@ const tr = (t, e, r, n) => {
|
|
|
1066
1002
|
return "mat4";
|
|
1067
1003
|
default:
|
|
1068
1004
|
console.error(
|
|
1069
|
-
|
|
1005
|
+
Y(
|
|
1070
1006
|
`The uniform type "${t}" is not valid, please make sure your uniform type is valid`
|
|
1071
1007
|
)
|
|
1072
1008
|
);
|
|
1073
1009
|
}
|
|
1074
|
-
}, ce = 9729,
|
|
1010
|
+
}, ce = 9729, Se = 9728, nr = 9987, Ie = 33071, _e = 10497;
|
|
1075
1011
|
class or {
|
|
1076
1012
|
gl;
|
|
1077
1013
|
url;
|
|
@@ -1091,12 +1027,12 @@ class or {
|
|
|
1091
1027
|
this.gl = e;
|
|
1092
1028
|
}
|
|
1093
1029
|
updateTexture = (e, r, n) => {
|
|
1094
|
-
const { gl: o } = this, c = 0, m = o.RGBA,
|
|
1030
|
+
const { gl: o } = this, c = 0, m = o.RGBA, E = o.RGBA, v = o.UNSIGNED_BYTE;
|
|
1095
1031
|
o.bindTexture(o.TEXTURE_2D, e), o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL, n), o.texImage2D(
|
|
1096
1032
|
o.TEXTURE_2D,
|
|
1097
1033
|
c,
|
|
1098
1034
|
m,
|
|
1099
|
-
|
|
1035
|
+
E,
|
|
1100
1036
|
v,
|
|
1101
1037
|
r
|
|
1102
1038
|
);
|
|
@@ -1129,7 +1065,7 @@ class or {
|
|
|
1129
1065
|
this.pow2canvas.width,
|
|
1130
1066
|
this.pow2canvas.height
|
|
1131
1067
|
), console.warn(
|
|
1132
|
-
|
|
1068
|
+
Y(
|
|
1133
1069
|
`Image is not power of two ${e.width} x ${e.height}. Resized to ${this.pow2canvas.width} x ${this.pow2canvas.height};`
|
|
1134
1070
|
)
|
|
1135
1071
|
), this.pow2canvas) : e;
|
|
@@ -1139,13 +1075,13 @@ class or {
|
|
|
1139
1075
|
wrapS: o,
|
|
1140
1076
|
wrapT: c,
|
|
1141
1077
|
minFilter: m,
|
|
1142
|
-
magFilter:
|
|
1078
|
+
magFilter: E,
|
|
1143
1079
|
flipY: v = -1
|
|
1144
1080
|
} = e;
|
|
1145
1081
|
if (!n)
|
|
1146
1082
|
return Promise.reject(
|
|
1147
1083
|
new Error(
|
|
1148
|
-
|
|
1084
|
+
Y(
|
|
1149
1085
|
"Missing url, please make sure to pass the url of your texture { url: ... }"
|
|
1150
1086
|
)
|
|
1151
1087
|
)
|
|
@@ -1154,53 +1090,53 @@ class or {
|
|
|
1154
1090
|
if (R === null && p === null)
|
|
1155
1091
|
return Promise.reject(
|
|
1156
1092
|
new Error(
|
|
1157
|
-
|
|
1093
|
+
Y(
|
|
1158
1094
|
`Please upload a video or an image with a valid format (url: ${n})`
|
|
1159
1095
|
)
|
|
1160
1096
|
)
|
|
1161
1097
|
);
|
|
1162
|
-
Object.assign(this, { url: n, wrapS: o, wrapT: c, minFilter: m, magFilter:
|
|
1163
|
-
const g = 0, x = r.RGBA, l = 1,
|
|
1098
|
+
Object.assign(this, { url: n, wrapS: o, wrapT: c, minFilter: m, magFilter: E, flipY: v });
|
|
1099
|
+
const g = 0, x = r.RGBA, l = 1, T = 1, C = 0, h = r.RGBA, L = r.UNSIGNED_BYTE, I = new Uint8Array([255, 255, 255, 0]), U = r.createTexture();
|
|
1164
1100
|
if (r.bindTexture(r.TEXTURE_2D, U), r.texImage2D(
|
|
1165
1101
|
r.TEXTURE_2D,
|
|
1166
1102
|
g,
|
|
1167
1103
|
x,
|
|
1168
1104
|
l,
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1105
|
+
T,
|
|
1106
|
+
C,
|
|
1107
|
+
h,
|
|
1108
|
+
L,
|
|
1109
|
+
I
|
|
1174
1110
|
), p) {
|
|
1175
1111
|
const P = this.setupVideo(n);
|
|
1176
1112
|
return r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, r.LINEAR), this._webglTexture = U, this.source = P, this.isVideo = !0, P.play().then(() => this);
|
|
1177
1113
|
}
|
|
1178
|
-
async function
|
|
1179
|
-
return new Promise((P,
|
|
1180
|
-
const
|
|
1181
|
-
|
|
1182
|
-
P(
|
|
1183
|
-
},
|
|
1184
|
-
|
|
1185
|
-
},
|
|
1114
|
+
async function y() {
|
|
1115
|
+
return new Promise((P, V) => {
|
|
1116
|
+
const b = new Image();
|
|
1117
|
+
b.crossOrigin = "anonymous", b.onload = () => {
|
|
1118
|
+
P(b);
|
|
1119
|
+
}, b.onerror = () => {
|
|
1120
|
+
V(new Error(Y(`failed loading url: ${n}`)));
|
|
1121
|
+
}, b.src = n ?? "";
|
|
1186
1122
|
});
|
|
1187
1123
|
}
|
|
1188
|
-
let w = await
|
|
1189
|
-
return (e.wrapS !==
|
|
1124
|
+
let w = await y(), _ = (w.width & w.width - 1) === 0 && (w.height & w.height - 1) === 0;
|
|
1125
|
+
return (e.wrapS !== Ie || e.wrapT !== Ie || e.minFilter !== Se && e.minFilter !== ce) && !_ && (w = this.makePowerOf2(w), _ = !0), r.bindTexture(r.TEXTURE_2D, U), r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL, v), r.texImage2D(
|
|
1190
1126
|
r.TEXTURE_2D,
|
|
1191
1127
|
g,
|
|
1192
1128
|
x,
|
|
1193
|
-
|
|
1194
|
-
|
|
1129
|
+
h,
|
|
1130
|
+
L,
|
|
1195
1131
|
w
|
|
1196
|
-
),
|
|
1132
|
+
), _ && e.minFilter !== Se && e.minFilter !== ce && r.generateMipmap(r.TEXTURE_2D), r.texParameteri(
|
|
1197
1133
|
r.TEXTURE_2D,
|
|
1198
1134
|
r.TEXTURE_WRAP_S,
|
|
1199
|
-
this.wrapS ||
|
|
1135
|
+
this.wrapS || _e
|
|
1200
1136
|
), r.texParameteri(
|
|
1201
1137
|
r.TEXTURE_2D,
|
|
1202
1138
|
r.TEXTURE_WRAP_T,
|
|
1203
|
-
this.wrapT ||
|
|
1139
|
+
this.wrapT || _e
|
|
1204
1140
|
), r.texParameteri(
|
|
1205
1141
|
r.TEXTURE_2D,
|
|
1206
1142
|
r.TEXTURE_MIN_FILTER,
|
|
@@ -1212,13 +1148,13 @@ class or {
|
|
|
1212
1148
|
), this._webglTexture = U, this.source = w, this.isVideo = !1, this.isLoaded = !0, this.width = w.width || 0, this.height = w.height || 0, this;
|
|
1213
1149
|
};
|
|
1214
1150
|
}
|
|
1215
|
-
const
|
|
1151
|
+
const Y = (t) => `react-shaders: ${t}`, Fe = (t) => {
|
|
1216
1152
|
if ("changedTouches" in t) {
|
|
1217
1153
|
const e = t.changedTouches[0];
|
|
1218
1154
|
return [e?.clientX ?? 0, e?.clientY ?? 0];
|
|
1219
1155
|
}
|
|
1220
1156
|
return [t.clientX, t.clientY];
|
|
1221
|
-
},
|
|
1157
|
+
}, Ce = (t, e, r) => t * (1 - r) + e * r, ir = (t, e, r) => r > 0 ? t.substring(0, r) + e + t.substring(r, t.length) : e + t;
|
|
1222
1158
|
function sr({
|
|
1223
1159
|
fs: t,
|
|
1224
1160
|
vs: e = we,
|
|
@@ -1227,38 +1163,38 @@ function sr({
|
|
|
1227
1163
|
clearColor: o = [0, 0, 0, 1],
|
|
1228
1164
|
precision: c = "highp",
|
|
1229
1165
|
style: m,
|
|
1230
|
-
contextAttributes:
|
|
1166
|
+
contextAttributes: E = {},
|
|
1231
1167
|
lerp: v = 1,
|
|
1232
1168
|
devicePixelRatio: R = 1,
|
|
1233
1169
|
onDoneLoadingTextures: p,
|
|
1234
1170
|
onError: g = console.error,
|
|
1235
1171
|
onWarning: x = console.warn
|
|
1236
1172
|
}) {
|
|
1237
|
-
const l = B(null),
|
|
1238
|
-
[ye]: { type: "float", isNeeded: !1, value: 0 },
|
|
1173
|
+
const l = B(null), T = B(null), C = B(null), h = B(null), L = B(void 0), I = B(void 0), U = B(!1), y = B(void 0), w = B(0), _ = B([0, 0]), P = B([]), V = B(0), b = B(void 0), f = B({
|
|
1239
1174
|
[Te]: { type: "float", isNeeded: !1, value: 0 },
|
|
1175
|
+
[ye]: { type: "float", isNeeded: !1, value: 0 },
|
|
1176
|
+
[Ee]: { type: "vec4", isNeeded: !1, value: [0, 0, 0, 0] },
|
|
1240
1177
|
[be]: { type: "vec4", isNeeded: !1, value: [0, 0, 0, 0] },
|
|
1241
|
-
[Ae]: { type: "vec4", isNeeded: !1, value: [0, 0, 0, 0] },
|
|
1242
1178
|
[Re]: { type: "vec2", isNeeded: !1, value: [0, 0] },
|
|
1243
|
-
[
|
|
1244
|
-
[
|
|
1179
|
+
[Ae]: { type: "int", isNeeded: !1, value: 0 },
|
|
1180
|
+
[Le]: {
|
|
1245
1181
|
type: "vec4",
|
|
1246
1182
|
isNeeded: !1,
|
|
1247
1183
|
value: [0, 0, 0, 0]
|
|
1248
1184
|
}
|
|
1249
|
-
}),
|
|
1250
|
-
const s = "width" in i ? i.width ?? 0 : 0,
|
|
1185
|
+
}), F = B(n), O = (i, a) => {
|
|
1186
|
+
const s = "width" in i ? i.width ?? 0 : 0, d = "height" in i ? i.height ?? 0 : 0, u = f.current.iChannelResolution;
|
|
1251
1187
|
if (!u) return;
|
|
1252
|
-
const
|
|
1253
|
-
|
|
1254
|
-
},
|
|
1255
|
-
l.current && (
|
|
1188
|
+
const A = Array.isArray(u.value) ? u.value : u.value = [];
|
|
1189
|
+
A[a * 3] = s * R, A[a * 3 + 1] = d * R, A[a * 3 + 2] = 0;
|
|
1190
|
+
}, z = () => {
|
|
1191
|
+
l.current && (T.current = l.current.getContext("webgl", E) || l.current.getContext(
|
|
1256
1192
|
"experimental-webgl",
|
|
1257
|
-
|
|
1258
|
-
),
|
|
1259
|
-
},
|
|
1260
|
-
const i =
|
|
1261
|
-
|
|
1193
|
+
E
|
|
1194
|
+
), T.current?.getExtension("OES_standard_derivatives"), T.current?.getExtension("EXT_shader_texture_lod"));
|
|
1195
|
+
}, W = () => {
|
|
1196
|
+
const i = T.current;
|
|
1197
|
+
C.current = i?.createBuffer() ?? null, i?.bindBuffer(i.ARRAY_BUFFER, C.current);
|
|
1262
1198
|
const a = [
|
|
1263
1199
|
1,
|
|
1264
1200
|
1,
|
|
@@ -1285,92 +1221,92 @@ function sr({
|
|
|
1285
1221
|
s ?? 0,
|
|
1286
1222
|
window.orientation ?? 0
|
|
1287
1223
|
];
|
|
1288
|
-
},
|
|
1289
|
-
const [a = 0, s = 0] =
|
|
1224
|
+
}, k = (i) => {
|
|
1225
|
+
const [a = 0, s = 0] = Fe(i), d = a - (y.current?.left ?? 0) - window.pageXOffset, u = (y.current?.height ?? 0) - s - (y.current?.top ?? 0) - window.pageYOffset;
|
|
1290
1226
|
U.current = !0;
|
|
1291
|
-
const
|
|
1292
|
-
|
|
1227
|
+
const A = Array.isArray(f.current.iMouse?.value) ? f.current.iMouse.value : void 0;
|
|
1228
|
+
A && (A[2] = d, A[3] = u), _.current[0] = d, _.current[1] = u;
|
|
1293
1229
|
}, M = (i) => {
|
|
1294
|
-
|
|
1295
|
-
const [a = 0, s = 0] =
|
|
1230
|
+
y.current = l.current?.getBoundingClientRect();
|
|
1231
|
+
const [a = 0, s = 0] = Fe(i), d = a - (y.current?.left ?? 0), u = (y.current?.height ?? 0) - s - (y.current?.top ?? 0);
|
|
1296
1232
|
if (v !== 1)
|
|
1297
|
-
|
|
1233
|
+
_.current[0] = d, _.current[1] = u;
|
|
1298
1234
|
else {
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1235
|
+
const A = Array.isArray(f.current.iMouse?.value) ? f.current.iMouse.value : void 0;
|
|
1236
|
+
A && (A[0] = d, A[1] = u);
|
|
1301
1237
|
}
|
|
1302
|
-
},
|
|
1238
|
+
}, S = () => {
|
|
1303
1239
|
const i = Array.isArray(f.current.iMouse?.value) ? f.current.iMouse.value : void 0;
|
|
1304
1240
|
i && (i[2] = 0, i[3] = 0);
|
|
1305
1241
|
}, N = () => {
|
|
1306
|
-
const i =
|
|
1242
|
+
const i = T.current;
|
|
1307
1243
|
if (!i) return;
|
|
1308
|
-
|
|
1244
|
+
y.current = l.current?.getBoundingClientRect();
|
|
1309
1245
|
const a = R, s = Math.floor(
|
|
1310
|
-
(
|
|
1311
|
-
),
|
|
1312
|
-
(
|
|
1246
|
+
(y.current?.width ?? 1) * a
|
|
1247
|
+
), d = Math.floor(
|
|
1248
|
+
(y.current?.height ?? 1) * a
|
|
1313
1249
|
);
|
|
1314
|
-
if (i.canvas.width = s, i.canvas.height =
|
|
1250
|
+
if (i.canvas.width = s, i.canvas.height = d, f.current.iResolution?.isNeeded && h.current) {
|
|
1315
1251
|
const u = i.getUniformLocation(
|
|
1316
|
-
|
|
1252
|
+
h.current,
|
|
1317
1253
|
Re
|
|
1318
1254
|
);
|
|
1319
1255
|
i.uniform2fv(u, [i.canvas.width, i.canvas.height]);
|
|
1320
1256
|
}
|
|
1321
|
-
},
|
|
1322
|
-
const s =
|
|
1257
|
+
}, K = (i, a) => {
|
|
1258
|
+
const s = T.current;
|
|
1323
1259
|
if (!s) return null;
|
|
1324
|
-
const
|
|
1325
|
-
if (!
|
|
1326
|
-
if (s.shaderSource(
|
|
1327
|
-
x?.(
|
|
1260
|
+
const d = s.createShader(i);
|
|
1261
|
+
if (!d) return null;
|
|
1262
|
+
if (s.shaderSource(d, a), s.compileShader(d), !s.getShaderParameter(d, s.COMPILE_STATUS)) {
|
|
1263
|
+
x?.(Y(`Error compiling the shader:
|
|
1328
1264
|
${a}`));
|
|
1329
|
-
const u = s.getShaderInfoLog(
|
|
1330
|
-
s.deleteShader(
|
|
1265
|
+
const u = s.getShaderInfoLog(d);
|
|
1266
|
+
s.deleteShader(d), g?.(Y(`Shader compiler log: ${u}`));
|
|
1331
1267
|
}
|
|
1332
|
-
return
|
|
1268
|
+
return d;
|
|
1333
1269
|
}, Z = (i, a) => {
|
|
1334
|
-
const s =
|
|
1270
|
+
const s = T.current;
|
|
1335
1271
|
if (!s) return;
|
|
1336
|
-
const
|
|
1337
|
-
if (
|
|
1338
|
-
if (s.attachShader(
|
|
1272
|
+
const d = K(s.FRAGMENT_SHADER, i), u = K(s.VERTEX_SHADER, a);
|
|
1273
|
+
if (h.current = s.createProgram(), !(!h.current || !u || !d)) {
|
|
1274
|
+
if (s.attachShader(h.current, u), s.attachShader(h.current, d), s.linkProgram(h.current), !s.getProgramParameter(h.current, s.LINK_STATUS)) {
|
|
1339
1275
|
g?.(
|
|
1340
|
-
|
|
1276
|
+
Y(
|
|
1341
1277
|
`Unable to initialize the shader program: ${s.getProgramInfoLog(
|
|
1342
|
-
|
|
1278
|
+
h.current
|
|
1343
1279
|
)}`
|
|
1344
1280
|
)
|
|
1345
1281
|
);
|
|
1346
1282
|
return;
|
|
1347
1283
|
}
|
|
1348
|
-
s.useProgram(
|
|
1349
|
-
|
|
1284
|
+
s.useProgram(h.current), L.current = s.getAttribLocation(
|
|
1285
|
+
h.current,
|
|
1350
1286
|
"aVertexPosition"
|
|
1351
|
-
), s.enableVertexAttribArray(
|
|
1287
|
+
), s.enableVertexAttribArray(L.current);
|
|
1352
1288
|
}
|
|
1353
1289
|
}, $ = () => {
|
|
1354
1290
|
if (n)
|
|
1355
1291
|
for (const i of Object.keys(n)) {
|
|
1356
1292
|
const a = n[i];
|
|
1357
1293
|
if (!a) continue;
|
|
1358
|
-
const { value: s, type:
|
|
1294
|
+
const { value: s, type: d } = a, u = rr(d);
|
|
1359
1295
|
if (!u) continue;
|
|
1360
|
-
const
|
|
1361
|
-
if (Jt(
|
|
1362
|
-
const
|
|
1363
|
-
s.length >
|
|
1364
|
-
} else Zt(
|
|
1296
|
+
const A = {};
|
|
1297
|
+
if (Jt(d, s)) {
|
|
1298
|
+
const D = d.length, X = Number.parseInt(d.charAt(D - 3)), te = Math.floor(s.length / (X * X));
|
|
1299
|
+
s.length > X * X && (A.arraySize = `[${te}]`);
|
|
1300
|
+
} else Zt(d, s) && (A.arraySize = `[${Math.floor(s.length / Number.parseInt(d.charAt(0)))}]`);
|
|
1365
1301
|
f.current[i] = {
|
|
1366
1302
|
type: u,
|
|
1367
1303
|
isNeeded: !1,
|
|
1368
1304
|
value: s,
|
|
1369
|
-
...
|
|
1305
|
+
...A
|
|
1370
1306
|
};
|
|
1371
1307
|
}
|
|
1372
1308
|
}, re = () => {
|
|
1373
|
-
const i =
|
|
1309
|
+
const i = T.current;
|
|
1374
1310
|
if (i)
|
|
1375
1311
|
if (r && r.length > 0) {
|
|
1376
1312
|
f.current[`${xe}`] = {
|
|
@@ -1380,11 +1316,11 @@ ${a}`));
|
|
|
1380
1316
|
value: []
|
|
1381
1317
|
};
|
|
1382
1318
|
const a = r.map(
|
|
1383
|
-
(s,
|
|
1319
|
+
(s, d) => (f.current[`${Qt}${d}`] = {
|
|
1384
1320
|
type: "sampler2D",
|
|
1385
1321
|
isNeeded: !1
|
|
1386
|
-
}, O(s,
|
|
1387
|
-
O(u,
|
|
1322
|
+
}, O(s, d), P.current[d] = new or(i), P.current[d]?.load(s).then((u) => {
|
|
1323
|
+
O(u, d);
|
|
1388
1324
|
}))
|
|
1389
1325
|
);
|
|
1390
1326
|
Promise.all(a).then(() => {
|
|
@@ -1397,58 +1333,58 @@ ${a}`));
|
|
|
1397
1333
|
const a = ge.includes(c ?? "highp"), s = `precision ${a ? c : ge[1]} float;
|
|
1398
1334
|
`;
|
|
1399
1335
|
a || x?.(
|
|
1400
|
-
|
|
1336
|
+
Y(
|
|
1401
1337
|
`wrong precision type ${c}, please make sure to pass one of a valid precision lowp, mediump, highp, by default you shader precision will be set to highp.`
|
|
1402
1338
|
)
|
|
1403
1339
|
);
|
|
1404
|
-
let
|
|
1340
|
+
let d = s.concat(`#define DPR ${R.toFixed(1)}
|
|
1405
1341
|
`).concat(i.replace(/texture\(/g, "texture2D("));
|
|
1406
|
-
for (const
|
|
1407
|
-
if (i.includes(
|
|
1408
|
-
const
|
|
1409
|
-
if (!
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
`uniform ${
|
|
1342
|
+
for (const A of Object.keys(f.current))
|
|
1343
|
+
if (i.includes(A)) {
|
|
1344
|
+
const D = f.current[A];
|
|
1345
|
+
if (!D) continue;
|
|
1346
|
+
d = ir(
|
|
1347
|
+
d,
|
|
1348
|
+
`uniform ${D.type} ${A}${D.arraySize || ""};
|
|
1413
1349
|
`,
|
|
1414
|
-
|
|
1415
|
-
),
|
|
1350
|
+
d.lastIndexOf(s) + s.length
|
|
1351
|
+
), D.isNeeded = !0;
|
|
1416
1352
|
}
|
|
1417
|
-
return i.includes("mainImage") && (
|
|
1418
|
-
},
|
|
1419
|
-
const a =
|
|
1420
|
-
if (!a || !
|
|
1421
|
-
const s =
|
|
1422
|
-
|
|
1423
|
-
const
|
|
1424
|
-
if (
|
|
1425
|
-
for (const u of Object.keys(
|
|
1426
|
-
const
|
|
1427
|
-
if (
|
|
1428
|
-
if (!
|
|
1429
|
-
const
|
|
1430
|
-
|
|
1353
|
+
return i.includes("mainImage") && (d = d.concat(Kt)), d;
|
|
1354
|
+
}, j = (i) => {
|
|
1355
|
+
const a = T.current;
|
|
1356
|
+
if (!a || !h.current) return;
|
|
1357
|
+
const s = V.current ? (i - V.current) / 1e3 : 0;
|
|
1358
|
+
V.current = i;
|
|
1359
|
+
const d = F.current;
|
|
1360
|
+
if (d)
|
|
1361
|
+
for (const u of Object.keys(d)) {
|
|
1362
|
+
const A = d[u];
|
|
1363
|
+
if (A && f.current[u]?.isNeeded) {
|
|
1364
|
+
if (!h.current) return;
|
|
1365
|
+
const D = a.getUniformLocation(
|
|
1366
|
+
h.current,
|
|
1431
1367
|
u
|
|
1432
1368
|
);
|
|
1433
|
-
if (!
|
|
1369
|
+
if (!D) return;
|
|
1434
1370
|
tr(
|
|
1435
1371
|
a,
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1372
|
+
D,
|
|
1373
|
+
A.type,
|
|
1374
|
+
A.value
|
|
1439
1375
|
);
|
|
1440
1376
|
}
|
|
1441
1377
|
}
|
|
1442
1378
|
if (f.current.iMouse?.isNeeded) {
|
|
1443
1379
|
const u = a.getUniformLocation(
|
|
1444
|
-
|
|
1445
|
-
|
|
1380
|
+
h.current,
|
|
1381
|
+
be
|
|
1446
1382
|
);
|
|
1447
1383
|
a.uniform4fv(u, f.current.iMouse.value);
|
|
1448
1384
|
}
|
|
1449
1385
|
if (f.current.iChannelResolution?.isNeeded) {
|
|
1450
1386
|
const u = a.getUniformLocation(
|
|
1451
|
-
|
|
1387
|
+
h.current,
|
|
1452
1388
|
xe
|
|
1453
1389
|
);
|
|
1454
1390
|
a.uniform3fv(
|
|
@@ -1458,8 +1394,8 @@ ${a}`));
|
|
|
1458
1394
|
}
|
|
1459
1395
|
if (f.current.iDeviceOrientation?.isNeeded) {
|
|
1460
1396
|
const u = a.getUniformLocation(
|
|
1461
|
-
|
|
1462
|
-
|
|
1397
|
+
h.current,
|
|
1398
|
+
Le
|
|
1463
1399
|
);
|
|
1464
1400
|
a.uniform4fv(
|
|
1465
1401
|
u,
|
|
@@ -1468,101 +1404,101 @@ ${a}`));
|
|
|
1468
1404
|
}
|
|
1469
1405
|
if (f.current.iTime?.isNeeded) {
|
|
1470
1406
|
const u = a.getUniformLocation(
|
|
1471
|
-
|
|
1472
|
-
|
|
1407
|
+
h.current,
|
|
1408
|
+
Te
|
|
1473
1409
|
);
|
|
1474
1410
|
a.uniform1f(u, w.current += s);
|
|
1475
1411
|
}
|
|
1476
1412
|
if (f.current.iTimeDelta?.isNeeded) {
|
|
1477
1413
|
const u = a.getUniformLocation(
|
|
1478
|
-
|
|
1479
|
-
|
|
1414
|
+
h.current,
|
|
1415
|
+
ye
|
|
1480
1416
|
);
|
|
1481
1417
|
a.uniform1f(u, s);
|
|
1482
1418
|
}
|
|
1483
1419
|
if (f.current.iDate?.isNeeded) {
|
|
1484
|
-
const u = /* @__PURE__ */ new Date(),
|
|
1485
|
-
|
|
1486
|
-
|
|
1420
|
+
const u = /* @__PURE__ */ new Date(), A = u.getMonth() + 1, D = u.getDate(), X = u.getFullYear(), te = u.getHours() * 60 * 60 + u.getMinutes() * 60 + u.getSeconds() + u.getMilliseconds() * 1e-3, ae = a.getUniformLocation(
|
|
1421
|
+
h.current,
|
|
1422
|
+
Ee
|
|
1487
1423
|
);
|
|
1488
|
-
a.uniform4fv(ae, [
|
|
1424
|
+
a.uniform4fv(ae, [X, A, D, te]);
|
|
1489
1425
|
}
|
|
1490
1426
|
if (f.current.iFrame?.isNeeded) {
|
|
1491
1427
|
const u = a.getUniformLocation(
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
),
|
|
1495
|
-
a.uniform1i(u,
|
|
1428
|
+
h.current,
|
|
1429
|
+
Ae
|
|
1430
|
+
), A = f.current.iFrame.value;
|
|
1431
|
+
a.uniform1i(u, A), f.current.iFrame.value = A + 1;
|
|
1496
1432
|
}
|
|
1497
1433
|
if (P.current.length > 0)
|
|
1498
1434
|
for (let u = 0; u < P.current.length; u++) {
|
|
1499
|
-
const
|
|
1500
|
-
if (!
|
|
1501
|
-
const { isVideo:
|
|
1502
|
-
if (!
|
|
1435
|
+
const A = P.current[u];
|
|
1436
|
+
if (!A) return;
|
|
1437
|
+
const { isVideo: D, _webglTexture: X, source: te, flipY: ae, isLoaded: We } = A;
|
|
1438
|
+
if (!We || !X || !te) return;
|
|
1503
1439
|
if (f.current[`iChannel${u}`]?.isNeeded) {
|
|
1504
|
-
if (!
|
|
1505
|
-
const
|
|
1506
|
-
|
|
1440
|
+
if (!h.current) return;
|
|
1441
|
+
const ze = a.getUniformLocation(
|
|
1442
|
+
h.current,
|
|
1507
1443
|
`iChannel${u}`
|
|
1508
1444
|
);
|
|
1509
|
-
a.activeTexture(a.TEXTURE0 + u), a.bindTexture(a.TEXTURE_2D,
|
|
1510
|
-
|
|
1445
|
+
a.activeTexture(a.TEXTURE0 + u), a.bindTexture(a.TEXTURE_2D, X), a.uniform1i(ze, u), D && A.updateTexture(
|
|
1446
|
+
X,
|
|
1511
1447
|
te,
|
|
1512
1448
|
ae
|
|
1513
1449
|
);
|
|
1514
1450
|
}
|
|
1515
1451
|
}
|
|
1516
1452
|
}, Q = (i) => {
|
|
1517
|
-
const a =
|
|
1453
|
+
const a = T.current;
|
|
1518
1454
|
if (!a) return;
|
|
1519
|
-
a.viewport(0, 0, a.drawingBufferWidth, a.drawingBufferHeight), a.clear(a.COLOR_BUFFER_BIT | a.DEPTH_BUFFER_BIT), a.bindBuffer(a.ARRAY_BUFFER,
|
|
1520
|
-
|
|
1455
|
+
a.viewport(0, 0, a.drawingBufferWidth, a.drawingBufferHeight), a.clear(a.COLOR_BUFFER_BIT | a.DEPTH_BUFFER_BIT), a.bindBuffer(a.ARRAY_BUFFER, C.current), a.vertexAttribPointer(
|
|
1456
|
+
L.current ?? 0,
|
|
1521
1457
|
3,
|
|
1522
1458
|
a.FLOAT,
|
|
1523
1459
|
!1,
|
|
1524
1460
|
0,
|
|
1525
1461
|
0
|
|
1526
|
-
),
|
|
1462
|
+
), j(i), a.drawArrays(a.TRIANGLE_STRIP, 0, 4);
|
|
1527
1463
|
const s = f.current.iMouse?.value;
|
|
1528
1464
|
if (f.current.iMouse?.isNeeded && v !== 1 && Array.isArray(s)) {
|
|
1529
|
-
const
|
|
1530
|
-
s[0] =
|
|
1465
|
+
const d = s[0] ?? 0, u = s[1] ?? 0;
|
|
1466
|
+
s[0] = Ce(d, _.current[0] ?? 0, v), s[1] = Ce(u, _.current[1] ?? 0, v);
|
|
1531
1467
|
}
|
|
1532
|
-
|
|
1468
|
+
I.current = requestAnimationFrame(Q);
|
|
1533
1469
|
}, ee = () => {
|
|
1534
1470
|
const i = { passive: !0 };
|
|
1535
|
-
f.current.iMouse?.isNeeded && l.current && (l.current.addEventListener("mousemove", M, i), l.current.addEventListener("mouseout",
|
|
1471
|
+
f.current.iMouse?.isNeeded && l.current && (l.current.addEventListener("mousemove", M, i), l.current.addEventListener("mouseout", S, i), l.current.addEventListener("mouseup", S, i), l.current.addEventListener("mousedown", k, i), l.current.addEventListener("touchmove", M, i), l.current.addEventListener("touchend", S, i), l.current.addEventListener("touchstart", k, i)), f.current.iDeviceOrientation?.isNeeded && window.addEventListener(
|
|
1536
1472
|
"deviceorientation",
|
|
1537
1473
|
H,
|
|
1538
1474
|
i
|
|
1539
|
-
), l.current && (
|
|
1475
|
+
), l.current && (b.current = new ResizeObserver(N), b.current.observe(l.current), window.addEventListener("resize", N, i));
|
|
1540
1476
|
}, J = () => {
|
|
1541
1477
|
const i = { passive: !0 };
|
|
1542
|
-
f.current.iMouse?.isNeeded && l.current && (l.current.removeEventListener("mousemove", M, i), l.current.removeEventListener("mouseout",
|
|
1478
|
+
f.current.iMouse?.isNeeded && l.current && (l.current.removeEventListener("mousemove", M, i), l.current.removeEventListener("mouseout", S, i), l.current.removeEventListener("mouseup", S, i), l.current.removeEventListener("mousedown", k, i), l.current.removeEventListener("touchmove", M, i), l.current.removeEventListener("touchend", S, i), l.current.removeEventListener("touchstart", k, i)), f.current.iDeviceOrientation?.isNeeded && window.removeEventListener(
|
|
1543
1479
|
"deviceorientation",
|
|
1544
1480
|
H,
|
|
1545
1481
|
i
|
|
1546
|
-
),
|
|
1482
|
+
), b.current && (b.current.disconnect(), window.removeEventListener("resize", N, i));
|
|
1547
1483
|
};
|
|
1548
1484
|
return ie(() => {
|
|
1549
|
-
|
|
1485
|
+
F.current = n;
|
|
1550
1486
|
}, [n]), ie(() => {
|
|
1551
1487
|
const i = P.current;
|
|
1552
1488
|
function a() {
|
|
1553
|
-
|
|
1554
|
-
const s =
|
|
1555
|
-
s && l.current && (s.clearColor(...o), s.clearDepth(1), s.enable(s.DEPTH_TEST), s.depthFunc(s.LEQUAL), s.viewport(0, 0, l.current.width, l.current.height), l.current.height = l.current.clientHeight, l.current.width = l.current.clientWidth, $(), re(), Z(ne(t ||
|
|
1489
|
+
z();
|
|
1490
|
+
const s = T.current;
|
|
1491
|
+
s && l.current && (s.clearColor(...o), s.clearDepth(1), s.enable(s.DEPTH_TEST), s.depthFunc(s.LEQUAL), s.viewport(0, 0, l.current.width, l.current.height), l.current.height = l.current.clientHeight, l.current.width = l.current.clientWidth, $(), re(), Z(ne(t || jt), e || we), W(), requestAnimationFrame(Q), ee(), N());
|
|
1556
1492
|
}
|
|
1557
1493
|
return requestAnimationFrame(a), () => {
|
|
1558
|
-
const s =
|
|
1494
|
+
const s = T.current;
|
|
1559
1495
|
if (s) {
|
|
1560
|
-
if (s.getExtension("WEBGL_lose_context")?.loseContext(), s.useProgram(null), s.deleteProgram(
|
|
1561
|
-
for (const
|
|
1562
|
-
s.deleteTexture(
|
|
1563
|
-
|
|
1496
|
+
if (s.getExtension("WEBGL_lose_context")?.loseContext(), s.useProgram(null), s.deleteProgram(h.current ?? null), i.length > 0)
|
|
1497
|
+
for (const d of i)
|
|
1498
|
+
s.deleteTexture(d._webglTexture);
|
|
1499
|
+
h.current = null;
|
|
1564
1500
|
}
|
|
1565
|
-
J(), cancelAnimationFrame(
|
|
1501
|
+
J(), cancelAnimationFrame(I.current ?? 0);
|
|
1566
1502
|
};
|
|
1567
1503
|
}, []), /* @__PURE__ */ q(
|
|
1568
1504
|
"canvas",
|
|
@@ -1739,7 +1675,7 @@ void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
|
|
1739
1675
|
float alpha = mappedBrightness * clamp(uMix, 1.0, 2.0);
|
|
1740
1676
|
fragColor = vec4(color, alpha);
|
|
1741
1677
|
}
|
|
1742
|
-
}`, cr = 10, ur = 2, lr = 0.5, fr = 0.2,
|
|
1678
|
+
}`, cr = 10, ur = 2, lr = 0.5, fr = 0.2, dr = 1.5, G = {
|
|
1743
1679
|
duration: 0.5,
|
|
1744
1680
|
ease: "easeOut"
|
|
1745
1681
|
}, Pe = {
|
|
@@ -1749,22 +1685,22 @@ void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
|
|
1749
1685
|
repeatType: "mirror"
|
|
1750
1686
|
};
|
|
1751
1687
|
function oe(t) {
|
|
1752
|
-
const [e, r] = Ue(t), n =
|
|
1753
|
-
|
|
1754
|
-
const c =
|
|
1755
|
-
(m,
|
|
1756
|
-
o.current =
|
|
1688
|
+
const [e, r] = Ue(t), n = mt(t), o = B(null);
|
|
1689
|
+
Tt(n, "change", (m) => r(m));
|
|
1690
|
+
const c = qe(
|
|
1691
|
+
(m, E) => {
|
|
1692
|
+
o.current = kt(n, m, E);
|
|
1757
1693
|
},
|
|
1758
1694
|
[n]
|
|
1759
1695
|
);
|
|
1760
1696
|
return { value: e, motionValue: n, controls: o, animate: c };
|
|
1761
1697
|
}
|
|
1762
|
-
function
|
|
1698
|
+
function hr(t, e) {
|
|
1763
1699
|
const [r, n] = Ue(cr), {
|
|
1764
1700
|
value: o,
|
|
1765
1701
|
animate: c,
|
|
1766
1702
|
motionValue: m
|
|
1767
|
-
} = oe(fr), { value:
|
|
1703
|
+
} = oe(fr), { value: E, animate: v } = oe(ur), { value: R, animate: p } = oe(lr), { value: g, animate: x } = oe(dr), l = wt(e, {
|
|
1768
1704
|
fftSize: 512,
|
|
1769
1705
|
smoothingTimeConstant: 0.55
|
|
1770
1706
|
});
|
|
@@ -1807,12 +1743,12 @@ function dr(t, e) {
|
|
|
1807
1743
|
]), {
|
|
1808
1744
|
speed: r,
|
|
1809
1745
|
scale: o,
|
|
1810
|
-
amplitude:
|
|
1746
|
+
amplitude: E,
|
|
1811
1747
|
frequency: R,
|
|
1812
1748
|
brightness: g
|
|
1813
1749
|
};
|
|
1814
1750
|
}
|
|
1815
|
-
const mr =
|
|
1751
|
+
const mr = vt({
|
|
1816
1752
|
base: "aspect-square",
|
|
1817
1753
|
variants: {
|
|
1818
1754
|
size: {
|
|
@@ -1844,14 +1780,14 @@ function Ge({
|
|
|
1844
1780
|
scale: o = 0.2,
|
|
1845
1781
|
blur: c = 1,
|
|
1846
1782
|
color: m = "#FF355E",
|
|
1847
|
-
colorShift:
|
|
1783
|
+
colorShift: E = 1,
|
|
1848
1784
|
brightness: v = 1,
|
|
1849
1785
|
themeMode: R = typeof window < "u" && document.documentElement.classList.contains("dark") ? "dark" : "light",
|
|
1850
1786
|
ref: p,
|
|
1851
1787
|
className: g,
|
|
1852
1788
|
...x
|
|
1853
1789
|
}) {
|
|
1854
|
-
const l =
|
|
1790
|
+
const l = He(() => pr(m), [m]);
|
|
1855
1791
|
return /* @__PURE__ */ q("div", { ref: p, className: g, ...x, children: /* @__PURE__ */ q(
|
|
1856
1792
|
sr,
|
|
1857
1793
|
{
|
|
@@ -1877,7 +1813,7 @@ function Ge({
|
|
|
1877
1813
|
// Color variation across layers (0-1)
|
|
1878
1814
|
uSpacing: { type: "1f", value: 0.5 },
|
|
1879
1815
|
// Color palette offset - shifts colors along the gradient (0-1)
|
|
1880
|
-
uColorShift: { type: "1f", value:
|
|
1816
|
+
uColorShift: { type: "1f", value: E },
|
|
1881
1817
|
// Color variation across layers (0-1)
|
|
1882
1818
|
uVariance: { type: "1f", value: 0.1 },
|
|
1883
1819
|
// Smoothing of the aurora (0-1)
|
|
@@ -1887,18 +1823,18 @@ function Ge({
|
|
|
1887
1823
|
// Color
|
|
1888
1824
|
uColor: { type: "3fv", value: l ?? [0, 0.7, 1] }
|
|
1889
1825
|
},
|
|
1890
|
-
onError: (
|
|
1891
|
-
console.error("Shader error:",
|
|
1826
|
+
onError: (T) => {
|
|
1827
|
+
console.error("Shader error:", T);
|
|
1892
1828
|
},
|
|
1893
|
-
onWarning: (
|
|
1894
|
-
console.warn("Shader warning:",
|
|
1829
|
+
onWarning: (T) => {
|
|
1830
|
+
console.warn("Shader warning:", T);
|
|
1895
1831
|
},
|
|
1896
1832
|
style: { width: "100%", height: "100%" }
|
|
1897
1833
|
}
|
|
1898
1834
|
) });
|
|
1899
1835
|
}
|
|
1900
1836
|
Ge.displayName = "AuraShader";
|
|
1901
|
-
function
|
|
1837
|
+
function Sr({
|
|
1902
1838
|
size: t = "lg",
|
|
1903
1839
|
state: e,
|
|
1904
1840
|
color: r,
|
|
@@ -1906,14 +1842,14 @@ function Cr({
|
|
|
1906
1842
|
audioTrack: o,
|
|
1907
1843
|
themeMode: c,
|
|
1908
1844
|
className: m,
|
|
1909
|
-
ref:
|
|
1845
|
+
ref: E,
|
|
1910
1846
|
...v
|
|
1911
1847
|
}) {
|
|
1912
|
-
const { speed: R, scale: p, amplitude: g, frequency: x, brightness: l } =
|
|
1848
|
+
const { speed: R, scale: p, amplitude: g, frequency: x, brightness: l } = hr(e, o);
|
|
1913
1849
|
return /* @__PURE__ */ q(
|
|
1914
1850
|
Ge,
|
|
1915
1851
|
{
|
|
1916
|
-
ref:
|
|
1852
|
+
ref: E,
|
|
1917
1853
|
blur: 0.2,
|
|
1918
1854
|
color: r,
|
|
1919
1855
|
colorShift: n,
|
|
@@ -1923,7 +1859,7 @@ function Cr({
|
|
|
1923
1859
|
amplitude: g,
|
|
1924
1860
|
frequency: x,
|
|
1925
1861
|
brightness: l,
|
|
1926
|
-
className:
|
|
1862
|
+
className: pt(
|
|
1927
1863
|
mr({ size: t }),
|
|
1928
1864
|
"overflow-hidden rounded-full",
|
|
1929
1865
|
m
|
|
@@ -1932,8 +1868,6 @@ function Cr({
|
|
|
1932
1868
|
}
|
|
1933
1869
|
);
|
|
1934
1870
|
}
|
|
1935
|
-
const vr = wt;
|
|
1936
|
-
vr.displayName = "F0ChatReportCard";
|
|
1937
1871
|
const Ir = ({
|
|
1938
1872
|
text: t,
|
|
1939
1873
|
confirmationText: e,
|
|
@@ -1949,7 +1883,7 @@ const Ir = ({
|
|
|
1949
1883
|
type: "button",
|
|
1950
1884
|
variant: "outline",
|
|
1951
1885
|
size: "sm",
|
|
1952
|
-
icon:
|
|
1886
|
+
icon: gt,
|
|
1953
1887
|
onClick: r,
|
|
1954
1888
|
label: e
|
|
1955
1889
|
}
|
|
@@ -1967,13 +1901,12 @@ const Ir = ({
|
|
|
1967
1901
|
] })
|
|
1968
1902
|
] });
|
|
1969
1903
|
export {
|
|
1970
|
-
|
|
1904
|
+
Rr as A,
|
|
1971
1905
|
Lr as F,
|
|
1972
|
-
|
|
1906
|
+
br as a,
|
|
1973
1907
|
Ar as b,
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
Ir as e,
|
|
1908
|
+
Sr as c,
|
|
1909
|
+
Ir as d,
|
|
1977
1910
|
Er as o,
|
|
1978
|
-
|
|
1911
|
+
xr as u
|
|
1979
1912
|
};
|