define('@cardstack/core-types/components/field-editors/integer-editor', ['exports', '@cardstack/core-types/templates/components/field-editors/integer-editor'], function (exports, _integerEditor) {
  'use strict';

  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.default = Ember.Component.extend({
    layout: _integerEditor.default,
    invalid: false,
    refresh: 1,
    actions: {
      update: function update(value) {
        var content = this.get('content');
        var field = this.get('field');
        if (value == null || value === '') {
          content.set(field, null);
          this.set('invalid', false);
        } else {
          value = String(value).trim();
          if (/^\d+$/.test(value)) {
            var number = parseFloat(value);
            if (number >= 0) {
              number = parseFloat(number.toFixed(2));
              content.set(field, number);
              this.set('invalid', false);
              return;
            }
          }
          this.set('invalid', true);
        }
      },
      normalize: function normalize() {
        // TODO
      }
    }
  });
});