UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 4.24 kB
import{n as e,r as t}from"./rolldown-runtime-CNOWq4Kh.js";import{Wo as n}from"./_4____________________________.js";import{Dw as r,Ow as i,_y as a,gy as o,hy as s,kw as c}from"./_2_____________________________.js";import{E as l,F as u,O as d,Rt as f,U as p,d as m,g as h,gt as g,j as _,l as v,m as y,u as b,v as x,x as S}from"./_6____________________.js";import{Rt as C,zt as w}from"./control-ui-boot-new-pHXPNTZp.js";function T(e,t,r,o,s){let l=e.ownerDocument,u=l.defaultView,d=t.getContext(`2d`);if(!d)return{setLevel:e=>{},dispose:()=>{}};let f=l.createElement(`canvas`),p=f.getContext(`2d`);if(!p)return{setLevel:e=>{},dispose:()=>{}};let m=performance.now(),h=o!==`listening`,g=o===`thinking`,_,v=m-90,y=0,b=1,x=0,S=0,C=19,T=34,O=[],A=0,j=-1/0,M=l.visibilityState!==`hidden`,N=!0,P=s.read(),F=!1,I=!1,L=()=>!F&&M&&N&&!P&&e.isConnected,R=()=>{A&&u.cancelAnimationFrame(A),A=0},z=()=>{!A&&O.length&&L()&&(A=u.requestAnimationFrame(V))},B=e=>y+((_??0)-y)*Math.min(1,(e-v)/90);function V(e){if(A=0,!L())return;if(e-j<32.333333333333336){z();return}j=e;let n=h?0:B(e);d.setTransform(b,0,0,b,0,0),d.clearRect(0,0,x,S);for(let t of O){let r=.18+n*t.gain*.82,i=.9;if(h){let n=g?900:1050,a=g?.45:.5,o=(e-m+t.index*70)%n/n,s=o<=a?k(o/a):1-k((o-a)/(1-a));r=g?.24+s*.68:.2+s*.38,i=g?.4+s*.6:.42+s*.48}let a=T*r;d.globalAlpha=i,d.drawImage(f,0,0,C*b,T*b,t.x,t.centerY-a/2,C,a)}I||(I=!0,t.dataset.ready=``),(h||e-v<90)&&z()}let H=()=>{I=!1,delete t.dataset.ready,b=Math.max(1,u.devicePixelRatio||1),x=e.offsetWidth+16,S=e.offsetHeight+16;let n=r[0],i=n.offsetWidth,a=n.offsetHeight;C=i+16,T=a+16,O=r.map((e,t)=>({x:e.offsetLeft,centerY:e.offsetTop+e.offsetHeight/2+D,gain:E[t],index:t})),t.width=Math.ceil(x*b),t.height=Math.ceil(S*b),t.style.width=`${x}px`,t.style.height=`${S}px`,f.width=Math.ceil(C*b),f.height=Math.ceil(T*b);let o=u.getComputedStyle(n);p.setTransform(b,0,0,b,0,0),p.fillStyle=o.backgroundColor,p.shadowColor=o.boxShadow.slice(0,o.boxShadow.indexOf(`)`)+1)||`transparent`,p.shadowBlur=5*b,p.beginPath(),p.roundRect(D,D,i,a,i/2),p.fill(),j=-1/0,z()},U,W=()=>{U?.();let e=u.matchMedia?.(`(resolution: ${u.devicePixelRatio||1}dppx)`);U=e&&n(e,`change`,()=>{H(),W()})},G=()=>{L()?(j=-1/0,z()):R()},K=[a(l,e=>{M=e,G()}),s.subscribe(e=>{P=e,H(),G()}),c([e],H,{box:`border-box`}),i([e],e=>{N=e.some(e=>e.isIntersecting),G()}),w(l,[`data-theme`,`data-theme-mode`,`style`],H),()=>U?.()];return W(),{setLevel(e){if(h||_===e)return;let t=performance.now();y=_===void 0?e:B(t),v=_===void 0?t-90:t,_=e,z()},dispose(){F=!0,R();for(let e of K)e();delete t.dataset.ready}}}var E,D,O,k;function A(){return(A=e((()=>{C(),r(),o(),E=[.38,.62,.84,1,.84,.62,.38],D=8,k=e=>{let t=O??=Array.from({length:257},(e,t)=>{let n=t/256,r=0,i=1;for(let e=0;e<18;e+=1){let e=(r+i)/2;3*(1-e)**2*e*.42+3*(1-e)*e**2*.58+e**3<n?r=e:i=e}let a=(r+i)/2;return 3*(1-a)*a**2+a**3}),n=Math.min(256,Math.max(0,e*256)),r=Math.floor(n),i=t[r];return i+(t[Math.min(256,r+1)]-i)*(n-r)}})))()}var j=t({MicrophoneActivity:()=>M});function M(e){let t=u(()=>({status:e.status===`connecting`||e.status===`thinking`?e.status:`listening`,source:e.inputLevel}),{equals:(e,t)=>e.status===t.status&&e.source===t.source}),n,r=[];var i=N(),a=i.firstChild,o=a.nextSibling;return y(()=>e=>n=e,i),i._$owner=f(),m(i,_(l,{count:7,children:e=>(()=>{var t=P();return x(t,`--talk-bar-delay`,`${e*-70}ms`),y(()=>t=>r[e]=t,t),t})()}),a),m(i,_(d,{get when(){return t()},keyed:!0,children:e=>{let t=e.status;if(t===`connecting`)return null;let i=e.source,a=s(`(prefers-reduced-motion: reduce)`),o;g(()=>{let e=n,s=o;if(!e||!s)return;let c,l=i?.value??0,u=n=>{let i=String(n);e.dataset.level!==i&&(e.dataset.level=i),!c&&(t===`thinking`||t===`listening`&&n>0)&&(c=T(e,s,r,t,a),c.setLevel(l)),c?.setLevel(n)},d=i?.subscribe(u);return i||u(0),()=>{d?.(),c?.dispose()}});var c=F();return y(()=>e=>o=e,c),c}}),o),v(()=>t().status,e=>{h(i,`data-status`,e)}),i}var N,P,F;function I(){return(I=e((()=>{b(),p(),o(),A(),N=S(`<openclaw-microphone-activity class=agent-chat__voice-activity data-level=0 data-source=microphone aria-hidden=true><!><!>`,1),P=S(`<span class=agent-chat__voice-activity-bar>`),F=S(`<canvas class=agent-chat__voice-activity-canvas aria-hidden=true>`)})))()}export{j as n,I as r,M as t};