1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,879646,457650,e=>{"use strict";var r=e.i(260293),s=e.i(809528),t=e.i(822388),a=e.i(707061),i=e.i(567087),n=e.i(477272),l=e.i(63893),d=e.i(699375),o=e.i(474831),c=(0,o.createServerReference)("0029eb8bbb7680d439d800263f4528beabe979c756",o.callServer,void 0,o.findSourceMapURL,"getFeedPrefsFull"),m=e.i(482343),u=e.i(975157);let x=["FEMALE","MALE","TRANS"],h=["both","realistic","anime"],g=["show","hide"],b=["always","wifi","never"];function p({active:e,onClick:s,children:t}){return(0,r.jsx)("button",{type:"button",onClick:s,"aria-pressed":e,className:(0,u.cn)("h-8 rounded-full px-3.5 text-xs font-medium ring-1 transition-colors",e?"bg-primary/15 text-foreground ring-primary/50":"bg-black/5 text-muted-foreground ring-black/10 hover:text-foreground dark:bg-white/5 dark:ring-white/10"),children:t})}function f({label:e,hint:s,children:t}){return(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:e}),s?(0,r.jsx)("p",{className:"-mt-1 text-xs text-muted-foreground",children:s}):null,(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t})]})}function j({label:e,hint:s,checked:t,onChange:a}){return(0,r.jsxs)("label",{className:"flex items-center justify-between gap-4 rounded-2xl bg-black/[0.03] px-4 py-3 ring-1 ring-black/5 dark:bg-white/[0.04] dark:ring-white/10",children:[(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{className:"block text-sm font-medium",children:e}),(0,r.jsx)("span",{className:"block text-xs text-muted-foreground",children:s})]}),(0,r.jsx)(d.Switch,{checked:t,onCheckedChange:a})]})}e.s(["FeedSettings",0,()=>{let e=(0,a.useTranslations)("settings"),[d,o]=(0,s.useState)(null),[,u]=(0,s.useTransition)();(0,s.useEffect)(()=>{c().then(e=>o(e.success?e.data:null))},[]);let v=e=>{d&&(o({...d,prefs:{...d.prefs,...e}}),u(async()=>{let r=await (0,m.updateFeedPrefs)(e);if(!r.success){o(d),l.toast.error(r.error);return}o(e=>e?{...e,prefs:r.data,mutedTags:e.mutedTags.filter(e=>r.data.mutedTagIds.includes(e.id)),mutedAuthors:e.mutedAuthors.filter(e=>r.data.mutedAuthorIds.includes(e.id))}:e)}))};if(!d)return(0,r.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,r.jsx)("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})});let N=d.prefs;return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"mb-4 border-b border-gray-200 pb-3 dark:border-gray-700",children:[(0,r.jsx)("h3",{className:"text-lg font-medium",children:e("feed.title")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("feed.subtitle")})]}),(0,r.jsx)(f,{label:e("feed.genders"),hint:e("feed.gendersHint"),children:x.map(s=>(0,r.jsx)(p,{active:N.genders.includes(s),onClick:()=>(e=>{let r=new Set(N.genders);if(r.has(e)){if(1===r.size)return;r.delete(e)}else r.add(e);v({genders:x.filter(e=>r.has(e))})})(s),children:e(`feed.gender.${s}`)},s))}),(0,r.jsx)(f,{label:e("feed.style"),children:h.map(s=>(0,r.jsx)(p,{active:N.style===s,onClick:()=>v({style:s}),children:e(`feed.styles.${s}`)},s))}),(0,r.jsx)(f,{label:e("feed.nsfw"),hint:e("feed.nsfwHint"),children:g.map(s=>(0,r.jsx)(p,{active:N.nsfw===s,onClick:()=>v({nsfw:s}),children:e(`feed.nsfwModes.${s}`)},s))}),"hide"!==N.nsfw?(0,r.jsx)(f,{label:e("feed.explicitness"),children:[1,2,3].map(s=>(0,r.jsx)(p,{active:N.maxExplicitness===s,onClick:()=>v({maxExplicitness:s}),children:e(`feed.explicitnessLevels.${s}`)},s))}):null,(0,r.jsx)(f,{label:e("feed.autoplay"),children:b.map(s=>(0,r.jsx)(p,{active:N.autoplay===s,onClick:()=>v({autoplay:s}),children:e(`feed.autoplayModes.${s}`)},s))}),(0,r.jsx)(f,{label:e("feed.defaultVisibility"),hint:e("feed.defaultVisibilityHint"),children:["PUBLIC","FOLLOWERS"].map(s=>(0,r.jsx)(p,{active:N.defaultVisibility===s,onClick:()=>v({defaultVisibility:s}),children:e(`feed.visibility.${s}`)},s))}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(j,{label:e("feed.hideSeen"),hint:e("feed.hideSeenHint"),checked:N.hideSeen,onChange:e=>v({hideSeen:e})}),(0,r.jsx)(j,{label:e("feed.promptReveal"),hint:e("feed.promptRevealHint"),checked:N.promptReveal,onChange:e=>v({promptReveal:e})}),(0,r.jsx)(j,{label:e("feed.snippetConsent"),hint:e("feed.snippetConsentHint"),checked:N.allowSnippetInclusion,onChange:e=>v({allowSnippetInclusion:e})})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:e("feed.mutedTags")}),0===d.mutedTags.length?(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:e("feed.mutedNone")}):(0,r.jsx)("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:d.mutedTags.map(s=>(0,r.jsxs)("span",{className:"inline-flex h-7 items-center gap-1 rounded-full bg-black/5 pl-2.5 pr-1 text-xs ring-1 ring-black/10 dark:bg-white/5 dark:ring-white/10",children:["#",s.name,(0,r.jsx)("button",{type:"button",onClick:()=>v({mutedTagIds:N.mutedTagIds.filter(e=>e!==s.id)}),className:"flex h-5 w-5 items-center justify-center rounded-full hover:bg-black/10 dark:hover:bg-white/10","aria-label":e("feed.unmute"),children:(0,r.jsx)(n.X,{className:"h-3 w-3"})})]},s.id))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:e("feed.mutedCreators")}),0===d.mutedAuthors.length?(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:e("feed.mutedNone")}):(0,r.jsx)("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:d.mutedAuthors.map(s=>(0,r.jsxs)("span",{className:"inline-flex h-7 items-center gap-1 rounded-full bg-black/5 pl-2.5 pr-1 text-xs ring-1 ring-black/10 dark:bg-white/5 dark:ring-white/10",children:["@",s.username,(0,r.jsx)("button",{type:"button",onClick:()=>v({mutedAuthorIds:N.mutedAuthorIds.filter(e=>e!==s.id)}),className:"flex h-5 w-5 items-center justify-center rounded-full hover:bg-black/10 dark:hover:bg-white/10","aria-label":e("feed.unmute"),children:(0,r.jsx)(n.X,{className:"h-3 w-3"})})]},s.id))})]})]}),(0,r.jsxs)(t.default,{href:"/feed/saved",className:"inline-flex items-center gap-2 text-sm font-medium text-primary",children:[(0,r.jsx)(i.Bookmark,{className:"h-4 w-4"})," ",e("feed.savedLink")]})]})}],879646);var v=e.i(593718);e.s(["div",()=>v.MotionDiv],457650)},690994,e=>{"use strict";let r=(0,e.i(286796).default)("Theater",[["path",{d:"M2 10s3-3 3-8",key:"3xiif0"}],["path",{d:"M22 10s-3-3-3-8",key:"ioaa5q"}
1],["path",{d:"M10 2c0 4.4-3.6 8-8 8",key:"16fkpi"}],["path",{d:"M14 2c0 4.4 3.6 8 8 8",key:"b9eulq"}],["path",{d:"M2 10s2 2 2 5",key:"1au1lb"}],["path",{d:"M22 10s-2 2-2 5",key:"qi2y5e"}],["path",{d:"M8 15h8",key:"45n4r"}],["path",{d:"M2 22v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1",key:"1vsc2m"}],["path",{d:"M14 22v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1",key:"hrha4u"}]]);e.s(["Theater",()=>r],690994)},164068,e=>{"use strict";e.i(257855);var r=e.i(474831),s=(0,r.createServerReference)("4089383da75442c893844541cc38f5dc1bf912ae5d",r.callServer,void 0,r.findSourceMapURL,"checkUsernameAvailability"),t=(0,r.createServerReference)("707f758a8f8ccd02921f55282907ababe58198372f",r.callServer,void 0,r.findSourceMapURL,"updateUserProfile"),a=(0,r.createServerReference)("409daabce943b75b953e338806ad02e635a3411527",r.callServer,void 0,r.findSourceMapURL,"getAvatarSignedUrl"),i=(0,r.createServerReference)("003beb37c58ad6e1b298b5e14868baa69f94b84a5f",r.callServer,void 0,r.findSourceMapURL,"generateRandomAvatarSeed");r.callServer,r.findSourceMapURL,e.i(133285),e.s(["checkUsernameAvailability",()=>s,"generateRandomAvatarSeed",()=>i,"getAvatarSignedUrl",()=>a,"updateUserProfile",()=>t],164068)},848061,552982,552941,248338,664965,700235,177275,347558,927865,345301,379146,490271,e=>{"use strict";var r=e.i(260293),s=e.i(809528),t=e.i(707061),a=e.i(519455),i=e.i(63893),n=e.i(168867),l=e.i(637369),d=e.i(316058);e.i(879388);var o=e.i(930368),c=e.i(164068),m=e.i(363546),u=e.i(548136),x=e.i(822388),h=e.i(317877),g=e.i(793479),b=e.i(110204),p=e.i(624687),f=(e.i(629288),e.i(967489)),j=e.i(474831),v=(0,j.createServerReference)("00e2b105300498abec53b6099d5d00732c357fb50d",j.callServer,void 0,j.findSourceMapURL,"getMyProfileDetails"),N=(0,j.createServerReference)("40f1734edde52edb6634757e69e1242e89d620a952",j.callServer,void 0,j.findSourceMapURL,"updateProfileDetails"),y=e.i(299451),w=e.i(746513);e.i(680909);var S=e.i(975157);let k="__none__";function C(){let e=(0,t.useTranslations)("mp.profile"),[l,d]=(0,s.use
1State)(null),[o,c]=(0,s.useState)(!1),[m,u]=(0,s.useState)(""),[j,C]=(0,s.useState)(""),[T,E]=(0,s.useState)("EVERYONE"),[A,R]=(0,s.useState)(k),[L,P]=(0,s.useState)(!1),[I,M]=(0,s.useState)({});if((0,s.useEffect)(()=>{let e=!0;return v().then(r=>{if(e){if(!r.success)return void c(!0);d(r.data),u(r.data.displayName??""),C(r.data.bio??""),E(r.data.dmPrivacy),R(r.data.activeAvatarId??k)}}).catch(()=>e&&c(!0)),()=>{e=!1}},[]),o)return null;if(!l)return(0,r.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,r.jsx)(n.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})});let F=m.trim()!==(l.displayName??"")||j.trim()!==(l.bio??"")||T!==l.dmPrivacy||(A===k?null:A)!==l.activeAvatarId,U=async()=>{if(!L){P(!0),M({});try{let r=await N({displayName:m.trim()||null,bio:j.trim()||null,...l.mpEnabled?{activeAvatarId:A===k?null:A}:{}});if(!r.success){r.fieldErrors&&M(r.fieldErrors),i.toast.error(r.contentFlagged?e("contentFlagged"):r.rateLimited?e("rateLimited"):r.fieldErrors?e("errorLength"):r.error||e("errorGeneric"));return}d(r.data),i.toast.success(e("saved"))}catch{i.toast.error(e("errorGeneric"))}finally{P(!1)}}};return(0,r.jsxs)("div",{className:"space-y-6 border-t border-gray-200 pt-6 dark:border-gray-700",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-lg font-medium",children:e("settingsTitle")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("settingsSubtitle")})]}),(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(b.Label,{htmlFor:"pp-display-name",className:"text-sm font-medium",children:e("displayNameLabel")}),(0,r.jsxs)("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[m.length,"/",y.DISPLAY_NAME_MAX]})]}),(0,r.jsx)(g.Input,{id:"pp-display-name",value:m,maxLength:y.DISPLAY_NAME_MAX,placeholder:e("displayNamePlaceholder"),onChange:e=>u(e.target.value),"aria-invalid":!!I.displayName,className:"rounded-md"}),(0,r.jsx)("p",{className:(0,S.cn)("text-xs",I.displayName?"text-destructive":"text-muted-foreground"),children:I.displayName?e("errorLength"):e("displayNameHint")})]}),(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(b.Label,{htmlFor:"pp-bio",className:"text-sm font-medium",children:e("bioLabel")}),(0,r.jsxs)("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[j.length,"/",y.BIO_MAX]})]}),(0,r.jsx)(p.Textarea,{id:"pp-bio",value:j,maxLength:y.BIO_MAX,rows:3,placeholder:e("bioPlaceholder"),onChange:e=>C(e.target.value),"aria-invalid":!!I.bio,className:"rounded-md"}),I.bio?(0,r.jsx)("p",{className:"text-xs text-destructive",children:e("errorLength")}):null]}),l.mpEnabled?(0,r.jsxs)(r.Fragment,{children:[null,(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)(b.Label,{className:"text-sm font-medium",children:e("activeAvatarLabel")}),l.avatars.length>0?(0,r.jsxs)(f.Select,{value:A,onValueChange:R,children:[(0,r.jsx)(f.SelectTrigger,{className:"rounded-md","aria-invalid":!!I.activeAvatarId,children:(0,r.jsx)(f.SelectValue,{placeholder:e("activeAvatarNone")})}),(0,r.jsxs)(f.SelectContent,{className:"z-[80]",children:[(0,r.jsx)(f.SelectItem,{value:k,children:e("activeAvatarNone")}),l.avatars.map(e=>(0,r.jsx)(f.SelectItem,{value:e.id,children:e.name},e.id))]})]}):(0,r.jsxs)("p",{className:"flex items-center gap-2 rounded-md border border-dashed border-border/60 px-3 py-2 text-sm text-muted-foreground",children:[(0,r.jsx)(h.Users,{className:"h-4 w-4"})," ",e("noAvatarsOwner")]}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e("activeAvatarHint")," ",(0,r.jsx)(x.default,{href:w.MP_AVATARS_PATH,className:"text-primary underline-offset-2 hover:underline",children:e("manageAvatars")})]})]})]}):null,(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsxs)(a.Button,{type:"button",onClick:U,disabled:L||!F,className:"bg-green-600 text-white hover:bg-green-700 dark:bg-green-600 dark:hover:bg-green-700",children:[L?(0,r.jsx)(n.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):null,e("save")]})})]})}e.s(["ProfileSettings",0,()=>{let e=(0,t.useTranslations)("settings"),{user:x,refreshAuthState:h}
1=(0,d.useAuth)(),[g,b]=(0,s.useState)(""),[p,f]=(0,s.useState)(""),[j,v]=(0,s.useState)(!0),[N,y]=(0,s.useState)(!1),[w,S]=(0,s.useState)(""),[k,T]=(0,s.useState)(null),[E,A]=(0,s.useState)(null),[R,L]=(0,s.useState)(null),[P,I]=(0,s.useState)(!1),M=(0,s.useRef)(null);(0,s.useEffect)(()=>{(async()=>{if(x)try{v(!0);let e=await (0,o.getUserDetails)();if(e.success&&e.data){let r=e.data;if(b(r.username||""),f(r.username||""),T(r.avatarUrl),L(r.avatarSeed),r.avatarUrl)try{let e=await (0,c.getAvatarSignedUrl)(r.avatarUrl);e.success&&e.data&&A(e.data.signedUrl)}catch(e){console.error("Error getting signed URL:",e)}}}catch(e){console.error("Error loading user data:",e)}finally{v(!1)}})()},[x]);let F=async r=>{(M.current&&clearTimeout(M.current),r!==p&&r)?r.length<3?S(e("usernameMinLength")):M.current=setTimeout(async()=>{try{let s=await (0,c.checkUsernameAvailability)(r);s.success?S(""):S(s.error||e("usernameNotAvailable"))}catch(e){console.error("Error checking username:",e)}},500):S("")},U=async()=>{try{I(!0);let r=i.toast.loading(e("generatingAvatar")),s=await (0,c.generateRandomAvatarSeed)();if(s.success&&s.data){let t=s.data;L(t.avatarSeed),A(null),T(null),i.toast.success(e("avatarGeneratedSuccess"),{id:r}),await h()}else i.toast.error(s.error||e("avatarGenerateError"),{id:r})}catch(r){console.error("Error generating avatar:",r),i.toast.error(e("avatarGenerateError"))}finally{I(!1)}},D=async r=>{if(r.preventDefault(),!w)try{y(!0),S("");let r=i.toast.loading(e("updatingProfile")),s=await (0,c.updateUserProfile)(g);s.success?(i.toast.success(e("profileUpdatedSuccess"),{id:r}),f(g),await h()):(i.toast.error(s.error||e("profileUpdateError"),{id:r}),S(s.error||e("profileUpdateError")))}catch(r){console.error("Error updating profile:",r),S(e("profileUpdateError"))}finally{y(!1)}};return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"mb-4 border-b border-gray-200 pb-3 dark:border-gray-700",children:[(0,r.jsx)("h3",{className:"text-lg font-medium",children:e("profileInformation")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("profileInformationSubtitle")})]}),j?(0,r.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,r.jsx)("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):(0,r.jsxs)("form",{onSubmit:D,className:"grid gap-6",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center",children:[(0,r.jsx)("div",{className:"mb-4 overflow-hidden rounded-full border-4 border-primary/30",children:E?(0,r.jsx)(u.default,{src:E,width:120,height:120,alt:e("userAvatarAlt"),className:"h-[120px] w-[120px] object-cover"}):(0,r.jsx)(m.default,{size:120,name:R||x?.email||"",variant:"marble",colors:["#92A1C6","#146A7C","#F0AB3D","#C271B4","#C20D90"]})}),(0,r.jsx)("div",{className:"mb-4 flex gap-2",children:(0,r.jsx)(a.Button,{type:"button",variant:"outline",size:"sm",onClick:U,disabled:P,className:"flex items-center gap-1",children:P?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Loader2,{className:"h-4 w-4 animate-spin"}),e("generating")]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.RefreshCw,{className:"h-4 w-4"}),e("random")]})})}),(0,r.jsx)("p",{className:"mb-4 text-center text-xs text-muted-foreground",children:k?e("avatarCustomUploaded"):R?e("avatarRandomGenerated"):e("avatarFromEmail")})]}),(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsxs)("label",{className:"text-sm font-medium",children:[e("username")," ",(0,r.jsx)("span",{className:"text-primary",children:"*"})]}),(0,r.jsx)("input",{type:"text",value:g,onChange:e=>{let r=e.target.value.trim();b(r),F(r)},className:`border-2 ${w?"border-destructive":"border-gray-300 hover:border-gray-500 focus:border-green-600 dark:border-gray-600 dark:hover:border-gray-400"} rounded-md bg-background p-2 text-sm transition-colors duration-200 focus:outline-none focus:ring-1 focus:ring-green-600`,placeholder:e("usernamePlaceholder"),required:!0,minLength:3}),w?(0,r.jsx)("p",{className:"text-xs text-destructive",children:w}):(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:e("usernameHint")})]}),(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium",children:e("email")}),(0,r.jsx)("div",{className:"rounded-md border-2 border-gray-300 bg-secondary/10 p-2 text-sm dark:border-gray-600",children:x?.email||e("notAvailable")}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:e("emailCannotBeChanged")})]}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsx)(a.Button,{type:"submit",disabled:N||!!w,className:"bg-green-600 text-white hover:bg-green-700 dark:bg-green-600 dark:hover:bg-green-700",children:N?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),e("saving")]}):e("save")})})]}),j?null:(0,r.jsx)(C,{})]})}],552982);var T=e.i(900840),E=e.i(573817),A=e.i(832356),R=e.i(319941),L=e.i(915670),P=e.i(776639),I=e.i(903133);let M=({open:e,onClose:i})=>
1{let l=(0,t.useTranslations)("settings"),[d,c]=(0,s.useState)(!1),[m,u]=(0,s.useState)(!1),[x,h]=(0,s.useState)(null),g=A.z.object({currentPassword:A.z.string().min(1,l("currentPasswordRequired")),newPassword:A.z.string().min(8,l("newPasswordMinLength")),confirmPassword:A.z.string().min(1,l("confirmPasswordRequired"))}).refine(e=>e.newPassword===e.confirmPassword,{message:l("passwordsDoNotMatch"),path:["confirmPassword"]}),b=(0,L.useForm)({resolver:(0,R.zodResolver)(g),defaultValues:{currentPassword:"",newPassword:"",confirmPassword:""}}),p=async e=>{try{c(!0),h(null);let r=await (0,o.changePassword)(e.currentPassword,e.newPassword);r.success?(u(!0),b.reset(),setTimeout(()=>{i(),u(!1)},2e3)):h(r.error||l("changePasswordFailed"))}catch(e){h(l("unexpectedError")),console.error("Error changing password:",e)}finally{c(!1)}};return(0,r.jsx)(P.Dialog,{open:e,onOpenChange:i,children:(0,r.jsxs)(P.DialogContent,{className:"sm:max-w-md",children:[(0,r.jsxs)(P.DialogHeader,{children:[(0,r.jsx)(P.DialogTitle,{children:l("changePassword")}),(0,r.jsx)(P.DialogHeader,{children:l("changePasswordSubtitle")})]}),m?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-4 text-center",children:[(0,r.jsx)("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-green-100 p-2",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),(0,r.jsx)("h3",{className:"text-lg font-medium",children:l("passwordChangedSuccess")}),(0,r.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:l("passwordChangedSuccessSubtitle")})]}):(0,r.jsx)(I.Form,{...b,children:(0,r.jsxs)("form",{onSubmit:b.handleSubmit(p),className:"space-y-4",children:[x&&(0,r.jsx)("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive",children:x}),(0,r.jsx)(I.FormField,{control:b.control,name:"currentPassword",render:({field:e})=>(0,r.jsxs)(I.FormItem,{children:[(0,r.jsx)(I.FormLabel,{children:l("currentPassword")}),(0,r.jsx)(I.FormControl,{children:(0,r.jsx)("input",{type:"password",className:"w-full rounded-md border-2 border-gray-300 bg-background p-2 text-sm dark:border-gray-600",placeholder:l("enterCurrentPassword"),...e})}),(0,r.jsx)(I.FormMessage,{})]})}),(0,r.jsx)(I.FormField,{control:b.control,name:"newPassword",render:({field:e})=>(0,r.jsxs)(I.FormItem,{children:[(0,r.jsx)(I.FormLabel,{children:l("newPassword")}),(0,r.jsx)(I.FormControl,{children:(0,r.jsx)("input",{type:"password",className:"w-full rounded-md border-2 border-gray-300 bg-background p-2 text-sm dark:border-gray-600",placeholder:l("enterNewPassword"),...e})}),(0,r.jsx)(I.FormMessage,{})]})}),(0,r.jsx)(I.FormField,{control:b.control,name:"confirmPassword",render:({field:e})=>(0,r.jsxs)(I.FormItem,{children:[(0,r.jsx)(I.FormLabel,{children:l("confirmNewPassword")}),(0,r.jsx)(I.FormControl,{children:(0,r.jsx)("input",{type:"password",className:"w-full rounded-md border-2 border-gray-300 bg-background p-2 text-sm dark:border-gray-600",placeholder:l("confirmNewPasswordPlaceholder"),...e})}),(0,r.jsx)(I.FormMessage,{})]})}),(0,r.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,r.jsx)(a.Button,{type:"button",variant:"outline",onClick:i,disabled:d,children:l("cancel")}),(0,r.jsx)(a.Button,{type:"submit",disabled:d,className:"bg-green-600 text-white hover:bg-green-700 dark:bg-green-600 dark:hover:bg-green-700",children:d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),l("changing")]}):l("changePassword")})]})]})})]})})};e.s(["AccountSettings",0,({onClose:e})=>{let i=(0,t.useTranslations)("settings"),[l,c]=(0,s.useState)(!1),[m,u]=(0,s.useState)(!1),[x,h]=(0,s.use
1State)(!1),[g,b]=(0,s.useState)(null),p=(0,E.useRouter)(),{refreshAuthState:f}=(0,d.useAuth)(),j=async()=>{h(!0),b(null);try{let r=await (0,o.deleteUserAccount)();r.success?(e(),await f(),p.push("/")):(b(r.error||i("deleteAccountError")),h(!1))}catch(e){b(i("deleteAccountUnexpectedError")),h(!1),console.error("Error deleting account:",e)}};return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"mb-4 border-b border-gray-200 pb-3 dark:border-gray-700",children:[(0,r.jsx)("h3",{className:"text-lg font-medium",children:i("accountSettings")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:i("accountSettingsSubtitle")})]}),(0,r.jsx)("div",{className:"grid gap-4",children:(0,r.jsx)(a.Button,{variant:"outline",className:"w-full sm:w-auto",onClick:()=>u(!0),children:i("changePassword")})}),(0,r.jsx)(M,{open:m,onClose:()=>u(!1)}),(0,r.jsxs)("div",{className:"mt-8 rounded-md border-2 border-destructive/30 bg-destructive/5 p-4",children:[(0,r.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,r.jsx)(T.AlertTriangle,{className:"h-5 w-5 text-destructive"}),(0,r.jsx)("h3",{className:"text-base font-medium text-destructive",children:i("dangerZone")})]}),(0,r.jsx)("p",{className:"mb-4 text-sm text-muted-foreground",children:i("dangerZoneSubtitle")}),g&&(0,r.jsx)("div",{className:"mb-3 rounded border-2 border-destructive/30 bg-destructive/10 p-2 text-sm text-destructive",children:g}),l?(0,r.jsxs)("div",{className:"rounded-md border-2 border-destructive/30 bg-background p-4",children:[(0,r.jsx)("p",{className:"mb-3 text-sm font-medium",children:i("deleteConfirmTitle")}),(0,r.jsxs)("ul",{className:"mb-4 list-disc pl-5 text-sm text-muted-foreground",children:[(0,r.jsx)("li",{children:i("deleteConfirmItem1")}),(0,r.jsx)("li",{children:i("deleteConfirmItem2")}),(0,r.jsx)("li",{children:i("deleteConfirmItem3")}),(0,r.jsx)("li",{children:i("deleteConfirmItem4")})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(a.Button,{variant:"destructive",size:"sm",className:"bg-destructive hover:bg-destructive/90",onClick:j,disabled:x,children:x?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Loader2,{className:"mr-1 h-4 w-4 animate-spin"}),i("deleting")]}):i("confirmDelete")}),(0,r.jsx)(a.Button,{variant:"outline",size:"sm",onClick:()=>c(!1),disabled:x,children:i("cancel")})]})]}):(0,r.jsx)(a.Button,{variant:"destructive",size:"sm",className:"bg-background text-destructive transition-colors hover:bg-destructive hover:text-destructive-foreground",onClick:()=>c(!0),children:i("deleteAccount")})]})]})}],552941);var F=(0,j.createServerReference)("003532d315e6c2a2640e2618a99c803466465364b2",j.callServer,void 0,j.findSourceMapURL,"getRoleplaySettings"),U=(0,j.createServerReference)("40d2405b25fa0b925668679345e36f25fd953e0996",j.callServer,void 0,j.findSourceMapURL,"saveRoleplaySettings");e.s(["RoleplaySettings",0,()=>{let e=(0,t.useTranslations)("settings"),{user:l}=(0,d.useAuth)(),[o,c]=(0,s.useState)(""),[m,u]=(0,s.useState)(""),[x,h]=(0,s.use
1State)(""),[g,b]=(0,s.useState)(""),[p,j]=(0,s.useState)(!1),[v,N]=(0,s.useState)(!1),[y,w]=(0,s.useState)(!0),[S,k]=(0,s.useState)({}),[C,T]=(0,s.useState)(!1),[E,A]=(0,s.useState)({roleplayName:"",gender:"",age:"",occupation:"",disableRomanticInteractions:!1});(0,s.useEffect)(()=>{(async()=>{if(l)try{w(!0);let e=await F();if(e.success&&e.data){let r=e.data,s={roleplayName:r.roleplayName||"",gender:r.gender||"null",age:null!==r.age?r.age:"",occupation:r.occupation||"",disableRomanticInteractions:r.disableRomanticInteractions};c(s.roleplayName),u(s.gender),h(s.age),b(s.occupation),j(s.disableRomanticInteractions),A(s),T(!1)}}catch(r){console.error("Error loading roleplay settings:",r),i.toast.error(e("roleplayLoadError"))}finally{w(!1)}})()},[l]);let R=r=>r&&r.length>30?e("roleplayNameMaxLength"):r&&!/^[a-zA-Z0-9\s._-]+$/.test(r)?e("roleplayNameInvalidChars"):"",L=r=>""===r?"":!Number.isInteger(Number(r))||isNaN(Number(r))?e("ageWholeNumber"):18>Number(r)?e("ageMin"):Number(r)>120?e("ageMax"):"",P=r=>r&&r.length>30?e("occupationMaxLength"):r&&!/^[a-zA-Z0-9\s._-]+$/.test(r)?e("occupationInvalidChars"):"";(0,s.useEffect)(()=>{T(o!==E.roleplayName||m!==E.gender||x!==E.age||g!==E.occupation||p!==E.disableRomanticInteractions)},[o,m,x,g,p,E]);let I=async r=>{r.preventDefault();let s=o.trim().replace(/[^\w\s._-]/g,""),t=g.trim().replace(/[^\w\s._-]/g,""),a={roleplayName:R(s),age:L(x),occupation:P(t)};if(k(a),Object.values(a).some(e=>""!==e))return void i.toast.error(e("fixFormErrors"));N(!0);try{let r=await U({roleplayName:s||null,gender:m||null,age:""===x?null:Number(x),occupation:t||null,disableRomanticInteractions:p});r.success?(A({roleplayName:s,gender:m,age:x,occupation:t,disableRomanticInteractions:p}),T(!1),i.toast.success(e("roleplaySaved"))):i.toast.error(r.error||e("roleplaySaveError"))}catch(r){console.error("Error saving roleplay settings:",r),i.toast.error(e("roleplaySaveError"))}finally{N(!1)}};return(0,r.jsxs)("div",{className:"relative space-y-6",children:[(0,r.jsx)("div",{className:`fixed bottom-20 left-0 right-0 z-50 border-t border-gray-200 bg-background/95 p-3 shadow-lg backdrop-blur-md transition-all duration-300 dark:border-gray-700 sm:bottom-0 ${C&&!y?"translate-y-0 opacity-100":"pointer-events-none translate-y-full opacity-0"}`,children:(0,r.jsxs)("div",{className:"mx-auto flex max-w-4xl items-center justify-between",children:[(0,r.jsx)("div",{className:"text-sm font-medium text-green-600 dark:text-green-500",children:e("unsavedChanges")}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(a.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>{c(E.roleplayName),u(E.gender),h(E.age),b(E.occupation),j(E.disableRomanticInteractions),k({})},children:e("cancel")}),(0,r.jsx)(a.Button,{type:"submit",size:"sm",className:"bg-green-600 text-white hover:bg-green-700 dark:bg-green-600 dark:hover:bg-green-700",disabled:v||Object.values(S).some(e=>""!==e),onClick:I,children:v?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Loader2,{className:"mr-2 h-3 w-3 animate-spin"}),e("saving")]}):e("saveChanges")})]})]})}),(0,r.jsxs)("div",{className:"mb-4 border-b border-gray-200 pb-3 dark:border-gray-700",children:[(0,r.jsx)("h3",{className:"text-lg font-medium",children:e("roleplaySettings")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("roleplaySettingsSubtitle")})]}),y?(0,r.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,r.jsx)("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):(0,r.jsxs)("form",{onSubmit:I,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium",children:e("roleplayName")}),(0,r.jsx)("input",{type:"text",value:o,onChange:e=>{let r=e.target.value;c(r);let s=R(r);k(e=>({...e,roleplayName:s}))},placeholder:e("roleplayNamePlaceholder"),maxLength:30,className:`mt-1 w-full rounded-md border-2 ${S.roleplayName?"border-destructive":"border-gray-300 hover:border-gray-500 focus:border-green-600 dark:border-gray-600 dark:hover:border-gray-400"} bg-background p-2 text-sm transition-colors duration-200 focus:outline-none focus:ring-1 focus:ring-green-600`}),S.roleplayName?(0,r.jsx)("p",{className:"mt-1 text-xs text-destructive",children:S.roleplayName}):(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e("roleplayNameHint")})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium",children:e("gender")}),(0,r.jsx)("div",{className:"mt-1",children:(0,r.jsxs)(f.Select,{value:m,onValueChange:e=>u(e),onOpenChange:e=>{e||m||u("null")},children:[(0,r.jsx)(f.SelectTrigger,{className:"w-full border-2 border-gray-300 bg-background hover:border-gray-500 focus:border-green-600 dark:border-gray-600 dark:hover:border-gray-400",children:(0,r.jsx)(f.SelectValue,{placeholder:e("selectGender")})}),(0,r.jsxs)(f.SelectContent,{children:[(0,r.jsx)(f.SelectItem,{value:"null"}),(0,r.jsx)(f.SelectItem,{value:"male",children:e("genderMale")}),(0,r.jsx)(f.SelectItem,{value:"female",children:e("genderFemale")}),(0,r.jsx)(f.SelectItem,{value:"non-binary",children:e("genderNonBinary")}),(0,r.jsx)(f.SelectItem,{value:"transgender",children:e("genderTransgender")}),(0,r.jsx)(f.SelectItem,{value:"genderfluid",children:e("genderGenderfluid")}),(0,r.jsx)(f.SelectItem,{value:"agender",children:e("genderAgender")}),(0,r.jsx)(f.SelectItem,{value:"other",children:e("genderOther")})]})]})}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e("genderHint")})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium",children:e("age")}),(0,r.jsx)("input",{type:"number",value:x,onChange:e=>{let r=""===e.target.value?"":parseInt(e.target.value);h(r);let s=L(r);k(e=>({...e,age:s}))},min:18,max:120,placeholder:e("agePlaceholder"),className:`mt-1 w-full rounded-md border-2 ${S.age?"border-destructive":"border-gray-300 hover:border-gray-500 focus:border-green-600 dark:border-gray-600 dark:hover:border-gray-400"} bg-background p-2 text-sm transition-colors duration-200 focus:outline-none focus:ring-1 focus:ring-green-600`}),S.age?(0,r.jsx)("p",{className:"mt-1 text-xs text-destructive",children:S.age}):(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e("ageHint")})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium",children:e("occupation")}),(0,r.jsx)("input",{type:"text",value:g,onChange:e=>{let r=e.target.value;b(r);let s=P(r);k(e=>({...e,occupation:s}))},placeholder:e("occupationPlaceholder"),maxLength:30,className:`mt-1 w-full rounded-md border-2 ${S.occupation?"border-destructive":"border-gray-300 hover:border-gray-500 focus:border-green-600 dark:border-gray-600 dark:hover:border-gray-400"} bg-background p-2 text-sm transition-colors duration-200 focus:outline-none focus:ring-1 focus:ring-green-600`}),S.occupation?(0,r.jsx)("p",{className:"mt-1 text-xs text-destructive",children:S.occupation}):(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e("occupationHint")})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between rounded-lg border-2 border-gray-300 p-4 transition-colors duration-200 hover:border-gray-500 dark:border-gray-600 dark:hover:border-gray-400",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"text-sm font-medium",children:e("disableRomantic")}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:e("disableRomantic
1Hint")})]}),(0,r.jsx)("div",{className:"flex h-6 items-center",children:(0,r.jsx)("input",{type:"checkbox",checked:p,onChange:e=>{j(e.target.checked)},className:"h-5 w-5 rounded border-gray-300 text-green-600 transition-colors focus:ring-green-600"})})]}),(0,r.jsx)("div",{className:"rounded-lg border-2 border-gray-200 bg-secondary/10 p-4 text-xs text-muted-foreground dark:border-gray-700",children:(0,r.jsx)("p",{children:e.rich("safetyNotice",{strong:e=>(0,r.jsx)("strong",{children:e})})})}),(0,r.jsx)("div",{className:"h-16"})]})]})}],248338);var D=e.i(286796);let O=(0,D.default)("BellRing",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]]);var B=e.i(699375),_=(0,j.createServerReference)("005df1ea5f7d909ff215894e159b9aa929f6b30c7b",j.callServer,void 0,j.findSourceMapURL,"getNotificationPrefs"),H=(0,j.createServerReference)("40cad41a804874a9950163e688c146659e26b3f967",j.callServer,void 0,j.findSourceMapURL,"updateNotificationPrefs"),$=e.i(412093),V=e.i(656449);e.s(["NotificationSettings",0,()=>{let e=(0,t.useTranslations)("settings"),[a,l]=(0,s.useState)(null),[,d]=(0,s.useTransition)(),o=(0,$.usePushNotifications)();(0,s.useEffect)(()=>{_().then(e=>l(e.success?e.data:null))},[]);let c=(e,r,s)=>{a&&(l({...a,[e]:{...a[e],[r]:s}}),d(async()=>{let t=await H({[e]:{[r]:s}});if(!t.success){l(a),i.toast.error(t.error);return}l(t.data)}))},m=o.isSupported&&"granted"===o.permission&&o.isSubscribed;return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"mb-4 border-b border-gray-200 pb-3 dark:border-gray-700",children:[(0,r.jsx)("h3",{className:"text-lg font-medium",children:e("notificationSettings")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("notificationSettingsSubtitle")})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-2xl bg-black/[0.03] px-4 py-3 ring-1 ring-black/5 dark:bg-white/[0.04] dark:ring-white/10",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("span",{className:"flex h-9 w-9 flex-none items-center justify-center rounded-full bg-primary/10 text-primary",children:(0,r.jsx)(O,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:e("notif.pushTitle")}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:o.isSupported?m?e("notif.pushOn"):"denied"===o.permission?e("notif.pushDenied"):e("notif.pushOff"):e("notif.pushUnsupported")})]})]}),o.isSupported&&"denied"!==o.permission?m?(0,r.jsx)("button",{type:"button",onClick:()=>void o.unsubscribe(),disabled:o.isLoading,className:"rounded-full px-3 py-1.5 text-xs text-muted-foreground ring-1 ring-black/10 hover:text-foreground dark:ring-white/10",children:e("notif.pushDisable")}):(0,r.jsx)("button",{type:"button",onClick:()=>void o.requestPermission(),disabled:o.isLoading,className:"rounded-full bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground",children:o.isLoading?(0,r.jsx)(n.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):e("notif.pushEnable")}):null]}),a?(0,r.jsxs)("div",{className:"overflow-hidden rounded-2xl ring-1 ring-black/5 dark:ring-white/10",children:[(0,r.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto] items-center gap-x-4 bg-black/[0.03] px-4 py-2 font-mono text-[10px] uppercase tracking-wider text-muted-foreground dark:bg-white/[0.04]",children:[(0,r.jsx)("span",{children:e("notif.topic")}),(0,r.jsx)("span",{className:"w-12 text-center",children:e("notif.inApp")}),(0,r.jsx)("span",{className:"w-12 text-center",children:e("notif.push")})]}),V.NOTIF_TOPICS.map(s=>(0,r.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto] items-center gap-x-4 border-t border-black/5 px-4 py-3 dark:border-white/10",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:e(`notif.topics.${s}`)}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:e(`notif.topicHints.${s}`)})]}),(0,r.jsx)("div",{className:"flex w-12 justify-center",children:(0,r.jsx)(B.Switch,{checked:a[s].inApp,onCheckedChange:e=>c(s,"inApp",e)})}),(0,r.jsx)("div",{className:"flex w-12 justify-center",children:(0,r.jsx)(B.Switch,{checked:a[s].push,disabled:!m,onCheckedChange:e=>c(s,"push",e)})})]},s))]}):(0,r.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,r.jsx)("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})})]})}],664965);var z=e.i(699441),G=e.i(132786),X=e.i(833486);e.s(["StylePreferenceSettings",0,()=>{let e=(0,t.useTranslations)("settings"),{resolvedStyle:s,isLoading:a,savePreference:n}
1=(0,X.useStylePreference)(),l=async r=>{r!==s&&(await n(r),i.toast.success(e("styleSet",{style:"anime"===r?e("styleAnime"):e("styleRealistic")})))};return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"mb-4 border-b border-gray-200 pb-3 dark:border-gray-700",children:[(0,r.jsx)("h3",{className:"text-lg font-medium",children:e("stylePreference")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("stylePreferenceSubtitle")})]}),a?(0,r.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,r.jsx)("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("button",{onClick:()=>l("realistic"),className:`flex items-center gap-3 rounded-xl border-2 p-4 transition-all duration-200 ${"realistic"===s?"border-primary bg-primary/10 shadow-lg shadow-primary/10":"border-border hover:border-border hover:bg-accent"}`,children:[(0,r.jsx)(z.Camera,{className:`h-5 w-5 ${"realistic"===s?"text-primary":"text-muted-foreground"}`}),(0,r.jsxs)("div",{className:"text-left",children:[(0,r.jsx)("div",{className:`text-sm font-medium ${"realistic"===s?"text-primary":""}`,children:e("styleRealistic")}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:e("stylePhotorealistic")})]})]}),(0,r.jsxs)("button",{onClick:()=>l("anime"),className:`flex items-center gap-3 rounded-xl border-2 p-4 transition-all duration-200 ${"anime"===s?"border-primary bg-primary/10 shadow-lg shadow-primary/10":"border-border hover:border-border hover:bg-accent"}`,children:[(0,r.jsx)(G.Sparkles,{className:`h-5 w-5 ${"anime"===s?"text-primary":"text-muted-foreground"}`}),(0,r.jsxs)("div",{className:"text-left",children:[(0,r.jsx)("div",{className:`text-sm font-medium ${"anime"===s?"text-primary":""}`,children:e("styleAnime")}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:e("styleMangaIllustration")})]})]})]}),(0,r.jsx)("div",{className:"rounded-lg border-2 border-gray-200 bg-secondary/10 p-4 text-xs text-muted-foreground dark:border-gray-700",children:(0,r.jsx)("p",{children:e("styleDefaultNote")})})]})}],700235),e.i(879646),e.s([],848061);var q=e.i(402364),K=e.i(144456),W=e.i(414073),Y=e.i(550300),Z=e.i(136725),Q=e.i(378843),J=e.i(250623),ee=e.i(590863);e.i(706730);var er=e.i(320143),es=e.i(146229),et=e.i(392718);let ea=e=>5*Math.round(e/250/5),ei=({packageKey:e,onPurchase:s,isProcessing:a,showGfeTexts:i,showVideoMinutes:l})=>{let d=(0,t.useTranslations)("settings"),o=Q.TOKEN_PACKS[e],{symbol:c}=(0,es.getCurrencyFromCookie)(),m=Math.round((o.valuePerDollar-100)/100*100),u=Math.floor(o.tokens/10);return(0,r.jsx)("div",{className:"group relative aspect-square cursor-pointer overflow-hidden rounded-2xl border-2 border-gray-200 bg-white p-3 shadow-md transition-all duration-200 hover:scale-[1.02] hover:border-amber-400 hover:shadow-lg dark:border-border/60 dark:bg-card/50 dark:hover:border-amber-500/50 dark:hover:bg-card/80 sm:p-4",onClick:()=>s(e),children:(0,r.jsxs)("div",{className:"relative flex h-full flex-col items-center justify-center gap-1.5 text-center",children:[(0,r.jsxs)("div",{className:"text-2xl font-bold leading-none text-amber-600",children:[o.tokens.toLocaleString(),(0,r.jsx)("span",{className:"ml-1 text-sm font-semibold",children:"XOT"})]}),(0,r.jsx)("div",{className:"text-xl font-bold text-foreground",children:o.priceDisplay.replace("$",c)}),m>0&&(0,r.jsx)("div",{className:"text-xs font-semibold text-green-600",children:d("percentValue",{percent:m})}),i&&(0,r.jsxs)("div",{className:"flex items-center gap-1 whitespace-nowrap text-[11px] font-medium text-pink-500",children:[(0,r.jsx)(Y.Heart,{className:"h-3 w-3 shrink-0 fill-pink-500"}),d("gfeTextsCount",{count:u.toLocaleString()})]}),l&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-1 text-[11px] font-medium leading-tight text-red-500",children:[(0,r.jsx)(Z.Video,{className:"h-3 w-3 shrink-0"}),(0,r.jsxs)("span",{children:["â ",ea(o.tokens)," min video call"]})]}),a&&(0,r.jsx)("div",{className:"absolute inset-0 flex items-center justify-center rounded-2xl bg-card/95 backdrop-blur-sm",children:(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,r.jsx)(n.Loader2,{className:"h-8 w-8 animate-spin text-amber-500"}),(0,r.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:d("processing")})]})})]})})};function en({onClose:e,tokenContext:l}){let c=(0,t.useTranslations)("settings"),{tokenBalance:m,isLoading:u}=function(){let{user:e}
1=(0,d.useAuth)(),[r,t]=(0,s.useState)(0),[a,i]=(0,s.useState)(!0),n=async()=>{if(e)try{i(!0);let e=await (0,o.getUserDetails)();e.success&&e.data&&t(e.data.tokenBalance)}catch(e){console.error("Error fetching token data:",e)}finally{i(!1)}else i(!1)};return(0,s.useEffect)(()=>{n()},[e]),{tokenBalance:r,isLoading:a,fetchTokenData:n}}(),[x,h]=(0,s.useState)(null),[g,b]=(0,s.useState)(!1),{isAuthenticated:p}=(0,d.useAuth)(),{subscriptionStatus:f,isActive:j}=(0,J.useSubscription)(),v=window.location.pathname.startsWith("/girlfriend"),N="videocall"===l,y=(0,E.useRouter)(),w=j&&f!==ee.SubscriptionStatus.FREE,S=async r=>{if(p&&w)try{h(r),sessionStorage.setItem("checkout-return-url",window.location.pathname),e?.(),y.push(`/tokens/checkout?package=${r}&src=token_settings`)}catch(e){console.error("Token purchase error:",e),i.toast.error(c("checkoutError")),h(null)}};return u?(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"mb-4 border-b border-border pb-3",children:[(0,r.jsx)("h3",{className:"text-lg font-medium",children:c("tabXot")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:c("xotSubtitle")})]}),(0,r.jsx)("div",{className:"rounded-xl border border-border bg-card/30 p-6",children:(0,r.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,r.jsx)(n.Loader2,{className:"h-5 w-5 animate-spin"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:c("loadingXot")})]})})]}):(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)("div",{className:"rounded-2xl bg-gradient-to-r from-amber-500/10 via-yellow-500/10 to-amber-600/10 p-6",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-gradient-to-br from-amber-500 to-yellow-500 shadow-md",children:(0,r.jsx)(q.Coins,{className:"h-6 w-6 text-white"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-foreground",children:c("yourXotBalance")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:v?c("girlfriendTextsRemaining",{count:Math.floor(m/10).toLocaleString()}):N?`â ${ea(m)} min of video calls`:c("xotBalanceHint")})]})]}),(0,r.jsxs)("div",{className:"text-3xl font-bold text-amber-600",children:[m.toLocaleString()," XOT"]})]})}),w?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"mb-4 flex items-center justify-between gap-2",children:[(0,r.jsx)("h4",{className:"text-base font-medium",children:c("choosePackage")}),(0,r.jsx)(et.DocsLink,{href:"/docs/xot/xot-costs",children:"See all costs"})]}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-3",children:Q.TOKEN_PACK_KEYS.map(e=>(0,r.jsx)(ei,{packageKey:e,onPurchase:S,isProcessing:x===e,showGfeTexts:v,showVideoMinutes:N},e))})]}):(0,r.jsx)("div",{className:"rounded-2xl border border-amber-500/30 bg-gradient-to-r from-amber-500/5 to-yellow-500/5 p-6",children:(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-4 text-center",children:[(0,r.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-amber-500 to-yellow-500 shadow-lg",children:(0,r.jsx)(W.Lock,{className:"h-8 w-8 text-white"})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("h4",{className:"mb-2 flex items-center justify-center gap-2 text-lg font-semibold text-amber-600",children:[(0,r.jsx)(K.Crown,{className:"h-5 w-5"}),c("subscriptionRequired")]}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:c("subscriptionRequiredHint")})]}),(0,r.jsxs)(a.Button,{className:"bg-gradient-to-r from-amber-500 to-yellow-500 hover:from-amber-500/90 hover:to-yellow-500/90",onClick:()=>{b(!0)},children:[(0,r.jsx)(K.Crown,{className:"mr-2 h-4 w-4"}),c("viewPlan")]})]})}),(0,r.jsx)(er.FullScreenSubscriptionPopup,{isOpen:g,source:"token_settings",onClose:()=>b(!1)})]})}e.s(["TokenSettings",()=>en],177275);let el=(0,D.default)("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);e.s(["Award",()=>el],347558);let ed=(0,D.default)("AudioWaveform",[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",ke
1y:"57tc96"}]]);e.s(["AudioWaveform",()=>ed],927865);let eo=(0,D.default)("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);e.s(["PenTool",()=>eo],345301);let ec=(0,D.default)("Rss",[["path",{d:"M4 11a9 9 0 0 1 9 9",key:"pv89mb"}],["path",{d:"M4 4a16 16 0 0 1 16 16",key:"k0647b"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);e.s(["Rss",()=>ec],379146);var em=(0,j.createServerReference)("00a5f9886fce34dd924ee00b544561dbb452f8563c",j.callServer,void 0,j.findSourceMapURL,"resumeSubscription");e.s(["resumeSubscription",()=>em],490271)},422225,e=>{"use strict";let r=(0,e.i(286796).default)("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);e.s(["MessageSquareText",()=>r],422225)},170897,e=>{"use strict";var r=e.i(260293),s=e.i(879646),t=e.i(809528),a=e.i(707061),i=e.i(776639),n=e.i(975157),l=e.i(457650),d=e.i(653287),o=e.i(831160),c=e.i(363636),m=e.i(690994),u=e.i(144456),x=e.i(402364),h=e.i(65992),g=e.i(653789);e.i(848061);var b=e.i(552982),p=e.i(552941),f=e.i(248338),j=e.i(664965),v=e.i(700235),N=e.i(177275),y=e.i(519455),w=e.i(168867),S=e.i(62048),k=e.i(209982),C=e.i(929467),T=e.i(477272),E=e.i(317877),A=e.i(593940),R=e.i(132786),L=e.i(962957),P=e.i(347558),I=e.i(927865),M=e.i(345301),F=e.i(273389),U=e.i(136725),D=e.i(379146),O=e.i(613113),B=e.i(195652),_=e.i(756914),H=e.i(490271),$=e.i(63893),V=e.i(967489),z=e.i(624687),G=e.i(392718),X=e.i(735281),q=e.i(550300),K=e.i(422225),W=e.i(474831),Y=(0,W.createServerReference)("405a3e4ab8687233a8605caa36b50c80cbe961e581",W.callServer,void 0,W.findSourceMapURL,"claimRetentionBonus"),Z=(0,W.createServerReference)("40139744c7a07d519be4812b50ce02a27d279d413b",W.callServer,void 0,W.findSourceMapURL,"confirmCancellation"),Q=(0,W.createServerReference)("607cf7f3c13a15926ce9e30bbf29a9b0a1e0b97748",W.callServer,void 0,W.findSourceMapURL,"startCancellationAttempt"),J=(0,W.createServerReference)("40c57744046c6356067a1d208f67d5b79e0f5256b8",W.callServer,void 0,W.findSourceMapURL,"cancelSubscription"),ee=e.i(874179),er=e.i(250623);let es={TOO_EXPENSIVE:"churnReasonTooExpensive",NOT_USING_ENOUGH:"churnReasonNotUsing",MISSING_FEATURES:"churnReasonMissingFeatures",CONTENT_QUALITY:"churnReasonContentQuality",TECHNICAL_ISSUES:"churnReasonTechnical",FOUND_ALTERNATIVE:"churnReasonAlternative",PRIVACY_CONCERNS:"churnReasonPrivacy",OTHER:"churnReasonOther"};function et({open:e,onOpenChange:s,expiresAtLabel:n,onSaved:l,onCancelled:d}){let o=(0,a.useTranslations)("settings"),{addTokens:c}=(0,ee.useTokens)(),{getTierName:m}=(0,er.useSubscription)(),u=m(),[x,h]=(0,t.useState)("reason"),[g,b]=(0,t.useState)(""),[p,f]=(0,t.useState)(""),[j,v]=(0,t.useState)(null),[N,k]=(0,t.useState)(!0),[C,E]=(0,t.useState)(500),[R,L]=(0,t.useState)(!1),[P,I]=(0,t.useState)(!1),[M,F]=(0,t.useState)(!1),U=R||P||M,D=""!==g&&("OTHER"!==g||p.trim().length>0),O=e=>{!U&&(s(e),e||setTimeout(()=>{h("reason"),b(""),f(""),v(null)},300))},B=async()=>{if(D)try{L(!0);let e=await Q(g,"OTHER"===g?p:void 0);e.success&&e.data?(v(e.data.attemptId),k(e.data.bonusEligible),E(e.data.bonusAmount)):(console.error("[Churn] startCancellationAttempt failed:",e.error),v(null),k(!1)),h("offer")}catch(e){console.error("[Churn] startCancellationAttempt threw:",e),v(null),k(!1),h("offer")}finally{L(!1)}},_=async()=>{if(j)try{I(!0);let e=await Y(j);e.success&&e.data?(c(C),$.toast.success(o("churnClaimSuccess",{amount:C})),l(),O(!1)):$.toast.error(e.error||o("churnErrorGeneric"))}catch{$.toast.error(o("churnErrorGeneric"))}finally{I(!1)}},H=async()=>{try{F(!0);let e=j?await Z(j):await J(!0);e.success?($.toast.success(o("cancelSuccess")),d(),O(!1)):$.toast.error(e.error||o("cancelError"))}catch{$.toast.error(o("cancelErrorRetry"))}finally{F(!1)}};return(0,r.jsx)(i.Dialog,{open:e,onOpenChange:O,children:(0,r.jsx)(i.DialogContent,{className:"max-w-md !rounded-2xl",children:"reason"===x?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.DialogHeader,{children:[(0,r.jsxs)(i.DialogTitle,{className:"flex items-center gap-2",children:[(0,r.jsx)(K.MessageSquareText,{className:"h-5 w-5 text-amber-500"}),o("churnReasonTitle")]}),(0,r.jsx)(i.DialogDescription,{children:o("churnReasonSubtitle")})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)(V.Select,{value:g,onValueChange:e=>b(e),children:[(0,r.jsx)(V.SelectTrigger,{className:"w-full rounded-xl",children:(0,r.jsx)(V.SelectValue,{placeholder:o("churnReasonPlaceholder")})}),(0,r.jsx)(V.SelectContent,{children:Object.keys(es).map(e=>(0,r.jsx)(V.SelectItem,{value:e,children:o(es[e])},e))})]}),"OTHER"===g&&(0,r.jsx)(z.Textarea,{value:p,onChange:e=>f(e.target.value),placeholder:o("churnReasonOtherPlaceholder"),maxLength:1e3,rows:3,className:"rounded-xl"})]}),(0,r.jsxs)(i.DialogFooter,{className:"flex-col-reverse gap-3 sm:flex-col-reverse sm:justify-start sm:space-x-0",children:[(0,r.jsxs)(y.Button,{onClick:()=>O(!1),disabled:U,className:"w-full rounded-2xl border-green-300 bg-green-100 text-green-700 hover:border-green-400 hover:bg-green-200 hover:text-green-800 dark:border-green-700/50 dark:bg-green-900/30 dark:text-green-300 dark:hover:border-green-600 dark:hover:bg-green-900/50 dark:hover:text-green-200",children:[(0,r.jsx)(S.CheckCircle,{className:"mr-2 h-4 w-4"}),o("churnKeepPlan")]}),(0,r.jsxs)(y.Button,{onClick:B,disabled:!D||U,className:"w-full rounded-2xl",children:[R?(0,r.jsx)(w.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,r.jsx)(A.ArrowRight,{className:"mr-2 h-4 w-4"}),o("churnContinue")]})]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.DialogHeader,{children:[(0,r.jsxs)(i.DialogTitle,{className:"flex items-center gap-2",children:[(0,r.jsx)(q.Heart,{className:"h-5 w-5 text-red-500"}),o("churnOfferTitle")]}),(0,r.jsx)(i.DialogDescription,{asChild:!0,children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("p",{className:"text-base",children:N?o("churnOfferBody"):o("cancelDialogBody",{date:n,tier:u})}),N&&(0,r.jsxs)("div",{className:"rounded-2xl border border-amber-500/30 bg-gradient-to-r from-amber-500/10 to-yellow-500/10 p-4",children:[(0,r.jsxs)("div",{className:"mb-1 flex items-center gap-2",children:[(0,r.jsx)(X.Gift,{className:"h-5 w-5 text-amber-500"}),(0,r.jsx)("span",{className:"text-lg font-bold text-amber-600",children:o("churnOfferBonus",{amount:C})})]}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:o("churnOfferBonusDesc")})]}),(0,r.jsxs)("div",{className:"rounded-2xl border border-destructive/20 bg-destructive/5 p-4",children:[(0,r.jsxs)("h4",{className:"mb-3 flex items-center gap-2 font-semibold text-destructive",children:[(0,r.jsx)(T.X,{className:"h-4 w-4"}),o("youWillLoseAccess")]}),(0,r.jsxs)("ul",{className:"space-y-1 text-sm",children:[(0,r.jsxs)("li",{children:["⢠",o("loseAccessItem1",{tier:u})]}),(0,r.jsxs)("li",{children:["⢠",o("loseAccessItem2")]}),(0,r.jsxs)("li",{children:["⢠",o("loseAccessItem3")]}),(0,r.jsxs)("li",{children:["⢠",o("loseAccessItem4")]})]})]}),(0,r.jsx)(G.DocsLink,{href:"/docs",className:"text-sm",children:o("churnOfferGuide")})]})})]}),(0,r.jsxs)(i.DialogFooter,{className:"flex-col-reverse gap-3 sm:flex-col-reverse sm:justify-start sm:space-x-0",children:[(0,r.jsxs)(y.Button,{variant:"outline",onClick:H,disabled:U,className:"w-full rounded-2xl border-red-300 bg-red-100 text-red-600 hover:border-red-400 hover:bg-red-200 hover:text-red-700 dark:border-red-700/50 dark:bg-red-900/30 dark:text-red-300 dark:hover:border-red-600 dark:hover:bg-red-900/50 dark:hover:text-red-200",children:[M?(0,r.jsx)(w.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,r.jsx)(T.X,{className:"mr-2 h-4 w-4"}),M?o("cancelling"):o("churnFinalCancel")]}),N?(0,r.jsxs)(y.Button,{onClick:_,disabled:U,className:"w-full rounded-2xl bg-gradient-to-r from-amber-500 to-yellow-500 text-white hover:from-amber-500/90 hover:to-yellow-500/90",children:[P?(0,r.jsx)(w.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,r.jsx)(X.Gift,{className:"mr-2 h-4 w-4"}),P?o("churnClaiming"):o("churnClaimBonus",{amount:C})]}):(0,r.jsxs)(y.Button,{onClick:()=>O(!1),disabled:U,className:"w-full rounded-2xl border-green-300 bg-green-100 text-green-700 hover:border-green-400 hover:bg-green-200 hover:text-green-800 dark:border-green-700/50 dark:bg-green-900/30 dark:text-green-300 dark:hover:border-green-600 dark:hover:bg-green-900/50 dark:hover:text-green-200",children:[(0,r.jsx)(S.CheckCircle,{className:"mr-2 h-4 w-4"}),o("keepSubscription")]})]})]})})})}var ea=e.i(488257),ei=e.i(590863);e.i(706730);var en=e.i(320143),el=e.i(146229),ed=e.i(378843),eo=e.i(904646),ec=e.i(438038),em=e.i(495527);function eu(){let e=(0,a.useTranslations)("settings"),s=(0,a.useTranslations)("plans"),[i,l]=(0,t.useState)(!0),[d,o]=(0,t.useState)(null),[c,m]=(0,t.useState)(!1),[h,g]=(0,t.useState)(!1),[b,p]=(0,t.useState)(!1),{symbol:f}=(0,el.getCurrencyFromCookie)(),j=e=>{o({status:e.status,expiresAt:e.expiresAt,isActive:e.isActive,effectiveTier:e.effectiveTier,isCancelled:e.isCancelled,canResume:e.canResume,isComp:e.isComp,price:e.price,interval:e.interval,intervalCount:e.intervalCount,priceDisplay:e.priceDisplay})};(0,t.useEffect)(()=>{(async()=>{try{l(!0);let e=await (0,ea.getUserSubscription)();e.success&&e.data&&j(e.data)}catch(r){console.error("Error fetching subscription:",r),$.toast.error(e("subscriptionLoadError"))}finally{l(!1)}})()},[]);let v=(0,t.useCallback)(async()=>{try{let e=await (0,ea.getUserSubscription)();e.success&&e.data&&j(e.data)}catch(e){console.error("Error refreshing subscription:",e)}},[]),N=async()=>{try{m(!0);let r=await (0,H.resumeSubscription)();r.success?($.toast.success(e("resumeSuccess")),await v()):$.toast.error(r.error||e("resumeError"))}catch(r){console.error("Error resuming subscription:",r),$.toast.error(e("resumeError"))}finally{m(!1)}},V=e=>e?new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}):"";if(i)return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"mb-4 border-b border-border pb-3",children:[(0,r.jsx)("h3",{className:"text-lg font-medium",children:e("subscription")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("subscriptionSubtitle")})]}),(0,r.jsx)("div",{className:"rounded-xl border border-border bg-card/30 p-6",children:(0,r.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,r.jsx)(w.Loader2,{className:"h-5 w-5 animate-spin"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("loadingSubscription")})]})})]});let z=d?.isActive||!1,G=d?.effectiveTier??ei.SubscriptionStatus.FREE,X=(0,eo.tierAtLeast)(G,ei.SubscriptionStatus.ELITE),q=z?ec.TIER_CONFIG[G]?.name??e("subscribed"):e("freePlan"),K=(0,eo.nextSellableTier)(z?G:ei.SubscriptionStatus.FREE)??null,W=K?em.TIER_THEME[K]:null,Y=K?(0,ed.findSubscriptionProduct)(K,"yearly"):null,Z=Y?(Y.price/12).toFixed(2):null,Q=[{icon:(0,r.jsx)(E.Users,{className:"h-4 w-4 text-amber-600"}),text:e("featureUnlimitedCharacters")},{icon:(0,r.jsx)(L.Image,{className:"h-4 w-4 text-amber-600"}),text:e("featureSotaImage")},{icon:(0,r.jsx)(I.AudioWaveform,{className:"h-4 w-4 text-amber-600"}),text:e("featureVoiceCalling")},{icon:(0,r.jsx)(M.PenTool,{className:"h-4 w-4 text-amber-600"}),text:e("featureSelene")},{icon:(0,r.jsx)(u.Crown,{className:"h-4 w-4 text-amber-600"}),text:e("featureProCharacters")},{icon:(0,r.jsx)(P.Award,{className:"h-4 w-4 text-amber-600"}),text:e("feature1000Xot")},{icon:(0,r.jsx)(U.Video,{className:"h-4 w-4 text-amber-600"}),text:e("featurePrivateCollections")},{icon:(0,r.jsx)(R.Sparkles,{className:"h-4 w-4 text-amber-600"}),text:e("featureVideoGeneration")},{icon:(0,r.jsx)(B.Share,{className:"h-4 w-4 text-amber-600"}),text:e("featureShareCreations")},{icon:(0,r.jsx)(M.PenTool,{className:"h-4 w-4 text-amber-600"}),text:e("featureScarlet")},{icon:(0,r.jsx)(D.Rss,{className:"h-4 w-4 text-amber-600"}),text:e("featureUnlimitedFeed")},{icon:(0,r.jsx)(x.Coins,{className:"h-4 w-4 text-amber-600"}),text:e("featureEarnXot")},{icon:(0,r.jsx)(P.Award,{className:"h-4 w-4 text-amber-600"}),text:e("featureVipSupport")},{icon:(0,r.jsx)(O.Brain,{className:"h-4 w-4 text-amber-600"}),text:e("featureEnhancedContext")}],J=em.TIER_BENEFIT_KEYS.ELITE.map(e=>({icon:(0,r.jsx)(_.Check,{className:"h-4 w-4 text-fuchsia-500"}),text:s(e)})),ee=z?X?em.TIER_THEME.ELITE.iconTile:em.TIER_THEME.ULTIMATE.iconTile:"bg-gradient-to-br from-gray-500 to-gray-600 text-white shadow-md";return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"mb-4 border-b border-border pb-3",children:[(0,r.jsx)("h3",{className:"text-lg font-medium",children:e("subscription")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("subscriptionSubtitle")})]}),(0,r.jsxs)("div",{className:"rounded-2xl border border-border bg-card/30 p-6",children:[(0,r.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:(0,n.cn)("flex h-12 w-12 items-center justify-center rounded-2xl",ee),children:z?X?(0,r.jsx)(F.Gem,{className:"h-6 w-6"}):(0,r.jsx)(u.Crown,{className:"h-6 w-6"}):(0,r.jsx)(C.Star,{className:"h-6 w-6"})}),(0,r.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,r.jsx)("h4",{className:"font-semibold",children:e("currentPlan")}),(0,r.jsx)("p",{className:"text-md",children:z?e("planSubscription",{tier:q}):e("freePlan")})]})]}),(0,r.jsxs)("div",{className:"text-right",children:[(0,r.jsx)("div",{className:"text-xl font-bold",children:z?d?.priceDisplay||e("subscribed"):e("free")}),z&&(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:d?.isCancelled?(0,r.jsxs)("span",{className:`inline-flex items-center gap-1 ${d.isComp?"text-muted-foreground":"text-red-500"}`,children:[d.isComp?(0,r.jsx)(k.Calendar,{className:"h-3 w-3"}):(0,r.jsx)(T.X,{className:"h-3 w-3"}),e("expiresOn",{date:V(d.expiresAt)})]}):(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-green-600",children:[(0,r.jsx)(S.CheckCircle,{className:"h-3 w-3"}),e("active")]})})]})]}),d?.canResume&&d?.isActive&&(0,r.jsx)("div",{className:"mb-4 flex justify-center",children:(0,r.jsx)(y.Button,{onClick:N,disabled:c,
1className:"group relative overflow-hidden rounded-xl bg-gradient-to-r from-green-500 to-emerald-600 px-6 py-3 text-white shadow-lg transition-all duration-300 hover:scale-105 hover:from-green-600 hover:to-emerald-700 hover:shadow-xl disabled:opacity-70 disabled:hover:scale-100",children:c?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(w.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),e("resuming")]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(R.Sparkles,{className:"mr-2 h-4 w-4 animate-pulse"}),e("resumeSubscription")]})})}),z&&d?.expiresAt&&(0,r.jsxs)("div",{className:"mb-4 rounded-2xl bg-muted/50 p-4",children:[(0,r.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(k.Calendar,{className:"h-4 w-4 text-muted-foreground"}),(0,r.jsx)("span",{className:"text-sm font-medium",children:d.isCancelled?e("expires"):e("nextBilling")})]}),(0,r.jsx)("span",{className:"text-sm text-muted-foreground",children:V(d.expiresAt)})]}),!d.isCancelled&&(0,r.jsx)("div",{className:"mt-4 flex justify-center",children:(0,r.jsxs)(y.Button,{variant:"outline",onClick:()=>g(!0),className:"group rounded-2xl border-red-300 bg-red-100 text-red-600 transition-all duration-200 hover:border-red-400 hover:bg-red-200 hover:text-red-700 dark:border-red-700/50 dark:bg-red-900/30 dark:text-red-300 dark:hover:border-red-600 dark:hover:bg-red-900/50 dark:hover:text-red-200",children:[(0,r.jsx)(T.X,{className:"mr-2 h-4 w-4 transition-transform group-hover:rotate-90"}),e("cancelSubscription")]})})]}),K&&W&&(0,r.jsxs)("div",{className:(0,n.cn)("rounded-2xl border p-4",K===ei.SubscriptionStatus.ELITE?"border-fuchsia-500/25 bg-gradient-to-r from-violet-600/10 to-fuchsia-500/10":"border-amber-500/20 bg-gradient-to-r from-amber-500/10 to-yellow-500/10"),children:[(0,r.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[K===ei.SubscriptionStatus.ELITE?(0,r.jsx)(F.Gem,{className:"h-5 w-5 text-fuchsia-500"}):(0,r.jsx)(u.Crown,{className:"h-5 w-5 text-amber-500"}),(0,r.jsx)("span",{className:(0,n.cn)("font-medium",W.accentText),children:K===ei.SubscriptionStatus.ELITE?e("upgradeToElite"):e("upgrade")})]}),(0,r.jsx)("p",{className:"mb-3 text-sm text-muted-foreground",children:K===ei.SubscriptionStatus.ELITE?e("upgradeToEliteDescription"):e("upgradeDescription")}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("div",{className:"text-sm",children:[(0,r.jsx)("span",{className:"font-medium",children:s(W.nameKey)}),Z&&(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:(0,n.cn)("text-lg font-bold",W.accentText),children:e("pricePerMonth",{price:`${f}${Z}`})}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:e("whenBilledYearly")})]})]}),(0,r.jsxs)(y.Button,{onClick:()=>p(!0),className:(0,n.cn)("rounded-xl",W.cta),children:[(0,r.jsx)(F.Gem,{className:"mr-2 h-4 w-4"}),K===ei.SubscriptionStatus.ELITE?e("upgradeToElite"):e("upgradeNow"),(0,r.jsx)(A.ArrowRight,{className:"ml-2 h-4 w-4"})]})]})]}),z&&(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)("h5",{className:"mb-3 font-medium",children:X?e("eliteBenefits"):e("ultimateBenefits")}),X&&(0,r.jsx)("div",{className:"mb-3 grid gap-3 sm:grid-cols-2",children:J.map((e,s)=>(0,r.jsxs)("div",{className:"flex items-center gap-2 rounded-xl border border-fuchsia-500/20 bg-fuchsia-500/5 p-2 text-sm",children:[e.icon,(0,r.jsx)("span",{children:e.text})]},s))}),X&&(0,r.jsx)("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:e("plusEverythingInUltimate")}),(0,r.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:Q.map((e,s)=>(0,r.jsxs)("div",{className:"flex items-center gap-2 rounded-xl bg-muted/30 p-2 text-sm",children:[e.icon,(0,r.jsx)("span",{children:e.text})]},s))})]})]}),!z&&(0,r.jsxs)("div",{className:"rounded-2xl border border-amber-200 bg-amber-50/20 p-6 dark:border-amber-800/30 dark:bg-amber-950/10",children:[(0,r.jsx)("h4",{className:"mb-4 font-semibold text-amber-700 dark:text-amber-300",children:e("everythingIncludedIn",{tier:ec.TIER_CONFIG.ULTIMATE.name})}),(0,r.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:Q.map((e,s)=>(0,r.jsxs)("div",{className:"flex items-center gap-3 rounded-2xl border border-amber-200 bg-amber-50/30 p-3 transition-colors hover:border-amber-300 dark:border-amber-800/30 dark:bg-amber-950/20 dark:hover:border-amber-700/50",children:[(0,r.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-2xl bg-gradient-to-br from-amber-500/20 to-amber-600/20",children:e.icon}),(0,r.jsx)("div",{className:"text-sm font-medium",children:e.text})]},s))})]}),(0,r.jsx)(et,{open:h,onOpenChange:g,expiresAtLabel:d?.expiresAt?V(d.expiresAt):e("endOfBillingPeriod"),onSaved:v,onCancelled:v}),(0,r.jsx)(en.FullScreenSubscriptionPopup,{isOpen:b,source:"settings_subscription",requiredTier:K??void 0,onClose:()=>p(!1)})]})}function ex({open:e,onOpenChange:y,initialTab:w="profile",tokenContext:S}){let k=(0,a.useTranslations)("settings"),[C,T]=(0,t.useState)(w);(0,t.useEffect)(()=>{w&&T(w)},[w]);let E=[{key:"profile",title:k("tabProfile"),icon:d.User,content:(0,r.jsx)(b.ProfileSettings,{})},{key:"account",title:k("tabAccount"),icon:o.Settings,content:(0,r.jsx)(p.AccountSettings,{onClose:()=>y(!1)})},{key:"subscription",title:k("tabSubscription"),icon:u.Crown,content:(0,r.jsx)(eu,{})},{key:"xot",title:k("tabXot"),icon:x.Coins,content:(0,r.jsx)(N.TokenSettings,{onClose:()=>y(!1),tokenContext:S})},{key:"roleplay",title:k("tabRoleplay"),icon:m.Theater,content:(0,r.jsx)(f.RoleplaySettings,{})},{key:"style",title:k("tabStyle"),icon:h.Palette,content:(0,r.jsx)(v.StylePreferenceSettings,{})},{key:"feed",title:k("tabFeed"),icon:g.Newspaper,content:(0,r.jsx)(s.FeedSettings,{})},{key:"notifications",title:k("tabNotifications"),icon:c.Bell,content:(0,r.jsx)(j.NotificationSettings,{})}];return(0,r.jsx)(i.Dialog,{open:e,onOpenChange:y,children:(0,r.jsxs)(i.DialogContent,{className:"max-w-4xl gap-0 overflow-hidden border-0 bg-background/95 p-0 shadow-xl backdrop-blur-lg dark:bg-stone-950/95 !rounded-3xl",children:[(0,r.jsx)(i.DialogHeader,{className:"mb-2 border-b border-gray-200 p-6 pb-0 dark:border-gray-700",children:(0,r.jsx)(i.DialogTitle,{className:"text-xl font-semibold",children:k("settings")})}),(0,r.jsxs)("div",{className:"relative flex h-[70vh] flex-col overflow-hidden sm:flex-row",children:[(0,r.jsx)("div",{className:"no-scrollbar hidden w-1/4 overflow-y-auto border-r border-gray-200 p-4 dark:border-gray-700 sm:block",children:(0,r.jsx)("div",{className:"flex flex-col space-y-1",children:E.map(e=>
1{let s=e.icon,t=C===e.key;return(0,r.jsxs)("button",{id:`${e.key}-tab`,onClick:()=>T(e.key),className:(0,n.cn)("flex items-center gap-3 rounded-md px-3 py-2 text-sm transition-all duration-200",t?"bg-primary/10 font-medium text-primary":"text-muted-foreground hover:bg-primary/5 hover:text-foreground"),children:[(0,r.jsx)(s,{className:"h-5 w-5"}),(0,r.jsx)("span",{children:e.title}),t&&(0,r.jsx)(l.div,{layoutId:"active-tab-indicator-desktop",className:"ml-auto h-1.5 w-1.5 rounded-full bg-primary",initial:{scale:0},animate:{scale:1},transition:{duration:.2}})]},e.key)})})}),(0,r.jsx)("div",{className:"no-scrollbar w-full flex-1 overflow-y-auto p-6 pb-20 sm:pb-6",children:E.find(e=>e.key===C)?.content}),(0,r.jsx)("div",{className:"fixed bottom-0 left-0 right-0 z-10 flex w-full flex-col border-t border-gray-200 bg-background/95 backdrop-blur-md dark:border-gray-700 dark:bg-stone-950/95 sm:hidden",children:(0,r.jsx)("div",{className:"no-scrollbar w-full overflow-x-auto py-2",children:(0,r.jsx)("div",{className:"flex min-w-max space-x-3 px-4",children:E.map(e=>{let s=e.icon,t=C===e.key;return(0,r.jsxs)("button",{id:`${e.key}-tab-mobile`,onClick:()=>T(e.key),className:(0,n.cn)("flex min-w-[64px] flex-col items-center rounded-md px-3 py-2 text-xs transition-all duration-200",t?"bg-primary/10 font-medium text-primary":"text-muted-foreground hover:bg-primary/5 hover:text-foreground"),children:[(0,r.jsx)(s,{className:"mb-1 h-5 w-5"}),(0,r.jsx)("span",{children:e.title})]},e.key)})})})})]})]})})}e.s(["SettingsModal",()=>ex,"SubscriptionModal",0,({isOpen:e,onClose:s})=>{let t=(0,a.useTranslations)("settings");return(0,r.jsx)(i.Dialog,{open:e,onOpenChange:s,children:(0,r.jsxs)(i.DialogContent,{className:"max-w-3xl overflow-hidden bg-background/95 p-6 backdrop-blur-lg dark:bg-stone-950/95 md:p-8 !rounded-3xl",children:[(0,r.jsxs)(i.DialogHeader,{className:"mb-6",children:[(0,r.jsxs)(i.DialogTitle,{className:"text-center text-2xl font-bold tracking-tight md:text-3xl",children:[t("purchase")," ",(0,r.jsx)("span",{className:"text-amber-500",children:t("tokens")})]}),(0,r.jsx)("p",{className:"mx-auto mt-2 max-w-2xl text-center text-sm text-muted-foreground",children:t("purchaseTokensSubtitle")})]}),(0,r.jsx)(N.TokenSettings,{})]})})}],170897)}]);
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.