better-auth-studio 1.0.57 → 1.0.58-beta.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.
@@ -506,7 +506,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
506
506
  }
507
507
  `;document.head.appendChild(g5);const Te=m.forwardRef(({className:e,type:t,...n},a)=>r.jsx("input",{type:t,className:`flex h-10 w-full border border-dashed border-white/20 bg-black/30 px-3 py-2 text-sm text-white placeholder:text-gray-400 focus:outline-none focus:ring-1 focus:ring-white focus:border-white/40 disabled:cursor-not-allowed disabled:opacity-50 rounded-none ${e}`,ref:a,...n}));Te.displayName="Input";const pe=m.forwardRef(({className:e,...t},n)=>r.jsx("label",{className:`text-sm font-light text-white ${e}`,ref:n,...t}));pe.displayName="Label";function b5({currentPage:e,totalPages:t,onPageChange:n,totalItems:a,startIndex:s,endIndex:i}){const o=()=>{const u=[],h=[];for(let d=Math.max(2,e-2);d<=Math.min(t-1,e+2);d++)u.push(d);return e-2>2?h.push(1,"..."):h.push(1),h.push(...u),e+2<t-1?h.push("...",t):t>1&&h.push(t),h};if(t<=1)return null;const l=o();return r.jsxs("div",{className:"flex items-center justify-between mt-6",children:[r.jsxs("div",{className:"text-sm text-gray-400",children:["Showing ",s+1," to ",Math.min(i,a)," of ",a," items"]}),r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsxs($,{variant:"outline",size:"sm",onClick:()=>n(e-1),disabled:e===1,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[r.jsx(VM,{className:"w-4 h-4"}),"Previous"]}),l.map((c,u)=>{if(c==="...")return r.jsx($,{variant:"outline",size:"sm",disabled:!0,className:"border border-dashed border-white/20 text-white rounded-none",children:r.jsx(HG,{className:"w-4 h-4"})},`dots-${u}`);const h=c,d=e===h;return r.jsx($,{variant:d?"default":"outline",size:"sm",onClick:()=>n(h),className:d?"bg-white text-black rounded-none":"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:h},h)}),r.jsxs($,{variant:"outline",size:"sm",onClick:()=>n(e+1),disabled:e===t,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:["Next",r.jsx(T1,{className:"w-4 h-4"})]})]})]})}const Tu=m.createContext({isOpen:!1,setIsOpen:()=>{}}),Ua=m.forwardRef(({className:e,value:t,onValueChange:n,children:a,...s},i)=>{const[o,l]=m.useState(!1);return r.jsx(Tu.Provider,{value:{value:t,onValueChange:n,isOpen:o,setIsOpen:l},children:r.jsx("div",{ref:i,className:`relative ${e}`,...s,children:a})})});Ua.displayName="Select";const Pa=m.forwardRef(({className:e,children:t,...n},a)=>{const{isOpen:s,setIsOpen:i}=m.useContext(Tu);return r.jsxs("button",{ref:a,type:"button",className:`flex h-10 w-full items-center justify-between border bg-black/30 px-3 py-2 text-sm text-white focus:outline-none focus:ring-1 focus:ring-white focus:border-white/40 disabled:cursor-not-allowed disabled:opacity-50 rounded-none ${e}`,onClick:()=>i(!s),...n,children:[t,r.jsx(bu,{className:`h-4 w-4 text-gray-400 transition-transform ${s?"rotate-180":""}`})]})});Pa.displayName="SelectTrigger";const yi=m.forwardRef(({className:e,placeholder:t,...n},a)=>{const{value:s}=m.useContext(Tu);return r.jsx("span",{ref:a,className:`text-sm text-white ${e}`,...n,children:s||t})});yi.displayName="SelectValue";const Fa=m.forwardRef(({className:e,children:t,...n},a)=>{const{isOpen:s}=m.useContext(Tu);return s?r.jsx("div",{ref:a,className:`absolute top-full left-0 right-0 z-[100] mt-1 border border-dashed border-white/20 bg-black rounded-none shadow-lg max-h-60 overflow-y-auto ${e}`,...n,children:t}):null});Fa.displayName="SelectContent";const Ve=m.forwardRef(({className:e,children:t,value:n,...a},s)=>{const{onValueChange:i,setIsOpen:o}=m.useContext(Tu);return r.jsx("div",{ref:s,className:`px-3 py-2 text-sm text-white hover:bg-white/10 cursor-pointer ${e}`,onClick:()=>{i==null||i(n),o(!1)},...a,children:t})});Ve.displayName="SelectItem";function x5(){const e=ur(),{counts:t,refetchCounts:n}=Mp(),[a,s]=m.useState([]),[i,o]=m.useState(!0),[l,c]=m.useState(null),[u,h]=m.useState(""),[d,f]=m.useState("all"),[p,v]=m.useState([]),[x,N]=m.useState(1),[b]=m.useState(20),[y,g]=m.useState(!1),[w,S]=m.useState(!1),[C,T]=m.useState(!1),[E,k]=m.useState(!1),[O,R]=m.useState(!1),[I,F]=m.useState(!1),[j,U]=m.useState(null),[_,M]=m.useState([]),[A,D]=m.useState(!1),[B,G]=m.useState({name:"",slug:""}),[L,q]=m.useState({name:"",slug:""});m.useEffect(()=>{ae();const re=setInterval(()=>{l!=null&&l.enabled||ae()},2e3);return()=>clearInterval(re)},[l==null?void 0:l.enabled]);const X=re=>re.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""),K=re=>{const we=X(re);G({name:re,slug:we})},ne=re=>{G(we=>({...we,slug:X(re)}))},te=re=>{const we=X(re);q({name:re,slug:we})},ee=re=>{q(we=>({...we,slug:X(re)}))},ae=async()=>{try{const we=await(await fetch("/api/plugins")).json(),Be=(we==null?void 0:we.plugins).find(V=>V.id==="organization");c({enabled:!!Be,availablePlugins:(we==null?void 0:we.plugins).map(V=>V.id),configPath:we.configPath,organizationPlugin:(we==null?void 0:we.plugins).find(V=>V.id==="organization")}),Be?await ge():o(!1)}catch(re){console.error("Failed to check plugin status:",re),c({enabled:!1,error:"Failed to check plugin status"}),o(!1)}},ge=async()=>{try{const we=await(await fetch("/api/organizations?limit=10000")).json();console.log({lenght:we.organizations.length}),s(we.organizations||[])}catch(re){console.error("Failed to fetch organizations:",re),H.error("Failed to fetch organizations")}finally{o(!1)}},se=async re=>{M([]),D(!0),M([{id:"start",type:"info",message:`Starting organization seeding process for ${re} organizations...`,timestamp:new Date}]);try{const Be=await(await fetch("/api/seed/organizations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:re})})).json();if(Be.success){const V=Be.results.map((he,xe)=>he.success?{id:`org-${xe}`,type:"progress",message:`Creating organization: ${he.organization.name} (${he.organization.slug})`,timestamp:new Date,status:"completed"}:{id:`org-${xe}`,type:"error",message:`Failed to create organization ${xe+1}: ${he.error}`,timestamp:new Date});M(he=>[...he,...V]);const le=Be.results.filter(he=>he.success).length;M(he=>[...he,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${le}/${re} organizations successfully`,timestamp:new Date}]),await ge(),await n()}else M(V=>[...V,{id:"error",type:"error",message:`❌ Seeding failed: ${Be.error||"Unknown error"}`,timestamp:new Date}])}catch(we){M(Be=>[...Be,{id:"error",type:"error",message:`❌ Network error: ${we}`,timestamp:new Date}])}finally{D(!1)}},fe=re=>{U(re),R(!0)},me=re=>{U(re),q({name:re.name,slug:re.slug}),T(!0)},Re=re=>{U(re),k(!0)},Me=async()=>{if(!B.name){H.error("Please fill in the organization name");return}const re=H.loading("Creating organization...");try{const Be=await(await fetch("/api/organizations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B.name,slug:B.slug})})).json();Be.success?(await ge(),g(!1),G({name:"",slug:""}),H.success("Organization created successfully!",{id:re})):H.error(`Error creating organization: ${Be.error||"Unknown error"}`,{id:re})}catch(we){console.error("Error creating organization:",we),H.error("Error creating organization",{id:re})}},Ue=async()=>{if(!j){H.error("No organization selected");return}if(!L.name){H.error("Please fill in the organization name");return}const re=H.loading("Updating organization...");try{const Be=await(await fetch(`/api/organizations/${j.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:L.name,slug:L.slug})})).json();Be.success?(await ge(),T(!1),U(null),q({name:"",slug:""}),H.success("Organization updated successfully!",{id:re})):H.error(`Error updating organization: ${Be.error||"Unknown error"}`,{id:re})}catch(we){console.error("Error updating organization:",we),H.error("Error updating organization",{id:re})}},$e=async()=>{if(!j){H.error("No organization selected");return}const re=H.loading("Deleting organization...");try{const Be=await(await fetch(`/api/organizations/${j.id}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();Be.success?(await ge(),await n(),k(!1),U(null),H.success("Organization deleted successfully!",{id:re})):H.error(`Error deleting organization: ${Be.error||"Unknown error"}`,{id:re})}catch(we){console.error("Error deleting organization:",we),H.error("Error deleting organization",{id:re})}},pt=()=>{if(a.length===0){H.error("No organizations to export");return}const re=["ID","Name","Slug","Created At","Updated At"],we=a.map(xe=>[xe.id,xe.name||"",xe.slug||"",new Date(xe.createdAt).toLocaleString(),new Date(xe.updatedAt).toLocaleString()]),Be=[re.join(","),...we.map(xe=>xe.map(De=>`"${De}"`).join(","))].join(`
508
508
  `),V=new Blob([Be],{type:"text/csv;charset=utf-8;"}),le=document.createElement("a"),he=URL.createObjectURL(V);le.setAttribute("href",he),le.setAttribute("download",`organizations-export-${new Date().toISOString().split("T")[0]}.csv`),le.style.visibility="hidden",document.body.appendChild(le),le.click(),document.body.removeChild(le),H.success(`Exported ${a.length} organizations to CSV`)},Ge=re=>{p.some(we=>we.type===re)||v([...p,{type:re}])},jt=re=>{v(p.filter(we=>we.type!==re))},vt=()=>{v([])},We=(re,we)=>{v(Be=>Be.map(V=>V.type===re?{...V,dateRange:we}:V))},et=a.filter(re=>{const we=re.name.toLowerCase().includes(u.toLowerCase())||re.slug.toLowerCase().includes(u.toLowerCase());if(p.length===0)return we;const Be=p.every(V=>{var le,he,xe,De;switch(V.type){case"createdAt":{if(!((le=V.dateRange)!=null&&le.from)&&!((he=V.dateRange)!=null&&he.to))return!0;const Ye=new Date(re.createdAt);return!((xe=V.dateRange)!=null&&xe.from&&V.dateRange.from>Ye||(De=V.dateRange)!=null&&De.to&&V.dateRange.to<Ye)}default:return!0}});return we&&Be}),Ze=Math.ceil(et.length/b),Et=(x-1)*b,Tt=Et+b,qt=et.slice(Et,Tt),Wt=re=>{N(re)};return i?r.jsx("div",{className:"flex min-h-screen items-center justify-center h-full",children:r.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[r.jsx(ir,{className:"w-6 h-6 text-white animate-spin"}),r.jsx("div",{className:"text-white text-sm",children:"Loading organizations..."})]})}):l&&!l.enabled?r.jsxs("div",{className:"space-y-6 p-6",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl text-white font-light",children:"Organizations"}),r.jsx("p",{className:"text-gray-400 font-light text-sm mt-1 uppercase font-mono",children:"Manage your application organizations"})]})}),r.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-8",children:r.jsxs("div",{className:"flex items-start space-x-4",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx(Er,{className:"w-12 h-12 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"Organization Plugin Required"}),r.jsx("p",{className:"text-gray-300 mb-6",children:"To use Organizations in Better Auth Studio, you need to enable the organization plugin in your Better Auth configuration."}),r.jsxs("div",{className:"bg-black/50 border border-dashed border-white/20 rounded-none p-4 mb-6",children:[r.jsx("h4",{className:"text-white font-light mb-3",children:"Follow these steps:"}),r.jsx("ol",{className:"text-gray-300 space-y-2 text-sm list-decimal list-inside",children:r.jsxs("li",{children:["Import the plugin in your auth configuration file",l.configPath&&r.jsxs("span",{className:"text-gray-400",children:[" (",l.configPath,")"]}),":"]})}),r.jsx("div",{className:"mt-4 bg-black/70 border border-dashed border-white/10 rounded-none p-3 overflow-x-auto",children:r.jsxs("pre",{className:"text-sm text-gray-300",children:[r.jsx("span",{className:"text-blue-400",children:"import"})," ","{ betterAuth }"," ",r.jsx("span",{className:"text-blue-400",children:"from"})," ",r.jsx("span",{className:"text-green-400",children:'"better-auth"'})," ",r.jsx("br",{}),r.jsx("span",{className:"text-blue-400",children:"import"})," ","{ organization }"," ",r.jsx("span",{className:"text-blue-400",children:"from"})," ",r.jsx("span",{className:"text-green-400",children:'"better-auth/plugins/organization"'})," ",r.jsx("br",{}),r.jsx("span",{className:"text-blue-400",children:"export const"})," ",r.jsx("span",{className:"text-yellow-300",children:"auth"})," ="," ",r.jsx("span",{className:"text-yellow-300",children:"betterAuth"}),"(","{"," ",r.jsx("br",{}),r.jsx("span",{className:"text-gray-500 pl-10",children:"// ... your existing configuration"})," ",r.jsx("br",{}),r.jsx("span",{className:"text-red-300 pl-10",children:"plugins"}),": [ ",r.jsx("br",{}),r.jsxs("span",{className:"text-yellow-300 pl-12",children:["organization(",")"]}),r.jsx("br",{}),r.jsx("span",{className:"pl-10",children:"]"})," ",r.jsx("br",{}),"}",") ",r.jsx("br",{})]})}),r.jsx("div",{className:"mt-4",children:r.jsx("p",{className:"text-gray-400 text-sm",children:"2. Do migrations to create the organizations table"})}),r.jsx("div",{className:"mt-2",children:r.jsx("p",{className:"text-gray-400 text-sm",children:"3. Restart your application to apply the changes"})})]}),l.availablePlugins&&l.availablePlugins.length>0&&r.jsx("div",{className:"mb-4",children:r.jsxs("p",{className:"text-gray-400 text-sm",children:["Currently enabled plugins: ",l.availablePlugins.join(", ")]})}),r.jsx($,{onClick:ae,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Check Again"}),r.jsxs("div",{className:"mt-4 text-xs text-gray-500",children:["Need help? Check the"," ",r.jsx("a",{href:"https://better-auth.com/docs/plugins/organization",target:"_blank",rel:"noopener noreferrer",className:"text-white hover:underline",children:"Better Auth Organization Plugin Documentation"})]})]})]})})]}):r.jsxs("div",{className:"space-y-6 p-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Organizations",r.jsx("sup",{className:"text-xs text-gray-500 ml-1 mt-0 inline-flex items-baseline",children:r.jsx(rr,{value:t.organizations??0,className:"text-white font-mono text-sm",prefix:r.jsx("span",{className:"mr-1 text-gray-500",children:"["}),suffix:r.jsx("span",{className:"ml-1 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]}),r.jsx("p",{className:"text-gray-400 font-light text-sm mt-1 uppercase font-mono",children:"Manage your organizations and teams"})]}),r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsxs($,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:pt,children:[r.jsx(ud,{className:"w-4 h-4 mr-2"}),"Export CSV"]}),r.jsxs($,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:()=>F(!0),children:[r.jsx(Vt,{className:"w-4 h-4 mr-2"}),"Seed"]}),r.jsxs($,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",onClick:()=>g(!0),children:[r.jsx(bi,{className:"w-4 h-4 mr-2"}),"Add Organization"]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(xo,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),r.jsx(Te,{placeholder:"Search organizations...",value:u,onChange:re=>h(re.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsx("div",{className:"flex items-center space-x-2",children:r.jsxs(Ua,{value:"",onValueChange:Ge,children:[r.jsx(Pa,{className:"w-[180px]",children:r.jsxs("div",{className:"flex mr-3 items-center space-x-2",children:[r.jsx(bi,{className:"w-4 h-4"}),r.jsx("span",{children:"Add Filter"})]})}),r.jsx(Fa,{children:!p.some(re=>re.type==="createdAt")&&r.jsx(Ve,{value:"createdAt",children:"Created Date"})})]})}),p.length>0&&r.jsx("div",{className:"flex items-center space-x-2",children:r.jsx($,{onClick:vt,children:"Clear all"})})]}),p.length>0&&r.jsx("div",{className:"space-y-3",children:r.jsx("div",{className:"flex flex-wrap gap-3",children:p.map(re=>{var we,Be,V,le;return r.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-2 bg-white/10 border border-white/20 rounded-sm",children:[r.jsx(C1,{className:"w-3 h-3 text-white"}),re.type==="createdAt"&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-white",children:"Created:"}),r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(_f,{className:"mr-1 h-3 w-3"}),(we=re.dateRange)!=null&&we.from?_a(re.dateRange.from,"MMM dd yyyy"):"From"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:(Be=re.dateRange)==null?void 0:Be.from,onSelect:he=>{var xe;return We("createdAt",{from:he,to:(xe=re.dateRange)==null?void 0:xe.to})},initialFocus:!0,className:"rounded-none"})})]}),r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(_f,{className:"mr-1 h-3 w-3"}),(V=re.dateRange)!=null&&V.to?_a(re.dateRange.to,"MMM dd yyyy"):"To"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:(le=re.dateRange)==null?void 0:le.to,onSelect:he=>{var xe;return We("createdAt",{from:(xe=re.dateRange)==null?void 0:xe.from,to:he})},initialFocus:!0,disabled:he=>{var xe;return(xe=re.dateRange)!=null&&xe.from?he<re.dateRange.from:!1},className:"rounded-none"})})]})]}),r.jsx("button",{onClick:()=>jt(re.type),className:"ml-1 hover:bg-white/20 rounded-full p-0.5",children:r.jsx(tn,{className:"w-3 h-3 text-white"})})]},re.type)})})})]}),r.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[r.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Organization"}),r.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Slug"}),r.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Created"}),r.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),r.jsx("tbody",{children:et.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:4,className:"py-12 px-4 text-center",children:r.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[r.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:r.jsx(Er,{className:"w-8 h-8 text-white/50"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-white font-medium text-lg",children:"No organizations found"}),r.jsx("p",{className:"text-gray-400 text-sm mt-1",children:u||d!=="all"?"Try adjusting your search or filter criteria":"Get started by creating your first organization"})]}),!u&&d==="all"&&r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsxs($,{onClick:()=>g(!0),className:"bg-white text-black hover:bg-gray-200 rounded-none",children:[r.jsx(bi,{className:"w-4 h-4 mr-2"}),"Create Organization"]}),r.jsxs($,{onClick:()=>F(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[r.jsx(Vt,{className:"w-4 h-4 mr-2"}),"Seed Data"]})]})]})})}):qt.map(re=>r.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5 cursor-pointer",onClick:()=>e(`/organizations/${re.id}`),children:[r.jsx("td",{className:"py-4 px-4",children:r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:r.jsx(Er,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-white font-light",children:re.name}),r.jsx(Ln,{id:re.id})]})]})}),r.jsx("td",{className:"py-4 px-4 text-white",children:re.slug}),r.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:r.jsxs("div",{className:"flex flex-col",children:[new Date(re.createdAt).toLocaleDateString(),r.jsx("p",{className:"text-xs",children:new Date(re.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]})}),r.jsx("td",{className:"py-4 px-4 text-right",children:r.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[r.jsx($,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:we=>{we.stopPropagation(),fe(re)},children:r.jsx(gi,{className:"w-4 h-4"})}),r.jsx($,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:we=>{we.stopPropagation(),me(re)},children:r.jsx(bo,{className:"w-4 h-4"})}),r.jsx($,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 rounded-none",onClick:we=>{we.stopPropagation(),Re(re)},children:r.jsx(xu,{className:"w-4 h-4"})})]})})]},re.id))})]})}),r.jsx(b5,{currentPage:x,totalPages:Ze,onPageChange:Wt,totalItems:et.length,startIndex:Et,endIndex:Tt})]}),I&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"overflow-x-hidden bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[r.jsx("span",{className:"text-white/50 mr-2",children:"["}),r.jsx(Er,{className:"inline mr-2 w-3.5 h-3.5 text-white"}),r.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed Organizations"}),r.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>F(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx(pe,{htmlFor:"organization-count",className:"text-sm text-gray-400 font-light",children:"Number of organizations"}),r.jsx(Te,{id:"organization-count",type:"number",min:"1",max:"100",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsx($,{onClick:()=>{var we;const re=parseInt(((we=document.getElementById("organization-count"))==null?void 0:we.value)||"5",10);se(re)},disabled:A,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:A?r.jsxs(r.Fragment,{children:[r.jsx(ir,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Vt,{className:"w-3 h-3 mr-2"}),"Seed Organizations"]})})]})}),_.length>0&&r.jsx("div",{className:"mt-6",children:r.jsx(ji,{title:"Organization Seeding Terminal",lines:_,isRunning:A,className:"w-full",defaultCollapsed:!0})})]}),r.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),r.jsx("div",{className:"flex justify-end mt-6 pt-6",children:r.jsx($,{variant:"outline",onClick:()=>F(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),y&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Create Organization"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"create-name",className:"text-sm text-gray-400 font-light",children:"Name"}),r.jsx(Te,{id:"create-name",value:B.name,onChange:re=>K(re.target.value),placeholder:"e.g. Acme Corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"create-slug",className:"text-sm text-gray-400 font-light",children:"Slug"}),r.jsx(Te,{id:"create-slug",value:B.slug,onChange:re=>ne(re.target.value),placeholder:"e.g. acme-corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Auto-generated from name. You can edit it manually."})]})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx($,{variant:"outline",onClick:()=>{g(!1),G({name:"",slug:""})},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:Me,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create"})]})]})}),C&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:re=>{re.target===re.currentTarget&&(T(!1),U(null),q({name:"",slug:""}))},children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",onClick:re=>re.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Edit Organization"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>{T(!1),U(null),q({name:"",slug:""})},className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:r.jsx(Er,{className:"w-8 h-8 text-white"})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-white font-light",children:j.name}),r.jsx("div",{className:"text-sm text-gray-400",children:j.slug})]})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"edit-name",className:"text-sm text-gray-400 font-light",children:"Name"}),r.jsx(Te,{id:"edit-name",value:L.name,onChange:re=>te(re.target.value),placeholder:"e.g. Acme Corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"edit-slug",className:"text-sm text-gray-400 font-light",children:"Slug"}),r.jsx(Te,{id:"edit-slug",value:L.slug,onChange:re=>ee(re.target.value),placeholder:"e.g. acme-corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Auto-generated from name. You can edit it manually."})]})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx($,{variant:"outline",onClick:()=>{T(!1),q({name:"",slug:""})},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:Ue,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update"})]})]})}),E&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Delete Organization"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>k(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:r.jsx(Er,{className:"w-8 h-8 text-white"})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-white font-light",children:j.name}),r.jsx("div",{className:"text-sm text-gray-400",children:j.slug})]})]}),r.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this organization? This action cannot be undone."})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx($,{variant:"outline",onClick:()=>k(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:$e,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete"})]})]})}),O&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Organization Details"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>R(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:r.jsx(Er,{className:"w-8 h-8 text-white"})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-white font-light",children:j.name}),r.jsx("div",{className:"text-sm text-gray-400",children:j.slug})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ln,{id:j.id,variant:"detail"}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-400",children:"Created:"}),r.jsx("span",{className:"text-white text-sm",children:new Date(j.createdAt).toLocaleString()})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-400",children:"Updated:"}),r.jsx("span",{className:"text-white text-sm",children:new Date(j.updatedAt).toLocaleString()})]})]})]}),r.jsx("div",{className:"flex justify-end mt-6",children:r.jsx($,{onClick:()=>R(!1),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Close"})})]})})]})}function y5(){const e=ur(),{counts:t,refetchCounts:n}=Mp(),[a,s]=m.useState([]),[i,o]=m.useState(!0),[l,c]=m.useState(""),[u,h]=m.useState([]),[d,f]=m.useState(1),[p]=m.useState(20),[v,x]=m.useState(!1),[N,b]=m.useState(!1),[y,g]=m.useState(!1),[w,S]=m.useState(!1),[C,T]=m.useState(!1),[E,k]=m.useState(!1),[O,R]=m.useState(!1),[I,F]=m.useState(!1),[j,U]=m.useState(null),[_,M]=m.useState(null),[A,D]=m.useState(""),[B,G]=m.useState(),[L,q]=m.useState(!1),[X,K]=m.useState(""),[ne,te]=m.useState(""),[ee,ae]=m.useState(""),[ge,se]=m.useState([]),[fe,me]=m.useState(!1),Re=m.useCallback(async()=>{try{const ie=await(await fetch("/api/users?limit=10000")).json();s(ie.users||[])}catch{}finally{o(!1)}},[]),Me=m.useCallback(async()=>{try{const ie=await(await fetch("/api/admin/status")).json();q(ie.enabled)}catch{q(!1)}},[]);m.useEffect(()=>{Re(),Me();const Q=()=>{_&&M(null)};return document.addEventListener("click",Q),()=>document.removeEventListener("click",Q)},[_,Me,Re]);const Ue=async(Q,ie)=>{se([]),me(!0),se([{id:"start",type:"info",message:`Starting user seeding process for ${Q} users...`,timestamp:new Date}]);try{const ue=await(await fetch("/api/seed/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:Q,role:ie||void 0})})).json();if(ue.success){const ke=ue.results.map((Y,be)=>Y.success?{id:`user-${be}`,type:"progress",message:`Creating user: ${Y.user.name} (${Y.user.email})`,timestamp:new Date,status:"completed"}:{id:`user-${be}`,type:"error",message:`Failed to create user ${be+1}: ${Y.error}`,timestamp:new Date});se(Y=>[...Y,...ke]);const W=ue.results.filter(Y=>Y.success).length;se(Y=>[...Y,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${W}/${Q} users successfully`,timestamp:new Date}]),await Re(),await n()}else se(ke=>[...ke,{id:"error",type:"error",message:`❌ Seeding failed: ${ue.error||"Unknown error"}`,timestamp:new Date}])}catch(Ne){se(ue=>[...ue,{id:"error",type:"error",message:`❌ Network error: ${Ne}`,timestamp:new Date}])}finally{me(!1)}},$e=Q=>{U(Q),S(!0)},pt=Q=>{U(Q),K(Q.role||""),b(!0)},Ge=Q=>{U(Q),g(!0)},jt=async()=>{var ke,W,Y;const Q=(ke=document.getElementById("create-name"))==null?void 0:ke.value,ie=(W=document.getElementById("create-email"))==null?void 0:W.value,Ne=(Y=document.getElementById("create-password"))==null?void 0:Y.value;if(!Q||!ie||!Ne){H.error("Please fill in all fields");return}const ue=H.loading("Creating user...");try{const He=await(await fetch("/api/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Q,email:ie,password:Ne,role:ee||null})})).json();He.success?(await Re(),x(!1),ae(""),document.getElementById("create-name").value="",document.getElementById("create-email").value="",document.getElementById("create-password").value="",H.success("User created successfully!",{id:ue})):H.error(`Error creating user: ${He.error||"Unknown error"}`,{id:ue})}catch{H.error("Error creating user",{id:ue})}},vt=async()=>{var ue,ke;if(!j){H.error("No user selected");return}const Q=(ue=document.getElementById("edit-name"))==null?void 0:ue.value,ie=(ke=document.getElementById("edit-email"))==null?void 0:ke.value;if(!Q||!ie){H.error("Please fill in all fields");return}const Ne=H.loading("Updating user...");try{const Y=await(await fetch(`/api/users/${j.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Q,email:ie,role:X||null})})).json();Y.success?(await Re(),b(!1),U(null),K(""),H.success("User updated successfully!",{id:Ne})):H.error(`Error updating user: ${Y.error||"Unknown error"}`,{id:Ne})}catch{H.error("Error updating user",{id:Ne})}},We=async()=>{if(!j){H.error("No user selected");return}const Q=H.loading("Deleting user...");try{const Ne=await(await fetch(`/api/users/${j.id}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();Ne.success?(await Re(),await n(),g(!1),U(null),H.success("User deleted successfully!",{id:Q})):H.error(`Error deleting user: ${Ne.error||"Unknown error"}`,{id:Q})}catch{H.error("Error deleting user",{id:Q})}},et=async()=>{if(!j)return;if(!L){H.error("Admin plugin is not enabled");return}const Q=H.loading("Banning user...");try{const ie=await fetch("/api/admin/ban-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:j.id,banReason:A||"No reason provided",banExpiresIn:B})}),Ne=await ie.json();ie.ok?(H.success("User banned successfully!",{id:Q}),k(!1),D(""),G(void 0),U(null),M(null),Re()):H.error(`Error banning user: ${Ne.error||Ne.message||"Unknown error"}`,{id:Q})}catch{H.error("Error banning user",{id:Q})}},Ze=async()=>{if(!j)return;if(!L){H.error("Admin plugin is not enabled");return}const Q=H.loading("Unbanning user...");try{const ie=await fetch("/api/admin/unban-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:j.id})}),Ne=await ie.json();ie.ok?(H.success("User unbanned successfully!",{id:Q}),R(!1),U(null),M(null),Re()):H.error(`Error unbanning user: ${Ne.error||Ne.message||"Unknown error"}`,{id:Q})}catch{H.error("Error unbanning user",{id:Q})}},Et=async()=>{var Ne;if(!j){H.error("No user selected");return}const Q=(Ne=document.getElementById("update-password"))==null?void 0:Ne.value;if(!Q){H.error("Please enter a new password");return}const ie=H.loading("Updating password...");try{const ue=await fetch(`/api/users/${j.id}/password`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:Q})}),ke=await ue.json();ue.ok&&ke.success?(H.success("Password updated successfully!",{id:ie}),F(!1),U(null),document.getElementById("update-password").value=""):H.error(`Error updating password: ${ke.error||"Unknown error"}`,{id:ie})}catch{H.error("Error updating password",{id:ie})}},Tt=()=>{if(a.length===0){H.error("No users to export");return}const Q=["ID","Name","Email","Email Verified","Created At","Updated At"],ie=a.map(Y=>[Y.id,Y.name||"",Y.email||"",!!Y.emailVerified,new Date(Y.createdAt).toLocaleString(),new Date(Y.updatedAt).toLocaleString()]),Ne=[Q.join(","),...ie.map(Y=>Y.map(be=>`"${be}"`).join(","))].join(`
509
- `),ue=new Blob([Ne],{type:"text/csv;charset=utf-8;"}),ke=document.createElement("a"),W=URL.createObjectURL(ue);ke.setAttribute("href",W),ke.setAttribute("download",`users-export-${new Date().toISOString().split("T")[0]}.csv`),ke.style.visibility="hidden",document.body.appendChild(ke),ke.click(),document.body.removeChild(ke),H.success(`Exported ${a.length} users to CSV`)},qt=Q=>{u.some(Ne=>Ne.type===Q)||(h(Ne=>[...Ne,{type:Q}]),f(1))},Wt=Q=>{h(ie=>ie.filter(Ne=>Ne.type!==Q)),f(1)},re=(Q,ie)=>{h(Ne=>Ne.map(ue=>ue.type===Q?{...ue,value:ie}:ue))},we=(Q,ie)=>{h(Ne=>Ne.map(ue=>ue.type===Q?{...ue,dateRange:ie}:ue))},Be=a.filter(Q=>{const ie=Q.name.toLowerCase().includes(l.toLowerCase())||Q.email.toLowerCase().includes(l.toLowerCase());if(u.length===0)return ie;const Ne=u.every(ue=>{var ke,W,Y,be,He;switch(ue.type){case"emailVerified":return ue.value===void 0?!0:Q.emailVerified===(ue.value==="true");case"banned":return ue.value===void 0?!0:Q.banned===(ue.value==="true");case"active":return Q.banned!==!0;case"createdAt":{if(!((ke=ue.dateRange)!=null&&ke.from)&&!((W=ue.dateRange)!=null&&W.to))return!0;const tt=new Date(Q.createdAt);return!((Y=ue.dateRange)!=null&&Y.from&&ue.dateRange.from>tt||(be=ue.dateRange)!=null&&be.to&&ue.dateRange.to<tt)}case"role":return ue.value?(He=Q.role)==null?void 0:He.toLowerCase().includes(ue.value.toLowerCase()):!0;default:return!0}});return ie&&Ne}),V=a.filter(Q=>Q.banned).length,le=Math.ceil(Be.length/p),he=(d-1)*p,xe=he+p,De=Be.slice(he,xe),Ye=Q=>{f(Q)};return i?r.jsx("div",{className:"flex min-h-screen items-center justify-center h-full",children:r.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[r.jsx(ir,{className:"w-6 h-6 text-white animate-spin"}),r.jsx("div",{className:"text-white text-sm",children:"Loading users..."})]})}):r.jsxs("div",{className:"space-y-6 p-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Users",r.jsx("sup",{className:"text-xs text-gray-500 ml-1 mt-0 inline-flex items-baseline",children:r.jsx(rr,{value:t.users??0,className:"text-white font-mono text-sm",prefix:r.jsx("span",{className:"mr-1 text-gray-500",children:"["}),suffix:r.jsx("span",{className:"ml-1 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]}),r.jsx("p",{className:"text-gray-400 font-light text-sm mt-1 uppercase font-mono",children:"Manage your application users"}),r.jsx("div",{className:"flex items-center space-x-4 mt-2",children:V>0&&r.jsxs("span",{className:"text-sm text-red-400 flex items-center space-x-1",children:[r.jsx(th,{className:"w-3 h-3"}),r.jsxs("span",{children:[V," Banned"]})]})})]}),r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsxs($,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:Tt,children:[r.jsx(ud,{className:"w-4 h-4 mr-2"}),"Export CSV"]}),r.jsxs($,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:()=>T(!0),children:[r.jsx(Vt,{className:"w-4 h-4 mr-2"}),"Seed"]}),r.jsxs($,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",onClick:()=>x(!0),children:[r.jsx(Uw,{className:"w-4 h-4 mr-2"}),"Add User"]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(xo,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),r.jsx(Te,{placeholder:"Search users...",value:l,onChange:Q=>c(Q.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsx("div",{className:"flex items-center space-x-2",children:r.jsxs(Ua,{value:"",onValueChange:qt,children:[r.jsx(Pa,{className:"w-[180px]",children:r.jsxs("div",{className:"flex mr-3 items-center space-x-2",children:[r.jsx(bi,{className:"w-4 h-4"}),r.jsx("span",{children:"Add Filter"})]})}),r.jsxs(Fa,{children:[!u.some(Q=>Q.type==="emailVerified")&&r.jsx(Ve,{value:"emailVerified",children:"Email Verified"}),!u.some(Q=>Q.type==="banned")&&r.jsx(Ve,{value:"banned",children:"Banned Status"}),!u.some(Q=>Q.type==="createdAt")&&r.jsx(Ve,{value:"createdAt",children:"Created Date"}),!u.some(Q=>Q.type==="role")&&r.jsx(Ve,{value:"role",children:"Role"})]})]})}),u.length>0&&r.jsx("div",{className:"flex items-center space-x-2",children:r.jsx($,{onClick:()=>h([]),className:"",children:"Clear all"})})]}),u.length>0&&r.jsx("div",{className:"space-y-3",children:r.jsx("div",{className:"flex flex-wrap gap-3",children:u.map(Q=>{var ie,Ne,ue,ke;return r.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-2 bg-white/10 border border-white/20 rounded-sm",children:[r.jsx(C1,{className:"w-3 h-3 text-white"}),Q.type==="emailVerified"&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-white",children:"Email Verified:"}),r.jsxs(Ua,{value:Q.value||"",onValueChange:W=>re("emailVerified",W),children:[r.jsx(Pa,{className:"h-7 w-24 text-xs",children:r.jsx("span",{children:Q.value==="true"?"True":Q.value==="false"?"False":"Select"})}),r.jsxs(Fa,{children:[r.jsx(Ve,{value:"true",children:"True"}),r.jsx(Ve,{value:"false",children:"False"})]})]})]}),Q.type==="banned"&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-white",children:"Banned:"}),r.jsxs(Ua,{value:Q.value||"",onValueChange:W=>re("banned",W),children:[r.jsx(Pa,{className:"h-7 w-24 text-xs",children:r.jsx("span",{children:Q.value==="true"?"Yes":Q.value==="false"?"No":"Select"})}),r.jsxs(Fa,{children:[r.jsx(Ve,{value:"true",children:"Yes"}),r.jsx(Ve,{value:"false",children:"No"})]})]})]}),Q.type==="createdAt"&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-white",children:"Created:"}),r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(_f,{className:"mr-1 h-3 w-3"}),(ie=Q.dateRange)!=null&&ie.from?_a(Q.dateRange.from,"MMM dd yyyy"):"From"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:(Ne=Q.dateRange)==null?void 0:Ne.from,onSelect:W=>{var Y;return we("createdAt",{from:W,to:(Y=Q.dateRange)==null?void 0:Y.to})},initialFocus:!0,className:"rounded-none"})})]}),r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(_f,{className:"mr-1 h-3 w-3"}),(ue=Q.dateRange)!=null&&ue.to?_a(Q.dateRange.to,"MMM dd yyyy"):"To"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:(ke=Q.dateRange)==null?void 0:ke.to,onSelect:W=>{var Y;return we("createdAt",{from:(Y=Q.dateRange)==null?void 0:Y.from,to:W})},initialFocus:!0,disabled:W=>{var Y;return(Y=Q.dateRange)!=null&&Y.from?W<Q.dateRange.from:!1},className:"rounded-none"})})]})]}),Q.type==="role"&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-white",children:"Role:"}),r.jsx(Te,{type:"text",value:Q.value||"",onChange:W=>re("role",W.target.value),className:"h-7 w-32 text-xs bg-black border-white/20 text-white",placeholder:"Enter role..."})]}),r.jsx("button",{onClick:()=>Wt(Q.type),className:"ml-1 hover:bg-white/20 rounded-full p-0.5",children:r.jsx(tn,{className:"w-3 h-3 text-white"})})]},Q.type)})})})]}),r.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:[r.jsx("div",{className:"overflow-x-auto overflow-y-hidden",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[r.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User"}),r.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email Status"}),r.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),r.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Created"}),r.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),r.jsx("tbody",{children:De.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:5,className:"py-12 px-4 text-center",children:r.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[r.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:r.jsx(yo,{className:"w-8 h-8 text-white/50"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-white font-medium text-lg",children:"No users found"}),r.jsx("p",{className:"text-gray-400 text-sm mt-1",children:l||u.length>0?"Try adjusting your search or filter criteria":"Get started by creating your first user or seeding some data"})]}),!l&&u.length===0&&r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsxs($,{onClick:()=>x(!0),className:"bg-white text-black hover:bg-gray-200 rounded-none",children:[r.jsx(Uw,{className:"w-4 h-4 mr-2"}),"Create User"]}),r.jsxs($,{onClick:()=>T(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[r.jsx(Vt,{className:"w-4 h-4 mr-2"}),"Seed Data"]})]})]})})}):De.map(Q=>r.jsxs("tr",{className:`border-b border-dashed hover:bg-white/5 cursor-pointer ${Q.banned?"border-red-500/30 bg-red-500/5":"border-white/5"}`,onClick:()=>e(`/users/${Q.id}`),children:[r.jsx("td",{className:"py-4 px-4",children:r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:Q.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${Q.id}`,alt:Q.name,className:`w-10 h-10 rounded-none border border-dashed ${Q.banned?"border-red-400/50 opacity-60":"border-white/20"}`}),Q.banned&&r.jsx("div",{className:"absolute -top-1 -right-1 bg-red-500 rounded-full p-0.5",children:r.jsx(th,{className:"w-3 h-3 text-white"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"text-white font-light",children:Q.name}),Q.banned&&r.jsxs("span",{className:"relative group inline-block",children:[r.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold bg-red-500/20 border border-red-500/50 text-red-400 rounded-sm uppercase tracking-wide cursor-help",children:"Banned"}),Q.banReason&&r.jsxs("span",{className:"absolute left-1/2 -translate-x-1/2 bottom-full mb-1.5 px-2 py-1 text-[10px] font-mono text-gray-300 bg-black border border-dashed border-white/20 rounded-none whitespace-nowrap opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-150 pointer-events-none z-50",children:[Q.banReason,r.jsx("span",{className:"absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-l-[4px] border-r-[4px] border-t-[4px] border-transparent border-t-white/20"})]})]})]}),r.jsx("div",{className:"text-sm text-gray-400 mt-0.5",children:Q.email})]})]})}),r.jsx("td",{className:"py-4 px-4",children:r.jsxs("div",{className:"flex items-center space-x-2",children:[Q.emailVerified?r.jsx(Rf,{className:"w-4 h-4 text-green-400"}):r.jsx(Xl,{className:"w-4 h-4 text-yellow-400"}),r.jsx("span",{className:"text-sm text-gray-400",children:Q.emailVerified?"Verified":"Not Verified"})]})}),r.jsx("td",{className:"py-4 px-4",children:Q.role?r.jsx("span",{className:"px-2 py-1 text-xs font-mono uppercase bg-white/5 border border-dashed border-white/15 text-white/80 rounded-sm tracking-wide",children:Q.role}):r.jsx("span",{className:"text-sm text-gray-500",children:"—"})}),r.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:r.jsxs("div",{className:"flex flex-col",children:[new Date(Q.createdAt).toLocaleDateString(),r.jsx("p",{className:"text-xs",children:new Date(Q.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]})}),r.jsx("td",{className:"py-4 px-4 text-right",children:r.jsxs("div",{className:"relative flex items-center justify-end",children:[r.jsx($,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:ie=>{ie.stopPropagation(),M(_===Q.id?null:Q.id)},children:r.jsx(WM,{className:"w-4 h-4"})}),_===Q.id&&r.jsxs("div",{className:"absolute z-[999] right-0 top-full mt-1 w-48 bg-black border border-white/20 rounded-none shadow-lg",onClick:ie=>ie.stopPropagation(),children:[r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:ie=>{ie.stopPropagation(),M(null),$e(Q)},children:[r.jsx(gi,{className:"w-4 h-4"}),r.jsx("span",{children:"View"})]}),r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:ie=>{ie.stopPropagation(),M(null),pt(Q)},children:[r.jsx(bo,{className:"w-4 h-4"}),r.jsx("span",{children:"Edit User"})]}),r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:ie=>{ie.stopPropagation(),M(null),U(Q),F(!0)},children:[r.jsx(Cn,{className:"w-4 h-4"}),r.jsx("span",{children:"Update Password"})]}),L&&(Q.banned?r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-green-400 hover:bg-white/10 flex items-center space-x-2",onClick:ie=>{ie.stopPropagation(),U(Q),R(!0),M(null)},children:[r.jsx(th,{className:"w-4 h-4"}),r.jsx("span",{children:"Unban User"})]}):r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-yellow-400 hover:bg-white/10 flex items-center space-x-2",onClick:ie=>{ie.stopPropagation(),U(Q),k(!0),M(null)},children:[r.jsx(th,{className:"w-4 h-4"}),r.jsx("span",{children:"Ban User"})]})),r.jsx("div",{className:"border-t border-white/10 my-1"}),r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-red-400 hover:bg-white/10 flex items-center space-x-2",onClick:ie=>{ie.stopPropagation(),M(null),Ge(Q)},children:[r.jsx(xu,{className:"w-4 h-4"}),r.jsx("span",{children:"Delete User"})]})]})]})})]},Q.id))})]})}),r.jsx(b5,{currentPage:d,totalPages:le,onPageChange:Ye,totalItems:Be.length,startIndex:he,endIndex:xe})]}),C&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"overflow-x-hidden bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[r.jsx("span",{className:"text-white/50 mr-2",children:"["}),r.jsx(yo,{className:"inline mr-2 w-3 h-3 text-white"}),r.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed User"}),r.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>{T(!1),te("")},className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center space-x-2"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center space-x-3",children:r.jsxs("div",{className:"flex-1",children:[r.jsx(pe,{htmlFor:"user-count",className:"text-sm text-gray-400 font-light",children:"Number of users"}),r.jsx(Te,{id:"user-count",type:"number",min:"1",max:"100",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})}),r.jsxs("div",{className:"flex-1",children:[r.jsx(pe,{htmlFor:"seed-role",className:"text-sm text-gray-400 font-light",children:"Role (optional)"}),r.jsxs(Ua,{className:"bg-black text-white",value:ne,onValueChange:te,children:[r.jsx(Pa,{id:"seed-role",className:"mt-1 border border-dashed border-white/20 bg-black text-white rounded-none",children:r.jsx(yi,{placeholder:"Select role (optional)"})}),r.jsxs(Fa,{children:[r.jsx(Ve,{value:"",children:"None"}),r.jsx(Ve,{value:"admin",children:"Admin"}),r.jsx(Ve,{value:"user",children:"User"}),r.jsx(Ve,{value:"mix",children:"Mix (Random)"})]})]})]}),r.jsx($,{onClick:()=>{var ie;const Q=parseInt(((ie=document.getElementById("user-count"))==null?void 0:ie.value)||"5",10);Ue(Q,ne||void 0)},disabled:fe,className:"bg-transparent hover:bg-white/90 bg-white text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:fe?r.jsxs(r.Fragment,{children:[r.jsx(ir,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Vt,{className:"w-3 h-3 mr-2"}),"Seed Users"]})})]})]}),ge.length>0&&r.jsx("div",{className:"mt-6",children:r.jsx(ji,{title:"User Seeding Terminal",lines:ge,isRunning:fe,className:"w-full",defaultCollapsed:!0})})]}),r.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),r.jsx("div",{className:"flex justify-end mt-6 pt-6",children:r.jsx($,{variant:"outline",onClick:()=>{T(!1),te("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),v&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-white/10 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Create User"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>{x(!1),ae("")},className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"create-name",className:"text-sm text-gray-400 font-light",children:"Name"}),r.jsx(Te,{id:"create-name",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"create-email",className:"text-sm text-gray-400 font-light",children:"Email"}),r.jsx(Te,{id:"create-email",type:"email",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"create-password",className:"text-sm text-gray-400 font-light",children:"Password"}),r.jsx(Te,{id:"create-password",type:"password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"create-role",className:"text-sm text-gray-400 font-light",children:"Role"}),r.jsxs(Ua,{className:"bg-black text-white",value:ee,onValueChange:ae,children:[r.jsx(Pa,{id:"create-role",className:"mt-1 border border-dashed border-white/20 bg-black text-white rounded-none",children:r.jsx(yi,{placeholder:"Select role"})}),r.jsxs(Fa,{children:[r.jsx(Ve,{value:"",children:"None"}),r.jsx(Ve,{value:"admin",children:"Admin"}),r.jsx(Ve,{value:"user",children:"User"})]})]})]})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx($,{variant:"outline",onClick:()=>{x(!1),ae("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:jt,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create"})]})]})}),N&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Edit User"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>{b(!1),K("")},className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("img",{src:j.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${j.id}`,alt:j.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-white font-light",children:j.name}),r.jsx("div",{className:"text-sm text-gray-400",children:j.email})]})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"edit-name",className:"text-sm text-gray-400 font-light",children:"Name"}),r.jsx(Te,{id:"edit-name",defaultValue:j.name,className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"edit-email",className:"text-sm text-gray-400 font-light",children:"Email"}),r.jsx(Te,{id:"edit-email",type:"email",defaultValue:j.email,className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"edit-role",className:"text-sm text-gray-400 font-light",children:"Role"}),r.jsxs(Ua,{value:X,onValueChange:K,children:[r.jsx(Pa,{id:"edit-role",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none",children:r.jsx(yi,{placeholder:"Select role"})}),r.jsxs(Fa,{children:[r.jsx(Ve,{value:"",children:"None"}),r.jsx(Ve,{value:"admin",children:"Admin"}),r.jsx(Ve,{value:"user",children:"User"})]})]})]})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx($,{variant:"outline",onClick:()=>{b(!1),K("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:vt,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update"})]})]})}),y&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Delete User"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("img",{src:j.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${j.id}`,alt:j.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-white font-light",children:j.name}),r.jsx("div",{className:"text-sm text-gray-400",children:j.email})]})]}),r.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this user? This action cannot be undone."})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx($,{variant:"outline",onClick:()=>g(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:We,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete"})]})]})}),w&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"User Details"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("img",{src:j.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${j.id}`,alt:j.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-white font-light",children:j.name}),r.jsx("div",{className:"text-sm text-gray-400",children:j.email})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ln,{id:j.id,variant:"detail"}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-400",children:"Email Verified:"}),r.jsx("span",{className:"text-white text-sm",children:j.emailVerified?"Yes":"No"})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-400",children:"Created:"}),r.jsx("span",{className:"text-white text-sm",children:new Date(j.createdAt).toLocaleString()})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-400",children:"Updated:"}),r.jsx("span",{className:"text-white text-sm",children:new Date(j.updatedAt).toLocaleString()})]})]})]}),r.jsx("div",{className:"flex justify-end mt-6",children:r.jsx($,{onClick:()=>S(!1),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Close"})})]})}),E&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black border border-red-400/20 rounded-none p-6 w-full max-w-md",children:[r.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Ban User"}),r.jsxs("p",{className:"text-gray-400 mb-4",children:["Ban ",r.jsx("strong",{children:j.name})," from accessing the system."]}),r.jsxs("div",{className:"space-y-4 mb-6",children:[r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"banReason",className:"text-white",children:"Ban Reason"}),r.jsx(Te,{id:"banReason",value:A,onChange:Q=>D(Q.target.value),placeholder:"Enter reason for ban (optional)",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"banExpires",className:"text-white",children:"Ban Duration (seconds)"}),r.jsx(Te,{id:"banExpires",type:"number",value:B||"",onChange:Q=>G(Q.target.value?Number(Q.target.value):void 0),placeholder:"Leave empty for permanent ban",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Examples: 3600 (1 hour), 86400 (1 day), 604800 (1 week)"})]})]}),r.jsxs("div",{className:"flex justify-end space-x-2",children:[r.jsx($,{variant:"outline",onClick:()=>{k(!1),D(""),G(void 0),U(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:et,className:"bg-red-600 text-white hover:bg-red-700 rounded-none",children:"Ban User"})]})]})}),O&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black border border-dashed border-green-400/50 rounded-none p-6 w-full max-w-md",children:[r.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Unban User"}),r.jsxs("p",{className:"text-gray-400 mb-6",children:["Are you sure you want to unban ",r.jsx("strong",{children:j.name}),"? This will restore their access to the system."]}),r.jsxs("div",{className:"flex justify-end space-x-2",children:[r.jsx($,{variant:"outline",onClick:()=>{R(!1),U(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:Ze,className:"bg-green-600 text-white hover:bg-green-700 rounded-none",children:"Unban User"})]})]})}),I&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Update Password"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>{F(!1),U(null),document.getElementById("update-password").value=""},className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("img",{src:j.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${j.id}`,alt:j.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-white font-light",children:j.name}),r.jsx("div",{className:"text-sm text-gray-400",children:j.email})]})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"update-password",className:"text-sm text-gray-400 font-light",children:"New Password"}),r.jsx(Te,{id:"update-password",type:"password",placeholder:"Enter new password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx($,{variant:"outline",onClick:()=>{F(!1),U(null),document.getElementById("update-password").value=""},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:Et,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update Password"})]})]})})]})}const Lc=[{id:"signups",label:"Signups",analyticsKey:"newUsers",barClass:"bg-white/25 border border-white/10",dotClass:"bg-white/25"},{id:"logins",label:"Logins",analyticsKey:"activeUsers",barClass:"bg-white/20 border border-white/10",dotClass:"bg-white/20"},{id:"organizations",label:"Organizations",analyticsKey:"organizations",barClass:"bg-white/15 border border-white/10",dotClass:"bg-white/15"},{id:"teams",label:"Teams",analyticsKey:"teams",barClass:"bg-white/10 border border-white/10",dotClass:"bg-white/10"},{id:"sessions",label:"Sessions",analyticsKey:"sessions",barClass:"bg-white/5 border border-white/10",dotClass:"bg-white/5"}];function Pte(){const[e]=m.useState("overview"),[t,n]=m.useState(!1),[a,s]=m.useState(0),[i,o]=m.useState(0),[l,c]=m.useState("1D"),[u,h]=m.useState("1D"),[d,f]=m.useState(null),[p,v]=m.useState(!1),[x,N]=m.useState("Daily"),[b,y]=m.useState("Daily"),[g,w]=m.useState("Daily"),[S,C]=m.useState("Daily"),[T,E]=m.useState(!1),[k,O]=m.useState(!1),[R,I]=m.useState(!1),[F,j]=m.useState(!1),[U,_]=m.useState(null),[M,A]=m.useState(null),[D,B]=m.useState(null),[G,L]=m.useState(null),[q,X]=m.useState(null),[K,ne]=m.useState(void 0),[te,ee]=m.useState(void 0),[ae,ge]=m.useState(void 0),[se,fe]=m.useState(void 0),[me,Re]=m.useState(void 0),[Me,Ue]=m.useState(void 0),[$e,pt]=m.useState(void 0),[Ge,jt]=m.useState(void 0),[vt,We]=m.useState([]),[et,Ze]=m.useState([]),[Et,Tt]=m.useState(0),[qt,Wt]=m.useState([]),[re,we]=m.useState([]),[Be,V]=m.useState(0),[le,he]=m.useState(0),[xe,De]=m.useState(0),[Ye,Q]=m.useState(0),[ie,Ne]=m.useState(0),[ue,ke]=m.useState(!1),[W,Y]=m.useState(!1),[be,He]=m.useState({signups:[],logins:[],organizations:[],teams:[],sessions:[]}),[tt,rt]=m.useState([]),[Qe,Jt]=m.useState(!1),[pn,ln]=m.useState(0),[Xt,Gr]=m.useState(0),[wn,Rn]=m.useState(0),[Va,Vr]=m.useState(0),[Do,As]=m.useState(0),[Ya,kt]=m.useState([]),[Yr,Wr]=m.useState(0),[Xr,pr]=m.useState(0),[Kr,mr]=m.useState(0),{counts:Wa,loading:Fn}=Mp(),Bn=ur(),Ea=["Daily","Weekly","Monthly","Yearly","Custom"],js={Daily:"1D",Weekly:"1W",Monthly:"1M",Yearly:"1Y",Custom:"Custom"},Qn=m.useMemo(()=>new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1}),[]),Jn=ye=>ye==null?"...":Qn.format(Number(ye)),Xa=ye=>ye==null?"...":Number(ye).toLocaleString(),ks=m.useMemo(()=>Lc.reduce((ye,ve)=>(ye[ve.id]=(be[ve.id]||[]).reduce((Ee,de)=>Ee+de,0),ye),{}),[be]),_s=m.useMemo(()=>Object.values(ks).reduce((ye,ve)=>ye+ve,0),[ks]),Io=(ye,ve)=>{const Ee=ye.currentTarget.getBoundingClientRect();L(ve),X({x:Ee.left+Ee.width/2,y:Ee.top})},Mi=(()=>{const ye=[];return U!=null&&U.isOutdated?ye.push({id:"version-check",title:`Update Better-Auth to v${U.latest}`,severity:"high",date:new Date().toISOString().split("T")[0],description:"Your current version is outdated. Update to the latest version to get the latest security fixes, features, and improvements. Run: `pnpm install better-auth@latest`",affectedComponents:["All Components"],status:"pending",cve:""}):U&&ye.push({id:"version-check",title:"Better-Auth is Up to date",severity:"low",date:new Date().toISOString().split("T")[0],description:"You are running the latest version of better-auth. Great job keeping your dependencies up to date!",affectedComponents:["All Components"],status:"applied",cve:""}),ye.push(),ye.push({id:"3",title:"Rate Limiting Configuration",severity:"medium",date:new Date().toISOString().split("T")[0],description:"Configure rate limiting for authentication endpoints to prevent brute force attacks. Better-auth provides built-in rate limiting middleware.",affectedComponents:["Auth Endpoints"],status:"pending"}),ye})(),dt=m.useCallback(async(ye,ve,Ee,de)=>{try{const je=new URLSearchParams({type:ye,period:ve});return Ee&&je.append("from",Ee.toISOString()),de&&je.append("to",de.toISOString()),await(await fetch(`/api/analytics?${je.toString()}`)).json()}catch{return null}},[]);m.useEffect(()=>{(async()=>{try{const Ee=await(await fetch("/api/users/all")).json();Ee!=null&&Ee.success&&Ee.users&&kt(Ee.users)}catch{kt([])}})()},[]),m.useEffect(()=>{(async()=>{try{const Ee=await(await fetch("/api/stats")).json();Ee&&s(Ee.activeUsers||0)}catch{s(0)}})()},[]),m.useEffect(()=>{(async()=>{const ve=await dt("users",l,K,te);ve&&(We(ve.data||[]),Ze(ve.labels||[]),Tt(ve.percentageChange||0))})()},[l,K,te,dt]),m.useEffect(()=>{if(Ya.length===0){Wr(0),pr(0);return}const ye=new Date;let ve,Ee=ye,de,je;if(b==="Custom"){if(!ae||!se){Wr(0),pr(0);return}ve=new Date(ae),Ee=new Date(se),Ee.setHours(23,59,59,999);const _t=Ee.getTime()-ve.getTime();je=new Date(ve.getTime()-1),de=new Date(je.getTime()-_t)}else switch(b){case"Daily":ve=new Date(ye),ve.setHours(0,0,0,0),je=new Date(ve.getTime()-1),de=new Date(je.getTime()-24*60*60*1e3);break;case"Weekly":ve=new Date(ye),ve.setDate(ye.getDate()-ye.getDay()),ve.setHours(0,0,0,0),je=new Date(ve.getTime()-1),de=new Date(je.getTime()-7*24*60*60*1e3);break;case"Monthly":ve=new Date(ye.getFullYear(),ye.getMonth(),1),ve.setHours(0,0,0,0),je=new Date(ve.getTime()-1),de=new Date(ye.getFullYear(),ye.getMonth()-1,1),de.setHours(0,0,0,0);break;case"Yearly":ve=new Date(ye.getFullYear(),0,1),ve.setHours(0,0,0,0),je=new Date(ve.getTime()-1),de=new Date(ye.getFullYear()-1,0,1),de.setHours(0,0,0,0);break;default:Wr(0),pr(0);return}const Le=Ya.filter(_t=>{if(!_t.createdAt)return!1;const zn=new Date(_t.createdAt);return zn>=ve&&zn<=Ee}),Oe=Ya.filter(_t=>{if(!_t.createdAt)return!1;const zn=new Date(_t.createdAt);return zn>=de&&zn<=je}),Ce=Le.length,nt=Oe.length;let _e=0;nt>0?_e=(Ce-nt)/nt*100:Ce>0&&(_e=100),Wr(Ce),pr(_e)},[Ya,b,ae,se]),m.useEffect(()=>{(async()=>{if(!(u==="Custom"&&(!ae||!se))){Jt(!0);try{const[ve,Ee,de,je,Le]=await Promise.all([dt("newUsers",u,ae,se),dt("activeUsers",u,ae,se),dt("organizations",u,ae,se),dt("teams",u,ae,se),dt("sessions",u,ae,se)]);ve&&(Wt(ve.data||[]),we(ve.labels||[])),He({signups:(ve==null?void 0:ve.data)||[],logins:(Ee==null?void 0:Ee.data)||[],organizations:(de==null?void 0:de.data)||[],teams:(je==null?void 0:je.data)||[],sessions:(Le==null?void 0:Le.data)||[]}),rt((ve==null?void 0:ve.labels)||(Ee==null?void 0:Ee.labels)||(de==null?void 0:de.labels)||(je==null?void 0:je.labels)||(Le==null?void 0:Le.labels)||[])}finally{Jt(!1)}}})()},[u,ae,se,dt]),m.useEffect(()=>{(async()=>{const ve=await dt("activeUsers","1D");ve&&V(ve.percentageChange||0)})()},[dt]),m.useEffect(()=>{},[Wa.organizations,Wa.teams,Fn]),m.useEffect(()=>{(async()=>{const ve=js[g]||"1D",Ee=ve==="Custom";if(!(Ee&&(!me||!Me))){ke(!0);try{const de=await dt("organizations",ve,Ee?me:void 0,Ee?Me:void 0);de&&(Q(de.total||0),he(de.percentageChange||0))}catch{Q(0),he(0)}finally{ke(!1)}}})()},[g,me,Me,dt]),m.useEffect(()=>{(async()=>{const ve=js[S]||"1D",Ee=ve==="Custom";if(!(Ee&&(!$e||!Ge))){Y(!0);try{const de=await dt("teams",ve,Ee?$e:void 0,Ee?Ge:void 0);de&&(Ne(de.total||0),De(de.percentageChange||0))}catch{Ne(0),De(0)}finally{Y(!1)}}})()},[S,$e,Ge,dt]),m.useEffect(()=>{(async()=>{const ve=await dt("users","1D");ve&&ln(ve.percentageChange||0);const Ee=await dt("organizations","1D");Ee&&Gr(Ee.percentageChange||0);const de=await dt("activeUsers","1D");de&&Rn(de.percentageChange||0);const[je,Le,Oe,Ce,nt]=await Promise.all([dt("newUsers","1D"),dt("activeUsers","1D"),dt("organizations","1D"),dt("teams","1D"),dt("sessions","1D")]);je?(o(je.total||0),mr(je.percentageChange||0)):(o(0),mr(0));const _t=[(je==null?void 0:je.total)||0,(Le==null?void 0:Le.total)||0,(Oe==null?void 0:Oe.total)||0,(Ce==null?void 0:Ce.total)||0,(nt==null?void 0:nt.total)||0].reduce((ea,Li)=>ea+Li,0);As(_t);const Ca=[(je==null?void 0:je.previousTotal)||0,(Le==null?void 0:Le.previousTotal)||0,(Oe==null?void 0:Oe.previousTotal)||0,(Ce==null?void 0:Ce.previousTotal)||0,(nt==null?void 0:nt.previousTotal)||0].reduce((ea,Li)=>ea+Li,0);if(Ca>0){const ea=(_t-Ca)/Ca*100;Vr(ea)}else _t>0?Vr(100):Vr(0)})()},[dt]),m.useEffect(()=>{(async()=>{try{const Ee=await(await fetch("/api/version-check")).json();Ee&&_({current:Ee.current||"1.0.0",latest:Ee.latest||"1.0.0",isOutdated:Ee.isOutdated||!1})}catch{try{const je=(await(await fetch("/api/package-info")).json()).betterAuthVersion||"1.0.0",Le="1.5.0";_({current:je,latest:Le,isOutdated:je!==Le})}catch{_({current:"1.0.0",latest:"1.5.0",isOutdated:!0})}}})()},[]);const gr=ye=>{switch(ye){case"critical":return"bg-white/10 text-white border-white/20";case"high":return"bg-white/10 text-white border-white/20";case"medium":return"bg-white/10 text-gray-300 border-white/20";case"low":return"bg-white/10 text-gray-400 border-white/20";default:return"bg-white/10 text-gray-400 border-white/20"}},br=ye=>{switch(ye){case"applied":return"bg-white/10 text-white border-white/20";case"scheduled":return"bg-white/10 text-gray-300 border-white/20";case"pending":return"bg-white/10 text-gray-400 border-white/20";default:return"bg-white/10 text-gray-400 border-white/20"}},Os=ye=>{f(ye),v(!0)},Zr=()=>{v(!1),setTimeout(()=>f(null),300)},Ta=(ye,ve="users")=>{const Ee=ve==="users"?et:re,je={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[ye]||7;if(Ee&&Ee.length>0&&Ee.length===je)return ye==="1D"?Ee.filter((Oe,Ce)=>Ce%4===0).map(Oe=>{const Ce=parseInt(Oe.replace("h",""),10);return Ce===0?"12am":Ce<12?`${Ce}am`:Ce===12?"12pm":`${Ce-12}pm`}):ye==="1W"?Ee.map(Oe=>Oe.length>3?Oe.substring(0,3):Oe):ye==="1M"?Ee.map(Oe=>{const Ce=Oe.split(" ");return Ce.length>=2?Ce[1]:Oe}):ye==="1Y"||ye==="3M"||ye==="6M"?Ee.map(Oe=>Oe.length>3?Oe.substring(0,3):Oe):Ee.map(Oe=>Oe.length>3?Oe.substring(0,3):Oe);const Le=new Date;switch(ye){case"1D":return["12am","4am","8am","12pm","4pm","8pm"];case"1W":return Array.from({length:7},(Oe,Ce)=>new Date(Le.getTime()-(6-Ce)*24*60*60*1e3).toLocaleDateString("en-US",{weekday:"short"}));case"1M":return Array.from({length:30},(Oe,Ce)=>new Date(Le.getTime()-(29-Ce)*24*60*60*1e3).getDate().toString());case"3M":return Array.from({length:3},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(2-Ce),1).toLocaleDateString("en-US",{month:"short"}));case"6M":return Array.from({length:6},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(5-Ce),1).toLocaleDateString("en-US",{month:"short"}));case"1Y":return Array.from({length:12},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(11-Ce),1).toLocaleDateString("en-US",{month:"short"}));case"ALL":return Array.from({length:7},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(6-Ce),1).toLocaleDateString("en-US",{month:"short"}));default:return["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},Mo=(ye,ve="users")=>{const Ee=ve==="users"?et:re,je={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[ye]||7;if(Ee&&Ee.length>0&&Ee.length===je)return ye==="1D"?Ee.map(Oe=>{const Ce=parseInt(Oe.replace("h",""),10);return Ce===0?"12am":Ce<12?`${Ce}am`:Ce===12?"12pm":`${Ce-12}pm`}):ye==="1Y"||ye==="3M"||ye==="6M"?Ee.map(Oe=>{const Ce=["January","February","March","April","May","June","July","August","September","October","November","December"],_e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].indexOf(Oe);return _e!==-1?Ce[_e]:Oe}):Ee;const Le=new Date;switch(ye){case"1D":return Array.from({length:24},(Oe,Ce)=>{const nt=new Date;return nt.setHours(Ce,0,0,0),nt.toLocaleTimeString("en-US",{hour:"numeric",hour12:!0})});case"1W":return Array.from({length:7},(Oe,Ce)=>new Date(Le.getTime()-(6-Ce)*24*60*60*1e3).toLocaleDateString("en-US",{weekday:"long"}));case"1M":return Array.from({length:30},(Oe,Ce)=>{const nt=new Date(Le.getTime()-(29-Ce)*24*60*60*1e3),_e=nt.toLocaleDateString("en-US",{month:"short"}),_t=nt.getDate();return`${_e} ${_t}`});case"3M":return Array.from({length:3},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(2-Ce),1).toLocaleDateString("en-US",{month:"long"}));case"6M":return Array.from({length:6},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(5-Ce),1).toLocaleDateString("en-US",{month:"long"}));case"1Y":return Array.from({length:12},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(11-Ce),1).toLocaleDateString("en-US",{month:"long"}));case"ALL":return Array.from({length:7},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(6-Ce),1).toLocaleDateString("en-US",{month:"long"}));default:return["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]}},xr=(ye,ve="users")=>{const Ee=ve==="users"?vt:qt,je={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[ye]||7;if(!Ee||Ee.length===0)return Array(je).fill(0);const Le=[...Ee];for(;Le.length<je;)Le.push(0);const Oe=Le.slice(0,je),Ce=Math.max(...Oe,1);return Oe.map(nt=>nt/Ce*100)},Ds=()=>{const ye=tt.length>0?tt:Ta(u,"users"),ve=ye.map((de,je)=>Lc.reduce((Le,Oe)=>{var Ce;return Le+(((Ce=be[Oe.id])==null?void 0:Ce[je])??0)},0)),Ee=Math.max(...ve,1);return r.jsxs("div",{className:"space-y-6 min-h-screen h-full mt-5 flex-1 overflow-y-hidden overflow-x-hidden px-0",children:[r.jsx("div",{className:"px-6 overflow-hidden",children:r.jsxs("div",{className:"flex items-center justify-between gap-8 py-4 px-6 bg-white/5 border border-white/10 rounded-none overflow-x-auto relative",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[r.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:r.jsx(Ct,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Users"}),r.jsx("span",{className:"text-white text-lg font-medium",children:Fn?"...":Jn(Wa.users)}),r.jsxs("div",{className:`flex items-center gap-1 ${pn>=0?"text-green-500":"text-red-500"}`,children:[r.jsx("svg",{className:`w-3 h-3 ${pn<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(pn).toFixed(1),"%"]})]})]})]}),r.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),r.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[r.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:r.jsx(ha,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Organizations"}),r.jsx("span",{className:"text-white text-lg font-medium",children:Fn?"...":Jn(Wa.organizations)}),r.jsxs("div",{className:`flex items-center gap-1 ${Xt>=0?"text-green-500":"text-red-500"}`,children:[r.jsx("svg",{className:`w-3 h-3 ${Xt<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(Xt).toFixed(1),"%"]})]})]})]}),r.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),r.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[r.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:r.jsx(pC,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Sessions"}),r.jsx("span",{className:"text-white text-lg font-medium",children:Fn?"...":Jn(Wa.sessions)}),r.jsxs("div",{className:`flex items-center gap-1 ${wn>=0?"text-green-500":"text-red-500"}`,children:[r.jsx("svg",{className:`w-3 h-3 ${wn<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(wn).toFixed(1),"%"]})]})]})]}),r.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),r.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[r.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:r.jsx(hC,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Activity Hits"}),r.jsx("span",{className:"text-white text-lg font-medium",children:Fn?"...":Jn(Do??0)}),r.jsxs("div",{className:`flex items-center gap-1 ${Va>=0?"text-green-500":"text-red-500"}`,children:[r.jsx("svg",{className:`w-3 h-3 ${Va<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(Va).toFixed(1),"%"]})]})]})]}),r.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),r.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[r.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:r.jsx(Ct,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"New Users"}),r.jsx("span",{className:"text-white text-lg font-medium",children:Fn?"...":Jn(i??0)}),r.jsxs("div",{className:`flex items-center gap-1 ${Kr>=0?"text-green-500":"text-red-500"}`,children:[r.jsx("svg",{className:`w-3 h-3 ${Kr<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(Kr).toFixed(1),"%"]})]})]})]})]})}),r.jsxs("div",{className:"px-6 pb-10 space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[r.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 relative",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-sm text-white uppercase font-light",children:"TOTAL USER"}),r.jsx("div",{className:"flex items-center space-x-1 overflow-x-auto",children:["1D","1W","6M","1Y"].map(de=>r.jsx("button",{onClick:()=>c(de),className:`px-2 py-1 text-xs font-light transition-colors whitespace-nowrap ${l===de?"bg-white/20 text-white border border-white/30":"text-gray-500 hover:text-white"}`,children:de},de))})]}),r.jsxs("div",{className:"flex justify-between items-end mb-6",children:[r.jsx("p",{className:"text-4xl text-white font-light",children:Fn?"...":Jn(Wa.users)}),r.jsxs("div",{className:"flex items-center gap-1 px-2 py-1",children:[r.jsx("svg",{className:`w-3 h-3 ${Et>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:`text-xs font-medium ${Et>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(Et).toFixed(1),"%"]})]})]}),r.jsxs("div",{className:"space-y-2 relative",children:[r.jsxs("div",{className:"h-32 relative",children:[r.jsx("svg",{className:"w-full h-full absolute inset-0",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:r.jsx("defs",{children:r.jsxs("linearGradient",{id:"usersBarGradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[r.jsx("stop",{offset:"0%",style:{stopColor:"rgba(255, 255, 255, 0.3)",stopOpacity:1}}),r.jsx("stop",{offset:"100%",style:{stopColor:"rgba(255, 255, 255, 0.05)",stopOpacity:1}})]})})}),r.jsx("div",{className:"h-32 flex items-end justify-between space-x-1 relative z-10",children:xr(l,"users").map((de,je)=>{const Le=M===je;return r.jsx("div",{className:"flex-1 transition-all duration-200 ease-out relative cursor-pointer group",style:{height:`${de}%`,background:"url(#usersBarGradient)"},onMouseEnter:Oe=>{const Ce=Oe.currentTarget.getBoundingClientRect(),nt=Ce.left+Ce.width/2,_e=Ce.top,_t=150,zn=60,Ca=Math.max(_t/2,Math.min(window.innerWidth-_t/2,nt)),ea=Math.max(zn+10,Math.min(window.innerHeight-10,_e));A(je),B({x:Ca,y:ea})},onMouseLeave:()=>{A(null),B(null)},children:r.jsx("div",{className:"w-full h-full",style:{background:"linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.05))",opacity:Le?1:.8}})},je)})}),M!==null&&D&&r.jsx("div",{className:"fixed z-50 pointer-events-none transition-all duration-200 ease-out animate-in fade-in",style:{left:`${D.x}px`,top:`${D.y}px`,transform:"translate(-50%, -100%)",maxWidth:"calc(100vw - 20px)"},children:r.jsxs("div",{className:"bg-black border border-white/20 rounded-sm px-3 py-2 shadow-lg whitespace-nowrap",children:[r.jsx("div",{className:"text-xs text-gray-400 mb-1 font-mono uppercase",children:Mo(l,"users")[M]}),r.jsxs("div",{className:"text-sm text-white font-sans font-medium",children:[vt[M]!==void 0?vt[M].toLocaleString():"0"," ",r.jsx("span",{className:"font-mono text-xs text-gray-400",children:"users"})]})]})})]}),r.jsx("div",{className:`flex justify-between ${l==="1M"?"text-[10px]":"text-xs"} text-gray-500 font-mono`,children:Ta(l,"users").map((de,je)=>r.jsx("span",{className:"flex-1 text-center truncate",children:de},je))})]})]}),r.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 relative",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm text-white uppercase font-light",children:"Activity Hits"}),r.jsx("p",{className:"text-4xl text-white font-light mt-1",children:Qe?"...":Xa(_s)}),r.jsx("p",{className:"text-xs text-gray-400",children:"Tracked events in selected period"})]}),r.jsx("div",{className:"flex items-center space-x-1 overflow-x-auto",children:["1D","1W","1M","3M","6M","1Y","ALL"].map(de=>r.jsx("button",{onClick:()=>h(de),className:`px-2 py-1 text-xs font-light transition-colors whitespace-nowrap ${u===de?"bg-white/20 text-white border border-white/30":"text-gray-500 hover:text-white"}`,children:de},de))})]}),r.jsxs("div",{className:"space-y-2 relative",children:[r.jsx("div",{className:"h-40 flex items-end gap-1",children:ye.map((de,je)=>{const Le=ve[je]||0;return r.jsx("div",{className:"flex-1 flex flex-col justify-end gap-[1px] h-full cursor-pointer",onMouseEnter:Oe=>Io(Oe,je),onMouseLeave:()=>{L(null),X(null)},children:Lc.map(Oe=>{var _e;const Ce=((_e=be[Oe.id])==null?void 0:_e[je])??0,nt=Le===0||Ee===0?0:Math.max(Ce/Ee*100,Ce>0?4:0);return r.jsx("div",{className:`w-full ${Oe.barClass}`,style:{height:`${nt}%`}},`${Oe.id}-${je}`)})},`${de}-${je}`)})}),Qe&&r.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center text-xs uppercase text-gray-400 pointer-events-none",children:"Loading activity..."}),G!==null&&q&&r.jsx("div",{className:"fixed z-50 pointer-events-none transition-all duration-200 ease-out animate-in fade-in",style:{left:`${q.x}px`,top:`${q.y}px`,transform:"translate(-50%, -100%)",maxWidth:"calc(100vw - 20px)"},children:r.jsxs("div",{className:"bg-black border border-white/20 rounded-sm px-3 py-2 shadow-lg min-w-[180px]",children:[r.jsx("div",{className:"text-xs text-gray-400 mb-2 font-mono uppercase",children:ye[G]||`Bucket ${G+1}`}),r.jsx("div",{className:"space-y-1",children:Lc.map(de=>{var je;return r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-300",children:[r.jsx("span",{className:`w-2 h-2 rounded-sm ${de.dotClass}`}),de.label]}),r.jsx("span",{className:"text-white font-medium",children:((je=be[de.id])==null?void 0:je[G])??0})]},de.id)})})]})}),r.jsx("div",{className:`flex justify-between ${u==="1M"?"text-[10px]":"text-xs"} text-gray-500 font-mono`,children:ye.map((de,je)=>r.jsx("span",{className:"flex-1 text-center truncate",children:de},je))}),r.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-3 mt-4 pt-4 border-t border-white/10",children:Lc.map(de=>r.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-400",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:`w-2 h-2 rounded-sm ${de.dotClass}`}),de.label]}),r.jsx("span",{className:"text-white font-medium",children:Qe?"...":Xa(ks[de.id]||0)})]},de.id))})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"space-y-4 overflow-x-hidden",children:[r.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[r.jsxs("div",{className:"relative",children:[r.jsxs("button",{onClick:()=>E(!T),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[r.jsx(ch,{className:"w-3 h-3"}),r.jsx("span",{children:x})]}),T&&r.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Ea.map(de=>r.jsx("button",{onClick:()=>{N(de),E(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:de},de))})]}),x==="Custom"&&r.jsxs("div",{className:"h-0 flex items-center gap-2",children:[r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),K?_a(K,"MMM dd yyyy"):"From"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:K,onSelect:ne,initialFocus:!0,className:"rounded-none"})})]}),r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),te?_a(te,"MMM dd yyyy"):"To"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:te,onSelect:ee,initialFocus:!0,disabled:de=>K?de<K:!1,className:"rounded-none"})})]})]})]}),r.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),r.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Active Users"}),r.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Users with active session in the time frame"}),r.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[r.jsx("p",{className:"text-3xl text-white font-light",children:Xa(a)}),r.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:r.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 border-white/5 rounded-none",children:[r.jsx("svg",{className:`w-3 h-3 ${Be>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:`text-xs font-medium ${Be>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(Be).toFixed(1),"%"]})]})})]})]}),r.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[r.jsxs("div",{className:"relative",children:[r.jsxs("button",{onClick:()=>O(!k),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[r.jsx(ch,{className:"w-3 h-3"}),r.jsx("span",{children:b})]}),k&&r.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Ea.map(de=>r.jsx("button",{onClick:()=>{y(de),O(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:de},de))})]}),b==="Custom"&&r.jsxs("div",{className:"h-0 flex items-center gap-2",children:[r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),ae?_a(ae,"MMM dd yyyy"):"From"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:ae,onSelect:ge,initialFocus:!0,className:"rounded-none"})})]}),r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),se?_a(se,"MMM dd yyyy"):"To"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:se,onSelect:fe,initialFocus:!0,disabled:de=>ae?de<ae:!1,className:"rounded-none"})})]})]})]}),r.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),r.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"New Users"}),r.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Newly registered Users in the time frame"}),r.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[r.jsx("p",{className:"text-3xl text-white font-light",children:Xa(Yr)}),r.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:r.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[r.jsx("svg",{className:`w-3 h-3 ${Xr>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",style:Xr<0?{transform:"rotate(180deg)"}:{},children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:`text-xs font-medium ${Xr>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(Xr).toFixed(1),"%"]})]})})]})]})]}),r.jsxs("div",{className:"space-y-4 overflow-x-hidden",children:[r.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[r.jsxs("div",{className:"relative",children:[r.jsxs("button",{onClick:()=>I(!R),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[r.jsx(ch,{className:"w-3 h-3"}),r.jsx("span",{children:g})]}),R&&r.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Ea.map(de=>r.jsx("button",{onClick:()=>{w(de),I(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:de},de))})]}),g==="Custom"&&r.jsxs("div",{className:"h-0 flex items-center gap-2",children:[r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),me?_a(me,"MMM dd yyyy"):"From"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:me,onSelect:Re,initialFocus:!0,className:"rounded-none"})})]}),r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),Me?_a(Me,"MMM dd yyyy"):"To"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:Me,onSelect:Ue,initialFocus:!0,disabled:de=>me?de<me:!1,className:"rounded-none"})})]})]})]}),r.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),r.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Organizations"}),r.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Total organizations in the time frame"}),r.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[r.jsx("p",{className:"text-3xl text-white font-light",children:ue?"...":Xa(Ye)}),r.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:r.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[r.jsx("svg",{className:`w-3 h-3 ${le>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:`text-xs font-medium ${le>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(le).toFixed(1),"%"]})]})})]})]}),r.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[r.jsxs("div",{className:"relative",children:[r.jsxs("button",{onClick:()=>j(!F),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[r.jsx(ch,{className:"w-3 h-3"}),r.jsx("span",{children:S})]}),F&&r.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Ea.map(de=>r.jsx("button",{onClick:()=>{C(de),j(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:de},de))})]}),S==="Custom"&&r.jsxs("div",{className:"h-0 flex items-center gap-2",children:[r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),$e?_a($e,"MMM dd yyyy"):"From"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:$e,onSelect:pt,initialFocus:!0,className:"rounded-none"})})]}),r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),Ge?_a(Ge,"MMM dd yyyy"):"To"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:Ge,onSelect:jt,initialFocus:!0,disabled:de=>$e?de<$e:!1,className:"rounded-none"})})]})]})]}),r.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),r.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Teams"}),r.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Total teams in the time frame"}),r.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[r.jsx("p",{className:"text-3xl text-white font-light",children:W?"...":Xa(ie)}),r.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:r.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[r.jsx("svg",{className:`w-3 h-3 ${xe>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:`text-xs font-medium ${xe>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(xe).toFixed(1),"%"]})]})})]})]})]}),r.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pt-4 overflow-hidden relative rounded-none flex flex-col",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Cn,{className:"w-4 h-4 text-white/60"}),r.jsx("h4",{className:"text-xs text-gray-400 uppercase font-mono font-light",children:"Security Insights"})]})}),r.jsx("hr",{className:"-mx-10 -mt-1 border-white/10"}),r.jsxs("div",{className:"space-y-3 overflow-y-auto custom-scrollbar max-h-[400px]",children:[Mi.length===0&&r.jsx("div",{className:"text-sm flex items-center justify-center text-gray-400",children:r.jsxs("div",{className:"flex mt-5 items-center justify-center",children:[r.jsx(Cn,{className:"w-4 h-4 text-gray-400 mr-2"}),r.jsx("p",{className:"text-center",children:"No security insights found"})]})}),Mi.map((de,je)=>r.jsx("div",{onClick:()=>Os(de),className:"group py-2 border-b border-white/5 cursor-pointer transition-all duration-200 hover:border-white/20",style:{animation:`slideIn 0.3s ease-out ${je*.1}s both`},children:r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:r.jsx("span",{className:"text-sm text-white/90 font-light truncate group-hover:text-white transition-colors",children:de.title})}),r.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[r.jsx("span",{className:`text-[9px] px-1.5 py-0.5 border rounded-sm uppercase font-mono ${gr(de.severity)}`,children:de.severity}),r.jsx("span",{className:`text-[9px] px-1.5 py-0.5 border rounded-sm capitalize font-mono ${br(de.status)}`,children:de.status})]})]}),r.jsx(Bd,{className:"w-3.5 h-3.5 text-gray-500 group-hover:text-white transition-all flex-shrink-0 mt-0.5"})]})},de.id))]})]})]})]})]})};return r.jsxs("div",{className:"h-screen bg-black text-white overflow-hidden flex flex-col",style:{overflowX:"hidden"},children:[r.jsx("div",{className:"flex-1 overflow-hidden",children:e==="overview"?Ds():e==="users"?r.jsx(y5,{}):e==="organizations"?r.jsx(x5,{}):Ds()}),t&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-3xl rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx(pC,{className:"w-6 h-6 text-white"}),r.jsx("h3",{className:"text-lg text-white font-light",children:"Quick Actions"})]}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>n(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(xt,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("button",{onClick:()=>{n(!1),Bn("/users")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[r.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:r.jsx(Ct,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"text-white font-light mb-1",children:"View All Users"}),r.jsx("p",{className:"text-sm text-gray-400",children:"Manage user accounts"})]}),r.jsx(Xs,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),r.jsxs("button",{onClick:()=>{n(!1),Bn("/organizations")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[r.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:r.jsx(ha,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"text-white font-light mb-1",children:"View Organizations"}),r.jsx("p",{className:"text-sm text-gray-400",children:"Manage organizations"})]}),r.jsx(Xs,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),r.jsxs("button",{onClick:()=>{n(!1),Bn("/sessions")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[r.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:r.jsx(hC,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"text-white font-light mb-1",children:"View Sessions"}),r.jsx("p",{className:"text-sm text-gray-400",children:"Monitor active sessions"})]}),r.jsx(Xs,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),r.jsxs("button",{onClick:()=>{n(!1),Bn("/database")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[r.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:r.jsx(ps,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"text-white font-light mb-1",children:"Database Schema"}),r.jsx("p",{className:"text-sm text-gray-400",children:"View schema visualizer"})]}),r.jsx(Xs,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),r.jsxs("button",{onClick:()=>{n(!1),Bn("/settings")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[r.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:r.jsx(u5,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"text-white font-light mb-1",children:"Settings"}),r.jsx("p",{className:"text-sm text-gray-400",children:"Configure system"})]}),r.jsx(Xs,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),r.jsxs("button",{onClick:()=>{n(!1),Bn("/users")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[r.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:r.jsx(c5,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"text-white font-light mb-1",children:"Search Users"}),r.jsx("p",{className:"text-sm text-gray-400",children:"Find specific users"})]}),r.jsx(Xs,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]})]}),r.jsx("div",{className:"mt-6 pt-6 border-t border-dashed border-white/10",children:r.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-400",children:[r.jsx("span",{children:"Tip: Press Ctrl+K or Cmd+K for command palette"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>n(!1),className:"text-gray-400 hover:text-white rounded-none",children:"Close"})]})})]})}),p&&d&&r.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-4",style:{animation:"fadeIn 0.3s ease-out"},onClick:Zr,children:r.jsxs("div",{className:"bg-black border border-white/20 rounded-none max-w-2xl w-full max-h-[80vh] overflow-y-auto",style:{animation:"slideUp 0.3s ease-out"},onClick:ye=>ye.stopPropagation(),children:[r.jsx("div",{className:"sticky top-0 bg-black border-b border-white/10 p-6 z-10",children:r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx(Cn,{className:"w-6 h-6 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light",children:d.title})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsxs("span",{className:`text-xs px-2 py-1 border rounded-none uppercase font-medium ${gr(d.severity)}`,children:[d.severity," Severity"]}),r.jsx("span",{className:`text-xs px-2 py-1 border rounded-none capitalize ${br(d.status)}`,children:d.status}),d.cve&&r.jsx("span",{className:"text-xs text-gray-400 font-mono bg-white/5 px-2 py-1 border border-white/10 rounded-none",children:d.cve})]})]}),r.jsx("button",{onClick:Zr,className:"p-2 hover:bg-white/10 transition-colors rounded-none",children:r.jsx(xt,{className:"w-5 h-5 text-gray-400 hover:text-white"})})]})}),r.jsxs("div",{className:"p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-2",children:"Release Date"}),r.jsx("p",{className:"text-white",children:new Date(d.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-2",children:"Description"}),d.description.includes("npm install")?r.jsxs("div",{children:[r.jsx("p",{className:"text-white leading-relaxed mb-3",children:d.description.split("Run:")[0]}),r.jsx("div",{className:"relative group",children:r.jsx("div",{className:"bg-black border border-white/20 rounded-none p-3 font-mono text-sm",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("code",{children:[r.jsx("span",{className:"text-green-400",children:"$"})," ",r.jsx("span",{className:"text-cyan-400",children:"npm"})," ",r.jsx("span",{className:"text-yellow-400",children:"install"})," ",r.jsx("span",{className:"text-white",children:"better-auth@latest"})]}),r.jsx("button",{onClick:()=>{navigator.clipboard.writeText("npm install better-auth@latest"),H.success("Command copied to clipboard")},className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 hover:bg-white/10 rounded",title:"Copy command",children:r.jsx(aa,{className:"w-4 h-4 text-gray-400 hover:text-white"})})]})})})]}):r.jsx("p",{className:"text-white leading-relaxed",children:d.description})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-3",children:"Affected Components"}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:d.affectedComponents.map((ye,ve)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-white/5 border border-white/10 rounded-none",style:{animation:`slideIn 0.3s ease-out ${ve*.1}s both`},children:[r.jsx("div",{className:"w-2 h-2 bg-white rounded-none flex-shrink-0"}),r.jsx("span",{className:"text-sm text-white",children:ye})]},ve))})]}),r.jsx("div",{className:"p-4 bg-white/5 border border-white/10 rounded-none",children:r.jsxs("div",{className:"flex items-start gap-3",children:[d.status==="applied"&&r.jsxs(r.Fragment,{children:[r.jsx(zf,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Patch Applied"}),r.jsx("p",{className:"text-xs text-gray-400",children:"This security patch has been successfully applied to your system."})]})]}),d.status==="scheduled"&&r.jsxs(r.Fragment,{children:[r.jsx(d5,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Scheduled"}),r.jsx("p",{className:"text-xs text-gray-400",children:"This patch is scheduled for deployment in the next maintenance window."})]})]}),d.status==="pending"&&r.jsxs(r.Fragment,{children:[r.jsx(bte,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Action Required"}),r.jsx("p",{className:"text-xs text-gray-400",children:"This patch is pending review and requires manual approval before deployment."})]})]})]})}),r.jsx("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-white/10",children:r.jsx($,{variant:"ghost",onClick:Zr,className:"text-gray-400 hover:text-white rounded-none",children:"Close"})})]})]})}),r.jsx("style",{children:`
509
+ `),ue=new Blob([Ne],{type:"text/csv;charset=utf-8;"}),ke=document.createElement("a"),W=URL.createObjectURL(ue);ke.setAttribute("href",W),ke.setAttribute("download",`users-export-${new Date().toISOString().split("T")[0]}.csv`),ke.style.visibility="hidden",document.body.appendChild(ke),ke.click(),document.body.removeChild(ke),H.success(`Exported ${a.length} users to CSV`)},qt=Q=>{u.some(Ne=>Ne.type===Q)||(h(Ne=>[...Ne,{type:Q}]),f(1))},Wt=Q=>{h(ie=>ie.filter(Ne=>Ne.type!==Q)),f(1)},re=(Q,ie)=>{h(Ne=>Ne.map(ue=>ue.type===Q?{...ue,value:ie}:ue))},we=(Q,ie)=>{h(Ne=>Ne.map(ue=>ue.type===Q?{...ue,dateRange:ie}:ue))},Be=a.filter(Q=>{const ie=Q.name.toLowerCase().includes(l.toLowerCase())||Q.email.toLowerCase().includes(l.toLowerCase());if(u.length===0)return ie;const Ne=u.every(ue=>{var ke,W,Y,be,He;switch(ue.type){case"emailVerified":return ue.value===void 0?!0:Q.emailVerified===(ue.value==="true");case"banned":return ue.value===void 0?!0:Q.banned===(ue.value==="true");case"active":return Q.banned!==!0;case"createdAt":{if(!((ke=ue.dateRange)!=null&&ke.from)&&!((W=ue.dateRange)!=null&&W.to))return!0;const tt=new Date(Q.createdAt);return!((Y=ue.dateRange)!=null&&Y.from&&ue.dateRange.from>tt||(be=ue.dateRange)!=null&&be.to&&ue.dateRange.to<tt)}case"role":return ue.value?(He=Q.role)==null?void 0:He.toLowerCase().includes(ue.value.toLowerCase()):!0;default:return!0}});return ie&&Ne}),V=a.filter(Q=>Q.banned).length,le=Math.ceil(Be.length/p),he=(d-1)*p,xe=he+p,De=Be.slice(he,xe),Ye=Q=>{f(Q)};return i?r.jsx("div",{className:"flex min-h-screen items-center justify-center h-full",children:r.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[r.jsx(ir,{className:"w-6 h-6 text-white animate-spin"}),r.jsx("div",{className:"text-white text-sm",children:"Loading users..."})]})}):r.jsxs("div",{className:"space-y-6 p-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Users",r.jsx("sup",{className:"text-xs text-gray-500 ml-1 mt-0 inline-flex items-baseline",children:r.jsx(rr,{value:t.users??0,className:"text-white font-mono text-sm",prefix:r.jsx("span",{className:"mr-1 text-gray-500",children:"["}),suffix:r.jsx("span",{className:"ml-1 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]}),r.jsx("p",{className:"text-gray-400 font-light text-sm mt-1 uppercase font-mono",children:"Manage your application users"}),r.jsx("div",{className:"flex items-center space-x-4 mt-2",children:V>0&&r.jsxs("span",{className:"text-sm text-red-400 flex items-center space-x-1",children:[r.jsx(th,{className:"w-3 h-3"}),r.jsxs("span",{children:[V," Banned"]})]})})]}),r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsxs($,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:Tt,children:[r.jsx(ud,{className:"w-4 h-4 mr-2"}),"Export CSV"]}),r.jsxs($,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:()=>T(!0),children:[r.jsx(Vt,{className:"w-4 h-4 mr-2"}),"Seed"]}),r.jsxs($,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",onClick:()=>x(!0),children:[r.jsx(Uw,{className:"w-4 h-4 mr-2"}),"Add User"]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(xo,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),r.jsx(Te,{placeholder:"Search users...",value:l,onChange:Q=>c(Q.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsx("div",{className:"flex items-center space-x-2",children:r.jsxs(Ua,{value:"",onValueChange:qt,children:[r.jsx(Pa,{className:"w-[180px]",children:r.jsxs("div",{className:"flex mr-3 items-center space-x-2",children:[r.jsx(bi,{className:"w-4 h-4"}),r.jsx("span",{children:"Add Filter"})]})}),r.jsxs(Fa,{children:[!u.some(Q=>Q.type==="emailVerified")&&r.jsx(Ve,{value:"emailVerified",children:"Email Verified"}),!u.some(Q=>Q.type==="banned")&&r.jsx(Ve,{value:"banned",children:"Banned Status"}),!u.some(Q=>Q.type==="createdAt")&&r.jsx(Ve,{value:"createdAt",children:"Created Date"}),!u.some(Q=>Q.type==="role")&&r.jsx(Ve,{value:"role",children:"Role"})]})]})}),u.length>0&&r.jsx("div",{className:"flex items-center space-x-2",children:r.jsx($,{onClick:()=>h([]),className:"",children:"Clear all"})})]}),u.length>0&&r.jsx("div",{className:"space-y-3",children:r.jsx("div",{className:"flex flex-wrap gap-3",children:u.map(Q=>{var ie,Ne,ue,ke;return r.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-2 bg-white/10 border border-white/20 rounded-sm",children:[r.jsx(C1,{className:"w-3 h-3 text-white"}),Q.type==="emailVerified"&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-white",children:"Email Verified:"}),r.jsxs(Ua,{value:Q.value||"",onValueChange:W=>re("emailVerified",W),children:[r.jsx(Pa,{className:"h-7 w-24 text-xs",children:r.jsx("span",{children:Q.value==="true"?"True":Q.value==="false"?"False":"Select"})}),r.jsxs(Fa,{children:[r.jsx(Ve,{value:"true",children:"True"}),r.jsx(Ve,{value:"false",children:"False"})]})]})]}),Q.type==="banned"&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-white",children:"Banned:"}),r.jsxs(Ua,{value:Q.value||"",onValueChange:W=>re("banned",W),children:[r.jsx(Pa,{className:"h-7 w-24 text-xs",children:r.jsx("span",{children:Q.value==="true"?"Yes":Q.value==="false"?"No":"Select"})}),r.jsxs(Fa,{children:[r.jsx(Ve,{value:"true",children:"Yes"}),r.jsx(Ve,{value:"false",children:"No"})]})]})]}),Q.type==="createdAt"&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-white",children:"Created:"}),r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(_f,{className:"mr-1 h-3 w-3"}),(ie=Q.dateRange)!=null&&ie.from?_a(Q.dateRange.from,"MMM dd yyyy"):"From"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:(Ne=Q.dateRange)==null?void 0:Ne.from,onSelect:W=>{var Y;return we("createdAt",{from:W,to:(Y=Q.dateRange)==null?void 0:Y.to})},initialFocus:!0,className:"rounded-none"})})]}),r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(_f,{className:"mr-1 h-3 w-3"}),(ue=Q.dateRange)!=null&&ue.to?_a(Q.dateRange.to,"MMM dd yyyy"):"To"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:(ke=Q.dateRange)==null?void 0:ke.to,onSelect:W=>{var Y;return we("createdAt",{from:(Y=Q.dateRange)==null?void 0:Y.from,to:W})},initialFocus:!0,disabled:W=>{var Y;return(Y=Q.dateRange)!=null&&Y.from?W<Q.dateRange.from:!1},className:"rounded-none"})})]})]}),Q.type==="role"&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-white",children:"Role:"}),r.jsx(Te,{type:"text",value:Q.value||"",onChange:W=>re("role",W.target.value),className:"h-7 w-32 text-xs bg-black border-white/20 text-white",placeholder:"Enter role..."})]}),r.jsx("button",{onClick:()=>Wt(Q.type),className:"ml-1 hover:bg-white/20 rounded-full p-0.5",children:r.jsx(tn,{className:"w-3 h-3 text-white"})})]},Q.type)})})})]}),r.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:[r.jsx("div",{className:"overflow-x-auto overflow-y-hidden",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[r.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User"}),r.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email Status"}),r.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),r.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Created"}),r.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),r.jsx("tbody",{children:De.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:5,className:"py-12 px-4 text-center",children:r.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[r.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:r.jsx(yo,{className:"w-8 h-8 text-white/50"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-white font-medium text-lg",children:"No users found"}),r.jsx("p",{className:"text-gray-400 text-sm mt-1",children:l||u.length>0?"Try adjusting your search or filter criteria":"Get started by creating your first user or seeding some data"})]}),!l&&u.length===0&&r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsxs($,{onClick:()=>x(!0),className:"bg-white text-black hover:bg-gray-200 rounded-none",children:[r.jsx(Uw,{className:"w-4 h-4 mr-2"}),"Create User"]}),r.jsxs($,{onClick:()=>T(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[r.jsx(Vt,{className:"w-4 h-4 mr-2"}),"Seed Data"]})]})]})})}):De.map(Q=>r.jsxs("tr",{className:`border-b border-dashed hover:bg-white/5 cursor-pointer ${Q.banned?"border-red-500/30 bg-red-500/5":"border-white/5"}`,onClick:()=>e(`/users/${Q.id}`),children:[r.jsx("td",{className:"py-4 px-4",children:r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:Q.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${Q.id}`,alt:Q.name,className:`w-10 h-10 rounded-none border border-dashed ${Q.banned?"border-red-400/50 opacity-60":"border-white/20"}`}),Q.banned&&r.jsx("div",{className:"absolute -top-1 -right-1 bg-red-500 rounded-full p-0.5",children:r.jsx(th,{className:"w-3 h-3 text-white"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"text-white font-light",children:Q.name}),Q.banned&&r.jsxs("span",{className:"relative group inline-block",children:[r.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold bg-red-500/20 border border-red-500/50 text-red-400 rounded-sm uppercase tracking-wide cursor-help",children:"Banned"}),Q.banReason&&r.jsxs("span",{className:"absolute left-1/2 -translate-x-1/2 bottom-full mb-1.5 px-2 py-1 text-[10px] font-mono text-gray-300 bg-black border border-dashed border-white/20 rounded-none whitespace-nowrap opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-150 pointer-events-none z-50",children:[Q.banReason,r.jsx("span",{className:"absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-l-[4px] border-r-[4px] border-t-[4px] border-transparent border-t-white/20"})]})]})]}),r.jsx("div",{className:"text-sm text-gray-400 mt-0.5",children:Q.email})]})]})}),r.jsx("td",{className:"py-4 px-4",children:r.jsxs("div",{className:"flex items-center space-x-2",children:[Q.emailVerified?r.jsx(Rf,{className:"w-4 h-4 text-green-400"}):r.jsx(Xl,{className:"w-4 h-4 text-yellow-400"}),r.jsx("span",{className:"text-sm text-gray-400",children:Q.emailVerified?"Verified":"Not Verified"})]})}),r.jsx("td",{className:"py-4 px-4",children:Q.role?r.jsx("span",{className:"px-2 py-1 text-xs font-mono uppercase bg-white/5 border border-dashed border-white/15 text-white/80 rounded-sm tracking-wide",children:Q.role}):r.jsx("span",{className:"text-sm text-gray-500",children:"—"})}),r.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:r.jsxs("div",{className:"flex flex-col",children:[new Date(Q.createdAt).toLocaleDateString(),r.jsx("p",{className:"text-xs",children:new Date(Q.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]})}),r.jsx("td",{className:"py-4 px-4 text-right",children:r.jsxs("div",{className:"relative flex items-center justify-end",children:[r.jsx($,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:ie=>{ie.stopPropagation(),M(_===Q.id?null:Q.id)},children:r.jsx(WM,{className:"w-4 h-4"})}),_===Q.id&&r.jsxs("div",{className:"absolute z-[999] right-0 top-full mt-1 w-48 bg-black border border-white/20 rounded-none shadow-lg",onClick:ie=>ie.stopPropagation(),children:[r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:ie=>{ie.stopPropagation(),M(null),$e(Q)},children:[r.jsx(gi,{className:"w-4 h-4"}),r.jsx("span",{children:"View"})]}),r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:ie=>{ie.stopPropagation(),M(null),pt(Q)},children:[r.jsx(bo,{className:"w-4 h-4"}),r.jsx("span",{children:"Edit User"})]}),r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:ie=>{ie.stopPropagation(),M(null),U(Q),F(!0)},children:[r.jsx(Cn,{className:"w-4 h-4"}),r.jsx("span",{children:"Update Password"})]}),L&&(Q.banned?r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-green-400 hover:bg-white/10 flex items-center space-x-2",onClick:ie=>{ie.stopPropagation(),U(Q),R(!0),M(null)},children:[r.jsx(th,{className:"w-4 h-4"}),r.jsx("span",{children:"Unban User"})]}):r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-yellow-400 hover:bg-white/10 flex items-center space-x-2",onClick:ie=>{ie.stopPropagation(),U(Q),k(!0),M(null)},children:[r.jsx(th,{className:"w-4 h-4"}),r.jsx("span",{children:"Ban User"})]})),r.jsx("div",{className:"border-t border-white/10 my-1"}),r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-red-400 hover:bg-white/10 flex items-center space-x-2",onClick:ie=>{ie.stopPropagation(),M(null),Ge(Q)},children:[r.jsx(xu,{className:"w-4 h-4"}),r.jsx("span",{children:"Delete User"})]})]})]})})]},Q.id))})]})}),r.jsx(b5,{currentPage:d,totalPages:le,onPageChange:Ye,totalItems:Be.length,startIndex:he,endIndex:xe})]}),C&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"overflow-x-hidden bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[r.jsx("span",{className:"text-white/50 mr-2",children:"["}),r.jsx(yo,{className:"inline mr-2 w-3 h-3 text-white"}),r.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed User"}),r.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>{T(!1),te("")},className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center space-x-2"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center space-x-3",children:r.jsxs("div",{className:"flex-1",children:[r.jsx(pe,{htmlFor:"user-count",className:"text-sm text-gray-400 font-light",children:"Number of users"}),r.jsx(Te,{id:"user-count",type:"number",min:"1",max:"100",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})}),r.jsxs("div",{className:"flex-1",children:[r.jsx(pe,{htmlFor:"seed-role",className:"text-sm text-gray-400 font-light",children:"Role (optional)"}),r.jsxs(Ua,{className:"bg-black text-white",value:ne,onValueChange:te,children:[r.jsx(Pa,{id:"seed-role",className:"mt-1 border border-dashed border-white/20 bg-black text-white rounded-none",children:r.jsx(yi,{placeholder:"Select role (optional)"})}),r.jsxs(Fa,{children:[r.jsx(Ve,{value:"",children:"None"}),r.jsx(Ve,{value:"admin",children:"Admin"}),r.jsx(Ve,{value:"user",children:"User"}),r.jsx(Ve,{value:"mix",children:"Mix (Random)"})]})]})]}),r.jsx($,{onClick:()=>{var ie;const Q=parseInt(((ie=document.getElementById("user-count"))==null?void 0:ie.value)||"5",10);Ue(Q,ne||void 0)},disabled:fe,className:"bg-transparent hover:bg-white/90 bg-white text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:fe?r.jsxs(r.Fragment,{children:[r.jsx(ir,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Vt,{className:"w-3 h-3 mr-2"}),"Seed Users"]})})]})]}),ge.length>0&&r.jsx("div",{className:"mt-6",children:r.jsx(ji,{title:"User Seeding Terminal",lines:ge,isRunning:fe,className:"w-full",defaultCollapsed:!0})})]}),r.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),r.jsx("div",{className:"flex justify-end mt-6 pt-6",children:r.jsx($,{variant:"outline",onClick:()=>{T(!1),te("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),v&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-white/10 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Create User"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>{x(!1),ae("")},className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"create-name",className:"text-sm text-gray-400 font-light",children:"Name"}),r.jsx(Te,{id:"create-name",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"create-email",className:"text-sm text-gray-400 font-light",children:"Email"}),r.jsx(Te,{id:"create-email",type:"email",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"create-password",className:"text-sm text-gray-400 font-light",children:"Password"}),r.jsx(Te,{id:"create-password",type:"password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"create-role",className:"text-sm text-gray-400 font-light",children:"Role"}),r.jsxs(Ua,{className:"bg-black text-white",value:ee,onValueChange:ae,children:[r.jsx(Pa,{id:"create-role",className:"mt-1 border border-dashed border-white/20 bg-black text-white rounded-none",children:r.jsx(yi,{placeholder:"Select role"})}),r.jsxs(Fa,{children:[r.jsx(Ve,{value:"",children:"None"}),r.jsx(Ve,{value:"admin",children:"Admin"}),r.jsx(Ve,{value:"user",children:"User"})]})]})]})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx($,{variant:"outline",onClick:()=>{x(!1),ae("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:jt,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create"})]})]})}),N&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Edit User"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>{b(!1),K("")},className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("img",{src:j.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${j.id}`,alt:j.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-white font-light",children:j.name}),r.jsx("div",{className:"text-sm text-gray-400",children:j.email})]})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"edit-name",className:"text-sm text-gray-400 font-light",children:"Name"}),r.jsx(Te,{id:"edit-name",defaultValue:j.name,className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"edit-email",className:"text-sm text-gray-400 font-light",children:"Email"}),r.jsx(Te,{id:"edit-email",type:"email",defaultValue:j.email,className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"edit-role",className:"text-sm text-gray-400 font-light",children:"Role"}),r.jsxs(Ua,{value:X,onValueChange:K,children:[r.jsx(Pa,{id:"edit-role",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none",children:r.jsx(yi,{placeholder:"Select role"})}),r.jsxs(Fa,{children:[r.jsx(Ve,{value:"",children:"None"}),r.jsx(Ve,{value:"admin",children:"Admin"}),r.jsx(Ve,{value:"user",children:"User"})]})]})]})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx($,{variant:"outline",onClick:()=>{b(!1),K("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:vt,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update"})]})]})}),y&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Delete User"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("img",{src:j.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${j.id}`,alt:j.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-white font-light",children:j.name}),r.jsx("div",{className:"text-sm text-gray-400",children:j.email})]})]}),r.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this user? This action cannot be undone."})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx($,{variant:"outline",onClick:()=>g(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:We,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete"})]})]})}),w&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"User Details"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("img",{src:j.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${j.id}`,alt:j.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-white font-light",children:j.name}),r.jsx("div",{className:"text-sm text-gray-400",children:j.email})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ln,{id:j.id,variant:"detail"}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-400",children:"Email Verified:"}),r.jsx("span",{className:"text-white text-sm",children:j.emailVerified?"Yes":"No"})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-400",children:"Created:"}),r.jsx("span",{className:"text-white text-sm",children:new Date(j.createdAt).toLocaleString()})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-400",children:"Updated:"}),r.jsx("span",{className:"text-white text-sm",children:new Date(j.updatedAt).toLocaleString()})]})]})]}),r.jsx("div",{className:"flex justify-end mt-6",children:r.jsx($,{onClick:()=>S(!1),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Close"})})]})}),E&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black border border-red-400/20 rounded-none p-6 w-full max-w-md",children:[r.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Ban User"}),r.jsxs("p",{className:"text-gray-400 mb-4",children:["Ban ",r.jsx("strong",{children:j.name})," from accessing the system."]}),r.jsxs("div",{className:"space-y-4 mb-6",children:[r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"banReason",className:"text-white",children:"Ban Reason"}),r.jsx(Te,{id:"banReason",value:A,onChange:Q=>D(Q.target.value),placeholder:"Enter reason for ban (optional)",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"banExpires",className:"text-white",children:"Ban Duration (seconds)"}),r.jsx(Te,{id:"banExpires",type:"number",value:B||"",onChange:Q=>G(Q.target.value?Number(Q.target.value):void 0),placeholder:"Leave empty for permanent ban",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Examples: 3600 (1 hour), 86400 (1 day), 604800 (1 week)"})]})]}),r.jsxs("div",{className:"flex justify-end space-x-2",children:[r.jsx($,{variant:"outline",onClick:()=>{k(!1),D(""),G(void 0),U(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:et,className:"bg-red-600 text-white hover:bg-red-700 rounded-none",children:"Ban User"})]})]})}),O&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black border border-dashed border-green-400/50 rounded-none p-6 w-full max-w-md",children:[r.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Unban User"}),r.jsxs("p",{className:"text-gray-400 mb-6",children:["Are you sure you want to unban ",r.jsx("strong",{children:j.name}),"? This will restore their access to the system."]}),r.jsxs("div",{className:"flex justify-end space-x-2",children:[r.jsx($,{variant:"outline",onClick:()=>{R(!1),U(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:Ze,className:"bg-green-600 text-white hover:bg-green-700 rounded-none",children:"Unban User"})]})]})}),I&&j&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Update Password"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>{F(!1),U(null),document.getElementById("update-password").value=""},className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(tn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("img",{src:j.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${j.id}`,alt:j.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-white font-light",children:j.name}),r.jsx("div",{className:"text-sm text-gray-400",children:j.email})]})]}),r.jsxs("div",{children:[r.jsx(pe,{htmlFor:"update-password",className:"text-sm text-gray-400 font-light",children:"New Password"}),r.jsx(Te,{id:"update-password",type:"password",placeholder:"Enter new password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx($,{variant:"outline",onClick:()=>{F(!1),U(null),document.getElementById("update-password").value=""},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx($,{onClick:Et,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update Password"})]})]})})]})}const Lc=[{id:"signups",label:"Signups",analyticsKey:"newUsers",barClass:"bg-white/25 border border-white/10",dotClass:"bg-white/25"},{id:"logins",label:"Logins",analyticsKey:"activeUsers",barClass:"bg-white/20 border border-white/10",dotClass:"bg-white/20"},{id:"organizations",label:"Organizations",analyticsKey:"organizations",barClass:"bg-white/15 border border-white/10",dotClass:"bg-white/15"},{id:"teams",label:"Teams",analyticsKey:"teams",barClass:"bg-white/10 border border-white/10",dotClass:"bg-white/10"},{id:"sessions",label:"Sessions",analyticsKey:"sessions",barClass:"bg-white/5 border border-white/10",dotClass:"bg-white/5"}];function Pte(){const[e]=m.useState("overview"),[t,n]=m.useState(!1),[a,s]=m.useState(0),[i,o]=m.useState(0),[l,c]=m.useState("1D"),[u,h]=m.useState("1D"),[d,f]=m.useState(null),[p,v]=m.useState(!1),[x,N]=m.useState("Daily"),[b,y]=m.useState("Daily"),[g,w]=m.useState("Daily"),[S,C]=m.useState("Daily"),[T,E]=m.useState(!1),[k,O]=m.useState(!1),[R,I]=m.useState(!1),[F,j]=m.useState(!1),[U,_]=m.useState(null),[M,A]=m.useState(null),[D,B]=m.useState(null),[G,L]=m.useState(null),[q,X]=m.useState(null),[K,ne]=m.useState(void 0),[te,ee]=m.useState(void 0),[ae,ge]=m.useState(void 0),[se,fe]=m.useState(void 0),[me,Re]=m.useState(void 0),[Me,Ue]=m.useState(void 0),[$e,pt]=m.useState(void 0),[Ge,jt]=m.useState(void 0),[vt,We]=m.useState([]),[et,Ze]=m.useState([]),[Et,Tt]=m.useState(0),[qt,Wt]=m.useState([]),[re,we]=m.useState([]),[Be,V]=m.useState(0),[le,he]=m.useState(0),[xe,De]=m.useState(0),[Ye,Q]=m.useState(0),[ie,Ne]=m.useState(0),[ue,ke]=m.useState(!1),[W,Y]=m.useState(!1),[be,He]=m.useState({signups:[],logins:[],organizations:[],teams:[],sessions:[]}),[tt,rt]=m.useState([]),[Qe,Jt]=m.useState(!1),[pn,ln]=m.useState(0),[Xt,Gr]=m.useState(0),[wn,Rn]=m.useState(0),[Va,Vr]=m.useState(0),[Do,As]=m.useState(0),[Ya,kt]=m.useState([]),[Yr,Wr]=m.useState(0),[Xr,pr]=m.useState(0),[Kr,mr]=m.useState(0),{counts:Wa,loading:Fn}=Mp(),Bn=ur(),Ea=["Daily","Weekly","Monthly","Yearly","Custom"],js={Daily:"1D",Weekly:"1W",Monthly:"1M",Yearly:"1Y",Custom:"Custom"},Qn=m.useMemo(()=>new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1}),[]),Jn=ye=>ye==null?"...":Qn.format(Number(ye)),Xa=ye=>ye==null?"...":Number(ye).toLocaleString(),ks=m.useMemo(()=>Lc.reduce((ye,ve)=>(ye[ve.id]=(be[ve.id]||[]).reduce((Ee,de)=>Ee+de,0),ye),{}),[be]),_s=m.useMemo(()=>Object.values(ks).reduce((ye,ve)=>ye+ve,0),[ks]),Io=(ye,ve)=>{const Ee=ye.currentTarget.getBoundingClientRect();L(ve),X({x:Ee.left+Ee.width/2,y:Ee.top})},Mi=(()=>{const ye=[];return U!=null&&U.isOutdated?ye.push({id:"version-check",title:`Update Better-Auth to v${U.latest}`,severity:"high",date:new Date().toISOString().split("T")[0],description:"Your current version is outdated. Update to the latest version to get the latest security fixes, features, and improvements. Run: `pnpm install better-auth@latest`",affectedComponents:["All Components"],status:"pending",cve:""}):U&&ye.push({id:"version-check",title:"Better-Auth is Up to date",severity:"low",date:new Date().toISOString().split("T")[0],description:"You are running the latest version of better-auth. Great job keeping your dependencies up to date!",affectedComponents:["All Components"],status:"applied",cve:""}),ye.push(),ye.push({id:"3",title:"Rate Limiting Configuration",severity:"medium",date:new Date().toISOString().split("T")[0],description:"Configure rate limiting for authentication endpoints to prevent brute force attacks. Better-auth provides built-in rate limiting middleware.",affectedComponents:["Auth Endpoints"],status:"pending"}),ye})(),dt=m.useCallback(async(ye,ve,Ee,de)=>{try{const je=new URLSearchParams({type:ye,period:ve});return Ee&&je.append("from",Ee.toISOString()),de&&je.append("to",de.toISOString()),await(await fetch(`/api/analytics?${je.toString()}`)).json()}catch{return null}},[]);m.useEffect(()=>{(async()=>{try{const Ee=await(await fetch("/api/users/all")).json();Ee!=null&&Ee.success&&Ee.users&&kt(Ee.users)}catch{kt([])}})()},[]),m.useEffect(()=>{(async()=>{try{const Ee=await(await fetch("/api/stats")).json();Ee&&s(Ee.activeUsers||0)}catch{s(0)}})()},[]),m.useEffect(()=>{(async()=>{const ve=await dt("users",l,K,te);ve&&(We(ve.data||[]),Ze(ve.labels||[]),Tt(ve.percentageChange||0))})()},[l,K,te,dt]),m.useEffect(()=>{if(Ya.length===0){Wr(0),pr(0);return}const ye=new Date;let ve,Ee=ye,de,je;if(b==="Custom"){if(!ae||!se){Wr(0),pr(0);return}ve=new Date(ae),Ee=new Date(se),Ee.setHours(23,59,59,999);const _t=Ee.getTime()-ve.getTime();je=new Date(ve.getTime()-1),de=new Date(je.getTime()-_t)}else switch(b){case"Daily":ve=new Date(ye),ve.setHours(0,0,0,0),je=new Date(ve.getTime()-1),de=new Date(je.getTime()-24*60*60*1e3);break;case"Weekly":ve=new Date(ye),ve.setDate(ye.getDate()-ye.getDay()),ve.setHours(0,0,0,0),je=new Date(ve.getTime()-1),de=new Date(je.getTime()-7*24*60*60*1e3);break;case"Monthly":ve=new Date(ye.getFullYear(),ye.getMonth(),1),ve.setHours(0,0,0,0),je=new Date(ve.getTime()-1),de=new Date(ye.getFullYear(),ye.getMonth()-1,1),de.setHours(0,0,0,0);break;case"Yearly":ve=new Date(ye.getFullYear(),0,1),ve.setHours(0,0,0,0),je=new Date(ve.getTime()-1),de=new Date(ye.getFullYear()-1,0,1),de.setHours(0,0,0,0);break;default:Wr(0),pr(0);return}const Le=Ya.filter(_t=>{if(!_t.createdAt)return!1;const zn=new Date(_t.createdAt);return zn>=ve&&zn<=Ee}),Oe=Ya.filter(_t=>{if(!_t.createdAt)return!1;const zn=new Date(_t.createdAt);return zn>=de&&zn<=je}),Ce=Le.length,nt=Oe.length;let _e=0;nt>0?_e=(Ce-nt)/nt*100:Ce>0&&(_e=100),Wr(Ce),pr(_e)},[Ya,b,ae,se]),m.useEffect(()=>{(async()=>{if(!(u==="Custom"&&(!ae||!se))){Jt(!0);try{const[ve,Ee,de,je,Le]=await Promise.all([dt("newUsers",u,ae,se),dt("activeUsers",u,ae,se),dt("organizations",u,ae,se),dt("teams",u,ae,se),dt("sessions",u,ae,se)]);ve&&(Wt(ve.data||[]),we(ve.labels||[])),He({signups:(ve==null?void 0:ve.data)||[],logins:(Ee==null?void 0:Ee.data)||[],organizations:(de==null?void 0:de.data)||[],teams:(je==null?void 0:je.data)||[],sessions:(Le==null?void 0:Le.data)||[]}),rt((ve==null?void 0:ve.labels)||(Ee==null?void 0:Ee.labels)||(de==null?void 0:de.labels)||(je==null?void 0:je.labels)||(Le==null?void 0:Le.labels)||[])}finally{Jt(!1)}}})()},[u,ae,se,dt]),m.useEffect(()=>{(async()=>{const ve=await dt("activeUsers","1D");ve&&V(ve.percentageChange||0)})()},[dt]),m.useEffect(()=>{},[Wa.organizations,Wa.teams,Fn]),m.useEffect(()=>{(async()=>{const ve=js[g]||"1D",Ee=ve==="Custom";if(!(Ee&&(!me||!Me))){ke(!0);try{const de=await dt("organizations",ve,Ee?me:void 0,Ee?Me:void 0);de&&(Q(de.total||0),he(de.percentageChange||0))}catch{Q(0),he(0)}finally{ke(!1)}}})()},[g,me,Me,dt]),m.useEffect(()=>{(async()=>{const ve=js[S]||"1D",Ee=ve==="Custom";if(!(Ee&&(!$e||!Ge))){Y(!0);try{const de=await dt("teams",ve,Ee?$e:void 0,Ee?Ge:void 0);de&&(Ne(de.total||0),De(de.percentageChange||0))}catch{Ne(0),De(0)}finally{Y(!1)}}})()},[S,$e,Ge,dt]),m.useEffect(()=>{(async()=>{const ve=await dt("users","1D");ve&&ln(ve.percentageChange||0);const Ee=await dt("organizations","1D");Ee&&Gr(Ee.percentageChange||0);const de=await dt("activeUsers","1D");de&&Rn(de.percentageChange||0);const[je,Le,Oe,Ce,nt]=await Promise.all([dt("newUsers","1D"),dt("activeUsers","1D"),dt("organizations","1D"),dt("teams","1D"),dt("sessions","1D")]);je?(o(je.total||0),mr(je.percentageChange||0)):(o(0),mr(0));const _t=[(je==null?void 0:je.total)||0,(Le==null?void 0:Le.total)||0,(Oe==null?void 0:Oe.total)||0,(Ce==null?void 0:Ce.total)||0,(nt==null?void 0:nt.total)||0].reduce((ea,Li)=>ea+Li,0);As(_t);const Ca=[(je==null?void 0:je.previousTotal)||0,(Le==null?void 0:Le.previousTotal)||0,(Oe==null?void 0:Oe.previousTotal)||0,(Ce==null?void 0:Ce.previousTotal)||0,(nt==null?void 0:nt.previousTotal)||0].reduce((ea,Li)=>ea+Li,0);if(Ca>0){const ea=(_t-Ca)/Ca*100;Vr(ea)}else _t>0?Vr(100):Vr(0)})()},[dt]),m.useEffect(()=>{(async()=>{try{const Ee=await(await fetch("/api/version-check")).json();Ee&&_({current:Ee.current||"1.0.0",latest:Ee.latest||"1.0.0",isOutdated:Ee.isOutdated||!1})}catch{try{const je=(await(await fetch("/api/package-info")).json()).betterAuthVersion||"1.0.0",Le="1.5.0";_({current:je,latest:Le,isOutdated:je!==Le})}catch{_({current:"1.0.0",latest:"1.5.0",isOutdated:!0})}}})()},[]);const gr=ye=>{switch(ye){case"critical":return"bg-white/10 text-white border-white/20";case"high":return"bg-white/10 text-white border-white/20";case"medium":return"bg-white/10 text-gray-300 border-white/20";case"low":return"bg-white/10 text-gray-400 border-white/20";default:return"bg-white/10 text-gray-400 border-white/20"}},br=ye=>{switch(ye){case"applied":return"bg-white/10 text-white border-white/20";case"scheduled":return"bg-white/10 text-gray-300 border-white/20";case"pending":return"bg-white/10 text-gray-400 border-white/20";default:return"bg-white/10 text-gray-400 border-white/20"}},Os=ye=>{f(ye),v(!0)},Zr=()=>{v(!1),setTimeout(()=>f(null),300)},Ta=(ye,ve="users")=>{const Ee=ve==="users"?et:re,je={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[ye]||7;if(Ee&&Ee.length>0&&Ee.length===je)return ye==="1D"?Ee.filter((Oe,Ce)=>Ce%4===0).map(Oe=>{const Ce=parseInt(Oe.replace("h",""),10);return Ce===0?"12am":Ce<12?`${Ce}am`:Ce===12?"12pm":`${Ce-12}pm`}):ye==="1W"?Ee.map(Oe=>Oe.length>3?Oe.substring(0,3):Oe):ye==="1M"?Ee.map(Oe=>{const Ce=Oe.split(" ");return Ce.length>=2?Ce[1]:Oe}):ye==="1Y"||ye==="3M"||ye==="6M"?Ee.map(Oe=>Oe.length>3?Oe.substring(0,3):Oe):Ee.map(Oe=>Oe.length>3?Oe.substring(0,3):Oe);const Le=new Date;switch(ye){case"1D":return["12am","4am","8am","12pm","4pm","8pm"];case"1W":return Array.from({length:7},(Oe,Ce)=>new Date(Le.getTime()-(6-Ce)*24*60*60*1e3).toLocaleDateString("en-US",{weekday:"short"}));case"1M":return Array.from({length:30},(Oe,Ce)=>new Date(Le.getTime()-(29-Ce)*24*60*60*1e3).getDate().toString());case"3M":return Array.from({length:3},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(2-Ce),1).toLocaleDateString("en-US",{month:"short"}));case"6M":return Array.from({length:6},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(5-Ce),1).toLocaleDateString("en-US",{month:"short"}));case"1Y":return Array.from({length:12},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(11-Ce),1).toLocaleDateString("en-US",{month:"short"}));case"ALL":return Array.from({length:7},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(6-Ce),1).toLocaleDateString("en-US",{month:"short"}));default:return["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},Mo=(ye,ve="users")=>{const Ee=ve==="users"?et:re,je={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[ye]||7;if(Ee&&Ee.length>0&&Ee.length===je)return ye==="1D"?Ee.map(Oe=>{const Ce=parseInt(Oe.replace("h",""),10);return Ce===0?"12am":Ce<12?`${Ce}am`:Ce===12?"12pm":`${Ce-12}pm`}):ye==="1Y"||ye==="3M"||ye==="6M"?Ee.map(Oe=>{const Ce=["January","February","March","April","May","June","July","August","September","October","November","December"],_e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].indexOf(Oe);return _e!==-1?Ce[_e]:Oe}):Ee;const Le=new Date;switch(ye){case"1D":return Array.from({length:24},(Oe,Ce)=>{const nt=new Date;return nt.setHours(Ce,0,0,0),nt.toLocaleTimeString("en-US",{hour:"numeric",hour12:!0})});case"1W":return Array.from({length:7},(Oe,Ce)=>new Date(Le.getTime()-(6-Ce)*24*60*60*1e3).toLocaleDateString("en-US",{weekday:"long"}));case"1M":return Array.from({length:30},(Oe,Ce)=>{const nt=new Date(Le.getTime()-(29-Ce)*24*60*60*1e3),_e=nt.toLocaleDateString("en-US",{month:"short"}),_t=nt.getDate();return`${_e} ${_t}`});case"3M":return Array.from({length:3},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(2-Ce),1).toLocaleDateString("en-US",{month:"long"}));case"6M":return Array.from({length:6},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(5-Ce),1).toLocaleDateString("en-US",{month:"long"}));case"1Y":return Array.from({length:12},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(11-Ce),1).toLocaleDateString("en-US",{month:"long"}));case"ALL":return Array.from({length:7},(Oe,Ce)=>new Date(Le.getFullYear(),Le.getMonth()-(6-Ce),1).toLocaleDateString("en-US",{month:"long"}));default:return["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]}},xr=(ye,ve="users")=>{const Ee=ve==="users"?vt:qt,je={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[ye]||7;if(!Ee||Ee.length===0)return Array(je).fill(0);const Le=[...Ee];for(;Le.length<je;)Le.push(0);const Oe=Le.slice(0,je),Ce=Math.max(...Oe,1);return Oe.map(nt=>nt/Ce*100)},Ds=()=>{const ye=tt.length>0?tt:Ta(u,"users"),ve=ye.map((de,je)=>Lc.reduce((Le,Oe)=>{var Ce;return Le+(((Ce=be[Oe.id])==null?void 0:Ce[je])??0)},0)),Ee=Math.max(...ve,1);return r.jsxs("div",{className:"space-y-6 min-h-screen h-full mt-5 flex-1 overflow-y-hidden overflow-x-hidden px-0",children:[r.jsx("div",{className:"px-6 overflow-hidden",children:r.jsxs("div",{className:"flex items-center justify-between gap-8 py-4 px-6 bg-white/5 border border-white/10 rounded-none overflow-x-auto relative",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[r.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:r.jsx(Ct,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Users"}),r.jsx("span",{className:"text-white text-lg font-medium",children:Fn?"...":Jn(Wa.users)}),r.jsxs("div",{className:`flex items-center gap-1 ${pn>=0?"text-green-500":"text-red-500"}`,children:[r.jsx("svg",{className:`w-3 h-3 ${pn<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(pn).toFixed(1),"%"]})]})]})]}),r.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),r.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[r.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:r.jsx(ha,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Organizations"}),r.jsx("span",{className:"text-white text-lg font-medium",children:Fn?"...":Jn(Wa.organizations)}),r.jsxs("div",{className:`flex items-center gap-1 ${Xt>=0?"text-green-500":"text-red-500"}`,children:[r.jsx("svg",{className:`w-3 h-3 ${Xt<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(Xt).toFixed(1),"%"]})]})]})]}),r.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),r.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[r.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:r.jsx(pC,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Sessions"}),r.jsx("span",{className:"text-white text-lg font-medium",children:Fn?"...":Jn(Wa.sessions)}),r.jsxs("div",{className:`flex items-center gap-1 ${wn>=0?"text-green-500":"text-red-500"}`,children:[r.jsx("svg",{className:`w-3 h-3 ${wn<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(wn).toFixed(1),"%"]})]})]})]}),r.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),r.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[r.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:r.jsx(hC,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Activity Hits"}),r.jsx("span",{className:"text-white text-lg font-medium",children:Fn?"...":Jn(Do??0)}),r.jsxs("div",{className:`flex items-center gap-1 ${Va>=0?"text-green-500":"text-red-500"}`,children:[r.jsx("svg",{className:`w-3 h-3 ${Va<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(Va).toFixed(1),"%"]})]})]})]}),r.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),r.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[r.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:r.jsx(Ct,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"New Users"}),r.jsx("span",{className:"text-white text-lg font-medium",children:Fn?"...":Jn(i??0)}),r.jsxs("div",{className:`flex items-center gap-1 ${Kr>=0?"text-green-500":"text-red-500"}`,children:[r.jsx("svg",{className:`w-3 h-3 ${Kr<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(Kr).toFixed(1),"%"]})]})]})]})]})}),r.jsxs("div",{className:"px-6 pb-10 space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[r.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 relative",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-sm text-white uppercase font-light",children:"TOTAL USER"}),r.jsx("div",{className:"flex items-center space-x-1 overflow-x-auto",children:["1D","1W","6M","1Y"].map(de=>r.jsx("button",{onClick:()=>c(de),className:`px-2 py-1 text-xs font-light transition-colors whitespace-nowrap ${l===de?"bg-white/20 text-white border border-white/30":"text-gray-500 hover:text-white"}`,children:de},de))})]}),r.jsxs("div",{className:"flex justify-between items-end mb-6",children:[r.jsx("p",{className:"text-4xl text-white font-light",children:Fn?"...":Jn(Wa.users)}),r.jsxs("div",{className:"flex items-center gap-1 px-2 py-1",children:[r.jsx("svg",{className:`w-3 h-3 ${Et>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:`text-xs font-medium ${Et>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(Et).toFixed(1),"%"]})]})]}),r.jsxs("div",{className:"space-y-2 relative",children:[r.jsxs("div",{className:"h-32 relative",children:[r.jsx("svg",{className:"w-full h-full absolute inset-0",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:r.jsx("defs",{children:r.jsxs("linearGradient",{id:"usersBarGradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[r.jsx("stop",{offset:"0%",style:{stopColor:"rgba(255, 255, 255, 0.3)",stopOpacity:1}}),r.jsx("stop",{offset:"100%",style:{stopColor:"rgba(255, 255, 255, 0.05)",stopOpacity:1}})]})})}),r.jsx("div",{className:"h-32 flex items-end justify-between space-x-1 relative z-10",children:xr(l,"users").map((de,je)=>{const Le=M===je;return r.jsx("div",{className:"flex-1 transition-all duration-200 ease-out relative cursor-pointer group",style:{height:`${de}%`,background:"url(#usersBarGradient)"},onMouseEnter:Oe=>{const Ce=Oe.currentTarget.getBoundingClientRect(),nt=Ce.left+Ce.width/2,_e=Ce.top,_t=150,zn=60,Ca=Math.max(_t/2,Math.min(window.innerWidth-_t/2,nt)),ea=Math.max(zn+10,Math.min(window.innerHeight-10,_e));A(je),B({x:Ca,y:ea})},onMouseLeave:()=>{A(null),B(null)},children:r.jsx("div",{className:"w-full h-full",style:{background:"linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.05))",opacity:Le?1:.8}})},je)})}),M!==null&&D&&r.jsx("div",{className:"fixed z-50 pointer-events-none transition-all duration-200 ease-out animate-in fade-in",style:{left:`${D.x}px`,top:`${D.y}px`,transform:"translate(-50%, -100%)",maxWidth:"calc(100vw - 20px)"},children:r.jsxs("div",{className:"bg-black border border-white/20 rounded-sm px-3 py-2 shadow-lg whitespace-nowrap",children:[r.jsx("div",{className:"text-xs text-gray-400 mb-1 font-mono uppercase",children:Mo(l,"users")[M]}),r.jsxs("div",{className:"text-sm text-white font-sans font-medium",children:[vt[M]!==void 0?vt[M].toLocaleString():"0"," ",r.jsx("span",{className:"font-mono text-xs text-gray-400",children:"users"})]})]})})]}),r.jsx("div",{className:`flex justify-between ${l==="1M"?"text-[10px]":"text-xs"} text-gray-500 font-mono`,children:Ta(l,"users").map((de,je)=>r.jsx("span",{className:"flex-1 text-center truncate",children:de},je))})]})]}),r.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 relative",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm text-white uppercase font-light",children:"Activity Hits"}),r.jsx("p",{className:"text-4xl text-white font-light mt-1",children:Qe?"...":Xa(_s)}),r.jsx("p",{className:"text-xs text-gray-400",children:"Tracked events in selected period"})]}),r.jsx("div",{className:"flex items-center space-x-1 overflow-x-auto",children:["1D","1W","3M","6M","1Y","ALL"].map(de=>r.jsx("button",{onClick:()=>h(de),className:`px-2 py-1 text-xs font-light transition-colors whitespace-nowrap ${u===de?"bg-white/20 text-white border border-white/30":"text-gray-500 hover:text-white"}`,children:de},de))})]}),r.jsxs("div",{className:"space-y-2 relative",children:[r.jsx("div",{className:"h-40 flex items-end gap-1",children:ye.map((de,je)=>{const Le=ve[je]||0;return r.jsx("div",{className:"flex-1 flex flex-col justify-end gap-[1px] h-full cursor-pointer",onMouseEnter:Oe=>Io(Oe,je),onMouseLeave:()=>{L(null),X(null)},children:Lc.map(Oe=>{var _e;const Ce=((_e=be[Oe.id])==null?void 0:_e[je])??0,nt=Le===0||Ee===0?0:Math.max(Ce/Ee*100,Ce>0?4:0);return r.jsx("div",{className:`w-full ${Oe.barClass}`,style:{height:`${nt}%`}},`${Oe.id}-${je}`)})},`${de}-${je}`)})}),Qe&&r.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center text-xs uppercase text-gray-400 pointer-events-none",children:"Loading activity..."}),G!==null&&q&&r.jsx("div",{className:"fixed z-50 pointer-events-none transition-all duration-200 ease-out animate-in fade-in",style:{left:`${q.x}px`,top:`${q.y}px`,transform:"translate(-50%, -100%)",maxWidth:"calc(100vw - 20px)"},children:r.jsxs("div",{className:"bg-black border border-white/20 rounded-sm px-3 py-2 shadow-lg min-w-[180px]",children:[r.jsx("div",{className:"text-xs text-gray-400 mb-2 font-mono uppercase",children:ye[G]||`Bucket ${G+1}`}),r.jsx("div",{className:"space-y-1",children:Lc.map(de=>{var je;return r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-300",children:[r.jsx("span",{className:`w-2 h-2 rounded-sm ${de.dotClass}`}),de.label]}),r.jsx("span",{className:"text-white font-medium",children:((je=be[de.id])==null?void 0:je[G])??0})]},de.id)})})]})}),r.jsx("div",{className:`flex justify-between ${u==="1M"?"text-[10px]":"text-xs"} text-gray-500 font-mono`,children:ye.map((de,je)=>r.jsx("span",{className:"flex-1 text-center truncate",children:de},je))}),r.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-3 mt-4 pt-4 border-t border-white/10",children:Lc.map(de=>r.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-400",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:`w-2 h-2 rounded-sm ${de.dotClass}`}),de.label]}),r.jsx("span",{className:"text-white font-medium",children:Qe?"...":Xa(ks[de.id]||0)})]},de.id))})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"space-y-4 overflow-x-hidden",children:[r.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[r.jsxs("div",{className:"relative",children:[r.jsxs("button",{onClick:()=>E(!T),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[r.jsx(ch,{className:"w-3 h-3"}),r.jsx("span",{children:x})]}),T&&r.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Ea.map(de=>r.jsx("button",{onClick:()=>{N(de),E(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:de},de))})]}),x==="Custom"&&r.jsxs("div",{className:"h-0 flex items-center gap-2",children:[r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),K?_a(K,"MMM dd yyyy"):"From"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:K,onSelect:ne,initialFocus:!0,className:"rounded-none"})})]}),r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),te?_a(te,"MMM dd yyyy"):"To"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:te,onSelect:ee,initialFocus:!0,disabled:de=>K?de<K:!1,className:"rounded-none"})})]})]})]}),r.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),r.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Active Users"}),r.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Users with active session in the time frame"}),r.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[r.jsx("p",{className:"text-3xl text-white font-light",children:Xa(a)}),r.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:r.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 border-white/5 rounded-none",children:[r.jsx("svg",{className:`w-3 h-3 ${Be>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:`text-xs font-medium ${Be>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(Be).toFixed(1),"%"]})]})})]})]}),r.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[r.jsxs("div",{className:"relative",children:[r.jsxs("button",{onClick:()=>O(!k),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[r.jsx(ch,{className:"w-3 h-3"}),r.jsx("span",{children:b})]}),k&&r.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Ea.map(de=>r.jsx("button",{onClick:()=>{y(de),O(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:de},de))})]}),b==="Custom"&&r.jsxs("div",{className:"h-0 flex items-center gap-2",children:[r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),ae?_a(ae,"MMM dd yyyy"):"From"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:ae,onSelect:ge,initialFocus:!0,className:"rounded-none"})})]}),r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),se?_a(se,"MMM dd yyyy"):"To"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:se,onSelect:fe,initialFocus:!0,disabled:de=>ae?de<ae:!1,className:"rounded-none"})})]})]})]}),r.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),r.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"New Users"}),r.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Newly registered Users in the time frame"}),r.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[r.jsx("p",{className:"text-3xl text-white font-light",children:Xa(Yr)}),r.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:r.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[r.jsx("svg",{className:`w-3 h-3 ${Xr>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",style:Xr<0?{transform:"rotate(180deg)"}:{},children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:`text-xs font-medium ${Xr>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(Xr).toFixed(1),"%"]})]})})]})]})]}),r.jsxs("div",{className:"space-y-4 overflow-x-hidden",children:[r.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[r.jsxs("div",{className:"relative",children:[r.jsxs("button",{onClick:()=>I(!R),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[r.jsx(ch,{className:"w-3 h-3"}),r.jsx("span",{children:g})]}),R&&r.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Ea.map(de=>r.jsx("button",{onClick:()=>{w(de),I(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:de},de))})]}),g==="Custom"&&r.jsxs("div",{className:"h-0 flex items-center gap-2",children:[r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),me?_a(me,"MMM dd yyyy"):"From"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:me,onSelect:Re,initialFocus:!0,className:"rounded-none"})})]}),r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),Me?_a(Me,"MMM dd yyyy"):"To"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:Me,onSelect:Ue,initialFocus:!0,disabled:de=>me?de<me:!1,className:"rounded-none"})})]})]})]}),r.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),r.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Organizations"}),r.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Total organizations in the time frame"}),r.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[r.jsx("p",{className:"text-3xl text-white font-light",children:ue?"...":Xa(Ye)}),r.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:r.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[r.jsx("svg",{className:`w-3 h-3 ${le>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:`text-xs font-medium ${le>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(le).toFixed(1),"%"]})]})})]})]}),r.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[r.jsxs("div",{className:"relative",children:[r.jsxs("button",{onClick:()=>j(!F),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[r.jsx(ch,{className:"w-3 h-3"}),r.jsx("span",{children:S})]}),F&&r.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Ea.map(de=>r.jsx("button",{onClick:()=>{C(de),j(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:de},de))})]}),S==="Custom"&&r.jsxs("div",{className:"h-0 flex items-center gap-2",children:[r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),$e?_a($e,"MMM dd yyyy"):"From"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:$e,onSelect:pt,initialFocus:!0,className:"rounded-none"})})]}),r.jsxs(Oa,{children:[r.jsx(Da,{asChild:!0,children:r.jsxs($,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[r.jsx(Za,{className:"mr-1 h-3 w-3"}),Ge?_a(Ge,"MMM dd yyyy"):"To"]})}),r.jsx(da,{className:"w-auto p-0 bg-black border-white/10",children:r.jsx(Ra,{mode:"single",selected:Ge,onSelect:jt,initialFocus:!0,disabled:de=>$e?de<$e:!1,className:"rounded-none"})})]})]})]}),r.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),r.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Teams"}),r.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Total teams in the time frame"}),r.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[r.jsx("p",{className:"text-3xl text-white font-light",children:W?"...":Xa(ie)}),r.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:r.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[r.jsx("svg",{className:`w-3 h-3 ${xe>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:r.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),r.jsxs("span",{className:`text-xs font-medium ${xe>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(xe).toFixed(1),"%"]})]})})]})]})]}),r.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pt-4 overflow-hidden relative rounded-none flex flex-col",children:[r.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),r.jsx("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Cn,{className:"w-4 h-4 text-white/60"}),r.jsx("h4",{className:"text-xs text-gray-400 uppercase font-mono font-light",children:"Security Insights"})]})}),r.jsx("hr",{className:"-mx-10 -mt-1 border-white/10"}),r.jsxs("div",{className:"space-y-3 overflow-y-auto custom-scrollbar max-h-[400px]",children:[Mi.length===0&&r.jsx("div",{className:"text-sm flex items-center justify-center text-gray-400",children:r.jsxs("div",{className:"flex mt-5 items-center justify-center",children:[r.jsx(Cn,{className:"w-4 h-4 text-gray-400 mr-2"}),r.jsx("p",{className:"text-center",children:"No security insights found"})]})}),Mi.map((de,je)=>r.jsx("div",{onClick:()=>Os(de),className:"group py-2 border-b border-white/5 cursor-pointer transition-all duration-200 hover:border-white/20",style:{animation:`slideIn 0.3s ease-out ${je*.1}s both`},children:r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:r.jsx("span",{className:"text-sm text-white/90 font-light truncate group-hover:text-white transition-colors",children:de.title})}),r.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[r.jsx("span",{className:`text-[9px] px-1.5 py-0.5 border rounded-sm uppercase font-mono ${gr(de.severity)}`,children:de.severity}),r.jsx("span",{className:`text-[9px] px-1.5 py-0.5 border rounded-sm capitalize font-mono ${br(de.status)}`,children:de.status})]})]}),r.jsx(Bd,{className:"w-3.5 h-3.5 text-gray-500 group-hover:text-white transition-all flex-shrink-0 mt-0.5"})]})},de.id))]})]})]})]})]})};return r.jsxs("div",{className:"h-screen bg-black text-white overflow-hidden flex flex-col",style:{overflowX:"hidden"},children:[r.jsx("div",{className:"flex-1 overflow-hidden",children:e==="overview"?Ds():e==="users"?r.jsx(y5,{}):e==="organizations"?r.jsx(x5,{}):Ds()}),t&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-3xl rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx(pC,{className:"w-6 h-6 text-white"}),r.jsx("h3",{className:"text-lg text-white font-light",children:"Quick Actions"})]}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>n(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(xt,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("button",{onClick:()=>{n(!1),Bn("/users")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[r.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:r.jsx(Ct,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"text-white font-light mb-1",children:"View All Users"}),r.jsx("p",{className:"text-sm text-gray-400",children:"Manage user accounts"})]}),r.jsx(Xs,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),r.jsxs("button",{onClick:()=>{n(!1),Bn("/organizations")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[r.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:r.jsx(ha,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"text-white font-light mb-1",children:"View Organizations"}),r.jsx("p",{className:"text-sm text-gray-400",children:"Manage organizations"})]}),r.jsx(Xs,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),r.jsxs("button",{onClick:()=>{n(!1),Bn("/sessions")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[r.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:r.jsx(hC,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"text-white font-light mb-1",children:"View Sessions"}),r.jsx("p",{className:"text-sm text-gray-400",children:"Monitor active sessions"})]}),r.jsx(Xs,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),r.jsxs("button",{onClick:()=>{n(!1),Bn("/database")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[r.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:r.jsx(ps,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"text-white font-light mb-1",children:"Database Schema"}),r.jsx("p",{className:"text-sm text-gray-400",children:"View schema visualizer"})]}),r.jsx(Xs,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),r.jsxs("button",{onClick:()=>{n(!1),Bn("/settings")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[r.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:r.jsx(u5,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"text-white font-light mb-1",children:"Settings"}),r.jsx("p",{className:"text-sm text-gray-400",children:"Configure system"})]}),r.jsx(Xs,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),r.jsxs("button",{onClick:()=>{n(!1),Bn("/users")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[r.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:r.jsx(c5,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"text-white font-light mb-1",children:"Search Users"}),r.jsx("p",{className:"text-sm text-gray-400",children:"Find specific users"})]}),r.jsx(Xs,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]})]}),r.jsx("div",{className:"mt-6 pt-6 border-t border-dashed border-white/10",children:r.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-400",children:[r.jsx("span",{children:"Tip: Press Ctrl+K or Cmd+K for command palette"}),r.jsx($,{variant:"ghost",size:"sm",onClick:()=>n(!1),className:"text-gray-400 hover:text-white rounded-none",children:"Close"})]})})]})}),p&&d&&r.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-4",style:{animation:"fadeIn 0.3s ease-out"},onClick:Zr,children:r.jsxs("div",{className:"bg-black border border-white/20 rounded-none max-w-2xl w-full max-h-[80vh] overflow-y-auto",style:{animation:"slideUp 0.3s ease-out"},onClick:ye=>ye.stopPropagation(),children:[r.jsx("div",{className:"sticky top-0 bg-black border-b border-white/10 p-6 z-10",children:r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx(Cn,{className:"w-6 h-6 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light",children:d.title})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsxs("span",{className:`text-xs px-2 py-1 border rounded-none uppercase font-medium ${gr(d.severity)}`,children:[d.severity," Severity"]}),r.jsx("span",{className:`text-xs px-2 py-1 border rounded-none capitalize ${br(d.status)}`,children:d.status}),d.cve&&r.jsx("span",{className:"text-xs text-gray-400 font-mono bg-white/5 px-2 py-1 border border-white/10 rounded-none",children:d.cve})]})]}),r.jsx("button",{onClick:Zr,className:"p-2 hover:bg-white/10 transition-colors rounded-none",children:r.jsx(xt,{className:"w-5 h-5 text-gray-400 hover:text-white"})})]})}),r.jsxs("div",{className:"p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-2",children:"Release Date"}),r.jsx("p",{className:"text-white",children:new Date(d.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-2",children:"Description"}),d.description.includes("npm install")?r.jsxs("div",{children:[r.jsx("p",{className:"text-white leading-relaxed mb-3",children:d.description.split("Run:")[0]}),r.jsx("div",{className:"relative group",children:r.jsx("div",{className:"bg-black border border-white/20 rounded-none p-3 font-mono text-sm",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("code",{children:[r.jsx("span",{className:"text-green-400",children:"$"})," ",r.jsx("span",{className:"text-cyan-400",children:"npm"})," ",r.jsx("span",{className:"text-yellow-400",children:"install"})," ",r.jsx("span",{className:"text-white",children:"better-auth@latest"})]}),r.jsx("button",{onClick:()=>{navigator.clipboard.writeText("npm install better-auth@latest"),H.success("Command copied to clipboard")},className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 hover:bg-white/10 rounded",title:"Copy command",children:r.jsx(aa,{className:"w-4 h-4 text-gray-400 hover:text-white"})})]})})})]}):r.jsx("p",{className:"text-white leading-relaxed",children:d.description})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-3",children:"Affected Components"}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:d.affectedComponents.map((ye,ve)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-white/5 border border-white/10 rounded-none",style:{animation:`slideIn 0.3s ease-out ${ve*.1}s both`},children:[r.jsx("div",{className:"w-2 h-2 bg-white rounded-none flex-shrink-0"}),r.jsx("span",{className:"text-sm text-white",children:ye})]},ve))})]}),r.jsx("div",{className:"p-4 bg-white/5 border border-white/10 rounded-none",children:r.jsxs("div",{className:"flex items-start gap-3",children:[d.status==="applied"&&r.jsxs(r.Fragment,{children:[r.jsx(zf,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Patch Applied"}),r.jsx("p",{className:"text-xs text-gray-400",children:"This security patch has been successfully applied to your system."})]})]}),d.status==="scheduled"&&r.jsxs(r.Fragment,{children:[r.jsx(d5,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Scheduled"}),r.jsx("p",{className:"text-xs text-gray-400",children:"This patch is scheduled for deployment in the next maintenance window."})]})]}),d.status==="pending"&&r.jsxs(r.Fragment,{children:[r.jsx(bte,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Action Required"}),r.jsx("p",{className:"text-xs text-gray-400",children:"This patch is pending review and requires manual approval before deployment."})]})]})]})}),r.jsx("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-white/10",children:r.jsx($,{variant:"ghost",onClick:Zr,className:"text-gray-400 hover:text-white rounded-none",children:"Close"})})]})]})}),r.jsx("style",{children:`
510
510
  @keyframes fadeIn {
511
511
  from {
512
512
  opacity: 0;