(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";

Vue.component('wpcfto_multi_input', {
    props: ['fields', 'field_label', 'field_name', 'field_id', 'field_value', 'field_options'],
    data: function data() {
      return {
        inputs: []
      };
    },
    template: "\n        <div class=\"wpcfto_generic_field wpcfto_generic_field_multi_input\" v-bind:class=\"field_id\">\n\n            <wpcfto_fields_aside_before :fields=\"fields\" :field_label=\"field_label\"></wpcfto_fields_aside_before>\n\t\t\t\n\t\t\t<div class=\"wpcfto-field-content\">\n\t\t\t\t<div class=\"wpcfto_sorter\">\n\t\n\t\t\t\t\t<draggable class=\"list-group\"\n\t\t\t\t\t\t\t   :list=\"inputs\"\n\t\t\t\t\t\t\t   group=\"inputs\">\n\t\n\t\t\t\t\t\t<div class=\"wpcfto_generic_field wpcfto_generic_field_flex_input wpcfto_generic_field__text\"\n\t\t\t\t\t\t\t v-for=\"(input, input_key) in inputs\"\n\t\t\t\t\t\t\t :key=\"input['key']\">\n\t\n\t\t\t\t\t\t  <div class=\"wpcfto_multi_input_label\">{{input['label']}}</div>\n\t\n\t\t\t\t\t\t  <input type=\"text\" v-model=\"input['value']\" v-bind:placeholder=\"input['label']\" />\n\t\n\t\t\t\t\t\t  <span class=\"wpcfto_multi_input_icon\"><i class=\"fa fa-arrows-alt\"></i></span>\n\t\n\t\t\t\t\t\t</div>\n\t\n\t\t\t\t\t </draggable>\n\t\n\t\t\t\t </div>\n\t\t\t </div>\n\n\t\t\t <wpcfto_fields_aside_after :fields=\"fields\"></wpcfto_fields_aside_after>\n\n        </div>\n    ",
    mounted: function mounted() {
      var _this = this;
  
      if (typeof _this.field_value === 'string' && WpcftoIsJsonString(_this.field_value)) _this.field_value = JSON.parse(_this.field_value);
      if (!_this.field_value.length) _this.field_value = {};
      /*Get sorted items*/
  
      Object.keys(_this.field_value).forEach(function (key) {
        var stored_item = _this.field_value[key];
  
        var config_item = _this.field_options.find(function (x) {
          return x.key === stored_item['key'];
        });
  
        if (typeof config_item === 'undefined') return false;
  
        _this.inputs.push({
          key: stored_item['key'],
          value: stored_item['value'],
          label: config_item['label']
        });
      });
      /*Add new items from config*/
  
      _this.field_options.forEach(function (config_item) {
        var stored_item = _this.inputs.find(function (x) {
          return x.key === config_item['key'];
        });
  
        if (stored_item) return false;
  
        _this.inputs.push(config_item);
      });
    },
    methods: {},
    watch: {
      inputs: {
        deep: true,
        handler: function handler(inputs) {
          var inputs_value = [];
          inputs.forEach(function (item) {
            inputs_value.push({
              key: item.key,
              value: item.value
            });
          });
          this.$emit('wpcfto-get-value', inputs_value);
        }
      }
    }
  });
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 7044 characters]
},{}]},{},[1])