// Generated by CoffeeScript 1.12.7
var CustomDataTypeHtmlEditorCSVImporterDestinationField,
  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  hasProp = {}.hasOwnProperty;

CustomDataTypeHtmlEditorCSVImporterDestinationField = (function(superClass) {
  extend(CustomDataTypeHtmlEditorCSVImporterDestinationField, superClass);

  function CustomDataTypeHtmlEditorCSVImporterDestinationField() {
    return CustomDataTypeHtmlEditorCSVImporterDestinationField.__super__.constructor.apply(this, arguments);
  }

  CustomDataTypeHtmlEditorCSVImporterDestinationField.prototype.initOpts = function() {
    CustomDataTypeHtmlEditorCSVImporterDestinationField.__super__.initOpts.call(this);
    return this.mergeOpt("field", {
      check: CustomDataTypeHtmlEditor
    });
  };

  CustomDataTypeHtmlEditorCSVImporterDestinationField.prototype.formatValues = function(values) {
    var _data, data, i, len, value;
    data = [];
    for (i = 0, len = values.length; i < len; i++) {
      value = values[i];
      try {
        _data = JSON.parse(value);
        if (CUI.util.isPlainObject(_data)) {
          data.push(_data);
          continue;
        }
      } catch (error) {}
      if (!CUI.isString(value)) {
        continue;
      }
      data.push(CustomDataTypeHtmlEditor.buildData(value));
    }
    if (data.length === 0) {
      return void 0;
    } else if (data.length === 1) {
      return data[0];
    } else {
      return data;
    }
  };

  return CustomDataTypeHtmlEditorCSVImporterDestinationField;

})(CustomDataTypeColumnCSVImporterDestinationField);
