import{a as x}from"./chunk-F6KLNSUK.js";import{Ob as g,nb as b}from"./chunk-YSQLW2JA.js";import{Aa as n,Cb as d,Pd as c,Qf as f,bb as p,hd as y,oc as l,ya as h}from"./chunk-SKPDQO4E.js";var u=`<div *ngIf="visibleComponent">
    <img *ngIf="identityThumbnail" [src]="identityThumbnail" class="identityImage" [attr.size]="size">
</div>`;var I=`.justify-content-center{-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center}.justify-content-flex-end{-webkit-box-pack:end;-moz-box-pack:end;-webkit-flex-pack:end;-ms-flex-pack:end;-moz-justify-content:flex-end;-webkit-justify-content:flex-end;justify-content:flex-end}.card-footer{padding:.28rem .7rem}.alert{font-size:.756rem}@media screen and (min-width: 992px){.modal-xxl{max-width:1640px}}@media screen and (min-width: 1200px){.modal-xxxl{max-width:1860px}}.modal-fs{max-width:none;position:absolute;margin:auto;inset:16px;height:100vh;display:flex}.btn-link{text-decoration:none}.btn-link:hover{text-decoration:underline}.invalid-feedback{margin-top:0!important;font-size:.672rem!important}:host{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center}:host .base-identityImage,:host .base-identityImageEmpty,:host .identityImageEmpty[size=original],:host .identityImageEmpty[size=xxl],:host .identityImageEmpty[size=xl],:host .identityImageEmpty[size=lg],:host .identityImageEmpty[size=md],:host .identityImageEmpty[size=xs],:host .identityImage[size=original],:host .identityImage[size=xxl],:host .identityImage[size=xl],:host .identityImage[size=lg],:host .identityImage[size=md],:host .identityImage[size=xs]{-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;box-shadow:0 0 2px #999;margin:0 6px}:host .identityImage[size=xs]{width:24px!important;height:24px!important}:host .identityImage[size=md]{width:36px!important;height:36px!important}:host .identityImage[size=lg]{width:48px!important;height:48px!important}:host .identityImage[size=xl]{width:64px!important;height:64px!important}:host .identityImage[size=xxl]{width:96px!important;height:96px!important}:host .identityImage[size=original]{width:128px!important;height:128px!important}:host .base-identityImageEmpty,:host .identityImageEmpty[size=original],:host .identityImageEmpty[size=xxl],:host .identityImageEmpty[size=xl],:host .identityImageEmpty[size=lg],:host .identityImageEmpty[size=md],:host .identityImageEmpty[size=xs]{position:relative;background:#ebebeb66;color:#fff;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center}:host .base-identityImageEmpty #empty-image-icon,:host .identityImageEmpty[size=original] #empty-image-icon,:host .identityImageEmpty[size=xxl] #empty-image-icon,:host .identityImageEmpty[size=xl] #empty-image-icon,:host .identityImageEmpty[size=lg] #empty-image-icon,:host .identityImageEmpty[size=md] #empty-image-icon,:host .identityImageEmpty[size=xs] #empty-image-icon{position:relative;inset:auto;transform:none}:host .identityImageEmpty[size=xs]{width:24px!important;height:24px!important}:host .identityImageEmpty[size=md]{width:36px!important;height:36px!important}:host .identityImageEmpty[size=lg]{width:48px!important;height:48px!important}:host .identityImageEmpty[size=xl]{width:64px!important;height:64px!important}:host .identityImageEmpty[size=xxl]{width:96px!important;height:96px!important}:host .identityImageEmpty[size=original]{width:128px!important;height:128px!important}
`;var P=function(a,t,e,s){var o=arguments.length,i=o<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(a,t,e,s);else for(var m=a.length-1;m>=0;m--)(r=a[m])&&(i=(o<3?r(i):o>3?r(t,e,i):r(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},z=class{interactionService;identityService;sessionService;authService;sanitizer;identityId=null;isBaseProfile=!1;identityData=null;removeWhenEmpty=!1;showData=!1;size="md";identityThumbnail;visibleComponent=!1;subscriptionLoginState;subscriptionProfilePhotoUpdated;listenChanges=!1;constructor(t,e,s,o,i){this.interactionService=t,this.identityService=e,this.sessionService=s,this.authService=o,this.sanitizer=i}ngOnInit(){this.initializeSubscriptions(),this.checkIdentityPhoto()}ngOnDestroy(){this.subscriptionLoginState.unsubscribe(),this.subscriptionProfilePhotoUpdated&&this.subscriptionProfilePhotoUpdated.unsubscribe()}ngOnChanges(t){this.listenChanges&&(t.identityData&&this.showData&&(this.identityThumbnail=this.sanitizer.bypassSecurityTrustResourceUrl(this.identityData)),t.showData&&(this.showData?this.identityThumbnail=this.sanitizer.bypassSecurityTrustResourceUrl(this.identityData):this.checkIdentityPhoto()))}checkIdentityPhoto(){this.sessionService.isLoggedIn&&(this.showData?(this.identityData&&(this.identityThumbnail=this.sanitizer.bypassSecurityTrustResourceUrl(this.identityData)),this.visibleComponent=!0):this.identityId&&this.identityId!=""?this.authService.checkPermission(y.IDENTITY.getReadBasic())?this.getThumbnailPhoto():this.visibleComponent=!this.removeWhenEmpty:this.isBaseProfile?(this.getProfileThumbnailPhoto(),this.subscriptionProfilePhotoUpdated||(this.subscriptionProfilePhotoUpdated=this.interactionService.onProfilePhotoUpdated.subscribe(()=>{this.checkIdentityPhoto()}))):this.getSelfThumbnailPhoto())}initializeSubscriptions(){this.subscriptionLoginState=this.sessionService.onLoginStatusChanged.subscribe(t=>{this.checkIdentityPhoto()})}afterThumbnailRequest(t){t!=null&&t.hasImage?(this.identityThumbnail=this.sanitizer.bypassSecurityTrustResourceUrl(l(t.thumbnail.data)),this.visibleComponent=!0):(this.identityThumbnail=this.sanitizer.bypassSecurityTrustResourceUrl(x.DATA),this.visibleComponent=!this.removeWhenEmpty),this.listenChanges=!0}getThumbnailPhoto(){this.identityService.getIdentityProfileThumbnail(this.identityId).subscribe(t=>{this.afterThumbnailRequest(t)})}getSelfThumbnailPhoto(){this.identityService.getIdentitySelfProfileThumbnail().subscribe(t=>{this.afterThumbnailRequest(t)})}getProfileThumbnailPhoto(){this.identityService.getProfileSelfProfileThumbnail().subscribe(t=>{this.afterThumbnailRequest(t)})}refreshPhoto(){this.checkIdentityPhoto()}static ctorParameters=()=>[{type:f},{type:b},{type:c},{type:g},{type:d}];static propDecorators={identityId:[{type:n}],isBaseProfile:[{type:n}],identityData:[{type:n}],removeWhenEmpty:[{type:n}],showData:[{type:n}],size:[{type:n}]}};z=P([h({selector:"armon-identity-photo",template:u,standalone:!0,imports:[p],styles:[I]})],z);export{z as a};
