@factorialco/f0-react 1.376.1 → 1.378.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/{DataCollectionStorageProvider-DYikAZhp.js → DataCollectionStorageProvider-C107DYaA.js} +15784 -14216
- package/dist/F0AiChat-Bza8zqLg.js +134780 -0
- package/dist/{F0HILActionConfirmation-DqkMrDGj.js → F0HILActionConfirmation-DVS7vYT1.js} +388 -211
- package/dist/ai.d.ts +21 -13
- package/dist/ai.js +2 -2
- package/dist/experimental.d.ts +144 -135
- package/dist/experimental.js +15957 -13023
- package/dist/f0.d.ts +263 -232
- package/dist/f0.js +5019 -4252
- package/dist/i18n-provider-defaults.d.ts +11 -11
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/F0AiChat-Bb12WR9x.js +0 -117826
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as X, jsxs as le } from "react/jsx-runtime";
|
|
2
2
|
import { useInsertionEffect as Xe, createContext as ke, useContext as $e, useRef as _, useEffect as ne, useState as _e, useCallback as ze, useMemo as Ye } from "react";
|
|
3
|
-
import { y as qe, z as We, D as He, G as je, J as Ne, K as Ke, M as Qe, N as Je, Q as Ze, R as et, V as Ce, W as tt, X as rt, Y as nt, Z as it, _ as ot, $ as at, a0 as st, a1 as ie, a2 as ct, a3 as ut, a4 as lt, a5 as ft, a6 as mt, a7 as dt, a8 as fe, a9 as ht } from "./F0AiChat-
|
|
3
|
+
import { y as qe, z as We, D as He, G as je, J as Ne, K as Ke, M as Qe, N as Je, Q as Ze, R as et, V as Ce, W as tt, X as rt, Y as nt, Z as it, _ as ot, $ as at, a0 as st, a1 as ie, a2 as ct, a3 as ut, a4 as lt, a5 as ft, a6 as mt, a7 as dt, a8 as fe, a9 as ht } from "./F0AiChat-Bza8zqLg.js";
|
|
4
4
|
import { useTrackVolume as pt } from "@livekit/components-react";
|
|
5
5
|
function vt(t, e, r) {
|
|
6
6
|
Xe(() => t.on(e, r), [t, e, r]);
|
|
@@ -356,16 +356,18 @@ const Gt = Bt(), mr = ["xs", "sm", "md", "lg"], dr = [
|
|
|
356
356
|
ask: "Ask One"
|
|
357
357
|
}
|
|
358
358
|
}, Pe = ke(null);
|
|
359
|
-
function pr({
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
});
|
|
359
|
+
function pr({
|
|
360
|
+
children: t,
|
|
361
|
+
translations: e
|
|
362
|
+
}) {
|
|
363
|
+
return /* @__PURE__ */ X(Pe.Provider, { value: e, children: t });
|
|
364
364
|
}
|
|
365
365
|
function vr() {
|
|
366
366
|
const t = $e(Pe);
|
|
367
367
|
if (t === null)
|
|
368
|
-
throw new Error(
|
|
368
|
+
throw new Error(
|
|
369
|
+
"useAiChatTranslations must be used within an AiChatTranslationsProvider"
|
|
370
|
+
);
|
|
369
371
|
return t;
|
|
370
372
|
}
|
|
371
373
|
const pe = ["lowp", "mediump", "highp"], Xt = `
|
|
@@ -473,7 +475,11 @@ const Wt = (t, e, r, n) => {
|
|
|
473
475
|
case "Matrix4fv":
|
|
474
476
|
return "mat4";
|
|
475
477
|
default:
|
|
476
|
-
console.error(
|
|
478
|
+
console.error(
|
|
479
|
+
G(
|
|
480
|
+
`The uniform type "${t}" is not valid, please make sure your uniform type is valid`
|
|
481
|
+
)
|
|
482
|
+
);
|
|
477
483
|
}
|
|
478
484
|
}, se = 9729, be = 9728, jt = 9987, Re = 33071, Ie = 10497;
|
|
479
485
|
class Kt {
|
|
@@ -496,7 +502,14 @@ class Kt {
|
|
|
496
502
|
}
|
|
497
503
|
updateTexture = (e, r, n) => {
|
|
498
504
|
const { gl: l } = this, f = 0, h = l.RGBA, A = l.RGBA, g = l.UNSIGNED_BYTE;
|
|
499
|
-
l.bindTexture(l.TEXTURE_2D, e), l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL, n), l.texImage2D(
|
|
505
|
+
l.bindTexture(l.TEXTURE_2D, e), l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL, n), l.texImage2D(
|
|
506
|
+
l.TEXTURE_2D,
|
|
507
|
+
f,
|
|
508
|
+
h,
|
|
509
|
+
A,
|
|
510
|
+
g,
|
|
511
|
+
r
|
|
512
|
+
);
|
|
500
513
|
};
|
|
501
514
|
setupVideo = (e) => {
|
|
502
515
|
const r = document.createElement("video");
|
|
@@ -505,30 +518,70 @@ class Kt {
|
|
|
505
518
|
const f = () => {
|
|
506
519
|
n && l && (this.isLoaded = !0);
|
|
507
520
|
};
|
|
508
|
-
return r.addEventListener(
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
521
|
+
return r.addEventListener(
|
|
522
|
+
"playing",
|
|
523
|
+
() => {
|
|
524
|
+
n = !0, this.width = r.videoWidth || 0, this.height = r.videoHeight || 0, f();
|
|
525
|
+
},
|
|
526
|
+
!0
|
|
527
|
+
), r.addEventListener(
|
|
528
|
+
"timeupdate",
|
|
529
|
+
() => {
|
|
530
|
+
l = !0, f();
|
|
531
|
+
},
|
|
532
|
+
!0
|
|
533
|
+
), r.src = e, r;
|
|
513
534
|
};
|
|
514
|
-
makePowerOf2 = (e) => e instanceof HTMLImageElement || e instanceof HTMLCanvasElement || e instanceof ImageBitmap ? (this.pow2canvas === void 0 && (this.pow2canvas = document.createElement("canvas")), this.pow2canvas.width = 2 ** Math.floor(Math.log(e.width) / Math.LN2), this.pow2canvas.height = 2 ** Math.floor(Math.log(e.height) / Math.LN2), this.pow2canvas.getContext("2d")?.drawImage(
|
|
535
|
+
makePowerOf2 = (e) => e instanceof HTMLImageElement || e instanceof HTMLCanvasElement || e instanceof ImageBitmap ? (this.pow2canvas === void 0 && (this.pow2canvas = document.createElement("canvas")), this.pow2canvas.width = 2 ** Math.floor(Math.log(e.width) / Math.LN2), this.pow2canvas.height = 2 ** Math.floor(Math.log(e.height) / Math.LN2), this.pow2canvas.getContext("2d")?.drawImage(
|
|
536
|
+
e,
|
|
537
|
+
0,
|
|
538
|
+
0,
|
|
539
|
+
this.pow2canvas.width,
|
|
540
|
+
this.pow2canvas.height
|
|
541
|
+
), console.warn(
|
|
542
|
+
G(
|
|
543
|
+
`Image is not power of two ${e.width} x ${e.height}. Resized to ${this.pow2canvas.width} x ${this.pow2canvas.height};`
|
|
544
|
+
)
|
|
545
|
+
), this.pow2canvas) : e;
|
|
515
546
|
load = async (e) => {
|
|
516
|
-
const { gl: r } = this, {
|
|
517
|
-
if (!n)
|
|
518
|
-
return Promise.reject(new Error(G("Missing url, please make sure to pass the url of your texture { url: ... }")));
|
|
519
|
-
const b = /(\.jpg|\.jpeg|\.png|\.gif|\.bmp)$/i.exec(n), y = /(\.mp4|\.3gp|\.webm|\.ogv)$/i.exec(n);
|
|
520
|
-
if (b === null && y === null)
|
|
521
|
-
return Promise.reject(new Error(G(`Please upload a video or an image with a valid format (url: ${n})`)));
|
|
522
|
-
Object.assign(this, {
|
|
547
|
+
const { gl: r } = this, {
|
|
523
548
|
url: n,
|
|
524
549
|
wrapS: l,
|
|
525
550
|
wrapT: f,
|
|
526
551
|
minFilter: h,
|
|
527
552
|
magFilter: A,
|
|
528
|
-
flipY: g
|
|
529
|
-
}
|
|
553
|
+
flipY: g = -1
|
|
554
|
+
} = e;
|
|
555
|
+
if (!n)
|
|
556
|
+
return Promise.reject(
|
|
557
|
+
new Error(
|
|
558
|
+
G(
|
|
559
|
+
"Missing url, please make sure to pass the url of your texture { url: ... }"
|
|
560
|
+
)
|
|
561
|
+
)
|
|
562
|
+
);
|
|
563
|
+
const b = /(\.jpg|\.jpeg|\.png|\.gif|\.bmp)$/i.exec(n), y = /(\.mp4|\.3gp|\.webm|\.ogv)$/i.exec(n);
|
|
564
|
+
if (b === null && y === null)
|
|
565
|
+
return Promise.reject(
|
|
566
|
+
new Error(
|
|
567
|
+
G(
|
|
568
|
+
`Please upload a video or an image with a valid format (url: ${n})`
|
|
569
|
+
)
|
|
570
|
+
)
|
|
571
|
+
);
|
|
572
|
+
Object.assign(this, { url: n, wrapS: l, wrapT: f, minFilter: h, magFilter: A, flipY: g });
|
|
530
573
|
const T = 0, x = r.RGBA, c = 1, v = 1, N = 0, m = r.RGBA, R = r.UNSIGNED_BYTE, L = new Uint8Array([255, 255, 255, 0]), C = r.createTexture();
|
|
531
|
-
if (r.bindTexture(r.TEXTURE_2D, C), r.texImage2D(
|
|
574
|
+
if (r.bindTexture(r.TEXTURE_2D, C), r.texImage2D(
|
|
575
|
+
r.TEXTURE_2D,
|
|
576
|
+
T,
|
|
577
|
+
x,
|
|
578
|
+
c,
|
|
579
|
+
v,
|
|
580
|
+
N,
|
|
581
|
+
m,
|
|
582
|
+
R,
|
|
583
|
+
L
|
|
584
|
+
), y) {
|
|
532
585
|
const F = this.setupVideo(n);
|
|
533
586
|
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 = C, this.source = F, this.isVideo = !0, F.play().then(() => this);
|
|
534
587
|
}
|
|
@@ -543,7 +596,30 @@ class Kt {
|
|
|
543
596
|
});
|
|
544
597
|
}
|
|
545
598
|
let S = await w(), I = (S.width & S.width - 1) === 0 && (S.height & S.height - 1) === 0;
|
|
546
|
-
return (e.wrapS !== Re || e.wrapT !== Re || e.minFilter !== be && e.minFilter !== se) && !I && (S = this.makePowerOf2(S), I = !0), r.bindTexture(r.TEXTURE_2D, C), r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL, g), r.texImage2D(
|
|
599
|
+
return (e.wrapS !== Re || e.wrapT !== Re || e.minFilter !== be && e.minFilter !== se) && !I && (S = this.makePowerOf2(S), I = !0), r.bindTexture(r.TEXTURE_2D, C), r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL, g), r.texImage2D(
|
|
600
|
+
r.TEXTURE_2D,
|
|
601
|
+
T,
|
|
602
|
+
x,
|
|
603
|
+
m,
|
|
604
|
+
R,
|
|
605
|
+
S
|
|
606
|
+
), I && e.minFilter !== be && e.minFilter !== se && r.generateMipmap(r.TEXTURE_2D), r.texParameteri(
|
|
607
|
+
r.TEXTURE_2D,
|
|
608
|
+
r.TEXTURE_WRAP_S,
|
|
609
|
+
this.wrapS || Ie
|
|
610
|
+
), r.texParameteri(
|
|
611
|
+
r.TEXTURE_2D,
|
|
612
|
+
r.TEXTURE_WRAP_T,
|
|
613
|
+
this.wrapT || Ie
|
|
614
|
+
), r.texParameteri(
|
|
615
|
+
r.TEXTURE_2D,
|
|
616
|
+
r.TEXTURE_MIN_FILTER,
|
|
617
|
+
this.minFilter || jt
|
|
618
|
+
), r.texParameteri(
|
|
619
|
+
r.TEXTURE_2D,
|
|
620
|
+
r.TEXTURE_MAG_FILTER,
|
|
621
|
+
this.magFilter || se
|
|
622
|
+
), this._webglTexture = C, this.source = S, this.isVideo = !1, this.isLoaded = !0, this.width = S.width || 0, this.height = S.height || 0, this;
|
|
547
623
|
};
|
|
548
624
|
}
|
|
549
625
|
const G = (t) => `react-shaders: ${t}`, Fe = (t) => {
|
|
@@ -553,38 +629,28 @@ const G = (t) => `react-shaders: ${t}`, Fe = (t) => {
|
|
|
553
629
|
}
|
|
554
630
|
return [t.clientX, t.clientY];
|
|
555
631
|
}, Le = (t, e, r) => t * (1 - r) + e * r, Qt = (t, e, r) => r > 0 ? t.substring(0, r) + e + t.substring(r, t.length) : e + t;
|
|
556
|
-
function Jt({
|
|
632
|
+
function Jt({
|
|
633
|
+
fs: t,
|
|
634
|
+
vs: e = ve,
|
|
635
|
+
textures: r = [],
|
|
636
|
+
uniforms: n,
|
|
637
|
+
clearColor: l = [0, 0, 0, 1],
|
|
638
|
+
precision: f = "highp",
|
|
639
|
+
style: h,
|
|
640
|
+
contextAttributes: A = {},
|
|
641
|
+
lerp: g = 1,
|
|
642
|
+
devicePixelRatio: b = 1,
|
|
643
|
+
onDoneLoadingTextures: y,
|
|
644
|
+
onError: T = console.error,
|
|
645
|
+
onWarning: x = console.warn
|
|
646
|
+
}) {
|
|
557
647
|
const c = _(null), v = _(null), N = _(null), m = _(null), R = _(void 0), L = _(void 0), C = _(!1), w = _(void 0), S = _(0), I = _([0, 0]), F = _([]), V = _(0), E = _(void 0), d = _({
|
|
558
|
-
[ge]: {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
},
|
|
563
|
-
[
|
|
564
|
-
type: "float",
|
|
565
|
-
isNeeded: !1,
|
|
566
|
-
value: 0
|
|
567
|
-
},
|
|
568
|
-
[Te]: {
|
|
569
|
-
type: "vec4",
|
|
570
|
-
isNeeded: !1,
|
|
571
|
-
value: [0, 0, 0, 0]
|
|
572
|
-
},
|
|
573
|
-
[Ae]: {
|
|
574
|
-
type: "vec4",
|
|
575
|
-
isNeeded: !1,
|
|
576
|
-
value: [0, 0, 0, 0]
|
|
577
|
-
},
|
|
578
|
-
[we]: {
|
|
579
|
-
type: "vec2",
|
|
580
|
-
isNeeded: !1,
|
|
581
|
-
value: [0, 0]
|
|
582
|
-
},
|
|
583
|
-
[Ee]: {
|
|
584
|
-
type: "int",
|
|
585
|
-
isNeeded: !1,
|
|
586
|
-
value: 0
|
|
587
|
-
},
|
|
648
|
+
[ge]: { type: "float", isNeeded: !1, value: 0 },
|
|
649
|
+
[ye]: { type: "float", isNeeded: !1, value: 0 },
|
|
650
|
+
[Te]: { type: "vec4", isNeeded: !1, value: [0, 0, 0, 0] },
|
|
651
|
+
[Ae]: { type: "vec4", isNeeded: !1, value: [0, 0, 0, 0] },
|
|
652
|
+
[we]: { type: "vec2", isNeeded: !1, value: [0, 0] },
|
|
653
|
+
[Ee]: { type: "int", isNeeded: !1, value: 0 },
|
|
588
654
|
[xe]: {
|
|
589
655
|
type: "vec4",
|
|
590
656
|
isNeeded: !1,
|
|
@@ -596,14 +662,39 @@ function Jt({ fs: t, vs: e = ve, textures: r = [], uniforms: n, clearColor: l =
|
|
|
596
662
|
const p = Array.isArray(s.value) ? s.value : s.value = [];
|
|
597
663
|
p[a * 3] = o * b, p[a * 3 + 1] = u * b, p[a * 3 + 2] = 0;
|
|
598
664
|
}, k = () => {
|
|
599
|
-
c.current && (v.current = c.current.getContext("webgl", A) || c.current.getContext(
|
|
665
|
+
c.current && (v.current = c.current.getContext("webgl", A) || c.current.getContext(
|
|
666
|
+
"experimental-webgl",
|
|
667
|
+
A
|
|
668
|
+
), v.current?.getExtension("OES_standard_derivatives"), v.current?.getExtension("EXT_shader_texture_lod"));
|
|
600
669
|
}, ue = () => {
|
|
601
670
|
const i = v.current;
|
|
602
671
|
N.current = i?.createBuffer() ?? null, i?.bindBuffer(i.ARRAY_BUFFER, N.current);
|
|
603
|
-
const a = [
|
|
672
|
+
const a = [
|
|
673
|
+
1,
|
|
674
|
+
1,
|
|
675
|
+
0,
|
|
676
|
+
-1,
|
|
677
|
+
1,
|
|
678
|
+
0,
|
|
679
|
+
1,
|
|
680
|
+
-1,
|
|
681
|
+
0,
|
|
682
|
+
-1,
|
|
683
|
+
-1,
|
|
684
|
+
0
|
|
685
|
+
];
|
|
604
686
|
i?.bufferData(i.ARRAY_BUFFER, new Float32Array(a), i.STATIC_DRAW);
|
|
605
|
-
}, oe = ({
|
|
606
|
-
|
|
687
|
+
}, oe = ({
|
|
688
|
+
alpha: i,
|
|
689
|
+
beta: a,
|
|
690
|
+
gamma: o
|
|
691
|
+
}) => {
|
|
692
|
+
d.current.iDeviceOrientation.value = [
|
|
693
|
+
i ?? 0,
|
|
694
|
+
a ?? 0,
|
|
695
|
+
o ?? 0,
|
|
696
|
+
window.orientation ?? 0
|
|
697
|
+
];
|
|
607
698
|
}, H = (i) => {
|
|
608
699
|
const [a = 0, o = 0] = Fe(i), u = a - (w.current?.left ?? 0) - window.pageXOffset, s = (w.current?.height ?? 0) - o - (w.current?.top ?? 0) - window.pageYOffset;
|
|
609
700
|
C.current = !0;
|
|
@@ -625,9 +716,16 @@ function Jt({ fs: t, vs: e = ve, textures: r = [], uniforms: n, clearColor: l =
|
|
|
625
716
|
const i = v.current;
|
|
626
717
|
if (!i) return;
|
|
627
718
|
w.current = c.current?.getBoundingClientRect();
|
|
628
|
-
const a = b, o = Math.floor(
|
|
719
|
+
const a = b, o = Math.floor(
|
|
720
|
+
(w.current?.width ?? 1) * a
|
|
721
|
+
), u = Math.floor(
|
|
722
|
+
(w.current?.height ?? 1) * a
|
|
723
|
+
);
|
|
629
724
|
if (i.canvas.width = o, i.canvas.height = u, d.current.iResolution?.isNeeded && m.current) {
|
|
630
|
-
const s = i.getUniformLocation(
|
|
725
|
+
const s = i.getUniformLocation(
|
|
726
|
+
m.current,
|
|
727
|
+
we
|
|
728
|
+
);
|
|
631
729
|
i.uniform2fv(s, [i.canvas.width, i.canvas.height]);
|
|
632
730
|
}
|
|
633
731
|
}, Q = (i, a) => {
|
|
@@ -648,10 +746,19 @@ ${a}`));
|
|
|
648
746
|
const u = Q(o.FRAGMENT_SHADER, i), s = Q(o.VERTEX_SHADER, a);
|
|
649
747
|
if (m.current = o.createProgram(), !(!m.current || !s || !u)) {
|
|
650
748
|
if (o.attachShader(m.current, s), o.attachShader(m.current, u), o.linkProgram(m.current), !o.getProgramParameter(m.current, o.LINK_STATUS)) {
|
|
651
|
-
T?.(
|
|
749
|
+
T?.(
|
|
750
|
+
G(
|
|
751
|
+
`Unable to initialize the shader program: ${o.getProgramInfoLog(
|
|
752
|
+
m.current
|
|
753
|
+
)}`
|
|
754
|
+
)
|
|
755
|
+
);
|
|
652
756
|
return;
|
|
653
757
|
}
|
|
654
|
-
o.useProgram(m.current), R.current = o.getAttribLocation(
|
|
758
|
+
o.useProgram(m.current), R.current = o.getAttribLocation(
|
|
759
|
+
m.current,
|
|
760
|
+
"aVertexPosition"
|
|
761
|
+
), o.enableVertexAttribArray(R.current);
|
|
655
762
|
}
|
|
656
763
|
}, Z = () => {
|
|
657
764
|
if (n)
|
|
@@ -682,12 +789,14 @@ ${a}`));
|
|
|
682
789
|
arraySize: `[${r.length}]`,
|
|
683
790
|
value: []
|
|
684
791
|
};
|
|
685
|
-
const a = r.map(
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
W(
|
|
690
|
-
|
|
792
|
+
const a = r.map(
|
|
793
|
+
(o, u) => (d.current[`${$t}${u}`] = {
|
|
794
|
+
type: "sampler2D",
|
|
795
|
+
isNeeded: !1
|
|
796
|
+
}, W(o, u), F.current[u] = new Kt(i), F.current[u]?.load(o).then((s) => {
|
|
797
|
+
W(s, u);
|
|
798
|
+
}))
|
|
799
|
+
);
|
|
691
800
|
Promise.all(a).then(() => {
|
|
692
801
|
y && y();
|
|
693
802
|
}).catch((o) => {
|
|
@@ -697,15 +806,23 @@ ${a}`));
|
|
|
697
806
|
}, te = (i) => {
|
|
698
807
|
const a = pe.includes(f ?? "highp"), o = `precision ${a ? f : pe[1]} float;
|
|
699
808
|
`;
|
|
700
|
-
a || x?.(
|
|
809
|
+
a || x?.(
|
|
810
|
+
G(
|
|
811
|
+
`wrong precision type ${f}, please make sure to pass one of a valid precision lowp, mediump, highp, by default you shader precision will be set to highp.`
|
|
812
|
+
)
|
|
813
|
+
);
|
|
701
814
|
let u = o.concat(`#define DPR ${b.toFixed(1)}
|
|
702
815
|
`).concat(i.replace(/texture\(/g, "texture2D("));
|
|
703
816
|
for (const p of Object.keys(d.current))
|
|
704
817
|
if (i.includes(p)) {
|
|
705
818
|
const O = d.current[p];
|
|
706
819
|
if (!O) continue;
|
|
707
|
-
u = Qt(
|
|
708
|
-
|
|
820
|
+
u = Qt(
|
|
821
|
+
u,
|
|
822
|
+
`uniform ${O.type} ${p}${O.arraySize || ""};
|
|
823
|
+
`,
|
|
824
|
+
u.lastIndexOf(o) + o.length
|
|
825
|
+
), O.isNeeded = !0;
|
|
709
826
|
}
|
|
710
827
|
return i.includes("mainImage") && (u = u.concat(Xt)), u;
|
|
711
828
|
}, z = (i) => {
|
|
@@ -719,37 +836,72 @@ ${a}`));
|
|
|
719
836
|
const p = u[s];
|
|
720
837
|
if (p && d.current[s]?.isNeeded) {
|
|
721
838
|
if (!m.current) return;
|
|
722
|
-
const O = a.getUniformLocation(
|
|
839
|
+
const O = a.getUniformLocation(
|
|
840
|
+
m.current,
|
|
841
|
+
s
|
|
842
|
+
);
|
|
723
843
|
if (!O) return;
|
|
724
|
-
Wt(
|
|
844
|
+
Wt(
|
|
845
|
+
a,
|
|
846
|
+
O,
|
|
847
|
+
p.type,
|
|
848
|
+
p.value
|
|
849
|
+
);
|
|
725
850
|
}
|
|
726
851
|
}
|
|
727
852
|
if (d.current.iMouse?.isNeeded) {
|
|
728
|
-
const s = a.getUniformLocation(
|
|
853
|
+
const s = a.getUniformLocation(
|
|
854
|
+
m.current,
|
|
855
|
+
Ae
|
|
856
|
+
);
|
|
729
857
|
a.uniform4fv(s, d.current.iMouse.value);
|
|
730
858
|
}
|
|
731
859
|
if (d.current.iChannelResolution?.isNeeded) {
|
|
732
|
-
const s = a.getUniformLocation(
|
|
733
|
-
|
|
860
|
+
const s = a.getUniformLocation(
|
|
861
|
+
m.current,
|
|
862
|
+
Se
|
|
863
|
+
);
|
|
864
|
+
a.uniform3fv(
|
|
865
|
+
s,
|
|
866
|
+
d.current.iChannelResolution.value
|
|
867
|
+
);
|
|
734
868
|
}
|
|
735
869
|
if (d.current.iDeviceOrientation?.isNeeded) {
|
|
736
|
-
const s = a.getUniformLocation(
|
|
737
|
-
|
|
870
|
+
const s = a.getUniformLocation(
|
|
871
|
+
m.current,
|
|
872
|
+
xe
|
|
873
|
+
);
|
|
874
|
+
a.uniform4fv(
|
|
875
|
+
s,
|
|
876
|
+
d.current.iDeviceOrientation.value
|
|
877
|
+
);
|
|
738
878
|
}
|
|
739
879
|
if (d.current.iTime?.isNeeded) {
|
|
740
|
-
const s = a.getUniformLocation(
|
|
880
|
+
const s = a.getUniformLocation(
|
|
881
|
+
m.current,
|
|
882
|
+
ge
|
|
883
|
+
);
|
|
741
884
|
a.uniform1f(s, S.current += o);
|
|
742
885
|
}
|
|
743
886
|
if (d.current.iTimeDelta?.isNeeded) {
|
|
744
|
-
const s = a.getUniformLocation(
|
|
887
|
+
const s = a.getUniformLocation(
|
|
888
|
+
m.current,
|
|
889
|
+
ye
|
|
890
|
+
);
|
|
745
891
|
a.uniform1f(s, o);
|
|
746
892
|
}
|
|
747
893
|
if (d.current.iDate?.isNeeded) {
|
|
748
|
-
const s = /* @__PURE__ */ new Date(), p = s.getMonth() + 1, O = s.getDate(), B = s.getFullYear(), K = s.getHours() * 60 * 60 + s.getMinutes() * 60 + s.getSeconds() + s.getMilliseconds() * 1e-3, ae = a.getUniformLocation(
|
|
894
|
+
const s = /* @__PURE__ */ new Date(), p = s.getMonth() + 1, O = s.getDate(), B = s.getFullYear(), K = s.getHours() * 60 * 60 + s.getMinutes() * 60 + s.getSeconds() + s.getMilliseconds() * 1e-3, ae = a.getUniformLocation(
|
|
895
|
+
m.current,
|
|
896
|
+
Te
|
|
897
|
+
);
|
|
749
898
|
a.uniform4fv(ae, [B, p, O, K]);
|
|
750
899
|
}
|
|
751
900
|
if (d.current.iFrame?.isNeeded) {
|
|
752
|
-
const s = a.getUniformLocation(
|
|
901
|
+
const s = a.getUniformLocation(
|
|
902
|
+
m.current,
|
|
903
|
+
Ee
|
|
904
|
+
), p = d.current.iFrame.value;
|
|
753
905
|
a.uniform1i(s, p), d.current.iFrame.value = p + 1;
|
|
754
906
|
}
|
|
755
907
|
if (F.current.length > 0)
|
|
@@ -760,14 +912,28 @@ ${a}`));
|
|
|
760
912
|
if (!Be || !B || !K) return;
|
|
761
913
|
if (d.current[`iChannel${s}`]?.isNeeded) {
|
|
762
914
|
if (!m.current) return;
|
|
763
|
-
const Ge = a.getUniformLocation(
|
|
764
|
-
|
|
915
|
+
const Ge = a.getUniformLocation(
|
|
916
|
+
m.current,
|
|
917
|
+
`iChannel${s}`
|
|
918
|
+
);
|
|
919
|
+
a.activeTexture(a.TEXTURE0 + s), a.bindTexture(a.TEXTURE_2D, B), a.uniform1i(Ge, s), O && p.updateTexture(
|
|
920
|
+
B,
|
|
921
|
+
K,
|
|
922
|
+
ae
|
|
923
|
+
);
|
|
765
924
|
}
|
|
766
925
|
}
|
|
767
926
|
}, Y = (i) => {
|
|
768
927
|
const a = v.current;
|
|
769
928
|
if (!a) return;
|
|
770
|
-
a.viewport(0, 0, a.drawingBufferWidth, a.drawingBufferHeight), a.clear(a.COLOR_BUFFER_BIT | a.DEPTH_BUFFER_BIT), a.bindBuffer(a.ARRAY_BUFFER, N.current), a.vertexAttribPointer(
|
|
929
|
+
a.viewport(0, 0, a.drawingBufferWidth, a.drawingBufferHeight), a.clear(a.COLOR_BUFFER_BIT | a.DEPTH_BUFFER_BIT), a.bindBuffer(a.ARRAY_BUFFER, N.current), a.vertexAttribPointer(
|
|
930
|
+
R.current ?? 0,
|
|
931
|
+
3,
|
|
932
|
+
a.FLOAT,
|
|
933
|
+
!1,
|
|
934
|
+
0,
|
|
935
|
+
0
|
|
936
|
+
), z(i), a.drawArrays(a.TRIANGLE_STRIP, 0, 4);
|
|
771
937
|
const o = d.current.iMouse?.value;
|
|
772
938
|
if (d.current.iMouse?.isNeeded && g !== 1 && Array.isArray(o)) {
|
|
773
939
|
const u = o[0] ?? 0, s = o[1] ?? 0;
|
|
@@ -775,15 +941,19 @@ ${a}`));
|
|
|
775
941
|
}
|
|
776
942
|
L.current = requestAnimationFrame(Y);
|
|
777
943
|
}, j = () => {
|
|
778
|
-
const i = {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
944
|
+
const i = { passive: !0 };
|
|
945
|
+
d.current.iMouse?.isNeeded && c.current && (c.current.addEventListener("mousemove", U, i), c.current.addEventListener("mouseout", M, i), c.current.addEventListener("mouseup", M, i), c.current.addEventListener("mousedown", H, i), c.current.addEventListener("touchmove", U, i), c.current.addEventListener("touchend", M, i), c.current.addEventListener("touchstart", H, i)), d.current.iDeviceOrientation?.isNeeded && window.addEventListener(
|
|
946
|
+
"deviceorientation",
|
|
947
|
+
oe,
|
|
948
|
+
i
|
|
949
|
+
), c.current && (E.current = new ResizeObserver($), E.current.observe(c.current), window.addEventListener("resize", $, i));
|
|
782
950
|
}, q = () => {
|
|
783
|
-
const i = {
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
951
|
+
const i = { passive: !0 };
|
|
952
|
+
d.current.iMouse?.isNeeded && c.current && (c.current.removeEventListener("mousemove", U, i), c.current.removeEventListener("mouseout", M, i), c.current.removeEventListener("mouseup", M, i), c.current.removeEventListener("mousedown", H, i), c.current.removeEventListener("touchmove", U, i), c.current.removeEventListener("touchend", M, i), c.current.removeEventListener("touchstart", H, i)), d.current.iDeviceOrientation?.isNeeded && window.removeEventListener(
|
|
953
|
+
"deviceorientation",
|
|
954
|
+
oe,
|
|
955
|
+
i
|
|
956
|
+
), E.current && (E.current.disconnect(), window.removeEventListener("resize", $, i));
|
|
787
957
|
};
|
|
788
958
|
return ne(() => {
|
|
789
959
|
P.current = n;
|
|
@@ -804,14 +974,13 @@ ${a}`));
|
|
|
804
974
|
}
|
|
805
975
|
q(), cancelAnimationFrame(L.current ?? 0);
|
|
806
976
|
};
|
|
807
|
-
}, []), X(
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
width: "100%",
|
|
812
|
-
...h
|
|
977
|
+
}, []), /* @__PURE__ */ X(
|
|
978
|
+
"canvas",
|
|
979
|
+
{
|
|
980
|
+
ref: c,
|
|
981
|
+
style: { height: "100%", width: "100%", ...h }
|
|
813
982
|
}
|
|
814
|
-
|
|
983
|
+
);
|
|
815
984
|
}
|
|
816
985
|
const Zt = `
|
|
817
986
|
const float TAU = 6.283185;
|
|
@@ -1069,78 +1238,64 @@ const ar = dt({
|
|
|
1069
1238
|
}
|
|
1070
1239
|
});
|
|
1071
1240
|
function sr(t) {
|
|
1072
|
-
const e = t.match(
|
|
1241
|
+
const e = t.match(
|
|
1242
|
+
/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
1243
|
+
);
|
|
1073
1244
|
if (e) {
|
|
1074
1245
|
const [, r, n, l] = e;
|
|
1075
1246
|
return [r, n, l].map((h = "00") => parseInt(h, 16) / 255);
|
|
1076
1247
|
}
|
|
1077
1248
|
}
|
|
1078
|
-
function Ve({
|
|
1249
|
+
function Ve({
|
|
1250
|
+
shape: t = 1,
|
|
1251
|
+
speed: e = 1,
|
|
1252
|
+
amplitude: r = 0.5,
|
|
1253
|
+
frequency: n = 0.5,
|
|
1254
|
+
scale: l = 0.2,
|
|
1255
|
+
blur: f = 1,
|
|
1256
|
+
color: h = "#FF355E",
|
|
1257
|
+
colorShift: A = 1,
|
|
1258
|
+
brightness: g = 1,
|
|
1259
|
+
themeMode: b = typeof window < "u" && document.documentElement.classList.contains("dark") ? "dark" : "light",
|
|
1260
|
+
ref: y,
|
|
1261
|
+
className: T,
|
|
1262
|
+
...x
|
|
1263
|
+
}) {
|
|
1079
1264
|
const c = Ye(() => sr(h), [h]);
|
|
1080
|
-
return X("div", {
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
...x,
|
|
1084
|
-
children: X(Jt, {
|
|
1265
|
+
return /* @__PURE__ */ X("div", { ref: y, className: T, ...x, children: /* @__PURE__ */ X(
|
|
1266
|
+
Jt,
|
|
1267
|
+
{
|
|
1085
1268
|
fs: Zt,
|
|
1086
1269
|
devicePixelRatio: globalThis.devicePixelRatio ?? 1,
|
|
1087
1270
|
uniforms: {
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
},
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
},
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
},
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
},
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
},
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
},
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
}
|
|
1116
|
-
uMix: {
|
|
1117
|
-
type: "1f",
|
|
1118
|
-
value: g
|
|
1119
|
-
},
|
|
1120
|
-
uSpacing: {
|
|
1121
|
-
type: "1f",
|
|
1122
|
-
value: 0.5
|
|
1123
|
-
},
|
|
1124
|
-
uColorShift: {
|
|
1125
|
-
type: "1f",
|
|
1126
|
-
value: A
|
|
1127
|
-
},
|
|
1128
|
-
uVariance: {
|
|
1129
|
-
type: "1f",
|
|
1130
|
-
value: 0.1
|
|
1131
|
-
},
|
|
1132
|
-
uSmoothing: {
|
|
1133
|
-
type: "1f",
|
|
1134
|
-
value: 1
|
|
1135
|
-
},
|
|
1136
|
-
uMode: {
|
|
1137
|
-
type: "1f",
|
|
1138
|
-
value: b === "light" ? 1 : 0
|
|
1139
|
-
},
|
|
1140
|
-
uColor: {
|
|
1141
|
-
type: "3fv",
|
|
1142
|
-
value: c ?? [0, 0.7, 1]
|
|
1143
|
-
}
|
|
1271
|
+
// Aurora wave speed
|
|
1272
|
+
uSpeed: { type: "1f", value: e },
|
|
1273
|
+
// Edge blur/softness
|
|
1274
|
+
uBlur: { type: "1f", value: f },
|
|
1275
|
+
// Shape scale
|
|
1276
|
+
uScale: { type: "1f", value: l },
|
|
1277
|
+
// Shape type: 1=circle, 2=line
|
|
1278
|
+
uShape: { type: "1f", value: t },
|
|
1279
|
+
// Wave frequency and complexity
|
|
1280
|
+
uFrequency: { type: "1f", value: n },
|
|
1281
|
+
// Turbulence amplitude
|
|
1282
|
+
uAmplitude: { type: "1f", value: r },
|
|
1283
|
+
// Light intensity (bloom)
|
|
1284
|
+
uBloom: { type: "1f", value: 0 },
|
|
1285
|
+
// Brightness of the aurora (0-1)
|
|
1286
|
+
uMix: { type: "1f", value: g },
|
|
1287
|
+
// Color variation across layers (0-1)
|
|
1288
|
+
uSpacing: { type: "1f", value: 0.5 },
|
|
1289
|
+
// Color palette offset - shifts colors along the gradient (0-1)
|
|
1290
|
+
uColorShift: { type: "1f", value: A },
|
|
1291
|
+
// Color variation across layers (0-1)
|
|
1292
|
+
uVariance: { type: "1f", value: 0.1 },
|
|
1293
|
+
// Smoothing of the aurora (0-1)
|
|
1294
|
+
uSmoothing: { type: "1f", value: 1 },
|
|
1295
|
+
// Display mode: 0=dark background, 1=light background
|
|
1296
|
+
uMode: { type: "1f", value: b === "light" ? 1 : 0 },
|
|
1297
|
+
// Color
|
|
1298
|
+
uColor: { type: "3fv", value: c ?? [0, 0.7, 1] }
|
|
1144
1299
|
},
|
|
1145
1300
|
onError: (v) => {
|
|
1146
1301
|
console.error("Shader error:", v);
|
|
@@ -1148,55 +1303,77 @@ function Ve({ shape: t = 1, speed: e = 1, amplitude: r = 0.5, frequency: n = 0.5
|
|
|
1148
1303
|
onWarning: (v) => {
|
|
1149
1304
|
console.warn("Shader warning:", v);
|
|
1150
1305
|
},
|
|
1151
|
-
style: {
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
}
|
|
1155
|
-
})
|
|
1156
|
-
});
|
|
1306
|
+
style: { width: "100%", height: "100%" }
|
|
1307
|
+
}
|
|
1308
|
+
) });
|
|
1157
1309
|
}
|
|
1158
1310
|
Ve.displayName = "AuraShader";
|
|
1159
|
-
function gr({
|
|
1311
|
+
function gr({
|
|
1312
|
+
size: t = "lg",
|
|
1313
|
+
state: e,
|
|
1314
|
+
color: r,
|
|
1315
|
+
colorShift: n = 0.05,
|
|
1316
|
+
audioTrack: l,
|
|
1317
|
+
themeMode: f,
|
|
1318
|
+
className: h,
|
|
1319
|
+
ref: A,
|
|
1320
|
+
...g
|
|
1321
|
+
}) {
|
|
1160
1322
|
const { speed: b, scale: y, amplitude: T, frequency: x, brightness: c } = or(e, l);
|
|
1161
|
-
return X(
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1323
|
+
return /* @__PURE__ */ X(
|
|
1324
|
+
Ve,
|
|
1325
|
+
{
|
|
1326
|
+
ref: A,
|
|
1327
|
+
blur: 0.2,
|
|
1328
|
+
color: r,
|
|
1329
|
+
colorShift: n,
|
|
1330
|
+
speed: b,
|
|
1331
|
+
scale: y,
|
|
1332
|
+
themeMode: f,
|
|
1333
|
+
amplitude: T,
|
|
1334
|
+
frequency: x,
|
|
1335
|
+
brightness: c,
|
|
1336
|
+
className: mt(
|
|
1337
|
+
ar({ size: t }),
|
|
1338
|
+
"overflow-hidden rounded-full",
|
|
1339
|
+
h
|
|
1340
|
+
),
|
|
1341
|
+
...g
|
|
1342
|
+
}
|
|
1343
|
+
);
|
|
1177
1344
|
}
|
|
1178
|
-
const yr = ({
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1345
|
+
const yr = ({
|
|
1346
|
+
text: t,
|
|
1347
|
+
confirmationText: e,
|
|
1348
|
+
onConfirm: r,
|
|
1349
|
+
cancelText: n,
|
|
1350
|
+
onCancel: l
|
|
1351
|
+
}) => /* @__PURE__ */ le("div", { className: "flex flex-col gap-2", children: [
|
|
1352
|
+
t && /* @__PURE__ */ X("p", { children: t }),
|
|
1353
|
+
/* @__PURE__ */ le("div", { className: "flex gap-2", children: [
|
|
1354
|
+
/* @__PURE__ */ X(
|
|
1355
|
+
fe,
|
|
1356
|
+
{
|
|
1357
|
+
type: "button",
|
|
1358
|
+
variant: "outline",
|
|
1359
|
+
size: "sm",
|
|
1360
|
+
icon: ht,
|
|
1361
|
+
onClick: r,
|
|
1362
|
+
label: e
|
|
1363
|
+
}
|
|
1364
|
+
),
|
|
1365
|
+
/* @__PURE__ */ X(
|
|
1366
|
+
fe,
|
|
1367
|
+
{
|
|
1368
|
+
type: "button",
|
|
1369
|
+
variant: "ghost",
|
|
1370
|
+
size: "sm",
|
|
1371
|
+
onClick: l,
|
|
1372
|
+
label: n
|
|
1373
|
+
}
|
|
1374
|
+
)
|
|
1375
|
+
] })
|
|
1376
|
+
] });
|
|
1200
1377
|
export {
|
|
1201
1378
|
pr as A,
|
|
1202
1379
|
gr as F,
|