import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import isEqual from '../../../node_modules/lodash-es/isEqual.js';
import memoize from '../../../node_modules/lodash-es/memoize.js';
import 'core-js/modules/es.symbol.js';
import 'core-js/modules/es.array.concat.js';
import 'core-js/modules/es.array.filter.js';
import 'core-js/modules/es.array.find.js';
import 'core-js/modules/es.array.includes.js';
import 'core-js/modules/es.array.map.js';
import 'core-js/modules/es.array.sort.js';
import 'core-js/modules/es.function.name.js';
import 'core-js/modules/es.object.get-own-property-descriptor.js';
import 'core-js/modules/es.object.get-own-property-descriptors.js';
import 'core-js/modules/es.object.keys.js';
import 'core-js/modules/es.object.to-string.js';
import 'core-js/modules/es.string.includes.js';
import 'core-js/modules/web.dom-collections.for-each.js';
import { Tabs, TabList, Tab, TabPanels, TabPanel, FormItem, DatePicker, DatePickerInput, FilterableMultiSelect, ComboBox, TextInput, MultiSelect, Button } from '@carbon/react';
import React__default, { useState, useRef, useEffect, useCallback } from 'react';
import classnames from 'classnames';
import PropTypes from 'prop-types';
import { settings } from '../../../constants/Settings.js';
import FlyoutMenu, { FlyoutMenuDirection } from '../../FlyoutMenu/FlyoutMenu.js';
import { getMultiSelectItems, getMultiselectFilterValue, getAppliedFilterText, getFilterValue, handleEnterKeyDown, defaultFunction } from '../../../utils/componentUtilityFunctions.js';
import { Filter, Close } from '@carbon/icons-react';

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var iotPrefix = settings.iotPrefix,
  prefix = settings.prefix;
var itemToString = function itemToString(key) {
  return function (item) {
    var _item$key;
    return (_item$key = item === null || item === void 0 ? void 0 : item[key]) !== null && _item$key !== void 0 ? _item$key : '';
  };
};
var propTypes = {
  columns: PropTypes.arrayOf(PropTypes.shape({
    id: PropTypes.string,
    /** When false, no filter shows */
    isFilterable: PropTypes.bool,
    /** i18N text for translation */
    placeholderText: PropTypes.string,
    /** if options is empty array, assume text input for filter */
    options: PropTypes.arrayOf(PropTypes.shape({
      id: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]).isRequired,
      text: PropTypes.string.isRequired
    })),
    /** if dateOptions is empty array, assume a default format and locale */
    dateOptions: PropTypes.shape({
      dateFormat: PropTypes.string,
      locale: PropTypes.string
    }),
    /** if isMultiselect and isFilterable are true, the table is filtered based on a multiselect */
    isMultiselect: PropTypes.bool,
    /** if isDate and isFilterable are true, the table is filtered base on a date picker */
    isDate: PropTypes.bool
  })).isRequired,
  tableState: PropTypes.shape({
    ordering: PropTypes.arrayOf(PropTypes.shape({
      columnId: PropTypes.string.isRequired,
      /* Visibility of column in table, defaults to false */
      isHidden: PropTypes.bool
    })).isRequired,
    filters: PropTypes.arrayOf(PropTypes.shape({
      columnId: PropTypes.string.isRequired,
      value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool, PropTypes.object, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object]))]).isRequired
    })),
    advancedFilters: PropTypes.arrayOf(PropTypes.shape({
      /** Unique id for particular filter */
      filterId: PropTypes.string.isRequired,
      /** Text for main tilte of page */
      filterTitleText: PropTypes.string.isRequired
    })),
    advancedFilterFlyoutOpen: PropTypes.bool,
    selectedAdvancedFilterIds: PropTypes.arrayOf(PropTypes.string),
    isDisabled: PropTypes.bool
  }),
  actions: PropTypes.shape({
    onApplyAdvancedFilter: PropTypes.func,
    onCancelAdvancedFilter: PropTypes.func,
    onCreateAdvancedFilter: PropTypes.func,
    onChangeAdvancedFilter: PropTypes.func,
    onToggleAdvancedFilter: PropTypes.func
  }),
  i18n: PropTypes.shape({
    applyButtonText: PropTypes.string,
    cancelButtonText: PropTypes.string,
    advancedFilterLabelText: PropTypes.string,
    createNewAdvancedFilterText: PropTypes.string,
    advancedFilterPlaceholderText: PropTypes.string,
    simpleFiltersTabLabel: PropTypes.string,
    advancedFiltersTabLabel: PropTypes.string,
    clearAllFilters: PropTypes.string,
    filterAria: PropTypes.string,
    openMenuAria: PropTypes.string,
    closeMenuAria: PropTypes.string,
    clearSelectionAria: PropTypes.string,
    toolbarIconLabelText: PropTypes.string
  })
};
var reduceFilterState = function reduceFilterState(filters, selectedAdvancedFilterIds) {
  var simple = {};
  var advanced = {
    filterIds: []
  };
  if (Array.isArray(filters) && filters.length) {
    simple = filters.reduce(function (state, _ref) {
      var columnId = _ref.columnId,
        value = _ref.value;
      return _objectSpread(_objectSpread({}, state), {}, _defineProperty({}, columnId, value));
    }, {});
  }
  if (Array.isArray(selectedAdvancedFilterIds) && selectedAdvancedFilterIds.length) {
    advanced = {
      filterIds: selectedAdvancedFilterIds
    };
  }
  return {
    simple: simple,
    advanced: advanced
  };
};
var defaultProps = {
  tableState: {
    filters: [],
    advancedFilters: [],
    advancedFilterFlyoutOpen: false,
    selectedAdvancedFilterIds: [],
    isDisabled: false
  },
  actions: {
    onApplyAdvancedFilter: defaultFunction('on AdvancedFilter'),
    onCancelAdvancedFilter: defaultFunction('onCancelAdvancedFilter'),
    onCreateAdvancedFilter: defaultFunction('onCreateAdvancedFilter'),
    onChangeAdvancedFilter: defaultFunction('onChangeAdvancedFilter'),
    onToggleAdvancedFilter: defaultFunction('onToggleAdvancedFilter')
  },
  i18n: {
    applyButtonText: 'Apply filters',
    cancelButtonText: 'Cancel',
    advancedFilterLabelText: 'Select an existing filter or',
    createNewAdvancedFilterText: 'create a new advanced filter',
    advancedFilterPlaceholderText: 'Select a filter',
    simpleFiltersTabLabel: 'Simple filters',
    advancedFiltersTabLabel: 'Advanced filters',
    filterAria: 'Filter',
    openMenuAria: 'Open menu',
    closeMenuAria: 'Close menu',
    clearSelectionAria: 'Clear selection',
    clearFilterAria: 'Clear filter',
    toolbarIconLabelText: 'Toggle advanced filters'
  }
};
var TableToolbarAdvancedFilterFlyout = function TableToolbarAdvancedFilterFlyout(_ref2) {
  var columns = _ref2.columns,
    _ref2$tableState = _ref2.tableState,
    ordering = _ref2$tableState.ordering,
    filters = _ref2$tableState.filters,
    advancedFilters = _ref2$tableState.advancedFilters,
    advancedFilterFlyoutOpen = _ref2$tableState.advancedFilterFlyoutOpen,
    selectedAdvancedFilterIds = _ref2$tableState.selectedAdvancedFilterIds,
    isDisabled = _ref2$tableState.isDisabled,
    i18n = _ref2.i18n,
    _ref2$actions = _ref2.actions,
    onApplyAdvancedFilter = _ref2$actions.onApplyAdvancedFilter,
    onCancelAdvancedFilter = _ref2$actions.onCancelAdvancedFilter,
    onCreateAdvancedFilter = _ref2$actions.onCreateAdvancedFilter,
    onChangeAdvancedFilter = _ref2$actions.onChangeAdvancedFilter,
    onToggleAdvancedFilter = _ref2$actions.onToggleAdvancedFilter;
  var _defaultProps$i18n = _objectSpread(_objectSpread({}, defaultProps.i18n), i18n !== null && i18n !== void 0 ? i18n : {}),
    applyButtonText = _defaultProps$i18n.applyButtonText,
    cancelButtonText = _defaultProps$i18n.cancelButtonText,
    advancedFilterLabelText = _defaultProps$i18n.advancedFilterLabelText,
    createNewAdvancedFilterText = _defaultProps$i18n.createNewAdvancedFilterText,
    advancedFilterPlaceholderText = _defaultProps$i18n.advancedFilterPlaceholderText,
    simpleFiltersTabLabel = _defaultProps$i18n.simpleFiltersTabLabel,
    advancedFiltersTabLabel = _defaultProps$i18n.advancedFiltersTabLabel,
    filterAria = _defaultProps$i18n.filterAria,
    openMenuAria = _defaultProps$i18n.openMenuAria,
    closeMenuAria = _defaultProps$i18n.closeMenuAria,
    clearSelectionAria = _defaultProps$i18n.clearSelectionAria,
    clearFilterAria = _defaultProps$i18n.clearFilterAria,
    toolbarIconLabelText = _defaultProps$i18n.toolbarIconLabelText;
  var _useState = useState(reduceFilterState(filters, selectedAdvancedFilterIds)),
    _useState2 = _slicedToArray(_useState, 2),
    filterState = _useState2[0],
    setFilterState = _useState2[1];
  var previousFilters = useRef(null);
  useEffect(function () {
    if (!isEqual(previousFilters.current, {
      filters: filters,
      selectedAdvancedFilterIds: selectedAdvancedFilterIds
    })) {
      var newState = reduceFilterState(filters, selectedAdvancedFilterIds);
      if (!isEqual(newState, filterState)) {
        setFilterState(newState);
        onApplyAdvancedFilter(newState);
      }
    }
  }, [filterState, filters, onApplyAdvancedFilter, selectedAdvancedFilterIds]);
  useEffect(function () {
    previousFilters.current = {
      filters: filters,
      selectedAdvancedFilterIds: selectedAdvancedFilterIds
    };
  });
  var handleClearFilter = useCallback(function (event, _ref3) {
    var id = _ref3.id;
    setFilterState(function (prev) {
      return _objectSpread(_objectSpread({}, prev), {}, {
        simple: _objectSpread(_objectSpread({}, prev.simple), {}, _defineProperty({}, id, ''))
      });
    });
  }, []);
  var handleTranslation = useCallback(function (idToTranslate) {
    switch (idToTranslate) {
      default:
        return '';
      case 'clear.selection':
        return clearSelectionAria;
      case 'clear.all':
        return clearSelectionAria;
      case 'open.menu':
        return openMenuAria;
      case 'close.menu':
        return closeMenuAria;
    }
  }, [clearSelectionAria, closeMenuAria, openMenuAria]);
  return /*#__PURE__*/React__default.createElement(FlyoutMenu, {
    testId: "advanced-filter-flyout",
    iconDescription: toolbarIconLabelText,
    className: "".concat(iotPrefix, "--table-toolbar__advanced-filters-button-wrapper"),
    direction: FlyoutMenuDirection.BottomEnd,
    disabled: isDisabled,
    renderIcon: Filter,
    hideTooltip: false,
    light: true,
    isOpen: advancedFilterFlyoutOpen,
    onApply: function onApply() {
      onApplyAdvancedFilter(filterState);
    },
    onCancel: function onCancel() {
      setFilterState(reduceFilterState(filters, selectedAdvancedFilterIds));
      onCancelAdvancedFilter();
    },
    buttonProps: {
      size: 'lg',
      className: classnames("".concat(prefix, "--btn--icon-only"), "".concat(iotPrefix, "--tooltip-svg-wrapper"), "".concat(iotPrefix, "--table-toolbar__advanced-filters-button"), _defineProperty({}, "".concat(iotPrefix, "--table-toolbar-button-active"), advancedFilterFlyoutOpen)),
      onClick: onToggleAdvancedFilter,
      tooltipPosition: 'bottom'
    },
    i18n: {
      applyButtonText: applyButtonText,
      cancelButtonText: cancelButtonText
    }
  }, /*#__PURE__*/React__default.createElement(Tabs, {
    className: "".concat(iotPrefix, "--advanced-filter__tab-container")
  }, /*#__PURE__*/React__default.createElement(TabList, {
    "aria-label": "advanced-filter-flyout-tab"
  }, /*#__PURE__*/React__default.createElement(Tab, {
    title: simpleFiltersTabLabel
  }, simpleFiltersTabLabel), /*#__PURE__*/React__default.createElement(Tab, {
    title: advancedFiltersTabLabel
  }, advancedFiltersTabLabel)), /*#__PURE__*/React__default.createElement(TabPanels, null, /*#__PURE__*/React__default.createElement(TabPanel, null, ordering.filter(function (column) {
    var fullColumn = columns.find(function (item) {
      return column.columnId === item.id;
    });
    return !column.isHidden && (fullColumn === null || fullColumn === void 0 ? void 0 : fullColumn.isFilterable) === true;
  }).reduce(function (chunks, item, index) {
    var newChunks = _toConsumableArray(chunks);
    var chunkIndex = Math.floor(index / 2);
    if (!chunks[chunkIndex]) {
      newChunks[chunkIndex] = [];
    }
    newChunks[chunkIndex] = [].concat(_toConsumableArray(newChunks[chunkIndex]), [item]);
    return newChunks;
  }, []).map(function (aRow, rowIndex) {
    return /*#__PURE__*/React__default.createElement("div", {
      key: "simple-filter-row-".concat(rowIndex),
      className: "".concat(iotPrefix, "--filter-flyout__simple-row")
    }, aRow.map(function (aColumn, columnIndex) {
      var _filterState$simple2, _filterState$simple3;
      var column = columns.find(function (item) {
        return aColumn.columnId === item.id;
      });
      var columnFilterValue = filterState === null || filterState === void 0 ? void 0 : filterState.simple[column.id];
      var filterColumnOptions = function filterColumnOptions(options) {
        options.sort(function (a, b) {
          return a.text.localeCompare(b.text, {
            sensitivity: 'base'
          });
        });
        return options;
      };
      var memoizeColumnOptions = memoize(filterColumnOptions); // TODO: this memoize isn't really working, should refactor to a higher column level
      if (column.isDate) {
        var _column$dateOptions, _column$dateOptions2, _filterState$simple;
        return /*#__PURE__*/React__default.createElement(FormItem, {
          key: "simple-filter-item-".concat(rowIndex, "-").concat(columnIndex),
          className: "".concat(iotPrefix, "--filter-flyout__simple-field")
        }, /*#__PURE__*/React__default.createElement(DatePicker, {
          key: "datepicker-".concat(rowIndex, "-").concat(columnIndex, "-").concat(columnFilterValue),
          datePickerType: "single",
          locale: (column === null || column === void 0 || (_column$dateOptions = column.dateOptions) === null || _column$dateOptions === void 0 ? void 0 : _column$dateOptions.locale) || 'en',
          dateFormat: (column === null || column === void 0 || (_column$dateOptions2 = column.dateOptions) === null || _column$dateOptions2 === void 0 ? void 0 : _column$dateOptions2.dateFormat) || 'Y-m-d',
          id: "column-".concat(rowIndex, "-").concat(columnIndex),
          value: filterState === null || filterState === void 0 || (_filterState$simple = filterState.simple) === null || _filterState$simple === void 0 ? void 0 : _filterState$simple[column.id],
          onChange: function onChange(evt) {
            setFilterState(function (prev) {
              return _objectSpread(_objectSpread({}, prev), {}, {
                simple: _objectSpread(_objectSpread({}, prev.simple), {}, _defineProperty({}, column.id, evt[0]))
              });
            });
          }
        }, /*#__PURE__*/React__default.createElement(DatePickerInput, {
          className: "".concat(iotPrefix, "--lelele"),
          placeholder: column.placeholderText || 'enter a date',
          labelText: column.name,
          id: "column-".concat(rowIndex, "-").concat(columnIndex)
        })));
      }
      if (column.options) {
        if (column.isMultiselect) {
          return /*#__PURE__*/React__default.createElement(FilterableMultiSelect, {
            className: "".concat(iotPrefix, "--filter-flyout__simple-field"),
            key: "multiselect-".concat(rowIndex, "-").concat(columnIndex, "-").concat(columnFilterValue),
            id: "column-".concat(rowIndex, "-").concat(columnIndex),
            "aria-label": filterAria,
            placeholder: column.placeholderText || 'Choose an option',
            translateWithId: handleTranslation,
            items: memoizeColumnOptions(column.options),
            label: column.placeholderText || 'Choose an option',
            itemToString: itemToString('text'),
            titleText: column.name,
            initialSelectedItems: getMultiSelectItems(column, columnFilterValue),
            onChange: function onChange(evt) {
              var selectedItems = evt.selectedItems;
              setFilterState(function (prev) {
                return _objectSpread(_objectSpread({}, prev), {}, {
                  simple: _objectSpread(_objectSpread({}, prev.simple), {}, _defineProperty({}, column.id, selectedItems.map(getMultiselectFilterValue)))
                });
              });
            }
          });
        }
        return /*#__PURE__*/React__default.createElement(ComboBox, {
          className: "".concat(iotPrefix, "--filter-flyout__simple-field"),
          key: "combobox-".concat(rowIndex, "-").concat(columnIndex, "-").concat(columnFilterValue),
          id: "column-".concat(columnIndex),
          "aria-label": filterAria,
          translateWithId: handleTranslation,
          items: memoizeColumnOptions(column.options),
          itemToString: itemToString('text'),
          initialSelectedItem: {
            id: columnFilterValue,
            text: getAppliedFilterText(column, columnFilterValue)
          },
          placeholder: column.placeholderText || 'Choose an option',
          titleText: column.name,
          onChange: function onChange(evt) {
            var selectedItem = evt.selectedItem;
            setFilterState(function (prev) {
              return _objectSpread(_objectSpread({}, prev), {}, {
                simple: _objectSpread(_objectSpread({}, prev.simple), {}, _defineProperty({}, column.id, getFilterValue(selectedItem)))
              });
            });
          }
        });
      }
      return /*#__PURE__*/React__default.createElement(FormItem, {
        key: "simple-filter-item-".concat(rowIndex, "-").concat(columnIndex),
        className: "".concat(iotPrefix, "--filter-flyout__simple-field")
      }, /*#__PURE__*/React__default.createElement(TextInput, {
        id: column.id,
        labelText: column.name,
        placeholder: column.placeholderText || 'Type and hit enter to apply',
        title: (filterState === null || filterState === void 0 ? void 0 : filterState[column.id]) || column.placeholderText,
        onChange: function onChange(event) {
          var value = event.target.value;
          setFilterState(function (prev) {
            return _objectSpread(_objectSpread({}, prev), {}, {
              simple: _objectSpread(_objectSpread({}, prev.simple), {}, _defineProperty({}, column.id, value))
            });
          });
        },
        defaultValue: filterState === null || filterState === void 0 || (_filterState$simple2 = filterState.simple) === null || _filterState$simple2 === void 0 ? void 0 : _filterState$simple2[column.id]
      }), filterState !== null && filterState !== void 0 && (_filterState$simple3 = filterState.simple) !== null && _filterState$simple3 !== void 0 && _filterState$simple3[column.id] ? /*#__PURE__*/React__default.createElement("div", {
        role: "button",
        className: classnames("".concat(prefix, "--list-box__selection"), _defineProperty({}, "".concat(iotPrefix, "--clear-filters-button--disabled"), isDisabled)),
        tabIndex: isDisabled ? '-1' : '0',
        onClick: function onClick(event) {
          if (!isDisabled) {
            handleClearFilter(event, column);
          }
        },
        onKeyDown: function onKeyDown(event) {
          return handleEnterKeyDown(event, function () {
            if (!isDisabled) {
              handleClearFilter(event, column);
            }
          });
        },
        title: clearFilterAria
      }, /*#__PURE__*/React__default.createElement(Close, {
        description: clearFilterAria
      })) : null);
    }));
  })), /*#__PURE__*/React__default.createElement(TabPanel, null, /*#__PURE__*/React__default.createElement(MultiSelect, {
    id: "advanced-filter-multiselect",
    titleText: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, advancedFilterLabelText, ' ', /*#__PURE__*/React__default.createElement(Button, {
      className: "".concat(iotPrefix, "--advanced-filter__inline-button"),
      kind: "ghost",
      onClick: onCreateAdvancedFilter
    }, createNewAdvancedFilterText)),
    onChange: function onChange(e) {
      onChangeAdvancedFilter(e);
      setFilterState(function (prev) {
        var _e$selectedItems$map, _e$selectedItems;
        return _objectSpread(_objectSpread({}, prev), {}, {
          advanced: {
            filterIds: (_e$selectedItems$map = (_e$selectedItems = e.selectedItems) === null || _e$selectedItems === void 0 ? void 0 : _e$selectedItems.map(function (advFilter) {
              return advFilter.filterId;
            })) !== null && _e$selectedItems$map !== void 0 ? _e$selectedItems$map : []
          }
        });
      });
    },
    itemToString: itemToString('filterTitleText'),
    items: advancedFilters !== null && advancedFilters !== void 0 ? advancedFilters : [],
    initialSelectedItems: advancedFilters === null || advancedFilters === void 0 ? void 0 : advancedFilters.filter(function (advFilter) {
      return selectedAdvancedFilterIds.includes(advFilter.filterId);
    }),
    label: advancedFilterPlaceholderText
  })))));
};
TableToolbarAdvancedFilterFlyout.propTypes = propTypes;
TableToolbarAdvancedFilterFlyout.defaultProps = defaultProps;
TableToolbarAdvancedFilterFlyout.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "TableToolbarAdvancedFilterFlyout",
  "props": {
    "tableState": {
      "defaultValue": {
        "value": "{\n  filters: [],\n  advancedFilters: [],\n  advancedFilterFlyoutOpen: false,\n  selectedAdvancedFilterIds: [],\n  isDisabled: false,\n}",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "shape",
        "value": {
          "ordering": {
            "name": "arrayOf",
            "value": {
              "name": "shape",
              "value": {
                "columnId": {
                  "name": "string",
                  "required": true
                },
                "isHidden": {
                  "name": "bool",
                  "required": false
                }
              }
            },
            "required": true
          },
          "filters": {
            "name": "arrayOf",
            "value": {
              "name": "shape",
              "value": {
                "columnId": {
                  "name": "string",
                  "required": true
                },
                "value": {
                  "name": "union",
                  "value": [{
                    "name": "string"
                  }, {
                    "name": "number"
                  }, {
                    "name": "bool"
                  }, {
                    "name": "object"
                  }, {
                    "name": "arrayOf",
                    "value": {
                      "name": "union",
                      "value": [{
                        "name": "string"
                      }, {
                        "name": "object"
                      }]
                    }
                  }],
                  "required": true
                }
              }
            },
            "required": false
          },
          "advancedFilters": {
            "name": "arrayOf",
            "value": {
              "name": "shape",
              "value": {
                "filterId": {
                  "name": "string",
                  "description": "Unique id for particular filter",
                  "required": true
                },
                "filterTitleText": {
                  "name": "string",
                  "description": "Text for main tilte of page",
                  "required": true
                }
              }
            },
            "required": false
          },
          "advancedFilterFlyoutOpen": {
            "name": "bool",
            "required": false
          },
          "selectedAdvancedFilterIds": {
            "name": "arrayOf",
            "value": {
              "name": "string"
            },
            "required": false
          },
          "isDisabled": {
            "name": "bool",
            "required": false
          }
        }
      },
      "required": false
    },
    "actions": {
      "defaultValue": {
        "value": "{\n  onApplyAdvancedFilter: defaultFunction('on AdvancedFilter'),\n  onCancelAdvancedFilter: defaultFunction('onCancelAdvancedFilter'),\n  onCreateAdvancedFilter: defaultFunction('onCreateAdvancedFilter'),\n  onChangeAdvancedFilter: defaultFunction('onChangeAdvancedFilter'),\n  onToggleAdvancedFilter: defaultFunction('onToggleAdvancedFilter'),\n}",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "shape",
        "value": {
          "onApplyAdvancedFilter": {
            "name": "func",
            "required": false
          },
          "onCancelAdvancedFilter": {
            "name": "func",
            "required": false
          },
          "onCreateAdvancedFilter": {
            "name": "func",
            "required": false
          },
          "onChangeAdvancedFilter": {
            "name": "func",
            "required": false
          },
          "onToggleAdvancedFilter": {
            "name": "func",
            "required": false
          }
        }
      },
      "required": false
    },
    "i18n": {
      "defaultValue": {
        "value": "{\n  applyButtonText: 'Apply filters',\n  cancelButtonText: 'Cancel',\n  advancedFilterLabelText: 'Select an existing filter or',\n  createNewAdvancedFilterText: 'create a new advanced filter',\n  advancedFilterPlaceholderText: 'Select a filter',\n  simpleFiltersTabLabel: 'Simple filters',\n  advancedFiltersTabLabel: 'Advanced filters',\n  filterAria: 'Filter',\n  openMenuAria: 'Open menu',\n  closeMenuAria: 'Close menu',\n  clearSelectionAria: 'Clear selection',\n  clearFilterAria: 'Clear filter',\n  toolbarIconLabelText: 'Toggle advanced filters',\n}",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "shape",
        "value": {
          "applyButtonText": {
            "name": "string",
            "required": false
          },
          "cancelButtonText": {
            "name": "string",
            "required": false
          },
          "advancedFilterLabelText": {
            "name": "string",
            "required": false
          },
          "createNewAdvancedFilterText": {
            "name": "string",
            "required": false
          },
          "advancedFilterPlaceholderText": {
            "name": "string",
            "required": false
          },
          "simpleFiltersTabLabel": {
            "name": "string",
            "required": false
          },
          "advancedFiltersTabLabel": {
            "name": "string",
            "required": false
          },
          "clearAllFilters": {
            "name": "string",
            "required": false
          },
          "filterAria": {
            "name": "string",
            "required": false
          },
          "openMenuAria": {
            "name": "string",
            "required": false
          },
          "closeMenuAria": {
            "name": "string",
            "required": false
          },
          "clearSelectionAria": {
            "name": "string",
            "required": false
          },
          "toolbarIconLabelText": {
            "name": "string",
            "required": false
          }
        }
      },
      "required": false
    },
    "columns": {
      "description": "",
      "type": {
        "name": "arrayOf",
        "value": {
          "name": "shape",
          "value": {
            "id": {
              "name": "string",
              "required": false
            },
            "isFilterable": {
              "name": "bool",
              "description": "When false, no filter shows",
              "required": false
            },
            "placeholderText": {
              "name": "string",
              "description": "i18N text for translation",
              "required": false
            },
            "options": {
              "name": "arrayOf",
              "value": {
                "name": "shape",
                "value": {
                  "id": {
                    "name": "union",
                    "value": [{
                      "name": "string"
                    }, {
                      "name": "number"
                    }, {
                      "name": "bool"
                    }],
                    "required": true
                  },
                  "text": {
                    "name": "string",
                    "required": true
                  }
                }
              },
              "description": "if options is empty array, assume text input for filter",
              "required": false
            },
            "dateOptions": {
              "name": "shape",
              "value": {
                "dateFormat": {
                  "name": "string",
                  "required": false
                },
                "locale": {
                  "name": "string",
                  "required": false
                }
              },
              "description": "if dateOptions is empty array, assume a default format and locale",
              "required": false
            },
            "isMultiselect": {
              "name": "bool",
              "description": "if isMultiselect and isFilterable are true, the table is filtered based on a multiselect",
              "required": false
            },
            "isDate": {
              "name": "bool",
              "description": "if isDate and isFilterable are true, the table is filtered base on a date picker",
              "required": false
            }
          }
        }
      },
      "required": true
    }
  }
};
var TableToolbarAdvancedFilterFlyout$1 = TableToolbarAdvancedFilterFlyout;

export { TableToolbarAdvancedFilterFlyout$1 as default };
