better-auth-studio 1.0.58 → 1.0.59-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-auth-studio",
3
- "version": "1.0.58",
3
+ "version": "1.0.59-beta.1",
4
4
  "description": "Studio for Better Auth",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1094,6 +1094,6 @@ export const authClient = createAuthClient({
1094
1094
  ],
1095
1095
  });`;Pc({...St,clientSetup:Ze})},Am=R=>{if(!R)return"";const $=R.replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return $.length===0?"":$.map((re,de)=>re.split("-").map((Dt,da)=>de===0&&da===0?Dt.toLowerCase():Dt.charAt(0).toUpperCase()+Dt.slice(1).toLowerCase()).join("")).join("")},s6=async()=>{if(!oa.trim()){q.error("Please enter a plugin name");return}dE(!0),Fc(null),Pc(null);try{const R=la.filter(xe=>xe.name.trim()&&xe.fields.some(Ze=>Ze.name.trim())),$=La.filter(xe=>xe.name.trim()&&xe.hookLogic.trim()),te=Cr.filter(xe=>xe.name.trim()&&xe.middlewareLogic.trim()),de=await(await fetch("/api/tools/plugin-generator",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pluginName:oa.trim(),description:jr.trim()||void 0,clientFramework:fE,tables:R.map(xe=>({name:xe.name.trim(),fields:xe.fields.filter(Ze=>Ze.name.trim())})),hooks:$.map(xe=>{var Ze,Dt;return{name:xe.name.trim(),timing:xe.timing,action:xe.action,customPath:(Ze=xe.customPath)==null?void 0:Ze.trim(),customMatcher:(Dt=xe.customMatcher)==null?void 0:Dt.trim(),hookLogic:xe.hookLogic.trim()}}),middleware:te.map(xe=>({name:xe.name.trim(),path:xe.path.trim(),pathType:xe.pathType,middlewareLogic:xe.middlewareLogic.trim()})),endpoints:cs.filter(xe=>xe.name.trim()&&xe.path.trim()).map(xe=>({name:xe.name.trim(),path:xe.path.trim(),method:xe.method,handlerLogic:xe.handlerLogic.trim()})),rateLimit:Sm?{path:Yn.path.trim(),pathType:Yn.pathType,window:Yn.window,max:Yn.max}:void 0})})).json();if(de.success)Pc(de.plugin),q.success("Plugin generated successfully"),setTimeout(()=>{var xe;(xe=lE.current)==null||xe.scrollIntoView({behavior:"smooth",block:"start"})},100);else{const xe=de.error||"Failed to generate plugin";Fc(xe),q.error(xe)}}catch(R){const $=R instanceof Error?R.message:"Failed to generate plugin";Fc($),q.error($)}finally{dE(!1)}},i6=async()=>{try{const $=await(await fetch("/api/database/schema")).json();if($.success&&$.schema&&$.schema.tables){const te=$.schema.tables.map(re=>({name:re.name,displayName:re.displayName||re.name}));se(te)}}catch{q.error("Failed to fetch available tables")}};p.useEffect(()=>{ae&&(i6(),le(new Set))},[ae]);const o6=R=>{le($=>{const te=new Set($);return te.has(R)?te.delete(R):te.add(R),te})},l6=()=>{le(new Set(ee.map(R=>R.name)))},c6=()=>{le(new Set)},d6=async()=>{if(!Ot.trim()){q.error("Please paste a JWT to decode");return}Wt(!0),ie(null),At(null);try{const $=await(await fetch("/api/tools/jwt/decode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:Ot.trim(),secret:Xe.trim()||void 0})})).json();if($.success)At($),q.success("JWT decoded successfully");else{const te=$.error||"Failed to decode JWT";ie(te),q.error(te)}}catch(R){const $=R instanceof Error?R.message:"Failed to decode JWT";ie($),q.error($)}finally{Wt(!1)}},u6=async()=>{const R=parseInt(Q,10);if(isNaN(R)||R<=0){q.error("Please provide a valid expiration (minutes)");return}let $;if(Y==="jwt"){const te=Re.trim();if(te.length>0&&te!=="{"&&te!=="}")try{$=JSON.parse(te)}catch{q.error("Custom claims must be valid JSON");return}}at(!0),we(null);try{const re=await(await fetch("/api/tools/token-generator",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:Y,subject:me||void 0,audience:Me||void 0,expiresInMinutes:R,customClaims:$,secretOverride:je||void 0})})).json();if(re.success)we(re),$e("success",`✅ Generated ${Y.replace("_"," ")} token`,"completed"),q.success("Token generated successfully");else throw new Error(re.error||"Failed to generate token")}catch(te){const re=te instanceof Error?te.message:"Failed to generate token";$e("error",`❌ ${re}`,"failed"),q.error(re)}finally{at(!1)}},h6=async()=>{if(ye.size===0){q.error("Please select at least one table to export");return}const R=parseInt(Oe,10);if(isNaN(R)||R<=0){q.error("Please enter a valid limit (greater than 0)");return}if(R>1e4){q.error("Limit cannot exceed 10,000 rows per table");return}qe(!0),a("export-data"),l(!0),i([]);try{$e("info",`📦 Starting export of ${ye.size} table(s)...`,"running"),$e("progress",`Format: ${ge.toUpperCase()} | Limit: ${R} rows per table`,"running");const te=await(await fetch("/api/tools/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tables:Array.from(ye),format:ge,limit:R})})).json();if(te.success){$e("success","✅ Export completed successfully!","completed"),te.rowCounts&&Object.entries(te.rowCounts).forEach(([Ze,Dt])=>{$e("info",` • ${Ze}: ${Dt} rows`,"completed")}),$e("info",`Downloading ${te.filename}...`,"completed");const re=new Blob([te.data],{type:te.contentType||(ge==="json"?"application/json":"text/csv")}),de=window.URL.createObjectURL(re),xe=document.createElement("a");xe.href=de,xe.download=te.filename,document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),window.URL.revokeObjectURL(de),q.success("Export downloaded successfully"),ne(!1)}else throw new Error(te.error||"Export failed")}catch($){$e("error",`❌ Export failed: ${$ instanceof Error?$.message:$}`,"failed"),q.error("Export failed")}finally{qe(!1),a(null)}},f6=async()=>{a("health-check"),l(!0),i([]),$e("info","Running Better Auth health check...","running");try{$e("progress","Testing Better Auth endpoints...","running");const R=await fetch("/api/tools/health-check",{method:"POST"}),$=await R.json();if(!R.ok)throw new Error($.error||$.message||"Health check failed");$.success?($e("success","✅ Better Auth health check passed","completed"),q.success("Health check passed")):($e("error","❌ Better Auth health check failed","failed"),$.failedEndpoints&&$.failedEndpoints.length>0&&$.failedEndpoints.forEach(te=>{const re=te.status?` (Status: ${te.status})`:"",de=te.error?` - ${te.error}`:"";$e("error",` • Endpoint ${te.endpoint}${re}${de}`,"failed")}),q.error("Health check failed"))}catch(R){$e("error",`❌ Health check failed: ${R instanceof Error?R.message:R}`,"failed"),q.error("Health check failed")}finally{a(null)}},p6=new Set(["test-oauth","test-db","hash-password","health-check","export-data","jwt-decoder","token-generator","validate-config","uuid-generator","password-strength","oauth-credentials","secret-generator","plugin-generator"]),m6=[{id:"test-oauth",name:"Test OAuth",description:"Test OAuth provider connections",icon:ea,action:MP,category:"oauth"},{id:"hash-password",name:"Hash Password",description:"Generate SHA hashes",icon:bo,action:IP,category:"utilities"},{id:"run-migration",name:"Run Migration",description:"Run database migrations",icon:As,action:UP,category:"database"},{id:"test-db",name:"Test Database",description:"Test database connection",icon:As,action:FP,category:"database"},{id:"validate-config",name:"Validate Config",description:"Validate Better Auth configuration",icon:gp,action:PP,category:"utilities"},{id:"health-check",name:"Health Check",description:"Run system health check",icon:fj,action:f6,category:"testing"},{id:"export-data",name:"Export Data",description:"Export database tables to JSON or CSV",icon:Dl,action:zP,category:"database"},{id:"jwt-decoder",name:"JWT Decoder",description:"Inspect tokens and verify claims",icon:An,action:$P,category:"utilities"},{id:"token-generator",name:"Token Generator",description:"Mint short-lived test tokens",icon:Xl,action:JP,category:"utilities"},{id:"plugin-generator",name:"Plugin Generator",description:"Generate Better Auth plugins",icon:oi,action:e6,category:"utilities"},{id:"uuid-generator",name:"UUID Generator",description:"Generate and validate UUIDs",icon:Rh,action:HP,category:"utilities"},{id:"password-strength",name:"Password Strength Checker",description:"Validate passwords against your config",icon:Yl,action:qP,category:"utilities"},{id:"oauth-credentials",name:"OAuth Credentials",description:"View and test OAuth provider credentials",icon:ea,action:WP,category:"oauth"},{id:"secret-generator",name:"Secret Generator",description:"Generate secure AUTH_SECRET for Better Auth",icon:bo,action:VP,category:"utilities"}],g6=[{id:"oauth",name:"OAuth",icon:ea},{id:"database",name:"Database",icon:As},{id:"testing",name:"Testing",icon:fj},{id:"utilities",name:"Utilities",icon:cU}].map(R=>({...R,tools:m6.filter($=>$.category===R.id)}));return r.jsxs("div",{className:"space-y-8 bg-black w-full min-h-screen",children:[r.jsxs("div",{className:"w-full flex flex-col",children:[r.jsx("div",{className:"flex items-center justify-between p-5 pt-7",children:r.jsxs("div",{className:"pb-8",children:[r.jsx("h1",{className:"text-3xl font-normal text-white tracking-tight",children:"Tools"}),r.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Utility tools for managing and testing your Better Auth setup"})]})}),r.jsxs("div",{className:"flex flex-col items-center space-y-8",children:[r.jsx("hr",{className:"w-full border-white/15 h-px"}),r.jsx("hr",{className:"w-full border-white/15 h-px"})]}),o&&s.length>0&&r.jsxs("div",{className:"mb-6 p-6 gap-8",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h3",{className:"text-sm uppercase font-mono text-gray-400 tracking-wider",children:"Tool Output"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>l(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsx(Gi,{title:"Tool Execution Logs",lines:s,isRunning:n!==null,className:"w-full",defaultCollapsed:!1})]}),r.jsx("div",{className:"space-y-8 p-6 gap-8",children:g6.map(R=>r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(R.icon,{className:"w-5 h-5 text-white"}),r.jsx("h2",{className:"text-lg font-light text-white uppercase tracking-wider",children:R.name})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:R.tools.map($=>{const te=$.icon,re=n===$.id,de=p6.has($.id),xe=!de||n!==null&&n!==$.id||re;return r.jsxs("button",{onClick:()=>$.action(),disabled:xe,className:`relative flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none transition-colors text-left group ${de?"hover:bg-black/50 disabled:opacity-50 disabled:cursor-not-allowed":"opacity-60 cursor-not-allowed"}`,children:[r.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:re?r.jsx(mn,{className:"w-6 h-6 text-white animate-spin"}):r.jsx(te,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"text-white font-light mb-1",children:$.name}),r.jsxs("p",{className:"text-xs uppercase font-mono flex items-center text-gray-400",children:[r.jsx(od,{className:"w-4 h-4 mr-2"}),$.description]})]}),!de&&r.jsx("span",{className:"absolute top-2 right-3 text-[10px] font-mono uppercase tracking-[0.2em] text-white/60",children:"Coming Soon"}),r.jsx(hi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]},$.id)})})]},R.id))})]}),N&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(bo,{className:"w-5 h-5 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Password Hasher"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-5 h-5"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Algorithm"}),r.jsxs("select",{value:I,onChange:R=>O(R.target.value),className:"mt-2 w-full bg-black border border-dashed border-white/20 text-white px-3 py-2 text-sm focus:outline-none",children:[r.jsx("option",{value:"SHA-256",children:"SHA-256"}),r.jsx("option",{value:"SHA-384",children:"SHA-384"}),r.jsx("option",{value:"SHA-512",children:"SHA-512"})]})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Encoding"}),r.jsxs("select",{value:M,onChange:R=>B(R.target.value),className:"mt-2 w-full bg-black border border-dashed border-white/20 text-white px-3 py-2 text-sm focus:outline-none",children:[r.jsx("option",{value:"hex",children:"Hex"}),r.jsx("option",{value:"base64",children:"Base64"}),r.jsx("option",{value:"base64url",children:"Base64 URL"})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Salt (optional)"}),r.jsx(ve,{value:E,onChange:R=>k(R.target.value),placeholder:"e.g. project-specific-salt",className:"mt-2 bg-black border border-dashed border-white/20 text-white rounded-none"}),r.jsxs("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:["Salt is prepended (",r.jsx("span",{className:"text-white/80",children:"salt:password"}),")"]})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Password"}),r.jsxs("div",{className:"relative mt-2",children:[r.jsx(ve,{type:C?"text":"password",value:T,onChange:R=>j(R.target.value),placeholder:"Enter password",className:"bg-black border border-dashed border-white/20 text-white rounded-none pr-10"}),r.jsx("button",{type:"button",onClick:()=>D(R=>!R),className:"absolute inset-y-0 right-0 px-3 flex items-center text-gray-400 hover:text-white","aria-label":C?"Hide password":"Show password",children:C?r.jsx(cf,{className:"w-4 h-4"}):r.jsx(Ii,{className:"w-4 h-4"})})]})]})]}),A&&r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Hash Result"}),r.jsxs("div",{className:"mt-2 flex items-center space-x-2",children:[r.jsx(ve,{value:A,readOnly:!0,className:"flex-1 bg-black border border-dashed border-white/20 text-white rounded-none"}),r.jsx(z,{variant:"outline",size:"icon",onClick:()=>A&&ca(A),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:r.jsx(Xn,{className:"w-4 h-4"})})]})]})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-8 border-t border-dashed border-white/10 pt-6",children:[r.jsx(z,{variant:"outline",onClick:()=>S(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"}),r.jsx(z,{onClick:DP,disabled:_,className:"rounded-none",children:_?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Hashing..."]}):"Hash Password"})]})]})}),c&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-8 w-full max-w-2xl rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(ea,{className:"w-6 h-6 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light",children:"Select OAuth Provider"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{u(!1),m("")},className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-5 h-5"})})]}),r.jsx("div",{className:"space-y-4",children:h.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(ea,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),r.jsx("p",{className:"text-gray-400 mb-2 text-lg",children:"No OAuth providers configured"}),r.jsx("p",{className:"text-sm text-gray-500",children:"Please configure OAuth providers in your Better Auth configuration"})]}):r.jsxs("div",{children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-400 mb-4 uppercase font-mono",children:["Available Providers (",h.length,")"]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 max-h-96 overflow-y-auto",children:h.map(R=>r.jsxs("button",{onClick:()=>{m(R.id),setTimeout(()=>{LP(R.id)},100)},className:`w-full flex items-center space-x-4 p-4 border rounded-none transition-all text-left group ${f===R.id?"border-white/50 bg-white/10":"border-dashed border-white/20 hover:bg-white/5 hover:border-white/30"}`,children:[r.jsx("div",{className:"flex-shrink-0",children:RP(R.id)}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("p",{className:"text-white uppercase font-mono font-light text-base",children:R.name||R.id})}),r.jsx(hi,{className:`w-5 h-5 transition-colors flex-shrink-0 ${f===R.id?"text-white":"text-gray-400 group-hover:text-white"}`})]},R.id))}),r.jsx("p",{className:"text-xs text-gray-500 mt-4 font-mono uppercase",children:"Click on a provider to start the OAuth test"})]})}),r.jsx("div",{className:"flex justify-end space-x-3 mt-8 pt-6 border-t border-dashed border-white/10",children:r.jsx(z,{variant:"outline",onClick:()=>{u(!1),m("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"})})]})}),y&&r.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/95 border border-dashed border-white/20 p-8 w-full max-w-5xl rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(As,{className:"w-6 h-6 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Select Migration"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>x(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-5 h-5"})})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[r.jsx("div",{className:"space-y-3",children:ud.map(R=>{const $=(wn==null?void 0:wn.id)===R.id;return r.jsxs("button",{onClick:()=>OP(R.id),disabled:R.disabled,className:`w-full flex items-center space-x-3 p-4 border transition-colors rounded-none text-left ${R.disabled?"border-dashed border-white/10 bg-black/30 cursor-not-allowed opacity-60":$?"border-white/60 bg-white/10":"border-dashed border-white/20 hover:bg-white/5 hover:border-white/40"}`,children:[r.jsx("div",{className:"flex-shrink-0 w-10 h-10 bg-white/10 flex items-center justify-center",children:R.logo?R.logo:r.jsx(oi,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-white uppercase font-mono text-sm",children:R.name}),r.jsx("p",{className:"text-xs uppercase text-gray-400 font-mono mt-1 truncate",children:R.description})]}),R.disabled&&r.jsx("span",{className:"text-[10px] font-mono text-gray-400 uppercase",children:"Coming Soon"})]},R.id)})}),r.jsxs("div",{className:"md:col-span-2 space-y-4",children:[r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"w-12 h-12 bg-white/10 flex items-center justify-center",children:wn.logo?wn.logo:r.jsx(oi,{className:"w-8 h-8 text-white"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"text-white -mb-2 text-lg font-light uppercase tracking-wider",children:wn.name}),r.jsx("p",{className:"text-sm mt-0 text-gray-400 uppercase font-mono leading-relaxed",children:wn.description}),r.jsx("div",{className:"flex items-center space-x-2",children:wn.docs&&r.jsx(z,{variant:"ghost",size:"sm",asChild:!0,className:"rounded-none border border-dashed",children:r.jsx("a",{href:wn.docs,target:"_blank",rel:"noreferrer",children:"View Docs"})})})]})]}),wn.highlights&&r.jsx("ul",{className:"space-y-2 text-xs text-gray-300 font-mono bg-black/40 border border-white/10 p-4",children:wn.highlights.map(R=>r.jsxs("li",{className:"flex items-start space-x-2",children:[r.jsx("span",{className:"text-white/60 mt-0.5",children:"•"}),r.jsx("span",{children:R})]},R))}),wn.disabled?r.jsxs("div",{className:"space-y-4 text-gray-400 font-mono text-xs",children:[r.jsx("p",{children:"This migration provider is coming soon."}),r.jsxs("p",{children:["Subscribe to updates at"," ",r.jsx("a",{href:"https://better-auth.com",target:"_blank",rel:"noreferrer",className:"text-white underline",children:"better-auth.com"}),"."]})]}):wn.custom?r.jsxs("div",{className:"space-y-3",children:[r.jsx("label",{className:"text-xs uppercase font-mono text-gray-400",children:"Custom Migration Script"}),r.jsx("textarea",{value:v,onChange:R=>g(R.target.value),className:"w-full h-64 bg-black/70 border border-white/10 text-xs text-gray-200 font-mono p-3 rounded-none focus:outline-none focus:ring-0"}),r.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[r.jsx(z,{variant:"outline",size:"sm",className:"rounded-none",onClick:()=>g(ew),children:"Reset"}),r.jsxs(z,{variant:"ghost",size:"sm",className:"rounded-none text-gray-400 hover:text-white",onClick:()=>ca(v),children:[r.jsx(Xn,{className:"w-4 h-4"}),"Copy Script"]}),r.jsx(z,{className:"rounded-none",onClick:()=>pE("custom",v),children:"Run Custom Script"})]})]}):r.jsxs("div",{className:"space-y-3",children:[wn.script&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center justify-between text-xs uppercase font-mono text-gray-400",children:[r.jsx("span",{children:"Migration Script Preview"}),r.jsxs(z,{variant:"ghost",size:"sm",className:"rounded-none text-gray-400 hover:text-white",onClick:()=>ca(wn.script),children:[r.jsx(Xn,{className:"w-4 h-4"}),"Copy Script"]})]}),r.jsx("pre",{className:"bg-black/70 border border-white/10 text-[11px] text-green-200 font-mono p-4 overflow-auto leading-relaxed h-64",children:r.jsx("code",{children:wn.script})})]}),r.jsx("div",{className:"flex items-center justify-end space-x-2",children:r.jsxs(z,{className:"rounded-none",onClick:()=>pE(wn.id),children:["Run ",wn.name," Migration"]})})]})]})]})]})}),ae&&r.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-3xl max-h-[85vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Dl,{className:"w-5 h-5 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Export Data"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ne(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-3 block",children:"Export Format"}),r.jsxs("div",{className:"flex space-x-4",children:[r.jsx("button",{onClick:()=>be("json"),className:`px-4 py-2 border rounded-none transition-colors ${ge==="json"?"border-white/50 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/30"}`,children:"JSON"}),r.jsx("button",{onClick:()=>be("csv"),className:`px-4 py-2 border rounded-none transition-colors ${ge==="csv"?"border-white/50 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/30"}`,children:"CSV"})]})]}),r.jsxs("div",{children:[r.jsx(oe,{htmlFor:"export-limit",className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Row Limit Per Table"}),r.jsx(ve,{id:"export-limit",type:"number",value:Oe,onChange:R=>Ue(R.target.value),min:"1",max:"10000",placeholder:"1000",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),r.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Maximum 10,000 rows per table (default: 1000)"})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs(oe,{className:"text-xs uppercase font-mono text-gray-400",children:["Select Tables (",ye.size," selected)"]}),r.jsxs("div",{className:"flex space-x-2",children:[r.jsx(z,{variant:"ghost",size:"sm",onClick:l6,className:"text-xs text-gray-400 hover:text-white rounded-none",children:"Select All"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:c6,className:"text-xs text-gray-400 hover:text-white rounded-none",children:"Deselect All"})]})]}),r.jsx("div",{className:"border border-dashed border-white/20 rounded-none max-h-64 overflow-y-auto",children:ee.length===0?r.jsx("div",{className:"p-4 text-center text-gray-400 text-sm",children:"Loading tables..."}):r.jsx("div",{className:"space-y-0",children:ee.map(R=>{const $=ye.has(R.name);return r.jsx("button",{onClick:()=>o6(R.name),className:`w-full text-left p-3 border-b border-dashed border-white/10 last:border-b-0 transition-colors ${$?"bg-white/10 border-white/30":"hover:bg-white/5"}`,children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-white text-sm font-mono",children:R.displayName}),r.jsxs("span",{className:"text-xs text-gray-400 ml-2 font-mono",children:["(",R.name,")"]})]}),$&&r.jsx(Fh,{className:"w-4 h-4 text-white"})]})},R.name)})})})]})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-8 border-t border-dashed border-white/10 pt-6",children:[r.jsx(z,{variant:"outline",onClick:()=>ne(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx(z,{onClick:h6,disabled:Be||ye.size===0,className:"rounded-none",children:Be?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Exporting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Dl,{className:"w-4 h-4 mr-2"}),"Export"]})})]})]})}),bt&&r.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60]",children:r.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(An,{className:"w-5 h-5 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"JWT Decoder"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>Ye(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"JWT Token"}),r.jsx("textarea",{value:Ot,onChange:R=>Nt(R.target.value),placeholder:"Paste JWT here",className:"w-full min-h-[120px] bg-black border border-dashed border-white/20 text-white font-mono text-xs p-3 rounded-none focus:outline-none"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"HMAC Secret (optional)"}),r.jsx(ve,{value:Xe,onChange:R=>nt(R.target.value),placeholder:"Defaults to Better Auth secret if omitted",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{className:"flex items-end justify-end space-x-2",children:[r.jsx(z,{variant:"outline",onClick:()=>{Nt(""),nt(""),At(null),ie(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),r.jsx(z,{onClick:d6,disabled:kt,className:"rounded-none",children:kt?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Decoding..."]}):"Decode JWT"})]})]}),Qt&&r.jsx("div",{className:"border border-dashed border-red-500/30 bg-red-500/10 text-red-300 text-xs font-mono p-3 rounded-none",children:Qt}),Je&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[r.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[r.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Signature"}),r.jsx("p",{className:`text-sm ${Je.verified?"text-green-400":"text-yellow-300"}`,children:Je.verified?"Verified (HS256)":"Not verified"}),r.jsx("p",{className:"text-gray-400 break-all",children:Je.signature||"None"})]}),r.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[r.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Issued"}),r.jsx("p",{className:"text-white",children:Je.issuedAtFormatted||"Unknown"}),r.jsx("p",{className:"text-gray-500",children:Je.issuedAgo||""})]}),r.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[r.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Expires"}),r.jsx("p",{className:`text-white ${Je.expired?"text-red-300":""}`,children:Je.expiresAtFormatted||"No expiry"}),r.jsx("p",{className:"text-gray-500",children:Je.expiresIn||""})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"text-xs uppercase font-mono text-gray-400",children:"Header"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ca(JSON.stringify(Je.header,null,2)),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(Xn,{className:"w-4 h-4"})})]}),r.jsx("pre",{className:"text-[11px] text-gray-100 font-mono bg-black/40 p-3 overflow-x-auto max-h-64",children:JSON.stringify(Je.header,null,2)})]}),r.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"text-xs uppercase font-mono text-gray-400",children:"Payload"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ca(JSON.stringify(Je.payload,null,2)),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(Xn,{className:"w-4 h-4"})})]}),r.jsx("pre",{className:"text-[11px] text-gray-100 font-mono bg-black/40 p-3 overflow-x-auto max-h-64",children:JSON.stringify(Je.payload,null,2)})]})]}),Je.customClaims&&Object.keys(Je.customClaims).length>0&&r.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[r.jsx("div",{className:"text-xs uppercase font-mono text-gray-400 mb-2",children:"Custom Claims"}),r.jsx("pre",{className:"text-[11px] text-gray-100 font-mono bg-black/40 p-3 overflow-x-auto max-h-64",children:JSON.stringify(Je.customClaims,null,2)})]})]})]})]})}),Te&&r.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-[60]",children:r.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Xl,{className:"w-5 h-5 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Token Generator"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>He(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-3 block",children:"Token Type"}),r.jsx("div",{className:"flex flex-wrap gap-3",children:[{id:"api_key",label:"API Key"},{id:"jwt",label:"JWT"}].map(R=>r.jsx("button",{onClick:()=>ue(R.id),className:`px-4 py-2 border rounded-none text-sm uppercase font-mono transition-colors ${Y===R.id?"border-white/60 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/40"}`,children:R.label},R.id))})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Subject / User ID (optional)"}),r.jsx(ve,{value:me,onChange:R=>Ne(R.target.value),placeholder:"User identifier or email",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Audience (optional)"}),r.jsx(ve,{value:Me,onChange:R=>We(R.target.value),placeholder:"Audience / app id",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Expires In (minutes)"}),r.jsx(ve,{type:"number",value:Q,onChange:R=>ce(R.target.value),min:"1",max:"1440",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),Y==="jwt"&&r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Override Secret (optional)"}),r.jsx(ve,{value:je,onChange:R=>pe(R.target.value),placeholder:"Defaults to Better Auth secret",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]})]}),Y==="jwt"&&r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Custom Claims (JSON)"}),r.jsx("textarea",{value:Re,onChange:R=>X(R.target.value),placeholder:'{"role":"admin"}',className:"w-full min-h-[120px] bg-black border border-dashed border-white/20 text-white font-mono text-xs p-3 rounded-none focus:outline-none"}),r.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Leave empty to include only default claims (iss, sub, aud, exp, iat, jti)."})]}),r.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[r.jsx(z,{variant:"outline",onClick:()=>{we(null),Ne(""),We(""),X(`{
1096
1096
 
1097
- }`)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Reset"}),r.jsx(z,{onClick:u6,disabled:Ge,className:"rounded-none",children:Ge?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):"Generate Token"})]}),W&&r.jsxs("div",{className:"space-y-4 border border-dashed border-white/15 p-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs uppercase font-mono text-gray-400",children:"Generated Token"}),r.jsx("p",{className:"text-white font-mono text-sm break-all mt-1",children:W.token})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ca(W.token),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(Xn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-gray-400 uppercase tracking-wider",children:"Type"}),r.jsx("p",{className:"text-white mt-1 capitalize",children:W.type.replace("_"," ")})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-gray-400 uppercase tracking-wider",children:"Expires"}),r.jsx("p",{className:"text-white mt-1",children:BP(W.expiresAt)})]}),W.url&&r.jsxs("div",{className:"col-span-1",children:[r.jsx("p",{className:"text-gray-400 uppercase tracking-wider",children:"URL"}),r.jsx("p",{className:"text-white mt-1 break-all",children:W.url})]})]}),W.metadata&&r.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[r.jsx("p",{className:"text-xs uppercase font-mono text-gray-400 mb-2",children:"Metadata"}),r.jsx("pre",{className:"text-[11px] text-gray-100 font-mono bg-black/40 p-3 overflow-x-auto",children:JSON.stringify(W.metadata,null,2)})]})]})]})]})}),yn&&r.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60]",children:r.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-5xl max-h-[90vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(oi,{className:"w-5 h-5 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Plugin Generator"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>fn(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Plugin Name *"}),r.jsx(ve,{value:oa,onChange:R=>os(R.target.value),placeholder:"myPlugin",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),r.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Must be a valid JavaScript identifier"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Description (optional)"}),r.jsx(ve,{value:jr,onChange:R=>Ji(R.target.value),placeholder:"Plugin description",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Tables (optional)"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>Ma([...la,{name:"",fields:[{name:"",type:"string",required:!1,unique:!1}]}]),className:"text-xs text-gray-400 hover:text-white rounded-none",children:"+ Add Table"})]}),la.length===0?r.jsx("p",{className:"text-xs text-gray-500 font-mono",children:"No tables added"}):r.jsx("div",{className:"space-y-4",children:la.map((R,$)=>r.jsxs("div",{className:"border px-5 border-dashed border-white/15 p-3 relative",children:[r.jsxs("div",{className:"flex items-center space-x-2 relative",children:[r.jsx(ve,{value:R.name,onChange:te=>{const re=[...la];re[$].name=te.target.value,Ma(re)},placeholder:"Table name",className:"bg-black border border-dashed border-white/20 text-white text-xs rounded-none flex-1"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{Ma(la.filter((te,re)=>re!==$))},className:"text-red-400 hover:text-red-300 rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),R.fields.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"absolute border border-dashed w-px border-white/30",style:{left:"7px",top:"31px",bottom:"12px"}}),r.jsx("div",{className:"absolute border border-dashed h-px w-[11px] border-white/30",style:{left:"9px",top:"31px",bottom:"12px"}}),r.jsx("div",{className:"mt-3 relative",children:r.jsxs("div",{className:"space-y-0 pl-6",children:[R.fields.map((te,re)=>r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute border border-dashed h-px border-white/30 top-1/2 -translate-y-1/2",style:{left:"-36px",width:"36px"}}),r.jsxs("div",{className:"flex items-center space-x-2 py-2",children:[r.jsx(ve,{value:te.name,onChange:de=>{const xe=[...la];xe[$].fields[re].name=de.target.value,Ma(xe)},placeholder:"Field name",className:"bg-black border border-dashed border-white/20 text-white text-xs rounded-none flex-1"}),r.jsxs(kn,{value:te.type,onValueChange:de=>{const xe=[...la];xe[$].fields[re].type=de,Ma(xe)},children:[r.jsx(_n,{className:"sm:h-full sm:w-56 border px-0 border-dashed border-white/20 text-white/90 text-xs rounded-none py-1",children:r.jsx(Ea,{className:"font-mono uppercase text-[10px] px-0 text-white/90"})}),r.jsxs(Rn,{className:"font-mono uppercase text-[10px]",children:[r.jsx(De,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"string",children:"string"}),r.jsx(De,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"number",children:"number"}),r.jsx(De,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"boolean",children:"boolean"}),r.jsx(De,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"date",children:"date"})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gf,{id:`required-${$}-${re}`,checked:te.required,onCheckedChange:de=>{const xe=[...la];xe[$].fields[re].required=de===!0,Ma(xe)}}),r.jsx(oe,{htmlFor:`required-${$}-${re}`,className:"text-xs text-gray-400 font-mono uppercase cursor-pointer",children:"Required"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gf,{id:`unique-${$}-${re}`,checked:te.unique,onCheckedChange:de=>{const xe=[...la];xe[$].fields[re].unique=de===!0,Ma(xe)}}),r.jsx(oe,{htmlFor:`unique-${$}-${re}`,className:"text-xs text-gray-400 font-mono uppercase cursor-pointer",children:"Unique"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{const de=[...la];de[$].fields=de[$].fields.filter((xe,Ze)=>Ze!==re),Ma(de)},className:"text-red-400 hover:text-red-300 rounded-none",children:r.jsx(ct,{className:"w-3 h-3"})})]})]},re)),r.jsxs("div",{className:"relative pt-2",children:[r.jsx("div",{className:"absolute border border-dashed h-px border-white/30",style:{left:"-35px",width:"36px",top:"31px"}}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{const te=[...la];te[$].fields.push({name:"",type:"string",required:!1,unique:!1}),Ma(te)},className:"text-xs text-gray-400 hover:text-white rounded-none",children:"+ Add Field"})]})]})})]}),R.fields.length===0&&r.jsx("div",{className:"mt-3",children:r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{const te=[...la];te[$].fields.push({name:"",type:"string",required:!1,unique:!1}),Ma(te)},className:"text-xs text-gray-400 hover:text-white rounded-none",children:"+ Add Field"})})]},$))})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Rh,{className:"w-4 h-4 text-white"}),r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Hooks"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ar([...La,{name:"",timing:"before",action:"sign-up",hookLogic:"const context = ctx;",expanded:!0}]),className:"text-xs text-gray-400 hover:text-white rounded-none",children:"+ Add Hook"})]}),La.length===0?r.jsx("p",{className:"text-xs text-gray-500 font-mono",children:"No hooks added"}):r.jsx("div",{className:"space-y-2",children:La.map((R,$)=>{const te=`${R.timing} ${R.action==="custom"?"custom":R.action}: ${R.name||`Hook ${$+1}`}`;return r.jsxs("div",{className:"border border-dashed border-white/10",children:[r.jsxs("button",{onClick:()=>t6($),className:"w-full flex items-center justify-between p-3 hover:bg-white/5 transition-colors text-left",children:[r.jsx("span",{className:"text-xs font-mono text-white px-2 py-1 bg-black/40 border border-dashed border-white/20 rounded-none",children:te}),r.jsx(od,{className:`w-4 h-4 text-white/60 transition-transform ${R.expanded?"rotate-90":""}`})]}),R.expanded&&r.jsxs("div",{className:"border-t border-dashed border-white/10 p-4 space-y-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Hook Name"}),r.jsx(ve,{value:R.name,onChange:re=>{const de=[...La];de[$].name=re.target.value,ar(de)},placeholder:"e.g., Age Verification, TOS Check",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Timing"}),r.jsxs(FN,{value:R.timing,onValueChange:re=>{const de=[...La];de[$].timing=re,ar(de)},className:"flex space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vl,{value:"before",id:`hook-timing-before-${$}`}),r.jsx(oe,{htmlFor:`hook-timing-before-${$}`,className:"text-xs text-white font-mono cursor-pointer",children:"Before"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vl,{value:"after",id:`hook-timing-after-${$}`}),r.jsx(oe,{htmlFor:`hook-timing-after-${$}`,className:"text-xs text-white font-mono cursor-pointer",children:"After"})]})]})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Action"}),r.jsxs(FN,{value:R.action,onValueChange:re=>{const de=[...La];de[$].action=re,ar(de)},className:"flex space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vl,{value:"sign-up",id:`hook-action-signup-${$}`}),r.jsx(oe,{htmlFor:`hook-action-signup-${$}`,className:"text-xs text-white font-mono cursor-pointer",children:"Sign-up"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vl,{value:"sign-in",id:`hook-action-signin-${$}`}),r.jsx(oe,{htmlFor:`hook-action-signin-${$}`,className:"text-xs text-white font-mono cursor-pointer",children:"Sign-in"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vl,{value:"custom",id:`hook-action-custom-${$}`}),r.jsx(oe,{htmlFor:`hook-action-custom-${$}`,className:"text-xs text-white font-mono cursor-pointer",children:"Custom"})]})]})]})]}),R.action==="custom"&&r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Custom Path"}),r.jsx(ve,{value:R.customPath||"",onChange:re=>{const de=[...La];de[$].customPath=re.target.value,ar(de)},placeholder:"/my-plugin/custom-endpoint",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Custom Matcher (optional)"}),r.jsx(ve,{value:R.customMatcher||"",onChange:re=>{const de=[...La];de[$].customMatcher=re.target.value,ar(de)},placeholder:"e.g., context.headers.get('x-custom') === 'value'",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),r.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Leave empty to use default path matching"})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[r.jsx(oi,{className:"w-4 h-4 text-white"}),r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Hook Logic (TypeScript)"})]}),r.jsx("p",{className:"text-xs text-gray-400 mb-2 font-mono",children:"This is the TypeScript code that will be executed when the hook is triggered. This function has properties like ctx so you can access the request context, headers, body, etc. Here is a simple example of a hook logic:"}),r.jsx("textarea",{value:R.hookLogic,onChange:re=>{const de=[...La];de[$].hookLogic=re.target.value,ar(de)},className:"w-full min-h-[200px] bg-black border border-dashed border-white/20 text-white font-mono text-xs p-3 rounded-none focus:outline-none focus:border-white/40",placeholder:"const context = ctx;"})]}),r.jsxs(z,{variant:"outline",onClick:()=>{ar(La.filter((re,de)=>de!==$))},className:"w-full border border-dashed border-red-500/50 text-red-400 hover:bg-red-500/10 rounded-none",children:[r.jsx(ct,{className:"w-4 h-4 mr-2"}),"Remove Hook"]})]})]},$)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(An,{className:"w-4 h-4 text-white"}),r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Middleware"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ls([...Cr,{name:"",path:"/my-plugin/protected",pathType:"exact",middlewareLogic:"const context = ctx;",expanded:!0}]),className:"text-xs text-gray-400 hover:text-white rounded-none",children:"+ Add Middleware"})]}),Cr.length===0?r.jsx("p",{className:"text-xs text-gray-500 font-mono",children:"No middleware added"}):r.jsx("div",{className:"space-y-2",children:Cr.map((R,$)=>{const te=`${R.path}: ${R.name||`Middleware ${$+1}`}`;return r.jsxs("div",{className:"border border-dashed border-white/10",children:[r.jsxs("button",{onClick:()=>n6($),className:"w-full flex items-center justify-between p-3 hover:bg-white/5 transition-colors text-left",children:[r.jsx("span",{className:"text-xs font-mono text-white px-2 py-1 bg-black/40 border border-dashed border-white/20 rounded-none",children:te}),r.jsx(od,{className:`w-4 h-4 text-white/60 transition-transform ${R.expanded?"rotate-90":""}`})]}),R.expanded&&r.jsxs("div",{className:"border-t border-dashed border-white/10 p-4 space-y-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Middleware Name"}),r.jsx(ve,{value:R.name,onChange:re=>{const de=[...Cr];de[$].name=re.target.value,ls(de)},placeholder:"e.g., Auth Check, Rate Limiter",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path"}),r.jsx(ve,{value:R.path,onChange:re=>{const de=[...Cr];de[$].path=re.target.value,ls(de)},placeholder:"/my-plugin/protected",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path Type"}),r.jsxs(kn,{value:R.pathType,onValueChange:re=>{const de=[...Cr];de[$].pathType=re,ls(de)},children:[r.jsx(_n,{className:"bg-black border border-dashed border-white/20 text-white rounded-none",children:r.jsx(Ea,{})}),r.jsxs(Rn,{children:[r.jsx(De,{value:"exact",children:"Exact Match"}),r.jsx(De,{value:"prefix",children:"Prefix Match"}),r.jsx(De,{value:"regex",children:"Regex Match"})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[r.jsx(oi,{className:"w-4 h-4 text-white"}),r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Middleware Logic (TypeScript)"})]}),r.jsx("p",{className:"text-xs text-gray-400 mb-2 font-mono",children:"This is the TypeScript code that will be executed when the middleware is triggered. You can access the request context, headers, body, etc."}),r.jsx("textarea",{value:R.middlewareLogic,onChange:re=>{const de=[...Cr];de[$].middlewareLogic=re.target.value,ls(de)},className:"w-full min-h-[200px] bg-black border border-dashed border-white/20 text-white font-mono text-xs p-3 rounded-none focus:outline-none focus:border-white/40",placeholder:"const context = ctx;"})]}),r.jsxs(z,{variant:"outline",onClick:()=>{ls(Cr.filter((re,de)=>de!==$))},className:"w-full border border-dashed border-red-500/50 text-red-400 hover:bg-red-500/10 rounded-none",children:[r.jsx(ct,{className:"w-4 h-4 mr-2"}),"Remove Middleware"]})]})]},$)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Xl,{className:"w-4 h-4 text-white"}),r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Endpoints"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{const R="/my-plugin/endpoint",$=Am(R);eo([...cs,{name:$,path:R,method:"POST",handlerLogic:`// Endpoint handler logic here
1098
- return ctx.json({ success: true });`,expanded:!0}])},className:"text-xs text-gray-400 hover:text-white rounded-none",children:"+ Add Endpoint"})]}),cs.length===0?r.jsx("p",{className:"text-xs text-gray-500 font-mono",children:"No endpoints added"}):r.jsx("div",{className:"space-y-2",children:cs.map((R,$)=>{const te=`${R.method} ${R.path}: ${R.name||Am(R.path)||`Endpoint ${$+1}`}`;return r.jsxs("div",{className:"border border-dashed border-white/10",children:[r.jsxs("button",{onClick:()=>a6($),className:"w-full flex items-center justify-between p-3 hover:bg-white/5 transition-colors text-left",children:[r.jsx("span",{className:"text-xs font-mono text-white px-2 py-1 bg-black/40 border border-dashed border-white/20 rounded-none",children:te}),r.jsx(od,{className:`w-4 h-4 text-white/60 transition-transform ${R.expanded?"rotate-90":""}`})]}),R.expanded&&r.jsxs("div",{className:"border-t border-dashed border-white/10 p-4 space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path"}),r.jsx(ve,{value:R.path,onChange:re=>{const de=re.target.value,xe=Am(de),Ze=[...cs];Ze[$].path=de,Ze[$].name=xe,eo(Ze)},placeholder:"/sign-in/anonymous",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Endpoint Name (Auto-generated)"}),r.jsx(ve,{value:R.name,readOnly:!0,className:"bg-black/50 border border-dashed border-white/10 text-white/70 rounded-none cursor-not-allowed"}),r.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Generated from path"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Method"}),r.jsxs(kn,{value:R.method,onValueChange:re=>{const de=[...cs];de[$].method=re,eo(de)},children:[r.jsx(_n,{className:"bg-black border border-dashed border-white/20 text-white rounded-none",children:r.jsx(Ea,{})}),r.jsxs(Rn,{children:[r.jsx(De,{value:"GET",children:"GET"}),r.jsx(De,{value:"POST",children:"POST"})]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[r.jsx(oi,{className:"w-4 h-4 text-white"}),r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Handler Logic (TypeScript)"})]}),r.jsx("p",{className:"text-xs text-gray-400 mb-2 font-mono",children:"This is the TypeScript code that will be executed when the endpoint is called. You can access the context via ctx parameter."}),r.jsx("textarea",{value:R.handlerLogic,onChange:re=>{const de=[...cs];de[$].handlerLogic=re.target.value,eo(de)},className:"w-full min-h-[200px] bg-black border border-dashed border-white/20 text-white font-mono text-xs p-3 rounded-none focus:outline-none focus:border-white/40",placeholder:"// Endpoint handler logic here\\nreturn ctx.json({ success: true });"})]}),r.jsxs(z,{variant:"outline",onClick:()=>{eo(cs.filter((re,de)=>de!==$))},className:"w-full border border-dashed border-red-500/50 text-red-400 hover:bg-red-500/10 rounded-none",children:[r.jsx(ct,{className:"w-4 h-4 mr-2"}),"Remove Endpoint"]})]})]},$)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-3",children:[r.jsx(gf,{id:"rate-limit",checked:Sm,onCheckedChange:R=>Em(R===!0)}),r.jsx(oe,{htmlFor:"rate-limit",className:"text-xs uppercase font-mono text-gray-400 cursor-pointer",children:"Enable Rate Limiting"})]}),Sm&&r.jsxs("div",{className:"border border-dashed border-white/10 p-4 space-y-4 mt-3",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path"}),r.jsx(ve,{value:Yn.path,onChange:R=>{Ks({...Yn,path:R.target.value})},placeholder:"/my-plugin/*",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path Type"}),r.jsxs(kn,{value:Yn.pathType,onValueChange:R=>{Ks({...Yn,pathType:R})},children:[r.jsx(_n,{className:"bg-black border border-dashed border-white/20 text-white rounded-none",children:r.jsx(Ea,{})}),r.jsxs(Rn,{children:[r.jsx(De,{value:"exact",children:"Exact Match"}),r.jsx(De,{value:"prefix",children:"Prefix Match"}),r.jsx(De,{value:"regex",children:"Regex Match"})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Window (ms)"}),r.jsx(ve,{type:"number",value:Yn.window||"",onChange:R=>{const $=R.target.value;Ks({...Yn,window:$===""?0:parseInt($,10)||0})},onBlur:R=>{(!R.target.value||parseInt(R.target.value,10)<=0)&&Ks({...Yn,window:15*60*1e3})},placeholder:"900000",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),r.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Time window in milliseconds (e.g., 900000 = 15 minutes)"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Max Requests"}),r.jsx(ve,{type:"number",value:Yn.max||"",onChange:R=>{const $=R.target.value;Ks({...Yn,max:$===""?0:parseInt($,10)||0})},onBlur:R=>{(!R.target.value||parseInt(R.target.value,10)<=0)&&Ks({...Yn,max:100})},placeholder:"100",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),r.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Maximum requests per window"})]})]})]})]}),r.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[r.jsx(z,{variant:"outline",onClick:()=>{os(""),Ji(""),Tm("react"),Ma([]),ar([]),ls([]),eo([]),Em(!1),Ks({path:"/my-plugin/*",pathType:"prefix",window:15*60*1e3,max:100}),Pc(null),Fc(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Reset"}),r.jsx(z,{onClick:s6,disabled:cE||!oa.trim(),className:"rounded-none",children:cE?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):"Generate Plugin"})]}),uE&&r.jsx("div",{className:"border border-dashed border-red-500/30 bg-red-500/10 text-red-300 text-xs font-mono p-3 rounded-none",children:uE}),St&&r.jsxs("div",{ref:lE,className:"space-y-4 border border-dashed border-white/15 p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("p",{className:"text-xs uppercase font-mono text-gray-400",children:"Generated Code"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[ds==="clientSetup"&&r.jsxs("div",{className:"flex items-center space-x-2 mr-2",children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 whitespace-nowrap",children:"Framework:"}),r.jsxs(kn,{value:fE,onValueChange:R=>{Tm(R),r6(R)},children:[r.jsx(_n,{className:"bg-black sm:w-56 border border-dashed border-white/20 text-white rounded-none w-[220px] h-10 text-xs font-mono uppercase px-4 py-2",children:r.jsx(Ea,{className:"font-mono uppercase text-xs text-white"})}),r.jsxs(Rn,{className:"font-mono uppercase text-[10px] bg-black border border-dashed border-white/20",children:[r.jsxs(De,{value:"react",className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",children:[" ","React"]}),r.jsxs(De,{value:"svelte",className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",children:[" ","Svelte"]}),r.jsxs(De,{value:"solid",className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",children:[" ","Solid"]}),r.jsxs(De,{value:"vue",className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",children:[" ","Vue"]})]})]})]}),r.jsxs(z,{variant:"ghost",size:"sm",onClick:()=>{const R=St[ds];ca(R)},className:"text-gray-400 hover:text-white rounded-none",children:[r.jsx(Xn,{className:"w-4 h-4 mr-1"}),"Copy"]}),r.jsxs(z,{variant:"ghost",size:"sm",onClick:()=>{var Ze,Dt,da,ht,Et;const R=St[ds],$=((Et=[{id:"server",path:((Ze=St.filePaths)==null?void 0:Ze.server)||`plugin/${St.name}/index.ts`},{id:"client",path:((Dt=St.filePaths)==null?void 0:Dt.client)||`plugin/${St.name}/client/index.ts`},{id:"serverSetup",path:((da=St.filePaths)==null?void 0:da.serverSetup)||"auth.ts"},{id:"clientSetup",path:((ht=St.filePaths)==null?void 0:ht.clientSetup)||"auth-client.ts"}].find(no=>no.id===ds))==null?void 0:Et.path)||`${St.name}-${ds}.ts`,te=new Blob([R],{type:"text/plain"}),re=window.URL.createObjectURL(te),de=document.createElement("a");de.href=re;const xe=$.split("/").pop()||$;de.download=xe,document.body.appendChild(de),de.click(),document.body.removeChild(de),window.URL.revokeObjectURL(re)},className:"text-gray-400 hover:text-white rounded-none",children:[r.jsx(Dl,{className:"w-4 h-4 mr-1"}),"Download"]})]})]}),r.jsx("div",{className:"flex space-x-2 border-b border-dashed border-white/10",children:[{id:"server",label:"Server Plugin",path:((mE=St.filePaths)==null?void 0:mE.server)||`plugin/${St.name}/index.ts`},{id:"client",label:"Client Plugin",path:((gE=St.filePaths)==null?void 0:gE.client)||`plugin/${St.name}/client/index.ts`},{id:"serverSetup",label:"Server Setup",path:((bE=St.filePaths)==null?void 0:bE.serverSetup)||"auth.ts"},{id:"clientSetup",label:"Client Setup",path:((xE=St.filePaths)==null?void 0:xE.clientSetup)||"auth-client.ts"}].map(R=>r.jsx("button",{onClick:()=>hE(R.id),className:`px-3 py-2 text-xs uppercase font-mono border-b-2 transition-colors ${ds===R.id?"border-white text-white":"border-transparent text-gray-400 hover:text-white"}`,title:R.path,children:R.label},R.id))}),r.jsx("div",{className:"border border-dashed border-white/10",children:r.jsx(JU,{code:St[ds],language:"typescript",fileName:((SE=[{id:"server",path:((vE=St.filePaths)==null?void 0:vE.server)||`plugin/${St.name}/index.ts`},{id:"client",path:((yE=St.filePaths)==null?void 0:yE.client)||`plugin/${St.name}/client/index.ts`},{id:"serverSetup",path:((wE=St.filePaths)==null?void 0:wE.serverSetup)||"auth.ts"},{id:"clientSetup",path:((NE=St.filePaths)==null?void 0:NE.clientSetup)||"auth-client.ts"}].find(R=>R.id===ds))==null?void 0:SE.path)||`${St.name}-${ds}.ts`})})]})]})]})}),H&&P&&r.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 overflow-hidden",onClick:R=>{R.target===R.currentTarget&&(V(!1),G(null))},children:r.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",onClick:R=>R.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gp,{className:"w-5 h-5 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Configuration Validator"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{V(!1),G(null)},className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"mb-6 p-4 border border-dashed border-white/10",children:[r.jsx("div",{className:"text-xs uppercase font-mono text-gray-400 mb-3",children:"Summary"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"text-left border-r border-dashed border-white/10 pr-4 last:border-r-0",children:[r.jsx("div",{className:"text-2xl font-mono text-white",children:P.summary.total}),r.jsx("div",{className:"text-xs text-gray-400 uppercase mt-1 font-mono",children:"Total Checks"})]}),r.jsxs("div",{className:"text-left border-r border-dashed border-white/10 pr-4 last:border-r-0",children:[r.jsx("div",{className:"text-2xl font-mono text-white",children:P.summary.passes}),r.jsx("div",{className:"text-xs text-gray-400 uppercase mt-1 font-mono",children:"Passed"})]}),r.jsxs("div",{className:"text-left border-r border-dashed border-white/10 pr-4 last:border-r-0",children:[r.jsx("div",{className:"text-2xl font-mono text-white",children:P.summary.errors}),r.jsx("div",{className:"text-xs text-gray-400 uppercase mt-1 font-mono",children:"Errors"})]}),r.jsxs("div",{className:"text-left",children:[r.jsx("div",{className:"text-2xl font-mono text-white",children:P.summary.warnings}),r.jsx("div",{className:"text-xs text-gray-400 uppercase mt-1 font-mono",children:"Warnings"})]})]})]}),r.jsx("div",{className:"space-y-4",children:Object.entries(P.results.reduce((R,$)=>(R[$.category]||(R[$.category]=[]),R[$.category].push($),R),{})).map(([R,$])=>{if(R==="OAuth Providers"){const te=$.reduce((re,de)=>{const xe=de.check.match(/^(.+?)\s*-\s*(.+)$/);if(xe){const Ze=xe[1],Dt=xe[2];re[Ze]||(re[Ze]=[]),re[Ze].push({...de,check:Dt})}else re.General||(re.General=[]),re.General.push(de);return re},{});return r.jsxs("div",{className:"border border-dashed border-white/10 p-4",children:[r.jsxs("h4",{className:"text-white font-mono uppercase text-xs mb-4 text-left",children:[R,r.jsxs("span",{className:"text-gray-500 font-normal ml-2",children:["(",$.length," check",$.length!==1?"s":"",")"]})]}),r.jsx("div",{className:"space-y-2",children:Object.entries(te).map(([re,de])=>{const xe=K.has(re),Ze=de.some(ht=>ht.severity==="error"),Dt=de.some(ht=>ht.severity==="warning"),da=de.every(ht=>ht.status==="pass");return r.jsxs("div",{className:"border border-dashed border-white/10",children:[r.jsxs("button",{onClick:()=>{Z(ht=>{const Et=new Set(ht);return Et.has(re)?Et.delete(re):Et.add(re),Et})},className:"w-full flex items-center justify-between p-3 hover:bg-white/5 transition-colors text-left",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(od,{className:`w-4 h-4 text-white/60 transition-transform ${xe?"rotate-90":""}`}),r.jsx("span",{className:"text-white font-mono text-sm",children:re}),r.jsxs("span",{className:"text-xs text-gray-500 font-mono",children:["(",de.length," check",de.length!==1?"s":"",")"]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[Ze&&r.jsx("span",{className:"text-xs text-white/60 font-mono",children:"Error"}),Dt&&!Ze&&r.jsx("span",{className:"text-xs text-white/60 font-mono",children:"Warning"}),da&&!Ze&&!Dt&&r.jsx(Fh,{className:"w-4 h-4 text-white/60"})]})]}),xe&&r.jsx("div",{className:"border-t border-dashed border-white/10 space-y-2 p-2",children:de.map((ht,Et)=>r.jsx("div",{className:`p-3 border-l border-dashed border-white/15 ${ht.status==="pass"?"bg-green-600/[8%]":"bg-red-600/[8%]"}`,children:r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"mt-0.5",children:ht.severity==="error"?r.jsx(vs,{className:"w-4 h-4 text-white/60"}):ht.severity==="warning"?r.jsx(Ah,{className:"w-4 h-4 text-white/60"}):ht.status==="pass"?r.jsx(Fh,{className:"w-4 h-4 text-white/60"}):r.jsx(Ml,{className:"w-4 h-4 text-white/40"})}),r.jsxs("div",{className:"flex-1 text-left",children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[r.jsx("span",{className:"text-white font-mono text-sm",children:ht.check}),r.jsx("span",{className:"text-xs px-2 py-0.5 border border-dashed border-white/20 text-white/60 font-mono",children:ht.status.toUpperCase()})]}),r.jsx("p",{className:"text-gray-300 text-sm",children:ht.message}),ht.suggestion&&r.jsxs("div",{className:"mt-2 p-2 bg-black/40 border border-dashed border-white/10",children:[r.jsx("p",{className:"text-xs text-gray-400 uppercase mb-1 font-mono",children:"Suggestion"}),r.jsx("p",{className:"text-xs text-gray-300",children:ht.suggestion})]})]})]})},`${re}-${ht.check}-${Et}`))})]},re)})})]},R)}return r.jsxs("div",{className:"border border-dashed border-white/10 p-4",children:[r.jsxs("h4",{className:"text-white font-mono uppercase text-xs mb-4 text-left",children:[R,r.jsxs("span",{className:"text-gray-500 font-normal ml-2",children:["(",$.length," check",$.length!==1?"s":"",")"]})]}),r.jsx("div",{className:"space-y-3",children:$.map((te,re)=>r.jsx("div",{className:`p-3 border-l border-dashed border-white/15 ${te.status==="pass"?"bg-green-600/[8%]":"bg-red-600/[8%]"}`,children:r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"mt-0.5",children:te.severity==="error"?r.jsx(vs,{className:"w-4 h-4 text-white/60"}):te.severity==="warning"?r.jsx(Ah,{className:"w-4 h-4 text-white/60"}):te.status==="pass"?r.jsx(Fh,{className:"w-4 h-4 text-white/60"}):r.jsx(Ml,{className:"w-4 h-4 text-white/40"})}),r.jsxs("div",{className:"flex-1 text-left",children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[r.jsx("span",{className:"text-white font-mono text-sm",children:te.check}),r.jsx("span",{className:"text-xs px-2 py-0.5 border border-dashed border-white/20 text-white/60 font-mono",children:te.status.toUpperCase()})]}),r.jsx("p",{className:"text-gray-300 text-sm",children:te.message}),te.suggestion&&r.jsxs("div",{className:"mt-2 p-2 bg-black/40 border border-dashed border-white/10",children:[r.jsx("p",{className:"text-xs text-gray-400 uppercase mb-1 font-mono",children:"Suggestion"}),r.jsx("p",{className:"text-xs text-gray-300",children:te.suggestion})]})]})]})},`${te.category}-${te.check}-${re}`))})]},R)})}),r.jsx("div",{className:"mt-6 flex justify-end",children:r.jsx(z,{variant:"outline",onClick:()=>{V(!1),G(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),it&&r.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60] overflow-hidden",onClick:R=>{R.target===R.currentTarget&&et(!1)},children:r.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",onClick:R=>R.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Rh,{className:"w-5 h-5 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"UUID Generator"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>et(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Generate UUIDs"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Count (1-100)"}),r.jsx(ve,{type:"number",value:an,onChange:R=>{const $=R.target.value;if($===""){vn("");return}const te=parseInt($);isNaN(te)||vn($)},onBlur:R=>{const $=R.target.value,te=parseInt($);isNaN(te)||te<1?vn("1"):te>100?vn("100"):vn(String(te))},min:"1",max:"100",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{className:"flex items-end justify-end space-x-2",children:[r.jsx(z,{variant:"outline",onClick:()=>{vn("1"),Jt([])},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),r.jsx(z,{onClick:ZP,className:"rounded-none",children:"Generate UUIDs"})]})]})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Validate UUID"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx("div",{children:r.jsx(ve,{value:es,onChange:R=>{jn(R.target.value)},onBlur:QP,placeholder:"Paste UUID to validate",className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs rounded-none"})}),r.jsx("div",{className:"flex items-end justify-end space-x-2",children:r.jsx(z,{variant:"outline",onClick:()=>{jn(""),Ja(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"})})]}),Un&&r.jsx("div",{className:`mt-2 border border-dashed p-3 rounded-none ${Un.isValid?"border-white/10 bg-black/40":"border-red-500/30 bg-red-500/10"}`,children:r.jsxs("div",{className:"text-xs font-mono space-y-1",children:[r.jsx("div",{className:`${Un.isValid?"text-green-400":"text-red-300"}`,children:Un.isValid?"✓ Valid UUID":"✗ Invalid UUID"}),Un.isValid&&Un.version&&r.jsxs("div",{className:"text-gray-400",children:["Version: ",Un.version]}),Un.isValid&&Un.variant&&r.jsxs("div",{className:"text-gray-400",children:["Variant: ",Un.variant]})]})})]}),hn.length>0&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Generated UUIDs"}),r.jsxs(z,{variant:"ghost",size:"sm",onClick:()=>ca(hn.join(`
1097
+ }`)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Reset"}),r.jsx(z,{onClick:u6,disabled:Ge,className:"rounded-none",children:Ge?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):"Generate Token"})]}),W&&r.jsxs("div",{className:"space-y-4 border border-dashed border-white/15 p-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs uppercase font-mono text-gray-400",children:"Generated Token"}),r.jsx("p",{className:"text-white font-mono text-sm break-all mt-1",children:W.token})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ca(W.token),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(Xn,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-gray-400 uppercase tracking-wider",children:"Type"}),r.jsx("p",{className:"text-white mt-1 capitalize",children:W.type.replace("_"," ")})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-gray-400 uppercase tracking-wider",children:"Expires"}),r.jsx("p",{className:"text-white mt-1",children:BP(W.expiresAt)})]}),W.url&&r.jsxs("div",{className:"col-span-1",children:[r.jsx("p",{className:"text-gray-400 uppercase tracking-wider",children:"URL"}),r.jsx("p",{className:"text-white mt-1 break-all",children:W.url})]})]}),W.metadata&&r.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[r.jsx("p",{className:"text-xs uppercase font-mono text-gray-400 mb-2",children:"Metadata"}),r.jsx("pre",{className:"text-[11px] text-gray-100 font-mono bg-black/40 p-3 overflow-x-auto",children:JSON.stringify(W.metadata,null,2)})]})]})]})]})}),yn&&r.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60]",children:r.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-5xl max-h-[90vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(oi,{className:"w-5 h-5 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Plugin Generator"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>fn(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Plugin Name *"}),r.jsx(ve,{value:oa,onChange:R=>os(R.target.value),placeholder:"myPlugin",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),r.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Must be a valid JavaScript identifier"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Description (optional)"}),r.jsx(ve,{value:jr,onChange:R=>Ji(R.target.value),placeholder:"Plugin description",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Tables (optional)"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>Ma([...la,{name:"",fields:[{name:"",type:"string",required:!1,unique:!1}]}]),className:"text-xs uppercase font-mono text-gray-400 hover:text-white rounded-none",children:"+ Add Table"})]}),la.length===0?r.jsx("p",{className:"text-xs text-gray-500 font-mono",children:"No tables added"}):r.jsx("div",{className:"space-y-2",children:la.map((R,$)=>r.jsxs("div",{className:"border px-5 border-dashed border-white/15 p-3 relative",children:[r.jsxs("div",{className:"flex items-center space-x-2 relative",children:[r.jsx(ve,{value:R.name,onChange:te=>{const re=[...la];re[$].name=te.target.value,Ma(re)},placeholder:"Table name",className:"bg-black border border-dashed border-white/20 text-white text-xs rounded-none flex-1"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{Ma(la.filter((te,re)=>re!==$))},className:"text-red-400 hover:text-red-300 rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),R.fields.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"absolute border border-dashed w-px border-white/30",style:{left:"7px",top:"31px",bottom:"12px"}}),r.jsx("div",{className:"absolute border border-dashed h-px w-[11px] border-white/30",style:{left:"9px",top:"31px",bottom:"12px"}}),r.jsx("div",{className:"mt-3 relative",children:r.jsxs("div",{className:"space-y-0 pl-6",children:[R.fields.map((te,re)=>r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute border border-dashed h-px border-white/30 top-1/2 -translate-y-1/2",style:{left:"-36px",width:"36px"}}),r.jsxs("div",{className:"flex items-center space-x-2 py-1",children:[r.jsx(ve,{value:te.name,onChange:de=>{const xe=[...la];xe[$].fields[re].name=de.target.value,Ma(xe)},placeholder:"Field name",className:"bg-black border border-dashed border-white/20 text-white text-xs rounded-none flex-1"}),r.jsxs(kn,{value:te.type,onValueChange:de=>{const xe=[...la];xe[$].fields[re].type=de,Ma(xe)},children:[r.jsx(_n,{className:"sm:h-10 sm:w-56 border px-0 border-dashed border-white/20 text-white/90 text-xs rounded-none py-1",children:r.jsx(Ea,{className:"font-mono uppercase text-[10px] px-0 text-white/90"})}),r.jsxs(Rn,{className:"font-mono uppercase text-[10px]",children:[r.jsx(De,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"string",children:"string"}),r.jsx(De,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"number",children:"number"}),r.jsx(De,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"boolean",children:"boolean"}),r.jsx(De,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"date",children:"date"})]})]}),r.jsxs("div",{className:"h-8 flex items-end space-x-2",children:[r.jsx(gf,{id:`required-${$}-${re}`,checked:te.required,onCheckedChange:de=>{const xe=[...la];xe[$].fields[re].required=de===!0,Ma(xe)}}),r.jsx(oe,{htmlFor:`required-${$}-${re}`,className:"text-xs text-gray-400 font-mono uppercase cursor-pointer",children:"Required"})]}),r.jsxs("div",{className:"flex h-8 items-end space-x-2",children:[r.jsx(gf,{id:`unique-${$}-${re}`,checked:te.unique,onCheckedChange:de=>{const xe=[...la];xe[$].fields[re].unique=de===!0,Ma(xe)}}),r.jsx(oe,{htmlFor:`unique-${$}-${re}`,className:"text-xs text-gray-400 font-mono uppercase cursor-pointer",children:"Unique"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{const de=[...la];de[$].fields=de[$].fields.filter((xe,Ze)=>Ze!==re),Ma(de)},className:"text-red-400 hover:text-red-300 rounded-none",children:r.jsx(ct,{className:"w-3 h-3"})})]})]},re)),r.jsxs("div",{className:"relative pt-2",children:[r.jsx("div",{className:"absolute border border-dashed h-px border-white/30",style:{left:"-35px",width:"36px",top:"25px"}}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{const te=[...la];te[$].fields.push({name:"",type:"string",required:!1,unique:!1}),Ma(te)},className:"text-xs uppercase font-mono text-gray-400 hover:text-white rounded-none",children:"+ Add Field"})]})]})})]}),R.fields.length===0&&r.jsx("div",{className:"mt-3",children:r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{const te=[...la];te[$].fields.push({name:"",type:"string",required:!1,unique:!1}),Ma(te)},className:"text-xs text-gray-400 hover:text-white rounded-none",children:"+ Add Field"})})]},$))})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Rh,{className:"w-4 h-4 text-white"}),r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Hooks"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ar([...La,{name:"",timing:"before",action:"sign-up",hookLogic:"const context = ctx;",expanded:!0}]),className:"text-xs uppercase font-mono text-gray-400 hover:text-white rounded-none",children:"+ Add Hook"})]}),La.length===0?r.jsx("p",{className:"text-xs text-gray-500 font-mono",children:"No hooks added"}):r.jsx("div",{className:"space-y-2",children:La.map((R,$)=>{const te=`${R.timing} ${R.action==="custom"?"custom":R.action}: ${R.name||`Hook ${$+1}`}`;return r.jsxs("div",{className:"border border-dashed border-white/10",children:[r.jsxs("button",{onClick:()=>t6($),className:"w-full flex items-center justify-between p-3 hover:bg-white/5 transition-colors text-left",children:[r.jsx("span",{className:"text-xs font-mono text-white px-2 py-1 bg-black/40 border border-dashed border-white/20 rounded-none",children:te}),r.jsx(od,{className:`w-4 h-4 text-white/60 transition-transform ${R.expanded?"rotate-90":""}`})]}),R.expanded&&r.jsxs("div",{className:"border-t border-dashed border-white/10 p-4 space-y-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Hook Name"}),r.jsx(ve,{value:R.name,onChange:re=>{const de=[...La];de[$].name=re.target.value,ar(de)},placeholder:"e.g., Age Verification, TOS Check",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Timing"}),r.jsxs(FN,{value:R.timing,onValueChange:re=>{const de=[...La];de[$].timing=re,ar(de)},className:"flex space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vl,{value:"before",id:`hook-timing-before-${$}`}),r.jsx(oe,{htmlFor:`hook-timing-before-${$}`,className:"text-xs text-white font-mono cursor-pointer",children:"Before"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vl,{value:"after",id:`hook-timing-after-${$}`}),r.jsx(oe,{htmlFor:`hook-timing-after-${$}`,className:"text-xs text-white font-mono cursor-pointer",children:"After"})]})]})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Action"}),r.jsxs(FN,{value:R.action,onValueChange:re=>{const de=[...La];de[$].action=re,ar(de)},className:"flex space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vl,{value:"sign-up",id:`hook-action-signup-${$}`}),r.jsx(oe,{htmlFor:`hook-action-signup-${$}`,className:"text-xs text-white font-mono cursor-pointer",children:"Sign-up"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vl,{value:"sign-in",id:`hook-action-signin-${$}`}),r.jsx(oe,{htmlFor:`hook-action-signin-${$}`,className:"text-xs text-white font-mono cursor-pointer",children:"Sign-in"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vl,{value:"custom",id:`hook-action-custom-${$}`}),r.jsx(oe,{htmlFor:`hook-action-custom-${$}`,className:"text-xs text-white font-mono cursor-pointer",children:"Custom"})]})]})]})]}),R.action==="custom"&&r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Custom Path"}),r.jsx(ve,{value:R.customPath||"",onChange:re=>{const de=[...La];de[$].customPath=re.target.value,ar(de)},placeholder:"/my-plugin/custom-endpoint",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Custom Matcher (optional)"}),r.jsx(ve,{value:R.customMatcher||"",onChange:re=>{const de=[...La];de[$].customMatcher=re.target.value,ar(de)},placeholder:"e.g., context.headers.get('x-custom') === 'value'",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),r.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Leave empty to use default path matching"})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[r.jsx(oi,{className:"w-4 h-4 text-white"}),r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Hook Logic (TypeScript)"})]}),r.jsx("p",{className:"text-xs text-gray-400 mb-2 font-mono",children:"This is the TypeScript code that will be executed when the hook is triggered. This function has properties like ctx so you can access the request context, headers, body, etc. Here is a simple example of a hook logic:"}),r.jsx("textarea",{value:R.hookLogic,onChange:re=>{const de=[...La];de[$].hookLogic=re.target.value,ar(de)},className:"w-full min-h-[200px] bg-black border border-dashed border-white/20 text-white font-mono text-xs p-3 rounded-none focus:outline-none focus:border-white/40",placeholder:"const context = ctx;"})]}),r.jsxs(z,{variant:"outline",onClick:()=>{ar(La.filter((re,de)=>de!==$))},className:"w-full border border-dashed border-red-500/50 text-red-400 hover:bg-red-500/10 rounded-none",children:[r.jsx(ct,{className:"w-4 h-4 mr-2"}),"Remove Hook"]})]})]},$)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(An,{className:"w-4 h-4 text-white"}),r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Middleware"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ls([...Cr,{name:"",path:"/my-plugin/protected",pathType:"exact",middlewareLogic:"const context = ctx;",expanded:!0}]),className:"text-xs uppercase font-mono text-gray-400 hover:text-white rounded-none",children:"+ Add Middleware"})]}),Cr.length===0?r.jsx("p",{className:"text-xs text-gray-500 font-mono",children:"No middleware added"}):r.jsx("div",{className:"space-y-2",children:Cr.map((R,$)=>{const te=`${R.path}: ${R.name||`Middleware ${$+1}`}`;return r.jsxs("div",{className:"border border-dashed border-white/10",children:[r.jsxs("button",{onClick:()=>n6($),className:"w-full flex items-center justify-between p-3 hover:bg-white/5 transition-colors text-left",children:[r.jsx("span",{className:"text-xs font-mono text-white px-2 py-1 bg-black/40 border border-dashed border-white/20 rounded-none",children:te}),r.jsx(od,{className:`w-4 h-4 text-white/60 transition-transform ${R.expanded?"rotate-90":""}`})]}),R.expanded&&r.jsxs("div",{className:"border-t border-dashed border-white/10 p-4 space-y-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Middleware Name"}),r.jsx(ve,{value:R.name,onChange:re=>{const de=[...Cr];de[$].name=re.target.value,ls(de)},placeholder:"e.g., Auth Check, Rate Limiter",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path"}),r.jsx(ve,{value:R.path,onChange:re=>{const de=[...Cr];de[$].path=re.target.value,ls(de)},placeholder:"/my-plugin/protected",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path Type"}),r.jsxs(kn,{value:R.pathType,onValueChange:re=>{const de=[...Cr];de[$].pathType=re,ls(de)},children:[r.jsx(_n,{className:"bg-black border border-dashed border-white/20 text-white rounded-none",children:r.jsx(Ea,{})}),r.jsxs(Rn,{children:[r.jsx(De,{value:"exact",children:"Exact Match"}),r.jsx(De,{value:"prefix",children:"Prefix Match"}),r.jsx(De,{value:"regex",children:"Regex Match"})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[r.jsx(oi,{className:"w-4 h-4 text-white"}),r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Middleware Logic (TypeScript)"})]}),r.jsx("p",{className:"text-xs text-gray-400 mb-2 font-mono",children:"This is the TypeScript code that will be executed when the middleware is triggered. You can access the request context, headers, body, etc."}),r.jsx("textarea",{value:R.middlewareLogic,onChange:re=>{const de=[...Cr];de[$].middlewareLogic=re.target.value,ls(de)},className:"w-full min-h-[200px] bg-black border border-dashed border-white/20 text-white font-mono text-xs p-3 rounded-none focus:outline-none focus:border-white/40",placeholder:"const context = ctx;"})]}),r.jsxs(z,{variant:"outline",onClick:()=>{ls(Cr.filter((re,de)=>de!==$))},className:"w-full border border-dashed border-red-500/50 text-red-400 hover:bg-red-500/10 rounded-none",children:[r.jsx(ct,{className:"w-4 h-4 mr-2"}),"Remove Middleware"]})]})]},$)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Xl,{className:"w-4 h-4 text-white"}),r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Endpoints"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{const R="/my-plugin/endpoint",$=Am(R);eo([...cs,{name:$,path:R,method:"POST",handlerLogic:`// Endpoint handler logic here
1098
+ return ctx.json({ success: true });`,expanded:!0}])},className:"text-xs uppercase font-mono text-gray-400 hover:text-white rounded-none",children:"+ Add Endpoint"})]}),cs.length===0?r.jsx("p",{className:"text-xs text-gray-500 font-mono",children:"No endpoints added"}):r.jsx("div",{className:"space-y-2",children:cs.map((R,$)=>{const te=`${R.method} ${R.path}: ${R.name||Am(R.path)||`Endpoint ${$+1}`}`;return r.jsxs("div",{className:"border border-dashed border-white/10",children:[r.jsxs("button",{onClick:()=>a6($),className:"w-full flex items-center justify-between p-3 hover:bg-white/5 transition-colors text-left",children:[r.jsx("span",{className:"text-xs font-mono text-white px-2 py-1 bg-black/40 border border-dashed border-white/20 rounded-none",children:te}),r.jsx(od,{className:`w-4 h-4 text-white/60 transition-transform ${R.expanded?"rotate-90":""}`})]}),R.expanded&&r.jsxs("div",{className:"border-t border-dashed border-white/10 p-4 space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path"}),r.jsx(ve,{value:R.path,onChange:re=>{const de=re.target.value,xe=Am(de),Ze=[...cs];Ze[$].path=de,Ze[$].name=xe,eo(Ze)},placeholder:"/sign-in/anonymous",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Endpoint Name (Auto-generated)"}),r.jsx(ve,{value:R.name,readOnly:!0,className:"bg-black/50 border border-dashed border-white/10 text-white/70 rounded-none cursor-not-allowed"}),r.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Generated from path"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Method"}),r.jsxs(kn,{value:R.method,onValueChange:re=>{const de=[...cs];de[$].method=re,eo(de)},children:[r.jsx(_n,{className:"bg-black border border-dashed border-white/20 text-white rounded-none",children:r.jsx(Ea,{})}),r.jsxs(Rn,{children:[r.jsx(De,{value:"GET",children:"GET"}),r.jsx(De,{value:"POST",children:"POST"})]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[r.jsx(oi,{className:"w-4 h-4 text-white"}),r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Handler Logic (TypeScript)"})]}),r.jsx("p",{className:"text-xs text-gray-400 mb-2 font-mono",children:"This is the TypeScript code that will be executed when the endpoint is called. You can access the context via ctx parameter."}),r.jsx("textarea",{value:R.handlerLogic,onChange:re=>{const de=[...cs];de[$].handlerLogic=re.target.value,eo(de)},className:"w-full min-h-[200px] bg-black border border-dashed border-white/20 text-white font-mono text-xs p-3 rounded-none focus:outline-none focus:border-white/40",placeholder:"// Endpoint handler logic here\\nreturn ctx.json({ success: true });"})]}),r.jsxs(z,{variant:"outline",onClick:()=>{eo(cs.filter((re,de)=>de!==$))},className:"w-full border border-dashed border-red-500/50 text-red-400 hover:bg-red-500/10 rounded-none",children:[r.jsx(ct,{className:"w-4 h-4 mr-2"}),"Remove Endpoint"]})]})]},$)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-3",children:[r.jsx(gf,{id:"rate-limit",checked:Sm,onCheckedChange:R=>Em(R===!0)}),r.jsx(oe,{htmlFor:"rate-limit",className:"text-xs uppercase font-mono text-gray-400 cursor-pointer",children:"Enable Rate Limiting"})]}),Sm&&r.jsxs("div",{className:"border border-dashed border-white/10 p-4 space-y-4 mt-3",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path"}),r.jsx(ve,{value:Yn.path,onChange:R=>{Ks({...Yn,path:R.target.value})},placeholder:"/my-plugin/*",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path Type"}),r.jsxs(kn,{value:Yn.pathType,onValueChange:R=>{Ks({...Yn,pathType:R})},children:[r.jsx(_n,{className:"bg-black border border-dashed border-white/20 text-white rounded-none",children:r.jsx(Ea,{})}),r.jsxs(Rn,{children:[r.jsx(De,{value:"exact",children:"Exact Match"}),r.jsx(De,{value:"prefix",children:"Prefix Match"}),r.jsx(De,{value:"regex",children:"Regex Match"})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Window (ms)"}),r.jsx(ve,{type:"number",value:Yn.window||"",onChange:R=>{const $=R.target.value;Ks({...Yn,window:$===""?0:parseInt($,10)||0})},onBlur:R=>{(!R.target.value||parseInt(R.target.value,10)<=0)&&Ks({...Yn,window:15*60*1e3})},placeholder:"900000",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),r.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Time window in milliseconds (e.g., 900000 = 15 minutes)"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Max Requests"}),r.jsx(ve,{type:"number",value:Yn.max||"",onChange:R=>{const $=R.target.value;Ks({...Yn,max:$===""?0:parseInt($,10)||0})},onBlur:R=>{(!R.target.value||parseInt(R.target.value,10)<=0)&&Ks({...Yn,max:100})},placeholder:"100",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),r.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Maximum requests per window"})]})]})]})]}),r.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[r.jsx(z,{variant:"outline",onClick:()=>{os(""),Ji(""),Tm("react"),Ma([]),ar([]),ls([]),eo([]),Em(!1),Ks({path:"/my-plugin/*",pathType:"prefix",window:15*60*1e3,max:100}),Pc(null),Fc(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Reset"}),r.jsx(z,{onClick:s6,disabled:cE||!oa.trim(),className:"rounded-none",children:cE?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):"Generate Plugin"})]}),uE&&r.jsx("div",{className:"border border-dashed border-red-500/30 bg-red-500/10 text-red-300 text-xs font-mono p-3 rounded-none",children:uE}),St&&r.jsxs("div",{ref:lE,className:"space-y-4 border border-dashed border-white/15 p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("p",{className:"text-xs uppercase font-mono text-gray-400",children:"Generated Code"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[ds==="clientSetup"&&r.jsxs("div",{className:"flex items-center space-x-2 mr-2",children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 whitespace-nowrap",children:"Framework:"}),r.jsxs(kn,{value:fE,onValueChange:R=>{Tm(R),r6(R)},children:[r.jsx(_n,{className:"bg-black sm:w-56 border border-dashed border-white/20 text-white rounded-none w-[220px] h-10 text-xs font-mono uppercase px-4 py-2",children:r.jsx(Ea,{className:"font-mono uppercase text-xs text-white"})}),r.jsxs(Rn,{className:"font-mono uppercase text-[10px] bg-black border border-dashed border-white/20",children:[r.jsx(De,{value:"react",className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",children:" React"}),r.jsx(De,{value:"svelte",className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",children:" Svelte"}),r.jsx(De,{value:"solid",className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",children:" Solid"}),r.jsx(De,{value:"vue",className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",children:" Vue"})]})]})]}),r.jsxs(z,{variant:"ghost",size:"sm",onClick:()=>{const R=St[ds];ca(R)},className:"text-gray-400 hover:text-white rounded-none",children:[r.jsx(Xn,{className:"w-4 h-4 mr-1"}),"Copy"]}),r.jsxs(z,{variant:"ghost",size:"sm",onClick:()=>{var Ze,Dt,da,ht,Et;const R=St[ds],$=((Et=[{id:"server",path:((Ze=St.filePaths)==null?void 0:Ze.server)||`plugin/${St.name}/index.ts`},{id:"client",path:((Dt=St.filePaths)==null?void 0:Dt.client)||`plugin/${St.name}/client/index.ts`},{id:"serverSetup",path:((da=St.filePaths)==null?void 0:da.serverSetup)||"auth.ts"},{id:"clientSetup",path:((ht=St.filePaths)==null?void 0:ht.clientSetup)||"auth-client.ts"}].find(no=>no.id===ds))==null?void 0:Et.path)||`${St.name}-${ds}.ts`,te=new Blob([R],{type:"text/plain"}),re=window.URL.createObjectURL(te),de=document.createElement("a");de.href=re;const xe=$.split("/").pop()||$;de.download=xe,document.body.appendChild(de),de.click(),document.body.removeChild(de),window.URL.revokeObjectURL(re)},className:"text-gray-400 hover:text-white rounded-none",children:[r.jsx(Dl,{className:"w-4 h-4 mr-1"}),"Download"]})]})]}),r.jsx("div",{className:"flex space-x-2 border-b border-dashed border-white/10",children:[{id:"server",label:"Server Plugin",path:((mE=St.filePaths)==null?void 0:mE.server)||`plugin/${St.name}/index.ts`},{id:"client",label:"Client Plugin",path:((gE=St.filePaths)==null?void 0:gE.client)||`plugin/${St.name}/client/index.ts`},{id:"serverSetup",label:"Server Setup",path:((bE=St.filePaths)==null?void 0:bE.serverSetup)||"auth.ts"},{id:"clientSetup",label:"Client Setup",path:((xE=St.filePaths)==null?void 0:xE.clientSetup)||"auth-client.ts"}].map(R=>r.jsx("button",{onClick:()=>hE(R.id),className:`px-3 py-2 text-xs uppercase font-mono border-b-2 transition-colors ${ds===R.id?"border-white text-white":"border-transparent text-gray-400 hover:text-white"}`,title:R.path,children:R.label},R.id))}),r.jsx("div",{className:"border border-dashed border-white/10",children:r.jsx(JU,{code:St[ds],language:"typescript",fileName:((SE=[{id:"server",path:((vE=St.filePaths)==null?void 0:vE.server)||`plugin/${St.name}/index.ts`},{id:"client",path:((yE=St.filePaths)==null?void 0:yE.client)||`plugin/${St.name}/client/index.ts`},{id:"serverSetup",path:((wE=St.filePaths)==null?void 0:wE.serverSetup)||"auth.ts"},{id:"clientSetup",path:((NE=St.filePaths)==null?void 0:NE.clientSetup)||"auth-client.ts"}].find(R=>R.id===ds))==null?void 0:SE.path)||`${St.name}-${ds}.ts`})})]})]})]})}),H&&P&&r.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 overflow-hidden",onClick:R=>{R.target===R.currentTarget&&(V(!1),G(null))},children:r.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",onClick:R=>R.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gp,{className:"w-5 h-5 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Configuration Validator"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{V(!1),G(null)},className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"mb-6 p-4 border border-dashed border-white/10",children:[r.jsx("div",{className:"text-xs uppercase font-mono text-gray-400 mb-3",children:"Summary"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"text-left border-r border-dashed border-white/10 pr-4 last:border-r-0",children:[r.jsx("div",{className:"text-2xl font-mono text-white",children:P.summary.total}),r.jsx("div",{className:"text-xs text-gray-400 uppercase mt-1 font-mono",children:"Total Checks"})]}),r.jsxs("div",{className:"text-left border-r border-dashed border-white/10 pr-4 last:border-r-0",children:[r.jsx("div",{className:"text-2xl font-mono text-white",children:P.summary.passes}),r.jsx("div",{className:"text-xs text-gray-400 uppercase mt-1 font-mono",children:"Passed"})]}),r.jsxs("div",{className:"text-left border-r border-dashed border-white/10 pr-4 last:border-r-0",children:[r.jsx("div",{className:"text-2xl font-mono text-white",children:P.summary.errors}),r.jsx("div",{className:"text-xs text-gray-400 uppercase mt-1 font-mono",children:"Errors"})]}),r.jsxs("div",{className:"text-left",children:[r.jsx("div",{className:"text-2xl font-mono text-white",children:P.summary.warnings}),r.jsx("div",{className:"text-xs text-gray-400 uppercase mt-1 font-mono",children:"Warnings"})]})]})]}),r.jsx("div",{className:"space-y-4",children:Object.entries(P.results.reduce((R,$)=>(R[$.category]||(R[$.category]=[]),R[$.category].push($),R),{})).map(([R,$])=>{if(R==="OAuth Providers"){const te=$.reduce((re,de)=>{const xe=de.check.match(/^(.+?)\s*-\s*(.+)$/);if(xe){const Ze=xe[1],Dt=xe[2];re[Ze]||(re[Ze]=[]),re[Ze].push({...de,check:Dt})}else re.General||(re.General=[]),re.General.push(de);return re},{});return r.jsxs("div",{className:"border border-dashed border-white/10 p-4",children:[r.jsxs("h4",{className:"text-white font-mono uppercase text-xs mb-4 text-left",children:[R,r.jsxs("span",{className:"text-gray-500 font-normal ml-2",children:["(",$.length," check",$.length!==1?"s":"",")"]})]}),r.jsx("div",{className:"space-y-2",children:Object.entries(te).map(([re,de])=>{const xe=K.has(re),Ze=de.some(ht=>ht.severity==="error"),Dt=de.some(ht=>ht.severity==="warning"),da=de.every(ht=>ht.status==="pass");return r.jsxs("div",{className:"border border-dashed border-white/10",children:[r.jsxs("button",{onClick:()=>{Z(ht=>{const Et=new Set(ht);return Et.has(re)?Et.delete(re):Et.add(re),Et})},className:"w-full flex items-center justify-between p-3 hover:bg-white/5 transition-colors text-left",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(od,{className:`w-4 h-4 text-white/60 transition-transform ${xe?"rotate-90":""}`}),r.jsx("span",{className:"text-white font-mono text-sm",children:re}),r.jsxs("span",{className:"text-xs text-gray-500 font-mono",children:["(",de.length," check",de.length!==1?"s":"",")"]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[Ze&&r.jsx("span",{className:"text-xs text-white/60 font-mono",children:"Error"}),Dt&&!Ze&&r.jsx("span",{className:"text-xs text-white/60 font-mono",children:"Warning"}),da&&!Ze&&!Dt&&r.jsx(Fh,{className:"w-4 h-4 text-white/60"})]})]}),xe&&r.jsx("div",{className:"border-t border-dashed border-white/10 space-y-2 p-2",children:de.map((ht,Et)=>r.jsx("div",{className:`p-3 border-l border-dashed border-white/15 ${ht.status==="pass"?"bg-green-600/[8%]":"bg-red-600/[8%]"}`,children:r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"mt-0.5",children:ht.severity==="error"?r.jsx(vs,{className:"w-4 h-4 text-white/60"}):ht.severity==="warning"?r.jsx(Ah,{className:"w-4 h-4 text-white/60"}):ht.status==="pass"?r.jsx(Fh,{className:"w-4 h-4 text-white/60"}):r.jsx(Ml,{className:"w-4 h-4 text-white/40"})}),r.jsxs("div",{className:"flex-1 text-left",children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[r.jsx("span",{className:"text-white font-mono text-sm",children:ht.check}),r.jsx("span",{className:"text-xs px-2 py-0.5 border border-dashed border-white/20 text-white/60 font-mono",children:ht.status.toUpperCase()})]}),r.jsx("p",{className:"text-gray-300 text-sm",children:ht.message}),ht.suggestion&&r.jsxs("div",{className:"mt-2 p-2 bg-black/40 border border-dashed border-white/10",children:[r.jsx("p",{className:"text-xs text-gray-400 uppercase mb-1 font-mono",children:"Suggestion"}),r.jsx("p",{className:"text-xs text-gray-300",children:ht.suggestion})]})]})]})},`${re}-${ht.check}-${Et}`))})]},re)})})]},R)}return r.jsxs("div",{className:"border border-dashed border-white/10 p-4",children:[r.jsxs("h4",{className:"text-white font-mono uppercase text-xs mb-4 text-left",children:[R,r.jsxs("span",{className:"text-gray-500 font-normal ml-2",children:["(",$.length," check",$.length!==1?"s":"",")"]})]}),r.jsx("div",{className:"space-y-3",children:$.map((te,re)=>r.jsx("div",{className:`p-3 border-l border-dashed border-white/15 ${te.status==="pass"?"bg-green-600/[8%]":"bg-red-600/[8%]"}`,children:r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"mt-0.5",children:te.severity==="error"?r.jsx(vs,{className:"w-4 h-4 text-white/60"}):te.severity==="warning"?r.jsx(Ah,{className:"w-4 h-4 text-white/60"}):te.status==="pass"?r.jsx(Fh,{className:"w-4 h-4 text-white/60"}):r.jsx(Ml,{className:"w-4 h-4 text-white/40"})}),r.jsxs("div",{className:"flex-1 text-left",children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[r.jsx("span",{className:"text-white font-mono text-sm",children:te.check}),r.jsx("span",{className:"text-xs px-2 py-0.5 border border-dashed border-white/20 text-white/60 font-mono",children:te.status.toUpperCase()})]}),r.jsx("p",{className:"text-gray-300 text-sm",children:te.message}),te.suggestion&&r.jsxs("div",{className:"mt-2 p-2 bg-black/40 border border-dashed border-white/10",children:[r.jsx("p",{className:"text-xs text-gray-400 uppercase mb-1 font-mono",children:"Suggestion"}),r.jsx("p",{className:"text-xs text-gray-300",children:te.suggestion})]})]})]})},`${te.category}-${te.check}-${re}`))})]},R)})}),r.jsx("div",{className:"mt-6 flex justify-end",children:r.jsx(z,{variant:"outline",onClick:()=>{V(!1),G(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),it&&r.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60] overflow-hidden",onClick:R=>{R.target===R.currentTarget&&et(!1)},children:r.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",onClick:R=>R.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Rh,{className:"w-5 h-5 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"UUID Generator"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>et(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Generate UUIDs"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Count (1-100)"}),r.jsx(ve,{type:"number",value:an,onChange:R=>{const $=R.target.value;if($===""){vn("");return}const te=parseInt($);isNaN(te)||vn($)},onBlur:R=>{const $=R.target.value,te=parseInt($);isNaN(te)||te<1?vn("1"):te>100?vn("100"):vn(String(te))},min:"1",max:"100",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{className:"flex items-end justify-end space-x-2",children:[r.jsx(z,{variant:"outline",onClick:()=>{vn("1"),Jt([])},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),r.jsx(z,{onClick:ZP,className:"rounded-none",children:"Generate UUIDs"})]})]})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Validate UUID"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx("div",{children:r.jsx(ve,{value:es,onChange:R=>{jn(R.target.value)},onBlur:QP,placeholder:"Paste UUID to validate",className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs rounded-none"})}),r.jsx("div",{className:"flex items-end justify-end space-x-2",children:r.jsx(z,{variant:"outline",onClick:()=>{jn(""),Ja(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"})})]}),Un&&r.jsx("div",{className:`mt-2 border border-dashed p-3 rounded-none ${Un.isValid?"border-white/10 bg-black/40":"border-red-500/30 bg-red-500/10"}`,children:r.jsxs("div",{className:"text-xs font-mono space-y-1",children:[r.jsx("div",{className:`${Un.isValid?"text-green-400":"text-red-300"}`,children:Un.isValid?"✓ Valid UUID":"✗ Invalid UUID"}),Un.isValid&&Un.version&&r.jsxs("div",{className:"text-gray-400",children:["Version: ",Un.version]}),Un.isValid&&Un.variant&&r.jsxs("div",{className:"text-gray-400",children:["Variant: ",Un.variant]})]})})]}),hn.length>0&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400",children:"Generated UUIDs"}),r.jsxs(z,{variant:"ghost",size:"sm",onClick:()=>ca(hn.join(`
1099
1099
  `)),className:"text-gray-400 hover:text-white rounded-none",children:[r.jsx(Xn,{className:"w-4 h-4 mr-1"}),"Copy All"]})]}),r.jsx("div",{className:"border border-dashed border-white/10 p-3",children:r.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:hn.map((R,$)=>r.jsxs("div",{className:"flex items-center justify-between p-2 bg-black/40 border border-dashed border-white/10",children:[r.jsx("span",{className:"text-white font-mono text-xs break-all",children:R}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ca(R),className:"text-gray-400 hover:text-white rounded-none ml-2",children:r.jsx(Xn,{className:"w-3 h-3"})})]},$))})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[r.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[r.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Version"}),r.jsx("p",{className:"text-white text-sm",children:"v4 (Random)"}),r.jsx("p",{className:"text-gray-500 text-xs",children:"Cryptographically random"})]}),r.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[r.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Format"}),r.jsx("p",{className:"text-white text-sm",children:"8-4-4-4-12"}),r.jsx("p",{className:"text-gray-500 text-xs",children:"36 characters"})]}),r.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[r.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Standard"}),r.jsx("p",{className:"text-white text-sm",children:"RFC 4122"}),r.jsx("p",{className:"text-gray-500 text-xs",children:"Universally unique"})]})]})]})]})}),ts&&r.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60] overflow-hidden",children:r.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Yl,{className:"w-5 h-5 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Password Strength Checker"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>Qo(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(ve,{type:wr?"text":"password",value:Hs,onChange:R=>er(R.target.value),placeholder:"Enter password to check",className:"w-full bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-10 rounded-none"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ss(!wr),className:"absolute right-0 top-0 h-full px-3 text-gray-400 hover:text-white rounded-none",children:wr?r.jsx(cf,{className:"w-4 h-4"}):r.jsx(Ii,{className:"w-4 h-4"})})]})]}),r.jsxs("div",{className:"flex items-end justify-end space-x-2",children:[r.jsx(z,{variant:"outline",onClick:()=>{er(""),ns(null),ss(!1)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),r.jsx(z,{onClick:GP,disabled:as||!Hs.trim(),className:"rounded-none",children:as?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Checking..."]}):"Check Strength"})]}),It&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[r.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[r.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Strength"}),r.jsx("p",{className:`text-sm font-medium ${It.strength==="very-strong"?"text-green-400":It.strength==="strong"?"text-green-300":It.strength==="good"?"text-yellow-300":It.strength==="fair"?"text-orange-300":"text-red-300"}`,children:It.strength.split("-").map(R=>R.charAt(0).toUpperCase()+R.slice(1)).join(" ")}),r.jsx("div",{className:"w-full bg-black/40 h-2 rounded-none",children:r.jsx("div",{className:`h-full transition-all ${It.strength==="very-strong"?"bg-green-400 w-full":It.strength==="strong"?"bg-green-300 w-4/5":It.strength==="good"?"bg-yellow-300 w-3/5":It.strength==="fair"?"bg-orange-300 w-2/5":"bg-red-300 w-1/5"}`})})]}),r.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[r.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Score"}),r.jsxs("p",{className:"text-white text-sm",children:[It.score," / 5"]}),r.jsx("p",{className:"text-gray-500 text-xs",children:It.score===5?"Excellent":It.score===4?"Very Good":It.score===3?"Good":It.score===2?"Fair":"Weak"})]}),r.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[r.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Config Match"}),r.jsx("p",{className:`text-sm ${It.meetsConfig?"text-green-400":"text-red-300"}`,children:It.meetsConfig?"✓ Meets Requirements":"✗ Fails Requirements"}),r.jsxs("p",{className:"text-gray-500 text-xs",children:[It.configRequirements.minLength," -"," ",It.configRequirements.maxLength," chars"]})]})]}),r.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[r.jsx("div",{className:"text-xs uppercase font-mono text-gray-400 mb-3",children:"Checks"}),r.jsx("div",{className:"space-y-2",children:It.checks.map((R,$)=>r.jsxs("div",{className:"flex items-center justify-between p-2 bg-black/40 border border-dashed border-white/10",children:[r.jsx("span",{className:"text-white font-mono text-xs",children:R.name}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:`text-xs font-mono ${R.passed?"text-green-400":"text-red-300"}`,children:R.passed?"✓":"✗"}),r.jsx("span",{className:"text-xs text-gray-400 font-mono",children:R.message})]})]},$))})]})]})]})]})}),Nr&&r.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60] overflow-hidden",children:r.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(ea,{className:"w-5 h-5 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"OAuth Credentials"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>tr(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Select Provider"}),r.jsx("div",{className:"flex flex-wrap gap-3",children:["google","github"].map(R=>{const $=f===R;return r.jsx("button",{onClick:()=>m(R),className:`px-4 py-2 border rounded-none text-sm uppercase font-mono transition-colors ${$?"border-white/60 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/40"}`,children:R.charAt(0).toUpperCase()+R.slice(1)},R)})})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Origin"}),r.jsx(ve,{value:Gn,onChange:R=>Vn(R.target.value),placeholder:`http://${Ia}`,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs rounded-none"}),r.jsxs("p",{className:"text-[11px] text-gray-500 font-mono mt-1",children:["The default will be http://",Ia]})]}),r.jsxs("div",{className:"flex items-end justify-end space-x-2",children:[r.jsx(z,{variant:"outline",onClick:()=>{ia(null),Vn(Ia)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),r.jsx(z,{onClick:XP,disabled:nr||!f||!Gn.trim()&&!Ia,className:"rounded-none",children:nr?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Fetching..."]}):"Fetch Credentials"})]}),sa&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Client ID"}),r.jsxs("div",{className:"relative",children:[r.jsx(ve,{value:sa.clientId,readOnly:!0,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-10 rounded-none"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ca(sa.clientId),className:"absolute right-0 top-0 h-full px-3 text-gray-400 hover:text-white rounded-none",children:r.jsx(Xn,{className:"w-4 h-4"})})]})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Client Secret"}),r.jsxs("div",{className:"relative",children:[r.jsx(ve,{type:Vs?"text":"password",value:sa.clientSecret,readOnly:!0,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-20 rounded-none"}),r.jsxs("div",{className:"absolute right-0 top-0 h-full flex items-center",children:[r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>Jo(!Vs),className:"px-2 text-gray-400 hover:text-white rounded-none",children:Vs?r.jsx(cf,{className:"w-4 h-4"}):r.jsx(Ii,{className:"w-4 h-4"})}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ca(sa.clientSecret),className:"px-2 text-gray-400 hover:text-white rounded-none",children:r.jsx(Xn,{className:"w-4 h-4"})})]})]})]})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-dashed border-white/10",children:[r.jsx("div",{className:"flex-1",children:ft&&r.jsx("div",{className:"text-xs font-mono",children:ft.success?r.jsxs("span",{className:"text-green-400 uppercase",children:["✓ ",ft.message.toLowerCase(),r.jsxs("span",{className:"block normal-case text-gray-400",children:[r.jsx("span",{className:"text-gray-400 mr-1",children:">"})," ",ft.path]})]}):r.jsxs("span",{className:"text-red-300",children:["✗ ",ft.message]})})}),r.jsx(z,{onClick:KP,disabled:Ys||el,className:"rounded-none",children:el?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Checking..."]}):Ys?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Writing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Rh,{className:"w-4 h-4 mr-2"}),"Write to .env"]})})]})]})]})]})}),Xs&&r.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60] overflow-hidden",children:r.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(bo,{className:"w-5 h-5 text-white"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Secret Generator"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>Se(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Length (bytes)"}),r.jsx(ve,{type:"number",value:Pe,onChange:R=>{const $=parseInt(R.target.value,10);$>=16&&$<=128&&Ie($)},min:"16",max:"128",className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs rounded-none"}),r.jsx("p",{className:"text-[11px] text-gray-500 font-mono mt-1",children:"Recommended: 32 bytes (256 bits)"})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Format"}),r.jsx("div",{className:"flex gap-3",children:[{id:"hex",label:"Hex"},{id:"base64",label:"Base64"}].map(R=>r.jsx("button",{onClick:()=>rt(R.id),className:`px-4 py-2 border rounded-none text-sm uppercase font-mono transition-colors flex-1 ${Ae===R.id?"border-white/60 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/40"}`,children:R.label},R.id))})]})]}),r.jsxs("div",{className:"flex justify-end space-x-2",children:[r.jsx(z,{variant:"outline",onClick:()=>{Ce(null),Ie(32),rt("hex")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),r.jsx(z,{onClick:YP,disabled:fe,className:"rounded-none",children:fe?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):"Generate Secret"})]}),Ee&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[r.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[r.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Length"}),r.jsxs("p",{className:"text-white text-sm",children:[Ee.length," bytes"]})]}),r.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[r.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Entropy"}),r.jsxs("p",{className:"text-white text-sm",children:[Ee.entropy," bits"]})]}),r.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[r.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Format"}),r.jsx("p",{className:"text-white text-sm uppercase",children:Ee.format})]})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Generated Secret"}),r.jsxs("div",{className:"relative",children:[r.jsx(ve,{value:Ee.secret,readOnly:!0,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-10 rounded-none"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ca(Ee.secret),className:"absolute right-0 top-0 h-full px-3 text-gray-400 hover:text-white rounded-none",children:r.jsx(Xn,{className:"w-3 h-3"})})]})]}),r.jsxs("div",{children:[r.jsx(oe,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Environment Variable Format"}),r.jsxs("div",{className:"relative",children:[r.jsx(ve,{value:Ee.envFormat,readOnly:!0,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-10 rounded-none"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ca(Ee.envFormat),className:"absolute right-0 top-0 h-full px-3 text-gray-400 hover:text-white rounded-none",children:r.jsx(Xn,{className:"w-3 h-3"})})]}),r.jsxs("p",{className:"text-[11px] text-gray-500 font-mono mt-2",children:["Add this to your ",r.jsx("code",{className:"text-gray-400",children:".env"})," file. Keep it secret and never commit it to version control."]})]}),r.jsx("div",{className:"border border-dashed border-white/20 bg-black text-gray-300 text-xs font-mono p-3 rounded-none",children:r.jsxs("div",{className:"flex items-start space-x-2",children:[r.jsx(Ah,{className:"w-4 h-4 mt-0.5 flex-shrink-0 text-gray-400"}),r.jsxs("div",{children:[r.jsx("div",{className:"uppercase font-mono mb-2 text-gray-400 tracking-wider",children:"Security Best Practices"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-[11px] text-gray-300",children:[r.jsx("li",{children:"Use a minimum of 32 bytes (256 bits) for production"}),r.jsx("li",{children:"Store secrets in environment variables, never in code"}),r.jsx("li",{children:"Use different secrets for development and production"}),r.jsx("li",{children:"Rotate secrets periodically for enhanced security"})]})]})]})})]})]})]})}),Er&&is&&r.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[70] overflow-hidden",children:r.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-2xl",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ah,{className:"w-5 h-5 text-yellow-400"}),r.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Overwrite Existing Credentials?"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{Ws(!1),Da(null),Tr(!1)},className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"border border-dashed border-white/20 p-4",children:[r.jsxs("p",{className:"text-sm border-b border-dashed border-white/20 pb-5 text-gray-300 font-mono mb-3",children:["The following"," ",r.jsx("span",{className:"text-white uppercase",children:(f==null?void 0:f.charAt(0).toUpperCase())+(f==null?void 0:f.slice(1))})," ","credentials already exist in"," ",r.jsx("span",{className:"text-gray-400 normal-case",children:is.path}),":"]}),r.jsx("div",{className:"space-y-2 pt-2",children:Object.entries(is.credentials).map(([R,$])=>r.jsxs("div",{className:"flex items-center justify-between text-xs font-mono",children:[r.jsx("span",{className:"text-gray-400 uppercase",children:R}),r.jsx("span",{className:"text-gray-500",children:$.length>20?`${$.substring(0,20)}...`:$})]},R))})]}),r.jsxs("div",{className:"flex items-center justify-end space-x-3 pt-4 border-t border-dashed border-white/10",children:[r.jsx(z,{variant:"outline",onClick:()=>{Ws(!1),Da(null),Tr(!1)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"No, Cancel"}),r.jsx(z,{variant:"outline",onClick:()=>Cm("append"),disabled:Ys,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Append"}),r.jsx(z,{onClick:()=>Cm("override"),disabled:Ys,className:"rounded-none",children:Ys?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Writing..."]}):"Yes, Overwrite"})]})]})]})})]})}function Ife(){const{userId:e}=$1(),t=xr(),[n,a]=p.useState(null),[s,i]=p.useState([]),[o,l]=p.useState([]),[c,u]=p.useState([]),[h,d]=p.useState([]),[f,m]=p.useState(!0),[y,x]=p.useState("details"),[w,b]=p.useState(!1),[v,g]=p.useState(!1),[N,S]=p.useState(!1),[T,j]=p.useState(!1),[E,k]=p.useState(!1),[I,O]=p.useState("random"),[M,B]=p.useState(!1),[A,U]=p.useState(!1),[_,L]=p.useState(!1),[C,D]=p.useState(""),[H,V]=p.useState(),[P,G]=p.useState(!1),[K,Z]=p.useState(""),[ae,ne]=p.useState([]),[ee,se]=p.useState(!1),[ye,le]=p.useState({}),ge=p.useRef({}),be=p.useCallback(async()=>{try{const ue=await(await fetch("/api/admin/status")).json();G(ue.enabled)}catch{G(!1)}},[]),Oe=p.useCallback(async Y=>{try{const ue=await fetch("/api/geo/resolve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ipAddress:Y})});if(ue.ok){const me=await ue.json();if(me.success&&me.location)return me.location}return null}catch{return null}},[]),Ue=p.useCallback(async Y=>{const ue=Y.filter(Me=>!ge.current[Me.id]);if(ue.length===0)return;const me=await Promise.all(ue.map(async Me=>{const We=await Oe(Me.ipAddress);return We?{sessionId:Me.id,location:We}:null})),Ne={};me.forEach(Me=>{Me&&(Ne[Me.sessionId]=Me.location)}),Object.keys(Ne).length>0&&(ge.current={...ge.current,...Ne},le(ge.current))},[Oe]),Be=Y=>{if(!Y)return"🌍";const ue=Y.toUpperCase().split("").map(me=>127397+me.charCodeAt(0));return String.fromCodePoint(...ue)},qe=Y=>Y?Y.replace(/[_-]/g," ").replace(/\b\w/g,ue=>ue.toUpperCase()):"Unknown Provider",bt=Y=>{if(!Y)return"Unknown";const ue=new Date(Y);return Number.isNaN(ue.getTime())?"Unknown":ue.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})},Ye=p.useCallback(async()=>{try{const Y=await fetch(`/api/users/${e}`);if(Y.ok){const ue=await Y.json();a(ue.user)}else q.error("Failed to fetch user details"),t("/users")}catch{q.error("Failed to fetch user details"),t("/users")}finally{m(!1)}},[e,t]),Ot=p.useCallback(async()=>{try{const[Y,ue,me]=await Promise.all([fetch(`/api/users/${e}/organizations`),fetch(`/api/users/${e}/teams`),fetch(`/api/users/${e}/sessions`)]);if(Y.ok){const Ne=await Y.json();i(Ne.memberships||[])}if(ue.ok){const Ne=await ue.json();l(Ne.memberships||[])}if(me.ok){const Me=(await me.json()).sessions||[];u(Me),Ue(Me)}}catch{}},[e,Ue]),Nt=p.useCallback(async()=>{try{const Y=await fetch(`/api/users/${e}/accounts`);if(Y.ok){const ue=await Y.json();d(ue.accounts||[])}}catch{}},[e]),Xe=async()=>{var Ne,Me;if(!n)return;const Y=(Ne=document.getElementById("edit-name"))==null?void 0:Ne.value,ue=(Me=document.getElementById("edit-email"))==null?void 0:Me.value;if(!Y||!ue){q.error("Please fill in all fields");return}const me=q.loading("Updating user...");try{const Q=await(await fetch(`/api/users/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Y,email:ue,role:K||null})})).json();Q.success?(a({...n,name:Y,email:ue,role:K||void 0}),b(!1),Z(""),q.success("User updated successfully!",{id:me})):q.error(`Error updating user: ${Q.error||"Unknown error"}`,{id:me})}catch{q.error("Error updating user",{id:me})}},nt=async()=>{if(!n)return;const Y=q.loading("Deleting user...");try{const me=await(await fetch(`/api/users/${e}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();me.success?(q.success("User deleted successfully!",{id:Y}),t("/users")):q.error(`Error deleting user: ${me.error||"Unknown error"}`,{id:Y})}catch{q.error("Error deleting user",{id:Y})}},Je=async()=>{if(!n)return;if(!P){q.error("Admin plugin is not enabled. Please enable the admin plugin in your Better Auth configuration to use ban functionality.");return}const Y=q.loading("Banning user...");try{const ue=await fetch("/api/admin/ban-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,banReason:C||"No reason provided",banExpiresIn:H})}),me=await ue.json();ue.ok?(q.success("User banned successfully!",{id:Y}),g(!1),D(""),V(void 0),Ye()):ue.status===403?q.error("You do not have permission to ban users. Admin role required.",{id:Y}):me.adminPluginEnabled&&me.instructions?q.error(`${me.error}`,{id:Y,duration:6e3,description:`Use: ${me.instructions.example}`}):q.error(`Error banning user: ${me.error||me.message||"Unknown error"}`,{id:Y})}catch{q.error("Error banning user",{id:Y})}},At=async()=>{if(!n)return;if(!P){q.error("Admin plugin is not enabled. Please enable the admin plugin in your Better Auth configuration to use unban functionality.");return}const Y=q.loading("Unbanning user...");try{const ue=await fetch("/api/admin/unban-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e})}),me=await ue.json();ue.ok?(q.success("User unbanned successfully!",{id:Y}),S(!1),Ye()):ue.status===403?q.error("You do not have permission to unban users. Admin role required.",{id:Y}):me.adminPluginEnabled&&me.instructions?q.error(`${me.error}`,{id:Y,duration:6e3,description:`Use: ${me.instructions.example}`}):q.error(`Error unbanning user: ${me.error||me.message||"Unknown error"}`,{id:Y})}catch{q.error("Error unbanning user",{id:Y})}},kt=async Y=>{const ue=q.loading("Removing user from organization...");try{const Ne=await(await fetch(`/api/organizations/members/${Y}`,{method:"DELETE"})).json();Ne.success?(i(Me=>Me.filter(We=>We.id!==Y)),Ot(),q.success("User removed from organization!",{id:ue})):q.error(`Error removing user: ${Ne.error||"Unknown error"}`,{id:ue})}catch{q.error("Error removing user from organization",{id:ue})}},Wt=async Y=>{const ue=q.loading("Removing user from team...");try{const Ne=await(await fetch(`/api/teams/members/${Y}`,{method:"DELETE"})).json();Ne.success?(l(Me=>Me.filter(We=>We.id!==Y)),Ot(),q.success("User removed from team!",{id:ue})):q.error(`Error removing user: ${Ne.error||"Unknown error"}`,{id:ue})}catch{q.error("Error removing user from team",{id:ue})}},Qt=async Y=>{const ue=q.loading("Deleting session...");try{const Ne=await(await fetch(`/api/sessions/${Y}`,{method:"DELETE"})).json();Ne.success?(u(Me=>Me.filter(We=>We.id!==Y)),q.success("Session deleted successfully!",{id:ue})):q.error(`Error deleting session: ${Ne.error||"Unknown error"}`,{id:ue})}catch{q.error("Error deleting session",{id:ue})}},ie=async Y=>{if(!e)return;const ue=q.loading("Unlinking account...");try{const me=await fetch(`/api/users/${e}/accounts/${Y}`,{method:"DELETE"}),Ne=await me.json();me.ok&&Ne.success?(d(Me=>Me.filter(We=>We.id!==Y)),await Nt(),q.success("Account unlinked successfully",{id:ue})):q.error(Ne.error||"Failed to unlink account",{id:ue})}catch{q.error("Failed to unlink account",{id:ue})}};p.useEffect(()=>{e&&(Ye(),Ot(),Nt(),be())},[e,be,Ye,Ot,Nt]);const Te=async(Y=3)=>{if(e){ne([]),se(!0),ne([{id:"start",type:"info",message:`Starting session seeding process for ${Y} sessions...`,timestamp:new Date}]);try{const me=await(await fetch(`/api/users/${e}/seed-sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:Y})})).json();if(me.success){const Ne=me.results.map((We,Q)=>We.success?{id:`session-${Q}`,type:"progress",message:`Creating session ${Q+1}: ${We.session.token.substring(0,20)}... from ${We.session.ipAddress}`,timestamp:new Date,status:"completed"}:{id:`session-${Q}`,type:"error",message:`Failed to create session ${Q+1}: ${We.error}`,timestamp:new Date});ne(We=>[...We,...Ne]);const Me=me.results.filter(We=>We.success).length;ne(We=>[...We,{id:"complete",type:"success",message:`✅ Session seeding completed! Created ${Me}/${Y} sessions successfully`,timestamp:new Date}]),Ot()}else ne(Ne=>[...Ne,{id:"error",type:"error",message:`❌ Session seeding failed: ${me.error||"Unknown error"}`,timestamp:new Date}])}catch(ue){ne(me=>[...me,{id:"error",type:"error",message:`❌ Network error: ${ue}`,timestamp:new Date}])}finally{se(!1)}}},He=async(Y=3,ue="random")=>{if(e){ne([]),se(!0),ne([{id:"start",type:"info",message:`Starting account seeding process for ${Y} accounts...`,timestamp:new Date}]);try{const Ne=await(await fetch(`/api/users/${e}/seed-accounts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:Y,providerId:ue})})).json();if(Ne.success){const Me=Ne.results.map((Q,ce)=>{var je;return Q.success?{id:`account-${ce}`,type:"progress",message:`Creating account ${ce+1}: ${Q.account.providerId||Q.account.provider} (${((je=Q.account.accountId)==null?void 0:je.substring(0,20))||Q.account.id.substring(0,20)}...)`,timestamp:new Date,status:"completed"}:{id:`account-${ce}`,type:"error",message:`Failed to create account ${ce+1}: ${Q.error}`,timestamp:new Date}});ne(Q=>[...Q,...Me]);const We=Ne.results.filter(Q=>Q.success).length;ne(Q=>[...Q,{id:"complete",type:"success",message:`✅ Account seeding completed! Created ${We}/${Y} accounts successfully`,timestamp:new Date}]),Nt()}else ne(Me=>[...Me,{id:"error",type:"error",message:`❌ Account seeding failed: ${Ne.error||"Unknown error"}`,timestamp:new Date}])}catch(me){ne(Ne=>[...Ne,{id:"error",type:"error",message:`❌ Network error: ${me}`,timestamp:new Date}])}finally{se(!1)}}};return f?r.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:r.jsx("div",{className:"text-white text-lg",children:"Loading user details..."})}):n?r.jsxs("div",{className:"space-y-6 p-6 bg-black w-full",children:[r.jsxs("div",{className:"w-full flex flex-col",children:[r.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:r.jsxs("span",{className:"font-light",children:[r.jsxs("span",{onClick:()=>t("/users"),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["users /"," "]}),r.jsx("span",{className:"text-white font-mono text-sm",children:n.id})]})}),r.jsx("div",{className:"mb-8 mt-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsx("div",{className:"w-16 h-16 bg-gray-800 border border-dashed border-white/20 flex items-center justify-center",children:n.image?r.jsx("img",{src:n.image,alt:n.name,className:"w-16 h-16 object-cover"}):r.jsx(ld,{className:"w-8 h-8 text-white"})}),r.jsxs("div",{children:[r.jsxs("h1",{className:"text-3xl font-light text-white inline-flex items-center",children:[n.name,r.jsx($n,{id:n.id,variant:"subscript"}),n.role&&r.jsx("sup",{className:"ml-2 px-2 pt-2 pb-2 -mt-1 py-0.5 text-[10px] font-mono uppercase border border-dashed border-white/15 bg-white/5 text-white/80 rounded-none",children:n.role}),n.banned&&r.jsxs("sup",{className:"relative group inline-block ml-2 px-2 pt-2 pb-2 -mt-1 py-0.5 text-[10px] font-mono uppercase border border-dashed border-red-500/30 bg-red-500/10 text-red-400/80 rounded-none cursor-help",children:["Banned",n.banReason&&r.jsxs("span",{className:"absolute lowercase left-1/2 -translate-x-1/2 bottom-full mb-3 px-2 py-2 text-[10px] font-mono text-gray-300 bg-black border border-dashed border-white/20 rounded-none whitespace-nowrap opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-150 pointer-events-none z-50",children:[r.jsx("span",{className:"text-gray-400 font-mono text-xs uppercase mr-1",children:"Banned Reason:"}),n.banReason,r.jsx("span",{className:"absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-l-[4px] border-r-[4px] border-t-[4px] border-transparent border-t-white/20"})]})]})]}),r.jsx("p",{className:"text-gray-400 font-mono text-sm",children:n.email})]})]}),r.jsx("div",{className:"flex items-center space-x-2",children:r.jsxs("div",{className:"relative",children:[r.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:Y=>{Y.stopPropagation(),L(!_)},children:r.jsx(VL,{className:"w-4 h-4"})}),_&&r.jsxs("div",{className:"absolute z-[999] right-0 top-full mt-1 w-48 bg-black border border-white/20 rounded-none shadow-lg",onClick:Y=>Y.stopPropagation(),children:[r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:Y=>{Y.stopPropagation(),L(!1),b(!0),Z(n.role||"")},children:[r.jsx(Lo,{className:"w-4 h-4"}),r.jsx("span",{children:"Edit User"})]}),r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:Y=>{Y.stopPropagation(),L(!1),B(!0)},children:[r.jsx(An,{className:"w-4 h-4"}),r.jsx("span",{children:"Update Password"})]}),P&&(n.banned?r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-green-400 hover:bg-white/10 flex items-center space-x-2",onClick:Y=>{Y.stopPropagation(),L(!1),S(!0)},children:[r.jsx(Vg,{className:"w-4 h-4"}),r.jsx("span",{children:"Unban User"})]}):r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-yellow-400 hover:bg-white/10 flex items-center space-x-2",onClick:Y=>{Y.stopPropagation(),L(!1),g(!0)},children:[r.jsx(Vg,{className:"w-4 h-4"}),r.jsx("span",{children:"Ban User"})]})),r.jsx("div",{className:"border-t border-white/10 my-1"}),r.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-red-400 hover:bg-white/10 flex items-center space-x-2",onClick:Y=>{Y.stopPropagation(),L(!1),U(!0)},children:[r.jsx(Gu,{className:"w-4 h-4"}),r.jsx("span",{children:"Delete User"})]})]})]})})]})}),r.jsxs("div",{className:"border border-dashed border-white/20 rounded-none",children:[r.jsx("div",{className:"border-b border-dashed border-white/20",children:r.jsx("nav",{className:"flex space-x-8 px-6",children:[{id:"details",name:"Details",icon:ld},{id:"organizations",name:"Organizations",icon:wa,count:s.length},{id:"teams",name:"Teams",icon:_t,count:o.length},{id:"accounts",name:"Accounts",icon:mo,count:h.length},{id:"sessions",name:"Sessions",icon:mN,count:c.length}].map(Y=>r.jsxs("button",{onClick:()=>x(Y.id),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${y===Y.id?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[r.jsx(Y.icon,{className:"w-4 h-4 text-white/90"}),r.jsxs("span",{className:"inline-flex items-start",children:[r.jsx("span",{className:"",children:Y.name}),Y.count!==void 0&&r.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:r.jsx(hr,{value:Y.count,className:"text-white/80 font-mono text-xs",prefix:r.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:r.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]},Y.id))})}),r.jsxs("div",{className:"p-6",children:[y==="details"&&r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[r.jsxs("div",{className:"overflow-x-hidden bg-white/[3%] border border-white/10 p-6 rounded-none",children:[r.jsx("h3",{className:"text-sm uppercase font-mono text-gray-400 mb-4 tracking-wider",children:"BASIC INFORMATION"}),r.jsx("hr",{className:"border-white/10 -mx-10 border-dashed my-4"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx(ld,{className:"w-4 h-4 text-gray-400 mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Name"}),r.jsx("div",{className:"text-white font-sans text-sm",children:n.name})]})]}),r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx(bs,{className:"w-4 h-4 text-gray-400 mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Email"}),r.jsx("div",{className:"text-white font-mono text-sm",children:n.email})]})]}),n.username&&r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx(Xne,{className:"w-4 h-4 text-gray-400 mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Username"}),r.jsx("div",{className:"text-white font-mono text-sm",children:n.username})]})]}),n.phoneNumber&&r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx(Wne,{className:"w-4 h-4 text-gray-400 mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Phone"}),r.jsx("div",{className:"text-white font-mono text-sm",children:"+251 91 234 5678"})]})]}),r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx(sr,{className:"w-4 h-4 text-gray-400 mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Member Since"}),r.jsx("div",{className:"text-white font-mono text-sm",children:new Date(n.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})})]})]})]})]}),r.jsxs("div",{className:"overflow-x-hidden bg-white/[3%] border border-white/10 p-6 rounded-none",children:[r.jsx("h3",{className:"text-sm uppercase font-mono text-gray-400 mb-4 tracking-wider",children:"SECURITY"}),r.jsx("hr",{className:"border-white/10 -mx-10 border-dashed my-4"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 bg-black/30 border border-white/10 rounded-none",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx(bs,{className:"w-4 h-4 text-gray-400"}),r.jsx("div",{children:r.jsx("div",{className:"text-xs uppercase font-mono text-gray-500",children:"Email Verification"})})]}),r.jsx("div",{className:`px-2 rounded-none border border-dashed border-white/20 uppercase py-1 text-xs font-mono ${n.emailVerified?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"}`,children:n.emailVerified?"Verified":"Unverified"})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-black/30 border border-white/10 rounded-none",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx(As,{className:"w-4 h-4 text-gray-400"}),r.jsx("div",{children:r.jsx("div",{className:"text-xs uppercase font-mono text-gray-500",children:"Two-Factor Authentication"})})]}),r.jsx("div",{className:`px-2 rounded-none border border-dashed border-white/20 uppercase py-1 text-xs font-mono ${n.twoFactorEnabled?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"}`,children:n.twoFactorEnabled?"Enabled":"Disabled"})]})]})]})]}),y==="organizations"&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between mb-4",children:r.jsxs("div",{children:[r.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Organizations",r.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[r.jsx("span",{className:"mr-1",children:"["}),r.jsx("span",{className:"text-white font-mono text-xs",children:s.length}),r.jsx("span",{className:"ml-1",children:"]"})]})]}),r.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Organizations this user belongs to"})]})}),s.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(wa,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No Organizations"}),r.jsx("p",{className:"text-gray-400",children:"This user is not a member of any organizations."})]}):r.jsx("div",{className:"grid gap-4",children:s.map(Y=>r.jsxs("div",{className:"border border-dashed border-white/10 rounded-none p-4 hover:bg-white/5 transition-colors",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center space-x-4 flex-1",children:[r.jsx("div",{className:"w-12 h-12 bg-black/80 border border-dashed border-white/20 flex items-center justify-center rounded-none",children:Y.organization.image?r.jsx("img",{src:Y.organization.image,alt:Y.organization.name,className:"w-12 h-12 object-cover"}):r.jsx(wa,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("h3",{className:"text-white font-light inline-flex items-start",children:[Y.organization.name,r.jsxs("sup",{className:"text-xs text-gray-500 ml-2 mt-0.5",children:[r.jsx("span",{className:"mr-1",children:"["}),r.jsx("span",{className:"text-white/80 font-mono text-xs",children:Y.organization.slug}),r.jsx("span",{className:"ml-1",children:"]"})]})]}),r.jsxs("p",{className:"text-gray-400 text-sm font-sans mt-1 flex items-center gap-2",children:[r.jsxs("span",{children:["in ",Y.organization.slug]}),r.jsx("button",{onClick:ue=>{ue.stopPropagation(),t(`/organizations/${Y.organization.id}`)},className:"text-white/60 hover:text-white transition-colors",title:"View organization details",children:r.jsx(uu,{className:"w-3.5 h-3.5"})})]})]})]}),r.jsx("div",{className:"flex flex-col items-end space-y-2",children:r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxs("span",{className:"text-gray-500 font-mono text-xs uppercase",children:["Joined:"," "]}),r.jsxs("span",{className:"text-white font-mono text-xs",children:[new Date(Y.joinedAt).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),","," ",new Date(Y.joinedAt).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})]})]})})]}),r.jsx("div",{className:"flex items-center justify-end",children:r.jsxs(z,{variant:"outline",size:"sm",onClick:()=>kt(Y.id),className:"border border-dashed border-red-400/20 text-red-400 hover:bg-red-400/10 rounded-none",children:[r.jsx(Gg,{className:"w-4 h-4 mr-1"}),"Remove"]})})]},Y.id))})]}),y==="teams"&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between mb-4",children:r.jsxs("div",{children:[r.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Teams",r.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[r.jsx("span",{className:"mr-1",children:"["}),r.jsx("span",{className:"text-white font-mono text-xs",children:o.length}),r.jsx("span",{className:"ml-1",children:"]"})]})]}),r.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Teams this user belongs to"})]})}),o.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(_t,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No Teams"}),r.jsx("p",{className:"text-gray-400",children:"This user is not a member of any teams."})]}):r.jsx("div",{className:"grid gap-4",children:o.map(Y=>r.jsxs("div",{className:"border border-dashed border-white/10 rounded-none p-4 hover:bg-white/5 transition-colors",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center space-x-4 flex-1",children:[r.jsx("div",{className:"w-12 h-12 bg-black/80 border border-dashed border-white/20 flex items-center justify-center rounded-none",children:r.jsx(_t,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("h3",{className:"text-white font-light inline-flex items-start",children:[Y.team.name,r.jsx($n,{id:Y.team.id,variant:"subscript",nonSliced:!!(Y.team.organizationSlug||Y.team.organizationName)})]}),r.jsxs("p",{className:"text-gray-400 text-sm font-sans mt-1 flex items-center gap-2",children:[r.jsxs("span",{children:["in"," ",Y.team.organizationSlug||Y.team.organizationName]}),r.jsx("button",{onClick:ue=>{ue.stopPropagation(),Y.team.organizationId?t(`/organizations/${Y.team.organizationId}/teams/${Y.team.id}`):t(`/teams/${Y.team.id}`)},className:"text-white/60 hover:text-white transition-colors",title:"View team details",children:r.jsx(uu,{className:"w-3.5 h-3.5"})})]})]})]}),r.jsx("div",{className:"flex flex-col items-end space-y-2",children:r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxs("span",{className:"text-gray-500 font-mono text-xs uppercase",children:["Joined:"," "]}),r.jsxs("span",{className:"text-white font-mono text-xs",children:[new Date(Y.joinedAt).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),","," ",new Date(Y.joinedAt).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})]})]})})]}),r.jsx("div",{className:"flex items-center justify-end",children:r.jsxs(z,{variant:"outline",size:"sm",onClick:()=>Wt(Y.id),className:"border border-dashed border-red-400/20 text-red-400 hover:bg-red-400/10 rounded-none",children:[r.jsx(Gg,{className:"w-4 h-4 mr-1"}),"Remove"]})})]},Y.id))})]}),y==="accounts"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Linked Accounts",r.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[r.jsx("span",{className:"mr-1",children:"["}),r.jsx("span",{className:"text-white font-mono text-xs",children:h.length}),r.jsx("span",{className:"ml-1",children:"]"})]})]}),r.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage user OAuth account connections"})]}),r.jsxs(z,{variant:"outline",onClick:()=>{ne([]),se(!1),k(!0)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[r.jsx(mo,{className:"w-4 h-4 mr-2"}),"Seed Accounts"]})]}),h.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(mo,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No Linked Accounts"}),r.jsx("p",{className:"text-gray-400",children:"This user has not connected any accounts yet."})]}):r.jsx("div",{className:"grid gap-4",children:h.map(Y=>r.jsxs("div",{className:"border border-dashed border-white/10 rounded-none p-4 hover:bg-white/5 transition-colors",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center space-x-4 flex-1",children:[r.jsx("div",{className:"w-12 h-12 bg-black/80 border border-dashed border-white/20 flex items-center justify-center rounded-none",children:RP(Y.providerId)}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("h3",{className:"text-white font-light inline-flex items-start",children:[qe(Y.providerId),r.jsx($n,{id:Y.accountId,variant:"subscript",nonSliced:!!(Y.email||n.email)})]}),r.jsx("p",{className:"text-gray-400 tracking-tight uppercase text-xs font-mono mt-1",children:`ID: ${Y.id}`})]})]}),r.jsx("div",{className:"flex flex-col items-end space-y-2 text-right",children:r.jsxs("div",{className:"flex items-center space-x-2 text-xs font-mono text-gray-400",children:[r.jsx("span",{children:"Linked:"}),r.jsx("span",{className:"text-white",children:bt(Y.createdAt||Y.updatedAt)})]})})]}),r.jsx("div",{className:"flex items-center justify-end",children:r.jsxs(z,{variant:"outline",size:"sm",onClick:()=>ie(Y.id),className:"border border-dashed border-red-400/20 text-red-400 hover:bg-red-400/10 rounded-none",children:[r.jsx(Gg,{className:"w-4 h-4 mr-1"}),"Unlink"]})})]},Y.id))})]}),y==="sessions"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Sessions",r.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[r.jsx("span",{className:"mr-1",children:"["}),r.jsx("span",{className:"text-white font-mono text-xs",children:c.length}),r.jsx("span",{className:"ml-1",children:"]"})]})]}),r.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage user authentication sessions"})]}),r.jsxs(z,{variant:"outline",onClick:()=>{ne([]),se(!1),j(!0)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[r.jsx(As,{className:"w-4 h-4 mr-2"}),"Seed Sessions"]})]}),c.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(mN,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No Sessions"}),r.jsx("p",{className:"text-gray-400",children:"This user has no active sessions."})]}):r.jsx("div",{className:"grid gap-4",children:c.map(Y=>{var ue,me,Ne,Me;return r.jsxs("div",{className:"border border-dashed border-white/10 rounded-none p-4 hover:bg-white/5 transition-colors",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center space-x-4 flex-1",children:[r.jsx("div",{className:"w-12 h-12 bg-black/80 border border-dashed border-white/20 flex items-center justify-center rounded-none",children:r.jsx(cC,{className:"w-6 h-6 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("h3",{className:"text-white font-light inline-flex items-start",children:["Session ",Y.id.substring(0,8),"...",r.jsxs("sup",{className:"text-xs text-gray-500 ml-2 mt-0.5",children:[r.jsx("span",{className:"mr-1",children:"["}),r.jsx("span",{className:"text-white/80 font-mono text-xs",children:Y.ipAddress}),r.jsx("span",{className:"ml-1",children:"]"})]})]}),r.jsxs("div",{className:"flex items-center space-x-2 mt-2",children:[r.jsx(Yne,{className:"w-3.5 h-3.5 text-gray-400"}),r.jsxs("span",{className:"text-gray-400 uppercase font-mono text-xs",children:[((ue=ye[Y.id])==null?void 0:ue.city)||"...",","," ",((me=ye[Y.id])==null?void 0:me.country)||"..."]}),((Ne=ye[Y.id])==null?void 0:Ne.countryCode)&&r.jsx("span",{className:"text-xs ml-1",children:Be((Me=ye[Y.id])==null?void 0:Me.countryCode)})]})]})]}),r.jsx("div",{className:"flex flex-col items-end space-y-2",children:r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxs("span",{className:"text-gray-500 font-mono text-xs uppercase",children:["Expires:"," "]}),r.jsxs("span",{className:"text-white font-mono text-xs",children:[new Date(Y.expiresAt).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),","," ",new Date(Y.expiresAt).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})]})]})})]}),r.jsx("div",{className:"flex items-center justify-end",children:r.jsxs(z,{variant:"outline",size:"sm",onClick:()=>Qt(Y.id),className:"border border-dashed border-red-400/20 text-red-400 hover:bg-red-400/10 rounded-none",children:[r.jsx(Vg,{className:"w-4 h-4 mr-1"}),"Revoke"]})})]},Y.id)})})]})]})]})]}),w&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 rounded-none p-6 w-full max-w-md",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Edit User"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{b(!1),Z("")},className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"w-16 h-16 bg-black/80 border border-dashed border-white/20 flex items-center justify-center",children:n!=null&&n.image?r.jsx("img",{src:n.image,alt:n.name,className:"w-16 h-16 object-cover"}):r.jsx(ld,{className:"w-8 h-8 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"text-white font-medium",children:n==null?void 0:n.name}),r.jsx("p",{className:"text-gray-400 text-sm",children:n==null?void 0:n.email})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Name"}),r.jsx("input",{id:"edit-name",type:"text",defaultValue:(n==null?void 0:n.name)||"",className:"w-full px-3 py-2 bg-gray-800 border border-dashed border-white/20 rounded-none text-white placeholder-gray-400 focus:outline-none focus:border-white/50"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Email"}),r.jsx("input",{id:"edit-email",type:"email",defaultValue:(n==null?void 0:n.email)||"",className:"w-full px-3 py-2 bg-gray-800 border border-dashed border-white/20 rounded-none text-white placeholder-gray-400 focus:outline-none focus:border-white/50"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Role"}),r.jsxs(kn,{className:"bg-black text-white",value:K,onValueChange:Z,children:[r.jsx(_n,{className:"w-full border border-dashed border-white/20 bg-black text-white rounded-none",children:r.jsx(Ea,{placeholder:"Select role"})}),r.jsxs(Rn,{children:[r.jsx(De,{value:"",children:"None"}),r.jsx(De,{value:"admin",children:"Admin"}),r.jsx(De,{value:"user",children:"User"})]})]})]})]}),r.jsxs("div",{className:"flex justify-end space-x-2 mt-6",children:[r.jsx(z,{variant:"outline",onClick:()=>{b(!1),Z("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx(z,{onClick:Xe,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update"})]})]})}),v&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black border border-red-400/20 rounded-none p-6 w-full max-w-md",children:[r.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Ban User"}),r.jsxs("p",{className:"text-gray-400 mb-4",children:["Ban ",r.jsx("strong",{children:n.name})," from accessing the system."]}),r.jsxs("div",{className:"space-y-4 mb-6",children:[r.jsxs("div",{children:[r.jsx(oe,{htmlFor:"banReason",className:"text-white",children:"Ban Reason"}),r.jsx(ve,{id:"banReason",value:C,onChange:Y=>D(Y.target.value),placeholder:"Enter reason for ban (optional)",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(oe,{htmlFor:"banExpires",className:"text-white",children:"Ban Duration (seconds)"}),r.jsx(ve,{id:"banExpires",type:"number",value:H||"",onChange:Y=>V(Y.target.value?Number(Y.target.value):void 0),placeholder:"Leave empty for permanent ban",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Examples: 3600 (1 hour), 86400 (1 day), 604800 (1 week)"})]})]}),r.jsxs("div",{className:"flex justify-end space-x-2",children:[r.jsx(z,{variant:"outline",onClick:()=>{g(!1),D(""),V(void 0)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx(z,{onClick:Je,className:"bg-red-600 text-white hover:bg-red-700 rounded-none",children:"Ban User"})]})]})}),N&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black border border-green-400/20 rounded-none p-6 w-full max-w-md",children:[r.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Unban User"}),r.jsxs("p",{className:"text-gray-400 mb-6",children:["Are you sure you want to unban ",r.jsx("strong",{children:n.name}),"? This will restore their access to the system."]}),r.jsxs("div",{className:"flex justify-end space-x-2",children:[r.jsx(z,{variant:"outline",onClick:()=>S(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx(z,{onClick:At,className:"bg-green-400 text-white hover:bg-green-700 rounded-none",children:"Unban User"})]})]})}),A&&n&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Delete User"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>U(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"w-16 h-16 bg-black/80 border border-dashed border-white/20 flex items-center justify-center",children:n.image?r.jsx("img",{src:n.image,alt:n.name,className:"w-16 h-16 object-cover"}):r.jsx(ld,{className:"w-8 h-8 text-white"})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-white font-light",children:n.name}),r.jsx("div",{className:"text-sm text-gray-400",children:n.email})]})]}),r.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this user? This action cannot be undone."})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx(z,{variant:"outline",onClick:()=>U(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx(z,{onClick:nt,className:"bg-red-500 hover:bg-red-600 text-white border border-red-500 rounded-none",children:"Delete"})]})]})}),M&&n&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg text-white font-light",children:"Update Password"}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>B(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx(oe,{htmlFor:"new-password",className:"text-sm text-gray-400 font-light",children:"New Password"}),r.jsx(ve,{id:"new-password",type:"password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx(z,{variant:"outline",onClick:()=>B(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),r.jsx(z,{onClick:async()=>{var me;const Y=(me=document.getElementById("new-password"))==null?void 0:me.value;if(!Y){q.error("Please enter a password");return}const ue=q.loading("Updating password...");try{const Me=await(await fetch(`/api/users/${e}/password`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:Y})})).json();Me.success?(B(!1),document.getElementById("new-password").value="",q.success("Password updated successfully!",{id:ue})):q.error(`Error updating password: ${Me.error||"Unknown error"}`,{id:ue})}catch{q.error("Error updating password",{id:ue})}},className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update"})]})]})}),T&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 overflow-hidden",children:r.jsxs("div",{className:"overflow-x-hidden overflow-y-auto bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none max-h-[90vh]",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[r.jsx("span",{className:"text-white/50 mr-2",children:"["}),r.jsx(cC,{className:"inline mr-2 w-3 h-3 text-white"}),r.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed Sessions"}),r.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>j(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx(oe,{htmlFor:"session-count",className:"text-sm text-gray-400 font-light",children:"Number of sessions"}),r.jsx(ve,{id:"session-count",type:"number",min:"1",max:"50",defaultValue:"3",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsx(z,{onClick:()=>{var ue;const Y=parseInt(((ue=document.getElementById("session-count"))==null?void 0:ue.value)||"3",10);Te(Y)},disabled:ee,className:"bg-transparent hover:bg-white/90 bg-white text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:ee?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):r.jsxs(r.Fragment,{children:[r.jsx(As,{className:"w-3 h-3 mr-2"}),"Seed Sessions"]})})]})}),ae.length>0&&r.jsx("div",{className:"mt-6",children:r.jsx(Gi,{title:"Session Seeding Terminal",lines:ae,isRunning:ee,className:"w-full",defaultCollapsed:!0})})]}),r.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),r.jsx("div",{className:"flex justify-end mt-6 pt-6",children:r.jsx(z,{variant:"outline",onClick:()=>j(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),E&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 overflow-hidden",children:r.jsxs("div",{className:"overflow-x-hidden overflow-y-auto bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none max-h-[90vh]",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[r.jsx("span",{className:"text-white/50 mr-2",children:"["}),r.jsx(mo,{className:"inline mr-2 w-3 h-3 text-white"}),r.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed Accounts"}),r.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),r.jsx(z,{variant:"ghost",size:"sm",onClick:()=>k(!1),className:"text-gray-400 hover:text-white rounded-none",children:r.jsx(ct,{className:"w-4 h-4"})})]}),r.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(oe,{htmlFor:"account-count",className:"text-sm text-gray-400 font-light",children:"Number of accounts"}),r.jsx(ve,{id:"account-count",type:"number",min:"1",max:"50",defaultValue:"3",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),r.jsxs("div",{children:[r.jsx(oe,{htmlFor:"account-provider",className:"text-sm text-gray-400 font-light",children:"Provider"}),r.jsxs(kn,{value:I,onValueChange:O,children:[r.jsx(_n,{className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none",children:r.jsx(Ea,{placeholder:"Select provider"})}),r.jsxs(Rn,{className:"bg-black border border-dashed border-white/20",children:[r.jsx(De,{value:"random",children:"Mix (Random)"}),r.jsx(De,{value:"github",children:"GitHub"}),r.jsx(De,{value:"google",children:"Google"}),r.jsx(De,{value:"discord",children:"Discord"}),r.jsx(De,{value:"facebook",children:"Facebook"}),r.jsx(De,{value:"twitter",children:"Twitter"}),r.jsx(De,{value:"linkedin",children:"LinkedIn"}),r.jsx(De,{value:"apple",children:"Apple"}),r.jsx(De,{value:"microsoft",children:"Microsoft"}),r.jsx(De,{value:"gitlab",children:"GitLab"}),r.jsx(De,{value:"bitbucket",children:"Bitbucket"}),r.jsx(De,{value:"spotify",children:"Spotify"}),r.jsx(De,{value:"twitch",children:"Twitch"}),r.jsx(De,{value:"reddit",children:"Reddit"}),r.jsx(De,{value:"slack",children:"Slack"}),r.jsx(De,{value:"notion",children:"Notion"}),r.jsx(De,{value:"tiktok",children:"TikTok"}),r.jsx(De,{value:"zoom",children:"Zoom"})]})]})]})]}),r.jsx(z,{onClick:()=>{var ue;const Y=parseInt(((ue=document.getElementById("account-count"))==null?void 0:ue.value)||"3",10);He(Y,I)},disabled:ee,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:ee?r.jsxs(r.Fragment,{children:[r.jsx(mn,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):r.jsxs(r.Fragment,{children:[r.jsx(mo,{className:"w-3 h-3 mr-2"}),"Seed Accounts"]})})]}),ae.length>0&&r.jsx("div",{className:"mt-6",children:r.jsx(Gi,{title:"Account Seeding Terminal",lines:ae,isRunning:ee,className:"w-full",defaultCollapsed:!0})})]}),r.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),r.jsx("div",{className:"flex justify-end mt-6 pt-6",children:r.jsx(z,{variant:"outline",onClick:()=>k(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})})]}):r.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:r.jsx("div",{className:"text-white text-lg",children:"User not found"})})}function Dfe(){return r.jsx(jK,{children:r.jsxs(f$,{children:[r.jsx(yQ,{children:r.jsxs(s$,{children:[r.jsx(Fn,{path:"/",element:r.jsx(bae,{})}),r.jsx(Fn,{path:"/users",element:r.jsx(bU,{})}),r.jsx(Fn,{path:"/users/:userId",element:r.jsx(Ife,{})}),r.jsx(Fn,{path:"/organizations",element:r.jsx(gU,{})}),r.jsx(Fn,{path:"/organizations/:orgId",element:r.jsx(Khe,{})}),r.jsx(Fn,{path:"/teams",element:r.jsx(Jhe,{})}),r.jsx(Fn,{path:"/teams/:teamId",element:r.jsx(HO,{})}),r.jsx(Fn,{path:"/organizations/:orgId/teams/:teamId",element:r.jsx(HO,{})}),r.jsx(Fn,{path:"/sessions",element:r.jsx(Zhe,{})}),r.jsx(Fn,{path:"/database",element:r.jsx(yae,{})}),r.jsx(Fn,{path:"/database/demo",element:r.jsx(TK,{})}),r.jsx(Fn,{path:"/emails",element:r.jsx(Whe,{})}),r.jsx(Fn,{path:"/tools",element:r.jsx(Ofe,{})}),r.jsx(Fn,{path:"/settings",element:r.jsx(Qhe,{})})]})}),r.jsx(q$,{className:"rounded-none border-dashed border-white/20",theme:"dark",position:"top-right",richColors:!0,toastOptions:{style:{border:"dashed 1px #ffffff20",borderRadius:"0"},className:"font-mono uppercase"},closeButton:!0})]})})}fz.createRoot(document.getElementById("root")).render(r.jsx(J.StrictMode,{children:r.jsx(Dfe,{})}));