import{__assign as t}from"tslib";import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useState as i,useRef as n,useEffect as a}from"react";import{Mic as o,MicOff as l,Volume2 as c,VolumeOff as s}from"lucide-react";var m=function(m){var d=m.amplitude,u=m.variant,h=m.isActive,p=m.className,f=void 0===p?"":p,b=m.onClick,v=m.disabled,x=void 0!==v&&v,y=m.isConnecting,g=i(Array(40).fill(4)),w=g[0],A=g[1],C=n(null),M=function(){var t=Math.min(Math.max(d,0),1),e=Math.max(t,.2),r=Array(40).fill(0).map(function(t,r){var i=Math.sin(r+Date.now()/100)+.5*Math.random();return 5+9*Math.abs(i)*e});A(r),C.current=requestAnimationFrame(M)};a(function(){return h?C.current=requestAnimationFrame(M):(A(Array(40).fill(4)),C.current&&cancelAnimationFrame(C.current)),function(){C.current&&cancelAnimationFrame(C.current)}},[h,d]);var k=h?"#364152":"#D0D4DB",D="microphone"===u?h||y?o:l:h?c:s;return e("div",t({className:f,style:{position:"relative",height:"3rem",zIndex:50,width:"100%",overflow:"hidden",display:"flex",alignItems:"center"}},{children:[r("div",t({style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",height:"2rem",gap:"0.25rem"}},{children:w.map(function(t,e){return r("div",{style:{flexShrink:0,width:"4px",borderRadius:"9999px",transition:"all 100ms",backgroundColor:k,height:"".concat(t,"px"),opacity:h?1:.4}},e)})})),r("button",t({onClick:b,disabled:x,"aria-label":"".concat(u," button"),style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"2rem",height:"2rem",borderRadius:"9999px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 200ms",backgroundColor:"white",border:"1px solid ".concat(k),cursor:x?"not-allowed":"pointer"}},{children:r(D,{color:k,className:y?"animate-spin":"",style:{width:"1.25rem",height:"1.25rem"}})}))]}))};export{m as default};
//# sourceMappingURL=AudioWaveform.js.map
