import{Id as m,sa as g,ta as C}from"./chunk-NVJ2ZZFT.js";import{Aa as b,Pd as w,Rd as A,Sd as k,ab as p,bb as y,dd as f,ec as x,hc as s,ya as d}from"./chunk-SKPDQO4E.js";var v=`<div class="pt-3 b-t-1" *ngIf="authenticationFactors.length > 0 ||\xA0editable">

    <div class="mb-3 headerArea">
        <label class="formLabel">{{'ACCESSCONTROLPOINT.MULTIPLE_AUTHENTICATION' | translate}}</label>
        <button *ngIf="editable" class="btn btn-sm btn-outline-primary"
            (click)="onAddMethodClicked($event)">{{'ACCESSCONTROLPOINT.AUTHENTICATION_BUTTON_ADD' | translate}}</button>
    </div>

    <div class="factorItem" *ngFor="let factor of authenticationFactors; index as factorIndex">
        <div class="factorOr" *ngIf="factorIndex > 0">
            <span>{{'ACCESSCONTROLPOINT.AUTHENTICATION_OR' |\xA0translate}}</span>
        </div>
        <div class="factorChipContainer column-gap-1">
            <div class="factorChip" *ngFor="let item of factor.and; index as itemIndex">
                <div class="chip">
                    <span class="chipOrder">{{itemIndex+1}}</span>
                    <span class="chipLabel">{{item.factorDescription | translate}} (<span
                            *ngIf="hasMultipleAuthenticationFactor(factor.id, item.factor, item.authenticatorType)">{{item.uniqueNumber}}.
                        </span>{{item.authenticatorDescription | translate}})</span>
                    <span class="chipRemove" (click)="onRemoveItemClicked(factor.id, item.id)"
                        *ngIf="editable"><strong>X</strong></span>
                </div>
            </div>
            <div *ngIf="editable" class="factorChip">
                <div class="chip" [attr.addnew]="true" (click)="onAddFactorClicked(factor.id)">
                    <span class="chipLabelAdd">{{'BUTTON.ADD' |\xA0translate}}</span>
                </div>
            </div>
        </div>
    </div>
    <div *ngIf="authenticationFactors.length === 0">
        <p class="p2" style="text-align: center">{{'ACCESSCONTROLPOINT.AUTHENTICATION_EMPTY' | translate}}</p>
    </div>
</div>`;var T=`.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}.headerArea{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center}.headerArea button{margin-left:auto}.factorItem{margin-top:4px;align-items:center;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-flex-grow:1;-webkit-box-flex:1;-moz-flex-grow:1;-ms-flex-positive:1;flex-grow:1}.factorOr{padding:0rem .5rem;font-size:.672rem}.factorChipContainer{border:1px solid #ddd;border-radius:.375rem;padding:0 8px;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-flex-wrap:wrap;-moz-flex-wrap:wrap;flex-wrap:wrap;-webkit-flex-grow:1;-webkit-box-flex:1;-moz-flex-grow:1;-ms-flex-positive:1;flex-grow:1}.factorChip{margin-top:.2rem;margin-bottom:.2rem;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-flex-wrap:wrap;-moz-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center;font-size:.672rem}.factorChip .chip{display:-webkit-inline-flex;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem}.factorChip .chip .chipPadding,.factorChip .chip .chipRemove,.factorChip .chip .chipLabelAdd,.factorChip .chip .chipLabel,.factorChip .chip .chipOrder{padding:.21rem .42rem}.factorChip .chip .chipOrder{-webkit-border-top-left-radius:.375rem;-moz-border-radius-topleft:.375rem;border-top-left-radius:.375rem;-webkit-border-v-left-radius:.375rem;-moz-border-radius-bottomleft:.375rem;border-bottom-left-radius:.375rem;background-color:#0a2a5ab3;color:#fdfeff}.factorChip .chip .chipLabel{text-align:center;background-color:#eee;color:#0a2a5a}.factorChip .chip .chipLabelAdd{text-align:center}.factorChip .chip .chipRemove{background-color:#c82602b3;color:#fff;cursor:pointer;-webkit-border-top-right-radius:.375rem;-moz-border-radius-topv:.375rem;border-top-right-radius:.375rem;-webkit-border-v-right-radius:.375rem;-moz-border-radius-bottomright:.375rem;border-bottom-right-radius:.375rem}.factorChip .chip[addnew=true]{cursor:pointer;border:1px solid #62a325;background-color:#fdfefc}.factorChip .chip[addnew=true] .chipLabelAdd,.addConnectIcon{color:#62a325}
`;var l;(function(r){r[r.User=1]="User",r[r.Visitor=2]="Visitor"})(l||(l={}));var h=[{type:l.User,description:"AUTHENTICATORTYPE.USER"},{type:l.Visitor,description:"AUTHENTICATORTYPE.VISITOR"}];var I=`<div class="modal-header">
    <span class="text-lg">{{'BUTTON.ADD' |\xA0translate}}</span>
</div>

<div class="modal-body">

    <div class="type-container mb-3">

        <div class="type-column pt-3">
            <div *ngFor="let item of sliceArray(authenticationTypes, true)" class="type-item"
                [attr.selected]="isAuthenticationTypeSelected(item.type)"
                (click)="onAuthenticationTypeClicked(item.type)">
                {{item.description | translate}}
            </div>
        </div>

        <div class="type-column pt-3">
            <div *ngFor="let item of sliceArray(authenticationTypes, false)" class="type-item"
                [attr.selected]="isAuthenticationTypeSelected(item.type)"
                (click)="onAuthenticationTypeClicked(item.type)">
                {{item.description | translate}}
            </div>
        </div>

    </div>

    <label class="formLabel">{{'ACCESSCONTROLPOINT.AUTHENTICATION_AUTHENTICATOR' | translate}}</label>

    <div class="type-container">

        <div class="type-column pt-3">
            <div *ngFor="let item of sliceArray(authenticators, true)" class="type-item"
                [attr.selected]="isAuthenticatorSelected(item.type)" (click)="onAuthenticatorClicked(item.type)">
                {{item.description | translate}}
            </div>
        </div>

        <div class="type-column pt-3">
            <div *ngFor="let item of sliceArray(authenticators, false)" class="type-item"
                [attr.selected]="isAuthenticatorSelected(item.type)" (click)="onAuthenticatorClicked(item.type)">
                {{item.description | translate}}
            </div>
        </div>

    </div>

</div>

<div class="modal-footer">
    <button class="btn btn-outline-primary" (click)="onCancelClicked($event)">{{'BUTTON.CLOSE' | translate}}</button>
    <button class="btn btn-success" (click)="onAddClicked($event)"
        [disabled]="addDisabled">{{'BUTTON.ADD' | translate}}</button>
</div>`;var O=`.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}.type-container{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex}.type-container .type-column{-webkit-flex-grow:1;-webkit-box-flex:1;-moz-flex-grow:1;-ms-flex-positive:1;flex-grow:1;margin-right:.4rem}.type-container .type-column .type-item{margin:.2rem 0rem;padding:.1rem .4rem;border:1px solid #ddd;cursor:pointer;border-radius:3px;font-size:13px}.type-container .type-column .type-item[selected=true]{background:#eb8d00;color:#fff;font-weight:500}
`;var F=function(r,t,e,o){var i=arguments.length,n=i<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(r,t,e,o);else for(var c=r.length-1;c>=0;c--)(a=r[c])&&(n=(i<3?a(n):i>3?a(t,e,n):a(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},u=class extends k{sessionService;selectedAuthenticationType;selectedAuthenticator;addDisabled=!0;constructor(t){super(),this.sessionService=t}get authenticationTypes(){return m}get authenticators(){return h}sliceArray(t,e){let o=Math.ceil(t.length/2);return e?t.slice(0,o):t.slice(o)}onAuthenticationTypeClicked(t){this.selectedAuthenticationType=t,this.setAddDisabled()}onAuthenticatorClicked(t){this.selectedAuthenticator=t,this.setAddDisabled()}isAuthenticationTypeSelected(t){return this.selectedAuthenticationType!=null&&this.selectedAuthenticationType!=null&&this.selectedAuthenticationType===t}isAuthenticatorSelected(t){return!!this.selectedAuthenticator&&this.selectedAuthenticator===t}setAddDisabled(){this.addDisabled=this.selectedAuthenticationType==null||this.selectedAuthenticationType==null||this.selectedAuthenticator==null||this.selectedAuthenticator==null}onAddClicked(t){let e=new g;e.authenticatorType=this.selectedAuthenticator,e.factor=this.selectedAuthenticationType,this.closeModal(e)}static ctorParameters=()=>[{type:w}]};u=F([d({selector:"armon-access-control-point-authentication-factors-select-modal",template:I,standalone:!0,imports:[p,f],styles:[O]})],u);var E=function(r,t,e,o){var i=arguments.length,n=i<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(r,t,e,o);else for(var c=r.length-1;c>=0;c--)(a=r[c])&&(n=(i<3?a(n):i>3?a(t,e,n):a(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},z=class{modalService;accessControlPoint;editable;factorList=[];constructor(t){this.modalService=t}ngOnInit(){this.accessControlPoint&&this.accessControlPoint.authenticationFactors&&this.accessControlPoint.authenticationFactors.forEach(t=>{let e=x(t);e.id=s(),e.and=[],(t.and||[]).forEach(o=>{let i=x(o);i.id=s(),this.generateItemDescriptions(i),e.and.push(i)}),this.factorList.push(e)})}generateItemDescriptions(t){let e=h.find(i=>i.type===t.authenticatorType);t.authenticatorDescription=e?e.description:"";let o=m.find(i=>i.type===t.factor);t.factorDescription=o?o.description:""}get authenticationFactors(){return this.factorList}hasMultipleAuthenticationFactor(t,e,o){let i=this.factorList.findIndex(n=>n.id===t);return i>=0?this.factorList[i].and.filter(n=>n.factor===e&&n.authenticatorType===o).length>1:!1}onAddMethodClicked(t){let e=new C;e.id=s(),e.and=[],this.factorList.push(e)}onAddFactorClicked(t){this.modalService.open(u,{settings:{size:"md"}}).result.then(e=>{let o=this.factorList.findIndex(i=>i.id===t);o>=0&&(e.id=s(),e.uniqueNumber=this.factorList[o].and.filter(i=>i.factor===e.factor&&i.authenticatorType===e.authenticatorType).length+1,this.generateItemDescriptions(e),this.factorList[o].and.push(e))}).catch(e=>{})}onRemoveItemClicked(t,e){if(!t||!e)return;let o=this.factorList.findIndex(i=>i.id===t);if(o>=0){let i=this.factorList[o].and.findIndex(n=>n.id===e);if(i>=0){if(this.hasMultipleAuthenticationFactor(t,this.factorList[o].and[i].factor,this.factorList[o].and[i].authenticatorType)){let n=this.factorList[o].and[i];this.factorList[o].and.forEach(a=>{a.factor===n.factor&&a.authenticatorType===n.authenticatorType&&a.uniqueNumber>n.uniqueNumber&&a.uniqueNumber--})}this.factorList[o].and.splice(i,1)}}}getCurrentFactorList(){let t=(this.factorList||[]).filter(e=>e.and&&e.and.length>0);return t.length===0?null:t}static ctorParameters=()=>[{type:A}];static propDecorators={accessControlPoint:[{type:b}],editable:[{type:b}]}};z=E([d({selector:"armon-access-control-point-authentication-factors",template:v,standalone:!0,imports:[y,p,f],styles:[T]})],z);export{z as a};
