1import{u as N,r as a,s as p,j as e,C as S,d as w,B as f,f as P,e as k,v as h}from"./index-QPhecp7O.js";import{u as $}from"./useDefaultShareVisibility-PJaaKmBJ.js";import{A}from"./arrow-left-1zOQukEW.js";import{G as L}from"./globe-J2Z7hv67.js";import{U as V}from"./users-DT6Ui4NJ.js";import{L as E}from"./lock-_e-nMnrw.js";import{A as U}from"./arrow-right-Dy7fK3Gp.js";const T=()=>{const c=N(),[v,b]=a.useState(null),[l,x]=a.useState(null),[o,n]=a.useState(!1),{defaultVisibility:d,updateDefaultVisibility:g,isLoading:u,hasSetPreference:m}=$(v),i=m===!0;a.useEffect(()=>{p.auth.getSession().then(({data:{session:t}})=>{b((t==null?void 0:t.user)??null)});const{data:{subscription:s}}=p.auth.onAuthStateChange((t,r)=>{b((r==null?void 0:r.user)??null)});return()=>s.unsubscribe()},[]),a.useEffect(()=>{!u&&m&&d&&x(d)},[u,m,d]);const y=async()=>{if(!l){h.error("Please select a privacy preference");return}n(!0);const s=await g(l);n(!1),s?(h.success("Privacy preference saved!"),c("/settings")):h.error("Failed to save preference. Please try again.")},j=async()=>{n(!0),await g("connections"),n(!1),c("/settings")},C=[{value:"public",icon:L,title:"Public",description:"By default, make my Tastes and Stashes shared with the Fyra community",color:"text-green-500",bgColor:"bg-green-500/10",borderColor:"border-green-500"},{value:"connections",icon:V,title:"Connections Only",description:"Share my Stashes with my friends and allow my friends to see my recent saves in their feed",color:"text-blue-500",bgColor:"bg-blue-500/10",borderColor:"border-blue-500"},{value:"private",icon:E,title:"Private",description:"Keep my Vault just for me, unless I decide to share a particular Stash",color:"text-muted-foreground",bgColor:"bg-muted",borderColor:"border-primary"}];return u?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx("div",{className:"animate-pulse text-muted-foreground",children:"Loading..."})}):e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(S,{className:"w-full max-w-lg",children:[e.jsxs(w,{className:"text-center",children:[i&&e.jsx(f,{variant:"ghost",size:"icon",onClick:()=>c(-1),className:"absolute left-4 top-4",children:e.jsx(A,{className:"h-5 w-5"})}),e.jsx(P,{className:`text-2xl ${i?"px-10":""}`,children:i?"Update Privacy Preferences":"Set Your Vault Privacy Preferences?"})]}),e.jsxs(k,{className:"space-y-4",children:[C.map(s=>{const t=s.icon,r=l===s.value;return e.jsx("button",{onClick:()=>x(s.value),className:`w-full p-4 rounded-lg border-2 transition-all text-left ${r?`${s.borderColor} ${s.bgColor}`:"border-border hover:border-muted-foreground/50"}`,children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:`p-2 rounded-full ${s.bgColor}`,children:e.jsx(t,{className:`h-5 w-5 ${s.color}`})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-semibold",children:s.title}),e.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:s.description})]})]})},s.value)}),e.jsxs("div",{className:"pt-4 space-y-3",children:[e.jsxs(f,{onClick:y,className:"w-full",disabled:!l||o,children:[o?"Saving...":"Continue",e.jsx(U,{className:"ml-2 h-4 w-4"})]}),!i&&e.jsx(f,{variant:"ghost",onClick:j,className:"w-full text-muted-foreground",disabled:o,children:"Skip for now (defaults to connections)"})]})]})]})})};export{T as default};
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.