import{b as J,d as it}from"./chunk-5HOZEP3O.js";import{d as et}from"./chunk-O2WVXTHR.js";import{a as q,b as K}from"./chunk-5DQKN4SL.js";import{a as Z}from"./chunk-D4RZOGGF.js";import{a as X}from"./chunk-H6QPU4XN.js";import{a as Q}from"./chunk-IMWNGRKR.js";import{a as tt}from"./chunk-4IRXRL4C.js";import{a as $}from"./chunk-WFZJP5WR.js";import{J as F,Mb as Y,Ob as v,Qb as B,Rb as W,o as L,sb as V,wb as H}from"./chunk-YSQLW2JA.js";import{D as k,F as U,H as C,I as j}from"./chunk-NVJ2ZZFT.js";import{Aa as d,Ba as I,Dc as p,Ka as z,Nb as P,Pd as g,Qd as O,Te as E,Xb as s,Yb as r,Yg as M,_a as T,ab as f,af as N,bb as b,cb as R,dc as y,dd as u,eh as G,ha as S,hd as m,jb as D,mg as _,wc as w,ya as h,zc as A}from"./chunk-SKPDQO4E.js";var ot=`<div class="h-100 activityTimelineContainer">
  <div class="row accessControlPointsContainer" *ngIf="widgetData && widgetData.accessControlPointIds.length > 0">
    <div class="col-12 d-flex py-2 px-0">
      <div class="accessControlPointNames text-truncate w-75">{{widgetData.accessControlPointNames}}</div>
      <div class="ms-auto">
        <cds-icon shape="report" style="width: 18px; height: 18px;" (click)="onAccessLogClicked()" nz-tooltip *ngIf="editFlag"
          class="cursor-pointer me-2" nzTooltipTitle="{{'BUTTON.SHOW_ALL' | translate}}">
        </cds-icon>
        <cds-icon shape="cog" style="width: 18px; height: 18px;" (click)="onSelectAccessControlPointClicked()" nz-tooltip *ngIf="editFlag"
          class="cursor-pointer" nzTooltipTitle="{{'COMMON.SETTINGS' | translate}}"></cds-icon>
      </div>
    </div>
  </div>
  <div class="activity-timeline-container" [@listAnimation]="activities.length"
    *ngIf="widgetData && widgetData.accessControlPointIds.length > 0">
    <div class="activity-timeline-item" *ngFor="let activity of activities" [attr.result]="activity.attemptResultKey"
      (click)="onShowDetailClicked($event, activity)">
      <!-- title="{{activity.descriptionKey | translate:activity.descriptionValue}}" -->
      <div class="icon-container" [ngSwitch]="activity.attemptResultKey">
      </div>
      <div class="time-container" [attr.direction]="activity.descriptionValue.d">
        <span class="hour-minute">{{activity.u | date:'HH:mm'}}</span>
        <div class="direction-animation" *ngIf="activity.descriptionValue.d"
          [attr.direction]="activity.descriptionValue.d">
          <cds-icon shape="angle" size="sm" class="direction-icon icon-1"></cds-icon>
          <cds-icon shape="angle" size="sm" class="direction-icon icon-2"></cds-icon>
          <cds-icon shape="angle" size="sm" class="direction-icon icon-3"></cds-icon>
        </div>
        <div class="time-icon-container">
          <ng-container *ngIf="activity.a && activity.a.credentials && activity.a.credentials.length>0">
            <cds-icon size="sm" [attr.shape]="credential.credentialType.icon"
              *ngFor="let credential of activity.a.credentials"></cds-icon>
          </ng-container>
          <cds-icon shape="camera" size="sm"
            *ngIf="activity.descriptionValue.sid && activity.descriptionValue.sid.length>0"></cds-icon>
        </div>
      </div>
      <div class="detail-container">
        <armon-captionlines [@enterLeaveFade] class="captionlines" [captionlines]="activity.descriptionValue.cl"
          [showBorder]="false"
          *ngIf="activity.a && activity.descriptionValue.cl && activity.descriptionValue.cl.length>0" class="me-3"
          [isVisitor]="activity.a.v"
          [ngClass]="{'mb-2': (activity.showDetail || widgetData.alwaysShowDescriptionText)}">
        </armon-captionlines>
        <div class="position-absolute m-2" style="top: 0; right: 3px;"
          *ngIf="permissionReportDetailed && activity.showDetail && activity.a && activity.a.u" nz-tooltip
          nzTooltipTitle="{{'IDENTITY.TITLE_LAST_ACCESS_LOGS'|translate}}">
          <cds-icon shape="search" style="width: 20px; height: 20px;" click-stop-propagation (click)="onIdentityClicked($event, activity.a.u)">
          </cds-icon>
        </div>
        <armon-local-date [dateUtc]="activity.u" showLabel="true"></armon-local-date>
        <span class="description-text" [@enterLeaveFade]
          *ngIf="widgetData.alwaysShowDescriptionText || activity.showDetail || activity.attemptResultKey==3 || (!activity.descriptionValue.cl || activity.descriptionValue.cl.length==0)">{{activity.descriptionKey
          | translate:activity.descriptionValue}}
          <span>({{activity.u | date:'medium'}})</span>
        </span>
        <armon-credential-tags [@enterLeaveFade]
          *ngIf="activity.showDetail && activity.a && activity.a.credentials && activity.a.credentials.length>0"
          [credentials]="activity.a.credentials"></armon-credential-tags>
        <div [@enterLeaveFade]
          *ngIf="activity.showDetail && activity.detail && activity.detail.snapshots && activity.detail.snapshots.length>0">
          <armon-camera-snapshot-gallery [snapshots]="activity.detail.snapshots">
          </armon-camera-snapshot-gallery>
        </div>

        <div *ngIf="activity.remoteAccessControlPoint" class="mt-2 w-100">
          <armon-remote-control-item-buttons [remoteAccessPoint]="activity.remoteAccessControlPoint">
          </armon-remote-control-item-buttons>
        </div>
      </div>
    </div>
  </div>


  <!-- Empty text -->
  <p class="p2 activityTimelineEmptyText h-100 centered"
    *ngIf="widgetData.accessControlPointIds.length > 0 && activities.length === 0">
    <cds-icon shape="info-standard"></cds-icon>
    {{'ACTIVITYTIMELINE.EMPTY' | translate}}
  </p>


  <div class="h-100 centered selectionContainer" *ngIf="!widgetData || widgetData.accessControlPointIds.length === 0">
    <p class="p2 activityTimelineEmptyText centered">
      <cds-icon shape="info-standard"></cds-icon>
      {{'ACTIVITYTIMELINE.SELECT_ACCESS_CONTROL_POINT' |\xA0translate}}
    </p>
    <div class="centered">
      <button class="btn btn-sm btn-outline-primary" (click)="onSelectAccessControlPointClicked()">{{'ACTIVITYTIMELINE.SELECT_ACCESS_CONTROL_POINT_LABEL' |\xA0translate}}</button>
    </div>
  </div>

</div>`;var nt=`.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}.selectionContainer{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.accessControlPointsContainer{border-bottom:1px solid #eee;align-items:center;margin:0}.accessControlPointsContainer .accessControlPointNames{color:#0a2a5a;font-size:12px;text-align:left;margin-top:0}.accessControlPointsContainer .btn{padding-right:0;margin:0 0 0 auto}.accessControlPointsContainer .settings-icon{cursor:pointer;color:#0a2a5a}:host .activityTimelineContainer{padding:6px 12px}:host .activityTimelineEmptyText{color:#0a2a5a;margin-bottom:24px;text-align:center}:host .activityTimelineEmptyText>cds-icon{margin-right:4px}:host .activity-timeline-item{margin:6px 0;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-moz-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:stretch;-ms-flex-align:stretch;-webkit-align-items:stretch;-moz-align-items:stretch;align-items:stretch;border:1px solid #eee;-webkit-border-radius:.56rem;-moz-border-radius:.56rem;border-radius:.56rem;cursor:pointer}:host .activity-timeline-item .icon-container{color:#fff;padding:3px;-webkit-border-top-left-radius:.56rem;-moz-border-radius-topleft:.56rem;border-top-left-radius:.56rem;-webkit-border-v-left-radius:.56rem;-moz-border-radius-bottomleft:.56rem;border-bottom-left-radius:.56rem;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items: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}:host .activity-timeline-item .time-container,:host .activity-timeline-item .time-container[direction="2"],:host .activity-timeline-item .time-container[direction="1"]{padding:6px;margin:0;width:3.5rem;min-height:1.4rem;background-color:#6666661a;color:#666;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items: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}:host .activity-timeline-item .time-container .hour-minute{font-size:.756rem}:host .activity-timeline-item .time-container .time-icon-container{padding-top:6px;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-flex-wrap:wrap;-moz-flex-wrap:wrap;flex-wrap:wrap;margin-top:auto}:host .activity-timeline-item .time-container .time-icon-container cds-icon{margin:0 2px}:host .activity-timeline-item .time-container .direction-animation[direction="1"] .direction-icon{margin:-3px;transform:rotate(90deg);-webkit-animation:bouncedelay 3s infinite ease-in-out both;animation:bouncedelay 3s infinite ease-in-out both}:host .activity-timeline-item .time-container .direction-animation[direction="1"] .icon-1{-webkit-animation-delay:-.6s;animation-delay:-.6s}:host .activity-timeline-item .time-container .direction-animation[direction="1"] .icon-2{-webkit-animation-delay:-.3s;animation-delay:-.3s}:host .activity-timeline-item .time-container .direction-animation[direction="2"]{line-height:.7rem}:host .activity-timeline-item .time-container .direction-animation[direction="2"] .direction-icon{margin:-3px;transform:rotate(270deg);-webkit-animation:bouncedelay 3s infinite ease-in-out both;animation:bouncedelay 3s infinite ease-in-out both}:host .activity-timeline-item .time-container .direction-animation[direction="2"] .icon-2{-webkit-animation-delay:-.3s;animation-delay:-.3s}:host .activity-timeline-item .time-container .direction-animation[direction="2"] .icon-3{-webkit-animation-delay:-.6s;animation-delay:-.6s}@-webkit-keyframes bouncedelay{0%,80%,to{opacity:0}40%{opacity:1}}@keyframes bouncedelay{0%,80%,to{opacity:0}40%{opacity:1}}:host .activity-timeline-item .time-container[direction="1"]{background-color:#0369a11a;color:#0369a1}:host .activity-timeline-item .time-container[direction="2"]{background-color:#eb8d001a;color:#eb8d00}:host .activity-timeline-item .identity-photo{-webkit-box-align:start;-ms-flex-align:start;-webkit-align-items:flex-start;-moz-align-items:flex-start;align-items:flex-start;padding-top:12px;-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}:host .activity-timeline-item .detail-container{flex:1;padding:6px 12px;position:relative;-webkit-border-top-right-radius:.56rem;-moz-border-radius-topv:.56rem;border-top-right-radius:.56rem;-webkit-border-v-right-radius:.56rem;-moz-border-radius-bottomright:.56rem;border-bottom-right-radius:.56rem;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:start;-ms-flex-align:start;-webkit-align-items:flex-start;-moz-align-items:flex-start;align-items:flex-start;-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}:host .activity-timeline-item .detail-container .name-surname{font-weight:200!important;font-size:.756rem}:host .activity-timeline-item .detail-container .description-text{color:#b3b3b3;font-size:.588rem}:host .activity-timeline-item[result="1"] .icon-container{background-color:#62a32599}:host .activity-timeline-item[result="2"] .icon-container{background-color:#eb8d0099}:host .activity-timeline-item[result="3"] .icon-container{background-color:#c8260299}:host .captionlines{margin-left:-.2rem}:host .snapshot-detail-container{margin-top:6px;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex}:host .snapshot-detail-container .snapshot-detail-item{margin-right:6px}:host .snapshot-detail-container .snapshot-detail-item img{height:120px;width:auto}:host .snapshot-detail-container .snapshot-detail-item .base-no-image,:host .snapshot-detail-container .snapshot-detail-item .no-image[status="2"],:host .snapshot-detail-container .snapshot-detail-item .no-image[status="0"]{height:120px;width:160px;background-color:#000;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-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;padding:12px}:host .snapshot-detail-container .snapshot-detail-item .base-no-image span,:host .snapshot-detail-container .snapshot-detail-item .no-image[status="2"] span,:host .snapshot-detail-container .snapshot-detail-item .no-image[status="0"] span{margin-top:6px;text-align:center;font-size:.588rem}:host .snapshot-detail-container .snapshot-detail-item .no-image[status="0"]{color:#42bafb}:host .snapshot-detail-container .snapshot-detail-item .no-image[status="2"]{color:#fd8166}
`;var at=`<div class="row">
    <div class="col-12 d-flex flex-column">
        <span class="text-lg mb-2">{{'ACTIVITYTIMELINE.TITLE'|translate}}</span>
        <span class="text-sm">{{'REGION.TITLE_ACCESS_CONTROL_POINTS' | translate}}</span>
        <div class="w-100 mt-3">
            <label class="report-form-label">{{'REPORT.ACCESS_CONTROL_POINTS' | translate}}</label>
            <armon-select-search query="point" [allowMulti]="true" [(ngModel)]="tempFilter.accessControlPointIds"
                (onSelectedChanged)="onPointsSelected($event)">
            </armon-select-search>
        </div>
        <div class="w-100 mt-3">
            <label class="report-form-label">{{'REPORT.ACCESS_REASONS' | translate}}</label>
            <armon-select-search query="reason" [allowMulti]="true" [(ngModel)]="tempFilter.recordReasons">
            </armon-select-search>
        </div>
        <div class="w-100 mt-3" *ngIf="permissionSearchIdentity && permissionReportDetailed">
            <label class="report-form-label">{{'REPORT.IDENTITIES' | translate : languageService.userTranslate}}</label>
            <armon-select-search query="identity" [allowMulti]="true" [(ngModel)]="tempFilter.userIds">
            </armon-select-search>
        </div>
        <div class="w-100 mt-3" *ngIf="permissionSearchOrganizationUnit && permissionReportDetailed">
            <label class="report-form-label">{{'REPORT.ORGANIZATION_UNITS' | translate}}</label>
            <armon-select-search query="unit" [allowMulti]="true" [(ngModel)]="tempFilter.organizationUnitIds">
            </armon-select-search>
            <label class="report-checkbox-label" nz-checkbox
                *ngIf="tempFilter.organizationUnitIds && tempFilter.organizationUnitIds.length > 0"
                [(ngModel)]="tempFilter.filterOrganizationUnitMembersHierarchically">{{'REPORT.SHOW_HIERARCHICALLY' |
                translate}}</label>
        </div>
        <div class="w-100 mt-3" *ngIf="permissionSearchUserGroup && permissionReportDetailed">
            <label class="report-form-label">{{'REPORT.USER_GROUPS' | translate :
                languageService.userTranslate}}</label>
            <armon-select-search query="group" [allowMulti]="true" [(ngModel)]="tempFilter.userGroupIds">
            </armon-select-search>
        </div>
        <div class="w-100 mt-3">
            <label class="report-form-label">{{'REPORT.STATUS' | translate}}</label>
            <nz-select class="w-100" [(ngModel)]="tempFilter.status" nzSize="small">
                <nz-option *ngFor="let option of accessResultTypes" [nzValue]="option.type" [nzLabel]="option.description |
                  translate"></nz-option>
            </nz-select>
        </div>
        <div class="w-100 mt-3">
            <label class="report-form-label">{{'REPORT.DIRECTION' | translate}}</label>
            <nz-select class="w-100" [(ngModel)]="tempFilter.direction" nzSize="small">
                <nz-option *ngFor="let option of directionTypes" [nzValue]="option.type" [nzLabel]="option.description |
                  translate"></nz-option>
            </nz-select>
        </div>
        <div class="form-check form-switch mt-3">
            <input id="alwaysShowDescriptionTextInput" type="checkbox"
                [(ngModel)]="tempFilter.alwaysShowDescriptionText" name="alwaysShowDescriptionTextInput"
                class="form-check-input">
            <label class="form-check-label cursor-pointer"
                for="alwaysShowDescriptionTextInput">{{'ACTIVITYTIMELINE.SHOW_DESCRIPTION_TEXT' | translate}}</label>
        </div>
    </div>
    <div class="col-12 d-flex justify-content-end mt-3">
        <button class="btn btn-sm btn-outline-primary me-2"
            (click)="onCancelClicked($event)">{{'BUTTON.CANCEL'|translate}}</button>
        <button class="btn btn-sm btn-primary" (click)="onSaveClicked($event)"
            [disabled]="!tempFilter.accessControlPointIds || tempFilter.accessControlPointIds.length==0">{{'BUTTON.SAVE'|translate}}</button>
    </div>
</div>`;var st="";var ft=function(c,t,i,o){var n=arguments.length,e=n<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,i):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(c,t,i,o);else for(var l=c.length-1;l>=0;l--)(a=c[l])&&(e=(n<3?a(e):n>3?a(t,i,e):a(t,i))||e);return n>3&&e&&Object.defineProperty(t,i,e),e},x=class{authService;sessionService;languageService;drawerRef;filter;tempFilter;directionTypes=j;accessResultTypes=U;permissionSearchUserGroup;permissionSearchIdentity;permissionSearchOrganizationUnit;permissionReportDetailed;constructor(t,i,o,n){this.authService=t,this.sessionService=i,this.languageService=o,this.drawerRef=n}ngOnInit(){this.permissionSearchUserGroup=this.authService.checkPermission(m.USERGROUP.getRead()),this.permissionSearchIdentity=this.authService.checkPermission(m.IDENTITY.getReadBasic()),this.permissionSearchOrganizationUnit=this.authService.checkPermission(m.ORGANIZATIONUNIT.getReadBasic()),this.permissionReportDetailed=this.authService.checkPermission(m.ACCESSLOG.getReportDetailed())&&(this.permissionSearchIdentity||this.permissionSearchOrganizationUnit||this.permissionSearchUserGroup),this.tempFilter=y(this.filter)}onPointsSelected(t){this.tempFilter.accessControlPointNames=t.map(i=>i.optionLabel)}onSaveClicked(t){this.tempFilter.accessControlPointIds.length>0&&this.drawerRef.close(this.tempFilter)}onCancelClicked(t){this.drawerRef.close()}static ctorParameters=()=>[{type:v},{type:g},{type:N},{type:q}];static propDecorators={filter:[{type:d}]}};x=ft([h({selector:"activity-timeline-filter",template:at,standalone:!0,imports:[H,E,_,b,L,G,f,u],styles:[st]})],x);var bt=function(c,t,i,o){var n=arguments.length,e=n<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,i):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(c,t,i,o);else for(var l=c.length-1;l>=0;l--)(a=c[l])&&(e=(n<3?a(e):n>3?a(t,i,e):a(t,i))||e);return n>3&&e&&Object.defineProperty(t,i,e),e},rt=class{detector;reportService;socketService;authService;routingService;systemService;sessionService;accessControlPointService;drawerService;widgetData;widgetId;dataUpdated=new S;editFlag=!0;activities=[];permissionReportDetailed;subscriptionActivity;subscriptionOrganizationChanged;subscriptionConnectionState;constructor(t,i,o,n,e,a,l,ct,lt){this.detector=t,this.reportService=i,this.socketService=o,this.authService=n,this.routingService=e,this.systemService=a,this.sessionService=l,this.accessControlPointService=ct,this.drawerService=lt}ngOnInit(){this.permissionReportDetailed=this.authService.checkPermission(m.ACCESSLOG.getReportDetailed()),this.widgetData?this.widgetData.version&&this.widgetData.version=="v1"?this.checkFilter(this.widgetData):P(this.widgetData)?this.widgetData.accessControlPoints?this.widgetData=this.initFilter(this.widgetData.accessControlPoints.map(t=>t.id),this.widgetData.accessControlPoints.map(t=>t.name)):this.widgetData=this.initFilter(this.widgetData.map(t=>t.id),this.widgetData.map(t=>t.name)):this.widgetData=this.initFilter():this.widgetData=this.initFilter(),this.initializeSubscriptions(),this.joinActivityRoom()}ngOnDestroy(){this.subscriptionActivity&&this.subscriptionActivity.unsubscribe(),this.subscriptionOrganizationChanged&&this.subscriptionOrganizationChanged.unsubscribe(),this.subscriptionConnectionState&&this.subscriptionConnectionState.unsubscribe()}ngAfterViewInit(){}checkFilter(t,i=[],o=[]){(s(t.organizationUnitIds)||r(t.organizationUnitIds))&&(t.organizationUnitIds=[]),(s(t.filterOrganizationUnitMembersHierarchically)||r(t.filterOrganizationUnitMembersHierarchically))&&(t.filterOrganizationUnitMembersHierarchically=!1),(s(t.userGroupIds)||r(t.userGroupIds))&&(t.userGroupIds=[]),(s(t.accessControlPointIds)||r(t.accessControlPointIds))&&(t.accessControlPointIds=i),(s(t.accessControlPointNames)||r(t.accessControlPointNames))&&(t.accessControlPointNames=o),(s(t.recordReasons)||r(t.recordReasons))&&(t.recordReasons=[]),(s(t.direction)||r(t.direction))&&(t.direction=C.All),(s(t.status)||r(t.status))&&(t.status=k.All),(s(t.alwaysShowDescriptionText)||r(t.alwaysShowDescriptionText))&&(t.alwaysShowDescriptionText=!1)}initFilter(t=[],i=[]){return{widgetId:this.widgetId,version:"v1",organizationUnitIds:[],filterOrganizationUnitMembersHierarchically:!1,userGroupIds:[],accessControlPointIds:t,accessControlPointNames:i,recordReasons:[],direction:C.All,status:k.All,alwaysShowDescriptionText:!1}}initializeSubscriptions(){this.subscriptionActivity=this.systemService.onActivityTimelineUpdated.subscribe(t=>{this.widgetData&&this.updateActivityList(this.socketService.getActivityRoomHistory(this.widgetData))}),this.subscriptionOrganizationChanged=this.sessionService.onOrganizationChanged.subscribe(()=>{this.activities=[]}),this.subscriptionConnectionState=this.systemService.onConnectionStatusChanged.subscribe(t=>{t?this.joinActivityRoom():this.leaveActivityRoom()})}joinActivityRoom(){this.widgetData&&this.widgetData.accessControlPointIds&&this.widgetData.accessControlPointIds.length>0&&(this.activities=[],this.updateActivityList(this.socketService.joinActivityRoom(this.widgetData).history))}leaveActivityRoom(){this.activities=[],this.widgetData&&this.widgetData.accessControlPointIds&&this.widgetData.accessControlPointIds.length>0&&this.socketService.leaveActivityRoom(this.widgetData)}updateActivityList(t){let i={},o=t.filter(e=>e.a&&this.widgetData.accessControlPointIds.indexOf(e.a.ai)>=0||e.e&&this.widgetData.accessControlPointIds.indexOf(e.e.ai)>=0);o.sort((e,a)=>p.fromJSDate(e.u)<p.fromJSDate(a.u)?1:p.fromJSDate(e.u)>p.fromJSDate(a.u)?-1:0);let n=o.slice(0,A.REQUEST_ITEM_LIMIT);n.forEach(e=>{e.a&&!e.a.s&&e.a.ai&&this.accessControlPointService.getCurrentRemoteAccessGrantedList().items.findIndex(a=>a.id==e.a.ai)>-1&&(i[e.a.ai]&&i[e.a.ai]==e.a.d?e.remoteAccessControlPoint&&delete e.remoteAccessControlPoint:(i[e.a.ai]=e.a.d,e.remoteAccessControlPoint=this.accessControlPointService.getCurrentRemoteAccessGrantedList().items.find(a=>a.id==e.a.ai)))}),this.activities=n,this.detector.detectChanges()}onShowDetailClicked(t,i){i.showDetail=!i.showDetail,i.showDetail&&!i.detail&&this.reportService.getAccessLogDetail(i.i).subscribe(o=>{i.detail=o})}onSelectAccessControlPointClicked(){this.drawerService.create({nzContent:x,nzClosable:!1,nzWidth:w(!0),nzContentParams:{filter:y(this.widgetData)}}).afterClose.subscribe(i=>{i&&(this.leaveActivityRoom(),this.widgetData=i,this.joinActivityRoom(),this.dataUpdated.emit(this.widgetData))})}onAccessLogClicked(t){this.routingService.gotoAccessLogs()}onIdentityClicked(t,i){this.permissionReportDetailed&&this.drawerService.create({nzContent:et,nzClosable:!1,nzWidth:w(),nzContentParams:{identityId:i,selectedTab:1}}).afterClose.subscribe(n=>{n&&n.result.then(e=>{},e=>{})})}static ctorParameters=()=>[{type:z},{type:F},{type:B},{type:v},{type:Y},{type:V},{type:g},{type:W},{type:K}];static propDecorators={widgetData:[{type:d}],widgetId:[{type:d}],dataUpdated:[{type:I}],editFlag:[{type:d}]}};rt=bt([h({selector:"armon-activity-timeline",template:ot,animations:[Z,J],standalone:!0,imports:[b,M,f,R,$,T,O,tt,X,Q,it,D,u],styles:[nt]})],rt);export{rt as a};
