1import{a as V}from"./chunk-YBY5KBAD.js";import{a as A,b as W,c as B,d as O}from"./chunk-HCKMG35W.js";import{a as I,b as $}from"./chunk-GRJCMPPK.js";import{a as j}from"./chunk-BPRAF6UX.js";import{l as U}from"./chunk-GVKCEWLH.js";import{a as D}from"./chunk-TZBLB6PJ.js";import{a as R}from"./chunk-2C4NJPSP.js";import"./chunk-TXGKLLCI.js";import{a as P}from"./chunk-4QXTYDGK.js";import"./chunk-PYVUQE42.js";import"./chunk-BXVXVZI5.js";import"./chunk-QONMVMJJ.js";import"./chunk-BR7SVKEQ.js";import"./chunk-JGDRMP4N.js";import"./chunk-EZWV5NND.js";import"./chunk-2PPFUFFT.js";import"./chunk-7CN4IQMJ.js";import{a as M,d as T}from"./chunk-6ATSIKZN.js";import"./chunk-Y3YKJBPO.js";import{Ib as h,Pb as S,Ub as s,V as p,Vb as i,Xc as C,_b as x,bc as c,dc as u,f as y,gb as a,lb as d,na as b,oa as k,qc as r,sb as v,sc as w,xd as E,yb as f}from"./chunk-CNARTFLR.js";import"./chunk-EQDQRRRY.js";function z(o,_){o&1&&r(0," Link sent ")}function L(o,_){if(o&1&&r(0),o&2){let e=u(2);w(" ",e.passwordResetSending?"Sending...":"Send reset link"," ")}}function q(o,_){if(o&1){let e=x();s(0,"app-card",9)(1,"h2",1),r(2,"Security"),i(),s(3,"div",10)(4,"div",4)(5,"p",5),r(6,"Password"),i(),s(7,"p",6),r(8),i()(),s(9,"button",11),c("click",function(){b(e);let n=u();return k(n.onSendPasswordReset())}),f(10,z,1,0)(11,L,1,1),i()()()}if(o&2){let e=u();a(8),w(" We'll email a secure link to ",e.user.email," so you can set a new password. The link expires shortly for your safety. "),a(),h("disabled",e.passwordResetSending||e.passwordResetSent),a(),S(e.passwordResetSent?10:11)}}var oe=(()=>{class o{constructor(e,t,n,g,l){this.title=e,this.auth=t,this.actionChips=n,this.settingsService=g,this.snackbar=l,this.showSimilar=!0,this.showMore=!0,this.weeklyEmail=!0,this.isUpdating=!1,this.passwordResetSending=!1,this.passwordResetSent=!1,this.destroy$=new y,this.title.set("Preferences"),this.actionChips.setState([A,W,B,O]),C(()=>{let m=this.auth.userProfileSig();m&&(this.user=m,this.showSimilar=m.show_similar??!0,this.showMore=m.show_more??!0,this.weeklyEmail=!(m.email_opt_out??!1))})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}onSendPasswordReset(){!this.user?.email||this.passwordResetSending||(this.passwordResetSending=!0,this.settingsService.requestPasswordReset(this.user.email).pipe(p(this.destroy$)).subscribe({next:e=>{this.passwordResetSending=!1,this.passwordResetSent=!0,this.snackbar.open(e?.message??"Password reset link sent to your email.","Close",{horizontalPosition:"right",duration:6e3})},error:e=>{this.passwordResetSending=!1,this.snackbar.open(e?.error?.message??"Could not send the reset link. Please try again.","Close",{horizontalPosition:"right",duration:6e3})}}))}onToggleShowSimilar(e){this.isUpdating=!0,this.settingsService.toggleShowSimilar().pipe(p(this.destroy$)).subscribe({next:t=>{this.showSimilar=t.show_similar,this.isUpdating=!1,this.auth.refreshUserProfile()},error:t=>{console.error("Error updating show similar setting:",t),this.showSimilar=!e.checked,this.isUpdating=!1}})}onToggleShowMore(e){this.isUpdating=!0,this.settingsService.toggleShowMore().pipe(p(this.destroy$)).subscribe({next:t=>{this.showMore=t.show_more,this.isUpdating=!1,this.auth.refreshUserProfile()},error:t=>{console.error("Error updating show more setting:",t),this.showMore=!e.checked,this.isUpdating=!1}})}onToggleWeeklyEmail(e){this.isUpdating=!0,this.settingsService.toggleEmailOptOut().pipe(p(this.destroy$)).subscribe({next:t=>{this.weeklyEmail=!t.email_opt_out,this.isUpdating=!1,this.auth.refreshUserProfile()},error:t=>{console.error("Error updating email preference:",t),this.weeklyEmail=!e.checked,this.isUpdating=!1}})}static{this.\u0275fac=function(t){return new(t||o)(d(R),d(P),d(j),d(V),d(U))}}static{this.\u0275cmp=v({type:o,selectors:[["app-dashboard-settings-preferences"]],decls:30,vars:7,consts:[[1,"max-w-2xl","pb-40"],[1,"text-base","font-semibold","mb-1"],[1,"divide-y","divide-white/[0.06]"],[1,"flex","items-start","justify-between","gap-6","py-4"],[1,"min-w-0"],[1,"m-0","text-sm","font-medium","text-white"],[1,"m-0","mt-0.5","text-[13px]","leading-snug","text-muted"],[1,"mt-0.5","shrink-0",3,"change","checked","disabled"],[1,"flex","items-start","justify-between","gap-6","py-4","!pb-1"],[1,"mt-4","block"],[1,"flex","items-start","justify-between","gap-6","pt-4","pb-1"],["mat-stroked-button","","type","button",1,"mt-0.5","shrink-0","px-4","py-2","text-sm",3,"click","disabled"]],template:function(t,n){t&1&&(s(0,"div",0)(1,"app-card")(2,"h2",1),r(3,"Link preferences"),i(),s(4,"div",2)(5,"div",3)(6,"div",4)(7,"p",5),r(8,"Show similar links"),i(),s(9,"p",6),r(10," Display similar links at the bottom of your social unlock pages. When disabled, your links also won't be recommended to others. "),i()(),s(11,"mat-slide-toggle",7),c("change",function(l){return n.onToggleShowSimilar(l)}),i()(),s(12,"div",8)(13,"div",4)(14,"p",5),r(15,"Show more from me"),i(),s(16,"p",6),r(17,' Display your other links in a "More from this user" section '),i()(),s(18,"mat-slide-toggle",7),c("change",function(l){return n.onToggleShowMore(l)}),i()()()(),s(19,"app-card",9)(20,"h2",1),r(21,"Emails"),i(),s(22,"div",10)(23,"div",4)(24,"p",5),r(25,"Weekly overview email"),i(),s(26,"p",6),r(27," A weekly summary of your links' views, unlocks and completed actions. Account and security emails are always sent. "),i()(),s(28,"mat-slide-toggle",7),c("change",function(l){return n.onToggleWeeklyEmail(l)}),i()()(),f(29,q,12,3,"app-card",9),i()),t&2&&(a(11),h("checked",n.showSimilar)("disabled",n.isUpdating),a(7),h("checked",n.showMore)("disabled",n.isUpdating),a(10),h("checked",n.weeklyEmail)("disabled",n.isUpdating),a(),S(n.user&&n.user.has_password?29:-1))},dependencies:[E,$,I,T,M,D],encapsulation:2})}}return o}
1)();export{oe as DashboardSettingsPreferencesComponent};
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.