import{a as C}from"./chunk-7QEXVS2A.js";import{b as T}from"./chunk-LAJI7RPC.js";import{Ob as v,Rb as N}from"./chunk-YSQLW2JA.js";import{P as d,Sa as b}from"./chunk-NVJ2ZZFT.js";import{Aa as i,Ba as h,Te as I,_a as g,bb as p,dd as R,ha as l,hd as f,mg as u,ya as m}from"./chunk-SKPDQO4E.js";var P=`<div class="card my-2" [ngClass]="{'summary-view-header': summaryView}" (click)="onSummaryViewHeaderClicked($event)">

  <div class="card-body px-3 py-2">

    <div>
      <div class="text-sm text-bold mb-1">
        {{ ( accessRight.accessControlPointName ? accessRight.accessControlPointName :
        'IDENTITY.ACP_DAFAULT_PERMISSIONS' ) | translate }}
        <cds-icon shape="help" *ngIf="!accessRight.accessControlPointName" nz-popover [nzPopoverTitle]="titleTemplate"
          [nzPopoverContent]="contentTemplate"></cds-icon>
        <ng-template #titleTemplate>{{'IDENTITY.ACP_DAFAULT_PERMISSIONS'|translate}}</ng-template>
        <ng-template #contentTemplate>
          <span
            class="text-sm"><strong>{{'IDENTITY.ACCESS'|translate}}</strong>&nbsp;({{'IDENTITY.ACCESS_INFO'|translate}})</span><br>
          <span
            class="text-sm"><strong>{{'IDENTITY.REMOTE_ACCESS'|translate}}</strong>&nbsp;({{'IDENTITY.REMOTE_ACCESS_INFO'|translate}})</span><br>
          <span
            class="text-sm"><strong>{{'IDENTITY.READ'|translate}}</strong>&nbsp;({{'IDENTITY.READ_INFO'|translate}})</span><br>
          <span
            class="text-sm"><strong>{{'IDENTITY.SNAPSHOT'|translate}}</strong>&nbsp;({{'IDENTITY.SNAPSHOT_INFO'|translate}})</span><br>
          <span
            class="text-sm"><strong>{{'IDENTITY.CONFIG'|translate}}</strong>&nbsp;({{'IDENTITY.CONFIG_INFO'|translate}})</span><br>
          <span
            class="text-sm"><strong>{{'IDENTITY.GRANT'|translate}}</strong>&nbsp;({{'IDENTITY.GRANT_INFO'|translate}})</span><br>
        </ng-template>
      </div>
      <div *ngIf="summaryView" class="permission-list">
        <span class="comma" *ngIf="accessRight.access">{{'IDENTITY.ACCESS'|translate}}</span>
        <span class="comma" *ngIf="accessRight.remoteAccess">{{'IDENTITY.REMOTE_ACCESS'|translate}}</span>
        <span class="comma" *ngIf="accessRight.read">{{'IDENTITY.READ'|translate}}</span>
        <span class="comma" *ngIf="accessRight.snapshot">{{'IDENTITY.SNAPSHOT'|translate}}</span>
        <span class="comma" *ngIf="accessRight.config">{{'IDENTITY.CONFIG'|translate}}</span>
        <span class="comma" *ngIf="accessRight.grant">{{'IDENTITY.GRANT'|translate}}</span>
      </div>
      <armon-card-badge [added]="isNewAdded" [updated]="isUpdated"></armon-card-badge>
    </div>
    <div class="row" *ngIf="visibleNoPermission">
      <div class="col-xl-12">
        <span class="text-sm text-bold text-danger mb-2">{{"IDENTITY.INFO_NO_PERMISSION"|translate}}</span>
      </div>
    </div>
    <div class="row pos-relative" *ngIf="!summaryView">
      <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12" *ngIf="!isBuiltinVirtualPoint">
        <div class="form-check" [title]="'IDENTITY.ACCESS_INFO'|translate">
          <input type="checkbox" class="form-check-input" [id]="'acpaccess'+accessRight.accessControlPointId"
            [(ngModel)]="accessRight.access" (change)="onPermissionChanged('access')" />
          <label [for]="'acpaccess'+accessRight.accessControlPointId" class="form-check-label">{{'IDENTITY.ACCESS' |
            translate}}</label>
        </div>
      </div>
      <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12"
        *ngIf="permissionGrantRemoteAccess && accessRight.accessControlPointRemoteAvailable && !isBuiltinVirtualPoint">
        <div class="form-check" [title]="'IDENTITY.REMOTE_ACCESS_INFO'|translate">
          <input type="checkbox" class="form-check-input" [id]="'acpremote'+ accessRight.accessControlPointId"
            [(ngModel)]="accessRight.remoteAccess" (change)="onPermissionChanged('remoteAccess')" />
          <label [for]="'acpremote'+ accessRight.accessControlPointId"
            class="form-check-label">{{'IDENTITY.REMOTE_ACCESS' | translate}}</label>
        </div>
      </div>
      <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12">
        <div class="form-check" [title]="'IDENTITY.READ_INFO'|translate"
          [ngClass]="{'disabled-checkbox': accessRight.config || accessRight.grant || accessRight.snapshot || accessRight.remoteAccess}">
          <input type="checkbox" class="form-check-input" [id]="'acpread'+accessRight.accessControlPointId"
            [disabled]="accessRight.config || accessRight.grant || accessRight.snapshot || accessRight.remoteAccess"
            [(ngModel)]="accessRight.read" (change)="onPermissionChanged('read')" />
          <label [for]="'acpread'+accessRight.accessControlPointId" class="form-check-label">{{'IDENTITY.READ' |
            translate}}</label>
        </div>
      </div>
      <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12" *ngIf="!isBuiltinVirtualPoint">
        <div class="form-check" [title]="'IDENTITY.SNAPSHOT_INFO'|translate">
          <input type="checkbox" class="form-check-input" [id]="'acpsnapshot'+accessRight.accessControlPointId"
            [(ngModel)]="accessRight.snapshot" (change)="onPermissionChanged('snapshot')" />
          <label [for]="'acpsnapshot'+accessRight.accessControlPointId"
            class="form-check-label">{{'IDENTITY.SNAPSHOT' | translate}}</label>
        </div>
      </div>
      <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12">
        <div class="form-check" [title]="'IDENTITY.CONFIG_INFO'|translate">
          <input type="checkbox" class="form-check-input" [id]="'acpconfig'+accessRight.accessControlPointId"
            [(ngModel)]="accessRight.config" (change)="onPermissionChanged('config')" />
          <label [for]="'acpconfig'+accessRight.accessControlPointId" class="form-check-label">{{'IDENTITY.CONFIG' |
            translate}}</label>
        </div>
      </div>
      <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12">
        <div class="form-check" [title]="'IDENTITY.GRANT_INFO'|translate">
          <input type="checkbox" class="form-check-input" [id]="'acpgrant'+accessRight.accessControlPointId"
            [(ngModel)]="accessRight.grant" (change)="onPermissionChanged('grant')" />
          <label [for]="'acpgrant'+accessRight.accessControlPointId" class="form-check-label">{{'IDENTITY.GRANT' |
            translate}}</label>
        </div>
      </div>
      <div class="disabled-overlay d-flex align-items-center justify-content-center" *ngIf="visibleDisabledOverlay">
        <div *ngIf="visibleUserNoGRant" class="text-xs">
          <cds-icon shape="warning-standard" class="me-1 cds-icon-18"></cds-icon>
          {{'IDENTITY.INFO_NO_GRANT'|translate}}
        </div>
      </div>
    </div>
  </div>
  <div class="card-footer px-2 py-1" *ngIf="visibleFooter && accessRight.userRights && accessRight.userRights.grant">
    <!-- Remove button -->
    <button class="btn btn-sm btn-link" (click)="onRemoveClicked($event)"
      [disabled]="!accessRight.managable">{{'BUTTON.REMOVE' | translate}}</button>
  </div>
</div>`;var E=`.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}.summary-view-header{cursor:pointer}.summary-view-header:hover{background-color:#ceedfe}.permission-title{font-size:.588rem}.permission-list{font-size:.546rem}.disabled-checkbox{cursor:not-allowed!important;opacity:.4!important}.disabled-overlay{position:absolute;margin:auto;inset:0 5px;cursor:default;z-index:1;background-color:#fffc;font-size:.504rem;color:#c82602}.disabled-overlay div{-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem;background-color:#fcf4f2;padding:3px 6px}
`;var A=function(c,s,t,a){var n=arguments.length,e=n<3?s:a===null?a=Object.getOwnPropertyDescriptor(s,t):a,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(c,s,t,a);else for(var r=c.length-1;r>=0;r--)(o=c[r])&&(e=(n<3?o(e):n>3?o(s,t,e):o(s,t))||e);return n>3&&e&&Object.defineProperty(s,t,e),e},y=class{authService;accessControlPointService;accessRight;isNewAdded;isUpdated;visibleFooter=!0;editMode=!0;initSummaryView=!1;summaryView=!1;visibleNoPermission=!1;visibleUserNoGRant=!1;visibleDisabledOverlay=!0;isBuiltinVirtualPoint;accessRightRemoved=new l;accessRightUpdated=new l;permissionGrantRemoteAccess;constructor(s,t){this.authService=s,this.accessControlPointService=t}ngOnInit(){this.checkPermissions(),this.isBuiltinVirtualPoint=this.accessRight.accessControlPointId==d,(this.accessRight.read==null||typeof this.accessRight.read>"u")&&(this.accessRight.read=!1),(this.accessRight.access==null||typeof this.accessRight.access>"u")&&(this.accessRight.access=!1),(this.accessRight.remoteAccess==null||typeof this.accessRight.remoteAccess>"u")&&(this.accessRight.remoteAccess=!1),(this.accessRight.config==null||typeof this.accessRight.config>"u")&&(this.accessRight.config=!1),(this.accessRight.grant==null||typeof this.accessRight.grant>"u")&&(this.accessRight.grant=!1),(this.accessRight.snapshot==null||typeof this.accessRight.snapshot>"u")&&(this.accessRight.snapshot=!1),this.initSummaryView&&!this.accessRight.userRights?this.summaryView=!0:this.render()}render(){this.editMode?this.accessRight.userRights?this.visibleUserNoGRant=!this.accessRight.userRights.grant:this.accessControlPointService.getAccessControlPointBasic(this.accessRight.accessControlPointId).subscribe(s=>{this.accessRight.userRights=s.userRights,this.visibleUserNoGRant=!this.accessRight.userRights.grant,this.checkNoPermission()},s=>{this.visibleUserNoGRant=!0,this.checkNoPermission()}):(this.accessRight=b.getEmptyModel(),this.checkNoPermission())}ngAfterViewInit(){this.checkNoPermission()}onRemoveClicked(s){this.accessRightRemoved.emit(this.accessRight.accessControlPointId)}onPermissionChanged(s){this.accessRightUpdated.emit({accessRight:this.accessRight,field:s,accessControlPointId:this.accessRight.accessControlPointId}),s!="read"&&(this.accessRight.grant||this.accessRight.config||this.accessRight.remoteAccess||this.accessRight.access||this.accessRight.snapshot)&&this.accessRight.read==!1&&(this.accessRight.read=!0,setTimeout(()=>{this.accessRightUpdated.emit({accessRight:this.accessRight,field:"read",accessControlPointId:this.accessRight.accessControlPointId})},500)),this.checkNoPermission()}checkNoPermission(){this.visibleNoPermission=!this.accessRight.isValid,this.isBuiltinVirtualPoint=this.accessRight.accessControlPointId==d,this.editMode?this.accessRight.userRights&&this.accessRight.userRights.grant?this.visibleDisabledOverlay=!1:this.visibleDisabledOverlay=!0:this.visibleDisabledOverlay=!1}checkPermissions(){this.permissionGrantRemoteAccess=this.authService.checkPermission(f.IDENTITY.getGrantRemoteAccess())}getAccessRight(){return this.accessRight}hasValid(){return this.accessRight.isValid}setRemoteAvailable(s){this.accessRight.accessControlPointRemoteAvailable=s,this.checkNoPermission()}onSummaryViewHeaderClicked(s){this.summaryView&&(this.summaryView=!1,this.render())}static ctorParameters=()=>[{type:v},{type:N}];static propDecorators={accessRight:[{type:i}],isNewAdded:[{type:i}],isUpdated:[{type:i}],visibleFooter:[{type:i}],editMode:[{type:i}],initSummaryView:[{type:i}],accessRightRemoved:[{type:h}],accessRightUpdated:[{type:h}]}};y=A([m({selector:"armon-identity-access-right",template:P,standalone:!0,imports:[g,p,T,C,I,u,R],styles:[E]})],y);export{y as a};
