import { Component, ViewChild } from '@angular/core';
import { NgForm } from '@angular/forms';
import { AlertService, gettext, ModalService, Status } from '@c8y/ngx-components';
import { TranslateService } from '@ngx-translate/core';
import { cloneDeep, escapeRegExp, find, head, orderBy } from 'lodash-es';
import { BsModalService } from 'ngx-bootstrap/modal';
import { ConnectionInfoWithDownloadCsvComponent } from './connection-info-with-download-csv.component';
import { ConnectionType } from './multiple-lns-connector.model';
import { MultipleLnsConnectorService } from './multiple-lns-connector.service';
import * as i0 from "@angular/core";
import * as i1 from "./multiple-lns-connector.service";
import * as i2 from "@c8y/ngx-components";
import * as i3 from "@ngx-translate/core";
import * as i4 from "ngx-bootstrap/modal";
import * as i5 from "@angular/common";
import * as i6 from "@angular/forms";
import * as i7 from "./no-connections-found.component";
export class SigfoxMultipleLnsConnectorComponent {
    constructor(connectorService, alertService, translateService, modalService, modal) {
        this.connectorService = connectorService;
        this.alertService = alertService;
        this.translateService = translateService;
        this.modalService = modalService;
        this.modal = modal;
        this.state = 'loadingConnection';
        this.cloneDeep = cloneDeep;
        this.connections = Array();
        this.showPassword = false;
        this.cardHeader = gettext('Sigfox connections');
        this.allowedSpecialCharacters = '~!@$^(){}[]|:,<+=,.`_ -';
        this.namePattern = `^[a-zA-Z0-9 ${escapeRegExp(this.allowedSpecialCharacters)}]*$`;
        this.namePatternError = this.translateService.instant(gettext('Connection name can only contain letters, numbers, spaces, and the following symbols: {{ symbols }}'), {
            symbols: this.allowedSpecialCharacters
        });
    }
    async ngOnInit() {
        await this.loadConnections();
    }
    async loadConnections() {
        const res = await this.connectorService.list(ConnectionType.SIGFOX);
        if (res && res.status !== 200) {
            const data = res.json ? await res.json() : undefined;
            this.alertService.addServerFailure({ data, res });
            this.state = 'loadingError';
        }
        else {
            const list = await res.json();
            this.connections = orderBy(list, ['name'], ['asc']);
            await this.setModel();
        }
    }
    async setModel(connectionObj = null) {
        const resetConnection = await this.resetEditedUnsavedConnection();
        this.connection = connectionObj
            ? connectionObj
            : this.state === 'savedSuccessfully'
                ? this.connection
                : resetConnection ?? cloneDeep(head(this.connections));
        this.state = 'updateConnection';
        this.showPassword = false;
        this.originalConnection = this.connection ? cloneDeep(this.connection) : undefined;
    }
    async resetEditedUnsavedConnection() {
        if (this.state !== 'updateConnection' || !this.originalConnection) {
            return;
        }
        const { name } = this.originalConnection;
        const originalData = find(this.connections, { name });
        if (originalData) {
            return cloneDeep(originalData);
        }
    }
    async addConnection() {
        await this.resetEditedUnsavedConnection();
        this.connection = {};
        this.originalConnection = {};
        this.state = 'addConnections';
        this.showPassword = true;
    }
    async save() {
        const checkForConnectionName = this.originalConnection && this.originalConnection.name && this.originalConnection.name !== ''
            ? this.originalConnection.name
            : this.connection.name;
        const isConnectionExist = await this.connectorService.exists(ConnectionType.SIGFOX, checkForConnectionName);
        if (this.state === 'addConnections' && isConnectionExist) {
            const mesg = this.translateService.instant(gettext(`Connection with name "{{ name }}" already exists.`), { name: this.connection.name });
            this.alertService.danger(mesg);
        }
        else {
            return this.saveConnection();
        }
    }
    async deleteConnection(originalConnection) {
        const { name } = originalConnection;
        const mesg = this.translateService.instant(gettext(`You are about to delete the connection "{{ name }}". Do you want to proceed?`), { name });
        try {
            await this.modal.confirm(gettext('Delete connection'), mesg, Status.DANGER, {
                ok: gettext('Delete'),
                cancel: gettext('Cancel')
            });
            await this.delete(originalConnection);
        }
        catch (error) {
            // empty catch block
        }
    }
    changePassword() {
        this.showPassword = !this.showPassword;
        if (this.connectorsForm.controls.password) {
            this.connectorsForm.controls.password.setValue(null);
        }
    }
    async saveConnection() {
        const res = await this.connectorService.save(this.connection, this.originalConnection?.name);
        if (res && (res.status === 201 || res.status === 200)) {
            this.state = 'savedSuccessfully';
            this.alertService.success(gettext('Connection saved.'));
            await this.loadConnections();
        }
        else if (res && res.status === 500) {
            const data = res.json ? await res.json() : undefined;
            const app = this.connectorService.getApplication('sigfox-agent');
            const initialState = {
                messageData: data,
                appData: app,
                modalTitle: gettext('Failed to update the connection'),
                ariaDescribedby: 'modal-body',
                ariaLabelledBy: 'modal-title',
                connectionName: this.connection.name
            };
            this.modalService.show(ConnectionInfoWithDownloadCsvComponent, { initialState });
        }
        else {
            const data = res.json ? await res.json() : undefined;
            this.alertService.addServerFailure({ data, res });
        }
    }
    async delete(originalConnection) {
        try {
            const response = await this.connectorService.delete(originalConnection);
            if (response.ok && response.status === 204) {
                this.alertService.success(gettext('Connection deleted.'));
                await this.loadConnections();
            }
            else if (response && response.status === 500) {
                const data = response.json ? await response.json() : undefined;
                const app = this.connectorService.getApplication('sigfox-agent');
                const initialState = {
                    messageData: data,
                    appData: app,
                    ariaDescribedby: 'modal-body',
                    ariaLabelledBy: 'modal-title',
                    modalTitle: gettext('Failed to delete the connection'),
                    connectionName: originalConnection.name
                };
                this.modalService.show(ConnectionInfoWithDownloadCsvComponent, { initialState });
            }
            else {
                const data = response.json ? await response.json() : undefined;
                this.alertService.addServerFailure({ data, response });
            }
        }
        catch (error) {
            // empty catch block
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SigfoxMultipleLnsConnectorComponent, deps: [{ token: i1.MultipleLnsConnectorService }, { token: i2.AlertService }, { token: i3.TranslateService }, { token: i4.BsModalService }, { token: i2.ModalService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: SigfoxMultipleLnsConnectorComponent, selector: "sigfox-multiple-lns-connector", viewQueries: [{ propertyName: "connectorsForm", first: true, predicate: ["connectorsForm"], descendants: true }], ngImport: i0, template: "<ng-container *ngIf=\"state === 'loadingConnection'; else renderListAndForm\">\n  <c8y-loading></c8y-loading>\n</ng-container>\n<c8y-title>{{ 'Connectivity' | translate }}</c8y-title>\n\n<c8y-breadcrumb>\n  <c8y-breadcrumb-item\n    [icon]=\"'cog'\"\n    [label]=\"'Settings' | translate\"\n  ></c8y-breadcrumb-item>\n  <c8y-breadcrumb-item\n    [icon]=\"'cog'\"\n    [label]=\"'Connectivity' | translate\"\n  ></c8y-breadcrumb-item>\n  <c8y-breadcrumb-item\n    [icon]=\"'cog'\"\n    [label]=\"'Sigfox' | translate\"\n  ></c8y-breadcrumb-item>\n</c8y-breadcrumb>\n\n<ng-template #renderListAndForm>\n  <no-connections-found\n    (onAction)=\"addConnection()\"\n    *ngIf=\"connections.length === 0 && state !== 'addConnections'\"\n    [header]=\"cardHeader | translate\"\n  ></no-connections-found>\n  <div>\n    <div\n      class=\"card content-fullpage split-view--5-7\"\n      *ngIf=\"connections.length !== 0 || state === 'addConnections'\"\n    >\n      <div class=\"card-header separator grid__col--fullspan\">\n        <div class=\"card-title\">{{ cardHeader | translate }}</div>\n      </div>\n      <div class=\"inner-scroll split-view__list\">\n        <div class=\"bg-level-1 flex-grow\">\n          <c8y-list-group class=\"nav c8y-nav-stacked\">\n            <c8y-li\n              class=\"c8y-stacked-item p-0\"\n              [class.active]=\"connection.name === connectionBeingEdited\"\n              *ngFor=\"let connection of connections; let index = index\"\n              (click)=\"setModel(cloneDeep(connection))\"\n            >\n              <c8y-li-icon [icon]=\"'plug'\"></c8y-li-icon>\n              <span title=\"{{ connection.name }}\">\n                {{ connection.name }}\n              </span>\n            </c8y-li>\n\n            <c8y-li\n              class=\"c8y-nav-stacked active\"\n              *ngIf=\"state === 'addConnections'\"\n              (click)=\"addConnection()\"\n            >\n              <c8y-li-icon [icon]=\"'plug'\"></c8y-li-icon>\n              {{ 'New connection' | translate }}\n            </c8y-li>\n          </c8y-list-group>\n        </div>\n        <div class=\"card-footer separator-top\">\n          <button\n            class=\"btn btn-default\"\n            title=\"{{ 'Add connection' | translate }}\"\n            [disabled]=\"state === 'addConnections'\"\n            (click)=\"addConnection()\"\n          >\n            <i [c8yIcon]=\"'plus-circle'\"></i>\n            {{ 'Add connection' | translate }}\n          </button>\n        </div>\n      </div>\n\n      <!-- 'split-view__detail--selected' condition needs to be fixed. this is needed so that both columns are visible in tablet format -->\n\n      <div\n        class=\"inner-scroll split-view__detail\"\n        ng-class=\"{ 'split-view__detail--selected': vm.selected && vm.jsonSchemaObjects }\"\n      >\n        <div class=\"card-header separator visible-sm visible-xs fit-w sticky-top\">\n          <button\n            class=\"btn btn-clean text-primary\"\n            title=\"{{ 'Back' | translate }}\"\n            ng-click=\"vm.deselect()\"\n          >\n            <i [c8yIcon]=\"'chevron-left'\"></i>\n            <span>{{ 'Back' | translate }}</span>\n          </button>\n        </div>\n        <form\n          class=\"d-contents\"\n          #connectorsForm=\"ngForm\"\n        >\n          <div class=\"flex-grow\">\n            <div class=\"card-block large-padding\">\n              <c8y-form-group>\n                <label for=\"name\">\n                  {{ 'Name' | translate }}\n                </label>\n                <input\n                  class=\"form-control\"\n                  id=\"name\"\n                  name=\"name\"\n                  type=\"text\"\n                  required\n                  [placeholder]=\"'e.g. Sigfox connection' | translate\"\n                  [(ngModel)]=\"connection.name\"\n                  [pattern]=\"namePattern\"\n                />\n                <c8y-messages>\n                  <c8y-message\n                    name=\"pattern\"\n                    [text]=\"namePatternError\"\n                  ></c8y-message>\n                </c8y-messages>\n              </c8y-form-group>\n\n              <c8y-form-group>\n                <label for=\"description\">\n                  {{ 'Description' | translate }}\n                </label>\n                <input\n                  class=\"form-control\"\n                  id=\"description\"\n                  name=\"description\"\n                  type=\"text\"\n                  [placeholder]=\"\n                    'e.g. This connection has a built-in functionality to\u2026' | translate\n                  \"\n                  [(ngModel)]=\"connection.description\"\n                />\n              </c8y-form-group>\n\n              <c8y-form-group>\n                <label for=\"baseUrl\">\n                  {{ 'URL' | translate }}\n                </label>\n                <input\n                  class=\"form-control\"\n                  id=\"baseUrl\"\n                  name=\"baseUrl\"\n                  type=\"text\"\n                  required\n                  [placeholder]=\"\n                    'e.g. {{ example }}' | translate : { example: 'https://backend.sigfox.com/api' }\n                  \"\n                  [(ngModel)]=\"connection.baseUrl\"\n                />\n              </c8y-form-group>\n              <c8y-form-group>\n                <label for=\"parentGroupId\">\n                  {{ 'Parent group ID' | translate }}\n                </label>\n                <input\n                  class=\"form-control\"\n                  id=\"parentGroupId\"\n                  name=\"parentGroupId\"\n                  type=\"text\"\n                  required\n                  [placeholder]=\"\n                    'e.g. {{ example }}' | translate : { example: '58c1793b9e93a15370f71caa' }\n                  \"\n                  [(ngModel)]=\"connection.parentGroupId\"\n                  pattern=\"[a-z\\d]+\"\n                />\n                <c8y-messages>\n                  <c8y-message\n                    name=\"pattern\"\n                    text=\"{{ 'Must be a valid Parent group ID' | translate }}\"\n                  ></c8y-message>\n                </c8y-messages>\n              </c8y-form-group>\n\n              <c8y-form-group>\n                <label for=\"username\">\n                  {{ 'Username' | translate }}\n                </label>\n                <input\n                  class=\"form-control\"\n                  id=\"username\"\n                  placeholder=\"{{ 'e.g. joe`LOCALIZE`' | translate }}\"\n                  name=\"username\"\n                  type=\"text\"\n                  required\n                  [(ngModel)]=\"connection.username\"\n                />\n              </c8y-form-group>\n              <c8y-form-group *ngIf=\"showPassword\">\n                <label for=\"password\">\n                  {{ 'Password' | translate }}\n                </label>\n                <input\n                  class=\"form-control\"\n                  id=\"password\"\n                  placeholder=\"{{ 'e.g. my_password' | translate }}\"\n                  name=\"password\"\n                  type=\"password\"\n                  required\n                  [(ngModel)]=\"connection.password\"\n                />\n              </c8y-form-group>\n\n              <button\n                class=\"btn btn-default\"\n                name=\"changePassword\"\n                type=\"button\"\n                *ngIf=\"state === 'updateConnection'\"\n                (click)=\"changePassword()\"\n              >\n                <span\n                  title=\"{{ 'Change password' | translate }}\"\n                  *ngIf=\"!showPassword\"\n                >\n                  {{ 'Change password' | translate }}\n                </span>\n                <span\n                  title=\"{{ 'Cancel password change' | translate }}\"\n                  *ngIf=\"showPassword\"\n                >\n                  {{ 'Cancel password change' | translate }}\n                </span>\n              </button>\n            </div>\n          </div>\n\n          <div class=\"card-footer separator-top\">\n            <button\n              class=\"btn btn-default\"\n              title=\"{{ 'Cancel' | translate }}\"\n              type=\"button\"\n              (click)=\"setModel()\"\n              translate\n            >\n              Cancel\n            </button>\n            <button\n              class=\"btn btn-danger\"\n              title=\"{{ 'Delete' | translate }}\"\n              type=\"button\"\n              data-cy=\"sigfox-multiple-lns-connector.component--delete-connectivity\"\n              *ngIf=\"state === 'updateConnection'\"\n              (click)=\"deleteConnection(originalConnection)\"\n              translate\n            >\n              Delete\n            </button>\n            <button\n              class=\"btn btn-primary\"\n              title=\"{{ 'Save' | translate }}\"\n              data-cy=\"sigfox-multiple-lns-connector.component--save-connectivity\"\n              type=\"submit\"\n              [disabled]=\"!this.connectorsForm.form.valid || this.connectorsForm.form.pristine\"\n              (click)=\"save()\"\n              translate\n            >\n              Save\n            </button>\n          </div>\n        </form>\n      </div>\n    </div>\n  </div>\n</ng-template>\n", dependencies: [{ kind: "component", type: i2.BreadcrumbComponent, selector: "c8y-breadcrumb" }, { kind: "component", type: i2.BreadcrumbItemComponent, selector: "c8y-breadcrumb-item", inputs: ["icon", "translate", "label", "path", "injector"] }, { kind: "directive", type: i2.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: i2.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.LoadingComponent, selector: "c8y-loading", inputs: ["layout", "progress", "message"] }, { kind: "component", type: i2.TitleComponent, selector: "c8y-title", inputs: ["pageTitleUpdate"] }, { kind: "directive", type: i6.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i6.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i6.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i2.FormGroupComponent, selector: "c8y-form-group", inputs: ["hasError", "hasWarning", "hasSuccess", "novalidation", "status"] }, { kind: "directive", type: i2.MessageDirective, selector: "c8y-message", inputs: ["name", "text"] }, { kind: "component", type: i2.MessagesComponent, selector: "c8y-messages", inputs: ["show", "defaults", "helpMessage"] }, { kind: "directive", type: i2.RequiredInputPlaceholderDirective, selector: "input[required], input[formControlName]" }, { kind: "component", type: i2.ListGroupComponent, selector: "c8y-list-group" }, { kind: "component", type: i2.ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "highlighted", "emptyActions", "dense", "collapsed", "selectable"], outputs: ["collapsedChange"] }, { kind: "component", type: i2.ListItemIconComponent, selector: "c8y-list-item-icon, c8y-li-icon", inputs: ["icon", "status"] }, { kind: "component", type: i7.NoConnectionsFoundComponent, selector: "no-connections-found", inputs: ["header"], outputs: ["onAction"] }, { kind: "pipe", type: i2.C8yTranslatePipe, name: "translate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SigfoxMultipleLnsConnectorComponent, decorators: [{
            type: Component,
            args: [{ selector: 'sigfox-multiple-lns-connector', template: "<ng-container *ngIf=\"state === 'loadingConnection'; else renderListAndForm\">\n  <c8y-loading></c8y-loading>\n</ng-container>\n<c8y-title>{{ 'Connectivity' | translate }}</c8y-title>\n\n<c8y-breadcrumb>\n  <c8y-breadcrumb-item\n    [icon]=\"'cog'\"\n    [label]=\"'Settings' | translate\"\n  ></c8y-breadcrumb-item>\n  <c8y-breadcrumb-item\n    [icon]=\"'cog'\"\n    [label]=\"'Connectivity' | translate\"\n  ></c8y-breadcrumb-item>\n  <c8y-breadcrumb-item\n    [icon]=\"'cog'\"\n    [label]=\"'Sigfox' | translate\"\n  ></c8y-breadcrumb-item>\n</c8y-breadcrumb>\n\n<ng-template #renderListAndForm>\n  <no-connections-found\n    (onAction)=\"addConnection()\"\n    *ngIf=\"connections.length === 0 && state !== 'addConnections'\"\n    [header]=\"cardHeader | translate\"\n  ></no-connections-found>\n  <div>\n    <div\n      class=\"card content-fullpage split-view--5-7\"\n      *ngIf=\"connections.length !== 0 || state === 'addConnections'\"\n    >\n      <div class=\"card-header separator grid__col--fullspan\">\n        <div class=\"card-title\">{{ cardHeader | translate }}</div>\n      </div>\n      <div class=\"inner-scroll split-view__list\">\n        <div class=\"bg-level-1 flex-grow\">\n          <c8y-list-group class=\"nav c8y-nav-stacked\">\n            <c8y-li\n              class=\"c8y-stacked-item p-0\"\n              [class.active]=\"connection.name === connectionBeingEdited\"\n              *ngFor=\"let connection of connections; let index = index\"\n              (click)=\"setModel(cloneDeep(connection))\"\n            >\n              <c8y-li-icon [icon]=\"'plug'\"></c8y-li-icon>\n              <span title=\"{{ connection.name }}\">\n                {{ connection.name }}\n              </span>\n            </c8y-li>\n\n            <c8y-li\n              class=\"c8y-nav-stacked active\"\n              *ngIf=\"state === 'addConnections'\"\n              (click)=\"addConnection()\"\n            >\n              <c8y-li-icon [icon]=\"'plug'\"></c8y-li-icon>\n              {{ 'New connection' | translate }}\n            </c8y-li>\n          </c8y-list-group>\n        </div>\n        <div class=\"card-footer separator-top\">\n          <button\n            class=\"btn btn-default\"\n            title=\"{{ 'Add connection' | translate }}\"\n            [disabled]=\"state === 'addConnections'\"\n            (click)=\"addConnection()\"\n          >\n            <i [c8yIcon]=\"'plus-circle'\"></i>\n            {{ 'Add connection' | translate }}\n          </button>\n        </div>\n      </div>\n\n      <!-- 'split-view__detail--selected' condition needs to be fixed. this is needed so that both columns are visible in tablet format -->\n\n      <div\n        class=\"inner-scroll split-view__detail\"\n        ng-class=\"{ 'split-view__detail--selected': vm.selected && vm.jsonSchemaObjects }\"\n      >\n        <div class=\"card-header separator visible-sm visible-xs fit-w sticky-top\">\n          <button\n            class=\"btn btn-clean text-primary\"\n            title=\"{{ 'Back' | translate }}\"\n            ng-click=\"vm.deselect()\"\n          >\n            <i [c8yIcon]=\"'chevron-left'\"></i>\n            <span>{{ 'Back' | translate }}</span>\n          </button>\n        </div>\n        <form\n          class=\"d-contents\"\n          #connectorsForm=\"ngForm\"\n        >\n          <div class=\"flex-grow\">\n            <div class=\"card-block large-padding\">\n              <c8y-form-group>\n                <label for=\"name\">\n                  {{ 'Name' | translate }}\n                </label>\n                <input\n                  class=\"form-control\"\n                  id=\"name\"\n                  name=\"name\"\n                  type=\"text\"\n                  required\n                  [placeholder]=\"'e.g. Sigfox connection' | translate\"\n                  [(ngModel)]=\"connection.name\"\n                  [pattern]=\"namePattern\"\n                />\n                <c8y-messages>\n                  <c8y-message\n                    name=\"pattern\"\n                    [text]=\"namePatternError\"\n                  ></c8y-message>\n                </c8y-messages>\n              </c8y-form-group>\n\n              <c8y-form-group>\n                <label for=\"description\">\n                  {{ 'Description' | translate }}\n                </label>\n                <input\n                  class=\"form-control\"\n                  id=\"description\"\n                  name=\"description\"\n                  type=\"text\"\n                  [placeholder]=\"\n                    'e.g. This connection has a built-in functionality to\u2026' | translate\n                  \"\n                  [(ngModel)]=\"connection.description\"\n                />\n              </c8y-form-group>\n\n              <c8y-form-group>\n                <label for=\"baseUrl\">\n                  {{ 'URL' | translate }}\n                </label>\n                <input\n                  class=\"form-control\"\n                  id=\"baseUrl\"\n                  name=\"baseUrl\"\n                  type=\"text\"\n                  required\n                  [placeholder]=\"\n                    'e.g. {{ example }}' | translate : { example: 'https://backend.sigfox.com/api' }\n                  \"\n                  [(ngModel)]=\"connection.baseUrl\"\n                />\n              </c8y-form-group>\n              <c8y-form-group>\n                <label for=\"parentGroupId\">\n                  {{ 'Parent group ID' | translate }}\n                </label>\n                <input\n                  class=\"form-control\"\n                  id=\"parentGroupId\"\n                  name=\"parentGroupId\"\n                  type=\"text\"\n                  required\n                  [placeholder]=\"\n                    'e.g. {{ example }}' | translate : { example: '58c1793b9e93a15370f71caa' }\n                  \"\n                  [(ngModel)]=\"connection.parentGroupId\"\n                  pattern=\"[a-z\\d]+\"\n                />\n                <c8y-messages>\n                  <c8y-message\n                    name=\"pattern\"\n                    text=\"{{ 'Must be a valid Parent group ID' | translate }}\"\n                  ></c8y-message>\n                </c8y-messages>\n              </c8y-form-group>\n\n              <c8y-form-group>\n                <label for=\"username\">\n                  {{ 'Username' | translate }}\n                </label>\n                <input\n                  class=\"form-control\"\n                  id=\"username\"\n                  placeholder=\"{{ 'e.g. joe`LOCALIZE`' | translate }}\"\n                  name=\"username\"\n                  type=\"text\"\n                  required\n                  [(ngModel)]=\"connection.username\"\n                />\n              </c8y-form-group>\n              <c8y-form-group *ngIf=\"showPassword\">\n                <label for=\"password\">\n                  {{ 'Password' | translate }}\n                </label>\n                <input\n                  class=\"form-control\"\n                  id=\"password\"\n                  placeholder=\"{{ 'e.g. my_password' | translate }}\"\n                  name=\"password\"\n                  type=\"password\"\n                  required\n                  [(ngModel)]=\"connection.password\"\n                />\n              </c8y-form-group>\n\n              <button\n                class=\"btn btn-default\"\n                name=\"changePassword\"\n                type=\"button\"\n                *ngIf=\"state === 'updateConnection'\"\n                (click)=\"changePassword()\"\n              >\n                <span\n                  title=\"{{ 'Change password' | translate }}\"\n                  *ngIf=\"!showPassword\"\n                >\n                  {{ 'Change password' | translate }}\n                </span>\n                <span\n                  title=\"{{ 'Cancel password change' | translate }}\"\n                  *ngIf=\"showPassword\"\n                >\n                  {{ 'Cancel password change' | translate }}\n                </span>\n              </button>\n            </div>\n          </div>\n\n          <div class=\"card-footer separator-top\">\n            <button\n              class=\"btn btn-default\"\n              title=\"{{ 'Cancel' | translate }}\"\n              type=\"button\"\n              (click)=\"setModel()\"\n              translate\n            >\n              Cancel\n            </button>\n            <button\n              class=\"btn btn-danger\"\n              title=\"{{ 'Delete' | translate }}\"\n              type=\"button\"\n              data-cy=\"sigfox-multiple-lns-connector.component--delete-connectivity\"\n              *ngIf=\"state === 'updateConnection'\"\n              (click)=\"deleteConnection(originalConnection)\"\n              translate\n            >\n              Delete\n            </button>\n            <button\n              class=\"btn btn-primary\"\n              title=\"{{ 'Save' | translate }}\"\n              data-cy=\"sigfox-multiple-lns-connector.component--save-connectivity\"\n              type=\"submit\"\n              [disabled]=\"!this.connectorsForm.form.valid || this.connectorsForm.form.pristine\"\n              (click)=\"save()\"\n              translate\n            >\n              Save\n            </button>\n          </div>\n        </form>\n      </div>\n    </div>\n  </div>\n</ng-template>\n" }]
        }], ctorParameters: () => [{ type: i1.MultipleLnsConnectorService }, { type: i2.AlertService }, { type: i3.TranslateService }, { type: i4.BsModalService }, { type: i2.ModalService }], propDecorators: { connectorsForm: [{
                type: ViewChild,
                args: ['connectorsForm', { static: false }]
            }] } });
//# sourceMappingURL=data:application/json;base64, 