1"use strict";(self.webpackChunkfuse=self.webpackChunkfuse||[]).push([[9625],{29625:(X,S,s)=>{s.r(S),s.d(S,{ContactsModule:()=>B});var m=s(58474),h=s(4859),_=s(56709),D=s(3238),Q=s(99602),G=s(44850),b=s(59549),w=s(97392),O=s(284),z=s(9506),p=s(28255),T=s(73162),c=s(71948),l=s(84385),u=s(23267),A=s(30671),q=s(10266),j=s(73190),E=s(44466),t=s(94650);class J{canDeactivate(e,n,a,i){let r=i.root;for(;r.firstChild;)r=r.firstChild;return!(i.url.includes("/contacts")&&!r.paramMap.get("id"))||e.closeDrawer().then(()=>!0)}}J.\u0275fac=function(e){return new(e||J)},J.\u0275prov=t.Yz7({token:J,factory:J.\u0275fac,providedIn:"root"});var tt=s(70262),H=s(62843),P=s(61135),F=s(18505),x=s(95698),Z=s(54004),f=s(63900),et=s(39646),$=s(39300),nt=s(80529);class v{constructor(e){this._httpClient=e,this._contact=new P.X(null),this._contacts=new P.X(null),this._countries=new P.X(null),this._tags=new P.X(null)}get contact$(){return this._contact.asObservable()}get contacts$(){return this._contacts.asObservable()}get countries$(){return this._countries.asObservable()}get tags$(){return this._tags.asObservable()}getContacts(){return this._httpClient.get("api/apps/contacts/all").pipe((0,F.b)(e=>{this._contacts.next(e)}))}searchContacts(e){return this._httpClient.get("api/apps/contacts/search",{params:{query:e}}).pipe((0,F.b)(n=>{this._contacts.next(n)}))}getContactById(e){return this._contacts.pipe((0,x.q)(1),(0,Z.U)(n=>{const a=n.find(i=>i.id===e)||null;return this._contact.next(a),a}),(0,f.w)(n=>n?(0,et.of)(n):(0,H._)("Could not found contact with id of "+e+"!")))}createContact(){return this.contacts$.pipe((0,x.q)(1),(0,f.w)(e=>this._httpClient.post("api/apps/contacts/contact",{}).pipe((0,Z.U)(n=>(this._contacts.next([n,...e]),n)))))}updateContact(e,n){return this.contacts$.pipe((0,x.q)(1),(0,f.w)(a=>this._httpClient.patch("api/apps/contacts/contact",{id:e,contact:n}).pipe((0,Z.U)(i=>{const r=a.findIndex(g=>g.id===e);return a[r]=i,this._contacts.next(a),i}),(0,f.w)(i=>this.contact$.pipe((0,x.q)(1),(0,$.h)(r=>r&&r.id===e),(0,F.b)(()=>(this._contact.next(i),i)))))))}deleteContact(e){return this.contacts$.pipe((0,x.q)(1),(0,f.w)(n=>this._httpClient.delete("api/apps/contacts/contact",{params:{id:e}}).pipe((0,Z.U)(a=>{const i=n.findIndex(r=>
1r.id===e);return n.splice(i,1),this._contacts.next(n),a}))))}getCountries(){return this._httpClient.get("api/apps/contacts/countries").pipe((0,F.b)(e=>{this._countries.next(e)}))}getTags(){return this._httpClient.get("api/apps/contacts/tags").pipe((0,F.b)(e=>{this._tags.next(e)}))}createTag(e){return this.tags$.pipe((0,x.q)(1),(0,f.w)(n=>this._httpClient.post("api/apps/contacts/tag",{tag:e}).pipe((0,Z.U)(a=>(this._tags.next([...n,a]),a)))))}updateTag(e,n){return this.tags$.pipe((0,x.q)(1),(0,f.w)(a=>this._httpClient.patch("api/apps/contacts/tag",{id:e,tag:n}).pipe((0,Z.U)(i=>{const r=a.findIndex(g=>g.id===e);return a[r]=i,this._tags.next(a),i}))))}deleteTag(e){return this.tags$.pipe((0,x.q)(1),(0,f.w)(n=>this._httpClient.delete("api/apps/contacts/tag",{params:{id:e}}).pipe((0,Z.U)(a=>{const i=n.findIndex(r=>r.id===e);return n.splice(i,1),this._tags.next(n),a}),(0,$.h)(a=>a),(0,f.w)(a=>this.contacts$.pipe((0,x.q)(1),(0,Z.U)(i=>(i.forEach(r=>{const g=r.tags.findIndex(k=>k===e);g>-1&&r.tags.splice(g,1)}),a)))))))}uploadAvatar(e,n){return this.contacts$.pipe((0,x.q)(1),(0,f.w)(a=>this._httpClient.post("api/apps/contacts/avatar",{id:e,avatar:n},{headers:{"Content-Type":n.type}}).pipe((0,Z.U)(i=>{const r=a.findIndex(g=>g.id===e);return a[r]=i,this._contacts.next(a),i}),(0,f.w)(i=>this.contact$.pipe((0,x.q)(1),(0,$.h)(r=>r&&r.id===e),(0,F.b)(()=>(this._contact.next(i),i)))))))}}v.\u0275fac=function(e){return new(e||v)(t.LFG(nt.eN))},v.\u0275prov=t.Yz7({token:v,factory:v.\u0275fac,providedIn:"root"});class N{constructor(e){this._contactsService=e}resolve(e,n){return this._contactsService.getContacts()}}N.\u0275fac=function(e){return new(e||N)(t.LFG(v))},N.\u0275prov=t.Yz7({token:N,factory:N.\u0275fac,providedIn:"root"});class U{constructor(e,n){this._contactsService=e,this._router=n}resolve(e,n){return this._contactsService.getContactById(e.paramMap.get("id")).pipe((0,tt.K)(a=>{console.error(a);const i=n.url.split("/").slice(0,-1).join("/");return this._router.navigateByUrl(i),(0,H._)(a)}))}}U.\u0275fac=function(e){return new(e||U)(t.LFG(v),t.LFG(m.F0))},U.\u0275prov=t.Yz7({token:U,factory:U.\u0275fac,providedIn:"root"});class I{constructor(e){this._contactsService=e}resolve(e,n){return this._contactsService.getCountries()}}I.\u0275fac=function(e){return new(e||I)(t.LFG(v))},I.\u0275prov=t.Yz7({token:I,factory:I.\u0275fac,providedIn:"root"});class L{constructor(e){this._contactsService=e}resolve(e,n){return this._contactsService.getTags()}}L.\u0275fac=function(e){return new(e||L)(t.LFG(v))},L.\u0275prov=t.Yz7({token:L,factory:L.\u0275fac,providedIn:"root"});class R{constructor(){}}R.\u0275fac=function(e){return new(e||R)},R.\u0275cmp=t.Xpm({type:R,selectors:[["contacts"]],decls:1,vars:0,template:function(e,n){1&e&&t._UZ(0,"router-outlet")},dependencies:[m.lC],encapsulation:2,changeDetection:0});var C=s(36895),d=s(24006),K=s(77579),y=s(82722),ot=s(54968),at=s(94880);const it=["matDrawer"];function ct(o,e){if(1&o&&(t.ynx(0),t._uU(1),t.BQk()),2&o){const n=t.oxw();t.xp6(1),t.hij(" ",n.contactsCount," ")}}function rt(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",26),t._uU(2),t.qZA(),t.BQk()),2&o){const n=t.oxw().$implicit;t.xp6(2),t.hij(" ",n.name.charAt(0)," ")}}function st(o,e){if(1&o&&(t.ynx(0),t._UZ(1,"img",27),t.BQk()),2&o){const n=t.oxw().$implicit;t.xp6(1),t.Q6J("src",n.avatar,t.LSH)}}function lt(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",28),t._uU(2),t.qZA(),t.BQk()),2&o){const n=t.oxw().$implicit;t.xp6(2),t.hij(" ",n.name.charAt(0)," ")}}const pt=function(o,e){return{"hover:bg-gray-100 dark:hover:bg-hover":o,"bg-primary-50 dark:bg-hover":e}},_t=function(o){return["./",o]};function ut(o,e){if(1&o&&(t.ynx(0),t.YNc(1,rt,3,1,"ng-container",9),t.TgZ(2,"a",21)(3,"div",22),t.YNc(4,st,2,1,"ng-container",9),t.YNc(5,lt,3,1,"ng-container",9),t.qZA(),t.TgZ(6,"div",23)(7,"div",24),t._uU(8),t.qZA(),t.TgZ(9,"div",25),t._uU(10),t.qZA()()(),t.BQk()),2&o){const n=e.$implicit,a=e.index,i=t.oxw(2).ngIf,r=t.oxw();
1t.xp6(1),t.Q6J("ngIf",0===a||n.name.charAt(0)!==i[a-1].name.charAt(0)),t.xp6(1),t.Q6J("ngClass",t.WLB(7,pt,!r.selectedContact||r.selectedContact.id!==n.id,r.selectedContact&&r.selectedContact.id===n.id))("routerLink",t.VKq(10,_t,n.id)),t.xp6(2),t.Q6J("ngIf",n.avatar),t.xp6(1),t.Q6J("ngIf",!n.avatar),t.xp6(3),t.Oqu(n.name),t.xp6(2),t.Oqu(n.title)}}function gt(o,e){if(1&o&&(t.ynx(0),t.YNc(1,ut,11,12,"ng-container",20),t.BQk()),2&o){const n=t.oxw().ngIf,a=t.oxw();t.xp6(1),t.Q6J("ngForOf",n)("ngForTrackBy",a.trackByFn)}}function mt(o,e){if(1&o&&(t.ynx(0),t.YNc(1,gt,2,2,"ng-container",19),t.BQk()),2&o){const n=e.ngIf;t.oxw();const a=t.MAs(28);t.xp6(1),t.Q6J("ngIf",n.length)("ngIfElse",a)}}function dt(o,e){1&o&&(t.TgZ(0,"div",29),t._uU(1,"There are no contacts!"),t.qZA())}const ft=function(){return{"=0":"No contacts","=1":"contact",other:"contacts"}};class M{constructor(e,n,a,i,r,g){this._activatedRoute=e,this._changeDetectorRef=n,this._contactsService=a,this._document=i,this._router=r,this._fuseMediaWatcherService=g,this.contactsCount=0,this.contactsTableColumns=["name","email","phoneNumber","job"],this.searchInputControl=new d.p4,this._unsubscribeAll=new K.x}ngOnInit(){this.contacts$=this._contactsService.contacts$,this._contactsService.contacts$.pipe((0,y.R)(this._unsubscribeAll)).subscribe(e=>{this.contactsCount=e.length,this._changeDetectorRef.markForCheck()}),this._contactsService.contact$.pipe((0,y.R)(this._unsubscribeAll)).subscribe(e=>{this.selectedContact=e,this._changeDetectorRef.markForCheck()}),this._contactsService.countries$.pipe((0,y.R)(this._unsubscribeAll)).subscribe(e=>{this.countries=e,this._changeDetectorRef.markForCheck()}),this.searchInputControl.valueChanges.pipe((0,y.R)(this._unsubscribeAll),(0,f.w)(e=>this._contactsService.searchContacts(e))).subscribe(),this.matDrawer.openedChange.subscribe(e=>{e||(this.selectedContact=null,this._changeDetectorRef.markForCheck())}),this._fuseMediaWatcherService.onMediaChange$.pipe((0,y.R)(this._unsubscribeAll)).subscribe(({matchingAliases:e})=>{this.drawerMode=e.includes("lg")?"side":"over",this._changeDetectorRef.markForCheck()}),(0,ot.R)(this._document,"keydown").pipe((0,y.R)(this._unsubscribeAll),(0,$.h)(e=>(!0===e.ctrlKey||e.metaKey)&&"/"===e.key)).subscribe(()=>{this.createContact()})}ngOnDestroy(){this._unsubscribeAll.next(null),this._unsubscribeAll.complete()}onBackdropClicked(){this._router.navigate(["./"],{relativeTo:this._activatedRoute}),this._changeDetectorRef.markForCheck()}createContact(){this._contactsService.createContact().subscribe(e=>{this._router.navigate(["./",e.id],{relativeTo:this._activatedRoute}),this._changeDetectorRef.markForCheck()})}trackByFn(e,n){return n.id||e}}M.\u0275fac=function(e){return new(e||M)(t.Y36(m.gz),t.Y36(t.sBO),t.Y36(v),t.Y36(C.K0),t.Y36(m.F0),t.Y36(at.T))},M.\u0275cmp=t.Xpm({type:M,selectors:[["contacts-list"]],viewQuery:function(e,n){if(1&e&&t.Gf(it,7),2&e){let a;t.iGM(a=t.CRH())&&(n.matDrawer=a.first)}},decls:29,vars:19,consts:[[1,"absolute","inset-0","flex","flex-col","min-w-0","overflow-hidden"],[1,"flex-auto","h-full","bg-card","dark:bg-transparent",3,"backdropClick"],[1,"w-full","md:w-160","dark:bg-gray-900",3,"mode","opened","position","disableClose"],["matDrawer",""],[1,"flex","flex-col"],[1,"flex-auto"],[1,"flex","flex-col","sm:flex-row","md:flex-col","flex-auto","justify-between","py-8","px-6","md:px-8","border-b"],[1,"text-4xl","font-extrabold","tracking-tight","leading-none"],[1,"ml-0.5","font-medium","text-secondary"],[4,"ngIf"],[1,"flex","items-center","mt-4","sm:mt-0","md:mt-4"],["subscriptSizing","dynamic",1,"fuse-mat-dense","fuse-mat-rounded","w-full","min-w-50"],["matPrefix","",1,"icon-size-5",3,"svgIcon"],["matInput","",3,"formControl","autocomplete","placeholder"],["mat-flat-button","",1,"ml-4",3,"color","click"],[3,"svgIcon"],[1,"ml-2","mr-1"],[1,"relative"],["noContacts",""],[4,"ngIf","ngIfElse"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"z-20","flex","items-center","px-6","py-4","md:px-8","cursor-pointer","border-b",3,"ngClass","routerLink"],[1,"flex","flex-0","items-center","justify-center","w-10","h-10","rounded-full","overflow-hidden"],[1,"min-w-0","ml-4"],[1,"font-medium","leading-5","truncate"],[1,"leading-5","truncate","text-secondary"],[1,"z-10","sticky","top-0","-mt-px","px-6","py-1","md:px-8","border-t","border-b","font-medium","uppercase","text-secondary","bg-gray-50","dark:bg-gray-900"],["alt","Contact avatar",1,"object-cover","w-full","h-full",3,"src"],[1,"flex","items-center","justify-center","w-full","h-full","rounded-full","text-lg","uppercase","bg-gray-200","text-gray-600","dark:bg-gray-700","dark:text-gray-200"],[1,"p-8","sm:p-16","border-t","text-4xl","font-semibold","tracking-tight","text-center"]],template:function(e,n){1&e&&(t.TgZ(0,"div",0)(1,"mat-drawer-container",1),t.NdJ("backdropClick",function(){return n.onBackdropClicked()}),t.TgZ(2,"mat-drawer",2,3),t._UZ(4,"router-outlet"),t.qZA(),t.TgZ(5,"mat-drawer-content",4)(6,"div",5)(7,"div",6)(8,"div")(9,"div",7),t._uU(10,"Contacts"),t.qZA(),t.TgZ(11,"div",8),t.YNc(12,ct,2,1,"ng-container",9),t._uU(13),t.ALo(14,"i18nPlural"),t.qZA()(),t.TgZ(15,"div",10)(16,"div",5)(17,"mat-form-field",11),t._UZ(18,"mat-icon",12)(19,"input",13),t.qZA()(),t.TgZ(20,"button",14),t.NdJ("click",function(){return n.createContact()}),t._UZ(21,"mat-icon",15),t.TgZ(22,"span",16),t._uU(23,"Add"),t.qZA()()()(),t.TgZ(24,"div",17),t.YNc(25,mt,2,2,"ng-container",9),t.ALo(26,"async"),t.YNc(27,dt,2,0,"ng-template",null,18,t.W1O),t.qZA()()()()()),2&e&&(t.xp6(2),t.Q6J("mode",n.drawerMode)("opened",!1)("position","end")("disableClose",!0),t.xp6(10),t.Q6J("ngIf",n.contactsCount>0),t.xp6(1),t.hij(" ",t.xi3(14,13,n.contactsCount,t.DdM(18,ft))," "),t.xp6(5),t.Q6J("svgIcon","heroicons_solid:search"),t.xp6(1),t.Q6J("formControl",n.searchInputControl)("autocomplete","off")("placeholder","Search contacts"),t.xp6(1),t.Q6J("color","primary"),t.xp6(1),t.Q6J("svgIcon","heroicons_outline:plus"),t.xp6(4),t.Q6J("ngIf",t.lcZ(26,16,n.contacts$)))},dependencies:[m.lC,m.rH,h.lW,b.KE,b.qo,w.Hw,O.Nt,u.jA,u.kh,u.LW,C.mk,C.sg,C.O5,d.Fj,d.JJ,d.oH,C.Ov,C.Gx],encapsulation:2,changeDetection:0});var ht=s(84080),xt=s(78372),vt=s(7401),Ct=s(98184),yt=s(39349),bt=s(3005);const Tt=["avatarFileInput"],Zt=["tagsPanel"],kt=["tagsPanelOrigin"];function At(o,e){if(1&o&&(t.ynx(0),t._UZ(1,"img",18),t.BQk()),2&o){const n=t.oxw(2);
1t.xp6(1),t.Q6J("src",n.contact.background,t.LSH)}}function Dt(o,e){if(1&o&&t._UZ(0,"img",19),2&o){const n=t.oxw(2);t.Q6J("src",n.contact.avatar,t.LSH)}}function It(o,e){if(1&o&&(t.TgZ(0,"div",20),t._uU(1),t.qZA()),2&o){const n=t.oxw(2);t.xp6(1),t.hij(" ",n.contact.name.charAt(0)," ")}}function Qt(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",23)(2,"span",24),t._uU(3),t.qZA()(),t.BQk()),2&o){const n=e.$implicit;t.xp6(3),t.Oqu(n.title)}}function wt(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",21),t.YNc(2,Qt,4,1,"ng-container",22),t.ALo(3,"fuseFindByKey"),t.qZA(),t.BQk()),2&o){const n=t.oxw(2);t.xp6(2),t.Q6J("ngForOf",t.Dn7(3,2,n.contact.tags,"id",n.tags))("ngForTrackBy",n.trackByFn)}}function Jt(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",25),t._UZ(2,"mat-icon",26),t.TgZ(3,"div",27),t._uU(4),t.qZA()(),t.BQk()),2&o){const n=t.oxw(2);t.xp6(2),t.Q6J("svgIcon","heroicons_outline:briefcase"),t.xp6(2),t.Oqu(n.contact.title)}}function Ft(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",25),t._UZ(2,"mat-icon",26),t.TgZ(3,"div",27),t._uU(4),t.qZA()(),t.BQk()),2&o){const n=t.oxw(2);t.xp6(2),t.Q6J("svgIcon","heroicons_outline:office-building"),t.xp6(2),t.Oqu(n.contact.company)}}function Nt(o,e){if(1&o&&(t.TgZ(0,"div",33)(1,"span",34),t._uU(2,"\u2022"),t.qZA(),t.TgZ(3,"span",35),t._uU(4),t.qZA()()),2&o){const n=t.oxw().$implicit;t.xp6(4),t.Oqu(n.label)}}function Ut(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",30)(2,"a",31),t._uU(3),t.qZA(),t.YNc(4,Nt,5,1,"div",32),t.qZA(),t.BQk()),2&o){const n=e.$implicit;t.xp6(2),t.Q6J("href","mailto:"+n.email,t.LSH),t.xp6(1),t.hij(" ",n.email," "),t.xp6(1),t.Q6J("ngIf",n.label)}}function Lt(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",28),t._UZ(2,"mat-icon",26),t.TgZ(3,"div",29),t.YNc(4,Ut,5,3,"ng-container",22),t.qZA()(),t.BQk()),2&o){const n=t.oxw(2);t.xp6(2),t.Q6J("svgIcon","heroicons_outline:mail"),t.xp6(2),t.Q6J("ngForOf",n.contact.emails)("ngForTrackBy",n.trackByFn)}}function Mt(o,e){if(1&o&&(t.TgZ(0,"div",33)(1,"span",34),t._uU(2,"\u2022"),t.qZA(),t.TgZ(3,"span",35),t._uU(4),t.qZA()()),2&o){const n=t.oxw().$implicit;t.xp6(4),t.Oqu(n.label)}}function Bt(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",30),t._UZ(2,"div",36),t.TgZ(3,"div",37),t._uU(4),t.qZA(),t.TgZ(5,"div",38),t._uU(6),t.qZA(),t.YNc(7,Mt,5,1,"div",32),t.qZA(),t.BQk()),2&o){const n=e.$implicit,a=t.oxw(3);t.xp6(2),t.Udp("background","url('/assets/images/apps/contacts/flags.png') no-repeat 0 0")("background-size","24px 3876px")("background-position",a.getCountryByIso(n.country).flagImagePos),t.Q6J("matTooltip",a.getCountryByIso(n.country).name),t.xp6(2),t.Oqu(a.getCountryByIso(n.country).code),t.xp6(2),t.Oqu(n.phoneNumber),t.xp6(1),t.Q6J("ngIf",n.label)}}function Ot(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",28),t._UZ(2,"mat-icon",26),t.TgZ(3,"div",29),t.YNc(4,Bt,8,10,"ng-container",22),t.qZA()(),t.BQk()),2&o){const n=t.oxw(2);t.xp6(2),t.Q6J("svgIcon","heroicons_outline:phone"),t.xp6(2),t.Q6J("ngForOf",n.contact.phoneNumbers)("ngForTrackBy",n.trackByFn)}}function Rt(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",25),t._UZ(2,"mat-icon",26),t.TgZ(3,"div",27),t._uU(4),t.qZA()(),t.BQk()),2&o){const n=t.oxw(2);t.xp6(2),t.Q6J("svgIcon","heroicons_outline:location-marker"),t.xp6(2),t.Oqu(n.contact.address)}}function Yt(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",25),t._UZ(2,"mat-icon",26),t.TgZ(3,"div",27),t._uU(4),t.ALo(5,"date"),t.qZA()(),t.BQk()),2&o){const n=t.oxw(2);t.xp6(2),t.Q6J("svgIcon","heroicons_outline:cake"),t.xp6(2),t.Oqu(t.xi3(5,2,n.contact.birthday,"longDate"))}}function St(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",28),t._UZ(2,"mat-icon",26)(3,"div",39),t.qZA(),t.BQk()),2&o){const n=t.oxw(2);t.xp6(2),t.Q6J("svgIcon","heroicons_outline:menu-alt-2"),t.xp6(1),t.Q6J("innerHTML",n.contact.notes,t.oJD)}}const V=function(){return["../"]};function qt(o,e){if(1&o){const n=t.EpF();t.ynx(0),t.TgZ(1,"div",2),t.YNc(2,At,2,1,"ng-container",1),t.TgZ(3,"div",3)(4,"a",4),t._UZ(5,"mat-icon",5),t.qZA()()(),t.TgZ(6,"div",6)(7,"div",7)(8,"div",8)(9,"div",9),t.YNc(10,Dt,1,1,"img",10),t.YNc(11,It,2,1,"div",11),t.qZA(),t.TgZ(12,"div",12)(13,"button",13),t.NdJ("click",function(){t.CHM(n);const i=t.oxw();return t.KtG(i.toggleEditMode(!0))}),t._UZ(14,"mat-icon",14),t.TgZ(15,"span",15),t._uU(16,"Edit"),t.qZA()()()(),t.TgZ(17,"div",16),t._uU(18),t.qZA(),t.YNc(19,wt,4,6,"ng-container",1),t.TgZ(20,"div",17),t.YNc(21,Jt,5,2,"ng-container",1),t.YNc(22,Ft,5,2,"ng-container",1),t.YNc(23,Lt,5,3,"ng-container",1),t.YNc(24,Ot,5,3,"ng-container",1),t.YNc(25,Rt,5,2,"ng-container",1),t.YNc(26,Yt,6,5,"ng-container",1),t.YNc(27,St,4,2,"ng-container",1),t.qZA()()(),t.BQk()}if(2&o){const n=t.oxw();
1t.xp6(2),t.Q6J("ngIf",n.contact.background),t.xp6(2),t.Q6J("matTooltip","Close")("routerLink",t.DdM(16,V)),t.xp6(1),t.Q6J("svgIcon","heroicons_outline:x"),t.xp6(5),t.Q6J("ngIf",n.contact.avatar),t.xp6(1),t.Q6J("ngIf",!n.contact.avatar),t.xp6(3),t.Q6J("svgIcon","heroicons_solid:pencil-alt"),t.xp6(4),t.Oqu(n.contact.name),t.xp6(1),t.Q6J("ngIf",n.contact.tags.length),t.xp6(2),t.Q6J("ngIf",n.contact.title),t.xp6(1),t.Q6J("ngIf",n.contact.company),t.xp6(1),t.Q6J("ngIf",n.contact.emails.length),t.xp6(1),t.Q6J("ngIf",n.contact.phoneNumbers.length),t.xp6(1),t.Q6J("ngIf",n.contact.address),t.xp6(1),t.Q6J("ngIf",n.contact.birthday),t.xp6(1),t.Q6J("ngIf",n.contact.notes)}}function Et(o,e){if(1&o&&(t.ynx(0),t._UZ(1,"img",18),t.BQk()),2&o){const n=t.oxw(2);t.xp6(1),t.Q6J("src",n.contact.background,t.LSH)}}function Pt(o,e){if(1&o&&t._UZ(0,"img",19),2&o){const n=t.oxw(2);t.Q6J("src",n.contact.avatar,t.LSH)}}function $t(o,e){if(1&o&&(t.TgZ(0,"div",20),t._uU(1),t.qZA()),2&o){const n=t.oxw(2);t.xp6(1),t.hij(" ",n.contact.name.charAt(0)," ")}}function Gt(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",69)(2,"span",70),t._uU(3),t.qZA()(),t.BQk()),2&o){const n=e.$implicit;t.xp6(3),t.Oqu(n.title)}}function zt(o,e){if(1&o&&(t.ynx(0),t.YNc(1,Gt,4,1,"ng-container",22),t.ALo(2,"fuseFindByKey"),t.BQk()),2&o){const n=t.oxw(2);t.xp6(1),t.Q6J("ngForOf",t.Dn7(2,2,n.contact.tags,"id",n.tags))("ngForTrackBy",n.trackByFn)}}function jt(o,e){1&o&&(t.ynx(0),t._UZ(1,"mat-icon",14),t.TgZ(2,"span",71),t._uU(3,"Edit"),t.qZA(),t.BQk()),2&o&&(t.xp6(1),t.Q6J("svgIcon","heroicons_solid:pencil-alt"))}function Ht(o,e){1&o&&(t.ynx(0),t._UZ(1,"mat-icon",14),t.TgZ(2,"span",71),t._uU(3,"Add"),t.qZA(),t.BQk()),2&o&&(t.xp6(1),t.Q6J("svgIcon","heroicons_solid:plus-circle"))}function Kt(o,e){1&o&&t._UZ(0,"mat-icon",14),2&o&&t.Q6J("svgIcon","heroicons_solid:pencil-alt")}function Vt(o,e){1&o&&t._UZ(0,"mat-icon",14),2&o&&t.Q6J("svgIcon","heroicons_solid:check")}function Wt(o,e){if(1&o){const n=t.EpF();t.ynx(0),t.TgZ(1,"div",81),t.NdJ("click",function(){const r=t.CHM(n).$implicit,g=t.oxw(4);return t.KtG(g.toggleContactTag(r))}),t._UZ(2,"mat-checkbox",82),t.TgZ(3,"div"),t._uU(4),t.qZA()(),t.BQk()}if(2&o){const n=e.$implicit,a=t.oxw(4);t.xp6(2),t.Q6J("checked",a.contact.tags.includes(n.id))("color","primary")("disableRipple",!0),t.xp6(2),t.Oqu(n.title)}}function Xt(o,e){if(1&o&&(t.ynx(0),t.YNc(1,Wt,5,4,"ng-container",22),t.BQk()),2&o){const n=t.oxw(3);t.xp6(1),t.Q6J("ngForOf",n.filteredTags)("ngForTrackBy",n.trackByFn)}}function te(o,e){if(1&o){const n=t.EpF();t.ynx(0),t.TgZ(1,"div",74)(2,"mat-form-field",84)(3,"input",85),t.NdJ("input",function(i){const g=t.CHM(n).$implicit,k=t.oxw(4);return t.KtG(k.updateTagTitle(g,i))}),t.qZA(),t.TgZ(4,"button",86),t.NdJ("click",function(){const r=t.CHM(n).$implicit,g=t.oxw(4);return t.KtG(g.deleteTag(r))}),t._UZ(5,"mat-icon",87),t.qZA()()(),t.BQk()}if(2&o){const n=e.$implicit;t.xp6(2),t.Q6J("subscriptSizing","dynamic"),t.xp6(1),t.Q6J("value",n.title),t.xp6(2),t.Q6J("svgIcon","heroicons_solid:trash")}}function ee(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",83),t.YNc(2,te,6,3,"ng-container",22),t.qZA(),t.BQk()),2&o){const n=t.oxw(3);t.xp6(2),t.Q6J("ngForOf",n.filteredTags)("ngForTrackBy",n.trackByFn)}}function ne(o,e){if(1&o){const n=t.EpF();t.TgZ(0,"div",88),t.NdJ("click",function(){t.CHM(n),t.oxw();const i=t.MAs(6);return t.oxw(2).createTag(i.value),t.KtG(i.value="")}),t._UZ(1,"mat-icon",89),t.TgZ(2,"div",90),t._uU(3,'Create "'),t.TgZ(4,"b"),t._uU(5),t.qZA(),t._uU(6,'"'),t.qZA()()}if(2&o){t.oxw();const n=t.MAs(6);t.xp6(1),t.Q6J("svgIcon","heroicons_solid:plus-circle"),t.xp6(4),t.Oqu(n.value)}}function oe(o,e){if(1&o){const n=t.EpF();t.TgZ(0,"div",72)(1,"div",73)(2,"div",74),t._UZ(3,"mat-icon",14),t.TgZ(4,"div",15)(5,"input",75,76),t.NdJ("input",function(i){t.CHM(n);const r=t.oxw(2);return t.KtG(r.filterTags(i))})("keydown",function(i){t.CHM(n);const r=t.oxw(2);return t.KtG(r.filterTagsInputKeyDown(i))}),t.qZA()()(),t.TgZ(7,"button",77),t.NdJ("click",function(){t.CHM(n);const i=t.oxw(2);return t.KtG(i.toggleTagsEditMode())}),t.YNc(8,Kt,1,1,"mat-icon",78),t.YNc(9,Vt,1,1,"mat-icon",78),t.qZA()(),t.TgZ(10,"div",79),t.YNc(11,Xt,2,2,"ng-container",1),t.YNc(12,ee,3,2,"ng-container",1),t.YNc(13,ne,7,2,"div",80),t.qZA()()}if(2&o){const n=t.MAs(6),a=t.oxw(2);t.xp6(3),t.Q6J("svgIcon","heroicons_solid:search"),t.xp6(2),t.Q6J("maxLength",30),t.xp6(3),t.Q6J("ngIf",!a.tagsEditMode),t.xp6(1),t.Q6J("ngIf",a.tagsEditMode),t.xp6(2),t.Q6J("ngIf",!a.tagsEditMode),t.xp6(1),t.Q6J("ngIf",a.tagsEditMode),t.xp6(1),t.Q6J("ngIf",a.shouldShowCreateTagButton(n.value))}}function ae(o,e){1&o&&(t.TgZ(0,"mat-label"),t._uU(1,"Email"),t.qZA())}function ie(o,e){1&o&&(t.TgZ(0,"mat-label"),t._uU(1,"Label"),t.qZA())}const W=function(o){return{"mt-6":o}};function ce(o,e){if(1&o){const n=t.EpF();t.ynx(0),t.TgZ(1,"div",95)(2,"button",96),t.NdJ("click",function(){t.CHM(n);const i=t.oxw().index,r=t.oxw(2);return t.KtG(r.removeEmailField(i))}),t._UZ(3,"mat-icon",14),t.qZA()(),t.BQk()}if(2&o){const n=t.oxw().first;t.xp6(1),t.Q6J("ngClass",t.VKq(2,W,n)),t.xp6(2),t.Q6J("svgIcon","heroicons_solid:trash")}}function re(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",28)(2,"mat-form-field",91),t.YNc(3,ae,2,0,"mat-label",1),t._UZ(4,"mat-icon",51)(5,"input",92),t.qZA(),t.TgZ(6,"mat-form-field",93),t.YNc(7,ie,2,0,"mat-label",1),t._UZ(8,"mat-icon",51)(9,"input",94),t.qZA(),t.YNc(10,ce,4,4,"ng-container",1),t.qZA(),t.BQk()),2&o){const n=e.$implicit,a=e.first,i=e.last;t.xp6(2),t.Q6J("subscriptSizing","dynamic"),t.xp6(1),t.Q6J("ngIf",a),t.xp6(1),t.Q6J("svgIcon","heroicons_solid:mail"),t.xp6(1),t.Q6J("formControl",n.get("email"))("placeholder","Email address")("spellcheck",!1),t.xp6(1),t.Q6J("subscriptSizing","dynamic"),t.xp6(1),t.Q6J("ngIf",a),t.xp6(1),t.Q6J("svgIcon","heroicons_solid:tag"),t.xp6(1),t.Q6J("formControl",n.get("label"))("placeholder","Label"),t.xp6(1),t.Q6J("ngIf",!(a&&i))}}function se(o,e){1&o&&(t.TgZ(0,"mat-label"),t._uU(1,"Phone"),t.qZA())}function le(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"mat-option",101)(2,"span",74),t._UZ(3,"span",102),t.TgZ(4,"span",15),t._uU(5),t.qZA(),t.TgZ(6,"span",103),t._uU(7),t.qZA()()(),t.BQk()),2&o){const n=e.$implicit;t.xp6(1),t.Q6J("value",n.iso),t.xp6(2),t.Udp("background","url('/assets/images/apps/contacts/flags.png') no-repeat 0 0")("background-size","24px 3876px")("background-position",n.flagImagePos),t.xp6(2),t.Oqu(n.name),t.xp6(2),t.Oqu(n.code)}}function pe(o,e){1&o&&(t.TgZ(0,"mat-label"),t._uU(1,"Label"),t.qZA())}function _e(o,e){if(1&o){const n=t.EpF();t.ynx(0),t.TgZ(1,"div",95)(2,"button",96),t.NdJ("click",function(){t.CHM(n);const i=t.oxw().index,r=t.oxw(2);return t.KtG(r.removePhoneNumberField(i))}),t._UZ(3,"mat-icon",14),t.qZA()(),t.BQk()}if(2&o){const n=t.oxw().first;t.xp6(1),t.Q6J("ngClass",t.VKq(2,W,n)),t.xp6(2),t.Q6J("svgIcon","heroicons_solid:trash")}}function ue(o,e){if(1&o&&(t.ynx(0),t.TgZ(1,"div",97)(2,"mat-form-field",91),t.YNc(3,se,2,0,"mat-label",1),t._UZ(4,"input",94),t.TgZ(5,"mat-select",98)(6,"mat-select-trigger")(7,"span",74),t._UZ(8,"span",99),t.TgZ(9,"span",100),t._uU(10),t.qZA()()(),t.YNc(11,le,8,9,"ng-container",22),t.qZA()(),t.TgZ(12,"mat-form-field",93),t.YNc(13,pe,2,0,"mat-label",1),t._UZ(14,"mat-icon",51)(15,"input",94),t.qZA(),t.YNc(16,_e,4,4,"ng-container",1),t.qZA(),t.BQk()),2&o){const n=e.$implicit,a=e.first,i=e.last,r=t.oxw(2);t.xp6(2),t.Q6J("subscriptSizing","dynamic"),t.xp6(1),t.Q6J("ngIf",a),t.xp6(1),t.Q6J("formControl",n.get("phoneNumber"))("placeholder","Phone"),t.xp6(1),t.Q6J("formControl",n.get("country")),t.xp6(3),t.Udp("background","url('/assets/images/apps/contacts/flags.png') no-repeat 0 0")("background-size","24px 3876px")("background-position",r.getCountryByIso(n.get("country").value).flagImagePos),t.xp6(2),t.Oqu(r.getCountryByIso(n.get("country").value).code),t.xp6(1),t.Q6J("ngForOf",r.countries)("ngForTrackBy",r.trackByFn),t.xp6(1),t.Q6J("subscriptSizing","dynamic"),t.xp6(1),t.Q6J("ngIf",a),t.xp6(1),t.Q6J("svgIcon","heroicons_solid:tag"),t.xp6(1),t.Q6J("formControl",n.get("label"))("placeholder","Label"),t.xp6(1),t.Q6J("ngIf",!(a&&i))}}function ge(o,e){if(1&o){const n=t.EpF();t.ynx(0),t.TgZ(1,"div",2),t.YNc(2,Et,2,1,"ng-container",1),t.TgZ(3,"div",3)(4,"a",4),t._UZ(5,"mat-icon",5),t.qZA()()(),t.TgZ(6,"div",40)(7,"div",7)(8,"form",41)(9,"div",8)(10,"div",42),t._UZ(11,"div",43),t.TgZ(12,"div",44)(13,"div")(14,"input",45,46),t.NdJ("change",function(){t.CHM(n);const i=t.MAs(15),r=t.oxw();return t.KtG(r.uploadAvatar(i.files))}),t.qZA(),t.TgZ(16,"label",47),t._UZ(17,"mat-icon",5),t.qZA()(),t.TgZ(18,"div")(19,"button",48),t.NdJ("click",function(){t.CHM(n);const i=t.oxw();return t.KtG(i.removeAvatar())}),t._UZ(20,"mat-icon",5),t.qZA()()(),t.YNc(21,Pt,1,1,"img",10),t.YNc(22,$t,2,1,"div",11),t.qZA()(),t.TgZ(23,"div",49)(24,"mat-form-field",50)(25,"mat-label"),t._uU(26,"Name"),t.qZA(),t._UZ(27,"mat-icon",51)(28,"input",52),t.qZA()(),t.TgZ(29,"div",53),t.YNc(30,zt,3,6,"ng-container",1),t.TgZ(31,"div",54,55),t.NdJ("click",function(){t.CHM(n);const i=t.oxw();return t.KtG(i.openTagsPanel())}),t.YNc(33,jt,4,1,"ng-container",1),t.YNc(34,Ht,4,1,"ng-container",1),t.YNc(35,oe,14,7,"ng-template",null,56,t.W1O),t.qZA()(),t.TgZ(37,"div",49)(38,"mat-form-field",50)(39,"mat-label"),t._uU(40,"Title"),t.qZA(),t._UZ(41,"mat-icon",51)(42,"input",57),t.qZA()(),t.TgZ(43,"div",49)(44,"mat-form-field",50)(45,"mat-label"),t._uU(46,"Company"),t.qZA(),t._UZ(47,"mat-icon",51)(48,"input",57),t.qZA()(),t.TgZ(49,"div",49)(50,"div",58),t.YNc(51,re,11,12,"ng-container",22),t.qZA(),t.TgZ(52,"div",59),t.NdJ("click",function(){t.CHM(n);const i=t.oxw();return t.KtG(i.addEmailField())}),t._UZ(53,"mat-icon",14),t.TgZ(54,"span",60),t._uU(55,"Add an email address"),t.qZA()()(),t.TgZ(56,"div",49)(57,"div",58),t.YNc(58,ue,17,20,"ng-container",22),t.qZA(),t.TgZ(59,"div",59),t.NdJ("click",function(){t.CHM(n);const i=t.oxw();return t.KtG(i.addPhoneNumberField())}),t._UZ(60,"mat-icon",14),t.TgZ(61,"span",60),t._uU(62,"Add a phone number"),t.qZA()()(),t.TgZ(63,"div",49)(64,"mat-form-field",50)(65,"mat-label"),t._uU(66,"Address"),t.qZA(),t._UZ(67,"mat-icon",51)(68,"input",57),t.qZA()(),t.TgZ(69,"div",49)(70,"mat-form-field",50)(71,"mat-label"),t._uU(72,"Birthday"),t.qZA(),t._UZ(73,"mat-icon",51)(74,"input",61)(75,"mat-datepicker-toggle",62)(76,"mat-datepicker",null,63),t.qZA()(),t.TgZ(78,"div",49)(79,"mat-form-field",50)(80,"mat-label"),t._uU(81,"Notes"),t.qZA(),t._UZ(82,"mat-icon",51)(83,"textarea",64),t.qZA()(),t.TgZ(84,"div",65)(85,"button",66),t.NdJ("click",function(){t.CHM(n);const i=t.oxw();return t.KtG(i.deleteContact())}),t._uU(86," Delete "),t.qZA(),t.TgZ(87,"button",67),t.NdJ("click",function(){t.CHM(n);const i=t.oxw();return t.KtG(i.toggleEditMode(!1))}),t._uU(88," Cancel "),t.qZA(),t.TgZ(89,"button",68),t.NdJ("click",function(){t.CHM(n);const i=t.oxw();return t.KtG(i.updateContact())}),t._uU(90," Save "),t.qZA()()()()(),t.BQk()}if(2&o){const n=t.MAs(77),a=t.oxw();
1t.xp6(2),t.Q6J("ngIf",a.contact.background),t.xp6(2),t.Q6J("matTooltip","Close")("routerLink",t.DdM(55,V)),t.xp6(1),t.Q6J("svgIcon","heroicons_outline:x"),t.xp6(3),t.Q6J("formGroup",a.contactForm),t.xp6(6),t.Q6J("multiple",!1)("accept","image/jpeg, image/png"),t.xp6(3),t.Q6J("svgIcon","heroicons_outline:camera"),t.xp6(3),t.Q6J("svgIcon","heroicons_outline:trash"),t.xp6(1),t.Q6J("ngIf",a.contact.avatar),t.xp6(1),t.Q6J("ngIf",!a.contact.avatar),t.xp6(2),t.Q6J("subscriptSizing","dynamic"),t.xp6(3),t.Q6J("svgIcon","heroicons_solid:user-circle"),t.xp6(1),t.Q6J("formControlName","name")("placeholder","Name")("spellcheck",!1),t.xp6(2),t.Q6J("ngIf",a.contact.tags.length),t.xp6(3),t.Q6J("ngIf",a.contact.tags.length),t.xp6(1),t.Q6J("ngIf",!a.contact.tags.length),t.xp6(4),t.Q6J("subscriptSizing","dynamic"),t.xp6(3),t.Q6J("svgIcon","heroicons_solid:briefcase"),t.xp6(1),t.Q6J("formControlName","title")("placeholder","Job title"),t.xp6(2),t.Q6J("subscriptSizing","dynamic"),t.xp6(3),t.Q6J("svgIcon","heroicons_solid:office-building"),t.xp6(1),t.Q6J("formControlName","company")("placeholder","Company"),t.xp6(3),t.Q6J("ngForOf",a.contactForm.get("emails").controls)("ngForTrackBy",a.trackByFn),t.xp6(2),t.Q6J("svgIcon","heroicons_solid:plus-circle"),t.xp6(5),t.Q6J("ngForOf",a.contactForm.get("phoneNumbers").controls)("ngForTrackBy",a.trackByFn),t.xp6(2),t.Q6J("svgIcon","heroicons_solid:plus-circle"),t.xp6(4),t.Q6J("subscriptSizing","dynamic"),t.xp6(3),t.Q6J("svgIcon","heroicons_solid:location-marker"),t.xp6(1),t.Q6J("formControlName","address")("placeholder","Address"),t.xp6(2),t.Q6J("subscriptSizing","dynamic"),t.xp6(3),t.Q6J("svgIcon","heroicons_solid:cake"),t.xp6(1),t.Q6J("matDatepicker",n)("formControlName","birthday")("placeholder","Birthday"),t.xp6(1),t.Q6J("for",n),t.xp6(4),t.Q6J("subscriptSizing","dynamic"),t.xp6(3),t.Q6J("svgIcon","heroicons_solid:menu-alt-2"),t.xp6(1),t.Q6J("formControlName","notes")("placeholder","Notes")("rows",5)("spellcheck",!1),t.xp6(2),t.Q6J("color","warn")("matTooltip","Delete"),t.xp6(2),t.Q6J("matTooltip","Cancel"),t.xp6(2),t.Q6J("color","primary")("disabled",a.contactForm.invalid)("matTooltip","Save")}}class Y{constructor(e,n,a,i,r,g,k,de,fe,he){this._activatedRoute=e,this._changeDetectorRef=n,this._contactsListComponent=a,this._contactsService=i,this._formBuilder=r,this._fuseConfirmationService=g,this._renderer2=k,this._router=de,this._overlay=fe,this._viewContainerRef=he,this.editMode=!1,this.tagsEditMode=!1,this._unsubscribeAll=new K.x}ngOnInit(){this._contactsListComponent.matDrawer.open(),this.contactForm=this._formBuilder.group({id:[""],avatar:[null],name:["",[d.kI.required]],emails:this._formBuilder.array([]),phoneNumbers:this._formBuilder.array([]),title:[""],company:[""],birthday:[null],address:[null],notes:[null],tags:[[]]}),this._contactsService.contacts$.pipe((0,y.R)(this._unsubscribeAll)).subscribe(e=>{this.contacts=e,this._changeDetectorRef.markForCheck()}),this._contactsService.contact$.pipe((0,y.R)(this._unsubscribeAll)).subscribe(e=>{this._contactsListComponent.matDrawer.open(),this.contact=e,this.contactForm.get("emails").clear(),this.contactForm.get("phoneNumbers").clear(),this.contactForm.patchValue(e);const n=[];e.emails.length>0?e.emails.forEach(i=>{n.push(this._formBuilder.group({email:[i.email],label:[i.label]}))}):n.push(this._formBuilder.group({email:[""],label:[""]})),n.forEach(i=>{this.contactForm.get("emails").push(i)});const a=[];e.phoneNumbers.length>0?e.phoneNumbers.forEach(i=>{a.push(this._formBuilder.group({country:[i.country],phoneNumber:[i.phoneNumber],label:[i.label]}))}):a.push(this._formBuilder.group({country:["us"],phoneNumber:[""],label:[""]})),a.forEach(i=>{this.contactForm.get("phoneNumbers").push(i)}),this.toggleEditMode(!1),this._changeDetectorRef.markForCheck()}),this._contactsService.countries$.pipe((0,y.R)(this._unsubscribeAll)).subscribe(e=>{this.countries=e,this._changeDetectorRef.markForCheck()}),this._contactsService.tags$.pipe((0,y.R)(this._unsubscribeAll)).subscribe(e=>{this.tags=e,this.filteredTags=e,this._changeDetectorRef.markForCheck()})}ngOnDestroy(){this._unsubscribeAll.next(null),this._unsubscribeAll.complete(),this._tagsPanelOverlayRef&&this._tagsPanelOverlayRef.dispose()}closeDrawer(){return this._contactsListComponent.matDrawer.close()}toggleEditMode(e=null){this.editMode=null===e?!this.editMode:e,this._changeDetectorRef.markForCheck()}updateContact(){const e=this.contactForm.getRawValue();e.emails=e.emails.filter(n=>n.email),e.phoneNumbers=e.phoneNumbers.filter(n=>n.phoneNumber),this._contactsService.updateContact(e.id,e).subscribe(()=>{this.toggleEditMode(!1)})}deleteContact(){this._fuseConfirmationService.open({title:"Delete contact",message:"Are you sure you want to delete this contact? This action cannot be undone!",actions:{confirm:{label:"Delete"}}}).afterClosed().subscribe(n=>
1{if("confirmed"===n){const a=this.contact.id,i=this.contacts.findIndex(k=>k.id===a),r=i+(i===this.contacts.length-1?-1:1),g=1===this.contacts.length&&this.contacts[0].id===a?null:this.contacts[r].id;this._contactsService.deleteContact(a).subscribe(k=>{!k||(this._router.navigate(g?["../",g]:["../"],{relativeTo:this._activatedRoute}),this.toggleEditMode(!1))}),this._changeDetectorRef.markForCheck()}})}uploadAvatar(e){if(!e.length)return;const a=e[0];!["image/jpeg","image/png"].includes(a.type)||this._contactsService.uploadAvatar(this.contact.id,a).subscribe()}removeAvatar(){this.contactForm.get("avatar").setValue(null),this._avatarFileInput.nativeElement.value=null,this.contact.avatar=null}openTagsPanel(){this._tagsPanelOverlayRef=this._overlay.create({backdropClass:"",hasBackdrop:!0,scrollStrategy:this._overlay.scrollStrategies.block(),positionStrategy:this._overlay.position().flexibleConnectedTo(this._tagsPanelOrigin.nativeElement).withFlexibleDimensions(!0).withViewportMargin(64).withLockedPosition(!0).withPositions([{originX:"start",originY:"bottom",overlayX:"start",overlayY:"top"}])}),this._tagsPanelOverlayRef.attachments().subscribe(()=>{this._renderer2.addClass(this._tagsPanelOrigin.nativeElement,"panel-opened"),this._tagsPanelOverlayRef.overlayElement.querySelector("input").focus()});const e=new ht.UE(this._tagsPanel,this._viewContainerRef);this._tagsPanelOverlayRef.attach(e),this._tagsPanelOverlayRef.backdropClick().subscribe(()=>{this._renderer2.removeClass(this._tagsPanelOrigin.nativeElement,"panel-opened"),this._tagsPanelOverlayRef&&this._tagsPanelOverlayRef.hasAttached()&&(this._tagsPanelOverlayRef.detach(),this.filteredTags=this.tags,this.tagsEditMode=!1),e&&e.isAttached&&e.detach()})}toggleTagsEditMode(){this.tagsEditMode=!this.tagsEditMode}filterTags(e){const n=e.target.value.toLowerCase();this.filteredTags=this.tags.filter(a=>a.title.toLowerCase().includes(n))}filterTagsInputKeyDown(e){if("Enter"!==e.key)return;if(0===this.filteredTags.length)return this.createTag(e.target.value),void(e.target.value="");const n=this.filteredTags[0];this.contact.tags.find(i=>i===n.id)?this.removeTagFromContact(n):this.addTagToContact(n)}createTag(e){this._contactsService.createTag({title:e}).subscribe(a=>{this.addTagToContact(a)})}updateTagTitle(e,n){e.title=n.target.value,this._contactsService.updateTag(e.id,e).pipe((0,xt.b)(300)).subscribe(),this._changeDetectorRef.markForCheck()}deleteTag(e){this._contactsService.deleteTag(e.id).subscribe(),this._changeDetectorRef.markForCheck()}addTagToContact(e){this.contact.tags.unshift(e.id),this.contactForm.get("tags").patchValue(this.contact.tags),this._changeDetectorRef.markForCheck()}removeTagFromContact(e){this.contact.tags.splice(this.contact.tags.findIndex(n=>n===e.id),1),this.contactForm.get("tags").patchValue(this.contact.tags),this._changeDetectorRef.markForCheck()}toggleContactTag(e){this.contact.tags.includes(e.id)?this.removeTagFromContact(e):this.addTagToContact(e)}shouldShowCreateTagButton(e){return!(""===e||this.tags.findIndex(n=>n.title.toLowerCase()===e.toLowerCase())>-1)}addEmailField(){const e=this._formBuilder.group({email:[""],label:[""]});this.contactForm.get("emails").push(e),this._changeDetectorRef.markForCheck()}removeEmailField(e){this.contactForm.get("emails").removeAt(e),this._changeDetectorRef.markForCheck()}addPhoneNumberField(){const e=this._formBuilder.group({country:["us"],phoneNumber:[""],label:[""]});this.contactForm.get("phoneNumbers").push(e),this._changeDetectorRef.markForCheck()}removePhoneNumberField(e){this.contactForm.get("phoneNumbers").removeAt(e),this._changeDetectorRef.markForCheck()}getCountryByIso(e){return this.countries.find(n=>n.iso===e)}trackByFn(e,n){return n.id||e}}Y.\u0275fac=function(e){return new(e||Y)(t.Y36(m.gz),t.Y36(t.sBO),t.Y36(M),t.Y36(v),t.Y36(d.QS),t.Y36(vt.R),t.Y36(t.Qsj),t.Y36(m.F0),t.Y36(Ct.aV),t.Y36(t.s_b))},Y.\u0275cmp=t.Xpm({type:Y,selectors:[["contacts-details"]],viewQuery:function(e,n){if(1&e&&(t.Gf(Tt,5),t.Gf(Zt,5),t.Gf(kt,5)),2&e){let a;t.iGM(a=t.CRH())&&(n._avatarFileInput=a.first),t.iGM(a=t.CRH())&&(n._tagsPanel=a.first),t.iGM(a=t.CRH())&&(n._tagsPanelOrigin=a.first)}},decls:3,vars:2,consts:[[1,"flex","flex-col","w-full"],[4,"ngIf"],[1,"relative","w-full","h-40","sm:h-48","px-8","sm:px-12","bg-accent-100","dark:bg-accent-700"],[1,"flex","items-center","justify-end","w-full","max-w-3xl","mx-auto","pt-6"],["mat-icon-button","",3,"matTooltip","routerLink"],[1,"text-white",3,"svgIcon"],[1,"relative","flex","flex-col","flex-auto","items-center","p-6","pt-0","sm:p-12","sm:pt-0"],[1,"w-full","max-w-3xl"],[1,"flex","flex-auto","items-end","-mt-16"],[1,"flex","items-center","justify-center","w-32","h-32","rounded-full","overflow-hidden","ring-4","ring-bg-card"],["class","object-cover w-full h-full",3,"src",4,"ngIf"],["class","flex items-center justify-center w-full h-full rounded overflow-hidden uppercase text-8xl font-bold leading-none bg-gray-200 text-gray-600 dark:bg-gray-700 dark:text-gray-200",4,"ngIf"],[1,"flex","items-center","ml-auto","mb-1"],["mat-stroked-button","",3,"click"],[1,"icon-size-5",3,"svgIcon"],[1,"ml-2"],[1,"mt-3","text-4xl","font-bold","truncate"],[1,"flex","flex-col","mt-4","pt-6","border-t","space-y-8"],[1,"absolute","
1inset-0","object-cover","w-full","h-full",3,"src"],[1,"object-cover","w-full","h-full",3,"src"],[1,"flex","items-center","justify-center","w-full","h-full","rounded","overflow-hidden","uppercase","text-8xl","font-bold","leading-none","bg-gray-200","text-gray-600","dark:bg-gray-700","dark:text-gray-200"],[1,"flex","flex-wrap","items-center","mt-2"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"flex","items-center","justify-center","py-1","px-3","mr-3","mb-3","rounded-full","leading-normal","text-gray-500","bg-gray-100","dark:text-gray-300","dark:bg-gray-700"],[1,"text-sm","font-medium","whitespace-nowrap"],[1,"flex","sm:items-center"],[3,"svgIcon"],[1,"ml-6","leading-6"],[1,"flex"],[1,"min-w-0","ml-6","space-y-1"],[1,"flex","items-center","leading-6"],["target","_blank",1,"hover:underline","text-primary-500",3,"href"],["class","text-md truncate text-secondary",4,"ngIf"],[1,"text-md","truncate","text-secondary"],[1,"mx-2"],[1,"font-medium"],[1,"hidden","sm:flex","w-6","h-4","overflow-hidden",3,"matTooltip"],[1,"sm:ml-3","font-mono"],[1,"ml-2.5","font-mono"],[1,"max-w-none","ml-6","prose","prose-sm",3,"innerHTML"],[1,"relative","flex","flex-col","flex-auto","items-center","px-6","sm:px-12"],[3,"formGroup"],[1,"relative","flex","items-center","justify-center","w-32","h-32","rounded-full","overflow-hidden","ring-4","ring-bg-card"],[1,"absolute","inset-0","bg-black","bg-opacity-50","z-10"],[1,"absolute","inset-0","flex","items-center","justify-center","z-20"],["id","avatar-file-input","type","file",1,"absolute","h-0","w-0","opacity-0","invisible","pointer-events-none",3,"multiple","accept","change"],["avatarFileInput",""],["for","avatar-file-input","matRipple","",1,"flex","items-center","justify-center","w-10","h-10","rounded-full","cursor-pointer","hover:bg-hover"],["mat-icon-button","",3,"click"],[1,"mt-8"],[1,"w-full",3,"subscriptSizing"],["matPrefix","",1,"hidden","sm:flex","icon-size-5",3,"svgIcon"],["matInput","",3,"formControlName","placeholder","spellcheck"],[1,"flex","flex-wrap","items-center","-m-1.5","mt-6"],[1,"flex","items-center","justify-center","px-4","m-1.5","rounded-full","leading-9","cursor-pointer","text-gray-500","bg-gray-100","dark:text-gray-300","dark:bg-gray-700",3,"click"],["tagsPanelOrigin",""],["tagsPanel",""],["matInput","",3,"formControlName","placeholder"],[1,"space-y-4"],[1,"group","inline-flex","items-center","mt-2","-ml-4","py-2","px-4","rounded","cursor-pointer",3,"click"],[1,"ml-2","font-medium","text-secondary","group-hover:underline"],["matInput","",3,"matDatepicker","formControlName","placeholder"],["matSuffix","",3,"for"],["birthdayDatepicker",""],["matInput","","cdkTextareaAutosize","",3,"formControlName","placeholder","rows","spellcheck"],[1,"flex","items-center","mt-10","-mx-6","sm:-mx-12","py-4","pr-4","pl-1","sm:pr-12","sm:pl-7","border-t","bg-gray-50","dark:bg-transparent"],["mat-button","",3,"color","matTooltip","click"],["mat-button","",1,"ml-auto",3,"matTooltip","click"],["mat-flat-button","",1,"ml-2",3,"color","disabled","matTooltip","click"],[1,"flex","items-center","justify-center","px-4","m-1.5","rounded-full","leading-9","text-gray-500","bg-gray-100","dark:text-gray-300","dark:bg-gray-700"],[1,"text-md","font-medium","whitespace-nowrap"],[1,"ml-1.5","text-md","font-medium","whitespace-nowrap"],[1,"w-60","rounded","border","shadow-md","bg-card"],[1,"flex","items-center","m-3","mr-2"],[1,"flex","items-center"],["type","text","placeholder","Enter tag name",1,"w-full","min-w-0","py-1","border-0",3,"maxLength","input","keydown"],["newTagInput",""],["mat-icon-button","",1,"ml-1",3,"click"],["class","icon-size-5",3,"svgIcon",4,"ngIf"],[1,"flex","flex-col","max-h-64","py-2","border-t","overflow-y-auto"],["class","flex items-center h-10 min-h-10 -ml-0.5 pl-4 pr-3 leading-none cursor-pointer hover:bg-hover","matRipple","",3,"click",4,"ngIf"],["matRipple","",1,"flex","items-center","h-10","min-h-10","pl-1","pr-4","cursor-pointer","hover:bg-hover",3,"click"],[1,"flex","items-center","h-10","min-h-10","pointer-events-none",3,"checked","color","disableRipple"],[1,"py-2","space-y-2"],[1,"fuse-mat-dense","w-full","mx-4",3,"subscriptSizing"],["matInput","",3,"value","input"],["mat-icon-button","","matSuffix","",3,"click"],[1,"icon-size-5","ml-2",3,"svgIcon"],["matRipple","",1,"flex","items-center","h-10","min-h-10","-ml-0.5","pl-4","pr-3","leading-none","cursor-pointer","hover:bg-hover",3,"click"],[1,"mr-2","icon-size-5",3,"svgIcon"],[1,"break-all"],[1,"flex-auto",3,"subscriptSizing"],["matInput","",3,"formControl","placeholder","spellcheck"],[1,"flex-auto","w-full","max-w-24","sm:max-w-40","ml-2","sm:ml-4",3,"subscriptSizing"],["matInput","",3,"formControl","placeholder"],[1,"flex","items-center","w-10","pl-2",3,"ngClass"],["mat-icon-button","","matTooltip","Remove",1,"w-8","h-8","min-h-8",3,"click"],[1,"relative","flex"],["matPrefix","",1,"mr-1.5",3,"formControl"],[1,"hidden","sm:flex","w-6","h-4","mr-1","overflow-hidden"],[1,"sm:mx-0.5","font-medium","text-default"],[3,"value"],[1,"w-6","h-4","overflow-hidden"],[1,"ml-2","font-medium"]],template:function(e,n){1&e&&(t.TgZ(0,"div",0),t.YNc(1,qt,28,17,"ng-container",1),t.YNc(2,ge,91,56,"ng-container",1),t.qZA()),2&e&&(t.xp6(1),t.Q6J("ngIf",!n.editMode),t.xp6(1),t.Q6J("ngIf",n.editMode))},dependencies:[m.rH,h.lW,h.o6,h.RK,_.oG,Q.Mq,Q.hl,Q.nW,b.KE,b.hX,b.qo,b.R9,w.Hw,O.Nt,yt.IC,D.wG,l.gD,l.$L,D.ey,q.gM,C.mk,C.sg,C.O5,d._Y,d.Fj,d.JJ,d.JL,d.oH,d.sg,d.u,bt.K,C.uU],encapsulation:2,changeDetection:0});const me=[{path:"",component:R,resolve:{tags:L},children:[{path:"",component:M,resolve:{contacts:N,countries:I},children:[{path:":id",component:Y,resolve:{contact:U,countries:I},canDeactivate:[J]}]}]}];class B{}B.\u0275fac=function(e){return new(e||B)},B.\u0275mod=t.oAB({type:B}),B.\u0275inj=t.cJS({providers:[{provide:D.sG,useValue:{parse:{dateInput:"D"},display:{dateInput:"DDD",monthYearLabel:"LLL yyyy",dateA11yLabel:"DD",monthYearA11yLabel:"LLLL yyyy"}}}],imports:[m.Bz.forChild(me),h.ot,_.p9,Q.FA,G.t,b.lN,w.Ps,O.c,z.En,p.Tx,T.Cv,c.Fk,D.si,l.LD,u.SJ,A.p0,q.AV,j.V,E.m]})},9506:(X,S,s)=>{s.d(S,{En:()=>z,_O:()=>w});var m=s(94650),h=s(3238),_=s(21837);const D=new m.OlP("MAT_LUXON_DATE_ADAPTER_OPTIONS",{providedIn:"root",factory:function Q(){return{useUtc:!1,firstDayOfWeek:0}}});let b=(()=>{class p extends h._A{constructor(c,l){super(),this._useUTC=!!l?.useUtc,this._firstDayOfWeek=l?.firstDayOfWeek||0,this.setLocale(c||_.ou.local().locale)}getYear(c){return c.year}getMonth(c){return c.month-1}getDate(c){return c.day}getDayOfWeek(c){return c.weekday}getMonthNames(c){return _.kI.months(c,{locale:this.locale})}getDateNames(){const c=new Intl.DateTimeFormat(this.locale,{day:"numeric",timeZone:"utc"});return function G(p,T){const c=Array(p);for(let l=0;l<p;l++)c[l]=T(l);return c}(31,l=>c.format(_.ou.utc(2017,1,l+1).toJSDate()))}getDayOfWeekNames(c){const l=_.kI.weekdays(c,{locale:this.locale});return l.unshift(l.pop()),l}getYearName(c){return c.toFormat("yyyy")}getFirstDayOfWeek(){return this._firstDayOfWeek}getNumDaysInMonth(c){return c.daysInMonth}clone(c){return _.ou.fromObject(c.toObject())}createDate(c,l,u){if(l<0||l>11)throw Error(`Invalid month index "${l}". Month index has to be between 0 and 11.`);if(u<1)throw Error(`Invalid date "${u}". Date has to be greater than 0.`);const A=this._useUTC?_.ou.utc(c,l+1,u):_.ou.local(c,l+1,u);
1if(!this.isValid(A))throw Error(`Invalid date "${u}". Reason: "${A.invalidReason}".`);return A.setLocale(this.locale)}today(){return(this._useUTC?_.ou.utc():_.ou.local()).setLocale(this.locale)}parse(c,l){const u=this._getOptions();if("string"==typeof c&&c.length>0){const A=_.ou.fromISO(c,u);if(this.isValid(A))return A;const q=Array.isArray(l)?l:[l];if(!l.length)throw Error("Formats array must not be empty.");for(const j of q){const E=_.ou.fromFormat(c,j,u);if(this.isValid(E))return E}return this.invalid()}return"number"==typeof c?_.ou.fromMillis(c,u):c instanceof Date?_.ou.fromJSDate(c,u):c instanceof _.ou?_.ou.fromMillis(c.toMillis(),u):null}format(c,l){if(!this.isValid(c))throw Error("LuxonDateAdapter: Cannot format invalid date.");return c.setLocale(this.locale).setZone(this._useUTC?"utc":void 0).toFormat(l)}addCalendarYears(c,l){return c.plus({years:l}).setLocale(this.locale)}addCalendarMonths(c,l){return c.plus({months:l}).setLocale(this.locale)}addCalendarDays(c,l){return c.plus({days:l}).setLocale(this.locale)}toIso8601(c){return c.toISO()}deserialize(c){const l=this._getOptions();let u;if(c instanceof Date&&(u=_.ou.fromJSDate(c,l)),"string"==typeof c){if(!c)return null;u=_.ou.fromISO(c,l)}return u&&this.isValid(u)?u:super.deserialize(c)}isDateInstance(c){return c instanceof _.ou}isValid(c){return c.isValid}invalid(){return _.ou.invalid("Invalid Luxon DateTime object.")}_getOptions(){return{zone:this._useUTC?"utc":void 0,locale:this.locale}}}return p.\u0275fac=function(c){return new(c||p)(m.LFG(h.Ad,8),m.LFG(D,8))},p.\u0275prov=m.Yz7({token:p,factory:p.\u0275fac}),p})();const w={parse:{dateInput:"D"},display:{dateInput:"D",monthYearLabel:"LLL yyyy",dateA11yLabel:"DD",monthYearA11yLabel:"LLLL yyyy"}};let O=(()=>{class p{}return p.\u0275fac=function(c){return new(c||p)},p.\u0275mod=m.oAB({type:p}),p.\u0275inj=m.cJS({providers:[{provide:h._A,useClass:b,deps:[h.Ad,D]}]}),p})(),z=(()=>{class p{}return p.\u0275fac=function(c){return new(c||p)},p.\u0275mod=m.oAB({type:p}),p.\u0275inj=m.cJS({providers:[{provide:h.sG,useValue:w}],imports:[O]}),p})()}}]);
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.