@voxket-ai/voxket-live 1.0.20 → 1.0.22
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 +21 -5
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -29,14 +29,16 @@ npm install @voxket-ai/voxket-live@latest
|
|
|
29
29
|
|
|
30
30
|
## Usage
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
To use the Voxket Live widget in your React application, you need to import both the component and its styles:
|
|
33
33
|
|
|
34
34
|
```tsx
|
|
35
35
|
import React from 'react';
|
|
36
|
-
import
|
|
36
|
+
import VoxketWidget, { VoxketWidgetProps } from '@voxket-ai/voxket-live';
|
|
37
|
+
// Import the CSS styles - REQUIRED for proper styling
|
|
38
|
+
import '@voxket-ai/voxket-live/dist/index.css';
|
|
37
39
|
|
|
38
40
|
const MyCustomApp = () => {
|
|
39
|
-
const widgetProps:
|
|
41
|
+
const widgetProps: VoxketWidgetProps = {
|
|
40
42
|
agentId: "your-unique-agent-id", // Replace with your actual Agent ID
|
|
41
43
|
baseUrl: "https://your.voxket.api", // Replace with your Voxket instance base URL
|
|
42
44
|
appId: "your-voxket-app-id", // Replace with your Voxket App ID
|
|
@@ -53,7 +55,7 @@ const MyCustomApp = () => {
|
|
|
53
55
|
<div>
|
|
54
56
|
<h1>My Application Integrating Voxket</h1>
|
|
55
57
|
<p>The Voxket Live widget is displayed below:</p>
|
|
56
|
-
<
|
|
58
|
+
<VoxketWidget {...widgetProps} />
|
|
57
59
|
</div>
|
|
58
60
|
);
|
|
59
61
|
};
|
|
@@ -61,9 +63,23 @@ const MyCustomApp = () => {
|
|
|
61
63
|
export default MyCustomApp;
|
|
62
64
|
```
|
|
63
65
|
|
|
66
|
+
### Important Notes on CSS
|
|
67
|
+
|
|
68
|
+
1. **CSS Import is Required**: You must import the CSS file for proper styling:
|
|
69
|
+
```tsx
|
|
70
|
+
import '@voxket-ai/voxket-live/dist/index.css';
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
2. **Import Order**: Import the CSS after the component import for best practices.
|
|
74
|
+
|
|
75
|
+
3. **Alternative CSS Import Methods**:
|
|
76
|
+
- In your main CSS file: `@import '@voxket-ai/voxket-live/dist/index.css';`
|
|
77
|
+
- In your application's entry point (e.g., `main.tsx` or `index.tsx`)
|
|
78
|
+
- Via your bundler's configuration (Webpack, Vite, etc.)
|
|
79
|
+
|
|
64
80
|
## Props
|
|
65
81
|
|
|
66
|
-
The `
|
|
82
|
+
The `VoxketWidget` component accepts the following props:
|
|
67
83
|
|
|
68
84
|
| Prop | Type | Required | Default | Description |
|
|
69
85
|
|---------------------|--------------|----------|-------------|------------------------------------------------------------------------------------------------------------|
|
package/dist/index.cjs
CHANGED
|
@@ -106,7 +106,7 @@ a=extmap-allow-mixed`)!==-1){const s=r.sdp.split(`
|
|
|
106
106
|
`)},om=function(){var t=parseInt(document.body.getAttribute(sr)||"0",10);return isFinite(t)?t:0},F_=function(){m.useEffect(function(){return document.body.setAttribute(sr,(om()+1).toString()),function(){var t=om()-1;t<=0?document.body.removeAttribute(sr):document.body.setAttribute(sr,t.toString())}},[])},j_=function(t){var e=t.noRelative,n=t.noImportant,i=t.gapMode,r=i===void 0?"margin":i;F_();var s=m.useMemo(function(){return N_(r)},[r]);return m.createElement(L_,{styles:V_(s,!e,r,n?"":"!important")})},nu=!1;if(typeof window<"u")try{var Zs=Object.defineProperty({},"passive",{get:function(){return nu=!0,!0}});window.addEventListener("test",Zs,Zs),window.removeEventListener("test",Zs,Zs)}catch{nu=!1}var Di=nu?{passive:!1}:!1,U_=function(t){return t.tagName==="TEXTAREA"},f1=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!U_(t)&&n[e]==="visible")},B_=function(t){return f1(t,"overflowY")},$_=function(t){return f1(t,"overflowX")},am=function(t,e){var n=e.ownerDocument,i=e;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var r=h1(t,i);if(r){var s=p1(t,i),o=s[1],a=s[2];if(o>a)return!0}i=i.parentNode}while(i&&i!==n.body);return!1},H_=function(t){var e=t.scrollTop,n=t.scrollHeight,i=t.clientHeight;return[e,n,i]},z_=function(t){var e=t.scrollLeft,n=t.scrollWidth,i=t.clientWidth;return[e,n,i]},h1=function(t,e){return t==="v"?B_(e):$_(e)},p1=function(t,e){return t==="v"?H_(e):z_(e)},W_=function(t,e){return t==="h"&&e==="rtl"?-1:1},q_=function(t,e,n,i,r){var s=W_(t,window.getComputedStyle(e).direction),o=s*i,a=n.target,c=e.contains(a),l=!1,u=o>0,d=0,h=0;do{if(!a)break;var p=p1(t,a),g=p[0],f=p[1],y=p[2],v=f-y-s*g;(g||v)&&h1(t,a)&&(d+=v,h+=g);var C=a.parentNode;a=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!c&&a!==document.body||c&&(e.contains(a)||e===a));return(u&&Math.abs(d)<1||!u&&Math.abs(h)<1)&&(l=!0),l},Ys=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},cm=function(t){return[t.deltaX,t.deltaY]},lm=function(t){return t&&"current"in t?t.current:t},G_=function(t,e){return t[0]===e[0]&&t[1]===e[1]},K_=function(t){return`
|
|
107
107
|
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
108
108
|
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
109
|
-
`)},Z_=0,Ni=[];function Y_(t){var e=m.useRef([]),n=m.useRef([0,0]),i=m.useRef(),r=m.useState(Z_++)[0],s=m.useState(d1)[0],o=m.useRef(t);m.useEffect(function(){o.current=t},[t]),m.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(r));var f=v_([t.lockRef.current],(t.shards||[]).map(lm),!0).filter(Boolean);return f.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),f.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}},[t.inert,t.lockRef.current,t.shards]);var a=m.useCallback(function(f,y){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!o.current.allowPinchZoom;var v=Ys(f),C=n.current,S="deltaX"in f?f.deltaX:C[0]-v[0],k="deltaY"in f?f.deltaY:C[1]-v[1],b,w=f.target,x=Math.abs(S)>Math.abs(k)?"h":"v";if("touches"in f&&x==="h"&&w.type==="range")return!1;var P=am(x,w);if(!P)return!0;if(P?b=x:(b=x==="v"?"h":"v",P=am(x,w)),!P)return!1;if(!i.current&&"changedTouches"in f&&(S||k)&&(i.current=b),!b)return!0;var M=i.current||b;return q_(M,y,f,M==="h"?S:k)},[]),c=m.useCallback(function(f){var y=f;if(!(!Ni.length||Ni[Ni.length-1]!==s)){var v="deltaY"in y?cm(y):Ys(y),C=e.current.filter(function(b){return b.name===y.type&&(b.target===y.target||y.target===b.shadowParent)&&G_(b.delta,v)})[0];if(C&&C.should){y.cancelable&&y.preventDefault();return}if(!C){var S=(o.current.shards||[]).map(lm).filter(Boolean).filter(function(b){return b.contains(y.target)}),k=S.length>0?a(y,S[0]):!o.current.noIsolation;k&&y.cancelable&&y.preventDefault()}}},[]),l=m.useCallback(function(f,y,v,C){var S={name:f,delta:y,target:v,should:C,shadowParent:J_(v)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(k){return k!==S})},1)},[]),u=m.useCallback(function(f){n.current=Ys(f),i.current=void 0},[]),d=m.useCallback(function(f){l(f.type,cm(f),f.target,a(f,t.lockRef.current))},[]),h=m.useCallback(function(f){l(f.type,Ys(f),f.target,a(f,t.lockRef.current))},[]);m.useEffect(function(){return Ni.push(s),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Di),document.addEventListener("touchmove",c,Di),document.addEventListener("touchstart",u,Di),function(){Ni=Ni.filter(function(f){return f!==s}),document.removeEventListener("wheel",c,Di),document.removeEventListener("touchmove",c,Di),document.removeEventListener("touchstart",u,Di)}},[]);var p=t.removeScrollBar,g=t.inert;return m.createElement(m.Fragment,null,g?m.createElement(s,{styles:K_(r)}):null,p?m.createElement(j_,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function J_(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const X_=E_(u1,Y_);var m1=m.forwardRef(function(t,e){return m.createElement(va,Jt({},t,{ref:e,sideCar:X_}))});m1.classNames=va.classNames;var Q_=[" ","Enter","ArrowUp","ArrowDown"],eM=[" ","Enter"],xi="Select",[ya,ba,tM]=I8(xi),[xr,qD]=_d(xi,[tM,Yb]),Sa=Yb(),[nM,si]=xr(xi),[iM,rM]=xr(xi),g1=t=>{const{__scopeSelect:e,children:n,open:i,defaultOpen:r,onOpenChange:s,value:o,defaultValue:a,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:h,required:p,form:g}=t,f=Sa(e),[y,v]=m.useState(null),[C,S]=m.useState(null),[k,b]=m.useState(!1),w=M8(l),[x,P]=Jl({prop:i,defaultProp:r??!1,onChange:s,caller:xi}),[M,T]=Jl({prop:o,defaultProp:a,onChange:c,caller:xi}),I=m.useRef(null),D=y?g||!!y.closest("form"):!0,[z,q]=m.useState(new Set),se=Array.from(z).map(G=>G.props.value).join(";");return R.jsx(s_,{...f,children:R.jsxs(nM,{required:p,scope:e,trigger:y,onTriggerChange:v,valueNode:C,onValueNodeChange:S,valueNodeHasChildren:k,onValueNodeHasChildrenChange:b,contentId:Md(),value:M,onValueChange:T,open:x,onOpenChange:P,dir:w,triggerPointerDownPosRef:I,disabled:h,children:[R.jsx(ya.Provider,{scope:e,children:R.jsx(iM,{scope:t.__scopeSelect,onNativeOptionAdd:m.useCallback(G=>{q(X=>new Set(X).add(G))},[]),onNativeOptionRemove:m.useCallback(G=>{q(X=>{const F=new Set(X);return F.delete(G),F})},[]),children:n})}),D?R.jsxs(F1,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:M,onChange:G=>T(G.target.value),disabled:h,form:g,children:[M===void 0?R.jsx("option",{value:""}):null,Array.from(z)]},se):null]})})};g1.displayName=xi;var v1="SelectTrigger",y1=m.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:i=!1,...r}=t,s=Sa(n),o=si(v1,n),a=o.disabled||i,c=rt(e,o.onTriggerChange),l=ba(n),u=m.useRef("touch"),[d,h,p]=U1(f=>{const y=l().filter(S=>!S.disabled),v=y.find(S=>S.value===o.value),C=B1(y,f,v);C!==void 0&&o.onValueChange(C.value)}),g=f=>{a||(o.onOpenChange(!0),p()),f&&(o.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return R.jsx(o_,{asChild:!0,...s,children:R.jsx(Ue.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":j1(o.value)?"":void 0,...r,ref:c,onClick:$e(r.onClick,f=>{f.currentTarget.focus(),u.current!=="mouse"&&g(f)}),onPointerDown:$e(r.onPointerDown,f=>{u.current=f.pointerType;const y=f.target;y.hasPointerCapture(f.pointerId)&&y.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(g(f),f.preventDefault())}),onKeyDown:$e(r.onKeyDown,f=>{const y=d.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&h(f.key),!(y&&f.key===" ")&&Q_.includes(f.key)&&(g(),f.preventDefault())})})})});y1.displayName=v1;var b1="SelectValue",S1=m.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:r,children:s,placeholder:o="",...a}=t,c=si(b1,n),{onValueNodeHasChildrenChange:l}=c,u=s!==void 0,d=rt(e,c.onValueNodeChange);return gt(()=>{l(u)},[l,u]),R.jsx(Ue.span,{...a,ref:d,style:{pointerEvents:"none"},children:j1(c.value)?R.jsx(R.Fragment,{children:o}):s})});S1.displayName=b1;var sM="SelectIcon",T1=m.forwardRef((t,e)=>{const{__scopeSelect:n,children:i,...r}=t;return R.jsx(Ue.span,{"aria-hidden":!0,...r,ref:e,children:i||"▼"})});T1.displayName=sM;var oM="SelectPortal",k1=t=>R.jsx(s1,{asChild:!0,...t});k1.displayName=oM;var Ei="SelectContent",C1=m.forwardRef((t,e)=>{const n=si(Ei,t.__scopeSelect),[i,r]=m.useState();if(gt(()=>{r(new DocumentFragment)},[]),!n.open){const s=i;return s?ta.createPortal(R.jsx(w1,{scope:t.__scopeSelect,children:R.jsx(ya.Slot,{scope:t.__scopeSelect,children:R.jsx("div",{children:t.children})})}),s):null}return R.jsx(x1,{...t,ref:e})});C1.displayName=Ei;var Vt=10,[w1,oi]=xr(Ei),aM="SelectContentImpl",cM=ms("SelectContent.RemoveScroll"),x1=m.forwardRef((t,e)=>{const{__scopeSelect:n,position:i="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:f,avoidCollisions:y,...v}=t,C=si(Ei,n),[S,k]=m.useState(null),[b,w]=m.useState(null),x=rt(e,j=>k(j)),[P,M]=m.useState(null),[T,I]=m.useState(null),D=ba(n),[z,q]=m.useState(!1),se=m.useRef(!1);m.useEffect(()=>{if(S)return g_(S)},[S]),B8();const G=m.useCallback(j=>{const[W,...te]=D().map(H=>H.ref.current),[ee]=te.slice(-1),ce=document.activeElement;for(const H of j)if(H===ce||(H==null||H.scrollIntoView({block:"nearest"}),H===W&&b&&(b.scrollTop=0),H===ee&&b&&(b.scrollTop=b.scrollHeight),H==null||H.focus(),document.activeElement!==ce))return},[D,b]),X=m.useCallback(()=>G([P,S]),[G,P,S]);m.useEffect(()=>{z&&X()},[z,X]);const{onOpenChange:F,triggerPointerDownPosRef:ae}=C;m.useEffect(()=>{if(S){let j={x:0,y:0};const W=ee=>{var ce,H;j={x:Math.abs(Math.round(ee.pageX)-(((ce=ae.current)==null?void 0:ce.x)??0)),y:Math.abs(Math.round(ee.pageY)-(((H=ae.current)==null?void 0:H.y)??0))}},te=ee=>{j.x<=10&&j.y<=10?ee.preventDefault():S.contains(ee.target)||F(!1),document.removeEventListener("pointermove",W),ae.current=null};return ae.current!==null&&(document.addEventListener("pointermove",W),document.addEventListener("pointerup",te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",W),document.removeEventListener("pointerup",te,{capture:!0})}}},[S,F,ae]),m.useEffect(()=>{const j=()=>F(!1);return window.addEventListener("blur",j),window.addEventListener("resize",j),()=>{window.removeEventListener("blur",j),window.removeEventListener("resize",j)}},[F]);const[A,L]=U1(j=>{const W=D().filter(ce=>!ce.disabled),te=W.find(ce=>ce.ref.current===document.activeElement),ee=B1(W,j,te);ee&&setTimeout(()=>ee.ref.current.focus())}),Y=m.useCallback((j,W,te)=>{const ee=!se.current&&!te;(C.value!==void 0&&C.value===W||ee)&&(M(j),ee&&(se.current=!0))},[C.value]),Z=m.useCallback(()=>S==null?void 0:S.focus(),[S]),Q=m.useCallback((j,W,te)=>{const ee=!se.current&&!te;(C.value!==void 0&&C.value===W||ee)&&I(j)},[C.value]),re=i==="popper"?iu:E1,oe=re===iu?{side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:f,avoidCollisions:y}:{};return R.jsx(w1,{scope:n,content:S,viewport:b,onViewportChange:w,itemRefCallback:Y,selectedItem:P,onItemLeave:Z,itemTextRefCallback:Q,focusSelectedItem:X,selectedItemText:T,position:i,isPositioned:z,searchRef:A,children:R.jsx(m1,{as:cM,allowPinchZoom:!0,children:R.jsx(Lb,{asChild:!0,trapped:C.open,onMountAutoFocus:j=>{j.preventDefault()},onUnmountAutoFocus:$e(r,j=>{var W;(W=C.trigger)==null||W.focus({preventScroll:!0}),j.preventDefault()}),children:R.jsx(Db,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:j=>j.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:R.jsx(re,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:j=>j.preventDefault(),...v,...oe,onPlaced:()=>q(!0),ref:x,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:$e(v.onKeyDown,j=>{const W=j.ctrlKey||j.altKey||j.metaKey;if(j.key==="Tab"&&j.preventDefault(),!W&&j.key.length===1&&L(j.key),["ArrowUp","ArrowDown","Home","End"].includes(j.key)){let ee=D().filter(ce=>!ce.disabled).map(ce=>ce.ref.current);if(["ArrowUp","End"].includes(j.key)&&(ee=ee.slice().reverse()),["ArrowUp","ArrowDown"].includes(j.key)){const ce=j.target,H=ee.indexOf(ce);ee=ee.slice(H+1)}setTimeout(()=>G(ee)),j.preventDefault()}})})})})})})});x1.displayName=aM;var lM="SelectItemAlignedPosition",E1=m.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:i,...r}=t,s=si(Ei,n),o=oi(Ei,n),[a,c]=m.useState(null),[l,u]=m.useState(null),d=rt(e,x=>u(x)),h=ba(n),p=m.useRef(!1),g=m.useRef(!0),{viewport:f,selectedItem:y,selectedItemText:v,focusSelectedItem:C}=o,S=m.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&l&&f&&y&&v){const x=s.trigger.getBoundingClientRect(),P=l.getBoundingClientRect(),M=s.valueNode.getBoundingClientRect(),T=v.getBoundingClientRect();if(s.dir!=="rtl"){const ce=T.left-P.left,H=M.left-ce,Ae=x.left-H,at=x.width+Ae,On=Math.max(at,P.width),Pr=window.innerWidth-Vt,Rr=Hp(H,[Vt,Math.max(Vt,Pr-On)]);a.style.minWidth=at+"px",a.style.left=Rr+"px"}else{const ce=P.right-T.right,H=window.innerWidth-M.right-ce,Ae=window.innerWidth-x.right-H,at=x.width+Ae,On=Math.max(at,P.width),Pr=window.innerWidth-Vt,Rr=Hp(H,[Vt,Math.max(Vt,Pr-On)]);a.style.minWidth=at+"px",a.style.right=Rr+"px"}const I=h(),D=window.innerHeight-Vt*2,z=f.scrollHeight,q=window.getComputedStyle(l),se=parseInt(q.borderTopWidth,10),G=parseInt(q.paddingTop,10),X=parseInt(q.borderBottomWidth,10),F=parseInt(q.paddingBottom,10),ae=se+G+z+F+X,A=Math.min(y.offsetHeight*5,ae),L=window.getComputedStyle(f),Y=parseInt(L.paddingTop,10),Z=parseInt(L.paddingBottom,10),Q=x.top+x.height/2-Vt,re=D-Q,oe=y.offsetHeight/2,j=y.offsetTop+oe,W=se+G+j,te=ae-W;if(W<=Q){const ce=I.length>0&&y===I[I.length-1].ref.current;a.style.bottom="0px";const H=l.clientHeight-f.offsetTop-f.offsetHeight,Ae=Math.max(re,oe+(ce?Z:0)+H+X),at=W+Ae;a.style.height=at+"px"}else{const ce=I.length>0&&y===I[0].ref.current;a.style.top="0px";const Ae=Math.max(Q,se+f.offsetTop+(ce?Y:0)+oe)+te;a.style.height=Ae+"px",f.scrollTop=W-Q+f.offsetTop}a.style.margin=`${Vt}px 0`,a.style.minHeight=A+"px",a.style.maxHeight=D+"px",i==null||i(),requestAnimationFrame(()=>p.current=!0)}},[h,s.trigger,s.valueNode,a,l,f,y,v,s.dir,i]);gt(()=>S(),[S]);const[k,b]=m.useState();gt(()=>{l&&b(window.getComputedStyle(l).zIndex)},[l]);const w=m.useCallback(x=>{x&&g.current===!0&&(S(),C==null||C(),g.current=!1)},[S,C]);return R.jsx(dM,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:w,children:R.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:R.jsx(Ue.div,{...r,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});E1.displayName=lM;var uM="SelectPopperPosition",iu=m.forwardRef((t,e)=>{const{__scopeSelect:n,align:i="start",collisionPadding:r=Vt,...s}=t,o=Sa(n);return R.jsx(a_,{...o,...s,ref:e,align:i,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});iu.displayName=uM;var[dM,$d]=xr(Ei,{}),ru="SelectViewport",P1=m.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:i,...r}=t,s=oi(ru,n),o=$d(ru,n),a=rt(e,s.onViewportChange),c=m.useRef(0);return R.jsxs(R.Fragment,{children:[R.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),R.jsx(ya.Slot,{scope:n,children:R.jsx(Ue.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:$e(r.onScroll,l=>{const u=l.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&d){const p=Math.abs(c.current-u.scrollTop);if(p>0){const g=window.innerHeight-Vt*2,f=parseFloat(d.style.minHeight),y=parseFloat(d.style.height),v=Math.max(f,y);if(v<g){const C=v+p,S=Math.min(g,C),k=C-S;d.style.height=S+"px",d.style.bottom==="0px"&&(u.scrollTop=k>0?k:0,d.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});P1.displayName=ru;var R1="SelectGroup",[fM,hM]=xr(R1),pM=m.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=Md();return R.jsx(fM,{scope:n,id:r,children:R.jsx(Ue.div,{role:"group","aria-labelledby":r,...i,ref:e})})});pM.displayName=R1;var A1="SelectLabel",mM=m.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=hM(A1,n);return R.jsx(Ue.div,{id:r.id,...i,ref:e})});mM.displayName=A1;var Zo="SelectItem",[gM,I1]=xr(Zo),_1=m.forwardRef((t,e)=>{const{__scopeSelect:n,value:i,disabled:r=!1,textValue:s,...o}=t,a=si(Zo,n),c=oi(Zo,n),l=a.value===i,[u,d]=m.useState(s??""),[h,p]=m.useState(!1),g=rt(e,C=>{var S;return(S=c.itemRefCallback)==null?void 0:S.call(c,C,i,r)}),f=Md(),y=m.useRef("touch"),v=()=>{r||(a.onValueChange(i),a.onOpenChange(!1))};if(i==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return R.jsx(gM,{scope:n,value:i,disabled:r,textId:f,isSelected:l,onItemTextChange:m.useCallback(C=>{d(S=>S||((C==null?void 0:C.textContent)??"").trim())},[]),children:R.jsx(ya.ItemSlot,{scope:n,value:i,disabled:r,textValue:u,children:R.jsx(Ue.div,{role:"option","aria-labelledby":f,"data-highlighted":h?"":void 0,"aria-selected":l&&h,"data-state":l?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...o,ref:g,onFocus:$e(o.onFocus,()=>p(!0)),onBlur:$e(o.onBlur,()=>p(!1)),onClick:$e(o.onClick,()=>{y.current!=="mouse"&&v()}),onPointerUp:$e(o.onPointerUp,()=>{y.current==="mouse"&&v()}),onPointerDown:$e(o.onPointerDown,C=>{y.current=C.pointerType}),onPointerMove:$e(o.onPointerMove,C=>{var S;y.current=C.pointerType,r?(S=c.onItemLeave)==null||S.call(c):y.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:$e(o.onPointerLeave,C=>{var S;C.currentTarget===document.activeElement&&((S=c.onItemLeave)==null||S.call(c))}),onKeyDown:$e(o.onKeyDown,C=>{var k;((k=c.searchRef)==null?void 0:k.current)!==""&&C.key===" "||(eM.includes(C.key)&&v(),C.key===" "&&C.preventDefault())})})})})});_1.displayName=Zo;var Wr="SelectItemText",M1=m.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:r,...s}=t,o=si(Wr,n),a=oi(Wr,n),c=I1(Wr,n),l=rM(Wr,n),[u,d]=m.useState(null),h=rt(e,v=>d(v),c.onItemTextChange,v=>{var C;return(C=a.itemTextRefCallback)==null?void 0:C.call(a,v,c.value,c.disabled)}),p=u==null?void 0:u.textContent,g=m.useMemo(()=>R.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:f,onNativeOptionRemove:y}=l;return gt(()=>(f(g),()=>y(g)),[f,y,g]),R.jsxs(R.Fragment,{children:[R.jsx(Ue.span,{id:c.textId,...s,ref:h}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ta.createPortal(s.children,o.valueNode):null]})});M1.displayName=Wr;var O1="SelectItemIndicator",D1=m.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return I1(O1,n).isSelected?R.jsx(Ue.span,{"aria-hidden":!0,...i,ref:e}):null});D1.displayName=O1;var su="SelectScrollUpButton",N1=m.forwardRef((t,e)=>{const n=oi(su,t.__scopeSelect),i=$d(su,t.__scopeSelect),[r,s]=m.useState(!1),o=rt(e,i.onScrollButtonChange);return gt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const l=c.scrollTop>0;s(l)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?R.jsx(V1,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});N1.displayName=su;var ou="SelectScrollDownButton",L1=m.forwardRef((t,e)=>{const n=oi(ou,t.__scopeSelect),i=$d(ou,t.__scopeSelect),[r,s]=m.useState(!1),o=rt(e,i.onScrollButtonChange);return gt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const l=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<l;s(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?R.jsx(V1,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});L1.displayName=ou;var V1=m.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:i,...r}=t,s=oi("SelectScrollButton",n),o=m.useRef(null),a=ba(n),c=m.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return m.useEffect(()=>()=>c(),[c]),gt(()=>{var u;const l=a().find(d=>d.ref.current===document.activeElement);(u=l==null?void 0:l.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),R.jsx(Ue.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:$e(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(i,50))}),onPointerMove:$e(r.onPointerMove,()=>{var l;(l=s.onItemLeave)==null||l.call(s),o.current===null&&(o.current=window.setInterval(i,50))}),onPointerLeave:$e(r.onPointerLeave,()=>{c()})})}),vM="SelectSeparator",yM=m.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return R.jsx(Ue.div,{"aria-hidden":!0,...i,ref:e})});yM.displayName=vM;var au="SelectArrow",bM=m.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=Sa(n),s=si(au,n),o=oi(au,n);return s.open&&o.position==="popper"?R.jsx(c_,{...r,...i,ref:e}):null});bM.displayName=au;var SM="SelectBubbleInput",F1=m.forwardRef(({__scopeSelect:t,value:e,...n},i)=>{const r=m.useRef(null),s=rt(i,r),o=u_(e);return m.useEffect(()=>{const a=r.current;if(!a)return;const c=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==e&&u){const d=new Event("change",{bubbles:!0});u.call(a,e),a.dispatchEvent(d)}},[o,e]),R.jsx(Ue.select,{...n,style:{...o1,...n.style},ref:s,defaultValue:e})});F1.displayName=SM;function j1(t){return t===""||t===void 0}function U1(t){const e=Ci(t),n=m.useRef(""),i=m.useRef(0),r=m.useCallback(o=>{const a=n.current+o;e(a),function c(l){n.current=l,window.clearTimeout(i.current),l!==""&&(i.current=window.setTimeout(()=>c(""),1e3))}(a)},[e]),s=m.useCallback(()=>{n.current="",window.clearTimeout(i.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(i.current),[]),[n,r,s]}function B1(t,e,n){const r=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=TM(t,Math.max(s,0));r.length===1&&(o=o.filter(l=>l!==n));const c=o.find(l=>l.textValue.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function TM(t,e){return t.map((n,i)=>t[(e+i)%t.length])}var kM=g1,CM=y1,wM=S1,xM=T1,EM=k1,PM=C1,RM=P1,AM=_1,IM=M1,_M=D1,MM=N1,OM=L1;function DM({...t}){return R.jsx(kM,{"data-slot":"select",...t})}function NM({...t}){return R.jsx(wM,{"data-slot":"select-value",...t})}function LM({className:t,size:e="default",children:n,...i}){return R.jsxs(CM,{"data-slot":"select-trigger","data-size":e,className:fe(["flex w-fit cursor-pointer items-center justify-between gap-2","rounded-full px-3 py-2 text-sm whitespace-nowrap","bg-button transition-[color,border,background-color]","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-muted hover:text-muted-foreground","!focus:ring-0 !focus-visible:ring-0 !focus:border-none !focus-visible:border-none !ring-0 !border-none !outline-none","aria-invalid:ring-0 dark:aria-invalid:ring-0","data-[placeholder]:text-muted-foreground","data-[size=default]:h-9 data-[size=sm]:h-8","*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2","[&:not([class*='text-'])_svg:not([class*='text-'])]:text-muted-foreground","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],t),...i,children:[n,R.jsx(xM,{asChild:!0,children:R.jsx(Rd,{weight:"bold",className:"size-4 transition-colors"})})]})}function VM({className:t,children:e,position:n="popper",...i}){return R.jsx(EM,{children:R.jsxs(PM,{"data-slot":"select-content",className:fe(["bg-[#18182a]/90 backdrop-blur-md text-white border border-[#23233a] shadow-2xl","relative z-50 overflow-x-hidden overflow-y-auto rounded-xl","max-h-(--radix-select-content-available-height) min-w-[8rem]","origin-(--radix-select-content-transform-origin)","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95","data-[side=top]:slide-in-from-bottom-2","data-[side=right]:slide-in-from-left-2","data-[side=bottom]:slide-in-from-top-2","data-[side=left]:slide-in-from-right-2"],n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...i,children:[R.jsx(jM,{}),R.jsx(RM,{className:fe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),R.jsx(UM,{})]})})}function FM({className:t,children:e,...n}){return R.jsxs(AM,{"data-slot":"select-item",className:fe(["relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none","cursor-pointer disabled:cursor-not-allowed","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2","[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],t),...n,children:[R.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:R.jsx(_M,{children:R.jsx(lb,{className:"size-4",weight:"bold"})})}),R.jsx(IM,{children:e})]})}function jM({className:t,...e}){return R.jsx(MM,{"data-slot":"select-scroll-up-button",className:fe("flex cursor-default items-center justify-center py-1",t),...e,children:R.jsx(ab,{className:"size-4",weight:"bold"})})}function UM({className:t,...e}){return R.jsx(OM,{"data-slot":"select-scroll-down-button",className:fe("flex cursor-default items-center justify-center py-1",t),...e,children:R.jsx(Rd,{className:"size-4",weight:"bold"})})}const BM=ea.cva(["w-full rounded-full px-3 py-2 text-sm cursor-pointer","disabled:not-allowed hover:bg-button-hover focus:bg-button-hover"],{variants:{size:{default:"w-[180px]",sm:"w-auto"}},defaultVariants:{size:"default"}});function um({kind:t,track:e,requestPermissions:n,onError:i,...r}){const s=r.size||"default",o=ha(),{devices:a,activeDeviceId:c,setActiveMediaDevice:l}=OA({kind:t,room:o,track:e,requestPermissions:n,onError:i});return R.jsxs(DM,{value:c,onValueChange:l,children:[R.jsx(LM,{className:fe(BM({size:s}),r.className,"hover:bg"),children:s!=="sm"&&R.jsx(NM,{className:"font-mono text-sm",placeholder:`Select a ${t}`})}),R.jsx(VM,{children:a.map(u=>R.jsx(FM,{value:u.deviceId,className:"font-mono text-xs",children:u.label},u.deviceId))})]})}function $M(t,e,n=!1){if(n)return Ad;switch(t){case _.Source.Microphone:return e?ub:db;case _.Source.Camera:return e?pb:mb;case _.Source.ScreenShare:return fb;default:return m.Fragment}}function Ac({source:t,pressed:e,pending:n,className:i,...r}){const s=$M(t,e??!1,n),o=t===_.Source.Microphone&&!(e??!1)&&!n,a=t===_.Source.Camera&&!(e??!1)&&!n;return R.jsxs(Mb,{pressed:e,"aria-label":`Toggle ${t}`,className:fe(i),...r,children:[R.jsx(s,{weight:"bold",className:fe(n&&"animate-spin",o||a?"text-red-500":void 0)}),r.children]})}const HM=t=>{switch(t){case _.Source.Camera:return 1;case _.Source.Microphone:return 2;case _.Source.ScreenShare:return 3;default:return 0}};function zM(){const t=MA(),e=n=>!!(t!=null&&t.canPublish)&&(t.canPublishSources.length===0||t.canPublishSources.includes(HM(n)));return{camera:e(_.Source.Camera),microphone:e(_.Source.Microphone),screenShare:e(_.Source.ScreenShare),data:(t==null?void 0:t.canPublishData)??!1}}function WM(t={}){const{controls:e,saveUserChoices:n=!0}=t,i={leave:!0,...e},{microphoneTrack:r,localParticipant:s}=eb(),o=zM(),a=ri(),c=gc({source:_.Source.Microphone,onDeviceError:w=>{var x;return(x=t.onDeviceError)==null?void 0:x.call(t,{source:_.Source.Microphone,error:w})}}),l=gc({source:_.Source.Camera,onDeviceError:w=>{var x;return(x=t.onDeviceError)==null?void 0:x.call(t,{source:_.Source.Camera,error:w})}}),u=gc({source:_.Source.ScreenShare,onDeviceError:w=>{var x;return(x=t.onDeviceError)==null?void 0:x.call(t,{source:_.Source.ScreenShare,error:w})}}),d=m.useMemo(()=>({participant:s,source:_.Source.Microphone,publication:r}),[s,r]);i.microphone??(i.microphone=o.microphone),i.screenShare??(i.screenShare=o.screenShare),i.camera??(i.camera=o.camera),i.chat??(i.chat=o.data);const{saveAudioInputEnabled:h,saveAudioInputDeviceId:p,saveVideoInputEnabled:g,saveVideoInputDeviceId:f}=jA({preventSave:!n}),y=m.useCallback(()=>{a&&a.disconnect()},[a]),v=m.useCallback(w=>{p(w??"default")},[p]),C=m.useCallback(w=>{f(w??"default")},[f]),S=m.useCallback(async w=>{u.enabled&&u.toggle(!1),await l.toggle(w),g(!l.enabled)},[l,g,u]),k=m.useCallback(async w=>{await c.toggle(w),h(!c.enabled)},[c,h]),b=m.useCallback(async w=>{l.enabled&&l.toggle(!1),await u.toggle(w)},[l,u]);return{micTrackRef:d,visibleControls:i,cameraToggle:{...l,toggle:S},microphoneToggle:{...c,toggle:k},screenShareToggle:{...u,toggle:b},handleDisconnect:y,handleAudioDeviceChange:v,handleVideoDeviceChange:C}}function qM({controls:t,saveUserChoices:e=!0,capabilities:n,className:i,onSendMessage:r,onChatOpenChange:s,onDisconnect:o,onDeviceError:a,...c}){const[l,u]=m.useState(!1),[d,h]=m.useState(!1),{micTrackRef:p,visibleControls:g,cameraToggle:f,microphoneToggle:y,screenShareToggle:v,handleAudioDeviceChange:C,handleVideoDeviceChange:S,handleDisconnect:k}=WM({controls:t,saveUserChoices:e}),b=async x=>{h(!0);try{await(r==null?void 0:r(x))}finally{h(!1)}},w=()=>{k(),o==null||o()};return m.useEffect(()=>{s==null||s(l)},[l,s]),R.jsxs("div",{"aria-label":"Voice assistant controls",className:fe("border border-border rounded-3xl py-4 flex flex-col justify-end h-full",i),...c,children:[n.suportsChatInput&&R.jsxs("div",{inert:!l,className:fe("overflow-hidden transition-[height] relative duration-300 ease-in-out",l?"h-[64px] mb-3":"h-0"),children:[R.jsx("div",{className:"flex h-9 px-4 w-full",children:R.jsx(T8,{onSend:b,disabled:d,className:"w-full"})}),R.jsx("hr",{className:"border-border my-2 mx-5"})]}),R.jsxs("div",{className:"flex flex-row items-center gap-2 rounded-2xl mx-auto bg-[#18182a]/80 border-none backdrop-blur-lg px-2 py-2",children:[R.jsxs("div",{className:"flex gap-y-2 justify-start",children:[g.microphone&&R.jsxs("div",{className:"flex gap-y-2 items-center rounded-full overflow-hidden border-none ",children:[R.jsx(Ac,{variant:"primary",source:_.Source.Microphone,pressed:y.enabled,disabled:y.pending,onPressedChange:y.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),R.jsx(sb,{barCount:3,trackRef:p,options:{minHeight:5},className:"flex h-full w-auto items-center justify-center gap-x-0.5",children:R.jsx("span",{className:fe(["h-full w-0.5 origin-center rounded-2xl","bg-white","group-data-[state=on]/track:bg-white group-data-[state=off]/track:bg-white","data-lk-muted:bg-muted"])})}),R.jsx(um,{size:"sm",kind:"audioinput",onError:a?x=>x instanceof Error?a({source:_.Source.Microphone,error:x}):void 0:void 0,onActiveDeviceChange:C,className:fe(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/30 transition-colors","min-w-[2.5rem]"])})]}),n.suportsVideoInput&&g.camera&&R.jsxs("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:[R.jsx(Ac,{variant:"primary",source:_.Source.Camera,pressed:f.enabled,pending:f.pending,disabled:f.pending,onPressedChange:f.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),R.jsx(um,{size:"sm",kind:"videoinput",onError:a?x=>x instanceof Error?a({source:_.Source.Camera,error:x}):void 0:void 0,onActiveDeviceChange:S,className:fe(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors","min-w-[2.5rem]"])})]}),g.leave&&R.jsx("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:R.jsx(Ab,{onClick:w,className:"font-semibold py-2 rounded-none border-none bg-transparent text-inherit transition-colors flex items-center",children:R.jsx(hb,{weight:"bold",className:"text-red-600"})})}),n.suportsScreenShare&&g.screenShare&&R.jsx("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:R.jsx(Ac,{variant:"secondary",source:_.Source.ScreenShare,pressed:v.enabled,disabled:v.pending,onPressedChange:v.toggle,className:"w-auto py-2 disabled:opacity-70 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"})})]}),g.chat&&R.jsx("div",{className:"flex items-center rounded-full overflow-hidden bg-secondary text-secondary-foreground border-none ",children:R.jsx(Mb,{variant:"secondary","aria-label":"Toggle chat",pressed:l,onPressedChange:x=>{u(x)},className:"aspect-square h-full py-3 rounded-none border-none bg-transparent text-inherit focus:bg-secondary/80 hover:bg-secondary/80 transition-colors flex items-center",children:R.jsx(cb,{weight:"bold",className:"h-5 w-5"})})})]})]})}const GM=(t,e)=>{var a,c;const n=m.useMemo(()=>e?e(t.message):t.message,[t.message,e]),i=!!t.editTimestamp,r=new Date(t.timestamp),s=typeof navigator<"u"?navigator.language:"en-US",o=(a=t.from)!=null&&a.name&&t.from.name!==""?t.from.name:(c=t.from)==null?void 0:c.identity;return{message:n,hasBeenEdited:i,time:r,locale:s,name:o}},KM=({entry:t,messageFormatter:e,className:n,participantName:i,...r})=>{var u,d;const{message:s,time:o,locale:a}=GM(t,e),c=((u=t.from)==null?void 0:u.isLocal)??!1;console.log("ChatEntry",{entry:t,message:s,time:o,locale:a,isLocalUser:c}),fe("w-full px-3 py-2 rounded-2xl text-xs break-words whitespace-pre-line",c?" text-end border border-[#5078F2]/30":"bg-muted text-foreground border border-[#813aa7]/30","text-left");const l=fe("inline-flex items-center justify-center w-6 h-6 rounded-full text-xs font-bold flex-shrink-0",c?"bg-[#5078F2] text-white":"bg-[#813aa7] ml-1 text-white");return R.jsx("li",{title:o.toLocaleTimeString(a,{timeStyle:"full"}),className:fe("group flex mb-2",c?"justify-end":"justify-start",n),...r,children:R.jsxs("div",{className:fe("flex w-fit max-w-full rounded-2xl border",c?"flex-row-reverse items-center border-[#5078F2]/30":"flex-row items-center border-[#813aa7]/30 bg-muted text-foreground"),children:[R.jsx("span",{className:l,children:c?((d=i==null?void 0:i[0])==null?void 0:d.toUpperCase())||"U":"A"}),R.jsx("span",{className:fe("flex items-center text-xs break-words whitespace-pre-line",c?"ml-auto justify-end text-right":"justify-start text-left","px-3 py-2"),children:s})]})})};function ZM(t){B.useEffect(()=>{function e(){const{scrollingElement:n}=document;n&&(n.scrollTop=n.scrollHeight)}if(t.current){const n=new ResizeObserver(e);return n.observe(t.current),e(),()=>n.disconnect()}},[t])}const YM=({className:t,children:e,...n})=>{const i=B.useRef(null);return ZM(i),R.jsx("div",{ref:i,className:fe("flex flex-col justify-end",t),...n,children:e})},JM=({state:t,audioTrack:e,className:n,ref:i})=>R.jsx("div",{ref:i,className:fe("",n),children:R.jsx(sb,{barCount:5,state:t,options:{minHeight:5},trackRef:e,className:fe("flex aspect-video w-40 items-center justify-center gap-1"),children:R.jsx("span",{className:fe(["bg-[#6721a4] min-h-2 w-2 rounded-full","origin-center transition-colors duration-250 ease-linear","data-[lk-highlighted=true]:bg-[#5c64f6]","data-[lk-muted=true]:bg-[#222222]"])})})}),XM=({videoTrack:t,className:e,ref:n})=>{var i,r;return R.jsx("div",{ref:n,className:fe(e),children:R.jsx(rb,{trackRef:t,width:((i=t==null?void 0:t.publication.dimensions)==null?void 0:i.width)??0,height:((r=t==null?void 0:t.publication.dimensions)==null?void 0:r.height)??0,className:"rounded-md"})})},QM=Zn.create(rb),e6=({trackRef:t,className:e,ref:n})=>{var i,r;return R.jsx("div",{className:fe("bg-muted overflow-hidden rounded-md",e),children:R.jsx(QM,{ref:n,trackRef:t,width:((i=t==null?void 0:t.publication.dimensions)==null?void 0:i.width)??0,height:((r=t==null?void 0:t.publication.dimensions)==null?void 0:r.height)??0,className:fe("h-full w-auto")})})},dm=Zn.create(e6),t6=Zn.create(JM),n6=Zn.create(XM),fn={initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},transition:{type:"spring",stiffness:675,damping:75,mass:1}},Li={grid:["h-full w-full","grid gap-x-2 place-content-center","grid-cols-[1fr_1fr] grid-rows-[90px_1fr_90px]"],agentChatOpenWithSecondTile:["col-start-1 row-start-1","self-center justify-self-end"],agentChatOpenWithoutSecondTile:["col-start-1 row-start-1","col-span-2","place-content-center"],agentChatClosed:["col-start-1 row-start-1","col-span-2 row-span-3","place-content-center"],secondTileChatOpen:["col-start-2 row-start-1","self-center justify-self-start"],secondTileChatClosed:["col-start-2 row-start-3","place-content-end"]};function i6(t){const{localParticipant:e}=eb(),n=e.getTrackPublication(t);return B.useMemo(()=>n?{source:t,participant:e,publication:n}:void 0,[t,n,e])}function r6({chatOpen:t}){const{state:e,audioTrack:n,videoTrack:i,agent:{isActive:r=!1}={}}=nb(),[s]=tb([_.Source.ScreenShare]),o=i6(_.Source.Camera),a=o&&!o.publication.isMuted,c=s&&!s.publication.isMuted,l=a||c,u={...fn.transition,delay:t?0:.15},d={...fn.animate,scale:t?1:3,transition:u},h={...fn.animate,transition:u},p=u,g=u,f=i!==void 0;return R.jsx("div",{className:"relative w-full h-full z-10 flex items-center justify-center",children:R.jsx("div",{className:"relative w-full h-full max-w-2xl px-4 md:px-0",children:R.jsxs("div",{className:fe(Li.grid),children:[r&&R.jsx("div",{className:fe(["grid",!t&&Li.agentChatClosed,t&&l&&Li.agentChatOpenWithSecondTile,t&&!l&&Li.agentChatOpenWithoutSecondTile]),children:R.jsxs("div",{className:"h-full flex items-center justify-center",children:[!f&&R.jsx(t6,{layoutId:"agent",...fn,animate:d,transition:p,state:e,audioTrack:n,className:fe(t?"h-[90px]":"h-auto w-full")},"agent"),f&&R.jsx(n6,{layoutId:"avatar",...fn,animate:h,transition:g,videoTrack:i,className:fe(t?"h-[90px] [&>video]:h-[90px] [&>video]:w-auto":"h-auto w-full")},"avatar")]})}),R.jsx("div",{className:fe(["grid",t&&Li.secondTileChatOpen,!t&&Li.secondTileChatClosed]),children:R.jsxs("div",{className:"w-full px-10 flex items-center shadow-2xl justify-between",children:[o&&a&&R.jsx(dm,{layout:"position",layoutId:"camera",...fn,trackRef:o,transition:{...fn.transition,delay:t?0:.15},className:"h-[60px] order-1"},"camera"),c&&R.jsx(dm,{layout:"position",layoutId:"screen",...fn,trackRef:s,transition:{...fn.transition,delay:t?0:.15},className:"h-[70px] order-2"},"screen")]})})]})})})}function s6(){const t=KA(),e=FA(),n=ri();return{messages:B.useMemo(()=>[...t.map(s=>c8(s,n)),...e.chatMessages].sort((s,o)=>s.timestamp-o.timestamp),[t,e.chatMessages,n]),send:e.send}}const o6=({logLevel:t}={})=>{const e=ri();m.useEffect(()=>(QT(t??"debug"),window.__lk_room=e,()=>{window.__lk_room=void 0}),[e,t])},a6=({disabled:t,capabilities:e,sessionStarted:n,ref:i,participantName:r="User",loadingText:s="Waiting for agent to connect..."})=>{const[o,a]=B.useState(!1),{messages:c,send:l}=s6(),u=B.useRef(null),{agent:{isActive:d=!1}={}}=nb();o6(),B.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[c.length]);async function h(p){await l(p)}return R.jsx("main",{ref:i,inert:t,className:fe("w-full flex flex-col items-center justify-center","max-w-md mx-auto","bg-gradient-to-br from-[#171727] to-[#12121F] rounded-2xl shadow-xl p-0","overflow-hidden","h-full"),style:{minHeight:0},children:R.jsxs("div",{className:"w-full h-full flex-1 flex flex-col items-center justify-end px-0",children:[!d&&R.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full min-h-[180px]",children:[R.jsx(Ad,{className:"w-10 h-10 animate-spin text-blue-400 mb-2",weight:"bold"}),R.jsx("span",{className:"text-sm text-muted-foreground opacity-80",children:s})]}),d&&R.jsxs(R.Fragment,{children:[o&&R.jsx(YM,{className:fe("mx-auto w-full py-2 max-w-2xl px-5 transition-[opacity,translate] duration-300 ease-out ","max-h-[calc(100%-80px)]",o?"translate-y-0 opacity-100 delay-200":"translate-y-10 opacity-0"),children:R.jsx("div",{ref:u,className:"space-y-3 relative whitespace-pre-wrap z-0 overflow-y-auto scrollbar-hide",style:{scrollbarWidth:"none"},children:R.jsx($0,{children:c.map(p=>R.jsx(Zn.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:1,height:"auto"},transition:{duration:.5,ease:"easeOut"},children:R.jsx(KM,{participantName:r,entry:p},p.id)},p.id))})})}),!o&&R.jsx(r6,{chatOpen:o}),R.jsx("div",{className:"w-full h-fit flex flex-col mb-1",children:R.jsx(Zn.div,{initial:{opacity:0,y:30},animate:{opacity:n?1:0,y:n?0:30},transition:{duration:.3,delay:n?.5:0,ease:"easeOut"},className:"rounded-xl flex flex-col-reverse justify-end h-full my-2 ",children:R.jsx(qM,{capabilities:e,onChatOpenChange:a,onSendMessage:h,className:"border-none py-1 rounded-xl"})},"control-bar")})]})]})})},fm=t=>t,c6=()=>{let t=fm;return{configure(e){t=e},generate(e){return t(e)},reset(){t=fm}}},l6=c6();function Xn(t,...e){const n=new URL(`https://mui.com/production-error/?code=${t}`);return e.forEach(i=>n.searchParams.append("args[]",i)),`Minified MUI error #${t}; visit ${n} for the full message.`}function Pi(t){if(typeof t!="string")throw new Error(process.env.NODE_ENV!=="production"?"MUI: `capitalize(string)` expects a string argument.":Xn(7));return t.charAt(0).toUpperCase()+t.slice(1)}var Js={exports:{}},Xs={exports:{}},Se={};/** @license React v16.13.1
|
|
109
|
+
`)},Z_=0,Ni=[];function Y_(t){var e=m.useRef([]),n=m.useRef([0,0]),i=m.useRef(),r=m.useState(Z_++)[0],s=m.useState(d1)[0],o=m.useRef(t);m.useEffect(function(){o.current=t},[t]),m.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(r));var f=v_([t.lockRef.current],(t.shards||[]).map(lm),!0).filter(Boolean);return f.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),f.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}},[t.inert,t.lockRef.current,t.shards]);var a=m.useCallback(function(f,y){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!o.current.allowPinchZoom;var v=Ys(f),C=n.current,S="deltaX"in f?f.deltaX:C[0]-v[0],k="deltaY"in f?f.deltaY:C[1]-v[1],b,w=f.target,x=Math.abs(S)>Math.abs(k)?"h":"v";if("touches"in f&&x==="h"&&w.type==="range")return!1;var P=am(x,w);if(!P)return!0;if(P?b=x:(b=x==="v"?"h":"v",P=am(x,w)),!P)return!1;if(!i.current&&"changedTouches"in f&&(S||k)&&(i.current=b),!b)return!0;var M=i.current||b;return q_(M,y,f,M==="h"?S:k)},[]),c=m.useCallback(function(f){var y=f;if(!(!Ni.length||Ni[Ni.length-1]!==s)){var v="deltaY"in y?cm(y):Ys(y),C=e.current.filter(function(b){return b.name===y.type&&(b.target===y.target||y.target===b.shadowParent)&&G_(b.delta,v)})[0];if(C&&C.should){y.cancelable&&y.preventDefault();return}if(!C){var S=(o.current.shards||[]).map(lm).filter(Boolean).filter(function(b){return b.contains(y.target)}),k=S.length>0?a(y,S[0]):!o.current.noIsolation;k&&y.cancelable&&y.preventDefault()}}},[]),l=m.useCallback(function(f,y,v,C){var S={name:f,delta:y,target:v,should:C,shadowParent:J_(v)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(k){return k!==S})},1)},[]),u=m.useCallback(function(f){n.current=Ys(f),i.current=void 0},[]),d=m.useCallback(function(f){l(f.type,cm(f),f.target,a(f,t.lockRef.current))},[]),h=m.useCallback(function(f){l(f.type,Ys(f),f.target,a(f,t.lockRef.current))},[]);m.useEffect(function(){return Ni.push(s),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Di),document.addEventListener("touchmove",c,Di),document.addEventListener("touchstart",u,Di),function(){Ni=Ni.filter(function(f){return f!==s}),document.removeEventListener("wheel",c,Di),document.removeEventListener("touchmove",c,Di),document.removeEventListener("touchstart",u,Di)}},[]);var p=t.removeScrollBar,g=t.inert;return m.createElement(m.Fragment,null,g?m.createElement(s,{styles:K_(r)}):null,p?m.createElement(j_,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function J_(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const X_=E_(u1,Y_);var m1=m.forwardRef(function(t,e){return m.createElement(va,Jt({},t,{ref:e,sideCar:X_}))});m1.classNames=va.classNames;var Q_=[" ","Enter","ArrowUp","ArrowDown"],eM=[" ","Enter"],xi="Select",[ya,ba,tM]=I8(xi),[xr,qD]=_d(xi,[tM,Yb]),Sa=Yb(),[nM,si]=xr(xi),[iM,rM]=xr(xi),g1=t=>{const{__scopeSelect:e,children:n,open:i,defaultOpen:r,onOpenChange:s,value:o,defaultValue:a,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:h,required:p,form:g}=t,f=Sa(e),[y,v]=m.useState(null),[C,S]=m.useState(null),[k,b]=m.useState(!1),w=M8(l),[x,P]=Jl({prop:i,defaultProp:r??!1,onChange:s,caller:xi}),[M,T]=Jl({prop:o,defaultProp:a,onChange:c,caller:xi}),I=m.useRef(null),D=y?g||!!y.closest("form"):!0,[z,q]=m.useState(new Set),se=Array.from(z).map(G=>G.props.value).join(";");return R.jsx(s_,{...f,children:R.jsxs(nM,{required:p,scope:e,trigger:y,onTriggerChange:v,valueNode:C,onValueNodeChange:S,valueNodeHasChildren:k,onValueNodeHasChildrenChange:b,contentId:Md(),value:M,onValueChange:T,open:x,onOpenChange:P,dir:w,triggerPointerDownPosRef:I,disabled:h,children:[R.jsx(ya.Provider,{scope:e,children:R.jsx(iM,{scope:t.__scopeSelect,onNativeOptionAdd:m.useCallback(G=>{q(X=>new Set(X).add(G))},[]),onNativeOptionRemove:m.useCallback(G=>{q(X=>{const F=new Set(X);return F.delete(G),F})},[]),children:n})}),D?R.jsxs(F1,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:M,onChange:G=>T(G.target.value),disabled:h,form:g,children:[M===void 0?R.jsx("option",{value:""}):null,Array.from(z)]},se):null]})})};g1.displayName=xi;var v1="SelectTrigger",y1=m.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:i=!1,...r}=t,s=Sa(n),o=si(v1,n),a=o.disabled||i,c=rt(e,o.onTriggerChange),l=ba(n),u=m.useRef("touch"),[d,h,p]=U1(f=>{const y=l().filter(S=>!S.disabled),v=y.find(S=>S.value===o.value),C=B1(y,f,v);C!==void 0&&o.onValueChange(C.value)}),g=f=>{a||(o.onOpenChange(!0),p()),f&&(o.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return R.jsx(o_,{asChild:!0,...s,children:R.jsx(Ue.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":j1(o.value)?"":void 0,...r,ref:c,onClick:$e(r.onClick,f=>{f.currentTarget.focus(),u.current!=="mouse"&&g(f)}),onPointerDown:$e(r.onPointerDown,f=>{u.current=f.pointerType;const y=f.target;y.hasPointerCapture(f.pointerId)&&y.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(g(f),f.preventDefault())}),onKeyDown:$e(r.onKeyDown,f=>{const y=d.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&h(f.key),!(y&&f.key===" ")&&Q_.includes(f.key)&&(g(),f.preventDefault())})})})});y1.displayName=v1;var b1="SelectValue",S1=m.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:r,children:s,placeholder:o="",...a}=t,c=si(b1,n),{onValueNodeHasChildrenChange:l}=c,u=s!==void 0,d=rt(e,c.onValueNodeChange);return gt(()=>{l(u)},[l,u]),R.jsx(Ue.span,{...a,ref:d,style:{pointerEvents:"none"},children:j1(c.value)?R.jsx(R.Fragment,{children:o}):s})});S1.displayName=b1;var sM="SelectIcon",T1=m.forwardRef((t,e)=>{const{__scopeSelect:n,children:i,...r}=t;return R.jsx(Ue.span,{"aria-hidden":!0,...r,ref:e,children:i||"▼"})});T1.displayName=sM;var oM="SelectPortal",k1=t=>R.jsx(s1,{asChild:!0,...t});k1.displayName=oM;var Ei="SelectContent",C1=m.forwardRef((t,e)=>{const n=si(Ei,t.__scopeSelect),[i,r]=m.useState();if(gt(()=>{r(new DocumentFragment)},[]),!n.open){const s=i;return s?ta.createPortal(R.jsx(w1,{scope:t.__scopeSelect,children:R.jsx(ya.Slot,{scope:t.__scopeSelect,children:R.jsx("div",{children:t.children})})}),s):null}return R.jsx(x1,{...t,ref:e})});C1.displayName=Ei;var Vt=10,[w1,oi]=xr(Ei),aM="SelectContentImpl",cM=ms("SelectContent.RemoveScroll"),x1=m.forwardRef((t,e)=>{const{__scopeSelect:n,position:i="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:f,avoidCollisions:y,...v}=t,C=si(Ei,n),[S,k]=m.useState(null),[b,w]=m.useState(null),x=rt(e,j=>k(j)),[P,M]=m.useState(null),[T,I]=m.useState(null),D=ba(n),[z,q]=m.useState(!1),se=m.useRef(!1);m.useEffect(()=>{if(S)return g_(S)},[S]),B8();const G=m.useCallback(j=>{const[W,...te]=D().map(H=>H.ref.current),[ee]=te.slice(-1),ce=document.activeElement;for(const H of j)if(H===ce||(H==null||H.scrollIntoView({block:"nearest"}),H===W&&b&&(b.scrollTop=0),H===ee&&b&&(b.scrollTop=b.scrollHeight),H==null||H.focus(),document.activeElement!==ce))return},[D,b]),X=m.useCallback(()=>G([P,S]),[G,P,S]);m.useEffect(()=>{z&&X()},[z,X]);const{onOpenChange:F,triggerPointerDownPosRef:ae}=C;m.useEffect(()=>{if(S){let j={x:0,y:0};const W=ee=>{var ce,H;j={x:Math.abs(Math.round(ee.pageX)-(((ce=ae.current)==null?void 0:ce.x)??0)),y:Math.abs(Math.round(ee.pageY)-(((H=ae.current)==null?void 0:H.y)??0))}},te=ee=>{j.x<=10&&j.y<=10?ee.preventDefault():S.contains(ee.target)||F(!1),document.removeEventListener("pointermove",W),ae.current=null};return ae.current!==null&&(document.addEventListener("pointermove",W),document.addEventListener("pointerup",te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",W),document.removeEventListener("pointerup",te,{capture:!0})}}},[S,F,ae]),m.useEffect(()=>{const j=()=>F(!1);return window.addEventListener("blur",j),window.addEventListener("resize",j),()=>{window.removeEventListener("blur",j),window.removeEventListener("resize",j)}},[F]);const[A,L]=U1(j=>{const W=D().filter(ce=>!ce.disabled),te=W.find(ce=>ce.ref.current===document.activeElement),ee=B1(W,j,te);ee&&setTimeout(()=>ee.ref.current.focus())}),Y=m.useCallback((j,W,te)=>{const ee=!se.current&&!te;(C.value!==void 0&&C.value===W||ee)&&(M(j),ee&&(se.current=!0))},[C.value]),Z=m.useCallback(()=>S==null?void 0:S.focus(),[S]),Q=m.useCallback((j,W,te)=>{const ee=!se.current&&!te;(C.value!==void 0&&C.value===W||ee)&&I(j)},[C.value]),re=i==="popper"?iu:E1,oe=re===iu?{side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:f,avoidCollisions:y}:{};return R.jsx(w1,{scope:n,content:S,viewport:b,onViewportChange:w,itemRefCallback:Y,selectedItem:P,onItemLeave:Z,itemTextRefCallback:Q,focusSelectedItem:X,selectedItemText:T,position:i,isPositioned:z,searchRef:A,children:R.jsx(m1,{as:cM,allowPinchZoom:!0,children:R.jsx(Lb,{asChild:!0,trapped:C.open,onMountAutoFocus:j=>{j.preventDefault()},onUnmountAutoFocus:$e(r,j=>{var W;(W=C.trigger)==null||W.focus({preventScroll:!0}),j.preventDefault()}),children:R.jsx(Db,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:j=>j.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:R.jsx(re,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:j=>j.preventDefault(),...v,...oe,onPlaced:()=>q(!0),ref:x,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:$e(v.onKeyDown,j=>{const W=j.ctrlKey||j.altKey||j.metaKey;if(j.key==="Tab"&&j.preventDefault(),!W&&j.key.length===1&&L(j.key),["ArrowUp","ArrowDown","Home","End"].includes(j.key)){let ee=D().filter(ce=>!ce.disabled).map(ce=>ce.ref.current);if(["ArrowUp","End"].includes(j.key)&&(ee=ee.slice().reverse()),["ArrowUp","ArrowDown"].includes(j.key)){const ce=j.target,H=ee.indexOf(ce);ee=ee.slice(H+1)}setTimeout(()=>G(ee)),j.preventDefault()}})})})})})})});x1.displayName=aM;var lM="SelectItemAlignedPosition",E1=m.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:i,...r}=t,s=si(Ei,n),o=oi(Ei,n),[a,c]=m.useState(null),[l,u]=m.useState(null),d=rt(e,x=>u(x)),h=ba(n),p=m.useRef(!1),g=m.useRef(!0),{viewport:f,selectedItem:y,selectedItemText:v,focusSelectedItem:C}=o,S=m.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&l&&f&&y&&v){const x=s.trigger.getBoundingClientRect(),P=l.getBoundingClientRect(),M=s.valueNode.getBoundingClientRect(),T=v.getBoundingClientRect();if(s.dir!=="rtl"){const ce=T.left-P.left,H=M.left-ce,Ae=x.left-H,at=x.width+Ae,On=Math.max(at,P.width),Pr=window.innerWidth-Vt,Rr=Hp(H,[Vt,Math.max(Vt,Pr-On)]);a.style.minWidth=at+"px",a.style.left=Rr+"px"}else{const ce=P.right-T.right,H=window.innerWidth-M.right-ce,Ae=window.innerWidth-x.right-H,at=x.width+Ae,On=Math.max(at,P.width),Pr=window.innerWidth-Vt,Rr=Hp(H,[Vt,Math.max(Vt,Pr-On)]);a.style.minWidth=at+"px",a.style.right=Rr+"px"}const I=h(),D=window.innerHeight-Vt*2,z=f.scrollHeight,q=window.getComputedStyle(l),se=parseInt(q.borderTopWidth,10),G=parseInt(q.paddingTop,10),X=parseInt(q.borderBottomWidth,10),F=parseInt(q.paddingBottom,10),ae=se+G+z+F+X,A=Math.min(y.offsetHeight*5,ae),L=window.getComputedStyle(f),Y=parseInt(L.paddingTop,10),Z=parseInt(L.paddingBottom,10),Q=x.top+x.height/2-Vt,re=D-Q,oe=y.offsetHeight/2,j=y.offsetTop+oe,W=se+G+j,te=ae-W;if(W<=Q){const ce=I.length>0&&y===I[I.length-1].ref.current;a.style.bottom="0px";const H=l.clientHeight-f.offsetTop-f.offsetHeight,Ae=Math.max(re,oe+(ce?Z:0)+H+X),at=W+Ae;a.style.height=at+"px"}else{const ce=I.length>0&&y===I[0].ref.current;a.style.top="0px";const Ae=Math.max(Q,se+f.offsetTop+(ce?Y:0)+oe)+te;a.style.height=Ae+"px",f.scrollTop=W-Q+f.offsetTop}a.style.margin=`${Vt}px 0`,a.style.minHeight=A+"px",a.style.maxHeight=D+"px",i==null||i(),requestAnimationFrame(()=>p.current=!0)}},[h,s.trigger,s.valueNode,a,l,f,y,v,s.dir,i]);gt(()=>S(),[S]);const[k,b]=m.useState();gt(()=>{l&&b(window.getComputedStyle(l).zIndex)},[l]);const w=m.useCallback(x=>{x&&g.current===!0&&(S(),C==null||C(),g.current=!1)},[S,C]);return R.jsx(dM,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:w,children:R.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:R.jsx(Ue.div,{...r,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});E1.displayName=lM;var uM="SelectPopperPosition",iu=m.forwardRef((t,e)=>{const{__scopeSelect:n,align:i="start",collisionPadding:r=Vt,...s}=t,o=Sa(n);return R.jsx(a_,{...o,...s,ref:e,align:i,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});iu.displayName=uM;var[dM,$d]=xr(Ei,{}),ru="SelectViewport",P1=m.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:i,...r}=t,s=oi(ru,n),o=$d(ru,n),a=rt(e,s.onViewportChange),c=m.useRef(0);return R.jsxs(R.Fragment,{children:[R.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),R.jsx(ya.Slot,{scope:n,children:R.jsx(Ue.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:$e(r.onScroll,l=>{const u=l.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&d){const p=Math.abs(c.current-u.scrollTop);if(p>0){const g=window.innerHeight-Vt*2,f=parseFloat(d.style.minHeight),y=parseFloat(d.style.height),v=Math.max(f,y);if(v<g){const C=v+p,S=Math.min(g,C),k=C-S;d.style.height=S+"px",d.style.bottom==="0px"&&(u.scrollTop=k>0?k:0,d.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});P1.displayName=ru;var R1="SelectGroup",[fM,hM]=xr(R1),pM=m.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=Md();return R.jsx(fM,{scope:n,id:r,children:R.jsx(Ue.div,{role:"group","aria-labelledby":r,...i,ref:e})})});pM.displayName=R1;var A1="SelectLabel",mM=m.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=hM(A1,n);return R.jsx(Ue.div,{id:r.id,...i,ref:e})});mM.displayName=A1;var Zo="SelectItem",[gM,I1]=xr(Zo),_1=m.forwardRef((t,e)=>{const{__scopeSelect:n,value:i,disabled:r=!1,textValue:s,...o}=t,a=si(Zo,n),c=oi(Zo,n),l=a.value===i,[u,d]=m.useState(s??""),[h,p]=m.useState(!1),g=rt(e,C=>{var S;return(S=c.itemRefCallback)==null?void 0:S.call(c,C,i,r)}),f=Md(),y=m.useRef("touch"),v=()=>{r||(a.onValueChange(i),a.onOpenChange(!1))};if(i==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return R.jsx(gM,{scope:n,value:i,disabled:r,textId:f,isSelected:l,onItemTextChange:m.useCallback(C=>{d(S=>S||((C==null?void 0:C.textContent)??"").trim())},[]),children:R.jsx(ya.ItemSlot,{scope:n,value:i,disabled:r,textValue:u,children:R.jsx(Ue.div,{role:"option","aria-labelledby":f,"data-highlighted":h?"":void 0,"aria-selected":l&&h,"data-state":l?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...o,ref:g,onFocus:$e(o.onFocus,()=>p(!0)),onBlur:$e(o.onBlur,()=>p(!1)),onClick:$e(o.onClick,()=>{y.current!=="mouse"&&v()}),onPointerUp:$e(o.onPointerUp,()=>{y.current==="mouse"&&v()}),onPointerDown:$e(o.onPointerDown,C=>{y.current=C.pointerType}),onPointerMove:$e(o.onPointerMove,C=>{var S;y.current=C.pointerType,r?(S=c.onItemLeave)==null||S.call(c):y.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:$e(o.onPointerLeave,C=>{var S;C.currentTarget===document.activeElement&&((S=c.onItemLeave)==null||S.call(c))}),onKeyDown:$e(o.onKeyDown,C=>{var k;((k=c.searchRef)==null?void 0:k.current)!==""&&C.key===" "||(eM.includes(C.key)&&v(),C.key===" "&&C.preventDefault())})})})})});_1.displayName=Zo;var Wr="SelectItemText",M1=m.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:r,...s}=t,o=si(Wr,n),a=oi(Wr,n),c=I1(Wr,n),l=rM(Wr,n),[u,d]=m.useState(null),h=rt(e,v=>d(v),c.onItemTextChange,v=>{var C;return(C=a.itemTextRefCallback)==null?void 0:C.call(a,v,c.value,c.disabled)}),p=u==null?void 0:u.textContent,g=m.useMemo(()=>R.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:f,onNativeOptionRemove:y}=l;return gt(()=>(f(g),()=>y(g)),[f,y,g]),R.jsxs(R.Fragment,{children:[R.jsx(Ue.span,{id:c.textId,...s,ref:h}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ta.createPortal(s.children,o.valueNode):null]})});M1.displayName=Wr;var O1="SelectItemIndicator",D1=m.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return I1(O1,n).isSelected?R.jsx(Ue.span,{"aria-hidden":!0,...i,ref:e}):null});D1.displayName=O1;var su="SelectScrollUpButton",N1=m.forwardRef((t,e)=>{const n=oi(su,t.__scopeSelect),i=$d(su,t.__scopeSelect),[r,s]=m.useState(!1),o=rt(e,i.onScrollButtonChange);return gt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const l=c.scrollTop>0;s(l)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?R.jsx(V1,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});N1.displayName=su;var ou="SelectScrollDownButton",L1=m.forwardRef((t,e)=>{const n=oi(ou,t.__scopeSelect),i=$d(ou,t.__scopeSelect),[r,s]=m.useState(!1),o=rt(e,i.onScrollButtonChange);return gt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const l=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<l;s(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?R.jsx(V1,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});L1.displayName=ou;var V1=m.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:i,...r}=t,s=oi("SelectScrollButton",n),o=m.useRef(null),a=ba(n),c=m.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return m.useEffect(()=>()=>c(),[c]),gt(()=>{var u;const l=a().find(d=>d.ref.current===document.activeElement);(u=l==null?void 0:l.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),R.jsx(Ue.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:$e(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(i,50))}),onPointerMove:$e(r.onPointerMove,()=>{var l;(l=s.onItemLeave)==null||l.call(s),o.current===null&&(o.current=window.setInterval(i,50))}),onPointerLeave:$e(r.onPointerLeave,()=>{c()})})}),vM="SelectSeparator",yM=m.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return R.jsx(Ue.div,{"aria-hidden":!0,...i,ref:e})});yM.displayName=vM;var au="SelectArrow",bM=m.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=Sa(n),s=si(au,n),o=oi(au,n);return s.open&&o.position==="popper"?R.jsx(c_,{...r,...i,ref:e}):null});bM.displayName=au;var SM="SelectBubbleInput",F1=m.forwardRef(({__scopeSelect:t,value:e,...n},i)=>{const r=m.useRef(null),s=rt(i,r),o=u_(e);return m.useEffect(()=>{const a=r.current;if(!a)return;const c=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==e&&u){const d=new Event("change",{bubbles:!0});u.call(a,e),a.dispatchEvent(d)}},[o,e]),R.jsx(Ue.select,{...n,style:{...o1,...n.style},ref:s,defaultValue:e})});F1.displayName=SM;function j1(t){return t===""||t===void 0}function U1(t){const e=Ci(t),n=m.useRef(""),i=m.useRef(0),r=m.useCallback(o=>{const a=n.current+o;e(a),function c(l){n.current=l,window.clearTimeout(i.current),l!==""&&(i.current=window.setTimeout(()=>c(""),1e3))}(a)},[e]),s=m.useCallback(()=>{n.current="",window.clearTimeout(i.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(i.current),[]),[n,r,s]}function B1(t,e,n){const r=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=TM(t,Math.max(s,0));r.length===1&&(o=o.filter(l=>l!==n));const c=o.find(l=>l.textValue.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function TM(t,e){return t.map((n,i)=>t[(e+i)%t.length])}var kM=g1,CM=y1,wM=S1,xM=T1,EM=k1,PM=C1,RM=P1,AM=_1,IM=M1,_M=D1,MM=N1,OM=L1;function DM({...t}){return R.jsx(kM,{"data-slot":"select",...t})}function NM({...t}){return R.jsx(wM,{"data-slot":"select-value",...t})}function LM({className:t,size:e="default",children:n,...i}){return R.jsxs(CM,{"data-slot":"select-trigger","data-size":e,className:fe(["flex w-fit cursor-pointer items-center justify-between gap-2","rounded-full px-3 py-2 text-sm whitespace-nowrap","bg-button transition-[color,border,background-color]","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-muted hover:text-muted-foreground","!focus:ring-0 !focus-visible:ring-0 !focus:border-none !focus-visible:border-none !ring-0 !border-none !outline-none","aria-invalid:ring-0 dark:aria-invalid:ring-0","data-[placeholder]:text-muted-foreground","data-[size=default]:h-9 data-[size=sm]:h-8","*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2","[&:not([class*='text-'])_svg:not([class*='text-'])]:text-muted-foreground","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],t),...i,children:[n,R.jsx(xM,{asChild:!0,children:R.jsx(Rd,{weight:"bold",className:"size-4 transition-colors"})})]})}function VM({className:t,children:e,position:n="popper",...i}){return R.jsx(EM,{children:R.jsxs(PM,{"data-slot":"select-content",className:fe(["bg-[#18182a]/90 backdrop-blur-md text-white border border-[#23233a] shadow-2xl","relative z-50 overflow-x-hidden overflow-y-auto rounded-xl","max-h-(--radix-select-content-available-height) min-w-[8rem]","origin-(--radix-select-content-transform-origin)","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95","data-[side=top]:slide-in-from-bottom-2","data-[side=right]:slide-in-from-left-2","data-[side=bottom]:slide-in-from-top-2","data-[side=left]:slide-in-from-right-2"],n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...i,children:[R.jsx(jM,{}),R.jsx(RM,{className:fe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),R.jsx(UM,{})]})})}function FM({className:t,children:e,...n}){return R.jsxs(AM,{"data-slot":"select-item",className:fe(["relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none","cursor-pointer disabled:cursor-not-allowed","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2","[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],t),...n,children:[R.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:R.jsx(_M,{children:R.jsx(lb,{className:"size-4",weight:"bold"})})}),R.jsx(IM,{children:e})]})}function jM({className:t,...e}){return R.jsx(MM,{"data-slot":"select-scroll-up-button",className:fe("flex cursor-default items-center justify-center py-1",t),...e,children:R.jsx(ab,{className:"size-4",weight:"bold"})})}function UM({className:t,...e}){return R.jsx(OM,{"data-slot":"select-scroll-down-button",className:fe("flex cursor-default items-center justify-center py-1",t),...e,children:R.jsx(Rd,{className:"size-4",weight:"bold"})})}const BM=ea.cva(["w-full rounded-full px-3 py-2 text-sm cursor-pointer","disabled:not-allowed hover:bg-button-hover focus:bg-button-hover"],{variants:{size:{default:"w-[180px]",sm:"w-auto"}},defaultVariants:{size:"default"}});function um({kind:t,track:e,requestPermissions:n,onError:i,...r}){const s=r.size||"default",o=ha(),{devices:a,activeDeviceId:c,setActiveMediaDevice:l}=OA({kind:t,room:o,track:e,requestPermissions:n,onError:i});return R.jsxs(DM,{value:c,onValueChange:l,children:[R.jsx(LM,{className:fe(BM({size:s}),r.className,"hover:bg"),children:s!=="sm"&&R.jsx(NM,{className:"font-mono text-sm",placeholder:`Select a ${t}`})}),R.jsx(VM,{children:a.map(u=>R.jsx(FM,{value:u.deviceId,className:"font-mono text-xs",children:u.label},u.deviceId))})]})}function $M(t,e,n=!1){if(n)return Ad;switch(t){case _.Source.Microphone:return e?ub:db;case _.Source.Camera:return e?pb:mb;case _.Source.ScreenShare:return fb;default:return m.Fragment}}function Ac({source:t,pressed:e,pending:n,className:i,...r}){const s=$M(t,e??!1,n),o=t===_.Source.Microphone&&!(e??!1)&&!n,a=t===_.Source.Camera&&!(e??!1)&&!n;return R.jsxs(Mb,{pressed:e,"aria-label":`Toggle ${t}`,className:fe(i),...r,children:[R.jsx(s,{weight:"bold",className:fe(n&&"animate-spin",o||a?"text-red-500":void 0)}),r.children]})}const HM=t=>{switch(t){case _.Source.Camera:return 1;case _.Source.Microphone:return 2;case _.Source.ScreenShare:return 3;default:return 0}};function zM(){const t=MA(),e=n=>!!(t!=null&&t.canPublish)&&(t.canPublishSources.length===0||t.canPublishSources.includes(HM(n)));return{camera:e(_.Source.Camera),microphone:e(_.Source.Microphone),screenShare:e(_.Source.ScreenShare),data:(t==null?void 0:t.canPublishData)??!1}}function WM(t={}){const{controls:e,saveUserChoices:n=!0}=t,i={leave:!0,...e},{microphoneTrack:r,localParticipant:s}=eb(),o=zM(),a=ri(),c=gc({source:_.Source.Microphone,onDeviceError:w=>{var x;return(x=t.onDeviceError)==null?void 0:x.call(t,{source:_.Source.Microphone,error:w})}}),l=gc({source:_.Source.Camera,onDeviceError:w=>{var x;return(x=t.onDeviceError)==null?void 0:x.call(t,{source:_.Source.Camera,error:w})}}),u=gc({source:_.Source.ScreenShare,onDeviceError:w=>{var x;return(x=t.onDeviceError)==null?void 0:x.call(t,{source:_.Source.ScreenShare,error:w})}}),d=m.useMemo(()=>({participant:s,source:_.Source.Microphone,publication:r}),[s,r]);i.microphone??(i.microphone=o.microphone),i.screenShare??(i.screenShare=o.screenShare),i.camera??(i.camera=o.camera),i.chat??(i.chat=o.data);const{saveAudioInputEnabled:h,saveAudioInputDeviceId:p,saveVideoInputEnabled:g,saveVideoInputDeviceId:f}=jA({preventSave:!n}),y=m.useCallback(()=>{a&&a.disconnect()},[a]),v=m.useCallback(w=>{p(w??"default")},[p]),C=m.useCallback(w=>{f(w??"default")},[f]),S=m.useCallback(async w=>{u.enabled&&u.toggle(!1),await l.toggle(w),g(!l.enabled)},[l,g,u]),k=m.useCallback(async w=>{await c.toggle(w),h(!c.enabled)},[c,h]),b=m.useCallback(async w=>{l.enabled&&l.toggle(!1),await u.toggle(w)},[l,u]);return{micTrackRef:d,visibleControls:i,cameraToggle:{...l,toggle:S},microphoneToggle:{...c,toggle:k},screenShareToggle:{...u,toggle:b},handleDisconnect:y,handleAudioDeviceChange:v,handleVideoDeviceChange:C}}function qM({controls:t,saveUserChoices:e=!0,capabilities:n,className:i,onSendMessage:r,onChatOpenChange:s,onDisconnect:o,onDeviceError:a,...c}){const[l,u]=m.useState(!1),[d,h]=m.useState(!1),{micTrackRef:p,visibleControls:g,cameraToggle:f,microphoneToggle:y,screenShareToggle:v,handleAudioDeviceChange:C,handleVideoDeviceChange:S,handleDisconnect:k}=WM({controls:t,saveUserChoices:e}),b=async x=>{h(!0);try{await(r==null?void 0:r(x))}finally{h(!1)}},w=()=>{k(),o==null||o()};return m.useEffect(()=>{s==null||s(l)},[l,s]),R.jsxs("div",{"aria-label":"Voice assistant controls",className:fe("border border-border rounded-3xl py-4 flex flex-col justify-end h-full",i),...c,children:[n.suportsChatInput&&R.jsxs("div",{inert:!l,className:fe("overflow-hidden transition-[height] relative duration-300 ease-in-out",l?"h-[64px] mb-3":"h-0"),children:[R.jsx("div",{className:"flex h-9 px-4 w-full",children:R.jsx(T8,{onSend:b,disabled:d,className:"w-full"})}),R.jsx("hr",{className:"border-border my-2 mx-5"})]}),R.jsxs("div",{className:"flex flex-row items-center gap-2 rounded-2xl mx-auto bg-[#18182a]/80 border-none backdrop-blur-lg px-2 py-2",children:[R.jsxs("div",{className:"flex gap-y-2 justify-start",children:[g.microphone&&R.jsxs("div",{className:"flex gap-y-2 items-center rounded-full overflow-hidden border-none ",children:[R.jsx(Ac,{variant:"primary",source:_.Source.Microphone,pressed:y.enabled,disabled:y.pending,onPressedChange:y.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),R.jsx(sb,{barCount:3,trackRef:p,options:{minHeight:5},className:"flex h-full w-auto items-center justify-center gap-x-0.5",children:R.jsx("span",{className:fe(["h-full w-0.5 origin-center rounded-2xl","bg-white","group-data-[state=on]/track:bg-white group-data-[state=off]/track:bg-white","data-lk-muted:bg-muted"])})}),R.jsx(um,{size:"sm",kind:"audioinput",onError:a?x=>x instanceof Error?a({source:_.Source.Microphone,error:x}):void 0:void 0,onActiveDeviceChange:C,className:fe(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/30 transition-colors","min-w-[2.5rem]"])})]}),n.suportsVideoInput&&g.camera&&R.jsxs("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:[R.jsx(Ac,{variant:"primary",source:_.Source.Camera,pressed:f.enabled,pending:f.pending,disabled:f.pending,onPressedChange:f.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),R.jsx(um,{size:"sm",kind:"videoinput",onError:a?x=>x instanceof Error?a({source:_.Source.Camera,error:x}):void 0:void 0,onActiveDeviceChange:S,className:fe(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors","min-w-[2.5rem]"])})]}),g.leave&&R.jsx("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:R.jsx(Ab,{onClick:w,className:"font-semibold py-2 rounded-none border-none bg-transparent text-inherit transition-colors flex items-center",children:R.jsx(hb,{weight:"bold",className:"text-red-600"})})}),n.suportsScreenShare&&g.screenShare&&R.jsx("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:R.jsx(Ac,{variant:"secondary",source:_.Source.ScreenShare,pressed:v.enabled,disabled:v.pending,onPressedChange:v.toggle,className:"w-auto py-2 disabled:opacity-70 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"})})]}),g.chat&&R.jsx("div",{className:"flex items-center rounded-full overflow-hidden bg-secondary text-secondary-foreground border-none ",children:R.jsx(Mb,{variant:"secondary","aria-label":"Toggle chat",pressed:l,onPressedChange:x=>{u(x)},className:"aspect-square h-full py-3 rounded-none border-none bg-transparent text-inherit focus:bg-secondary/80 hover:bg-secondary/80 transition-colors flex items-center",children:R.jsx(cb,{weight:"bold",className:"h-5 w-5"})})})]})]})}const GM=(t,e)=>{var a,c;const n=m.useMemo(()=>e?e(t.message):t.message,[t.message,e]),i=!!t.editTimestamp,r=new Date(t.timestamp),s=typeof navigator<"u"?navigator.language:"en-US",o=(a=t.from)!=null&&a.name&&t.from.name!==""?t.from.name:(c=t.from)==null?void 0:c.identity;return{message:n,hasBeenEdited:i,time:r,locale:s,name:o}},KM=({entry:t,messageFormatter:e,className:n,participantName:i,...r})=>{var u,d;const{message:s,time:o,locale:a}=GM(t,e),c=((u=t.from)==null?void 0:u.isLocal)??!1;console.log("ChatEntry",{entry:t,message:s,time:o,locale:a,isLocalUser:c}),fe("w-full px-3 py-2 rounded-2xl text-xs break-words whitespace-pre-line",c?" text-end border border-[#5078F2]/30":"bg-muted text-foreground border border-[#813aa7]/30","text-left");const l=fe("inline-flex items-center justify-center w-6 h-6 rounded-full text-xs font-bold flex-shrink-0",c?"bg-[#5078F2] text-white":"bg-[#813aa7] ml-1 text-white");return R.jsx("li",{title:o.toLocaleTimeString(a,{timeStyle:"full"}),className:fe("group flex mb-2",c?"justify-end":"justify-start",n),...r,children:R.jsxs("div",{className:fe("flex w-fit max-w-full rounded-2xl border",c?"flex-row-reverse items-center border-[#5078F2]/30":"flex-row items-center border-[#813aa7]/30 bg-muted text-foreground"),children:[R.jsx("span",{className:l,children:c?((d=i==null?void 0:i[0])==null?void 0:d.toUpperCase())||"U":"A"}),R.jsx("span",{className:fe("flex items-center text-xs break-words whitespace-pre-line",c?"ml-auto justify-end text-right":"justify-start text-left","px-3 py-2"),children:s})]})})};function ZM(t){B.useEffect(()=>{function e(){const{scrollingElement:n}=document;n&&(n.scrollTop=n.scrollHeight)}if(t.current){const n=new ResizeObserver(e);return n.observe(t.current),e(),()=>n.disconnect()}},[t])}const YM=({className:t,children:e,...n})=>{const i=B.useRef(null);return ZM(i),R.jsx("div",{ref:i,className:fe("flex flex-col justify-end",t),...n,children:e})},JM=({state:t,audioTrack:e,className:n,ref:i})=>R.jsx("div",{ref:i,className:fe("",n),children:R.jsx(sb,{barCount:5,state:t,options:{minHeight:5},trackRef:e,className:fe("flex aspect-video w-40 items-center justify-center gap-1"),children:R.jsx("span",{className:fe(["bg-[#6721a4] min-h-2 w-2 rounded-full","origin-center transition-colors duration-250 ease-linear","data-[lk-highlighted=true]:bg-[#5c64f6]","data-[lk-muted=true]:bg-[#222222]"])})})}),XM=({videoTrack:t,className:e,ref:n})=>{var i,r;return R.jsx("div",{ref:n,className:fe(e),children:R.jsx(rb,{trackRef:t,width:((i=t==null?void 0:t.publication.dimensions)==null?void 0:i.width)??0,height:((r=t==null?void 0:t.publication.dimensions)==null?void 0:r.height)??0,className:"rounded-md"})})},QM=Zn.create(rb),e6=({trackRef:t,className:e,ref:n})=>{var i,r;return R.jsx("div",{className:fe("bg-muted overflow-hidden rounded-md",e),children:R.jsx(QM,{ref:n,trackRef:t,width:((i=t==null?void 0:t.publication.dimensions)==null?void 0:i.width)??0,height:((r=t==null?void 0:t.publication.dimensions)==null?void 0:r.height)??0,className:fe("h-full w-auto")})})},dm=Zn.create(e6),t6=Zn.create(JM),n6=Zn.create(XM),fn={initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},transition:{type:"spring",stiffness:675,damping:75,mass:1}},Li={grid:["h-full w-full","grid gap-x-2 place-content-center","grid-cols-[1fr_1fr] grid-rows-[90px_1fr_90px]"],agentChatOpenWithSecondTile:["col-start-1 row-start-1","self-center justify-self-end"],agentChatOpenWithoutSecondTile:["col-start-1 row-start-1","col-span-2","place-content-center"],agentChatClosed:["col-start-1 row-start-1","col-span-2 row-span-3","place-content-center"],secondTileChatOpen:["col-start-2 row-start-1","self-center justify-self-start"],secondTileChatClosed:["col-start-2 row-start-3","place-content-end"]};function i6(t){const{localParticipant:e}=eb(),n=e.getTrackPublication(t);return B.useMemo(()=>n?{source:t,participant:e,publication:n}:void 0,[t,n,e])}function r6({chatOpen:t}){const{state:e,audioTrack:n,videoTrack:i,agent:{isActive:r=!1}={}}=nb(),[s]=tb([_.Source.ScreenShare]),o=i6(_.Source.Camera),a=o&&!o.publication.isMuted,c=s&&!s.publication.isMuted,l=a||c,u={...fn.transition,delay:t?0:.15},d={...fn.animate,scale:t?1:3,transition:u},h={...fn.animate,transition:u},p=u,g=u,f=i!==void 0;return R.jsx("div",{className:"relative w-full h-full z-10 flex items-center justify-center",children:R.jsx("div",{className:"relative w-full h-full max-w-2xl px-4 md:px-0",children:R.jsxs("div",{className:fe(Li.grid),children:[r&&R.jsx("div",{className:fe(["grid",!t&&Li.agentChatClosed,t&&l&&Li.agentChatOpenWithSecondTile,t&&!l&&Li.agentChatOpenWithoutSecondTile]),children:R.jsxs("div",{className:"h-full flex items-center justify-center",children:[!f&&R.jsx(t6,{layoutId:"agent",...fn,animate:d,transition:p,state:e,audioTrack:n,className:fe(t?"h-[90px]":"h-auto w-full")},"agent"),f&&R.jsx(n6,{layoutId:"avatar",...fn,animate:h,transition:g,videoTrack:i,className:fe(t?"h-[90px] [&>video]:h-[90px] [&>video]:w-auto":"h-auto w-full")},"avatar")]})}),R.jsx("div",{className:fe(["grid",t&&Li.secondTileChatOpen,!t&&Li.secondTileChatClosed]),children:R.jsxs("div",{className:"w-full px-10 flex items-center shadow-2xl justify-between",children:[o&&a&&R.jsx(dm,{layout:"position",layoutId:"camera",...fn,trackRef:o,transition:{...fn.transition,delay:t?0:.15},className:"h-[60px] order-1"},"camera"),c&&R.jsx(dm,{layout:"position",layoutId:"screen",...fn,trackRef:s,transition:{...fn.transition,delay:t?0:.15},className:"h-[70px] order-2"},"screen")]})})]})})})}function s6(){const t=KA(),e=FA(),n=ri();return{messages:B.useMemo(()=>[...t.map(s=>c8(s,n)),...e.chatMessages].sort((s,o)=>s.timestamp-o.timestamp),[t,e.chatMessages,n]),send:e.send}}const o6=({logLevel:t}={})=>{const e=ri();m.useEffect(()=>(QT(t??"debug"),window.__lk_room=e,()=>{window.__lk_room=void 0}),[e,t])},a6=({disabled:t,capabilities:e,sessionStarted:n,ref:i,participantName:r="User",loadingText:s="Waiting for agent to connect..."})=>{const[o,a]=B.useState(!1),{messages:c,send:l}=s6(),u=B.useRef(null),{agent:{isActive:d=!1}={}}=nb();o6(),B.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[c.length]);async function h(p){await l(p)}return R.jsx("main",{ref:i,inert:t,className:fe("w-full flex flex-col items-center justify-center","max-w-md mx-auto","bg-gradient-to-br from-[#171727] to-[#12121F] rounded-2xl shadow-xl p-0","overflow-hidden","h-full"),style:{minHeight:0},children:R.jsxs("div",{className:"w-full h-full flex-1 flex flex-col items-center justify-end px-0",children:[!d&&R.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full min-h-[180px]",children:[R.jsx(Ad,{className:"w-10 h-10 animate-spin text-blue-400 mb-2",weight:"bold"}),R.jsx("span",{className:"text-sm text-muted-foreground opacity-80",children:s})]}),d&&R.jsxs(R.Fragment,{children:[o&&R.jsx(YM,{className:fe("mx-auto w-full py-2 max-w-2xl px-5 transition-[opacity,translate] duration-300 ease-out ","max-h-[calc(100%-80px)]",o?"translate-y-0 opacity-100 delay-200":"translate-y-10 opacity-0"),children:R.jsx("div",{ref:u,className:"space-y-3 relative whitespace-pre-wrap z-0 overflow-y-auto scrollbar-hide",style:{scrollbarWidth:"none"},children:R.jsx($0,{children:c.map(p=>R.jsx(Zn.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:1,height:"auto"},transition:{duration:.5,ease:"easeOut"},children:R.jsx(KM,{participantName:r,entry:p},p.id)},p.id))})})}),!o&&R.jsx(r6,{chatOpen:o}),R.jsx("div",{className:"w-full relative h-fit flex flex-col mb-1",children:R.jsx(Zn.div,{initial:{opacity:0,y:30},animate:{opacity:n?1:0,y:n?0:30},transition:{duration:.3,delay:n?.5:0,ease:"easeOut"},className:"rounded-xl flex flex-col-reverse justify-end h-full my-2 ",children:R.jsx(qM,{capabilities:e,onChatOpenChange:a,onSendMessage:h,className:"border-none py-1 rounded-xl"})},"control-bar")})]})]})})},fm=t=>t,c6=()=>{let t=fm;return{configure(e){t=e},generate(e){return t(e)},reset(){t=fm}}},l6=c6();function Xn(t,...e){const n=new URL(`https://mui.com/production-error/?code=${t}`);return e.forEach(i=>n.searchParams.append("args[]",i)),`Minified MUI error #${t}; visit ${n} for the full message.`}function Pi(t){if(typeof t!="string")throw new Error(process.env.NODE_ENV!=="production"?"MUI: `capitalize(string)` expects a string argument.":Xn(7));return t.charAt(0).toUpperCase()+t.slice(1)}var Js={exports:{}},Xs={exports:{}},Se={};/** @license React v16.13.1
|
|
110
110
|
* react-is.production.min.js
|
|
111
111
|
*
|
|
112
112
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
package/dist/index.js
CHANGED
|
@@ -31833,7 +31833,7 @@ const k6 = ({ logLevel: t } = {}) => {
|
|
|
31833
31833
|
}
|
|
31834
31834
|
),
|
|
31835
31835
|
!o && /* @__PURE__ */ R.jsx(S6, { chatOpen: o }),
|
|
31836
|
-
/* @__PURE__ */ R.jsx("div", { className: "w-full h-fit flex flex-col mb-1", children: /* @__PURE__ */ R.jsx(
|
|
31836
|
+
/* @__PURE__ */ R.jsx("div", { className: "w-full relative h-fit flex flex-col mb-1", children: /* @__PURE__ */ R.jsx(
|
|
31837
31837
|
ei.div,
|
|
31838
31838
|
{
|
|
31839
31839
|
initial: { opacity: 0, y: 30 },
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voxket-ai/voxket-live",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "A React widget for embedding Voxket-powered audio/video/chat experiences.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
+
"style": "./dist/index.css",
|
|
9
10
|
"files": [
|
|
10
11
|
"dist"
|
|
11
12
|
],
|
|
@@ -18,7 +19,8 @@
|
|
|
18
19
|
"import": "./dist/index.js",
|
|
19
20
|
"require": "./dist/index.cjs",
|
|
20
21
|
"types": "./dist/index.d.ts"
|
|
21
|
-
}
|
|
22
|
+
},
|
|
23
|
+
"./dist/index.css": "./dist/index.css"
|
|
22
24
|
},
|
|
23
25
|
"publishConfig": {
|
|
24
26
|
"registry": "https://registry.npmjs.org/"
|