@cuekit-ai/react 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -11
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +716 -160
- package/dist/index.mjs +712 -160
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -174,10 +174,22 @@ var ttsManager = new TtsManager();
|
|
|
174
174
|
|
|
175
175
|
// src/core/navigation.ts
|
|
176
176
|
var navigation;
|
|
177
|
+
var navigationHandler = null;
|
|
177
178
|
var setNavigator = (navigator2) => {
|
|
178
179
|
navigation = navigator2;
|
|
179
180
|
};
|
|
181
|
+
var setNavigationHandler = (handler) => {
|
|
182
|
+
navigationHandler = handler;
|
|
183
|
+
};
|
|
180
184
|
var navigate = (path, params) => {
|
|
185
|
+
if (navigationHandler) {
|
|
186
|
+
try {
|
|
187
|
+
navigationHandler(path, params);
|
|
188
|
+
return;
|
|
189
|
+
} catch (error) {
|
|
190
|
+
console.error("[CueKit] navigation handler failed, falling back to default:", error);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
181
193
|
let fullPath = path;
|
|
182
194
|
if (params) {
|
|
183
195
|
const searchParams = new URLSearchParams(params).toString();
|
|
@@ -188,16 +200,17 @@ var navigate = (path, params) => {
|
|
|
188
200
|
if (navigation) {
|
|
189
201
|
navigation.push(fullPath);
|
|
190
202
|
} else {
|
|
191
|
-
window
|
|
203
|
+
if (typeof window !== "undefined") {
|
|
204
|
+
window.location.href = fullPath;
|
|
205
|
+
}
|
|
192
206
|
}
|
|
193
207
|
};
|
|
194
208
|
var getCurrentPath = () => {
|
|
209
|
+
if (typeof window === "undefined") return "";
|
|
195
210
|
return window.location.pathname;
|
|
196
211
|
};
|
|
197
212
|
var getSearchParams = () => {
|
|
198
|
-
if (
|
|
199
|
-
return navigation.query;
|
|
200
|
-
}
|
|
213
|
+
if (typeof window === "undefined") return new URLSearchParams();
|
|
201
214
|
return new URLSearchParams(window.location.search);
|
|
202
215
|
};
|
|
203
216
|
var safeNavigate = (name, params = {}) => {
|
|
@@ -245,6 +258,7 @@ function onStateChange() {
|
|
|
245
258
|
}
|
|
246
259
|
var handleNavigationAndClick = (routeName, elementHash) => {
|
|
247
260
|
safeNavigate(routeName);
|
|
261
|
+
if (typeof MutationObserver === "undefined" || typeof document === "undefined") return;
|
|
248
262
|
const observer = new MutationObserver((mutationsList, observer2) => {
|
|
249
263
|
const elements = flushCapturedElements();
|
|
250
264
|
const elementToClick = elements.find((el) => el.elementId === elementHash);
|
|
@@ -292,17 +306,14 @@ var processVoice = async (transcript, apiKey, appId, deviceId) => {
|
|
|
292
306
|
};
|
|
293
307
|
console.log("body", body);
|
|
294
308
|
try {
|
|
295
|
-
const response = await fetch(
|
|
296
|
-
|
|
297
|
-
{
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
body: JSON.stringify(body)
|
|
304
|
-
}
|
|
305
|
-
);
|
|
309
|
+
const response = await fetch(`https://api.cuekit.ai/components/app/${appId}/app-intents`, {
|
|
310
|
+
method: "POST",
|
|
311
|
+
headers: {
|
|
312
|
+
"Content-Type": "application/json",
|
|
313
|
+
"X-API-Key": apiKey ?? ""
|
|
314
|
+
},
|
|
315
|
+
body: JSON.stringify(body)
|
|
316
|
+
});
|
|
306
317
|
const data = await response.json();
|
|
307
318
|
if (!response.ok) {
|
|
308
319
|
console.log("Response Status:", response.status);
|
|
@@ -377,11 +388,8 @@ var _apiKey = "";
|
|
|
377
388
|
var setApiKey = (key) => _apiKey = key;
|
|
378
389
|
|
|
379
390
|
// src/core/init.ts
|
|
380
|
-
function InitCuekit(apiKey
|
|
391
|
+
function InitCuekit(apiKey) {
|
|
381
392
|
setApiKey(apiKey);
|
|
382
|
-
if (navigator2) {
|
|
383
|
-
setNavigator(navigator2);
|
|
384
|
-
}
|
|
385
393
|
}
|
|
386
394
|
|
|
387
395
|
// src/Provider/CuekitProvider.tsx
|
|
@@ -403,27 +411,40 @@ var QubeContext = createContext({
|
|
|
403
411
|
appId: ""
|
|
404
412
|
});
|
|
405
413
|
var getUniqueId = () => {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
414
|
+
if (typeof window === "undefined") {
|
|
415
|
+
return "server-" + Date.now().toString(36);
|
|
416
|
+
}
|
|
417
|
+
try {
|
|
418
|
+
let id = localStorage.getItem("cuekit_device_id");
|
|
419
|
+
if (!id) {
|
|
420
|
+
id = Date.now().toString(36) + Math.random().toString(36).substring(2);
|
|
421
|
+
localStorage.setItem("cuekit_device_id", id);
|
|
422
|
+
}
|
|
423
|
+
return id;
|
|
424
|
+
} catch {
|
|
425
|
+
return "anon-" + Date.now().toString(36);
|
|
410
426
|
}
|
|
411
|
-
return id;
|
|
412
427
|
};
|
|
413
428
|
var CuekitProvider = ({
|
|
414
429
|
apiKey,
|
|
415
430
|
deviceId = "",
|
|
416
431
|
appId,
|
|
417
432
|
children,
|
|
418
|
-
|
|
433
|
+
navigationHandler: navigationHandler2
|
|
419
434
|
}) => {
|
|
420
435
|
const [internalDeviceId, setInternalDeviceId] = useState(deviceId);
|
|
421
436
|
useEffect(() => {
|
|
422
|
-
InitCuekit(apiKey
|
|
423
|
-
}, [apiKey
|
|
437
|
+
InitCuekit(apiKey);
|
|
438
|
+
}, [apiKey]);
|
|
439
|
+
useEffect(() => {
|
|
440
|
+
setNavigationHandler(navigationHandler2 ?? null);
|
|
441
|
+
return () => {
|
|
442
|
+
setNavigationHandler(null);
|
|
443
|
+
};
|
|
444
|
+
}, [navigationHandler2]);
|
|
424
445
|
useEffect(() => {
|
|
425
446
|
const updateGlobalStore = (id) => {
|
|
426
|
-
if (globalThis.CuekitStore) {
|
|
447
|
+
if (typeof window !== "undefined" && globalThis.CuekitStore) {
|
|
427
448
|
globalThis.CuekitStore.update({
|
|
428
449
|
apiKey,
|
|
429
450
|
appId,
|
|
@@ -454,16 +475,24 @@ var CuekitProvider = ({
|
|
|
454
475
|
GlobalStore.clearData("transcript");
|
|
455
476
|
}
|
|
456
477
|
};
|
|
457
|
-
window
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
478
|
+
if (typeof window !== "undefined") {
|
|
479
|
+
window.addEventListener("popstate", handleRouteChange);
|
|
480
|
+
}
|
|
481
|
+
const originalPushState = typeof history !== "undefined" ? history.pushState : void 0;
|
|
482
|
+
if (originalPushState) {
|
|
483
|
+
history.pushState = function(...args) {
|
|
484
|
+
originalPushState.apply(this, args);
|
|
485
|
+
handleRouteChange();
|
|
486
|
+
};
|
|
487
|
+
}
|
|
463
488
|
handleRouteChange();
|
|
464
489
|
return () => {
|
|
465
|
-
window
|
|
466
|
-
|
|
490
|
+
if (typeof window !== "undefined") {
|
|
491
|
+
window.removeEventListener("popstate", handleRouteChange);
|
|
492
|
+
}
|
|
493
|
+
if (originalPushState) {
|
|
494
|
+
history.pushState = originalPushState;
|
|
495
|
+
}
|
|
467
496
|
};
|
|
468
497
|
}, [apiKey, appId, internalDeviceId]);
|
|
469
498
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -547,8 +576,8 @@ import { useState as useState3, useCallback as useCallback3 } from "react";
|
|
|
547
576
|
|
|
548
577
|
// src/hook/useVoiceRecognition.ts
|
|
549
578
|
import { useState as useState2, useEffect as useEffect3, useCallback as useCallback2, useRef as useRef2 } from "react";
|
|
550
|
-
var
|
|
551
|
-
var recognition =
|
|
579
|
+
var SpeechRecognitionCtor = typeof window !== "undefined" ? window.SpeechRecognition || window.webkitSpeechRecognition : null;
|
|
580
|
+
var recognition = SpeechRecognitionCtor ? new SpeechRecognitionCtor() : null;
|
|
552
581
|
if (recognition) {
|
|
553
582
|
recognition.continuous = true;
|
|
554
583
|
recognition.interimResults = true;
|
|
@@ -655,10 +684,14 @@ var TtsManager2 = class {
|
|
|
655
684
|
return;
|
|
656
685
|
}
|
|
657
686
|
console.log("\u{1F508} Speaking:", text);
|
|
658
|
-
window
|
|
687
|
+
if (typeof window !== "undefined") {
|
|
688
|
+
window.speechSynthesis.cancel();
|
|
689
|
+
}
|
|
659
690
|
this.utterance.text = text;
|
|
660
691
|
this.onEndCallback = onEnd || null;
|
|
661
|
-
window
|
|
692
|
+
if (typeof window !== "undefined") {
|
|
693
|
+
window.speechSynthesis.speak(this.utterance);
|
|
694
|
+
}
|
|
662
695
|
}
|
|
663
696
|
stop() {
|
|
664
697
|
if (typeof window !== "undefined" && "speechSynthesis" in window) {
|
|
@@ -719,7 +752,140 @@ import { Mic, Loader2, Volume2, X, Sparkles } from "lucide-react";
|
|
|
719
752
|
import React2 from "react";
|
|
720
753
|
var BorderGlow = ({ isActive }) => {
|
|
721
754
|
if (!isActive) return null;
|
|
722
|
-
|
|
755
|
+
const styles = {
|
|
756
|
+
container: {
|
|
757
|
+
position: "fixed",
|
|
758
|
+
top: 0,
|
|
759
|
+
left: 0,
|
|
760
|
+
right: 0,
|
|
761
|
+
bottom: 0,
|
|
762
|
+
pointerEvents: "none",
|
|
763
|
+
zIndex: 1e4,
|
|
764
|
+
overflow: "hidden"
|
|
765
|
+
},
|
|
766
|
+
rightBorder1: {
|
|
767
|
+
position: "absolute",
|
|
768
|
+
top: 0,
|
|
769
|
+
right: 0,
|
|
770
|
+
bottom: 0,
|
|
771
|
+
width: "4px",
|
|
772
|
+
background: "linear-gradient(to bottom, #06b6d4, #3b82f6, #2563eb)",
|
|
773
|
+
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
774
|
+
opacity: 0.8
|
|
775
|
+
},
|
|
776
|
+
rightBorder2: {
|
|
777
|
+
position: "absolute",
|
|
778
|
+
top: 0,
|
|
779
|
+
right: 0,
|
|
780
|
+
bottom: 0,
|
|
781
|
+
width: "8px",
|
|
782
|
+
background: "linear-gradient(to bottom, #22d3ee, #3b82f6, #3b82f6)",
|
|
783
|
+
filter: "blur(4px)",
|
|
784
|
+
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
785
|
+
opacity: 0.6
|
|
786
|
+
},
|
|
787
|
+
rightBorder3: {
|
|
788
|
+
position: "absolute",
|
|
789
|
+
top: 0,
|
|
790
|
+
right: 0,
|
|
791
|
+
bottom: 0,
|
|
792
|
+
width: "16px",
|
|
793
|
+
background: "linear-gradient(to bottom, #67e8f9, #3b82f6, #60a5fa)",
|
|
794
|
+
filter: "blur(12px)",
|
|
795
|
+
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
796
|
+
opacity: 0.4
|
|
797
|
+
},
|
|
798
|
+
leftBorder1: {
|
|
799
|
+
position: "absolute",
|
|
800
|
+
top: 0,
|
|
801
|
+
left: 0,
|
|
802
|
+
bottom: 0,
|
|
803
|
+
width: "4px",
|
|
804
|
+
background: "linear-gradient(to bottom, #f59e0b, #3b82f6, #2563eb)",
|
|
805
|
+
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
806
|
+
opacity: 0.8
|
|
807
|
+
},
|
|
808
|
+
leftBorder2: {
|
|
809
|
+
position: "absolute",
|
|
810
|
+
top: 0,
|
|
811
|
+
left: 0,
|
|
812
|
+
bottom: 0,
|
|
813
|
+
width: "8px",
|
|
814
|
+
background: "linear-gradient(to bottom, #f59e0b, #3b82f6, #3b82f6)",
|
|
815
|
+
filter: "blur(4px)",
|
|
816
|
+
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
817
|
+
opacity: 0.6
|
|
818
|
+
},
|
|
819
|
+
leftBorder3: {
|
|
820
|
+
position: "absolute",
|
|
821
|
+
top: 0,
|
|
822
|
+
left: 0,
|
|
823
|
+
bottom: 0,
|
|
824
|
+
width: "16px",
|
|
825
|
+
background: "linear-gradient(to bottom, #f59e0b, #3b82f6, #60a5fa)",
|
|
826
|
+
filter: "blur(12px)",
|
|
827
|
+
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
828
|
+
opacity: 0.4
|
|
829
|
+
},
|
|
830
|
+
cornerTopLeft: {
|
|
831
|
+
position: "absolute",
|
|
832
|
+
top: 0,
|
|
833
|
+
left: 0,
|
|
834
|
+
width: "32px",
|
|
835
|
+
height: "32px",
|
|
836
|
+
background: "#f59e0b",
|
|
837
|
+
borderBottomRightRadius: "50%",
|
|
838
|
+
filter: "blur(16px)",
|
|
839
|
+
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
840
|
+
opacity: 0.6
|
|
841
|
+
},
|
|
842
|
+
cornerTopRight: {
|
|
843
|
+
position: "absolute",
|
|
844
|
+
top: 0,
|
|
845
|
+
right: 0,
|
|
846
|
+
width: "32px",
|
|
847
|
+
height: "32px",
|
|
848
|
+
background: "#06b6d4",
|
|
849
|
+
borderBottomLeftRadius: "50%",
|
|
850
|
+
filter: "blur(16px)",
|
|
851
|
+
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
852
|
+
opacity: 0.6
|
|
853
|
+
},
|
|
854
|
+
cornerBottomRight: {
|
|
855
|
+
position: "absolute",
|
|
856
|
+
bottom: 0,
|
|
857
|
+
right: 0,
|
|
858
|
+
width: "32px",
|
|
859
|
+
height: "32px",
|
|
860
|
+
background: "#3b82f6",
|
|
861
|
+
borderTopLeftRadius: "50%",
|
|
862
|
+
filter: "blur(16px)",
|
|
863
|
+
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
864
|
+
opacity: 0.6
|
|
865
|
+
},
|
|
866
|
+
cornerBottomLeft: {
|
|
867
|
+
position: "absolute",
|
|
868
|
+
bottom: 0,
|
|
869
|
+
left: 0,
|
|
870
|
+
width: "32px",
|
|
871
|
+
height: "32px",
|
|
872
|
+
background: "#2563eb",
|
|
873
|
+
borderTopRightRadius: "50%",
|
|
874
|
+
filter: "blur(16px)",
|
|
875
|
+
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
876
|
+
opacity: 0.6
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("style", null, `
|
|
880
|
+
@keyframes borderPulse {
|
|
881
|
+
0%, 100% {
|
|
882
|
+
opacity: 1;
|
|
883
|
+
}
|
|
884
|
+
50% {
|
|
885
|
+
opacity: 0.5;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
`), /* @__PURE__ */ React2.createElement("div", { style: styles.container }, /* @__PURE__ */ React2.createElement("div", { style: styles.rightBorder1 }), /* @__PURE__ */ React2.createElement("div", { style: styles.rightBorder2 }), /* @__PURE__ */ React2.createElement("div", { style: styles.rightBorder3 }), /* @__PURE__ */ React2.createElement("div", { style: styles.leftBorder1 }), /* @__PURE__ */ React2.createElement("div", { style: styles.leftBorder2 }), /* @__PURE__ */ React2.createElement("div", { style: styles.leftBorder3 }), /* @__PURE__ */ React2.createElement("div", { style: styles.cornerTopLeft }), /* @__PURE__ */ React2.createElement("div", { style: styles.cornerTopRight }), /* @__PURE__ */ React2.createElement("div", { style: styles.cornerBottomRight }), /* @__PURE__ */ React2.createElement("div", { style: styles.cornerBottomLeft })));
|
|
723
889
|
};
|
|
724
890
|
var BorderGlow_default = BorderGlow;
|
|
725
891
|
|
|
@@ -746,6 +912,10 @@ if (typeof document !== "undefined") {
|
|
|
746
912
|
0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
|
|
747
913
|
50% { transform: none; animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
|
|
748
914
|
}
|
|
915
|
+
@keyframes spin {
|
|
916
|
+
from { transform: rotate(0deg); }
|
|
917
|
+
to { transform: rotate(360deg); }
|
|
918
|
+
}
|
|
749
919
|
`;
|
|
750
920
|
if (!document.head.querySelector("style[data-mic-button-animations]")) {
|
|
751
921
|
style.setAttribute("data-mic-button-animations", "true");
|
|
@@ -753,34 +923,69 @@ if (typeof document !== "undefined") {
|
|
|
753
923
|
}
|
|
754
924
|
}
|
|
755
925
|
var WaveAnimation = () => {
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
926
|
+
const waveStyles = {
|
|
927
|
+
container: {
|
|
928
|
+
position: "absolute",
|
|
929
|
+
top: 0,
|
|
930
|
+
left: 0,
|
|
931
|
+
right: 0,
|
|
932
|
+
bottom: 0,
|
|
933
|
+
display: "flex",
|
|
934
|
+
alignItems: "center",
|
|
935
|
+
justifyContent: "center",
|
|
936
|
+
pointerEvents: "none"
|
|
937
|
+
},
|
|
938
|
+
innerContainer: {
|
|
939
|
+
position: "absolute",
|
|
940
|
+
top: 0,
|
|
941
|
+
left: 0,
|
|
942
|
+
right: 0,
|
|
943
|
+
bottom: 0,
|
|
944
|
+
display: "flex",
|
|
945
|
+
alignItems: "center",
|
|
946
|
+
justifyContent: "center"
|
|
947
|
+
},
|
|
948
|
+
wave1: {
|
|
949
|
+
position: "absolute",
|
|
950
|
+
width: "96px",
|
|
951
|
+
// w-24
|
|
952
|
+
height: "96px",
|
|
953
|
+
// h-24
|
|
954
|
+
borderRadius: "50%",
|
|
955
|
+
border: "2px solid #3b82f6",
|
|
956
|
+
// border-blue-500
|
|
957
|
+
opacity: 0.4,
|
|
958
|
+
animationDelay: "0s",
|
|
959
|
+
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
|
|
960
|
+
},
|
|
961
|
+
wave2: {
|
|
962
|
+
position: "absolute",
|
|
963
|
+
width: "128px",
|
|
964
|
+
// w-32
|
|
965
|
+
height: "128px",
|
|
966
|
+
// h-32
|
|
967
|
+
borderRadius: "50%",
|
|
968
|
+
border: "2px solid #22d3ee",
|
|
969
|
+
// border-cyan-400
|
|
970
|
+
opacity: 0.3,
|
|
971
|
+
animationDelay: "0.5s",
|
|
972
|
+
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
|
|
973
|
+
},
|
|
974
|
+
wave3: {
|
|
975
|
+
position: "absolute",
|
|
976
|
+
width: "160px",
|
|
977
|
+
// w-40
|
|
978
|
+
height: "160px",
|
|
979
|
+
// h-40
|
|
980
|
+
borderRadius: "50%",
|
|
981
|
+
border: "2px solid #c084fc",
|
|
982
|
+
// border-purple-400
|
|
983
|
+
opacity: 0.2,
|
|
984
|
+
animationDelay: "1s",
|
|
985
|
+
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
|
|
782
986
|
}
|
|
783
|
-
|
|
987
|
+
};
|
|
988
|
+
return /* @__PURE__ */ React3.createElement("div", { style: waveStyles.container }, /* @__PURE__ */ React3.createElement("div", { style: waveStyles.innerContainer }, /* @__PURE__ */ React3.createElement("div", { style: waveStyles.wave1 }), /* @__PURE__ */ React3.createElement("div", { style: waveStyles.wave2 }), /* @__PURE__ */ React3.createElement("div", { style: waveStyles.wave3 })));
|
|
784
989
|
};
|
|
785
990
|
var UnifiedModal = ({
|
|
786
991
|
text,
|
|
@@ -826,87 +1031,318 @@ var UnifiedModal = ({
|
|
|
826
1031
|
if (!isVisible) return null;
|
|
827
1032
|
const isSpeechMode = mode === "speech";
|
|
828
1033
|
const isComplete = currentWordIndex >= (text?.split(" ").length || 0) - 1;
|
|
829
|
-
|
|
1034
|
+
const modalStyles = {
|
|
1035
|
+
container: {
|
|
1036
|
+
position: "fixed",
|
|
1037
|
+
left: 0,
|
|
1038
|
+
right: 0,
|
|
1039
|
+
bottom: 0,
|
|
1040
|
+
zIndex: 5e5,
|
|
1041
|
+
display: "flex",
|
|
1042
|
+
alignItems: "flex-end",
|
|
1043
|
+
justifyContent: "center"
|
|
1044
|
+
},
|
|
1045
|
+
overlay: {
|
|
1046
|
+
position: "fixed",
|
|
1047
|
+
top: 0,
|
|
1048
|
+
left: 0,
|
|
1049
|
+
right: 0,
|
|
1050
|
+
bottom: 0,
|
|
1051
|
+
backgroundColor: "rgba(0, 0, 0, 0.2)",
|
|
1052
|
+
cursor: "pointer"
|
|
1053
|
+
},
|
|
1054
|
+
modalContainer: {
|
|
1055
|
+
position: "relative",
|
|
1056
|
+
width: "100%",
|
|
1057
|
+
maxWidth: "384px",
|
|
1058
|
+
// max-w-sm
|
|
1059
|
+
margin: "0 auto",
|
|
1060
|
+
height: "30vh",
|
|
1061
|
+
animation: "slideUp 0.3s ease-out forwards",
|
|
1062
|
+
transform: "translateY(100%)"
|
|
1063
|
+
},
|
|
1064
|
+
orbTop: {
|
|
1065
|
+
position: "absolute",
|
|
1066
|
+
top: "-16px",
|
|
1067
|
+
right: "-16px",
|
|
1068
|
+
width: "64px",
|
|
1069
|
+
// w-16
|
|
1070
|
+
height: "64px",
|
|
1071
|
+
// h-16
|
|
1072
|
+
background: "linear-gradient(to bottom right, rgba(59, 130, 246, 0.4), rgba(59, 130, 246, 0.2))",
|
|
1073
|
+
borderRadius: "50%",
|
|
1074
|
+
filter: "blur(24px)",
|
|
1075
|
+
// blur-xl
|
|
1076
|
+
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
|
|
1077
|
+
},
|
|
1078
|
+
orbBottom: {
|
|
1079
|
+
position: "absolute",
|
|
1080
|
+
bottom: "-16px",
|
|
1081
|
+
left: "-16px",
|
|
1082
|
+
width: "48px",
|
|
1083
|
+
// w-12
|
|
1084
|
+
height: "48px",
|
|
1085
|
+
// h-12
|
|
1086
|
+
background: "linear-gradient(to bottom right, rgba(59, 130, 246, 0.3), rgba(59, 130, 246, 0.1))",
|
|
1087
|
+
borderRadius: "50%",
|
|
1088
|
+
filter: "blur(16px)",
|
|
1089
|
+
// blur-lg
|
|
1090
|
+
animationDelay: "1s",
|
|
1091
|
+
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
return /* @__PURE__ */ React3.createElement("div", { style: modalStyles.container }, /* @__PURE__ */ React3.createElement("div", { style: modalStyles.overlay, onClick: onClose }), /* @__PURE__ */ React3.createElement("div", { style: modalStyles.modalContainer }, /* @__PURE__ */ React3.createElement("div", { style: modalStyles.orbTop }), /* @__PURE__ */ React3.createElement("div", { style: modalStyles.orbBottom }), /* @__PURE__ */ React3.createElement(
|
|
830
1095
|
"div",
|
|
831
1096
|
{
|
|
832
|
-
className: "relative w-full max-w-sm mx-auto",
|
|
833
1097
|
style: {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
1098
|
+
position: "relative",
|
|
1099
|
+
backgroundColor: "white",
|
|
1100
|
+
borderTopLeftRadius: "24px",
|
|
1101
|
+
borderTopRightRadius: "24px",
|
|
1102
|
+
borderTop: "1px solid rgba(59, 130, 246, 0.3)",
|
|
1103
|
+
borderLeft: "1px solid rgba(59, 130, 246, 0.3)",
|
|
1104
|
+
borderRight: "1px solid rgba(59, 130, 246, 0.3)",
|
|
1105
|
+
boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
|
|
1106
|
+
height: "100%",
|
|
1107
|
+
display: "flex",
|
|
1108
|
+
flexDirection: "column",
|
|
1109
|
+
overflow: "hidden"
|
|
837
1110
|
}
|
|
838
1111
|
},
|
|
839
1112
|
/* @__PURE__ */ React3.createElement(
|
|
840
1113
|
"div",
|
|
841
1114
|
{
|
|
842
|
-
className: "absolute -top-4 -right-4 w-16 h-16 bg-gradient-to-br from-blue-500/40 to-blue-500/20 rounded-full blur-xl",
|
|
843
|
-
style: { animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite" }
|
|
844
|
-
}
|
|
845
|
-
),
|
|
846
|
-
/* @__PURE__ */ React3.createElement(
|
|
847
|
-
"div",
|
|
848
|
-
{
|
|
849
|
-
className: "absolute -bottom-4 -left-4 w-12 h-12 bg-gradient-to-br from-blue-500/30 to-blue-500/10 rounded-full blur-lg",
|
|
850
1115
|
style: {
|
|
851
|
-
|
|
852
|
-
|
|
1116
|
+
position: "relative",
|
|
1117
|
+
background: "linear-gradient(to right, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05), rgba(59, 130, 246, 0.1))",
|
|
1118
|
+
padding: "16px",
|
|
1119
|
+
borderBottom: "1px solid rgba(59, 130, 246, 0.2)",
|
|
1120
|
+
flexShrink: 0
|
|
853
1121
|
}
|
|
854
|
-
}
|
|
1122
|
+
},
|
|
1123
|
+
/* @__PURE__ */ React3.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" } }, /* @__PURE__ */ React3.createElement("div", { style: { display: "flex", alignItems: "center", gap: "12px" } }, /* @__PURE__ */ React3.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ React3.createElement(
|
|
1124
|
+
"div",
|
|
1125
|
+
{
|
|
1126
|
+
style: {
|
|
1127
|
+
width: "32px",
|
|
1128
|
+
height: "32px",
|
|
1129
|
+
background: "linear-gradient(to bottom right, #3b82f6, #3b82f6)",
|
|
1130
|
+
borderRadius: "12px",
|
|
1131
|
+
display: "flex",
|
|
1132
|
+
alignItems: "center",
|
|
1133
|
+
justifyContent: "center",
|
|
1134
|
+
boxShadow: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"
|
|
1135
|
+
}
|
|
1136
|
+
},
|
|
1137
|
+
isSpeechMode ? /* @__PURE__ */ React3.createElement(Mic, { style: { width: "16px", height: "16px", color: "white" } }) : /* @__PURE__ */ React3.createElement(Sparkles, { style: { width: "16px", height: "16px", color: "white" } })
|
|
1138
|
+
), /* @__PURE__ */ React3.createElement(
|
|
1139
|
+
"div",
|
|
1140
|
+
{
|
|
1141
|
+
style: {
|
|
1142
|
+
position: "absolute",
|
|
1143
|
+
top: "-4px",
|
|
1144
|
+
left: "-4px",
|
|
1145
|
+
right: "-4px",
|
|
1146
|
+
bottom: "-4px",
|
|
1147
|
+
background: "linear-gradient(to bottom right, #3b82f6, #3b82f6)",
|
|
1148
|
+
borderRadius: "12px",
|
|
1149
|
+
opacity: 0.3,
|
|
1150
|
+
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
)), /* @__PURE__ */ React3.createElement("div", null, /* @__PURE__ */ React3.createElement(
|
|
1154
|
+
"h3",
|
|
1155
|
+
{
|
|
1156
|
+
style: {
|
|
1157
|
+
fontSize: "16px",
|
|
1158
|
+
fontWeight: "600",
|
|
1159
|
+
color: "#1f2937",
|
|
1160
|
+
margin: 0
|
|
1161
|
+
}
|
|
1162
|
+
},
|
|
1163
|
+
isSpeechMode ? "Voice Input" : "AI Assistant"
|
|
1164
|
+
), /* @__PURE__ */ React3.createElement(
|
|
1165
|
+
"div",
|
|
1166
|
+
{
|
|
1167
|
+
style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }
|
|
1168
|
+
},
|
|
1169
|
+
isSpeechMode ? /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("div", { style: { display: "flex", gap: "4px" } }, /* @__PURE__ */ React3.createElement(
|
|
1170
|
+
"div",
|
|
1171
|
+
{
|
|
1172
|
+
style: {
|
|
1173
|
+
width: "4px",
|
|
1174
|
+
height: "4px",
|
|
1175
|
+
backgroundColor: "#3b82f6",
|
|
1176
|
+
borderRadius: "50%",
|
|
1177
|
+
animationDelay: "0ms",
|
|
1178
|
+
animation: "bounce 1s infinite"
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
), /* @__PURE__ */ React3.createElement(
|
|
1182
|
+
"div",
|
|
1183
|
+
{
|
|
1184
|
+
style: {
|
|
1185
|
+
width: "4px",
|
|
1186
|
+
height: "4px",
|
|
1187
|
+
backgroundColor: "#3b82f6",
|
|
1188
|
+
borderRadius: "50%",
|
|
1189
|
+
animationDelay: "150ms",
|
|
1190
|
+
animation: "bounce 1s infinite"
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
), /* @__PURE__ */ React3.createElement(
|
|
1194
|
+
"div",
|
|
1195
|
+
{
|
|
1196
|
+
style: {
|
|
1197
|
+
width: "4px",
|
|
1198
|
+
height: "4px",
|
|
1199
|
+
backgroundColor: "#3b82f6",
|
|
1200
|
+
borderRadius: "50%",
|
|
1201
|
+
animationDelay: "300ms",
|
|
1202
|
+
animation: "bounce 1s infinite"
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
)), /* @__PURE__ */ React3.createElement("span", { style: { fontSize: "12px", color: "#4b5563" } }, "Listening...")) : /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(Volume2, { style: { width: "12px", height: "12px", color: "#3b82f6" } }), /* @__PURE__ */ React3.createElement("span", { style: { fontSize: "12px", color: "#4b5563" } }, "Speaking..."))
|
|
1206
|
+
))), /* @__PURE__ */ React3.createElement(
|
|
1207
|
+
"button",
|
|
1208
|
+
{
|
|
1209
|
+
onClick: onClose,
|
|
1210
|
+
style: {
|
|
1211
|
+
width: "32px",
|
|
1212
|
+
height: "32px",
|
|
1213
|
+
borderRadius: "12px",
|
|
1214
|
+
backgroundColor: "rgba(255, 255, 255, 0.1)",
|
|
1215
|
+
border: "none",
|
|
1216
|
+
display: "flex",
|
|
1217
|
+
alignItems: "center",
|
|
1218
|
+
justifyContent: "center",
|
|
1219
|
+
transition: "all 0.2s",
|
|
1220
|
+
cursor: "pointer"
|
|
1221
|
+
},
|
|
1222
|
+
onMouseEnter: (e) => {
|
|
1223
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.2)";
|
|
1224
|
+
e.currentTarget.style.transform = "scale(1.05)";
|
|
1225
|
+
},
|
|
1226
|
+
onMouseLeave: (e) => {
|
|
1227
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.1)";
|
|
1228
|
+
e.currentTarget.style.transform = "scale(1)";
|
|
1229
|
+
}
|
|
1230
|
+
},
|
|
1231
|
+
/* @__PURE__ */ React3.createElement(X, { style: { width: "16px", height: "16px", color: "#4b5563" } })
|
|
1232
|
+
))
|
|
855
1233
|
),
|
|
856
|
-
/* @__PURE__ */ React3.createElement(
|
|
857
|
-
"div",
|
|
858
|
-
{
|
|
859
|
-
className: "absolute -inset-1 bg-gradient-to-br from-blue-500 to-blue-500 rounded-xl opacity-30",
|
|
860
|
-
style: { animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite" }
|
|
861
|
-
}
|
|
862
|
-
)), /* @__PURE__ */ React3.createElement("div", null, /* @__PURE__ */ React3.createElement("h3", { className: "text-base font-semibold text-gray-800" }, isSpeechMode ? "Voice Input" : "AI Assistant"), /* @__PURE__ */ React3.createElement("div", { className: "flex items-center gap-2 mt-0.5" }, isSpeechMode ? /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("div", { className: "flex gap-1" }, /* @__PURE__ */ React3.createElement(
|
|
1234
|
+
/* @__PURE__ */ React3.createElement(
|
|
863
1235
|
"div",
|
|
864
1236
|
{
|
|
865
|
-
className: "w-1 h-1 bg-blue-500 rounded-full",
|
|
866
1237
|
style: {
|
|
867
|
-
|
|
868
|
-
|
|
1238
|
+
flex: 1,
|
|
1239
|
+
padding: "16px",
|
|
1240
|
+
overflowY: "auto"
|
|
869
1241
|
}
|
|
870
|
-
}
|
|
871
|
-
|
|
1242
|
+
},
|
|
1243
|
+
/* @__PURE__ */ React3.createElement(
|
|
1244
|
+
"div",
|
|
1245
|
+
{
|
|
1246
|
+
style: {
|
|
1247
|
+
minHeight: "80px",
|
|
1248
|
+
display: "flex",
|
|
1249
|
+
alignItems: "center",
|
|
1250
|
+
justifyContent: "center"
|
|
1251
|
+
}
|
|
1252
|
+
},
|
|
1253
|
+
displayedText ? /* @__PURE__ */ React3.createElement("div", { style: { width: "100%", textAlign: "center" } }, /* @__PURE__ */ React3.createElement(
|
|
1254
|
+
"p",
|
|
1255
|
+
{
|
|
1256
|
+
style: {
|
|
1257
|
+
fontSize: "14px",
|
|
1258
|
+
lineHeight: "1.625",
|
|
1259
|
+
fontWeight: "300",
|
|
1260
|
+
letterSpacing: "0.025em",
|
|
1261
|
+
color: "#1f2937",
|
|
1262
|
+
margin: 0
|
|
1263
|
+
}
|
|
1264
|
+
},
|
|
1265
|
+
displayedText,
|
|
1266
|
+
!isComplete && /* @__PURE__ */ React3.createElement(
|
|
1267
|
+
"span",
|
|
1268
|
+
{
|
|
1269
|
+
style: {
|
|
1270
|
+
display: "inline-block",
|
|
1271
|
+
width: "2px",
|
|
1272
|
+
height: "20px",
|
|
1273
|
+
background: "linear-gradient(to top, #3b82f6, #3b82f6)",
|
|
1274
|
+
marginLeft: "8px",
|
|
1275
|
+
verticalAlign: "text-bottom",
|
|
1276
|
+
borderRadius: "9999px",
|
|
1277
|
+
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
)
|
|
1281
|
+
)) : /* @__PURE__ */ React3.createElement("div", { style: { width: "100%", textAlign: "center" } }, /* @__PURE__ */ React3.createElement(
|
|
1282
|
+
"p",
|
|
1283
|
+
{
|
|
1284
|
+
style: {
|
|
1285
|
+
fontSize: "14px",
|
|
1286
|
+
color: "#4b5563",
|
|
1287
|
+
fontWeight: "300",
|
|
1288
|
+
fontStyle: "italic",
|
|
1289
|
+
margin: 0
|
|
1290
|
+
}
|
|
1291
|
+
},
|
|
1292
|
+
isSpeechMode ? "Start speaking..." : "Generating response..."
|
|
1293
|
+
))
|
|
1294
|
+
)
|
|
1295
|
+
),
|
|
1296
|
+
/* @__PURE__ */ React3.createElement(
|
|
872
1297
|
"div",
|
|
873
1298
|
{
|
|
874
|
-
className: "w-1 h-1 bg-blue-500 rounded-full",
|
|
875
1299
|
style: {
|
|
876
|
-
|
|
877
|
-
|
|
1300
|
+
paddingLeft: "16px",
|
|
1301
|
+
paddingRight: "16px",
|
|
1302
|
+
paddingBottom: "16px",
|
|
1303
|
+
flexShrink: 0
|
|
878
1304
|
}
|
|
879
|
-
}
|
|
880
|
-
|
|
1305
|
+
},
|
|
1306
|
+
/* @__PURE__ */ React3.createElement(
|
|
1307
|
+
"div",
|
|
1308
|
+
{
|
|
1309
|
+
style: {
|
|
1310
|
+
display: "flex",
|
|
1311
|
+
alignItems: "center",
|
|
1312
|
+
justifyContent: "space-between",
|
|
1313
|
+
fontSize: "12px",
|
|
1314
|
+
color: "#6b7280"
|
|
1315
|
+
}
|
|
1316
|
+
},
|
|
1317
|
+
/* @__PURE__ */ React3.createElement("div", { style: { display: "flex", alignItems: "center", gap: "8px" } }, /* @__PURE__ */ React3.createElement(
|
|
1318
|
+
"div",
|
|
1319
|
+
{
|
|
1320
|
+
style: {
|
|
1321
|
+
width: "8px",
|
|
1322
|
+
height: "8px",
|
|
1323
|
+
backgroundColor: "#3b82f6",
|
|
1324
|
+
borderRadius: "50%",
|
|
1325
|
+
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
), /* @__PURE__ */ React3.createElement("span", null, isSpeechMode ? "Listening for input..." : "Response delivered")),
|
|
1329
|
+
/* @__PURE__ */ React3.createElement("span", null, (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }))
|
|
1330
|
+
)
|
|
1331
|
+
),
|
|
1332
|
+
/* @__PURE__ */ React3.createElement(
|
|
881
1333
|
"div",
|
|
882
1334
|
{
|
|
883
|
-
className: "w-1 h-1 bg-blue-500 rounded-full",
|
|
884
1335
|
style: {
|
|
885
|
-
|
|
886
|
-
|
|
1336
|
+
position: "absolute",
|
|
1337
|
+
top: 0,
|
|
1338
|
+
left: 0,
|
|
1339
|
+
right: 0,
|
|
1340
|
+
height: "1px",
|
|
1341
|
+
background: "linear-gradient(to right, transparent, rgba(59, 130, 246, 0.5), transparent)"
|
|
887
1342
|
}
|
|
888
1343
|
}
|
|
889
|
-
)
|
|
890
|
-
|
|
891
|
-
{
|
|
892
|
-
onClick: onClose,
|
|
893
|
-
className: "w-8 h-8 rounded-xl bg-white/10 hover:bg-white/20 flex items-center justify-center transition-all duration-200 hover:scale-105"
|
|
894
|
-
},
|
|
895
|
-
/* @__PURE__ */ React3.createElement(X, { className: "w-4 h-4 text-gray-600" })
|
|
896
|
-
))), /* @__PURE__ */ React3.createElement("div", { className: "flex-1 p-4 overflow-y-auto" }, /* @__PURE__ */ React3.createElement("div", { className: "min-h-[80px] flex items-center justify-center" }, displayedText ? /* @__PURE__ */ React3.createElement("div", { className: "w-full text-center" }, /* @__PURE__ */ React3.createElement("p", { className: "text-sm leading-relaxed font-light tracking-wide text-gray-800" }, displayedText, !isComplete && /* @__PURE__ */ React3.createElement(
|
|
897
|
-
"span",
|
|
898
|
-
{
|
|
899
|
-
className: "inline-block w-0.5 h-5 bg-gradient-to-t from-blue-500 to-blue-500 ml-2 align-text-bottom rounded-full",
|
|
900
|
-
style: { animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite" }
|
|
901
|
-
}
|
|
902
|
-
))) : /* @__PURE__ */ React3.createElement("div", { className: "w-full text-center" }, /* @__PURE__ */ React3.createElement("p", { className: "text-sm text-gray-600 font-light italic" }, isSpeechMode ? "Start speaking..." : "Generating response...")))), /* @__PURE__ */ React3.createElement("div", { className: "px-4 pb-4 flex-shrink-0" }, /* @__PURE__ */ React3.createElement("div", { className: "flex items-center justify-between text-xs text-gray-500" }, /* @__PURE__ */ React3.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React3.createElement(
|
|
903
|
-
"div",
|
|
904
|
-
{
|
|
905
|
-
className: "w-2 h-2 bg-blue-500 rounded-full",
|
|
906
|
-
style: { animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite" }
|
|
907
|
-
}
|
|
908
|
-
), /* @__PURE__ */ React3.createElement("span", null, isSpeechMode ? "Listening for input..." : "Response delivered")), /* @__PURE__ */ React3.createElement("span", null, (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })))), /* @__PURE__ */ React3.createElement("div", { className: "absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-blue-500/50 to-transparent" }))
|
|
909
|
-
));
|
|
1344
|
+
)
|
|
1345
|
+
)));
|
|
910
1346
|
};
|
|
911
1347
|
var MicButton = ({
|
|
912
1348
|
hasText = false,
|
|
@@ -916,7 +1352,8 @@ var MicButton = ({
|
|
|
916
1352
|
imageStyle,
|
|
917
1353
|
buttonStyle,
|
|
918
1354
|
screenPosition = "bottom-right",
|
|
919
|
-
|
|
1355
|
+
bottomSpace = 20,
|
|
1356
|
+
buttonSize = 64
|
|
920
1357
|
}) => {
|
|
921
1358
|
const { isListening, start, stop, transcript } = useVoice();
|
|
922
1359
|
const [micState, setMicState] = useState4("idle");
|
|
@@ -998,27 +1435,36 @@ var MicButton = ({
|
|
|
998
1435
|
}
|
|
999
1436
|
}, [isListening, transcript]);
|
|
1000
1437
|
const getIcon = () => {
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1438
|
+
if (imageSource) {
|
|
1439
|
+
const baseImageStyle = {
|
|
1440
|
+
width: `${buttonSize * 0.4375}px`,
|
|
1441
|
+
height: `${buttonSize * 0.4375}px`,
|
|
1442
|
+
objectFit: "contain",
|
|
1443
|
+
filter: "drop-shadow(0 10px 8px rgba(0, 0, 0, 0.04)) drop-shadow(0 4px 3px rgba(0, 0, 0, 0.1))",
|
|
1444
|
+
...imageStyle
|
|
1445
|
+
};
|
|
1446
|
+
const animatedImageStyle = micState === "thinking" ? { ...baseImageStyle, animation: "spin 1s linear infinite" } : micState === "replying" ? { ...baseImageStyle, animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite" } : baseImageStyle;
|
|
1447
|
+
return /* @__PURE__ */ React3.createElement("img", { src: imageSource, alt: "Voice Assistant", style: animatedImageStyle });
|
|
1010
1448
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1449
|
+
const iconStyle = {
|
|
1450
|
+
width: `${buttonSize * 0.4375}px`,
|
|
1451
|
+
height: `${buttonSize * 0.4375}px`,
|
|
1452
|
+
color: "white",
|
|
1453
|
+
filter: "drop-shadow(0 10px 8px rgba(0, 0, 0, 0.04)) drop-shadow(0 4px 3px rgba(0, 0, 0, 0.1))"
|
|
1454
|
+
};
|
|
1013
1455
|
switch (micState) {
|
|
1014
|
-
case "listening":
|
|
1015
|
-
return "scale-110 shadow-2xl shadow-blue-500/60";
|
|
1016
1456
|
case "thinking":
|
|
1017
|
-
return "
|
|
1457
|
+
return /* @__PURE__ */ React3.createElement(Loader2, { style: { ...iconStyle, animation: "spin 1s linear infinite" } });
|
|
1018
1458
|
case "replying":
|
|
1019
|
-
return
|
|
1459
|
+
return /* @__PURE__ */ React3.createElement(
|
|
1460
|
+
Volume2,
|
|
1461
|
+
{
|
|
1462
|
+
style: { ...iconStyle, animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite" }
|
|
1463
|
+
}
|
|
1464
|
+
);
|
|
1465
|
+
case "listening":
|
|
1020
1466
|
default:
|
|
1021
|
-
return
|
|
1467
|
+
return /* @__PURE__ */ React3.createElement(Mic, { style: iconStyle });
|
|
1022
1468
|
}
|
|
1023
1469
|
};
|
|
1024
1470
|
const shouldShowWaves = micState === "listening" || micState === "replying";
|
|
@@ -1026,7 +1472,7 @@ var MicButton = ({
|
|
|
1026
1472
|
const positionStyles = {
|
|
1027
1473
|
position: "fixed",
|
|
1028
1474
|
// <-- Ensure button is fixed to the viewport
|
|
1029
|
-
bottom:
|
|
1475
|
+
bottom: bottomSpace,
|
|
1030
1476
|
zIndex: 9999
|
|
1031
1477
|
};
|
|
1032
1478
|
switch (screenPosition) {
|
|
@@ -1049,32 +1495,134 @@ var MicButton = ({
|
|
|
1049
1495
|
};
|
|
1050
1496
|
}
|
|
1051
1497
|
};
|
|
1052
|
-
|
|
1498
|
+
const buttonStyles = {
|
|
1499
|
+
container: {
|
|
1500
|
+
position: "relative",
|
|
1501
|
+
display: "flex",
|
|
1502
|
+
alignItems: "center",
|
|
1503
|
+
justifyContent: "center"
|
|
1504
|
+
},
|
|
1505
|
+
button: {
|
|
1506
|
+
position: "relative",
|
|
1507
|
+
display: "flex",
|
|
1508
|
+
alignItems: "center",
|
|
1509
|
+
justifyContent: "center",
|
|
1510
|
+
width: `${buttonSize}px`,
|
|
1511
|
+
height: `${buttonSize}px`,
|
|
1512
|
+
borderRadius: "50%",
|
|
1513
|
+
background: "linear-gradient(to bottom right, #3b82f6, #22d3ee, #c084fc)",
|
|
1514
|
+
// from-blue-500 via-cyan-400 to-purple-400
|
|
1515
|
+
transition: "all 0.5s",
|
|
1516
|
+
border: "none",
|
|
1517
|
+
boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
|
|
1518
|
+
// shadow-2xl
|
|
1519
|
+
cursor: "pointer",
|
|
1520
|
+
transform: "scale(1)",
|
|
1521
|
+
...buttonStyle
|
|
1522
|
+
},
|
|
1523
|
+
iconContainer: {
|
|
1524
|
+
position: "relative",
|
|
1525
|
+
zIndex: 10
|
|
1526
|
+
},
|
|
1527
|
+
listeningGlow: {
|
|
1528
|
+
position: "absolute",
|
|
1529
|
+
top: 0,
|
|
1530
|
+
left: 0,
|
|
1531
|
+
right: 0,
|
|
1532
|
+
bottom: 0,
|
|
1533
|
+
borderRadius: "50%",
|
|
1534
|
+
backgroundColor: "#3b82f6",
|
|
1535
|
+
opacity: 0.3,
|
|
1536
|
+
animation: "ping 1s cubic-bezier(0, 0, 0.2, 1) infinite"
|
|
1537
|
+
},
|
|
1538
|
+
thinkingRing: {
|
|
1539
|
+
position: "absolute",
|
|
1540
|
+
top: "-2px",
|
|
1541
|
+
left: "-2px",
|
|
1542
|
+
right: "-2px",
|
|
1543
|
+
bottom: "-2px",
|
|
1544
|
+
borderRadius: "50%",
|
|
1545
|
+
border: "2px solid rgba(59, 130, 246, 0.6)",
|
|
1546
|
+
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
|
|
1547
|
+
},
|
|
1548
|
+
replyingGlow: {
|
|
1549
|
+
position: "absolute",
|
|
1550
|
+
top: 0,
|
|
1551
|
+
left: 0,
|
|
1552
|
+
right: 0,
|
|
1553
|
+
bottom: 0,
|
|
1554
|
+
borderRadius: "50%",
|
|
1555
|
+
backgroundColor: "#3b82f6",
|
|
1556
|
+
opacity: 0.25,
|
|
1557
|
+
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
const getDynamicButtonStyle = () => {
|
|
1561
|
+
const baseStyle = { ...buttonStyles.button };
|
|
1562
|
+
switch (micState) {
|
|
1563
|
+
case "listening":
|
|
1564
|
+
baseStyle.transform = "scale(1.1)";
|
|
1565
|
+
baseStyle.boxShadow = "0 25px 50px -12px rgba(59, 130, 246, 0.6)";
|
|
1566
|
+
break;
|
|
1567
|
+
case "thinking":
|
|
1568
|
+
baseStyle.transform = "scale(1.05)";
|
|
1569
|
+
baseStyle.boxShadow = "0 20px 25px -5px rgba(196, 132, 252, 0.4)";
|
|
1570
|
+
baseStyle.animation = "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite";
|
|
1571
|
+
break;
|
|
1572
|
+
case "replying":
|
|
1573
|
+
baseStyle.transform = "scale(1.05)";
|
|
1574
|
+
baseStyle.boxShadow = "0 20px 25px -5px rgba(34, 211, 238, 0.4)";
|
|
1575
|
+
break;
|
|
1576
|
+
default:
|
|
1577
|
+
baseStyle.boxShadow = "0 10px 15px -3px rgba(59, 130, 246, 0.3)";
|
|
1578
|
+
break;
|
|
1579
|
+
}
|
|
1580
|
+
return baseStyle;
|
|
1581
|
+
};
|
|
1582
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("div", { style: { ...buttonStyles.container, ...getPositionStyle() } }, shouldShowWaves && /* @__PURE__ */ React3.createElement(WaveAnimation, null), /* @__PURE__ */ React3.createElement("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "8px" } }, /* @__PURE__ */ React3.createElement(
|
|
1053
1583
|
"button",
|
|
1054
1584
|
{
|
|
1055
1585
|
"data-testid": "ignore",
|
|
1056
1586
|
onClick: handlePress,
|
|
1057
1587
|
disabled: micState === "thinking" || micState === "replying",
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1588
|
+
style: getDynamicButtonStyle(),
|
|
1589
|
+
onMouseEnter: (e) => {
|
|
1590
|
+
if (micState === "idle") {
|
|
1591
|
+
e.currentTarget.style.transform = "scale(1.05)";
|
|
1592
|
+
e.currentTarget.style.boxShadow = "0 20px 25px -5px rgba(59, 130, 246, 0.4)";
|
|
1593
|
+
}
|
|
1594
|
+
},
|
|
1595
|
+
onMouseLeave: (e) => {
|
|
1596
|
+
if (micState === "idle") {
|
|
1597
|
+
e.currentTarget.style.transform = "scale(1)";
|
|
1598
|
+
e.currentTarget.style.boxShadow = "0 10px 15px -3px rgba(59, 130, 246, 0.3)";
|
|
1599
|
+
}
|
|
1061
1600
|
},
|
|
1062
1601
|
"aria-label": micState === "thinking" ? "Processing..." : micState === "replying" ? "AI is responding..." : isListening ? "Stop listening" : "Start listening"
|
|
1063
1602
|
},
|
|
1064
|
-
/* @__PURE__ */ React3.createElement("div", {
|
|
1065
|
-
micState === "listening" && /* @__PURE__ */ React3.createElement("div", {
|
|
1066
|
-
micState === "thinking" && /* @__PURE__ */ React3.createElement(
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1603
|
+
/* @__PURE__ */ React3.createElement("div", { style: buttonStyles.iconContainer }, getIcon()),
|
|
1604
|
+
micState === "listening" && /* @__PURE__ */ React3.createElement("div", { style: buttonStyles.listeningGlow }),
|
|
1605
|
+
micState === "thinking" && /* @__PURE__ */ React3.createElement("div", { style: buttonStyles.thinkingRing }),
|
|
1606
|
+
micState === "replying" && /* @__PURE__ */ React3.createElement("div", { style: buttonStyles.replyingGlow })
|
|
1607
|
+
), hasText && text && /* @__PURE__ */ React3.createElement(
|
|
1608
|
+
"div",
|
|
1609
|
+
{
|
|
1610
|
+
style: {
|
|
1611
|
+
fontSize: "12px",
|
|
1612
|
+
color: "#6b7280",
|
|
1613
|
+
fontWeight: "500",
|
|
1614
|
+
textAlign: "center",
|
|
1615
|
+
background: "rgba(255, 255, 255, 0.9)",
|
|
1616
|
+
padding: "4px 8px",
|
|
1617
|
+
borderRadius: "6px",
|
|
1618
|
+
backdropFilter: "blur(8px)",
|
|
1619
|
+
border: "1px solid rgba(59, 130, 246, 0.2)",
|
|
1620
|
+
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1)",
|
|
1621
|
+
...textStyle
|
|
1074
1622
|
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
)), showModal && typeof document !== "undefined" && createPortal(
|
|
1623
|
+
},
|
|
1624
|
+
text
|
|
1625
|
+
))), showModal && typeof document !== "undefined" && createPortal(
|
|
1078
1626
|
/* @__PURE__ */ React3.createElement(
|
|
1079
1627
|
UnifiedModal,
|
|
1080
1628
|
{
|
|
@@ -1103,8 +1651,12 @@ export {
|
|
|
1103
1651
|
CuekitProvider,
|
|
1104
1652
|
InitCuekit,
|
|
1105
1653
|
MicButton,
|
|
1654
|
+
navigate,
|
|
1106
1655
|
onStateChange,
|
|
1107
1656
|
processVoice,
|
|
1657
|
+
safeNavigate,
|
|
1658
|
+
setNavigationHandler,
|
|
1659
|
+
setNavigator,
|
|
1108
1660
|
useAudioController,
|
|
1109
1661
|
useVoiceRecognition
|
|
1110
1662
|
};
|