"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _toConsumableArray2=require("babel-runtime/helpers/toConsumableArray"),_toConsumableArray3=_interopRequireDefault(_toConsumableArray2),_extends2=require("babel-runtime/helpers/extends"),_extends3=_interopRequireDefault(_extends2);exports.flatArray=flatArray,exports.treeMap=treeMap,exports.flatFilter=flatFilter,exports.normalizeColumns=normalizeColumns;var _react=require("react"),React=_interopRequireWildcard(_react);function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function flatArray(){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"children",a=[];return function t(e){e.forEach(function(e){if(e[n]){var r=(0,_extends3.default)({},e);delete r[n],a.push(r),0<e[n].length&&t(e[n])}else a.push(e)})}(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]),a}function treeMap(e,n){var a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"children";return e.map(function(e,r){var t={};return e[a]&&(t[a]=treeMap(e[a],n,a)),(0,_extends3.default)({},n(e,r),t)})}function flatFilter(e,n){return e.reduce(function(e,r){if(n(r)&&e.push(r),r.children){var t=flatFilter(r.children,n);e.push.apply(e,(0,_toConsumableArray3.default)(t))}return e},[])}function normalizeColumns(e){var t=[];return React.Children.forEach(e,function(e){if(React.isValidElement(e)){var r=(0,_extends3.default)({},e.props);e.key&&(r.key=e.key),e.type&&e.type.__ANT_TABLE_COLUMN_GROUP&&(r.children=normalizeColumns(r.children)),t.push(r)}}),t}