\n {affixStyle &&
}\n
\n {\n this.updatePosition();\n }}>\n {children}\n \n
\n
\n );\n };\n }\n getTargetFunc() {\n const { getTargetContainer } = this.context;\n const { target } = this.props;\n if (target !== undefined) {\n return target;\n }\n return getTargetContainer || getDefaultTarget;\n }\n // Event handler\n componentDidMount() {\n const targetFunc = this.getTargetFunc();\n if (targetFunc) {\n // [Legacy] Wait for parent component ref has its value.\n // We should use target as directly element instead of function which makes element check hard.\n this.timeout = setTimeout(() => {\n addObserveTarget(targetFunc(), this);\n // Mock Event object.\n this.updatePosition();\n });\n }\n }\n componentDidUpdate(prevProps) {\n const { prevTarget } = this.state;\n const targetFunc = this.getTargetFunc();\n let newTarget = null;\n if (targetFunc) {\n newTarget = targetFunc() || null;\n }\n if (prevTarget !== newTarget) {\n removeObserveTarget(this);\n if (newTarget) {\n addObserveTarget(newTarget, this);\n // Mock Event object.\n this.updatePosition();\n }\n this.setState({ prevTarget: newTarget });\n }\n if (prevProps.offsetTop !== this.props.offsetTop ||\n prevProps.offsetBottom !== this.props.offsetBottom) {\n this.updatePosition();\n }\n this.measure();\n }\n componentWillUnmount() {\n clearTimeout(this.timeout);\n removeObserveTarget(this);\n this.updatePosition.cancel();\n // https://github.com/ant-design/ant-design/issues/22683\n this.lazyUpdatePosition.cancel();\n }\n // Handle realign logic\n updatePosition() {\n this.prepareMeasure();\n }\n lazyUpdatePosition() {\n const targetFunc = this.getTargetFunc();\n const { affixStyle } = this.state;\n // Check position change before measure to make Safari smooth\n if (targetFunc && affixStyle) {\n const offsetTop = this.getOffsetTop();\n const offsetBottom = this.getOffsetBottom();\n const targetNode = targetFunc();\n if (targetNode && this.placeholderNode) {\n const targetRect = getTargetRect(targetNode);\n const placeholderReact = getTargetRect(this.placeholderNode);\n const fixedTop = getFixedTop(placeholderReact, targetRect, offsetTop);\n const fixedBottom = getFixedBottom(placeholderReact, targetRect, offsetBottom);\n if ((fixedTop !== undefined && affixStyle.top === fixedTop) ||\n (fixedBottom !== undefined && affixStyle.bottom === fixedBottom)) {\n return;\n }\n }\n }\n // Directly call prepare measure since it's already throttled.\n this.prepareMeasure();\n }\n}\nAffix.contextType = ConfigContext;\n__decorate([\n throttleByAnimationFrameDecorator()\n], Affix.prototype, \"updatePosition\", null);\n__decorate([\n throttleByAnimationFrameDecorator()\n], Affix.prototype, \"lazyUpdatePosition\", null);\nexport default Affix;\n","export function isWindow(obj) {\n return obj !== null && obj !== undefined && obj === obj.window;\n}\nexport default function getScroll(target, top) {\n if (typeof window === 'undefined') {\n return 0;\n }\n const method = top ? 'scrollTop' : 'scrollLeft';\n let result = 0;\n if (isWindow(target)) {\n result = target[top ? 'pageYOffset' : 'pageXOffset'];\n }\n else if (target instanceof Document) {\n result = target.documentElement[method];\n }\n else if (target) {\n result = target[method];\n }\n if (target && !isWindow(target) && typeof result !== 'number') {\n result = (target.ownerDocument || target).documentElement[method];\n }\n return result;\n}\n","import raf from 'raf';\nimport getScroll, { isWindow } from './getScroll';\nimport { easeInOutCubic } from './easings';\nexport default function scrollTo(y, options = {}) {\n const { getContainer = () => window, callback, duration = 450 } = options;\n const container = getContainer();\n const scrollTop = getScroll(container, true);\n const startTime = Date.now();\n const frameFunc = () => {\n const timestamp = Date.now();\n const time = timestamp - startTime;\n const nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);\n if (isWindow(container)) {\n container.scrollTo(window.pageXOffset, nextScrollTop);\n }\n else if (container instanceof Document) {\n container.documentElement.scrollTop = nextScrollTop;\n }\n else {\n container.scrollTop = nextScrollTop;\n }\n if (time < duration) {\n raf(frameFunc);\n }\n else if (typeof callback === 'function') {\n callback();\n }\n };\n raf(frameFunc);\n}\n","// eslint-disable-next-line import/prefer-default-export\nexport function easeInOutCubic(t, b, c, d) {\n const cc = c - b;\n t /= d / 2;\n if (t < 1) {\n return (cc / 2) * t * t * t + b;\n }\n return (cc / 2) * ((t -= 2) * t * t + 2) + b;\n}\n","import * as React from 'react';\nconst AnchorContext = React.createContext(null);\nexport default AnchorContext;\n","import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport classNames from 'classnames';\nimport addEventListener from 'rc-util/lib/Dom/addEventListener';\nimport Affix from '../affix';\nimport { ConfigContext } from '../config-provider';\nimport scrollTo from '../_util/scrollTo';\nimport getScroll from '../_util/getScroll';\nimport AnchorContext from './context';\nfunction getDefaultContainer() {\n return window;\n}\nfunction getOffsetTop(element, container) {\n if (!element.getClientRects().length) {\n return 0;\n }\n const rect = element.getBoundingClientRect();\n if (rect.width || rect.height) {\n if (container === window) {\n container = element.ownerDocument.documentElement;\n return rect.top - container.clientTop;\n }\n return rect.top - container.getBoundingClientRect().top;\n }\n return rect.top;\n}\nconst sharpMatcherRegx = /#(\\S+)$/;\nexport default class Anchor extends React.Component {\n constructor() {\n super(...arguments);\n this.state = {\n activeLink: null,\n };\n this.links = [];\n // Context\n this.registerLink = (link) => {\n if (!this.links.includes(link)) {\n this.links.push(link);\n }\n };\n this.unregisterLink = (link) => {\n const index = this.links.indexOf(link);\n if (index !== -1) {\n this.links.splice(index, 1);\n }\n };\n this.getContainer = () => {\n const { getTargetContainer } = this.context;\n const { getContainer } = this.props;\n const getFunc = getContainer || getTargetContainer || getDefaultContainer;\n return getFunc();\n };\n this.handleScrollTo = (link) => {\n const { offsetTop, targetOffset } = this.props;\n this.setCurrentActiveLink(link);\n const container = this.getContainer();\n const scrollTop = getScroll(container, true);\n const sharpLinkMatch = sharpMatcherRegx.exec(link);\n if (!sharpLinkMatch) {\n return;\n }\n const targetElement = document.getElementById(sharpLinkMatch[1]);\n if (!targetElement) {\n return;\n }\n const eleOffsetTop = getOffsetTop(targetElement, container);\n let y = scrollTop + eleOffsetTop;\n y -= targetOffset !== undefined ? targetOffset : offsetTop || 0;\n this.animating = true;\n scrollTo(y, {\n callback: () => {\n this.animating = false;\n },\n getContainer: this.getContainer,\n });\n };\n this.saveInkNode = (node) => {\n this.inkNode = node;\n };\n this.setCurrentActiveLink = (link) => {\n const { activeLink } = this.state;\n const { onChange } = this.props;\n if (activeLink !== link) {\n this.setState({\n activeLink: link,\n });\n if (onChange) {\n onChange(link);\n }\n }\n };\n this.handleScroll = () => {\n if (this.animating) {\n return;\n }\n const { offsetTop, bounds, targetOffset } = this.props;\n const currentActiveLink = this.getCurrentAnchor(targetOffset !== undefined ? targetOffset : offsetTop || 0, bounds);\n this.setCurrentActiveLink(currentActiveLink);\n };\n this.updateInk = () => {\n const { prefixCls } = this;\n const anchorNode = ReactDOM.findDOMNode(this);\n const linkNode = anchorNode.getElementsByClassName(`${prefixCls}-link-title-active`)[0];\n if (linkNode) {\n this.inkNode.style.top = `${linkNode.offsetTop + linkNode.clientHeight / 2 - 4.5}px`;\n }\n };\n this.render = () => {\n const { getPrefixCls, direction } = this.context;\n const { prefixCls: customizePrefixCls, className = '', style, offsetTop, affix, showInkInFixed, children, } = this.props;\n const { activeLink } = this.state;\n const prefixCls = getPrefixCls('anchor', customizePrefixCls);\n // To support old version react.\n // Have to add prefixCls on the instance.\n // https://github.com/facebook/react/issues/12397\n this.prefixCls = prefixCls;\n const inkClass = classNames(`${prefixCls}-ink-ball`, {\n visible: activeLink,\n });\n const wrapperClass = classNames(className, `${prefixCls}-wrapper`, {\n [`${prefixCls}-rtl`]: direction === 'rtl',\n });\n const anchorClass = classNames(prefixCls, {\n fixed: !affix && !showInkInFixed,\n });\n const wrapperStyle = Object.assign({ maxHeight: offsetTop ? `calc(100vh - ${offsetTop}px)` : '100vh' }, style);\n const anchorContent = (
);\n return (
\n {!affix ? (anchorContent) : (\n {anchorContent}\n )}\n );\n };\n }\n componentDidMount() {\n this.scrollContainer = this.getContainer();\n this.scrollEvent = addEventListener(this.scrollContainer, 'scroll', this.handleScroll);\n this.handleScroll();\n }\n componentDidUpdate() {\n if (this.scrollEvent) {\n const currentContainer = this.getContainer();\n if (this.scrollContainer !== currentContainer) {\n this.scrollContainer = currentContainer;\n this.scrollEvent.remove();\n this.scrollEvent = addEventListener(this.scrollContainer, 'scroll', this.handleScroll);\n this.handleScroll();\n }\n }\n this.updateInk();\n }\n componentWillUnmount() {\n if (this.scrollEvent) {\n this.scrollEvent.remove();\n }\n }\n getCurrentAnchor(offsetTop = 0, bounds = 5) {\n const { getCurrentAnchor } = this.props;\n if (typeof getCurrentAnchor === 'function') {\n return getCurrentAnchor();\n }\n const linkSections = [];\n const container = this.getContainer();\n this.links.forEach(link => {\n const sharpLinkMatch = sharpMatcherRegx.exec(link.toString());\n if (!sharpLinkMatch) {\n return;\n }\n const target = document.getElementById(sharpLinkMatch[1]);\n if (target) {\n const top = getOffsetTop(target, container);\n if (top < offsetTop + bounds) {\n linkSections.push({\n link,\n top,\n });\n }\n }\n });\n if (linkSections.length) {\n const maxSection = linkSections.reduce((prev, curr) => (curr.top > prev.top ? curr : prev));\n return maxSection.link;\n }\n return '';\n }\n}\nAnchor.defaultProps = {\n affix: true,\n showInkInFixed: false,\n};\nAnchor.contextType = ConfigContext;\n","import * as React from 'react';\nimport classNames from 'classnames';\nimport { ConfigConsumer } from '../config-provider';\nimport AnchorContext from './context';\nclass AnchorLink extends React.Component {\n constructor() {\n super(...arguments);\n this.handleClick = (e) => {\n const { scrollTo, onClick } = this.context;\n const { href, title } = this.props;\n if (onClick) {\n onClick(e, { title, href });\n }\n scrollTo(href);\n };\n this.renderAnchorLink = ({ getPrefixCls }) => {\n const { prefixCls: customizePrefixCls, href, title, children, className, target } = this.props;\n const prefixCls = getPrefixCls('anchor', customizePrefixCls);\n const active = this.context.activeLink === href;\n const wrapperClassName = classNames(className, `${prefixCls}-link`, {\n [`${prefixCls}-link-active`]: active,\n });\n const titleClassName = classNames(`${prefixCls}-link-title`, {\n [`${prefixCls}-link-title-active`]: active,\n });\n return (
);\n };\n }\n componentDidMount() {\n this.context.registerLink(this.props.href);\n }\n componentDidUpdate({ href: prevHref }) {\n const { href } = this.props;\n if (prevHref !== href) {\n this.context.unregisterLink(prevHref);\n this.context.registerLink(href);\n }\n }\n componentWillUnmount() {\n this.context.unregisterLink(this.props.href);\n }\n render() {\n return
{this.renderAnchorLink};\n }\n}\nAnchorLink.defaultProps = {\n href: '#',\n};\nAnchorLink.contextType = AnchorContext;\nexport default AnchorLink;\n","import Anchor from './Anchor';\nimport AnchorLink from './AnchorLink';\nexport { AnchorProps } from './Anchor';\nexport { AnchorLinkProps } from './AnchorLink';\nAnchor.Link = AnchorLink;\nexport default Anchor;\n","/**\n * @ignore\n * some key-codes definition and utils from closure-library\n * @author yiminghe@gmail.com\n */\nvar KeyCode = {\n /**\n * MAC_ENTER\n */\n MAC_ENTER: 3,\n\n /**\n * BACKSPACE\n */\n BACKSPACE: 8,\n\n /**\n * TAB\n */\n TAB: 9,\n\n /**\n * NUMLOCK on FF/Safari Mac\n */\n NUM_CENTER: 12,\n\n /**\n * ENTER\n */\n ENTER: 13,\n\n /**\n * SHIFT\n */\n SHIFT: 16,\n\n /**\n * CTRL\n */\n CTRL: 17,\n\n /**\n * ALT\n */\n ALT: 18,\n\n /**\n * PAUSE\n */\n PAUSE: 19,\n\n /**\n * CAPS_LOCK\n */\n CAPS_LOCK: 20,\n\n /**\n * ESC\n */\n ESC: 27,\n\n /**\n * SPACE\n */\n SPACE: 32,\n\n /**\n * PAGE_UP\n */\n PAGE_UP: 33,\n\n /**\n * PAGE_DOWN\n */\n PAGE_DOWN: 34,\n\n /**\n * END\n */\n END: 35,\n\n /**\n * HOME\n */\n HOME: 36,\n\n /**\n * LEFT\n */\n LEFT: 37,\n\n /**\n * UP\n */\n UP: 38,\n\n /**\n * RIGHT\n */\n RIGHT: 39,\n\n /**\n * DOWN\n */\n DOWN: 40,\n\n /**\n * PRINT_SCREEN\n */\n PRINT_SCREEN: 44,\n\n /**\n * INSERT\n */\n INSERT: 45,\n\n /**\n * DELETE\n */\n DELETE: 46,\n\n /**\n * ZERO\n */\n ZERO: 48,\n\n /**\n * ONE\n */\n ONE: 49,\n\n /**\n * TWO\n */\n TWO: 50,\n\n /**\n * THREE\n */\n THREE: 51,\n\n /**\n * FOUR\n */\n FOUR: 52,\n\n /**\n * FIVE\n */\n FIVE: 53,\n\n /**\n * SIX\n */\n SIX: 54,\n\n /**\n * SEVEN\n */\n SEVEN: 55,\n\n /**\n * EIGHT\n */\n EIGHT: 56,\n\n /**\n * NINE\n */\n NINE: 57,\n\n /**\n * QUESTION_MARK\n */\n QUESTION_MARK: 63,\n\n /**\n * A\n */\n A: 65,\n\n /**\n * B\n */\n B: 66,\n\n /**\n * C\n */\n C: 67,\n\n /**\n * D\n */\n D: 68,\n\n /**\n * E\n */\n E: 69,\n\n /**\n * F\n */\n F: 70,\n\n /**\n * G\n */\n G: 71,\n\n /**\n * H\n */\n H: 72,\n\n /**\n * I\n */\n I: 73,\n\n /**\n * J\n */\n J: 74,\n\n /**\n * K\n */\n K: 75,\n\n /**\n * L\n */\n L: 76,\n\n /**\n * M\n */\n M: 77,\n\n /**\n * N\n */\n N: 78,\n\n /**\n * O\n */\n O: 79,\n\n /**\n * P\n */\n P: 80,\n\n /**\n * Q\n */\n Q: 81,\n\n /**\n * R\n */\n R: 82,\n\n /**\n * S\n */\n S: 83,\n\n /**\n * T\n */\n T: 84,\n\n /**\n * U\n */\n U: 85,\n\n /**\n * V\n */\n V: 86,\n\n /**\n * W\n */\n W: 87,\n\n /**\n * X\n */\n X: 88,\n\n /**\n * Y\n */\n Y: 89,\n\n /**\n * Z\n */\n Z: 90,\n\n /**\n * META\n */\n META: 91,\n\n /**\n * WIN_KEY_RIGHT\n */\n WIN_KEY_RIGHT: 92,\n\n /**\n * CONTEXT_MENU\n */\n CONTEXT_MENU: 93,\n\n /**\n * NUM_ZERO\n */\n NUM_ZERO: 96,\n\n /**\n * NUM_ONE\n */\n NUM_ONE: 97,\n\n /**\n * NUM_TWO\n */\n NUM_TWO: 98,\n\n /**\n * NUM_THREE\n */\n NUM_THREE: 99,\n\n /**\n * NUM_FOUR\n */\n NUM_FOUR: 100,\n\n /**\n * NUM_FIVE\n */\n NUM_FIVE: 101,\n\n /**\n * NUM_SIX\n */\n NUM_SIX: 102,\n\n /**\n * NUM_SEVEN\n */\n NUM_SEVEN: 103,\n\n /**\n * NUM_EIGHT\n */\n NUM_EIGHT: 104,\n\n /**\n * NUM_NINE\n */\n NUM_NINE: 105,\n\n /**\n * NUM_MULTIPLY\n */\n NUM_MULTIPLY: 106,\n\n /**\n * NUM_PLUS\n */\n NUM_PLUS: 107,\n\n /**\n * NUM_MINUS\n */\n NUM_MINUS: 109,\n\n /**\n * NUM_PERIOD\n */\n NUM_PERIOD: 110,\n\n /**\n * NUM_DIVISION\n */\n NUM_DIVISION: 111,\n\n /**\n * F1\n */\n F1: 112,\n\n /**\n * F2\n */\n F2: 113,\n\n /**\n * F3\n */\n F3: 114,\n\n /**\n * F4\n */\n F4: 115,\n\n /**\n * F5\n */\n F5: 116,\n\n /**\n * F6\n */\n F6: 117,\n\n /**\n * F7\n */\n F7: 118,\n\n /**\n * F8\n */\n F8: 119,\n\n /**\n * F9\n */\n F9: 120,\n\n /**\n * F10\n */\n F10: 121,\n\n /**\n * F11\n */\n F11: 122,\n\n /**\n * F12\n */\n F12: 123,\n\n /**\n * NUMLOCK\n */\n NUMLOCK: 144,\n\n /**\n * SEMICOLON\n */\n SEMICOLON: 186,\n\n /**\n * DASH\n */\n DASH: 189,\n\n /**\n * EQUALS\n */\n EQUALS: 187,\n\n /**\n * COMMA\n */\n COMMA: 188,\n\n /**\n * PERIOD\n */\n PERIOD: 190,\n\n /**\n * SLASH\n */\n SLASH: 191,\n\n /**\n * APOSTROPHE\n */\n APOSTROPHE: 192,\n\n /**\n * SINGLE_QUOTE\n */\n SINGLE_QUOTE: 222,\n\n /**\n * OPEN_SQUARE_BRACKET\n */\n OPEN_SQUARE_BRACKET: 219,\n\n /**\n * BACKSLASH\n */\n BACKSLASH: 220,\n\n /**\n * CLOSE_SQUARE_BRACKET\n */\n CLOSE_SQUARE_BRACKET: 221,\n\n /**\n * WIN_KEY\n */\n WIN_KEY: 224,\n\n /**\n * MAC_FF_META\n */\n MAC_FF_META: 224,\n\n /**\n * WIN_IME\n */\n WIN_IME: 229,\n // ======================== Function ========================\n\n /**\n * whether text and modified key is entered at the same time.\n */\n isTextModifyingKeyEvent: function isTextModifyingKeyEvent(e) {\n var keyCode = e.keyCode;\n\n if (e.altKey && !e.ctrlKey || e.metaKey || // Function keys don't generate text\n keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) {\n return false;\n } // The following keys are quite harmless, even in combination with\n // CTRL, ALT or SHIFT.\n\n\n switch (keyCode) {\n case KeyCode.ALT:\n case KeyCode.CAPS_LOCK:\n case KeyCode.CONTEXT_MENU:\n case KeyCode.CTRL:\n case KeyCode.DOWN:\n case KeyCode.END:\n case KeyCode.ESC:\n case KeyCode.HOME:\n case KeyCode.INSERT:\n case KeyCode.LEFT:\n case KeyCode.MAC_FF_META:\n case KeyCode.META:\n case KeyCode.NUMLOCK:\n case KeyCode.NUM_CENTER:\n case KeyCode.PAGE_DOWN:\n case KeyCode.PAGE_UP:\n case KeyCode.PAUSE:\n case KeyCode.PRINT_SCREEN:\n case KeyCode.RIGHT:\n case KeyCode.SHIFT:\n case KeyCode.UP:\n case KeyCode.WIN_KEY:\n case KeyCode.WIN_KEY_RIGHT:\n return false;\n\n default:\n return true;\n }\n },\n\n /**\n * whether character is entered.\n */\n isCharacterKey: function isCharacterKey(keyCode) {\n if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) {\n return true;\n }\n\n if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) {\n return true;\n }\n\n if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) {\n return true;\n } // Safari sends zero key code for non-latin characters.\n\n\n if (window.navigator.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) {\n return true;\n }\n\n switch (keyCode) {\n case KeyCode.SPACE:\n case KeyCode.QUESTION_MARK:\n case KeyCode.NUM_PLUS:\n case KeyCode.NUM_MINUS:\n case KeyCode.NUM_PERIOD:\n case KeyCode.NUM_DIVISION:\n case KeyCode.SEMICOLON:\n case KeyCode.DASH:\n case KeyCode.EQUALS:\n case KeyCode.COMMA:\n case KeyCode.PERIOD:\n case KeyCode.SLASH:\n case KeyCode.APOSTROPHE:\n case KeyCode.SINGLE_QUOTE:\n case KeyCode.OPEN_SQUARE_BRACKET:\n case KeyCode.BACKSLASH:\n case KeyCode.CLOSE_SQUARE_BRACKET:\n return true;\n\n default:\n return false;\n }\n }\n};\nexport default KeyCode;","import * as React from 'react';\nexport default function useMemo(getValue, condition, shouldUpdate) {\n var cacheRef = React.useRef({});\n\n if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {\n cacheRef.current.value = getValue();\n cacheRef.current.condition = condition;\n }\n\n return cacheRef.current.value;\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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\nimport * as React from 'react';\nimport classNames from 'classnames';\n/**\n * Fill component to provided the scroll content real height.\n */\n\nvar Filler = function Filler(_ref) {\n var height = _ref.height,\n offset = _ref.offset,\n children = _ref.children,\n prefixCls = _ref.prefixCls;\n var outerStyle = {};\n var innerStyle = {\n display: 'flex',\n flexDirection: 'column'\n };\n\n if (offset !== undefined) {\n outerStyle = {\n height: height,\n position: 'relative',\n overflow: 'hidden'\n };\n innerStyle = _objectSpread({}, innerStyle, {\n transform: \"translateY(\".concat(offset, \"px)\"),\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0\n });\n }\n\n return React.createElement(\"div\", {\n style: outerStyle\n }, React.createElement(\"div\", {\n style: innerStyle,\n className: classNames(_defineProperty({}, \"\".concat(prefixCls, \"-holder-inner\"), prefixCls))\n }, children));\n};\n\nexport default Filler;","function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport findDOMNode from \"rc-util/es/Dom/findDOMNode\";\n/**\n * Our algorithm have additional one ghost item\n * whose index as `data.length` to simplify the calculation\n */\n\nexport var GHOST_ITEM_KEY = '__rc_ghost_item__';\n/**\n * Get location item and its align percentage with the scroll percentage.\n * We should measure current scroll position to decide which item is the location item.\n * And then fill the top count and bottom count with the base of location item.\n *\n * `total` should be the real count instead of `total - 1` in calculation.\n */\n\nfunction getLocationItem(scrollPtg, total) {\n var itemIndex = Math.floor(scrollPtg * total);\n var itemTopPtg = itemIndex / total;\n var itemBottomPtg = (itemIndex + 1) / total;\n var itemOffsetPtg = (scrollPtg - itemTopPtg) / (itemBottomPtg - itemTopPtg);\n return {\n index: itemIndex,\n offsetPtg: itemOffsetPtg\n };\n}\n/**\n * Safari has the elasticity effect which provides negative `scrollTop` value.\n * We should ignore it since will make scroll animation shake.\n */\n\n\nexport function alignScrollTop(scrollTop, scrollRange) {\n if (scrollTop < 0) {\n return 0;\n }\n\n if (scrollTop >= scrollRange) {\n return scrollRange;\n }\n\n return scrollTop;\n}\nexport function getScrollPercentage(_ref) {\n var scrollTop = _ref.scrollTop,\n scrollHeight = _ref.scrollHeight,\n clientHeight = _ref.clientHeight;\n\n if (scrollHeight <= clientHeight) {\n return 0;\n }\n\n var scrollRange = scrollHeight - clientHeight;\n var alignedScrollTop = alignScrollTop(scrollTop, scrollRange);\n var scrollTopPtg = alignedScrollTop / scrollRange;\n return scrollTopPtg;\n}\nexport function getElementScrollPercentage(element) {\n if (!element) {\n return 0;\n }\n\n return getScrollPercentage(element);\n}\n/**\n * Get node `offsetHeight`. We prefer node is a dom element directly.\n * But if not provided, downgrade to `findDOMNode` to get the real dom element.\n */\n\nexport function getNodeHeight(node) {\n var element = findDOMNode(node);\n return element ? element.offsetHeight : 0;\n}\n/**\n * Get display items start, end, located item index. This is pure math calculation\n */\n\nexport function getRangeIndex(scrollPtg, itemCount, visibleCount) {\n var _getLocationItem = getLocationItem(scrollPtg, itemCount),\n index = _getLocationItem.index,\n offsetPtg = _getLocationItem.offsetPtg;\n\n var beforeCount = Math.ceil(scrollPtg * visibleCount);\n var afterCount = Math.ceil((1 - scrollPtg) * visibleCount);\n return {\n itemIndex: index,\n itemOffsetPtg: offsetPtg,\n startIndex: Math.max(0, index - beforeCount),\n endIndex: Math.min(itemCount - 1, index + afterCount)\n };\n}\n/**\n * Calculate the located item related top with current window height\n */\n\nexport function getItemRelativeTop(_ref2) {\n var itemIndex = _ref2.itemIndex,\n itemOffsetPtg = _ref2.itemOffsetPtg,\n itemElementHeights = _ref2.itemElementHeights,\n scrollPtg = _ref2.scrollPtg,\n clientHeight = _ref2.clientHeight,\n getItemKey = _ref2.getItemKey;\n var locatedItemHeight = itemElementHeights[getItemKey(itemIndex)] || 0;\n var locatedItemTop = scrollPtg * clientHeight;\n var locatedItemOffset = itemOffsetPtg * locatedItemHeight;\n return Math.floor(locatedItemTop - locatedItemOffset);\n}\n/**\n * Calculate the located item absolute top with whole scroll height\n */\n\nexport function getItemAbsoluteTop(_ref3) {\n var scrollTop = _ref3.scrollTop,\n rest = _objectWithoutProperties(_ref3, [\"scrollTop\"]);\n\n return scrollTop + getItemRelativeTop(rest);\n}\nexport function getCompareItemRelativeTop(_ref4) {\n var locatedItemRelativeTop = _ref4.locatedItemRelativeTop,\n locatedItemIndex = _ref4.locatedItemIndex,\n compareItemIndex = _ref4.compareItemIndex,\n startIndex = _ref4.startIndex,\n endIndex = _ref4.endIndex,\n getItemKey = _ref4.getItemKey,\n itemElementHeights = _ref4.itemElementHeights;\n var originCompareItemTop = locatedItemRelativeTop;\n var compareItemKey = getItemKey(compareItemIndex);\n\n if (compareItemIndex <= locatedItemIndex) {\n for (var index = locatedItemIndex; index >= startIndex; index -= 1) {\n var key = getItemKey(index);\n\n if (key === compareItemKey) {\n break;\n }\n\n var prevItemKey = getItemKey(index - 1);\n originCompareItemTop -= itemElementHeights[prevItemKey] || 0;\n }\n } else {\n for (var _index = locatedItemIndex; _index <= endIndex; _index += 1) {\n var _key = getItemKey(_index);\n\n if (_key === compareItemKey) {\n break;\n }\n\n originCompareItemTop += itemElementHeights[_key] || 0;\n }\n }\n\n return originCompareItemTop;\n}\nexport function requireVirtual(height, itemHeight, count, virtual) {\n return virtual !== false && typeof height === 'number' && count * itemHeight > height;\n}","/**\n * Get index with specific start index one by one. e.g.\n * min: 3, max: 9, start: 6\n *\n * Return index is:\n * [0]: 6\n * [1]: 7\n * [2]: 5\n * [3]: 8\n * [4]: 4\n * [5]: 9\n * [6]: 3\n */\nexport function getIndexByStartLoc(min, max, start, index) {\n var beforeCount = start - min;\n var afterCount = max - start;\n var balanceCount = Math.min(beforeCount, afterCount) * 2; // Balance\n\n if (index <= balanceCount) {\n var stepIndex = Math.floor(index / 2);\n\n if (index % 2) {\n return start + stepIndex + 1;\n }\n\n return start - stepIndex;\n } // One is out of range\n\n\n if (beforeCount > afterCount) {\n return start - (index - afterCount);\n }\n\n return start + (index - beforeCount);\n}\n/**\n * We assume that 2 list has only 1 item diff and others keeping the order.\n * So we can use dichotomy algorithm to find changed one.\n */\n\nexport function findListDiffIndex(originList, targetList, getKey) {\n var originLen = originList.length;\n var targetLen = targetList.length;\n var shortList;\n var longList;\n\n if (originLen === 0 && targetLen === 0) {\n return null;\n }\n\n if (originLen < targetLen) {\n shortList = originList;\n longList = targetList;\n } else {\n shortList = targetList;\n longList = originList;\n }\n\n var notExistKey = {\n __EMPTY_ITEM__: true\n };\n\n function getItemKey(item) {\n if (item !== undefined) {\n return getKey(item);\n }\n\n return notExistKey;\n } // Loop to find diff one\n\n\n var diffIndex = null;\n var multiple = Math.abs(originLen - targetLen) !== 1;\n\n for (var i = 0; i < longList.length; i += 1) {\n var shortKey = getItemKey(shortList[i]);\n var longKey = getItemKey(longList[i]);\n\n if (shortKey !== longKey) {\n diffIndex = i;\n multiple = multiple || shortKey !== getItemKey(longList[i + 1]);\n break;\n }\n }\n\n return diffIndex === null ? null : {\n index: diffIndex,\n multiple: multiple\n };\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport raf from 'raf';\nimport Filler from './Filler';\nimport { getElementScrollPercentage, getScrollPercentage, getNodeHeight, getRangeIndex, getItemAbsoluteTop, GHOST_ITEM_KEY, getItemRelativeTop, getCompareItemRelativeTop, alignScrollTop, requireVirtual } from './utils/itemUtil';\nimport { getIndexByStartLoc, findListDiffIndex } from './utils/algorithmUtil';\nvar ScrollStyle = {\n overflowY: 'auto',\n overflowAnchor: 'none'\n};\nvar ITEM_SCALE_RATE = 1;\n/**\n * We use class component here since typescript can not support generic in function component\n *\n * Virtual list display logic:\n * 1. scroll / initialize trigger measure\n * 2. Get location item of current `scrollTop`\n * 3. [Render] Render visible items\n * 4. Get all the visible items height\n * 5. [Render] Update top item `margin-top` to fit the position\n *\n * Algorithm:\n * We split scroll bar into equal slice. An item with whatever height occupy the same range slice.\n * When `scrollTop` change,\n * it will calculate the item percentage position and move item to the position.\n * Then calculate other item position base on the located item.\n *\n * Concept:\n *\n * # located item\n * The base position item which other items position calculate base on.\n */\n\nvar List = /*#__PURE__*/function (_React$Component) {\n _inherits(List, _React$Component);\n\n function List(props) {\n var _this;\n\n _classCallCheck(this, List);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(List).call(this, props));\n _this.listRef = React.createRef();\n _this.itemElements = {};\n _this.itemElementHeights = {};\n /**\n * Lock scroll process with `onScroll` event.\n * This is used for `data` length change and `scrollTop` restore\n */\n\n _this.lockScroll = false;\n /**\n * Phase 2: Trigger render since we should re-calculate current position.\n */\n\n _this.onScroll = function (event) {\n var _this$props = _this.props,\n data = _this$props.data,\n height = _this$props.height,\n itemHeight = _this$props.itemHeight,\n disabled = _this$props.disabled;\n var _this$listRef$current = _this.listRef.current,\n originScrollTop = _this$listRef$current.scrollTop,\n clientHeight = _this$listRef$current.clientHeight,\n scrollHeight = _this$listRef$current.scrollHeight;\n var scrollTop = alignScrollTop(originScrollTop, scrollHeight - clientHeight); // Skip if `scrollTop` not change to avoid shake\n\n if (scrollTop === _this.state.scrollTop || _this.lockScroll || disabled) {\n return;\n }\n\n var scrollPtg = getElementScrollPercentage(_this.listRef.current);\n var visibleCount = Math.ceil(height / itemHeight);\n\n var _getRangeIndex = getRangeIndex(scrollPtg, data.length, visibleCount),\n itemIndex = _getRangeIndex.itemIndex,\n itemOffsetPtg = _getRangeIndex.itemOffsetPtg,\n startIndex = _getRangeIndex.startIndex,\n endIndex = _getRangeIndex.endIndex;\n\n _this.setState({\n status: 'MEASURE_START',\n scrollTop: scrollTop,\n itemIndex: itemIndex,\n itemOffsetPtg: itemOffsetPtg,\n startIndex: startIndex,\n endIndex: endIndex\n });\n\n _this.triggerOnScroll(event);\n };\n\n _this.onRawScroll = function (event) {\n var scrollTop = _this.listRef.current.scrollTop;\n\n _this.setState({\n scrollTop: scrollTop\n });\n\n _this.triggerOnScroll(event);\n };\n\n _this.triggerOnScroll = function (event) {\n var onScroll = _this.props.onScroll;\n\n if (onScroll && event) {\n onScroll(event);\n }\n };\n\n _this.getIndexKey = function (index, props) {\n var mergedProps = props || _this.props;\n var _mergedProps$data = mergedProps.data,\n data = _mergedProps$data === void 0 ? [] : _mergedProps$data; // Return ghost key as latest index item\n\n if (index === data.length) {\n return GHOST_ITEM_KEY;\n }\n\n var item = data[index];\n\n if (!item) {\n /* istanbul ignore next */\n console.error('Not find index item. Please report this since it is a bug.');\n }\n\n return _this.getItemKey(item, mergedProps);\n };\n\n _this.getItemKey = function (item, props) {\n var _ref = props || _this.props,\n itemKey = _ref.itemKey;\n\n return typeof itemKey === 'function' ? itemKey(item) : item[itemKey];\n };\n /**\n * Collect current rendered dom element item heights\n */\n\n\n _this.collectItemHeights = function (range) {\n var _ref2 = range || _this.state,\n startIndex = _ref2.startIndex,\n endIndex = _ref2.endIndex;\n\n var data = _this.props.data; // Record here since measure item height will get warning in `render`\n\n for (var index = startIndex; index <= endIndex; index += 1) {\n var item = data[index]; // Only collect exist item height\n\n if (item) {\n var eleKey = _this.getItemKey(item);\n\n _this.itemElementHeights[eleKey] = getNodeHeight(_this.itemElements[eleKey]);\n }\n }\n };\n\n _this.scrollTo = function (arg0) {\n raf(function () {\n // Number top\n if (_typeof(arg0) === 'object') {\n var isVirtual = _this.state.isVirtual;\n var _this$props2 = _this.props,\n height = _this$props2.height,\n itemHeight = _this$props2.itemHeight,\n data = _this$props2.data;\n var _arg0$align = arg0.align,\n align = _arg0$align === void 0 ? 'auto' : _arg0$align;\n var index = 0;\n\n if ('index' in arg0) {\n index = arg0.index;\n } else if ('key' in arg0) {\n var key = arg0.key;\n index = data.findIndex(function (item) {\n return _this.getItemKey(item) === key;\n });\n }\n\n var visibleCount = Math.ceil(height / itemHeight);\n var item = data[index];\n\n if (item) {\n var clientHeight = _this.listRef.current.clientHeight;\n\n if (isVirtual) {\n // Calculate related data\n var _this$state = _this.state,\n itemIndex = _this$state.itemIndex,\n itemOffsetPtg = _this$state.itemOffsetPtg;\n var scrollTop = _this.listRef.current.scrollTop;\n var scrollPtg = getElementScrollPercentage(_this.listRef.current);\n var relativeLocatedItemTop = getItemRelativeTop({\n itemIndex: itemIndex,\n itemOffsetPtg: itemOffsetPtg,\n itemElementHeights: _this.itemElementHeights,\n scrollPtg: scrollPtg,\n clientHeight: clientHeight,\n getItemKey: _this.getIndexKey\n }); // We will force render related items to collect height for re-location\n\n _this.setState({\n startIndex: Math.max(0, index - visibleCount),\n endIndex: Math.min(data.length - 1, index + visibleCount)\n }, function () {\n _this.collectItemHeights(); // Calculate related top\n\n\n var relativeTop;\n var mergedAlgin = align;\n\n if (align === 'auto') {\n var shouldChange = true; // Check if exist in the visible range\n\n if (Math.abs(itemIndex - index) < visibleCount) {\n var itemTop = relativeLocatedItemTop;\n\n if (index < itemIndex) {\n for (var i = index; i < itemIndex; i += 1) {\n var eleKey = _this.getIndexKey(i);\n\n itemTop -= _this.itemElementHeights[eleKey] || 0;\n }\n } else {\n for (var _i = itemIndex; _i <= index; _i += 1) {\n var _eleKey = _this.getIndexKey(_i);\n\n itemTop += _this.itemElementHeights[_eleKey] || 0;\n }\n }\n\n shouldChange = itemTop <= 0 || itemTop >= clientHeight;\n }\n\n if (shouldChange) {\n // Out of range will fall back to position align\n mergedAlgin = index < itemIndex ? 'top' : 'bottom';\n } else {\n var _getRangeIndex2 = getRangeIndex(scrollPtg, data.length, visibleCount),\n nextIndex = _getRangeIndex2.itemIndex,\n newOffsetPtg = _getRangeIndex2.itemOffsetPtg,\n startIndex = _getRangeIndex2.startIndex,\n endIndex = _getRangeIndex2.endIndex;\n\n _this.setState({\n scrollTop: scrollTop,\n itemIndex: nextIndex,\n itemOffsetPtg: newOffsetPtg,\n startIndex: startIndex,\n endIndex: endIndex\n });\n\n return;\n }\n } // Align with position should make scroll happen\n\n\n if (mergedAlgin === 'top') {\n relativeTop = 0;\n } else if (mergedAlgin === 'bottom') {\n var _eleKey2 = _this.getItemKey(item);\n\n relativeTop = clientHeight - _this.itemElementHeights[_eleKey2] || 0;\n }\n\n _this.internalScrollTo({\n itemIndex: index,\n relativeTop: relativeTop\n });\n });\n } else {\n // Raw list without virtual scroll set position directly\n _this.collectItemHeights({\n startIndex: 0,\n endIndex: data.length - 1\n });\n\n var mergedAlgin = align; // Collection index item position\n\n var indexItemHeight = _this.itemElementHeights[_this.getIndexKey(index)];\n\n var itemTop = 0;\n\n for (var i = 0; i < index; i += 1) {\n var eleKey = _this.getIndexKey(i);\n\n itemTop += _this.itemElementHeights[eleKey] || 0;\n }\n\n var itemBottom = itemTop + indexItemHeight;\n\n if (mergedAlgin === 'auto') {\n if (itemTop < _this.listRef.current.scrollTop) {\n mergedAlgin = 'top';\n } else if (itemBottom > _this.listRef.current.scrollTop + clientHeight) {\n mergedAlgin = 'bottom';\n }\n }\n\n if (mergedAlgin === 'top') {\n _this.listRef.current.scrollTop = itemTop;\n } else if (mergedAlgin === 'bottom') {\n _this.listRef.current.scrollTop = itemTop - (clientHeight - indexItemHeight);\n }\n }\n }\n } else {\n _this.listRef.current.scrollTop = arg0;\n }\n });\n };\n /**\n * Phase 4: Render item and get all the visible items height\n */\n\n\n _this.renderChildren = function (list, startIndex, renderFunc) {\n var status = _this.state.status; // We should measure rendered item height\n\n return list.map(function (item, index) {\n var eleIndex = startIndex + index;\n var node = renderFunc(item, eleIndex, {\n style: status === 'MEASURE_START' ? {\n visibility: 'hidden'\n } : {}\n });\n\n var eleKey = _this.getIndexKey(eleIndex); // Pass `key` and `ref` for internal measure\n\n\n return React.cloneElement(node, {\n key: eleKey,\n ref: function ref(ele) {\n _this.itemElements[eleKey] = ele;\n }\n });\n });\n };\n\n _this.cachedProps = props;\n _this.state = {\n status: 'NONE',\n scrollTop: null,\n itemIndex: 0,\n itemOffsetPtg: 0,\n startIndex: 0,\n endIndex: 0,\n startItemTop: 0,\n isVirtual: requireVirtual(props.height, props.itemHeight, props.data.length, props.virtual),\n itemCount: props.data.length\n };\n return _this;\n }\n\n _createClass(List, [{\n key: \"componentDidMount\",\n\n /**\n * Phase 1: Initial should sync with default scroll top\n */\n value: function componentDidMount() {\n if (this.listRef.current) {\n this.listRef.current.scrollTop = 0;\n this.onScroll(null);\n }\n }\n /**\n * Phase 4: Record used item height\n * Phase 5: Trigger re-render to use correct position\n */\n\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n var _this2 = this;\n\n var status = this.state.status;\n var _this$props3 = this.props,\n data = _this$props3.data,\n height = _this$props3.height,\n itemHeight = _this$props3.itemHeight,\n disabled = _this$props3.disabled,\n onSkipRender = _this$props3.onSkipRender,\n virtual = _this$props3.virtual;\n var prevData = this.cachedProps.data || [];\n var changedItemIndex = null;\n\n if (prevData.length !== data.length) {\n var diff = findListDiffIndex(prevData, data, this.getItemKey);\n changedItemIndex = diff ? diff.index : null;\n }\n\n if (disabled) {\n // Should trigger `onSkipRender` to tell that diff component is not render in the list\n if (data.length > prevData.length) {\n var _this$state2 = this.state,\n startIndex = _this$state2.startIndex,\n endIndex = _this$state2.endIndex;\n\n if (onSkipRender && (changedItemIndex === null || changedItemIndex < startIndex || endIndex < changedItemIndex)) {\n onSkipRender();\n }\n }\n\n return;\n }\n\n var isVirtual = requireVirtual(height, itemHeight, data.length, virtual);\n var nextStatus = status;\n\n if (this.state.isVirtual !== isVirtual) {\n nextStatus = isVirtual ? 'SWITCH_TO_VIRTUAL' : 'SWITCH_TO_RAW';\n this.setState({\n isVirtual: isVirtual,\n status: nextStatus\n });\n /**\n * We will wait a tick to let list turn to virtual list.\n * And then use virtual list sync logic to adjust the scroll.\n */\n\n if (nextStatus === 'SWITCH_TO_VIRTUAL') {\n return;\n }\n }\n\n if (status === 'MEASURE_START') {\n var _this$state3 = this.state,\n _startIndex = _this$state3.startIndex,\n itemIndex = _this$state3.itemIndex,\n itemOffsetPtg = _this$state3.itemOffsetPtg;\n var scrollTop = this.listRef.current.scrollTop; // Record here since measure item height will get warning in `render`\n\n this.collectItemHeights(); // Calculate top visible item top offset\n\n var locatedItemTop = getItemAbsoluteTop({\n itemIndex: itemIndex,\n itemOffsetPtg: itemOffsetPtg,\n itemElementHeights: this.itemElementHeights,\n scrollTop: scrollTop,\n scrollPtg: getElementScrollPercentage(this.listRef.current),\n clientHeight: this.listRef.current.clientHeight,\n getItemKey: this.getIndexKey\n });\n var startItemTop = locatedItemTop;\n\n for (var index = itemIndex - 1; index >= _startIndex; index -= 1) {\n startItemTop -= this.itemElementHeights[this.getIndexKey(index)] || 0;\n }\n\n this.setState({\n status: 'MEASURE_DONE',\n startItemTop: startItemTop\n });\n }\n\n if (status === 'SWITCH_TO_RAW') {\n /**\n * After virtual list back to raw list,\n * we update the `scrollTop` to real top instead of percentage top.\n */\n var _this$state$cacheScro = this.state.cacheScroll,\n _itemIndex = _this$state$cacheScro.itemIndex,\n relativeTop = _this$state$cacheScro.relativeTop;\n var rawTop = relativeTop;\n\n for (var _index = 0; _index < _itemIndex; _index += 1) {\n rawTop -= this.itemElementHeights[this.getIndexKey(_index)] || 0;\n }\n\n this.lockScroll = true;\n this.listRef.current.scrollTop = -rawTop;\n this.setState({\n status: 'MEASURE_DONE',\n itemIndex: 0\n });\n requestAnimationFrame(function () {\n requestAnimationFrame(function () {\n _this2.lockScroll = false;\n });\n });\n } else if (prevData.length !== data.length && changedItemIndex !== null && height) {\n /**\n * Re-calculate the item position since `data` length changed.\n * [IMPORTANT] We use relative position calculate here.\n */\n var originItemIndex = this.state.itemIndex;\n var _this$state4 = this.state,\n originItemOffsetPtg = _this$state4.itemOffsetPtg,\n originStartIndex = _this$state4.startIndex,\n originEndIndex = _this$state4.endIndex,\n originScrollTop = _this$state4.scrollTop; // 1. Refresh item heights\n\n this.collectItemHeights(); // 1. Get origin located item top\n\n var originLocatedItemRelativeTop;\n\n if (this.state.status === 'SWITCH_TO_VIRTUAL') {\n originItemIndex = 0;\n originLocatedItemRelativeTop = -this.state.scrollTop;\n } else {\n originLocatedItemRelativeTop = getItemRelativeTop({\n itemIndex: originItemIndex,\n itemOffsetPtg: originItemOffsetPtg,\n itemElementHeights: this.itemElementHeights,\n scrollPtg: getScrollPercentage({\n scrollTop: originScrollTop,\n scrollHeight: prevData.length * itemHeight,\n clientHeight: this.listRef.current.clientHeight\n }),\n clientHeight: this.listRef.current.clientHeight,\n getItemKey: function getItemKey(index) {\n return _this2.getIndexKey(index, _this2.cachedProps);\n }\n });\n } // 2. Find the compare item\n\n\n var originCompareItemIndex = changedItemIndex - 1; // Use next one since there are not more item before removed\n\n if (originCompareItemIndex < 0) {\n originCompareItemIndex = 0;\n } // 3. Find the compare item top\n\n\n var originCompareItemTop = getCompareItemRelativeTop({\n locatedItemRelativeTop: originLocatedItemRelativeTop,\n locatedItemIndex: originItemIndex,\n compareItemIndex: originCompareItemIndex,\n startIndex: originStartIndex,\n endIndex: originEndIndex,\n getItemKey: function getItemKey(index) {\n return _this2.getIndexKey(index, _this2.cachedProps);\n },\n itemElementHeights: this.itemElementHeights\n });\n\n if (nextStatus === 'SWITCH_TO_RAW') {\n /**\n * We will record current measure relative item top and apply in raw list after list turned\n */\n this.setState({\n cacheScroll: {\n itemIndex: originCompareItemIndex,\n relativeTop: originCompareItemTop\n }\n });\n } else {\n this.internalScrollTo({\n itemIndex: originCompareItemIndex,\n relativeTop: originCompareItemTop\n });\n }\n } else if (nextStatus === 'SWITCH_TO_RAW') {\n // This is only trigger when height changes that all items can show in raw\n // Let's reset back to top\n this.setState({\n cacheScroll: {\n itemIndex: 0,\n relativeTop: 0\n }\n });\n }\n\n this.cachedProps = this.props;\n }\n }, {\n key: \"internalScrollTo\",\n value: function internalScrollTo(relativeScroll) {\n var _this3 = this;\n\n var compareItemIndex = relativeScroll.itemIndex,\n compareItemRelativeTop = relativeScroll.relativeTop;\n var originScrollTop = this.state.scrollTop;\n var _this$props4 = this.props,\n data = _this$props4.data,\n itemHeight = _this$props4.itemHeight,\n height = _this$props4.height; // 1. Find the best match compare item top\n\n var bestSimilarity = Number.MAX_VALUE;\n var bestScrollTop = null;\n var bestItemIndex = null;\n var bestItemOffsetPtg = null;\n var bestStartIndex = null;\n var bestEndIndex = null;\n var missSimilarity = 0;\n var scrollHeight = data.length * itemHeight;\n var clientHeight = this.listRef.current.clientHeight;\n var maxScrollTop = scrollHeight - clientHeight;\n\n for (var i = 0; i < maxScrollTop; i += 1) {\n var scrollTop = getIndexByStartLoc(0, maxScrollTop, originScrollTop, i);\n var scrollPtg = getScrollPercentage({\n scrollTop: scrollTop,\n scrollHeight: scrollHeight,\n clientHeight: clientHeight\n });\n var visibleCount = Math.ceil(height / itemHeight);\n\n var _getRangeIndex3 = getRangeIndex(scrollPtg, data.length, visibleCount),\n itemIndex = _getRangeIndex3.itemIndex,\n itemOffsetPtg = _getRangeIndex3.itemOffsetPtg,\n startIndex = _getRangeIndex3.startIndex,\n endIndex = _getRangeIndex3.endIndex; // No need to check if compare item out of the index to save performance\n\n\n if (startIndex <= compareItemIndex && compareItemIndex <= endIndex) {\n // 1.1 Get measure located item relative top\n var locatedItemRelativeTop = getItemRelativeTop({\n itemIndex: itemIndex,\n itemOffsetPtg: itemOffsetPtg,\n itemElementHeights: this.itemElementHeights,\n scrollPtg: scrollPtg,\n clientHeight: clientHeight,\n getItemKey: this.getIndexKey\n });\n var compareItemTop = getCompareItemRelativeTop({\n locatedItemRelativeTop: locatedItemRelativeTop,\n locatedItemIndex: itemIndex,\n compareItemIndex: compareItemIndex,\n startIndex: startIndex,\n endIndex: endIndex,\n getItemKey: this.getIndexKey,\n itemElementHeights: this.itemElementHeights\n }); // 1.2 Find best match compare item top\n\n var similarity = Math.abs(compareItemTop - compareItemRelativeTop);\n\n if (similarity < bestSimilarity) {\n bestSimilarity = similarity;\n bestScrollTop = scrollTop;\n bestItemIndex = itemIndex;\n bestItemOffsetPtg = itemOffsetPtg;\n bestStartIndex = startIndex;\n bestEndIndex = endIndex;\n missSimilarity = 0;\n } else {\n missSimilarity += 1;\n }\n } // If keeping 10 times not match similarity,\n // check more scrollTop is meaningless.\n // Here boundary is set to 10.\n\n\n if (missSimilarity > 10) {\n break;\n }\n } // 2. Re-scroll if has best scroll match\n\n\n if (bestScrollTop !== null) {\n this.lockScroll = true;\n this.listRef.current.scrollTop = bestScrollTop;\n this.setState({\n status: 'MEASURE_START',\n scrollTop: bestScrollTop,\n itemIndex: bestItemIndex,\n itemOffsetPtg: bestItemOffsetPtg,\n startIndex: bestStartIndex,\n endIndex: bestEndIndex\n });\n requestAnimationFrame(function () {\n requestAnimationFrame(function () {\n _this3.lockScroll = false;\n });\n });\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$state5 = this.state,\n isVirtual = _this$state5.isVirtual,\n itemCount = _this$state5.itemCount;\n\n var _this$props5 = this.props,\n prefixCls = _this$props5.prefixCls,\n style = _this$props5.style,\n className = _this$props5.className,\n _this$props5$componen = _this$props5.component,\n Component = _this$props5$componen === void 0 ? 'div' : _this$props5$componen,\n height = _this$props5.height,\n itemHeight = _this$props5.itemHeight,\n _this$props5$fullHeig = _this$props5.fullHeight,\n fullHeight = _this$props5$fullHeig === void 0 ? true : _this$props5$fullHeig,\n data = _this$props5.data,\n children = _this$props5.children,\n itemKey = _this$props5.itemKey,\n onSkipRender = _this$props5.onSkipRender,\n disabled = _this$props5.disabled,\n virtual = _this$props5.virtual,\n restProps = _objectWithoutProperties(_this$props5, [\"prefixCls\", \"style\", \"className\", \"component\", \"height\", \"itemHeight\", \"fullHeight\", \"data\", \"children\", \"itemKey\", \"onSkipRender\", \"disabled\", \"virtual\"]);\n\n var mergedClassName = classNames(prefixCls, className); // Render pure list if not set height or height is enough for all items\n\n if (!isVirtual) {\n /**\n * Virtual list switch is works on component updated.\n * We should double check here if need cut the content.\n */\n var shouldVirtual = requireVirtual(height, itemHeight, data.length, virtual);\n return React.createElement(Component, Object.assign({\n style: height ? _objectSpread({}, style, _defineProperty({}, fullHeight ? 'height' : 'maxHeight', height), ScrollStyle) : style,\n className: mergedClassName\n }, restProps, {\n onScroll: this.onRawScroll,\n ref: this.listRef\n }), React.createElement(Filler, {\n prefixCls: prefixCls,\n height: height\n }, this.renderChildren(shouldVirtual ? data.slice(0, Math.ceil(height / itemHeight)) : data, 0, children)));\n } // Use virtual list\n\n\n var mergedStyle = _objectSpread({}, style, {\n height: height\n }, ScrollStyle);\n\n var _this$state6 = this.state,\n status = _this$state6.status,\n startIndex = _this$state6.startIndex,\n endIndex = _this$state6.endIndex,\n startItemTop = _this$state6.startItemTop;\n var contentHeight = itemCount * itemHeight * ITEM_SCALE_RATE;\n return React.createElement(Component, Object.assign({\n style: mergedStyle,\n className: mergedClassName\n }, restProps, {\n onScroll: this.onScroll,\n ref: this.listRef\n }), React.createElement(Filler, {\n prefixCls: prefixCls,\n height: contentHeight,\n offset: status === 'MEASURE_DONE' ? startItemTop : 0\n }, this.renderChildren(data.slice(startIndex, endIndex + 1), startIndex, children)));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(nextProps) {\n if (!nextProps.disabled) {\n return {\n itemCount: nextProps.data.length\n };\n }\n\n return null;\n }\n }]);\n\n return List;\n}(React.Component);\n\nList.defaultProps = {\n itemHeight: 15,\n data: []\n};\nexport default List;","import * as React from 'react';\nimport classNames from 'classnames';\n\nvar TransBtn = function TransBtn(_ref) {\n var className = _ref.className,\n customizeIcon = _ref.customizeIcon,\n customizeIconProps = _ref.customizeIconProps,\n _onMouseDown = _ref.onMouseDown,\n onClick = _ref.onClick,\n children = _ref.children;\n var icon;\n\n if (typeof customizeIcon === 'function') {\n icon = customizeIcon(customizeIconProps);\n } else {\n icon = customizeIcon;\n }\n\n return React.createElement(\"span\", {\n className: className,\n onMouseDown: function onMouseDown(event) {\n event.preventDefault();\n\n if (_onMouseDown) {\n _onMouseDown(event);\n }\n },\n style: {\n userSelect: 'none',\n WebkitUserSelect: 'none'\n },\n unselectable: \"on\",\n onClick: onClick,\n \"aria-hidden\": true\n }, icon !== undefined ? icon : React.createElement(\"span\", {\n className: classNames(className.split(/\\s+/).map(function (cls) {\n return \"\".concat(cls, \"-icon\");\n }))\n }, children));\n};\n\nexport default TransBtn;","import List from './List';\nexport default List;","function _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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nimport * as React from 'react';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport useMemo from \"rc-util/es/hooks/useMemo\";\nimport classNames from 'classnames';\nimport List from 'rc-virtual-list';\nimport TransBtn from './TransBtn';\n/**\n * Using virtual list of option display.\n * Will fallback to dom if use customize render.\n */\n\nvar OptionList = function OptionList(_ref, ref) {\n var prefixCls = _ref.prefixCls,\n id = _ref.id,\n flattenOptions = _ref.flattenOptions,\n childrenAsData = _ref.childrenAsData,\n values = _ref.values,\n searchValue = _ref.searchValue,\n multiple = _ref.multiple,\n defaultActiveFirstOption = _ref.defaultActiveFirstOption,\n height = _ref.height,\n itemHeight = _ref.itemHeight,\n notFoundContent = _ref.notFoundContent,\n open = _ref.open,\n menuItemSelectedIcon = _ref.menuItemSelectedIcon,\n virtual = _ref.virtual,\n onSelect = _ref.onSelect,\n onToggleOpen = _ref.onToggleOpen,\n onActiveValue = _ref.onActiveValue,\n onScroll = _ref.onScroll;\n var itemPrefixCls = \"\".concat(prefixCls, \"-item\");\n var memoFlattenOptions = useMemo(function () {\n return flattenOptions;\n }, [open, flattenOptions], function (prev, next) {\n return next[0] && prev[1] !== next[1];\n }); // =========================== List ===========================\n\n var listRef = React.useRef(null);\n\n var onListMouseDown = function onListMouseDown(event) {\n event.preventDefault();\n };\n\n var scrollIntoView = function scrollIntoView(index) {\n if (listRef.current) {\n listRef.current.scrollTo({\n index: index\n });\n }\n }; // ========================== Active ==========================\n\n\n var getEnabledActiveIndex = function getEnabledActiveIndex(index) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var len = memoFlattenOptions.length;\n\n for (var i = 0; i < len; i += 1) {\n var current = (index + i * offset + len) % len;\n var _memoFlattenOptions$c = memoFlattenOptions[current],\n group = _memoFlattenOptions$c.group,\n data = _memoFlattenOptions$c.data;\n\n if (!group && !data.disabled) {\n return current;\n }\n }\n\n return -1;\n };\n\n var _React$useState = React.useState(function () {\n return getEnabledActiveIndex(0);\n }),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n activeIndex = _React$useState2[0],\n setActiveIndex = _React$useState2[1];\n\n var setActive = function setActive(index) {\n setActiveIndex(index); // Trigger active event\n\n var flattenItem = memoFlattenOptions[index];\n\n if (!flattenItem) {\n onActiveValue(null, -1);\n return;\n }\n\n onActiveValue(flattenItem.data.value, index);\n }; // Auto active first item when list length or searchValue changed\n\n\n React.useEffect(function () {\n setActive(defaultActiveFirstOption !== false ? getEnabledActiveIndex(0) : -1);\n }, [memoFlattenOptions.length, searchValue]); // Auto scroll to item position in single mode\n\n React.useEffect(function () {\n /**\n * React will skip `onChange` when component update.\n * `setActive` function will call root accessibility state update which makes re-render.\n * So we need to delay to let Input component trigger onChange first.\n */\n var timeoutId = setTimeout(function () {\n if (!multiple && open && values.size === 1) {\n var value = Array.from(values)[0];\n var index = memoFlattenOptions.findIndex(function (_ref2) {\n var data = _ref2.data;\n return data.value === value;\n });\n setActive(index);\n scrollIntoView(index);\n }\n });\n return function () {\n return clearTimeout(timeoutId);\n };\n }, [open]); // ========================== Values ==========================\n\n var onSelectValue = function onSelectValue(value) {\n if (value !== undefined) {\n onSelect(value, {\n selected: !values.has(value)\n });\n } // Single mode should always close by select\n\n\n if (!multiple) {\n onToggleOpen(false);\n }\n }; // ========================= Keyboard =========================\n\n\n React.useImperativeHandle(ref, function () {\n return {\n onKeyDown: function onKeyDown(event) {\n var which = event.which;\n\n switch (which) {\n // >>> Arrow keys\n case KeyCode.UP:\n case KeyCode.DOWN:\n {\n var offset = 0;\n\n if (which === KeyCode.UP) {\n offset = -1;\n } else if (which === KeyCode.DOWN) {\n offset = 1;\n }\n\n if (offset !== 0) {\n var nextActiveIndex = getEnabledActiveIndex(activeIndex + offset, offset);\n scrollIntoView(nextActiveIndex);\n setActive(nextActiveIndex);\n }\n\n break;\n }\n // >>> Select\n\n case KeyCode.ENTER:\n {\n // value\n var item = memoFlattenOptions[activeIndex];\n\n if (item && !item.data.disabled) {\n onSelectValue(item.data.value);\n } else {\n onSelectValue(undefined);\n }\n\n if (open) {\n event.preventDefault();\n }\n\n break;\n }\n // >>> Close\n\n case KeyCode.ESC:\n {\n onToggleOpen(false);\n }\n }\n },\n onKeyUp: function onKeyUp() {},\n scrollTo: function scrollTo(index) {\n scrollIntoView(index);\n }\n };\n }); // ========================== Render ==========================\n\n if (memoFlattenOptions.length === 0) {\n return React.createElement(\"div\", {\n role: \"listbox\",\n id: \"\".concat(id, \"_list\"),\n className: \"\".concat(itemPrefixCls, \"-empty\"),\n onMouseDown: onListMouseDown\n }, notFoundContent);\n }\n\n function renderItem(index) {\n var item = memoFlattenOptions[index];\n var value = item && item.data.value;\n return item ? React.createElement(\"div\", {\n key: index,\n role: \"option\",\n id: \"\".concat(id, \"_list_\").concat(index),\n \"aria-selected\": values.has(value)\n }, value) : null;\n }\n\n return React.createElement(React.Fragment, null, React.createElement(\"div\", {\n role: \"listbox\",\n id: \"\".concat(id, \"_list\"),\n style: {\n height: 0,\n width: 0,\n overflow: 'hidden'\n }\n }, renderItem(activeIndex - 1), renderItem(activeIndex), renderItem(activeIndex + 1)), React.createElement(List, {\n itemKey: \"key\",\n ref: listRef,\n data: memoFlattenOptions,\n height: height,\n itemHeight: itemHeight,\n fullHeight: false,\n onMouseDown: onListMouseDown,\n onScroll: onScroll,\n virtual: virtual\n }, function (_ref3, itemIndex) {\n var _classNames;\n\n var group = _ref3.group,\n groupOption = _ref3.groupOption,\n data = _ref3.data;\n var label = data.label,\n key = data.key; // Group\n\n if (group) {\n return React.createElement(\"div\", {\n className: classNames(itemPrefixCls, \"\".concat(itemPrefixCls, \"-group\"))\n }, label !== undefined ? label : key);\n }\n\n var disabled = data.disabled,\n value = data.value,\n title = data.title,\n children = data.children,\n style = data.style,\n className = data.className,\n otherProps = _objectWithoutProperties(data, [\"disabled\", \"value\", \"title\", \"children\", \"style\", \"className\"]); // Option\n\n\n var selected = values.has(value);\n var optionPrefixCls = \"\".concat(itemPrefixCls, \"-option\");\n var optionClassName = classNames(itemPrefixCls, optionPrefixCls, className, (_classNames = {}, _defineProperty(_classNames, \"\".concat(optionPrefixCls, \"-grouped\"), groupOption), _defineProperty(_classNames, \"\".concat(optionPrefixCls, \"-active\"), activeIndex === itemIndex && !disabled), _defineProperty(_classNames, \"\".concat(optionPrefixCls, \"-disabled\"), disabled), _defineProperty(_classNames, \"\".concat(optionPrefixCls, \"-selected\"), selected), _classNames));\n var mergedLabel = childrenAsData ? children : label;\n var iconVisible = !menuItemSelectedIcon || typeof menuItemSelectedIcon === 'function' || selected;\n return React.createElement(\"div\", Object.assign({}, otherProps, {\n \"aria-selected\": selected,\n className: optionClassName,\n title: title,\n onMouseMove: function onMouseMove() {\n if (activeIndex === itemIndex || disabled) {\n return;\n }\n\n setActive(itemIndex);\n },\n onClick: function onClick() {\n if (!disabled) {\n onSelectValue(value);\n }\n },\n style: style\n }), React.createElement(\"div\", {\n className: \"\".concat(optionPrefixCls, \"-content\")\n }, mergedLabel || value), React.isValidElement(menuItemSelectedIcon) || selected, iconVisible && React.createElement(TransBtn, {\n className: \"\".concat(itemPrefixCls, \"-option-state\"),\n customizeIcon: menuItemSelectedIcon,\n customizeIconProps: {\n isSelected: selected\n }\n }, selected ? '✓' : null));\n }));\n};\n\nvar RefOptionList = React.forwardRef(OptionList);\nRefOptionList.displayName = 'OptionList';\nexport default RefOptionList;","/** This is a placeholder, not real render in dom */\nvar Option = function Option() {\n return null;\n};\n\nOption.isSelectOption = true;\nexport default Option;","/** This is a placeholder, not real render in dom */\nvar OptGroup = function OptGroup() {\n return null;\n};\n\nOptGroup.isSelectOptGroup = true;\nexport default OptGroup;","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport * as React from 'react';\nimport toArray from \"rc-util/es/Children/toArray\";\n\nfunction convertNodeToOption(node) {\n var key = node.key,\n _node$props = node.props,\n children = _node$props.children,\n value = _node$props.value,\n restProps = _objectWithoutProperties(_node$props, [\"children\", \"value\"]);\n\n return _objectSpread({\n key: key,\n value: value !== undefined ? value : key,\n children: children\n }, restProps);\n}\n\nexport function convertChildrenToData(nodes) {\n var optionOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n return toArray(nodes).map(function (node, index) {\n if (!React.isValidElement(node) || !node.type) {\n return null;\n }\n\n var isSelectOptGroup = node.type.isSelectOptGroup,\n key = node.key,\n _node$props2 = node.props,\n children = _node$props2.children,\n restProps = _objectWithoutProperties(_node$props2, [\"children\"]);\n\n if (optionOnly || !isSelectOptGroup) {\n return convertNodeToOption(node);\n }\n\n return _objectSpread(_objectSpread({\n key: \"__RC_SELECT_GRP__\".concat(key === null ? index : key, \"__\"),\n label: key\n }, restProps), {}, {\n options: convertChildrenToData(children)\n });\n }).filter(function (data) {\n return data;\n });\n}","function _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 _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 _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\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\nexport function toArray(value) {\n if (Array.isArray(value)) {\n return value;\n }\n\n return value !== undefined ? [value] : [];\n}\n/**\n * Convert outer props value into internal value\n */\n\nexport function toInnerValue(value, _ref) {\n var labelInValue = _ref.labelInValue,\n combobox = _ref.combobox;\n\n if (value === undefined || value === '' && combobox) {\n return [];\n }\n\n var values = Array.isArray(value) ? value : [value];\n\n if (labelInValue) {\n return values.map(function (_ref2) {\n var key = _ref2.key,\n val = _ref2.value;\n return val !== undefined ? val : key;\n });\n }\n\n return values;\n}\n/**\n * Convert internal value into out event value\n */\n\nexport function toOuterValues(valueList, _ref3) {\n var optionLabelProp = _ref3.optionLabelProp,\n labelInValue = _ref3.labelInValue,\n prevValue = _ref3.prevValue,\n options = _ref3.options,\n getLabeledValue = _ref3.getLabeledValue;\n var values = valueList;\n\n if (labelInValue) {\n values = values.map(function (val) {\n return getLabeledValue(val, {\n options: options,\n prevValue: prevValue,\n labelInValue: labelInValue,\n optionLabelProp: optionLabelProp\n });\n });\n }\n\n return values;\n}\nexport function removeLastEnabledValue(measureValues, values) {\n var newValues = _toConsumableArray(values);\n\n var removeIndex;\n\n for (removeIndex = measureValues.length - 1; removeIndex >= 0; removeIndex -= 1) {\n if (!measureValues[removeIndex].disabled) {\n break;\n }\n }\n\n var removedValue = null;\n\n if (removeIndex !== -1) {\n removedValue = newValues[removeIndex];\n newValues.splice(removeIndex, 1);\n }\n\n return {\n values: newValues,\n removedValue: removedValue\n };\n}\nexport var isClient = typeof window !== 'undefined' && window.document && window.document.documentElement;\n/** Is client side and not jsdom */\n\nexport var isBrowserClient = process.env.NODE_ENV !== 'test' && isClient;\nvar uuid = 0;\n/** Get unique id for accessibility usage */\n\nexport function getUUID() {\n var retId; // Test never reach\n\n /* istanbul ignore if */\n\n if (isBrowserClient) {\n retId = uuid;\n uuid += 1;\n } else {\n retId = 'TEST_OR_SSR';\n }\n\n return retId;\n}","function _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 _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _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 _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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\nimport warning from \"rc-util/es/warning\";\nimport { toArray } from './commonUtil';\n\nfunction getKey(data, index) {\n var key = data.key;\n var value;\n\n if ('value' in data) {\n value = data.value;\n }\n\n if (key !== null && key !== undefined) {\n return key;\n }\n\n if (value !== undefined) {\n return value;\n }\n\n return \"rc-index-key-\".concat(index);\n}\n/**\n * Flat options into flatten list.\n * We use `optionOnly` here is aim to avoid user use nested option group.\n * Here is simply set `key` to the index if not provided.\n */\n\n\nexport function flattenOptions(options) {\n var flattenList = [];\n\n function dig(list, isGroupOption) {\n list.forEach(function (data) {\n if (isGroupOption || !('options' in data)) {\n // Option\n flattenList.push({\n key: getKey(data, flattenList.length),\n groupOption: isGroupOption,\n data: data\n });\n } else {\n // Option Group\n flattenList.push({\n key: getKey(data, flattenList.length),\n group: true,\n data: data\n });\n dig(data.options, true);\n }\n });\n }\n\n dig(options, false);\n return flattenList;\n}\n/**\n * Inject `props` into `option` for legacy usage\n */\n\nfunction injectPropsWithOption(option) {\n var newOption = _objectSpread({}, option);\n\n if (!('props' in newOption)) {\n Object.defineProperty(newOption, 'props', {\n get: function get() {\n warning(false, 'Return type is option instead of Option instance. Please read value directly instead of reading from `props`.');\n return newOption;\n }\n });\n }\n\n return newOption;\n}\n\nexport function findValueOption(values, options) {\n var optionMap = new Map();\n options.forEach(function (flattenItem) {\n if (!flattenItem.group) {\n var data = flattenItem.data; // Check if match\n\n optionMap.set(data.value, data);\n }\n });\n return values.map(function (val) {\n return injectPropsWithOption(optionMap.get(val));\n });\n}\nexport var getLabeledValue = function getLabeledValue(value, _ref) {\n var options = _ref.options,\n prevValue = _ref.prevValue,\n labelInValue = _ref.labelInValue,\n optionLabelProp = _ref.optionLabelProp;\n var item = findValueOption([value], options)[0];\n var result = {\n value: value\n };\n var prevValItem;\n var prevValues = toArray(prevValue);\n\n if (labelInValue) {\n prevValItem = prevValues.find(function (prevItem) {\n if (_typeof(prevItem) === 'object' && 'value' in prevItem) {\n return prevItem.value === value;\n } // [Legacy] Support `key` as `value`\n\n\n return prevItem.key === value;\n });\n }\n\n if (prevValItem && _typeof(prevValItem) === 'object' && 'label' in prevValItem) {\n result.label = prevValItem.label;\n\n if (item && typeof prevValItem.label === 'string' && typeof item[optionLabelProp] === 'string' && prevValItem.label.trim() !== item[optionLabelProp].trim()) {\n warning(false, '`label` of `value` is not same as `label` in Select options.');\n }\n } else if (item && optionLabelProp in item) {\n result.label = item[optionLabelProp];\n } else {\n result.label = value;\n } // [Legacy] We need fill `key` as `value` to compatible old code usage\n\n\n result.key = result.value;\n return result;\n};\n\nfunction toRawString(content) {\n return toArray(content).join('');\n}\n/** Filter single option if match the search text */\n\n\nfunction getFilterFunction(optionFilterProp) {\n return function (searchValue, option) {\n var lowerSearchText = searchValue.toLowerCase(); // Group label search\n\n if ('options' in option) {\n return toRawString(option.label).toLowerCase().includes(lowerSearchText);\n } // Option value search\n\n\n var rawValue = option[optionFilterProp];\n var value = toRawString(rawValue).toLowerCase();\n return value.includes(lowerSearchText) && !option.disabled;\n };\n}\n/** Filter options and return a new options by the search text */\n\n\nexport function filterOptions(searchValue, options, _ref2) {\n var optionFilterProp = _ref2.optionFilterProp,\n filterOption = _ref2.filterOption;\n var filteredOptions = [];\n var filterFunc;\n\n if (filterOption === false) {\n return options;\n }\n\n if (typeof filterOption === 'function') {\n filterFunc = filterOption;\n } else {\n filterFunc = getFilterFunction(optionFilterProp);\n }\n\n options.forEach(function (item) {\n // Group should check child options\n if ('options' in item) {\n // Check group first\n var matchGroup = filterFunc(searchValue, item);\n\n if (matchGroup) {\n filteredOptions.push(item);\n } else {\n // Check option\n var subOptions = item.options.filter(function (subItem) {\n return filterFunc(searchValue, subItem);\n });\n\n if (subOptions.length) {\n filteredOptions.push(_objectSpread(_objectSpread({}, item), {}, {\n options: subOptions\n }));\n }\n }\n\n return;\n }\n\n if (filterFunc(searchValue, injectPropsWithOption(item))) {\n filteredOptions.push(item);\n }\n });\n return filteredOptions;\n}\nexport function getSeparatedContent(text, tokens) {\n if (!tokens || !tokens.length) {\n return null;\n }\n\n var match = false;\n\n function separate(str, _ref3) {\n var _ref4 = _toArray(_ref3),\n token = _ref4[0],\n restTokens = _ref4.slice(1);\n\n if (!token) {\n return [str];\n }\n\n var list = str.split(token);\n match = match || list.length > 1;\n return list.reduce(function (prevList, unitStr) {\n return [].concat(_toConsumableArray(prevList), _toConsumableArray(separate(unitStr, restTokens)));\n }, []).filter(function (unit) {\n return unit;\n });\n }\n\n var list = separate(text, tokens);\n return match ? list : null;\n}\nexport function isValueDisabled(value, options) {\n var option = findValueOption([value], options)[0];\n return option.disabled;\n}\n/**\n * `tags` mode should fill un-list item into the option list\n */\n\nexport function fillOptionsWithMissingValue(options, value, optionLabelProp, labelInValue) {\n var values = toArray(value).slice().sort();\n\n var cloneOptions = _toConsumableArray(options); // Convert options value to set\n\n\n var optionValues = new Set();\n options.forEach(function (opt) {\n if (opt.options) {\n opt.options.forEach(function (subOpt) {\n optionValues.add(subOpt.value);\n });\n } else {\n optionValues.add(opt.value);\n }\n }); // Fill missing value\n\n values.forEach(function (item) {\n var val = labelInValue ? item.value : item;\n\n if (!optionValues.has(val)) {\n var _ref5;\n\n cloneOptions.push(labelInValue ? (_ref5 = {}, _defineProperty(_ref5, optionLabelProp, item.label), _defineProperty(_ref5, \"value\", val), _ref5) : {\n value: val\n });\n }\n });\n return cloneOptions;\n}","function _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(n); 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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nimport * as React from 'react';\nexport default function useControlledState(defaultStateValue, option) {\n var _ref = option || {},\n defaultValue = _ref.defaultValue,\n value = _ref.value,\n onChange = _ref.onChange,\n postState = _ref.postState;\n\n var _React$useState = React.useState(function () {\n if (value !== undefined) {\n return value;\n }\n\n if (defaultValue !== undefined) {\n return typeof defaultValue === 'function' ? defaultValue() : defaultValue;\n }\n\n return typeof defaultStateValue === 'function' ? defaultStateValue() : defaultStateValue;\n }),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n innerValue = _React$useState2[0],\n setInnerValue = _React$useState2[1];\n\n var mergedValue = value !== undefined ? value : innerValue;\n\n if (postState) {\n mergedValue = postState(mergedValue);\n }\n\n function triggerChange(newValue) {\n setInnerValue(newValue);\n\n if (mergedValue !== newValue && onChange) {\n onChange(newValue, mergedValue);\n }\n } // Effect of reset value to `undefined`\n\n\n var firstRenderRef = React.useRef(true);\n React.useEffect(function () {\n if (firstRenderRef.current) {\n firstRenderRef.current = false;\n return;\n }\n\n if (value === undefined) {\n setInnerValue(value);\n }\n }, [value]);\n return [mergedValue, triggerChange];\n}","var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);\n\n// ================= Transition =================\n// Event wrapper. Copy from react source code\nfunction makePrefixMap(styleProp, eventName) {\n var prefixes = {};\n\n prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();\n prefixes['Webkit' + styleProp] = 'webkit' + eventName;\n prefixes['Moz' + styleProp] = 'moz' + eventName;\n prefixes['ms' + styleProp] = 'MS' + eventName;\n prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();\n\n return prefixes;\n}\n\nexport function getVendorPrefixes(domSupport, win) {\n var prefixes = {\n animationend: makePrefixMap('Animation', 'AnimationEnd'),\n transitionend: makePrefixMap('Transition', 'TransitionEnd')\n };\n\n if (domSupport) {\n if (!('AnimationEvent' in win)) {\n delete prefixes.animationend.animation;\n }\n\n if (!('TransitionEvent' in win)) {\n delete prefixes.transitionend.transition;\n }\n }\n\n return prefixes;\n}\n\nvar vendorPrefixes = getVendorPrefixes(canUseDOM, typeof window !== 'undefined' ? window : {});\n\nvar style = {};\n\nif (canUseDOM) {\n style = document.createElement('div').style;\n}\n\nvar prefixedEventNames = {};\n\nexport function getVendorPrefixedEventName(eventName) {\n if (prefixedEventNames[eventName]) {\n return prefixedEventNames[eventName];\n }\n\n var prefixMap = vendorPrefixes[eventName];\n\n if (prefixMap) {\n var stylePropList = Object.keys(prefixMap);\n var len = stylePropList.length;\n for (var i = 0; i < len; i += 1) {\n var styleProp = stylePropList[i];\n if (Object.prototype.hasOwnProperty.call(prefixMap, styleProp) && styleProp in style) {\n prefixedEventNames[eventName] = prefixMap[styleProp];\n return prefixedEventNames[eventName];\n }\n }\n }\n\n return '';\n}\n\nexport var animationEndName = getVendorPrefixedEventName('animationend');\nexport var transitionEndName = getVendorPrefixedEventName('transitionend');\nexport var supportTransition = !!(animationEndName && transitionEndName);\n\nexport function getTransitionName(transitionName, transitionType) {\n if (!transitionName) return null;\n\n if (typeof transitionName === 'object') {\n var type = transitionType.replace(/-\\w/g, function (match) {\n return match[1].toUpperCase();\n });\n return transitionName[type];\n }\n\n return transitionName + '-' + transitionType;\n}","var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/* eslint-disable react/default-props-match-prop-types, react/no-multi-comp, react/prop-types */\nimport React from 'react';\nimport findDOMNode from 'rc-util/es/Dom/findDOMNode';\nimport classNames from 'classnames';\nimport raf from 'raf';\nimport { getTransitionName, animationEndName, transitionEndName, supportTransition } from './util/motion';\n\nvar STATUS_NONE = 'none';\nvar STATUS_APPEAR = 'appear';\nvar STATUS_ENTER = 'enter';\nvar STATUS_LEAVE = 'leave';\n\n/**\n * `transitionSupport` is used for none transition test case.\n * Default we use browser transition event support check.\n */\nexport function genCSSMotion(config) {\n var transitionSupport = config;\n var forwardRef = !!React.forwardRef;\n\n if (typeof config === 'object') {\n transitionSupport = config.transitionSupport;\n forwardRef = 'forwardRef' in config ? config.forwardRef : forwardRef;\n }\n\n function isSupportTransition(props) {\n return !!(props.motionName && transitionSupport);\n }\n\n var CSSMotion = function (_React$Component) {\n _inherits(CSSMotion, _React$Component);\n\n function CSSMotion() {\n _classCallCheck(this, CSSMotion);\n\n var _this = _possibleConstructorReturn(this, (CSSMotion.__proto__ || Object.getPrototypeOf(CSSMotion)).call(this));\n\n _this.onDomUpdate = function () {\n var _this$state = _this.state,\n status = _this$state.status,\n newStatus = _this$state.newStatus;\n var _this$props = _this.props,\n onAppearStart = _this$props.onAppearStart,\n onEnterStart = _this$props.onEnterStart,\n onLeaveStart = _this$props.onLeaveStart,\n onAppearActive = _this$props.onAppearActive,\n onEnterActive = _this$props.onEnterActive,\n onLeaveActive = _this$props.onLeaveActive,\n motionAppear = _this$props.motionAppear,\n motionEnter = _this$props.motionEnter,\n motionLeave = _this$props.motionLeave;\n\n\n if (!isSupportTransition(_this.props)) {\n return;\n }\n\n // Event injection\n var $ele = _this.getElement();\n if (_this.$cacheEle !== $ele) {\n _this.removeEventListener(_this.$cacheEle);\n _this.addEventListener($ele);\n _this.$cacheEle = $ele;\n }\n\n // Init status\n if (newStatus && status === STATUS_APPEAR && motionAppear) {\n _this.updateStatus(onAppearStart, null, null, function () {\n _this.updateActiveStatus(onAppearActive, STATUS_APPEAR);\n });\n } else if (newStatus && status === STATUS_ENTER && motionEnter) {\n _this.updateStatus(onEnterStart, null, null, function () {\n _this.updateActiveStatus(onEnterActive, STATUS_ENTER);\n });\n } else if (newStatus && status === STATUS_LEAVE && motionLeave) {\n _this.updateStatus(onLeaveStart, null, null, function () {\n _this.updateActiveStatus(onLeaveActive, STATUS_LEAVE);\n });\n }\n };\n\n _this.onMotionEnd = function (event) {\n var _this$state2 = _this.state,\n status = _this$state2.status,\n statusActive = _this$state2.statusActive;\n var _this$props2 = _this.props,\n onAppearEnd = _this$props2.onAppearEnd,\n onEnterEnd = _this$props2.onEnterEnd,\n onLeaveEnd = _this$props2.onLeaveEnd;\n\n if (status === STATUS_APPEAR && statusActive) {\n _this.updateStatus(onAppearEnd, { status: STATUS_NONE }, event);\n } else if (status === STATUS_ENTER && statusActive) {\n _this.updateStatus(onEnterEnd, { status: STATUS_NONE }, event);\n } else if (status === STATUS_LEAVE && statusActive) {\n _this.updateStatus(onLeaveEnd, { status: STATUS_NONE }, event);\n }\n };\n\n _this.setNodeRef = function (node) {\n var internalRef = _this.props.internalRef;\n\n _this.node = node;\n\n if (typeof internalRef === 'function') {\n internalRef(node);\n } else if (internalRef && 'current' in internalRef) {\n internalRef.current = node;\n }\n };\n\n _this.getElement = function () {\n try {\n return findDOMNode(_this.node || _this);\n } catch (e) {\n /**\n * Fallback to cache element.\n * This is only happen when `motionDeadline` trigger but element removed.\n */\n return _this.$cacheEle;\n }\n };\n\n _this.addEventListener = function ($ele) {\n if (!$ele) return;\n\n $ele.addEventListener(transitionEndName, _this.onMotionEnd);\n $ele.addEventListener(animationEndName, _this.onMotionEnd);\n };\n\n _this.removeEventListener = function ($ele) {\n if (!$ele) return;\n\n $ele.removeEventListener(transitionEndName, _this.onMotionEnd);\n $ele.removeEventListener(animationEndName, _this.onMotionEnd);\n };\n\n _this.updateStatus = function (styleFunc, additionalState, event, callback) {\n var statusStyle = styleFunc ? styleFunc(_this.getElement(), event) : null;\n\n if (statusStyle === false || _this._destroyed) return;\n\n var nextStep = void 0;\n if (callback) {\n nextStep = function nextStep() {\n _this.nextFrame(callback);\n };\n }\n\n _this.setState(_extends({\n statusStyle: typeof statusStyle === 'object' ? statusStyle : null,\n newStatus: false\n }, additionalState), nextStep); // Trigger before next frame & after `componentDidMount`\n };\n\n _this.updateActiveStatus = function (styleFunc, currentStatus) {\n // `setState` use `postMessage` to trigger at the end of frame.\n // Let's use requestAnimationFrame to update new state in next frame.\n _this.nextFrame(function () {\n var status = _this.state.status;\n\n if (status !== currentStatus) return;\n\n var motionDeadline = _this.props.motionDeadline;\n\n\n _this.updateStatus(styleFunc, { statusActive: true });\n\n if (motionDeadline > 0) {\n setTimeout(function () {\n _this.onMotionEnd({\n deadline: true\n });\n }, motionDeadline);\n }\n });\n };\n\n _this.nextFrame = function (func) {\n _this.cancelNextFrame();\n _this.raf = raf(func);\n };\n\n _this.cancelNextFrame = function () {\n if (_this.raf) {\n raf.cancel(_this.raf);\n _this.raf = null;\n }\n };\n\n _this.state = {\n status: STATUS_NONE,\n statusActive: false,\n newStatus: false,\n statusStyle: null\n };\n _this.$cacheEle = null;\n _this.node = null;\n _this.raf = null;\n return _this;\n }\n\n _createClass(CSSMotion, [{\n key: 'componentDidMount',\n value: function componentDidMount() {\n this.onDomUpdate();\n }\n }, {\n key: 'componentDidUpdate',\n value: function componentDidUpdate() {\n this.onDomUpdate();\n }\n }, {\n key: 'componentWillUnmount',\n value: function componentWillUnmount() {\n this._destroyed = true;\n this.removeEventListener(this.$cacheEle);\n this.cancelNextFrame();\n }\n }, {\n key: 'render',\n value: function render() {\n var _classNames;\n\n var _state = this.state,\n status = _state.status,\n statusActive = _state.statusActive,\n statusStyle = _state.statusStyle;\n var _props = this.props,\n children = _props.children,\n motionName = _props.motionName,\n visible = _props.visible,\n removeOnLeave = _props.removeOnLeave,\n leavedClassName = _props.leavedClassName,\n eventProps = _props.eventProps;\n\n\n if (!children) return null;\n\n if (status === STATUS_NONE || !isSupportTransition(this.props)) {\n if (visible) {\n return children(_extends({}, eventProps), this.setNodeRef);\n } else if (!removeOnLeave) {\n return children(_extends({}, eventProps, { className: leavedClassName }), this.setNodeRef);\n }\n\n return null;\n }\n\n return children(_extends({}, eventProps, {\n className: classNames((_classNames = {}, _defineProperty(_classNames, getTransitionName(motionName, status), status !== STATUS_NONE), _defineProperty(_classNames, getTransitionName(motionName, status + '-active'), status !== STATUS_NONE && statusActive), _defineProperty(_classNames, motionName, typeof motionName === 'string'), _classNames)),\n style: statusStyle\n }), this.setNodeRef);\n }\n }], [{\n key: 'getDerivedStateFromProps',\n value: function getDerivedStateFromProps(props, _ref) {\n var prevProps = _ref.prevProps,\n prevStatus = _ref.status;\n\n if (!isSupportTransition(props)) return {};\n\n var visible = props.visible,\n motionAppear = props.motionAppear,\n motionEnter = props.motionEnter,\n motionLeave = props.motionLeave,\n motionLeaveImmediately = props.motionLeaveImmediately;\n\n var newState = {\n prevProps: props\n };\n\n // Clean up status if prop set to false\n if (prevStatus === STATUS_APPEAR && !motionAppear || prevStatus === STATUS_ENTER && !motionEnter || prevStatus === STATUS_LEAVE && !motionLeave) {\n newState.status = STATUS_NONE;\n newState.statusActive = false;\n newState.newStatus = false;\n }\n\n // Appear\n if (!prevProps && visible && motionAppear) {\n newState.status = STATUS_APPEAR;\n newState.statusActive = false;\n newState.newStatus = true;\n }\n\n // Enter\n if (prevProps && !prevProps.visible && visible && motionEnter) {\n newState.status = STATUS_ENTER;\n newState.statusActive = false;\n newState.newStatus = true;\n }\n\n // Leave\n if (prevProps && prevProps.visible && !visible && motionLeave || !prevProps && motionLeaveImmediately && !visible && motionLeave) {\n newState.status = STATUS_LEAVE;\n newState.statusActive = false;\n newState.newStatus = true;\n }\n\n return newState;\n }\n }]);\n\n return CSSMotion;\n }(React.Component);\n\n CSSMotion.defaultProps = {\n visible: true,\n motionEnter: true,\n motionAppear: true,\n motionLeave: true,\n removeOnLeave: true\n };\n\n\n if (!forwardRef) {\n return CSSMotion;\n }\n\n return React.forwardRef(function (props, ref) {\n return React.createElement(CSSMotion, _extends({ internalRef: ref }, props));\n });\n}\n\nexport default genCSSMotion(supportTransition);","var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nexport var STATUS_ADD = 'add';\nexport var STATUS_KEEP = 'keep';\nexport var STATUS_REMOVE = 'remove';\nexport var STATUS_REMOVED = 'removed';\n\nexport function wrapKeyToObject(key) {\n var keyObj = void 0;\n if (key && typeof key === 'object' && 'key' in key) {\n keyObj = key;\n } else {\n keyObj = { key: key };\n }\n return _extends({}, keyObj, {\n key: String(keyObj.key)\n });\n}\n\nexport function parseKeys() {\n var keys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n\n return keys.map(wrapKeyToObject);\n}\n\nexport function diffKeys() {\n var prevKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var currentKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n\n var list = [];\n var currentIndex = 0;\n var currentLen = currentKeys.length;\n\n var prevKeyObjects = parseKeys(prevKeys);\n var currentKeyObjects = parseKeys(currentKeys);\n\n // Check prev keys to insert or keep\n prevKeyObjects.forEach(function (keyObj) {\n var hit = false;\n\n for (var i = currentIndex; i < currentLen; i += 1) {\n var currentKeyObj = currentKeyObjects[i];\n if (currentKeyObj.key === keyObj.key) {\n // New added keys should add before current key\n if (currentIndex < i) {\n list = list.concat(currentKeyObjects.slice(currentIndex, i).map(function (obj) {\n return _extends({}, obj, { status: STATUS_ADD });\n }));\n currentIndex = i;\n }\n list.push(_extends({}, currentKeyObj, {\n status: STATUS_KEEP\n }));\n currentIndex += 1;\n\n hit = true;\n break;\n }\n }\n\n // If not hit, it means key is removed\n if (!hit) {\n list.push(_extends({}, keyObj, {\n status: STATUS_REMOVE\n }));\n }\n });\n\n // Add rest to the list\n if (currentIndex < currentLen) {\n list = list.concat(currentKeyObjects.slice(currentIndex).map(function (obj) {\n return _extends({}, obj, { status: STATUS_ADD });\n }));\n }\n\n /**\n * Merge same key when it remove and add again:\n * [1 - add, 2 - keep, 1 - remove] -> [1 - keep, 2 - keep]\n */\n var keys = {};\n list.forEach(function (_ref) {\n var key = _ref.key;\n\n keys[key] = (keys[key] || 0) + 1;\n });\n var duplicatedKeys = Object.keys(keys).filter(function (key) {\n return keys[key] > 1;\n });\n duplicatedKeys.forEach(function (matchKey) {\n // Remove `STATUS_REMOVE` node.\n list = list.filter(function (_ref2) {\n var key = _ref2.key,\n status = _ref2.status;\n return key !== matchKey || status !== STATUS_REMOVE;\n });\n\n // Update `STATUS_ADD` to `STATUS_KEEP`\n list.forEach(function (node) {\n if (node.key === matchKey) {\n node.status = STATUS_KEEP;\n }\n });\n });\n\n return list;\n}","var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/* eslint react/prop-types: 0 */\nimport React from 'react';\nimport OriginCSSMotion from './CSSMotion';\nimport { supportTransition } from './util/motion';\nimport { STATUS_ADD, STATUS_KEEP, STATUS_REMOVE, STATUS_REMOVED, diffKeys, parseKeys } from './util/diff';\n\nvar MOTION_PROP_NAMES = ['eventProps', 'visible', 'children', 'motionName', 'motionAppear', 'motionEnter', 'motionLeave', 'motionLeaveImmediately', 'motionDeadline', 'removeOnLeave', 'leavedClassName', 'onAppearStart', 'onAppearActive', 'onAppearEnd', 'onEnterStart', 'onEnterActive', 'onEnterEnd', 'onLeaveStart', 'onLeaveActive', 'onLeaveEnd'];\n\nexport function genCSSMotionList(transitionSupport) {\n var CSSMotion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : OriginCSSMotion;\n\n var CSSMotionList = function (_React$Component) {\n _inherits(CSSMotionList, _React$Component);\n\n function CSSMotionList() {\n var _ref;\n\n var _temp, _this, _ret;\n\n _classCallCheck(this, CSSMotionList);\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = CSSMotionList.__proto__ || Object.getPrototypeOf(CSSMotionList)).call.apply(_ref, [this].concat(args))), _this), _this.state = {\n keyEntities: []\n }, _this.removeKey = function (removeKey) {\n _this.setState(function (_ref2) {\n var keyEntities = _ref2.keyEntities;\n return {\n keyEntities: keyEntities.map(function (entity) {\n if (entity.key !== removeKey) return entity;\n return _extends({}, entity, {\n status: STATUS_REMOVED\n });\n })\n };\n });\n }, _temp), _possibleConstructorReturn(_this, _ret);\n }\n\n _createClass(CSSMotionList, [{\n key: 'render',\n value: function render() {\n var _this2 = this;\n\n var keyEntities = this.state.keyEntities;\n\n var _props = this.props,\n component = _props.component,\n children = _props.children,\n restProps = _objectWithoutProperties(_props, ['component', 'children']);\n\n var Component = component || React.Fragment;\n\n var motionProps = {};\n MOTION_PROP_NAMES.forEach(function (prop) {\n motionProps[prop] = restProps[prop];\n delete restProps[prop];\n });\n delete restProps.keys;\n\n return React.createElement(\n Component,\n restProps,\n keyEntities.map(function (_ref3) {\n var status = _ref3.status,\n eventProps = _objectWithoutProperties(_ref3, ['status']);\n\n var visible = status === STATUS_ADD || status === STATUS_KEEP;\n return React.createElement(\n CSSMotion,\n _extends({}, motionProps, {\n key: eventProps.key,\n visible: visible,\n eventProps: eventProps,\n onLeaveEnd: function onLeaveEnd() {\n if (motionProps.onLeaveEnd) {\n motionProps.onLeaveEnd.apply(motionProps, arguments);\n }\n _this2.removeKey(eventProps.key);\n }\n }),\n children\n );\n })\n );\n }\n }], [{\n key: 'getDerivedStateFromProps',\n value: function getDerivedStateFromProps(_ref4, _ref5) {\n var keys = _ref4.keys;\n var keyEntities = _ref5.keyEntities;\n\n var parsedKeyObjects = parseKeys(keys);\n\n // Always as keep when motion not support\n if (!transitionSupport) {\n return {\n keyEntities: parsedKeyObjects.map(function (obj) {\n return _extends({}, obj, { status: STATUS_KEEP });\n })\n };\n }\n\n var mixedKeyEntities = diffKeys(keyEntities, parsedKeyObjects);\n\n var keyEntitiesLen = keyEntities.length;\n return {\n keyEntities: mixedKeyEntities.filter(function (entity) {\n // IE 9 not support Array.prototype.find\n var prevEntity = null;\n for (var i = 0; i < keyEntitiesLen; i += 1) {\n var currentEntity = keyEntities[i];\n if (currentEntity.key === entity.key) {\n prevEntity = currentEntity;\n break;\n }\n }\n\n // Remove if already mark as removed\n if (prevEntity && prevEntity.status === STATUS_REMOVED && entity.status === STATUS_REMOVE) {\n return false;\n }\n return true;\n })\n };\n }\n }]);\n\n return CSSMotionList;\n }(React.Component);\n\n CSSMotionList.defaultProps = {\n component: 'div'\n };\n\n\n return CSSMotionList;\n}\n\nexport default genCSSMotionList(supportTransition);","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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\nimport React from 'react';\nimport { composeRef } from \"rc-util/es/ref\";\n\nvar Input = function Input(_ref, ref) {\n var prefixCls = _ref.prefixCls,\n id = _ref.id,\n inputElement = _ref.inputElement,\n disabled = _ref.disabled,\n tabIndex = _ref.tabIndex,\n autoFocus = _ref.autoFocus,\n autoComplete = _ref.autoComplete,\n editable = _ref.editable,\n accessibilityIndex = _ref.accessibilityIndex,\n value = _ref.value,\n _onKeyDown = _ref.onKeyDown,\n _onMouseDown = _ref.onMouseDown,\n _onChange = _ref.onChange,\n onPaste = _ref.onPaste,\n open = _ref.open;\n var inputNode = inputElement || React.createElement(\"input\", null);\n var _inputNode = inputNode,\n originRef = _inputNode.ref,\n _inputNode$props = _inputNode.props,\n onOriginKeyDown = _inputNode$props.onKeyDown,\n onOriginChange = _inputNode$props.onChange,\n onOriginMouseDown = _inputNode$props.onMouseDown,\n style = _inputNode$props.style;\n inputNode = React.cloneElement(inputNode, {\n id: id,\n ref: composeRef(ref, originRef),\n disabled: disabled,\n tabIndex: tabIndex,\n autoComplete: autoComplete || 'off',\n autoFocus: autoFocus,\n className: \"\".concat(prefixCls, \"-selection-search-input\"),\n style: _objectSpread(_objectSpread({}, style), {}, {\n opacity: editable ? null : 0\n }),\n role: 'combobox',\n 'aria-expanded': open,\n 'aria-haspopup': 'listbox',\n 'aria-owns': \"\".concat(id, \"_list\"),\n 'aria-autocomplete': 'list',\n 'aria-controls': \"\".concat(id, \"_list\"),\n 'aria-activedescendant': \"\".concat(id, \"_list_\").concat(accessibilityIndex),\n value: editable ? value : '',\n readOnly: !editable,\n onKeyDown: function onKeyDown(event) {\n _onKeyDown(event);\n\n if (onOriginKeyDown) {\n onOriginKeyDown(event);\n }\n },\n onMouseDown: function onMouseDown(event) {\n _onMouseDown(event);\n\n if (onOriginMouseDown) {\n onOriginMouseDown(event);\n }\n },\n onChange: function onChange(event) {\n _onChange(event);\n\n if (onOriginChange) {\n onOriginChange(event);\n }\n },\n onPaste: onPaste\n });\n return inputNode;\n};\n\nvar RefInput = React.forwardRef(Input);\nRefInput.displayName = 'Input';\nexport default RefInput;","/* eslint-disable react-hooks/rules-of-hooks */\nimport * as React from 'react';\nimport { isBrowserClient } from '../utils/commonUtil';\n/**\n * Wrap `React.useLayoutEffect` which will not throw warning message in test env\n */\n\nexport default function useLayoutEffect(effect, deps) {\n // Never happen in test env\n if (isBrowserClient) {\n /* istanbul ignore next */\n React.useLayoutEffect(effect, deps);\n } else {\n React.useEffect(effect, deps);\n }\n}\n/* eslint-enable */","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nimport React from 'react';\nimport classNames from 'classnames';\nimport CSSMotionList from \"rc-animate/es/CSSMotionList\";\nimport TransBtn from '../TransBtn';\nimport Input from './Input';\nimport useLayoutEffect from '../hooks/useLayoutEffect';\nvar REST_TAG_KEY = '__RC_SELECT_MAX_REST_COUNT__';\n\nvar SelectSelector = function SelectSelector(_ref) {\n var id = _ref.id,\n prefixCls = _ref.prefixCls,\n values = _ref.values,\n open = _ref.open,\n searchValue = _ref.searchValue,\n inputRef = _ref.inputRef,\n placeholder = _ref.placeholder,\n disabled = _ref.disabled,\n mode = _ref.mode,\n showSearch = _ref.showSearch,\n autoFocus = _ref.autoFocus,\n autoComplete = _ref.autoComplete,\n accessibilityIndex = _ref.accessibilityIndex,\n tabIndex = _ref.tabIndex,\n removeIcon = _ref.removeIcon,\n choiceTransitionName = _ref.choiceTransitionName,\n maxTagCount = _ref.maxTagCount,\n maxTagTextLength = _ref.maxTagTextLength,\n _ref$maxTagPlaceholde = _ref.maxTagPlaceholder,\n maxTagPlaceholder = _ref$maxTagPlaceholde === void 0 ? function (omittedValues) {\n return \"+ \".concat(omittedValues.length, \" ...\");\n } : _ref$maxTagPlaceholde,\n tagRender = _ref.tagRender,\n onSelect = _ref.onSelect,\n onInputChange = _ref.onInputChange,\n onInputPaste = _ref.onInputPaste,\n onInputKeyDown = _ref.onInputKeyDown,\n onInputMouseDown = _ref.onInputMouseDown;\n\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n motionAppear = _React$useState2[0],\n setMotionAppear = _React$useState2[1];\n\n var measureRef = React.useRef(null);\n\n var _React$useState3 = React.useState(0),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n inputWidth = _React$useState4[0],\n setInputWidth = _React$useState4[1]; // ===================== Motion ======================\n\n\n React.useEffect(function () {\n setMotionAppear(true);\n }, []); // ===================== Search ======================\n\n var inputValue = open ? searchValue : '';\n var inputEditable = mode === 'tags' || open && showSearch; // We measure width and set to the input immediately\n\n useLayoutEffect(function () {\n setInputWidth(measureRef.current.scrollWidth);\n }, [inputValue]); // ==================== Selection ====================\n\n var displayValues = values; // Cut by `maxTagCount`\n\n var restCount;\n\n if (typeof maxTagCount === 'number') {\n restCount = values.length - maxTagCount;\n displayValues = values.slice(0, maxTagCount);\n } // Update by `maxTagTextLength`\n\n\n if (typeof maxTagTextLength === 'number') {\n displayValues = displayValues.map(function (_ref2) {\n var label = _ref2.label,\n rest = _objectWithoutProperties(_ref2, [\"label\"]);\n\n var displayLabel = label;\n\n if (typeof label === 'string' || typeof label === 'number') {\n var strLabel = String(displayLabel);\n\n if (strLabel.length > maxTagTextLength) {\n displayLabel = \"\".concat(strLabel.slice(0, maxTagTextLength), \"...\");\n }\n }\n\n return _objectSpread(_objectSpread({}, rest), {}, {\n label: displayLabel\n });\n });\n } // Fill rest\n\n\n if (restCount > 0) {\n displayValues.push({\n key: REST_TAG_KEY,\n label: typeof maxTagPlaceholder === 'function' ? maxTagPlaceholder(values.slice(maxTagCount)) : maxTagPlaceholder\n });\n }\n\n var selectionNode = React.createElement(CSSMotionList, {\n component: false,\n keys: displayValues,\n motionName: choiceTransitionName,\n motionAppear: motionAppear\n }, function (_ref3) {\n var key = _ref3.key,\n label = _ref3.label,\n value = _ref3.value,\n itemDisabled = _ref3.disabled,\n className = _ref3.className,\n style = _ref3.style;\n var mergedKey = key || value;\n var closable = key !== REST_TAG_KEY && !itemDisabled;\n\n var onMouseDown = function onMouseDown(event) {\n event.preventDefault();\n event.stopPropagation();\n };\n\n var onClose = function onClose(event) {\n if (event) event.stopPropagation();\n onSelect(value, {\n selected: false\n });\n };\n\n return typeof tagRender === 'function' ? React.createElement(\"span\", {\n key: mergedKey,\n onMouseDown: onMouseDown,\n className: className,\n style: style\n }, tagRender({\n label: label,\n value: value,\n disabled: itemDisabled,\n closable: closable,\n onClose: onClose\n })) : React.createElement(\"span\", {\n key: mergedKey,\n className: classNames(className, \"\".concat(prefixCls, \"-selection-item\"), _defineProperty({}, \"\".concat(prefixCls, \"-selection-item-disabled\"), itemDisabled)),\n style: style\n }, React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-selection-item-content\")\n }, label), closable && React.createElement(TransBtn, {\n className: \"\".concat(prefixCls, \"-selection-item-remove\"),\n onMouseDown: onMouseDown,\n onClick: onClose,\n customizeIcon: removeIcon\n }, \"\\xD7\"));\n });\n return React.createElement(React.Fragment, null, selectionNode, React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-selection-search\"),\n style: {\n width: inputWidth\n }\n }, React.createElement(Input, {\n ref: inputRef,\n open: open,\n prefixCls: prefixCls,\n id: id,\n inputElement: null,\n disabled: disabled,\n autoFocus: autoFocus,\n autoComplete: autoComplete,\n editable: inputEditable,\n accessibilityIndex: accessibilityIndex,\n value: inputValue,\n onKeyDown: onInputKeyDown,\n onMouseDown: onInputMouseDown,\n onChange: onInputChange,\n onPaste: onInputPaste,\n tabIndex: tabIndex\n }), React.createElement(\"span\", {\n ref: measureRef,\n className: \"\".concat(prefixCls, \"-selection-search-mirror\"),\n \"aria-hidden\": true\n }, inputValue, \"\\xA0\")), !values.length && !inputValue && React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-selection-placeholder\")\n }, placeholder));\n};\n\nexport default SelectSelector;","import React from 'react';\nimport Input from './Input';\n\nvar SingleSelector = function SingleSelector(_ref) {\n var inputElement = _ref.inputElement,\n prefixCls = _ref.prefixCls,\n id = _ref.id,\n inputRef = _ref.inputRef,\n disabled = _ref.disabled,\n autoFocus = _ref.autoFocus,\n autoComplete = _ref.autoComplete,\n accessibilityIndex = _ref.accessibilityIndex,\n mode = _ref.mode,\n open = _ref.open,\n values = _ref.values,\n placeholder = _ref.placeholder,\n tabIndex = _ref.tabIndex,\n showSearch = _ref.showSearch,\n searchValue = _ref.searchValue,\n activeValue = _ref.activeValue,\n onInputKeyDown = _ref.onInputKeyDown,\n onInputMouseDown = _ref.onInputMouseDown,\n onInputChange = _ref.onInputChange,\n onInputPaste = _ref.onInputPaste;\n var combobox = mode === 'combobox';\n var inputEditable = combobox || showSearch && open;\n var item = values[0];\n\n var getDisplayValue = function getDisplayValue(value) {\n return value === null ? '' : String(value);\n };\n\n var inputValue = searchValue;\n\n if (combobox) {\n inputValue = item ? getDisplayValue(item.value) : activeValue || searchValue;\n } // Not show text when closed expect combobox mode\n\n\n var hasTextInput = mode !== 'combobox' && !open ? false : !!inputValue;\n return React.createElement(React.Fragment, null, React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-selection-search\")\n }, React.createElement(Input, {\n ref: inputRef,\n prefixCls: prefixCls,\n id: id,\n open: open,\n inputElement: inputElement,\n disabled: disabled,\n autoFocus: autoFocus,\n autoComplete: autoComplete,\n editable: inputEditable,\n accessibilityIndex: accessibilityIndex,\n value: inputValue,\n onKeyDown: onInputKeyDown,\n onMouseDown: onInputMouseDown,\n onChange: onInputChange,\n onPaste: onInputPaste,\n tabIndex: tabIndex\n })), !combobox && item && !hasTextInput && React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-selection-item\")\n }, item.label), !item && !hasTextInput && React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-selection-placeholder\")\n }, placeholder));\n};\n\nexport default SingleSelector;","import * as React from 'react';\n/**\n * Locker return cached mark.\n * If set to `true`, will return `true` in a short time even if set `false`.\n * If set to `false` and then set to `true`, will change to `true`.\n * And after time duration, it will back to `null` automatically.\n */\n\nexport default function useLock() {\n var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 250;\n var lockRef = React.useRef(null);\n var timeoutRef = React.useRef(null); // Clean up\n\n React.useEffect(function () {\n return function () {\n window.clearTimeout(timeoutRef.current);\n };\n }, []);\n\n function doLock(locked) {\n if (locked || lockRef.current === null) {\n lockRef.current = locked;\n }\n\n window.clearTimeout(timeoutRef.current);\n timeoutRef.current = window.setTimeout(function () {\n lockRef.current = null;\n }, duration);\n }\n\n return [function () {\n return lockRef.current;\n }, doLock];\n}","function _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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\n/**\n * Cursor rule:\n * 1. Only `showSearch` enabled\n * 2. Only `open` is `true`\n * 3. When typing, set `open` to `true` which hit rule of 2\n *\n * Accessibility:\n * - https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html\n */\nimport * as React from 'react';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport MultipleSelector from './MultipleSelector';\nimport SingleSelector from './SingleSelector';\nimport useLock from '../hooks/useLock';\n\nvar Selector = function Selector(props, ref) {\n var inputRef = React.useRef(null);\n var prefixCls = props.prefixCls,\n multiple = props.multiple,\n open = props.open,\n mode = props.mode,\n showSearch = props.showSearch,\n onSearch = props.onSearch,\n onToggleOpen = props.onToggleOpen,\n onInputKeyDown = props.onInputKeyDown,\n domRef = props.domRef; // ======================= Ref =======================\n\n React.useImperativeHandle(ref, function () {\n return {\n focus: function focus() {\n inputRef.current.focus();\n },\n blur: function blur() {\n inputRef.current.blur();\n }\n };\n }); // ====================== Input ======================\n\n var _useLock = useLock(0),\n _useLock2 = _slicedToArray(_useLock, 2),\n getInputMouseDown = _useLock2[0],\n setInputMouseDown = _useLock2[1];\n\n var onInternalInputKeyDown = function onInternalInputKeyDown(event) {\n var which = event.which;\n\n if (which === KeyCode.UP || which === KeyCode.DOWN) {\n event.preventDefault();\n }\n\n if (onInputKeyDown) {\n onInputKeyDown(event);\n }\n\n if (![KeyCode.SHIFT, KeyCode.TAB, KeyCode.BACKSPACE, KeyCode.ESC].includes(which)) {\n onToggleOpen(true);\n }\n };\n /**\n * We can not use `findDOMNode` sine it will get warning,\n * have to use timer to check if is input element.\n */\n\n\n var onInternalInputMouseDown = function onInternalInputMouseDown() {\n setInputMouseDown(true);\n }; // When paste come, ignore next onChange\n\n\n var pasteClearRef = React.useRef(false);\n\n var triggerOnSearch = function triggerOnSearch(value) {\n if (onSearch(value) !== false) {\n onToggleOpen(true);\n }\n };\n\n var onInputChange = function onInputChange(_ref) {\n var value = _ref.target.value;\n\n if (pasteClearRef.current) {\n pasteClearRef.current = false;\n return;\n }\n\n triggerOnSearch(value);\n };\n\n var onInputPaste = function onInputPaste(e) {\n var clipboardData = e.clipboardData;\n var value = clipboardData.getData('text'); // Block next onChange\n\n pasteClearRef.current = true;\n setTimeout(function () {\n pasteClearRef.current = false;\n });\n triggerOnSearch(value);\n }; // ====================== Focus ======================\n // Should focus input if click the selector\n\n\n var onClick = function onClick(_ref2) {\n var target = _ref2.target;\n\n if (target !== inputRef.current) {\n inputRef.current.focus();\n }\n };\n\n var onMouseDown = function onMouseDown(event) {\n var inputMouseDown = getInputMouseDown();\n\n if (event.target !== inputRef.current && !inputMouseDown) {\n event.preventDefault();\n }\n\n if (mode !== 'combobox' && (!showSearch || !inputMouseDown) || !open) {\n if (open) {\n onSearch('');\n }\n\n onToggleOpen();\n }\n }; // ================= Inner Selector ==================\n\n\n var sharedProps = {\n inputRef: inputRef,\n onInputKeyDown: onInternalInputKeyDown,\n onInputMouseDown: onInternalInputMouseDown,\n onInputChange: onInputChange,\n onInputPaste: onInputPaste\n };\n var selectNode = multiple ? React.createElement(MultipleSelector, Object.assign({}, props, sharedProps)) : React.createElement(SingleSelector, Object.assign({}, props, sharedProps));\n return React.createElement(\"div\", {\n ref: domRef,\n className: \"\".concat(prefixCls, \"-selector\"),\n onClick: onClick,\n onMouseDown: onMouseDown\n }, selectNode);\n};\n\nvar ForwardSelector = React.forwardRef(Selector);\nForwardSelector.displayName = 'Selector';\nexport default ForwardSelector;","export default function contains(root, n) {\n var node = n;\n\n while (node) {\n if (node === root) {\n return true;\n }\n\n node = node.parentNode;\n }\n\n return false;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\n\nvar Portal = /*#__PURE__*/function (_React$Component) {\n _inherits(Portal, _React$Component);\n\n var _super = _createSuper(Portal);\n\n function Portal() {\n _classCallCheck(this, Portal);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Portal, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.createContainer();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n var didUpdate = this.props.didUpdate;\n\n if (didUpdate) {\n didUpdate(prevProps);\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.removeContainer();\n }\n }, {\n key: \"createContainer\",\n value: function createContainer() {\n this._container = this.props.getContainer();\n this.forceUpdate();\n }\n }, {\n key: \"removeContainer\",\n value: function removeContainer() {\n if (this._container) {\n this._container.parentNode.removeChild(this._container);\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n if (this._container) {\n return ReactDOM.createPortal(this.props.children, this._container);\n }\n\n return null;\n }\n }]);\n\n return Portal;\n}(React.Component);\n\nPortal.propTypes = {\n getContainer: PropTypes.func.isRequired,\n children: PropTypes.node.isRequired,\n didUpdate: PropTypes.func\n};\nexport { Portal as default };","function _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(source, true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(source).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nvar vendorPrefix;\nvar jsCssMap = {\n Webkit: '-webkit-',\n Moz: '-moz-',\n // IE did it wrong again ...\n ms: '-ms-',\n O: '-o-'\n};\n\nfunction getVendorPrefix() {\n if (vendorPrefix !== undefined) {\n return vendorPrefix;\n }\n\n vendorPrefix = '';\n var style = document.createElement('p').style;\n var testProp = 'Transform';\n\n for (var key in jsCssMap) {\n if (key + testProp in style) {\n vendorPrefix = key;\n }\n }\n\n return vendorPrefix;\n}\n\nfunction getTransitionName() {\n return getVendorPrefix() ? \"\".concat(getVendorPrefix(), \"TransitionProperty\") : 'transitionProperty';\n}\n\nfunction getTransformName() {\n return getVendorPrefix() ? \"\".concat(getVendorPrefix(), \"Transform\") : 'transform';\n}\nfunction setTransitionProperty(node, value) {\n var name = getTransitionName();\n\n if (name) {\n node.style[name] = value;\n\n if (name !== 'transitionProperty') {\n node.style.transitionProperty = value;\n }\n }\n}\n\nfunction setTransform(node, value) {\n var name = getTransformName();\n\n if (name) {\n node.style[name] = value;\n\n if (name !== 'transform') {\n node.style.transform = value;\n }\n }\n}\n\nfunction getTransitionProperty(node) {\n return node.style.transitionProperty || node.style[getTransitionName()];\n}\nfunction getTransformXY(node) {\n var style = window.getComputedStyle(node, null);\n var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());\n\n if (transform && transform !== 'none') {\n var matrix = transform.replace(/[^0-9\\-.,]/g, '').split(',');\n return {\n x: parseFloat(matrix[12] || matrix[4], 0),\n y: parseFloat(matrix[13] || matrix[5], 0)\n };\n }\n\n return {\n x: 0,\n y: 0\n };\n}\nvar matrix2d = /matrix\\((.*)\\)/;\nvar matrix3d = /matrix3d\\((.*)\\)/;\nfunction setTransformXY(node, xy) {\n var style = window.getComputedStyle(node, null);\n var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());\n\n if (transform && transform !== 'none') {\n var arr;\n var match2d = transform.match(matrix2d);\n\n if (match2d) {\n match2d = match2d[1];\n arr = match2d.split(',').map(function (item) {\n return parseFloat(item, 10);\n });\n arr[4] = xy.x;\n arr[5] = xy.y;\n setTransform(node, \"matrix(\".concat(arr.join(','), \")\"));\n } else {\n var match3d = transform.match(matrix3d)[1];\n arr = match3d.split(',').map(function (item) {\n return parseFloat(item, 10);\n });\n arr[12] = xy.x;\n arr[13] = xy.y;\n setTransform(node, \"matrix3d(\".concat(arr.join(','), \")\"));\n }\n } else {\n setTransform(node, \"translateX(\".concat(xy.x, \"px) translateY(\").concat(xy.y, \"px) translateZ(0)\"));\n }\n}\n\nvar RE_NUM = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source;\nvar getComputedStyleX; // https://stackoverflow.com/a/3485654/3040605\n\nfunction forceRelayout(elem) {\n var originalStyle = elem.style.display;\n elem.style.display = 'none';\n elem.offsetHeight; // eslint-disable-line\n\n elem.style.display = originalStyle;\n}\n\nfunction css(el, name, v) {\n var value = v;\n\n if (_typeof(name) === 'object') {\n for (var i in name) {\n if (name.hasOwnProperty(i)) {\n css(el, i, name[i]);\n }\n }\n\n return undefined;\n }\n\n if (typeof value !== 'undefined') {\n if (typeof value === 'number') {\n value = \"\".concat(value, \"px\");\n }\n\n el.style[name] = value;\n return undefined;\n }\n\n return getComputedStyleX(el, name);\n}\n\nfunction getClientPosition(elem) {\n var box;\n var x;\n var y;\n var doc = elem.ownerDocument;\n var body = doc.body;\n var docElem = doc && doc.documentElement; // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式\n\n box = elem.getBoundingClientRect(); // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop\n // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确\n // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin\n\n x = box.left;\n y = box.top; // In IE, most of the time, 2 extra pixels are added to the top and left\n // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and\n // IE6 standards mode, this border can be overridden by setting the\n // document element's border to zero -- thus, we cannot rely on the\n // offset always being 2 pixels.\n // In quirks mode, the offset can be determined by querying the body's\n // clientLeft/clientTop, but in standards mode, it is found by querying\n // the document element's clientLeft/clientTop. Since we already called\n // getClientBoundingRect we have already forced a reflow, so it is not\n // too expensive just to query them all.\n // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的\n // 窗口边框标准是设 documentElement ,quirks 时设置 body\n // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去\n // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置\n // 标准 ie 下 docElem.clientTop 就是 border-top\n // ie7 html 即窗口边框改变不了。永远为 2\n // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0\n\n x -= docElem.clientLeft || body.clientLeft || 0;\n y -= docElem.clientTop || body.clientTop || 0;\n return {\n left: x,\n top: y\n };\n}\n\nfunction getScroll(w, top) {\n var ret = w[\"page\".concat(top ? 'Y' : 'X', \"Offset\")];\n var method = \"scroll\".concat(top ? 'Top' : 'Left');\n\n if (typeof ret !== 'number') {\n var d = w.document; // ie6,7,8 standard mode\n\n ret = d.documentElement[method];\n\n if (typeof ret !== 'number') {\n // quirks mode\n ret = d.body[method];\n }\n }\n\n return ret;\n}\n\nfunction getScrollLeft(w) {\n return getScroll(w);\n}\n\nfunction getScrollTop(w) {\n return getScroll(w, true);\n}\n\nfunction getOffset(el) {\n var pos = getClientPosition(el);\n var doc = el.ownerDocument;\n var w = doc.defaultView || doc.parentWindow;\n pos.left += getScrollLeft(w);\n pos.top += getScrollTop(w);\n return pos;\n}\n/**\n * A crude way of determining if an object is a window\n * @member util\n */\n\n\nfunction isWindow(obj) {\n // must use == for ie8\n\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}\n\nfunction getDocument(node) {\n if (isWindow(node)) {\n return node.document;\n }\n\n if (node.nodeType === 9) {\n return node;\n }\n\n return node.ownerDocument;\n}\n\nfunction _getComputedStyle(elem, name, cs) {\n var computedStyle = cs;\n var val = '';\n var d = getDocument(elem);\n computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null); // https://github.com/kissyteam/kissy/issues/61\n\n if (computedStyle) {\n val = computedStyle.getPropertyValue(name) || computedStyle[name];\n }\n\n return val;\n}\n\nvar _RE_NUM_NO_PX = new RegExp(\"^(\".concat(RE_NUM, \")(?!px)[a-z%]+$\"), 'i');\n\nvar RE_POS = /^(top|right|bottom|left)$/;\nvar CURRENT_STYLE = 'currentStyle';\nvar RUNTIME_STYLE = 'runtimeStyle';\nvar LEFT = 'left';\nvar PX = 'px';\n\nfunction _getComputedStyleIE(elem, name) {\n // currentStyle maybe null\n // http://msdn.microsoft.com/en-us/library/ms535231.aspx\n var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name]; // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值\n // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19\n // 在 ie 下不对,需要直接用 offset 方式\n // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了\n // From the awesome hack by Dean Edwards\n // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n // If we're not dealing with a regular pixel number\n // but a number that has a weird ending, we need to convert it to pixels\n // exclude left right for relativity\n\n if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {\n // Remember the original values\n var style = elem.style;\n var left = style[LEFT];\n var rsLeft = elem[RUNTIME_STYLE][LEFT]; // prevent flashing of content\n\n elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; // Put in the new values to get a computed value out\n\n style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;\n ret = style.pixelLeft + PX; // Revert the changed values\n\n style[LEFT] = left;\n elem[RUNTIME_STYLE][LEFT] = rsLeft;\n }\n\n return ret === '' ? 'auto' : ret;\n}\n\nif (typeof window !== 'undefined') {\n getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;\n}\n\nfunction getOffsetDirection(dir, option) {\n if (dir === 'left') {\n return option.useCssRight ? 'right' : dir;\n }\n\n return option.useCssBottom ? 'bottom' : dir;\n}\n\nfunction oppositeOffsetDirection(dir) {\n if (dir === 'left') {\n return 'right';\n } else if (dir === 'right') {\n return 'left';\n } else if (dir === 'top') {\n return 'bottom';\n } else if (dir === 'bottom') {\n return 'top';\n }\n} // 设置 elem 相对 elem.ownerDocument 的坐标\n\n\nfunction setLeftTop(elem, offset, option) {\n // set position first, in-case top/left are set even on static elem\n if (css(elem, 'position') === 'static') {\n elem.style.position = 'relative';\n }\n\n var presetH = -999;\n var presetV = -999;\n var horizontalProperty = getOffsetDirection('left', option);\n var verticalProperty = getOffsetDirection('top', option);\n var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty);\n var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);\n\n if (horizontalProperty !== 'left') {\n presetH = 999;\n }\n\n if (verticalProperty !== 'top') {\n presetV = 999;\n }\n\n var originalTransition = '';\n var originalOffset = getOffset(elem);\n\n if ('left' in offset || 'top' in offset) {\n originalTransition = getTransitionProperty(elem) || '';\n setTransitionProperty(elem, 'none');\n }\n\n if ('left' in offset) {\n elem.style[oppositeHorizontalProperty] = '';\n elem.style[horizontalProperty] = \"\".concat(presetH, \"px\");\n }\n\n if ('top' in offset) {\n elem.style[oppositeVerticalProperty] = '';\n elem.style[verticalProperty] = \"\".concat(presetV, \"px\");\n } // force relayout\n\n\n forceRelayout(elem);\n var old = getOffset(elem);\n var originalStyle = {};\n\n for (var key in offset) {\n if (offset.hasOwnProperty(key)) {\n var dir = getOffsetDirection(key, option);\n var preset = key === 'left' ? presetH : presetV;\n var off = originalOffset[key] - old[key];\n\n if (dir === key) {\n originalStyle[dir] = preset + off;\n } else {\n originalStyle[dir] = preset - off;\n }\n }\n }\n\n css(elem, originalStyle); // force relayout\n\n forceRelayout(elem);\n\n if ('left' in offset || 'top' in offset) {\n setTransitionProperty(elem, originalTransition);\n }\n\n var ret = {};\n\n for (var _key in offset) {\n if (offset.hasOwnProperty(_key)) {\n var _dir = getOffsetDirection(_key, option);\n\n var _off = offset[_key] - originalOffset[_key];\n\n if (_key === _dir) {\n ret[_dir] = originalStyle[_dir] + _off;\n } else {\n ret[_dir] = originalStyle[_dir] - _off;\n }\n }\n }\n\n css(elem, ret);\n}\n\nfunction setTransform$1(elem, offset) {\n var originalOffset = getOffset(elem);\n var originalXY = getTransformXY(elem);\n var resultXY = {\n x: originalXY.x,\n y: originalXY.y\n };\n\n if ('left' in offset) {\n resultXY.x = originalXY.x + offset.left - originalOffset.left;\n }\n\n if ('top' in offset) {\n resultXY.y = originalXY.y + offset.top - originalOffset.top;\n }\n\n setTransformXY(elem, resultXY);\n}\n\nfunction setOffset(elem, offset, option) {\n if (option.ignoreShake) {\n var oriOffset = getOffset(elem);\n var oLeft = oriOffset.left.toFixed(0);\n var oTop = oriOffset.top.toFixed(0);\n var tLeft = offset.left.toFixed(0);\n var tTop = offset.top.toFixed(0);\n\n if (oLeft === tLeft && oTop === tTop) {\n return;\n }\n }\n\n if (option.useCssRight || option.useCssBottom) {\n setLeftTop(elem, offset, option);\n } else if (option.useCssTransform && getTransformName() in document.body.style) {\n setTransform$1(elem, offset);\n } else {\n setLeftTop(elem, offset, option);\n }\n}\n\nfunction each(arr, fn) {\n for (var i = 0; i < arr.length; i++) {\n fn(arr[i]);\n }\n}\n\nfunction isBorderBoxFn(elem) {\n return getComputedStyleX(elem, 'boxSizing') === 'border-box';\n}\n\nvar BOX_MODELS = ['margin', 'border', 'padding'];\nvar CONTENT_INDEX = -1;\nvar PADDING_INDEX = 2;\nvar BORDER_INDEX = 1;\nvar MARGIN_INDEX = 0;\n\nfunction swap(elem, options, callback) {\n var old = {};\n var style = elem.style;\n var name; // Remember the old values, and insert the new ones\n\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n old[name] = style[name];\n style[name] = options[name];\n }\n }\n\n callback.call(elem); // Revert the old values\n\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n style[name] = old[name];\n }\n }\n}\n\nfunction getPBMWidth(elem, props, which) {\n var value = 0;\n var prop;\n var j;\n var i;\n\n for (j = 0; j < props.length; j++) {\n prop = props[j];\n\n if (prop) {\n for (i = 0; i < which.length; i++) {\n var cssProp = void 0;\n\n if (prop === 'border') {\n cssProp = \"\".concat(prop).concat(which[i], \"Width\");\n } else {\n cssProp = prop + which[i];\n }\n\n value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;\n }\n }\n }\n\n return value;\n}\n\nvar domUtils = {\n getParent: function getParent(element) {\n var parent = element;\n\n do {\n if (parent.nodeType === 11 && parent.host) {\n parent = parent.host;\n } else {\n parent = parent.parentNode;\n }\n } while (parent && parent.nodeType !== 1 && parent.nodeType !== 9);\n\n return parent;\n }\n};\neach(['Width', 'Height'], function (name) {\n domUtils[\"doc\".concat(name)] = function (refWin) {\n var d = refWin.document;\n return Math.max( // firefox chrome documentElement.scrollHeight< body.scrollHeight\n // ie standard mode : documentElement.scrollHeight> body.scrollHeight\n d.documentElement[\"scroll\".concat(name)], // quirks : documentElement.scrollHeight 最大等于可视窗口多一点?\n d.body[\"scroll\".concat(name)], domUtils[\"viewport\".concat(name)](d));\n };\n\n domUtils[\"viewport\".concat(name)] = function (win) {\n // pc browser includes scrollbar in window.innerWidth\n var prop = \"client\".concat(name);\n var doc = win.document;\n var body = doc.body;\n var documentElement = doc.documentElement;\n var documentElementProp = documentElement[prop]; // 标准模式取 documentElement\n // backcompat 取 body\n\n return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;\n };\n});\n/*\n 得到元素的大小信息\n @param elem\n @param name\n @param {String} [extra] 'padding' : (css width) + padding\n 'border' : (css width) + padding + border\n 'margin' : (css width) + padding + border + margin\n */\n\nfunction getWH(elem, name, ex) {\n var extra = ex;\n\n if (isWindow(elem)) {\n return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);\n } else if (elem.nodeType === 9) {\n return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);\n }\n\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n var borderBoxValue = name === 'width' ? elem.getBoundingClientRect().width : elem.getBoundingClientRect().height;\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem);\n var cssBoxValue = 0;\n\n if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) {\n borderBoxValue = undefined; // Fall back to computed then un computed css if necessary\n\n cssBoxValue = getComputedStyleX(elem, name);\n\n if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) {\n cssBoxValue = elem.style[name] || 0;\n } // Normalize '', auto, and prepare for extra\n\n\n cssBoxValue = parseFloat(cssBoxValue) || 0;\n }\n\n if (extra === undefined) {\n extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;\n }\n\n var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;\n var val = borderBoxValue || cssBoxValue;\n\n if (extra === CONTENT_INDEX) {\n if (borderBoxValueOrIsBorderBox) {\n return val - getPBMWidth(elem, ['border', 'padding'], which);\n }\n\n return cssBoxValue;\n } else if (borderBoxValueOrIsBorderBox) {\n if (extra === BORDER_INDEX) {\n return val;\n }\n\n return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which) : getPBMWidth(elem, ['margin'], which));\n }\n\n return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which);\n}\n\nvar cssShow = {\n position: 'absolute',\n visibility: 'hidden',\n display: 'block'\n}; // fix #119 : https://github.com/kissyteam/kissy/issues/119\n\nfunction getWHIgnoreDisplay() {\n for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var val;\n var elem = args[0]; // in case elem is window\n // elem.offsetWidth === undefined\n\n if (elem.offsetWidth !== 0) {\n val = getWH.apply(undefined, args);\n } else {\n swap(elem, cssShow, function () {\n val = getWH.apply(undefined, args);\n });\n }\n\n return val;\n}\n\neach(['width', 'height'], function (name) {\n var first = name.charAt(0).toUpperCase() + name.slice(1);\n\n domUtils[\"outer\".concat(first)] = function (el, includeMargin) {\n return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);\n };\n\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n\n domUtils[name] = function (elem, v) {\n var val = v;\n\n if (val !== undefined) {\n if (elem) {\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem);\n\n if (isBorderBox) {\n val += getPBMWidth(elem, ['padding', 'border'], which);\n }\n\n return css(elem, name, val);\n }\n\n return undefined;\n }\n\n return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);\n };\n});\n\nfunction mix(to, from) {\n for (var i in from) {\n if (from.hasOwnProperty(i)) {\n to[i] = from[i];\n }\n }\n\n return to;\n}\n\nvar utils = {\n getWindow: function getWindow(node) {\n if (node && node.document && node.setTimeout) {\n return node;\n }\n\n var doc = node.ownerDocument || node;\n return doc.defaultView || doc.parentWindow;\n },\n getDocument: getDocument,\n offset: function offset(el, value, option) {\n if (typeof value !== 'undefined') {\n setOffset(el, value, option || {});\n } else {\n return getOffset(el);\n }\n },\n isWindow: isWindow,\n each: each,\n css: css,\n clone: function clone(obj) {\n var i;\n var ret = {};\n\n for (i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret[i] = obj[i];\n }\n }\n\n var overflow = obj.overflow;\n\n if (overflow) {\n for (i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret.overflow[i] = obj.overflow[i];\n }\n }\n }\n\n return ret;\n },\n mix: mix,\n getWindowScrollLeft: function getWindowScrollLeft(w) {\n return getScrollLeft(w);\n },\n getWindowScrollTop: function getWindowScrollTop(w) {\n return getScrollTop(w);\n },\n merge: function merge() {\n var ret = {};\n\n for (var i = 0; i < arguments.length; i++) {\n utils.mix(ret, i < 0 || arguments.length <= i ? undefined : arguments[i]);\n }\n\n return ret;\n },\n viewportWidth: 0,\n viewportHeight: 0\n};\nmix(utils, domUtils);\n\n/**\n * 得到会导致元素显示不全的祖先元素\n */\n\nvar getParent = utils.getParent;\n\nfunction getOffsetParent(element) {\n if (utils.isWindow(element) || element.nodeType === 9) {\n return null;\n } // ie 这个也不是完全可行\n\n /*\n
\n
\n 元素 6 高 100px 宽 50px
\n
\n
\n */\n // element.offsetParent does the right thing in ie7 and below. Return parent with layout!\n // In other browsers it only includes elements with position absolute, relative or\n // fixed, not elements with overflow set to auto or scroll.\n // if (UA.ie && ieMode < 8) {\n // return element.offsetParent;\n // }\n // 统一的 offsetParent 方法\n\n\n var doc = utils.getDocument(element);\n var body = doc.body;\n var parent;\n var positionStyle = utils.css(element, 'position');\n var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute';\n\n if (!skipStatic) {\n return element.nodeName.toLowerCase() === 'html' ? null : getParent(element);\n }\n\n for (parent = getParent(element); parent && parent !== body && parent.nodeType !== 9; parent = getParent(parent)) {\n positionStyle = utils.css(parent, 'position');\n\n if (positionStyle !== 'static') {\n return parent;\n }\n }\n\n return null;\n}\n\nvar getParent$1 = utils.getParent;\nfunction isAncestorFixed(element) {\n if (utils.isWindow(element) || element.nodeType === 9) {\n return false;\n }\n\n var doc = utils.getDocument(element);\n var body = doc.body;\n var parent = null;\n\n for (parent = getParent$1(element); parent && parent !== body; parent = getParent$1(parent)) {\n var positionStyle = utils.css(parent, 'position');\n\n if (positionStyle === 'fixed') {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * 获得元素的显示部分的区域\n */\n\nfunction getVisibleRectForElement(element, alwaysByViewport) {\n var visibleRect = {\n left: 0,\n right: Infinity,\n top: 0,\n bottom: Infinity\n };\n var el = getOffsetParent(element);\n var doc = utils.getDocument(element);\n var win = doc.defaultView || doc.parentWindow;\n var body = doc.body;\n var documentElement = doc.documentElement; // Determine the size of the visible rect by climbing the dom accounting for\n // all scrollable containers.\n\n while (el) {\n // clientWidth is zero for inline block elements in ie.\n if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) && // body may have overflow set on it, yet we still get the entire\n // viewport. In some browsers, el.offsetParent may be\n // document.documentElement, so check for that too.\n el !== body && el !== documentElement && utils.css(el, 'overflow') !== 'visible') {\n var pos = utils.offset(el); // add border\n\n pos.left += el.clientLeft;\n pos.top += el.clientTop;\n visibleRect.top = Math.max(visibleRect.top, pos.top);\n visibleRect.right = Math.min(visibleRect.right, // consider area without scrollBar\n pos.left + el.clientWidth);\n visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight);\n visibleRect.left = Math.max(visibleRect.left, pos.left);\n } else if (el === body || el === documentElement) {\n break;\n }\n\n el = getOffsetParent(el);\n } // Set element position to fixed\n // make sure absolute element itself don't affect it's visible area\n // https://github.com/ant-design/ant-design/issues/7601\n\n\n var originalPosition = null;\n\n if (!utils.isWindow(element) && element.nodeType !== 9) {\n originalPosition = element.style.position;\n var position = utils.css(element, 'position');\n\n if (position === 'absolute') {\n element.style.position = 'fixed';\n }\n }\n\n var scrollX = utils.getWindowScrollLeft(win);\n var scrollY = utils.getWindowScrollTop(win);\n var viewportWidth = utils.viewportWidth(win);\n var viewportHeight = utils.viewportHeight(win);\n var documentWidth = documentElement.scrollWidth;\n var documentHeight = documentElement.scrollHeight; // scrollXXX on html is sync with body which means overflow: hidden on body gets wrong scrollXXX.\n // We should cut this ourself.\n\n var bodyStyle = window.getComputedStyle(body);\n\n if (bodyStyle.overflowX === 'hidden') {\n documentWidth = win.innerWidth;\n }\n\n if (bodyStyle.overflowY === 'hidden') {\n documentHeight = win.innerHeight;\n } // Reset element position after calculate the visible area\n\n\n if (element.style) {\n element.style.position = originalPosition;\n }\n\n if (alwaysByViewport || isAncestorFixed(element)) {\n // Clip by viewport's size.\n visibleRect.left = Math.max(visibleRect.left, scrollX);\n visibleRect.top = Math.max(visibleRect.top, scrollY);\n visibleRect.right = Math.min(visibleRect.right, scrollX + viewportWidth);\n visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + viewportHeight);\n } else {\n // Clip by document's size.\n var maxVisibleWidth = Math.max(documentWidth, scrollX + viewportWidth);\n visibleRect.right = Math.min(visibleRect.right, maxVisibleWidth);\n var maxVisibleHeight = Math.max(documentHeight, scrollY + viewportHeight);\n visibleRect.bottom = Math.min(visibleRect.bottom, maxVisibleHeight);\n }\n\n return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null;\n}\n\nfunction adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) {\n var pos = utils.clone(elFuturePos);\n var size = {\n width: elRegion.width,\n height: elRegion.height\n };\n\n if (overflow.adjustX && pos.left < visibleRect.left) {\n pos.left = visibleRect.left;\n } // Left edge inside and right edge outside viewport, try to resize it.\n\n\n if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) {\n size.width -= pos.left + size.width - visibleRect.right;\n } // Right edge outside viewport, try to move it.\n\n\n if (overflow.adjustX && pos.left + size.width > visibleRect.right) {\n // 保证左边界和可视区域左边界对齐\n pos.left = Math.max(visibleRect.right - size.width, visibleRect.left);\n } // Top edge outside viewport, try to move it.\n\n\n if (overflow.adjustY && pos.top < visibleRect.top) {\n pos.top = visibleRect.top;\n } // Top edge inside and bottom edge outside viewport, try to resize it.\n\n\n if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) {\n size.height -= pos.top + size.height - visibleRect.bottom;\n } // Bottom edge outside viewport, try to move it.\n\n\n if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) {\n // 保证上边界和可视区域上边界对齐\n pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top);\n }\n\n return utils.mix(pos, size);\n}\n\nfunction getRegion(node) {\n var offset;\n var w;\n var h;\n\n if (!utils.isWindow(node) && node.nodeType !== 9) {\n offset = utils.offset(node);\n w = utils.outerWidth(node);\n h = utils.outerHeight(node);\n } else {\n var win = utils.getWindow(node);\n offset = {\n left: utils.getWindowScrollLeft(win),\n top: utils.getWindowScrollTop(win)\n };\n w = utils.viewportWidth(win);\n h = utils.viewportHeight(win);\n }\n\n offset.width = w;\n offset.height = h;\n return offset;\n}\n\n/**\n * 获取 node 上的 align 对齐点 相对于页面的坐标\n */\nfunction getAlignOffset(region, align) {\n var V = align.charAt(0);\n var H = align.charAt(1);\n var w = region.width;\n var h = region.height;\n var x = region.left;\n var y = region.top;\n\n if (V === 'c') {\n y += h / 2;\n } else if (V === 'b') {\n y += h;\n }\n\n if (H === 'c') {\n x += w / 2;\n } else if (H === 'r') {\n x += w;\n }\n\n return {\n left: x,\n top: y\n };\n}\n\nfunction getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) {\n var p1 = getAlignOffset(refNodeRegion, points[1]);\n var p2 = getAlignOffset(elRegion, points[0]);\n var diff = [p2.left - p1.left, p2.top - p1.top];\n return {\n left: Math.round(elRegion.left - diff[0] + offset[0] - targetOffset[0]),\n top: Math.round(elRegion.top - diff[1] + offset[1] - targetOffset[1])\n };\n}\n\n/**\n * align dom node flexibly\n * @author yiminghe@gmail.com\n */\n\nfunction isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}\n\nfunction isFailY(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom;\n}\n\nfunction isCompleteFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left;\n}\n\nfunction isCompleteFailY(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top;\n}\n\nfunction flip(points, reg, map) {\n var ret = [];\n utils.each(points, function (p) {\n ret.push(p.replace(reg, function (m) {\n return map[m];\n }));\n });\n return ret;\n}\n\nfunction flipOffset(offset, index) {\n offset[index] = -offset[index];\n return offset;\n}\n\nfunction convertOffset(str, offsetLen) {\n var n;\n\n if (/%$/.test(str)) {\n n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen;\n } else {\n n = parseInt(str, 10);\n }\n\n return n || 0;\n}\n\nfunction normalizeOffset(offset, el) {\n offset[0] = convertOffset(offset[0], el.width);\n offset[1] = convertOffset(offset[1], el.height);\n}\n/**\n * @param el\n * @param tgtRegion 参照节点所占的区域: { left, top, width, height }\n * @param align\n */\n\n\nfunction doAlign(el, tgtRegion, align, isTgtRegionVisible) {\n var points = align.points;\n var offset = align.offset || [0, 0];\n var targetOffset = align.targetOffset || [0, 0];\n var overflow = align.overflow;\n var source = align.source || el;\n offset = [].concat(offset);\n targetOffset = [].concat(targetOffset);\n overflow = overflow || {};\n var newOverflowCfg = {};\n var fail = 0;\n var alwaysByViewport = !!(overflow && overflow.alwaysByViewport); // 当前节点可以被放置的显示区域\n\n var visibleRect = getVisibleRectForElement(source, alwaysByViewport); // 当前节点所占的区域, left/top/width/height\n\n var elRegion = getRegion(source); // 将 offset 转换成数值,支持百分比\n\n normalizeOffset(offset, elRegion);\n normalizeOffset(targetOffset, tgtRegion); // 当前节点将要被放置的位置\n\n var elFuturePos = getElFuturePos(elRegion, tgtRegion, points, offset, targetOffset); // 当前节点将要所处的区域\n\n var newElRegion = utils.merge(elRegion, elFuturePos); // 如果可视区域不能完全放置当前节点时允许调整\n\n if (visibleRect && (overflow.adjustX || overflow.adjustY) && isTgtRegionVisible) {\n if (overflow.adjustX) {\n // 如果横向不能放下\n if (isFailX(elFuturePos, elRegion, visibleRect)) {\n // 对齐位置反下\n var newPoints = flip(points, /[lr]/gi, {\n l: 'r',\n r: 'l'\n }); // 偏移量也反下\n\n var newOffset = flipOffset(offset, 0);\n var newTargetOffset = flipOffset(targetOffset, 0);\n var newElFuturePos = getElFuturePos(elRegion, tgtRegion, newPoints, newOffset, newTargetOffset);\n\n if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) {\n fail = 1;\n points = newPoints;\n offset = newOffset;\n targetOffset = newTargetOffset;\n }\n }\n }\n\n if (overflow.adjustY) {\n // 如果纵向不能放下\n if (isFailY(elFuturePos, elRegion, visibleRect)) {\n // 对齐位置反下\n var _newPoints = flip(points, /[tb]/gi, {\n t: 'b',\n b: 't'\n }); // 偏移量也反下\n\n\n var _newOffset = flipOffset(offset, 1);\n\n var _newTargetOffset = flipOffset(targetOffset, 1);\n\n var _newElFuturePos = getElFuturePos(elRegion, tgtRegion, _newPoints, _newOffset, _newTargetOffset);\n\n if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) {\n fail = 1;\n points = _newPoints;\n offset = _newOffset;\n targetOffset = _newTargetOffset;\n }\n }\n } // 如果失败,重新计算当前节点将要被放置的位置\n\n\n if (fail) {\n elFuturePos = getElFuturePos(elRegion, tgtRegion, points, offset, targetOffset);\n utils.mix(newElRegion, elFuturePos);\n }\n\n var isStillFailX = isFailX(elFuturePos, elRegion, visibleRect);\n var isStillFailY = isFailY(elFuturePos, elRegion, visibleRect); // 检查反下后的位置是否可以放下了,如果仍然放不下:\n // 1. 复原修改过的定位参数\n\n if (isStillFailX || isStillFailY) {\n points = align.points;\n offset = align.offset || [0, 0];\n targetOffset = align.targetOffset || [0, 0];\n } // 2. 只有指定了可以调整当前方向才调整\n\n\n newOverflowCfg.adjustX = overflow.adjustX && isStillFailX;\n newOverflowCfg.adjustY = overflow.adjustY && isStillFailY; // 确实要调整,甚至可能会调整高度宽度\n\n if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) {\n newElRegion = adjustForViewport(elFuturePos, elRegion, visibleRect, newOverflowCfg);\n }\n } // need judge to in case set fixed with in css on height auto element\n\n\n if (newElRegion.width !== elRegion.width) {\n utils.css(source, 'width', utils.width(source) + newElRegion.width - elRegion.width);\n }\n\n if (newElRegion.height !== elRegion.height) {\n utils.css(source, 'height', utils.height(source) + newElRegion.height - elRegion.height);\n } // https://github.com/kissyteam/kissy/issues/190\n // 相对于屏幕位置没变,而 left/top 变了\n // 例如
\n\n\n utils.offset(source, {\n left: newElRegion.left,\n top: newElRegion.top\n }, {\n useCssRight: align.useCssRight,\n useCssBottom: align.useCssBottom,\n useCssTransform: align.useCssTransform,\n ignoreShake: align.ignoreShake\n });\n return {\n points: points,\n offset: offset,\n targetOffset: targetOffset,\n overflow: newOverflowCfg\n };\n}\n/**\n * 2012-04-26 yiminghe@gmail.com\n * - 优化智能对齐算法\n * - 慎用 resizeXX\n *\n * 2011-07-13 yiminghe@gmail.com note:\n * - 增加智能对齐,以及大小调整选项\n **/\n\nfunction isOutOfVisibleRect(target, alwaysByViewport) {\n var visibleRect = getVisibleRectForElement(target, alwaysByViewport);\n var targetRegion = getRegion(target);\n return !visibleRect || targetRegion.left + targetRegion.width <= visibleRect.left || targetRegion.top + targetRegion.height <= visibleRect.top || targetRegion.left >= visibleRect.right || targetRegion.top >= visibleRect.bottom;\n}\n\nfunction alignElement(el, refNode, align) {\n var target = align.target || refNode;\n var refNodeRegion = getRegion(target);\n var isTargetNotOutOfVisible = !isOutOfVisibleRect(target, align.overflow && align.overflow.alwaysByViewport);\n return doAlign(el, refNodeRegion, align, isTargetNotOutOfVisible);\n}\n\nalignElement.__getOffsetParent = getOffsetParent;\nalignElement.__getVisibleRectForElement = getVisibleRectForElement;\n\n/**\n * `tgtPoint`: { pageX, pageY } or { clientX, clientY }.\n * If client position provided, will internal convert to page position.\n */\n\nfunction alignPoint(el, tgtPoint, align) {\n var pageX;\n var pageY;\n var doc = utils.getDocument(el);\n var win = doc.defaultView || doc.parentWindow;\n var scrollX = utils.getWindowScrollLeft(win);\n var scrollY = utils.getWindowScrollTop(win);\n var viewportWidth = utils.viewportWidth(win);\n var viewportHeight = utils.viewportHeight(win);\n\n if ('pageX' in tgtPoint) {\n pageX = tgtPoint.pageX;\n } else {\n pageX = scrollX + tgtPoint.clientX;\n }\n\n if ('pageY' in tgtPoint) {\n pageY = tgtPoint.pageY;\n } else {\n pageY = scrollY + tgtPoint.clientY;\n }\n\n var tgtRegion = {\n left: pageX,\n top: pageY,\n width: 0,\n height: 0\n };\n var pointInView = pageX >= 0 && pageX <= scrollX + viewportWidth && pageY >= 0 && pageY <= scrollY + viewportHeight; // Provide default target point\n\n var points = [align.points[0], 'cc'];\n return doAlign(el, tgtRegion, _objectSpread2({}, align, {\n points: points\n }), pointInView);\n}\n\nexport default alignElement;\nexport { alignElement, alignPoint };\n//# sourceMappingURL=index.js.map\n","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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 isPointsEq(a1, a2, isAlignPoint) {\n if (isAlignPoint) {\n return a1[0] === a2[0];\n }\n\n return a1[0] === a2[0] && a1[1] === a2[1];\n}\n\nexport function getAlignFromPlacement(builtinPlacements, placementStr, align) {\n var baseAlign = builtinPlacements[placementStr] || {};\n return _objectSpread(_objectSpread({}, baseAlign), align);\n}\nexport function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {\n var points = align.points;\n var placements = Object.keys(builtinPlacements);\n\n for (var i = 0; i < placements.length; i += 1) {\n var placement = placements[i];\n\n if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) {\n return \"\".concat(prefixCls, \"-placement-\").concat(placement);\n }\n }\n\n return '';\n}","function _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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nimport ResizeObserver from 'resize-observer-polyfill';\nimport contains from \"rc-util/es/Dom/contains\";\nexport function isSamePoint(prev, next) {\n if (prev === next) return true;\n if (!prev || !next) return false;\n\n if ('pageX' in next && 'pageY' in next) {\n return prev.pageX === next.pageX && prev.pageY === next.pageY;\n }\n\n if ('clientX' in next && 'clientY' in next) {\n return prev.clientX === next.clientX && prev.clientY === next.clientY;\n }\n\n return false;\n}\nexport function restoreFocus(activeElement, container) {\n // Focus back if is in the container\n if (activeElement !== document.activeElement && contains(container, activeElement)) {\n activeElement.focus();\n }\n}\nexport function monitorResize(element, callback) {\n var prevWidth = null;\n var prevHeight = null;\n\n function onResize(_ref) {\n var _ref2 = _slicedToArray(_ref, 1),\n target = _ref2[0].target;\n\n var _target$getBoundingCl = target.getBoundingClientRect(),\n width = _target$getBoundingCl.width,\n height = _target$getBoundingCl.height;\n\n var fixedWidth = Math.floor(width);\n var fixedHeight = Math.floor(height);\n\n if (prevWidth !== fixedWidth || prevHeight !== fixedHeight) {\n callback({\n width: fixedWidth,\n height: fixedHeight\n });\n }\n\n prevWidth = fixedWidth;\n prevHeight = fixedHeight;\n }\n\n var resizeObserver = new ResizeObserver(onResize);\n\n if (element) {\n resizeObserver.observe(element);\n }\n\n return function () {\n resizeObserver.disconnect();\n };\n}","import React from 'react';\nexport default (function (callback, buffer) {\n var calledRef = React.useRef(false);\n var timeoutRef = React.useRef(null);\n\n function cancelTrigger() {\n window.clearTimeout(timeoutRef.current);\n }\n\n function trigger(force) {\n if (!calledRef.current || force === true) {\n if (callback() === false) {\n // Not delay since callback cancelled self\n return;\n }\n\n calledRef.current = true;\n cancelTrigger();\n timeoutRef.current = window.setTimeout(function () {\n calledRef.current = false;\n }, buffer);\n } else {\n cancelTrigger();\n timeoutRef.current = window.setTimeout(function () {\n calledRef.current = false;\n trigger();\n }, buffer);\n }\n }\n\n return [trigger, function () {\n calledRef.current = false;\n cancelTrigger();\n }];\n});","function _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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/**\n * Removed props:\n * - childrenProps\n */\nimport React from 'react';\nimport { composeRef } from \"rc-util/es/ref\";\nimport { alignElement, alignPoint } from 'dom-align';\nimport addEventListener from \"rc-util/es/Dom/addEventListener\";\nimport { isSamePoint, restoreFocus, monitorResize } from './util';\nimport useBuffer from './hooks/useBuffer';\n\nfunction getElement(func) {\n if (typeof func !== 'function') return null;\n return func();\n}\n\nfunction getPoint(point) {\n if (_typeof(point) !== 'object' || !point) return null;\n return point;\n}\n\nvar Align = function Align(_ref, ref) {\n var children = _ref.children,\n disabled = _ref.disabled,\n target = _ref.target,\n align = _ref.align,\n onAlign = _ref.onAlign,\n monitorWindowResize = _ref.monitorWindowResize,\n _ref$monitorBufferTim = _ref.monitorBufferTime,\n monitorBufferTime = _ref$monitorBufferTim === void 0 ? 0 : _ref$monitorBufferTim;\n var cacheRef = React.useRef({});\n var nodeRef = React.useRef();\n var childNode = React.Children.only(children); // ===================== Align ======================\n // We save the props here to avoid closure makes props ood\n\n var forceAlignPropsRef = React.useRef({});\n forceAlignPropsRef.current.disabled = disabled;\n forceAlignPropsRef.current.target = target;\n forceAlignPropsRef.current.onAlign = onAlign;\n\n var _useBuffer = useBuffer(function () {\n var _forceAlignPropsRef$c = forceAlignPropsRef.current,\n latestDisabled = _forceAlignPropsRef$c.disabled,\n latestTarget = _forceAlignPropsRef$c.target;\n\n if (!latestDisabled && latestTarget) {\n var source = nodeRef.current;\n var result;\n var element = getElement(latestTarget);\n var point = getPoint(latestTarget);\n cacheRef.current.element = element;\n cacheRef.current.point = point; // IE lose focus after element realign\n // We should record activeElement and restore later\n\n var _document = document,\n activeElement = _document.activeElement;\n\n if (element) {\n result = alignElement(source, element, align);\n } else if (point) {\n result = alignPoint(source, point, align);\n }\n\n restoreFocus(activeElement, source);\n\n if (onAlign) {\n onAlign(source, result);\n }\n\n return true;\n }\n\n return false;\n }, monitorBufferTime),\n _useBuffer2 = _slicedToArray(_useBuffer, 2),\n _forceAlign = _useBuffer2[0],\n cancelForceAlign = _useBuffer2[1]; // ===================== Effect =====================\n // Listen for target updated\n\n\n var resizeMonitor = React.useRef({\n cancel: function cancel() {}\n }); // Listen for source updated\n\n var sourceResizeMonitor = React.useRef({\n cancel: function cancel() {}\n });\n React.useEffect(function () {\n var element = getElement(target);\n var point = getPoint(target);\n\n if (nodeRef.current !== sourceResizeMonitor.current.element) {\n sourceResizeMonitor.current.cancel();\n sourceResizeMonitor.current.element = nodeRef.current;\n sourceResizeMonitor.current.cancel = monitorResize(nodeRef.current, _forceAlign);\n }\n\n if (cacheRef.current.element !== element || !isSamePoint(cacheRef.current.point, point)) {\n _forceAlign(); // Add resize observer\n\n\n if (resizeMonitor.current.element !== element) {\n resizeMonitor.current.cancel();\n resizeMonitor.current.element = element;\n resizeMonitor.current.cancel = monitorResize(element, _forceAlign);\n }\n }\n }); // Listen for disabled change\n\n React.useEffect(function () {\n if (!disabled) {\n _forceAlign();\n } else {\n cancelForceAlign();\n }\n }, [disabled]); // Listen for window resize\n\n var winResizeRef = React.useRef(null);\n React.useEffect(function () {\n if (monitorWindowResize) {\n if (!winResizeRef.current) {\n winResizeRef.current = addEventListener(window, 'resize', _forceAlign);\n }\n } else if (winResizeRef.current) {\n winResizeRef.current.remove();\n winResizeRef.current = null;\n }\n }, [monitorWindowResize]); // Clear all if unmount\n\n React.useEffect(function () {\n return function () {\n resizeMonitor.current.cancel();\n sourceResizeMonitor.current.cancel();\n if (winResizeRef.current) winResizeRef.current.remove();\n cancelForceAlign();\n };\n }, []); // ====================== Ref =======================\n\n React.useImperativeHandle(ref, function () {\n return {\n forceAlign: function forceAlign() {\n return _forceAlign(true);\n }\n };\n }); // ===================== Render =====================\n\n if (React.isValidElement(childNode)) {\n childNode = React.cloneElement(childNode, {\n ref: composeRef(childNode.ref, nodeRef)\n });\n }\n\n return childNode;\n};\n\nvar RefAlign = React.forwardRef(Align);\nRefAlign.displayName = 'Align';\nexport default RefAlign;","// export this package's api\nimport Align from './Align';\nexport default Align;","import React from 'react';\nimport classNames from 'classnames';\n\nvar PopupInner = function PopupInner(props, ref) {\n var prefixCls = props.prefixCls,\n className = props.className,\n visible = props.visible,\n style = props.style,\n children = props.children,\n onMouseEnter = props.onMouseEnter,\n onMouseLeave = props.onMouseLeave,\n onMouseDown = props.onMouseDown,\n onTouchStart = props.onTouchStart;\n var childNode = children;\n\n if (React.Children.count(children) > 1) {\n childNode = React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-content\")\n }, children);\n }\n\n return React.createElement(\"div\", {\n ref: ref,\n className: classNames(className, !visible && \"\".concat(props.hiddenClassName)),\n onMouseEnter: onMouseEnter,\n onMouseLeave: onMouseLeave,\n onMouseDown: onMouseDown,\n onTouchStart: onTouchStart,\n style: style\n }, childNode);\n};\n\nvar RefPopupInner = React.forwardRef(PopupInner);\nRefPopupInner.displayName = 'PopupInner';\nexport default RefPopupInner;","export function getMotion(_ref) {\n var prefixCls = _ref.prefixCls,\n motion = _ref.motion,\n animation = _ref.animation,\n transitionName = _ref.transitionName;\n\n if (motion) {\n return motion;\n }\n\n if (animation) {\n return {\n motionName: \"\".concat(prefixCls, \"-\").concat(animation)\n };\n }\n\n if (transitionName) {\n return {\n motionName: transitionName\n };\n }\n\n return null;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/* eslint-disable no-param-reassign */\nimport React, { Component } from 'react';\nimport raf from 'raf';\nimport Align from 'rc-align';\nimport { composeRef } from \"rc-util/es/ref\";\nimport classNames from 'classnames';\nimport RawCSSMotion from \"rc-animate/es/CSSMotion\";\nimport PopupInner from './PopupInner';\nimport { getMotion } from './utils/legacyUtil';\nvar CSSMotion = RawCSSMotion;\n\nfunction supportMotion(motion) {\n return motion && motion.motionName;\n}\n\nvar Popup = /*#__PURE__*/function (_Component) {\n _inherits(Popup, _Component);\n\n var _super = _createSuper(Popup);\n\n function Popup() {\n var _this;\n\n _classCallCheck(this, Popup);\n\n _this = _super.apply(this, arguments);\n _this.state = {\n targetWidth: undefined,\n targetHeight: undefined,\n status: null,\n prevVisible: null,\n alignClassName: null\n };\n _this.popupRef = React.createRef();\n _this.alignRef = React.createRef();\n _this.nextFrameState = null;\n _this.nextFrameId = null;\n\n _this.onAlign = function (popupDomNode, align) {\n var status = _this.state.status;\n var _this$props = _this.props,\n getClassNameFromAlign = _this$props.getClassNameFromAlign,\n onAlign = _this$props.onAlign;\n var alignClassName = getClassNameFromAlign(align);\n\n if (status === 'align') {\n _this.setState({\n alignClassName: alignClassName,\n status: 'aligned'\n }, function () {\n _this.alignRef.current.forceAlign();\n });\n } else if (status === 'aligned') {\n _this.setState({\n alignClassName: alignClassName,\n status: 'afterAlign'\n });\n\n onAlign(popupDomNode, align);\n } else {\n _this.setState({\n alignClassName: alignClassName\n });\n }\n };\n\n _this.onMotionEnd = function () {\n var visible = _this.props.visible;\n\n _this.setState({\n status: visible ? 'AfterMotion' : 'stable'\n });\n };\n\n _this.setStateOnNextFrame = function (state) {\n _this.cancelFrameState();\n\n _this.nextFrameState = _objectSpread(_objectSpread({}, _this.nextFrameState), state);\n _this.nextFrameId = raf(function () {\n var submitState = _objectSpread({}, _this.nextFrameState);\n\n _this.nextFrameState = null;\n\n _this.setState(submitState);\n });\n };\n\n _this.getMotion = function () {\n return _objectSpread({}, getMotion(_this.props));\n }; // `target` on `rc-align` can accept as a function to get the bind element or a point.\n // ref: https://www.npmjs.com/package/rc-align\n\n\n _this.getAlignTarget = function () {\n var _this$props2 = _this.props,\n point = _this$props2.point,\n getRootDomNode = _this$props2.getRootDomNode;\n\n if (point) {\n return point;\n }\n\n return getRootDomNode;\n };\n\n _this.cancelFrameState = function () {\n raf.cancel(_this.nextFrameId);\n };\n\n _this.renderPopupElement = function () {\n var _this$state = _this.state,\n status = _this$state.status,\n targetHeight = _this$state.targetHeight,\n targetWidth = _this$state.targetWidth,\n alignClassName = _this$state.alignClassName;\n var _this$props3 = _this.props,\n prefixCls = _this$props3.prefixCls,\n className = _this$props3.className,\n style = _this$props3.style,\n stretch = _this$props3.stretch,\n visible = _this$props3.visible,\n align = _this$props3.align,\n destroyPopupOnHide = _this$props3.destroyPopupOnHide,\n onMouseEnter = _this$props3.onMouseEnter,\n onMouseLeave = _this$props3.onMouseLeave,\n onMouseDown = _this$props3.onMouseDown,\n onTouchStart = _this$props3.onTouchStart,\n children = _this$props3.children;\n var mergedClassName = classNames(prefixCls, className, alignClassName);\n var hiddenClassName = \"\".concat(prefixCls, \"-hidden\"); // ================== Style ==================\n\n var sizeStyle = {};\n\n if (stretch) {\n // Stretch with target\n if (stretch.indexOf('height') !== -1) {\n sizeStyle.height = targetHeight;\n } else if (stretch.indexOf('minHeight') !== -1) {\n sizeStyle.minHeight = targetHeight;\n }\n\n if (stretch.indexOf('width') !== -1) {\n sizeStyle.width = targetWidth;\n } else if (stretch.indexOf('minWidth') !== -1) {\n sizeStyle.minWidth = targetWidth;\n }\n }\n\n var mergedStyle = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sizeStyle), _this.getZIndexStyle()), style), {}, {\n opacity: status === 'stable' || !visible ? undefined : 0\n }); // ================= Motions =================\n\n\n var mergedMotion = _this.getMotion();\n\n var mergedMotionVisible = visible;\n\n if (visible && status !== 'beforeMotion' && status !== 'motion' && status !== 'stable') {\n mergedMotion.motionAppear = false;\n mergedMotion.motionEnter = false;\n mergedMotion.motionLeave = false;\n }\n\n if (status === 'afterAlign' || status === 'beforeMotion') {\n mergedMotionVisible = false;\n } // ================== Align ==================\n\n\n var mergedAlignDisabled = !visible || status !== 'align' && status !== 'aligned' && status !== 'stable'; // ================== Popup ==================\n\n var mergedPopupVisible = true;\n\n if (status === 'stable') {\n mergedPopupVisible = visible;\n } // Only remove popup since mask may still need animation\n\n\n if (destroyPopupOnHide && !mergedPopupVisible) {\n return null;\n }\n\n return React.createElement(CSSMotion, Object.assign({\n visible: mergedMotionVisible\n }, mergedMotion, {\n removeOnLeave: false,\n onEnterEnd: _this.onMotionEnd,\n onLeaveEnd: _this.onMotionEnd\n }), function (_ref, motionRef) {\n var motionStyle = _ref.style,\n motionClassName = _ref.className;\n return React.createElement(Align, {\n target: _this.getAlignTarget(),\n key: \"popup\",\n ref: _this.alignRef,\n monitorWindowResize: true,\n disabled: mergedAlignDisabled,\n align: align,\n onAlign: _this.onAlign\n }, React.createElement(PopupInner, {\n prefixCls: prefixCls,\n visible: mergedPopupVisible,\n hiddenClassName: hiddenClassName,\n className: classNames(mergedClassName, motionClassName),\n ref: composeRef(motionRef, _this.popupRef),\n onMouseEnter: onMouseEnter,\n onMouseLeave: onMouseLeave,\n onMouseDown: onMouseDown,\n onTouchStart: onTouchStart,\n style: _objectSpread(_objectSpread({}, mergedStyle), motionStyle)\n }, children));\n });\n };\n\n _this.renderMaskElement = function () {\n var _this$props4 = _this.props,\n mask = _this$props4.mask,\n maskMotion = _this$props4.maskMotion,\n maskTransitionName = _this$props4.maskTransitionName,\n maskAnimation = _this$props4.maskAnimation,\n prefixCls = _this$props4.prefixCls,\n visible = _this$props4.visible;\n\n if (!mask) {\n return null;\n }\n\n var motion = {};\n\n if (maskMotion && maskMotion.motionName) {\n motion = _objectSpread({\n motionAppear: true\n }, getMotion({\n motion: maskMotion,\n prefixCls: prefixCls,\n transitionName: maskTransitionName,\n animation: maskAnimation\n }));\n }\n\n return React.createElement(CSSMotion, Object.assign({}, motion, {\n visible: visible,\n removeOnLeave: true\n }), function (_ref2) {\n var className = _ref2.className;\n return React.createElement(\"div\", {\n style: _this.getZIndexStyle(),\n key: \"mask\",\n className: classNames(\"\".concat(prefixCls, \"-mask\"), className)\n });\n });\n };\n\n return _this;\n }\n\n _createClass(Popup, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.componentDidUpdate();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n var status = this.state.status;\n var _this$props5 = this.props,\n getRootDomNode = _this$props5.getRootDomNode,\n visible = _this$props5.visible,\n stretch = _this$props5.stretch; // If there is a pending state update, cancel it, a new one will be set if necessary\n\n this.cancelFrameState();\n\n if (visible && status !== 'stable') {\n switch (status) {\n case null:\n {\n this.setStateOnNextFrame({\n status: stretch ? 'measure' : 'align'\n });\n break;\n }\n\n case 'afterAlign':\n {\n this.setStateOnNextFrame({\n status: supportMotion(this.getMotion()) ? 'beforeMotion' : 'stable'\n });\n break;\n }\n\n case 'AfterMotion':\n {\n this.setStateOnNextFrame({\n status: 'stable'\n });\n break;\n }\n\n default:\n {\n // Go to next status\n var queue = ['measure', 'align', null, 'beforeMotion', 'motion'];\n var index = queue.indexOf(status);\n var nextStatus = queue[index + 1];\n\n if (index !== -1 && nextStatus) {\n this.setStateOnNextFrame({\n status: nextStatus\n });\n }\n }\n }\n } // Measure stretch size\n\n\n if (status === 'measure') {\n var $ele = getRootDomNode();\n\n if ($ele) {\n this.setStateOnNextFrame({\n targetHeight: $ele.offsetHeight,\n targetWidth: $ele.offsetWidth\n });\n }\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.cancelFrameState();\n }\n }, {\n key: \"getZIndexStyle\",\n value: function getZIndexStyle() {\n var zIndex = this.props.zIndex;\n return {\n zIndex: zIndex\n };\n }\n }, {\n key: \"render\",\n value: function render() {\n return React.createElement(\"div\", null, this.renderMaskElement(), this.renderPopupElement());\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(_ref3, _ref4) {\n var visible = _ref3.visible,\n props = _objectWithoutProperties(_ref3, [\"visible\"]);\n\n var prevVisible = _ref4.prevVisible,\n status = _ref4.status;\n var newState = {\n prevVisible: visible,\n status: status\n };\n var mergedMotion = getMotion(props);\n\n if (prevVisible === null && visible === false) {\n // Init render should always be stable\n newState.status = 'stable';\n } else if (visible !== prevVisible) {\n if (visible || supportMotion(mergedMotion) && ['motion', 'AfterMotion', 'stable'].includes(status)) {\n newState.status = null;\n } else {\n newState.status = 'stable';\n }\n\n if (visible) {\n newState.alignClassName = null;\n }\n }\n\n return newState;\n }\n }]);\n\n return Popup;\n}(Component);\n\nexport default Popup;\n/* eslint-enable */","import React from 'react';\nvar TriggerContext = React.createContext(null);\nexport default TriggerContext;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport contains from \"rc-util/es/Dom/contains\";\nimport findDOMNode from \"rc-util/es/Dom/findDOMNode\";\nimport { composeRef, supportRef } from \"rc-util/es/ref\";\nimport addEventListener from \"rc-util/es/Dom/addEventListener\";\nimport Portal from \"rc-util/es/Portal\";\nimport classNames from 'classnames';\nimport { getAlignFromPlacement, getAlignPopupClassName } from './utils/alignUtil';\nimport Popup from './Popup';\nimport TriggerContext from './context';\n\nfunction noop() {}\n\nfunction returnEmptyString() {\n return '';\n}\n\nfunction returnDocument() {\n return window.document;\n}\n\nvar ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur', 'onContextMenu'];\n/**\n * Internal usage. Do not use in your code since this will be removed.\n */\n\nexport function generateTrigger(PortalComponent) {\n var Trigger = /*#__PURE__*/function (_React$Component) {\n _inherits(Trigger, _React$Component);\n\n var _super = _createSuper(Trigger);\n\n function Trigger(props) {\n var _this;\n\n _classCallCheck(this, Trigger);\n\n _this = _super.call(this, props);\n _this.popupRef = React.createRef();\n _this.triggerRef = React.createRef();\n\n _this.onMouseEnter = function (e) {\n var mouseEnterDelay = _this.props.mouseEnterDelay;\n\n _this.fireEvents('onMouseEnter', e);\n\n _this.delaySetPopupVisible(true, mouseEnterDelay, mouseEnterDelay ? null : e);\n };\n\n _this.onMouseMove = function (e) {\n _this.fireEvents('onMouseMove', e);\n\n _this.setPoint(e);\n };\n\n _this.onMouseLeave = function (e) {\n _this.fireEvents('onMouseLeave', e);\n\n _this.delaySetPopupVisible(false, _this.props.mouseLeaveDelay);\n };\n\n _this.onPopupMouseEnter = function () {\n _this.clearDelayTimer();\n };\n\n _this.onPopupMouseLeave = function (e) {\n // https://github.com/react-component/trigger/pull/13\n // react bug?\n if (e.relatedTarget && !e.relatedTarget.setTimeout && _this.popupRef.current && _this.popupRef.current.popupRef.current && contains(_this.popupRef.current.popupRef.current, e.relatedTarget)) {\n return;\n }\n\n _this.delaySetPopupVisible(false, _this.props.mouseLeaveDelay);\n };\n\n _this.onFocus = function (e) {\n _this.fireEvents('onFocus', e); // incase focusin and focusout\n\n\n _this.clearDelayTimer();\n\n if (_this.isFocusToShow()) {\n _this.focusTime = Date.now();\n\n _this.delaySetPopupVisible(true, _this.props.focusDelay);\n }\n };\n\n _this.onMouseDown = function (e) {\n _this.fireEvents('onMouseDown', e);\n\n _this.preClickTime = Date.now();\n };\n\n _this.onTouchStart = function (e) {\n _this.fireEvents('onTouchStart', e);\n\n _this.preTouchTime = Date.now();\n };\n\n _this.onBlur = function (e) {\n _this.fireEvents('onBlur', e);\n\n _this.clearDelayTimer();\n\n if (_this.isBlurToHide()) {\n _this.delaySetPopupVisible(false, _this.props.blurDelay);\n }\n };\n\n _this.onContextMenu = function (e) {\n e.preventDefault();\n\n _this.fireEvents('onContextMenu', e);\n\n _this.setPopupVisible(true, e);\n };\n\n _this.onContextMenuClose = function () {\n if (_this.isContextMenuToShow()) {\n _this.close();\n }\n };\n\n _this.onClick = function (event) {\n _this.fireEvents('onClick', event); // focus will trigger click\n\n\n if (_this.focusTime) {\n var preTime;\n\n if (_this.preClickTime && _this.preTouchTime) {\n preTime = Math.min(_this.preClickTime, _this.preTouchTime);\n } else if (_this.preClickTime) {\n preTime = _this.preClickTime;\n } else if (_this.preTouchTime) {\n preTime = _this.preTouchTime;\n }\n\n if (Math.abs(preTime - _this.focusTime) < 20) {\n return;\n }\n\n _this.focusTime = 0;\n }\n\n _this.preClickTime = 0;\n _this.preTouchTime = 0; // Only prevent default when all the action is click.\n // https://github.com/ant-design/ant-design/issues/17043\n // https://github.com/ant-design/ant-design/issues/17291\n\n if (_this.isClickToShow() && (_this.isClickToHide() || _this.isBlurToHide()) && event && event.preventDefault) {\n event.preventDefault();\n }\n\n var nextVisible = !_this.state.popupVisible;\n\n if (_this.isClickToHide() && !nextVisible || nextVisible && _this.isClickToShow()) {\n _this.setPopupVisible(!_this.state.popupVisible, event);\n }\n };\n\n _this.onPopupMouseDown = function () {\n _this.hasPopupMouseDown = true;\n clearTimeout(_this.mouseDownTimeout);\n _this.mouseDownTimeout = window.setTimeout(function () {\n _this.hasPopupMouseDown = false;\n }, 0);\n\n if (_this.context) {\n var _this$context;\n\n (_this$context = _this.context).onPopupMouseDown.apply(_this$context, arguments);\n }\n };\n\n _this.onDocumentClick = function (event) {\n if (_this.props.mask && !_this.props.maskClosable) {\n return;\n }\n\n var target = event.target;\n\n var root = _this.getRootDomNode();\n\n var popupNode = _this.getPopupDomNode();\n\n if (!contains(root, target) && !contains(popupNode, target) && !_this.hasPopupMouseDown) {\n _this.close();\n }\n };\n\n _this.getRootDomNode = function () {\n var getTriggerDOMNode = _this.props.getTriggerDOMNode;\n\n if (getTriggerDOMNode) {\n return getTriggerDOMNode(_this.triggerRef.current);\n }\n\n try {\n var domNode = findDOMNode(_this.triggerRef.current);\n\n if (domNode) {\n return domNode;\n }\n } catch (err) {// Do nothing\n }\n\n return ReactDOM.findDOMNode(_assertThisInitialized(_this));\n };\n\n _this.getPopupClassNameFromAlign = function (align) {\n var className = [];\n var _this$props = _this.props,\n popupPlacement = _this$props.popupPlacement,\n builtinPlacements = _this$props.builtinPlacements,\n prefixCls = _this$props.prefixCls,\n alignPoint = _this$props.alignPoint,\n getPopupClassNameFromAlign = _this$props.getPopupClassNameFromAlign;\n\n if (popupPlacement && builtinPlacements) {\n className.push(getAlignPopupClassName(builtinPlacements, prefixCls, align, alignPoint));\n }\n\n if (getPopupClassNameFromAlign) {\n className.push(getPopupClassNameFromAlign(align));\n }\n\n return className.join(' ');\n };\n\n _this.getComponent = function () {\n var _this$props2 = _this.props,\n prefixCls = _this$props2.prefixCls,\n destroyPopupOnHide = _this$props2.destroyPopupOnHide,\n popupClassName = _this$props2.popupClassName,\n onPopupAlign = _this$props2.onPopupAlign,\n popupMotion = _this$props2.popupMotion,\n popupAnimation = _this$props2.popupAnimation,\n popupTransitionName = _this$props2.popupTransitionName,\n popupStyle = _this$props2.popupStyle,\n mask = _this$props2.mask,\n maskAnimation = _this$props2.maskAnimation,\n maskTransitionName = _this$props2.maskTransitionName,\n maskMotion = _this$props2.maskMotion,\n zIndex = _this$props2.zIndex,\n popup = _this$props2.popup,\n stretch = _this$props2.stretch,\n alignPoint = _this$props2.alignPoint;\n var _this$state = _this.state,\n popupVisible = _this$state.popupVisible,\n point = _this$state.point;\n\n var align = _this.getPopupAlign();\n\n var mouseProps = {};\n\n if (_this.isMouseEnterToShow()) {\n mouseProps.onMouseEnter = _this.onPopupMouseEnter;\n }\n\n if (_this.isMouseLeaveToHide()) {\n mouseProps.onMouseLeave = _this.onPopupMouseLeave;\n }\n\n mouseProps.onMouseDown = _this.onPopupMouseDown;\n mouseProps.onTouchStart = _this.onPopupMouseDown;\n return React.createElement(Popup, Object.assign({\n prefixCls: prefixCls,\n destroyPopupOnHide: destroyPopupOnHide,\n visible: popupVisible,\n point: alignPoint && point,\n className: popupClassName,\n align: align,\n onAlign: onPopupAlign,\n animation: popupAnimation,\n getClassNameFromAlign: _this.getPopupClassNameFromAlign\n }, mouseProps, {\n stretch: stretch,\n getRootDomNode: _this.getRootDomNode,\n style: popupStyle,\n mask: mask,\n zIndex: zIndex,\n transitionName: popupTransitionName,\n maskAnimation: maskAnimation,\n maskTransitionName: maskTransitionName,\n maskMotion: maskMotion,\n ref: _this.popupRef,\n motion: popupMotion\n }), typeof popup === 'function' ? popup() : popup);\n };\n\n _this.getContainer = function () {\n var _assertThisInitialize = _assertThisInitialized(_this),\n props = _assertThisInitialize.props;\n\n var popupContainer = document.createElement('div'); // Make sure default popup container will never cause scrollbar appearing\n // https://github.com/react-component/trigger/issues/41\n\n popupContainer.style.position = 'absolute';\n popupContainer.style.top = '0';\n popupContainer.style.left = '0';\n popupContainer.style.width = '100%';\n var mountNode = props.getPopupContainer ? props.getPopupContainer(_this.getRootDomNode()) : props.getDocument().body;\n mountNode.appendChild(popupContainer);\n return popupContainer;\n };\n\n _this.setPoint = function (point) {\n var alignPoint = _this.props.alignPoint;\n if (!alignPoint || !point) return;\n\n _this.setState({\n point: {\n pageX: point.pageX,\n pageY: point.pageY\n }\n });\n };\n\n _this.handlePortalUpdate = function () {\n if (_this.state.prevPopupVisible !== _this.state.popupVisible) {\n _this.props.afterPopupVisibleChange(_this.state.popupVisible);\n }\n };\n\n var popupVisible;\n\n if ('popupVisible' in props) {\n popupVisible = !!props.popupVisible;\n } else {\n popupVisible = !!props.defaultPopupVisible;\n }\n\n _this.state = {\n prevPopupVisible: popupVisible,\n popupVisible: popupVisible\n };\n ALL_HANDLERS.forEach(function (h) {\n _this[\"fire\".concat(h)] = function (e) {\n _this.fireEvents(h, e);\n };\n });\n return _this;\n }\n\n _createClass(Trigger, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.componentDidUpdate();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n var props = this.props;\n var state = this.state; // We must listen to `mousedown` or `touchstart`, edge case:\n // https://github.com/ant-design/ant-design/issues/5804\n // https://github.com/react-component/calendar/issues/250\n // https://github.com/react-component/trigger/issues/50\n\n if (state.popupVisible) {\n var currentDocument;\n\n if (!this.clickOutsideHandler && (this.isClickToHide() || this.isContextMenuToShow())) {\n currentDocument = props.getDocument();\n this.clickOutsideHandler = addEventListener(currentDocument, 'mousedown', this.onDocumentClick);\n } // always hide on mobile\n\n\n if (!this.touchOutsideHandler) {\n currentDocument = currentDocument || props.getDocument();\n this.touchOutsideHandler = addEventListener(currentDocument, 'touchstart', this.onDocumentClick);\n } // close popup when trigger type contains 'onContextMenu' and document is scrolling.\n\n\n if (!this.contextMenuOutsideHandler1 && this.isContextMenuToShow()) {\n currentDocument = currentDocument || props.getDocument();\n this.contextMenuOutsideHandler1 = addEventListener(currentDocument, 'scroll', this.onContextMenuClose);\n } // close popup when trigger type contains 'onContextMenu' and window is blur.\n\n\n if (!this.contextMenuOutsideHandler2 && this.isContextMenuToShow()) {\n this.contextMenuOutsideHandler2 = addEventListener(window, 'blur', this.onContextMenuClose);\n }\n\n return;\n }\n\n this.clearOutsideHandler();\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.clearDelayTimer();\n this.clearOutsideHandler();\n clearTimeout(this.mouseDownTimeout);\n }\n }, {\n key: \"getPopupDomNode\",\n value: function getPopupDomNode() {\n // for test\n if (this.popupRef.current && this.popupRef.current.popupRef.current) {\n return this.popupRef.current.popupRef.current;\n }\n\n return null;\n }\n }, {\n key: \"getPopupAlign\",\n value: function getPopupAlign() {\n var props = this.props;\n var popupPlacement = props.popupPlacement,\n popupAlign = props.popupAlign,\n builtinPlacements = props.builtinPlacements;\n\n if (popupPlacement && builtinPlacements) {\n return getAlignFromPlacement(builtinPlacements, popupPlacement, popupAlign);\n }\n\n return popupAlign;\n }\n /**\n * @param popupVisible Show or not the popup element\n * @param event SyntheticEvent, used for `pointAlign`\n */\n\n }, {\n key: \"setPopupVisible\",\n value: function setPopupVisible(popupVisible, event) {\n var alignPoint = this.props.alignPoint;\n var prevPopupVisible = this.state.popupVisible;\n this.clearDelayTimer();\n\n if (prevPopupVisible !== popupVisible) {\n if (!('popupVisible' in this.props)) {\n this.setState({\n popupVisible: popupVisible,\n prevPopupVisible: prevPopupVisible\n });\n }\n\n this.props.onPopupVisibleChange(popupVisible);\n } // Always record the point position since mouseEnterDelay will delay the show\n\n\n if (alignPoint && event) {\n this.setPoint(event);\n }\n }\n }, {\n key: \"delaySetPopupVisible\",\n value: function delaySetPopupVisible(visible, delayS, event) {\n var _this2 = this;\n\n var delay = delayS * 1000;\n this.clearDelayTimer();\n\n if (delay) {\n var point = event ? {\n pageX: event.pageX,\n pageY: event.pageY\n } : null;\n this.delayTimer = window.setTimeout(function () {\n _this2.setPopupVisible(visible, point);\n\n _this2.clearDelayTimer();\n }, delay);\n } else {\n this.setPopupVisible(visible, event);\n }\n }\n }, {\n key: \"clearDelayTimer\",\n value: function clearDelayTimer() {\n if (this.delayTimer) {\n clearTimeout(this.delayTimer);\n this.delayTimer = null;\n }\n }\n }, {\n key: \"clearOutsideHandler\",\n value: function clearOutsideHandler() {\n if (this.clickOutsideHandler) {\n this.clickOutsideHandler.remove();\n this.clickOutsideHandler = null;\n }\n\n if (this.contextMenuOutsideHandler1) {\n this.contextMenuOutsideHandler1.remove();\n this.contextMenuOutsideHandler1 = null;\n }\n\n if (this.contextMenuOutsideHandler2) {\n this.contextMenuOutsideHandler2.remove();\n this.contextMenuOutsideHandler2 = null;\n }\n\n if (this.touchOutsideHandler) {\n this.touchOutsideHandler.remove();\n this.touchOutsideHandler = null;\n }\n }\n }, {\n key: \"createTwoChains\",\n value: function createTwoChains(event) {\n var childPros = this.props.children.props;\n var props = this.props;\n\n if (childPros[event] && props[event]) {\n return this[\"fire\".concat(event)];\n }\n\n return childPros[event] || props[event];\n }\n }, {\n key: \"isClickToShow\",\n value: function isClickToShow() {\n var _this$props3 = this.props,\n action = _this$props3.action,\n showAction = _this$props3.showAction;\n return action.indexOf('click') !== -1 || showAction.indexOf('click') !== -1;\n }\n }, {\n key: \"isContextMenuToShow\",\n value: function isContextMenuToShow() {\n var _this$props4 = this.props,\n action = _this$props4.action,\n showAction = _this$props4.showAction;\n return action.indexOf('contextMenu') !== -1 || showAction.indexOf('contextMenu') !== -1;\n }\n }, {\n key: \"isClickToHide\",\n value: function isClickToHide() {\n var _this$props5 = this.props,\n action = _this$props5.action,\n hideAction = _this$props5.hideAction;\n return action.indexOf('click') !== -1 || hideAction.indexOf('click') !== -1;\n }\n }, {\n key: \"isMouseEnterToShow\",\n value: function isMouseEnterToShow() {\n var _this$props6 = this.props,\n action = _this$props6.action,\n showAction = _this$props6.showAction;\n return action.indexOf('hover') !== -1 || showAction.indexOf('mouseEnter') !== -1;\n }\n }, {\n key: \"isMouseLeaveToHide\",\n value: function isMouseLeaveToHide() {\n var _this$props7 = this.props,\n action = _this$props7.action,\n hideAction = _this$props7.hideAction;\n return action.indexOf('hover') !== -1 || hideAction.indexOf('mouseLeave') !== -1;\n }\n }, {\n key: \"isFocusToShow\",\n value: function isFocusToShow() {\n var _this$props8 = this.props,\n action = _this$props8.action,\n showAction = _this$props8.showAction;\n return action.indexOf('focus') !== -1 || showAction.indexOf('focus') !== -1;\n }\n }, {\n key: \"isBlurToHide\",\n value: function isBlurToHide() {\n var _this$props9 = this.props,\n action = _this$props9.action,\n hideAction = _this$props9.hideAction;\n return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1;\n }\n }, {\n key: \"forcePopupAlign\",\n value: function forcePopupAlign() {\n if (this.state.popupVisible && this.popupRef.current && this.popupRef.current.alignRef.current) {\n this.popupRef.current.alignRef.current.forceAlign();\n }\n }\n }, {\n key: \"fireEvents\",\n value: function fireEvents(type, e) {\n var childCallback = this.props.children.props[type];\n\n if (childCallback) {\n childCallback(e);\n }\n\n var callback = this.props[type];\n\n if (callback) {\n callback(e);\n }\n }\n }, {\n key: \"close\",\n value: function close() {\n this.setPopupVisible(false);\n }\n }, {\n key: \"render\",\n value: function render() {\n var popupVisible = this.state.popupVisible;\n var _this$props10 = this.props,\n children = _this$props10.children,\n forceRender = _this$props10.forceRender,\n alignPoint = _this$props10.alignPoint,\n className = _this$props10.className;\n var child = React.Children.only(children);\n var newChildProps = {\n key: 'trigger'\n };\n\n if (this.isContextMenuToShow()) {\n newChildProps.onContextMenu = this.onContextMenu;\n } else {\n newChildProps.onContextMenu = this.createTwoChains('onContextMenu');\n }\n\n if (this.isClickToHide() || this.isClickToShow()) {\n newChildProps.onClick = this.onClick;\n newChildProps.onMouseDown = this.onMouseDown;\n newChildProps.onTouchStart = this.onTouchStart;\n } else {\n newChildProps.onClick = this.createTwoChains('onClick');\n newChildProps.onMouseDown = this.createTwoChains('onMouseDown');\n newChildProps.onTouchStart = this.createTwoChains('onTouchStart');\n }\n\n if (this.isMouseEnterToShow()) {\n newChildProps.onMouseEnter = this.onMouseEnter;\n\n if (alignPoint) {\n newChildProps.onMouseMove = this.onMouseMove;\n }\n } else {\n newChildProps.onMouseEnter = this.createTwoChains('onMouseEnter');\n }\n\n if (this.isMouseLeaveToHide()) {\n newChildProps.onMouseLeave = this.onMouseLeave;\n } else {\n newChildProps.onMouseLeave = this.createTwoChains('onMouseLeave');\n }\n\n if (this.isFocusToShow() || this.isBlurToHide()) {\n newChildProps.onFocus = this.onFocus;\n newChildProps.onBlur = this.onBlur;\n } else {\n newChildProps.onFocus = this.createTwoChains('onFocus');\n newChildProps.onBlur = this.createTwoChains('onBlur');\n }\n\n var childrenClassName = classNames(child && child.props && child.props.className, className);\n\n if (childrenClassName) {\n newChildProps.className = childrenClassName;\n }\n\n var cloneProps = _objectSpread({}, newChildProps);\n\n if (supportRef(child)) {\n cloneProps.ref = composeRef(this.triggerRef, child.ref);\n }\n\n var trigger = React.cloneElement(child, cloneProps);\n var portal; // prevent unmounting after it's rendered\n\n if (popupVisible || this.popupRef.current || forceRender) {\n portal = React.createElement(PortalComponent, {\n key: \"portal\",\n getContainer: this.getContainer,\n didUpdate: this.handlePortalUpdate\n }, this.getComponent());\n }\n\n return React.createElement(TriggerContext.Provider, {\n value: {\n onPopupMouseDown: this.onPopupMouseDown\n }\n }, trigger, portal);\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(_ref, prevState) {\n var popupVisible = _ref.popupVisible;\n var newState = {};\n\n if (popupVisible !== undefined && prevState.popupVisible !== popupVisible) {\n newState.popupVisible = popupVisible;\n newState.prevPopupVisible = prevState.popupVisible;\n }\n\n return newState;\n }\n }]);\n\n return Trigger;\n }(React.Component);\n\n Trigger.contextType = TriggerContext;\n Trigger.defaultProps = {\n prefixCls: 'rc-trigger-popup',\n getPopupClassNameFromAlign: returnEmptyString,\n getDocument: returnDocument,\n onPopupVisibleChange: noop,\n afterPopupVisibleChange: noop,\n onPopupAlign: noop,\n popupClassName: '',\n mouseEnterDelay: 0,\n mouseLeaveDelay: 0.1,\n focusDelay: 0,\n blurDelay: 0.15,\n popupStyle: {},\n destroyPopupOnHide: false,\n popupAlign: {},\n defaultPopupVisible: false,\n mask: false,\n maskClosable: true,\n action: [],\n showAction: [],\n hideAction: []\n };\n return Trigger;\n}\nexport default generateTrigger(Portal);","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport * as React from 'react';\nimport Trigger from 'rc-trigger';\nimport classNames from 'classnames';\n\nvar getBuiltInPlacements = function getBuiltInPlacements(dropdownMatchSelectWidth) {\n // Enable horizontal overflow auto-adjustment when a custom dropdown width is provided\n var adjustX = typeof dropdownMatchSelectWidth !== 'number' ? 0 : 1;\n return {\n bottomLeft: {\n points: ['tl', 'bl'],\n offset: [0, 4],\n overflow: {\n adjustX: adjustX,\n adjustY: 1\n }\n },\n bottomRight: {\n points: ['tr', 'br'],\n offset: [0, 4],\n overflow: {\n adjustX: adjustX,\n adjustY: 1\n }\n },\n topLeft: {\n points: ['bl', 'tl'],\n offset: [0, -4],\n overflow: {\n adjustX: adjustX,\n adjustY: 1\n }\n },\n topRight: {\n points: ['br', 'tr'],\n offset: [0, -4],\n overflow: {\n adjustX: adjustX,\n adjustY: 1\n }\n }\n };\n};\n\nvar SelectTrigger = function SelectTrigger(props, ref) {\n var prefixCls = props.prefixCls,\n disabled = props.disabled,\n visible = props.visible,\n children = props.children,\n popupElement = props.popupElement,\n containerWidth = props.containerWidth,\n animation = props.animation,\n transitionName = props.transitionName,\n dropdownStyle = props.dropdownStyle,\n dropdownClassName = props.dropdownClassName,\n _props$direction = props.direction,\n direction = _props$direction === void 0 ? 'ltr' : _props$direction,\n _props$dropdownMatchS = props.dropdownMatchSelectWidth,\n dropdownMatchSelectWidth = _props$dropdownMatchS === void 0 ? true : _props$dropdownMatchS,\n dropdownRender = props.dropdownRender,\n dropdownAlign = props.dropdownAlign,\n getPopupContainer = props.getPopupContainer,\n empty = props.empty,\n getTriggerDOMNode = props.getTriggerDOMNode,\n restProps = _objectWithoutProperties(props, [\"prefixCls\", \"disabled\", \"visible\", \"children\", \"popupElement\", \"containerWidth\", \"animation\", \"transitionName\", \"dropdownStyle\", \"dropdownClassName\", \"direction\", \"dropdownMatchSelectWidth\", \"dropdownRender\", \"dropdownAlign\", \"getPopupContainer\", \"empty\", \"getTriggerDOMNode\"]);\n\n var dropdownPrefixCls = \"\".concat(prefixCls, \"-dropdown\");\n var popupNode = popupElement;\n\n if (dropdownRender) {\n popupNode = dropdownRender(popupElement);\n }\n\n var builtInPlacements = React.useMemo(function () {\n return getBuiltInPlacements(dropdownMatchSelectWidth);\n }, [dropdownMatchSelectWidth]); // ===================== Motion ======================\n\n var mergedTransitionName = animation ? \"\".concat(dropdownPrefixCls, \"-\").concat(animation) : transitionName; // ======================= Ref =======================\n\n var popupRef = React.useRef(null);\n React.useImperativeHandle(ref, function () {\n return {\n getPopupElement: function getPopupElement() {\n return popupRef.current;\n }\n };\n });\n\n var popupStyle = _objectSpread({\n minWidth: containerWidth\n }, dropdownStyle);\n\n if (typeof dropdownMatchSelectWidth === 'number') {\n popupStyle.width = dropdownMatchSelectWidth;\n } else if (dropdownMatchSelectWidth) {\n popupStyle.width = containerWidth;\n }\n\n return React.createElement(Trigger, Object.assign({}, restProps, {\n showAction: [],\n hideAction: [],\n popupPlacement: direction === 'rtl' ? 'bottomRight' : 'bottomLeft',\n builtinPlacements: builtInPlacements,\n prefixCls: dropdownPrefixCls,\n popupTransitionName: mergedTransitionName,\n popup: React.createElement(\"div\", {\n ref: popupRef\n }, popupNode),\n popupAlign: dropdownAlign,\n popupVisible: visible,\n getPopupContainer: getPopupContainer,\n popupClassName: classNames(dropdownClassName, _defineProperty({}, \"\".concat(dropdownPrefixCls, \"-empty\"), empty)),\n popupStyle: popupStyle,\n getTriggerDOMNode: getTriggerDOMNode\n }), children);\n};\n\nvar RefSelectTrigger = React.forwardRef(SelectTrigger);\nRefSelectTrigger.displayName = 'SelectTrigger';\nexport default RefSelectTrigger;","export var INTERNAL_PROPS_MARK = 'RC_SELECT_INTERNAL_PROPS_MARK';","function _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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nimport * as React from 'react';\n/**\n * Similar with `useLock`, but this hook will always execute last value.\n * When set to `true`, it will keep `true` for a short time even if `false` is set.\n */\n\nexport default function useDelayReset() {\n var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;\n\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n bool = _React$useState2[0],\n setBool = _React$useState2[1];\n\n var delayRef = React.useRef(null);\n\n var cancelLatest = function cancelLatest() {\n window.clearTimeout(delayRef.current);\n };\n\n React.useEffect(function () {\n return cancelLatest;\n }, []);\n\n var delaySetBool = function delaySetBool(value, callback) {\n cancelLatest();\n delayRef.current = window.setTimeout(function () {\n setBool(value);\n\n if (callback) {\n callback();\n }\n }, timeout);\n };\n\n return [bool, delaySetBool, cancelLatest];\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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\nimport * as React from 'react';\nexport default function useCacheDisplayValue(values) {\n var prevValuesRef = React.useRef(values);\n var mergedValues = React.useMemo(function () {\n // Create value - label map\n var valueLabels = new Map();\n prevValuesRef.current.forEach(function (_ref) {\n var value = _ref.value,\n label = _ref.label;\n\n if (value !== label) {\n valueLabels.set(value, label);\n }\n });\n var resultValues = values.map(function (item) {\n var cacheLabel = valueLabels.get(item.value);\n\n if (item.value === item.label && cacheLabel) {\n return _objectSpread(_objectSpread({}, item), {}, {\n label: cacheLabel\n });\n }\n\n return item;\n });\n prevValuesRef.current = resultValues;\n return resultValues;\n }, [values]);\n return mergedValues;\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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 _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\" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/**\n * To match accessibility requirement, we always provide an input in the component.\n * Other element will not set `tabIndex` to avoid `onBlur` sequence problem.\n * For focused select, we set `aria-live=\"polite\"` to update the accessibility content.\n *\n * ref:\n * - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions\n */\nimport * as React from 'react';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport classNames from 'classnames';\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport Selector from './Selector';\nimport SelectTrigger from './SelectTrigger';\nimport { INTERNAL_PROPS_MARK } from './interface/generator';\nimport { toInnerValue, toOuterValues, removeLastEnabledValue, getUUID } from './utils/commonUtil';\nimport TransBtn from './TransBtn';\nimport useLock from './hooks/useLock';\nimport useDelayReset from './hooks/useDelayReset';\nimport useLayoutEffect from './hooks/useLayoutEffect';\nimport { getSeparatedContent } from './utils/valueUtil';\nimport useSelectTriggerControl from './hooks/useSelectTriggerControl';\nimport useCacheDisplayValue from './hooks/useCacheDisplayValue';\nvar DEFAULT_OMIT_PROPS = ['removeIcon', 'placeholder', 'autoFocus', 'maxTagCount', 'maxTagTextLength', 'maxTagPlaceholder', 'choiceTransitionName', 'onInputKeyDown'];\n/**\n * This function is in internal usage.\n * Do not use it in your prod env since we may refactor this.\n */\n\nexport default function generateSelector(config) {\n var defaultPrefixCls = config.prefixCls,\n OptionList = config.components.optionList,\n convertChildrenToData = config.convertChildrenToData,\n flattenOptions = config.flattenOptions,\n getLabeledValue = config.getLabeledValue,\n filterOptions = config.filterOptions,\n isValueDisabled = config.isValueDisabled,\n findValueOption = config.findValueOption,\n warningProps = config.warningProps,\n fillOptionsWithMissingValue = config.fillOptionsWithMissingValue,\n omitDOMProps = config.omitDOMProps; // Use raw define since `React.FC` not support generic\n\n function Select(props, ref) {\n var _classNames2;\n\n var _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? defaultPrefixCls : _props$prefixCls,\n className = props.className,\n id = props.id,\n open = props.open,\n defaultOpen = props.defaultOpen,\n options = props.options,\n children = props.children,\n mode = props.mode,\n value = props.value,\n defaultValue = props.defaultValue,\n labelInValue = props.labelInValue,\n showSearch = props.showSearch,\n inputValue = props.inputValue,\n searchValue = props.searchValue,\n filterOption = props.filterOption,\n _props$optionFilterPr = props.optionFilterProp,\n optionFilterProp = _props$optionFilterPr === void 0 ? 'value' : _props$optionFilterPr,\n _props$autoClearSearc = props.autoClearSearchValue,\n autoClearSearchValue = _props$autoClearSearc === void 0 ? true : _props$autoClearSearc,\n onSearch = props.onSearch,\n allowClear = props.allowClear,\n clearIcon = props.clearIcon,\n showArrow = props.showArrow,\n inputIcon = props.inputIcon,\n menuItemSelectedIcon = props.menuItemSelectedIcon,\n disabled = props.disabled,\n loading = props.loading,\n defaultActiveFirstOption = props.defaultActiveFirstOption,\n _props$notFoundConten = props.notFoundContent,\n notFoundContent = _props$notFoundConten === void 0 ? 'Not Found' : _props$notFoundConten,\n optionLabelProp = props.optionLabelProp,\n backfill = props.backfill,\n getInputElement = props.getInputElement,\n getPopupContainer = props.getPopupContainer,\n _props$listHeight = props.listHeight,\n listHeight = _props$listHeight === void 0 ? 200 : _props$listHeight,\n _props$listItemHeight = props.listItemHeight,\n listItemHeight = _props$listItemHeight === void 0 ? 20 : _props$listItemHeight,\n animation = props.animation,\n transitionName = props.transitionName,\n virtual = props.virtual,\n dropdownStyle = props.dropdownStyle,\n dropdownClassName = props.dropdownClassName,\n dropdownMatchSelectWidth = props.dropdownMatchSelectWidth,\n dropdownRender = props.dropdownRender,\n dropdownAlign = props.dropdownAlign,\n _props$showAction = props.showAction,\n showAction = _props$showAction === void 0 ? [] : _props$showAction,\n direction = props.direction,\n tokenSeparators = props.tokenSeparators,\n tagRender = props.tagRender,\n onPopupScroll = props.onPopupScroll,\n onDropdownVisibleChange = props.onDropdownVisibleChange,\n onFocus = props.onFocus,\n onBlur = props.onBlur,\n onKeyUp = props.onKeyUp,\n onKeyDown = props.onKeyDown,\n onMouseDown = props.onMouseDown,\n onChange = props.onChange,\n onSelect = props.onSelect,\n onDeselect = props.onDeselect,\n _props$internalProps = props.internalProps,\n internalProps = _props$internalProps === void 0 ? {} : _props$internalProps,\n restProps = _objectWithoutProperties(props, [\"prefixCls\", \"className\", \"id\", \"open\", \"defaultOpen\", \"options\", \"children\", \"mode\", \"value\", \"defaultValue\", \"labelInValue\", \"showSearch\", \"inputValue\", \"searchValue\", \"filterOption\", \"optionFilterProp\", \"autoClearSearchValue\", \"onSearch\", \"allowClear\", \"clearIcon\", \"showArrow\", \"inputIcon\", \"menuItemSelectedIcon\", \"disabled\", \"loading\", \"defaultActiveFirstOption\", \"notFoundContent\", \"optionLabelProp\", \"backfill\", \"getInputElement\", \"getPopupContainer\", \"listHeight\", \"listItemHeight\", \"animation\", \"transitionName\", \"virtual\", \"dropdownStyle\", \"dropdownClassName\", \"dropdownMatchSelectWidth\", \"dropdownRender\", \"dropdownAlign\", \"showAction\", \"direction\", \"tokenSeparators\", \"tagRender\", \"onPopupScroll\", \"onDropdownVisibleChange\", \"onFocus\", \"onBlur\", \"onKeyUp\", \"onKeyDown\", \"onMouseDown\", \"onChange\", \"onSelect\", \"onDeselect\", \"internalProps\"]);\n\n var useInternalProps = internalProps.mark === INTERNAL_PROPS_MARK;\n var domProps = omitDOMProps ? omitDOMProps(restProps) : restProps;\n DEFAULT_OMIT_PROPS.forEach(function (prop) {\n delete domProps[prop];\n });\n var containerRef = React.useRef(null);\n var triggerRef = React.useRef(null);\n var selectorRef = React.useRef(null);\n var listRef = React.useRef(null);\n /** Used for component focused management */\n\n var _useDelayReset = useDelayReset(),\n _useDelayReset2 = _slicedToArray(_useDelayReset, 3),\n mockFocused = _useDelayReset2[0],\n setMockFocused = _useDelayReset2[1],\n cancelSetMockFocused = _useDelayReset2[2]; // Inner id for accessibility usage. Only work in client side\n\n\n var _React$useState = React.useState(),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n innerId = _React$useState2[0],\n setInnerId = _React$useState2[1];\n\n React.useEffect(function () {\n setInnerId(\"rc_select_\".concat(getUUID()));\n }, []);\n var mergedId = id || innerId; // optionLabelProp\n\n var mergedOptionLabelProp = optionLabelProp;\n\n if (mergedOptionLabelProp === undefined) {\n mergedOptionLabelProp = options ? 'label' : 'children';\n } // labelInValue\n\n\n var mergedLabelInValue = mode === 'combobox' ? false : labelInValue;\n var isMultiple = mode === 'tags' || mode === 'multiple';\n var mergedShowSearch = showSearch !== undefined ? showSearch : isMultiple || mode === 'combobox'; // ============================== Ref ===============================\n\n var selectorDomRef = React.useRef(null);\n React.useImperativeHandle(ref, function () {\n return {\n focus: selectorRef.current.focus,\n blur: selectorRef.current.blur\n };\n }); // ============================= Value ==============================\n\n var _React$useState3 = React.useState(value || defaultValue),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n innerValue = _React$useState4[0],\n setInnerValue = _React$useState4[1];\n\n var baseValue = value !== undefined ? value : innerValue; // Should reset when controlled to be uncontrolled\n\n var prevValueRef = React.useRef(value);\n React.useEffect(function () {\n if (prevValueRef.current !== value && (value === undefined || value === null)) {\n setInnerValue(undefined);\n }\n\n prevValueRef.current = value;\n }, [value]);\n /** Unique raw values */\n\n var mergedRawValue = React.useMemo(function () {\n return toInnerValue(baseValue, {\n labelInValue: mergedLabelInValue,\n combobox: mode === 'combobox'\n });\n }, [baseValue, mergedLabelInValue]);\n /** We cache a set of raw values to speed up check */\n\n var rawValues = React.useMemo(function () {\n return new Set(mergedRawValue);\n }, [mergedRawValue]); // ============================= Option =============================\n // Set by option list active, it will merge into search input when mode is `combobox`\n\n var _React$useState5 = React.useState(null),\n _React$useState6 = _slicedToArray(_React$useState5, 2),\n activeValue = _React$useState6[0],\n setActiveValue = _React$useState6[1];\n\n var _React$useState7 = React.useState(''),\n _React$useState8 = _slicedToArray(_React$useState7, 2),\n innerSearchValue = _React$useState8[0],\n setInnerSearchValue = _React$useState8[1];\n\n var mergedSearchValue = innerSearchValue;\n\n if (mode === 'combobox' && value !== undefined) {\n mergedSearchValue = value;\n } else if (searchValue !== undefined) {\n mergedSearchValue = searchValue;\n } else if (inputValue) {\n mergedSearchValue = inputValue;\n }\n\n var mergedOptions = React.useMemo(function () {\n var newOptions = options;\n\n if (newOptions === undefined) {\n newOptions = convertChildrenToData(children);\n }\n /**\n * `tags` should fill un-list item.\n * This is not cool here since TreeSelect do not need this\n */\n\n\n if (mode === 'tags' && fillOptionsWithMissingValue) {\n newOptions = fillOptionsWithMissingValue(newOptions, baseValue, mergedOptionLabelProp, labelInValue);\n }\n\n return newOptions || [];\n }, [options, children, mode, baseValue]);\n var mergedFlattenOptions = React.useMemo(function () {\n return flattenOptions(mergedOptions, props);\n }, [mergedOptions]); // Display options for OptionList\n\n var displayOptions = React.useMemo(function () {\n if (!mergedSearchValue || !mergedShowSearch) {\n return _toConsumableArray(mergedOptions);\n }\n\n var filteredOptions = filterOptions(mergedSearchValue, mergedOptions, {\n optionFilterProp: optionFilterProp,\n filterOption: mode === 'combobox' && filterOption === undefined ? function () {\n return true;\n } : filterOption\n });\n\n if (mode === 'tags' && filteredOptions.every(function (opt) {\n return opt.value !== mergedSearchValue;\n })) {\n filteredOptions.unshift({\n value: mergedSearchValue,\n label: mergedSearchValue,\n key: '__RC_SELECT_TAG_PLACEHOLDER__'\n });\n }\n\n return filteredOptions;\n }, [mergedOptions, mergedSearchValue, mode, mergedShowSearch]);\n var displayFlattenOptions = React.useMemo(function () {\n return flattenOptions(displayOptions, props);\n }, [displayOptions]);\n React.useEffect(function () {\n if (listRef.current && listRef.current.scrollTo) {\n listRef.current.scrollTo(0);\n }\n }, [mergedSearchValue]); // ============================ Selector ============================\n\n var displayValues = React.useMemo(function () {\n return mergedRawValue.map(function (val) {\n var displayValue = getLabeledValue(val, {\n options: mergedFlattenOptions,\n prevValue: baseValue,\n labelInValue: mergedLabelInValue,\n optionLabelProp: mergedOptionLabelProp\n });\n return _objectSpread(_objectSpread({}, displayValue), {}, {\n disabled: isValueDisabled(val, mergedFlattenOptions)\n });\n });\n }, [baseValue, mergedOptions]); // Polyfill with cache label\n\n displayValues = useCacheDisplayValue(displayValues);\n\n var triggerSelect = function triggerSelect(newValue, isSelect, source) {\n var outOption = findValueOption([newValue], mergedFlattenOptions)[0];\n\n if (!internalProps.skipTriggerSelect) {\n // Skip trigger `onSelect` or `onDeselect` if configured\n var selectValue = mergedLabelInValue ? getLabeledValue(newValue, {\n options: mergedFlattenOptions,\n prevValue: baseValue,\n labelInValue: mergedLabelInValue,\n optionLabelProp: mergedOptionLabelProp\n }) : newValue;\n\n if (isSelect && onSelect) {\n onSelect(selectValue, outOption);\n } else if (!isSelect && onDeselect) {\n onDeselect(selectValue, outOption);\n }\n } // Trigger internal event\n\n\n if (useInternalProps) {\n if (isSelect && internalProps.onRawSelect) {\n internalProps.onRawSelect(newValue, outOption, source);\n } else if (!isSelect && internalProps.onRawDeselect) {\n internalProps.onRawDeselect(newValue, outOption, source);\n }\n }\n };\n\n var triggerChange = function triggerChange(newRawValues) {\n if (useInternalProps && internalProps.skipTriggerChange) {\n return;\n }\n\n var outValues = toOuterValues(Array.from(newRawValues), {\n labelInValue: mergedLabelInValue,\n options: mergedFlattenOptions,\n getLabeledValue: getLabeledValue,\n prevValue: baseValue,\n optionLabelProp: mergedOptionLabelProp\n });\n var outValue = isMultiple ? outValues : outValues[0]; // Skip trigger if prev & current value is both empty\n\n if (onChange && (mergedRawValue.length !== 0 || outValues.length !== 0)) {\n var outOptions = findValueOption(newRawValues, mergedFlattenOptions);\n onChange(outValue, isMultiple ? outOptions : outOptions[0]);\n }\n\n setInnerValue(outValue);\n };\n\n var onInternalSelect = function onInternalSelect(newValue, _ref) {\n var selected = _ref.selected,\n source = _ref.source;\n\n if (disabled) {\n return;\n }\n\n var newRawValue;\n\n if (isMultiple) {\n newRawValue = new Set(mergedRawValue);\n\n if (selected) {\n newRawValue.add(newValue);\n } else {\n newRawValue.delete(newValue);\n }\n } else {\n newRawValue = new Set();\n newRawValue.add(newValue);\n } // Multiple always trigger change and single should change if value changed\n\n\n if (isMultiple || !isMultiple && Array.from(mergedRawValue)[0] !== newValue) {\n triggerChange(Array.from(newRawValue));\n } // Trigger `onSelect`. Single mode always trigger select\n\n\n triggerSelect(newValue, !isMultiple || selected, source); // Clean search value if single or configured\n\n if (mode === 'combobox') {\n setInnerSearchValue(String(newValue));\n setActiveValue('');\n } else if (!isMultiple || autoClearSearchValue) {\n setInnerSearchValue('');\n setActiveValue('');\n }\n };\n\n var onInternalOptionSelect = function onInternalOptionSelect(newValue, info) {\n onInternalSelect(newValue, _objectSpread(_objectSpread({}, info), {}, {\n source: 'option'\n }));\n };\n\n var onInternalSelectionSelect = function onInternalSelectionSelect(newValue, info) {\n onInternalSelect(newValue, _objectSpread(_objectSpread({}, info), {}, {\n source: 'selection'\n }));\n }; // ============================= Input ==============================\n // Only works in `combobox`\n\n\n var customizeInputElement = mode === 'combobox' && getInputElement && getInputElement() || null; // ============================== Open ==============================\n\n var _useMergedState = useMergedState(undefined, {\n defaultValue: defaultOpen,\n value: open\n }),\n _useMergedState2 = _slicedToArray(_useMergedState, 2),\n innerOpen = _useMergedState2[0],\n setInnerOpen = _useMergedState2[1];\n\n var mergedOpen = innerOpen; // Not trigger `open` in `combobox` when `notFoundContent` is empty\n\n var emptyListContent = !notFoundContent && !displayOptions.length;\n\n if (disabled || emptyListContent && mergedOpen && mode === 'combobox') {\n mergedOpen = false;\n }\n\n var triggerOpen = emptyListContent ? false : mergedOpen;\n\n var onToggleOpen = function onToggleOpen(newOpen) {\n var nextOpen = newOpen !== undefined ? newOpen : !mergedOpen;\n\n if (innerOpen !== nextOpen && !disabled) {\n setInnerOpen(nextOpen);\n\n if (onDropdownVisibleChange) {\n onDropdownVisibleChange(nextOpen);\n }\n }\n };\n\n useSelectTriggerControl([containerRef.current, triggerRef.current && triggerRef.current.getPopupElement()], triggerOpen, onToggleOpen); // ============================= Search =============================\n\n var triggerSearch = function triggerSearch(searchText) {\n var fromTyping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var ret = true;\n var newSearchText = searchText;\n setActiveValue(null); // Check if match the `tokenSeparators`\n\n var patchLabels = getSeparatedContent(searchText, tokenSeparators);\n var patchRawValues = patchLabels;\n\n if (mode === 'combobox') {\n // Only typing will trigger onChange\n if (fromTyping) {\n triggerChange([newSearchText]);\n }\n } else if (patchLabels) {\n newSearchText = '';\n\n if (mode !== 'tags') {\n patchRawValues = patchLabels.map(function (label) {\n var item = mergedFlattenOptions.find(function (_ref2) {\n var data = _ref2.data;\n return data[mergedOptionLabelProp] === label;\n });\n return item ? item.data.value : null;\n }).filter(function (val) {\n return val !== null;\n });\n }\n\n var newRawValues = Array.from(new Set([].concat(_toConsumableArray(mergedRawValue), _toConsumableArray(patchRawValues))));\n triggerChange(newRawValues);\n newRawValues.forEach(function (newRawValue) {\n triggerSelect(newRawValue, true, 'input');\n }); // Should close when paste finish\n\n onToggleOpen(false); // Tell Selector that break next actions\n\n ret = false;\n }\n\n setInnerSearchValue(newSearchText);\n\n if (onSearch && mergedSearchValue !== newSearchText) {\n onSearch(newSearchText);\n }\n\n return ret;\n }; // Close dropdown when disabled change\n\n\n React.useEffect(function () {\n if (innerOpen && !!disabled) {\n setInnerOpen(false);\n }\n }, [disabled]); // Close will clean up single mode search text\n\n React.useEffect(function () {\n if (!mergedOpen && !isMultiple && mode !== 'combobox') {\n triggerSearch('', false);\n }\n }, [mergedOpen]); // ============================ Keyboard ============================\n\n /**\n * We record input value here to check if can press to clean up by backspace\n * - null: Key is not down, this is reset by key up\n * - true: Search text is empty when first time backspace down\n * - false: Search text is not empty when first time backspace down\n */\n\n var _useLock = useLock(),\n _useLock2 = _slicedToArray(_useLock, 2),\n getClearLock = _useLock2[0],\n setClearLock = _useLock2[1]; // KeyDown\n\n\n var onInternalKeyDown = function onInternalKeyDown(event) {\n var clearLock = getClearLock();\n var which = event.which; // We only manage open state here, close logic should handle by list component\n\n if (!mergedOpen && which === KeyCode.ENTER) {\n onToggleOpen(true);\n }\n\n setClearLock(!!mergedSearchValue); // Remove value by `backspace`\n\n if (which === KeyCode.BACKSPACE && !clearLock && isMultiple && !mergedSearchValue && mergedRawValue.length) {\n var removeInfo = removeLastEnabledValue(displayValues, mergedRawValue);\n\n if (removeInfo.removedValue !== null) {\n triggerChange(removeInfo.values);\n triggerSelect(removeInfo.removedValue, false, 'input');\n }\n }\n\n for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n rest[_key - 1] = arguments[_key];\n }\n\n if (mergedOpen && listRef.current) {\n var _listRef$current;\n\n (_listRef$current = listRef.current).onKeyDown.apply(_listRef$current, [event].concat(rest));\n }\n\n if (onKeyDown) {\n onKeyDown.apply(void 0, [event].concat(rest));\n }\n }; // KeyUp\n\n\n var onInternalKeyUp = function onInternalKeyUp(event) {\n for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n rest[_key2 - 1] = arguments[_key2];\n }\n\n if (mergedOpen && listRef.current) {\n var _listRef$current2;\n\n (_listRef$current2 = listRef.current).onKeyUp.apply(_listRef$current2, [event].concat(rest));\n }\n\n if (onKeyUp) {\n onKeyUp.apply(void 0, [event].concat(rest));\n }\n }; // ========================== Focus / Blur ==========================\n\n /** Record real focus status */\n\n\n var focusRef = React.useRef(false);\n\n var onContainerFocus = function onContainerFocus() {\n setMockFocused(true);\n\n if (!disabled) {\n if (onFocus && !focusRef.current) {\n onFocus.apply(void 0, arguments);\n } // `showAction` should handle `focus` if set\n\n\n if (showAction.includes('focus')) {\n onToggleOpen(true);\n }\n }\n\n focusRef.current = true;\n };\n\n var onContainerBlur = function onContainerBlur() {\n setMockFocused(false, function () {\n focusRef.current = false;\n onToggleOpen(false);\n });\n\n if (disabled) {\n return;\n }\n\n if (mergedSearchValue) {\n // `tags` mode should move `searchValue` into values\n if (mode === 'tags') {\n triggerSearch('', false);\n triggerChange(Array.from(new Set([].concat(_toConsumableArray(mergedRawValue), [mergedSearchValue]))));\n } else if (mode === 'multiple') {\n // `multiple` mode only clean the search value but not trigger event\n setInnerSearchValue('');\n }\n }\n\n if (onBlur) {\n onBlur.apply(void 0, arguments);\n }\n };\n\n var activeTimeoutIds = [];\n React.useEffect(function () {\n return function () {\n activeTimeoutIds.forEach(function (timeoutId) {\n return clearTimeout(timeoutId);\n });\n activeTimeoutIds.splice(0, activeTimeoutIds.length);\n };\n }, []);\n\n var onInternalMouseDown = function onInternalMouseDown(event) {\n var target = event.target;\n var popupElement = triggerRef.current && triggerRef.current.getPopupElement(); // We should give focus back to selector if clicked item is not focusable\n\n if (popupElement && popupElement.contains(target)) {\n var timeoutId = setTimeout(function () {\n var index = activeTimeoutIds.indexOf(timeoutId);\n\n if (index !== -1) {\n activeTimeoutIds.splice(index, 1);\n }\n\n cancelSetMockFocused();\n\n if (!popupElement.contains(document.activeElement)) {\n selectorRef.current.focus();\n }\n });\n activeTimeoutIds.push(timeoutId);\n }\n\n if (onMouseDown) {\n for (var _len3 = arguments.length, restArgs = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n restArgs[_key3 - 1] = arguments[_key3];\n }\n\n onMouseDown.apply(void 0, [event].concat(restArgs));\n }\n }; // ========================= Accessibility ==========================\n\n\n var _React$useState9 = React.useState(0),\n _React$useState10 = _slicedToArray(_React$useState9, 2),\n accessibilityIndex = _React$useState10[0],\n setAccessibilityIndex = _React$useState10[1];\n\n var mergedDefaultActiveFirstOption = defaultActiveFirstOption !== undefined ? defaultActiveFirstOption : mode !== 'combobox';\n\n var onActiveValue = function onActiveValue(active, index) {\n setAccessibilityIndex(index);\n\n if (backfill && mode === 'combobox' && active !== null) {\n setActiveValue(String(active));\n }\n }; // ============================= Popup ==============================\n\n\n var _React$useState11 = React.useState(null),\n _React$useState12 = _slicedToArray(_React$useState11, 2),\n containerWidth = _React$useState12[0],\n setContainerWidth = _React$useState12[1];\n\n useLayoutEffect(function () {\n if (triggerOpen) {\n var newWidth = Math.ceil(containerRef.current.offsetWidth);\n\n if (containerWidth !== newWidth) {\n setContainerWidth(newWidth);\n }\n }\n }, [triggerOpen]);\n var popupNode = React.createElement(OptionList, {\n ref: listRef,\n prefixCls: prefixCls,\n id: mergedId,\n open: mergedOpen,\n childrenAsData: !options,\n options: displayOptions,\n flattenOptions: displayFlattenOptions,\n multiple: isMultiple,\n values: rawValues,\n height: listHeight,\n itemHeight: listItemHeight,\n onSelect: onInternalOptionSelect,\n onToggleOpen: onToggleOpen,\n onActiveValue: onActiveValue,\n defaultActiveFirstOption: mergedDefaultActiveFirstOption,\n notFoundContent: notFoundContent,\n onScroll: onPopupScroll,\n searchValue: mergedSearchValue,\n menuItemSelectedIcon: menuItemSelectedIcon,\n virtual: virtual !== false && dropdownMatchSelectWidth !== false\n }); // ============================= Clear ==============================\n\n var clearNode;\n\n var onClearMouseDown = function onClearMouseDown() {\n // Trigger internal `onClear` event\n if (useInternalProps && internalProps.onClear) {\n internalProps.onClear();\n }\n\n triggerChange([]);\n triggerSearch('', false);\n };\n\n if (!disabled && allowClear && (mergedRawValue.length || mergedSearchValue)) {\n clearNode = React.createElement(TransBtn, {\n className: \"\".concat(prefixCls, \"-clear\"),\n onMouseDown: onClearMouseDown,\n customizeIcon: clearIcon\n }, \"\\xD7\");\n } // ============================= Arrow ==============================\n\n\n var mergedShowArrow = showArrow !== undefined ? showArrow : loading || !isMultiple && mode !== 'combobox';\n var arrowNode;\n\n if (mergedShowArrow) {\n arrowNode = React.createElement(TransBtn, {\n className: classNames(\"\".concat(prefixCls, \"-arrow\"), _defineProperty({}, \"\".concat(prefixCls, \"-arrow-loading\"), loading)),\n customizeIcon: inputIcon,\n customizeIconProps: {\n loading: loading,\n searchValue: mergedSearchValue,\n open: mergedOpen,\n focused: mockFocused,\n showSearch: mergedShowSearch\n }\n });\n } // ============================ Warning =============================\n\n\n if (process.env.NODE_ENV !== 'production' && warningProps) {\n warningProps(props);\n } // ============================= Render =============================\n\n\n var mergedClassName = classNames(prefixCls, className, (_classNames2 = {}, _defineProperty(_classNames2, \"\".concat(prefixCls, \"-focused\"), mockFocused), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-multiple\"), isMultiple), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-single\"), !isMultiple), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-allow-clear\"), allowClear), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-show-arrow\"), mergedShowArrow), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-disabled\"), disabled), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-loading\"), loading), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-open\"), mergedOpen), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-customize-input\"), customizeInputElement), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-show-search\"), mergedShowSearch), _classNames2));\n return React.createElement(\"div\", Object.assign({\n className: mergedClassName\n }, domProps, {\n ref: containerRef,\n onMouseDown: onInternalMouseDown,\n onKeyDown: onInternalKeyDown,\n onKeyUp: onInternalKeyUp,\n onFocus: onContainerFocus,\n onBlur: onContainerBlur\n }), mockFocused && !mergedOpen && React.createElement(\"span\", {\n style: {\n width: 0,\n height: 0,\n display: 'flex',\n overflow: 'hidden',\n opacity: 0\n },\n \"aria-live\": \"polite\"\n }, \"\".concat(mergedRawValue.join(', '))), React.createElement(SelectTrigger, {\n ref: triggerRef,\n disabled: disabled,\n prefixCls: prefixCls,\n visible: triggerOpen,\n popupElement: popupNode,\n containerWidth: containerWidth,\n animation: animation,\n transitionName: transitionName,\n dropdownStyle: dropdownStyle,\n dropdownClassName: dropdownClassName,\n direction: direction,\n dropdownMatchSelectWidth: dropdownMatchSelectWidth,\n dropdownRender: dropdownRender,\n dropdownAlign: dropdownAlign,\n getPopupContainer: getPopupContainer,\n empty: !mergedOptions.length,\n getTriggerDOMNode: function getTriggerDOMNode() {\n return selectorDomRef.current;\n }\n }, React.createElement(Selector, Object.assign({}, props, {\n domRef: selectorDomRef,\n prefixCls: prefixCls,\n inputElement: customizeInputElement,\n ref: selectorRef,\n id: mergedId,\n showSearch: mergedShowSearch,\n mode: mode,\n accessibilityIndex: accessibilityIndex,\n multiple: isMultiple,\n tagRender: tagRender,\n values: displayValues,\n open: mergedOpen,\n onToggleOpen: onToggleOpen,\n searchValue: mergedSearchValue,\n activeValue: activeValue,\n onSearch: triggerSearch,\n onSelect: onInternalSelectionSelect\n }))), arrowNode, clearNode);\n }\n\n var RefSelect = React.forwardRef(Select);\n return RefSelect;\n}","import * as React from 'react';\nexport default function useSelectTriggerControl(elements, open, triggerOpen) {\n var propsRef = React.useRef(null);\n propsRef.current = {\n elements: elements.filter(function (e) {\n return e;\n }),\n open: open,\n triggerOpen: triggerOpen\n };\n React.useEffect(function () {\n function onGlobalMouseDown(event) {\n var target = event.target;\n\n if (propsRef.current.open && propsRef.current.elements.every(function (element) {\n return !element.contains(target) && element !== target;\n })) {\n // Should trigger close\n propsRef.current.triggerOpen(false);\n }\n }\n\n window.addEventListener('mousedown', onGlobalMouseDown);\n return function () {\n return window.removeEventListener('mousedown', onGlobalMouseDown);\n };\n }, []);\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport React from 'react';\nimport warning, { noteOnce } from \"rc-util/es/warning\";\nimport toNodeArray from \"rc-util/es/Children/toArray\";\nimport { convertChildrenToData } from './legacyUtil';\nimport { toArray } from './commonUtil';\n\nfunction warningProps(props) {\n var mode = props.mode,\n options = props.options,\n children = props.children,\n backfill = props.backfill,\n allowClear = props.allowClear,\n placeholder = props.placeholder,\n getInputElement = props.getInputElement,\n showSearch = props.showSearch,\n onSearch = props.onSearch,\n defaultOpen = props.defaultOpen,\n autoFocus = props.autoFocus,\n labelInValue = props.labelInValue,\n value = props.value,\n inputValue = props.inputValue,\n optionLabelProp = props.optionLabelProp;\n var multiple = mode === 'multiple' || mode === 'tags';\n var mergedShowSearch = showSearch !== undefined ? showSearch : multiple || mode === 'combobox';\n var mergedOptions = options || convertChildrenToData(children); // `tags` should not set option as disabled\n\n warning(mode !== 'tags' || mergedOptions.every(function (opt) {\n return !opt.disabled;\n }), 'Please avoid setting option to disabled in tags mode since user can always type text as tag.'); // `combobox` & `tags` should option be `string` type\n\n if (mode === 'tags' || mode === 'combobox') {\n var hasNumberValue = mergedOptions.some(function (item) {\n if (item.options) {\n return item.options.some(function (opt) {\n return typeof ('value' in opt ? opt.value : opt.key) === 'number';\n });\n }\n\n return typeof ('value' in item ? item.value : item.key) === 'number';\n });\n warning(!hasNumberValue, '`value` of Option should not use number type when `mode` is `tags` or `combobox`.');\n } // `combobox` should not use `optionLabelProp`\n\n\n warning(mode !== 'combobox' || !optionLabelProp, '`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly.'); // Only `combobox` support `backfill`\n\n warning(mode === 'combobox' || !backfill, '`backfill` only works with `combobox` mode.'); // Only `combobox` support `getInputElement`\n\n warning(mode === 'combobox' || !getInputElement, '`getInputElement` only work with `combobox` mode.'); // Customize `getInputElement` should not use `allowClear` & `placeholder`\n\n noteOnce(mode !== 'combobox' || !getInputElement || !allowClear || !placeholder, 'Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`.'); // `onSearch` should use in `combobox` or `showSearch`\n\n if (onSearch && !mergedShowSearch && mode !== 'combobox' && mode !== 'tags') {\n warning(false, '`onSearch` should work with `showSearch` instead of use alone.');\n }\n\n noteOnce(!defaultOpen || autoFocus, '`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed.');\n\n if (value !== undefined && value !== null) {\n var values = toArray(value);\n warning(!labelInValue || values.every(function (val) {\n return _typeof(val) === 'object' && ('key' in val || 'value' in val);\n }), '`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`');\n warning(!multiple || Array.isArray(value), '`value` should be array when `mode` is `multiple` or `tags`');\n } // Syntactic sugar should use correct children type\n\n\n if (children) {\n var invalidateChildType = null;\n toNodeArray(children).some(function (node) {\n if (!React.isValidElement(node) || !node.type) {\n return false;\n }\n\n var type = node.type;\n\n if (type.isSelectOption) {\n return false;\n }\n\n if (type.isSelectOptGroup) {\n var allChildrenValid = toNodeArray(node.props.children).every(function (subNode) {\n if (!React.isValidElement(subNode) || !node.type || subNode.type.isSelectOption) {\n return true;\n }\n\n invalidateChildType = subNode.type;\n return false;\n });\n\n if (allChildrenValid) {\n return false;\n }\n\n return true;\n }\n\n invalidateChildType = type;\n return true;\n });\n\n if (invalidateChildType) {\n warning(false, \"`children` should be `Select.Option` or `Select.OptGroup` instead of `\".concat(invalidateChildType.displayName || invalidateChildType.name || invalidateChildType, \"`.\"));\n }\n\n warning(inputValue === undefined, '`inputValue` is deprecated, please use `searchValue` instead.');\n }\n}\n\nexport default warningProps;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * To match accessibility requirement, we always provide an input in the component.\n * Other element will not set `tabIndex` to avoid `onBlur` sequence problem.\n * For focused select, we set `aria-live=\"polite\"` to update the accessibility content.\n *\n * ref:\n * - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions\n *\n * New api:\n * - listHeight\n * - listItemHeight\n * - component\n *\n * Remove deprecated api:\n * - multiple\n * - tags\n * - combobox\n * - firstActiveValue\n * - dropdownMenuStyle\n * - openClassName (Not list in api)\n *\n * Update:\n * - `backfill` only support `combobox` mode\n * - `combobox` mode not support `labelInValue` since it's meaningless\n * - `getInputElement` only support `combobox` mode\n * - `onChange` return OptionData instead of ReactNode\n * - `filterOption` `onChange` `onSelect` accept OptionData instead of ReactNode\n * - `combobox` mode trigger `onChange` will get `undefined` if no `value` match in Option\n * - `combobox` mode not support `optionLabelProp`\n */\nimport React from 'react';\nimport SelectOptionList from './OptionList';\nimport Option from './Option';\nimport OptGroup from './OptGroup';\nimport { convertChildrenToData as convertSelectChildrenToData } from './utils/legacyUtil';\nimport { getLabeledValue as getSelectLabeledValue, filterOptions as selectDefaultFilterOptions, isValueDisabled as isSelectValueDisabled, findValueOption as findSelectValueOption, flattenOptions, fillOptionsWithMissingValue } from './utils/valueUtil';\nimport generateSelector from './generate';\nimport warningProps from './utils/warningPropsUtil';\nvar RefSelect = generateSelector({\n prefixCls: 'rc-select',\n components: {\n optionList: SelectOptionList\n },\n convertChildrenToData: convertSelectChildrenToData,\n flattenOptions: flattenOptions,\n getLabeledValue: getSelectLabeledValue,\n filterOptions: selectDefaultFilterOptions,\n isValueDisabled: isSelectValueDisabled,\n findValueOption: findSelectValueOption,\n warningProps: warningProps,\n fillOptionsWithMissingValue: fillOptionsWithMissingValue\n});\n/**\n * Typescript not support generic with function component,\n * we have to wrap an class component to handle this.\n */\n\nvar Select = /*#__PURE__*/function (_React$Component) {\n _inherits(Select, _React$Component);\n\n var _super = _createSuper(Select);\n\n function Select() {\n var _this;\n\n _classCallCheck(this, Select);\n\n _this = _super.apply(this, arguments);\n _this.selectRef = React.createRef();\n\n _this.focus = function () {\n _this.selectRef.current.focus();\n };\n\n _this.blur = function () {\n _this.selectRef.current.blur();\n };\n\n return _this;\n }\n\n _createClass(Select, [{\n key: \"render\",\n value: function render() {\n return React.createElement(RefSelect, Object.assign({\n ref: this.selectRef\n }, this.props));\n }\n }]);\n\n return Select;\n}(React.Component);\n\nSelect.Option = Option;\nSelect.OptGroup = OptGroup;\nexport default Select;","import Select from './Select';\nimport Option from './Option';\nimport OptGroup from './OptGroup';\nexport { Option, OptGroup };\nexport default Select;","import * as React from 'react';\nimport DownOutlined from '@ant-design/icons/DownOutlined';\nimport LoadingOutlined from '@ant-design/icons/LoadingOutlined';\nimport CheckOutlined from '@ant-design/icons/CheckOutlined';\nimport CloseOutlined from '@ant-design/icons/CloseOutlined';\nimport CloseCircleFilled from '@ant-design/icons/CloseCircleFilled';\nimport SearchOutlined from '@ant-design/icons/SearchOutlined';\nexport default function getIcons({ suffixIcon, clearIcon, menuItemSelectedIcon, removeIcon, loading, multiple, }) {\n // Clear Icon\n let mergedClearIcon = clearIcon;\n if (!clearIcon) {\n mergedClearIcon =
;\n }\n // Arrow item icon\n let mergedSuffixIcon = null;\n if (suffixIcon !== undefined) {\n mergedSuffixIcon = suffixIcon;\n }\n else if (loading) {\n mergedSuffixIcon =
;\n }\n else {\n mergedSuffixIcon = ({ open, showSearch }) => {\n if (open && showSearch) {\n return
;\n }\n return
;\n };\n }\n // Checked item icon\n let mergedItemIcon = null;\n if (menuItemSelectedIcon !== undefined) {\n mergedItemIcon = menuItemSelectedIcon;\n }\n else if (multiple) {\n mergedItemIcon =
;\n }\n else {\n mergedItemIcon = null;\n }\n let mergedRemoveIcon = null;\n if (removeIcon !== undefined) {\n mergedRemoveIcon = removeIcon;\n }\n else {\n mergedRemoveIcon =
;\n }\n return {\n clearIcon: mergedClearIcon,\n suffixIcon: mergedSuffixIcon,\n itemIcon: mergedItemIcon,\n removeIcon: mergedRemoveIcon,\n };\n}\n","// TODO: 4.0 - codemod should help to change `filterOption` to support node props.\nimport * as React from 'react';\nimport omit from 'omit.js';\nimport classNames from 'classnames';\nimport RcSelect, { Option, OptGroup } from 'rc-select';\nimport { ConfigConsumer } from '../config-provider';\nimport getIcons from './utils/iconUtil';\nimport SizeContext from '../config-provider/SizeContext';\n// We still use class here since `forwardRef` not support generic in typescript\nclass Select extends React.Component {\n constructor() {\n super(...arguments);\n this.selectRef = React.createRef();\n this.focus = () => {\n if (this.selectRef.current) {\n this.selectRef.current.focus();\n }\n };\n this.blur = () => {\n if (this.selectRef.current) {\n this.selectRef.current.blur();\n }\n };\n this.getMode = () => {\n const { mode } = this.props;\n if (mode === 'combobox') {\n return undefined;\n }\n if (mode === Select.SECRET_COMBOBOX_MODE_DO_NOT_USE) {\n return 'combobox';\n }\n return mode;\n };\n this.renderSelect = ({ getPopupContainer: getContextPopupContainer, getPrefixCls, renderEmpty, direction, }) => {\n const { prefixCls: customizePrefixCls, notFoundContent, className, size: customizeSize, listHeight = 256, listItemHeight = 32, getPopupContainer, dropdownClassName, bordered, } = this.props;\n const prefixCls = getPrefixCls('select', customizePrefixCls);\n const mode = this.getMode();\n const isMultiple = mode === 'multiple' || mode === 'tags';\n // ===================== Empty =====================\n let mergedNotFound;\n if (notFoundContent !== undefined) {\n mergedNotFound = notFoundContent;\n }\n else if (mode === 'combobox') {\n mergedNotFound = null;\n }\n else {\n mergedNotFound = renderEmpty('Select');\n }\n // ===================== Icons =====================\n const { suffixIcon, itemIcon, removeIcon, clearIcon } = getIcons(Object.assign(Object.assign({}, this.props), { multiple: isMultiple }));\n const selectProps = omit(this.props, [\n 'prefixCls',\n 'suffixIcon',\n 'itemIcon',\n 'removeIcon',\n 'clearIcon',\n 'size',\n 'bordered',\n ]);\n const rcSelectRtlDropDownClassName = classNames(dropdownClassName, {\n [`${prefixCls}-dropdown-${direction}`]: direction === 'rtl',\n });\n return (
\n {size => {\n const mergedSize = customizeSize || size;\n const mergedClassName = classNames(className, {\n [`${prefixCls}-lg`]: mergedSize === 'large',\n [`${prefixCls}-sm`]: mergedSize === 'small',\n [`${prefixCls}-rtl`]: direction === 'rtl',\n [`${prefixCls}-borderless`]: !bordered,\n });\n return ();\n }}\n );\n };\n }\n render() {\n return
{this.renderSelect};\n }\n}\nSelect.Option = Option;\nSelect.OptGroup = OptGroup;\nSelect.SECRET_COMBOBOX_MODE_DO_NOT_USE = 'SECRET_COMBOBOX_MODE_DO_NOT_USE';\nSelect.defaultProps = {\n transitionName: 'slide-up',\n choiceTransitionName: 'zoom',\n bordered: true,\n};\nexport default Select;\n","/**\n * TODO: 4.0\n * - remove `dataSource`\n * - `size` not work with customizeInput\n * - customizeInput not feedback `ENTER` key since accessibility enhancement\n */\nimport * as React from 'react';\nimport toArray from 'rc-util/lib/Children/toArray';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport Select from '../select';\nimport { ConfigConsumer } from '../config-provider';\nimport warning from '../_util/warning';\nconst { Option } = Select;\nconst InternalSelect = Select;\nfunction isSelectOptionOrSelectOptGroup(child) {\n return child && child.type && (child.type.isSelectOption || child.type.isSelectOptGroup);\n}\nconst AutoComplete = (props, ref) => {\n const { prefixCls: customizePrefixCls, className, children, dataSource } = props;\n const childNodes = toArray(children);\n const selectRef = React.useRef();\n React.useImperativeHandle(ref, () => selectRef.current);\n // ============================= Input =============================\n let customizeInput;\n if (childNodes.length === 1 &&\n React.isValidElement(childNodes[0]) &&\n !isSelectOptionOrSelectOptGroup(childNodes[0])) {\n customizeInput = childNodes[0];\n }\n const getInputElement = () => customizeInput;\n // ============================ Options ============================\n let optionChildren;\n // [Legacy] convert `children` or `dataSource` into option children\n if (childNodes.length && isSelectOptionOrSelectOptGroup(childNodes[0])) {\n optionChildren = children;\n }\n else {\n optionChildren = dataSource\n ? dataSource.map(item => {\n if (React.isValidElement(item)) {\n return item;\n }\n switch (typeof item) {\n case 'string':\n return (
);\n case 'object': {\n const { value: optionValue } = item;\n return (
);\n }\n default:\n throw new Error('AutoComplete[dataSource] only supports type `string[] | Object[]`.');\n }\n })\n : [];\n }\n // ============================ Warning ============================\n React.useEffect(() => {\n warning(!('dataSource' in props), 'AutoComplete', '`dataSource` is deprecated, please use `options` instead.');\n warning(!customizeInput || !('size' in props), 'AutoComplete', 'You need to control style self instead of setting `size` when using customize input.');\n }, []);\n return (
\n {({ getPrefixCls }) => {\n const prefixCls = getPrefixCls('select', customizePrefixCls);\n return (\n {optionChildren}\n );\n }}\n );\n};\nconst RefAutoComplete = React.forwardRef(AutoComplete);\nRefAutoComplete.Option = Option;\nexport default RefAutoComplete;\n","import * as React from 'react';\nimport Alert from '.';\nexport default class ErrorBoundary extends React.Component {\n constructor() {\n super(...arguments);\n this.state = {\n error: undefined,\n info: {\n componentStack: '',\n },\n };\n }\n componentDidCatch(error, info) {\n this.setState({ error, info });\n }\n render() {\n const { message, description, children } = this.props;\n const { error, info } = this.state;\n const componentStack = info && info.componentStack ? info.componentStack : null;\n const errorMessage = typeof message === 'undefined' ? (error || '').toString() : message;\n const errorDescription = typeof description === 'undefined' ? componentStack : description;\n if (error) {\n return (
{errorDescription}}/>);\n }\n return children;\n }\n}\n","import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport CloseOutlined from '@ant-design/icons/CloseOutlined';\nimport CheckCircleOutlined from '@ant-design/icons/CheckCircleOutlined';\nimport ExclamationCircleOutlined from '@ant-design/icons/ExclamationCircleOutlined';\nimport InfoCircleOutlined from '@ant-design/icons/InfoCircleOutlined';\nimport CloseCircleOutlined from '@ant-design/icons/CloseCircleOutlined';\nimport CheckCircleFilled from '@ant-design/icons/CheckCircleFilled';\nimport ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled';\nimport InfoCircleFilled from '@ant-design/icons/InfoCircleFilled';\nimport CloseCircleFilled from '@ant-design/icons/CloseCircleFilled';\nimport Animate from 'rc-animate';\nimport classNames from 'classnames';\nimport { ConfigConsumer } from '../config-provider';\nimport getDataOrAriaProps from '../_util/getDataOrAriaProps';\nimport ErrorBoundary from './ErrorBoundary';\nconst iconMapFilled = {\n success: CheckCircleFilled,\n info: InfoCircleFilled,\n error: CloseCircleFilled,\n warning: ExclamationCircleFilled,\n};\nconst iconMapOutlined = {\n success: CheckCircleOutlined,\n info: InfoCircleOutlined,\n error: CloseCircleOutlined,\n warning: ExclamationCircleOutlined,\n};\nexport default class Alert extends React.Component {\n constructor() {\n super(...arguments);\n this.state = {\n closing: false,\n closed: false,\n };\n this.handleClose = (e) => {\n var _a, _b;\n e.preventDefault();\n const dom = ReactDOM.findDOMNode(this);\n dom.style.height = `${dom.offsetHeight}px`;\n // Magic code\n // 重复一次后才能正确设置 height\n dom.style.height = `${dom.offsetHeight}px`;\n this.setState({\n closing: true,\n });\n (_b = (_a = this.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n };\n this.animationEnd = () => {\n var _a, _b;\n this.setState({\n closing: false,\n closed: true,\n });\n (_b = (_a = this.props).afterClose) === null || _b === void 0 ? void 0 : _b.call(_a);\n };\n this.renderAlert = ({ getPrefixCls, direction }) => {\n const { description, prefixCls: customizePrefixCls, message, banner, className = '', style, onMouseEnter, onMouseLeave, onClick, } = this.props;\n const { closing, closed } = this.state;\n const prefixCls = getPrefixCls('alert', customizePrefixCls);\n const isShowIcon = this.getShowIcon();\n const type = this.getType();\n const closable = this.getClosable();\n const alertCls = classNames(prefixCls, `${prefixCls}-${type}`, {\n [`${prefixCls}-closing`]: closing,\n [`${prefixCls}-with-description`]: !!description,\n [`${prefixCls}-no-icon`]: !isShowIcon,\n [`${prefixCls}-banner`]: !!banner,\n [`${prefixCls}-closable`]: closable,\n [`${prefixCls}-rtl`]: direction === 'rtl',\n }, className);\n const closeIcon = this.renderCloseIcon({ prefixCls });\n const dataOrAriaProps = getDataOrAriaProps(this.props);\n const iconNode = this.renderIconNode({ prefixCls });\n return closed ? null : (\n \n {isShowIcon ? iconNode : null}\n {message}\n {description}\n {closeIcon}\n
\n );\n };\n }\n getShowIcon() {\n const { banner, showIcon } = this.props;\n // banner 模式默认有 Icon\n return banner && showIcon === undefined ? true : showIcon;\n }\n getType() {\n const { banner, type } = this.props;\n if (type !== undefined) {\n return type;\n }\n // banner 模式默认为警告\n return banner ? 'warning' : 'info';\n }\n getClosable() {\n const { closable, closeText } = this.props;\n // closeable when closeText is assigned\n return closeText ? true : closable;\n }\n getIconType() {\n const { description } = this.props;\n // use outline icon in alert with description\n return (description ? iconMapOutlined : iconMapFilled)[this.getType()] || null;\n }\n renderIconNode({ prefixCls }) {\n const { icon } = this.props;\n const iconType = this.getIconType();\n if (icon) {\n return React.isValidElement(icon) ? (React.cloneElement(icon, {\n className: classNames(`${prefixCls}-icon`, {\n [icon.props.className]: icon.props.className,\n }),\n })) : ({icon});\n }\n return React.createElement(iconType, { className: `${prefixCls}-icon` });\n }\n renderCloseIcon({ prefixCls }) {\n const { closeText } = this.props;\n return this.getClosable() ? () : null;\n }\n render() {\n return {this.renderAlert};\n }\n}\nAlert.ErrorBoundary = ErrorBoundary;\n","export default function getDataOrAriaProps(props) {\n return Object.keys(props).reduce((prev, key) => {\n if ((key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') &&\n key.substr(0, 7) !== 'data-__') {\n prev[key] = props[key];\n }\n return prev;\n }, {});\n}\n","var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { ConfigConsumer } from '../config-provider';\nimport warning from '../_util/warning';\nexport default class Avatar extends React.Component {\n constructor() {\n super(...arguments);\n this.state = {\n scale: 1,\n mounted: false,\n isImgExist: true,\n };\n this.setScale = () => {\n if (!this.avatarChildren || !this.avatarNode) {\n return;\n }\n const childrenWidth = this.avatarChildren.offsetWidth; // offsetWidth avoid affecting be transform scale\n const nodeWidth = this.avatarNode.offsetWidth;\n // denominator is 0 is no meaning\n if (childrenWidth === 0 ||\n nodeWidth === 0 ||\n (this.lastChildrenWidth === childrenWidth && this.lastNodeWidth === nodeWidth)) {\n return;\n }\n this.lastChildrenWidth = childrenWidth;\n this.lastNodeWidth = nodeWidth;\n // add 4px gap for each side to get better performance\n this.setState({\n scale: nodeWidth - 8 < childrenWidth ? (nodeWidth - 8) / childrenWidth : 1,\n });\n };\n this.handleImgLoadError = () => {\n const { onError } = this.props;\n const errorFlag = onError ? onError() : undefined;\n if (errorFlag !== false) {\n this.setState({ isImgExist: false });\n }\n };\n this.renderAvatar = ({ getPrefixCls }) => {\n const _a = this.props, { prefixCls: customizePrefixCls, shape, size, src, srcSet, icon, className, alt } = _a, others = __rest(_a, [\"prefixCls\", \"shape\", \"size\", \"src\", \"srcSet\", \"icon\", \"className\", \"alt\"]);\n warning(!(typeof icon === 'string' && icon.length > 2), 'Avatar', `\\`icon\\` is using ReactNode instead of string naming in v4. Please check \\`${icon}\\` at https://ant.design/components/icon`);\n const { isImgExist, scale, mounted } = this.state;\n const prefixCls = getPrefixCls('avatar', customizePrefixCls);\n const sizeCls = classNames({\n [`${prefixCls}-lg`]: size === 'large',\n [`${prefixCls}-sm`]: size === 'small',\n });\n const classString = classNames(prefixCls, className, sizeCls, {\n [`${prefixCls}-${shape}`]: shape,\n [`${prefixCls}-image`]: src && isImgExist,\n [`${prefixCls}-icon`]: icon,\n });\n const sizeStyle = typeof size === 'number'\n ? {\n width: size,\n height: size,\n lineHeight: `${size}px`,\n fontSize: icon ? size / 2 : 18,\n }\n : {};\n let { children } = this.props;\n if (src && isImgExist) {\n children = ;\n }\n else if (icon) {\n children = icon;\n }\n else {\n const childrenNode = this.avatarChildren;\n if (childrenNode || scale !== 1) {\n const transformString = `scale(${scale}) translateX(-50%)`;\n const childrenStyle = {\n msTransform: transformString,\n WebkitTransform: transformString,\n transform: transformString,\n };\n const sizeChildrenStyle = typeof size === 'number'\n ? {\n lineHeight: `${size}px`,\n }\n : {};\n children = ( (this.avatarChildren = node)} style={Object.assign(Object.assign({}, sizeChildrenStyle), childrenStyle)}>\n {children}\n );\n }\n else {\n const childrenStyle = {};\n if (!mounted) {\n childrenStyle.opacity = 0;\n }\n children = ( (this.avatarChildren = node)}>\n {children}\n );\n }\n }\n return ( (this.avatarNode = node)}>\n {children}\n );\n };\n }\n componentDidMount() {\n this.setScale();\n this.setState({ mounted: true });\n }\n componentDidUpdate(prevProps) {\n this.setScale();\n if (prevProps.src !== this.props.src) {\n this.setState({ isImgExist: true, scale: 1 });\n }\n }\n render() {\n return {this.renderAvatar};\n }\n}\nAvatar.defaultProps = {\n shape: 'circle',\n size: 'default',\n};\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport * as React from 'react';\nimport Animate from 'rc-animate';\nimport addEventListener from 'rc-util/lib/Dom/addEventListener';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport { throttleByAnimationFrameDecorator } from '../_util/throttleByAnimationFrame';\nimport { ConfigConsumer } from '../config-provider';\nimport getScroll from '../_util/getScroll';\nimport scrollTo from '../_util/scrollTo';\nexport default class BackTop extends React.Component {\n constructor() {\n super(...arguments);\n this.state = {\n visible: false,\n };\n this.getDefaultTarget = () => {\n return this.node && this.node.ownerDocument ? this.node.ownerDocument : window;\n };\n this.saveDivRef = (node) => {\n this.node = node;\n };\n this.scrollToTop = (e) => {\n const { onClick, target } = this.props;\n scrollTo(0, {\n getContainer: target || this.getDefaultTarget,\n });\n if (typeof onClick === 'function') {\n onClick(e);\n }\n };\n this.renderBackTop = ({ getPrefixCls, direction }) => {\n const { prefixCls: customizePrefixCls, className = '' } = this.props;\n const prefixCls = getPrefixCls('back-top', customizePrefixCls);\n const classString = classNames(prefixCls, className, {\n [`${prefixCls}-rtl`]: direction === 'rtl',\n });\n // fix https://fb.me/react-unknown-prop\n const divProps = omit(this.props, [\n 'prefixCls',\n 'className',\n 'children',\n 'visibilityHeight',\n 'target',\n 'visible',\n ]);\n return (\n {this.renderChildren({ prefixCls })}\n
);\n };\n }\n componentDidMount() {\n this.bindScrollEvent();\n }\n componentDidUpdate(prevProps) {\n const { target } = this.props;\n if (prevProps.target !== target) {\n this.bindScrollEvent();\n }\n }\n componentWillUnmount() {\n if (this.scrollEvent) {\n this.scrollEvent.remove();\n }\n this.handleScroll.cancel();\n }\n bindScrollEvent() {\n if (this.scrollEvent) {\n this.scrollEvent.remove();\n }\n const { target } = this.props;\n const getTarget = target || this.getDefaultTarget;\n const container = getTarget();\n this.scrollEvent = addEventListener(container, 'scroll', (e) => {\n this.handleScroll(e);\n });\n this.handleScroll({\n target: container,\n });\n }\n getVisible() {\n if ('visible' in this.props) {\n return this.props.visible;\n }\n return this.state.visible;\n }\n handleScroll(e) {\n const { visibilityHeight = 0 } = this.props;\n const scrollTop = getScroll(e.target, true);\n this.setState({\n visible: scrollTop > visibilityHeight,\n });\n }\n renderChildren({ prefixCls }) {\n const { children } = this.props;\n const defaultElement = (\n
\n
);\n return (
\n {this.getVisible() ? {children || defaultElement}
: null}\n );\n }\n render() {\n return
{this.renderBackTop};\n }\n}\nBackTop.defaultProps = {\n visibilityHeight: 400,\n};\n__decorate([\n throttleByAnimationFrameDecorator()\n], BackTop.prototype, \"handleScroll\", null);\n","import * as React from 'react';\nimport omit from 'omit.js';\nimport classNames from 'classnames';\nimport { ConfigConsumer } from '../config-provider';\nfunction getNumberArray(num) {\n return num\n ? num\n .toString()\n .split('')\n .reverse()\n .map(i => {\n const current = Number(i);\n return isNaN(current) ? i : current;\n })\n : [];\n}\nfunction renderNumberList(position, className) {\n const childrenToReturn = [];\n for (let i = 0; i < 30; i++) {\n childrenToReturn.push(
\n {i % 10}\n
);\n }\n return childrenToReturn;\n}\nconst ScrollNumber = props => {\n const [animateStarted, setAnimateStarted] = React.useState(true);\n const [count, setCount] = React.useState(props.count);\n const [prevCount, setPrevCount] = React.useState(props.count);\n const [lastCount, setLastCount] = React.useState(props.count);\n if (prevCount !== props.count) {\n setAnimateStarted(true);\n setPrevCount(props.count);\n }\n React.useEffect(() => {\n setLastCount(count);\n let timeout;\n if (animateStarted) {\n // Let browser has time to reset the scroller before actually\n // performing the transition.\n timeout = setTimeout(() => {\n setAnimateStarted(false);\n setCount(props.count);\n if (props.onAnimated) {\n props.onAnimated();\n }\n });\n }\n return () => {\n if (timeout) {\n clearTimeout(timeout);\n }\n };\n }, [animateStarted, count, props.count, props.onAnimated]);\n const getPositionByNum = (num, i) => {\n const currentCount = Math.abs(Number(count));\n const lstCount = Math.abs(Number(lastCount));\n const currentDigit = Math.abs(getNumberArray(count)[i]);\n const lastDigit = Math.abs(getNumberArray(lstCount)[i]);\n if (animateStarted) {\n return 10 + num;\n }\n // 同方向则在同一侧切换数字\n if (currentCount > lstCount) {\n if (currentDigit >= lastDigit) {\n return 10 + num;\n }\n return 20 + num;\n }\n if (currentDigit <= lastDigit) {\n return 10 + num;\n }\n return num;\n };\n const renderCurrentNumber = (prefixCls, num, i) => {\n if (typeof num === 'number') {\n const position = getPositionByNum(num, i);\n const removeTransition = animateStarted || getNumberArray(lastCount)[i] === undefined;\n return React.createElement('span', {\n className: `${prefixCls}-only`,\n style: {\n transition: removeTransition ? 'none' : undefined,\n msTransform: `translateY(${-position * 100}%)`,\n WebkitTransform: `translateY(${-position * 100}%)`,\n transform: `translateY(${-position * 100}%)`,\n },\n key: i,\n }, renderNumberList(position, `${prefixCls}-only-unit`));\n }\n return (
\n {num}\n );\n };\n const renderNumberElement = (prefixCls) => {\n if (count && Number(count) % 1 === 0) {\n return getNumberArray(count)\n .map((num, i) => renderCurrentNumber(prefixCls, num, i))\n .reverse();\n }\n return count;\n };\n const renderScrollNumber = ({ getPrefixCls }) => {\n const { prefixCls: customizePrefixCls, className, style, title, component = 'sup', displayComponent, } = props;\n // fix https://fb.me/react-unknown-prop\n const restProps = omit(props, [\n 'count',\n 'onAnimated',\n 'component',\n 'prefixCls',\n 'displayComponent',\n ]);\n const prefixCls = getPrefixCls('scroll-number', customizePrefixCls);\n const newProps = Object.assign(Object.assign({}, restProps), { className: classNames(prefixCls, className), title: title });\n // allow specify the border\n // mock border-color by box-shadow for compatible with old usage:\n //
\n if (style && style.borderColor) {\n newProps.style = Object.assign(Object.assign({}, style), { boxShadow: `0 0 0 1px ${style.borderColor} inset` });\n }\n if (displayComponent) {\n return React.cloneElement(displayComponent, {\n className: classNames(`${prefixCls}-custom-component`, displayComponent.props && displayComponent.props.className),\n });\n }\n return React.createElement(component, newProps, renderNumberElement(prefixCls));\n };\n return
{renderScrollNumber};\n};\nScrollNumber.defaultProps = {\n count: null,\n onAnimated() { },\n};\nexport default ScrollNumber;\n","// https://stackoverflow.com/questions/46176165/ways-to-get-string-literal-type-of-array-values-without-enum-overhead\nexport const tuple = (...args) => args;\nexport const tupleNum = (...args) => args;\n","import { tuple } from './type';\nexport const PresetStatusColorTypes = tuple('success', 'processing', 'error', 'default', 'warning');\n// eslint-disable-next-line import/prefer-default-export\nexport const PresetColorTypes = tuple('pink', 'red', 'yellow', 'orange', 'cyan', 'green', 'blue', 'purple', 'geekblue', 'magenta', 'volcano', 'gold', 'lime');\n","var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport Animate from 'rc-animate';\nimport omit from 'omit.js';\nimport classNames from 'classnames';\nimport ScrollNumber from './ScrollNumber';\nimport { PresetColorTypes } from '../_util/colors';\nimport { ConfigConsumer } from '../config-provider';\nexport { ScrollNumberProps } from './ScrollNumber';\nfunction isPresetColor(color) {\n return PresetColorTypes.indexOf(color) !== -1;\n}\nconst Badge = props => {\n const getNumberedDisplayCount = () => {\n const { count, overflowCount } = props;\n const displayCount = count > overflowCount ? `${overflowCount}+` : count;\n return displayCount;\n };\n const hasStatus = () => {\n const { status, color } = props;\n return !!status || !!color;\n };\n const isZero = () => {\n const numberedDisplayCount = getNumberedDisplayCount();\n return numberedDisplayCount === '0' || numberedDisplayCount === 0;\n };\n const isDot = () => {\n const { dot } = props;\n return (dot && !isZero()) || hasStatus();\n };\n const getDisplayCount = () => {\n // dot mode don't need count\n if (isDot()) {\n return '';\n }\n return getNumberedDisplayCount();\n };\n const getScrollNumberTitle = () => {\n const { title, count } = props;\n if (title) {\n return title;\n }\n return typeof count === 'string' || typeof count === 'number' ? count : undefined;\n };\n const getStyleWithOffset = () => {\n const { offset, style } = props;\n return offset\n ? Object.assign({ right: -parseInt(offset[0], 10), marginTop: offset[1] }, style) : style;\n };\n const getBadgeClassName = (prefixCls, direction = 'ltr') => {\n const { className, children } = props;\n return classNames(className, prefixCls, {\n [`${prefixCls}-status`]: hasStatus(),\n [`${prefixCls}-not-a-wrapper`]: !children,\n [`${prefixCls}-rtl`]: direction === 'rtl',\n });\n };\n const isHidden = () => {\n const { showZero } = props;\n const displayCount = getDisplayCount();\n const isEmpty = displayCount === null || displayCount === undefined || displayCount === '';\n return (isEmpty || (isZero() && !showZero)) && !isDot();\n };\n const renderStatusText = (prefixCls) => {\n const { text } = props;\n const hidden = isHidden();\n return hidden || !text ? null :
{text};\n };\n const renderDisplayComponent = () => {\n const { count } = props;\n const customNode = count;\n if (!customNode || typeof customNode !== 'object') {\n return undefined;\n }\n return React.cloneElement(customNode, {\n style: Object.assign(Object.assign({}, getStyleWithOffset()), (customNode.props && customNode.props.style)),\n });\n };\n const renderBadgeNumber = (prefixCls, scrollNumberPrefixCls) => {\n const { status, count, color } = props;\n const displayCount = getDisplayCount();\n const dot = isDot();\n const hidden = isHidden();\n const scrollNumberCls = classNames({\n [`${prefixCls}-dot`]: dot,\n [`${prefixCls}-count`]: !dot,\n [`${prefixCls}-multiple-words`]: !dot && count && count.toString && count.toString().length > 1,\n [`${prefixCls}-status-${status}`]: !!status,\n [`${prefixCls}-status-${color}`]: isPresetColor(color),\n });\n let statusStyle = getStyleWithOffset();\n if (color && !isPresetColor(color)) {\n statusStyle = statusStyle || {};\n statusStyle.background = color;\n }\n return hidden ? null : (
}>\n title={getScrollNumberTitle()} style={statusStyle} key=\"scrollNumber\"/>);\n };\n const renderBadge = ({ getPrefixCls, direction }) => {\n const { prefixCls: customizePrefixCls, scrollNumberPrefixCls: customizeScrollNumberPrefixCls, children, status, text, color } = props, restProps = __rest(props, [\"prefixCls\", \"scrollNumberPrefixCls\", \"children\", \"status\", \"text\", \"color\"]);\n const omitArr = [\n 'count',\n 'showZero',\n 'overflowCount',\n 'className',\n 'style',\n 'dot',\n 'offset',\n 'title',\n ];\n const prefixCls = getPrefixCls('badge', customizePrefixCls);\n const scrollNumberPrefixCls = getPrefixCls('scroll-number', customizeScrollNumberPrefixCls);\n const scrollNumber = renderBadgeNumber(prefixCls, scrollNumberPrefixCls);\n const statusText = renderStatusText(prefixCls);\n const statusCls = classNames({\n [`${prefixCls}-status-dot`]: hasStatus(),\n [`${prefixCls}-status-${status}`]: !!status,\n [`${prefixCls}-status-${color}`]: isPresetColor(color),\n });\n const statusStyle = {};\n if (color && !isPresetColor(color)) {\n statusStyle.background = color;\n }\n //
\n if (!children && hasStatus()) {\n const styleWithOffset = getStyleWithOffset();\n const statusTextColor = styleWithOffset && styleWithOffset.color;\n return (
\n \n \n {text}\n \n );\n }\n return (\n {children}\n \n {scrollNumber}\n \n {statusText}\n );\n };\n return {renderBadge};\n};\nBadge.defaultProps = {\n count: null,\n showZero: false,\n dot: false,\n overflowCount: 99,\n};\nexport default Badge;\n","var autoAdjustOverflow = {\n adjustX: 1,\n adjustY: 1\n};\nvar targetOffset = [0, 0];\nvar placements = {\n topLeft: {\n points: ['bl', 'tl'],\n overflow: autoAdjustOverflow,\n offset: [0, -4],\n targetOffset: targetOffset\n },\n topCenter: {\n points: ['bc', 'tc'],\n overflow: autoAdjustOverflow,\n offset: [0, -4],\n targetOffset: targetOffset\n },\n topRight: {\n points: ['br', 'tr'],\n overflow: autoAdjustOverflow,\n offset: [0, -4],\n targetOffset: targetOffset\n },\n bottomLeft: {\n points: ['tl', 'bl'],\n overflow: autoAdjustOverflow,\n offset: [0, 4],\n targetOffset: targetOffset\n },\n bottomCenter: {\n points: ['tc', 'bc'],\n overflow: autoAdjustOverflow,\n offset: [0, 4],\n targetOffset: targetOffset\n },\n bottomRight: {\n points: ['tr', 'br'],\n overflow: autoAdjustOverflow,\n offset: [0, 4],\n targetOffset: targetOffset\n }\n};\nexport default placements;","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport * as React from 'react';\nimport Trigger from 'rc-trigger';\nimport classNames from 'classnames';\nimport Placements from './placements';\n\nfunction Dropdown(props, ref) {\n var _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? 'rc-dropdown' : _props$prefixCls,\n transitionName = props.transitionName,\n animation = props.animation,\n align = props.align,\n _props$placement = props.placement,\n placement = _props$placement === void 0 ? 'bottomLeft' : _props$placement,\n _props$placements = props.placements,\n placements = _props$placements === void 0 ? Placements : _props$placements,\n getPopupContainer = props.getPopupContainer,\n showAction = props.showAction,\n hideAction = props.hideAction,\n overlayClassName = props.overlayClassName,\n overlayStyle = props.overlayStyle,\n visible = props.visible,\n _props$trigger = props.trigger,\n trigger = _props$trigger === void 0 ? ['hover'] : _props$trigger,\n otherProps = _objectWithoutProperties(props, [\"prefixCls\", \"transitionName\", \"animation\", \"align\", \"placement\", \"placements\", \"getPopupContainer\", \"showAction\", \"hideAction\", \"overlayClassName\", \"overlayStyle\", \"visible\", \"trigger\"]);\n\n var _React$useState = React.useState(),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n triggerVisible = _React$useState2[0],\n setTriggerVisible = _React$useState2[1];\n\n var mergedVisible = 'visible' in props ? visible : triggerVisible;\n var triggerRef = React.useRef(null);\n React.useImperativeHandle(ref, function () {\n return triggerRef.current;\n });\n\n var getOverlayElement = function getOverlayElement() {\n var overlay = props.overlay;\n var overlayElement;\n\n if (typeof overlay === 'function') {\n overlayElement = overlay();\n } else {\n overlayElement = overlay;\n }\n\n return overlayElement;\n };\n\n var onClick = function onClick(e) {\n var onOverlayClick = props.onOverlayClick;\n var overlayProps = getOverlayElement().props;\n setTriggerVisible(false);\n\n if (onOverlayClick) {\n onOverlayClick(e);\n }\n\n if (overlayProps.onClick) {\n overlayProps.onClick(e);\n }\n };\n\n var onVisibleChange = function onVisibleChange(visible) {\n var onVisibleChange = props.onVisibleChange;\n setTriggerVisible(visible);\n\n if (typeof onVisibleChange === 'function') {\n onVisibleChange(visible);\n }\n };\n\n var getMenuElement = function getMenuElement() {\n var overlayElement = getOverlayElement();\n var extraOverlayProps = {\n prefixCls: \"\".concat(prefixCls, \"-menu\"),\n onClick: onClick\n };\n\n if (typeof overlayElement.type === 'string') {\n delete extraOverlayProps.prefixCls;\n }\n\n return React.cloneElement(overlayElement, extraOverlayProps);\n };\n\n var getMenuElementOrLambda = function getMenuElementOrLambda() {\n var overlay = props.overlay;\n\n if (typeof overlay === 'function') {\n return getMenuElement;\n }\n\n return getMenuElement();\n };\n\n var getMinOverlayWidthMatchTrigger = function getMinOverlayWidthMatchTrigger() {\n var minOverlayWidthMatchTrigger = props.minOverlayWidthMatchTrigger,\n alignPoint = props.alignPoint;\n\n if ('minOverlayWidthMatchTrigger' in props) {\n return minOverlayWidthMatchTrigger;\n }\n\n return !alignPoint;\n };\n\n var getOpenClassName = function getOpenClassName() {\n var openClassName = props.openClassName;\n\n if (openClassName !== undefined) {\n return openClassName;\n }\n\n return \"\".concat(prefixCls, \"-open\");\n };\n\n var renderChildren = function renderChildren() {\n var children = props.children;\n var childrenProps = children.props ? children.props : {};\n var childClassName = classNames(childrenProps.className, getOpenClassName());\n return triggerVisible && children ? React.cloneElement(children, {\n className: childClassName\n }) : children;\n };\n\n var triggerHideAction = hideAction;\n\n if (!triggerHideAction && trigger.indexOf('contextMenu') !== -1) {\n triggerHideAction = ['click'];\n }\n\n return React.createElement(Trigger, Object.assign({}, otherProps, {\n prefixCls: prefixCls,\n ref: triggerRef,\n popupClassName: overlayClassName,\n popupStyle: overlayStyle,\n builtinPlacements: placements,\n action: trigger,\n showAction: showAction,\n hideAction: triggerHideAction || [],\n popupPlacement: placement,\n popupAlign: align,\n popupTransitionName: transitionName,\n popupAnimation: animation,\n popupVisible: mergedVisible,\n stretch: getMinOverlayWidthMatchTrigger() ? 'minWidth' : '',\n popup: getMenuElementOrLambda(),\n onPopupVisibleChange: onVisibleChange,\n getPopupContainer: getPopupContainer\n }), renderChildren());\n}\n\nexport default React.forwardRef(Dropdown);","import Dropdown from './Dropdown';\nexport default Dropdown;","import * as React from 'react';\nimport RcDropdown from 'rc-dropdown';\nimport classNames from 'classnames';\nimport RightOutlined from '@ant-design/icons/RightOutlined';\nimport { ConfigConsumer } from '../config-provider';\nimport warning from '../_util/warning';\nimport { tuple } from '../_util/type';\nconst Placements = tuple('topLeft', 'topCenter', 'topRight', 'bottomLeft', 'bottomCenter', 'bottomRight');\nexport default class Dropdown extends React.Component {\n constructor() {\n super(...arguments);\n this.renderOverlay = (prefixCls) => {\n // rc-dropdown already can process the function of overlay, but we have check logic here.\n // So we need render the element to check and pass back to rc-dropdown.\n const { overlay } = this.props;\n let overlayNode;\n if (typeof overlay === 'function') {\n overlayNode = overlay();\n }\n else {\n overlayNode = overlay;\n }\n overlayNode = React.Children.only(overlayNode);\n const overlayProps = overlayNode.props;\n // Warning if use other mode\n warning(!overlayProps.mode || overlayProps.mode === 'vertical', 'Dropdown', `mode=\"${overlayProps.mode}\" is not supported for Dropdown's Menu.`);\n // menu cannot be selectable in dropdown defaultly\n // menu should be focusable in dropdown defaultly\n const { selectable = false, focusable = true } = overlayProps;\n const expandIcon = (\n \n );\n const fixedModeOverlay = typeof overlayNode.type === 'string'\n ? overlay\n : React.cloneElement(overlayNode, {\n mode: 'vertical',\n selectable,\n focusable,\n expandIcon,\n });\n return fixedModeOverlay;\n };\n this.renderDropDown = ({ getPopupContainer: getContextPopupContainer, getPrefixCls, direction, }) => {\n const { prefixCls: customizePrefixCls, children, trigger, disabled, getPopupContainer, overlayClassName, } = this.props;\n const prefixCls = getPrefixCls('dropdown', customizePrefixCls);\n const child = React.Children.only(children);\n const dropdownTrigger = React.cloneElement(child, {\n className: classNames(child.props.className, `${prefixCls}-trigger`, {\n [`${prefixCls}-rtl`]: direction === 'rtl',\n }),\n disabled,\n });\n const overlayClassNameCustomized = classNames(overlayClassName, {\n [`${prefixCls}-rtl`]: direction === 'rtl',\n });\n const triggerActions = disabled ? [] : trigger;\n let alignPoint;\n if (triggerActions && triggerActions.indexOf('contextMenu') !== -1) {\n alignPoint = true;\n }\n return ( this.renderOverlay(prefixCls)} placement={this.getPlacement(direction)}>\n {dropdownTrigger}\n );\n };\n }\n getTransitionName() {\n const { placement = '', transitionName } = this.props;\n if (transitionName !== undefined) {\n return transitionName;\n }\n if (placement.indexOf('top') >= 0) {\n return 'slide-down';\n }\n return 'slide-up';\n }\n getPlacement(direction = 'ltr') {\n const { placement } = this.props;\n if (placement !== undefined) {\n return placement;\n }\n return direction === 'rtl' ? 'bottomRight' : 'bottomLeft';\n }\n render() {\n return {this.renderDropDown};\n }\n}\nDropdown.defaultProps = {\n mouseEnterDelay: 0.15,\n mouseLeaveDelay: 0.1,\n};\n","var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport DownOutlined from '@ant-design/icons/DownOutlined';\nimport omit from 'omit.js';\nimport DropDown from '../dropdown/dropdown';\nimport { ConfigConsumer } from '../config-provider';\nexport default class BreadcrumbItem extends React.Component {\n constructor() {\n super(...arguments);\n this.renderBreadcrumbItem = ({ getPrefixCls }) => {\n const _a = this.props, { prefixCls: customizePrefixCls, separator, children } = _a, restProps = __rest(_a, [\"prefixCls\", \"separator\", \"children\"]);\n const prefixCls = getPrefixCls('breadcrumb', customizePrefixCls);\n let link;\n if ('href' in this.props) {\n link = (\n {children}\n );\n }\n else {\n link = (\n {children}\n );\n }\n // wrap to dropDown\n link = this.renderBreadcrumbNode(link, prefixCls);\n if (children) {\n return (\n {link}\n {separator && separator !== '' && ({separator})}\n );\n }\n return null;\n };\n /**\n * if overlay is have\n * Wrap a DropDown\n */\n this.renderBreadcrumbNode = (breadcrumbItem, prefixCls) => {\n const { overlay, dropdownProps } = this.props;\n if (overlay) {\n return (\n \n {breadcrumbItem}\n \n \n );\n }\n return breadcrumbItem;\n };\n }\n render() {\n return {this.renderBreadcrumbItem};\n }\n}\nBreadcrumbItem.__ANT_BREADCRUMB_ITEM = true;\nBreadcrumbItem.defaultProps = {\n separator: '/',\n};\n","import PropTypes from 'prop-types';\nexport var storeShape = PropTypes.shape({\n subscribe: PropTypes.func.isRequired,\n setState: PropTypes.func.isRequired,\n getState: PropTypes.func.isRequired,\n});\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport React, { Component, createContext } from 'react';\nimport { storeShape } from './PropTypes';\nexport var MiniStoreContext = createContext(null);\nvar Provider = /** @class */ (function (_super) {\n __extends(Provider, _super);\n function Provider() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Provider.prototype.render = function () {\n return React.createElement(MiniStoreContext.Provider, { value: this.props.store }, this.props.children);\n };\n Provider.propTypes = {\n store: storeShape.isRequired,\n };\n return Provider;\n}(Component));\nexport { Provider };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nimport { default as React, Component } from 'react';\nimport shallowEqual from 'shallowequal';\nimport hoistStatics from 'hoist-non-react-statics';\nimport { MiniStoreContext } from './Provider';\nfunction getDisplayName(WrappedComponent) {\n return WrappedComponent.displayName || WrappedComponent.name || 'Component';\n}\nvar defaultMapStateToProps = function () { return ({}); };\nexport function connect(mapStateToProps, options) {\n if (options === void 0) { options = {}; }\n var shouldSubscribe = !!mapStateToProps;\n var finalMapStateToProps = mapStateToProps || defaultMapStateToProps;\n return function wrapWithConnect(WrappedComponent) {\n var Connect = /** @class */ (function (_super) {\n __extends(Connect, _super);\n function Connect(props, context) {\n var _this = _super.call(this, props, context) || this;\n _this.unsubscribe = null;\n _this.handleChange = function () {\n if (!_this.unsubscribe) {\n return;\n }\n var nextState = finalMapStateToProps(_this.store.getState(), _this.props);\n _this.setState({ subscribed: nextState });\n };\n _this.store = _this.context;\n _this.state = {\n subscribed: finalMapStateToProps(_this.store.getState(), props),\n store: _this.store,\n props: props,\n };\n return _this;\n }\n Connect.getDerivedStateFromProps = function (props, prevState) {\n // using ownProps\n if (mapStateToProps && mapStateToProps.length === 2 && props !== prevState.props) {\n return {\n subscribed: finalMapStateToProps(prevState.store.getState(), props),\n props: props,\n };\n }\n return { props: props };\n };\n Connect.prototype.componentDidMount = function () {\n this.trySubscribe();\n };\n Connect.prototype.componentWillUnmount = function () {\n this.tryUnsubscribe();\n };\n Connect.prototype.shouldComponentUpdate = function (nextProps, nextState) {\n return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state.subscribed, nextState.subscribed);\n };\n Connect.prototype.trySubscribe = function () {\n if (shouldSubscribe) {\n this.unsubscribe = this.store.subscribe(this.handleChange);\n this.handleChange();\n }\n };\n Connect.prototype.tryUnsubscribe = function () {\n if (this.unsubscribe) {\n this.unsubscribe();\n this.unsubscribe = null;\n }\n };\n Connect.prototype.render = function () {\n var props = __assign(__assign(__assign({}, this.props), this.state.subscribed), { store: this.store });\n return React.createElement(WrappedComponent, __assign({}, props, { ref: this.props.miniStoreForwardedRef }));\n };\n Connect.displayName = \"Connect(\" + getDisplayName(WrappedComponent) + \")\";\n Connect.contextType = MiniStoreContext;\n return Connect;\n }(Component));\n if (options.forwardRef) {\n var forwarded = React.forwardRef(function (props, ref) {\n return React.createElement(Connect, __assign({}, props, { miniStoreForwardedRef: ref }));\n });\n return hoistStatics(forwarded, WrappedComponent);\n }\n return hoistStatics(Connect, WrappedComponent);\n };\n}\n","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nexport function create(initialState) {\n var state = initialState;\n var listeners = [];\n function setState(partial) {\n state = __assign(__assign({}, state), partial);\n for (var i = 0; i < listeners.length; i++) {\n listeners[i]();\n }\n }\n function getState() {\n return state;\n }\n function subscribe(listener) {\n listeners.push(listener);\n return function unsubscribe() {\n var index = listeners.indexOf(listener);\n listeners.splice(index, 1);\n };\n }\n return {\n setState: setState,\n getState: getState,\n subscribe: subscribe,\n };\n}\n","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\n// MIT License from https://github.com/kaimallea/isMobile\nvar applePhone = /iPhone/i;\nvar appleIpod = /iPod/i;\nvar appleTablet = /iPad/i;\nvar androidPhone = /\\bAndroid(?:.+)Mobile\\b/i; // Match 'Android' AND 'Mobile'\n\nvar androidTablet = /Android/i;\nvar amazonPhone = /\\bAndroid(?:.+)SD4930UR\\b/i;\nvar amazonTablet = /\\bAndroid(?:.+)(?:KF[A-Z]{2,4})\\b/i;\nvar windowsPhone = /Windows Phone/i;\nvar windowsTablet = /\\bWindows(?:.+)ARM\\b/i; // Match 'Windows' AND 'ARM'\n\nvar otherBlackberry = /BlackBerry/i;\nvar otherBlackberry10 = /BB10/i;\nvar otherOpera = /Opera Mini/i;\nvar otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nvar otherFirefox = /Mobile(?:.+)Firefox\\b/i; // Match 'Mobile' AND 'Firefox'\n\nfunction match(regex, userAgent) {\n return regex.test(userAgent);\n}\n\nfunction isMobile(userAgent) {\n var ua = userAgent || (typeof navigator !== 'undefined' ? navigator.userAgent : ''); // Facebook mobile app's integrated browser adds a bunch of strings that\n // match everything. Strip it out if it exists.\n\n var tmp = ua.split('[FBAN');\n\n if (typeof tmp[1] !== 'undefined') {\n var _tmp = tmp;\n\n var _tmp2 = _slicedToArray(_tmp, 1);\n\n ua = _tmp2[0];\n } // Twitter mobile app's integrated browser on iPad adds a \"Twitter for\n // iPhone\" string. Same probably happens on other tablet platforms.\n // This will confuse detection so strip it out if it exists.\n\n\n tmp = ua.split('Twitter');\n\n if (typeof tmp[1] !== 'undefined') {\n var _tmp3 = tmp;\n\n var _tmp4 = _slicedToArray(_tmp3, 1);\n\n ua = _tmp4[0];\n }\n\n var result = {\n apple: {\n phone: match(applePhone, ua) && !match(windowsPhone, ua),\n ipod: match(appleIpod, ua),\n tablet: !match(applePhone, ua) && match(appleTablet, ua) && !match(windowsPhone, ua),\n device: (match(applePhone, ua) || match(appleIpod, ua) || match(appleTablet, ua)) && !match(windowsPhone, ua)\n },\n amazon: {\n phone: match(amazonPhone, ua),\n tablet: !match(amazonPhone, ua) && match(amazonTablet, ua),\n device: match(amazonPhone, ua) || match(amazonTablet, ua)\n },\n android: {\n phone: !match(windowsPhone, ua) && match(amazonPhone, ua) || !match(windowsPhone, ua) && match(androidPhone, ua),\n tablet: !match(windowsPhone, ua) && !match(amazonPhone, ua) && !match(androidPhone, ua) && (match(amazonTablet, ua) || match(androidTablet, ua)),\n device: !match(windowsPhone, ua) && (match(amazonPhone, ua) || match(amazonTablet, ua) || match(androidPhone, ua) || match(androidTablet, ua)) || match(/\\bokhttp\\b/i, ua)\n },\n windows: {\n phone: match(windowsPhone, ua),\n tablet: match(windowsTablet, ua),\n device: match(windowsPhone, ua) || match(windowsTablet, ua)\n },\n other: {\n blackberry: match(otherBlackberry, ua),\n blackberry10: match(otherBlackberry10, ua),\n opera: match(otherOpera, ua),\n firefox: match(otherFirefox, ua),\n chrome: match(otherChrome, ua),\n device: match(otherBlackberry, ua) || match(otherBlackberry10, ua) || match(otherOpera, ua) || match(otherFirefox, ua) || match(otherChrome, ua)\n },\n // Additional\n any: null,\n phone: null,\n tablet: null\n };\n result.any = result.apple.device || result.android.device || result.windows.device || result.other.device; // excludes 'other' devices and ipods, targeting touchscreen phones\n\n result.phone = result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet = result.apple.tablet || result.android.tablet || result.windows.tablet;\n return result;\n}\n\nvar defaultResult = _objectSpread(_objectSpread({}, isMobile()), {}, {\n isMobile: isMobile\n});\n\nexport default defaultResult;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport React from 'react';\nimport isMobile from './utils/isMobile';\nexport function noop() {}\nexport function getKeyFromChildrenIndex(child, menuEventKey, index) {\n var prefix = menuEventKey || '';\n return child.key || \"\".concat(prefix, \"item_\").concat(index);\n}\nexport function getMenuIdFromSubMenuEventKey(eventKey) {\n return \"\".concat(eventKey, \"-menu-\");\n}\nexport function loopMenuItem(children, cb) {\n var index = -1;\n React.Children.forEach(children, function (c) {\n index += 1;\n\n if (c && c.type && c.type.isMenuItemGroup) {\n React.Children.forEach(c.props.children, function (c2) {\n index += 1;\n cb(c2, index);\n });\n } else {\n cb(c, index);\n }\n });\n}\nexport function loopMenuItemRecursively(children, keys, ret) {\n /* istanbul ignore if */\n if (!children || ret.find) {\n return;\n }\n\n React.Children.forEach(children, function (c) {\n if (c) {\n var construct = c.type;\n\n if (!construct || !(construct.isSubMenu || construct.isMenuItem || construct.isMenuItemGroup)) {\n return;\n }\n\n if (keys.indexOf(c.key) !== -1) {\n ret.find = true;\n } else if (c.props.children) {\n loopMenuItemRecursively(c.props.children, keys, ret);\n }\n }\n });\n}\nexport var menuAllProps = ['defaultSelectedKeys', 'selectedKeys', 'defaultOpenKeys', 'openKeys', 'mode', 'getPopupContainer', 'onSelect', 'onDeselect', 'onDestroy', 'openTransitionName', 'openAnimation', 'subMenuOpenDelay', 'subMenuCloseDelay', 'forceSubMenuRender', 'triggerSubMenuAction', 'level', 'selectable', 'multiple', 'onOpenChange', 'visible', 'focusable', 'defaultActiveFirst', 'prefixCls', 'inlineIndent', 'parentMenu', 'title', 'rootPrefixCls', 'eventKey', 'active', 'onItemHover', 'onTitleMouseEnter', 'onTitleMouseLeave', 'onTitleClick', 'popupAlign', 'popupOffset', 'isOpen', 'renderMenuItem', 'manualRef', 'subMenuKey', 'disabled', 'index', 'isSelected', 'store', 'activeKey', 'builtinPlacements', 'overflowedIndicator', 'motion', // the following keys found need to be removed from test regression\n'attribute', 'value', 'popupClassName', 'inlineCollapsed', 'menu', 'theme', 'itemIcon', 'expandIcon']; // ref: https://github.com/ant-design/ant-design/issues/14007\n// ref: https://bugs.chromium.org/p/chromium/issues/detail?id=360889\n// getBoundingClientRect return the full precision value, which is\n// not the same behavior as on chrome. Set the precision to 6 to\n// unify their behavior\n\nexport var getWidth = function getWidth(elem) {\n var width = elem && typeof elem.getBoundingClientRect === 'function' && elem.getBoundingClientRect().width;\n\n if (width) {\n width = +width.toFixed(6);\n }\n\n return width || 0;\n};\nexport var setStyle = function setStyle(elem, styleProperty, value) {\n if (elem && _typeof(elem.style) === 'object') {\n elem.style[styleProperty] = value;\n }\n};\nexport var isMobileDevice = function isMobileDevice() {\n return isMobile.any;\n};","var autoAdjustOverflow = {\n adjustX: 1,\n adjustY: 1\n};\nexport var placements = {\n topLeft: {\n points: ['bl', 'tl'],\n overflow: autoAdjustOverflow,\n offset: [0, -7]\n },\n bottomLeft: {\n points: ['tl', 'bl'],\n overflow: autoAdjustOverflow,\n offset: [0, 7]\n },\n leftTop: {\n points: ['tr', 'tl'],\n overflow: autoAdjustOverflow,\n offset: [-4, 0]\n },\n rightTop: {\n points: ['tl', 'tr'],\n overflow: autoAdjustOverflow,\n offset: [4, 0]\n }\n};\nexport var placementsRtl = {\n topLeft: {\n points: ['bl', 'tl'],\n overflow: autoAdjustOverflow,\n offset: [0, -7]\n },\n bottomLeft: {\n points: ['tl', 'bl'],\n overflow: autoAdjustOverflow,\n offset: [0, 7]\n },\n rightTop: {\n points: ['tr', 'tl'],\n overflow: autoAdjustOverflow,\n offset: [-4, 0]\n },\n leftTop: {\n points: ['tl', 'tr'],\n overflow: autoAdjustOverflow,\n offset: [4, 0]\n }\n};\nexport default placements;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport Trigger from 'rc-trigger';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport CSSMotion from \"rc-animate/es/CSSMotion\";\nimport classNames from 'classnames';\nimport { connect } from 'mini-store';\nimport SubPopupMenu from './SubPopupMenu';\nimport { placements, placementsRtl } from './placements';\nimport { noop, loopMenuItemRecursively, getMenuIdFromSubMenuEventKey, menuAllProps } from './util';\nvar guid = 0;\nvar popupPlacementMap = {\n horizontal: 'bottomLeft',\n vertical: 'rightTop',\n 'vertical-left': 'rightTop',\n 'vertical-right': 'leftTop'\n};\n\nvar updateDefaultActiveFirst = function updateDefaultActiveFirst(store, eventKey, defaultActiveFirst) {\n var menuId = getMenuIdFromSubMenuEventKey(eventKey);\n var state = store.getState();\n store.setState({\n defaultActiveFirst: _objectSpread(_objectSpread({}, state.defaultActiveFirst), {}, _defineProperty({}, menuId, defaultActiveFirst))\n });\n};\n\nexport var SubMenu = /*#__PURE__*/function (_React$Component) {\n _inherits(SubMenu, _React$Component);\n\n var _super = _createSuper(SubMenu);\n\n function SubMenu(props) {\n var _this;\n\n _classCallCheck(this, SubMenu);\n\n _this = _super.call(this, props);\n\n _this.onDestroy = function (key) {\n _this.props.onDestroy(key);\n };\n /**\n * note:\n * This legacy code that `onKeyDown` is called by parent instead of dom self.\n * which need return code to check if this event is handled\n */\n\n\n _this.onKeyDown = function (e) {\n var keyCode = e.keyCode;\n var menu = _this.menuInstance;\n var _this$props = _this.props,\n isOpen = _this$props.isOpen,\n store = _this$props.store;\n\n if (keyCode === KeyCode.ENTER) {\n _this.onTitleClick(e);\n\n updateDefaultActiveFirst(store, _this.props.eventKey, true);\n return true;\n }\n\n if (keyCode === KeyCode.RIGHT) {\n if (isOpen) {\n menu.onKeyDown(e);\n } else {\n _this.triggerOpenChange(true); // need to update current menu's defaultActiveFirst value\n\n\n updateDefaultActiveFirst(store, _this.props.eventKey, true);\n }\n\n return true;\n }\n\n if (keyCode === KeyCode.LEFT) {\n var handled;\n\n if (isOpen) {\n handled = menu.onKeyDown(e);\n } else {\n return undefined;\n }\n\n if (!handled) {\n _this.triggerOpenChange(false);\n\n handled = true;\n }\n\n return handled;\n }\n\n if (isOpen && (keyCode === KeyCode.UP || keyCode === KeyCode.DOWN)) {\n return menu.onKeyDown(e);\n }\n\n return undefined;\n };\n\n _this.onOpenChange = function (e) {\n _this.props.onOpenChange(e);\n };\n\n _this.onPopupVisibleChange = function (visible) {\n _this.triggerOpenChange(visible, visible ? 'mouseenter' : 'mouseleave');\n };\n\n _this.onMouseEnter = function (e) {\n var _this$props2 = _this.props,\n key = _this$props2.eventKey,\n onMouseEnter = _this$props2.onMouseEnter,\n store = _this$props2.store;\n updateDefaultActiveFirst(store, _this.props.eventKey, false);\n onMouseEnter({\n key: key,\n domEvent: e\n });\n };\n\n _this.onMouseLeave = function (e) {\n var _this$props3 = _this.props,\n parentMenu = _this$props3.parentMenu,\n eventKey = _this$props3.eventKey,\n onMouseLeave = _this$props3.onMouseLeave;\n parentMenu.subMenuInstance = _assertThisInitialized(_this);\n onMouseLeave({\n key: eventKey,\n domEvent: e\n });\n };\n\n _this.onTitleMouseEnter = function (domEvent) {\n var _this$props4 = _this.props,\n key = _this$props4.eventKey,\n onItemHover = _this$props4.onItemHover,\n onTitleMouseEnter = _this$props4.onTitleMouseEnter;\n onItemHover({\n key: key,\n hover: true\n });\n onTitleMouseEnter({\n key: key,\n domEvent: domEvent\n });\n };\n\n _this.onTitleMouseLeave = function (e) {\n var _this$props5 = _this.props,\n parentMenu = _this$props5.parentMenu,\n eventKey = _this$props5.eventKey,\n onItemHover = _this$props5.onItemHover,\n onTitleMouseLeave = _this$props5.onTitleMouseLeave;\n parentMenu.subMenuInstance = _assertThisInitialized(_this);\n onItemHover({\n key: eventKey,\n hover: false\n });\n onTitleMouseLeave({\n key: eventKey,\n domEvent: e\n });\n };\n\n _this.onTitleClick = function (e) {\n var _assertThisInitialize = _assertThisInitialized(_this),\n props = _assertThisInitialize.props;\n\n props.onTitleClick({\n key: props.eventKey,\n domEvent: e\n });\n\n if (props.triggerSubMenuAction === 'hover') {\n return;\n }\n\n _this.triggerOpenChange(!props.isOpen, 'click');\n\n updateDefaultActiveFirst(props.store, _this.props.eventKey, false);\n };\n\n _this.onSubMenuClick = function (info) {\n // in the case of overflowed submenu\n // onClick is not copied over\n if (typeof _this.props.onClick === 'function') {\n _this.props.onClick(_this.addKeyPath(info));\n }\n };\n\n _this.onSelect = function (info) {\n _this.props.onSelect(info);\n };\n\n _this.onDeselect = function (info) {\n _this.props.onDeselect(info);\n };\n\n _this.getPrefixCls = function () {\n return \"\".concat(_this.props.rootPrefixCls, \"-submenu\");\n };\n\n _this.getActiveClassName = function () {\n return \"\".concat(_this.getPrefixCls(), \"-active\");\n };\n\n _this.getDisabledClassName = function () {\n return \"\".concat(_this.getPrefixCls(), \"-disabled\");\n };\n\n _this.getSelectedClassName = function () {\n return \"\".concat(_this.getPrefixCls(), \"-selected\");\n };\n\n _this.getOpenClassName = function () {\n return \"\".concat(_this.props.rootPrefixCls, \"-submenu-open\");\n };\n\n _this.saveMenuInstance = function (c) {\n // children menu instance\n _this.menuInstance = c;\n };\n\n _this.addKeyPath = function (info) {\n return _objectSpread(_objectSpread({}, info), {}, {\n keyPath: (info.keyPath || []).concat(_this.props.eventKey)\n });\n };\n\n _this.triggerOpenChange = function (open, type) {\n var key = _this.props.eventKey;\n\n var openChange = function openChange() {\n _this.onOpenChange({\n key: key,\n item: _assertThisInitialized(_this),\n trigger: type,\n open: open\n });\n };\n\n if (type === 'mouseenter') {\n // make sure mouseenter happen after other menu item's mouseleave\n _this.mouseenterTimeout = setTimeout(function () {\n openChange();\n }, 0);\n } else {\n openChange();\n }\n };\n\n _this.isChildrenSelected = function () {\n var ret = {\n find: false\n };\n loopMenuItemRecursively(_this.props.children, _this.props.selectedKeys, ret);\n return ret.find;\n };\n\n _this.isOpen = function () {\n return _this.props.openKeys.indexOf(_this.props.eventKey) !== -1;\n };\n\n _this.adjustWidth = function () {\n /* istanbul ignore if */\n if (!_this.subMenuTitle || !_this.menuInstance) {\n return;\n }\n\n var popupMenu = ReactDOM.findDOMNode(_this.menuInstance);\n\n if (popupMenu.offsetWidth >= _this.subMenuTitle.offsetWidth) {\n return;\n }\n /* istanbul ignore next */\n\n\n popupMenu.style.minWidth = \"\".concat(_this.subMenuTitle.offsetWidth, \"px\");\n };\n\n _this.saveSubMenuTitle = function (subMenuTitle) {\n _this.subMenuTitle = subMenuTitle;\n };\n\n _this.getBaseProps = function () {\n var _assertThisInitialize2 = _assertThisInitialized(_this),\n props = _assertThisInitialize2.props;\n\n return {\n mode: props.mode === 'horizontal' ? 'vertical' : props.mode,\n visible: _this.props.isOpen,\n level: props.level + 1,\n inlineIndent: props.inlineIndent,\n focusable: false,\n onClick: _this.onSubMenuClick,\n onSelect: _this.onSelect,\n onDeselect: _this.onDeselect,\n onDestroy: _this.onDestroy,\n selectedKeys: props.selectedKeys,\n eventKey: \"\".concat(props.eventKey, \"-menu-\"),\n openKeys: props.openKeys,\n motion: props.motion,\n onOpenChange: _this.onOpenChange,\n subMenuOpenDelay: props.subMenuOpenDelay,\n parentMenu: _assertThisInitialized(_this),\n subMenuCloseDelay: props.subMenuCloseDelay,\n forceSubMenuRender: props.forceSubMenuRender,\n triggerSubMenuAction: props.triggerSubMenuAction,\n builtinPlacements: props.builtinPlacements,\n defaultActiveFirst: props.store.getState().defaultActiveFirst[getMenuIdFromSubMenuEventKey(props.eventKey)],\n multiple: props.multiple,\n prefixCls: props.rootPrefixCls,\n id: _this.internalMenuId,\n manualRef: _this.saveMenuInstance,\n itemIcon: props.itemIcon,\n expandIcon: props.expandIcon,\n direction: props.direction\n };\n };\n\n _this.getMotion = function (mode, visible) {\n var _assertThisInitialize3 = _assertThisInitialized(_this),\n haveRendered = _assertThisInitialize3.haveRendered;\n\n var _this$props6 = _this.props,\n motion = _this$props6.motion,\n rootPrefixCls = _this$props6.rootPrefixCls; // don't show transition on first rendering (no animation for opened menu)\n // show appear transition if it's not visible (not sure why)\n // show appear transition if it's not inline mode\n\n var mergedMotion = _objectSpread(_objectSpread({}, motion), {}, {\n leavedClassName: \"\".concat(rootPrefixCls, \"-hidden\"),\n removeOnLeave: false,\n motionAppear: haveRendered || !visible || mode !== 'inline'\n });\n\n return mergedMotion;\n };\n\n var store = props.store,\n eventKey = props.eventKey;\n\n var _store$getState = store.getState(),\n defaultActiveFirst = _store$getState.defaultActiveFirst;\n\n _this.isRootMenu = false;\n var value = false;\n\n if (defaultActiveFirst) {\n value = defaultActiveFirst[eventKey];\n }\n\n updateDefaultActiveFirst(store, eventKey, value);\n return _this;\n }\n\n _createClass(SubMenu, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.componentDidUpdate();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n var _this2 = this;\n\n var _this$props7 = this.props,\n mode = _this$props7.mode,\n parentMenu = _this$props7.parentMenu,\n manualRef = _this$props7.manualRef; // invoke customized ref to expose component to mixin\n\n if (manualRef) {\n manualRef(this);\n }\n\n if (mode !== 'horizontal' || !parentMenu.isRootMenu || !this.props.isOpen) {\n return;\n }\n\n this.minWidthTimeout = setTimeout(function () {\n return _this2.adjustWidth();\n }, 0);\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n var _this$props8 = this.props,\n onDestroy = _this$props8.onDestroy,\n eventKey = _this$props8.eventKey;\n\n if (onDestroy) {\n onDestroy(eventKey);\n }\n /* istanbul ignore if */\n\n\n if (this.minWidthTimeout) {\n clearTimeout(this.minWidthTimeout);\n }\n /* istanbul ignore if */\n\n\n if (this.mouseenterTimeout) {\n clearTimeout(this.mouseenterTimeout);\n }\n }\n }, {\n key: \"renderChildren\",\n value: function renderChildren(children) {\n var _this3 = this;\n\n var baseProps = this.getBaseProps(); // [Legacy] getMotion must be called before `haveRendered`\n\n var mergedMotion = this.getMotion(baseProps.mode, baseProps.visible);\n this.haveRendered = true;\n this.haveOpened = this.haveOpened || baseProps.visible || baseProps.forceSubMenuRender; // never rendered not planning to, don't render\n\n if (!this.haveOpened) {\n return React.createElement(\"div\", null);\n }\n\n var direction = baseProps.direction;\n return React.createElement(CSSMotion, Object.assign({\n visible: baseProps.visible\n }, mergedMotion), function (_ref) {\n var className = _ref.className,\n style = _ref.style;\n var mergedClassName = classNames(\"\".concat(baseProps.prefixCls, \"-sub\"), className, _defineProperty({}, \"\".concat(baseProps.prefixCls, \"-rtl\"), direction === 'rtl'));\n return React.createElement(SubPopupMenu, Object.assign({}, baseProps, {\n id: _this3.internalMenuId,\n className: mergedClassName,\n style: style\n }), children);\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var _classNames2;\n\n var props = _objectSpread({}, this.props);\n\n var isOpen = props.isOpen;\n var prefixCls = this.getPrefixCls();\n var isInlineMode = props.mode === 'inline';\n var className = classNames(prefixCls, \"\".concat(prefixCls, \"-\").concat(props.mode), (_classNames2 = {}, _defineProperty(_classNames2, props.className, !!props.className), _defineProperty(_classNames2, this.getOpenClassName(), isOpen), _defineProperty(_classNames2, this.getActiveClassName(), props.active || isOpen && !isInlineMode), _defineProperty(_classNames2, this.getDisabledClassName(), props.disabled), _defineProperty(_classNames2, this.getSelectedClassName(), this.isChildrenSelected()), _classNames2));\n\n if (!this.internalMenuId) {\n if (props.eventKey) {\n this.internalMenuId = \"\".concat(props.eventKey, \"$Menu\");\n } else {\n guid += 1;\n this.internalMenuId = \"$__$\".concat(guid, \"$Menu\");\n }\n }\n\n var mouseEvents = {};\n var titleClickEvents = {};\n var titleMouseEvents = {};\n\n if (!props.disabled) {\n mouseEvents = {\n onMouseLeave: this.onMouseLeave,\n onMouseEnter: this.onMouseEnter\n }; // only works in title, not outer li\n\n titleClickEvents = {\n onClick: this.onTitleClick\n };\n titleMouseEvents = {\n onMouseEnter: this.onTitleMouseEnter,\n onMouseLeave: this.onTitleMouseLeave\n };\n }\n\n var style = {};\n var direction = props.direction;\n\n if (isInlineMode) {\n if (direction === 'rtl') {\n style.paddingRight = props.inlineIndent * props.level;\n } else {\n style.paddingLeft = props.inlineIndent * props.level;\n }\n }\n\n var ariaOwns = {}; // only set aria-owns when menu is open\n // otherwise it would be an invalid aria-owns value\n // since corresponding node cannot be found\n\n if (this.props.isOpen) {\n ariaOwns = {\n 'aria-owns': this.internalMenuId\n };\n } // expand custom icon should NOT be displayed in menu with horizontal mode.\n\n\n var icon = null;\n\n if (props.mode !== 'horizontal') {\n icon = this.props.expandIcon; // ReactNode\n\n if (typeof this.props.expandIcon === 'function') {\n icon = React.createElement(this.props.expandIcon, _objectSpread({}, this.props));\n }\n }\n\n var title = React.createElement(\"div\", Object.assign({\n ref: this.saveSubMenuTitle,\n style: style,\n className: \"\".concat(prefixCls, \"-title\"),\n role: \"button\"\n }, titleMouseEvents, titleClickEvents, {\n \"aria-expanded\": isOpen\n }, ariaOwns, {\n \"aria-haspopup\": \"true\",\n title: typeof props.title === 'string' ? props.title : undefined\n }), props.title, icon || React.createElement(\"i\", {\n className: \"\".concat(prefixCls, \"-arrow\")\n }));\n var children = this.renderChildren(props.children);\n var getPopupContainer = props.parentMenu.isRootMenu ? props.parentMenu.props.getPopupContainer : function (triggerNode) {\n return triggerNode.parentNode;\n };\n var popupPlacement = popupPlacementMap[props.mode];\n var popupAlign = props.popupOffset ? {\n offset: props.popupOffset\n } : {};\n var popupClassName = props.mode === 'inline' ? '' : props.popupClassName;\n popupClassName += direction === 'rtl' ? \" \".concat(prefixCls, \"-rtl\") : '';\n var disabled = props.disabled,\n triggerSubMenuAction = props.triggerSubMenuAction,\n subMenuOpenDelay = props.subMenuOpenDelay,\n forceSubMenuRender = props.forceSubMenuRender,\n subMenuCloseDelay = props.subMenuCloseDelay,\n builtinPlacements = props.builtinPlacements;\n menuAllProps.forEach(function (key) {\n return delete props[key];\n }); // Set onClick to null, to ignore propagated onClick event\n\n delete props.onClick;\n var placement = direction === 'rtl' ? Object.assign({}, placementsRtl, builtinPlacements) : Object.assign({}, placements, builtinPlacements);\n delete props.direction;\n return React.createElement(\"li\", Object.assign({}, props, mouseEvents, {\n className: className,\n role: \"menuitem\"\n }), isInlineMode && title, isInlineMode && children, !isInlineMode && React.createElement(Trigger, {\n prefixCls: prefixCls,\n popupClassName: classNames(\"\".concat(prefixCls, \"-popup\"), popupClassName),\n getPopupContainer: getPopupContainer,\n builtinPlacements: placement,\n popupPlacement: popupPlacement,\n popupVisible: isOpen,\n popupAlign: popupAlign,\n popup: children,\n action: disabled ? [] : [triggerSubMenuAction],\n mouseEnterDelay: subMenuOpenDelay,\n mouseLeaveDelay: subMenuCloseDelay,\n onPopupVisibleChange: this.onPopupVisibleChange,\n forceRender: forceSubMenuRender\n }, title));\n }\n }]);\n\n return SubMenu;\n}(React.Component);\nSubMenu.defaultProps = {\n onMouseEnter: noop,\n onMouseLeave: noop,\n onTitleMouseEnter: noop,\n onTitleMouseLeave: noop,\n onTitleClick: noop,\n manualRef: noop,\n mode: 'vertical',\n title: ''\n};\nvar connected = connect(function (_ref2, _ref3) {\n var openKeys = _ref2.openKeys,\n activeKey = _ref2.activeKey,\n selectedKeys = _ref2.selectedKeys;\n var eventKey = _ref3.eventKey,\n subMenuKey = _ref3.subMenuKey;\n return {\n isOpen: openKeys.indexOf(eventKey) > -1,\n active: activeKey[subMenuKey] === eventKey,\n selectedKeys: selectedKeys\n };\n})(SubMenu);\nconnected.isSubMenu = true;\nexport default connected;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\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 _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 _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport ResizeObserver from 'resize-observer-polyfill';\nimport SubMenu from './SubMenu';\nimport { getWidth, setStyle, menuAllProps } from './util';\nvar MENUITEM_OVERFLOWED_CLASSNAME = 'menuitem-overflowed';\nvar FLOAT_PRECISION_ADJUST = 0.5;\n\nvar DOMWrap = /*#__PURE__*/function (_React$Component) {\n _inherits(DOMWrap, _React$Component);\n\n var _super = _createSuper(DOMWrap);\n\n function DOMWrap() {\n var _this;\n\n _classCallCheck(this, DOMWrap);\n\n _this = _super.apply(this, arguments);\n _this.resizeObserver = null;\n _this.mutationObserver = null; // original scroll size of the list\n\n _this.originalTotalWidth = 0; // copy of overflowed items\n\n _this.overflowedItems = []; // cache item of the original items (so we can track the size and order)\n\n _this.menuItemSizes = [];\n _this.state = {\n lastVisibleIndex: undefined\n }; // get all valid menuItem nodes\n\n _this.getMenuItemNodes = function () {\n var prefixCls = _this.props.prefixCls;\n var ul = ReactDOM.findDOMNode(_assertThisInitialized(_this));\n\n if (!ul) {\n return [];\n } // filter out all overflowed indicator placeholder\n\n\n return [].slice.call(ul.children).filter(function (node) {\n return node.className.split(' ').indexOf(\"\".concat(prefixCls, \"-overflowed-submenu\")) < 0;\n });\n };\n\n _this.getOverflowedSubMenuItem = function (keyPrefix, overflowedItems, renderPlaceholder) {\n var _this$props = _this.props,\n overflowedIndicator = _this$props.overflowedIndicator,\n level = _this$props.level,\n mode = _this$props.mode,\n prefixCls = _this$props.prefixCls,\n theme = _this$props.theme;\n\n if (level !== 1 || mode !== 'horizontal') {\n return null;\n } // put all the overflowed item inside a submenu\n // with a title of overflow indicator ('...')\n\n\n var copy = _this.props.children[0];\n\n var _copy$props = copy.props,\n throwAway = _copy$props.children,\n title = _copy$props.title,\n propStyle = _copy$props.style,\n rest = _objectWithoutProperties(_copy$props, [\"children\", \"title\", \"style\"]);\n\n var style = _objectSpread({}, propStyle);\n\n var key = \"\".concat(keyPrefix, \"-overflowed-indicator\");\n var eventKey = \"\".concat(keyPrefix, \"-overflowed-indicator\");\n\n if (overflowedItems.length === 0 && renderPlaceholder !== true) {\n style = _objectSpread(_objectSpread({}, style), {}, {\n display: 'none'\n });\n } else if (renderPlaceholder) {\n style = _objectSpread(_objectSpread({}, style), {}, {\n visibility: 'hidden',\n // prevent from taking normal dom space\n position: 'absolute'\n });\n key = \"\".concat(key, \"-placeholder\");\n eventKey = \"\".concat(eventKey, \"-placeholder\");\n }\n\n var popupClassName = theme ? \"\".concat(prefixCls, \"-\").concat(theme) : '';\n var props = {};\n menuAllProps.forEach(function (k) {\n if (rest[k] !== undefined) {\n props[k] = rest[k];\n }\n });\n return React.createElement(SubMenu, Object.assign({\n title: overflowedIndicator,\n className: \"\".concat(prefixCls, \"-overflowed-submenu\"),\n popupClassName: popupClassName\n }, props, {\n key: key,\n eventKey: eventKey,\n disabled: false,\n style: style\n }), overflowedItems);\n }; // memorize rendered menuSize\n\n\n _this.setChildrenWidthAndResize = function () {\n if (_this.props.mode !== 'horizontal') {\n return;\n }\n\n var ul = ReactDOM.findDOMNode(_assertThisInitialized(_this));\n\n if (!ul) {\n return;\n }\n\n var ulChildrenNodes = ul.children;\n\n if (!ulChildrenNodes || ulChildrenNodes.length === 0) {\n return;\n }\n\n var lastOverflowedIndicatorPlaceholder = ul.children[ulChildrenNodes.length - 1]; // need last overflowed indicator for calculating length;\n\n setStyle(lastOverflowedIndicatorPlaceholder, 'display', 'inline-block');\n\n var menuItemNodes = _this.getMenuItemNodes(); // reset display attribute for all hidden elements caused by overflow to calculate updated width\n // and then reset to original state after width calculation\n\n\n var overflowedItems = menuItemNodes.filter(function (c) {\n return c.className.split(' ').indexOf(MENUITEM_OVERFLOWED_CLASSNAME) >= 0;\n });\n overflowedItems.forEach(function (c) {\n setStyle(c, 'display', 'inline-block');\n });\n _this.menuItemSizes = menuItemNodes.map(function (c) {\n return getWidth(c);\n });\n overflowedItems.forEach(function (c) {\n setStyle(c, 'display', 'none');\n });\n _this.overflowedIndicatorWidth = getWidth(ul.children[ul.children.length - 1]);\n _this.originalTotalWidth = _this.menuItemSizes.reduce(function (acc, cur) {\n return acc + cur;\n }, 0);\n\n _this.handleResize(); // prevent the overflowed indicator from taking space;\n\n\n setStyle(lastOverflowedIndicatorPlaceholder, 'display', 'none');\n };\n\n _this.handleResize = function () {\n if (_this.props.mode !== 'horizontal') {\n return;\n }\n\n var ul = ReactDOM.findDOMNode(_assertThisInitialized(_this));\n\n if (!ul) {\n return;\n }\n\n var width = getWidth(ul);\n _this.overflowedItems = [];\n var currentSumWidth = 0; // index for last visible child in horizontal mode\n\n var lastVisibleIndex; // float number comparison could be problematic\n // e.g. 0.1 + 0.2 > 0.3 =====> true\n // thus using FLOAT_PRECISION_ADJUST as buffer to help the situation\n\n if (_this.originalTotalWidth > width + FLOAT_PRECISION_ADJUST) {\n lastVisibleIndex = -1;\n\n _this.menuItemSizes.forEach(function (liWidth) {\n currentSumWidth += liWidth;\n\n if (currentSumWidth + _this.overflowedIndicatorWidth <= width) {\n lastVisibleIndex += 1;\n }\n });\n }\n\n _this.setState({\n lastVisibleIndex: lastVisibleIndex\n });\n };\n\n return _this;\n }\n\n _createClass(DOMWrap, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var _this2 = this;\n\n this.setChildrenWidthAndResize();\n\n if (this.props.level === 1 && this.props.mode === 'horizontal') {\n var menuUl = ReactDOM.findDOMNode(this);\n\n if (!menuUl) {\n return;\n }\n\n this.resizeObserver = new ResizeObserver(function (entries) {\n entries.forEach(_this2.setChildrenWidthAndResize);\n });\n [].slice.call(menuUl.children).concat(menuUl).forEach(function (el) {\n _this2.resizeObserver.observe(el);\n });\n\n if (typeof MutationObserver !== 'undefined') {\n this.mutationObserver = new MutationObserver(function () {\n _this2.resizeObserver.disconnect();\n\n [].slice.call(menuUl.children).concat(menuUl).forEach(function (el) {\n _this2.resizeObserver.observe(el);\n });\n\n _this2.setChildrenWidthAndResize();\n });\n this.mutationObserver.observe(menuUl, {\n attributes: false,\n childList: true,\n subTree: false\n });\n }\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n }\n\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n }\n }\n }, {\n key: \"renderChildren\",\n value: function renderChildren(children) {\n var _this3 = this;\n\n // need to take care of overflowed items in horizontal mode\n var lastVisibleIndex = this.state.lastVisibleIndex;\n return (children || []).reduce(function (acc, childNode, index) {\n var item = childNode;\n\n if (_this3.props.mode === 'horizontal') {\n var overflowed = _this3.getOverflowedSubMenuItem(childNode.props.eventKey, []);\n\n if (lastVisibleIndex !== undefined && _this3.props.className.indexOf(\"\".concat(_this3.props.prefixCls, \"-root\")) !== -1) {\n if (index > lastVisibleIndex) {\n item = React.cloneElement(childNode, // 这里修改 eventKey 是为了防止隐藏状态下还会触发 openkeys 事件\n {\n style: {\n display: 'none'\n },\n eventKey: \"\".concat(childNode.props.eventKey, \"-hidden\"),\n\n /**\n * Legacy code. Here `className` never used:\n * https://github.com/react-component/menu/commit/4cd6b49fce9d116726f4ea00dda85325d6f26500#diff-e2fa48f75c2dd2318295cde428556a76R240\n */\n className: \"\".concat(MENUITEM_OVERFLOWED_CLASSNAME)\n });\n }\n\n if (index === lastVisibleIndex + 1) {\n _this3.overflowedItems = children.slice(lastVisibleIndex + 1).map(function (c) {\n return React.cloneElement(c, // children[index].key will become '.$key' in clone by default,\n // we have to overwrite with the correct key explicitly\n {\n key: c.props.eventKey,\n mode: 'vertical-left'\n });\n });\n overflowed = _this3.getOverflowedSubMenuItem(childNode.props.eventKey, _this3.overflowedItems);\n }\n }\n\n var ret = [].concat(_toConsumableArray(acc), [overflowed, item]);\n\n if (index === children.length - 1) {\n // need a placeholder for calculating overflowed indicator width\n ret.push(_this3.getOverflowedSubMenuItem(childNode.props.eventKey, [], true));\n }\n\n return ret;\n }\n\n return [].concat(_toConsumableArray(acc), [item]);\n }, []);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$props2 = this.props,\n visible = _this$props2.visible,\n prefixCls = _this$props2.prefixCls,\n overflowedIndicator = _this$props2.overflowedIndicator,\n mode = _this$props2.mode,\n level = _this$props2.level,\n tag = _this$props2.tag,\n children = _this$props2.children,\n theme = _this$props2.theme,\n rest = _objectWithoutProperties(_this$props2, [\"visible\", \"prefixCls\", \"overflowedIndicator\", \"mode\", \"level\", \"tag\", \"children\", \"theme\"]);\n\n var Tag = tag;\n return React.createElement(Tag, Object.assign({}, rest), this.renderChildren(children));\n }\n }]);\n\n return DOMWrap;\n}(React.Component);\n\nDOMWrap.defaultProps = {\n tag: 'div',\n className: ''\n};\nexport default DOMWrap;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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\nimport React from 'react';\nimport { connect } from 'mini-store';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport createChainedFunction from \"rc-util/es/createChainedFunction\";\nimport shallowEqual from 'shallowequal';\nimport classNames from 'classnames';\nimport { getKeyFromChildrenIndex, loopMenuItem, noop, menuAllProps, isMobileDevice } from './util';\nimport DOMWrap from './DOMWrap';\n\nfunction allDisabled(arr) {\n if (!arr.length) {\n return true;\n }\n\n return arr.every(function (c) {\n return !!c.props.disabled;\n });\n}\n\nfunction updateActiveKey(store, menuId, activeKey) {\n var state = store.getState();\n store.setState({\n activeKey: _objectSpread(_objectSpread({}, state.activeKey), {}, _defineProperty({}, menuId, activeKey))\n });\n}\n\nfunction getEventKey(props) {\n // when eventKey not available ,it's menu and return menu id '0-menu-'\n return props.eventKey || '0-menu-';\n}\n\nexport function getActiveKey(props, originalActiveKey) {\n var activeKey = originalActiveKey;\n var children = props.children,\n eventKey = props.eventKey;\n\n if (activeKey) {\n var found;\n loopMenuItem(children, function (c, i) {\n if (c && c.props && !c.props.disabled && activeKey === getKeyFromChildrenIndex(c, eventKey, i)) {\n found = true;\n }\n });\n\n if (found) {\n return activeKey;\n }\n }\n\n activeKey = null;\n\n if (props.defaultActiveFirst) {\n loopMenuItem(children, function (c, i) {\n if (!activeKey && c && !c.props.disabled) {\n activeKey = getKeyFromChildrenIndex(c, eventKey, i);\n }\n });\n return activeKey;\n }\n\n return activeKey;\n}\nexport function saveRef(c) {\n if (c) {\n var index = this.instanceArray.indexOf(c);\n\n if (index !== -1) {\n // update component if it's already inside instanceArray\n this.instanceArray[index] = c;\n } else {\n // add component if it's not in instanceArray yet;\n this.instanceArray.push(c);\n }\n }\n}\nexport var SubPopupMenu = /*#__PURE__*/function (_React$Component) {\n _inherits(SubPopupMenu, _React$Component);\n\n var _super = _createSuper(SubPopupMenu);\n\n function SubPopupMenu(props) {\n var _this;\n\n _classCallCheck(this, SubPopupMenu);\n\n _this = _super.call(this, props);\n /**\n * all keyboard events callbacks run from here at first\n *\n * note:\n * This legacy code that `onKeyDown` is called by parent instead of dom self.\n * which need return code to check if this event is handled\n */\n\n _this.onKeyDown = function (e, callback) {\n var keyCode = e.keyCode;\n var handled;\n\n _this.getFlatInstanceArray().forEach(function (obj) {\n if (obj && obj.props.active && obj.onKeyDown) {\n handled = obj.onKeyDown(e);\n }\n });\n\n if (handled) {\n return 1;\n }\n\n var activeItem = null;\n\n if (keyCode === KeyCode.UP || keyCode === KeyCode.DOWN) {\n activeItem = _this.step(keyCode === KeyCode.UP ? -1 : 1);\n }\n\n if (activeItem) {\n e.preventDefault();\n updateActiveKey(_this.props.store, getEventKey(_this.props), activeItem.props.eventKey);\n\n if (typeof callback === 'function') {\n callback(activeItem);\n }\n\n return 1;\n }\n\n return undefined;\n };\n\n _this.onItemHover = function (e) {\n var key = e.key,\n hover = e.hover;\n updateActiveKey(_this.props.store, getEventKey(_this.props), hover ? key : null);\n };\n\n _this.onDeselect = function (selectInfo) {\n _this.props.onDeselect(selectInfo);\n };\n\n _this.onSelect = function (selectInfo) {\n _this.props.onSelect(selectInfo);\n };\n\n _this.onClick = function (e) {\n _this.props.onClick(e);\n };\n\n _this.onOpenChange = function (e) {\n _this.props.onOpenChange(e);\n };\n\n _this.onDestroy = function (key) {\n /* istanbul ignore next */\n _this.props.onDestroy(key);\n };\n\n _this.getFlatInstanceArray = function () {\n return _this.instanceArray;\n };\n\n _this.step = function (direction) {\n var children = _this.getFlatInstanceArray();\n\n var activeKey = _this.props.store.getState().activeKey[getEventKey(_this.props)];\n\n var len = children.length;\n\n if (!len) {\n return null;\n }\n\n if (direction < 0) {\n children = children.concat().reverse();\n } // find current activeIndex\n\n\n var activeIndex = -1;\n children.every(function (c, ci) {\n if (c && c.props.eventKey === activeKey) {\n activeIndex = ci;\n return false;\n }\n\n return true;\n });\n\n if (!_this.props.defaultActiveFirst && activeIndex !== -1 && allDisabled(children.slice(activeIndex, len - 1))) {\n return undefined;\n }\n\n var start = (activeIndex + 1) % len;\n var i = start;\n\n do {\n var child = children[i];\n\n if (!child || child.props.disabled) {\n i = (i + 1) % len;\n } else {\n return child;\n }\n } while (i !== start);\n\n return null;\n };\n\n _this.renderCommonMenuItem = function (child, i, extraProps) {\n var state = _this.props.store.getState();\n\n var _assertThisInitialize = _assertThisInitialized(_this),\n props = _assertThisInitialize.props;\n\n var key = getKeyFromChildrenIndex(child, props.eventKey, i);\n var childProps = child.props; // https://github.com/ant-design/ant-design/issues/11517#issuecomment-477403055\n\n if (!childProps || typeof child.type === 'string') {\n return child;\n }\n\n var isActive = key === state.activeKey;\n\n var newChildProps = _objectSpread(_objectSpread({\n mode: childProps.mode || props.mode,\n level: props.level,\n inlineIndent: props.inlineIndent,\n renderMenuItem: _this.renderMenuItem,\n rootPrefixCls: props.prefixCls,\n index: i,\n parentMenu: props.parentMenu,\n // customized ref function, need to be invoked manually in child's componentDidMount\n manualRef: childProps.disabled ? undefined : createChainedFunction(child.ref, saveRef.bind(_assertThisInitialized(_this))),\n eventKey: key,\n active: !childProps.disabled && isActive,\n multiple: props.multiple,\n onClick: function onClick(e) {\n (childProps.onClick || noop)(e);\n\n _this.onClick(e);\n },\n onItemHover: _this.onItemHover,\n motion: props.motion,\n subMenuOpenDelay: props.subMenuOpenDelay,\n subMenuCloseDelay: props.subMenuCloseDelay,\n forceSubMenuRender: props.forceSubMenuRender,\n onOpenChange: _this.onOpenChange,\n onDeselect: _this.onDeselect,\n onSelect: _this.onSelect,\n builtinPlacements: props.builtinPlacements,\n itemIcon: childProps.itemIcon || _this.props.itemIcon,\n expandIcon: childProps.expandIcon || _this.props.expandIcon\n }, extraProps), {}, {\n direction: props.direction\n }); // ref: https://github.com/ant-design/ant-design/issues/13943\n\n\n if (props.mode === 'inline' || isMobileDevice()) {\n newChildProps.triggerSubMenuAction = 'click';\n }\n\n return React.cloneElement(child, newChildProps);\n };\n\n _this.renderMenuItem = function (c, i, subMenuKey) {\n /* istanbul ignore if */\n if (!c) {\n return null;\n }\n\n var state = _this.props.store.getState();\n\n var extraProps = {\n openKeys: state.openKeys,\n selectedKeys: state.selectedKeys,\n triggerSubMenuAction: _this.props.triggerSubMenuAction,\n subMenuKey: subMenuKey\n };\n return _this.renderCommonMenuItem(c, i, extraProps);\n };\n\n props.store.setState({\n activeKey: _objectSpread(_objectSpread({}, props.store.getState().activeKey), {}, _defineProperty({}, props.eventKey, getActiveKey(props, props.activeKey)))\n });\n _this.instanceArray = [];\n return _this;\n }\n\n _createClass(SubPopupMenu, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n // invoke customized ref to expose component to mixin\n if (this.props.manualRef) {\n this.props.manualRef(this);\n }\n }\n }, {\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate(nextProps) {\n return this.props.visible || nextProps.visible || this.props.className !== nextProps.className || !shallowEqual(this.props.style, nextProps.style);\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n var props = this.props;\n var originalActiveKey = 'activeKey' in props ? props.activeKey : props.store.getState().activeKey[getEventKey(props)];\n var activeKey = getActiveKey(props, originalActiveKey);\n\n if (activeKey !== originalActiveKey) {\n updateActiveKey(props.store, getEventKey(props), activeKey);\n } else if ('activeKey' in prevProps) {\n // If prev activeKey is not same as current activeKey,\n // we should set it.\n var prevActiveKey = getActiveKey(prevProps, prevProps.activeKey);\n\n if (activeKey !== prevActiveKey) {\n updateActiveKey(props.store, getEventKey(props), activeKey);\n }\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n var props = _extends({}, this.props);\n\n this.instanceArray = [];\n var className = classNames(props.prefixCls, props.className, \"\".concat(props.prefixCls, \"-\").concat(props.mode));\n var domProps = {\n className: className,\n // role could be 'select' and by default set to menu\n role: props.role || 'menu'\n };\n\n if (props.id) {\n domProps.id = props.id;\n }\n\n if (props.focusable) {\n domProps.tabIndex = 0;\n domProps.onKeyDown = this.onKeyDown;\n }\n\n var prefixCls = props.prefixCls,\n eventKey = props.eventKey,\n visible = props.visible,\n level = props.level,\n mode = props.mode,\n overflowedIndicator = props.overflowedIndicator,\n theme = props.theme;\n menuAllProps.forEach(function (key) {\n return delete props[key];\n }); // Otherwise, the propagated click event will trigger another onClick\n\n delete props.onClick;\n return React.createElement(DOMWrap, Object.assign({}, props, {\n prefixCls: prefixCls,\n mode: mode,\n tag: \"ul\",\n level: level,\n theme: theme,\n visible: visible,\n overflowedIndicator: overflowedIndicator\n }, domProps), React.Children.map(props.children, function (c, i) {\n return _this2.renderMenuItem(c, i, eventKey || '0-menu-');\n }));\n }\n }]);\n\n return SubPopupMenu;\n}(React.Component);\nSubPopupMenu.defaultProps = {\n prefixCls: 'rc-menu',\n className: '',\n mode: 'vertical',\n level: 1,\n inlineIndent: 24,\n visible: true,\n focusable: true,\n style: {},\n manualRef: noop\n};\nvar connected = connect()(SubPopupMenu);\nexport default connected;","/**\n * Safe chained function\n *\n * Will only create a new function if needed,\n * otherwise will pass back existing functions or null.\n *\n * @returns {function|null}\n */\nexport default function createChainedFunction() {\n var args = [].slice.call(arguments, 0);\n\n if (args.length === 1) {\n return args[0];\n }\n\n return function chainedFunction() {\n for (var i = 0; i < args.length; i++) {\n if (args[i] && args[i].apply) {\n args[i].apply(this, arguments);\n }\n }\n };\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport warning from \"rc-util/es/warning\";\nexport function getMotion(_ref) {\n var prefixCls = _ref.prefixCls,\n motion = _ref.motion,\n openAnimation = _ref.openAnimation,\n openTransitionName = _ref.openTransitionName;\n\n if (motion) {\n return motion;\n }\n\n if (_typeof(openAnimation) === 'object' && openAnimation) {\n warning(false, 'Object type of `openAnimation` is removed. Please use `motion` instead.');\n } else if (typeof openAnimation === 'string') {\n return {\n motionName: \"\".concat(prefixCls, \"-open-\").concat(openAnimation)\n };\n }\n\n if (openTransitionName) {\n return {\n motionName: openTransitionName\n };\n }\n\n return null;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nimport React from 'react';\nimport { Provider, create } from 'mini-store';\nimport SubPopupMenu, { getActiveKey } from './SubPopupMenu';\nimport { noop } from './util';\nimport { getMotion } from './utils/legacyUtil';\n\nvar Menu = /*#__PURE__*/function (_React$Component) {\n _inherits(Menu, _React$Component);\n\n var _super = _createSuper(Menu);\n\n function Menu(props) {\n var _this;\n\n _classCallCheck(this, Menu);\n\n _this = _super.call(this, props);\n\n _this.onSelect = function (selectInfo) {\n var _assertThisInitialize = _assertThisInitialized(_this),\n props = _assertThisInitialize.props;\n\n if (props.selectable) {\n // root menu\n var _this$store$getState = _this.store.getState(),\n _selectedKeys = _this$store$getState.selectedKeys;\n\n var selectedKey = selectInfo.key;\n\n if (props.multiple) {\n _selectedKeys = _selectedKeys.concat([selectedKey]);\n } else {\n _selectedKeys = [selectedKey];\n }\n\n if (!('selectedKeys' in props)) {\n _this.store.setState({\n selectedKeys: _selectedKeys\n });\n }\n\n props.onSelect(_objectSpread(_objectSpread({}, selectInfo), {}, {\n selectedKeys: _selectedKeys\n }));\n }\n };\n\n _this.onClick = function (e) {\n _this.props.onClick(e);\n }; // onKeyDown needs to be exposed as a instance method\n // e.g., in rc-select, we need to navigate menu item while\n // current active item is rc-select input box rather than the menu itself\n\n\n _this.onKeyDown = function (e, callback) {\n _this.innerMenu.getWrappedInstance().onKeyDown(e, callback);\n };\n\n _this.onOpenChange = function (event) {\n var _assertThisInitialize2 = _assertThisInitialized(_this),\n props = _assertThisInitialize2.props;\n\n var openKeys = _this.store.getState().openKeys.concat();\n\n var changed = false;\n\n var processSingle = function processSingle(e) {\n var oneChanged = false;\n\n if (e.open) {\n oneChanged = openKeys.indexOf(e.key) === -1;\n\n if (oneChanged) {\n openKeys.push(e.key);\n }\n } else {\n var index = openKeys.indexOf(e.key);\n oneChanged = index !== -1;\n\n if (oneChanged) {\n openKeys.splice(index, 1);\n }\n }\n\n changed = changed || oneChanged;\n };\n\n if (Array.isArray(event)) {\n // batch change call\n event.forEach(processSingle);\n } else {\n processSingle(event);\n }\n\n if (changed) {\n if (!('openKeys' in _this.props)) {\n _this.store.setState({\n openKeys: openKeys\n });\n }\n\n props.onOpenChange(openKeys);\n }\n };\n\n _this.onDeselect = function (selectInfo) {\n var _assertThisInitialize3 = _assertThisInitialized(_this),\n props = _assertThisInitialize3.props;\n\n if (props.selectable) {\n var _selectedKeys2 = _this.store.getState().selectedKeys.concat();\n\n var selectedKey = selectInfo.key;\n\n var index = _selectedKeys2.indexOf(selectedKey);\n\n if (index !== -1) {\n _selectedKeys2.splice(index, 1);\n }\n\n if (!('selectedKeys' in props)) {\n _this.store.setState({\n selectedKeys: _selectedKeys2\n });\n }\n\n props.onDeselect(_objectSpread(_objectSpread({}, selectInfo), {}, {\n selectedKeys: _selectedKeys2\n }));\n }\n };\n\n _this.getOpenTransitionName = function () {\n var _assertThisInitialize4 = _assertThisInitialized(_this),\n props = _assertThisInitialize4.props;\n\n var transitionName = props.openTransitionName;\n var animationName = props.openAnimation;\n\n if (!transitionName && typeof animationName === 'string') {\n transitionName = \"\".concat(props.prefixCls, \"-open-\").concat(animationName);\n }\n\n return transitionName;\n };\n\n _this.setInnerMenu = function (node) {\n _this.innerMenu = node;\n };\n\n _this.isRootMenu = true;\n var selectedKeys = props.defaultSelectedKeys;\n var openKeys = props.defaultOpenKeys;\n\n if ('selectedKeys' in props) {\n selectedKeys = props.selectedKeys || [];\n }\n\n if ('openKeys' in props) {\n openKeys = props.openKeys || [];\n }\n\n _this.store = create({\n selectedKeys: selectedKeys,\n openKeys: openKeys,\n activeKey: {\n '0-menu-': getActiveKey(props, props.activeKey)\n }\n });\n return _this;\n }\n\n _createClass(Menu, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.updateMiniStore();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n this.updateMiniStore();\n }\n }, {\n key: \"updateMiniStore\",\n value: function updateMiniStore() {\n if ('selectedKeys' in this.props) {\n this.store.setState({\n selectedKeys: this.props.selectedKeys || []\n });\n }\n\n if ('openKeys' in this.props) {\n this.store.setState({\n openKeys: this.props.openKeys || []\n });\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var props = _objectSpread({}, this.props);\n\n props.className += \" \".concat(props.prefixCls, \"-root\");\n\n if (props.direction === 'rtl') {\n props.className += \" \".concat(props.prefixCls, \"-rtl\");\n }\n\n props = _objectSpread(_objectSpread({}, props), {}, {\n onClick: this.onClick,\n onOpenChange: this.onOpenChange,\n onDeselect: this.onDeselect,\n onSelect: this.onSelect,\n parentMenu: this,\n motion: getMotion(this.props)\n });\n delete props.openAnimation;\n delete props.openTransitionName;\n return React.createElement(Provider, {\n store: this.store\n }, React.createElement(SubPopupMenu, Object.assign({}, props, {\n ref: this.setInnerMenu\n }), this.props.children));\n }\n }]);\n\n return Menu;\n}(React.Component);\n\nMenu.defaultProps = {\n selectable: true,\n onClick: noop,\n onSelect: noop,\n onOpenChange: noop,\n onDeselect: noop,\n defaultSelectedKeys: [],\n defaultOpenKeys: [],\n subMenuOpenDelay: 0.1,\n subMenuCloseDelay: 0.1,\n triggerSubMenuAction: 'hover',\n prefixCls: 'rc-menu',\n className: '',\n mode: 'vertical',\n style: {},\n builtinPlacements: {},\n overflowedIndicator: React.createElement(\"span\", null, \"\\xB7\\xB7\\xB7\")\n};\nexport default Menu;","function isElement(el) {\n return el != null && typeof el === 'object' && el.nodeType === 1;\n}\n\nfunction canOverflow(overflow, skipOverflowHiddenElements) {\n if (skipOverflowHiddenElements && overflow === 'hidden') {\n return false;\n }\n\n return overflow !== 'visible' && overflow !== 'clip';\n}\n\nfunction getFrameElement(el) {\n if (!el.ownerDocument || !el.ownerDocument.defaultView) {\n return null;\n }\n\n return el.ownerDocument.defaultView.frameElement;\n}\n\nfunction isHiddenByFrame(el) {\n var frame = getFrameElement(el);\n\n if (!frame) {\n return false;\n }\n\n return frame.clientHeight < el.scrollHeight || frame.clientWidth < el.scrollWidth;\n}\n\nfunction isScrollable(el, skipOverflowHiddenElements) {\n if (el.clientHeight < el.scrollHeight || el.clientWidth < el.scrollWidth) {\n var style = getComputedStyle(el, null);\n return canOverflow(style.overflowY, skipOverflowHiddenElements) || canOverflow(style.overflowX, skipOverflowHiddenElements) || isHiddenByFrame(el);\n }\n\n return false;\n}\n\nfunction alignNearest(scrollingEdgeStart, scrollingEdgeEnd, scrollingSize, scrollingBorderStart, scrollingBorderEnd, elementEdgeStart, elementEdgeEnd, elementSize) {\n if (elementEdgeStart < scrollingEdgeStart && elementEdgeEnd > scrollingEdgeEnd || elementEdgeStart > scrollingEdgeStart && elementEdgeEnd < scrollingEdgeEnd) {\n return 0;\n }\n\n if (elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize || elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize) {\n return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart;\n }\n\n if (elementEdgeEnd > scrollingEdgeEnd && elementSize < scrollingSize || elementEdgeStart < scrollingEdgeStart && elementSize > scrollingSize) {\n return elementEdgeEnd - scrollingEdgeEnd + scrollingBorderEnd;\n }\n\n return 0;\n}\n\nexport default (function (target, options) {\n var scrollMode = options.scrollMode,\n block = options.block,\n inline = options.inline,\n boundary = options.boundary,\n skipOverflowHiddenElements = options.skipOverflowHiddenElements;\n var checkBoundary = typeof boundary === 'function' ? boundary : function (node) {\n return node !== boundary;\n };\n\n if (!isElement(target)) {\n throw new TypeError('Invalid target');\n }\n\n var scrollingElement = document.scrollingElement || document.documentElement;\n var frames = [];\n var cursor = target;\n\n while (isElement(cursor) && checkBoundary(cursor)) {\n cursor = cursor.parentNode;\n\n if (cursor === scrollingElement) {\n frames.push(cursor);\n break;\n }\n\n if (cursor === document.body && isScrollable(cursor) && !isScrollable(document.documentElement)) {\n continue;\n }\n\n if (isScrollable(cursor, skipOverflowHiddenElements)) {\n frames.push(cursor);\n }\n }\n\n var viewportWidth = window.visualViewport ? visualViewport.width : innerWidth;\n var viewportHeight = window.visualViewport ? visualViewport.height : innerHeight;\n var viewportX = window.scrollX || pageXOffset;\n var viewportY = window.scrollY || pageYOffset;\n\n var _target$getBoundingCl = target.getBoundingClientRect(),\n targetHeight = _target$getBoundingCl.height,\n targetWidth = _target$getBoundingCl.width,\n targetTop = _target$getBoundingCl.top,\n targetRight = _target$getBoundingCl.right,\n targetBottom = _target$getBoundingCl.bottom,\n targetLeft = _target$getBoundingCl.left;\n\n var targetBlock = block === 'start' || block === 'nearest' ? targetTop : block === 'end' ? targetBottom : targetTop + targetHeight / 2;\n var targetInline = inline === 'center' ? targetLeft + targetWidth / 2 : inline === 'end' ? targetRight : targetLeft;\n var computations = [];\n\n for (var index = 0; index < frames.length; index++) {\n var frame = frames[index];\n\n var _frame$getBoundingCli = frame.getBoundingClientRect(),\n height = _frame$getBoundingCli.height,\n width = _frame$getBoundingCli.width,\n top = _frame$getBoundingCli.top,\n right = _frame$getBoundingCli.right,\n bottom = _frame$getBoundingCli.bottom,\n left = _frame$getBoundingCli.left;\n\n if (scrollMode === 'if-needed' && targetTop >= 0 && targetLeft >= 0 && targetBottom <= viewportHeight && targetRight <= viewportWidth && targetTop >= top && targetBottom <= bottom && targetLeft >= left && targetRight <= right) {\n return computations;\n }\n\n var frameStyle = getComputedStyle(frame);\n var borderLeft = parseInt(frameStyle.borderLeftWidth, 10);\n var borderTop = parseInt(frameStyle.borderTopWidth, 10);\n var borderRight = parseInt(frameStyle.borderRightWidth, 10);\n var borderBottom = parseInt(frameStyle.borderBottomWidth, 10);\n var blockScroll = 0;\n var inlineScroll = 0;\n var scrollbarWidth = 'offsetWidth' in frame ? frame.offsetWidth - frame.clientWidth - borderLeft - borderRight : 0;\n var scrollbarHeight = 'offsetHeight' in frame ? frame.offsetHeight - frame.clientHeight - borderTop - borderBottom : 0;\n\n if (scrollingElement === frame) {\n if (block === 'start') {\n blockScroll = targetBlock;\n } else if (block === 'end') {\n blockScroll = targetBlock - viewportHeight;\n } else if (block === 'nearest') {\n blockScroll = alignNearest(viewportY, viewportY + viewportHeight, viewportHeight, borderTop, borderBottom, viewportY + targetBlock, viewportY + targetBlock + targetHeight, targetHeight);\n } else {\n blockScroll = targetBlock - viewportHeight / 2;\n }\n\n if (inline === 'start') {\n inlineScroll = targetInline;\n } else if (inline === 'center') {\n inlineScroll = targetInline - viewportWidth / 2;\n } else if (inline === 'end') {\n inlineScroll = targetInline - viewportWidth;\n } else {\n inlineScroll = alignNearest(viewportX, viewportX + viewportWidth, viewportWidth, borderLeft, borderRight, viewportX + targetInline, viewportX + targetInline + targetWidth, targetWidth);\n }\n\n blockScroll = Math.max(0, blockScroll + viewportY);\n inlineScroll = Math.max(0, inlineScroll + viewportX);\n } else {\n if (block === 'start') {\n blockScroll = targetBlock - top - borderTop;\n } else if (block === 'end') {\n blockScroll = targetBlock - bottom + borderBottom + scrollbarHeight;\n } else if (block === 'nearest') {\n blockScroll = alignNearest(top, bottom, height, borderTop, borderBottom + scrollbarHeight, targetBlock, targetBlock + targetHeight, targetHeight);\n } else {\n blockScroll = targetBlock - (top + height / 2) + scrollbarHeight / 2;\n }\n\n if (inline === 'start') {\n inlineScroll = targetInline - left - borderLeft;\n } else if (inline === 'center') {\n inlineScroll = targetInline - (left + width / 2) + scrollbarWidth / 2;\n } else if (inline === 'end') {\n inlineScroll = targetInline - right + borderRight + scrollbarWidth;\n } else {\n inlineScroll = alignNearest(left, right, width, borderLeft, borderRight + scrollbarWidth, targetInline, targetInline + targetWidth, targetWidth);\n }\n\n var scrollLeft = frame.scrollLeft,\n scrollTop = frame.scrollTop;\n blockScroll = Math.max(0, Math.min(scrollTop + blockScroll, frame.scrollHeight - height + scrollbarHeight));\n inlineScroll = Math.max(0, Math.min(scrollLeft + inlineScroll, frame.scrollWidth - width + scrollbarWidth));\n targetBlock += scrollTop - blockScroll;\n targetInline += scrollLeft - inlineScroll;\n }\n\n computations.push({\n el: frame,\n top: blockScroll,\n left: inlineScroll\n });\n }\n\n return computations;\n});","import compute from 'compute-scroll-into-view';\n\nfunction isOptionsObject(options) {\n return options === Object(options) && Object.keys(options).length !== 0;\n}\n\nfunction defaultBehavior(actions, behavior) {\n if (behavior === void 0) {\n behavior = 'auto';\n }\n\n var canSmoothScroll = 'scrollBehavior' in document.body.style;\n actions.forEach(function (_ref) {\n var el = _ref.el,\n top = _ref.top,\n left = _ref.left;\n\n if (el.scroll && canSmoothScroll) {\n el.scroll({\n top: top,\n left: left,\n behavior: behavior\n });\n } else {\n el.scrollTop = top;\n el.scrollLeft = left;\n }\n });\n}\n\nfunction getOptions(options) {\n if (options === false) {\n return {\n block: 'end',\n inline: 'nearest'\n };\n }\n\n if (isOptionsObject(options)) {\n return options;\n }\n\n return {\n block: 'start',\n inline: 'nearest'\n };\n}\n\nfunction scrollIntoView(target, options) {\n var targetIsDetached = !target.ownerDocument.documentElement.contains(target);\n\n if (isOptionsObject(options) && typeof options.behavior === 'function') {\n return options.behavior(targetIsDetached ? [] : compute(target, options));\n }\n\n if (targetIsDetached) {\n return;\n }\n\n var computeOptions = getOptions(options);\n return defaultBehavior(compute(target, computeOptions), computeOptions.behavior);\n}\n\nexport default scrollIntoView;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport classNames from 'classnames';\nimport scrollIntoView from 'scroll-into-view-if-needed';\nimport { connect } from 'mini-store';\nimport { noop, menuAllProps } from './util';\nexport var MenuItem = /*#__PURE__*/function (_React$Component) {\n _inherits(MenuItem, _React$Component);\n\n var _super = _createSuper(MenuItem);\n\n function MenuItem() {\n var _this;\n\n _classCallCheck(this, MenuItem);\n\n _this = _super.apply(this, arguments);\n\n _this.onKeyDown = function (e) {\n var keyCode = e.keyCode;\n\n if (keyCode === KeyCode.ENTER) {\n _this.onClick(e);\n\n return true;\n }\n\n return undefined;\n };\n\n _this.onMouseLeave = function (e) {\n var _this$props = _this.props,\n eventKey = _this$props.eventKey,\n onItemHover = _this$props.onItemHover,\n onMouseLeave = _this$props.onMouseLeave;\n onItemHover({\n key: eventKey,\n hover: false\n });\n onMouseLeave({\n key: eventKey,\n domEvent: e\n });\n };\n\n _this.onMouseEnter = function (e) {\n var _this$props2 = _this.props,\n eventKey = _this$props2.eventKey,\n onItemHover = _this$props2.onItemHover,\n onMouseEnter = _this$props2.onMouseEnter;\n onItemHover({\n key: eventKey,\n hover: true\n });\n onMouseEnter({\n key: eventKey,\n domEvent: e\n });\n };\n\n _this.onClick = function (e) {\n var _this$props3 = _this.props,\n eventKey = _this$props3.eventKey,\n multiple = _this$props3.multiple,\n onClick = _this$props3.onClick,\n onSelect = _this$props3.onSelect,\n onDeselect = _this$props3.onDeselect,\n isSelected = _this$props3.isSelected;\n var info = {\n key: eventKey,\n keyPath: [eventKey],\n item: _assertThisInitialized(_this),\n domEvent: e\n };\n onClick(info);\n\n if (multiple) {\n if (isSelected) {\n onDeselect(info);\n } else {\n onSelect(info);\n }\n } else if (!isSelected) {\n onSelect(info);\n }\n };\n\n _this.saveNode = function (node) {\n _this.node = node;\n };\n\n return _this;\n }\n\n _createClass(MenuItem, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n // invoke customized ref to expose component to mixin\n this.callRef();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n var _this$props4 = this.props,\n active = _this$props4.active,\n parentMenu = _this$props4.parentMenu,\n eventKey = _this$props4.eventKey; // 在 parentMenu 上层保存滚动状态,避免重复的 MenuItem key 导致滚动跳动\n // https://github.com/ant-design/ant-design/issues/16181\n\n if (!prevProps.active && active && (!parentMenu || !parentMenu[\"scrolled-\".concat(eventKey)])) {\n if (this.node) {\n scrollIntoView(this.node, {\n scrollMode: 'if-needed',\n // eslint-disable-next-line react/no-find-dom-node\n boundary: ReactDOM.findDOMNode(parentMenu),\n block: 'nearest'\n });\n parentMenu[\"scrolled-\".concat(eventKey)] = true;\n }\n } else if (parentMenu && parentMenu[\"scrolled-\".concat(eventKey)]) {\n delete parentMenu[\"scrolled-\".concat(eventKey)];\n }\n\n this.callRef();\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n var props = this.props;\n\n if (props.onDestroy) {\n props.onDestroy(props.eventKey);\n }\n }\n }, {\n key: \"getPrefixCls\",\n value: function getPrefixCls() {\n return \"\".concat(this.props.rootPrefixCls, \"-item\");\n }\n }, {\n key: \"getActiveClassName\",\n value: function getActiveClassName() {\n return \"\".concat(this.getPrefixCls(), \"-active\");\n }\n }, {\n key: \"getSelectedClassName\",\n value: function getSelectedClassName() {\n return \"\".concat(this.getPrefixCls(), \"-selected\");\n }\n }, {\n key: \"getDisabledClassName\",\n value: function getDisabledClassName() {\n return \"\".concat(this.getPrefixCls(), \"-disabled\");\n }\n }, {\n key: \"callRef\",\n value: function callRef() {\n if (this.props.manualRef) {\n this.props.manualRef(this);\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _classNames;\n\n var props = _objectSpread({}, this.props);\n\n var className = classNames(this.getPrefixCls(), props.className, (_classNames = {}, _defineProperty(_classNames, this.getActiveClassName(), !props.disabled && props.active), _defineProperty(_classNames, this.getSelectedClassName(), props.isSelected), _defineProperty(_classNames, this.getDisabledClassName(), props.disabled), _classNames));\n\n var attrs = _objectSpread(_objectSpread({}, props.attribute), {}, {\n title: props.title,\n className: className,\n // set to menuitem by default\n role: props.role || 'menuitem',\n 'aria-disabled': props.disabled\n });\n\n if (props.role === 'option') {\n // overwrite to option\n attrs = _objectSpread(_objectSpread({}, attrs), {}, {\n role: 'option',\n 'aria-selected': props.isSelected\n });\n } else if (props.role === null || props.role === 'none') {\n // sometimes we want to specify role inside element\n // Link would be a good example\n // in this case the role on should be \"none\" to\n // remove the implied listitem role.\n // https://www.w3.org/TR/wai-aria-practices-1.1/examples/menubar/menubar-1/menubar-1.html\n attrs.role = 'none';\n } // In case that onClick/onMouseLeave/onMouseEnter is passed down from owner\n\n\n var mouseEvent = {\n onClick: props.disabled ? null : this.onClick,\n onMouseLeave: props.disabled ? null : this.onMouseLeave,\n onMouseEnter: props.disabled ? null : this.onMouseEnter\n };\n\n var style = _objectSpread({}, props.style);\n\n if (props.mode === 'inline') {\n if (props.direction === 'rtl') {\n style.paddingRight = props.inlineIndent * props.level;\n } else {\n style.paddingLeft = props.inlineIndent * props.level;\n }\n }\n\n menuAllProps.forEach(function (key) {\n return delete props[key];\n });\n delete props.direction;\n var icon = this.props.itemIcon;\n\n if (typeof this.props.itemIcon === 'function') {\n // TODO: This is a bug which should fixed after TS refactor\n icon = React.createElement(this.props.itemIcon, this.props);\n }\n\n return React.createElement(\"li\", Object.assign({}, props, attrs, mouseEvent, {\n style: style,\n ref: this.saveNode\n }), props.children, icon);\n }\n }]);\n\n return MenuItem;\n}(React.Component);\nMenuItem.isMenuItem = true;\nMenuItem.defaultProps = {\n onSelect: noop,\n onMouseEnter: noop,\n onMouseLeave: noop,\n manualRef: noop\n};\nvar connected = connect(function (_ref, _ref2) {\n var activeKey = _ref.activeKey,\n selectedKeys = _ref.selectedKeys;\n var eventKey = _ref2.eventKey,\n subMenuKey = _ref2.subMenuKey;\n return {\n active: activeKey[subMenuKey] === eventKey,\n isSelected: selectedKeys.indexOf(eventKey) !== -1\n };\n})(MenuItem);\nexport default connected;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nimport React from 'react';\nimport { menuAllProps } from './util';\n\nvar MenuItemGroup = /*#__PURE__*/function (_React$Component) {\n _inherits(MenuItemGroup, _React$Component);\n\n var _super = _createSuper(MenuItemGroup);\n\n function MenuItemGroup() {\n var _this;\n\n _classCallCheck(this, MenuItemGroup);\n\n _this = _super.apply(this, arguments);\n\n _this.renderInnerMenuItem = function (item) {\n var _this$props = _this.props,\n renderMenuItem = _this$props.renderMenuItem,\n index = _this$props.index;\n return renderMenuItem(item, index, _this.props.subMenuKey);\n };\n\n return _this;\n }\n\n _createClass(MenuItemGroup, [{\n key: \"render\",\n value: function render() {\n var props = _extends({}, this.props);\n\n var _props$className = props.className,\n className = _props$className === void 0 ? '' : _props$className,\n rootPrefixCls = props.rootPrefixCls;\n var titleClassName = \"\".concat(rootPrefixCls, \"-item-group-title\");\n var listClassName = \"\".concat(rootPrefixCls, \"-item-group-list\");\n var title = props.title,\n children = props.children;\n menuAllProps.forEach(function (key) {\n return delete props[key];\n }); // Set onClick to null, to ignore propagated onClick event\n\n delete props.onClick;\n delete props.direction;\n return React.createElement(\"li\", Object.assign({}, props, {\n className: \"\".concat(className, \" \").concat(rootPrefixCls, \"-item-group\")\n }), React.createElement(\"div\", {\n className: titleClassName,\n title: typeof title === 'string' ? title : undefined\n }, title), React.createElement(\"ul\", {\n className: listClassName\n }, React.Children.map(children, this.renderInnerMenuItem)));\n }\n }]);\n\n return MenuItemGroup;\n}(React.Component);\n\nMenuItemGroup.isMenuItemGroup = true;\nMenuItemGroup.defaultProps = {\n disabled: true\n};\nexport default MenuItemGroup;","import React from 'react';\n\nvar Divider = function Divider(_ref) {\n var className = _ref.className,\n rootPrefixCls = _ref.rootPrefixCls,\n style = _ref.style;\n return React.createElement(\"li\", {\n className: \"\".concat(className, \" \").concat(rootPrefixCls, \"-item-divider\"),\n style: style\n });\n};\n\nDivider.defaultProps = {\n // To fix keyboard UX.\n disabled: true,\n className: '',\n style: {}\n};\nexport default Divider;","import Menu from './Menu';\nimport SubMenu from './SubMenu';\nimport MenuItem from './MenuItem';\nimport MenuItemGroup from './MenuItemGroup';\nimport Divider from './Divider';\nexport { SubMenu, MenuItem as Item, MenuItem, MenuItemGroup, MenuItemGroup as ItemGroup, Divider };\nexport default Menu;","import { createContext } from 'react';\nconst MenuContext = createContext({\n inlineCollapsed: false,\n});\nexport default MenuContext;\n","import * as React from 'react';\nimport * as PropTypes from 'prop-types';\nimport { SubMenu as RcSubMenu } from 'rc-menu';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport MenuContext from './MenuContext';\nclass SubMenu extends React.Component {\n constructor() {\n super(...arguments);\n this.onKeyDown = (e) => {\n this.subMenu.onKeyDown(e);\n };\n this.saveSubMenu = (subMenu) => {\n this.subMenu = subMenu;\n };\n }\n renderTitle() {\n const { icon, title } = this.props;\n if (!icon) {\n return title;\n }\n // inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性,则内部包裹一个 span\n // ref: https://github.com/ant-design/ant-design/pull/23456\n const titleIsSpan = React.isValidElement(title) && title.type === 'span';\n return (<>\n {icon}\n {titleIsSpan ? title : {title}}\n >);\n }\n render() {\n const { rootPrefixCls, popupClassName } = this.props;\n return (\n {({ antdMenuTheme }) => ()}\n );\n }\n}\nSubMenu.contextTypes = {\n antdMenuTheme: PropTypes.string,\n};\n// fix issue:https://github.com/ant-design/ant-design/issues/8666\nSubMenu.isSubMenu = 1;\nexport default SubMenu;\n","import React from 'react';\n\nvar Content = function Content(props) {\n var overlay = props.overlay,\n prefixCls = props.prefixCls,\n id = props.id;\n return React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-inner\"),\n id: id,\n role: \"tooltip\"\n }, typeof overlay === 'function' ? overlay() : overlay);\n};\n\nexport default Content;","var autoAdjustOverflow = {\n adjustX: 1,\n adjustY: 1\n};\nvar targetOffset = [0, 0];\nexport var placements = {\n left: {\n points: ['cr', 'cl'],\n overflow: autoAdjustOverflow,\n offset: [-4, 0],\n targetOffset: targetOffset\n },\n right: {\n points: ['cl', 'cr'],\n overflow: autoAdjustOverflow,\n offset: [4, 0],\n targetOffset: targetOffset\n },\n top: {\n points: ['bc', 'tc'],\n overflow: autoAdjustOverflow,\n offset: [0, -4],\n targetOffset: targetOffset\n },\n bottom: {\n points: ['tc', 'bc'],\n overflow: autoAdjustOverflow,\n offset: [0, 4],\n targetOffset: targetOffset\n },\n topLeft: {\n points: ['bl', 'tl'],\n overflow: autoAdjustOverflow,\n offset: [0, -4],\n targetOffset: targetOffset\n },\n leftTop: {\n points: ['tr', 'tl'],\n overflow: autoAdjustOverflow,\n offset: [-4, 0],\n targetOffset: targetOffset\n },\n topRight: {\n points: ['br', 'tr'],\n overflow: autoAdjustOverflow,\n offset: [0, -4],\n targetOffset: targetOffset\n },\n rightTop: {\n points: ['tl', 'tr'],\n overflow: autoAdjustOverflow,\n offset: [4, 0],\n targetOffset: targetOffset\n },\n bottomRight: {\n points: ['tr', 'br'],\n overflow: autoAdjustOverflow,\n offset: [0, 4],\n targetOffset: targetOffset\n },\n rightBottom: {\n points: ['bl', 'br'],\n overflow: autoAdjustOverflow,\n offset: [4, 0],\n targetOffset: targetOffset\n },\n bottomLeft: {\n points: ['tl', 'bl'],\n overflow: autoAdjustOverflow,\n offset: [0, 4],\n targetOffset: targetOffset\n },\n leftBottom: {\n points: ['br', 'bl'],\n overflow: autoAdjustOverflow,\n offset: [-4, 0],\n targetOffset: targetOffset\n }\n};\nexport default placements;","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport React, { useRef, useImperativeHandle, forwardRef } from 'react';\nimport Trigger from 'rc-trigger';\nimport { placements } from './placements';\nimport Content from './Content';\n\nvar Tooltip = function Tooltip(props, ref) {\n var overlayClassName = props.overlayClassName,\n _props$trigger = props.trigger,\n trigger = _props$trigger === void 0 ? ['hover'] : _props$trigger,\n _props$mouseEnterDela = props.mouseEnterDelay,\n mouseEnterDelay = _props$mouseEnterDela === void 0 ? 0 : _props$mouseEnterDela,\n _props$mouseLeaveDela = props.mouseLeaveDelay,\n mouseLeaveDelay = _props$mouseLeaveDela === void 0 ? 0.1 : _props$mouseLeaveDela,\n overlayStyle = props.overlayStyle,\n _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? 'rc-tooltip' : _props$prefixCls,\n children = props.children,\n onVisibleChange = props.onVisibleChange,\n afterVisibleChange = props.afterVisibleChange,\n transitionName = props.transitionName,\n animation = props.animation,\n _props$placement = props.placement,\n placement = _props$placement === void 0 ? 'right' : _props$placement,\n _props$align = props.align,\n align = _props$align === void 0 ? {} : _props$align,\n _props$destroyTooltip = props.destroyTooltipOnHide,\n destroyTooltipOnHide = _props$destroyTooltip === void 0 ? false : _props$destroyTooltip,\n defaultVisible = props.defaultVisible,\n getTooltipContainer = props.getTooltipContainer,\n restProps = _objectWithoutProperties(props, [\"overlayClassName\", \"trigger\", \"mouseEnterDelay\", \"mouseLeaveDelay\", \"overlayStyle\", \"prefixCls\", \"children\", \"onVisibleChange\", \"afterVisibleChange\", \"transitionName\", \"animation\", \"placement\", \"align\", \"destroyTooltipOnHide\", \"defaultVisible\", \"getTooltipContainer\"]);\n\n var domRef = useRef(null);\n useImperativeHandle(ref, function () {\n return domRef.current;\n });\n\n var extraProps = _objectSpread({}, restProps);\n\n if ('visible' in props) {\n extraProps.popupVisible = props.visible;\n }\n\n var getPopupElement = function getPopupElement() {\n var _props$arrowContent = props.arrowContent,\n arrowContent = _props$arrowContent === void 0 ? null : _props$arrowContent,\n overlay = props.overlay,\n id = props.id;\n return [React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-arrow\"),\n key: \"arrow\"\n }, arrowContent), React.createElement(Content, {\n key: \"content\",\n prefixCls: prefixCls,\n id: id,\n overlay: overlay\n })];\n };\n\n return React.createElement(Trigger, Object.assign({\n popupClassName: overlayClassName,\n prefixCls: prefixCls,\n popup: getPopupElement,\n action: trigger,\n builtinPlacements: placements,\n popupPlacement: placement,\n ref: domRef,\n popupAlign: align,\n getPopupContainer: getTooltipContainer,\n onPopupVisibleChange: onVisibleChange,\n afterPopupVisibleChange: afterVisibleChange,\n popupTransitionName: transitionName,\n popupAnimation: animation,\n defaultPopupVisible: defaultVisible,\n destroyPopupOnHide: destroyTooltipOnHide,\n mouseLeaveDelay: mouseLeaveDelay,\n popupStyle: overlayStyle,\n mouseEnterDelay: mouseEnterDelay\n }, extraProps), children);\n};\n\nexport default forwardRef(Tooltip);","import Tooltip from './Tooltip';\nexport default Tooltip;","import { placements } from 'rc-tooltip/lib/placements';\nconst autoAdjustOverflowEnabled = {\n adjustX: 1,\n adjustY: 1,\n};\nconst autoAdjustOverflowDisabled = {\n adjustX: 0,\n adjustY: 0,\n};\nconst targetOffset = [0, 0];\nexport function getOverflowOptions(autoAdjustOverflow) {\n if (typeof autoAdjustOverflow === 'boolean') {\n return autoAdjustOverflow ? autoAdjustOverflowEnabled : autoAdjustOverflowDisabled;\n }\n return Object.assign(Object.assign({}, autoAdjustOverflowDisabled), autoAdjustOverflow);\n}\nexport default function getPlacements(config) {\n const { arrowWidth = 5, horizontalArrowShift = 16, verticalArrowShift = 8, autoAdjustOverflow, } = config;\n const placementMap = {\n left: {\n points: ['cr', 'cl'],\n offset: [-4, 0],\n },\n right: {\n points: ['cl', 'cr'],\n offset: [4, 0],\n },\n top: {\n points: ['bc', 'tc'],\n offset: [0, -4],\n },\n bottom: {\n points: ['tc', 'bc'],\n offset: [0, 4],\n },\n topLeft: {\n points: ['bl', 'tc'],\n offset: [-(horizontalArrowShift + arrowWidth), -4],\n },\n leftTop: {\n points: ['tr', 'cl'],\n offset: [-4, -(verticalArrowShift + arrowWidth)],\n },\n topRight: {\n points: ['br', 'tc'],\n offset: [horizontalArrowShift + arrowWidth, -4],\n },\n rightTop: {\n points: ['tl', 'cr'],\n offset: [4, -(verticalArrowShift + arrowWidth)],\n },\n bottomRight: {\n points: ['tr', 'bc'],\n offset: [horizontalArrowShift + arrowWidth, 4],\n },\n rightBottom: {\n points: ['bl', 'cr'],\n offset: [4, verticalArrowShift + arrowWidth],\n },\n bottomLeft: {\n points: ['tl', 'bc'],\n offset: [-(horizontalArrowShift + arrowWidth), 4],\n },\n leftBottom: {\n points: ['br', 'cl'],\n offset: [-4, verticalArrowShift + arrowWidth],\n },\n };\n Object.keys(placementMap).forEach(key => {\n placementMap[key] = config.arrowPointAtCenter\n ? Object.assign(Object.assign({}, placementMap[key]), { overflow: getOverflowOptions(autoAdjustOverflow), targetOffset }) : Object.assign(Object.assign({}, placements[key]), { overflow: getOverflowOptions(autoAdjustOverflow) });\n placementMap[key].ignoreShake = true;\n });\n return placementMap;\n}\n","import * as React from 'react';\nimport RcTooltip from 'rc-tooltip';\nimport classNames from 'classnames';\nimport getPlacements, { AdjustOverflow, PlacementsConfig } from './placements';\nimport { ConfigConsumer } from '../config-provider';\nexport { AdjustOverflow, PlacementsConfig };\nconst splitObject = (obj, keys) => {\n const picked = {};\n const omitted = Object.assign({}, obj);\n keys.forEach(key => {\n if (obj && key in obj) {\n picked[key] = obj[key];\n delete omitted[key];\n }\n });\n return { picked, omitted };\n};\n// Fix Tooltip won't hide at disabled button\n// mouse events don't trigger at disabled button in Chrome\n// https://github.com/react-component/tooltip/issues/18\nfunction getDisabledCompatibleChildren(element, prefixCls) {\n const elementType = element.type;\n if ((elementType.__ANT_BUTTON === true ||\n elementType.__ANT_SWITCH === true ||\n elementType.__ANT_CHECKBOX === true ||\n element.type === 'button') &&\n element.props.disabled) {\n // Pick some layout related style properties up to span\n // Prevent layout bugs like https://github.com/ant-design/ant-design/issues/5254\n const { picked, omitted } = splitObject(element.props.style, [\n 'position',\n 'left',\n 'right',\n 'top',\n 'bottom',\n 'float',\n 'display',\n 'zIndex',\n ]);\n const spanStyle = Object.assign(Object.assign({ display: 'inline-block' }, picked), { cursor: 'not-allowed', width: element.props.block ? '100%' : null });\n const buttonStyle = Object.assign(Object.assign({}, omitted), { pointerEvents: 'none' });\n const child = React.cloneElement(element, {\n style: buttonStyle,\n className: null,\n });\n return (\n {child}\n );\n }\n return element;\n}\nclass Tooltip extends React.Component {\n constructor(props) {\n super(props);\n this.onVisibleChange = (visible) => {\n const { onVisibleChange } = this.props;\n if (!('visible' in this.props)) {\n this.setState({ visible: this.isNoTitle() ? false : visible });\n }\n if (onVisibleChange && !this.isNoTitle()) {\n onVisibleChange(visible);\n }\n };\n this.saveTooltip = (node) => {\n this.tooltip = node;\n };\n // 动态设置动画点\n this.onPopupAlign = (domNode, align) => {\n const placements = this.getPlacements();\n // 当前返回的位置\n const placement = Object.keys(placements).filter(key => placements[key].points[0] === align.points[0] &&\n placements[key].points[1] === align.points[1])[0];\n if (!placement) {\n return;\n }\n // 根据当前坐标设置动画点\n const rect = domNode.getBoundingClientRect();\n const transformOrigin = {\n top: '50%',\n left: '50%',\n };\n if (placement.indexOf('top') >= 0 || placement.indexOf('Bottom') >= 0) {\n transformOrigin.top = `${rect.height - align.offset[1]}px`;\n }\n else if (placement.indexOf('Top') >= 0 || placement.indexOf('bottom') >= 0) {\n transformOrigin.top = `${-align.offset[1]}px`;\n }\n if (placement.indexOf('left') >= 0 || placement.indexOf('Right') >= 0) {\n transformOrigin.left = `${rect.width - align.offset[0]}px`;\n }\n else if (placement.indexOf('right') >= 0 || placement.indexOf('Left') >= 0) {\n transformOrigin.left = `${-align.offset[0]}px`;\n }\n domNode.style.transformOrigin = `${transformOrigin.left} ${transformOrigin.top}`;\n };\n this.renderTooltip = ({ getPopupContainer: getContextPopupContainer, getPrefixCls, direction, }) => {\n const { props, state } = this;\n const { prefixCls: customizePrefixCls, openClassName, getPopupContainer, getTooltipContainer, overlayClassName, } = props;\n const children = props.children;\n const prefixCls = getPrefixCls('tooltip', customizePrefixCls);\n let { visible } = state;\n // Hide tooltip when there is no title\n if (!('visible' in props) && this.isNoTitle()) {\n visible = false;\n }\n const child = getDisabledCompatibleChildren(React.isValidElement(children) ? children : {children}, prefixCls);\n const childProps = child.props;\n const childCls = classNames(childProps.className, {\n [openClassName || `${prefixCls}-open`]: true,\n });\n const customOverlayClassName = classNames(overlayClassName, {\n [`${prefixCls}-rtl`]: direction === 'rtl',\n });\n return (\n {visible ? React.cloneElement(child, { className: childCls }) : child}\n );\n };\n this.state = {\n visible: !!props.visible || !!props.defaultVisible,\n };\n }\n static getDerivedStateFromProps(nextProps) {\n if ('visible' in nextProps) {\n return { visible: nextProps.visible };\n }\n return null;\n }\n getPopupDomNode() {\n return this.tooltip.getPopupDomNode();\n }\n getPlacements() {\n const { builtinPlacements, arrowPointAtCenter, autoAdjustOverflow } = this.props;\n return (builtinPlacements ||\n getPlacements({\n arrowPointAtCenter,\n autoAdjustOverflow,\n }));\n }\n isNoTitle() {\n const { title, overlay } = this.props;\n return !title && !overlay && title !== 0; // overlay for old version compatibility\n }\n getOverlay() {\n const { title, overlay } = this.props;\n if (title === 0) {\n return title;\n }\n return overlay || title || '';\n }\n render() {\n return {this.renderTooltip};\n }\n}\nTooltip.defaultProps = {\n placement: 'top',\n transitionName: 'zoom-big-fast',\n mouseEnterDelay: 0.1,\n mouseLeaveDelay: 0.1,\n arrowPointAtCenter: false,\n autoAdjustOverflow: true,\n};\nexport default Tooltip;\n","var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { ConfigConsumer } from '../config-provider';\nexport const LayoutContext = React.createContext({\n siderHook: {\n addSider: () => null,\n removeSider: () => null,\n },\n});\nfunction generator({ suffixCls, tagName, displayName }) {\n return (BasicComponent) => {\n var _a;\n return _a = class Adapter extends React.Component {\n constructor() {\n super(...arguments);\n this.renderComponent = ({ getPrefixCls }) => {\n const { prefixCls: customizePrefixCls } = this.props;\n const prefixCls = getPrefixCls(suffixCls, customizePrefixCls);\n return ;\n };\n }\n render() {\n return {this.renderComponent};\n }\n },\n _a.displayName = displayName,\n _a;\n };\n}\nconst Basic = (props) => {\n const { prefixCls, className, children, tagName } = props, others = __rest(props, [\"prefixCls\", \"className\", \"children\", \"tagName\"]);\n const classString = classNames(prefixCls, className);\n return React.createElement(tagName, Object.assign({ className: classString }, others), children);\n};\nclass BasicLayout extends React.Component {\n constructor() {\n super(...arguments);\n this.state = { siders: [] };\n this.renderComponent = ({ direction }) => {\n const _a = this.props, { prefixCls, className, children, hasSider, tagName: Tag } = _a, others = __rest(_a, [\"prefixCls\", \"className\", \"children\", \"hasSider\", \"tagName\"]);\n const classString = classNames(prefixCls, {\n [`${prefixCls}-has-sider`]: typeof hasSider === 'boolean' ? hasSider : this.state.siders.length > 0,\n [`${prefixCls}-rtl`]: direction === 'rtl',\n }, className);\n return (\n \n {children}\n \n );\n };\n }\n getSiderHook() {\n return {\n addSider: (id) => {\n this.setState(state => ({\n siders: [...state.siders, id],\n }));\n },\n removeSider: (id) => {\n this.setState(state => ({\n siders: state.siders.filter(currentId => currentId !== id),\n }));\n },\n };\n }\n render() {\n return {this.renderComponent};\n }\n}\nconst Layout = generator({\n suffixCls: 'layout',\n tagName: 'section',\n displayName: 'Layout',\n})(BasicLayout);\nconst Header = generator({\n suffixCls: 'layout-header',\n tagName: 'header',\n displayName: 'Header',\n})(Basic);\nconst Footer = generator({\n suffixCls: 'layout-footer',\n tagName: 'footer',\n displayName: 'Footer',\n})(Basic);\nconst Content = generator({\n suffixCls: 'layout-content',\n tagName: 'main',\n displayName: 'Content',\n})(Basic);\nLayout.Header = Header;\nLayout.Footer = Footer;\nLayout.Content = Content;\nexport default Layout;\n","const isNumeric = (value) => {\n return !isNaN(parseFloat(value)) && isFinite(value);\n};\nexport default isNumeric;\n","var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport BarsOutlined from '@ant-design/icons/BarsOutlined';\nimport RightOutlined from '@ant-design/icons/RightOutlined';\nimport LeftOutlined from '@ant-design/icons/LeftOutlined';\nimport { LayoutContext } from './layout';\nimport { ConfigConsumer } from '../config-provider';\nimport isNumeric from '../_util/isNumeric';\nconst dimensionMaxMap = {\n xs: '479.98px',\n sm: '575.98px',\n md: '767.98px',\n lg: '991.98px',\n xl: '1199.98px',\n xxl: '1599.98px',\n};\nexport const SiderContext = React.createContext({});\nconst generateId = (() => {\n let i = 0;\n return (prefix = '') => {\n i += 1;\n return `${prefix}${i}`;\n };\n})();\nclass InternalSider extends React.Component {\n constructor(props) {\n super(props);\n this.responsiveHandler = (mql) => {\n this.setState({ below: mql.matches });\n const { onBreakpoint } = this.props;\n if (onBreakpoint) {\n onBreakpoint(mql.matches);\n }\n if (this.state.collapsed !== mql.matches) {\n this.setCollapsed(mql.matches, 'responsive');\n }\n };\n this.setCollapsed = (collapsed, type) => {\n if (!('collapsed' in this.props)) {\n this.setState({\n collapsed,\n });\n }\n const { onCollapse } = this.props;\n if (onCollapse) {\n onCollapse(collapsed, type);\n }\n };\n this.toggle = () => {\n const collapsed = !this.state.collapsed;\n this.setCollapsed(collapsed, 'clickTrigger');\n };\n this.renderSider = ({ getPrefixCls }) => {\n const _a = this.props, { prefixCls: customizePrefixCls, className, theme, collapsible, reverseArrow, trigger, style, width, collapsedWidth, zeroWidthTriggerStyle } = _a, others = __rest(_a, [\"prefixCls\", \"className\", \"theme\", \"collapsible\", \"reverseArrow\", \"trigger\", \"style\", \"width\", \"collapsedWidth\", \"zeroWidthTriggerStyle\"]);\n const prefixCls = getPrefixCls('layout-sider', customizePrefixCls);\n const divProps = omit(others, [\n 'collapsed',\n 'defaultCollapsed',\n 'onCollapse',\n 'breakpoint',\n 'onBreakpoint',\n 'siderHook',\n 'zeroWidthTriggerStyle',\n ]);\n const rawWidth = this.state.collapsed ? collapsedWidth : width;\n // use \"px\" as fallback unit for width\n const siderWidth = isNumeric(rawWidth) ? `${rawWidth}px` : String(rawWidth);\n // special trigger when collapsedWidth == 0\n const zeroWidthTrigger = parseFloat(String(collapsedWidth || 0)) === 0 ? (\n \n ) : null;\n const iconObj = {\n expanded: reverseArrow ? : ,\n collapsed: reverseArrow ? : ,\n };\n const status = this.state.collapsed ? 'collapsed' : 'expanded';\n const defaultTrigger = iconObj[status];\n const triggerDom = trigger !== null\n ? zeroWidthTrigger || (\n {trigger || defaultTrigger}\n
)\n : null;\n const divStyle = Object.assign(Object.assign({}, style), { flex: `0 0 ${siderWidth}`, maxWidth: siderWidth, minWidth: siderWidth, width: siderWidth });\n const siderCls = classNames(className, prefixCls, `${prefixCls}-${theme}`, {\n [`${prefixCls}-collapsed`]: !!this.state.collapsed,\n [`${prefixCls}-has-trigger`]: collapsible && trigger !== null && !zeroWidthTrigger,\n [`${prefixCls}-below`]: !!this.state.below,\n [`${prefixCls}-zero-width`]: parseFloat(siderWidth) === 0,\n });\n return ();\n };\n this.uniqueId = generateId('ant-sider-');\n let matchMedia;\n if (typeof window !== 'undefined') {\n matchMedia = window.matchMedia;\n }\n if (matchMedia && props.breakpoint && props.breakpoint in dimensionMaxMap) {\n this.mql = matchMedia(`(max-width: ${dimensionMaxMap[props.breakpoint]})`);\n }\n let collapsed;\n if ('collapsed' in props) {\n collapsed = props.collapsed;\n }\n else {\n collapsed = props.defaultCollapsed;\n }\n this.state = {\n collapsed,\n below: false,\n };\n }\n static getDerivedStateFromProps(nextProps) {\n if ('collapsed' in nextProps) {\n return {\n collapsed: nextProps.collapsed,\n };\n }\n return null;\n }\n componentDidMount() {\n if (this.mql) {\n this.mql.addListener(this.responsiveHandler);\n this.responsiveHandler(this.mql);\n }\n if (this.props.siderHook) {\n this.props.siderHook.addSider(this.uniqueId);\n }\n }\n componentWillUnmount() {\n if (this.mql) {\n this.mql.removeListener(this.responsiveHandler);\n }\n if (this.props.siderHook) {\n this.props.siderHook.removeSider(this.uniqueId);\n }\n }\n render() {\n const { collapsed } = this.state;\n const { collapsedWidth } = this.props;\n return (\n {this.renderSider}\n );\n }\n}\nInternalSider.defaultProps = {\n collapsible: false,\n defaultCollapsed: false,\n reverseArrow: false,\n width: 200,\n collapsedWidth: 80,\n style: {},\n theme: 'dark',\n};\n// eslint-disable-next-line react/prefer-stateless-function\nexport default class Sider extends React.Component {\n render() {\n return (\n {(context) => }\n );\n }\n}\n","var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport { Item } from 'rc-menu';\nimport toArray from 'rc-util/lib/Children/toArray';\nimport classNames from 'classnames';\nimport MenuContext from './MenuContext';\nimport Tooltip from '../tooltip';\nimport { SiderContext } from '../layout/Sider';\nexport default class MenuItem extends React.Component {\n constructor() {\n super(...arguments);\n this.onKeyDown = (e) => {\n this.menuItem.onKeyDown(e);\n };\n this.saveMenuItem = (menuItem) => {\n this.menuItem = menuItem;\n };\n this.renderItem = ({ siderCollapsed }) => {\n const { level, className, children, rootPrefixCls } = this.props;\n const _a = this.props, { title, icon } = _a, rest = __rest(_a, [\"title\", \"icon\"]);\n return (\n {({ inlineCollapsed, direction }) => {\n let tooltipTitle = title;\n if (typeof title === 'undefined') {\n tooltipTitle = level === 1 ? children : '';\n }\n else if (title === false) {\n tooltipTitle = '';\n }\n const tooltipProps = {\n title: tooltipTitle,\n };\n if (!siderCollapsed && !inlineCollapsed) {\n tooltipProps.title = null;\n // Reset `visible` to fix control mode tooltip display not correct\n // ref: https://github.com/ant-design/ant-design/issues/16742\n tooltipProps.visible = false;\n }\n const childrenLength = toArray(children).length;\n return (\n - \n {icon}\n {this.renderItemChildren()}\n
\n );\n }}\n );\n };\n }\n renderItemChildren() {\n const { icon, children } = this.props;\n // inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性,则内部包裹一个 span\n // ref: https://github.com/ant-design/ant-design/pull/23456\n if (!icon || (React.isValidElement(children) && children.type === 'span')) {\n return children;\n }\n return {children};\n }\n render() {\n return {this.renderItem};\n }\n}\nMenuItem.isMenuItem = true;\n","import raf from 'raf';\nlet id = 0;\nconst ids = {};\n// Support call raf with delay specified frame\nexport default function wrapperRaf(callback, delayFrames = 1) {\n const myId = id++;\n let restFrames = delayFrames;\n function internalCallback() {\n restFrames -= 1;\n if (restFrames <= 0) {\n callback();\n delete ids[myId];\n }\n else {\n ids[myId] = raf(internalCallback);\n }\n }\n ids[myId] = raf(internalCallback);\n return myId;\n}\nwrapperRaf.cancel = function cancel(pid) {\n if (pid === undefined)\n return;\n raf.cancel(ids[pid]);\n delete ids[pid];\n};\nwrapperRaf.ids = ids; // export this for test usage\n","// ================== Collapse Motion ==================\nconst getCollapsedHeight = () => ({ height: 0, opacity: 0 });\nconst getRealHeight = node => ({ height: node.scrollHeight, opacity: 1 });\nconst getCurrentHeight = node => ({ height: node.offsetHeight });\nconst collapseMotion = {\n motionName: 'ant-motion-collapse',\n onAppearStart: getCollapsedHeight,\n onEnterStart: getCollapsedHeight,\n onAppearActive: getRealHeight,\n onEnterActive: getRealHeight,\n onLeaveStart: getCurrentHeight,\n onLeaveActive: getCollapsedHeight,\n motionDeadline: 500,\n};\nexport default collapseMotion;\n","import * as React from 'react';\nimport RcMenu, { Divider, ItemGroup } from 'rc-menu';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport SubMenu from './SubMenu';\nimport Item from './MenuItem';\nimport { ConfigConsumer } from '../config-provider';\nimport warning from '../_util/warning';\nimport { SiderContext } from '../layout/Sider';\nimport raf from '../_util/raf';\nimport collapseMotion from '../_util/motion';\nimport MenuContext from './MenuContext';\nexport { MenuItemGroupProps } from 'rc-menu/es/MenuItemGroup';\nclass InternalMenu extends React.Component {\n constructor(props) {\n super(props);\n // Restore vertical mode when menu is collapsed responsively when mounted\n // https://github.com/ant-design/ant-design/issues/13104\n // TODO: not a perfect solution, looking a new way to avoid setting switchingModeFromInline in this situation\n this.handleMouseEnter = (e) => {\n this.restoreModeVerticalFromInline();\n const { onMouseEnter } = this.props;\n if (onMouseEnter) {\n onMouseEnter(e);\n }\n };\n this.handleTransitionEnd = (e) => {\n // when inlineCollapsed menu width animation finished\n // https://github.com/ant-design/ant-design/issues/12864\n const widthCollapsed = e.propertyName === 'width' && e.target === e.currentTarget;\n // Fix SVGElement e.target.className.indexOf is not a function\n // https://github.com/ant-design/ant-design/issues/15699\n const { className } = e.target;\n // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during an animation.\n const classNameValue = Object.prototype.toString.call(className) === '[object SVGAnimatedString]'\n ? className.animVal\n : className;\n // Fix for , the width transition won't trigger when menu is collapsed\n // https://github.com/ant-design/ant-design-pro/issues/2783\n const iconScaled = e.propertyName === 'font-size' && classNameValue.indexOf('anticon') >= 0;\n if (widthCollapsed || iconScaled) {\n this.restoreModeVerticalFromInline();\n }\n };\n this.handleClick = (e) => {\n this.handleOpenChange([]);\n const { onClick } = this.props;\n if (onClick) {\n onClick(e);\n }\n };\n this.handleOpenChange = (openKeys) => {\n this.setOpenKeys(openKeys);\n const { onOpenChange } = this.props;\n if (onOpenChange) {\n onOpenChange(openKeys);\n }\n };\n this.renderMenu = ({ getPopupContainer, getPrefixCls, direction }) => {\n const { prefixCls: customizePrefixCls, className, theme, collapsedWidth } = this.props;\n const { openKeys } = this.state;\n const passProps = omit(this.props, ['collapsedWidth', 'siderCollapsed']);\n const menuMode = this.getRealMenuMode();\n const menuOpenMotion = this.getOpenMotionProps(menuMode);\n const prefixCls = getPrefixCls('menu', customizePrefixCls);\n const menuClassName = classNames(className, `${prefixCls}-${theme}`, {\n [`${prefixCls}-inline-collapsed`]: this.getInlineCollapsed(),\n });\n const menuProps = Object.assign({ openKeys, onOpenChange: this.handleOpenChange, className: menuClassName, mode: menuMode }, menuOpenMotion);\n if (menuMode !== 'inline') {\n // closing vertical popup submenu after click it\n menuProps.onClick = this.handleClick;\n }\n // https://github.com/ant-design/ant-design/issues/8587\n const hideMenu = this.getInlineCollapsed() &&\n (collapsedWidth === 0 || collapsedWidth === '0' || collapsedWidth === '0px');\n if (hideMenu) {\n menuProps.openKeys = [];\n }\n return (\n \n );\n };\n warning(!('inlineCollapsed' in props && props.mode !== 'inline'), 'Menu', '`inlineCollapsed` should only be used when `mode` is inline.');\n warning(!(props.siderCollapsed !== undefined && 'inlineCollapsed' in props), 'Menu', '`inlineCollapsed` not control Menu under Sider. Should set `collapsed` on Sider instead.');\n let openKeys;\n if ('openKeys' in props) {\n openKeys = props.openKeys;\n }\n else if ('defaultOpenKeys' in props) {\n openKeys = props.defaultOpenKeys;\n }\n this.state = {\n openKeys: openKeys || [],\n switchingModeFromInline: false,\n inlineOpenKeys: [],\n prevProps: props,\n };\n }\n static getDerivedStateFromProps(nextProps, prevState) {\n const { prevProps } = prevState;\n const newState = {\n prevProps: nextProps,\n };\n if (prevProps.mode === 'inline' && nextProps.mode !== 'inline') {\n newState.switchingModeFromInline = true;\n }\n if ('openKeys' in nextProps) {\n newState.openKeys = nextProps.openKeys;\n }\n else {\n // [Legacy] Old code will return after `openKeys` changed.\n // Not sure the reason, we should keep this logic still.\n if ((nextProps.inlineCollapsed && !prevProps.inlineCollapsed) ||\n (nextProps.siderCollapsed && !prevProps.siderCollapsed)) {\n newState.switchingModeFromInline = true;\n newState.inlineOpenKeys = prevState.openKeys;\n newState.openKeys = [];\n }\n if ((!nextProps.inlineCollapsed && prevProps.inlineCollapsed) ||\n (!nextProps.siderCollapsed && prevProps.siderCollapsed)) {\n newState.openKeys = prevState.inlineOpenKeys;\n newState.inlineOpenKeys = [];\n }\n }\n return newState;\n }\n componentWillUnmount() {\n raf.cancel(this.mountRafId);\n }\n componentDidUpdate(prevProps) {\n const { siderCollapsed, inlineCollapsed, onOpenChange } = this.props;\n if ((!prevProps.inlineCollapsed && inlineCollapsed) ||\n (!prevProps.siderCollapsed && siderCollapsed)) {\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange([]);\n }\n }\n setOpenKeys(openKeys) {\n if (!('openKeys' in this.props)) {\n this.setState({ openKeys });\n }\n }\n getRealMenuMode() {\n const { mode } = this.props;\n const { switchingModeFromInline } = this.state;\n const inlineCollapsed = this.getInlineCollapsed();\n if (switchingModeFromInline && inlineCollapsed) {\n return 'inline';\n }\n return inlineCollapsed ? 'vertical' : mode;\n }\n getInlineCollapsed() {\n const { inlineCollapsed, siderCollapsed } = this.props;\n if (siderCollapsed !== undefined) {\n return siderCollapsed;\n }\n return inlineCollapsed;\n }\n getOpenMotionProps(menuMode) {\n const { openTransitionName, openAnimation, motion } = this.props;\n const { switchingModeFromInline } = this.state;\n // Provides by user\n if (motion) {\n return { motion };\n }\n if (openAnimation) {\n warning(typeof openAnimation === 'string', 'Menu', '`openAnimation` do not support object. Please use `motion` instead.');\n return { openAnimation };\n }\n if (openTransitionName) {\n return { openTransitionName };\n }\n // Default logic\n if (menuMode === 'horizontal') {\n return { motion: { motionName: 'slide-up' } };\n }\n if (menuMode === 'inline') {\n return { motion: collapseMotion };\n }\n // When mode switch from inline\n // submenu should hide without animation\n return {\n motion: {\n motionName: switchingModeFromInline ? '' : 'zoom-big',\n },\n };\n }\n restoreModeVerticalFromInline() {\n const { switchingModeFromInline } = this.state;\n if (switchingModeFromInline) {\n this.setState({\n switchingModeFromInline: false,\n });\n }\n }\n render() {\n return {this.renderMenu};\n }\n}\nInternalMenu.defaultProps = {\n className: '',\n theme: 'light',\n focusable: false,\n};\n// We should keep this as ref-able\nexport default class Menu extends React.Component {\n render() {\n return (\n {(context) => }\n );\n }\n}\nMenu.Divider = Divider;\nMenu.Item = Item;\nMenu.SubMenu = SubMenu;\nMenu.ItemGroup = ItemGroup;\n","var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport toArray from 'rc-util/lib/Children/toArray';\nimport omit from 'omit.js';\nimport BreadcrumbItem from './BreadcrumbItem';\nimport Menu from '../menu';\nimport { ConfigConsumer } from '../config-provider';\nimport warning from '../_util/warning';\nfunction getBreadcrumbName(route, params) {\n if (!route.breadcrumbName) {\n return null;\n }\n const paramsKeys = Object.keys(params).join('|');\n const name = route.breadcrumbName.replace(new RegExp(`:(${paramsKeys})`, 'g'), (replacement, key) => params[key] || replacement);\n return name;\n}\nfunction defaultItemRender(route, params, routes, paths) {\n const isLastItem = routes.indexOf(route) === routes.length - 1;\n const name = getBreadcrumbName(route, params);\n return isLastItem ? {name} : {name};\n}\nexport default class Breadcrumb extends React.Component {\n constructor() {\n super(...arguments);\n this.getPath = (path, params) => {\n path = (path || '').replace(/^\\//, '');\n Object.keys(params).forEach(key => {\n path = path.replace(`:${key}`, params[key]);\n });\n return path;\n };\n this.addChildPath = (paths, childPath = '', params) => {\n const originalPaths = [...paths];\n const path = this.getPath(childPath, params);\n if (path) {\n originalPaths.push(path);\n }\n return originalPaths;\n };\n this.genForRoutes = ({ routes = [], params = {}, separator, itemRender = defaultItemRender, }) => {\n const paths = [];\n return routes.map(route => {\n const path = this.getPath(route.path, params);\n if (path) {\n paths.push(path);\n }\n // generated overlay by route.children\n let overlay;\n if (route.children && route.children.length) {\n overlay = ();\n }\n return (\n {itemRender(route, params, routes, paths)}\n );\n });\n };\n this.renderBreadcrumb = ({ getPrefixCls, direction }) => {\n let crumbs;\n const _a = this.props, { prefixCls: customizePrefixCls, separator, style, className, routes, children } = _a, restProps = __rest(_a, [\"prefixCls\", \"separator\", \"style\", \"className\", \"routes\", \"children\"]);\n const prefixCls = getPrefixCls('breadcrumb', customizePrefixCls);\n if (routes && routes.length > 0) {\n // generated by route\n crumbs = this.genForRoutes(this.props);\n }\n else if (children) {\n crumbs = toArray(children).map((element, index) => {\n if (!element) {\n return element;\n }\n warning(element.type &&\n (element.type.__ANT_BREADCRUMB_ITEM === true ||\n element.type.__ANT_BREADCRUMB_SEPARATOR === true), 'Breadcrumb', \"Only accepts Breadcrumb.Item and Breadcrumb.Separator as it's children\");\n return React.cloneElement(element, {\n separator,\n key: index,\n });\n });\n }\n const breadcrumbClassName = classNames(className, prefixCls, {\n [`${prefixCls}-rtl`]: direction === 'rtl',\n });\n return (\n {crumbs}\n
);\n };\n }\n render() {\n return {this.renderBreadcrumb};\n }\n}\nBreadcrumb.defaultProps = {\n separator: '/',\n};\n","import * as React from 'react';\nimport { ConfigConsumer } from '../config-provider';\nexport default class BreadcrumbSeparator extends React.Component {\n constructor() {\n super(...arguments);\n this.renderSeparator = ({ getPrefixCls }) => {\n const { children } = this.props;\n const prefixCls = getPrefixCls('breadcrumb');\n return {children || '/'};\n };\n }\n render() {\n return {this.renderSeparator};\n }\n}\nBreadcrumbSeparator.__ANT_BREADCRUMB_SEPARATOR = true;\n","import Breadcrumb from './Breadcrumb';\nimport BreadcrumbItem from './BreadcrumbItem';\nimport BreadcrumbSeparator from './BreadcrumbSeparator';\nexport { BreadcrumbProps } from './Breadcrumb';\nexport { BreadcrumbItemProps } from './BreadcrumbItem';\nBreadcrumb.Item = BreadcrumbItem;\nBreadcrumb.Separator = BreadcrumbSeparator;\nexport default Breadcrumb;\n","export default class UnreachableException {\n constructor(value) {\n return new Error(`unreachable case: ${JSON.stringify(value)}`);\n }\n}\n","var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { ConfigConsumer } from '../config-provider';\nimport UnreachableException from '../_util/unreachableException';\nconst ButtonGroup = props => (\n {({ getPrefixCls, direction }) => {\n const { prefixCls: customizePrefixCls, size, className } = props, others = __rest(props, [\"prefixCls\", \"size\", \"className\"]);\n const prefixCls = getPrefixCls('btn-group', customizePrefixCls);\n // large => lg\n // small => sm\n let sizeCls = '';\n switch (size) {\n case 'large':\n sizeCls = 'lg';\n break;\n case 'small':\n sizeCls = 'sm';\n break;\n case 'middle':\n case undefined:\n break;\n default:\n // eslint-disable-next-line no-console\n console.warn(new UnreachableException(size));\n }\n const classes = classNames(prefixCls, {\n [`${prefixCls}-${sizeCls}`]: sizeCls,\n [`${prefixCls}-rtl`]: direction === 'rtl',\n }, className);\n return ;\n}}\n );\nexport default ButtonGroup;\n","import * as React from 'react';\nimport { findDOMNode } from 'react-dom';\nimport TransitionEvents from '@ant-design/css-animation/lib/Event';\nimport raf from './raf';\nimport { ConfigConsumer } from '../config-provider';\nlet styleForPesudo;\n// Where el is the DOM element you'd like to test for visibility\nfunction isHidden(element) {\n if (process.env.NODE_ENV === 'test') {\n return false;\n }\n return !element || element.offsetParent === null;\n}\nfunction isNotGrey(color) {\n // eslint-disable-next-line no-useless-escape\n const match = (color || '').match(/rgba?\\((\\d*), (\\d*), (\\d*)(, [\\d.]*)?\\)/);\n if (match && match[1] && match[2] && match[3]) {\n return !(match[1] === match[2] && match[2] === match[3]);\n }\n return true;\n}\nexport default class Wave extends React.Component {\n constructor() {\n super(...arguments);\n this.animationStart = false;\n this.destroyed = false;\n this.onClick = (node, waveColor) => {\n if (!node || isHidden(node) || node.className.indexOf('-leave') >= 0) {\n return;\n }\n const { insertExtraNode } = this.props;\n this.extraNode = document.createElement('div');\n const { extraNode } = this;\n extraNode.className = 'ant-click-animating-node';\n const attributeName = this.getAttributeName();\n node.setAttribute(attributeName, 'true');\n // Not white or transparnt or grey\n styleForPesudo = styleForPesudo || document.createElement('style');\n if (waveColor &&\n waveColor !== '#ffffff' &&\n waveColor !== 'rgb(255, 255, 255)' &&\n isNotGrey(waveColor) &&\n !/rgba\\((?:\\d*, ){3}0\\)/.test(waveColor) && // any transparent rgba color\n waveColor !== 'transparent') {\n // Add nonce if CSP exist\n if (this.csp && this.csp.nonce) {\n styleForPesudo.nonce = this.csp.nonce;\n }\n extraNode.style.borderColor = waveColor;\n styleForPesudo.innerHTML = `\n [ant-click-animating-without-extra-node='true']::after, .ant-click-animating-node {\n --antd-wave-shadow-color: ${waveColor};\n }`;\n if (!document.body.contains(styleForPesudo)) {\n document.body.appendChild(styleForPesudo);\n }\n }\n if (insertExtraNode) {\n node.appendChild(extraNode);\n }\n TransitionEvents.addStartEventListener(node, this.onTransitionStart);\n TransitionEvents.addEndEventListener(node, this.onTransitionEnd);\n };\n this.onTransitionStart = (e) => {\n if (this.destroyed) {\n return;\n }\n const node = findDOMNode(this);\n if (!e || e.target !== node || this.animationStart) {\n return;\n }\n this.resetEffect(node);\n };\n this.onTransitionEnd = (e) => {\n if (!e || e.animationName !== 'fadeEffect') {\n return;\n }\n this.resetEffect(e.target);\n };\n this.bindAnimationEvent = (node) => {\n if (!node ||\n !node.getAttribute ||\n node.getAttribute('disabled') ||\n node.className.indexOf('disabled') >= 0) {\n return;\n }\n const onClick = (e) => {\n // Fix radio button click twice\n if (e.target.tagName === 'INPUT' || isHidden(e.target)) {\n return;\n }\n this.resetEffect(node);\n // Get wave color from target\n const waveColor = getComputedStyle(node).getPropertyValue('border-top-color') || // Firefox Compatible\n getComputedStyle(node).getPropertyValue('border-color') ||\n getComputedStyle(node).getPropertyValue('background-color');\n this.clickWaveTimeoutId = window.setTimeout(() => this.onClick(node, waveColor), 0);\n raf.cancel(this.animationStartId);\n this.animationStart = true;\n // Render to trigger transition event cost 3 frames. Let's delay 10 frames to reset this.\n this.animationStartId = raf(() => {\n this.animationStart = false;\n }, 10);\n };\n node.addEventListener('click', onClick, true);\n return {\n cancel: () => {\n node.removeEventListener('click', onClick, true);\n },\n };\n };\n this.renderWave = ({ csp }) => {\n const { children } = this.props;\n this.csp = csp;\n return children;\n };\n }\n componentDidMount() {\n const node = findDOMNode(this);\n if (!node || node.nodeType !== 1) {\n return;\n }\n this.instance = this.bindAnimationEvent(node);\n }\n componentWillUnmount() {\n if (this.instance) {\n this.instance.cancel();\n }\n if (this.clickWaveTimeoutId) {\n clearTimeout(this.clickWaveTimeoutId);\n }\n this.destroyed = true;\n }\n getAttributeName() {\n const { insertExtraNode } = this.props;\n return insertExtraNode ? 'ant-click-animating' : 'ant-click-animating-without-extra-node';\n }\n resetEffect(node) {\n if (!node || node === this.extraNode || !(node instanceof Element)) {\n return;\n }\n const { insertExtraNode } = this.props;\n const attributeName = this.getAttributeName();\n node.setAttribute(attributeName, 'false'); // edge has bug on `removeAttribute` #14466\n if (styleForPesudo) {\n styleForPesudo.innerHTML = '';\n }\n if (insertExtraNode && this.extraNode && node.contains(this.extraNode)) {\n node.removeChild(this.extraNode);\n }\n TransitionEvents.removeStartEventListener(node, this.onTransitionStart);\n TransitionEvents.removeEndEventListener(node, this.onTransitionEnd);\n }\n render() {\n return
{this.renderWave};\n }\n}\n","import * as React from 'react';\nimport classNames from 'classnames';\nimport CSSMotion from 'rc-animate/lib/CSSMotion';\nimport LoadingOutlined from '@ant-design/icons/LoadingOutlined';\nconst getCollapsedWidth = () => ({ width: 0, opacity: 0, transform: 'scale(0)' });\nconst getRealWidth = (node) => ({\n width: node.scrollWidth,\n opacity: 1,\n transform: 'scale(1)',\n});\nexport default function LoadingIcon({ prefixCls, loading, existIcon }) {\n const visible = !!loading;\n if (existIcon) {\n return (
\n \n );\n }\n return (
\n {({ className, style }, ref) => {\n return (\n \n );\n }}\n );\n}\n","var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n/* eslint-disable react/button-has-type */\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport Group from './button-group';\nimport { ConfigContext } from '../config-provider';\nimport Wave from '../_util/wave';\nimport { tuple } from '../_util/type';\nimport warning from '../_util/warning';\nimport SizeContext from '../config-provider/SizeContext';\nimport LoadingIcon from './LoadingIcon';\nconst rxTwoCNChar = /^[\\u4e00-\\u9fa5]{2}$/;\nconst isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);\nfunction isString(str) {\n return typeof str === 'string';\n}\n// Insert one space between two chinese characters automatically.\nfunction insertSpace(child, needInserted) {\n // Check the child if is undefined or null.\n if (child == null) {\n return;\n }\n const SPACE = needInserted ? ' ' : '';\n // strictNullChecks oops.\n if (typeof child !== 'string' &&\n typeof child !== 'number' &&\n isString(child.type) &&\n isTwoCNChar(child.props.children)) {\n return React.cloneElement(child, {}, child.props.children.split('').join(SPACE));\n }\n if (typeof child === 'string') {\n if (isTwoCNChar(child)) {\n child = child.split('').join(SPACE);\n }\n return
{child};\n }\n return child;\n}\nfunction spaceChildren(children, needInserted) {\n let isPrevChildPure = false;\n const childList = [];\n React.Children.forEach(children, child => {\n const type = typeof child;\n const isCurrentChildPure = type === 'string' || type === 'number';\n if (isPrevChildPure && isCurrentChildPure) {\n const lastIndex = childList.length - 1;\n const lastChild = childList[lastIndex];\n childList[lastIndex] = `${lastChild}${child}`;\n }\n else {\n childList.push(child);\n }\n isPrevChildPure = isCurrentChildPure;\n });\n // Pass to React.Children.map to auto fill key\n return React.Children.map(childList, child => insertSpace(child, needInserted));\n}\nconst ButtonTypes = tuple('default', 'primary', 'ghost', 'dashed', 'link');\nconst ButtonShapes = tuple('circle', 'circle-outline', 'round');\nconst ButtonHTMLTypes = tuple('submit', 'button', 'reset');\nexport function convertLegacyProps(type) {\n if (type === 'danger') {\n return { danger: true };\n }\n return { type };\n}\nconst InternalButton = (props, ref) => {\n const size = React.useContext(SizeContext);\n const [loading, setLoading] = React.useState(props.loading);\n const [hasTwoCNChar, setHasTwoCNChar] = React.useState(false);\n const { getPrefixCls, autoInsertSpaceInButton, direction } = React.useContext(ConfigContext);\n const buttonRef = ref || React.createRef();\n let delayTimeout;\n const isNeedInserted = () => {\n const { icon, children, type } = props;\n return React.Children.count(children) === 1 && !icon && type !== 'link';\n };\n const fixTwoCNChar = () => {\n // Fix for HOC usage like
\n if (!buttonRef || !buttonRef.current || autoInsertSpaceInButton === false) {\n return;\n }\n const buttonText = buttonRef.current.textContent;\n if (isNeedInserted() && isTwoCNChar(buttonText)) {\n if (!hasTwoCNChar) {\n setHasTwoCNChar(true);\n }\n }\n else if (hasTwoCNChar) {\n setHasTwoCNChar(false);\n }\n };\n React.useEffect(() => {\n if (props.loading && typeof props.loading !== 'boolean') {\n clearTimeout(delayTimeout);\n }\n if (props.loading && typeof props.loading !== 'boolean' && props.loading.delay) {\n delayTimeout = window.setTimeout(() => {\n setLoading(props.loading);\n }, props.loading.delay);\n }\n else if (props.loading !== loading) {\n setLoading(props.loading);\n }\n }, [props.loading]);\n React.useEffect(() => {\n fixTwoCNChar();\n }, [buttonRef]);\n const handleClick = (e) => {\n const { onClick } = props;\n if (loading) {\n return;\n }\n if (onClick) {\n onClick(e);\n }\n };\n const { prefixCls: customizePrefixCls, type, danger, shape, size: customizeSize, className, children, icon, ghost, block } = props, rest = __rest(props, [\"prefixCls\", \"type\", \"danger\", \"shape\", \"size\", \"className\", \"children\", \"icon\", \"ghost\", \"block\"]);\n warning(!(typeof icon === 'string' && icon.length > 2), 'Button', `\\`icon\\` is using ReactNode instead of string naming in v4. Please check \\`${icon}\\` at https://ant.design/components/icon`);\n const prefixCls = getPrefixCls('btn', customizePrefixCls);\n const autoInsertSpace = autoInsertSpaceInButton !== false;\n // large => lg\n // small => sm\n let sizeCls = '';\n switch (customizeSize || size) {\n case 'large':\n sizeCls = 'lg';\n break;\n case 'small':\n sizeCls = 'sm';\n break;\n default:\n break;\n }\n const iconType = loading ? 'loading' : icon;\n const classes = classNames(prefixCls, className, {\n [`${prefixCls}-${type}`]: type,\n [`${prefixCls}-${shape}`]: shape,\n [`${prefixCls}-${sizeCls}`]: sizeCls,\n [`${prefixCls}-icon-only`]: !children && children !== 0 && iconType,\n [`${prefixCls}-background-ghost`]: ghost,\n [`${prefixCls}-loading`]: loading,\n [`${prefixCls}-two-chinese-chars`]: hasTwoCNChar && autoInsertSpace,\n [`${prefixCls}-block`]: block,\n [`${prefixCls}-dangerous`]: !!danger,\n [`${prefixCls}-rtl`]: direction === 'rtl',\n });\n const iconNode = icon && !loading ? (icon) : (
);\n const kids = children || children === 0\n ? spaceChildren(children, isNeedInserted() && autoInsertSpace)\n : null;\n const linkButtonRestProps = omit(rest, ['htmlType', 'loading']);\n if (linkButtonRestProps.href !== undefined) {\n return (\n {iconNode}\n {kids}\n );\n }\n // React does not recognize the `htmlType` prop on a DOM element. Here we pick it out of `rest`.\n const _a = rest, { htmlType } = _a, otherProps = __rest(_a, [\"htmlType\"]);\n const buttonNode = ();\n if (type === 'link') {\n return buttonNode;\n }\n return {buttonNode};\n};\nconst Button = React.forwardRef(InternalButton);\nButton.displayName = 'Button';\nButton.defaultProps = {\n loading: false,\n ghost: false,\n block: false,\n htmlType: 'button',\n};\nButton.Group = Group;\nButton.__ANT_BUTTON = true;\nexport default Button;\n","import Button from './button';\nexport { ButtonProps, ButtonShape, ButtonType } from './button';\nexport { ButtonGroupProps } from './button-group';\nexport { SizeType as ButtonSize } from '../config-provider/SizeContext';\nexport default Button;\n","import moment from 'moment';\nimport { noteOnce } from \"rc-util/es/warning\";\nvar generateConfig = {\n // get\n getNow: function getNow() {\n return moment();\n },\n getWeekDay: function getWeekDay(date) {\n var clone = date.clone().locale('en_US');\n return clone.weekday() + clone.localeData().firstDayOfWeek();\n },\n getYear: function getYear(date) {\n return date.year();\n },\n getMonth: function getMonth(date) {\n return date.month();\n },\n getDate: function getDate(date) {\n return date.date();\n },\n getHour: function getHour(date) {\n return date.hour();\n },\n getMinute: function getMinute(date) {\n return date.minute();\n },\n getSecond: function getSecond(date) {\n return date.second();\n },\n // set\n addYear: function addYear(date, diff) {\n var clone = date.clone();\n return clone.add(diff, 'year');\n },\n addMonth: function addMonth(date, diff) {\n var clone = date.clone();\n return clone.add(diff, 'month');\n },\n addDate: function addDate(date, diff) {\n var clone = date.clone();\n return clone.add(diff, 'day');\n },\n setYear: function setYear(date, year) {\n var clone = date.clone();\n return clone.year(year);\n },\n setMonth: function setMonth(date, month) {\n var clone = date.clone();\n return clone.month(month);\n },\n setDate: function setDate(date, num) {\n var clone = date.clone();\n return clone.date(num);\n },\n setHour: function setHour(date, hour) {\n var clone = date.clone();\n return clone.hour(hour);\n },\n setMinute: function setMinute(date, minute) {\n var clone = date.clone();\n return clone.minute(minute);\n },\n setSecond: function setSecond(date, second) {\n var clone = date.clone();\n return clone.second(second);\n },\n // Compare\n isAfter: function isAfter(date1, date2) {\n return date1.isAfter(date2);\n },\n isValidate: function isValidate(date) {\n return date.isValid();\n },\n locale: {\n getWeekFirstDay: function getWeekFirstDay(locale) {\n var date = moment().locale(locale);\n return date.localeData().firstDayOfWeek();\n },\n getWeek: function getWeek(locale, date) {\n var clone = date.clone();\n var result = clone.locale(locale);\n return result.week();\n },\n getShortWeekDays: function getShortWeekDays(locale) {\n var date = moment().locale(locale);\n return date.localeData().weekdaysMin();\n },\n getShortMonths: function getShortMonths(locale) {\n var date = moment().locale(locale);\n return date.localeData().monthsShort();\n },\n format: function format(locale, date, _format) {\n var clone = date.clone();\n var result = clone.locale(locale);\n return result.format(_format);\n },\n parse: function parse(locale, text, formats) {\n var fallbackFormatList = [];\n\n for (var i = 0; i < formats.length; i += 1) {\n var format = formats[i];\n var formatText = text;\n\n if (format.includes('wo') || format.includes('Wo')) {\n format = format.replace(/wo/g, 'w').replace(/Wo/g, 'W');\n var matchFormat = format.match(/[-YyMmDdHhSsWwGg]+/g);\n var matchText = formatText.match(/[-\\d]+/g);\n\n if (matchFormat && matchText) {\n format = matchFormat.join('');\n formatText = matchText.join('');\n } else {\n fallbackFormatList.push(format.replace(/o/g, ''));\n }\n }\n\n var date = moment(formatText, format, locale, true);\n\n if (date.isValid()) {\n return date;\n }\n } // Fallback to fuzzy matching, this should always not reach match or need fire a issue\n\n\n for (var _i = 0; _i < fallbackFormatList.length; _i += 1) {\n var _date = moment(text, fallbackFormatList[_i], locale, false);\n /* istanbul ignore next */\n\n\n if (_date.isValid()) {\n noteOnce(false, 'Not match any format strictly and fallback to fuzzy match. Please help to fire a issue about this.');\n return _date;\n }\n }\n\n return null;\n }\n }\n};\nexport default generateConfig;","import * as React from 'react';\nvar PanelContext = React.createContext({});\nexport default PanelContext;","import * as React from 'react';\nimport PanelContext from '../PanelContext';\nvar HIDDEN_STYLE = {\n visibility: 'hidden'\n};\n\nfunction Header(_ref) {\n var prefixCls = _ref.prefixCls,\n _ref$prevIcon = _ref.prevIcon,\n prevIcon = _ref$prevIcon === void 0 ? \"\\u2039\" : _ref$prevIcon,\n _ref$nextIcon = _ref.nextIcon,\n nextIcon = _ref$nextIcon === void 0 ? \"\\u203A\" : _ref$nextIcon,\n _ref$superPrevIcon = _ref.superPrevIcon,\n superPrevIcon = _ref$superPrevIcon === void 0 ? \"\\xAB\" : _ref$superPrevIcon,\n _ref$superNextIcon = _ref.superNextIcon,\n superNextIcon = _ref$superNextIcon === void 0 ? \"\\xBB\" : _ref$superNextIcon,\n onSuperPrev = _ref.onSuperPrev,\n onSuperNext = _ref.onSuperNext,\n onPrev = _ref.onPrev,\n onNext = _ref.onNext,\n children = _ref.children;\n\n var _React$useContext = React.useContext(PanelContext),\n hideNextBtn = _React$useContext.hideNextBtn,\n hidePrevBtn = _React$useContext.hidePrevBtn;\n\n return React.createElement(\"div\", {\n className: prefixCls\n }, onSuperPrev && React.createElement(\"button\", {\n type: \"button\",\n onClick: onSuperPrev,\n tabIndex: -1,\n className: \"\".concat(prefixCls, \"-super-prev-btn\"),\n style: hidePrevBtn ? HIDDEN_STYLE : {}\n }, superPrevIcon), onPrev && React.createElement(\"button\", {\n type: \"button\",\n onClick: onPrev,\n tabIndex: -1,\n className: \"\".concat(prefixCls, \"-prev-btn\"),\n style: hidePrevBtn ? HIDDEN_STYLE : {}\n }, prevIcon), React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-view\")\n }, children), onNext && React.createElement(\"button\", {\n type: \"button\",\n onClick: onNext,\n tabIndex: -1,\n className: \"\".concat(prefixCls, \"-next-btn\"),\n style: hideNextBtn ? HIDDEN_STYLE : {}\n }, nextIcon), onSuperNext && React.createElement(\"button\", {\n type: \"button\",\n onClick: onSuperNext,\n tabIndex: -1,\n className: \"\".concat(prefixCls, \"-super-next-btn\"),\n style: hideNextBtn ? HIDDEN_STYLE : {}\n }, superNextIcon));\n}\n\nexport default Header;","import * as React from 'react';\nimport Header from '../Header';\nimport PanelContext from '../../PanelContext';\n\nfunction TimeHeader(props) {\n var _React$useContext = React.useContext(PanelContext),\n hideHeader = _React$useContext.hideHeader;\n\n if (hideHeader) {\n return null;\n }\n\n var prefixCls = props.prefixCls,\n generateConfig = props.generateConfig,\n locale = props.locale,\n value = props.value,\n format = props.format;\n var headerPrefixCls = \"\".concat(prefixCls, \"-header\");\n return React.createElement(Header, {\n prefixCls: headerPrefixCls\n }, value ? generateConfig.locale.format(locale.locale, value, format) : \"\\xA0\");\n}\n\nexport default TimeHeader;","function _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 _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(n); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\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\nimport KeyCode from \"rc-util/es/KeyCode\";\nvar scrollIds = new Map();\n/* eslint-disable no-param-reassign */\n\nexport function scrollTo(element, to, duration) {\n if (scrollIds.get(element)) {\n cancelAnimationFrame(scrollIds.get(element));\n } // jump to target if duration zero\n\n\n if (duration <= 0) {\n scrollIds.set(element, requestAnimationFrame(function () {\n element.scrollTop = to;\n }));\n return;\n }\n\n var difference = to - element.scrollTop;\n var perTick = difference / duration * 10;\n scrollIds.set(element, requestAnimationFrame(function () {\n element.scrollTop += perTick;\n\n if (element.scrollTop !== to) {\n scrollTo(element, to, duration - 10);\n }\n }));\n}\nexport function createKeyDownHandler(event, _ref) {\n var onLeftRight = _ref.onLeftRight,\n onCtrlLeftRight = _ref.onCtrlLeftRight,\n onUpDown = _ref.onUpDown,\n onPageUpDown = _ref.onPageUpDown,\n onEnter = _ref.onEnter;\n var which = event.which,\n ctrlKey = event.ctrlKey,\n metaKey = event.metaKey;\n\n switch (which) {\n case KeyCode.LEFT:\n if (ctrlKey || metaKey) {\n if (onCtrlLeftRight) {\n onCtrlLeftRight(-1);\n return true;\n }\n } else if (onLeftRight) {\n onLeftRight(-1);\n return true;\n }\n /* istanbul ignore next */\n\n\n break;\n\n case KeyCode.RIGHT:\n if (ctrlKey || metaKey) {\n if (onCtrlLeftRight) {\n onCtrlLeftRight(1);\n return true;\n }\n } else if (onLeftRight) {\n onLeftRight(1);\n return true;\n }\n /* istanbul ignore next */\n\n\n break;\n\n case KeyCode.UP:\n if (onUpDown) {\n onUpDown(-1);\n return true;\n }\n /* istanbul ignore next */\n\n\n break;\n\n case KeyCode.DOWN:\n if (onUpDown) {\n onUpDown(1);\n return true;\n }\n /* istanbul ignore next */\n\n\n break;\n\n case KeyCode.PAGE_UP:\n if (onPageUpDown) {\n onPageUpDown(-1);\n return true;\n }\n /* istanbul ignore next */\n\n\n break;\n\n case KeyCode.PAGE_DOWN:\n if (onPageUpDown) {\n onPageUpDown(1);\n return true;\n }\n /* istanbul ignore next */\n\n\n break;\n\n case KeyCode.ENTER:\n if (onEnter) {\n onEnter();\n return true;\n }\n /* istanbul ignore next */\n\n\n break;\n }\n\n return false;\n} // ===================== Format =====================\n\nexport function getDefaultFormat(format, picker, showTime, use12Hours) {\n var mergedFormat = format;\n\n if (!mergedFormat) {\n switch (picker) {\n case 'time':\n mergedFormat = use12Hours ? 'hh:mm:ss a' : 'HH:mm:ss';\n break;\n\n case 'week':\n mergedFormat = 'gggg-wo';\n break;\n\n case 'month':\n mergedFormat = 'YYYY-MM';\n break;\n\n case 'quarter':\n mergedFormat = 'YYYY-[Q]Q';\n break;\n\n case 'year':\n mergedFormat = 'YYYY';\n break;\n\n default:\n mergedFormat = showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';\n }\n }\n\n return mergedFormat;\n}\nexport function getInputSize(picker, format) {\n var defaultSize = picker === 'time' ? 8 : 10;\n return Math.max(defaultSize, format.length) + 2;\n}\nvar globalClickFunc = null;\nvar clickCallbacks = new Set();\nexport function addGlobalMouseDownEvent(callback) {\n if (!globalClickFunc && typeof window !== 'undefined' && window.addEventListener) {\n globalClickFunc = function globalClickFunc(e) {\n // Clone a new list to avoid repeat trigger events\n _toConsumableArray(clickCallbacks).forEach(function (queueFunc) {\n queueFunc(e);\n });\n };\n\n window.addEventListener('mousedown', globalClickFunc);\n }\n\n clickCallbacks.add(callback);\n return function () {\n clickCallbacks.delete(callback);\n\n if (clickCallbacks.size === 0) {\n window.removeEventListener('mousedown', globalClickFunc);\n globalClickFunc = null;\n }\n };\n} // ====================== Mode ======================\n\nvar getYearNextMode = function getYearNextMode(next) {\n if (next === 'month' || next === 'date') {\n return 'year';\n }\n\n return next;\n};\n\nvar getMonthNextMode = function getMonthNextMode(next) {\n if (next === 'date') {\n return 'month';\n }\n\n return next;\n};\n\nvar getQuarterNextMode = function getQuarterNextMode(next) {\n if (next === 'month' || next === 'date') {\n return 'quarter';\n }\n\n return next;\n};\n\nvar getWeekNextMode = function getWeekNextMode(next) {\n if (next === 'date') {\n return 'week';\n }\n\n return next;\n};\n\nexport var PickerModeMap = {\n year: getYearNextMode,\n month: getMonthNextMode,\n quarter: getQuarterNextMode,\n week: getWeekNextMode,\n time: null,\n date: null\n};\nexport function elementsContains(elements, target) {\n return elements.some(function (ele) {\n return ele && ele.contains(target);\n });\n}","function _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\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { scrollTo } from '../../utils/uiUtil';\nimport PanelContext from '../../PanelContext';\n\nfunction TimeUnitColumn(props) {\n var prefixCls = props.prefixCls,\n units = props.units,\n onSelect = props.onSelect,\n value = props.value,\n active = props.active,\n hideDisabledOptions = props.hideDisabledOptions;\n var cellPrefixCls = \"\".concat(prefixCls, \"-cell\");\n\n var _React$useContext = React.useContext(PanelContext),\n open = _React$useContext.open;\n\n var ulRef = React.useRef(null);\n var liRefs = React.useRef(new Map()); // `useLayoutEffect` here to avoid blink by duration is 0\n\n React.useLayoutEffect(function () {\n var li = liRefs.current.get(value);\n\n if (li && open !== false) {\n scrollTo(ulRef.current, li.offsetTop, 120);\n }\n }, [value]);\n React.useLayoutEffect(function () {\n if (open) {\n var li = liRefs.current.get(value);\n\n if (li) {\n scrollTo(ulRef.current, li.offsetTop, 0);\n }\n }\n }, [open]);\n return React.createElement(\"ul\", {\n className: classNames(\"\".concat(prefixCls, \"-column\"), _defineProperty({}, \"\".concat(prefixCls, \"-column-active\"), active)),\n ref: ulRef,\n style: {\n position: 'relative'\n }\n }, units.map(function (unit) {\n var _classNames2;\n\n if (hideDisabledOptions && unit.disabled) {\n return null;\n }\n\n return React.createElement(\"li\", {\n key: unit.value,\n ref: function ref(element) {\n liRefs.current.set(unit.value, element);\n },\n className: classNames(cellPrefixCls, (_classNames2 = {}, _defineProperty(_classNames2, \"\".concat(cellPrefixCls, \"-disabled\"), unit.disabled), _defineProperty(_classNames2, \"\".concat(cellPrefixCls, \"-selected\"), value === unit.value), _classNames2)),\n onClick: function onClick() {\n if (unit.disabled) {\n return;\n }\n\n onSelect(unit.value);\n }\n }, React.createElement(\"div\", {\n className: \"\".concat(cellPrefixCls, \"-inner\")\n }, unit.label));\n }));\n}\n\nexport default TimeUnitColumn;","export function leftPad(str, length) {\n var fill = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '0';\n var current = String(str);\n\n while (current.length < length) {\n current = \"\".concat(fill).concat(str);\n }\n\n return current;\n}\nexport var tuple = function tuple() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return args;\n};\nexport function toArray(val) {\n if (val === null || val === undefined) {\n return [];\n }\n\n return Array.isArray(val) ? val : [val];\n}\nexport default function getDataOrAriaProps(props) {\n var retProps = {};\n Object.keys(props).forEach(function (key) {\n if ((key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role' || key === 'name') && key.substr(0, 7) !== 'data-__') {\n retProps[key] = props[key];\n }\n });\n return retProps;\n}\nexport function getValue(values, index) {\n return values ? values[index] : null;\n}\nexport function updateValues(values, value, index) {\n var newValues = [getValue(values, 0), getValue(values, 1)];\n newValues[index] = typeof value === 'function' ? value(newValues[index]) : value;\n\n if (!newValues[0] && !newValues[1]) {\n return null;\n }\n\n return newValues;\n}","import * as React from 'react';\nimport TimeUnitColumn from './TimeUnitColumn';\nimport { leftPad } from '../../utils/miscUtil';\n\nfunction generateUnits(start, end, step, disabledUnits) {\n var units = [];\n\n for (var i = start; i <= end; i += step) {\n units.push({\n label: leftPad(i, 2),\n value: i,\n disabled: (disabledUnits || []).includes(i)\n });\n }\n\n return units;\n}\n\nfunction TimeBody(props) {\n var generateConfig = props.generateConfig,\n prefixCls = props.prefixCls,\n operationRef = props.operationRef,\n activeColumnIndex = props.activeColumnIndex,\n value = props.value,\n showHour = props.showHour,\n showMinute = props.showMinute,\n showSecond = props.showSecond,\n use12Hours = props.use12Hours,\n _props$hourStep = props.hourStep,\n hourStep = _props$hourStep === void 0 ? 1 : _props$hourStep,\n _props$minuteStep = props.minuteStep,\n minuteStep = _props$minuteStep === void 0 ? 1 : _props$minuteStep,\n _props$secondStep = props.secondStep,\n secondStep = _props$secondStep === void 0 ? 1 : _props$secondStep,\n disabledHours = props.disabledHours,\n disabledMinutes = props.disabledMinutes,\n disabledSeconds = props.disabledSeconds,\n hideDisabledOptions = props.hideDisabledOptions,\n onSelect = props.onSelect;\n var columns = [];\n var contentPrefixCls = \"\".concat(prefixCls, \"-content\");\n var columnPrefixCls = \"\".concat(prefixCls, \"-time-panel\");\n var isPM;\n var hour = value ? generateConfig.getHour(value) : -1;\n var minute = value ? generateConfig.getMinute(value) : -1;\n var second = value ? generateConfig.getSecond(value) : -1;\n\n var setTime = function setTime(isNewPM, newHour, newMinute, newSecond) {\n var newDate = value || generateConfig.getNow();\n var mergedHour = Math.max(0, newHour);\n var mergedMinute = Math.max(0, newMinute);\n var mergedSecond = Math.max(0, newSecond);\n newDate = generateConfig.setSecond(newDate, mergedSecond);\n newDate = generateConfig.setMinute(newDate, mergedMinute);\n newDate = generateConfig.setHour(newDate, !use12Hours || !isNewPM ? mergedHour : mergedHour + 12);\n return newDate;\n }; // ========================= Unit =========================\n\n\n var hours = generateUnits(0, use12Hours ? 11 : 23, hourStep, disabledHours && disabledHours()); // Should additional logic to handle 12 hours\n\n if (use12Hours && hour !== -1) {\n isPM = hour >= 12;\n hour %= 12;\n hours[0].label = '12';\n }\n\n var minutes = generateUnits(0, 59, minuteStep, disabledMinutes && disabledMinutes(hour));\n var seconds = generateUnits(0, 59, secondStep, disabledSeconds && disabledSeconds(hour, minute)); // ====================== Operations ======================\n\n operationRef.current = {\n onUpDown: function onUpDown(diff) {\n var column = columns[activeColumnIndex];\n\n if (column) {\n var valueIndex = column.units.findIndex(function (unit) {\n return unit.value === column.value;\n });\n var unitLen = column.units.length;\n\n for (var i = 1; i < unitLen; i += 1) {\n var nextUnit = column.units[(valueIndex + diff * i + unitLen) % unitLen];\n\n if (nextUnit.disabled !== true) {\n column.onSelect(nextUnit.value);\n break;\n }\n }\n }\n }\n }; // ======================== Render ========================\n\n function addColumnNode(condition, node, columnValue, units, onColumnSelect) {\n if (condition !== false) {\n columns.push({\n node: React.cloneElement(node, {\n prefixCls: columnPrefixCls,\n value: columnValue,\n active: activeColumnIndex === columns.length,\n onSelect: onColumnSelect,\n units: units,\n hideDisabledOptions: hideDisabledOptions\n }),\n onSelect: onColumnSelect,\n value: columnValue,\n units: units\n });\n }\n } // Hour\n\n\n addColumnNode(showHour, React.createElement(TimeUnitColumn, {\n key: \"hour\"\n }), hour, hours, function (num) {\n onSelect(setTime(isPM, num, minute, second), 'mouse');\n }); // Minute\n\n addColumnNode(showMinute, React.createElement(TimeUnitColumn, {\n key: \"minute\"\n }), minute, minutes, function (num) {\n onSelect(setTime(isPM, hour, num, second), 'mouse');\n }); // Second\n\n addColumnNode(showSecond, React.createElement(TimeUnitColumn, {\n key: \"second\"\n }), second, seconds, function (num) {\n onSelect(setTime(isPM, hour, minute, num), 'mouse');\n }); // 12 Hours\n\n var PMIndex = -1;\n\n if (typeof isPM === 'boolean') {\n PMIndex = isPM ? 1 : 0;\n }\n\n addColumnNode(use12Hours === true, React.createElement(TimeUnitColumn, {\n key: \"12hours\"\n }), PMIndex, [{\n label: 'AM',\n value: 0\n }, {\n label: 'PM',\n value: 1\n }], function (num) {\n onSelect(setTime(!!num, hour, minute, second), 'mouse');\n });\n return React.createElement(\"div\", {\n className: contentPrefixCls\n }, columns.map(function (_ref) {\n var node = _ref.node;\n return node;\n }));\n}\n\nexport default TimeBody;","function _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(n); 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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport TimeHeader from './TimeHeader';\nimport TimeBody from './TimeBody';\nimport { createKeyDownHandler } from '../../utils/uiUtil';\n\nvar countBoolean = function countBoolean(boolList) {\n return boolList.filter(function (bool) {\n return bool !== false;\n }).length;\n};\n\nfunction TimePanel(props) {\n var generateConfig = props.generateConfig,\n _props$format = props.format,\n format = _props$format === void 0 ? 'HH:mm:ss' : _props$format,\n prefixCls = props.prefixCls,\n active = props.active,\n operationRef = props.operationRef,\n showHour = props.showHour,\n showMinute = props.showMinute,\n showSecond = props.showSecond,\n _props$use12Hours = props.use12Hours,\n use12Hours = _props$use12Hours === void 0 ? false : _props$use12Hours,\n onSelect = props.onSelect,\n value = props.value;\n var panelPrefixCls = \"\".concat(prefixCls, \"-time-panel\");\n var bodyOperationRef = React.useRef(); // ======================= Keyboard =======================\n\n var _React$useState = React.useState(-1),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n activeColumnIndex = _React$useState2[0],\n setActiveColumnIndex = _React$useState2[1];\n\n var columnsCount = countBoolean([showHour, showMinute, showSecond, use12Hours]);\n operationRef.current = {\n onKeyDown: function onKeyDown(event) {\n return createKeyDownHandler(event, {\n onLeftRight: function onLeftRight(diff) {\n setActiveColumnIndex((activeColumnIndex + diff + columnsCount) % columnsCount);\n },\n onUpDown: function onUpDown(diff) {\n if (activeColumnIndex === -1) {\n setActiveColumnIndex(0);\n } else if (bodyOperationRef.current) {\n bodyOperationRef.current.onUpDown(diff);\n }\n },\n onEnter: function onEnter() {\n onSelect(value || generateConfig.getNow(), 'key');\n setActiveColumnIndex(-1);\n }\n });\n },\n onBlur: function onBlur() {\n setActiveColumnIndex(-1);\n }\n };\n return React.createElement(\"div\", {\n className: classNames(panelPrefixCls, _defineProperty({}, \"\".concat(panelPrefixCls, \"-active\"), active))\n }, React.createElement(TimeHeader, Object.assign({}, props, {\n format: format,\n prefixCls: prefixCls\n })), React.createElement(TimeBody, Object.assign({}, props, {\n prefixCls: prefixCls,\n activeColumnIndex: activeColumnIndex,\n operationRef: bodyOperationRef\n })));\n}\n\nexport default TimePanel;","export var WEEK_DAY_COUNT = 7;\nexport function isNullEqual(value1, value2) {\n if (!value1 && !value2) {\n return true;\n }\n\n if (!value1 || !value2) {\n return false;\n }\n\n return undefined;\n}\nexport function isSameDecade(generateConfig, decade1, decade2) {\n var equal = isNullEqual(decade1, decade2);\n\n if (typeof equal === 'boolean') {\n return equal;\n }\n\n var num1 = Math.floor(generateConfig.getYear(decade1) / 10);\n var num2 = Math.floor(generateConfig.getYear(decade2) / 10);\n return num1 === num2;\n}\nexport function isSameYear(generateConfig, year1, year2) {\n var equal = isNullEqual(year1, year2);\n\n if (typeof equal === 'boolean') {\n return equal;\n }\n\n return generateConfig.getYear(year1) === generateConfig.getYear(year2);\n}\nexport function getQuarter(generateConfig, date) {\n var quota = Math.floor(generateConfig.getMonth(date) / 3);\n return quota + 1;\n}\nexport function isSameQuarter(generateConfig, quarter1, quarter2) {\n var equal = isNullEqual(quarter1, quarter2);\n\n if (typeof equal === 'boolean') {\n return equal;\n }\n\n return isSameYear(generateConfig, quarter1, quarter2) && getQuarter(generateConfig, quarter1) === getQuarter(generateConfig, quarter2);\n}\nexport function isSameMonth(generateConfig, month1, month2) {\n var equal = isNullEqual(month1, month2);\n\n if (typeof equal === 'boolean') {\n return equal;\n }\n\n return isSameYear(generateConfig, month1, month2) && generateConfig.getMonth(month1) === generateConfig.getMonth(month2);\n}\nexport function isSameDate(generateConfig, date1, date2) {\n var equal = isNullEqual(date1, date2);\n\n if (typeof equal === 'boolean') {\n return equal;\n }\n\n return generateConfig.getYear(date1) === generateConfig.getYear(date2) && generateConfig.getMonth(date1) === generateConfig.getMonth(date2) && generateConfig.getDate(date1) === generateConfig.getDate(date2);\n}\nexport function isSameTime(generateConfig, time1, time2) {\n var equal = isNullEqual(time1, time2);\n\n if (typeof equal === 'boolean') {\n return equal;\n }\n\n return generateConfig.getHour(time1) === generateConfig.getHour(time2) && generateConfig.getMinute(time1) === generateConfig.getMinute(time2) && generateConfig.getSecond(time1) === generateConfig.getSecond(time2);\n}\nexport function isSameWeek(generateConfig, locale, date1, date2) {\n var equal = isNullEqual(date1, date2);\n\n if (typeof equal === 'boolean') {\n return equal;\n }\n\n return generateConfig.locale.getWeek(locale, date1) === generateConfig.locale.getWeek(locale, date2);\n}\nexport function isEqual(generateConfig, value1, value2) {\n return isSameDate(generateConfig, value1, value2) && isSameTime(generateConfig, value1, value2);\n}\n/** Between in date but not equal of date */\n\nexport function isInRange(generateConfig, startDate, endDate, current) {\n if (!startDate || !endDate || !current) {\n return false;\n }\n\n return !isSameDate(generateConfig, startDate, current) && !isSameDate(generateConfig, endDate, current) && generateConfig.isAfter(current, startDate) && generateConfig.isAfter(endDate, current);\n}\nexport function getWeekStartDate(locale, generateConfig, value) {\n var weekFirstDay = generateConfig.locale.getWeekFirstDay(locale);\n var monthStartDate = generateConfig.setDate(value, 1);\n var startDateWeekDay = generateConfig.getWeekDay(monthStartDate);\n var alignStartDate = generateConfig.addDate(monthStartDate, weekFirstDay - startDateWeekDay);\n\n if (generateConfig.getMonth(alignStartDate) === generateConfig.getMonth(value) && generateConfig.getDate(alignStartDate) > 1) {\n alignStartDate = generateConfig.addDate(alignStartDate, -7);\n }\n\n return alignStartDate;\n}\nexport function getClosingViewDate(viewDate, picker, generateConfig) {\n var offset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n\n switch (picker) {\n case 'year':\n return generateConfig.addYear(viewDate, offset * 10);\n\n case 'month':\n return generateConfig.addYear(viewDate, offset);\n\n default:\n return generateConfig.addMonth(viewDate, offset);\n }\n}","import * as React from 'react';\nvar RangeContext = React.createContext({});\nexport default RangeContext;","function _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\nimport { isInRange } from '../utils/dateUtil';\nimport { getValue } from '../utils/miscUtil';\nexport default function useCellClassName(_ref) {\n var cellPrefixCls = _ref.cellPrefixCls,\n generateConfig = _ref.generateConfig,\n rangedValue = _ref.rangedValue,\n hoverRangedValue = _ref.hoverRangedValue,\n isInView = _ref.isInView,\n isSameCell = _ref.isSameCell,\n offsetCell = _ref.offsetCell,\n today = _ref.today,\n value = _ref.value;\n\n function getClassName(currentDate) {\n var _ref2;\n\n var prevDate = offsetCell(currentDate, -1);\n var nextDate = offsetCell(currentDate, 1);\n var rangeStart = getValue(rangedValue, 0);\n var rangeEnd = getValue(rangedValue, 1);\n var hoverStart = getValue(hoverRangedValue, 0);\n var hoverEnd = getValue(hoverRangedValue, 1);\n var isRangeHovered = isInRange(generateConfig, hoverStart, hoverEnd, currentDate);\n\n function isRangeStart(date) {\n return isSameCell(rangeStart, date);\n }\n\n function isRangeEnd(date) {\n return isSameCell(rangeEnd, date);\n }\n\n var isHoverStart = isSameCell(hoverStart, currentDate);\n var isHoverEnd = isSameCell(hoverEnd, currentDate);\n var isHoverEdgeStart = (isRangeHovered || isHoverEnd) && (!isInView(prevDate) || isRangeEnd(prevDate));\n var isHoverEdgeEnd = (isRangeHovered || isHoverStart) && (!isInView(nextDate) || isRangeStart(nextDate));\n return _ref2 = {}, _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-in-view\"), isInView(currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-in-range\"), isInRange(generateConfig, rangeStart, rangeEnd, currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-start\"), isRangeStart(currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-end\"), isRangeEnd(currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-start-single\"), isRangeStart(currentDate) && !rangeEnd), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-end-single\"), isRangeEnd(currentDate) && !rangeStart), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-start-near-hover\"), isRangeStart(currentDate) && (isSameCell(prevDate, hoverStart) || isInRange(generateConfig, hoverStart, hoverEnd, prevDate))), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-end-near-hover\"), isRangeEnd(currentDate) && (isSameCell(nextDate, hoverEnd) || isInRange(generateConfig, hoverStart, hoverEnd, nextDate))), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover\"), isRangeHovered), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-start\"), isHoverStart), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-end\"), isHoverEnd), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-edge-start\"), isHoverEdgeStart), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-edge-end\"), isHoverEdgeEnd), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-edge-start-near-range\"), isHoverEdgeStart && isSameCell(prevDate, rangeEnd)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-edge-end-near-range\"), isHoverEdgeEnd && isSameCell(nextDate, rangeStart)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-today\"), isSameCell(today, currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-selected\"), isSameCell(value, currentDate)), _ref2;\n }\n\n return getClassName;\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport PanelContext from '../PanelContext';\nexport default function PanelBody(_ref) {\n var prefixCls = _ref.prefixCls,\n disabledDate = _ref.disabledDate,\n onSelect = _ref.onSelect,\n rowNum = _ref.rowNum,\n colNum = _ref.colNum,\n prefixColumn = _ref.prefixColumn,\n rowClassName = _ref.rowClassName,\n baseDate = _ref.baseDate,\n getCellClassName = _ref.getCellClassName,\n getCellText = _ref.getCellText,\n getCellNode = _ref.getCellNode,\n getCellDate = _ref.getCellDate,\n titleCell = _ref.titleCell,\n headerCells = _ref.headerCells;\n\n var _React$useContext = React.useContext(PanelContext),\n onDateMouseEnter = _React$useContext.onDateMouseEnter,\n onDateMouseLeave = _React$useContext.onDateMouseLeave;\n\n var cellPrefixCls = \"\".concat(prefixCls, \"-cell\"); // =============================== Body ===============================\n\n var rows = [];\n\n for (var i = 0; i < rowNum; i += 1) {\n var row = [];\n var rowStartDate = void 0;\n\n var _loop = function _loop(j) {\n var offset = i * colNum + j;\n var currentDate = getCellDate(baseDate, offset);\n var disabled = disabledDate && disabledDate(currentDate);\n\n if (j === 0) {\n rowStartDate = currentDate;\n\n if (prefixColumn) {\n row.push(prefixColumn(rowStartDate));\n }\n }\n\n row.push(React.createElement(\"td\", {\n key: j,\n title: titleCell && titleCell(currentDate),\n className: classNames(cellPrefixCls, _objectSpread(_defineProperty({}, \"\".concat(cellPrefixCls, \"-disabled\"), disabled), getCellClassName(currentDate))),\n onClick: function onClick() {\n if (!disabled) {\n onSelect(currentDate);\n }\n },\n onMouseEnter: function onMouseEnter() {\n if (!disabled && onDateMouseEnter) {\n onDateMouseEnter(currentDate);\n }\n },\n onMouseLeave: function onMouseLeave() {\n if (!disabled && onDateMouseLeave) {\n onDateMouseLeave(currentDate);\n }\n }\n }, getCellNode ? getCellNode(currentDate) : React.createElement(\"div\", {\n className: \"\".concat(cellPrefixCls, \"-inner\")\n }, getCellText(currentDate))));\n };\n\n for (var j = 0; j < colNum; j += 1) {\n _loop(j);\n }\n\n rows.push(React.createElement(\"tr\", {\n key: i,\n className: rowClassName && rowClassName(rowStartDate)\n }, row));\n }\n\n return React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-body\")\n }, React.createElement(\"table\", {\n className: \"\".concat(prefixCls, \"-content\")\n }, headerCells && React.createElement(\"thead\", null, React.createElement(\"tr\", null, headerCells)), React.createElement(\"tbody\", null, rows)));\n}","import * as React from 'react';\nimport { WEEK_DAY_COUNT, getWeekStartDate, isSameDate, isSameMonth } from '../../utils/dateUtil';\nimport RangeContext from '../../RangeContext';\nimport useCellClassName from '../../hooks/useCellClassName';\nimport PanelBody from '../PanelBody';\n\nfunction DateBody(props) {\n var prefixCls = props.prefixCls,\n generateConfig = props.generateConfig,\n prefixColumn = props.prefixColumn,\n locale = props.locale,\n rowCount = props.rowCount,\n viewDate = props.viewDate,\n value = props.value,\n dateRender = props.dateRender;\n\n var _React$useContext = React.useContext(RangeContext),\n rangedValue = _React$useContext.rangedValue,\n hoverRangedValue = _React$useContext.hoverRangedValue;\n\n var baseDate = getWeekStartDate(locale.locale, generateConfig, viewDate);\n var cellPrefixCls = \"\".concat(prefixCls, \"-cell\");\n var weekFirstDay = generateConfig.locale.getWeekFirstDay(locale.locale);\n var today = generateConfig.getNow(); // ============================== Header ==============================\n\n var headerCells = [];\n var weekDaysLocale = locale.shortWeekDays || (generateConfig.locale.getShortWeekDays ? generateConfig.locale.getShortWeekDays(locale.locale) : []);\n\n if (prefixColumn) {\n headerCells.push(React.createElement(\"th\", {\n key: \"empty\"\n }));\n }\n\n for (var i = 0; i < WEEK_DAY_COUNT; i += 1) {\n headerCells.push(React.createElement(\"th\", {\n key: i\n }, weekDaysLocale[(i + weekFirstDay) % WEEK_DAY_COUNT]));\n } // =============================== Body ===============================\n\n\n var getCellClassName = useCellClassName({\n cellPrefixCls: cellPrefixCls,\n today: today,\n value: value,\n generateConfig: generateConfig,\n rangedValue: prefixColumn ? null : rangedValue,\n hoverRangedValue: prefixColumn ? null : hoverRangedValue,\n isSameCell: function isSameCell(current, target) {\n return isSameDate(generateConfig, current, target);\n },\n isInView: function isInView(date) {\n return isSameMonth(generateConfig, date, viewDate);\n },\n offsetCell: function offsetCell(date, offset) {\n return generateConfig.addDate(date, offset);\n }\n });\n var getCellNode = dateRender ? function (date) {\n return dateRender(date, today);\n } : undefined;\n return React.createElement(PanelBody, Object.assign({}, props, {\n rowNum: rowCount,\n colNum: WEEK_DAY_COUNT,\n baseDate: baseDate,\n getCellNode: getCellNode,\n getCellText: generateConfig.getDate,\n getCellClassName: getCellClassName,\n getCellDate: generateConfig.addDate,\n titleCell: function titleCell(date) {\n return generateConfig.locale.format(locale.locale, date, 'YYYY-MM-DD');\n },\n headerCells: headerCells\n }));\n}\n\nexport default DateBody;","import * as React from 'react';\nimport Header from '../Header';\nimport PanelContext from '../../PanelContext';\n\nfunction DateHeader(props) {\n var prefixCls = props.prefixCls,\n generateConfig = props.generateConfig,\n locale = props.locale,\n viewDate = props.viewDate,\n onNextMonth = props.onNextMonth,\n onPrevMonth = props.onPrevMonth,\n onNextYear = props.onNextYear,\n onPrevYear = props.onPrevYear,\n onYearClick = props.onYearClick,\n onMonthClick = props.onMonthClick;\n\n var _React$useContext = React.useContext(PanelContext),\n hideHeader = _React$useContext.hideHeader;\n\n if (hideHeader) {\n return null;\n }\n\n var headerPrefixCls = \"\".concat(prefixCls, \"-header\");\n var monthsLocale = locale.shortMonths || (generateConfig.locale.getShortMonths ? generateConfig.locale.getShortMonths(locale.locale) : []);\n var month = generateConfig.getMonth(viewDate); // =================== Month & Year ===================\n\n var yearNode = React.createElement(\"button\", {\n type: \"button\",\n key: \"year\",\n onClick: onYearClick,\n tabIndex: -1,\n className: \"\".concat(prefixCls, \"-year-btn\")\n }, generateConfig.locale.format(locale.locale, viewDate, locale.yearFormat));\n var monthNode = React.createElement(\"button\", {\n type: \"button\",\n key: \"month\",\n onClick: onMonthClick,\n tabIndex: -1,\n className: \"\".concat(prefixCls, \"-month-btn\")\n }, locale.monthFormat ? generateConfig.locale.format(locale.locale, viewDate, locale.monthFormat) : monthsLocale[month]);\n var monthYearNodes = locale.monthBeforeYear ? [monthNode, yearNode] : [yearNode, monthNode];\n return React.createElement(Header, Object.assign({}, props, {\n prefixCls: headerPrefixCls,\n onSuperPrev: onPrevYear,\n onPrev: onPrevMonth,\n onNext: onNextMonth,\n onSuperNext: onNextYear\n }), monthYearNodes);\n}\n\nexport default DateHeader;","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport DateBody from './DateBody';\nimport DateHeader from './DateHeader';\nimport { WEEK_DAY_COUNT } from '../../utils/dateUtil';\nimport { createKeyDownHandler } from '../../utils/uiUtil';\nvar DATE_ROW_COUNT = 6;\n\nfunction DatePanel(props) {\n var prefixCls = props.prefixCls,\n _props$panelName = props.panelName,\n panelName = _props$panelName === void 0 ? 'date' : _props$panelName,\n keyboardConfig = props.keyboardConfig,\n active = props.active,\n operationRef = props.operationRef,\n generateConfig = props.generateConfig,\n value = props.value,\n viewDate = props.viewDate,\n onViewDateChange = props.onViewDateChange,\n onPanelChange = props.onPanelChange,\n _onSelect = props.onSelect;\n var panelPrefixCls = \"\".concat(prefixCls, \"-\").concat(panelName, \"-panel\"); // ======================= Keyboard =======================\n\n operationRef.current = {\n onKeyDown: function onKeyDown(event) {\n return createKeyDownHandler(event, _objectSpread({\n onLeftRight: function onLeftRight(diff) {\n _onSelect(generateConfig.addDate(value || viewDate, diff), 'key');\n },\n onCtrlLeftRight: function onCtrlLeftRight(diff) {\n _onSelect(generateConfig.addYear(value || viewDate, diff), 'key');\n },\n onUpDown: function onUpDown(diff) {\n _onSelect(generateConfig.addDate(value || viewDate, diff * WEEK_DAY_COUNT), 'key');\n },\n onPageUpDown: function onPageUpDown(diff) {\n _onSelect(generateConfig.addMonth(value || viewDate, diff), 'key');\n }\n }, keyboardConfig));\n }\n }; // ==================== View Operation ====================\n\n var onYearChange = function onYearChange(diff) {\n var newDate = generateConfig.addYear(viewDate, diff);\n onViewDateChange(newDate);\n onPanelChange(null, newDate);\n };\n\n var onMonthChange = function onMonthChange(diff) {\n var newDate = generateConfig.addMonth(viewDate, diff);\n onViewDateChange(newDate);\n onPanelChange(null, newDate);\n };\n\n return React.createElement(\"div\", {\n className: classNames(panelPrefixCls, _defineProperty({}, \"\".concat(panelPrefixCls, \"-active\"), active))\n }, React.createElement(DateHeader, Object.assign({}, props, {\n prefixCls: prefixCls,\n value: value,\n viewDate: viewDate,\n // View Operation\n onPrevYear: function onPrevYear() {\n onYearChange(-1);\n },\n onNextYear: function onNextYear() {\n onYearChange(1);\n },\n onPrevMonth: function onPrevMonth() {\n onMonthChange(-1);\n },\n onNextMonth: function onNextMonth() {\n onMonthChange(1);\n },\n onMonthClick: function onMonthClick() {\n onPanelChange('month', viewDate);\n },\n onYearClick: function onYearClick() {\n onPanelChange('year', viewDate);\n }\n })), React.createElement(DateBody, Object.assign({}, props, {\n onSelect: function onSelect(date) {\n return _onSelect(date, 'mouse');\n },\n prefixCls: prefixCls,\n value: value,\n viewDate: viewDate,\n rowCount: DATE_ROW_COUNT\n })));\n}\n\nexport default DatePanel;","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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 _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(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(n); 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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport DatePanel from '../DatePanel';\nimport TimePanel from '../TimePanel';\nimport { tuple } from '../../utils/miscUtil';\n\nfunction setTime(generateConfig, date, defaultDate) {\n if (!defaultDate) {\n return date;\n }\n\n var newDate = date;\n newDate = generateConfig.setHour(newDate, generateConfig.getHour(defaultDate));\n newDate = generateConfig.setMinute(newDate, generateConfig.getMinute(defaultDate));\n newDate = generateConfig.setSecond(newDate, generateConfig.getSecond(defaultDate));\n return newDate;\n}\n\nvar ACTIVE_PANEL = tuple('date', 'time');\n\nfunction DatetimePanel(props) {\n var prefixCls = props.prefixCls,\n operationRef = props.operationRef,\n generateConfig = props.generateConfig,\n value = props.value,\n defaultValue = props.defaultValue,\n disabledTime = props.disabledTime,\n showTime = props.showTime,\n onSelect = props.onSelect;\n var panelPrefixCls = \"\".concat(prefixCls, \"-datetime-panel\");\n\n var _React$useState = React.useState(null),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n activePanel = _React$useState2[0],\n setActivePanel = _React$useState2[1];\n\n var dateOperationRef = React.useRef({});\n var timeOperationRef = React.useRef({});\n var timeProps = _typeof(showTime) === 'object' ? _objectSpread({}, showTime) : {}; // ======================= Keyboard =======================\n\n function getNextActive(offset) {\n var activeIndex = ACTIVE_PANEL.indexOf(activePanel) + offset;\n var nextActivePanel = ACTIVE_PANEL[activeIndex] || null;\n return nextActivePanel;\n }\n\n var onBlur = function onBlur(e) {\n if (timeOperationRef.current.onBlur) {\n timeOperationRef.current.onBlur(e);\n }\n\n setActivePanel(null);\n };\n\n operationRef.current = {\n onKeyDown: function onKeyDown(event) {\n // Switch active panel\n if (event.which === KeyCode.TAB) {\n var nextActivePanel = getNextActive(event.shiftKey ? -1 : 1);\n setActivePanel(nextActivePanel);\n\n if (nextActivePanel) {\n event.preventDefault();\n }\n\n return true;\n } // Operate on current active panel\n\n\n if (activePanel) {\n var ref = activePanel === 'date' ? dateOperationRef : timeOperationRef;\n\n if (ref.current && ref.current.onKeyDown) {\n ref.current.onKeyDown(event);\n }\n\n return true;\n } // Switch first active panel if operate without panel\n\n\n if ([KeyCode.LEFT, KeyCode.RIGHT, KeyCode.UP, KeyCode.DOWN].includes(event.which)) {\n setActivePanel('date');\n return true;\n }\n\n return false;\n },\n onBlur: onBlur,\n onClose: onBlur\n }; // ======================== Events ========================\n\n var onInternalSelect = function onInternalSelect(date, source) {\n var selectedDate = date;\n\n if (source === 'date' && !value && timeProps.defaultValue) {\n // Date with time defaultValue\n selectedDate = generateConfig.setHour(selectedDate, generateConfig.getHour(timeProps.defaultValue));\n selectedDate = generateConfig.setMinute(selectedDate, generateConfig.getMinute(timeProps.defaultValue));\n selectedDate = generateConfig.setSecond(selectedDate, generateConfig.getSecond(timeProps.defaultValue));\n } else if (source === 'time' && !value && defaultValue) {\n selectedDate = generateConfig.setYear(selectedDate, generateConfig.getYear(defaultValue));\n selectedDate = generateConfig.setMonth(selectedDate, generateConfig.getMonth(defaultValue));\n selectedDate = generateConfig.setDate(selectedDate, generateConfig.getDate(defaultValue));\n }\n\n if (onSelect) {\n onSelect(selectedDate, 'mouse');\n }\n }; // ======================== Render ========================\n\n\n var disabledTimes = disabledTime ? disabledTime(value || null) : {};\n return React.createElement(\"div\", {\n className: classNames(panelPrefixCls, _defineProperty({}, \"\".concat(panelPrefixCls, \"-active\"), activePanel))\n }, React.createElement(DatePanel, Object.assign({}, props, {\n operationRef: dateOperationRef,\n active: activePanel === 'date',\n onSelect: function onSelect(date) {\n onInternalSelect(setTime(generateConfig, date, showTime && _typeof(showTime) === 'object' ? showTime.defaultValue : null), 'date');\n }\n })), React.createElement(TimePanel, Object.assign({}, props, {\n format: undefined\n }, timeProps, disabledTimes, {\n defaultValue: undefined,\n operationRef: timeOperationRef,\n active: activePanel === 'time',\n onSelect: function onSelect(date) {\n onInternalSelect(date, 'time');\n }\n })));\n}\n\nexport default DatetimePanel;","function _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\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport DatePanel from '../DatePanel';\nimport { isSameWeek } from '../../utils/dateUtil';\n\nfunction WeekPanel(props) {\n var prefixCls = props.prefixCls,\n generateConfig = props.generateConfig,\n locale = props.locale,\n value = props.value; // Render additional column\n\n var cellPrefixCls = \"\".concat(prefixCls, \"-cell\");\n\n var prefixColumn = function prefixColumn(date) {\n return React.createElement(\"td\", {\n key: \"week\",\n className: classNames(cellPrefixCls, \"\".concat(cellPrefixCls, \"-week\"))\n }, generateConfig.locale.getWeek(locale.locale, date));\n }; // Add row className\n\n\n var rowPrefixCls = \"\".concat(prefixCls, \"-week-panel-row\");\n\n var rowClassName = function rowClassName(date) {\n return classNames(rowPrefixCls, _defineProperty({}, \"\".concat(rowPrefixCls, \"-selected\"), isSameWeek(generateConfig, locale.locale, value, date)));\n };\n\n return React.createElement(DatePanel, Object.assign({}, props, {\n panelName: \"week\",\n prefixColumn: prefixColumn,\n rowClassName: rowClassName,\n keyboardConfig: {\n onLeftRight: null\n }\n }));\n}\n\nexport default WeekPanel;","import * as React from 'react';\nimport Header from '../Header';\nimport PanelContext from '../../PanelContext';\n\nfunction MonthHeader(props) {\n var prefixCls = props.prefixCls,\n generateConfig = props.generateConfig,\n locale = props.locale,\n viewDate = props.viewDate,\n onNextYear = props.onNextYear,\n onPrevYear = props.onPrevYear,\n onYearClick = props.onYearClick;\n\n var _React$useContext = React.useContext(PanelContext),\n hideHeader = _React$useContext.hideHeader;\n\n if (hideHeader) {\n return null;\n }\n\n var headerPrefixCls = \"\".concat(prefixCls, \"-header\");\n return React.createElement(Header, {\n prefixCls: headerPrefixCls,\n onSuperPrev: onPrevYear,\n onSuperNext: onNextYear\n }, React.createElement(\"button\", {\n type: \"button\",\n key: \"year\",\n onClick: onYearClick,\n className: \"\".concat(prefixCls, \"-year-btn\")\n }, generateConfig.locale.format(locale.locale, viewDate, locale.yearFormat)));\n}\n\nexport default MonthHeader;","import * as React from 'react';\nimport { isSameMonth } from '../../utils/dateUtil';\nimport RangeContext from '../../RangeContext';\nimport useCellClassName from '../../hooks/useCellClassName';\nimport PanelBody from '../PanelBody';\nexport var MONTH_COL_COUNT = 3;\nvar MONTH_ROW_COUNT = 4;\n\nfunction MonthBody(props) {\n var prefixCls = props.prefixCls,\n locale = props.locale,\n value = props.value,\n viewDate = props.viewDate,\n generateConfig = props.generateConfig,\n monthCellRender = props.monthCellRender;\n\n var _React$useContext = React.useContext(RangeContext),\n rangedValue = _React$useContext.rangedValue,\n hoverRangedValue = _React$useContext.hoverRangedValue;\n\n var cellPrefixCls = \"\".concat(prefixCls, \"-cell\");\n var getCellClassName = useCellClassName({\n cellPrefixCls: cellPrefixCls,\n value: value,\n generateConfig: generateConfig,\n rangedValue: rangedValue,\n hoverRangedValue: hoverRangedValue,\n isSameCell: function isSameCell(current, target) {\n return isSameMonth(generateConfig, current, target);\n },\n isInView: function isInView() {\n return true;\n },\n offsetCell: function offsetCell(date, offset) {\n return generateConfig.addMonth(date, offset);\n }\n });\n var monthsLocale = locale.shortMonths || (generateConfig.locale.getShortMonths ? generateConfig.locale.getShortMonths(locale.locale) : []);\n var baseMonth = generateConfig.setMonth(viewDate, 0);\n var getCellNode = monthCellRender ? function (date) {\n return monthCellRender(date, locale);\n } : undefined;\n return React.createElement(PanelBody, Object.assign({}, props, {\n rowNum: MONTH_ROW_COUNT,\n colNum: MONTH_COL_COUNT,\n baseDate: baseMonth,\n getCellNode: getCellNode,\n getCellText: function getCellText(date) {\n return locale.monthFormat ? generateConfig.locale.format(locale.locale, date, locale.monthFormat) : monthsLocale[generateConfig.getMonth(date)];\n },\n getCellClassName: getCellClassName,\n getCellDate: generateConfig.addMonth,\n titleCell: function titleCell(date) {\n return generateConfig.locale.format(locale.locale, date, 'YYYY-MM');\n }\n }));\n}\n\nexport default MonthBody;","import * as React from 'react';\nimport MonthHeader from './MonthHeader';\nimport MonthBody, { MONTH_COL_COUNT } from './MonthBody';\nimport { createKeyDownHandler } from '../../utils/uiUtil';\n\nfunction MonthPanel(props) {\n var prefixCls = props.prefixCls,\n operationRef = props.operationRef,\n onViewDateChange = props.onViewDateChange,\n generateConfig = props.generateConfig,\n value = props.value,\n viewDate = props.viewDate,\n onPanelChange = props.onPanelChange,\n _onSelect = props.onSelect;\n var panelPrefixCls = \"\".concat(prefixCls, \"-month-panel\"); // ======================= Keyboard =======================\n\n operationRef.current = {\n onKeyDown: function onKeyDown(event) {\n return createKeyDownHandler(event, {\n onLeftRight: function onLeftRight(diff) {\n _onSelect(generateConfig.addMonth(value || viewDate, diff), 'key');\n },\n onCtrlLeftRight: function onCtrlLeftRight(diff) {\n _onSelect(generateConfig.addYear(value || viewDate, diff), 'key');\n },\n onUpDown: function onUpDown(diff) {\n _onSelect(generateConfig.addMonth(value || viewDate, diff * MONTH_COL_COUNT), 'key');\n },\n onEnter: function onEnter() {\n onPanelChange('date', value || viewDate);\n }\n });\n }\n }; // ==================== View Operation ====================\n\n var onYearChange = function onYearChange(diff) {\n var newDate = generateConfig.addYear(viewDate, diff);\n onViewDateChange(newDate);\n onPanelChange(null, newDate);\n };\n\n return React.createElement(\"div\", {\n className: panelPrefixCls\n }, React.createElement(MonthHeader, Object.assign({}, props, {\n prefixCls: prefixCls,\n onPrevYear: function onPrevYear() {\n onYearChange(-1);\n },\n onNextYear: function onNextYear() {\n onYearChange(1);\n },\n onYearClick: function onYearClick() {\n onPanelChange('year', viewDate);\n }\n })), React.createElement(MonthBody, Object.assign({}, props, {\n prefixCls: prefixCls,\n onSelect: function onSelect(date) {\n _onSelect(date, 'mouse');\n\n onPanelChange('date', date);\n }\n })));\n}\n\nexport default MonthPanel;","import * as React from 'react';\nimport Header from '../Header';\nimport PanelContext from '../../PanelContext';\n\nfunction QuarterHeader(props) {\n var prefixCls = props.prefixCls,\n generateConfig = props.generateConfig,\n locale = props.locale,\n viewDate = props.viewDate,\n onNextYear = props.onNextYear,\n onPrevYear = props.onPrevYear,\n onYearClick = props.onYearClick;\n\n var _React$useContext = React.useContext(PanelContext),\n hideHeader = _React$useContext.hideHeader;\n\n if (hideHeader) {\n return null;\n }\n\n var headerPrefixCls = \"\".concat(prefixCls, \"-header\");\n return React.createElement(Header, {\n prefixCls: headerPrefixCls,\n onSuperPrev: onPrevYear,\n onSuperNext: onNextYear\n }, React.createElement(\"button\", {\n type: \"button\",\n key: \"year\",\n onClick: onYearClick,\n className: \"\".concat(prefixCls, \"-year-btn\")\n }, generateConfig.locale.format(locale.locale, viewDate, locale.yearFormat)));\n}\n\nexport default QuarterHeader;","import * as React from 'react';\nimport { isSameQuarter } from '../../utils/dateUtil';\nimport RangeContext from '../../RangeContext';\nimport useCellClassName from '../../hooks/useCellClassName';\nimport PanelBody from '../PanelBody';\nexport var QUARTER_COL_COUNT = 4;\nvar QUARTER_ROW_COUNT = 1;\n\nfunction QuarterBody(props) {\n var prefixCls = props.prefixCls,\n locale = props.locale,\n value = props.value,\n viewDate = props.viewDate,\n generateConfig = props.generateConfig;\n\n var _React$useContext = React.useContext(RangeContext),\n rangedValue = _React$useContext.rangedValue,\n hoverRangedValue = _React$useContext.hoverRangedValue;\n\n var cellPrefixCls = \"\".concat(prefixCls, \"-cell\");\n var getCellClassName = useCellClassName({\n cellPrefixCls: cellPrefixCls,\n value: value,\n generateConfig: generateConfig,\n rangedValue: rangedValue,\n hoverRangedValue: hoverRangedValue,\n isSameCell: function isSameCell(current, target) {\n return isSameQuarter(generateConfig, current, target);\n },\n isInView: function isInView() {\n return true;\n },\n offsetCell: function offsetCell(date, offset) {\n return generateConfig.addMonth(date, offset * 3);\n }\n });\n var baseQuarter = generateConfig.setDate(generateConfig.setMonth(viewDate, 0), 1);\n return React.createElement(PanelBody, Object.assign({}, props, {\n rowNum: QUARTER_ROW_COUNT,\n colNum: QUARTER_COL_COUNT,\n baseDate: baseQuarter,\n getCellText: function getCellText(date) {\n return generateConfig.locale.format(locale.locale, date, locale.quarterFormat || '[Q]Q');\n },\n getCellClassName: getCellClassName,\n getCellDate: function getCellDate(date, offset) {\n return generateConfig.addMonth(date, offset * 3);\n },\n titleCell: function titleCell(date) {\n return generateConfig.locale.format(locale.locale, date, 'YYYY-[Q]Q');\n }\n }));\n}\n\nexport default QuarterBody;","import * as React from 'react';\nimport QuarterHeader from './QuarterHeader';\nimport QuarterBody from './QuarterBody';\nimport { createKeyDownHandler } from '../../utils/uiUtil';\n\nfunction QuarterPanel(props) {\n var prefixCls = props.prefixCls,\n operationRef = props.operationRef,\n onViewDateChange = props.onViewDateChange,\n generateConfig = props.generateConfig,\n value = props.value,\n viewDate = props.viewDate,\n onPanelChange = props.onPanelChange,\n _onSelect = props.onSelect;\n var panelPrefixCls = \"\".concat(prefixCls, \"-quarter-panel\"); // ======================= Keyboard =======================\n\n operationRef.current = {\n onKeyDown: function onKeyDown(event) {\n return createKeyDownHandler(event, {\n onLeftRight: function onLeftRight(diff) {\n _onSelect(generateConfig.addMonth(value || viewDate, diff * 3), 'key');\n },\n onCtrlLeftRight: function onCtrlLeftRight(diff) {\n _onSelect(generateConfig.addYear(value || viewDate, diff), 'key');\n },\n onUpDown: function onUpDown(diff) {\n _onSelect(generateConfig.addYear(value || viewDate, diff), 'key');\n }\n });\n }\n }; // ==================== View Operation ====================\n\n var onYearChange = function onYearChange(diff) {\n var newDate = generateConfig.addYear(viewDate, diff);\n onViewDateChange(newDate);\n onPanelChange(null, newDate);\n };\n\n return React.createElement(\"div\", {\n className: panelPrefixCls\n }, React.createElement(QuarterHeader, Object.assign({}, props, {\n prefixCls: prefixCls,\n onPrevYear: function onPrevYear() {\n onYearChange(-1);\n },\n onNextYear: function onNextYear() {\n onYearChange(1);\n },\n onYearClick: function onYearClick() {\n onPanelChange('year', viewDate);\n }\n })), React.createElement(QuarterBody, Object.assign({}, props, {\n prefixCls: prefixCls,\n onSelect: function onSelect(date) {\n _onSelect(date, 'mouse');\n }\n })));\n}\n\nexport default QuarterPanel;","import * as React from 'react';\nimport Header from '../Header';\nimport { YEAR_DECADE_COUNT } from '.';\nimport PanelContext from '../../PanelContext';\n\nfunction YearHeader(props) {\n var prefixCls = props.prefixCls,\n generateConfig = props.generateConfig,\n viewDate = props.viewDate,\n onPrevDecade = props.onPrevDecade,\n onNextDecade = props.onNextDecade,\n onDecadeClick = props.onDecadeClick;\n\n var _React$useContext = React.useContext(PanelContext),\n hideHeader = _React$useContext.hideHeader;\n\n if (hideHeader) {\n return null;\n }\n\n var headerPrefixCls = \"\".concat(prefixCls, \"-header\");\n var yearNumber = generateConfig.getYear(viewDate);\n var startYear = Math.floor(yearNumber / YEAR_DECADE_COUNT) * YEAR_DECADE_COUNT;\n var endYear = startYear + YEAR_DECADE_COUNT - 1;\n return React.createElement(Header, Object.assign({}, props, {\n prefixCls: headerPrefixCls,\n onSuperPrev: onPrevDecade,\n onSuperNext: onNextDecade\n }), React.createElement(\"button\", {\n type: \"button\",\n key: \"year\",\n onClick: onDecadeClick,\n className: \"\".concat(prefixCls, \"-decade-btn\")\n }, startYear, \"-\", endYear));\n}\n\nexport default YearHeader;","import * as React from 'react';\nimport { YEAR_DECADE_COUNT } from '.';\nimport useCellClassName from '../../hooks/useCellClassName';\nimport { isSameYear } from '../../utils/dateUtil';\nimport RangeContext from '../../RangeContext';\nimport PanelBody from '../PanelBody';\nexport var YEAR_COL_COUNT = 3;\nvar YEAR_ROW_COUNT = 4;\n\nfunction YearBody(props) {\n var prefixCls = props.prefixCls,\n value = props.value,\n viewDate = props.viewDate,\n locale = props.locale,\n generateConfig = props.generateConfig;\n\n var _React$useContext = React.useContext(RangeContext),\n rangedValue = _React$useContext.rangedValue,\n hoverRangedValue = _React$useContext.hoverRangedValue;\n\n var yearPrefixCls = \"\".concat(prefixCls, \"-cell\"); // =============================== Year ===============================\n\n var yearNumber = generateConfig.getYear(viewDate);\n var startYear = Math.floor(yearNumber / YEAR_DECADE_COUNT) * YEAR_DECADE_COUNT;\n var endYear = startYear + YEAR_DECADE_COUNT - 1;\n var baseYear = generateConfig.setYear(viewDate, startYear - Math.ceil((YEAR_COL_COUNT * YEAR_ROW_COUNT - YEAR_DECADE_COUNT) / 2));\n\n var isInView = function isInView(date) {\n var currentYearNumber = generateConfig.getYear(date);\n return startYear <= currentYearNumber && currentYearNumber <= endYear;\n };\n\n var getCellClassName = useCellClassName({\n cellPrefixCls: yearPrefixCls,\n value: value,\n generateConfig: generateConfig,\n rangedValue: rangedValue,\n hoverRangedValue: hoverRangedValue,\n isSameCell: function isSameCell(current, target) {\n return isSameYear(generateConfig, current, target);\n },\n isInView: isInView,\n offsetCell: function offsetCell(date, offset) {\n return generateConfig.addYear(date, offset);\n }\n });\n return React.createElement(PanelBody, Object.assign({}, props, {\n rowNum: YEAR_ROW_COUNT,\n colNum: YEAR_COL_COUNT,\n baseDate: baseYear,\n getCellText: generateConfig.getYear,\n getCellClassName: getCellClassName,\n getCellDate: generateConfig.addYear,\n titleCell: function titleCell(date) {\n return generateConfig.locale.format(locale.locale, date, 'YYYY');\n }\n }));\n}\n\nexport default YearBody;","import * as React from 'react';\nimport YearHeader from './YearHeader';\nimport YearBody, { YEAR_COL_COUNT } from './YearBody';\nimport { createKeyDownHandler } from '../../utils/uiUtil';\nexport var YEAR_DECADE_COUNT = 10;\n\nfunction YearPanel(props) {\n var prefixCls = props.prefixCls,\n operationRef = props.operationRef,\n onViewDateChange = props.onViewDateChange,\n generateConfig = props.generateConfig,\n value = props.value,\n viewDate = props.viewDate,\n sourceMode = props.sourceMode,\n _onSelect = props.onSelect,\n onPanelChange = props.onPanelChange;\n var panelPrefixCls = \"\".concat(prefixCls, \"-year-panel\"); // ======================= Keyboard =======================\n\n operationRef.current = {\n onKeyDown: function onKeyDown(event) {\n return createKeyDownHandler(event, {\n onLeftRight: function onLeftRight(diff) {\n _onSelect(generateConfig.addYear(value || viewDate, diff), 'key');\n },\n onCtrlLeftRight: function onCtrlLeftRight(diff) {\n _onSelect(generateConfig.addYear(value || viewDate, diff * YEAR_DECADE_COUNT), 'key');\n },\n onUpDown: function onUpDown(diff) {\n _onSelect(generateConfig.addYear(value || viewDate, diff * YEAR_COL_COUNT), 'key');\n },\n onEnter: function onEnter() {\n onPanelChange(sourceMode === 'date' ? 'date' : 'month', value || viewDate);\n }\n });\n }\n }; // ==================== View Operation ====================\n\n var onDecadeChange = function onDecadeChange(diff) {\n var newDate = generateConfig.addYear(viewDate, diff * 10);\n onViewDateChange(newDate);\n onPanelChange(null, newDate);\n };\n\n return React.createElement(\"div\", {\n className: panelPrefixCls\n }, React.createElement(YearHeader, Object.assign({}, props, {\n prefixCls: prefixCls,\n onPrevDecade: function onPrevDecade() {\n onDecadeChange(-1);\n },\n onNextDecade: function onNextDecade() {\n onDecadeChange(1);\n },\n onDecadeClick: function onDecadeClick() {\n onPanelChange('decade', viewDate);\n }\n })), React.createElement(YearBody, Object.assign({}, props, {\n prefixCls: prefixCls,\n onSelect: function onSelect(date) {\n onPanelChange(sourceMode === 'date' ? 'date' : 'month', date);\n\n _onSelect(date, 'mouse');\n }\n })));\n}\n\nexport default YearPanel;","import * as React from 'react';\nimport Header from '../Header';\nimport { DECADE_DISTANCE_COUNT } from '.';\nimport PanelContext from '../../PanelContext';\n\nfunction DecadeHeader(props) {\n var prefixCls = props.prefixCls,\n generateConfig = props.generateConfig,\n viewDate = props.viewDate,\n onPrevDecades = props.onPrevDecades,\n onNextDecades = props.onNextDecades;\n\n var _React$useContext = React.useContext(PanelContext),\n hideHeader = _React$useContext.hideHeader;\n\n if (hideHeader) {\n return null;\n }\n\n var headerPrefixCls = \"\".concat(prefixCls, \"-header\");\n var yearNumber = generateConfig.getYear(viewDate);\n var startYear = Math.floor(yearNumber / DECADE_DISTANCE_COUNT) * DECADE_DISTANCE_COUNT;\n var endYear = startYear + DECADE_DISTANCE_COUNT - 1;\n return React.createElement(Header, Object.assign({}, props, {\n prefixCls: headerPrefixCls,\n onSuperPrev: onPrevDecades,\n onSuperNext: onNextDecades\n }), startYear, \"-\", endYear);\n}\n\nexport default DecadeHeader;","function _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\nimport * as React from 'react';\nimport { DECADE_DISTANCE_COUNT, DECADE_UNIT_DIFF } from '.';\nimport PanelBody from '../PanelBody';\nexport var DECADE_COL_COUNT = 3;\nvar DECADE_ROW_COUNT = 4;\n\nfunction DecadeBody(props) {\n var DECADE_UNIT_DIFF_DES = DECADE_UNIT_DIFF - 1;\n var prefixCls = props.prefixCls,\n viewDate = props.viewDate,\n generateConfig = props.generateConfig,\n disabledDate = props.disabledDate;\n var cellPrefixCls = \"\".concat(prefixCls, \"-cell\");\n var yearNumber = generateConfig.getYear(viewDate);\n var decadeYearNumber = Math.floor(yearNumber / DECADE_UNIT_DIFF) * DECADE_UNIT_DIFF;\n var startDecadeYear = Math.floor(yearNumber / DECADE_DISTANCE_COUNT) * DECADE_DISTANCE_COUNT;\n var endDecadeYear = startDecadeYear + DECADE_DISTANCE_COUNT - 1;\n var baseDecadeYear = generateConfig.setYear(viewDate, startDecadeYear - Math.ceil((DECADE_COL_COUNT * DECADE_ROW_COUNT * DECADE_UNIT_DIFF - DECADE_DISTANCE_COUNT) / 2));\n\n var getCellClassName = function getCellClassName(date) {\n var _ref;\n\n var disabled = disabledDate && disabledDate(date);\n var startDecadeNumber = generateConfig.getYear(date);\n var endDecadeNumber = startDecadeNumber + DECADE_UNIT_DIFF_DES;\n return _ref = {}, _defineProperty(_ref, \"\".concat(cellPrefixCls, \"-disabled\"), disabled), _defineProperty(_ref, \"\".concat(cellPrefixCls, \"-in-view\"), startDecadeYear <= startDecadeNumber && endDecadeNumber <= endDecadeYear), _defineProperty(_ref, \"\".concat(cellPrefixCls, \"-selected\"), startDecadeNumber === decadeYearNumber), _ref;\n };\n\n return React.createElement(PanelBody, Object.assign({}, props, {\n rowNum: DECADE_ROW_COUNT,\n colNum: DECADE_COL_COUNT,\n baseDate: baseDecadeYear,\n getCellText: function getCellText(date) {\n var startDecadeNumber = generateConfig.getYear(date);\n return \"\".concat(startDecadeNumber, \"-\").concat(startDecadeNumber + DECADE_UNIT_DIFF_DES);\n },\n getCellClassName: getCellClassName,\n getCellDate: function getCellDate(date, offset) {\n return generateConfig.addYear(date, offset * DECADE_UNIT_DIFF);\n }\n }));\n}\n\nexport default DecadeBody;","import * as React from 'react';\nimport DecadeHeader from './DecadeHeader';\nimport DecadeBody, { DECADE_COL_COUNT } from './DecadeBody';\nimport { createKeyDownHandler } from '../../utils/uiUtil';\nexport var DECADE_UNIT_DIFF = 10;\nexport var DECADE_DISTANCE_COUNT = DECADE_UNIT_DIFF * 10;\n\nfunction DecadePanel(props) {\n var prefixCls = props.prefixCls,\n onViewDateChange = props.onViewDateChange,\n generateConfig = props.generateConfig,\n viewDate = props.viewDate,\n operationRef = props.operationRef,\n onSelect = props.onSelect,\n onPanelChange = props.onPanelChange;\n var panelPrefixCls = \"\".concat(prefixCls, \"-decade-panel\"); // ======================= Keyboard =======================\n\n operationRef.current = {\n onKeyDown: function onKeyDown(event) {\n return createKeyDownHandler(event, {\n onLeftRight: function onLeftRight(diff) {\n onSelect(generateConfig.addYear(viewDate, diff * DECADE_UNIT_DIFF), 'key');\n },\n onCtrlLeftRight: function onCtrlLeftRight(diff) {\n onSelect(generateConfig.addYear(viewDate, diff * DECADE_DISTANCE_COUNT), 'key');\n },\n onUpDown: function onUpDown(diff) {\n onSelect(generateConfig.addYear(viewDate, diff * DECADE_UNIT_DIFF * DECADE_COL_COUNT), 'key');\n },\n onEnter: function onEnter() {\n onPanelChange('year', viewDate);\n }\n });\n }\n }; // ==================== View Operation ====================\n\n var onDecadesChange = function onDecadesChange(diff) {\n var newDate = generateConfig.addYear(viewDate, diff * DECADE_DISTANCE_COUNT);\n onViewDateChange(newDate);\n onPanelChange(null, newDate);\n };\n\n var onInternalSelect = function onInternalSelect(date) {\n onSelect(date, 'mouse');\n onPanelChange('year', date);\n };\n\n return React.createElement(\"div\", {\n className: panelPrefixCls\n }, React.createElement(DecadeHeader, Object.assign({}, props, {\n prefixCls: prefixCls,\n onPrevDecades: function onPrevDecades() {\n onDecadesChange(-1);\n },\n onNextDecades: function onNextDecades() {\n onDecadesChange(1);\n }\n })), React.createElement(DecadeBody, Object.assign({}, props, {\n prefixCls: prefixCls,\n onSelect: onInternalSelect\n })));\n}\n\nexport default DecadePanel;","import * as React from 'react';\nexport default function getExtraFooter(prefixCls, mode, renderExtraFooter) {\n if (!renderExtraFooter) {\n return null;\n }\n\n return React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-footer-extra\")\n }, renderExtraFooter(mode));\n}","import * as React from 'react';\nexport default function getRanges(_ref) {\n var prefixCls = _ref.prefixCls,\n _ref$rangeList = _ref.rangeList,\n rangeList = _ref$rangeList === void 0 ? [] : _ref$rangeList,\n _ref$components = _ref.components,\n components = _ref$components === void 0 ? {} : _ref$components,\n needConfirmButton = _ref.needConfirmButton,\n onNow = _ref.onNow,\n onOk = _ref.onOk,\n okDisabled = _ref.okDisabled,\n locale = _ref.locale;\n var presetNode;\n var okNode;\n\n if (rangeList.length) {\n var Item = components.rangeItem || 'span';\n presetNode = React.createElement(React.Fragment, null, rangeList.map(function (_ref2) {\n var label = _ref2.label,\n onClick = _ref2.onClick,\n onMouseEnter = _ref2.onMouseEnter,\n onMouseLeave = _ref2.onMouseLeave;\n return React.createElement(\"li\", {\n key: label,\n className: \"\".concat(prefixCls, \"-preset\")\n }, React.createElement(Item, {\n onClick: onClick,\n onMouseEnter: onMouseEnter,\n onMouseLeave: onMouseLeave\n }, label));\n }));\n }\n\n if (needConfirmButton) {\n var Button = components.button || 'button';\n\n if (onNow && !presetNode) {\n presetNode = React.createElement(\"li\", {\n className: \"\".concat(prefixCls, \"-now\")\n }, React.createElement(\"a\", {\n className: \"\".concat(prefixCls, \"-now-btn\"),\n onClick: onNow\n }, locale.now));\n }\n\n okNode = needConfirmButton && React.createElement(\"li\", {\n className: \"\".concat(prefixCls, \"-ok\")\n }, React.createElement(Button, {\n disabled: okDisabled,\n onClick: onOk\n }, locale.ok));\n }\n\n if (!presetNode && !okNode) {\n return null;\n }\n\n return React.createElement(\"ul\", {\n className: \"\".concat(prefixCls, \"-ranges\")\n }, presetNode, okNode);\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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(n); 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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\n/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n\n/**\n * Logic:\n * When `mode` === `picker`,\n * click will trigger `onSelect` (if value changed trigger `onChange` also).\n * Panel change will not trigger `onSelect` but trigger `onPanelChange`\n */\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport warning from \"rc-util/es/warning\";\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport TimePanel from './panels/TimePanel';\nimport DatetimePanel from './panels/DatetimePanel';\nimport DatePanel from './panels/DatePanel';\nimport WeekPanel from './panels/WeekPanel';\nimport MonthPanel from './panels/MonthPanel';\nimport QuarterPanel from './panels/QuarterPanel';\nimport YearPanel from './panels/YearPanel';\nimport DecadePanel from './panels/DecadePanel';\nimport { isEqual } from './utils/dateUtil';\nimport PanelContext from './PanelContext';\nimport { PickerModeMap } from './utils/uiUtil';\nimport RangeContext from './RangeContext';\nimport getExtraFooter from './utils/getExtraFooter';\nimport getRanges from './utils/getRanges';\n\nfunction PickerPanel(props) {\n var _classNames;\n\n var _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? 'rc-picker' : _props$prefixCls,\n className = props.className,\n style = props.style,\n locale = props.locale,\n generateConfig = props.generateConfig,\n value = props.value,\n defaultValue = props.defaultValue,\n pickerValue = props.pickerValue,\n defaultPickerValue = props.defaultPickerValue,\n disabledDate = props.disabledDate,\n mode = props.mode,\n _props$picker = props.picker,\n picker = _props$picker === void 0 ? 'date' : _props$picker,\n _props$tabIndex = props.tabIndex,\n tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,\n showTime = props.showTime,\n showToday = props.showToday,\n renderExtraFooter = props.renderExtraFooter,\n hideHeader = props.hideHeader,\n onSelect = props.onSelect,\n onChange = props.onChange,\n onPanelChange = props.onPanelChange,\n onMouseDown = props.onMouseDown,\n onPickerValueChange = props.onPickerValueChange,\n _onOk = props.onOk,\n components = props.components,\n direction = props.direction;\n var needConfirmButton = picker === 'date' && !!showTime || picker === 'time';\n\n if (process.env.NODE_ENV !== 'production') {\n warning(!value || generateConfig.isValidate(value), 'Invalidate date pass to `value`.');\n warning(!value || generateConfig.isValidate(value), 'Invalidate date pass to `defaultValue`.');\n } // ============================ State =============================\n\n\n var panelContext = React.useContext(PanelContext);\n var operationRef = panelContext.operationRef,\n panelDivRef = panelContext.panelRef,\n onContextSelect = panelContext.onSelect,\n hideRanges = panelContext.hideRanges,\n defaultOpenValue = panelContext.defaultOpenValue;\n\n var _React$useContext = React.useContext(RangeContext),\n inRange = _React$useContext.inRange,\n panelPosition = _React$useContext.panelPosition,\n rangedValue = _React$useContext.rangedValue,\n hoverRangedValue = _React$useContext.hoverRangedValue;\n\n var panelRef = React.useRef({}); // Handle init logic\n\n var initRef = React.useRef(true); // Value\n\n var _useMergedState = useMergedState(null, {\n value: value,\n defaultValue: defaultValue,\n postState: function postState(val) {\n if (!val && defaultOpenValue && picker === 'time') {\n return defaultOpenValue;\n }\n\n return val;\n }\n }),\n _useMergedState2 = _slicedToArray(_useMergedState, 2),\n mergedValue = _useMergedState2[0],\n setInnerValue = _useMergedState2[1]; // View date control\n\n\n var _useMergedState3 = useMergedState(null, {\n value: pickerValue,\n defaultValue: defaultPickerValue || mergedValue,\n postState: function postState(date) {\n return date || generateConfig.getNow();\n }\n }),\n _useMergedState4 = _slicedToArray(_useMergedState3, 2),\n viewDate = _useMergedState4[0],\n setInnerViewDate = _useMergedState4[1];\n\n var setViewDate = function setViewDate(date) {\n setInnerViewDate(date);\n\n if (onPickerValueChange) {\n onPickerValueChange(date);\n }\n }; // Panel control\n\n\n var getInternalNextMode = function getInternalNextMode(nextMode) {\n var getNextMode = PickerModeMap[picker];\n\n if (getNextMode) {\n return getNextMode(nextMode);\n }\n\n return nextMode;\n }; // Save panel is changed from which panel\n\n\n var _useMergedState5 = useMergedState(function () {\n if (picker === 'time') {\n return 'time';\n }\n\n return getInternalNextMode('date');\n }, {\n value: mode\n }),\n _useMergedState6 = _slicedToArray(_useMergedState5, 2),\n mergedMode = _useMergedState6[0],\n setInnerMode = _useMergedState6[1];\n\n var _React$useState = React.useState(function () {\n return mergedMode;\n }),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n sourceMode = _React$useState2[0],\n setSourceMode = _React$useState2[1];\n\n var onInternalPanelChange = function onInternalPanelChange(newMode, viewValue) {\n var nextMode = getInternalNextMode(newMode || mergedMode);\n setSourceMode(mergedMode);\n setInnerMode(nextMode);\n\n if (onPanelChange && (mergedMode !== nextMode || isEqual(generateConfig, viewDate, viewDate))) {\n onPanelChange(viewValue, nextMode);\n }\n };\n\n var triggerSelect = function triggerSelect(date, type) {\n var forceTriggerSelect = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n if (mergedMode === picker || forceTriggerSelect) {\n setInnerValue(date);\n\n if (onSelect) {\n onSelect(date);\n }\n\n if (onContextSelect) {\n onContextSelect(date, type);\n }\n\n if (onChange && !isEqual(generateConfig, date, mergedValue)) {\n onChange(date);\n }\n }\n }; // ========================= Interactive ==========================\n\n\n var onInternalKeyDown = function onInternalKeyDown(e) {\n if (panelRef.current && panelRef.current.onKeyDown) {\n if ([KeyCode.LEFT, KeyCode.RIGHT, KeyCode.UP, KeyCode.DOWN, KeyCode.PAGE_UP, KeyCode.PAGE_DOWN, KeyCode.ENTER].includes(e.which)) {\n e.preventDefault();\n }\n\n return panelRef.current.onKeyDown(e);\n }\n /* istanbul ignore next */\n\n /* eslint-disable no-lone-blocks */\n\n\n {\n warning(false, 'Panel not correct handle keyDown event. Please help to fire issue about this.');\n return false;\n }\n /* eslint-enable no-lone-blocks */\n };\n\n var onInternalBlur = function onInternalBlur(e) {\n if (panelRef.current && panelRef.current.onBlur) {\n panelRef.current.onBlur(e);\n }\n };\n\n if (operationRef) {\n operationRef.current = {\n onKeyDown: onInternalKeyDown,\n onClose: function onClose() {\n if (panelRef.current && panelRef.current.onClose) {\n panelRef.current.onClose();\n }\n }\n };\n } // ============================ Effect ============================\n\n\n React.useEffect(function () {\n if (value && !initRef.current) {\n setInnerViewDate(value);\n }\n }, [value]);\n React.useEffect(function () {\n initRef.current = false;\n }, []); // ============================ Panels ============================\n\n var panelNode;\n\n var pickerProps = _objectSpread({}, props, {\n operationRef: panelRef,\n prefixCls: prefixCls,\n viewDate: viewDate,\n value: mergedValue,\n onViewDateChange: setViewDate,\n sourceMode: sourceMode,\n onPanelChange: onInternalPanelChange,\n disabledDate: picker === mergedMode ? disabledDate : undefined\n });\n\n delete pickerProps.onChange;\n delete pickerProps.onSelect;\n\n switch (mergedMode) {\n case 'decade':\n panelNode = React.createElement(DecadePanel, Object.assign({}, pickerProps, {\n onSelect: function onSelect(date, type) {\n setViewDate(date);\n triggerSelect(date, type);\n }\n }));\n break;\n\n case 'year':\n panelNode = React.createElement(YearPanel, Object.assign({}, pickerProps, {\n onSelect: function onSelect(date, type) {\n setViewDate(date);\n triggerSelect(date, type);\n }\n }));\n break;\n\n case 'month':\n panelNode = React.createElement(MonthPanel, Object.assign({}, pickerProps, {\n onSelect: function onSelect(date, type) {\n setViewDate(date);\n triggerSelect(date, type);\n }\n }));\n break;\n\n case 'quarter':\n panelNode = React.createElement(QuarterPanel, Object.assign({}, pickerProps, {\n onSelect: function onSelect(date, type) {\n setViewDate(date);\n triggerSelect(date, type);\n }\n }));\n break;\n\n case 'week':\n panelNode = React.createElement(WeekPanel, Object.assign({}, pickerProps, {\n onSelect: function onSelect(date, type) {\n setViewDate(date);\n triggerSelect(date, type);\n }\n }));\n break;\n\n case 'time':\n delete pickerProps.showTime;\n panelNode = React.createElement(TimePanel, Object.assign({}, pickerProps, _typeof(showTime) === 'object' ? showTime : null, {\n onSelect: function onSelect(date, type) {\n setViewDate(date);\n triggerSelect(date, type);\n }\n }));\n break;\n\n default:\n if (showTime) {\n panelNode = React.createElement(DatetimePanel, Object.assign({}, pickerProps, {\n onSelect: function onSelect(date, type) {\n setViewDate(date);\n triggerSelect(date, type);\n }\n }));\n } else {\n panelNode = React.createElement(DatePanel, Object.assign({}, pickerProps, {\n onSelect: function onSelect(date, type) {\n setViewDate(date);\n triggerSelect(date, type);\n }\n }));\n }\n\n } // ============================ Footer ============================\n\n\n var extraFooter;\n var rangesNode;\n\n if (!hideRanges) {\n extraFooter = getExtraFooter(prefixCls, mergedMode, renderExtraFooter);\n rangesNode = getRanges({\n prefixCls: prefixCls,\n components: components,\n needConfirmButton: needConfirmButton,\n okDisabled: !mergedValue || disabledDate && disabledDate(mergedValue),\n locale: locale,\n onNow: needConfirmButton && function () {\n triggerSelect(generateConfig.getNow(), 'submit');\n },\n onOk: function onOk() {\n if (mergedValue) {\n triggerSelect(mergedValue, 'submit', true);\n\n if (_onOk) {\n _onOk(mergedValue);\n }\n }\n }\n });\n }\n\n var todayNode;\n\n if (showToday && mergedMode === 'date' && picker === 'date' && !showTime) {\n todayNode = React.createElement(\"a\", {\n className: \"\".concat(prefixCls, \"-today-btn\"),\n onClick: function onClick() {\n triggerSelect(generateConfig.getNow(), 'mouse', true);\n }\n }, locale.today);\n }\n\n return React.createElement(PanelContext.Provider, {\n value: _objectSpread({}, panelContext, {\n hideHeader: 'hideHeader' in props ? hideHeader : panelContext.hideHeader,\n hidePrevBtn: inRange && panelPosition === 'right',\n hideNextBtn: inRange && panelPosition === 'left'\n })\n }, React.createElement(\"div\", {\n tabIndex: tabIndex,\n className: classNames(\"\".concat(prefixCls, \"-panel\"), className, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-panel-has-range\"), rangedValue && rangedValue[0] && rangedValue[1]), _defineProperty(_classNames, \"\".concat(prefixCls, \"-panel-has-range-hover\"), hoverRangedValue && hoverRangedValue[0] && hoverRangedValue[1]), _defineProperty(_classNames, \"\".concat(prefixCls, \"-panel-rtl\"), direction === 'rtl'), _classNames)),\n style: style,\n onKeyDown: onInternalKeyDown,\n onBlur: onInternalBlur,\n onMouseDown: onMouseDown,\n ref: panelDivRef\n }, panelNode, extraFooter || rangesNode || todayNode ? React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-footer\")\n }, extraFooter, rangesNode, todayNode) : null));\n}\n\nexport default PickerPanel;\n/* eslint-enable */","function _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\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport Trigger from 'rc-trigger';\nvar BUILT_IN_PLACEMENTS = {\n bottomLeft: {\n points: ['tl', 'bl'],\n offset: [0, 4],\n overflow: {\n adjustX: 1,\n adjustY: 1\n }\n },\n bottomRight: {\n points: ['tr', 'br'],\n offset: [0, 4],\n overflow: {\n adjustX: 1,\n adjustY: 1\n }\n },\n topLeft: {\n points: ['bl', 'tl'],\n offset: [0, -4],\n overflow: {\n adjustX: 0,\n adjustY: 1\n }\n },\n topRight: {\n points: ['br', 'tr'],\n offset: [0, -4],\n overflow: {\n adjustX: 0,\n adjustY: 1\n }\n }\n};\n\nfunction PickerTrigger(_ref) {\n var _classNames;\n\n var prefixCls = _ref.prefixCls,\n popupElement = _ref.popupElement,\n popupStyle = _ref.popupStyle,\n visible = _ref.visible,\n dropdownClassName = _ref.dropdownClassName,\n dropdownAlign = _ref.dropdownAlign,\n transitionName = _ref.transitionName,\n getPopupContainer = _ref.getPopupContainer,\n children = _ref.children,\n range = _ref.range,\n popupPlacement = _ref.popupPlacement,\n direction = _ref.direction;\n var dropdownPrefixCls = \"\".concat(prefixCls, \"-dropdown\");\n\n var getPopupPlacement = function getPopupPlacement() {\n if (popupPlacement !== undefined) {\n return popupPlacement;\n }\n\n return direction === 'rtl' ? 'bottomRight' : 'bottomLeft';\n };\n\n return React.createElement(Trigger, {\n showAction: [],\n hideAction: [],\n popupPlacement: getPopupPlacement(),\n builtinPlacements: BUILT_IN_PLACEMENTS,\n prefixCls: dropdownPrefixCls,\n popupTransitionName: transitionName,\n popup: popupElement,\n popupAlign: dropdownAlign,\n popupVisible: visible,\n popupClassName: classNames(dropdownClassName, (_classNames = {}, _defineProperty(_classNames, \"\".concat(dropdownPrefixCls, \"-range\"), range), _defineProperty(_classNames, \"\".concat(dropdownPrefixCls, \"-rtl\"), direction === 'rtl'), _classNames)),\n popupStyle: popupStyle,\n getPopupContainer: getPopupContainer\n }, children);\n}\n\nexport default PickerTrigger;","function _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(n); 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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nimport * as React from 'react';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport { addGlobalMouseDownEvent } from '../utils/uiUtil';\nexport default function usePickerInput(_ref) {\n var open = _ref.open,\n isClickOutside = _ref.isClickOutside,\n triggerOpen = _ref.triggerOpen,\n forwardKeyDown = _ref.forwardKeyDown,\n blurToCancel = _ref.blurToCancel,\n onSubmit = _ref.onSubmit,\n onCancel = _ref.onCancel,\n _onFocus = _ref.onFocus,\n _onBlur = _ref.onBlur;\n\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n typing = _React$useState2[0],\n setTyping = _React$useState2[1];\n\n var _React$useState3 = React.useState(false),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n focused = _React$useState4[0],\n setFocused = _React$useState4[1];\n /**\n * We will prevent blur to handle open event when user click outside,\n * since this will repeat trigger `onOpenChange` event.\n */\n\n\n var preventBlurRef = React.useRef(false);\n var inputProps = {\n onMouseDown: function onMouseDown() {\n setTyping(true);\n triggerOpen(true);\n },\n onKeyDown: function onKeyDown(e) {\n switch (e.which) {\n case KeyCode.ENTER:\n {\n if (!open) {\n triggerOpen(true);\n } else if (onSubmit() !== false) {\n setTyping(true);\n }\n\n e.preventDefault();\n return;\n }\n\n case KeyCode.TAB:\n {\n if (typing && open && !e.shiftKey) {\n setTyping(false);\n e.preventDefault();\n } else if (!typing && open) {\n if (!forwardKeyDown(e) && e.shiftKey) {\n setTyping(true);\n e.preventDefault();\n }\n }\n\n return;\n }\n\n case KeyCode.ESC:\n {\n setTyping(true);\n onCancel();\n return;\n }\n }\n\n if (!open && ![KeyCode.SHIFT].includes(e.which)) {\n triggerOpen(true);\n } else if (!typing) {\n // Let popup panel handle keyboard\n forwardKeyDown(e);\n }\n },\n onFocus: function onFocus(e) {\n setTyping(true);\n setFocused(true);\n\n if (_onFocus) {\n _onFocus(e);\n }\n },\n onBlur: function onBlur(e) {\n if (preventBlurRef.current || !isClickOutside(document.activeElement)) {\n preventBlurRef.current = false;\n return;\n }\n\n if (blurToCancel) {\n setTimeout(function () {\n if (isClickOutside(document.activeElement)) {\n onCancel();\n }\n }, 0);\n } else {\n triggerOpen(false);\n }\n\n setFocused(false);\n\n if (_onBlur) {\n _onBlur(e);\n }\n }\n }; // Global click handler\n\n React.useEffect(function () {\n return addGlobalMouseDownEvent(function (_ref2) {\n var target = _ref2.target;\n\n if (open) {\n if (!isClickOutside(target)) {\n preventBlurRef.current = true; // Always set back in case `onBlur` prevented by user\n\n window.setTimeout(function () {\n preventBlurRef.current = false;\n }, 0);\n } else if (!focused) {\n triggerOpen(false);\n }\n }\n });\n });\n return [inputProps, {\n focused: focused,\n typing: typing\n }];\n}","function _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(n); 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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nimport * as React from 'react';\nexport default function useTextValueMapping(_ref) {\n var valueTexts = _ref.valueTexts,\n onTextChange = _ref.onTextChange;\n\n var _React$useState = React.useState(''),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n text = _React$useState2[0],\n setInnerText = _React$useState2[1];\n\n var valueTextsRef = React.useRef([]);\n valueTextsRef.current = valueTexts;\n\n function triggerTextChange(value) {\n setInnerText(value);\n onTextChange(value);\n }\n\n function resetText() {\n setInnerText(valueTextsRef.current[0]);\n }\n\n React.useEffect(function () {\n if (valueTexts.every(function (valText) {\n return valText !== text;\n })) {\n resetText();\n }\n }, [valueTexts.join('||')]);\n return [text, triggerTextChange, resetText];\n}","import shallowEqual from 'shallowequal';\nimport useMemo from \"rc-util/es/hooks/useMemo\";\nexport default function useValueTexts(value, _ref) {\n var formatList = _ref.formatList,\n generateConfig = _ref.generateConfig,\n locale = _ref.locale;\n return useMemo(function () {\n if (!value) {\n return [''];\n }\n\n return formatList.map(function (subFormat) {\n return generateConfig.locale.format(locale.locale, value, subFormat);\n });\n }, [value, formatList], function (prev, next) {\n return prev[0] !== next[0] || !shallowEqual(prev[1], next[1]);\n });\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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(n); 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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\n/**\n * Removed:\n * - getCalendarContainer: use `getPopupContainer` instead\n * - onOk\n *\n * New Feature:\n * - picker\n * - allowEmpty\n * - selectable\n *\n * Tips: Should add faq about `datetime` mode with `defaultValue`\n */\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport warning from \"rc-util/es/warning\";\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport PickerPanel from './PickerPanel';\nimport PickerTrigger from './PickerTrigger';\nimport { isEqual } from './utils/dateUtil';\nimport getDataOrAriaProps, { toArray } from './utils/miscUtil';\nimport PanelContext from './PanelContext';\nimport { getDefaultFormat, getInputSize, elementsContains } from './utils/uiUtil';\nimport usePickerInput from './hooks/usePickerInput';\nimport useTextValueMapping from './hooks/useTextValueMapping';\nimport useValueTexts from './hooks/useValueTexts';\n\nfunction InnerPicker(props) {\n var _classNames2;\n\n var _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? 'rc-picker' : _props$prefixCls,\n id = props.id,\n tabIndex = props.tabIndex,\n style = props.style,\n className = props.className,\n dropdownClassName = props.dropdownClassName,\n dropdownAlign = props.dropdownAlign,\n popupStyle = props.popupStyle,\n transitionName = props.transitionName,\n generateConfig = props.generateConfig,\n locale = props.locale,\n inputReadOnly = props.inputReadOnly,\n allowClear = props.allowClear,\n autoFocus = props.autoFocus,\n showTime = props.showTime,\n _props$picker = props.picker,\n picker = _props$picker === void 0 ? 'date' : _props$picker,\n format = props.format,\n use12Hours = props.use12Hours,\n value = props.value,\n defaultValue = props.defaultValue,\n open = props.open,\n defaultOpen = props.defaultOpen,\n defaultOpenValue = props.defaultOpenValue,\n suffixIcon = props.suffixIcon,\n clearIcon = props.clearIcon,\n disabled = props.disabled,\n disabledDate = props.disabledDate,\n placeholder = props.placeholder,\n getPopupContainer = props.getPopupContainer,\n pickerRef = props.pickerRef,\n onChange = props.onChange,\n onOpenChange = props.onOpenChange,\n onFocus = props.onFocus,\n onBlur = props.onBlur,\n onMouseDown = props.onMouseDown,\n onMouseUp = props.onMouseUp,\n onMouseEnter = props.onMouseEnter,\n onMouseLeave = props.onMouseLeave,\n onContextMenu = props.onContextMenu,\n onClick = props.onClick,\n direction = props.direction,\n autoComplete = props.autoComplete;\n var inputRef = React.useRef(null);\n var needConfirmButton = picker === 'date' && !!showTime || picker === 'time'; // ============================= State =============================\n\n var formatList = toArray(getDefaultFormat(format, picker, showTime, use12Hours)); // Panel ref\n\n var panelDivRef = React.useRef(null);\n var inputDivRef = React.useRef(null); // Real value\n\n var _useMergedState = useMergedState(null, {\n value: value,\n defaultValue: defaultValue\n }),\n _useMergedState2 = _slicedToArray(_useMergedState, 2),\n mergedValue = _useMergedState2[0],\n setInnerValue = _useMergedState2[1]; // Selected value\n\n\n var _React$useState = React.useState(mergedValue),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n selectedValue = _React$useState2[0],\n setSelectedValue = _React$useState2[1]; // Operation ref\n\n\n var operationRef = React.useRef(null); // Open\n\n var _useMergedState3 = useMergedState(false, {\n value: open,\n defaultValue: defaultOpen,\n postState: function postState(postOpen) {\n return disabled ? false : postOpen;\n },\n onChange: function onChange(newOpen) {\n if (onOpenChange) {\n onOpenChange(newOpen);\n }\n\n if (!newOpen && operationRef.current && operationRef.current.onClose) {\n operationRef.current.onClose();\n }\n }\n }),\n _useMergedState4 = _slicedToArray(_useMergedState3, 2),\n mergedOpen = _useMergedState4[0],\n triggerInnerOpen = _useMergedState4[1]; // ============================= Text ==============================\n\n\n var valueTexts = useValueTexts(selectedValue, {\n formatList: formatList,\n generateConfig: generateConfig,\n locale: locale\n });\n\n var _useTextValueMapping = useTextValueMapping({\n valueTexts: valueTexts,\n onTextChange: function onTextChange(newText) {\n var inputDate = generateConfig.locale.parse(locale.locale, newText, formatList);\n\n if (inputDate && (!disabledDate || !disabledDate(inputDate))) {\n setSelectedValue(inputDate);\n }\n }\n }),\n _useTextValueMapping2 = _slicedToArray(_useTextValueMapping, 3),\n text = _useTextValueMapping2[0],\n triggerTextChange = _useTextValueMapping2[1],\n resetText = _useTextValueMapping2[2]; // ============================ Trigger ============================\n\n\n var triggerChange = function triggerChange(newValue) {\n setSelectedValue(newValue);\n setInnerValue(newValue);\n\n if (onChange && !isEqual(generateConfig, mergedValue, newValue)) {\n onChange(newValue, newValue ? generateConfig.locale.format(locale.locale, newValue, formatList[0]) : '');\n }\n };\n\n var triggerOpen = function triggerOpen(newOpen) {\n var preventChangeEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (disabled && newOpen) {\n return;\n }\n\n triggerInnerOpen(newOpen);\n\n if (!newOpen && !preventChangeEvent) {\n triggerChange(selectedValue);\n }\n };\n\n var forwardKeyDown = function forwardKeyDown(e) {\n if (mergedOpen && operationRef.current && operationRef.current.onKeyDown) {\n // Let popup panel handle keyboard\n return operationRef.current.onKeyDown(e);\n }\n /* istanbul ignore next */\n\n /* eslint-disable no-lone-blocks */\n\n\n {\n warning(false, 'Picker not correct forward KeyDown operation. Please help to fire issue about this.');\n return false;\n }\n };\n\n var onInternalMouseUp = function onInternalMouseUp() {\n if (onMouseUp) {\n onMouseUp.apply(void 0, arguments);\n }\n\n if (inputRef.current) {\n inputRef.current.focus();\n triggerOpen(true);\n }\n }; // ============================= Input =============================\n\n\n var _usePickerInput = usePickerInput({\n blurToCancel: needConfirmButton,\n open: mergedOpen,\n triggerOpen: triggerOpen,\n forwardKeyDown: forwardKeyDown,\n isClickOutside: function isClickOutside(target) {\n return !elementsContains([panelDivRef.current, inputDivRef.current], target);\n },\n onSubmit: function onSubmit() {\n if (disabledDate && disabledDate(selectedValue)) {\n return false;\n }\n\n triggerChange(selectedValue);\n triggerOpen(false, true);\n resetText();\n return true;\n },\n onCancel: function onCancel() {\n triggerOpen(false, true);\n setSelectedValue(mergedValue);\n resetText();\n },\n onFocus: onFocus,\n onBlur: onBlur\n }),\n _usePickerInput2 = _slicedToArray(_usePickerInput, 2),\n inputProps = _usePickerInput2[0],\n _usePickerInput2$ = _usePickerInput2[1],\n focused = _usePickerInput2$.focused,\n typing = _usePickerInput2$.typing; // ============================= Sync ==============================\n // Close should sync back with text value\n\n\n React.useEffect(function () {\n if (!mergedOpen) {\n setSelectedValue(mergedValue);\n\n if (!valueTexts.length || valueTexts[0] === '') {\n triggerTextChange('');\n } else if (!valueTexts.includes(text)) {\n resetText();\n }\n }\n }, [mergedOpen, valueTexts]); // Change picker should sync back with text value\n\n React.useEffect(function () {\n if (!mergedOpen) {\n resetText();\n }\n }, [picker]); // Sync innerValue with control mode\n\n React.useEffect(function () {\n // Sync select value\n setSelectedValue(mergedValue);\n }, [mergedValue]); // ============================ Private ============================\n\n if (pickerRef) {\n pickerRef.current = {\n focus: function focus() {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n },\n blur: function blur() {\n if (inputRef.current) {\n inputRef.current.blur();\n }\n }\n };\n } // ============================= Panel =============================\n\n\n var panelProps = _objectSpread({}, props, {\n className: undefined,\n style: undefined,\n pickerValue: undefined,\n onPickerValueChange: undefined\n });\n\n var panel = React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-panel-container\"),\n onMouseDown: function onMouseDown(e) {\n e.preventDefault();\n }\n }, React.createElement(PickerPanel, Object.assign({}, panelProps, {\n generateConfig: generateConfig,\n className: classNames(_defineProperty({}, \"\".concat(prefixCls, \"-panel-focused\"), !typing)),\n value: selectedValue,\n locale: locale,\n tabIndex: -1,\n onChange: setSelectedValue,\n direction: direction\n })));\n var suffixNode;\n\n if (suffixIcon) {\n suffixNode = React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-suffix\")\n }, suffixIcon);\n }\n\n var clearNode;\n\n if (allowClear && mergedValue && !disabled) {\n clearNode = React.createElement(\"span\", {\n onMouseDown: function onMouseDown(e) {\n e.preventDefault();\n e.stopPropagation();\n },\n onMouseUp: function onMouseUp(e) {\n e.preventDefault();\n e.stopPropagation();\n triggerChange(null);\n triggerOpen(false, true);\n },\n className: \"\".concat(prefixCls, \"-clear\")\n }, clearIcon || React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-clear-btn\")\n }));\n } // ============================ Warning ============================\n\n\n if (process.env.NODE_ENV !== 'production') {\n warning(!defaultOpenValue, '`defaultOpenValue` may confuse user for the current value status. Please use `defaultValue` instead.');\n } // ============================ Return =============================\n\n\n var onContextSelect = function onContextSelect(date, type) {\n if (type === 'submit' || type !== 'key' && !needConfirmButton) {\n // triggerChange will also update selected values\n triggerChange(date);\n triggerOpen(false, true);\n }\n };\n\n var popupPlacement = direction === 'rtl' ? 'bottomRight' : 'bottomLeft';\n return React.createElement(PanelContext.Provider, {\n value: {\n operationRef: operationRef,\n hideHeader: picker === 'time',\n panelRef: panelDivRef,\n onSelect: onContextSelect,\n open: mergedOpen,\n defaultOpenValue: defaultOpenValue\n }\n }, React.createElement(PickerTrigger, {\n visible: mergedOpen,\n popupElement: panel,\n popupStyle: popupStyle,\n prefixCls: prefixCls,\n dropdownClassName: dropdownClassName,\n dropdownAlign: dropdownAlign,\n getPopupContainer: getPopupContainer,\n transitionName: transitionName,\n popupPlacement: popupPlacement,\n direction: direction\n }, React.createElement(\"div\", {\n className: classNames(prefixCls, className, (_classNames2 = {}, _defineProperty(_classNames2, \"\".concat(prefixCls, \"-disabled\"), disabled), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-focused\"), focused), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _classNames2)),\n style: style,\n onMouseDown: onMouseDown,\n onMouseUp: onInternalMouseUp,\n onMouseEnter: onMouseEnter,\n onMouseLeave: onMouseLeave,\n onContextMenu: onContextMenu,\n onClick: onClick\n }, React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-input\"),\n ref: inputDivRef\n }, React.createElement(\"input\", Object.assign({\n id: id,\n tabIndex: tabIndex,\n disabled: disabled,\n readOnly: inputReadOnly || !typing,\n value: text,\n onChange: function onChange(e) {\n triggerTextChange(e.target.value);\n },\n autoFocus: autoFocus,\n placeholder: placeholder,\n ref: inputRef,\n title: text\n }, inputProps, {\n size: getInputSize(picker, formatList[0])\n }, getDataOrAriaProps(props), {\n autoComplete: autoComplete\n })), suffixNode, clearNode))));\n} // Wrap with class component to enable pass generic with instance method\n\n\nvar Picker = /*#__PURE__*/function (_React$Component) {\n _inherits(Picker, _React$Component);\n\n var _super = _createSuper(Picker);\n\n function Picker() {\n var _this;\n\n _classCallCheck(this, Picker);\n\n _this = _super.apply(this, arguments);\n _this.pickerRef = React.createRef();\n\n _this.focus = function () {\n if (_this.pickerRef.current) {\n _this.pickerRef.current.focus();\n }\n };\n\n _this.blur = function () {\n if (_this.pickerRef.current) {\n _this.pickerRef.current.blur();\n }\n };\n\n return _this;\n }\n\n _createClass(Picker, [{\n key: \"render\",\n value: function render() {\n return React.createElement(InnerPicker, Object.assign({}, this.props, {\n pickerRef: this.pickerRef\n }));\n }\n }]);\n\n return Picker;\n}(React.Component);\n\nexport default Picker;","import * as React from 'react';\nexport default function useWeekDisabled(_ref) {\n var disabledDate = _ref.disabledDate,\n locale = _ref.locale,\n generateConfig = _ref.generateConfig;\n var disabledCache = React.useMemo(function () {\n return new Map();\n }, [disabledDate]);\n\n function disabledWeekDate(date) {\n var weekStr = generateConfig.locale.format(locale.locale, date, 'YYYY-WW');\n\n if (!disabledCache.has(weekStr)) {\n var disabled = false;\n\n var checkDisabled = function checkDisabled(offset) {\n for (var i = 0; i < 7; i += 1) {\n var currentDate = generateConfig.addDate(date, i * offset);\n var currentWeekStr = generateConfig.locale.format(locale.locale, currentDate, 'YYYY-WW');\n\n if (currentWeekStr !== weekStr) {\n break;\n }\n\n if (disabledDate(currentDate)) {\n disabled = true;\n break;\n }\n }\n };\n\n checkDisabled(1);\n checkDisabled(-1);\n disabledCache.set(weekStr, disabled);\n }\n\n return disabledCache.get(weekStr);\n }\n\n return [disabledWeekDate];\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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(n); 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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nimport * as React from 'react';\nimport { getValue } from '../utils/miscUtil';\nimport { isSameDate } from '../utils/dateUtil';\nimport useWeekDisabled from './useWeekDisabled';\nexport default function useRangeDisabled(_ref) {\n var picker = _ref.picker,\n locale = _ref.locale,\n selectedValue = _ref.selectedValue,\n disabledDate = _ref.disabledDate,\n disabled = _ref.disabled,\n generateConfig = _ref.generateConfig;\n var startDate = getValue(selectedValue, 0);\n var endDate = getValue(selectedValue, 1);\n var disabledStartDate = React.useCallback(function (date) {\n if (disabledDate && disabledDate(date)) {\n return true;\n }\n\n if (disabled[1] && endDate) {\n return !isSameDate(generateConfig, date, endDate) && generateConfig.isAfter(date, endDate);\n }\n\n return false;\n }, [disabledDate, disabled[1], endDate]);\n var disableEndDate = React.useCallback(function (date) {\n if (disabledDate && disabledDate(date)) {\n return true;\n }\n\n if (startDate) {\n var compareStartDate = picker === 'week' ? generateConfig.addDate(startDate, -7) : startDate;\n return !isSameDate(generateConfig, date, compareStartDate) && generateConfig.isAfter(compareStartDate, date);\n }\n\n return false;\n }, [disabledDate, startDate, picker]); // Handle week date disabled\n\n var sharedWeekDisabledConfig = {\n generateConfig: generateConfig,\n locale: locale\n };\n\n var _useWeekDisabled = useWeekDisabled(_objectSpread({}, sharedWeekDisabledConfig, {\n disabledDate: disabledStartDate\n })),\n _useWeekDisabled2 = _slicedToArray(_useWeekDisabled, 1),\n disabledStartWeekDate = _useWeekDisabled2[0];\n\n var _useWeekDisabled3 = useWeekDisabled(_objectSpread({}, sharedWeekDisabledConfig, {\n disabledDate: disableEndDate\n })),\n _useWeekDisabled4 = _slicedToArray(_useWeekDisabled3, 1),\n disabledEndWeekDate = _useWeekDisabled4[0];\n\n if (picker === 'week') {\n return [disabledStartWeekDate, disabledEndWeekDate];\n }\n\n return [disabledStartDate, disableEndDate];\n}","function _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(n); 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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nimport * as React from 'react';\nimport { getValue, updateValues } from '../utils/miscUtil';\nimport { getClosingViewDate, isSameYear, isSameMonth, isSameDecade } from '../utils/dateUtil';\n\nfunction getStartEndDistance(startDate, endDate, picker, generateConfig) {\n var startNext = getClosingViewDate(startDate, picker, generateConfig, 1);\n\n function getDistance(compareFunc) {\n if (compareFunc(startDate, endDate)) {\n return 'same';\n }\n\n if (compareFunc(startNext, endDate)) {\n return 'closing';\n }\n\n return 'far';\n }\n\n switch (picker) {\n case 'year':\n return getDistance(function (start, end) {\n return isSameDecade(generateConfig, start, end);\n });\n\n case 'month':\n return getDistance(function (start, end) {\n return isSameYear(generateConfig, start, end);\n });\n\n default:\n return getDistance(function (start, end) {\n return isSameMonth(generateConfig, start, end);\n });\n }\n}\n\nfunction getRangeViewDate(values, index, picker, generateConfig) {\n var startDate = getValue(values, 0);\n var endDate = getValue(values, 1);\n\n if (index === 0) {\n return startDate;\n }\n\n if (startDate && endDate) {\n var distance = getStartEndDistance(startDate, endDate, picker, generateConfig);\n\n switch (distance) {\n case 'same':\n return startDate;\n\n case 'closing':\n return startDate;\n\n default:\n return getClosingViewDate(endDate, picker, generateConfig, -1);\n }\n }\n\n return startDate;\n}\n\nexport default function useRangeViewDates(_ref) {\n var values = _ref.values,\n picker = _ref.picker,\n defaultDates = _ref.defaultDates,\n generateConfig = _ref.generateConfig;\n\n var _React$useState = React.useState(function () {\n return [getValue(defaultDates, 0), getValue(defaultDates, 1)];\n }),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n defaultViewDates = _React$useState2[0],\n setDefaultViewDates = _React$useState2[1];\n\n var _React$useState3 = React.useState(null),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n viewDates = _React$useState4[0],\n setInternalViewDates = _React$useState4[1];\n\n var startDate = getValue(values, 0);\n var endDate = getValue(values, 1);\n\n function getViewDate(index) {\n // If set default view date, use it\n if (defaultViewDates[index]) {\n return defaultViewDates[index];\n }\n\n return getValue(viewDates, index) || getRangeViewDate(values, index, picker, generateConfig) || startDate || endDate || generateConfig.getNow();\n }\n\n function setViewDate(viewDate, index) {\n if (viewDate) {\n var newViewDates = updateValues(viewDates, viewDate, index); // Set view date will clean up default one\n\n setDefaultViewDates( // Should always be an array\n updateValues(defaultViewDates, null, index) || [null, null]); // Reset another one when not have value\n\n var anotherIndex = (index + 1) % 2;\n\n if (getValue(values, anotherIndex)) {\n newViewDates = updateValues(newViewDates, viewDate, anotherIndex);\n }\n\n setInternalViewDates(newViewDates);\n } else if (startDate || endDate) {\n // Reset all when has values when `viewDate` is `null` which means from open trigger\n setInternalViewDates(null);\n }\n }\n\n return [getViewDate, setViewDate];\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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(n); 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) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport warning from \"rc-util/es/warning\";\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport PickerTrigger from './PickerTrigger';\nimport PickerPanel from './PickerPanel';\nimport usePickerInput from './hooks/usePickerInput';\nimport getDataOrAriaProps, { toArray, getValue, updateValues } from './utils/miscUtil';\nimport { getDefaultFormat, getInputSize, elementsContains } from './utils/uiUtil';\nimport PanelContext from './PanelContext';\nimport { isEqual, getClosingViewDate, isSameDate } from './utils/dateUtil';\nimport useValueTexts from './hooks/useValueTexts';\nimport useTextValueMapping from './hooks/useTextValueMapping';\nimport RangeContext from './RangeContext';\nimport useRangeDisabled from './hooks/useRangeDisabled';\nimport getExtraFooter from './utils/getExtraFooter';\nimport getRanges from './utils/getRanges';\nimport useRangeViewDates from './hooks/useRangeViewDates';\n\nfunction reorderValues(values, generateConfig) {\n if (values && values[0] && values[1] && generateConfig.isAfter(values[0], values[1])) {\n return [values[1], values[0]];\n }\n\n return values;\n}\n\nfunction canValueTrigger(value, index, disabled, allowEmpty) {\n if (value) {\n return true;\n }\n\n if (allowEmpty && allowEmpty[index]) {\n return true;\n }\n\n if (disabled[(index + 1) % 2]) {\n return true;\n }\n\n return false;\n}\n\nfunction InnerRangePicker(props) {\n var _classNames2;\n\n var _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? 'rc-picker' : _props$prefixCls,\n id = props.id,\n style = props.style,\n className = props.className,\n popupStyle = props.popupStyle,\n dropdownClassName = props.dropdownClassName,\n transitionName = props.transitionName,\n dropdownAlign = props.dropdownAlign,\n getPopupContainer = props.getPopupContainer,\n generateConfig = props.generateConfig,\n locale = props.locale,\n placeholder = props.placeholder,\n autoFocus = props.autoFocus,\n disabled = props.disabled,\n format = props.format,\n _props$picker = props.picker,\n picker = _props$picker === void 0 ? 'date' : _props$picker,\n showTime = props.showTime,\n use12Hours = props.use12Hours,\n _props$separator = props.separator,\n separator = _props$separator === void 0 ? '~' : _props$separator,\n value = props.value,\n defaultValue = props.defaultValue,\n defaultPickerValue = props.defaultPickerValue,\n open = props.open,\n defaultOpen = props.defaultOpen,\n disabledDate = props.disabledDate,\n _disabledTime = props.disabledTime,\n ranges = props.ranges,\n allowEmpty = props.allowEmpty,\n allowClear = props.allowClear,\n suffixIcon = props.suffixIcon,\n clearIcon = props.clearIcon,\n pickerRef = props.pickerRef,\n inputReadOnly = props.inputReadOnly,\n mode = props.mode,\n renderExtraFooter = props.renderExtraFooter,\n onChange = props.onChange,\n onOpenChange = props.onOpenChange,\n onPanelChange = props.onPanelChange,\n onCalendarChange = props.onCalendarChange,\n _onFocus = props.onFocus,\n onBlur = props.onBlur,\n _onOk = props.onOk,\n components = props.components,\n order = props.order,\n direction = props.direction,\n activePickerIndex = props.activePickerIndex;\n var needConfirmButton = picker === 'date' && !!showTime || picker === 'time';\n var containerRef = React.useRef(null);\n var panelDivRef = React.useRef(null);\n var startInputDivRef = React.useRef(null);\n var endInputDivRef = React.useRef(null);\n var separatorRef = React.useRef(null);\n var startInputRef = React.useRef(null);\n var endInputRef = React.useRef(null); // ============================= Misc ==============================\n\n var formatList = toArray(getDefaultFormat(format, picker, showTime, use12Hours)); // Active picker\n\n var _useMergedState = useMergedState(0, {\n value: activePickerIndex\n }),\n _useMergedState2 = _slicedToArray(_useMergedState, 2),\n mergedActivePickerIndex = _useMergedState2[0],\n setMergedActivePickerIndex = _useMergedState2[1]; // Operation ref\n\n\n var operationRef = React.useRef(null);\n var mergedDisabled = React.useMemo(function () {\n if (Array.isArray(disabled)) {\n return disabled;\n }\n\n return [disabled || false, disabled || false];\n }, [disabled]); // ============================= Value =============================\n\n var _useMergedState3 = useMergedState(null, {\n value: value,\n defaultValue: defaultValue,\n postState: function postState(values) {\n return picker === 'time' && !order ? values : reorderValues(values, generateConfig);\n }\n }),\n _useMergedState4 = _slicedToArray(_useMergedState3, 2),\n mergedValue = _useMergedState4[0],\n setInnerValue = _useMergedState4[1]; // =========================== View Date ===========================\n // Config view panel\n\n\n var _useRangeViewDates = useRangeViewDates({\n values: mergedValue,\n picker: picker,\n defaultDates: defaultPickerValue,\n generateConfig: generateConfig\n }),\n _useRangeViewDates2 = _slicedToArray(_useRangeViewDates, 2),\n getViewDate = _useRangeViewDates2[0],\n setViewDate = _useRangeViewDates2[1]; // ========================= Select Values =========================\n\n\n var _useMergedState5 = useMergedState(mergedValue, {\n postState: function postState(values) {\n var postValues = values;\n\n if (mergedDisabled[0] && mergedDisabled[1]) {\n return postValues;\n } // Fill disabled unit\n\n\n for (var i = 0; i < 2; i += 1) {\n if (mergedDisabled[i] && !getValue(postValues, i) && !getValue(allowEmpty, i)) {\n postValues = updateValues(postValues, generateConfig.getNow(), i);\n }\n }\n\n return postValues;\n }\n }),\n _useMergedState6 = _slicedToArray(_useMergedState5, 2),\n selectedValue = _useMergedState6[0],\n setSelectedValue = _useMergedState6[1];\n\n var _React$useState = React.useState(null),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n rangeHoverValue = _React$useState2[0],\n setRangeHoverValue = _React$useState2[1]; // ========================== Hover Range ==========================\n\n\n var _React$useState3 = React.useState(null),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n hoverRangedValue = _React$useState4[0],\n setHoverRangedValue = _React$useState4[1];\n\n var onDateMouseEnter = function onDateMouseEnter(date) {\n setHoverRangedValue(updateValues(selectedValue, date, mergedActivePickerIndex));\n };\n\n var onDateMouseLeave = function onDateMouseLeave() {\n setHoverRangedValue(updateValues(selectedValue, null, mergedActivePickerIndex));\n }; // ============================= Modes =============================\n\n\n var _useMergedState7 = useMergedState([picker, picker], {\n value: mode\n }),\n _useMergedState8 = _slicedToArray(_useMergedState7, 2),\n mergedModes = _useMergedState8[0],\n setInnerModes = _useMergedState8[1];\n\n React.useEffect(function () {\n setInnerModes([picker, picker]);\n }, [picker]);\n\n var triggerModesChange = function triggerModesChange(modes, values) {\n setInnerModes(modes);\n\n if (onPanelChange) {\n onPanelChange(values, modes);\n }\n }; // ========================= Disable Date ==========================\n\n\n var _useRangeDisabled = useRangeDisabled({\n picker: picker,\n selectedValue: selectedValue,\n locale: locale,\n disabled: mergedDisabled,\n disabledDate: disabledDate,\n generateConfig: generateConfig\n }),\n _useRangeDisabled2 = _slicedToArray(_useRangeDisabled, 2),\n disabledStartDate = _useRangeDisabled2[0],\n disabledEndDate = _useRangeDisabled2[1]; // ============================= Open ==============================\n\n\n var _useMergedState9 = useMergedState(false, {\n value: open,\n defaultValue: defaultOpen,\n postState: function postState(postOpen) {\n return mergedDisabled[mergedActivePickerIndex] ? false : postOpen;\n },\n onChange: function onChange(newOpen) {\n if (onOpenChange) {\n onOpenChange(newOpen);\n }\n\n if (!newOpen && operationRef.current && operationRef.current.onClose) {\n operationRef.current.onClose();\n }\n }\n }),\n _useMergedState10 = _slicedToArray(_useMergedState9, 2),\n mergedOpen = _useMergedState10[0],\n triggerInnerOpen = _useMergedState10[1];\n\n var startOpen = mergedOpen && mergedActivePickerIndex === 0;\n var endOpen = mergedOpen && mergedActivePickerIndex === 1; // ============================= Popup =============================\n // Popup min width\n\n var _React$useState5 = React.useState(0),\n _React$useState6 = _slicedToArray(_React$useState5, 2),\n popupMinWidth = _React$useState6[0],\n setPopupMinWidth = _React$useState6[1];\n\n React.useEffect(function () {\n if (!mergedOpen && containerRef.current) {\n setPopupMinWidth(containerRef.current.offsetWidth);\n }\n }, [mergedOpen]); // ============================ Trigger ============================\n\n var _triggerOpen;\n\n var triggerChange = function triggerChange(newValue) {\n var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var _config$forceInput = config.forceInput,\n forceInput = _config$forceInput === void 0 ? true : _config$forceInput,\n source = config.source;\n var values = newValue;\n var startValue = getValue(values, 0);\n var endValue = getValue(values, 1);\n\n if (startValue && endValue && generateConfig.isAfter(startValue, endValue)) {\n if (!isSameDate(generateConfig, startValue, endValue)) {\n // Clean up end date when start date is after end date\n values = [startValue, null];\n endValue = null;\n } else if (picker !== 'time' || order !== false) {\n // Reorder when in same date\n values = reorderValues(values, generateConfig);\n }\n }\n\n setSelectedValue(values);\n var startStr = values && values[0] ? generateConfig.locale.format(locale.locale, values[0], formatList[0]) : '';\n var endStr = values && values[1] ? generateConfig.locale.format(locale.locale, values[1], formatList[0]) : '';\n\n if (onCalendarChange) {\n onCalendarChange(values, [startStr, endStr]);\n }\n\n var canStartValueTrigger = canValueTrigger(startValue, 0, mergedDisabled, allowEmpty);\n var canEndValueTrigger = canValueTrigger(endValue, 1, mergedDisabled, allowEmpty);\n var canTrigger = values === null || canStartValueTrigger && canEndValueTrigger;\n\n if (canTrigger) {\n // Trigger onChange only when value is validate\n setInnerValue(values);\n\n if (source !== 'open') {\n _triggerOpen(false, mergedActivePickerIndex, true);\n }\n\n if (onChange && (!isEqual(generateConfig, getValue(mergedValue, 0), startValue) || !isEqual(generateConfig, getValue(mergedValue, 1), endValue))) {\n onChange(values, [startStr, endStr]);\n }\n } else if (forceInput) {\n // Open miss value panel to force user input\n var missingValueIndex = canStartValueTrigger ? 1 : 0; // Same index means user choice to close picker\n\n if (missingValueIndex === mergedActivePickerIndex) {\n return;\n }\n\n if (source !== 'open') {\n _triggerOpen(true, missingValueIndex);\n } // Delay to focus to avoid input blur trigger expired selectedValues\n\n\n setTimeout(function () {\n var inputRef = [startInputRef, endInputRef][missingValueIndex];\n\n if (inputRef.current) {\n inputRef.current.focus();\n }\n }, 0);\n }\n };\n\n _triggerOpen = function triggerOpen(newOpen, index) {\n var preventChangeEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n if (newOpen) {\n setMergedActivePickerIndex(index);\n triggerInnerOpen(newOpen); // Open to reset view date\n\n if (!mergedOpen) {\n setViewDate(null, index);\n }\n } else if (mergedActivePickerIndex === index) {\n triggerInnerOpen(newOpen);\n\n if (!preventChangeEvent) {\n triggerChange(selectedValue, {\n source: 'open'\n });\n }\n }\n };\n\n var forwardKeyDown = function forwardKeyDown(e) {\n if (mergedOpen && operationRef.current && operationRef.current.onKeyDown) {\n // Let popup panel handle keyboard\n return operationRef.current.onKeyDown(e);\n }\n /* istanbul ignore next */\n\n /* eslint-disable no-lone-blocks */\n\n\n {\n warning(false, 'Picker not correct forward KeyDown operation. Please help to fire issue about this.');\n return false;\n }\n }; // ============================= Text ==============================\n\n\n var sharedTextHooksProps = {\n formatList: formatList,\n generateConfig: generateConfig,\n locale: locale\n };\n var startValueTexts = useValueTexts(getValue(selectedValue, 0), sharedTextHooksProps);\n var endValueTexts = useValueTexts(getValue(selectedValue, 1), sharedTextHooksProps);\n\n var _onTextChange = function onTextChange(newText, index) {\n var inputDate = generateConfig.locale.parse(locale.locale, newText, formatList);\n var disabledFunc = index === 0 ? disabledStartDate : disabledEndDate;\n\n if (inputDate && !disabledFunc(inputDate)) {\n setSelectedValue(updateValues(selectedValue, inputDate, index));\n setViewDate(inputDate, index);\n }\n };\n\n var _useTextValueMapping = useTextValueMapping({\n valueTexts: startValueTexts,\n onTextChange: function onTextChange(newText) {\n return _onTextChange(newText, 0);\n }\n }),\n _useTextValueMapping2 = _slicedToArray(_useTextValueMapping, 3),\n startText = _useTextValueMapping2[0],\n triggerStartTextChange = _useTextValueMapping2[1],\n resetStartText = _useTextValueMapping2[2];\n\n var _useTextValueMapping3 = useTextValueMapping({\n valueTexts: endValueTexts,\n onTextChange: function onTextChange(newText) {\n return _onTextChange(newText, 1);\n }\n }),\n _useTextValueMapping4 = _slicedToArray(_useTextValueMapping3, 3),\n endText = _useTextValueMapping4[0],\n triggerEndTextChange = _useTextValueMapping4[1],\n resetEndText = _useTextValueMapping4[2]; // ============================= Input =============================\n\n\n var getSharedInputHookProps = function getSharedInputHookProps(index, resetText) {\n return {\n blurToCancel: needConfirmButton,\n forwardKeyDown: forwardKeyDown,\n onBlur: onBlur,\n isClickOutside: function isClickOutside(target) {\n return !elementsContains([panelDivRef.current, startInputDivRef.current, endInputDivRef.current], target);\n },\n onFocus: function onFocus(e) {\n setMergedActivePickerIndex(index);\n\n if (_onFocus) {\n _onFocus(e);\n }\n },\n triggerOpen: function triggerOpen(newOpen) {\n return _triggerOpen(newOpen, index);\n },\n onSubmit: function onSubmit() {\n triggerChange(selectedValue);\n resetText();\n },\n onCancel: function onCancel() {\n _triggerOpen(false, index, true);\n\n setSelectedValue(mergedValue);\n resetText();\n }\n };\n };\n\n var _usePickerInput = usePickerInput(_objectSpread({}, getSharedInputHookProps(0, resetStartText), {\n open: startOpen\n })),\n _usePickerInput2 = _slicedToArray(_usePickerInput, 2),\n startInputProps = _usePickerInput2[0],\n _usePickerInput2$ = _usePickerInput2[1],\n startFocused = _usePickerInput2$.focused,\n startTyping = _usePickerInput2$.typing;\n\n var _usePickerInput3 = usePickerInput(_objectSpread({}, getSharedInputHookProps(1, resetEndText), {\n open: endOpen\n })),\n _usePickerInput4 = _slicedToArray(_usePickerInput3, 2),\n endInputProps = _usePickerInput4[0],\n _usePickerInput4$ = _usePickerInput4[1],\n endFocused = _usePickerInput4$.focused,\n endTyping = _usePickerInput4$.typing; // ============================= Sync ==============================\n // Close should sync back with text value\n\n\n var startStr = mergedValue && mergedValue[0] ? generateConfig.locale.format(locale.locale, mergedValue[0], 'YYYYMMDDHHmmss') : '';\n var endStr = mergedValue && mergedValue[1] ? generateConfig.locale.format(locale.locale, mergedValue[1], 'YYYYMMDDHHmmss') : '';\n React.useEffect(function () {\n if (!mergedOpen) {\n setSelectedValue(mergedValue);\n\n if (!startValueTexts.length || startValueTexts[0] === '') {\n triggerStartTextChange('');\n } else if (!startValueTexts.includes(startText)) {\n resetStartText();\n }\n\n if (!endValueTexts.length || endValueTexts[0] === '') {\n triggerEndTextChange('');\n } else if (!endValueTexts.includes(endText)) {\n resetEndText();\n }\n }\n }, [mergedOpen, startValueTexts, endValueTexts]); // Sync innerValue with control mode\n\n React.useEffect(function () {\n setSelectedValue(mergedValue);\n }, [startStr, endStr]); // ============================ Warning ============================\n\n if (process.env.NODE_ENV !== 'production') {\n if (value && Array.isArray(disabled) && (getValue(disabled, 0) && !getValue(value, 0) || getValue(disabled, 1) && !getValue(value, 1))) {\n warning(false, '`disabled` should not set with empty `value`. You should set `allowEmpty` or `value` instead.');\n }\n } // ============================ Private ============================\n\n\n if (pickerRef) {\n pickerRef.current = {\n focus: function focus() {\n if (startInputRef.current) {\n startInputRef.current.focus();\n }\n },\n blur: function blur() {\n if (startInputRef.current) {\n startInputRef.current.blur();\n }\n\n if (endInputRef.current) {\n endInputRef.current.blur();\n }\n }\n };\n } // ============================ Ranges =============================\n\n\n var rangeLabels = Object.keys(ranges || {});\n var rangeList = rangeLabels.map(function (label) {\n var range = ranges[label];\n var newValues = typeof range === 'function' ? range() : range;\n return {\n label: label,\n onClick: function onClick() {\n triggerChange(newValues);\n },\n onMouseEnter: function onMouseEnter() {\n setRangeHoverValue(newValues);\n },\n onMouseLeave: function onMouseLeave() {\n setRangeHoverValue(null);\n }\n };\n }); // ============================= Panel =============================\n\n function renderPanel() {\n var panelPosition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var panelProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var panelHoverRangedValue = null;\n\n if (mergedOpen && hoverRangedValue && hoverRangedValue[0] && hoverRangedValue[1] && generateConfig.isAfter(hoverRangedValue[1], hoverRangedValue[0])) {\n panelHoverRangedValue = hoverRangedValue;\n }\n\n var panelShowTime = showTime;\n\n if (showTime && _typeof(showTime) === 'object' && showTime.defaultValue) {\n var timeDefaultValues = showTime.defaultValue;\n panelShowTime = _objectSpread({}, showTime, {\n defaultValue: getValue(timeDefaultValues, mergedActivePickerIndex) || undefined\n });\n }\n\n return React.createElement(RangeContext.Provider, {\n value: {\n inRange: true,\n panelPosition: panelPosition,\n rangedValue: rangeHoverValue || selectedValue,\n hoverRangedValue: panelHoverRangedValue\n }\n }, React.createElement(PickerPanel, Object.assign({}, props, panelProps, {\n showTime: panelShowTime,\n mode: mergedModes[mergedActivePickerIndex],\n generateConfig: generateConfig,\n style: undefined,\n direction: direction,\n disabledDate: mergedActivePickerIndex === 0 ? disabledStartDate : disabledEndDate,\n disabledTime: function disabledTime(date) {\n if (_disabledTime) {\n return _disabledTime(date, mergedActivePickerIndex === 0 ? 'start' : 'end');\n }\n\n return false;\n },\n className: classNames(_defineProperty({}, \"\".concat(prefixCls, \"-panel-focused\"), mergedActivePickerIndex === 0 ? !startTyping : !endTyping)),\n value: getValue(selectedValue, mergedActivePickerIndex),\n locale: locale,\n tabIndex: -1,\n onPanelChange: function onPanelChange(date, newMode) {\n triggerModesChange(updateValues(mergedModes, newMode, mergedActivePickerIndex), updateValues(selectedValue, date, mergedActivePickerIndex));\n var viewDate = date;\n\n if (panelPosition === 'right') {\n viewDate = getClosingViewDate(viewDate, newMode, generateConfig, -1);\n }\n\n setViewDate(viewDate, mergedActivePickerIndex);\n },\n onOk: null,\n onSelect: undefined,\n onChange: undefined,\n defaultValue: undefined,\n defaultPickerValue: undefined\n })));\n }\n\n var arrowLeft = 0;\n var panelLeft = 0;\n\n if (mergedActivePickerIndex && startInputDivRef.current && separatorRef.current && panelDivRef.current) {\n // Arrow offset\n arrowLeft = startInputDivRef.current.offsetWidth + separatorRef.current.offsetWidth;\n\n if (panelDivRef.current.offsetWidth && arrowLeft > panelDivRef.current.offsetWidth) {\n panelLeft = arrowLeft;\n }\n }\n\n var arrowPositionStyle = direction === 'rtl' ? {\n right: arrowLeft\n } : {\n left: arrowLeft\n };\n\n function renderPanels() {\n var panels;\n var extraNode = getExtraFooter(prefixCls, mergedModes[mergedActivePickerIndex], renderExtraFooter);\n var rangesNode = getRanges({\n prefixCls: prefixCls,\n components: components,\n needConfirmButton: needConfirmButton,\n okDisabled: !getValue(selectedValue, mergedActivePickerIndex),\n locale: locale,\n rangeList: rangeList,\n onOk: function onOk() {\n if (getValue(selectedValue, mergedActivePickerIndex)) {\n triggerChange(selectedValue);\n\n if (_onOk) {\n _onOk(selectedValue);\n }\n }\n }\n });\n\n if (picker !== 'time' && !showTime) {\n var viewDate = getViewDate(mergedActivePickerIndex);\n var nextViewDate = getClosingViewDate(viewDate, picker, generateConfig);\n var currentMode = mergedModes[mergedActivePickerIndex];\n var showDoublePanel = currentMode === picker;\n var leftPanel = renderPanel(showDoublePanel ? 'left' : false, {\n pickerValue: viewDate,\n onPickerValueChange: function onPickerValueChange(newViewDate) {\n setViewDate(newViewDate, mergedActivePickerIndex);\n }\n });\n var rightPanel = renderPanel('right', {\n pickerValue: nextViewDate,\n onPickerValueChange: function onPickerValueChange(newViewDate) {\n setViewDate(getClosingViewDate(newViewDate, picker, generateConfig, -1), mergedActivePickerIndex);\n }\n });\n\n if (direction === 'rtl') {\n panels = React.createElement(React.Fragment, null, rightPanel, showDoublePanel && leftPanel);\n } else {\n panels = React.createElement(React.Fragment, null, leftPanel, showDoublePanel && rightPanel);\n }\n } else {\n panels = renderPanel();\n }\n\n return React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-panel-container\"),\n style: {\n marginLeft: panelLeft\n },\n ref: panelDivRef,\n onMouseDown: function onMouseDown(e) {\n e.preventDefault();\n }\n }, React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-panels\")\n }, panels), (extraNode || rangesNode) && React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-footer\")\n }, extraNode, rangesNode));\n }\n\n var rangePanel = React.createElement(\"div\", {\n className: classNames(\"\".concat(prefixCls, \"-range-wrapper\"), \"\".concat(prefixCls, \"-\").concat(picker, \"-range-wrapper\")),\n style: {\n minWidth: popupMinWidth\n }\n }, React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-range-arrow\"),\n style: arrowPositionStyle\n }), renderPanels()); // ============================= Icons =============================\n\n var suffixNode;\n\n if (suffixIcon) {\n suffixNode = React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-suffix\")\n }, suffixIcon);\n }\n\n var clearNode;\n\n if (allowClear && (getValue(mergedValue, 0) && !mergedDisabled[0] || getValue(mergedValue, 1) && !mergedDisabled[1])) {\n clearNode = React.createElement(\"span\", {\n onMouseDown: function onMouseDown(e) {\n e.preventDefault();\n e.stopPropagation();\n },\n onMouseUp: function onMouseUp(e) {\n e.preventDefault();\n e.stopPropagation();\n var values = mergedValue;\n\n if (!mergedDisabled[0]) {\n values = updateValues(values, null, 0);\n }\n\n if (!mergedDisabled[1]) {\n values = updateValues(values, null, 1);\n }\n\n triggerChange(values, {\n forceInput: false\n });\n },\n className: \"\".concat(prefixCls, \"-clear\")\n }, clearIcon || React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-clear-btn\")\n }));\n }\n\n var inputSharedProps = {\n size: getInputSize(picker, formatList[0])\n };\n var activeBarLeft = 0;\n var activeBarWidth = 0;\n\n if (startInputDivRef.current && endInputDivRef.current && separatorRef.current) {\n if (mergedActivePickerIndex === 0) {\n activeBarWidth = startInputDivRef.current.offsetWidth;\n } else {\n activeBarLeft = arrowLeft;\n activeBarWidth = endInputDivRef.current.offsetWidth;\n }\n }\n\n var activeBarPositionStyle = direction === 'rtl' ? {\n right: activeBarLeft\n } : {\n left: activeBarLeft\n }; // ============================ Return =============================\n\n var onContextSelect = function onContextSelect(date, type) {\n var values = updateValues(selectedValue, date, mergedActivePickerIndex);\n\n if (type === 'submit' || type !== 'key' && !needConfirmButton) {\n // triggerChange will also update selected values\n triggerChange(values);\n } else {\n setSelectedValue(values);\n }\n };\n\n return React.createElement(PanelContext.Provider, {\n value: {\n operationRef: operationRef,\n hideHeader: picker === 'time',\n onDateMouseEnter: onDateMouseEnter,\n onDateMouseLeave: onDateMouseLeave,\n hideRanges: true,\n onSelect: onContextSelect,\n open: mergedOpen\n }\n }, React.createElement(PickerTrigger, {\n visible: mergedOpen,\n popupElement: rangePanel,\n popupStyle: popupStyle,\n prefixCls: prefixCls,\n dropdownClassName: dropdownClassName,\n dropdownAlign: dropdownAlign,\n getPopupContainer: getPopupContainer,\n transitionName: transitionName,\n range: true,\n direction: direction\n }, React.createElement(\"div\", Object.assign({\n ref: containerRef,\n className: classNames(prefixCls, \"\".concat(prefixCls, \"-range\"), className, (_classNames2 = {}, _defineProperty(_classNames2, \"\".concat(prefixCls, \"-disabled\"), mergedDisabled[0] && mergedDisabled[1]), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-focused\"), mergedActivePickerIndex === 0 ? startFocused : endFocused), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _classNames2)),\n style: style\n }, getDataOrAriaProps(props)), React.createElement(\"div\", {\n className: classNames(\"\".concat(prefixCls, \"-input\"), _defineProperty({}, \"\".concat(prefixCls, \"-input-active\"), mergedActivePickerIndex === 0)),\n ref: startInputDivRef\n }, React.createElement(\"input\", Object.assign({\n id: id,\n disabled: mergedDisabled[0],\n readOnly: inputReadOnly || !startTyping,\n value: startText,\n onChange: function onChange(e) {\n triggerStartTextChange(e.target.value);\n },\n autoFocus: autoFocus,\n placeholder: getValue(placeholder, 0) || '',\n ref: startInputRef\n }, startInputProps, inputSharedProps))), React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-range-separator\"),\n ref: separatorRef\n }, separator), React.createElement(\"div\", {\n className: classNames(\"\".concat(prefixCls, \"-input\"), _defineProperty({}, \"\".concat(prefixCls, \"-input-active\"), mergedActivePickerIndex === 1)),\n ref: endInputDivRef\n }, React.createElement(\"input\", Object.assign({\n disabled: mergedDisabled[1],\n readOnly: inputReadOnly || !endTyping,\n value: endText,\n onChange: function onChange(e) {\n triggerEndTextChange(e.target.value);\n },\n placeholder: getValue(placeholder, 1) || '',\n ref: endInputRef\n }, endInputProps, inputSharedProps))), React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-active-bar\"),\n style: _objectSpread({}, activeBarPositionStyle, {\n width: activeBarWidth,\n position: 'absolute'\n })\n }), suffixNode, clearNode)));\n} // Wrap with class component to enable pass generic with instance method\n\n\nvar RangePicker = /*#__PURE__*/function (_React$Component) {\n _inherits(RangePicker, _React$Component);\n\n var _super = _createSuper(RangePicker);\n\n function RangePicker() {\n var _this;\n\n _classCallCheck(this, RangePicker);\n\n _this = _super.apply(this, arguments);\n _this.pickerRef = React.createRef();\n\n _this.focus = function () {\n if (_this.pickerRef.current) {\n _this.pickerRef.current.focus();\n }\n };\n\n _this.blur = function () {\n if (_this.pickerRef.current) {\n _this.pickerRef.current.blur();\n }\n };\n\n return _this;\n }\n\n _createClass(RangePicker, [{\n key: \"render\",\n value: function render() {\n return React.createElement(InnerRangePicker, Object.assign({}, this.props, {\n pickerRef: this.pickerRef\n }));\n }\n }]);\n\n return RangePicker;\n}(React.Component);\n\nexport default RangePicker;","import Picker from './Picker';\nimport PickerPanel from './PickerPanel';\nimport RangePicker from './RangePicker';\nexport { PickerPanel, RangePicker };\nexport default Picker;","import * as React from 'react';\nimport Select from '../select';\nimport { Group, Button } from '../radio';\nconst YearSelectOffset = 10;\nconst YearSelectTotal = 20;\nfunction YearSelect(props) {\n const { fullscreen, validRange, generateConfig, locale, prefixCls, value, onChange, divRef, } = props;\n const year = generateConfig.getYear(value);\n let start = year - YearSelectOffset;\n let end = start + YearSelectTotal;\n if (validRange) {\n start = generateConfig.getYear(validRange[0]);\n end = generateConfig.getYear(validRange[1]) + 1;\n }\n const suffix = locale && locale.year === '年' ? '年' : '';\n const options = [];\n for (let index = start; index < end; index++) {\n options.push({ label: `${index}${suffix}`, value: index });\n }\n return (