1import{a as v}from"./chunk-6ORYOOUQ.js";import{e as O}from"./chunk-YBFQQSLW.js";import{cc as R,d as F,k as N,kh as q}from"./chunk-X5J6QTCG.js";import{$ as h,$a as u,Ad as I,Fa as s,G as k,Ib as t,Jb as j,Ka as d,Kb as f,Ma as T,Na as x,T as D,U as E,bb as p,d as y,db as A,eb as M,fa as b,fb as V,ga as S,gb as $,hb as a,ib as l,pj as P,qb as g,sb as C,tb as m,u as w,vd as U,xd as z}from"./chunk-SMW7PHYX.js";import"./chunk-BMIYOSOG.js";function G(r,i){if(r&1){let e=g();t(0,` 2 `),a(1,"div",5),t(2,` 3 `),a(3,"p-checkbox",6),C("onChange",function(n){let c=b(e).$implicit,_=m(3);return S(_.updateEmailCategoryId(n,c.value))}),t(4,` 4 `),l(),a(5,"label",7),t(6),l(),t(7,` 5 `),l(),t(8,` 6 `)}if(r&2){let e=i.$implicit,o=m(3);s(3),$("value",e.value)("binary",!0)("ngModel",o.isFieldChecked(e.value)),s(3),j(e.label)}}function J(r,i){if(r&1){let e=g();t(0,` 7 `),a(1,"div",8),t(2,` 8 `),a(3,"button",9),C("click",function(){b(e);let n=m(3);return S(n.unsubscribeAll())}),t(4,` 9 `),a(5,"div",10),t(6),l(),t(7,` 10 `),a(8,"div",11),t(9,"I understand that this option will remove me from club wide email communications."),l(),t(10,` 11 `),l(),t(11,` 12 `),l(),t(12,` 13 `)}if(r&2){let e=m(3);s(6),f("Please remove me from all lists at ",e.clubSettings.club.name)}}function L(r,i){if(r&1){let e=g();t(0,` 14 `),a(1,"div",8),t(2,` 15 `),a(3,"button",9),C("click",function(){b(e);let n=m(3);return S(n.subscribeAll())}),t(4,` 16 `),a(5,"div",10),t(6),l(),t(7,` 17 `),a(8,"div",11),t(9,"Subscribe to All"),l(),t(10,` 18 `),l(),t(11,` 19 `),l(),t(12,` 20 `)}if(r&2){let e=m(3);s(6),f("You are currently unsubscribed from all emails at ",e.clubSettings==null||e.clubSettings.club==null?null:e.clubSettings.club.name,". You will only receive communications related to account information.")}}function H(r,i){if(r&1&&(t(0,` 21 `),M(1,G,9,4,null,null,A),u(3,J,13,1),u(4,L,13,1)),r&2){let e=m(2);s(),V(e.emailSettings[0].options),s(2),p(!e.entity||e.entity.emailCategoryId.length!==e.zEmailCategory.length?3:-1),s(),p((e.entity==null||e.entity.emailCategoryId==null?null:e.entity.emailCategoryId.length)===e.zEmailCategory.length?4:-1)}}function K(r,i){if(r&1&&(t(0,` 22 `),a(1,"div",2),t(2,` 23 `),a(3,"div",3),t(4,` 24 `),a(5,"div"),t(6,` 25 `),a(7,"h3"),t(8),l(),t(9,` 26 `),l(),t(10,` 27 `),l(),t(11,` 28 `),a(12,"div",4),t(13,` 29 `),u(14,H,5,2),l(),t(15,` 30 `),t(16,` 31 `),l(),t(17,` 32 `)),r&2){let e=m();s(8),f("",e.clubSettings==null||e.clubSettings.club==null?null:e.clubSettings.club.name," Email Subscriptions"),s(6),p(e.emailSettings?14:-1)}}var Y=(()=>{let i=class i{constructor(o,n,c,_){this.siteDataService=o,this.emailSubscriptionService=n,this.route=c,this.router=_,this.unsubscribe$=new y,this.save$=new y,this.loading=!1,this.showEmailSettingsDialog=!1}ngOnInit(){this.save$.pipe(k(300),D(()=>this.emailSubscriptionService.saveEmailSettings(this.entity)),E(this.unsubscribe$)).subscribe({next:()=>this.siteDataService.showSiteSuccessAlert("Email Preferences Updated"),error:()=>this.siteDataService.showSiteErrorAlert("Error Updating Preferences")}),this.route.queryParams.subscribe(o=>{o.qs?(this.emailQuery=o.qs,w({clubSettings:this.siteDataService.getClubSettings(!0),emailMetadata:this.emailSubscriptionService.getEmailCategoryMetadata(),emailCategories:this.emailSubscriptionService.getEmailCategories(),userValues:this.emailSubscriptionService.getUserEmailUnsubscriptions(this.emailQuery)}).pipe(E(this.unsubscribe$)).subscribe({next:n=>{this.clubSettings=n.clubSettings,this.emailSettings=n.emailMetadata.fields,this.zEmailCategory=n.emailCategories,n.userValues&&(this.entity=new O,this.entity.emailCategoryId=n.userValues.map(({emailCategoryId:c})=>c)),this.loading=!1,this.siteDataService.hideSiteLoader()},error:()=>this.siteDataService.showSiteErrorAlertDefaultGET()})):this.router.navigate(["/dashboard"],{relativeTo:this.route})},()=>this.siteDataService.showSiteErrorAlert("An Error Occured"))}isFieldChecked(o){return this.entity&&this.entity.emailCategoryId?this.entity.emailCategoryId.findIndex(n=>n===o)===-1:!0}updateEmailCategoryId(o,n){o.checked?this.entity.emailCategoryId=this.entity.emailCategoryId.filter(c=>c!==n):this.entity.emailCategoryId.push(n),this.saveEmailSettings()}unsubscribeAll(){this.entity.emailCategoryId=[],this.zEmailCategory.forEac
32h(o=>{this.entity.emailCategoryId=[...new Set([...this.entity.emailCategoryId,o.id])]}),this.saveEmailSettings()}subscribeAll(){this.entity.emailCategoryId=[],this.saveEmailSettings()}saveEmailSettings(){this.entity.email=this.emailQuery,this.save$.next()}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}};i.\u0275fac=function(n){return new(n||i)(d(P),d(v),d(U),d(z))},i.\u0275cmp=T({type:i,selectors:[["ng-component"]],standalone:!1,decls:7,vars:1,consts:[[2,"padding-top","60px"],[1,"container"],[1,"card","edit-card","pb-1"],[1,"card-header"],[1,"card-body","py-3"],[1,"mb-3"],[3,"onChange","value","binary","ngModel"],[1,"ml-2"],[1,"border-top"],[1,"btn-a11y","border-all","p-3","border-radius","bg-primary-hover",3,"click"],[1,"fw-700","mb-2"],[1,"text-medium"]],template:function(n,c){n&1&&(a(0,"main",0),t(1,` 33 `),a(2,"div",1),t(3,` 34 `),u(4,K,18,2),l(),t(5,` 35`),l(),t(6,` 36`)),n&2&&(s(4),p(c.loading?-1:4))},dependencies:[F,N,R],encapsulation:2});let r=i;return r})();var B=(()=>{let i=class i{};i.\u0275fac=function(n){return new(n||i)},i.\u0275mod=x({type:i}),i.\u0275inj=h({imports:[I.forChild([{path:"",component:Y}]),I]});let r=i;return r})();var gt=(()=>{let i=class i{};i.\u0275fac=function(n){return new(n||i)},i.\u0275mod=x({type:i}),i.\u0275inj=h({providers:[v],imports:[q,B]});let r=i;return r})();export{gt as EmailSubscriptionModule};
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.