react-ai-avatar 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +188 -142
- package/dist/lib/components/AvatarCaption.d.ts +25 -0
- package/dist/lib/components/RealtimeAvatar.d.ts +18 -1
- package/dist/lib/components/SquirrelAvatar.d.ts +8 -1
- package/dist/lib/index.cjs +4 -4
- package/dist/lib/index.js +661 -552
- package/dist/lib/lib/index.d.ts +2 -2
- package/dist/lib/react-ai-avatar.css +1 -1
- package/package.json +1 -1
package/dist/lib/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var Ne=Object.create;var ue=Object.defineProperty;var We=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var $e=Object.getPrototypeOf,Te=Object.prototype.hasOwnProperty;var Be=(t,r,l,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of Qe(r))!Te.call(t,s)&&s!==l&&ue(t,s,{get:()=>r[s],enumerable:!(a=We(r,s))||a.enumerable});return t};var pe=(t,r,l)=>(l=t!=null?Ne($e(t)):{},Be(r||!t||!t.__esModule?ue(l,"default",{value:t,enumerable:!0}):l,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("react"),Y=require("./useReducedMotion-BRDEmRNI.cjs"),re=require("motion/react"),Ce={idle:"#4b5563",listening:"#3b82f6",thinking:"#8b5cf6",speaking:"#10b981",working:"#f59e0b"};function ge(t,r){const l=Y.useReducedMotion(),a=x.useRef(r);a.current=r;const s=x.useRef({x:0,y:0});x.useEffect(()=>{if(l)return;const i=o=>{s.current.x=Math.max(-1,Math.min(1,o.clientX/window.innerWidth*2-1)),s.current.y=Math.max(-1,Math.min(1,o.clientY/window.innerHeight*2-1))};return window.addEventListener("mousemove",i),()=>window.removeEventListener("mousemove",i)},[l]),x.useEffect(()=>{const i=t.current;if(i===null||typeof window>"u")return;const o=(M,q)=>q>0?Math.round(M/q)*q:M;let c=null,f=null,h=null,p=[],n=[],_=[],R=!1,T=3,G=9,b=0,m=1,B=[],d=[],j=[];const v=()=>{var W;c=i.querySelector("#rra-ring"),f=i.querySelector("#rra-mouth"),h=i.querySelector("#rra-think"),p=h?Array.from(h.querySelectorAll("circle, rect")):[],n=Array.from(i.querySelectorAll(".rra-pupil")),_=Array.from(i.querySelectorAll(".rra-lid")),R=(f==null?void 0:f.tagName.toLowerCase())==="rect",T=f?parseFloat(f.getAttribute(R?"height":"ry")??"3"):3,G=f?parseFloat(f.getAttribute(R?"width":"rx")??"9"):9,b=f?parseFloat(f.getAttribute("data-quantize")??"0"):0,B=n.map(E=>{const P=E.tagName.toLowerCase()==="rect";return{isRect:P,x:parseFloat(E.getAttribute("data-base-x")??E.getAttribute(P?"x":"cx")??"0"),y:parseFloat(E.getAttribute("data-base-y")??E.getAttribute(P?"y":"cy")??"0"),quantize:parseFloat(E.getAttribute("data-quantize")??"0")}}),d=_.map(E=>parseFloat(E.getAttribute("data-max-height")??"16")),j=n.map(()=>({x:0,y:0}));const M=i.querySelector("svg"),q=parseFloat(((W=M==null?void 0:M.getAttribute("viewBox"))==null?void 0:W.split(/[\s,]+/)[2])??"200");m=q>0?q/200:1},y=()=>(f?!f.isConnected:i.querySelector("#rra-mouth")!==null)||(c?!c.isConnected:i.querySelector("#rra-ring")!==null);v();let S=null,J=null,w=!1,u=0,L=1,F=1,N=1500+Math.random()*2e3,C=0,g=!1,D=0,H=0,V=0,I=performance.now();const K=M=>{const q=Math.min(100,M-I);I=M,y()&&v();const W=a.current,{state:E}=W,P={...Ce,...W.stateColors},O=(W.maxMouthOpening??30)*m,U=l?0:W.mouseTrackingIntensity??1,X=W.blinkIntervalMin??2e3,te=W.blinkIntervalMax??6e3,ee=W.blinkDuration??100;if(c==null||c.setAttribute("stroke",P[E]),f){const A=E==="speaking";A&&(!w||J!==W.analyser)&&(S=Y.createMouthEngine(W.analyser),J=W.analyser,w=!0),A||(w=!1);let k=0,Q=1,$=1;if(A&&S){const z=S.read();k=z.level,z.shape==="e"?(Q=1.35,$=.55):z.shape==="o"&&(Q=.65,$=1.35)}if(u+=(k-u)*.3,L+=(Q-L)*.25,F+=($-F)*.25,R){const z=o(T+u*F*O*.4,b);f.setAttribute("height",String(Math.max(T,z)))}else f.setAttribute("ry",String(T+u*F*O*.4)),f.setAttribute("rx",String(G*(1+(L-1)*Math.min(1,u*2))))}if(!l&&_.length>0){g?(C+=q/ee,C>=2&&(g=!1,C=0,N=X+Math.random()*Math.max(0,te-X))):(N-=q,N<=0&&(g=!0,C=0));const A=g?1-Math.abs(1-Math.min(2,C)):0;_.forEach((k,Q)=>k.setAttribute("height",String(A*d[Q])))}if(n.length>0){let A=s.current.x*3*U,k=s.current.y*2.2*U;E==="thinking"?(A=-2.5,k=-3):E==="working"?(A=0,k=3.5):E==="listening"&&!l&&(A+=Math.sin(M*.0021)*.5,k+=Math.cos(M*.0017)*.4),A*=m,k*=m,n.forEach((Q,$)=>{const z=B[$];j[$].x+=(A-j[$].x)*.12,j[$].y+=(k-j[$].y)*.12;const ie=z.x+o(j[$].x,z.quantize),le=z.y+o(j[$].y,z.quantize);z.isRect?(Q.setAttribute("x",String(ie)),Q.setAttribute("y",String(le))):(Q.setAttribute("cx",String(ie)),Q.setAttribute("cy",String(le)))})}h&&(D+=((E==="thinking"?1:0)-D)*.12,h.setAttribute("opacity",String(D<.01?0:D)),E==="thinking"&&!l?(H+=q*.004,p.forEach((k,Q)=>{const $=.35+.65*Math.max(0,Math.sin(H-Q*.9));k.setAttribute("opacity",String($))})):p.forEach(k=>k.setAttribute("opacity","1"))),V=requestAnimationFrame(K)};return V=requestAnimationFrame(K),()=>cancelAnimationFrame(V)},[t,l])}function ae({state:t,analyser:r,size:l=300,className:a="",style:s,maxMouthOpening:i,mouseTrackingIntensity:o,blinkIntervalMin:c,blinkIntervalMax:f,blinkDuration:h,stateColors:p,children:n}){const _=x.useRef(null);return ge(_,{state:t,analyser:r,stateColors:p,maxMouthOpening:i,mouseTrackingIntensity:o,blinkIntervalMin:c,blinkIntervalMax:f,blinkDuration:h}),e.jsx("div",{ref:_,className:`relative flex items-center justify-center ${a}`,style:{width:l,height:l,...s},children:n})}function ce({size:t=300,customization:r,mouthColor:l="#7a3b2e",className:a,style:s}){const{skinColor:i="#f5c7a9",hairColor:o="#2c2c2c",clothingColor:c="#3b7b9b",hoodieColor:f="#3a3e45",bgColor:h="#88c0b7",glasses:p=!0,glassesColor:n="#2c2c2c",headphones:_=!0,headphonesColor:R="#3a3b40"}=r??{};return e.jsxs("svg",{viewBox:"0 0 200 200",width:t,height:t,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Avatar",className:a,style:s,children:[e.jsx("circle",{cx:"100",cy:"100",r:"78",fill:h}),e.jsx("clipPath",{id:"rra-clip",children:e.jsx("circle",{cx:"100",cy:"100",r:"78"})}),e.jsxs("g",{clipPath:"url(#rra-clip)",children:[e.jsx("rect",{id:"rra-clothing",x:"48",y:"150",width:"104",height:"60",rx:"20",fill:c}),e.jsx("path",{id:"rra-hoodie",d:"M52 168 Q52 140 100 140 Q148 140 148 168 L148 210 L52 210 Z",fill:f}),e.jsx("rect",{id:"rra-neck",x:"88",y:"120",width:"24",height:"28",rx:"10",fill:i,opacity:"0.85"}),e.jsx("ellipse",{id:"rra-head",cx:"100",cy:"92",rx:"42",ry:"46",fill:i}),e.jsx("path",{id:"rra-hair",d:"M58 88 Q56 44 100 44 Q144 44 142 88 Q142 70 128 62 Q120 76 100 74 Q80 76 72 62 Q58 70 58 88 Z",fill:o}),_&&e.jsxs("g",{id:"rra-headphones",children:[e.jsx("rect",{x:"50",y:"84",width:"12",height:"26",rx:"6",fill:R}),e.jsx("rect",{x:"138",y:"84",width:"12",height:"26",rx:"6",fill:R}),e.jsx("path",{d:"M56 90 Q56 50 100 50 Q144 50 144 90",fill:"none",stroke:R,strokeWidth:"7",strokeLinecap:"round"})]}),e.jsxs("g",{id:"rra-eyeL",children:[e.jsx("ellipse",{cx:"84",cy:"90",rx:"9",ry:"7",fill:"#ffffff"}),e.jsx("circle",{className:"rra-pupil","data-base-x":"84","data-base-y":"90",cx:"84",cy:"90",r:"4",fill:"#2c2c2c"}),e.jsx("rect",{className:"rra-lid","data-max-height":"17",x:"74",y:"80",width:"20",height:"0",fill:i})]}),e.jsxs("g",{id:"rra-eyeR",children:[e.jsx("ellipse",{cx:"116",cy:"90",rx:"9",ry:"7",fill:"#ffffff"}),e.jsx("circle",{className:"rra-pupil","data-base-x":"116","data-base-y":"90",cx:"116",cy:"90",r:"4",fill:"#2c2c2c"}),e.jsx("rect",{className:"rra-lid","data-max-height":"17",x:"106",y:"80",width:"20",height:"0",fill:i})]}),p&&e.jsxs("g",{id:"rra-glasses",children:[e.jsx("rect",{x:"72",y:"82",width:"24",height:"16",rx:"6",fill:"none",stroke:n,strokeWidth:"2.5"}),e.jsx("rect",{x:"104",y:"82",width:"24",height:"16",rx:"6",fill:"none",stroke:n,strokeWidth:"2.5"}),e.jsx("line",{x1:"96",y1:"90",x2:"104",y2:"90",stroke:n,strokeWidth:"2.5"})]}),e.jsx("ellipse",{id:"rra-mouth",cx:"100",cy:"112",rx:"9",ry:"3",fill:l})]}),e.jsxs("g",{id:"rra-think",opacity:"0",children:[e.jsx("circle",{cx:"150",cy:"56",r:"4",fill:"#8b5cf6"}),e.jsx("circle",{cx:"164",cy:"44",r:"5.5",fill:"#8b5cf6"}),e.jsx("circle",{cx:"181",cy:"30",r:"7",fill:"#8b5cf6"})]})]})}function me({size:t=300,customization:r,className:l,style:a}){const{skinColor:s="#f6c8a8",hairColor:i="#5b3a23",bgColor:o="#dbe7f4"}=r??{},c=x.useId().replace(/[^a-zA-Z0-9]/g,""),f=`rra-skin-${c}`,h=`rra-bg-${c}`,p=`rra-hair-${c}`,n=`rra-mouthg-${c}`;return e.jsxs("svg",{viewBox:"0 0 200 200",width:t,height:t,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Avatar",className:l,style:a,children:[e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:f,cx:"0.38",cy:"0.32",r:"0.85",children:[e.jsx("stop",{offset:"0%",stopColor:"#ffffff",stopOpacity:"0.55"}),e.jsx("stop",{offset:"35%",stopColor:s}),e.jsx("stop",{offset:"100%",stopColor:s,stopOpacity:"1"})]}),e.jsxs("radialGradient",{id:h,cx:"0.5",cy:"0.35",r:"0.9",children:[e.jsx("stop",{offset:"0%",stopColor:"#ffffff",stopOpacity:"0.9"}),e.jsx("stop",{offset:"100%",stopColor:o})]}),e.jsxs("linearGradient",{id:p,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:i,stopOpacity:"0.85"}),e.jsx("stop",{offset:"100%",stopColor:i})]}),e.jsxs("linearGradient",{id:n,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#7c2f33"}),e.jsx("stop",{offset:"100%",stopColor:"#52181c"})]})]}),e.jsx("circle",{cx:"100",cy:"100",r:"78",fill:`url(#${h})`}),e.jsx("clipPath",{id:`rra-memoji-clip-${c}`,children:e.jsx("circle",{cx:"100",cy:"100",r:"78"})}),e.jsxs("g",{clipPath:`url(#rra-memoji-clip-${c})`,children:[e.jsx("rect",{x:"86",y:"128",width:"28",height:"30",rx:"12",fill:s}),e.jsx("ellipse",{cx:"100",cy:"178",rx:"52",ry:"28",fill:"#ffffff",opacity:"0.85"}),e.jsx("ellipse",{id:"rra-head",cx:"100",cy:"94",rx:"44",ry:"48",fill:`url(#${f})`}),e.jsx("ellipse",{cx:"100",cy:"132",rx:"20",ry:"7",fill:"#000000",opacity:"0.06"}),e.jsx("ellipse",{cx:"55",cy:"96",rx:"7",ry:"11",fill:s}),e.jsx("ellipse",{cx:"145",cy:"96",rx:"7",ry:"11",fill:s}),e.jsx("path",{id:"rra-hair",d:"M54 92 Q50 38 100 40 Q150 38 146 92 Q146 66 126 58 Q120 72 96 68 Q72 72 66 58 Q54 66 54 92 Z",fill:`url(#${p})`}),e.jsx("path",{d:"M70 76 Q82 70 92 75",fill:"none",stroke:i,strokeWidth:"4",strokeLinecap:"round",opacity:"0.9"}),e.jsx("path",{d:"M108 75 Q118 70 130 76",fill:"none",stroke:i,strokeWidth:"4",strokeLinecap:"round",opacity:"0.9"}),e.jsxs("g",{id:"rra-eyeL",children:[e.jsx("ellipse",{cx:"81",cy:"92",rx:"10.5",ry:"8.5",fill:"#ffffff"}),e.jsx("circle",{className:"rra-pupil","data-base-x":"81","data-base-y":"92",cx:"81",cy:"92",r:"5",fill:"#3d2c20"}),e.jsx("circle",{cx:"83",cy:"89.5",r:"1.7",fill:"#ffffff",opacity:"0.95"}),e.jsx("rect",{className:"rra-lid","data-max-height":"19",x:"69",y:"82",width:"24",height:"0",rx:"3",fill:s})]}),e.jsxs("g",{id:"rra-eyeR",children:[e.jsx("ellipse",{cx:"119",cy:"92",rx:"10.5",ry:"8.5",fill:"#ffffff"}),e.jsx("circle",{className:"rra-pupil","data-base-x":"119","data-base-y":"92",cx:"119",cy:"92",r:"5",fill:"#3d2c20"}),e.jsx("circle",{cx:"121",cy:"89.5",r:"1.7",fill:"#ffffff",opacity:"0.95"}),e.jsx("rect",{className:"rra-lid","data-max-height":"19",x:"107",y:"82",width:"24",height:"0",rx:"3",fill:s})]}),e.jsx("ellipse",{cx:"70",cy:"108",rx:"8",ry:"4.5",fill:"#e98a7a",opacity:"0.35"}),e.jsx("ellipse",{cx:"130",cy:"108",rx:"8",ry:"4.5",fill:"#e98a7a",opacity:"0.35"}),e.jsx("path",{d:"M97 100 Q95 108 100 110 Q105 108 103 100",fill:"none",stroke:"#c98f6f",strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.8"}),e.jsx("ellipse",{id:"rra-mouth",cx:"100",cy:"120",rx:"9.5",ry:"3.5",fill:`url(#${n})`})]}),e.jsxs("g",{id:"rra-think",opacity:"0",children:[e.jsx("circle",{cx:"150",cy:"56",r:"4",fill:"#8b5cf6"}),e.jsx("circle",{cx:"164",cy:"44",r:"5.5",fill:"#8b5cf6"}),e.jsx("circle",{cx:"181",cy:"30",r:"7",fill:"#8b5cf6"})]})]})}function ye({size:t=300,customization:r,className:l,style:a}){const{skinColor:s="#f0b58a",hairColor:i="#3a2a1e",clothingColor:o="#2f6f8f",bgColor:c="#9ad1c8"}=r??{};return e.jsxs("svg",{viewBox:"0 0 32 32",width:t,height:t,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Avatar",className:l,style:{imageRendering:"pixelated",...a},shapeRendering:"crispEdges",children:[e.jsx("rect",{x:"2",y:"2",width:"28",height:"28",fill:c}),e.jsx("rect",{id:"rra-clothing",x:"8",y:"26",width:"16",height:"4",fill:o}),e.jsx("rect",{x:"10",y:"25",width:"12",height:"1",fill:o}),e.jsx("rect",{x:"14",y:"23",width:"4",height:"3",fill:s}),e.jsx("rect",{id:"rra-head",x:"9",y:"7",width:"14",height:"16",fill:s}),e.jsxs("g",{id:"rra-hair",children:[e.jsx("rect",{x:"8",y:"4",width:"16",height:"4",fill:i}),e.jsx("rect",{x:"8",y:"8",width:"2",height:"5",fill:i}),e.jsx("rect",{x:"22",y:"8",width:"2",height:"5",fill:i}),e.jsx("rect",{x:"11",y:"8",width:"3",height:"1",fill:i}),e.jsx("rect",{x:"17",y:"8",width:"4",height:"1",fill:i})]}),e.jsxs("g",{id:"rra-eyeL",children:[e.jsx("rect",{x:"11",y:"12",width:"3",height:"2",fill:"#ffffff"}),e.jsx("rect",{className:"rra-pupil","data-base-x":"12","data-base-y":"12.5","data-quantize":"1",x:"12",y:"12.5",width:"1",height:"1",fill:"#1c1c1c"}),e.jsx("rect",{className:"rra-lid","data-max-height":"2",x:"11",y:"12",width:"3",height:"0",fill:s})]}),e.jsxs("g",{id:"rra-eyeR",children:[e.jsx("rect",{x:"18",y:"12",width:"3",height:"2",fill:"#ffffff"}),e.jsx("rect",{className:"rra-pupil","data-base-x":"19","data-base-y":"12.5","data-quantize":"1",x:"19",y:"12.5",width:"1",height:"1",fill:"#1c1c1c"}),e.jsx("rect",{className:"rra-lid","data-max-height":"2",x:"18",y:"12",width:"3",height:"0",fill:s})]}),e.jsx("rect",{x:"15",y:"15",width:"2",height:"1",fill:"#d49a72"}),e.jsx("rect",{id:"rra-mouth","data-quantize":"1",x:"13",y:"18",width:"6",height:"1",fill:"#5a1f1f"}),e.jsxs("g",{id:"rra-think",opacity:"0",children:[e.jsx("rect",{x:"24",y:"9",width:"1",height:"1",fill:"#8b5cf6"}),e.jsx("rect",{x:"26",y:"7",width:"1.5",height:"1.5",fill:"#8b5cf6"}),e.jsx("rect",{x:"28",y:"4",width:"2",height:"2",fill:"#8b5cf6"})]})]})}function je({size:t=300,customization:r,inkColor:l="#2f2a26",className:a,style:s}){const{skinColor:i="#fdf6ec",hairColor:o="#2f2a26",bgColor:c="#fffdf8"}=r??{};return e.jsxs("svg",{viewBox:"0 0 200 200",width:t,height:t,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Avatar",className:a,style:s,children:[e.jsx("circle",{cx:"100",cy:"100",r:"79",fill:c}),e.jsx("clipPath",{id:"rra-doodle-clip",children:e.jsx("circle",{cx:"100",cy:"100",r:"79"})}),e.jsxs("g",{clipPath:"url(#rra-doodle-clip)",children:[e.jsx("path",{d:"M52 182 Q60 148 100 146 Q140 148 148 182",fill:"#ffffff",stroke:l,strokeWidth:"3",strokeLinecap:"round"}),e.jsx("path",{d:"M88 150 L86 134 M112 150 L114 134",fill:"none",stroke:l,strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("path",{id:"rra-head",d:`M100 46
|
|
1
|
+
"use strict";var Qe=Object.create;var pe=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var Be=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var Ie=(t,i,l,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of Te(i))!Ce.call(t,n)&&n!==l&&pe(t,n,{get:()=>i[n],enumerable:!(a=$e(i,n))||a.enumerable});return t};var ge=(t,i,l)=>(l=t!=null?Qe(Be(t)):{},Ie(i||!t||!t.__esModule?pe(l,"default",{value:t,enumerable:!0}):l,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("react"),V=require("./useReducedMotion-BRDEmRNI.cjs"),ee=require("motion/react"),_e={idle:"#4b5563",listening:"#3b82f6",thinking:"#8b5cf6",speaking:"#10b981",working:"#f59e0b"};function me(t,i){const l=V.useReducedMotion(),a=x.useRef(i);a.current=i;const n=x.useRef({x:0,y:0});x.useEffect(()=>{if(l)return;const r=c=>{n.current.x=Math.max(-1,Math.min(1,c.clientX/window.innerWidth*2-1)),n.current.y=Math.max(-1,Math.min(1,c.clientY/window.innerHeight*2-1))};return window.addEventListener("mousemove",r),()=>window.removeEventListener("mousemove",r)},[l]),x.useEffect(()=>{const r=t.current;if(r===null||typeof window>"u")return;const c=(Q,R)=>R>0?Math.round(Q/R)*R:Q;let o=null,d=null,h=null,u=[],s=[],T=[],B=!1,I=3,U=9,v=0,m=1,_=[],f=[],w=[];const A=()=>{var C;o=r.querySelector("#rra-ring"),d=r.querySelector("#rra-mouth"),h=r.querySelector("#rra-think"),u=h?Array.from(h.querySelectorAll("circle, rect")):[],s=Array.from(r.querySelectorAll(".rra-pupil")),T=Array.from(r.querySelectorAll(".rra-lid")),B=(d==null?void 0:d.tagName.toLowerCase())==="rect",I=d?parseFloat(d.getAttribute(B?"height":"ry")??"3"):3,U=d?parseFloat(d.getAttribute(B?"width":"rx")??"9"):9,v=d?parseFloat(d.getAttribute("data-quantize")??"0"):0,_=s.map(k=>{const Z=k.tagName.toLowerCase()==="rect";return{isRect:Z,x:parseFloat(k.getAttribute("data-base-x")??k.getAttribute(Z?"x":"cx")??"0"),y:parseFloat(k.getAttribute("data-base-y")??k.getAttribute(Z?"y":"cy")??"0"),quantize:parseFloat(k.getAttribute("data-quantize")??"0")}}),f=T.map(k=>parseFloat(k.getAttribute("data-max-height")??"16")),w=s.map(()=>({x:0,y:0}));const Q=r.querySelector("svg"),R=parseFloat(((C=Q==null?void 0:Q.getAttribute("viewBox"))==null?void 0:C.split(/[\s,]+/)[2])??"200");m=R>0?R/200:1},y=()=>(d?!d.isConnected:r.querySelector("#rra-mouth")!==null)||(o?!o.isConnected:r.querySelector("#rra-ring")!==null);A();let N=null,J=null,te=!1,E=0,W=1,p=1,j=1500+Math.random()*2e3,D=0,b=!1,F=0,X=0,Y=0,q=performance.now();const z=Q=>{const R=Math.min(100,Q-q);q=Q,y()&&A();const C=a.current,{state:k}=C,Z={..._e,...C.stateColors},H=(C.maxMouthOpening??30)*m,O=l?0:C.mouseTrackingIntensity??1,ie=C.blinkIntervalMin??2e3,G=C.blinkIntervalMax??6e3,le=C.blinkDuration??100;if(o==null||o.setAttribute("stroke",Z[k]),d){const S=k==="speaking";S&&(!te||J!==C.analyser)&&(N=V.createMouthEngine(C.analyser),J=C.analyser,te=!0),S||(te=!1);let g=0,L=1,M=1;if(S&&N){const $=N.read();g=$.level,$.shape==="e"?(L=1.35,M=.55):$.shape==="o"&&(L=.65,M=1.35)}if(E+=(g-E)*.3,W+=(L-W)*.25,p+=(M-p)*.25,B){const $=c(I+E*p*H*.4,v);d.setAttribute("height",String(Math.max(I,$)))}else d.setAttribute("ry",String(I+E*p*H*.4)),d.setAttribute("rx",String(U*(1+(W-1)*Math.min(1,E*2))))}if(!l&&T.length>0){b?(D+=R/le,D>=2&&(b=!1,D=0,j=ie+Math.random()*Math.max(0,G-ie))):(j-=R,j<=0&&(b=!0,D=0));const S=b?1-Math.abs(1-Math.min(2,D)):0;T.forEach((g,L)=>g.setAttribute("height",String(S*f[L])))}if(s.length>0){let S=n.current.x*3*O,g=n.current.y*2.2*O;k==="thinking"?(S=-2.5,g=-3):k==="working"?(S=0,g=3.5):k==="listening"&&!l&&(S+=Math.sin(Q*.0021)*.5,g+=Math.cos(Q*.0017)*.4),S*=m,g*=m,s.forEach((L,M)=>{const $=_[M];w[M].x+=(S-w[M].x)*.12,w[M].y+=(g-w[M].y)*.12;const K=$.x+c(w[M].x,$.quantize),re=$.y+c(w[M].y,$.quantize);$.isRect?(L.setAttribute("x",String(K)),L.setAttribute("y",String(re))):(L.setAttribute("cx",String(K)),L.setAttribute("cy",String(re)))})}h&&(F+=((k==="thinking"?1:0)-F)*.12,h.setAttribute("opacity",String(F<.01?0:F)),k==="thinking"&&!l?(X+=R*.004,u.forEach((g,L)=>{const M=.35+.65*Math.max(0,Math.sin(X-L*.9));g.setAttribute("opacity",String(M))})):u.forEach(g=>g.setAttribute("opacity","1"))),Y=requestAnimationFrame(z)};return Y=requestAnimationFrame(z),()=>cancelAnimationFrame(Y)},[t,l])}function ae({state:t,analyser:i,size:l=300,className:a="",style:n,maxMouthOpening:r,mouseTrackingIntensity:c,blinkIntervalMin:o,blinkIntervalMax:d,blinkDuration:h,stateColors:u,children:s}){const T=x.useRef(null);return me(T,{state:t,analyser:i,stateColors:u,maxMouthOpening:r,mouseTrackingIntensity:c,blinkIntervalMin:o,blinkIntervalMax:d,blinkDuration:h}),e.jsx("div",{ref:T,className:`relative flex items-center justify-center ${a}`,style:{width:l,height:l,...n},children:s})}function ce({size:t=300,customization:i,mouthColor:l="#7a3b2e",className:a,style:n}){const{skinColor:r="#f5c7a9",hairColor:c="#2c2c2c",clothingColor:o="#3b7b9b",hoodieColor:d="#3a3e45",bgColor:h="#88c0b7",glasses:u=!0,glassesColor:s="#2c2c2c",headphones:T=!0,headphonesColor:B="#3a3b40"}=i??{};return e.jsxs("svg",{viewBox:"0 0 200 200",width:t,height:t,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Avatar",className:a,style:n,children:[e.jsx("circle",{cx:"100",cy:"100",r:"78",fill:h}),e.jsx("clipPath",{id:"rra-clip",children:e.jsx("circle",{cx:"100",cy:"100",r:"78"})}),e.jsxs("g",{clipPath:"url(#rra-clip)",children:[e.jsx("rect",{id:"rra-clothing",x:"48",y:"150",width:"104",height:"60",rx:"20",fill:o}),e.jsx("path",{id:"rra-hoodie",d:"M52 168 Q52 140 100 140 Q148 140 148 168 L148 210 L52 210 Z",fill:d}),e.jsx("rect",{id:"rra-neck",x:"88",y:"120",width:"24",height:"28",rx:"10",fill:r,opacity:"0.85"}),e.jsx("ellipse",{id:"rra-head",cx:"100",cy:"92",rx:"42",ry:"46",fill:r}),e.jsx("path",{id:"rra-hair",d:"M58 88 Q56 44 100 44 Q144 44 142 88 Q142 70 128 62 Q120 76 100 74 Q80 76 72 62 Q58 70 58 88 Z",fill:c}),T&&e.jsxs("g",{id:"rra-headphones",children:[e.jsx("rect",{x:"50",y:"84",width:"12",height:"26",rx:"6",fill:B}),e.jsx("rect",{x:"138",y:"84",width:"12",height:"26",rx:"6",fill:B}),e.jsx("path",{d:"M56 90 Q56 50 100 50 Q144 50 144 90",fill:"none",stroke:B,strokeWidth:"7",strokeLinecap:"round"})]}),e.jsxs("g",{id:"rra-eyeL",children:[e.jsx("ellipse",{cx:"84",cy:"90",rx:"9",ry:"7",fill:"#ffffff"}),e.jsx("circle",{className:"rra-pupil","data-base-x":"84","data-base-y":"90",cx:"84",cy:"90",r:"4",fill:"#2c2c2c"}),e.jsx("rect",{className:"rra-lid","data-max-height":"17",x:"74",y:"80",width:"20",height:"0",fill:r})]}),e.jsxs("g",{id:"rra-eyeR",children:[e.jsx("ellipse",{cx:"116",cy:"90",rx:"9",ry:"7",fill:"#ffffff"}),e.jsx("circle",{className:"rra-pupil","data-base-x":"116","data-base-y":"90",cx:"116",cy:"90",r:"4",fill:"#2c2c2c"}),e.jsx("rect",{className:"rra-lid","data-max-height":"17",x:"106",y:"80",width:"20",height:"0",fill:r})]}),u&&e.jsxs("g",{id:"rra-glasses",children:[e.jsx("rect",{x:"72",y:"82",width:"24",height:"16",rx:"6",fill:"none",stroke:s,strokeWidth:"2.5"}),e.jsx("rect",{x:"104",y:"82",width:"24",height:"16",rx:"6",fill:"none",stroke:s,strokeWidth:"2.5"}),e.jsx("line",{x1:"96",y1:"90",x2:"104",y2:"90",stroke:s,strokeWidth:"2.5"})]}),e.jsx("ellipse",{id:"rra-mouth",cx:"100",cy:"112",rx:"9",ry:"3",fill:l})]}),e.jsxs("g",{id:"rra-think",opacity:"0",children:[e.jsx("circle",{cx:"150",cy:"56",r:"4",fill:"#8b5cf6"}),e.jsx("circle",{cx:"164",cy:"44",r:"5.5",fill:"#8b5cf6"}),e.jsx("circle",{cx:"181",cy:"30",r:"7",fill:"#8b5cf6"})]})]})}function ye({size:t=300,customization:i,className:l,style:a}){const{skinColor:n="#f6c8a8",hairColor:r="#5b3a23",bgColor:c="#dbe7f4"}=i??{},o=x.useId().replace(/[^a-zA-Z0-9]/g,""),d=`rra-skin-${o}`,h=`rra-bg-${o}`,u=`rra-hair-${o}`,s=`rra-mouthg-${o}`;return e.jsxs("svg",{viewBox:"0 0 200 200",width:t,height:t,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Avatar",className:l,style:a,children:[e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:d,cx:"0.38",cy:"0.32",r:"0.85",children:[e.jsx("stop",{offset:"0%",stopColor:"#ffffff",stopOpacity:"0.55"}),e.jsx("stop",{offset:"35%",stopColor:n}),e.jsx("stop",{offset:"100%",stopColor:n,stopOpacity:"1"})]}),e.jsxs("radialGradient",{id:h,cx:"0.5",cy:"0.35",r:"0.9",children:[e.jsx("stop",{offset:"0%",stopColor:"#ffffff",stopOpacity:"0.9"}),e.jsx("stop",{offset:"100%",stopColor:c})]}),e.jsxs("linearGradient",{id:u,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:r,stopOpacity:"0.85"}),e.jsx("stop",{offset:"100%",stopColor:r})]}),e.jsxs("linearGradient",{id:s,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#7c2f33"}),e.jsx("stop",{offset:"100%",stopColor:"#52181c"})]})]}),e.jsx("circle",{cx:"100",cy:"100",r:"78",fill:`url(#${h})`}),e.jsx("clipPath",{id:`rra-memoji-clip-${o}`,children:e.jsx("circle",{cx:"100",cy:"100",r:"78"})}),e.jsxs("g",{clipPath:`url(#rra-memoji-clip-${o})`,children:[e.jsx("rect",{x:"86",y:"128",width:"28",height:"30",rx:"12",fill:n}),e.jsx("ellipse",{cx:"100",cy:"178",rx:"52",ry:"28",fill:"#ffffff",opacity:"0.85"}),e.jsx("ellipse",{id:"rra-head",cx:"100",cy:"94",rx:"44",ry:"48",fill:`url(#${d})`}),e.jsx("ellipse",{cx:"100",cy:"132",rx:"20",ry:"7",fill:"#000000",opacity:"0.06"}),e.jsx("ellipse",{cx:"55",cy:"96",rx:"7",ry:"11",fill:n}),e.jsx("ellipse",{cx:"145",cy:"96",rx:"7",ry:"11",fill:n}),e.jsx("path",{id:"rra-hair",d:"M54 92 Q50 38 100 40 Q150 38 146 92 Q146 66 126 58 Q120 72 96 68 Q72 72 66 58 Q54 66 54 92 Z",fill:`url(#${u})`}),e.jsx("path",{d:"M70 76 Q82 70 92 75",fill:"none",stroke:r,strokeWidth:"4",strokeLinecap:"round",opacity:"0.9"}),e.jsx("path",{d:"M108 75 Q118 70 130 76",fill:"none",stroke:r,strokeWidth:"4",strokeLinecap:"round",opacity:"0.9"}),e.jsxs("g",{id:"rra-eyeL",children:[e.jsx("ellipse",{cx:"81",cy:"92",rx:"10.5",ry:"8.5",fill:"#ffffff"}),e.jsx("circle",{className:"rra-pupil","data-base-x":"81","data-base-y":"92",cx:"81",cy:"92",r:"5",fill:"#3d2c20"}),e.jsx("circle",{cx:"83",cy:"89.5",r:"1.7",fill:"#ffffff",opacity:"0.95"}),e.jsx("rect",{className:"rra-lid","data-max-height":"19",x:"69",y:"82",width:"24",height:"0",rx:"3",fill:n})]}),e.jsxs("g",{id:"rra-eyeR",children:[e.jsx("ellipse",{cx:"119",cy:"92",rx:"10.5",ry:"8.5",fill:"#ffffff"}),e.jsx("circle",{className:"rra-pupil","data-base-x":"119","data-base-y":"92",cx:"119",cy:"92",r:"5",fill:"#3d2c20"}),e.jsx("circle",{cx:"121",cy:"89.5",r:"1.7",fill:"#ffffff",opacity:"0.95"}),e.jsx("rect",{className:"rra-lid","data-max-height":"19",x:"107",y:"82",width:"24",height:"0",rx:"3",fill:n})]}),e.jsx("ellipse",{cx:"70",cy:"108",rx:"8",ry:"4.5",fill:"#e98a7a",opacity:"0.35"}),e.jsx("ellipse",{cx:"130",cy:"108",rx:"8",ry:"4.5",fill:"#e98a7a",opacity:"0.35"}),e.jsx("path",{d:"M97 100 Q95 108 100 110 Q105 108 103 100",fill:"none",stroke:"#c98f6f",strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.8"}),e.jsx("ellipse",{id:"rra-mouth",cx:"100",cy:"120",rx:"9.5",ry:"3.5",fill:`url(#${s})`})]}),e.jsxs("g",{id:"rra-think",opacity:"0",children:[e.jsx("circle",{cx:"150",cy:"56",r:"4",fill:"#8b5cf6"}),e.jsx("circle",{cx:"164",cy:"44",r:"5.5",fill:"#8b5cf6"}),e.jsx("circle",{cx:"181",cy:"30",r:"7",fill:"#8b5cf6"})]})]})}function je({size:t=300,customization:i,className:l,style:a}){const{skinColor:n="#f0b58a",hairColor:r="#3a2a1e",clothingColor:c="#2f6f8f",bgColor:o="#9ad1c8"}=i??{};return e.jsxs("svg",{viewBox:"0 0 32 32",width:t,height:t,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Avatar",className:l,style:{imageRendering:"pixelated",...a},shapeRendering:"crispEdges",children:[e.jsx("rect",{x:"2",y:"2",width:"28",height:"28",fill:o}),e.jsx("rect",{id:"rra-clothing",x:"8",y:"26",width:"16",height:"4",fill:c}),e.jsx("rect",{x:"10",y:"25",width:"12",height:"1",fill:c}),e.jsx("rect",{x:"14",y:"23",width:"4",height:"3",fill:n}),e.jsx("rect",{id:"rra-head",x:"9",y:"7",width:"14",height:"16",fill:n}),e.jsxs("g",{id:"rra-hair",children:[e.jsx("rect",{x:"8",y:"4",width:"16",height:"4",fill:r}),e.jsx("rect",{x:"8",y:"8",width:"2",height:"5",fill:r}),e.jsx("rect",{x:"22",y:"8",width:"2",height:"5",fill:r}),e.jsx("rect",{x:"11",y:"8",width:"3",height:"1",fill:r}),e.jsx("rect",{x:"17",y:"8",width:"4",height:"1",fill:r})]}),e.jsxs("g",{id:"rra-eyeL",children:[e.jsx("rect",{x:"11",y:"12",width:"3",height:"2",fill:"#ffffff"}),e.jsx("rect",{className:"rra-pupil","data-base-x":"12","data-base-y":"12.5","data-quantize":"1",x:"12",y:"12.5",width:"1",height:"1",fill:"#1c1c1c"}),e.jsx("rect",{className:"rra-lid","data-max-height":"2",x:"11",y:"12",width:"3",height:"0",fill:n})]}),e.jsxs("g",{id:"rra-eyeR",children:[e.jsx("rect",{x:"18",y:"12",width:"3",height:"2",fill:"#ffffff"}),e.jsx("rect",{className:"rra-pupil","data-base-x":"19","data-base-y":"12.5","data-quantize":"1",x:"19",y:"12.5",width:"1",height:"1",fill:"#1c1c1c"}),e.jsx("rect",{className:"rra-lid","data-max-height":"2",x:"18",y:"12",width:"3",height:"0",fill:n})]}),e.jsx("rect",{x:"15",y:"15",width:"2",height:"1",fill:"#d49a72"}),e.jsx("rect",{id:"rra-mouth","data-quantize":"1",x:"13",y:"18",width:"6",height:"1",fill:"#5a1f1f"}),e.jsxs("g",{id:"rra-think",opacity:"0",children:[e.jsx("rect",{x:"24",y:"9",width:"1",height:"1",fill:"#8b5cf6"}),e.jsx("rect",{x:"26",y:"7",width:"1.5",height:"1.5",fill:"#8b5cf6"}),e.jsx("rect",{x:"28",y:"4",width:"2",height:"2",fill:"#8b5cf6"})]})]})}function be({size:t=300,customization:i,inkColor:l="#2f2a26",className:a,style:n}){const{skinColor:r="#fdf6ec",hairColor:c="#2f2a26",bgColor:o="#fffdf8"}=i??{};return e.jsxs("svg",{viewBox:"0 0 200 200",width:t,height:t,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Avatar",className:a,style:n,children:[e.jsx("circle",{cx:"100",cy:"100",r:"79",fill:o}),e.jsx("clipPath",{id:"rra-doodle-clip",children:e.jsx("circle",{cx:"100",cy:"100",r:"79"})}),e.jsxs("g",{clipPath:"url(#rra-doodle-clip)",children:[e.jsx("path",{d:"M52 182 Q60 148 100 146 Q140 148 148 182",fill:"#ffffff",stroke:l,strokeWidth:"3",strokeLinecap:"round"}),e.jsx("path",{d:"M88 150 L86 134 M112 150 L114 134",fill:"none",stroke:l,strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("path",{id:"rra-head",d:`M100 46
|
|
2
2
|
Q140 44 143 90
|
|
3
3
|
Q145 122 122 134
|
|
4
4
|
Q101 143 79 133
|
|
5
5
|
Q56 121 58 88
|
|
6
|
-
Q62 45 100 46 Z`,fill:
|
|
7
|
-
`).filter(l=>{const a=l.trim();if(!a)return!0;const
|
|
8
|
-
`),r=r.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1"),r=r.replace(/\[([^\]]+)\]\([^)]*\)/g,"$1"),r=r.replace(/`([^`]+)`/g,"$1"),r=r.replace(/^\s{0,3}#{1,6}\s+/gm,""),r=r.replace(/^\s{0,3}>\s?/gm,""),r=r.replace(/^\s{0,3}[-*+]\s+/gm,""),r=r.replace(/^\s{0,3}\d+\.\s+/gm,"");for(let l=0;l<2;l++)r=r.replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/__([^_]+)__/g,"$1").replace(/_([^_]+)_/g,"$1").replace(/~~([^~]+)~~/g,"$1");return r=r.replace(/[*_~]{1,3}(?=\s|$)/g,"").replace(/(^|\s)[*_~]{1,3}/g,"$1"),r=r.replace(/^\s{0,3}([-*_])\1{2,}\s*$/gm,""),r=r.replace(/\s*\n\s*/g," ").replace(/[ \t]{2,}/g," "),r.trim()}function xe(t,r={}){const l=r.maxChars??160,a=t.trim();if(a.length<=l)return a;const s=a.slice(a.length-l),i=s.search(new RegExp("(?<=[.!?…])\\s+"));if(i!==-1&&i<l*.6)return"…"+s.slice(i).trimStart();const o=s.indexOf(" "),c=o===-1?0:o+1;return"…"+s.slice(c)}function Se({text:t,maxChars:r=160,className:l="",style:a}){const s=xe(he(t??""),{maxChars:r});return s?e.jsx("div",{className:`rra-caption w-full flex justify-center pointer-events-none ${l}`,style:a,children:e.jsx(re.motion.span,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.18},role:"status","aria-live":"polite",className:"inline-block max-w-[640px] text-center text-base md:text-lg font-medium text-zinc-100 leading-relaxed px-5 py-3 rounded-2xl border border-zinc-700/40 break-words",style:{textShadow:"0px 1px 3px rgba(0,0,0,0.5)",background:"rgba(9, 9, 11, 0.8)",backdropFilter:"blur(12px)"},children:s},s)}):null}function Ee({text:t,maxChars:r=220,label:l="Thought process",className:a="",style:s}){const i=xe(he(t??""),{maxChars:r});return i?e.jsx(re.motion.div,{initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},transition:{duration:.3},className:`rra-thought w-full max-w-[420px] text-left pointer-events-none ${a}`,style:s,children:e.jsxs("div",{className:"bg-zinc-900/90 backdrop-blur-xl text-zinc-100 px-5 py-4 rounded-3xl shadow-[0_10px_30px_rgba(139,92,246,0.15)] border border-purple-500/25 text-sm italic break-words",children:[e.jsxs("div",{className:"text-purple-400 text-[10px] uppercase tracking-widest font-mono font-bold mb-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),l]}),e.jsx("p",{className:"leading-relaxed text-zinc-200",children:i})]})}):null}function Fe(t,r){return r===t?{type:"none"}:r.length>t.length&&r.startsWith(t)?{type:"push",text:r.slice(t.length)}:{type:"reset",seed:r}}function Le(t){const r=x.useRef(null);r.current===null&&(r.current=Y.createSpeechActivity());const l=x.useRef("");return x.useEffect(()=>{if(t===void 0)return;const a=r.current,s=Fe(l.current,t);s.type==="push"?a.push(s.text):s.type==="reset"&&(a.reset(),s.seed&&a.push(s.seed)),l.current=t},[t]),t===void 0?null:r.current}function Z(t,r){if(!t||!t.startsWith("#"))return t||"transparent";const l=t.replace("#","");let a=0,s=0,i=0;return l.length===3?(a=parseInt(l[0]+l[0],16),s=parseInt(l[1]+l[1],16),i=parseInt(l[2]+l[2],16)):l.length===6&&(a=parseInt(l.substring(0,2),16),s=parseInt(l.substring(2,4),16),i=parseInt(l.substring(4,6),16)),`rgba(${a}, ${s}, ${i}, ${r})`}const Ie=x.lazy(()=>Promise.resolve().then(()=>require("./VrmAvatar-g_9JGG0m.cjs")).then(t=>({default:t.VrmAvatar}))),qe=x.lazy(()=>Promise.resolve().then(()=>require("./GlbArkitAvatar-CIHx_Kop.cjs")).then(t=>({default:t.GlbArkitAvatar})));function Pe({state:t,analyser:r=null,speechActivity:l,streamingText:a,size:s=280,variant:i="geometric",children:o,vrmUrl:c,glbUrl:f,subtitle:h,thought:p,tool:n,showGlow:_=!0,showStatePill:R=!0,showThought:T=!0,showSubtitle:G=!0,className:b="",style:m,dicebearCollection:B,dicebearSeed:d,maxMouthOpening:j,blinkIntervalMin:v,blinkIntervalMax:y,blinkDuration:S,mouseTrackingIntensity:J,stateColors:w,stateLabels:u,customization:L}){const F=Le(a),N=l??F,C=N??r,g={state:t,analyser:C,size:s,maxMouthOpening:j,blinkIntervalMin:v,blinkIntervalMax:y,blinkDuration:S,mouseTrackingIntensity:J,stateColors:w,customization:L};let D;if(i==="vrm")D=e.jsx(x.Suspense,{fallback:null,children:e.jsx(Ie,{...g,vrmUrl:c})});else if(i==="glb")D=e.jsx(x.Suspense,{fallback:null,children:e.jsx(qe,{...g,glbUrl:f})});else if(i==="dicebear")D=e.jsx(Ae,{state:t,analyser:C,size:s,maxMouthOpening:j,stateColors:w,collection:B,seed:d});else if(i==="byos")D=e.jsx(ae,{...g,children:o});else{const P={geometric:ce,memoji:me,pixelart:ye,doodle:je}[i]??ce;D=e.jsx(ae,{...g,children:e.jsx(P,{size:s,customization:L,state:t})},i)}const H=re.useMotionValue(1),V=re.useMotionValue(.15),I=x.useRef(null),K=Y.useReducedMotion(),M={idle:(w==null?void 0:w.idle)??"#4b5563",listening:(w==null?void 0:w.listening)??"#3b82f6",thinking:(w==null?void 0:w.thinking)??"#8b5cf6",speaking:(w==null?void 0:w.speaking)??"#10b981",working:(w==null?void 0:w.working)??"#f59e0b"},q={idle:(u==null?void 0:u.idle)??"Idle",listening:(u==null?void 0:u.listening)??"Listening",thinking:(u==null?void 0:u.thinking)??"Thinking...",speaking:(u==null?void 0:u.speaking)??"Speaking",working:(u==null?void 0:u.working)??"Working"},W={idle:Z(M.idle,.15),listening:Z(M.listening,.35),thinking:Z(M.thinking,.4),speaking:Z(M.speaking,.45),working:Z(M.working,.4)};return x.useEffect(()=>{if(!(r&&(t==="speaking"||t==="listening"))&&!(!r&&N&&t==="speaking")){H.set(t==="thinking"||t==="working"?1.05:1),V.set(t==="thinking"||t==="working"?.35:.15),I.current&&cancelAnimationFrame(I.current);return}const O=r?new Uint8Array(r.frequencyBinCount):null,U=()=>{let X;if(r&&O){r.getByteTimeDomainData(O);let te=0;for(let ee=0;ee<O.length;ee++){const A=Math.abs(O[ee]-128);A>te&&(te=A)}X=Math.min(1,te/128)}else X=N?N.sample():0;H.set(1+X*.35),V.set(.15+X*.35),I.current=requestAnimationFrame(U)};return I.current=requestAnimationFrame(U),()=>{I.current&&cancelAnimationFrame(I.current)}},[r,N,t,H,V]),e.jsxs("div",{className:`relative flex flex-col items-center justify-center ${b}`,style:{width:s,height:s,...m},children:[_&&e.jsx(re.motion.div,{className:"absolute rounded-[1.75rem] pointer-events-none filter blur-2xl",style:{width:s*.9,height:s*.9,backgroundColor:M[t],scale:H,opacity:V}}),e.jsx("div",{className:"w-full h-full relative flex items-center justify-center z-10",children:D}),T&&p&&e.jsx("div",{className:"absolute bottom-[108%] left-1/2 -translate-x-1/2 w-[90vw] max-w-[340px] md:max-w-[420px] z-40",children:e.jsxs("div",{className:"relative",children:[e.jsx(Ee,{text:p,className:"max-w-none"}),e.jsx("div",{className:"absolute -bottom-3 left-1/2 -translate-x-1/2 w-4 h-4 bg-zinc-900/90 rounded-full border border-purple-500/20 shadow-md backdrop-blur-md"}),e.jsx("div",{className:"absolute -bottom-6 left-[48%] -translate-x-1/2 w-2.5 h-2.5 bg-zinc-900/90 rounded-full border border-purple-500/15 shadow-sm backdrop-blur-md"}),e.jsx("div",{className:"absolute -bottom-8 left-[47%] -translate-x-1/2 w-1.5 h-1.5 bg-zinc-900/90 rounded-full border border-purple-500/10 backdrop-blur-md"})]})}),R&&e.jsx(re.motion.div,{role:"status","aria-live":"polite",className:"absolute -bottom-6 px-4 py-1.5 rounded-full text-xs font-bold text-white uppercase tracking-widest shadow-lg z-30 cursor-default select-none border border-white/10",animate:{backgroundColor:M[t],boxShadow:`0 4px 14px rgba(0,0,0,0.4), 0 0 16px ${W[t]}`},transition:{duration:.3},children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`w-2 h-2 rounded-full bg-white ${!K&&(t==="speaking"||t==="thinking")?"animate-ping":""}`}),t==="working"&&n?`Working: ${n}`:q[t]]})}),G&&h&&e.jsx("div",{className:"absolute top-[115%] left-1/2 -translate-x-1/2 w-[90vw] max-w-[500px] md:max-w-[640px] z-50 pb-8",children:e.jsx(Se,{text:h})})]})}function ze({size:t="100%",customization:r,state:l,className:a,style:s}){const{skinColor:i="#cf6b34",bgColor:o="#6fb3bd"}=r??{},[c,f]=x.useState(()=>Math.random()<.5?"wires":"paper"),h=x.useRef(l);return x.useEffect(()=>{l==="working"&&h.current!=="working"&&f(Math.random()<.5?"wires":"paper"),h.current=l},[l]),e.jsxs("svg",{viewBox:"0 0 200 200",width:t,height:t,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Avatar",className:a,style:s,children:[e.jsx("circle",{cx:"100",cy:"100",r:"79",fill:o}),e.jsx("clipPath",{id:"rra-squirrel-clip",children:e.jsx("circle",{cx:"100",cy:"100",r:"79"})}),e.jsxs("g",{clipPath:"url(#rra-squirrel-clip)",children:[e.jsx("path",{d:"M150 158 C182 150 188 96 162 66 C150 52 130 52 124 66 C140 70 150 92 146 110 C142 132 132 148 150 158 Z",fill:i}),e.jsx("path",{d:"M150 150 C172 142 176 100 156 76 C150 90 156 104 152 120 C148 134 140 142 150 150 Z",fill:"#e3a368"}),e.jsx("path",{d:"M84 118 Q82 140 78 150 L122 150 Q118 140 116 118 Z",fill:i}),e.jsx("path",{d:"M85 122 Q100 133 115 122 Q100 129 85 122 Z",fill:"#b05418",opacity:"0.55"}),e.jsx("path",{d:"M36 182 Q42 148 72 144 Q86 158 100 158 Q114 158 128 144 Q158 148 164 182 Z",fill:"#2b2f36"}),e.jsx("path",{d:"M78 146 Q100 156 122 146",fill:"none",stroke:"#3c424b",strokeWidth:"3",strokeLinecap:"round"}),e.jsx("path",{d:"M88 152 L100 182 L112 152 Z",fill:"#1f6fb0"}),e.jsxs("g",{stroke:"#6cc0ee",strokeWidth:"1.1",fill:"none",opacity:"0.85",children:[e.jsx("path",{d:"M100 158 L100 178 M94 164 L106 164 M97 172 L103 172"}),e.jsx("circle",{cx:"100",cy:"162",r:"1.4",fill:"#6cc0ee",stroke:"none"})]}),e.jsx("path",{d:"M96 150 L94 170 M104 150 L106 170",stroke:"#e9eef2",strokeWidth:"1.6",strokeLinecap:"round",fill:"none"}),e.jsxs("g",{id:"rra-squirrel-head",transform:l==="thinking"?"rotate(6 100 120)":void 0,children:[e.jsx("path",{d:"M66 80 L58 42 Q74 50 86 72 Z",fill:i}),e.jsx("path",{d:"M134 80 L142 42 Q126 50 114 72 Z",fill:i}),e.jsx("path",{d:"M68 74 L63 52 Q72 56 80 70 Z",fill:"#a8451c"}),e.jsx("path",{d:"M132 74 L137 52 Q128 56 120 70 Z",fill:"#a8451c"}),e.jsxs("g",{stroke:"#f0d9b8",strokeWidth:"1.4",strokeLinecap:"round",fill:"none",children:[e.jsx("path",{d:"M60 46 L57 38 M63 47 L62 39 M66 49 L66 41"}),e.jsx("path",{d:"M140 46 L143 38 M137 47 L138 39 M134 49 L134 41"})]}),e.jsx("ellipse",{cx:"100",cy:"98",rx:"40",ry:"37",fill:i}),e.jsx("path",{d:"M62 96 Q54 90 58 100 Q56 108 64 106 Z",fill:i}),e.jsx("path",{d:"M138 96 Q146 90 142 100 Q144 108 136 106 Z",fill:i}),e.jsx("ellipse",{cx:"100",cy:"112",rx:"23",ry:"18",fill:"#ecc090"}),e.jsx("path",{d:"M64 78 Q60 50 86 46 Q78 54 82 60 Q92 44 110 48 Q102 56 106 60 Q120 50 134 74 Q124 62 112 66 Q100 56 88 66 Q76 64 64 78 Z",fill:"#3a2820"}),e.jsxs("g",{stroke:"#5a3a22",strokeWidth:"3",strokeLinecap:"round",fill:"none",children:[e.jsx("path",{d:"M70 80 Q78 75 88 79"}),e.jsx("path",{d:"M112 79 Q122 75 130 80"})]}),e.jsxs("g",{stroke:"#1a1a1a",strokeWidth:"3",fill:"none",children:[e.jsx("path",{d:"M95 92 Q100 89 105 92"}),e.jsx("path",{d:"M69 90 L60 86"}),e.jsx("path",{d:"M131 90 L140 86"})]}),e.jsx("circle",{cx:"82",cy:"92",r:"13.5",fill:"#fbf7ef",stroke:"#1a1a1a",strokeWidth:"3"}),e.jsx("circle",{cx:"118",cy:"92",r:"13.5",fill:"#fbf7ef",stroke:"#1a1a1a",strokeWidth:"3"}),e.jsxs("g",{children:[e.jsx("ellipse",{cx:"82",cy:"93",rx:"8",ry:"8.5",fill:"#ffffff"}),e.jsx("g",{transform:l==="thinking"?"translate(5, 0)":void 0,children:e.jsx("circle",{className:"rra-pupil","data-base-x":82,"data-base-y":93,cx:"82",cy:"93",r:"4.6",fill:"#2b1b12"})}),e.jsx("circle",{cx:"84",cy:"90",r:"1.5",fill:"#ffffff"}),e.jsx("rect",{className:"rra-lid","data-max-height":"18",x:"73",y:"83",width:"18",height:"0",fill:i})]}),e.jsxs("g",{children:[e.jsx("ellipse",{cx:"118",cy:"93",rx:"8",ry:"8.5",fill:"#ffffff"}),e.jsx("g",{transform:l==="thinking"?"translate(5, 0)":void 0,children:e.jsx("circle",{className:"rra-pupil","data-base-x":118,"data-base-y":93,cx:"118",cy:"93",r:"4.6",fill:"#2b1b12"})}),e.jsx("circle",{cx:"120",cy:"90",r:"1.5",fill:"#ffffff"}),e.jsx("rect",{className:"rra-lid","data-max-height":"18",x:"109",y:"83",width:"18",height:"0",fill:i})]}),l==="working"&&c==="wires"&&e.jsxs("g",{id:"rra-safety-goggles",children:[e.jsx("path",{d:"M 52 92 C 45 92, 45 96, 40 96 M 148 92 C 155 92, 155 96, 160 96",fill:"none",stroke:"#2d3748",strokeWidth:"4",strokeLinecap:"round"}),e.jsx("rect",{x:"58",y:"78",width:"84",height:"28",rx:"14",fill:"none",stroke:"#e2e8f0",strokeWidth:"4"}),e.jsx("rect",{x:"60",y:"80",width:"80",height:"24",rx:"12",fill:"#e0f2fe",fillOpacity:"0.15"}),e.jsx("circle",{cx:"56",cy:"92",r:"3",fill:"#475569"}),e.jsx("circle",{cx:"144",cy:"92",r:"3",fill:"#475569"})]}),e.jsx("path",{d:"M93 107 Q100 101 107 107 Q100 113 93 107 Z",fill:"#7a4a32"}),e.jsx("path",{d:"M100 113 L100 118",stroke:"#7a4a32",strokeWidth:"1.6",strokeLinecap:"round"}),e.jsx("ellipse",{id:"rra-mouth",cx:"100",cy:"121",rx:"7",ry:"2.3",fill:"#5a3324"}),e.jsx("g",{stroke:"#caa074",strokeWidth:"1",strokeLinecap:"round",opacity:"0.8",fill:"none",children:e.jsx("path",{d:"M80 116 L62 113 M80 120 L62 121 M120 116 L138 113 M120 120 L138 121"})}),l==="thinking"&&e.jsxs("g",{id:"rra-thinking-hand",children:[e.jsx("path",{d:"M136 182 L112 144 L124 138 L152 182 Z",fill:"#2b2f36",stroke:"#1e293b",strokeWidth:"1.2"}),e.jsxs("g",{fill:i,stroke:"#b05418",strokeWidth:"1.2",strokeLinejoin:"round",strokeLinecap:"round",children:[e.jsx("path",{d:"M112 144 C110 138, 107 130, 105 124 C104 121, 108 121, 109 124 C111 130, 113 136, 115 141"}),e.jsx("path",{d:"M115 141 C117 139, 120 140, 119 143 C121 142, 123 144, 121 147 C122 147, 123 149, 121 151 C120 152, 116 150, 115 145"}),e.jsx("path",{d:"M110 139 C104 139, 96 135, 92 132 C90 130, 93 128, 95 130 C100 133, 106 135, 110 136"})]})]})]}),l==="working"&&c==="wires"&&e.jsxs("g",{id:"rra-working-workspace-wires",children:[e.jsx("circle",{cx:"100",cy:"162",r:"22",fill:"#fef08a",fillOpacity:"0.25",children:e.jsx("animate",{attributeName:"opacity",values:"1;0.2;0.9;0.1;0.8;0.3;1",dur:"1.2s",repeatCount:"indefinite"})}),e.jsx("rect",{x:"94",y:"172",width:"12",height:"8",fill:"#94a3b8",rx:"1"}),e.jsx("rect",{x:"96",y:"175",width:"8",height:"2",fill:"#64748b"}),e.jsx("path",{d:"M92 165 C92 153, 108 153, 108 165 C108 171, 104 172, 104 174 L96 174 C96 172, 92 171, 92 165 Z",fill:"#fef08a",stroke:"#ca8a04",strokeWidth:"1.5",children:e.jsx("animate",{attributeName:"fill",values:"#fef08a;#fef08a;#78350f;#fef08a;#fef08a;#78350f;#fef08a",dur:"1.2s",repeatCount:"indefinite"})}),e.jsx("path",{d:"M97 167 L99 160 L101 160 L103 167",fill:"none",stroke:"#ca8a04",strokeWidth:"1",children:e.jsx("animate",{attributeName:"stroke",values:"#ca8a04;#ca8a04;#78350f;#ca8a04;#ca8a04;#78350f;#ca8a04",dur:"1.2s",repeatCount:"indefinite"})}),e.jsxs("g",{id:"rra-left-arm-cable",children:[e.jsx("animateTransform",{attributeName:"transform",type:"translate",values:"0,0; -0.6,0.3; 0.4,-0.2; -0.3,-0.5; 0,0",dur:"0.18s",repeatCount:"indefinite"}),e.jsx("path",{d:"M36 182 L55 162 L64 168 L45 182 Z",fill:"#2b2f36",stroke:"#1e293b",strokeWidth:"1"}),e.jsx("path",{d:"M 45 180 C 45 165, 80 170, 94 174",fill:"none",stroke:"#ef4444",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsxs("g",{fill:i,stroke:"#b05418",strokeWidth:"1",children:[e.jsx("rect",{x:"58",y:"160",width:"10",height:"12",rx:"4",transform:"rotate(-10 63 166)"}),e.jsx("rect",{x:"62",y:"163",width:"9",height:"10",rx:"3",transform:"rotate(-15 66.5 168)"})]})]}),e.jsxs("g",{id:"rra-right-arm-cable",children:[e.jsx("animateTransform",{attributeName:"transform",type:"translate",values:"0,0; 0.5,-0.3; -0.4,0.2; 0.3,0.4; 0,0",dur:"0.15s",repeatCount:"indefinite"}),e.jsx("path",{d:"M164 182 L145 162 L136 168 L155 182 Z",fill:"#2b2f36",stroke:"#1e293b",strokeWidth:"1"}),e.jsx("path",{d:"M 155 180 C 155 165, 120 170, 106 174",fill:"none",stroke:"#1e293b",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsxs("g",{fill:i,stroke:"#b05418",strokeWidth:"1",children:[e.jsx("rect",{x:"132",y:"160",width:"10",height:"12",rx:"4",transform:"rotate(10 137 166)"}),e.jsx("rect",{x:"129",y:"163",width:"9",height:"10",rx:"3",transform:"rotate(15 133.5 168)"})]})]})]}),l==="working"&&c==="paper"&&e.jsxs("g",{id:"rra-working-workspace-paper",children:[e.jsx("animateTransform",{attributeName:"transform",type:"translate",values:"0,0; 0,1; 0,0; 0,1; 0,0",dur:"3.2s",repeatCount:"indefinite"}),e.jsx("path",{d:"M36 182 L54 168 L64 176 L48 182 Z",fill:"#2b2f36",stroke:"#1e293b",strokeWidth:"1"}),e.jsx("path",{d:"M164 182 L146 168 L136 176 L152 182 Z",fill:"#2b2f36",stroke:"#1e293b",strokeWidth:"1"}),e.jsx("path",{d:"M50 118 C 66 120 84 128 100 134 C 116 128 134 120 150 118 L 148 124 C 134 126 116 134 100 150 C 84 134 66 126 52 124 Z",fill:"#f8fafc",stroke:"#d9d2c4",strokeWidth:"1"}),e.jsxs("g",{stroke:"#9aa4b2",strokeWidth:"1.1",strokeLinecap:"round",children:[e.jsx("line",{x1:"60",y1:"124",x2:"92",y2:"137"}),e.jsx("line",{x1:"140",y1:"124",x2:"108",y2:"137"})]}),e.jsx("path",{d:"M100 148 C 84 136 68 130 52 126 L 60 182 C 78 178 90 177 100 176 Z",fill:"#20242b",stroke:"#0f1216",strokeWidth:"1.5"}),e.jsx("path",{d:"M100 148 C 116 136 132 130 148 126 L 140 182 C 122 178 110 177 100 176 Z",fill:"#20242b",stroke:"#0f1216",strokeWidth:"1.5"}),e.jsx("line",{x1:"100",y1:"134",x2:"100",y2:"176",stroke:"#0f1216",strokeWidth:"1.4"}),e.jsxs("g",{fill:i,stroke:"#b05418",strokeWidth:"1",children:[e.jsx("circle",{cx:"60",cy:"180",r:"7"}),e.jsx("rect",{x:"57",y:"170",width:"7",height:"12",rx:"3"}),e.jsx("rect",{x:"62",y:"172",width:"7",height:"11",rx:"3"}),e.jsx("rect",{x:"67",y:"173",width:"6",height:"10",rx:"3"})]}),e.jsxs("g",{fill:i,stroke:"#b05418",strokeWidth:"1",children:[e.jsx("circle",{cx:"140",cy:"180",r:"7"}),e.jsx("rect",{x:"136",y:"170",width:"7",height:"12",rx:"3"}),e.jsx("rect",{x:"131",y:"172",width:"7",height:"11",rx:"3"}),e.jsx("rect",{x:"127",y:"173",width:"6",height:"10",rx:"3"})]})]})]}),e.jsxs("g",{id:"rra-think",opacity:"0",children:[e.jsx("circle",{cx:"150",cy:"54",r:"4",fill:"#ffffff",stroke:"#8b5cf6",strokeWidth:"2"}),e.jsx("circle",{cx:"165",cy:"42",r:"5.5",fill:"#ffffff",stroke:"#8b5cf6",strokeWidth:"2"}),e.jsx("circle",{cx:"182",cy:"28",r:"7",fill:"#ffffff",stroke:"#8b5cf6",strokeWidth:"2.5"})]})]})}function Ze({collection:t,seed:r,size:l=44,className:a=""}){const[s,i]=x.useState(null);return x.useEffect(()=>{let o=!1;return i(null),Me(t,r).then(c=>{o||i(c)}).catch(()=>{o||i(null)}),()=>{o=!0}},[t,r]),e.jsx("div",{className:`flex items-center justify-center overflow-hidden ${a}`,style:{width:l,height:l},"aria-hidden":!0,children:s?e.jsx("div",{className:"w-full h-full [&>svg]:w-full [&>svg]:h-full",dangerouslySetInnerHTML:{__html:s}}):e.jsx("div",{className:"w-full h-full rounded-md bg-zinc-800/40 animate-pulse"})})}function Oe({analyser:t,state:r,height:l=80,className:a="",style:s,stateColors:i}){const o=x.useRef(null),c=x.useRef(null),f=x.useRef(0),h={idle:(i==null?void 0:i.idle)??"#9ca3af",listening:(i==null?void 0:i.listening)??"#3b82f6",thinking:(i==null?void 0:i.thinking)??"#8b5cf6",speaking:(i==null?void 0:i.speaking)??"#10b981",working:(i==null?void 0:i.working)??"#f59e0b"};return x.useEffect(()=>{const p=o.current;if(!p)return;const n=p.getContext("2d");if(!n)return;const _=()=>{const b=window.devicePixelRatio||1,m=p.getBoundingClientRect();p.width=m.width*b,p.height=m.height*b,n.scale(b,b)};_(),window.addEventListener("resize",_);let R=0,T=new Uint8Array(0);t&&(t.fftSize=128,R=t.frequencyBinCount,T=new Uint8Array(R));const G=()=>{const b=p.width/(window.devicePixelRatio||1),m=p.height/(window.devicePixelRatio||1);n.fillStyle="rgba(9, 9, 11, 0.2)",n.fillRect(0,0,b,m),f.current+=.05;const B=f.current;if(r==="speaking"&&t){t.getByteFrequencyData(T),n.lineWidth=3,n.strokeStyle=h.speaking,n.shadowBlur=15,n.shadowColor=Z(h.speaking,.6),n.beginPath();const d=b/R;let j=0;for(let v=0;v<R;v++){const y=T[v]/255,S=m/2+Math.sin(v*.15+B*2)*(y*m*.4);v===0?n.moveTo(j,S):n.lineTo(j,S),j+=d}n.lineTo(b,m/2),n.stroke(),n.shadowBlur=0}else if(r==="listening"){let d=0;if(t&&T.length>0){t.getByteTimeDomainData(T);let y=0;for(let S=0;S<T.length;S++){const J=Math.abs(T[S]-128);J>y&&(y=J)}d=Math.min(1,y/128)}const j=4+d*36,v=3+d*27;n.shadowBlur=12,n.lineWidth=2.5,n.strokeStyle=Z(h.listening,.7),n.shadowColor=Z(h.listening,.4),n.beginPath();for(let y=0;y<b;y++){const S=m/2+Math.sin(y*.02+B*1.5)*Math.sin(y*.005)*j;y===0?n.moveTo(y,S):n.lineTo(y,S)}n.stroke(),n.strokeStyle=Z(h.listening,.5),n.shadowColor=Z(h.listening,.3),n.beginPath();for(let y=0;y<b;y++){const S=m/2+Math.sin(y*.015-B*1.2+Math.PI)*Math.sin(y*.005)*v;y===0?n.moveTo(y,S):n.lineTo(y,S)}n.stroke(),n.shadowBlur=0}else if(r==="thinking"){n.shadowBlur=10,n.shadowColor=Z(h.thinking,.4),n.lineWidth=2,n.strokeStyle=Z(h.thinking,.7),n.beginPath();for(let d=0;d<b;d++){const j=m/2+Math.sin(d*.03+B)*5+Math.sin(d*.01-B*.5)*8;d===0?n.moveTo(d,j):n.lineTo(d,j)}n.stroke(),n.shadowBlur=0}else if(r==="working"){n.shadowBlur=10,n.shadowColor=Z(h.working,.4),n.lineWidth=2,n.strokeStyle=Z(h.working,.7),n.beginPath();for(let d=0;d<b;d+=8){const j=m/2+Math.sin(d*.04+B*2.5)*12+Math.cos(d*.01-B)*6,v=m/2+Math.round((j-m/2)/6)*6;d===0?n.moveTo(d,v):(n.lineTo(d,v),n.lineTo(Math.min(b,d+8),v))}n.stroke(),n.shadowBlur=0}else{n.lineWidth=1.5,n.strokeStyle=Z(h.idle,.3),n.beginPath();for(let d=0;d<b;d++){const j=m/2+Math.sin(d*.01+B*.2)*2;d===0?n.moveTo(d,j):n.lineTo(d,j)}n.stroke()}c.current=requestAnimationFrame(G)};return G(),()=>{window.removeEventListener("resize",_),c.current&&cancelAnimationFrame(c.current)}},[t,r,i]),e.jsxs("div",{className:`w-full bg-zinc-950/80 border border-zinc-800/40 rounded-xl overflow-hidden p-2 ${a}`,style:s,children:[e.jsxs("div",{className:"flex justify-between items-center px-2 mb-1",children:[e.jsx("span",{className:"text-[10px] text-zinc-500 uppercase tracking-widest font-mono font-bold",children:"Audio Waveform Telemetry"}),e.jsxs("span",{className:"flex h-2 w-2 relative",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:h[r]}}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2",style:{backgroundColor:h[r]}})]})]}),e.jsx("canvas",{ref:o,className:"w-full block",style:{height:l}})]})}function Ge({analyser:t,enabled:r,onFrame:l,onStop:a}){const s=x.useRef(l),i=x.useRef(a);s.current=l,i.current=a,x.useEffect(()=>{var h;if(!r){(h=i.current)==null||h.call(i);return}const o=Y.createMouthEngine(t);let c;const f=()=>{s.current(o.read()),c=requestAnimationFrame(f)};return c=requestAnimationFrame(f),()=>{var p;cancelAnimationFrame(c),(p=i.current)==null||p.call(i)}},[t,r])}exports.SPEECH_ACTIVITY_BRAND=Y.SPEECH_ACTIVITY_BRAND;exports.createMouthEngine=Y.createMouthEngine;exports.createSpeechActivity=Y.createSpeechActivity;exports.isSpeechActivity=Y.isSpeechActivity;exports.useReducedMotion=Y.useReducedMotion;exports.AudioVisualizer=Oe;exports.AvatarCaption=Se;exports.AvatarThought=Ee;exports.ContractAvatar=ae;exports.DEFAULT_DICEBEAR_COLLECTION=we;exports.DEFAULT_DICEBEAR_SEED=ve;exports.DICEBEAR_FEATURED_FACES=de;exports.DICEBEAR_RIGS=be;exports.DICEBEAR_STYLES=ke;exports.DICEBEAR_STYLE_BY_ID=De;exports.DiceBearAvatar=Ae;exports.DiceBearThumb=Ze;exports.DoodleAvatar=je;exports.GeometricAvatar=ce;exports.MemojiAvatar=me;exports.PixelArtAvatar=ye;exports.RealtimeAvatar=Pe;exports.SquirrelAvatar=ze;exports.collectionExportName=se;exports.loadDiceBear=fe;exports.renderDiceBearSvg=Me;exports.scopeSvgIds=oe;exports.tailWindow=xe;exports.toPlainText=he;exports.useAudioMouth=Ge;exports.useAvatarRuntime=ge;exports.useStreamingTextActivity=Le;
|
|
6
|
+
Q62 45 100 46 Z`,fill:r,stroke:l,strokeWidth:"3.5",strokeLinecap:"round"}),e.jsxs("g",{id:"rra-hair",fill:"none",stroke:c,strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("path",{d:"M62 84 Q58 52 88 47 Q72 56 74 64 Q80 50 104 46 Q92 54 96 60 Q106 48 126 52 Q116 58 120 64 Q130 56 140 78 Q132 66 122 68"}),e.jsx("path",{d:"M66 76 Q70 62 82 58",opacity:"0.7"}),e.jsx("path",{d:"M118 56 Q130 62 134 76",opacity:"0.7"})]}),e.jsx("path",{d:"M70 80 Q80 74 90 78",fill:"none",stroke:l,strokeWidth:"3",strokeLinecap:"round"}),e.jsx("path",{d:"M110 78 Q120 74 130 80",fill:"none",stroke:l,strokeWidth:"3",strokeLinecap:"round"}),e.jsxs("g",{id:"rra-eyeL",children:[e.jsx("ellipse",{cx:"82",cy:"92",rx:"9",ry:"7.5",fill:"#ffffff",stroke:l,strokeWidth:"2.5"}),e.jsx("circle",{className:"rra-pupil","data-base-x":"82","data-base-y":"92",cx:"82",cy:"92",r:"3.4",fill:l}),e.jsx("rect",{className:"rra-lid","data-max-height":"17",x:"72",y:"83",width:"20",height:"0",fill:r})]}),e.jsxs("g",{id:"rra-eyeR",children:[e.jsx("ellipse",{cx:"118",cy:"92",rx:"9",ry:"7.5",fill:"#ffffff",stroke:l,strokeWidth:"2.5"}),e.jsx("circle",{className:"rra-pupil","data-base-x":"118","data-base-y":"92",cx:"118",cy:"92",r:"3.4",fill:l}),e.jsx("rect",{className:"rra-lid","data-max-height":"17",x:"108",y:"83",width:"20",height:"0",fill:r})]}),e.jsx("path",{d:"M99 100 Q96 110 103 112",fill:"none",stroke:l,strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("ellipse",{id:"rra-mouth",cx:"100",cy:"122",rx:"9",ry:"2.5",fill:"#3a2e28",stroke:l,strokeWidth:"2"}),e.jsx("path",{d:"M64 106 L70 102 M67 110 L73 106",stroke:l,strokeWidth:"1.5",strokeLinecap:"round",opacity:"0.45"})]}),e.jsxs("g",{id:"rra-think",opacity:"0",children:[e.jsx("circle",{cx:"150",cy:"56",r:"4",fill:"#ffffff",stroke:"#8b5cf6",strokeWidth:"2"}),e.jsx("circle",{cx:"164",cy:"44",r:"5.5",fill:"#ffffff",stroke:"#8b5cf6",strokeWidth:"2"}),e.jsx("circle",{cx:"181",cy:"30",r:"7",fill:"#ffffff",stroke:"#8b5cf6",strokeWidth:"2.5"})]})]})}function ne(t){return t.replace(/-([a-z])/g,(i,l)=>l.toUpperCase())}const ke=[["pixel-art","Pixel Art"],["pixel-art-neutral","Pixel Art Neutral"],["lorelei","Lorelei"],["lorelei-neutral","Lorelei Neutral"],["notionists","Notionists"],["notionists-neutral","Notionists Neutral"],["open-peeps","Open Peeps"],["thumbs","Thumbs"]].map(([t,i])=>({id:t,exportName:ne(t),label:i,license:"CC0 1.0"}));function oe(t,i){const l=new Set,a=/\bid="([^"]+)"/g;let n;for(;n=a.exec(t);)l.add(n[1]);let r=t;for(const c of l){const o=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");r=r.replace(new RegExp(`id="${o}"`,"g"),`id="${i}-${c}"`).replace(new RegExp(`url\\(#${o}\\)`,"g"),`url(#${i}-${c})`).replace(new RegExp(`(xlink:href|href)="#${o}"`,"g"),`$1="#${i}-${c}"`)}return r}const we={"pixel-art":{part:"mouth",visemes:["happy01","happy11","happy12"]},"pixel-art-neutral":{part:"mouth",visemes:["happy01","happy11","happy12"]},lorelei:{part:"mouth",visemes:["happy01","happy08","happy06"]},"lorelei-neutral":{part:"mouth",visemes:["happy01","happy08","happy06"]},notionists:{part:"lips",visemes:["variant23","variant26","variant30"],blink:{open:"variant03",closed:"variant01"}},"notionists-neutral":{part:"lips",visemes:["variant23","variant26","variant30"],blink:{open:"variant03",closed:"variant01"}},thumbs:{part:"mouth",visemes:["variant3","variant1","variant2"]},"open-peeps":{part:"face",visemes:["calm","smile","smileBig"],faceBlink:"eyesClosed"}},de=[{collection:"notionists",seed:"lg9gf48i"},{collection:"notionists",seed:"8c1jvg09"},{collection:"notionists",seed:"glk0g9uv"},{collection:"notionists",seed:"pp70crp6"},{collection:"open-peeps",seed:"2ehwdy6e"},{collection:"open-peeps",seed:"1q3sb396"},{collection:"open-peeps",seed:"k8adqmt7"},{collection:"open-peeps",seed:"x6kn3bke"},{collection:"lorelei",seed:"b2wi3z2j"},{collection:"lorelei",seed:"lp1iegj9"},{collection:"lorelei",seed:"6umh2s52"},{collection:"pixel-art",seed:"smmje3r6"},{collection:"pixel-art",seed:"wxhz14w1"},{collection:"pixel-art",seed:"uovelmrj"}],ve=de[0].collection,Me=de[0].seed,De=Object.fromEntries(ke.map(t=>[t.id,t]));let se=null;function fe(){return se||(se=Promise.all([import("@dicebear/core"),import("@dicebear/collection")]).then(([t,i])=>({createAvatar:t.createAvatar,collection:i}))),se}async function Ae(t,i,l={}){const{createAvatar:a,collection:n}=await fe(),r=n[ne(String(t))];if(!r)throw new Error(`Unknown DiceBear style "${t}"`);return a(r,{seed:i,...l}).toString()}function Fe(t,i,l,a,n){const r=[],c=(o,d)=>r.push({key:o,html:oe(t(i,{...l,...d}).toString(),`${n}-${o}`)});if(a.part==="face")a.visemes.forEach((o,d)=>c(`m${d}`,{face:[o]})),a.faceBlink&&c("blink",{face:[a.faceBlink]});else{const o=a.blink?[["o",{eyes:[a.blink.open]}],["c",{eyes:[a.blink.closed]}]]:[["o",{}]];a.visemes.forEach((d,h)=>{for(const[u,s]of o)c(`m${h}-${u}`,{[a.part]:[d],...s})})}return r}function Ne({state:t,analyser:i,size:l=300,collection:a=ve,seed:n=Me,backgroundColor:r,radius:c,className:o="",style:d,maxMouthOpening:h=30,stateColors:u}){const s=V.useReducedMotion(),B=`rra-db-${x.useId().replace(/[^a-zA-Z0-9]/g,"")}`,I=x.useRef(null),U=x.useRef(new Map),v=x.useRef(null),[m,_]=x.useState(null),[f,w]=x.useState(null),[A,y]=x.useState(null),N=x.useRef({state:t,analyser:i,maxMouthOpening:h});N.current={state:t,analyser:i,maxMouthOpening:h};const J=(r==null?void 0:r.join(","))??"";x.useEffect(()=>{let E=!1;return _(null),y(null),fe().then(({createAvatar:W,collection:p})=>{if(E)return;const j=p[ne(String(a))];if(!j){y(`Unknown DiceBear style "${a}"`);return}const D={seed:n};r&&r.length&&(D.backgroundColor=r),c!=null&&(D.radius=c);const b=we[String(a)]??null;U.current=new Map,b?(w(b),_(Fe(W,j,D,b,B))):(w(null),_([{key:"base",html:oe(W(j,D).toString(),`${B}-base`)}]))}).catch(W=>{if(E)return;const p=(W==null?void 0:W.message)||String(W);y(/Cannot find module|Failed to (resolve|fetch)|dicebear/i.test(p)?"missing":p)}),()=>{E=!0}},[a,n,c,J]),x.useEffect(()=>{const E=I.current;if(!E||!m||m.length===0||typeof window>"u")return;const W=U.current,p=!!(f&&(f.blink||f.faceBlink));let j=null,D=null,b=0,F=0,X=1500+Math.random()*2500,Y=0,q=!1,z=0,Q="",R=performance.now();const C=Z=>{if(Z===Q)return;const H=W.get(Z)??W.get(m[0].key);W.forEach(O=>{O.style.visibility=O===H?"visible":"hidden"}),Q=Z},k=Z=>{const H=Math.min(100,Z-R);R=Z;const{state:O,analyser:ie,maxMouthOpening:G}=N.current,le=O==="speaking",S=G/30;if(le?((!j||D!==ie)&&(j=V.createMouthEngine(ie),D=ie),b+=(j.read().level-b)*.3):(j=null,D=null,b+=(0-b)*.25),p&&!s&&(q?(Y+=H,Y>=160&&(q=!1,X=1800+Math.random()*3500)):(X-=H,X<=0&&(q=!0,Y=0))),f){let g=z;if(z===0?b>.07&&(g=b>.22?2:1):z===1?b>.22?g=2:b<.05&&(g=0):b<.06?g=0:b<.18&&(g=1),z=le?g:0,f.part==="face")C(q&&f.faceBlink?"blink":`m${z}`);else{const We=q&&f.blink?"c":"o";C(`m${z}-${We}`)}let L=0,M=0;s||(F+=H*.002,L=Math.sin(F)*.008,O==="listening"&&(M=Math.sin(F*1.6)*1.2));const $=b*4*S,K=1+b*.04*S+L,re=1-b*.02*S+L;E.style.transform=`translateY(${(-$+M).toFixed(2)}px) scale(${re.toFixed(4)}, ${K.toFixed(4)})`}else{let g=0;s||(F+=H*.002,g=Math.sin(F)*.012);const L=b*10*S,M=1+b*.1*S+g,$=1-b*.05*S+g,K=O==="thinking"&&!s?-4:0;E.style.transform=`translateY(${(-L).toFixed(2)}px) scale(${$.toFixed(4)}, ${M.toFixed(4)}) rotate(${K}deg)`}v.current=requestAnimationFrame(k)};return E.style.transformOrigin="center bottom",v.current=requestAnimationFrame(k),()=>{v.current&&cancelAnimationFrame(v.current)}},[m,f,s]);const te=(u==null?void 0:u[t])??"#10b981";return e.jsxs("div",{className:`relative flex items-center justify-center ${o}`,style:{width:l,height:l,...d},children:[m&&e.jsx("div",{ref:I,className:"relative w-full h-full",role:"img","aria-label":"Avatar",children:m.map((E,W)=>e.jsx("div",{ref:p=>{p?U.current.set(E.key,p):U.current.delete(E.key)},dangerouslySetInnerHTML:{__html:E.html},className:"absolute inset-0 [&>svg]:w-full [&>svg]:h-full",style:{visibility:W===0?"visible":"hidden"}},E.key))}),!m&&!A&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("div",{className:"w-8 h-8 border-4 rounded-full animate-spin mb-2",style:{borderColor:`${te}33`,borderTopColor:te}}),e.jsx("span",{className:"text-[10px] font-mono font-bold tracking-widest text-zinc-400 animate-pulse",children:"GENERATING AVATAR…"})]}),A==="missing"&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-zinc-950/90 backdrop-blur-md rounded-2xl p-4 text-center",children:[e.jsx("span",{className:"text-xs font-mono font-bold text-amber-400 uppercase tracking-wider mb-2",children:"DiceBear not installed"}),e.jsx("p",{className:"text-[10px] text-zinc-500 max-w-[220px] leading-relaxed mb-2",children:"Install the optional peer dependencies to use this variant:"}),e.jsx("code",{className:"text-[10px] text-zinc-300 bg-zinc-900 px-2 py-1 rounded border border-zinc-800 break-all",children:"npm i @dicebear/core @dicebear/collection"})]}),A&&A!=="missing"&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-zinc-950/90 backdrop-blur-md rounded-2xl p-4 text-center",children:[e.jsx("span",{className:"text-xs font-mono font-bold text-red-400 uppercase tracking-wider mb-2",children:"Failed to generate"}),e.jsx("p",{className:"text-[10px] text-zinc-500 max-w-[220px] leading-relaxed break-all",children:A})]})]})}function he(t){if(!t)return"";let i=t;i=i.replace(/```[^\n]*\n?([\s\S]*?)```/g,"$1"),i=i.replace(/```[^\n]*\n?/g,""),i=i.split(`
|
|
7
|
+
`).filter(l=>{const a=l.trim();if(!a)return!0;const n=/^\|.*\|?\s*$/.test(a)&&a.includes("|"),r=/^\|?[\s:|-]+\|[\s:|-]*$/.test(a)&&a.includes("-");return!(n||r)}).join(`
|
|
8
|
+
`),i=i.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1"),i=i.replace(/\[([^\]]+)\]\([^)]*\)/g,"$1"),i=i.replace(/`([^`]+)`/g,"$1"),i=i.replace(/^\s{0,3}#{1,6}\s+/gm,""),i=i.replace(/^\s{0,3}>\s?/gm,""),i=i.replace(/^\s{0,3}[-*+]\s+/gm,""),i=i.replace(/^\s{0,3}\d+\.\s+/gm,"");for(let l=0;l<2;l++)i=i.replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/__([^_]+)__/g,"$1").replace(/_([^_]+)_/g,"$1").replace(/~~([^~]+)~~/g,"$1");return i=i.replace(/[*_~]{1,3}(?=\s|$)/g,"").replace(/(^|\s)[*_~]{1,3}/g,"$1"),i=i.replace(/^\s{0,3}([-*_])\1{2,}\s*$/gm,""),i=i.replace(/\s*\n\s*/g," ").replace(/[ \t]{2,}/g," "),i.trim()}function xe(t,i={}){const l=i.maxChars??160,a=t.trim();if(a.length<=l)return a;const n=a.slice(a.length-l),r=n.search(new RegExp("(?<=[.!?…])\\s+"));if(r!==-1&&r<l*.6)return"…"+n.slice(r).trimStart();const c=n.indexOf(" "),o=c===-1?0:c+1;return"…"+n.slice(o)}function Se({text:t,maxChars:i=160,className:l="",style:a}){const n=xe(he(t??""),{maxChars:i});return n?e.jsx("div",{className:`rra-caption w-full flex justify-center pointer-events-none ${l}`,style:a,children:e.jsx(ee.motion.span,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.18},role:"status","aria-live":"polite",className:"inline-block max-w-[640px] text-center text-base md:text-lg font-medium text-zinc-100 leading-relaxed px-5 py-3 rounded-2xl border border-zinc-700/40 break-words",style:{textShadow:"0px 1px 3px rgba(0,0,0,0.5)",background:"rgba(9, 9, 11, 0.8)",backdropFilter:"blur(12px)"},children:n},n)}):null}function Ee({text:t,maxChars:i=220,label:l="Thought process",className:a="",style:n}){const r=xe(he(t??""),{maxChars:i});return r?e.jsx(ee.motion.div,{initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},transition:{duration:.3},className:`rra-thought w-full max-w-[420px] text-left pointer-events-none ${a}`,style:n,children:e.jsxs("div",{className:"bg-zinc-900/90 backdrop-blur-xl text-zinc-100 px-5 py-4 rounded-3xl shadow-[0_10px_30px_rgba(139,92,246,0.15)] border border-purple-500/25 text-sm italic break-words",children:[e.jsxs("div",{className:"text-purple-400 text-[10px] uppercase tracking-widest font-mono font-bold mb-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),l]}),e.jsx("p",{className:"leading-relaxed text-zinc-200",children:r})]})}):null}const ue=["🤔","💭","📚","🔍","🌐","💡","🧠","📝","⚙️"];function Le({emojis:t=ue,interval:i=900,size:l=64,className:a="",style:n}){const r=V.useReducedMotion(),[c,o]=x.useState(0);if(x.useEffect(()=>{if(r||t.length<=1)return;const h=setInterval(()=>{o(u=>(u+1)%t.length)},Math.max(200,i));return()=>clearInterval(h)},[r,t.length,i]),t.length===0)return null;const d=t[c%t.length];return e.jsx(ee.motion.div,{initial:{opacity:0,y:8,scale:.9},animate:{opacity:1,y:0,scale:1},transition:{duration:.3},className:`rra-thought-emoji flex justify-center pointer-events-none ${a}`,style:n,role:"status","aria-live":"off","aria-label":"Thinking",children:e.jsx("div",{className:"relative flex items-center justify-center rounded-full bg-zinc-900/90 backdrop-blur-xl border border-purple-500/25 shadow-[0_10px_30px_rgba(139,92,246,0.25)]",style:{width:l,height:l},children:e.jsx(ee.AnimatePresence,{mode:"wait",initial:!1,children:e.jsx(ee.motion.span,{initial:r?!1:{opacity:0,scale:.6,rotate:-15},animate:{opacity:1,scale:1,rotate:0},exit:r?void 0:{opacity:0,scale:.6,rotate:15},transition:{duration:.18},className:"absolute leading-none select-none",style:{fontSize:Math.round(l*.5)},children:d},c)})})})}function qe(t,i){return i===t?{type:"none"}:i.length>t.length&&i.startsWith(t)?{type:"push",text:i.slice(t.length)}:{type:"reset",seed:i}}function Re(t){const i=x.useRef(null);i.current===null&&(i.current=V.createSpeechActivity());const l=x.useRef("");return x.useEffect(()=>{if(t===void 0)return;const a=i.current,n=qe(l.current,t);n.type==="push"?a.push(n.text):n.type==="reset"&&(a.reset(),n.seed&&a.push(n.seed)),l.current=t},[t]),t===void 0?null:i.current}function P(t,i){if(!t||!t.startsWith("#"))return t||"transparent";const l=t.replace("#","");let a=0,n=0,r=0;return l.length===3?(a=parseInt(l[0]+l[0],16),n=parseInt(l[1]+l[1],16),r=parseInt(l[2]+l[2],16)):l.length===6&&(a=parseInt(l.substring(0,2),16),n=parseInt(l.substring(2,4),16),r=parseInt(l.substring(4,6),16)),`rgba(${a}, ${n}, ${r}, ${i})`}const Pe=x.lazy(()=>Promise.resolve().then(()=>require("./VrmAvatar-g_9JGG0m.cjs")).then(t=>({default:t.VrmAvatar}))),ze=x.lazy(()=>Promise.resolve().then(()=>require("./GlbArkitAvatar-CIHx_Kop.cjs")).then(t=>({default:t.GlbArkitAvatar})));function Ze({state:t,analyser:i=null,speechActivity:l,streamingText:a,size:n=280,variant:r="geometric",children:c,vrmUrl:o,glbUrl:d,subtitle:h,thought:u,tool:s,thinkingEmojis:T,thinkingEmojiInterval:B=900,thinkingEmojiSize:I,showGlow:U=!0,showStatePill:v=!0,showThought:m=!0,showSubtitle:_=!0,className:f="",style:w,dicebearCollection:A,dicebearSeed:y,maxMouthOpening:N,blinkIntervalMin:J,blinkIntervalMax:te,blinkDuration:E,mouseTrackingIntensity:W,stateColors:p,stateLabels:j,customization:D}){const b=Re(a),F=l??b,X=F??i,Y={state:t,analyser:X,size:n,maxMouthOpening:N,blinkIntervalMin:J,blinkIntervalMax:te,blinkDuration:E,mouseTrackingIntensity:W,stateColors:p,customization:D};let q;if(r==="vrm")q=e.jsx(x.Suspense,{fallback:null,children:e.jsx(Pe,{...Y,vrmUrl:o})});else if(r==="glb")q=e.jsx(x.Suspense,{fallback:null,children:e.jsx(ze,{...Y,glbUrl:d})});else if(r==="dicebear")q=e.jsx(Ne,{state:t,analyser:X,size:n,maxMouthOpening:N,stateColors:p,collection:A,seed:y});else if(r==="byos")q=e.jsx(ae,{...Y,children:c});else{const S={geometric:ce,memoji:ye,pixelart:je,doodle:be}[r]??ce;q=e.jsx(ae,{...Y,children:e.jsx(S,{size:n,customization:D,state:t})},r)}const z=ee.useMotionValue(1),Q=ee.useMotionValue(.15),R=x.useRef(null),C=V.useReducedMotion(),k={idle:(p==null?void 0:p.idle)??"#4b5563",listening:(p==null?void 0:p.listening)??"#3b82f6",thinking:(p==null?void 0:p.thinking)??"#8b5cf6",speaking:(p==null?void 0:p.speaking)??"#10b981",working:(p==null?void 0:p.working)??"#f59e0b"},Z={idle:(j==null?void 0:j.idle)??"Idle",listening:(j==null?void 0:j.listening)??"Listening",thinking:(j==null?void 0:j.thinking)??"Thinking...",speaking:(j==null?void 0:j.speaking)??"Speaking",working:(j==null?void 0:j.working)??"Working"},H={idle:P(k.idle,.15),listening:P(k.listening,.35),thinking:P(k.thinking,.4),speaking:P(k.speaking,.45),working:P(k.working,.4)};x.useEffect(()=>{if(!(i&&(t==="speaking"||t==="listening"))&&!(!i&&F&&t==="speaking")){z.set(t==="thinking"||t==="working"?1.05:1),Q.set(t==="thinking"||t==="working"?.35:.15),R.current&&cancelAnimationFrame(R.current);return}const g=i?new Uint8Array(i.frequencyBinCount):null,L=()=>{let M;if(i&&g){i.getByteTimeDomainData(g);let $=0;for(let K=0;K<g.length;K++){const re=Math.abs(g[K]-128);re>$&&($=re)}M=Math.min(1,$/128)}else M=F?F.sample():0;z.set(1+M*.35),Q.set(.15+M*.35),R.current=requestAnimationFrame(L)};return R.current=requestAnimationFrame(L),()=>{R.current&&cancelAnimationFrame(R.current)}},[i,F,t,z,Q]);const O=Array.isArray(T)?T:T?ue:null,ie=t==="thinking"&&!!O&&O.length>0,G=I??Math.round(n*.28);return e.jsxs("div",{className:`relative flex flex-col items-center justify-center ${f}`,style:{width:n,height:n,...w},children:[U&&e.jsx(ee.motion.div,{className:"absolute rounded-[1.75rem] pointer-events-none filter blur-2xl",style:{width:n*.9,height:n*.9,backgroundColor:k[t],scale:z,opacity:Q}}),e.jsx("div",{className:"w-full h-full relative flex items-center justify-center z-10",children:q}),ie?e.jsx("div",{className:"absolute z-40",style:{top:Math.round(n*.02),right:Math.round(n*.02)},children:e.jsxs("div",{className:"relative",children:[e.jsx(Le,{emojis:O,interval:B,size:G}),e.jsx("div",{className:"absolute rounded-full bg-zinc-900/90 border border-purple-500/25 shadow-md backdrop-blur-md",style:{width:G*.22,height:G*.22,bottom:-G*.14,left:-G*.02}}),e.jsx("div",{className:"absolute rounded-full bg-zinc-900/90 border border-purple-500/20 shadow-sm backdrop-blur-md",style:{width:G*.14,height:G*.14,bottom:-G*.3,left:-G*.18}})]})}):m&&u&&e.jsx("div",{className:"absolute bottom-[108%] left-1/2 -translate-x-1/2 w-[90vw] max-w-[340px] md:max-w-[420px] z-40",children:e.jsxs("div",{className:"relative",children:[e.jsx(Ee,{text:u,className:"max-w-none"}),e.jsx("div",{className:"absolute -bottom-3 left-1/2 -translate-x-1/2 w-4 h-4 bg-zinc-900/90 rounded-full border border-purple-500/20 shadow-md backdrop-blur-md"}),e.jsx("div",{className:"absolute -bottom-6 left-[48%] -translate-x-1/2 w-2.5 h-2.5 bg-zinc-900/90 rounded-full border border-purple-500/15 shadow-sm backdrop-blur-md"}),e.jsx("div",{className:"absolute -bottom-8 left-[47%] -translate-x-1/2 w-1.5 h-1.5 bg-zinc-900/90 rounded-full border border-purple-500/10 backdrop-blur-md"})]})}),v&&e.jsx(ee.motion.div,{role:"status","aria-live":"polite",className:"absolute -bottom-6 px-4 py-1.5 rounded-full text-xs font-bold text-white uppercase tracking-widest shadow-lg z-30 cursor-default select-none border border-white/10",animate:{backgroundColor:k[t],boxShadow:`0 4px 14px rgba(0,0,0,0.4), 0 0 16px ${H[t]}`},transition:{duration:.3},children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`w-2 h-2 rounded-full bg-white ${!C&&(t==="speaking"||t==="thinking")?"animate-ping":""}`}),t==="working"&&s?`Working: ${s}`:Z[t]]})}),_&&h&&e.jsx("div",{className:"absolute top-[115%] left-1/2 -translate-x-1/2 w-[90vw] max-w-[500px] md:max-w-[640px] z-50 pb-8",children:e.jsx(Se,{text:h})})]})}function Oe({size:t="100%",customization:i,state:l,poses:a=!1,className:n,style:r}){const{skinColor:c="#cf6b34",bgColor:o="#6fb3bd"}=i??{},[d,h]=x.useState(()=>Math.random()<.5?"wires":"paper"),u=x.useRef(l);return x.useEffect(()=>{l==="working"&&u.current!=="working"&&h(Math.random()<.5?"wires":"paper"),u.current=l},[l]),e.jsxs("svg",{viewBox:"0 0 200 200",width:t,height:t,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Avatar",className:n,style:r,children:[e.jsx("circle",{cx:"100",cy:"100",r:"79",fill:o}),e.jsx("clipPath",{id:"rra-squirrel-clip",children:e.jsx("circle",{cx:"100",cy:"100",r:"79"})}),e.jsxs("g",{clipPath:"url(#rra-squirrel-clip)",children:[e.jsx("path",{d:"M150 158 C182 150 188 96 162 66 C150 52 130 52 124 66 C140 70 150 92 146 110 C142 132 132 148 150 158 Z",fill:c}),e.jsx("path",{d:"M150 150 C172 142 176 100 156 76 C150 90 156 104 152 120 C148 134 140 142 150 150 Z",fill:"#e3a368"}),e.jsx("path",{d:"M84 118 Q82 140 78 150 L122 150 Q118 140 116 118 Z",fill:c}),e.jsx("path",{d:"M85 122 Q100 133 115 122 Q100 129 85 122 Z",fill:"#b05418",opacity:"0.55"}),e.jsx("path",{d:"M36 182 Q42 148 72 144 Q86 158 100 158 Q114 158 128 144 Q158 148 164 182 Z",fill:"#2b2f36"}),e.jsx("path",{d:"M78 146 Q100 156 122 146",fill:"none",stroke:"#3c424b",strokeWidth:"3",strokeLinecap:"round"}),e.jsx("path",{d:"M88 152 L100 182 L112 152 Z",fill:"#1f6fb0"}),e.jsxs("g",{stroke:"#6cc0ee",strokeWidth:"1.1",fill:"none",opacity:"0.85",children:[e.jsx("path",{d:"M100 158 L100 178 M94 164 L106 164 M97 172 L103 172"}),e.jsx("circle",{cx:"100",cy:"162",r:"1.4",fill:"#6cc0ee",stroke:"none"})]}),e.jsx("path",{d:"M96 150 L94 170 M104 150 L106 170",stroke:"#e9eef2",strokeWidth:"1.6",strokeLinecap:"round",fill:"none"}),e.jsxs("g",{id:"rra-squirrel-head",transform:a&&l==="thinking"?"rotate(6 100 120)":void 0,children:[e.jsx("path",{d:"M66 80 L58 42 Q74 50 86 72 Z",fill:c}),e.jsx("path",{d:"M134 80 L142 42 Q126 50 114 72 Z",fill:c}),e.jsx("path",{d:"M68 74 L63 52 Q72 56 80 70 Z",fill:"#a8451c"}),e.jsx("path",{d:"M132 74 L137 52 Q128 56 120 70 Z",fill:"#a8451c"}),e.jsxs("g",{stroke:"#f0d9b8",strokeWidth:"1.4",strokeLinecap:"round",fill:"none",children:[e.jsx("path",{d:"M60 46 L57 38 M63 47 L62 39 M66 49 L66 41"}),e.jsx("path",{d:"M140 46 L143 38 M137 47 L138 39 M134 49 L134 41"})]}),e.jsx("ellipse",{cx:"100",cy:"98",rx:"40",ry:"37",fill:c}),e.jsx("path",{d:"M62 96 Q54 90 58 100 Q56 108 64 106 Z",fill:c}),e.jsx("path",{d:"M138 96 Q146 90 142 100 Q144 108 136 106 Z",fill:c}),e.jsx("ellipse",{cx:"100",cy:"112",rx:"23",ry:"18",fill:"#ecc090"}),e.jsx("path",{d:"M64 78 Q60 50 86 46 Q78 54 82 60 Q92 44 110 48 Q102 56 106 60 Q120 50 134 74 Q124 62 112 66 Q100 56 88 66 Q76 64 64 78 Z",fill:"#3a2820"}),e.jsxs("g",{stroke:"#5a3a22",strokeWidth:"3",strokeLinecap:"round",fill:"none",children:[e.jsx("path",{d:"M70 80 Q78 75 88 79"}),e.jsx("path",{d:"M112 79 Q122 75 130 80"})]}),e.jsxs("g",{stroke:"#1a1a1a",strokeWidth:"3",fill:"none",children:[e.jsx("path",{d:"M95 92 Q100 89 105 92"}),e.jsx("path",{d:"M69 90 L60 86"}),e.jsx("path",{d:"M131 90 L140 86"})]}),e.jsx("circle",{cx:"82",cy:"92",r:"13.5",fill:"#fbf7ef",stroke:"#1a1a1a",strokeWidth:"3"}),e.jsx("circle",{cx:"118",cy:"92",r:"13.5",fill:"#fbf7ef",stroke:"#1a1a1a",strokeWidth:"3"}),e.jsxs("g",{children:[e.jsx("ellipse",{cx:"82",cy:"93",rx:"8",ry:"8.5",fill:"#ffffff"}),e.jsx("g",{transform:a&&l==="thinking"?"translate(5, 0)":void 0,children:e.jsx("circle",{className:"rra-pupil","data-base-x":82,"data-base-y":93,cx:"82",cy:"93",r:"4.6",fill:"#2b1b12"})}),e.jsx("circle",{cx:"84",cy:"90",r:"1.5",fill:"#ffffff"}),e.jsx("rect",{className:"rra-lid","data-max-height":"18",x:"73",y:"83",width:"18",height:"0",fill:c})]}),e.jsxs("g",{children:[e.jsx("ellipse",{cx:"118",cy:"93",rx:"8",ry:"8.5",fill:"#ffffff"}),e.jsx("g",{transform:a&&l==="thinking"?"translate(5, 0)":void 0,children:e.jsx("circle",{className:"rra-pupil","data-base-x":118,"data-base-y":93,cx:"118",cy:"93",r:"4.6",fill:"#2b1b12"})}),e.jsx("circle",{cx:"120",cy:"90",r:"1.5",fill:"#ffffff"}),e.jsx("rect",{className:"rra-lid","data-max-height":"18",x:"109",y:"83",width:"18",height:"0",fill:c})]}),a&&l==="working"&&d==="wires"&&e.jsxs("g",{id:"rra-safety-goggles",children:[e.jsx("path",{d:"M 52 92 C 45 92, 45 96, 40 96 M 148 92 C 155 92, 155 96, 160 96",fill:"none",stroke:"#2d3748",strokeWidth:"4",strokeLinecap:"round"}),e.jsx("rect",{x:"58",y:"78",width:"84",height:"28",rx:"14",fill:"none",stroke:"#e2e8f0",strokeWidth:"4"}),e.jsx("rect",{x:"60",y:"80",width:"80",height:"24",rx:"12",fill:"#e0f2fe",fillOpacity:"0.15"}),e.jsx("circle",{cx:"56",cy:"92",r:"3",fill:"#475569"}),e.jsx("circle",{cx:"144",cy:"92",r:"3",fill:"#475569"})]}),e.jsx("path",{d:"M93 107 Q100 101 107 107 Q100 113 93 107 Z",fill:"#7a4a32"}),e.jsx("path",{d:"M100 113 L100 118",stroke:"#7a4a32",strokeWidth:"1.6",strokeLinecap:"round"}),e.jsx("ellipse",{id:"rra-mouth",cx:"100",cy:"121",rx:"7",ry:"2.3",fill:"#5a3324"}),e.jsx("g",{stroke:"#caa074",strokeWidth:"1",strokeLinecap:"round",opacity:"0.8",fill:"none",children:e.jsx("path",{d:"M80 116 L62 113 M80 120 L62 121 M120 116 L138 113 M120 120 L138 121"})}),a&&l==="thinking"&&e.jsxs("g",{id:"rra-thinking-hand",children:[e.jsx("path",{d:"M136 182 L112 144 L124 138 L152 182 Z",fill:"#2b2f36",stroke:"#1e293b",strokeWidth:"1.2"}),e.jsxs("g",{fill:c,stroke:"#b05418",strokeWidth:"1.2",strokeLinejoin:"round",strokeLinecap:"round",children:[e.jsx("path",{d:"M112 144 C110 138, 107 130, 105 124 C104 121, 108 121, 109 124 C111 130, 113 136, 115 141"}),e.jsx("path",{d:"M115 141 C117 139, 120 140, 119 143 C121 142, 123 144, 121 147 C122 147, 123 149, 121 151 C120 152, 116 150, 115 145"}),e.jsx("path",{d:"M110 139 C104 139, 96 135, 92 132 C90 130, 93 128, 95 130 C100 133, 106 135, 110 136"})]})]})]}),a&&l==="working"&&d==="wires"&&e.jsxs("g",{id:"rra-working-workspace-wires",children:[e.jsx("circle",{cx:"100",cy:"162",r:"22",fill:"#fef08a",fillOpacity:"0.25",children:e.jsx("animate",{attributeName:"opacity",values:"1;0.2;0.9;0.1;0.8;0.3;1",dur:"1.2s",repeatCount:"indefinite"})}),e.jsx("rect",{x:"94",y:"172",width:"12",height:"8",fill:"#94a3b8",rx:"1"}),e.jsx("rect",{x:"96",y:"175",width:"8",height:"2",fill:"#64748b"}),e.jsx("path",{d:"M92 165 C92 153, 108 153, 108 165 C108 171, 104 172, 104 174 L96 174 C96 172, 92 171, 92 165 Z",fill:"#fef08a",stroke:"#ca8a04",strokeWidth:"1.5",children:e.jsx("animate",{attributeName:"fill",values:"#fef08a;#fef08a;#78350f;#fef08a;#fef08a;#78350f;#fef08a",dur:"1.2s",repeatCount:"indefinite"})}),e.jsx("path",{d:"M97 167 L99 160 L101 160 L103 167",fill:"none",stroke:"#ca8a04",strokeWidth:"1",children:e.jsx("animate",{attributeName:"stroke",values:"#ca8a04;#ca8a04;#78350f;#ca8a04;#ca8a04;#78350f;#ca8a04",dur:"1.2s",repeatCount:"indefinite"})}),e.jsxs("g",{id:"rra-left-arm-cable",children:[e.jsx("animateTransform",{attributeName:"transform",type:"translate",values:"0,0; -0.6,0.3; 0.4,-0.2; -0.3,-0.5; 0,0",dur:"0.18s",repeatCount:"indefinite"}),e.jsx("path",{d:"M36 182 L55 162 L64 168 L45 182 Z",fill:"#2b2f36",stroke:"#1e293b",strokeWidth:"1"}),e.jsx("path",{d:"M 45 180 C 45 165, 80 170, 94 174",fill:"none",stroke:"#ef4444",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsxs("g",{fill:c,stroke:"#b05418",strokeWidth:"1",children:[e.jsx("rect",{x:"58",y:"160",width:"10",height:"12",rx:"4",transform:"rotate(-10 63 166)"}),e.jsx("rect",{x:"62",y:"163",width:"9",height:"10",rx:"3",transform:"rotate(-15 66.5 168)"})]})]}),e.jsxs("g",{id:"rra-right-arm-cable",children:[e.jsx("animateTransform",{attributeName:"transform",type:"translate",values:"0,0; 0.5,-0.3; -0.4,0.2; 0.3,0.4; 0,0",dur:"0.15s",repeatCount:"indefinite"}),e.jsx("path",{d:"M164 182 L145 162 L136 168 L155 182 Z",fill:"#2b2f36",stroke:"#1e293b",strokeWidth:"1"}),e.jsx("path",{d:"M 155 180 C 155 165, 120 170, 106 174",fill:"none",stroke:"#1e293b",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsxs("g",{fill:c,stroke:"#b05418",strokeWidth:"1",children:[e.jsx("rect",{x:"132",y:"160",width:"10",height:"12",rx:"4",transform:"rotate(10 137 166)"}),e.jsx("rect",{x:"129",y:"163",width:"9",height:"10",rx:"3",transform:"rotate(15 133.5 168)"})]})]})]}),a&&l==="working"&&d==="paper"&&e.jsxs("g",{id:"rra-working-workspace-paper",children:[e.jsx("animateTransform",{attributeName:"transform",type:"translate",values:"0,0; 0,1; 0,0; 0,1; 0,0",dur:"3.2s",repeatCount:"indefinite"}),e.jsx("path",{d:"M36 182 L54 168 L64 176 L48 182 Z",fill:"#2b2f36",stroke:"#1e293b",strokeWidth:"1"}),e.jsx("path",{d:"M164 182 L146 168 L136 176 L152 182 Z",fill:"#2b2f36",stroke:"#1e293b",strokeWidth:"1"}),e.jsx("path",{d:"M50 118 C 66 120 84 128 100 134 C 116 128 134 120 150 118 L 148 124 C 134 126 116 134 100 150 C 84 134 66 126 52 124 Z",fill:"#f8fafc",stroke:"#d9d2c4",strokeWidth:"1"}),e.jsxs("g",{stroke:"#9aa4b2",strokeWidth:"1.1",strokeLinecap:"round",children:[e.jsx("line",{x1:"60",y1:"124",x2:"92",y2:"137"}),e.jsx("line",{x1:"140",y1:"124",x2:"108",y2:"137"})]}),e.jsx("path",{d:"M100 148 C 84 136 68 130 52 126 L 60 182 C 78 178 90 177 100 176 Z",fill:"#20242b",stroke:"#0f1216",strokeWidth:"1.5"}),e.jsx("path",{d:"M100 148 C 116 136 132 130 148 126 L 140 182 C 122 178 110 177 100 176 Z",fill:"#20242b",stroke:"#0f1216",strokeWidth:"1.5"}),e.jsx("line",{x1:"100",y1:"134",x2:"100",y2:"176",stroke:"#0f1216",strokeWidth:"1.4"}),e.jsxs("g",{fill:c,stroke:"#b05418",strokeWidth:"1",children:[e.jsx("circle",{cx:"60",cy:"180",r:"7"}),e.jsx("rect",{x:"57",y:"170",width:"7",height:"12",rx:"3"}),e.jsx("rect",{x:"62",y:"172",width:"7",height:"11",rx:"3"}),e.jsx("rect",{x:"67",y:"173",width:"6",height:"10",rx:"3"})]}),e.jsxs("g",{fill:c,stroke:"#b05418",strokeWidth:"1",children:[e.jsx("circle",{cx:"140",cy:"180",r:"7"}),e.jsx("rect",{x:"136",y:"170",width:"7",height:"12",rx:"3"}),e.jsx("rect",{x:"131",y:"172",width:"7",height:"11",rx:"3"}),e.jsx("rect",{x:"127",y:"173",width:"6",height:"10",rx:"3"})]})]})]}),e.jsxs("g",{id:"rra-think",opacity:"0",children:[e.jsx("circle",{cx:"150",cy:"54",r:"4",fill:"#ffffff",stroke:"#8b5cf6",strokeWidth:"2"}),e.jsx("circle",{cx:"165",cy:"42",r:"5.5",fill:"#ffffff",stroke:"#8b5cf6",strokeWidth:"2"}),e.jsx("circle",{cx:"182",cy:"28",r:"7",fill:"#ffffff",stroke:"#8b5cf6",strokeWidth:"2.5"})]})]})}function Ge({collection:t,seed:i,size:l=44,className:a=""}){const[n,r]=x.useState(null);return x.useEffect(()=>{let c=!1;return r(null),Ae(t,i).then(o=>{c||r(o)}).catch(()=>{c||r(null)}),()=>{c=!0}},[t,i]),e.jsx("div",{className:`flex items-center justify-center overflow-hidden ${a}`,style:{width:l,height:l},"aria-hidden":!0,children:n?e.jsx("div",{className:"w-full h-full [&>svg]:w-full [&>svg]:h-full",dangerouslySetInnerHTML:{__html:n}}):e.jsx("div",{className:"w-full h-full rounded-md bg-zinc-800/40 animate-pulse"})})}function Ve({analyser:t,state:i,height:l=80,className:a="",style:n,stateColors:r}){const c=x.useRef(null),o=x.useRef(null),d=x.useRef(0),h={idle:(r==null?void 0:r.idle)??"#9ca3af",listening:(r==null?void 0:r.listening)??"#3b82f6",thinking:(r==null?void 0:r.thinking)??"#8b5cf6",speaking:(r==null?void 0:r.speaking)??"#10b981",working:(r==null?void 0:r.working)??"#f59e0b"};return x.useEffect(()=>{const u=c.current;if(!u)return;const s=u.getContext("2d");if(!s)return;const T=()=>{const v=window.devicePixelRatio||1,m=u.getBoundingClientRect();u.width=m.width*v,u.height=m.height*v,s.scale(v,v)};T(),window.addEventListener("resize",T);let B=0,I=new Uint8Array(0);t&&(t.fftSize=128,B=t.frequencyBinCount,I=new Uint8Array(B));const U=()=>{const v=u.width/(window.devicePixelRatio||1),m=u.height/(window.devicePixelRatio||1);s.fillStyle="rgba(9, 9, 11, 0.2)",s.fillRect(0,0,v,m),d.current+=.05;const _=d.current;if(i==="speaking"&&t){t.getByteFrequencyData(I),s.lineWidth=3,s.strokeStyle=h.speaking,s.shadowBlur=15,s.shadowColor=P(h.speaking,.6),s.beginPath();const f=v/B;let w=0;for(let A=0;A<B;A++){const y=I[A]/255,N=m/2+Math.sin(A*.15+_*2)*(y*m*.4);A===0?s.moveTo(w,N):s.lineTo(w,N),w+=f}s.lineTo(v,m/2),s.stroke(),s.shadowBlur=0}else if(i==="listening"){let f=0;if(t&&I.length>0){t.getByteTimeDomainData(I);let y=0;for(let N=0;N<I.length;N++){const J=Math.abs(I[N]-128);J>y&&(y=J)}f=Math.min(1,y/128)}const w=4+f*36,A=3+f*27;s.shadowBlur=12,s.lineWidth=2.5,s.strokeStyle=P(h.listening,.7),s.shadowColor=P(h.listening,.4),s.beginPath();for(let y=0;y<v;y++){const N=m/2+Math.sin(y*.02+_*1.5)*Math.sin(y*.005)*w;y===0?s.moveTo(y,N):s.lineTo(y,N)}s.stroke(),s.strokeStyle=P(h.listening,.5),s.shadowColor=P(h.listening,.3),s.beginPath();for(let y=0;y<v;y++){const N=m/2+Math.sin(y*.015-_*1.2+Math.PI)*Math.sin(y*.005)*A;y===0?s.moveTo(y,N):s.lineTo(y,N)}s.stroke(),s.shadowBlur=0}else if(i==="thinking"){s.shadowBlur=10,s.shadowColor=P(h.thinking,.4),s.lineWidth=2,s.strokeStyle=P(h.thinking,.7),s.beginPath();for(let f=0;f<v;f++){const w=m/2+Math.sin(f*.03+_)*5+Math.sin(f*.01-_*.5)*8;f===0?s.moveTo(f,w):s.lineTo(f,w)}s.stroke(),s.shadowBlur=0}else if(i==="working"){s.shadowBlur=10,s.shadowColor=P(h.working,.4),s.lineWidth=2,s.strokeStyle=P(h.working,.7),s.beginPath();for(let f=0;f<v;f+=8){const w=m/2+Math.sin(f*.04+_*2.5)*12+Math.cos(f*.01-_)*6,A=m/2+Math.round((w-m/2)/6)*6;f===0?s.moveTo(f,A):(s.lineTo(f,A),s.lineTo(Math.min(v,f+8),A))}s.stroke(),s.shadowBlur=0}else{s.lineWidth=1.5,s.strokeStyle=P(h.idle,.3),s.beginPath();for(let f=0;f<v;f++){const w=m/2+Math.sin(f*.01+_*.2)*2;f===0?s.moveTo(f,w):s.lineTo(f,w)}s.stroke()}o.current=requestAnimationFrame(U)};return U(),()=>{window.removeEventListener("resize",T),o.current&&cancelAnimationFrame(o.current)}},[t,i,r]),e.jsxs("div",{className:`w-full bg-zinc-950/80 border border-zinc-800/40 rounded-xl overflow-hidden p-2 ${a}`,style:n,children:[e.jsxs("div",{className:"flex justify-between items-center px-2 mb-1",children:[e.jsx("span",{className:"text-[10px] text-zinc-500 uppercase tracking-widest font-mono font-bold",children:"Audio Waveform Telemetry"}),e.jsxs("span",{className:"flex h-2 w-2 relative",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:h[i]}}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2",style:{backgroundColor:h[i]}})]})]}),e.jsx("canvas",{ref:c,className:"w-full block",style:{height:l}})]})}function Ue({analyser:t,enabled:i,onFrame:l,onStop:a}){const n=x.useRef(l),r=x.useRef(a);n.current=l,r.current=a,x.useEffect(()=>{var h;if(!i){(h=r.current)==null||h.call(r);return}const c=V.createMouthEngine(t);let o;const d=()=>{n.current(c.read()),o=requestAnimationFrame(d)};return o=requestAnimationFrame(d),()=>{var u;cancelAnimationFrame(o),(u=r.current)==null||u.call(r)}},[t,i])}exports.SPEECH_ACTIVITY_BRAND=V.SPEECH_ACTIVITY_BRAND;exports.createMouthEngine=V.createMouthEngine;exports.createSpeechActivity=V.createSpeechActivity;exports.isSpeechActivity=V.isSpeechActivity;exports.useReducedMotion=V.useReducedMotion;exports.AudioVisualizer=Ve;exports.AvatarCaption=Se;exports.AvatarThought=Ee;exports.ContractAvatar=ae;exports.DEFAULT_DICEBEAR_COLLECTION=ve;exports.DEFAULT_DICEBEAR_SEED=Me;exports.DEFAULT_THINKING_EMOJIS=ue;exports.DICEBEAR_FEATURED_FACES=de;exports.DICEBEAR_RIGS=we;exports.DICEBEAR_STYLES=ke;exports.DICEBEAR_STYLE_BY_ID=De;exports.DiceBearAvatar=Ne;exports.DiceBearThumb=Ge;exports.DoodleAvatar=be;exports.GeometricAvatar=ce;exports.MemojiAvatar=ye;exports.PixelArtAvatar=je;exports.RealtimeAvatar=Ze;exports.SquirrelAvatar=Oe;exports.ThoughtEmojiBubble=Le;exports.collectionExportName=ne;exports.loadDiceBear=fe;exports.renderDiceBearSvg=Ae;exports.scopeSvgIds=oe;exports.tailWindow=xe;exports.toPlainText=he;exports.useAudioMouth=Ue;exports.useAvatarRuntime=me;exports.useStreamingTextActivity=Re;
|