text: System.register(["./../../../utilities/vanilla/jsTools", "password-meter", "aurelia-framework"], function (exports_1, context_1) {
      var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
          var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
          if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
          else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
          return c > 3 && r && Object.defineProperty(target, key, r), r;
      };
      var __metadata = (this && this.__metadata) || function (k, v) {
          if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
      };
      var __moduleName = context_1 && context_1.id;
      var jsTools_1, password_meter_1, aurelia_framework_1, PasswordCustomElement;
      return {
          setters: [
              function (jsTools_1_1) {
                  jsTools_1 = jsTools_1_1;
              },
              function (password_meter_1_1) {
                  password_meter_1 = password_meter_1_1;
              },
              function (aurelia_framework_1_1) {
                  aurelia_framework_1 = aurelia_framework_1_1;
              }
          ],
          execute: function () {
              PasswordCustomElement = (function () {
                  function PasswordCustomElement(jsTools) {
                      this.jsTools = jsTools;
                      this.buttonColorType = 'secondary';
                      this.errorIcon = 'fa fa-times';
                      this.showPasswordIcon = 'fa fa-eye';
                      this.hidePasswordIcon = 'fa fa-eye-slash';
                      this.progressBarHeight = '5px';
                      this.errorDisplayType = 'none';
                      this.showProgressBar = true;
                      this.size = 'md';
                      this.showPercent = false;
                      this.passwordVisibility = true;
                      this.scoreRange = null;
                      this.requirements = null;
                      this.isInvisible = true;
                      this.progressBarValue = 0;
                      this.percentValue = '';
                      this.progressBarClass = null;
                      this.progressBarColor = null;
                  }
                  PasswordCustomElement.prototype.afterAttached = function () {
                      this.showProgressBar = (this.showProgressBar === '' && this.passwordTemplate.hasAttribute('show-progress-bar')) || this.showProgressBar.toString() === 'true';
                      this.showPercent = (this.showPercent === '' && this.passwordTemplate.hasAttribute('show-percent')) || this.showPercent.toString() === 'true';
                      this.passwordVisibility = (this.passwordVisibility === '' && this.passwordTemplate.hasAttribute('password-visibility')) || this.passwordVisibility.toString() === 'true';
                      var req = this.requirements;
                      var range = this.getScoreRangeInfo(this.scoreRange);
                      this.passwordMeter = new password_meter_1.PasswordMeter(req, range);
                      if (this.text && this.text.length > 0) {
                          this.textChanged(this.text);
                      }
                  };
                  PasswordCustomElement.prototype.passwordVisibilityToggle = function () {
                      if (this.isInvisible) {
                          this.isInvisible = false;
                          $(this.txtPassword).attr('type', 'text');
                      }
                      else {
                          this.isInvisible = true;
                          $(this.txtPassword).attr('type', 'password');
                      }
                  };
                  PasswordCustomElement.prototype.generateErrorsAsHtml = function (errors) {
                      var html = '';
                      if (errors) {
                          for (var index = 0; index < errors.length; index++) {
                              var element = errors[index];
                              html += "<div class=\"abt-password-error-item\"><i class=\"abt-password-error-icon " + this.errorIcon + "\" aria-hidden=\"true\"></i>" + element + "</div>";
                          }
                      }
                      return html;
                  };
                  PasswordCustomElement.prototype.getScoreRangeInfo = function (scoreRange) {
                      var option = {};
                      var color = '';
                      var isClass = false;
                      var scores = Object.keys(scoreRange);
                      for (var index = 0; index < scores.length; index++) {
                          var key = scores[index];
                          var message = scoreRange[key].message;
                          option[key] = message;
                      }
                      return option;
                  };
                  PasswordCustomElement.prototype.getMinColorInfo = function (scoreRange) {
                      var scores = Object.keys(scoreRange);
                      var color = null;
                      var isClass = false;
                      var key = scores[0];
                      var message = scoreRange[key].message;
                      color = scoreRange[key].color;
                      isClass = color.startsWith('.');
                      return {
                          color: color,
                          isClass: isClass
                      };
                  };
                  PasswordCustomElement.prototype.getColorInfo = function (scoreRange, status) {
                      var scores = Object.keys(scoreRange);
                      var color = null;
                      var isClass = false;
                      for (var index = 0; index < scores.length; index++) {
                          var key = scores[index];
                          var message = scoreRange[key].message;
                          if (message === status) {
                              color = scoreRange[key].color;
                              isClass = color.startsWith('.');
                              break;
                          }
                      }
                      if (!color) {
                          return null;
                      }
                      return {
                          color: color,
                          isClass: isClass
                      };
                  };
                  PasswordCustomElement.prototype.textChanged = function (value) {
                      if (!this.scoreRange) {
                          throw Error("The 'score-range' property can not be null.");
                      }
                      if (!this.jsTools.isObject(this.scoreRange)) {
                          throw Error("The 'score-range' property must be an object.");
                      }
                      var result = this.passwordMeter.getResult(value);
                      var colorStatus = this.getColorInfo(this.scoreRange, result.status);
                      if (colorStatus) {
                          if (colorStatus.isClass) {
                              this.progressBarClass = colorStatus.color.replace('.', '');
                              this.progressBarColor = null;
                          }
                          else {
                              this.progressBarClass = null;
                              this.progressBarColor = colorStatus.color;
                          }
                      }
                      if (result.score >= 0) {
                          this.progressBarValue = result.percent;
                          if (this.showPercent && result.score > 0) {
                              this.percentValue = result.percent + '%';
                          }
                      }
                      else {
                          this.percentValue = '';
                          this.progressBarValue = 100;
                          colorStatus = this.getMinColorInfo(this.scoreRange);
                          if (colorStatus.isClass) {
                              this.progressBarClass = colorStatus.color.replace('.', '');
                              this.progressBarColor = null;
                          }
                          else {
                              this.progressBarClass = null;
                              this.progressBarColor = colorStatus.color;
                          }
                      }
                      if (result.score < 0) {
                          this.percentValue = '';
                          if (this.errorDisplayType === 'tooltip') {
                              $(this.txtPassword).tooltip({
                                  'title': this.generateErrorsAsHtml(result.errors),
                                  'html': true,
                                  'animation': true,
                                  'placement': 'bottom',
                                  'template': '<div class="tooltip" role="tooltip"><div class="arrow"></div><div style="max-width: 350px;" class="tooltip-inner text-left text-nowrap"></div></div>'
                              });
                              this.errorsList.innerHTML = '';
                          }
                          else if (this.errorDisplayType === 'list') {
                              $(this.txtPassword).tooltip('dispose');
                              this.errorsList.innerHTML = this.generateErrorsAsHtml(result.errors);
                          }
                          else {
                              $(this.txtPassword).tooltip('dispose');
                              this.errorsList.innerHTML = '';
                          }
                      }
                      if (result.score === 0 || !result.errors) {
                          $(this.txtPassword).tooltip('dispose');
                          this.errorsList.innerHTML = '';
                          if (result.score === 0) {
                              this.percentValue = '';
                          }
                      }
                      if (this.passwordChanged) {
                          this.passwordChanged({
                              result: result,
                              colorStatus: colorStatus
                          });
                      }
                  };
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneWay }),
                      __metadata("design:type", String)
                  ], PasswordCustomElement.prototype, "inputClass", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneWay }),
                      __metadata("design:type", String)
                  ], PasswordCustomElement.prototype, "inputStyle", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneWay }),
                      __metadata("design:type", String)
                  ], PasswordCustomElement.prototype, "buttonClass", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneWay }),
                      __metadata("design:type", String)
                  ], PasswordCustomElement.prototype, "buttonStyle", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneWay }),
                      __metadata("design:type", String)
                  ], PasswordCustomElement.prototype, "buttonColorType", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneWay }),
                      __metadata("design:type", String)
                  ], PasswordCustomElement.prototype, "errorIcon", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneWay }),
                      __metadata("design:type", String)
                  ], PasswordCustomElement.prototype, "showPasswordIcon", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneWay }),
                      __metadata("design:type", String)
                  ], PasswordCustomElement.prototype, "hidePasswordIcon", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneWay }),
                      __metadata("design:type", String)
                  ], PasswordCustomElement.prototype, "progressBarHeight", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneWay }),
                      __metadata("design:type", String)
                  ], PasswordCustomElement.prototype, "errorDisplayType", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneWay }),
                      __metadata("design:type", Object)
                  ], PasswordCustomElement.prototype, "showProgressBar", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneWay }),
                      __metadata("design:type", String)
                  ], PasswordCustomElement.prototype, "size", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneWay }),
                      __metadata("design:type", Object)
                  ], PasswordCustomElement.prototype, "showPercent", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneWay }),
                      __metadata("design:type", Object)
                  ], PasswordCustomElement.prototype, "passwordVisibility", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.twoWay }),
                      __metadata("design:type", String)
                  ], PasswordCustomElement.prototype, "text", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.twoWay }),
                      __metadata("design:type", Object)
                  ], PasswordCustomElement.prototype, "scoreRange", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.twoWay }),
                      __metadata("design:type", Object)
                  ], PasswordCustomElement.prototype, "requirements", void 0);
                  __decorate([
                      aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.twoWay }),
                      __metadata("design:type", Function)
                  ], PasswordCustomElement.prototype, "passwordChanged", void 0);
                  PasswordCustomElement = __decorate([
                      aurelia_framework_1.inject(jsTools_1.JsTools),
                      aurelia_framework_1.customElement('abt-password'),
                      __metadata("design:paramtypes", [jsTools_1.JsTools])
                  ], PasswordCustomElement);
                  return PasswordCustomElement;
              }());
              exports_1("PasswordCustomElement", PasswordCustomElement);
          }
      };
  });
  