voice-ring 0.1.0 → 0.1.2

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 CHANGED
@@ -60,6 +60,7 @@ function VoiceScreen() {
60
60
  - `stream` (a `MediaStream`) or `level` (a number, or a getter read every frame).
61
61
  - `emotion`: `positive`, `negative` or `calm` shifts the spectrum toward its colour.
62
62
  - `direction`: −1 left … 1 right, a number or a getter. A browser microphone is mono, so the side comes from you: a stereo capture, a diarised speaker, or where that person sits in your UI. The ring barely drifts but leans toward it, and meets the screen's edge through a soft lens; the `direction…` props tune it.
63
+ - `hoverBend`: while the ring waits or works (`idle`, `processing`), it bends toward the cursor as it nears the rim, like a membrane, easing in and out. `true` bends at 0.55; a number 0–1 sets the strength. Desktop only (a fine pointer that hovers), and off with reduced motion.
63
64
  - `sensitivity` (0.85), `speed`, `theme` (`auto`, `dark`, `light`), `paused`.
64
65
 
65
66
  A 2D canvas with a small WebGL pass for the edge lens; React 18+.
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const kn=require("react/jsx-runtime"),$=require("react");let Bt=null;function Fn(){if(typeof window>"u")return null;const t=window;return t.AudioContext??t.webkitAudioContext??null}function ss(){return Fn()!=null}function fn(){const t=Fn();return t?(Bt||(Bt=new t),Bt.state==="suspended"&&Bt.resume().catch(()=>{}),Bt):null}const nn=new WeakMap;function In(t){const n=fn();if(!n||t.getAudioTracks().length===0)return null;let e=nn.get(t);e||(e={node:n.createMediaStreamSource(t),refs:0},nn.set(t,e)),e.refs+=1;const s=n.createAnalyser();s.fftSize=1024,s.smoothingTimeConstant=.5,e.node.connect(s);let o=!1;return{analyser:s,release:()=>{if(!o){o=!0;try{e.node.disconnect(s)}catch{}if(e.refs-=1,e.refs<=0){try{e.node.disconnect()}catch{}nn.delete(t)}}}}}const qt={positive:{r:92,g:224,b:150},negative:{r:255,g:104,b:104},calm:{r:104,g:162,b:255}},Nn={green:qt.positive,red:qt.negative,blue:qt.calm},es=.7,os=1.1,as=.6;class cs{constructor(){this.glow={r:0,g:0,b:0,amount:0,t:0,size:0}}step(n,e,s,o,r){const c=this.glow,l=a=>r?1:1-Math.exp(-n/a),i=e?1:0;if(c.amount+=(i-c.amount)*l(i>c.amount?es:os),e){const a=c.amount<.03?1:l(as);c.r+=(e.r-c.r)*a,c.g+=(e.g-c.g)*a,c.b+=(e.b-c.b)*a}return c.t=s,c.size=o,c}}const Mt={move:2,pull:.7,deform:.1,squash:.5,lens:.67,stretch:1,split:1,blur:1,bounce:1};function rs(t,n){const e=Math.abs(t.move)+Math.abs(t.pull)+2*Math.abs(t.deform);return e===0?0:Math.ceil(n*.36*e)+2}class is{constructor(){this.x=0,this.v=0,this.landed=!1}step(n,e){const r=Math.max(1,Math.ceil(e*240)),c=e/r;for(let i=0;i<r;i++)this.v+=(15*15*(n-this.x)-2*.3*15*this.v)*c,this.x+=this.v*c;const l=this.x-n;return n<=0?this.landed=!1:l>=0&&(this.landed=!0),l<0&&!this.landed?0:l}}function ls(t,n,e,s,o=[1/0,1/0],r=0){if(Math.abs(n)<.002||s.move===0&&s.pull===0&&s.deform===0)return t;const c=e/2,l=e*.36,i=n<0?-1:1,a=Math.abs(n),M=(b,w)=>{const x=(b-c)/l,F=(w-c)/l,R=Math.max(0,Math.min(1,(x*i+1)/2)),O=Math.max(0,x*i);return n*l*(s.move+s.pull*R*R+s.deform*O*O*Math.exp(-F*F*1.5))},h=Math.max(0,Math.min(2,s.lens??1)),f=l*.9,p=i>0?o[1]:o[0],d=Number.isFinite(p)?Math.min(f*.45,l*.3*h*Math.max(0,s.stretch??1)):0;let m=1,v=1/0,_=1;if(Number.isFinite(p)){v=i>0?e+p:-p;const b=(w,x,F)=>{_=Math.max(_,F);const R=M(w,x)*i;R>1e-9&&(m=Math.min(m,Math.max(0,((v-w)*i-F-d)/R)))};for(const w of t.dots)b(w.x,w.y,w.r);for(const w of t.strokes)for(let x=0;x<w.pts.length;x+=2)b(w.pts[x],w.pts[x+1],1)}const u=m<1?Math.min(1,(1-m)/.35):0,g=u>0?r*(s.bounce??1):0,y=Math.min(1.4,u+Math.max(0,g)),N=l*.12*Math.max(0,-g),E=v-i*_,B=E-i*d,S=l*.55*y*(s.squash??0);let C=1/0,P=-1/0,q=!0;const G=(b,w)=>{const x=Math.max(0,Math.min(1,((b-c)/l*i+1)/2)),F=1-.15*s.deform*a*m*x;let R=b+M(b,w)*m+i*(S*.5-N),O=c+(w-c)*F;if(S>0){const k=(R-(B-i*S))*i;if(k>0){const I=k/S,T=S*(I/Math.sqrt(1+I*I));R=B-i*S+i*T,O=c+(O-c)*(1+.18*y*(s.squash??0)*(T/S))}}return q&&(B-R)*i<Math.max(S,f*.3)&&(C=Math.min(C,O),P=Math.max(P,O)),[R,O]};for(const b of t.dots)[b.x,b.y]=G(b.x,b.y);for(const b of t.strokes)for(let w=0;w<b.pts.length;w+=2){const[x,F]=G(b.pts[w],b.pts[w+1]);b.pts[w]=x,b.pts[w+1]=F}if(u>0&&P>C){const b=h*y;t.contact={side:i,x:E,y0:C,y1:P,depth:S,press:u,lens:b>.02?{zone:f,gap:d*Math.min(1,y),flare:.22*b*Math.max(0,s.stretch??1),split:f*.1*b*Math.max(0,s.split??1),blur:f*.075*b*Math.max(0,s.blur??1),cy:c}:void 0}}if(q=!1,t.light){const b=t.light;[b.cx,b.cy]=G(b.cx,b.cy);for(const w of b.spec)[w.x,w.y]=G(w.x,w.y)}return t}const ft=Math.PI*2;function Rt(t,n,e){return t+(n-t)*e}function j(t){return t<0?0:t>1?1:t}function dn(t,n,e){const s=j((e-t)/(n-t));return s*s*(3-2*s)}const $t=t=>t<1e-6?1:Math.sin(t)/t,hs=Math.hypot(2.1,1.3),us=Math.hypot(1.9,1.7),fs=Math.hypot(4.3-2.9,-3.7,-3.1),ds=Math.hypot(4.3+2.9,3.7,-3.1);function pn(t,n,e,s=1){const o=1/Math.max(.05,s),r=.9*e,c=-.7*e+1.3,l=2.1*e,i=-1.6*e,a=t*(.55*Math.sin(r)*$t(hs*o)+.45*Math.sin(c)*$t(us*o))+n*.5*(Math.cos(l-i)*$t(fs*o)-Math.cos(l+i)*$t(ds*o));return(M,h,f)=>(M*=o,h*=o,f*=o,t*(.55*Math.sin(2.1*M+1.3*h+r)+.45*Math.sin(1.7*f-1.9*h+c))+n*Math.sin(4.3*M-3.1*f+l)*Math.sin(3.7*h+2.9*M+i)-a)}function St(t,n){const e=Math.sin(t*12.9898+n*78.233)*43758.5453;return e-Math.floor(e)}function xt(t,n,e){const s=Math.sin(t*127.1+n*311.7+e*74.7)*43758.5453;return s-Math.floor(s)}function zt(t,n,e){const s=Math.floor(t),o=Math.floor(n),r=Math.floor(e);let c=t-s,l=n-o,i=e-r;c=c*c*(3-2*c),l=l*l*(3-2*l),i=i*i*(3-2*i);const a=Rt(xt(s,o,r),xt(s+1,o,r),c),M=Rt(xt(s,o+1,r),xt(s+1,o+1,r),c),h=Rt(xt(s,o,r+1),xt(s+1,o,r+1),c),f=Rt(xt(s,o+1,r+1),xt(s+1,o+1,r+1),c);return Rt(Rt(a,M,l),Rt(h,f,l),i)}function Mn(t,n){const e=Math.PI*(3-Math.sqrt(5)),s=1-2*(t+.5)/n,o=Math.sqrt(1-s*s),r=t*e;return[o*Math.cos(r),s,o*Math.sin(r)]}function Kt(t,n,e,s,o){const r=Math.sin(n),c=Math.cos(n),l=Math.sin(t),i=Math.cos(t);return(a,M,h)=>{const f=a*i+h*l,p=-a*l+h*i,d=M*c-p*r,m=M*r+p*c;return[e+f*o,s-d*o,m]}}function Dt(t,n=.6){return(t/200)**n}function _t(t,n,e=.3){const s=[];for(const o of t)(o.a??1)<.02||(o.r=Math.max(e,o.r),s.push(o));return s.sort((o,r)=>o.z-r.z),{dots:s,strokes:n}}const Wt=32;function ps(t,n=0,e=0,s=1){const o=t.r/255,r=t.g/255,c=t.b/255,l=Math.max(o,r,c),i=Math.min(o,r,c);let a=(l+i)/2,M=l===i?0:(l-i)/(1-Math.abs(2*a-1)),h=0;if(l!==i){const m=l-i;h=l===o?(r-c)/m%6:l===r?(c-o)/m+2:(o-r)/m+4,h*=60}h=((h+n)%360+360)%360,M=Math.min(1,M*(1+e)),a=.5+(a-.5)*(1-.6*e),a=Math.max(0,Math.min(1,a*s));const f=m=>(m+h/30)%12,p=M*Math.min(a,1-a),d=m=>a-p*Math.max(-1,Math.min(f(m)-3,9-f(m),1));return[Math.round(d(0)*255),Math.round(d(8)*255),Math.round(d(4)*255)]}function Ms(t){const n=Math.max(0,Math.min(1,t.saturation)),e=Math.max(0,Math.min(1,t.neutral)),s=t.start??.1,o=Math.max(.05,t.width??.6),r=[];for(let h=0;h<Wt;h++){const f=h/(Wt-1),p=Math.max(0,Math.min(1,(f-s)/o)),d=p*p*(3-2*p);r.push(n*(1-e*(1-d)))}const c=t.angle*Math.PI/180,l=Math.cos(c),i=Math.sin(c),a=t.size/2,M=t.size*.8;return{rgb:ps(t.accent,t.hue,Math.max(0,Math.min(1,t.vivid??0)),t.brightness),mix:r,saturation:n,at:(h,f)=>{const p=((h-a)*l+(f-a)*i)/M+.5;return Math.max(0,Math.min(Wt-1,Math.round(p*(Wt-1))))}}}const ms=[120,232,214],gs=[64,72,255];function En(t,n,e){t/=255,n/=255,e/=255;const s=Math.max(t,n,e),o=Math.min(t,n,e),r=(s+o)/2;if(s===o)return[0,0,r];const c=s-o,l=r>.5?c/(2-s-o):c/(s+o);return[(s===t?(n-e)/c+(n<e?6:0):s===n?(e-t)/c+2:(t-n)/c+4)/6,l,r]}function bs(t,n,e){const s=c=>(c+t*12)%12,o=n*Math.min(e,1-e),r=c=>e-o*Math.max(-1,Math.min(s(c)-3,9-s(c),1));return[r(0)*255,r(8)*255,r(4)*255]}const sn=t=>(t/=255)<=.04045?t/12.92:((t+.055)/1.055)**2.4,vs=t=>255*(t<=.0031308?12.92*t:1.055*Math.max(0,t)**(1/2.4)-.055);function un(t,n,e){const[s,o,r]=[sn(t),sn(n),sn(e)],c=Math.cbrt(.4122214708*s+.5363325363*o+.0514459929*r),l=Math.cbrt(.2119034982*s+.6806995451*o+.1073969566*r),i=Math.cbrt(.0883024619*s+.2817188376*o+.6299787005*r);return[.2104542553*c+.793617785*l-.0040720468*i,1.9779984951*c-2.428592205*l+.4505937099*i,.0259040371*c+.7827717662*l-.808675766*i]}function On(t,n,e){const s=(t+.3963377774*n+.2158037573*e)**3,o=(t-.1055613458*n-.0638541728*e)**3,r=(t-.0894841775*n-1.291485548*e)**3,c=l=>Math.max(0,Math.min(255,vs(l)));return[c(4.0767416621*s-3.3077115913*o+.2309699292*r),c(-1.2684380046*s+2.6097574011*o-.3413193965*r),c(-.0041960863*s-.7034186147*o+1.707614701*r)]}function ys(t,n,e,s){const o=s&&s.amount>.005?s:void 0;return t.map(([r,c,l,i])=>{if(e&&(c+=(e.r-c)*.85,l+=(e.g-l)*.85,i+=(e.b-i)*.85),o){const[,M,h]=En(c,l,i),[f]=En(o.r,o.g,o.b),p=bs((f+.1*Math.sin(2*Math.PI*r)+1)%1,M,h),d=un(c,l,i),m=un(p[0],p[1],p[2]),v=o.amount;[c,l,i]=On(d[0]+(m[0]-d[0])*v,d[1]+(m[1]-d[1])*v,d[2]+(m[2]-d[2])*v)}const a=n?1:.82;return[r,c*a,l*a,i*a]})}const Bn=(t,n,e)=>`rgb(${Math.round(t)},${Math.round(n)},${Math.round(e)})`;function xs(t,n=36){const e=t.filter(([a])=>a<1),s=e.length;if(s<3)return t;const o=e.map(([,a,M,h])=>un(a,M,h)),r=a=>(a%s+s)%s,c=a=>e[r(a)][0]+Math.floor(a/s),l=a=>{const M=c(a+1)-c(a-1);return o[r(a+1)].map((h,f)=>(h-o[r(a-1)][f])/M)},i=[];for(let a=0;a<=n;a++){const M=a/n;let h=-1;for(;h<s-1&&c(h+1)<=M;)h++;const f=c(h+1)-c(h),p=(M-c(h))/f,d=p*p,m=d*p,v=o[r(h)],_=o[r(h+1)],u=l(h),g=l(h+1),y=[0,1,2].map(S=>(2*m-3*d+1)*v[S]+(m-2*d+p)*f*u[S]+(-2*m+3*d)*_[S]+(m-d)*f*g[S]),[N,E,B]=On(y[0],y[1],y[2]);i.push([M,N,E,B])}return i}const Ss=1.5,qn=typeof CanvasRenderingContext2D=="function"&&"filter"in CanvasRenderingContext2D.prototype,Tn=new WeakMap;function en(t,n){return(typeof OffscreenCanvas=="function"?new OffscreenCanvas(t,n):Object.assign(document.createElement("canvas"),{width:t,height:n})).getContext("2d")}function ws(t){const{width:n,height:e}=t.canvas;let s=Tn.get(t);return(!s||s.full.canvas.width!==n||s.full.canvas.height!==e)&&(s={full:en(n,e)},qn||(s.half=en(Math.ceil(n/2),Math.ceil(e/2)),s.quarter=en(Math.ceil(n/4),Math.ceil(e/4))),Tn.set(t,s)),s.full.setTransform(1,0,0,1,0,0),s.full.clearRect(0,0,n,e),s.full.setTransform(t.getTransform()),s}function on(t,n){t.globalCompositeOperation="copy",t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high",t.drawImage(n.canvas,0,0,t.canvas.width,t.canvas.height)}function Es(t,n,e){const s=t.getTransform();t.save(),t.setTransform(1,0,0,1,0,0),t.globalCompositeOperation=e,t.globalAlpha=1,t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high",qn?(t.filter=`blur(${Ss*Math.hypot(s.a,s.b)}px)`,t.drawImage(n.full.canvas,0,0)):n.half&&n.quarter&&(on(n.half,n.full),on(n.quarter,n.half),on(n.half,n.quarter),t.drawImage(n.half.canvas,0,0,n.half.canvas.width*2,n.half.canvas.height*2)),t.restore()}function Rn(t,n,e){const s=typeof t.createConicGradient=="function"?t.createConicGradient(n.angle,n.cx,n.cy):t.createLinearGradient(n.cx-n.r,n.cy-n.r,n.cx+n.r,n.cy+n.r);for(const[o,r,c,l]of e)s.addColorStop(j(o),Bn(r,c,l));return s}function Ts(t,n,e,s,o,r){const c=xs(ys(e.stops,s,o,r)),l=Rn(t,e,c),i=n.strokes.map(u=>{const g=new Path2D,y=u.pts.length>>1;let N=0;for(let E=0;E<y;E++)E===0?g.moveTo(u.pts[0],u.pts[1]):g.lineTo(u.pts[2*E],u.pts[2*E+1]),N+=u.a[E];return u.closed&&g.closePath(),{p:g,a:y?N/y:1,w:u.w}}),a=Math.max(1,i.length),M=e.intensity,h=s?"lighter":"source-over",f=(u,g,y=t)=>{for(const N of i)y.lineWidth=u(N.w),y.globalAlpha=j(g(N.a)),y.stroke(N.p)},p=(u,g)=>{u.lineCap="round",u.lineJoin="round",u.globalCompositeOperation=h,u.strokeStyle=g},d=ws(t),m=d.full;p(m,Rn(m,e,c));const v=e.halo*M*(s?1:.2)/a;for(const[u,g]of[[.7,.045],[.42,.075],[.24,.11],[.12,.16]])f(()=>e.r*u,()=>g*v,m);const _=M*(s?1:.6);for(const[u,g]of[[16,.05],[8,.11],[4,.2]])f(y=>y*u,y=>g*_*y,m);if(Es(t,d,h),t.save(),p(t,l),s&&e.fringe>0){for(const[u,g,y]of[[1+e.fringe,ms,.16],[1-e.fringe,gs,.22]])t.save(),t.translate(e.cx,e.cy),t.scale(u,u),t.translate(-e.cx,-e.cy),t.strokeStyle=Bn(g[0],g[1],g[2]),f(N=>N*1.4/u,N=>y*M*N),t.restore();t.strokeStyle=l}if(f(u=>u,u=>.7*u*(.75+.25*M)),s)for(const u of e.spec){const g=t.createRadialGradient(u.x,u.y,0,u.x,u.y,u.r);g.addColorStop(0,"rgba(255,255,255,1)"),g.addColorStop(.35,"rgba(255,255,255,0.45)"),g.addColorStop(1,"rgba(255,255,255,0)"),t.strokeStyle=g,f(y=>y*2.2,y=>u.a*y)}t.restore()}const Rs=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $n=require("react/jsx-runtime"),$=require("react");let Lt=null;function Wn(){if(typeof window>"u")return null;const t=window;return t.AudioContext??t.webkitAudioContext??null}function Me(){return Wn()!=null}function xn(){const t=Wn();return t?(Lt||(Lt=new t),Lt.state==="suspended"&&Lt.resume().catch(()=>{}),Lt):null}const hn=new WeakMap;function Vn(t){const n=xn();if(!n||t.getAudioTracks().length===0)return null;let s=hn.get(t);s||(s={node:n.createMediaStreamSource(t),refs:0},hn.set(t,s)),s.refs+=1;const e=n.createAnalyser();e.fftSize=1024,e.smoothingTimeConstant=.5,s.node.connect(e);let o=!1;return{analyser:e,release:()=>{if(!o){o=!0;try{s.node.disconnect(e)}catch{}if(s.refs-=1,s.refs<=0){try{s.node.disconnect()}catch{}hn.delete(t)}}}}}const Dt={positive:{r:92,g:224,b:150},negative:{r:255,g:104,b:104},calm:{r:104,g:162,b:255}},Xn={green:Dt.positive,red:Dt.negative,blue:Dt.calm},ge=.7,be=1.1,ve=.6;class xe{constructor(){this.glow={r:0,g:0,b:0,amount:0,t:0,size:0}}step(n,s,e,o,c){const r=this.glow,l=a=>c?1:1-Math.exp(-n/a),i=s?1:0;if(r.amount+=(i-r.amount)*l(i>r.amount?ge:be),s){const a=r.amount<.03?1:l(ve);r.r+=(s.r-r.r)*a,r.g+=(s.g-r.g)*a,r.b+=(s.b-r.b)*a}return r.t=e,r.size=o,r}}const Hn=(t,n)=>{var s;return((s=t.light)==null?void 0:s.r)??n*.28};function ye(t,n,s){const o=(Hn(t,n)*.7)**2,c=.9*Math.min(1,Math.max(0,s.amount)),r=(l,i)=>{const a=s.x-l,d=s.y-i,h=c*Math.exp(-(a*a+d*d)/o);return[l+a*h,i+d*h]};return{...t,strokes:t.strokes.map(l=>{const i=l.pts.slice();for(let a=0;a<i.length;a+=2)[i[a],i[a+1]]=r(i[a],i[a+1]);return{...l,pts:i}}),dots:t.dots.map(l=>{const[i,a]=r(l.x,l.y);return{...l,x:i,y:a}})}}const Se=(t,n)=>Math.min(1,Math.max(0,(.8*n-t)/(.6*n))),xt={move:2,pull:.7,deform:.1,squash:.5,lens:.67,stretch:1,split:1,blur:1,bounce:1};function Ee(t,n){const s=Math.abs(t.move)+Math.abs(t.pull)+2*Math.abs(t.deform);return s===0?0:Math.ceil(n*.36*s)+2}class we{constructor(){this.x=0,this.v=0,this.landed=!1}step(n,s){const c=Math.max(1,Math.ceil(s*240)),r=s/c;for(let i=0;i<c;i++)this.v+=(15*15*(n-this.x)-2*.3*15*this.v)*r,this.x+=this.v*r;const l=this.x-n;return n<=0?this.landed=!1:l>=0&&(this.landed=!0),l<0&&!this.landed?0:l}}function Te(t,n,s,e,o=[1/0,1/0],c=0){if(Math.abs(n)<.002||e.move===0&&e.pull===0&&e.deform===0)return t;const r=s/2,l=s*.36,i=n<0?-1:1,a=Math.abs(n),d=(b,E)=>{const y=(b-r)/l,I=(E-r)/l,R=Math.max(0,Math.min(1,(y*i+1)/2)),B=Math.max(0,y*i);return n*l*(e.move+e.pull*R*R+e.deform*B*B*Math.exp(-I*I*1.5))},h=Math.max(0,Math.min(2,e.lens??1)),f=l*.9,m=i>0?o[1]:o[0],p=Number.isFinite(m)?Math.min(f*.45,l*.3*h*Math.max(0,e.stretch??1)):0;let M=1,v=1/0,A=1;if(Number.isFinite(m)){v=i>0?s+m:-m;const b=(E,y,I)=>{A=Math.max(A,I);const R=d(E,y)*i;R>1e-9&&(M=Math.min(M,Math.max(0,((v-E)*i-I-p)/R)))};for(const E of t.dots)b(E.x,E.y,E.r);for(const E of t.strokes)for(let y=0;y<E.pts.length;y+=2)b(E.pts[y],E.pts[y+1],1)}const u=M<1?Math.min(1,(1-M)/.35):0,g=u>0?c*(e.bounce??1):0,x=Math.min(1.4,u+Math.max(0,g)),O=l*.12*Math.max(0,-g),w=v-i*A,G=w-i*p,S=l*.55*x*(e.squash??0);let C=1/0,_=-1/0,L=!0;const U=(b,E)=>{const y=Math.max(0,Math.min(1,((b-r)/l*i+1)/2)),I=1-.15*e.deform*a*M*y;let R=b+d(b,E)*M+i*(S*.5-O),B=r+(E-r)*I;if(S>0){const k=(R-(G-i*S))*i;if(k>0){const F=k/S,T=S*(F/Math.sqrt(1+F*F));R=G-i*S+i*T,B=r+(B-r)*(1+.18*x*(e.squash??0)*(T/S))}}return L&&(G-R)*i<Math.max(S,f*.3)&&(C=Math.min(C,B),_=Math.max(_,B)),[R,B]};for(const b of t.dots)[b.x,b.y]=U(b.x,b.y);for(const b of t.strokes)for(let E=0;E<b.pts.length;E+=2){const[y,I]=U(b.pts[E],b.pts[E+1]);b.pts[E]=y,b.pts[E+1]=I}if(u>0&&_>C){const b=h*x;t.contact={side:i,x:w,y0:C,y1:_,depth:S,press:u,lens:b>.02?{zone:f,gap:p*Math.min(1,x),flare:.22*b*Math.max(0,e.stretch??1),split:f*.1*b*Math.max(0,e.split??1),blur:f*.075*b*Math.max(0,e.blur??1),cy:r}:void 0}}if(L=!1,t.light){const b=t.light;[b.cx,b.cy]=U(b.cx,b.cy);for(const E of b.spec)[E.x,E.y]=U(E.x,E.y)}return t}const bt=Math.PI*2;function kt(t,n,s){return t+(n-t)*s}function Z(t){return t<0?0:t>1?1:t}function yn(t,n,s){const e=Z((s-t)/(n-t));return e*e*(3-2*e)}const Yt=t=>t<1e-6?1:Math.sin(t)/t,Re=Math.hypot(2.1,1.3),Ae=Math.hypot(1.9,1.7),_e=Math.hypot(4.3-2.9,-3.7,-3.1),Pe=Math.hypot(4.3+2.9,3.7,-3.1);function Sn(t,n,s,e=1){const o=1/Math.max(.05,e),c=.9*s,r=-.7*s+1.3,l=2.1*s,i=-1.6*s,a=t*(.55*Math.sin(c)*Yt(Re*o)+.45*Math.sin(r)*Yt(Ae*o))+n*.5*(Math.cos(l-i)*Yt(_e*o)-Math.cos(l+i)*Yt(Pe*o));return(d,h,f)=>(d*=o,h*=o,f*=o,t*(.55*Math.sin(2.1*d+1.3*h+c)+.45*Math.sin(1.7*f-1.9*h+r))+n*Math.sin(4.3*d-3.1*f+l)*Math.sin(3.7*h+2.9*d+i)-a)}function Tt(t,n){const s=Math.sin(t*12.9898+n*78.233)*43758.5453;return s-Math.floor(s)}function wt(t,n,s){const e=Math.sin(t*127.1+n*311.7+s*74.7)*43758.5453;return e-Math.floor(e)}function Ut(t,n,s){const e=Math.floor(t),o=Math.floor(n),c=Math.floor(s);let r=t-e,l=n-o,i=s-c;r=r*r*(3-2*r),l=l*l*(3-2*l),i=i*i*(3-2*i);const a=kt(wt(e,o,c),wt(e+1,o,c),r),d=kt(wt(e,o+1,c),wt(e+1,o+1,c),r),h=kt(wt(e,o,c+1),wt(e+1,o,c+1),r),f=kt(wt(e,o+1,c+1),wt(e+1,o+1,c+1),r);return kt(kt(a,d,l),kt(h,f,l),i)}function En(t,n){const s=Math.PI*(3-Math.sqrt(5)),e=1-2*(t+.5)/n,o=Math.sqrt(1-e*e),c=t*s;return[o*Math.cos(c),e,o*Math.sin(c)]}function Qt(t,n,s,e,o){const c=Math.sin(n),r=Math.cos(n),l=Math.sin(t),i=Math.cos(t);return(a,d,h)=>{const f=a*i+h*l,m=-a*l+h*i,p=d*r-m*c,M=d*c+m*r;return[s+f*o,e-p*o,M]}}function zt(t,n=.6){return(t/200)**n}function Nt(t,n,s=.3){const e=[];for(const o of t)(o.a??1)<.02||(o.r=Math.max(s,o.r),e.push(o));return e.sort((o,c)=>o.z-c.z),{dots:e,strokes:n}}const jt=32;function Ce(t,n=0,s=0,e=1){const o=t.r/255,c=t.g/255,r=t.b/255,l=Math.max(o,c,r),i=Math.min(o,c,r);let a=(l+i)/2,d=l===i?0:(l-i)/(1-Math.abs(2*a-1)),h=0;if(l!==i){const M=l-i;h=l===o?(c-r)/M%6:l===c?(r-o)/M+2:(o-c)/M+4,h*=60}h=((h+n)%360+360)%360,d=Math.min(1,d*(1+s)),a=.5+(a-.5)*(1-.6*s),a=Math.max(0,Math.min(1,a*e));const f=M=>(M+h/30)%12,m=d*Math.min(a,1-a),p=M=>a-m*Math.max(-1,Math.min(f(M)-3,9-f(M),1));return[Math.round(p(0)*255),Math.round(p(8)*255),Math.round(p(4)*255)]}function ke(t){const n=Math.max(0,Math.min(1,t.saturation)),s=Math.max(0,Math.min(1,t.neutral)),e=t.start??.1,o=Math.max(.05,t.width??.6),c=[];for(let h=0;h<jt;h++){const f=h/(jt-1),m=Math.max(0,Math.min(1,(f-e)/o)),p=m*m*(3-2*m);c.push(n*(1-s*(1-p)))}const r=t.angle*Math.PI/180,l=Math.cos(r),i=Math.sin(r),a=t.size/2,d=t.size*.8;return{rgb:Ce(t.accent,t.hue,Math.max(0,Math.min(1,t.vivid??0)),t.brightness),mix:c,saturation:n,at:(h,f)=>{const m=((h-a)*l+(f-a)*i)/d+.5;return Math.max(0,Math.min(jt-1,Math.round(m*(jt-1))))}}}const Fe=[120,232,214],Ie=[64,72,255];function On(t,n,s){t/=255,n/=255,s/=255;const e=Math.max(t,n,s),o=Math.min(t,n,s),c=(e+o)/2;if(e===o)return[0,0,c];const r=e-o,l=c>.5?r/(2-e-o):r/(e+o);return[(e===t?(n-s)/r+(n<s?6:0):e===n?(s-t)/r+2:(t-n)/r+4)/6,l,c]}function Ne(t,n,s){const e=r=>(r+t*12)%12,o=n*Math.min(s,1-s),c=r=>s-o*Math.max(-1,Math.min(e(r)-3,9-e(r),1));return[c(0)*255,c(8)*255,c(4)*255]}const un=t=>(t/=255)<=.04045?t/12.92:((t+.055)/1.055)**2.4,Oe=t=>255*(t<=.0031308?12.92*t:1.055*Math.max(0,t)**(1/2.4)-.055);function vn(t,n,s){const[e,o,c]=[un(t),un(n),un(s)],r=Math.cbrt(.4122214708*e+.5363325363*o+.0514459929*c),l=Math.cbrt(.2119034982*e+.6806995451*o+.1073969566*c),i=Math.cbrt(.0883024619*e+.2817188376*o+.6299787005*c);return[.2104542553*r+.793617785*l-.0040720468*i,1.9779984951*r-2.428592205*l+.4505937099*i,.0259040371*r+.7827717662*l-.808675766*i]}function Kn(t,n,s){const e=(t+.3963377774*n+.2158037573*s)**3,o=(t-.1055613458*n-.0638541728*s)**3,c=(t-.0894841775*n-1.291485548*s)**3,r=l=>Math.max(0,Math.min(255,Oe(l)));return[r(4.0767416621*e-3.3077115913*o+.2309699292*c),r(-1.2684380046*e+2.6097574011*o-.3413193965*c),r(-.0041960863*e-.7034186147*o+1.707614701*c)]}const Be=146/360,qe=[81,136],Bn=.1;function Ge(t,n=qe){const s=(n[0]+n[1])/720,e=(n[1]-n[0])/720,o=Math.abs((t-Be+1.5)%1-.5),c=Math.max(0,1-o/(40/360));return[t+(s-t)*c,Bn+(e-Bn)*c]}function Le(t,n,s,e,o){const c=e&&e.amount>.005?e:void 0;return t.map(([r,l,i,a])=>{if(s&&(l+=(s.r-l)*.85,i+=(s.g-i)*.85,a+=(s.b-a)*.85),c){const[,h,f]=On(l,i,a),[m,p]=Ge(On(c.r,c.g,c.b)[0],o),M=Ne((m+p*Math.sin(2*Math.PI*r)+1)%1,h,f),v=vn(l,i,a),A=vn(M[0],M[1],M[2]),u=c.amount;[l,i,a]=Kn(v[0]+(A[0]-v[0])*u,v[1]+(A[1]-v[1])*u,v[2]+(A[2]-v[2])*u)}const d=n?1:.82;return[r,l*d,i*d,a*d]})}const Yn=(t,n,s)=>`rgb(${Math.round(t)},${Math.round(n)},${Math.round(s)})`;function De(t,n=36){const s=t.filter(([a])=>a<1),e=s.length;if(e<3)return t;const o=s.map(([,a,d,h])=>vn(a,d,h)),c=a=>(a%e+e)%e,r=a=>s[c(a)][0]+Math.floor(a/e),l=a=>{const d=r(a+1)-r(a-1);return o[c(a+1)].map((h,f)=>(h-o[c(a-1)][f])/d)},i=[];for(let a=0;a<=n;a++){const d=a/n;let h=-1;for(;h<e-1&&r(h+1)<=d;)h++;const f=r(h+1)-r(h),m=(d-r(h))/f,p=m*m,M=p*m,v=o[c(h)],A=o[c(h+1)],u=l(h),g=l(h+1),x=[0,1,2].map(S=>(2*M-3*p+1)*v[S]+(M-2*p+m)*f*u[S]+(-2*M+3*p)*A[S]+(M-p)*f*g[S]),[O,w,G]=Kn(x[0],x[1],x[2]);i.push([d,O,w,G])}return i}const Ue=1.5,jn=typeof CanvasRenderingContext2D=="function"&&"filter"in CanvasRenderingContext2D.prototype,qn=new WeakMap;function fn(t,n){return(typeof OffscreenCanvas=="function"?new OffscreenCanvas(t,n):Object.assign(document.createElement("canvas"),{width:t,height:n})).getContext("2d")}function ze(t){const{width:n,height:s}=t.canvas;let e=qn.get(t);return(!e||e.full.canvas.width!==n||e.full.canvas.height!==s)&&(e={full:fn(n,s)},jn||(e.half=fn(Math.ceil(n/2),Math.ceil(s/2)),e.quarter=fn(Math.ceil(n/4),Math.ceil(s/4))),qn.set(t,e)),e.full.setTransform(1,0,0,1,0,0),e.full.clearRect(0,0,n,s),e.full.setTransform(t.getTransform()),e}function dn(t,n){t.globalCompositeOperation="copy",t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high",t.drawImage(n.canvas,0,0,t.canvas.width,t.canvas.height)}function $e(t,n,s){const e=t.getTransform();t.save(),t.setTransform(1,0,0,1,0,0),t.globalCompositeOperation=s,t.globalAlpha=1,t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high",jn?(t.filter=`blur(${Ue*Math.hypot(e.a,e.b)}px)`,t.drawImage(n.full.canvas,0,0)):n.half&&n.quarter&&(dn(n.half,n.full),dn(n.quarter,n.half),dn(n.half,n.quarter),t.drawImage(n.half.canvas,0,0,n.half.canvas.width*2,n.half.canvas.height*2)),t.restore()}function Gn(t,n,s){const e=typeof t.createConicGradient=="function"?t.createConicGradient(n.angle,n.cx,n.cy):t.createLinearGradient(n.cx-n.r,n.cy-n.r,n.cx+n.r,n.cy+n.r);for(const[o,c,r,l]of s)e.addColorStop(Z(o),Yn(c,r,l));return e}function We(t,n,s,e,o,c){const r=De(Le(s.stops,e,o,c,s.green)),l=Gn(t,s,r),i=n.strokes.map(u=>{const g=new Path2D,x=u.pts.length>>1;let O=0;for(let w=0;w<x;w++)w===0?g.moveTo(u.pts[0],u.pts[1]):g.lineTo(u.pts[2*w],u.pts[2*w+1]),O+=u.a[w];return u.closed&&g.closePath(),{p:g,a:x?O/x:1,w:u.w}}),a=Math.max(1,i.length),d=s.intensity,h=e?"lighter":"source-over",f=(u,g,x=t)=>{for(const O of i)x.lineWidth=u(O.w),x.globalAlpha=Z(g(O.a)),x.stroke(O.p)},m=(u,g)=>{u.lineCap="round",u.lineJoin="round",u.globalCompositeOperation=h,u.strokeStyle=g},p=ze(t),M=p.full;m(M,Gn(M,s,r));const v=s.halo*d*(e?1:.2)/a;for(const[u,g]of[[.7,.045],[.42,.075],[.24,.11],[.12,.16]])f(()=>s.r*u,()=>g*v,M);const A=d*(e?1:.6);for(const[u,g]of[[16,.05],[8,.11],[4,.2]])f(x=>x*u,x=>g*A*x,M);if($e(t,p,h),t.save(),m(t,l),e&&s.fringe>0){for(const[u,g,x]of[[1+s.fringe,Fe,.16],[1-s.fringe,Ie,.22]])t.save(),t.translate(s.cx,s.cy),t.scale(u,u),t.translate(-s.cx,-s.cy),t.strokeStyle=Yn(g[0],g[1],g[2]),f(O=>O*1.4/u,O=>x*d*O),t.restore();t.strokeStyle=l}if(f(u=>u,u=>.7*u*(.75+.25*d)),e)for(const u of s.spec){const g=t.createRadialGradient(u.x,u.y,0,u.x,u.y,u.r);g.addColorStop(0,"rgba(255,255,255,1)"),g.addColorStop(.35,"rgba(255,255,255,0.45)"),g.addColorStop(1,"rgba(255,255,255,0)"),t.strokeStyle=g,f(x=>x*2.2,x=>u.a*x)}t.restore()}const Ve=`
2
2
  attribute vec2 aPos;
3
3
  varying vec2 vUv;
4
4
  void main() {
5
5
  vUv = vec2(aPos.x + 1.0, 1.0 - aPos.y) * 0.5;
6
6
  gl_Position = vec4(aPos, 0.0, 1.0);
7
- }`,As=`
7
+ }`,Xe=`
8
8
  precision highp float;
9
9
  uniform sampler2D uTex;
10
10
  uniform vec2 uSize;
@@ -38,4 +38,4 @@ void main() {
38
38
  a += max(cg.a, max(cr.a, cb.a));
39
39
  }
40
40
  gl_FragColor = vec4(rgb, a) / float(TAPS);
41
- }`;let Vt;function Ps(){if(typeof document>"u")return null;const t=document.createElement("canvas"),n=t.getContext("webgl",{premultipliedAlpha:!0,antialias:!1,depth:!1});if(!n)return null;const e=(i,a)=>{const M=n.createShader(i);return n.shaderSource(M,a),n.compileShader(M),M},s=n.createProgram();if(n.attachShader(s,e(n.VERTEX_SHADER,Rs)),n.attachShader(s,e(n.FRAGMENT_SHADER,As)),n.linkProgram(s),!n.getProgramParameter(s,n.LINK_STATUS))return null;n.useProgram(s);const o=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,o),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),n.STATIC_DRAW);const r=n.getAttribLocation(s,"aPos");n.enableVertexAttribArray(r),n.vertexAttribPointer(r,2,n.FLOAT,!1,0,0);const c=n.createTexture();n.bindTexture(n.TEXTURE_2D,c),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);const l={};for(const i of["uSize","uWall","uSide","uZone","uGap","uFlare","uSplit","uBlur","uCy"])l[i]=n.getUniformLocation(s,i);return{gl:n,canvas:t,source:document.createElement("canvas"),tex:c,u:l}}function _s(t,n,e,s){if(Vt===void 0&&(Vt=Ps()),!Vt)return!1;const{gl:o,canvas:r,source:c,tex:l,u:i}=Vt,a=t.getTransform(),M=Math.hypot(a.a,a.b)||1,h=t.canvas.width,f=t.canvas.height,p=a.a*e+a.e,d=s.zone*M,m=s.blur*M,v=Math.max(0,Math.floor(n>0?p-d-2*m-4:0)),u=Math.min(h,Math.ceil(n>0?h:p+d+2*m+4))-v;if(u<2||f<2)return!1;(c.width!==u||c.height!==f)&&(c.width=u,c.height=f);const g=c.getContext("2d");return g.clearRect(0,0,u,f),g.drawImage(t.canvas,v,0,u,f,0,0,u,f),(r.width!==u||r.height!==f)&&(r.width=u,r.height=f),o.viewport(0,0,u,f),o.bindTexture(o.TEXTURE_2D,l),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,c),o.uniform2f(i.uSize,u,f),o.uniform1f(i.uWall,p-v),o.uniform1f(i.uSide,n),o.uniform1f(i.uZone,d),o.uniform1f(i.uGap,s.gap*M),o.uniform1f(i.uFlare,s.flare),o.uniform1f(i.uSplit,s.split*M),o.uniform1f(i.uBlur,m),o.uniform1f(i.uCy,a.d*s.cy+a.f),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.drawArrays(o.TRIANGLE_STRIP,0,4),t.save(),t.setTransform(1,0,0,1,0,0),t.globalCompositeOperation="copy",t.beginPath(),t.rect(v,0,u,f),t.clip(),t.drawImage(r,v,0),t.restore(),!0}function zn(t,n,e,s){const o=2.2/s.size,r=zt(t*o+s.t*.11,n*o-s.t*.08,s.t*.07),c=dn(.3,.75,r);return s.amount*(.2+.75*c)*j(1.3-e)}function Dn(t,n,e,s,o,r=0,c,l=0){const i=Math.round(n*1e3)/1e3,a=d=>e?d*(1-t):d+(255-d)*t,M=(e?1-t:t)*255;let h=s?a(s.r):M,f=s?a(s.g):M,p=s?a(s.b):M;return c&&l>0&&(h+=(a(c[0])-h)*l,f+=(a(c[1])-f)*l,p+=(a(c[2])-p)*l),o&&r>0&&(h+=(a(o.r)-h)*r,f+=(a(o.g)-f)*r,p+=(a(o.b)-p)*r),`rgba(${Math.round(h)},${Math.round(f)},${Math.round(p)},${i})`}const An=24,Pn=8;function Cs(t,n,e,s,o,r){const c=o&&o.amount>.005?o:void 0,l=r&&r.saturation>0?r:void 0,i=new Map;for(const a of n){const M=a.pts.length>>1,h=a.closed?M:M-1;let f="",p;for(let d=0;d<h;d++){const m=d+1===M?0:d+1,v=Math.round(j((a.a[d]+a.a[m])/2)*An);if(v===0){f="";continue}const _=c?Math.round(zn((a.pts[2*d]+a.pts[2*m])/2,(a.pts[2*d+1]+a.pts[2*m+1])/2,a.white,c)*Pn):0,u=l?l.at((a.pts[2*d]+a.pts[2*m])/2,(a.pts[2*d+1]+a.pts[2*m+1])/2):0,g=`${v}|${a.white}|${Math.round(a.w*20)}|${_}|${u}`;if(g!==f){let y=i.get(g);y||(y={path:new Path2D,white:a.white,w:a.w,a:v/An,gw:_/Pn,ci:u},i.set(g,y)),p=y,f=g,y.path.moveTo(a.pts[2*d],a.pts[2*d+1])}p.path.lineTo(a.pts[2*m],a.pts[2*m+1])}}t.lineCap="round",t.lineJoin="round";for(const a of i.values())t.strokeStyle=Dn(j(a.white),a.a,e,s,c,a.gw,l==null?void 0:l.rgb,l==null?void 0:l.mix[a.ci]),t.lineWidth=a.w,t.stroke(a.path)}function ks(t,n,e,s,o,r,c=!1){const l=o&&o.amount>.005?o:void 0,i=r&&r.saturation>0?r:void 0;for(const a of n){const M=j(a.white),h=l?zn(a.x,a.y,M,l):0,f=i?i.at(a.x,a.y):0;if(t.fillStyle=Dn(M,j(a.a??1),e,s,l,h,i==null?void 0:i.rgb,i==null?void 0:i.mix[f]),c){t.fillRect(a.x-a.r,a.y-a.r,2*a.r,2*a.r);continue}t.beginPath(),t.arc(a.x,a.y,a.r,0,ft),t.fill()}}function Fs(t,n,e,s,o,r){var l;const c=r&&r.saturation>0&&!n.light?Ms(r):void 0;n.light?Ts(t,n,n.light,e,s,o):n.strokes.length&&Cs(t,n.strokes,e,s,o,c),ks(t,n.dots,e,s,o,c,n.square),(l=n.contact)!=null&&l.lens&&_s(t,n.contact.side,n.contact.x,n.contact.lens)}const Is=[[0,255,150,90],[.12,255,110,120],[.24,255,80,170],[.4,190,80,255],[.58,90,92,255],[.74,60,132,255],[.84,170,90,255],[.93,240,104,165],[1,255,150,90]],Ns=(t,n,e,s)=>{const o=t/2,r=e.level,[c,l]=e.softBands,i=e.bands[2],a=e.drive,M=e.processing,h=.5*r+.5*e.soft,f=o*(s.radius??.56)*(1+(s.zoom??.17)*e.soft)*(1-.06*M),p=s.deform??1.45,d=.02+(.14*c+.06*r)*p,m=.01+(.07*l+.03*i)*p,v=pn(d,m,a,s.deformRadius??1.75),_=Math.max(.6,(s.lineW??1.85)*Dt(t,.5)),u=Math.max(1,Math.round(s.rings??6)),g=Math.max(24,Math.round(s.segs??140)),y=s.lean??.91,N=s.ringGap??.02,E=[];let B=0,S=0;for(let x=0;x<u;x++){const F=.16*(.5+St(x,2.1))*(x%2?1:-1),R=Math.max(.02,y*(.2+.8*St(x,3.1))+.03*Math.sin(n*.27+x*1.3)+.08*Math.sin(a*.35+x*1.7)),O=St(x,7.7)*ft+n*.05*(x%2?1:-1)+a*F,k=Math.sin(R)*Math.cos(O),I=Math.sin(R)*Math.sin(O),T=Math.cos(R),A=Math.hypot(k,T),z=T/A,L=-k/A,U=I*L,W=T*z-k*L,Z=-I*z,nt=f*(1+N*(x-(u-1)/2)),Y=Math.sin(R),X=[],ct=[],J=[];for(let Q=0;Q<g;Q++){const V=Q/g*ft,dt=Math.cos(V),rt=Math.sin(V),it=z*dt+U*rt,st=W*rt,mt=L*dt+Z*rt,ht=v(it,st,mt);X.push(it,st),ct.push(ht),B+=ht,S++,J.push(.62+.38*j((mt/Y+1)/2))}E.push({dirs:X,f:ct,a:J,rk:nt})}const C=S?B/S:0;let P=0,q=0;for(const{dirs:x,f:F}of E)for(let R=0;R<F.length;R++){const O=x[2*R],k=x[2*R+1],I=Math.hypot(O,k)||1;P+=(F[R]-C)*(O/I),q+=(F[R]-C)*(k/I)}P=S?2*P/S:0,q=S?2*q/S:0;const G=E.map(({dirs:x,f:F,a:R,rk:O})=>{const k=[];for(let I=0;I<F.length;I++){const T=x[2*I],A=x[2*I+1],z=Math.hypot(T,A)||1,L=O*(1+F[I]-C-P*(T/z)-q*(A/z));k.push(o+T*L,o-A*L)}return{pts:k,a:R,white:0,w:_,closed:!0}}),b=2.3+.25*Math.sin(n*.21)+2*e.spin,w={cx:o,cy:o,r:f,stops:Is,angle:-Math.PI/2-.35+.5*Math.sin(n*.07)+.4*Math.sin(a*.2)+e.spin,intensity:.62+.55*h+.5*M,halo:(s.halo??.5)*(1+.6*M),spec:[{x:o+Math.cos(b)*f,y:o+Math.sin(b)*f,r:f*(.5+.25*M),a:.5+.35*h+.4*M}],fringe:.016+.012*h};return{..._t([],G),light:w}},Ln=-.45,Gn=.55,Un=.7,Os=Math.hypot(Ln,Gn,Un),Bs=(t,n,e,s)=>{const o=t/2,r=e.level,[c,l,i]=e.bands,a=e.drive,M=e.processing,h=o*(s.radius??.72),f=h*(1+(s.zoom??.3)*r)*(1-.06*M),p=s.rMul??1,d=Math.max(4,Math.round(s.cells??17)),m=2*h/d,v=m/2-Math.max(.5,m*(s.gap??.24)/2),_=Math.ceil(f*1.25/m),u=(s.turn??.12)*n+.1*a+.5*e.spin,g=Math.sin(u),y=Math.cos(u),N=Math.sin(.35),E=Math.cos(.35),B=s.shade??.7,S=s.texture??.35,C=s.fade??1.3,P=s.strength??1.38,q=s.deform??1.7,G=.012+(.09*c+.03*r)*q,b=(.035*l+.025*i)*q,w=k=>G*(.55*Math.sin(2*k+.9*a)+.45*Math.sin(3*k-.7*a+1.3))+b*Math.sin(7*k+2.3*a)*Math.sin(5*k-1.7*a),x=.95*Math.sin(n*1.3),F=e.spectrum,R=F.length,O=[];for(let k=-_;k<=_;k++)for(let I=-_;I<=_;I++){const T=o+I*m,A=o+k*m,z=(T-o)/f,L=-(A-o)/f,U=w(Math.atan2(L,z)),W=Math.hypot(z,L)/(1+U);if(W>=1)continue;const Z=1/(1+U),nt=z*Z,Y=L*Z,X=Math.sqrt(Math.max(0,1-nt*nt-Y*Y)),ct=j((nt*Ln+Y*Gn+X*Un)/Os),J=1-B+B*ct,Q=Y*E+X*N,V=-Y*N+X*E,dt=nt*y-V*g,rt=nt*g+V*y,it=.65*zt(dt*2.2+a*.15,Q*2.2,rt*2.2-a*.1)+.35*zt(dt*4.6-a*.2,Q*4.6+7.3,rt*4.6),st=1-S+S*dn(.32,.68,it),mt=R?F[Math.min(R-1,Math.floor(W*R))]:r,ht=.35*r+.85*mt,gt=Math.exp(-((Y-x)**2)/.01)*M,lt=1-.4*C*(1-X),wt=(.35+.75*J*st+.3*ht+.2*gt)*lt*p,Ct=.22+.62*J*st+.22*ht+.3*gt;O.push({x:T,y:A,z:X*f,r:v*Math.min(1,wt),white:j(1-Ct*P),a:j((1-.75*C*(1-Math.sqrt(X)))*P)})}return{..._t(O,[],s.rMin??.4),square:!0}},qs=(t,n,e,s)=>{const o=t/2,r=t/2,c=.5*e.level+.5*e.soft,l=(1+(s.swell??.49)*c)*(1-.14*e.processing),i=t/2*(s.radius??.56),a=s.persp??.25,M=Kt(n*.12+e.drive*.03,.3,0,0,1),h=Dt(t,s.rsPow??.9)*(s.rMul??1),f=[],p=s.orbitN??12,d=s.particles??6;for(let m=0;m<p;m++){const v=St(m,1.7),_=St(m,5.2),u=St(m,8.9),g=i*(.45+.52*v),y=v*ft,N=Math.acos(2*_-1),E=Math.sin(N)*Math.cos(y),B=Math.cos(N),S=Math.sin(N)*Math.sin(y);let C=-B,P=E;const q=Math.max(1e-6,Math.sqrt(C*C+P*P));C/=q,P/=q;const G=-S*P,b=S*C,w=E*P-B*C,x=(.25+.55*u)*(u>.5?1:-1);for(let F=0;F<d;F++){const R=e.drive*x+F/d*ft+_*6,O=Math.cos(R),k=Math.sin(R),[I,T,A]=M((C*O+G*k)*g,(P*O+b*k)*g,w*k*g),z=j((A/i+1)/2),L=l/(1-a*A/i);f.push({x:o+I*L,y:r+T*L,z:A,r:((s.partR??.47)+(s.partRDepth??.65)*z)*h*L,white:.32-.24*z})}}return _t(f,[],s.rMin)},zs=(t,n,e,s)=>{const o=t/2,r=t/2,c=e.soft,[l,i]=e.softBands,a=t/2*(s.radius??.66)*(1+(s.zoom??.21)*e.level),M=e.drive,h=s.deform??1,f=s.wave??1,p=.015+(.1*l+.05*e.level)*h,d=.04*i*h,m=pn(p,d,M),v=.55+.05*Math.sin(n*.37),_=Math.cos(v),u=Math.sin(v);let g=0;for(let T=0;T<48;T++){const A=T/48*ft;g+=m(Math.cos(A),Math.sin(A)*_,Math.sin(A)*u)}g/=48;const y=(T,A,z)=>1+m(T,A,z)-g,E=Kt(0,.3,o,r,1),B=Dt(t,s.rsPow??.6)*(s.rMul??1),S=e.drive,C=[],P=s.ghostN??60;for(let T=0;T<P;T++){const A=Mn(T,P),z=a*y(A[0],A[1],A[2]),[L,U,W]=E(A[0]*z,A[1]*z,A[2]*z),Z=(W/a+1)/2;C.push({x:L,y:U,z:W,r:.65*B,white:.78,a:.1+.22*Z})}const q=-u,G=_,b=Math.max(1,Math.round(s.lanes??10)),w=Math.max(8,Math.round(s.segs??56)),x=e.processing,F=(s.laneGap??.062)*(1+.25*c)*(1-.4*x),R=S*1.6,O=.15*(.55+.9*l*f)*(1-.6*x),k=.06*(.5+1.2*i*f),I=.05+.05*c;for(let T=0;T<b;T++){const A=(T-(b-1)/2)*F,z=Math.abs(T-(b-1)/2)/Math.max(1,(b-1)/2);for(let L=0;L<w;L++){const U=L/w*ft,W=O*Math.sin(U*3-S*.95+T*.18)+k*Math.sin(U*5+S*.6)+I*Math.sin(U*2+n*.31+Math.sin(n*.17)*1.5),Z=A+W,nt=Math.cos(U),Y=Math.sin(U),X=nt,ct=Y*_+q*Z,J=Y*u+G*Z,Q=Math.sqrt(X*X+ct*ct+J*J),V=a*y(X/Q,ct/Q,J/Q)/Q,[dt,rt,it]=E(X*V,ct*V,J*V),st=(it/a+1)/2,mt=Math.max(0,W)*c,ht=Math.atan2(Math.sin(U-R),Math.cos(U-R)),gt=Math.exp(-(ht*ht)/.18)*x;C.push({x:dt,y:rt,z:it,r:((s.rBase??.49)+(s.rDepth??.78)*st)*(1-.25*z)*(1+1.2*mt+.5*gt)*B,white:.52-.44*st+.18*z-.3*gt,a:.4+.6*st})}}return _t(C,[],s.rMin)},Ds=(t,n,e,s)=>{const o=t/2,r=e.level,[c,l]=e.softBands,i=e.bands[2],a=e.drive,M=o*(s.radius??.6)*(1+(s.zoom??.06)*e.soft)*(1-.08*e.processing),h=Kt((s.yaw??.42)+.08*Math.sin(n*.23),s.tilt??.32,o,o,1),f=Math.max(.4,(s.lineW??.6)*Dt(t,.5)),p=E=>.06+.94*j((E/M+1)/2)**2,d=s.deform??1,m=.02+(.14*c+.06*r)*d,v=.01+(.07*l+.03*i)*d,_=pn(m,v,a),u=[],g=Math.max(24,Math.round(s.segs??96)),y=Math.max(0,Math.round(s.limbs??2));for(let E=0;E<y;E++){const B=.1+.05*Math.sin(n*.31+E*2.1),S=n*.17*(E%2?1:-1)+E*2.4,C=Math.sin(B)*Math.cos(S),P=Math.sin(B)*Math.sin(S),q=Math.cos(B),G=Math.hypot(C,q),b=q/G,w=-C/G,x=P*w,F=q*b-C*w,R=-P*b,O=[],k=[];for(let I=0;I<g;I++){const T=I/g*ft,A=b*Math.cos(T)+x*Math.sin(T),z=F*Math.sin(T),L=w*Math.cos(T)+R*Math.sin(T),U=M*(1+.006*E+_(A,z,L));O.push(o+A*U,o-z*U),k.push(.55+.35*j((L/Math.sin(B)+1)/2))}u.push({pts:O,a:k,white:0,w:f,closed:!0})}const N=Math.max(2,Math.round(s.circles??8));for(let E=0;E<N;E++){const[B,S,C]=Mn(E,N),P=a*.16*(.5+St(E,2.1))*(E%2?1:-1)+St(E,6.6)*ft,q=S*Math.cos(P)-C*Math.sin(P),G=S*Math.sin(P)+C*Math.cos(P),b=Math.max(1e-6,Math.hypot(G,B)),w=G/b,x=-B/b,F=q*x,R=G*w-B*x,O=-q*w,k=[],I=[];for(let T=0;T<g;T++){const A=T/g*ft,z=w*Math.cos(A)+F*Math.sin(A),L=R*Math.sin(A),U=x*Math.cos(A)+O*Math.sin(A),W=M*(1+_(z,L,U)),[Z,nt,Y]=h(z*W,L*W,U*W);k.push(Z,nt),I.push(p(Y))}u.push({pts:k,a:I,white:0,w:f,closed:!0})}return _t([],u,s.rMin)},Ls=(t,n,e,s)=>{const o=t/2,r=e.level,[c,l,i]=e.bands,a=e.drive,M=e.processing,h=o*(s.radius??.6)*(1+(s.zoom??.1)*r)*(1-.08*M),f=.95*Math.sin(n*1.3),p=Kt(n*.14,.32,o,o,1),d=Dt(t,s.rsPow??.6)*(s.rMul??1),m=Math.max(40,Math.round(s.dotN??900)),v=s.cloudFreq??2.3,_=s.deform??1,u=.018+(.12*c+.04*r)*_,g=(.045*l+.03*i)*_,y=[],N=[];let E=0;for(let S=0;S<m;S++){const C=Mn(S,m),[P,q,G]=C,b=.55*Math.sin(2.1*P+1.3*q+.9*a)+.45*Math.sin(1.7*G-1.9*q-.7*a+1.3),w=Math.sin(5.3*P-4.1*G+2.3*a)*Math.sin(4.7*q+3.1*P-1.7*a),x=u*b+g*w;y.push(C),N.push(x),E+=x/m}const B=[];for(let S=0;S<m;S++){const[C,P,q]=y[S],G=N[S]-E,b=h*(1+G),[w,x,F]=p(C*b,P*b,q*b),R=j((F/h+1)/2),O=.65*zt(C*v+a*.21,P*v-a*.15,q*v+a*.1)+.35*zt(C*v*2.1-a*.29,P*v*2.1+7.3,q*v*2.1+a*.24),k=dn(.34,.68,O),I=Math.exp(-((P-f)**2)/.012)*M,T=Math.max(0,G)/.16;B.push({x:w,y:x,z:F,r:((s.rBase??.27)+(s.rDepth??.84)*R)*(.22+.95*k+.6*I)*(1+.5*T)*d,white:.62-.52*R-.16*k-.3*I,a:.3+.7*R})}return _t(B,[],s.rMin??.25)},Gs=["orbit","sash","signal","swell","pixel","aura"],Us={orbit:qs,sash:zs,signal:Ds,swell:Ls,pixel:Bs,aura:Ns},ot={orbit:{speed:1.05,driveGain:.12,opts:{orbitN:12,particles:6},counts:{}},sash:{speed:1.5,driveGain:.8,gain:1.1,opts:{lanes:10,segs:56,ghostN:60},counts:{segs:.45,ghostN:.8}},signal:{speed:1.6,driveGain:2,opts:{circles:8,segs:96},counts:{circles:.5,segs:.5}},swell:{speed:1.4,driveGain:2.4,opts:{dotN:900},counts:{dotN:1}},pixel:{speed:1.2,driveGain:1.6,attack:.16,dotSize:.55,opts:{cells:17},counts:{cells:.5}},aura:{speed:1.6,driveGain:2,voiceSpeed:.9,lean:{move:.21,pull:.36,deform:.28,squash:0,bounce:.92,lens:.49,stretch:1.04,split:1.01,blur:1.24},opts:{rings:6,segs:140},counts:{segs:.5}}};function $n(t,n,e=1,s=1){const o=t in ot?t:"orbit",r=ot[o],c=Math.min(1.4,Math.max(.2,n/200))*Math.max(.1,e),l={...r.opts};for(const[i,a]of Object.entries(r.counts)){const M=l[i];M!=null&&(l[i]=Math.max(1,Math.round(M*c**a)))}return s!==1&&(l.rMul=Math.max(.1,s)),{frame:Us[o],speed:r.speed,driveGain:r.driveGain,gain:r.gain??1,opts:l}}function $s(t){let n=t;for(;n;){const e=n.getAttribute("data-theme");if(e==="dark")return!0;if(e==="light")return!1;if(n.classList.contains("dark"))return!0;if(n.classList.contains("light"))return!1;n=n.parentElement}return null}function Ws(){return typeof matchMedia>"u"||matchMedia("(prefers-color-scheme: dark)").matches}function Vs(t,n){const[e,s]=$.useState(!0);return $.useEffect(()=>{if(t==="dark"){s(!0);return}if(t==="light"){s(!1);return}const o=()=>{const i=$s(n.current);s(i??Ws())};o();const r=typeof matchMedia<"u"?matchMedia("(prefers-color-scheme: dark)"):null,c=()=>o();r==null||r.addEventListener("change",c);let l=null;return typeof MutationObserver<"u"&&n.current&&(l=new MutationObserver(o),l.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"],subtree:!0})),()=>{r==null||r.removeEventListener("change",c),l==null||l.disconnect()}},[t,n]),e}function Xs(){const[t,n]=$.useState(!1);return $.useEffect(()=>{if(typeof matchMedia>"u")return;const e=matchMedia("(prefers-reduced-motion: reduce)");n(e.matches);const s=o=>n(o.matches);return e.addEventListener("change",s),()=>e.removeEventListener("change",s)},[]),t}const ut=16,Ks=2.1,js=.3,Ys=2.5,Hs=1.6,Zs=5,_n=2.2,Cn=[[80,300],[300,2e3],[2e3,6e3]],an=90,Js=7e3,cn=Math.PI*2,rn=.35,ln=.9;function Wn(t){return t<0?0:t>1?1:t}function hn(t,n){if(t<=n)return 0;const e=(t-n)/Math.max(.001,1-n);return Wn((1-Math.exp(-3*e))/(1-Math.exp(-3)))}function At(t,n,e,s,o){const r=n>t?s:o;return t+(n-t)*(1-Math.exp(-e/Math.max(.001,r)))}class Vn{constructor(){this.clock=0,this.t=0,this.drive=0,this.level=0,this.bands=[0,0,0],this.spectrum=new Float32Array(ut),this.floor=new Float32Array(ut+3).fill(1),this.heard=0,this.proc=0,this.spin=0,this.pan=0,this.panVel=0,this.raw={level:0,bands:[0,0,0],spectrum:new Float32Array(ut)},this.timeBuf=null,this.freqBuf=null,this.out={level:0,bands:[0,0,0],soft:0,softBands:[0,0,0],spectrum:this.spectrum,drive:0,processing:0,spin:0,pan:0}}readAnalyser(n,e,s){(!this.timeBuf||this.timeBuf.length!==n.fftSize)&&(this.timeBuf=new Float32Array(n.fftSize)),(!this.freqBuf||this.freqBuf.length!==n.frequencyBinCount)&&(this.freqBuf=new Uint8Array(n.frequencyBinCount));const o=this.timeBuf,r=this.freqBuf;n.getFloatTimeDomainData(o);let c=0;for(let h=0;h<o.length;h++)c+=o[h]*o[h];this.raw.level=Math.sqrt(c/o.length)*Zs*e,n.getByteFrequencyData(r);const l=n.context.sampleRate/n.fftSize,i=(h,f)=>{const p=Math.max(0,Math.floor(h/l)),d=Math.max(p,Math.min(r.length-1,Math.ceil(f/l)));let m=0;for(let v=p;v<=d;v++)m+=r[v];return m/(d-p+1)/255},a=(h,f)=>{const p=this.floor[h];return this.floor[h]=f<p?f:p+(f-p)*(1-Math.exp(-s/8)),Math.max(0,f-this.floor[h])/Math.max(.05,1-this.floor[h])};for(let h=0;h<3;h++)this.raw.bands[h]=a(h,i(Cn[h][0],Cn[h][1]))*_n*e;const M=Js/an;for(let h=0;h<ut;h++){const f=an*M**(h/ut),p=an*M**((h+1)/ut);this.raw.spectrum[h]=a(3+h,i(f,p))*_n*e}}readLevel(n,e){const s=Wn(n)*e,o=this.clock;this.raw.level=s,this.raw.bands[0]=s,this.raw.bands[1]=s*(.72+.28*Math.sin(o*2.3)),this.raw.bands[2]=s*(.6+.4*Math.sin(o*3.7+2));const r=.28+.1*Math.sin(o*2.3)+.05*Math.sin(o*5.1),c=.64+.1*Math.sin(o*1.7+1);for(let l=0;l<ut;l++){const i=l/(ut-1),a=Math.exp(-((i-r)**2)/.012)+.6*Math.exp(-((i-c)**2)/.008);this.raw.spectrum[l]=s*(.25+.75*a)*(1-.4*i)}}readSilence(){this.raw.level=0,this.raw.bands.fill(0),this.raw.spectrum.fill(0)}step(n,e,s){const{threshold:o,attack:r,release:c,rate:l}=e,i=this.proc=At(this.proc,e.processing?1:0,n,.35,.5),a=e.calm+(1-e.calm)*Math.min(1,Math.max(this.heard*2.5,i));s||(this.clock+=n,this.t+=n*l*a*(1+.5*i));const M=hn(this.raw.level,o);this.level=At(this.level,M,n,r,c),this.heard=At(this.heard,this.level,n,rn,ln);for(let u=0;u<3;u++)this.bands[u]=At(this.bands[u],hn(this.raw.bands[u],o*.6),n,r,c*1.15);for(let u=0;u<ut;u++)this.spectrum[u]=At(this.spectrum[u],hn(this.raw.spectrum[u],o*.6),n,r,c);const h=this.clock,f=s?.5:.5+.5*Math.sin(cn*h/6),p=e.idle*f*(1-i),d=this.out;d.level=this.level+(1-this.level)*p;for(let u=0;u<3;u++)d.bands[u]=this.bands[u]+(1-this.bands[u])*p*.6;d.soft=At(d.soft,d.level,n,rn,ln);for(let u=0;u<3;u++)d.softBands[u]=At(d.softBands[u],d.bands[u],n,rn,ln);if(s||(this.drive+=n*l*(a+e.driveGain*this.level+1.3*i)),d.drive=this.drive,d.processing=i,!s){const u=Math.ceil(this.spin/cn-1e-6)*cn,g=Math.min(js,(u-this.spin)*.6);this.spin+=n*(Ks*l*i+g*(1-i))}d.spin=this.spin;const m=Math.max(-1,Math.min(1,e.direction||0)),v=this.heard>.06&&!e.processing?m:0,_=Math.abs(v)>Math.abs(this.pan)?Ys:Hs;return this.panVel+=(_*_*(v-this.pan)-2*_*this.panVel)*n,this.pan+=this.panVel*n,d.pan=this.pan,d}}function Qs(t){if(!t)return;const n=t.trim().match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(n){let s=n[1];s.length===3&&(s=s.replace(/./g,r=>r+r));const o=parseInt(s,16);return{r:o>>16&255,g:o>>8&255,b:o&255}}const e=t.trim().match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);if(e)return{r:Number(e[1]),g:Number(e[2]),b:Number(e[3])}}const te={idle:"Waiting",listening:"Listening",speaking:"Speaking",processing:"Thinking"},ne=1e3/62;function Xn({type:t="orbit",state:n="listening",size:e=160,stream:s,analyser:o,level:r,sensitivity:c=.85,threshold:l=.04,attack:i,release:a=.32,idle:M=.1,calm:h=.4,voiceSpeed:f,emotion:p=null,emotionColors:d,saturation:m=2,accent:v=null,gradientAngle:_=99,gradientSpin:u=12,neutral:g=1,colorBrightness:y=1.02,colorHue:N=0,gradientStart:E=.1,gradientWidth:B=.6,direction:S,directionMove:C,directionPull:P,directionDeform:q,directionSquash:G,directionLens:b,directionStretch:w,directionSplit:x,directionBlur:F,directionBounce:R,directionMargin:O,directionBounds:k,theme:I="auto",speed:T=1,paused:A=!1,color:z,dots:L=1,dotSize:U,opts:W,frame:Z,onLevel:nt,style:Y,"aria-label":X,...ct}){const J=$.useRef(null),Q=Vs(I,J),V=Xs(),dt=W?JSON.stringify(W):"",rt=!!(s||o||r!=null||n==="processing"),it=$.useRef(null);it.current||(it.current=new Vn);const st=$.useRef(null);st.current||(st.current=new cs);const mt=p?(d==null?void 0:d[p])??qt[p]:null,ht={saturation:Math.min(1,m),vivid:Math.max(0,Math.min(1,m-1)),brightness:y,hue:N,start:E,width:B,accent:v?Nn[v]:null,angle:_,spin:u,neutral:g,size:e},gt=U??ot[t in ot?t:"orbit"].dotSize??1,lt=ot[t in ot?t:"orbit"].lean??{},wt=O??ot[t in ot?t:"orbit"].margin??32,Ct={state:n,level:r,analyser:o,sensitivity:c,threshold:l,attack:i??ot[t in ot?t:"orbit"].attack??.06,release:a,idle:M,calm:h,voiceSpeed:f??ot[t in ot?t:"orbit"].voiceSpeed??1,onLevel:nt,emotionTint:mt,colors:ht,direction:S,bounds:k,lean:{move:C??lt.move??Mt.move,pull:P??lt.pull??Mt.pull,deform:q??lt.deform??Mt.deform,squash:G??lt.squash??Mt.squash,lens:b??lt.lens??Mt.lens,stretch:w??lt.stretch??Mt.stretch,split:x??lt.split??Mt.split,blur:F??lt.blur??Mt.blur,bounce:R??lt.bounce??Mt.bounce}},kt=$.useRef(Ct);kt.current=Ct;const Pt=S==null?0:rs(Ct.lean,e),[mn,Kn]=$.useState([1/0,1/0]),jt=Math.min(Pt,mn[0]),Yt=Math.min(Pt,mn[1]),bt=Pt?jt+wt:0,Ft=Pt?Yt+wt:0,Ht=$.useRef(null);return $.useEffect(()=>{if(!s)return;const et=In(s);return Ht.current=(et==null?void 0:et.analyser)??null,()=>{Ht.current=null,et==null||et.release()}},[s]),$.useEffect(()=>{const et=J.current;if(!et)return;const It=Math.min(2,typeof devicePixelRatio<"u"&&devicePixelRatio||1);et.width=Math.round((e+bt+Ft)*It),et.height=Math.round(e*It);const Lt=et.getContext("2d");if(!Lt)return;const Et=$n(t,e,L,gt),jn=W?{...Et.opts,...W}:Et.opts,Yn=Z??Et.frame,Hn=Qs(z),vt=it.current,Zn=st.current,Jn=new is;let gn=0;const Qn=(H,K,D)=>{var wn;Lt.setTransform(It,0,0,It,bt*It,0),Lt.clearRect(-bt,0,e+bt+Ft,e);const Nt=A||V?0:Jn.step(gn,D),yt=ls(Yn(e,vt.t,H,jn),H.pan,e,kt.current.lean,[jt,Yt],Nt);gn=((wn=yt.contact)==null?void 0:wn.press)??0;const at=kt.current.colors,pt=K.amount,tt=at.accent,Ot=tt?{r:tt.r+(K.r-tt.r)*pt,g:tt.g+(K.g-tt.g)*pt,b:tt.b+(K.b-tt.b)*pt}:{r:K.r,g:K.g,b:K.b},ns={...at,accent:Ot,saturation:at.saturation*(tt?1:pt),angle:at.angle+at.spin*vt.clock};Fs(Lt,yt,Q,Hn,yt.light?K:void 0,ns)};let bn=-1/0;const ts=H=>{var pt,tt;if(!Pt||H-bn<500)return;bn=H;const K=et.getBoundingClientRect().left+bt,D=(tt=(pt=kt.current.bounds)==null?void 0:pt.current)==null?void 0:tt.getBoundingClientRect(),Nt=D?D.left:0,yt=D?D.right:document.documentElement.clientWidth,at=[Math.max(0,Math.floor(K-Nt-wt)),Math.max(0,Math.floor(yt-K-e-wt))];Kn(Ot=>Math.abs(Ot[0]-at[0])>1||Math.abs(Ot[1]-at[1])>1?at:Ot)};let Gt=0;const vn=H=>{var tt;ts(H);const K=Gt?Math.min(.05,(H-Gt)/1e3):1/60;Gt=H;const D=kt.current,Nt=D.state==="listening"||D.state==="speaking",yt=Ht.current??D.analyser??null;Nt?yt?vt.readAnalyser(yt,D.sensitivity*Et.gain,K):D.level!=null?vt.readLevel(typeof D.level=="function"?D.level():D.level,D.sensitivity*Et.gain):vt.readSilence():vt.readSilence();const at=vt.step(K,{sensitivity:D.sensitivity,threshold:D.threshold,attack:D.attack,release:D.release,idle:D.idle,driveGain:Et.driveGain*D.voiceSpeed,calm:D.calm,rate:Et.speed*T,processing:D.state==="processing",direction:typeof D.direction=="function"?D.direction():D.direction??0},V);(tt=D.onLevel)==null||tt.call(D,at.level);const pt=Zn.step(K,D.emotionTint,vt.clock,e,A||V);Qn(at,pt,K)};if(vn(performance.now()),A||V&&!rt)return;let Zt=0,Ut=!1,yn=0;const xn=H=>{Ut&&(Zt=requestAnimationFrame(xn),!(H-yn<ne)&&(yn=H,vn(H)))},Jt=()=>{Ut||(Ut=!0,Gt=0,Zt=requestAnimationFrame(xn))},Qt=()=>{Ut=!1,cancelAnimationFrame(Zt)};let tn=!0;const Tt=typeof IntersectionObserver<"u"?new IntersectionObserver(([H])=>{tn=H.isIntersecting,tn&&document.visibilityState!=="hidden"?Jt():Qt()}):null;Tt==null||Tt.observe(et);const Sn=()=>{document.visibilityState==="hidden"?Qt():tn&&Jt()};return document.addEventListener("visibilitychange",Sn),Tt||Jt(),()=>{Qt(),Tt==null||Tt.disconnect(),document.removeEventListener("visibilitychange",Sn)}},[t,e,Pt,jt,Yt,bt,Ft,wt,Q,T,A,V,rt,z,L,gt,dt,Z,A||V?p:null,A||V?`${m}|${v}|${_}|${u}|${g}|${y}|${N}|${E}|${B}`:null]),kn.jsx("canvas",{ref:J,role:"img","aria-label":X??te[n],style:{width:e+bt+Ft,height:e,display:"block",marginLeft:-bt,marginRight:-Ft,...Y},...ct})}const se={echoCancellation:!1,noiseSuppression:!1,autoGainControl:!1};function Xt(){return typeof navigator<"u"&&typeof navigator.mediaDevices<"u"&&typeof navigator.mediaDevices.getUserMedia=="function"}function ee(t={}){const{constraints:n,autoStart:e=!1}=t,[s,o]=$.useState(null),[r,c]=$.useState(()=>Xt()?"idle":"unsupported"),[l,i]=$.useState(null),a=$.useRef(null),M=$.useRef(n);M.current=n;const h=$.useCallback(()=>{const p=a.current;a.current=null,p&&p.getTracks().forEach(d=>d.stop()),o(null),c(Xt()?"idle":"unsupported")},[]),f=$.useCallback(async()=>{if(!Xt())return c("unsupported"),null;if(a.current)return a.current;fn(),c("requesting"),i(null);try{const p=await navigator.mediaDevices.getUserMedia({audio:{...se,...M.current??{}}});a.current=p,o(p),c("live");const d=()=>{a.current===p&&(a.current=null,o(null),c("idle"))};return p.getAudioTracks().forEach(m=>m.addEventListener("ended",d)),p}catch(p){const d=p instanceof Error?p:new Error(String(p));return i(d),c(d.name==="NotAllowedError"||d.name==="SecurityError"?"denied":"error"),null}},[]);return $.useEffect(()=>{e&&f()},[e]),$.useEffect(()=>()=>{const p=a.current;a.current=null,p&&p.getTracks().forEach(d=>d.stop())},[]),{stream:s,state:r,error:l,supported:Xt(),start:f,stop:h}}function oe(t){return kn.jsx(Xn,{...t,type:"aura"})}exports.ACCENT_COLORS=Nn;exports.EMOTION_COLORS=qt;exports.PRESETS=ot;exports.SPECTRUM_N=ut;exports.VOICE_ORB_TYPES=Gs;exports.VoiceFollower=Vn;exports.VoiceOrb=Xn;exports.VoiceRing=oe;exports.acquireAnalyser=In;exports.getAudioContext=fn;exports.isAudioSupported=ss;exports.resolvePreset=$n;exports.useMicrophone=ee;
41
+ }`;let Zt;function He(){if(typeof document>"u")return null;const t=document.createElement("canvas"),n=t.getContext("webgl",{premultipliedAlpha:!0,antialias:!1,depth:!1});if(!n)return null;const s=(i,a)=>{const d=n.createShader(i);return n.shaderSource(d,a),n.compileShader(d),d},e=n.createProgram();if(n.attachShader(e,s(n.VERTEX_SHADER,Ve)),n.attachShader(e,s(n.FRAGMENT_SHADER,Xe)),n.linkProgram(e),!n.getProgramParameter(e,n.LINK_STATUS))return null;n.useProgram(e);const o=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,o),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),n.STATIC_DRAW);const c=n.getAttribLocation(e,"aPos");n.enableVertexAttribArray(c),n.vertexAttribPointer(c,2,n.FLOAT,!1,0,0);const r=n.createTexture();n.bindTexture(n.TEXTURE_2D,r),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);const l={};for(const i of["uSize","uWall","uSide","uZone","uGap","uFlare","uSplit","uBlur","uCy"])l[i]=n.getUniformLocation(e,i);return{gl:n,canvas:t,source:document.createElement("canvas"),tex:r,u:l}}function Ke(t,n,s,e){if(Zt===void 0&&(Zt=He()),!Zt)return!1;const{gl:o,canvas:c,source:r,tex:l,u:i}=Zt,a=t.getTransform(),d=Math.hypot(a.a,a.b)||1,h=t.canvas.width,f=t.canvas.height,m=a.a*s+a.e,p=e.zone*d,M=e.blur*d,v=Math.max(0,Math.floor(n>0?m-p-2*M-4:0)),u=Math.min(h,Math.ceil(n>0?h:m+p+2*M+4))-v;if(u<2||f<2)return!1;(r.width!==u||r.height!==f)&&(r.width=u,r.height=f);const g=r.getContext("2d");return g.clearRect(0,0,u,f),g.drawImage(t.canvas,v,0,u,f,0,0,u,f),(c.width!==u||c.height!==f)&&(c.width=u,c.height=f),o.viewport(0,0,u,f),o.bindTexture(o.TEXTURE_2D,l),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,r),o.uniform2f(i.uSize,u,f),o.uniform1f(i.uWall,m-v),o.uniform1f(i.uSide,n),o.uniform1f(i.uZone,p),o.uniform1f(i.uGap,e.gap*d),o.uniform1f(i.uFlare,e.flare),o.uniform1f(i.uSplit,e.split*d),o.uniform1f(i.uBlur,M),o.uniform1f(i.uCy,a.d*e.cy+a.f),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.drawArrays(o.TRIANGLE_STRIP,0,4),t.save(),t.setTransform(1,0,0,1,0,0),t.globalCompositeOperation="copy",t.beginPath(),t.rect(v,0,u,f),t.clip(),t.drawImage(c,v,0),t.restore(),!0}function Zn(t,n,s,e){const o=2.2/e.size,c=Ut(t*o+e.t*.11,n*o-e.t*.08,e.t*.07),r=yn(.3,.75,c);return e.amount*(.2+.75*r)*Z(1.3-s)}function Jn(t,n,s,e,o,c=0,r,l=0){const i=Math.round(n*1e3)/1e3,a=p=>s?p*(1-t):p+(255-p)*t,d=(s?1-t:t)*255;let h=e?a(e.r):d,f=e?a(e.g):d,m=e?a(e.b):d;return r&&l>0&&(h+=(a(r[0])-h)*l,f+=(a(r[1])-f)*l,m+=(a(r[2])-m)*l),o&&c>0&&(h+=(a(o.r)-h)*c,f+=(a(o.g)-f)*c,m+=(a(o.b)-m)*c),`rgba(${Math.round(h)},${Math.round(f)},${Math.round(m)},${i})`}const Ln=24,Dn=8;function Ye(t,n,s,e,o,c){const r=o&&o.amount>.005?o:void 0,l=c&&c.saturation>0?c:void 0,i=new Map;for(const a of n){const d=a.pts.length>>1,h=a.closed?d:d-1;let f="",m;for(let p=0;p<h;p++){const M=p+1===d?0:p+1,v=Math.round(Z((a.a[p]+a.a[M])/2)*Ln);if(v===0){f="";continue}const A=r?Math.round(Zn((a.pts[2*p]+a.pts[2*M])/2,(a.pts[2*p+1]+a.pts[2*M+1])/2,a.white,r)*Dn):0,u=l?l.at((a.pts[2*p]+a.pts[2*M])/2,(a.pts[2*p+1]+a.pts[2*M+1])/2):0,g=`${v}|${a.white}|${Math.round(a.w*20)}|${A}|${u}`;if(g!==f){let x=i.get(g);x||(x={path:new Path2D,white:a.white,w:a.w,a:v/Ln,gw:A/Dn,ci:u},i.set(g,x)),m=x,f=g,x.path.moveTo(a.pts[2*p],a.pts[2*p+1])}m.path.lineTo(a.pts[2*M],a.pts[2*M+1])}}t.lineCap="round",t.lineJoin="round";for(const a of i.values())t.strokeStyle=Jn(Z(a.white),a.a,s,e,r,a.gw,l==null?void 0:l.rgb,l==null?void 0:l.mix[a.ci]),t.lineWidth=a.w,t.stroke(a.path)}function je(t,n,s,e,o,c,r=!1){const l=o&&o.amount>.005?o:void 0,i=c&&c.saturation>0?c:void 0;for(const a of n){const d=Z(a.white),h=l?Zn(a.x,a.y,d,l):0,f=i?i.at(a.x,a.y):0;if(t.fillStyle=Jn(d,Z(a.a??1),s,e,l,h,i==null?void 0:i.rgb,i==null?void 0:i.mix[f]),r){t.fillRect(a.x-a.r,a.y-a.r,2*a.r,2*a.r);continue}t.beginPath(),t.arc(a.x,a.y,a.r,0,bt),t.fill()}}function Ze(t,n,s,e,o,c){var l;const r=c&&c.saturation>0&&!n.light?ke(c):void 0;n.light?We(t,n,n.light,s,e,o):n.strokes.length&&Ye(t,n.strokes,s,e,o,r),je(t,n.dots,s,e,o,r,n.square),(l=n.contact)!=null&&l.lens&&Ke(t,n.contact.side,n.contact.x,n.contact.lens)}const Je=[[0,255,150,90],[.12,255,110,120],[.24,255,80,170],[.4,190,80,255],[.58,90,92,255],[.74,60,132,255],[.84,170,90,255],[.93,240,104,165],[1,255,150,90]],Qe=(t,n,s,e)=>{const o=t/2,c=s.level,[r,l]=s.softBands,i=s.bands[2],a=s.drive,d=s.processing,h=.5*c+.5*s.soft,f=o*(e.radius??.56)*(1+(e.zoom??.17)*s.soft)*(1-.06*d),m=e.deform??1.45,p=.02+(.14*r+.06*c)*m,M=.01+(.07*l+.03*i)*m,v=Sn(p,M,a,e.deformRadius??1.75),A=Math.max(.6,(e.lineW??1.85)*zt(t,.5)),u=Math.max(1,Math.round(e.rings??6)),g=Math.max(24,Math.round(e.segs??140)),x=e.lean??.91,O=e.ringGap??.02,w=[];let G=0,S=0;for(let y=0;y<u;y++){const I=.16*(.5+Tt(y,2.1))*(y%2?1:-1),R=Math.max(.02,x*(.2+.8*Tt(y,3.1))+.03*Math.sin(n*.27+y*1.3)+.08*Math.sin(a*.35+y*1.7)),B=Tt(y,7.7)*bt+n*.05*(y%2?1:-1)+a*I,k=Math.sin(R)*Math.cos(B),F=Math.sin(R)*Math.sin(B),T=Math.cos(R),P=Math.hypot(k,T),N=T/P,D=-k/P,z=F*D,V=T*N-k*D,X=-F*N,tt=f*(1+O*(y-(u-1)/2)),J=Math.sin(R),H=[],ct=[],st=[];for(let K=0;K<g;K++){const ot=K/g*bt,W=Math.cos(ot),ut=Math.sin(ot),ft=N*W+z*ut,nt=V*ut,dt=D*W+X*ut,pt=v(ft,nt,dt);H.push(ft,nt),ct.push(pt),G+=pt,S++,st.push(.62+.38*Z((dt/J+1)/2))}w.push({dirs:H,f:ct,a:st,rk:tt})}const C=S?G/S:0;let _=0,L=0;for(const{dirs:y,f:I}of w)for(let R=0;R<I.length;R++){const B=y[2*R],k=y[2*R+1],F=Math.hypot(B,k)||1;_+=(I[R]-C)*(B/F),L+=(I[R]-C)*(k/F)}_=S?2*_/S:0,L=S?2*L/S:0;const U=w.map(({dirs:y,f:I,a:R,rk:B})=>{const k=[];for(let F=0;F<I.length;F++){const T=y[2*F],P=y[2*F+1],N=Math.hypot(T,P)||1,D=B*(1+I[F]-C-_*(T/N)-L*(P/N));k.push(o+T*D,o-P*D)}return{pts:k,a:R,white:0,w:A,closed:!0}}),b=2.3+.25*Math.sin(n*.21)+2*s.spin,E={cx:o,cy:o,r:f,stops:Je,angle:-Math.PI/2-.35+.5*Math.sin(n*.07)+.4*Math.sin(a*.2)+s.spin,intensity:.62+.55*h+.5*d,halo:(e.halo??.5)*(1+.6*d),spec:[{x:o+Math.cos(b)*f,y:o+Math.sin(b)*f,r:f*(.5+.25*d),a:.5+.35*h+.4*d}],fringe:.016+.012*h,green:[e.greenFrom??81,e.greenTo??136]};return{...Nt([],U),light:E}},Qn=-.45,te=.55,ne=.7,ts=Math.hypot(Qn,te,ne),ns=(t,n,s,e)=>{const o=t/2,c=s.level,[r,l,i]=s.bands,a=s.drive,d=s.processing,h=o*(e.radius??.72),f=h*(1+(e.zoom??.3)*c)*(1-.06*d),m=e.rMul??1,p=Math.max(4,Math.round(e.cells??17)),M=2*h/p,v=M/2-Math.max(.5,M*(e.gap??.24)/2),A=Math.ceil(f*1.25/M),u=(e.turn??.12)*n+.1*a+.5*s.spin,g=Math.sin(u),x=Math.cos(u),O=Math.sin(.35),w=Math.cos(.35),G=e.shade??.7,S=e.texture??.35,C=e.fade??1.3,_=e.strength??1.38,L=e.deform??1.7,U=.012+(.09*r+.03*c)*L,b=(.035*l+.025*i)*L,E=k=>U*(.55*Math.sin(2*k+.9*a)+.45*Math.sin(3*k-.7*a+1.3))+b*Math.sin(7*k+2.3*a)*Math.sin(5*k-1.7*a),y=.95*Math.sin(n*1.3),I=s.spectrum,R=I.length,B=[];for(let k=-A;k<=A;k++)for(let F=-A;F<=A;F++){const T=o+F*M,P=o+k*M,N=(T-o)/f,D=-(P-o)/f,z=E(Math.atan2(D,N)),V=Math.hypot(N,D)/(1+z);if(V>=1)continue;const X=1/(1+z),tt=N*X,J=D*X,H=Math.sqrt(Math.max(0,1-tt*tt-J*J)),ct=Z((tt*Qn+J*te+H*ne)/ts),st=1-G+G*ct,K=J*w+H*O,ot=-J*O+H*w,W=tt*x-ot*g,ut=tt*g+ot*x,ft=.65*Ut(W*2.2+a*.15,K*2.2,ut*2.2-a*.1)+.35*Ut(W*4.6-a*.2,K*4.6+7.3,ut*4.6),nt=1-S+S*yn(.32,.68,ft),dt=R?I[Math.min(R-1,Math.floor(V*R))]:c,pt=.35*c+.85*dt,Rt=Math.exp(-((J-y)**2)/.01)*d,$t=1-.4*C*(1-H),rt=(.35+.75*st*nt+.3*pt+.2*Rt)*$t*m,At=.22+.62*st*nt+.22*pt+.3*Rt;B.push({x:T,y:P,z:H*f,r:v*Math.min(1,rt),white:Z(1-At*_),a:Z((1-.75*C*(1-Math.sqrt(H)))*_)})}return{...Nt(B,[],e.rMin??.4),square:!0}},es=(t,n,s,e)=>{const o=t/2,c=t/2,r=.5*s.level+.5*s.soft,l=(1+(e.swell??.49)*r)*(1-.14*s.processing),i=t/2*(e.radius??.56),a=e.persp??.25,d=Qt(n*.12+s.drive*.03,.3,0,0,1),h=zt(t,e.rsPow??.9)*(e.rMul??1),f=[],m=e.orbitN??12,p=e.particles??6;for(let M=0;M<m;M++){const v=Tt(M,1.7),A=Tt(M,5.2),u=Tt(M,8.9),g=i*(.45+.52*v),x=v*bt,O=Math.acos(2*A-1),w=Math.sin(O)*Math.cos(x),G=Math.cos(O),S=Math.sin(O)*Math.sin(x);let C=-G,_=w;const L=Math.max(1e-6,Math.sqrt(C*C+_*_));C/=L,_/=L;const U=-S*_,b=S*C,E=w*_-G*C,y=(.25+.55*u)*(u>.5?1:-1);for(let I=0;I<p;I++){const R=s.drive*y+I/p*bt+A*6,B=Math.cos(R),k=Math.sin(R),[F,T,P]=d((C*B+U*k)*g,(_*B+b*k)*g,E*k*g),N=Z((P/i+1)/2),D=l/(1-a*P/i);f.push({x:o+F*D,y:c+T*D,z:P,r:((e.partR??.47)+(e.partRDepth??.65)*N)*h*D,white:.32-.24*N})}}return Nt(f,[],e.rMin)},ss=(t,n,s,e)=>{const o=t/2,c=t/2,r=s.soft,[l,i]=s.softBands,a=t/2*(e.radius??.66)*(1+(e.zoom??.21)*s.level),d=s.drive,h=e.deform??1,f=e.wave??1,m=.015+(.1*l+.05*s.level)*h,p=.04*i*h,M=Sn(m,p,d),v=.55+.05*Math.sin(n*.37),A=Math.cos(v),u=Math.sin(v);let g=0;for(let T=0;T<48;T++){const P=T/48*bt;g+=M(Math.cos(P),Math.sin(P)*A,Math.sin(P)*u)}g/=48;const x=(T,P,N)=>1+M(T,P,N)-g,w=Qt(0,.3,o,c,1),G=zt(t,e.rsPow??.6)*(e.rMul??1),S=s.drive,C=[],_=e.ghostN??60;for(let T=0;T<_;T++){const P=En(T,_),N=a*x(P[0],P[1],P[2]),[D,z,V]=w(P[0]*N,P[1]*N,P[2]*N),X=(V/a+1)/2;C.push({x:D,y:z,z:V,r:.65*G,white:.78,a:.1+.22*X})}const L=-u,U=A,b=Math.max(1,Math.round(e.lanes??10)),E=Math.max(8,Math.round(e.segs??56)),y=s.processing,I=(e.laneGap??.062)*(1+.25*r)*(1-.4*y),R=S*1.6,B=.15*(.55+.9*l*f)*(1-.6*y),k=.06*(.5+1.2*i*f),F=.05+.05*r;for(let T=0;T<b;T++){const P=(T-(b-1)/2)*I,N=Math.abs(T-(b-1)/2)/Math.max(1,(b-1)/2);for(let D=0;D<E;D++){const z=D/E*bt,V=B*Math.sin(z*3-S*.95+T*.18)+k*Math.sin(z*5+S*.6)+F*Math.sin(z*2+n*.31+Math.sin(n*.17)*1.5),X=P+V,tt=Math.cos(z),J=Math.sin(z),H=tt,ct=J*A+L*X,st=J*u+U*X,K=Math.sqrt(H*H+ct*ct+st*st),ot=a*x(H/K,ct/K,st/K)/K,[W,ut,ft]=w(H*ot,ct*ot,st*ot),nt=(ft/a+1)/2,dt=Math.max(0,V)*r,pt=Math.atan2(Math.sin(z-R),Math.cos(z-R)),Rt=Math.exp(-(pt*pt)/.18)*y;C.push({x:W,y:ut,z:ft,r:((e.rBase??.49)+(e.rDepth??.78)*nt)*(1-.25*N)*(1+1.2*dt+.5*Rt)*G,white:.52-.44*nt+.18*N-.3*Rt,a:.4+.6*nt})}}return Nt(C,[],e.rMin)},os=(t,n,s,e)=>{const o=t/2,c=s.level,[r,l]=s.softBands,i=s.bands[2],a=s.drive,d=o*(e.radius??.6)*(1+(e.zoom??.06)*s.soft)*(1-.08*s.processing),h=Qt((e.yaw??.42)+.08*Math.sin(n*.23),e.tilt??.32,o,o,1),f=Math.max(.4,(e.lineW??.6)*zt(t,.5)),m=w=>.06+.94*Z((w/d+1)/2)**2,p=e.deform??1,M=.02+(.14*r+.06*c)*p,v=.01+(.07*l+.03*i)*p,A=Sn(M,v,a),u=[],g=Math.max(24,Math.round(e.segs??96)),x=Math.max(0,Math.round(e.limbs??2));for(let w=0;w<x;w++){const G=.1+.05*Math.sin(n*.31+w*2.1),S=n*.17*(w%2?1:-1)+w*2.4,C=Math.sin(G)*Math.cos(S),_=Math.sin(G)*Math.sin(S),L=Math.cos(G),U=Math.hypot(C,L),b=L/U,E=-C/U,y=_*E,I=L*b-C*E,R=-_*b,B=[],k=[];for(let F=0;F<g;F++){const T=F/g*bt,P=b*Math.cos(T)+y*Math.sin(T),N=I*Math.sin(T),D=E*Math.cos(T)+R*Math.sin(T),z=d*(1+.006*w+A(P,N,D));B.push(o+P*z,o-N*z),k.push(.55+.35*Z((D/Math.sin(G)+1)/2))}u.push({pts:B,a:k,white:0,w:f,closed:!0})}const O=Math.max(2,Math.round(e.circles??8));for(let w=0;w<O;w++){const[G,S,C]=En(w,O),_=a*.16*(.5+Tt(w,2.1))*(w%2?1:-1)+Tt(w,6.6)*bt,L=S*Math.cos(_)-C*Math.sin(_),U=S*Math.sin(_)+C*Math.cos(_),b=Math.max(1e-6,Math.hypot(U,G)),E=U/b,y=-G/b,I=L*y,R=U*E-G*y,B=-L*E,k=[],F=[];for(let T=0;T<g;T++){const P=T/g*bt,N=E*Math.cos(P)+I*Math.sin(P),D=R*Math.sin(P),z=y*Math.cos(P)+B*Math.sin(P),V=d*(1+A(N,D,z)),[X,tt,J]=h(N*V,D*V,z*V);k.push(X,tt),F.push(m(J))}u.push({pts:k,a:F,white:0,w:f,closed:!0})}return Nt([],u,e.rMin)},as=(t,n,s,e)=>{const o=t/2,c=s.level,[r,l,i]=s.bands,a=s.drive,d=s.processing,h=o*(e.radius??.6)*(1+(e.zoom??.1)*c)*(1-.08*d),f=.95*Math.sin(n*1.3),m=Qt(n*.14,.32,o,o,1),p=zt(t,e.rsPow??.6)*(e.rMul??1),M=Math.max(40,Math.round(e.dotN??900)),v=e.cloudFreq??2.3,A=e.deform??1,u=.018+(.12*r+.04*c)*A,g=(.045*l+.03*i)*A,x=[],O=[];let w=0;for(let S=0;S<M;S++){const C=En(S,M),[_,L,U]=C,b=.55*Math.sin(2.1*_+1.3*L+.9*a)+.45*Math.sin(1.7*U-1.9*L-.7*a+1.3),E=Math.sin(5.3*_-4.1*U+2.3*a)*Math.sin(4.7*L+3.1*_-1.7*a),y=u*b+g*E;x.push(C),O.push(y),w+=y/M}const G=[];for(let S=0;S<M;S++){const[C,_,L]=x[S],U=O[S]-w,b=h*(1+U),[E,y,I]=m(C*b,_*b,L*b),R=Z((I/h+1)/2),B=.65*Ut(C*v+a*.21,_*v-a*.15,L*v+a*.1)+.35*Ut(C*v*2.1-a*.29,_*v*2.1+7.3,L*v*2.1+a*.24),k=yn(.34,.68,B),F=Math.exp(-((_-f)**2)/.012)*d,T=Math.max(0,U)/.16;G.push({x:E,y,z:I,r:((e.rBase??.27)+(e.rDepth??.84)*R)*(.22+.95*k+.6*F)*(1+.5*T)*p,white:.62-.52*R-.16*k-.3*F,a:.3+.7*R})}return Nt(G,[],e.rMin??.25)},cs=["orbit","sash","signal","swell","pixel","aura"],rs={orbit:es,sash:ss,signal:os,swell:as,pixel:ns,aura:Qe},et={orbit:{speed:1.05,driveGain:.12,opts:{orbitN:12,particles:6},counts:{}},sash:{speed:1.5,driveGain:.8,gain:1.1,opts:{lanes:10,segs:56,ghostN:60},counts:{segs:.45,ghostN:.8}},signal:{speed:1.6,driveGain:2,opts:{circles:8,segs:96},counts:{circles:.5,segs:.5}},swell:{speed:1.4,driveGain:2.4,opts:{dotN:900},counts:{dotN:1}},pixel:{speed:1.2,driveGain:1.6,attack:.16,dotSize:.55,opts:{cells:17},counts:{cells:.5}},aura:{speed:1.6,driveGain:2,voiceSpeed:.9,lean:{move:.21,pull:.36,deform:.28,squash:0,bounce:.92,lens:.49,stretch:1.04,split:1.01,blur:1.24},opts:{rings:6,segs:140},counts:{segs:.5}}};function ee(t,n,s=1,e=1){const o=t in et?t:"orbit",c=et[o],r=Math.min(1.4,Math.max(.2,n/200))*Math.max(.1,s),l={...c.opts};for(const[i,a]of Object.entries(c.counts)){const d=l[i];d!=null&&(l[i]=Math.max(1,Math.round(d*r**a)))}return e!==1&&(l.rMul=Math.max(.1,e)),{frame:rs[o],speed:c.speed,driveGain:c.driveGain,gain:c.gain??1,opts:l}}function is(t){let n=t;for(;n;){const s=n.getAttribute("data-theme");if(s==="dark")return!0;if(s==="light")return!1;if(n.classList.contains("dark"))return!0;if(n.classList.contains("light"))return!1;n=n.parentElement}return null}function ls(){return typeof matchMedia>"u"||matchMedia("(prefers-color-scheme: dark)").matches}function hs(t,n){const[s,e]=$.useState(!0);return $.useEffect(()=>{if(t==="dark"){e(!0);return}if(t==="light"){e(!1);return}const o=()=>{const i=is(n.current);e(i??ls())};o();const c=typeof matchMedia<"u"?matchMedia("(prefers-color-scheme: dark)"):null,r=()=>o();c==null||c.addEventListener("change",r);let l=null;return typeof MutationObserver<"u"&&n.current&&(l=new MutationObserver(o),l.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"],subtree:!0})),()=>{c==null||c.removeEventListener("change",r),l==null||l.disconnect()}},[t,n]),s}function us(){const[t,n]=$.useState(!1);return $.useEffect(()=>{if(typeof matchMedia>"u")return;const s=matchMedia("(prefers-reduced-motion: reduce)");n(s.matches);const e=o=>n(o.matches);return s.addEventListener("change",e),()=>s.removeEventListener("change",e)},[]),t}const gt=16,fs=2.1,ds=.3,ps=2.5,ms=1.6,Ms=5,Un=2.2,zn=[[80,300],[300,2e3],[2e3,6e3]],pn=90,gs=7e3,mn=Math.PI*2,Mn=.35,gn=.9;function se(t){return t<0?0:t>1?1:t}function bn(t,n){if(t<=n)return 0;const s=(t-n)/Math.max(.001,1-n);return se((1-Math.exp(-3*s))/(1-Math.exp(-3)))}function Ft(t,n,s,e,o){const c=n>t?e:o;return t+(n-t)*(1-Math.exp(-s/Math.max(.001,c)))}class oe{constructor(){this.clock=0,this.t=0,this.drive=0,this.level=0,this.bands=[0,0,0],this.spectrum=new Float32Array(gt),this.floor=new Float32Array(gt+3).fill(1),this.heard=0,this.proc=0,this.spin=0,this.pan=0,this.panVel=0,this.raw={level:0,bands:[0,0,0],spectrum:new Float32Array(gt)},this.timeBuf=null,this.freqBuf=null,this.out={level:0,bands:[0,0,0],soft:0,softBands:[0,0,0],spectrum:this.spectrum,drive:0,processing:0,spin:0,pan:0}}readAnalyser(n,s,e){(!this.timeBuf||this.timeBuf.length!==n.fftSize)&&(this.timeBuf=new Float32Array(n.fftSize)),(!this.freqBuf||this.freqBuf.length!==n.frequencyBinCount)&&(this.freqBuf=new Uint8Array(n.frequencyBinCount));const o=this.timeBuf,c=this.freqBuf;n.getFloatTimeDomainData(o);let r=0;for(let h=0;h<o.length;h++)r+=o[h]*o[h];this.raw.level=Math.sqrt(r/o.length)*Ms*s,n.getByteFrequencyData(c);const l=n.context.sampleRate/n.fftSize,i=(h,f)=>{const m=Math.max(0,Math.floor(h/l)),p=Math.max(m,Math.min(c.length-1,Math.ceil(f/l)));let M=0;for(let v=m;v<=p;v++)M+=c[v];return M/(p-m+1)/255},a=(h,f)=>{const m=this.floor[h];return this.floor[h]=f<m?f:m+(f-m)*(1-Math.exp(-e/8)),Math.max(0,f-this.floor[h])/Math.max(.05,1-this.floor[h])};for(let h=0;h<3;h++)this.raw.bands[h]=a(h,i(zn[h][0],zn[h][1]))*Un*s;const d=gs/pn;for(let h=0;h<gt;h++){const f=pn*d**(h/gt),m=pn*d**((h+1)/gt);this.raw.spectrum[h]=a(3+h,i(f,m))*Un*s}}readLevel(n,s){const e=se(n)*s,o=this.clock;this.raw.level=e,this.raw.bands[0]=e,this.raw.bands[1]=e*(.72+.28*Math.sin(o*2.3)),this.raw.bands[2]=e*(.6+.4*Math.sin(o*3.7+2));const c=.28+.1*Math.sin(o*2.3)+.05*Math.sin(o*5.1),r=.64+.1*Math.sin(o*1.7+1);for(let l=0;l<gt;l++){const i=l/(gt-1),a=Math.exp(-((i-c)**2)/.012)+.6*Math.exp(-((i-r)**2)/.008);this.raw.spectrum[l]=e*(.25+.75*a)*(1-.4*i)}}readSilence(){this.raw.level=0,this.raw.bands.fill(0),this.raw.spectrum.fill(0)}step(n,s,e){const{threshold:o,attack:c,release:r,rate:l}=s,i=this.proc=Ft(this.proc,s.processing?1:0,n,.35,.5),a=s.calm+(1-s.calm)*Math.min(1,Math.max(this.heard*2.5,i));e||(this.clock+=n,this.t+=n*l*a*(1+.5*i));const d=bn(this.raw.level,o);this.level=Ft(this.level,d,n,c,r),this.heard=Ft(this.heard,this.level,n,Mn,gn);for(let u=0;u<3;u++)this.bands[u]=Ft(this.bands[u],bn(this.raw.bands[u],o*.6),n,c,r*1.15);for(let u=0;u<gt;u++)this.spectrum[u]=Ft(this.spectrum[u],bn(this.raw.spectrum[u],o*.6),n,c,r);const h=this.clock,f=e?.5:.5+.5*Math.sin(mn*h/6),m=s.idle*f*(1-i),p=this.out;p.level=this.level+(1-this.level)*m;for(let u=0;u<3;u++)p.bands[u]=this.bands[u]+(1-this.bands[u])*m*.6;p.soft=Ft(p.soft,p.level,n,Mn,gn);for(let u=0;u<3;u++)p.softBands[u]=Ft(p.softBands[u],p.bands[u],n,Mn,gn);if(e||(this.drive+=n*l*(a+s.driveGain*this.level+1.3*i)),p.drive=this.drive,p.processing=i,!e){const u=Math.ceil(this.spin/mn-1e-6)*mn,g=Math.min(ds,(u-this.spin)*.6);this.spin+=n*(fs*l*i+g*(1-i))}p.spin=this.spin;const M=Math.max(-1,Math.min(1,s.direction||0)),v=this.heard>.06&&!s.processing?M:0,A=Math.abs(v)>Math.abs(this.pan)?ps:ms;return this.panVel+=(A*A*(v-this.pan)-2*A*this.panVel)*n,this.pan+=this.panVel*n,p.pan=this.pan,p}}function bs(t){if(!t)return;const n=t.trim().match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(n){let e=n[1];e.length===3&&(e=e.replace(/./g,c=>c+c));const o=parseInt(e,16);return{r:o>>16&255,g:o>>8&255,b:o&255}}const s=t.trim().match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);if(s)return{r:Number(s[1]),g:Number(s[2]),b:Number(s[3])}}const vs={idle:"Waiting",listening:"Listening",speaking:"Speaking",processing:"Thinking"},xs=.55,ys=1e3/62;function ae({type:t="orbit",state:n="listening",size:s=160,stream:e,analyser:o,level:c,sensitivity:r=.85,threshold:l=.04,attack:i,release:a=.32,idle:d=.1,calm:h=.4,voiceSpeed:f,emotion:m=null,emotionColors:p,saturation:M=2,accent:v=null,gradientAngle:A=99,gradientSpin:u=12,neutral:g=1,colorBrightness:x=1.02,colorHue:O=0,gradientStart:w=.1,gradientWidth:G=.6,direction:S,directionMove:C,directionPull:_,directionDeform:L,directionSquash:U,directionLens:b,directionStretch:E,directionSplit:y,directionBlur:I,directionBounce:R,directionMargin:B,directionBounds:k,hoverBend:F=!1,theme:T="auto",speed:P=1,paused:N=!1,color:D,dots:z=1,dotSize:V,opts:X,frame:tt,onLevel:J,style:H,"aria-label":ct,...st}){const K=$.useRef(null),ot=hs(T,K),W=us(),ut=X?JSON.stringify(X):"",ft=!!(e||o||c!=null||n==="processing"),nt=$.useRef(null);nt.current||(nt.current=new oe);const dt=$.useRef(null);dt.current||(dt.current=new xe);const pt=m?(p==null?void 0:p[m])??Dt[m]:null,Rt={saturation:Math.min(1,M),vivid:Math.max(0,Math.min(1,M-1)),brightness:x,hue:O,start:w,width:G,accent:v?Xn[v]:null,angle:A,spin:u,neutral:g,size:s},$t=V??et[t in et?t:"orbit"].dotSize??1,rt=et[t in et?t:"orbit"].lean??{},At=B??et[t in et?t:"orbit"].margin??32,Wt={state:n,level:c,analyser:o,sensitivity:r,threshold:l,attack:i??et[t in et?t:"orbit"].attack??.06,release:a,idle:d,calm:h,voiceSpeed:f??et[t in et?t:"orbit"].voiceSpeed??1,onLevel:J,emotionTint:pt,colors:Rt,direction:S,bounds:k,bend:F===!0?xs:typeof F=="number"?Math.max(0,Math.min(1,F)):0,lean:{move:C??rt.move??xt.move,pull:_??rt.pull??xt.pull,deform:L??rt.deform??xt.deform,squash:U??rt.squash??xt.squash,lens:b??rt.lens??xt.lens,stretch:E??rt.stretch??xt.stretch,split:y??rt.split??xt.split,blur:I??rt.blur??xt.blur,bounce:R??rt.bounce??xt.bounce}},yt=$.useRef(Wt);yt.current=Wt;const It=S==null?0:Ee(Wt.lean,s),[wn,ce]=$.useState([1/0,1/0]),tn=Math.min(It,wn[0]),nn=Math.min(It,wn[1]),it=It?tn+At:0,_t=It?nn+At:0,Vt=$.useRef({x:0,y:0,over:!1}),Tn=Wt.bend>0&&!W;$.useEffect(()=>{const Y=K.current;if(!Tn||!Y||typeof matchMedia!="function"||!matchMedia("(hover: hover) and (pointer: fine)").matches)return;const St=lt=>{if(lt.pointerType==="touch")return;const Ot=Y.getBoundingClientRect(),Xt=(s+it+_t)/(Ot.width||1);Vt.current={x:(lt.clientX-Ot.left)*Xt-it,y:(lt.clientY-Ot.top)*Xt,over:!0}},Pt=()=>{Vt.current.over=!1};return window.addEventListener("pointermove",St,{passive:!0}),document.documentElement.addEventListener("pointerleave",Pt),()=>{window.removeEventListener("pointermove",St),document.documentElement.removeEventListener("pointerleave",Pt),Vt.current.over=!1}},[Tn,s,it,_t]);const en=$.useRef(null);return $.useEffect(()=>{if(!e)return;const Y=Vn(e);return en.current=(Y==null?void 0:Y.analyser)??null,()=>{en.current=null,Y==null||Y.release()}},[e]),$.useEffect(()=>{const Y=K.current;if(!Y)return;const St=Math.min(2,typeof devicePixelRatio<"u"&&devicePixelRatio||1);Y.width=Math.round((s+it+_t)*St),Y.height=Math.round(s*St);const Pt=Y.getContext("2d");if(!Pt)return;const lt=ee(t,s,z,$t),Ot=X?{...lt.opts,...X}:lt.opts,Xt=tt??lt.frame,re=bs(D),Et=nt.current,ie=dt.current,le=new we;let Rn=0,Bt=0,sn=s/2,on=s/2;const he=(Q,j,q)=>{var Fn;Pt.setTransform(St,0,0,St,it*St,0),Pt.clearRect(-it,0,s+it+_t,s);const qt=N||W?0:le.step(Rn,q);let ht=Te(Xt(s,Et.t,Q,Ot),Q.pan,s,yt.current.lean,[tn,nn],qt);Rn=((Fn=ht.contact)==null?void 0:Fn.press)??0;const vt=yt.current.bend;if(vt>0){const Gt=Vt.current,In=Hn(ht,s),pe=yt.current.state==="idle"||yt.current.state==="processing",me=Gt.over&&pe&&!N&&!W?Se(Math.hypot(Gt.x-s/2,Gt.y-s/2)-In,In):0;Bt+=(me-Bt)*(1-Math.exp(-q/.14));const Nn=Bt<.01?1:1-Math.exp(-q/.05);sn+=(Gt.x-sn)*Nn,on+=(Gt.y-on)*Nn,Bt>.002&&(ht=ye(ht,s,{x:sn,y:on,amount:Bt*vt}))}const mt=yt.current.colors,Mt=j.amount,at=mt.accent,fe=at?{r:at.r+(j.r-at.r)*Mt,g:at.g+(j.g-at.g)*Mt,b:at.b+(j.b-at.b)*Mt}:{r:j.r,g:j.g,b:j.b},de={...mt,accent:fe,saturation:mt.saturation*(at?1:Mt),angle:mt.angle+mt.spin*Et.clock};Ze(Pt,ht,ot,re,ht.light?j:void 0,de)};let An=-1/0;const ue=Q=>{var mt,Mt;if(!It||Q-An<500)return;An=Q;const j=Y.getBoundingClientRect().left+it,q=(Mt=(mt=yt.current.bounds)==null?void 0:mt.current)==null?void 0:Mt.getBoundingClientRect(),qt=q?q.left:0,ht=q?q.right:document.documentElement.clientWidth,vt=[Math.max(0,Math.floor(j-qt-At)),Math.max(0,Math.floor(ht-j-s-At))];ce(at=>Math.abs(at[0]-vt[0])>1||Math.abs(at[1]-vt[1])>1?vt:at)};let Ht=0;const _n=Q=>{var Mt;ue(Q);const j=Ht?Math.min(.05,(Q-Ht)/1e3):1/60;Ht=Q;const q=yt.current,qt=q.state==="listening"||q.state==="speaking",ht=en.current??q.analyser??null;qt?ht?Et.readAnalyser(ht,q.sensitivity*lt.gain,j):q.level!=null?Et.readLevel(typeof q.level=="function"?q.level():q.level,q.sensitivity*lt.gain):Et.readSilence():Et.readSilence();const vt=Et.step(j,{sensitivity:q.sensitivity,threshold:q.threshold,attack:q.attack,release:q.release,idle:q.idle,driveGain:lt.driveGain*q.voiceSpeed,calm:q.calm,rate:lt.speed*P,processing:q.state==="processing",direction:typeof q.direction=="function"?q.direction():q.direction??0},W);(Mt=q.onLevel)==null||Mt.call(q,vt.level);const mt=ie.step(j,q.emotionTint,Et.clock,s,N||W);he(vt,mt,j)};if(_n(performance.now()),N||W&&!ft)return;let an=0,Kt=!1,Pn=0;const Cn=Q=>{Kt&&(an=requestAnimationFrame(Cn),!(Q-Pn<ys)&&(Pn=Q,_n(Q)))},cn=()=>{Kt||(Kt=!0,Ht=0,an=requestAnimationFrame(Cn))},rn=()=>{Kt=!1,cancelAnimationFrame(an)};let ln=!0;const Ct=typeof IntersectionObserver<"u"?new IntersectionObserver(([Q])=>{ln=Q.isIntersecting,ln&&document.visibilityState!=="hidden"?cn():rn()}):null;Ct==null||Ct.observe(Y);const kn=()=>{document.visibilityState==="hidden"?rn():ln&&cn()};return document.addEventListener("visibilitychange",kn),Ct||cn(),()=>{rn(),Ct==null||Ct.disconnect(),document.removeEventListener("visibilitychange",kn)}},[t,s,It,tn,nn,it,_t,At,ot,P,N,W,ft,D,z,$t,ut,tt,N||W?m:null,N||W?`${M}|${v}|${A}|${u}|${g}|${x}|${O}|${w}|${G}`:null]),$n.jsx("canvas",{ref:K,role:"img","aria-label":ct??vs[n],style:{width:s+it+_t,height:s,display:"block",marginLeft:-it,marginRight:-_t,...H},...st})}const Ss={echoCancellation:!1,noiseSuppression:!1,autoGainControl:!1};function Jt(){return typeof navigator<"u"&&typeof navigator.mediaDevices<"u"&&typeof navigator.mediaDevices.getUserMedia=="function"}function Es(t={}){const{constraints:n,autoStart:s=!1}=t,[e,o]=$.useState(null),[c,r]=$.useState(()=>Jt()?"idle":"unsupported"),[l,i]=$.useState(null),a=$.useRef(null),d=$.useRef(n);d.current=n;const h=$.useCallback(()=>{const m=a.current;a.current=null,m&&m.getTracks().forEach(p=>p.stop()),o(null),r(Jt()?"idle":"unsupported")},[]),f=$.useCallback(async()=>{if(!Jt())return r("unsupported"),null;if(a.current)return a.current;xn(),r("requesting"),i(null);try{const m=await navigator.mediaDevices.getUserMedia({audio:{...Ss,...d.current??{}}});a.current=m,o(m),r("live");const p=()=>{a.current===m&&(a.current=null,o(null),r("idle"))};return m.getAudioTracks().forEach(M=>M.addEventListener("ended",p)),m}catch(m){const p=m instanceof Error?m:new Error(String(m));return i(p),r(p.name==="NotAllowedError"||p.name==="SecurityError"?"denied":"error"),null}},[]);return $.useEffect(()=>{s&&f()},[s]),$.useEffect(()=>()=>{const m=a.current;a.current=null,m&&m.getTracks().forEach(p=>p.stop())},[]),{stream:e,state:c,error:l,supported:Jt(),start:f,stop:h}}function ws(t){return $n.jsx(ae,{...t,type:"aura"})}exports.ACCENT_COLORS=Xn;exports.EMOTION_COLORS=Dt;exports.PRESETS=et;exports.SPECTRUM_N=gt;exports.VOICE_ORB_TYPES=cs;exports.VoiceFollower=oe;exports.VoiceOrb=ae;exports.VoiceRing=ws;exports.acquireAnalyser=Vn;exports.getAudioContext=xn;exports.isAudioSupported=Me;exports.resolvePreset=ee;exports.useMicrophone=Es;
package/dist/index.d.ts CHANGED
@@ -75,6 +75,9 @@ declare interface FrameLight {
75
75
  }>;
76
76
  /** Chromatic fringe offset, as a share of `r`. */
77
77
  fringe: number;
78
+ /** Where the positive emotion's colours run round the ring: degrees of
79
+ * hue, from one side to the other. @default [81, 136] (yellow-green → green) */
80
+ green?: [number, number];
78
81
  }
79
82
 
80
83
  /**
@@ -368,7 +371,7 @@ export declare interface VoiceInput {
368
371
  pan: number;
369
372
  }
370
373
 
371
- export declare function VoiceOrb({ type, state, size, stream, analyser, level, sensitivity, threshold, attack, release, idle, calm, voiceSpeed: voiceSpeedProp, emotion, emotionColors, saturation, accent, gradientAngle, gradientSpin, neutral, colorBrightness, colorHue, gradientStart, gradientWidth, direction, directionMove, directionPull, directionDeform, directionSquash, directionLens, directionStretch, directionSplit, directionBlur, directionBounce, directionMargin: marginProp, directionBounds, theme, speed, paused, color, dots, dotSize: dotSizeProp, opts: optsOverride, frame: customFrame, onLevel, style, 'aria-label': ariaLabel, ...rest }: VoiceOrbProps): JSX_2.Element;
374
+ export declare function VoiceOrb({ type, state, size, stream, analyser, level, sensitivity, threshold, attack, release, idle, calm, voiceSpeed: voiceSpeedProp, emotion, emotionColors, saturation, accent, gradientAngle, gradientSpin, neutral, colorBrightness, colorHue, gradientStart, gradientWidth, direction, directionMove, directionPull, directionDeform, directionSquash, directionLens, directionStretch, directionSplit, directionBlur, directionBounce, directionMargin: marginProp, directionBounds, hoverBend, theme, speed, paused, color, dots, dotSize: dotSizeProp, opts: optsOverride, frame: customFrame, onLevel, style, 'aria-label': ariaLabel, ...rest }: VoiceOrbProps): JSX_2.Element;
372
375
 
373
376
  /** Colourful mode's accents: the same three hues, by colour. */
374
377
  export declare type VoiceOrbAccent = 'green' | 'red' | 'blue';
@@ -488,6 +491,15 @@ export declare interface VoiceOrbProps extends Omit<CanvasHTMLAttributes<HTMLCan
488
491
  directionBounds?: {
489
492
  readonly current: Element | null;
490
493
  };
494
+ /**
495
+ * Bend toward the pointer on hover: as the cursor nears the rim, the orb's
496
+ * marks are drawn out toward it like a membrane, easing in and out. Only
497
+ * while the orb is waiting or processing (a voice moving it leaves the
498
+ * pointer be); desktop only (a fine pointer that hovers), and off with
499
+ * reduced motion. `true` bends at 0.55; a number 0–1 sets the strength.
500
+ * @default false
501
+ */
502
+ hoverBend?: boolean | number;
491
503
  /**
492
504
  * Colourful mode: how neutral the gradient's start is — 1 begins in the
493
505
  * plain monochrome ink and gathers the accent toward the far side, 0