/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = "./src/table/index.js");
/******/ })
/************************************************************************/
/******/ ({

/***/ "./src/table/backend/index.js":
/*!************************************!*\
  !*** ./src/table/backend/index.js ***!
  \************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return BackendProfileField; });\n/* harmony import */ var _components_field__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/field */ \"./src/table/components/field.js\");\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nvar _wp$element = wp.element,\n    createElement = _wp$element.createElement,\n    render = _wp$element.render,\n    Fragment = _wp$element.Fragment,\n    useState = _wp$element.useState,\n    useEffect = _wp$element.useEffect;\n\nfunction BackendProfileField(props) {\n  var _useState = useState(props.fields),\n      _useState2 = _slicedToArray(_useState, 2),\n      fields = _useState2[0],\n      setFields = _useState2[1];\n\n  var addRowColumn = function addRowColumn(type) {\n    var nfields = _objectSpread({}, fields);\n\n    nfields[type].push({\n      name: '',\n      id: Math.random()\n    });\n    setFields(nfields);\n  };\n\n  var generateFields = function generateFields() {\n    var columns = [];\n\n    var _loop = function _loop(rowIndex) {\n      columns.push(wp.element.createElement(\"tr\", null, function () {\n        var rows = [];\n\n        var _loop2 = function _loop2(columnIndex) {\n          if (columnIndex === 0) {\n            if (rowIndex === 0) {\n              rows.push(wp.element.createElement(\"th\", null));\n            } else {\n              var currentrow = fields.rows[rowIndex - 1];\n              rows.push(wp.element.createElement(\"th\", {\n                className: \"removable_item\"\n              }, wp.element.createElement(\"span\", {\n                className: \"dashicons dashicons-no\",\n                onClick: function onClick() {\n                  var nfields = _objectSpread({}, fields);\n\n                  nfields.rows.splice(rowIndex - 1, 1);\n                  setFields(nfields);\n                }\n              }), wp.element.createElement(\"input\", {\n                type: \"text\",\n                value: currentrow.name,\n                onChange: function onChange(e) {\n                  var nfields = _objectSpread({}, fields);\n\n                  nfields.rows[rowIndex - 1]['name'] = e.target.value;\n                  setFields(nfields);\n                },\n                placeholder: window.vibebp_profile_field_table.translations.enter_row_name\n              })));\n            }\n          } else {\n            if (rowIndex === 0) {\n              var currentcolumn = fields.columns[columnIndex - 1];\n              rows.push(wp.element.createElement(\"th\", {\n                className: \"removable_item\"\n              }, wp.element.createElement(\"span\", {\n                className: \"dashicons dashicons-no\",\n                onClick: function onClick() {\n                  var nfields = _objectSpread({}, fields);\n\n                  nfields.columns.splice(columnIndex - 1, 1);\n                  setFields(nfields);\n                }\n              }), wp.element.createElement(\"input\", {\n                type: \"text\",\n                value: currentcolumn.name,\n                onChange: function onChange(e) {\n                  var nfields = _objectSpread({}, fields);\n\n                  nfields.columns[columnIndex - 1]['name'] = e.target.value;\n                  setFields(nfields);\n                },\n                placeholder: window.vibebp_profile_field_table.translations.enter_column_name\n              })));\n            } else {\n              var ids = {\n                row: fields.rows[rowIndex - 1].id,\n                column: fields.columns[columnIndex - 1].id\n              };\n\n              var value = _objectSpread(_objectSpread({}, ids), {}, {\n                type: \"text\"\n              });\n\n              if (fields.values) {\n                var i = fields.values.findIndex(function (v) {\n                  return v.row == ids.row && v.column == ids.column;\n                });\n\n                if (i > -1 && fields.values[i].row && fields.values[i].column) {\n                  value = fields.values[i];\n                }\n              }\n\n              rows.push(wp.element.createElement(\"td\", null, wp.element.createElement(\"div\", null, wp.element.createElement(_components_field__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n                ids: ids,\n                value: value,\n                onChange: function onChange(updatedFieldDetails) {\n                  setFields(function (previous) {\n                    var nfields = _objectSpread({}, previous);\n\n                    var arr = _toConsumableArray(nfields.values);\n\n                    var i = fields.values.findIndex(function (v) {\n                      return v.row == ids.row && v.column == ids.column;\n                    });\n\n                    if (i > -1) {\n                      arr.splice(i, 1, updatedFieldDetails);\n                    } else {\n                      arr.push(updatedFieldDetails);\n                    }\n\n                    nfields.values = _toConsumableArray(arr);\n                    return nfields;\n                  });\n                }\n              }))));\n            }\n          }\n        };\n\n        for (var columnIndex = 0; columnIndex <= fields.columns.length; columnIndex++) {\n          _loop2(columnIndex);\n        }\n\n        return rows;\n      }()));\n    };\n\n    for (var rowIndex = 0; rowIndex <= fields.rows.length; rowIndex++) {\n      _loop(rowIndex);\n    }\n\n    return columns;\n  };\n\n  return wp.element.createElement(\"div\", {\n    className: \"backend_profile_field\"\n  }, wp.element.createElement(\"div\", {\n    className: \"_profile_field_header\"\n  }, wp.element.createElement(\"a\", {\n    className: \"button-primary\",\n    onClick: function onClick() {\n      return addRowColumn('rows');\n    }\n  }, window.vibebp_profile_field_table.translations.add_row), wp.element.createElement(\"a\", {\n    className: \"button-primary\",\n    onClick: function onClick() {\n      return addRowColumn('columns');\n    }\n  }, window.vibebp_profile_field_table.translations.add_column)), wp.element.createElement(\"div\", {\n    className: \"_profile_field_body\"\n  }, wp.element.createElement(\"input\", {\n    type: \"text\",\n    id: props.field_id,\n    name: props.field_id,\n    value: JSON.stringify(fields),\n    style: {\n      display: 'none'\n    }\n  }), fields ? wp.element.createElement(\"div\", {\n    className: \"vibebpProfile_table_wrapper\"\n  }, wp.element.createElement(\"table\", {\n    className: \"vibebpProfile_table\"\n  }, fields.hasOwnProperty('columns') && fields.columns && fields.columns.length && fields.hasOwnProperty('rows') && fields.rows && fields.rows.length ? generateFields() : '')) : ''));\n}\n\n//# sourceURL=webpack:///./src/table/backend/index.js?");

/***/ }),

/***/ "./src/table/components/field.js":
/*!***************************************!*\
  !*** ./src/table/components/field.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Field; });\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nvar _wp$element = wp.element,\n    createElement = _wp$element.createElement,\n    render = _wp$element.render,\n    Fragment = _wp$element.Fragment,\n    useState = _wp$element.useState,\n    useEffect = _wp$element.useEffect;\nfunction Field(props) {\n  var _useState = useState(props.value && props.value.row && props.value.column ? _objectSpread({}, props.value) : _objectSpread(_objectSpread({}, props.ids), {}, {\n    type: \"text\"\n  })),\n      _useState2 = _slicedToArray(_useState, 2),\n      value = _useState2[0],\n      setValue = _useState2[1];\n\n  var _useState3 = useState(false),\n      _useState4 = _slicedToArray(_useState3, 2),\n      isActive = _useState4[0],\n      setIsActive = _useState4[1];\n\n  useEffect(function () {\n    props.onChange(value);\n  }, [value]);\n  return wp.element.createElement(\"div\", {\n    className: \"profile_field_fields_element\"\n  }, isActive ? wp.element.createElement(\"div\", {\n    className: value.type\n  }, wp.element.createElement(\"div\", {\n    className: \"field_settings\"\n  }, wp.element.createElement(\"select\", {\n    value: value.type,\n    onChange: function onChange(e) {\n      e.persist();\n      setValue(function (previous) {\n        var newValue = _objectSpread({}, previous);\n\n        newValue.type = e.target.value;\n        return newValue;\n      });\n    }\n  }, window.vibebp_profile_field_table.settings.types ? wp.element.createElement(Fragment, null, Object.keys(window.vibebp_profile_field_table.settings.types).map(function (key) {\n    var type = window.vibebp_profile_field_table.settings.types[key];\n    return wp.element.createElement(\"option\", {\n      value: key\n    }, type.name);\n  })) : ''), value.type && (value.type === \"checkbox\" || value.type === \"option\") ? wp.element.createElement(\"a\", {\n    className: \"button is-primary\",\n    onClick: function onClick() {\n      return setValue(function (previous) {\n        var newValue = _objectSpread({}, previous);\n\n        if (!(newValue.options && Array.isArray(newValue.options))) {\n          newValue.options = [];\n        }\n\n        newValue.options.push({});\n        return newValue;\n      });\n    }\n  }, window.vibebp_profile_field_table.translations.create_options) : ''), wp.element.createElement(\"div\", {\n    className: \"field_options\"\n  }, value.options && value.options.map(function (option, optionIndex) {\n    return wp.element.createElement(\"span\", {\n      className: \"field_option\"\n    }, wp.element.createElement(\"div\", null, wp.element.createElement(\"input\", {\n      type: \"text\",\n      placeholder: window.vibebp_profile_field_table.translations.enter_lable,\n      value: option.lable,\n      onChange: function onChange(e) {\n        return setValue(function (previous) {\n          e.persist();\n\n          var newValue = _objectSpread({}, previous);\n\n          newValue.options[optionIndex].lable = e.target.value;\n          return newValue;\n        });\n      }\n    }), wp.element.createElement(\"input\", {\n      type: \"text\",\n      placeholder: window.vibebp_profile_field_table.translations.enter_value,\n      value: option.value,\n      onChange: function onChange(e) {\n        return setValue(function (previous) {\n          e.persist();\n\n          var newValue = _objectSpread({}, previous);\n\n          newValue.options[optionIndex].value = e.target.value;\n          return newValue;\n        });\n      }\n    })), wp.element.createElement(\"span\", {\n      style: {\n        cursor: 'pointer'\n      },\n      onClick: function onClick(e) {\n        return setValue(function (previous) {\n          e.persist();\n\n          var newValue = _objectSpread({}, previous);\n\n          newValue.options.splice(optionIndex, 1);\n          return newValue;\n        });\n      }\n    }, \"x\"));\n  }))) : wp.element.createElement(\"div\", {\n    className: value.type\n  }, value.type && window.vibebp_profile_field_table.settings.types && window.vibebp_profile_field_table.settings.types[value.type] ? wp.element.createElement(\"span\", null, window.vibebp_profile_field_table.settings.types[value.type].name) : ''), wp.element.createElement(\"span\", {\n    className: isActive ? 'dashicons dashicons-no' : 'dashicons dashicons-edit',\n    onClick: function onClick() {\n      return setIsActive(!isActive);\n    }\n  }));\n}\n\n//# sourceURL=webpack:///./src/table/components/field.js?");

/***/ }),

/***/ "./src/table/frontend/index.js":
/*!*************************************!*\
  !*** ./src/table/frontend/index.js ***!
  \*************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return FrontendProfileField; });\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nvar _wp$element = wp.element,\n    createElement = _wp$element.createElement,\n    render = _wp$element.render,\n    Fragment = _wp$element.Fragment,\n    useState = _wp$element.useState,\n    useEffect = _wp$element.useEffect;\nfunction FrontendProfileField(props) {\n  var _useState = useState(props.fields),\n      _useState2 = _slicedToArray(_useState, 2),\n      fields = _useState2[0],\n      setFields = _useState2[1];\n\n  var addRowColumn = function addRowColumn(type) {\n    var nfields = _objectSpread({}, fields);\n\n    nfields[type].push({\n      name: '',\n      id: Math.random()\n    });\n    setFields(nfields);\n  };\n\n  var generateFields = function generateFields() {\n    var columns = [];\n\n    var _loop = function _loop(rowIndex) {\n      columns.push(wp.element.createElement(\"tr\", null, function () {\n        var rows = [];\n\n        var _loop2 = function _loop2(columnIndex) {\n          if (columnIndex === 0) {\n            if (rowIndex === 0) {\n              rows.push(wp.element.createElement(\"th\", null));\n            } else {\n              var currentrow = fields.rows[rowIndex - 1];\n              rows.push(wp.element.createElement(\"th\", {\n                className: \"removable_item\"\n              }, wp.element.createElement(\"span\", {\n                onClick: function onClick() {\n                  var nfields = _objectSpread({}, fields);\n\n                  nfields.rows.splice(rowIndex - 1, 1);\n                  setFields(nfields);\n                },\n                className: \"vicon vicon-x\"\n              }), wp.element.createElement(\"input\", {\n                type: \"text\",\n                value: currentrow.name,\n                onChange: function onChange(e) {\n                  var nfields = _objectSpread({}, fields);\n\n                  nfields.rows[rowIndex - 1]['name'] = e.target.value;\n                  setFields(nfields);\n                },\n                placeholder: window.vibebp_profile_field_table.translations.enter_row_name\n              })));\n            }\n          } else {\n            if (rowIndex === 0) {\n              var currentcolumn = fields.columns[columnIndex - 1];\n              rows.push(wp.element.createElement(\"th\", {\n                className: \"removable_item\"\n              }, wp.element.createElement(\"span\", {\n                onClick: function onClick() {\n                  var nfields = _objectSpread({}, fields);\n\n                  nfields.columns.splice(columnIndex - 1, 1);\n                  setFields(nfields);\n                }\n              }, \"x\"), wp.element.createElement(\"input\", {\n                type: \"text\",\n                value: currentcolumn.name,\n                onChange: function onChange(e) {\n                  var nfields = _objectSpread({}, fields);\n\n                  nfields.columns[columnIndex - 1]['name'] = e.target.value;\n                  setFields(nfields);\n                },\n                placeholder: window.vibebp_profile_field_table.translations.enter_column_name\n              })));\n            } else {\n              var ids = {\n                row: fields.rows[rowIndex - 1].id,\n                column: fields.columns[columnIndex - 1].id\n              };\n              console.log(ids);\n              rows.push(wp.element.createElement(\"td\", null, wp.element.createElement(\"div\", null, \"User Field\")));\n            }\n          }\n        };\n\n        for (var columnIndex = 0; columnIndex <= fields.columns.length; columnIndex++) {\n          _loop2(columnIndex);\n        }\n\n        return rows;\n      }()));\n    };\n\n    for (var rowIndex = 0; rowIndex <= fields.rows.length; rowIndex++) {\n      _loop(rowIndex);\n    }\n\n    return columns;\n  };\n\n  return wp.element.createElement(\"div\", {\n    className: \"frontend_profile_field\"\n  }, wp.element.createElement(\"div\", {\n    className: \"_profile_field_header\"\n  }, wp.element.createElement(\"a\", {\n    onClick: function onClick() {\n      return addRowColumn('rows');\n    }\n  }, window.vibebp_profile_field_table.translations.add_row), wp.element.createElement(\"a\", {\n    onClick: function onClick() {\n      return addRowColumn('columns');\n    }\n  }, window.vibebp_profile_field_table.translations.add_column)), wp.element.createElement(\"div\", {\n    className: \"_profile_field_body\"\n  }, wp.element.createElement(\"input\", {\n    type: \"text\",\n    id: props.field_id,\n    value: JSON.stringify(fields),\n    style: {\n      display: 'none'\n    }\n  }), fields ? wp.element.createElement(\"table\", {\n    className: \"vibebpProfile_table\"\n  }, fields.hasOwnProperty('columns') && fields.columns && fields.columns.length && fields.hasOwnProperty('rows') && fields.rows && fields.rows.length ? generateFields() : '') : ''));\n}\n\n//# sourceURL=webpack:///./src/table/frontend/index.js?");

/***/ }),

/***/ "./src/table/index.js":
/*!****************************!*\
  !*** ./src/table/index.js ***!
  \****************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _backend__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./backend */ \"./src/table/backend/index.js\");\n/* harmony import */ var _frontend__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./frontend */ \"./src/table/frontend/index.js\");\nvar _wp$element = wp.element,\n    createElement = _wp$element.createElement,\n    render = _wp$element.render,\n    Fragment = _wp$element.Fragment,\n    useState = _wp$element.useState; //import '../../_sass/table.scss';\n\n\n\ndocument.addEventListener(\"profile_field_type_table_backend\", function (e) {\n  // console.log(e);\n  var element = document.querySelector('.profile_field_type_table_backend');\n\n  if (element && e.detail && e.detail.hasOwnProperty('fields') && e.detail.hasOwnProperty('field_id')) {\n    render(wp.element.createElement(_backend__WEBPACK_IMPORTED_MODULE_0__[\"default\"], e.detail), element);\n  }\n}, false);\ndocument.addEventListener(\"profile_field_type_table_frontend\", function (e) {\n  var element = document.querySelector('.profile_field_type_table_frontend');\n\n  if (element) {\n    render(wp.element.createElement(_frontend__WEBPACK_IMPORTED_MODULE_1__[\"default\"], null), element);\n  }\n}, false);\n\n//# sourceURL=webpack:///./src/table/index.js?");

/***/ })

/******/ });