@centive/aria-sdk 0.8.7 → 0.8.9
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/index.js +387 -364
- package/dist/index.js.map +1 -1
- package/dist/lib/AriaSessionManager.d.ts +40 -18
- package/dist/lib/AriaSessionManager.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as n, jsxs as E, Fragment as
|
|
2
|
-
import { useRef as me, useState as I, useEffect as ee, useCallback as
|
|
3
|
-
import { Sparkles as
|
|
1
|
+
import { jsx as n, jsxs as E, Fragment as He } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as me, useState as I, useEffect as ee, useCallback as V } from "react";
|
|
3
|
+
import { Sparkles as Re, Wrench as Ve, MicOff as je, Mic as Be, Maximize2 as dr, Phone as De, X as Oe, RefreshCw as We, MessageCircle as Fe, Minimize2 as gr, User as hr, Bot as ur, Send as pr } from "lucide-react";
|
|
4
4
|
import { createPortal as mr } from "react-dom";
|
|
5
5
|
function fr(r) {
|
|
6
6
|
return typeof r == "object" && r !== null && "status" in r && (r.status === "success" || r.status === "error") && !("type" in r);
|
|
@@ -90,6 +90,9 @@ class U {
|
|
|
90
90
|
// Auto-reconnect on Anam disconnect (for inactivity timeout)
|
|
91
91
|
isReconnecting = !1;
|
|
92
92
|
autoReconnectOnAnamDisconnect = !0;
|
|
93
|
+
// Track if user has had a session before (to skip greeting on subsequent sessions)
|
|
94
|
+
// This persists across session restarts within the same app lifecycle
|
|
95
|
+
hasHadSessionBefore = !1;
|
|
93
96
|
// ============================================================================
|
|
94
97
|
// Singleton Pattern
|
|
95
98
|
// ============================================================================
|
|
@@ -143,8 +146,8 @@ class U {
|
|
|
143
146
|
t && t.forEach((o) => {
|
|
144
147
|
try {
|
|
145
148
|
o(e);
|
|
146
|
-
} catch (
|
|
147
|
-
console.error("[AriaSessionManager] Error in event listener:",
|
|
149
|
+
} catch (a) {
|
|
150
|
+
console.error("[AriaSessionManager] Error in event listener:", a);
|
|
148
151
|
}
|
|
149
152
|
});
|
|
150
153
|
}
|
|
@@ -369,8 +372,8 @@ class U {
|
|
|
369
372
|
// Token is ready for use
|
|
370
373
|
}), this.scheduleRefresh(), this.deferAnamInit ? t ? (console.log("[AriaSessionManager] Session token refreshed proactively"), this.config.onSessionRefresh?.(), this.emit({ type: "session_refresh", data: { token: o } }), this.anamClient ? this.setStatus("ready") : this.setStatus("connected")) : this.isReconnecting ? (console.log("[AriaSessionManager] Token received during reconnect, initializing Anam client"), this.initializeAnamClient(o).then(() => {
|
|
371
374
|
console.log("[AriaSessionManager] Anam client initialized after reconnect"), this.isReconnecting = !1, this.emit({ type: "reconnecting", data: { isReconnecting: !1 } });
|
|
372
|
-
}).catch((
|
|
373
|
-
console.error("[AriaSessionManager] Failed to initialize Anam client during reconnect:",
|
|
375
|
+
}).catch((a) => {
|
|
376
|
+
console.error("[AriaSessionManager] Failed to initialize Anam client during reconnect:", a), this.isReconnecting = !1, this.emit({ type: "reconnecting", data: { isReconnecting: !1 } }), this.setStatus("error"), this.updateSessionState({ lastError: "Failed to reconnect session" });
|
|
374
377
|
})) : (console.log("[AriaSessionManager] Session token ready, waiting for user to open widget"), this.setStatus("connected"), this.emit({ type: "session_ready", data: { sessionId: null, tokenReady: !0, lazyInit: !0 } }), this.config.onSessionPreloaded?.()) : this.anamClient ? t && (console.log("[AriaSessionManager] Session refreshed, token updated"), this.config.onSessionRefresh?.(), this.emit({ type: "session_refresh", data: { token: o } })) : this.initializeAnamClient(o);
|
|
375
378
|
} else
|
|
376
379
|
console.log("[AriaSessionManager] Session response without data:", e.message), this.updateSessionState({
|
|
@@ -393,6 +396,9 @@ class U {
|
|
|
393
396
|
* Request a session token from the backend with user_trigger=true
|
|
394
397
|
* This is called automatically when WebSocket connects
|
|
395
398
|
* The token is stored and used when user opens the widget for the first time
|
|
399
|
+
*
|
|
400
|
+
* If user has had a session before (in this app lifecycle), skip_greeting is sent
|
|
401
|
+
* to prevent the greeting from playing again on subsequent sessions.
|
|
396
402
|
*/
|
|
397
403
|
requestSessionToken() {
|
|
398
404
|
if (this.sessionState.token && !this.isTokenExpired()) {
|
|
@@ -407,16 +413,22 @@ class U {
|
|
|
407
413
|
console.warn("[AriaSessionManager] Cannot request session token: WebSocket not connected");
|
|
408
414
|
return;
|
|
409
415
|
}
|
|
410
|
-
|
|
416
|
+
const e = this.hasHadSessionBefore;
|
|
417
|
+
console.log(
|
|
418
|
+
"[AriaSessionManager] Requesting session token with user_trigger=true for user:",
|
|
419
|
+
this.config.userId,
|
|
420
|
+
e ? "(skip_greeting: true)" : "(with greeting)"
|
|
421
|
+
), this.setStatus("preloading");
|
|
411
422
|
try {
|
|
412
|
-
const
|
|
423
|
+
const t = JSON.stringify({
|
|
413
424
|
user_trigger: !0,
|
|
414
|
-
...this.config.userId && { userId: this.config.userId }
|
|
425
|
+
...this.config.userId && { userId: this.config.userId },
|
|
426
|
+
...e && { skip_greeting: !0 }
|
|
415
427
|
});
|
|
416
|
-
console.log("[AriaSessionManager] Sending message:",
|
|
417
|
-
} catch (
|
|
418
|
-
const
|
|
419
|
-
console.error("[AriaSessionManager] Session token request error:",
|
|
428
|
+
console.log("[AriaSessionManager] Sending message:", t), this.ws.send(t);
|
|
429
|
+
} catch (t) {
|
|
430
|
+
const o = t instanceof Error ? t.message : "Failed to request session token";
|
|
431
|
+
console.error("[AriaSessionManager] Session token request error:", o), this.handleSessionError(o);
|
|
420
432
|
}
|
|
421
433
|
}
|
|
422
434
|
/**
|
|
@@ -439,15 +451,21 @@ class U {
|
|
|
439
451
|
console.error("[AriaSessionManager] Cannot trigger session: WebSocket not connected");
|
|
440
452
|
return;
|
|
441
453
|
}
|
|
454
|
+
const t = this.hasHadSessionBefore;
|
|
442
455
|
try {
|
|
443
|
-
const
|
|
456
|
+
const o = JSON.stringify({
|
|
444
457
|
user_trigger: !0,
|
|
445
|
-
userId: this.config.userId
|
|
458
|
+
userId: this.config.userId,
|
|
459
|
+
...t && { skip_greeting: !0 }
|
|
446
460
|
});
|
|
447
|
-
this.ws.send(
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
461
|
+
this.ws.send(o), console.log(
|
|
462
|
+
"[AriaSessionManager] Sent session request with user_trigger: true, userId:",
|
|
463
|
+
this.config.userId,
|
|
464
|
+
t ? "(skip_greeting: true)" : "(with greeting)"
|
|
465
|
+
), e && this.config.userId && this.config.onManualTrigger?.(this.config.userId);
|
|
466
|
+
} catch (o) {
|
|
467
|
+
const a = o instanceof Error ? o.message : "Failed to trigger session";
|
|
468
|
+
console.error("[AriaSessionManager] Trigger error:", a), this.config.onError?.(o instanceof Error ? o : new Error(a));
|
|
451
469
|
}
|
|
452
470
|
}
|
|
453
471
|
// ============================================================================
|
|
@@ -496,13 +514,17 @@ class U {
|
|
|
496
514
|
this.isAnamInitializing = !0, console.log("[AriaSessionManager] Initializing Anam client"), this.setStatus("preloading");
|
|
497
515
|
try {
|
|
498
516
|
this.createHiddenVideoElement();
|
|
499
|
-
const { createClient: t, AnamEvent: o } = await import("@anam-ai/js-sdk"),
|
|
500
|
-
|
|
501
|
-
const m =
|
|
517
|
+
const { createClient: t, AnamEvent: o } = await import("@anam-ai/js-sdk"), a = t(e);
|
|
518
|
+
a.addListener(o.SESSION_READY, () => {
|
|
519
|
+
const m = a.getActiveSessionId();
|
|
502
520
|
m && (this.updateSessionState({ session_id: m }), console.log("[AriaSessionManager] Anam session ready with ID:", m));
|
|
503
|
-
}),
|
|
504
|
-
console.log("[AriaSessionManager] Anam connection closed"), this.emit({ type: "connection_change", data: { connected: !1 } }), this.
|
|
505
|
-
|
|
521
|
+
}), a.addListener(o.CONNECTION_CLOSED, () => {
|
|
522
|
+
if (console.log("[AriaSessionManager] Anam connection closed"), this.emit({ type: "connection_change", data: { connected: !1 } }), this.isPaused) {
|
|
523
|
+
console.log("[AriaSessionManager] Anam disconnected while paused, clearing stale session"), this.clearStaleSessionForResume();
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
this.autoReconnectOnAnamDisconnect && !this.isIntentionalDisconnect && !this.isReconnecting && (console.log("[AriaSessionManager] Anam disconnected unexpectedly, auto-reconnecting..."), this.autoReconnectSession());
|
|
527
|
+
}), a.addListener(o.MESSAGE_HISTORY_UPDATED, (m) => {
|
|
506
528
|
this.chatMessages = m.map((A) => ({
|
|
507
529
|
role: A.role,
|
|
508
530
|
content: A.content,
|
|
@@ -514,7 +536,7 @@ class U {
|
|
|
514
536
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
515
537
|
}));
|
|
516
538
|
this.sendMessageHistory(f), this.emit({ type: "message_history", data: { messages: this.chatMessages } });
|
|
517
|
-
}),
|
|
539
|
+
}), a.addListener(o.MESSAGE_STREAM_EVENT_RECEIVED, (m) => {
|
|
518
540
|
m.role === "persona" ? this.liveTranscript += m.content : m.role === "user" && (this.liveTranscript = "");
|
|
519
541
|
const f = {
|
|
520
542
|
role: m.role,
|
|
@@ -522,7 +544,7 @@ class U {
|
|
|
522
544
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
523
545
|
};
|
|
524
546
|
this.sendMessageStream(f, m.is_final ?? !1), this.emit({ type: "message_stream", data: { event: m, liveTranscript: this.liveTranscript } });
|
|
525
|
-
}),
|
|
547
|
+
}), a.addListener(o.CLIENT_TOOL_EVENT_RECEIVED, (m) => {
|
|
526
548
|
console.log("[AriaSessionManager] Tool call event received:", m.eventName), this.isToolCallActive = !0, this.activeToolCall = m, this.emit({
|
|
527
549
|
type: "tool_call",
|
|
528
550
|
data: {
|
|
@@ -534,13 +556,13 @@ class U {
|
|
|
534
556
|
}), setTimeout(() => {
|
|
535
557
|
this.activeToolCall?.eventUid === m.eventUid && this.clearToolCallState();
|
|
536
558
|
}, 3e4);
|
|
537
|
-
}), this.anamClient =
|
|
538
|
-
const l = await
|
|
539
|
-
this.videoStream =
|
|
559
|
+
}), this.anamClient = a, this.audioInputStream = await navigator.mediaDevices.getUserMedia({ audio: !0 }), this.createHiddenAudioElement();
|
|
560
|
+
const l = await a.stream(this.audioInputStream), i = l[0], b = l[1];
|
|
561
|
+
this.videoStream = i, this.hiddenVideoElement && (this.hiddenVideoElement.srcObject = i, this.hiddenVideoElement.muted = !0), this.hiddenAudioElement && b ? (this.hiddenAudioElement.srcObject = b, this.hiddenAudioElement.muted = !1, this.hiddenAudioElement.play().catch((m) => {
|
|
540
562
|
console.warn("[AriaSessionManager] Initial audio play failed (may need user interaction):", m);
|
|
541
563
|
}), console.log("[AriaSessionManager] Audio stream attached to audio element")) : console.log("[AriaSessionManager] No separate audio stream available, audio may come through video"), this.isAnamInitializing = !1, this.setStatus("ready");
|
|
542
|
-
const d =
|
|
543
|
-
console.log("[AriaSessionManager] Session fully ready with video stream, ID:", d), this.emit({ type: "session_ready", data: { sessionId: d, streamReady: !0 } }), this.config.onSessionReady?.(), console.log("[AriaSessionManager] Anam client initialized and streaming");
|
|
564
|
+
const d = a.getActiveSessionId();
|
|
565
|
+
console.log("[AriaSessionManager] Session fully ready with video stream, ID:", d), this.emit({ type: "session_ready", data: { sessionId: d, streamReady: !0 } }), this.config.onSessionReady?.(), this.hasHadSessionBefore || (this.hasHadSessionBefore = !0, console.log("[AriaSessionManager] First session started - subsequent sessions will skip greeting")), console.log("[AriaSessionManager] Anam client initialized and streaming");
|
|
544
566
|
} catch (t) {
|
|
545
567
|
this.isAnamInitializing = !1;
|
|
546
568
|
const o = t instanceof Error ? t.message : "Failed to initialize Anam client";
|
|
@@ -590,11 +612,11 @@ class U {
|
|
|
590
612
|
*/
|
|
591
613
|
attachToVideoElement(e) {
|
|
592
614
|
if (this.videoStream) {
|
|
593
|
-
const t = this.videoStream.getTracks(), o = t.filter((
|
|
594
|
-
console.log("[AriaSessionManager] Attaching video stream, tracks:", t.length, "active:", o.length, "audio:",
|
|
595
|
-
console.warn("[AriaSessionManager] Audio play failed:",
|
|
596
|
-
}), console.log("[AriaSessionManager] Audio playing through separate audio element")) : (e.muted = !1, console.log("[AriaSessionManager] Audio playing through video element")), e.play().catch((
|
|
597
|
-
console.warn("[AriaSessionManager] Video play failed:",
|
|
615
|
+
const t = this.videoStream.getTracks(), o = t.filter((i) => i.readyState === "live"), a = t.filter((i) => i.kind === "audio");
|
|
616
|
+
console.log("[AriaSessionManager] Attaching video stream, tracks:", t.length, "active:", o.length, "audio:", a.length), e.srcObject = this.videoStream, this.hiddenAudioElement && this.hiddenAudioElement.srcObject ? (e.muted = !0, this.hiddenAudioElement.muted = !1, this.hiddenAudioElement.play().catch((i) => {
|
|
617
|
+
console.warn("[AriaSessionManager] Audio play failed:", i);
|
|
618
|
+
}), console.log("[AriaSessionManager] Audio playing through separate audio element")) : (e.muted = !1, console.log("[AriaSessionManager] Audio playing through video element")), e.play().catch((i) => {
|
|
619
|
+
console.warn("[AriaSessionManager] Video play failed:", i);
|
|
598
620
|
});
|
|
599
621
|
} else
|
|
600
622
|
console.log("[AriaSessionManager] No video stream available to attach (session may be initializing)");
|
|
@@ -632,8 +654,8 @@ class U {
|
|
|
632
654
|
};
|
|
633
655
|
try {
|
|
634
656
|
this.ws.send(JSON.stringify(o)), console.log("[AriaSessionManager] Sent message history:", e.length, "messages");
|
|
635
|
-
} catch (
|
|
636
|
-
console.error("[AriaSessionManager] Failed to send message history:",
|
|
657
|
+
} catch (a) {
|
|
658
|
+
console.error("[AriaSessionManager] Failed to send message history:", a);
|
|
637
659
|
}
|
|
638
660
|
}
|
|
639
661
|
sendMessageStream(e, t) {
|
|
@@ -646,8 +668,8 @@ class U {
|
|
|
646
668
|
};
|
|
647
669
|
try {
|
|
648
670
|
this.ws.send(JSON.stringify(o));
|
|
649
|
-
} catch (
|
|
650
|
-
console.error("[AriaSessionManager] Failed to send message stream:",
|
|
671
|
+
} catch (a) {
|
|
672
|
+
console.error("[AriaSessionManager] Failed to send message stream:", a);
|
|
651
673
|
}
|
|
652
674
|
}
|
|
653
675
|
sendSessionEnd() {
|
|
@@ -702,8 +724,8 @@ class U {
|
|
|
702
724
|
console.log("[AriaSessionManager] No expiration time, skipping refresh scheduling");
|
|
703
725
|
return;
|
|
704
726
|
}
|
|
705
|
-
const e = new Date(this.sessionState.expires_at).getTime(), t = Date.now(), o = this.refreshConfig.bufferMinutes * 60 * 1e3,
|
|
706
|
-
console.log(`[AriaSessionManager] Token expires at: ${new Date(e).toISOString()}`), console.log(`[AriaSessionManager] Time until expiry: ${Math.round(
|
|
727
|
+
const e = new Date(this.sessionState.expires_at).getTime(), t = Date.now(), o = this.refreshConfig.bufferMinutes * 60 * 1e3, a = e - o, l = Math.max(0, a - t), i = e - t;
|
|
728
|
+
console.log(`[AriaSessionManager] Token expires at: ${new Date(e).toISOString()}`), console.log(`[AriaSessionManager] Time until expiry: ${Math.round(i / 1e3 / 60)} minutes`), console.log(`[AriaSessionManager] Refresh buffer: ${this.refreshConfig.bufferMinutes} minutes`), l <= 0 ? (console.log("[AriaSessionManager] Session expiring soon, refreshing immediately"), this.refreshSession()) : (console.log(`[AriaSessionManager] Scheduling proactive refresh in ${Math.round(l / 1e3 / 60)} minutes`), this.refreshTimer = setTimeout(() => {
|
|
707
729
|
console.log("[AriaSessionManager] Proactive refresh timer fired"), this.refreshSession();
|
|
708
730
|
}, l));
|
|
709
731
|
}
|
|
@@ -721,15 +743,17 @@ class U {
|
|
|
721
743
|
return;
|
|
722
744
|
}
|
|
723
745
|
console.log("[AriaSessionManager] Refreshing session token (proactive refresh)"), this.updateSessionState({ isRefreshing: !0 }), this.setStatus("refreshing");
|
|
746
|
+
const e = this.hasHadSessionBefore;
|
|
724
747
|
try {
|
|
725
|
-
const
|
|
748
|
+
const t = JSON.stringify({
|
|
726
749
|
user_trigger: !0,
|
|
727
|
-
userId: this.config.userId
|
|
750
|
+
userId: this.config.userId,
|
|
751
|
+
...e && { skip_greeting: !0 }
|
|
728
752
|
});
|
|
729
|
-
this.ws.send(
|
|
730
|
-
} catch (
|
|
731
|
-
const
|
|
732
|
-
console.error("[AriaSessionManager] Refresh error:",
|
|
753
|
+
this.ws.send(t);
|
|
754
|
+
} catch (t) {
|
|
755
|
+
const o = t instanceof Error ? t.message : "Failed to refresh session";
|
|
756
|
+
console.error("[AriaSessionManager] Refresh error:", o), this.updateSessionState({ isRefreshing: !1 }), this.config.onSessionRefreshError?.(t instanceof Error ? t : new Error(o)), this.scheduleRetry();
|
|
733
757
|
}
|
|
734
758
|
}
|
|
735
759
|
// ============================================================================
|
|
@@ -770,11 +794,11 @@ class U {
|
|
|
770
794
|
// ============================================================================
|
|
771
795
|
/**
|
|
772
796
|
* Check if session persistence is enabled
|
|
773
|
-
*
|
|
774
|
-
*
|
|
797
|
+
* Returns FALSE - sessions are ended when widget closes to save Anam resources
|
|
798
|
+
* A new session with skip_greeting is created when widget reopens
|
|
775
799
|
*/
|
|
776
800
|
isPersistSessionEnabled() {
|
|
777
|
-
return !
|
|
801
|
+
return !1;
|
|
778
802
|
}
|
|
779
803
|
/**
|
|
780
804
|
* Check if WebSocket should stay alive when paused
|
|
@@ -783,78 +807,50 @@ class U {
|
|
|
783
807
|
return this.config.keepWebSocketAlive !== !1;
|
|
784
808
|
}
|
|
785
809
|
/**
|
|
786
|
-
* Check if
|
|
810
|
+
* Check if widget is closed (session was ended on close)
|
|
811
|
+
* Note: With the new behavior, sessions are ended when widget closes,
|
|
812
|
+
* not paused. This returns true if the widget was closed.
|
|
787
813
|
*/
|
|
788
814
|
isSessionPaused() {
|
|
789
|
-
return this.
|
|
815
|
+
return !this.anamClient && this.hasHadSessionBefore;
|
|
790
816
|
}
|
|
791
817
|
/**
|
|
792
|
-
* Pause the session (called when widget closes)
|
|
793
|
-
*
|
|
794
|
-
*
|
|
795
|
-
*
|
|
796
|
-
*
|
|
818
|
+
* Pause the session (called when widget closes / user hangs up)
|
|
819
|
+
*
|
|
820
|
+
* NEW BEHAVIOR: Ends the Anam session to save resources.
|
|
821
|
+
* When widget reopens, a new session is created with skip_greeting: true
|
|
822
|
+
* so the greeting doesn't play again.
|
|
823
|
+
*
|
|
824
|
+
* This is more resource-efficient than keeping the session alive.
|
|
797
825
|
*/
|
|
798
|
-
pauseSession() {
|
|
799
|
-
if (this.isPaused) {
|
|
800
|
-
console.log("[AriaSessionManager] Session already paused");
|
|
801
|
-
return;
|
|
802
|
-
}
|
|
826
|
+
async pauseSession() {
|
|
803
827
|
if (!this.anamClient) {
|
|
804
|
-
console.log("[AriaSessionManager] No active Anam client, nothing to pause");
|
|
828
|
+
console.log("[AriaSessionManager] No active Anam client, nothing to pause/end");
|
|
805
829
|
return;
|
|
806
830
|
}
|
|
807
|
-
console.log("[AriaSessionManager]
|
|
831
|
+
console.log("[AriaSessionManager] Widget closed - ending Anam session (will skip greeting on reopen)"), await this.endCurrentSession(), this.config.onSessionPaused?.();
|
|
808
832
|
}
|
|
809
833
|
/**
|
|
810
834
|
* Resume the session (called when widget reopens)
|
|
811
|
-
*
|
|
812
|
-
*
|
|
813
|
-
*
|
|
814
|
-
*
|
|
835
|
+
*
|
|
836
|
+
* NEW BEHAVIOR: Since we end the session on pause, this now creates a new session
|
|
837
|
+
* with skip_greeting: true. The new session token should already be preloaded
|
|
838
|
+
* (requested in endCurrentSession), so initialization should be fast.
|
|
839
|
+
*
|
|
840
|
+
* @returns true if session initialization started, false if already has active session
|
|
815
841
|
*/
|
|
816
842
|
async resumeSession() {
|
|
817
|
-
if (
|
|
818
|
-
return console.log("[AriaSessionManager]
|
|
819
|
-
if (
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
if (!this.videoStream)
|
|
827
|
-
return console.log("[AriaSessionManager] No video stream available, will create new session"), await this.stopStreaming(), this.resetSessionState(), !1;
|
|
828
|
-
const e = this.videoStream.getTracks(), t = e.filter((o) => o.readyState === "live");
|
|
829
|
-
return console.log("[AriaSessionManager] Video stream tracks:", e.length, "active:", t.length), this.hiddenAudioElement && (this.hiddenAudioElement.muted = !1, this.hiddenAudioElement.play().catch((o) => {
|
|
830
|
-
console.warn("[AriaSessionManager] Audio play failed on resume:", o);
|
|
831
|
-
}), console.log("[AriaSessionManager] Audio element unmuted (session resumed)")), this.isConnected() || (console.log("[AriaSessionManager] Reconnecting WebSocket for resumed session"), this.reconnectForResume()), this.setStatus("ready"), this.config.onSessionResumed?.(), !0;
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* Reconnect WebSocket for session resume (without triggering new session)
|
|
835
|
-
*/
|
|
836
|
-
reconnectForResume() {
|
|
837
|
-
if (this.ws?.readyState === WebSocket.OPEN) {
|
|
838
|
-
console.log("[AriaSessionManager] WebSocket already connected");
|
|
839
|
-
return;
|
|
840
|
-
}
|
|
841
|
-
if (this.ws?.readyState === WebSocket.CONNECTING) {
|
|
842
|
-
console.log("[AriaSessionManager] WebSocket already connecting");
|
|
843
|
-
return;
|
|
844
|
-
}
|
|
845
|
-
this.setStatus("connecting");
|
|
846
|
-
try {
|
|
847
|
-
this.ws = new WebSocket(this.config.websocketUrl), this.ws.onopen = () => {
|
|
848
|
-
console.log("[AriaSessionManager] WebSocket reconnected for resumed session"), this.setStatus("ready"), this.retryCount = 0, this.emit({ type: "connection_change", data: { connected: !0 } }), this.config.onConnectionStateChange?.(!0), console.log("[AriaSessionManager] Session resumed with existing token");
|
|
849
|
-
}, this.ws.onmessage = (e) => this.handleWebSocketMessage(e), this.ws.onerror = (e) => {
|
|
850
|
-
console.error("[AriaSessionManager] WebSocket error during resume:", e), this.setStatus("error"), this.updateSessionState({ lastError: "WebSocket connection error" }), this.config.onError?.(new Error("WebSocket connection failed"));
|
|
851
|
-
}, this.ws.onclose = () => {
|
|
852
|
-
console.log("[AriaSessionManager] WebSocket disconnected"), this.emit({ type: "connection_change", data: { connected: !1 } }), this.config.onConnectionStateChange?.(!1), !this.sessionState.isRefreshing && !this.isPaused && this.setStatus("idle");
|
|
853
|
-
};
|
|
854
|
-
} catch (e) {
|
|
855
|
-
const t = e instanceof Error ? e.message : "Failed to reconnect WebSocket";
|
|
856
|
-
console.error("[AriaSessionManager] Reconnection error:", t), this.setStatus("error"), this.updateSessionState({ lastError: t }), this.config.onError?.(e instanceof Error ? e : new Error(t));
|
|
843
|
+
if (console.log("[AriaSessionManager] Widget reopened - will create new session with skip_greeting"), this.anamClient && this.videoStream)
|
|
844
|
+
return console.log("[AriaSessionManager] Active session exists, no need to create new one"), this.setStatus("ready"), this.config.onSessionResumed?.(), !0;
|
|
845
|
+
if (this.sessionState.token && !this.isTokenExpired()) {
|
|
846
|
+
console.log("[AriaSessionManager] Session token ready, initializing Anam client (skip_greeting applied)");
|
|
847
|
+
try {
|
|
848
|
+
return await this.initializeAnamClient(this.sessionState.token), this.config.onSessionResumed?.(), !0;
|
|
849
|
+
} catch (e) {
|
|
850
|
+
console.error("[AriaSessionManager] Failed to initialize session on resume:", e), this.updateSessionState({ token: null, isSessionReady: !1 });
|
|
851
|
+
}
|
|
857
852
|
}
|
|
853
|
+
return this.isConnected() ? (console.log("[AriaSessionManager] Requesting new session token for resume"), this.requestSessionToken()) : (console.log("[AriaSessionManager] WebSocket not connected, reconnecting..."), this.connect()), !1;
|
|
858
854
|
}
|
|
859
855
|
/**
|
|
860
856
|
* Reset session state (used when session expires or needs to be recreated)
|
|
@@ -873,9 +869,24 @@ class U {
|
|
|
873
869
|
/**
|
|
874
870
|
* Force end the session (explicit user action or logout)
|
|
875
871
|
* This always ends the session regardless of persistSession setting
|
|
872
|
+
*
|
|
873
|
+
* @param resetGreeting - If true, resets the greeting state so next session shows greeting (useful for logout)
|
|
874
|
+
*/
|
|
875
|
+
async forceEndSession(e = !1) {
|
|
876
|
+
console.log("[AriaSessionManager] Force ending session", e ? "(resetting greeting state)" : ""), this.sendSessionEnd(), await this.stopStreaming(), this.resetSessionState(), this.isPaused = !1, e && (this.hasHadSessionBefore = !1, console.log("[AriaSessionManager] Greeting state reset - next session will show greeting")), this.setStatus("idle");
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Reset the greeting state so the next session will show the greeting
|
|
880
|
+
* Call this when user logs out or you want to show greeting again
|
|
881
|
+
*/
|
|
882
|
+
resetGreetingState() {
|
|
883
|
+
this.hasHadSessionBefore = !1, console.log("[AriaSessionManager] Greeting state reset - next session will show greeting");
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Check if greeting will be skipped on next session
|
|
876
887
|
*/
|
|
877
|
-
|
|
878
|
-
|
|
888
|
+
willSkipGreeting() {
|
|
889
|
+
return this.hasHadSessionBefore;
|
|
879
890
|
}
|
|
880
891
|
// ============================================================================
|
|
881
892
|
// Auto-Reconnect on Anam Disconnect (Inactivity Timeout)
|
|
@@ -934,6 +945,18 @@ class U {
|
|
|
934
945
|
isRefreshing: !1
|
|
935
946
|
}), this.isAnamInitializing = !1;
|
|
936
947
|
}
|
|
948
|
+
/**
|
|
949
|
+
* Clear stale session data when Anam disconnects while paused
|
|
950
|
+
* This ensures a fresh session is created when the widget reopens
|
|
951
|
+
*/
|
|
952
|
+
clearStaleSessionForResume() {
|
|
953
|
+
console.log("[AriaSessionManager] Clearing stale session for resume"), this.anamClient = null, this.videoStream = null, this.audioInputStream && (this.audioInputStream.getTracks().forEach((e) => e.stop()), this.audioInputStream = null), this.removeHiddenVideoElement(), this.removeHiddenAudioElement(), this.updateSessionState({
|
|
954
|
+
session_id: null,
|
|
955
|
+
token: null,
|
|
956
|
+
isSessionReady: !1,
|
|
957
|
+
isPreloaded: !1
|
|
958
|
+
}), this.isAnamInitializing = !1, console.log("[AriaSessionManager] Stale session cleared, ready for fresh session on resume");
|
|
959
|
+
}
|
|
937
960
|
/**
|
|
938
961
|
* End the current session but keep WebSocket connected for new session creation
|
|
939
962
|
* This is called when widget closes without persistSession enabled
|
|
@@ -1206,16 +1229,16 @@ class xe {
|
|
|
1206
1229
|
*/
|
|
1207
1230
|
static async renderReactUI(e, t, o) {
|
|
1208
1231
|
try {
|
|
1209
|
-
const
|
|
1232
|
+
const a = await import("react"), l = await import("react-dom/client"), { AriaStandaloneUI: i } = await Promise.resolve().then(() => vt), b = l.createRoot(e);
|
|
1210
1233
|
S.reactRoot = b, b.render(
|
|
1211
|
-
|
|
1234
|
+
a.createElement(i, {
|
|
1212
1235
|
theme: t,
|
|
1213
1236
|
triggerLabel: o,
|
|
1214
1237
|
container: e
|
|
1215
1238
|
})
|
|
1216
1239
|
), console.log("[AriaCore] React UI mounted");
|
|
1217
|
-
} catch (
|
|
1218
|
-
console.error("[AriaCore] Failed to mount React UI:",
|
|
1240
|
+
} catch (a) {
|
|
1241
|
+
console.error("[AriaCore] Failed to mount React UI:", a), S.config?.onError?.(a instanceof Error ? a : new Error(String(a)));
|
|
1219
1242
|
}
|
|
1220
1243
|
}
|
|
1221
1244
|
/**
|
|
@@ -1232,7 +1255,7 @@ function Ie(r) {
|
|
|
1232
1255
|
if (!Sr(r))
|
|
1233
1256
|
return null;
|
|
1234
1257
|
try {
|
|
1235
|
-
const o = r.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"),
|
|
1258
|
+
const o = r.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), a = o.padEnd(o.length + (4 - o.length % 4) % 4, "="), l = atob(a);
|
|
1236
1259
|
return JSON.parse(l);
|
|
1237
1260
|
} catch (e) {
|
|
1238
1261
|
return console.error("Failed to decode JWT:", e), null;
|
|
@@ -1265,12 +1288,12 @@ function St(r) {
|
|
|
1265
1288
|
exp: null,
|
|
1266
1289
|
iat: null
|
|
1267
1290
|
};
|
|
1268
|
-
const t = Er(r), o = typeof e.exp == "number" ? e.exp : null,
|
|
1291
|
+
const t = Er(r), o = typeof e.exp == "number" ? e.exp : null, a = typeof e.iat == "number" ? e.iat : null;
|
|
1269
1292
|
return {
|
|
1270
1293
|
sessionId: t,
|
|
1271
1294
|
payload: e,
|
|
1272
1295
|
exp: o,
|
|
1273
|
-
iat:
|
|
1296
|
+
iat: a
|
|
1274
1297
|
};
|
|
1275
1298
|
}
|
|
1276
1299
|
function Et(r) {
|
|
@@ -1285,33 +1308,33 @@ const Ke = ({
|
|
|
1285
1308
|
styles: e = "",
|
|
1286
1309
|
className: t,
|
|
1287
1310
|
style: o,
|
|
1288
|
-
as:
|
|
1311
|
+
as: a = "div"
|
|
1289
1312
|
}) => {
|
|
1290
|
-
const l = me(null), [
|
|
1313
|
+
const l = me(null), [i, b] = I(null);
|
|
1291
1314
|
ee(() => {
|
|
1292
1315
|
const f = l.current;
|
|
1293
1316
|
if (!f) return;
|
|
1294
1317
|
let A = f.shadowRoot;
|
|
1295
1318
|
A || (A = f.attachShadow({ mode: "open" })), b(A);
|
|
1296
1319
|
}, []), ee(() => {
|
|
1297
|
-
if (!
|
|
1298
|
-
const f =
|
|
1320
|
+
if (!i || !e) return;
|
|
1321
|
+
const f = i.querySelector("style[data-aria-styles]");
|
|
1299
1322
|
if (f) {
|
|
1300
1323
|
f.textContent = e;
|
|
1301
1324
|
return;
|
|
1302
1325
|
}
|
|
1303
1326
|
const A = document.createElement("style");
|
|
1304
|
-
return A.setAttribute("data-aria-styles", "true"), A.textContent = e,
|
|
1327
|
+
return A.setAttribute("data-aria-styles", "true"), A.textContent = e, i.prepend(A), () => {
|
|
1305
1328
|
A.remove();
|
|
1306
1329
|
};
|
|
1307
|
-
}, [
|
|
1330
|
+
}, [i, e]);
|
|
1308
1331
|
const [d, m] = I(null);
|
|
1309
1332
|
return ee(() => {
|
|
1310
|
-
if (!
|
|
1311
|
-
let f =
|
|
1312
|
-
f || (f = document.createElement("div"), f.className = "aria-shadow-content",
|
|
1313
|
-
}, [
|
|
1314
|
-
|
|
1333
|
+
if (!i) return;
|
|
1334
|
+
let f = i.querySelector(".aria-shadow-content");
|
|
1335
|
+
f || (f = document.createElement("div"), f.className = "aria-shadow-content", i.appendChild(f)), m(f);
|
|
1336
|
+
}, [i]), /* @__PURE__ */ n(
|
|
1337
|
+
a,
|
|
1315
1338
|
{
|
|
1316
1339
|
ref: l,
|
|
1317
1340
|
className: t,
|
|
@@ -1327,23 +1350,23 @@ function Xe(r) {
|
|
|
1327
1350
|
var e, t, o = "";
|
|
1328
1351
|
if (typeof r == "string" || typeof r == "number") o += r;
|
|
1329
1352
|
else if (typeof r == "object") if (Array.isArray(r)) {
|
|
1330
|
-
var
|
|
1331
|
-
for (e = 0; e <
|
|
1353
|
+
var a = r.length;
|
|
1354
|
+
for (e = 0; e < a; e++) r[e] && (t = Xe(r[e])) && (o && (o += " "), o += t);
|
|
1332
1355
|
} else for (t in r) r[t] && (o && (o += " "), o += t);
|
|
1333
1356
|
return o;
|
|
1334
1357
|
}
|
|
1335
1358
|
function Cr() {
|
|
1336
|
-
for (var r, e, t = 0, o = "",
|
|
1359
|
+
for (var r, e, t = 0, o = "", a = arguments.length; t < a; t++) (r = arguments[t]) && (e = Xe(r)) && (o && (o += " "), o += e);
|
|
1337
1360
|
return o;
|
|
1338
1361
|
}
|
|
1339
|
-
const
|
|
1362
|
+
const Rr = (r, e) => {
|
|
1340
1363
|
const t = new Array(r.length + e.length);
|
|
1341
1364
|
for (let o = 0; o < r.length; o++)
|
|
1342
1365
|
t[o] = r[o];
|
|
1343
1366
|
for (let o = 0; o < e.length; o++)
|
|
1344
1367
|
t[r.length + o] = e[o];
|
|
1345
1368
|
return t;
|
|
1346
|
-
},
|
|
1369
|
+
}, Nr = (r, e) => ({
|
|
1347
1370
|
classGroupId: r,
|
|
1348
1371
|
validator: e
|
|
1349
1372
|
}), Ze = (r = /* @__PURE__ */ new Map(), e = null, t) => ({
|
|
@@ -1356,34 +1379,34 @@ const Nr = (r, e) => {
|
|
|
1356
1379
|
conflictingClassGroupModifiers: o
|
|
1357
1380
|
} = r;
|
|
1358
1381
|
return {
|
|
1359
|
-
getClassGroupId: (
|
|
1360
|
-
if (
|
|
1361
|
-
return zr(
|
|
1362
|
-
const b =
|
|
1382
|
+
getClassGroupId: (i) => {
|
|
1383
|
+
if (i.startsWith("[") && i.endsWith("]"))
|
|
1384
|
+
return zr(i);
|
|
1385
|
+
const b = i.split(Ee), d = b[0] === "" && b.length > 1 ? 1 : 0;
|
|
1363
1386
|
return Ye(b, d, e);
|
|
1364
1387
|
},
|
|
1365
|
-
getConflictingClassGroupIds: (
|
|
1388
|
+
getConflictingClassGroupIds: (i, b) => {
|
|
1366
1389
|
if (b) {
|
|
1367
|
-
const d = o[
|
|
1368
|
-
return d ? m ?
|
|
1390
|
+
const d = o[i], m = t[i];
|
|
1391
|
+
return d ? m ? Rr(m, d) : d : m || Le;
|
|
1369
1392
|
}
|
|
1370
|
-
return t[
|
|
1393
|
+
return t[i] || Le;
|
|
1371
1394
|
}
|
|
1372
1395
|
};
|
|
1373
1396
|
}, Ye = (r, e, t) => {
|
|
1374
1397
|
if (r.length - e === 0)
|
|
1375
1398
|
return t.classGroupId;
|
|
1376
|
-
const
|
|
1399
|
+
const a = r[e], l = t.nextPart.get(a);
|
|
1377
1400
|
if (l) {
|
|
1378
1401
|
const m = Ye(r, e + 1, l);
|
|
1379
1402
|
if (m) return m;
|
|
1380
1403
|
}
|
|
1381
|
-
const
|
|
1382
|
-
if (
|
|
1404
|
+
const i = t.validators;
|
|
1405
|
+
if (i === null)
|
|
1383
1406
|
return;
|
|
1384
|
-
const b = e === 0 ? r.join(Ee) : r.slice(e).join(Ee), d =
|
|
1407
|
+
const b = e === 0 ? r.join(Ee) : r.slice(e).join(Ee), d = i.length;
|
|
1385
1408
|
for (let m = 0; m < d; m++) {
|
|
1386
|
-
const f =
|
|
1409
|
+
const f = i[m];
|
|
1387
1410
|
if (f.validator(b))
|
|
1388
1411
|
return f.classGroupId;
|
|
1389
1412
|
}
|
|
@@ -1395,55 +1418,55 @@ const Nr = (r, e) => {
|
|
|
1395
1418
|
theme: e,
|
|
1396
1419
|
classGroups: t
|
|
1397
1420
|
} = r;
|
|
1398
|
-
return
|
|
1399
|
-
},
|
|
1421
|
+
return Hr(t, e);
|
|
1422
|
+
}, Hr = (r, e) => {
|
|
1400
1423
|
const t = Ze();
|
|
1401
1424
|
for (const o in r) {
|
|
1402
|
-
const
|
|
1403
|
-
ze(
|
|
1425
|
+
const a = r[o];
|
|
1426
|
+
ze(a, t, o, e);
|
|
1404
1427
|
}
|
|
1405
1428
|
return t;
|
|
1406
1429
|
}, ze = (r, e, t, o) => {
|
|
1407
|
-
const
|
|
1408
|
-
for (let l = 0; l <
|
|
1409
|
-
const
|
|
1410
|
-
|
|
1430
|
+
const a = r.length;
|
|
1431
|
+
for (let l = 0; l < a; l++) {
|
|
1432
|
+
const i = r[l];
|
|
1433
|
+
Vr(i, e, t, o);
|
|
1411
1434
|
}
|
|
1412
|
-
},
|
|
1435
|
+
}, Vr = (r, e, t, o) => {
|
|
1413
1436
|
if (typeof r == "string") {
|
|
1414
|
-
|
|
1437
|
+
jr(r, e, t);
|
|
1415
1438
|
return;
|
|
1416
1439
|
}
|
|
1417
1440
|
if (typeof r == "function") {
|
|
1418
|
-
|
|
1441
|
+
Br(r, e, t, o);
|
|
1419
1442
|
return;
|
|
1420
1443
|
}
|
|
1421
|
-
|
|
1422
|
-
},
|
|
1444
|
+
Dr(r, e, t, o);
|
|
1445
|
+
}, jr = (r, e, t) => {
|
|
1423
1446
|
const o = r === "" ? e : $e(e, r);
|
|
1424
1447
|
o.classGroupId = t;
|
|
1425
|
-
},
|
|
1448
|
+
}, Br = (r, e, t, o) => {
|
|
1426
1449
|
if (Or(r)) {
|
|
1427
1450
|
ze(r(o), e, t, o);
|
|
1428
1451
|
return;
|
|
1429
1452
|
}
|
|
1430
|
-
e.validators === null && (e.validators = []), e.validators.push(
|
|
1431
|
-
},
|
|
1432
|
-
const
|
|
1433
|
-
for (let
|
|
1434
|
-
const [b, d] = i
|
|
1453
|
+
e.validators === null && (e.validators = []), e.validators.push(Nr(t, r));
|
|
1454
|
+
}, Dr = (r, e, t, o) => {
|
|
1455
|
+
const a = Object.entries(r), l = a.length;
|
|
1456
|
+
for (let i = 0; i < l; i++) {
|
|
1457
|
+
const [b, d] = a[i];
|
|
1435
1458
|
ze(d, $e(e, b), t, o);
|
|
1436
1459
|
}
|
|
1437
1460
|
}, $e = (r, e) => {
|
|
1438
1461
|
let t = r;
|
|
1439
|
-
const o = e.split(Ee),
|
|
1440
|
-
for (let l = 0; l <
|
|
1441
|
-
const
|
|
1442
|
-
let b = t.nextPart.get(
|
|
1443
|
-
b || (b = Ze(), t.nextPart.set(
|
|
1462
|
+
const o = e.split(Ee), a = o.length;
|
|
1463
|
+
for (let l = 0; l < a; l++) {
|
|
1464
|
+
const i = o[l];
|
|
1465
|
+
let b = t.nextPart.get(i);
|
|
1466
|
+
b || (b = Ze(), t.nextPart.set(i, b)), t = b;
|
|
1444
1467
|
}
|
|
1445
1468
|
return t;
|
|
1446
|
-
}, Or = (r) => "isThemeGetter" in r && r.isThemeGetter === !0,
|
|
1469
|
+
}, Or = (r) => "isThemeGetter" in r && r.isThemeGetter === !0, Wr = (r) => {
|
|
1447
1470
|
if (r < 1)
|
|
1448
1471
|
return {
|
|
1449
1472
|
get: () => {
|
|
@@ -1452,71 +1475,71 @@ const Nr = (r, e) => {
|
|
|
1452
1475
|
}
|
|
1453
1476
|
};
|
|
1454
1477
|
let e = 0, t = /* @__PURE__ */ Object.create(null), o = /* @__PURE__ */ Object.create(null);
|
|
1455
|
-
const
|
|
1456
|
-
t[l] =
|
|
1478
|
+
const a = (l, i) => {
|
|
1479
|
+
t[l] = i, e++, e > r && (e = 0, o = t, t = /* @__PURE__ */ Object.create(null));
|
|
1457
1480
|
};
|
|
1458
1481
|
return {
|
|
1459
1482
|
get(l) {
|
|
1460
|
-
let
|
|
1461
|
-
if (
|
|
1462
|
-
return
|
|
1463
|
-
if ((
|
|
1464
|
-
return
|
|
1483
|
+
let i = t[l];
|
|
1484
|
+
if (i !== void 0)
|
|
1485
|
+
return i;
|
|
1486
|
+
if ((i = o[l]) !== void 0)
|
|
1487
|
+
return a(l, i), i;
|
|
1465
1488
|
},
|
|
1466
|
-
set(l,
|
|
1467
|
-
l in t ? t[l] =
|
|
1489
|
+
set(l, i) {
|
|
1490
|
+
l in t ? t[l] = i : a(l, i);
|
|
1468
1491
|
}
|
|
1469
1492
|
};
|
|
1470
|
-
},
|
|
1493
|
+
}, Ne = "!", _e = ":", Fr = [], Ge = (r, e, t, o, a) => ({
|
|
1471
1494
|
modifiers: r,
|
|
1472
1495
|
hasImportantModifier: e,
|
|
1473
1496
|
baseClassName: t,
|
|
1474
1497
|
maybePostfixModifierPosition: o,
|
|
1475
|
-
isExternal:
|
|
1498
|
+
isExternal: a
|
|
1476
1499
|
}), Ur = (r) => {
|
|
1477
1500
|
const {
|
|
1478
1501
|
prefix: e,
|
|
1479
1502
|
experimentalParseClassName: t
|
|
1480
1503
|
} = r;
|
|
1481
|
-
let o = (
|
|
1504
|
+
let o = (a) => {
|
|
1482
1505
|
const l = [];
|
|
1483
|
-
let
|
|
1484
|
-
const f =
|
|
1485
|
-
for (let
|
|
1486
|
-
const P =
|
|
1487
|
-
if (
|
|
1506
|
+
let i = 0, b = 0, d = 0, m;
|
|
1507
|
+
const f = a.length;
|
|
1508
|
+
for (let B = 0; B < f; B++) {
|
|
1509
|
+
const P = a[B];
|
|
1510
|
+
if (i === 0 && b === 0) {
|
|
1488
1511
|
if (P === _e) {
|
|
1489
|
-
l.push(
|
|
1512
|
+
l.push(a.slice(d, B)), d = B + 1;
|
|
1490
1513
|
continue;
|
|
1491
1514
|
}
|
|
1492
1515
|
if (P === "/") {
|
|
1493
|
-
m =
|
|
1516
|
+
m = B;
|
|
1494
1517
|
continue;
|
|
1495
1518
|
}
|
|
1496
1519
|
}
|
|
1497
|
-
P === "[" ?
|
|
1520
|
+
P === "[" ? i++ : P === "]" ? i-- : P === "(" ? b++ : P === ")" && b--;
|
|
1498
1521
|
}
|
|
1499
|
-
const A = l.length === 0 ?
|
|
1500
|
-
let
|
|
1501
|
-
A.endsWith(
|
|
1522
|
+
const A = l.length === 0 ? a : a.slice(d);
|
|
1523
|
+
let R = A, z = !1;
|
|
1524
|
+
A.endsWith(Ne) ? (R = A.slice(0, -1), z = !0) : (
|
|
1502
1525
|
/**
|
|
1503
1526
|
* In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
|
|
1504
1527
|
* @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
|
|
1505
1528
|
*/
|
|
1506
|
-
A.startsWith(
|
|
1529
|
+
A.startsWith(Ne) && (R = A.slice(1), z = !0)
|
|
1507
1530
|
);
|
|
1508
|
-
const
|
|
1509
|
-
return Ge(l, z,
|
|
1531
|
+
const j = m && m > d ? m - d : void 0;
|
|
1532
|
+
return Ge(l, z, R, j);
|
|
1510
1533
|
};
|
|
1511
1534
|
if (e) {
|
|
1512
|
-
const
|
|
1513
|
-
o = (
|
|
1535
|
+
const a = e + _e, l = o;
|
|
1536
|
+
o = (i) => i.startsWith(a) ? l(i.slice(a.length)) : Ge(Fr, !1, i, void 0, !0);
|
|
1514
1537
|
}
|
|
1515
1538
|
if (t) {
|
|
1516
|
-
const
|
|
1539
|
+
const a = o;
|
|
1517
1540
|
o = (l) => t({
|
|
1518
1541
|
className: l,
|
|
1519
|
-
parseClassName:
|
|
1542
|
+
parseClassName: a
|
|
1520
1543
|
});
|
|
1521
1544
|
}
|
|
1522
1545
|
return o;
|
|
@@ -1526,15 +1549,15 @@ const Nr = (r, e) => {
|
|
|
1526
1549
|
e.set(t, 1e6 + o);
|
|
1527
1550
|
}), (t) => {
|
|
1528
1551
|
const o = [];
|
|
1529
|
-
let
|
|
1552
|
+
let a = [];
|
|
1530
1553
|
for (let l = 0; l < t.length; l++) {
|
|
1531
|
-
const
|
|
1532
|
-
b || d ? (
|
|
1554
|
+
const i = t[l], b = i[0] === "[", d = e.has(i);
|
|
1555
|
+
b || d ? (a.length > 0 && (a.sort(), o.push(...a), a = []), o.push(i)) : a.push(i);
|
|
1533
1556
|
}
|
|
1534
|
-
return
|
|
1557
|
+
return a.length > 0 && (a.sort(), o.push(...a)), o;
|
|
1535
1558
|
};
|
|
1536
1559
|
}, _r = (r) => ({
|
|
1537
|
-
cache:
|
|
1560
|
+
cache: Wr(r.cacheSize),
|
|
1538
1561
|
parseClassName: Ur(r),
|
|
1539
1562
|
sortModifiers: Lr(r),
|
|
1540
1563
|
...Ir(r)
|
|
@@ -1542,51 +1565,51 @@ const Nr = (r, e) => {
|
|
|
1542
1565
|
const {
|
|
1543
1566
|
parseClassName: t,
|
|
1544
1567
|
getClassGroupId: o,
|
|
1545
|
-
getConflictingClassGroupIds:
|
|
1568
|
+
getConflictingClassGroupIds: a,
|
|
1546
1569
|
sortModifiers: l
|
|
1547
|
-
} = e,
|
|
1570
|
+
} = e, i = [], b = r.trim().split(Gr);
|
|
1548
1571
|
let d = "";
|
|
1549
1572
|
for (let m = b.length - 1; m >= 0; m -= 1) {
|
|
1550
1573
|
const f = b[m], {
|
|
1551
1574
|
isExternal: A,
|
|
1552
|
-
modifiers:
|
|
1575
|
+
modifiers: R,
|
|
1553
1576
|
hasImportantModifier: z,
|
|
1554
|
-
baseClassName:
|
|
1555
|
-
maybePostfixModifierPosition:
|
|
1577
|
+
baseClassName: j,
|
|
1578
|
+
maybePostfixModifierPosition: B
|
|
1556
1579
|
} = t(f);
|
|
1557
1580
|
if (A) {
|
|
1558
1581
|
d = f + (d.length > 0 ? " " + d : d);
|
|
1559
1582
|
continue;
|
|
1560
1583
|
}
|
|
1561
|
-
let P = !!
|
|
1584
|
+
let P = !!B, G = o(P ? j.substring(0, B) : j);
|
|
1562
1585
|
if (!G) {
|
|
1563
1586
|
if (!P) {
|
|
1564
1587
|
d = f + (d.length > 0 ? " " + d : d);
|
|
1565
1588
|
continue;
|
|
1566
1589
|
}
|
|
1567
|
-
if (G = o(
|
|
1590
|
+
if (G = o(j), !G) {
|
|
1568
1591
|
d = f + (d.length > 0 ? " " + d : d);
|
|
1569
1592
|
continue;
|
|
1570
1593
|
}
|
|
1571
1594
|
P = !1;
|
|
1572
1595
|
}
|
|
1573
|
-
const K =
|
|
1574
|
-
if (
|
|
1596
|
+
const K = R.length === 0 ? "" : R.length === 1 ? R[0] : l(R).join(":"), Q = z ? K + Ne : K, M = Q + G;
|
|
1597
|
+
if (i.indexOf(M) > -1)
|
|
1575
1598
|
continue;
|
|
1576
|
-
|
|
1577
|
-
const L =
|
|
1599
|
+
i.push(M);
|
|
1600
|
+
const L = a(G, P);
|
|
1578
1601
|
for (let _ = 0; _ < L.length; ++_) {
|
|
1579
1602
|
const q = L[_];
|
|
1580
|
-
|
|
1603
|
+
i.push(Q + q);
|
|
1581
1604
|
}
|
|
1582
1605
|
d = f + (d.length > 0 ? " " + d : d);
|
|
1583
1606
|
}
|
|
1584
1607
|
return d;
|
|
1585
1608
|
}, qr = (...r) => {
|
|
1586
|
-
let e = 0, t, o,
|
|
1609
|
+
let e = 0, t, o, a = "";
|
|
1587
1610
|
for (; e < r.length; )
|
|
1588
|
-
(t = r[e++]) && (o = er(t)) && (
|
|
1589
|
-
return
|
|
1611
|
+
(t = r[e++]) && (o = er(t)) && (a && (a += " "), a += o);
|
|
1612
|
+
return a;
|
|
1590
1613
|
}, er = (r) => {
|
|
1591
1614
|
if (typeof r == "string")
|
|
1592
1615
|
return r;
|
|
@@ -1595,18 +1618,18 @@ const Nr = (r, e) => {
|
|
|
1595
1618
|
r[o] && (e = er(r[o])) && (t && (t += " "), t += e);
|
|
1596
1619
|
return t;
|
|
1597
1620
|
}, Kr = (r, ...e) => {
|
|
1598
|
-
let t, o,
|
|
1599
|
-
const
|
|
1621
|
+
let t, o, a, l;
|
|
1622
|
+
const i = (d) => {
|
|
1600
1623
|
const m = e.reduce((f, A) => A(f), r());
|
|
1601
|
-
return t = _r(m), o = t.cache.get,
|
|
1624
|
+
return t = _r(m), o = t.cache.get, a = t.cache.set, l = b, b(d);
|
|
1602
1625
|
}, b = (d) => {
|
|
1603
1626
|
const m = o(d);
|
|
1604
1627
|
if (m)
|
|
1605
1628
|
return m;
|
|
1606
1629
|
const f = Qr(d, t);
|
|
1607
|
-
return
|
|
1630
|
+
return a(d, f), f;
|
|
1608
1631
|
};
|
|
1609
|
-
return l =
|
|
1632
|
+
return l = i, (...d) => l(qr(...d));
|
|
1610
1633
|
}, Jr = [], T = (r) => {
|
|
1611
1634
|
const e = (t) => t[r] || Jr;
|
|
1612
1635
|
return e.isThemeGetter = !0, e;
|
|
@@ -1622,7 +1645,7 @@ const Nr = (r, e) => {
|
|
|
1622
1645
|
const o = tr.exec(r);
|
|
1623
1646
|
return o ? o[1] ? e(o[1]) : t : !1;
|
|
1624
1647
|
}, ar = (r) => r === "position" || r === "percentage", ir = (r) => r === "image" || r === "url", nr = (r) => r === "length" || r === "size" || r === "bg-size", sr = (r) => r === "length", ht = (r) => r === "number", ut = (r) => r === "family-name", lr = (r) => r === "shadow", pt = () => {
|
|
1625
|
-
const r = T("color"), e = T("font"), t = T("text"), o = T("font-weight"),
|
|
1648
|
+
const r = T("color"), e = T("font"), t = T("text"), o = T("font-weight"), a = T("tracking"), l = T("leading"), i = T("breakpoint"), b = T("container"), d = T("spacing"), m = T("radius"), f = T("shadow"), A = T("inset-shadow"), R = T("text-shadow"), z = T("drop-shadow"), j = T("blur"), B = T("perspective"), P = T("aspect"), G = T("ease"), K = T("animate"), Q = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], M = () => [
|
|
1626
1649
|
"center",
|
|
1627
1650
|
"top",
|
|
1628
1651
|
"bottom",
|
|
@@ -1640,15 +1663,15 @@ const Nr = (r, e) => {
|
|
|
1640
1663
|
"bottom-left",
|
|
1641
1664
|
// Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
|
|
1642
1665
|
"left-bottom"
|
|
1643
|
-
], L = () => [...M(), h, g], _ = () => ["auto", "hidden", "clip", "visible", "scroll"], q = () => ["auto", "contain", "none"], y = () => [h, g, d],
|
|
1666
|
+
], L = () => [...M(), h, g], _ = () => ["auto", "hidden", "clip", "visible", "scroll"], q = () => ["auto", "contain", "none"], y = () => [h, g, d], D = () => [pe, "full", "auto", ...y()], s = () => [te, "none", "subgrid", h, g], O = () => ["auto", {
|
|
1644
1667
|
span: ["full", te, h, g]
|
|
1645
|
-
}, te, h, g], Y = () => [te, "auto", h, g], re = () => ["auto", "min", "max", "fr", h, g], J = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], w = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"], p = () => ["auto", ...y()],
|
|
1668
|
+
}, te, h, g], Y = () => [te, "auto", h, g], re = () => ["auto", "min", "max", "fr", h, g], J = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], w = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"], p = () => ["auto", ...y()], H = () => [pe, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...y()], v = () => [r, h, g], le = () => [...M(), qe, Qe, {
|
|
1646
1669
|
position: [h, g]
|
|
1647
1670
|
}], ce = () => ["no-repeat", {
|
|
1648
1671
|
repeat: ["", "x", "y", "space", "round"]
|
|
1649
1672
|
}], de = () => ["auto", "cover", "contain", dt, st, {
|
|
1650
1673
|
size: [h, g]
|
|
1651
|
-
}], oe = () => [Me, ye, se],
|
|
1674
|
+
}], oe = () => [Me, ye, se], N = () => [
|
|
1652
1675
|
// Deprecated since Tailwind CSS v4.0.0
|
|
1653
1676
|
"",
|
|
1654
1677
|
"none",
|
|
@@ -1656,11 +1679,11 @@ const Nr = (r, e) => {
|
|
|
1656
1679
|
m,
|
|
1657
1680
|
h,
|
|
1658
1681
|
g
|
|
1659
|
-
],
|
|
1682
|
+
], W = () => ["", x, ye, se], X = () => ["solid", "dashed", "dotted", "double"], ae = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], C = () => [x, Me, qe, Qe], ge = () => [
|
|
1660
1683
|
// Deprecated since Tailwind CSS v4.0.0
|
|
1661
1684
|
"",
|
|
1662
1685
|
"none",
|
|
1663
|
-
|
|
1686
|
+
j,
|
|
1664
1687
|
h,
|
|
1665
1688
|
g
|
|
1666
1689
|
], ie = () => ["none", x, h, g], he = () => ["none", x, h, g], be = () => [x, h, g], ue = () => [pe, "full", ...y()];
|
|
@@ -1841,63 +1864,63 @@ const Nr = (r, e) => {
|
|
|
1841
1864
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1842
1865
|
*/
|
|
1843
1866
|
inset: [{
|
|
1844
|
-
inset:
|
|
1867
|
+
inset: D()
|
|
1845
1868
|
}],
|
|
1846
1869
|
/**
|
|
1847
1870
|
* Right / Left
|
|
1848
1871
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1849
1872
|
*/
|
|
1850
1873
|
"inset-x": [{
|
|
1851
|
-
"inset-x":
|
|
1874
|
+
"inset-x": D()
|
|
1852
1875
|
}],
|
|
1853
1876
|
/**
|
|
1854
1877
|
* Top / Bottom
|
|
1855
1878
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1856
1879
|
*/
|
|
1857
1880
|
"inset-y": [{
|
|
1858
|
-
"inset-y":
|
|
1881
|
+
"inset-y": D()
|
|
1859
1882
|
}],
|
|
1860
1883
|
/**
|
|
1861
1884
|
* Start
|
|
1862
1885
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1863
1886
|
*/
|
|
1864
1887
|
start: [{
|
|
1865
|
-
start:
|
|
1888
|
+
start: D()
|
|
1866
1889
|
}],
|
|
1867
1890
|
/**
|
|
1868
1891
|
* End
|
|
1869
1892
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1870
1893
|
*/
|
|
1871
1894
|
end: [{
|
|
1872
|
-
end:
|
|
1895
|
+
end: D()
|
|
1873
1896
|
}],
|
|
1874
1897
|
/**
|
|
1875
1898
|
* Top
|
|
1876
1899
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1877
1900
|
*/
|
|
1878
1901
|
top: [{
|
|
1879
|
-
top:
|
|
1902
|
+
top: D()
|
|
1880
1903
|
}],
|
|
1881
1904
|
/**
|
|
1882
1905
|
* Right
|
|
1883
1906
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1884
1907
|
*/
|
|
1885
1908
|
right: [{
|
|
1886
|
-
right:
|
|
1909
|
+
right: D()
|
|
1887
1910
|
}],
|
|
1888
1911
|
/**
|
|
1889
1912
|
* Bottom
|
|
1890
1913
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1891
1914
|
*/
|
|
1892
1915
|
bottom: [{
|
|
1893
|
-
bottom:
|
|
1916
|
+
bottom: D()
|
|
1894
1917
|
}],
|
|
1895
1918
|
/**
|
|
1896
1919
|
* Left
|
|
1897
1920
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1898
1921
|
*/
|
|
1899
1922
|
left: [{
|
|
1900
|
-
left:
|
|
1923
|
+
left: D()
|
|
1901
1924
|
}],
|
|
1902
1925
|
/**
|
|
1903
1926
|
* Visibility
|
|
@@ -2287,14 +2310,14 @@ const Nr = (r, e) => {
|
|
|
2287
2310
|
* @see https://tailwindcss.com/docs/width#setting-both-width-and-height
|
|
2288
2311
|
*/
|
|
2289
2312
|
size: [{
|
|
2290
|
-
size:
|
|
2313
|
+
size: H()
|
|
2291
2314
|
}],
|
|
2292
2315
|
/**
|
|
2293
2316
|
* Width
|
|
2294
2317
|
* @see https://tailwindcss.com/docs/width
|
|
2295
2318
|
*/
|
|
2296
2319
|
w: [{
|
|
2297
|
-
w: [b, "screen", ...
|
|
2320
|
+
w: [b, "screen", ...H()]
|
|
2298
2321
|
}],
|
|
2299
2322
|
/**
|
|
2300
2323
|
* Min-Width
|
|
@@ -2306,7 +2329,7 @@ const Nr = (r, e) => {
|
|
|
2306
2329
|
"screen",
|
|
2307
2330
|
/** Deprecated. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
|
|
2308
2331
|
"none",
|
|
2309
|
-
...
|
|
2332
|
+
...H()
|
|
2310
2333
|
]
|
|
2311
2334
|
}],
|
|
2312
2335
|
/**
|
|
@@ -2322,9 +2345,9 @@ const Nr = (r, e) => {
|
|
|
2322
2345
|
"prose",
|
|
2323
2346
|
/** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
|
|
2324
2347
|
{
|
|
2325
|
-
screen: [
|
|
2348
|
+
screen: [i]
|
|
2326
2349
|
},
|
|
2327
|
-
...
|
|
2350
|
+
...H()
|
|
2328
2351
|
]
|
|
2329
2352
|
}],
|
|
2330
2353
|
/**
|
|
@@ -2332,21 +2355,21 @@ const Nr = (r, e) => {
|
|
|
2332
2355
|
* @see https://tailwindcss.com/docs/height
|
|
2333
2356
|
*/
|
|
2334
2357
|
h: [{
|
|
2335
|
-
h: ["screen", "lh", ...
|
|
2358
|
+
h: ["screen", "lh", ...H()]
|
|
2336
2359
|
}],
|
|
2337
2360
|
/**
|
|
2338
2361
|
* Min-Height
|
|
2339
2362
|
* @see https://tailwindcss.com/docs/min-height
|
|
2340
2363
|
*/
|
|
2341
2364
|
"min-h": [{
|
|
2342
|
-
"min-h": ["screen", "lh", "none", ...
|
|
2365
|
+
"min-h": ["screen", "lh", "none", ...H()]
|
|
2343
2366
|
}],
|
|
2344
2367
|
/**
|
|
2345
2368
|
* Max-Height
|
|
2346
2369
|
* @see https://tailwindcss.com/docs/max-height
|
|
2347
2370
|
*/
|
|
2348
2371
|
"max-h": [{
|
|
2349
|
-
"max-h": ["screen", "lh", ...
|
|
2372
|
+
"max-h": ["screen", "lh", ...H()]
|
|
2350
2373
|
}],
|
|
2351
2374
|
// ------------------
|
|
2352
2375
|
// --- Typography ---
|
|
@@ -2424,7 +2447,7 @@ const Nr = (r, e) => {
|
|
|
2424
2447
|
* @see https://tailwindcss.com/docs/letter-spacing
|
|
2425
2448
|
*/
|
|
2426
2449
|
tracking: [{
|
|
2427
|
-
tracking: [
|
|
2450
|
+
tracking: [a, h, g]
|
|
2428
2451
|
}],
|
|
2429
2452
|
/**
|
|
2430
2453
|
* Line Clamp
|
|
@@ -2701,175 +2724,175 @@ const Nr = (r, e) => {
|
|
|
2701
2724
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2702
2725
|
*/
|
|
2703
2726
|
rounded: [{
|
|
2704
|
-
rounded:
|
|
2727
|
+
rounded: N()
|
|
2705
2728
|
}],
|
|
2706
2729
|
/**
|
|
2707
2730
|
* Border Radius Start
|
|
2708
2731
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2709
2732
|
*/
|
|
2710
2733
|
"rounded-s": [{
|
|
2711
|
-
"rounded-s":
|
|
2734
|
+
"rounded-s": N()
|
|
2712
2735
|
}],
|
|
2713
2736
|
/**
|
|
2714
2737
|
* Border Radius End
|
|
2715
2738
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2716
2739
|
*/
|
|
2717
2740
|
"rounded-e": [{
|
|
2718
|
-
"rounded-e":
|
|
2741
|
+
"rounded-e": N()
|
|
2719
2742
|
}],
|
|
2720
2743
|
/**
|
|
2721
2744
|
* Border Radius Top
|
|
2722
2745
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2723
2746
|
*/
|
|
2724
2747
|
"rounded-t": [{
|
|
2725
|
-
"rounded-t":
|
|
2748
|
+
"rounded-t": N()
|
|
2726
2749
|
}],
|
|
2727
2750
|
/**
|
|
2728
2751
|
* Border Radius Right
|
|
2729
2752
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2730
2753
|
*/
|
|
2731
2754
|
"rounded-r": [{
|
|
2732
|
-
"rounded-r":
|
|
2755
|
+
"rounded-r": N()
|
|
2733
2756
|
}],
|
|
2734
2757
|
/**
|
|
2735
2758
|
* Border Radius Bottom
|
|
2736
2759
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2737
2760
|
*/
|
|
2738
2761
|
"rounded-b": [{
|
|
2739
|
-
"rounded-b":
|
|
2762
|
+
"rounded-b": N()
|
|
2740
2763
|
}],
|
|
2741
2764
|
/**
|
|
2742
2765
|
* Border Radius Left
|
|
2743
2766
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2744
2767
|
*/
|
|
2745
2768
|
"rounded-l": [{
|
|
2746
|
-
"rounded-l":
|
|
2769
|
+
"rounded-l": N()
|
|
2747
2770
|
}],
|
|
2748
2771
|
/**
|
|
2749
2772
|
* Border Radius Start Start
|
|
2750
2773
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2751
2774
|
*/
|
|
2752
2775
|
"rounded-ss": [{
|
|
2753
|
-
"rounded-ss":
|
|
2776
|
+
"rounded-ss": N()
|
|
2754
2777
|
}],
|
|
2755
2778
|
/**
|
|
2756
2779
|
* Border Radius Start End
|
|
2757
2780
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2758
2781
|
*/
|
|
2759
2782
|
"rounded-se": [{
|
|
2760
|
-
"rounded-se":
|
|
2783
|
+
"rounded-se": N()
|
|
2761
2784
|
}],
|
|
2762
2785
|
/**
|
|
2763
2786
|
* Border Radius End End
|
|
2764
2787
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2765
2788
|
*/
|
|
2766
2789
|
"rounded-ee": [{
|
|
2767
|
-
"rounded-ee":
|
|
2790
|
+
"rounded-ee": N()
|
|
2768
2791
|
}],
|
|
2769
2792
|
/**
|
|
2770
2793
|
* Border Radius End Start
|
|
2771
2794
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2772
2795
|
*/
|
|
2773
2796
|
"rounded-es": [{
|
|
2774
|
-
"rounded-es":
|
|
2797
|
+
"rounded-es": N()
|
|
2775
2798
|
}],
|
|
2776
2799
|
/**
|
|
2777
2800
|
* Border Radius Top Left
|
|
2778
2801
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2779
2802
|
*/
|
|
2780
2803
|
"rounded-tl": [{
|
|
2781
|
-
"rounded-tl":
|
|
2804
|
+
"rounded-tl": N()
|
|
2782
2805
|
}],
|
|
2783
2806
|
/**
|
|
2784
2807
|
* Border Radius Top Right
|
|
2785
2808
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2786
2809
|
*/
|
|
2787
2810
|
"rounded-tr": [{
|
|
2788
|
-
"rounded-tr":
|
|
2811
|
+
"rounded-tr": N()
|
|
2789
2812
|
}],
|
|
2790
2813
|
/**
|
|
2791
2814
|
* Border Radius Bottom Right
|
|
2792
2815
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2793
2816
|
*/
|
|
2794
2817
|
"rounded-br": [{
|
|
2795
|
-
"rounded-br":
|
|
2818
|
+
"rounded-br": N()
|
|
2796
2819
|
}],
|
|
2797
2820
|
/**
|
|
2798
2821
|
* Border Radius Bottom Left
|
|
2799
2822
|
* @see https://tailwindcss.com/docs/border-radius
|
|
2800
2823
|
*/
|
|
2801
2824
|
"rounded-bl": [{
|
|
2802
|
-
"rounded-bl":
|
|
2825
|
+
"rounded-bl": N()
|
|
2803
2826
|
}],
|
|
2804
2827
|
/**
|
|
2805
2828
|
* Border Width
|
|
2806
2829
|
* @see https://tailwindcss.com/docs/border-width
|
|
2807
2830
|
*/
|
|
2808
2831
|
"border-w": [{
|
|
2809
|
-
border:
|
|
2832
|
+
border: W()
|
|
2810
2833
|
}],
|
|
2811
2834
|
/**
|
|
2812
2835
|
* Border Width X
|
|
2813
2836
|
* @see https://tailwindcss.com/docs/border-width
|
|
2814
2837
|
*/
|
|
2815
2838
|
"border-w-x": [{
|
|
2816
|
-
"border-x":
|
|
2839
|
+
"border-x": W()
|
|
2817
2840
|
}],
|
|
2818
2841
|
/**
|
|
2819
2842
|
* Border Width Y
|
|
2820
2843
|
* @see https://tailwindcss.com/docs/border-width
|
|
2821
2844
|
*/
|
|
2822
2845
|
"border-w-y": [{
|
|
2823
|
-
"border-y":
|
|
2846
|
+
"border-y": W()
|
|
2824
2847
|
}],
|
|
2825
2848
|
/**
|
|
2826
2849
|
* Border Width Start
|
|
2827
2850
|
* @see https://tailwindcss.com/docs/border-width
|
|
2828
2851
|
*/
|
|
2829
2852
|
"border-w-s": [{
|
|
2830
|
-
"border-s":
|
|
2853
|
+
"border-s": W()
|
|
2831
2854
|
}],
|
|
2832
2855
|
/**
|
|
2833
2856
|
* Border Width End
|
|
2834
2857
|
* @see https://tailwindcss.com/docs/border-width
|
|
2835
2858
|
*/
|
|
2836
2859
|
"border-w-e": [{
|
|
2837
|
-
"border-e":
|
|
2860
|
+
"border-e": W()
|
|
2838
2861
|
}],
|
|
2839
2862
|
/**
|
|
2840
2863
|
* Border Width Top
|
|
2841
2864
|
* @see https://tailwindcss.com/docs/border-width
|
|
2842
2865
|
*/
|
|
2843
2866
|
"border-w-t": [{
|
|
2844
|
-
"border-t":
|
|
2867
|
+
"border-t": W()
|
|
2845
2868
|
}],
|
|
2846
2869
|
/**
|
|
2847
2870
|
* Border Width Right
|
|
2848
2871
|
* @see https://tailwindcss.com/docs/border-width
|
|
2849
2872
|
*/
|
|
2850
2873
|
"border-w-r": [{
|
|
2851
|
-
"border-r":
|
|
2874
|
+
"border-r": W()
|
|
2852
2875
|
}],
|
|
2853
2876
|
/**
|
|
2854
2877
|
* Border Width Bottom
|
|
2855
2878
|
* @see https://tailwindcss.com/docs/border-width
|
|
2856
2879
|
*/
|
|
2857
2880
|
"border-w-b": [{
|
|
2858
|
-
"border-b":
|
|
2881
|
+
"border-b": W()
|
|
2859
2882
|
}],
|
|
2860
2883
|
/**
|
|
2861
2884
|
* Border Width Left
|
|
2862
2885
|
* @see https://tailwindcss.com/docs/border-width
|
|
2863
2886
|
*/
|
|
2864
2887
|
"border-w-l": [{
|
|
2865
|
-
"border-l":
|
|
2888
|
+
"border-l": W()
|
|
2866
2889
|
}],
|
|
2867
2890
|
/**
|
|
2868
2891
|
* Divide Width X
|
|
2869
2892
|
* @see https://tailwindcss.com/docs/border-width#between-children
|
|
2870
2893
|
*/
|
|
2871
2894
|
"divide-x": [{
|
|
2872
|
-
"divide-x":
|
|
2895
|
+
"divide-x": W()
|
|
2873
2896
|
}],
|
|
2874
2897
|
/**
|
|
2875
2898
|
* Divide Width X Reverse
|
|
@@ -2881,7 +2904,7 @@ const Nr = (r, e) => {
|
|
|
2881
2904
|
* @see https://tailwindcss.com/docs/border-width#between-children
|
|
2882
2905
|
*/
|
|
2883
2906
|
"divide-y": [{
|
|
2884
|
-
"divide-y":
|
|
2907
|
+
"divide-y": W()
|
|
2885
2908
|
}],
|
|
2886
2909
|
/**
|
|
2887
2910
|
* Divide Width Y Reverse
|
|
@@ -3043,7 +3066,7 @@ const Nr = (r, e) => {
|
|
|
3043
3066
|
* @see https://tailwindcss.com/docs/box-shadow#adding-a-ring
|
|
3044
3067
|
*/
|
|
3045
3068
|
"ring-w": [{
|
|
3046
|
-
ring:
|
|
3069
|
+
ring: W()
|
|
3047
3070
|
}],
|
|
3048
3071
|
/**
|
|
3049
3072
|
* Ring Width Inset
|
|
@@ -3082,7 +3105,7 @@ const Nr = (r, e) => {
|
|
|
3082
3105
|
* @see https://tailwindcss.com/docs/box-shadow#adding-an-inset-ring
|
|
3083
3106
|
*/
|
|
3084
3107
|
"inset-ring-w": [{
|
|
3085
|
-
"inset-ring":
|
|
3108
|
+
"inset-ring": W()
|
|
3086
3109
|
}],
|
|
3087
3110
|
/**
|
|
3088
3111
|
* Inset Ring Color
|
|
@@ -3096,7 +3119,7 @@ const Nr = (r, e) => {
|
|
|
3096
3119
|
* @see https://tailwindcss.com/docs/text-shadow
|
|
3097
3120
|
*/
|
|
3098
3121
|
"text-shadow": [{
|
|
3099
|
-
"text-shadow": ["none",
|
|
3122
|
+
"text-shadow": ["none", R, Se, ke]
|
|
3100
3123
|
}],
|
|
3101
3124
|
/**
|
|
3102
3125
|
* Text Shadow Color
|
|
@@ -3596,7 +3619,7 @@ const Nr = (r, e) => {
|
|
|
3596
3619
|
* @see https://tailwindcss.com/docs/perspective
|
|
3597
3620
|
*/
|
|
3598
3621
|
perspective: [{
|
|
3599
|
-
perspective: [
|
|
3622
|
+
perspective: [B, h, g]
|
|
3600
3623
|
}],
|
|
3601
3624
|
/**
|
|
3602
3625
|
* Perspective Origin
|
|
@@ -4100,7 +4123,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4100
4123
|
triggerLabel: e,
|
|
4101
4124
|
container: t
|
|
4102
4125
|
}) => {
|
|
4103
|
-
const [o,
|
|
4126
|
+
const [o, a] = I(!1), [l, i] = I(!1), [b, d] = I(!1), [m, f] = I(!1), [A, R] = I([]), [z, j] = I(""), [B, P] = I(!1), [G, K] = I(!1), [Q, M] = I(null), [, L] = I("user"), [_, q] = I("bottom-right"), [y, D] = I({
|
|
4104
4127
|
isActive: !1,
|
|
4105
4128
|
toolName: null,
|
|
4106
4129
|
toolData: null
|
|
@@ -4112,10 +4135,10 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4112
4135
|
lastError: null,
|
|
4113
4136
|
isPreloaded: !1,
|
|
4114
4137
|
isRefreshing: !1
|
|
4115
|
-
}), [Y, re] = I("idle"), [, J] = I(!1), w = me(null), p = me(null),
|
|
4138
|
+
}), [Y, re] = I("idle"), [, J] = I(!1), w = me(null), p = me(null), H = V((u) => {
|
|
4116
4139
|
const { newStatus: k } = u.data;
|
|
4117
4140
|
re(k), k === "preloading" || k === "connecting" ? o && f(!0) : k === "ready" ? (f(!1), d(!0)) : k === "error" && f(!1);
|
|
4118
|
-
}, [o]), v =
|
|
4141
|
+
}, [o]), v = V((u) => {
|
|
4119
4142
|
const k = u.data;
|
|
4120
4143
|
if (console.log("[AriaStandaloneUI] Session ready event:", k), w.current) {
|
|
4121
4144
|
const F = w.current.getSessionState();
|
|
@@ -4123,43 +4146,43 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4123
4146
|
const ne = k?.lazyInit === !0;
|
|
4124
4147
|
k?.streamReady === !0 ? (p.current && (console.log("[AriaStandaloneUI] Attaching video stream after full session ready (streamReady=true)"), w.current.attachToVideoElement(p.current)), d(!0), f(!1), M(null)) : ne ? console.log("[AriaStandaloneUI] Token ready (lazy init), button enabled") : (p.current && (console.log("[AriaStandaloneUI] Attaching video stream (legacy event)"), w.current.attachToVideoElement(p.current)), d(!0), f(!1), M(null));
|
|
4125
4148
|
}
|
|
4126
|
-
}, []), le =
|
|
4149
|
+
}, []), le = V((u) => {
|
|
4127
4150
|
const k = u.error?.message || "Session error";
|
|
4128
4151
|
if (console.error("[AriaStandaloneUI] Session error:", k), M(k), f(!1), w.current) {
|
|
4129
4152
|
const F = w.current.getSessionState();
|
|
4130
4153
|
O(F);
|
|
4131
4154
|
}
|
|
4132
|
-
}, []), ce =
|
|
4155
|
+
}, []), ce = V((u) => {
|
|
4133
4156
|
const { connected: k } = u.data;
|
|
4134
4157
|
if (d(k), !k && w.current) {
|
|
4135
4158
|
const F = w.current.getSessionState();
|
|
4136
4159
|
O(F);
|
|
4137
4160
|
}
|
|
4138
|
-
}, []), de =
|
|
4161
|
+
}, []), de = V((u) => {
|
|
4139
4162
|
const { messages: k } = u.data;
|
|
4140
|
-
k &&
|
|
4141
|
-
}, []), oe =
|
|
4163
|
+
k && R(k);
|
|
4164
|
+
}, []), oe = V((u) => {
|
|
4142
4165
|
const { liveTranscript: k } = u.data;
|
|
4143
|
-
k !== void 0 &&
|
|
4144
|
-
}, []),
|
|
4166
|
+
k !== void 0 && j(k);
|
|
4167
|
+
}, []), N = V((u) => {
|
|
4145
4168
|
const k = u.data;
|
|
4146
|
-
|
|
4169
|
+
D({
|
|
4147
4170
|
isActive: k.isActive,
|
|
4148
4171
|
toolName: k.toolName,
|
|
4149
4172
|
toolData: k.toolData
|
|
4150
4173
|
});
|
|
4151
|
-
}, []),
|
|
4174
|
+
}, []), W = V((u) => {
|
|
4152
4175
|
const k = p.current;
|
|
4153
4176
|
p.current = u, u && w.current ? w.current.getVideoStream() !== null ? (console.log("[AriaStandaloneUI] Attaching video stream to element"), w.current.attachToVideoElement(u)) : console.log("[AriaStandaloneUI] Video element registered, waiting for stream to be ready") : !u && k && w.current && (console.log("[AriaStandaloneUI] Detaching video stream from element"), w.current.detachFromVideoElement(k));
|
|
4154
|
-
}, []), X =
|
|
4155
|
-
if (L(u), q(u === "websocket" ? "center" : "bottom-right"),
|
|
4177
|
+
}, []), X = V((u = "user") => {
|
|
4178
|
+
if (L(u), q(u === "websocket" ? "center" : "bottom-right"), a(!0), i(!1), M(null), !w.current) return;
|
|
4156
4179
|
const k = w.current.isSessionPaused();
|
|
4157
4180
|
if (console.log("[AriaStandaloneUI] openAssistant called, isPaused:", k), k) {
|
|
4158
4181
|
f(!0), w.current.resumeSession().then((Z) => {
|
|
4159
4182
|
if (J(!1), Z) {
|
|
4160
4183
|
f(!1), d(!0);
|
|
4161
4184
|
const Pe = w.current.getSessionState();
|
|
4162
|
-
O(Pe),
|
|
4185
|
+
O(Pe), R(w.current.getChatMessages()), p.current && w.current && (console.log("[AriaStandaloneUI] Attaching video stream after resume"), w.current.attachToVideoElement(p.current));
|
|
4163
4186
|
} else
|
|
4164
4187
|
w.current.hasSessionToken() ? w.current.initializeSessionOnDemand().then(() => {
|
|
4165
4188
|
f(!1), d(!0);
|
|
@@ -4181,13 +4204,13 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4181
4204
|
}).catch((Z) => {
|
|
4182
4205
|
f(!1), M(Z instanceof Error ? Z.message : "Failed to initialize session");
|
|
4183
4206
|
})) : (console.warn("[AriaStandaloneUI] No token available, button should have been disabled"), M("Session not ready. Please wait and try again."));
|
|
4184
|
-
}, []), ae =
|
|
4185
|
-
|
|
4186
|
-
}, []), C =
|
|
4187
|
-
|
|
4188
|
-
}, []), ge =
|
|
4189
|
-
|
|
4190
|
-
}, []), ie =
|
|
4207
|
+
}, []), ae = V(() => {
|
|
4208
|
+
i(!0);
|
|
4209
|
+
}, []), C = V(() => {
|
|
4210
|
+
i(!1);
|
|
4211
|
+
}, []), ge = V(() => {
|
|
4212
|
+
a(!1), i(!1), w.current && (p.current && w.current.detachFromVideoElement(p.current), j(""), console.log("[AriaStandaloneUI] Pausing session (widget closed)"), w.current.pauseSession(), J(!0));
|
|
4213
|
+
}, []), ie = V(() => {
|
|
4191
4214
|
console.log("[AriaStandaloneUI] WebSocket trigger event"), X("websocket");
|
|
4192
4215
|
}, [X]);
|
|
4193
4216
|
ee(() => {
|
|
@@ -4196,21 +4219,21 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4196
4219
|
return;
|
|
4197
4220
|
}
|
|
4198
4221
|
const u = U.getInstance({});
|
|
4199
|
-
return w.current = u, u.addEventListener("status_change",
|
|
4200
|
-
O(u.getSessionState()), re(u.getStatus()), d(u.isConnected()),
|
|
4222
|
+
return w.current = u, u.addEventListener("status_change", H), u.addEventListener("session_ready", v), u.addEventListener("session_error", le), u.addEventListener("connection_change", ce), u.addEventListener("message_history", de), u.addEventListener("message_stream", oe), u.addEventListener("tool_call", N), u.setWebSocketTriggerCallback(ie), queueMicrotask(() => {
|
|
4223
|
+
O(u.getSessionState()), re(u.getStatus()), d(u.isConnected()), R(u.getChatMessages()), j(u.getLiveTranscript()), K(u.isMuted()), J(u.isSessionPaused());
|
|
4201
4224
|
const F = u.getToolCallState();
|
|
4202
|
-
|
|
4225
|
+
D(F);
|
|
4203
4226
|
}), () => {
|
|
4204
|
-
u.removeEventListener("status_change",
|
|
4227
|
+
u.removeEventListener("status_change", H), u.removeEventListener("session_ready", v), u.removeEventListener("session_error", le), u.removeEventListener("connection_change", ce), u.removeEventListener("message_history", de), u.removeEventListener("message_stream", oe), u.removeEventListener("tool_call", N), u.setWebSocketTriggerCallback(null);
|
|
4205
4228
|
};
|
|
4206
4229
|
}, [
|
|
4207
|
-
|
|
4230
|
+
H,
|
|
4208
4231
|
v,
|
|
4209
4232
|
le,
|
|
4210
4233
|
ce,
|
|
4211
4234
|
de,
|
|
4212
4235
|
oe,
|
|
4213
|
-
|
|
4236
|
+
N,
|
|
4214
4237
|
ie
|
|
4215
4238
|
]), ee(() => {
|
|
4216
4239
|
const u = (ve) => {
|
|
@@ -4228,22 +4251,22 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4228
4251
|
}, [X, ge, ae, C]), ee(() => {
|
|
4229
4252
|
t.setAttribute("data-aria-open", String(o));
|
|
4230
4253
|
}, [o, t]);
|
|
4231
|
-
const he =
|
|
4254
|
+
const he = V(() => {
|
|
4232
4255
|
P((u) => !u);
|
|
4233
|
-
}, []), be =
|
|
4256
|
+
}, []), be = V(async (u) => {
|
|
4234
4257
|
if (!w.current || !b)
|
|
4235
4258
|
throw new Error("Not connected to Aria");
|
|
4236
4259
|
await w.current.sendMessage(u);
|
|
4237
|
-
}, [b]), ue =
|
|
4260
|
+
}, [b]), ue = V(() => {
|
|
4238
4261
|
if (!w.current) return;
|
|
4239
4262
|
const u = w.current.toggleMute();
|
|
4240
4263
|
K(u);
|
|
4241
|
-
}, []), cr =
|
|
4264
|
+
}, []), cr = V(() => {
|
|
4242
4265
|
w.current && (f(!0), M(null), w.current.refreshSession().catch((u) => {
|
|
4243
4266
|
M(u instanceof Error ? u.message : "Failed to refresh session"), f(!1);
|
|
4244
4267
|
}));
|
|
4245
4268
|
}, []);
|
|
4246
|
-
return /* @__PURE__ */ E(
|
|
4269
|
+
return /* @__PURE__ */ E(He, { children: [
|
|
4247
4270
|
!o && /* @__PURE__ */ n(
|
|
4248
4271
|
wt,
|
|
4249
4272
|
{
|
|
@@ -4254,7 +4277,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4254
4277
|
onClick: () => X("user")
|
|
4255
4278
|
}
|
|
4256
4279
|
),
|
|
4257
|
-
o && /* @__PURE__ */ E(
|
|
4280
|
+
o && /* @__PURE__ */ E(He, { children: [
|
|
4258
4281
|
!l && /* @__PURE__ */ n(
|
|
4259
4282
|
"div",
|
|
4260
4283
|
{
|
|
@@ -4296,12 +4319,12 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4296
4319
|
isLoading: m,
|
|
4297
4320
|
chatMessages: A,
|
|
4298
4321
|
liveTranscript: z,
|
|
4299
|
-
isChatVisible:
|
|
4322
|
+
isChatVisible: B,
|
|
4300
4323
|
isMuted: G,
|
|
4301
4324
|
error: Q,
|
|
4302
4325
|
toolCallState: y,
|
|
4303
4326
|
sessionState: s,
|
|
4304
|
-
setVideoElement:
|
|
4327
|
+
setVideoElement: W,
|
|
4305
4328
|
toggleChat: he,
|
|
4306
4329
|
sendMessage: be,
|
|
4307
4330
|
toggleMute: ue,
|
|
@@ -4317,9 +4340,9 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4317
4340
|
label: e,
|
|
4318
4341
|
theme: t,
|
|
4319
4342
|
isReady: o = !1,
|
|
4320
|
-
onClick:
|
|
4343
|
+
onClick: a
|
|
4321
4344
|
}) => {
|
|
4322
|
-
const l = t === "dark",
|
|
4345
|
+
const l = t === "dark", i = e || "Talk to Aria";
|
|
4323
4346
|
return /* @__PURE__ */ n(
|
|
4324
4347
|
Ke,
|
|
4325
4348
|
{
|
|
@@ -4334,7 +4357,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4334
4357
|
"button",
|
|
4335
4358
|
{
|
|
4336
4359
|
onClick: (b) => {
|
|
4337
|
-
b.preventDefault(), o &&
|
|
4360
|
+
b.preventDefault(), o && a();
|
|
4338
4361
|
},
|
|
4339
4362
|
disabled: !o,
|
|
4340
4363
|
className: c(
|
|
@@ -4367,7 +4390,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4367
4390
|
"img",
|
|
4368
4391
|
{
|
|
4369
4392
|
src: Te,
|
|
4370
|
-
alt:
|
|
4393
|
+
alt: i,
|
|
4371
4394
|
className: "w-full h-full object-cover",
|
|
4372
4395
|
onError: (b) => {
|
|
4373
4396
|
b.currentTarget.style.display = "none";
|
|
@@ -4380,7 +4403,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4380
4403
|
"div",
|
|
4381
4404
|
{
|
|
4382
4405
|
className: "hidden w-full h-full items-center justify-center aria-gradient-bg text-white",
|
|
4383
|
-
children: /* @__PURE__ */ n(
|
|
4406
|
+
children: /* @__PURE__ */ n(Re, { className: "w-4 h-4" })
|
|
4384
4407
|
}
|
|
4385
4408
|
),
|
|
4386
4409
|
/* @__PURE__ */ n("span", { className: c(
|
|
@@ -4394,12 +4417,12 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4394
4417
|
"transition-transform duration-200",
|
|
4395
4418
|
o && "group-hover:scale-105",
|
|
4396
4419
|
!o && "grayscale"
|
|
4397
|
-
), children: /* @__PURE__ */ n(
|
|
4420
|
+
), children: /* @__PURE__ */ n(Re, { className: "w-4 h-4" }) }),
|
|
4398
4421
|
/* @__PURE__ */ E("div", { className: "relative flex flex-col items-start min-w-0 text-left", children: [
|
|
4399
4422
|
/* @__PURE__ */ n("span", { className: c(
|
|
4400
4423
|
"font-bold text-[13px] tracking-tight leading-none",
|
|
4401
4424
|
l ? "text-white" : "text-gray-900"
|
|
4402
|
-
), children:
|
|
4425
|
+
), children: i }),
|
|
4403
4426
|
/* @__PURE__ */ n("span", { className: c(
|
|
4404
4427
|
"text-[10px] font-medium mt-1 leading-none",
|
|
4405
4428
|
l ? "text-gray-400" : "text-gray-500",
|
|
@@ -4416,38 +4439,38 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4416
4439
|
isMinimized: e,
|
|
4417
4440
|
onMinimize: t,
|
|
4418
4441
|
onMaximize: o,
|
|
4419
|
-
theme:
|
|
4442
|
+
theme: a,
|
|
4420
4443
|
displayMode: l,
|
|
4421
|
-
isConnected:
|
|
4444
|
+
isConnected: i,
|
|
4422
4445
|
isLoading: b,
|
|
4423
4446
|
chatMessages: d,
|
|
4424
4447
|
liveTranscript: m,
|
|
4425
4448
|
isChatVisible: f,
|
|
4426
4449
|
isMuted: A,
|
|
4427
|
-
error:
|
|
4450
|
+
error: R,
|
|
4428
4451
|
toolCallState: z,
|
|
4429
|
-
setVideoElement:
|
|
4430
|
-
toggleChat:
|
|
4452
|
+
setVideoElement: j,
|
|
4453
|
+
toggleChat: B,
|
|
4431
4454
|
sendMessage: P,
|
|
4432
4455
|
toggleMute: G,
|
|
4433
4456
|
refreshSession: K
|
|
4434
4457
|
}) => {
|
|
4435
|
-
const Q = me(null), M = me(null), [L, _] = I(""), [q, y] = I(!1),
|
|
4458
|
+
const Q = me(null), M = me(null), [L, _] = I(""), [q, y] = I(!1), D = me(null), s = a === "dark", O = l === "bottom-right", Y = l === "center";
|
|
4436
4459
|
ee(() => {
|
|
4437
4460
|
M.current && (M.current.scrollTop = M.current.scrollHeight);
|
|
4438
|
-
}, [m]), ee(() => (Q.current && (console.log("[AriaWidgetStandalone] Registering video element, minimized:", e),
|
|
4439
|
-
|
|
4440
|
-
}), [
|
|
4441
|
-
|
|
4461
|
+
}, [m]), ee(() => (Q.current && (console.log("[AriaWidgetStandalone] Registering video element, minimized:", e), j(Q.current)), () => {
|
|
4462
|
+
j(null);
|
|
4463
|
+
}), [j, e]), ee(() => {
|
|
4464
|
+
D.current?.scrollIntoView({ behavior: "smooth" });
|
|
4442
4465
|
}, [d]);
|
|
4443
4466
|
const re = async () => {
|
|
4444
|
-
if (!L.trim() || !
|
|
4467
|
+
if (!L.trim() || !i || q) return;
|
|
4445
4468
|
const p = L.trim();
|
|
4446
4469
|
_(""), y(!0);
|
|
4447
4470
|
try {
|
|
4448
4471
|
await P(p);
|
|
4449
|
-
} catch (
|
|
4450
|
-
console.error("Failed to send message:",
|
|
4472
|
+
} catch (H) {
|
|
4473
|
+
console.error("Failed to send message:", H), _(p);
|
|
4451
4474
|
} finally {
|
|
4452
4475
|
y(!1);
|
|
4453
4476
|
}
|
|
@@ -4487,7 +4510,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4487
4510
|
className: "w-full h-full object-cover"
|
|
4488
4511
|
}
|
|
4489
4512
|
),
|
|
4490
|
-
z.isActive &&
|
|
4513
|
+
z.isActive && i && /* @__PURE__ */ E(
|
|
4491
4514
|
"div",
|
|
4492
4515
|
{
|
|
4493
4516
|
className: c(
|
|
@@ -4501,7 +4524,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4501
4524
|
/* @__PURE__ */ n("div", { className: c(
|
|
4502
4525
|
"w-5 h-5 rounded-full flex items-center justify-center",
|
|
4503
4526
|
s ? "bg-amber-800/50" : "bg-amber-100"
|
|
4504
|
-
), children: /* @__PURE__ */ n(
|
|
4527
|
+
), children: /* @__PURE__ */ n(Ve, { className: c(
|
|
4505
4528
|
"w-3 h-3 animate-pulse",
|
|
4506
4529
|
s ? "text-amber-400" : "text-amber-600"
|
|
4507
4530
|
) }) }),
|
|
@@ -4512,7 +4535,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4512
4535
|
]
|
|
4513
4536
|
}
|
|
4514
4537
|
),
|
|
4515
|
-
|
|
4538
|
+
i && !R && /* @__PURE__ */ E(
|
|
4516
4539
|
"div",
|
|
4517
4540
|
{
|
|
4518
4541
|
className: c(
|
|
@@ -4533,7 +4556,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4533
4556
|
A ? "bg-red-500 hover:bg-red-600 text-white" : s ? "bg-gray-800/80 hover:bg-gray-700 text-gray-300" : "bg-gray-100/80 hover:bg-gray-200 text-gray-600"
|
|
4534
4557
|
),
|
|
4535
4558
|
title: A ? "Unmute" : "Mute",
|
|
4536
|
-
children: A ? /* @__PURE__ */ n(
|
|
4559
|
+
children: A ? /* @__PURE__ */ n(je, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ n(Be, { className: "h-3.5 w-3.5" })
|
|
4537
4560
|
}
|
|
4538
4561
|
),
|
|
4539
4562
|
/* @__PURE__ */ n(
|
|
@@ -4555,7 +4578,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4555
4578
|
onClick: r,
|
|
4556
4579
|
className: "w-8 h-8 rounded-full bg-red-500 hover:bg-red-600 flex items-center justify-center transition-all duration-200 text-white border-0 outline-none focus:outline-none shadow-sm",
|
|
4557
4580
|
title: "End Call",
|
|
4558
|
-
children: /* @__PURE__ */ n(
|
|
4581
|
+
children: /* @__PURE__ */ n(De, { className: "h-3.5 w-3.5 rotate-[135deg]" })
|
|
4559
4582
|
}
|
|
4560
4583
|
)
|
|
4561
4584
|
]
|
|
@@ -4593,7 +4616,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4593
4616
|
s ? "text-gray-400" : "text-gray-600"
|
|
4594
4617
|
), children: "Connecting..." })
|
|
4595
4618
|
] }),
|
|
4596
|
-
|
|
4619
|
+
R && /* @__PURE__ */ E("div", { className: c(
|
|
4597
4620
|
"absolute inset-0 flex flex-col items-center justify-center z-10 p-4",
|
|
4598
4621
|
s ? "bg-gray-950/90" : "bg-white/90"
|
|
4599
4622
|
), children: [
|
|
@@ -4612,7 +4635,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4612
4635
|
s ? "bg-indigo-600 hover:bg-indigo-700 text-white" : "bg-indigo-500 hover:bg-indigo-600 text-white"
|
|
4613
4636
|
),
|
|
4614
4637
|
children: [
|
|
4615
|
-
/* @__PURE__ */ n(
|
|
4638
|
+
/* @__PURE__ */ n(We, { className: "w-3 h-3" }),
|
|
4616
4639
|
"Retry"
|
|
4617
4640
|
]
|
|
4618
4641
|
}
|
|
@@ -4715,7 +4738,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4715
4738
|
), children: "Get ready to chat" })
|
|
4716
4739
|
] })
|
|
4717
4740
|
] }),
|
|
4718
|
-
|
|
4741
|
+
R && /* @__PURE__ */ n(
|
|
4719
4742
|
"div",
|
|
4720
4743
|
{
|
|
4721
4744
|
className: c(
|
|
@@ -4736,7 +4759,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4736
4759
|
/* @__PURE__ */ n("p", { className: c(
|
|
4737
4760
|
"text-sm leading-relaxed mb-4",
|
|
4738
4761
|
s ? "text-red-400" : "text-red-600"
|
|
4739
|
-
), children:
|
|
4762
|
+
), children: R }),
|
|
4740
4763
|
/* @__PURE__ */ E(
|
|
4741
4764
|
"button",
|
|
4742
4765
|
{
|
|
@@ -4747,7 +4770,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4747
4770
|
s ? "bg-indigo-600 hover:bg-indigo-700 text-white" : "bg-indigo-500 hover:bg-indigo-600 text-white"
|
|
4748
4771
|
),
|
|
4749
4772
|
children: [
|
|
4750
|
-
/* @__PURE__ */ n(
|
|
4773
|
+
/* @__PURE__ */ n(We, { className: "w-4 h-4" }),
|
|
4751
4774
|
"Try Again"
|
|
4752
4775
|
]
|
|
4753
4776
|
}
|
|
@@ -4765,7 +4788,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4765
4788
|
className: "w-full h-full object-contain"
|
|
4766
4789
|
}
|
|
4767
4790
|
),
|
|
4768
|
-
z.isActive &&
|
|
4791
|
+
z.isActive && i && /* @__PURE__ */ E(
|
|
4769
4792
|
"div",
|
|
4770
4793
|
{
|
|
4771
4794
|
className: c(
|
|
@@ -4779,7 +4802,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4779
4802
|
/* @__PURE__ */ n("div", { className: c(
|
|
4780
4803
|
"w-6 h-6 rounded-full flex items-center justify-center",
|
|
4781
4804
|
s ? "bg-amber-800/50" : "bg-amber-100"
|
|
4782
|
-
), children: /* @__PURE__ */ n(
|
|
4805
|
+
), children: /* @__PURE__ */ n(Ve, { className: c(
|
|
4783
4806
|
"w-3.5 h-3.5 animate-pulse",
|
|
4784
4807
|
s ? "text-amber-400" : "text-amber-600"
|
|
4785
4808
|
) }) }),
|
|
@@ -4810,7 +4833,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4810
4833
|
]
|
|
4811
4834
|
}
|
|
4812
4835
|
),
|
|
4813
|
-
m &&
|
|
4836
|
+
m && i && !z.isActive && /* @__PURE__ */ n(
|
|
4814
4837
|
"div",
|
|
4815
4838
|
{
|
|
4816
4839
|
className: c(
|
|
@@ -4825,7 +4848,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4825
4848
|
] })
|
|
4826
4849
|
}
|
|
4827
4850
|
),
|
|
4828
|
-
|
|
4851
|
+
i && !R && /* @__PURE__ */ E(
|
|
4829
4852
|
"div",
|
|
4830
4853
|
{
|
|
4831
4854
|
className: c(
|
|
@@ -4839,7 +4862,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4839
4862
|
/* @__PURE__ */ n(
|
|
4840
4863
|
"button",
|
|
4841
4864
|
{
|
|
4842
|
-
onClick:
|
|
4865
|
+
onClick: B,
|
|
4843
4866
|
className: c(
|
|
4844
4867
|
"w-9 h-9 rounded-full flex items-center justify-center transition-all duration-200",
|
|
4845
4868
|
"border-0 outline-none focus:outline-none shadow-sm",
|
|
@@ -4859,7 +4882,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4859
4882
|
A ? "bg-red-500 hover:bg-red-600 text-white" : s ? "bg-gray-800/80 hover:bg-gray-700 text-gray-300" : "bg-gray-100/80 hover:bg-gray-200 text-gray-600"
|
|
4860
4883
|
),
|
|
4861
4884
|
title: A ? "Unmute" : "Mute",
|
|
4862
|
-
children: A ? /* @__PURE__ */ n(
|
|
4885
|
+
children: A ? /* @__PURE__ */ n(je, { className: "h-4 w-4" }) : /* @__PURE__ */ n(Be, { className: "h-4 w-4" })
|
|
4863
4886
|
}
|
|
4864
4887
|
),
|
|
4865
4888
|
/* @__PURE__ */ n(
|
|
@@ -4881,7 +4904,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4881
4904
|
onClick: r,
|
|
4882
4905
|
className: "w-10 h-9 rounded-full bg-red-500 hover:bg-red-600 flex items-center justify-center transition-all duration-200 text-white border-0 outline-none focus:outline-none shadow-sm",
|
|
4883
4906
|
title: "End Call",
|
|
4884
|
-
children: /* @__PURE__ */ n(
|
|
4907
|
+
children: /* @__PURE__ */ n(De, { className: "h-4 w-4 rotate-[135deg]" })
|
|
4885
4908
|
}
|
|
4886
4909
|
)
|
|
4887
4910
|
]
|
|
@@ -4917,7 +4940,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4917
4940
|
/* @__PURE__ */ n("div", { className: c(
|
|
4918
4941
|
"rounded-2xl p-6 mb-4",
|
|
4919
4942
|
s ? "bg-gradient-to-br from-indigo-900/20 to-purple-900/20" : "bg-gradient-to-br from-indigo-50 to-purple-50"
|
|
4920
|
-
), children: /* @__PURE__ */ n(
|
|
4943
|
+
), children: /* @__PURE__ */ n(Re, { className: c(
|
|
4921
4944
|
"h-8 w-8",
|
|
4922
4945
|
s ? "text-indigo-400" : "text-indigo-500"
|
|
4923
4946
|
) }) }),
|
|
@@ -4929,14 +4952,14 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4929
4952
|
"text-xs",
|
|
4930
4953
|
s ? "text-gray-400" : "text-gray-500"
|
|
4931
4954
|
), children: "Aria is here to chat with you" })
|
|
4932
|
-
] }) : d.filter((p) => p.content && p.content.trim() !== "").map((p,
|
|
4955
|
+
] }) : d.filter((p) => p.content && p.content.trim() !== "").map((p, H) => /* @__PURE__ */ E(
|
|
4933
4956
|
"div",
|
|
4934
4957
|
{
|
|
4935
4958
|
className: c(
|
|
4936
4959
|
"flex gap-2 aria-animate-fade-in",
|
|
4937
4960
|
p.role === "user" ? "flex-row-reverse" : "flex-row"
|
|
4938
4961
|
),
|
|
4939
|
-
style: { animationDelay: `${
|
|
4962
|
+
style: { animationDelay: `${H * 50}ms` },
|
|
4940
4963
|
children: [
|
|
4941
4964
|
/* @__PURE__ */ n(
|
|
4942
4965
|
"div",
|
|
@@ -4978,9 +5001,9 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4978
5001
|
)
|
|
4979
5002
|
]
|
|
4980
5003
|
},
|
|
4981
|
-
|
|
5004
|
+
H
|
|
4982
5005
|
)),
|
|
4983
|
-
/* @__PURE__ */ n("div", { ref:
|
|
5006
|
+
/* @__PURE__ */ n("div", { ref: D })
|
|
4984
5007
|
] }),
|
|
4985
5008
|
/* @__PURE__ */ n("div", { className: c(
|
|
4986
5009
|
"p-3 border-t",
|
|
@@ -4995,8 +5018,8 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
4995
5018
|
value: L,
|
|
4996
5019
|
onChange: (p) => _(p.target.value),
|
|
4997
5020
|
onKeyDown: J,
|
|
4998
|
-
placeholder:
|
|
4999
|
-
disabled: !
|
|
5021
|
+
placeholder: i ? "Message Aria..." : "Connecting...",
|
|
5022
|
+
disabled: !i || q,
|
|
5000
5023
|
className: c(
|
|
5001
5024
|
"flex-1 border-0 bg-transparent shadow-none focus:outline-none px-2 h-8 text-xs",
|
|
5002
5025
|
s ? "placeholder:text-gray-500 text-white" : "placeholder:text-gray-400 text-gray-900"
|
|
@@ -5007,7 +5030,7 @@ const Te = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCSRXhpZgAATU0AK
|
|
|
5007
5030
|
"button",
|
|
5008
5031
|
{
|
|
5009
5032
|
onClick: re,
|
|
5010
|
-
disabled: !
|
|
5033
|
+
disabled: !i || !L.trim() || q,
|
|
5011
5034
|
className: c(
|
|
5012
5035
|
"h-7 w-7 rounded-md shrink-0 transition-all duration-200 flex items-center justify-center",
|
|
5013
5036
|
"bg-indigo-500 hover:bg-indigo-600 disabled:opacity-40 text-white"
|