PageSourceSearch

https://tingu.ai/assets/SettingsPanel-C78GsDYt.js

js tingu.ai collected 2026-10-05 13:55:36 UTC 43,193 bytes, 1 lines download raw bytes

1import{f as se,aj as Ce,d as Se,r as l,j as e,B as w,ak as K,s as o,b as Ye,au as Me,av as Ge,aw as Ve,ax as Ze,ay as Je,az as Ke,aA as Xe,aG as Ee,aI as De,Z as Qe,c as ee,_ as es,$ as ss,a0 as ts,a1 as re,a2 as ie}from"./index-DIinWBJp.js";import{C as R,a as $,b as z,c as G,d as U}from"./card-D1HsiIKh.js";import{L as E,a as ne,b as le,c as ce,d as oe,e as M,I as as}from"./currency-Cg3sM3ab.js";import{S as O}from"./separator-CMh4dsG1.js";import{B as Z}from"./badge-CzxSdy2z.js";import{S as he}from"./switch-BCCxcWeL.js";import{A as pe,i as ue,a as je,b as we,c as fe,d as ge,e as ve,f as Ne,g as ye,U as rs,h as is,H as ns}from"./alert-dialog-R7MJZF2F.js";import{T as xe}from"./triangle-alert-Dh2q7_Xm.js";import{T as qe}from"./trash-2-C8RPoQ52.js";import{A as ls,b as cs}from"./avatar-CzvoZGQ6.js";import{T as be,a as ke,b as V,c as j,d as _e,e as x}from"./table-BYrHZYGj.js";import{U as os,C as ds}from"./user-minus-CGrI38gE.js";import{f as H}from"./format-BJd7SSY8.js";import{A as ms,a as xs,b as hs}from"./alert-CdgmGEaL.js";import{S as Le}from"./shield-C6ojBWS4.js";import{C as Te}from"./calendar-BKGTf1DJ.js";import{P as Fe,d as Pe,e as Re}from"./popover-DQX-pQwZ.js";import{S as ps}from"./skeleton-BpYxr9Ib.js";import{C as Ue}from"./calendar-B5GJoZMa.js";import{R as us}from"./refresh-cw-Clr0qlUr.js";import{C as js}from"./circle-x-Dl9A78z_.js";import{C as ws}from"./clock-BRkjCs0K.js";import{U as fs}from"./users-Ci1yDhxO.js";import"./dropdown-menu-xzQnnre3.js";import"./useThrottledCallback-BVtzWQSR.js";import"./en-US-Cs2UT8Qj.js";import"./endOfMonth-CVFug1Ip.js";const gs=()=>{const{currentWorkspace:s,refreshWorkspaces:_}=se(),{toast:r}=Ce(),i=Se(),[f,g]=l.useState((s==null?void 0:s.name)||""),[D,v]=l.useState(!1),[q,b]=l.useState(!1),[L,m]=l.useState(""),[P,k]=l.useState("pool"),[J,B]=l.useState(50),A=(s==null?void 0:s.role)==="owner";l.useEffect(()=>{const a=s==null?void 0:s.settings;a!=null&&a.credit_model&&k(a.credit_model),(a==null?void 0:a.default_member_credits)!==void 0&&B(a.default_member_credits)},[s]),l.useEffect(()=>{(async()=>{if(!(s!=null&&s.owner_id))return;const{data:N}=await o.from("profiles").select("username").eq("id",s.owner_id).single();N&&m(N.username||"Unknown")})()},[s==null?void 0:s.owner_id]);const n=async()=>{if(!(!s||!f.trim())){v(!0);try{const a=f.toLowerCase().replace(/[^a-z0-9]+/g,"-"),{error:N}=await o.from("workspaces").update({name:f.trim(),slug:a}).eq("id",s.workspace_id);if(N)throw N;r({title:"Workspace updated",description:"Workspace name has been updated successfully."}),await _()}catch(a){console.error("Error updating workspace:",a),r({title:"Error",description:"Failed to update workspace name.",variant:"destructive"})}finally{v(!1)}}},I=async a=>{if(s)try{const{error:N}=await o.from("workspaces").update({settings:{...s.settings,credit_model:a}}).eq("id",s.workspace_id);if(N)throw N;k(a),r({title:"Credit model updated",description:`Switched to ${a==="pool"?"pooled":"allocated"} credits mode.`}),await _()}catch(N){console.error("Error updating credit model:",N),r({title:"Error",description:"Failed to update credit model.",variant:"destructive"})}},d=async()=>{if(s)try{v(!0);const{error:a}=await o.from("workspaces").update({settings:{...s.settings,default_member_credits:J}}).eq("id",s.workspace_id);if(a)throw a;r({title:"Settings saved",description:"Default member credits updated successfully."}),await _()}catch(a){console.error("Error updating default credits:",a),r({title:"Error",description:"Failed to update default credits.",variant:"destructive"})}finally{v(!1)}},T=async()=>{if(!(!s||s.is_personal)){b(!0);try{const{error:a}=await o.from("workspaces").delete().eq("id",s.workspace_id);if(a)throw a;r({title:"Workspace deleted",description:"The workspace has been permanently deleted."}),await _(),i("/dashboard")}catch(a){console.error("Error deleting workspace:",a),r({title:"Error",description:"Failed to delete workspace.",variant:"destructive"}),b(!1)}}};return s?e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(R,{children:[e.jsxs($,{className:"p-4 sm:p-6",children:[e.jsx(z,{className:"text-lg sm:text-xl",children:"Worksp
1ace Information"}),e.jsx(G,{className:"text-xs sm:text-sm",children:"Update your workspace name and view workspace details"})]}),e.jsxs(U,{className:"space-y-4 p-4 sm:p-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"workspace-name",className:"text-sm",children:"Workspace Name"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(K,{id:"workspace-name",value:f,onChange:a=>g(a.target.value),placeholder:"Enter workspace name",disabled:!A,className:"flex-1 text-sm sm:text-base"}),A&&e.jsx(w,{onClick:n,disabled:D||f===s.name||!f.trim(),className:"w-full sm:w-auto text-sm",children:D?"Saving...":"Save"})]}),!A&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Only workspace owners can change the workspace name"})]}),e.jsx(O,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"Workspace Slug"}),e.jsx(K,{value:s.slug,disabled:!0,className:"bg-muted"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Auto-generated from workspace name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"Workspace Type"}),e.jsx("div",{children:s.is_personal?e.jsx(Z,{variant:"secondary",children:"Personal Workspace"}):e.jsx(Z,{variant:"default",children:"Team Workspace"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"Owner"}),e.jsx(K,{value:L,disabled:!0,className:"bg-muted"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"Your Role"}),e.jsx("div",{children:e.jsx(Z,{variant:"outline",className:"capitalize",children:s.role})})]}),e.jsx(O,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"credit-model",className:"text-sm",children:"Credit Model"}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:P==="pool"?"Pooled Credits":"Allocated Credits"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:P==="pool"?"All members share workspace credits":"Credits assigned individually to members"})]}),e.jsx(he,{id:"credit-model",checked:P==="allocated",onCheckedChange:a=>I(a?"allocated":"pool"),disabled:!A,className:"flex-shrink-0"})]}),!A&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Only workspace owners can change the credit model"})]}),P==="allocated"&&e.jsxs(e.Fragment,{children:[e.jsx(O,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"default-credits",className:"text-sm",children:"Default Member Credits"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(K,{id:"default-credits",type:"number",min:0,value:J,onChange:a=>B(parseInt(a.target.value)||0),placeholder:"50",disabled:!A,className:"flex-1 text-sm sm:text-base"}),A&&e.jsx(w,{onClick:d,disabled:D,className:"w-full sm:w-auto text-sm",children:D?"Saving...":"Save"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Credits automatically allocated to new members when they join"})]})]})]})]}),A&&!s.is_personal&&e.jsxs(R,{className:"border-destructive",children:[e.jsxs($,{className:"p-4 sm:p-6",children:[e.jsxs(z,{className:"text-destructive flex items-center gap-2 text-base sm:text-lg",children:[e.jsx(xe,{className:"w-4 h-4 sm:w-5 sm:h-5"}),"Danger Zone"]}),e.jsx(G,{className:"text-xs sm:text-sm",children:"Irreversible actions that will permanently affect your workspace"})]}),e.jsx(U,{className:"p-4 sm:p-6",children:e.jsxs(pe,{children:[e.jsx(ue,{asChild:!0,children:e.jsxs(w,{variant:"destructive",className:"gap-2 w-full sm:w-auto text-sm",children:[e.jsx(qe,{className:"w-3 h-3 sm:w-4 sm:h-4"}),"Delete Workspace"]})}),e.jsxs(je,{className:"max-w-[95vw] sm:max-w-lg",children:[e.jsxs(we,{children:[e.jsx(fe,{className:"text-lg sm:text-xl",children:"Are you absolutely sure?"}),e.jsxs(ge,{className:"space-y-2 text-sm",children:[e.jsxs("p",{children:["This action cannot be undone. This will permanently delete the"," ",e.jsx("strong",{children:s.name})," workspace and remove all associated data:"]}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs sm:text-sm",children:[e.jsx("li",{children:"All workspace members will lose access"}),e.jsx("li",{children:"All generations and chat conversations will be deleted"}),e.jsx("li",{children:"All workspace credits will be lost"}),e.jsx("li",{children:"All workspace settings will be removed"})]})]})]}),e.jsxs(ve,{className:"flex-col sm:flex-row gap-2",children:[e.jsx(Ne,{className:"w-full sm:w-auto text-sm",children:"Cancel"}),e.jsx(ye,{onClick:T,disabled:q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 w-full sm:w-auto text-sm",children:q?"Deleting...":"Delete Worksp
1ace"})]})]})]})})]}),s.is_personal&&e.jsx(R,{className:"border-muted",children:e.jsx(U,{className:"pt-6",children:e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[e.jsx(xe,{className:"w-4 h-4"}),"Personal workspaces cannot be deleted"]})})})]}):e.jsxs(R,{className:"border-destructive",children:[e.jsxs($,{children:[e.jsxs(z,{className:"text-destructive flex items-center gap-2",children:[e.jsx(xe,{className:"w-5 h-5"}),"Workspace Not Found"]}),e.jsx(G,{children:"Unable to load workspace settings"})]}),e.jsxs(U,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"The workspace could not be loaded. This might be because:"}),e.jsxs("ul",{className:"list-disc list-inside text-sm text-muted-foreground space-y-1",children:[e.jsx("li",{children:"You don't have permission to access this workspace"}),e.jsx("li",{children:"The workspace has been deleted"}),e.jsx("li",{children:"There's a connection issue"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(w,{onClick:()=>_(),variant:"default",children:"Reload Workspace"}),e.jsx(w,{onClick:()=>i("/dashboard"),variant:"outline",children:"Go to Dashboard"})]})]})]})},vs=()=>{var Ie;const{currentWorkspace:s,refreshWorkspaces:_}=se(),{user:r}=Ye(),{toast:i}=Ce(),f=Se(),[g,D]=l.useState([]),[v,q]=l.useState([]),[b,L]=l.useState(!0),[m,P]=l.useState(""),[k,J]=l.useState("member"),[B,A]=l.useState(!1),[n,I]=l.useState(null),[d,T]=l.useState(null),[a,N]=l.useState(0),h=(s==null?void 0:s.role)==="owner"||(s==null?void 0:s.role)==="admin",W=(s==null?void 0:s.role)==="owner",de=((Ie=s==null?void 0:s.settings)==null?void 0:Ie.credit_model)||"pool";l.useEffect(()=>{s&&(te(),ae())},[s]);const te=async()=>{if(s){L(!0);try{const{data:t,error:c}=await o.from("workspace_members").select("user_id, role, joined_at, status").eq("workspace_id",s.workspace_id).eq("status","active").order("joined_at",{ascending:!0});if(c)throw c;const C=(t||[]).map(y=>y.user_id);let F=new Map;if(C.length>0){const{data:y}=await o.from("profiles").select("id, username").in("id",C);F=new Map((y||[]).map(u=>[u.id,u]))}const{data:Y}=await o.from("member_credit_allocations").select("user_id, allocated_credits, spent_credits").eq("workspace_id",s.workspace_id),p=new Map((Y||[]).map(y=>[y.user_id,y])),S=(t||[]).map(y=>{const u=p.get(y.user_id),X=F.get(y.user_id);return{user_id:y.user_id,username:(X==null?void 0:X.username)||"Unknown",role:y.role,joined_at:y.joined_at,status:y.status,allocated_credits:(u==null?void 0:u.allocated_credits)||0,spent_credits:(u==null?void 0:u.spent_credits)||0,remaining_credits:((u==null?void 0:u.allocated_credits)||0)-((u==null?void 0:u.spent_credits)||0)}});D(S)}catch(t){console.error("Error fetching members:",t),i({title:"Error",description:"Failed to load workspace members.",variant:"destructive"})}finally{L(!1)}}},ae=async()=>{if(s)try{const{data:t,error:c}=await o.from("workspace_invites").select("id, email, role, expires_at, status, invited_by").eq("workspace_id",s.workspace_id).eq("status","pending").order("created_at",{ascending:!1});if(c)throw c;const C=Array.from(new Set((t||[]).map(p=>p.invited_by)));let F=new Map;if(C.length>0){const{data:p}=await o.from("profiles").select("id, username").in("id",C);F=new Map((p||[]).map(S=>[S.id,S]))}const Y=(t||[]).map(p=>{var S;return{id:p.id,email:p.email,role:p.role,invited_by_username:((S=F.get(p.invited_by))==null?void 0:S.username)||"Unknown",expires_at:p.expires_at,status:p.status}});q(Y)}catch(t){console.error("Error fetching invites:",t)}},Ae=async()=>{if(!s||!m.trim()||!h)return;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(m)){i({title:"Invalid email",description:"Please enter a valid email address.",variant:"destructive"});return}A(!0);try{const c=m.trim().toLowerCase(),{data:C,error:F}=await o.from("workspace_invites").select("id, email, status").eq("workspace_id",s.workspace_id).eq("email",c).eq("status","pending").maybeSingle();if(F&&F.code!=="PGRST116")throw F;if(C){i({title:"Invite already pending",description:"An invitation is already pending for this email. Use 'Resend' in the Pending Invites table to send it again.",variant:"destructive"}),A(!1);return}const{data:Y,error:p}=await o.from("workspace_invites").insert({workspace_id:s.workspace_id,email:c,role:k,invited_by:r==null?void 0:r.id,status:"pending"}).select("id, token").single();if(p){if(p.code==="23505")i({title:"Invite already exists",description:"An invite has already been sent to this email.",variant:"destructive"});else throw p;return}const{data:S}=await o.from("profiles").select("username").eq("id",r==null?void 0:r.id).maybeSingle(),y=(S==null?void 0:S.username)||(r==null?void 0:r.email)||"Someone",u=s.name,me=`${"https://tingu.ai/".replace(/\/$/,"")}/invite/${Y.token}`,{error:Q}=await o.from("email_jobs").insert({job_type:"workspace_invite",recipient_email:c,payload:{workspace_name:u,inviter_name:y,role:k,invite_url:me}});Q?(console.error("Failed to queue email job:",Q),i({title:"Invite created",description:"Invitation created but email may not have been sent. You can resend from the Pending Invites table."})):i({title:"Invite sent",description:`Invitation sent to ${m}`}),P(""),J("member"),ae()}catch(c){console.error("Error inviting member:",c),i({title:"Error",description:"Failed to send invite.",variant:"destructive"})}finally{A(!1)}},He=async(t,c)=>{if(!(!s||!h))try{const{error:C}=await o.from("workspace_members").update({role:c}).eq("workspace_id",s.workspace_id).eq("user_id",t);if(C)throw C;i({title:"Role updated",description:"Member role has been updated."}),te()}catch(C){console.error("Error updating role:",C),i({title:"Error",description:"Failed to update member role.",variant:"destructive"})}},Oe=async t=>{if(!(!s||!h))try{const{error:c}=await o.from("workspace_members").delete().eq("workspace_id",s.workspace_id).eq("user_id",t);if(c)throw c;i({title:"Member removed",description:"Member has been removed from the workspace."}),te()}catch(c){console.error("Error removing member:",c),i({title:"Error",description:"Failed to remove member.",variant:"destructive"})}},$e=async t=>{if(!(!s||!h)){I(t);try{const{data:c,error:C}=await o.from("workspace_invites").select("email, role, workspace_id").eq("id",t).single();if(C)throw C;const F=new Date;F.setDate(F.getDate()+7);const Y=crypto.randomUUID(),{error:p}=await o.from("workspace_invites").update({token:Y,expires_at:F.toISOString(),invited_by:r==null?void 0:r.id}).eq("id",t);if(p)throw p;const{data:S}=await o.from("profiles").select("username").eq("id",r==null?void 0:r.id).maybeSingle(),y=(S==null?void 0:S.username)||(r==null?void 0:r.email)||"Someone",u=s.name,me=`${"https://tingu.ai/".replace(/\/$/,"")}/invite/${Y}`,{error:Q}=await o.from("email_jobs").insert({job_type:"workspace_invite",recipient_email:c.email,payload:{workspace_name:u,inviter_name:y,role:c.role,invite_url:me}});Q?(console.error("Failed to queue email job:",Q),i({title:"Invitation updated",description:"Invitation has been updated. Email may not have been sent. Please try again.",variant:"destructive"})):i({title:"Invitation resent",description:`Invitation has been resent to ${c.email}`}),ae()}catch(c){console.error("Error resending invite:",c),i({title:"Error",description:"Failed to resend invitation.",variant:"destructive"})}finally{I(null)}}},ze=async t=>{if(!(!s||!h))try{const{error:c}=await o.from("workspace_invites").delete().eq("id",t);if(c)throw c;i({title:"Invite cancelled",description:"Invitation has been cancelled."}),ae()}catch(c){console.error("Error cancelling invite:",c),i({title:"Error",description:"Failed to cancel invite.",variant:"destructive"})}},Be=async()=>
1{if(!(!s||!r||W))try{const{error:t}=await o.from("workspace_members").delete().eq("workspace_id",s.workspace_id).eq("user_id",r.id);if(t)throw t;i({title:"Left workspace",description:"You have left the workspace."}),await _(),f("/dashboard")}catch(t){console.error("Error leaving workspace:",t),i({title:"Error",description:"Failed to leave workspace.",variant:"destructive"})}},We=async()=>{if(!(!d||!s))try{const{error:t}=await o.from("member_credit_allocations").upsert({workspace_id:s.workspace_id,user_id:d.user_id,allocated_credits:a,spent_credits:d.spent_credits});if(t)throw t;i({title:"Credits allocated",description:`Allocated ${a} credits to ${d.username}`}),te(),T(null)}catch(t){console.error("Error allocating credits:",t),i({title:"Error",description:"Failed to allocate credits.",variant:"destructive"})}};return s?e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[h&&e.jsxs(R,{children:[e.jsxs($,{className:"p-4 sm:p-6",children:[e.jsxs(z,{className:"flex items-center gap-2 text-lg sm:text-xl",children:[e.jsx(rs,{className:"w-4 h-4 sm:w-5 sm:h-5"}),"Invite Member"]}),e.jsx(G,{className:"text-xs sm:text-sm",children:"Invite a new member to join this workspace"})]}),e.jsxs(U,{className:"space-y-4 p-4 sm:p-6",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"sm:col-span-2 space-y-2",children:[e.jsx(E,{htmlFor:"invite-email",className:"text-sm",children:"Email Address"}),e.jsx(K,{id:"invite-email",type:"email",placeholder:"[email protected]",value:m,onChange:t=>P(t.target.value),onKeyDown:t=>{t.key==="Enter"&&!B&&Ae()},className:"text-sm sm:text-base"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"invite-role",className:"text-sm",children:"Role"}),e.jsxs(ne,{value:k,onValueChange:t=>J(t),children:[e.jsx(le,{id:"invite-role",className:"text-sm sm:text-base",children:e.jsx(ce,{})}),e.jsxs(oe,{children:[e.jsx(M,{value:"member",children:"Member"}),e.jsx(M,{value:"admin",children:"Admin"})]})]})]})]}),e.jsxs(w,{onClick:Ae,disabled:!m.trim()||B,className:"gap-2 w-full sm:w-auto text-sm",children:[e.jsx(Me,{className:"w-3 h-3 sm:w-4 sm:h-4"}),B?"Sending...":"Send Invite"]})]})]}),e.jsxs(R,{children:[e.jsxs($,{className:"p-4 sm:p-6",children:[e.jsxs(z,{className:"text-lg sm:text-xl",children:["Workspace Members (",g.length,")"]}),e.jsx(G,{className:"text-xs sm:text-sm",children:"Manage members and their roles in this workspace"})]}),e.jsx(U,{className:"p-4 sm:p-6",children:b?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading members..."}):g.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No members found"}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(be,{children:[e.jsx(ke,{children:e.jsxs(V,{children:[e.jsx(j,{className:"text-xs sm:text-sm whitespace-nowrap",children:"Member"}),e.jsx(j,{className:"text-xs sm:text-sm whitespace-nowrap",children:"Role"}),de==="allocated"&&e.jsxs(e.Fragment,{children:[e.jsx(j,{className:"text-right text-xs sm:text-sm whitespace-nowrap",children:"Allocated"}),e.jsx(j,{className:"text-right text-xs sm:text-sm whitespace-nowrap",children:"Spent"}),e.jsx(j,{className:"text-right text-xs sm:text-sm whitespace-nowrap",children:"Remaining"})]}),e.jsx(j,{className:"text-xs sm:text-sm whitespace-nowrap",children:"Joined"}),h&&e.jsx(j,{className:"text-right text-xs sm:text-sm whitespace-nowrap",children:"Actions"})]})}),e.jsx(_e,{children:g.map(t=>e.jsxs(V,{children:[e.jsx(x,{children:e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx(ls,{className:"h-7 w-7 sm:h-8 sm:w-8",children:e.jsx(cs,{className:"text-[10px] sm:text-xs",children:t.username.charAt(0).toUpperCase()})}),e.jsx("span",{className:"font-medium text-xs sm:text-sm",children:t.username}),t.user_id===(r==null?void 0:r.id)&&e.jsx(Z,{variant:"outline",className:"text-[9px] sm:text-xs",children:"You"})]})}),e.jsx(x,{children:h&&t.role!=="owner"?e.jsxs(ne,{value:t.role,onValueChange:c=>He(t.user_id,c),children:[e.jsx(le,{className:"w-24 sm:w-32 text-xs sm:text-sm h-8 sm:h-10",children:e.jsx(ce,{})}),e.jsxs(oe,{children:[e.jsx(M,{value:"member",children:"Member"}),e.jsx(M,{value:"admin",children:"Admin"})]})]}):e.jsx(Z,{variant:"outline",className:"capitalize text-[10px] sm:text-xs",children:t.role})}),de==="allocated"&&e.jsxs(e.Fragment,{children:[e.jsx(x,{className:"text-right font-mono text-xs sm:text-sm whitespace-nowrap",children:t.allocated_credits}),e.jsx(x,{className:"text-right font-mono text-xs sm:text-sm text-muted-foreground whitespace-nowrap",children:t.spent_credits}),e.jsx(x,{className:"text-right font-mono text-xs sm:text-sm whitespace-nowrap",children:e.jsx("span",{className:t.remaining_credits<10?"text-destructive":"",children:t.remaining_credits})})]}),e.jsxs(x,{className:"text-xs sm:text-sm text-muted-foreground whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:H(new Date(t.joined_at),"MMM dd, yyyy")}),e.jsx("span",{className:"sm:hidden",children:H(new Date(t.joined_at),"MMM dd")})]}),h&&e.jsx(x,{className:"text-right",children:e.jsxs("div",{className:"flex gap-1 sm:gap-2 justify-end",children:[de==="allocated"&&t.role!=="owner"&&e.jsx(w,{size:"sm",variant:"outline",onClick:()=>{T(t),N(t.allocated_credits)},className:"text-xs h-7 sm:h-9 px-2 sm:px-3",children:"Allocate"}),t.role!=="owner"&&t.user_id!==(r==null?void 0:r.id)&&e.jsxs(pe,{children:[e.jsx(ue,{asChild:!0,children:e.jsx(w,{variant:"ghost",size:"sm",className:"text-destructive h-7 w-7 sm:h-9 sm:w-9 p-0",children:e.jsx(qe,{className:"w-3 h-3 sm:w-4 sm:h-4"})})}),e.jsxs(je,{className:"max-w-[95vw] sm:max-w-lg",children:[e.jsxs(we,{children:[e.jsx(fe,{className:"text-lg sm:text-xl",children:"Remove member?"}),e.jsxs(ge,{className:"text-sm",children:["Are you sure you want to remove ",t.username," from this workspace? They will lose access to all workspace content."]})]}),e.jsxs(ve,{className:"flex-col sm:flex-row gap-2",children:[e.jsx(Ne,{className:"w-full sm:w-auto text-sm",children:"Cancel"}),e.jsx(ye,{onClick:()=>Oe(t.user_id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 w-full sm:w-auto text-sm",children:"Remove"})]})]})]})]})})]},t.user_id))})]})})})]}),h&&v.length>0&&e.jsxs(R,{children:[e.jsxs($,{className:"p-4 sm:p-6",children:[e.jsxs(z,{className:"text-lg sm:text-xl",children:["Pending Invites (",v.length,")"]}),e.jsx(G,{className:"text-xs sm:text-sm",children:"Invitations that haven't been accepted yet"})]}),e.jsx(U,{className:"p-4 sm:p-6",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(be,{children:[e.jsx(ke,{children:e.jsxs(V,{children:[e.jsx(j,{className:"text-xs sm:text-sm whitespace-nowrap",children:"Email"}),e.jsx(j,{className:"text-xs sm:text-sm whitespace-nowrap",children:"Role"}),e.jsx(j,{className:"text-xs sm:text-sm whitespace-nowrap",children:"Invited By"}),e.jsx(j,{className:"text-xs sm:text-sm whitespace-nowrap",children:"Expires"}),e.jsx(j,{className:"text-right text-xs sm:text-sm whitespace-nowrap",children:"Actions"})]})}),e.jsx(_e,{children:v.map(t=>e.jsxs(V,{children:[e.jsx(x,{className:"font-medium text-xs sm:text-sm",children:t.email}),e.jsx(x,{children:e.jsx(Z,{variant:"outline",className:"capitalize text-[10px] sm:text-xs",children:t.role})}),e.jsx(x,{className:"text-xs sm:text-sm text-muted-foreground whitespace-nowrap",children:t.invited_by_username}),e.jsxs(x,{className:"text-xs sm:text-sm text-muted-foreground whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:H(new Date(t.expires_at),"MMM dd, yyyy")}),e.jsx("span",{className:"sm:hidden",children:H(new Date(t.expires_at),"MMM dd")})]}),e.jsx(x,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1 sm:gap-2",children:[e.jsxs(w,{variant:"outline",size:"sm",onClick:()=>$e(t.id),disabled:n===t.id,className:"gap-1 text-xs h-7 sm:h-9 px-2 sm:px-3",children:[e.jsx(Me,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden sm:inline",children:n===t.id?"Resending...":"Resend"}),e.jsx("span",{className:"sm:hidden",children:n===t.id?"...":"Resend"})]}),e.jsx(w,{variant:"ghost",size:"sm",onClick:()=>ze(t.id),className:"text-destructive text-xs h-7 sm:h-9 px-2 sm:px-3",children:"Cancel"})]})})]},t.id))})]})})})]}),!W&&e.jsxs(e.Fragment,{children:[e.jsx(O,{}),e.jsxs(R,{className:"border-muted",children:[e.jsxs($,{children:[e.jsx(z,{className:"text-base",children:"Leave Worksp
1ace"}),e.jsx(G,{children:"Remove yourself from this workspace"})]}),e.jsx(U,{children:e.jsxs(pe,{children:[e.jsx(ue,{asChild:!0,children:e.jsxs(w,{variant:"outline",className:"gap-2",children:[e.jsx(os,{className:"w-4 h-4"}),"Leave Workspace"]})}),e.jsxs(je,{children:[e.jsxs(we,{children:[e.jsx(fe,{children:"Leave workspace?"}),e.jsxs(ge,{children:["Are you sure you want to leave ",s.name,"? You will lose access to all workspace content. You'll need a new invitation to rejoin."]})]}),e.jsxs(ve,{children:[e.jsx(Ne,{children:"Cancel"}),e.jsx(ye,{onClick:Be,children:"Leave Workspace"})]})]})]})})]})]}),e.jsx(Ge,{open:!!d,onOpenChange:()=>T(null),children:e.jsxs(Ve,{className:"max-w-[95vw] sm:max-w-md",children:[e.jsxs(Ze,{children:[e.jsx(Je,{className:"text-lg sm:text-xl",children:"Allocate Credits"}),e.jsxs(Ke,{className:"text-sm",children:["Assign credits to ",d==null?void 0:d.username]})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm",children:"Current Allocation"}),e.jsx("div",{className:"text-xl sm:text-2xl font-mono",children:(d==null?void 0:d.allocated_credits)||0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm",children:"Spent Credits"}),e.jsx("div",{className:"text-xs sm:text-sm font-mono text-muted-foreground",children:(d==null?void 0:d.spent_credits)||0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"allocation-amount",className:"text-sm",children:"New Allocation"}),e.jsx(K,{id:"allocation-amount",type:"number",min:"0",value:a,onChange:t=>N(Number(t.target.value)),className:"text-sm sm:text-base"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Remaining after change: ",a-((d==null?void 0:d.spent_credits)||0)]})]})]}),e.jsxs(Xe,{className:"flex-col sm:flex-row gap-2",children:[e.jsx(w,{variant:"outline",onClick:()=>T(null),className:"w-full sm:w-auto text-sm",children:"Cancel"}),e.jsx(w,{onClick:We,className:"w-full sm:w-auto text-sm",children:"Allocate Credits"})]})]})})]}):null},Ns=()=>{const{currentWorkspace:s,refreshWorkspaces:_}=se(),{toast:r}=Ce(),[i,f]=l.useState(!0),[g,D]=l.useState(!0),[v,q]=l.useState(!1),[b,L]=l.useState(!1),m=(s==null?void 0:s.role)==="owner"||(s==null?void 0:s.role)==="admin";l.useEffect(()=>{s&&(f(s.settings.generations_shared),D(s.settings.chat_shared))},[s]),l.useEffect(()=>{if(s){const k=i!==s.settings.generations_shared||g!==s.settings.chat_shared;L(k)}},[i,g,s]);const P=async()=>{if(!(!s||!m)){q(!0);try{const{error:k}=await o.from("workspaces").update({settings:{generations_shared:i,chat_shared:g}}).eq("id",s.workspace_id);if(k)throw k;r({title:"Privacy settings updated",description:"Your workspace privacy settings have been saved."}),L(!1),await _()}catch(k){console.error("Error updating privacy settings:",k),r({title:"Error",description:"Failed to update privacy settings.",variant:"destructive"})}finally{q(!1)}}};return s?e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(ms,{children:[e.jsx(as,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx(xs,{className:"text-sm sm:text-base",children:"About Privacy Settings"}),e.jsxs(hs,{className:"text-xs sm:text-sm space-y-2 mt-2",children:[e.jsx("p",{children:"Privacy settings control how content is shared within your workspace. These settings only affect workspace members."}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 mt-2",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Enabled:"})," All members can see each other's content"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Disabled:"})," Members only see their own content"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Private content:"})," Always hidden from others, regardless of settings"]})]})]})]}),e.jsxs(R,{children:[e.jsxs($,{className:"p-4 sm:p-6",children:[e.jsxs(z,{className:"flex items-center gap-2 text-lg sm:text-xl",children:[e.jsx(Le,{className:"w-4 h-4 sm:w-5 sm:h-5"}),"Workspace Sharing Settings"]}),e.jsx(G,{className:"text-xs sm:text-sm",children:"Control what content is visible to all workspace members"})]}
1),e.jsxs(U,{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex-1 space-y-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{htmlFor:"share-generations",className:"text-sm sm:text-base font-medium",children:"Share Generations"}),i?e.jsx(Ee,{className:"w-3 h-3 sm:w-4 sm:h-4 text-primary flex-shrink-0"}):e.jsx(De,{className:"w-3 h-3 sm:w-4 sm:h-4 text-muted-foreground flex-shrink-0"})]}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"When enabled, all workspace members can view each other's image and video generations in the History panel. Members can still mark individual generations as private to keep them hidden."}),!i&&e.jsx("p",{className:"text-[10px] sm:text-xs text-orange-600 mt-2",children:"Currently disabled: Members can only see their own generations"})]}),e.jsx(he,{id:"share-generations",checked:i,onCheckedChange:f,disabled:!m,className:"flex-shrink-0"})]}),e.jsx(O,{}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex-1 space-y-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{htmlFor:"share-chat",className:"text-sm sm:text-base font-medium",children:"Share Chat Conversations"}),g?e.jsx(Ee,{className:"w-3 h-3 sm:w-4 sm:h-4 text-primary flex-shrink-0"}):e.jsx(De,{className:"w-3 h-3 sm:w-4 sm:h-4 text-muted-foreground flex-shrink-0"})]}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"When enabled, all workspace members can view each other's AI chat conversations in the Chat panel. Incognito chats are always private and never shared."}),!g&&e.jsx("p",{className:"text-[10px] sm:text-xs text-orange-600 mt-2",children:"Currently disabled: Members can only see their own conversations"})]}),e.jsx(he,{id:"share-chat",checked:g,onCheckedChange:D,disabled:!m,className:"flex-shrink-0"})]}),!m&&e.jsxs(e.Fragment,{children:[e.jsx(O,{}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Only workspace owners and admins can change privacy settings"})]}),m&&b&&e.jsxs(e.Fragment,{children:[e.jsx(O,{}),e.jsxs("div",{className:"flex flex-col sm:flex-row justify-end gap-2",children:[e.jsx(w,{variant:"outline",onClick:()=>{f(s.settings.generations_shared),D(s.settings.chat_shared)},disabled:v,className:"w-full sm:w-auto text-sm",children:"Cancel"}),e.jsx(w,{onClick:P,disabled:v,className:"w-full sm:w-auto text-sm",children:v?"Saving...":"Save Changes"})]})]})]})]}),e.jsxs(R,{children:[e.jsx($,{className:"p-4 sm:p-6",children:e.jsx(z,{className:"text-sm sm:text-base",children:"How Privacy Works"})}),e.jsxs(U,{className:"space-y-3 text-xs sm:text-sm text-muted-foreground p-4 sm:p-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-foreground",children:"Workspace Sharing (These Settings)"}),e.jsx("p",{children:"Controls the default visibility of content within the workspace. When enabled, members can see each other's work. When disabled, content is private by default."})]}),e.jsx(O,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-foreground",children:"Private Content Flag"}),e.jsxs("p",{children:['Individual items (generations, chats) can be marked as "private" regardless of workspace settings. Private content is ',e.jsx("strong",{children:"always"})," hidden from other members."]})]}),e.jsx(O,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-foreground",children:"Incognito Mode (Chat Only)"}),e.jsx("p",{children:"Incognito chats do not use workspace credits and are always private. They won't appear in the chat history for any workspace members."})]})]})]})]}):null},ys=()=>{const{currentWorkspace:s}=se(),[_,r]=l.useState([]),[i,f]=l.useState(!0),[g,D]=l.useState("all"),[v,q]=l.useState("all"),[b,L]=l.useState(),[m,P]=l.useState();l.useEffect(()=>{s&&k()},[s,g,v,b,m]);const k=async()=>
1{if(s){f(!0);try{let n=o.from("credit_transactions").select("*").eq("workspace_id",s.workspace_id).order("created_at",{ascending:!1}).limit(100);if(g!=="all"&&(n=n.eq("status",g)),v!=="all"&&(n=n.eq("type",v)),b&&(n=n.gte("created_at",b.toISOString())),m){const h=new Date(m);h.setHours(23,59,59,999),n=n.lte("created_at",h.toISOString())}const{data:I,error:d}=await n;if(d)throw d;const T=Array.from(new Set((I||[]).map(h=>h.user_id)));let a=new Map;if(T.length>0){const{data:h}=await o.from("profiles").select("id, username").in("id",T);a=new Map((h||[]).map(W=>[W.id,W]))}const N=(I||[]).map(h=>{var W;return{...h,username:((W=a.get(h.user_id))==null?void 0:W.username)||"Unknown User"}});r(N)}catch(n){console.error("Error fetching transactions:",n),Qe.error("Failed to load transaction history")}finally{f(!1)}}},J=n=>{const I={completed:{icon:es,variant:"default",label:"Completed",color:"text-green-500"},pending:{icon:ws,variant:"secondary",label:"Pending",color:"text-yellow-500"},failed:{icon:js,variant:"destructive",label:"Failed",color:"text-red-500"},refunded:{icon:ds,variant:"outline",label:"Refunded",color:"text-blue-500"}},{icon:d,variant:T,label:a,color:N}=I[n]||I.completed;return e.jsxs(Z,{variant:T,className:"gap-1 text-[10px] sm:text-xs",children:[e.jsx(d,{className:ee("w-2.5 h-2.5 sm:w-3 sm:h-3",N)}),a]})},B=n=>{const I={spend:"bg-red-500/10 text-red-500 border-red-500/20",refund:"bg-green-500/10 text-green-500 border-green-500/20",purchase:"bg-blue-500/10 text-blue-500 border-blue-500/20",credit:"bg-cyan-500/10 text-cyan-500 border-cyan-500/20",deduction:"bg-orange-500/10 text-orange-500 border-orange-500/20"};return e.jsx(Z,{variant:"outline",className:ee("capitalize text-[10px] sm:text-xs",I[n]),children:n})},A=()=>{D("all"),q("all"),L(void 0),P(void 0)};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(R,{className:"p-3 sm:p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground block",children:"Status"}),e.jsxs(ne,{value:g,onValueChange:D,children:[e.jsx(le,{className:"h-9 text-sm",children:e.jsx(ce,{})}),e.jsxs(oe,{children:[e.jsx(M,{value:"all",children:"All Status"}),e.jsx(M,{value:"completed",children:"Completed"}),e.jsx(M,{value:"pending",children:"Pending"}),e.jsx(M,{value:"failed",children:"Failed"}),e.jsx(M,{value:"refunded",children:"Refunded"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground block",children:"Type"}),e.jsxs(ne,{value:v,onValueChange:q,children:[e.jsx(le,{className:"h-9 text-sm",children:e.jsx(ce,{})}),e.jsxs(oe,{children:[e.jsx(M,{value:"all",children:"All Types"}),e.jsx(M,{value:"spend",children:"Spend"}),e.jsx(M,{value:"refund",children:"Refund"}),e.jsx(M,{value:"purchase",children:"Purchase"}),e.jsx(M,{value:"credit",children:"Credit"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground block",children:"Start Date"}),e.jsxs(Fe,{children:[e.jsx(Pe,{asChild:!0,children:e.jsxs(w,{variant:"outline",className:ee("w-full justify-start text-left font-normal h-9 text-sm",!b&&"text-muted-foreground"),children:[e.jsx(Ue,{className:"mr-2 h-3.5 w-3.5 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:b?H(b,"PPP"):"Pick a date"}),e.jsx("span",{className:"sm:hidden",children:b?H(b,"MMM d"):"Start"})]})}),e.jsx(Re,{className:"w-auto p-0",children:e.jsx(Te,{mode:"single",selected:b,onSelect:L,initialFocus:!0})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground block",children:"End Date"}),e.jsxs(Fe,{children:[e.jsx(Pe,{asChild:!0,children:e.jsxs(w,{variant:"outline",className:ee("w-full justify-start text-left font-normal h-9 text-sm",!m&&"text-muted-foreground"),children:[e.jsx(Ue,{className:"mr-2 h-3.5 w-3.5 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:m?H(m,"PPP"):"Pick a date"}),e.jsx("span",{className:"sm:hidden",children:m?H(m,"MMM d"):"End"})]})}),e.jsx(Re,{className:"w-auto p-0",children:e.jsx(Te,{mode:"single",selected:m,onSelect:P,initialFocus:!0})})]})]})]}),e.jsxs("div",{className:"flex gap-2 mt-3 sm:mt-4",children:[e.jsxs(w,{variant:"outline",size:"sm",onClick:k,title:"Refresh",className:"h-9 text-xs sm:text-sm",children:[e.jsx(us,{className:"w-3 h-3 sm:w-4 sm:h-4 mr-1 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]}),e.jsx(w,{variant:"ghost",onClick:A,className:"h-9 text-xs sm:text-sm",children:"Clear Filters"})]})]}),e.jsx(R,{children:e.jsx(U,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(be,{children:[e.jsx(ke,{children:e.jsxs(V,{children:[e.jsx(j,{className:"text-xs sm:text-sm whitespace-nowrap",children:"Date"}),e.jsx(j,{className:"text-xs sm:text-sm whitespace-nowrap",children:"User"}),e.jsx(j,{className:"text-xs sm:text-sm whitespace-nowrap",children:"Type"}),e.jsx(j,{className:"text-xs sm:text-sm whitespace-nowrap",children:"Description"}),e.jsx(j,{className:"text-right text-xs sm:text-sm whitespace-nowrap",children:"Amount"}),e.jsx(j,{className:"text-right text-xs sm:text-sm whitespace-nowrap hidden sm:table-cell",children:"Balance After"}),e.jsx(j,{className:"text-xs sm:text-sm whitespace-nowrap",children:"Status"})]})}),e.jsx(_e,{children:i?Array.from({length:5}).map((n,I)=>e.jsx(V,{children:Array.from({length:7}).map((d,T)=>e.jsx(x,{children:e.jsx(ps,{className:"h-4 w-full"})},T))},I)):_.length===0?e.jsx(V,{children:e.jsx(x,{colSpan:7,className:"text-center text-muted-foreground py-8 text-xs sm:text-sm",children:"No transactions foun
1d"})}):_.map(n=>e.jsxs(V,{children:[e.jsxs(x,{className:"font-mono text-[10px] sm:text-xs whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:H(new Date(n.created_at),"MMM dd, yyyy HH:mm")}),e.jsx("span",{className:"sm:hidden",children:H(new Date(n.created_at),"MMM dd, HH:mm")})]}),e.jsx(x,{className:"font-medium text-xs sm:text-sm whitespace-nowrap",children:n.username}),e.jsx(x,{className:"whitespace-nowrap",children:B(n.type)}),e.jsx(x,{className:"max-w-[150px] sm:max-w-xs truncate text-xs sm:text-sm",title:n.description,children:n.description}),e.jsxs(x,{className:ee("text-right font-semibold tabular-nums text-xs sm:text-sm whitespace-nowrap",n.amount<0?"text-red-500":"text-green-500"),children:[n.amount>0?"+":"",n.amount.toLocaleString()]}),e.jsx(x,{className:"text-right font-mono tabular-nums text-xs sm:text-sm whitespace-nowrap hidden sm:table-cell",children:n.balance_after.toLocaleString()}),e.jsx(x,{className:"whitespace-nowrap",children:J(n.status)})]},n.id))})]})})})})]})},Js=()=>{const{currentWorkspace:s}=se(),_=Se(),i=new URLSearchParams(window.location.search).get("tab");l.useEffect(()=>{i==="credits"&&_("/dashboard/subscriptions",{replace:!0})},[i,_]);const f=i==="credits"?"general":i||"general";return e.jsxs("div",{className:"flex flex-col h-full lg:overflow-hidden p-3 sm:p-4 lg:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-8",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold mb-2",children:"Workspace Settings"}),e.jsxs("p",{className:"text-sm sm:text-base text-muted-foreground capitalize",children:["Manage your"," ",s!=null&&s.name.toLowerCase().includes("workspace")?s==null?void 0:s.name:(s==null?void 0:s.name)+" workspace"," ","settings and preferences"]})]}),e.jsxs(ss,{defaultValue:f,className:"flex-1 flex flex-col lg:overflow-hidden",children:[e.jsxs(ts,{className:"grid w-full grid-cols-4 rounded-none border-b h-auto p-0 bg-transparent overflow-x-auto",children:[e.jsxs(re,{value:"general",className:"flex flex-col sm:flex-row gap-1 sm:gap-2 rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent text-[10px] sm:text-sm px-2 sm:px-3 py-3 sm:py-2.5 min-h-[44px]",children:[e.jsx(is,{className:"w-5 h-5 sm:w-5 sm:h-5"}),e.jsx("span",{children:"General"})]}),e.jsxs(re,{value:"members",className:"flex flex-col sm:flex-row gap-1 sm:gap-2 rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent text-[10px] sm:text-sm px-2 sm:px-3 py-3 sm:py-2.5 min-h-[44px]",children:[e.jsx(fs,{className:"w-5 h-5 sm:w-5 sm:h-5"}),e.jsx("span",{children:"Members"})]}),e.jsxs(re,{value:"transactions",className:"flex flex-col sm:flex-row gap-1 sm:gap-2 rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent text-[10px] sm:text-sm px-2 sm:px-3 py-3 sm:py-2.5 min-h-[44px]",children:[e.jsx(ns,{className:"w-5 h-5 sm:w-5 sm:h-5"}),e.jsx("span",{children:"History"})]}),e.jsxs(re,{value:"privacy",className:"flex flex-col sm:flex-row gap-1 sm:gap-2 rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent text-[10px] sm:text-sm px-2 sm:px-3 py-3 sm:py-2.5 min-h-[44px]",children:[e.jsx(Le,{className:"w-5 h-5 sm:w-5 sm:h-5"}),e.jsx("span",{children:"Privacy"})]})]}),e.jsxs("div",{className:"flex-1 lg:overflow-y-auto",children:[e.jsx(ie,{value:"general",className:"mt-0 h-full",children:e.jsx("div",{className:"mx-auto py-4 sm:py-6 lg:py-8 px-3 sm:px-4 lg:px-6",children:e.jsx(gs,{})})}),e.jsx(ie,{value:"members",className:"mt-0 h-full",children:e.jsx("div",{className:"mx-auto py-4 sm:py-6 lg:py-8 px-3 sm:px-4 lg:px-6",children:e.jsx(vs,{})})}),e.jsx(ie,{value:"transactions",className:"mt-0 h-full",children:e.jsx("div",{className:"mx-auto py-4 sm:py-6 lg:py-8 px-3 sm:px-4 lg:px-6",children:e.jsx(ys,{})})}),e.jsx(ie,{value:"privacy",className:"mt-0 h-full",children:e.jsx("div",{className:"mx-auto py-4 sm:py-6 lg:py-8 px-3 sm:px-4 lg:px-6",children:e.jsx(Ns,{})})})]})]})]})};export{Js as SettingsPanel};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.