better-auth-studio 1.0.36-beta.9 → 1.0.37

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.
@@ -465,7 +465,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
465
465
  .custom-scrollbar::-webkit-scrollbar-thumb:hover {
466
466
  background: rgba(255, 255, 255, 0.3);
467
467
  }
468
- `})]})}const _n=m.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:De("rounded-lg border border-gray-700 bg-gray-900 text-white shadow-sm",e),...t}));_n.displayName="Card";const Dn=m.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:De("flex flex-col space-y-1.5 p-6",e),...t}));Dn.displayName="CardHeader";const Tn=m.forwardRef(({className:e,...t},n)=>s.jsx("h3",{ref:n,className:De("text-2xl font-semibold leading-none tracking-tight text-white",e),...t}));Tn.displayName="CardTitle";const fr=m.forwardRef(({className:e,...t},n)=>s.jsx("p",{ref:n,className:De("text-sm text-gray-300",e),...t}));fr.displayName="CardDescription";const Pn=m.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:De("p-6 pt-0",e),...t}));Pn.displayName="CardContent";const jF=m.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:De("flex items-center p-6 pt-0",e),...t}));jF.displayName="CardFooter";const kF={databaseSchemaNode:Um},Sw=[{name:"organization",displayName:"Organization",description:"Multi-tenant organization support",color:"bg-blue-500"},{name:"teams",displayName:"Teams",description:"Team management within organizations",color:"bg-green-500"},{name:"twoFactor",displayName:"Two Factor",description:"Two-factor authentication support",color:"bg-purple-500"},{name:"apiKey",displayName:"API Key",description:"API key authentication",color:"bg-orange-500"},{name:"passkey",displayName:"Passkey",description:"WebAuthn passkey support",color:"bg-pink-500"}];function SF(){const[e,t]=m.useState(null),[n,r]=m.useState(!0),[a,i]=m.useState(null),[o,l]=m.useState([]),[c,d]=m.useState([]),[h,u,f]=tP([]),[p,w,v]=nP([]),b=m.useCallback(k=>{const S=Sw.find(M=>M.name===k);return(S==null?void 0:S.color)||"bg-gray-500"},[]),g=m.useCallback((k,S,M)=>{if(k==="user"||k==="session"||k==="account"||k==="verification")return"core";for(const A of M)if(k===A||k.includes(A))return A;return"core"},[]),y=m.useCallback(async()=>{try{const S=await(await fetch("/api/plugins")).json();if(S.plugins&&Array.isArray(S.plugins)){const M=S.plugins.map(A=>({name:A.id,displayName:A.name||A.id,description:A.description||`${A.id} plugin for Better Auth`,color:b(A.id)}));d(M),l(M.map(A=>A.name))}}catch{d(Sw),l(["organization"])}},[b]),x=m.useCallback(async k=>{try{r(!0);const S=k.length>0?`?plugins=${k.join(",")}`:"",A=await(await fetch(`/api/database/schema${S}`)).json();A.success?t(A.schema):i(A.error||"Failed to fetch schema")}catch{i("Failed to fetch database schema")}finally{r(!1)}},[]);m.useEffect(()=>{y()},[y]),m.useEffect(()=>{o.length>0&&x(o)},[o,x]),m.useEffect(()=>{if(!e)return;const k=[],S=[];e.tables.forEach((M,A)=>{const I=M.fields.map(U=>({id:`${M.name}-${U.name}`,isPrimary:U.primaryKey||!1,isNullable:!U.required,isUnique:U.unique||!1,isIdentity:!1,name:U.name,format:U.type,plugin:g(M.name,U.name,o)}));k.push({id:M.name,type:"databaseSchemaNode",position:{x:A%3*380,y:Math.floor(A/3)*320},data:{name:M.name,displayName:M.displayName,isForeign:!1,plugin:g(M.name,"",o),columns:I.map(U=>{var $;return{...U,description:(($=M.fields.find(L=>L.name===U.name))==null?void 0:$.description)||""}}),relationships:M.relationships}})}),e.tables.forEach(M=>{M.relationships.forEach(A=>{if(A.type==="many-to-one")return;const I=M.name,U=A.target,$=k.find(E=>E.id===I),L=k.find(E=>E.id===U);if($&&L){const E=A.type==="one-to-one"?"1:1":"1:N";S.push({id:`${I}-${U}-${A.field}`,source:I,target:U,type:"smoothstep",animated:!1,style:{stroke:"#6b7280",strokeWidth:2,strokeDasharray:"0"},label:E,labelStyle:{fontSize:"11px",fill:"#9ca3af",fontWeight:"500"},labelBgStyle:{fill:"rgba(0, 0, 0, 0.9)",fillOpacity:1,rx:4,ry:4},markerEnd:{type:"arrowclosed",color:"#6b7280",width:12,height:12}})}})}),u(k),w(S)},[e,o,u,w,g]);const N=m.useCallback(k=>w(S=>Y1(k,S)),[w]);if(n)return s.jsxs("div",{className:"p-6",children:[s.jsxs("div",{className:"animate-pulse",children:[s.jsx("div",{className:"h-8 bg-gray-700 rounded w-1/3 mb-6"}),s.jsx("div",{className:"h-96 bg-gray-700 rounded"})]}),s.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 mt-4",children:"Loading plugins and schema..."})]});if(a)return s.jsx("div",{className:"p-6",children:s.jsxs("div",{className:"bg-red-900/20 border border-red-500/20 rounded-none p-6",children:[s.jsx("h2",{className:"text-xl font-semibold text-red-400 mb-2",children:"Error Loading Schema"}),s.jsx("p",{className:"text-gray-300",children:a})]})});const j=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("div",{className:"flex items-center justify-between mb-1",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(lt,{className:"w-6 h-6 text-white"}),s.jsx("h1",{className:"text-2xl font-light text-white",children:"Schema Visualizer"})]})}),s.jsx("p",{className:"text-gray-400",children:"Visualize your Better Auth database schema with interactive tables and relationships."})]}),s.jsxs("div",{className:"flex-1 grid grid-cols-4 gap-6",children:[s.jsxs("div",{className:"col-span-1",children:[s.jsxs(_n,{className:"rounded-none bg-black h-fit shadow-sm",children:[s.jsx(Dn,{children:s.jsxs(Tn,{className:"font-light text-xl text-white flex items-center space-x-2",children:[s.jsx(bi,{className:"w-5 h-5"}),s.jsx("span",{children:"Plugins"})]})}),s.jsx(Pn,{className:"space-y-3",children:c.length>0?c.map(k=>s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:`w-3 h-3 rounded-full ${k.color}`}),s.jsx("label",{htmlFor:k.name,className:"text-sm font-medium text-white cursor-pointer",children:k.displayName.slice(0,1).toUpperCase()+k.displayName.slice(1).replace("-"," ")})]},k.name)):s.jsx("div",{className:"text-sm text-white/70",children:"No plugins detected in configuration"})})]}),e&&s.jsxs(_n,{className:"rounded-none bg-black mt-4 shadow-sm",children:[s.jsx(Dn,{children:s.jsx(Tn,{className:"text-white text-sm",children:"Schema Info"})}),s.jsxs(Pn,{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-white/70",children:"Tables:"}),s.jsx("span",{className:"text-white",children:e.tables.length})]}),s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-white/70",children:"Relationships:"}),s.jsx("span",{className:"text-white",children:e.tables.reduce((k,S)=>k+S.relationships.length,0)})]}),s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-white/70",children:"Available Plugins:"}),s.jsx("span",{className:"text-white",children:c.length})]}),s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-white/70",children:"Selected Plugins:"}),s.jsx("span",{className:"text-white",children:o.length})]})]})]})]}),s.jsx("div",{className:"col-span-3",children:s.jsx("div",{className:"h-full bg-black border border-gray-700 rounded-lg overflow-hidden shadow-xl",children:s.jsxs(eP,{nodes:h,edges:p,onNodesChange:f,onEdgesChange:v,onConnect:N,nodeTypes:kF,fitView:!0,fitViewOptions:{padding:.1,includeHiddenNodes:!1},className:"bg-black",connectionLineType:"smoothstep",defaultEdgeOptions:{style:{stroke:"#6b7280",strokeWidth:2},animated:!1,type:"smoothstep"},nodesDraggable:!0,nodesConnectable:!1,elementsSelectable:!0,children:[s.jsx(mP,{className:"bg-gray-900 border-gray-700 [&>button]:bg-gray-800 [&>button]:border-gray-600 [&>button]:text-white [&>button:hover]:bg-gray-700"}),s.jsx(EP,{className:"bg-gray-900 border-gray-700",nodeColor:k=>{var S;return(S=k.data)!=null&&S.isForeign?"#374151":"#1f2937"},maskColor:"rgba(0, 0, 0, 0.9)"}),s.jsx(oP,{variant:Xr.Dots,gap:20,size:1,color:"#374151"})]})})})]})]});return s.jsxs("div",{className:"overflow-hidden p-6 h-[90vh] flex flex-col opacity-70 bg-black relative",children:[s.jsxs("div",{className:"absolute inset-0 z-50 flex items-center justify-center pointer-events-none",children:[s.jsx("div",{className:"absolute inset-0 backdrop-blur-sm",style:{WebkitBackdropFilter:"blur(8px)",backdropFilter:"blur(8px)"}}),s.jsxs("div",{className:"relative -mt-6 bg-black/50 border border-dashed border-white/20 rounded-none p-12 max-w-2xl mx-6 text-center pointer-events-auto",children:[s.jsx("div",{className:"flex items-center justify-center mb-4",children:s.jsxs("div",{className:"relative",children:[s.jsx(lt,{className:"w-16 h-16 text-white opacity-50"}),s.jsx(VP,{className:"w-8 h-8 text-white opacity-80 absolute -top-2 -right-2 animate-pulse"})]})}),s.jsx("h2",{className:"text-3xl font-mono uppercase font-light text-white mb-3",children:"Coming Soon"}),s.jsx("p",{className:"text-lg text-gray-300 font-light mb-6 leading-relaxed",children:"We will be having this feature soon. This feature will allow you to explore your Better Auth database structure with beautiful, interactive graphs showing all tables, relationships, and data flow."}),s.jsxs("div",{className:"flex items-center justify-center space-x-6 text-sm text-gray-400",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),s.jsx("span",{children:"Interactive Tables"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),s.jsx("span",{children:"Relationship Mapping"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full"}),s.jsx("span",{children:"Real-time Updates"})]})]})]})]}),s.jsx("div",{className:"blur-sm opacity-50 pointer-events-none",children:j})]})}const CF=u2("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-white text-black hover:bg-white",secondary:"border-transparent bg-gray-800 text-white hover:bg-gray-800 border border-gray-600",destructive:"border-transparent bg-red-500 text-white hover:bg-red-600",outline:"text-gray-300 border-gray-600",success:"border-transparent bg-green-900 text-green-300",warning:"border-transparent bg-yellow-900 text-yellow-300",error:"border-transparent bg-red-900 text-red-300",info:"border-transparent bg-gray-800 text-white border border-gray-600"}},defaultVariants:{variant:"default"}});function at({className:e,variant:t,...n}){return s.jsx("div",{className:De(CF({variant:t}),e),...n})}function EF(){const{orgId:e}=qp(),t=Dr(),[n,r]=m.useState(null),[a,i]=m.useState([]),[o,l]=m.useState([]),[c,d]=m.useState([]),[h,u]=m.useState(!0),[f,p]=m.useState("details"),[w,v]=m.useState(!1),[b,g]=m.useState(!1),[y,x]=m.useState(!1),[N,j]=m.useState(!1),[k,S]=m.useState(!1),[M,A]=m.useState(!1),[I,U]=m.useState(!1),[$,L]=m.useState(!1),[E,O]=m.useState(null),[D,T]=m.useState(""),[C,_]=m.useState(""),[z,H]=m.useState([]),[P,B]=m.useState({name:""}),[q,G]=m.useState(!1),[se,re]=m.useState([]),[Z,R]=m.useState(!1),[ee,J]=m.useState([]),[F,K]=m.useState(!1);m.useEffect(()=>{e&&(ce(),ve(),ge(),Te(),tt(),Ae())},[e]),m.useEffect(()=>{w&&e&&Ae()},[]),m.useEffect(()=>{f==="members"&&e&&tt()},[f,e]),m.useEffect(()=>{f==="invitations"&&e&&Te()},[f,e]);const ne=W=>{B({name:W})},ce=async()=>{try{const te=await(await fetch(`/api/organizations/${e}`)).json();te.success&&te.organization||te.organization?r(te.organization):V.error("Organization not found")}catch(W){console.error("Failed to fetch organization:",W),V.error("Failed to load organization")}finally{u(!1)}},ge=async()=>{try{const te=await(await fetch("/api/plugins/teams/status")).json();v(te.enabled)}catch(W){console.error("Failed to check teams status:",W),v(!1)}},ve=async()=>{try{const te=await(await fetch("/api/plugins/organization/status")).json();g(te.enabled)}catch(W){console.error("Failed to check organization status:",W),g(!1)}},Ae=async()=>{try{const te=await(await fetch(`/api/organizations/${e}/teams`)).json();te.success&&i(te.teams||[])}catch(W){console.error("Failed to fetch teams:",W),V.error("Failed to load teams")}},Te=async()=>{try{const te=await(await fetch(`/api/organizations/${e}/invitations`)).json();te.success&&l(te.invitations||[])}catch(W){console.error("Failed to fetch invitations:",W),V.error("Failed to load invitations")}},tt=async()=>{try{const te=await(await fetch(`/api/organizations/${e}/members`)).json();te.success&&d(te.members||[])}catch(W){console.error("Failed to fetch members:",W),V.error("Failed to load members")}},ht=async W=>{re([]),R(!0),re([{id:"start",type:"info",message:`Starting member seeding process for ${W} members...`,timestamp:new Date}]);try{const ue=await(await fetch(`/api/organizations/${e}/seed-members`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:W})})).json();if(ue.success){const Ne=ue.results.map((he,Pe)=>he.success?{id:`member-${Pe}`,type:"progress",message:`Adding member: ${he.member.user.name} (${he.member.user.email})`,timestamp:new Date,status:"completed"}:{id:`member-${Pe}`,type:"error",message:`Failed to add member ${Pe+1}: ${he.error}`,timestamp:new Date});re(he=>[...he,...Ne]);const Se=ue.results.filter(he=>he.success).length;re(he=>[...he,{id:"complete",type:"success",message:`✅ Seeding completed! Added ${Se}/${W} members successfully`,timestamp:new Date}]),await tt(),V.success(`Successfully added ${Se} members!`)}else re(Ne=>[...Ne,{id:"error",type:"error",message:`❌ Seeding failed: ${ue.error||"Unknown error"}`,timestamp:new Date}]),V.error(ue.error||"Failed to seed members")}catch(te){re(ue=>[...ue,{id:"error",type:"error",message:`❌ Network error: ${te}`,timestamp:new Date}]),V.error("Failed to seed members")}finally{R(!1)}},Le=async W=>{J([]),K(!0),J([{id:"start",type:"info",message:`Starting team seeding process for ${W} teams...`,timestamp:new Date}]);try{const ue=await(await fetch(`/api/organizations/${e}/seed-teams`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:W})})).json();if(ue.success){const Ne=ue.results.map((he,Pe)=>he.success?{id:`team-${Pe}`,type:"progress",message:`Creating team: ${he.team.name}`,timestamp:new Date,status:"completed"}:{id:`team-${Pe}`,type:"error",message:`Failed to create team ${Pe+1}: ${he.error}`,timestamp:new Date});J(he=>[...he,...Ne]);const Se=ue.results.filter(he=>he.success).length;J(he=>[...he,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${Se}/${W} teams successfully`,timestamp:new Date}]),await Ae(),V.success(`Successfully created ${Se} teams!`)}else J(Ne=>[...Ne,{id:"error",type:"error",message:`❌ Seeding failed: ${ue.error||"Unknown error"}`,timestamp:new Date}]),V.error(ue.error||"Failed to seed teams")}catch(te){J(ue=>[...ue,{id:"error",type:"error",message:`❌ Network error: ${te}`,timestamp:new Date}]),V.error("Failed to seed teams")}finally{K(!1)}},Oe=async()=>{try{const te=await(await fetch("/api/users/all")).json();te.success&&H(te.users||[])}catch(W){console.error("Failed to fetch users:",W)}},Ge=()=>{Oe(),x(!0)},Je=async()=>{if(!D){V.error("Please enter an email address");return}if(!C){V.error("Please select an inviter");return}G(!0);const W=V.loading("Sending invitation...");try{const ue=await(await fetch(`/api/organizations/${e}/invitations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:D,role:"member",inviterId:C})})).json();ue.success?(await Te(),x(!1),T(""),_(""),V.success("Invitation sent successfully!",{id:W})):V.error(`Error sending invitation: ${ue.error||"Unknown error"}`,{id:W})}catch(te){console.error("Error sending invitation:",te),V.error("Error sending invitation",{id:W})}finally{G(!1)}},ot=async W=>{const te=V.loading("Cancelling invitation...");try{const Ne=await(await fetch(`/api/invitations/${W}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();Ne.success?(await Te(),V.success("Invitation cancelled successfully!",{id:te})):V.error(`Error cancelling invitation: ${Ne.error||"Unknown error"}`,{id:te})}catch(ue){console.error("Error cancelling invitation:",ue),V.error("Error cancelling invitation",{id:te})}},Ot=async(W,te)=>{const ue=V.loading("Resending invitation...");try{const Se=await(await fetch(`/api/invitations/${W}/resend`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();Se.success?(await Te(),V.success(`Invitation resent to ${te}!`,{id:ue})):V.error(`Error resending invitation: ${Se.error||"Unknown error"}`,{id:ue})}catch(Ne){console.error("Error resending invitation:",Ne),V.error("Error resending invitation",{id:ue})}},zt=async(W,te)=>{const ue=V.loading(`Removing ${te}...`);try{const Se=await(await fetch(`/api/members/${W}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();Se.success?(await tt(),V.success(`${te} removed from organization!`,{id:ue})):V.error(`Error removing member: ${Se.error||"Unknown error"}`,{id:ue})}catch(Ne){console.error("Error removing member:",Ne),V.error("Error removing member",{id:ue})}},ae=async()=>{if(!P.name){V.error("Please enter a team name");return}const W=V.loading("Creating team...");try{const ue=await(await fetch(`/api/organizations/${e}/teams`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:P.name,organizationId:e})})).json();ue.success?(await Ae(),A(!1),B({name:""}),V.success("Team created successfully!",{id:W})):V.error(`Error creating team: ${ue.error||"Unknown error"}`,{id:W})}catch(te){console.error("Error creating team:",te),V.error("Error creating team",{id:W})}},me=async()=>{if(!E||!P.name){V.error("Please enter a team name");return}const W=V.loading("Updating team...");try{const ue=await(await fetch(`/api/teams/${E.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:P.name})})).json();ue.success?(await Ae(),U(!1),O(null),B({name:""}),V.success("Team updated successfully!",{id:W})):V.error(`Error updating team: ${ue.error||"Unknown error"}`,{id:W})}catch(te){console.error("Error updating team:",te),V.error("Error updating team",{id:W})}},ze=async()=>{if(!E){V.error("No team selected");return}const W=V.loading("Deleting team...");try{const ue=await(await fetch(`/api/teams/${E.id}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();ue.success?(await Ae(),L(!1),O(null),V.success("Team deleted successfully!",{id:W})):V.error(`Error deleting team: ${ue.error||"Unknown error"}`,{id:W})}catch(te){console.error("Error deleting team:",te),V.error("Error deleting team",{id:W})}},X=W=>{O(W),B({name:W.name}),U(!0)},le=W=>{O(W),L(!0)};return h?s.jsx("div",{className:"flex items-center justify-center h-32",children:s.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[s.jsx(ca,{className:"w-6 h-6 text-white animate-spin"}),s.jsx("div",{className:"text-white text-sm",children:"Loading organization details..."})]})}):n?s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center space-x-4",children:s.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:s.jsxs("span",{className:"font-light",children:[s.jsxs("span",{onClick:()=>t("/organizations"),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["orgs /"," "]}),s.jsx("span",{className:"text-white font-mono text-sm",children:e})]})})}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs(Y,{onClick:()=>j(!0),className:"border border-dashed border-white/20 text-white bg-transparent hover:bg-white/10 rounded-none",children:[s.jsx(Ze,{className:"w-4 h-4 mr-2"}),"Seed Members"]}),s.jsxs(Y,{onClick:Ge,className:"border border-dashed border-white/20 text-white bg-transparent hover:bg-white/10 rounded-none",children:[s.jsx(Ir,{className:"w-4 h-4 mr-2"}),"Invite User"]}),s.jsxs(Y,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[s.jsx(Ca,{className:"w-4 h-4 mr-2"}),"Edit Organization"]})]})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-12 h-12 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:s.jsx(Ln,{className:"w-6 h-6 text-white"})}),s.jsx("div",{children:s.jsxs("h1",{className:"text-2xl text-white font-light inline-flex items-center",children:[n.name,s.jsxs("sup",{className:"text-xs text-gray-500 ml-2",children:[s.jsx("span",{className:"mr-1",children:"["}),s.jsx("span",{className:"text-white/80 font-mono text-xs",children:n.slug}),s.jsx("span",{className:"ml-1",children:"]"})]})]})})]}),s.jsx("div",{className:"border-b border-white/10",children:s.jsxs("nav",{className:"flex space-x-8",children:[s.jsxs("button",{onClick:()=>p("details"),className:`flex items-center space-x-2 px-3 py-4 text-sm font-medium border-b-2 transition-all duration-200 ${f==="details"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-gray-300"}`,children:[s.jsx(Ln,{className:"w-4 h-4"}),s.jsxs("span",{className:"inline-flex items-start",children:["Details",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:s.jsx(Nr,{value:0,className:"text-white/80 font-mono text-xs",prefix:s.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]}),s.jsxs("button",{onClick:()=>p("members"),className:`flex items-center space-x-2 px-3 py-4 text-sm font-medium border-b-2 transition-all duration-200 ${f==="members"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-gray-300"}`,children:[s.jsx(Ze,{className:"w-4 h-4"}),s.jsxs("span",{className:"inline-flex items-start",children:["Members",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:s.jsx(Nr,{value:c.length,className:"text-white/80 font-mono text-xs",prefix:s.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]}),s.jsxs("button",{onClick:()=>p("invitations"),className:`flex items-center space-x-2 px-3 py-4 text-sm font-medium border-b-2 transition-all duration-200 ${f==="invitations"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-gray-300"}`,children:[s.jsx(Ir,{className:"w-4 h-4"}),s.jsxs("span",{className:"inline-flex items-start",children:["Invitations",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:s.jsx(Nr,{value:o.length,className:"text-white/80 font-mono text-xs",prefix:s.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]}),s.jsxs("button",{onClick:()=>p("teams"),className:`flex items-center space-x-2 px-3 py-4 text-sm font-medium border-b-2 transition-all duration-200 ${f==="teams"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-gray-300"}`,children:[s.jsx(Ze,{className:"w-4 h-4"}),s.jsxs("span",{className:"inline-flex items-start",children:["Teams",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:s.jsx(Nr,{value:a.length,className:"text-white/80 font-mono text-xs",prefix:s.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]})]})}),f==="details"&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:[s.jsx("h3",{className:"text-lg text-white font-light mb-4",children:"Organization Information"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Name"}),s.jsx("p",{className:"text-white font-sans mt-1",children:n.name})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Slug"}),s.jsx("p",{className:"text-white font-mono mt-1",children:n.slug})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Created"}),s.jsx("p",{className:"text-white font-sans mt-1",children:new Date(n.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6",children:[s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ze,{className:"w-8 h-8 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl text-white font-sans font-light",children:c.length}),s.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Members"})]})]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ze,{className:"w-8 h-8 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.length}),s.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Teams"})]})]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ir,{className:"w-8 h-8 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl text-white font-sans font-light",children:o.length}),s.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Invitations"})]})]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Yn,{className:"w-8 h-8 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl text-white font-sans font-light",children:Math.ceil((new Date().getTime()-new Date(n.createdAt).getTime())/(1e3*60*60*24))}),s.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Days Active"})]})]})})]})]}),f==="teams"&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Teams",s.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[s.jsx("span",{className:"mr-1",children:"["}),s.jsx("span",{className:"text-white font-mono text-xs",children:a.length}),s.jsx("span",{className:"ml-1",children:"]"})]})]}),s.jsx("p",{className:"text-gray-400 mt-1 uppercase font-mono text-xs font-light",children:"Manage teams within this organization"})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs(Y,{onClick:()=>S(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[s.jsx(Vr,{className:"w-4 h-4 mr-2"}),"Seed Teams"]}),s.jsxs(Y,{onClick:()=>A(!0),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[s.jsx(Yo,{className:"w-4 h-4 mr-2"}),"Create Team"]})]})]}),w?a.length>0?s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Team"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Members"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Created"}),s.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),s.jsx("tbody",{children:a.map(W=>s.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5 cursor-pointer",onClick:()=>t(`/organizations/${e}/teams/${W.id}`),children:[s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-10 h-10 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:s.jsx(Ze,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:W.name}),s.jsxs("div",{className:"text-sm text-gray-400",children:["Team ID: ",W.id]})]})]})}),s.jsx("td",{className:"py-4 px-4 text-white",children:W.memberCount||0}),s.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(W.createdAt).toLocaleDateString()}),s.jsx("td",{className:"py-4 px-4 text-right",children:s.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[s.jsxs(Y,{variant:"outline",size:"sm",className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",onClick:te=>{te.stopPropagation(),X(W)},children:[s.jsx(Ca,{className:"w-4 h-4 mr-1"}),"Edit"]}),s.jsxs(Y,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:te=>{te.stopPropagation(),le(W)},children:[s.jsx(cd,{className:"w-4 h-4 mr-1"}),"Delete"]})]})})]},W.id))})]})})}):s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:s.jsxs("div",{className:"text-center",children:[s.jsx(Ze,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Teams Yet"}),s.jsx("p",{className:"text-gray-400 mb-6",children:"Create your first team to start organizing members within this organization."}),s.jsxs(Y,{onClick:()=>A(!0),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[s.jsx(Yo,{className:"w-4 h-4 mr-2"}),"Create First Team"]})]})}):s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-8",children:s.jsxs("div",{className:"flex items-start space-x-4",children:[s.jsx("div",{className:"flex-shrink-0",children:s.jsx(Ze,{className:"w-12 h-12 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"Teams Feature Required"}),s.jsx("p",{className:"text-gray-300 mb-6",children:"To use Teams in Better Auth Studio, you need to enable the teams feature in your organization plugin configuration."}),s.jsxs("div",{className:"bg-black/50 border border-dashed border-white/20 rounded-none p-4 mb-6",children:[s.jsx("h4",{className:"text-white font-light mb-3",children:"Follow these steps:"}),s.jsx("ol",{className:"text-gray-300 space-y-2 text-sm list-decimal list-inside",children:s.jsx("li",{children:"Update your auth configuration file to enable teams:"})}),s.jsx("div",{className:"mt-4 bg-black/70 border border-dashed border-white/10 rounded-none p-3 overflow-x-auto",children:s.jsxs("pre",{className:"text-sm text-gray-300",children:[s.jsx("span",{className:"text-blue-400",children:"import"})," ","{ betterAuth }"," ",s.jsx("span",{className:"text-blue-400",children:"from"})," ",s.jsx("span",{className:"text-green-400",children:'"better-auth"'})," ",s.jsx("br",{}),s.jsx("span",{className:"text-blue-400",children:"import"})," ","{ organization }"," ",s.jsx("span",{className:"text-blue-400",children:"from"})," ",s.jsx("span",{className:"text-green-400",children:'"better-auth/plugins/organization"'})," ",s.jsx("br",{}),s.jsx("span",{className:"text-blue-400",children:"export const"})," ",s.jsx("span",{className:"text-yellow-300",children:"auth"})," ="," ",s.jsx("span",{className:"text-yellow-300",children:"betterAuth"}),"(","{"," ",s.jsx("br",{}),s.jsx("span",{className:"text-gray-500 pl-10",children:"// ... your existing configuration"})," ",s.jsx("br",{}),s.jsx("span",{className:"text-red-300 pl-10",children:"plugins"}),": [ ",s.jsx("br",{}),s.jsx("span",{className:"text-yellow-300 pl-12",children:"organization"}),"(","{"," ",s.jsx("br",{}),s.jsx("span",{className:"text-red-300 pl-16",children:"teams"}),": ","{"," ",s.jsx("br",{}),s.jsx("span",{className:"text-yellow-300 pl-20",children:"enabled"}),":"," ",s.jsx("span",{className:"text-blue-400",children:"true"})," ",s.jsx("br",{}),s.jsx("span",{className:"pl-16",children:"}"})," ",s.jsx("br",{}),s.jsx("span",{className:"pl-12",children:"})"})," ",s.jsx("br",{}),s.jsx("span",{className:"pl-10",children:"]"})," ",s.jsx("br",{}),"}",") ",s.jsx("br",{})]})}),s.jsx("div",{className:"mt-4",children:s.jsx("p",{className:"text-gray-400 text-sm",children:"2. Run migrations to create the teams table"})}),s.jsx("div",{className:"mt-2",children:s.jsx("p",{className:"text-gray-400 text-sm",children:"3. Restart your application to apply the changes"})})]}),s.jsx(Y,{onClick:()=>window.location.reload(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Check Again"}),s.jsxs("div",{className:"mt-4 text-xs text-gray-500",children:["Need help? Check the"," ",s.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"})]})]})]})})]}),f==="members"&&s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Members",s.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[s.jsx("span",{className:"mr-1",children:"["}),s.jsx("span",{className:"text-white font-mono text-xs",children:c.length}),s.jsx("span",{className:"ml-1",children:"]"})]})]}),s.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage organization members and their roles"})]})}),c.length>0?s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Joined"}),s.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),s.jsx("tbody",{children:c.map(W=>s.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5",children:[s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("img",{src:W.user.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${W.user.id}`,alt:W.user.name,className:"w-10 h-10 rounded-none border border-dashed border-white/20"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:W.user.name}),s.jsxs("div",{className:"text-sm text-gray-400",children:["ID: ",W.user.id]})]})]})}),s.jsx("td",{className:"py-4 px-4 text-white",children:W.user.email}),s.jsx("td",{className:"py-4 px-4",children:s.jsx(at,{variant:"secondary",className:"text-xs bg-blue-900/10 border border-dashed rounded-none border-blue-500/30 text-blue-400/70 capitalize",children:W.role})}),s.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(W.joinedAt).toLocaleDateString()}),s.jsx("td",{className:"py-4 px-4 text-right",children:s.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.jsxs(Y,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:()=>zt(W.id,W.user.name),children:[s.jsx(cd,{className:"w-4 h-4 mr-1"}),"Remove"]})})})]},W.id))})]})})}):s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:s.jsxs("div",{className:"text-center",children:[s.jsx(Ze,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Members Yet"}),s.jsx("p",{className:"text-gray-400 mb-6",children:"Invite users or seed members from existing users to get started."}),s.jsxs("div",{className:"flex items-center justify-center space-x-3",children:[s.jsxs(Y,{onClick:()=>j(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[s.jsx(Ze,{className:"w-4 h-4 mr-2"}),"Seed Members"]}),s.jsxs(Y,{onClick:Ge,className:"bg-white text-white hover:bg-white/90 bg-transparent border border-white/20 rounded-none",children:[s.jsx(Ir,{className:"w-4 h-4 mr-2"}),"Invite User"]})]})]})})]}),f==="invitations"&&s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Invitations",s.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[s.jsx("span",{className:"mr-1",children:"["}),s.jsx("span",{className:"text-white font-mono text-xs",children:o.length}),s.jsx("span",{className:"ml-1",children:"]"})]})]}),s.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage pending invitations to this organization"})]})}),o.length>0?s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Status"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Expires"}),s.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),s.jsx("tbody",{children:o.map(W=>s.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5",children:[s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-10 h-10 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:s.jsx(Ir,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:W.email}),s.jsxs("div",{className:"text-sm text-gray-400",children:["Expires on"," ",new Date(W.expiresAt).toLocaleDateString("en-US",{month:"short",year:"numeric",day:"numeric"})]})]})]})}),s.jsx("td",{className:"py-4 px-4 text-white capitalize",children:W.role}),s.jsx("td",{className:"py-4 px-4",children:s.jsxs(at,{variant:"secondary",className:`text-xs font-normal rounded-none border-dashed flex items-center gap-1 w-fit ${W.status==="pending"?"bg-yellow-900/10 border border-yellow-500/30 text-yellow-400/70":W.status==="accepted"?"bg-green-900/10 border border-green-500/30 text-green-400/70":"bg-red-900/10 border border-red-500/30 text-red-400/70"}`,children:[W.status==="pending"&&s.jsx(ek,{className:"w-3 h-3"}),W.status==="accepted"&&s.jsx(Fx,{className:"w-3 h-3"}),W.status==="expired"&&s.jsx(Kt,{className:"w-3 h-3"}),W.status]})}),s.jsxs("td",{className:"py-4 px-4 text-sm text-gray-400",children:[new Date(W.expiresAt).toLocaleDateString(),s.jsx("br",{}),s.jsx("span",{className:"text-xs text-gray-400",children:new Date(W.expiresAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),s.jsx("td",{className:"py-4 px-4 text-right",children:s.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[s.jsxs(Y,{variant:"outline",size:"sm",className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",onClick:()=>Ot(W.id,W.email),children:[s.jsx(xw,{className:"w-4 h-4 mr-1"}),"Resend"]}),s.jsxs(Y,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:()=>ot(W.id),children:[s.jsx(cd,{className:"w-4 h-4 mr-1"}),"Cancel"]})]})})]},W.id))})]})})}):s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:s.jsxs("div",{className:"text-center",children:[s.jsx(Ir,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Invitations"}),s.jsx("p",{className:"text-gray-400 mb-6",children:"Start inviting users to join this organization."}),s.jsxs(Y,{onClick:Ge,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[s.jsx(Ir,{className:"w-4 h-4 mr-2"}),"Send First Invitation"]})]})})]}),y&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Invite User"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>{x(!1),T(""),_("")},className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(He,{htmlFor:"invite-email",className:"text-sm text-gray-400 font-light",children:"Email Address"}),s.jsx(Ie,{id:"invite-email",type:"email",value:D,onChange:W=>T(W.target.value),placeholder:"user@example.com",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"inviter-select",className:"text-sm text-gray-400 font-light",children:"Inviter"}),s.jsxs(pa,{value:C,onValueChange:_,children:[s.jsx(xa,{children:s.jsx(Vx,{placeholder:"Select an inviter..."})}),s.jsx(ga,{children:z.map(W=>s.jsx(sn,{value:W.id,children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("img",{src:W.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${W.id}`,alt:W.name,className:"w-6 h-6 rounded-none border border-dashed border-white/20"}),s.jsxs("span",{children:[W.name," (",W.email,")"]})]})},W.id))})]})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>{x(!1),T(""),_("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsxs(Y,{onClick:Je,disabled:q,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:[q?s.jsx(ca,{className:"w-3 h-3 mr-2 animate-spin"}):s.jsx(xw,{className:"w-4 h-4 mr-2"}),q?"Sending...":"Send Invitation"]})]})]})}),M&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Create Team"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>{A(!1),B({name:""})},className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{children:[s.jsx(He,{htmlFor:"team-name",className:"text-sm text-gray-400 font-light",children:"Team Name"}),s.jsx(Ie,{id:"team-name",value:P.name,onChange:W=>ne(W.target.value),placeholder:"e.g. Development Team",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>{A(!1),B({name:""})},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ae,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create Team"})]})]})}),I&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Edit Team"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>{U(!1),B({name:""})},className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:s.jsx(Ze,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsxs("div",{className:"text-sm text-gray-400",children:["Team ID: ",E.id]})]})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"edit-team-name",className:"text-sm text-gray-400 font-light",children:"Team Name"}),s.jsx(Ie,{id:"edit-team-name",value:P.name,onChange:W=>ne(W.target.value),placeholder:"e.g. Development Team",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>{U(!1),B({name:""})},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:me,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update Team"})]})]})}),$&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Delete Team"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>L(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:s.jsx(Ze,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsxs("div",{className:"text-sm text-gray-400",children:["Team ID: ",E.id]})]})]}),s.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this team? This action cannot be undone."})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>L(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ze,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete Team"})]})]})}),N&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Seed Members"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>j(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ze,{className:"w-5 h-5 text-white"}),s.jsx("h4",{className:"text-white font-light",children:"Add Members from Existing Users"})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(He,{htmlFor:"member-count",className:"text-sm text-gray-400 font-light",children:"Number of members to add"}),s.jsx(Ie,{id:"member-count",type:"number",min:"1",max:"50",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsx(Y,{onClick:()=>{var te;const W=parseInt(((te=document.getElementById("member-count"))==null?void 0:te.value)||"5");ht(W)},disabled:Z,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:Z?s.jsxs(s.Fragment,{children:[s.jsx(ca,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ze,{className:"w-3 h-3 mr-2"}),"Seed Members"]})})]})]}),se.length>0&&s.jsx("div",{className:"mt-6",children:s.jsx(Oa,{title:"Member Seeding Terminal",lines:se,isRunning:Z,className:"w-full",defaultCollapsed:!0})})]}),s.jsx("div",{className:"flex justify-end mt-6 pt-6 border-t border-dashed border-white/10",children:s.jsx(Y,{variant:"outline",onClick:()=>j(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),k&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Seed Teams"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ln,{className:"w-5 h-5 text-white"}),s.jsx("h4",{className:"text-white font-light",children:"Create Teams"})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(He,{htmlFor:"team-count",className:"text-sm text-gray-400 font-light",children:"Number of teams to create"}),s.jsx(Ie,{id:"team-count",type:"number",min:"1",max:"20",defaultValue:"3",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsx(Y,{onClick:()=>{var te;const W=parseInt(((te=document.getElementById("team-count"))==null?void 0:te.value)||"3");Le(W)},disabled:F,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:F?s.jsxs(s.Fragment,{children:[s.jsx(ca,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ln,{className:"w-3 h-3 mr-2"}),"Seed Teams"]})})]})]}),ee.length>0&&s.jsx("div",{className:"mt-6",children:s.jsx(Oa,{title:"Team Seeding Terminal",lines:ee,isRunning:F,className:"w-full",defaultCollapsed:!0})})]}),s.jsx("div",{className:"flex justify-end mt-6 pt-6 border-t border-dashed border-white/10",children:s.jsx(Y,{variant:"outline",onClick:()=>S(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})})]}):s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("div",{className:"flex items-center space-x-4",children:s.jsx(Gp,{to:"/organizations",children:s.jsxs(Y,{variant:"ghost",className:"text-gray-400 hover:text-white rounded-none",children:[s.jsx(KL,{className:"w-4 h-4 mr-2"}),"Back to Organizations"]})})}),s.jsx("br",{}),s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Ln,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),s.jsx("h2",{className:"text-xl text-white font-light mb-2",children:"Organization Not Found"}),s.jsx("p",{className:"text-gray-400",children:"The organization you're looking for doesn't exist."})]})]})}function MF(){const[e,t]=m.useState([]),[n,r]=m.useState(!0),[a,i]=m.useState(""),[o,l]=m.useState("all"),[c,d]=m.useState(!1),[h,u]=m.useState(!1),[f,p]=m.useState(!1),[w,v]=m.useState(!1),[b,g]=m.useState(!1),[y,x]=m.useState(null),[N,j]=m.useState([]),[k,S]=m.useState(!1),M=m.useCallback(async()=>{try{const _=await(await fetch("/api/sessions")).json();t(_.sessions||[])}catch{}finally{r(!1)}},[]);m.useEffect(()=>{M()},[M]);const A=async C=>{j([]),S(!0),j([{id:"start",type:"info",message:`Starting session seeding process for ${C} sessions...`,timestamp:new Date}]);try{const z=await(await fetch("/api/seed/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:C})})).json();if(z.success){const H=z.results.map((B,q)=>B.success?{id:`session-${q}`,type:"progress",message:`Creating session: ${B.session.id}`,timestamp:new Date,status:"completed"}:{id:`session-${q}`,type:"error",message:`Failed to create session ${q+1}: ${B.error}`,timestamp:new Date});j(B=>[...B,...H]);const P=z.results.filter(B=>B.success).length;j(B=>[...B,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${P}/${C} sessions successfully`,timestamp:new Date}]),await M()}else j(H=>[...H,{id:"error",type:"error",message:`❌ Seeding failed: ${z.error||"Unknown error"}`,timestamp:new Date}])}catch(_){j(z=>[...z,{id:"error",type:"error",message:`❌ Network error: ${_}`,timestamp:new Date}])}finally{S(!1)}},I=async C=>{j([]),S(!0),j([{id:"start",type:"info",message:`Starting account seeding process for ${C} accounts...`,timestamp:new Date}]);try{const z=await(await fetch("/api/seed/accounts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:C})})).json();if(z.success){const H=z.results.map((B,q)=>B.success?{id:`account-${q}`,type:"progress",message:`Creating account: ${B.account.provider}`,timestamp:new Date,status:"completed"}:{id:`account-${q}`,type:"error",message:`Failed to create account ${q+1}: ${B.error}`,timestamp:new Date});j(B=>[...B,...H]);const P=z.results.filter(B=>B.success).length;j(B=>[...B,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${P}/${C} accounts successfully`,timestamp:new Date}]),await M()}else j(H=>[...H,{id:"error",type:"error",message:`❌ Seeding failed: ${z.error||"Unknown error"}`,timestamp:new Date}])}catch(_){j(z=>[...z,{id:"error",type:"error",message:`❌ Network error: ${_}`,timestamp:new Date}])}finally{S(!1)}},U=C=>{x(C),v(!0)},$=C=>{x(C),u(!0)},L=C=>{x(C),p(!0)},E=async C=>{d(!1)},O=async C=>{u(!1)},D=async()=>{p(!1)},T=e.filter(C=>{const _=C.id.toLowerCase().includes(a.toLowerCase())||C.userId.toLowerCase().includes(a.toLowerCase()),z=o==="all"||o==="active"&&new Date(C.expiresAt)>new Date||o==="expired"&&new Date(C.expiresAt)<=new Date;return _&&z});return n?s.jsx("div",{className:"flex items-center justify-center h-32",children:s.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[s.jsx(Cr,{className:"w-6 h-6 text-white animate-spin"}),s.jsx("div",{className:"text-white text-sm",children:"Loading sessions..."})]})}):s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Sessions",s.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[s.jsx("span",{className:"mr-1",children:"["}),s.jsx("span",{className:"text-white font-mono text-sm",children:e.length}),s.jsx("span",{className:"ml-1",children:"]"})]})]}),s.jsx("p",{className:"text-gray-400 mt-1 uppercase font-mono text-sm font-light",children:"Manage user sessions and accounts"})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs(Y,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",onClick:()=>g(!0),children:[s.jsx(lt,{className:"w-4 h-4 mr-2"}),"Seed"]}),s.jsxs(Y,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",onClick:()=>d(!0),children:[s.jsx(zs,{className:"w-4 h-4 mr-2"}),"Add Session"]})]})]}),s.jsxs("div",{className:"flex items-center space-x-4",children:[s.jsxs("div",{className:"flex-1 relative",children:[s.jsx(Ea,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),s.jsx(Ie,{placeholder:"Search sessions...",value:a,onChange:C=>i(C.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(mx,{className:"w-4 h-4 text-gray-400"}),s.jsxs(pa,{value:o,onValueChange:l,children:[s.jsx(xa,{children:s.jsx(Vx,{})}),s.jsxs(ga,{children:[s.jsx(sn,{value:"all",children:"All"}),s.jsx(sn,{value:"active",children:"Active"}),s.jsx(sn,{value:"expired",children:"Expired"})]})]})]})]}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Session"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User ID"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Status"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Expires"}),s.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),s.jsx("tbody",{children:T.map(C=>s.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5",children:[s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(lt,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-white font-light",children:["Session ",C.id.slice(0,8),"..."]}),s.jsxs("div",{className:"text-sm text-gray-400",children:["ID: ",C.id]})]})]})}),s.jsx("td",{className:"py-4 px-4 text-white",children:C.userId}),s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[new Date(C.expiresAt)>new Date?s.jsx("div",{className:"w-2 h-2 bg-green-400 rounded-full"}):s.jsx("div",{className:"w-2 h-2 bg-red-400 rounded-full"}),s.jsx("span",{className:"text-sm text-gray-400",children:new Date(C.expiresAt)>new Date?"Active":"Expired"})]})}),s.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(C.expiresAt).toLocaleDateString()}),s.jsx("td",{className:"py-4 px-4 text-right",children:s.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[s.jsx(Y,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:()=>U(C),children:s.jsx(Ll,{className:"w-4 h-4"})}),s.jsx(Y,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:()=>$(C),children:s.jsx(Ca,{className:"w-4 h-4"})}),s.jsx(Y,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 rounded-none",onClick:()=>L(C),children:s.jsx(px,{className:"w-4 h-4"})})]})})]},C.id))})]})})}),b&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Seed Data"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(lt,{className:"w-5 h-5 text-white"}),s.jsx("h4",{className:"text-white font-light",children:"Seed Sessions"})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(He,{htmlFor:"session-count",className:"text-sm text-gray-400 font-light",children:"Number of sessions"}),s.jsx(Ie,{id:"session-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"})]}),s.jsx(Y,{onClick:()=>{var _;const C=parseInt(((_=document.getElementById("session-count"))==null?void 0:_.value)||"5",10);A(C)},disabled:k,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:k?s.jsxs(s.Fragment,{children:[s.jsx(Cr,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):s.jsxs(s.Fragment,{children:[s.jsx(lt,{className:"w-3 h-3 mr-2"}),"Seed Sessions"]})})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(wv,{className:"w-5 h-5 text-white"}),s.jsx("h4",{className:"text-white font-light",children:"Seed Accounts"})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(He,{htmlFor:"account-count",className:"text-sm text-gray-400 font-light",children:"Number of accounts"}),s.jsx(Ie,{id:"account-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"})]}),s.jsx(Y,{onClick:()=>{var _;const C=parseInt(((_=document.getElementById("account-count"))==null?void 0:_.value)||"5",10);I(C)},disabled:k,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:k?s.jsxs(s.Fragment,{children:[s.jsx(Cr,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):s.jsxs(s.Fragment,{children:[s.jsx(wv,{className:"w-3 h-3 mr-2"}),"Seed Accounts"]})})]})]}),N.length>0&&s.jsx("div",{className:"mt-6",children:s.jsx(Oa,{title:"Session Seeding Terminal",lines:N,isRunning:k,className:"w-full",defaultCollapsed:!0})})]}),s.jsx("div",{className:"flex justify-end mt-6 pt-6 border-t border-dashed border-white/10",children:s.jsx(Y,{variant:"outline",onClick:()=>g(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),c&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Create Session"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>d(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(He,{htmlFor:"create-user-id",className:"text-sm text-gray-400 font-light",children:"User ID"}),s.jsx(Ie,{id:"create-user-id",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"create-expires",className:"text-sm text-gray-400 font-light",children:"Expires At"}),s.jsx(Ie,{id:"create-expires",type:"datetime-local",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>d(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:()=>E(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create"})]})]})}),h&&y&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Edit Session"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>u(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(lt,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-white font-light",children:["Session ",y.id.slice(0,8),"..."]}),s.jsx("div",{className:"text-sm text-gray-400",children:y.userId})]})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"edit-user-id",className:"text-sm text-gray-400 font-light",children:"User ID"}),s.jsx(Ie,{id:"edit-user-id",defaultValue:y.userId,className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"edit-expires",className:"text-sm text-gray-400 font-light",children:"Expires At"}),s.jsx(Ie,{id:"edit-expires",type:"datetime-local",defaultValue:new Date(y.expiresAt).toISOString().slice(0,16),className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>u(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:()=>O(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update"})]})]})}),f&&y&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Delete Session"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>p(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(lt,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-white font-light",children:["Session ",y.id.slice(0,8),"..."]}),s.jsx("div",{className:"text-sm text-gray-400",children:y.userId})]})]}),s.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this session? This action cannot be undone."})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>p(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:D,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete"})]})]})}),w&&y&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Session Details"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>v(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(lt,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-white font-light",children:["Session ",y.id.slice(0,8),"..."]}),s.jsx("div",{className:"text-sm text-gray-400",children:y.userId})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"ID:"}),s.jsx("span",{className:"text-white text-sm",children:y.id})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"User ID:"}),s.jsx("span",{className:"text-white text-sm",children:y.userId})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Status:"}),s.jsx("span",{className:"text-white text-sm",children:new Date(y.expiresAt)>new Date?"Active":"Expired"})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Expires:"}),s.jsx("span",{className:"text-white text-sm",children:new Date(y.expiresAt).toLocaleString()})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Created:"}),s.jsx("span",{className:"text-white text-sm",children:new Date(y.createdAt).toLocaleString()})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Updated:"}),s.jsx("span",{className:"text-white text-sm",children:new Date(y.updatedAt).toLocaleString()})]})]})]}),s.jsx("div",{className:"flex justify-end mt-6",children:s.jsx(Y,{onClick:()=>v(!1),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Close"})})]})})]})}function _F(e){const t=m.useRef(null),n=m.useRef(null),r=m.useRef(0),a=5;m.useEffect(()=>{const i=()=>{try{const l=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`;t.current=new WebSocket(l),t.current.onopen=()=>{r.current=0,n.current&&(clearTimeout(n.current),n.current=null)},t.current.onmessage=c=>{try{const d=JSON.parse(c.data);e(d)}catch{}},t.current.onclose=c=>{if(!(c.code===1006||c.code===1001)&&r.current<a){r.current++;const d=Math.min(1e3*2**r.current,1e4);n.current=setTimeout(()=>{i()},d)}},t.current.onerror=c=>{}}catch{}};return i(),()=>{t.current&&t.current.close(),n.current&&clearTimeout(n.current)}},[e])}function DF(){var y,x,N,j,k,S,M,A,I,U,$,L,E,O,D,T,C,_,z,H,P,B,q,G,se,re,Z,R,ee;const[e,t]=m.useState(null),[n,r]=m.useState(null),[a,i]=m.useState(null),[o,l]=m.useState(null),[c,d]=m.useState(!0),[h,u]=m.useState(null);_F(J=>{J.type==="config_changed"?setTimeout(()=>{f(),p(),w(),v()},500):J.type});const f=m.useCallback(async()=>{var J;try{const K=await(await fetch("/api/config")).json();(J=K.studio)!=null&&J.version&&u(`v${K.studio.version}`),t(K)}catch{}finally{d(!1)}},[]),p=m.useCallback(async()=>{try{const F=await(await fetch("/api/health")).json();r(F.system||{studioVersion:h||"v1.0.0",nodeVersion:process.version,platform:navigator.platform,uptime:"2h 15m"})}catch{r({studioVersion:h||"v1.0.0",nodeVersion:"v18.0.0",platform:"macOS",uptime:"2h 15m"})}},[h]),w=m.useCallback(async()=>{try{const F=await(await fetch("/api/plugins")).json();i(F)}catch{i({plugins:[],configPath:null,totalPlugins:0,error:"Failed to fetch plugins"})}},[]),v=m.useCallback(async()=>{try{const F=await(await fetch("/api/db")).json();l(F)}catch{l({success:!1,name:"unknown",version:"unknown",dialect:"unknown",adapter:"unknown",displayName:"Unknown",autoDetected:!1,message:"Failed to fetch database info"})}},[]),b=J=>{switch(J==null?void 0:J.toLowerCase()){case"postgresql":case"postgres":return s.jsxs(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[s.jsx(Et,{className:"w-3 h-3"}),"Connected"]});case"mysql":return s.jsxs(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[s.jsx(Et,{className:"w-3 h-3"}),"Connected"]});case"sqlite":return s.jsxs(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[s.jsx(Dc,{className:"w-3 h-3"}),"Local"]});default:return s.jsxs(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[s.jsx(hr,{className:"w-3 h-3"}),"Unknown"]})}};m.useEffect(()=>{f(),p(),w(),v()},[f,v,w,p]);const g=J=>{switch(J.toLowerCase()){case"google":return s.jsx(Ht,{className:"w-5 h-5 text-white"});case"github":return s.jsx(Mn,{className:"w-5 h-5 text-white"});case"discord":return s.jsx(Ht,{className:"w-5 h-5 text-white"});case"twitter":return s.jsx(Ht,{className:"w-5 h-5 text-white"});default:return s.jsx(Ht,{className:"w-5 h-5 text-white"})}};return c?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-white"})}):s.jsxs("div",{className:"space-y-8 animate-fade-in",children:[s.jsx("div",{className:"flex items-center justify-between p-5 pt-7",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-normal text-white tracking-tight",children:"Settings"}),s.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Configure your Better Auth application"})]})}),s.jsx("hr",{className:"w-full border-white/15 h-px"}),s.jsx("hr",{className:"w-full border-white/15 h-px"}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8 p-5",children:[s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(bi,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Application"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Basic application configuration"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsxs(Pn,{className:"space-y-0 px-0 pb-0 border-b-none",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ht,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"App Name"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Application display name"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-medium text-white",children:(e==null?void 0:e.appName)||"Better Auth"})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Xd,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Base URL"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Application base URL"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-mono font-medium text-white",children:(e==null?void 0:e.baseURL)||"http://localhost:3000"})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(sd,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Base Path"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Auth API base path"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-mono font-medium text-white",children:(e==null?void 0:e.basePath)||"/api/auth"})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Mn,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Secret"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Encryption secret"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-medium text-white",children:(e==null?void 0:e.secret)==="Configured"?"Configured":"Not set"})})]})]})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(lt,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Database"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Database connection and configuration"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsxs(Pn,{className:"space-y-0 px-0 pb-0 border-b-none",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(lt,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:(o==null?void 0:o.displayName)||((y=e==null?void 0:e.database)==null?void 0:y.type)&&((x=e==null?void 0:e.database)==null?void 0:x.type.charAt(0).toUpperCase())+((N=e==null?void 0:e.database)==null?void 0:N.type.slice(1))||"Unknown"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database Type"})]})]}),((o==null?void 0:o.name)||((j=e==null?void 0:e.database)==null?void 0:j.type))&&b((o==null?void 0:o.name)||((k=e==null?void 0:e.database)==null?void 0:k.type)||"")]}),((o==null?void 0:o.dialect)||((S=e==null?void 0:e.database)==null?void 0:S.dialect))&&(o==null?void 0:o.dialect)!=="unknown"&&s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(lt,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Dialect"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database dialect"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-medium text-white",children:(o==null?void 0:o.dialect)||((M=e==null?void 0:e.database)==null?void 0:M.dialect)})})]}),((A=e==null?void 0:e.database)==null?void 0:A.url)&&s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Xd,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Connection URL"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database connection string"})]})]}),s.jsxs(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[s.jsx(Et,{className:"w-3 h-3"}),"Configured"]})]}),((I=e==null?void 0:e.database)==null?void 0:I.casing)&&s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(bi,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Casing"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Table name casing"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-medium text-white capitalize",children:e.database.casing})})]}),(e==null?void 0:e.database)&&s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(gv,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Debug Logs"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database debug logging"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:e.database.debugLogs?s.jsxs(s.Fragment,{children:[s.jsx(hr,{className:"w-3 h-3"}),"Enabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Disabled"]})})]}),!(o!=null&&o.success)&&!(e!=null&&e.database)&&s.jsxs("div",{className:"flex items-center justify-between p-3 px-5",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(hr,{className:"w-5 h-5 text-yellow-400"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"No Database Detected"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:(o==null?void 0:o.message)||"No supported database packages found"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs bg-yellow-900/50 border border-yellow-500/30 text-yellow-400 rounded-sm",children:"Unknown"})]})]})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(Mn,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Providers"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Configured authentication providers"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsx(Pn,{className:"p-0",children:e!=null&&e.socialProviders&&e.socialProviders.length>0?e.socialProviders.map((J,F)=>s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15 last:border-b-0",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[g(J.type),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white capitalize",children:J.type}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:J.clientId?"Configured":"Not configured"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:J.clientId?s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Active"]}):s.jsxs(s.Fragment,{children:[s.jsx(hr,{className:"w-3 h-3"}),"Setup Required"]})})]},F)):s.jsxs("div",{className:"text-center py-8",children:[s.jsx(Mn,{className:"w-8 h-8 text-white mx-auto mb-2"}),s.jsx("p",{className:"text-sm text-gray-400",children:"No providers configured"})]})})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(qd,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Email & Password"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Email authentication settings"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsxs(Pn,{className:"p-0",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(qd,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Email Authentication"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Allow users to sign up with email"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(U=e==null?void 0:e.emailAndPassword)!=null&&U.enabled?s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(ra,{className:"w-3 h-3"}),"Disabled"]})})]}),(($=e==null?void 0:e.emailAndPassword)==null?void 0:$.enabled)&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ma,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Sign Up"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Allow new user registration"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(L=e==null?void 0:e.emailAndPassword)!=null&&L.disableSignUp?s.jsxs(s.Fragment,{children:[s.jsx(ra,{className:"w-3 h-3"}),"Disabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Mn,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Email Verification"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Require email verification"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(E=e==null?void 0:e.emailAndPassword)!=null&&E.requireEmailVerification?s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Required"]}):s.jsxs(s.Fragment,{children:[s.jsx(hr,{className:"w-3 h-3"}),"Optional"]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(sd,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Password Length"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Min/Max password length"})]})]}),s.jsx("div",{className:"text-right",children:s.jsxs("p",{className:"text-sm font-medium text-white",children:[((O=e==null?void 0:e.emailAndPassword)==null?void 0:O.minPasswordLength)||8," -"," ",((D=e==null?void 0:e.emailAndPassword)==null?void 0:D.maxPasswordLength)||128]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(qh,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Auto Sign In"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Auto sign in after registration"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(T=e==null?void 0:e.emailAndPassword)!=null&&T.autoSignIn?s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(hr,{className:"w-3 h-3"}),"Disabled"]})})]})]})]})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(_c,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Session"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Session management settings"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsxs(Pn,{className:"p-0",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(_c,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Session Duration"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"How long sessions last"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:(C=e==null?void 0:e.session)!=null&&C.expiresIn?`${Math.floor(e.session.expiresIn/(60*60*24))} days`:"7 days"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Default"})]})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(gv,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Update Age"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Session refresh interval"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-medium text-white",children:(_=e==null?void 0:e.session)!=null&&_.updateAge?`${Math.floor(e.session.updateAge/(60*60))} hours`:"24 hours"})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(qh,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Session Refresh"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Auto refresh sessions"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(z=e==null?void 0:e.session)!=null&&z.disableSessionRefresh?s.jsxs(s.Fragment,{children:[s.jsx(ra,{className:"w-3 h-3"}),"Disabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(lt,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Store in Database"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Store sessions in database"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(H=e==null?void 0:e.session)!=null&&H.storeSessionInDatabase?s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(Dc,{className:"w-3 h-3"}),"Secondary Storage"]})})]})]})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(Mn,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Rate Limiting"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"API rate limiting configuration"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsxs(Pn,{className:"p-0",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Mn,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Rate Limiting"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Enable rate limiting"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(P=e==null?void 0:e.rateLimit)!=null&&P.enabled?s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(hr,{className:"w-3 h-3"}),"Disabled"]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(_c,{className:"w-5 h-5 text-red-400"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Rate Limit Window"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Time window for rate limiting"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:(B=e==null?void 0:e.rateLimit)!=null&&B.window?`${e.rateLimit.window} seconds`:"10 seconds"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Window"})]})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Mn,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Max Requests"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Maximum requests per window"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:((q=e==null?void 0:e.rateLimit)==null?void 0:q.max)||100}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Requests"})]})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(lt,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Storage"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Rate limit storage type"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-medium text-white capitalize",children:((G=e==null?void 0:e.rateLimit)==null?void 0:G.storage)||"memory"})})]})]})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(bi,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Advanced"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Advanced configuration options"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsxs(Pn,{className:"p-0",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(sd,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Secure Cookies"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Use secure cookies"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(se=e==null?void 0:e.advanced)!=null&&se.useSecureCookies?s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(hr,{className:"w-3 h-3"}),"Disabled"]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Mn,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"CSRF Check"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"CSRF protection"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(re=e==null?void 0:e.advanced)!=null&&re.disableCSRFCheck?s.jsxs(s.Fragment,{children:[s.jsx(ra,{className:"w-3 h-3"}),"Disabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ll,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"IP Tracking"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Track IP addresses"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(R=(Z=e==null?void 0:e.advanced)==null?void 0:Z.ipAddress)!=null&&R.disableIpTracking?s.jsxs(s.Fragment,{children:[s.jsx(ra,{className:"w-3 h-3"}),"Disabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(zP,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Telemetry"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Usage analytics"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(ee=e==null?void 0:e.telemetry)!=null&&ee.enabled?s.jsxs(s.Fragment,{children:[s.jsx(hr,{className:"w-3 h-3"}),"Enabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Disabled"]})})]})]})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(Dc,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"System Info"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Better Auth Studio system information"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsxs(Pn,{className:"p-0",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(qh,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Studio Version"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Better Auth Studio"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:h||"v1.0.0"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Latest"})]})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Dc,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Node.js Version"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Runtime environment"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:(n==null?void 0:n.nodeVersion)||"v18.0.0"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Current"})]})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ht,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Platform"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Operating system"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:(n==null?void 0:n.platform)||"macOS"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"System"})]})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(_c,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Uptime"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Service uptime"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:(n==null?void 0:n.uptime)||"2h 15m"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Running"})]})]})]})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none lg:col-span-2",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(xv,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Plugins"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Better Auth plugins enabled in your configuration"]})]}),s.jsxs("div",{className:"pr-6",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:(a==null?void 0:a.totalPlugins)||0}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Active"})]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsx(Pn,{className:"space-y-0 px-0 pb-0 border-b-none",children:a!=null&&a.plugins&&a.plugins.length>0?s.jsxs(s.Fragment,{children:[a.plugins.map((J,F)=>s.jsxs("div",{className:`flex items-center justify-between p-3 px-5 ${F<a.plugins.length-1?"border-b border-white/15":""}`,children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(xv,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:J.name.slice(0,1).toUpperCase()+J.name.slice(1).replace("-"," ")}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:J.description})]})]}),s.jsx("div",{className:"text-right flex items-center space-x-2",children:s.jsxs(at,{variant:"secondary",className:"text-xs bg-green-900/50 border border-dashed rounded-none border-green-500/30 text-green-400 flex items-center gap-1",children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]})})]},J.id)),a.configPath&&s.jsx("div",{className:"p-4 px-5 bg-black/30 border-t border-white/10",children:s.jsxs("p",{className:"text-xs text-gray-400",children:["Config file:"," ",s.jsx("span",{className:"text-white font-mono",children:a.configPath})]})})]}):s.jsxs("div",{className:"flex items-center justify-between p-4 px-5",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(hr,{className:"w-5 h-5 text-yellow-400"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-white",children:"No Plugins Enabled"}),s.jsx("p",{className:"text-xs text-gray-400",children:(a==null?void 0:a.error)||"No plugins are currently configured in your Better Auth setup"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs bg-yellow-900/50 border border-yellow-500/30 text-yellow-400 rounded-sm",children:"None"})]})})]})]})]})}function Cw(){var D,T;const{orgId:e,teamId:t}=qp(),n=Dr(),[r,a]=m.useState(null),[i,o]=m.useState([]),[l,c]=m.useState(!0),[d,h]=m.useState("details"),[u,f]=m.useState(!1),[p,w]=m.useState(!1),[v,b]=m.useState(""),[g,y]=m.useState([]),[x,N]=m.useState([]),[j,k]=m.useState({name:""}),S=m.useCallback(async()=>{if(t)try{const _=await(await fetch(`/api/teams/${t}`)).json();_.success&&_.team?(a(_.team),k({name:_.team.name})):_.team?(a(_.team),k({name:_.team.name})):V.error("Team not found")}catch{V.error("Failed to load team")}finally{c(!1)}},[t]),M=m.useCallback(async()=>{if(t)try{const _=await(await fetch(`/api/teams/${t}/members`)).json();_.success&&o(_.members||[])}catch{V.error("Failed to load team members")}},[t]),A=async()=>{try{const _=await(await fetch("/api/users?limit=10000")).json(),z=i.map(P=>P.userId),H=(_.users||[]).filter(P=>!z.includes(P.id));y(H)}catch{V.error("Failed to load users")}};m.useEffect(()=>{t&&(S(),M())},[t,S,M]);const I=async()=>{if(!j.name){V.error("Please enter a team name");return}const C=V.loading("Updating team...");try{const z=await(await fetch(`/api/teams/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:j.name})})).json();z.success?(await S(),w(!1),V.success("Team updated successfully!",{id:C})):V.error(`Error updating team: ${z.error||"Unknown error"}`,{id:C})}catch{V.error("Error updating team",{id:C})}},U=async()=>{if(x.length===0){V.error("Please select at least one user");return}const C=V.loading(`Adding ${x.length} members...`);try{const z=await(await fetch(`/api/teams/${t}/members`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userIds:x})})).json();z.success?(await M(),f(!1),N([]),b(""),V.success(`Successfully added ${x.length} members!`,{id:C})):V.error(`Error adding members: ${z.error||"Unknown error"}`,{id:C})}catch{V.error("Error adding members",{id:C})}},$=async(C,_)=>{const z=V.loading(`Removing ${_}...`);try{const P=await(await fetch(`/api/team-members/${C}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();P.success?(await M(),V.success(`${_} removed from team!`,{id:z})):V.error(`Error removing member: ${P.error||"Unknown error"}`,{id:z})}catch{V.error("Error removing team member",{id:z})}},L=()=>{A(),f(!0)},E=C=>{N(_=>_.includes(C)?_.filter(z=>z!==C):[..._,C])},O=g.filter(C=>C.name.toLowerCase().includes(v.toLowerCase())||C.email.toLowerCase().includes(v.toLowerCase()));return l?s.jsx("div",{className:"flex items-center justify-center h-32",children:s.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[s.jsx(ca,{className:"w-6 h-6 text-white animate-spin"}),s.jsx("div",{className:"text-white text-sm",children:"Loading team details..."})]})}):r?s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center space-x-4",children:s.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:s.jsxs("span",{className:"font-light",children:[s.jsxs("span",{onClick:()=>n(`/organizations/${r.organizationId}`),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["teams /"," "]}),s.jsx("span",{className:"text-white font-mono text-sm",children:t})]})})}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs(Y,{onClick:L,className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[s.jsx(Yo,{className:"w-4 h-4 mr-2"}),"Add Members"]}),s.jsxs(Y,{onClick:()=>w(!0),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[s.jsx(Ca,{className:"w-4 h-4 mr-2"}),"Edit Team"]})]})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-12 h-12 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:s.jsx(Ze,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{children:[s.jsxs("h1",{className:"text-2xl text-white font-light inline-flex items-center",children:[r.name,s.jsxs("sup",{className:"text-xs text-gray-500 ml-2",children:[s.jsx("span",{className:"mr-1",children:"["}),s.jsx("span",{className:"text-white/80 font-mono text-xs",children:t}),s.jsx("span",{className:"ml-1",children:"]"})]})]}),s.jsx("div",{className:"flex items-center space-x-2 mt-1",children:r.organization&&s.jsxs(Gp,{to:`/organizations/${r.organizationId}`,className:"text-gray-400 hover:text-white text-sm font-sans",children:[s.jsx(Ln,{className:"w-4 h-4 inline mr-1"}),r.organization.name]})})]})]}),s.jsx("div",{className:"border-b border-white/10",children:s.jsxs("nav",{className:"flex space-x-8",children:[s.jsxs("button",{onClick:()=>h("details"),className:`flex items-center space-x-2 px-3 py-4 text-sm font-medium border-b-2 transition-all duration-200 ${d==="details"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-gray-300"}`,children:[s.jsx(Ze,{className:"w-4 h-4"}),s.jsx("span",{children:"Details"})]}),s.jsxs("button",{onClick:()=>h("members"),className:`flex items-center space-x-2 px-3 py-4 text-sm font-medium border-b-2 transition-all duration-200 ${d==="members"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-gray-300"}`,children:[s.jsx(Ze,{className:"w-4 h-4"}),s.jsxs("span",{className:"inline-flex items-start",children:["Members",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:s.jsx(Nr,{value:i.length,className:"text-white/80 font-mono text-xs",prefix:s.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]})]})}),d==="details"&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:[s.jsx("h3",{className:"text-lg text-white font-light mb-4",children:"Team Information"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Name"}),s.jsx("p",{className:"text-white font-sans mt-1",children:r.name})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Organization"}),s.jsx("p",{className:"text-white font-sans mt-1",children:((D=r.organization)==null?void 0:D.name)||"Unknown"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Created"}),s.jsx("p",{className:"text-white font-sans mt-1",children:new Date(r.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Last Updated"}),s.jsx("p",{className:"text-white font-sans mt-1",children:new Date(r.updatedAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ze,{className:"w-8 h-8 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl text-white font-sans font-light",children:i.length}),s.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Members"})]})]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Yn,{className:"w-8 h-8 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl text-white font-sans font-light",children:Math.ceil((Date.now()-new Date(r.createdAt).getTime())/(1e3*60*60*24))}),s.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Days Active"})]})]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ln,{className:"w-8 h-8 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl text-white font-sans font-light",children:"1"}),s.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Organization"})]})]})})]})]}),d==="members"&&s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Team Members",s.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[s.jsx("span",{className:"mr-1",children:"["}),s.jsx("span",{className:"text-white/80 font-mono text-xs",children:i.length}),s.jsx("span",{className:"ml-1",children:"]"})]})]}),s.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage members of this team"})]})}),i.length>0?s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Joined"}),s.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),s.jsx("tbody",{children:i.map(C=>s.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5",children:[s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("img",{src:C.user.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${C.user.id}`,alt:C.user.name,className:"w-10 h-10 rounded-none border border-dashed border-white/20"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:C.user.name}),s.jsxs("div",{className:"text-sm text-gray-400",children:["ID: ",C.user.id]})]})]})}),s.jsx("td",{className:"py-4 px-4 text-white",children:C.user.email}),s.jsx("td",{className:"py-4 px-4",children:s.jsx(at,{variant:"secondary",className:"text-xs bg-blue-900/10 border border-dashed border-blue-500/30 text-blue-400/70 rounded-none capitalize",children:C.role})}),s.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(C.joinedAt).toLocaleDateString()}),s.jsx("td",{className:"py-4 px-4 text-right",children:s.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.jsxs(Y,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:()=>$(C.id,C.user.name),children:[s.jsx(cd,{className:"w-4 h-4 mr-1"}),"Remove"]})})})]},C.id))})]})})}):s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:s.jsxs("div",{className:"text-center",children:[s.jsx(Ze,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Members Yet"}),s.jsx("p",{className:"text-gray-400 mb-6",children:"Add members to this team to get started."}),s.jsxs(Y,{onClick:L,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[s.jsx(Yo,{className:"w-4 h-4 mr-2"}),"Add First Members"]})]})})]}),u&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Add Team Members"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>{f(!1),N([]),b("")},className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"relative",children:[s.jsx(J2,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),s.jsx(Ie,{placeholder:"Search users by name or email...",value:v,onChange:C=>b(C.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),x.length>0&&s.jsx("div",{className:"bg-blue-900/20 border border-blue-500/30 rounded-none p-3",children:s.jsxs("p",{className:"text-blue-400 text-sm",children:[x.length," user",x.length!==1?"s":""," selected"]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none max-h-96 overflow-y-auto",children:O.length>0?s.jsx("div",{className:"divide-y divide-white/5",children:O.map(C=>s.jsxs("div",{className:`flex items-center space-x-3 p-4 cursor-pointer hover:bg-white/5 ${x.includes(C.id)?"bg-blue-900/20":""}`,onClick:()=>E(C.id),children:[s.jsx("input",{type:"checkbox",checked:x.includes(C.id),onChange:()=>E(C.id),className:"rounded border-gray-300"}),s.jsx("img",{src:C.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${C.id}`,alt:C.name,className:"w-10 h-10 rounded-none border border-dashed border-white/20"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"text-white font-light",children:C.name}),s.jsx("div",{className:"text-sm text-gray-400",children:C.email})]})]},C.id))}):s.jsx("div",{className:"p-8 text-center",children:s.jsx("p",{className:"text-gray-400",children:"No users found matching your search."})})})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>{f(!1),N([]),b("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsxs(Y,{onClick:U,disabled:x.length===0,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:[s.jsx(Yo,{className:"w-4 h-4 mr-2"}),"Add ",x.length," Member",x.length!==1?"s":""]})]})]})}),p&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Edit Team"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>w(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:s.jsx(Ze,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:r.name}),s.jsx("div",{className:"text-sm text-gray-400",children:(T=r.organization)==null?void 0:T.name})]})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"edit-team-name",className:"text-sm text-gray-400 font-light",children:"Team Name"}),s.jsx(Ie,{id:"edit-team-name",value:j.name,onChange:C=>k({name:C.target.value}),placeholder:"e.g. Development Team",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>w(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:I,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update Team"})]})]})})]}):s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("div",{className:"flex items-center space-x-4",children:s.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:s.jsxs("span",{className:"font-light",children:[s.jsxs("span",{onClick:()=>n(`/organizations/${e}`),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["teams /"," "]}),s.jsx("span",{className:"text-white font-mono text-sm",children:t})]})})}),s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Ze,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),s.jsx("h2",{className:"text-xl text-white font-light mb-2",children:"Team Not Found"}),s.jsx("p",{className:"text-gray-400",children:"The team you're looking for doesn't exist."})]})]})}function TF(){const e=Dr(),[t,n]=m.useState([]),[r,a]=m.useState(!0),[i,o]=m.useState(null),[l,c]=m.useState(""),[d,h]=m.useState("all"),[u,f]=m.useState(1),[p]=m.useState(20);m.useEffect(()=>{w()},[]);const w=async()=>{try{const k=await(await fetch("/api/plugins")).json(),S=(k==null?void 0:k.plugins).find(M=>M.id==="teams");o({enabled:!!S,availablePlugins:(k==null?void 0:k.plugins).map(M=>M.id),configPath:k.configPath,teamsPlugin:(k==null?void 0:k.plugins).find(M=>M.id==="teams")}),S?await v():a(!1)}catch(j){console.error("Failed to check teams plugin status:",j),o({enabled:!1,error:"Failed to check plugin status"}),a(!1)}},v=async()=>{try{const k=await(await fetch("/api/teams")).json();k.success&&n(k.teams||[])}catch(j){console.error("Failed to fetch teams:",j),V.error("Failed to load teams")}finally{a(!1)}},b=t.filter(j=>{var S;const k=j.name.toLowerCase().includes(l.toLowerCase())||((S=j.organization)==null?void 0:S.name.toLowerCase().includes(l.toLowerCase()));if(d==="all")return k;if(d==="recent"){const M=new Date;return M.setDate(M.getDate()-7),k&&new Date(j.createdAt)>M}return k}),g=u*p,y=g-p,x=b.slice(y,g),N=Math.ceil(b.length/p);return r?s.jsx("div",{className:"flex items-center justify-center min-h-screen",children:s.jsx(Cr,{className:"w-8 h-8 animate-spin text-white"})}):i!=null&&i.enabled?s.jsxs("div",{className:"p-6 space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Teams",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 mt-0 inline-flex items-baseline",children:s.jsx(Nr,{value:b.length,className:"text-white font-mono text-sm",prefix:s.jsx("span",{className:"mr-1 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-1 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]}),s.jsxs("p",{className:"text-gray-400 mt-1 uppercase font-mono text-sm font-light flex items-baseline gap-1",children:[s.jsx(Nr,{value:b.length,className:"text-white font-mono text-sm",format:{notation:"standard",maximumFractionDigits:0}}),s.jsxs("span",{children:["team",b.length!==1?"s":""," found"]})]})]}),s.jsx("div",{className:"flex items-center space-x-3",children:s.jsxs(Y,{onClick:()=>e("/teams/new"),className:"bg-white text-black hover:bg-gray-200 border-dashed",children:[s.jsx(zs,{className:"w-4 h-4 mr-2"}),"Create Team"]})})]}),s.jsxs("div",{className:"flex items-center space-x-4",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(Ea,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),s.jsx(Ie,{type:"text",placeholder:"Search teams...",value:l,onChange:j=>c(j.target.value),className:"pl-10 bg-black border-dashed border-white/20 text-white placeholder-gray-400 focus:ring-2 focus:ring-white focus:border-transparent"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Y,{variant:d==="all"?"default":"outline",size:"sm",onClick:()=>h("all"),className:d==="all"?"bg-white text-black":"border-dashed border-white/20 text-white hover:bg-white/10",children:"All"}),s.jsx(Y,{variant:d==="recent"?"default":"outline",size:"sm",onClick:()=>h("recent"),className:d==="recent"?"bg-white text-black":"border-dashed border-white/20 text-white hover:bg-white/10",children:"Recent"})]})]}),x.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Ma,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-light text-white mb-2",children:"No teams found"}),s.jsx("p",{className:"text-gray-400 mb-6",children:l?"Try adjusting your search terms":"Get started by creating your first team"}),!l&&s.jsxs(Y,{onClick:()=>e("/teams/new"),className:"bg-white text-black hover:bg-gray-200 border-dashed",children:[s.jsx(zs,{className:"w-4 h-4 mr-2"}),"Create Team"]})]}):s.jsx("div",{className:"grid gap-4",children:x.map(j=>{var k;return s.jsx("div",{className:"bg-black/30 border border-white/15 rounded-none p-4 hover:bg-black/40 transition-colors cursor-pointer",onClick:()=>e(`/teams/${j.id}`),children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-4",children:[s.jsx("div",{className:"w-10 h-10 bg-white/10 rounded-none flex items-center justify-center",children:s.jsx(Ma,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium",children:j.name}),s.jsxs("p",{className:"text-gray-400 text-sm",children:[(k=j.organization)==null?void 0:k.name," • ",j.memberCount||0," members"]})]})]}),s.jsx("div",{className:"flex items-center space-x-2",children:s.jsx(at,{variant:"secondary",className:"text-xs bg-green-900/50 border border-dashed rounded-none border-green-500/30 text-green-400",children:"Active"})})]})},j.id)})}),N>1&&s.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[s.jsx(Y,{variant:"outline",size:"sm",onClick:()=>f(Math.max(1,u-1)),disabled:u===1,className:"border-dashed border-white/20 text-white hover:bg-white/10 disabled:opacity-50",children:"Previous"}),s.jsxs("span",{className:"text-gray-400 text-sm",children:["Page ",u," of ",N]}),s.jsx(Y,{variant:"outline",size:"sm",onClick:()=>f(Math.min(N,u+1)),disabled:u===N,className:"border-dashed border-white/20 text-white hover:bg-white/10 disabled:opacity-50",children:"Next"})]})]}):s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl text-white font-light",children:"Teams"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"Manage your application organizations"})]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-8",children:s.jsxs("div",{className:"flex items-start space-x-4",children:[s.jsx("div",{className:"flex-shrink-0",children:s.jsx(xr,{className:"w-12 h-12 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"Organization Plugin Required"}),s.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."}),s.jsxs("div",{className:"bg-black/50 border border-dashed border-white/20 rounded-none p-4 mb-6",children:[s.jsx("h4",{className:"text-white font-light mb-3",children:"Follow these steps:"}),s.jsx("ol",{className:"text-gray-300 space-y-2 text-sm list-decimal list-inside",children:s.jsxs("li",{children:["Import the plugin in your auth configuration file",(i==null?void 0:i.configPath)&&s.jsxs("span",{className:"text-gray-400",children:[" (",i.configPath,")"]}),":"]})}),s.jsx("div",{className:"mt-4 bg-black/70 border border-dashed border-white/10 rounded-none p-3 overflow-x-auto",children:s.jsxs("pre",{className:"text-sm text-gray-300",children:[s.jsx("span",{className:"text-blue-400",children:"import"})," ","{ betterAuth }"," ",s.jsx("span",{className:"text-blue-400",children:"from"})," ",s.jsx("span",{className:"text-green-400",children:'"better-auth"'})," ",s.jsx("br",{}),s.jsx("span",{className:"text-blue-400",children:"import"})," ","{ organization }"," ",s.jsx("span",{className:"text-blue-400",children:"from"})," ",s.jsx("span",{className:"text-green-400",children:'"better-auth/plugins/organization"'})," ",s.jsx("br",{}),s.jsx("span",{className:"text-blue-400",children:"export const"})," ",s.jsx("span",{className:"text-yellow-300",children:"auth"})," ="," ",s.jsx("span",{className:"text-yellow-300",children:"betterAuth"}),"(","{"," ",s.jsx("br",{}),s.jsx("span",{className:"text-gray-500 pl-10",children:"// ... your existing configuration"})," ",s.jsx("br",{}),s.jsx("span",{className:"text-red-300 pl-10",children:"plugins"}),": [ ",s.jsx("br",{}),s.jsxs("span",{className:"text-yellow-300 pl-12",children:["organization(",")"]}),s.jsx("br",{}),s.jsx("span",{className:"pl-10",children:"]"})," ",s.jsx("br",{}),"}",") ",s.jsx("br",{})]})}),s.jsx("div",{className:"mt-4",children:s.jsx("p",{className:"text-gray-400 text-sm",children:"2. Do migrations to create the organizations table"})}),s.jsx("div",{className:"mt-2",children:s.jsx("p",{className:"text-gray-400 text-sm",children:"3. Restart your application to apply the changes"})})]}),(i==null?void 0:i.availablePlugins)&&i.availablePlugins.length>0&&s.jsx("div",{className:"mb-4",children:s.jsxs("p",{className:"text-gray-400 text-sm",children:["Currently enabled plugins: ",i.availablePlugins.join(", ")]})}),s.jsx(Y,{onClick:()=>window.location.reload(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Check Again"}),s.jsxs("div",{className:"mt-4 text-xs text-gray-500",children:["Need help? Check the"," ",s.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"})]})]})]})})]})}const yf=`// Example custom migration script
468
+ `})]})}const _n=m.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:De("rounded-lg border border-gray-700 bg-gray-900 text-white shadow-sm",e),...t}));_n.displayName="Card";const Dn=m.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:De("flex flex-col space-y-1.5 p-6",e),...t}));Dn.displayName="CardHeader";const Tn=m.forwardRef(({className:e,...t},n)=>s.jsx("h3",{ref:n,className:De("text-2xl font-semibold leading-none tracking-tight text-white",e),...t}));Tn.displayName="CardTitle";const fr=m.forwardRef(({className:e,...t},n)=>s.jsx("p",{ref:n,className:De("text-sm text-gray-300",e),...t}));fr.displayName="CardDescription";const Pn=m.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:De("p-6 pt-0",e),...t}));Pn.displayName="CardContent";const jF=m.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:De("flex items-center p-6 pt-0",e),...t}));jF.displayName="CardFooter";const kF={databaseSchemaNode:Um},Sw=[{name:"organization",displayName:"Organization",description:"Multi-tenant organization support",color:"bg-blue-500"},{name:"teams",displayName:"Teams",description:"Team management within organizations",color:"bg-green-500"},{name:"twoFactor",displayName:"Two Factor",description:"Two-factor authentication support",color:"bg-purple-500"},{name:"apiKey",displayName:"API Key",description:"API key authentication",color:"bg-orange-500"},{name:"passkey",displayName:"Passkey",description:"WebAuthn passkey support",color:"bg-pink-500"}];function SF(){const[e,t]=m.useState(null),[n,r]=m.useState(!0),[a,i]=m.useState(null),[o,l]=m.useState([]),[c,d]=m.useState([]),[h,u,f]=tP([]),[p,w,v]=nP([]),b=m.useCallback(k=>{const S=Sw.find(M=>M.name===k);return(S==null?void 0:S.color)||"bg-gray-500"},[]),g=m.useCallback((k,S,M)=>{if(k==="user"||k==="session"||k==="account"||k==="verification")return"core";for(const A of M)if(k===A||k.includes(A))return A;return"core"},[]),y=m.useCallback(async()=>{try{const S=await(await fetch("/api/plugins")).json();if(S.plugins&&Array.isArray(S.plugins)){const M=S.plugins.map(A=>({name:A.id,displayName:A.name||A.id,description:A.description||`${A.id} plugin for Better Auth`,color:b(A.id)}));d(M),l(M.map(A=>A.name))}}catch{d(Sw),l(["organization"])}},[b]),x=m.useCallback(async k=>{try{r(!0);const S=k.length>0?`?plugins=${k.join(",")}`:"",A=await(await fetch(`/api/database/schema${S}`)).json();A.success?t(A.schema):i(A.error||"Failed to fetch schema")}catch{i("Failed to fetch database schema")}finally{r(!1)}},[]);m.useEffect(()=>{y()},[y]),m.useEffect(()=>{o.length>0&&x(o)},[o,x]),m.useEffect(()=>{if(!e)return;const k=[],S=[];e.tables.forEach((M,A)=>{const I=M.fields.map(U=>({id:`${M.name}-${U.name}`,isPrimary:U.primaryKey||!1,isNullable:!U.required,isUnique:U.unique||!1,isIdentity:!1,name:U.name,format:U.type,plugin:g(M.name,U.name,o)}));k.push({id:M.name,type:"databaseSchemaNode",position:{x:A%3*380,y:Math.floor(A/3)*320},data:{name:M.name,displayName:M.displayName,isForeign:!1,plugin:g(M.name,"",o),columns:I.map(U=>{var $;return{...U,description:(($=M.fields.find(L=>L.name===U.name))==null?void 0:$.description)||""}}),relationships:M.relationships}})}),e.tables.forEach(M=>{M.relationships.forEach(A=>{if(A.type==="many-to-one")return;const I=M.name,U=A.target,$=k.find(E=>E.id===I),L=k.find(E=>E.id===U);if($&&L){const E=A.type==="one-to-one"?"1:1":"1:N";S.push({id:`${I}-${U}-${A.field}`,source:I,target:U,type:"smoothstep",animated:!1,style:{stroke:"#6b7280",strokeWidth:2,strokeDasharray:"0"},label:E,labelStyle:{fontSize:"11px",fill:"#9ca3af",fontWeight:"500"},labelBgStyle:{fill:"rgba(0, 0, 0, 0.9)",fillOpacity:1,rx:4,ry:4},markerEnd:{type:"arrowclosed",color:"#6b7280",width:12,height:12}})}})}),u(k),w(S)},[e,o,u,w,g]);const N=m.useCallback(k=>w(S=>Y1(k,S)),[w]);if(n)return s.jsxs("div",{className:"p-6",children:[s.jsxs("div",{className:"animate-pulse",children:[s.jsx("div",{className:"h-8 bg-gray-700 rounded w-1/3 mb-6"}),s.jsx("div",{className:"h-96 bg-gray-700 rounded"})]}),s.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 mt-4",children:"Loading plugins and schema..."})]});if(a)return s.jsx("div",{className:"p-6",children:s.jsxs("div",{className:"bg-red-900/20 border border-red-500/20 rounded-none p-6",children:[s.jsx("h2",{className:"text-xl font-semibold text-red-400 mb-2",children:"Error Loading Schema"}),s.jsx("p",{className:"text-gray-300",children:a})]})});const j=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("div",{className:"flex items-center justify-between mb-1",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(lt,{className:"w-6 h-6 text-white"}),s.jsx("h1",{className:"text-2xl font-light text-white",children:"Schema Visualizer"})]})}),s.jsx("p",{className:"text-gray-400",children:"Visualize your Better Auth database schema with interactive tables and relationships."})]}),s.jsxs("div",{className:"flex-1 grid grid-cols-4 gap-6",children:[s.jsxs("div",{className:"col-span-1",children:[s.jsxs(_n,{className:"rounded-none bg-black h-fit shadow-sm",children:[s.jsx(Dn,{children:s.jsxs(Tn,{className:"font-light text-xl text-white flex items-center space-x-2",children:[s.jsx(bi,{className:"w-5 h-5"}),s.jsx("span",{children:"Plugins"})]})}),s.jsx(Pn,{className:"space-y-3",children:c.length>0?c.map(k=>s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:`w-3 h-3 rounded-full ${k.color}`}),s.jsx("label",{htmlFor:k.name,className:"text-sm font-medium text-white cursor-pointer",children:k.displayName.slice(0,1).toUpperCase()+k.displayName.slice(1).replace("-"," ")})]},k.name)):s.jsx("div",{className:"text-sm text-white/70",children:"No plugins detected in configuration"})})]}),e&&s.jsxs(_n,{className:"rounded-none bg-black mt-4 shadow-sm",children:[s.jsx(Dn,{children:s.jsx(Tn,{className:"text-white text-sm",children:"Schema Info"})}),s.jsxs(Pn,{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-white/70",children:"Tables:"}),s.jsx("span",{className:"text-white",children:e.tables.length})]}),s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-white/70",children:"Relationships:"}),s.jsx("span",{className:"text-white",children:e.tables.reduce((k,S)=>k+S.relationships.length,0)})]}),s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-white/70",children:"Available Plugins:"}),s.jsx("span",{className:"text-white",children:c.length})]}),s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-white/70",children:"Selected Plugins:"}),s.jsx("span",{className:"text-white",children:o.length})]})]})]})]}),s.jsx("div",{className:"col-span-3",children:s.jsx("div",{className:"h-full bg-black border border-gray-700 rounded-lg overflow-hidden shadow-xl",children:s.jsxs(eP,{nodes:h,edges:p,onNodesChange:f,onEdgesChange:v,onConnect:N,nodeTypes:kF,fitView:!0,fitViewOptions:{padding:.1,includeHiddenNodes:!1},className:"bg-black",connectionLineType:"smoothstep",defaultEdgeOptions:{style:{stroke:"#6b7280",strokeWidth:2},animated:!1,type:"smoothstep"},nodesDraggable:!0,nodesConnectable:!1,elementsSelectable:!0,children:[s.jsx(mP,{className:"bg-gray-900 border-gray-700 [&>button]:bg-gray-800 [&>button]:border-gray-600 [&>button]:text-white [&>button:hover]:bg-gray-700"}),s.jsx(EP,{className:"bg-gray-900 border-gray-700",nodeColor:k=>{var S;return(S=k.data)!=null&&S.isForeign?"#374151":"#1f2937"},maskColor:"rgba(0, 0, 0, 0.9)"}),s.jsx(oP,{variant:Xr.Dots,gap:20,size:1,color:"#374151"})]})})})]})]});return s.jsxs("div",{className:"overflow-hidden p-6 h-[90vh] flex flex-col opacity-70 bg-black relative",children:[s.jsxs("div",{className:"absolute inset-0 z-50 flex items-center justify-center pointer-events-none",children:[s.jsx("div",{className:"absolute inset-0 backdrop-blur-sm",style:{WebkitBackdropFilter:"blur(8px)",backdropFilter:"blur(8px)"}}),s.jsxs("div",{className:"relative -mt-6 bg-black/50 border border-dashed border-white/20 rounded-none p-12 max-w-2xl mx-6 text-center pointer-events-auto",children:[s.jsx("div",{className:"flex items-center justify-center mb-4",children:s.jsxs("div",{className:"relative",children:[s.jsx(lt,{className:"w-16 h-16 text-white opacity-50"}),s.jsx(VP,{className:"w-8 h-8 text-white opacity-80 absolute -top-2 -right-2 animate-pulse"})]})}),s.jsx("h2",{className:"text-3xl font-mono uppercase font-light text-white mb-3",children:"Coming Soon"}),s.jsx("p",{className:"text-lg text-gray-300 font-light mb-6 leading-relaxed",children:"We will be having this feature soon. This feature will allow you to explore your Better Auth database structure with beautiful, interactive graphs showing all tables, relationships, and data flow."}),s.jsxs("div",{className:"flex items-center justify-center space-x-6 text-sm text-gray-400",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),s.jsx("span",{children:"Interactive Tables"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),s.jsx("span",{children:"Relationship Mapping"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full"}),s.jsx("span",{children:"Real-time Updates"})]})]})]})]}),s.jsx("div",{className:"blur-sm opacity-50 pointer-events-none",children:j})]})}const CF=u2("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-white text-black hover:bg-white",secondary:"border-transparent bg-gray-800 text-white hover:bg-gray-800 border border-gray-600",destructive:"border-transparent bg-red-500 text-white hover:bg-red-600",outline:"text-gray-300 border-gray-600",success:"border-transparent bg-green-900 text-green-300",warning:"border-transparent bg-yellow-900 text-yellow-300",error:"border-transparent bg-red-900 text-red-300",info:"border-transparent bg-gray-800 text-white border border-gray-600"}},defaultVariants:{variant:"default"}});function at({className:e,variant:t,...n}){return s.jsx("div",{className:De(CF({variant:t}),e),...n})}function EF(){const{orgId:e}=qp(),t=Dr(),[n,r]=m.useState(null),[a,i]=m.useState([]),[o,l]=m.useState([]),[c,d]=m.useState([]),[h,u]=m.useState(!0),[f,p]=m.useState("details"),[w,v]=m.useState(!1),[b,g]=m.useState(!1),[y,x]=m.useState(!1),[N,j]=m.useState(!1),[k,S]=m.useState(!1),[M,A]=m.useState(!1),[I,U]=m.useState(!1),[$,L]=m.useState(!1),[E,O]=m.useState(null),[D,T]=m.useState(""),[C,_]=m.useState(""),[z,H]=m.useState([]),[P,B]=m.useState({name:""}),[q,G]=m.useState(!1),[se,re]=m.useState([]),[Z,R]=m.useState(!1),[ee,J]=m.useState([]),[F,K]=m.useState(!1);m.useEffect(()=>{e&&(ce(),ve(),ge(),Te(),tt(),Ae())},[e]),m.useEffect(()=>{w&&e&&Ae()},[]),m.useEffect(()=>{f==="members"&&e&&tt()},[f,e]),m.useEffect(()=>{f==="invitations"&&e&&Te()},[f,e]);const ne=W=>{B({name:W})},ce=async()=>{try{const te=await(await fetch(`/api/organizations/${e}`)).json();te.success&&te.organization||te.organization?r(te.organization):V.error("Organization not found")}catch(W){console.error("Failed to fetch organization:",W),V.error("Failed to load organization")}finally{u(!1)}},ge=async()=>{try{const te=await(await fetch("/api/plugins/teams/status")).json();v(te.enabled)}catch(W){console.error("Failed to check teams status:",W),v(!1)}},ve=async()=>{try{const te=await(await fetch("/api/plugins/organization/status")).json();g(te.enabled)}catch(W){console.error("Failed to check organization status:",W),g(!1)}},Ae=async()=>{try{const te=await(await fetch(`/api/organizations/${e}/teams`)).json();te.success&&i(te.teams||[])}catch(W){console.error("Failed to fetch teams:",W),V.error("Failed to load teams")}},Te=async()=>{try{const te=await(await fetch(`/api/organizations/${e}/invitations`)).json();te.success&&l(te.invitations||[])}catch(W){console.error("Failed to fetch invitations:",W),V.error("Failed to load invitations")}},tt=async()=>{try{const te=await(await fetch(`/api/organizations/${e}/members`)).json();te.success&&d(te.members||[])}catch(W){console.error("Failed to fetch members:",W),V.error("Failed to load members")}},ht=async W=>{re([]),R(!0),re([{id:"start",type:"info",message:`Starting member seeding process for ${W} members...`,timestamp:new Date}]);try{const ue=await(await fetch(`/api/organizations/${e}/seed-members`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:W})})).json();if(ue.success){const Ne=ue.results.map((he,Pe)=>he.success?{id:`member-${Pe}`,type:"progress",message:`Adding member: ${he.member.user.name} (${he.member.user.email})`,timestamp:new Date,status:"completed"}:{id:`member-${Pe}`,type:"error",message:`Failed to add member ${Pe+1}: ${he.error}`,timestamp:new Date});re(he=>[...he,...Ne]);const Se=ue.results.filter(he=>he.success).length;re(he=>[...he,{id:"complete",type:"success",message:`✅ Seeding completed! Added ${Se}/${W} members successfully`,timestamp:new Date}]),await tt(),V.success(`Successfully added ${Se} members!`)}else re(Ne=>[...Ne,{id:"error",type:"error",message:`❌ Seeding failed: ${ue.error||"Unknown error"}`,timestamp:new Date}]),V.error(ue.error||"Failed to seed members")}catch(te){re(ue=>[...ue,{id:"error",type:"error",message:`❌ Network error: ${te}`,timestamp:new Date}]),V.error("Failed to seed members")}finally{R(!1)}},Le=async W=>{J([]),K(!0),J([{id:"start",type:"info",message:`Starting team seeding process for ${W} teams...`,timestamp:new Date}]);try{const ue=await(await fetch(`/api/organizations/${e}/seed-teams`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:W})})).json();if(ue.success){const Ne=ue.results.map((he,Pe)=>he.success?{id:`team-${Pe}`,type:"progress",message:`Creating team: ${he.team.name}`,timestamp:new Date,status:"completed"}:{id:`team-${Pe}`,type:"error",message:`Failed to create team ${Pe+1}: ${he.error}`,timestamp:new Date});J(he=>[...he,...Ne]);const Se=ue.results.filter(he=>he.success).length;J(he=>[...he,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${Se}/${W} teams successfully`,timestamp:new Date}]),await Ae(),V.success(`Successfully created ${Se} teams!`)}else J(Ne=>[...Ne,{id:"error",type:"error",message:`❌ Seeding failed: ${ue.error||"Unknown error"}`,timestamp:new Date}]),V.error(ue.error||"Failed to seed teams")}catch(te){J(ue=>[...ue,{id:"error",type:"error",message:`❌ Network error: ${te}`,timestamp:new Date}]),V.error("Failed to seed teams")}finally{K(!1)}},Oe=async()=>{try{const te=await(await fetch("/api/users/all")).json();te.success&&H(te.users||[])}catch(W){console.error("Failed to fetch users:",W)}},Ge=()=>{Oe(),x(!0)},Je=async()=>{if(!D){V.error("Please enter an email address");return}if(!C){V.error("Please select an inviter");return}G(!0);const W=V.loading("Sending invitation...");try{const ue=await(await fetch(`/api/organizations/${e}/invitations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:D,role:"member",inviterId:C})})).json();ue.success?(await Te(),x(!1),T(""),_(""),V.success("Invitation sent successfully!",{id:W})):V.error(`Error sending invitation: ${ue.error||"Unknown error"}`,{id:W})}catch(te){console.error("Error sending invitation:",te),V.error("Error sending invitation",{id:W})}finally{G(!1)}},ot=async W=>{const te=V.loading("Cancelling invitation...");try{const Ne=await(await fetch(`/api/invitations/${W}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();Ne.success?(await Te(),V.success("Invitation cancelled successfully!",{id:te})):V.error(`Error cancelling invitation: ${Ne.error||"Unknown error"}`,{id:te})}catch(ue){console.error("Error cancelling invitation:",ue),V.error("Error cancelling invitation",{id:te})}},Ot=async(W,te)=>{const ue=V.loading("Resending invitation...");try{const Se=await(await fetch(`/api/invitations/${W}/resend`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();Se.success?(await Te(),V.success(`Invitation resent to ${te}!`,{id:ue})):V.error(`Error resending invitation: ${Se.error||"Unknown error"}`,{id:ue})}catch(Ne){console.error("Error resending invitation:",Ne),V.error("Error resending invitation",{id:ue})}},zt=async(W,te)=>{const ue=V.loading(`Removing ${te}...`);try{const Se=await(await fetch(`/api/members/${W}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();Se.success?(await tt(),V.success(`${te} removed from organization!`,{id:ue})):V.error(`Error removing member: ${Se.error||"Unknown error"}`,{id:ue})}catch(Ne){console.error("Error removing member:",Ne),V.error("Error removing member",{id:ue})}},ae=async()=>{if(!P.name){V.error("Please enter a team name");return}const W=V.loading("Creating team...");try{const ue=await(await fetch(`/api/organizations/${e}/teams`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:P.name,organizationId:e})})).json();ue.success?(await Ae(),A(!1),B({name:""}),V.success("Team created successfully!",{id:W})):V.error(`Error creating team: ${ue.error||"Unknown error"}`,{id:W})}catch(te){console.error("Error creating team:",te),V.error("Error creating team",{id:W})}},me=async()=>{if(!E||!P.name){V.error("Please enter a team name");return}const W=V.loading("Updating team...");try{const ue=await(await fetch(`/api/teams/${E.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:P.name})})).json();ue.success?(await Ae(),U(!1),O(null),B({name:""}),V.success("Team updated successfully!",{id:W})):V.error(`Error updating team: ${ue.error||"Unknown error"}`,{id:W})}catch(te){console.error("Error updating team:",te),V.error("Error updating team",{id:W})}},ze=async()=>{if(!E){V.error("No team selected");return}const W=V.loading("Deleting team...");try{const ue=await(await fetch(`/api/teams/${E.id}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();ue.success?(await Ae(),L(!1),O(null),V.success("Team deleted successfully!",{id:W})):V.error(`Error deleting team: ${ue.error||"Unknown error"}`,{id:W})}catch(te){console.error("Error deleting team:",te),V.error("Error deleting team",{id:W})}},X=W=>{O(W),B({name:W.name}),U(!0)},le=W=>{O(W),L(!0)};return h?s.jsx("div",{className:"flex items-center justify-center h-32",children:s.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[s.jsx(ca,{className:"w-6 h-6 text-white animate-spin"}),s.jsx("div",{className:"text-white text-sm",children:"Loading organization details..."})]})}):n?s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center space-x-4",children:s.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:s.jsxs("span",{className:"font-light",children:[s.jsxs("span",{onClick:()=>t("/organizations"),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["orgs /"," "]}),s.jsx("span",{className:"text-white font-mono text-sm",children:e})]})})}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs(Y,{onClick:()=>j(!0),className:"border border-dashed border-white/20 text-white bg-transparent hover:bg-white/10 rounded-none",children:[s.jsx(Ze,{className:"w-4 h-4 mr-2"}),"Seed Members"]}),s.jsxs(Y,{onClick:Ge,className:"border border-dashed border-white/20 text-white bg-transparent hover:bg-white/10 rounded-none",children:[s.jsx(Ir,{className:"w-4 h-4 mr-2"}),"Invite User"]}),s.jsxs(Y,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[s.jsx(Ca,{className:"w-4 h-4 mr-2"}),"Edit Organization"]})]})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-12 h-12 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:s.jsx(Ln,{className:"w-6 h-6 text-white"})}),s.jsx("div",{children:s.jsxs("h1",{className:"text-2xl text-white font-light inline-flex items-center",children:[n.name,s.jsxs("sup",{className:"text-xs text-gray-500 ml-2",children:[s.jsx("span",{className:"mr-1",children:"["}),s.jsx("span",{className:"text-white/80 font-mono text-xs",children:n.slug}),s.jsx("span",{className:"ml-1",children:"]"})]})]})})]}),s.jsx("div",{className:"border-b border-white/10",children:s.jsxs("nav",{className:"flex space-x-8",children:[s.jsxs("button",{onClick:()=>p("details"),className:`flex items-center space-x-2 px-3 py-4 text-sm font-medium border-b-2 transition-all duration-200 ${f==="details"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-gray-300"}`,children:[s.jsx(Ln,{className:"w-4 h-4"}),s.jsxs("span",{className:"inline-flex items-start",children:["Details",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:s.jsx(Nr,{value:0,className:"text-white/80 font-mono text-xs",prefix:s.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]}),s.jsxs("button",{onClick:()=>p("members"),className:`flex items-center space-x-2 px-3 py-4 text-sm font-medium border-b-2 transition-all duration-200 ${f==="members"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-gray-300"}`,children:[s.jsx(Ze,{className:"w-4 h-4"}),s.jsxs("span",{className:"inline-flex items-start",children:["Members",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:s.jsx(Nr,{value:c.length,className:"text-white/80 font-mono text-xs",prefix:s.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]}),s.jsxs("button",{onClick:()=>p("invitations"),className:`flex items-center space-x-2 px-3 py-4 text-sm font-medium border-b-2 transition-all duration-200 ${f==="invitations"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-gray-300"}`,children:[s.jsx(Ir,{className:"w-4 h-4"}),s.jsxs("span",{className:"inline-flex items-start",children:["Invitations",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:s.jsx(Nr,{value:o.length,className:"text-white/80 font-mono text-xs",prefix:s.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]}),s.jsxs("button",{onClick:()=>p("teams"),className:`flex items-center space-x-2 px-3 py-4 text-sm font-medium border-b-2 transition-all duration-200 ${f==="teams"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-gray-300"}`,children:[s.jsx(Ze,{className:"w-4 h-4"}),s.jsxs("span",{className:"inline-flex items-start",children:["Teams",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:s.jsx(Nr,{value:a.length,className:"text-white/80 font-mono text-xs",prefix:s.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]})]})}),f==="details"&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:[s.jsx("h3",{className:"text-lg text-white font-light mb-4",children:"Organization Information"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Name"}),s.jsx("p",{className:"text-white font-sans mt-1",children:n.name})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Slug"}),s.jsx("p",{className:"text-white font-mono mt-1",children:n.slug})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Created"}),s.jsx("p",{className:"text-white font-sans mt-1",children:new Date(n.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6",children:[s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ze,{className:"w-8 h-8 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl text-white font-sans font-light",children:c.length}),s.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Members"})]})]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ze,{className:"w-8 h-8 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.length}),s.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Teams"})]})]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ir,{className:"w-8 h-8 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl text-white font-sans font-light",children:o.length}),s.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Invitations"})]})]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Yn,{className:"w-8 h-8 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl text-white font-sans font-light",children:Math.ceil((new Date().getTime()-new Date(n.createdAt).getTime())/(1e3*60*60*24))}),s.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Days Active"})]})]})})]})]}),f==="teams"&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Teams",s.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[s.jsx("span",{className:"mr-1",children:"["}),s.jsx("span",{className:"text-white font-mono text-xs",children:a.length}),s.jsx("span",{className:"ml-1",children:"]"})]})]}),s.jsx("p",{className:"text-gray-400 mt-1 uppercase font-mono text-xs font-light",children:"Manage teams within this organization"})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs(Y,{onClick:()=>S(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[s.jsx(Vr,{className:"w-4 h-4 mr-2"}),"Seed Teams"]}),s.jsxs(Y,{onClick:()=>A(!0),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[s.jsx(Yo,{className:"w-4 h-4 mr-2"}),"Create Team"]})]})]}),w?a.length>0?s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Team"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Members"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Created"}),s.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),s.jsx("tbody",{children:a.map(W=>s.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5 cursor-pointer",onClick:()=>t(`/organizations/${e}/teams/${W.id}`),children:[s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-10 h-10 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:s.jsx(Ze,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:W.name}),s.jsxs("div",{className:"text-sm text-gray-400",children:["Team ID: ",W.id]})]})]})}),s.jsx("td",{className:"py-4 px-4 text-white",children:W.memberCount||0}),s.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(W.createdAt).toLocaleDateString()}),s.jsx("td",{className:"py-4 px-4 text-right",children:s.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[s.jsxs(Y,{variant:"outline",size:"sm",className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",onClick:te=>{te.stopPropagation(),X(W)},children:[s.jsx(Ca,{className:"w-4 h-4 mr-1"}),"Edit"]}),s.jsxs(Y,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:te=>{te.stopPropagation(),le(W)},children:[s.jsx(cd,{className:"w-4 h-4 mr-1"}),"Delete"]})]})})]},W.id))})]})})}):s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:s.jsxs("div",{className:"text-center",children:[s.jsx(Ze,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Teams Yet"}),s.jsx("p",{className:"text-gray-400 mb-6",children:"Create your first team to start organizing members within this organization."}),s.jsxs(Y,{onClick:()=>A(!0),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[s.jsx(Yo,{className:"w-4 h-4 mr-2"}),"Create First Team"]})]})}):s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-8",children:s.jsxs("div",{className:"flex items-start space-x-4",children:[s.jsx("div",{className:"flex-shrink-0",children:s.jsx(Ze,{className:"w-12 h-12 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"Teams Feature Required"}),s.jsx("p",{className:"text-gray-300 mb-6",children:"To use Teams in Better Auth Studio, you need to enable the teams feature in your organization plugin configuration."}),s.jsxs("div",{className:"bg-black/50 border border-dashed border-white/20 rounded-none p-4 mb-6",children:[s.jsx("h4",{className:"text-white font-light mb-3",children:"Follow these steps:"}),s.jsx("ol",{className:"text-gray-300 space-y-2 text-sm list-decimal list-inside",children:s.jsx("li",{children:"Update your auth configuration file to enable teams:"})}),s.jsx("div",{className:"mt-4 bg-black/70 border border-dashed border-white/10 rounded-none p-3 overflow-x-auto",children:s.jsxs("pre",{className:"text-sm text-gray-300",children:[s.jsx("span",{className:"text-blue-400",children:"import"})," ","{ betterAuth }"," ",s.jsx("span",{className:"text-blue-400",children:"from"})," ",s.jsx("span",{className:"text-green-400",children:'"better-auth"'})," ",s.jsx("br",{}),s.jsx("span",{className:"text-blue-400",children:"import"})," ","{ organization }"," ",s.jsx("span",{className:"text-blue-400",children:"from"})," ",s.jsx("span",{className:"text-green-400",children:'"better-auth/plugins/organization"'})," ",s.jsx("br",{}),s.jsx("span",{className:"text-blue-400",children:"export const"})," ",s.jsx("span",{className:"text-yellow-300",children:"auth"})," ="," ",s.jsx("span",{className:"text-yellow-300",children:"betterAuth"}),"(","{"," ",s.jsx("br",{}),s.jsx("span",{className:"text-gray-500 pl-10",children:"// ... your existing configuration"})," ",s.jsx("br",{}),s.jsx("span",{className:"text-red-300 pl-10",children:"plugins"}),": [ ",s.jsx("br",{}),s.jsx("span",{className:"text-yellow-300 pl-12",children:"organization"}),"(","{"," ",s.jsx("br",{}),s.jsx("span",{className:"text-red-300 pl-16",children:"teams"}),": ","{"," ",s.jsx("br",{}),s.jsx("span",{className:"text-yellow-300 pl-20",children:"enabled"}),":"," ",s.jsx("span",{className:"text-blue-400",children:"true"})," ",s.jsx("br",{}),s.jsx("span",{className:"pl-16",children:"}"})," ",s.jsx("br",{}),s.jsx("span",{className:"pl-12",children:"})"})," ",s.jsx("br",{}),s.jsx("span",{className:"pl-10",children:"]"})," ",s.jsx("br",{}),"}",") ",s.jsx("br",{})]})}),s.jsx("div",{className:"mt-4",children:s.jsx("p",{className:"text-gray-400 text-sm",children:"2. Run migrations to create the teams table"})}),s.jsx("div",{className:"mt-2",children:s.jsx("p",{className:"text-gray-400 text-sm",children:"3. Restart your application to apply the changes"})})]}),s.jsx(Y,{onClick:()=>window.location.reload(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Check Again"}),s.jsxs("div",{className:"mt-4 text-xs text-gray-500",children:["Need help? Check the"," ",s.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"})]})]})]})})]}),f==="members"&&s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Members",s.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[s.jsx("span",{className:"mr-1",children:"["}),s.jsx("span",{className:"text-white font-mono text-xs",children:c.length}),s.jsx("span",{className:"ml-1",children:"]"})]})]}),s.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage organization members and their roles"})]})}),c.length>0?s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Joined"}),s.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),s.jsx("tbody",{children:c.map(W=>s.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5",children:[s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("img",{src:W.user.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${W.user.id}`,alt:W.user.name,className:"w-10 h-10 rounded-none border border-dashed border-white/20"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:W.user.name}),s.jsxs("div",{className:"text-sm text-gray-400",children:["ID: ",W.user.id]})]})]})}),s.jsx("td",{className:"py-4 px-4 text-white",children:W.user.email}),s.jsx("td",{className:"py-4 px-4",children:s.jsx(at,{variant:"secondary",className:"text-xs bg-blue-900/10 border border-dashed rounded-none border-blue-500/30 text-blue-400/70 capitalize",children:W.role})}),s.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(W.joinedAt).toLocaleDateString()}),s.jsx("td",{className:"py-4 px-4 text-right",children:s.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.jsxs(Y,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:()=>zt(W.id,W.user.name),children:[s.jsx(cd,{className:"w-4 h-4 mr-1"}),"Remove"]})})})]},W.id))})]})})}):s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:s.jsxs("div",{className:"text-center",children:[s.jsx(Ze,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Members Yet"}),s.jsx("p",{className:"text-gray-400 mb-6",children:"Invite users or seed members from existing users to get started."}),s.jsxs("div",{className:"flex items-center justify-center space-x-3",children:[s.jsxs(Y,{onClick:()=>j(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[s.jsx(Ze,{className:"w-4 h-4 mr-2"}),"Seed Members"]}),s.jsxs(Y,{onClick:Ge,className:"bg-white text-white hover:bg-white/90 bg-transparent border border-white/20 rounded-none",children:[s.jsx(Ir,{className:"w-4 h-4 mr-2"}),"Invite User"]})]})]})})]}),f==="invitations"&&s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Invitations",s.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[s.jsx("span",{className:"mr-1",children:"["}),s.jsx("span",{className:"text-white font-mono text-xs",children:o.length}),s.jsx("span",{className:"ml-1",children:"]"})]})]}),s.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage pending invitations to this organization"})]})}),o.length>0?s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Status"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Expires"}),s.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),s.jsx("tbody",{children:o.map(W=>s.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5",children:[s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-10 h-10 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:s.jsx(Ir,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:W.email}),s.jsxs("div",{className:"text-sm text-gray-400",children:["Expires on"," ",new Date(W.expiresAt).toLocaleDateString("en-US",{month:"short",year:"numeric",day:"numeric"})]})]})]})}),s.jsx("td",{className:"py-4 px-4 text-white capitalize",children:W.role}),s.jsx("td",{className:"py-4 px-4",children:s.jsxs(at,{variant:"secondary",className:`text-xs font-normal rounded-none border-dashed flex items-center gap-1 w-fit ${W.status==="pending"?"bg-yellow-900/10 border border-yellow-500/30 text-yellow-400/70":W.status==="accepted"?"bg-green-900/10 border border-green-500/30 text-green-400/70":"bg-red-900/10 border border-red-500/30 text-red-400/70"}`,children:[W.status==="pending"&&s.jsx(ek,{className:"w-3 h-3"}),W.status==="accepted"&&s.jsx(Fx,{className:"w-3 h-3"}),W.status==="expired"&&s.jsx(Kt,{className:"w-3 h-3"}),W.status]})}),s.jsxs("td",{className:"py-4 px-4 text-sm text-gray-400",children:[new Date(W.expiresAt).toLocaleDateString(),s.jsx("br",{}),s.jsx("span",{className:"text-xs text-gray-400",children:new Date(W.expiresAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),s.jsx("td",{className:"py-4 px-4 text-right",children:s.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[s.jsxs(Y,{variant:"outline",size:"sm",className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",onClick:()=>Ot(W.id,W.email),children:[s.jsx(xw,{className:"w-4 h-4 mr-1"}),"Resend"]}),s.jsxs(Y,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:()=>ot(W.id),children:[s.jsx(cd,{className:"w-4 h-4 mr-1"}),"Cancel"]})]})})]},W.id))})]})})}):s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:s.jsxs("div",{className:"text-center",children:[s.jsx(Ir,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Invitations"}),s.jsx("p",{className:"text-gray-400 mb-6",children:"Start inviting users to join this organization."}),s.jsxs(Y,{onClick:Ge,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[s.jsx(Ir,{className:"w-4 h-4 mr-2"}),"Send First Invitation"]})]})})]}),y&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Invite User"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>{x(!1),T(""),_("")},className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(He,{htmlFor:"invite-email",className:"text-sm text-gray-400 font-light",children:"Email Address"}),s.jsx(Ie,{id:"invite-email",type:"email",value:D,onChange:W=>T(W.target.value),placeholder:"user@example.com",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"inviter-select",className:"text-sm text-gray-400 font-light",children:"Inviter"}),s.jsxs(pa,{value:C,onValueChange:_,children:[s.jsx(xa,{children:s.jsx(Vx,{placeholder:"Select an inviter..."})}),s.jsx(ga,{children:z.map(W=>s.jsx(sn,{value:W.id,children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("img",{src:W.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${W.id}`,alt:W.name,className:"w-6 h-6 rounded-none border border-dashed border-white/20"}),s.jsxs("span",{children:[W.name," (",W.email,")"]})]})},W.id))})]})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>{x(!1),T(""),_("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsxs(Y,{onClick:Je,disabled:q,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:[q?s.jsx(ca,{className:"w-3 h-3 mr-2 animate-spin"}):s.jsx(xw,{className:"w-4 h-4 mr-2"}),q?"Sending...":"Send Invitation"]})]})]})}),M&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Create Team"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>{A(!1),B({name:""})},className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{children:[s.jsx(He,{htmlFor:"team-name",className:"text-sm text-gray-400 font-light",children:"Team Name"}),s.jsx(Ie,{id:"team-name",value:P.name,onChange:W=>ne(W.target.value),placeholder:"e.g. Development Team",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>{A(!1),B({name:""})},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ae,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create Team"})]})]})}),I&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Edit Team"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>{U(!1),B({name:""})},className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:s.jsx(Ze,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsxs("div",{className:"text-sm text-gray-400",children:["Team ID: ",E.id]})]})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"edit-team-name",className:"text-sm text-gray-400 font-light",children:"Team Name"}),s.jsx(Ie,{id:"edit-team-name",value:P.name,onChange:W=>ne(W.target.value),placeholder:"e.g. Development Team",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>{U(!1),B({name:""})},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:me,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update Team"})]})]})}),$&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Delete Team"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>L(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:s.jsx(Ze,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsxs("div",{className:"text-sm text-gray-400",children:["Team ID: ",E.id]})]})]}),s.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this team? This action cannot be undone."})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>L(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ze,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete Team"})]})]})}),N&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Seed Members"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>j(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ze,{className:"w-5 h-5 text-white"}),s.jsx("h4",{className:"text-white font-light",children:"Add Members from Existing Users"})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(He,{htmlFor:"member-count",className:"text-sm text-gray-400 font-light",children:"Number of members to add"}),s.jsx(Ie,{id:"member-count",type:"number",min:"1",max:"50",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsx(Y,{onClick:()=>{var te;const W=parseInt(((te=document.getElementById("member-count"))==null?void 0:te.value)||"5");ht(W)},disabled:Z,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:Z?s.jsxs(s.Fragment,{children:[s.jsx(ca,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ze,{className:"w-3 h-3 mr-2"}),"Seed Members"]})})]})]}),se.length>0&&s.jsx("div",{className:"mt-6",children:s.jsx(Oa,{title:"Member Seeding Terminal",lines:se,isRunning:Z,className:"w-full",defaultCollapsed:!0})})]}),s.jsx("div",{className:"flex justify-end mt-6 pt-6 border-t border-dashed border-white/10",children:s.jsx(Y,{variant:"outline",onClick:()=>j(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),k&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Seed Teams"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ln,{className:"w-5 h-5 text-white"}),s.jsx("h4",{className:"text-white font-light",children:"Create Teams"})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(He,{htmlFor:"team-count",className:"text-sm text-gray-400 font-light",children:"Number of teams to create"}),s.jsx(Ie,{id:"team-count",type:"number",min:"1",max:"20",defaultValue:"3",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsx(Y,{onClick:()=>{var te;const W=parseInt(((te=document.getElementById("team-count"))==null?void 0:te.value)||"3");Le(W)},disabled:F,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:F?s.jsxs(s.Fragment,{children:[s.jsx(ca,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ln,{className:"w-3 h-3 mr-2"}),"Seed Teams"]})})]})]}),ee.length>0&&s.jsx("div",{className:"mt-6",children:s.jsx(Oa,{title:"Team Seeding Terminal",lines:ee,isRunning:F,className:"w-full",defaultCollapsed:!0})})]}),s.jsx("div",{className:"flex justify-end mt-6 pt-6 border-t border-dashed border-white/10",children:s.jsx(Y,{variant:"outline",onClick:()=>S(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})})]}):s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("div",{className:"flex items-center space-x-4",children:s.jsx(Gp,{to:"/organizations",children:s.jsxs(Y,{variant:"ghost",className:"text-gray-400 hover:text-white rounded-none",children:[s.jsx(KL,{className:"w-4 h-4 mr-2"}),"Back to Organizations"]})})}),s.jsx("br",{}),s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Ln,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),s.jsx("h2",{className:"text-xl text-white font-light mb-2",children:"Organization Not Found"}),s.jsx("p",{className:"text-gray-400",children:"The organization you're looking for doesn't exist."})]})]})}function MF(){const[e,t]=m.useState([]),[n,r]=m.useState(!0),[a,i]=m.useState(""),[o,l]=m.useState("all"),[c,d]=m.useState(!1),[h,u]=m.useState(!1),[f,p]=m.useState(!1),[w,v]=m.useState(!1),[b,g]=m.useState(!1),[y,x]=m.useState(null),[N,j]=m.useState([]),[k,S]=m.useState(!1),M=m.useCallback(async()=>{try{const _=await(await fetch("/api/sessions")).json();t(_.sessions||[])}catch{}finally{r(!1)}},[]);m.useEffect(()=>{M()},[M]);const A=async C=>{j([]),S(!0),j([{id:"start",type:"info",message:`Starting session seeding process for ${C} sessions...`,timestamp:new Date}]);try{const z=await(await fetch("/api/seed/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:C})})).json();if(z.success){const H=z.results.map((B,q)=>B.success?{id:`session-${q}`,type:"progress",message:`Creating session: ${B.session.id}`,timestamp:new Date,status:"completed"}:{id:`session-${q}`,type:"error",message:`Failed to create session ${q+1}: ${B.error}`,timestamp:new Date});j(B=>[...B,...H]);const P=z.results.filter(B=>B.success).length;j(B=>[...B,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${P}/${C} sessions successfully`,timestamp:new Date}]),await M()}else j(H=>[...H,{id:"error",type:"error",message:`❌ Seeding failed: ${z.error||"Unknown error"}`,timestamp:new Date}])}catch(_){j(z=>[...z,{id:"error",type:"error",message:`❌ Network error: ${_}`,timestamp:new Date}])}finally{S(!1)}},I=async C=>{j([]),S(!0),j([{id:"start",type:"info",message:`Starting account seeding process for ${C} accounts...`,timestamp:new Date}]);try{const z=await(await fetch("/api/seed/accounts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:C})})).json();if(z.success){const H=z.results.map((B,q)=>B.success?{id:`account-${q}`,type:"progress",message:`Creating account: ${B.account.provider}`,timestamp:new Date,status:"completed"}:{id:`account-${q}`,type:"error",message:`Failed to create account ${q+1}: ${B.error}`,timestamp:new Date});j(B=>[...B,...H]);const P=z.results.filter(B=>B.success).length;j(B=>[...B,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${P}/${C} accounts successfully`,timestamp:new Date}]),await M()}else j(H=>[...H,{id:"error",type:"error",message:`❌ Seeding failed: ${z.error||"Unknown error"}`,timestamp:new Date}])}catch(_){j(z=>[...z,{id:"error",type:"error",message:`❌ Network error: ${_}`,timestamp:new Date}])}finally{S(!1)}},U=C=>{x(C),v(!0)},$=C=>{x(C),u(!0)},L=C=>{x(C),p(!0)},E=async C=>{d(!1)},O=async C=>{u(!1)},D=async()=>{p(!1)},T=e.filter(C=>{const _=C.id.toLowerCase().includes(a.toLowerCase())||C.userId.toLowerCase().includes(a.toLowerCase()),z=o==="all"||o==="active"&&new Date(C.expiresAt)>new Date||o==="expired"&&new Date(C.expiresAt)<=new Date;return _&&z});return n?s.jsx("div",{className:"flex items-center justify-center h-32",children:s.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[s.jsx(Cr,{className:"w-6 h-6 text-white animate-spin"}),s.jsx("div",{className:"text-white text-sm",children:"Loading sessions..."})]})}):s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Sessions",s.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[s.jsx("span",{className:"mr-1",children:"["}),s.jsx("span",{className:"text-white font-mono text-sm",children:e.length}),s.jsx("span",{className:"ml-1",children:"]"})]})]}),s.jsx("p",{className:"text-gray-400 mt-1 uppercase font-mono text-sm font-light",children:"Manage user sessions and accounts"})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs(Y,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",onClick:()=>g(!0),children:[s.jsx(lt,{className:"w-4 h-4 mr-2"}),"Seed"]}),s.jsxs(Y,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",onClick:()=>d(!0),children:[s.jsx(zs,{className:"w-4 h-4 mr-2"}),"Add Session"]})]})]}),s.jsxs("div",{className:"flex items-center space-x-4",children:[s.jsxs("div",{className:"flex-1 relative",children:[s.jsx(Ea,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),s.jsx(Ie,{placeholder:"Search sessions...",value:a,onChange:C=>i(C.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(mx,{className:"w-4 h-4 text-gray-400"}),s.jsxs(pa,{value:o,onValueChange:l,children:[s.jsx(xa,{children:s.jsx(Vx,{})}),s.jsxs(ga,{children:[s.jsx(sn,{value:"all",children:"All"}),s.jsx(sn,{value:"active",children:"Active"}),s.jsx(sn,{value:"expired",children:"Expired"})]})]})]})]}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Session"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User ID"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Status"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Expires"}),s.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),s.jsx("tbody",{children:T.map(C=>s.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5",children:[s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(lt,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-white font-light",children:["Session ",C.id.slice(0,8),"..."]}),s.jsxs("div",{className:"text-sm text-gray-400",children:["ID: ",C.id]})]})]})}),s.jsx("td",{className:"py-4 px-4 text-white",children:C.userId}),s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[new Date(C.expiresAt)>new Date?s.jsx("div",{className:"w-2 h-2 bg-green-400 rounded-full"}):s.jsx("div",{className:"w-2 h-2 bg-red-400 rounded-full"}),s.jsx("span",{className:"text-sm text-gray-400",children:new Date(C.expiresAt)>new Date?"Active":"Expired"})]})}),s.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(C.expiresAt).toLocaleDateString()}),s.jsx("td",{className:"py-4 px-4 text-right",children:s.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[s.jsx(Y,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:()=>U(C),children:s.jsx(Ll,{className:"w-4 h-4"})}),s.jsx(Y,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:()=>$(C),children:s.jsx(Ca,{className:"w-4 h-4"})}),s.jsx(Y,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 rounded-none",onClick:()=>L(C),children:s.jsx(px,{className:"w-4 h-4"})})]})})]},C.id))})]})})}),b&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Seed Data"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(lt,{className:"w-5 h-5 text-white"}),s.jsx("h4",{className:"text-white font-light",children:"Seed Sessions"})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(He,{htmlFor:"session-count",className:"text-sm text-gray-400 font-light",children:"Number of sessions"}),s.jsx(Ie,{id:"session-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"})]}),s.jsx(Y,{onClick:()=>{var _;const C=parseInt(((_=document.getElementById("session-count"))==null?void 0:_.value)||"5",10);A(C)},disabled:k,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:k?s.jsxs(s.Fragment,{children:[s.jsx(Cr,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):s.jsxs(s.Fragment,{children:[s.jsx(lt,{className:"w-3 h-3 mr-2"}),"Seed Sessions"]})})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(wv,{className:"w-5 h-5 text-white"}),s.jsx("h4",{className:"text-white font-light",children:"Seed Accounts"})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(He,{htmlFor:"account-count",className:"text-sm text-gray-400 font-light",children:"Number of accounts"}),s.jsx(Ie,{id:"account-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"})]}),s.jsx(Y,{onClick:()=>{var _;const C=parseInt(((_=document.getElementById("account-count"))==null?void 0:_.value)||"5",10);I(C)},disabled:k,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:k?s.jsxs(s.Fragment,{children:[s.jsx(Cr,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):s.jsxs(s.Fragment,{children:[s.jsx(wv,{className:"w-3 h-3 mr-2"}),"Seed Accounts"]})})]})]}),N.length>0&&s.jsx("div",{className:"mt-6",children:s.jsx(Oa,{title:"Session Seeding Terminal",lines:N,isRunning:k,className:"w-full",defaultCollapsed:!0})})]}),s.jsx("div",{className:"flex justify-end mt-6 pt-6 border-t border-dashed border-white/10",children:s.jsx(Y,{variant:"outline",onClick:()=>g(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),c&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Create Session"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>d(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(He,{htmlFor:"create-user-id",className:"text-sm text-gray-400 font-light",children:"User ID"}),s.jsx(Ie,{id:"create-user-id",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"create-expires",className:"text-sm text-gray-400 font-light",children:"Expires At"}),s.jsx(Ie,{id:"create-expires",type:"datetime-local",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>d(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:()=>E(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create"})]})]})}),h&&y&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Edit Session"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>u(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(lt,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-white font-light",children:["Session ",y.id.slice(0,8),"..."]}),s.jsx("div",{className:"text-sm text-gray-400",children:y.userId})]})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"edit-user-id",className:"text-sm text-gray-400 font-light",children:"User ID"}),s.jsx(Ie,{id:"edit-user-id",defaultValue:y.userId,className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"edit-expires",className:"text-sm text-gray-400 font-light",children:"Expires At"}),s.jsx(Ie,{id:"edit-expires",type:"datetime-local",defaultValue:new Date(y.expiresAt).toISOString().slice(0,16),className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>u(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:()=>O(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update"})]})]})}),f&&y&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Delete Session"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>p(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(lt,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-white font-light",children:["Session ",y.id.slice(0,8),"..."]}),s.jsx("div",{className:"text-sm text-gray-400",children:y.userId})]})]}),s.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this session? This action cannot be undone."})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>p(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:D,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete"})]})]})}),w&&y&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Session Details"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>v(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(lt,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-white font-light",children:["Session ",y.id.slice(0,8),"..."]}),s.jsx("div",{className:"text-sm text-gray-400",children:y.userId})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"ID:"}),s.jsx("span",{className:"text-white text-sm",children:y.id})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"User ID:"}),s.jsx("span",{className:"text-white text-sm",children:y.userId})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Status:"}),s.jsx("span",{className:"text-white text-sm",children:new Date(y.expiresAt)>new Date?"Active":"Expired"})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Expires:"}),s.jsx("span",{className:"text-white text-sm",children:new Date(y.expiresAt).toLocaleString()})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Created:"}),s.jsx("span",{className:"text-white text-sm",children:new Date(y.createdAt).toLocaleString()})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Updated:"}),s.jsx("span",{className:"text-white text-sm",children:new Date(y.updatedAt).toLocaleString()})]})]})]}),s.jsx("div",{className:"flex justify-end mt-6",children:s.jsx(Y,{onClick:()=>v(!1),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Close"})})]})})]})}function _F(e){const t=m.useRef(null),n=m.useRef(null),r=m.useRef(0),a=5;m.useEffect(()=>{const i=()=>{try{const l=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`;t.current=new WebSocket(l),t.current.onopen=()=>{r.current=0,n.current&&(clearTimeout(n.current),n.current=null)},t.current.onmessage=c=>{try{const d=JSON.parse(c.data);e(d)}catch{}},t.current.onclose=c=>{if(!(c.code===1006||c.code===1001)&&r.current<a){r.current++;const d=Math.min(1e3*2**r.current,1e4);n.current=setTimeout(()=>{i()},d)}},t.current.onerror=c=>{}}catch{}};return i(),()=>{t.current&&t.current.close(),n.current&&clearTimeout(n.current)}},[e])}function DF(){var y,x,N,j,k,S,M,A,I,U,$,L,E,O,D,T,C,_,z,H,P,B,q,G,se,re,Z,R,ee;const[e,t]=m.useState(null),[n,r]=m.useState(null),[a,i]=m.useState(null),[o,l]=m.useState(null),[c,d]=m.useState(!0),[h,u]=m.useState(null);_F(J=>{J.type==="config_changed"?setTimeout(()=>{f(),p(),w(),v()},500):J.type});const f=m.useCallback(async()=>{var J;try{const K=await(await fetch("/api/config")).json();(J=K.studio)!=null&&J.version&&u(`v${K.studio.version}`),t(K)}catch{}finally{d(!1)}},[]),p=m.useCallback(async()=>{try{const F=await(await fetch("/api/health")).json();r(F.system||{studioVersion:h||"v1.0.0",nodeVersion:process.version,platform:navigator.platform,uptime:"2h 15m"})}catch{r({studioVersion:h||"v1.0.0",nodeVersion:"v18.0.0",platform:"macOS",uptime:"2h 15m"})}},[h]),w=m.useCallback(async()=>{try{const F=await(await fetch("/api/plugins")).json();i(F)}catch{i({plugins:[],configPath:null,totalPlugins:0,error:"Failed to fetch plugins"})}},[]),v=m.useCallback(async()=>{try{const F=await(await fetch("/api/db")).json();l(F)}catch{l({success:!1,name:"unknown",version:"unknown",dialect:"unknown",adapter:"unknown",displayName:"Unknown",autoDetected:!1,message:"Failed to fetch database info"})}},[]),b=J=>{switch(J==null?void 0:J.toLowerCase()){case"postgresql":case"postgres":return s.jsxs(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[s.jsx(Et,{className:"w-3 h-3"}),"Connected"]});case"mysql":return s.jsxs(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[s.jsx(Et,{className:"w-3 h-3"}),"Connected"]});case"sqlite":return s.jsxs(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[s.jsx(Dc,{className:"w-3 h-3"}),"Local"]});default:return s.jsxs(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[s.jsx(hr,{className:"w-3 h-3"}),"Unknown"]})}};m.useEffect(()=>{f(),p(),w(),v()},[f,v,w,p]);const g=J=>{switch(J.toLowerCase()){case"google":return s.jsx(Ht,{className:"w-5 h-5 text-white"});case"github":return s.jsx(Mn,{className:"w-5 h-5 text-white"});case"discord":return s.jsx(Ht,{className:"w-5 h-5 text-white"});case"twitter":return s.jsx(Ht,{className:"w-5 h-5 text-white"});default:return s.jsx(Ht,{className:"w-5 h-5 text-white"})}};return c?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-white"})}):s.jsxs("div",{className:"space-y-8 animate-fade-in",children:[s.jsx("div",{className:"flex items-center justify-between p-5 pt-7",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-normal text-white tracking-tight",children:"Settings"}),s.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Configure your Better Auth application"})]})}),s.jsx("hr",{className:"w-full border-white/15 h-px"}),s.jsx("hr",{className:"w-full border-white/15 h-px"}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8 p-5",children:[s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(bi,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Application"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Basic application configuration"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsxs(Pn,{className:"space-y-0 px-0 pb-0 border-b-none",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ht,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"App Name"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Application display name"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-medium text-white",children:(e==null?void 0:e.appName)||"Better Auth"})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Xd,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Base URL"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Application base URL"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-mono font-medium text-white",children:(e==null?void 0:e.baseURL)||"http://localhost:3000"})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(sd,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Base Path"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Auth API base path"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-mono font-medium text-white",children:(e==null?void 0:e.basePath)||"/api/auth"})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Mn,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Secret"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Encryption secret"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-medium text-white",children:(e==null?void 0:e.secret)==="Configured"?"Configured":"Not set"})})]})]})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(lt,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Database"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Database connection and configuration"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsxs(Pn,{className:"space-y-0 px-0 pb-0 border-b-none",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(lt,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:(o==null?void 0:o.displayName)||((y=e==null?void 0:e.database)==null?void 0:y.type)&&((x=e==null?void 0:e.database)==null?void 0:x.type.charAt(0).toUpperCase())+((N=e==null?void 0:e.database)==null?void 0:N.type.slice(1))||"Unknown"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database Type"})]})]}),((o==null?void 0:o.name)||((j=e==null?void 0:e.database)==null?void 0:j.type))&&b((o==null?void 0:o.name)||((k=e==null?void 0:e.database)==null?void 0:k.type)||"")]}),((o==null?void 0:o.dialect)||((S=e==null?void 0:e.database)==null?void 0:S.dialect))&&(o==null?void 0:o.dialect)!=="unknown"&&s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(lt,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Dialect"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database dialect"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-medium text-white",children:((M=e==null?void 0:e.database)==null?void 0:M.dialect)||(o==null?void 0:o.dialect)})})]}),((A=e==null?void 0:e.database)==null?void 0:A.url)&&s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Xd,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Connection URL"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database connection string"})]})]}),s.jsxs(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[s.jsx(Et,{className:"w-3 h-3"}),"Configured"]})]}),((I=e==null?void 0:e.database)==null?void 0:I.casing)&&s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(bi,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Casing"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Table name casing"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-medium text-white capitalize",children:e.database.casing})})]}),(e==null?void 0:e.database)&&s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(gv,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Debug Logs"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database debug logging"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:e.database.debugLogs?s.jsxs(s.Fragment,{children:[s.jsx(hr,{className:"w-3 h-3"}),"Enabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Disabled"]})})]}),!(o!=null&&o.success)&&!(e!=null&&e.database)&&s.jsxs("div",{className:"flex items-center justify-between p-3 px-5",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(hr,{className:"w-5 h-5 text-yellow-400"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"No Database Detected"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:(o==null?void 0:o.message)||"No supported database packages found"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs bg-yellow-900/50 border border-yellow-500/30 text-yellow-400 rounded-sm",children:"Unknown"})]})]})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(Mn,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Providers"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Configured authentication providers"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsx(Pn,{className:"p-0",children:e!=null&&e.socialProviders&&e.socialProviders.length>0?e.socialProviders.map((J,F)=>s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15 last:border-b-0",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[g(J.type),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white capitalize",children:J.type}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:J.clientId?"Configured":"Not configured"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:J.clientId?s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Active"]}):s.jsxs(s.Fragment,{children:[s.jsx(hr,{className:"w-3 h-3"}),"Setup Required"]})})]},F)):s.jsxs("div",{className:"text-center py-8",children:[s.jsx(Mn,{className:"w-8 h-8 text-white mx-auto mb-2"}),s.jsx("p",{className:"text-sm text-gray-400",children:"No providers configured"})]})})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(qd,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Email & Password"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Email authentication settings"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsxs(Pn,{className:"p-0",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(qd,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Email Authentication"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Allow users to sign up with email"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(U=e==null?void 0:e.emailAndPassword)!=null&&U.enabled?s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(ra,{className:"w-3 h-3"}),"Disabled"]})})]}),(($=e==null?void 0:e.emailAndPassword)==null?void 0:$.enabled)&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ma,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Sign Up"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Allow new user registration"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(L=e==null?void 0:e.emailAndPassword)!=null&&L.disableSignUp?s.jsxs(s.Fragment,{children:[s.jsx(ra,{className:"w-3 h-3"}),"Disabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Mn,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Email Verification"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Require email verification"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(E=e==null?void 0:e.emailAndPassword)!=null&&E.requireEmailVerification?s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Required"]}):s.jsxs(s.Fragment,{children:[s.jsx(hr,{className:"w-3 h-3"}),"Optional"]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(sd,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Password Length"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Min/Max password length"})]})]}),s.jsx("div",{className:"text-right",children:s.jsxs("p",{className:"text-sm font-medium text-white",children:[((O=e==null?void 0:e.emailAndPassword)==null?void 0:O.minPasswordLength)||8," -"," ",((D=e==null?void 0:e.emailAndPassword)==null?void 0:D.maxPasswordLength)||128]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(qh,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Auto Sign In"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Auto sign in after registration"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(T=e==null?void 0:e.emailAndPassword)!=null&&T.autoSignIn?s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(hr,{className:"w-3 h-3"}),"Disabled"]})})]})]})]})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(_c,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Session"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Session management settings"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsxs(Pn,{className:"p-0",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(_c,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Session Duration"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"How long sessions last"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:(C=e==null?void 0:e.session)!=null&&C.expiresIn?`${Math.floor(e.session.expiresIn/(60*60*24))} days`:"7 days"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Default"})]})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(gv,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Update Age"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Session refresh interval"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-medium text-white",children:(_=e==null?void 0:e.session)!=null&&_.updateAge?`${Math.floor(e.session.updateAge/(60*60))} hours`:"24 hours"})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(qh,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Session Refresh"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Auto refresh sessions"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(z=e==null?void 0:e.session)!=null&&z.disableSessionRefresh?s.jsxs(s.Fragment,{children:[s.jsx(ra,{className:"w-3 h-3"}),"Disabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(lt,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Store in Database"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Store sessions in database"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(H=e==null?void 0:e.session)!=null&&H.storeSessionInDatabase?s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(Dc,{className:"w-3 h-3"}),"Secondary Storage"]})})]})]})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(Mn,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Rate Limiting"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"API rate limiting configuration"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsxs(Pn,{className:"p-0",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Mn,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Rate Limiting"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Enable rate limiting"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(P=e==null?void 0:e.rateLimit)!=null&&P.enabled?s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(hr,{className:"w-3 h-3"}),"Disabled"]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(_c,{className:"w-5 h-5 text-red-400"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Rate Limit Window"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Time window for rate limiting"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:(B=e==null?void 0:e.rateLimit)!=null&&B.window?`${e.rateLimit.window} seconds`:"10 seconds"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Window"})]})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Mn,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Max Requests"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Maximum requests per window"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:((q=e==null?void 0:e.rateLimit)==null?void 0:q.max)||100}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Requests"})]})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(lt,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Storage"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Rate limit storage type"})]})]}),s.jsx("div",{className:"text-right",children:s.jsx("p",{className:"text-sm font-medium text-white capitalize",children:((G=e==null?void 0:e.rateLimit)==null?void 0:G.storage)||"memory"})})]})]})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(bi,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Advanced"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Advanced configuration options"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsxs(Pn,{className:"p-0",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(sd,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Secure Cookies"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Use secure cookies"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(se=e==null?void 0:e.advanced)!=null&&se.useSecureCookies?s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(hr,{className:"w-3 h-3"}),"Disabled"]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Mn,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"CSRF Check"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"CSRF protection"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(re=e==null?void 0:e.advanced)!=null&&re.disableCSRFCheck?s.jsxs(s.Fragment,{children:[s.jsx(ra,{className:"w-3 h-3"}),"Disabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ll,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"IP Tracking"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Track IP addresses"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(R=(Z=e==null?void 0:e.advanced)==null?void 0:Z.ipAddress)!=null&&R.disableIpTracking?s.jsxs(s.Fragment,{children:[s.jsx(ra,{className:"w-3 h-3"}),"Disabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]})})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(zP,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Telemetry"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Usage analytics"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(ee=e==null?void 0:e.telemetry)!=null&&ee.enabled?s.jsxs(s.Fragment,{children:[s.jsx(hr,{className:"w-3 h-3"}),"Enabled"]}):s.jsxs(s.Fragment,{children:[s.jsx(Et,{className:"w-3 h-3"}),"Disabled"]})})]})]})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(Dc,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"System Info"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Better Auth Studio system information"]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsxs(Pn,{className:"p-0",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(qh,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Studio Version"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Better Auth Studio"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:h||"v1.0.0"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Latest"})]})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Dc,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Node.js Version"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Runtime environment"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:(n==null?void 0:n.nodeVersion)||"v18.0.0"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Current"})]})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ht,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Platform"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Operating system"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:(n==null?void 0:n.platform)||"macOS"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"System"})]})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(_c,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Uptime"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Service uptime"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:(n==null?void 0:n.uptime)||"2h 15m"}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Running"})]})]})]})]}),s.jsxs(_n,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none lg:col-span-2",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs(Dn,{className:"space-y-0",children:[s.jsxs(Tn,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[s.jsx(xv,{className:"w-4 h-4 text-white"}),s.jsx("span",{children:"Plugins"})]}),s.jsxs(fr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[s.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",s.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Better Auth plugins enabled in your configuration"]})]}),s.jsxs("div",{className:"pr-6",children:[s.jsx("p",{className:"text-sm font-medium text-white",children:(a==null?void 0:a.totalPlugins)||0}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Active"})]})]}),s.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),s.jsx(Pn,{className:"space-y-0 px-0 pb-0 border-b-none",children:a!=null&&a.plugins&&a.plugins.length>0?s.jsxs(s.Fragment,{children:[a.plugins.map((J,F)=>s.jsxs("div",{className:`flex items-center justify-between p-3 px-5 ${F<a.plugins.length-1?"border-b border-white/15":""}`,children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(xv,{className:"w-5 h-5 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-light uppercase text-white",children:J.name.slice(0,1).toUpperCase()+J.name.slice(1).replace("-"," ")}),s.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:J.description})]})]}),s.jsx("div",{className:"text-right flex items-center space-x-2",children:s.jsxs(at,{variant:"secondary",className:"text-xs bg-green-900/50 border border-dashed rounded-none border-green-500/30 text-green-400 flex items-center gap-1",children:[s.jsx(Et,{className:"w-3 h-3"}),"Enabled"]})})]},J.id)),a.configPath&&s.jsx("div",{className:"p-4 px-5 bg-black/30 border-t border-white/10",children:s.jsxs("p",{className:"text-xs text-gray-400",children:["Config file:"," ",s.jsx("span",{className:"text-white font-mono",children:a.configPath})]})})]}):s.jsxs("div",{className:"flex items-center justify-between p-4 px-5",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(hr,{className:"w-5 h-5 text-yellow-400"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-white",children:"No Plugins Enabled"}),s.jsx("p",{className:"text-xs text-gray-400",children:(a==null?void 0:a.error)||"No plugins are currently configured in your Better Auth setup"})]})]}),s.jsx(at,{variant:"secondary",className:"text-xs bg-yellow-900/50 border border-yellow-500/30 text-yellow-400 rounded-sm",children:"None"})]})})]})]})]})}function Cw(){var D,T;const{orgId:e,teamId:t}=qp(),n=Dr(),[r,a]=m.useState(null),[i,o]=m.useState([]),[l,c]=m.useState(!0),[d,h]=m.useState("details"),[u,f]=m.useState(!1),[p,w]=m.useState(!1),[v,b]=m.useState(""),[g,y]=m.useState([]),[x,N]=m.useState([]),[j,k]=m.useState({name:""}),S=m.useCallback(async()=>{if(t)try{const _=await(await fetch(`/api/teams/${t}`)).json();_.success&&_.team?(a(_.team),k({name:_.team.name})):_.team?(a(_.team),k({name:_.team.name})):V.error("Team not found")}catch{V.error("Failed to load team")}finally{c(!1)}},[t]),M=m.useCallback(async()=>{if(t)try{const _=await(await fetch(`/api/teams/${t}/members`)).json();_.success&&o(_.members||[])}catch{V.error("Failed to load team members")}},[t]),A=async()=>{try{const _=await(await fetch("/api/users?limit=10000")).json(),z=i.map(P=>P.userId),H=(_.users||[]).filter(P=>!z.includes(P.id));y(H)}catch{V.error("Failed to load users")}};m.useEffect(()=>{t&&(S(),M())},[t,S,M]);const I=async()=>{if(!j.name){V.error("Please enter a team name");return}const C=V.loading("Updating team...");try{const z=await(await fetch(`/api/teams/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:j.name})})).json();z.success?(await S(),w(!1),V.success("Team updated successfully!",{id:C})):V.error(`Error updating team: ${z.error||"Unknown error"}`,{id:C})}catch{V.error("Error updating team",{id:C})}},U=async()=>{if(x.length===0){V.error("Please select at least one user");return}const C=V.loading(`Adding ${x.length} members...`);try{const z=await(await fetch(`/api/teams/${t}/members`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userIds:x})})).json();z.success?(await M(),f(!1),N([]),b(""),V.success(`Successfully added ${x.length} members!`,{id:C})):V.error(`Error adding members: ${z.error||"Unknown error"}`,{id:C})}catch{V.error("Error adding members",{id:C})}},$=async(C,_)=>{const z=V.loading(`Removing ${_}...`);try{const P=await(await fetch(`/api/team-members/${C}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();P.success?(await M(),V.success(`${_} removed from team!`,{id:z})):V.error(`Error removing member: ${P.error||"Unknown error"}`,{id:z})}catch{V.error("Error removing team member",{id:z})}},L=()=>{A(),f(!0)},E=C=>{N(_=>_.includes(C)?_.filter(z=>z!==C):[..._,C])},O=g.filter(C=>C.name.toLowerCase().includes(v.toLowerCase())||C.email.toLowerCase().includes(v.toLowerCase()));return l?s.jsx("div",{className:"flex items-center justify-center h-32",children:s.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[s.jsx(ca,{className:"w-6 h-6 text-white animate-spin"}),s.jsx("div",{className:"text-white text-sm",children:"Loading team details..."})]})}):r?s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center space-x-4",children:s.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:s.jsxs("span",{className:"font-light",children:[s.jsxs("span",{onClick:()=>n(`/organizations/${r.organizationId}`),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["teams /"," "]}),s.jsx("span",{className:"text-white font-mono text-sm",children:t})]})})}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs(Y,{onClick:L,className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[s.jsx(Yo,{className:"w-4 h-4 mr-2"}),"Add Members"]}),s.jsxs(Y,{onClick:()=>w(!0),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[s.jsx(Ca,{className:"w-4 h-4 mr-2"}),"Edit Team"]})]})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-12 h-12 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:s.jsx(Ze,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{children:[s.jsxs("h1",{className:"text-2xl text-white font-light inline-flex items-center",children:[r.name,s.jsxs("sup",{className:"text-xs text-gray-500 ml-2",children:[s.jsx("span",{className:"mr-1",children:"["}),s.jsx("span",{className:"text-white/80 font-mono text-xs",children:t}),s.jsx("span",{className:"ml-1",children:"]"})]})]}),s.jsx("div",{className:"flex items-center space-x-2 mt-1",children:r.organization&&s.jsxs(Gp,{to:`/organizations/${r.organizationId}`,className:"text-gray-400 hover:text-white text-sm font-sans",children:[s.jsx(Ln,{className:"w-4 h-4 inline mr-1"}),r.organization.name]})})]})]}),s.jsx("div",{className:"border-b border-white/10",children:s.jsxs("nav",{className:"flex space-x-8",children:[s.jsxs("button",{onClick:()=>h("details"),className:`flex items-center space-x-2 px-3 py-4 text-sm font-medium border-b-2 transition-all duration-200 ${d==="details"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-gray-300"}`,children:[s.jsx(Ze,{className:"w-4 h-4"}),s.jsx("span",{children:"Details"})]}),s.jsxs("button",{onClick:()=>h("members"),className:`flex items-center space-x-2 px-3 py-4 text-sm font-medium border-b-2 transition-all duration-200 ${d==="members"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-gray-300"}`,children:[s.jsx(Ze,{className:"w-4 h-4"}),s.jsxs("span",{className:"inline-flex items-start",children:["Members",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:s.jsx(Nr,{value:i.length,className:"text-white/80 font-mono text-xs",prefix:s.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]})]})}),d==="details"&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:[s.jsx("h3",{className:"text-lg text-white font-light mb-4",children:"Team Information"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Name"}),s.jsx("p",{className:"text-white font-sans mt-1",children:r.name})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Organization"}),s.jsx("p",{className:"text-white font-sans mt-1",children:((D=r.organization)==null?void 0:D.name)||"Unknown"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Created"}),s.jsx("p",{className:"text-white font-sans mt-1",children:new Date(r.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Last Updated"}),s.jsx("p",{className:"text-white font-sans mt-1",children:new Date(r.updatedAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ze,{className:"w-8 h-8 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl text-white font-sans font-light",children:i.length}),s.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Members"})]})]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Yn,{className:"w-8 h-8 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl text-white font-sans font-light",children:Math.ceil((Date.now()-new Date(r.createdAt).getTime())/(1e3*60*60*24))}),s.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Days Active"})]})]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ln,{className:"w-8 h-8 text-white"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl text-white font-sans font-light",children:"1"}),s.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Organization"})]})]})})]})]}),d==="members"&&s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Team Members",s.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[s.jsx("span",{className:"mr-1",children:"["}),s.jsx("span",{className:"text-white/80 font-mono text-xs",children:i.length}),s.jsx("span",{className:"ml-1",children:"]"})]})]}),s.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage members of this team"})]})}),i.length>0?s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Joined"}),s.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),s.jsx("tbody",{children:i.map(C=>s.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5",children:[s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("img",{src:C.user.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${C.user.id}`,alt:C.user.name,className:"w-10 h-10 rounded-none border border-dashed border-white/20"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:C.user.name}),s.jsxs("div",{className:"text-sm text-gray-400",children:["ID: ",C.user.id]})]})]})}),s.jsx("td",{className:"py-4 px-4 text-white",children:C.user.email}),s.jsx("td",{className:"py-4 px-4",children:s.jsx(at,{variant:"secondary",className:"text-xs bg-blue-900/10 border border-dashed border-blue-500/30 text-blue-400/70 rounded-none capitalize",children:C.role})}),s.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(C.joinedAt).toLocaleDateString()}),s.jsx("td",{className:"py-4 px-4 text-right",children:s.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.jsxs(Y,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:()=>$(C.id,C.user.name),children:[s.jsx(cd,{className:"w-4 h-4 mr-1"}),"Remove"]})})})]},C.id))})]})})}):s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:s.jsxs("div",{className:"text-center",children:[s.jsx(Ze,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Members Yet"}),s.jsx("p",{className:"text-gray-400 mb-6",children:"Add members to this team to get started."}),s.jsxs(Y,{onClick:L,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[s.jsx(Yo,{className:"w-4 h-4 mr-2"}),"Add First Members"]})]})})]}),u&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Add Team Members"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>{f(!1),N([]),b("")},className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"relative",children:[s.jsx(J2,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),s.jsx(Ie,{placeholder:"Search users by name or email...",value:v,onChange:C=>b(C.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),x.length>0&&s.jsx("div",{className:"bg-blue-900/20 border border-blue-500/30 rounded-none p-3",children:s.jsxs("p",{className:"text-blue-400 text-sm",children:[x.length," user",x.length!==1?"s":""," selected"]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none max-h-96 overflow-y-auto",children:O.length>0?s.jsx("div",{className:"divide-y divide-white/5",children:O.map(C=>s.jsxs("div",{className:`flex items-center space-x-3 p-4 cursor-pointer hover:bg-white/5 ${x.includes(C.id)?"bg-blue-900/20":""}`,onClick:()=>E(C.id),children:[s.jsx("input",{type:"checkbox",checked:x.includes(C.id),onChange:()=>E(C.id),className:"rounded border-gray-300"}),s.jsx("img",{src:C.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${C.id}`,alt:C.name,className:"w-10 h-10 rounded-none border border-dashed border-white/20"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"text-white font-light",children:C.name}),s.jsx("div",{className:"text-sm text-gray-400",children:C.email})]})]},C.id))}):s.jsx("div",{className:"p-8 text-center",children:s.jsx("p",{className:"text-gray-400",children:"No users found matching your search."})})})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>{f(!1),N([]),b("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsxs(Y,{onClick:U,disabled:x.length===0,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:[s.jsx(Yo,{className:"w-4 h-4 mr-2"}),"Add ",x.length," Member",x.length!==1?"s":""]})]})]})}),p&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Edit Team"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>w(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:s.jsx(Ze,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:r.name}),s.jsx("div",{className:"text-sm text-gray-400",children:(T=r.organization)==null?void 0:T.name})]})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"edit-team-name",className:"text-sm text-gray-400 font-light",children:"Team Name"}),s.jsx(Ie,{id:"edit-team-name",value:j.name,onChange:C=>k({name:C.target.value}),placeholder:"e.g. Development Team",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>w(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:I,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update Team"})]})]})})]}):s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("div",{className:"flex items-center space-x-4",children:s.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:s.jsxs("span",{className:"font-light",children:[s.jsxs("span",{onClick:()=>n(`/organizations/${e}`),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["teams /"," "]}),s.jsx("span",{className:"text-white font-mono text-sm",children:t})]})})}),s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Ze,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),s.jsx("h2",{className:"text-xl text-white font-light mb-2",children:"Team Not Found"}),s.jsx("p",{className:"text-gray-400",children:"The team you're looking for doesn't exist."})]})]})}function TF(){const e=Dr(),[t,n]=m.useState([]),[r,a]=m.useState(!0),[i,o]=m.useState(null),[l,c]=m.useState(""),[d,h]=m.useState("all"),[u,f]=m.useState(1),[p]=m.useState(20);m.useEffect(()=>{w()},[]);const w=async()=>{try{const k=await(await fetch("/api/plugins")).json(),S=(k==null?void 0:k.plugins).find(M=>M.id==="teams");o({enabled:!!S,availablePlugins:(k==null?void 0:k.plugins).map(M=>M.id),configPath:k.configPath,teamsPlugin:(k==null?void 0:k.plugins).find(M=>M.id==="teams")}),S?await v():a(!1)}catch(j){console.error("Failed to check teams plugin status:",j),o({enabled:!1,error:"Failed to check plugin status"}),a(!1)}},v=async()=>{try{const k=await(await fetch("/api/teams")).json();k.success&&n(k.teams||[])}catch(j){console.error("Failed to fetch teams:",j),V.error("Failed to load teams")}finally{a(!1)}},b=t.filter(j=>{var S;const k=j.name.toLowerCase().includes(l.toLowerCase())||((S=j.organization)==null?void 0:S.name.toLowerCase().includes(l.toLowerCase()));if(d==="all")return k;if(d==="recent"){const M=new Date;return M.setDate(M.getDate()-7),k&&new Date(j.createdAt)>M}return k}),g=u*p,y=g-p,x=b.slice(y,g),N=Math.ceil(b.length/p);return r?s.jsx("div",{className:"flex items-center justify-center min-h-screen",children:s.jsx(Cr,{className:"w-8 h-8 animate-spin text-white"})}):i!=null&&i.enabled?s.jsxs("div",{className:"p-6 space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Teams",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 mt-0 inline-flex items-baseline",children:s.jsx(Nr,{value:b.length,className:"text-white font-mono text-sm",prefix:s.jsx("span",{className:"mr-1 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-1 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]}),s.jsxs("p",{className:"text-gray-400 mt-1 uppercase font-mono text-sm font-light flex items-baseline gap-1",children:[s.jsx(Nr,{value:b.length,className:"text-white font-mono text-sm",format:{notation:"standard",maximumFractionDigits:0}}),s.jsxs("span",{children:["team",b.length!==1?"s":""," found"]})]})]}),s.jsx("div",{className:"flex items-center space-x-3",children:s.jsxs(Y,{onClick:()=>e("/teams/new"),className:"bg-white text-black hover:bg-gray-200 border-dashed",children:[s.jsx(zs,{className:"w-4 h-4 mr-2"}),"Create Team"]})})]}),s.jsxs("div",{className:"flex items-center space-x-4",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(Ea,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),s.jsx(Ie,{type:"text",placeholder:"Search teams...",value:l,onChange:j=>c(j.target.value),className:"pl-10 bg-black border-dashed border-white/20 text-white placeholder-gray-400 focus:ring-2 focus:ring-white focus:border-transparent"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Y,{variant:d==="all"?"default":"outline",size:"sm",onClick:()=>h("all"),className:d==="all"?"bg-white text-black":"border-dashed border-white/20 text-white hover:bg-white/10",children:"All"}),s.jsx(Y,{variant:d==="recent"?"default":"outline",size:"sm",onClick:()=>h("recent"),className:d==="recent"?"bg-white text-black":"border-dashed border-white/20 text-white hover:bg-white/10",children:"Recent"})]})]}),x.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Ma,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-light text-white mb-2",children:"No teams found"}),s.jsx("p",{className:"text-gray-400 mb-6",children:l?"Try adjusting your search terms":"Get started by creating your first team"}),!l&&s.jsxs(Y,{onClick:()=>e("/teams/new"),className:"bg-white text-black hover:bg-gray-200 border-dashed",children:[s.jsx(zs,{className:"w-4 h-4 mr-2"}),"Create Team"]})]}):s.jsx("div",{className:"grid gap-4",children:x.map(j=>{var k;return s.jsx("div",{className:"bg-black/30 border border-white/15 rounded-none p-4 hover:bg-black/40 transition-colors cursor-pointer",onClick:()=>e(`/teams/${j.id}`),children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-4",children:[s.jsx("div",{className:"w-10 h-10 bg-white/10 rounded-none flex items-center justify-center",children:s.jsx(Ma,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium",children:j.name}),s.jsxs("p",{className:"text-gray-400 text-sm",children:[(k=j.organization)==null?void 0:k.name," • ",j.memberCount||0," members"]})]})]}),s.jsx("div",{className:"flex items-center space-x-2",children:s.jsx(at,{variant:"secondary",className:"text-xs bg-green-900/50 border border-dashed rounded-none border-green-500/30 text-green-400",children:"Active"})})]})},j.id)})}),N>1&&s.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[s.jsx(Y,{variant:"outline",size:"sm",onClick:()=>f(Math.max(1,u-1)),disabled:u===1,className:"border-dashed border-white/20 text-white hover:bg-white/10 disabled:opacity-50",children:"Previous"}),s.jsxs("span",{className:"text-gray-400 text-sm",children:["Page ",u," of ",N]}),s.jsx(Y,{variant:"outline",size:"sm",onClick:()=>f(Math.min(N,u+1)),disabled:u===N,className:"border-dashed border-white/20 text-white hover:bg-white/10 disabled:opacity-50",children:"Next"})]})]}):s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl text-white font-light",children:"Teams"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"Manage your application organizations"})]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-8",children:s.jsxs("div",{className:"flex items-start space-x-4",children:[s.jsx("div",{className:"flex-shrink-0",children:s.jsx(xr,{className:"w-12 h-12 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"Organization Plugin Required"}),s.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."}),s.jsxs("div",{className:"bg-black/50 border border-dashed border-white/20 rounded-none p-4 mb-6",children:[s.jsx("h4",{className:"text-white font-light mb-3",children:"Follow these steps:"}),s.jsx("ol",{className:"text-gray-300 space-y-2 text-sm list-decimal list-inside",children:s.jsxs("li",{children:["Import the plugin in your auth configuration file",(i==null?void 0:i.configPath)&&s.jsxs("span",{className:"text-gray-400",children:[" (",i.configPath,")"]}),":"]})}),s.jsx("div",{className:"mt-4 bg-black/70 border border-dashed border-white/10 rounded-none p-3 overflow-x-auto",children:s.jsxs("pre",{className:"text-sm text-gray-300",children:[s.jsx("span",{className:"text-blue-400",children:"import"})," ","{ betterAuth }"," ",s.jsx("span",{className:"text-blue-400",children:"from"})," ",s.jsx("span",{className:"text-green-400",children:'"better-auth"'})," ",s.jsx("br",{}),s.jsx("span",{className:"text-blue-400",children:"import"})," ","{ organization }"," ",s.jsx("span",{className:"text-blue-400",children:"from"})," ",s.jsx("span",{className:"text-green-400",children:'"better-auth/plugins/organization"'})," ",s.jsx("br",{}),s.jsx("span",{className:"text-blue-400",children:"export const"})," ",s.jsx("span",{className:"text-yellow-300",children:"auth"})," ="," ",s.jsx("span",{className:"text-yellow-300",children:"betterAuth"}),"(","{"," ",s.jsx("br",{}),s.jsx("span",{className:"text-gray-500 pl-10",children:"// ... your existing configuration"})," ",s.jsx("br",{}),s.jsx("span",{className:"text-red-300 pl-10",children:"plugins"}),": [ ",s.jsx("br",{}),s.jsxs("span",{className:"text-yellow-300 pl-12",children:["organization(",")"]}),s.jsx("br",{}),s.jsx("span",{className:"pl-10",children:"]"})," ",s.jsx("br",{}),"}",") ",s.jsx("br",{})]})}),s.jsx("div",{className:"mt-4",children:s.jsx("p",{className:"text-gray-400 text-sm",children:"2. Do migrations to create the organizations table"})}),s.jsx("div",{className:"mt-2",children:s.jsx("p",{className:"text-gray-400 text-sm",children:"3. Restart your application to apply the changes"})})]}),(i==null?void 0:i.availablePlugins)&&i.availablePlugins.length>0&&s.jsx("div",{className:"mb-4",children:s.jsxs("p",{className:"text-gray-400 text-sm",children:["Currently enabled plugins: ",i.availablePlugins.join(", ")]})}),s.jsx(Y,{onClick:()=>window.location.reload(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Check Again"}),s.jsxs("div",{className:"mt-4 text-xs text-gray-500",children:["Need help? Check the"," ",s.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"})]})]})]})})]})}const yf=`// Example custom migration script
469
469
  import { migrateUser } from '@better-auth/migration';
470
470
 
471
471
  async function run() {