@voxket-ai/voxket-live 1.0.75 → 1.0.76
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.cjs +10 -198
- package/dist/index.css +1 -0
- package/dist/index.js +1781 -1988
- package/package.json +2 -2
- package/dist/assets/index.css +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,223 +1,35 @@
|
|
|
1
|
-
"use strict";var al=Object.defineProperty;var ll=(e,t,n)=>t in e?al(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var me=(e,t,n)=>ll(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("react"),a=require("react/jsx-runtime"),I=require("livekit-client"),ue=require("@livekit/components-react"),$i=require("sonner"),cl=require("@phosphor-icons/react"),un=require("class-variance-authority"),dl=require("clsx"),ul=require("@radix-ui/react-toggle"),hl=require("@radix-ui/react-select"),ge=require("lucide-react"),Be=require("@mui/icons-material"),ml=require("react-dom/client");function ps(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const h=ps(y),fl=ps(ul),Ee=ps(hl),xs=y.createContext({});function ys(e){const t=y.useRef(null);return t.current===null&&(t.current=e()),t.current}const bs=typeof window<"u",Oi=bs?y.useLayoutEffect:y.useEffect,hn=y.createContext(null);function vs(e,t){e.indexOf(t)===-1&&e.push(t)}function ws(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const $e=(e,t,n)=>n>t?t:n<e?e:n;function zn(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}let pt=()=>{},Oe=()=>{};process.env.NODE_ENV!=="production"&&(pt=(e,t,n)=>{!e&&typeof console<"u"&&console.warn(zn(t,n))},Oe=(e,t,n)=>{if(!e)throw new Error(zn(t,n))});const _e={},_i=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Hi(e){return typeof e=="object"&&e!==null}const zi=e=>/^0[^.\s]+$/u.test(e);function Ss(e){let t;return()=>(t===void 0&&(t=e()),t)}const Ae=e=>e,gl=(e,t)=>n=>t(e(n)),Lt=(...e)=>e.reduce(gl),Nt=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s};class Cs{constructor(){this.subscriptions=[]}add(t){return vs(this.subscriptions,t),()=>ws(this.subscriptions,t)}notify(t,n,s){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,n,s);else for(let r=0;r<o;r++){const i=this.subscriptions[r];i&&i(t,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ve=e=>e*1e3,Pe=e=>e/1e3;function Zi(e,t){return t?e*(1e3/t):0}const ao=new Set;function ks(e,t,n){e||ao.has(t)||(console.warn(zn(t,n)),ao.add(t))}const Ui=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,pl=1e-7,xl=12;function yl(e,t,n,s,o){let r,i,l=0;do i=t+(n-t)/2,r=Ui(i,s,o)-e,r>0?n=i:t=i;while(Math.abs(r)>pl&&++l<xl);return i}function Bt(e,t,n,s){if(e===t&&n===s)return Ae;const o=r=>yl(r,0,1,e,n);return r=>r===0||r===1?r:Ui(o(r),t,s)}const Wi=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ki=e=>t=>1-e(1-t),Gi=Bt(.33,1.53,.69,.99),js=Ki(Gi),Yi=Wi(js),qi=e=>(e*=2)<1?.5*js(e):.5*(2-Math.pow(2,-10*(e-1))),Es=e=>1-Math.sin(Math.acos(e)),Xi=Ki(Es),Ji=Wi(Es),bl=Bt(.42,0,1,1),vl=Bt(0,0,.58,1),Qi=Bt(.42,0,.58,1),wl=e=>Array.isArray(e)&&typeof e[0]!="number",er=e=>Array.isArray(e)&&typeof e[0]=="number",lo={linear:Ae,easeIn:bl,easeInOut:Qi,easeOut:vl,circIn:Es,circInOut:Ji,circOut:Xi,backIn:js,backInOut:Yi,backOut:Gi,anticipate:qi},Sl=e=>typeof e=="string",co=e=>{if(er(e)){Oe(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,s,o]=e;return Bt(t,n,s,o)}else if(Sl(e))return Oe(lo[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),lo[e];return e},Ut=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Cl(e,t){let n=new Set,s=new Set,o=!1,r=!1;const i=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(u){i.has(u)&&(d.schedule(u),e()),u(l)}const d={schedule:(u,m=!1,f=!1)=>{const p=f&&o?n:s;return m&&i.add(u),p.has(u)||p.add(u),u},cancel:u=>{s.delete(u),i.delete(u)},process:u=>{if(l=u,o){r=!0;return}o=!0,[n,s]=[s,n],n.forEach(c),n.clear(),o=!1,r&&(r=!1,d.process(u))}};return d}const kl=40;function tr(e,t){let n=!1,s=!0;const o={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,i=Ut.reduce((S,w)=>(S[w]=Cl(r),S),{}),{setup:l,read:c,resolveKeyframes:d,preUpdate:u,update:m,preRender:f,render:g,postRender:p}=i,x=()=>{const S=_e.useManualTiming?o.timestamp:performance.now();n=!1,_e.useManualTiming||(o.delta=s?1e3/60:Math.max(Math.min(S-o.timestamp,kl),1)),o.timestamp=S,o.isProcessing=!0,l.process(o),c.process(o),d.process(o),u.process(o),m.process(o),f.process(o),g.process(o),p.process(o),o.isProcessing=!1,n&&t&&(s=!1,e(x))},v=()=>{n=!0,s=!0,o.isProcessing||e(x)};return{schedule:Ut.reduce((S,w)=>{const C=i[w];return S[w]=(A,j=!1,k=!1)=>(n||v(),C.schedule(A,j,k)),S},{}),cancel:S=>{for(let w=0;w<Ut.length;w++)i[Ut[w]].cancel(S)},state:o,steps:i}}const{schedule:ie,cancel:Ue,state:xe,steps:wn}=tr(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ae,!0);let Qt;function jl(){Qt=void 0}const Se={now:()=>(Qt===void 0&&Se.set(xe.isProcessing||_e.useManualTiming?xe.timestamp:performance.now()),Qt),set:e=>{Qt=e,queueMicrotask(jl)}},nr=e=>t=>typeof t=="string"&&t.startsWith(e),As=nr("--"),El=nr("var(--"),Ms=e=>El(e)?Al.test(e.split("/*")[0].trim()):!1,Al=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,xt={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Pt={...xt,transform:e=>$e(0,1,e)},Wt={...xt,default:1},At=e=>Math.round(e*1e5)/1e5,Ts=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Ml(e){return e==null}const Tl=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Vs=(e,t)=>n=>!!(typeof n=="string"&&Tl.test(n)&&n.startsWith(e)||t&&!Ml(n)&&Object.prototype.hasOwnProperty.call(n,t)),sr=(e,t,n)=>s=>{if(typeof s!="string")return s;const[o,r,i,l]=s.match(Ts);return{[e]:parseFloat(o),[t]:parseFloat(r),[n]:parseFloat(i),alpha:l!==void 0?parseFloat(l):1}},Vl=e=>$e(0,255,e),Sn={...xt,transform:e=>Math.round(Vl(e))},Xe={test:Vs("rgb","red"),parse:sr("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+Sn.transform(e)+", "+Sn.transform(t)+", "+Sn.transform(n)+", "+At(Pt.transform(s))+")"};function Nl(e){let t="",n="",s="",o="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),o=e.substring(4,5),t+=t,n+=n,s+=s,o+=o),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:o?parseInt(o,16)/255:1}}const Zn={test:Vs("#"),parse:Nl,transform:Xe.transform},$t=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ze=$t("deg"),Re=$t("%"),Z=$t("px"),Pl=$t("vh"),Rl=$t("vw"),uo={...Re,parse:e=>Re.parse(e)/100,transform:e=>Re.transform(e*100)},it={test:Vs("hsl","hue"),parse:sr("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+Re.transform(At(t))+", "+Re.transform(At(n))+", "+At(Pt.transform(s))+")"},fe={test:e=>Xe.test(e)||Zn.test(e)||it.test(e),parse:e=>Xe.test(e)?Xe.parse(e):it.test(e)?it.parse(e):Zn.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Xe.transform(e):it.transform(e),getAnimatableNone:e=>{const t=fe.parse(e);return t.alpha=0,fe.transform(t)}},Il=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Dl(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Ts))==null?void 0:t.length)||0)+(((n=e.match(Il))==null?void 0:n.length)||0)>0}const or="number",ir="color",Fl="var",Ll="var(",ho="${}",Bl=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Rt(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},o=[];let r=0;const l=t.replace(Bl,c=>(fe.test(c)?(s.color.push(r),o.push(ir),n.push(fe.parse(c))):c.startsWith(Ll)?(s.var.push(r),o.push(Fl),n.push(c)):(s.number.push(r),o.push(or),n.push(parseFloat(c))),++r,ho)).split(ho);return{values:n,split:l,indexes:s,types:o}}function rr(e){return Rt(e).values}function ar(e){const{split:t,types:n}=Rt(e),s=t.length;return o=>{let r="";for(let i=0;i<s;i++)if(r+=t[i],o[i]!==void 0){const l=n[i];l===or?r+=At(o[i]):l===ir?r+=fe.transform(o[i]):r+=o[i]}return r}}const $l=e=>typeof e=="number"?0:fe.test(e)?fe.getAnimatableNone(e):e;function Ol(e){const t=rr(e);return ar(e)(t.map($l))}const We={test:Dl,parse:rr,createTransformer:ar,getAnimatableNone:Ol};function Cn(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function _l({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let o=0,r=0,i=0;if(!t)o=r=i=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;o=Cn(c,l,e+1/3),r=Cn(c,l,e),i=Cn(c,l,e-1/3)}return{red:Math.round(o*255),green:Math.round(r*255),blue:Math.round(i*255),alpha:s}}function rn(e,t){return n=>n>0?t:e}const le=(e,t,n)=>e+(t-e)*n,kn=(e,t,n)=>{const s=e*e,o=n*(t*t-s)+s;return o<0?0:Math.sqrt(o)},Hl=[Zn,Xe,it],zl=e=>Hl.find(t=>t.test(e));function mo(e){const t=zl(e);if(pt(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let n=t.parse(e);return t===it&&(n=_l(n)),n}const fo=(e,t)=>{const n=mo(e),s=mo(t);if(!n||!s)return rn(e,t);const o={...n};return r=>(o.red=kn(n.red,s.red,r),o.green=kn(n.green,s.green,r),o.blue=kn(n.blue,s.blue,r),o.alpha=le(n.alpha,s.alpha,r),Xe.transform(o))},Un=new Set(["none","hidden"]);function Zl(e,t){return Un.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Ul(e,t){return n=>le(e,t,n)}function Ns(e){return typeof e=="number"?Ul:typeof e=="string"?Ms(e)?rn:fe.test(e)?fo:Gl:Array.isArray(e)?lr:typeof e=="object"?fe.test(e)?fo:Wl:rn}function lr(e,t){const n=[...e],s=n.length,o=e.map((r,i)=>Ns(r)(r,t[i]));return r=>{for(let i=0;i<s;i++)n[i]=o[i](r);return n}}function Wl(e,t){const n={...e,...t},s={};for(const o in n)e[o]!==void 0&&t[o]!==void 0&&(s[o]=Ns(e[o])(e[o],t[o]));return o=>{for(const r in s)n[r]=s[r](o);return n}}function Kl(e,t){const n=[],s={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const r=t.types[o],i=e.indexes[r][s[r]],l=e.values[i]??0;n[o]=l,s[r]++}return n}const Gl=(e,t)=>{const n=We.createTransformer(t),s=Rt(e),o=Rt(t);return s.indexes.var.length===o.indexes.var.length&&s.indexes.color.length===o.indexes.color.length&&s.indexes.number.length>=o.indexes.number.length?Un.has(e)&&!o.values.length||Un.has(t)&&!s.values.length?Zl(e,t):Lt(lr(Kl(s,o),o.values),n):(pt(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),rn(e,t))};function cr(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?le(e,t,n):Ns(e)(e,t)}const Yl=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>ie.update(t,n),stop:()=>Ue(t),now:()=>xe.isProcessing?xe.timestamp:Se.now()}},dr=(e,t,n=10)=>{let s="";const o=Math.max(Math.round(t/n),2);for(let r=0;r<o;r++)s+=Math.round(e(r/(o-1))*1e4)/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},an=2e4;function Ps(e){let t=0;const n=50;let s=e.next(t);for(;!s.done&&t<an;)t+=n,s=e.next(t);return t>=an?1/0:t}function ql(e,t=100,n){const s=n({...e,keyframes:[0,t]}),o=Math.min(Ps(s),an);return{type:"keyframes",ease:r=>s.next(o*r).value/t,duration:Pe(o)}}const Xl=5;function ur(e,t,n){const s=Math.max(t-Xl,0);return Zi(n-e(s),t-s)}const ae={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},jn=.001;function Jl({duration:e=ae.duration,bounce:t=ae.bounce,velocity:n=ae.velocity,mass:s=ae.mass}){let o,r;pt(e<=Ve(ae.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let i=1-t;i=$e(ae.minDamping,ae.maxDamping,i),e=$e(ae.minDuration,ae.maxDuration,Pe(e)),i<1?(o=d=>{const u=d*i,m=u*e,f=u-n,g=Wn(d,i),p=Math.exp(-m);return jn-f/g*p},r=d=>{const m=d*i*e,f=m*n+n,g=Math.pow(i,2)*Math.pow(d,2)*e,p=Math.exp(-m),x=Wn(Math.pow(d,2),i);return(-o(d)+jn>0?-1:1)*((f-g)*p)/x}):(o=d=>{const u=Math.exp(-d*e),m=(d-n)*e+1;return-jn+u*m},r=d=>{const u=Math.exp(-d*e),m=(n-d)*(e*e);return u*m});const l=5/e,c=ec(o,r,l);if(e=Ve(e),isNaN(c))return{stiffness:ae.stiffness,damping:ae.damping,duration:e};{const d=Math.pow(c,2)*s;return{stiffness:d,damping:i*2*Math.sqrt(s*d),duration:e}}}const Ql=12;function ec(e,t,n){let s=n;for(let o=1;o<Ql;o++)s=s-e(s)/t(s);return s}function Wn(e,t){return e*Math.sqrt(1-t*t)}const tc=["duration","bounce"],nc=["stiffness","damping","mass"];function go(e,t){return t.some(n=>e[n]!==void 0)}function sc(e){let t={velocity:ae.velocity,stiffness:ae.stiffness,damping:ae.damping,mass:ae.mass,isResolvedFromDuration:!1,...e};if(!go(e,nc)&&go(e,tc))if(e.visualDuration){const n=e.visualDuration,s=2*Math.PI/(n*1.2),o=s*s,r=2*$e(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:ae.mass,stiffness:o,damping:r}}else{const n=Jl(e);t={...t,...n,mass:ae.mass},t.isResolvedFromDuration=!0}return t}function ln(e=ae.visualDuration,t=ae.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:o}=n;const r=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],l={done:!1,value:r},{stiffness:c,damping:d,mass:u,duration:m,velocity:f,isResolvedFromDuration:g}=sc({...n,velocity:-Pe(n.velocity||0)}),p=f||0,x=d/(2*Math.sqrt(c*u)),v=i-r,E=Pe(Math.sqrt(c/u)),b=Math.abs(v)<5;s||(s=b?ae.restSpeed.granular:ae.restSpeed.default),o||(o=b?ae.restDelta.granular:ae.restDelta.default);let S;if(x<1){const C=Wn(E,x);S=A=>{const j=Math.exp(-x*E*A);return i-j*((p+x*E*v)/C*Math.sin(C*A)+v*Math.cos(C*A))}}else if(x===1)S=C=>i-Math.exp(-E*C)*(v+(p+E*v)*C);else{const C=E*Math.sqrt(x*x-1);S=A=>{const j=Math.exp(-x*E*A),k=Math.min(C*A,300);return i-j*((p+x*E*v)*Math.sinh(k)+C*v*Math.cosh(k))/C}}const w={calculatedDuration:g&&m||null,next:C=>{const A=S(C);if(g)l.done=C>=m;else{let j=C===0?p:0;x<1&&(j=C===0?Ve(p):ur(S,C,A));const k=Math.abs(j)<=s,D=Math.abs(i-A)<=o;l.done=k&&D}return l.value=l.done?i:A,l},toString:()=>{const C=Math.min(Ps(w),an),A=dr(j=>w.next(C*j).value,C,30);return C+"ms "+A},toTransition:()=>{}};return w}ln.applyToOptions=e=>{const t=ql(e,100,ln);return e.ease=t.ease,e.duration=Ve(t.duration),e.type="keyframes",e};function Kn({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:o=10,bounceStiffness:r=500,modifyTarget:i,min:l,max:c,restDelta:d=.5,restSpeed:u}){const m=e[0],f={done:!1,value:m},g=k=>l!==void 0&&k<l||c!==void 0&&k>c,p=k=>l===void 0?c:c===void 0||Math.abs(l-k)<Math.abs(c-k)?l:c;let x=n*t;const v=m+x,E=i===void 0?v:i(v);E!==v&&(x=E-m);const b=k=>-x*Math.exp(-k/s),S=k=>E+b(k),w=k=>{const D=b(k),L=S(k);f.done=Math.abs(D)<=d,f.value=f.done?E:L};let C,A;const j=k=>{g(f.value)&&(C=k,A=ln({keyframes:[f.value,p(f.value)],velocity:ur(S,k,f.value),damping:o,stiffness:r,restDelta:d,restSpeed:u}))};return j(0),{calculatedDuration:null,next:k=>{let D=!1;return!A&&C===void 0&&(D=!0,w(k),j(k)),C!==void 0&&k>=C?A.next(k-C):(!D&&w(k),f)}}}function oc(e,t,n){const s=[],o=n||_e.mix||cr,r=e.length-1;for(let i=0;i<r;i++){let l=o(e[i],e[i+1]);if(t){const c=Array.isArray(t)?t[i]||Ae:t;l=Lt(c,l)}s.push(l)}return s}function ic(e,t,{clamp:n=!0,ease:s,mixer:o}={}){const r=e.length;if(Oe(r===t.length,"Both input and output ranges must be the same length","range-length"),r===1)return()=>t[0];if(r===2&&t[0]===t[1])return()=>t[1];const i=e[0]===e[1];e[0]>e[r-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=oc(t,s,o),c=l.length,d=u=>{if(i&&u<e[0])return t[0];let m=0;if(c>1)for(;m<e.length-2&&!(u<e[m+1]);m++);const f=Nt(e[m],e[m+1],u);return l[m](f)};return n?u=>d($e(e[0],e[r-1],u)):d}function rc(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const o=Nt(0,t,s);e.push(le(n,1,o))}}function ac(e){const t=[0];return rc(t,e.length-1),t}function lc(e,t){return e.map(n=>n*t)}function cc(e,t){return e.map(()=>t||Qi).splice(0,e.length-1)}function rt({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const o=wl(s)?s.map(co):co(s),r={done:!1,value:t[0]},i=lc(n&&n.length===t.length?n:ac(t),e),l=ic(i,t,{ease:Array.isArray(o)?o:cc(t,o)});return{calculatedDuration:e,next:c=>(r.value=l(c),r.done=c>=e,r)}}const dc=e=>e!==null;function Rs(e,{repeat:t,repeatType:n="loop"},s,o=1){const r=e.filter(dc),l=o<0||t&&n!=="loop"&&t%2===1?0:r.length-1;return!l||s===void 0?r[l]:s}const uc={decay:Kn,inertia:Kn,tween:rt,keyframes:rt,spring:ln};function hr(e){typeof e.type=="string"&&(e.type=uc[e.type])}class Is{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const hc=e=>e/100;class Ds extends Is{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var s,o;const{motionValue:n}=this.options;n&&n.updatedAt!==Se.now()&&this.tick(Se.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(o=(s=this.options).onStop)==null||o.call(s))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;hr(t);const{type:n=rt,repeat:s=0,repeatDelay:o=0,repeatType:r,velocity:i=0}=t;let{keyframes:l}=t;const c=n||rt;process.env.NODE_ENV!=="production"&&c!==rt&&Oe(l.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${l}`,"spring-two-frames"),c!==rt&&typeof l[0]!="number"&&(this.mixKeyframes=Lt(hc,cr(l[0],l[1])),l=[0,100]);const d=c({...t,keyframes:l});r==="mirror"&&(this.mirroredGenerator=c({...t,keyframes:[...l].reverse(),velocity:-i})),d.calculatedDuration===null&&(d.calculatedDuration=Ps(d));const{calculatedDuration:u}=d;this.calculatedDuration=u,this.resolvedDuration=u+o,this.totalDuration=this.resolvedDuration*(s+1)-o,this.generator=d}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:s,totalDuration:o,mixKeyframes:r,mirroredGenerator:i,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return s.next(0);const{delay:d=0,keyframes:u,repeat:m,repeatType:f,repeatDelay:g,type:p,onUpdate:x,finalKeyframe:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-o/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const E=this.currentTime-d*(this.playbackSpeed>=0?1:-1),b=this.playbackSpeed>=0?E<0:E>o;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let S=this.currentTime,w=s;if(m){const k=Math.min(this.currentTime,o)/l;let D=Math.floor(k),L=k%1;!L&&k>=1&&(L=1),L===1&&D--,D=Math.min(D,m+1),!!(D%2)&&(f==="reverse"?(L=1-L,g&&(L-=g/l)):f==="mirror"&&(w=i)),S=$e(0,1,L)*l}const C=b?{done:!1,value:u[0]}:w.next(S);r&&(C.value=r(C.value));let{done:A}=C;!b&&c!==null&&(A=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const j=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return j&&p!==Kn&&(C.value=Rs(u,this.options,v,this.speed)),x&&x(C.value),j&&this.finish(),C}then(t,n){return this.finished.then(t,n)}get duration(){return Pe(this.calculatedDuration)}get time(){return Pe(this.currentTime)}set time(t){var n;t=Ve(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(Se.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Pe(this.currentTime))}play(){var o,r;if(this.isStopped)return;const{driver:t=Yl,startTime:n}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),(r=(o=this.options).onPlay)==null||r.call(o);const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=n??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Se.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function mc(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Je=e=>e*180/Math.PI,Gn=e=>{const t=Je(Math.atan2(e[1],e[0]));return Yn(t)},fc={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Gn,rotateZ:Gn,skewX:e=>Je(Math.atan(e[1])),skewY:e=>Je(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Yn=e=>(e=e%360,e<0&&(e+=360),e),po=Gn,xo=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),yo=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),gc={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:xo,scaleY:yo,scale:e=>(xo(e)+yo(e))/2,rotateX:e=>Yn(Je(Math.atan2(e[6],e[5]))),rotateY:e=>Yn(Je(Math.atan2(-e[2],e[0]))),rotateZ:po,rotate:po,skewX:e=>Je(Math.atan(e[4])),skewY:e=>Je(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function qn(e){return e.includes("scale")?1:0}function Xn(e,t){if(!e||e==="none")return qn(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,o;if(n)s=gc,o=n;else{const l=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=fc,o=l}if(!o)return qn(t);const r=s[t],i=o[1].split(",").map(xc);return typeof r=="function"?r(i):i[r]}const pc=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Xn(n,t)};function xc(e){return parseFloat(e.trim())}const yt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bt=new Set(yt),bo=e=>e===xt||e===Z,yc=new Set(["x","y","z"]),bc=yt.filter(e=>!yc.has(e));function vc(e){const t=[];return bc.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const Qe={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Xn(t,"x"),y:(e,{transform:t})=>Xn(t,"y")};Qe.translateX=Qe.x;Qe.translateY=Qe.y;const et=new Set;let Jn=!1,Qn=!1,es=!1;function mr(){if(Qn){const e=Array.from(et).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const o=vc(s);o.length&&(n.set(s,o),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const o=n.get(s);o&&o.forEach(([r,i])=>{var l;(l=s.getValue(r))==null||l.set(i)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}Qn=!1,Jn=!1,et.forEach(e=>e.complete(es)),et.clear()}function fr(){et.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Qn=!0)})}function wc(){es=!0,fr(),mr(),es=!1}class Fs{constructor(t,n,s,o,r,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=o,this.element=r,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(et.add(this),Jn||(Jn=!0,ie.read(fr),ie.resolveKeyframes(mr))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:o}=this;if(t[0]===null){const r=o==null?void 0:o.get(),i=t[t.length-1];if(r!==void 0)t[0]=r;else if(s&&n){const l=s.readValue(n,i);l!=null&&(t[0]=l)}t[0]===void 0&&(t[0]=i),o&&r===void 0&&o.set(t[0])}mc(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),et.delete(this)}cancel(){this.state==="scheduled"&&(et.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Sc=e=>e.startsWith("--");function Cc(e,t,n){Sc(t)?e.style.setProperty(t,n):e.style[t]=n}const kc=Ss(()=>window.ScrollTimeline!==void 0),jc={};function Ec(e,t){const n=Ss(e);return()=>jc[t]??n()}const gr=Ec(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Et=([e,t,n,s])=>`cubic-bezier(${e}, ${t}, ${n}, ${s})`,vo={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Et([0,.65,.55,1]),circOut:Et([.55,0,1,.45]),backIn:Et([.31,.01,.66,-.59]),backOut:Et([.33,1.53,.69,.99])};function pr(e,t){if(e)return typeof e=="function"?gr()?dr(e,t):"ease-out":er(e)?Et(e):Array.isArray(e)?e.map(n=>pr(n,t)||vo.easeOut):vo[e]}function Ac(e,t,n,{delay:s=0,duration:o=300,repeat:r=0,repeatType:i="loop",ease:l="easeOut",times:c}={},d=void 0){const u={[t]:n};c&&(u.offset=c);const m=pr(l,o);Array.isArray(m)&&(u.easing=m);const f={delay:s,duration:o,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:r+1,direction:i==="reverse"?"alternate":"normal"};return d&&(f.pseudoElement=d),e.animate(u,f)}function xr(e){return typeof e=="function"&&"applyToOptions"in e}function Mc({type:e,...t}){return xr(e)&&gr()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class Tc extends Is{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:s,keyframes:o,pseudoElement:r,allowFlatten:i=!1,finalKeyframe:l,onComplete:c}=t;this.isPseudoElement=!!r,this.allowFlatten=i,this.options=t,Oe(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const d=Mc(t);this.animation=Ac(n,s,o,d,r),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const u=Rs(o,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(u):Cc(n,s,u),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,n;this.isPseudoElement||(n=(t=this.animation).commitStyles)==null||n.call(t)}get duration(){var n,s;const t=((s=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:s.call(n).duration)||0;return Pe(Number(t))}get time(){return Pe(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=Ve(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&kc()?(this.animation.timeline=t,Ae):n(this)}}const yr={anticipate:qi,backInOut:Yi,circInOut:Ji};function Vc(e){return e in yr}function Nc(e){typeof e.ease=="string"&&Vc(e.ease)&&(e.ease=yr[e.ease])}const wo=10;class Pc extends Tc{constructor(t){Nc(t),hr(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:s,onComplete:o,element:r,...i}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const l=new Ds({...i,autoplay:!1}),c=Ve(this.finishedTime??this.time);n.setWithVelocity(l.sample(c-wo).value,l.sample(c).value,wo),l.stop()}}const So=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(We.test(e)||e==="0")&&!e.startsWith("url("));function Rc(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Ic(e,t,n,s){const o=e[0];if(o===null)return!1;if(t==="display"||t==="visibility")return!0;const r=e[e.length-1],i=So(o,t),l=So(r,t);return pt(i===l,`You are trying to animate ${t} from "${o}" to "${r}". "${i?r:o}" is not an animatable value.`,"value-not-animatable"),!i||!l?!1:Rc(e)||(n==="spring"||xr(n))&&s}function ts(e){e.duration=0,e.type}const Dc=new Set(["opacity","clipPath","filter","transform"]),Fc=Ss(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Lc(e){var u;const{motionValue:t,name:n,repeatDelay:s,repeatType:o,damping:r,type:i}=e;if(!(((u=t==null?void 0:t.owner)==null?void 0:u.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:d}=t.owner.getProps();return Fc()&&n&&Dc.has(n)&&(n!=="transform"||!d)&&!c&&!s&&o!=="mirror"&&r!==0&&i!=="inertia"}const Bc=40;class $c extends Is{constructor({autoplay:t=!0,delay:n=0,type:s="keyframes",repeat:o=0,repeatDelay:r=0,repeatType:i="loop",keyframes:l,name:c,motionValue:d,element:u,...m}){var p;super(),this.stop=()=>{var x,v;this._animation&&(this._animation.stop(),(x=this.stopTimeline)==null||x.call(this)),(v=this.keyframeResolver)==null||v.cancel()},this.createdAt=Se.now();const f={autoplay:t,delay:n,type:s,repeat:o,repeatDelay:r,repeatType:i,name:c,motionValue:d,element:u,...m},g=(u==null?void 0:u.KeyframeResolver)||Fs;this.keyframeResolver=new g(l,(x,v,E)=>this.onKeyframesResolved(x,v,f,!E),c,d,u),(p=this.keyframeResolver)==null||p.scheduleResolve()}onKeyframesResolved(t,n,s,o){this.keyframeResolver=void 0;const{name:r,type:i,velocity:l,delay:c,isHandoff:d,onUpdate:u}=s;this.resolvedAt=Se.now(),Ic(t,r,i,l)||((_e.instantAnimations||!c)&&(u==null||u(Rs(t,s,n))),t[0]=t[t.length-1],ts(s),s.repeat=0);const f={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>Bc?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:t},g=!d&&Lc(f)?new Pc({...f,element:f.motionValue.owner.current}):new Ds(f);g.finished.then(()=>this.notifyFinished()).catch(Ae),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),wc()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}const Oc=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function _c(e){const t=Oc.exec(e);if(!t)return[,];const[,n,s,o]=t;return[`--${n??s}`,o]}const Hc=4;function br(e,t,n=1){Oe(n<=Hc,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[s,o]=_c(e);if(!s)return;const r=window.getComputedStyle(t).getPropertyValue(s);if(r){const i=r.trim();return _i(i)?parseFloat(i):i}return Ms(o)?br(o,t,n+1):o}function Ls(e,t){return(e==null?void 0:e[t])??(e==null?void 0:e.default)??e}const vr=new Set(["width","height","top","left","right","bottom",...yt]),zc={test:e=>e==="auto",parse:e=>e},wr=e=>t=>t.test(e),Sr=[xt,Z,Re,Ze,Rl,Pl,zc],Co=e=>Sr.find(wr(e));function Zc(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||zi(e):!0}const Uc=new Set(["brightness","contrast","saturate","opacity"]);function Wc(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(Ts)||[];if(!s)return e;const o=n.replace(s,"");let r=Uc.has(t)?1:0;return s!==n&&(r*=100),t+"("+r+o+")"}const Kc=/\b([a-z-]*)\(.*?\)/gu,ns={...We,getAnimatableNone:e=>{const t=e.match(Kc);return t?t.map(Wc).join(" "):e}},ko={...xt,transform:Math.round},Gc={rotate:Ze,rotateX:Ze,rotateY:Ze,rotateZ:Ze,scale:Wt,scaleX:Wt,scaleY:Wt,scaleZ:Wt,skew:Ze,skewX:Ze,skewY:Ze,distance:Z,translateX:Z,translateY:Z,translateZ:Z,x:Z,y:Z,z:Z,perspective:Z,transformPerspective:Z,opacity:Pt,originX:uo,originY:uo,originZ:Z},Bs={borderWidth:Z,borderTopWidth:Z,borderRightWidth:Z,borderBottomWidth:Z,borderLeftWidth:Z,borderRadius:Z,radius:Z,borderTopLeftRadius:Z,borderTopRightRadius:Z,borderBottomRightRadius:Z,borderBottomLeftRadius:Z,width:Z,maxWidth:Z,height:Z,maxHeight:Z,top:Z,right:Z,bottom:Z,left:Z,padding:Z,paddingTop:Z,paddingRight:Z,paddingBottom:Z,paddingLeft:Z,margin:Z,marginTop:Z,marginRight:Z,marginBottom:Z,marginLeft:Z,backgroundPositionX:Z,backgroundPositionY:Z,...Gc,zIndex:ko,fillOpacity:Pt,strokeOpacity:Pt,numOctaves:ko},Yc={...Bs,color:fe,backgroundColor:fe,outlineColor:fe,fill:fe,stroke:fe,borderColor:fe,borderTopColor:fe,borderRightColor:fe,borderBottomColor:fe,borderLeftColor:fe,filter:ns,WebkitFilter:ns},Cr=e=>Yc[e];function kr(e,t){let n=Cr(e);return n!==ns&&(n=We),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const qc=new Set(["auto","none","0"]);function Xc(e,t,n){let s=0,o;for(;s<e.length&&!o;){const r=e[s];typeof r=="string"&&!qc.has(r)&&Rt(r).values.length&&(o=e[s]),s++}if(o&&n)for(const r of t)e[r]=kr(n,o)}class Jc extends Fs{constructor(t,n,s,o,r){super(t,n,s,o,r,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let d=t[c];if(typeof d=="string"&&(d=d.trim(),Ms(d))){const u=br(d,n.current);u!==void 0&&(t[c]=u),c===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!vr.has(s)||t.length!==2)return;const[o,r]=t,i=Co(o),l=Co(r);if(i!==l)if(bo(i)&&bo(l))for(let c=0;c<t.length;c++){const d=t[c];typeof d=="string"&&(t[c]=parseFloat(d))}else Qe[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,s=[];for(let o=0;o<t.length;o++)(t[o]===null||Zc(t[o]))&&s.push(o);s.length&&Xc(t,s,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:s}=this;if(!t||!t.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Qe[s](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&t.getValue(s,o).jump(o,!1)}measureEndState(){var l;const{element:t,name:n,unresolvedKeyframes:s}=this;if(!t||!t.current)return;const o=t.getValue(n);o&&o.jump(this.measuredOrigin,!1);const r=s.length-1,i=s[r];s[r]=Qe[n](t.measureViewportBox(),window.getComputedStyle(t.current)),i!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=i),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,d])=>{t.getValue(c).set(d)}),this.resolveNoneKeyframes()}}function Qc(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let s=document;const o=(n==null?void 0:n[e])??s.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e)}const jr=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Er(e){return Hi(e)&&"offsetHeight"in e}const jo=30,ed=e=>!isNaN(parseFloat(e));class td{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{var r;const o=Se.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&((r=this.events.change)==null||r.notify(this.current),this.dependents))for(const i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Se.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=ed(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return process.env.NODE_ENV!=="production"&&ks(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Cs);const s=this.events[t].add(n);return t==="change"?()=>{s(),ie.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Se.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>jo)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,jo);return Zi(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function mt(e,t){return new td(e,t)}const{schedule:$s}=tr(queueMicrotask,!1),Te={x:!1,y:!1};function Ar(){return Te.x||Te.y}function nd(e){return e==="x"||e==="y"?Te[e]?null:(Te[e]=!0,()=>{Te[e]=!1}):Te.x||Te.y?null:(Te.x=Te.y=!0,()=>{Te.x=Te.y=!1})}function Mr(e,t){const n=Qc(e),s=new AbortController,o={passive:!0,...t,signal:s.signal};return[n,o,()=>s.abort()]}function Eo(e){return!(e.pointerType==="touch"||Ar())}function sd(e,t,n={}){const[s,o,r]=Mr(e,n),i=l=>{if(!Eo(l))return;const{target:c}=l,d=t(c,l);if(typeof d!="function"||!c)return;const u=m=>{Eo(m)&&(d(m),c.removeEventListener("pointerleave",u))};c.addEventListener("pointerleave",u,o)};return s.forEach(l=>{l.addEventListener("pointerenter",i,o)}),r}const Tr=(e,t)=>t?e===t?!0:Tr(e,t.parentElement):!1,Os=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,od=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function id(e){return od.has(e.tagName)||e.tabIndex!==-1}const en=new WeakSet;function Ao(e){return t=>{t.key==="Enter"&&e(t)}}function En(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const rd=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=Ao(()=>{if(en.has(n))return;En(n,"down");const o=Ao(()=>{En(n,"up")}),r=()=>En(n,"cancel");n.addEventListener("keyup",o,t),n.addEventListener("blur",r,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function Mo(e){return Os(e)&&!Ar()}function ad(e,t,n={}){const[s,o,r]=Mr(e,n),i=l=>{const c=l.currentTarget;if(!Mo(l))return;en.add(c);const d=t(c,l),u=(g,p)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",f),en.has(c)&&en.delete(c),Mo(g)&&typeof d=="function"&&d(g,{success:p})},m=g=>{u(g,c===window||c===document||n.useGlobalTarget||Tr(c,g.target))},f=g=>{u(g,!1)};window.addEventListener("pointerup",m,o),window.addEventListener("pointercancel",f,o)};return s.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",i,o),Er(l)&&(l.addEventListener("focus",d=>rd(d,o)),!id(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),r}function Vr(e){return Hi(e)&&"ownerSVGElement"in e}function ld(e){return Vr(e)&&e.tagName==="svg"}const be=e=>!!(e&&e.getVelocity),cd=[...Sr,fe,We],dd=e=>cd.find(wr(e)),_s=y.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class ud extends h.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const s=n.offsetParent,o=Er(s)&&s.offsetWidth||0,r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft,r.right=o-r.width-r.left}return null}componentDidUpdate(){}render(){return this.props.children}}function hd({children:e,isPresent:t,anchorX:n,root:s}){const o=y.useId(),r=y.useRef(null),i=y.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:l}=y.useContext(_s);return y.useInsertionEffect(()=>{const{width:c,height:d,top:u,left:m,right:f}=i.current;if(t||!r.current||!c||!d)return;const g=n==="left"?`left: ${m}`:`right: ${f}`;r.current.dataset.motionPopId=o;const p=document.createElement("style");l&&(p.nonce=l);const x=s??document.head;return x.appendChild(p),p.sheet&&p.sheet.insertRule(`
|
|
1
|
+
"use strict";var rl=Object.defineProperty;var al=(e,t,n)=>t in e?rl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var me=(e,t,n)=>al(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("react"),a=require("react/jsx-runtime"),I=require("livekit-client"),ue=require("@livekit/components-react"),Bi=require("sonner"),ll=require("@phosphor-icons/react"),un=require("class-variance-authority"),cl=require("clsx"),dl=require("@radix-ui/react-toggle"),ul=require("@radix-ui/react-select"),pe=require("lucide-react"),Be=require("@mui/icons-material"),hl=require("react-dom/client");function ps(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const h=ps(y),ml=ps(dl),Ee=ps(ul),gs=y.createContext({});function xs(e){const t=y.useRef(null);return t.current===null&&(t.current=e()),t.current}const ys=typeof window<"u",$i=ys?y.useLayoutEffect:y.useEffect,hn=y.createContext(null);function bs(e,t){e.indexOf(t)===-1&&e.push(t)}function vs(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const $e=(e,t,n)=>n>t?t:n<e?e:n;function Hn(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}let gt=()=>{},Oe=()=>{};process.env.NODE_ENV!=="production"&&(gt=(e,t,n)=>{!e&&typeof console<"u"&&console.warn(Hn(t,n))},Oe=(e,t,n)=>{if(!e)throw new Error(Hn(t,n))});const _e={},Oi=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function _i(e){return typeof e=="object"&&e!==null}const Hi=e=>/^0[^.\s]+$/u.test(e);function ws(e){let t;return()=>(t===void 0&&(t=e()),t)}const Ae=e=>e,fl=(e,t)=>n=>t(e(n)),Lt=(...e)=>e.reduce(fl),Nt=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s};class Ss{constructor(){this.subscriptions=[]}add(t){return bs(this.subscriptions,t),()=>vs(this.subscriptions,t)}notify(t,n,s){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,n,s);else for(let r=0;r<o;r++){const i=this.subscriptions[r];i&&i(t,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ve=e=>e*1e3,Pe=e=>e/1e3;function Zi(e,t){return t?e*(1e3/t):0}const ro=new Set;function Cs(e,t,n){e||ro.has(t)||(console.warn(Hn(t,n)),ro.add(t))}const Ui=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,pl=1e-7,gl=12;function xl(e,t,n,s,o){let r,i,l=0;do i=t+(n-t)/2,r=Ui(i,s,o)-e,r>0?n=i:t=i;while(Math.abs(r)>pl&&++l<gl);return i}function Bt(e,t,n,s){if(e===t&&n===s)return Ae;const o=r=>xl(r,0,1,e,n);return r=>r===0||r===1?r:Ui(o(r),t,s)}const zi=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Wi=e=>t=>1-e(1-t),Ki=Bt(.33,1.53,.69,.99),ks=Wi(Ki),Gi=zi(ks),Yi=e=>(e*=2)<1?.5*ks(e):.5*(2-Math.pow(2,-10*(e-1))),js=e=>1-Math.sin(Math.acos(e)),qi=Wi(js),Xi=zi(js),yl=Bt(.42,0,1,1),bl=Bt(0,0,.58,1),Ji=Bt(.42,0,.58,1),vl=e=>Array.isArray(e)&&typeof e[0]!="number",Qi=e=>Array.isArray(e)&&typeof e[0]=="number",ao={linear:Ae,easeIn:yl,easeInOut:Ji,easeOut:bl,circIn:js,circInOut:Xi,circOut:qi,backIn:ks,backInOut:Gi,backOut:Ki,anticipate:Yi},wl=e=>typeof e=="string",lo=e=>{if(Qi(e)){Oe(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,s,o]=e;return Bt(t,n,s,o)}else if(wl(e))return Oe(ao[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),ao[e];return e},zt=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Sl(e,t){let n=new Set,s=new Set,o=!1,r=!1;const i=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(u){i.has(u)&&(d.schedule(u),e()),u(l)}const d={schedule:(u,m=!1,f=!1)=>{const g=f&&o?n:s;return m&&i.add(u),g.has(u)||g.add(u),u},cancel:u=>{s.delete(u),i.delete(u)},process:u=>{if(l=u,o){r=!0;return}o=!0,[n,s]=[s,n],n.forEach(c),n.clear(),o=!1,r&&(r=!1,d.process(u))}};return d}const Cl=40;function er(e,t){let n=!1,s=!0;const o={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,i=zt.reduce((S,w)=>(S[w]=Sl(r),S),{}),{setup:l,read:c,resolveKeyframes:d,preUpdate:u,update:m,preRender:f,render:p,postRender:g}=i,x=()=>{const S=_e.useManualTiming?o.timestamp:performance.now();n=!1,_e.useManualTiming||(o.delta=s?1e3/60:Math.max(Math.min(S-o.timestamp,Cl),1)),o.timestamp=S,o.isProcessing=!0,l.process(o),c.process(o),d.process(o),u.process(o),m.process(o),f.process(o),p.process(o),g.process(o),o.isProcessing=!1,n&&t&&(s=!1,e(x))},v=()=>{n=!0,s=!0,o.isProcessing||e(x)};return{schedule:zt.reduce((S,w)=>{const C=i[w];return S[w]=(A,j=!1,k=!1)=>(n||v(),C.schedule(A,j,k)),S},{}),cancel:S=>{for(let w=0;w<zt.length;w++)i[zt[w]].cancel(S)},state:o,steps:i}}const{schedule:ie,cancel:ze,state:xe,steps:wn}=er(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ae,!0);let Qt;function kl(){Qt=void 0}const Se={now:()=>(Qt===void 0&&Se.set(xe.isProcessing||_e.useManualTiming?xe.timestamp:performance.now()),Qt),set:e=>{Qt=e,queueMicrotask(kl)}},tr=e=>t=>typeof t=="string"&&t.startsWith(e),Es=tr("--"),jl=tr("var(--"),As=e=>jl(e)?El.test(e.split("/*")[0].trim()):!1,El=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,xt={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Pt={...xt,transform:e=>$e(0,1,e)},Wt={...xt,default:1},At=e=>Math.round(e*1e5)/1e5,Ms=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Al(e){return e==null}const Ml=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ts=(e,t)=>n=>!!(typeof n=="string"&&Ml.test(n)&&n.startsWith(e)||t&&!Al(n)&&Object.prototype.hasOwnProperty.call(n,t)),nr=(e,t,n)=>s=>{if(typeof s!="string")return s;const[o,r,i,l]=s.match(Ms);return{[e]:parseFloat(o),[t]:parseFloat(r),[n]:parseFloat(i),alpha:l!==void 0?parseFloat(l):1}},Tl=e=>$e(0,255,e),Sn={...xt,transform:e=>Math.round(Tl(e))},Xe={test:Ts("rgb","red"),parse:nr("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+Sn.transform(e)+", "+Sn.transform(t)+", "+Sn.transform(n)+", "+At(Pt.transform(s))+")"};function Vl(e){let t="",n="",s="",o="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),o=e.substring(4,5),t+=t,n+=n,s+=s,o+=o),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:o?parseInt(o,16)/255:1}}const Zn={test:Ts("#"),parse:Vl,transform:Xe.transform},$t=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ue=$t("deg"),Re=$t("%"),U=$t("px"),Nl=$t("vh"),Pl=$t("vw"),co={...Re,parse:e=>Re.parse(e)/100,transform:e=>Re.transform(e*100)},it={test:Ts("hsl","hue"),parse:nr("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+Re.transform(At(t))+", "+Re.transform(At(n))+", "+At(Pt.transform(s))+")"},fe={test:e=>Xe.test(e)||Zn.test(e)||it.test(e),parse:e=>Xe.test(e)?Xe.parse(e):it.test(e)?it.parse(e):Zn.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Xe.transform(e):it.transform(e),getAnimatableNone:e=>{const t=fe.parse(e);return t.alpha=0,fe.transform(t)}},Rl=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Il(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Ms))==null?void 0:t.length)||0)+(((n=e.match(Rl))==null?void 0:n.length)||0)>0}const sr="number",or="color",Dl="var",Fl="var(",uo="${}",Ll=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Rt(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},o=[];let r=0;const l=t.replace(Ll,c=>(fe.test(c)?(s.color.push(r),o.push(or),n.push(fe.parse(c))):c.startsWith(Fl)?(s.var.push(r),o.push(Dl),n.push(c)):(s.number.push(r),o.push(sr),n.push(parseFloat(c))),++r,uo)).split(uo);return{values:n,split:l,indexes:s,types:o}}function ir(e){return Rt(e).values}function rr(e){const{split:t,types:n}=Rt(e),s=t.length;return o=>{let r="";for(let i=0;i<s;i++)if(r+=t[i],o[i]!==void 0){const l=n[i];l===sr?r+=At(o[i]):l===or?r+=fe.transform(o[i]):r+=o[i]}return r}}const Bl=e=>typeof e=="number"?0:fe.test(e)?fe.getAnimatableNone(e):e;function $l(e){const t=ir(e);return rr(e)(t.map(Bl))}const We={test:Il,parse:ir,createTransformer:rr,getAnimatableNone:$l};function Cn(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Ol({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let o=0,r=0,i=0;if(!t)o=r=i=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;o=Cn(c,l,e+1/3),r=Cn(c,l,e),i=Cn(c,l,e-1/3)}return{red:Math.round(o*255),green:Math.round(r*255),blue:Math.round(i*255),alpha:s}}function rn(e,t){return n=>n>0?t:e}const le=(e,t,n)=>e+(t-e)*n,kn=(e,t,n)=>{const s=e*e,o=n*(t*t-s)+s;return o<0?0:Math.sqrt(o)},_l=[Zn,Xe,it],Hl=e=>_l.find(t=>t.test(e));function ho(e){const t=Hl(e);if(gt(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let n=t.parse(e);return t===it&&(n=Ol(n)),n}const mo=(e,t)=>{const n=ho(e),s=ho(t);if(!n||!s)return rn(e,t);const o={...n};return r=>(o.red=kn(n.red,s.red,r),o.green=kn(n.green,s.green,r),o.blue=kn(n.blue,s.blue,r),o.alpha=le(n.alpha,s.alpha,r),Xe.transform(o))},Un=new Set(["none","hidden"]);function Zl(e,t){return Un.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Ul(e,t){return n=>le(e,t,n)}function Vs(e){return typeof e=="number"?Ul:typeof e=="string"?As(e)?rn:fe.test(e)?mo:Kl:Array.isArray(e)?ar:typeof e=="object"?fe.test(e)?mo:zl:rn}function ar(e,t){const n=[...e],s=n.length,o=e.map((r,i)=>Vs(r)(r,t[i]));return r=>{for(let i=0;i<s;i++)n[i]=o[i](r);return n}}function zl(e,t){const n={...e,...t},s={};for(const o in n)e[o]!==void 0&&t[o]!==void 0&&(s[o]=Vs(e[o])(e[o],t[o]));return o=>{for(const r in s)n[r]=s[r](o);return n}}function Wl(e,t){const n=[],s={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const r=t.types[o],i=e.indexes[r][s[r]],l=e.values[i]??0;n[o]=l,s[r]++}return n}const Kl=(e,t)=>{const n=We.createTransformer(t),s=Rt(e),o=Rt(t);return s.indexes.var.length===o.indexes.var.length&&s.indexes.color.length===o.indexes.color.length&&s.indexes.number.length>=o.indexes.number.length?Un.has(e)&&!o.values.length||Un.has(t)&&!s.values.length?Zl(e,t):Lt(ar(Wl(s,o),o.values),n):(gt(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),rn(e,t))};function lr(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?le(e,t,n):Vs(e)(e,t)}const Gl=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>ie.update(t,n),stop:()=>ze(t),now:()=>xe.isProcessing?xe.timestamp:Se.now()}},cr=(e,t,n=10)=>{let s="";const o=Math.max(Math.round(t/n),2);for(let r=0;r<o;r++)s+=Math.round(e(r/(o-1))*1e4)/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},an=2e4;function Ns(e){let t=0;const n=50;let s=e.next(t);for(;!s.done&&t<an;)t+=n,s=e.next(t);return t>=an?1/0:t}function Yl(e,t=100,n){const s=n({...e,keyframes:[0,t]}),o=Math.min(Ns(s),an);return{type:"keyframes",ease:r=>s.next(o*r).value/t,duration:Pe(o)}}const ql=5;function dr(e,t,n){const s=Math.max(t-ql,0);return Zi(n-e(s),t-s)}const ae={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},jn=.001;function Xl({duration:e=ae.duration,bounce:t=ae.bounce,velocity:n=ae.velocity,mass:s=ae.mass}){let o,r;gt(e<=Ve(ae.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let i=1-t;i=$e(ae.minDamping,ae.maxDamping,i),e=$e(ae.minDuration,ae.maxDuration,Pe(e)),i<1?(o=d=>{const u=d*i,m=u*e,f=u-n,p=zn(d,i),g=Math.exp(-m);return jn-f/p*g},r=d=>{const m=d*i*e,f=m*n+n,p=Math.pow(i,2)*Math.pow(d,2)*e,g=Math.exp(-m),x=zn(Math.pow(d,2),i);return(-o(d)+jn>0?-1:1)*((f-p)*g)/x}):(o=d=>{const u=Math.exp(-d*e),m=(d-n)*e+1;return-jn+u*m},r=d=>{const u=Math.exp(-d*e),m=(n-d)*(e*e);return u*m});const l=5/e,c=Ql(o,r,l);if(e=Ve(e),isNaN(c))return{stiffness:ae.stiffness,damping:ae.damping,duration:e};{const d=Math.pow(c,2)*s;return{stiffness:d,damping:i*2*Math.sqrt(s*d),duration:e}}}const Jl=12;function Ql(e,t,n){let s=n;for(let o=1;o<Jl;o++)s=s-e(s)/t(s);return s}function zn(e,t){return e*Math.sqrt(1-t*t)}const ec=["duration","bounce"],tc=["stiffness","damping","mass"];function fo(e,t){return t.some(n=>e[n]!==void 0)}function nc(e){let t={velocity:ae.velocity,stiffness:ae.stiffness,damping:ae.damping,mass:ae.mass,isResolvedFromDuration:!1,...e};if(!fo(e,tc)&&fo(e,ec))if(e.visualDuration){const n=e.visualDuration,s=2*Math.PI/(n*1.2),o=s*s,r=2*$e(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:ae.mass,stiffness:o,damping:r}}else{const n=Xl(e);t={...t,...n,mass:ae.mass},t.isResolvedFromDuration=!0}return t}function ln(e=ae.visualDuration,t=ae.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:o}=n;const r=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],l={done:!1,value:r},{stiffness:c,damping:d,mass:u,duration:m,velocity:f,isResolvedFromDuration:p}=nc({...n,velocity:-Pe(n.velocity||0)}),g=f||0,x=d/(2*Math.sqrt(c*u)),v=i-r,E=Pe(Math.sqrt(c/u)),b=Math.abs(v)<5;s||(s=b?ae.restSpeed.granular:ae.restSpeed.default),o||(o=b?ae.restDelta.granular:ae.restDelta.default);let S;if(x<1){const C=zn(E,x);S=A=>{const j=Math.exp(-x*E*A);return i-j*((g+x*E*v)/C*Math.sin(C*A)+v*Math.cos(C*A))}}else if(x===1)S=C=>i-Math.exp(-E*C)*(v+(g+E*v)*C);else{const C=E*Math.sqrt(x*x-1);S=A=>{const j=Math.exp(-x*E*A),k=Math.min(C*A,300);return i-j*((g+x*E*v)*Math.sinh(k)+C*v*Math.cosh(k))/C}}const w={calculatedDuration:p&&m||null,next:C=>{const A=S(C);if(p)l.done=C>=m;else{let j=C===0?g:0;x<1&&(j=C===0?Ve(g):dr(S,C,A));const k=Math.abs(j)<=s,D=Math.abs(i-A)<=o;l.done=k&&D}return l.value=l.done?i:A,l},toString:()=>{const C=Math.min(Ns(w),an),A=cr(j=>w.next(C*j).value,C,30);return C+"ms "+A},toTransition:()=>{}};return w}ln.applyToOptions=e=>{const t=Yl(e,100,ln);return e.ease=t.ease,e.duration=Ve(t.duration),e.type="keyframes",e};function Wn({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:o=10,bounceStiffness:r=500,modifyTarget:i,min:l,max:c,restDelta:d=.5,restSpeed:u}){const m=e[0],f={done:!1,value:m},p=k=>l!==void 0&&k<l||c!==void 0&&k>c,g=k=>l===void 0?c:c===void 0||Math.abs(l-k)<Math.abs(c-k)?l:c;let x=n*t;const v=m+x,E=i===void 0?v:i(v);E!==v&&(x=E-m);const b=k=>-x*Math.exp(-k/s),S=k=>E+b(k),w=k=>{const D=b(k),L=S(k);f.done=Math.abs(D)<=d,f.value=f.done?E:L};let C,A;const j=k=>{p(f.value)&&(C=k,A=ln({keyframes:[f.value,g(f.value)],velocity:dr(S,k,f.value),damping:o,stiffness:r,restDelta:d,restSpeed:u}))};return j(0),{calculatedDuration:null,next:k=>{let D=!1;return!A&&C===void 0&&(D=!0,w(k),j(k)),C!==void 0&&k>=C?A.next(k-C):(!D&&w(k),f)}}}function sc(e,t,n){const s=[],o=n||_e.mix||lr,r=e.length-1;for(let i=0;i<r;i++){let l=o(e[i],e[i+1]);if(t){const c=Array.isArray(t)?t[i]||Ae:t;l=Lt(c,l)}s.push(l)}return s}function oc(e,t,{clamp:n=!0,ease:s,mixer:o}={}){const r=e.length;if(Oe(r===t.length,"Both input and output ranges must be the same length","range-length"),r===1)return()=>t[0];if(r===2&&t[0]===t[1])return()=>t[1];const i=e[0]===e[1];e[0]>e[r-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=sc(t,s,o),c=l.length,d=u=>{if(i&&u<e[0])return t[0];let m=0;if(c>1)for(;m<e.length-2&&!(u<e[m+1]);m++);const f=Nt(e[m],e[m+1],u);return l[m](f)};return n?u=>d($e(e[0],e[r-1],u)):d}function ic(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const o=Nt(0,t,s);e.push(le(n,1,o))}}function rc(e){const t=[0];return ic(t,e.length-1),t}function ac(e,t){return e.map(n=>n*t)}function lc(e,t){return e.map(()=>t||Ji).splice(0,e.length-1)}function rt({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const o=vl(s)?s.map(lo):lo(s),r={done:!1,value:t[0]},i=ac(n&&n.length===t.length?n:rc(t),e),l=oc(i,t,{ease:Array.isArray(o)?o:lc(t,o)});return{calculatedDuration:e,next:c=>(r.value=l(c),r.done=c>=e,r)}}const cc=e=>e!==null;function Ps(e,{repeat:t,repeatType:n="loop"},s,o=1){const r=e.filter(cc),l=o<0||t&&n!=="loop"&&t%2===1?0:r.length-1;return!l||s===void 0?r[l]:s}const dc={decay:Wn,inertia:Wn,tween:rt,keyframes:rt,spring:ln};function ur(e){typeof e.type=="string"&&(e.type=dc[e.type])}class Rs{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const uc=e=>e/100;class Is extends Rs{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var s,o;const{motionValue:n}=this.options;n&&n.updatedAt!==Se.now()&&this.tick(Se.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(o=(s=this.options).onStop)==null||o.call(s))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;ur(t);const{type:n=rt,repeat:s=0,repeatDelay:o=0,repeatType:r,velocity:i=0}=t;let{keyframes:l}=t;const c=n||rt;process.env.NODE_ENV!=="production"&&c!==rt&&Oe(l.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${l}`,"spring-two-frames"),c!==rt&&typeof l[0]!="number"&&(this.mixKeyframes=Lt(uc,lr(l[0],l[1])),l=[0,100]);const d=c({...t,keyframes:l});r==="mirror"&&(this.mirroredGenerator=c({...t,keyframes:[...l].reverse(),velocity:-i})),d.calculatedDuration===null&&(d.calculatedDuration=Ns(d));const{calculatedDuration:u}=d;this.calculatedDuration=u,this.resolvedDuration=u+o,this.totalDuration=this.resolvedDuration*(s+1)-o,this.generator=d}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:s,totalDuration:o,mixKeyframes:r,mirroredGenerator:i,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return s.next(0);const{delay:d=0,keyframes:u,repeat:m,repeatType:f,repeatDelay:p,type:g,onUpdate:x,finalKeyframe:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-o/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const E=this.currentTime-d*(this.playbackSpeed>=0?1:-1),b=this.playbackSpeed>=0?E<0:E>o;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let S=this.currentTime,w=s;if(m){const k=Math.min(this.currentTime,o)/l;let D=Math.floor(k),L=k%1;!L&&k>=1&&(L=1),L===1&&D--,D=Math.min(D,m+1),!!(D%2)&&(f==="reverse"?(L=1-L,p&&(L-=p/l)):f==="mirror"&&(w=i)),S=$e(0,1,L)*l}const C=b?{done:!1,value:u[0]}:w.next(S);r&&(C.value=r(C.value));let{done:A}=C;!b&&c!==null&&(A=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const j=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return j&&g!==Wn&&(C.value=Ps(u,this.options,v,this.speed)),x&&x(C.value),j&&this.finish(),C}then(t,n){return this.finished.then(t,n)}get duration(){return Pe(this.calculatedDuration)}get time(){return Pe(this.currentTime)}set time(t){var n;t=Ve(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(Se.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Pe(this.currentTime))}play(){var o,r;if(this.isStopped)return;const{driver:t=Gl,startTime:n}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),(r=(o=this.options).onPlay)==null||r.call(o);const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=n??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Se.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function hc(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Je=e=>e*180/Math.PI,Kn=e=>{const t=Je(Math.atan2(e[1],e[0]));return Gn(t)},mc={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Kn,rotateZ:Kn,skewX:e=>Je(Math.atan(e[1])),skewY:e=>Je(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Gn=e=>(e=e%360,e<0&&(e+=360),e),po=Kn,go=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),xo=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),fc={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:go,scaleY:xo,scale:e=>(go(e)+xo(e))/2,rotateX:e=>Gn(Je(Math.atan2(e[6],e[5]))),rotateY:e=>Gn(Je(Math.atan2(-e[2],e[0]))),rotateZ:po,rotate:po,skewX:e=>Je(Math.atan(e[4])),skewY:e=>Je(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Yn(e){return e.includes("scale")?1:0}function qn(e,t){if(!e||e==="none")return Yn(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,o;if(n)s=fc,o=n;else{const l=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=mc,o=l}if(!o)return Yn(t);const r=s[t],i=o[1].split(",").map(gc);return typeof r=="function"?r(i):i[r]}const pc=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return qn(n,t)};function gc(e){return parseFloat(e.trim())}const yt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bt=new Set(yt),yo=e=>e===xt||e===U,xc=new Set(["x","y","z"]),yc=yt.filter(e=>!xc.has(e));function bc(e){const t=[];return yc.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const Qe={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>qn(t,"x"),y:(e,{transform:t})=>qn(t,"y")};Qe.translateX=Qe.x;Qe.translateY=Qe.y;const et=new Set;let Xn=!1,Jn=!1,Qn=!1;function hr(){if(Jn){const e=Array.from(et).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const o=bc(s);o.length&&(n.set(s,o),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const o=n.get(s);o&&o.forEach(([r,i])=>{var l;(l=s.getValue(r))==null||l.set(i)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}Jn=!1,Xn=!1,et.forEach(e=>e.complete(Qn)),et.clear()}function mr(){et.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Jn=!0)})}function vc(){Qn=!0,mr(),hr(),Qn=!1}class Ds{constructor(t,n,s,o,r,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=o,this.element=r,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(et.add(this),Xn||(Xn=!0,ie.read(mr),ie.resolveKeyframes(hr))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:o}=this;if(t[0]===null){const r=o==null?void 0:o.get(),i=t[t.length-1];if(r!==void 0)t[0]=r;else if(s&&n){const l=s.readValue(n,i);l!=null&&(t[0]=l)}t[0]===void 0&&(t[0]=i),o&&r===void 0&&o.set(t[0])}hc(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),et.delete(this)}cancel(){this.state==="scheduled"&&(et.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const wc=e=>e.startsWith("--");function Sc(e,t,n){wc(t)?e.style.setProperty(t,n):e.style[t]=n}const Cc=ws(()=>window.ScrollTimeline!==void 0),kc={};function jc(e,t){const n=ws(e);return()=>kc[t]??n()}const fr=jc(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Et=([e,t,n,s])=>`cubic-bezier(${e}, ${t}, ${n}, ${s})`,bo={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Et([0,.65,.55,1]),circOut:Et([.55,0,1,.45]),backIn:Et([.31,.01,.66,-.59]),backOut:Et([.33,1.53,.69,.99])};function pr(e,t){if(e)return typeof e=="function"?fr()?cr(e,t):"ease-out":Qi(e)?Et(e):Array.isArray(e)?e.map(n=>pr(n,t)||bo.easeOut):bo[e]}function Ec(e,t,n,{delay:s=0,duration:o=300,repeat:r=0,repeatType:i="loop",ease:l="easeOut",times:c}={},d=void 0){const u={[t]:n};c&&(u.offset=c);const m=pr(l,o);Array.isArray(m)&&(u.easing=m);const f={delay:s,duration:o,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:r+1,direction:i==="reverse"?"alternate":"normal"};return d&&(f.pseudoElement=d),e.animate(u,f)}function gr(e){return typeof e=="function"&&"applyToOptions"in e}function Ac({type:e,...t}){return gr(e)&&fr()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class Mc extends Rs{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:s,keyframes:o,pseudoElement:r,allowFlatten:i=!1,finalKeyframe:l,onComplete:c}=t;this.isPseudoElement=!!r,this.allowFlatten=i,this.options=t,Oe(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const d=Ac(t);this.animation=Ec(n,s,o,d,r),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const u=Ps(o,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(u):Sc(n,s,u),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,n;this.isPseudoElement||(n=(t=this.animation).commitStyles)==null||n.call(t)}get duration(){var n,s;const t=((s=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:s.call(n).duration)||0;return Pe(Number(t))}get time(){return Pe(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=Ve(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&Cc()?(this.animation.timeline=t,Ae):n(this)}}const xr={anticipate:Yi,backInOut:Gi,circInOut:Xi};function Tc(e){return e in xr}function Vc(e){typeof e.ease=="string"&&Tc(e.ease)&&(e.ease=xr[e.ease])}const vo=10;class Nc extends Mc{constructor(t){Vc(t),ur(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:s,onComplete:o,element:r,...i}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const l=new Is({...i,autoplay:!1}),c=Ve(this.finishedTime??this.time);n.setWithVelocity(l.sample(c-vo).value,l.sample(c).value,vo),l.stop()}}const wo=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(We.test(e)||e==="0")&&!e.startsWith("url("));function Pc(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Rc(e,t,n,s){const o=e[0];if(o===null)return!1;if(t==="display"||t==="visibility")return!0;const r=e[e.length-1],i=wo(o,t),l=wo(r,t);return gt(i===l,`You are trying to animate ${t} from "${o}" to "${r}". "${i?r:o}" is not an animatable value.`,"value-not-animatable"),!i||!l?!1:Pc(e)||(n==="spring"||gr(n))&&s}function es(e){e.duration=0,e.type}const Ic=new Set(["opacity","clipPath","filter","transform"]),Dc=ws(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Fc(e){var u;const{motionValue:t,name:n,repeatDelay:s,repeatType:o,damping:r,type:i}=e;if(!(((u=t==null?void 0:t.owner)==null?void 0:u.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:d}=t.owner.getProps();return Dc()&&n&&Ic.has(n)&&(n!=="transform"||!d)&&!c&&!s&&o!=="mirror"&&r!==0&&i!=="inertia"}const Lc=40;class Bc extends Rs{constructor({autoplay:t=!0,delay:n=0,type:s="keyframes",repeat:o=0,repeatDelay:r=0,repeatType:i="loop",keyframes:l,name:c,motionValue:d,element:u,...m}){var g;super(),this.stop=()=>{var x,v;this._animation&&(this._animation.stop(),(x=this.stopTimeline)==null||x.call(this)),(v=this.keyframeResolver)==null||v.cancel()},this.createdAt=Se.now();const f={autoplay:t,delay:n,type:s,repeat:o,repeatDelay:r,repeatType:i,name:c,motionValue:d,element:u,...m},p=(u==null?void 0:u.KeyframeResolver)||Ds;this.keyframeResolver=new p(l,(x,v,E)=>this.onKeyframesResolved(x,v,f,!E),c,d,u),(g=this.keyframeResolver)==null||g.scheduleResolve()}onKeyframesResolved(t,n,s,o){this.keyframeResolver=void 0;const{name:r,type:i,velocity:l,delay:c,isHandoff:d,onUpdate:u}=s;this.resolvedAt=Se.now(),Rc(t,r,i,l)||((_e.instantAnimations||!c)&&(u==null||u(Ps(t,s,n))),t[0]=t[t.length-1],es(s),s.repeat=0);const f={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>Lc?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:t},p=!d&&Fc(f)?new Nc({...f,element:f.motionValue.owner.current}):new Is(f);p.finished.then(()=>this.notifyFinished()).catch(Ae),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),vc()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}const $c=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Oc(e){const t=$c.exec(e);if(!t)return[,];const[,n,s,o]=t;return[`--${n??s}`,o]}const _c=4;function yr(e,t,n=1){Oe(n<=_c,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[s,o]=Oc(e);if(!s)return;const r=window.getComputedStyle(t).getPropertyValue(s);if(r){const i=r.trim();return Oi(i)?parseFloat(i):i}return As(o)?yr(o,t,n+1):o}function Fs(e,t){return(e==null?void 0:e[t])??(e==null?void 0:e.default)??e}const br=new Set(["width","height","top","left","right","bottom",...yt]),Hc={test:e=>e==="auto",parse:e=>e},vr=e=>t=>t.test(e),wr=[xt,U,Re,Ue,Pl,Nl,Hc],So=e=>wr.find(vr(e));function Zc(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Hi(e):!0}const Uc=new Set(["brightness","contrast","saturate","opacity"]);function zc(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(Ms)||[];if(!s)return e;const o=n.replace(s,"");let r=Uc.has(t)?1:0;return s!==n&&(r*=100),t+"("+r+o+")"}const Wc=/\b([a-z-]*)\(.*?\)/gu,ts={...We,getAnimatableNone:e=>{const t=e.match(Wc);return t?t.map(zc).join(" "):e}},Co={...xt,transform:Math.round},Kc={rotate:Ue,rotateX:Ue,rotateY:Ue,rotateZ:Ue,scale:Wt,scaleX:Wt,scaleY:Wt,scaleZ:Wt,skew:Ue,skewX:Ue,skewY:Ue,distance:U,translateX:U,translateY:U,translateZ:U,x:U,y:U,z:U,perspective:U,transformPerspective:U,opacity:Pt,originX:co,originY:co,originZ:U},Ls={borderWidth:U,borderTopWidth:U,borderRightWidth:U,borderBottomWidth:U,borderLeftWidth:U,borderRadius:U,radius:U,borderTopLeftRadius:U,borderTopRightRadius:U,borderBottomRightRadius:U,borderBottomLeftRadius:U,width:U,maxWidth:U,height:U,maxHeight:U,top:U,right:U,bottom:U,left:U,padding:U,paddingTop:U,paddingRight:U,paddingBottom:U,paddingLeft:U,margin:U,marginTop:U,marginRight:U,marginBottom:U,marginLeft:U,backgroundPositionX:U,backgroundPositionY:U,...Kc,zIndex:Co,fillOpacity:Pt,strokeOpacity:Pt,numOctaves:Co},Gc={...Ls,color:fe,backgroundColor:fe,outlineColor:fe,fill:fe,stroke:fe,borderColor:fe,borderTopColor:fe,borderRightColor:fe,borderBottomColor:fe,borderLeftColor:fe,filter:ts,WebkitFilter:ts},Sr=e=>Gc[e];function Cr(e,t){let n=Sr(e);return n!==ts&&(n=We),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Yc=new Set(["auto","none","0"]);function qc(e,t,n){let s=0,o;for(;s<e.length&&!o;){const r=e[s];typeof r=="string"&&!Yc.has(r)&&Rt(r).values.length&&(o=e[s]),s++}if(o&&n)for(const r of t)e[r]=Cr(n,o)}class Xc extends Ds{constructor(t,n,s,o,r){super(t,n,s,o,r,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let d=t[c];if(typeof d=="string"&&(d=d.trim(),As(d))){const u=yr(d,n.current);u!==void 0&&(t[c]=u),c===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!br.has(s)||t.length!==2)return;const[o,r]=t,i=So(o),l=So(r);if(i!==l)if(yo(i)&&yo(l))for(let c=0;c<t.length;c++){const d=t[c];typeof d=="string"&&(t[c]=parseFloat(d))}else Qe[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,s=[];for(let o=0;o<t.length;o++)(t[o]===null||Zc(t[o]))&&s.push(o);s.length&&qc(t,s,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:s}=this;if(!t||!t.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Qe[s](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&t.getValue(s,o).jump(o,!1)}measureEndState(){var l;const{element:t,name:n,unresolvedKeyframes:s}=this;if(!t||!t.current)return;const o=t.getValue(n);o&&o.jump(this.measuredOrigin,!1);const r=s.length-1,i=s[r];s[r]=Qe[n](t.measureViewportBox(),window.getComputedStyle(t.current)),i!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=i),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,d])=>{t.getValue(c).set(d)}),this.resolveNoneKeyframes()}}function Jc(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let s=document;const o=(n==null?void 0:n[e])??s.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e)}const kr=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function jr(e){return _i(e)&&"offsetHeight"in e}const ko=30,Qc=e=>!isNaN(parseFloat(e));class ed{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{var r;const o=Se.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&((r=this.events.change)==null||r.notify(this.current),this.dependents))for(const i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Se.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Qc(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return process.env.NODE_ENV!=="production"&&Cs(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Ss);const s=this.events[t].add(n);return t==="change"?()=>{s(),ie.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Se.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>ko)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,ko);return Zi(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function mt(e,t){return new ed(e,t)}const{schedule:Bs}=er(queueMicrotask,!1),Te={x:!1,y:!1};function Er(){return Te.x||Te.y}function td(e){return e==="x"||e==="y"?Te[e]?null:(Te[e]=!0,()=>{Te[e]=!1}):Te.x||Te.y?null:(Te.x=Te.y=!0,()=>{Te.x=Te.y=!1})}function Ar(e,t){const n=Jc(e),s=new AbortController,o={passive:!0,...t,signal:s.signal};return[n,o,()=>s.abort()]}function jo(e){return!(e.pointerType==="touch"||Er())}function nd(e,t,n={}){const[s,o,r]=Ar(e,n),i=l=>{if(!jo(l))return;const{target:c}=l,d=t(c,l);if(typeof d!="function"||!c)return;const u=m=>{jo(m)&&(d(m),c.removeEventListener("pointerleave",u))};c.addEventListener("pointerleave",u,o)};return s.forEach(l=>{l.addEventListener("pointerenter",i,o)}),r}const Mr=(e,t)=>t?e===t?!0:Mr(e,t.parentElement):!1,$s=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,sd=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function od(e){return sd.has(e.tagName)||e.tabIndex!==-1}const en=new WeakSet;function Eo(e){return t=>{t.key==="Enter"&&e(t)}}function En(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const id=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=Eo(()=>{if(en.has(n))return;En(n,"down");const o=Eo(()=>{En(n,"up")}),r=()=>En(n,"cancel");n.addEventListener("keyup",o,t),n.addEventListener("blur",r,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function Ao(e){return $s(e)&&!Er()}function rd(e,t,n={}){const[s,o,r]=Ar(e,n),i=l=>{const c=l.currentTarget;if(!Ao(l))return;en.add(c);const d=t(c,l),u=(p,g)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",f),en.has(c)&&en.delete(c),Ao(p)&&typeof d=="function"&&d(p,{success:g})},m=p=>{u(p,c===window||c===document||n.useGlobalTarget||Mr(c,p.target))},f=p=>{u(p,!1)};window.addEventListener("pointerup",m,o),window.addEventListener("pointercancel",f,o)};return s.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",i,o),jr(l)&&(l.addEventListener("focus",d=>id(d,o)),!od(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),r}function Tr(e){return _i(e)&&"ownerSVGElement"in e}function ad(e){return Tr(e)&&e.tagName==="svg"}const be=e=>!!(e&&e.getVelocity),ld=[...wr,fe,We],cd=e=>ld.find(vr(e)),Os=y.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class dd extends h.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const s=n.offsetParent,o=jr(s)&&s.offsetWidth||0,r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft,r.right=o-r.width-r.left}return null}componentDidUpdate(){}render(){return this.props.children}}function ud({children:e,isPresent:t,anchorX:n,root:s}){const o=y.useId(),r=y.useRef(null),i=y.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:l}=y.useContext(Os);return y.useInsertionEffect(()=>{const{width:c,height:d,top:u,left:m,right:f}=i.current;if(t||!r.current||!c||!d)return;const p=n==="left"?`left: ${m}`:`right: ${f}`;r.current.dataset.motionPopId=o;const g=document.createElement("style");l&&(g.nonce=l);const x=s??document.head;return x.appendChild(g),g.sheet&&g.sheet.insertRule(`
|
|
2
2
|
[data-motion-pop-id="${o}"] {
|
|
3
3
|
position: absolute !important;
|
|
4
4
|
width: ${c}px !important;
|
|
5
5
|
height: ${d}px !important;
|
|
6
|
-
${
|
|
6
|
+
${p}px !important;
|
|
7
7
|
top: ${u}px !important;
|
|
8
8
|
}
|
|
9
|
-
`),()=>{x.contains(p)&&x.removeChild(p)}},[t]),a.jsx(ud,{isPresent:t,childRef:r,sizeRef:i,children:h.cloneElement(e,{ref:r})})}const md=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:o,presenceAffectsLayout:r,mode:i,anchorX:l,root:c})=>{const d=ys(fd),u=y.useId();let m=!0,f=y.useMemo(()=>(m=!1,{id:u,initial:t,isPresent:n,custom:o,onExitComplete:g=>{d.set(g,!0);for(const p of d.values())if(!p)return;s&&s()},register:g=>(d.set(g,!1),()=>d.delete(g))}),[n,d,s]);return r&&m&&(f={...f}),y.useMemo(()=>{d.forEach((g,p)=>d.set(p,!1))},[n]),h.useEffect(()=>{!n&&!d.size&&s&&s()},[n]),i==="popLayout"&&(e=a.jsx(hd,{isPresent:n,anchorX:l,root:c,children:e})),a.jsx(hn.Provider,{value:f,children:e})};function fd(){return new Map}function Nr(e=!0){const t=y.useContext(hn);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:o}=t,r=y.useId();y.useEffect(()=>{if(e)return o(r)},[e]);const i=y.useCallback(()=>e&&s&&s(r),[r,s,e]);return!n&&s?[!1,i]:[!0]}const Kt=e=>e.key||"";function To(e){const t=[];return y.Children.forEach(e,n=>{y.isValidElement(n)&&t.push(n)}),t}const ut=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:o=!0,mode:r="sync",propagate:i=!1,anchorX:l="left",root:c})=>{const[d,u]=Nr(i),m=y.useMemo(()=>To(e),[e]),f=i&&!d?[]:m.map(Kt),g=y.useRef(!0),p=y.useRef(m),x=ys(()=>new Map),[v,E]=y.useState(m),[b,S]=y.useState(m);Oi(()=>{g.current=!1,p.current=m;for(let A=0;A<b.length;A++){const j=Kt(b[A]);f.includes(j)?x.delete(j):x.get(j)!==!0&&x.set(j,!1)}},[b,f.length,f.join("-")]);const w=[];if(m!==v){let A=[...m];for(let j=0;j<b.length;j++){const k=b[j],D=Kt(k);f.includes(D)||(A.splice(j,0,k),w.push(k))}return r==="wait"&&w.length&&(A=w),S(To(A)),E(m),null}process.env.NODE_ENV!=="production"&&r==="wait"&&b.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:C}=y.useContext(xs);return a.jsx(a.Fragment,{children:b.map(A=>{const j=Kt(A),k=i&&!d?!1:m===b||f.includes(j),D=()=>{if(x.has(j))x.set(j,!0);else return;let L=!0;x.forEach(W=>{W||(L=!1)}),L&&(C==null||C(),S(p.current),i&&(u==null||u()),s&&s())};return a.jsx(md,{isPresent:k,initial:!g.current||n?void 0:!1,custom:t,presenceAffectsLayout:o,mode:r,root:c,onExitComplete:k?void 0:D,anchorX:l,children:A},j)})})},Pr=y.createContext({strict:!1}),Vo={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},ft={};for(const e in Vo)ft[e]={isEnabled:t=>Vo[e].some(n=>!!t[n])};function gd(e){for(const t in e)ft[t]={...ft[t],...e[t]}}const pd=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function cn(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||pd.has(e)}let Rr=e=>!cn(e);function xd(e){typeof e=="function"&&(Rr=t=>t.startsWith("on")?!cn(t):e(t))}try{xd(require("@emotion/is-prop-valid").default)}catch{}function yd(e,t,n){const s={};for(const o in e)o==="values"&&typeof e.values=="object"||(Rr(o)||n===!0&&cn(o)||!t&&!cn(o)||e.draggable&&o.startsWith("onDrag"))&&(s[o]=e[o]);return s}const mn=y.createContext({});function fn(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function It(e){return typeof e=="string"||Array.isArray(e)}const Hs=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],zs=["initial",...Hs];function gn(e){return fn(e.animate)||zs.some(t=>It(e[t]))}function Ir(e){return!!(gn(e)||e.variants)}function bd(e,t){if(gn(e)){const{initial:n,animate:s}=e;return{initial:n===!1||It(n)?n:void 0,animate:It(s)?s:void 0}}return e.inherit!==!1?t:{}}function vd(e){const{initial:t,animate:n}=bd(e,y.useContext(mn));return y.useMemo(()=>({initial:t,animate:n}),[No(t),No(n)])}function No(e){return Array.isArray(e)?e.join(" "):e}const Dt={};function wd(e){for(const t in e)Dt[t]=e[t],As(t)&&(Dt[t].isCSSVariable=!0)}function Dr(e,{layout:t,layoutId:n}){return bt.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Dt[e]||e==="opacity")}const Sd={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Cd=yt.length;function kd(e,t,n){let s="",o=!0;for(let r=0;r<Cd;r++){const i=yt[r],l=e[i];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(i.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const d=jr(l,Bs[i]);if(!c){o=!1;const u=Sd[i]||i;s+=`${u}(${d}) `}n&&(t[i]=d)}}return s=s.trim(),n?s=n(t,o?"":s):o&&(s="none"),s}function Zs(e,t,n){const{style:s,vars:o,transformOrigin:r}=e;let i=!1,l=!1;for(const c in t){const d=t[c];if(bt.has(c)){i=!0;continue}else if(As(c)){o[c]=d;continue}else{const u=jr(d,Bs[c]);c.startsWith("origin")?(l=!0,r[c]=u):s[c]=u}}if(t.transform||(i||n?s.transform=kd(t,e.transform,n):s.transform&&(s.transform="none")),l){const{originX:c="50%",originY:d="50%",originZ:u=0}=r;s.transformOrigin=`${c} ${d} ${u}`}}const Us=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Fr(e,t,n){for(const s in t)!be(t[s])&&!Dr(s,n)&&(e[s]=t[s])}function jd({transformTemplate:e},t){return y.useMemo(()=>{const n=Us();return Zs(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Ed(e,t){const n=e.style||{},s={};return Fr(s,n,e),Object.assign(s,jd(e,t)),s}function Ad(e,t){const n={},s=Ed(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}const Md={offset:"stroke-dashoffset",array:"stroke-dasharray"},Td={offset:"strokeDashoffset",array:"strokeDasharray"};function Vd(e,t,n=1,s=0,o=!0){e.pathLength=1;const r=o?Md:Td;e[r.offset]=Z.transform(-s);const i=Z.transform(t),l=Z.transform(n);e[r.array]=`${i} ${l}`}function Lr(e,{attrX:t,attrY:n,attrScale:s,pathLength:o,pathSpacing:r=1,pathOffset:i=0,...l},c,d,u){if(Zs(e,l,d),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:m,style:f}=e;m.transform&&(f.transform=m.transform,delete m.transform),(f.transform||m.transformOrigin)&&(f.transformOrigin=m.transformOrigin??"50% 50%",delete m.transformOrigin),f.transform&&(f.transformBox=(u==null?void 0:u.transformBox)??"fill-box",delete m.transformBox),t!==void 0&&(m.x=t),n!==void 0&&(m.y=n),s!==void 0&&(m.scale=s),o!==void 0&&Vd(m,o,r,i,!1)}const Br=()=>({...Us(),attrs:{}}),$r=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Nd(e,t,n,s){const o=y.useMemo(()=>{const r=Br();return Lr(r,t,$r(s),e.transformTemplate,e.style),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const r={};Fr(r,e.style,e),o.style={...r,...o.style}}return o}const Pd=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Ws(e){return typeof e!="string"||e.includes("-")?!1:!!(Pd.indexOf(e)>-1||/[A-Z]/u.test(e))}function Rd(e,t,n,{latestValues:s},o,r=!1){const l=(Ws(e)?Nd:Ad)(t,s,o,e),c=yd(t,typeof e=="string",r),d=e!==y.Fragment?{...c,...l,ref:n}:{},{children:u}=t,m=y.useMemo(()=>be(u)?u.get():u,[u]);return y.createElement(e,{...d,children:m})}function Po(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function Ks(e,t,n,s){if(typeof t=="function"){const[o,r]=Po(s);t=t(n!==void 0?n:e.custom,o,r)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[o,r]=Po(s);t=t(n!==void 0?n:e.custom,o,r)}return t}function tn(e){return be(e)?e.get():e}function Id({scrapeMotionValuesFromProps:e,createRenderState:t},n,s,o){return{latestValues:Dd(n,s,o,e),renderState:t()}}function Dd(e,t,n,s){const o={},r=s(e,{});for(const f in r)o[f]=tn(r[f]);let{initial:i,animate:l}=e;const c=gn(e),d=Ir(e);t&&d&&!c&&e.inherit!==!1&&(i===void 0&&(i=t.initial),l===void 0&&(l=t.animate));let u=n?n.initial===!1:!1;u=u||i===!1;const m=u?l:i;if(m&&typeof m!="boolean"&&!fn(m)){const f=Array.isArray(m)?m:[m];for(let g=0;g<f.length;g++){const p=Ks(e,f[g]);if(p){const{transitionEnd:x,transition:v,...E}=p;for(const b in E){let S=E[b];if(Array.isArray(S)){const w=u?S.length-1:0;S=S[w]}S!==null&&(o[b]=S)}for(const b in x)o[b]=x[b]}}}return o}const Or=e=>(t,n)=>{const s=y.useContext(mn),o=y.useContext(hn),r=()=>Id(e,t,s,o);return n?r():ys(r)};function Gs(e,t,n){var r;const{style:s}=e,o={};for(const i in s)(be(s[i])||t.style&&be(t.style[i])||Dr(i,e)||((r=n==null?void 0:n.getValue(i))==null?void 0:r.liveStyle)!==void 0)&&(o[i]=s[i]);return o}const Fd=Or({scrapeMotionValuesFromProps:Gs,createRenderState:Us});function _r(e,t,n){const s=Gs(e,t,n);for(const o in e)if(be(e[o])||be(t[o])){const r=yt.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;s[r]=e[o]}return s}const Ld=Or({scrapeMotionValuesFromProps:_r,createRenderState:Br}),Bd=Symbol.for("motionComponentSymbol");function at(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function $d(e,t,n){return y.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),n&&(typeof n=="function"?n(s):at(n)&&(n.current=s))},[t])}const Ys=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Od="framerAppearId",Hr="data-"+Ys(Od),zr=y.createContext({});function _d(e,t,n,s,o){var x,v;const{visualElement:r}=y.useContext(mn),i=y.useContext(Pr),l=y.useContext(hn),c=y.useContext(_s).reducedMotion,d=y.useRef(null);s=s||i.renderer,!d.current&&s&&(d.current=s(e,{visualState:t,parent:r,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const u=d.current,m=y.useContext(zr);u&&!u.projection&&o&&(u.type==="html"||u.type==="svg")&&Hd(d.current,n,o,m);const f=y.useRef(!1);y.useInsertionEffect(()=>{u&&f.current&&u.update(n,l)});const g=n[Hr],p=y.useRef(!!g&&!((x=window.MotionHandoffIsComplete)!=null&&x.call(window,g))&&((v=window.MotionHasOptimisedAnimation)==null?void 0:v.call(window,g)));return Oi(()=>{u&&(f.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),u.scheduleRenderMicrotask(),p.current&&u.animationState&&u.animationState.animateChanges())}),y.useEffect(()=>{u&&(!p.current&&u.animationState&&u.animationState.animateChanges(),p.current&&(queueMicrotask(()=>{var E;(E=window.MotionHandoffMarkAsComplete)==null||E.call(window,g)}),p.current=!1),u.enteringChildren=void 0)}),u}function Hd(e,t,n,s){const{layoutId:o,layout:r,drag:i,dragConstraints:l,layoutScroll:c,layoutRoot:d,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Zr(e.parent)),e.projection.setOptions({layoutId:o,layout:r,alwaysMeasureLayout:!!i||l&&at(l),visualElement:e,animationType:typeof r=="string"?r:"both",initialPromotionConfig:s,crossfade:u,layoutScroll:c,layoutRoot:d})}function Zr(e){if(e)return e.options.allowProjection!==!1?e.projection:Zr(e.parent)}function An(e,{forwardMotionProps:t=!1}={},n,s){n&&gd(n);const o=Ws(e)?Ld:Fd;function r(l,c){let d;const u={...y.useContext(_s),...l,layoutId:zd(l)},{isStatic:m}=u,f=vd(l),g=o(l,m);if(!m&&bs){Zd(u,n);const p=Ud(u);d=p.MeasureLayout,f.visualElement=_d(e,g,u,s,p.ProjectionNode)}return a.jsxs(mn.Provider,{value:f,children:[d&&f.visualElement?a.jsx(d,{visualElement:f.visualElement,...u}):null,Rd(e,l,$d(g,f.visualElement,c),g,m,t)]})}r.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const i=y.forwardRef(r);return i[Bd]=e,i}function zd({layoutId:e}){const t=y.useContext(xs).id;return t&&e!==void 0?t+"-"+e:e}function Zd(e,t){const n=y.useContext(Pr).strict;if(process.env.NODE_ENV!=="production"&&t&&n){const s="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?pt(!1,s,"lazy-strict-mode"):Oe(!1,s,"lazy-strict-mode")}}function Ud(e){const{drag:t,layout:n}=ft;if(!t&&!n)return{};const s={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function Wd(e,t){if(typeof Proxy>"u")return An;const n=new Map,s=(r,i)=>An(r,i,e,t),o=(r,i)=>(process.env.NODE_ENV!=="production"&&ks(!1,"motion() is deprecated. Use motion.create() instead."),s(r,i));return new Proxy(o,{get:(r,i)=>i==="create"?s:(n.has(i)||n.set(i,An(i,void 0,e,t)),n.get(i))})}function Ur({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function Kd({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Gd(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function Mn(e){return e===void 0||e===1}function ss({scale:e,scaleX:t,scaleY:n}){return!Mn(e)||!Mn(t)||!Mn(n)}function qe(e){return ss(e)||Wr(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Wr(e){return Ro(e.x)||Ro(e.y)}function Ro(e){return e&&e!=="0%"}function dn(e,t,n){const s=e-n,o=t*s;return n+o}function Io(e,t,n,s,o){return o!==void 0&&(e=dn(e,o,s)),dn(e,n,s)+t}function os(e,t=0,n=1,s,o){e.min=Io(e.min,t,n,s,o),e.max=Io(e.max,t,n,s,o)}function Kr(e,{x:t,y:n}){os(e.x,t.translate,t.scale,t.originPoint),os(e.y,n.translate,n.scale,n.originPoint)}const Do=.999999999999,Fo=1.0000000000001;function Yd(e,t,n,s=!1){const o=n.length;if(!o)return;t.x=t.y=1;let r,i;for(let l=0;l<o;l++){r=n[l],i=r.projectionDelta;const{visualElement:c}=r.options;c&&c.props.style&&c.props.style.display==="contents"||(s&&r.options.layoutScroll&&r.scroll&&r!==r.root&&ct(e,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),i&&(t.x*=i.x.scale,t.y*=i.y.scale,Kr(e,i)),s&&qe(r.latestValues)&&ct(e,r.latestValues))}t.x<Fo&&t.x>Do&&(t.x=1),t.y<Fo&&t.y>Do&&(t.y=1)}function lt(e,t){e.min=e.min+t,e.max=e.max+t}function Lo(e,t,n,s,o=.5){const r=le(e.min,e.max,o);os(e,t,n,r,s)}function ct(e,t){Lo(e.x,t.x,t.scaleX,t.scale,t.originX),Lo(e.y,t.y,t.scaleY,t.scale,t.originY)}function Gr(e,t){return Ur(Gd(e.getBoundingClientRect(),t))}function qd(e,t,n){const s=Gr(e,n),{scroll:o}=t;return o&&(lt(s.x,o.offset.x),lt(s.y,o.offset.y)),s}const Bo=()=>({translate:0,scale:1,origin:0,originPoint:0}),dt=()=>({x:Bo(),y:Bo()}),$o=()=>({min:0,max:0}),de=()=>({x:$o(),y:$o()}),is={current:null},Yr={current:!1};function Xd(){if(Yr.current=!0,!!bs)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>is.current=e.matches;e.addEventListener("change",t),t()}else is.current=!1}const Jd=new WeakMap;function Qd(e,t,n){for(const s in t){const o=t[s],r=n[s];if(be(o))e.addValue(s,o);else if(be(r))e.addValue(s,mt(o,{owner:e}));else if(r!==o)if(e.hasValue(s)){const i=e.getValue(s);i.liveStyle===!0?i.jump(o):i.hasAnimated||i.set(o)}else{const i=e.getStaticValue(s);e.addValue(s,mt(i!==void 0?i:o,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const Oo=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class eu{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:o,blockInitialAnimation:r,visualState:i},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Fs,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=Se.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,ie.render(this.render,!1,!0))};const{latestValues:c,renderState:d}=i;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=o,this.options=l,this.blockInitialAnimation=!!r,this.isControllingVariants=gn(n),this.isVariantNode=Ir(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...m}=this.scrapeMotionValuesFromProps(n,{},this);for(const f in m){const g=m[f];c[f]!==void 0&&be(g)&&g.set(c[f])}}mount(t){var n;this.current=t,Jd.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,o)=>this.bindToMotionValue(o,s)),Yr.current||Xd(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:is.current,process.env.NODE_ENV!=="production"&&ks(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var t;this.projection&&this.projection.unmount(),Ue(this.notifyUpdate),Ue(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const s=this.features[n];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=bt.has(t);s&&this.onBindTransform&&this.onBindTransform();const o=n.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&ie.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let r;window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{o(),r&&r(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in ft){const n=ft[t];if(!n)continue;const{isEnabled:s,Feature:o}=n;if(!this.features[t]&&o&&s(this.props)&&(this.features[t]=new o(this)),this.features[t]){const r=this.features[t];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):de()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<Oo.length;s++){const o=Oo[s];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const r="on"+o,i=t[r];i&&(this.propEventSubscriptions[o]=this.on(o,i))}this.prevMotionValues=Qd(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=mt(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(_i(s)||zi(s))?s=parseFloat(s):!dd(s)&&We.test(n)&&(s=kr(t,n)),this.setBaseTarget(t,be(s)?s.get():s)),be(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var r;const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const i=Ks(this.props,n,(r=this.presenceContext)==null?void 0:r.custom);i&&(s=i[t])}if(n&&s!==void 0)return s;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!be(o)?o:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Cs),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){$s.render(this.render)}}class qr extends eu{constructor(){super(...arguments),this.KeyframeResolver=Jc}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;be(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function Xr(e,{style:t,vars:n},s,o){const r=e.style;let i;for(i in t)r[i]=t[i];o==null||o.applyProjectionStyles(r,s);for(i in n)r.setProperty(i,n[i])}function tu(e){return window.getComputedStyle(e)}class nu extends qr{constructor(){super(...arguments),this.type="html",this.renderInstance=Xr}readValueFromInstance(t,n){var s;if(bt.has(n))return(s=this.projection)!=null&&s.isProjecting?qn(n):pc(t,n);{const o=tu(t),r=(As(n)?o.getPropertyValue(n):o[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Gr(t,n)}build(t,n,s){Zs(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return Gs(t,n,s)}}const Jr=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function su(e,t,n,s){Xr(e,t,void 0,s);for(const o in t.attrs)e.setAttribute(Jr.has(o)?o:Ys(o),t.attrs[o])}class ou extends qr{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=de}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(bt.has(n)){const s=Cr(n);return s&&s.default||0}return n=Jr.has(n)?n:Ys(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return _r(t,n,s)}build(t,n,s){Lr(t,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(t,n,s,o){su(t,n,s,o)}mount(t){this.isSVGTag=$r(t.tagName),super.mount(t)}}const iu=(e,t)=>Ws(e)?new ou(t):new nu(t,{allowProjection:e!==y.Fragment});function ht(e,t,n){const s=e.getProps();return Ks(s,t,n!==void 0?n:s.custom,e)}const rs=e=>Array.isArray(e);function ru(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,mt(n))}function au(e){return rs(e)?e[e.length-1]||0:e}function lu(e,t){const n=ht(e,t);let{transitionEnd:s={},transition:o={},...r}=n||{};r={...r,...s};for(const i in r){const l=au(r[i]);ru(e,i,l)}}function cu(e){return!!(be(e)&&e.add)}function as(e,t){const n=e.getValue("willChange");if(cu(n))return n.add(t);if(!n&&_e.WillChange){const s=new _e.WillChange("auto");e.addValue("willChange",s),s.add(t)}}function Qr(e){return e.props[Hr]}const du=e=>e!==null;function uu(e,{repeat:t,repeatType:n="loop"},s){const o=e.filter(du),r=t&&n!=="loop"&&t%2===1?0:o.length-1;return o[r]}const hu={type:"spring",stiffness:500,damping:25,restSpeed:10},mu=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),fu={type:"keyframes",duration:.8},gu={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},pu=(e,{keyframes:t})=>t.length>2?fu:bt.has(e)?e.startsWith("scale")?mu(t[1]):hu:gu;function xu({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:o,repeat:r,repeatType:i,repeatDelay:l,from:c,elapsed:d,...u}){return!!Object.keys(u).length}const qs=(e,t,n,s={},o,r)=>i=>{const l=Ls(s,e)||{},c=l.delay||s.delay||0;let{elapsed:d=0}=s;d=d-Ve(c);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-d,onUpdate:f=>{t.set(f),l.onUpdate&&l.onUpdate(f)},onComplete:()=>{i(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:r?void 0:o};xu(l)||Object.assign(u,pu(e,u)),u.duration&&(u.duration=Ve(u.duration)),u.repeatDelay&&(u.repeatDelay=Ve(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let m=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(ts(u),u.delay===0&&(m=!0)),(_e.instantAnimations||_e.skipAnimations)&&(m=!0,ts(u),u.delay=0),u.allowFlatten=!l.type&&!l.ease,m&&!r&&t.get()!==void 0){const f=uu(u.keyframes,l);if(f!==void 0){ie.update(()=>{u.onUpdate(f),u.onComplete()});return}}return l.isSync?new Ds(u):new $c(u)};function yu({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function ea(e,t,{delay:n=0,transitionOverride:s,type:o}={}){let{transition:r=e.getDefaultTransition(),transitionEnd:i,...l}=t;s&&(r=s);const c=[],d=o&&e.animationState&&e.animationState.getState()[o];for(const u in l){const m=e.getValue(u,e.latestValues[u]??null),f=l[u];if(f===void 0||d&&yu(d,u))continue;const g={delay:n,...Ls(r||{},u)},p=m.get();if(p!==void 0&&!m.isAnimating&&!Array.isArray(f)&&f===p&&!g.velocity)continue;let x=!1;if(window.MotionHandoffAnimation){const E=Qr(e);if(E){const b=window.MotionHandoffAnimation(E,u,ie);b!==null&&(g.startTime=b,x=!0)}}as(e,u),m.start(qs(u,m,f,e.shouldReduceMotion&&vr.has(u)?{type:!1}:g,e,x));const v=m.animation;v&&c.push(v)}return i&&Promise.all(c).then(()=>{ie.update(()=>{i&&lu(e,i)})}),c}function ta(e,t,n,s=0,o=1){const r=Array.from(e).sort((d,u)=>d.sortNodePosition(u)).indexOf(t),i=e.size,l=(i-1)*s;return typeof n=="function"?n(r,i):o===1?r*s:l-r*s}function ls(e,t,n={}){var c;const s=ht(e,t,n.type==="exit"?(c=e.presenceContext)==null?void 0:c.custom:void 0);let{transition:o=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(o=n.transitionOverride);const r=s?()=>Promise.all(ea(e,s,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:u=0,staggerChildren:m,staggerDirection:f}=o;return bu(e,t,d,u,m,f,n)}:()=>Promise.resolve(),{when:l}=o;if(l){const[d,u]=l==="beforeChildren"?[r,i]:[i,r];return d().then(()=>u())}else return Promise.all([r(),i(n.delay)])}function bu(e,t,n=0,s=0,o=0,r=1,i){const l=[];for(const c of e.variantChildren)c.notify("AnimationStart",t),l.push(ls(c,t,{...i,delay:n+(typeof s=="function"?0:s)+ta(e.variantChildren,c,s,o,r)}).then(()=>c.notify("AnimationComplete",t)));return Promise.all(l)}function vu(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const o=t.map(r=>ls(e,r,n));s=Promise.all(o)}else if(typeof t=="string")s=ls(e,t,n);else{const o=typeof t=="function"?ht(e,t,n.custom):t;s=Promise.all(ea(e,o,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}function na(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s<n;s++)if(t[s]!==e[s])return!1;return!0}const wu=zs.length;function sa(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?sa(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<wu;n++){const s=zs[n],o=e.props[s];(It(o)||o===!1)&&(t[s]=o)}return t}const Su=[...Hs].reverse(),Cu=Hs.length;function ku(e){return t=>Promise.all(t.map(({animation:n,options:s})=>vu(e,n,s)))}function ju(e){let t=ku(e),n=_o(),s=!0;const o=c=>(d,u)=>{var f;const m=ht(e,u,c==="exit"?(f=e.presenceContext)==null?void 0:f.custom:void 0);if(m){const{transition:g,transitionEnd:p,...x}=m;d={...d,...x,...p}}return d};function r(c){t=c(e)}function i(c){const{props:d}=e,u=sa(e.parent)||{},m=[],f=new Set;let g={},p=1/0;for(let v=0;v<Cu;v++){const E=Su[v],b=n[E],S=d[E]!==void 0?d[E]:u[E],w=It(S),C=E===c?b.isActive:null;C===!1&&(p=v);let A=S===u[E]&&S!==d[E]&&w;if(A&&s&&e.manuallyAnimateOnMount&&(A=!1),b.protectedKeys={...g},!b.isActive&&C===null||!S&&!b.prevProp||fn(S)||typeof S=="boolean")continue;const j=Eu(b.prevProp,S);let k=j||E===c&&b.isActive&&!A&&w||v>p&&w,D=!1;const L=Array.isArray(S)?S:[S];let W=L.reduce(o(E),{});C===!1&&(W={});const{prevResolvedValues:H={}}=b,Ce={...H,...W},ne=U=>{k=!0,f.has(U)&&(D=!0,f.delete(U)),b.needsAnimating[U]=!0;const M=e.getValue(U);M&&(M.liveStyle=!1)};for(const U in Ce){const M=W[U],G=H[U];if(g.hasOwnProperty(U))continue;let Y=!1;rs(M)&&rs(G)?Y=!na(M,G):Y=M!==G,Y?M!=null?ne(U):f.add(U):M!==void 0&&f.has(U)?ne(U):b.protectedKeys[U]=!0}b.prevProp=S,b.prevResolvedValues=W,b.isActive&&(g={...g,...W}),s&&e.blockInitialAnimation&&(k=!1);const te=A&&j;k&&(!te||D)&&m.push(...L.map(U=>{const M={type:E};if(typeof U=="string"&&s&&!te&&e.manuallyAnimateOnMount&&e.parent){const{parent:G}=e,Y=ht(G,U);if(G.enteringChildren&&Y){const{delayChildren:V}=Y.transition||{};M.delay=ta(G.enteringChildren,e,V)}}return{animation:U,options:M}}))}if(f.size){const v={};if(typeof d.initial!="boolean"){const E=ht(e,Array.isArray(d.initial)?d.initial[0]:d.initial);E&&E.transition&&(v.transition=E.transition)}f.forEach(E=>{const b=e.getBaseTarget(E),S=e.getValue(E);S&&(S.liveStyle=!0),v[E]=b??null}),m.push({animation:v})}let x=!!m.length;return s&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(x=!1),s=!1,x?t(m):Promise.resolve()}function l(c,d){var m;if(n[c].isActive===d)return Promise.resolve();(m=e.variantChildren)==null||m.forEach(f=>{var g;return(g=f.animationState)==null?void 0:g.setActive(c,d)}),n[c].isActive=d;const u=i(c);for(const f in n)n[f].protectedKeys={};return u}return{animateChanges:i,setActive:l,setAnimateFunction:r,getState:()=>n,reset:()=>{n=_o(),s=!0}}}function Eu(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!na(t,e):!1}function Ge(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function _o(){return{animate:Ge(!0),whileInView:Ge(),whileHover:Ge(),whileTap:Ge(),whileDrag:Ge(),whileFocus:Ge(),exit:Ge()}}class Ke{constructor(t){this.isMounted=!1,this.node=t}update(){}}class Au extends Ke{constructor(t){super(t),t.animationState||(t.animationState=ju(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();fn(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let Mu=0;class Tu extends Ke{constructor(){super(...arguments),this.id=Mu++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const o=this.node.animationState.setActive("exit",!t);n&&!t&&o.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const Vu={animation:{Feature:Au},exit:{Feature:Tu}};function Ft(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}function Ot(e){return{point:{x:e.pageX,y:e.pageY}}}const Nu=e=>t=>Os(t)&&e(t,Ot(t));function Mt(e,t,n,s){return Ft(e,t,Nu(n),s)}const oa=1e-4,Pu=1-oa,Ru=1+oa,ia=.01,Iu=0-ia,Du=0+ia;function we(e){return e.max-e.min}function Fu(e,t,n){return Math.abs(e-t)<=n}function Ho(e,t,n,s=.5){e.origin=s,e.originPoint=le(t.min,t.max,e.origin),e.scale=we(n)/we(t),e.translate=le(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Pu&&e.scale<=Ru||isNaN(e.scale))&&(e.scale=1),(e.translate>=Iu&&e.translate<=Du||isNaN(e.translate))&&(e.translate=0)}function Tt(e,t,n,s){Ho(e.x,t.x,n.x,s?s.originX:void 0),Ho(e.y,t.y,n.y,s?s.originY:void 0)}function zo(e,t,n){e.min=n.min+t.min,e.max=e.min+we(t)}function Lu(e,t,n){zo(e.x,t.x,n.x),zo(e.y,t.y,n.y)}function Zo(e,t,n){e.min=t.min-n.min,e.max=e.min+we(t)}function Vt(e,t,n){Zo(e.x,t.x,n.x),Zo(e.y,t.y,n.y)}function je(e){return[e("x"),e("y")]}const ra=({current:e})=>e?e.ownerDocument.defaultView:null,Uo=(e,t)=>Math.abs(e-t);function Bu(e,t){const n=Uo(e.x,t.x),s=Uo(e.y,t.y);return Math.sqrt(n**2+s**2)}class aa{constructor(t,n,{transformPagePoint:s,contextWindow:o=window,dragSnapToOrigin:r=!1,distanceThreshold:i=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Vn(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,p=Bu(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!p)return;const{point:x}=f,{timestamp:v}=xe;this.history.push({...x,timestamp:v});const{onStart:E,onMove:b}=this.handlers;g||(E&&E(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),b&&b(this.lastMoveEvent,f)},this.handlePointerMove=(f,g)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Tn(g,this.transformPagePoint),ie.update(this.updatePoint,!0)},this.handlePointerUp=(f,g)=>{this.end();const{onEnd:p,onSessionEnd:x,resumeAnimation:v}=this.handlers;if(this.dragSnapToOrigin&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const E=Vn(f.type==="pointercancel"?this.lastMoveEventInfo:Tn(g,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,E),x&&x(f,E)},!Os(t))return;this.dragSnapToOrigin=r,this.handlers=n,this.transformPagePoint=s,this.distanceThreshold=i,this.contextWindow=o||window;const l=Ot(t),c=Tn(l,this.transformPagePoint),{point:d}=c,{timestamp:u}=xe;this.history=[{...d,timestamp:u}];const{onSessionStart:m}=n;m&&m(t,Vn(c,this.history)),this.removeListeners=Lt(Mt(this.contextWindow,"pointermove",this.handlePointerMove),Mt(this.contextWindow,"pointerup",this.handlePointerUp),Mt(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ue(this.updatePoint)}}function Tn(e,t){return t?{point:t(e.point)}:e}function Wo(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Vn({point:e},t){return{point:e,delta:Wo(e,la(t)),offset:Wo(e,$u(t)),velocity:Ou(t,.1)}}function $u(e){return e[0]}function la(e){return e[e.length-1]}function Ou(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const o=la(e);for(;n>=0&&(s=e[n],!(o.timestamp-s.timestamp>Ve(t)));)n--;if(!s)return{x:0,y:0};const r=Pe(o.timestamp-s.timestamp);if(r===0)return{x:0,y:0};const i={x:(o.x-s.x)/r,y:(o.y-s.y)/r};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function _u(e,{min:t,max:n},s){return t!==void 0&&e<t?e=s?le(t,e,s.min):Math.max(e,t):n!==void 0&&e>n&&(e=s?le(n,e,s.max):Math.min(e,n)),e}function Ko(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function Hu(e,{top:t,left:n,bottom:s,right:o}){return{x:Ko(e.x,n,o),y:Ko(e.y,t,s)}}function Go(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,s]=[s,n]),{min:n,max:s}}function zu(e,t){return{x:Go(e.x,t.x),y:Go(e.y,t.y)}}function Zu(e,t){let n=.5;const s=we(e),o=we(t);return o>s?n=Nt(t.min,t.max-s,e.min):s>o&&(n=Nt(e.min,e.max-o,t.min)),$e(0,1,n)}function Uu(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const cs=.35;function Wu(e=cs){return e===!1?e=0:e===!0&&(e=cs),{x:Yo(e,"left","right"),y:Yo(e,"top","bottom")}}function Yo(e,t,n){return{min:qo(e,t),max:qo(e,n)}}function qo(e,t){return typeof e=="number"?e:e[t]||0}const Ku=new WeakMap;class Gu{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=de(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:s}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const r=m=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Ot(m).point)},i=(m,f)=>{const{drag:g,dragPropagation:p,onDragStart:x}=this.getProps();if(g&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=nd(g),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),je(E=>{let b=this.getAxisMotionValue(E).get()||0;if(Re.test(b)){const{projection:S}=this.visualElement;if(S&&S.layout){const w=S.layout.layoutBox[E];w&&(b=we(w)*(parseFloat(b)/100))}}this.originPoint[E]=b}),x&&ie.postRender(()=>x(m,f)),as(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},l=(m,f)=>{this.latestPointerEvent=m,this.latestPanInfo=f;const{dragPropagation:g,dragDirectionLock:p,onDirectionLock:x,onDrag:v}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:E}=f;if(p&&this.currentDirection===null){this.currentDirection=Yu(E),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",f.point,E),this.updateAxis("y",f.point,E),this.visualElement.render(),v&&v(m,f)},c=(m,f)=>{this.latestPointerEvent=m,this.latestPanInfo=f,this.stop(m,f),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>je(m=>{var f;return this.getAnimationState(m)==="paused"&&((f=this.getAxisMotionValue(m).animation)==null?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new aa(t,{onSessionStart:r,onStart:i,onMove:l,onSessionEnd:c,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:s,contextWindow:ra(this.visualElement)})}stop(t,n){const s=t||this.latestPointerEvent,o=n||this.latestPanInfo,r=this.isDragging;if(this.cancel(),!r||!o||!s)return;const{velocity:i}=o;this.startAnimation(i);const{onDragEnd:l}=this.getProps();l&&ie.postRender(()=>l(s,o))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,s){const{drag:o}=this.getProps();if(!s||!Gt(t,o,this.currentDirection))return;const r=this.getAxisMotionValue(t);let i=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(i=_u(i,this.constraints[t],this.elastic[t])),r.set(i)}resolveConstraints(){var r;const{dragConstraints:t,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(r=this.visualElement.projection)==null?void 0:r.layout,o=this.constraints;t&&at(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&s?this.constraints=Hu(s.layoutBox,t):this.constraints=!1,this.elastic=Wu(n),o!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&je(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=Uu(s.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!at(t))return!1;const s=t.current;Oe(s!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const r=qd(s,o.root,this.visualElement.getTransformPagePoint());let i=zu(o.layout.layoutBox,r);if(n){const l=n(Kd(i));this.hasMutatedConstraints=!!l,l&&(i=Ur(l))}return i}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:o,dragTransition:r,dragSnapToOrigin:i,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},d=je(u=>{if(!Gt(u,n,this.currentDirection))return;let m=c&&c[u]||{};i&&(m={min:0,max:0});const f=o?200:1e6,g=o?40:1e7,p={type:"inertia",velocity:s?t[u]:0,bounceStiffness:f,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...r,...m};return this.startAxisValueAnimation(u,p)});return Promise.all(d).then(l)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return as(this.visualElement,t),s.start(qs(t,s,0,n,this.visualElement,!1))}stopAnimation(){je(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){je(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),o=s[n];return o||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){je(n=>{const{drag:s}=this.getProps();if(!Gt(n,s,this.currentDirection))return;const{projection:o}=this.visualElement,r=this.getAxisMotionValue(n);if(o&&o.layout){const{min:i,max:l}=o.layout.layoutBox[n];r.set(t[n]-le(i,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!at(n)||!s||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};je(i=>{const l=this.getAxisMotionValue(i);if(l&&this.constraints!==!1){const c=l.get();o[i]=Zu({min:c,max:c},this.constraints[i])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),je(i=>{if(!Gt(i,t,null))return;const l=this.getAxisMotionValue(i),{min:c,max:d}=this.constraints[i];l.set(le(c,d,o[i]))})}addListeners(){if(!this.visualElement.current)return;Ku.set(this.visualElement,this);const t=this.visualElement.current,n=Mt(t,"pointerdown",c=>{const{drag:d,dragListener:u=!0}=this.getProps();d&&u&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();at(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,r=o.addEventListener("measure",s);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),ie.read(s);const i=Ft(window,"resize",()=>this.scalePositionWithinConstraints()),l=o.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(je(u=>{const m=this.getAxisMotionValue(u);m&&(this.originPoint[u]+=c[u].translate,m.set(m.get()+c[u].translate))}),this.visualElement.render())});return()=>{i(),n(),r(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:o=!1,dragConstraints:r=!1,dragElastic:i=cs,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:o,dragConstraints:r,dragElastic:i,dragMomentum:l}}}function Gt(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Yu(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class qu extends Ke{constructor(t){super(t),this.removeGroupControls=Ae,this.removeListeners=Ae,this.controls=new Gu(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ae}unmount(){this.removeGroupControls(),this.removeListeners()}}const Xo=e=>(t,n)=>{e&&ie.postRender(()=>e(t,n))};class Xu extends Ke{constructor(){super(...arguments),this.removePointerDownListener=Ae}onPointerDown(t){this.session=new aa(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:ra(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:o}=this.node.getProps();return{onSessionStart:Xo(t),onStart:Xo(n),onMove:s,onEnd:(r,i)=>{delete this.session,o&&ie.postRender(()=>o(r,i))}}}mount(){this.removePointerDownListener=Mt(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const nn={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Jo(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const kt={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Z.test(e))e=parseFloat(e);else return e;const n=Jo(e,t.target.x),s=Jo(e,t.target.y);return`${n}% ${s}%`}},Ju={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,o=We.parse(e);if(o.length>5)return s;const r=We.createTransformer(e),i=typeof o[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;o[0+i]/=l,o[1+i]/=c;const d=le(l,c,.5);return typeof o[2+i]=="number"&&(o[2+i]/=d),typeof o[3+i]=="number"&&(o[3+i]/=d),r(o)}};let Nn=!1;class Qu extends y.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:o}=this.props,{projection:r}=t;wd(eh),r&&(n.group&&n.group.add(r),s&&s.register&&o&&s.register(r),Nn&&r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),nn.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:o,isPresent:r}=this.props,{projection:i}=s;return i&&(i.isPresent=r,Nn=!0,o||t.layoutDependency!==n||n===void 0||t.isPresent!==r?i.willUpdate():this.safeToRemove(),t.isPresent!==r&&(r?i.promote():i.relegate()||ie.postRender(()=>{const l=i.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),$s.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:o}=t;Nn=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),s&&s.deregister&&s.deregister(o))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function ca(e){const[t,n]=Nr(),s=y.useContext(xs);return a.jsx(Qu,{...e,layoutGroup:s,switchLayoutGroup:y.useContext(zr),isPresent:t,safeToRemove:n})}const eh={borderRadius:{...kt,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:kt,borderTopRightRadius:kt,borderBottomLeftRadius:kt,borderBottomRightRadius:kt,boxShadow:Ju};function th(e,t,n){const s=be(e)?e:mt(e);return s.start(qs("",s,t,n)),s.animation}const nh=(e,t)=>e.depth-t.depth;class sh{constructor(){this.children=[],this.isDirty=!1}add(t){vs(this.children,t),this.isDirty=!0}remove(t){ws(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(nh),this.isDirty=!1,this.children.forEach(t)}}function oh(e,t){const n=Se.now(),s=({timestamp:o})=>{const r=o-n;r>=t&&(Ue(s),e(r-t))};return ie.setup(s,!0),()=>Ue(s)}const da=["TopLeft","TopRight","BottomLeft","BottomRight"],ih=da.length,Qo=e=>typeof e=="string"?parseFloat(e):e,ei=e=>typeof e=="number"||Z.test(e);function rh(e,t,n,s,o,r){o?(e.opacity=le(0,n.opacity??1,ah(s)),e.opacityExit=le(t.opacity??1,0,lh(s))):r&&(e.opacity=le(t.opacity??1,n.opacity??1,s));for(let i=0;i<ih;i++){const l=`border${da[i]}Radius`;let c=ti(t,l),d=ti(n,l);if(c===void 0&&d===void 0)continue;c||(c=0),d||(d=0),c===0||d===0||ei(c)===ei(d)?(e[l]=Math.max(le(Qo(c),Qo(d),s),0),(Re.test(d)||Re.test(c))&&(e[l]+="%")):e[l]=d}(t.rotate||n.rotate)&&(e.rotate=le(t.rotate||0,n.rotate||0,s))}function ti(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const ah=ua(0,.5,Xi),lh=ua(.5,.95,Ae);function ua(e,t,n){return s=>s<e?0:s>t?1:n(Nt(e,t,s))}function ni(e,t){e.min=t.min,e.max=t.max}function ke(e,t){ni(e.x,t.x),ni(e.y,t.y)}function si(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function oi(e,t,n,s,o){return e-=t,e=dn(e,1/n,s),o!==void 0&&(e=dn(e,1/o,s)),e}function ch(e,t=0,n=1,s=.5,o,r=e,i=e){if(Re.test(t)&&(t=parseFloat(t),t=le(i.min,i.max,t/100)-i.min),typeof t!="number")return;let l=le(r.min,r.max,s);e===r&&(l-=t),e.min=oi(e.min,t,n,l,o),e.max=oi(e.max,t,n,l,o)}function ii(e,t,[n,s,o],r,i){ch(e,t[n],t[s],t[o],t.scale,r,i)}const dh=["x","scaleX","originX"],uh=["y","scaleY","originY"];function ri(e,t,n,s){ii(e.x,t,dh,n?n.x:void 0,s?s.x:void 0),ii(e.y,t,uh,n?n.y:void 0,s?s.y:void 0)}function ai(e){return e.translate===0&&e.scale===1}function ha(e){return ai(e.x)&&ai(e.y)}function li(e,t){return e.min===t.min&&e.max===t.max}function hh(e,t){return li(e.x,t.x)&&li(e.y,t.y)}function ci(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function ma(e,t){return ci(e.x,t.x)&&ci(e.y,t.y)}function di(e){return we(e.x)/we(e.y)}function ui(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class mh{constructor(){this.members=[]}add(t){vs(this.members,t),t.scheduleRender()}remove(t){if(ws(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(o=>t===o);if(n===0)return!1;let s;for(let o=n;o>=0;o--){const r=this.members[o];if(r.isPresent!==!1){s=r;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:o}=t.options;o===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function fh(e,t,n){let s="";const o=e.x.translate/t.x,r=e.y.translate/t.y,i=(n==null?void 0:n.z)||0;if((o||r||i)&&(s=`translate3d(${o}px, ${r}px, ${i}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:u,rotateX:m,rotateY:f,skewX:g,skewY:p}=n;d&&(s=`perspective(${d}px) ${s}`),u&&(s+=`rotate(${u}deg) `),m&&(s+=`rotateX(${m}deg) `),f&&(s+=`rotateY(${f}deg) `),g&&(s+=`skewX(${g}deg) `),p&&(s+=`skewY(${p}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(s+=`scale(${l}, ${c})`),s||"none"}const Pn=["","X","Y","Z"],gh=1e3;let ph=0;function Rn(e,t,n,s){const{latestValues:o}=t;o[e]&&(n[e]=o[e],t.setStaticValue(e,0),s&&(s[e]=0))}function fa(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Qr(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ie,!(o||r))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&fa(s)}function ga({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:o}){return class{constructor(i={},l=t==null?void 0:t()){this.id=ph++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(bh),this.nodes.forEach(Ch),this.nodes.forEach(kh),this.nodes.forEach(vh)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new sh)}addEventListener(i,l){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new Cs),this.eventHandlers.get(i).add(l)}notifyListeners(i,...l){const c=this.eventHandlers.get(i);c&&c.notify(...l)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=Vr(i)&&!ld(i),this.instance=i;const{layoutId:l,layout:c,visualElement:d}=this.options;if(d&&!d.current&&d.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),e){let u,m=0;const f=()=>this.root.updateBlockedByResize=!1;ie.read(()=>{m=window.innerWidth}),e(i,()=>{const g=window.innerWidth;g!==m&&(m=g,this.root.updateBlockedByResize=!0,u&&u(),u=oh(f,250),nn.hasAnimatedSinceResize&&(nn.hasAnimatedSinceResize=!1,this.nodes.forEach(fi)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||c)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:m,hasRelativeLayoutChanged:f,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const p=this.options.transition||d.getDefaultTransition()||Th,{onLayoutAnimationStart:x,onLayoutAnimationComplete:v}=d.getProps(),E=!this.targetLayout||!ma(this.targetLayout,g),b=!m&&f;if(this.options.layoutRoot||this.resumeFrom||b||m&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const S={...Ls(p,"layout"),onPlay:x,onComplete:v};(d.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S),this.setAnimationOrigin(u,b)}else m||fi(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Ue(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(jh),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&fa(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const m=this.path[u];m.shouldResetTransform=!0,m.updateScroll("snapshot"),m.options.layoutRoot&&m.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(hi);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(mi);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Sh),this.nodes.forEach(xh),this.nodes.forEach(yh)):this.nodes.forEach(mi),this.clearAllSnapshots();const l=Se.now();xe.delta=$e(0,1e3/60,l-xe.timestamp),xe.timestamp=l,xe.isProcessing=!0,wn.update.process(xe),wn.preRender.process(xe),wn.render.process(xe),xe.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,$s.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(wh),this.sharedNodes.forEach(Eh)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ie.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ie.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!we(this.snapshot.measuredBox.x)&&!we(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const i=this.layout;this.layout=this.measure(!1),this.layoutCorrected=de(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(l=!1),l&&this.instance){const c=s(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!o)return;const i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!ha(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,u=d!==this.prevTransformTemplateValue;i&&this.instance&&(l||qe(this.latestValues)||u)&&(o(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return i&&(c=this.removeTransform(c)),Vh(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:i}=this.options;if(!i)return de();const l=i.measureViewportBox();if(!(((d=this.scroll)==null?void 0:d.wasRoot)||this.path.some(Nh))){const{scroll:u}=this.root;u&&(lt(l.x,u.offset.x),lt(l.y,u.offset.y))}return l}removeElementScroll(i){var c;const l=de();if(ke(l,i),(c=this.scroll)!=null&&c.wasRoot)return l;for(let d=0;d<this.path.length;d++){const u=this.path[d],{scroll:m,options:f}=u;u!==this.root&&m&&f.layoutScroll&&(m.wasRoot&&ke(l,i),lt(l.x,m.offset.x),lt(l.y,m.offset.y))}return l}applyTransform(i,l=!1){const c=de();ke(c,i);for(let d=0;d<this.path.length;d++){const u=this.path[d];!l&&u.options.layoutScroll&&u.scroll&&u!==u.root&&ct(c,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),qe(u.latestValues)&&ct(c,u.latestValues)}return qe(this.latestValues)&&ct(c,this.latestValues),c}removeTransform(i){const l=de();ke(l,i);for(let c=0;c<this.path.length;c++){const d=this.path[c];if(!d.instance||!qe(d.latestValues))continue;ss(d.latestValues)&&d.updateSnapshot();const u=de(),m=d.measurePageBox();ke(u,m),ri(l,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,u)}return qe(this.latestValues)&&ri(l,this.latestValues),l}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options={...this.options,...i,crossfade:i.crossfade!==void 0?i.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==xe.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){var f;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(i||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(f=this.parent)!=null&&f.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:m}=this.options;if(!(!this.layout||!(u||m))){if(this.resolvedRelativeTargetAt=xe.timestamp,!this.targetDelta&&!this.relativeTarget){const g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=de(),this.relativeTargetOrigin=de(),Vt(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),ke(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=de(),this.targetWithTransforms=de()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Lu(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ke(this.target,this.layout.layoutBox),Kr(this.target,this.targetDelta)):ke(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const g=this.getClosestProjectingParent();g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=de(),this.relativeTargetOrigin=de(),Vt(this.relativeTargetOrigin,this.target,g.target),ke(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||ss(this.parent.latestValues)||Wr(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var p;const i=this.getLead(),l=!!this.resumingFrom||this!==i;let c=!0;if((this.isProjectionDirty||(p=this.parent)!=null&&p.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===xe.timestamp&&(c=!1),c)return;const{layout:d,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||u))return;ke(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,f=this.treeScale.y;Yd(this.layoutCorrected,this.treeScale,this.path,l),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=de());const{target:g}=i;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(si(this.prevProjectionDelta.x,this.projectionDelta.x),si(this.prevProjectionDelta.y,this.projectionDelta.y)),Tt(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==f||!ui(this.projectionDelta.x,this.prevProjectionDelta.x)||!ui(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),i){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=dt(),this.projectionDelta=dt(),this.projectionDeltaWithTransform=dt()}setAnimationOrigin(i,l=!1){const c=this.snapshot,d=c?c.latestValues:{},u={...this.latestValues},m=dt();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const f=de(),g=c?c.source:void 0,p=this.layout?this.layout.source:void 0,x=g!==p,v=this.getStack(),E=!v||v.members.length<=1,b=!!(x&&!E&&this.options.crossfade===!0&&!this.path.some(Mh));this.animationProgress=0;let S;this.mixTargetDelta=w=>{const C=w/1e3;gi(m.x,i.x,C),gi(m.y,i.y,C),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Vt(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Ah(this.relativeTarget,this.relativeTargetOrigin,f,C),S&&hh(this.relativeTarget,S)&&(this.isProjectionDirty=!1),S||(S=de()),ke(S,this.relativeTarget)),x&&(this.animationValues=u,rh(u,d,this.latestValues,C,b,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){var l,c,d;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(d=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||d.stop(),this.pendingAnimation&&(Ue(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ie.update(()=>{nn.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=mt(0)),this.currentAnimation=th(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),i.onUpdate&&i.onUpdate(u)},onStop:()=>{},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(gh),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:l,target:c,layout:d,latestValues:u}=i;if(!(!l||!c||!d)){if(this!==i&&this.layout&&d&&pa(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||de();const m=we(this.layout.layoutBox.x);c.x.min=i.target.x.min,c.x.max=c.x.min+m;const f=we(this.layout.layoutBox.y);c.y.min=i.target.y.min,c.y.max=c.y.min+f}ke(l,c),ct(l,u),Tt(this.projectionDeltaWithTransform,this.layoutCorrected,l,u)}}registerSharedNode(i,l){this.sharedNodes.has(i)||this.sharedNodes.set(i,new mh),this.sharedNodes.get(i).add(l);const d=l.options.initialPromotionConfig;l.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(l):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){var l;const{layoutId:i}=this.options;return i?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:i}=this.options;return i?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:l,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),i&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let l=!1;const{latestValues:c}=i;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const d={};c.z&&Rn("z",i,d,this.animationValues);for(let u=0;u<Pn.length;u++)Rn(`rotate${Pn[u]}`,i,d,this.animationValues),Rn(`skew${Pn[u]}`,i,d,this.animationValues);i.render();for(const u in d)i.setStaticValue(u,d[u]),this.animationValues&&(this.animationValues[u]=d[u]);i.scheduleRender()}applyProjectionStyles(i,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){i.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,i.visibility="",i.opacity="",i.pointerEvents=tn(l==null?void 0:l.pointerEvents)||"",i.transform=c?c(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(i.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,i.pointerEvents=tn(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!qe(this.latestValues)&&(i.transform=c?c({},""):"none",this.hasProjected=!1);return}i.visibility="";const u=d.animationValues||d.latestValues;this.applyTransformsToTarget();let m=fh(this.projectionDeltaWithTransform,this.treeScale,u);c&&(m=c(u,m)),i.transform=m;const{x:f,y:g}=this.projectionDelta;i.transformOrigin=`${f.origin*100}% ${g.origin*100}% 0`,d.animationValues?i.opacity=d===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:i.opacity=d===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const p in Dt){if(u[p]===void 0)continue;const{correct:x,applyTo:v,isCSSVariable:E}=Dt[p],b=m==="none"?u[p]:x(u[p],d);if(v){const S=v.length;for(let w=0;w<S;w++)i[v[w]]=b}else E?this.options.visualElement.renderState.vars[p]=b:i[p]=b}this.options.layoutId&&(i.pointerEvents=d===this?tn(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>{var l;return(l=i.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(hi),this.root.sharedNodes.clear()}}}function xh(e){e.updateLayout()}function yh(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:o}=e.layout,{animationType:r}=e.options,i=t.source!==e.layout.source;r==="size"?je(m=>{const f=i?t.measuredBox[m]:t.layoutBox[m],g=we(f);f.min=s[m].min,f.max=f.min+g}):pa(r,t.layoutBox,s)&&je(m=>{const f=i?t.measuredBox[m]:t.layoutBox[m],g=we(s[m]);f.max=f.min+g,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[m].max=e.relativeTarget[m].min+g)});const l=dt();Tt(l,s,t.layoutBox);const c=dt();i?Tt(c,e.applyTransform(o,!0),t.measuredBox):Tt(c,s,t.layoutBox);const d=!ha(l);let u=!1;if(!e.resumeFrom){const m=e.getClosestProjectingParent();if(m&&!m.resumeFrom){const{snapshot:f,layout:g}=m;if(f&&g){const p=de();Vt(p,t.layoutBox,f.layoutBox);const x=de();Vt(x,s,g.layoutBox),ma(p,x)||(u=!0),m.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=p,e.relativeParent=m)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:c,layoutDelta:l,hasLayoutChanged:d,hasRelativeLayoutChanged:u})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function bh(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function vh(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function wh(e){e.clearSnapshot()}function hi(e){e.clearMeasurements()}function mi(e){e.isLayoutDirty=!1}function Sh(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function fi(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Ch(e){e.resolveTargetDelta()}function kh(e){e.calcProjection()}function jh(e){e.resetSkewAndRotation()}function Eh(e){e.removeLeadSnapshot()}function gi(e,t,n){e.translate=le(t.translate,0,n),e.scale=le(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function pi(e,t,n,s){e.min=le(t.min,n.min,s),e.max=le(t.max,n.max,s)}function Ah(e,t,n,s){pi(e.x,t.x,n.x,s),pi(e.y,t.y,n.y,s)}function Mh(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const Th={duration:.45,ease:[.4,0,.1,1]},xi=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),yi=xi("applewebkit/")&&!xi("chrome/")?Math.round:Ae;function bi(e){e.min=yi(e.min),e.max=yi(e.max)}function Vh(e){bi(e.x),bi(e.y)}function pa(e,t,n){return e==="position"||e==="preserve-aspect"&&!Fu(di(t),di(n),.2)}function Nh(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const Ph=ga({attachResizeListener:(e,t)=>Ft(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),In={current:void 0},xa=ga({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!In.current){const e=new Ph({});e.mount(window),e.setOptions({layoutScroll:!0}),In.current=e}return In.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Rh={pan:{Feature:Xu},drag:{Feature:qu,ProjectionNode:xa,MeasureLayout:ca}};function vi(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,r=s[o];r&&ie.postRender(()=>r(t,Ot(t)))}class Ih extends Ke{mount(){const{current:t}=this.node;t&&(this.unmount=sd(t,(n,s)=>(vi(this.node,s,"Start"),o=>vi(this.node,o,"End"))))}unmount(){}}class Dh extends Ke{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Lt(Ft(this.node.current,"focus",()=>this.onFocus()),Ft(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function wi(e,t,n){const{props:s}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),r=s[o];r&&ie.postRender(()=>r(t,Ot(t)))}class Fh extends Ke{mount(){const{current:t}=this.node;t&&(this.unmount=ad(t,(n,s)=>(wi(this.node,s,"Start"),(o,{success:r})=>wi(this.node,o,r?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const ds=new WeakMap,Dn=new WeakMap,Lh=e=>{const t=ds.get(e.target);t&&t(e)},Bh=e=>{e.forEach(Lh)};function $h({root:e,...t}){const n=e||document;Dn.has(n)||Dn.set(n,{});const s=Dn.get(n),o=JSON.stringify(t);return s[o]||(s[o]=new IntersectionObserver(Bh,{root:e,...t})),s[o]}function Oh(e,t,n){const s=$h(t);return ds.set(e,n),s.observe(e),()=>{ds.delete(e),s.unobserve(e)}}const _h={some:0,all:1};class Hh extends Ke{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:o="some",once:r}=t,i={root:n?n.current:void 0,rootMargin:s,threshold:typeof o=="number"?o:_h[o]},l=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,r&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:u,onViewportLeave:m}=this.node.getProps(),f=d?u:m;f&&f(c)};return Oh(this.node.current,i,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(zh(t,n))&&this.startObserver()}unmount(){}}function zh({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Zh={inView:{Feature:Hh},tap:{Feature:Fh},focus:{Feature:Dh},hover:{Feature:Ih}},Uh={layout:{ProjectionNode:xa,MeasureLayout:ca}},Wh={...Vu,...Zh,...Rh,...Uh},Q=Wd(Wh,iu),Xs="-",Kh=e=>{const t=Yh(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:i=>{const l=i.split(Xs);return l[0]===""&&l.length!==1&&l.shift(),ya(l,t)||Gh(i)},getConflictingClassGroupIds:(i,l)=>{const c=n[i]||[];return l&&s[i]?[...c,...s[i]]:c}}},ya=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),o=s?ya(e.slice(1),s):void 0;if(o)return o;if(t.validators.length===0)return;const r=e.join(Xs);return(i=t.validators.find(({validator:l})=>l(r)))==null?void 0:i.classGroupId},Si=/^\[(.+)\]$/,Gh=e=>{if(Si.test(e)){const t=Si.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Yh=e=>{const{theme:t,classGroups:n}=e,s={nextPart:new Map,validators:[]};for(const o in n)us(n[o],s,o,t);return s},us=(e,t,n,s)=>{e.forEach(o=>{if(typeof o=="string"){const r=o===""?t:Ci(t,o);r.classGroupId=n;return}if(typeof o=="function"){if(qh(o)){us(o(s),t,n,s);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([r,i])=>{us(i,Ci(t,r),n,s)})})},Ci=(e,t)=>{let n=e;return t.split(Xs).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},qh=e=>e.isThemeGetter,Xh=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const o=(r,i)=>{n.set(r,i),t++,t>e&&(t=0,s=n,n=new Map)};return{get(r){let i=n.get(r);if(i!==void 0)return i;if((i=s.get(r))!==void 0)return o(r,i),i},set(r,i){n.has(r)?n.set(r,i):o(r,i)}}},hs="!",ms=":",Jh=ms.length,Qh=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=o=>{const r=[];let i=0,l=0,c=0,d;for(let p=0;p<o.length;p++){let x=o[p];if(i===0&&l===0){if(x===ms){r.push(o.slice(c,p)),c=p+Jh;continue}if(x==="/"){d=p;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const u=r.length===0?o:o.substring(c),m=em(u),f=m!==u,g=d&&d>c?d-c:void 0;return{modifiers:r,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:g}};if(t){const o=t+ms,r=s;s=i=>i.startsWith(o)?r(i.substring(o.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const o=s;s=r=>n({className:r,parseClassName:o})}return s},em=e=>e.endsWith(hs)?e.substring(0,e.length-1):e.startsWith(hs)?e.substring(1):e,tm=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const o=[];let r=[];return s.forEach(i=>{i[0]==="["||t[i]?(o.push(...r.sort(),i),r=[]):r.push(i)}),o.push(...r.sort()),o}},nm=e=>({cache:Xh(e.cacheSize),parseClassName:Qh(e),sortModifiers:tm(e),...Kh(e)}),sm=/\s+/,om=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o,sortModifiers:r}=t,i=[],l=e.trim().split(sm);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:m,modifiers:f,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:x}=n(u);if(m){c=u+(c.length>0?" "+c:c);continue}let v=!!x,E=s(v?p.substring(0,x):p);if(!E){if(!v){c=u+(c.length>0?" "+c:c);continue}if(E=s(p),!E){c=u+(c.length>0?" "+c:c);continue}v=!1}const b=r(f).join(":"),S=g?b+hs:b,w=S+E;if(i.includes(w))continue;i.push(w);const C=o(E,v);for(let A=0;A<C.length;++A){const j=C[A];i.push(S+j)}c=u+(c.length>0?" "+c:c)}return c};function im(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=ba(t))&&(s&&(s+=" "),s+=n);return s}const ba=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=ba(e[s]))&&(n&&(n+=" "),n+=t);return n};function rm(e,...t){let n,s,o,r=i;function i(c){const d=t.reduce((u,m)=>m(u),e());return n=nm(d),s=n.cache.get,o=n.cache.set,r=l,l(c)}function l(c){const d=s(c);if(d)return d;const u=om(c,n);return o(c,u),u}return function(){return r(im.apply(null,arguments))}}const pe=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},va=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,wa=/^\((?:(\w[\w-]*):)?(.+)\)$/i,am=/^\d+\/\d+$/,lm=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,cm=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,dm=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,um=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hm=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,st=e=>am.test(e),X=e=>!!e&&!Number.isNaN(Number(e)),ze=e=>!!e&&Number.isInteger(Number(e)),Fn=e=>e.endsWith("%")&&X(e.slice(0,-1)),Fe=e=>lm.test(e),mm=()=>!0,fm=e=>cm.test(e)&&!dm.test(e),Sa=()=>!1,gm=e=>um.test(e),pm=e=>hm.test(e),xm=e=>!N(e)&&!P(e),ym=e=>vt(e,ja,Sa),N=e=>va.test(e),Ye=e=>vt(e,Ea,fm),Ln=e=>vt(e,Cm,X),ki=e=>vt(e,Ca,Sa),bm=e=>vt(e,ka,pm),Yt=e=>vt(e,Aa,gm),P=e=>wa.test(e),jt=e=>wt(e,Ea),vm=e=>wt(e,km),ji=e=>wt(e,Ca),wm=e=>wt(e,ja),Sm=e=>wt(e,ka),qt=e=>wt(e,Aa,!0),vt=(e,t,n)=>{const s=va.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},wt=(e,t,n=!1)=>{const s=wa.exec(e);return s?s[1]?t(s[1]):n:!1},Ca=e=>e==="position"||e==="percentage",ka=e=>e==="image"||e==="url",ja=e=>e==="length"||e==="size"||e==="bg-size",Ea=e=>e==="length",Cm=e=>e==="number",km=e=>e==="family-name",Aa=e=>e==="shadow",jm=()=>{const e=pe("color"),t=pe("font"),n=pe("text"),s=pe("font-weight"),o=pe("tracking"),r=pe("leading"),i=pe("breakpoint"),l=pe("container"),c=pe("spacing"),d=pe("radius"),u=pe("shadow"),m=pe("inset-shadow"),f=pe("text-shadow"),g=pe("drop-shadow"),p=pe("blur"),x=pe("perspective"),v=pe("aspect"),E=pe("ease"),b=pe("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...w(),P,N],A=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],k=()=>[P,N,c],D=()=>[st,"full","auto",...k()],L=()=>[ze,"none","subgrid",P,N],W=()=>["auto",{span:["full",ze,P,N]},ze,P,N],H=()=>[ze,"auto",P,N],Ce=()=>["auto","min","max","fr",P,N],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],te=()=>["start","end","center","stretch","center-safe","end-safe"],se=()=>["auto",...k()],U=()=>[st,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],M=()=>[e,P,N],G=()=>[...w(),ji,ki,{position:[P,N]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",wm,ym,{size:[P,N]}],q=()=>[Fn,jt,Ye],T=()=>["","none","full",d,P,N],F=()=>["",X,jt,Ye],z=()=>["solid","dashed","dotted","double"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],R=()=>[X,Fn,ji,ki],_=()=>["","none",p,P,N],K=()=>["none",X,P,N],O=()=>["none",X,P,N],re=()=>[X,P,N],oe=()=>[st,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fe],breakpoint:[Fe],color:[mm],container:[Fe],"drop-shadow":[Fe],ease:["in","out","in-out"],font:[xm],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fe],shadow:[Fe],spacing:["px",X],text:[Fe],"text-shadow":[Fe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",st,N,P,v]}],container:["container"],columns:[{columns:[X,N,P,l]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{start:D()}],end:[{end:D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[ze,"auto",P,N]}],basis:[{basis:[st,"full","auto",l,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[X,st,"auto","initial","none",N]}],grow:[{grow:["",X,P,N]}],shrink:[{shrink:["",X,P,N]}],order:[{order:[ze,"first","last","none",P,N]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:W()}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:W()}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ce()}],"auto-rows":[{"auto-rows":Ce()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[...te(),"normal"]}],"justify-self":[{"justify-self":["auto",...te()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[...te(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...te(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...te(),"baseline"]}],"place-self":[{"place-self":["auto",...te()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:se()}],mx:[{mx:se()}],my:[{my:se()}],ms:[{ms:se()}],me:[{me:se()}],mt:[{mt:se()}],mr:[{mr:se()}],mb:[{mb:se()}],ml:[{ml:se()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[l,"screen",...U()]}],"min-w":[{"min-w":[l,"screen","none",...U()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",n,jt,Ye]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,P,Ln]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Fn,N]}],"font-family":[{font:[vm,N,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,P,N]}],"line-clamp":[{"line-clamp":[X,"none",P,Ln]}],leading:[{leading:[r,...k()]}],"list-image":[{"list-image":["none",P,N]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",P,N]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...z(),"wavy"]}],"text-decoration-thickness":[{decoration:[X,"from-font","auto",P,Ye]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[X,"auto",P,N]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",P,N]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",P,N]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ze,P,N],radial:["",P,N],conic:[ze,P,N]},Sm,bm]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:T()}],"rounded-s":[{"rounded-s":T()}],"rounded-e":[{"rounded-e":T()}],"rounded-t":[{"rounded-t":T()}],"rounded-r":[{"rounded-r":T()}],"rounded-b":[{"rounded-b":T()}],"rounded-l":[{"rounded-l":T()}],"rounded-ss":[{"rounded-ss":T()}],"rounded-se":[{"rounded-se":T()}],"rounded-ee":[{"rounded-ee":T()}],"rounded-es":[{"rounded-es":T()}],"rounded-tl":[{"rounded-tl":T()}],"rounded-tr":[{"rounded-tr":T()}],"rounded-br":[{"rounded-br":T()}],"rounded-bl":[{"rounded-bl":T()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...z(),"hidden","none"]}],"divide-style":[{divide:[...z(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[X,P,N]}],"outline-w":[{outline:["",X,jt,Ye]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",u,qt,Yt]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",m,qt,Yt]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[X,Ye]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",f,qt,Yt]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[X,P,N]}],"mix-blend":[{"mix-blend":[...B(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":B()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[X]}],"mask-image-linear-from-pos":[{"mask-linear-from":R()}],"mask-image-linear-to-pos":[{"mask-linear-to":R()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":R()}],"mask-image-t-to-pos":[{"mask-t-to":R()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":R()}],"mask-image-r-to-pos":[{"mask-r-to":R()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":R()}],"mask-image-b-to-pos":[{"mask-b-to":R()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":R()}],"mask-image-l-to-pos":[{"mask-l-to":R()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":R()}],"mask-image-x-to-pos":[{"mask-x-to":R()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":R()}],"mask-image-y-to-pos":[{"mask-y-to":R()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[P,N]}],"mask-image-radial-from-pos":[{"mask-radial-from":R()}],"mask-image-radial-to-pos":[{"mask-radial-to":R()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[X]}],"mask-image-conic-from-pos":[{"mask-conic-from":R()}],"mask-image-conic-to-pos":[{"mask-conic-to":R()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",P,N]}],filter:[{filter:["","none",P,N]}],blur:[{blur:_()}],brightness:[{brightness:[X,P,N]}],contrast:[{contrast:[X,P,N]}],"drop-shadow":[{"drop-shadow":["","none",g,qt,Yt]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",X,P,N]}],"hue-rotate":[{"hue-rotate":[X,P,N]}],invert:[{invert:["",X,P,N]}],saturate:[{saturate:[X,P,N]}],sepia:[{sepia:["",X,P,N]}],"backdrop-filter":[{"backdrop-filter":["","none",P,N]}],"backdrop-blur":[{"backdrop-blur":_()}],"backdrop-brightness":[{"backdrop-brightness":[X,P,N]}],"backdrop-contrast":[{"backdrop-contrast":[X,P,N]}],"backdrop-grayscale":[{"backdrop-grayscale":["",X,P,N]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[X,P,N]}],"backdrop-invert":[{"backdrop-invert":["",X,P,N]}],"backdrop-opacity":[{"backdrop-opacity":[X,P,N]}],"backdrop-saturate":[{"backdrop-saturate":[X,P,N]}],"backdrop-sepia":[{"backdrop-sepia":["",X,P,N]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",P,N]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[X,"initial",P,N]}],ease:[{ease:["linear","initial",E,P,N]}],delay:[{delay:[X,P,N]}],animate:[{animate:["none",b,P,N]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,P,N]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:K()}],"rotate-x":[{"rotate-x":K()}],"rotate-y":[{"rotate-y":K()}],"rotate-z":[{"rotate-z":K()}],scale:[{scale:O()}],"scale-x":[{"scale-x":O()}],"scale-y":[{"scale-y":O()}],"scale-z":[{"scale-z":O()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[P,N,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",P,N]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",P,N]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[X,jt,Ye,Ln]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Em=rm(jm);function $(...e){return Em(dl.clsx(e))}function Am(e,t){return{id:e.streamInfo.id,timestamp:e.streamInfo.timestamp,message:e.text,from:e.participantInfo.identity===t.localParticipant.identity?t.localParticipant:Array.from(t.remoteParticipants.values()).find(n=>n.identity===e.participantInfo.identity)}}const Mm=un.cva(["relative w-full rounded-lg border px-4 py-3 text-sm grid grid-cols-[0_1fr] gap-y-0.5 items-start","has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current"],{variants:{variant:{default:"bg-card text-card-foreground",destructive:["text-destructive-foreground bg-destructive border-destructive-border","[&>svg]:text-current *:data-[slot=alert-description]:text-destructive-foreground/90"]}},defaultVariants:{variant:"default"}});function Tm({className:e,variant:t,...n}){return a.jsx("div",{"data-slot":"alert",role:"alert",className:$(Mm({variant:t}),e),...n})}function Vm({className:e,...t}){return a.jsx("div",{"data-slot":"alert-title",className:$("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function Nm({className:e,...t}){return a.jsx("div",{"data-slot":"alert-description",className:$("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function Xt(e){return $i.toast.custom(t=>a.jsx(Pm,{id:t,title:e.title,description:e.description}),{duration:1e4})}function Pm(e){const{title:t,id:n,description:s}=e;return a.jsxs(Tm,{onClick:()=>$i.toast.dismiss(n),className:"bg-gradient-to-br from-[#181825] to-[#232336] border border-[#232336] shadow-lg shadow-black/40 rounded-xl px-4 py-3 flex items-start gap-3 hover:shadow-xl transition-all duration-200",style:{color:"#F3F4F6"},children:[a.jsx(cl.WarningIcon,{weight:"bold",className:"text-yellow-400 mt-1 flex-shrink-0",size:24}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx(Vm,{className:"text-base font-semibold text-white mb-1",children:t}),a.jsx(Nm,{className:"text-sm text-gray-300 leading-snug",children:s})]})]})}const Ne=h.forwardRef((e,t)=>{const{alt:n,color:s="currentColor",size:o="1em",weight:r="regular",mirrored:i=!1,children:l,weights:c,...d}=e;return h.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,fill:s,viewBox:"0 0 256 256",transform:i?"scale(-1, 1)":void 0,...d},!!n&&h.createElement("title",null,n),l,c.get(r))});Ne.displayName="SSRBase";const Rm=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),h.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),Js=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Rm}));Js.displayName="CaretDownIcon";const Im=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),h.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),Ma=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Im}));Ma.displayName="CaretUpIcon";const Dm=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216,44H40A20,20,0,0,0,20,64V224A19.82,19.82,0,0,0,31.56,242.1a20.14,20.14,0,0,0,8.49,1.9,19.91,19.91,0,0,0,12.82-4.72l.12-.11L84.47,212H216a20,20,0,0,0,20-20V64A20,20,0,0,0,216,44Zm-4,144H80a11.93,11.93,0,0,0-7.84,2.92L44,215.23V68H212ZM84,108A12,12,0,0,1,96,96h64a12,12,0,1,1,0,24H96A12,12,0,0,1,84,108Zm0,40a12,12,0,0,1,12-12h64a12,12,0,0,1,0,24H96A12,12,0,0,1,84,148Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M224,64V192a8,8,0,0,1-8,8H80L45.15,230.11A8,8,0,0,1,32,224V64a8,8,0,0,1,8-8H216A8,8,0,0,1,224,64Z",opacity:"0.2"}),h.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.84,15.84,0,0,0,9.25,14.5A16.05,16.05,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM160,152H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216,50H40A14,14,0,0,0,26,64V224a13.88,13.88,0,0,0,8.09,12.69A14.11,14.11,0,0,0,40,238a13.87,13.87,0,0,0,9-3.31l.06-.05L82.23,206H216a14,14,0,0,0,14-14V64A14,14,0,0,0,216,50Zm2,142a2,2,0,0,1-2,2H80a6,6,0,0,0-3.92,1.46L41.26,225.53A2,2,0,0,1,38,224V64a2,2,0,0,1,2-2H216a2,2,0,0,1,2,2Zm-52-80a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,144Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216,52H40A12,12,0,0,0,28,64V224a11.89,11.89,0,0,0,6.93,10.88A12.17,12.17,0,0,0,40,236a11.89,11.89,0,0,0,7.69-2.83l0,0L81.49,204H216a12,12,0,0,0,12-12V64A12,12,0,0,0,216,52Zm4,140a4,4,0,0,1-4,4H80a4,4,0,0,0-2.62,1L42.56,227.06A4,4,0,0,1,36,224V64a4,4,0,0,1,4-4H216a4,4,0,0,1,4,4Zm-56-80a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,144Z"}))]]),Ta=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Dm}));Ta.displayName="ChatTextIcon";const Fm=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),h.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),Va=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Fm}));Va.displayName="CheckIcon";const Lm=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M128,180a52.06,52.06,0,0,0,52-52V64A52,52,0,0,0,76,64v64A52.06,52.06,0,0,0,128,180ZM100,64a28,28,0,0,1,56,0v64a28,28,0,0,1-56,0Zm40,155.22V240a12,12,0,0,1-24,0V219.22A92.14,92.14,0,0,1,36,128a12,12,0,0,1,24,0,68,68,0,0,0,136,0,12,12,0,0,1,24,0A92.14,92.14,0,0,1,140,219.22Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),h.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M80,128V64a48,48,0,0,1,96,0v64a48,48,0,0,1-96,0Zm128,0a8,8,0,0,0-16,0,64,64,0,0,1-128,0,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.6A80.11,80.11,0,0,0,208,128Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M128,174a46.06,46.06,0,0,0,46-46V64a46,46,0,0,0-92,0v64A46.06,46.06,0,0,0,128,174ZM94,64a34,34,0,0,1,68,0v64a34,34,0,0,1-68,0Zm40,141.75V240a6,6,0,0,1-12,0V205.75A78.09,78.09,0,0,1,50,128a6,6,0,0,1,12,0,66,66,0,0,0,132,0,6,6,0,0,1,12,0A78.09,78.09,0,0,1,134,205.75Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M128,172a44.05,44.05,0,0,0,44-44V64a44,44,0,0,0-88,0v64A44.05,44.05,0,0,0,128,172ZM92,64a36,36,0,0,1,72,0v64a36,36,0,0,1-72,0Zm40,139.89V240a4,4,0,0,1-8,0V203.89A76.09,76.09,0,0,1,52,128a4,4,0,0,1,8,0,68,68,0,0,0,136,0,4,4,0,0,1,8,0A76.09,76.09,0,0,1,132,203.89Z"}))]]),Na=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Lm}));Na.displayName="MicrophoneIcon";const Bm=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M56.88,39.93A12,12,0,1,0,39.12,56.07L76,96.64V128a52,52,0,0,0,72.11,48l11.26,12.39A67.34,67.34,0,0,1,128,196a68.07,68.07,0,0,1-68-68,12,12,0,0,0-24,0,92.14,92.14,0,0,0,80,91.22V240a12,12,0,0,0,24,0V219.23a90.39,90.39,0,0,0,35.92-12.68l23.2,25.52a12,12,0,0,0,17.76-16.14ZM128,156a28,28,0,0,1-28-28v-5l29.9,32.89C129.27,156,128.64,156,128,156Zm63-2.42A67.63,67.63,0,0,0,196,128a12,12,0,0,1,24,0,91.48,91.48,0,0,1-6.74,34.61,12,12,0,0,1-22.23-9ZM85.7,33.75A52,52,0,0,1,180,64v56.54a12,12,0,0,1-24,0V64a28,28,0,0,0-50.79-16.28,12,12,0,0,1-19.51-14Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),h.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M213.38,229.92a8,8,0,0,1-11.3-.54l-30.92-34A78.83,78.83,0,0,1,136,207.59V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64.07,64.07,0,0,0,64,64,63.41,63.41,0,0,0,32.21-8.68l-11.1-12.2A48,48,0,0,1,80,128V95.09L42.08,53.38A8,8,0,0,1,53.92,42.62l160,176A8,8,0,0,1,213.38,229.92Zm-24.19-63.13a7.88,7.88,0,0,0,3.51.82,8,8,0,0,0,7.19-4.49A79.16,79.16,0,0,0,208,128a8,8,0,0,0-16,0,63.32,63.32,0,0,1-6.48,28.09A8,8,0,0,0,189.19,166.79Zm-27.33-29.22A8,8,0,0,0,175.74,133a49.49,49.49,0,0,0,.26-5V64A48,48,0,0,0,84,44.87a8,8,0,0,0,1.41,8.57Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M212.44,220,52.44,44A6,6,0,0,0,43.56,52L82,94.32V128a46,46,0,0,0,67.56,40.64l13.75,15.12A65.26,65.26,0,0,1,128,194a66.08,66.08,0,0,1-66-66,6,6,0,0,0-12,0,78.09,78.09,0,0,0,72,77.75V240a6,6,0,0,0,12,0V205.77a76.93,76.93,0,0,0,37.48-13L203.56,228a6,6,0,0,0,8.88-8.08ZM128,162a34,34,0,0,1-34-34V107.52l47.12,51.84A33.82,33.82,0,0,1,128,162Zm59.32-5A65.38,65.38,0,0,0,194,128a6,6,0,0,1,12,0,77.33,77.33,0,0,1-7.9,34.25A6,6,0,1,1,187.32,157ZM85.8,45.67A46,46,0,0,1,174,64v64a45.17,45.17,0,0,1-.25,4.81,6,6,0,0,1-6,5.38q-.31,0-.63,0a6,6,0,0,1-5.34-6.59A35.41,35.41,0,0,0,162,128V64A34,34,0,0,0,96.8,50.45a6,6,0,0,1-11-4.78Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M211,221.31,51,45.31A4,4,0,0,0,45,50.69L84,93.55V128a44,44,0,0,0,66,38.12l16.38,18A67.21,67.21,0,0,1,128,196a68.07,68.07,0,0,1-68-68,4,4,0,0,0-8,0,76.09,76.09,0,0,0,72,75.89V240a4,4,0,0,0,8,0V203.89a75.1,75.1,0,0,0,39.79-13.77L205,226.69a4,4,0,1,0,5.92-5.38ZM128,164a36,36,0,0,1-36-36V102.35L144.43,160A35.83,35.83,0,0,1,128,164Zm61.12-6.15A67.44,67.44,0,0,0,196,128a4,4,0,0,1,8,0,75.28,75.28,0,0,1-7.7,33.37,4,4,0,0,1-7.18-3.52ZM87.63,46.46A44,44,0,0,1,172,64v64a44.2,44.2,0,0,1-.24,4.61,4,4,0,0,1-4,3.58l-.42,0a4,4,0,0,1-3.57-4.39A36.67,36.67,0,0,0,164,128V64A36,36,0,0,0,95,49.66a4,4,0,0,1-7.34-3.2Z"}))]]),Pa=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Bm}));Pa.displayName="MicrophoneSlashIcon";const $m=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,36H48A28,28,0,0,0,20,64V176a28,28,0,0,0,28,28H208a28,28,0,0,0,28-28V64A28,28,0,0,0,208,36Zm4,140a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-40,52a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,228ZM160.49,103.51a12,12,0,0,1-17,17L140,117v35a12,12,0,0,1-24,0V117l-3.51,3.52a12,12,0,0,1-17-17l24-24a12,12,0,0,1,17,0Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M224,64V176a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V64A16,16,0,0,1,48,48H208A16,16,0,0,1,224,64Z",opacity:"0.2"}),h.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M168,224a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM232,64V176a24,24,0,0,1-24,24H48a24,24,0,0,1-24-24V64A24,24,0,0,1,48,40H208A24,24,0,0,1,232,64Zm-74.34,42.34-24-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,11.32,11.32L120,107.31V152a8,8,0,0,0,16,0V107.31l10.34,10.35a8,8,0,0,0,11.32-11.32Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,42H48A22,22,0,0,0,26,64V176a22,22,0,0,0,22,22H208a22,22,0,0,0,22-22V64A22,22,0,0,0,208,42Zm10,134a10,10,0,0,1-10,10H48a10,10,0,0,1-10-10V64A10,10,0,0,1,48,54H208a10,10,0,0,1,10,10Zm-52,48a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,224Zm-9.76-116.24a6,6,0,1,1-8.48,8.48L134,102.49V152a6,6,0,0,1-12,0V102.49l-13.76,13.75a6,6,0,0,1-8.48-8.48l24-24a6,6,0,0,1,8.48,0Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,44H48A20,20,0,0,0,28,64V176a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V64A20,20,0,0,0,208,44Zm12,132a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V64A12,12,0,0,1,48,52H208a12,12,0,0,1,12,12Zm-56,48a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,224Zm-9.17-114.83a4,4,0,0,1-5.66,5.66L132,97.66V152a4,4,0,0,1-8,0V97.66l-17.17,17.17a4,4,0,0,1-5.66-5.66l24-24a4,4,0,0,1,5.66,0Z"}))]]),Ra=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:$m}));Ra.displayName="MonitorArrowUpIcon";const Om=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm33.25,62.75a12,12,0,0,0,8.49-3.52L204.37,68.6a12,12,0,0,0-17-17L164.77,74.26a12,12,0,0,0,8.48,20.49ZM224,116H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),h.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm33.94,58.75,17-17a8,8,0,0,1,11.32,11.32l-17,17a8,8,0,0,1-11.31-11.31ZM48,136a8,8,0,0,1,0-16H72a8,8,0,0,1,0,16Zm46.06,37.25-17,17a8,8,0,0,1-11.32-11.32l17-17a8,8,0,0,1,11.31,11.31Zm0-79.19a8,8,0,0,1-11.31,0l-17-17A8,8,0,0,1,77.09,65.77l17,17A8,8,0,0,1,94.06,94.06ZM136,208a8,8,0,0,1-16,0V184a8,8,0,0,1,16,0Zm0-136a8,8,0,0,1-16,0V48a8,8,0,0,1,16,0Zm54.23,118.23a8,8,0,0,1-11.32,0l-17-17a8,8,0,0,1,11.31-11.31l17,17A8,8,0,0,1,190.23,190.23ZM208,136H184a8,8,0,0,1,0-16h24a8,8,0,0,1,0,16Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M134,32V64a6,6,0,0,1-12,0V32a6,6,0,0,1,12,0Zm39.25,56.75A6,6,0,0,0,177.5,87l22.62-22.63a6,6,0,0,0-8.48-8.48L169,78.5a6,6,0,0,0,4.24,10.25ZM224,122H192a6,6,0,0,0,0,12h32a6,6,0,0,0,0-12Zm-46.5,47A6,6,0,0,0,169,177.5l22.63,22.62a6,6,0,0,0,8.48-8.48ZM128,186a6,6,0,0,0-6,6v32a6,6,0,0,0,12,0V192A6,6,0,0,0,128,186ZM78.5,169,55.88,191.64a6,6,0,1,0,8.48,8.48L87,177.5A6,6,0,1,0,78.5,169ZM70,128a6,6,0,0,0-6-6H32a6,6,0,0,0,0,12H64A6,6,0,0,0,70,128ZM64.36,55.88a6,6,0,0,0-8.48,8.48L78.5,87A6,6,0,1,0,87,78.5Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M132,32V64a4,4,0,0,1-8,0V32a4,4,0,0,1,8,0Zm41.25,54.75a4,4,0,0,0,2.83-1.18L198.71,63a4,4,0,0,0-5.66-5.66L170.43,79.92a4,4,0,0,0,2.82,6.83ZM224,124H192a4,4,0,0,0,0,8h32a4,4,0,0,0,0-8Zm-47.92,46.43a4,4,0,1,0-5.65,5.65l22.62,22.63a4,4,0,0,0,5.66-5.66ZM128,188a4,4,0,0,0-4,4v32a4,4,0,0,0,8,0V192A4,4,0,0,0,128,188ZM79.92,170.43,57.29,193.05A4,4,0,0,0,63,198.71l22.62-22.63a4,4,0,1,0-5.65-5.65ZM68,128a4,4,0,0,0-4-4H32a4,4,0,0,0,0,8H64A4,4,0,0,0,68,128ZM63,57.29A4,4,0,0,0,57.29,63L79.92,85.57a4,4,0,1,0,5.65-5.65Z"}))]]),Qs=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Om}));Qs.displayName="SpinnerIcon";const _m=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V167.57l24.94,18.14A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM188,180H36V76H188Zm44-27.57-20-14.54V118.11l20-14.54Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),h.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M192,72V184a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V72A16,16,0,0,1,32,56H176A16,16,0,0,1,192,72Zm58,.25a8.23,8.23,0,0,0-6.63,1.22L209.78,95.86A4,4,0,0,0,208,99.19v57.62a4,4,0,0,0,1.78,3.33l33.78,22.52a8,8,0,0,0,8.58.19,8.33,8.33,0,0,0,3.86-7.17V80A8,8,0,0,0,250,72.25Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V155.21L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM194,184a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H192a2,2,0,0,1,2,2Zm48-19.21-36-24V115.21l36-24Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V151.47l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM196,184a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H192a4,4,0,0,1,4,4Zm48-15.47-40-26.67V114.14l40-26.67Z"}))]]),Ia=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:_m}));Ia.displayName="VideoCameraIcon";const Hm=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H123.88a12,12,0,0,0,0,24H188v68a12,12,0,0,0,4.46,9.33c.15.13.31.25.48.38l44,32A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM232,152.43l-20-14.54V118.11l20-14.54ZM56.88,31.93A12,12,0,1,0,39.12,48.07L42.69,52H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H180.87l18.25,20.07a12,12,0,0,0,17.76-16.14ZM36,180V76H64.51l94.55,104Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),h.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M256,80.23v95.45a8.33,8.33,0,0,1-3.86,7.17,8,8,0,0,1-8.58-.19l-33.78-22.52a4,4,0,0,1-1.78-3.33V99.19a4,4,0,0,1,1.78-3.32l33.78-22.53a8,8,0,0,1,9.73.66A8.23,8.23,0,0,1,256,80.23ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM185,155.07a4,4,0,0,0,7-2.7V72a16,16,0,0,0-16-16H104a4,4,0,0,0-3,6.69Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H113.06a6,6,0,0,0,0,12H192a2,2,0,0,1,2,2v87.63a6,6,0,0,0,12,0v-4.42L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM242,164.79l-36-24V115.21l36-24ZM52.44,36A6,6,0,0,0,43.56,44L56.25,58H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H183.53l20,22a6,6,0,0,0,8.88-8.08ZM32,186a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H67.16L172.62,186Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H113.06a4,4,0,0,0,0,8H192a4,4,0,0,1,4,4v87.63a4,4,0,0,0,8,0v-8.16l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM244,168.53l-40-26.67V114.14l40-26.67ZM51,37.31A4,4,0,0,0,45,42.69L60.78,60H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H184.41L205,218.69a4,4,0,1,0,5.92-5.38ZM32,188a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H68.05L177.14,188Z"}))]]),Da=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Hm}));Da.displayName="VideoCameraSlashIcon";function Ei(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function zm(...e){return t=>{let n=!1;const s=e.map(o=>{const r=Ei(o,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let o=0;o<s.length;o++){const r=s[o];typeof r=="function"?r():Ei(e[o],null)}}}}function Zm(e){const t=Wm(e),n=h.forwardRef((s,o)=>{const{children:r,...i}=s,l=h.Children.toArray(r),c=l.find(Gm);if(c){const d=c.props.children,u=l.map(m=>m===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:m);return a.jsx(t,{...i,ref:o,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return a.jsx(t,{...i,ref:o,children:r})});return n.displayName=`${e}.Slot`,n}var Um=Zm("Slot");function Wm(e){const t=h.forwardRef((n,s)=>{const{children:o,...r}=n;if(h.isValidElement(o)){const i=qm(o),l=Ym(r,o.props);return o.type!==h.Fragment&&(l.ref=s?zm(s,i):i),h.cloneElement(o,l)}return h.Children.count(o)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Km=Symbol("radix.slottable");function Gm(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Km}function Ym(e,t){const n={...t};for(const s in t){const o=e[s],r=t[s];/^on[A-Z]/.test(s)?o&&r?n[s]=(...l)=>{const c=r(...l);return o(...l),c}:o&&(n[s]=o):s==="style"?n[s]={...o,...r}:s==="className"&&(n[s]=[o,r].filter(Boolean).join(" "))}return{...e,...n}}function qm(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Xm=un.cva(["text-xs font-bold tracking-wider uppercase whitespace-nowrap","inline-flex items-center justify-center gap-2 shrink-0 rounded-full cursor-pointer outline-none transition-colors duration-300","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","disabled:pointer-events-none disabled:opacity-50","aria-invalid:ring-destructive/20 aria-invalid:border-destructive dark:aria-invalid:ring-destructive/40 ","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button text-button-foreground hover:bg-muted focus:bg-muted",destructive:["bg-destructive text-destructive-foreground","hover:bg-destructive-hover focus:bg-destructive-hover focus-visible:ring-destructive-foreground/20","dark:focus-visible:ring-destructive-foreground/40"],outline:["border bg-background","hover:bg-accent hover:text-accent-foreground","dark:bg-input/30 dark:border-input dark:hover:bg-input/50"],primary:"",secondary:"bg-secondary text-secondary-foregroun hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Jm({className:e,variant:t,size:n,asChild:s=!1,...o}){const r=s?Um:"button";return a.jsx(r,{"data-slot":"button",className:$(Xm({variant:t,size:n,className:e})),...o})}function Qm({onSend:e,className:t,disabled:n,...s}){const o=y.useRef(null),[r,i]=y.useState(""),l=d=>{var u,m;d.preventDefault(),(u=s.onSubmit)==null||u.call(s,d),e==null||e(r),i(""),(m=o.current)==null||m.focus({preventScroll:!0})},c=n||r.trim().length===0;return a.jsxs("form",{...s,onSubmit:l,className:$("flex items-center rounded-md pl-1 text-sm",t),children:[a.jsx("input",{ref:o,type:"text",className:"flex-1 focus:outline-none",placeholder:"Type something...",value:r,onChange:d=>i(d.target.value),disabled:n}),a.jsx(Jm,{size:"sm",type:"submit",variant:c?"secondary":"primary",disabled:c,className:"font-mono",children:"SEND"})]})}const ef=un.cva(["inline-flex items-center justify-center gap-2 rounded-full","text-sm font-medium whitespace-nowrap","cursor-pointer outline-none transition-[color,border,background-color]","!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 aria-invalid:border-0","disabled:pointer-events-none disabled:opacity-50 disabled:not-allowed","data-[state=on]:bg-button-selected data-[state=on]:border-button-border-selected","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button hover:bg-muted focus:bg-muted hover:text-muted-foreground focus:text-muted-foreground",primary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=off]:bg-button-primary hover:data-[state=off]:bg-button-hover data-[state=off]:text-button-primary-foreground",secondary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=on]:bg-button-secondary hover:data-[state=on]:bg-button-secondary data-[state=on]:text-button-secondary-foreground",outline:["border border-button-border bg-button text-button-foreground","hover:bg-background focus:bg-background"]},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function Fa({className:e,variant:t,size:n,...s}){return a.jsx(fl.Root,{"data-slot":"toggle",className:$(ef({variant:t,size:n,className:e})),...s})}function tf(e){const[t,n]=y.useState(()=>e.getPublishPermissions());return y.useEffect(()=>{const s=()=>{n(e.getPublishPermissions())},o=()=>{s()};return e.on("connection.connected",o),e.on("connection.disconnected",o),()=>{e.off("connection.connected",o),e.off("connection.disconnected",o)}},[e]),t}function nf(e){const[t,n]=y.useState(()=>e.getLocalParticipant()),[s,o]=y.useState(()=>e.getMicrophoneTrack());return y.useEffect(()=>{const r=()=>{const l=e.getLocalParticipant(),c=e.getMicrophoneTrack();console.log("🎤 useVoxketLocalParticipant: Updating state:",{hasParticipant:!!l,hasMicTrack:!!c,isMicEnabled:e.isMicrophoneEnabled,trackPublications:l?l.trackPublications.size:0}),n(l),o(c)};r(),e.on("connection.connected",r),e.on("connection.disconnected",r),e.on("track.muted",r),e.on("track.unmuted",r);const i=e.getRoom();if(i){const l=()=>{console.log("🎤 Track published, updating participant state"),r()},c=()=>{console.log("🎤 Track unpublished, updating participant state"),r()};return i.on("localTrackPublished",l),i.on("localTrackUnpublished",c),()=>{e.off("connection.connected",r),e.off("connection.disconnected",r),e.off("track.muted",r),e.off("track.unmuted",r),i.off("localTrackPublished",l),i.off("localTrackUnpublished",c)}}else return()=>{e.off("connection.connected",r),e.off("connection.disconnected",r),e.off("track.muted",r),e.off("track.unmuted",r)}},[e]),{localParticipant:t,microphoneTrack:s}}function Bn(e,t,n){const[s,o]=y.useState(!1),[r,i]=y.useState(!1);return y.useEffect(()=>{const c=()=>{let d=!1;switch(t){case"microphone":d=e.isMicrophoneEnabled;break;case"camera":d=e.isCameraEnabled;break;case"screenShare":d=e.isScreenShareEnabled;break}console.log(`useVoxketTrackToggle: ${t} enabled state updated to:`,d),o(d)};return c(),e.on("track.muted",c),e.on("track.unmuted",c),e.on("connection.connected",c),()=>{e.off("track.muted",c),e.off("track.unmuted",c),e.off("connection.connected",c)}},[e,t]),{enabled:s,pending:r,toggle:async c=>{var d;try{i(!0);const u=c!==void 0?c:!s;switch(t){case"microphone":await e.toggleMicrophone(u);break;case"camera":await e.toggleCamera(u);break;case"screenShare":u?await e.startScreenShare():await e.stopScreenShare();break}}catch(u){(d=n==null?void 0:n.onDeviceError)==null||d.call(n,u)}finally{i(!1)}}}}function sf(e){const[t,n]=y.useState(()=>e.getRoom()),[s,o]=y.useState(()=>e.getConnectionState());return y.useEffect(()=>{const r=()=>{n(e.getRoom()),o(e.getConnectionState())};return e.on("connection.connected",r),e.on("connection.disconnected",r),e.on("connection.connecting",r),()=>{e.off("connection.connected",r),e.off("connection.disconnected",r),e.off("connection.connecting",r)}},[e]),t}function of(e,t){const[n,s]=y.useState([]),[o,r]=y.useState("");return y.useEffect(()=>{var d;const l=async()=>{try{const u=t==="audioinput"?await e.getAudioInputDevices():await e.getVideoInputDevices();s(u)}catch(u){console.error("Failed to load devices:",u)}};l();const c=()=>{l()};return(d=navigator.mediaDevices)==null||d.addEventListener("devicechange",c),()=>{var u;(u=navigator.mediaDevices)==null||u.removeEventListener("devicechange",c)}},[e,t]),{devices:n,activeDeviceId:o,setActiveMediaDevice:async l=>{try{t==="audioinput"?await e.setAudioInputDevice(l):await e.setVideoInputDevice(l),r(l)}catch(c){console.error("Failed to set device:",c)}}}}function rf(e){const{preventSave:t=!1}=e||{};return{saveAudioInputEnabled:i=>{t||localStorage.setItem("voxket-audio-input-enabled",i.toString())},saveAudioInputDeviceId:i=>{t||localStorage.setItem("voxket-audio-input-device-id",i)},saveVideoInputEnabled:i=>{t||localStorage.setItem("voxket-video-input-enabled",i.toString())},saveVideoInputDeviceId:i=>{t||localStorage.setItem("voxket-video-input-device-id",i)}}}function Ai({...e}){return a.jsx(Ee.Root,{"data-slot":"select",...e})}function Mi({...e}){return a.jsx(Ee.Value,{"data-slot":"select-value",...e})}function Ti({className:e,size:t="default",children:n,...s}){return a.jsxs(Ee.Trigger,{"data-slot":"select-trigger","data-size":t,className:$(["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"],e),...s,children:[n,a.jsx(Ee.Icon,{asChild:!0,children:a.jsx(Js,{weight:"bold",className:"size-4 transition-colors"})})]})}function Vi({className:e,children:t,position:n="popper",...s}){return a.jsx(Ee.Portal,{children:a.jsxs(Ee.Content,{"data-slot":"select-content",className:$(["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",e),position:n,...s,children:[a.jsx(af,{}),a.jsx(Ee.Viewport,{className:$("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),a.jsx(lf,{})]})})}function Ni({className:e,children:t,...n}){return a.jsxs(Ee.Item,{"data-slot":"select-item",className:$(["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"],e),...n,children:[a.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:a.jsx(Ee.ItemIndicator,{children:a.jsx(Va,{className:"size-4",weight:"bold"})})}),a.jsx(Ee.ItemText,{children:t})]})}function af({className:e,...t}){return a.jsx(Ee.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:$("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Ma,{className:"size-4",weight:"bold"})})}function lf({className:e,...t}){return a.jsx(Ee.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:$("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Js,{className:"size-4",weight:"bold"})})}const Pi=un.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 Ri({kind:e,track:t,requestPermissions:n,onError:s,client:o,...r}){const i=r.size||"default";if(!o)return a.jsxs(Ai,{disabled:!0,children:[a.jsx(Ti,{className:$(Pi({size:i}),r.className),children:a.jsx(Mi,{placeholder:`Select a ${e}`})}),a.jsx(Vi,{children:a.jsx(Ni,{value:"none",children:"No devices available"})})]});const{devices:l,activeDeviceId:c,setActiveMediaDevice:d}=of(o,e==="audioinput"?"audioinput":"videoinput");return a.jsxs(Ai,{value:c,onValueChange:d,children:[a.jsx(Ti,{className:$(Pi({size:i}),r.className,"hover:bg"),children:i!=="sm"&&a.jsx(Mi,{className:"font-mono text-sm",placeholder:`Select a ${e}`})}),a.jsx(Vi,{children:l.map(u=>a.jsx(Ni,{value:u.deviceId,className:"font-mono text-xs",children:u.label},u.deviceId))})]})}function cf(e,t,n=!1){if(n)return Qs;switch(e){case I.Track.Source.Microphone:return t?Na:Pa;case I.Track.Source.Camera:return t?Ia:Da;case I.Track.Source.ScreenShare:return Ra;default:return h.Fragment}}function $n({source:e,pressed:t,pending:n,className:s,...o}){const r=cf(e,t??!1,n),i=e===I.Track.Source.Microphone&&!(t??!1)&&!n,l=e===I.Track.Source.Camera&&!(t??!1)&&!n;return h.useEffect(()=>{console.log(`TrackToggle for ${e} changed: pressed=${t}, pending=${n}, actualState=${t?"enabled":"disabled"}`)},[e,t,n]),a.jsxs(Fa,{pressed:t,"aria-label":`Toggle ${e}`,className:$(s),...o,children:[a.jsx(r,{weight:"bold",className:$(n&&"animate-spin",i||l?"text-red-500":void 0)}),o.children]})}function df(e){return e?tf(e):{camera:!0,microphone:!0,screenShare:!0,data:!0}}function uf(e={}){const{controls:t,saveUserChoices:n=!0,client:s}=e,o={leave:!0,...t};if(!s)return{micTrackRef:{participant:void 0,source:I.Track.Source.Microphone,publication:void 0},visibleControls:o,microphoneToggle:{enabled:!1,pending:!1,toggle:async()=>{}},cameraToggle:{enabled:!1,pending:!1,toggle:async()=>{}},screenShareToggle:{enabled:!1,pending:!1,toggle:async()=>{}},handleDisconnect:()=>{},handleAudioDeviceChange:()=>{},handleVideoDeviceChange:()=>{}};const{microphoneTrack:r,localParticipant:i}=nf(s),l=df(s);sf(s);const c=Bn(s,"microphone",{onDeviceError:A=>{var j;return(j=e.onDeviceError)==null?void 0:j.call(e,{source:I.Track.Source.Microphone,error:A})}}),d=Bn(s,"camera",{onDeviceError:A=>{var j;return(j=e.onDeviceError)==null?void 0:j.call(e,{source:I.Track.Source.Camera,error:A})}}),u=Bn(s,"screenShare",{onDeviceError:A=>{var j;return(j=e.onDeviceError)==null?void 0:j.call(e,{source:I.Track.Source.ScreenShare,error:A})}}),m=h.useMemo(()=>{let A;if(i){for(const[,j]of i.trackPublications)if(j.source===I.Track.Source.Microphone){A=j;break}}return console.log("🎤 Creating micTrackRef:",{hasParticipant:!!i,hasPublication:!!A,isTrackSubscribed:A==null?void 0:A.isSubscribed,isMuted:A==null?void 0:A.isMuted,trackSid:A==null?void 0:A.trackSid}),{participant:i??void 0,source:I.Track.Source.Microphone,publication:A}},[i,r]);o.microphone??(o.microphone=l.microphone),o.screenShare??(o.screenShare=l.screenShare),o.camera??(o.camera=l.camera),o.chat??(o.chat=l.data);const{saveAudioInputEnabled:f,saveAudioInputDeviceId:g,saveVideoInputEnabled:p,saveVideoInputDeviceId:x}=rf({preventSave:!n}),v=h.useCallback(()=>{s&&s.disconnect()},[s]),E=h.useCallback(A=>{g(A??"default"),s&&s.setAudioInputDevice(A)},[g,s]),b=h.useCallback(A=>{x(A??"default"),s&&s.setVideoInputDevice(A)},[x,s]),S=h.useCallback(async A=>{u.enabled&&await u.toggle(!1),await d.toggle(A),p(!d.enabled)},[d,p,u]),w=h.useCallback(async A=>{await c.toggle(A),f(!c.enabled)},[c,f]),C=h.useCallback(async A=>{d.enabled&&await d.toggle(!1),await u.toggle(A)},[d,u]);return{micTrackRef:m,visibleControls:o,cameraToggle:{...d,toggle:S},microphoneToggle:{...c,toggle:w},screenShareToggle:{...u,toggle:C},handleDisconnect:v,handleAudioDeviceChange:E,handleVideoDeviceChange:b}}const hf={card:" bg-gradient-to-br from-black to-gray-900 border border-gray-900 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto rounded-2xl shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-black/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-gray-800/20 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-gray-600/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-gray-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-gray-400 to-gray-500 rounded-full blur-sm opacity-20 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-gray-500 to-gray-600 rounded-full blur-sm opacity-15 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-black to-gray-900 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-white via-gray-200 to-gray-300"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900",promptSlider:"absolute w-full py-3 px-2 bg-gray-900 rounded-xl text-center text-white text-sm transition-opacity duration-700 ease-in-out border border-gray-600",statusIndicator:"w-2 h-2 bg-gray-400 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-gray-600/30 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-gray-500/20 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-gray-400/15 pulse-ring"},controlBar:"border border-gray-600 rounded-3xl py-4 flex flex-col justify-end h-full bg-gray-900/50 backdrop-blur-sm",chatInput:{container:"bg-gray-900 w-full border-gray-600",textarea:"bg-gray-800 border-none text-white placeholder-gray-400",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-gray-600 text-white",other:"bg-gray-700 text-white"},chatHeader:{container:"bg-gray-900 border-gray-600",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-gray-400 mb-2",suggestedResponse:{container:"bg-gray-800 text-blue-300 border-gray-700 hover:bg-gray-700 hover:text-white"},video:{container:"bg-gradient-to-br from-black to-gray-900 text-white",header:"border-gray-700 bg-gray-900/50",headerButton:"bg-gray-800 hover:bg-gray-700 text-gray-300",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-gray-900/80 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-gray-800 border border-gray-700 shadow-lg",placeholder:"bg-gray-800 text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},mf={card:" bg-gradient-to-br from-white to-gray-50 border border-gray-200 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-white/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-blue-500/5 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-purple-500/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-pink-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-blue-500 to-purple-500 rounded-full blur-sm opacity-30 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-pink-500 to-purple-500 rounded-full blur-sm opacity-20 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-white to-gray-50 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-gray-900",secondary:"text-gray-700",muted:"text-gray-500",accent:"bg-clip-text text-transparent bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600"},micButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-white",promptSlider:"absolute w-full py-3 px-2 bg-gray-100 rounded-xl text-center text-gray-700 text-sm transition-opacity duration-700 ease-in-out border border-gray-200",statusIndicator:"w-2 h-2 bg-green-500 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-blue-500/20 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-purple-500/15 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-pink-500/10 pulse-ring"},controlBar:"border border-gray-200 rounded-3xl py-4 flex flex-col justify-end h-full bg-white/80 backdrop-blur-sm",chatInput:{container:"bg-white/90 border-gray-200 shadow-sm",textarea:"bg-white border-none text-gray-900 placeholder-gray-500 ",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 disabled:opacity-50 text-white",attachButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100 bg-blue-50",endButton:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200"},chatMessage:{own:"bg-blue-50 text-gray-900 border border-blue-100",other:"bg-gray-50 text-gray-900 border border-gray-200"},chatHeader:{container:"bg-white border-gray-200",backButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100"},spinner:"w-10 h-10 animate-spin text-blue-500 mb-2",suggestedResponse:{container:"bg-white text-blue-700 border-blue-200 hover:bg-blue-50 hover:text-blue-900"},video:{container:"bg-gradient-to-br from-white to-gray-50 text-gray-900",header:"border-gray-200 bg-white/80",headerButton:"bg-gray-100 hover:bg-gray-200 text-gray-600",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-white/90 backdrop-blur-sm border-t border-gray-200",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-200 hover:bg-gray-300 text-gray-600",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-white border border-gray-200 shadow-sm",placeholder:"bg-gray-50 text-gray-600",avatar:"bg-gray-200 text-gray-600",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},ff={card:" text-white bg-gradient-to-br from-[#171727] to-[#12121F] border border-gray-800 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-[#171727]/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-[#3B82F6]/15 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-[#8B5CF6]/25 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-[#EC4899]/20 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full blur-sm opacity-50 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-[#EC4899] to-[#8B5CF6] rounded-full blur-sm opacity-40 animate-pulse",main:"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",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-[#3B82F6] via-[#8B5CF6] to-[#EC4899]"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900 shadow-xl",promptSlider:"absolute w-full py-3 px-2 bg-[#1E1E2E] rounded-xl text-center text-gray-200 text-sm transition-opacity duration-700 ease-in-out border border-gray-700",statusIndicator:"w-2 h-2 bg-[#10B981] rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-[#3B82F6]/40 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-[#8B5CF6]/30 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-[#EC4899]/20 pulse-ring"},controlBar:"border border-border rounded-3xl py-4 flex flex-col justify-end h-full",chatInput:{container:"bg-[#1E1E2E] border-gray-700",textarea:"bg-[#1E1E2E] border-none text-white placeholder-gray-400",sendButton:"bg-[#3B82F6] hover:bg-[#2563EB] disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-[#1E1E2E]/80 text-white",other:"bg-[#1E1E2E] text-white border border-gray-700"},chatHeader:{container:"bg-[#1E1E2E] border-gray-700",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-blue-400 mb-2",suggestedResponse:{container:"bg-[#221f3f] text-white border-none"},video:{container:"bg-gradient-to-br from-[#171727] to-[#12121F] text-white",header:"border-gray-700 bg-[#1E1E2E]/80",headerButton:"bg-[#1E1E2E] hover:bg-gray-700 text-gray-300",statusDot:"bg-[#10B981] animate-pulse",controlsBackground:"bg-[#1E1E2E]/90 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-[#3B82F6] hover:bg-[#2563EB] text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-[#1E1E2E] border border-gray-700 shadow-xl",placeholder:"bg-[#1E1E2E] text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},Ii={dark:hf,light:mf,vox:ff};function ye(e){return Ii[e]||Ii.vox}function gf({controls:e,saveUserChoices:t=!0,capabilities:n,className:s,onSendMessage:o,onChatOpenChange:r,onDisconnect:i,onDeviceError:l,theme:c="vox",client:d,...u}){const[m,f]=h.useState(!1),[g,p]=h.useState(!1),x=ye(c),{micTrackRef:v,visibleControls:E,cameraToggle:b,microphoneToggle:S,screenShareToggle:w,handleAudioDeviceChange:C,handleVideoDeviceChange:A,handleDisconnect:j}=uf({controls:e,saveUserChoices:t,client:d}),k=async D=>{p(!0);try{await(o==null?void 0:o(D))}finally{p(!1)}};return h.useEffect(()=>{r==null||r(m)},[m,r]),h.useEffect(()=>{var D,L,W,H;console.log("🎤 AgentControlBar: micTrackRef changed:",{hasParticipant:!!v.participant,hasPublication:!!v.publication,source:v.source,isSubscribed:(D=v.publication)==null?void 0:D.isSubscribed,isMuted:(L=v.publication)==null?void 0:L.isMuted,trackSid:(W=v.publication)==null?void 0:W.trackSid,hasTrack:!!((H=v.publication)!=null&&H.track)})},[v]),a.jsxs("div",{"aria-label":"Voice assistant controls",className:$(x.controlBar,s),...u,children:[n.suportsChatInput&&a.jsxs("div",{inert:!m,className:$("overflow-hidden transition-[height] relative duration-300 ease-in-out",m?"h-[64px] mb-3":"h-0"),children:[a.jsx("div",{className:"flex h-9 px-4 w-full",children:a.jsx(Qm,{onSend:k,disabled:g,className:$("w-full",x.chatInput)})}),a.jsx("hr",{className:"border-border my-2 mx-5"})]}),a.jsxs("div",{className:$("flex flex-row items-center gap-2 rounded-2xl mx-auto border-none backdrop-blur-lg px-2 py-2",c==="light"?"bg-white/80":"bg-[#18182a]/80"),children:[a.jsxs("div",{className:"flex gap-y-2 justify-start",children:[E.microphone&&a.jsxs("div",{className:"flex gap-y-2 items-center rounded-full overflow-hidden border-none ",children:[a.jsx($n,{variant:"primary",source:I.Track.Source.Microphone,pressed:S.enabled,disabled:S.pending,onPressedChange:S.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),a.jsx(ue.BarVisualizer,{barCount:3,trackRef:v,options:{minHeight:5},className:"flex h-full w-auto items-center justify-center gap-x-0.5",children:a.jsx("span",{className:$(["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"])})}),a.jsx(Ri,{size:"sm",kind:"audioinput",client:d,onError:l?D=>D instanceof Error?l({source:I.Track.Source.Microphone,error:D}):void 0:void 0,onActiveDeviceChange:C,className:$(["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&&E.camera&&a.jsxs("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:[a.jsx($n,{variant:"primary",source:I.Track.Source.Camera,pressed:b.enabled,pending:b.pending,disabled:b.pending,onPressedChange:b.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),a.jsx(Ri,{size:"sm",kind:"videoinput",client:d,onError:l?D=>D instanceof Error?l({source:I.Track.Source.Camera,error:D}):void 0:void 0,onActiveDeviceChange:A,className:$(["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]"])})]}),n.suportsScreenShare&&E.screenShare&&a.jsx("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:a.jsx($n,{variant:"secondary",source:I.Track.Source.ScreenShare,pressed:w.enabled,disabled:w.pending,onPressedChange:w.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"})})]}),E.chat&&a.jsx("div",{className:"flex items-center rounded-full overflow-hidden bg-secondary text-secondary-foreground border-none ",children:a.jsx(Fa,{variant:"secondary","aria-label":"Toggle chat",pressed:m,onPressedChange:D=>{f(D)},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:a.jsx(Ta,{weight:"bold",className:"h-5 w-5"})})})]})]})}const pf=(e,t)=>{var l,c;const n=h.useMemo(()=>t?t(e.message):e.message,[e.message,t]),s=!!e.editTimestamp,o=new Date(e.timestamp),r=typeof navigator<"u"?navigator.language:"en-US",i=(l=e.from)!=null&&l.name&&e.from.name!==""?e.from.name:(c=e.from)==null?void 0:c.identity;return{message:n,hasBeenEdited:s,time:o,locale:r,name:i}},xf=({entry:e,messageFormatter:t,className:n,participantName:s,...o})=>{var u,m;const{message:r,time:i,locale:l}=pf(e,t),c=((u=e.from)==null?void 0:u.isLocal)??!1;$("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 d=$("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 a.jsx("li",{title:i.toLocaleTimeString(l,{timeStyle:"full"}),className:$("group flex mb-2",c?"justify-end":"justify-start",n),...o,children:a.jsxs("div",{className:$("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:[a.jsx("span",{className:d,children:c?((m=s==null?void 0:s[0])==null?void 0:m.toUpperCase())||"U":"A"}),a.jsx("span",{className:$("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:r})]})})};function yf(e){y.useEffect(()=>{function t(){const n=e.current;n&&(n.scrollTop=n.scrollHeight)}if(e.current){const n=new ResizeObserver(t);return n.observe(e.current),t(),()=>n.disconnect()}},[e])}const bf=({className:e,children:t,...n})=>{const s=y.useRef(null);return yf(s),a.jsx("div",{ref:s,className:$("flex flex-col justify-end",e),...n,children:t})},vf=({state:e,audioTrack:t,className:n,ref:s})=>a.jsx("div",{ref:s,className:$("",n),children:a.jsx(ue.BarVisualizer,{barCount:5,state:e,options:{minHeight:5},trackRef:t,className:$("flex aspect-video w-40 items-center justify-center gap-1"),children:a.jsx("span",{className:$(["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]"])})})}),wf=({videoTrack:e,className:t,ref:n})=>{var s,o;return a.jsx("div",{ref:n,className:$(t),children:a.jsx(ue.VideoTrack,{trackRef:e,width:((s=e==null?void 0:e.publication.dimensions)==null?void 0:s.width)??0,height:((o=e==null?void 0:e.publication.dimensions)==null?void 0:o.height)??0,className:"rounded-md"})})},Sf=Q.create(ue.VideoTrack),Cf=({trackRef:e,className:t,ref:n})=>{var s,o;return a.jsx("div",{className:$("bg-muted overflow-hidden rounded-md",t),children:a.jsx(Sf,{ref:n,trackRef:e,width:((s=e==null?void 0:e.publication.dimensions)==null?void 0:s.width)??0,height:((o=e==null?void 0:e.publication.dimensions)==null?void 0:o.height)??0,className:$("h-full w-auto")})})},Di=Q.create(Cf),kf=Q.create(vf),jf=Q.create(wf),Le={initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},transition:{type:"spring",stiffness:675,damping:75,mass:1}},ot={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 Ef(e){const{localParticipant:t}=ue.useLocalParticipant(),n=t.getTrackPublication(e);return y.useMemo(()=>n?{source:e,participant:t,publication:n}:void 0,[e,n,t])}function Af({chatOpen:e}){const{state:t,audioTrack:n,videoTrack:s,agent:{isActive:o=!1}={}}=ue.useVoiceAssistant(),[r]=ue.useTracks([I.Track.Source.ScreenShare]),i=Ef(I.Track.Source.Camera),l=i&&!i.publication.isMuted,c=r&&!r.publication.isMuted,d=l||c,u={...Le.transition,delay:e?0:.15},m={...Le.animate,scale:e?1:3,transition:u},f={...Le.animate,transition:u},g=u,p=u,x=s!==void 0;return a.jsx("div",{className:"relative w-full h-full z-10 flex items-center justify-center",children:a.jsx("div",{className:"relative w-full h-full max-w-2xl px-4 md:px-0",children:a.jsxs("div",{className:$(ot.grid),children:[o&&a.jsx("div",{className:$(["grid",!e&&ot.agentChatClosed,e&&d&&ot.agentChatOpenWithSecondTile,e&&!d&&ot.agentChatOpenWithoutSecondTile]),children:a.jsxs("div",{className:"h-full flex items-center justify-center",children:[!x&&a.jsx(kf,{layoutId:"agent",...Le,animate:m,transition:g,state:t,audioTrack:n,className:$(e?"h-[90px]":"h-auto w-full")},"agent"),x&&a.jsx(jf,{layoutId:"avatar",...Le,animate:f,transition:p,videoTrack:s,className:$(e?"h-[90px] [&>video]:h-[90px] [&>video]:w-auto":"h-auto w-full")},"avatar")]})}),a.jsx("div",{className:$(["grid",e&&ot.secondTileChatOpen,!e&&ot.secondTileChatClosed]),children:a.jsxs("div",{className:"w-full px-10 flex items-center shadow-2xl justify-between",children:[i&&l&&a.jsx(Di,{layout:"position",layoutId:"camera",...Le,trackRef:i,transition:{...Le.transition,delay:e?0:.15},className:"h-[60px] order-1"},"camera"),c&&a.jsx(Di,{layout:"position",layoutId:"screen",...Le,trackRef:r,transition:{...Le.transition,delay:e?0:.15},className:"h-[70px] order-2"},"screen")]})})]})})})}function Fi({timeout:e}){const[t,n]=y.useState(100),s=y.useRef(null),o=y.useRef(null);return y.useEffect(()=>{if(!e||e<=0)return;n(100),o.current=Date.now();const r=()=>{if(!e||o.current===null)return;const i=Date.now()-o.current,l=Math.max(0,100-i/e*100);n(l),l>0&&(s.current=requestAnimationFrame(r))};return s.current=requestAnimationFrame(r),()=>{s.current&&cancelAnimationFrame(s.current)}},[e]),!e||e<=0?null:a.jsx("div",{className:"w-full h-1 relative top-1 rounded-t-4xl bg-gray-700 overflow-hidden",children:a.jsx(Q.div,{className:"h-1 rounded-t-4xl dark:bg-white bg-blue-200 ",initial:{width:"100%"},animate:{width:`${Math.max(t,2)}%`},transition:{duration:.1,ease:"linear"},style:{minWidth:"2%"}})})}function gt({interaction:e,theme:t,onDismiss:n,client:s,addLocalMessage:o}){var l;if(!e||!e.isVisible||!e.component)return null;const[r]=h.useState(()=>Date.now()),i=()=>e.component?h.createElement(e.component,{handler:e.handler||void 0,timeout:e.timeout,loadData:async d=>{console.log("InteractiveComponent: Loading data:",d)},presentationMode:e.presentationMode,data:e.data,client:s,addLocalMessage:o}):a.jsx("div",{className:"p-4 text-red-500",children:"Component not found"});switch(e.presentationMode){case"fullscreen":return a.jsx(ut,{children:a.jsxs(Q.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999] bg-black",children:[a.jsxs("div",{className:"flex flex-col",children:[a.jsx(Fi,{timeout:e.timeout}),a.jsxs("div",{className:"flex items-center justify-between p-4 bg-black/80 text-white border-b border-gray-700",children:[a.jsx("h3",{className:"text-lg font-semibold",children:e.methodName.replace(/_/g," ").replace(/\b\w/g,c=>c.toUpperCase())}),a.jsx("button",{onClick:n||((l=e.handler)==null?void 0:l.dismissView),className:"p-2 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors",children:a.jsx(ge.X,{className:"w-5 h-5"})})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:i()})]})});case"embedded":default:return a.jsx(ut,{children:a.jsx(Q.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"w-fit rounded-lg ",children:a.jsxs("div",{children:[a.jsx(Fi,{timeout:e.timeout}),i()]})})})}}function Mf(){const e=ue.useTranscriptions(),t=ue.useChat(),n=ue.useRoomContext();return{messages:y.useMemo(()=>[...e.map(r=>Am(r,n)),...t.chatMessages].sort((r,i)=>r.timestamp-i.timestamp),[e,t.chatMessages,n]),send:t.send}}const Tf=({logLevel:e}={})=>{const t=ue.useRoomContext();h.useEffect(()=>(I.setLogLevel(e??"debug"),window.__lk_room=t,()=>{window.__lk_room=void 0}),[t,e])},Vf=({disabled:e,capabilities:t,sessionStarted:n,ref:s,participantName:o="User",loadingText:r="Waiting for agent to connect...",theme:i="vox",client:l,displayType:c="widget",onBack:d})=>{var ne,te,se,U,M,G,Y;const[u,m]=y.useState(!1),[f,g]=y.useState(!1),[p,x]=y.useState(()=>{var q;const V=(q=l==null?void 0:l.getCurrentInteraction)==null?void 0:q.call(l);return console.log("SessionView: Initializing with existing interaction:",(V==null?void 0:V.methodName)||"none"),V||null}),{messages:v,send:E}=Mf(),b=y.useRef(null),S=y.useRef(null),{agent:{isActive:w=!1}={}}=ue.useVoiceAssistant(),C=ye(i),A=y.useMemo(()=>l&&typeof l.getCurrentSession=="function"?!!l.getCurrentSession():!1,[l]),j=w||A;y.useEffect(()=>{var V,q;console.log("🤖 SessionView agent state:",{isAgentActive:w,hasActiveSession:A,effectiveAgentActive:j,sessionStarted:n,clientSession:(q=(V=l==null?void 0:l.getCurrentSession)==null?void 0:V.call(l))==null?void 0:q.id})},[w,A,j,n,l]),y.useEffect(()=>{console.log("🤖 Agent active state changed:",w)},[w]),y.useEffect(()=>{console.log("📋 Session state changed:",{sessionStarted:n,disabled:e,participantName:o,effectiveAgentActive:j,chatOpen:u,currentInteraction:(p==null?void 0:p.methodName)||"none"})},[n,e,o,j,u,p]),y.useEffect(()=>{if(n&&!w){console.log("⏰ Starting agent timeout detection...");const V=setTimeout(()=>{console.log("⚠️ Agent timeout: Agent did not become active within 30 seconds"),g(!0)},3e4);return()=>{clearTimeout(V)}}else w&&(console.log("✅ Agent is active, clearing timeout"),g(!1))},[n,w]),y.useEffect(()=>{if(!l)return;const V=()=>{console.log("🔄 Client connection state changed:",l.connected)},q=T=>{console.log("🔴 Client disconnected:",T),x(null),m(!1),g(!1)};return l.on("connection.connected",V),l.on("connection.disconnected",q),()=>{l.off("connection.connected",V),l.off("connection.disconnected",q)}},[l]),y.useEffect(()=>{if(!l)return;const V=z=>{console.log("🎯 SessionView: RPC Interaction started:",z);const B=l.getCurrentInteraction();B&&(console.log("📱 SessionView: Setting current interaction:",B.methodName,"mode:",B.presentationMode),x(B))},q=z=>{console.log("✅ SessionView: RPC Interaction completed:",z),x(null)},T=async z=>{console.log("⏰ SessionView: RPC Interaction timeout:",z),x(null)},F=async z=>{console.log("❌ SessionView: RPC Interaction dismissed:",z),x(null)};return l.on("rpc.interaction.started",V),l.on("rpc.interaction.completed",q),l.on("rpc.interaction.timeout",T),l.on("rpc.interaction.dismissed",F),()=>{l.off("rpc.interaction.started",V),l.off("rpc.interaction.completed",q),l.off("rpc.interaction.timeout",T),l.off("rpc.interaction.dismissed",F)}},[l]),y.useEffect(()=>{if(!l)return;const V=l.getCurrentInteraction();V?(console.log("🔄 SessionView: Syncing with existing interaction:",V.methodName),x(V)):x(null)},[l]),y.useEffect(()=>{console.log("🎭 SessionView: Current interaction changed:",(p==null?void 0:p.methodName)||"none","mode:",(p==null?void 0:p.presentationMode)||"none")},[p]),y.useEffect(()=>{var V,q,T;console.log("📱 SessionView: Display type changed to:",c),console.log("📱 SessionView: Current session state during display change:",{sessionStarted:n,effectiveAgentActive:j,hasSession:!!((V=l==null?void 0:l.getCurrentSession)!=null&&V.call(l)),sessionId:(T=(q=l==null?void 0:l.getCurrentSession)==null?void 0:q.call(l))==null?void 0:T.id})},[c,n,j,l]),y.useEffect(()=>{console.log("💬 SessionView: Chat open state changed:",u)},[u]),y.useEffect(()=>{p&&u&&(console.log("🎭 SessionView: Interactive UI appeared, closing chat"),m(!1))},[p,u]),Tf(),y.useEffect(()=>{b.current&&u&&v.length>0&&(console.log("📜 SessionView: Auto-scrolling to latest message, count:",v.length),setTimeout(()=>{if(b.current){let V=b.current.parentElement;for(;V&&V.scrollHeight<=V.clientHeight;)V=V.parentElement;V?(console.log("📜 SessionView: Scrolling container found, scrolling to bottom"),V.scrollTo({top:V.scrollHeight,behavior:"smooth"})):(console.log("📜 SessionView: Using fallback scroll method"),b.current.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"}))}},100))},[v.length,u]),y.useEffect(()=>{var T,F;console.log("📝 SessionView: Messages updated, count:",v.length),v.length>0&&console.log("📝 SessionView: Latest messages:",v.slice(-3).map(z=>{var B,R,_,K,O,re,oe;return{id:z.id,message:z.message,timestamp:z.timestamp,from:((B=z.from)==null?void 0:B.name)||((R=z.from)==null?void 0:R.identity),fromType:z.from===void 0?"unknown":"participant",isLocal:((_=z.from)==null?void 0:_.identity)===((re=(O=(K=l==null?void 0:l.getCurrentSession)==null?void 0:K.call(l))==null?void 0:O.localParticipant)==null?void 0:re.identity),messageLength:((oe=z.message)==null?void 0:oe.length)||0}}));const V=((T=l==null?void 0:l.getTranscriptions)==null?void 0:T.call(l))||[],q=((F=l==null?void 0:l.getChatMessages)==null?void 0:F.call(l))||[];console.log("📝 SessionView: Raw transcriptions count:",V.length),console.log("📝 SessionView: Raw chat messages count:",q.length)},[v.length,v,l]),y.useEffect(()=>{console.log("💬 SessionView: Chat state changed:",{chatOpen:u,messagesCount:v.length,displayType:c,hasMessages:v.length>0})},[u,v.length,c]);async function k(V){await E(V)}const D=y.useCallback(V=>{console.log("📝 SessionView: Adding local message for voice session context:",V)},[]),L=y.useCallback(async V=>{try{l&&typeof l.sendAttachments=="function"&&(await l.sendAttachments(V),console.log("📎 SessionView: Attachments sent successfully:",V.map(q=>q.name)))}catch(q){console.error("❌ SessionView: Failed to send attachments:",q)}},[l]),W=y.useCallback(()=>{try{console.log("📞 SessionView: Ending call..."),console.log("📞 SessionView: Current state before ending:",{sessionStarted:n,effectiveAgentActive:j,chatOpen:u,currentInteraction:p==null?void 0:p.methodName,hasOnBack:!!d}),p&&(console.log("🎭 SessionView: Dismissing current interaction:",p.methodName),x(null),l&&typeof l.dismissCurrentInteraction=="function"&&l.dismissCurrentInteraction()),m(!1),g(!1),console.log("✅ SessionView: Local state reset"),l&&typeof l.endSession=="function"&&(l.endSession(),console.log("✅ SessionView: Session ended via client.endSession()")),l&&typeof l.disconnect=="function"&&(l.disconnect(),console.log("✅ SessionView: Client disconnected")),d?(console.log("🔄 SessionView: Calling onBack to return to welcome..."),setTimeout(()=>{d(),console.log("✅ SessionView: onBack called")},150)):console.warn("⚠️ SessionView: No onBack function provided - cannot return to welcome"),console.log("🏁 SessionView: Call ended and cleanup completed")}catch(V){console.error("❌ SessionView: Failed to end call:",V),x(null),m(!1),g(!1),d&&(console.log("🔄 SessionView: Error occurred, still calling onBack..."),d())}},[l,d,p,n,j,u]);y.useEffect(()=>(console.log("🔄 SessionView: Component mounted/props changed:",{sessionStarted:n,disabled:e,participantName:o,displayType:c,hasOnBack:!!d,hasClient:!!l}),()=>{console.log("🧹 SessionView: Component unmounting or props changing")}),[n,e,o,c,d,l]),y.useEffect(()=>{console.log("🔗 SessionView: onBack prop:",{hasOnBack:!!d,onBackType:typeof d})},[d]),y.useEffect(()=>{var q,T;const V=((T=(q=l==null?void 0:l.getCurrentSession)==null?void 0:q.call(l))==null?void 0:T.id)||null;S.current&&!V&&console.warn("⚠️ SessionView: Session was lost unexpectedly!",{previousSession:S.current,currentSession:V,displayType:c,sessionStarted:n,effectiveAgentActive:j}),S.current=V},[l,c,n,j]);const H=$("w-full flex flex-col items-center justify-center",c==="fullscreen"?"w-full max-w-none mx-0 h-full":"w-full mx-auto",C.main,c==="fullscreen"?"max-w-none":"","overflow-hidden","h-full"),Ce=d&&(c==="popup"||c==="fullscreen");return a.jsxs("main",{ref:s,inert:e,className:$(H,"relative"),style:{minHeight:0},children:[Ce&&a.jsx("div",{className:`flex items-center justify-between w-full p-4 border-b ${((ne=C.chatHeader)==null?void 0:ne.container)||"border-gray-200"}`,children:a.jsx("div",{className:"flex items-center",children:a.jsxs("div",{children:[a.jsx("h3",{className:`font-semibold ${C.text.primary}`,children:"Voice Session"}),a.jsx("p",{className:`text-sm ${C.text.muted}`,children:o})]})})}),a.jsxs("div",{className:"w-full flex-1 flex flex-col items-center px-0 min-h-0 overflow-hidden",children:[!j&&a.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full min-h-[180px]",children:[a.jsx(Q.div,{animate:{rotate:360,scale:[1,1.1,1]},transition:{rotate:{duration:2,repeat:1/0,ease:"linear"},scale:{duration:1,repeat:1/0,ease:"easeInOut"}},className:"w-12 h-12 mb-4",children:a.jsx(Qs,{className:C.spinner,weight:"bold"})}),a.jsx(Q.span,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`text-sm opacity-80 ${C.text.muted} text-center max-w-xs`,children:f?"Agent is taking longer than expected...":r}),a.jsx(Q.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:2},className:`text-xs ${C.text.muted} mt-2 text-center opacity-60`,children:f?"Please check your connection or try again.":"Agent is connecting... This may take a moment."}),f&&d&&a.jsx(Q.button,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.5},onClick:d,className:`mt-4 px-4 py-2 rounded-lg ${((te=C.chatHeader)==null?void 0:te.backButton)||"bg-gray-100 hover:bg-gray-200"} transition-colors`,children:"Go Back"})]}),j&&a.jsxs(a.Fragment,{children:[u&&a.jsxs("div",{className:$("absolute inset-0 w-full h-full flex flex-col transition-[opacity,translate] duration-300 ease-out z-10",i==="light"?"bg-white":"bg-gray-900/95 backdrop-blur-sm",u?"translate-y-0 opacity-100 delay-200":"translate-y-10 opacity-0"),children:[a.jsxs("div",{className:$("flex-shrink-0 px-4 py-3 border-b",c==="fullscreen"?"px-8":"px-5",((se=C.chatHeader)==null?void 0:se.container)||"border-gray-200 dark:border-gray-700"),children:[a.jsx("h3",{className:$("font-semibold text-lg",((U=C.text)==null?void 0:U.primary)||"text-gray-900 dark:text-white"),children:"Transcription & Chat"}),a.jsxs("p",{className:$("text-sm",((M=C.text)==null?void 0:M.muted)||"text-gray-600 dark:text-gray-400"),children:[v.length," messages"]})]}),a.jsx("div",{className:$("flex-1 flex flex-col min-h-0",c==="fullscreen"?"px-8":"px-5"),children:a.jsx(bf,{className:"flex-1 flex flex-col min-h-0 h-full",children:a.jsxs("div",{className:`flex-1 flex flex-col h-full ${$("overflow-y-auto scrollbar-hide py-4")}`,style:{scrollbarWidth:"none",scrollBehavior:"smooth",paddingBottom:"120px"},children:[v.length===0&&a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:$("text-lg font-medium mb-2",((G=C.text)==null?void 0:G.primary)||"text-gray-900 dark:text-white"),children:"Start Speaking"}),a.jsx("p",{className:$("text-sm",((Y=C.text)==null?void 0:Y.muted)||"text-gray-600 dark:text-gray-400"),children:"Your conversation will appear here"})]})}),v.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex-1 min-h-4"}),a.jsx("div",{ref:b,className:"space-y-4 relative whitespace-pre-wrap z-0",children:a.jsx(ut,{mode:"popLayout",children:v.map((V,q)=>a.jsx(Q.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.3,ease:"easeOut",delay:q*.02},layout:!0,children:a.jsx(xf,{participantName:o,entry:V})},V.id||`message-${q}`))})})]})]})})})]}),!u&&a.jsxs("div",{className:$("flex-1 flex flex-col items-center w-full h-full min-h-0",(p==null?void 0:p.presentationMode)==="embedded"?"justify-end":"justify-center"),children:[a.jsx(Q.div,{className:"w-full flex justify-center",animate:{y:(p==null?void 0:p.presentationMode)==="embedded"?-8:0},transition:{duration:.3,ease:"easeOut"},children:a.jsx(Af,{chatOpen:u})}),a.jsx(ut,{mode:"wait",children:p&&p.presentationMode==="embedded"&&a.jsx(Q.div,{initial:{opacity:0,y:20,height:0},animate:{opacity:1,y:0,height:"auto"},exit:{opacity:0,y:20,height:0},transition:{duration:.3,ease:"easeOut"},className:$("w-full relative mt-4 flex justify-center",c==="fullscreen"?"max-w-4xl":"max-w-md"),children:a.jsx("div",{className:"bg-white/10 backdrop-blur-sm rounded-xl border border-white/20 shadow-lg overflow-hidden",children:a.jsx(gt,{interaction:p,theme:i,onDismiss:()=>{var V;return(V=l==null?void 0:l.dismissCurrentInteraction)==null?void 0:V.call(l)},client:l,addLocalMessage:D})})},`embedded-${p.methodName}`)})]})]})]}),a.jsx(ut,{mode:"wait",children:p&&p.presentationMode!=="embedded"&&!u&&a.jsx("div",{className:$("absolute inset-0 z-50 flex items-center justify-center backdrop-blur-sm",c==="fullscreen"?"bg-black/70":"bg-black/50"),children:a.jsx(Q.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},className:$("relative w-full overflow-hidden",c==="fullscreen"?"max-w-2xl mx-8 max-h-[85vh]":"max-w-lg mx-4 max-h-[80vh]","bg-white dark:bg-gray-900 rounded-2xl shadow-2xl","border border-gray-200 dark:border-gray-700"),children:a.jsx(gt,{interaction:p,theme:i,onDismiss:()=>{var V;return(V=l==null?void 0:l.dismissCurrentInteraction)==null?void 0:V.call(l)},client:l,addLocalMessage:D})},`modal-${p.methodName}`)})}),a.jsx(Q.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"absolute bottom-0 left-0 right-0 flex-shrink-0 w-full z-20",children:a.jsx(Nf,{capabilities:t,onSendMessage:k,onSendAttachments:L,onEndCall:W,onChatOpenChange:m,disabled:e,theme:i,client:l,sessionStarted:n})})]})};function Nf({capabilities:e,onSendMessage:t,onSendAttachments:n,onEndCall:s,onChatOpenChange:o,disabled:r=!1,theme:i,client:l,sessionStarted:c=!1}){const[d,u]=y.useState(!1),m=y.useRef(null),f=y.useRef(null);y.useEffect(()=>{const b=()=>{const S=navigator.userAgent.toLowerCase(),C=["android","iphone","ipad","mobile","tablet"].some(k=>S.includes(k)),A="ontouchstart"in window||navigator.maxTouchPoints>0,j=window.innerWidth<=768;u(C||A&&j)};return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[]);const g=b=>{const S=b.target.files;if(S&&S.length>0){const C=Array.from(S).filter(A=>A.type.startsWith("image/"));if(C.length===0){console.warn("No valid image files selected");return}n&&n(C),m.current&&(m.current.value="")}},p=b=>{const S=b.target.files;if(S&&S.length>0){const w=S[0];w.type.startsWith("image/")&&n&&n([w]),f.current&&(f.current.value="")}},x=()=>{!r&&m.current&&m.current.click()},v=()=>{!r&&d&&f.current&&f.current.click()},E=()=>{console.log("🔴 VoiceControlPanel: End call button clicked"),console.log("🔴 VoiceControlPanel: Current state:",{disabled:r,sessionStarted:c,hasOnEndCall:!!s}),s?s():console.warn("⚠️ VoiceControlPanel: No onEndCall function provided")};return a.jsx("div",{className:$("px-4 py-3 !w-full backdrop-blur-xl border-0 shadow-lg",i==="light"?"bg-white/95 border-t border-gray-200":"bg-gray-900/95 border-t border-gray-700"),children:a.jsxs("div",{className:"flex items-center justify-between !w-full mx-auto max-w-4xl",children:[a.jsx("input",{ref:m,type:"file",multiple:!0,onChange:g,className:"hidden",accept:"image/*"}),a.jsx("input",{ref:f,type:"file",onChange:p,className:"hidden",accept:"image/*",capture:"environment"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:x,disabled:r,className:$("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",r?"opacity-50 cursor-not-allowed":"hover:shadow-md",i==="light"?"bg-gray-100 hover:bg-gray-200 text-gray-600":"bg-gray-700/50 hover:bg-gray-600/50 text-gray-300"),title:"Attach files",children:a.jsx(Be.AttachFile,{className:"w-5 h-5"})}),d&&a.jsx("button",{onClick:v,disabled:r,className:$("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",r?"opacity-50 cursor-not-allowed":"hover:shadow-md",i==="light"?"bg-gray-100 hover:bg-gray-200 text-gray-600":"bg-gray-700/50 hover:bg-gray-600/50 text-gray-300"),title:"Take photo",children:a.jsx(Be.CameraAlt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"flex-1 flex justify-center px-4",children:a.jsx(gf,{capabilities:e,onChatOpenChange:o,onSendMessage:t,theme:i,client:l,className:"border-none py-1 rounded-xl max-w-md w-full"})}),a.jsx("div",{className:"flex items-center",children:a.jsx("button",{onClick:E,disabled:r||!c,className:$("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",r||!c?"opacity-50 cursor-not-allowed":"hover:shadow-md","bg-red-500 hover:bg-red-600 text-white"),title:"End call",children:a.jsx(Be.CallEnd,{className:"w-5 h-5"})})})]})})}function Pf({onSendMessage:e,onSendAttachments:t,disabled:n,theme:s,onEndChat:o}){const[r,i]=h.useState(""),[l,c]=h.useState(!1),d=h.useRef(null),u=h.useRef(null),[m,f]=h.useState(!1),g=ye(s);h.useEffect(()=>{const w=()=>{const C=navigator.userAgent.toLowerCase(),j=["android","iphone","ipad","mobile","tablet"].some(L=>C.includes(L)),k="ontouchstart"in window||navigator.maxTouchPoints>0,D=window.innerWidth<=768;f(j||k&&D)};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]);const p=w=>{w.preventDefault(),r.trim()&&!n&&(e(r.trim()),i(""))},x=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),p(w))},v=w=>{const C=w.target.files;if(C&&C.length>0){const A=Array.from(C),j=A.filter(k=>k.type.startsWith("image/"));if(j.length===0){console.warn("No valid image files selected");return}j.length!==A.length&&console.warn("Some non-image files were filtered out"),console.log("Selected image files:",j),t(j),d.current&&(d.current.value="")}},E=()=>{!n&&d.current&&d.current.click()},b=()=>{!n&&m&&u.current&&u.current.click()},S=w=>{const C=w.target.files;if(C&&C.length>0){const A=C[0];A.type.startsWith("image/")?t([A]):console.warn("Selected file is not an image"),u.current&&(u.current.value="")}};return a.jsx("div",{className:"px-4 py-3 !w-full backdrop-blur-xl border-0 shadow-lg ",children:a.jsx("form",{onSubmit:p,className:"flex items-center !w-full mx-auto max-w-4xl",children:a.jsxs("div",{className:`flex items-center gap-2 !w-full backdrop-blur-md rounded-full px-3 py-2 shadow-sm hover:shadow-md focus-within:shadow-lg focus-within:ring-2 focus-within:ring-blue-500/30 focus-within:border-blue-500/50 transition-all duration-200 border ${s==="light"?"bg-white/90 border-gray-200":g.chatInput.container}`,children:[a.jsx(Q.button,{type:"button",onClick:E,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 ${g.chatInput.attachButton}`,disabled:n,"aria-label":"Attach file",children:a.jsx(ge.Paperclip,{className:"w-4 h-4"})}),m&&a.jsx(Q.button,{type:"button",onClick:b,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 ${g.chatInput.attachButton}`,disabled:n,"aria-label":"Take photo",children:a.jsx(ge.Camera,{className:"w-4 h-4"})}),a.jsx("input",{ref:d,type:"file",multiple:!0,onChange:v,className:"hidden",accept:"image/*"}),a.jsx("input",{ref:u,type:"file",onChange:S,className:"hidden",accept:"image/*",capture:"environment"}),a.jsx("textarea",{value:r,onChange:w=>i(w.target.value),onKeyDown:x,onFocus:()=>c(!0),onBlur:()=>c(!1),placeholder:"Type your message...",disabled:n,className:`flex-1 px-2 py-1 bg-transparent resize-none min-h-[32px] max-h-20 focus:outline-none text-sm border-0 ${g.chatInput.textarea}`,rows:1,style:{height:"auto",minHeight:"32px"},onInput:w=>{const C=w.target;C.style.height="auto",C.style.height=`${Math.min(C.scrollHeight,80)}px`}}),a.jsx(Q.button,{type:"submit",disabled:n||!r.trim(),whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 flex-shrink-0 ${r.trim()&&!n?g.chatInput.sendButton:s==="light"?"bg-gray-200 text-gray-400 cursor-not-allowed opacity-70":"bg-gray-600/50 text-gray-500 cursor-not-allowed opacity-50"}`,"aria-label":"Send message",children:a.jsx(ge.SendHorizontal,{className:"w-4 h-4"})}),o&&a.jsx(Q.button,{type:"button",onClick:o,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 flex-shrink-0 ${g.chatInput.endButton}`,"aria-label":"End chat",children:a.jsx(ge.PhoneOff,{className:"w-4 h-4"})})]})})})}function Rf({text:e,isComplete:t,isRealTimeStream:n=!1,speed:s=50}){const[o,r]=h.useState(""),[i,l]=h.useState(0);return h.useEffect(()=>{if(n){r(e);return}if(t){r(e);return}if(i<e.length){const c=setTimeout(()=>{r(e.slice(0,i+1)),l(i+1)},s);return()=>clearTimeout(c)}},[e,i,t,s,n]),h.useEffect(()=>{n||(l(0),r(""))},[e,n]),a.jsxs("span",{className:"relative",children:[a.jsx("span",{className:"inline-block",children:o}),!t&&a.jsx("span",{className:"inline-flex items-center ml-1",children:[0,1,2].map(c=>a.jsx(Q.span,{className:"w-1.5 h-1.5 bg-current rounded-full mx-0.5",animate:{y:[0,-4,0],opacity:[.4,1,.4],scale:[.8,1,.8]},transition:{duration:.8,repeat:1/0,repeatType:"mirror",delay:c*.2,ease:"easeInOut"}},c))})]})}function If({message:e,theme:t,isOwn:n,isStreaming:s=!1}){var i,l;const o=ye(t),r=e.sender.name?e.sender.name.split(" ").map(c=>c[0]).join("").toUpperCase().slice(0,2):"U";return a.jsx("div",{className:`flex w-full ${n?"justify-end":"justify-start"} mb-4 px-1`,children:a.jsxs("div",{className:`relative group ${n?"flex-row-reverse":"flex-row"} flex items-end gap-3 max-w-[85%]`,children:[a.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${n?t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700":t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:r}),a.jsxs("div",{className:`
|
|
9
|
+
`),()=>{x.contains(g)&&x.removeChild(g)}},[t]),a.jsx(dd,{isPresent:t,childRef:r,sizeRef:i,children:h.cloneElement(e,{ref:r})})}const hd=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:o,presenceAffectsLayout:r,mode:i,anchorX:l,root:c})=>{const d=xs(md),u=y.useId();let m=!0,f=y.useMemo(()=>(m=!1,{id:u,initial:t,isPresent:n,custom:o,onExitComplete:p=>{d.set(p,!0);for(const g of d.values())if(!g)return;s&&s()},register:p=>(d.set(p,!1),()=>d.delete(p))}),[n,d,s]);return r&&m&&(f={...f}),y.useMemo(()=>{d.forEach((p,g)=>d.set(g,!1))},[n]),h.useEffect(()=>{!n&&!d.size&&s&&s()},[n]),i==="popLayout"&&(e=a.jsx(ud,{isPresent:n,anchorX:l,root:c,children:e})),a.jsx(hn.Provider,{value:f,children:e})};function md(){return new Map}function Vr(e=!0){const t=y.useContext(hn);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:o}=t,r=y.useId();y.useEffect(()=>{if(e)return o(r)},[e]);const i=y.useCallback(()=>e&&s&&s(r),[r,s,e]);return!n&&s?[!1,i]:[!0]}const Kt=e=>e.key||"";function Mo(e){const t=[];return y.Children.forEach(e,n=>{y.isValidElement(n)&&t.push(n)}),t}const ut=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:o=!0,mode:r="sync",propagate:i=!1,anchorX:l="left",root:c})=>{const[d,u]=Vr(i),m=y.useMemo(()=>Mo(e),[e]),f=i&&!d?[]:m.map(Kt),p=y.useRef(!0),g=y.useRef(m),x=xs(()=>new Map),[v,E]=y.useState(m),[b,S]=y.useState(m);$i(()=>{p.current=!1,g.current=m;for(let A=0;A<b.length;A++){const j=Kt(b[A]);f.includes(j)?x.delete(j):x.get(j)!==!0&&x.set(j,!1)}},[b,f.length,f.join("-")]);const w=[];if(m!==v){let A=[...m];for(let j=0;j<b.length;j++){const k=b[j],D=Kt(k);f.includes(D)||(A.splice(j,0,k),w.push(k))}return r==="wait"&&w.length&&(A=w),S(Mo(A)),E(m),null}process.env.NODE_ENV!=="production"&&r==="wait"&&b.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:C}=y.useContext(gs);return a.jsx(a.Fragment,{children:b.map(A=>{const j=Kt(A),k=i&&!d?!1:m===b||f.includes(j),D=()=>{if(x.has(j))x.set(j,!0);else return;let L=!0;x.forEach(W=>{W||(L=!1)}),L&&(C==null||C(),S(g.current),i&&(u==null||u()),s&&s())};return a.jsx(hd,{isPresent:k,initial:!p.current||n?void 0:!1,custom:t,presenceAffectsLayout:o,mode:r,root:c,onExitComplete:k?void 0:D,anchorX:l,children:A},j)})})},Nr=y.createContext({strict:!1}),To={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},ft={};for(const e in To)ft[e]={isEnabled:t=>To[e].some(n=>!!t[n])};function fd(e){for(const t in e)ft[t]={...ft[t],...e[t]}}const pd=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function cn(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||pd.has(e)}let Pr=e=>!cn(e);function gd(e){typeof e=="function"&&(Pr=t=>t.startsWith("on")?!cn(t):e(t))}try{gd(require("@emotion/is-prop-valid").default)}catch{}function xd(e,t,n){const s={};for(const o in e)o==="values"&&typeof e.values=="object"||(Pr(o)||n===!0&&cn(o)||!t&&!cn(o)||e.draggable&&o.startsWith("onDrag"))&&(s[o]=e[o]);return s}const mn=y.createContext({});function fn(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function It(e){return typeof e=="string"||Array.isArray(e)}const _s=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Hs=["initial",..._s];function pn(e){return fn(e.animate)||Hs.some(t=>It(e[t]))}function Rr(e){return!!(pn(e)||e.variants)}function yd(e,t){if(pn(e)){const{initial:n,animate:s}=e;return{initial:n===!1||It(n)?n:void 0,animate:It(s)?s:void 0}}return e.inherit!==!1?t:{}}function bd(e){const{initial:t,animate:n}=yd(e,y.useContext(mn));return y.useMemo(()=>({initial:t,animate:n}),[Vo(t),Vo(n)])}function Vo(e){return Array.isArray(e)?e.join(" "):e}const Dt={};function vd(e){for(const t in e)Dt[t]=e[t],Es(t)&&(Dt[t].isCSSVariable=!0)}function Ir(e,{layout:t,layoutId:n}){return bt.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Dt[e]||e==="opacity")}const wd={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Sd=yt.length;function Cd(e,t,n){let s="",o=!0;for(let r=0;r<Sd;r++){const i=yt[r],l=e[i];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(i.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const d=kr(l,Ls[i]);if(!c){o=!1;const u=wd[i]||i;s+=`${u}(${d}) `}n&&(t[i]=d)}}return s=s.trim(),n?s=n(t,o?"":s):o&&(s="none"),s}function Zs(e,t,n){const{style:s,vars:o,transformOrigin:r}=e;let i=!1,l=!1;for(const c in t){const d=t[c];if(bt.has(c)){i=!0;continue}else if(Es(c)){o[c]=d;continue}else{const u=kr(d,Ls[c]);c.startsWith("origin")?(l=!0,r[c]=u):s[c]=u}}if(t.transform||(i||n?s.transform=Cd(t,e.transform,n):s.transform&&(s.transform="none")),l){const{originX:c="50%",originY:d="50%",originZ:u=0}=r;s.transformOrigin=`${c} ${d} ${u}`}}const Us=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Dr(e,t,n){for(const s in t)!be(t[s])&&!Ir(s,n)&&(e[s]=t[s])}function kd({transformTemplate:e},t){return y.useMemo(()=>{const n=Us();return Zs(n,t,e),Object.assign({},n.vars,n.style)},[t])}function jd(e,t){const n=e.style||{},s={};return Dr(s,n,e),Object.assign(s,kd(e,t)),s}function Ed(e,t){const n={},s=jd(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}const Ad={offset:"stroke-dashoffset",array:"stroke-dasharray"},Md={offset:"strokeDashoffset",array:"strokeDasharray"};function Td(e,t,n=1,s=0,o=!0){e.pathLength=1;const r=o?Ad:Md;e[r.offset]=U.transform(-s);const i=U.transform(t),l=U.transform(n);e[r.array]=`${i} ${l}`}function Fr(e,{attrX:t,attrY:n,attrScale:s,pathLength:o,pathSpacing:r=1,pathOffset:i=0,...l},c,d,u){if(Zs(e,l,d),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:m,style:f}=e;m.transform&&(f.transform=m.transform,delete m.transform),(f.transform||m.transformOrigin)&&(f.transformOrigin=m.transformOrigin??"50% 50%",delete m.transformOrigin),f.transform&&(f.transformBox=(u==null?void 0:u.transformBox)??"fill-box",delete m.transformBox),t!==void 0&&(m.x=t),n!==void 0&&(m.y=n),s!==void 0&&(m.scale=s),o!==void 0&&Td(m,o,r,i,!1)}const Lr=()=>({...Us(),attrs:{}}),Br=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Vd(e,t,n,s){const o=y.useMemo(()=>{const r=Lr();return Fr(r,t,Br(s),e.transformTemplate,e.style),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const r={};Dr(r,e.style,e),o.style={...r,...o.style}}return o}const Nd=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function zs(e){return typeof e!="string"||e.includes("-")?!1:!!(Nd.indexOf(e)>-1||/[A-Z]/u.test(e))}function Pd(e,t,n,{latestValues:s},o,r=!1){const l=(zs(e)?Vd:Ed)(t,s,o,e),c=xd(t,typeof e=="string",r),d=e!==y.Fragment?{...c,...l,ref:n}:{},{children:u}=t,m=y.useMemo(()=>be(u)?u.get():u,[u]);return y.createElement(e,{...d,children:m})}function No(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function Ws(e,t,n,s){if(typeof t=="function"){const[o,r]=No(s);t=t(n!==void 0?n:e.custom,o,r)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[o,r]=No(s);t=t(n!==void 0?n:e.custom,o,r)}return t}function tn(e){return be(e)?e.get():e}function Rd({scrapeMotionValuesFromProps:e,createRenderState:t},n,s,o){return{latestValues:Id(n,s,o,e),renderState:t()}}function Id(e,t,n,s){const o={},r=s(e,{});for(const f in r)o[f]=tn(r[f]);let{initial:i,animate:l}=e;const c=pn(e),d=Rr(e);t&&d&&!c&&e.inherit!==!1&&(i===void 0&&(i=t.initial),l===void 0&&(l=t.animate));let u=n?n.initial===!1:!1;u=u||i===!1;const m=u?l:i;if(m&&typeof m!="boolean"&&!fn(m)){const f=Array.isArray(m)?m:[m];for(let p=0;p<f.length;p++){const g=Ws(e,f[p]);if(g){const{transitionEnd:x,transition:v,...E}=g;for(const b in E){let S=E[b];if(Array.isArray(S)){const w=u?S.length-1:0;S=S[w]}S!==null&&(o[b]=S)}for(const b in x)o[b]=x[b]}}}return o}const $r=e=>(t,n)=>{const s=y.useContext(mn),o=y.useContext(hn),r=()=>Rd(e,t,s,o);return n?r():xs(r)};function Ks(e,t,n){var r;const{style:s}=e,o={};for(const i in s)(be(s[i])||t.style&&be(t.style[i])||Ir(i,e)||((r=n==null?void 0:n.getValue(i))==null?void 0:r.liveStyle)!==void 0)&&(o[i]=s[i]);return o}const Dd=$r({scrapeMotionValuesFromProps:Ks,createRenderState:Us});function Or(e,t,n){const s=Ks(e,t,n);for(const o in e)if(be(e[o])||be(t[o])){const r=yt.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;s[r]=e[o]}return s}const Fd=$r({scrapeMotionValuesFromProps:Or,createRenderState:Lr}),Ld=Symbol.for("motionComponentSymbol");function at(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Bd(e,t,n){return y.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),n&&(typeof n=="function"?n(s):at(n)&&(n.current=s))},[t])}const Gs=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),$d="framerAppearId",_r="data-"+Gs($d),Hr=y.createContext({});function Od(e,t,n,s,o){var x,v;const{visualElement:r}=y.useContext(mn),i=y.useContext(Nr),l=y.useContext(hn),c=y.useContext(Os).reducedMotion,d=y.useRef(null);s=s||i.renderer,!d.current&&s&&(d.current=s(e,{visualState:t,parent:r,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const u=d.current,m=y.useContext(Hr);u&&!u.projection&&o&&(u.type==="html"||u.type==="svg")&&_d(d.current,n,o,m);const f=y.useRef(!1);y.useInsertionEffect(()=>{u&&f.current&&u.update(n,l)});const p=n[_r],g=y.useRef(!!p&&!((x=window.MotionHandoffIsComplete)!=null&&x.call(window,p))&&((v=window.MotionHasOptimisedAnimation)==null?void 0:v.call(window,p)));return $i(()=>{u&&(f.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),u.scheduleRenderMicrotask(),g.current&&u.animationState&&u.animationState.animateChanges())}),y.useEffect(()=>{u&&(!g.current&&u.animationState&&u.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{var E;(E=window.MotionHandoffMarkAsComplete)==null||E.call(window,p)}),g.current=!1),u.enteringChildren=void 0)}),u}function _d(e,t,n,s){const{layoutId:o,layout:r,drag:i,dragConstraints:l,layoutScroll:c,layoutRoot:d,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Zr(e.parent)),e.projection.setOptions({layoutId:o,layout:r,alwaysMeasureLayout:!!i||l&&at(l),visualElement:e,animationType:typeof r=="string"?r:"both",initialPromotionConfig:s,crossfade:u,layoutScroll:c,layoutRoot:d})}function Zr(e){if(e)return e.options.allowProjection!==!1?e.projection:Zr(e.parent)}function An(e,{forwardMotionProps:t=!1}={},n,s){n&&fd(n);const o=zs(e)?Fd:Dd;function r(l,c){let d;const u={...y.useContext(Os),...l,layoutId:Hd(l)},{isStatic:m}=u,f=bd(l),p=o(l,m);if(!m&&ys){Zd(u,n);const g=Ud(u);d=g.MeasureLayout,f.visualElement=Od(e,p,u,s,g.ProjectionNode)}return a.jsxs(mn.Provider,{value:f,children:[d&&f.visualElement?a.jsx(d,{visualElement:f.visualElement,...u}):null,Pd(e,l,Bd(p,f.visualElement,c),p,m,t)]})}r.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const i=y.forwardRef(r);return i[Ld]=e,i}function Hd({layoutId:e}){const t=y.useContext(gs).id;return t&&e!==void 0?t+"-"+e:e}function Zd(e,t){const n=y.useContext(Nr).strict;if(process.env.NODE_ENV!=="production"&&t&&n){const s="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?gt(!1,s,"lazy-strict-mode"):Oe(!1,s,"lazy-strict-mode")}}function Ud(e){const{drag:t,layout:n}=ft;if(!t&&!n)return{};const s={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function zd(e,t){if(typeof Proxy>"u")return An;const n=new Map,s=(r,i)=>An(r,i,e,t),o=(r,i)=>(process.env.NODE_ENV!=="production"&&Cs(!1,"motion() is deprecated. Use motion.create() instead."),s(r,i));return new Proxy(o,{get:(r,i)=>i==="create"?s:(n.has(i)||n.set(i,An(i,void 0,e,t)),n.get(i))})}function Ur({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function Wd({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Kd(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function Mn(e){return e===void 0||e===1}function ns({scale:e,scaleX:t,scaleY:n}){return!Mn(e)||!Mn(t)||!Mn(n)}function qe(e){return ns(e)||zr(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function zr(e){return Po(e.x)||Po(e.y)}function Po(e){return e&&e!=="0%"}function dn(e,t,n){const s=e-n,o=t*s;return n+o}function Ro(e,t,n,s,o){return o!==void 0&&(e=dn(e,o,s)),dn(e,n,s)+t}function ss(e,t=0,n=1,s,o){e.min=Ro(e.min,t,n,s,o),e.max=Ro(e.max,t,n,s,o)}function Wr(e,{x:t,y:n}){ss(e.x,t.translate,t.scale,t.originPoint),ss(e.y,n.translate,n.scale,n.originPoint)}const Io=.999999999999,Do=1.0000000000001;function Gd(e,t,n,s=!1){const o=n.length;if(!o)return;t.x=t.y=1;let r,i;for(let l=0;l<o;l++){r=n[l],i=r.projectionDelta;const{visualElement:c}=r.options;c&&c.props.style&&c.props.style.display==="contents"||(s&&r.options.layoutScroll&&r.scroll&&r!==r.root&&ct(e,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),i&&(t.x*=i.x.scale,t.y*=i.y.scale,Wr(e,i)),s&&qe(r.latestValues)&&ct(e,r.latestValues))}t.x<Do&&t.x>Io&&(t.x=1),t.y<Do&&t.y>Io&&(t.y=1)}function lt(e,t){e.min=e.min+t,e.max=e.max+t}function Fo(e,t,n,s,o=.5){const r=le(e.min,e.max,o);ss(e,t,n,r,s)}function ct(e,t){Fo(e.x,t.x,t.scaleX,t.scale,t.originX),Fo(e.y,t.y,t.scaleY,t.scale,t.originY)}function Kr(e,t){return Ur(Kd(e.getBoundingClientRect(),t))}function Yd(e,t,n){const s=Kr(e,n),{scroll:o}=t;return o&&(lt(s.x,o.offset.x),lt(s.y,o.offset.y)),s}const Lo=()=>({translate:0,scale:1,origin:0,originPoint:0}),dt=()=>({x:Lo(),y:Lo()}),Bo=()=>({min:0,max:0}),de=()=>({x:Bo(),y:Bo()}),os={current:null},Gr={current:!1};function qd(){if(Gr.current=!0,!!ys)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>os.current=e.matches;e.addEventListener("change",t),t()}else os.current=!1}const Xd=new WeakMap;function Jd(e,t,n){for(const s in t){const o=t[s],r=n[s];if(be(o))e.addValue(s,o);else if(be(r))e.addValue(s,mt(o,{owner:e}));else if(r!==o)if(e.hasValue(s)){const i=e.getValue(s);i.liveStyle===!0?i.jump(o):i.hasAnimated||i.set(o)}else{const i=e.getStaticValue(s);e.addValue(s,mt(i!==void 0?i:o,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const $o=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Qd{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:o,blockInitialAnimation:r,visualState:i},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ds,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=Se.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,ie.render(this.render,!1,!0))};const{latestValues:c,renderState:d}=i;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=o,this.options=l,this.blockInitialAnimation=!!r,this.isControllingVariants=pn(n),this.isVariantNode=Rr(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...m}=this.scrapeMotionValuesFromProps(n,{},this);for(const f in m){const p=m[f];c[f]!==void 0&&be(p)&&p.set(c[f])}}mount(t){var n;this.current=t,Xd.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,o)=>this.bindToMotionValue(o,s)),Gr.current||qd(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:os.current,process.env.NODE_ENV!=="production"&&Cs(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var t;this.projection&&this.projection.unmount(),ze(this.notifyUpdate),ze(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const s=this.features[n];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=bt.has(t);s&&this.onBindTransform&&this.onBindTransform();const o=n.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&ie.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let r;window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{o(),r&&r(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in ft){const n=ft[t];if(!n)continue;const{isEnabled:s,Feature:o}=n;if(!this.features[t]&&o&&s(this.props)&&(this.features[t]=new o(this)),this.features[t]){const r=this.features[t];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):de()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<$o.length;s++){const o=$o[s];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const r="on"+o,i=t[r];i&&(this.propEventSubscriptions[o]=this.on(o,i))}this.prevMotionValues=Jd(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=mt(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(Oi(s)||Hi(s))?s=parseFloat(s):!cd(s)&&We.test(n)&&(s=Cr(t,n)),this.setBaseTarget(t,be(s)?s.get():s)),be(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var r;const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const i=Ws(this.props,n,(r=this.presenceContext)==null?void 0:r.custom);i&&(s=i[t])}if(n&&s!==void 0)return s;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!be(o)?o:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Ss),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){Bs.render(this.render)}}class Yr extends Qd{constructor(){super(...arguments),this.KeyframeResolver=Xc}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;be(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function qr(e,{style:t,vars:n},s,o){const r=e.style;let i;for(i in t)r[i]=t[i];o==null||o.applyProjectionStyles(r,s);for(i in n)r.setProperty(i,n[i])}function eu(e){return window.getComputedStyle(e)}class tu extends Yr{constructor(){super(...arguments),this.type="html",this.renderInstance=qr}readValueFromInstance(t,n){var s;if(bt.has(n))return(s=this.projection)!=null&&s.isProjecting?Yn(n):pc(t,n);{const o=eu(t),r=(Es(n)?o.getPropertyValue(n):o[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Kr(t,n)}build(t,n,s){Zs(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return Ks(t,n,s)}}const Xr=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function nu(e,t,n,s){qr(e,t,void 0,s);for(const o in t.attrs)e.setAttribute(Xr.has(o)?o:Gs(o),t.attrs[o])}class su extends Yr{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=de}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(bt.has(n)){const s=Sr(n);return s&&s.default||0}return n=Xr.has(n)?n:Gs(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return Or(t,n,s)}build(t,n,s){Fr(t,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(t,n,s,o){nu(t,n,s,o)}mount(t){this.isSVGTag=Br(t.tagName),super.mount(t)}}const ou=(e,t)=>zs(e)?new su(t):new tu(t,{allowProjection:e!==y.Fragment});function ht(e,t,n){const s=e.getProps();return Ws(s,t,n!==void 0?n:s.custom,e)}const is=e=>Array.isArray(e);function iu(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,mt(n))}function ru(e){return is(e)?e[e.length-1]||0:e}function au(e,t){const n=ht(e,t);let{transitionEnd:s={},transition:o={},...r}=n||{};r={...r,...s};for(const i in r){const l=ru(r[i]);iu(e,i,l)}}function lu(e){return!!(be(e)&&e.add)}function rs(e,t){const n=e.getValue("willChange");if(lu(n))return n.add(t);if(!n&&_e.WillChange){const s=new _e.WillChange("auto");e.addValue("willChange",s),s.add(t)}}function Jr(e){return e.props[_r]}const cu=e=>e!==null;function du(e,{repeat:t,repeatType:n="loop"},s){const o=e.filter(cu),r=t&&n!=="loop"&&t%2===1?0:o.length-1;return o[r]}const uu={type:"spring",stiffness:500,damping:25,restSpeed:10},hu=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),mu={type:"keyframes",duration:.8},fu={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},pu=(e,{keyframes:t})=>t.length>2?mu:bt.has(e)?e.startsWith("scale")?hu(t[1]):uu:fu;function gu({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:o,repeat:r,repeatType:i,repeatDelay:l,from:c,elapsed:d,...u}){return!!Object.keys(u).length}const Ys=(e,t,n,s={},o,r)=>i=>{const l=Fs(s,e)||{},c=l.delay||s.delay||0;let{elapsed:d=0}=s;d=d-Ve(c);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-d,onUpdate:f=>{t.set(f),l.onUpdate&&l.onUpdate(f)},onComplete:()=>{i(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:r?void 0:o};gu(l)||Object.assign(u,pu(e,u)),u.duration&&(u.duration=Ve(u.duration)),u.repeatDelay&&(u.repeatDelay=Ve(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let m=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(es(u),u.delay===0&&(m=!0)),(_e.instantAnimations||_e.skipAnimations)&&(m=!0,es(u),u.delay=0),u.allowFlatten=!l.type&&!l.ease,m&&!r&&t.get()!==void 0){const f=du(u.keyframes,l);if(f!==void 0){ie.update(()=>{u.onUpdate(f),u.onComplete()});return}}return l.isSync?new Is(u):new Bc(u)};function xu({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function Qr(e,t,{delay:n=0,transitionOverride:s,type:o}={}){let{transition:r=e.getDefaultTransition(),transitionEnd:i,...l}=t;s&&(r=s);const c=[],d=o&&e.animationState&&e.animationState.getState()[o];for(const u in l){const m=e.getValue(u,e.latestValues[u]??null),f=l[u];if(f===void 0||d&&xu(d,u))continue;const p={delay:n,...Fs(r||{},u)},g=m.get();if(g!==void 0&&!m.isAnimating&&!Array.isArray(f)&&f===g&&!p.velocity)continue;let x=!1;if(window.MotionHandoffAnimation){const E=Jr(e);if(E){const b=window.MotionHandoffAnimation(E,u,ie);b!==null&&(p.startTime=b,x=!0)}}rs(e,u),m.start(Ys(u,m,f,e.shouldReduceMotion&&br.has(u)?{type:!1}:p,e,x));const v=m.animation;v&&c.push(v)}return i&&Promise.all(c).then(()=>{ie.update(()=>{i&&au(e,i)})}),c}function ea(e,t,n,s=0,o=1){const r=Array.from(e).sort((d,u)=>d.sortNodePosition(u)).indexOf(t),i=e.size,l=(i-1)*s;return typeof n=="function"?n(r,i):o===1?r*s:l-r*s}function as(e,t,n={}){var c;const s=ht(e,t,n.type==="exit"?(c=e.presenceContext)==null?void 0:c.custom:void 0);let{transition:o=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(o=n.transitionOverride);const r=s?()=>Promise.all(Qr(e,s,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:u=0,staggerChildren:m,staggerDirection:f}=o;return yu(e,t,d,u,m,f,n)}:()=>Promise.resolve(),{when:l}=o;if(l){const[d,u]=l==="beforeChildren"?[r,i]:[i,r];return d().then(()=>u())}else return Promise.all([r(),i(n.delay)])}function yu(e,t,n=0,s=0,o=0,r=1,i){const l=[];for(const c of e.variantChildren)c.notify("AnimationStart",t),l.push(as(c,t,{...i,delay:n+(typeof s=="function"?0:s)+ea(e.variantChildren,c,s,o,r)}).then(()=>c.notify("AnimationComplete",t)));return Promise.all(l)}function bu(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const o=t.map(r=>as(e,r,n));s=Promise.all(o)}else if(typeof t=="string")s=as(e,t,n);else{const o=typeof t=="function"?ht(e,t,n.custom):t;s=Promise.all(Qr(e,o,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}function ta(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s<n;s++)if(t[s]!==e[s])return!1;return!0}const vu=Hs.length;function na(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?na(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<vu;n++){const s=Hs[n],o=e.props[s];(It(o)||o===!1)&&(t[s]=o)}return t}const wu=[..._s].reverse(),Su=_s.length;function Cu(e){return t=>Promise.all(t.map(({animation:n,options:s})=>bu(e,n,s)))}function ku(e){let t=Cu(e),n=Oo(),s=!0;const o=c=>(d,u)=>{var f;const m=ht(e,u,c==="exit"?(f=e.presenceContext)==null?void 0:f.custom:void 0);if(m){const{transition:p,transitionEnd:g,...x}=m;d={...d,...x,...g}}return d};function r(c){t=c(e)}function i(c){const{props:d}=e,u=na(e.parent)||{},m=[],f=new Set;let p={},g=1/0;for(let v=0;v<Su;v++){const E=wu[v],b=n[E],S=d[E]!==void 0?d[E]:u[E],w=It(S),C=E===c?b.isActive:null;C===!1&&(g=v);let A=S===u[E]&&S!==d[E]&&w;if(A&&s&&e.manuallyAnimateOnMount&&(A=!1),b.protectedKeys={...p},!b.isActive&&C===null||!S&&!b.prevProp||fn(S)||typeof S=="boolean")continue;const j=ju(b.prevProp,S);let k=j||E===c&&b.isActive&&!A&&w||v>g&&w,D=!1;const L=Array.isArray(S)?S:[S];let W=L.reduce(o(E),{});C===!1&&(W={});const{prevResolvedValues:H={}}=b,Ce={...H,...W},ne=z=>{k=!0,f.has(z)&&(D=!0,f.delete(z)),b.needsAnimating[z]=!0;const M=e.getValue(z);M&&(M.liveStyle=!1)};for(const z in Ce){const M=W[z],G=H[z];if(p.hasOwnProperty(z))continue;let Y=!1;is(M)&&is(G)?Y=!ta(M,G):Y=M!==G,Y?M!=null?ne(z):f.add(z):M!==void 0&&f.has(z)?ne(z):b.protectedKeys[z]=!0}b.prevProp=S,b.prevResolvedValues=W,b.isActive&&(p={...p,...W}),s&&e.blockInitialAnimation&&(k=!1);const te=A&&j;k&&(!te||D)&&m.push(...L.map(z=>{const M={type:E};if(typeof z=="string"&&s&&!te&&e.manuallyAnimateOnMount&&e.parent){const{parent:G}=e,Y=ht(G,z);if(G.enteringChildren&&Y){const{delayChildren:V}=Y.transition||{};M.delay=ea(G.enteringChildren,e,V)}}return{animation:z,options:M}}))}if(f.size){const v={};if(typeof d.initial!="boolean"){const E=ht(e,Array.isArray(d.initial)?d.initial[0]:d.initial);E&&E.transition&&(v.transition=E.transition)}f.forEach(E=>{const b=e.getBaseTarget(E),S=e.getValue(E);S&&(S.liveStyle=!0),v[E]=b??null}),m.push({animation:v})}let x=!!m.length;return s&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(x=!1),s=!1,x?t(m):Promise.resolve()}function l(c,d){var m;if(n[c].isActive===d)return Promise.resolve();(m=e.variantChildren)==null||m.forEach(f=>{var p;return(p=f.animationState)==null?void 0:p.setActive(c,d)}),n[c].isActive=d;const u=i(c);for(const f in n)n[f].protectedKeys={};return u}return{animateChanges:i,setActive:l,setAnimateFunction:r,getState:()=>n,reset:()=>{n=Oo(),s=!0}}}function ju(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!ta(t,e):!1}function Ge(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Oo(){return{animate:Ge(!0),whileInView:Ge(),whileHover:Ge(),whileTap:Ge(),whileDrag:Ge(),whileFocus:Ge(),exit:Ge()}}class Ke{constructor(t){this.isMounted=!1,this.node=t}update(){}}class Eu extends Ke{constructor(t){super(t),t.animationState||(t.animationState=ku(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();fn(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let Au=0;class Mu extends Ke{constructor(){super(...arguments),this.id=Au++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const o=this.node.animationState.setActive("exit",!t);n&&!t&&o.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const Tu={animation:{Feature:Eu},exit:{Feature:Mu}};function Ft(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}function Ot(e){return{point:{x:e.pageX,y:e.pageY}}}const Vu=e=>t=>$s(t)&&e(t,Ot(t));function Mt(e,t,n,s){return Ft(e,t,Vu(n),s)}const sa=1e-4,Nu=1-sa,Pu=1+sa,oa=.01,Ru=0-oa,Iu=0+oa;function we(e){return e.max-e.min}function Du(e,t,n){return Math.abs(e-t)<=n}function _o(e,t,n,s=.5){e.origin=s,e.originPoint=le(t.min,t.max,e.origin),e.scale=we(n)/we(t),e.translate=le(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Nu&&e.scale<=Pu||isNaN(e.scale))&&(e.scale=1),(e.translate>=Ru&&e.translate<=Iu||isNaN(e.translate))&&(e.translate=0)}function Tt(e,t,n,s){_o(e.x,t.x,n.x,s?s.originX:void 0),_o(e.y,t.y,n.y,s?s.originY:void 0)}function Ho(e,t,n){e.min=n.min+t.min,e.max=e.min+we(t)}function Fu(e,t,n){Ho(e.x,t.x,n.x),Ho(e.y,t.y,n.y)}function Zo(e,t,n){e.min=t.min-n.min,e.max=e.min+we(t)}function Vt(e,t,n){Zo(e.x,t.x,n.x),Zo(e.y,t.y,n.y)}function je(e){return[e("x"),e("y")]}const ia=({current:e})=>e?e.ownerDocument.defaultView:null,Uo=(e,t)=>Math.abs(e-t);function Lu(e,t){const n=Uo(e.x,t.x),s=Uo(e.y,t.y);return Math.sqrt(n**2+s**2)}class ra{constructor(t,n,{transformPagePoint:s,contextWindow:o=window,dragSnapToOrigin:r=!1,distanceThreshold:i=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Vn(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=Lu(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!g)return;const{point:x}=f,{timestamp:v}=xe;this.history.push({...x,timestamp:v});const{onStart:E,onMove:b}=this.handlers;p||(E&&E(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),b&&b(this.lastMoveEvent,f)},this.handlePointerMove=(f,p)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Tn(p,this.transformPagePoint),ie.update(this.updatePoint,!0)},this.handlePointerUp=(f,p)=>{this.end();const{onEnd:g,onSessionEnd:x,resumeAnimation:v}=this.handlers;if(this.dragSnapToOrigin&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const E=Vn(f.type==="pointercancel"?this.lastMoveEventInfo:Tn(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(f,E),x&&x(f,E)},!$s(t))return;this.dragSnapToOrigin=r,this.handlers=n,this.transformPagePoint=s,this.distanceThreshold=i,this.contextWindow=o||window;const l=Ot(t),c=Tn(l,this.transformPagePoint),{point:d}=c,{timestamp:u}=xe;this.history=[{...d,timestamp:u}];const{onSessionStart:m}=n;m&&m(t,Vn(c,this.history)),this.removeListeners=Lt(Mt(this.contextWindow,"pointermove",this.handlePointerMove),Mt(this.contextWindow,"pointerup",this.handlePointerUp),Mt(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),ze(this.updatePoint)}}function Tn(e,t){return t?{point:t(e.point)}:e}function zo(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Vn({point:e},t){return{point:e,delta:zo(e,aa(t)),offset:zo(e,Bu(t)),velocity:$u(t,.1)}}function Bu(e){return e[0]}function aa(e){return e[e.length-1]}function $u(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const o=aa(e);for(;n>=0&&(s=e[n],!(o.timestamp-s.timestamp>Ve(t)));)n--;if(!s)return{x:0,y:0};const r=Pe(o.timestamp-s.timestamp);if(r===0)return{x:0,y:0};const i={x:(o.x-s.x)/r,y:(o.y-s.y)/r};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function Ou(e,{min:t,max:n},s){return t!==void 0&&e<t?e=s?le(t,e,s.min):Math.max(e,t):n!==void 0&&e>n&&(e=s?le(n,e,s.max):Math.min(e,n)),e}function Wo(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function _u(e,{top:t,left:n,bottom:s,right:o}){return{x:Wo(e.x,n,o),y:Wo(e.y,t,s)}}function Ko(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,s]=[s,n]),{min:n,max:s}}function Hu(e,t){return{x:Ko(e.x,t.x),y:Ko(e.y,t.y)}}function Zu(e,t){let n=.5;const s=we(e),o=we(t);return o>s?n=Nt(t.min,t.max-s,e.min):s>o&&(n=Nt(e.min,e.max-o,t.min)),$e(0,1,n)}function Uu(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const ls=.35;function zu(e=ls){return e===!1?e=0:e===!0&&(e=ls),{x:Go(e,"left","right"),y:Go(e,"top","bottom")}}function Go(e,t,n){return{min:Yo(e,t),max:Yo(e,n)}}function Yo(e,t){return typeof e=="number"?e:e[t]||0}const Wu=new WeakMap;class Ku{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=de(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:s}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const r=m=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Ot(m).point)},i=(m,f)=>{const{drag:p,dragPropagation:g,onDragStart:x}=this.getProps();if(p&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=td(p),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),je(E=>{let b=this.getAxisMotionValue(E).get()||0;if(Re.test(b)){const{projection:S}=this.visualElement;if(S&&S.layout){const w=S.layout.layoutBox[E];w&&(b=we(w)*(parseFloat(b)/100))}}this.originPoint[E]=b}),x&&ie.postRender(()=>x(m,f)),rs(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},l=(m,f)=>{this.latestPointerEvent=m,this.latestPanInfo=f;const{dragPropagation:p,dragDirectionLock:g,onDirectionLock:x,onDrag:v}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:E}=f;if(g&&this.currentDirection===null){this.currentDirection=Gu(E),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",f.point,E),this.updateAxis("y",f.point,E),this.visualElement.render(),v&&v(m,f)},c=(m,f)=>{this.latestPointerEvent=m,this.latestPanInfo=f,this.stop(m,f),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>je(m=>{var f;return this.getAnimationState(m)==="paused"&&((f=this.getAxisMotionValue(m).animation)==null?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new ra(t,{onSessionStart:r,onStart:i,onMove:l,onSessionEnd:c,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:s,contextWindow:ia(this.visualElement)})}stop(t,n){const s=t||this.latestPointerEvent,o=n||this.latestPanInfo,r=this.isDragging;if(this.cancel(),!r||!o||!s)return;const{velocity:i}=o;this.startAnimation(i);const{onDragEnd:l}=this.getProps();l&&ie.postRender(()=>l(s,o))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,s){const{drag:o}=this.getProps();if(!s||!Gt(t,o,this.currentDirection))return;const r=this.getAxisMotionValue(t);let i=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(i=Ou(i,this.constraints[t],this.elastic[t])),r.set(i)}resolveConstraints(){var r;const{dragConstraints:t,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(r=this.visualElement.projection)==null?void 0:r.layout,o=this.constraints;t&&at(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&s?this.constraints=_u(s.layoutBox,t):this.constraints=!1,this.elastic=zu(n),o!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&je(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=Uu(s.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!at(t))return!1;const s=t.current;Oe(s!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const r=Yd(s,o.root,this.visualElement.getTransformPagePoint());let i=Hu(o.layout.layoutBox,r);if(n){const l=n(Wd(i));this.hasMutatedConstraints=!!l,l&&(i=Ur(l))}return i}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:o,dragTransition:r,dragSnapToOrigin:i,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},d=je(u=>{if(!Gt(u,n,this.currentDirection))return;let m=c&&c[u]||{};i&&(m={min:0,max:0});const f=o?200:1e6,p=o?40:1e7,g={type:"inertia",velocity:s?t[u]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...r,...m};return this.startAxisValueAnimation(u,g)});return Promise.all(d).then(l)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return rs(this.visualElement,t),s.start(Ys(t,s,0,n,this.visualElement,!1))}stopAnimation(){je(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){je(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),o=s[n];return o||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){je(n=>{const{drag:s}=this.getProps();if(!Gt(n,s,this.currentDirection))return;const{projection:o}=this.visualElement,r=this.getAxisMotionValue(n);if(o&&o.layout){const{min:i,max:l}=o.layout.layoutBox[n];r.set(t[n]-le(i,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!at(n)||!s||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};je(i=>{const l=this.getAxisMotionValue(i);if(l&&this.constraints!==!1){const c=l.get();o[i]=Zu({min:c,max:c},this.constraints[i])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),je(i=>{if(!Gt(i,t,null))return;const l=this.getAxisMotionValue(i),{min:c,max:d}=this.constraints[i];l.set(le(c,d,o[i]))})}addListeners(){if(!this.visualElement.current)return;Wu.set(this.visualElement,this);const t=this.visualElement.current,n=Mt(t,"pointerdown",c=>{const{drag:d,dragListener:u=!0}=this.getProps();d&&u&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();at(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,r=o.addEventListener("measure",s);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),ie.read(s);const i=Ft(window,"resize",()=>this.scalePositionWithinConstraints()),l=o.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(je(u=>{const m=this.getAxisMotionValue(u);m&&(this.originPoint[u]+=c[u].translate,m.set(m.get()+c[u].translate))}),this.visualElement.render())});return()=>{i(),n(),r(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:o=!1,dragConstraints:r=!1,dragElastic:i=ls,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:o,dragConstraints:r,dragElastic:i,dragMomentum:l}}}function Gt(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Gu(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class Yu extends Ke{constructor(t){super(t),this.removeGroupControls=Ae,this.removeListeners=Ae,this.controls=new Ku(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ae}unmount(){this.removeGroupControls(),this.removeListeners()}}const qo=e=>(t,n)=>{e&&ie.postRender(()=>e(t,n))};class qu extends Ke{constructor(){super(...arguments),this.removePointerDownListener=Ae}onPointerDown(t){this.session=new ra(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:ia(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:o}=this.node.getProps();return{onSessionStart:qo(t),onStart:qo(n),onMove:s,onEnd:(r,i)=>{delete this.session,o&&ie.postRender(()=>o(r,i))}}}mount(){this.removePointerDownListener=Mt(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const nn={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Xo(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const kt={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(U.test(e))e=parseFloat(e);else return e;const n=Xo(e,t.target.x),s=Xo(e,t.target.y);return`${n}% ${s}%`}},Xu={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,o=We.parse(e);if(o.length>5)return s;const r=We.createTransformer(e),i=typeof o[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;o[0+i]/=l,o[1+i]/=c;const d=le(l,c,.5);return typeof o[2+i]=="number"&&(o[2+i]/=d),typeof o[3+i]=="number"&&(o[3+i]/=d),r(o)}};let Nn=!1;class Ju extends y.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:o}=this.props,{projection:r}=t;vd(Qu),r&&(n.group&&n.group.add(r),s&&s.register&&o&&s.register(r),Nn&&r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),nn.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:o,isPresent:r}=this.props,{projection:i}=s;return i&&(i.isPresent=r,Nn=!0,o||t.layoutDependency!==n||n===void 0||t.isPresent!==r?i.willUpdate():this.safeToRemove(),t.isPresent!==r&&(r?i.promote():i.relegate()||ie.postRender(()=>{const l=i.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Bs.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:o}=t;Nn=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),s&&s.deregister&&s.deregister(o))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function la(e){const[t,n]=Vr(),s=y.useContext(gs);return a.jsx(Ju,{...e,layoutGroup:s,switchLayoutGroup:y.useContext(Hr),isPresent:t,safeToRemove:n})}const Qu={borderRadius:{...kt,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:kt,borderTopRightRadius:kt,borderBottomLeftRadius:kt,borderBottomRightRadius:kt,boxShadow:Xu};function eh(e,t,n){const s=be(e)?e:mt(e);return s.start(Ys("",s,t,n)),s.animation}const th=(e,t)=>e.depth-t.depth;class nh{constructor(){this.children=[],this.isDirty=!1}add(t){bs(this.children,t),this.isDirty=!0}remove(t){vs(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(th),this.isDirty=!1,this.children.forEach(t)}}function sh(e,t){const n=Se.now(),s=({timestamp:o})=>{const r=o-n;r>=t&&(ze(s),e(r-t))};return ie.setup(s,!0),()=>ze(s)}const ca=["TopLeft","TopRight","BottomLeft","BottomRight"],oh=ca.length,Jo=e=>typeof e=="string"?parseFloat(e):e,Qo=e=>typeof e=="number"||U.test(e);function ih(e,t,n,s,o,r){o?(e.opacity=le(0,n.opacity??1,rh(s)),e.opacityExit=le(t.opacity??1,0,ah(s))):r&&(e.opacity=le(t.opacity??1,n.opacity??1,s));for(let i=0;i<oh;i++){const l=`border${ca[i]}Radius`;let c=ei(t,l),d=ei(n,l);if(c===void 0&&d===void 0)continue;c||(c=0),d||(d=0),c===0||d===0||Qo(c)===Qo(d)?(e[l]=Math.max(le(Jo(c),Jo(d),s),0),(Re.test(d)||Re.test(c))&&(e[l]+="%")):e[l]=d}(t.rotate||n.rotate)&&(e.rotate=le(t.rotate||0,n.rotate||0,s))}function ei(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const rh=da(0,.5,qi),ah=da(.5,.95,Ae);function da(e,t,n){return s=>s<e?0:s>t?1:n(Nt(e,t,s))}function ti(e,t){e.min=t.min,e.max=t.max}function ke(e,t){ti(e.x,t.x),ti(e.y,t.y)}function ni(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function si(e,t,n,s,o){return e-=t,e=dn(e,1/n,s),o!==void 0&&(e=dn(e,1/o,s)),e}function lh(e,t=0,n=1,s=.5,o,r=e,i=e){if(Re.test(t)&&(t=parseFloat(t),t=le(i.min,i.max,t/100)-i.min),typeof t!="number")return;let l=le(r.min,r.max,s);e===r&&(l-=t),e.min=si(e.min,t,n,l,o),e.max=si(e.max,t,n,l,o)}function oi(e,t,[n,s,o],r,i){lh(e,t[n],t[s],t[o],t.scale,r,i)}const ch=["x","scaleX","originX"],dh=["y","scaleY","originY"];function ii(e,t,n,s){oi(e.x,t,ch,n?n.x:void 0,s?s.x:void 0),oi(e.y,t,dh,n?n.y:void 0,s?s.y:void 0)}function ri(e){return e.translate===0&&e.scale===1}function ua(e){return ri(e.x)&&ri(e.y)}function ai(e,t){return e.min===t.min&&e.max===t.max}function uh(e,t){return ai(e.x,t.x)&&ai(e.y,t.y)}function li(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function ha(e,t){return li(e.x,t.x)&&li(e.y,t.y)}function ci(e){return we(e.x)/we(e.y)}function di(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class hh{constructor(){this.members=[]}add(t){bs(this.members,t),t.scheduleRender()}remove(t){if(vs(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(o=>t===o);if(n===0)return!1;let s;for(let o=n;o>=0;o--){const r=this.members[o];if(r.isPresent!==!1){s=r;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:o}=t.options;o===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function mh(e,t,n){let s="";const o=e.x.translate/t.x,r=e.y.translate/t.y,i=(n==null?void 0:n.z)||0;if((o||r||i)&&(s=`translate3d(${o}px, ${r}px, ${i}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:u,rotateX:m,rotateY:f,skewX:p,skewY:g}=n;d&&(s=`perspective(${d}px) ${s}`),u&&(s+=`rotate(${u}deg) `),m&&(s+=`rotateX(${m}deg) `),f&&(s+=`rotateY(${f}deg) `),p&&(s+=`skewX(${p}deg) `),g&&(s+=`skewY(${g}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(s+=`scale(${l}, ${c})`),s||"none"}const Pn=["","X","Y","Z"],fh=1e3;let ph=0;function Rn(e,t,n,s){const{latestValues:o}=t;o[e]&&(n[e]=o[e],t.setStaticValue(e,0),s&&(s[e]=0))}function ma(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Jr(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ie,!(o||r))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&ma(s)}function fa({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:o}){return class{constructor(i={},l=t==null?void 0:t()){this.id=ph++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(yh),this.nodes.forEach(Sh),this.nodes.forEach(Ch),this.nodes.forEach(bh)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new nh)}addEventListener(i,l){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new Ss),this.eventHandlers.get(i).add(l)}notifyListeners(i,...l){const c=this.eventHandlers.get(i);c&&c.notify(...l)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=Tr(i)&&!ad(i),this.instance=i;const{layoutId:l,layout:c,visualElement:d}=this.options;if(d&&!d.current&&d.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),e){let u,m=0;const f=()=>this.root.updateBlockedByResize=!1;ie.read(()=>{m=window.innerWidth}),e(i,()=>{const p=window.innerWidth;p!==m&&(m=p,this.root.updateBlockedByResize=!0,u&&u(),u=sh(f,250),nn.hasAnimatedSinceResize&&(nn.hasAnimatedSinceResize=!1,this.nodes.forEach(mi)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||c)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:m,hasRelativeLayoutChanged:f,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||d.getDefaultTransition()||Mh,{onLayoutAnimationStart:x,onLayoutAnimationComplete:v}=d.getProps(),E=!this.targetLayout||!ha(this.targetLayout,p),b=!m&&f;if(this.options.layoutRoot||this.resumeFrom||b||m&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const S={...Fs(g,"layout"),onPlay:x,onComplete:v};(d.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S),this.setAnimationOrigin(u,b)}else m||mi(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ze(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(kh),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&ma(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const m=this.path[u];m.shouldResetTransform=!0,m.updateScroll("snapshot"),m.options.layoutRoot&&m.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(ui);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(hi);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(wh),this.nodes.forEach(gh),this.nodes.forEach(xh)):this.nodes.forEach(hi),this.clearAllSnapshots();const l=Se.now();xe.delta=$e(0,1e3/60,l-xe.timestamp),xe.timestamp=l,xe.isProcessing=!0,wn.update.process(xe),wn.preRender.process(xe),wn.render.process(xe),xe.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Bs.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(vh),this.sharedNodes.forEach(jh)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ie.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ie.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!we(this.snapshot.measuredBox.x)&&!we(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const i=this.layout;this.layout=this.measure(!1),this.layoutCorrected=de(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(l=!1),l&&this.instance){const c=s(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!o)return;const i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!ua(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,u=d!==this.prevTransformTemplateValue;i&&this.instance&&(l||qe(this.latestValues)||u)&&(o(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return i&&(c=this.removeTransform(c)),Th(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:i}=this.options;if(!i)return de();const l=i.measureViewportBox();if(!(((d=this.scroll)==null?void 0:d.wasRoot)||this.path.some(Vh))){const{scroll:u}=this.root;u&&(lt(l.x,u.offset.x),lt(l.y,u.offset.y))}return l}removeElementScroll(i){var c;const l=de();if(ke(l,i),(c=this.scroll)!=null&&c.wasRoot)return l;for(let d=0;d<this.path.length;d++){const u=this.path[d],{scroll:m,options:f}=u;u!==this.root&&m&&f.layoutScroll&&(m.wasRoot&&ke(l,i),lt(l.x,m.offset.x),lt(l.y,m.offset.y))}return l}applyTransform(i,l=!1){const c=de();ke(c,i);for(let d=0;d<this.path.length;d++){const u=this.path[d];!l&&u.options.layoutScroll&&u.scroll&&u!==u.root&&ct(c,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),qe(u.latestValues)&&ct(c,u.latestValues)}return qe(this.latestValues)&&ct(c,this.latestValues),c}removeTransform(i){const l=de();ke(l,i);for(let c=0;c<this.path.length;c++){const d=this.path[c];if(!d.instance||!qe(d.latestValues))continue;ns(d.latestValues)&&d.updateSnapshot();const u=de(),m=d.measurePageBox();ke(u,m),ii(l,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,u)}return qe(this.latestValues)&&ii(l,this.latestValues),l}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options={...this.options,...i,crossfade:i.crossfade!==void 0?i.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==xe.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){var f;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(i||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(f=this.parent)!=null&&f.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:m}=this.options;if(!(!this.layout||!(u||m))){if(this.resolvedRelativeTargetAt=xe.timestamp,!this.targetDelta&&!this.relativeTarget){const p=this.getClosestProjectingParent();p&&p.layout&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=de(),this.relativeTargetOrigin=de(),Vt(this.relativeTargetOrigin,this.layout.layoutBox,p.layout.layoutBox),ke(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=de(),this.targetWithTransforms=de()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Fu(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ke(this.target,this.layout.layoutBox),Wr(this.target,this.targetDelta)):ke(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const p=this.getClosestProjectingParent();p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=de(),this.relativeTargetOrigin=de(),Vt(this.relativeTargetOrigin,this.target,p.target),ke(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||ns(this.parent.latestValues)||zr(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var g;const i=this.getLead(),l=!!this.resumingFrom||this!==i;let c=!0;if((this.isProjectionDirty||(g=this.parent)!=null&&g.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===xe.timestamp&&(c=!1),c)return;const{layout:d,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||u))return;ke(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,f=this.treeScale.y;Gd(this.layoutCorrected,this.treeScale,this.path,l),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=de());const{target:p}=i;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(ni(this.prevProjectionDelta.x,this.projectionDelta.x),ni(this.prevProjectionDelta.y,this.projectionDelta.y)),Tt(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==f||!di(this.projectionDelta.x,this.prevProjectionDelta.x)||!di(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),i){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=dt(),this.projectionDelta=dt(),this.projectionDeltaWithTransform=dt()}setAnimationOrigin(i,l=!1){const c=this.snapshot,d=c?c.latestValues:{},u={...this.latestValues},m=dt();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const f=de(),p=c?c.source:void 0,g=this.layout?this.layout.source:void 0,x=p!==g,v=this.getStack(),E=!v||v.members.length<=1,b=!!(x&&!E&&this.options.crossfade===!0&&!this.path.some(Ah));this.animationProgress=0;let S;this.mixTargetDelta=w=>{const C=w/1e3;fi(m.x,i.x,C),fi(m.y,i.y,C),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Vt(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Eh(this.relativeTarget,this.relativeTargetOrigin,f,C),S&&uh(this.relativeTarget,S)&&(this.isProjectionDirty=!1),S||(S=de()),ke(S,this.relativeTarget)),x&&(this.animationValues=u,ih(u,d,this.latestValues,C,b,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){var l,c,d;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(d=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||d.stop(),this.pendingAnimation&&(ze(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ie.update(()=>{nn.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=mt(0)),this.currentAnimation=eh(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),i.onUpdate&&i.onUpdate(u)},onStop:()=>{},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(fh),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:l,target:c,layout:d,latestValues:u}=i;if(!(!l||!c||!d)){if(this!==i&&this.layout&&d&&pa(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||de();const m=we(this.layout.layoutBox.x);c.x.min=i.target.x.min,c.x.max=c.x.min+m;const f=we(this.layout.layoutBox.y);c.y.min=i.target.y.min,c.y.max=c.y.min+f}ke(l,c),ct(l,u),Tt(this.projectionDeltaWithTransform,this.layoutCorrected,l,u)}}registerSharedNode(i,l){this.sharedNodes.has(i)||this.sharedNodes.set(i,new hh),this.sharedNodes.get(i).add(l);const d=l.options.initialPromotionConfig;l.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(l):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){var l;const{layoutId:i}=this.options;return i?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:i}=this.options;return i?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:l,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),i&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let l=!1;const{latestValues:c}=i;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const d={};c.z&&Rn("z",i,d,this.animationValues);for(let u=0;u<Pn.length;u++)Rn(`rotate${Pn[u]}`,i,d,this.animationValues),Rn(`skew${Pn[u]}`,i,d,this.animationValues);i.render();for(const u in d)i.setStaticValue(u,d[u]),this.animationValues&&(this.animationValues[u]=d[u]);i.scheduleRender()}applyProjectionStyles(i,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){i.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,i.visibility="",i.opacity="",i.pointerEvents=tn(l==null?void 0:l.pointerEvents)||"",i.transform=c?c(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(i.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,i.pointerEvents=tn(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!qe(this.latestValues)&&(i.transform=c?c({},""):"none",this.hasProjected=!1);return}i.visibility="";const u=d.animationValues||d.latestValues;this.applyTransformsToTarget();let m=mh(this.projectionDeltaWithTransform,this.treeScale,u);c&&(m=c(u,m)),i.transform=m;const{x:f,y:p}=this.projectionDelta;i.transformOrigin=`${f.origin*100}% ${p.origin*100}% 0`,d.animationValues?i.opacity=d===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:i.opacity=d===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const g in Dt){if(u[g]===void 0)continue;const{correct:x,applyTo:v,isCSSVariable:E}=Dt[g],b=m==="none"?u[g]:x(u[g],d);if(v){const S=v.length;for(let w=0;w<S;w++)i[v[w]]=b}else E?this.options.visualElement.renderState.vars[g]=b:i[g]=b}this.options.layoutId&&(i.pointerEvents=d===this?tn(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>{var l;return(l=i.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(ui),this.root.sharedNodes.clear()}}}function gh(e){e.updateLayout()}function xh(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:o}=e.layout,{animationType:r}=e.options,i=t.source!==e.layout.source;r==="size"?je(m=>{const f=i?t.measuredBox[m]:t.layoutBox[m],p=we(f);f.min=s[m].min,f.max=f.min+p}):pa(r,t.layoutBox,s)&&je(m=>{const f=i?t.measuredBox[m]:t.layoutBox[m],p=we(s[m]);f.max=f.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[m].max=e.relativeTarget[m].min+p)});const l=dt();Tt(l,s,t.layoutBox);const c=dt();i?Tt(c,e.applyTransform(o,!0),t.measuredBox):Tt(c,s,t.layoutBox);const d=!ua(l);let u=!1;if(!e.resumeFrom){const m=e.getClosestProjectingParent();if(m&&!m.resumeFrom){const{snapshot:f,layout:p}=m;if(f&&p){const g=de();Vt(g,t.layoutBox,f.layoutBox);const x=de();Vt(x,s,p.layoutBox),ha(g,x)||(u=!0),m.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=g,e.relativeParent=m)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:c,layoutDelta:l,hasLayoutChanged:d,hasRelativeLayoutChanged:u})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function yh(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function bh(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function vh(e){e.clearSnapshot()}function ui(e){e.clearMeasurements()}function hi(e){e.isLayoutDirty=!1}function wh(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function mi(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Sh(e){e.resolveTargetDelta()}function Ch(e){e.calcProjection()}function kh(e){e.resetSkewAndRotation()}function jh(e){e.removeLeadSnapshot()}function fi(e,t,n){e.translate=le(t.translate,0,n),e.scale=le(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function pi(e,t,n,s){e.min=le(t.min,n.min,s),e.max=le(t.max,n.max,s)}function Eh(e,t,n,s){pi(e.x,t.x,n.x,s),pi(e.y,t.y,n.y,s)}function Ah(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const Mh={duration:.45,ease:[.4,0,.1,1]},gi=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),xi=gi("applewebkit/")&&!gi("chrome/")?Math.round:Ae;function yi(e){e.min=xi(e.min),e.max=xi(e.max)}function Th(e){yi(e.x),yi(e.y)}function pa(e,t,n){return e==="position"||e==="preserve-aspect"&&!Du(ci(t),ci(n),.2)}function Vh(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const Nh=fa({attachResizeListener:(e,t)=>Ft(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),In={current:void 0},ga=fa({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!In.current){const e=new Nh({});e.mount(window),e.setOptions({layoutScroll:!0}),In.current=e}return In.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Ph={pan:{Feature:qu},drag:{Feature:Yu,ProjectionNode:ga,MeasureLayout:la}};function bi(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,r=s[o];r&&ie.postRender(()=>r(t,Ot(t)))}class Rh extends Ke{mount(){const{current:t}=this.node;t&&(this.unmount=nd(t,(n,s)=>(bi(this.node,s,"Start"),o=>bi(this.node,o,"End"))))}unmount(){}}class Ih extends Ke{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Lt(Ft(this.node.current,"focus",()=>this.onFocus()),Ft(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function vi(e,t,n){const{props:s}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),r=s[o];r&&ie.postRender(()=>r(t,Ot(t)))}class Dh extends Ke{mount(){const{current:t}=this.node;t&&(this.unmount=rd(t,(n,s)=>(vi(this.node,s,"Start"),(o,{success:r})=>vi(this.node,o,r?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const cs=new WeakMap,Dn=new WeakMap,Fh=e=>{const t=cs.get(e.target);t&&t(e)},Lh=e=>{e.forEach(Fh)};function Bh({root:e,...t}){const n=e||document;Dn.has(n)||Dn.set(n,{});const s=Dn.get(n),o=JSON.stringify(t);return s[o]||(s[o]=new IntersectionObserver(Lh,{root:e,...t})),s[o]}function $h(e,t,n){const s=Bh(t);return cs.set(e,n),s.observe(e),()=>{cs.delete(e),s.unobserve(e)}}const Oh={some:0,all:1};class _h extends Ke{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:o="some",once:r}=t,i={root:n?n.current:void 0,rootMargin:s,threshold:typeof o=="number"?o:Oh[o]},l=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,r&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:u,onViewportLeave:m}=this.node.getProps(),f=d?u:m;f&&f(c)};return $h(this.node.current,i,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(Hh(t,n))&&this.startObserver()}unmount(){}}function Hh({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Zh={inView:{Feature:_h},tap:{Feature:Dh},focus:{Feature:Ih},hover:{Feature:Rh}},Uh={layout:{ProjectionNode:ga,MeasureLayout:la}},zh={...Tu,...Zh,...Ph,...Uh},Q=zd(zh,ou),qs="-",Wh=e=>{const t=Gh(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:i=>{const l=i.split(qs);return l[0]===""&&l.length!==1&&l.shift(),xa(l,t)||Kh(i)},getConflictingClassGroupIds:(i,l)=>{const c=n[i]||[];return l&&s[i]?[...c,...s[i]]:c}}},xa=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),o=s?xa(e.slice(1),s):void 0;if(o)return o;if(t.validators.length===0)return;const r=e.join(qs);return(i=t.validators.find(({validator:l})=>l(r)))==null?void 0:i.classGroupId},wi=/^\[(.+)\]$/,Kh=e=>{if(wi.test(e)){const t=wi.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Gh=e=>{const{theme:t,classGroups:n}=e,s={nextPart:new Map,validators:[]};for(const o in n)ds(n[o],s,o,t);return s},ds=(e,t,n,s)=>{e.forEach(o=>{if(typeof o=="string"){const r=o===""?t:Si(t,o);r.classGroupId=n;return}if(typeof o=="function"){if(Yh(o)){ds(o(s),t,n,s);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([r,i])=>{ds(i,Si(t,r),n,s)})})},Si=(e,t)=>{let n=e;return t.split(qs).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},Yh=e=>e.isThemeGetter,qh=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const o=(r,i)=>{n.set(r,i),t++,t>e&&(t=0,s=n,n=new Map)};return{get(r){let i=n.get(r);if(i!==void 0)return i;if((i=s.get(r))!==void 0)return o(r,i),i},set(r,i){n.has(r)?n.set(r,i):o(r,i)}}},us="!",hs=":",Xh=hs.length,Jh=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=o=>{const r=[];let i=0,l=0,c=0,d;for(let g=0;g<o.length;g++){let x=o[g];if(i===0&&l===0){if(x===hs){r.push(o.slice(c,g)),c=g+Xh;continue}if(x==="/"){d=g;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const u=r.length===0?o:o.substring(c),m=Qh(u),f=m!==u,p=d&&d>c?d-c:void 0;return{modifiers:r,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:p}};if(t){const o=t+hs,r=s;s=i=>i.startsWith(o)?r(i.substring(o.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const o=s;s=r=>n({className:r,parseClassName:o})}return s},Qh=e=>e.endsWith(us)?e.substring(0,e.length-1):e.startsWith(us)?e.substring(1):e,em=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const o=[];let r=[];return s.forEach(i=>{i[0]==="["||t[i]?(o.push(...r.sort(),i),r=[]):r.push(i)}),o.push(...r.sort()),o}},tm=e=>({cache:qh(e.cacheSize),parseClassName:Jh(e),sortModifiers:em(e),...Wh(e)}),nm=/\s+/,sm=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o,sortModifiers:r}=t,i=[],l=e.trim().split(nm);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:m,modifiers:f,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:x}=n(u);if(m){c=u+(c.length>0?" "+c:c);continue}let v=!!x,E=s(v?g.substring(0,x):g);if(!E){if(!v){c=u+(c.length>0?" "+c:c);continue}if(E=s(g),!E){c=u+(c.length>0?" "+c:c);continue}v=!1}const b=r(f).join(":"),S=p?b+us:b,w=S+E;if(i.includes(w))continue;i.push(w);const C=o(E,v);for(let A=0;A<C.length;++A){const j=C[A];i.push(S+j)}c=u+(c.length>0?" "+c:c)}return c};function om(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=ya(t))&&(s&&(s+=" "),s+=n);return s}const ya=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=ya(e[s]))&&(n&&(n+=" "),n+=t);return n};function im(e,...t){let n,s,o,r=i;function i(c){const d=t.reduce((u,m)=>m(u),e());return n=tm(d),s=n.cache.get,o=n.cache.set,r=l,l(c)}function l(c){const d=s(c);if(d)return d;const u=sm(c,n);return o(c,u),u}return function(){return r(om.apply(null,arguments))}}const ge=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},ba=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,va=/^\((?:(\w[\w-]*):)?(.+)\)$/i,rm=/^\d+\/\d+$/,am=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lm=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,cm=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dm=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,um=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,st=e=>rm.test(e),X=e=>!!e&&!Number.isNaN(Number(e)),Ze=e=>!!e&&Number.isInteger(Number(e)),Fn=e=>e.endsWith("%")&&X(e.slice(0,-1)),Fe=e=>am.test(e),hm=()=>!0,mm=e=>lm.test(e)&&!cm.test(e),wa=()=>!1,fm=e=>dm.test(e),pm=e=>um.test(e),gm=e=>!N(e)&&!P(e),xm=e=>vt(e,ka,wa),N=e=>ba.test(e),Ye=e=>vt(e,ja,mm),Ln=e=>vt(e,Sm,X),Ci=e=>vt(e,Sa,wa),ym=e=>vt(e,Ca,pm),Yt=e=>vt(e,Ea,fm),P=e=>va.test(e),jt=e=>wt(e,ja),bm=e=>wt(e,Cm),ki=e=>wt(e,Sa),vm=e=>wt(e,ka),wm=e=>wt(e,Ca),qt=e=>wt(e,Ea,!0),vt=(e,t,n)=>{const s=ba.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},wt=(e,t,n=!1)=>{const s=va.exec(e);return s?s[1]?t(s[1]):n:!1},Sa=e=>e==="position"||e==="percentage",Ca=e=>e==="image"||e==="url",ka=e=>e==="length"||e==="size"||e==="bg-size",ja=e=>e==="length",Sm=e=>e==="number",Cm=e=>e==="family-name",Ea=e=>e==="shadow",km=()=>{const e=ge("color"),t=ge("font"),n=ge("text"),s=ge("font-weight"),o=ge("tracking"),r=ge("leading"),i=ge("breakpoint"),l=ge("container"),c=ge("spacing"),d=ge("radius"),u=ge("shadow"),m=ge("inset-shadow"),f=ge("text-shadow"),p=ge("drop-shadow"),g=ge("blur"),x=ge("perspective"),v=ge("aspect"),E=ge("ease"),b=ge("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...w(),P,N],A=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],k=()=>[P,N,c],D=()=>[st,"full","auto",...k()],L=()=>[Ze,"none","subgrid",P,N],W=()=>["auto",{span:["full",Ze,P,N]},Ze,P,N],H=()=>[Ze,"auto",P,N],Ce=()=>["auto","min","max","fr",P,N],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],te=()=>["start","end","center","stretch","center-safe","end-safe"],se=()=>["auto",...k()],z=()=>[st,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],M=()=>[e,P,N],G=()=>[...w(),ki,Ci,{position:[P,N]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",vm,xm,{size:[P,N]}],q=()=>[Fn,jt,Ye],T=()=>["","none","full",d,P,N],F=()=>["",X,jt,Ye],Z=()=>["solid","dashed","dotted","double"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],R=()=>[X,Fn,ki,Ci],_=()=>["","none",g,P,N],K=()=>["none",X,P,N],O=()=>["none",X,P,N],re=()=>[X,P,N],oe=()=>[st,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fe],breakpoint:[Fe],color:[hm],container:[Fe],"drop-shadow":[Fe],ease:["in","out","in-out"],font:[gm],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fe],shadow:[Fe],spacing:["px",X],text:[Fe],"text-shadow":[Fe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",st,N,P,v]}],container:["container"],columns:[{columns:[X,N,P,l]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{start:D()}],end:[{end:D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[Ze,"auto",P,N]}],basis:[{basis:[st,"full","auto",l,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[X,st,"auto","initial","none",N]}],grow:[{grow:["",X,P,N]}],shrink:[{shrink:["",X,P,N]}],order:[{order:[Ze,"first","last","none",P,N]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:W()}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:W()}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ce()}],"auto-rows":[{"auto-rows":Ce()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[...te(),"normal"]}],"justify-self":[{"justify-self":["auto",...te()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[...te(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...te(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...te(),"baseline"]}],"place-self":[{"place-self":["auto",...te()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:se()}],mx:[{mx:se()}],my:[{my:se()}],ms:[{ms:se()}],me:[{me:se()}],mt:[{mt:se()}],mr:[{mr:se()}],mb:[{mb:se()}],ml:[{ml:se()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],w:[{w:[l,"screen",...z()]}],"min-w":[{"min-w":[l,"screen","none",...z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",n,jt,Ye]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,P,Ln]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Fn,N]}],"font-family":[{font:[bm,N,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,P,N]}],"line-clamp":[{"line-clamp":[X,"none",P,Ln]}],leading:[{leading:[r,...k()]}],"list-image":[{"list-image":["none",P,N]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",P,N]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:[X,"from-font","auto",P,Ye]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[X,"auto",P,N]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",P,N]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",P,N]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ze,P,N],radial:["",P,N],conic:[Ze,P,N]},wm,ym]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:T()}],"rounded-s":[{"rounded-s":T()}],"rounded-e":[{"rounded-e":T()}],"rounded-t":[{"rounded-t":T()}],"rounded-r":[{"rounded-r":T()}],"rounded-b":[{"rounded-b":T()}],"rounded-l":[{"rounded-l":T()}],"rounded-ss":[{"rounded-ss":T()}],"rounded-se":[{"rounded-se":T()}],"rounded-ee":[{"rounded-ee":T()}],"rounded-es":[{"rounded-es":T()}],"rounded-tl":[{"rounded-tl":T()}],"rounded-tr":[{"rounded-tr":T()}],"rounded-br":[{"rounded-br":T()}],"rounded-bl":[{"rounded-bl":T()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Z(),"hidden","none"]}],"divide-style":[{divide:[...Z(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...Z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[X,P,N]}],"outline-w":[{outline:["",X,jt,Ye]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",u,qt,Yt]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",m,qt,Yt]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[X,Ye]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",f,qt,Yt]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[X,P,N]}],"mix-blend":[{"mix-blend":[...B(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":B()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[X]}],"mask-image-linear-from-pos":[{"mask-linear-from":R()}],"mask-image-linear-to-pos":[{"mask-linear-to":R()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":R()}],"mask-image-t-to-pos":[{"mask-t-to":R()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":R()}],"mask-image-r-to-pos":[{"mask-r-to":R()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":R()}],"mask-image-b-to-pos":[{"mask-b-to":R()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":R()}],"mask-image-l-to-pos":[{"mask-l-to":R()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":R()}],"mask-image-x-to-pos":[{"mask-x-to":R()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":R()}],"mask-image-y-to-pos":[{"mask-y-to":R()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[P,N]}],"mask-image-radial-from-pos":[{"mask-radial-from":R()}],"mask-image-radial-to-pos":[{"mask-radial-to":R()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[X]}],"mask-image-conic-from-pos":[{"mask-conic-from":R()}],"mask-image-conic-to-pos":[{"mask-conic-to":R()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",P,N]}],filter:[{filter:["","none",P,N]}],blur:[{blur:_()}],brightness:[{brightness:[X,P,N]}],contrast:[{contrast:[X,P,N]}],"drop-shadow":[{"drop-shadow":["","none",p,qt,Yt]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",X,P,N]}],"hue-rotate":[{"hue-rotate":[X,P,N]}],invert:[{invert:["",X,P,N]}],saturate:[{saturate:[X,P,N]}],sepia:[{sepia:["",X,P,N]}],"backdrop-filter":[{"backdrop-filter":["","none",P,N]}],"backdrop-blur":[{"backdrop-blur":_()}],"backdrop-brightness":[{"backdrop-brightness":[X,P,N]}],"backdrop-contrast":[{"backdrop-contrast":[X,P,N]}],"backdrop-grayscale":[{"backdrop-grayscale":["",X,P,N]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[X,P,N]}],"backdrop-invert":[{"backdrop-invert":["",X,P,N]}],"backdrop-opacity":[{"backdrop-opacity":[X,P,N]}],"backdrop-saturate":[{"backdrop-saturate":[X,P,N]}],"backdrop-sepia":[{"backdrop-sepia":["",X,P,N]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",P,N]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[X,"initial",P,N]}],ease:[{ease:["linear","initial",E,P,N]}],delay:[{delay:[X,P,N]}],animate:[{animate:["none",b,P,N]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,P,N]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:K()}],"rotate-x":[{"rotate-x":K()}],"rotate-y":[{"rotate-y":K()}],"rotate-z":[{"rotate-z":K()}],scale:[{scale:O()}],"scale-x":[{"scale-x":O()}],"scale-y":[{"scale-y":O()}],"scale-z":[{"scale-z":O()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[P,N,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",P,N]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",P,N]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[X,jt,Ye,Ln]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},jm=im(km);function $(...e){return jm(cl.clsx(e))}function Em(e,t){return{id:e.streamInfo.id,timestamp:e.streamInfo.timestamp,message:e.text,from:e.participantInfo.identity===t.localParticipant.identity?t.localParticipant:Array.from(t.remoteParticipants.values()).find(n=>n.identity===e.participantInfo.identity)}}const Am=un.cva(["relative w-full rounded-lg border px-4 py-3 text-sm grid grid-cols-[0_1fr] gap-y-0.5 items-start","has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current"],{variants:{variant:{default:"bg-card text-card-foreground",destructive:["text-destructive-foreground bg-destructive border-destructive-border","[&>svg]:text-current *:data-[slot=alert-description]:text-destructive-foreground/90"]}},defaultVariants:{variant:"default"}});function Mm({className:e,variant:t,...n}){return a.jsx("div",{"data-slot":"alert",role:"alert",className:$(Am({variant:t}),e),...n})}function Tm({className:e,...t}){return a.jsx("div",{"data-slot":"alert-title",className:$("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function Vm({className:e,...t}){return a.jsx("div",{"data-slot":"alert-description",className:$("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function Xt(e){return Bi.toast.custom(t=>a.jsx(Nm,{id:t,title:e.title,description:e.description}),{duration:1e4})}function Nm(e){const{title:t,id:n,description:s}=e;return a.jsxs(Mm,{onClick:()=>Bi.toast.dismiss(n),className:"bg-gradient-to-br from-[#181825] to-[#232336] border border-[#232336] shadow-lg shadow-black/40 rounded-xl px-4 py-3 flex items-start gap-3 hover:shadow-xl transition-all duration-200",style:{color:"#F3F4F6"},children:[a.jsx(ll.WarningIcon,{weight:"bold",className:"text-yellow-400 mt-1 flex-shrink-0",size:24}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx(Tm,{className:"text-base font-semibold text-white mb-1",children:t}),a.jsx(Vm,{className:"text-sm text-gray-300 leading-snug",children:s})]})]})}const Ne=h.forwardRef((e,t)=>{const{alt:n,color:s="currentColor",size:o="1em",weight:r="regular",mirrored:i=!1,children:l,weights:c,...d}=e;return h.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,fill:s,viewBox:"0 0 256 256",transform:i?"scale(-1, 1)":void 0,...d},!!n&&h.createElement("title",null,n),l,c.get(r))});Ne.displayName="SSRBase";const Pm=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),h.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),Xs=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Pm}));Xs.displayName="CaretDownIcon";const Rm=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),h.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),Aa=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Rm}));Aa.displayName="CaretUpIcon";const Im=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216,44H40A20,20,0,0,0,20,64V224A19.82,19.82,0,0,0,31.56,242.1a20.14,20.14,0,0,0,8.49,1.9,19.91,19.91,0,0,0,12.82-4.72l.12-.11L84.47,212H216a20,20,0,0,0,20-20V64A20,20,0,0,0,216,44Zm-4,144H80a11.93,11.93,0,0,0-7.84,2.92L44,215.23V68H212ZM84,108A12,12,0,0,1,96,96h64a12,12,0,1,1,0,24H96A12,12,0,0,1,84,108Zm0,40a12,12,0,0,1,12-12h64a12,12,0,0,1,0,24H96A12,12,0,0,1,84,148Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M224,64V192a8,8,0,0,1-8,8H80L45.15,230.11A8,8,0,0,1,32,224V64a8,8,0,0,1,8-8H216A8,8,0,0,1,224,64Z",opacity:"0.2"}),h.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.84,15.84,0,0,0,9.25,14.5A16.05,16.05,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM160,152H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216,50H40A14,14,0,0,0,26,64V224a13.88,13.88,0,0,0,8.09,12.69A14.11,14.11,0,0,0,40,238a13.87,13.87,0,0,0,9-3.31l.06-.05L82.23,206H216a14,14,0,0,0,14-14V64A14,14,0,0,0,216,50Zm2,142a2,2,0,0,1-2,2H80a6,6,0,0,0-3.92,1.46L41.26,225.53A2,2,0,0,1,38,224V64a2,2,0,0,1,2-2H216a2,2,0,0,1,2,2Zm-52-80a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,144Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216,52H40A12,12,0,0,0,28,64V224a11.89,11.89,0,0,0,6.93,10.88A12.17,12.17,0,0,0,40,236a11.89,11.89,0,0,0,7.69-2.83l0,0L81.49,204H216a12,12,0,0,0,12-12V64A12,12,0,0,0,216,52Zm4,140a4,4,0,0,1-4,4H80a4,4,0,0,0-2.62,1L42.56,227.06A4,4,0,0,1,36,224V64a4,4,0,0,1,4-4H216a4,4,0,0,1,4,4Zm-56-80a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,144Z"}))]]),Ma=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Im}));Ma.displayName="ChatTextIcon";const Dm=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),h.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),Ta=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Dm}));Ta.displayName="CheckIcon";const Fm=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M128,180a52.06,52.06,0,0,0,52-52V64A52,52,0,0,0,76,64v64A52.06,52.06,0,0,0,128,180ZM100,64a28,28,0,0,1,56,0v64a28,28,0,0,1-56,0Zm40,155.22V240a12,12,0,0,1-24,0V219.22A92.14,92.14,0,0,1,36,128a12,12,0,0,1,24,0,68,68,0,0,0,136,0,12,12,0,0,1,24,0A92.14,92.14,0,0,1,140,219.22Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),h.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M80,128V64a48,48,0,0,1,96,0v64a48,48,0,0,1-96,0Zm128,0a8,8,0,0,0-16,0,64,64,0,0,1-128,0,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.6A80.11,80.11,0,0,0,208,128Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M128,174a46.06,46.06,0,0,0,46-46V64a46,46,0,0,0-92,0v64A46.06,46.06,0,0,0,128,174ZM94,64a34,34,0,0,1,68,0v64a34,34,0,0,1-68,0Zm40,141.75V240a6,6,0,0,1-12,0V205.75A78.09,78.09,0,0,1,50,128a6,6,0,0,1,12,0,66,66,0,0,0,132,0,6,6,0,0,1,12,0A78.09,78.09,0,0,1,134,205.75Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M128,172a44.05,44.05,0,0,0,44-44V64a44,44,0,0,0-88,0v64A44.05,44.05,0,0,0,128,172ZM92,64a36,36,0,0,1,72,0v64a36,36,0,0,1-72,0Zm40,139.89V240a4,4,0,0,1-8,0V203.89A76.09,76.09,0,0,1,52,128a4,4,0,0,1,8,0,68,68,0,0,0,136,0,4,4,0,0,1,8,0A76.09,76.09,0,0,1,132,203.89Z"}))]]),Va=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Fm}));Va.displayName="MicrophoneIcon";const Lm=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M56.88,39.93A12,12,0,1,0,39.12,56.07L76,96.64V128a52,52,0,0,0,72.11,48l11.26,12.39A67.34,67.34,0,0,1,128,196a68.07,68.07,0,0,1-68-68,12,12,0,0,0-24,0,92.14,92.14,0,0,0,80,91.22V240a12,12,0,0,0,24,0V219.23a90.39,90.39,0,0,0,35.92-12.68l23.2,25.52a12,12,0,0,0,17.76-16.14ZM128,156a28,28,0,0,1-28-28v-5l29.9,32.89C129.27,156,128.64,156,128,156Zm63-2.42A67.63,67.63,0,0,0,196,128a12,12,0,0,1,24,0,91.48,91.48,0,0,1-6.74,34.61,12,12,0,0,1-22.23-9ZM85.7,33.75A52,52,0,0,1,180,64v56.54a12,12,0,0,1-24,0V64a28,28,0,0,0-50.79-16.28,12,12,0,0,1-19.51-14Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),h.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M213.38,229.92a8,8,0,0,1-11.3-.54l-30.92-34A78.83,78.83,0,0,1,136,207.59V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64.07,64.07,0,0,0,64,64,63.41,63.41,0,0,0,32.21-8.68l-11.1-12.2A48,48,0,0,1,80,128V95.09L42.08,53.38A8,8,0,0,1,53.92,42.62l160,176A8,8,0,0,1,213.38,229.92Zm-24.19-63.13a7.88,7.88,0,0,0,3.51.82,8,8,0,0,0,7.19-4.49A79.16,79.16,0,0,0,208,128a8,8,0,0,0-16,0,63.32,63.32,0,0,1-6.48,28.09A8,8,0,0,0,189.19,166.79Zm-27.33-29.22A8,8,0,0,0,175.74,133a49.49,49.49,0,0,0,.26-5V64A48,48,0,0,0,84,44.87a8,8,0,0,0,1.41,8.57Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M212.44,220,52.44,44A6,6,0,0,0,43.56,52L82,94.32V128a46,46,0,0,0,67.56,40.64l13.75,15.12A65.26,65.26,0,0,1,128,194a66.08,66.08,0,0,1-66-66,6,6,0,0,0-12,0,78.09,78.09,0,0,0,72,77.75V240a6,6,0,0,0,12,0V205.77a76.93,76.93,0,0,0,37.48-13L203.56,228a6,6,0,0,0,8.88-8.08ZM128,162a34,34,0,0,1-34-34V107.52l47.12,51.84A33.82,33.82,0,0,1,128,162Zm59.32-5A65.38,65.38,0,0,0,194,128a6,6,0,0,1,12,0,77.33,77.33,0,0,1-7.9,34.25A6,6,0,1,1,187.32,157ZM85.8,45.67A46,46,0,0,1,174,64v64a45.17,45.17,0,0,1-.25,4.81,6,6,0,0,1-6,5.38q-.31,0-.63,0a6,6,0,0,1-5.34-6.59A35.41,35.41,0,0,0,162,128V64A34,34,0,0,0,96.8,50.45a6,6,0,0,1-11-4.78Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M211,221.31,51,45.31A4,4,0,0,0,45,50.69L84,93.55V128a44,44,0,0,0,66,38.12l16.38,18A67.21,67.21,0,0,1,128,196a68.07,68.07,0,0,1-68-68,4,4,0,0,0-8,0,76.09,76.09,0,0,0,72,75.89V240a4,4,0,0,0,8,0V203.89a75.1,75.1,0,0,0,39.79-13.77L205,226.69a4,4,0,1,0,5.92-5.38ZM128,164a36,36,0,0,1-36-36V102.35L144.43,160A35.83,35.83,0,0,1,128,164Zm61.12-6.15A67.44,67.44,0,0,0,196,128a4,4,0,0,1,8,0,75.28,75.28,0,0,1-7.7,33.37,4,4,0,0,1-7.18-3.52ZM87.63,46.46A44,44,0,0,1,172,64v64a44.2,44.2,0,0,1-.24,4.61,4,4,0,0,1-4,3.58l-.42,0a4,4,0,0,1-3.57-4.39A36.67,36.67,0,0,0,164,128V64A36,36,0,0,0,95,49.66a4,4,0,0,1-7.34-3.2Z"}))]]),Na=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Lm}));Na.displayName="MicrophoneSlashIcon";const Bm=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,36H48A28,28,0,0,0,20,64V176a28,28,0,0,0,28,28H208a28,28,0,0,0,28-28V64A28,28,0,0,0,208,36Zm4,140a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-40,52a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,228ZM160.49,103.51a12,12,0,0,1-17,17L140,117v35a12,12,0,0,1-24,0V117l-3.51,3.52a12,12,0,0,1-17-17l24-24a12,12,0,0,1,17,0Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M224,64V176a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V64A16,16,0,0,1,48,48H208A16,16,0,0,1,224,64Z",opacity:"0.2"}),h.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M168,224a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM232,64V176a24,24,0,0,1-24,24H48a24,24,0,0,1-24-24V64A24,24,0,0,1,48,40H208A24,24,0,0,1,232,64Zm-74.34,42.34-24-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,11.32,11.32L120,107.31V152a8,8,0,0,0,16,0V107.31l10.34,10.35a8,8,0,0,0,11.32-11.32Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,42H48A22,22,0,0,0,26,64V176a22,22,0,0,0,22,22H208a22,22,0,0,0,22-22V64A22,22,0,0,0,208,42Zm10,134a10,10,0,0,1-10,10H48a10,10,0,0,1-10-10V64A10,10,0,0,1,48,54H208a10,10,0,0,1,10,10Zm-52,48a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,224Zm-9.76-116.24a6,6,0,1,1-8.48,8.48L134,102.49V152a6,6,0,0,1-12,0V102.49l-13.76,13.75a6,6,0,0,1-8.48-8.48l24-24a6,6,0,0,1,8.48,0Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,44H48A20,20,0,0,0,28,64V176a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V64A20,20,0,0,0,208,44Zm12,132a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V64A12,12,0,0,1,48,52H208a12,12,0,0,1,12,12Zm-56,48a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,224Zm-9.17-114.83a4,4,0,0,1-5.66,5.66L132,97.66V152a4,4,0,0,1-8,0V97.66l-17.17,17.17a4,4,0,0,1-5.66-5.66l24-24a4,4,0,0,1,5.66,0Z"}))]]),Pa=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Bm}));Pa.displayName="MonitorArrowUpIcon";const $m=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm33.25,62.75a12,12,0,0,0,8.49-3.52L204.37,68.6a12,12,0,0,0-17-17L164.77,74.26a12,12,0,0,0,8.48,20.49ZM224,116H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),h.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm33.94,58.75,17-17a8,8,0,0,1,11.32,11.32l-17,17a8,8,0,0,1-11.31-11.31ZM48,136a8,8,0,0,1,0-16H72a8,8,0,0,1,0,16Zm46.06,37.25-17,17a8,8,0,0,1-11.32-11.32l17-17a8,8,0,0,1,11.31,11.31Zm0-79.19a8,8,0,0,1-11.31,0l-17-17A8,8,0,0,1,77.09,65.77l17,17A8,8,0,0,1,94.06,94.06ZM136,208a8,8,0,0,1-16,0V184a8,8,0,0,1,16,0Zm0-136a8,8,0,0,1-16,0V48a8,8,0,0,1,16,0Zm54.23,118.23a8,8,0,0,1-11.32,0l-17-17a8,8,0,0,1,11.31-11.31l17,17A8,8,0,0,1,190.23,190.23ZM208,136H184a8,8,0,0,1,0-16h24a8,8,0,0,1,0,16Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M134,32V64a6,6,0,0,1-12,0V32a6,6,0,0,1,12,0Zm39.25,56.75A6,6,0,0,0,177.5,87l22.62-22.63a6,6,0,0,0-8.48-8.48L169,78.5a6,6,0,0,0,4.24,10.25ZM224,122H192a6,6,0,0,0,0,12h32a6,6,0,0,0,0-12Zm-46.5,47A6,6,0,0,0,169,177.5l22.63,22.62a6,6,0,0,0,8.48-8.48ZM128,186a6,6,0,0,0-6,6v32a6,6,0,0,0,12,0V192A6,6,0,0,0,128,186ZM78.5,169,55.88,191.64a6,6,0,1,0,8.48,8.48L87,177.5A6,6,0,1,0,78.5,169ZM70,128a6,6,0,0,0-6-6H32a6,6,0,0,0,0,12H64A6,6,0,0,0,70,128ZM64.36,55.88a6,6,0,0,0-8.48,8.48L78.5,87A6,6,0,1,0,87,78.5Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M132,32V64a4,4,0,0,1-8,0V32a4,4,0,0,1,8,0Zm41.25,54.75a4,4,0,0,0,2.83-1.18L198.71,63a4,4,0,0,0-5.66-5.66L170.43,79.92a4,4,0,0,0,2.82,6.83ZM224,124H192a4,4,0,0,0,0,8h32a4,4,0,0,0,0-8Zm-47.92,46.43a4,4,0,1,0-5.65,5.65l22.62,22.63a4,4,0,0,0,5.66-5.66ZM128,188a4,4,0,0,0-4,4v32a4,4,0,0,0,8,0V192A4,4,0,0,0,128,188ZM79.92,170.43,57.29,193.05A4,4,0,0,0,63,198.71l22.62-22.63a4,4,0,1,0-5.65-5.65ZM68,128a4,4,0,0,0-4-4H32a4,4,0,0,0,0,8H64A4,4,0,0,0,68,128ZM63,57.29A4,4,0,0,0,57.29,63L79.92,85.57a4,4,0,1,0,5.65-5.65Z"}))]]),Js=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:$m}));Js.displayName="SpinnerIcon";const Om=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V167.57l24.94,18.14A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM188,180H36V76H188Zm44-27.57-20-14.54V118.11l20-14.54Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),h.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M192,72V184a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V72A16,16,0,0,1,32,56H176A16,16,0,0,1,192,72Zm58,.25a8.23,8.23,0,0,0-6.63,1.22L209.78,95.86A4,4,0,0,0,208,99.19v57.62a4,4,0,0,0,1.78,3.33l33.78,22.52a8,8,0,0,0,8.58.19,8.33,8.33,0,0,0,3.86-7.17V80A8,8,0,0,0,250,72.25Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V155.21L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM194,184a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H192a2,2,0,0,1,2,2Zm48-19.21-36-24V115.21l36-24Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V151.47l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM196,184a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H192a4,4,0,0,1,4,4Zm48-15.47-40-26.67V114.14l40-26.67Z"}))]]),Ra=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:Om}));Ra.displayName="VideoCameraIcon";const _m=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H123.88a12,12,0,0,0,0,24H188v68a12,12,0,0,0,4.46,9.33c.15.13.31.25.48.38l44,32A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM232,152.43l-20-14.54V118.11l20-14.54ZM56.88,31.93A12,12,0,1,0,39.12,48.07L42.69,52H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H180.87l18.25,20.07a12,12,0,0,0,17.76-16.14ZM36,180V76H64.51l94.55,104Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),h.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M256,80.23v95.45a8.33,8.33,0,0,1-3.86,7.17,8,8,0,0,1-8.58-.19l-33.78-22.52a4,4,0,0,1-1.78-3.33V99.19a4,4,0,0,1,1.78-3.32l33.78-22.53a8,8,0,0,1,9.73.66A8.23,8.23,0,0,1,256,80.23ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM185,155.07a4,4,0,0,0,7-2.7V72a16,16,0,0,0-16-16H104a4,4,0,0,0-3,6.69Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H113.06a6,6,0,0,0,0,12H192a2,2,0,0,1,2,2v87.63a6,6,0,0,0,12,0v-4.42L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM242,164.79l-36-24V115.21l36-24ZM52.44,36A6,6,0,0,0,43.56,44L56.25,58H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H183.53l20,22a6,6,0,0,0,8.88-8.08ZM32,186a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H67.16L172.62,186Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H113.06a4,4,0,0,0,0,8H192a4,4,0,0,1,4,4v87.63a4,4,0,0,0,8,0v-8.16l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM244,168.53l-40-26.67V114.14l40-26.67ZM51,37.31A4,4,0,0,0,45,42.69L60.78,60H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H184.41L205,218.69a4,4,0,1,0,5.92-5.38ZM32,188a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H68.05L177.14,188Z"}))]]),Ia=h.forwardRef((e,t)=>h.createElement(Ne,{ref:t,...e,weights:_m}));Ia.displayName="VideoCameraSlashIcon";function ji(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Hm(...e){return t=>{let n=!1;const s=e.map(o=>{const r=ji(o,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let o=0;o<s.length;o++){const r=s[o];typeof r=="function"?r():ji(e[o],null)}}}}function Zm(e){const t=zm(e),n=h.forwardRef((s,o)=>{const{children:r,...i}=s,l=h.Children.toArray(r),c=l.find(Km);if(c){const d=c.props.children,u=l.map(m=>m===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:m);return a.jsx(t,{...i,ref:o,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return a.jsx(t,{...i,ref:o,children:r})});return n.displayName=`${e}.Slot`,n}var Um=Zm("Slot");function zm(e){const t=h.forwardRef((n,s)=>{const{children:o,...r}=n;if(h.isValidElement(o)){const i=Ym(o),l=Gm(r,o.props);return o.type!==h.Fragment&&(l.ref=s?Hm(s,i):i),h.cloneElement(o,l)}return h.Children.count(o)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Wm=Symbol("radix.slottable");function Km(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Wm}function Gm(e,t){const n={...t};for(const s in t){const o=e[s],r=t[s];/^on[A-Z]/.test(s)?o&&r?n[s]=(...l)=>{const c=r(...l);return o(...l),c}:o&&(n[s]=o):s==="style"?n[s]={...o,...r}:s==="className"&&(n[s]=[o,r].filter(Boolean).join(" "))}return{...e,...n}}function Ym(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const qm=un.cva(["text-xs font-bold tracking-wider uppercase whitespace-nowrap","inline-flex items-center justify-center gap-2 shrink-0 rounded-full cursor-pointer outline-none transition-colors duration-300","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","disabled:pointer-events-none disabled:opacity-50","aria-invalid:ring-destructive/20 aria-invalid:border-destructive dark:aria-invalid:ring-destructive/40 ","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button text-button-foreground hover:bg-muted focus:bg-muted",destructive:["bg-destructive text-destructive-foreground","hover:bg-destructive-hover focus:bg-destructive-hover focus-visible:ring-destructive-foreground/20","dark:focus-visible:ring-destructive-foreground/40"],outline:["border bg-background","hover:bg-accent hover:text-accent-foreground","dark:bg-input/30 dark:border-input dark:hover:bg-input/50"],primary:"",secondary:"bg-secondary text-secondary-foregroun hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Xm({className:e,variant:t,size:n,asChild:s=!1,...o}){const r=s?Um:"button";return a.jsx(r,{"data-slot":"button",className:$(qm({variant:t,size:n,className:e})),...o})}function Jm({onSend:e,className:t,disabled:n,...s}){const o=y.useRef(null),[r,i]=y.useState(""),l=d=>{var u,m;d.preventDefault(),(u=s.onSubmit)==null||u.call(s,d),e==null||e(r),i(""),(m=o.current)==null||m.focus({preventScroll:!0})},c=n||r.trim().length===0;return a.jsxs("form",{...s,onSubmit:l,className:$("flex items-center rounded-md pl-1 text-sm",t),children:[a.jsx("input",{ref:o,type:"text",className:"flex-1 focus:outline-none",placeholder:"Type something...",value:r,onChange:d=>i(d.target.value),disabled:n}),a.jsx(Xm,{size:"sm",type:"submit",variant:c?"secondary":"primary",disabled:c,className:"font-mono",children:"SEND"})]})}const Qm=un.cva(["inline-flex items-center justify-center gap-2 rounded-full","text-sm font-medium whitespace-nowrap","cursor-pointer outline-none transition-[color,border,background-color]","!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 aria-invalid:border-0","disabled:pointer-events-none disabled:opacity-50 disabled:not-allowed","data-[state=on]:bg-button-selected data-[state=on]:border-button-border-selected","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button hover:bg-muted focus:bg-muted hover:text-muted-foreground focus:text-muted-foreground",primary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=off]:bg-button-primary hover:data-[state=off]:bg-button-hover data-[state=off]:text-button-primary-foreground",secondary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=on]:bg-button-secondary hover:data-[state=on]:bg-button-secondary data-[state=on]:text-button-secondary-foreground",outline:["border border-button-border bg-button text-button-foreground","hover:bg-background focus:bg-background"]},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function Da({className:e,variant:t,size:n,...s}){return a.jsx(ml.Root,{"data-slot":"toggle",className:$(Qm({variant:t,size:n,className:e})),...s})}function ef(e){const[t,n]=y.useState(()=>e.getPublishPermissions());return y.useEffect(()=>{const s=()=>{n(e.getPublishPermissions())},o=()=>{s()};return e.on("connection.connected",o),e.on("connection.disconnected",o),()=>{e.off("connection.connected",o),e.off("connection.disconnected",o)}},[e]),t}function tf(e){const[t,n]=y.useState(()=>e.getLocalParticipant()),[s,o]=y.useState(()=>e.getMicrophoneTrack());return y.useEffect(()=>{const r=()=>{const l=e.getLocalParticipant(),c=e.getMicrophoneTrack();console.log("🎤 useVoxketLocalParticipant: Updating state:",{hasParticipant:!!l,hasMicTrack:!!c,isMicEnabled:e.isMicrophoneEnabled,trackPublications:l?l.trackPublications.size:0}),n(l),o(c)};r(),e.on("connection.connected",r),e.on("connection.disconnected",r),e.on("track.muted",r),e.on("track.unmuted",r);const i=e.getRoom();if(i){const l=()=>{console.log("🎤 Track published, updating participant state"),r()},c=()=>{console.log("🎤 Track unpublished, updating participant state"),r()};return i.on("localTrackPublished",l),i.on("localTrackUnpublished",c),()=>{e.off("connection.connected",r),e.off("connection.disconnected",r),e.off("track.muted",r),e.off("track.unmuted",r),i.off("localTrackPublished",l),i.off("localTrackUnpublished",c)}}else return()=>{e.off("connection.connected",r),e.off("connection.disconnected",r),e.off("track.muted",r),e.off("track.unmuted",r)}},[e]),{localParticipant:t,microphoneTrack:s}}function Bn(e,t,n){const[s,o]=y.useState(!1),[r,i]=y.useState(!1);return y.useEffect(()=>{const c=()=>{let d=!1;switch(t){case"microphone":d=e.isMicrophoneEnabled;break;case"camera":d=e.isCameraEnabled;break;case"screenShare":d=e.isScreenShareEnabled;break}console.log(`useVoxketTrackToggle: ${t} enabled state updated to:`,d),o(d)};return c(),e.on("track.muted",c),e.on("track.unmuted",c),e.on("connection.connected",c),()=>{e.off("track.muted",c),e.off("track.unmuted",c),e.off("connection.connected",c)}},[e,t]),{enabled:s,pending:r,toggle:async c=>{var d;try{i(!0);const u=c!==void 0?c:!s;switch(t){case"microphone":await e.toggleMicrophone(u);break;case"camera":await e.toggleCamera(u);break;case"screenShare":u?await e.startScreenShare():await e.stopScreenShare();break}}catch(u){(d=n==null?void 0:n.onDeviceError)==null||d.call(n,u)}finally{i(!1)}}}}function nf(e){const[t,n]=y.useState(()=>e.getRoom()),[s,o]=y.useState(()=>e.getConnectionState());return y.useEffect(()=>{const r=()=>{n(e.getRoom()),o(e.getConnectionState())};return e.on("connection.connected",r),e.on("connection.disconnected",r),e.on("connection.connecting",r),()=>{e.off("connection.connected",r),e.off("connection.disconnected",r),e.off("connection.connecting",r)}},[e]),t}function sf(e,t){const[n,s]=y.useState([]),[o,r]=y.useState("");return y.useEffect(()=>{var d;const l=async()=>{try{const u=t==="audioinput"?await e.getAudioInputDevices():await e.getVideoInputDevices();s(u)}catch(u){console.error("Failed to load devices:",u)}};l();const c=()=>{l()};return(d=navigator.mediaDevices)==null||d.addEventListener("devicechange",c),()=>{var u;(u=navigator.mediaDevices)==null||u.removeEventListener("devicechange",c)}},[e,t]),{devices:n,activeDeviceId:o,setActiveMediaDevice:async l=>{try{t==="audioinput"?await e.setAudioInputDevice(l):await e.setVideoInputDevice(l),r(l)}catch(c){console.error("Failed to set device:",c)}}}}function of(e){const{preventSave:t=!1}=e||{};return{saveAudioInputEnabled:i=>{t||localStorage.setItem("voxket-audio-input-enabled",i.toString())},saveAudioInputDeviceId:i=>{t||localStorage.setItem("voxket-audio-input-device-id",i)},saveVideoInputEnabled:i=>{t||localStorage.setItem("voxket-video-input-enabled",i.toString())},saveVideoInputDeviceId:i=>{t||localStorage.setItem("voxket-video-input-device-id",i)}}}function Ei({...e}){return a.jsx(Ee.Root,{"data-slot":"select",...e})}function Ai({...e}){return a.jsx(Ee.Value,{"data-slot":"select-value",...e})}function Mi({className:e,size:t="default",children:n,...s}){return a.jsxs(Ee.Trigger,{"data-slot":"select-trigger","data-size":t,className:$(["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"],e),...s,children:[n,a.jsx(Ee.Icon,{asChild:!0,children:a.jsx(Xs,{weight:"bold",className:"size-4 transition-colors"})})]})}function Ti({className:e,children:t,position:n="popper",...s}){return a.jsx(Ee.Portal,{children:a.jsxs(Ee.Content,{"data-slot":"select-content",className:$(["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",e),position:n,...s,children:[a.jsx(rf,{}),a.jsx(Ee.Viewport,{className:$("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),a.jsx(af,{})]})})}function Vi({className:e,children:t,...n}){return a.jsxs(Ee.Item,{"data-slot":"select-item",className:$(["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"],e),...n,children:[a.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:a.jsx(Ee.ItemIndicator,{children:a.jsx(Ta,{className:"size-4",weight:"bold"})})}),a.jsx(Ee.ItemText,{children:t})]})}function rf({className:e,...t}){return a.jsx(Ee.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:$("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Aa,{className:"size-4",weight:"bold"})})}function af({className:e,...t}){return a.jsx(Ee.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:$("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Xs,{className:"size-4",weight:"bold"})})}const Ni=un.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 Pi({kind:e,track:t,requestPermissions:n,onError:s,client:o,...r}){const i=r.size||"default";if(!o)return a.jsxs(Ei,{disabled:!0,children:[a.jsx(Mi,{className:$(Ni({size:i}),r.className),children:a.jsx(Ai,{placeholder:`Select a ${e}`})}),a.jsx(Ti,{children:a.jsx(Vi,{value:"none",children:"No devices available"})})]});const{devices:l,activeDeviceId:c,setActiveMediaDevice:d}=sf(o,e==="audioinput"?"audioinput":"videoinput");return a.jsxs(Ei,{value:c,onValueChange:d,children:[a.jsx(Mi,{className:$(Ni({size:i}),r.className,"hover:bg"),children:i!=="sm"&&a.jsx(Ai,{className:"font-mono text-sm",placeholder:`Select a ${e}`})}),a.jsx(Ti,{children:l.map(u=>a.jsx(Vi,{value:u.deviceId,className:"font-mono text-xs",children:u.label},u.deviceId))})]})}function lf(e,t,n=!1){if(n)return Js;switch(e){case I.Track.Source.Microphone:return t?Va:Na;case I.Track.Source.Camera:return t?Ra:Ia;case I.Track.Source.ScreenShare:return Pa;default:return h.Fragment}}function $n({source:e,pressed:t,pending:n,className:s,...o}){const r=lf(e,t??!1,n),i=e===I.Track.Source.Microphone&&!(t??!1)&&!n,l=e===I.Track.Source.Camera&&!(t??!1)&&!n;return h.useEffect(()=>{console.log(`TrackToggle for ${e} changed: pressed=${t}, pending=${n}, actualState=${t?"enabled":"disabled"}`)},[e,t,n]),a.jsxs(Da,{pressed:t,"aria-label":`Toggle ${e}`,className:$(s),...o,children:[a.jsx(r,{weight:"bold",className:$(n&&"animate-spin",i||l?"text-red-500":void 0)}),o.children]})}function cf(e){return e?ef(e):{camera:!0,microphone:!0,screenShare:!0,data:!0}}function df(e={}){const{controls:t,saveUserChoices:n=!0,client:s}=e,o={leave:!0,...t};if(!s)return{micTrackRef:{participant:void 0,source:I.Track.Source.Microphone,publication:void 0},visibleControls:o,microphoneToggle:{enabled:!1,pending:!1,toggle:async()=>{}},cameraToggle:{enabled:!1,pending:!1,toggle:async()=>{}},screenShareToggle:{enabled:!1,pending:!1,toggle:async()=>{}},handleDisconnect:()=>{},handleAudioDeviceChange:()=>{},handleVideoDeviceChange:()=>{}};const{microphoneTrack:r,localParticipant:i}=tf(s),l=cf(s);nf(s);const c=Bn(s,"microphone",{onDeviceError:A=>{var j;return(j=e.onDeviceError)==null?void 0:j.call(e,{source:I.Track.Source.Microphone,error:A})}}),d=Bn(s,"camera",{onDeviceError:A=>{var j;return(j=e.onDeviceError)==null?void 0:j.call(e,{source:I.Track.Source.Camera,error:A})}}),u=Bn(s,"screenShare",{onDeviceError:A=>{var j;return(j=e.onDeviceError)==null?void 0:j.call(e,{source:I.Track.Source.ScreenShare,error:A})}}),m=h.useMemo(()=>{let A;if(i){for(const[,j]of i.trackPublications)if(j.source===I.Track.Source.Microphone){A=j;break}}return console.log("🎤 Creating micTrackRef:",{hasParticipant:!!i,hasPublication:!!A,isTrackSubscribed:A==null?void 0:A.isSubscribed,isMuted:A==null?void 0:A.isMuted,trackSid:A==null?void 0:A.trackSid}),{participant:i??void 0,source:I.Track.Source.Microphone,publication:A}},[i,r]);o.microphone??(o.microphone=l.microphone),o.screenShare??(o.screenShare=l.screenShare),o.camera??(o.camera=l.camera),o.chat??(o.chat=l.data);const{saveAudioInputEnabled:f,saveAudioInputDeviceId:p,saveVideoInputEnabled:g,saveVideoInputDeviceId:x}=of({preventSave:!n}),v=h.useCallback(()=>{s&&s.disconnect()},[s]),E=h.useCallback(A=>{p(A??"default"),s&&s.setAudioInputDevice(A)},[p,s]),b=h.useCallback(A=>{x(A??"default"),s&&s.setVideoInputDevice(A)},[x,s]),S=h.useCallback(async A=>{u.enabled&&await u.toggle(!1),await d.toggle(A),g(!d.enabled)},[d,g,u]),w=h.useCallback(async A=>{await c.toggle(A),f(!c.enabled)},[c,f]),C=h.useCallback(async A=>{d.enabled&&await d.toggle(!1),await u.toggle(A)},[d,u]);return{micTrackRef:m,visibleControls:o,cameraToggle:{...d,toggle:S},microphoneToggle:{...c,toggle:w},screenShareToggle:{...u,toggle:C},handleDisconnect:v,handleAudioDeviceChange:E,handleVideoDeviceChange:b}}const uf={card:" bg-gradient-to-br from-black to-gray-900 border border-gray-900 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto rounded-2xl shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-black/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-gray-800/20 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-gray-600/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-gray-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-gray-400 to-gray-500 rounded-full blur-sm opacity-20 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-gray-500 to-gray-600 rounded-full blur-sm opacity-15 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-black to-gray-900 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-white via-gray-200 to-gray-300"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900",promptSlider:"absolute w-full py-3 px-2 bg-gray-900 rounded-xl text-center text-white text-sm transition-opacity duration-700 ease-in-out border border-gray-600",statusIndicator:"w-2 h-2 bg-gray-400 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-gray-600/30 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-gray-500/20 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-gray-400/15 pulse-ring"},controlBar:"border border-gray-600 rounded-3xl py-4 flex flex-col justify-end h-full bg-gray-900/50 backdrop-blur-sm",chatInput:{container:"bg-gray-900 w-full border-gray-600",textarea:"bg-gray-800 border-none text-white placeholder-gray-400",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-gray-600 text-white",other:"bg-gray-700 text-white"},chatHeader:{container:"bg-gray-900 border-gray-600",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-gray-400 mb-2",suggestedResponse:{container:"bg-gray-800 text-blue-300 border-gray-700 hover:bg-gray-700 hover:text-white"},video:{container:"bg-gradient-to-br from-black to-gray-900 text-white",header:"border-gray-700 bg-gray-900/50",headerButton:"bg-gray-800 hover:bg-gray-700 text-gray-300",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-gray-900/80 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-gray-800 border border-gray-700 shadow-lg",placeholder:"bg-gray-800 text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},hf={card:" bg-gradient-to-br from-white to-gray-50 border border-gray-200 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-white/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-blue-500/5 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-purple-500/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-pink-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-blue-500 to-purple-500 rounded-full blur-sm opacity-30 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-pink-500 to-purple-500 rounded-full blur-sm opacity-20 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-white to-gray-50 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-gray-900",secondary:"text-gray-700",muted:"text-gray-500",accent:"bg-clip-text text-transparent bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600"},micButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-white",promptSlider:"absolute w-full py-3 px-2 bg-gray-100 rounded-xl text-center text-gray-700 text-sm transition-opacity duration-700 ease-in-out border border-gray-200",statusIndicator:"w-2 h-2 bg-green-500 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-blue-500/20 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-purple-500/15 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-pink-500/10 pulse-ring"},controlBar:"border border-gray-200 rounded-3xl py-4 flex flex-col justify-end h-full bg-white/80 backdrop-blur-sm",chatInput:{container:"bg-white/90 border-gray-200 shadow-sm",textarea:"bg-white border-none text-gray-900 placeholder-gray-500 ",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 disabled:opacity-50 text-white",attachButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100 bg-blue-50",endButton:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200"},chatMessage:{own:"bg-blue-50 text-gray-900 border border-blue-100",other:"bg-gray-50 text-gray-900 border border-gray-200"},chatHeader:{container:"bg-white border-gray-200",backButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100"},spinner:"w-10 h-10 animate-spin text-blue-500 mb-2",suggestedResponse:{container:"bg-white text-blue-700 border-blue-200 hover:bg-blue-50 hover:text-blue-900"},video:{container:"bg-gradient-to-br from-white to-gray-50 text-gray-900",header:"border-gray-200 bg-white/80",headerButton:"bg-gray-100 hover:bg-gray-200 text-gray-600",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-white/90 backdrop-blur-sm border-t border-gray-200",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-200 hover:bg-gray-300 text-gray-600",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-white border border-gray-200 shadow-sm",placeholder:"bg-gray-50 text-gray-600",avatar:"bg-gray-200 text-gray-600",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},mf={card:" text-white bg-gradient-to-br from-[#171727] to-[#12121F] border border-gray-800 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-[#171727]/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-[#3B82F6]/15 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-[#8B5CF6]/25 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-[#EC4899]/20 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full blur-sm opacity-50 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-[#EC4899] to-[#8B5CF6] rounded-full blur-sm opacity-40 animate-pulse",main:"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",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-[#3B82F6] via-[#8B5CF6] to-[#EC4899]"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900 shadow-xl",promptSlider:"absolute w-full py-3 px-2 bg-[#1E1E2E] rounded-xl text-center text-gray-200 text-sm transition-opacity duration-700 ease-in-out border border-gray-700",statusIndicator:"w-2 h-2 bg-[#10B981] rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-[#3B82F6]/40 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-[#8B5CF6]/30 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-[#EC4899]/20 pulse-ring"},controlBar:"border border-border rounded-3xl py-4 flex flex-col justify-end h-full",chatInput:{container:"bg-[#1E1E2E] border-gray-700",textarea:"bg-[#1E1E2E] border-none text-white placeholder-gray-400",sendButton:"bg-[#3B82F6] hover:bg-[#2563EB] disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-[#1E1E2E]/80 text-white",other:"bg-[#1E1E2E] text-white border border-gray-700"},chatHeader:{container:"bg-[#1E1E2E] border-gray-700",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-blue-400 mb-2",suggestedResponse:{container:"bg-[#221f3f] text-white border-none"},video:{container:"bg-gradient-to-br from-[#171727] to-[#12121F] text-white",header:"border-gray-700 bg-[#1E1E2E]/80",headerButton:"bg-[#1E1E2E] hover:bg-gray-700 text-gray-300",statusDot:"bg-[#10B981] animate-pulse",controlsBackground:"bg-[#1E1E2E]/90 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-[#3B82F6] hover:bg-[#2563EB] text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-[#1E1E2E] border border-gray-700 shadow-xl",placeholder:"bg-[#1E1E2E] text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},Ri={dark:uf,light:hf,vox:mf};function ye(e){return Ri[e]||Ri.vox}function ff({controls:e,saveUserChoices:t=!0,capabilities:n,className:s,onSendMessage:o,onChatOpenChange:r,onDisconnect:i,onDeviceError:l,theme:c="vox",client:d,...u}){const[m,f]=h.useState(!1),[p,g]=h.useState(!1),x=ye(c),{micTrackRef:v,visibleControls:E,cameraToggle:b,microphoneToggle:S,screenShareToggle:w,handleAudioDeviceChange:C,handleVideoDeviceChange:A,handleDisconnect:j}=df({controls:e,saveUserChoices:t,client:d}),k=async D=>{g(!0);try{await(o==null?void 0:o(D))}finally{g(!1)}};return h.useEffect(()=>{r==null||r(m)},[m,r]),h.useEffect(()=>{var D,L,W,H;console.log("🎤 AgentControlBar: micTrackRef changed:",{hasParticipant:!!v.participant,hasPublication:!!v.publication,source:v.source,isSubscribed:(D=v.publication)==null?void 0:D.isSubscribed,isMuted:(L=v.publication)==null?void 0:L.isMuted,trackSid:(W=v.publication)==null?void 0:W.trackSid,hasTrack:!!((H=v.publication)!=null&&H.track)})},[v]),a.jsxs("div",{"aria-label":"Voice assistant controls",className:$(x.controlBar,s),...u,children:[n.suportsChatInput&&a.jsxs("div",{inert:!m,className:$("overflow-hidden transition-[height] relative duration-300 ease-in-out",m?"h-[64px] mb-3":"h-0"),children:[a.jsx("div",{className:"flex h-9 px-4 w-full",children:a.jsx(Jm,{onSend:k,disabled:p,className:$("w-full",x.chatInput)})}),a.jsx("hr",{className:"border-border my-2 mx-5"})]}),a.jsxs("div",{className:$("flex flex-row items-center gap-2 rounded-2xl mx-auto border-none backdrop-blur-lg px-2 py-2",c==="light"?"bg-white/80":"bg-[#18182a]/80"),children:[a.jsxs("div",{className:"flex gap-y-2 justify-start",children:[E.microphone&&a.jsxs("div",{className:"flex gap-y-2 items-center rounded-full overflow-hidden border-none ",children:[a.jsx($n,{variant:"primary",source:I.Track.Source.Microphone,pressed:S.enabled,disabled:S.pending,onPressedChange:S.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),a.jsx(ue.BarVisualizer,{barCount:3,trackRef:v,options:{minHeight:5},className:"flex h-full w-auto items-center justify-center gap-x-0.5",children:a.jsx("span",{className:$(["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"])})}),a.jsx(Pi,{size:"sm",kind:"audioinput",client:d,onError:l?D=>D instanceof Error?l({source:I.Track.Source.Microphone,error:D}):void 0:void 0,onActiveDeviceChange:C,className:$(["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&&E.camera&&a.jsxs("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:[a.jsx($n,{variant:"primary",source:I.Track.Source.Camera,pressed:b.enabled,pending:b.pending,disabled:b.pending,onPressedChange:b.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),a.jsx(Pi,{size:"sm",kind:"videoinput",client:d,onError:l?D=>D instanceof Error?l({source:I.Track.Source.Camera,error:D}):void 0:void 0,onActiveDeviceChange:A,className:$(["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]"])})]}),n.suportsScreenShare&&E.screenShare&&a.jsx("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:a.jsx($n,{variant:"secondary",source:I.Track.Source.ScreenShare,pressed:w.enabled,disabled:w.pending,onPressedChange:w.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"})})]}),E.chat&&a.jsx("div",{className:"flex items-center rounded-full overflow-hidden bg-secondary text-secondary-foreground border-none ",children:a.jsx(Da,{variant:"secondary","aria-label":"Toggle chat",pressed:m,onPressedChange:D=>{f(D)},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:a.jsx(Ma,{weight:"bold",className:"h-5 w-5"})})})]})]})}const pf=(e,t)=>{var l,c;const n=h.useMemo(()=>t?t(e.message):e.message,[e.message,t]),s=!!e.editTimestamp,o=new Date(e.timestamp),r=typeof navigator<"u"?navigator.language:"en-US",i=(l=e.from)!=null&&l.name&&e.from.name!==""?e.from.name:(c=e.from)==null?void 0:c.identity;return{message:n,hasBeenEdited:s,time:o,locale:r,name:i}},gf=({entry:e,messageFormatter:t,className:n,participantName:s,...o})=>{var u,m;const{message:r,time:i,locale:l}=pf(e,t),c=((u=e.from)==null?void 0:u.isLocal)??!1;$("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 d=$("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 a.jsx("li",{title:i.toLocaleTimeString(l,{timeStyle:"full"}),className:$("group flex mb-2",c?"justify-end":"justify-start",n),...o,children:a.jsxs("div",{className:$("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:[a.jsx("span",{className:d,children:c?((m=s==null?void 0:s[0])==null?void 0:m.toUpperCase())||"U":"A"}),a.jsx("span",{className:$("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:r})]})})};function xf(e){y.useEffect(()=>{function t(){const n=e.current;n&&(n.scrollTop=n.scrollHeight)}if(e.current){const n=new ResizeObserver(t);return n.observe(e.current),t(),()=>n.disconnect()}},[e])}const yf=({className:e,children:t,...n})=>{const s=y.useRef(null);return xf(s),a.jsx("div",{ref:s,className:$("flex flex-col justify-end",e),...n,children:t})},bf=({state:e,audioTrack:t,className:n,ref:s})=>a.jsx("div",{ref:s,className:$("",n),children:a.jsx(ue.BarVisualizer,{barCount:5,state:e,options:{minHeight:5},trackRef:t,className:$("flex aspect-video w-40 items-center justify-center gap-1"),children:a.jsx("span",{className:$(["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]"])})})}),vf=({videoTrack:e,className:t,ref:n})=>{var s,o;return a.jsx("div",{ref:n,className:$(t),children:a.jsx(ue.VideoTrack,{trackRef:e,width:((s=e==null?void 0:e.publication.dimensions)==null?void 0:s.width)??0,height:((o=e==null?void 0:e.publication.dimensions)==null?void 0:o.height)??0,className:"rounded-md"})})},wf=Q.create(ue.VideoTrack),Sf=({trackRef:e,className:t,ref:n})=>{var s,o;return a.jsx("div",{className:$("bg-muted overflow-hidden rounded-md",t),children:a.jsx(wf,{ref:n,trackRef:e,width:((s=e==null?void 0:e.publication.dimensions)==null?void 0:s.width)??0,height:((o=e==null?void 0:e.publication.dimensions)==null?void 0:o.height)??0,className:$("h-full w-auto")})})},Ii=Q.create(Sf),Cf=Q.create(bf),kf=Q.create(vf),Le={initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},transition:{type:"spring",stiffness:675,damping:75,mass:1}},ot={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 jf(e){const{localParticipant:t}=ue.useLocalParticipant(),n=t.getTrackPublication(e);return y.useMemo(()=>n?{source:e,participant:t,publication:n}:void 0,[e,n,t])}function Ef({chatOpen:e}){const{state:t,audioTrack:n,videoTrack:s,agent:{isActive:o=!1}={}}=ue.useVoiceAssistant(),[r]=ue.useTracks([I.Track.Source.ScreenShare]),i=jf(I.Track.Source.Camera),l=i&&!i.publication.isMuted,c=r&&!r.publication.isMuted,d=l||c,u={...Le.transition,delay:e?0:.15},m={...Le.animate,scale:e?1:3,transition:u},f={...Le.animate,transition:u},p=u,g=u,x=s!==void 0;return a.jsx("div",{className:"relative w-full h-full z-10 flex items-center justify-center",children:a.jsx("div",{className:"relative w-full h-full max-w-2xl px-4 md:px-0",children:a.jsxs("div",{className:$(ot.grid),children:[o&&a.jsx("div",{className:$(["grid",!e&&ot.agentChatClosed,e&&d&&ot.agentChatOpenWithSecondTile,e&&!d&&ot.agentChatOpenWithoutSecondTile]),children:a.jsxs("div",{className:"h-full flex items-center justify-center",children:[!x&&a.jsx(Cf,{layoutId:"agent",...Le,animate:m,transition:p,state:t,audioTrack:n,className:$(e?"h-[90px]":"h-auto w-full")},"agent"),x&&a.jsx(kf,{layoutId:"avatar",...Le,animate:f,transition:g,videoTrack:s,className:$(e?"h-[90px] [&>video]:h-[90px] [&>video]:w-auto":"h-auto w-full")},"avatar")]})}),a.jsx("div",{className:$(["grid",e&&ot.secondTileChatOpen,!e&&ot.secondTileChatClosed]),children:a.jsxs("div",{className:"w-full px-10 flex items-center shadow-2xl justify-between",children:[i&&l&&a.jsx(Ii,{layout:"position",layoutId:"camera",...Le,trackRef:i,transition:{...Le.transition,delay:e?0:.15},className:"h-[60px] order-1"},"camera"),c&&a.jsx(Ii,{layout:"position",layoutId:"screen",...Le,trackRef:r,transition:{...Le.transition,delay:e?0:.15},className:"h-[70px] order-2"},"screen")]})})]})})})}function Di({timeout:e}){const[t,n]=y.useState(100),s=y.useRef(null),o=y.useRef(null);return y.useEffect(()=>{if(!e||e<=0)return;n(100),o.current=Date.now();const r=()=>{if(!e||o.current===null)return;const i=Date.now()-o.current,l=Math.max(0,100-i/e*100);n(l),l>0&&(s.current=requestAnimationFrame(r))};return s.current=requestAnimationFrame(r),()=>{s.current&&cancelAnimationFrame(s.current)}},[e]),!e||e<=0?null:a.jsx("div",{className:"w-full h-1 relative top-1 rounded-t-4xl bg-gray-700 overflow-hidden",children:a.jsx(Q.div,{className:"h-1 rounded-t-4xl dark:bg-white bg-blue-200 ",initial:{width:"100%"},animate:{width:`${Math.max(t,2)}%`},transition:{duration:.1,ease:"linear"},style:{minWidth:"2%"}})})}function pt({interaction:e,theme:t,onDismiss:n,client:s,addLocalMessage:o}){var l;if(!e||!e.isVisible||!e.component)return null;const[r]=h.useState(()=>Date.now()),i=()=>e.component?h.createElement(e.component,{handler:e.handler||void 0,timeout:e.timeout,loadData:async d=>{console.log("InteractiveComponent: Loading data:",d)},presentationMode:e.presentationMode,data:e.data,client:s,addLocalMessage:o}):a.jsx("div",{className:"p-4 text-red-500",children:"Component not found"});switch(e.presentationMode){case"fullscreen":return a.jsx(ut,{children:a.jsxs(Q.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999] bg-black",children:[a.jsxs("div",{className:"flex flex-col",children:[a.jsx(Di,{timeout:e.timeout}),a.jsxs("div",{className:"flex items-center justify-between p-4 bg-black/80 text-white border-b border-gray-700",children:[a.jsx("h3",{className:"text-lg font-semibold",children:e.methodName.replace(/_/g," ").replace(/\b\w/g,c=>c.toUpperCase())}),a.jsx("button",{onClick:n||((l=e.handler)==null?void 0:l.dismissView),className:"p-2 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors",children:a.jsx(pe.X,{className:"w-5 h-5"})})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:i()})]})});case"embedded":default:return a.jsx(ut,{children:a.jsx(Q.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"w-fit rounded-lg ",children:a.jsxs("div",{children:[a.jsx(Di,{timeout:e.timeout}),i()]})})})}}function Af(){const e=ue.useTranscriptions(),t=ue.useChat(),n=ue.useRoomContext();return{messages:y.useMemo(()=>[...e.map(r=>Em(r,n)),...t.chatMessages].sort((r,i)=>r.timestamp-i.timestamp),[e,t.chatMessages,n]),send:t.send}}const Mf=({logLevel:e}={})=>{const t=ue.useRoomContext();h.useEffect(()=>(I.setLogLevel(e??"debug"),window.__lk_room=t,()=>{window.__lk_room=void 0}),[t,e])},Tf=({disabled:e,capabilities:t,sessionStarted:n,ref:s,participantName:o="User",loadingText:r="Waiting for agent to connect...",theme:i="vox",client:l,displayType:c="widget",onBack:d})=>{var ne,te,se,z,M,G,Y;const[u,m]=y.useState(!1),[f,p]=y.useState(!1),[g,x]=y.useState(()=>{var q;const V=(q=l==null?void 0:l.getCurrentInteraction)==null?void 0:q.call(l);return console.log("SessionView: Initializing with existing interaction:",(V==null?void 0:V.methodName)||"none"),V||null}),{messages:v,send:E}=Af(),b=y.useRef(null),S=y.useRef(null),{agent:{isActive:w=!1}={}}=ue.useVoiceAssistant(),C=ye(i),A=y.useMemo(()=>l&&typeof l.getCurrentSession=="function"?!!l.getCurrentSession():!1,[l]),j=w||A;y.useEffect(()=>{var V,q;console.log("🤖 SessionView agent state:",{isAgentActive:w,hasActiveSession:A,effectiveAgentActive:j,sessionStarted:n,clientSession:(q=(V=l==null?void 0:l.getCurrentSession)==null?void 0:V.call(l))==null?void 0:q.id})},[w,A,j,n,l]),y.useEffect(()=>{console.log("🤖 Agent active state changed:",w)},[w]),y.useEffect(()=>{console.log("📋 Session state changed:",{sessionStarted:n,disabled:e,participantName:o,effectiveAgentActive:j,chatOpen:u,currentInteraction:(g==null?void 0:g.methodName)||"none"})},[n,e,o,j,u,g]),y.useEffect(()=>{if(n&&!w){console.log("⏰ Starting agent timeout detection...");const V=setTimeout(()=>{console.log("⚠️ Agent timeout: Agent did not become active within 30 seconds"),p(!0)},3e4);return()=>{clearTimeout(V)}}else w&&(console.log("✅ Agent is active, clearing timeout"),p(!1))},[n,w]),y.useEffect(()=>{if(!l)return;const V=()=>{console.log("🔄 Client connection state changed:",l.connected)},q=T=>{console.log("🔴 Client disconnected:",T),x(null),m(!1),p(!1)};return l.on("connection.connected",V),l.on("connection.disconnected",q),()=>{l.off("connection.connected",V),l.off("connection.disconnected",q)}},[l]),y.useEffect(()=>{if(!l)return;const V=Z=>{console.log("🎯 SessionView: RPC Interaction started:",Z);const B=l.getCurrentInteraction();B&&(console.log("📱 SessionView: Setting current interaction:",B.methodName,"mode:",B.presentationMode),x(B))},q=Z=>{console.log("✅ SessionView: RPC Interaction completed:",Z),x(null)},T=async Z=>{console.log("⏰ SessionView: RPC Interaction timeout:",Z),x(null)},F=async Z=>{console.log("❌ SessionView: RPC Interaction dismissed:",Z),x(null)};return l.on("rpc.interaction.started",V),l.on("rpc.interaction.completed",q),l.on("rpc.interaction.timeout",T),l.on("rpc.interaction.dismissed",F),()=>{l.off("rpc.interaction.started",V),l.off("rpc.interaction.completed",q),l.off("rpc.interaction.timeout",T),l.off("rpc.interaction.dismissed",F)}},[l]),y.useEffect(()=>{if(!l)return;const V=l.getCurrentInteraction();V?(console.log("🔄 SessionView: Syncing with existing interaction:",V.methodName),x(V)):x(null)},[l]),y.useEffect(()=>{console.log("🎭 SessionView: Current interaction changed:",(g==null?void 0:g.methodName)||"none","mode:",(g==null?void 0:g.presentationMode)||"none")},[g]),y.useEffect(()=>{var V,q,T;console.log("📱 SessionView: Display type changed to:",c),console.log("📱 SessionView: Current session state during display change:",{sessionStarted:n,effectiveAgentActive:j,hasSession:!!((V=l==null?void 0:l.getCurrentSession)!=null&&V.call(l)),sessionId:(T=(q=l==null?void 0:l.getCurrentSession)==null?void 0:q.call(l))==null?void 0:T.id})},[c,n,j,l]),y.useEffect(()=>{console.log("💬 SessionView: Chat open state changed:",u)},[u]),y.useEffect(()=>{g&&u&&(console.log("🎭 SessionView: Interactive UI appeared, closing chat"),m(!1))},[g,u]),Mf(),y.useEffect(()=>{b.current&&u&&v.length>0&&(console.log("📜 SessionView: Auto-scrolling to latest message, count:",v.length),setTimeout(()=>{if(b.current){let V=b.current.parentElement;for(;V&&V.scrollHeight<=V.clientHeight;)V=V.parentElement;V?(console.log("📜 SessionView: Scrolling container found, scrolling to bottom"),V.scrollTo({top:V.scrollHeight,behavior:"smooth"})):(console.log("📜 SessionView: Using fallback scroll method"),b.current.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"}))}},100))},[v.length,u]),y.useEffect(()=>{var T,F;console.log("📝 SessionView: Messages updated, count:",v.length),v.length>0&&console.log("📝 SessionView: Latest messages:",v.slice(-3).map(Z=>{var B,R,_,K,O,re,oe;return{id:Z.id,message:Z.message,timestamp:Z.timestamp,from:((B=Z.from)==null?void 0:B.name)||((R=Z.from)==null?void 0:R.identity),fromType:Z.from===void 0?"unknown":"participant",isLocal:((_=Z.from)==null?void 0:_.identity)===((re=(O=(K=l==null?void 0:l.getCurrentSession)==null?void 0:K.call(l))==null?void 0:O.localParticipant)==null?void 0:re.identity),messageLength:((oe=Z.message)==null?void 0:oe.length)||0}}));const V=((T=l==null?void 0:l.getTranscriptions)==null?void 0:T.call(l))||[],q=((F=l==null?void 0:l.getChatMessages)==null?void 0:F.call(l))||[];console.log("📝 SessionView: Raw transcriptions count:",V.length),console.log("📝 SessionView: Raw chat messages count:",q.length)},[v.length,v,l]),y.useEffect(()=>{console.log("💬 SessionView: Chat state changed:",{chatOpen:u,messagesCount:v.length,displayType:c,hasMessages:v.length>0})},[u,v.length,c]);async function k(V){await E(V)}const D=y.useCallback(V=>{console.log("📝 SessionView: Adding local message for voice session context:",V)},[]),L=y.useCallback(async V=>{try{l&&typeof l.sendAttachments=="function"&&(await l.sendAttachments(V),console.log("📎 SessionView: Attachments sent successfully:",V.map(q=>q.name)))}catch(q){console.error("❌ SessionView: Failed to send attachments:",q)}},[l]),W=y.useCallback(()=>{try{console.log("📞 SessionView: Ending call..."),console.log("📞 SessionView: Current state before ending:",{sessionStarted:n,effectiveAgentActive:j,chatOpen:u,currentInteraction:g==null?void 0:g.methodName,hasOnBack:!!d}),g&&(console.log("🎭 SessionView: Dismissing current interaction:",g.methodName),x(null),l&&typeof l.dismissCurrentInteraction=="function"&&l.dismissCurrentInteraction()),m(!1),p(!1),console.log("✅ SessionView: Local state reset"),l&&typeof l.endSession=="function"&&(l.endSession(),console.log("✅ SessionView: Session ended via client.endSession()")),l&&typeof l.disconnect=="function"&&(l.disconnect(),console.log("✅ SessionView: Client disconnected")),d?(console.log("🔄 SessionView: Calling onBack to return to welcome..."),setTimeout(()=>{d(),console.log("✅ SessionView: onBack called")},150)):console.warn("⚠️ SessionView: No onBack function provided - cannot return to welcome"),console.log("🏁 SessionView: Call ended and cleanup completed")}catch(V){console.error("❌ SessionView: Failed to end call:",V),x(null),m(!1),p(!1),d&&(console.log("🔄 SessionView: Error occurred, still calling onBack..."),d())}},[l,d,g,n,j,u]);y.useEffect(()=>(console.log("🔄 SessionView: Component mounted/props changed:",{sessionStarted:n,disabled:e,participantName:o,displayType:c,hasOnBack:!!d,hasClient:!!l}),()=>{console.log("🧹 SessionView: Component unmounting or props changing")}),[n,e,o,c,d,l]),y.useEffect(()=>{console.log("🔗 SessionView: onBack prop:",{hasOnBack:!!d,onBackType:typeof d})},[d]),y.useEffect(()=>{var q,T;const V=((T=(q=l==null?void 0:l.getCurrentSession)==null?void 0:q.call(l))==null?void 0:T.id)||null;S.current&&!V&&console.warn("⚠️ SessionView: Session was lost unexpectedly!",{previousSession:S.current,currentSession:V,displayType:c,sessionStarted:n,effectiveAgentActive:j}),S.current=V},[l,c,n,j]);const H=$("w-full flex flex-col items-center justify-center",c==="fullscreen"?"w-full max-w-none mx-0 h-full":"w-full mx-auto",C.main,c==="fullscreen"?"max-w-none":"","overflow-hidden","h-full"),Ce=d&&(c==="popup"||c==="fullscreen");return a.jsxs("main",{ref:s,inert:e,className:$(H,"relative"),style:{minHeight:0},children:[Ce&&a.jsx("div",{className:`flex items-center justify-between w-full p-4 border-b ${((ne=C.chatHeader)==null?void 0:ne.container)||"border-gray-200"}`,children:a.jsx("div",{className:"flex items-center",children:a.jsxs("div",{children:[a.jsx("h3",{className:`font-semibold ${C.text.primary}`,children:"Voice Session"}),a.jsx("p",{className:`text-sm ${C.text.muted}`,children:o})]})})}),a.jsxs("div",{className:"w-full flex-1 flex flex-col items-center px-0 min-h-0 overflow-hidden",children:[!j&&a.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full min-h-[180px]",children:[a.jsx(Q.div,{animate:{rotate:360,scale:[1,1.1,1]},transition:{rotate:{duration:2,repeat:1/0,ease:"linear"},scale:{duration:1,repeat:1/0,ease:"easeInOut"}},className:"w-12 h-12 mb-4",children:a.jsx(Js,{className:C.spinner,weight:"bold"})}),a.jsx(Q.span,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`text-sm opacity-80 ${C.text.muted} text-center max-w-xs`,children:f?"Agent is taking longer than expected...":r}),a.jsx(Q.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:2},className:`text-xs ${C.text.muted} mt-2 text-center opacity-60`,children:f?"Please check your connection or try again.":"Agent is connecting... This may take a moment."}),f&&d&&a.jsx(Q.button,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.5},onClick:d,className:`mt-4 px-4 py-2 rounded-lg ${((te=C.chatHeader)==null?void 0:te.backButton)||"bg-gray-100 hover:bg-gray-200"} transition-colors`,children:"Go Back"})]}),j&&a.jsxs(a.Fragment,{children:[u&&a.jsxs("div",{className:$("absolute inset-0 w-full h-full flex flex-col transition-[opacity,translate] duration-300 ease-out z-10",i==="light"?"bg-white":"bg-gray-900/95 backdrop-blur-sm",u?"translate-y-0 opacity-100 delay-200":"translate-y-10 opacity-0"),children:[a.jsxs("div",{className:$("flex-shrink-0 px-4 py-3 border-b",c==="fullscreen"?"px-8":"px-5",((se=C.chatHeader)==null?void 0:se.container)||"border-gray-200 dark:border-gray-700"),children:[a.jsx("h3",{className:$("font-semibold text-lg",((z=C.text)==null?void 0:z.primary)||"text-gray-900 dark:text-white"),children:"Transcription & Chat"}),a.jsxs("p",{className:$("text-sm",((M=C.text)==null?void 0:M.muted)||"text-gray-600 dark:text-gray-400"),children:[v.length," messages"]})]}),a.jsx("div",{className:$("flex-1 flex flex-col min-h-0",c==="fullscreen"?"px-8":"px-5"),children:a.jsx(yf,{className:"flex-1 flex flex-col min-h-0 h-full",children:a.jsxs("div",{className:`flex-1 flex flex-col h-full ${$("overflow-y-auto scrollbar-hide py-4")}`,style:{scrollbarWidth:"none",scrollBehavior:"smooth",paddingBottom:"120px"},children:[v.length===0&&a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:$("text-lg font-medium mb-2",((G=C.text)==null?void 0:G.primary)||"text-gray-900 dark:text-white"),children:"Start Speaking"}),a.jsx("p",{className:$("text-sm",((Y=C.text)==null?void 0:Y.muted)||"text-gray-600 dark:text-gray-400"),children:"Your conversation will appear here"})]})}),v.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex-1 min-h-4"}),a.jsx("div",{ref:b,className:"space-y-4 relative whitespace-pre-wrap z-0",children:a.jsx(ut,{mode:"popLayout",children:v.map((V,q)=>a.jsx(Q.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.3,ease:"easeOut",delay:q*.02},layout:!0,children:a.jsx(gf,{participantName:o,entry:V})},V.id||`message-${q}`))})})]})]})})})]}),!u&&a.jsxs("div",{className:$("flex-1 flex flex-col items-center w-full h-full min-h-0",(g==null?void 0:g.presentationMode)==="embedded"?"justify-end":"justify-center"),children:[a.jsx(Q.div,{className:"w-full flex justify-center",animate:{y:(g==null?void 0:g.presentationMode)==="embedded"?-8:0},transition:{duration:.3,ease:"easeOut"},children:a.jsx(Ef,{chatOpen:u})}),a.jsx(ut,{mode:"wait",children:g&&g.presentationMode==="embedded"&&a.jsx(Q.div,{initial:{opacity:0,y:20,height:0},animate:{opacity:1,y:0,height:"auto"},exit:{opacity:0,y:20,height:0},transition:{duration:.3,ease:"easeOut"},className:$("w-full relative mt-4 flex justify-center",c==="fullscreen"?"max-w-4xl":"max-w-md"),children:a.jsx("div",{className:"bg-white/10 backdrop-blur-sm rounded-xl border border-white/20 shadow-lg overflow-hidden",children:a.jsx(pt,{interaction:g,theme:i,onDismiss:()=>{var V;return(V=l==null?void 0:l.dismissCurrentInteraction)==null?void 0:V.call(l)},client:l,addLocalMessage:D})})},`embedded-${g.methodName}`)})]})]})]}),a.jsx(ut,{mode:"wait",children:g&&g.presentationMode!=="embedded"&&!u&&a.jsx("div",{className:$("absolute inset-0 z-50 flex items-center justify-center backdrop-blur-sm",c==="fullscreen"?"bg-black/70":"bg-black/50"),children:a.jsx(Q.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},className:$("relative w-full overflow-hidden",c==="fullscreen"?"max-w-2xl mx-8 max-h-[85vh]":"max-w-lg mx-4 max-h-[80vh]","bg-white dark:bg-gray-900 rounded-2xl shadow-2xl","border border-gray-200 dark:border-gray-700"),children:a.jsx(pt,{interaction:g,theme:i,onDismiss:()=>{var V;return(V=l==null?void 0:l.dismissCurrentInteraction)==null?void 0:V.call(l)},client:l,addLocalMessage:D})},`modal-${g.methodName}`)})}),a.jsx(Q.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"absolute bottom-0 left-0 right-0 flex-shrink-0 w-full z-20",children:a.jsx(Vf,{capabilities:t,onSendMessage:k,onSendAttachments:L,onEndCall:W,onChatOpenChange:m,disabled:e,theme:i,client:l,sessionStarted:n})})]})};function Vf({capabilities:e,onSendMessage:t,onSendAttachments:n,onEndCall:s,onChatOpenChange:o,disabled:r=!1,theme:i,client:l,sessionStarted:c=!1}){const[d,u]=y.useState(!1),m=y.useRef(null),f=y.useRef(null);y.useEffect(()=>{const b=()=>{const S=navigator.userAgent.toLowerCase(),C=["android","iphone","ipad","mobile","tablet"].some(k=>S.includes(k)),A="ontouchstart"in window||navigator.maxTouchPoints>0,j=window.innerWidth<=768;u(C||A&&j)};return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[]);const p=b=>{const S=b.target.files;if(S&&S.length>0){const C=Array.from(S).filter(A=>A.type.startsWith("image/"));if(C.length===0){console.warn("No valid image files selected");return}n&&n(C),m.current&&(m.current.value="")}},g=b=>{const S=b.target.files;if(S&&S.length>0){const w=S[0];w.type.startsWith("image/")&&n&&n([w]),f.current&&(f.current.value="")}},x=()=>{!r&&m.current&&m.current.click()},v=()=>{!r&&d&&f.current&&f.current.click()},E=()=>{console.log("🔴 VoiceControlPanel: End call button clicked"),console.log("🔴 VoiceControlPanel: Current state:",{disabled:r,sessionStarted:c,hasOnEndCall:!!s}),s?s():console.warn("⚠️ VoiceControlPanel: No onEndCall function provided")};return a.jsx("div",{className:$("px-4 py-3 !w-full backdrop-blur-xl border-0 shadow-lg",i==="light"?"bg-white/95 border-t border-gray-200":"bg-gray-900/95 border-t border-gray-700"),children:a.jsxs("div",{className:"flex items-center justify-between !w-full mx-auto max-w-4xl",children:[a.jsx("input",{ref:m,type:"file",multiple:!0,onChange:p,className:"hidden",accept:"image/*"}),a.jsx("input",{ref:f,type:"file",onChange:g,className:"hidden",accept:"image/*",capture:"environment"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:x,disabled:r,className:$("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",r?"opacity-50 cursor-not-allowed":"hover:shadow-md",i==="light"?"bg-gray-100 hover:bg-gray-200 text-gray-600":"bg-gray-700/50 hover:bg-gray-600/50 text-gray-300"),title:"Attach files",children:a.jsx(Be.AttachFile,{className:"w-5 h-5"})}),d&&a.jsx("button",{onClick:v,disabled:r,className:$("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",r?"opacity-50 cursor-not-allowed":"hover:shadow-md",i==="light"?"bg-gray-100 hover:bg-gray-200 text-gray-600":"bg-gray-700/50 hover:bg-gray-600/50 text-gray-300"),title:"Take photo",children:a.jsx(Be.CameraAlt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"flex-1 flex justify-center px-4",children:a.jsx(ff,{capabilities:e,onChatOpenChange:o,onSendMessage:t,theme:i,client:l,className:"border-none py-1 rounded-xl max-w-md w-full"})}),a.jsx("div",{className:"flex items-center",children:a.jsx("button",{onClick:E,disabled:r||!c,className:$("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",r||!c?"opacity-50 cursor-not-allowed":"hover:shadow-md","bg-red-500 hover:bg-red-600 text-white"),title:"End call",children:a.jsx(Be.CallEnd,{className:"w-5 h-5"})})})]})})}function Nf({onSendMessage:e,onSendAttachments:t,disabled:n,theme:s,onEndChat:o}){const[r,i]=h.useState(""),[l,c]=h.useState(!1),d=h.useRef(null),u=h.useRef(null),[m,f]=h.useState(!1),p=ye(s);h.useEffect(()=>{const w=()=>{const C=navigator.userAgent.toLowerCase(),j=["android","iphone","ipad","mobile","tablet"].some(L=>C.includes(L)),k="ontouchstart"in window||navigator.maxTouchPoints>0,D=window.innerWidth<=768;f(j||k&&D)};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]);const g=w=>{w.preventDefault(),r.trim()&&!n&&(e(r.trim()),i(""))},x=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),g(w))},v=w=>{const C=w.target.files;if(C&&C.length>0){const A=Array.from(C),j=A.filter(k=>k.type.startsWith("image/"));if(j.length===0){console.warn("No valid image files selected");return}j.length!==A.length&&console.warn("Some non-image files were filtered out"),console.log("Selected image files:",j),t(j),d.current&&(d.current.value="")}},E=()=>{!n&&d.current&&d.current.click()},b=()=>{!n&&m&&u.current&&u.current.click()},S=w=>{const C=w.target.files;if(C&&C.length>0){const A=C[0];A.type.startsWith("image/")?t([A]):console.warn("Selected file is not an image"),u.current&&(u.current.value="")}};return a.jsx("div",{className:"px-4 py-3 !w-full backdrop-blur-xl border-0 shadow-lg ",children:a.jsx("form",{onSubmit:g,className:"flex items-center !w-full mx-auto max-w-4xl",children:a.jsxs("div",{className:`flex items-center gap-2 !w-full backdrop-blur-md rounded-full px-3 py-2 shadow-sm hover:shadow-md focus-within:shadow-lg focus-within:ring-2 focus-within:ring-blue-500/30 focus-within:border-blue-500/50 transition-all duration-200 border ${s==="light"?"bg-white/90 border-gray-200":p.chatInput.container}`,children:[a.jsx(Q.button,{type:"button",onClick:E,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 ${p.chatInput.attachButton}`,disabled:n,"aria-label":"Attach file",children:a.jsx(pe.Paperclip,{className:"w-4 h-4"})}),m&&a.jsx(Q.button,{type:"button",onClick:b,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 ${p.chatInput.attachButton}`,disabled:n,"aria-label":"Take photo",children:a.jsx(pe.Camera,{className:"w-4 h-4"})}),a.jsx("input",{ref:d,type:"file",multiple:!0,onChange:v,className:"hidden",accept:"image/*"}),a.jsx("input",{ref:u,type:"file",onChange:S,className:"hidden",accept:"image/*",capture:"environment"}),a.jsx("textarea",{value:r,onChange:w=>i(w.target.value),onKeyDown:x,onFocus:()=>c(!0),onBlur:()=>c(!1),placeholder:"Type your message...",disabled:n,className:`flex-1 px-2 py-1 bg-transparent resize-none min-h-[32px] max-h-20 focus:outline-none text-sm border-0 ${p.chatInput.textarea}`,rows:1,style:{height:"auto",minHeight:"32px"},onInput:w=>{const C=w.target;C.style.height="auto",C.style.height=`${Math.min(C.scrollHeight,80)}px`}}),a.jsx(Q.button,{type:"submit",disabled:n||!r.trim(),whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 flex-shrink-0 ${r.trim()&&!n?p.chatInput.sendButton:s==="light"?"bg-gray-200 text-gray-400 cursor-not-allowed opacity-70":"bg-gray-600/50 text-gray-500 cursor-not-allowed opacity-50"}`,"aria-label":"Send message",children:a.jsx(pe.SendHorizontal,{className:"w-4 h-4"})}),o&&a.jsx(Q.button,{type:"button",onClick:o,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 flex-shrink-0 ${p.chatInput.endButton}`,"aria-label":"End chat",children:a.jsx(pe.PhoneOff,{className:"w-4 h-4"})})]})})})}function Pf({text:e,isComplete:t,isRealTimeStream:n=!1,speed:s=50}){const[o,r]=h.useState(""),[i,l]=h.useState(0);return h.useEffect(()=>{if(n){r(e);return}if(t){r(e);return}if(i<e.length){const c=setTimeout(()=>{r(e.slice(0,i+1)),l(i+1)},s);return()=>clearTimeout(c)}},[e,i,t,s,n]),h.useEffect(()=>{n||(l(0),r(""))},[e,n]),a.jsxs("span",{className:"relative",children:[a.jsx("span",{className:"inline-block",children:o}),!t&&a.jsx("span",{className:"inline-flex items-center ml-1",children:[0,1,2].map(c=>a.jsx(Q.span,{className:"w-1.5 h-1.5 bg-current rounded-full mx-0.5",animate:{y:[0,-4,0],opacity:[.4,1,.4],scale:[.8,1,.8]},transition:{duration:.8,repeat:1/0,repeatType:"mirror",delay:c*.2,ease:"easeInOut"}},c))})]})}function Rf({message:e,theme:t,isOwn:n,isStreaming:s=!1}){var i,l;const o=ye(t),r=e.sender.name?e.sender.name.split(" ").map(c=>c[0]).join("").toUpperCase().slice(0,2):"U";return a.jsx("div",{className:`flex w-full ${n?"justify-end":"justify-start"} mb-4 px-1`,children:a.jsxs("div",{className:`relative group ${n?"flex-row-reverse":"flex-row"} flex items-end gap-3 max-w-[85%]`,children:[a.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${n?t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700":t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:r}),a.jsxs("div",{className:`
|
|
10
10
|
relative px-3 py-2 rounded-2xl break-words shadow-lg backdrop-blur-sm message-bubble message-hover
|
|
11
11
|
${n?`${o.chatMessage.own} rounded-br-md`:`${o.chatMessage.other} rounded-bl-md`}
|
|
12
12
|
${s?"shimmer":""}
|
|
13
13
|
transition-all duration-200 group-hover:scale-[1.02]
|
|
14
|
-
`,style:{wordWrap:"break-word",overflowWrap:"break-word"},children:[a.jsx("div",{className:"whitespace-pre-wrap break-words leading-relaxed text-sm",children:((i=e.metadata)==null?void 0:i.type)==="attachment"?a.jsx(
|
|
14
|
+
`,style:{wordWrap:"break-word",overflowWrap:"break-word"},children:[a.jsx("div",{className:"whitespace-pre-wrap break-words leading-relaxed text-sm",children:((i=e.metadata)==null?void 0:i.type)==="attachment"?a.jsx(Ff,{message:e,theme:t,isOwn:n}):s&&!n?a.jsx(Pf,{text:e.content,isComplete:!s,isRealTimeStream:((l=e.metadata)==null?void 0:l.streaming)===!0,speed:35}):e.content}),a.jsx("div",{className:"text-xs",children:e.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})})}function If(e,t){return e.startsWith("image/")?pe.Image:e.startsWith("video/")?pe.Video:e.startsWith("audio/")?pe.Music:e.includes("zip")||e.includes("rar")||e.includes("archive")?pe.Archive:pe.FileText}function Df(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,s)).toFixed(2))+" "+n[s]}function Ff({message:e,theme:t,isOwn:n}){const s=ye(t),o=e.metadata,r=(o==null?void 0:o.fileName)||"Unknown file",i=(o==null?void 0:o.fileSize)||0,l=(o==null?void 0:o.mimeType)||"application/octet-stream",c=o==null?void 0:o.downloading,d=o==null?void 0:o.uploading,u=(o==null?void 0:o.downloadProgress)||0,m=(o==null?void 0:o.uploadProgress)||0,f=o==null?void 0:o.downloadUrl,p=o==null?void 0:o.file,g=If(l),x=c||d,v=c?u:m,E=c?"Downloading...":d?"Uploading...":"Complete",[b,S]=h.useState(null);h.useEffect(()=>{if(f)S(f);else if(p&&l.startsWith("image/")){const j=URL.createObjectURL(p);return S(j),()=>URL.revokeObjectURL(j)}else S(null)},[f,p,l]);const w=()=>{if(f){const j=document.createElement("a");j.href=f,j.download=r,j.click()}},A=l.startsWith("image/")&&b;return a.jsxs("div",{className:"flex flex-col gap-2 max-w-sm",children:[A&&a.jsxs("div",{className:"relative rounded-lg overflow-hidden",children:[a.jsx("img",{src:b,alt:r,className:"max-w-full h-auto max-h-48 object-cover rounded-lg cursor-pointer",onClick:w}),a.jsx("div",{className:"absolute inset-0 bg-black/0 hover:bg-black/10 transition-colors duration-200 cursor-pointer"})]}),a.jsxs("div",{className:`
|
|
15
15
|
flex items-center gap-3 p-3 rounded-lg border transition-all duration-200
|
|
16
16
|
${t==="light"?"bg-gray-50 border-gray-200 hover:bg-gray-100":"bg-gray-800/50 border-gray-700 hover:bg-gray-700/50"}
|
|
17
17
|
`,children:[a.jsx("div",{className:`
|
|
18
18
|
p-2 rounded-lg flex-shrink-0
|
|
19
19
|
${t==="light"?"bg-blue-100 text-blue-600":"bg-blue-900/50 text-blue-400"}
|
|
20
|
-
`,children:a.jsx(
|
|
20
|
+
`,children:a.jsx(g,{className:"w-5 h-5"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:`font-medium text-sm truncate ${s.text.primary}`,children:r}),a.jsxs("div",{className:`text-xs ${s.text.muted}`,children:[i>0&&Df(i),x&&a.jsxs(a.Fragment,{children:[i>0&&" • ",E," ",Math.round(v*100),"%"]})]}),x&&a.jsx("div",{className:`
|
|
21
21
|
w-full h-1 rounded-full mt-1 overflow-hidden
|
|
22
22
|
${t==="light"?"bg-gray-200":"bg-gray-700"}
|
|
23
23
|
`,children:a.jsx(Q.div,{className:`h-full ${t==="light"?"bg-blue-500":"bg-blue-400"}`,initial:{width:0},animate:{width:`${v*100}%`},transition:{duration:.3}})})]}),f&&!x&&a.jsx(Q.button,{onClick:w,whileHover:{scale:1.05},whileTap:{scale:.95},className:`
|
|
24
24
|
p-2 rounded-lg transition-colors duration-200
|
|
25
25
|
${t==="light"?"hover:bg-gray-200 text-gray-600 hover:text-gray-800":"hover:bg-gray-600 text-gray-400 hover:text-gray-200"}
|
|
26
|
-
`,"aria-label":"Download file",children:a.jsx(ge.Download,{className:"w-4 h-4"})})]})]})}function Bf(){return a.jsxs("div",{className:"max-w-xs mx-auto bg-green-50 border border-green-200 rounded-lg shadow p-3 flex flex-col items-center",children:[a.jsx("div",{className:"text-2xl mb-2",children:"✅"}),a.jsx("div",{className:"text-green-700 font-semibold text-sm mb-1",children:"Success!"}),a.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:"Your action was completed successfully."})]})}function $f(){return a.jsxs("div",{className:"max-w-xs mx-auto bg-yellow-50 border border-yellow-200 rounded-lg shadow p-3 flex flex-col items-center",children:[a.jsx("div",{className:"text-2xl mb-2",children:"⏰"}),a.jsx("div",{className:"text-yellow-700 font-semibold text-sm mb-1",children:"Interaction timed out"}),a.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:"No response was provided in time."})]})}function Of({client:e,theme:t="vox",onBack:n,disabled:s=!1,displayType:o="widget",onEndChat:r}){const[i,l]=h.useState(()=>{if(e&&typeof e.getChatMessages=="function"){const T=e.getChatMessages();return console.log("🔄 ChatView: Initializing with existing messages:",T.length),T}return[]}),[c,d]=h.useState(!0),[u,m]=h.useState(()=>{const T=e&&typeof e.getCurrentSession=="function"&&!!e.getCurrentSession(),F=e&&typeof e.getChatMessages=="function"&&e.getChatMessages().length>0;return!T&&!F}),[f,g]=h.useState(new Set),[p,x]=h.useState([]),[v,E]=h.useState(!1),[b,S]=h.useState(!1),[w,C]=h.useState(()=>{const T=e.getCurrentInteraction();return console.log("ChatView: Initializing with existing interaction:",(T==null?void 0:T.methodName)||"none"),T}),A=h.useRef(null),j=ye(t);h.useEffect(()=>{const T=()=>{const F=navigator.userAgent.toLowerCase(),B=["android","iphone","ipad","mobile","tablet"].some(O=>F.includes(O)),R="ontouchstart"in window||navigator.maxTouchPoints>0,_=window.innerWidth<=768,K=B||R&&_;E(K),K&&o==="widget"&&S(!0)};return T(),window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[o]),h.useEffect(()=>(b&&v&&(document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.height="100%",document.documentElement.requestFullscreen&&document.documentElement.requestFullscreen().catch(console.log)),()=>{b&&v&&(document.body.style.overflow="unset",document.body.style.position="unset",document.body.style.width="unset",document.body.style.height="unset",document.fullscreenElement&&document.exitFullscreen().catch(console.log))}),[b,v]);const k=e.getCurrentAgentInfo(),D=(k==null?void 0:k.name)||"AI Assistant",L=D.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),W=h.useCallback(T=>{const F={id:`local_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:T,timestamp:new Date,sender:{id:"participant",name:"You",type:"participant"},metadata:{isLocal:!0}};l(z=>(console.log("ChatView: Adding local message:",F.id),[...z,F]))},[]);h.useEffect(()=>{var T,F,z,B,R;console.log("💬 ChatView loading state:",{isLoading:u,hasActiveSession:!!((T=e==null?void 0:e.getCurrentSession)!=null&&T.call(e)),messagesCount:i.length,sessionId:(z=(F=e==null?void 0:e.getCurrentSession)==null?void 0:F.call(e))==null?void 0:z.id,hasStoredMessages:!!((R=(B=e==null?void 0:e.getChatMessages)==null?void 0:B.call(e))!=null&&R.length),isMobile:v,isFullscreen:b})},[u,i.length,e,v,b]);const H=h.useCallback((T=!1)=>{A.current&&(T?A.current.scrollIntoView({behavior:"auto"}):A.current.scrollIntoView({behavior:"smooth"}))},[]);h.useEffect(()=>{H(!0);const T=setTimeout(()=>{H(!1)},10);return()=>clearTimeout(T)},[i.length,H]),h.useEffect(()=>{if(w){H(!0);const T=setTimeout(()=>{H(!1)},50);return()=>clearTimeout(T)}},[w,H]),h.useEffect(()=>{const T=B=>{if(console.log("ChatView: Received message:",B),m(!1),w&&B.sender.type==="agent"){console.log("ChatView: Queuing agent message due to active interaction:",w.methodName),x(R=>[...R,B]);return}B.sender.type==="agent"&&d(!1),l(R=>{var K;if(R.some(O=>O.id===B.id))return console.log("ChatView: Message already exists, skipping:",B.id),R;if(console.log("ChatView: Adding new message:",B.id),B.sender.type==="agent"&&(g(O=>new Set(O).add(B.id)),!((K=B.metadata)!=null&&K.streaming))){const O=B.content.length*35+1e3;setTimeout(()=>{g(re=>{const oe=new Set(re);return oe.delete(B.id),oe})},O)}return[...R,B]}),setTimeout(()=>H(!0),0)},F=B=>{var R;if(console.log("ChatView: Updated message:",B),w&&B.sender.type==="agent"){console.log("ChatView: Queuing agent message update due to active interaction:",w.methodName),x(_=>{const K=_.findIndex(O=>O.id===B.id);if(K>=0){const O=[..._];return O[K]=B,O}else return[..._,B]});return}l(_=>_.map(K=>K.id===B.id?{...B}:K)),setTimeout(()=>H(!0),0),(R=B.metadata)!=null&&R.streaming||g(_=>{const K=new Set(_);return K.delete(B.id),K})},z=B=>{console.log("ChatView: Sent message:",B),m(!1),l(R=>R.some(K=>K.id===B.id)?(console.log("ChatView: Sent message already exists, skipping:",B.id),R):(console.log("ChatView: Adding sent message:",B.id),[...R,B])),setTimeout(()=>H(!0),0)};return e.on("chat.message.received",T),e.on("chat.message.updated",F),e.on("chat.message.sent",z),()=>{e.off("chat.message.received",T),e.off("chat.message.updated",F),e.off("chat.message.sent",z)}},[e,w]),h.useEffect(()=>{const T=R=>{console.log("ChatView: RPC interaction started:",R);const _=e.getCurrentInteraction();console.log("ChatView: Got interaction from client:",_==null?void 0:_.methodName),C(_),d(!1),H(!0),setTimeout(()=>{H(!1)},100)},F=R=>{if(console.log("ChatView: RPC interaction completed:",R),C(null),p.length>0&&(console.log("ChatView: Processing",p.length,"queued messages"),l(_=>{const K=[..._];return p.forEach(O=>{var oe;if(!K.some(he=>he.id===O.id)&&(console.log("ChatView: Adding queued message:",O.id),K.push(O),O.sender.type==="agent"&&(g(he=>new Set(he).add(O.id)),!((oe=O.metadata)!=null&&oe.streaming)))){const he=O.content.length*35+1e3;setTimeout(()=>{g(ve=>{const De=new Set(ve);return De.delete(O.id),De})},he)}}),K}),x([]),setTimeout(()=>H(!0),0)),R&&R.response&&R.response.success){let _=null;R.response.successView?_=R.response.successView:R.successView&&(_=R.successView),l(K=>{const O=[...K].reverse().findIndex(ve=>ve.sender.type==="participant");let re=K.length;O!==-1&&(re=K.length-O);const oe={id:`success_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:"",timestamp:new Date,sender:{id:"participant",name:"You",type:"participant"},metadata:{type:"successView",view:_||a.jsx(Bf,{})}};e&&typeof e.addChatMessage=="function"&&e.addChatMessage(oe);const he=[...K];return he.splice(re,0,oe),he})}},z=async R=>{w&&(console.log("ChatView: Dismissing active interaction due to timeout"),e.dismissCurrentInteraction()),C(null),p.length>0&&(console.log("ChatView: Processing",p.length,"queued messages after timeout"),l(K=>{const O=[...K];return p.forEach(re=>{var he;if(!O.some(ve=>ve.id===re.id)&&(O.push(re),re.sender.type==="agent"&&(g(ve=>new Set(ve).add(re.id)),!((he=re.metadata)!=null&&he.streaming)))){const ve=re.content.length*35+1e3;setTimeout(()=>{g(De=>{const zt=new Set(De);return zt.delete(re.id),zt})},ve)}}),O}),x([]),setTimeout(()=>H(!0),0));let _=null;R&&R.response&&R.response.timeoutView?_=R.response.timeoutView:R&&R.timeoutView&&(_=R.timeoutView),l(K=>{const O={id:`timeout_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:"",timestamp:new Date,sender:{id:"agent",name:D,type:"agent"},metadata:{type:"timeoutView",view:_||a.jsx($f,{})}};return e&&typeof e.addChatMessage=="function"&&e.addChatMessage(O),[...K,O]}),setTimeout(()=>{e.getCurrentInteraction()||C(null)},100)},B=async R=>{console.log("ChatView: RPC interaction dismissed:",R),console.log("ChatView: Current interaction before dismiss:",w==null?void 0:w.methodName),C(null),p.length>0&&(console.log("ChatView: Processing",p.length,"queued messages after dismissal"),l(_=>{const K=[..._];return p.forEach(O=>{var oe;if(!K.some(he=>he.id===O.id)&&(K.push(O),O.sender.type==="agent"&&(g(he=>new Set(he).add(O.id)),!((oe=O.metadata)!=null&&oe.streaming)))){const he=O.content.length*35+1e3;setTimeout(()=>{g(ve=>{const De=new Set(ve);return De.delete(O.id),De})},he)}}),K}),x([]),setTimeout(()=>H(!0),0)),setTimeout(()=>{const _=e.getCurrentInteraction();console.log("ChatView: Latest interaction from client after dismiss:",(_==null?void 0:_.methodName)||"null"),_===null&&C(null)},50),console.log("ChatView: Set currentInteraction to null after dismiss")};return e.on("rpc.interaction.started",T),e.on("rpc.interaction.completed",F),e.on("rpc.interaction.timeout",z),e.on("rpc.interaction.dismissed",B),()=>{e.off("rpc.interaction.started",T),e.off("rpc.interaction.completed",F),e.off("rpc.interaction.timeout",z),e.off("rpc.interaction.dismissed",B)}},[e]),h.useEffect(()=>{const T=()=>{if(console.log("ChatView: Agent is thinking"),w){console.log("ChatView: Suppressing thinking indicator due to active interaction:",w.methodName);return}d(!0)},F=()=>{console.log("ChatView: Agent is speaking"),d(!1)};return e.on("agent.thinking",T),e.on("agent.speaking",F),()=>{e.off("agent.thinking",T),e.off("agent.speaking",F)}},[e,w]),h.useEffect(()=>{const T=e.getCurrentInteraction();T?(console.log("ChatView: Restoring interaction state on mount/client change:",T.methodName),C(T)):C(null)},[e]),h.useEffect(()=>{console.log("ChatView: Display type changed to:",o,"Current interaction:",(w==null?void 0:w.methodName)||"none")},[o,w]);const Ce=async T=>{try{w&&(console.log("ChatView: Dismissing active interaction due to user message send"),e.dismissCurrentInteraction(),C(null)),await e.sendChatMessage(T)}catch(F){console.error("Failed to send message:",F)}},ne=async T=>{try{w&&(console.log("ChatView: Dismissing active interaction due to user attachment send"),e.dismissCurrentInteraction(),C(null)),await e.sendAttachments(T),console.log("Attachments sent successfully:",T.map(F=>F.name))}catch(F){console.error("Failed to send attachments:",F)}},[te,se]=h.useState([]);if(h.useEffect(()=>{const T=F=>{se(Array.isArray(F)?F:["tes","hello how are you","algebra make me learn that ","what is the meaning of life"])};return e.on("suggested.response",T),()=>{e.off("suggested.response",T)}},[e]),u){const T=b&&v?"fixed inset-0 z-[9999] flex flex-col items-center justify-center h-screen w-screen bg-black":"flex w-full flex-col items-center justify-center h-full p-8";return a.jsxs("div",{className:T,children:[a.jsx("div",{className:`${j.spinner} w-12 h-12 mb-6`}),a.jsxs("p",{className:`text-sm text-center ${b&&v?"text-white":""}`,children:["Connecting to ",D,"..."]})]})}const U=b&&v?"fullscreen":o,M=U==="fullscreen"?b&&v?"fixed inset-0 z-[9999] flex flex-col h-screen w-screen bg-black":"flex flex-col h-full w-full max-w-none":"flex flex-col h-full w-full backdrop-blur-sm",G=U==="fullscreen"?b&&v?"flex items-center w-full justify-between px-4 pt-3 pb-3 bg-black/80 text-white border-b border-gray-700":`flex items-center w-full justify-between px-6 pt-5 pb-4 border-b ${j.chatHeader.container}`:`flex items-center w-full justify-between px-4 pt-5 pb-4 border-b ${j.chatHeader.container}`,Y=U==="fullscreen"?b&&v?"flex-1 overflow-y-auto scrollbar-hide p-4 w-full max-w-none chat-scrollable min-h-0":"flex-1 overflow-y-auto scrollbar-hide p-6 w-full max-w-none chat-scrollable min-h-0":"flex-1 overflow-y-auto scrollbar-hide w-full p-4 chat-scrollable min-h-0",V="flex-shrink-0 !w-full",q=()=>{S(!1),n&&n()};return a.jsxs("div",{className:M,children:[a.jsx("div",{className:G,children:a.jsxs("div",{className:"flex items-center gap-2",children:[b&&v&&a.jsx(Q.button,{onClick:q,whileHover:{scale:1.05},whileTap:{scale:.95},className:"p-2 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors mr-2","aria-label":"Exit fullscreen",children:"✕"}),a.jsxs("div",{children:[a.jsx("h3",{className:`font-semibold text-base leading-tight ${b&&v?"text-white":j.text.primary}`,children:D}),a.jsxs("p",{className:`text-xs flex items-center gap-1.5 mt-0.5 ${b&&v?"text-gray-300":j.text.muted}`,children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full animate-pulse"}),"Online"]})]})]})}),a.jsxs("div",{className:`${Y} flex flex-col`,style:{scrollBehavior:"smooth",scrollbarWidth:"none"},children:[" ",i.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center flex-1 text-center py-12",children:[a.jsx(Q.div,{transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"w-16 h-16 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center text-white font-bold text-xl mb-6 shadow-xl",children:L}),a.jsxs("p",{className:`text-base mb-2 ${b&&v?"text-white":j.text.secondary}`,children:[D," is joining..."]}),a.jsx("p",{className:`text-xs ${b&&v?"text-gray-300":j.text.muted}`,children:"Your conversation will begin shortly"})]}):a.jsx("div",{className:"w-full max-w-5xl mx-auto space-y-3 py-4 flex-1 flex flex-col justify-end",children:a.jsxs("div",{className:"space-y-3",children:[i.map((T,F)=>{var z,B;return a.jsx("div",{children:((z=T.metadata)==null?void 0:z.type)==="successView"?a.jsx("div",{className:"flex w-full justify-end mb-4 px-1",children:a.jsxs("div",{className:"relative group flex-row-reverse flex items-end gap-3 max-w-[85%]",children:[a.jsx(Q.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1},className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700"}`,children:"Y"}),a.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-br-md message-hover border-gray-200 dark:border-gray-700 ${j.chatMessage.own}`,children:[T.metadata.view,a.jsx("div",{className:`text-xs ${j.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:T.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}):((B=T.metadata)==null?void 0:B.type)==="timeoutView"?a.jsx("div",{className:"flex w-full justify-start mb-4 px-1",children:a.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[a.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:L}),a.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-bl-md message-hover border-gray-200 dark:border-gray-700 ${j.chatMessage.other}`,children:[T.metadata.view,a.jsx("div",{className:`text-xs ${j.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:T.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}):a.jsx(If,{message:T,theme:t,isOwn:T.sender.type==="participant",isStreaming:f.has(T.id)})},T.id)}),c&&!w&&a.jsx(Q.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:i.length*.1},className:"flex w-full justify-start mb-4 px-1",children:a.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[a.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700"}`,children:L}),a.jsx("div",{className:`relative px-3 py-2 rounded-2xl break-words shadow-lg backdrop-blur-sm message-bubble message-hover ${j.chatMessage.other} rounded-bl-md transition-all duration-200 group-hover:scale-[1.02]`,style:{wordWrap:"break-word",overflowWrap:"break-word",minWidth:48},children:a.jsx("span",{className:"inline-flex items-center",children:[0,1,2].map(T=>a.jsx(Q.span,{className:"w-1.5 h-1.5 bg-current rounded-full mx-0.5",animate:{y:[0,-4,0],opacity:[.4,1,.4],scale:[.8,1,.8]},transition:{duration:.8,repeat:1/0,repeatType:"mirror",delay:T*.2,ease:"easeInOut"}},T))})})]})}),w&&w.presentationMode==="embedded"&&a.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[a.jsx(Q.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1},className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:L}),a.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-bl-md message-hover border-gray-200 dark:border-gray-700 ${j.chatMessage.other}`,children:[a.jsx(gt,{interaction:w,theme:t,onDismiss:()=>e.dismissCurrentInteraction(),client:e,addLocalMessage:W},w.methodName),a.jsx(Q.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},className:`text-xs ${j.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]}),a.jsx("div",{ref:A})]})})]}),te.length>0&&a.jsx("div",{className:"w-full flex overflow-x-auto gap-2 px-4 py-2 mb-1 scrollbar-hide",children:te.map((T,F)=>{var z;return a.jsx("button",{className:`whitespace-nowrap px-3 py-1 rounded-full border shadow-sm flex-shrink-0 transition-all duration-150 font-medium text-sm focus:outline-none focus:ring-2 focus:ring-blue-400/40
|
|
27
|
-
${t==="light"?"bg-white text-blue-700 border-blue-200 hover:bg-blue-50 hover:text-blue-900":t==="dark"?"bg-gray-800 text-blue-300 border-gray-700 hover:bg-gray-700 hover:text-white":((
|
|
28
|
-
`,style:{boxShadow:t==="vox"?"0 2px 8px 0 rgba(80,60,200,0.10)":void 0,borderWidth:1},onClick:()=>{Ce(T),se([])},children:T},T+F)})}),w&&w.presentationMode!=="embedded"&&a.jsx(
|
|
26
|
+
`,"aria-label":"Download file",children:a.jsx(pe.Download,{className:"w-4 h-4"})})]})]})}function Lf(){return a.jsxs("div",{className:"max-w-xs mx-auto bg-green-50 border border-green-200 rounded-lg shadow p-3 flex flex-col items-center",children:[a.jsx("div",{className:"text-2xl mb-2",children:"✅"}),a.jsx("div",{className:"text-green-700 font-semibold text-sm mb-1",children:"Success!"}),a.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:"Your action was completed successfully."})]})}function Bf(){return a.jsxs("div",{className:"max-w-xs mx-auto bg-yellow-50 border border-yellow-200 rounded-lg shadow p-3 flex flex-col items-center",children:[a.jsx("div",{className:"text-2xl mb-2",children:"⏰"}),a.jsx("div",{className:"text-yellow-700 font-semibold text-sm mb-1",children:"Interaction timed out"}),a.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:"No response was provided in time."})]})}function $f({client:e,theme:t="vox",onBack:n,disabled:s=!1,displayType:o="widget",onEndChat:r}){const[i,l]=h.useState(()=>{if(e&&typeof e.getChatMessages=="function"){const T=e.getChatMessages();return console.log("🔄 ChatView: Initializing with existing messages:",T.length),T}return[]}),[c,d]=h.useState(!0),[u,m]=h.useState(()=>{const T=e&&typeof e.getCurrentSession=="function"&&!!e.getCurrentSession(),F=e&&typeof e.getChatMessages=="function"&&e.getChatMessages().length>0;return!T&&!F}),[f,p]=h.useState(new Set),[g,x]=h.useState([]),[v,E]=h.useState(!1),[b,S]=h.useState(!1),[w,C]=h.useState(()=>{const T=e.getCurrentInteraction();return console.log("ChatView: Initializing with existing interaction:",(T==null?void 0:T.methodName)||"none"),T}),A=h.useRef(null),j=ye(t);h.useEffect(()=>{const T=()=>{const F=navigator.userAgent.toLowerCase(),B=["android","iphone","ipad","mobile","tablet"].some(O=>F.includes(O)),R="ontouchstart"in window||navigator.maxTouchPoints>0,_=window.innerWidth<=768,K=B||R&&_;E(K),K&&o==="widget"&&S(!0)};return T(),window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[o]),h.useEffect(()=>(b&&v&&(document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.height="100%",document.documentElement.requestFullscreen&&document.documentElement.requestFullscreen().catch(console.log)),()=>{b&&v&&(document.body.style.overflow="unset",document.body.style.position="unset",document.body.style.width="unset",document.body.style.height="unset",document.fullscreenElement&&document.exitFullscreen().catch(console.log))}),[b,v]);const k=e.getCurrentAgentInfo(),D=(k==null?void 0:k.name)||"AI Assistant",L=D.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),W=h.useCallback(T=>{const F={id:`local_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:T,timestamp:new Date,sender:{id:"participant",name:"You",type:"participant"},metadata:{isLocal:!0}};l(Z=>(console.log("ChatView: Adding local message:",F.id),[...Z,F]))},[]);h.useEffect(()=>{var T,F,Z,B,R;console.log("💬 ChatView loading state:",{isLoading:u,hasActiveSession:!!((T=e==null?void 0:e.getCurrentSession)!=null&&T.call(e)),messagesCount:i.length,sessionId:(Z=(F=e==null?void 0:e.getCurrentSession)==null?void 0:F.call(e))==null?void 0:Z.id,hasStoredMessages:!!((R=(B=e==null?void 0:e.getChatMessages)==null?void 0:B.call(e))!=null&&R.length),isMobile:v,isFullscreen:b})},[u,i.length,e,v,b]);const H=h.useCallback((T=!1)=>{A.current&&(T?A.current.scrollIntoView({behavior:"auto"}):A.current.scrollIntoView({behavior:"smooth"}))},[]);h.useEffect(()=>{H(!0);const T=setTimeout(()=>{H(!1)},10);return()=>clearTimeout(T)},[i.length,H]),h.useEffect(()=>{if(w){H(!0);const T=setTimeout(()=>{H(!1)},50);return()=>clearTimeout(T)}},[w,H]),h.useEffect(()=>{const T=B=>{if(console.log("ChatView: Received message:",B),m(!1),w&&B.sender.type==="agent"){console.log("ChatView: Queuing agent message due to active interaction:",w.methodName),x(R=>[...R,B]);return}B.sender.type==="agent"&&d(!1),l(R=>{var K;if(R.some(O=>O.id===B.id))return console.log("ChatView: Message already exists, skipping:",B.id),R;if(console.log("ChatView: Adding new message:",B.id),B.sender.type==="agent"&&(p(O=>new Set(O).add(B.id)),!((K=B.metadata)!=null&&K.streaming))){const O=B.content.length*35+1e3;setTimeout(()=>{p(re=>{const oe=new Set(re);return oe.delete(B.id),oe})},O)}return[...R,B]}),setTimeout(()=>H(!0),0)},F=B=>{var R;if(console.log("ChatView: Updated message:",B),w&&B.sender.type==="agent"){console.log("ChatView: Queuing agent message update due to active interaction:",w.methodName),x(_=>{const K=_.findIndex(O=>O.id===B.id);if(K>=0){const O=[..._];return O[K]=B,O}else return[..._,B]});return}l(_=>_.map(K=>K.id===B.id?{...B}:K)),setTimeout(()=>H(!0),0),(R=B.metadata)!=null&&R.streaming||p(_=>{const K=new Set(_);return K.delete(B.id),K})},Z=B=>{console.log("ChatView: Sent message:",B),m(!1),l(R=>R.some(K=>K.id===B.id)?(console.log("ChatView: Sent message already exists, skipping:",B.id),R):(console.log("ChatView: Adding sent message:",B.id),[...R,B])),setTimeout(()=>H(!0),0)};return e.on("chat.message.received",T),e.on("chat.message.updated",F),e.on("chat.message.sent",Z),()=>{e.off("chat.message.received",T),e.off("chat.message.updated",F),e.off("chat.message.sent",Z)}},[e,w]),h.useEffect(()=>{const T=R=>{console.log("ChatView: RPC interaction started:",R);const _=e.getCurrentInteraction();console.log("ChatView: Got interaction from client:",_==null?void 0:_.methodName),C(_),d(!1),H(!0),setTimeout(()=>{H(!1)},100)},F=R=>{if(console.log("ChatView: RPC interaction completed:",R),C(null),g.length>0&&(console.log("ChatView: Processing",g.length,"queued messages"),l(_=>{const K=[..._];return g.forEach(O=>{var oe;if(!K.some(he=>he.id===O.id)&&(console.log("ChatView: Adding queued message:",O.id),K.push(O),O.sender.type==="agent"&&(p(he=>new Set(he).add(O.id)),!((oe=O.metadata)!=null&&oe.streaming)))){const he=O.content.length*35+1e3;setTimeout(()=>{p(ve=>{const De=new Set(ve);return De.delete(O.id),De})},he)}}),K}),x([]),setTimeout(()=>H(!0),0)),R&&R.response&&R.response.success){let _=null;R.response.successView?_=R.response.successView:R.successView&&(_=R.successView),l(K=>{const O=[...K].reverse().findIndex(ve=>ve.sender.type==="participant");let re=K.length;O!==-1&&(re=K.length-O);const oe={id:`success_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:"",timestamp:new Date,sender:{id:"participant",name:"You",type:"participant"},metadata:{type:"successView",view:_||a.jsx(Lf,{})}};e&&typeof e.addChatMessage=="function"&&e.addChatMessage(oe);const he=[...K];return he.splice(re,0,oe),he})}},Z=async R=>{w&&(console.log("ChatView: Dismissing active interaction due to timeout"),e.dismissCurrentInteraction()),C(null),g.length>0&&(console.log("ChatView: Processing",g.length,"queued messages after timeout"),l(K=>{const O=[...K];return g.forEach(re=>{var he;if(!O.some(ve=>ve.id===re.id)&&(O.push(re),re.sender.type==="agent"&&(p(ve=>new Set(ve).add(re.id)),!((he=re.metadata)!=null&&he.streaming)))){const ve=re.content.length*35+1e3;setTimeout(()=>{p(De=>{const Zt=new Set(De);return Zt.delete(re.id),Zt})},ve)}}),O}),x([]),setTimeout(()=>H(!0),0));let _=null;R&&R.response&&R.response.timeoutView?_=R.response.timeoutView:R&&R.timeoutView&&(_=R.timeoutView),l(K=>{const O={id:`timeout_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:"",timestamp:new Date,sender:{id:"agent",name:D,type:"agent"},metadata:{type:"timeoutView",view:_||a.jsx(Bf,{})}};return e&&typeof e.addChatMessage=="function"&&e.addChatMessage(O),[...K,O]}),setTimeout(()=>{e.getCurrentInteraction()||C(null)},100)},B=async R=>{console.log("ChatView: RPC interaction dismissed:",R),console.log("ChatView: Current interaction before dismiss:",w==null?void 0:w.methodName),C(null),g.length>0&&(console.log("ChatView: Processing",g.length,"queued messages after dismissal"),l(_=>{const K=[..._];return g.forEach(O=>{var oe;if(!K.some(he=>he.id===O.id)&&(K.push(O),O.sender.type==="agent"&&(p(he=>new Set(he).add(O.id)),!((oe=O.metadata)!=null&&oe.streaming)))){const he=O.content.length*35+1e3;setTimeout(()=>{p(ve=>{const De=new Set(ve);return De.delete(O.id),De})},he)}}),K}),x([]),setTimeout(()=>H(!0),0)),setTimeout(()=>{const _=e.getCurrentInteraction();console.log("ChatView: Latest interaction from client after dismiss:",(_==null?void 0:_.methodName)||"null"),_===null&&C(null)},50),console.log("ChatView: Set currentInteraction to null after dismiss")};return e.on("rpc.interaction.started",T),e.on("rpc.interaction.completed",F),e.on("rpc.interaction.timeout",Z),e.on("rpc.interaction.dismissed",B),()=>{e.off("rpc.interaction.started",T),e.off("rpc.interaction.completed",F),e.off("rpc.interaction.timeout",Z),e.off("rpc.interaction.dismissed",B)}},[e]),h.useEffect(()=>{const T=()=>{if(console.log("ChatView: Agent is thinking"),w){console.log("ChatView: Suppressing thinking indicator due to active interaction:",w.methodName);return}d(!0)},F=()=>{console.log("ChatView: Agent is speaking"),d(!1)};return e.on("agent.thinking",T),e.on("agent.speaking",F),()=>{e.off("agent.thinking",T),e.off("agent.speaking",F)}},[e,w]),h.useEffect(()=>{const T=e.getCurrentInteraction();T?(console.log("ChatView: Restoring interaction state on mount/client change:",T.methodName),C(T)):C(null)},[e]),h.useEffect(()=>{console.log("ChatView: Display type changed to:",o,"Current interaction:",(w==null?void 0:w.methodName)||"none")},[o,w]);const Ce=async T=>{try{w&&(console.log("ChatView: Dismissing active interaction due to user message send"),e.dismissCurrentInteraction(),C(null)),await e.sendChatMessage(T)}catch(F){console.error("Failed to send message:",F)}},ne=async T=>{try{w&&(console.log("ChatView: Dismissing active interaction due to user attachment send"),e.dismissCurrentInteraction(),C(null)),await e.sendAttachments(T),console.log("Attachments sent successfully:",T.map(F=>F.name))}catch(F){console.error("Failed to send attachments:",F)}},[te,se]=h.useState([]);if(h.useEffect(()=>{const T=F=>{se(Array.isArray(F)?F:["tes","hello how are you","algebra make me learn that ","what is the meaning of life"])};return e.on("suggested.response",T),()=>{e.off("suggested.response",T)}},[e]),u){const T=b&&v?"fixed inset-0 z-[9999] flex flex-col items-center justify-center h-screen w-screen bg-black":"flex w-full flex-col items-center justify-center h-full p-8";return a.jsxs("div",{className:T,children:[a.jsx("div",{className:`${j.spinner} w-12 h-12 mb-6`}),a.jsxs("p",{className:`text-sm text-center ${b&&v?"text-white":""}`,children:["Connecting to ",D,"..."]})]})}const z=b&&v?"fullscreen":o,M=z==="fullscreen"?b&&v?"fixed inset-0 z-[9999] flex flex-col h-screen w-screen bg-black":"flex flex-col h-full w-full max-w-none":"flex flex-col h-full w-full backdrop-blur-sm",G=z==="fullscreen"?b&&v?"flex items-center w-full justify-between px-4 pt-3 pb-3 bg-black/80 text-white border-b border-gray-700":`flex items-center w-full justify-between px-6 pt-5 pb-4 border-b ${j.chatHeader.container}`:`flex items-center w-full justify-between px-4 pt-5 pb-4 border-b ${j.chatHeader.container}`,Y=z==="fullscreen"?b&&v?"flex-1 overflow-y-auto scrollbar-hide p-4 w-full max-w-none chat-scrollable min-h-0":"flex-1 overflow-y-auto scrollbar-hide p-6 w-full max-w-none chat-scrollable min-h-0":"flex-1 overflow-y-auto scrollbar-hide w-full p-4 chat-scrollable min-h-0",V="flex-shrink-0 !w-full",q=()=>{S(!1),n&&n()};return a.jsxs("div",{className:M,children:[a.jsx("div",{className:G,children:a.jsxs("div",{className:"flex items-center gap-2",children:[b&&v&&a.jsx(Q.button,{onClick:q,whileHover:{scale:1.05},whileTap:{scale:.95},className:"p-2 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors mr-2","aria-label":"Exit fullscreen",children:"✕"}),a.jsxs("div",{children:[a.jsx("h3",{className:`font-semibold text-base leading-tight ${b&&v?"text-white":j.text.primary}`,children:D}),a.jsxs("p",{className:`text-xs flex items-center gap-1.5 mt-0.5 ${b&&v?"text-gray-300":j.text.muted}`,children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full animate-pulse"}),"Online"]})]})]})}),a.jsxs("div",{className:`${Y} flex flex-col`,style:{scrollBehavior:"smooth",scrollbarWidth:"none"},children:[" ",i.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center flex-1 text-center py-12",children:[a.jsx(Q.div,{transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"w-16 h-16 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center text-white font-bold text-xl mb-6 shadow-xl",children:L}),a.jsxs("p",{className:`text-base mb-2 ${b&&v?"text-white":j.text.secondary}`,children:[D," is joining..."]}),a.jsx("p",{className:`text-xs ${b&&v?"text-gray-300":j.text.muted}`,children:"Your conversation will begin shortly"})]}):a.jsx("div",{className:"w-full max-w-5xl mx-auto space-y-3 py-4 flex-1 flex flex-col justify-end",children:a.jsxs("div",{className:"space-y-3",children:[i.map((T,F)=>{var Z,B;return a.jsx("div",{children:((Z=T.metadata)==null?void 0:Z.type)==="successView"?a.jsx("div",{className:"flex w-full justify-end mb-4 px-1",children:a.jsxs("div",{className:"relative group flex-row-reverse flex items-end gap-3 max-w-[85%]",children:[a.jsx(Q.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1},className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700"}`,children:"Y"}),a.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-br-md message-hover border-gray-200 dark:border-gray-700 ${j.chatMessage.own}`,children:[T.metadata.view,a.jsx("div",{className:`text-xs ${j.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:T.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}):((B=T.metadata)==null?void 0:B.type)==="timeoutView"?a.jsx("div",{className:"flex w-full justify-start mb-4 px-1",children:a.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[a.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:L}),a.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-bl-md message-hover border-gray-200 dark:border-gray-700 ${j.chatMessage.other}`,children:[T.metadata.view,a.jsx("div",{className:`text-xs ${j.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:T.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}):a.jsx(Rf,{message:T,theme:t,isOwn:T.sender.type==="participant",isStreaming:f.has(T.id)})},T.id)}),c&&!w&&a.jsx(Q.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:i.length*.1},className:"flex w-full justify-start mb-4 px-1",children:a.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[a.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700"}`,children:L}),a.jsx("div",{className:`relative px-3 py-2 rounded-2xl break-words shadow-lg backdrop-blur-sm message-bubble message-hover ${j.chatMessage.other} rounded-bl-md transition-all duration-200 group-hover:scale-[1.02]`,style:{wordWrap:"break-word",overflowWrap:"break-word",minWidth:48},children:a.jsx("span",{className:"inline-flex items-center",children:[0,1,2].map(T=>a.jsx(Q.span,{className:"w-1.5 h-1.5 bg-current rounded-full mx-0.5",animate:{y:[0,-4,0],opacity:[.4,1,.4],scale:[.8,1,.8]},transition:{duration:.8,repeat:1/0,repeatType:"mirror",delay:T*.2,ease:"easeInOut"}},T))})})]})}),w&&w.presentationMode==="embedded"&&a.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[a.jsx(Q.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1},className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:L}),a.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-bl-md message-hover border-gray-200 dark:border-gray-700 ${j.chatMessage.other}`,children:[a.jsx(pt,{interaction:w,theme:t,onDismiss:()=>e.dismissCurrentInteraction(),client:e,addLocalMessage:W},w.methodName),a.jsx(Q.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},className:`text-xs ${j.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]}),a.jsx("div",{ref:A})]})})]}),te.length>0&&a.jsx("div",{className:"w-full flex overflow-x-auto gap-2 px-4 py-2 mb-1 scrollbar-hide",children:te.map((T,F)=>{var Z;return a.jsx("button",{className:`whitespace-nowrap px-3 py-1 rounded-full border shadow-sm flex-shrink-0 transition-all duration-150 font-medium text-sm focus:outline-none focus:ring-2 focus:ring-blue-400/40
|
|
27
|
+
${t==="light"?"bg-white text-blue-700 border-blue-200 hover:bg-blue-50 hover:text-blue-900":t==="dark"?"bg-gray-800 text-blue-300 border-gray-700 hover:bg-gray-700 hover:text-white":((Z=j.suggestedResponse)==null?void 0:Z.container)||"bg-gradient-to-br from-blue-500 to-purple-600 text-white border-blue-400 hover:from-blue-600 hover:to-purple-700"}
|
|
28
|
+
`,style:{boxShadow:t==="vox"?"0 2px 8px 0 rgba(80,60,200,0.10)":void 0,borderWidth:1},onClick:()=>{Ce(T),se([])},children:T},T+F)})}),w&&w.presentationMode!=="embedded"&&a.jsx(pt,{interaction:w,theme:t,onDismiss:()=>e.dismissCurrentInteraction(),client:e,addLocalMessage:W},w.methodName),a.jsx(Q.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:V,children:a.jsx(Nf,{onSendMessage:Ce,onSendAttachments:ne,disabled:s,theme:t,onEndChat:r})})]})}function Of({onToggleCamera:e,onToggleScreenShare:t,onEndCall:n,onBack:s,theme:o,cameraEnabled:r,screenShareEnabled:i,isCameraLoading:l,isScreenShareLoading:c,disabled:d}){const u=ye(o);return a.jsxs("div",{className:`flex items-center justify-center gap-3 p-4 ${u.video.controlsBackground}`,children:[a.jsx("button",{onClick:e,disabled:d||l,className:`p-3 rounded-full transition-all duration-200 ${r?u.video.controlEnabled:u.video.controlDisabled} ${d?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:r?"Turn off camera":"Turn on camera",children:l?a.jsx("div",{className:"w-5 h-5 animate-spin rounded-full border-2 border-current border-t-transparent"}):r?a.jsx(pe.Camera,{className:"w-5 h-5"}):a.jsx(pe.CameraOff,{className:"w-5 h-5"})}),a.jsx("button",{onClick:t,disabled:d||c,className:`p-3 rounded-full transition-all duration-200 ${i?u.video.controlEnabled:u.video.controlDisabled} ${d?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:i?"Stop screen share":"Share screen",children:c?a.jsx("div",{className:"w-5 h-5 animate-spin rounded-full border-2 border-current border-t-transparent"}):i?a.jsx(pe.MonitorOff,{className:"w-5 h-5"}):a.jsx(pe.Monitor,{className:"w-5 h-5"})}),n&&a.jsx("button",{onClick:n,disabled:d,className:`p-3 rounded-full transition-all duration-200 ${u.video.endCall} ${d?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:"End call",children:a.jsx(pe.PhoneOff,{className:"w-5 h-5"})}),s&&a.jsx("button",{onClick:s,disabled:d,className:`p-3 rounded-full transition-all duration-200 ${u.video.controlDisabled} ${d?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:"Back",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"})})})]})}function Fi({trackRef:e,participant:t,isLocal:n=!1,className:s="",theme:o}){var c;const r=ye(o),i=(t==null?void 0:t.name)||(t==null?void 0:t.identity)||(n?"You":"Participant"),l=(e==null?void 0:e.publication)&&!e.publication.isMuted;return a.jsxs("div",{className:`relative rounded-lg overflow-hidden ${r.video.tile} ${s}`,children:[l?a.jsx(ue.VideoTrack,{trackRef:e,className:"w-full h-full object-cover"}):a.jsx("div",{className:`w-full h-full flex items-center justify-center ${r.video.placeholder}`,children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:`w-16 h-16 mx-auto mb-2 rounded-full flex items-center justify-center ${r.video.avatar}`,children:a.jsx(pe.User,{className:"w-8 h-8"})}),a.jsx("p",{className:"text-sm opacity-80",children:i}),a.jsx("p",{className:"text-xs opacity-60",children:"Camera off"})]})}),a.jsx("div",{className:`absolute bottom-2 left-2 px-2 py-1 rounded text-xs ${r.video.nameOverlay}`,children:i}),((c=e==null?void 0:e.publication)==null?void 0:c.isMuted)&&a.jsx("div",{className:`absolute top-2 right-2 p-1 rounded ${r.video.mutedIndicator}`,children:a.jsx(pe.CameraOff,{className:"w-4 h-4"})})]})}function _f({trackRefs:e,participants:t,theme:n,localParticipant:s}){const o=e.find(u=>u.source===I.Track.Source.Camera&&u.participant===s),r=e.filter(u=>u.participant!==s),i=e.length,l=i<=1?1:i<=4?2:3,c="grid gap-2 h-full",d={gridTemplateColumns:`repeat(${l}, 1fr)`,gridAutoRows:"minmax(0, 1fr)"};return a.jsxs("div",{className:c,style:d,children:[o&&s&&a.jsx(Fi,{trackRef:o,participant:s,isLocal:!0,theme:n,className:"min-h-0"}),r.map((u,m)=>{var f;return a.jsx(Fi,{trackRef:u,participant:u.participant,isLocal:!1,theme:n,className:"min-h-0"},((f=u.publication)==null?void 0:f.trackSid)||m)}),i===0&&a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center",children:[a.jsx(pe.Users,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),a.jsx("p",{className:"text-lg opacity-70",children:"Waiting for participants..."}),a.jsx("p",{className:"text-sm opacity-50",children:"Turn on your camera to start the video call"})]})})]})}function Hf({client:e,theme:t="vox",onBack:n,disabled:s=!1,displayType:o,onEndCall:r}){const i=ye(t),l=ue.useMaybeRoomContext(),[c,d]=h.useState(!1),[u,m]=h.useState(!1),[f,p]=h.useState(!1),[g,x]=h.useState(!1),[v,E]=h.useState(null),b=ue.useTracks([I.Track.Source.Camera,I.Track.Source.ScreenShare],{onlySubscribed:!1});b.filter(j=>j.source===I.Track.Source.Camera),b.filter(j=>j.source===I.Track.Source.ScreenShare);const S=h.useMemo(()=>l?Array.from(l.remoteParticipants.values()):[],[l]),w=h.useCallback(async()=>{if(!(!l||f)){p(!0);try{const j=l.localParticipant;c?(await j.setCameraEnabled(!1),d(!1)):(await j.setCameraEnabled(!0),d(!0))}catch(j){console.error("Failed to toggle camera:",j)}finally{p(!1)}}},[l,c,f]),C=h.useCallback(async()=>{if(!(!l||g)){x(!0);try{const j=l.localParticipant;u?(await j.setScreenShareEnabled(!1),m(!1)):(await j.setScreenShareEnabled(!0),m(!0))}catch(j){console.error("Failed to toggle screen share:",j)}finally{x(!1)}}},[l,u,g]),A=h.useCallback(()=>{r?r():n&&n()},[r,n]);return h.useEffect(()=>{if(!e)return;const j=k=>{console.log("📺 Video: Interactive UI state updated:",k),E(k)};return e.on("interactive.ui.update",j),e.on("interactive.ui.show",j),()=>{e.off("interactive.ui.update",j),e.off("interactive.ui.show",j)}},[e]),a.jsxs("div",{className:`flex flex-col h-full ${i.video.container}`,children:[a.jsxs("div",{className:`flex items-center justify-between p-4 border-b ${i.video.header}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${i.video.statusDot}`}),a.jsx("span",{className:"font-medium",children:"Video Call"}),a.jsxs("span",{className:"text-sm opacity-70",children:[S.length+1," participant",S.length!==0?"s":""]})]}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("button",{className:`p-2 rounded-lg transition-colors ${i.video.headerButton}`,title:"Layout options",children:a.jsx(pe.LayoutGrid,{className:"w-4 h-4"})})})]}),a.jsx("div",{className:"flex-1 p-4 min-h-0",children:a.jsx(_f,{trackRefs:b,participants:S,localParticipant:l==null?void 0:l.localParticipant,theme:t})}),v&&a.jsx(Q.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},className:"absolute inset-4 z-10",children:a.jsx(pt,{interaction:v,onDismiss:()=>E(null),theme:t})}),a.jsx(Of,{onToggleCamera:w,onToggleScreenShare:C,onEndCall:A,onBack:n,theme:t,cameraEnabled:c,screenShareEnabled:u,isCameraLoading:f,isScreenShareLoading:g,disabled:s})]})}function Jt({onClick:e,disabled:t,theme:n}){const s=ye(n);return a.jsx("button",{className:s.micButton,onClick:e,disabled:t,"aria-label":"Start Voice Session",type:"button",children:a.jsx(Be.Mic,{})})}function On({onClick:e,disabled:t,theme:n}){const s=ye(n);return a.jsx("button",{className:s.chatButton,onClick:e,disabled:t,"aria-label":"Start Chat Session",type:"button",children:a.jsx(Be.Chat,{})})}function _n({onClick:e,disabled:t,theme:n}){const s=ye(n);return a.jsx("button",{className:s.videoButton,onClick:e,disabled:t,"aria-label":"Start Video Session",type:"button",children:a.jsx(Be.Videocam,{})})}function Zf({prompts:e,theme:t}){const n=ye(t),[s,o]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>{o(i=>(i+1)%e.length)},3e3);return()=>clearInterval(r)},[e.length]),a.jsx("div",{className:"w-96 min-h-[3rem] h-12 relative overflow-hidden flex items-center justify-center",children:e.map((r,i)=>a.jsx("div",{className:`
|
|
29
29
|
${n.promptSlider}
|
|
30
30
|
${i===s?"opacity-100":"opacity-0"}
|
|
31
31
|
whitespace-pre-line break-words
|
|
32
|
-
`,style:{minHeight:"2.5rem",display:i===s?"block":"none"},children:r},i))})}function Uf({statusMessage:e,theme:t}){const n=ye(t);return a.jsxs("div",{className:"z-10 flex items-center space-x-2 mt-2 pb-2",children:[a.jsx("div",{className:n.statusIndicator}),a.jsx("span",{className:`text-xs ${n.text.muted}`,children:e})]})}const Wf=({disabled:e,onStartCall:t,onStartChat:n,onStartVideo:s,prompts:o=['"Book a meeting with the marketing team"',`"What's the status of project Alpha?"`,`"Summarize yesterday's sales report"`,'"Find a good Italian restaurant nearby"','"Remind me to call John tomorrow at 10 AM"'],statusMessage:r="Agent is ready",title:i="Choose how to interact",subTitle:l="Ask me anything or give me a task to complete",theme:c="vox",modalities:d=["voice","chat","video"]})=>{const u=ye(c),m=d.includes("voice"),f=d.includes("chat"),g=d.includes("video"),p=[m,f,g].filter(Boolean).length;return console.log("🎯 Welcome component debug:",{modalities:d,hasVoice:m,hasChat:f,hasVideo:g,totalButtons:p,onStartVideo:!!s}),a.jsxs("div",{inert:e,className:"flex p-8 flex-col items-center h-full justify-center w-full",children:[a.jsxs("div",{className:"mt-1 relative flex items-center justify-center mb-8 w-full",style:{minHeight:"120px"},children:[a.jsxs("div",{className:"absolute inset-0 flex items-center justify-center",children:[a.jsx("div",{className:u.pulseRings.ring1}),a.jsx("div",{className:u.pulseRings.ring2,style:{animationDelay:"0.5s"}}),a.jsx("div",{className:u.pulseRings.ring3,style:{animationDelay:"1s"}})]}),a.jsx("div",{className:"relative z-10 flex items-center justify-center",children:m&&f&&g?a.jsxs("div",{className:"flex gap-4 items-center justify-center",children:[a.jsx(Jt,{onClick:t,disabled:e,theme:c}),a.jsx(On,{onClick:n,disabled:e,theme:c}),a.jsx(_n,{onClick:s||t,disabled:e,theme:c})]}):p>1?a.jsxs("div",{className:"flex gap-6 items-center justify-center",children:[m&&a.jsx(Jt,{onClick:t,disabled:e,theme:c}),f&&a.jsx(On,{onClick:n,disabled:e,theme:c}),g&&s&&a.jsx(_n,{onClick:s,disabled:e,theme:c})]}):a.jsx("div",{className:"flex items-center justify-center",children:m?a.jsx(Jt,{onClick:t,disabled:e,theme:c}):f?a.jsx(On,{onClick:n,disabled:e,theme:c}):g&&s?a.jsx(_n,{onClick:s,disabled:e,theme:c}):a.jsx(Jt,{onClick:t,disabled:e,theme:c})})})]}),a.jsxs("div",{className:"text-center flex flex-col items-center gap-y-2 mb-6 w-full",children:[a.jsx("h3",{className:`text-xl font-semibold mb-2 ${u.text.accent}`,children:i}),a.jsx("p",{className:`text-sm leading-relaxed px-4 ${u.text.secondary}`,children:l}),p>1&&a.jsxs("div",{className:"flex gap-6 mt-4 text-xs justify-center",children:[m&&a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx(Be.Mic,{className:"w-4 h-4"}),a.jsx("span",{className:u.text.muted,children:"Voice"})]}),f&&a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx(Be.Chat,{className:"w-4 h-4"}),a.jsx("span",{className:u.text.muted,children:"Chat"})]}),g&&a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx(Be.Videocam,{className:"w-4 h-4"}),a.jsx("span",{className:u.text.muted,children:"Video"})]})]})]}),a.jsx(Zf,{prompts:o,theme:c}),a.jsx(Uf,{statusMessage:r,theme:c})]})};function La({room:e,onSessionEnd:t,onSessionStart:n,enableConsoleLogging:s=!0,enableLocalStorage:o=!0,voxketSessionId:r}={}){const[i,l]=h.useState(null),[c,d]=h.useState([]),[u,m]=h.useState(null),[f,g]=h.useState([]),p=h.useCallback((b,S)=>{const w={timestamp:new Date,event:b,data:S,sessionId:i==null?void 0:i.sessionId,participantId:u==null?void 0:u.identity};if(d(C=>[...C,w]),o){const C=JSON.parse(localStorage.getItem("voxket-session-logs")||"[]");C.push(w),localStorage.setItem("voxket-session-logs",JSON.stringify(C))}return w},[i==null?void 0:i.sessionId,u==null?void 0:u.identity,s,o]);h.useEffect(()=>{if(!e)return;const b=()=>{const L=r||`session-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,W=new Date,H={sessionId:L,startTime:W,totalMessages:0,connectionIssues:0,participantCount:f.length,events:[]};l(H),p("SESSION_STARTED",{sessionId:L,startTime:W}),n==null||n(L)},S=()=>{if(i){const L=new Date,W=L.getTime()-i.startTime.getTime(),H={...i,endTime:L,duration:W,events:c};p("SESSION_ENDED",{sessionId:i.sessionId,duration:`${Math.round(W/1e3)}s`,totalMessages:i.totalMessages,connectionIssues:i.connectionIssues}),t==null||t(H),l(null),d([])}},w=L=>{p("CONNECTION_STATE_CHANGED",{state:L}),L===I.ConnectionState.Reconnecting&&i&&(l(W=>W?{...W,connectionIssues:W.connectionIssues+1}:null),p("CONNECTION_ISSUE",{type:"reconnecting"}))},C=L=>{p("TRACK_PUBLISHED",{trackKind:L.kind,trackSource:L.source})},A=L=>{p("TRACK_UNPUBLISHED",{trackKind:L.kind,trackSource:L.source})},j=(L,W)=>{i&&l(H=>H?{...H,totalMessages:H.totalMessages+1}:null),p("DATA_RECEIVED",{participantId:W==null?void 0:W.identity,dataSize:L.length})},k=L=>{p("PARTICIPANT_CONNECTED",{participantId:L.identity,participantName:L.name}),g(W=>[...W,L]),i&&l(W=>W?{...W,participantCount:W.participantCount+1}:null)},D=L=>{p("PARTICIPANT_DISCONNECTED",{participantId:L.identity,participantName:L.name}),g(W=>W.filter(H=>H.identity!==L.identity))};return e.localParticipant&&m(e.localParticipant),e.on(I.RoomEvent.Connected,b),e.on(I.RoomEvent.Disconnected,S),e.on(I.RoomEvent.ConnectionStateChanged,w),e.on(I.RoomEvent.TrackPublished,C),e.on(I.RoomEvent.TrackUnpublished,A),e.on(I.RoomEvent.DataReceived,j),e.on(I.RoomEvent.ParticipantConnected,k),e.on(I.RoomEvent.ParticipantDisconnected,D),()=>{e.off(I.RoomEvent.Connected,b),e.off(I.RoomEvent.Disconnected,S),e.off(I.RoomEvent.ConnectionStateChanged,w),e.off(I.RoomEvent.TrackPublished,C),e.off(I.RoomEvent.TrackUnpublished,A),e.off(I.RoomEvent.DataReceived,j),e.off(I.RoomEvent.ParticipantConnected,k),e.off(I.RoomEvent.ParticipantDisconnected,D)}},[e,i,c,f.length,p,t,n]);const x=h.useCallback(()=>o?JSON.parse(localStorage.getItem("voxket-session-logs")||"[]"):c,[c,o]),v=h.useCallback(()=>{o&&localStorage.removeItem("voxket-session-logs"),d([])},[o]),E=h.useCallback(()=>{const b=x(),S=JSON.stringify(b,null,2),w="data:application/json;charset=utf-8,"+encodeURIComponent(S),C=`voxket-session-logs-${new Date().toISOString().split("T")[0]}.json`,A=document.createElement("a");A.setAttribute("href",w),A.setAttribute("download",C),A.click()},[x]);return{sessionMetrics:i,sessionLogs:c,logEvent:p,getSessionLogs:x,clearSessionLogs:v,exportSessionLogs:E}}class eo{constructor(){me(this,"listeners",{})}on(t,n){return this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(n),()=>this.off(t,n)}once(t,n){const s=(...o)=>{this.off(t,s),n(...o)};return this.on(t,s)}off(t,n){const s=this.listeners[t];if(!s)return;const o=s.indexOf(n);o>-1&&s.splice(o,1)}removeAllListeners(t){t?delete this.listeners[t]:this.listeners={}}emit(t,...n){const s=this.listeners[t];if(!s)return;const o=[...s];for(const r of o)try{r(...n)}catch(i){console.error(`Error in event listener for ${String(t)}:`,i)}}listenerCount(t){var n;return((n=this.listeners[t])==null?void 0:n.length)??0}eventNames(){return Object.keys(this.listeners)}}class Ba{constructor(t){me(this,"plugins",new Map);me(this,"installedPlugins",new Set);me(this,"context");this.context={client:t,emit:t.emit.bind(t),on:t.on.bind(t),config:{}}}register(t){if(this.plugins.has(t.name))throw new Error(`Plugin '${t.name}' is already registered`);if(t.dependencies){for(const n of t.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin '${t.name}' depends on '${n}' which is not registered`)}this.plugins.set(t.name,t)}async install(t,n){const s=this.plugins.get(t);if(!s)throw new Error(`Plugin '${t}' is not registered`);if(this.installedPlugins.has(t))throw new Error(`Plugin '${t}' is already installed`);if(s.dependencies)for(const r of s.dependencies)this.installedPlugins.has(r)||await this.install(r);const o={...this.context,config:{...s.config,...n}};s.install&&await s.install(o),this.installedPlugins.add(t),this.setupPluginEvents(s,o)}async uninstall(t){var s;const n=this.plugins.get(t);if(!n)throw new Error(`Plugin '${t}' is not registered`);if(this.installedPlugins.has(t)){for(const[o,r]of this.plugins)if(this.installedPlugins.has(o)&&((s=r.dependencies)!=null&&s.includes(t)))throw new Error(`Cannot uninstall '${t}' because '${o}' depends on it`);n.uninstall&&await n.uninstall(this.context),this.installedPlugins.delete(t)}}isInstalled(t){return this.installedPlugins.has(t)}getInstalledPlugins(){return Array.from(this.installedPlugins)}getAvailablePlugins(){return Array.from(this.plugins.keys())}getPluginInfo(t){return this.plugins.get(t)}setupPluginEvents(t,n){t.onSessionStart&&n.on("session.started",s=>{t.onSessionStart(n,s.id)}),t.onSessionEnd&&n.on("session.ended",s=>{t.onSessionEnd(n,s.id)}),t.onAgentResponse&&n.on("agent.response",s=>{t.onAgentResponse(n,s)})}}function Kf(e){return e}function to(e,t,n){return{name:e,version:"1.0.0",description:`${t} modality plugin`,install:async s=>{n.onActivate&&await n.onActivate(s)},uninstall:async s=>{n.onDeactivate&&await n.onDeactivate(s)},onAgentResponse:n.onMessage}}const Gf={name:"analytics",version:"1.0.0",description:"Built-in analytics tracking",install:async e=>{console.log("Analytics plugin installed"),e.on("session.started",t=>{console.log("Analytics: Session started",t.id)}),e.on("session.ended",(t,n)=>{console.log("Analytics: Session ended",t.id,n)}),e.on("chat.message.sent",t=>{console.log("Analytics: User message sent",t.content.length)})}},Yf={name:"debug",version:"1.0.0",description:"Debug logging and development tools",install:async e=>{console.log("Debug plugin installed");const t=e.emit;e.emit=(n,...s)=>(console.log(`[Debug] Event: ${String(n)}`,s),t(n,...s))}},qf={name:"metrics",version:"1.0.0",description:"Advanced metrics collection",install:async e=>{console.log("Metrics plugin installed");const t=new Map;e.on("session.started",n=>{t.set(n.id,{startTime:Date.now(),events:[]})}),e.on("agent.response",n=>{console.log("Metrics: Agent response analyzed",{type:n.type,length:n.content.length,timestamp:n.timestamp})})}},$a=y.createContext(null);function Oa({config:e,children:t,autoConnect:n=!1}){const[s,o]=y.useState(null),[r,i]=y.useState(!1),[l,c]=y.useState(!1),[d,u]=y.useState(null),[m,f]=y.useState(null),[g,p]=y.useState("idle"),[x,v]=y.useState(null),[E,b]=y.useState([]),[S,w]=y.useState([]),[C,A]=y.useState([]);y.useEffect(()=>{const M=new _t(e);return o(M),j(M),n&&k(M),()=>{M.disconnect().catch(console.error)}},[e,n]);const j=M=>{M.on("connection.connecting",()=>{c(!0),u(null)}),M.on("connection.connected",()=>{i(!0),c(!1),u(null)}),M.on("connection.disconnected",()=>{i(!1),c(!1),f(null),p("idle"),b([]),w([]),A([])}),M.on("connection.error",G=>{u(G),c(!1)}),M.on("session.created",G=>{f(G),p(G.state)}),M.on("session.state.changed",G=>{p(G),m&&f({...m,state:G})}),M.on("session.ended",(G,Y)=>{f(null),p("idle"),v(Y),b([]),w([]),A([])}),M.on("participant.joined",G=>{b(Y=>[...Y,G])}),M.on("participant.left",G=>{b(Y=>Y.filter(V=>V.id!==G.id))}),M.on("chat.message.received",G=>{w(Y=>[...Y,G])}),M.on("chat.message.sent",G=>{w(Y=>[...Y,G])}),M.on("transcription.received",G=>{A(Y=>[...Y,G])})},k=async M=>{const G=M||s;if(G)try{await G.connect()}catch(Y){console.error("Failed to connect:",Y)}},U={client:s,isConnected:r,isConnecting:l,connectionError:d,currentSession:m,sessionState:g,sessionMetrics:x,participants:E,chatMessages:S,transcriptions:C,connect:()=>k(),disconnect:async()=>{if(s)try{await s.disconnect()}catch(M){console.error("Failed to disconnect:",M)}},createSession:async(M,G={})=>{if(!s)throw new Error("Client not initialized");const Y={agentId:M,participantName:G.participantName||"User",metadata:G.metadata,modalities:G.modalities||["voice"]};return await s.createSession(Y)},endSession:async()=>s?await s.endSession():null,sendChatMessage:async M=>{if(!s)throw new Error("Client not initialized");await s.sendChatMessage(M)},setMicrophoneEnabled:async M=>{if(!s)throw new Error("Client not initialized");await s.setMicrophoneEnabled(M)},setCameraEnabled:async M=>{if(!s)throw new Error("Client not initialized");await s.setCameraEnabled(M)},startScreenShare:async()=>{if(!s)throw new Error("Client not initialized");await s.startScreenShare()},stopScreenShare:async()=>{if(!s)throw new Error("Client not initialized");await s.stopScreenShare()}};return a.jsx($a.Provider,{value:U,children:t})}function Ie(){const e=y.useContext($a);if(!e)throw new Error("useVoxket must be used within a VoxketProvider");return e}class Xf extends eo{constructor(n){super();me(this,"room",null);me(this,"registeredMethods",new Map);me(this,"activeInteractions",new Map);me(this,"currentInteraction",null);n&&this.setRoom(n)}setRoom(n){this.room=n}async registerFrontendRPC(n,s,o="embedded"){if(console.log(`RpcManager: Starting registration for method '${n}'`),!this.room)throw console.error(`RpcManager: Cannot register '${n}' - no room instance`),new Error("Room not initialized. Cannot register RPC method.");if(!this.room.localParticipant)throw console.error(`RpcManager: Cannot register '${n}' - no local participant`),new Error("Local participant not available for RPC registration");console.log(`RpcManager: Room state: ${this.room.state}`),console.log(`RpcManager: Local participant: ${this.room.localParticipant.identity}`),console.log(`RpcManager: Registering frontend RPC method: ${n}`);const r={methodName:n,component:s,presentationMode:o};this.registeredMethods.set(n,r);try{this.room.registerRpcMethod(n,async i=>{console.log(`RpcManager: RPC method '${n}' called by ${i.callerIdentity}`),console.log("RpcManager: Payload:",i.payload),this.emit("rpc.method.called",{methodName:n,data:i});let l;console.log(`RpcManager: Current registration for '${n}':`,r);let c=i.responseTimeout||30;try{l=JSON.parse(i.payload)}catch{l=i.payload}try{const d=await this.awaitUserInteraction(n,s,o,l,c);return JSON.stringify(d)}catch(d){throw console.error(`RpcManager: Error in RPC method '${n}':`,d),d}}),this.emit("rpc.method.registered",{methodName:n}),console.log(`RpcManager: Successfully registered RPC method: ${n}`)}catch(i){throw console.error(`RpcManager: Failed to register RPC method '${n}':`,i),i}}async awaitUserInteraction(n,s,o,r,i){return new Promise((l,c)=>{const d=`${n}_${Date.now()}`;console.log(`RpcManager: Starting user interaction for method: ${n}, timeout: ${i} seconds`);const u={didSuccess:(f,g)=>{console.log(`RpcManager: User interaction successful for method: ${n}`,f),this.clearInteraction(d),this.currentInteraction=null;const p={success:!0,message:"User interaction completed successfully",data:f,timestamp:new Date,...g?{successView:g}:{}};this.emit("rpc.interaction.completed",{methodName:n,response:p}),l(p)},didFail:f=>{console.log(`RpcManager: User interaction failed for method: ${n}`,f),this.clearInteraction(d);const g={success:!1,message:"User interaction failed",error:f,timestamp:new Date};this.emit("rpc.interaction.completed",{methodName:n,response:g}),l(g)},dismissView:()=>{var g;console.log(`RpcManager: User dismissed interaction for method: ${n}`),console.log("RpcManager: Current interaction before dismiss:",(g=this.currentInteraction)==null?void 0:g.methodName),this.clearInteraction(d),this.currentInteraction=null,console.log("RpcManager: Current interaction after dismiss:",this.currentInteraction);const f={success:!0,data:{dismissed:!0,reason:"User dismissed the interaction"},message:"User interaction dismissed",timestamp:new Date};this.emit("rpc.interaction.dismissed",{methodName:n,response:f}),this.emit("rpc.interaction.completed",{methodName:n,response:f}),setTimeout(()=>{var p;((p=this.currentInteraction)==null?void 0:p.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),l(f)},didTimeout:f=>{console.log(`RpcManager: User interaction timeout for method: ${n}`),this.clearInteraction(d),this.currentInteraction=null;const g={success:!0,message:`User interaction timed out after ${i} seconds, it should be considered as declined, agent don't need to retry`,timestamp:new Date,...f?{timeoutView:f}:{}};this.emit("rpc.interaction.timeout",{methodName:n,response:g}),setTimeout(()=>{var p;((p=this.currentInteraction)==null?void 0:p.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),l(g)}},m=setTimeout(()=>{u.didTimeout&&u.didTimeout()},i);this.activeInteractions.set(d,{resolve:f=>l(JSON.parse(f)),reject:c,timeoutId:m}),this.currentInteraction={isVisible:!0,methodName:n,component:s,presentationMode:o,timeout:i,data:r,handler:u},this.emit("rpc.interaction.started",{methodName:n,presentationMode:o}),setTimeout(async()=>{var f;if((f=this.currentInteraction)!=null&&f.handler)try{console.log(`RpcManager: Component created for method: ${n} with data:`,r)}catch(g){console.error("RpcManager: Error loading data into component:",g),u.didFail({error:"Failed to load data into component"})}},100)})}clearInteraction(n){const s=this.activeInteractions.get(n);s&&(console.log(`RpcManager: Clearing interaction: ${n}`),clearTimeout(s.timeoutId),this.activeInteractions.delete(n))}getCurrentInteraction(){return this.currentInteraction}dismissCurrentInteraction(){var n;this.currentInteraction&&(console.log(`RpcManager: Dismissing current interaction: ${this.currentInteraction.methodName}`),(n=this.currentInteraction.handler)==null||n.dismissView(),setTimeout(()=>{this.currentInteraction&&(console.log("RpcManager: Force clearing lingering interaction"),this.currentInteraction=null)},0))}getRegisteredMethods(){return Array.from(this.registeredMethods.keys())}unregisterMethod(n){this.registeredMethods.delete(n),console.log(`RpcManager: Unregistered RPC method: ${n}`)}clear(){for(const[n,s]of this.activeInteractions)clearTimeout(s.timeoutId);this.activeInteractions.clear(),this.registeredMethods.clear(),this.currentInteraction=null,console.log("RpcManager: Cleared all registrations and interactions")}}class ee extends Error{constructor(t,n,s){super(t),this.code=n,this.details=s,this.name="VoxketError"}}class _t extends eo{constructor(n){super();me(this,"config");me(this,"room",null);me(this,"pluginManager");me(this,"rpcManager");me(this,"isConnected",!1);me(this,"currentSession",null);me(this,"connectionState",I.ConnectionState.Disconnected);me(this,"renderedComponents",new Map);me(this,"textStreamHandlersRegistered",!1);me(this,"currentAgentInfo",null);me(this,"chatMessages",[]);this.config=n,this.pluginManager=new Ba(this),this.rpcManager=new Xf,this.setupEventListeners(),this.initializeClient()}setupEventListeners(){this.on("connection.connected",()=>{var n,s;this.isConnected=!0,(s=(n=this.config).onConnected)==null||s.call(n)}),this.on("connection.disconnected",n=>{var s,o;this.isConnected=!1,(o=(s=this.config).onDisconnected)==null||o.call(s,n)}),this.on("connection.error",n=>{var s,o;(o=(s=this.config).onError)==null||o.call(s,n)}),this.on("chat.message.received",n=>{var s,o;this.addChatMessage(n),(o=(s=this.config).onMessageReceived)==null||o.call(s,n)}),this.on("chat.message.updated",n=>{this.updateChatMessage(n)}),this.on("chat.message.sent",n=>{this.addChatMessage(n)}),this.on("transcription.received",n=>{var s,o;(o=(s=this.config).onTranscriptionReceived)==null||o.call(s,n)}),this.on("session.state.changed",n=>{var s,o;(o=(s=this.config).onSessionStateChanged)==null||o.call(s,n)}),this.on("session.created",n=>{var s,o;(o=(s=this.config).onSessionStart)==null||o.call(s,n.id)}),this.on("session.ended",(n,s)=>{var o,r;(r=(o=this.config).onSessionEnd)==null||r.call(o,s)}),this.on("participant.joined",n=>{var s,o;(o=(s=this.config).onUserJoined)==null||o.call(s,n.id)}),this.on("participant.left",n=>{var s,o;(o=(s=this.config).onUserLeft)==null||o.call(s,n.id)}),this.setupRpcEventForwarding()}setupRpcEventForwarding(){if(!this.rpcManager){console.warn("RpcManager not initialized, skipping event forwarding setup");return}this.rpcManager.on("rpc.method.registered",n=>this.emit("rpc.method.registered",n)),this.rpcManager.on("rpc.method.called",n=>this.emit("rpc.method.called",n)),this.rpcManager.on("rpc.interaction.started",n=>this.emit("rpc.interaction.started",n)),this.rpcManager.on("rpc.interaction.completed",n=>this.emit("rpc.interaction.completed",n)),this.rpcManager.on("rpc.interaction.timeout",n=>this.emit("rpc.interaction.timeout",n)),this.rpcManager.on("rpc.interaction.dismissed",n=>this.emit("rpc.interaction.dismissed",n))}initializeClient(){this.room=new I.Room,this.setupRoomEventListeners()}setupRoomEventListeners(){this.room&&(this.room.on(I.RoomEvent.Connected,()=>{var n,s;this.connectionState=I.ConnectionState.Connected,this.emit("connection.connected"),this.rpcManager.setRoom(this.room),(s=(n=this.currentSession)==null?void 0:n.activeModalities)!=null&&s.includes("voice")&&setTimeout(async()=>{var o;try{(o=this.room)!=null&&o.localParticipant&&(this.room.localParticipant.isMicrophoneEnabled?this.emit("track.unmuted",{source:"microphone",enabled:!0}):(await this.room.localParticipant.setMicrophoneEnabled(!0),this.emit("track.unmuted",{source:"microphone",enabled:!0})))}catch(r){console.warn("VoxketClient: Failed to enable microphone after room connection:",r)}},1e3),this.textStreamHandlersRegistered||this.setupTextStreamHandlers()}),this.room.on(I.RoomEvent.Disconnected,n=>{this.connectionState=I.ConnectionState.Disconnected,this.textStreamHandlersRegistered=!1,this.emit("connection.disconnected",n==null?void 0:n.toString())}),this.room.on(I.RoomEvent.ConnectionStateChanged,n=>{this.connectionState=n,n===I.ConnectionState.Connecting&&this.emit("connection.connecting")}),this.room.on(I.RoomEvent.ParticipantConnected,n=>{const s={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.joined",s)}),this.room.on(I.RoomEvent.ParticipantDisconnected,n=>{const s={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.left",s)}))}setupTextStreamHandlers(){if(this.room){try{this.room.registerTextStreamHandler("lk.chat",async(n,s)=>{try{const o=await n.readAll(),r={id:`msg_${Date.now()}_${s.identity||"user"}_${Math.random().toString(36).substr(2,9)}`,content:o,timestamp:new Date,sender:{id:s.identity||"user",name:s.identity||"User",type:"participant"},metadata:{topic:"lk.chat"}};this.emit("chat.message.received",r)}catch(o){console.error("VoxketClient: Failed to process lk.chat message:",o)}})}catch(n){console.warn("VoxketClient: lk.chat handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("lk.transcription",async(n,s)=>{var o,r;try{const i=`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`;let l="";const c=((o=this.currentAgentInfo)==null?void 0:o.name)||s.identity||"AI Assistant",d={id:i,content:"",timestamp:new Date,sender:{id:s.identity||"agent",name:c,type:"agent"},metadata:{topic:"lk.transcription",streaming:!0}};this.emit("chat.message.received",d);for await(const f of n){l+=f;const g=this.convertMarkdownToText(l),p={...d,content:g,metadata:{...d.metadata,streaming:!0}};this.emit("chat.message.updated",p)}const u=this.convertMarkdownToText(l),m={...d,content:u,metadata:{...d.metadata,streaming:!1}};this.emit("chat.message.updated",m)}catch(i){console.error("VoxketClient: Failed to process lk.transcription message:",i);try{const l=await n.readAll(),c=((r=this.currentAgentInfo)==null?void 0:r.name)||s.identity||"AI Assistant",d={id:`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`,content:l,timestamp:new Date,sender:{id:s.identity||"agent",name:c,type:"agent"},metadata:{topic:"lk.transcription"}};this.emit("chat.message.received",d)}catch(l){console.error("VoxketClient: Fallback failed for lk.transcription:",l)}}})}catch(n){console.warn("VoxketClient: lk.transcription handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("suggested_response",async n=>{const s=await n.readAll();let o=[];try{o=["tes","hello how are you","algebra make me learn that ","what is the meaning of life"]}catch(r){console.warn("VoxketClient: Failed to parse suggested_response:",r,s)}this.emit("suggested.response",o)})}catch(n){console.warn("VoxketClient: suggested_response handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("agent_state_changed",async(n,s)=>{const o=await n.readAll();let r={};try{r=typeof o=="string"?JSON.parse(o.replace(/'/g,'"')):o}catch(i){console.warn("VoxketClient: Failed to parse agent_state_changed:",i,o)}r.new_state==="speaking"?this.emit("agent.speaking",r):r.new_state==="thinking"&&this.emit("agent.thinking",r)})}catch(n){console.warn("VoxketClient: conversation_item_added handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("images",async(n,s)=>{try{const o=await n.readAll()}catch(o){console.error("VoxketClient: Error processing images stream:",o)}})}catch(n){console.warn("VoxketClient: images handler already registered, skipping:",n)}try{this.room.registerByteStreamHandler("images",async(n,s)=>{var o,r;try{const i=n.info,l={id:`img_${Date.now()}_${s.identity||"agent"}_${Math.random().toString(36).substr(2,9)}`,content:`�️ ${i.name||"Image"}`,sender:{id:s.identity||"agent",name:s.identity||"Agent",type:s.identity===((r=(o=this.room)==null?void 0:o.localParticipant)==null?void 0:r.identity)?"participant":"agent"},timestamp:new Date,metadata:{type:"attachment",fileName:i.name,fileSize:i.size,mimeType:i.mimeType,streamId:i.id,downloading:!0}};this.emit("chat.message.received",l),n.onProgress&&(n.onProgress=f=>{const g={...l,metadata:{...l.metadata,downloadProgress:f||0}};this.emit("chat.message.updated",g)});const c=[];for await(const f of n)c.push(f);const d=new Blob(c,{type:i.mimeType||"application/octet-stream"}),u=URL.createObjectURL(d),m={...l,metadata:{...l.metadata,downloading:!1,downloadProgress:1,downloadUrl:u,blob:d}};this.emit("chat.message.updated",m)}catch(i){console.error("VoxketClient: Error processing image attachment:",i)}})}catch(n){console.warn("VoxketClient: image handler already registered, skipping:",n)}this.textStreamHandlersRegistered=!0}}async fetchConnectionDetails(n,s,o){const r=n||this.config.agentId||"default-agent",i=s||this.config.participantName||"User",l=o||this.config.modalities||["voice"];try{const c={agent_id:r,participant_name:i,participant_metadata:{user_id:""},modality:l[0]},d=await fetch(`${this.config.baseUrl}/api/live/agent/session`,{method:"POST",headers:{accept:"application/json","X-APP-ID":this.config.appId,"X-APP-SECRET":this.config.appSecret,"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok){let f=`HTTP ${d.status}: Failed to fetch connection details`;try{const g=await d.json();g&&(g.error?f=`API Error: ${g.error}`:g.detail?f=`API Error: ${g.detail}`:g.message&&(f=`API Error: ${g.message}`))}catch{try{const p=await d.text();p&&(f=`API Error: ${p}`)}catch{}}throw new Error(f)}const u=await d.json();let m;return u.agent_info&&(m={id:u.agent_info.id||r,name:u.agent_info.name||"AI Assistant",avatar:u.agent_info.avatar,capabilities:u.agent_info.capabilities||["voice_interaction","text_chat"],metadata:u.agent_info.metadata||{}},this.currentAgentInfo=m),{serverUrl:u.wss_url,participantToken:u.token,voxketSessionId:u.session_id,agentInfo:m}}catch(c){console.error("VoxketClient: fetchConnectionDetails failed:",c);const d=new ee(`Failed to fetch connection details: ${c instanceof Error?c.message:"Unknown error"}`,"CONNECTION_FAILED",c);throw this.emit("connection.error",d),d}}async connect(n,s,o){var r;try{this.emit("connection.connecting");const i=await this.fetchConnectionDetails(n,s,o);return await((r=this.room)==null?void 0:r.connect(i.serverUrl,i.participantToken)),this.isConnected=!0,i}catch(i){console.error("VoxketClient: Connection failed:",i);const l=new ee(`Failed to connect to Voxket services: ${i instanceof Error?i.message:"Unknown error"}`,"CONNECTION_FAILED",i);throw this.emit("connection.error",l),l}}async disconnect(){var n;try{await((n=this.room)==null?void 0:n.disconnect()),this.isConnected=!1,this.currentSession=null,this.currentAgentInfo=null,this.textStreamHandlersRegistered=!1,this.clearChatMessages(),this.room=new I.Room,this.setupRoomEventListeners()}catch(s){const o=new ee("Failed to disconnect properly","NETWORK_ERROR",s);throw this.emit("connection.error",o),o}}async createSession(n){var s,o;try{const r=await this.connect(n.agentId,n.participantName,n.modalities),i={id:r.voxketSessionId,agentId:n.agentId,state:"connecting",startedAt:new Date,metadata:n.metadata||{},activeModalities:n.modalities||["voice"],agentInfo:r.agentInfo||this.currentAgentInfo};if(this.currentSession=i,this.emit("session.created",i),(s=n.modalities)!=null&&s.includes("voice"))try{await new Promise(l=>setTimeout(l,500)),(o=this.room)!=null&&o.localParticipant?(await this.room.localParticipant.setMicrophoneEnabled(!0,void 0,{preConnectBuffer:!0}),this.emit("track.unmuted",{source:"microphone",enabled:!0})):console.warn("VoxketClient: No local participant found, microphone not enabled")}catch(l){console.warn("VoxketClient: Failed to enable microphone, but continuing with session:",l)}return setTimeout(()=>{this.currentSession&&(this.currentSession.state="active",this.emit("session.state.changed","active",this.currentSession.state))},1e3),i}catch(r){throw console.error("VoxketClient: Failed to create session:",r),r instanceof ee?r:r instanceof TypeError&&r.message.includes("fetch")?new ee("Network connection failed","CONNECTION_FAILED",r):r instanceof Error&&r.message.includes("Failed to fetch connection details")?new ee(`API connection failed: ${r.message}`,"CONNECTION_FAILED",r):new ee(`Failed to create session: ${r instanceof Error?r.message:"Unknown error"}`,"SESSION_NOT_FOUND",r)}}async startSession(n,s){const o={agentId:n||this.config.agentId||"default-agent",participantName:(s==null?void 0:s.participantName)||this.config.participantName||"User",modalities:(s==null?void 0:s.modalities)||this.config.modalities||["voice","chat"],metadata:s==null?void 0:s.metadata};return this.createSession(o)}async endSession(){var n,s;if(!this.currentSession)return null;try{const o={sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((s=this.room)==null?void 0:s.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]};return this.currentSession.endedAt=new Date,this.currentSession.state="disconnected",this.emit("session.ended",this.currentSession,o),await this.disconnect(),o}catch(o){throw new ee("Failed to end session","SESSION_NOT_FOUND",o)}}getCurrentSession(){return this.currentSession}getCurrentAgentInfo(){return this.currentAgentInfo}getChatMessages(){return[...this.chatMessages]}addChatMessage(n){this.chatMessages.some(o=>o.id===n.id)||this.chatMessages.push(n)}updateChatMessage(n){const s=this.chatMessages.findIndex(o=>o.id===n.id);s!==-1&&(this.chatMessages[s]=n)}clearChatMessages(){this.chatMessages=[],this.dismissCurrentInteraction(),this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays(),this.emit("chat.history.cleared")}renderUI(n={}){var c,d,u;const s=this.resolveTarget(n.target||"body"),o=this.getTargetKey(s),r=this.renderedComponents.get(o);r&&r.target===s||this.removeUI(s);const i=(r==null?void 0:r.root)||ml.createRoot(s),l={agentId:n.agentId||this.config.agentId||"default-agent",participantName:n.participantName||this.config.participantName||"User",baseUrl:this.config.baseUrl,appSecret:this.config.appSecret,appId:this.config.appId,className:n.className,theme:typeof n.theme=="string"?n.theme:void 0,modalities:n.modality||this.config.modalities||["voice"],suportsChatInput:((c=n.modality)==null?void 0:c.includes("chat"))!==!1,suportsVideoInput:((d=n.modality)==null?void 0:d.includes("video"))===!0,suportsScreenShare:((u=n.modality)==null?void 0:u.includes("screen_share"))===!0,autoStart:n.autoStart,displayType:n.displayType||"widget",popupPosition:n.popupPosition||"bottom-right",popupTriggerText:n.popupTriggerText||"Open Chat",width:n.width,height:n.height,onDisplayTypeChange:n.onDisplayTypeChange,prompts:n.prompts,statusMessage:n.statusMessage,welcomeTitle:n.welcomeTitle,welcomeSubTitle:n.welcomeSubTitle,loadingText:n.loadingText,voxketClient:this};if(!i||typeof i.render!="function")throw new Error("Invalid React root. Make sure React 18+ is properly installed and configured.");try{i.render(y.createElement(Oa,{config:this.config,autoConnect:n.autoStart||!1,children:y.createElement(_a,l)}))}catch(m){throw console.error("Error rendering Voxket widget:",m),new Error(`Failed to render Voxket widget: ${m instanceof Error?m.message:"Unknown error"}`)}this.renderedComponents.set(o,{root:i,target:s})}removeUI(n){const s=n?this.resolveTarget(n):null;if(s){const o=this.getTargetKey(s),r=this.renderedComponents.get(o);r&&(r.root.unmount(),this.renderedComponents.delete(o),s.querySelectorAll('[id*="voxket"], [class*="voxket"], .fixed.inset-0.z-50').forEach(l=>{try{l.remove()}catch(c){console.warn("Failed to remove element:",c)}}),s===document.body&&s.querySelectorAll(".fixed.z-50, .fixed.inset-0").forEach(c=>{if(c.classList.contains("bg-black")&&c.classList.contains("backdrop-blur-sm"))try{c.remove()}catch(d){console.warn("Failed to remove fixed element:",d)}}))}}removeAllUI(){for(const[n,s]of this.renderedComponents)s.root.unmount();this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays()}forceCleanupFullscreenOverlays(){document.body.querySelectorAll(".fixed.inset-0.z-50").forEach(s=>{if(s.classList.contains("bg-black")&&(s.classList.contains("backdrop-blur-sm")||s.classList.contains("bg-opacity-30")))try{s.remove()}catch(o){console.warn("Failed to remove overlay:",o)}})}resolveTarget(n){if(typeof n=="string"){const s=document.querySelector(n);if(!s)throw new Error(`Target element not found: ${n}`);return s}return n}getTargetKey(n){return n.id?n.id:n.className?n.tagName+"_"+n.className.replace(/\s+/g,"_"):n.tagName+"_"+n.outerHTML.length%1e3}async sendMessage(n,s){var o;if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new ee("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new ee("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new ee("No local participant","CONNECTION_FAILED");this.dismissCurrentInteraction();try{const r={id:`msg_${Date.now()}`,content:n,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:s||{}},i=await((o=this.room)==null?void 0:o.localParticipant.sendText(n,{topic:"lk.chat",destinationIdentities:[]}));this.emit("chat.message.sent",r)}catch(r){throw console.error("VoxketClient: Failed to send chat message:",r),new ee("Failed to send message","NETWORK_ERROR",r)}}async sendChatMessage(n,s){return this.sendMessage(n,s)}async sendAttachments(n,s){if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new ee("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new ee("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new ee("No local participant","CONNECTION_FAILED");if(!n||n.length===0)throw new ee("No files provided","INVALID_PARAMETER");this.dismissCurrentInteraction();const o=n.filter(r=>r.type.startsWith("image/"));if(o.length===0)throw new ee("Only image files are allowed","INVALID_PARAMETER");o.length!==n.length&&console.warn("VoxketClient: Some non-image files were filtered out");try{const r=o.map(async(i,l)=>{const d={id:`att_${Date.now()}_${l}`,content:`📎 ${i.name}`,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:{...s,type:"attachment",fileName:i.name,fileSize:i.size,mimeType:i.type,uploading:!0}};this.emit("chat.message.sent",d);const u=await this.room.localParticipant.sendFile(i,{mimeType:i.type,topic:"images",onProgress:f=>{const g={...d,metadata:{...d.metadata,uploadProgress:f}};this.emit("chat.message.updated",g)}});try{const f=new FileReader,g=new Promise((v,E)=>{f.onload=()=>{typeof f.result=="string"?v(f.result):E(new Error("Failed to convert to base64"))},f.onerror=E});f.readAsDataURL(i);const x={type:"image",data:await g,filename:i.name,mimeType:i.type,size:i.size};await this.room.localParticipant.sendText(JSON.stringify(x),{topic:"images",destinationIdentities:[]})}catch(f){console.warn("VoxketClient: Failed to send image data to agent:",f);try{const g=`I've shared an image: ${i.name}`;await this.room.localParticipant.sendText(g,{topic:"lk.chat",destinationIdentities:[]})}catch(g){console.warn("VoxketClient: Failed to send image notification to agent:",g)}}const m={...d,metadata:{...d.metadata,uploading:!1,uploadProgress:1,streamId:u.id}};return this.emit("chat.message.updated",m),u});await Promise.all(r)}catch(r){throw console.error("VoxketClient: Failed to send attachments:",r),new ee("Failed to send attachments","NETWORK_ERROR",r)}}async sendAttachment(n,s){return this.sendAttachments([n],s)}toggleMicrophone(n){return this.setMicrophoneEnabled(n!==!1)}async setMicrophoneEnabled(n){var s,o;try{const r=(s=this.room)==null?void 0:s.localParticipant.isMicrophoneEnabled,i=n??!r;await((o=this.room)==null?void 0:o.localParticipant.setMicrophoneEnabled(i)),i?this.emit("track.unmuted",{source:"microphone",enabled:!0}):this.emit("track.muted",{source:"microphone",enabled:!1})}catch(r){throw console.error("VoxketClient: Failed to toggle microphone:",r),new ee("Failed to toggle microphone","PERMISSION_DENIED",r)}}toggleCamera(n){return this.setCameraEnabled(n!==!1)}async setCameraEnabled(n){var s,o;try{const r=(s=this.room)==null?void 0:s.localParticipant.isCameraEnabled,i=n??!r;await((o=this.room)==null?void 0:o.localParticipant.setCameraEnabled(i)),i?this.emit("track.unmuted",{source:"camera",enabled:!0}):this.emit("track.muted",{source:"camera",enabled:!1})}catch(r){throw console.error("VoxketClient: Failed to toggle camera:",r),new ee("Failed to toggle camera","PERMISSION_DENIED",r)}}async enableCamera(){return this.setCameraEnabled(!0)}async disableCamera(){return this.setCameraEnabled(!1)}async startScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!0))}catch(s){throw new ee("Failed to start screen share","PERMISSION_DENIED",s)}}async stopScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!1))}catch(s){throw new ee("Failed to stop screen share","PERMISSION_DENIED",s)}}async getAudioInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="audioinput")}catch(n){throw new ee("Failed to get audio input devices","DEVICE_ERROR",n)}}async getVideoInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="videoinput")}catch(n){throw new ee("Failed to get video input devices","DEVICE_ERROR",n)}}async setAudioInputDevice(n){var s;try{if(!((s=this.room)!=null&&s.localParticipant))throw new Error("Not connected to room")}catch(o){throw new ee("Failed to set audio input device","DEVICE_ERROR",o)}}async setVideoInputDevice(n){var s;try{if(!((s=this.room)!=null&&s.localParticipant))throw new Error("Not connected to room")}catch(o){throw new ee("Failed to set video input device","DEVICE_ERROR",o)}}getLocalParticipant(){var n;return((n=this.room)==null?void 0:n.localParticipant)??null}getRemoteParticipants(){var n;return Array.from(((n=this.room)==null?void 0:n.remoteParticipants.values())??[])}getPublishPermissions(){const n=this.getLocalParticipant();if(!n)return{camera:!1,microphone:!1,screenShare:!1,data:!1};const s=n.permissions;if(!s)return{camera:!0,microphone:!0,screenShare:!0,data:!0};const o=r=>!!s.canPublish&&(s.canPublishSources.length===0||s.canPublishSources.includes(r));return{camera:o(1),microphone:o(2),screenShare:o(3),data:s.canPublishData??!1}}canPublishSource(n){return this.getPublishPermissions()[n]}getRoom(){return this.room}getConnectionState(){return this.connectionState}get connected(){return this.isConnected&&this.connectionState===I.ConnectionState.Connected}getMicrophoneTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===I.Track.Source.Microphone)return s.track;return null}getCameraTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===I.Track.Source.Camera)return s.track;return null}getScreenShareTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===I.Track.Source.ScreenShare)return s.track;return null}get isMicrophoneEnabled(){const n=this.getMicrophoneTrack();return n?!n.isMuted:!1}get isCameraEnabled(){const n=this.getCameraTrack();return n?!n.isMuted:!1}get isScreenShareEnabled(){const n=this.getScreenShareTrack();return n?!n.isMuted:!1}registerPlugin(n){this.pluginManager.register(n)}getPluginManager(){return this.pluginManager}getParticipants(){if(!this.room)return[];const n=[];return this.room.localParticipant&&n.push({id:this.room.localParticipant.identity,name:this.room.localParticipant.name||this.room.localParticipant.identity,isLocal:!0}),this.room.remoteParticipants.forEach(s=>{n.push({id:s.identity,name:s.name||s.identity,isLocal:!1})}),n}getSessionMetrics(){var n,s;return this.currentSession?{sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((s=this.room)==null?void 0:s.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]}:null}updateConfig(n){this.config={...this.config,...n}}async startRecording(){var n;try{this.emit("recording.started",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(s){throw new ee("Failed to start recording","RECORDING_ERROR",s)}}async stopRecording(){var n;try{this.emit("recording.stopped",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(s){throw new ee("Failed to stop recording","RECORDING_ERROR",s)}}async registerFrontendRPC(n,s,o="embedded"){return this.rpcManager.registerFrontendRPC(n,s,o)}getCurrentInteraction(){return this.rpcManager.getCurrentInteraction()}dismissCurrentInteraction(){this.rpcManager.dismissCurrentInteraction()}getRegisteredRpcMethods(){return this.rpcManager.getRegisteredMethods()}unregisterRpcMethod(n){this.rpcManager.unregisterMethod(n)}registerEventListener(n,s){return this.on(n,s)}registerEventEmitter(n,s){if(!this.room)throw new Error("Room not available");try{this.room.registerTextStreamHandler(n,async o=>{try{const r=await o.readAll();s(r)}catch(r){console.error(`Error processing event for topic '${n}':`,r)}})}catch(o){console.warn(`VoxketClient: Handler for topic '${n}' may already be registered:`,o)}}convertMarkdownToText(n){if(!n)return"";let s=n;return s=s.replace(/\*\*(.*?)\*\*/g,"$1"),s=s.replace(/__(.*?)__/g,"$1"),s=s.replace(/\*(.*?)\*/g,"$1"),s=s.replace(/_(.*?)_/g,"$1"),s=s.replace(/~~(.*?)~~/g,"$1"),s=s.replace(/`([^`]+)`/g,"$1"),s=s.replace(/```[\s\S]*?```/g,""),s=s.replace(/^#{1,6}\s+/gm,""),s=s.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1"),s.trim()}}function Jf(){if(typeof document>"u"||document.getElementById("voxket-widget-styles"))return;const e=document.createElement("style");e.id="voxket-widget-styles",e.textContent=`::-webkit-scrollbar { display: none;}
|
|
33
|
-
.scrollbar-hide {
|
|
34
|
-
scrollbar-width: none;
|
|
35
|
-
-ms-overflow-style: none;
|
|
36
|
-
}
|
|
37
|
-
.scrollbar-hide::-webkit-scrollbar {
|
|
38
|
-
display: none;
|
|
39
|
-
}
|
|
40
|
-
.chat-scrollable {
|
|
41
|
-
scrollbar-width: thin;
|
|
42
|
-
scrollbar-color: rgba(155, 155, 155, 0.3) transparent;
|
|
43
|
-
display: flex;
|
|
44
|
-
flex-direction: column;
|
|
45
|
-
}
|
|
46
|
-
.chat-scrollable::-webkit-scrollbar {
|
|
47
|
-
width: 6px;
|
|
48
|
-
display: block;
|
|
49
|
-
}
|
|
50
|
-
.chat-scrollable::-webkit-scrollbar-track {
|
|
51
|
-
background: transparent;
|
|
52
|
-
}
|
|
53
|
-
.chat-scrollable::-webkit-scrollbar-thumb {
|
|
54
|
-
background-color: rgba(155, 155, 155, 0.3);
|
|
55
|
-
border-radius: 3px;
|
|
56
|
-
}
|
|
57
|
-
.chat-scrollable::-webkit-scrollbar-thumb:hover {
|
|
58
|
-
background-color: rgba(155, 155, 155, 0.5);
|
|
59
|
-
}
|
|
60
|
-
.chat-messages-container {
|
|
61
|
-
display: flex;
|
|
62
|
-
flex-direction: column;
|
|
63
|
-
justify-content: flex-end;
|
|
64
|
-
min-height: 100%;
|
|
65
|
-
width: 100%;
|
|
66
|
-
max-width: none;
|
|
67
|
-
}
|
|
68
|
-
@keyframes pulse-ring {
|
|
69
|
-
0% { transform: scale(1); opacity: 1; }
|
|
70
|
-
50% { transform: scale(1.2); opacity: 0.6; }
|
|
71
|
-
100% { transform: scale(1.4); opacity: 0; }
|
|
72
|
-
}
|
|
73
|
-
@keyframes glow {
|
|
74
|
-
0%, 100% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.5); }
|
|
75
|
-
50% { box-shadow: 0 0 30px rgba(59, 130, 246, 0.8); }
|
|
76
|
-
}
|
|
77
|
-
.pulse-ring {
|
|
78
|
-
animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
79
|
-
}
|
|
80
|
-
.mic-glow {
|
|
81
|
-
animation: glow 2s ease-in-out infinite;
|
|
82
|
-
}
|
|
83
|
-
.voxket-widget-root {
|
|
84
|
-
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
85
|
-
line-height: 1.5;
|
|
86
|
-
font-weight: 400;
|
|
87
|
-
color-scheme: light dark;
|
|
88
|
-
background-color: transparent;
|
|
89
|
-
color: rgba(255, 255, 255, 0.87);
|
|
90
|
-
font-synthesis: none;
|
|
91
|
-
text-rendering: optimizeLegibility;
|
|
92
|
-
-webkit-font-smoothing: antialiased;
|
|
93
|
-
-moz-osx-font-smoothing: grayscale;
|
|
94
|
-
border-radius: 1rem;
|
|
95
|
-
}
|
|
96
|
-
.voxket-widget-root.theme-light {
|
|
97
|
-
color: rgba(0, 0, 0, 0.87);
|
|
98
|
-
}
|
|
99
|
-
.voxket-widget-root.theme-dark {
|
|
100
|
-
color: rgba(255, 255, 255, 0.87);
|
|
101
|
-
}
|
|
102
|
-
.voxket-widget-root.theme-vox {
|
|
103
|
-
color: rgba(255, 255, 255, 0.87);
|
|
104
|
-
}
|
|
105
|
-
.animate-spin {
|
|
106
|
-
animation: spin 1s linear infinite;
|
|
107
|
-
}
|
|
108
|
-
@keyframes spin {
|
|
109
|
-
to {
|
|
110
|
-
transform: rotate(360deg);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
.voxket-widget-root button {
|
|
114
|
-
cursor: pointer;
|
|
115
|
-
}`,document.head.appendChild(e)}const Qf=Q.create(Vf),e0=Q.create(Of),t0=Q.create(zf),n0=Q.create(Wf);function s0({onClick:e,text:t="Open Chat",position:n="bottom-right",theme:s}){const o={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"},r=ye(s);return a.jsx(Q.button,{onClick:e,className:`fixed ${o[n]} z-50 px-4 py-2 rounded-full shadow-lg ${r.popupTrigger} transition-all duration-200 hover:scale-105`,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},children:t})}function Bi({children:e,theme:t,displayType:n="widget",onClose:s,popupPosition:o="bottom-right",onExpand:r}){const i=ye(t);if(n==="fullscreen")return a.jsx("div",{className:"fixed inset-0 z-50 bg-black bg-opacity-30 backdrop-blur-sm flex items-center justify-center p-8",children:a.jsxs("div",{className:"w-full h-full max-w-6xl max-h-[90vh] rounded-2xl relative bg-transparent",children:[s&&a.jsx("button",{onClick:l=>{l.preventDefault(),l.stopPropagation(),s()},className:"absolute top-4 cursor-pointer right-4 z-[100] w-12 h-12 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Exit Fullscreen",type:"button",children:a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),a.jsxs("div",{id:"voice-card",className:`${i.card} w-full h-full flex flex-col rounded-xl shadow-2xl`,style:{minHeight:"600px"},children:[a.jsx("div",{className:i.cardTopGradient}),a.jsx("div",{className:i.cardPurpleBlur}),a.jsx("div",{className:i.cardPinkBlur}),a.jsx("div",{className:" flex flex-col h-full",children:e}),a.jsx("div",{className:i.cardPulse1}),a.jsx("div",{className:i.cardPulse2,style:{animationDelay:"1s"}})]})]})});if(n==="popup"){const l={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"};return a.jsx("div",{className:"fixed rounded-2xl inset-0 z-50 pointer-events-none",children:a.jsxs("div",{className:`fixed rounded-2xl ${l[o]} pointer-events-auto`,children:[s&&a.jsx("button",{onClick:s,className:"absolute -top-2 -right-2 z-10 w-8 h-8 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 text-sm shadow-lg border border-gray-700",children:"×"}),a.jsxs("div",{id:"voice-card",className:`${i.card} rounded-2xl flex flex-col`,style:{width:"300px",height:"450px"},children:[a.jsx("div",{className:i.cardPurpleBlur}),a.jsx("div",{className:i.cardPinkBlur}),a.jsx("div",{className:" flex flex-col h-full",children:e}),a.jsx("div",{className:i.cardPulse1}),a.jsx("div",{className:i.cardPulse2,style:{animationDelay:"1s"}})]})]})})}return a.jsxs("div",{id:"voice-card",className:`${i.card}`,children:[r&&a.jsx("button",{onClick:r,className:"absolute top-4 right-4 z-20 w-10 h-10 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Enter Fullscreen",children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})}),a.jsx("div",{className:i.cardTopGradient}),a.jsx("div",{className:i.cardPurpleBlur}),a.jsx("div",{className:i.cardPinkBlur}),e,a.jsx("div",{className:i.cardPulse1}),a.jsx("div",{className:i.cardPulse2,style:{animationDelay:"1s"}})]})}function _a(e){if(typeof window>"u")return null;console.log("🎯 Widget component rendering with props:",{displayType:e.displayType,popupPosition:e.popupPosition,theme:e.theme});const{agentId:t,participantName:n,baseUrl:s,appSecret:o,appId:r,prompts:i,statusMessage:l,welcomeTitle:c,welcomeSubTitle:d,className:u,width:m,height:f,loadingText:g,suportsChatInput:p=!0,suportsVideoInput:x=!0,suportsScreenShare:v=!0,theme:E="vox",onSessionStart:b,onSessionEnd:S,enableSessionLogging:w=!0,onSessionLogsUpdate:C,onSessionMetricsUpdate:A,modalities:j=["voice"],displayType:k="widget",popupPosition:D="bottom-right",popupTriggerText:L="Open Chat",onPopupToggle:W,voxketClient:H,onDisplayTypeChange:Ce}=e,[ne,te]=h.useState(()=>H?!!H.getCurrentSession():!1),[se,U]=h.useState(!1),[M,G]=h.useState(t||""),[Y,V]=h.useState(n||"User"),[q,T]=h.useState(()=>H?H.getCurrentSession():null),[F,z]=h.useState(()=>{var J,He,Me;if(H){const ce=H.getCurrentSession();if((J=ce==null?void 0:ce.activeModalities)!=null&&J.includes("chat"))return"chat";if((He=ce==null?void 0:ce.activeModalities)!=null&&He.includes("voice"))return"voice";if((Me=ce==null?void 0:ce.activeModalities)!=null&&Me.includes("video"))return"video"}return"welcome"}),[B,R]=h.useState(!1);h.useEffect(()=>{console.log("🎯 Widget displayType prop changed to:",k),Jf()},[k]),h.useEffect(()=>{console.log("📊 Session state changed:",{currentMode:F,sessionStarted:ne,loading:se,currentSession:q==null?void 0:q.id,isPopupOpen:B})},[F,ne,se,q,B]);const _=h.useMemo(()=>{if(H)return console.log("🔄 Using passed VoxketClient to preserve session state"),H;console.log("🆕 Creating new VoxketClient instance");const J={appId:r,appSecret:o,baseUrl:s,agentId:M,participantName:Y||"User",modalities:j};return new _t(J)},[H,r,o,s,M,Y,j]),K=j,O=h.useMemo(()=>_.getRoom()||new I.Room,[_]),re={suportsChatInput:p,suportsVideoInput:x,suportsScreenShare:v},{sessionMetrics:oe,sessionLogs:he,logEvent:ve}=La({room:O,onSessionStart:b,onSessionEnd:S,enableConsoleLogging:w,enableLocalStorage:w,voxketSessionId:q==null?void 0:q.id});h.useEffect(()=>{C&&C(he)},[he,C]),h.useEffect(()=>{A&&oe&&A(oe)},[oe,A]),h.useEffect(()=>{const J=Me=>{console.log("🔴 Room disconnected:",Me),U(!1),te(!1),T(null),z("welcome")},He=Me=>{console.log("📹 Media devices error:",Me),Xt({title:"Allow access to your microphone/camera",description:`${Me.name}: ${Me.message}`})};return O.on(I.RoomEvent.MediaDevicesError,He),O.on(I.RoomEvent.Disconnected,J),()=>{O.off(I.RoomEvent.Disconnected,J),O.off(I.RoomEvent.MediaDevicesError,He)}},[O]);const De=async()=>{try{console.log("🎤 Starting voice session...",{agentId:M,participantName:Y}),console.log("🎤 Pre-start state:",{currentMode:F,sessionStarted:ne,loading:se}),U(!0),te(!0),z("voice"),console.log("🎤 State after mode change:",{currentMode:"voice",sessionStarted:!0,loading:!0}),ve("USER_STARTED_VOICE_SESSION",{agentId:M,participantName:Y});const J=await _.startSession(M,{participantName:Y||"User",modalities:["voice",...x?["video"]:[]]});console.log("✅ Voice session started successfully:",J.id),T(J),U(!1),b&&b(J.id)}catch(J){console.error("❌ Failed to start voice session:",J),Xt({title:"Failed to start voice session",description:J instanceof Error?J.message:"Unknown error occurred"}),U(!1),te(!1),z("welcome")}},zt=async()=>{try{U(!0),te(!0),z("chat"),ve("USER_STARTED_CHAT_SESSION",{agentId:M,participantName:Y});const J=await _.startSession(M,{participantName:Y||"User",modalities:["chat"]});T(J),U(!1),b&&b(J.id)}catch(J){console.error("Failed to start chat session:",J),Xt({title:"Failed to start chat session",description:J instanceof Error?J.message:"Unknown error occurred"}),U(!1),te(!1),z("welcome")}},sl=async()=>{try{console.log("📺 Starting video session...",{agentId:M,participantName:Y}),console.log("📺 Pre-start state:",{currentMode:F,sessionStarted:ne,loading:se}),U(!0),te(!0),z("video"),console.log("📺 State after mode change:",{currentMode:"video",sessionStarted:!0,loading:!0}),ve("USER_STARTED_VIDEO_SESSION",{agentId:M,participantName:Y});const J=await _.startSession(M,{participantName:Y||"User",modalities:["video","voice"]});console.log("✅ Video session started successfully:",J.id),T(J),U(!1),b&&b(J.id)}catch(J){console.error("❌ Failed to start video session:",J),Xt({title:"Failed to start video session",description:J instanceof Error?J.message:"Unknown error occurred"}),U(!1),te(!1),z("welcome")}},St=()=>{z("welcome"),Ce&&Ce(e.displayType||"widget"),q&&ne&&(te(!1),T(null),_.disconnect()),k==="popup"&&!B&&R(!0)},Ct=()=>{const J=!B;R(J),W&&W(J),!J&&!(q&&ne)&&(z("welcome"),te(!1),T(null))},ol=()=>{console.log("🔄 Closing fullscreen, switching to widget display type"),e.onDisplayTypeChange?e.onDisplayTypeChange("widget"):console.warn("⚠️ No onDisplayTypeChange callback provided")},il=()=>{e.onDisplayTypeChange&&e.onDisplayTypeChange("fullscreen")};h.useEffect(()=>{var J,He,Me;if(H&&_){console.log("🔄 Syncing widget state with existing client session state");const ce=_.getCurrentSession(),rl=_.connected;console.log("🔍 Existing session state:",{hasSession:!!ce,sessionId:ce==null?void 0:ce.id,isConnected:rl,activeModalities:ce==null?void 0:ce.activeModalities}),ce&&(console.log("✅ Restoring session state from existing client"),T(ce),te(!0),U(!1),(J=ce.activeModalities)!=null&&J.includes("chat")?z("chat"):(He=ce.activeModalities)!=null&&He.includes("voice")?z("voice"):(Me=ce.activeModalities)!=null&&Me.includes("video")&&z("video"))}},[H,_]),h.useEffect(()=>()=>{console.log("🧹 Cleaning up widget component"),H?console.log("🔄 Widget cleanup: preserving passed client instance"):(console.log("🧹 Widget cleanup: disconnecting self-created client"),_.disconnect())},[_,H]);let xn="w-96",yn="h-[25rem]",bn={};if(m&&(m.startsWith("w-")?xn=m:(bn.width=m,xn="")),f&&(f.startsWith("h-")?yn=f:(bn.height=f,yn="")),k==="popup"&&!B)return console.log("🟡 Showing popup trigger button"),a.jsx(s0,{onClick:Ct,text:L,position:D,theme:E});console.log("🟢 Rendering widget content, displayType:",k,"isPopupOpen:",B,"currentMode:",F,"sessionStarted:",ne,"loading:",se);let vn=`voxket-widget-root theme-${E}`,Zt={scrollMargin:0,scrollPadding:0,contain:"layout style paint"};k==="widget"?(vn+=` flex items-center justify-center min-h-fit ${xn} ${yn} ${u}`,Zt={...Zt,...bn}):(vn=`${u||""}`,Zt={});const ro=a.jsx(a.Fragment,{children:a.jsxs(ut,{mode:"wait",children:[F==="welcome"&&!se&&a.jsx(n0,{agentId:M,participantName:Y||"",onAgentIdChange:G,onParticipantNameChange:V,onStartCall:De,onStartChat:zt,onStartVideo:sl,disabled:ne||se,prompts:i,statusMessage:l,title:c,subTitle:d,theme:E,modalities:K,initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:40},transition:{duration:.3,ease:"easeInOut"}},"welcome"),F==="voice"&&a.jsxs(ue.RoomContext.Provider,{value:O,children:[a.jsx(ue.RoomAudioRenderer,{}),a.jsx(ue.StartAudio,{label:"Start Audio"}),a.jsx(Qf,{loadingText:g,participantName:Y||"User",capabilities:re,sessionStarted:ne,disabled:!ne,theme:E,client:_,displayType:k,onBack:k==="popup"?Ct:St,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"session-view")]}),F==="chat"&&a.jsx(e0,{client:_,theme:E,displayType:k,onBack:k==="popup"?Ct:St,onEndChat:St,disabled:!ne,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"chat-view"),F==="video"&&a.jsxs(ue.RoomContext.Provider,{value:O,children:[a.jsx(ue.RoomAudioRenderer,{}),a.jsx(ue.StartAudio,{label:"Start Audio"}),a.jsx(t0,{client:_,theme:E,displayType:k,onBack:k==="popup"?Ct:St,onEndCall:St,disabled:!ne,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"video-view")]})]})});return k==="fullscreen"||k==="popup"?(console.log("📱 Rendering fullscreen/popup mode, displayType:",k),a.jsx(Bi,{theme:E,displayType:k,popupPosition:D,onClose:k==="fullscreen"?ol:Ct,children:ro})):(console.log("📦 Rendering widget mode"),a.jsx("div",{className:vn,style:Zt,children:a.jsx(Bi,{theme:E,displayType:k,popupPosition:D,onExpand:il,children:ro})}))}class Ha extends h.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("VoxketWidget Error:",t,n)}render(){if(this.state.hasError){if(this.props.fallback){const t=this.props.fallback;return h.createElement(t,{error:this.state.error})}return h.createElement("div",{style:{padding:"20px",border:"1px solid #ff4444",borderRadius:"8px",background:"#fff5f5",color:"#cc0000"}},"VoxketWidget encountered an error. Please check the console for details.")}return this.props.children}}function o0({logs:e,onClear:t,onExport:n}){const[s,o]=y.useState(!1),[r,i]=y.useState(""),l=e.filter(c=>!r||c.event.toLowerCase().includes(r.toLowerCase()));return s?a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[80vh] flex flex-col m-4",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[a.jsxs("h2",{className:"text-lg font-semibold",children:["Session Logs (",e.length,")"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",placeholder:"Filter events...",value:r,onChange:c=>i(c.target.value),className:"px-3 py-1 border rounded text-sm"}),a.jsx("button",{onClick:t,className:"px-3 py-1 bg-red-600 text-white rounded text-sm hover:bg-red-700",children:"Clear"}),a.jsx("button",{onClick:n,className:"px-3 py-1 bg-green-600 text-white rounded text-sm hover:bg-green-700",children:"Export"}),a.jsx("button",{onClick:()=>o(!1),className:"px-3 py-1 bg-gray-600 text-white rounded text-sm hover:bg-gray-700",children:"Close"})]})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4",children:l.length===0?a.jsx("p",{className:"text-gray-500 text-center py-8",children:"No logs found"}):a.jsx("div",{className:"space-y-2",children:l.map((c,d)=>a.jsxs("div",{className:"border rounded p-3 text-sm",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"font-semibold text-blue-600",children:c.event}),a.jsx("span",{className:"text-gray-500 text-xs",children:new Date(c.timestamp).toLocaleTimeString()})]}),c.sessionId&&a.jsxs("div",{className:"text-xs text-gray-600 mb-1",children:["Session: ",c.sessionId]}),c.data&&a.jsx("div",{className:"bg-gray-50 p-2 rounded text-xs",children:a.jsx("pre",{className:"whitespace-pre-wrap overflow-auto",children:JSON.stringify(c.data,null,2)})})]},d))})})]})}):a.jsxs("button",{onClick:()=>o(!0),className:"fixed bottom-4 right-4 bg-blue-600 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-blue-700 transition-colors text-sm z-50",children:["Session Logs (",e.length,")"]})}function i0({metrics:e}){return e?a.jsxs("div",{className:"bg-gray-100 p-4 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Current Session"}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-600",children:"Session ID:"}),a.jsx("div",{className:"font-mono text-xs",children:e.sessionId})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-600",children:"Start Time:"}),a.jsx("div",{children:new Date(e.startTime).toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-600",children:"Messages:"}),a.jsx("div",{children:e.totalMessages})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-600",children:"Participants:"}),a.jsx("div",{children:e.participantCount})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-600",children:"Connection Issues:"}),a.jsx("div",{children:e.connectionIssues})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-600",children:"Duration:"}),a.jsxs("div",{children:[Math.round((Date.now()-new Date(e.startTime).getTime())/1e3),"s"]})]})]})]}):null}let Hn=!1;const r0=`/* Voxket SDK Styles */
|
|
116
|
-
::-webkit-scrollbar { display: none;}
|
|
117
|
-
|
|
118
|
-
/* Scrollbar utilities */
|
|
119
|
-
.scrollbar-hide {
|
|
120
|
-
scrollbar-width: none;
|
|
121
|
-
-ms-overflow-style: none;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.scrollbar-hide::-webkit-scrollbar {
|
|
125
|
-
display: none;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/* Custom scrollbar for chat */
|
|
129
|
-
.chat-scrollable {
|
|
130
|
-
scrollbar-width: thin;
|
|
131
|
-
scrollbar-color: rgba(155, 155, 155, 0.3) transparent;
|
|
132
|
-
display: flex;
|
|
133
|
-
flex-direction: column;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.chat-scrollable::-webkit-scrollbar {
|
|
137
|
-
width: 6px;
|
|
138
|
-
display: block;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.chat-scrollable::-webkit-scrollbar-track {
|
|
142
|
-
background: transparent;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.chat-scrollable::-webkit-scrollbar-thumb {
|
|
146
|
-
background-color: rgba(155, 155, 155, 0.3);
|
|
147
|
-
border-radius: 3px;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.chat-scrollable::-webkit-scrollbar-thumb:hover {
|
|
151
|
-
background-color: rgba(155, 155, 155, 0.5);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/* Ensure chat messages start from bottom when there are few messages */
|
|
155
|
-
.chat-messages-container {
|
|
156
|
-
display: flex;
|
|
157
|
-
flex-direction: column;
|
|
158
|
-
justify-content: flex-end;
|
|
159
|
-
min-height: 100%;
|
|
160
|
-
width: 100%;
|
|
161
|
-
max-width: none;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
@keyframes pulse-ring {
|
|
165
|
-
0% { transform: scale(1); opacity: 1; }
|
|
166
|
-
50% { transform: scale(1.2); opacity: 0.6; }
|
|
167
|
-
100% { transform: scale(1.4); opacity: 0; }
|
|
168
|
-
}
|
|
169
|
-
@keyframes glow {
|
|
170
|
-
0%, 100% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.5); }
|
|
171
|
-
50% { box-shadow: 0 0 30px rgba(59, 130, 246, 0.8); }
|
|
172
|
-
}
|
|
173
|
-
.pulse-ring {
|
|
174
|
-
animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
175
|
-
}
|
|
176
|
-
.mic-glow {
|
|
177
|
-
animation: glow 2s ease-in-out infinite;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.voxket-widget-root {
|
|
181
|
-
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
182
|
-
line-height: 1.5;
|
|
183
|
-
font-weight: 400;
|
|
184
|
-
color-scheme: light dark;
|
|
185
|
-
background-color: transparent;
|
|
186
|
-
color: rgba(255, 255, 255, 0.87);
|
|
187
|
-
border-radius: '2xl';
|
|
188
|
-
font-synthesis: none;
|
|
189
|
-
text-rendering: optimizeLegibility;
|
|
190
|
-
-webkit-font-smoothing: antialiased;
|
|
191
|
-
-moz-osx-font-smoothing: grayscale;
|
|
192
|
-
border-radius: 1rem;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/* Theme-specific root styles */
|
|
196
|
-
.voxket-widget-root.theme-light {
|
|
197
|
-
color: rgba(0, 0, 0, 0.87);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.voxket-widget-root.theme-dark {
|
|
201
|
-
color: rgba(255, 255, 255, 0.87);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.voxket-widget-root.theme-vox {
|
|
205
|
-
color: rgba(255, 255, 255, 0.87);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.animate-spin {
|
|
209
|
-
animation: spin 1s linear infinite;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
@keyframes spin {
|
|
213
|
-
to {
|
|
214
|
-
transform: rotate(360deg);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
.voxket-widget-root button {
|
|
219
|
-
cursor: pointer;
|
|
220
|
-
}`;function a0(){if(Hn||typeof document>"u")return;if(document.getElementById("voxket-widget-styles")){Hn=!0;return}const t=document.createElement("style");t.id="voxket-widget-styles",t.type="text/css",t.textContent=r0,document.head.appendChild(t),Hn=!0}a0();function nt(){const{currentSession:e,sessionState:t,sessionMetrics:n,createSession:s,endSession:o}=Ie(),r=y.useCallback(async(l,c)=>await s(l,c),[s]),i=y.useCallback(async()=>await o(),[o]);return{session:e,state:t,metrics:n,isActive:e!==null&&t!=="disconnected",isConnecting:t==="connecting",isConnected:t==="connected"||t==="active",start:r,stop:i}}function za(){const{sessionMetrics:e,currentSession:t}=Ie();return{metrics:e,sessionId:t==null?void 0:t.id,duration:e==null?void 0:e.duration,participantCount:e==null?void 0:e.participantCount,messageCount:e==null?void 0:e.messageCount,audioQuality:e==null?void 0:e.audioQuality,networkStats:e==null?void 0:e.networkStats}}function Za(){const{setMicrophoneEnabled:e,client:t}=Ie(),[n,s]=y.useState(!1),[o,r]=y.useState(!1),i=y.useCallback(async()=>{if(!o){r(!0);try{const d=!n;await e(d),s(d)}catch(d){console.error("Failed to toggle microphone:",d)}finally{r(!1)}}},[n,o,e]),l=y.useCallback(async()=>{if(!(n||o)){r(!0);try{await e(!0),s(!0)}catch(d){console.error("Failed to enable microphone:",d)}finally{r(!1)}}},[n,o,e]),c=y.useCallback(async()=>{if(!(!n||o)){r(!0);try{await e(!1),s(!1)}catch(d){console.error("Failed to disable microphone:",d)}finally{r(!1)}}},[n,o,e]);return{isEnabled:n,isLoading:o,toggle:i,enable:l,disable:c}}function Ua(){const{setCameraEnabled:e}=Ie(),[t,n]=y.useState(!1),[s,o]=y.useState(!1),r=y.useCallback(async()=>{if(!s){o(!0);try{const c=!t;await e(c),n(c)}catch(c){console.error("Failed to toggle camera:",c)}finally{o(!1)}}},[t,s,e]),i=y.useCallback(async()=>{if(!(t||s)){o(!0);try{await e(!0),n(!0)}catch(c){console.error("Failed to enable camera:",c)}finally{o(!1)}}},[t,s,e]),l=y.useCallback(async()=>{if(!(!t||s)){o(!0);try{await e(!1),n(!1)}catch(c){console.error("Failed to disable camera:",c)}finally{o(!1)}}},[t,s,e]);return{isEnabled:t,isLoading:s,toggle:r,enable:i,disable:l}}function Wa(){const{startScreenShare:e,stopScreenShare:t}=Ie(),[n,s]=y.useState(!1),[o,r]=y.useState(!1),i=y.useCallback(async()=>{if(!(n||o)){r(!0);try{await e(),s(!0)}catch(d){console.error("Failed to start screen share:",d)}finally{r(!1)}}},[n,o,e]),l=y.useCallback(async()=>{if(!(!n||o)){r(!0);try{await t(),s(!1)}catch(d){console.error("Failed to stop screen share:",d)}finally{r(!1)}}},[n,o,t]),c=y.useCallback(async()=>{n?await l():await i()},[n,i,l]);return{isSharing:n,isLoading:o,start:i,stop:l,toggle:c}}function l0(){const{client:e}=Ie(),[t,n]=y.useState({tracks:[],layout:{type:"grid",showLocalVideo:!0,aspectRatio:"16:9"},isRecording:!1}),s=y.useMemo(()=>t.tracks.find(x=>x.isLocal),[t.tracks]),o=y.useMemo(()=>t.tracks.filter(x=>!x.isLocal),[t.tracks]),r=y.useCallback(async()=>{try{s!=null&&s.isEnabled?await(e==null?void 0:e.disableCamera()):await(e==null?void 0:e.enableCamera())}catch(x){throw console.error("Failed to toggle camera:",x),x}},[e,s]),i=y.useCallback(async()=>{try{t.tracks.find(v=>v.isScreenShare)?await(e==null?void 0:e.stopScreenShare()):await(e==null?void 0:e.startScreenShare())}catch(x){throw console.error("Failed to toggle screen share:",x),x}},[e,t.tracks]),l=y.useCallback(x=>{n(v=>({...v,layout:x}))},[]),c=y.useCallback(x=>{n(v=>({...v,pinnedTrack:x}))},[]),d=y.useCallback(()=>{n(x=>({...x,pinnedTrack:void 0}))},[]),u=y.useCallback(async()=>{try{await(e==null?void 0:e.startRecording()),n(x=>({...x,isRecording:!0}))}catch(x){throw console.error("Failed to start recording:",x),x}},[e]),m=y.useCallback(async()=>{try{await(e==null?void 0:e.stopRecording()),n(x=>({...x,isRecording:!1}))}catch(x){throw console.error("Failed to stop recording:",x),x}},[e]),f=y.useCallback(x=>t.tracks.find(v=>v.id===x),[t.tracks]),g=y.useCallback(x=>t.tracks.filter(v=>v.participantId===x),[t.tracks]),p=y.useCallback(x=>x.isEnabled&&t.tracks.includes(x),[t.tracks]);return y.useEffect(()=>{if(!e)return;const x=b=>{n(S=>({...S,tracks:[...S.tracks.filter(w=>w.id!==b.id),b]}))},v=b=>{n(S=>{var w;return{...S,tracks:S.tracks.filter(C=>C.id!==b),pinnedTrack:((w=S.pinnedTrack)==null?void 0:w.id)===b?void 0:S.pinnedTrack}})},E=b=>{n(S=>({...S,tracks:S.tracks.map(w=>w.id===b.id?b:w)}))};return e.on("videoTrackAdded",x),e.on("videoTrackRemoved",v),e.on("videoTrackUpdated",E),()=>{e.off("videoTrackAdded",x),e.off("videoTrackRemoved",v),e.off("videoTrackUpdated",E)}},[e]),{tracks:t.tracks,localTrack:s,remoteTraracks:o,pinnedTrack:t.pinnedTrack,layout:t.layout,isRecording:t.isRecording,toggleCamera:r,toggleScreenShare:i,setLayout:l,pinTrack:c,unpinTrack:d,startRecording:u,stopRecording:m,getTrackById:f,getTracksByParticipant:g,isTrackActive:p}}function pn(){const{chatMessages:e,sendChatMessage:t,currentSession:n}=Ie(),[s,o]=y.useState(!1),r=y.useCallback(async d=>{if(!(!d.trim()||s||!n)){o(!0);try{await t(d.trim())}catch(u){throw console.error("Failed to send chat message:",u),u}finally{o(!1)}}},[t,s,n]),{userMessages:i,agentMessages:l,allMessages:c}=y.useMemo(()=>{const d=e.filter(m=>m.sender.type==="participant"),u=e.filter(m=>m.sender.type==="agent");return{userMessages:d,agentMessages:u,allMessages:e}},[e]);return{messages:c,userMessages:i,agentMessages:l,messageCount:c.length,isSending:s,canSend:!!n&&!s,send:r}}function c0(){const{send:e,isSending:t,canSend:n}=pn(),[s,o]=y.useState(""),r=y.useCallback(async()=>{if(!(!s.trim()||!n))try{await e(s),o("")}catch(l){throw l}},[s,e,n]),i=y.useCallback(l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),r())},[r]);return{value:s,setValue:o,send:r,handleKeyPress:i,isSending:t,canSend:n&&s.trim().length>0}}function no(){const{isConnected:e,isConnecting:t,connectionError:n,connect:s,disconnect:o}=Ie(),r=y.useCallback(async()=>{if(!(e||t))try{await s()}catch(l){throw console.error("Failed to connect:",l),l}},[s,e,t]),i=y.useCallback(async()=>{if(e)try{await o()}catch(l){throw console.error("Failed to disconnect:",l),l}},[o,e]);return{isConnected:e,isConnecting:t,isDisconnected:!e&&!t,error:n,hasError:!!n,connect:r,disconnect:i}}function Ka(){const{participants:e}=Ie();return{participants:e,count:e.length,localParticipant:e.find(t=>t.isLocal),remoteParticipants:e.filter(t=>!t.isLocal)}}const Ga=y.createContext({}),Ht=()=>y.useContext(Ga);function Ya({children:e,...t}){return a.jsx(Ga.Provider,{value:t,children:e})}function sn({name:e,children:t,fallback:n,className:s}){return a.jsx("div",{className:`voxket-slot voxket-slot--${e} ${s||""}`,children:t||n})}function qa(e,t={}){return Object.assign(e,t)}function Xa({showMicrophoneControl:e=!0,showCameraControl:t=!0,showScreenShareControl:n=!0,showSessionActions:s=!0,customControls:o,className:r=""}){const i=nt(),l=Za(),c=Ua(),d=Wa(),u=Ht(),m=["voxket-session-controls",`voxket-session-controls--${u.variant||"default"}`,`voxket-session-controls--${u.size||"md"}`,i.isActive?"voxket-session-controls--active":"voxket-session-controls--inactive",r].filter(Boolean).join(" ");return!i.isActive&&!s?a.jsx("div",{className:m,children:a.jsx("div",{className:"voxket-controls-inactive",children:a.jsx("p",{children:"Controls available during active session"})})}):a.jsxs("div",{className:m,children:[s&&a.jsx("div",{className:"voxket-session-actions",children:i.isActive?a.jsx("button",{onClick:i.stop,className:"voxket-button voxket-button--danger",children:"End Session"}):a.jsx(d0,{})}),i.isActive&&a.jsxs("div",{className:"voxket-media-controls",children:[e&&a.jsxs("button",{onClick:l.toggle,disabled:l.isLoading,className:`voxket-button voxket-button--media ${l.isEnabled?"voxket-button--active":""}`,title:l.isEnabled?"Mute microphone":"Unmute microphone",children:[a.jsx("span",{className:"voxket-icon",children:"🎤"}),l.isLoading?"Loading...":l.isEnabled?"Mute":"Unmute"]}),t&&a.jsxs("button",{onClick:c.toggle,disabled:c.isLoading,className:`voxket-button voxket-button--media ${c.isEnabled?"voxket-button--active":""}`,title:c.isEnabled?"Stop camera":"Start camera",children:[a.jsx("span",{className:"voxket-icon",children:"📹"}),c.isLoading?"Loading...":c.isEnabled?"Stop Video":"Start Video"]}),n&&a.jsxs("button",{onClick:d.toggle,disabled:d.isLoading,className:`voxket-button voxket-button--media ${d.isSharing?"voxket-button--active":""}`,title:d.isSharing?"Stop screen share":"Start screen share",children:[a.jsx("span",{className:"voxket-icon",children:"🖥️"}),d.isLoading?"Loading...":d.isSharing?"Stop Share":"Share Screen"]})]}),o&&a.jsx("div",{className:"voxket-custom-controls",children:o})]})}function d0(){nt();const[e,t]=y.useState(!1),n=async()=>{t(!0);try{console.log("Start session - agentId needed")}catch(s){console.error("Failed to start session:",s)}finally{t(!1)}};return a.jsx("button",{onClick:n,disabled:e,className:"voxket-button voxket-button--primary",children:e?"Starting...":"Start Session"})}function so({showConnectionStatus:e=!0,showSessionInfo:t=!0,showAgentInfo:n=!0,className:s=""}){const o=nt(),r=no(),i=Ht(),l=["voxket-session-header",`voxket-session-header--${i.variant||"default"}`,`voxket-session-header--${i.size||"md"}`,s].filter(Boolean).join(" ");return a.jsxs("div",{className:l,children:[e&&a.jsxs("div",{className:"voxket-connection-status",children:[a.jsx("div",{className:`voxket-status-indicator ${r.isConnected?"connected":"disconnected"}`}),a.jsx("span",{className:"voxket-status-text",children:r.isConnecting?"Connecting...":r.isConnected?"Connected":"Disconnected"})]}),t&&o.session&&a.jsxs("div",{className:"voxket-session-info",children:[a.jsxs("div",{className:"voxket-session-id",children:["Session: ",o.session.id.slice(-8)]}),a.jsxs("div",{className:"voxket-session-state",children:["State: ",o.state]})]}),n&&o.session&&a.jsxs("div",{className:"voxket-agent-info",children:[a.jsxs("div",{className:"voxket-agent-id",children:["Agent: ",o.session.agentId]}),a.jsxs("div",{className:"voxket-modalities",children:["Modalities: ",o.session.activeModalities.join(", ")]})]}),r.error&&a.jsxs("div",{className:"voxket-error-message",children:["Error: ",r.error.message]})]})}function oo({showChat:e=!0,showTranscriptions:t=!1,customContent:n,className:s=""}){const o=nt(),r=pn(),i=Ht(),l=["voxket-session-content",`voxket-session-content--${i.variant||"default"}`,`voxket-session-content--${i.size||"md"}`,s].filter(Boolean).join(" ");return o.isActive?a.jsx("div",{className:l,children:n||a.jsxs(a.Fragment,{children:[e&&a.jsxs("div",{className:"voxket-chat-container",children:[a.jsxs("div",{className:"voxket-chat-messages",children:[r.messages.map(c=>a.jsxs("div",{className:`voxket-message voxket-message--${c.sender.type}`,children:[a.jsxs("div",{className:"voxket-message-header",children:[a.jsx("span",{className:"voxket-message-sender",children:c.sender.name}),a.jsx("span",{className:"voxket-message-time",children:c.timestamp.toLocaleTimeString()})]}),a.jsx("div",{className:"voxket-message-content",children:c.content})]},c.id)),r.messages.length===0&&a.jsx("div",{className:"voxket-empty-messages",children:a.jsx("p",{children:"No messages yet. Start the conversation!"})})]}),a.jsx(u0,{})]}),t&&a.jsx("div",{className:"voxket-transcriptions",children:a.jsx("div",{className:"voxket-transcription-placeholder",children:a.jsx("p",{children:"Voice transcriptions will appear here"})})})]})}):a.jsx("div",{className:l,children:a.jsx("div",{className:"voxket-inactive-state",children:a.jsxs("div",{className:"voxket-inactive-message",children:[a.jsx("h3",{children:"Start a conversation"}),a.jsx("p",{children:"Begin a session to start chatting with the AI agent"})]})})})}function u0(){const e=pn(),[t,n]=y.useState(""),s=async()=>{if(!(!t.trim()||!e.canSend))try{await e.send(t),n("")}catch(r){console.error("Failed to send message:",r)}},o=r=>{r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),s())};return a.jsxs("div",{className:"voxket-chat-input",children:[a.jsx("input",{type:"text",value:t,onChange:r=>n(r.target.value),onKeyPress:o,placeholder:"Type your message...",disabled:!e.canSend,className:"voxket-input"}),a.jsx("button",{onClick:s,disabled:!e.canSend||!t.trim(),className:"voxket-send-button",children:e.isSending?"Sending...":"Send"})]})}function io({showMetrics:e=!0,showParticipants:t=!0,showStatus:n=!0,customFooter:s,className:o=""}){const r=nt(),i=za(),l=Ka(),c=Ht(),d=["voxket-session-footer",`voxket-session-footer--${c.variant||"default"}`,`voxket-session-footer--${c.size||"md"}`,o].filter(Boolean).join(" ");return r.isActive?a.jsx("div",{className:d,children:s||a.jsxs(a.Fragment,{children:[n&&a.jsxs("div",{className:"voxket-session-status",children:[a.jsx("div",{className:"voxket-status-indicator voxket-status-indicator--active"}),a.jsx("span",{className:"voxket-status-text",children:"Session Active"})]}),e&&i.metrics&&a.jsxs("div",{className:"voxket-session-metrics",children:[a.jsxs("div",{className:"voxket-metric",children:[a.jsx("span",{className:"voxket-metric-label",children:"Duration:"}),a.jsx("span",{className:"voxket-metric-value",children:h0(i.duration||0)})]}),a.jsxs("div",{className:"voxket-metric",children:[a.jsx("span",{className:"voxket-metric-label",children:"Messages:"}),a.jsx("span",{className:"voxket-metric-value",children:i.metrics.messageCount})]})]}),t&&a.jsxs("div",{className:"voxket-participants-info",children:[a.jsxs("span",{className:"voxket-participants-count",children:[l.count," participant",l.count!==1?"s":""]}),l.remoteParticipants.length>0&&a.jsx("div",{className:"voxket-participant-list",children:l.remoteParticipants.map(u=>a.jsx("span",{className:"voxket-participant-name",children:u.name},u.id))})]})]})}):a.jsx("div",{className:d,children:a.jsx("div",{className:"voxket-footer-inactive",children:a.jsx("span",{className:"voxket-status-text",children:"Ready to start session"})})})}function h0(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),s=Math.floor(n/60);return s>0?`${s}:${(n%60).toString().padStart(2,"0")}:${(t%60).toString().padStart(2,"0")}`:`${n}:${(t%60).toString().padStart(2,"0")}`}function m0({agentId:e,sessionConfig:t,autoStart:n=!1,onSessionStart:s,onSessionEnd:o,variant:r="default",size:i="md",theme:l,className:c="",children:d}){var g;const u=nt(),m=no();y.useEffect(()=>{n&&e&&m.isConnected&&!u.isActive&&u.start(e,t).catch(console.error)},[n,e,m.isConnected,u.isActive]),y.useEffect(()=>{var p;(p=u.session)!=null&&p.id&&s&&s(u.session.id)},[(g=u.session)==null?void 0:g.id,s]),y.useEffect(()=>()=>{u.isActive&&o&&u.stop().then(o).catch(console.error)},[]);const f=["voxket-session",`voxket-session--${r}`,`voxket-session--${i}`,u.isActive?"voxket-session--active":"voxket-session--inactive",c].filter(Boolean).join(" ");return a.jsx(Ya,{variant:r,size:i,theme:l,className:c,children:a.jsx("div",{className:f,children:d||a.jsxs(a.Fragment,{children:[a.jsx(sn,{name:"header",fallback:a.jsx(so,{})}),a.jsx(sn,{name:"content",fallback:a.jsx(oo,{})}),a.jsx(sn,{name:"footer",fallback:a.jsx(io,{})})]})})})}const Ja=qa(m0,{Header:so,Content:oo,Footer:io,Controls:Xa}),tt={name:"default",colors:{primary:"#3B82F6",secondary:"#6B7280",accent:"#8B5CF6",background:"#FFFFFF",surface:"#F9FAFB",text:{primary:"#111827",secondary:"#6B7280",muted:"#9CA3AF",inverse:"#FFFFFF"},status:{success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6"},border:"#E5E7EB",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},typography:{fontFamily:"system-ui, -apple-system, sans-serif",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{none:"0",sm:"0.25rem",md:"0.5rem",lg:"0.75rem",full:"9999px"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1)"}},fs={...tt,name:"dark",colors:{primary:"#60A5FA",secondary:"#9CA3AF",accent:"#A78BFA",background:"#111827",surface:"#1F2937",text:{primary:"#F9FAFB",secondary:"#D1D5DB",muted:"#9CA3AF",inverse:"#111827"},status:{success:"#34D399",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},border:"#374151",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.3)"}},gs={...tt,name:"enterprise",colors:{primary:"#1E40AF",secondary:"#64748B",accent:"#7C3AED",background:"#FFFFFF",surface:"#F8FAFC",text:{primary:"#0F172A",secondary:"#475569",muted:"#94A3B8",inverse:"#FFFFFF"},status:{success:"#059669",warning:"#D97706",error:"#DC2626",info:"#1E40AF"},border:"#CBD5E1",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},borderRadius:{none:"0",sm:"0.125rem",md:"0.25rem",lg:"0.375rem",full:"9999px"}},Qa=y.createContext(null),el=()=>{const e=y.useContext(Qa);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e};function f0({theme:e="default",themes:t={},children:n,cssVariables:s=!0,className:o=""}){const[r,i]=y.useState(()=>{const f={default:tt,dark:fs,enterprise:gs,...t};return typeof e=="string"?f[e]||tt:e}),[l,c]=y.useState(()=>({default:tt,dark:fs,enterprise:gs,...t})),d=f=>{if(typeof f=="string"){const g=l[f];g&&i(g)}else i(f)},u=f=>{c(g=>({...g,[f.name]:f}))};y.useEffect(()=>{if(s&&typeof document<"u"){const f=document.documentElement;Object.entries(tl(r)).forEach(([g,p])=>{f.style.setProperty(`--voxket-${g}`,p)})}},[r,s]);const m={theme:r,setTheme:d,themes:l,registerTheme:u};return a.jsx(Qa.Provider,{value:m,children:a.jsx("div",{className:`voxket-theme voxket-theme--${r.name} ${o}`,children:n})})}function tl(e){const t={},n=(s,o="")=>{for(const[r,i]of Object.entries(s)){const l=o?`${o}-${r}`:r;typeof i=="object"&&i!==null&&!Array.isArray(i)?n(i,l):t[l]=String(i)}};return n(e),t}function g0(e=tt,t){return{...e,...t,colors:{...e.colors,...t.colors},typography:{...e.typography,...t.typography},spacing:{...e.spacing,...t.spacing},borderRadius:{...e.borderRadius,...t.borderRadius},shadows:{...e.shadows,...t.shadows}}}function p0(e){var n;const{theme:t}=el();return((n=t.components)==null?void 0:n[e])||{}}const x0=to("voice-modality","voice",{onActivate:async e=>{const t=e.config;t.enableTranscription&&y0(e),t.enableVoiceActivation&&b0(e,t),console.log("Voice modality activated",t)},onDeactivate:async e=>{console.log("Voice modality deactivated")},onMessage:async(e,t)=>{t.type==="audio"&&v0(e,t)}});function y0(e,t){e.on("participant.speaking.started",n=>{console.log("Transcription: Started for",n.name)}),e.on("participant.speaking.stopped",n=>{console.log("Transcription: Stopped for",n.name)})}function b0(e,t){const n=t.silenceThreshold||-50;console.log("Voice activation setup with threshold:",n)}function v0(e,t){console.log("Playing audio response:",t.content)}const w0=to("chat-modality","chat",{onActivate:async e=>{const t=e.config;t.enableRichText&&S0(),t.enableFileUpload&&C0(e),t.enableCustomComponents&&k0(),console.log("Chat modality activated",t)},onDeactivate:async e=>{console.log("Chat modality deactivated")},onMessage:async(e,t)=>{const n=e.config;t.type==="ui_component"?j0(e,t):t.type==="text"&&n.enableRichText&&E0(e,t)}});function S0(e){console.log("Rich text support enabled")}function C0(e){console.log("File upload enabled"),e.on("chat.file.uploaded",t=>{console.log("File uploaded:",t.name)})}function k0(e){console.log("Custom components enabled");const t=new Map;t.set("quick-actions",A0),t.set("form",M0),t.set("card",T0),t.set("chart",V0)}function j0(e,t){const{componentType:n,props:s}=t.metadata;console.log("Rendering custom component:",n,s),e.emit("chat.component.render",{type:n,props:s,timestamp:new Date})}function E0(e,t){console.log("Processing rich text message:",t.content)}function A0(e){return{type:"quick-actions",actions:e.actions||[],layout:e.layout||"horizontal"}}function M0(e){return{type:"form",fields:e.fields||[],submitAction:e.submitAction,validation:e.validation}}function T0(e){return{type:"card",title:e.title,content:e.content,actions:e.actions,variant:e.variant||"default"}}function V0(e){return{type:"chart",chartType:e.chartType||"line",data:e.data,options:e.options}}function on({track:e,participantName:t,showControls:n=!0,showName:s=!0,showMuteIndicator:o=!0,isPinned:r=!1,className:i="",onClick:l,onPin:c,onUnpin:d}){const u=y.useRef(null),[m,f]=y.useState(!1);y.useEffect(()=>{if(!u.current||!e.isEnabled)return;const v=u.current;return v.srcObject=null,()=>{v.srcObject&&(v.srcObject=null)}},[e]);const g=()=>{l==null||l(e)},p=v=>{v.stopPropagation(),r?d==null||d(e):c==null||c(e)},x=["voxket-video-tile",e.isLocal?"voxket-video-tile--local":"voxket-video-tile--remote",e.isScreenShare?"voxket-video-tile--screen-share":"voxket-video-tile--camera",r?"voxket-video-tile--pinned":"",e.isEnabled?"":"voxket-video-tile--disabled",m?"voxket-video-tile--hovered":"",i].filter(Boolean).join(" ");return a.jsxs("div",{className:x,onClick:g,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{aspectRatio:e.dimensions?`${e.dimensions.width} / ${e.dimensions.height}`:"16 / 9"},children:[a.jsx("video",{ref:u,className:"voxket-video-element",autoPlay:!0,playsInline:!0,muted:e.isLocal}),!e.isEnabled&&a.jsxs("div",{className:"voxket-video-placeholder",children:[a.jsx("div",{className:"voxket-video-placeholder-icon",children:e.isScreenShare?"🖥️":"📹"}),a.jsx("p",{className:"voxket-video-placeholder-text",children:e.isScreenShare?"Screen sharing paused":"Camera off"})]}),a.jsxs("div",{className:"voxket-video-overlay",children:[s&&t&&a.jsxs("div",{className:"voxket-video-name",children:[t,e.isLocal&&" (You)"]}),o&&!e.isEnabled&&a.jsx("div",{className:"voxket-video-mute-indicator",children:"🔇"}),n&&(m||r)&&a.jsxs("div",{className:"voxket-video-controls",children:[a.jsx("button",{className:`voxket-video-control-btn ${r?"voxket-video-control-btn--active":""}`,onClick:p,title:r?"Unpin video":"Pin video",children:"📌"}),e.isScreenShare&&a.jsx("div",{className:"voxket-video-indicator",children:"🖥️"}),e.source&&a.jsx("div",{className:"voxket-video-source",children:e.source})]})]}),!e.isEnabled&&a.jsx("div",{className:"voxket-video-loading",children:a.jsx("div",{className:"voxket-spinner"})})]})}function N0({tracks:e,layout:t,className:n="",onLayoutChange:s,onTrackClick:o,maxVisibleTracks:r=9,showPagination:i=!0}){const[l,c]=y.useState(0),[d,u]=y.useState(null),m=y.useMemo(()=>{let b=[...e];t.type==="speaker"&&d&&(b=[d,...e.filter(C=>C.id!==d.id)]);const S=l*r,w=S+r;return b.slice(S,w)},[e,t,d,l,r]),f=Math.ceil(e.length/r),g=y.useMemo(()=>{const b=m.length;switch(t.type){case"grid":const S=Math.ceil(Math.sqrt(b)),w=Math.ceil(b/S);return{display:"grid",gridTemplateColumns:`repeat(${S}, 1fr)`,gridTemplateRows:`repeat(${w}, 1fr)`,gap:"8px"};case"speaker":return{display:"flex",flexDirection:"column",gap:"8px"};case"sidebar":return{display:"flex",gap:"8px"};case"gallery":return{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center"};default:return{}}},[t.type,m.length]),p=b=>{u(b)},x=()=>{u(null)},v=b=>{s==null||s({...t,type:b})},E=["voxket-video-grid",`voxket-video-grid--${t.type}`,`voxket-video-grid--${m.length}-tracks`,n].filter(Boolean).join(" ");return e.length===0?a.jsx("div",{className:"voxket-video-grid-empty",children:a.jsxs("div",{className:"voxket-video-grid-empty-content",children:[a.jsx("div",{className:"voxket-video-grid-empty-icon",children:"📹"}),a.jsx("p",{children:"No video tracks available"})]})}):a.jsxs("div",{className:E,children:[a.jsxs("div",{className:"voxket-video-grid-controls",children:[a.jsx("div",{className:"voxket-video-layout-controls",children:["grid","speaker","sidebar","gallery"].map(b=>a.jsx("button",{className:`voxket-layout-btn ${t.type===b?"voxket-layout-btn--active":""}`,onClick:()=>v(b),title:`Switch to ${b} layout`,children:P0(b)},b))}),a.jsxs("div",{className:"voxket-video-count",children:[e.length," participant",e.length!==1?"s":""]})]}),a.jsx("div",{className:"voxket-video-grid-content",style:g,children:t.type==="speaker"&&d?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"voxket-video-speaker-main",children:a.jsx(on,{track:d,participantName:`Participant ${d.participantId}`,isPinned:!0,onClick:o,onUnpin:x})}),a.jsx("div",{className:"voxket-video-speaker-sidebar",children:m.filter(b=>b.id!==d.id).map(b=>a.jsx(on,{track:b,participantName:`Participant ${b.participantId}`,showControls:!1,onClick:o,onPin:p},b.id))})]}):m.map(b=>a.jsx(on,{track:b,participantName:`Participant ${b.participantId}`,isPinned:(d==null?void 0:d.id)===b.id,onClick:o,onPin:p,onUnpin:x},b.id))}),i&&f>1&&a.jsxs("div",{className:"voxket-video-pagination",children:[a.jsx("button",{className:"voxket-pagination-btn",onClick:()=>c(Math.max(0,l-1)),disabled:l===0,children:"←"}),a.jsxs("span",{className:"voxket-pagination-info",children:["Page ",l+1," of ",f]}),a.jsx("button",{className:"voxket-pagination-btn",onClick:()=>c(Math.min(f-1,l+1)),disabled:l===f-1,children:"→"})]})]})}function P0(e){switch(e){case"grid":return"⊞";case"speaker":return"🎤";case"sidebar":return"⫸";case"gallery":return"⊡";case"picture-in-picture":return"⧉";default:return"⊞"}}function R0({localTrack:e,onToggleCamera:t,onToggleScreenShare:n,onLayoutChange:s,showLayoutControls:o=!0,showCameraControls:r=!0,showScreenShareControls:i=!0,className:l=""}){const c=["voxket-video-controls",l].filter(Boolean).join(" "),d=u=>{s==null||s({type:u,showLocalVideo:!0,aspectRatio:"16:9"})};return a.jsxs("div",{className:c,children:[r&&a.jsxs("div",{className:"voxket-video-controls-section",children:[a.jsx("h4",{className:"voxket-video-controls-title",children:"Camera"}),a.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isEnabled?"voxket-control-btn--active":""}`,onClick:t,title:e!=null&&e.isEnabled?"Turn off camera":"Turn on camera",children:[a.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isEnabled?"📹":"📷"}),a.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isEnabled?"Camera On":"Camera Off"})]}),(e==null?void 0:e.dimensions)&&a.jsxs("div",{className:"voxket-video-info",children:[e.dimensions.width," × ",e.dimensions.height]})]}),i&&a.jsxs("div",{className:"voxket-video-controls-section",children:[a.jsx("h4",{className:"voxket-video-controls-title",children:"Screen Share"}),a.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isScreenShare?"voxket-control-btn--active":""}`,onClick:n,title:e!=null&&e.isScreenShare?"Stop screen sharing":"Start screen sharing",children:[a.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isScreenShare?"🛑":"🖥️"}),a.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isScreenShare?"Stop Sharing":"Share Screen"})]})]}),o&&a.jsxs("div",{className:"voxket-video-controls-section",children:[a.jsx("h4",{className:"voxket-video-controls-title",children:"Layout"}),a.jsx("div",{className:"voxket-layout-buttons",children:[{type:"grid",icon:"⊞",label:"Grid"},{type:"speaker",icon:"🎤",label:"Speaker"},{type:"sidebar",icon:"⫸",label:"Sidebar"},{type:"gallery",icon:"⊡",label:"Gallery"}].map(({type:u,icon:m,label:f})=>a.jsxs("button",{className:"voxket-layout-control-btn",onClick:()=>d(u),title:`Switch to ${f} layout`,children:[a.jsx("span",{className:"voxket-control-icon",children:m}),a.jsx("span",{className:"voxket-control-label",children:f})]},u))})]}),a.jsxs("div",{className:"voxket-video-controls-section",children:[a.jsx("h4",{className:"voxket-video-controls-title",children:"Video Settings"}),a.jsxs("div",{className:"voxket-video-settings",children:[a.jsxs("div",{className:"voxket-setting-group",children:[a.jsx("label",{className:"voxket-setting-label",children:"Quality"}),a.jsxs("select",{className:"voxket-setting-select",children:[a.jsx("option",{value:"high",children:"High (720p)"}),a.jsx("option",{value:"medium",children:"Medium (480p)"}),a.jsx("option",{value:"low",children:"Low (240p)"})]})]}),a.jsxs("div",{className:"voxket-setting-group",children:[a.jsx("label",{className:"voxket-setting-label",children:"Frame Rate"}),a.jsxs("select",{className:"voxket-setting-select",children:[a.jsx("option",{value:"30",children:"30 fps"}),a.jsx("option",{value:"15",children:"15 fps"}),a.jsx("option",{value:"10",children:"10 fps"})]})]}),a.jsxs("div",{className:"voxket-setting-group",children:[a.jsx("label",{className:"voxket-setting-label",children:"Bandwidth"}),a.jsxs("select",{className:"voxket-setting-select",children:[a.jsx("option",{value:"unlimited",children:"Unlimited"}),a.jsx("option",{value:"1000",children:"1 Mbps"}),a.jsx("option",{value:"500",children:"500 Kbps"}),a.jsx("option",{value:"250",children:"250 Kbps"})]})]})]})]}),a.jsxs("div",{className:"voxket-video-controls-section",children:[a.jsx("h4",{className:"voxket-video-controls-title",children:"Statistics"}),a.jsxs("div",{className:"voxket-video-stats",children:[a.jsxs("div",{className:"voxket-stat-item",children:[a.jsx("span",{className:"voxket-stat-label",children:"Resolution:"}),a.jsx("span",{className:"voxket-stat-value",children:e!=null&&e.dimensions?`${e.dimensions.width}×${e.dimensions.height}`:"N/A"})]}),a.jsxs("div",{className:"voxket-stat-item",children:[a.jsx("span",{className:"voxket-stat-label",children:"Source:"}),a.jsx("span",{className:"voxket-stat-value",children:(e==null?void 0:e.source)||"None"})]}),a.jsxs("div",{className:"voxket-stat-item",children:[a.jsx("span",{className:"voxket-stat-label",children:"Status:"}),a.jsx("span",{className:`voxket-stat-value ${e!=null&&e.isEnabled?"voxket-stat-value--active":"voxket-stat-value--inactive"}`,children:e!=null&&e.isEnabled?"Active":"Inactive"})]})]})]})]})}const nl=({handler:e,loadData:t,data:n,client:s,addLocalMessage:o})=>{const[r,i]=h.useState(null),[l,c]=h.useState(!0),[d,u]=h.useState(!1),[m]=h.useState(Date.now());h.useEffect(()=>{(async()=>{try{if(c(!0),console.log("📋 AssignmentView: Loading assignment data..."),console.log("📋 AssignmentView: Received data from RPC:",n),n&&typeof n=="object"){const v={title:n.title||"Untitled Assignment",description:n.description||"No description provided",estimated_time_of_completion:n.estimated_time_of_completion||"Unknown"};i(v),console.log("📋 AssignmentView: Assignment loaded from RPC data:",v)}}catch(v){console.error("📋 AssignmentView: Error loading assignment:",v),i({title:"Assignment Loading Error",description:"There was an error loading the assignment details. Please try again.",estimated_time_of_completion:"Unknown"})}finally{c(!1)}})()},[n,t]);const f=({message:x,assignment:v})=>{const E=x.toLowerCase().includes("declined"),b=E?"bg-red-50 border-red-200":"bg-green-50 border-green-200",S=E?"text-red-700":"text-green-700",w=E?"❌":"🎉";return a.jsxs("div",{className:`max-w-sm mx-auto ${b} border rounded-lg shadow p-3 flex flex-col items-center`,children:[a.jsx("div",{className:"text-2xl mb-2",children:w}),a.jsx("div",{className:`${S} font-semibold text-sm mb-1`,children:x}),a.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:v.title}),a.jsx("div",{className:"text-xs text-gray-500",children:"Thank you for your response!"})]})},g=async()=>{if(!(!r||!e)){u(!0);try{const x={message:"accepted"};console.log("📋 AssignmentView: Assignment accepted:",x),e.didSuccess(x,a.jsx(f,{message:"Assignment accepted!",assignment:r}))}catch(x){console.error("📋 AssignmentView: Error accepting assignment:",x),e.didFail({error:"Failed to accept assignment"})}finally{u(!1)}}},p=async()=>{if(!(!r||!e)){u(!0);try{const x={message:"declined"};console.log("📋 AssignmentView: Assignment declined:",x),e.didSuccess(x,a.jsx(f,{message:"Assignment declined",assignment:r}))}catch(x){console.error("📋 AssignmentView: Error declining assignment:",x),e.didFail({error:"Failed to decline assignment"})}finally{u(!1)}}};return l?a.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:a.jsxs("div",{className:"flex items-center justify-center py-4",children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}),a.jsx("span",{className:"ml-2 text-xs text-gray-600",children:"Loading assignment..."})]})}):r?a.jsxs("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg overflow-hidden",children:[a.jsx("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 text-white p-3",children:a.jsx("div",{className:"flex items-center justify-between",children:a.jsx("h3",{className:"text-xs font-semibold text-white truncate",children:r.title})})}),a.jsxs("div",{className:"p-3",children:[a.jsx("div",{className:"bg-gray-50 rounded p-2 mb-3",children:a.jsx("p",{className:"text-xs text-gray-700 leading-snug",children:r.description})}),a.jsx("div",{className:"mb-3",children:a.jsxs("div",{className:"flex items-center text-xs text-gray-600",children:[a.jsx("span",{className:"text-xs mr-1",children:"📅"}),a.jsxs("span",{children:["Est: ",r.estimated_time_of_completion]})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:g,disabled:d,className:"flex-1 bg-green-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:d?a.jsxs("span",{className:"flex items-center justify-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-2 w-2 border-b-2 border-white mr-1"}),a.jsx("span",{className:"text-xs",children:"Processing..."})]}):"Accept"}),a.jsx("button",{onClick:p,disabled:d,className:"flex-1 bg-red-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-red-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Decline"})]})]})]}):a.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:a.jsxs("div",{className:"text-center py-4",children:[a.jsx("div",{className:"text-red-600 text-sm font-semibold mb-2",children:"⚠️ Assignment Error"}),a.jsx("p",{className:"text-xs text-gray-600 mb-3",children:"Failed to load assignment details."})]})})};function I0(){const[e,t]=h.useState(null),[n,s]=h.useState([]);h.useEffect(()=>{const l=new _t({appId:"your-app-id",appSecret:"your-app-secret",baseUrl:"https://your-voxket-api.com",agentId:"your-agent-id",participantName:"User",modalities:["chat"]});return t(l),l.on("rpc.method.called",c=>{console.log("RPC Method Called:",c)}),l.on("rpc.interaction.completed",c=>{console.log("RPC Interaction Completed:",c)}),()=>{l.disconnect()}},[]);const o=async()=>{if(e)try{await e.registerFrontendRPC("give_assignment",nl,"embedded");const l=e.getRegisteredRpcMethods();s(l),console.log("✅ Assignment RPC registered successfully")}catch(l){console.error("❌ Failed to register assignment RPC:",l)}},r=async()=>{if(!e)return;const l=({handler:c,timeout:d})=>{const[u,m]=h.useState(""),f=[{id:"pro",name:"Pro Plan",price:"$29/month"},{id:"enterprise",name:"Enterprise Plan",price:"$99/month"},{id:"basic",name:"Basic Plan",price:"$9/month"}],g=x=>{m(x)},p=()=>{const x=f.find(v=>v.id===u);c==null||c.didSuccess({selectedProduct:u,productName:x==null?void 0:x.name,price:x==null?void 0:x.price,timestamp:new Date().toISOString()})};return a.jsxs("div",{className:"p-6 bg-white rounded-lg",children:[a.jsx("h3",{className:"text-xl font-bold mb-4",children:"Choose Your Plan"}),a.jsx("p",{className:"text-gray-600 mb-4",children:"Select the plan that best fits your needs:"}),a.jsx("div",{className:"space-y-3 mb-6",children:f.map(x=>a.jsx("div",{onClick:()=>g(x.id),className:`p-4 border rounded-lg cursor-pointer transition-all ${u===x.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,children:a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium",children:x.name}),a.jsx("p",{className:"text-gray-600 text-sm",children:x.price})]}),a.jsx("div",{className:`w-4 h-4 rounded-full ${u===x.id?"bg-blue-500":"border-2 border-gray-300"}`})]})},x.id))}),a.jsxs("div",{className:"flex justify-end space-x-3",children:[a.jsx("button",{onClick:()=>c==null?void 0:c.dismissView(),className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Cancel"}),a.jsx("button",{onClick:p,disabled:!u,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Select Plan"})]}),d&&a.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Time remaining: ",d," seconds"]})]})};try{await e.registerFrontendRPC("recommend_product",l,"modal");const c=e.getRegisteredRpcMethods();s(c),console.log("✅ Product Recommendation RPC registered successfully")}catch(c){console.error("❌ Failed to register product recommendation RPC:",c)}},i=async()=>{if(!e)return;const l=({handler:c})=>{const[d,u]=h.useState(0),[m,f]=h.useState(""),g=()=>{c==null||c.didSuccess({rating:d,comment:m,timestamp:new Date().toISOString()})};return a.jsxs("div",{className:"p-4 bg-white rounded-lg",children:[a.jsx("h3",{className:"text-lg font-semibold mb-3",children:"How was your experience?"}),a.jsxs("div",{className:"mb-4",children:[a.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Rate your experience:"}),a.jsx("div",{className:"flex space-x-1",children:[1,2,3,4,5].map(p=>a.jsx("button",{onClick:()=>u(p),className:`text-2xl ${p<=d?"text-yellow-400":"text-gray-300"}`,children:"⭐"},p))})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Additional comments:"}),a.jsx("textarea",{value:m,onChange:p=>f(p.target.value),className:"w-full p-2 border border-gray-300 rounded text-sm",rows:3,placeholder:"Tell us more about your experience..."})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx("button",{onClick:()=>c==null?void 0:c.dismissView(),className:"px-3 py-1 text-sm border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Skip"}),a.jsx("button",{onClick:g,disabled:d===0,className:"px-3 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Submit"})]})]})};try{await e.registerFrontendRPC("collect_feedback",l,"embedded");const c=e.getRegisteredRpcMethods();s(c),console.log("✅ Feedback RPC registered successfully")}catch(c){console.error("❌ Failed to register feedback RPC:",c)}};return a.jsxs("div",{className:"p-6",children:[a.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Frontend RPC Examples"}),a.jsxs("div",{className:"space-y-4 mb-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Register RPC Methods"}),a.jsxs("div",{className:"space-x-2",children:[a.jsx("button",{onClick:o,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Register Assignment RPC"}),a.jsx("button",{onClick:r,className:"px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600",children:"Register Product Recommendation RPC"}),a.jsx("button",{onClick:i,className:"px-4 py-2 bg-purple-500 text-white rounded hover:bg-purple-600",children:"Register Feedback RPC"})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Registered Methods"}),n.length>0?a.jsx("ul",{className:"list-disc list-inside space-y-1",children:n.map(l=>a.jsx("li",{className:"text-gray-700",children:a.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded",children:l})},l))}):a.jsx("p",{className:"text-gray-500",children:"No methods registered yet"})]})]}),a.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"How it works"}),a.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-sm text-gray-700",children:[a.jsxs("li",{children:["Register RPC methods with React components using ",a.jsx("code",{children:"client.registerFrontendRPC()"})]}),a.jsx("li",{children:"When the agent calls an RPC method, the corresponding component will be displayed"}),a.jsx("li",{children:"Users interact with the component, and the response is sent back to the agent"}),a.jsx("li",{children:"Components can be displayed in different modes: embedded, modal, or fullscreen"}),a.jsx("li",{children:"Each component has a timeout and can handle success/failure scenarios"})]})]}),a.jsxs("div",{className:"mt-6 bg-blue-50 p-4 rounded-lg",children:[a.jsx("h3",{className:"text-lg font-semibold mb-2 text-blue-800",children:"Agent Side"}),a.jsx("p",{className:"text-sm text-blue-700 mb-2",children:"On the agent side, you can call these RPC methods like this:"}),a.jsx("pre",{className:"bg-white p-3 rounded text-xs text-gray-800 overflow-x-auto",children:`// Agent calls RPC method
|
|
32
|
+
`,style:{minHeight:"2.5rem",display:i===s?"block":"none"},children:r},i))})}function Uf({statusMessage:e,theme:t}){const n=ye(t);return a.jsxs("div",{className:"z-10 flex items-center space-x-2 mt-2 pb-2",children:[a.jsx("div",{className:n.statusIndicator}),a.jsx("span",{className:`text-xs ${n.text.muted}`,children:e})]})}const zf=({disabled:e,onStartCall:t,onStartChat:n,onStartVideo:s,prompts:o=['"Book a meeting with the marketing team"',`"What's the status of project Alpha?"`,`"Summarize yesterday's sales report"`,'"Find a good Italian restaurant nearby"','"Remind me to call John tomorrow at 10 AM"'],statusMessage:r="Agent is ready",title:i="Choose how to interact",subTitle:l="Ask me anything or give me a task to complete",theme:c="vox",modalities:d=["voice","chat","video"]})=>{const u=ye(c),m=d.includes("voice"),f=d.includes("chat"),p=d.includes("video"),g=[m,f,p].filter(Boolean).length;return console.log("🎯 Welcome component debug:",{modalities:d,hasVoice:m,hasChat:f,hasVideo:p,totalButtons:g,onStartVideo:!!s}),a.jsxs("div",{inert:e,className:"flex p-8 flex-col items-center h-full justify-center w-full",children:[a.jsxs("div",{className:"mt-1 relative flex items-center justify-center mb-8 w-full",style:{minHeight:"120px"},children:[a.jsxs("div",{className:"absolute inset-0 flex items-center justify-center",children:[a.jsx("div",{className:u.pulseRings.ring1}),a.jsx("div",{className:u.pulseRings.ring2,style:{animationDelay:"0.5s"}}),a.jsx("div",{className:u.pulseRings.ring3,style:{animationDelay:"1s"}})]}),a.jsx("div",{className:"relative z-10 flex items-center justify-center",children:m&&f&&p?a.jsxs("div",{className:"flex gap-4 items-center justify-center",children:[a.jsx(Jt,{onClick:t,disabled:e,theme:c}),a.jsx(On,{onClick:n,disabled:e,theme:c}),a.jsx(_n,{onClick:s||t,disabled:e,theme:c})]}):g>1?a.jsxs("div",{className:"flex gap-6 items-center justify-center",children:[m&&a.jsx(Jt,{onClick:t,disabled:e,theme:c}),f&&a.jsx(On,{onClick:n,disabled:e,theme:c}),p&&s&&a.jsx(_n,{onClick:s,disabled:e,theme:c})]}):a.jsx("div",{className:"flex items-center justify-center",children:m?a.jsx(Jt,{onClick:t,disabled:e,theme:c}):f?a.jsx(On,{onClick:n,disabled:e,theme:c}):p&&s?a.jsx(_n,{onClick:s,disabled:e,theme:c}):a.jsx(Jt,{onClick:t,disabled:e,theme:c})})})]}),a.jsxs("div",{className:"text-center flex flex-col items-center gap-y-2 mb-6 w-full",children:[a.jsx("h3",{className:`text-xl font-semibold mb-2 ${u.text.accent}`,children:i}),a.jsx("p",{className:`text-sm leading-relaxed px-4 ${u.text.secondary}`,children:l}),g>1&&a.jsxs("div",{className:"flex gap-6 mt-4 text-xs justify-center",children:[m&&a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx(Be.Mic,{className:"w-4 h-4"}),a.jsx("span",{className:u.text.muted,children:"Voice"})]}),f&&a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx(Be.Chat,{className:"w-4 h-4"}),a.jsx("span",{className:u.text.muted,children:"Chat"})]}),p&&a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx(Be.Videocam,{className:"w-4 h-4"}),a.jsx("span",{className:u.text.muted,children:"Video"})]})]})]}),a.jsx(Zf,{prompts:o,theme:c}),a.jsx(Uf,{statusMessage:r,theme:c})]})};function Fa({room:e,onSessionEnd:t,onSessionStart:n,enableConsoleLogging:s=!0,enableLocalStorage:o=!0,voxketSessionId:r}={}){const[i,l]=h.useState(null),[c,d]=h.useState([]),[u,m]=h.useState(null),[f,p]=h.useState([]),g=h.useCallback((b,S)=>{const w={timestamp:new Date,event:b,data:S,sessionId:i==null?void 0:i.sessionId,participantId:u==null?void 0:u.identity};if(d(C=>[...C,w]),o){const C=JSON.parse(localStorage.getItem("voxket-session-logs")||"[]");C.push(w),localStorage.setItem("voxket-session-logs",JSON.stringify(C))}return w},[i==null?void 0:i.sessionId,u==null?void 0:u.identity,s,o]);h.useEffect(()=>{if(!e)return;const b=()=>{const L=r||`session-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,W=new Date,H={sessionId:L,startTime:W,totalMessages:0,connectionIssues:0,participantCount:f.length,events:[]};l(H),g("SESSION_STARTED",{sessionId:L,startTime:W}),n==null||n(L)},S=()=>{if(i){const L=new Date,W=L.getTime()-i.startTime.getTime(),H={...i,endTime:L,duration:W,events:c};g("SESSION_ENDED",{sessionId:i.sessionId,duration:`${Math.round(W/1e3)}s`,totalMessages:i.totalMessages,connectionIssues:i.connectionIssues}),t==null||t(H),l(null),d([])}},w=L=>{g("CONNECTION_STATE_CHANGED",{state:L}),L===I.ConnectionState.Reconnecting&&i&&(l(W=>W?{...W,connectionIssues:W.connectionIssues+1}:null),g("CONNECTION_ISSUE",{type:"reconnecting"}))},C=L=>{g("TRACK_PUBLISHED",{trackKind:L.kind,trackSource:L.source})},A=L=>{g("TRACK_UNPUBLISHED",{trackKind:L.kind,trackSource:L.source})},j=(L,W)=>{i&&l(H=>H?{...H,totalMessages:H.totalMessages+1}:null),g("DATA_RECEIVED",{participantId:W==null?void 0:W.identity,dataSize:L.length})},k=L=>{g("PARTICIPANT_CONNECTED",{participantId:L.identity,participantName:L.name}),p(W=>[...W,L]),i&&l(W=>W?{...W,participantCount:W.participantCount+1}:null)},D=L=>{g("PARTICIPANT_DISCONNECTED",{participantId:L.identity,participantName:L.name}),p(W=>W.filter(H=>H.identity!==L.identity))};return e.localParticipant&&m(e.localParticipant),e.on(I.RoomEvent.Connected,b),e.on(I.RoomEvent.Disconnected,S),e.on(I.RoomEvent.ConnectionStateChanged,w),e.on(I.RoomEvent.TrackPublished,C),e.on(I.RoomEvent.TrackUnpublished,A),e.on(I.RoomEvent.DataReceived,j),e.on(I.RoomEvent.ParticipantConnected,k),e.on(I.RoomEvent.ParticipantDisconnected,D),()=>{e.off(I.RoomEvent.Connected,b),e.off(I.RoomEvent.Disconnected,S),e.off(I.RoomEvent.ConnectionStateChanged,w),e.off(I.RoomEvent.TrackPublished,C),e.off(I.RoomEvent.TrackUnpublished,A),e.off(I.RoomEvent.DataReceived,j),e.off(I.RoomEvent.ParticipantConnected,k),e.off(I.RoomEvent.ParticipantDisconnected,D)}},[e,i,c,f.length,g,t,n]);const x=h.useCallback(()=>o?JSON.parse(localStorage.getItem("voxket-session-logs")||"[]"):c,[c,o]),v=h.useCallback(()=>{o&&localStorage.removeItem("voxket-session-logs"),d([])},[o]),E=h.useCallback(()=>{const b=x(),S=JSON.stringify(b,null,2),w="data:application/json;charset=utf-8,"+encodeURIComponent(S),C=`voxket-session-logs-${new Date().toISOString().split("T")[0]}.json`,A=document.createElement("a");A.setAttribute("href",w),A.setAttribute("download",C),A.click()},[x]);return{sessionMetrics:i,sessionLogs:c,logEvent:g,getSessionLogs:x,clearSessionLogs:v,exportSessionLogs:E}}class Qs{constructor(){me(this,"listeners",{})}on(t,n){return this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(n),()=>this.off(t,n)}once(t,n){const s=(...o)=>{this.off(t,s),n(...o)};return this.on(t,s)}off(t,n){const s=this.listeners[t];if(!s)return;const o=s.indexOf(n);o>-1&&s.splice(o,1)}removeAllListeners(t){t?delete this.listeners[t]:this.listeners={}}emit(t,...n){const s=this.listeners[t];if(!s)return;const o=[...s];for(const r of o)try{r(...n)}catch(i){console.error(`Error in event listener for ${String(t)}:`,i)}}listenerCount(t){var n;return((n=this.listeners[t])==null?void 0:n.length)??0}eventNames(){return Object.keys(this.listeners)}}class La{constructor(t){me(this,"plugins",new Map);me(this,"installedPlugins",new Set);me(this,"context");this.context={client:t,emit:t.emit.bind(t),on:t.on.bind(t),config:{}}}register(t){if(this.plugins.has(t.name))throw new Error(`Plugin '${t.name}' is already registered`);if(t.dependencies){for(const n of t.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin '${t.name}' depends on '${n}' which is not registered`)}this.plugins.set(t.name,t)}async install(t,n){const s=this.plugins.get(t);if(!s)throw new Error(`Plugin '${t}' is not registered`);if(this.installedPlugins.has(t))throw new Error(`Plugin '${t}' is already installed`);if(s.dependencies)for(const r of s.dependencies)this.installedPlugins.has(r)||await this.install(r);const o={...this.context,config:{...s.config,...n}};s.install&&await s.install(o),this.installedPlugins.add(t),this.setupPluginEvents(s,o)}async uninstall(t){var s;const n=this.plugins.get(t);if(!n)throw new Error(`Plugin '${t}' is not registered`);if(this.installedPlugins.has(t)){for(const[o,r]of this.plugins)if(this.installedPlugins.has(o)&&((s=r.dependencies)!=null&&s.includes(t)))throw new Error(`Cannot uninstall '${t}' because '${o}' depends on it`);n.uninstall&&await n.uninstall(this.context),this.installedPlugins.delete(t)}}isInstalled(t){return this.installedPlugins.has(t)}getInstalledPlugins(){return Array.from(this.installedPlugins)}getAvailablePlugins(){return Array.from(this.plugins.keys())}getPluginInfo(t){return this.plugins.get(t)}setupPluginEvents(t,n){t.onSessionStart&&n.on("session.started",s=>{t.onSessionStart(n,s.id)}),t.onSessionEnd&&n.on("session.ended",s=>{t.onSessionEnd(n,s.id)}),t.onAgentResponse&&n.on("agent.response",s=>{t.onAgentResponse(n,s)})}}function Wf(e){return e}function eo(e,t,n){return{name:e,version:"1.0.0",description:`${t} modality plugin`,install:async s=>{n.onActivate&&await n.onActivate(s)},uninstall:async s=>{n.onDeactivate&&await n.onDeactivate(s)},onAgentResponse:n.onMessage}}const Kf={name:"analytics",version:"1.0.0",description:"Built-in analytics tracking",install:async e=>{console.log("Analytics plugin installed"),e.on("session.started",t=>{console.log("Analytics: Session started",t.id)}),e.on("session.ended",(t,n)=>{console.log("Analytics: Session ended",t.id,n)}),e.on("chat.message.sent",t=>{console.log("Analytics: User message sent",t.content.length)})}},Gf={name:"debug",version:"1.0.0",description:"Debug logging and development tools",install:async e=>{console.log("Debug plugin installed");const t=e.emit;e.emit=(n,...s)=>(console.log(`[Debug] Event: ${String(n)}`,s),t(n,...s))}},Yf={name:"metrics",version:"1.0.0",description:"Advanced metrics collection",install:async e=>{console.log("Metrics plugin installed");const t=new Map;e.on("session.started",n=>{t.set(n.id,{startTime:Date.now(),events:[]})}),e.on("agent.response",n=>{console.log("Metrics: Agent response analyzed",{type:n.type,length:n.content.length,timestamp:n.timestamp})})}},Ba=y.createContext(null);function $a({config:e,children:t,autoConnect:n=!1}){const[s,o]=y.useState(null),[r,i]=y.useState(!1),[l,c]=y.useState(!1),[d,u]=y.useState(null),[m,f]=y.useState(null),[p,g]=y.useState("idle"),[x,v]=y.useState(null),[E,b]=y.useState([]),[S,w]=y.useState([]),[C,A]=y.useState([]);y.useEffect(()=>{const M=new _t(e);return o(M),j(M),n&&k(M),()=>{M.disconnect().catch(console.error)}},[e,n]);const j=M=>{M.on("connection.connecting",()=>{c(!0),u(null)}),M.on("connection.connected",()=>{i(!0),c(!1),u(null)}),M.on("connection.disconnected",()=>{i(!1),c(!1),f(null),g("idle"),b([]),w([]),A([])}),M.on("connection.error",G=>{u(G),c(!1)}),M.on("session.created",G=>{f(G),g(G.state)}),M.on("session.state.changed",G=>{g(G),m&&f({...m,state:G})}),M.on("session.ended",(G,Y)=>{f(null),g("idle"),v(Y),b([]),w([]),A([])}),M.on("participant.joined",G=>{b(Y=>[...Y,G])}),M.on("participant.left",G=>{b(Y=>Y.filter(V=>V.id!==G.id))}),M.on("chat.message.received",G=>{w(Y=>[...Y,G])}),M.on("chat.message.sent",G=>{w(Y=>[...Y,G])}),M.on("transcription.received",G=>{A(Y=>[...Y,G])})},k=async M=>{const G=M||s;if(G)try{await G.connect()}catch(Y){console.error("Failed to connect:",Y)}},z={client:s,isConnected:r,isConnecting:l,connectionError:d,currentSession:m,sessionState:p,sessionMetrics:x,participants:E,chatMessages:S,transcriptions:C,connect:()=>k(),disconnect:async()=>{if(s)try{await s.disconnect()}catch(M){console.error("Failed to disconnect:",M)}},createSession:async(M,G={})=>{if(!s)throw new Error("Client not initialized");const Y={agentId:M,participantName:G.participantName||"User",metadata:G.metadata,modalities:G.modalities||["voice"]};return await s.createSession(Y)},endSession:async()=>s?await s.endSession():null,sendChatMessage:async M=>{if(!s)throw new Error("Client not initialized");await s.sendChatMessage(M)},setMicrophoneEnabled:async M=>{if(!s)throw new Error("Client not initialized");await s.setMicrophoneEnabled(M)},setCameraEnabled:async M=>{if(!s)throw new Error("Client not initialized");await s.setCameraEnabled(M)},startScreenShare:async()=>{if(!s)throw new Error("Client not initialized");await s.startScreenShare()},stopScreenShare:async()=>{if(!s)throw new Error("Client not initialized");await s.stopScreenShare()}};return a.jsx(Ba.Provider,{value:z,children:t})}function Ie(){const e=y.useContext(Ba);if(!e)throw new Error("useVoxket must be used within a VoxketProvider");return e}class qf extends Qs{constructor(n){super();me(this,"room",null);me(this,"registeredMethods",new Map);me(this,"activeInteractions",new Map);me(this,"currentInteraction",null);n&&this.setRoom(n)}setRoom(n){this.room=n}async registerFrontendRPC(n,s,o="embedded"){if(console.log(`RpcManager: Starting registration for method '${n}'`),!this.room)throw console.error(`RpcManager: Cannot register '${n}' - no room instance`),new Error("Room not initialized. Cannot register RPC method.");if(!this.room.localParticipant)throw console.error(`RpcManager: Cannot register '${n}' - no local participant`),new Error("Local participant not available for RPC registration");console.log(`RpcManager: Room state: ${this.room.state}`),console.log(`RpcManager: Local participant: ${this.room.localParticipant.identity}`),console.log(`RpcManager: Registering frontend RPC method: ${n}`);const r={methodName:n,component:s,presentationMode:o};this.registeredMethods.set(n,r);try{this.room.registerRpcMethod(n,async i=>{console.log(`RpcManager: RPC method '${n}' called by ${i.callerIdentity}`),console.log("RpcManager: Payload:",i.payload),this.emit("rpc.method.called",{methodName:n,data:i});let l;console.log(`RpcManager: Current registration for '${n}':`,r);let c=i.responseTimeout||30;try{l=JSON.parse(i.payload)}catch{l=i.payload}try{const d=await this.awaitUserInteraction(n,s,o,l,c);return JSON.stringify(d)}catch(d){throw console.error(`RpcManager: Error in RPC method '${n}':`,d),d}}),this.emit("rpc.method.registered",{methodName:n}),console.log(`RpcManager: Successfully registered RPC method: ${n}`)}catch(i){throw console.error(`RpcManager: Failed to register RPC method '${n}':`,i),i}}async awaitUserInteraction(n,s,o,r,i){return new Promise((l,c)=>{const d=`${n}_${Date.now()}`;console.log(`RpcManager: Starting user interaction for method: ${n}, timeout: ${i} seconds`);const u={didSuccess:(f,p)=>{console.log(`RpcManager: User interaction successful for method: ${n}`,f),this.clearInteraction(d),this.currentInteraction=null;const g={success:!0,message:"User interaction completed successfully",data:f,timestamp:new Date,...p?{successView:p}:{}};this.emit("rpc.interaction.completed",{methodName:n,response:g}),l(g)},didFail:f=>{console.log(`RpcManager: User interaction failed for method: ${n}`,f),this.clearInteraction(d);const p={success:!1,message:"User interaction failed",error:f,timestamp:new Date};this.emit("rpc.interaction.completed",{methodName:n,response:p}),l(p)},dismissView:()=>{var p;console.log(`RpcManager: User dismissed interaction for method: ${n}`),console.log("RpcManager: Current interaction before dismiss:",(p=this.currentInteraction)==null?void 0:p.methodName),this.clearInteraction(d),this.currentInteraction=null,console.log("RpcManager: Current interaction after dismiss:",this.currentInteraction);const f={success:!0,data:{dismissed:!0,reason:"User dismissed the interaction"},message:"User interaction dismissed",timestamp:new Date};this.emit("rpc.interaction.dismissed",{methodName:n,response:f}),this.emit("rpc.interaction.completed",{methodName:n,response:f}),setTimeout(()=>{var g;((g=this.currentInteraction)==null?void 0:g.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),l(f)},didTimeout:f=>{console.log(`RpcManager: User interaction timeout for method: ${n}`),this.clearInteraction(d),this.currentInteraction=null;const p={success:!0,message:`User interaction timed out after ${i} seconds, it should be considered as declined, agent don't need to retry`,timestamp:new Date,...f?{timeoutView:f}:{}};this.emit("rpc.interaction.timeout",{methodName:n,response:p}),setTimeout(()=>{var g;((g=this.currentInteraction)==null?void 0:g.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),l(p)}},m=setTimeout(()=>{u.didTimeout&&u.didTimeout()},i);this.activeInteractions.set(d,{resolve:f=>l(JSON.parse(f)),reject:c,timeoutId:m}),this.currentInteraction={isVisible:!0,methodName:n,component:s,presentationMode:o,timeout:i,data:r,handler:u},this.emit("rpc.interaction.started",{methodName:n,presentationMode:o}),setTimeout(async()=>{var f;if((f=this.currentInteraction)!=null&&f.handler)try{console.log(`RpcManager: Component created for method: ${n} with data:`,r)}catch(p){console.error("RpcManager: Error loading data into component:",p),u.didFail({error:"Failed to load data into component"})}},100)})}clearInteraction(n){const s=this.activeInteractions.get(n);s&&(console.log(`RpcManager: Clearing interaction: ${n}`),clearTimeout(s.timeoutId),this.activeInteractions.delete(n))}getCurrentInteraction(){return this.currentInteraction}dismissCurrentInteraction(){var n;this.currentInteraction&&(console.log(`RpcManager: Dismissing current interaction: ${this.currentInteraction.methodName}`),(n=this.currentInteraction.handler)==null||n.dismissView(),setTimeout(()=>{this.currentInteraction&&(console.log("RpcManager: Force clearing lingering interaction"),this.currentInteraction=null)},0))}getRegisteredMethods(){return Array.from(this.registeredMethods.keys())}unregisterMethod(n){this.registeredMethods.delete(n),console.log(`RpcManager: Unregistered RPC method: ${n}`)}clear(){for(const[n,s]of this.activeInteractions)clearTimeout(s.timeoutId);this.activeInteractions.clear(),this.registeredMethods.clear(),this.currentInteraction=null,console.log("RpcManager: Cleared all registrations and interactions")}}class ee extends Error{constructor(t,n,s){super(t),this.code=n,this.details=s,this.name="VoxketError"}}class _t extends Qs{constructor(n){super();me(this,"config");me(this,"room",null);me(this,"pluginManager");me(this,"rpcManager");me(this,"isConnected",!1);me(this,"currentSession",null);me(this,"connectionState",I.ConnectionState.Disconnected);me(this,"renderedComponents",new Map);me(this,"textStreamHandlersRegistered",!1);me(this,"currentAgentInfo",null);me(this,"chatMessages",[]);this.config=n,this.pluginManager=new La(this),this.rpcManager=new qf,this.setupEventListeners(),this.initializeClient()}setupEventListeners(){this.on("connection.connected",()=>{var n,s;this.isConnected=!0,(s=(n=this.config).onConnected)==null||s.call(n)}),this.on("connection.disconnected",n=>{var s,o;this.isConnected=!1,(o=(s=this.config).onDisconnected)==null||o.call(s,n)}),this.on("connection.error",n=>{var s,o;(o=(s=this.config).onError)==null||o.call(s,n)}),this.on("chat.message.received",n=>{var s,o;this.addChatMessage(n),(o=(s=this.config).onMessageReceived)==null||o.call(s,n)}),this.on("chat.message.updated",n=>{this.updateChatMessage(n)}),this.on("chat.message.sent",n=>{this.addChatMessage(n)}),this.on("transcription.received",n=>{var s,o;(o=(s=this.config).onTranscriptionReceived)==null||o.call(s,n)}),this.on("session.state.changed",n=>{var s,o;(o=(s=this.config).onSessionStateChanged)==null||o.call(s,n)}),this.on("session.created",n=>{var s,o;(o=(s=this.config).onSessionStart)==null||o.call(s,n.id)}),this.on("session.ended",(n,s)=>{var o,r;(r=(o=this.config).onSessionEnd)==null||r.call(o,s)}),this.on("participant.joined",n=>{var s,o;(o=(s=this.config).onUserJoined)==null||o.call(s,n.id)}),this.on("participant.left",n=>{var s,o;(o=(s=this.config).onUserLeft)==null||o.call(s,n.id)}),this.setupRpcEventForwarding()}setupRpcEventForwarding(){if(!this.rpcManager){console.warn("RpcManager not initialized, skipping event forwarding setup");return}this.rpcManager.on("rpc.method.registered",n=>this.emit("rpc.method.registered",n)),this.rpcManager.on("rpc.method.called",n=>this.emit("rpc.method.called",n)),this.rpcManager.on("rpc.interaction.started",n=>this.emit("rpc.interaction.started",n)),this.rpcManager.on("rpc.interaction.completed",n=>this.emit("rpc.interaction.completed",n)),this.rpcManager.on("rpc.interaction.timeout",n=>this.emit("rpc.interaction.timeout",n)),this.rpcManager.on("rpc.interaction.dismissed",n=>this.emit("rpc.interaction.dismissed",n))}initializeClient(){this.room=new I.Room,this.setupRoomEventListeners()}setupRoomEventListeners(){this.room&&(this.room.on(I.RoomEvent.Connected,()=>{var n,s;this.connectionState=I.ConnectionState.Connected,this.emit("connection.connected"),this.rpcManager.setRoom(this.room),(s=(n=this.currentSession)==null?void 0:n.activeModalities)!=null&&s.includes("voice")&&setTimeout(async()=>{var o;try{(o=this.room)!=null&&o.localParticipant&&(this.room.localParticipant.isMicrophoneEnabled?this.emit("track.unmuted",{source:"microphone",enabled:!0}):(await this.room.localParticipant.setMicrophoneEnabled(!0),this.emit("track.unmuted",{source:"microphone",enabled:!0})))}catch(r){console.warn("VoxketClient: Failed to enable microphone after room connection:",r)}},1e3),this.textStreamHandlersRegistered||this.setupTextStreamHandlers()}),this.room.on(I.RoomEvent.Disconnected,n=>{this.connectionState=I.ConnectionState.Disconnected,this.textStreamHandlersRegistered=!1,this.emit("connection.disconnected",n==null?void 0:n.toString())}),this.room.on(I.RoomEvent.ConnectionStateChanged,n=>{this.connectionState=n,n===I.ConnectionState.Connecting&&this.emit("connection.connecting")}),this.room.on(I.RoomEvent.ParticipantConnected,n=>{const s={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.joined",s)}),this.room.on(I.RoomEvent.ParticipantDisconnected,n=>{const s={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.left",s)}))}setupTextStreamHandlers(){if(this.room){try{this.room.registerTextStreamHandler("lk.chat",async(n,s)=>{try{const o=await n.readAll(),r={id:`msg_${Date.now()}_${s.identity||"user"}_${Math.random().toString(36).substr(2,9)}`,content:o,timestamp:new Date,sender:{id:s.identity||"user",name:s.identity||"User",type:"participant"},metadata:{topic:"lk.chat"}};this.emit("chat.message.received",r)}catch(o){console.error("VoxketClient: Failed to process lk.chat message:",o)}})}catch(n){console.warn("VoxketClient: lk.chat handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("lk.transcription",async(n,s)=>{var o,r;try{const i=`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`;let l="";const c=((o=this.currentAgentInfo)==null?void 0:o.name)||s.identity||"AI Assistant",d={id:i,content:"",timestamp:new Date,sender:{id:s.identity||"agent",name:c,type:"agent"},metadata:{topic:"lk.transcription",streaming:!0}};this.emit("chat.message.received",d);for await(const f of n){l+=f;const p=this.convertMarkdownToText(l),g={...d,content:p,metadata:{...d.metadata,streaming:!0}};this.emit("chat.message.updated",g)}const u=this.convertMarkdownToText(l),m={...d,content:u,metadata:{...d.metadata,streaming:!1}};this.emit("chat.message.updated",m)}catch(i){console.error("VoxketClient: Failed to process lk.transcription message:",i);try{const l=await n.readAll(),c=((r=this.currentAgentInfo)==null?void 0:r.name)||s.identity||"AI Assistant",d={id:`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`,content:l,timestamp:new Date,sender:{id:s.identity||"agent",name:c,type:"agent"},metadata:{topic:"lk.transcription"}};this.emit("chat.message.received",d)}catch(l){console.error("VoxketClient: Fallback failed for lk.transcription:",l)}}})}catch(n){console.warn("VoxketClient: lk.transcription handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("suggested_response",async n=>{const s=await n.readAll();let o=[];try{o=["tes","hello how are you","algebra make me learn that ","what is the meaning of life"]}catch(r){console.warn("VoxketClient: Failed to parse suggested_response:",r,s)}this.emit("suggested.response",o)})}catch(n){console.warn("VoxketClient: suggested_response handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("agent_state_changed",async(n,s)=>{const o=await n.readAll();let r={};try{r=typeof o=="string"?JSON.parse(o.replace(/'/g,'"')):o}catch(i){console.warn("VoxketClient: Failed to parse agent_state_changed:",i,o)}r.new_state==="speaking"?this.emit("agent.speaking",r):r.new_state==="thinking"&&this.emit("agent.thinking",r)})}catch(n){console.warn("VoxketClient: conversation_item_added handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("images",async(n,s)=>{try{const o=await n.readAll()}catch(o){console.error("VoxketClient: Error processing images stream:",o)}})}catch(n){console.warn("VoxketClient: images handler already registered, skipping:",n)}try{this.room.registerByteStreamHandler("images",async(n,s)=>{var o,r;try{const i=n.info,l={id:`img_${Date.now()}_${s.identity||"agent"}_${Math.random().toString(36).substr(2,9)}`,content:`�️ ${i.name||"Image"}`,sender:{id:s.identity||"agent",name:s.identity||"Agent",type:s.identity===((r=(o=this.room)==null?void 0:o.localParticipant)==null?void 0:r.identity)?"participant":"agent"},timestamp:new Date,metadata:{type:"attachment",fileName:i.name,fileSize:i.size,mimeType:i.mimeType,streamId:i.id,downloading:!0}};this.emit("chat.message.received",l),n.onProgress&&(n.onProgress=f=>{const p={...l,metadata:{...l.metadata,downloadProgress:f||0}};this.emit("chat.message.updated",p)});const c=[];for await(const f of n)c.push(f);const d=new Blob(c,{type:i.mimeType||"application/octet-stream"}),u=URL.createObjectURL(d),m={...l,metadata:{...l.metadata,downloading:!1,downloadProgress:1,downloadUrl:u,blob:d}};this.emit("chat.message.updated",m)}catch(i){console.error("VoxketClient: Error processing image attachment:",i)}})}catch(n){console.warn("VoxketClient: image handler already registered, skipping:",n)}this.textStreamHandlersRegistered=!0}}async fetchConnectionDetails(n,s,o){const r=n||this.config.agentId||"default-agent",i=s||this.config.participantName||"User",l=o||this.config.modalities||["voice"];try{const c={agent_id:r,participant_name:i,participant_metadata:{user_id:""},modality:l[0]},d=await fetch(`${this.config.baseUrl}/api/live/agent/session`,{method:"POST",headers:{accept:"application/json","X-APP-ID":this.config.appId,"X-APP-SECRET":this.config.appSecret,"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok){let f=`HTTP ${d.status}: Failed to fetch connection details`;try{const p=await d.json();p&&(p.error?f=`API Error: ${p.error}`:p.detail?f=`API Error: ${p.detail}`:p.message&&(f=`API Error: ${p.message}`))}catch{try{const g=await d.text();g&&(f=`API Error: ${g}`)}catch{}}throw new Error(f)}const u=await d.json();let m;return u.agent_info&&(m={id:u.agent_info.id||r,name:u.agent_info.name||"AI Assistant",avatar:u.agent_info.avatar,capabilities:u.agent_info.capabilities||["voice_interaction","text_chat"],metadata:u.agent_info.metadata||{}},this.currentAgentInfo=m),{serverUrl:u.wss_url,participantToken:u.token,voxketSessionId:u.session_id,agentInfo:m}}catch(c){console.error("VoxketClient: fetchConnectionDetails failed:",c);const d=new ee(`Failed to fetch connection details: ${c instanceof Error?c.message:"Unknown error"}`,"CONNECTION_FAILED",c);throw this.emit("connection.error",d),d}}async connect(n,s,o){var r;try{this.emit("connection.connecting");const i=await this.fetchConnectionDetails(n,s,o);return await((r=this.room)==null?void 0:r.connect(i.serverUrl,i.participantToken)),this.isConnected=!0,i}catch(i){console.error("VoxketClient: Connection failed:",i);const l=new ee(`Failed to connect to Voxket services: ${i instanceof Error?i.message:"Unknown error"}`,"CONNECTION_FAILED",i);throw this.emit("connection.error",l),l}}async disconnect(){var n;try{await((n=this.room)==null?void 0:n.disconnect()),this.isConnected=!1,this.currentSession=null,this.currentAgentInfo=null,this.textStreamHandlersRegistered=!1,this.clearChatMessages(),this.room=new I.Room,this.setupRoomEventListeners()}catch(s){const o=new ee("Failed to disconnect properly","NETWORK_ERROR",s);throw this.emit("connection.error",o),o}}async createSession(n){var s,o;try{const r=await this.connect(n.agentId,n.participantName,n.modalities),i={id:r.voxketSessionId,agentId:n.agentId,state:"connecting",startedAt:new Date,metadata:n.metadata||{},activeModalities:n.modalities||["voice"],agentInfo:r.agentInfo||this.currentAgentInfo};if(this.currentSession=i,this.emit("session.created",i),(s=n.modalities)!=null&&s.includes("voice"))try{await new Promise(l=>setTimeout(l,500)),(o=this.room)!=null&&o.localParticipant?(await this.room.localParticipant.setMicrophoneEnabled(!0,void 0,{preConnectBuffer:!0}),this.emit("track.unmuted",{source:"microphone",enabled:!0})):console.warn("VoxketClient: No local participant found, microphone not enabled")}catch(l){console.warn("VoxketClient: Failed to enable microphone, but continuing with session:",l)}return setTimeout(()=>{this.currentSession&&(this.currentSession.state="active",this.emit("session.state.changed","active",this.currentSession.state))},1e3),i}catch(r){throw console.error("VoxketClient: Failed to create session:",r),r instanceof ee?r:r instanceof TypeError&&r.message.includes("fetch")?new ee("Network connection failed","CONNECTION_FAILED",r):r instanceof Error&&r.message.includes("Failed to fetch connection details")?new ee(`API connection failed: ${r.message}`,"CONNECTION_FAILED",r):new ee(`Failed to create session: ${r instanceof Error?r.message:"Unknown error"}`,"SESSION_NOT_FOUND",r)}}async startSession(n,s){const o={agentId:n||this.config.agentId||"default-agent",participantName:(s==null?void 0:s.participantName)||this.config.participantName||"User",modalities:(s==null?void 0:s.modalities)||this.config.modalities||["voice","chat"],metadata:s==null?void 0:s.metadata};return this.createSession(o)}async endSession(){var n,s;if(!this.currentSession)return null;try{const o={sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((s=this.room)==null?void 0:s.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]};return this.currentSession.endedAt=new Date,this.currentSession.state="disconnected",this.emit("session.ended",this.currentSession,o),await this.disconnect(),o}catch(o){throw new ee("Failed to end session","SESSION_NOT_FOUND",o)}}getCurrentSession(){return this.currentSession}getCurrentAgentInfo(){return this.currentAgentInfo}getChatMessages(){return[...this.chatMessages]}addChatMessage(n){this.chatMessages.some(o=>o.id===n.id)||this.chatMessages.push(n)}updateChatMessage(n){const s=this.chatMessages.findIndex(o=>o.id===n.id);s!==-1&&(this.chatMessages[s]=n)}clearChatMessages(){this.chatMessages=[],this.dismissCurrentInteraction(),this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays(),this.emit("chat.history.cleared")}renderUI(n={}){var c,d,u;const s=this.resolveTarget(n.target||"body"),o=this.getTargetKey(s),r=this.renderedComponents.get(o);r&&r.target===s||this.removeUI(s);const i=(r==null?void 0:r.root)||hl.createRoot(s),l={agentId:n.agentId||this.config.agentId||"default-agent",participantName:n.participantName||this.config.participantName||"User",baseUrl:this.config.baseUrl,appSecret:this.config.appSecret,appId:this.config.appId,className:n.className,theme:typeof n.theme=="string"?n.theme:void 0,modalities:n.modality||this.config.modalities||["voice"],suportsChatInput:((c=n.modality)==null?void 0:c.includes("chat"))!==!1,suportsVideoInput:((d=n.modality)==null?void 0:d.includes("video"))===!0,suportsScreenShare:((u=n.modality)==null?void 0:u.includes("screen_share"))===!0,autoStart:n.autoStart,displayType:n.displayType||"widget",popupPosition:n.popupPosition||"bottom-right",popupTriggerText:n.popupTriggerText||"Open Chat",width:n.width,height:n.height,onDisplayTypeChange:n.onDisplayTypeChange,prompts:n.prompts,statusMessage:n.statusMessage,welcomeTitle:n.welcomeTitle,welcomeSubTitle:n.welcomeSubTitle,loadingText:n.loadingText,voxketClient:this};if(!i||typeof i.render!="function")throw new Error("Invalid React root. Make sure React 18+ is properly installed and configured.");try{i.render(y.createElement($a,{config:this.config,autoConnect:n.autoStart||!1,children:y.createElement(Oa,l)}))}catch(m){throw console.error("Error rendering Voxket widget:",m),new Error(`Failed to render Voxket widget: ${m instanceof Error?m.message:"Unknown error"}`)}this.renderedComponents.set(o,{root:i,target:s})}removeUI(n){const s=n?this.resolveTarget(n):null;if(s){const o=this.getTargetKey(s),r=this.renderedComponents.get(o);r&&(r.root.unmount(),this.renderedComponents.delete(o),s.querySelectorAll('[id*="voxket"], [class*="voxket"], .fixed.inset-0.z-50').forEach(l=>{try{l.remove()}catch(c){console.warn("Failed to remove element:",c)}}),s===document.body&&s.querySelectorAll(".fixed.z-50, .fixed.inset-0").forEach(c=>{if(c.classList.contains("bg-black")&&c.classList.contains("backdrop-blur-sm"))try{c.remove()}catch(d){console.warn("Failed to remove fixed element:",d)}}))}}removeAllUI(){for(const[n,s]of this.renderedComponents)s.root.unmount();this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays()}forceCleanupFullscreenOverlays(){document.body.querySelectorAll(".fixed.inset-0.z-50").forEach(s=>{if(s.classList.contains("bg-black")&&(s.classList.contains("backdrop-blur-sm")||s.classList.contains("bg-opacity-30")))try{s.remove()}catch(o){console.warn("Failed to remove overlay:",o)}})}resolveTarget(n){if(typeof n=="string"){const s=document.querySelector(n);if(!s)throw new Error(`Target element not found: ${n}`);return s}return n}getTargetKey(n){return n.id?n.id:n.className?n.tagName+"_"+n.className.replace(/\s+/g,"_"):n.tagName+"_"+n.outerHTML.length%1e3}async sendMessage(n,s){var o;if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new ee("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new ee("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new ee("No local participant","CONNECTION_FAILED");this.dismissCurrentInteraction();try{const r={id:`msg_${Date.now()}`,content:n,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:s||{}},i=await((o=this.room)==null?void 0:o.localParticipant.sendText(n,{topic:"lk.chat",destinationIdentities:[]}));this.emit("chat.message.sent",r)}catch(r){throw console.error("VoxketClient: Failed to send chat message:",r),new ee("Failed to send message","NETWORK_ERROR",r)}}async sendChatMessage(n,s){return this.sendMessage(n,s)}async sendAttachments(n,s){if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new ee("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new ee("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new ee("No local participant","CONNECTION_FAILED");if(!n||n.length===0)throw new ee("No files provided","INVALID_PARAMETER");this.dismissCurrentInteraction();const o=n.filter(r=>r.type.startsWith("image/"));if(o.length===0)throw new ee("Only image files are allowed","INVALID_PARAMETER");o.length!==n.length&&console.warn("VoxketClient: Some non-image files were filtered out");try{const r=o.map(async(i,l)=>{const d={id:`att_${Date.now()}_${l}`,content:`📎 ${i.name}`,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:{...s,type:"attachment",fileName:i.name,fileSize:i.size,mimeType:i.type,uploading:!0}};this.emit("chat.message.sent",d);const u=await this.room.localParticipant.sendFile(i,{mimeType:i.type,topic:"images",onProgress:f=>{const p={...d,metadata:{...d.metadata,uploadProgress:f}};this.emit("chat.message.updated",p)}});try{const f=new FileReader,p=new Promise((v,E)=>{f.onload=()=>{typeof f.result=="string"?v(f.result):E(new Error("Failed to convert to base64"))},f.onerror=E});f.readAsDataURL(i);const x={type:"image",data:await p,filename:i.name,mimeType:i.type,size:i.size};await this.room.localParticipant.sendText(JSON.stringify(x),{topic:"images",destinationIdentities:[]})}catch(f){console.warn("VoxketClient: Failed to send image data to agent:",f);try{const p=`I've shared an image: ${i.name}`;await this.room.localParticipant.sendText(p,{topic:"lk.chat",destinationIdentities:[]})}catch(p){console.warn("VoxketClient: Failed to send image notification to agent:",p)}}const m={...d,metadata:{...d.metadata,uploading:!1,uploadProgress:1,streamId:u.id}};return this.emit("chat.message.updated",m),u});await Promise.all(r)}catch(r){throw console.error("VoxketClient: Failed to send attachments:",r),new ee("Failed to send attachments","NETWORK_ERROR",r)}}async sendAttachment(n,s){return this.sendAttachments([n],s)}toggleMicrophone(n){return this.setMicrophoneEnabled(n!==!1)}async setMicrophoneEnabled(n){var s,o;try{const r=(s=this.room)==null?void 0:s.localParticipant.isMicrophoneEnabled,i=n??!r;await((o=this.room)==null?void 0:o.localParticipant.setMicrophoneEnabled(i)),i?this.emit("track.unmuted",{source:"microphone",enabled:!0}):this.emit("track.muted",{source:"microphone",enabled:!1})}catch(r){throw console.error("VoxketClient: Failed to toggle microphone:",r),new ee("Failed to toggle microphone","PERMISSION_DENIED",r)}}toggleCamera(n){return this.setCameraEnabled(n!==!1)}async setCameraEnabled(n){var s,o;try{const r=(s=this.room)==null?void 0:s.localParticipant.isCameraEnabled,i=n??!r;await((o=this.room)==null?void 0:o.localParticipant.setCameraEnabled(i)),i?this.emit("track.unmuted",{source:"camera",enabled:!0}):this.emit("track.muted",{source:"camera",enabled:!1})}catch(r){throw console.error("VoxketClient: Failed to toggle camera:",r),new ee("Failed to toggle camera","PERMISSION_DENIED",r)}}async enableCamera(){return this.setCameraEnabled(!0)}async disableCamera(){return this.setCameraEnabled(!1)}async startScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!0))}catch(s){throw new ee("Failed to start screen share","PERMISSION_DENIED",s)}}async stopScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!1))}catch(s){throw new ee("Failed to stop screen share","PERMISSION_DENIED",s)}}async getAudioInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="audioinput")}catch(n){throw new ee("Failed to get audio input devices","DEVICE_ERROR",n)}}async getVideoInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="videoinput")}catch(n){throw new ee("Failed to get video input devices","DEVICE_ERROR",n)}}async setAudioInputDevice(n){var s;try{if(!((s=this.room)!=null&&s.localParticipant))throw new Error("Not connected to room")}catch(o){throw new ee("Failed to set audio input device","DEVICE_ERROR",o)}}async setVideoInputDevice(n){var s;try{if(!((s=this.room)!=null&&s.localParticipant))throw new Error("Not connected to room")}catch(o){throw new ee("Failed to set video input device","DEVICE_ERROR",o)}}getLocalParticipant(){var n;return((n=this.room)==null?void 0:n.localParticipant)??null}getRemoteParticipants(){var n;return Array.from(((n=this.room)==null?void 0:n.remoteParticipants.values())??[])}getPublishPermissions(){const n=this.getLocalParticipant();if(!n)return{camera:!1,microphone:!1,screenShare:!1,data:!1};const s=n.permissions;if(!s)return{camera:!0,microphone:!0,screenShare:!0,data:!0};const o=r=>!!s.canPublish&&(s.canPublishSources.length===0||s.canPublishSources.includes(r));return{camera:o(1),microphone:o(2),screenShare:o(3),data:s.canPublishData??!1}}canPublishSource(n){return this.getPublishPermissions()[n]}getRoom(){return this.room}getConnectionState(){return this.connectionState}get connected(){return this.isConnected&&this.connectionState===I.ConnectionState.Connected}getMicrophoneTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===I.Track.Source.Microphone)return s.track;return null}getCameraTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===I.Track.Source.Camera)return s.track;return null}getScreenShareTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===I.Track.Source.ScreenShare)return s.track;return null}get isMicrophoneEnabled(){const n=this.getMicrophoneTrack();return n?!n.isMuted:!1}get isCameraEnabled(){const n=this.getCameraTrack();return n?!n.isMuted:!1}get isScreenShareEnabled(){const n=this.getScreenShareTrack();return n?!n.isMuted:!1}registerPlugin(n){this.pluginManager.register(n)}getPluginManager(){return this.pluginManager}getParticipants(){if(!this.room)return[];const n=[];return this.room.localParticipant&&n.push({id:this.room.localParticipant.identity,name:this.room.localParticipant.name||this.room.localParticipant.identity,isLocal:!0}),this.room.remoteParticipants.forEach(s=>{n.push({id:s.identity,name:s.name||s.identity,isLocal:!1})}),n}getSessionMetrics(){var n,s;return this.currentSession?{sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((s=this.room)==null?void 0:s.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]}:null}updateConfig(n){this.config={...this.config,...n}}async startRecording(){var n;try{this.emit("recording.started",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(s){throw new ee("Failed to start recording","RECORDING_ERROR",s)}}async stopRecording(){var n;try{this.emit("recording.stopped",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(s){throw new ee("Failed to stop recording","RECORDING_ERROR",s)}}async registerFrontendRPC(n,s,o="embedded"){return this.rpcManager.registerFrontendRPC(n,s,o)}getCurrentInteraction(){return this.rpcManager.getCurrentInteraction()}dismissCurrentInteraction(){this.rpcManager.dismissCurrentInteraction()}getRegisteredRpcMethods(){return this.rpcManager.getRegisteredMethods()}unregisterRpcMethod(n){this.rpcManager.unregisterMethod(n)}registerEventListener(n,s){return this.on(n,s)}registerEventEmitter(n,s){if(!this.room)throw new Error("Room not available");try{this.room.registerTextStreamHandler(n,async o=>{try{const r=await o.readAll();s(r)}catch(r){console.error(`Error processing event for topic '${n}':`,r)}})}catch(o){console.warn(`VoxketClient: Handler for topic '${n}' may already be registered:`,o)}}convertMarkdownToText(n){if(!n)return"";let s=n;return s=s.replace(/\*\*(.*?)\*\*/g,"$1"),s=s.replace(/__(.*?)__/g,"$1"),s=s.replace(/\*(.*?)\*/g,"$1"),s=s.replace(/_(.*?)_/g,"$1"),s=s.replace(/~~(.*?)~~/g,"$1"),s=s.replace(/`([^`]+)`/g,"$1"),s=s.replace(/```[\s\S]*?```/g,""),s=s.replace(/^#{1,6}\s+/gm,""),s=s.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1"),s.trim()}}const Xf=Q.create(Tf),Jf=Q.create($f),Qf=Q.create(Hf),e0=Q.create(zf);function t0({onClick:e,text:t="Open Chat",position:n="bottom-right",theme:s}){const o={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"},r=ye(s);return a.jsx(Q.button,{onClick:e,className:`fixed ${o[n]} z-50 px-4 py-2 rounded-full shadow-lg ${r.popupTrigger} transition-all duration-200 hover:scale-105`,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},children:t})}function Li({children:e,theme:t,displayType:n="widget",onClose:s,popupPosition:o="bottom-right",onExpand:r}){const i=ye(t);if(n==="fullscreen")return a.jsx("div",{className:"fixed inset-0 z-50 bg-black bg-opacity-30 backdrop-blur-sm flex items-center justify-center p-8",children:a.jsxs("div",{className:"w-full h-full max-w-6xl max-h-[90vh] rounded-2xl relative bg-transparent",children:[s&&a.jsx("button",{onClick:l=>{l.preventDefault(),l.stopPropagation(),s()},className:"absolute top-4 cursor-pointer right-4 z-[100] w-12 h-12 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Exit Fullscreen",type:"button",children:a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),a.jsxs("div",{id:"voice-card",className:`${i.card} w-full h-full flex flex-col rounded-xl shadow-2xl`,style:{minHeight:"600px"},children:[a.jsx("div",{className:i.cardTopGradient}),a.jsx("div",{className:i.cardPurpleBlur}),a.jsx("div",{className:i.cardPinkBlur}),a.jsx("div",{className:" flex flex-col h-full",children:e}),a.jsx("div",{className:i.cardPulse1}),a.jsx("div",{className:i.cardPulse2,style:{animationDelay:"1s"}})]})]})});if(n==="popup"){const l={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"};return a.jsx("div",{className:"fixed rounded-2xl inset-0 z-50 pointer-events-none",children:a.jsxs("div",{className:`fixed rounded-2xl ${l[o]} pointer-events-auto`,children:[s&&a.jsx("button",{onClick:s,className:"absolute -top-2 -right-2 z-10 w-8 h-8 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 text-sm shadow-lg border border-gray-700",children:"×"}),a.jsxs("div",{id:"voice-card",className:`${i.card} rounded-2xl flex flex-col`,style:{width:"300px",height:"450px"},children:[a.jsx("div",{className:i.cardPurpleBlur}),a.jsx("div",{className:i.cardPinkBlur}),a.jsx("div",{className:" flex flex-col h-full",children:e}),a.jsx("div",{className:i.cardPulse1}),a.jsx("div",{className:i.cardPulse2,style:{animationDelay:"1s"}})]})]})})}return a.jsxs("div",{id:"voice-card",className:`${i.card}`,children:[r&&a.jsx("button",{onClick:r,className:"absolute top-4 right-4 z-20 w-10 h-10 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Enter Fullscreen",children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})}),a.jsx("div",{className:i.cardTopGradient}),a.jsx("div",{className:i.cardPurpleBlur}),a.jsx("div",{className:i.cardPinkBlur}),e,a.jsx("div",{className:i.cardPulse1}),a.jsx("div",{className:i.cardPulse2,style:{animationDelay:"1s"}})]})}function Oa(e){if(typeof window>"u")return null;console.log("🎯 Widget component rendering with props:",{displayType:e.displayType,popupPosition:e.popupPosition,theme:e.theme});const{agentId:t,participantName:n,baseUrl:s,appSecret:o,appId:r,prompts:i,statusMessage:l,welcomeTitle:c,welcomeSubTitle:d,className:u,width:m,height:f,loadingText:p,suportsChatInput:g=!0,suportsVideoInput:x=!0,suportsScreenShare:v=!0,theme:E="vox",onSessionStart:b,onSessionEnd:S,enableSessionLogging:w=!0,onSessionLogsUpdate:C,onSessionMetricsUpdate:A,modalities:j=["voice"],displayType:k="widget",popupPosition:D="bottom-right",popupTriggerText:L="Open Chat",onPopupToggle:W,voxketClient:H,onDisplayTypeChange:Ce}=e,[ne,te]=h.useState(()=>H?!!H.getCurrentSession():!1),[se,z]=h.useState(!1),[M,G]=h.useState(t||""),[Y,V]=h.useState(n||"User"),[q,T]=h.useState(()=>H?H.getCurrentSession():null),[F,Z]=h.useState(()=>{var J,He,Me;if(H){const ce=H.getCurrentSession();if((J=ce==null?void 0:ce.activeModalities)!=null&&J.includes("chat"))return"chat";if((He=ce==null?void 0:ce.activeModalities)!=null&&He.includes("voice"))return"voice";if((Me=ce==null?void 0:ce.activeModalities)!=null&&Me.includes("video"))return"video"}return"welcome"}),[B,R]=h.useState(!1);h.useEffect(()=>{console.log("🎯 Widget displayType prop changed to:",k)},[k]),h.useEffect(()=>{console.log("📊 Session state changed:",{currentMode:F,sessionStarted:ne,loading:se,currentSession:q==null?void 0:q.id,isPopupOpen:B})},[F,ne,se,q,B]);const _=h.useMemo(()=>{if(H)return console.log("🔄 Using passed VoxketClient to preserve session state"),H;console.log("🆕 Creating new VoxketClient instance");const J={appId:r,appSecret:o,baseUrl:s,agentId:M,participantName:Y||"User",modalities:j};return new _t(J)},[H,r,o,s,M,Y,j]),K=j,O=h.useMemo(()=>_.getRoom()||new I.Room,[_]),re={suportsChatInput:g,suportsVideoInput:x,suportsScreenShare:v},{sessionMetrics:oe,sessionLogs:he,logEvent:ve}=Fa({room:O,onSessionStart:b,onSessionEnd:S,enableConsoleLogging:w,enableLocalStorage:w,voxketSessionId:q==null?void 0:q.id});h.useEffect(()=>{C&&C(he)},[he,C]),h.useEffect(()=>{A&&oe&&A(oe)},[oe,A]),h.useEffect(()=>{const J=Me=>{console.log("🔴 Room disconnected:",Me),z(!1),te(!1),T(null),Z("welcome")},He=Me=>{console.log("📹 Media devices error:",Me),Xt({title:"Allow access to your microphone/camera",description:`${Me.name}: ${Me.message}`})};return O.on(I.RoomEvent.MediaDevicesError,He),O.on(I.RoomEvent.Disconnected,J),()=>{O.off(I.RoomEvent.Disconnected,J),O.off(I.RoomEvent.MediaDevicesError,He)}},[O]);const De=async()=>{try{console.log("🎤 Starting voice session...",{agentId:M,participantName:Y}),console.log("🎤 Pre-start state:",{currentMode:F,sessionStarted:ne,loading:se}),z(!0),te(!0),Z("voice"),console.log("🎤 State after mode change:",{currentMode:"voice",sessionStarted:!0,loading:!0}),ve("USER_STARTED_VOICE_SESSION",{agentId:M,participantName:Y});const J=await _.startSession(M,{participantName:Y||"User",modalities:["voice",...x?["video"]:[]]});console.log("✅ Voice session started successfully:",J.id),T(J),z(!1),b&&b(J.id)}catch(J){console.error("❌ Failed to start voice session:",J),Xt({title:"Failed to start voice session",description:J instanceof Error?J.message:"Unknown error occurred"}),z(!1),te(!1),Z("welcome")}},Zt=async()=>{try{z(!0),te(!0),Z("chat"),ve("USER_STARTED_CHAT_SESSION",{agentId:M,participantName:Y});const J=await _.startSession(M,{participantName:Y||"User",modalities:["chat"]});T(J),z(!1),b&&b(J.id)}catch(J){console.error("Failed to start chat session:",J),Xt({title:"Failed to start chat session",description:J instanceof Error?J.message:"Unknown error occurred"}),z(!1),te(!1),Z("welcome")}},nl=async()=>{try{console.log("📺 Starting video session...",{agentId:M,participantName:Y}),console.log("📺 Pre-start state:",{currentMode:F,sessionStarted:ne,loading:se}),z(!0),te(!0),Z("video"),console.log("📺 State after mode change:",{currentMode:"video",sessionStarted:!0,loading:!0}),ve("USER_STARTED_VIDEO_SESSION",{agentId:M,participantName:Y});const J=await _.startSession(M,{participantName:Y||"User",modalities:["video","voice"]});console.log("✅ Video session started successfully:",J.id),T(J),z(!1),b&&b(J.id)}catch(J){console.error("❌ Failed to start video session:",J),Xt({title:"Failed to start video session",description:J instanceof Error?J.message:"Unknown error occurred"}),z(!1),te(!1),Z("welcome")}},St=()=>{Z("welcome"),Ce&&Ce(e.displayType||"widget"),q&&ne&&(te(!1),T(null),_.disconnect()),k==="popup"&&!B&&R(!0)},Ct=()=>{const J=!B;R(J),W&&W(J),!J&&!(q&&ne)&&(Z("welcome"),te(!1),T(null))},sl=()=>{console.log("🔄 Closing fullscreen, switching to widget display type"),e.onDisplayTypeChange?e.onDisplayTypeChange("widget"):console.warn("⚠️ No onDisplayTypeChange callback provided")},ol=()=>{e.onDisplayTypeChange&&e.onDisplayTypeChange("fullscreen")};h.useEffect(()=>{var J,He,Me;if(H&&_){console.log("🔄 Syncing widget state with existing client session state");const ce=_.getCurrentSession(),il=_.connected;console.log("🔍 Existing session state:",{hasSession:!!ce,sessionId:ce==null?void 0:ce.id,isConnected:il,activeModalities:ce==null?void 0:ce.activeModalities}),ce&&(console.log("✅ Restoring session state from existing client"),T(ce),te(!0),z(!1),(J=ce.activeModalities)!=null&&J.includes("chat")?Z("chat"):(He=ce.activeModalities)!=null&&He.includes("voice")?Z("voice"):(Me=ce.activeModalities)!=null&&Me.includes("video")&&Z("video"))}},[H,_]),h.useEffect(()=>()=>{console.log("🧹 Cleaning up widget component"),H?console.log("🔄 Widget cleanup: preserving passed client instance"):(console.log("🧹 Widget cleanup: disconnecting self-created client"),_.disconnect())},[_,H]);let xn="w-96",yn="h-[25rem]",bn={};if(m&&(m.startsWith("w-")?xn=m:(bn.width=m,xn="")),f&&(f.startsWith("h-")?yn=f:(bn.height=f,yn="")),k==="popup"&&!B)return console.log("🟡 Showing popup trigger button"),a.jsx(t0,{onClick:Ct,text:L,position:D,theme:E});console.log("🟢 Rendering widget content, displayType:",k,"isPopupOpen:",B,"currentMode:",F,"sessionStarted:",ne,"loading:",se);let vn=`voxket-widget-root theme-${E}`,Ut={scrollMargin:0,scrollPadding:0,contain:"layout style paint"};k==="widget"?(vn+=` flex items-center justify-center min-h-fit ${xn} ${yn} ${u}`,Ut={...Ut,...bn}):(vn=`${u||""}`,Ut={});const io=a.jsx(a.Fragment,{children:a.jsxs(ut,{mode:"wait",children:[F==="welcome"&&!se&&a.jsx(e0,{agentId:M,participantName:Y||"",onAgentIdChange:G,onParticipantNameChange:V,onStartCall:De,onStartChat:Zt,onStartVideo:nl,disabled:ne||se,prompts:i,statusMessage:l,title:c,subTitle:d,theme:E,modalities:K,initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:40},transition:{duration:.3,ease:"easeInOut"}},"welcome"),F==="voice"&&a.jsxs(ue.RoomContext.Provider,{value:O,children:[a.jsx(ue.RoomAudioRenderer,{}),a.jsx(ue.StartAudio,{label:"Start Audio"}),a.jsx(Xf,{loadingText:p,participantName:Y||"User",capabilities:re,sessionStarted:ne,disabled:!ne,theme:E,client:_,displayType:k,onBack:k==="popup"?Ct:St,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"session-view")]}),F==="chat"&&a.jsx(Jf,{client:_,theme:E,displayType:k,onBack:k==="popup"?Ct:St,onEndChat:St,disabled:!ne,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"chat-view"),F==="video"&&a.jsxs(ue.RoomContext.Provider,{value:O,children:[a.jsx(ue.RoomAudioRenderer,{}),a.jsx(ue.StartAudio,{label:"Start Audio"}),a.jsx(Qf,{client:_,theme:E,displayType:k,onBack:k==="popup"?Ct:St,onEndCall:St,disabled:!ne,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"video-view")]})]})});return k==="fullscreen"||k==="popup"?(console.log("📱 Rendering fullscreen/popup mode, displayType:",k),a.jsx(Li,{theme:E,displayType:k,popupPosition:D,onClose:k==="fullscreen"?sl:Ct,children:io})):(console.log("📦 Rendering widget mode"),a.jsx("div",{className:vn,style:Ut,children:a.jsx(Li,{theme:E,displayType:k,popupPosition:D,onExpand:ol,children:io})}))}class _a extends h.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("VoxketWidget Error:",t,n)}render(){if(this.state.hasError){if(this.props.fallback){const t=this.props.fallback;return h.createElement(t,{error:this.state.error})}return h.createElement("div",{style:{padding:"20px",border:"1px solid #ff4444",borderRadius:"8px",background:"#fff5f5",color:"#cc0000"}},"VoxketWidget encountered an error. Please check the console for details.")}return this.props.children}}function n0({logs:e,onClear:t,onExport:n}){const[s,o]=y.useState(!1),[r,i]=y.useState(""),l=e.filter(c=>!r||c.event.toLowerCase().includes(r.toLowerCase()));return s?a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[80vh] flex flex-col m-4",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[a.jsxs("h2",{className:"text-lg font-semibold",children:["Session Logs (",e.length,")"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",placeholder:"Filter events...",value:r,onChange:c=>i(c.target.value),className:"px-3 py-1 border rounded text-sm"}),a.jsx("button",{onClick:t,className:"px-3 py-1 bg-red-600 text-white rounded text-sm hover:bg-red-700",children:"Clear"}),a.jsx("button",{onClick:n,className:"px-3 py-1 bg-green-600 text-white rounded text-sm hover:bg-green-700",children:"Export"}),a.jsx("button",{onClick:()=>o(!1),className:"px-3 py-1 bg-gray-600 text-white rounded text-sm hover:bg-gray-700",children:"Close"})]})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4",children:l.length===0?a.jsx("p",{className:"text-gray-500 text-center py-8",children:"No logs found"}):a.jsx("div",{className:"space-y-2",children:l.map((c,d)=>a.jsxs("div",{className:"border rounded p-3 text-sm",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"font-semibold text-blue-600",children:c.event}),a.jsx("span",{className:"text-gray-500 text-xs",children:new Date(c.timestamp).toLocaleTimeString()})]}),c.sessionId&&a.jsxs("div",{className:"text-xs text-gray-600 mb-1",children:["Session: ",c.sessionId]}),c.data&&a.jsx("div",{className:"bg-gray-50 p-2 rounded text-xs",children:a.jsx("pre",{className:"whitespace-pre-wrap overflow-auto",children:JSON.stringify(c.data,null,2)})})]},d))})})]})}):a.jsxs("button",{onClick:()=>o(!0),className:"fixed bottom-4 right-4 bg-blue-600 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-blue-700 transition-colors text-sm z-50",children:["Session Logs (",e.length,")"]})}function s0({metrics:e}){return e?a.jsxs("div",{className:"bg-gray-100 p-4 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Current Session"}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-600",children:"Session ID:"}),a.jsx("div",{className:"font-mono text-xs",children:e.sessionId})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-600",children:"Start Time:"}),a.jsx("div",{children:new Date(e.startTime).toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-600",children:"Messages:"}),a.jsx("div",{children:e.totalMessages})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-600",children:"Participants:"}),a.jsx("div",{children:e.participantCount})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-600",children:"Connection Issues:"}),a.jsx("div",{children:e.connectionIssues})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-600",children:"Duration:"}),a.jsxs("div",{children:[Math.round((Date.now()-new Date(e.startTime).getTime())/1e3),"s"]})]})]})]}):null}function nt(){const{currentSession:e,sessionState:t,sessionMetrics:n,createSession:s,endSession:o}=Ie(),r=y.useCallback(async(l,c)=>await s(l,c),[s]),i=y.useCallback(async()=>await o(),[o]);return{session:e,state:t,metrics:n,isActive:e!==null&&t!=="disconnected",isConnecting:t==="connecting",isConnected:t==="connected"||t==="active",start:r,stop:i}}function Ha(){const{sessionMetrics:e,currentSession:t}=Ie();return{metrics:e,sessionId:t==null?void 0:t.id,duration:e==null?void 0:e.duration,participantCount:e==null?void 0:e.participantCount,messageCount:e==null?void 0:e.messageCount,audioQuality:e==null?void 0:e.audioQuality,networkStats:e==null?void 0:e.networkStats}}function Za(){const{setMicrophoneEnabled:e,client:t}=Ie(),[n,s]=y.useState(!1),[o,r]=y.useState(!1),i=y.useCallback(async()=>{if(!o){r(!0);try{const d=!n;await e(d),s(d)}catch(d){console.error("Failed to toggle microphone:",d)}finally{r(!1)}}},[n,o,e]),l=y.useCallback(async()=>{if(!(n||o)){r(!0);try{await e(!0),s(!0)}catch(d){console.error("Failed to enable microphone:",d)}finally{r(!1)}}},[n,o,e]),c=y.useCallback(async()=>{if(!(!n||o)){r(!0);try{await e(!1),s(!1)}catch(d){console.error("Failed to disable microphone:",d)}finally{r(!1)}}},[n,o,e]);return{isEnabled:n,isLoading:o,toggle:i,enable:l,disable:c}}function Ua(){const{setCameraEnabled:e}=Ie(),[t,n]=y.useState(!1),[s,o]=y.useState(!1),r=y.useCallback(async()=>{if(!s){o(!0);try{const c=!t;await e(c),n(c)}catch(c){console.error("Failed to toggle camera:",c)}finally{o(!1)}}},[t,s,e]),i=y.useCallback(async()=>{if(!(t||s)){o(!0);try{await e(!0),n(!0)}catch(c){console.error("Failed to enable camera:",c)}finally{o(!1)}}},[t,s,e]),l=y.useCallback(async()=>{if(!(!t||s)){o(!0);try{await e(!1),n(!1)}catch(c){console.error("Failed to disable camera:",c)}finally{o(!1)}}},[t,s,e]);return{isEnabled:t,isLoading:s,toggle:r,enable:i,disable:l}}function za(){const{startScreenShare:e,stopScreenShare:t}=Ie(),[n,s]=y.useState(!1),[o,r]=y.useState(!1),i=y.useCallback(async()=>{if(!(n||o)){r(!0);try{await e(),s(!0)}catch(d){console.error("Failed to start screen share:",d)}finally{r(!1)}}},[n,o,e]),l=y.useCallback(async()=>{if(!(!n||o)){r(!0);try{await t(),s(!1)}catch(d){console.error("Failed to stop screen share:",d)}finally{r(!1)}}},[n,o,t]),c=y.useCallback(async()=>{n?await l():await i()},[n,i,l]);return{isSharing:n,isLoading:o,start:i,stop:l,toggle:c}}function o0(){const{client:e}=Ie(),[t,n]=y.useState({tracks:[],layout:{type:"grid",showLocalVideo:!0,aspectRatio:"16:9"},isRecording:!1}),s=y.useMemo(()=>t.tracks.find(x=>x.isLocal),[t.tracks]),o=y.useMemo(()=>t.tracks.filter(x=>!x.isLocal),[t.tracks]),r=y.useCallback(async()=>{try{s!=null&&s.isEnabled?await(e==null?void 0:e.disableCamera()):await(e==null?void 0:e.enableCamera())}catch(x){throw console.error("Failed to toggle camera:",x),x}},[e,s]),i=y.useCallback(async()=>{try{t.tracks.find(v=>v.isScreenShare)?await(e==null?void 0:e.stopScreenShare()):await(e==null?void 0:e.startScreenShare())}catch(x){throw console.error("Failed to toggle screen share:",x),x}},[e,t.tracks]),l=y.useCallback(x=>{n(v=>({...v,layout:x}))},[]),c=y.useCallback(x=>{n(v=>({...v,pinnedTrack:x}))},[]),d=y.useCallback(()=>{n(x=>({...x,pinnedTrack:void 0}))},[]),u=y.useCallback(async()=>{try{await(e==null?void 0:e.startRecording()),n(x=>({...x,isRecording:!0}))}catch(x){throw console.error("Failed to start recording:",x),x}},[e]),m=y.useCallback(async()=>{try{await(e==null?void 0:e.stopRecording()),n(x=>({...x,isRecording:!1}))}catch(x){throw console.error("Failed to stop recording:",x),x}},[e]),f=y.useCallback(x=>t.tracks.find(v=>v.id===x),[t.tracks]),p=y.useCallback(x=>t.tracks.filter(v=>v.participantId===x),[t.tracks]),g=y.useCallback(x=>x.isEnabled&&t.tracks.includes(x),[t.tracks]);return y.useEffect(()=>{if(!e)return;const x=b=>{n(S=>({...S,tracks:[...S.tracks.filter(w=>w.id!==b.id),b]}))},v=b=>{n(S=>{var w;return{...S,tracks:S.tracks.filter(C=>C.id!==b),pinnedTrack:((w=S.pinnedTrack)==null?void 0:w.id)===b?void 0:S.pinnedTrack}})},E=b=>{n(S=>({...S,tracks:S.tracks.map(w=>w.id===b.id?b:w)}))};return e.on("videoTrackAdded",x),e.on("videoTrackRemoved",v),e.on("videoTrackUpdated",E),()=>{e.off("videoTrackAdded",x),e.off("videoTrackRemoved",v),e.off("videoTrackUpdated",E)}},[e]),{tracks:t.tracks,localTrack:s,remoteTraracks:o,pinnedTrack:t.pinnedTrack,layout:t.layout,isRecording:t.isRecording,toggleCamera:r,toggleScreenShare:i,setLayout:l,pinTrack:c,unpinTrack:d,startRecording:u,stopRecording:m,getTrackById:f,getTracksByParticipant:p,isTrackActive:g}}function gn(){const{chatMessages:e,sendChatMessage:t,currentSession:n}=Ie(),[s,o]=y.useState(!1),r=y.useCallback(async d=>{if(!(!d.trim()||s||!n)){o(!0);try{await t(d.trim())}catch(u){throw console.error("Failed to send chat message:",u),u}finally{o(!1)}}},[t,s,n]),{userMessages:i,agentMessages:l,allMessages:c}=y.useMemo(()=>{const d=e.filter(m=>m.sender.type==="participant"),u=e.filter(m=>m.sender.type==="agent");return{userMessages:d,agentMessages:u,allMessages:e}},[e]);return{messages:c,userMessages:i,agentMessages:l,messageCount:c.length,isSending:s,canSend:!!n&&!s,send:r}}function i0(){const{send:e,isSending:t,canSend:n}=gn(),[s,o]=y.useState(""),r=y.useCallback(async()=>{if(!(!s.trim()||!n))try{await e(s),o("")}catch(l){throw l}},[s,e,n]),i=y.useCallback(l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),r())},[r]);return{value:s,setValue:o,send:r,handleKeyPress:i,isSending:t,canSend:n&&s.trim().length>0}}function to(){const{isConnected:e,isConnecting:t,connectionError:n,connect:s,disconnect:o}=Ie(),r=y.useCallback(async()=>{if(!(e||t))try{await s()}catch(l){throw console.error("Failed to connect:",l),l}},[s,e,t]),i=y.useCallback(async()=>{if(e)try{await o()}catch(l){throw console.error("Failed to disconnect:",l),l}},[o,e]);return{isConnected:e,isConnecting:t,isDisconnected:!e&&!t,error:n,hasError:!!n,connect:r,disconnect:i}}function Wa(){const{participants:e}=Ie();return{participants:e,count:e.length,localParticipant:e.find(t=>t.isLocal),remoteParticipants:e.filter(t=>!t.isLocal)}}const Ka=y.createContext({}),Ht=()=>y.useContext(Ka);function Ga({children:e,...t}){return a.jsx(Ka.Provider,{value:t,children:e})}function sn({name:e,children:t,fallback:n,className:s}){return a.jsx("div",{className:`voxket-slot voxket-slot--${e} ${s||""}`,children:t||n})}function Ya(e,t={}){return Object.assign(e,t)}function qa({showMicrophoneControl:e=!0,showCameraControl:t=!0,showScreenShareControl:n=!0,showSessionActions:s=!0,customControls:o,className:r=""}){const i=nt(),l=Za(),c=Ua(),d=za(),u=Ht(),m=["voxket-session-controls",`voxket-session-controls--${u.variant||"default"}`,`voxket-session-controls--${u.size||"md"}`,i.isActive?"voxket-session-controls--active":"voxket-session-controls--inactive",r].filter(Boolean).join(" ");return!i.isActive&&!s?a.jsx("div",{className:m,children:a.jsx("div",{className:"voxket-controls-inactive",children:a.jsx("p",{children:"Controls available during active session"})})}):a.jsxs("div",{className:m,children:[s&&a.jsx("div",{className:"voxket-session-actions",children:i.isActive?a.jsx("button",{onClick:i.stop,className:"voxket-button voxket-button--danger",children:"End Session"}):a.jsx(r0,{})}),i.isActive&&a.jsxs("div",{className:"voxket-media-controls",children:[e&&a.jsxs("button",{onClick:l.toggle,disabled:l.isLoading,className:`voxket-button voxket-button--media ${l.isEnabled?"voxket-button--active":""}`,title:l.isEnabled?"Mute microphone":"Unmute microphone",children:[a.jsx("span",{className:"voxket-icon",children:"🎤"}),l.isLoading?"Loading...":l.isEnabled?"Mute":"Unmute"]}),t&&a.jsxs("button",{onClick:c.toggle,disabled:c.isLoading,className:`voxket-button voxket-button--media ${c.isEnabled?"voxket-button--active":""}`,title:c.isEnabled?"Stop camera":"Start camera",children:[a.jsx("span",{className:"voxket-icon",children:"📹"}),c.isLoading?"Loading...":c.isEnabled?"Stop Video":"Start Video"]}),n&&a.jsxs("button",{onClick:d.toggle,disabled:d.isLoading,className:`voxket-button voxket-button--media ${d.isSharing?"voxket-button--active":""}`,title:d.isSharing?"Stop screen share":"Start screen share",children:[a.jsx("span",{className:"voxket-icon",children:"🖥️"}),d.isLoading?"Loading...":d.isSharing?"Stop Share":"Share Screen"]})]}),o&&a.jsx("div",{className:"voxket-custom-controls",children:o})]})}function r0(){nt();const[e,t]=y.useState(!1),n=async()=>{t(!0);try{console.log("Start session - agentId needed")}catch(s){console.error("Failed to start session:",s)}finally{t(!1)}};return a.jsx("button",{onClick:n,disabled:e,className:"voxket-button voxket-button--primary",children:e?"Starting...":"Start Session"})}function no({showConnectionStatus:e=!0,showSessionInfo:t=!0,showAgentInfo:n=!0,className:s=""}){const o=nt(),r=to(),i=Ht(),l=["voxket-session-header",`voxket-session-header--${i.variant||"default"}`,`voxket-session-header--${i.size||"md"}`,s].filter(Boolean).join(" ");return a.jsxs("div",{className:l,children:[e&&a.jsxs("div",{className:"voxket-connection-status",children:[a.jsx("div",{className:`voxket-status-indicator ${r.isConnected?"connected":"disconnected"}`}),a.jsx("span",{className:"voxket-status-text",children:r.isConnecting?"Connecting...":r.isConnected?"Connected":"Disconnected"})]}),t&&o.session&&a.jsxs("div",{className:"voxket-session-info",children:[a.jsxs("div",{className:"voxket-session-id",children:["Session: ",o.session.id.slice(-8)]}),a.jsxs("div",{className:"voxket-session-state",children:["State: ",o.state]})]}),n&&o.session&&a.jsxs("div",{className:"voxket-agent-info",children:[a.jsxs("div",{className:"voxket-agent-id",children:["Agent: ",o.session.agentId]}),a.jsxs("div",{className:"voxket-modalities",children:["Modalities: ",o.session.activeModalities.join(", ")]})]}),r.error&&a.jsxs("div",{className:"voxket-error-message",children:["Error: ",r.error.message]})]})}function so({showChat:e=!0,showTranscriptions:t=!1,customContent:n,className:s=""}){const o=nt(),r=gn(),i=Ht(),l=["voxket-session-content",`voxket-session-content--${i.variant||"default"}`,`voxket-session-content--${i.size||"md"}`,s].filter(Boolean).join(" ");return o.isActive?a.jsx("div",{className:l,children:n||a.jsxs(a.Fragment,{children:[e&&a.jsxs("div",{className:"voxket-chat-container",children:[a.jsxs("div",{className:"voxket-chat-messages",children:[r.messages.map(c=>a.jsxs("div",{className:`voxket-message voxket-message--${c.sender.type}`,children:[a.jsxs("div",{className:"voxket-message-header",children:[a.jsx("span",{className:"voxket-message-sender",children:c.sender.name}),a.jsx("span",{className:"voxket-message-time",children:c.timestamp.toLocaleTimeString()})]}),a.jsx("div",{className:"voxket-message-content",children:c.content})]},c.id)),r.messages.length===0&&a.jsx("div",{className:"voxket-empty-messages",children:a.jsx("p",{children:"No messages yet. Start the conversation!"})})]}),a.jsx(a0,{})]}),t&&a.jsx("div",{className:"voxket-transcriptions",children:a.jsx("div",{className:"voxket-transcription-placeholder",children:a.jsx("p",{children:"Voice transcriptions will appear here"})})})]})}):a.jsx("div",{className:l,children:a.jsx("div",{className:"voxket-inactive-state",children:a.jsxs("div",{className:"voxket-inactive-message",children:[a.jsx("h3",{children:"Start a conversation"}),a.jsx("p",{children:"Begin a session to start chatting with the AI agent"})]})})})}function a0(){const e=gn(),[t,n]=y.useState(""),s=async()=>{if(!(!t.trim()||!e.canSend))try{await e.send(t),n("")}catch(r){console.error("Failed to send message:",r)}},o=r=>{r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),s())};return a.jsxs("div",{className:"voxket-chat-input",children:[a.jsx("input",{type:"text",value:t,onChange:r=>n(r.target.value),onKeyPress:o,placeholder:"Type your message...",disabled:!e.canSend,className:"voxket-input"}),a.jsx("button",{onClick:s,disabled:!e.canSend||!t.trim(),className:"voxket-send-button",children:e.isSending?"Sending...":"Send"})]})}function oo({showMetrics:e=!0,showParticipants:t=!0,showStatus:n=!0,customFooter:s,className:o=""}){const r=nt(),i=Ha(),l=Wa(),c=Ht(),d=["voxket-session-footer",`voxket-session-footer--${c.variant||"default"}`,`voxket-session-footer--${c.size||"md"}`,o].filter(Boolean).join(" ");return r.isActive?a.jsx("div",{className:d,children:s||a.jsxs(a.Fragment,{children:[n&&a.jsxs("div",{className:"voxket-session-status",children:[a.jsx("div",{className:"voxket-status-indicator voxket-status-indicator--active"}),a.jsx("span",{className:"voxket-status-text",children:"Session Active"})]}),e&&i.metrics&&a.jsxs("div",{className:"voxket-session-metrics",children:[a.jsxs("div",{className:"voxket-metric",children:[a.jsx("span",{className:"voxket-metric-label",children:"Duration:"}),a.jsx("span",{className:"voxket-metric-value",children:l0(i.duration||0)})]}),a.jsxs("div",{className:"voxket-metric",children:[a.jsx("span",{className:"voxket-metric-label",children:"Messages:"}),a.jsx("span",{className:"voxket-metric-value",children:i.metrics.messageCount})]})]}),t&&a.jsxs("div",{className:"voxket-participants-info",children:[a.jsxs("span",{className:"voxket-participants-count",children:[l.count," participant",l.count!==1?"s":""]}),l.remoteParticipants.length>0&&a.jsx("div",{className:"voxket-participant-list",children:l.remoteParticipants.map(u=>a.jsx("span",{className:"voxket-participant-name",children:u.name},u.id))})]})]})}):a.jsx("div",{className:d,children:a.jsx("div",{className:"voxket-footer-inactive",children:a.jsx("span",{className:"voxket-status-text",children:"Ready to start session"})})})}function l0(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),s=Math.floor(n/60);return s>0?`${s}:${(n%60).toString().padStart(2,"0")}:${(t%60).toString().padStart(2,"0")}`:`${n}:${(t%60).toString().padStart(2,"0")}`}function c0({agentId:e,sessionConfig:t,autoStart:n=!1,onSessionStart:s,onSessionEnd:o,variant:r="default",size:i="md",theme:l,className:c="",children:d}){var p;const u=nt(),m=to();y.useEffect(()=>{n&&e&&m.isConnected&&!u.isActive&&u.start(e,t).catch(console.error)},[n,e,m.isConnected,u.isActive]),y.useEffect(()=>{var g;(g=u.session)!=null&&g.id&&s&&s(u.session.id)},[(p=u.session)==null?void 0:p.id,s]),y.useEffect(()=>()=>{u.isActive&&o&&u.stop().then(o).catch(console.error)},[]);const f=["voxket-session",`voxket-session--${r}`,`voxket-session--${i}`,u.isActive?"voxket-session--active":"voxket-session--inactive",c].filter(Boolean).join(" ");return a.jsx(Ga,{variant:r,size:i,theme:l,className:c,children:a.jsx("div",{className:f,children:d||a.jsxs(a.Fragment,{children:[a.jsx(sn,{name:"header",fallback:a.jsx(no,{})}),a.jsx(sn,{name:"content",fallback:a.jsx(so,{})}),a.jsx(sn,{name:"footer",fallback:a.jsx(oo,{})})]})})})}const Xa=Ya(c0,{Header:no,Content:so,Footer:oo,Controls:qa}),tt={name:"default",colors:{primary:"#3B82F6",secondary:"#6B7280",accent:"#8B5CF6",background:"#FFFFFF",surface:"#F9FAFB",text:{primary:"#111827",secondary:"#6B7280",muted:"#9CA3AF",inverse:"#FFFFFF"},status:{success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6"},border:"#E5E7EB",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},typography:{fontFamily:"system-ui, -apple-system, sans-serif",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{none:"0",sm:"0.25rem",md:"0.5rem",lg:"0.75rem",full:"9999px"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1)"}},ms={...tt,name:"dark",colors:{primary:"#60A5FA",secondary:"#9CA3AF",accent:"#A78BFA",background:"#111827",surface:"#1F2937",text:{primary:"#F9FAFB",secondary:"#D1D5DB",muted:"#9CA3AF",inverse:"#111827"},status:{success:"#34D399",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},border:"#374151",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.3)"}},fs={...tt,name:"enterprise",colors:{primary:"#1E40AF",secondary:"#64748B",accent:"#7C3AED",background:"#FFFFFF",surface:"#F8FAFC",text:{primary:"#0F172A",secondary:"#475569",muted:"#94A3B8",inverse:"#FFFFFF"},status:{success:"#059669",warning:"#D97706",error:"#DC2626",info:"#1E40AF"},border:"#CBD5E1",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},borderRadius:{none:"0",sm:"0.125rem",md:"0.25rem",lg:"0.375rem",full:"9999px"}},Ja=y.createContext(null),Qa=()=>{const e=y.useContext(Ja);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e};function d0({theme:e="default",themes:t={},children:n,cssVariables:s=!0,className:o=""}){const[r,i]=y.useState(()=>{const f={default:tt,dark:ms,enterprise:fs,...t};return typeof e=="string"?f[e]||tt:e}),[l,c]=y.useState(()=>({default:tt,dark:ms,enterprise:fs,...t})),d=f=>{if(typeof f=="string"){const p=l[f];p&&i(p)}else i(f)},u=f=>{c(p=>({...p,[f.name]:f}))};y.useEffect(()=>{if(s&&typeof document<"u"){const f=document.documentElement;Object.entries(el(r)).forEach(([p,g])=>{f.style.setProperty(`--voxket-${p}`,g)})}},[r,s]);const m={theme:r,setTheme:d,themes:l,registerTheme:u};return a.jsx(Ja.Provider,{value:m,children:a.jsx("div",{className:`voxket-theme voxket-theme--${r.name} ${o}`,children:n})})}function el(e){const t={},n=(s,o="")=>{for(const[r,i]of Object.entries(s)){const l=o?`${o}-${r}`:r;typeof i=="object"&&i!==null&&!Array.isArray(i)?n(i,l):t[l]=String(i)}};return n(e),t}function u0(e=tt,t){return{...e,...t,colors:{...e.colors,...t.colors},typography:{...e.typography,...t.typography},spacing:{...e.spacing,...t.spacing},borderRadius:{...e.borderRadius,...t.borderRadius},shadows:{...e.shadows,...t.shadows}}}function h0(e){var n;const{theme:t}=Qa();return((n=t.components)==null?void 0:n[e])||{}}const m0=eo("voice-modality","voice",{onActivate:async e=>{const t=e.config;t.enableTranscription&&f0(e),t.enableVoiceActivation&&p0(e,t),console.log("Voice modality activated",t)},onDeactivate:async e=>{console.log("Voice modality deactivated")},onMessage:async(e,t)=>{t.type==="audio"&&g0(e,t)}});function f0(e,t){e.on("participant.speaking.started",n=>{console.log("Transcription: Started for",n.name)}),e.on("participant.speaking.stopped",n=>{console.log("Transcription: Stopped for",n.name)})}function p0(e,t){const n=t.silenceThreshold||-50;console.log("Voice activation setup with threshold:",n)}function g0(e,t){console.log("Playing audio response:",t.content)}const x0=eo("chat-modality","chat",{onActivate:async e=>{const t=e.config;t.enableRichText&&y0(),t.enableFileUpload&&b0(e),t.enableCustomComponents&&v0(),console.log("Chat modality activated",t)},onDeactivate:async e=>{console.log("Chat modality deactivated")},onMessage:async(e,t)=>{const n=e.config;t.type==="ui_component"?w0(e,t):t.type==="text"&&n.enableRichText&&S0(e,t)}});function y0(e){console.log("Rich text support enabled")}function b0(e){console.log("File upload enabled"),e.on("chat.file.uploaded",t=>{console.log("File uploaded:",t.name)})}function v0(e){console.log("Custom components enabled");const t=new Map;t.set("quick-actions",C0),t.set("form",k0),t.set("card",j0),t.set("chart",E0)}function w0(e,t){const{componentType:n,props:s}=t.metadata;console.log("Rendering custom component:",n,s),e.emit("chat.component.render",{type:n,props:s,timestamp:new Date})}function S0(e,t){console.log("Processing rich text message:",t.content)}function C0(e){return{type:"quick-actions",actions:e.actions||[],layout:e.layout||"horizontal"}}function k0(e){return{type:"form",fields:e.fields||[],submitAction:e.submitAction,validation:e.validation}}function j0(e){return{type:"card",title:e.title,content:e.content,actions:e.actions,variant:e.variant||"default"}}function E0(e){return{type:"chart",chartType:e.chartType||"line",data:e.data,options:e.options}}function on({track:e,participantName:t,showControls:n=!0,showName:s=!0,showMuteIndicator:o=!0,isPinned:r=!1,className:i="",onClick:l,onPin:c,onUnpin:d}){const u=y.useRef(null),[m,f]=y.useState(!1);y.useEffect(()=>{if(!u.current||!e.isEnabled)return;const v=u.current;return v.srcObject=null,()=>{v.srcObject&&(v.srcObject=null)}},[e]);const p=()=>{l==null||l(e)},g=v=>{v.stopPropagation(),r?d==null||d(e):c==null||c(e)},x=["voxket-video-tile",e.isLocal?"voxket-video-tile--local":"voxket-video-tile--remote",e.isScreenShare?"voxket-video-tile--screen-share":"voxket-video-tile--camera",r?"voxket-video-tile--pinned":"",e.isEnabled?"":"voxket-video-tile--disabled",m?"voxket-video-tile--hovered":"",i].filter(Boolean).join(" ");return a.jsxs("div",{className:x,onClick:p,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{aspectRatio:e.dimensions?`${e.dimensions.width} / ${e.dimensions.height}`:"16 / 9"},children:[a.jsx("video",{ref:u,className:"voxket-video-element",autoPlay:!0,playsInline:!0,muted:e.isLocal}),!e.isEnabled&&a.jsxs("div",{className:"voxket-video-placeholder",children:[a.jsx("div",{className:"voxket-video-placeholder-icon",children:e.isScreenShare?"🖥️":"📹"}),a.jsx("p",{className:"voxket-video-placeholder-text",children:e.isScreenShare?"Screen sharing paused":"Camera off"})]}),a.jsxs("div",{className:"voxket-video-overlay",children:[s&&t&&a.jsxs("div",{className:"voxket-video-name",children:[t,e.isLocal&&" (You)"]}),o&&!e.isEnabled&&a.jsx("div",{className:"voxket-video-mute-indicator",children:"🔇"}),n&&(m||r)&&a.jsxs("div",{className:"voxket-video-controls",children:[a.jsx("button",{className:`voxket-video-control-btn ${r?"voxket-video-control-btn--active":""}`,onClick:g,title:r?"Unpin video":"Pin video",children:"📌"}),e.isScreenShare&&a.jsx("div",{className:"voxket-video-indicator",children:"🖥️"}),e.source&&a.jsx("div",{className:"voxket-video-source",children:e.source})]})]}),!e.isEnabled&&a.jsx("div",{className:"voxket-video-loading",children:a.jsx("div",{className:"voxket-spinner"})})]})}function A0({tracks:e,layout:t,className:n="",onLayoutChange:s,onTrackClick:o,maxVisibleTracks:r=9,showPagination:i=!0}){const[l,c]=y.useState(0),[d,u]=y.useState(null),m=y.useMemo(()=>{let b=[...e];t.type==="speaker"&&d&&(b=[d,...e.filter(C=>C.id!==d.id)]);const S=l*r,w=S+r;return b.slice(S,w)},[e,t,d,l,r]),f=Math.ceil(e.length/r),p=y.useMemo(()=>{const b=m.length;switch(t.type){case"grid":const S=Math.ceil(Math.sqrt(b)),w=Math.ceil(b/S);return{display:"grid",gridTemplateColumns:`repeat(${S}, 1fr)`,gridTemplateRows:`repeat(${w}, 1fr)`,gap:"8px"};case"speaker":return{display:"flex",flexDirection:"column",gap:"8px"};case"sidebar":return{display:"flex",gap:"8px"};case"gallery":return{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center"};default:return{}}},[t.type,m.length]),g=b=>{u(b)},x=()=>{u(null)},v=b=>{s==null||s({...t,type:b})},E=["voxket-video-grid",`voxket-video-grid--${t.type}`,`voxket-video-grid--${m.length}-tracks`,n].filter(Boolean).join(" ");return e.length===0?a.jsx("div",{className:"voxket-video-grid-empty",children:a.jsxs("div",{className:"voxket-video-grid-empty-content",children:[a.jsx("div",{className:"voxket-video-grid-empty-icon",children:"📹"}),a.jsx("p",{children:"No video tracks available"})]})}):a.jsxs("div",{className:E,children:[a.jsxs("div",{className:"voxket-video-grid-controls",children:[a.jsx("div",{className:"voxket-video-layout-controls",children:["grid","speaker","sidebar","gallery"].map(b=>a.jsx("button",{className:`voxket-layout-btn ${t.type===b?"voxket-layout-btn--active":""}`,onClick:()=>v(b),title:`Switch to ${b} layout`,children:M0(b)},b))}),a.jsxs("div",{className:"voxket-video-count",children:[e.length," participant",e.length!==1?"s":""]})]}),a.jsx("div",{className:"voxket-video-grid-content",style:p,children:t.type==="speaker"&&d?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"voxket-video-speaker-main",children:a.jsx(on,{track:d,participantName:`Participant ${d.participantId}`,isPinned:!0,onClick:o,onUnpin:x})}),a.jsx("div",{className:"voxket-video-speaker-sidebar",children:m.filter(b=>b.id!==d.id).map(b=>a.jsx(on,{track:b,participantName:`Participant ${b.participantId}`,showControls:!1,onClick:o,onPin:g},b.id))})]}):m.map(b=>a.jsx(on,{track:b,participantName:`Participant ${b.participantId}`,isPinned:(d==null?void 0:d.id)===b.id,onClick:o,onPin:g,onUnpin:x},b.id))}),i&&f>1&&a.jsxs("div",{className:"voxket-video-pagination",children:[a.jsx("button",{className:"voxket-pagination-btn",onClick:()=>c(Math.max(0,l-1)),disabled:l===0,children:"←"}),a.jsxs("span",{className:"voxket-pagination-info",children:["Page ",l+1," of ",f]}),a.jsx("button",{className:"voxket-pagination-btn",onClick:()=>c(Math.min(f-1,l+1)),disabled:l===f-1,children:"→"})]})]})}function M0(e){switch(e){case"grid":return"⊞";case"speaker":return"🎤";case"sidebar":return"⫸";case"gallery":return"⊡";case"picture-in-picture":return"⧉";default:return"⊞"}}function T0({localTrack:e,onToggleCamera:t,onToggleScreenShare:n,onLayoutChange:s,showLayoutControls:o=!0,showCameraControls:r=!0,showScreenShareControls:i=!0,className:l=""}){const c=["voxket-video-controls",l].filter(Boolean).join(" "),d=u=>{s==null||s({type:u,showLocalVideo:!0,aspectRatio:"16:9"})};return a.jsxs("div",{className:c,children:[r&&a.jsxs("div",{className:"voxket-video-controls-section",children:[a.jsx("h4",{className:"voxket-video-controls-title",children:"Camera"}),a.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isEnabled?"voxket-control-btn--active":""}`,onClick:t,title:e!=null&&e.isEnabled?"Turn off camera":"Turn on camera",children:[a.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isEnabled?"📹":"📷"}),a.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isEnabled?"Camera On":"Camera Off"})]}),(e==null?void 0:e.dimensions)&&a.jsxs("div",{className:"voxket-video-info",children:[e.dimensions.width," × ",e.dimensions.height]})]}),i&&a.jsxs("div",{className:"voxket-video-controls-section",children:[a.jsx("h4",{className:"voxket-video-controls-title",children:"Screen Share"}),a.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isScreenShare?"voxket-control-btn--active":""}`,onClick:n,title:e!=null&&e.isScreenShare?"Stop screen sharing":"Start screen sharing",children:[a.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isScreenShare?"🛑":"🖥️"}),a.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isScreenShare?"Stop Sharing":"Share Screen"})]})]}),o&&a.jsxs("div",{className:"voxket-video-controls-section",children:[a.jsx("h4",{className:"voxket-video-controls-title",children:"Layout"}),a.jsx("div",{className:"voxket-layout-buttons",children:[{type:"grid",icon:"⊞",label:"Grid"},{type:"speaker",icon:"🎤",label:"Speaker"},{type:"sidebar",icon:"⫸",label:"Sidebar"},{type:"gallery",icon:"⊡",label:"Gallery"}].map(({type:u,icon:m,label:f})=>a.jsxs("button",{className:"voxket-layout-control-btn",onClick:()=>d(u),title:`Switch to ${f} layout`,children:[a.jsx("span",{className:"voxket-control-icon",children:m}),a.jsx("span",{className:"voxket-control-label",children:f})]},u))})]}),a.jsxs("div",{className:"voxket-video-controls-section",children:[a.jsx("h4",{className:"voxket-video-controls-title",children:"Video Settings"}),a.jsxs("div",{className:"voxket-video-settings",children:[a.jsxs("div",{className:"voxket-setting-group",children:[a.jsx("label",{className:"voxket-setting-label",children:"Quality"}),a.jsxs("select",{className:"voxket-setting-select",children:[a.jsx("option",{value:"high",children:"High (720p)"}),a.jsx("option",{value:"medium",children:"Medium (480p)"}),a.jsx("option",{value:"low",children:"Low (240p)"})]})]}),a.jsxs("div",{className:"voxket-setting-group",children:[a.jsx("label",{className:"voxket-setting-label",children:"Frame Rate"}),a.jsxs("select",{className:"voxket-setting-select",children:[a.jsx("option",{value:"30",children:"30 fps"}),a.jsx("option",{value:"15",children:"15 fps"}),a.jsx("option",{value:"10",children:"10 fps"})]})]}),a.jsxs("div",{className:"voxket-setting-group",children:[a.jsx("label",{className:"voxket-setting-label",children:"Bandwidth"}),a.jsxs("select",{className:"voxket-setting-select",children:[a.jsx("option",{value:"unlimited",children:"Unlimited"}),a.jsx("option",{value:"1000",children:"1 Mbps"}),a.jsx("option",{value:"500",children:"500 Kbps"}),a.jsx("option",{value:"250",children:"250 Kbps"})]})]})]})]}),a.jsxs("div",{className:"voxket-video-controls-section",children:[a.jsx("h4",{className:"voxket-video-controls-title",children:"Statistics"}),a.jsxs("div",{className:"voxket-video-stats",children:[a.jsxs("div",{className:"voxket-stat-item",children:[a.jsx("span",{className:"voxket-stat-label",children:"Resolution:"}),a.jsx("span",{className:"voxket-stat-value",children:e!=null&&e.dimensions?`${e.dimensions.width}×${e.dimensions.height}`:"N/A"})]}),a.jsxs("div",{className:"voxket-stat-item",children:[a.jsx("span",{className:"voxket-stat-label",children:"Source:"}),a.jsx("span",{className:"voxket-stat-value",children:(e==null?void 0:e.source)||"None"})]}),a.jsxs("div",{className:"voxket-stat-item",children:[a.jsx("span",{className:"voxket-stat-label",children:"Status:"}),a.jsx("span",{className:`voxket-stat-value ${e!=null&&e.isEnabled?"voxket-stat-value--active":"voxket-stat-value--inactive"}`,children:e!=null&&e.isEnabled?"Active":"Inactive"})]})]})]})]})}const tl=({handler:e,loadData:t,data:n,client:s,addLocalMessage:o})=>{const[r,i]=h.useState(null),[l,c]=h.useState(!0),[d,u]=h.useState(!1),[m]=h.useState(Date.now());h.useEffect(()=>{(async()=>{try{if(c(!0),console.log("📋 AssignmentView: Loading assignment data..."),console.log("📋 AssignmentView: Received data from RPC:",n),n&&typeof n=="object"){const v={title:n.title||"Untitled Assignment",description:n.description||"No description provided",estimated_time_of_completion:n.estimated_time_of_completion||"Unknown"};i(v),console.log("📋 AssignmentView: Assignment loaded from RPC data:",v)}}catch(v){console.error("📋 AssignmentView: Error loading assignment:",v),i({title:"Assignment Loading Error",description:"There was an error loading the assignment details. Please try again.",estimated_time_of_completion:"Unknown"})}finally{c(!1)}})()},[n,t]);const f=({message:x,assignment:v})=>{const E=x.toLowerCase().includes("declined"),b=E?"bg-red-50 border-red-200":"bg-green-50 border-green-200",S=E?"text-red-700":"text-green-700",w=E?"❌":"🎉";return a.jsxs("div",{className:`max-w-sm mx-auto ${b} border rounded-lg shadow p-3 flex flex-col items-center`,children:[a.jsx("div",{className:"text-2xl mb-2",children:w}),a.jsx("div",{className:`${S} font-semibold text-sm mb-1`,children:x}),a.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:v.title}),a.jsx("div",{className:"text-xs text-gray-500",children:"Thank you for your response!"})]})},p=async()=>{if(!(!r||!e)){u(!0);try{const x={message:"accepted"};console.log("📋 AssignmentView: Assignment accepted:",x),e.didSuccess(x,a.jsx(f,{message:"Assignment accepted!",assignment:r}))}catch(x){console.error("📋 AssignmentView: Error accepting assignment:",x),e.didFail({error:"Failed to accept assignment"})}finally{u(!1)}}},g=async()=>{if(!(!r||!e)){u(!0);try{const x={message:"declined"};console.log("📋 AssignmentView: Assignment declined:",x),e.didSuccess(x,a.jsx(f,{message:"Assignment declined",assignment:r}))}catch(x){console.error("📋 AssignmentView: Error declining assignment:",x),e.didFail({error:"Failed to decline assignment"})}finally{u(!1)}}};return l?a.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:a.jsxs("div",{className:"flex items-center justify-center py-4",children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}),a.jsx("span",{className:"ml-2 text-xs text-gray-600",children:"Loading assignment..."})]})}):r?a.jsxs("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg overflow-hidden",children:[a.jsx("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 text-white p-3",children:a.jsx("div",{className:"flex items-center justify-between",children:a.jsx("h3",{className:"text-xs font-semibold text-white truncate",children:r.title})})}),a.jsxs("div",{className:"p-3",children:[a.jsx("div",{className:"bg-gray-50 rounded p-2 mb-3",children:a.jsx("p",{className:"text-xs text-gray-700 leading-snug",children:r.description})}),a.jsx("div",{className:"mb-3",children:a.jsxs("div",{className:"flex items-center text-xs text-gray-600",children:[a.jsx("span",{className:"text-xs mr-1",children:"📅"}),a.jsxs("span",{children:["Est: ",r.estimated_time_of_completion]})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:p,disabled:d,className:"flex-1 bg-green-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:d?a.jsxs("span",{className:"flex items-center justify-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-2 w-2 border-b-2 border-white mr-1"}),a.jsx("span",{className:"text-xs",children:"Processing..."})]}):"Accept"}),a.jsx("button",{onClick:g,disabled:d,className:"flex-1 bg-red-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-red-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Decline"})]})]})]}):a.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:a.jsxs("div",{className:"text-center py-4",children:[a.jsx("div",{className:"text-red-600 text-sm font-semibold mb-2",children:"⚠️ Assignment Error"}),a.jsx("p",{className:"text-xs text-gray-600 mb-3",children:"Failed to load assignment details."})]})})};function V0(){const[e,t]=h.useState(null),[n,s]=h.useState([]);h.useEffect(()=>{const l=new _t({appId:"your-app-id",appSecret:"your-app-secret",baseUrl:"https://your-voxket-api.com",agentId:"your-agent-id",participantName:"User",modalities:["chat"]});return t(l),l.on("rpc.method.called",c=>{console.log("RPC Method Called:",c)}),l.on("rpc.interaction.completed",c=>{console.log("RPC Interaction Completed:",c)}),()=>{l.disconnect()}},[]);const o=async()=>{if(e)try{await e.registerFrontendRPC("give_assignment",tl,"embedded");const l=e.getRegisteredRpcMethods();s(l),console.log("✅ Assignment RPC registered successfully")}catch(l){console.error("❌ Failed to register assignment RPC:",l)}},r=async()=>{if(!e)return;const l=({handler:c,timeout:d})=>{const[u,m]=h.useState(""),f=[{id:"pro",name:"Pro Plan",price:"$29/month"},{id:"enterprise",name:"Enterprise Plan",price:"$99/month"},{id:"basic",name:"Basic Plan",price:"$9/month"}],p=x=>{m(x)},g=()=>{const x=f.find(v=>v.id===u);c==null||c.didSuccess({selectedProduct:u,productName:x==null?void 0:x.name,price:x==null?void 0:x.price,timestamp:new Date().toISOString()})};return a.jsxs("div",{className:"p-6 bg-white rounded-lg",children:[a.jsx("h3",{className:"text-xl font-bold mb-4",children:"Choose Your Plan"}),a.jsx("p",{className:"text-gray-600 mb-4",children:"Select the plan that best fits your needs:"}),a.jsx("div",{className:"space-y-3 mb-6",children:f.map(x=>a.jsx("div",{onClick:()=>p(x.id),className:`p-4 border rounded-lg cursor-pointer transition-all ${u===x.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,children:a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium",children:x.name}),a.jsx("p",{className:"text-gray-600 text-sm",children:x.price})]}),a.jsx("div",{className:`w-4 h-4 rounded-full ${u===x.id?"bg-blue-500":"border-2 border-gray-300"}`})]})},x.id))}),a.jsxs("div",{className:"flex justify-end space-x-3",children:[a.jsx("button",{onClick:()=>c==null?void 0:c.dismissView(),className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Cancel"}),a.jsx("button",{onClick:g,disabled:!u,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Select Plan"})]}),d&&a.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Time remaining: ",d," seconds"]})]})};try{await e.registerFrontendRPC("recommend_product",l,"modal");const c=e.getRegisteredRpcMethods();s(c),console.log("✅ Product Recommendation RPC registered successfully")}catch(c){console.error("❌ Failed to register product recommendation RPC:",c)}},i=async()=>{if(!e)return;const l=({handler:c})=>{const[d,u]=h.useState(0),[m,f]=h.useState(""),p=()=>{c==null||c.didSuccess({rating:d,comment:m,timestamp:new Date().toISOString()})};return a.jsxs("div",{className:"p-4 bg-white rounded-lg",children:[a.jsx("h3",{className:"text-lg font-semibold mb-3",children:"How was your experience?"}),a.jsxs("div",{className:"mb-4",children:[a.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Rate your experience:"}),a.jsx("div",{className:"flex space-x-1",children:[1,2,3,4,5].map(g=>a.jsx("button",{onClick:()=>u(g),className:`text-2xl ${g<=d?"text-yellow-400":"text-gray-300"}`,children:"⭐"},g))})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Additional comments:"}),a.jsx("textarea",{value:m,onChange:g=>f(g.target.value),className:"w-full p-2 border border-gray-300 rounded text-sm",rows:3,placeholder:"Tell us more about your experience..."})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx("button",{onClick:()=>c==null?void 0:c.dismissView(),className:"px-3 py-1 text-sm border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Skip"}),a.jsx("button",{onClick:p,disabled:d===0,className:"px-3 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Submit"})]})]})};try{await e.registerFrontendRPC("collect_feedback",l,"embedded");const c=e.getRegisteredRpcMethods();s(c),console.log("✅ Feedback RPC registered successfully")}catch(c){console.error("❌ Failed to register feedback RPC:",c)}};return a.jsxs("div",{className:"p-6",children:[a.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Frontend RPC Examples"}),a.jsxs("div",{className:"space-y-4 mb-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Register RPC Methods"}),a.jsxs("div",{className:"space-x-2",children:[a.jsx("button",{onClick:o,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Register Assignment RPC"}),a.jsx("button",{onClick:r,className:"px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600",children:"Register Product Recommendation RPC"}),a.jsx("button",{onClick:i,className:"px-4 py-2 bg-purple-500 text-white rounded hover:bg-purple-600",children:"Register Feedback RPC"})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Registered Methods"}),n.length>0?a.jsx("ul",{className:"list-disc list-inside space-y-1",children:n.map(l=>a.jsx("li",{className:"text-gray-700",children:a.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded",children:l})},l))}):a.jsx("p",{className:"text-gray-500",children:"No methods registered yet"})]})]}),a.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"How it works"}),a.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-sm text-gray-700",children:[a.jsxs("li",{children:["Register RPC methods with React components using ",a.jsx("code",{children:"client.registerFrontendRPC()"})]}),a.jsx("li",{children:"When the agent calls an RPC method, the corresponding component will be displayed"}),a.jsx("li",{children:"Users interact with the component, and the response is sent back to the agent"}),a.jsx("li",{children:"Components can be displayed in different modes: embedded, modal, or fullscreen"}),a.jsx("li",{children:"Each component has a timeout and can handle success/failure scenarios"})]})]}),a.jsxs("div",{className:"mt-6 bg-blue-50 p-4 rounded-lg",children:[a.jsx("h3",{className:"text-lg font-semibold mb-2 text-blue-800",children:"Agent Side"}),a.jsx("p",{className:"text-sm text-blue-700 mb-2",children:"On the agent side, you can call these RPC methods like this:"}),a.jsx("pre",{className:"bg-white p-3 rounded text-xs text-gray-800 overflow-x-auto",children:`// Agent calls RPC method
|
|
221
33
|
const response = await participant.performRpc({
|
|
222
34
|
method: 'give_assignment',
|
|
223
35
|
data: JSON.stringify({
|
|
@@ -228,4 +40,4 @@ const response = await participant.performRpc({
|
|
|
228
40
|
})
|
|
229
41
|
});
|
|
230
42
|
|
|
231
|
-
console.log('User response:', response);`})]})]})}const
|
|
43
|
+
console.log('User response:', response);`})]})]})}const N0={async checkAvailableRpcs(e){const t=e.getRegisteredRpcMethods();return console.log("🔍 Agent: Available RPC methods:",t),t},async triggerAssignment(e,t){const n={title:"Complete Q4 Sales Analysis Report",description:"Please analyze the Q4 sales data and create a comprehensive report with insights, trends, and recommendations for the upcoming quarter. Include visualizations and executive summary.",estimated_time_of_completion:"2-3 hours"};try{console.log("🤖 Agent: Triggering give_assignment RPC with data:",n);const s=await e.localParticipant.performRpc(t,"give_assignment",JSON.stringify(n),{responseTimeout:12e4}),o=JSON.parse(s);return console.log("✅ Agent: Received user response:",o),await this.processAssignmentResponse(o),o}catch(s){throw console.error("❌ Agent: RPC failed:",s),s}},async processAssignmentResponse(e){console.log("🧠 Agent: Processing assignment response...");const t=e.status,n=e.assignmentId,s=e.timeSpent;return t==="accepted"?(console.log("🎉 Agent: User accepted the assignment!"),console.log(`� Assignment ID: ${n}`),console.log(`⏱️ Time to respond: ${s}ms`),console.log("💬 Agent: Sending follow-up:","Great! I've recorded that you've accepted the assignment. You'll receive the detailed requirements and access to the data shortly. Let me know if you need any clarification!")):t==="declined"?(console.log("❌ Agent: User declined the assignment"),console.log("💬 Agent: Sending follow-up:","No problem! Is there anything specific about this assignment that doesn't work for you? I can suggest alternatives or modify the requirements.")):t==="completed"&&(console.log("✅ Agent: User completed the assignment"),console.log("💬 Agent: Sending follow-up:","Excellent work! Could you please share the completed report? I'm excited to review your analysis and insights.")),{status:t,assignmentId:n,timeSpent:s,processed:!0,followupAction:t==="accepted"?"send_requirements":t==="declined"?"offer_alternatives":"request_deliverables"}},getAssignmentExamples(){return{marketing:{title:"Create Social Media Campaign",description:"Design and plan a social media campaign for our new product launch. Include content calendar, post designs, and engagement strategy.",estimated_time_of_completion:"4-5 hours"},technical:{title:"API Integration Documentation",description:"Create comprehensive documentation for our new API endpoints, including examples, error codes, and best practices for developers.",estimated_time_of_completion:"6-8 hours"},research:{title:"Market Research Analysis",description:"Research and analyze competitor pricing strategies in our target market. Provide recommendations for our pricing model.",estimated_time_of_completion:"3-4 hours"},quick:{title:"Customer Feedback Summary",description:"Review this week's customer feedback and create a summary of key themes and actionable insights.",estimated_time_of_completion:"30-45 minutes"}}}},P0=e=>typeof window>"u"?null:h.createElement(_a,{children:h.createElement(Oa,e)});exports.AssignmentView=tl;exports.CompoundProvider=Ga;exports.InteractiveComponent=pt;exports.PluginManager=La;exports.RpcExamples=V0;exports.SessionContainer=Xa;exports.SessionContent=so;exports.SessionControls=qa;exports.SessionFooter=oo;exports.SessionHeader=no;exports.SessionLogViewer=n0;exports.SessionMetricsComponent=s0;exports.Slot=sn;exports.ThemeProvider=d0;exports.VideoControls=T0;exports.VideoGrid=A0;exports.VideoTile=on;exports.VoxketClient=_t;exports.VoxketErrorBoundary=_a;exports.VoxketEventEmitter=Qs;exports.VoxketProvider=$a;exports.VoxketSDK=_t;exports.VoxketSessionComponent=Xa;exports.agentRpcExample=N0;exports.analyticsPlugin=Kf;exports.chatModalityPlugin=x0;exports.createCustomTheme=u0;exports.createModalityPlugin=eo;exports.createPlugin=Wf;exports.darkTheme=ms;exports.debugPlugin=Gf;exports.default=P0;exports.defaultTheme=tt;exports.enterpriseTheme=fs;exports.flattenTheme=el;exports.metricsPlugin=Yf;exports.useComponentTheme=h0;exports.useCompoundContext=Ht;exports.useSessionLogging=Fa;exports.useTheme=Qa;exports.useVoxket=Ie;exports.useVoxketCamera=Ua;exports.useVoxketChat=gn;exports.useVoxketChatInput=i0;exports.useVoxketConnection=to;exports.useVoxketMetrics=Ha;exports.useVoxketMicrophone=Za;exports.useVoxketParticipants=Wa;exports.useVoxketScreenShare=za;exports.useVoxketSession=nt;exports.useVoxketVideo=o0;exports.voiceModalityPlugin=m0;exports.withCompoundComponent=Ya;
|