function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _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."); }

function _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); }

function _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; }

function _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; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

import React, { useState } from 'react';
import Modal from "antd/es/modal";
import Tabs from "antd/es/tabs";
import { DownOutlined, UpOutlined, LeftOutlined, RightOutlined, ArrowUpOutlined, ArrowDownOutlined, ArrowLeftOutlined, ArrowRightOutlined, QuestionCircleOutlined, InfoCircleOutlined, ExclamationCircleOutlined, CloseOutlined, CheckOutlined, PlusOutlined, MinusOutlined, EditOutlined, FormOutlined, CopyOutlined, DeleteOutlined, SearchOutlined, FileOutlined, FilterOutlined, FolderOutlined, FolderOpenOutlined, DownloadOutlined, UploadOutlined, FileSearchOutlined, UserOutlined, StepBackwardOutlined, StepForwardOutlined, FastBackwardOutlined, FastForwardOutlined, ShrinkOutlined, ArrowsAltOutlined, CaretUpOutlined, CaretDownOutlined, CaretLeftOutlined, CaretRightOutlined, DoubleRightOutlined, DoubleLeftOutlined, RollbackOutlined, RetweetOutlined, SwapOutlined, PlayCircleOutlined, LoginOutlined, LogoutOutlined, MenuFoldOutlined, MenuUnfoldOutlined, FullscreenOutlined, FullscreenExitOutlined, PauseOutlined, ClockCircleOutlined, WarningOutlined, StopOutlined, RedoOutlined, UndoOutlined, ExportOutlined, ImportOutlined, SyncOutlined, StarOutlined, MailOutlined, ReloadOutlined, PoweroffOutlined, SaveOutlined, HomeOutlined, ScanOutlined, LikeOutlined, DislikeOutlined, MessageOutlined, PayCircleOutlined, CalculatorOutlined, BulbOutlined, KeyOutlined, LinkOutlined, DisconnectOutlined, SelectOutlined, MoreOutlined, SettingOutlined, BellOutlined, SafetyOutlined, UpCircleFilled, DownCircleFilled, LeftCircleFilled, RightCircleFilled, PlayCircleFilled, UpSquareFilled, DownSquareFilled, LeftSquareFilled, RightSquareFilled, QuestionCircleFilled, InfoCircleFilled, ExclamationCircleFilled, CloseCircleFilled, CheckCircleFilled, ClockCircleFilled, WarningFilled, StopFilled, EditFilled, CopyFilled, DeleteFilled, EyeFilled, EyeInvisibleFilled, FolderFilled, FolderOpenFilled, HomeFilled, FilterFilled, UnlockFilled, SkinFilled, TagFilled, TagsFilled, StarFilled, UpCircleTwoTone, DownCircleTwoTone, LeftCircleTwoTone, RightCircleTwoTone, PlayCircleTwoTone, UpSquareTwoTone, DownSquareTwoTone, LeftSquareTwoTone, RightSquareTwoTone, QuestionCircleTwoTone, PlusCircleTwoTone, PauseCircleTwoTone, MinusCircleTwoTone, PlusSquareTwoTone, MinusSquareTwoTone, InfoCircleTwoTone, ExclamationCircleTwoTone, CloseCircleTwoTone, CloseSquareTwoTone, CheckCircleTwoTone, CheckSquareTwoTone, ClockCircleTwoTone, WarningTwoTone, StopTwoTone, EditTwoTone, CopyTwoTone, DeleteTwoTone, FilterTwoTone, EyeTwoTone, EyeInvisibleTwoTone, FolderTwoTone, FolderOpenTwoTone, TagTwoTone, StarTwoTone } from '@fishx/icons';
import { css } from '@emotion/css';
import IconList from './IconList';
var TabPane = Tabs.TabPane;
var titleStyle = css({
  marginTop: '10px'
});

var ModalIconTabs = function ModalIconTabs(_ref) {
  var visible = _ref.visible,
      handleVisible = _ref.handleVisible,
      setCurrentIcon = _ref.setCurrentIcon,
      currentIcon = _ref.currentIcon,
      title = _ref.title,
      typeText = _ref.typeText,
      sortText = _ref.sortText;

  var _useState = useState(currentIcon),
      _useState2 = _slicedToArray(_useState, 2),
      selectedIcon = _useState2[0],
      setSelectedIcon = _useState2[1];

  var handleOk = function handleOk() {
    setCurrentIcon(selectedIcon);
    handleVisible(false);
  };

  var dataSourceFirstDirection = [/*#__PURE__*/React.createElement(DownOutlined, null), /*#__PURE__*/React.createElement(UpOutlined, null), /*#__PURE__*/React.createElement(LeftOutlined, null), /*#__PURE__*/React.createElement(RightOutlined, null), /*#__PURE__*/React.createElement(ArrowUpOutlined, null), /*#__PURE__*/React.createElement(ArrowDownOutlined, null), /*#__PURE__*/React.createElement(ArrowLeftOutlined, null), /*#__PURE__*/React.createElement(ArrowRightOutlined, null)];
  var dataSourceFirstTips = [/*#__PURE__*/React.createElement(QuestionCircleOutlined, null), /*#__PURE__*/React.createElement(InfoCircleOutlined, null), /*#__PURE__*/React.createElement(ExclamationCircleOutlined, null), /*#__PURE__*/React.createElement(CloseOutlined, null), /*#__PURE__*/React.createElement(CheckOutlined, null), /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement(MinusOutlined, null)];
  var dataSourceFirstEditor = [/*#__PURE__*/React.createElement(EditOutlined, null), /*#__PURE__*/React.createElement(FormOutlined, null), /*#__PURE__*/React.createElement(CopyOutlined, null), /*#__PURE__*/React.createElement(DeleteOutlined, null)];
  var dataSourceFirstNormal = [/*#__PURE__*/React.createElement(SearchOutlined, null), /*#__PURE__*/React.createElement(FileOutlined, null), /*#__PURE__*/React.createElement(FilterOutlined, null), /*#__PURE__*/React.createElement(FolderOutlined, null), /*#__PURE__*/React.createElement(FolderOpenOutlined, null), /*#__PURE__*/React.createElement(DownloadOutlined, null), /*#__PURE__*/React.createElement(UploadOutlined, null), /*#__PURE__*/React.createElement(FileSearchOutlined, null), /*#__PURE__*/React.createElement(UserOutlined, null)];
  var dataSourceSecondDirection = [/*#__PURE__*/React.createElement(StepBackwardOutlined, null), /*#__PURE__*/React.createElement(StepForwardOutlined, null), /*#__PURE__*/React.createElement(FastBackwardOutlined, null), /*#__PURE__*/React.createElement(FastForwardOutlined, null), /*#__PURE__*/React.createElement(ShrinkOutlined, null), /*#__PURE__*/React.createElement(ArrowsAltOutlined, null), /*#__PURE__*/React.createElement(CaretUpOutlined, null), /*#__PURE__*/React.createElement(CaretDownOutlined, null), /*#__PURE__*/React.createElement(CaretLeftOutlined, null), /*#__PURE__*/React.createElement(CaretRightOutlined, null), /*#__PURE__*/React.createElement(DoubleRightOutlined, null), /*#__PURE__*/React.createElement(DoubleLeftOutlined, null), /*#__PURE__*/React.createElement(RollbackOutlined, null), /*#__PURE__*/React.createElement(RetweetOutlined, null), /*#__PURE__*/React.createElement(SwapOutlined, null), /*#__PURE__*/React.createElement(PlayCircleOutlined, null), /*#__PURE__*/React.createElement(LoginOutlined, null), /*#__PURE__*/React.createElement(LogoutOutlined, null), /*#__PURE__*/React.createElement(MenuFoldOutlined, null), /*#__PURE__*/React.createElement(MenuUnfoldOutlined, null), /*#__PURE__*/React.createElement(FullscreenOutlined, null), /*#__PURE__*/React.createElement(FullscreenExitOutlined, null)];
  var dataSourceSecondTips = [/*#__PURE__*/React.createElement(PauseOutlined, null), /*#__PURE__*/React.createElement(ClockCircleOutlined, null), /*#__PURE__*/React.createElement(WarningOutlined, null), /*#__PURE__*/React.createElement(StopOutlined, null)];
  var dataSourceSecondEditor = [/*#__PURE__*/React.createElement(RedoOutlined, null), /*#__PURE__*/React.createElement(UndoOutlined, null)];
  var dataSourceSecondNormal = [/*#__PURE__*/React.createElement(ExportOutlined, null), /*#__PURE__*/React.createElement(ImportOutlined, null), /*#__PURE__*/React.createElement(StarOutlined, null), /*#__PURE__*/React.createElement(SyncOutlined, null), /*#__PURE__*/React.createElement(StarOutlined, null), /*#__PURE__*/React.createElement(MailOutlined, null), /*#__PURE__*/React.createElement(ReloadOutlined, null), /*#__PURE__*/React.createElement(PoweroffOutlined, null), /*#__PURE__*/React.createElement(SaveOutlined, null), /*#__PURE__*/React.createElement(HomeOutlined, null), /*#__PURE__*/React.createElement(ScanOutlined, null), /*#__PURE__*/React.createElement(LikeOutlined, null), /*#__PURE__*/React.createElement(DislikeOutlined, null), /*#__PURE__*/React.createElement(MessageOutlined, null), /*#__PURE__*/React.createElement(PayCircleOutlined, null), /*#__PURE__*/React.createElement(CalculatorOutlined, null), /*#__PURE__*/React.createElement(BulbOutlined, null), /*#__PURE__*/React.createElement(KeyOutlined, null), /*#__PURE__*/React.createElement(LinkOutlined, null), /*#__PURE__*/React.createElement(DisconnectOutlined, null), /*#__PURE__*/React.createElement(SelectOutlined, null), /*#__PURE__*/React.createElement(MoreOutlined, null), /*#__PURE__*/React.createElement(SettingOutlined, null), /*#__PURE__*/React.createElement(BellOutlined, null), /*#__PURE__*/React.createElement(SafetyOutlined, null)];
  var dataSourceThirdDirection = [/*#__PURE__*/React.createElement(UpCircleFilled, null), /*#__PURE__*/React.createElement(DownCircleFilled, null), /*#__PURE__*/React.createElement(LeftCircleFilled, null), /*#__PURE__*/React.createElement(RightCircleFilled, null), /*#__PURE__*/React.createElement(PlayCircleFilled, null), /*#__PURE__*/React.createElement(UpSquareFilled, null), /*#__PURE__*/React.createElement(DownSquareFilled, null), /*#__PURE__*/React.createElement(LeftSquareFilled, null), /*#__PURE__*/React.createElement(RightSquareFilled, null)];
  var dataSourceThirdTips = [/*#__PURE__*/React.createElement(QuestionCircleFilled, null), /*#__PURE__*/React.createElement(InfoCircleFilled, null), /*#__PURE__*/React.createElement(ExclamationCircleFilled, null), /*#__PURE__*/React.createElement(CloseCircleFilled, null), /*#__PURE__*/React.createElement(CheckCircleFilled, null), /*#__PURE__*/React.createElement(ClockCircleFilled, null), /*#__PURE__*/React.createElement(WarningFilled, null), /*#__PURE__*/React.createElement(StopFilled, null)];
  var dataSourceThirdEditor = [/*#__PURE__*/React.createElement(EditFilled, null), /*#__PURE__*/React.createElement(CopyFilled, null), /*#__PURE__*/React.createElement(DeleteFilled, null)];
  var dataSourceThirdNormal = [/*#__PURE__*/React.createElement(EyeFilled, null), /*#__PURE__*/React.createElement(EyeInvisibleFilled, null), /*#__PURE__*/React.createElement(FolderFilled, null), /*#__PURE__*/React.createElement(FolderOpenFilled, null), /*#__PURE__*/React.createElement(HomeFilled, null), /*#__PURE__*/React.createElement(FilterFilled, null), /*#__PURE__*/React.createElement(UnlockFilled, null), /*#__PURE__*/React.createElement(SkinFilled, null), /*#__PURE__*/React.createElement(TagFilled, null), /*#__PURE__*/React.createElement(TagsFilled, null), /*#__PURE__*/React.createElement(StarFilled, null)];
  var dataSourceFourthDirection = [/*#__PURE__*/React.createElement(UpCircleTwoTone, null), /*#__PURE__*/React.createElement(DownCircleTwoTone, null), /*#__PURE__*/React.createElement(LeftCircleTwoTone, null), /*#__PURE__*/React.createElement(RightCircleTwoTone, null), /*#__PURE__*/React.createElement(PlayCircleTwoTone, null), /*#__PURE__*/React.createElement(UpSquareTwoTone, null), /*#__PURE__*/React.createElement(DownSquareTwoTone, null), /*#__PURE__*/React.createElement(LeftSquareTwoTone, null), /*#__PURE__*/React.createElement(RightSquareTwoTone, null)];
  var dataSourceFourthTips = [/*#__PURE__*/React.createElement(QuestionCircleTwoTone, null), /*#__PURE__*/React.createElement(PlusCircleTwoTone, null), /*#__PURE__*/React.createElement(PauseCircleTwoTone, null), /*#__PURE__*/React.createElement(MinusCircleTwoTone, null), /*#__PURE__*/React.createElement(PlusSquareTwoTone, null), /*#__PURE__*/React.createElement(MinusSquareTwoTone, null), /*#__PURE__*/React.createElement(InfoCircleTwoTone, null), /*#__PURE__*/React.createElement(ExclamationCircleTwoTone, null), /*#__PURE__*/React.createElement(CloseCircleTwoTone, null), /*#__PURE__*/React.createElement(CloseSquareTwoTone, null), /*#__PURE__*/React.createElement(CheckCircleTwoTone, null), /*#__PURE__*/React.createElement(CheckSquareTwoTone, null), /*#__PURE__*/React.createElement(ClockCircleTwoTone, null), /*#__PURE__*/React.createElement(WarningTwoTone, null), /*#__PURE__*/React.createElement(StopTwoTone, null)];
  var dataSourceFourthEditor = [/*#__PURE__*/React.createElement(EditTwoTone, null), /*#__PURE__*/React.createElement(CopyTwoTone, null), /*#__PURE__*/React.createElement(DeleteTwoTone, null)];
  var dataSourceFourthNormal = [/*#__PURE__*/React.createElement(FilterTwoTone, null), /*#__PURE__*/React.createElement(EyeTwoTone, null), /*#__PURE__*/React.createElement(EyeInvisibleTwoTone, null), /*#__PURE__*/React.createElement(FolderTwoTone, null), /*#__PURE__*/React.createElement(FolderOpenTwoTone, null), /*#__PURE__*/React.createElement(TagTwoTone, null), /*#__PURE__*/React.createElement(StarTwoTone, null)];
  var titleArr = {
    direction: 'Direction Icons',
    tips: 'Tips Icons',
    editor: 'Edit Icons',
    normal: 'Normal Icons'
  };
  Object.keys(titleArr).map(function (v, index) {
    if (sortText && Array.isArray(sortText) && sortText.length > 0 && sortText[index]) {
      titleArr[v] = sortText[index];
    }
  });
  var iconObject = [{
    title: 'Normal',
    dataSource: {
      direction: dataSourceFirstDirection,
      tips: dataSourceFirstTips,
      editor: dataSourceFirstEditor,
      normal: dataSourceFirstNormal
    }
  }, {
    title: 'Outlined',
    dataSource: {
      direction: dataSourceSecondDirection,
      tips: dataSourceSecondTips,
      editor: dataSourceSecondEditor,
      normal: dataSourceSecondNormal
    }
  }, {
    title: 'Filled',
    dataSource: {
      direction: dataSourceThirdDirection,
      tips: dataSourceThirdTips,
      editor: dataSourceThirdEditor,
      normal: dataSourceThirdNormal
    }
  }, {
    title: 'TwoTone',
    dataSource: {
      direction: dataSourceFourthDirection,
      tips: dataSourceFourthTips,
      editor: dataSourceFourthEditor,
      normal: dataSourceFourthNormal
    }
  }];
  iconObject.map(function (v, index) {
    if (typeText && Array.isArray(typeText) && typeText.length > 0 && typeText[index]) {
      v.title = typeText[index];
    }
  });
  return /*#__PURE__*/React.createElement(Modal, {
    title: title || "Please Select Icon",
    width: 800,
    visible: visible,
    onCancel: function onCancel() {
      return handleVisible(false);
    },
    onOk: function onOk() {
      return handleOk();
    }
  }, /*#__PURE__*/React.createElement(Tabs, {
    defaultActiveKey: "0",
    tabPosition: "left"
  }, iconObject.map(function (vl, index) {
    return /*#__PURE__*/React.createElement(TabPane, {
      tab: vl.title,
      key: String(index)
    }, Object.keys(vl.dataSource).map(function (item) {
      return /*#__PURE__*/React.createElement("div", {
        key: item
      }, vl.dataSource[item].length > 0 && /*#__PURE__*/React.createElement("h4", {
        className: titleStyle
      }, titleArr[item]), /*#__PURE__*/React.createElement(IconList, {
        dataSource: vl.dataSource[item],
        currentIcon: selectedIcon,
        iconChange: function iconChange(v) {
          return setSelectedIcon(v);
        }
      }));
    }));
  })));
};

export default ModalIconTabs;