@factorialco/f0-react 1.408.0 → 1.409.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/dist/F0AiChat-jQP26RJL.js +28929 -0
- package/dist/F0AnalyticsDashboard-BpLckkpk.js +64104 -0
- package/dist/{f0.css → F0AnalyticsDashboard.css} +1 -1
- package/dist/F0ChatDashboard-Cb5hmJwl.js +292 -0
- package/dist/F0ChatDashboard.d.ts +364 -0
- package/dist/F0ChatDashboard.js +4 -0
- package/dist/{F0HILActionConfirmation-Cud7NMip.js → F0HILActionConfirmation-DSmdPfxW.js} +262 -236
- package/dist/{F0AiChat-B5pShue-.js → F0Input-xBidN3aT.js} +94273 -122302
- package/dist/ai.d.ts +373 -17
- package/dist/ai.js +54 -52
- package/dist/experimental.d.ts +47 -16
- package/dist/experimental.js +3119 -2937
- package/dist/f0.d.ts +412 -21
- package/dist/f0.js +16407 -70330
- package/dist/i18n-provider-defaults.d.ts +39 -15
- package/dist/i18n-provider-defaults.js +24 -0
- package/dist/{useDataCollectionSource-BIFyi9Io.js → index-DWr1PlvN.js} +14802 -24733
- package/dist/{useDataCollectionSource.css → index.css} +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as q, jsxs as le } from "react/jsx-runtime";
|
|
2
2
|
import { useInsertionEffect as ze, createContext as Xe, useContext as Ye, useRef as B, useEffect as ie, useState as Ue, useCallback as $e, useMemo as qe } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { useTrackVolume as
|
|
3
|
+
import { r as He, i as je, m as Ke, a as Qe, b as Me, d as Je, c as Ze, f as et, e as tt, s as nt, g as Oe, p as rt, V as ot, h as it, j as st, k as at, S as ct, H as ut, v as se, l as lt, n as ft, o as ht, q as dt, t as mt, w as pt, F as fe, x as vt } from "./F0Input-xBidN3aT.js";
|
|
4
|
+
import { useTrackVolume as gt } from "@livekit/components-react";
|
|
5
5
|
function wt(t, e, n) {
|
|
6
6
|
ze(() => t.on(e, n), [t, e, n]);
|
|
7
7
|
}
|
|
8
8
|
function ue(t) {
|
|
9
9
|
return typeof t == "object" && !Array.isArray(t);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function Ne(t, e, n, r) {
|
|
12
12
|
return typeof t == "string" && ue(e) ? He(t, n, r) : t instanceof NodeList ? Array.from(t) : Array.isArray(t) ? t : [t];
|
|
13
13
|
}
|
|
14
14
|
function Tt(t, e, n) {
|
|
@@ -22,20 +22,20 @@ const yt = (t, e, n) => {
|
|
|
22
22
|
return ((n - t) % r + r) % r + t;
|
|
23
23
|
};
|
|
24
24
|
function Be(t, e) {
|
|
25
|
-
return
|
|
25
|
+
return je(t) ? t[yt(0, t.length, e)] : t;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function bt(t, e, n) {
|
|
28
28
|
for (let r = 0; r < t.length; r++) {
|
|
29
29
|
const o = t[r];
|
|
30
30
|
o.at > e && o.at < n && (Qe(t, o), r--);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
|
|
33
|
+
function Et(t, e, n, r, o, c) {
|
|
34
|
+
bt(t, o, c);
|
|
35
35
|
for (let m = 0; m < e.length; m++)
|
|
36
36
|
t.push({
|
|
37
37
|
value: e[m],
|
|
38
|
-
at:
|
|
38
|
+
at: Ke(o, c, r[m]),
|
|
39
39
|
easing: Be(n, m)
|
|
40
40
|
});
|
|
41
41
|
}
|
|
@@ -48,78 +48,78 @@ function Rt(t, e) {
|
|
|
48
48
|
}
|
|
49
49
|
const xt = "easeInOut", St = 20;
|
|
50
50
|
function Lt(t, { defaultTransition: e = {}, ...n } = {}, r, o) {
|
|
51
|
-
const c = e.duration || 0.3, m = /* @__PURE__ */ new Map(),
|
|
52
|
-
let p = 0,
|
|
51
|
+
const c = e.duration || 0.3, m = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), v = {}, R = /* @__PURE__ */ new Map();
|
|
52
|
+
let p = 0, g = 0, x = 0;
|
|
53
53
|
for (let l = 0; l < t.length; l++) {
|
|
54
54
|
const T = t[l];
|
|
55
55
|
if (typeof T == "string") {
|
|
56
|
-
R.set(T,
|
|
56
|
+
R.set(T, g);
|
|
57
57
|
continue;
|
|
58
58
|
} else if (!Array.isArray(T)) {
|
|
59
|
-
R.set(T.name, he(
|
|
59
|
+
R.set(T.name, he(g, T.at, p, R));
|
|
60
60
|
continue;
|
|
61
61
|
}
|
|
62
62
|
let [F, d, S = {}] = T;
|
|
63
|
-
S.at !== void 0 && (
|
|
64
|
-
let
|
|
65
|
-
const U = (y, w,
|
|
66
|
-
const A =
|
|
63
|
+
S.at !== void 0 && (g = he(g, S.at, p, R));
|
|
64
|
+
let C = 0;
|
|
65
|
+
const U = (y, w, I, P = 0, D = 0) => {
|
|
66
|
+
const A = Ct(y), { delay: f = 0, times: _ = Je(A), type: N = "keyframes", repeat: W, repeatType: k, repeatDelay: H = 0, ...z } = w;
|
|
67
67
|
let { ease: M = e.ease || "easeOut", duration: L } = w;
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
let
|
|
71
|
-
if (
|
|
68
|
+
const O = typeof f == "function" ? f(P, D) : f, j = A.length, Z = tt(N) ? N : o?.[N];
|
|
69
|
+
if (j <= 2 && Z) {
|
|
70
|
+
let K = 100;
|
|
71
|
+
if (j === 2 && Ft(A)) {
|
|
72
72
|
const J = A[1] - A[0];
|
|
73
|
-
|
|
73
|
+
K = Math.abs(J);
|
|
74
74
|
}
|
|
75
75
|
const Q = { ...z };
|
|
76
76
|
L !== void 0 && (Q.duration = nt(L));
|
|
77
|
-
const ee = Ze(Q,
|
|
77
|
+
const ee = Ze(Q, K, Z);
|
|
78
78
|
M = ee.ease, L = ee.duration;
|
|
79
79
|
}
|
|
80
80
|
L ?? (L = c);
|
|
81
|
-
const $ =
|
|
82
|
-
|
|
83
|
-
const ne =
|
|
84
|
-
if (ne > 0 && et(
|
|
85
|
-
|
|
86
|
-
const
|
|
81
|
+
const $ = g + O;
|
|
82
|
+
_.length === 1 && _[0] === 0 && (_[1] = 1);
|
|
83
|
+
const ne = _.length - A.length;
|
|
84
|
+
if (ne > 0 && et(_, ne), A.length === 1 && A.unshift(null), W) {
|
|
85
|
+
Oe(W < St, "Repeat count too high, must be less than 20"), L = Tt(L, W);
|
|
86
|
+
const K = [...A], Q = [..._];
|
|
87
87
|
M = Array.isArray(M) ? [...M] : [M];
|
|
88
88
|
const ee = [...M];
|
|
89
89
|
for (let J = 0; J < W; J++) {
|
|
90
|
-
A.push(...
|
|
91
|
-
for (let i = 0; i <
|
|
92
|
-
|
|
90
|
+
A.push(...K);
|
|
91
|
+
for (let i = 0; i < K.length; i++)
|
|
92
|
+
_.push(Q[i] + (J + 1)), M.push(i === 0 ? "linear" : Be(ee, i - 1));
|
|
93
93
|
}
|
|
94
|
-
At(
|
|
94
|
+
At(_, W);
|
|
95
95
|
}
|
|
96
96
|
const re = $ + L;
|
|
97
|
-
|
|
97
|
+
Et(I, A, M, _, $, re), C = Math.max(O + L, C), x = Math.max(re, x);
|
|
98
98
|
};
|
|
99
99
|
if (Me(F)) {
|
|
100
|
-
const y = de(F,
|
|
100
|
+
const y = de(F, b);
|
|
101
101
|
U(d, S, me("default", y));
|
|
102
102
|
} else {
|
|
103
|
-
const y =
|
|
104
|
-
for (let
|
|
103
|
+
const y = Ne(F, d, r, v), w = y.length;
|
|
104
|
+
for (let I = 0; I < w; I++) {
|
|
105
105
|
d = d, S = S;
|
|
106
|
-
const P = y[
|
|
106
|
+
const P = y[I], D = de(P, b);
|
|
107
107
|
for (const A in d)
|
|
108
|
-
U(d[A],
|
|
108
|
+
U(d[A], It(S, A), me(A, D), I, w);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
p =
|
|
111
|
+
p = g, g += C;
|
|
112
112
|
}
|
|
113
|
-
return
|
|
113
|
+
return b.forEach((l, T) => {
|
|
114
114
|
for (const F in l) {
|
|
115
115
|
const d = l[F];
|
|
116
116
|
d.sort(Rt);
|
|
117
|
-
const S = [],
|
|
117
|
+
const S = [], C = [], U = [];
|
|
118
118
|
for (let w = 0; w < d.length; w++) {
|
|
119
|
-
const { at:
|
|
120
|
-
S.push(P),
|
|
119
|
+
const { at: I, value: P, easing: D } = d[w];
|
|
120
|
+
S.push(P), C.push(rt(0, x, I)), U.push(D || "easeOut");
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
C[0] !== 0 && (C.unshift(0), S.unshift(S[0]), U.unshift(xt)), C[C.length - 1] !== 1 && (C.push(1), S.push(null)), m.has(T) || m.set(T, {
|
|
123
123
|
keyframes: {},
|
|
124
124
|
transition: {}
|
|
125
125
|
});
|
|
@@ -128,7 +128,7 @@ function Lt(t, { defaultTransition: e = {}, ...n } = {}, r, o) {
|
|
|
128
128
|
...e,
|
|
129
129
|
duration: x,
|
|
130
130
|
ease: U,
|
|
131
|
-
times:
|
|
131
|
+
times: C,
|
|
132
132
|
...n
|
|
133
133
|
};
|
|
134
134
|
}
|
|
@@ -140,16 +140,16 @@ function de(t, e) {
|
|
|
140
140
|
function me(t, e) {
|
|
141
141
|
return e[t] || (e[t] = []), e[t];
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function Ct(t) {
|
|
144
144
|
return Array.isArray(t) ? t : [t];
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function It(t, e) {
|
|
147
147
|
return t && t[e] ? {
|
|
148
148
|
...t,
|
|
149
149
|
...t[e]
|
|
150
150
|
} : { ...t };
|
|
151
151
|
}
|
|
152
|
-
const
|
|
152
|
+
const _t = (t) => typeof t == "number", Ft = (t) => t.every(_t);
|
|
153
153
|
function Pt(t, e) {
|
|
154
154
|
return t in e;
|
|
155
155
|
}
|
|
@@ -199,7 +199,7 @@ function Mt(t) {
|
|
|
199
199
|
}, n = st(t) && !at(t) ? new ct(e) : new ut(e);
|
|
200
200
|
n.mount(t), se.set(t, n);
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function Ot(t) {
|
|
203
203
|
const e = {
|
|
204
204
|
presenceContext: null,
|
|
205
205
|
props: {},
|
|
@@ -212,32 +212,32 @@ function Nt(t) {
|
|
|
212
212
|
}, n = new Ut(e);
|
|
213
213
|
n.mount(t), se.set(t, n);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function Nt(t, e) {
|
|
216
216
|
return Me(t) || typeof t == "number" || typeof t == "string" && !ue(e);
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function De(t, e, n, r) {
|
|
219
219
|
const o = [];
|
|
220
|
-
if (
|
|
220
|
+
if (Nt(t, e))
|
|
221
221
|
o.push(lt(t, ue(e) && e.default || e, n && (n.default || n)));
|
|
222
222
|
else {
|
|
223
|
-
const c =
|
|
224
|
-
|
|
225
|
-
for (let
|
|
226
|
-
const
|
|
227
|
-
se.has(
|
|
228
|
-
const p = se.get(
|
|
229
|
-
"delay" in
|
|
223
|
+
const c = Ne(t, e, r), m = c.length;
|
|
224
|
+
Oe(!!m, "No valid elements provided.");
|
|
225
|
+
for (let b = 0; b < m; b++) {
|
|
226
|
+
const v = c[b], R = v instanceof Element ? Mt : Ot;
|
|
227
|
+
se.has(v) || R(v);
|
|
228
|
+
const p = se.get(v), g = { ...n };
|
|
229
|
+
"delay" in g && typeof g.delay == "function" && (g.delay = g.delay(b, m)), o.push(...ft(p, { ...e, transition: g }, {}));
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
return o;
|
|
233
233
|
}
|
|
234
234
|
function Bt(t, e, n) {
|
|
235
235
|
const r = [];
|
|
236
|
-
return Lt(t, e, n, { spring: ht }).forEach(({ keyframes: c, transition: m },
|
|
237
|
-
r.push(...
|
|
236
|
+
return Lt(t, e, n, { spring: ht }).forEach(({ keyframes: c, transition: m }, b) => {
|
|
237
|
+
r.push(...De(b, c, m));
|
|
238
238
|
}), r;
|
|
239
239
|
}
|
|
240
|
-
class
|
|
240
|
+
class Dt {
|
|
241
241
|
constructor(e) {
|
|
242
242
|
this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean);
|
|
243
243
|
}
|
|
@@ -302,7 +302,7 @@ class Vt {
|
|
|
302
302
|
this.runAll("complete");
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
-
class
|
|
305
|
+
class Vt extends Dt {
|
|
306
306
|
then(e, n) {
|
|
307
307
|
return this.finished.finally(e).then(() => {
|
|
308
308
|
});
|
|
@@ -314,15 +314,15 @@ function Gt(t) {
|
|
|
314
314
|
function kt(t) {
|
|
315
315
|
function e(n, r, o) {
|
|
316
316
|
let c = [];
|
|
317
|
-
return Gt(n) ? c = Bt(n, r, t) : c =
|
|
317
|
+
return Gt(n) ? c = Bt(n, r, t) : c = De(n, r, o, t), new Vt(c);
|
|
318
318
|
}
|
|
319
319
|
return e;
|
|
320
320
|
}
|
|
321
|
-
const Wt = kt(), yn = ["xs", "sm", "md", "lg"],
|
|
321
|
+
const Wt = kt(), yn = ["xs", "sm", "md", "lg"], bn = [
|
|
322
322
|
"inProgress",
|
|
323
323
|
"executing",
|
|
324
324
|
"completed"
|
|
325
|
-
],
|
|
325
|
+
], En = {
|
|
326
326
|
ai: {
|
|
327
327
|
openChat: "Open Chat with One AI",
|
|
328
328
|
closeChat: "Close Chat with One AI",
|
|
@@ -337,6 +337,9 @@ const Wt = kt(), yn = ["xs", "sm", "md", "lg"], En = [
|
|
|
337
337
|
thoughtsGroupTitle: "Reflection",
|
|
338
338
|
resourcesGroupTitle: "Resources",
|
|
339
339
|
thinking: "Thinking...",
|
|
340
|
+
closeDashboard: "Close dashboard",
|
|
341
|
+
exportTable: "Download table",
|
|
342
|
+
generatedTableFilename: "OneGeneratedTable",
|
|
340
343
|
feedbackModal: {
|
|
341
344
|
positive: {
|
|
342
345
|
title: "What did you like about this response?",
|
|
@@ -349,22 +352,45 @@ const Wt = kt(), yn = ["xs", "sm", "md", "lg"], En = [
|
|
|
349
352
|
placeholder: "Share what didn't work"
|
|
350
353
|
}
|
|
351
354
|
},
|
|
352
|
-
dataDownloadPreview: "Preview {{shown}} of {{total}} rows — download
|
|
355
|
+
dataDownloadPreview: "Preview {{shown}} of {{total}} rows — download to see all data.",
|
|
353
356
|
expandChat: "Expand chat",
|
|
354
357
|
collapseChat: "Collapse chat",
|
|
358
|
+
chatHistory: "Chat history",
|
|
359
|
+
noPreviousChats: "No previous conversations",
|
|
360
|
+
newConversation: "New conversation",
|
|
361
|
+
today: "Today",
|
|
362
|
+
yesterday: "Yesterday",
|
|
363
|
+
thisMonth: "This month",
|
|
364
|
+
older: "Older",
|
|
365
|
+
searchChats: "Search conversations...",
|
|
366
|
+
pinnedChats: "Pinned",
|
|
367
|
+
threadOptions: "Thread options",
|
|
368
|
+
pinChat: "Pin chat",
|
|
369
|
+
unpinChat: "Unpin chat",
|
|
370
|
+
deleteChat: "Delete chat",
|
|
355
371
|
ask: "Ask One",
|
|
356
372
|
viewProfile: "View profile",
|
|
357
|
-
tools: "Tools"
|
|
373
|
+
tools: "Tools",
|
|
374
|
+
reportCard: {
|
|
375
|
+
reportLabel: "Report",
|
|
376
|
+
openButton: "Open"
|
|
377
|
+
},
|
|
378
|
+
dataDownload: {
|
|
379
|
+
download: "Download {{format}}"
|
|
380
|
+
},
|
|
381
|
+
unsavedChanges: "Unsaved changes",
|
|
382
|
+
saveChanges: "Save changes",
|
|
383
|
+
discardChanges: "Discard"
|
|
358
384
|
}
|
|
359
|
-
},
|
|
385
|
+
}, Ve = Xe(null);
|
|
360
386
|
function An({
|
|
361
387
|
children: t,
|
|
362
388
|
translations: e
|
|
363
389
|
}) {
|
|
364
|
-
return /* @__PURE__ */ q(
|
|
390
|
+
return /* @__PURE__ */ q(Ve.Provider, { value: e, children: t });
|
|
365
391
|
}
|
|
366
392
|
function Rn() {
|
|
367
|
-
const t = Ye(
|
|
393
|
+
const t = Ye(Ve);
|
|
368
394
|
if (t === null)
|
|
369
395
|
throw new Error(
|
|
370
396
|
"useAiChatTranslations must be used within an AiChatTranslationsProvider"
|
|
@@ -372,116 +398,116 @@ function Rn() {
|
|
|
372
398
|
return t;
|
|
373
399
|
}
|
|
374
400
|
function pe(t, e, n, r) {
|
|
375
|
-
const o = Math.max(1, Math.min(t, e)), c = Math.min(n, 20),
|
|
401
|
+
const o = Math.max(1, Math.min(t, e)), c = Math.min(n, 20), b = Math.min(c + r, o), v = Math.min(b, Math.floor(t / 2)), R = Math.min(b, Math.floor(e / 2)), p = ($) => $ / t * 2 - 1, g = ($) => $ / e * 2 - 1, x = 0, l = t, T = 0, F = e, d = v, S = t - v, C = R, U = e - R, y = p(x), w = p(l), I = g(T), P = g(F), D = p(d), A = p(S), f = g(C), _ = g(U), N = 0, W = 0, k = 1, H = 1, z = v / t, M = 1 - v / t, L = R / e, O = 1 - R / e, j = new Float32Array([
|
|
376
402
|
// Top strip
|
|
377
403
|
y,
|
|
378
|
-
|
|
404
|
+
I,
|
|
379
405
|
w,
|
|
380
|
-
|
|
406
|
+
I,
|
|
381
407
|
y,
|
|
382
408
|
f,
|
|
383
409
|
y,
|
|
384
410
|
f,
|
|
385
411
|
w,
|
|
386
|
-
|
|
412
|
+
I,
|
|
387
413
|
w,
|
|
388
414
|
f,
|
|
389
415
|
// Bottom strip
|
|
390
416
|
y,
|
|
391
|
-
|
|
417
|
+
_,
|
|
392
418
|
w,
|
|
393
|
-
|
|
419
|
+
_,
|
|
394
420
|
y,
|
|
395
421
|
P,
|
|
396
422
|
y,
|
|
397
423
|
P,
|
|
398
424
|
w,
|
|
399
|
-
|
|
425
|
+
_,
|
|
400
426
|
w,
|
|
401
427
|
P,
|
|
402
428
|
// Left strip
|
|
403
429
|
y,
|
|
404
430
|
f,
|
|
405
|
-
|
|
431
|
+
D,
|
|
406
432
|
f,
|
|
407
433
|
y,
|
|
408
|
-
|
|
434
|
+
_,
|
|
409
435
|
y,
|
|
410
|
-
|
|
411
|
-
|
|
436
|
+
_,
|
|
437
|
+
D,
|
|
412
438
|
f,
|
|
413
|
-
|
|
414
|
-
|
|
439
|
+
D,
|
|
440
|
+
_,
|
|
415
441
|
// Right strip
|
|
416
442
|
A,
|
|
417
443
|
f,
|
|
418
444
|
w,
|
|
419
445
|
f,
|
|
420
446
|
A,
|
|
421
|
-
|
|
447
|
+
_,
|
|
422
448
|
A,
|
|
423
|
-
|
|
449
|
+
_,
|
|
424
450
|
w,
|
|
425
451
|
f,
|
|
426
452
|
w,
|
|
427
|
-
|
|
453
|
+
_
|
|
428
454
|
]), Z = new Float32Array([
|
|
429
455
|
// Top strip
|
|
430
|
-
|
|
456
|
+
N,
|
|
431
457
|
W,
|
|
432
458
|
k,
|
|
433
459
|
W,
|
|
434
|
-
|
|
460
|
+
N,
|
|
435
461
|
L,
|
|
436
|
-
|
|
462
|
+
N,
|
|
437
463
|
L,
|
|
438
464
|
k,
|
|
439
465
|
W,
|
|
440
466
|
k,
|
|
441
467
|
L,
|
|
442
468
|
// Bottom strip
|
|
443
|
-
O,
|
|
444
469
|
N,
|
|
470
|
+
O,
|
|
445
471
|
k,
|
|
446
|
-
N,
|
|
447
472
|
O,
|
|
473
|
+
N,
|
|
448
474
|
H,
|
|
449
|
-
|
|
475
|
+
N,
|
|
450
476
|
H,
|
|
451
477
|
k,
|
|
452
|
-
|
|
478
|
+
O,
|
|
453
479
|
k,
|
|
454
480
|
H,
|
|
455
481
|
// Left strip
|
|
456
|
-
|
|
482
|
+
N,
|
|
457
483
|
L,
|
|
458
484
|
z,
|
|
459
485
|
L,
|
|
460
|
-
O,
|
|
461
486
|
N,
|
|
462
487
|
O,
|
|
463
488
|
N,
|
|
489
|
+
O,
|
|
464
490
|
z,
|
|
465
491
|
L,
|
|
466
492
|
z,
|
|
467
|
-
|
|
493
|
+
O,
|
|
468
494
|
// Right strip
|
|
469
495
|
M,
|
|
470
496
|
L,
|
|
471
497
|
k,
|
|
472
498
|
L,
|
|
473
499
|
M,
|
|
474
|
-
|
|
500
|
+
O,
|
|
475
501
|
M,
|
|
476
|
-
|
|
502
|
+
O,
|
|
477
503
|
k,
|
|
478
504
|
L,
|
|
479
505
|
k,
|
|
480
|
-
|
|
506
|
+
O
|
|
481
507
|
]);
|
|
482
|
-
return { positions:
|
|
508
|
+
return { positions: j, uvs: Z };
|
|
483
509
|
}
|
|
484
|
-
function
|
|
510
|
+
function ve(t, e, n) {
|
|
485
511
|
const r = t.createShader(e);
|
|
486
512
|
if (!r) throw new Error("Failed to create shader");
|
|
487
513
|
if (t.shaderSource(r, n), t.compileShader(r), !t.getShaderParameter(r, t.COMPILE_STATUS)) {
|
|
@@ -491,7 +517,7 @@ function ge(t, e, n) {
|
|
|
491
517
|
return r;
|
|
492
518
|
}
|
|
493
519
|
function zt(t, e, n) {
|
|
494
|
-
const r =
|
|
520
|
+
const r = ve(t, t.VERTEX_SHADER, e), o = ve(t, t.FRAGMENT_SHADER, n), c = t.createProgram();
|
|
495
521
|
if (!c) throw new Error("Failed to create program");
|
|
496
522
|
if (t.attachShader(c, r), t.attachShader(c, o), t.linkProgram(c), !t.getProgramParameter(c, t.LINK_STATUS)) {
|
|
497
523
|
const m = t.getProgramInfoLog(c) || "Unknown link error";
|
|
@@ -793,23 +819,23 @@ class xn {
|
|
|
793
819
|
resize(e, n, r) {
|
|
794
820
|
if (this.disposed) throw new Error("Mask instance has been disposed.");
|
|
795
821
|
if (this.options.width = e, this.options.height = n, r && (this.options.ratio = r), !this.running) return;
|
|
796
|
-
const { gl: o, program: c, vao: m, positionBuffer:
|
|
797
|
-
this.canvas.style.width = `${e}px`, this.canvas.style.height = `${n}px`, (this.canvas.width !==
|
|
822
|
+
const { gl: o, program: c, vao: m, positionBuffer: b, uvBuffer: v, uResolution: R } = this.glr, p = r ?? this.options.ratio ?? window.devicePixelRatio ?? 1, g = Math.max(1, Math.floor(e * p)), x = Math.max(1, Math.floor(n * p));
|
|
823
|
+
this.canvas.style.width = `${e}px`, this.canvas.style.height = `${n}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");
|
|
798
824
|
const { positions: l, uvs: T } = pe(
|
|
799
825
|
this.canvas.width,
|
|
800
826
|
this.canvas.height,
|
|
801
827
|
this.options.borderWidth * p,
|
|
802
828
|
this.options.glowWidth * p
|
|
803
829
|
);
|
|
804
|
-
o.bindVertexArray(m), o.bindBuffer(o.ARRAY_BUFFER,
|
|
830
|
+
o.bindVertexArray(m), o.bindBuffer(o.ARRAY_BUFFER, b), o.bufferData(o.ARRAY_BUFFER, l, o.STATIC_DRAW);
|
|
805
831
|
const F = o.getAttribLocation(c, "aPosition");
|
|
806
|
-
o.enableVertexAttribArray(F), o.vertexAttribPointer(F, 2, o.FLOAT, !1, 0, 0), this.checkGLError(o, "resize: after position buffer update"), o.bindBuffer(o.ARRAY_BUFFER,
|
|
832
|
+
o.enableVertexAttribArray(F), o.vertexAttribPointer(F, 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);
|
|
807
833
|
const d = o.getAttribLocation(c, "aUV");
|
|
808
834
|
o.enableVertexAttribArray(d), o.vertexAttribPointer(d, 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");
|
|
809
835
|
const S = performance.now();
|
|
810
836
|
this.lastTime = S;
|
|
811
|
-
const
|
|
812
|
-
this.render(
|
|
837
|
+
const C = (S - this.startTime) * 1e-3;
|
|
838
|
+
this.render(C);
|
|
813
839
|
}
|
|
814
840
|
/**
|
|
815
841
|
* Automatically resizes the canvas to match the dimensions of the given element.
|
|
@@ -884,21 +910,21 @@ class xn {
|
|
|
884
910
|
this.checkGLError(e, "setupGL: after createProgram");
|
|
885
911
|
const r = e.createVertexArray();
|
|
886
912
|
e.bindVertexArray(r), this.checkGLError(e, "setupGL: after VAO creation");
|
|
887
|
-
const o = this.canvas.width || 2, c = this.canvas.height || 2, { positions: m, uvs:
|
|
913
|
+
const o = this.canvas.width || 2, c = this.canvas.height || 2, { positions: m, uvs: b } = pe(
|
|
888
914
|
o,
|
|
889
915
|
c,
|
|
890
916
|
this.options.borderWidth,
|
|
891
917
|
this.options.glowWidth
|
|
892
|
-
),
|
|
893
|
-
e.bindBuffer(e.ARRAY_BUFFER,
|
|
918
|
+
), v = e.createBuffer();
|
|
919
|
+
e.bindBuffer(e.ARRAY_BUFFER, v), e.bufferData(e.ARRAY_BUFFER, m, e.STATIC_DRAW);
|
|
894
920
|
const R = e.getAttribLocation(n, "aPosition");
|
|
895
921
|
e.enableVertexAttribArray(R), e.vertexAttribPointer(R, 2, e.FLOAT, !1, 0, 0), this.checkGLError(e, "setupGL: after position buffer setup");
|
|
896
922
|
const p = e.createBuffer();
|
|
897
|
-
e.bindBuffer(e.ARRAY_BUFFER, p), e.bufferData(e.ARRAY_BUFFER,
|
|
898
|
-
const
|
|
899
|
-
e.enableVertexAttribArray(
|
|
900
|
-
const x = e.getUniformLocation(n, "uResolution"), l = e.getUniformLocation(n, "uTime"), T = e.getUniformLocation(n, "uBorderWidth"), F = e.getUniformLocation(n, "uGlowWidth"), d = e.getUniformLocation(n, "uBorderRadius"), S = e.getUniformLocation(n, "uColors"),
|
|
901
|
-
e.useProgram(n), e.uniform1f(T, this.options.borderWidth), e.uniform1f(F, this.options.glowWidth), e.uniform1f(d, this.options.borderRadius), this.options.mode === "dark" ? (e.uniform1f(
|
|
923
|
+
e.bindBuffer(e.ARRAY_BUFFER, p), e.bufferData(e.ARRAY_BUFFER, b, e.STATIC_DRAW);
|
|
924
|
+
const g = e.getAttribLocation(n, "aUV");
|
|
925
|
+
e.enableVertexAttribArray(g), e.vertexAttribPointer(g, 2, e.FLOAT, !1, 0, 0), this.checkGLError(e, "setupGL: after UV buffer setup");
|
|
926
|
+
const x = e.getUniformLocation(n, "uResolution"), l = e.getUniformLocation(n, "uTime"), T = e.getUniformLocation(n, "uBorderWidth"), F = e.getUniformLocation(n, "uGlowWidth"), d = e.getUniformLocation(n, "uBorderRadius"), S = e.getUniformLocation(n, "uColors"), C = e.getUniformLocation(n, "uGlowExponent"), U = e.getUniformLocation(n, "uGlowFactor");
|
|
927
|
+
e.useProgram(n), e.uniform1f(T, this.options.borderWidth), e.uniform1f(F, this.options.glowWidth), e.uniform1f(d, this.options.borderRadius), this.options.mode === "dark" ? (e.uniform1f(C, 2), e.uniform1f(U, 1.8)) : (e.uniform1f(C, 1), e.uniform1f(U, 1));
|
|
902
928
|
const y = (this.options.colors || $t).map(qt);
|
|
903
929
|
for (let w = 0; w < y.length; w++)
|
|
904
930
|
e.uniform3f(
|
|
@@ -909,7 +935,7 @@ class xn {
|
|
|
909
935
|
gl: e,
|
|
910
936
|
program: n,
|
|
911
937
|
vao: r,
|
|
912
|
-
positionBuffer:
|
|
938
|
+
positionBuffer: v,
|
|
913
939
|
uvBuffer: p,
|
|
914
940
|
uResolution: x,
|
|
915
941
|
uTime: l,
|
|
@@ -925,19 +951,19 @@ class xn {
|
|
|
925
951
|
n.useProgram(r), n.bindVertexArray(o), n.uniform1f(c, e), n.disable(n.DEPTH_TEST), n.disable(n.CULL_FACE), n.disable(n.BLEND), n.clearColor(0, 0, 0, 0), n.clear(n.COLOR_BUFFER_BIT), n.drawArrays(n.TRIANGLES, 0, 24), this.checkGLError(n, "render: after draw call"), n.bindVertexArray(null);
|
|
926
952
|
}
|
|
927
953
|
}
|
|
928
|
-
const
|
|
954
|
+
const ge = ["lowp", "mediump", "highp"], Ht = `
|
|
929
955
|
void main(void){
|
|
930
956
|
vec4 color = vec4(0.0,0.0,0.0,1.0);
|
|
931
957
|
mainImage( color, gl_FragCoord.xy );
|
|
932
958
|
gl_FragColor = color;
|
|
933
|
-
}`,
|
|
959
|
+
}`, jt = `void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
|
|
934
960
|
vec2 uv = fragCoord/iResolution.xy;
|
|
935
961
|
vec3 col = 0.5 + 0.5*cos(iTime+uv.xyx+vec3(0,2,4));
|
|
936
962
|
fragColor = vec4(col,1.0);
|
|
937
963
|
}`, we = `attribute vec3 aVertexPosition;
|
|
938
964
|
void main(void) {
|
|
939
965
|
gl_Position = vec4(aVertexPosition, 1.0);
|
|
940
|
-
}`, Te = "iTime", ye = "iTimeDelta",
|
|
966
|
+
}`, Te = "iTime", ye = "iTimeDelta", be = "iDate", Ee = "iFrame", Ae = "iMouse", Re = "iResolution", Kt = "iChannel", xe = "iChannelResolution", Se = "iDeviceOrientation";
|
|
941
967
|
function Qt(t, e) {
|
|
942
968
|
return t.includes("Matrix") && Array.isArray(e);
|
|
943
969
|
}
|
|
@@ -1036,7 +1062,7 @@ const en = (t, e, n, r) => {
|
|
|
1036
1062
|
)
|
|
1037
1063
|
);
|
|
1038
1064
|
}
|
|
1039
|
-
}, ce = 9729, Le = 9728, nn = 9987,
|
|
1065
|
+
}, ce = 9729, Le = 9728, nn = 9987, Ce = 33071, Ie = 10497;
|
|
1040
1066
|
class rn {
|
|
1041
1067
|
gl;
|
|
1042
1068
|
url;
|
|
@@ -1056,13 +1082,13 @@ class rn {
|
|
|
1056
1082
|
this.gl = e;
|
|
1057
1083
|
}
|
|
1058
1084
|
updateTexture = (e, n, r) => {
|
|
1059
|
-
const { gl: o } = this, c = 0, m = o.RGBA,
|
|
1085
|
+
const { gl: o } = this, c = 0, m = o.RGBA, b = o.RGBA, v = o.UNSIGNED_BYTE;
|
|
1060
1086
|
o.bindTexture(o.TEXTURE_2D, e), o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL, r), o.texImage2D(
|
|
1061
1087
|
o.TEXTURE_2D,
|
|
1062
1088
|
c,
|
|
1063
1089
|
m,
|
|
1064
|
-
|
|
1065
|
-
|
|
1090
|
+
b,
|
|
1091
|
+
v,
|
|
1066
1092
|
n
|
|
1067
1093
|
);
|
|
1068
1094
|
};
|
|
@@ -1104,8 +1130,8 @@ class rn {
|
|
|
1104
1130
|
wrapS: o,
|
|
1105
1131
|
wrapT: c,
|
|
1106
1132
|
minFilter: m,
|
|
1107
|
-
magFilter:
|
|
1108
|
-
flipY:
|
|
1133
|
+
magFilter: b,
|
|
1134
|
+
flipY: v = -1
|
|
1109
1135
|
} = e;
|
|
1110
1136
|
if (!r)
|
|
1111
1137
|
return Promise.reject(
|
|
@@ -1124,48 +1150,48 @@ class rn {
|
|
|
1124
1150
|
)
|
|
1125
1151
|
)
|
|
1126
1152
|
);
|
|
1127
|
-
Object.assign(this, { url: r, wrapS: o, wrapT: c, minFilter: m, magFilter:
|
|
1128
|
-
const
|
|
1153
|
+
Object.assign(this, { url: r, wrapS: o, wrapT: c, minFilter: m, magFilter: b, flipY: v });
|
|
1154
|
+
const g = 0, x = n.RGBA, l = 1, T = 1, F = 0, d = n.RGBA, S = n.UNSIGNED_BYTE, C = new Uint8Array([255, 255, 255, 0]), U = n.createTexture();
|
|
1129
1155
|
if (n.bindTexture(n.TEXTURE_2D, U), n.texImage2D(
|
|
1130
1156
|
n.TEXTURE_2D,
|
|
1131
|
-
|
|
1157
|
+
g,
|
|
1132
1158
|
x,
|
|
1133
1159
|
l,
|
|
1134
1160
|
T,
|
|
1135
1161
|
F,
|
|
1136
1162
|
d,
|
|
1137
1163
|
S,
|
|
1138
|
-
|
|
1164
|
+
C
|
|
1139
1165
|
), p) {
|
|
1140
1166
|
const P = this.setupVideo(r);
|
|
1141
1167
|
return n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.LINEAR), this._webglTexture = U, this.source = P, this.isVideo = !0, P.play().then(() => this);
|
|
1142
1168
|
}
|
|
1143
1169
|
async function y() {
|
|
1144
|
-
return new Promise((P,
|
|
1170
|
+
return new Promise((P, D) => {
|
|
1145
1171
|
const A = new Image();
|
|
1146
1172
|
A.crossOrigin = "anonymous", A.onload = () => {
|
|
1147
1173
|
P(A);
|
|
1148
1174
|
}, A.onerror = () => {
|
|
1149
|
-
|
|
1175
|
+
D(new Error(Y(`failed loading url: ${r}`)));
|
|
1150
1176
|
}, A.src = r ?? "";
|
|
1151
1177
|
});
|
|
1152
1178
|
}
|
|
1153
|
-
let w = await y(),
|
|
1154
|
-
return (e.wrapS !==
|
|
1179
|
+
let w = await y(), I = (w.width & w.width - 1) === 0 && (w.height & w.height - 1) === 0;
|
|
1180
|
+
return (e.wrapS !== Ce || e.wrapT !== Ce || e.minFilter !== Le && e.minFilter !== ce) && !I && (w = this.makePowerOf2(w), I = !0), n.bindTexture(n.TEXTURE_2D, U), n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, v), n.texImage2D(
|
|
1155
1181
|
n.TEXTURE_2D,
|
|
1156
|
-
|
|
1182
|
+
g,
|
|
1157
1183
|
x,
|
|
1158
1184
|
d,
|
|
1159
1185
|
S,
|
|
1160
1186
|
w
|
|
1161
|
-
),
|
|
1187
|
+
), I && e.minFilter !== Le && e.minFilter !== ce && n.generateMipmap(n.TEXTURE_2D), n.texParameteri(
|
|
1162
1188
|
n.TEXTURE_2D,
|
|
1163
1189
|
n.TEXTURE_WRAP_S,
|
|
1164
|
-
this.wrapS ||
|
|
1190
|
+
this.wrapS || Ie
|
|
1165
1191
|
), n.texParameteri(
|
|
1166
1192
|
n.TEXTURE_2D,
|
|
1167
1193
|
n.TEXTURE_WRAP_T,
|
|
1168
|
-
this.wrapT ||
|
|
1194
|
+
this.wrapT || Ie
|
|
1169
1195
|
), n.texParameteri(
|
|
1170
1196
|
n.TEXTURE_2D,
|
|
1171
1197
|
n.TEXTURE_MIN_FILTER,
|
|
@@ -1177,7 +1203,7 @@ class rn {
|
|
|
1177
1203
|
), this._webglTexture = U, this.source = w, this.isVideo = !1, this.isLoaded = !0, this.width = w.width || 0, this.height = w.height || 0, this;
|
|
1178
1204
|
};
|
|
1179
1205
|
}
|
|
1180
|
-
const Y = (t) => `react-shaders: ${t}`,
|
|
1206
|
+
const Y = (t) => `react-shaders: ${t}`, _e = (t) => {
|
|
1181
1207
|
if ("changedTouches" in t) {
|
|
1182
1208
|
const e = t.changedTouches[0];
|
|
1183
1209
|
return [e?.clientX ?? 0, e?.clientY ?? 0];
|
|
@@ -1192,34 +1218,34 @@ function sn({
|
|
|
1192
1218
|
clearColor: o = [0, 0, 0, 1],
|
|
1193
1219
|
precision: c = "highp",
|
|
1194
1220
|
style: m,
|
|
1195
|
-
contextAttributes:
|
|
1196
|
-
lerp:
|
|
1221
|
+
contextAttributes: b = {},
|
|
1222
|
+
lerp: v = 1,
|
|
1197
1223
|
devicePixelRatio: R = 1,
|
|
1198
1224
|
onDoneLoadingTextures: p,
|
|
1199
|
-
onError:
|
|
1225
|
+
onError: g = console.error,
|
|
1200
1226
|
onWarning: x = console.warn
|
|
1201
1227
|
}) {
|
|
1202
|
-
const l = B(null), T = B(null), F = B(null), d = B(null), S = B(void 0),
|
|
1228
|
+
const l = B(null), T = B(null), F = B(null), d = B(null), S = B(void 0), C = B(void 0), U = B(!1), y = B(void 0), w = B(0), I = B([0, 0]), P = B([]), D = B(0), A = B(void 0), f = B({
|
|
1203
1229
|
[Te]: { type: "float", isNeeded: !1, value: 0 },
|
|
1204
1230
|
[ye]: { type: "float", isNeeded: !1, value: 0 },
|
|
1205
|
-
[
|
|
1231
|
+
[be]: { type: "vec4", isNeeded: !1, value: [0, 0, 0, 0] },
|
|
1206
1232
|
[Ae]: { type: "vec4", isNeeded: !1, value: [0, 0, 0, 0] },
|
|
1207
1233
|
[Re]: { type: "vec2", isNeeded: !1, value: [0, 0] },
|
|
1208
|
-
[
|
|
1234
|
+
[Ee]: { type: "int", isNeeded: !1, value: 0 },
|
|
1209
1235
|
[Se]: {
|
|
1210
1236
|
type: "vec4",
|
|
1211
1237
|
isNeeded: !1,
|
|
1212
1238
|
value: [0, 0, 0, 0]
|
|
1213
1239
|
}
|
|
1214
|
-
}),
|
|
1240
|
+
}), _ = B(r), N = (i, a) => {
|
|
1215
1241
|
const s = "width" in i ? i.width ?? 0 : 0, h = "height" in i ? i.height ?? 0 : 0, u = f.current.iChannelResolution;
|
|
1216
1242
|
if (!u) return;
|
|
1217
|
-
const
|
|
1218
|
-
|
|
1243
|
+
const E = Array.isArray(u.value) ? u.value : u.value = [];
|
|
1244
|
+
E[a * 3] = s * R, E[a * 3 + 1] = h * R, E[a * 3 + 2] = 0;
|
|
1219
1245
|
}, W = () => {
|
|
1220
|
-
l.current && (T.current = l.current.getContext("webgl",
|
|
1246
|
+
l.current && (T.current = l.current.getContext("webgl", b) || l.current.getContext(
|
|
1221
1247
|
"experimental-webgl",
|
|
1222
|
-
|
|
1248
|
+
b
|
|
1223
1249
|
), T.current?.getExtension("OES_standard_derivatives"), T.current?.getExtension("EXT_shader_texture_lod"));
|
|
1224
1250
|
}, k = () => {
|
|
1225
1251
|
const i = T.current;
|
|
@@ -1251,23 +1277,23 @@ function sn({
|
|
|
1251
1277
|
window.orientation ?? 0
|
|
1252
1278
|
];
|
|
1253
1279
|
}, z = (i) => {
|
|
1254
|
-
const [a = 0, s = 0] =
|
|
1280
|
+
const [a = 0, s = 0] = _e(i), h = a - (y.current?.left ?? 0) - window.pageXOffset, u = (y.current?.height ?? 0) - s - (y.current?.top ?? 0) - window.pageYOffset;
|
|
1255
1281
|
U.current = !0;
|
|
1256
|
-
const
|
|
1257
|
-
|
|
1282
|
+
const E = Array.isArray(f.current.iMouse?.value) ? f.current.iMouse.value : void 0;
|
|
1283
|
+
E && (E[2] = h, E[3] = u), I.current[0] = h, I.current[1] = u;
|
|
1258
1284
|
}, M = (i) => {
|
|
1259
1285
|
y.current = l.current?.getBoundingClientRect();
|
|
1260
|
-
const [a = 0, s = 0] =
|
|
1261
|
-
if (
|
|
1262
|
-
|
|
1286
|
+
const [a = 0, s = 0] = _e(i), h = a - (y.current?.left ?? 0), u = (y.current?.height ?? 0) - s - (y.current?.top ?? 0);
|
|
1287
|
+
if (v !== 1)
|
|
1288
|
+
I.current[0] = h, I.current[1] = u;
|
|
1263
1289
|
else {
|
|
1264
|
-
const
|
|
1265
|
-
|
|
1290
|
+
const E = Array.isArray(f.current.iMouse?.value) ? f.current.iMouse.value : void 0;
|
|
1291
|
+
E && (E[0] = h, E[1] = u);
|
|
1266
1292
|
}
|
|
1267
1293
|
}, L = () => {
|
|
1268
1294
|
const i = Array.isArray(f.current.iMouse?.value) ? f.current.iMouse.value : void 0;
|
|
1269
1295
|
i && (i[2] = 0, i[3] = 0);
|
|
1270
|
-
},
|
|
1296
|
+
}, O = () => {
|
|
1271
1297
|
const i = T.current;
|
|
1272
1298
|
if (!i) return;
|
|
1273
1299
|
y.current = l.current?.getBoundingClientRect();
|
|
@@ -1283,7 +1309,7 @@ function sn({
|
|
|
1283
1309
|
);
|
|
1284
1310
|
i.uniform2fv(u, [i.canvas.width, i.canvas.height]);
|
|
1285
1311
|
}
|
|
1286
|
-
},
|
|
1312
|
+
}, j = (i, a) => {
|
|
1287
1313
|
const s = T.current;
|
|
1288
1314
|
if (!s) return null;
|
|
1289
1315
|
const h = s.createShader(i);
|
|
@@ -1292,16 +1318,16 @@ function sn({
|
|
|
1292
1318
|
x?.(Y(`Error compiling the shader:
|
|
1293
1319
|
${a}`));
|
|
1294
1320
|
const u = s.getShaderInfoLog(h);
|
|
1295
|
-
s.deleteShader(h),
|
|
1321
|
+
s.deleteShader(h), g?.(Y(`Shader compiler log: ${u}`));
|
|
1296
1322
|
}
|
|
1297
1323
|
return h;
|
|
1298
1324
|
}, Z = (i, a) => {
|
|
1299
1325
|
const s = T.current;
|
|
1300
1326
|
if (!s) return;
|
|
1301
|
-
const h =
|
|
1327
|
+
const h = j(s.FRAGMENT_SHADER, i), u = j(s.VERTEX_SHADER, a);
|
|
1302
1328
|
if (d.current = s.createProgram(), !(!d.current || !u || !h)) {
|
|
1303
1329
|
if (s.attachShader(d.current, u), s.attachShader(d.current, h), s.linkProgram(d.current), !s.getProgramParameter(d.current, s.LINK_STATUS)) {
|
|
1304
|
-
|
|
1330
|
+
g?.(
|
|
1305
1331
|
Y(
|
|
1306
1332
|
`Unable to initialize the shader program: ${s.getProgramInfoLog(
|
|
1307
1333
|
d.current
|
|
@@ -1322,16 +1348,16 @@ ${a}`));
|
|
|
1322
1348
|
if (!a) continue;
|
|
1323
1349
|
const { value: s, type: h } = a, u = tn(h);
|
|
1324
1350
|
if (!u) continue;
|
|
1325
|
-
const
|
|
1351
|
+
const E = {};
|
|
1326
1352
|
if (Qt(h, s)) {
|
|
1327
|
-
const
|
|
1328
|
-
s.length > X * X && (
|
|
1329
|
-
} else Jt(h, s) && (
|
|
1353
|
+
const V = h.length, X = Number.parseInt(h.charAt(V - 3)), te = Math.floor(s.length / (X * X));
|
|
1354
|
+
s.length > X * X && (E.arraySize = `[${te}]`);
|
|
1355
|
+
} else Jt(h, s) && (E.arraySize = `[${Math.floor(s.length / Number.parseInt(h.charAt(0)))}]`);
|
|
1330
1356
|
f.current[i] = {
|
|
1331
1357
|
type: u,
|
|
1332
1358
|
isNeeded: !1,
|
|
1333
1359
|
value: s,
|
|
1334
|
-
...
|
|
1360
|
+
...E
|
|
1335
1361
|
};
|
|
1336
1362
|
}
|
|
1337
1363
|
}, ne = () => {
|
|
@@ -1345,21 +1371,21 @@ ${a}`));
|
|
|
1345
1371
|
value: []
|
|
1346
1372
|
};
|
|
1347
1373
|
const a = n.map(
|
|
1348
|
-
(s, h) => (f.current[`${
|
|
1374
|
+
(s, h) => (f.current[`${Kt}${h}`] = {
|
|
1349
1375
|
type: "sampler2D",
|
|
1350
1376
|
isNeeded: !1
|
|
1351
|
-
},
|
|
1352
|
-
|
|
1377
|
+
}, N(s, h), P.current[h] = new rn(i), P.current[h]?.load(s).then((u) => {
|
|
1378
|
+
N(u, h);
|
|
1353
1379
|
}))
|
|
1354
1380
|
);
|
|
1355
1381
|
Promise.all(a).then(() => {
|
|
1356
1382
|
p && p();
|
|
1357
1383
|
}).catch((s) => {
|
|
1358
|
-
|
|
1384
|
+
g?.(s), p && p();
|
|
1359
1385
|
});
|
|
1360
1386
|
} else p && p();
|
|
1361
1387
|
}, re = (i) => {
|
|
1362
|
-
const a =
|
|
1388
|
+
const a = ge.includes(c ?? "highp"), s = `precision ${a ? c : ge[1]} float;
|
|
1363
1389
|
`;
|
|
1364
1390
|
a || x?.(
|
|
1365
1391
|
Y(
|
|
@@ -1368,39 +1394,39 @@ ${a}`));
|
|
|
1368
1394
|
);
|
|
1369
1395
|
let h = s.concat(`#define DPR ${R.toFixed(1)}
|
|
1370
1396
|
`).concat(i.replace(/texture\(/g, "texture2D("));
|
|
1371
|
-
for (const
|
|
1372
|
-
if (i.includes(
|
|
1373
|
-
const
|
|
1374
|
-
if (!
|
|
1397
|
+
for (const E of Object.keys(f.current))
|
|
1398
|
+
if (i.includes(E)) {
|
|
1399
|
+
const V = f.current[E];
|
|
1400
|
+
if (!V) continue;
|
|
1375
1401
|
h = on(
|
|
1376
1402
|
h,
|
|
1377
|
-
`uniform ${
|
|
1403
|
+
`uniform ${V.type} ${E}${V.arraySize || ""};
|
|
1378
1404
|
`,
|
|
1379
1405
|
h.lastIndexOf(s) + s.length
|
|
1380
|
-
),
|
|
1406
|
+
), V.isNeeded = !0;
|
|
1381
1407
|
}
|
|
1382
1408
|
return i.includes("mainImage") && (h = h.concat(Ht)), h;
|
|
1383
|
-
},
|
|
1409
|
+
}, K = (i) => {
|
|
1384
1410
|
const a = T.current;
|
|
1385
1411
|
if (!a || !d.current) return;
|
|
1386
|
-
const s =
|
|
1387
|
-
|
|
1388
|
-
const h =
|
|
1412
|
+
const s = D.current ? (i - D.current) / 1e3 : 0;
|
|
1413
|
+
D.current = i;
|
|
1414
|
+
const h = _.current;
|
|
1389
1415
|
if (h)
|
|
1390
1416
|
for (const u of Object.keys(h)) {
|
|
1391
|
-
const
|
|
1392
|
-
if (
|
|
1417
|
+
const E = h[u];
|
|
1418
|
+
if (E && f.current[u]?.isNeeded) {
|
|
1393
1419
|
if (!d.current) return;
|
|
1394
|
-
const
|
|
1420
|
+
const V = a.getUniformLocation(
|
|
1395
1421
|
d.current,
|
|
1396
1422
|
u
|
|
1397
1423
|
);
|
|
1398
|
-
if (!
|
|
1424
|
+
if (!V) return;
|
|
1399
1425
|
en(
|
|
1400
1426
|
a,
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1427
|
+
V,
|
|
1428
|
+
E.type,
|
|
1429
|
+
E.value
|
|
1404
1430
|
);
|
|
1405
1431
|
}
|
|
1406
1432
|
}
|
|
@@ -1446,24 +1472,24 @@ ${a}`));
|
|
|
1446
1472
|
a.uniform1f(u, s);
|
|
1447
1473
|
}
|
|
1448
1474
|
if (f.current.iDate?.isNeeded) {
|
|
1449
|
-
const u = /* @__PURE__ */ new Date(),
|
|
1475
|
+
const u = /* @__PURE__ */ new Date(), E = u.getMonth() + 1, V = u.getDate(), X = u.getFullYear(), te = u.getHours() * 60 * 60 + u.getMinutes() * 60 + u.getSeconds() + u.getMilliseconds() * 1e-3, ae = a.getUniformLocation(
|
|
1450
1476
|
d.current,
|
|
1451
|
-
|
|
1477
|
+
be
|
|
1452
1478
|
);
|
|
1453
|
-
a.uniform4fv(ae, [X,
|
|
1479
|
+
a.uniform4fv(ae, [X, E, V, te]);
|
|
1454
1480
|
}
|
|
1455
1481
|
if (f.current.iFrame?.isNeeded) {
|
|
1456
1482
|
const u = a.getUniformLocation(
|
|
1457
1483
|
d.current,
|
|
1458
|
-
|
|
1459
|
-
),
|
|
1460
|
-
a.uniform1i(u,
|
|
1484
|
+
Ee
|
|
1485
|
+
), E = f.current.iFrame.value;
|
|
1486
|
+
a.uniform1i(u, E), f.current.iFrame.value = E + 1;
|
|
1461
1487
|
}
|
|
1462
1488
|
if (P.current.length > 0)
|
|
1463
1489
|
for (let u = 0; u < P.current.length; u++) {
|
|
1464
|
-
const
|
|
1465
|
-
if (!
|
|
1466
|
-
const { isVideo:
|
|
1490
|
+
const E = P.current[u];
|
|
1491
|
+
if (!E) return;
|
|
1492
|
+
const { isVideo: V, _webglTexture: X, source: te, flipY: ae, isLoaded: ke } = E;
|
|
1467
1493
|
if (!ke || !X || !te) return;
|
|
1468
1494
|
if (f.current[`iChannel${u}`]?.isNeeded) {
|
|
1469
1495
|
if (!d.current) return;
|
|
@@ -1471,7 +1497,7 @@ ${a}`));
|
|
|
1471
1497
|
d.current,
|
|
1472
1498
|
`iChannel${u}`
|
|
1473
1499
|
);
|
|
1474
|
-
a.activeTexture(a.TEXTURE0 + u), a.bindTexture(a.TEXTURE_2D, X), a.uniform1i(We, u),
|
|
1500
|
+
a.activeTexture(a.TEXTURE0 + u), a.bindTexture(a.TEXTURE_2D, X), a.uniform1i(We, u), V && E.updateTexture(
|
|
1475
1501
|
X,
|
|
1476
1502
|
te,
|
|
1477
1503
|
ae
|
|
@@ -1488,36 +1514,36 @@ ${a}`));
|
|
|
1488
1514
|
!1,
|
|
1489
1515
|
0,
|
|
1490
1516
|
0
|
|
1491
|
-
),
|
|
1517
|
+
), K(i), a.drawArrays(a.TRIANGLE_STRIP, 0, 4);
|
|
1492
1518
|
const s = f.current.iMouse?.value;
|
|
1493
|
-
if (f.current.iMouse?.isNeeded &&
|
|
1519
|
+
if (f.current.iMouse?.isNeeded && v !== 1 && Array.isArray(s)) {
|
|
1494
1520
|
const h = s[0] ?? 0, u = s[1] ?? 0;
|
|
1495
|
-
s[0] = Fe(h,
|
|
1521
|
+
s[0] = Fe(h, I.current[0] ?? 0, v), s[1] = Fe(u, I.current[1] ?? 0, v);
|
|
1496
1522
|
}
|
|
1497
|
-
|
|
1523
|
+
C.current = requestAnimationFrame(Q);
|
|
1498
1524
|
}, ee = () => {
|
|
1499
1525
|
const i = { passive: !0 };
|
|
1500
1526
|
f.current.iMouse?.isNeeded && l.current && (l.current.addEventListener("mousemove", M, i), l.current.addEventListener("mouseout", L, i), l.current.addEventListener("mouseup", L, i), l.current.addEventListener("mousedown", z, i), l.current.addEventListener("touchmove", M, i), l.current.addEventListener("touchend", L, i), l.current.addEventListener("touchstart", z, i)), f.current.iDeviceOrientation?.isNeeded && window.addEventListener(
|
|
1501
1527
|
"deviceorientation",
|
|
1502
1528
|
H,
|
|
1503
1529
|
i
|
|
1504
|
-
), l.current && (A.current = new ResizeObserver(
|
|
1530
|
+
), l.current && (A.current = new ResizeObserver(O), A.current.observe(l.current), window.addEventListener("resize", O, i));
|
|
1505
1531
|
}, J = () => {
|
|
1506
1532
|
const i = { passive: !0 };
|
|
1507
1533
|
f.current.iMouse?.isNeeded && l.current && (l.current.removeEventListener("mousemove", M, i), l.current.removeEventListener("mouseout", L, i), l.current.removeEventListener("mouseup", L, i), l.current.removeEventListener("mousedown", z, i), l.current.removeEventListener("touchmove", M, i), l.current.removeEventListener("touchend", L, i), l.current.removeEventListener("touchstart", z, i)), f.current.iDeviceOrientation?.isNeeded && window.removeEventListener(
|
|
1508
1534
|
"deviceorientation",
|
|
1509
1535
|
H,
|
|
1510
1536
|
i
|
|
1511
|
-
), A.current && (A.current.disconnect(), window.removeEventListener("resize",
|
|
1537
|
+
), A.current && (A.current.disconnect(), window.removeEventListener("resize", O, i));
|
|
1512
1538
|
};
|
|
1513
1539
|
return ie(() => {
|
|
1514
|
-
|
|
1540
|
+
_.current = r;
|
|
1515
1541
|
}, [r]), ie(() => {
|
|
1516
1542
|
const i = P.current;
|
|
1517
1543
|
function a() {
|
|
1518
1544
|
W();
|
|
1519
1545
|
const s = T.current;
|
|
1520
|
-
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, $(), ne(), Z(re(t ||
|
|
1546
|
+
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, $(), ne(), Z(re(t || jt), e || we), k(), requestAnimationFrame(Q), ee(), O());
|
|
1521
1547
|
}
|
|
1522
1548
|
return requestAnimationFrame(a), () => {
|
|
1523
1549
|
const s = T.current;
|
|
@@ -1527,7 +1553,7 @@ ${a}`));
|
|
|
1527
1553
|
s.deleteTexture(h._webglTexture);
|
|
1528
1554
|
d.current = null;
|
|
1529
1555
|
}
|
|
1530
|
-
J(), cancelAnimationFrame(
|
|
1556
|
+
J(), cancelAnimationFrame(C.current ?? 0);
|
|
1531
1557
|
};
|
|
1532
1558
|
}, []), /* @__PURE__ */ q(
|
|
1533
1559
|
"canvas",
|
|
@@ -1717,8 +1743,8 @@ function oe(t) {
|
|
|
1717
1743
|
const [e, n] = Ue(t), r = dt(t), o = B(null);
|
|
1718
1744
|
wt(r, "change", (m) => n(m));
|
|
1719
1745
|
const c = $e(
|
|
1720
|
-
(m,
|
|
1721
|
-
o.current = Wt(r, m,
|
|
1746
|
+
(m, b) => {
|
|
1747
|
+
o.current = Wt(r, m, b);
|
|
1722
1748
|
},
|
|
1723
1749
|
[r]
|
|
1724
1750
|
);
|
|
@@ -1729,7 +1755,7 @@ function dn(t, e) {
|
|
|
1729
1755
|
value: o,
|
|
1730
1756
|
animate: c,
|
|
1731
1757
|
motionValue: m
|
|
1732
|
-
} = oe(fn), { value:
|
|
1758
|
+
} = oe(fn), { value: b, animate: v } = oe(un), { value: R, animate: p } = oe(ln), { value: g, animate: x } = oe(hn), l = gt(e, {
|
|
1733
1759
|
fftSize: 512,
|
|
1734
1760
|
smoothingTimeConstant: 0.55
|
|
1735
1761
|
});
|
|
@@ -1738,25 +1764,25 @@ function dn(t, e) {
|
|
|
1738
1764
|
case "idle":
|
|
1739
1765
|
case "failed":
|
|
1740
1766
|
case "disconnected":
|
|
1741
|
-
r(10), c(0.2, G),
|
|
1767
|
+
r(10), c(0.2, G), v(1.2, G), p(0.4, G), x(1, G);
|
|
1742
1768
|
return;
|
|
1743
1769
|
case "listening":
|
|
1744
1770
|
case "pre-connect-buffering":
|
|
1745
|
-
r(20), c(0.3, { type: "spring", duration: 1, bounce: 0.35 }),
|
|
1771
|
+
r(20), c(0.3, { type: "spring", duration: 1, bounce: 0.35 }), v(1, G), p(0.7, G), x([1.5, 2], Pe);
|
|
1746
1772
|
return;
|
|
1747
1773
|
case "thinking":
|
|
1748
1774
|
case "connecting":
|
|
1749
1775
|
case "initializing":
|
|
1750
|
-
r(30), c(0.3, G),
|
|
1776
|
+
r(30), c(0.3, G), v(0.5, G), p(1, G), x([0.5, 2.5], Pe);
|
|
1751
1777
|
return;
|
|
1752
1778
|
case "speaking":
|
|
1753
|
-
r(70), c(0.3, G),
|
|
1779
|
+
r(70), c(0.3, G), v(0.75, G), p(1.25, G), x(1.5, G);
|
|
1754
1780
|
return;
|
|
1755
1781
|
}
|
|
1756
1782
|
}, [
|
|
1757
1783
|
t,
|
|
1758
1784
|
c,
|
|
1759
|
-
|
|
1785
|
+
v,
|
|
1760
1786
|
p,
|
|
1761
1787
|
x
|
|
1762
1788
|
]), ie(() => {
|
|
@@ -1766,15 +1792,15 @@ function dn(t, e) {
|
|
|
1766
1792
|
l,
|
|
1767
1793
|
m,
|
|
1768
1794
|
c,
|
|
1769
|
-
|
|
1795
|
+
v,
|
|
1770
1796
|
p,
|
|
1771
1797
|
x
|
|
1772
1798
|
]), {
|
|
1773
1799
|
speed: n,
|
|
1774
1800
|
scale: o,
|
|
1775
|
-
amplitude:
|
|
1801
|
+
amplitude: b,
|
|
1776
1802
|
frequency: R,
|
|
1777
|
-
brightness:
|
|
1803
|
+
brightness: g
|
|
1778
1804
|
};
|
|
1779
1805
|
}
|
|
1780
1806
|
const mn = pt({
|
|
@@ -1809,15 +1835,15 @@ function Ge({
|
|
|
1809
1835
|
scale: o = 0.2,
|
|
1810
1836
|
blur: c = 1,
|
|
1811
1837
|
color: m = "#FF355E",
|
|
1812
|
-
colorShift:
|
|
1813
|
-
brightness:
|
|
1838
|
+
colorShift: b = 1,
|
|
1839
|
+
brightness: v = 1,
|
|
1814
1840
|
themeMode: R = typeof window < "u" && document.documentElement.classList.contains("dark") ? "dark" : "light",
|
|
1815
1841
|
ref: p,
|
|
1816
|
-
className:
|
|
1842
|
+
className: g,
|
|
1817
1843
|
...x
|
|
1818
1844
|
}) {
|
|
1819
1845
|
const l = qe(() => pn(m), [m]);
|
|
1820
|
-
return /* @__PURE__ */ q("div", { ref: p, className:
|
|
1846
|
+
return /* @__PURE__ */ q("div", { ref: p, className: g, ...x, children: /* @__PURE__ */ q(
|
|
1821
1847
|
sn,
|
|
1822
1848
|
{
|
|
1823
1849
|
fs: an,
|
|
@@ -1838,11 +1864,11 @@ function Ge({
|
|
|
1838
1864
|
// Light intensity (bloom)
|
|
1839
1865
|
uBloom: { type: "1f", value: 0 },
|
|
1840
1866
|
// Brightness of the aurora (0-1)
|
|
1841
|
-
uMix: { type: "1f", value:
|
|
1867
|
+
uMix: { type: "1f", value: v },
|
|
1842
1868
|
// Color variation across layers (0-1)
|
|
1843
1869
|
uSpacing: { type: "1f", value: 0.5 },
|
|
1844
1870
|
// Color palette offset - shifts colors along the gradient (0-1)
|
|
1845
|
-
uColorShift: { type: "1f", value:
|
|
1871
|
+
uColorShift: { type: "1f", value: b },
|
|
1846
1872
|
// Color variation across layers (0-1)
|
|
1847
1873
|
uVariance: { type: "1f", value: 0.1 },
|
|
1848
1874
|
// Smoothing of the aurora (0-1)
|
|
@@ -1871,21 +1897,21 @@ function Sn({
|
|
|
1871
1897
|
audioTrack: o,
|
|
1872
1898
|
themeMode: c,
|
|
1873
1899
|
className: m,
|
|
1874
|
-
ref:
|
|
1875
|
-
...
|
|
1900
|
+
ref: b,
|
|
1901
|
+
...v
|
|
1876
1902
|
}) {
|
|
1877
|
-
const { speed: R, scale: p, amplitude:
|
|
1903
|
+
const { speed: R, scale: p, amplitude: g, frequency: x, brightness: l } = dn(e, o);
|
|
1878
1904
|
return /* @__PURE__ */ q(
|
|
1879
1905
|
Ge,
|
|
1880
1906
|
{
|
|
1881
|
-
ref:
|
|
1907
|
+
ref: b,
|
|
1882
1908
|
blur: 0.2,
|
|
1883
1909
|
color: n,
|
|
1884
1910
|
colorShift: r,
|
|
1885
1911
|
speed: R,
|
|
1886
1912
|
scale: p,
|
|
1887
1913
|
themeMode: c,
|
|
1888
|
-
amplitude:
|
|
1914
|
+
amplitude: g,
|
|
1889
1915
|
frequency: x,
|
|
1890
1916
|
brightness: l,
|
|
1891
1917
|
className: mt(
|
|
@@ -1893,7 +1919,7 @@ function Sn({
|
|
|
1893
1919
|
"overflow-hidden rounded-full",
|
|
1894
1920
|
m
|
|
1895
1921
|
),
|
|
1896
|
-
...
|
|
1922
|
+
...v
|
|
1897
1923
|
}
|
|
1898
1924
|
);
|
|
1899
1925
|
}
|
|
@@ -1912,7 +1938,7 @@ const Ln = ({
|
|
|
1912
1938
|
type: "button",
|
|
1913
1939
|
variant: "outline",
|
|
1914
1940
|
size: "sm",
|
|
1915
|
-
icon:
|
|
1941
|
+
icon: vt,
|
|
1916
1942
|
onClick: n,
|
|
1917
1943
|
label: e
|
|
1918
1944
|
}
|
|
@@ -1932,8 +1958,8 @@ const Ln = ({
|
|
|
1932
1958
|
export {
|
|
1933
1959
|
An as A,
|
|
1934
1960
|
xn as F,
|
|
1935
|
-
|
|
1936
|
-
|
|
1961
|
+
En as a,
|
|
1962
|
+
bn as b,
|
|
1937
1963
|
Sn as c,
|
|
1938
1964
|
Ln as d,
|
|
1939
1965
|
yn as o,
|