@aberhamm/liquid-glass-react 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),n=require("react/jsx-runtime");var Ot={lensW:95,lensH:95,borderRadius:95,mapSize:512,clipToShape:!0,softEdge:!0,strength:.06,depth:.65,curvature:.6,splay:0,dispersion:.5,bend:0,bendWidth:.16,frost:.5,brightness:.1,specular:1,sheenAngle:45,sheenDark:!1,sheen:.3,sheenWidth:3,sheenFalloff:1.5,glow:.12,glowSpread:1,glowFalloff:.5},lr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=",at=.22,Ar=Math.sqrt(Math.PI),_r=t=>Math.tanh(Ar*t),Zt=(t,e)=>e>0?(t-Math.sqrt(t*t-e*e))/e:0,kr=(t,e,a)=>{const i=Math.max(.01,Math.min(t,Math.min(e,a)-1)),s=(e*e+i*i)/(2*i),u=(a*a+i*i)/(2*i),f=Zt(s,e),h=Zt(u,a);return{Rx:s,Ry:u,scaleX:f>0?.5/f:1,scaleY:h>0?.5/h:1}},Fr=(t,e,a)=>{const i=Math.min(t,e*.999);return i/Math.sqrt(e*e-i*i)*a},Nt=(t,e)=>`${t} 0 0 0 ${.5*(1-t)} 0 ${e} 0 0 ${.5*(1-e)} 0 0 1 0 0 0 0 0 1 0`,er=new Map,ur=(t,e,a)=>{const i=Math.max(1,Math.round(t)),s=Math.max(1,Math.round(e)),u=Math.max(0,Math.min(Math.round(a),Math.min(i,s)/2)),f=`rr·${i}·${s}·${u}`,h=er.get(f);if(h)return{uri:h,key:f};const l=.5,o=Math.max(0,i-2*l),k=Math.max(0,s-2*l),X=Math.max(0,u-l),m=`<svg xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none' viewBox='0 0 ${i} ${s}'><rect fill='black' rx='${X}' ry='${X}' x='${l}' y='${l}' width='${o}' height='${k}'/></svg>`,d=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`;return er.set(f,d),{uri:d,key:f}},Lr=(t,e,a)=>{const i=Math.max(1,Math.round(t)),s=Math.max(1,Math.round(e)),u=Math.max(0,Math.min(Math.round(a),Math.floor(Math.min(i,s)/2)));return ur(i,s,u)},At=t=>(.5+t)*255+.5|0,tr=t=>127*t+128+.5|0,$t=t=>{let e=null,a=null,i=null,s=null,u=-1/0,f=-1/0,h=-1/0,l=0,o=!0,k=null;return{generate(X){e||(e=document.createElement("canvas"),e.width=t,e.height=t,a=e.getContext("2d"),i=a.createImageData(t,t));const{lensHalfWidth:m,lensHalfHeight:d,borderRadius:y,depth:G,clipToShape:N,softEdge:F,sheenAngle:z=45,glow:$=0,glowSpread:v=1,glowFalloff:q=1.5,sheen:U=0,sheenWidth:S=3,sheenFalloff:M=1.5,curvature:w=0,splay:D=0,bend:j=0,bendWidth:O=.16}=X,_=i.data,I=t>>1,W=Math.min(y,Math.min(m,d)),c=Math.min(m,d),K=Math.min(G*c,c-1),J=Math.max(0,m-K),E=Math.max(0,d-K),T=Math.max(0,Math.min(y,Math.min(J,E))),Y=K>0?Math.SQRT1_2/K:1e6,te=$>0||U>0,ce=z*Math.PI/180,re=Math.cos(ce),ee=Math.sin(ce),he=S>0?1/S:0,pe=1/Math.max(2,v*Math.min(m,d)),Re=2*m/t,C=2*d/t,V=1/m,g=1/d,Q=w>0,se=w*Math.min(m,d),A=D>0,Le=j>0,me=1/Math.max(2,O*Math.min(m,d)),B=(le,ue)=>le>0||ue>0?Math.sqrt(le*le+ue*ue):0;if(Q&&((!k||Math.abs(se-u)>.5||Math.abs(m-f)>1||Math.abs(d-h)>1)&&(k=kr(se,m,d),u=se,f=m,h=d,o=!0),l!==I&&(s=new Float32Array(I),l=I,o=!0),o)){const le=s,ue=k,Me=ue.Rx*ue.Rx,Ie=ue.Rx*(1-.001);for(let b=0;b<I;b+=1){const Te=-((b+.5)*Re-m),je=Te<Ie?Te:Ie;le[b]=je/Math.sqrt(Me-je*je)*ue.scaleX}o=!1}const Z=Q?s:null,ve=.5*Math.min(m,d),Ue=ve>0?1/ve:0,He=Math.SQRT1_2;for(let le=0;le<I;le+=1){const ue=t-1-le,Me=-((le+.5)*C-d),Ie=Me-d+W,b=F?Me-E+T:0,Te=Q&&Z?Fr(Me,k.Ry,k.scaleY):Me*g>1?1:Me*g,je=Me*g>1?1:Me*g,Oe=A?Math.max(0,1-(d-Me)*Ue):0,Ae=le*t,Ze=ue*t;for(let Ge=0;Ge<I;Ge+=1){const Ve=t-1-Ge,Pe=-((Ge+.5)*Re-m),we=Pe-m+W,x=B(we>0?we:0,Ie>0?Ie:0)+(we>Ie?we>0?0:we:Ie>0?0:Ie)-W,fe=(Ae+Ge)*4,de=(Ae+Ve)*4,be=(Ze+Ge)*4,ze=(Ze+Ve)*4;if(N&&x>=0){for(const ae of[fe,de,be,ze])_[ae]=128,_[ae+1]=128,_[ae+2]=128,_[ae+3]=255;continue}let R=Z?Z[Ge]:Pe*V>1?1:Pe*V,H=Te;if(A){const ae=Oe*D,Fe=Math.max(0,1-(m-Pe)*Ue)*D;if(ae>.001||Fe>.001){const et=R,Xe=H;R=et*(1-ae),H=Xe*(1-Fe);const tt=Math.sqrt(et*et+Xe*Xe),lt=Math.sqrt(R*R+H*H);if(lt>.001){const Mt=tt/lt;R*=Mt,H*=Mt}}}let ie=1;if(F){const ae=Pe-J+T,Fe=B(ae>0?ae:0,b>0?b:0)+(ae>b?ae>0?0:ae:b>0?0:b)-T;ie=.5*(1+_r(Fe*Y))}let Ce=.5*R*ie,De=.5*H*ie;if(Le){const ae=x<0?Math.max(0,1+x*me):0;if(ae>0){const Fe=Math.sqrt(R*R+H*H);if(Fe>1e-4){const et=6.75*ae*ae*(1-ae),Xe=.5*j*et*ie/Fe;Ce+=R*Xe,De+=H*Xe}}}let _e=0,ke=0;if(te){const ae=Pe*V>1?1:Pe*V,Fe=Math.min(1,Math.abs(ae*re+je*ee)*He),et=Math.min(1,Math.abs(ae*re-je*ee)*He);if(U>0){const Xe=x<0?Math.max(0,1+x*he):0,tt=U*Math.pow(Xe,M);_e+=tt*(.16+.84*Math.pow(Fe,1.6)),ke+=tt*(.16+.84*Math.pow(et,1.6))}if($>0){const tt=1-(x<0?Math.min(1,-x*pe):1),lt=$*Math.pow(tt*tt*(3-2*tt),q)*ie;_e+=lt*(.6+.4*Fe),ke+=lt*(.6+.4*et)}_e>1?_e=1:_e<-1&&(_e=-1),ke>1?ke=1:ke<-1&&(ke=-1)}const Ne=At(Ce),ct=At(-Ce),Be=At(De),ht=At(-De),Je=tr(_e),rt=tr(ke);_[fe]=Ne,_[fe+1]=Be,_[fe+2]=Je,_[fe+3]=255,_[de]=ct,_[de+1]=Be,_[de+2]=rt,_[de+3]=255,_[be]=Ne,_[be+1]=ht,_[be+2]=rt,_[be+3]=255,_[ze]=ct,_[ze+1]=ht,_[ze+2]=Je,_[ze+3]=255}}return a.putImageData(i,0,0),e.toDataURL()},dispose(){e&&(e.width=0,e.height=0,e=null),a=null,i=null,s=null,k=null,u=-1/0,f=-1/0,h=-1/0,l=0,o=!0}}},xe=t=>typeof t=="object"&&t!==null&&"get"in t&&"on"in t,We=t=>xe(t)?t.get():t,jr=class{constructor(t){this.subscribers=[],this.current=t}get(){return this.current}set(t){if(t!==this.current){this.current=t;for(const e of this.subscribers.slice())e(t)}}on(t,e){return this.subscribers.push(e),()=>{const a=this.subscribers.indexOf(e);a!==-1&&this.subscribers.splice(a,1)}}},ge=t=>new jr(t),ot=(t,e)=>{const a=ge(e()),i=()=>a.set(e());for(const s of t)s.on("change",i);return a},Et=(t,e,a,i)=>{const s=3*t,u=3*(a-t)-s,f=1-s-u,h=3*e,l=3*(i-e)-h,o=1-h-l,k=y=>((f*y+u)*y+s)*y,X=y=>((o*y+l)*y+h)*y,m=y=>(3*f*y+2*u)*y+s,d=y=>{let G=y;for(let z=0;z<8;z+=1){const $=k(G)-y;if(Math.abs($)<1e-6)return G;const v=m(G);if(Math.abs(v)<1e-6)break;G-=$/v}let N=0,F=1;for(G=y;N<F;){const z=k(G);if(Math.abs(z-y)<1e-6||(z<y?N=G:F=G,F-N<1e-7))break;G=(N+F)/2}return G};return y=>y<=0?0:y>=1?1:X(d(y))},Cr=Et(.34,1.36,.42,1),_t=new WeakMap,Dr=(t,e,{duration:a=.3,ease:i=Cr,onComplete:s}={})=>{var X;(X=_t.get(t))==null||X.stop();const u=t.get();if(u===e||a<=0)return t.set(e),s==null||s(),{stop(){}};const f=a*1e3;let h=0,l=0;const o=m=>{l===0&&(l=m);const d=(m-l)/f;if(d>=1){t.set(e),_t.delete(t),s==null||s();return}t.set(u+(e-u)*i(d)),h=requestAnimationFrame(o)};h=requestAnimationFrame(o);const k={stop(){cancelAnimationFrame(h),_t.delete(t)}};return _t.set(t,k),k},Wt=`#version 300 es
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),i=require("react/jsx-runtime");var Ot={lensW:95,lensH:95,borderRadius:95,mapSize:512,clipToShape:!0,softEdge:!0,strength:.06,depth:.65,curvature:.6,splay:0,dispersion:.5,bend:0,bendWidth:.16,frost:.5,brightness:.1,specular:1,sheenAngle:45,sheenDark:!1,sheen:.3,sheenWidth:3,sheenFalloff:1.5,glow:.12,glowSpread:1,glowFalloff:.5},lr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=",ot=.22,Ar=Math.sqrt(Math.PI),_r=t=>Math.tanh(Ar*t),Zt=(t,e)=>e>0?(t-Math.sqrt(t*t-e*e))/e:0,kr=(t,e,o)=>{const n=Math.max(.01,Math.min(t,Math.min(e,o)-1)),s=(e*e+n*n)/(2*n),u=(o*o+n*n)/(2*n),f=Zt(s,e),h=Zt(u,o);return{Rx:s,Ry:u,scaleX:f>0?.5/f:1,scaleY:h>0?.5/h:1}},Fr=(t,e,o)=>{const n=Math.min(t,e*.999);return n/Math.sqrt(e*e-n*n)*o},Nt=(t,e)=>`${t} 0 0 0 ${.5*(1-t)} 0 ${e} 0 0 ${.5*(1-e)} 0 0 1 0 0 0 0 0 1 0`,er=new Map,ur=(t,e,o)=>{const n=Math.max(1,Math.round(t)),s=Math.max(1,Math.round(e)),u=Math.max(0,Math.min(Math.round(o),Math.min(n,s)/2)),f=`rr·${n}·${s}·${u}`,h=er.get(f);if(h)return{uri:h,key:f};const l=.5,a=Math.max(0,n-2*l),k=Math.max(0,s-2*l),I=Math.max(0,u-l),m=`<svg xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none' viewBox='0 0 ${n} ${s}'><rect fill='black' rx='${I}' ry='${I}' x='${l}' y='${l}' width='${a}' height='${k}'/></svg>`,d=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`;return er.set(f,d),{uri:d,key:f}},Lr=(t,e,o)=>{const n=Math.max(1,Math.round(t)),s=Math.max(1,Math.round(e)),u=Math.max(0,Math.min(Math.round(o),Math.floor(Math.min(n,s)/2)));return ur(n,s,u)},At=t=>(.5+t)*255+.5|0,tr=t=>127*t+128+.5|0,$t=t=>{let e=null,o=null,n=null,s=null,u=-1/0,f=-1/0,h=-1/0,l=0,a=!0,k=null;return{generate(I){e||(e=document.createElement("canvas"),e.width=t,e.height=t,o=e.getContext("2d"),n=o.createImageData(t,t));const{lensHalfWidth:m,lensHalfHeight:d,borderRadius:y,depth:G,clipToShape:N,softEdge:F,sheenAngle:z=45,glow:$=0,glowSpread:v=1,glowFalloff:q=1.5,sheen:U=0,sheenWidth:S=3,sheenFalloff:M=1.5,curvature:w=0,splay:D=0,bend:C=0,bendWidth:O=.16}=I,_=n.data,X=t>>1,W=Math.min(y,Math.min(m,d)),c=Math.min(m,d),K=Math.min(G*c,c-1),J=Math.max(0,m-K),E=Math.max(0,d-K),T=Math.max(0,Math.min(y,Math.min(J,E))),Y=K>0?Math.SQRT1_2/K:1e6,te=$>0||U>0,ce=z*Math.PI/180,re=Math.cos(ce),ee=Math.sin(ce),he=S>0?1/S:0,pe=1/Math.max(2,v*Math.min(m,d)),Re=2*m/t,j=2*d/t,V=1/m,g=1/d,Q=w>0,se=w*Math.min(m,d),A=D>0,Le=C>0,me=1/Math.max(2,O*Math.min(m,d)),B=(le,ue)=>le>0||ue>0?Math.sqrt(le*le+ue*ue):0;if(Q&&((!k||Math.abs(se-u)>.5||Math.abs(m-f)>1||Math.abs(d-h)>1)&&(k=kr(se,m,d),u=se,f=m,h=d,a=!0),l!==X&&(s=new Float32Array(X),l=X,a=!0),a)){const le=s,ue=k,Me=ue.Rx*ue.Rx,Xe=ue.Rx*(1-.001);for(let b=0;b<X;b+=1){const Te=-((b+.5)*Re-m),Ce=Te<Xe?Te:Xe;le[b]=Ce/Math.sqrt(Me-Ce*Ce)*ue.scaleX}a=!1}const Z=Q?s:null,ve=.5*Math.min(m,d),Ue=ve>0?1/ve:0,He=Math.SQRT1_2;for(let le=0;le<X;le+=1){const ue=t-1-le,Me=-((le+.5)*j-d),Xe=Me-d+W,b=F?Me-E+T:0,Te=Q&&Z?Fr(Me,k.Ry,k.scaleY):Me*g>1?1:Me*g,Ce=Me*g>1?1:Me*g,Oe=A?Math.max(0,1-(d-Me)*Ue):0,Ae=le*t,Ze=ue*t;for(let Ge=0;Ge<X;Ge+=1){const Ve=t-1-Ge,Pe=-((Ge+.5)*Re-m),we=Pe-m+W,x=B(we>0?we:0,Xe>0?Xe:0)+(we>Xe?we>0?0:we:Xe>0?0:Xe)-W,fe=(Ae+Ge)*4,de=(Ae+Ve)*4,be=(Ze+Ge)*4,ze=(Ze+Ve)*4;if(N&&x>=0){for(const oe of[fe,de,be,ze])_[oe]=128,_[oe+1]=128,_[oe+2]=128,_[oe+3]=255;continue}let R=Z?Z[Ge]:Pe*V>1?1:Pe*V,H=Te;if(A){const oe=Oe*D,Fe=Math.max(0,1-(m-Pe)*Ue)*D;if(oe>.001||Fe>.001){const et=R,Ie=H;R=et*(1-oe),H=Ie*(1-Fe);const tt=Math.sqrt(et*et+Ie*Ie),lt=Math.sqrt(R*R+H*H);if(lt>.001){const Mt=tt/lt;R*=Mt,H*=Mt}}}let ie=1;if(F){const oe=Pe-J+T,Fe=B(oe>0?oe:0,b>0?b:0)+(oe>b?oe>0?0:oe:b>0?0:b)-T;ie=.5*(1+_r(Fe*Y))}let je=.5*R*ie,De=.5*H*ie;if(Le){const oe=x<0?Math.max(0,1+x*me):0;if(oe>0){const Fe=Math.sqrt(R*R+H*H);if(Fe>1e-4){const et=6.75*oe*oe*(1-oe),Ie=.5*C*et*ie/Fe;je+=R*Ie,De+=H*Ie}}}let _e=0,ke=0;if(te){const oe=Pe*V>1?1:Pe*V,Fe=Math.min(1,Math.abs(oe*re+Ce*ee)*He),et=Math.min(1,Math.abs(oe*re-Ce*ee)*He);if(U>0){const Ie=x<0?Math.max(0,1+x*he):0,tt=U*Math.pow(Ie,M);_e+=tt*(.16+.84*Math.pow(Fe,1.6)),ke+=tt*(.16+.84*Math.pow(et,1.6))}if($>0){const tt=1-(x<0?Math.min(1,-x*pe):1),lt=$*Math.pow(tt*tt*(3-2*tt),q)*ie;_e+=lt*(.6+.4*Fe),ke+=lt*(.6+.4*et)}_e>1?_e=1:_e<-1&&(_e=-1),ke>1?ke=1:ke<-1&&(ke=-1)}const Ne=At(je),ct=At(-je),Be=At(De),ht=At(-De),Je=tr(_e),rt=tr(ke);_[fe]=Ne,_[fe+1]=Be,_[fe+2]=Je,_[fe+3]=255,_[de]=ct,_[de+1]=Be,_[de+2]=rt,_[de+3]=255,_[be]=Ne,_[be+1]=ht,_[be+2]=rt,_[be+3]=255,_[ze]=ct,_[ze+1]=ht,_[ze+2]=Je,_[ze+3]=255}}return o.putImageData(n,0,0),e.toDataURL()},dispose(){e&&(e.width=0,e.height=0,e=null),o=null,n=null,s=null,k=null,u=-1/0,f=-1/0,h=-1/0,l=0,a=!0}}},xe=t=>typeof t=="object"&&t!==null&&"get"in t&&"on"in t,We=t=>xe(t)?t.get():t,Cr=class{constructor(t){this.subscribers=[],this.current=t}get(){return this.current}set(t){if(t!==this.current){this.current=t;for(const e of this.subscribers.slice())e(t)}}on(t,e){return this.subscribers.push(e),()=>{const o=this.subscribers.indexOf(e);o!==-1&&this.subscribers.splice(o,1)}}},ge=t=>new Cr(t),at=(t,e)=>{const o=ge(e()),n=()=>o.set(e());for(const s of t)s.on("change",n);return o},Et=(t,e,o,n)=>{const s=3*t,u=3*(o-t)-s,f=1-s-u,h=3*e,l=3*(n-e)-h,a=1-h-l,k=y=>((f*y+u)*y+s)*y,I=y=>((a*y+l)*y+h)*y,m=y=>(3*f*y+2*u)*y+s,d=y=>{let G=y;for(let z=0;z<8;z+=1){const $=k(G)-y;if(Math.abs($)<1e-6)return G;const v=m(G);if(Math.abs(v)<1e-6)break;G-=$/v}let N=0,F=1;for(G=y;N<F;){const z=k(G);if(Math.abs(z-y)<1e-6||(z<y?N=G:F=G,F-N<1e-7))break;G=(N+F)/2}return G};return y=>y<=0?0:y>=1?1:I(d(y))},jr=Et(.34,1.36,.42,1),_t=new WeakMap,Dr=(t,e,{duration:o=.3,ease:n=jr,onComplete:s}={})=>{var I;(I=_t.get(t))==null||I.stop();const u=t.get();if(u===e||o<=0)return t.set(e),s==null||s(),{stop(){}};const f=o*1e3;let h=0,l=0;const a=m=>{l===0&&(l=m);const d=(m-l)/f;if(d>=1){t.set(e),_t.delete(t),s==null||s();return}t.set(u+(e-u)*n(d)),h=requestAnimationFrame(a)};h=requestAnimationFrame(a);const k={stop(){cancelAnimationFrame(h),_t.delete(t)}};return _t.set(t,k),k},Wt=`#version 300 es
2
2
  in vec2 a_pos;
3
3
  out vec2 v_uv;
4
4
  void main() {
@@ -7,12 +7,12 @@ void main() {
7
7
  // descriptor is supplied in this same bottom-left space by the component.
8
8
  v_uv = a_pos * 0.5 + 0.5;
9
9
  gl_Position = vec4(a_pos, 0.0, 1.0);
10
- }`,Xr=`#version 300 es
10
+ }`,Ir=`#version 300 es
11
11
  precision highp float;
12
12
  in vec2 v_uv;
13
13
  out vec4 o;
14
14
  uniform sampler2D u_src;
15
- void main() { o = texture(u_src, v_uv); }`,Ir=`#version 300 es
15
+ void main() { o = texture(u_src, v_uv); }`,Xr=`#version 300 es
16
16
  precision highp float;
17
17
  in vec2 v_uv;
18
18
  out vec4 o;
@@ -84,4 +84,4 @@ void main() {
84
84
  // silhouette. Canvas stays fully opaque, so straight/premultiplied alpha is moot.
85
85
  vec3 backdrop = texture(u_src, v_uv).rgb;
86
86
  o = vec4(mix(backdrop, lensCol, coverage), 1.0);
87
- }`,rr=(t,e,a)=>{const i=t.createShader(e);if(t.shaderSource(i,a),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)){const s=t.getShaderInfoLog(i);throw t.deleteShader(i),new Error(`glass-webgl shader: ${s}`)}return i},Gt=(t,e,a)=>{const i=t.createProgram(),s=rr(t,t.VERTEX_SHADER,e),u=rr(t,t.FRAGMENT_SHADER,a);if(t.attachShader(i,s),t.attachShader(i,u),t.bindAttribLocation(i,0,"a_pos"),t.linkProgram(i),t.deleteShader(s),t.deleteShader(u),!t.getProgramParameter(i,t.LINK_STATUS)){const f=t.getProgramInfoLog(i);throw t.deleteProgram(i),new Error(`glass-webgl link: ${f}`)}return i},Gr=class{constructor(t){this.dispCache=new Map,this.blurW=0,this.blurH=0,this.srcW=0,this.srcH=0,this.disposed=!1;const e=t.getContext("webgl2",{premultipliedAlpha:!1,alpha:!0,antialias:!1,preserveDrawingBuffer:!1});if(!e)throw new Error("webgl2 unavailable");this.gl=e,this.blit=Gt(e,Wt,Xr),this.lens=Gt(e,Wt,Wr),this.blur=Gt(e,Wt,Ir),this.quad=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.quad),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),e.STATIC_DRAW);const a=()=>{const i=e.createTexture();return e.bindTexture(e.TEXTURE_2D,i),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),i};this.srcTex=a(),this.dispTex=a(),this.blurTex=[a(),a()],this.fbo=[e.createFramebuffer(),e.createFramebuffer()],e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),this.uBlitSrc=e.getUniformLocation(this.blit,"u_src"),this.uBlur={src:e.getUniformLocation(this.blur,"u_src"),step:e.getUniformLocation(this.blur,"u_step")},this.uLens={src:e.getUniformLocation(this.lens,"u_src"),blur:e.getUniformLocation(this.lens,"u_blur"),disp:e.getUniformLocation(this.lens,"u_disp"),origin:e.getUniformLocation(this.lens,"u_origin"),size:e.getUniformLocation(this.lens,"u_size"),scale:e.getUniformLocation(this.lens,"u_scale"),lenspx:e.getUniformLocation(this.lens,"u_lenspx"),radiuspx:e.getUniformLocation(this.lens,"u_radiuspx"),dispersion:e.getUniformLocation(this.lens,"u_dispersion"),specular:e.getUniformLocation(this.lens,"u_sheen"),frost:e.getUniformLocation(this.lens,"u_frost"),opacity:e.getUniformLocation(this.lens,"u_opacity"),brightness:e.getUniformLocation(this.lens,"u_brightness")}}ensureBlurTargets(t,e){if(t===this.blurW&&e===this.blurH)return;const a=this.gl;for(let i=0;i<2;i+=1)a.bindTexture(a.TEXTURE_2D,this.blurTex[i]),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,t,e,0,a.RGBA,a.UNSIGNED_BYTE,null),a.bindFramebuffer(a.FRAMEBUFFER,this.fbo[i]),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,this.blurTex[i],0);a.bindFramebuffer(a.FRAMEBUFFER,null),this.blurW=t,this.blurH=e}renderFrost(t){const e=this.gl;this.ensureBlurTargets(this.srcW,this.srcH),e.useProgram(this.blur),e.viewport(0,0,this.srcW,this.srcH),e.activeTexture(e.TEXTURE0),e.uniform1i(this.uBlur.src,0),e.bindFramebuffer(e.FRAMEBUFFER,this.fbo[0]),e.bindTexture(e.TEXTURE_2D,this.srcTex),e.uniform2f(this.uBlur.step,t/this.srcW,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.bindFramebuffer(e.FRAMEBUFFER,this.fbo[1]),e.bindTexture(e.TEXTURE_2D,this.blurTex[0]),e.uniform2f(this.uBlur.step,0,t/this.srcH),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.bindFramebuffer(e.FRAMEBUFFER,null)}setDisplacementMap(t){if(this.disposed)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,this.dispTex),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t)}dispTexFor(t){const e=this.gl;let a=this.dispCache.get(t);return a||(a=e.createTexture(),e.bindTexture(e.TEXTURE_2D,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),this.dispCache.set(t,a)),a}releaseDispMap(t){const e=this.dispCache.get(t);e&&(this.gl.deleteTexture(e),this.dispCache.delete(t))}resize(t,e){const a=this.gl.canvas;(a.width!==t||a.height!==e)&&(a.width=t,a.height=e)}uploadSource(t,e,a){const i=this.gl;i.bindTexture(i.TEXTURE_2D,this.srcTex),e!==this.srcW||a!==this.srcH?(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t),this.srcW=e,this.srcH=a):i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,t)}render(t,e,a,i){if(this.disposed||e===0||a===0)return;const s=this.gl;this.uploadSource(t,e,a),s.bindBuffer(s.ARRAY_BUFFER,this.quad),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,0,0),s.disable(s.BLEND);const u=i.reduce((l,o)=>Math.max(l,o.blur),0);u>0&&this.renderFrost(u);const f=s.canvas.width,h=s.canvas.height;s.viewport(0,0,f,h),s.useProgram(this.blit),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this.srcTex),s.uniform1i(this.uBlitSrc,0),s.drawArrays(s.TRIANGLE_STRIP,0,4),s.useProgram(this.lens),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this.srcTex),s.uniform1i(this.uLens.src,0),s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,this.dispTex),s.uniform1i(this.uLens.disp,1),s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,this.blurTex[1]),s.uniform1i(this.uLens.blur,2);for(const l of i){const o=l.opacity??1;o<=0||(s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,l.dispMap?this.dispTexFor(l.dispMap):this.dispTex),s.uniform2f(this.uLens.origin,l.originX,l.originY),s.uniform2f(this.uLens.size,l.sizeX,l.sizeY),s.uniform2f(this.uLens.scale,l.scaleX,l.scaleY),s.uniform2f(this.uLens.lenspx,l.sizeX*f,l.sizeY*h),s.uniform1f(this.uLens.radiuspx,(l.cornerRadius??0)*f),s.uniform1f(this.uLens.dispersion,l.dispersion),s.uniform1f(this.uLens.specular,l.specular),s.uniform1f(this.uLens.frost,l.blur>0?Math.min(1,l.blur/8):0),s.uniform1f(this.uLens.opacity,o),s.uniform1f(this.uLens.brightness,l.brightness??0),s.drawArrays(s.TRIANGLE_STRIP,0,4))}}dispose(){if(this.disposed)return;this.disposed=!0;const t=this.gl;t.deleteProgram(this.blit),t.deleteProgram(this.lens),t.deleteProgram(this.blur),t.deleteTexture(this.srcTex),t.deleteTexture(this.dispTex),this.dispCache.forEach(a=>t.deleteTexture(a)),this.dispCache.clear(),t.deleteTexture(this.blurTex[0]),t.deleteTexture(this.blurTex[1]),t.deleteFramebuffer(this.fbo[0]),t.deleteFramebuffer(this.fbo[1]),t.deleteBuffer(this.quad);const e=t.getExtension("WEBGL_lose_context");e==null||e.loseContext()}},Br=()=>typeof window<"u"&&window.devicePixelRatio||1,Pr=t=>({merged:{...Ot,...t.lens},lensW:t.lensW,lensH:t.lensH,radius:t.borderRadius,x:t.x,y:t.y,scale:t.scale??1,opacity:t.opacity??1}),Ur=(t,e,a,i,s,u)=>{const[f,h]=r.useState(!1),l=r.useRef(null),o=r.useRef(null),k=i[0],X=r.useRef(i);X.current=i;const m=i.some(S=>xe(S.x)||xe(S.y)||xe(S.lensW)||xe(S.lensH)||S.radius!=null&&xe(S.radius));r.useLayoutEffect(()=>{const S=t.current,M=e.current;if(!S||!M)return;let w;try{w=new Gr(S)}catch(_){typeof console<"u"&&console.warn("[liquid-glass] WebGL renderer unavailable, falling back:",_),h(!0);return}l.current=w;const D=Math.min(Br(),s),j=()=>{const _=M.clientWidth,I=M.clientHeight;S.style.width=`${_}px`,S.style.height=`${I}px`,w.resize(Math.round(_*D),Math.round(I*D))};j();const O=new ResizeObserver(j);return O.observe(M),()=>{O.disconnect(),w.dispose(),l.current=null}},[t,e,s]);const d=k.merged,y=We(k.lensW),G=We(k.lensH),N=k.radius!=null?We(k.radius):Math.min(y,G),F=JSON.stringify([d.mapSize,y,G,N,d.depth,d.clipToShape,d.softEdge,d.curvature,d.splay,d.glow,d.glowSpread,d.glowFalloff,d.sheen,d.sheenWidth,d.sheenFalloff,d.sheenAngle,d.bend,d.bendWidth]);r.useEffect(()=>{if(!l.current)return;o.current||(o.current=$t(d.mapSize));const M=o.current.generate({lensHalfWidth:y,lensHalfHeight:G,borderRadius:N,depth:d.depth,clipToShape:d.clipToShape,softEdge:d.softEdge,sheenAngle:d.sheenAngle,glow:d.glow,glowSpread:d.glowSpread,glowFalloff:d.glowFalloff,sheen:d.sheen,sheenWidth:d.sheenWidth,sheenFalloff:d.sheenFalloff,curvature:d.curvature,splay:d.splay,bend:d.bend,bendWidth:d.bendWidth});let w=!1;const D=new Image;return D.onload=()=>{var j;w||(j=l.current)==null||j.setDisplacementMap(D)},D.src=M,()=>{w=!0}},[F,f]);const z=S=>{const M=S.merged,w=We(S.lensW),D=We(S.lensH),j=S.radius!=null?We(S.radius):Math.min(w,D);return JSON.stringify([M.mapSize,w,D,j,M.depth,M.clipToShape,M.softEdge,M.curvature,M.splay,M.glow,M.glowSpread,M.glowFalloff,M.sheen,M.sheenWidth,M.sheenFalloff,M.sheenAngle,M.bend,M.bendWidth])},$=i.map(z),v=r.useRef($);v.current=$;const q=r.useRef(new Map),U=$.join("|");return r.useEffect(()=>{const S=o.current;if(!S)return;const M=new Set(v.current);q.current.forEach((O,_)=>{var I;M.has(_)||(q.current.delete(_),(I=l.current)==null||I.releaseDispMap(O))});const w=v.current[0],D=[],j=new Set;return i.forEach((O,_)=>{const I=v.current[_];if(I===w||j.has(I)||q.current.has(I))return;j.add(I);const W=O.merged,c=We(O.lensW),K=We(O.lensH),J=O.radius!=null?We(O.radius):Math.min(c,K),E=S.generate({lensHalfWidth:c,lensHalfHeight:K,borderRadius:J,depth:W.depth,clipToShape:W.clipToShape,softEdge:W.softEdge,sheenAngle:W.sheenAngle,glow:W.glow,glowSpread:W.glowSpread,glowFalloff:W.glowFalloff,sheen:W.sheen,sheenWidth:W.sheenWidth,sheenFalloff:W.sheenFalloff,curvature:W.curvature,splay:W.splay,bend:W.bend,bendWidth:W.bendWidth});let T=!1;const Y=new Image;Y.onload=()=>{T||q.current.set(I,Y)},Y.src=E,D.push(()=>{T=!0})}),()=>D.forEach(O=>O())},[U,f]),r.useEffect(()=>()=>{var S;(S=o.current)==null||S.dispose(),o.current=null},[]),r.useEffect(()=>{if(f)return;let S=0,M=0;const w=u,D=!!w&&!m&&typeof w.requestVideoFrameCallback=="function",j=()=>{const O=l.current,_=e.current;if(!O||!_)return;const I=a();if(I&&I.w>0&&I.h>0){const W=_.clientWidth,c=_.clientHeight,K=Math.sqrt((W*W+c*c)/2),J=v.current,E=X.current.map((T,Y)=>{const te=We(T.lensW),ce=We(T.lensH),re=T.radius!=null?We(T.radius):Math.min(te,ce),ee=We(T.x),he=We(T.y),pe=te*T.scale,Re=ce*T.scale,C=Y>0&&J[Y]!==J[0],V=C?q.current.get(J[Y]):void 0,g=C&&!V;return{originX:(ee*W-pe)/W,originY:1-(he*c+Re)/c,sizeX:2*pe/W,sizeY:2*Re/c,scaleX:g?0:(T.merged.scaleX??T.merged.strength)*K/W,scaleY:g?0:(T.merged.scaleY??T.merged.strength)*K/c,dispersion:T.merged.dispersion,specular:T.merged.specular,blur:T.merged.frost,cornerRadius:re*T.scale/W,opacity:T.opacity,brightness:T.merged.brightness,dispMap:V}});O.render(I.source,I.w,I.h,E)}D?M=w.requestVideoFrameCallback(j):S=requestAnimationFrame(j)};return D?M=w.requestVideoFrameCallback(j):S=requestAnimationFrame(j),()=>{var O;cancelAnimationFrame(S),D&&M&&((O=w.cancelVideoFrameCallback)==null||O.call(w,M))}},[f,a,e,u,m]),f},Or=({src:t,draw:e,poster:a,loop:i=!0,muted:s=!0,autoPlay:u=!0,crossOrigin:f,paused:h,videoRef:l,lenses:o,width:k,height:X,lens:m,lensW:d=90,lensH:y=90,borderRadius:G,x:N=.5,y:F=.5,maxDpr:z=1.5,className:$,style:v,children:q})=>{const U=t!=null,S=r.useRef(null),M=r.useRef(null),w=r.useRef(null),[D,j]=r.useState(null),O=r.useCallback(E=>{w.current=E,typeof l=="function"?l(E):l&&(l.current=E)},[l]),_=r.useRef(null),I=r.useRef(e);I.current=e;const W=r.useRef(0);!U&&!_.current&&typeof document<"u"&&(_.current=document.createElement("canvas"));const c=(o&&o.length?o.map(E=>({lens:E.optics?{...m,...E.optics}:m,lensW:E.w/2,lensH:E.h/2,borderRadius:E.radius,x:E.x,y:E.y,scale:E.scale,opacity:E.opacity})):[{lens:m,lensW:d,lensH:y,borderRadius:G,x:N,y:F}]).map(Pr);r.useEffect(()=>{U&&j(w.current)},[U]),r.useEffect(()=>{const E=w.current;!U||!E||h===void 0||(h?E.pause():E.play().catch(()=>{}))},[U,h]);const K=r.useCallback(()=>{if(U){const re=w.current;return!re||re.readyState<2?null:{source:re,w:re.videoWidth,h:re.videoHeight}}const E=_.current,T=S.current;if(!E||!T||!I.current)return null;const Y=k??Math.round(T.clientWidth),te=X??Math.round(T.clientHeight);if(Y===0||te===0)return null;(E.width!==Y||E.height!==te)&&(E.width=Y,E.height=te);const ce=E.getContext("2d");return ce?(W.current===0&&(W.current=performance.now()),I.current(ce,performance.now()-W.current),{source:E,w:Y,h:te}):null},[U,k,X]),J=Ur(M,S,K,c,z,U?D:null);return n.jsxs("div",{ref:S,className:$,style:{position:"relative",overflow:"hidden",...v},children:[U&&n.jsx("video",{ref:O,src:t,poster:a,loop:i,muted:s,autoPlay:u,playsInline:!0,crossOrigin:f,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",visibility:J?"visible":"hidden"}}),n.jsx("canvas",{ref:M,style:{position:"absolute",inset:0,pointerEvents:"none",display:J?"none":"block"}}),!U&&J&&n.jsx("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center",color:"#888",font:"13px system-ui"},children:"WebGL unavailable"}),q!=null&&n.jsx("div",{style:{position:"absolute",inset:0},children:q})]})},Nr=()=>{const[t,e]=r.useState(!1);return r.useEffect(()=>{if(typeof navigator>"u")return;const a=navigator.userAgent,s=navigator.userAgentData!=null||/\b(?:Chrome|Chromium|Edg)\//.test(a)&&!/\b(?:CriOS|EdgiOS|FxiOS|OPiOS)\b/.test(a)&&!/iPhone|iPad|iPod/.test(a);e(s)},[]),t},$r={strength:.05,depth:.5,curvature:.3,bend:.45,bendWidth:.16,dispersion:.32,frost:6,saturate:1.15,sheen:.32,sheenWidth:3,sheenFalloff:1.5,glow:.1,glowSpread:1,glowFalloff:.5,specular:1,sheenAngle:45,brightness:0},Hr=({dispScale:t,dispersion:e,specular:a,hasSpecular:i,mapMatrix:s,width:u,height:f,mapUrl:h,feImageRef:l})=>{const o=s?"scaledMap":"map";return n.jsxs(n.Fragment,{children:[n.jsx("feFlood",{floodColor:"rgb(128,128,128)",floodOpacity:"1",result:"mapBg"}),n.jsx("feImage",{ref:l,href:h||void 0,x:0,y:0,width:u,height:f,preserveAspectRatio:"none",result:"rawMap"}),n.jsx("feComposite",{in:"rawMap",in2:"mapBg",operator:"over",result:"map"}),s&&n.jsx("feColorMatrix",{in:"map",type:"matrix",values:s,result:"scaledMap"}),e>0?n.jsxs(n.Fragment,{children:[n.jsx("feDisplacementMap",{in:"SourceGraphic",in2:o,scale:t*(1+at*e),xChannelSelector:"R",yChannelSelector:"G"}),n.jsx("feColorMatrix",{type:"matrix",values:"1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0",result:"refractR"}),n.jsx("feDisplacementMap",{in:"SourceGraphic",in2:o,scale:t*(1+at*.5*e),xChannelSelector:"R",yChannelSelector:"G"}),n.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0",result:"refractG"}),n.jsx("feDisplacementMap",{in:"SourceGraphic",in2:o,scale:t,xChannelSelector:"R",yChannelSelector:"G"}),n.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0",result:"refractB"}),n.jsx("feComposite",{in:"refractR",in2:"refractG",operator:"arithmetic",k1:"0",k2:"1",k3:"1",k4:"0",result:"refractRG"}),n.jsx("feComposite",{in:"refractRG",in2:"refractB",operator:"arithmetic",k1:"0",k2:"1",k3:"1",k4:"0",result:"lensOut"})]}):n.jsx("feDisplacementMap",{in:"SourceGraphic",in2:o,scale:t,xChannelSelector:"R",yChannelSelector:"G",result:"lensOut"}),i&&n.jsxs(n.Fragment,{children:[n.jsx("feColorMatrix",{in:"map",type:"matrix",values:`0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 ${-128/255}`,result:"sheenMask"}),n.jsx("feComposite",{in:"sheenMask",in2:"lensOut",operator:"arithmetic",k1:"0",k2:a,k3:"1",k4:"0"})]})]})},Bt=t=>t==null?void 0:xe(t)?We(t):t,zr=({children:t,optics:e,radius:a,width:i,height:s,className:u,style:f,...h})=>{const l=Nr(),o=r.useMemo(()=>({...Ot,...$r,...e}),[e]),k=r.useId().replace(/:/g,""),X=r.useRef(null),m=r.useRef(null),d=r.useRef(null),y=r.useRef(null),G=r.useRef(""),N=r.useRef(0),[F,z]=r.useState({w:0,h:0,r:0,appliedR:void 0}),[$,v]=r.useState(!1),q=F.w>0&&F.h>0,U=Bt(a),S=Bt(i),M=Bt(s),w=(f==null?void 0:f.borderRadius)!=null,D=r.useRef(!1);r.useLayoutEffect(()=>{D.current=!1},[U,w,u]),r.useLayoutEffect(()=>{const C=X.current;if(!C)return;const V=()=>{const Q=C.getBoundingClientRect(),se=typeof getComputedStyle<"u",A=se?getComputedStyle(C):null,Le=A&&parseFloat(A.borderTopLeftRadius)||0;if(A){const Z=A.position;v(ve=>Z==="static"?!0:Z==="relative"?ve:!1)}let me,B;if(U!=null)me=U,B=U;else if(w||Le>0&&!D.current)me=Le,B=void 0;else{let Z=C.firstElementChild;for(;Z&&Z.hasAttribute("data-lg-layer");)Z=Z.nextElementSibling;const ve=Z&&se&&parseFloat(getComputedStyle(Z).borderTopLeftRadius)||0;me=ve,B=ve,D.current=!0}z(Z=>Z.w===Q.width&&Z.h===Q.height&&Z.r===me&&Z.appliedR===B?Z:{w:Q.width,h:Q.height,r:me,appliedR:B})};V();const g=new ResizeObserver(V);return g.observe(C),window.addEventListener("resize",V),()=>{g.disconnect(),window.removeEventListener("resize",V)}},[U,w,u]);const j=JSON.stringify([F.w,F.h,F.r,o.mapSize,o.clipToShape,o.softEdge,o.depth,o.curvature,o.splay,o.bend,o.bendWidth,o.sheen,o.sheenWidth,o.sheenFalloff,o.sheenAngle,o.glow,o.glowSpread,o.glowFalloff]),O=o.scaleX??o.strength,_=o.scaleY??o.strength,I=Math.max(O,_),W=q?Math.sqrt((F.w*F.w+F.h*F.h)/2):0,c=I*W,K=q?Math.ceil(c*(o.dispersion>0?1.2:1)*.5+28):0,J=I>0?O/I:1,E=I>0?_/I:1,T=J===1&&E===1?null:Nt(J,E),Y=o.glow>0||o.sheen>0;r.useLayoutEffect(()=>{var g,Q;if(!q)return;const C=o.mapSize;(!y.current||y.current.size!==C)&&((g=y.current)==null||g.gen.dispose(),y.current={gen:$t(C),size:C});const V=y.current.gen.generate({lensHalfWidth:F.w/2,lensHalfHeight:F.h/2,borderRadius:F.r,depth:o.depth,clipToShape:o.clipToShape,softEdge:o.softEdge,sheenAngle:o.sheenAngle,glow:o.glow,glowSpread:o.glowSpread,glowFalloff:o.glowFalloff,sheen:o.sheen,sheenWidth:o.sheenWidth,sheenFalloff:o.sheenFalloff,curvature:o.curvature,splay:o.splay,bend:o.bend,bendWidth:o.bendWidth});G.current=V,(Q=d.current)==null||Q.setAttribute("href",V),te()},[q,j]);const te=r.useMemo(()=>()=>{const C=X.current,V=m.current;if(!C)return;const g=Math.max(0,o.frost),Q=o.saturate??1,se=[g>0?`blur(${g}px)`:"",Q!==1?`saturate(${Q})`:""].filter(Boolean).join(" ");let A=se||"none";l&&V&&G.current&&(N.current+=1,V.id=`lg-mat-${k}-v${N.current}`,A=`${se?se+" ":""}url(#${V.id})`),C.style.backdropFilter=A,C.style.setProperty("-webkit-backdrop-filter",A)},[o.frost,o.saturate,l,k]);r.useEffect(()=>{q&&te()},[q,te,o.dispersion,o.strength,o.scaleX,o.scaleY,o.specular]),r.useEffect(()=>()=>{var C;(C=y.current)==null||C.gen.dispose(),y.current=null},[]);const ce=r.useRef(!1);r.useEffect(()=>{if(ce.current||!q||typeof getComputedStyle>"u"||typeof document>"u")return;const C=X.current;if(!C)return;const V=getComputedStyle(C).backgroundColor;let g=!1;try{const Q=document.createElement("canvas");Q.width=Q.height=1;const se=Q.getContext("2d");se&&(se.clearRect(0,0,1,1),se.fillStyle=V,se.fillRect(0,0,1,1),g=se.getImageData(0,0,1,1).data[3]===255)}catch{g=!1}g&&typeof console<"u"&&(console.warn("[liquid-glass] <Glass>: the wrapper's background is fully opaque, so it hides the refraction (no glass shows through). Give it an alpha (e.g. `bg-red-400/40` / `rgba(...,0.4)`). (An opaque `background-image` — a solid gradient or photo — hides it the same way.)"),ce.current=!0)},[q]);const re=r.useMemo(()=>{const C=Math.max(0,Math.min(1.5,o.specular));return[`inset 0 1px 0 rgba(255,255,255,${(.55*C).toFixed(3)})`,`inset 0 0 0 1px rgba(255,255,255,${(.12*C).toFixed(3)})`].join(", ")},[o.specular]),ee=f==null?void 0:f.position,pe=ee!=null&&ee!=="static"&&ee!=="unset"&&ee!=="initial"?ee:$?"relative":void 0,Re=o.brightness!==0?n.jsx("div",{"aria-hidden":!0,"data-lg-layer":"",style:{position:"absolute",inset:0,pointerEvents:"none",borderRadius:"inherit",background:o.brightness>0?"#fff":"#000",opacity:Math.min(1,Math.abs(o.brightness))}}):null;return n.jsxs("div",{ref:X,"data-liquid-glass":"material",className:u,style:{display:"inline-block",...f,...pe!=null?{position:pe}:null,...S!=null?{width:S}:null,...M!=null?{height:M}:null,...F.appliedR!=null?{borderRadius:F.appliedR}:null},...h,children:[Re,t,n.jsx("div",{"aria-hidden":!0,"data-lg-layer":"",style:{position:"absolute",inset:0,pointerEvents:"none",borderRadius:"inherit",boxShadow:re}}),n.jsx("svg",{"aria-hidden":!0,"data-lg-layer":"",width:0,height:0,style:{position:"absolute",width:0,height:0},children:n.jsx("defs",{children:n.jsx("filter",{ref:m,id:`lg-mat-${k}-v0`,filterUnits:"userSpaceOnUse",primitiveUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",x:-K,y:-K,width:F.w+2*K,height:F.h+2*K,children:q&&n.jsx(Hr,{dispScale:c,dispersion:o.dispersion,specular:o.specular,hasSpecular:Y,mapMatrix:T,width:F.w,height:F.h,mapUrl:G.current||"",feImageRef:d})})})})]})},Yr=()=>{const[t,e]=r.useState(!1);return r.useEffect(()=>{e(typeof navigator<"u"&&/^((?!chrome|chromium|android).)*safari/i.test(navigator.userAgent))},[]),t},qr=({lens:t,mapHref:e,feImageRef:a,mapMatrixRef:i,blurStdDeviation:s,specularFromRawMap:u,brightnessInFilter:f,filterW:h,filterH:l,clipShapeRef:o})=>{const k=t.scaleX??t.strength,X=t.scaleY??t.strength,m=Math.max(k,X),d=h&&l?Math.sqrt((h*h+l*l)/2):1,y=m*d,G=m>0?k/m:0,N=m>0?X/m:0,F=!(G===1&&N===1),z=F?"scaledMap":"map",$=t.frost>0&&!!s,v=$?"blurred":"SourceGraphic",q=t.glow>0||t.sheen>0,U=t.specular,S=f&&t.brightness!==0,M=$||S;return n.jsxs(n.Fragment,{children:[n.jsx("feFlood",{floodColor:"rgb(128,128,128)",floodOpacity:"1",result:"mapBg"}),n.jsx("feImage",{ref:a,"data-lens":"",href:e,preserveAspectRatio:"none",result:"rawMap"}),n.jsx("feComposite",{in:"rawMap",in2:"mapBg",operator:"over",result:"map"}),F&&n.jsx("feColorMatrix",{ref:i,in:"map",type:"matrix",values:Nt(G,N),result:"scaledMap"}),$&&n.jsx("feGaussianBlur",{in:"SourceGraphic",stdDeviation:s,result:"blurred"}),M&&n.jsx("feImage",{ref:o,"data-lens":"",href:lr,preserveAspectRatio:"none",result:"lensShape"}),t.dispersion>0?n.jsxs(n.Fragment,{children:[n.jsx("feDisplacementMap",{"data-lens":"",in:v,in2:z,scale:y*(1+at*.5*t.dispersion),xChannelSelector:"R",yChannelSelector:"G"}),n.jsx("feColorMatrix",{type:"matrix",values:"1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0",result:"refractR"}),n.jsx("feDisplacementMap",{"data-lens":"",in:v,in2:z,scale:y,xChannelSelector:"R",yChannelSelector:"G"}),n.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0",result:"refractG"}),n.jsx("feDisplacementMap",{"data-lens":"",in:v,in2:z,scale:y*(1-at*.5*t.dispersion),xChannelSelector:"R",yChannelSelector:"G"}),n.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0",result:"refractB"}),n.jsx("feComposite",{in:"refractR",in2:"refractG",operator:"arithmetic",k1:"0",k2:"1",k3:"1",k4:"0",result:"refractRG"}),n.jsx("feComposite",{in:"refractRG",in2:"refractB",operator:"arithmetic",k1:"0",k2:"1",k3:"1",k4:"0",result:"lensOut"})]}):n.jsx("feDisplacementMap",{"data-lens":"",in:v,in2:z,scale:y,xChannelSelector:"R",yChannelSelector:"G",result:"lensOut"}),q&&(t.sheenDark?n.jsxs(n.Fragment,{children:[n.jsx("feColorMatrix",{in:u?"rawMap":"map",type:"matrix",values:`0 0 ${-U} 0 ${1+128*U/255} 0 0 ${-U} 0 ${1+128*U/255} 0 0 ${-U} 0 ${1+128*U/255} 0 0 0 0 1`,result:"sheenMask"}),n.jsx("feComposite",{in:"sheenMask",in2:"lensOut",operator:"arithmetic",k1:"1",k2:"0",k3:"0",k4:"0",result:"lensOut"})]}):n.jsxs(n.Fragment,{children:[n.jsx("feColorMatrix",{in:u?"rawMap":"map",type:"matrix",values:`0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 ${-128/255}`,result:"sheenMask"}),n.jsx("feComposite",{in:"sheenMask",in2:"lensOut",operator:"arithmetic",k1:"0",k2:U,k3:"1",k4:"0",result:"lensOut"})]})),S&&n.jsxs(n.Fragment,{children:[n.jsx("feFlood",{"data-lens":"",floodColor:t.brightness>0?"white":"black",floodOpacity:Math.abs(t.brightness),result:"brightnessFlood"}),n.jsx("feComposite",{in:"brightnessFlood",in2:"lensShape",operator:"in",result:"brightnessVeil"}),n.jsx("feComposite",{in:"brightnessVeil",in2:"lensOut",operator:"over",result:"lensOut"})]}),M?n.jsxs(n.Fragment,{children:[n.jsx("feComposite",{in:"lensOut",in2:"lensShape",operator:"in",result:"lensOut"}),n.jsx("feComposite",{in:"SourceGraphic",in2:"lensShape",operator:"out",result:"cutoutSrc"}),n.jsx("feComposite",{in:"lensOut",in2:"cutoutSrc",operator:"over"})]}):n.jsxs(n.Fragment,{children:[n.jsx("feFlood",{"data-lens":"",floodColor:"black",floodOpacity:"1",result:"lensMask"}),n.jsx("feComposite",{in:"SourceGraphic",in2:"lensMask",operator:"out",result:"cutoutSrc"}),n.jsx("feComposite",{in:"lensOut",in2:"cutoutSrc",operator:"over"})]})]})},Kr=({children:t,lens:e,x:a=.5,y:i=.5,lensW:s,lensH:u,borderRadius:f,refractionTarget:h,refractionBackground:l="transparent",overlay:o,tintColor:k,tintOpacity:X,tintBlur:m,shadowOpacity:d,restShadowOpacity:y,edgeBias:G,depth:N,scale:F,filterResolution:z=1,brightnessInFilter:$=!1,pixelUnits:v=!1,live:q=!1,onLensMapChange:U,className:S,style:M,...w})=>{const D=Yr(),j=r.useRef(D);j.current=D;const O=r.useRef($);O.current=$;const _=r.useRef(v);_.current=v;const I=r.useRef(q);I.current=q;const W=r.useRef(z);W.current=z;const c=r.useMemo(()=>({...Ot,...e}),[e]),K=r.useRef(c);K.current=c;const J=r.useId().replace(/:/g,""),E=r.useRef(null),T=r.useRef(null),Y=r.useRef(null),te=r.useRef(null),ce=r.useRef(null),re=r.useRef(null),ee=r.useRef(null),he=r.useRef(null),pe=r.useRef(null),Re=r.useRef(null),C=r.useRef(null),V=r.useRef(null),g=r.useRef(null),Q=r.useRef([]),se=r.useRef([]),[A,Le]=r.useState({w:0,h:0}),me=r.useRef(A);me.current=A;const B=A.w>0&&A.h>0,Z=h!=null,[ve,Ue]=r.useState(null);r.useLayoutEffect(()=>{var L,ne;if(!Z||l!=="transparent"){Ue(null);return}if(typeof window>"u")return;let P=((L=E.current)==null?void 0:L.parentElement)??null,p=null;for(;P;){const Ye=getComputedStyle(P).backgroundColor,ye=(ne=Ye.match(/rgba?\(([^)]+)\)/))==null?void 0:ne[1].split(",");if((ye&&ye[3]!=null?parseFloat(ye[3]):1)>.95){p=Ye;break}P=P.parentElement}Ue(p)},[Z,l]);const He=l!=="transparent"?l:ve??"transparent",le=r.useRef(.5),ue=r.useRef(.5),Me=r.useRef(c.lensW),Ie=r.useRef(c.lensH),b=r.useRef(c.borderRadius),Te=r.useRef(s!==void 0);Te.current=s!==void 0;const je=r.useRef(u!==void 0);je.current=u!==void 0;const Oe=r.useRef(f!==void 0);Oe.current=f!==void 0;const Ae=r.useRef(0),Ze=r.useRef(c.depth),Ge=r.useRef(c.scaleX??c.strength),Ve=r.useRef(c.scaleY??c.strength),Pe=r.useRef(1),we=r.useRef(0),x=r.useRef(1),fe=r.useRef(0),de=r.useRef(.5),be=r.useRef(NaN),ze=r.useRef(NaN),R=r.useRef(NaN),H=r.useRef(1),ie=r.useRef(0),Ce=r.useRef(""),De=r.useRef(!1),_e=r.useRef(null),ke=r.useRef(null),Ne=r.useRef(null),ct=r.useRef(k);ct.current=k;const Be=r.useRef(U);Be.current=U;const ht=A.w>0&&A.h>0?Math.sqrt((A.w*A.w+A.h*A.h)/2):0;let Je=Math.max(c.scaleX??c.strength,c.scaleY??c.strength);if(ht>0){const P=typeof s=="number"?s*2:A.w,p=typeof u=="number"?u*2:A.h,L=1+at*c.dispersion;Je=Math.min(Je,Math.max(P,p)*.6/(ht*L))}const rt=v&&h!=null&&A.w>0&&A.h>0?Math.ceil(Je*ht*(1+at*c.dispersion)*.5+c.depth+28)+16:0,ae=r.useRef(rt);ae.current=rt,r.useLayoutEffect(()=>{const P=E.current;if(!P)return;const p=()=>{var Ye;const ne=P.getBoundingClientRect();if(!Oe.current&&typeof getComputedStyle<"u"){let ye=parseFloat(getComputedStyle(P).borderTopLeftRadius)||0;const Se=(Ye=T.current)==null?void 0:Ye.firstElementChild;!ye&&Se&&(ye=parseFloat(getComputedStyle(Se).borderTopLeftRadius)||0),Ae.current=ye}Le(ye=>ye.w===ne.width&&ye.h===ne.height?ye:{w:ne.width,h:ne.height})};p();const L=new ResizeObserver(p);return L.observe(P),window.addEventListener("resize",p),()=>{L.disconnect(),window.removeEventListener("resize",p)}},[]);const Fe=r.useCallback(()=>{const P=E.current;if(!P)return;let p=me.current.w,L=me.current.h;if(!(p>0&&L>0)){const oe=P.getBoundingClientRect();p=oe.width,L=oe.height}if(!(p>0&&L>0))return;const ne=K.current,Ye=Ge.current,ye=Ve.current;let Se=Math.max(Ye,ye);const pt=ne.dispersion,bt=Te.current?Me.current:p/2,xt=je.current?Ie.current:L/2,ut=Oe.current?b.current:Ae.current;let Dt=le.current*p,Xt=ue.current*L;_.current&&Y.current&&(Dt=Math.max(bt,Math.min(p-bt,Dt)),Xt=Math.max(xt,Math.min(L-xt,Xt)));const qe=Dt-bt,Ke=Xt-xt,nt=2*bt,it=2*xt;if(_.current){const oe=Math.sqrt((p*p+L*L)/2),Ee=1+at*pt,Rt=Math.max(nt,it)*.6;oe>0&&(Se=Math.min(Se,Rt/(oe*Ee)))}const Kt=W.current,Qe=Kt!==1&&!j.current?Kt:1,ft=j.current?Qe*H.current:Qe,vr=qe!==be.current||Ke!==ze.current,Vt=Se!==R.current;if(be.current=qe,ze.current=Ke,R.current=Se,vr||Vt||I.current){const oe=de.current,Ee=_.current,Rt=Math.sqrt((p*p+L*L)/2),wr=Se*Rt*(1+at*pt)*.5,Jt=Math.ceil(wr+Ze.current+28),gt=Ee&&Y.current?ae.current:0,yr=String(Ee?(qe+gt+oe)*ft:(qe+oe)/p),Sr=String(Ee?(Ke+gt+oe)*ft:(Ke+oe)/L),Er=String(Ee?Math.max(0,nt-2*oe)*ft:Math.max(0,nt-2*oe)/p),Mr=String(Ee?Math.max(0,it-2*oe)*ft:Math.max(0,it-2*oe)/L);for(const $e of Q.current)$e.setAttribute("x",yr),$e.setAttribute("y",Sr),$e.setAttribute("width",Er),$e.setAttribute("height",Mr);if(Vt){const $e=Ee?Se*Rt*ft:Se,Tr=pt>0?[$e*(1+at*.5*pt),$e,$e*(1-at*.5*pt)]:[$e],Qt=se.current;for(let Tt=0;Tt<Qt.length;Tt+=1)Qt[Tt].setAttribute("scale",String(Tr[Tt]??0))}const dt=Re.current;if(dt){Ee&&(dt.setAttribute("x","0"),dt.setAttribute("y","0"),Y.current?(dt.setAttribute("width",String((qe+gt+nt+Jt)*ft)),dt.setAttribute("height",String((Ke+gt+it+Jt)*ft))):(dt.setAttribute("width",String(p*ft)),dt.setAttribute("height",String(L*ft)))),ie.current+=1,dt.id=`lg-${J}-v${ie.current}`;const $e=_e.current?`url(#${dt.id})`:"";Y.current?(Y.current.style.filter!==$e&&(Y.current.style.filter=$e),Y.current.style.clipPath=`inset(${Math.max(0,Ke+gt)*Qe}px ${Math.max(0,p+gt-(qe+nt))*Qe}px ${Math.max(0,L+gt-(Ke+it))*Qe}px ${Math.max(0,qe+gt)*Qe}px round ${ut*Qe}px)`,T.current&&!te.current&&(T.current.style.filter="")):T.current&&T.current.style.filter!==$e&&(T.current.style.filter=$e)}}te.current&&(te.current.style.clipPath=`inset(${Math.max(0,Ke)*Qe}px ${Math.max(0,p-(qe+nt))*Qe}px ${Math.max(0,L-(Ke+it))*Qe}px ${Math.max(0,qe)*Qe}px round ${ut*Qe}px)`),ce.current&&!te.current&&(ce.current.style.clipPath=`inset(${Math.max(0,Ke)}px ${Math.max(0,p-(qe+nt))}px ${Math.max(0,L-(Ke+it))}px ${Math.max(0,qe)}px round ${ut}px)`);const It=(oe,Ee)=>{oe.style.transform=`translate(${qe}px, ${Ke}px)`,oe.style.width=`${nt}px`,oe.style.height=`${it}px`,oe.style.borderRadius=`${ut}px`,Ee!==void 0&&(oe.style.opacity=String(Ee))};if(he.current&&It(he.current,x.current),pe.current&&It(pe.current,fe.current),ee.current){ee.current.style.transform=`translate3d(${qe}px, ${Ke}px, 0)`,ee.current.style.width=`${nt}px`,ee.current.style.height=`${it}px`,ee.current.style.borderRadius=`${ut}px`;const{uri:oe,key:Ee}=ur(nt,it,ut);if(Ce.current!==Ee){const Rt=`url("${oe}")`;ee.current.style.maskImage=Rt,ee.current.style.setProperty("-webkit-mask-image",Rt),ee.current.style.maskSize="100% 100%",ee.current.style.setProperty("-webkit-mask-size","100% 100%"),Ce.current=Ee}}if(re.current){It(re.current);const oe=ct.current??"white";re.current.style.background=`color-mix(in srgb, ${oe} ${100*Pe.current}%, transparent)`,re.current.style.opacity="1";const Ee=we.current>0?`blur(${we.current}px)`:"none";re.current.style.backdropFilter=Ee,re.current.style.setProperty("-webkit-backdrop-filter",Ee)}if(g.current){const oe=Se>0?Ye/Se:0,Ee=Se>0?ye/Se:0;g.current.setAttribute("values",Nt(oe,Ee))}},[J]),et=r.useCallback(()=>{De.current||(De.current=!0,queueMicrotask(()=>{De.current=!1,Fe()}))},[Fe]),Xe=r.useCallback(()=>{be.current=NaN,R.current=NaN,Fe()},[Fe]);r.useEffect(()=>{const P=()=>{const L=window.innerWidth,ne=L>0?window.outerWidth/L:1;return ne>.2&&ne<12?Math.abs(ne-1)<.04?1:ne:1},p=()=>{const L=P();Math.abs(L-H.current)>.002&&(H.current=L,Xe())};return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[Xe]);const tt=r.useCallback(()=>{var Se,pt,bt,xt;const P=K.current.mapSize;(!Ne.current||Ne.current.size!==P)&&((Se=Ne.current)==null||Se.gen.dispose(),Ne.current={gen:$t(P),size:P});const p=K.current,L=Te.current?Me.current:me.current.w/2,ne=je.current?Ie.current:me.current.h/2,Ye=Oe.current?b.current:Ae.current,ye=Ne.current.gen.generate({lensHalfWidth:L,lensHalfHeight:ne,borderRadius:Ye,depth:Ze.current,clipToShape:p.clipToShape,softEdge:p.softEdge,sheenAngle:p.sheenAngle,glow:p.glow,glowSpread:p.glowSpread,glowFalloff:p.glowFalloff,sheen:p.sheen,sheenWidth:p.sheenWidth,sheenFalloff:p.sheenFalloff,curvature:p.curvature,splay:p.splay,bend:p.bend,bendWidth:p.bendWidth});if(_e.current=ye,(pt=C.current)==null||pt.setAttribute("href",ye),p.frost>0||O.current&&p.brightness!==0){const ut=Lr(2*L,2*ne,Ye);ke.current=ut.uri,(bt=V.current)==null||bt.setAttribute("href",ut.uri)}(xt=Be.current)==null||xt.call(Be,ye),Xe()},[Xe]),lt=r.useRef(tt);lt.current=tt;const Mt=JSON.stringify([c.mapSize,c.clipToShape,c.softEdge,c.sheenAngle,c.glow,c.glowSpread,c.glowFalloff,c.sheen,c.sheenWidth,c.sheenFalloff,c.curvature,c.splay,c.bend,c.bendWidth,xe(s)?"mv":s??(A.w/2||c.lensW),xe(u)?"mv":u??(A.h/2||c.lensH),xe(f)?"mv":f??Ae.current,xe(N)?"mv":N??c.depth,$&&c.brightness!==0]);r.useLayoutEffect(()=>{const P=[],p=(L,ne,Ye,ye=()=>{I.current||et()})=>{if(L===void 0){ne.current=Ye;return}xe(L)?(ne.current=L.get(),P.push(L.on("change",Se=>{ne.current=Se,ye()}))):ne.current=L};return p(a,le,.5),p(i,ue,.5),p(s??c.lensW,Me,c.lensW),p(u??c.lensH,Ie,c.lensH),p(f??c.borderRadius,b,c.borderRadius),p(N??c.depth,Ze,c.depth),p(F??c.scaleX??c.strength,Ge,c.scaleX??c.strength),p(F??c.scaleY??c.strength,Ve,c.scaleY??c.strength),p(X,Pe,1),p(m,we,0),p(d,x,1),p(y,fe,0),p(G,de,.5),Fe(),()=>P.forEach(L=>L())},[a,i,s,u,f,N,F,X,m,d,y,G,c,et,Fe]);const mr=c.dispersion>0,jt=c.frost>0,br=c.glow>0||c.sheen>0;r.useLayoutEffect(()=>{const P=Re.current;Q.current=P?Array.from(P.querySelectorAll("[data-lens]")):[],se.current=P?Array.from(P.querySelectorAll("feDisplacementMap")):[],C.current&&_e.current&&C.current.setAttribute("href",_e.current),V.current&&ke.current&&V.current.setAttribute("href",ke.current),Xe()},[B,mr,jt,br,c.sheenDark,c.scaleX,c.scaleY,c.strength,c.brightness,$,v,D,h!=null,o!=null,Xe]),r.useLayoutEffect(()=>{B&&Xe()},[A.w,A.h,rt,Xe]),r.useLayoutEffect(()=>{B&&lt.current()},[B,Mt]),r.useEffect(()=>{const P=[];let p;const L=()=>{clearTimeout(p),p=setTimeout(()=>lt.current(),90)};for(const ne of[s,u,f,N])xe(ne)&&P.push(ne.on("change",L));return()=>{P.forEach(ne=>ne()),clearTimeout(p)}},[s,u,f,N]),r.useEffect(()=>()=>{var P,p;(P=Ne.current)==null||P.gen.dispose(),Ne.current=null,(p=Be.current)==null||p.call(Be,null)},[]),r.useEffect(()=>{if(!q||!B)return;let P=0;const p=()=>{P=requestAnimationFrame(p),Fe()};return P=requestAnimationFrame(p),()=>cancelAnimationFrame(P)},[q,B,Fe]);const xr=z!==1&&!D?z:1,Rr=jt&&B?v?`${c.frost*xr}`:`${c.frost/A.w} ${c.frost/A.h}`:void 0,st=z!==1&&!D?z:1,Ct=st>1&&o==null&&h==null&&B,Ht=o==null&&h==null&&!Ct&&s===void 0,zt=(P,p,L)=>n.jsx("div",{ref:P,style:{...L,position:"absolute",top:0,left:0,width:A.w*st,height:A.h*st,transform:`scale(${1/st})`,transformOrigin:"top left"},children:n.jsx("div",{style:{transform:`scale(${st})`,transformOrigin:"top left",width:A.w,height:A.h},children:p})}),Yt=c.brightness!==0&&!$?n.jsx("div",{ref:ce,style:{position:"absolute",inset:0,pointerEvents:"none",background:c.brightness>0?"white":"black",opacity:Math.abs(c.brightness)}}):null,qt=(P,p,L)=>p||L?n.jsx("div",{ref:P,style:{position:"absolute",top:0,left:0,pointerEvents:"none",willChange:"transform",boxSizing:"border-box",boxShadow:[p,L?`inset ${L}`:null].filter(Boolean).join(", ")}}):null;return n.jsxs("div",{ref:E,"data-liquid-glass":"",className:S,style:{contain:"layout",position:"relative",overflow:"visible",...Ht?{width:"fit-content"}:null,...Ct?{minHeight:A.h}:null,...M},...w,children:[Ct?zt(T,t,{willChange:"filter"}):o==null&&h==null?n.jsx("div",{ref:T,style:Ht?{willChange:"filter"}:{willChange:"filter",position:"relative",height:B?A.h:void 0,overflow:"hidden",contain:"paint"},children:t}):o==null&&v?n.jsx("div",{ref:T,style:{position:"absolute",inset:0,isolation:"isolate"},children:t}):n.jsx("div",{ref:o!=null?void 0:T,style:o!=null?void 0:{willChange:"filter"},children:t}),h!=null&&(v?n.jsx("div",{ref:Y,style:{position:"absolute",inset:-rt,pointerEvents:"none",willChange:"filter, clip-path",background:He},children:n.jsx("div",{style:{position:"absolute",inset:rt},children:h})}):st>1?zt(Y,h,{pointerEvents:"none",willChange:"filter, clip-path",background:He}):n.jsx("div",{ref:Y,style:{position:"absolute",inset:0,pointerEvents:"none",willChange:"filter, clip-path",background:He},children:h})),o!=null&&n.jsxs("div",{ref:te,style:{position:"absolute",inset:0,pointerEvents:"none"},children:[n.jsx("div",{ref:T,style:{willChange:"filter"},children:o}),Yt]}),n.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[n.jsx("svg",{viewBox:`0 0 ${A.w} ${A.h}`,width:"100%",height:"100%",style:{display:"block"},children:n.jsx("defs",{children:n.jsx("filter",{ref:Re,id:`lg-${J}-v0`,filterUnits:v?"userSpaceOnUse":"objectBoundingBox",primitiveUnits:v?"userSpaceOnUse":"objectBoundingBox",colorInterpolationFilters:"sRGB",x:0,y:0,width:v?A.w*st:1,height:v?A.h*st:1,children:B&&n.jsx(qr,{lens:{...c,scaleX:F!==void 0?We(F):c.scaleX??c.strength,scaleY:F!==void 0?We(F):c.scaleY??c.strength},mapHref:lr,feImageRef:C,mapMatrixRef:g,blurStdDeviation:Rr,specularFromRawMap:D,brightnessInFilter:$,filterW:v?A.w*st:void 0,filterH:v?A.h*st:void 0,clipShapeRef:V})})})}),o==null&&Yt,k!==void 0&&n.jsx("div",{ref:re,style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"hidden",willChange:"transform"}})]}),jt&&t==null&&h==null&&o==null&&n.jsx("div",{ref:ee,style:{position:"absolute",top:0,left:0,pointerEvents:"none",willChange:"backdrop-filter, transform",backdropFilter:`blur(${c.frost}px)`,WebkitBackdropFilter:`blur(${c.frost}px)`}}),qt(he,c.edgeShadow,c.edgeInsetShadow),qt(pe,c.restEdgeShadow,c.restEdgeInsetShadow)]})},sr=t=>r.useMemo(()=>t==null?void 0:xe(t)?ot([t],()=>t.get()/2):t/2,[t]),mt=t=>{const{children:e,width:a,height:i,size:s,radius:u,center:f,optics:h,refract:l,behind:o,src:k,draw:X,lenses:m,videoRef:d,paused:y,poster:G,loop:N,muted:F,autoPlay:z,crossOrigin:$,maxDpr:v,unstable_lens:q,...U}=t,S={...U,...q??{}},M=f==null?void 0:f.x,w=f==null?void 0:f.y,[D,j]=Array.isArray(s)?s:s!=null?[s,s]:[void 0,void 0],O=sr(a??D),_=sr(i??j);if(k!=null||X!=null)return n.jsx(Or,{src:k,draw:X,lens:h,lenses:m,videoRef:d,paused:y,poster:G,loop:N,muted:F,autoPlay:z,crossOrigin:$,maxDpr:v,lensW:O,lensH:_,borderRadius:u,x:M,y:w,className:t.className,style:t.style,children:e});const{overlay:I,tintColor:W,tintOpacity:c,tintBlur:K,shadowOpacity:J,restShadowOpacity:E,edgeBias:T,brightnessInFilter:Y,depth:te,scale:ce,filterResolution:re,pixelUnits:ee,live:he,onLensMapChange:pe,...Re}=S,C=xe(a)||xe(i)||xe(u)||xe(D)||xe(j)||xe(M)||xe(w);return e!=null&&l==null&&k==null&&X==null&&m==null&&I==null&&!ee&&W==null&&c==null&&K==null&&J==null&&E==null&&T==null&&!Y&&re==null&&!he&&te==null&&ce==null&&pe==null&&M==null&&w==null&&!C?n.jsx(zr,{...Re,optics:h,radius:u,width:a??D,height:i??j,children:e}):n.jsx(Kr,{...S,lensW:O,lensH:_,borderRadius:u,x:M,y:w,lens:h,refractionTarget:l,refractionBackground:o,children:e})},Vr=176,Jr=13.6,kt=.34,Qr=.75,Zr=84,nr=.033,ir=.008,ar=.03,es=(t,e,a,i)=>{r.useEffect(()=>{let s=0,u=0,f=0,h=0,l=t.get(),o=!1;const k=G=>{const N=Math.pow(G,Qr)/Zr,F=N<kt?N:kt,z=a.current,$=F>z?F:z;return $<kt?$:kt},X=G=>Math.abs(u)<6e-4&&Math.abs(f)<.006&&G<.006&&a.current===0,m=G=>{const N=(G-h)/1e3,F=N<nr?N:nr;h=G;const z=t.get(),$=N<ir?ir:N>ar?ar:N,v=Math.abs((z-l)/$);l=z;const q=k(v),U=Vr*(q-u)-Jr*f;if(f+=U*F,u+=f*F,e.set(u),X(v)){o=!1,e.set(0);return}s=requestAnimationFrame(m)},d=()=>{o||(o=!0,h=performance.now(),l=t.get(),s=requestAnimationFrame(m))};i.current=d;const y=t.on("change",d);return()=>{y(),cancelAnimationFrame(s),i.current=()=>{}}},[t,e,a,i])},Lt=(t,e,a)=>{const i=t<a?t/a:1;return e*i*(3+i*(i-3))},St=r.forwardRef(({x:t,scaleX:e,scaleY:a,style:i,children:s,...u},f)=>{const h=r.useRef(null);return r.useEffect(()=>{const l=h.current;if(!l)return;const o=[t,e,a].filter(m=>m!=null),k=()=>{let m="";if(t&&(m=`translateX(${t.get()}px)`),e||a){const d=e?e.get():1,y=a?a.get():1;m+=`${m?" ":""}scale(${d}, ${y})`}l.style.transform=m};k();const X=o.map(m=>m.on("change",k));return()=>X.forEach(m=>m())},[t,e,a]),n.jsx("div",{ref:l=>{h.current=l,typeof f=="function"?f(l):f&&(f.current=l)},style:i,...u,children:s})});St.displayName="GlassDiv";const ts=r.forwardRef(function({variant:e="primary",size:a="md",glassProps:i,contentClassName:s,className:u="",type:f="button",children:h,...l},o){return n.jsxs("span",{className:`matui-glass-button-shell matui-glass-button--${e}`,children:[n.jsx(mt,{...i,"aria-hidden":!0,style:{...i==null?void 0:i.style,position:"absolute",inset:0,width:"100%",height:"100%",borderRadius:"inherit",pointerEvents:"none"},children:n.jsx("span",{})}),n.jsx("button",{...l,ref:o,type:f,className:`matui-glass-button matui-glass-button--${a} ${u}`,children:n.jsx("span",{className:s,children:h})})]})}),rs=r.forwardRef(function({elevation:e="raised",glassProps:a,className:i="",children:s,...u},f){return n.jsx("div",{...u,ref:f,className:`matui-glass-card matui-glass-card--${e} ${i}`,children:n.jsx(mt,{...a,style:{width:"100%",padding:28,borderRadius:"inherit",...a==null?void 0:a.style},children:s})})});function ss({label:t,options:e,value:a,defaultValue:i,onValueChange:s,name:u,disabled:f,className:h=""}){var m;const l=r.useId(),[o,k]=r.useState(i??((m=e.find(d=>!d.disabled))==null?void 0:m.value)??""),X=a??o;return n.jsxs("fieldset",{disabled:f,className:`matui-glass-segmented ${h}`,children:[n.jsx("legend",{className:"matui-glass-sr-only",children:t}),e.map(d=>n.jsxs("div",{className:"matui-glass-segment",children:[X===d.value&&n.jsx(mt,{"aria-hidden":!0,className:"matui-glass-segment-lens",style:{position:"absolute",inset:0,borderRadius:18,width:"100%",height:"100%",background:"#ffffff44",pointerEvents:"none"},children:n.jsx("span",{})}),n.jsxs("label",{children:[n.jsx("input",{type:"radio",name:u??l,value:d.value,checked:X===d.value,disabled:d.disabled,onChange:()=>{a===void 0&&k(d.value),s==null||s(d.value)}}),n.jsx("span",{children:d.label})]})]},d.value))]})}const fr="(prefers-reduced-motion: reduce)",ns=t=>{const e=window.matchMedia(fr);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},is=()=>window.matchMedia(fr).matches,as=()=>!1;function dr(){return r.useSyncExternalStore(ns,is,as)}function hr(){const t=dr();return r.useCallback((...[e,a,i])=>Dr(e,a,t?{...i,duration:0}:i),[t])}function pr(...[t,e,a,i]){const s=dr(),u=r.useMemo(()=>ge(0),[]),f=r.useRef(0),h=r.useRef(()=>{});es(s?u:t,e,s?f:a,s?h:i),r.useEffect(()=>{s&&(e.set(0),i.current=()=>{})},[s,e,i])}const gr=Et(.34,1.36,.42,1),os=Et(.36,0,.18,1),vt={ease:gr,duration:.52},yt={ease:gr,duration:.26},wt={ease:os,duration:.46},cs={mapSize:256,depth:.2,dispersion:.65,strength:.19,clipToShape:!0,softEdge:!0,curvature:.3,splay:.6,bend:.1,bendWidth:.06,frost:0,brightness:.05,specular:1.2,sheenAngle:45,sheenDark:!1,glow:.05,glowSpread:.5,glowFalloff:1.5,sheen:.45,sheenWidth:2,sheenFalloff:1.5,edgeShadow:"0 2px 6px rgba(0, 0, 0, 0.16)",edgeInsetShadow:"0 -4px 10px rgba(0, 0, 0, 0.12)",restEdgeShadow:"0 1px 3px rgba(0, 0, 0, 0.24), 0 4px 10px rgba(0, 0, 0, 0.14)"},ls={brightness:.12,glow:.4,sheen:.5},us={brightness:-.02,sheenAngle:30,specular:1.5,glow:.4,glowSpread:.5,glowFalloff:2,sheen:1,sheenWidth:1.5,sheenFalloff:1},or="color-mix(in srgb, var(--glass-track), var(--glass-active) calc(var(--switch-progress, 0) * 100%))",fs=({checked:t,defaultChecked:e=!1,onCheckedChange:a,disabled:i,name:s,value:u,ariaLabel:f,width:h=74,height:l=28,lens:o,tintBlur:k,rubberOvershoot:X=.15,rubberDampening:m=10,filterResolution:d=2,forceExpanded:y=!1,onLensMapChange:G,scheme:N="light",trackColor:F,activeColor:z,surface:$})=>{const v=hr(),[q,U]=r.useState(e),S=t??q,M=N==="dark",w=Math.round(.6*h),D=l-6,j=h-w-6,O=h*X,_=O*m,I=l/2,W=D/2,c=w/2,K=D/2,J=Math.round(.75*l),E=Math.ceil(.5*Math.max(c,K)+O)+2,T=h+2*E,Y=l+2*E,te=r.useRef(j),ce=r.useRef(w),re=r.useRef(T),ee=r.useRef(E),he=r.useRef(c),pe=r.useRef(K),Re=r.useRef(W),C=r.useRef(k??0);r.useLayoutEffect(()=>{te.current=j,ce.current=w,re.current=T,ee.current=E,he.current=c,pe.current=K,Re.current=W,C.current=k??0});const V=r.useRef(S),g=r.useMemo(()=>{const x=ge(V.current?te.current:0),fe=ot([x],()=>(ee.current+3+ce.current/2+x.get())/re.current),de=ge(he.current),be=ge(pe.current),ze=ge(Re.current),R=ge(1),H=ge(.85),ie=ge(.525),Ce=ge(C.current),De=ge(0),_e=ot([De],()=>1-De.get()),ke=ge(0),Ne=ot([de,ke],()=>de.get()*(1-.2*ke.get())*2),ct=ot([be,ke],()=>be.get()*(1+.4*ke.get())*2),Be=ot([R],()=>.5*R.get());return{thumbX:x,lensX:fe,halfW:de,halfH:be,radius:ze,tintOpacity:R,trackScaleX:H,trackScaleY:ie,blur:Ce,shadowOpacity:De,restShadowOpacity:_e,stretch:ke,lensW:Ne,lensH:ct,edgeBias:Be}},[]),Q=r.useRef(0),se=r.useRef(()=>{});pr(g.thumbX,g.stretch,Q,se);const A=x=>{v(g.halfW,1.5*he.current,x),v(g.halfH,1.5*pe.current,x),v(g.radius,1.5*Re.current,x),v(g.tintOpacity,0,x),v(g.blur,0,x),v(g.trackScaleX,.95,x),v(g.trackScaleY,.975,x),v(g.shadowOpacity,1,x)},Le=x=>{v(g.halfW,he.current,x),v(g.halfH,pe.current,x),v(g.radius,Re.current,x),v(g.tintOpacity,1,x),v(g.blur,C.current,x),v(g.trackScaleX,.85,x),v(g.trackScaleY,.525,x),v(g.shadowOpacity,0,x)},me=r.useRef(!1);r.useEffect(()=>{y!==me.current&&(me.current=y,y?(A(yt),Q.current=.175,se.current()):(Le(wt),Q.current=0))},[y]);const B=r.useRef("idle"),Z=r.useRef(void 0),ve=r.useRef(void 0),Ue=r.useRef(!0),[He,le]=r.useState(!1),ue=r.useRef(!1),Me=r.useRef(null),Ie=r.useRef(null),b=r.useRef(null),Te=r.useRef(0),je=r.useRef(0),Oe=r.useRef(!1),Ae=r.useRef(null);r.useEffect(()=>{Ue.current=!0;const x=Ie.current;return()=>{if(Ue.current=!1,clearTimeout(Z.current),clearTimeout(ve.current),b.current!==null&&x){try{x.releasePointerCapture(b.current)}catch{}b.current=null}}},[]),r.useEffect(()=>{He||B.current==="tap"||(Ae.current=v(g.thumbX,S?j:0,vt))},[S,He,g.thumbX,j,v]),r.useLayoutEffect(()=>{const x=fe=>{var be;const de=te.current;(be=Me.current)==null||be.style.setProperty("--switch-progress",String(de>0?Math.max(0,Math.min(1,fe/de)):0))};return x(g.thumbX.get()),g.thumbX.on("change",x)},[g.thumbX]);const Ze=r.useMemo(()=>({...cs,...M?ls:us,...o,sheenDark:!M}),[M,o]),Ge=x=>{ue.current||i||(t===void 0&&U(x),a==null||a(x),B.current==="idle"&&(B.current="tap",A(yt),clearTimeout(ve.current),ve.current=setTimeout(()=>{Le(wt)},290),Ae.current=v(g.thumbX,x?j:0,{...vt,onComplete:()=>{Ue.current&&B.current==="tap"&&(B.current="idle")}})))},Ve=$??(M?"#1f1f24":"#ffffff"),Pe=F??(M?"#2a2828":"#e1dfdf"),we=z??"#0a84ff";return n.jsxs("label",{ref:Me,className:"matui-glass-control",style:{flexShrink:0,width:h,height:l,overflow:"visible",cursor:i?"not-allowed":"pointer",opacity:i?.4:void 0,borderRadius:999,display:"block",position:"relative","--glass-track":Pe,"--glass-active":we},children:[n.jsx("input",{type:"checkbox",role:"switch","aria-checked":S,checked:S??!1,onChange:x=>Ge(x.target.checked),onClick:x=>{ue.current&&x.preventDefault()},onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),Ge(!S))},disabled:i,name:s,value:u,"aria-label":f,style:{whiteSpace:"nowrap",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",pointerEvents:"none",border:0,width:1,height:1,margin:-1,padding:0,position:"absolute",overflow:"hidden"}}),n.jsx(mt,{optics:Ze,center:{x:g.lensX,y:.5},size:[g.lensW,g.lensH],radius:g.radius,unstable_lens:{tintColor:"white",tintOpacity:g.tintOpacity,tintBlur:g.blur,shadowOpacity:g.shadowOpacity,restShadowOpacity:g.restShadowOpacity,edgeBias:g.edgeBias},filterResolution:d,onLensMapChange:G,behind:Ve,style:{width:T,height:Y,overflow:"visible",margin:-E},refract:n.jsx("div",{style:{padding:E,height:l,display:"flex",alignItems:"center",boxSizing:"content-box"},children:n.jsx(St,{scaleX:g.trackScaleX,scaleY:g.trackScaleY,style:{width:h,height:J,borderRadius:J/2,background:or}})}),children:n.jsx("div",{style:{padding:E},children:n.jsx("div",{"aria-hidden":!0,style:{width:h,height:l,borderRadius:I,background:or,display:"block",position:"relative",overflow:"visible"},children:n.jsx(St,{ref:Ie,x:g.thumbX,style:{position:"absolute",willChange:"transform",userSelect:"none",WebkitUserSelect:"none",width:w,height:D,top:3,left:3,touchAction:"none"},onPointerDown:x=>{b.current!==null||i||(b.current=x.pointerId,x.currentTarget.setPointerCapture(x.pointerId),Te.current=x.clientX,je.current=g.thumbX.get(),Oe.current=!1,le(!0),ue.current=!0,clearTimeout(Z.current),clearTimeout(ve.current),B.current="pending",Z.current=setTimeout(()=>{var fe;B.current==="pending"&&(B.current="hold",(fe=Ae.current)==null||fe.stop(),A(yt),Q.current=.175,se.current())},170))},onPointerMove:x=>{var be;if(x.pointerId!==b.current)return;const fe=x.clientX-Te.current;if(!Oe.current){if(Math.abs(fe)<3)return;Oe.current=!0,(be=Ae.current)==null||be.stop(),je.current=g.thumbX.get(),Te.current=x.clientX,clearTimeout(Z.current),Q.current=0,B.current!=="hold"&&(B.current="hold",A(yt))}let de=je.current+(x.clientX-Te.current);de<0?de=-Lt(-de,O,_):de>j&&(de=j+Lt(de-j,O,_)),g.thumbX.set(de)},onPointerUp:x=>{if(x.pointerId===b.current)if(b.current=null,clearTimeout(Z.current),Oe.current){le(!1),B.current="idle",Le(wt);const fe=Math.max(0,Math.min(j,g.thumbX.get()))>j/2;Ae.current=v(g.thumbX,fe?j:0,vt),fe!==S&&(a==null||a(fe)),requestAnimationFrame(()=>{ue.current=!1})}else if(B.current==="pending"||B.current==="tap"){B.current="tap",ue.current=!1,le(!1),A(yt),clearTimeout(ve.current),ve.current=setTimeout(()=>{Le(wt)},290);const fe=S?0:j;Ae.current=v(g.thumbX,fe,{...vt,onComplete:()=>{Ue.current&&B.current==="tap"&&(B.current="idle")}})}else B.current==="hold"?(B.current="idle",le(!1),Q.current=0,Le(wt),Ae.current=v(g.thumbX,S?j:0,vt),requestAnimationFrame(()=>{ue.current=!1})):(le(!1),ue.current=!1)},onPointerCancel:x=>{x.pointerId===b.current&&(b.current=null,clearTimeout(Z.current),Q.current=0,le(!1),B.current="idle",Le(wt),Ae.current=v(g.thumbX,S?j:0,vt),requestAnimationFrame(()=>{ue.current=!1}))},onDragStart:x=>x.preventDefault()})})})})]})},cr={ease:Et(.34,1.36,.42,1),duration:.27},Pt={ease:Et(.36,0,.18,1),duration:.46},ds={mapSize:256,depth:.2,dispersion:.5,scaleX:.06,scaleY:.06,clipToShape:!0,softEdge:!0,curvature:.55,splay:.5,bend:.1,bendWidth:.05,frost:0,brightness:.06,specular:1.5,sheenAngle:45,sheenDark:!1,glow:.4,glowSpread:.5,glowFalloff:1.5,sheen:0,sheenWidth:3,sheenFalloff:1.5,edgeShadow:"0 2px 6px rgba(0, 0, 0, 0.16)",edgeInsetShadow:"0 -4px 10px rgba(0, 0, 0, 0.12)"},hs={restEdgeShadow:"0 1.333px 5.333px rgba(0, 0, 0, 0.5)",scaleX:.133,scaleY:.135,brightness:.12,sheenAngle:45,glowFalloff:1.5,sheen:.5,sheenWidth:1,sheenFalloff:1.5},ps={restEdgeShadow:"0 1.333px 5.333px rgba(46, 15, 15, 0.12)",scaleX:.1,scaleY:.1,brightness:-.02,sheenAngle:30,glowFalloff:2,sheen:1,sheenWidth:1,sheenFalloff:1},gs={scaleY:.25},ms=()=>{const[t,e]=r.useState(!1);return r.useEffect(()=>{e(typeof navigator<"u"&&/^((?!chrome|chromium|android).)*safari/i.test(navigator.userAgent))},[]),t},bs=({value:t,defaultValue:e=50,onValueChange:a,min:i=0,max:s=100,step:u=1,disabled:f,width:h=240,thumbHeight:l=22,thumbWidth:o,height:k=6,rubberOvershoot:X=.05,rubberDampening:m=30,refractionTrackHeight:d,lens:y,tintBlur:G,filterResolution:N=2,name:F,ariaLabel:z,forceExpanded:$=!1,onLensMapChange:v,scheme:q="light",trackColor:U,activeColor:S,surface:M})=>{const w=hr(),D=q==="dark",j=ms(),O=t!==void 0,[_,I]=r.useState(e),W=O?t:_,c=r.useCallback(R=>{const H=u>0?Math.round((R-i)/u)*u+i:R,ie=Math.max(i,Math.min(s,H));O||I(ie),a==null||a(ie)},[i,s,u,O,a]),K=o??Math.round(2*l),J=h-K,E=K/2,T=l/2,Y=l/2,te=k/2,ce=h*X,re=ce*m,ee=d??Math.round(.75*l),he=Math.ceil(.5*Math.max(E,T)+ce)+2,pe=h+2*he,Re=l+2*he,C=r.useRef(J),V=r.useRef(K),g=r.useRef(pe),Q=r.useRef(he),se=r.useRef(E),A=r.useRef(T),Le=r.useRef(Y),me=r.useRef(!1),B=r.useRef(0),Z=r.useRef(0),ve=r.useRef(ce),Ue=r.useRef(re),He=r.useRef(G??0);r.useLayoutEffect(()=>{C.current=J,V.current=K,g.current=pe,Q.current=he,se.current=E,A.current=T,Le.current=Y,ve.current=ce,Ue.current=re,He.current=G??0});const le=r.useCallback(R=>s>i?(R-i)/(s-i)*J:0,[i,s,J]),ue=r.useCallback(R=>{const H=Math.max(0,Math.min(J,R)),ie=J>0?i+H/J*(s-i):i;return Math.max(i,Math.min(s,u>0?Math.round((ie-i)/u)*u+i:ie))},[i,s,J,u]),Me=r.useRef(le),Ie=r.useRef(W),b=r.useMemo(()=>{const R=ge(Me.current(Ie.current)),H=ot([R],()=>(Q.current+V.current/2+R.get())/g.current),ie=ge(se.current),Ce=ge(A.current),De=ge(Le.current),_e=ge(1),ke=ge(.85),Ne=ge(.525),ct=ge(He.current),Be=ge(0),ht=ot([Be],()=>1-Be.get()),Je=ge(0),rt=ot([ie,Je],()=>ie.get()*(1-.2*Je.get())*2),ae=ot([Ce,Je],()=>Ce.get()*(1+.4*Je.get())*2);return{thumbX:R,lensX:H,halfW:ie,halfH:Ce,radius:De,tintOpacity:_e,trackScaleX:ke,trackScaleY:Ne,blur:ct,shadowOpacity:Be,restShadowOpacity:ht,stretch:Je,lensW:rt,lensH:ae}},[]);r.useEffect(()=>{me.current||(b.halfW.set(E),b.halfH.set(T),b.radius.set(Y))},[E,T,Y,b]);const Te=r.useRef(0),je=r.useRef(()=>{});pr(b.thumbX,b.stretch,Te,je);const Oe=R=>{w(b.halfW,1.5*se.current,R),w(b.halfH,1.5*A.current,R),w(b.radius,1.5*Le.current,R),w(b.tintOpacity,0,R),w(b.blur,0,R),w(b.trackScaleX,.95,R),w(b.trackScaleY,.975,R),w(b.shadowOpacity,1,R)},Ae=R=>{w(b.halfW,se.current,R),w(b.halfH,A.current,R),w(b.radius,Le.current,R),w(b.tintOpacity,1,R),w(b.blur,He.current,R),w(b.trackScaleX,.85,R),w(b.trackScaleY,.525,R),w(b.shadowOpacity,0,R)},Ze=r.useRef(!1);r.useEffect(()=>{$!==Ze.current&&(Ze.current=$,$?(Oe(cr),Te.current=.175,je.current()):(Ae(Pt),Te.current=0))},[$]);const Ge=r.useRef(null),Ve=r.useRef(null),Pe=r.useRef(null),we=r.useRef(null);r.useEffect(()=>()=>{if(we.current!==null&&Ve.current){try{Ve.current.releasePointerCapture(we.current)}catch{}we.current=null}},[]),r.useEffect(()=>{me.current||b.thumbX.set(le(W))},[W,le,b.thumbX]),r.useEffect(()=>{const R=H=>{const ie=Ge.current;if(!ie)return;const Ce=V.current/2+H,De=C.current>0?H/C.current:0;ie.style.setProperty("--slider-fill",`${Ce}px`),ie.style.setProperty("--slider-progress",String(Math.max(0,Math.min(1,De))))};return R(b.thumbX.get()),b.thumbX.on("change",R)},[b.thumbX]);const x=r.useMemo(()=>({...ds,...D?hs:ps,...j?gs:null,...y,sheenDark:!D}),[D,j,y]),fe=M??(D?"#1f1f24":"#ffffff"),de=U??(D?"#2a2828":"#e1dfdf"),be=S??"#0a84ff",ze=R=>{if(R.pointerId!==we.current)return;we.current=null,me.current=!1,Te.current=0;const H=Math.max(0,Math.min(C.current,b.thumbX.get()));w(b.thumbX,H,Pt),Ae(Pt)};return n.jsx("div",{ref:Ge,className:"matui-glass-control",style:{flexShrink:0,width:h,height:l,overflow:"visible",borderRadius:999,position:"relative",opacity:f?.4:void 0,cursor:f?"not-allowed":void 0,"--glass-track":de,"--glass-active":be},children:n.jsx(mt,{optics:x,center:{x:b.lensX,y:.5},size:[b.lensW,b.lensH],radius:b.radius,unstable_lens:{tintColor:"white",tintOpacity:b.tintOpacity,tintBlur:b.blur,shadowOpacity:b.shadowOpacity,restShadowOpacity:b.restShadowOpacity},filterResolution:N,onLensMapChange:v,behind:fe,style:{width:pe,height:Re,overflow:"visible",margin:-he},refract:n.jsx("div",{style:{padding:he,height:l,display:"flex",alignItems:"center",boxSizing:"content-box"},children:n.jsxs(St,{scaleX:b.trackScaleX,scaleY:b.trackScaleY,style:{position:"relative",width:h,height:ee,borderRadius:ee/2,overflow:"hidden"},children:[n.jsx("div",{style:{position:"absolute",inset:0,background:"var(--glass-track)"}}),n.jsx("div",{style:{position:"absolute",inset:0,background:"var(--glass-active)",borderRadius:"inherit",transform:"translateX(calc((var(--slider-progress, 0) - 1) * 100%))"}})]})}),children:n.jsxs("div",{style:{padding:he},children:[n.jsx("input",{ref:Pe,type:"range",min:i,max:s,step:u,value:W,disabled:f,name:F,"aria-label":z,onChange:R=>c(Number(R.target.value)),style:{whiteSpace:"nowrap",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",pointerEvents:"none",border:0,width:1,height:1,margin:-1,padding:0,position:"absolute",overflow:"hidden"}}),n.jsxs("div",{ref:Ve,"aria-hidden":!0,style:{width:h,height:l,cursor:f?"not-allowed":"pointer",touchAction:"none",userSelect:"none",WebkitUserSelect:"none",alignItems:"center",display:"flex",position:"relative",overflow:"visible"},onPointerDown:R=>{var De,_e;if(f||we.current!==null)return;we.current=R.pointerId,R.currentTarget.setPointerCapture(R.pointerId),me.current=!0,(De=Pe.current)==null||De.focus({preventScroll:!0});const H=(_e=Ve.current)==null?void 0:_e.getBoundingClientRect(),ie=H?R.clientX-H.left-V.current/2:0,Ce=Math.max(0,Math.min(C.current,ie));b.thumbX.set(Ce),c(ue(Ce)),B.current=R.clientX,Z.current=Ce,Oe(cr),Te.current=.175,je.current()},onPointerMove:R=>{if(R.pointerId!==we.current)return;let H=Z.current+(R.clientX-B.current);H<0?H=-Lt(-H,ve.current,Ue.current):H>C.current&&(H=C.current+Lt(H-C.current,ve.current,Ue.current)),b.thumbX.set(H),c(ue(Math.max(0,Math.min(C.current,H))))},onPointerUp:ze,onPointerCancel:ze,onDragStart:R=>R.preventDefault(),children:[n.jsxs("div",{style:{width:"100%",position:"relative",overflow:"hidden",height:k,borderRadius:te},children:[n.jsx("div",{style:{position:"absolute",inset:0,background:"var(--glass-track)",borderRadius:"inherit"}}),n.jsx("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:"var(--slider-fill)",background:"var(--glass-active)",borderRadius:te}})]}),n.jsx(St,{x:b.thumbX,style:{willChange:"transform",position:"absolute",top:0,left:0,width:K,height:l}})]})]})})})},xs="-apple-system, 'SF Pro Text', ui-sans-serif, system-ui, sans-serif",Rs={mapSize:256,clipToShape:!0,softEdge:!0,depth:1,curvature:.5,dispersion:.6,strength:.17,bend:.7,bendWidth:.12,frost:3,brightness:.22,specular:1.3,sheenAngle:50,glow:.32,glowSpread:1,glowFalloff:1,sheen:1.3,sheenWidth:3},vs="#1c1c1e",ws="rgba(0,0,0,0.5)",ys="rgba(0,0,0,0.74)",Ss="radial-gradient(120% 120% at 12% 18%, #ff9d4d 0%, transparent 46%),radial-gradient(120% 120% at 82% 14%, #4dc3ff 0%, transparent 44%),radial-gradient(130% 130% at 78% 88%, #ff5d8f 0%, transparent 50%),radial-gradient(140% 140% at 22% 86%, #7a5cff 0%, transparent 52%),linear-gradient(135deg, #b24bd8, #f0793b)",Es=({bg:t})=>n.jsx("div",{"aria-hidden":!0,style:{position:"absolute",inset:0,background:t,backgroundSize:"cover",backgroundPosition:"center"}}),Ms=420,Ts=48,Ft=84,Ut=20,As=()=>{const t=r.useRef(null),[e,a]=r.useState({w:0,h:0});return r.useLayoutEffect(()=>{const i=t.current;if(!i)return;const s=()=>a({w:i.clientWidth,h:i.clientHeight});s();const u=new ResizeObserver(s);return u.observe(i),()=>u.disconnect()},[]),[t,e]},_s=({title:t="Priya Raman",time:e="now",body:a="Just landed — grabbing a cab. Save me a seat and order the usual?",avatar:i="PR",wallpaper:s=Ss,lens:u})=>{const[f,{w:h,h:l}]=As(),o=Math.round(Math.min(h-Ts,Ms)),k=h>0&&l>0&&o>0,X=Math.round((h-o)/2),m=Math.round((l-Ft)/2);return n.jsxs("div",{ref:f,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",fontFamily:xs,userSelect:"none"},children:[n.jsx(Es,{bg:s}),k&&n.jsxs(n.Fragment,{children:[n.jsx(mt,{optics:{...Rs,...u},brightnessInFilter:!0,width:o,height:Ft,radius:Ut,refract:n.jsx("div",{"aria-hidden":!0,style:{position:"absolute",left:-X,top:-m,width:h,height:l,background:s,backgroundSize:"cover",backgroundPosition:"center"}}),behind:"#c8569f",style:{position:"absolute",left:X,top:m,width:o,height:Ft,borderRadius:Ut}}),n.jsxs("div",{style:{position:"absolute",left:X,top:m,width:o,height:Ft,borderRadius:Ut,background:"linear-gradient(180deg, rgba(255,255,255,0.62) 0%, rgba(255,255,255,0.16) 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.95), inset 0 0 0 1px rgba(255,255,255,0.5), inset 0 0 24px rgba(255,255,255,0.55), 0 0 0 0.5px rgba(0,0,0,0.18), 0 14px 36px rgba(0,0,0,0.22), 0 2px 5px rgba(0,0,0,0.14)",display:"flex",alignItems:"center",gap:14,padding:"0 18px",boxSizing:"border-box",color:vs},children:[n.jsx("div",{"aria-hidden":!0,style:{flexShrink:0,width:40,height:40,borderRadius:"50%",display:"grid",placeItems:"center",background:"linear-gradient(160deg, #2e9bff 0%, #0a6cff 100%)",color:"#fff",fontSize:14,fontWeight:600,letterSpacing:.3,boxShadow:"inset 0 1px 1px rgba(255,255,255,0.4)"},children:i}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[n.jsx("span",{style:{fontSize:14.5,fontWeight:600},children:t}),n.jsx("span",{style:{marginLeft:"auto",fontSize:12,color:ws,whiteSpace:"nowrap"},children:e})]}),n.jsx("div",{style:{marginTop:3,fontSize:13.5,lineHeight:1.35,color:ys,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:a})]})]})]})]})},ks="0.3.0";exports.Glass=mt;exports.GlassButton=ts;exports.GlassCard=rs;exports.GlassNotification=_s;exports.GlassSegmentedControl=ss;exports.GlassSlider=bs;exports.GlassSwitch=fs;exports.LiquidGlass=mt;exports.VERSION=ks;
87
+ }`,rr=(t,e,o)=>{const n=t.createShader(e);if(t.shaderSource(n,o),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){const s=t.getShaderInfoLog(n);throw t.deleteShader(n),new Error(`glass-webgl shader: ${s}`)}return n},Gt=(t,e,o)=>{const n=t.createProgram(),s=rr(t,t.VERTEX_SHADER,e),u=rr(t,t.FRAGMENT_SHADER,o);if(t.attachShader(n,s),t.attachShader(n,u),t.bindAttribLocation(n,0,"a_pos"),t.linkProgram(n),t.deleteShader(s),t.deleteShader(u),!t.getProgramParameter(n,t.LINK_STATUS)){const f=t.getProgramInfoLog(n);throw t.deleteProgram(n),new Error(`glass-webgl link: ${f}`)}return n},Gr=class{constructor(t){this.dispCache=new Map,this.blurW=0,this.blurH=0,this.srcW=0,this.srcH=0,this.disposed=!1;const e=t.getContext("webgl2",{premultipliedAlpha:!1,alpha:!0,antialias:!1,preserveDrawingBuffer:!1});if(!e)throw new Error("webgl2 unavailable");this.gl=e,this.blit=Gt(e,Wt,Ir),this.lens=Gt(e,Wt,Wr),this.blur=Gt(e,Wt,Xr),this.quad=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.quad),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),e.STATIC_DRAW);const o=()=>{const n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),n};this.srcTex=o(),this.dispTex=o(),this.blurTex=[o(),o()],this.fbo=[e.createFramebuffer(),e.createFramebuffer()],e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),this.uBlitSrc=e.getUniformLocation(this.blit,"u_src"),this.uBlur={src:e.getUniformLocation(this.blur,"u_src"),step:e.getUniformLocation(this.blur,"u_step")},this.uLens={src:e.getUniformLocation(this.lens,"u_src"),blur:e.getUniformLocation(this.lens,"u_blur"),disp:e.getUniformLocation(this.lens,"u_disp"),origin:e.getUniformLocation(this.lens,"u_origin"),size:e.getUniformLocation(this.lens,"u_size"),scale:e.getUniformLocation(this.lens,"u_scale"),lenspx:e.getUniformLocation(this.lens,"u_lenspx"),radiuspx:e.getUniformLocation(this.lens,"u_radiuspx"),dispersion:e.getUniformLocation(this.lens,"u_dispersion"),specular:e.getUniformLocation(this.lens,"u_sheen"),frost:e.getUniformLocation(this.lens,"u_frost"),opacity:e.getUniformLocation(this.lens,"u_opacity"),brightness:e.getUniformLocation(this.lens,"u_brightness")}}ensureBlurTargets(t,e){if(t===this.blurW&&e===this.blurH)return;const o=this.gl;for(let n=0;n<2;n+=1)o.bindTexture(o.TEXTURE_2D,this.blurTex[n]),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,t,e,0,o.RGBA,o.UNSIGNED_BYTE,null),o.bindFramebuffer(o.FRAMEBUFFER,this.fbo[n]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,this.blurTex[n],0);o.bindFramebuffer(o.FRAMEBUFFER,null),this.blurW=t,this.blurH=e}renderFrost(t){const e=this.gl;this.ensureBlurTargets(this.srcW,this.srcH),e.useProgram(this.blur),e.viewport(0,0,this.srcW,this.srcH),e.activeTexture(e.TEXTURE0),e.uniform1i(this.uBlur.src,0),e.bindFramebuffer(e.FRAMEBUFFER,this.fbo[0]),e.bindTexture(e.TEXTURE_2D,this.srcTex),e.uniform2f(this.uBlur.step,t/this.srcW,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.bindFramebuffer(e.FRAMEBUFFER,this.fbo[1]),e.bindTexture(e.TEXTURE_2D,this.blurTex[0]),e.uniform2f(this.uBlur.step,0,t/this.srcH),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.bindFramebuffer(e.FRAMEBUFFER,null)}setDisplacementMap(t){if(this.disposed)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,this.dispTex),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t)}dispTexFor(t){const e=this.gl;let o=this.dispCache.get(t);return o||(o=e.createTexture(),e.bindTexture(e.TEXTURE_2D,o),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),this.dispCache.set(t,o)),o}releaseDispMap(t){const e=this.dispCache.get(t);e&&(this.gl.deleteTexture(e),this.dispCache.delete(t))}resize(t,e){const o=this.gl.canvas;(o.width!==t||o.height!==e)&&(o.width=t,o.height=e)}uploadSource(t,e,o){const n=this.gl;n.bindTexture(n.TEXTURE_2D,this.srcTex),e!==this.srcW||o!==this.srcH?(n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),this.srcW=e,this.srcH=o):n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,t)}render(t,e,o,n){if(this.disposed||e===0||o===0)return;const s=this.gl;this.uploadSource(t,e,o),s.bindBuffer(s.ARRAY_BUFFER,this.quad),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,0,0),s.disable(s.BLEND);const u=n.reduce((l,a)=>Math.max(l,a.blur),0);u>0&&this.renderFrost(u);const f=s.canvas.width,h=s.canvas.height;s.viewport(0,0,f,h),s.useProgram(this.blit),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this.srcTex),s.uniform1i(this.uBlitSrc,0),s.drawArrays(s.TRIANGLE_STRIP,0,4),s.useProgram(this.lens),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this.srcTex),s.uniform1i(this.uLens.src,0),s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,this.dispTex),s.uniform1i(this.uLens.disp,1),s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,this.blurTex[1]),s.uniform1i(this.uLens.blur,2);for(const l of n){const a=l.opacity??1;a<=0||(s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,l.dispMap?this.dispTexFor(l.dispMap):this.dispTex),s.uniform2f(this.uLens.origin,l.originX,l.originY),s.uniform2f(this.uLens.size,l.sizeX,l.sizeY),s.uniform2f(this.uLens.scale,l.scaleX,l.scaleY),s.uniform2f(this.uLens.lenspx,l.sizeX*f,l.sizeY*h),s.uniform1f(this.uLens.radiuspx,(l.cornerRadius??0)*f),s.uniform1f(this.uLens.dispersion,l.dispersion),s.uniform1f(this.uLens.specular,l.specular),s.uniform1f(this.uLens.frost,l.blur>0?Math.min(1,l.blur/8):0),s.uniform1f(this.uLens.opacity,a),s.uniform1f(this.uLens.brightness,l.brightness??0),s.drawArrays(s.TRIANGLE_STRIP,0,4))}}dispose(){if(this.disposed)return;this.disposed=!0;const t=this.gl;t.deleteProgram(this.blit),t.deleteProgram(this.lens),t.deleteProgram(this.blur),t.deleteTexture(this.srcTex),t.deleteTexture(this.dispTex),this.dispCache.forEach(o=>t.deleteTexture(o)),this.dispCache.clear(),t.deleteTexture(this.blurTex[0]),t.deleteTexture(this.blurTex[1]),t.deleteFramebuffer(this.fbo[0]),t.deleteFramebuffer(this.fbo[1]),t.deleteBuffer(this.quad);const e=t.getExtension("WEBGL_lose_context");e==null||e.loseContext()}},Br=()=>typeof window<"u"&&window.devicePixelRatio||1,Pr=t=>({merged:{...Ot,...t.lens},lensW:t.lensW,lensH:t.lensH,radius:t.borderRadius,x:t.x,y:t.y,scale:t.scale??1,opacity:t.opacity??1}),Ur=(t,e,o,n,s,u)=>{const[f,h]=r.useState(!1),l=r.useRef(null),a=r.useRef(null),k=n[0],I=r.useRef(n);I.current=n;const m=n.some(S=>xe(S.x)||xe(S.y)||xe(S.lensW)||xe(S.lensH)||S.radius!=null&&xe(S.radius));r.useLayoutEffect(()=>{const S=t.current,M=e.current;if(!S||!M)return;let w;try{w=new Gr(S)}catch(_){typeof console<"u"&&console.warn("[liquid-glass] WebGL renderer unavailable, falling back:",_),h(!0);return}l.current=w;const D=Math.min(Br(),s),C=()=>{const _=M.clientWidth,X=M.clientHeight;S.style.width=`${_}px`,S.style.height=`${X}px`,w.resize(Math.round(_*D),Math.round(X*D))};C();const O=new ResizeObserver(C);return O.observe(M),()=>{O.disconnect(),w.dispose(),l.current=null}},[t,e,s]);const d=k.merged,y=We(k.lensW),G=We(k.lensH),N=k.radius!=null?We(k.radius):Math.min(y,G),F=JSON.stringify([d.mapSize,y,G,N,d.depth,d.clipToShape,d.softEdge,d.curvature,d.splay,d.glow,d.glowSpread,d.glowFalloff,d.sheen,d.sheenWidth,d.sheenFalloff,d.sheenAngle,d.bend,d.bendWidth]);r.useEffect(()=>{if(!l.current)return;a.current||(a.current=$t(d.mapSize));const M=a.current.generate({lensHalfWidth:y,lensHalfHeight:G,borderRadius:N,depth:d.depth,clipToShape:d.clipToShape,softEdge:d.softEdge,sheenAngle:d.sheenAngle,glow:d.glow,glowSpread:d.glowSpread,glowFalloff:d.glowFalloff,sheen:d.sheen,sheenWidth:d.sheenWidth,sheenFalloff:d.sheenFalloff,curvature:d.curvature,splay:d.splay,bend:d.bend,bendWidth:d.bendWidth});let w=!1;const D=new Image;return D.onload=()=>{var C;w||(C=l.current)==null||C.setDisplacementMap(D)},D.src=M,()=>{w=!0}},[F,f]);const z=S=>{const M=S.merged,w=We(S.lensW),D=We(S.lensH),C=S.radius!=null?We(S.radius):Math.min(w,D);return JSON.stringify([M.mapSize,w,D,C,M.depth,M.clipToShape,M.softEdge,M.curvature,M.splay,M.glow,M.glowSpread,M.glowFalloff,M.sheen,M.sheenWidth,M.sheenFalloff,M.sheenAngle,M.bend,M.bendWidth])},$=n.map(z),v=r.useRef($);v.current=$;const q=r.useRef(new Map),U=$.join("|");return r.useEffect(()=>{const S=a.current;if(!S)return;const M=new Set(v.current);q.current.forEach((O,_)=>{var X;M.has(_)||(q.current.delete(_),(X=l.current)==null||X.releaseDispMap(O))});const w=v.current[0],D=[],C=new Set;return n.forEach((O,_)=>{const X=v.current[_];if(X===w||C.has(X)||q.current.has(X))return;C.add(X);const W=O.merged,c=We(O.lensW),K=We(O.lensH),J=O.radius!=null?We(O.radius):Math.min(c,K),E=S.generate({lensHalfWidth:c,lensHalfHeight:K,borderRadius:J,depth:W.depth,clipToShape:W.clipToShape,softEdge:W.softEdge,sheenAngle:W.sheenAngle,glow:W.glow,glowSpread:W.glowSpread,glowFalloff:W.glowFalloff,sheen:W.sheen,sheenWidth:W.sheenWidth,sheenFalloff:W.sheenFalloff,curvature:W.curvature,splay:W.splay,bend:W.bend,bendWidth:W.bendWidth});let T=!1;const Y=new Image;Y.onload=()=>{T||q.current.set(X,Y)},Y.src=E,D.push(()=>{T=!0})}),()=>D.forEach(O=>O())},[U,f]),r.useEffect(()=>()=>{var S;(S=a.current)==null||S.dispose(),a.current=null},[]),r.useEffect(()=>{if(f)return;let S=0,M=0;const w=u,D=!!w&&!m&&typeof w.requestVideoFrameCallback=="function",C=()=>{const O=l.current,_=e.current;if(!O||!_)return;const X=o();if(X&&X.w>0&&X.h>0){const W=_.clientWidth,c=_.clientHeight,K=Math.sqrt((W*W+c*c)/2),J=v.current,E=I.current.map((T,Y)=>{const te=We(T.lensW),ce=We(T.lensH),re=T.radius!=null?We(T.radius):Math.min(te,ce),ee=We(T.x),he=We(T.y),pe=te*T.scale,Re=ce*T.scale,j=Y>0&&J[Y]!==J[0],V=j?q.current.get(J[Y]):void 0,g=j&&!V;return{originX:(ee*W-pe)/W,originY:1-(he*c+Re)/c,sizeX:2*pe/W,sizeY:2*Re/c,scaleX:g?0:(T.merged.scaleX??T.merged.strength)*K/W,scaleY:g?0:(T.merged.scaleY??T.merged.strength)*K/c,dispersion:T.merged.dispersion,specular:T.merged.specular,blur:T.merged.frost,cornerRadius:re*T.scale/W,opacity:T.opacity,brightness:T.merged.brightness,dispMap:V}});O.render(X.source,X.w,X.h,E)}D?M=w.requestVideoFrameCallback(C):S=requestAnimationFrame(C)};return D?M=w.requestVideoFrameCallback(C):S=requestAnimationFrame(C),()=>{var O;cancelAnimationFrame(S),D&&M&&((O=w.cancelVideoFrameCallback)==null||O.call(w,M))}},[f,o,e,u,m]),f},Or=({src:t,draw:e,poster:o,loop:n=!0,muted:s=!0,autoPlay:u=!0,crossOrigin:f,paused:h,videoRef:l,lenses:a,width:k,height:I,lens:m,lensW:d=90,lensH:y=90,borderRadius:G,x:N=.5,y:F=.5,maxDpr:z=1.5,className:$,style:v,children:q})=>{const U=t!=null,S=r.useRef(null),M=r.useRef(null),w=r.useRef(null),[D,C]=r.useState(null),O=r.useCallback(E=>{w.current=E,typeof l=="function"?l(E):l&&(l.current=E)},[l]),_=r.useRef(null),X=r.useRef(e);X.current=e;const W=r.useRef(0);!U&&!_.current&&typeof document<"u"&&(_.current=document.createElement("canvas"));const c=(a&&a.length?a.map(E=>({lens:E.optics?{...m,...E.optics}:m,lensW:E.w/2,lensH:E.h/2,borderRadius:E.radius,x:E.x,y:E.y,scale:E.scale,opacity:E.opacity})):[{lens:m,lensW:d,lensH:y,borderRadius:G,x:N,y:F}]).map(Pr);r.useEffect(()=>{U&&C(w.current)},[U]),r.useEffect(()=>{const E=w.current;!U||!E||h===void 0||(h?E.pause():E.play().catch(()=>{}))},[U,h]);const K=r.useCallback(()=>{if(U){const re=w.current;return!re||re.readyState<2?null:{source:re,w:re.videoWidth,h:re.videoHeight}}const E=_.current,T=S.current;if(!E||!T||!X.current)return null;const Y=k??Math.round(T.clientWidth),te=I??Math.round(T.clientHeight);if(Y===0||te===0)return null;(E.width!==Y||E.height!==te)&&(E.width=Y,E.height=te);const ce=E.getContext("2d");return ce?(W.current===0&&(W.current=performance.now()),X.current(ce,performance.now()-W.current),{source:E,w:Y,h:te}):null},[U,k,I]),J=Ur(M,S,K,c,z,U?D:null);return i.jsxs("div",{ref:S,className:$,style:{position:"relative",overflow:"hidden",...v},children:[U&&i.jsx("video",{ref:O,src:t,poster:o,loop:n,muted:s,autoPlay:u,playsInline:!0,crossOrigin:f,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",visibility:J?"visible":"hidden"}}),i.jsx("canvas",{ref:M,style:{position:"absolute",inset:0,pointerEvents:"none",display:J?"none":"block"}}),!U&&J&&i.jsx("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center",color:"#888",font:"13px system-ui"},children:"WebGL unavailable"}),q!=null&&i.jsx("div",{style:{position:"absolute",inset:0},children:q})]})},Nr=()=>{const[t,e]=r.useState(!1);return r.useEffect(()=>{if(typeof navigator>"u")return;const o=navigator.userAgent,s=navigator.userAgentData!=null||/\b(?:Chrome|Chromium|Edg)\//.test(o)&&!/\b(?:CriOS|EdgiOS|FxiOS|OPiOS)\b/.test(o)&&!/iPhone|iPad|iPod/.test(o);e(s)},[]),t},$r={strength:.05,depth:.5,curvature:.3,bend:.45,bendWidth:.16,dispersion:.32,frost:6,saturate:1.15,sheen:.32,sheenWidth:3,sheenFalloff:1.5,glow:.1,glowSpread:1,glowFalloff:.5,specular:1,sheenAngle:45,brightness:0},Hr=({dispScale:t,dispersion:e,specular:o,hasSpecular:n,mapMatrix:s,width:u,height:f,mapUrl:h,feImageRef:l})=>{const a=s?"scaledMap":"map";return i.jsxs(i.Fragment,{children:[i.jsx("feFlood",{floodColor:"rgb(128,128,128)",floodOpacity:"1",result:"mapBg"}),i.jsx("feImage",{ref:l,href:h||void 0,x:0,y:0,width:u,height:f,preserveAspectRatio:"none",result:"rawMap"}),i.jsx("feComposite",{in:"rawMap",in2:"mapBg",operator:"over",result:"map"}),s&&i.jsx("feColorMatrix",{in:"map",type:"matrix",values:s,result:"scaledMap"}),e>0?i.jsxs(i.Fragment,{children:[i.jsx("feDisplacementMap",{in:"SourceGraphic",in2:a,scale:t*(1+ot*e),xChannelSelector:"R",yChannelSelector:"G"}),i.jsx("feColorMatrix",{type:"matrix",values:"1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0",result:"refractR"}),i.jsx("feDisplacementMap",{in:"SourceGraphic",in2:a,scale:t*(1+ot*.5*e),xChannelSelector:"R",yChannelSelector:"G"}),i.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0",result:"refractG"}),i.jsx("feDisplacementMap",{in:"SourceGraphic",in2:a,scale:t,xChannelSelector:"R",yChannelSelector:"G"}),i.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0",result:"refractB"}),i.jsx("feComposite",{in:"refractR",in2:"refractG",operator:"arithmetic",k1:"0",k2:"1",k3:"1",k4:"0",result:"refractRG"}),i.jsx("feComposite",{in:"refractRG",in2:"refractB",operator:"arithmetic",k1:"0",k2:"1",k3:"1",k4:"0",result:"lensOut"})]}):i.jsx("feDisplacementMap",{in:"SourceGraphic",in2:a,scale:t,xChannelSelector:"R",yChannelSelector:"G",result:"lensOut"}),n&&i.jsxs(i.Fragment,{children:[i.jsx("feColorMatrix",{in:"map",type:"matrix",values:`0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 ${-128/255}`,result:"sheenMask"}),i.jsx("feComposite",{in:"sheenMask",in2:"lensOut",operator:"arithmetic",k1:"0",k2:o,k3:"1",k4:"0"})]})]})},Bt=t=>t==null?void 0:xe(t)?We(t):t,zr=({children:t,optics:e,radius:o,width:n,height:s,className:u,style:f,...h})=>{const l=Nr(),a=r.useMemo(()=>({...Ot,...$r,...e}),[e]),k=r.useId().replace(/:/g,""),I=r.useRef(null),m=r.useRef(null),d=r.useRef(null),y=r.useRef(null),G=r.useRef(""),N=r.useRef(0),[F,z]=r.useState({w:0,h:0,r:0,appliedR:void 0}),[$,v]=r.useState(!1),q=F.w>0&&F.h>0,U=Bt(o),S=Bt(n),M=Bt(s),w=(f==null?void 0:f.borderRadius)!=null,D=r.useRef(!1);r.useLayoutEffect(()=>{D.current=!1},[U,w,u]),r.useLayoutEffect(()=>{const j=I.current;if(!j)return;const V=()=>{const Q=j.getBoundingClientRect(),se=typeof getComputedStyle<"u",A=se?getComputedStyle(j):null,Le=A&&parseFloat(A.borderTopLeftRadius)||0;if(A){const Z=A.position;v(ve=>Z==="static"?!0:Z==="relative"?ve:!1)}let me,B;if(U!=null)me=U,B=U;else if(w||Le>0&&!D.current)me=Le,B=void 0;else{let Z=j.firstElementChild;for(;Z&&Z.hasAttribute("data-lg-layer");)Z=Z.nextElementSibling;const ve=Z&&se&&parseFloat(getComputedStyle(Z).borderTopLeftRadius)||0;me=ve,B=ve,D.current=!0}z(Z=>Z.w===Q.width&&Z.h===Q.height&&Z.r===me&&Z.appliedR===B?Z:{w:Q.width,h:Q.height,r:me,appliedR:B})};V();const g=new ResizeObserver(V);return g.observe(j),window.addEventListener("resize",V),()=>{g.disconnect(),window.removeEventListener("resize",V)}},[U,w,u]);const C=JSON.stringify([F.w,F.h,F.r,a.mapSize,a.clipToShape,a.softEdge,a.depth,a.curvature,a.splay,a.bend,a.bendWidth,a.sheen,a.sheenWidth,a.sheenFalloff,a.sheenAngle,a.glow,a.glowSpread,a.glowFalloff]),O=a.scaleX??a.strength,_=a.scaleY??a.strength,X=Math.max(O,_),W=q?Math.sqrt((F.w*F.w+F.h*F.h)/2):0,c=X*W,K=q?Math.ceil(c*(a.dispersion>0?1.2:1)*.5+28):0,J=X>0?O/X:1,E=X>0?_/X:1,T=J===1&&E===1?null:Nt(J,E),Y=a.glow>0||a.sheen>0;r.useLayoutEffect(()=>{var g,Q;if(!q)return;const j=a.mapSize;(!y.current||y.current.size!==j)&&((g=y.current)==null||g.gen.dispose(),y.current={gen:$t(j),size:j});const V=y.current.gen.generate({lensHalfWidth:F.w/2,lensHalfHeight:F.h/2,borderRadius:F.r,depth:a.depth,clipToShape:a.clipToShape,softEdge:a.softEdge,sheenAngle:a.sheenAngle,glow:a.glow,glowSpread:a.glowSpread,glowFalloff:a.glowFalloff,sheen:a.sheen,sheenWidth:a.sheenWidth,sheenFalloff:a.sheenFalloff,curvature:a.curvature,splay:a.splay,bend:a.bend,bendWidth:a.bendWidth});G.current=V,(Q=d.current)==null||Q.setAttribute("href",V),te()},[q,C]);const te=r.useMemo(()=>()=>{const j=I.current,V=m.current;if(!j)return;const g=Math.max(0,a.frost),Q=a.saturate??1,se=[g>0?`blur(${g}px)`:"",Q!==1?`saturate(${Q})`:""].filter(Boolean).join(" ");let A=se||"none";l&&V&&G.current&&(N.current+=1,V.id=`lg-mat-${k}-v${N.current}`,A=`${se?se+" ":""}url(#${V.id})`),j.style.backdropFilter=A,j.style.setProperty("-webkit-backdrop-filter",A)},[a.frost,a.saturate,l,k]);r.useEffect(()=>{q&&te()},[q,te,a.dispersion,a.strength,a.scaleX,a.scaleY,a.specular]),r.useEffect(()=>()=>{var j;(j=y.current)==null||j.gen.dispose(),y.current=null},[]);const ce=r.useRef(!1);r.useEffect(()=>{if(ce.current||!q||typeof getComputedStyle>"u"||typeof document>"u")return;const j=I.current;if(!j)return;const V=getComputedStyle(j).backgroundColor;let g=!1;try{const Q=document.createElement("canvas");Q.width=Q.height=1;const se=Q.getContext("2d");se&&(se.clearRect(0,0,1,1),se.fillStyle=V,se.fillRect(0,0,1,1),g=se.getImageData(0,0,1,1).data[3]===255)}catch{g=!1}g&&typeof console<"u"&&(console.warn("[liquid-glass] <Glass>: the wrapper's background is fully opaque, so it hides the refraction (no glass shows through). Give it an alpha (e.g. `bg-red-400/40` / `rgba(...,0.4)`). (An opaque `background-image` — a solid gradient or photo — hides it the same way.)"),ce.current=!0)},[q]);const re=r.useMemo(()=>{const j=Math.max(0,Math.min(1.5,a.specular));return[`inset 0 1px 0 rgba(255,255,255,${(.55*j).toFixed(3)})`,`inset 0 0 0 1px rgba(255,255,255,${(.12*j).toFixed(3)})`].join(", ")},[a.specular]),ee=f==null?void 0:f.position,pe=ee!=null&&ee!=="static"&&ee!=="unset"&&ee!=="initial"?ee:$?"relative":void 0,Re=a.brightness!==0?i.jsx("div",{"aria-hidden":!0,"data-lg-layer":"",style:{position:"absolute",inset:0,pointerEvents:"none",borderRadius:"inherit",background:a.brightness>0?"#fff":"#000",opacity:Math.min(1,Math.abs(a.brightness))}}):null;return i.jsxs("div",{ref:I,"data-liquid-glass":"material",className:u,style:{display:"inline-block",...f,...pe!=null?{position:pe}:null,...S!=null?{width:S}:null,...M!=null?{height:M}:null,...F.appliedR!=null?{borderRadius:F.appliedR}:null},...h,children:[Re,t,i.jsx("div",{"aria-hidden":!0,"data-lg-layer":"",style:{position:"absolute",inset:0,pointerEvents:"none",borderRadius:"inherit",boxShadow:re}}),i.jsx("svg",{"aria-hidden":!0,"data-lg-layer":"",width:0,height:0,style:{position:"absolute",width:0,height:0},children:i.jsx("defs",{children:i.jsx("filter",{ref:m,id:`lg-mat-${k}-v0`,filterUnits:"userSpaceOnUse",primitiveUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",x:-K,y:-K,width:F.w+2*K,height:F.h+2*K,children:q&&i.jsx(Hr,{dispScale:c,dispersion:a.dispersion,specular:a.specular,hasSpecular:Y,mapMatrix:T,width:F.w,height:F.h,mapUrl:G.current||"",feImageRef:d})})})})]})},Yr=()=>{const[t,e]=r.useState(!1);return r.useEffect(()=>{e(typeof navigator<"u"&&/^((?!chrome|chromium|android).)*safari/i.test(navigator.userAgent))},[]),t},qr=({lens:t,mapHref:e,feImageRef:o,mapMatrixRef:n,blurStdDeviation:s,specularFromRawMap:u,brightnessInFilter:f,filterW:h,filterH:l,clipShapeRef:a})=>{const k=t.scaleX??t.strength,I=t.scaleY??t.strength,m=Math.max(k,I),d=h&&l?Math.sqrt((h*h+l*l)/2):1,y=m*d,G=m>0?k/m:0,N=m>0?I/m:0,F=!(G===1&&N===1),z=F?"scaledMap":"map",$=t.frost>0&&!!s,v=$?"blurred":"SourceGraphic",q=t.glow>0||t.sheen>0,U=t.specular,S=f&&t.brightness!==0,M=$||S;return i.jsxs(i.Fragment,{children:[i.jsx("feFlood",{floodColor:"rgb(128,128,128)",floodOpacity:"1",result:"mapBg"}),i.jsx("feImage",{ref:o,"data-lens":"",href:e,preserveAspectRatio:"none",result:"rawMap"}),i.jsx("feComposite",{in:"rawMap",in2:"mapBg",operator:"over",result:"map"}),F&&i.jsx("feColorMatrix",{ref:n,in:"map",type:"matrix",values:Nt(G,N),result:"scaledMap"}),$&&i.jsx("feGaussianBlur",{in:"SourceGraphic",stdDeviation:s,result:"blurred"}),M&&i.jsx("feImage",{ref:a,"data-lens":"",href:lr,preserveAspectRatio:"none",result:"lensShape"}),t.dispersion>0?i.jsxs(i.Fragment,{children:[i.jsx("feDisplacementMap",{"data-lens":"",in:v,in2:z,scale:y*(1+ot*.5*t.dispersion),xChannelSelector:"R",yChannelSelector:"G"}),i.jsx("feColorMatrix",{type:"matrix",values:"1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0",result:"refractR"}),i.jsx("feDisplacementMap",{"data-lens":"",in:v,in2:z,scale:y,xChannelSelector:"R",yChannelSelector:"G"}),i.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0",result:"refractG"}),i.jsx("feDisplacementMap",{"data-lens":"",in:v,in2:z,scale:y*(1-ot*.5*t.dispersion),xChannelSelector:"R",yChannelSelector:"G"}),i.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0",result:"refractB"}),i.jsx("feComposite",{in:"refractR",in2:"refractG",operator:"arithmetic",k1:"0",k2:"1",k3:"1",k4:"0",result:"refractRG"}),i.jsx("feComposite",{in:"refractRG",in2:"refractB",operator:"arithmetic",k1:"0",k2:"1",k3:"1",k4:"0",result:"lensOut"})]}):i.jsx("feDisplacementMap",{"data-lens":"",in:v,in2:z,scale:y,xChannelSelector:"R",yChannelSelector:"G",result:"lensOut"}),q&&(t.sheenDark?i.jsxs(i.Fragment,{children:[i.jsx("feColorMatrix",{in:u?"rawMap":"map",type:"matrix",values:`0 0 ${-U} 0 ${1+128*U/255} 0 0 ${-U} 0 ${1+128*U/255} 0 0 ${-U} 0 ${1+128*U/255} 0 0 0 0 1`,result:"sheenMask"}),i.jsx("feComposite",{in:"sheenMask",in2:"lensOut",operator:"arithmetic",k1:"1",k2:"0",k3:"0",k4:"0",result:"lensOut"})]}):i.jsxs(i.Fragment,{children:[i.jsx("feColorMatrix",{in:u?"rawMap":"map",type:"matrix",values:`0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 ${-128/255}`,result:"sheenMask"}),i.jsx("feComposite",{in:"sheenMask",in2:"lensOut",operator:"arithmetic",k1:"0",k2:U,k3:"1",k4:"0",result:"lensOut"})]})),S&&i.jsxs(i.Fragment,{children:[i.jsx("feFlood",{"data-lens":"",floodColor:t.brightness>0?"white":"black",floodOpacity:Math.abs(t.brightness),result:"brightnessFlood"}),i.jsx("feComposite",{in:"brightnessFlood",in2:"lensShape",operator:"in",result:"brightnessVeil"}),i.jsx("feComposite",{in:"brightnessVeil",in2:"lensOut",operator:"over",result:"lensOut"})]}),M?i.jsxs(i.Fragment,{children:[i.jsx("feComposite",{in:"lensOut",in2:"lensShape",operator:"in",result:"lensOut"}),i.jsx("feComposite",{in:"SourceGraphic",in2:"lensShape",operator:"out",result:"cutoutSrc"}),i.jsx("feComposite",{in:"lensOut",in2:"cutoutSrc",operator:"over"})]}):i.jsxs(i.Fragment,{children:[i.jsx("feFlood",{"data-lens":"",floodColor:"black",floodOpacity:"1",result:"lensMask"}),i.jsx("feComposite",{in:"SourceGraphic",in2:"lensMask",operator:"out",result:"cutoutSrc"}),i.jsx("feComposite",{in:"lensOut",in2:"cutoutSrc",operator:"over"})]})]})},Kr=({children:t,lens:e,x:o=.5,y:n=.5,lensW:s,lensH:u,borderRadius:f,refractionTarget:h,refractionBackground:l="transparent",overlay:a,tintColor:k,tintOpacity:I,tintBlur:m,shadowOpacity:d,restShadowOpacity:y,edgeBias:G,depth:N,scale:F,filterResolution:z=1,brightnessInFilter:$=!1,pixelUnits:v=!1,live:q=!1,onLensMapChange:U,className:S,style:M,...w})=>{const D=Yr(),C=r.useRef(D);C.current=D;const O=r.useRef($);O.current=$;const _=r.useRef(v);_.current=v;const X=r.useRef(q);X.current=q;const W=r.useRef(z);W.current=z;const c=r.useMemo(()=>({...Ot,...e}),[e]),K=r.useRef(c);K.current=c;const J=r.useId().replace(/:/g,""),E=r.useRef(null),T=r.useRef(null),Y=r.useRef(null),te=r.useRef(null),ce=r.useRef(null),re=r.useRef(null),ee=r.useRef(null),he=r.useRef(null),pe=r.useRef(null),Re=r.useRef(null),j=r.useRef(null),V=r.useRef(null),g=r.useRef(null),Q=r.useRef([]),se=r.useRef([]),[A,Le]=r.useState({w:0,h:0}),me=r.useRef(A);me.current=A;const B=A.w>0&&A.h>0,Z=h!=null,[ve,Ue]=r.useState(null);r.useLayoutEffect(()=>{var L,ne;if(!Z||l!=="transparent"){Ue(null);return}if(typeof window>"u")return;let P=((L=E.current)==null?void 0:L.parentElement)??null,p=null;for(;P;){const Ye=getComputedStyle(P).backgroundColor,ye=(ne=Ye.match(/rgba?\(([^)]+)\)/))==null?void 0:ne[1].split(",");if((ye&&ye[3]!=null?parseFloat(ye[3]):1)>.95){p=Ye;break}P=P.parentElement}Ue(p)},[Z,l]);const He=l!=="transparent"?l:ve??"transparent",le=r.useRef(.5),ue=r.useRef(.5),Me=r.useRef(c.lensW),Xe=r.useRef(c.lensH),b=r.useRef(c.borderRadius),Te=r.useRef(s!==void 0);Te.current=s!==void 0;const Ce=r.useRef(u!==void 0);Ce.current=u!==void 0;const Oe=r.useRef(f!==void 0);Oe.current=f!==void 0;const Ae=r.useRef(0),Ze=r.useRef(c.depth),Ge=r.useRef(c.scaleX??c.strength),Ve=r.useRef(c.scaleY??c.strength),Pe=r.useRef(1),we=r.useRef(0),x=r.useRef(1),fe=r.useRef(0),de=r.useRef(.5),be=r.useRef(NaN),ze=r.useRef(NaN),R=r.useRef(NaN),H=r.useRef(1),ie=r.useRef(0),je=r.useRef(""),De=r.useRef(!1),_e=r.useRef(null),ke=r.useRef(null),Ne=r.useRef(null),ct=r.useRef(k);ct.current=k;const Be=r.useRef(U);Be.current=U;const ht=A.w>0&&A.h>0?Math.sqrt((A.w*A.w+A.h*A.h)/2):0;let Je=Math.max(c.scaleX??c.strength,c.scaleY??c.strength);if(ht>0){const P=typeof s=="number"?s*2:A.w,p=typeof u=="number"?u*2:A.h,L=1+ot*c.dispersion;Je=Math.min(Je,Math.max(P,p)*.6/(ht*L))}const rt=v&&h!=null&&A.w>0&&A.h>0?Math.ceil(Je*ht*(1+ot*c.dispersion)*.5+c.depth+28)+16:0,oe=r.useRef(rt);oe.current=rt,r.useLayoutEffect(()=>{const P=E.current;if(!P)return;const p=()=>{var Ye;const ne=P.getBoundingClientRect();if(!Oe.current&&typeof getComputedStyle<"u"){let ye=parseFloat(getComputedStyle(P).borderTopLeftRadius)||0;const Se=(Ye=T.current)==null?void 0:Ye.firstElementChild;!ye&&Se&&(ye=parseFloat(getComputedStyle(Se).borderTopLeftRadius)||0),Ae.current=ye}Le(ye=>ye.w===ne.width&&ye.h===ne.height?ye:{w:ne.width,h:ne.height})};p();const L=new ResizeObserver(p);return L.observe(P),window.addEventListener("resize",p),()=>{L.disconnect(),window.removeEventListener("resize",p)}},[]);const Fe=r.useCallback(()=>{const P=E.current;if(!P)return;let p=me.current.w,L=me.current.h;if(!(p>0&&L>0)){const ae=P.getBoundingClientRect();p=ae.width,L=ae.height}if(!(p>0&&L>0))return;const ne=K.current,Ye=Ge.current,ye=Ve.current;let Se=Math.max(Ye,ye);const pt=ne.dispersion,bt=Te.current?Me.current:p/2,xt=Ce.current?Xe.current:L/2,ut=Oe.current?b.current:Ae.current;let Dt=le.current*p,It=ue.current*L;_.current&&Y.current&&(Dt=Math.max(bt,Math.min(p-bt,Dt)),It=Math.max(xt,Math.min(L-xt,It)));const qe=Dt-bt,Ke=It-xt,nt=2*bt,it=2*xt;if(_.current){const ae=Math.sqrt((p*p+L*L)/2),Ee=1+ot*pt,Rt=Math.max(nt,it)*.6;ae>0&&(Se=Math.min(Se,Rt/(ae*Ee)))}const Kt=W.current,Qe=Kt!==1&&!C.current?Kt:1,ft=C.current?Qe*H.current:Qe,vr=qe!==be.current||Ke!==ze.current,Vt=Se!==R.current;if(be.current=qe,ze.current=Ke,R.current=Se,vr||Vt||X.current){const ae=de.current,Ee=_.current,Rt=Math.sqrt((p*p+L*L)/2),wr=Se*Rt*(1+ot*pt)*.5,Jt=Math.ceil(wr+Ze.current+28),gt=Ee&&Y.current?oe.current:0,yr=String(Ee?(qe+gt+ae)*ft:(qe+ae)/p),Sr=String(Ee?(Ke+gt+ae)*ft:(Ke+ae)/L),Er=String(Ee?Math.max(0,nt-2*ae)*ft:Math.max(0,nt-2*ae)/p),Mr=String(Ee?Math.max(0,it-2*ae)*ft:Math.max(0,it-2*ae)/L);for(const $e of Q.current)$e.setAttribute("x",yr),$e.setAttribute("y",Sr),$e.setAttribute("width",Er),$e.setAttribute("height",Mr);if(Vt){const $e=Ee?Se*Rt*ft:Se,Tr=pt>0?[$e*(1+ot*.5*pt),$e,$e*(1-ot*.5*pt)]:[$e],Qt=se.current;for(let Tt=0;Tt<Qt.length;Tt+=1)Qt[Tt].setAttribute("scale",String(Tr[Tt]??0))}const dt=Re.current;if(dt){Ee&&(dt.setAttribute("x","0"),dt.setAttribute("y","0"),Y.current?(dt.setAttribute("width",String((qe+gt+nt+Jt)*ft)),dt.setAttribute("height",String((Ke+gt+it+Jt)*ft))):(dt.setAttribute("width",String(p*ft)),dt.setAttribute("height",String(L*ft)))),ie.current+=1,dt.id=`lg-${J}-v${ie.current}`;const $e=_e.current?`url(#${dt.id})`:"";Y.current?(Y.current.style.filter!==$e&&(Y.current.style.filter=$e),Y.current.style.clipPath=`inset(${Math.max(0,Ke+gt)*Qe}px ${Math.max(0,p+gt-(qe+nt))*Qe}px ${Math.max(0,L+gt-(Ke+it))*Qe}px ${Math.max(0,qe+gt)*Qe}px round ${ut*Qe}px)`,T.current&&!te.current&&(T.current.style.filter="")):T.current&&T.current.style.filter!==$e&&(T.current.style.filter=$e)}}te.current&&(te.current.style.clipPath=`inset(${Math.max(0,Ke)*Qe}px ${Math.max(0,p-(qe+nt))*Qe}px ${Math.max(0,L-(Ke+it))*Qe}px ${Math.max(0,qe)*Qe}px round ${ut*Qe}px)`),ce.current&&!te.current&&(ce.current.style.clipPath=`inset(${Math.max(0,Ke)}px ${Math.max(0,p-(qe+nt))}px ${Math.max(0,L-(Ke+it))}px ${Math.max(0,qe)}px round ${ut}px)`);const Xt=(ae,Ee)=>{ae.style.transform=`translate(${qe}px, ${Ke}px)`,ae.style.width=`${nt}px`,ae.style.height=`${it}px`,ae.style.borderRadius=`${ut}px`,Ee!==void 0&&(ae.style.opacity=String(Ee))};if(he.current&&Xt(he.current,x.current),pe.current&&Xt(pe.current,fe.current),ee.current){ee.current.style.transform=`translate3d(${qe}px, ${Ke}px, 0)`,ee.current.style.width=`${nt}px`,ee.current.style.height=`${it}px`,ee.current.style.borderRadius=`${ut}px`;const{uri:ae,key:Ee}=ur(nt,it,ut);if(je.current!==Ee){const Rt=`url("${ae}")`;ee.current.style.maskImage=Rt,ee.current.style.setProperty("-webkit-mask-image",Rt),ee.current.style.maskSize="100% 100%",ee.current.style.setProperty("-webkit-mask-size","100% 100%"),je.current=Ee}}if(re.current){Xt(re.current);const ae=ct.current??"white";re.current.style.background=`color-mix(in srgb, ${ae} ${100*Pe.current}%, transparent)`,re.current.style.opacity="1";const Ee=we.current>0?`blur(${we.current}px)`:"none";re.current.style.backdropFilter=Ee,re.current.style.setProperty("-webkit-backdrop-filter",Ee)}if(g.current){const ae=Se>0?Ye/Se:0,Ee=Se>0?ye/Se:0;g.current.setAttribute("values",Nt(ae,Ee))}},[J]),et=r.useCallback(()=>{De.current||(De.current=!0,queueMicrotask(()=>{De.current=!1,Fe()}))},[Fe]),Ie=r.useCallback(()=>{be.current=NaN,R.current=NaN,Fe()},[Fe]);r.useEffect(()=>{const P=()=>{const L=window.innerWidth,ne=L>0?window.outerWidth/L:1;return ne>.2&&ne<12?Math.abs(ne-1)<.04?1:ne:1},p=()=>{const L=P();Math.abs(L-H.current)>.002&&(H.current=L,Ie())};return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[Ie]);const tt=r.useCallback(()=>{var Se,pt,bt,xt;const P=K.current.mapSize;(!Ne.current||Ne.current.size!==P)&&((Se=Ne.current)==null||Se.gen.dispose(),Ne.current={gen:$t(P),size:P});const p=K.current,L=Te.current?Me.current:me.current.w/2,ne=Ce.current?Xe.current:me.current.h/2,Ye=Oe.current?b.current:Ae.current,ye=Ne.current.gen.generate({lensHalfWidth:L,lensHalfHeight:ne,borderRadius:Ye,depth:Ze.current,clipToShape:p.clipToShape,softEdge:p.softEdge,sheenAngle:p.sheenAngle,glow:p.glow,glowSpread:p.glowSpread,glowFalloff:p.glowFalloff,sheen:p.sheen,sheenWidth:p.sheenWidth,sheenFalloff:p.sheenFalloff,curvature:p.curvature,splay:p.splay,bend:p.bend,bendWidth:p.bendWidth});if(_e.current=ye,(pt=j.current)==null||pt.setAttribute("href",ye),p.frost>0||O.current&&p.brightness!==0){const ut=Lr(2*L,2*ne,Ye);ke.current=ut.uri,(bt=V.current)==null||bt.setAttribute("href",ut.uri)}(xt=Be.current)==null||xt.call(Be,ye),Ie()},[Ie]),lt=r.useRef(tt);lt.current=tt;const Mt=JSON.stringify([c.mapSize,c.clipToShape,c.softEdge,c.sheenAngle,c.glow,c.glowSpread,c.glowFalloff,c.sheen,c.sheenWidth,c.sheenFalloff,c.curvature,c.splay,c.bend,c.bendWidth,xe(s)?"mv":s??(A.w/2||c.lensW),xe(u)?"mv":u??(A.h/2||c.lensH),xe(f)?"mv":f??Ae.current,xe(N)?"mv":N??c.depth,$&&c.brightness!==0]);r.useLayoutEffect(()=>{const P=[],p=(L,ne,Ye,ye=()=>{X.current||et()})=>{if(L===void 0){ne.current=Ye;return}xe(L)?(ne.current=L.get(),P.push(L.on("change",Se=>{ne.current=Se,ye()}))):ne.current=L};return p(o,le,.5),p(n,ue,.5),p(s??c.lensW,Me,c.lensW),p(u??c.lensH,Xe,c.lensH),p(f??c.borderRadius,b,c.borderRadius),p(N??c.depth,Ze,c.depth),p(F??c.scaleX??c.strength,Ge,c.scaleX??c.strength),p(F??c.scaleY??c.strength,Ve,c.scaleY??c.strength),p(I,Pe,1),p(m,we,0),p(d,x,1),p(y,fe,0),p(G,de,.5),Fe(),()=>P.forEach(L=>L())},[o,n,s,u,f,N,F,I,m,d,y,G,c,et,Fe]);const mr=c.dispersion>0,Ct=c.frost>0,br=c.glow>0||c.sheen>0;r.useLayoutEffect(()=>{const P=Re.current;Q.current=P?Array.from(P.querySelectorAll("[data-lens]")):[],se.current=P?Array.from(P.querySelectorAll("feDisplacementMap")):[],j.current&&_e.current&&j.current.setAttribute("href",_e.current),V.current&&ke.current&&V.current.setAttribute("href",ke.current),Ie()},[B,mr,Ct,br,c.sheenDark,c.scaleX,c.scaleY,c.strength,c.brightness,$,v,D,h!=null,a!=null,Ie]),r.useLayoutEffect(()=>{B&&Ie()},[A.w,A.h,rt,Ie]),r.useLayoutEffect(()=>{B&&lt.current()},[B,Mt]),r.useEffect(()=>{const P=[];let p;const L=()=>{clearTimeout(p),p=setTimeout(()=>lt.current(),90)};for(const ne of[s,u,f,N])xe(ne)&&P.push(ne.on("change",L));return()=>{P.forEach(ne=>ne()),clearTimeout(p)}},[s,u,f,N]),r.useEffect(()=>()=>{var P,p;(P=Ne.current)==null||P.gen.dispose(),Ne.current=null,(p=Be.current)==null||p.call(Be,null)},[]),r.useEffect(()=>{if(!q||!B)return;let P=0;const p=()=>{P=requestAnimationFrame(p),Fe()};return P=requestAnimationFrame(p),()=>cancelAnimationFrame(P)},[q,B,Fe]);const xr=z!==1&&!D?z:1,Rr=Ct&&B?v?`${c.frost*xr}`:`${c.frost/A.w} ${c.frost/A.h}`:void 0,st=z!==1&&!D?z:1,jt=st>1&&a==null&&h==null&&B,Ht=a==null&&h==null&&!jt&&s===void 0,zt=(P,p,L)=>i.jsx("div",{ref:P,style:{...L,position:"absolute",top:0,left:0,width:A.w*st,height:A.h*st,transform:`scale(${1/st})`,transformOrigin:"top left"},children:i.jsx("div",{style:{transform:`scale(${st})`,transformOrigin:"top left",width:A.w,height:A.h},children:p})}),Yt=c.brightness!==0&&!$?i.jsx("div",{ref:ce,style:{position:"absolute",inset:0,pointerEvents:"none",background:c.brightness>0?"white":"black",opacity:Math.abs(c.brightness)}}):null,qt=(P,p,L)=>p||L?i.jsx("div",{ref:P,style:{position:"absolute",top:0,left:0,pointerEvents:"none",willChange:"transform",boxSizing:"border-box",boxShadow:[p,L?`inset ${L}`:null].filter(Boolean).join(", ")}}):null;return i.jsxs("div",{ref:E,"data-liquid-glass":"",className:S,style:{contain:"layout",position:"relative",overflow:"visible",...Ht?{width:"fit-content"}:null,...jt?{minHeight:A.h}:null,...M},...w,children:[jt?zt(T,t,{willChange:"filter"}):a==null&&h==null?i.jsx("div",{ref:T,style:Ht?{willChange:"filter"}:{willChange:"filter",position:"relative",height:B?A.h:void 0,overflow:"hidden",contain:"paint"},children:t}):a==null&&v?i.jsx("div",{ref:T,style:{position:"absolute",inset:0,isolation:"isolate"},children:t}):i.jsx("div",{ref:a!=null?void 0:T,style:a!=null?void 0:{willChange:"filter"},children:t}),h!=null&&(v?i.jsx("div",{ref:Y,style:{position:"absolute",inset:-rt,pointerEvents:"none",willChange:"filter, clip-path",background:He},children:i.jsx("div",{style:{position:"absolute",inset:rt},children:h})}):st>1?zt(Y,h,{pointerEvents:"none",willChange:"filter, clip-path",background:He}):i.jsx("div",{ref:Y,style:{position:"absolute",inset:0,pointerEvents:"none",willChange:"filter, clip-path",background:He},children:h})),a!=null&&i.jsxs("div",{ref:te,style:{position:"absolute",inset:0,pointerEvents:"none"},children:[i.jsx("div",{ref:T,style:{willChange:"filter"},children:a}),Yt]}),i.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[i.jsx("svg",{viewBox:`0 0 ${A.w} ${A.h}`,width:"100%",height:"100%",style:{display:"block"},children:i.jsx("defs",{children:i.jsx("filter",{ref:Re,id:`lg-${J}-v0`,filterUnits:v?"userSpaceOnUse":"objectBoundingBox",primitiveUnits:v?"userSpaceOnUse":"objectBoundingBox",colorInterpolationFilters:"sRGB",x:0,y:0,width:v?A.w*st:1,height:v?A.h*st:1,children:B&&i.jsx(qr,{lens:{...c,scaleX:F!==void 0?We(F):c.scaleX??c.strength,scaleY:F!==void 0?We(F):c.scaleY??c.strength},mapHref:lr,feImageRef:j,mapMatrixRef:g,blurStdDeviation:Rr,specularFromRawMap:D,brightnessInFilter:$,filterW:v?A.w*st:void 0,filterH:v?A.h*st:void 0,clipShapeRef:V})})})}),a==null&&Yt,k!==void 0&&i.jsx("div",{ref:re,style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"hidden",willChange:"transform"}})]}),Ct&&t==null&&h==null&&a==null&&i.jsx("div",{ref:ee,style:{position:"absolute",top:0,left:0,pointerEvents:"none",willChange:"backdrop-filter, transform",backdropFilter:`blur(${c.frost}px)`,WebkitBackdropFilter:`blur(${c.frost}px)`}}),qt(he,c.edgeShadow,c.edgeInsetShadow),qt(pe,c.restEdgeShadow,c.restEdgeInsetShadow)]})},sr=t=>r.useMemo(()=>t==null?void 0:xe(t)?at([t],()=>t.get()/2):t/2,[t]),mt=t=>{const{children:e,width:o,height:n,size:s,radius:u,center:f,optics:h,refract:l,behind:a,src:k,draw:I,lenses:m,videoRef:d,paused:y,poster:G,loop:N,muted:F,autoPlay:z,crossOrigin:$,maxDpr:v,unstable_lens:q,...U}=t,S={...U,...q??{}},M=f==null?void 0:f.x,w=f==null?void 0:f.y,[D,C]=Array.isArray(s)?s:s!=null?[s,s]:[void 0,void 0],O=sr(o??D),_=sr(n??C);if(k!=null||I!=null)return i.jsx(Or,{src:k,draw:I,lens:h,lenses:m,videoRef:d,paused:y,poster:G,loop:N,muted:F,autoPlay:z,crossOrigin:$,maxDpr:v,lensW:O,lensH:_,borderRadius:u,x:M,y:w,className:t.className,style:t.style,children:e});const{overlay:X,tintColor:W,tintOpacity:c,tintBlur:K,shadowOpacity:J,restShadowOpacity:E,edgeBias:T,brightnessInFilter:Y,depth:te,scale:ce,filterResolution:re,pixelUnits:ee,live:he,onLensMapChange:pe,...Re}=S,j=xe(o)||xe(n)||xe(u)||xe(D)||xe(C)||xe(M)||xe(w);return e!=null&&l==null&&k==null&&I==null&&m==null&&X==null&&!ee&&W==null&&c==null&&K==null&&J==null&&E==null&&T==null&&!Y&&re==null&&!he&&te==null&&ce==null&&pe==null&&M==null&&w==null&&!j?i.jsx(zr,{...Re,optics:h,radius:u,width:o??D,height:n??C,children:e}):i.jsx(Kr,{...S,lensW:O,lensH:_,borderRadius:u,x:M,y:w,lens:h,refractionTarget:l,refractionBackground:a,children:e})},Vr=176,Jr=13.6,kt=.34,Qr=.75,Zr=84,nr=.033,ir=.008,or=.03,es=(t,e,o,n)=>{r.useEffect(()=>{let s=0,u=0,f=0,h=0,l=t.get(),a=!1;const k=G=>{const N=Math.pow(G,Qr)/Zr,F=N<kt?N:kt,z=o.current,$=F>z?F:z;return $<kt?$:kt},I=G=>Math.abs(u)<6e-4&&Math.abs(f)<.006&&G<.006&&o.current===0,m=G=>{const N=(G-h)/1e3,F=N<nr?N:nr;h=G;const z=t.get(),$=N<ir?ir:N>or?or:N,v=Math.abs((z-l)/$);l=z;const q=k(v),U=Vr*(q-u)-Jr*f;if(f+=U*F,u+=f*F,e.set(u),I(v)){a=!1,e.set(0);return}s=requestAnimationFrame(m)},d=()=>{a||(a=!0,h=performance.now(),l=t.get(),s=requestAnimationFrame(m))};n.current=d;const y=t.on("change",d);return()=>{y(),cancelAnimationFrame(s),n.current=()=>{}}},[t,e,o,n])},Lt=(t,e,o)=>{const n=t<o?t/o:1;return e*n*(3+n*(n-3))},St=r.forwardRef(({x:t,scaleX:e,scaleY:o,style:n,children:s,...u},f)=>{const h=r.useRef(null);return r.useEffect(()=>{const l=h.current;if(!l)return;const a=[t,e,o].filter(m=>m!=null),k=()=>{let m="";if(t&&(m=`translateX(${t.get()}px)`),e||o){const d=e?e.get():1,y=o?o.get():1;m+=`${m?" ":""}scale(${d}, ${y})`}l.style.transform=m};k();const I=a.map(m=>m.on("change",k));return()=>I.forEach(m=>m())},[t,e,o]),i.jsx("div",{ref:l=>{h.current=l,typeof f=="function"?f(l):f&&(f.current=l)},style:n,...u,children:s})});St.displayName="GlassDiv";const ts={strength:.2,frost:.5,depth:.65,curvature:.6,dispersion:.5},rs=r.forwardRef(function({variant:e="primary",size:o="md",glassProps:n,contentClassName:s,className:u="",type:f="button",children:h,...l},a){return i.jsxs("span",{className:`matui-glass-button-shell matui-glass-button--${e}`,children:[i.jsx(mt,{...n,optics:{...ts,...n==null?void 0:n.optics},"aria-hidden":!0,style:{...n==null?void 0:n.style,position:"absolute",inset:0,width:"100%",height:"100%",borderRadius:"inherit",pointerEvents:"none"},children:i.jsx("span",{})}),i.jsx("button",{...l,ref:a,type:f,className:`matui-glass-button matui-glass-button--${o} ${u}`,children:i.jsx("span",{className:s,children:h})})]})}),ss=r.forwardRef(function({elevation:e="raised",glassProps:o,className:n="",children:s,...u},f){return i.jsx("div",{...u,ref:f,className:`matui-glass-card matui-glass-card--${e} ${n}`,children:i.jsx(mt,{...o,style:{width:"100%",padding:28,borderRadius:"inherit",...o==null?void 0:o.style},children:s})})});function ns({label:t,options:e,value:o,defaultValue:n,onValueChange:s,name:u,disabled:f,className:h=""}){var m;const l=r.useId(),[a,k]=r.useState(n??((m=e.find(d=>!d.disabled))==null?void 0:m.value)??""),I=o??a;return i.jsxs("fieldset",{disabled:f,className:`matui-glass-segmented ${h}`,children:[i.jsx("legend",{className:"matui-glass-sr-only",children:t}),e.map(d=>i.jsxs("div",{className:"matui-glass-segment",children:[I===d.value&&i.jsx(mt,{"aria-hidden":!0,className:"matui-glass-segment-lens",style:{position:"absolute",inset:0,borderRadius:18,width:"100%",height:"100%",background:"#ffffff44",pointerEvents:"none"},children:i.jsx("span",{})}),i.jsxs("label",{children:[i.jsx("input",{type:"radio",name:u??l,value:d.value,checked:I===d.value,disabled:d.disabled,onChange:()=>{o===void 0&&k(d.value),s==null||s(d.value)}}),i.jsx("span",{children:d.label})]})]},d.value))]})}const fr="(prefers-reduced-motion: reduce)",is=t=>{const e=window.matchMedia(fr);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},os=()=>window.matchMedia(fr).matches,as=()=>!1;function dr(){return r.useSyncExternalStore(is,os,as)}function hr(){const t=dr();return r.useCallback((...[e,o,n])=>Dr(e,o,t?{...n,duration:0}:n),[t])}function pr(...[t,e,o,n]){const s=dr(),u=r.useMemo(()=>ge(0),[]),f=r.useRef(0),h=r.useRef(()=>{});es(s?u:t,e,s?f:o,s?h:n),r.useEffect(()=>{s&&(e.set(0),n.current=()=>{})},[s,e,n])}const gr=Et(.34,1.36,.42,1),cs=Et(.36,0,.18,1),vt={ease:gr,duration:.52},yt={ease:gr,duration:.26},wt={ease:cs,duration:.46},ls={mapSize:256,depth:.2,dispersion:.65,strength:.19,clipToShape:!0,softEdge:!0,curvature:.3,splay:.6,bend:.1,bendWidth:.06,frost:0,brightness:.05,specular:1.2,sheenAngle:45,sheenDark:!1,glow:.05,glowSpread:.5,glowFalloff:1.5,sheen:.45,sheenWidth:2,sheenFalloff:1.5,edgeShadow:"0 2px 6px rgba(0, 0, 0, 0.16)",edgeInsetShadow:"0 -4px 10px rgba(0, 0, 0, 0.12)",restEdgeShadow:"0 1px 3px rgba(0, 0, 0, 0.24), 0 4px 10px rgba(0, 0, 0, 0.14)"},us={brightness:.12,glow:.4,sheen:.5},fs={brightness:-.02,sheenAngle:30,specular:1.5,glow:.4,glowSpread:.5,glowFalloff:2,sheen:1,sheenWidth:1.5,sheenFalloff:1},ar="color-mix(in srgb, var(--glass-track), var(--glass-active) calc(var(--switch-progress, 0) * 100%))",ds=({checked:t,defaultChecked:e=!1,onCheckedChange:o,disabled:n,name:s,value:u,ariaLabel:f,width:h=74,height:l=28,lens:a,tintBlur:k,rubberOvershoot:I=.15,rubberDampening:m=10,filterResolution:d=2,forceExpanded:y=!1,onLensMapChange:G,scheme:N="light",trackColor:F,activeColor:z,surface:$})=>{const v=hr(),[q,U]=r.useState(e),S=t??q,M=N==="dark",w=Math.round(.6*h),D=l-6,C=h-w-6,O=h*I,_=O*m,X=l/2,W=D/2,c=w/2,K=D/2,J=Math.round(.75*l),E=Math.ceil(.5*Math.max(c,K)+O)+2,T=h+2*E,Y=l+2*E,te=r.useRef(C),ce=r.useRef(w),re=r.useRef(T),ee=r.useRef(E),he=r.useRef(c),pe=r.useRef(K),Re=r.useRef(W),j=r.useRef(k??0);r.useLayoutEffect(()=>{te.current=C,ce.current=w,re.current=T,ee.current=E,he.current=c,pe.current=K,Re.current=W,j.current=k??0});const V=r.useRef(S),g=r.useMemo(()=>{const x=ge(V.current?te.current:0),fe=at([x],()=>(ee.current+3+ce.current/2+x.get())/re.current),de=ge(he.current),be=ge(pe.current),ze=ge(Re.current),R=ge(1),H=ge(.85),ie=ge(.525),je=ge(j.current),De=ge(0),_e=at([De],()=>1-De.get()),ke=ge(0),Ne=at([de,ke],()=>de.get()*(1-.2*ke.get())*2),ct=at([be,ke],()=>be.get()*(1+.4*ke.get())*2),Be=at([R],()=>.5*R.get());return{thumbX:x,lensX:fe,halfW:de,halfH:be,radius:ze,tintOpacity:R,trackScaleX:H,trackScaleY:ie,blur:je,shadowOpacity:De,restShadowOpacity:_e,stretch:ke,lensW:Ne,lensH:ct,edgeBias:Be}},[]),Q=r.useRef(0),se=r.useRef(()=>{});pr(g.thumbX,g.stretch,Q,se);const A=x=>{v(g.halfW,1.5*he.current,x),v(g.halfH,1.5*pe.current,x),v(g.radius,1.5*Re.current,x),v(g.tintOpacity,0,x),v(g.blur,0,x),v(g.trackScaleX,.95,x),v(g.trackScaleY,.975,x),v(g.shadowOpacity,1,x)},Le=x=>{v(g.halfW,he.current,x),v(g.halfH,pe.current,x),v(g.radius,Re.current,x),v(g.tintOpacity,1,x),v(g.blur,j.current,x),v(g.trackScaleX,.85,x),v(g.trackScaleY,.525,x),v(g.shadowOpacity,0,x)},me=r.useRef(!1);r.useEffect(()=>{y!==me.current&&(me.current=y,y?(A(yt),Q.current=.175,se.current()):(Le(wt),Q.current=0))},[y]);const B=r.useRef("idle"),Z=r.useRef(void 0),ve=r.useRef(void 0),Ue=r.useRef(!0),[He,le]=r.useState(!1),ue=r.useRef(!1),Me=r.useRef(null),Xe=r.useRef(null),b=r.useRef(null),Te=r.useRef(0),Ce=r.useRef(0),Oe=r.useRef(!1),Ae=r.useRef(null);r.useEffect(()=>{Ue.current=!0;const x=Xe.current;return()=>{if(Ue.current=!1,clearTimeout(Z.current),clearTimeout(ve.current),b.current!==null&&x){try{x.releasePointerCapture(b.current)}catch{}b.current=null}}},[]),r.useEffect(()=>{He||B.current==="tap"||(Ae.current=v(g.thumbX,S?C:0,vt))},[S,He,g.thumbX,C,v]),r.useLayoutEffect(()=>{const x=fe=>{var be;const de=te.current;(be=Me.current)==null||be.style.setProperty("--switch-progress",String(de>0?Math.max(0,Math.min(1,fe/de)):0))};return x(g.thumbX.get()),g.thumbX.on("change",x)},[g.thumbX]);const Ze=r.useMemo(()=>({...ls,...M?us:fs,...a,sheenDark:!M}),[M,a]),Ge=x=>{ue.current||n||(t===void 0&&U(x),o==null||o(x),B.current==="idle"&&(B.current="tap",A(yt),clearTimeout(ve.current),ve.current=setTimeout(()=>{Le(wt)},290),Ae.current=v(g.thumbX,x?C:0,{...vt,onComplete:()=>{Ue.current&&B.current==="tap"&&(B.current="idle")}})))},Ve=$??(M?"#1f1f24":"#ffffff"),Pe=F??(M?"#2a2828":"#e1dfdf"),we=z??"#0a84ff";return i.jsxs("label",{ref:Me,className:"matui-glass-control",style:{flexShrink:0,width:h,height:l,overflow:"visible",cursor:n?"not-allowed":"pointer",opacity:n?.4:void 0,borderRadius:999,display:"block",position:"relative","--glass-track":Pe,"--glass-active":we},children:[i.jsx("input",{type:"checkbox",role:"switch","aria-checked":S,checked:S??!1,onChange:x=>Ge(x.target.checked),onClick:x=>{ue.current&&x.preventDefault()},onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),Ge(!S))},disabled:n,name:s,value:u,"aria-label":f,style:{whiteSpace:"nowrap",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",pointerEvents:"none",border:0,width:1,height:1,margin:-1,padding:0,position:"absolute",overflow:"hidden"}}),i.jsx(mt,{optics:Ze,center:{x:g.lensX,y:.5},size:[g.lensW,g.lensH],radius:g.radius,unstable_lens:{tintColor:"white",tintOpacity:g.tintOpacity,tintBlur:g.blur,shadowOpacity:g.shadowOpacity,restShadowOpacity:g.restShadowOpacity,edgeBias:g.edgeBias},filterResolution:d,onLensMapChange:G,behind:Ve,style:{width:T,height:Y,overflow:"visible",margin:-E},refract:i.jsx("div",{style:{padding:E,height:l,display:"flex",alignItems:"center",boxSizing:"content-box"},children:i.jsx(St,{scaleX:g.trackScaleX,scaleY:g.trackScaleY,style:{width:h,height:J,borderRadius:J/2,background:ar}})}),children:i.jsx("div",{style:{padding:E},children:i.jsx("div",{"aria-hidden":!0,style:{width:h,height:l,borderRadius:X,background:ar,display:"block",position:"relative",overflow:"visible"},children:i.jsx(St,{ref:Xe,x:g.thumbX,style:{position:"absolute",willChange:"transform",userSelect:"none",WebkitUserSelect:"none",width:w,height:D,top:3,left:3,touchAction:"none"},onPointerDown:x=>{b.current!==null||n||(b.current=x.pointerId,x.currentTarget.setPointerCapture(x.pointerId),Te.current=x.clientX,Ce.current=g.thumbX.get(),Oe.current=!1,le(!0),ue.current=!0,clearTimeout(Z.current),clearTimeout(ve.current),B.current="pending",Z.current=setTimeout(()=>{var fe;B.current==="pending"&&(B.current="hold",(fe=Ae.current)==null||fe.stop(),A(yt),Q.current=.175,se.current())},170))},onPointerMove:x=>{var be;if(x.pointerId!==b.current)return;const fe=x.clientX-Te.current;if(!Oe.current){if(Math.abs(fe)<3)return;Oe.current=!0,(be=Ae.current)==null||be.stop(),Ce.current=g.thumbX.get(),Te.current=x.clientX,clearTimeout(Z.current),Q.current=0,B.current!=="hold"&&(B.current="hold",A(yt))}let de=Ce.current+(x.clientX-Te.current);de<0?de=-Lt(-de,O,_):de>C&&(de=C+Lt(de-C,O,_)),g.thumbX.set(de)},onPointerUp:x=>{if(x.pointerId===b.current)if(b.current=null,clearTimeout(Z.current),Oe.current){le(!1),B.current="idle",Le(wt);const fe=Math.max(0,Math.min(C,g.thumbX.get()))>C/2;Ae.current=v(g.thumbX,fe?C:0,vt),fe!==S&&(o==null||o(fe)),requestAnimationFrame(()=>{ue.current=!1})}else if(B.current==="pending"||B.current==="tap"){B.current="tap",ue.current=!1,le(!1),A(yt),clearTimeout(ve.current),ve.current=setTimeout(()=>{Le(wt)},290);const fe=S?0:C;Ae.current=v(g.thumbX,fe,{...vt,onComplete:()=>{Ue.current&&B.current==="tap"&&(B.current="idle")}})}else B.current==="hold"?(B.current="idle",le(!1),Q.current=0,Le(wt),Ae.current=v(g.thumbX,S?C:0,vt),requestAnimationFrame(()=>{ue.current=!1})):(le(!1),ue.current=!1)},onPointerCancel:x=>{x.pointerId===b.current&&(b.current=null,clearTimeout(Z.current),Q.current=0,le(!1),B.current="idle",Le(wt),Ae.current=v(g.thumbX,S?C:0,vt),requestAnimationFrame(()=>{ue.current=!1}))},onDragStart:x=>x.preventDefault()})})})})]})},cr={ease:Et(.34,1.36,.42,1),duration:.27},Pt={ease:Et(.36,0,.18,1),duration:.46},hs={mapSize:256,depth:.2,dispersion:.5,scaleX:.06,scaleY:.06,clipToShape:!0,softEdge:!0,curvature:.55,splay:.5,bend:.1,bendWidth:.05,frost:0,brightness:.06,specular:1.5,sheenAngle:45,sheenDark:!1,glow:.4,glowSpread:.5,glowFalloff:1.5,sheen:0,sheenWidth:3,sheenFalloff:1.5,edgeShadow:"0 2px 6px rgba(0, 0, 0, 0.16)",edgeInsetShadow:"0 -4px 10px rgba(0, 0, 0, 0.12)"},ps={restEdgeShadow:"0 1.333px 5.333px rgba(0, 0, 0, 0.5)",scaleX:.133,scaleY:.135,brightness:.12,sheenAngle:45,glowFalloff:1.5,sheen:.5,sheenWidth:1,sheenFalloff:1.5},gs={restEdgeShadow:"0 1.333px 5.333px rgba(46, 15, 15, 0.12)",scaleX:.1,scaleY:.1,brightness:-.02,sheenAngle:30,glowFalloff:2,sheen:1,sheenWidth:1,sheenFalloff:1},ms={scaleY:.25},bs=()=>{const[t,e]=r.useState(!1);return r.useEffect(()=>{e(typeof navigator<"u"&&/^((?!chrome|chromium|android).)*safari/i.test(navigator.userAgent))},[]),t},xs=({value:t,defaultValue:e=50,onValueChange:o,min:n=0,max:s=100,step:u=1,disabled:f,width:h=240,thumbHeight:l=22,thumbWidth:a,height:k=6,rubberOvershoot:I=.05,rubberDampening:m=30,refractionTrackHeight:d,lens:y,tintBlur:G,filterResolution:N=2,name:F,ariaLabel:z,forceExpanded:$=!1,onLensMapChange:v,scheme:q="light",trackColor:U,activeColor:S,surface:M})=>{const w=hr(),D=q==="dark",C=bs(),O=t!==void 0,[_,X]=r.useState(e),W=O?t:_,c=r.useCallback(R=>{const H=u>0?Math.round((R-n)/u)*u+n:R,ie=Math.max(n,Math.min(s,H));O||X(ie),o==null||o(ie)},[n,s,u,O,o]),K=a??Math.round(2*l),J=h-K,E=K/2,T=l/2,Y=l/2,te=k/2,ce=h*I,re=ce*m,ee=d??Math.round(.75*l),he=Math.ceil(.5*Math.max(E,T)+ce)+2,pe=h+2*he,Re=l+2*he,j=r.useRef(J),V=r.useRef(K),g=r.useRef(pe),Q=r.useRef(he),se=r.useRef(E),A=r.useRef(T),Le=r.useRef(Y),me=r.useRef(!1),B=r.useRef(0),Z=r.useRef(0),ve=r.useRef(ce),Ue=r.useRef(re),He=r.useRef(G??0);r.useLayoutEffect(()=>{j.current=J,V.current=K,g.current=pe,Q.current=he,se.current=E,A.current=T,Le.current=Y,ve.current=ce,Ue.current=re,He.current=G??0});const le=r.useCallback(R=>s>n?(R-n)/(s-n)*J:0,[n,s,J]),ue=r.useCallback(R=>{const H=Math.max(0,Math.min(J,R)),ie=J>0?n+H/J*(s-n):n;return Math.max(n,Math.min(s,u>0?Math.round((ie-n)/u)*u+n:ie))},[n,s,J,u]),Me=r.useRef(le),Xe=r.useRef(W),b=r.useMemo(()=>{const R=ge(Me.current(Xe.current)),H=at([R],()=>(Q.current+V.current/2+R.get())/g.current),ie=ge(se.current),je=ge(A.current),De=ge(Le.current),_e=ge(1),ke=ge(.85),Ne=ge(.525),ct=ge(He.current),Be=ge(0),ht=at([Be],()=>1-Be.get()),Je=ge(0),rt=at([ie,Je],()=>ie.get()*(1-.2*Je.get())*2),oe=at([je,Je],()=>je.get()*(1+.4*Je.get())*2);return{thumbX:R,lensX:H,halfW:ie,halfH:je,radius:De,tintOpacity:_e,trackScaleX:ke,trackScaleY:Ne,blur:ct,shadowOpacity:Be,restShadowOpacity:ht,stretch:Je,lensW:rt,lensH:oe}},[]);r.useEffect(()=>{me.current||(b.halfW.set(E),b.halfH.set(T),b.radius.set(Y))},[E,T,Y,b]);const Te=r.useRef(0),Ce=r.useRef(()=>{});pr(b.thumbX,b.stretch,Te,Ce);const Oe=R=>{w(b.halfW,1.5*se.current,R),w(b.halfH,1.5*A.current,R),w(b.radius,1.5*Le.current,R),w(b.tintOpacity,0,R),w(b.blur,0,R),w(b.trackScaleX,.95,R),w(b.trackScaleY,.975,R),w(b.shadowOpacity,1,R)},Ae=R=>{w(b.halfW,se.current,R),w(b.halfH,A.current,R),w(b.radius,Le.current,R),w(b.tintOpacity,1,R),w(b.blur,He.current,R),w(b.trackScaleX,.85,R),w(b.trackScaleY,.525,R),w(b.shadowOpacity,0,R)},Ze=r.useRef(!1);r.useEffect(()=>{$!==Ze.current&&(Ze.current=$,$?(Oe(cr),Te.current=.175,Ce.current()):(Ae(Pt),Te.current=0))},[$]);const Ge=r.useRef(null),Ve=r.useRef(null),Pe=r.useRef(null),we=r.useRef(null);r.useEffect(()=>()=>{if(we.current!==null&&Ve.current){try{Ve.current.releasePointerCapture(we.current)}catch{}we.current=null}},[]),r.useEffect(()=>{me.current||b.thumbX.set(le(W))},[W,le,b.thumbX]),r.useEffect(()=>{const R=H=>{const ie=Ge.current;if(!ie)return;const je=V.current/2+H,De=j.current>0?H/j.current:0;ie.style.setProperty("--slider-fill",`${je}px`),ie.style.setProperty("--slider-progress",String(Math.max(0,Math.min(1,De))))};return R(b.thumbX.get()),b.thumbX.on("change",R)},[b.thumbX]);const x=r.useMemo(()=>({...hs,...D?ps:gs,...C?ms:null,...y,sheenDark:!D}),[D,C,y]),fe=M??(D?"#1f1f24":"#ffffff"),de=U??(D?"#2a2828":"#e1dfdf"),be=S??"#0a84ff",ze=R=>{if(R.pointerId!==we.current)return;we.current=null,me.current=!1,Te.current=0;const H=Math.max(0,Math.min(j.current,b.thumbX.get()));w(b.thumbX,H,Pt),Ae(Pt)};return i.jsx("div",{ref:Ge,className:"matui-glass-control",style:{flexShrink:0,width:h,height:l,overflow:"visible",borderRadius:999,position:"relative",opacity:f?.4:void 0,cursor:f?"not-allowed":void 0,"--glass-track":de,"--glass-active":be},children:i.jsx(mt,{optics:x,center:{x:b.lensX,y:.5},size:[b.lensW,b.lensH],radius:b.radius,unstable_lens:{tintColor:"white",tintOpacity:b.tintOpacity,tintBlur:b.blur,shadowOpacity:b.shadowOpacity,restShadowOpacity:b.restShadowOpacity},filterResolution:N,onLensMapChange:v,behind:fe,style:{width:pe,height:Re,overflow:"visible",margin:-he},refract:i.jsx("div",{style:{padding:he,height:l,display:"flex",alignItems:"center",boxSizing:"content-box"},children:i.jsxs(St,{scaleX:b.trackScaleX,scaleY:b.trackScaleY,style:{position:"relative",width:h,height:ee,borderRadius:ee/2,overflow:"hidden"},children:[i.jsx("div",{style:{position:"absolute",inset:0,background:"var(--glass-track)"}}),i.jsx("div",{style:{position:"absolute",inset:0,background:"var(--glass-active)",borderRadius:"inherit",transform:"translateX(calc((var(--slider-progress, 0) - 1) * 100%))"}})]})}),children:i.jsxs("div",{style:{padding:he},children:[i.jsx("input",{ref:Pe,type:"range",min:n,max:s,step:u,value:W,disabled:f,name:F,"aria-label":z,onChange:R=>c(Number(R.target.value)),style:{whiteSpace:"nowrap",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",pointerEvents:"none",border:0,width:1,height:1,margin:-1,padding:0,position:"absolute",overflow:"hidden"}}),i.jsxs("div",{ref:Ve,"aria-hidden":!0,style:{width:h,height:l,cursor:f?"not-allowed":"pointer",touchAction:"none",userSelect:"none",WebkitUserSelect:"none",alignItems:"center",display:"flex",position:"relative",overflow:"visible"},onPointerDown:R=>{var De,_e;if(f||we.current!==null)return;we.current=R.pointerId,R.currentTarget.setPointerCapture(R.pointerId),me.current=!0,(De=Pe.current)==null||De.focus({preventScroll:!0});const H=(_e=Ve.current)==null?void 0:_e.getBoundingClientRect(),ie=H?R.clientX-H.left-V.current/2:0,je=Math.max(0,Math.min(j.current,ie));b.thumbX.set(je),c(ue(je)),B.current=R.clientX,Z.current=je,Oe(cr),Te.current=.175,Ce.current()},onPointerMove:R=>{if(R.pointerId!==we.current)return;let H=Z.current+(R.clientX-B.current);H<0?H=-Lt(-H,ve.current,Ue.current):H>j.current&&(H=j.current+Lt(H-j.current,ve.current,Ue.current)),b.thumbX.set(H),c(ue(Math.max(0,Math.min(j.current,H))))},onPointerUp:ze,onPointerCancel:ze,onDragStart:R=>R.preventDefault(),children:[i.jsxs("div",{style:{width:"100%",position:"relative",overflow:"hidden",height:k,borderRadius:te},children:[i.jsx("div",{style:{position:"absolute",inset:0,background:"var(--glass-track)",borderRadius:"inherit"}}),i.jsx("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:"var(--slider-fill)",background:"var(--glass-active)",borderRadius:te}})]}),i.jsx(St,{x:b.thumbX,style:{willChange:"transform",position:"absolute",top:0,left:0,width:K,height:l}})]})]})})})},Rs="-apple-system, 'SF Pro Text', ui-sans-serif, system-ui, sans-serif",vs={mapSize:256,clipToShape:!0,softEdge:!0,depth:1,curvature:.5,dispersion:.6,strength:.17,bend:.7,bendWidth:.12,frost:3,brightness:.22,specular:1.3,sheenAngle:50,glow:.32,glowSpread:1,glowFalloff:1,sheen:1.3,sheenWidth:3},ws="#1c1c1e",ys="rgba(0,0,0,0.5)",Ss="rgba(0,0,0,0.74)",Es="radial-gradient(120% 120% at 12% 18%, #ff9d4d 0%, transparent 46%),radial-gradient(120% 120% at 82% 14%, #4dc3ff 0%, transparent 44%),radial-gradient(130% 130% at 78% 88%, #ff5d8f 0%, transparent 50%),radial-gradient(140% 140% at 22% 86%, #7a5cff 0%, transparent 52%),linear-gradient(135deg, #b24bd8, #f0793b)",Ms=({bg:t})=>i.jsx("div",{"aria-hidden":!0,style:{position:"absolute",inset:0,background:t,backgroundSize:"cover",backgroundPosition:"center"}}),Ts=420,As=48,Ft=84,Ut=20,_s=()=>{const t=r.useRef(null),[e,o]=r.useState({w:0,h:0});return r.useLayoutEffect(()=>{const n=t.current;if(!n)return;const s=()=>o({w:n.clientWidth,h:n.clientHeight});s();const u=new ResizeObserver(s);return u.observe(n),()=>u.disconnect()},[]),[t,e]},ks=({title:t="Priya Raman",time:e="now",body:o="Just landed — grabbing a cab. Save me a seat and order the usual?",avatar:n="PR",wallpaper:s=Es,lens:u})=>{const[f,{w:h,h:l}]=_s(),a=Math.round(Math.min(h-As,Ts)),k=h>0&&l>0&&a>0,I=Math.round((h-a)/2),m=Math.round((l-Ft)/2);return i.jsxs("div",{ref:f,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",fontFamily:Rs,userSelect:"none"},children:[i.jsx(Ms,{bg:s}),k&&i.jsxs(i.Fragment,{children:[i.jsx(mt,{optics:{...vs,...u},brightnessInFilter:!0,width:a,height:Ft,radius:Ut,refract:i.jsx("div",{"aria-hidden":!0,style:{position:"absolute",left:-I,top:-m,width:h,height:l,background:s,backgroundSize:"cover",backgroundPosition:"center"}}),behind:"#c8569f",style:{position:"absolute",left:I,top:m,width:a,height:Ft,borderRadius:Ut}}),i.jsxs("div",{style:{position:"absolute",left:I,top:m,width:a,height:Ft,borderRadius:Ut,background:"linear-gradient(180deg, rgba(255,255,255,0.62) 0%, rgba(255,255,255,0.16) 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.95), inset 0 0 0 1px rgba(255,255,255,0.5), inset 0 0 24px rgba(255,255,255,0.55), 0 0 0 0.5px rgba(0,0,0,0.18), 0 14px 36px rgba(0,0,0,0.22), 0 2px 5px rgba(0,0,0,0.14)",display:"flex",alignItems:"center",gap:14,padding:"0 18px",boxSizing:"border-box",color:ws},children:[i.jsx("div",{"aria-hidden":!0,style:{flexShrink:0,width:40,height:40,borderRadius:"50%",display:"grid",placeItems:"center",background:"linear-gradient(160deg, #2e9bff 0%, #0a6cff 100%)",color:"#fff",fontSize:14,fontWeight:600,letterSpacing:.3,boxShadow:"inset 0 1px 1px rgba(255,255,255,0.4)"},children:n}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[i.jsx("span",{style:{fontSize:14.5,fontWeight:600},children:t}),i.jsx("span",{style:{marginLeft:"auto",fontSize:12,color:ys,whiteSpace:"nowrap"},children:e})]}),i.jsx("div",{style:{marginTop:3,fontSize:13.5,lineHeight:1.35,color:Ss,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:o})]})]})]})]})},Fs="0.3.1";exports.Glass=mt;exports.GlassButton=rs;exports.GlassCard=ss;exports.GlassNotification=ks;exports.GlassSegmentedControl=ns;exports.GlassSlider=xs;exports.GlassSwitch=ds;exports.LiquidGlass=mt;exports.VERSION=Fs;
package/dist/index.d.cts CHANGED
@@ -139,6 +139,6 @@ export declare interface GlassSwitchProps {
139
139
  surface?: string;
140
140
  }
141
141
 
142
- export declare const VERSION = "0.3.0";
142
+ export declare const VERSION = "0.3.1";
143
143
 
144
144
  export { }
package/dist/index.d.ts CHANGED
@@ -139,6 +139,6 @@ export declare interface GlassSwitchProps {
139
139
  surface?: string;
140
140
  }
141
141
 
142
- export declare const VERSION = "0.3.0";
142
+ export declare const VERSION = "0.3.1";
143
143
 
144
144
  export { }
package/dist/index.mjs CHANGED
@@ -2290,7 +2290,13 @@ void main() {
2290
2290
  );
2291
2291
  });
2292
2292
  Ft.displayName = "GlassDiv";
2293
- const Gn = vr(function({
2293
+ const fn = {
2294
+ strength: 0.2,
2295
+ frost: 0.5,
2296
+ depth: 0.65,
2297
+ curvature: 0.6,
2298
+ dispersion: 0.5
2299
+ }, Pn = vr(function({
2294
2300
  variant: e = "primary",
2295
2301
  size: s = "md",
2296
2302
  glassProps: n,
@@ -2305,6 +2311,7 @@ const Gn = vr(function({
2305
2311
  _t,
2306
2312
  {
2307
2313
  ...n,
2314
+ optics: { ...fn, ...n == null ? void 0 : n.optics },
2308
2315
  "aria-hidden": !0,
2309
2316
  style: {
2310
2317
  ...n == null ? void 0 : n.style,
@@ -2329,7 +2336,7 @@ const Gn = vr(function({
2329
2336
  }
2330
2337
  )
2331
2338
  ] });
2332
- }), Pn = vr(function({ elevation: e = "raised", glassProps: s, className: n = "", children: r, ...u }, h) {
2339
+ }), Un = vr(function({ elevation: e = "raised", glassProps: s, className: n = "", children: r, ...u }, h) {
2333
2340
  return /* @__PURE__ */ a(
2334
2341
  "div",
2335
2342
  {
@@ -2347,7 +2354,7 @@ const Gn = vr(function({
2347
2354
  }
2348
2355
  );
2349
2356
  });
2350
- function Un({
2357
+ function On({
2351
2358
  label: t,
2352
2359
  options: e,
2353
2360
  value: s,
@@ -2400,12 +2407,12 @@ function Un({
2400
2407
  ] }, d.value))
2401
2408
  ] });
2402
2409
  }
2403
- const yr = "(prefers-reduced-motion: reduce)", fn = (t) => {
2410
+ const yr = "(prefers-reduced-motion: reduce)", pn = (t) => {
2404
2411
  const e = window.matchMedia(yr);
2405
2412
  return e.addEventListener("change", t), () => e.removeEventListener("change", t);
2406
- }, pn = () => window.matchMedia(yr).matches, gn = () => !1;
2413
+ }, gn = () => window.matchMedia(yr).matches, mn = () => !1;
2407
2414
  function Rr() {
2408
- return Br(fn, pn, gn);
2415
+ return Br(pn, gn, mn);
2409
2416
  }
2410
2417
  function Sr() {
2411
2418
  const t = Rr();
@@ -2427,7 +2434,7 @@ function Mr(...[t, e, s, n]) {
2427
2434
  });
2428
2435
  }, [r, e, n]);
2429
2436
  }
2430
- const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er, duration: 0.52 }, kt = { ease: Er, duration: 0.26 }, At = { ease: mn, duration: 0.46 }, bn = {
2437
+ const Er = Lt(0.34, 1.36, 0.42, 1), bn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er, duration: 0.52 }, kt = { ease: Er, duration: 0.26 }, At = { ease: bn, duration: 0.46 }, vn = {
2431
2438
  mapSize: 256,
2432
2439
  // depth/curvature are 0..1 fractions of the thumb's expanded half-extent (~16.5px):
2433
2440
  // a gentle depth keeps a refractive rim, not a magnifying body dome; the glassy
@@ -2459,11 +2466,11 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
2459
2466
  // a tight contact shadow + a soft ambient one. Fades out as it expands into
2460
2467
  // the lens (which has its own `edgeShadow`).
2461
2468
  restEdgeShadow: "0 1px 3px rgba(0, 0, 0, 0.24), 0 4px 10px rgba(0, 0, 0, 0.14)"
2462
- }, vn = {
2469
+ }, wn = {
2463
2470
  brightness: 0.12,
2464
2471
  glow: 0.4,
2465
2472
  sheen: 0.5
2466
- }, wn = {
2473
+ }, xn = {
2467
2474
  brightness: -0.02,
2468
2475
  sheenAngle: 30,
2469
2476
  specular: 1.5,
@@ -2473,7 +2480,7 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
2473
2480
  sheen: 1,
2474
2481
  sheenWidth: 1.5,
2475
2482
  sheenFalloff: 1
2476
- }, mr = "color-mix(in srgb, var(--glass-track), var(--glass-active) calc(var(--switch-progress, 0) * 100%))", On = ({
2483
+ }, mr = "color-mix(in srgb, var(--glass-track), var(--glass-active) calc(var(--switch-progress, 0) * 100%))", Nn = ({
2477
2484
  checked: t,
2478
2485
  defaultChecked: e = !1,
2479
2486
  onCheckedChange: s,
@@ -2560,8 +2567,8 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
2560
2567
  }, [g.thumbX]);
2561
2568
  const nt = ft(
2562
2569
  () => ({
2563
- ...bn,
2564
- ...E ? vn : wn,
2570
+ ...vn,
2571
+ ...E ? wn : xn,
2565
2572
  ...i,
2566
2573
  sheenDark: !E
2567
2574
  }),
@@ -2773,7 +2780,7 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
2773
2780
  ]
2774
2781
  }
2775
2782
  );
2776
- }, br = { ease: Lt(0.34, 1.36, 0.42, 1), duration: 0.27 }, qt = { ease: Lt(0.36, 0, 0.18, 1), duration: 0.46 }, xn = {
2783
+ }, br = { ease: Lt(0.34, 1.36, 0.42, 1), duration: 0.27 }, qt = { ease: Lt(0.36, 0, 0.18, 1), duration: 0.46 }, yn = {
2777
2784
  mapSize: 256,
2778
2785
  // depth/curvature are 0..1 fractions of the thumb's expanded half-extent (~16.5px):
2779
2786
  // depth ≈ 0.12 is a ~1.3–2px refractive rim; curvature ≈ 0.30 shapes the rim BEND
@@ -2807,7 +2814,7 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
2807
2814
  edgeInsetShadow: "0 -4px 10px rgba(0, 0, 0, 0.12)"
2808
2815
  // restEdgeShadow (the floating resting-puck shadow, fades out as the thumb
2809
2816
  // blooms) is themed per scheme — see SLIDER_DARK / SLIDER_LIGHT below.
2810
- }, yn = {
2817
+ }, Rn = {
2811
2818
  restEdgeShadow: "0 1.333px 5.333px rgba(0, 0, 0, 0.5)",
2812
2819
  scaleX: 0.133,
2813
2820
  scaleY: 0.135,
@@ -2817,7 +2824,7 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
2817
2824
  sheen: 0.5,
2818
2825
  sheenWidth: 1,
2819
2826
  sheenFalloff: 1.5
2820
- }, Rn = {
2827
+ }, Sn = {
2821
2828
  restEdgeShadow: "0 1.333px 5.333px rgba(46, 15, 15, 0.12)",
2822
2829
  scaleX: 0.1,
2823
2830
  scaleY: 0.1,
@@ -2827,14 +2834,14 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
2827
2834
  sheen: 1,
2828
2835
  sheenWidth: 1,
2829
2836
  sheenFalloff: 1
2830
- }, Sn = { scaleY: 0.25 }, Mn = () => {
2837
+ }, Mn = { scaleY: 0.25 }, En = () => {
2831
2838
  const [t, e] = Ke(!1);
2832
2839
  return oe(() => {
2833
2840
  e(
2834
2841
  typeof navigator < "u" && /^((?!chrome|chromium|android).)*safari/i.test(navigator.userAgent)
2835
2842
  );
2836
2843
  }, []), t;
2837
- }, Nn = ({
2844
+ }, $n = ({
2838
2845
  value: t,
2839
2846
  defaultValue: e = 50,
2840
2847
  onValueChange: s,
@@ -2861,7 +2868,7 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
2861
2868
  activeColor: S,
2862
2869
  surface: E
2863
2870
  }) => {
2864
- const y = Sr(), X = K === "dark", C = Mn(), N = t !== void 0, [_, W] = Ke(e), B = N ? t : _, c = Rt(
2871
+ const y = Sr(), X = K === "dark", C = En(), N = t !== void 0, [_, W] = Ke(e), B = N ? t : _, c = Rt(
2865
2872
  (w) => {
2866
2873
  const z = u > 0 ? Math.round((w - n) / u) * u + n : w, ae = Math.max(n, Math.min(r, z));
2867
2874
  N || W(ae), s == null || s(ae);
@@ -2943,9 +2950,9 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
2943
2950
  return w(b.thumbX.get()), b.thumbX.on("change", w);
2944
2951
  }, [b.thumbX]);
2945
2952
  const v = ft(() => ({
2946
- ...xn,
2947
- ...X ? yn : Rn,
2948
- ...C ? Sn : null,
2953
+ ...yn,
2954
+ ...X ? Rn : Sn,
2955
+ ...C ? Mn : null,
2949
2956
  ...R,
2950
2957
  sheenDark: !X
2951
2958
  }), [X, C, R]), fe = E ?? (X ? "#1f1f24" : "#ffffff"), pe = O ?? (X ? "#2a2828" : "#e1dfdf"), we = S ?? "#0a84ff", je = (w) => {
@@ -3167,7 +3174,7 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
3167
3174
  )
3168
3175
  }
3169
3176
  );
3170
- }, En = "-apple-system, 'SF Pro Text', ui-sans-serif, system-ui, sans-serif", Tn = {
3177
+ }, Tn = "-apple-system, 'SF Pro Text', ui-sans-serif, system-ui, sans-serif", An = {
3171
3178
  mapSize: 256,
3172
3179
  clipToShape: !0,
3173
3180
  softEdge: !0,
@@ -3189,7 +3196,7 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
3189
3196
  glowFalloff: 1,
3190
3197
  sheen: 1.3,
3191
3198
  sheenWidth: 3
3192
- }, An = "#1c1c1e", _n = "rgba(0,0,0,0.5)", kn = "rgba(0,0,0,0.74)", Fn = "radial-gradient(120% 120% at 12% 18%, #ff9d4d 0%, transparent 46%),radial-gradient(120% 120% at 82% 14%, #4dc3ff 0%, transparent 44%),radial-gradient(130% 130% at 78% 88%, #ff5d8f 0%, transparent 50%),radial-gradient(140% 140% at 22% 86%, #7a5cff 0%, transparent 52%),linear-gradient(135deg, #b24bd8, #f0793b)", Ln = ({ bg: t }) => /* @__PURE__ */ a(
3199
+ }, _n = "#1c1c1e", kn = "rgba(0,0,0,0.5)", Fn = "rgba(0,0,0,0.74)", Ln = "radial-gradient(120% 120% at 12% 18%, #ff9d4d 0%, transparent 46%),radial-gradient(120% 120% at 82% 14%, #4dc3ff 0%, transparent 44%),radial-gradient(130% 130% at 78% 88%, #ff5d8f 0%, transparent 50%),radial-gradient(140% 140% at 22% 86%, #7a5cff 0%, transparent 52%),linear-gradient(135deg, #b24bd8, #f0793b)", Cn = ({ bg: t }) => /* @__PURE__ */ a(
3193
3200
  "div",
3194
3201
  {
3195
3202
  "aria-hidden": !0,
@@ -3201,7 +3208,7 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
3201
3208
  backgroundPosition: "center"
3202
3209
  }
3203
3210
  }
3204
- ), Cn = 420, Dn = 48, Bt = 84, Kt = 20, Xn = () => {
3211
+ ), Dn = 420, Xn = 48, Bt = 84, Kt = 20, In = () => {
3205
3212
  const t = o(null), [e, s] = Ke({ w: 0, h: 0 });
3206
3213
  return qe(() => {
3207
3214
  const n = t.current;
@@ -3211,15 +3218,15 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
3211
3218
  const u = new ResizeObserver(r);
3212
3219
  return u.observe(n), () => u.disconnect();
3213
3220
  }, []), [t, e];
3214
- }, $n = ({
3221
+ }, Hn = ({
3215
3222
  title: t = "Priya Raman",
3216
3223
  time: e = "now",
3217
3224
  body: s = "Just landed — grabbing a cab. Save me a seat and order the usual?",
3218
3225
  avatar: n = "PR",
3219
- wallpaper: r = Fn,
3226
+ wallpaper: r = Ln,
3220
3227
  lens: u
3221
3228
  }) => {
3222
- const [h, { w: f, h: l }] = Xn(), i = Math.round(Math.min(f - Dn, Cn)), k = f > 0 && l > 0 && i > 0, I = Math.round((f - i) / 2), m = Math.round((l - Bt) / 2);
3229
+ const [h, { w: f, h: l }] = In(), i = Math.round(Math.min(f - Xn, Dn)), k = f > 0 && l > 0 && i > 0, I = Math.round((f - i) / 2), m = Math.round((l - Bt) / 2);
3223
3230
  return /* @__PURE__ */ te(
3224
3231
  "div",
3225
3232
  {
@@ -3229,16 +3236,16 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
3229
3236
  width: "100%",
3230
3237
  height: "100%",
3231
3238
  overflow: "hidden",
3232
- fontFamily: En,
3239
+ fontFamily: Tn,
3233
3240
  userSelect: "none"
3234
3241
  },
3235
3242
  children: [
3236
- /* @__PURE__ */ a(Ln, { bg: r }),
3243
+ /* @__PURE__ */ a(Cn, { bg: r }),
3237
3244
  k && /* @__PURE__ */ te(ot, { children: [
3238
3245
  /* @__PURE__ */ a(
3239
3246
  _t,
3240
3247
  {
3241
- optics: { ...Tn, ...u },
3248
+ optics: { ...An, ...u },
3242
3249
  brightnessInFilter: !0,
3243
3250
  width: i,
3244
3251
  height: Bt,
@@ -3292,7 +3299,7 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
3292
3299
  gap: 14,
3293
3300
  padding: "0 18px",
3294
3301
  boxSizing: "border-box",
3295
- color: An
3302
+ color: _n
3296
3303
  },
3297
3304
  children: [
3298
3305
  /* @__PURE__ */ a(
@@ -3325,7 +3332,7 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
3325
3332
  style: {
3326
3333
  marginLeft: "auto",
3327
3334
  fontSize: 12,
3328
- color: _n,
3335
+ color: kn,
3329
3336
  whiteSpace: "nowrap"
3330
3337
  },
3331
3338
  children: e
@@ -3339,7 +3346,7 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
3339
3346
  marginTop: 3,
3340
3347
  fontSize: 13.5,
3341
3348
  lineHeight: 1.35,
3342
- color: kn,
3349
+ color: Fn,
3343
3350
  display: "-webkit-box",
3344
3351
  WebkitLineClamp: 2,
3345
3352
  WebkitBoxOrient: "vertical",
@@ -3356,15 +3363,15 @@ const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er,
3356
3363
  ]
3357
3364
  }
3358
3365
  );
3359
- }, Hn = "0.3.0";
3366
+ }, zn = "0.3.1";
3360
3367
  export {
3361
3368
  _t as Glass,
3362
- Gn as GlassButton,
3363
- Pn as GlassCard,
3364
- $n as GlassNotification,
3365
- Un as GlassSegmentedControl,
3366
- Nn as GlassSlider,
3367
- On as GlassSwitch,
3369
+ Pn as GlassButton,
3370
+ Un as GlassCard,
3371
+ Hn as GlassNotification,
3372
+ On as GlassSegmentedControl,
3373
+ $n as GlassSlider,
3374
+ Nn as GlassSwitch,
3368
3375
  _t as LiquidGlass,
3369
- Hn as VERSION
3376
+ zn as VERSION
3370
3377
  };
@@ -1 +1 @@
1
- .matui-glass-button-shell{position:relative;display:inline-flex;border-radius:999px;vertical-align:middle;color:var(--matui-glass-fg, #17332e)}.matui-glass-button-shell>[data-liquid-glass]{background:#ffffff32}.matui-glass-button-shell.matui-glass-button--primary{background:#117a6c88;color:#102e28}.matui-glass-button--secondary{background:#ffffff30}.matui-glass-button--subtle{background:#ffffff10}.matui-glass-button{position:relative;font:inherit;font-weight:600;color:inherit;border:0;border-radius:inherit;background:transparent;cursor:pointer}.matui-glass-button--sm{padding:8px 14px;font-size:13px}.matui-glass-button--md{padding:12px 22px;font-size:14px}.matui-glass-button--lg{padding:16px 28px;font-size:16px}.matui-glass-button--icon{width:44px;height:44px;display:grid;place-items:center}.matui-glass-button:disabled{cursor:not-allowed;opacity:.45}.matui-glass-button-shell:has(:disabled){opacity:.6}.matui-glass-button:hover:enabled{background:#ffffff18}.matui-glass-button:focus-visible,.matui-glass-control:focus-within,.matui-glass-segment:focus-within{outline:3px solid var(--matui-glass-focus, #195fbb);outline-offset:4px}.matui-glass-card{display:inline-block;max-width:100%;border-radius:28px;background:#fff2;color:var(--matui-glass-fg, inherit)}.matui-glass-card--raised{box-shadow:0 8px 24px #172e2918}.matui-glass-card--floating{box-shadow:0 18px 48px #172e2930}.matui-glass-segmented{margin:0;padding:5px;min-width:0;display:inline-flex;flex-wrap:wrap;gap:4px;border:1px solid #ffffff66;border-radius:24px;background:#fff2;color:var(--matui-glass-fg, inherit)}.matui-glass-segment{position:relative;border-radius:18px}.matui-glass-segment label{position:relative;display:block;padding:10px 18px;cursor:pointer}.matui-glass-segment input,.matui-glass-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.matui-glass-segment:has(:disabled){opacity:.45}.matui-glass-segment:has(:disabled) label{cursor:not-allowed}
1
+ .matui-glass-button-shell{position:relative;display:inline-flex;border-radius:999px;vertical-align:middle;color:var(--matui-glass-fg, #17332e)}.matui-glass-button-shell>[data-liquid-glass]{background:transparent}.matui-glass-button-shell.matui-glass-button--primary{--matui-glass-button-tint: #a8ead829;color:#102e28}.matui-glass-button--secondary{--matui-glass-button-tint: #ffffff1a}.matui-glass-button--subtle{--matui-glass-button-tint: #ffffff0a}.matui-glass-button{position:relative;font:inherit;font-weight:600;color:inherit;border:0;border-radius:inherit;background:var(--matui-glass-button-tint, #ffffff0a);cursor:pointer}.matui-glass-button--sm{padding:8px 14px;font-size:13px}.matui-glass-button--md{padding:12px 22px;font-size:14px}.matui-glass-button--lg{padding:16px 28px;font-size:16px}.matui-glass-button--icon{width:44px;height:44px;display:grid;place-items:center}.matui-glass-button:disabled{cursor:not-allowed;opacity:.45}.matui-glass-button-shell:has(:disabled){opacity:.6}.matui-glass-button:hover:enabled{background:#ffffff18}.matui-glass-button:focus-visible,.matui-glass-control:focus-within,.matui-glass-segment:focus-within{outline:3px solid var(--matui-glass-focus, #195fbb);outline-offset:4px}.matui-glass-card{display:inline-block;max-width:100%;border-radius:28px;background:#fff2;color:var(--matui-glass-fg, inherit)}.matui-glass-card--raised{box-shadow:0 8px 24px #172e2918}.matui-glass-card--floating{box-shadow:0 18px 48px #172e2930}.matui-glass-segmented{margin:0;padding:5px;min-width:0;display:inline-flex;flex-wrap:wrap;gap:4px;border:1px solid #ffffff66;border-radius:24px;background:#fff2;color:var(--matui-glass-fg, inherit)}.matui-glass-segment{position:relative;border-radius:18px}.matui-glass-segment label{position:relative;display:block;padding:10px 18px;cursor:pointer}.matui-glass-segment input,.matui-glass-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.matui-glass-segment:has(:disabled){opacity:.45}.matui-glass-segment:has(:disabled) label{cursor:not-allowed}
@@ -13,7 +13,7 @@
13
13
  * native bundle. Native ports of the prebuilt components are out of scope for
14
14
  * this round (primitive only).
15
15
  */
16
- export declare const VERSION = "0.3.0";
16
+ export declare const VERSION = "0.3.1";
17
17
  export { LiquidGlass, type LiquidGlassNativeProps } from './liquid-glass.native';
18
18
  export type { DisplacementMode, GlassVariant, LiquidGlassCoreProps, MousePos, } from './types';
19
19
  export * from './tokens';
@@ -13,7 +13,7 @@
13
13
  * native bundle. Native ports of the prebuilt components are out of scope for
14
14
  * this round (primitive only).
15
15
  */
16
- export const VERSION = '0.3.0';
16
+ export const VERSION = '0.3.1';
17
17
  export { LiquidGlass } from './liquid-glass.native';
18
18
  // Shared design tokens (plan 022) — the same source of truth the web build uses.
19
19
  export * from './tokens';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aberhamm/liquid-glass-react",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "React liquid-glass components powered by the samasante liquid-glass engine, with a separate native frosted surface.",
5
5
  "type": "module",
6
6
  "license": "MIT",