define('@cardstack/identitymind/components/kyc-field', ['exports', 'ember-i18n-iso-countries'], function (exports, _emberI18nIsoCountries) {
  'use strict';

  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.default = Ember.Component.extend({
    classNames: ['kyc-field'],
    classNameBindings: ['showErrorClass:has-error', 'isValid:has-success'],
    model: null,
    value: null,
    type: 'text',
    field: '',
    validation: null,
    showValidations: false,
    didValidate: false,
    countries: (0, _emberI18nIsoCountries.getNames)('en'),

    notValidating: Ember.computed.not('validation.isValidating').readOnly(),
    hasContent: Ember.computed.notEmpty('value').readOnly(),
    hasWarnings: Ember.computed.notEmpty('validation.warnings').readOnly(),
    isValid: Ember.computed.and('hasContent', 'validation.isTruelyValid').readOnly(),
    shouldDisplayValidations: Ember.computed.or('showValidations', 'didValidate', 'hasContent').readOnly(),

    showErrorClass: Ember.computed.and('notValidating', 'showErrorMessage', 'validation').readOnly(),
    showErrorMessage: Ember.computed.and('shouldDisplayValidations', 'validation.isInvalid').readOnly(),
    showWarningMessage: Ember.computed.and('shouldDisplayValidations', 'hasWarnings', 'isValid').readOnly(),

    init: function init() {
      this._super.apply(this, arguments);
      var field = this.get('field');

      Ember.defineProperty(this, 'validation', Ember.computed.readOnly('model.validations.attrs.' + field));
      Ember.defineProperty(this, 'value', Ember.computed.alias('model.' + field));
    },
    focusOut: function focusOut() {
      this._super.apply(this, arguments);
      this.set('showValidations', true);
    }
  });
});