import{jsx as e,jsxs as m,Fragment as u}from"react/jsx-runtime";import{memo as f,useRef as g,useState as d,useEffect as h}from"react";const w=f(function({serverId:o}){const i=g(null),[r,l]=d(!1),[n,a]=d(!1);return h(()=>{const s=i.current;if(!s)return;const t=new IntersectionObserver(([c])=>{c.isIntersecting&&(l(!0),t.unobserve(s))},{threshold:.1});return t.observe(s),()=>t.disconnect()},[]),e("div",{ref:i,className:`w-full animate-on-scroll-scale ${r?"visible":""}`,children:e("div",{className:"bg-card rounded-xl shadow-lg border overflow-hidden w-full",children:e("div",{className:"p-0 relative",style:{minHeight:"300px"},children:r?m(u,{children:[!n&&e("div",{className:"absolute inset-0 flex items-center justify-center bg-muted",children:e("div",{className:"animate-pulse text-muted-foreground",children:"Loading Discord..."})}),e("iframe",{src:`https://discord.com/widget?id=${o}&theme=dark`,width:"100%",height:"300",sandbox:"allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts",className:"border-0",title:"Discord Widget",loading:"lazy",onLoad:()=>a(!0)})]}):e("div",{className:"h-[300px] flex items-center justify-center bg-muted",children:e("div",{className:"text-muted-foreground",children:"Loading Discord widget..."})})})})})});export{w as DiscordWidget};
