antd-tag-input
Version:
```js import TagInput from 'antd-tag-input'; import 'antd-tag-input/dist/style.css'; ```
1,365 lines (1,364 loc) • 491 kB
JavaScript
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
var __spreadValues = (a, b2) => {
for (var prop in b2 || (b2 = {}))
if (__hasOwnProp.call(b2, prop))
__defNormalProp(a, prop, b2[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b2)) {
if (__propIsEnum.call(b2, prop))
__defNormalProp(a, prop, b2[prop]);
}
return a;
};
var __spreadProps = (a, b2) => __defProps(a, __getOwnPropDescs(b2));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
import * as React from "react";
import React__default, { useRef, useState, useEffect, useLayoutEffect, Component, createContext, useContext, forwardRef, useImperativeHandle } from "react";
import ReactDOM from "react-dom";
var _default = "";
var index$5 = "";
var index$4 = "";
var index$3 = "";
var index$2 = "";
var index$1 = "";
function _extends$1() {
_extends$1 = Object.assign || function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key2 in source) {
if (Object.prototype.hasOwnProperty.call(source, key2)) {
target[key2] = source[key2];
}
}
}
return target;
};
return _extends$1.apply(this, arguments);
}
function _defineProperty$1(obj, key2, value) {
if (key2 in obj) {
Object.defineProperty(obj, key2, {
value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key2] = value;
}
return obj;
}
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
var classnames = { exports: {} };
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
(function(module) {
(function() {
var hasOwn = {}.hasOwnProperty;
function classNames2() {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg)
continue;
var argType = typeof arg;
if (argType === "string" || argType === "number") {
classes.push(arg);
} else if (Array.isArray(arg)) {
if (arg.length) {
var inner = classNames2.apply(null, arg);
if (inner) {
classes.push(inner);
}
}
} else if (argType === "object") {
if (arg.toString === Object.prototype.toString) {
for (var key2 in arg) {
if (hasOwn.call(arg, key2) && arg[key2]) {
classes.push(key2);
}
}
} else {
classes.push(arg.toString());
}
}
}
return classes.join(" ");
}
if (module.exports) {
classNames2.default = classNames2;
module.exports = classNames2;
} else {
window.classNames = classNames2;
}
})();
})(classnames);
var classNames = classnames.exports;
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null)
return {};
var target = {};
var sourceKeys = Object.keys(source);
var key2, i;
for (i = 0; i < sourceKeys.length; i++) {
key2 = sourceKeys[i];
if (excluded.indexOf(key2) >= 0)
continue;
target[key2] = source[key2];
}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null)
return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key2, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key2 = sourceSymbolKeys[i];
if (excluded.indexOf(key2) >= 0)
continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key2))
continue;
target[key2] = source[key2];
}
}
return target;
}
function ownKeys$1(object4, enumerableOnly) {
var keys2 = Object.keys(object4);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object4);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
})), keys2.push.apply(keys2, symbols);
}
return keys2;
}
function _objectSpread2$1(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
i % 2 ? ownKeys$1(Object(source), true).forEach(function(key2) {
_defineProperty$1(target, key2, source[key2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function(key2) {
Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2));
});
}
return target;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a 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);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps)
_defineProperties(Constructor.prototype, protoProps);
if (staticProps)
_defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _setPrototypeOf$1(o, p2) {
_setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf2(o2, p3) {
o2.__proto__ = p3;
return o2;
};
return _setPrototypeOf$1(o, p2);
}
function _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
}
});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass)
_setPrototypeOf$1(subClass, superClass);
}
function _getPrototypeOf$1(o) {
_getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf$1(o);
}
function _isNativeReflectConstruct$1() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
return true;
} catch (e2) {
return false;
}
}
function _typeof$1(obj) {
"@babel/helpers - typeof";
return _typeof$1 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
return typeof obj2;
} : function(obj2) {
return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
}, _typeof$1(obj);
}
function _assertThisInitialized(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _possibleConstructorReturn(self2, call2) {
if (call2 && (_typeof$1(call2) === "object" || typeof call2 === "function")) {
return call2;
} else if (call2 !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self2);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
return function _createSuperInternal() {
var Super = _getPrototypeOf$1(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf$1(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr))
return arr;
}
function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null)
return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i)
break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null)
_i["return"]();
} finally {
if (_d)
throw _e;
}
}
return _arr;
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length)
len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o)
return;
if (typeof o === "string")
return _arrayLikeToArray(o, minLen);
var n2 = Object.prototype.toString.call(o).slice(8, -1);
if (n2 === "Object" && o.constructor)
n2 = o.constructor.name;
if (n2 === "Map" || n2 === "Set")
return Array.from(o);
if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2))
return _arrayLikeToArray(o, minLen);
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function findDOMNode(node) {
if (node instanceof HTMLElement) {
return node;
}
return ReactDOM.findDOMNode(node);
}
var reactIs = { exports: {} };
var reactIs_production_min = {};
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var b = typeof Symbol === "function" && Symbol.for, c = b ? Symbol.for("react.element") : 60103, d = b ? Symbol.for("react.portal") : 60106, e = b ? Symbol.for("react.fragment") : 60107, f$1 = b ? Symbol.for("react.strict_mode") : 60108, g$1 = b ? Symbol.for("react.profiler") : 60114, h$1 = b ? Symbol.for("react.provider") : 60109, k = b ? Symbol.for("react.context") : 60110, l = b ? Symbol.for("react.async_mode") : 60111, m$1 = b ? Symbol.for("react.concurrent_mode") : 60111, n$1 = b ? Symbol.for("react.forward_ref") : 60112, p$1 = b ? Symbol.for("react.suspense") : 60113, q$1 = b ? Symbol.for("react.suspense_list") : 60120, r = b ? Symbol.for("react.memo") : 60115, t = b ? Symbol.for("react.lazy") : 60116, v = b ? Symbol.for("react.block") : 60121, w = b ? Symbol.for("react.fundamental") : 60117, x = b ? Symbol.for("react.responder") : 60118, y = b ? Symbol.for("react.scope") : 60119;
function z(a) {
if (typeof a === "object" && a !== null) {
var u = a.$$typeof;
switch (u) {
case c:
switch (a = a.type, a) {
case l:
case m$1:
case e:
case g$1:
case f$1:
case p$1:
return a;
default:
switch (a = a && a.$$typeof, a) {
case k:
case n$1:
case t:
case r:
case h$1:
return a;
default:
return u;
}
}
case d:
return u;
}
}
}
function A(a) {
return z(a) === m$1;
}
reactIs_production_min.AsyncMode = l;
reactIs_production_min.ConcurrentMode = m$1;
reactIs_production_min.ContextConsumer = k;
reactIs_production_min.ContextProvider = h$1;
reactIs_production_min.Element = c;
reactIs_production_min.ForwardRef = n$1;
reactIs_production_min.Fragment = e;
reactIs_production_min.Lazy = t;
reactIs_production_min.Memo = r;
reactIs_production_min.Portal = d;
reactIs_production_min.Profiler = g$1;
reactIs_production_min.StrictMode = f$1;
reactIs_production_min.Suspense = p$1;
reactIs_production_min.isAsyncMode = function(a) {
return A(a) || z(a) === l;
};
reactIs_production_min.isConcurrentMode = A;
reactIs_production_min.isContextConsumer = function(a) {
return z(a) === k;
};
reactIs_production_min.isContextProvider = function(a) {
return z(a) === h$1;
};
reactIs_production_min.isElement = function(a) {
return typeof a === "object" && a !== null && a.$$typeof === c;
};
reactIs_production_min.isForwardRef = function(a) {
return z(a) === n$1;
};
reactIs_production_min.isFragment = function(a) {
return z(a) === e;
};
reactIs_production_min.isLazy = function(a) {
return z(a) === t;
};
reactIs_production_min.isMemo = function(a) {
return z(a) === r;
};
reactIs_production_min.isPortal = function(a) {
return z(a) === d;
};
reactIs_production_min.isProfiler = function(a) {
return z(a) === g$1;
};
reactIs_production_min.isStrictMode = function(a) {
return z(a) === f$1;
};
reactIs_production_min.isSuspense = function(a) {
return z(a) === p$1;
};
reactIs_production_min.isValidElementType = function(a) {
return typeof a === "string" || typeof a === "function" || a === e || a === m$1 || a === g$1 || a === f$1 || a === p$1 || a === q$1 || typeof a === "object" && a !== null && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h$1 || a.$$typeof === k || a.$$typeof === n$1 || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
};
reactIs_production_min.typeOf = z;
{
reactIs.exports = reactIs_production_min;
}
function useMemo(getValue2, condition, shouldUpdate) {
var cacheRef = React.useRef({});
if (!("value" in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
cacheRef.current.value = getValue2();
cacheRef.current.condition = condition;
}
return cacheRef.current.value;
}
function fillRef(ref, node) {
if (typeof ref === "function") {
ref(node);
} else if (_typeof$1(ref) === "object" && ref && "current" in ref) {
ref.current = node;
}
}
function composeRef() {
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
refs[_key] = arguments[_key];
}
var refList = refs.filter(function(ref) {
return ref;
});
if (refList.length <= 1) {
return refList[0];
}
return function(node) {
refs.forEach(function(ref) {
fillRef(ref, node);
});
};
}
function supportRef(nodeOrComponent) {
var _type$prototype, _nodeOrComponent$prot;
var type4 = reactIs.exports.isMemo(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type;
if (typeof type4 === "function" && !((_type$prototype = type4.prototype) === null || _type$prototype === void 0 ? void 0 : _type$prototype.render)) {
return false;
}
if (typeof nodeOrComponent === "function" && !((_nodeOrComponent$prot = nodeOrComponent.prototype) === null || _nodeOrComponent$prot === void 0 ? void 0 : _nodeOrComponent$prot.render)) {
return false;
}
return true;
}
function canUseDom() {
return !!(typeof window !== "undefined" && window.document && window.document.createElement);
}
function makePrefixMap(styleProp, eventName) {
var prefixes = {};
prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
prefixes["Webkit".concat(styleProp)] = "webkit".concat(eventName);
prefixes["Moz".concat(styleProp)] = "moz".concat(eventName);
prefixes["ms".concat(styleProp)] = "MS".concat(eventName);
prefixes["O".concat(styleProp)] = "o".concat(eventName.toLowerCase());
return prefixes;
}
function getVendorPrefixes(domSupport, win) {
var prefixes = {
animationend: makePrefixMap("Animation", "AnimationEnd"),
transitionend: makePrefixMap("Transition", "TransitionEnd")
};
if (domSupport) {
if (!("AnimationEvent" in win)) {
delete prefixes.animationend.animation;
}
if (!("TransitionEvent" in win)) {
delete prefixes.transitionend.transition;
}
}
return prefixes;
}
var vendorPrefixes = getVendorPrefixes(canUseDom(), typeof window !== "undefined" ? window : {});
var style = {};
if (canUseDom()) {
var _document$createEleme = document.createElement("div");
style = _document$createEleme.style;
}
var prefixedEventNames = {};
function getVendorPrefixedEventName(eventName) {
if (prefixedEventNames[eventName]) {
return prefixedEventNames[eventName];
}
var prefixMap = vendorPrefixes[eventName];
if (prefixMap) {
var stylePropList = Object.keys(prefixMap);
var len = stylePropList.length;
for (var i = 0; i < len; i += 1) {
var styleProp = stylePropList[i];
if (Object.prototype.hasOwnProperty.call(prefixMap, styleProp) && styleProp in style) {
prefixedEventNames[eventName] = prefixMap[styleProp];
return prefixedEventNames[eventName];
}
}
}
return "";
}
var internalAnimationEndName = getVendorPrefixedEventName("animationend");
var internalTransitionEndName = getVendorPrefixedEventName("transitionend");
var supportTransition = !!(internalAnimationEndName && internalTransitionEndName);
var animationEndName = internalAnimationEndName || "animationend";
var transitionEndName = internalTransitionEndName || "transitionend";
function getTransitionName$2(transitionName2, transitionType) {
if (!transitionName2)
return null;
if (_typeof$1(transitionName2) === "object") {
var type4 = transitionType.replace(/-\w/g, function(match) {
return match[1].toUpperCase();
});
return transitionName2[type4];
}
return "".concat(transitionName2, "-").concat(transitionType);
}
var STATUS_NONE = "none";
var STATUS_APPEAR = "appear";
var STATUS_ENTER = "enter";
var STATUS_LEAVE = "leave";
var STEP_NONE = "none";
var STEP_PREPARE = "prepare";
var STEP_START = "start";
var STEP_ACTIVE = "active";
var STEP_ACTIVATED = "end";
function useMountStatus(defaultValue) {
var destroyRef = useRef(false);
var _useState = useState(defaultValue), _useState2 = _slicedToArray(_useState, 2), val = _useState2[0], setVal = _useState2[1];
function setValue2(next) {
if (!destroyRef.current) {
setVal(next);
}
}
useEffect(function() {
return function() {
destroyRef.current = true;
};
}, []);
return [val, setValue2];
}
var useIsomorphicLayoutEffect = canUseDom() ? useLayoutEffect : useEffect;
var raf = function raf2(callback) {
return +setTimeout(callback, 16);
};
var caf = function caf2(num) {
return clearTimeout(num);
};
if (typeof window !== "undefined" && "requestAnimationFrame" in window) {
raf = function raf3(callback) {
return window.requestAnimationFrame(callback);
};
caf = function caf3(handle) {
return window.cancelAnimationFrame(handle);
};
}
var rafUUID = 0;
var rafIds = /* @__PURE__ */ new Map();
function cleanup(id2) {
rafIds.delete(id2);
}
function wrapperRaf$1(callback) {
var times = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
rafUUID += 1;
var id2 = rafUUID;
function callRef(leftTimes) {
if (leftTimes === 0) {
cleanup(id2);
callback();
} else {
var realId = raf(function() {
callRef(leftTimes - 1);
});
rafIds.set(id2, realId);
}
}
callRef(times);
return id2;
}
wrapperRaf$1.cancel = function(id2) {
var realId = rafIds.get(id2);
cleanup(realId);
return caf(realId);
};
var useNextFrame = function() {
var nextFrameRef = React.useRef(null);
function cancelNextFrame() {
wrapperRaf$1.cancel(nextFrameRef.current);
}
function nextFrame(callback) {
var delay = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2;
cancelNextFrame();
var nextFrameId = wrapperRaf$1(function() {
if (delay <= 1) {
callback({
isCanceled: function isCanceled() {
return nextFrameId !== nextFrameRef.current;
}
});
} else {
nextFrame(callback, delay - 1);
}
});
nextFrameRef.current = nextFrameId;
}
React.useEffect(function() {
return function() {
cancelNextFrame();
};
}, []);
return [nextFrame, cancelNextFrame];
};
var STEP_QUEUE = [STEP_PREPARE, STEP_START, STEP_ACTIVE, STEP_ACTIVATED];
var SkipStep = false;
var DoStep = true;
function isActive(step) {
return step === STEP_ACTIVE || step === STEP_ACTIVATED;
}
var useStepQueue = function(status, callback) {
var _useState = useMountStatus(STEP_NONE), _useState2 = _slicedToArray(_useState, 2), step = _useState2[0], setStep = _useState2[1];
var _useNextFrame = useNextFrame(), _useNextFrame2 = _slicedToArray(_useNextFrame, 2), nextFrame = _useNextFrame2[0], cancelNextFrame = _useNextFrame2[1];
function startQueue() {
setStep(STEP_PREPARE);
}
useIsomorphicLayoutEffect(function() {
if (step !== STEP_NONE && step !== STEP_ACTIVATED) {
var index2 = STEP_QUEUE.indexOf(step);
var nextStep = STEP_QUEUE[index2 + 1];
var result = callback(step);
if (result === SkipStep) {
setStep(nextStep);
} else {
nextFrame(function(info) {
function doNext() {
if (info.isCanceled())
return;
setStep(nextStep);
}
if (result === true) {
doNext();
} else {
Promise.resolve(result).then(doNext);
}
});
}
}
}, [status, step]);
React.useEffect(function() {
return function() {
cancelNextFrame();
};
}, []);
return [startQueue, step];
};
var useDomMotionEvents = function(callback) {
var cacheElementRef = useRef();
var callbackRef = useRef(callback);
callbackRef.current = callback;
var onInternalMotionEnd = React.useCallback(function(event) {
callbackRef.current(event);
}, []);
function removeMotionEvents(element) {
if (element) {
element.removeEventListener(transitionEndName, onInternalMotionEnd);
element.removeEventListener(animationEndName, onInternalMotionEnd);
}
}
function patchMotionEvents(element) {
if (cacheElementRef.current && cacheElementRef.current !== element) {
removeMotionEvents(cacheElementRef.current);
}
if (element && element !== cacheElementRef.current) {
element.addEventListener(transitionEndName, onInternalMotionEnd);
element.addEventListener(animationEndName, onInternalMotionEnd);
cacheElementRef.current = element;
}
}
React.useEffect(function() {
return function() {
removeMotionEvents(cacheElementRef.current);
};
}, []);
return [patchMotionEvents, removeMotionEvents];
};
function useStatus(supportMotion, visible, getElement2, _ref) {
var _ref$motionEnter = _ref.motionEnter, motionEnter = _ref$motionEnter === void 0 ? true : _ref$motionEnter, _ref$motionAppear = _ref.motionAppear, motionAppear = _ref$motionAppear === void 0 ? true : _ref$motionAppear, _ref$motionLeave = _ref.motionLeave, motionLeave = _ref$motionLeave === void 0 ? true : _ref$motionLeave, motionDeadline = _ref.motionDeadline, motionLeaveImmediately = _ref.motionLeaveImmediately, onAppearPrepare = _ref.onAppearPrepare, onEnterPrepare = _ref.onEnterPrepare, onLeavePrepare = _ref.onLeavePrepare, onAppearStart = _ref.onAppearStart, onEnterStart = _ref.onEnterStart, onLeaveStart = _ref.onLeaveStart, onAppearActive = _ref.onAppearActive, onEnterActive = _ref.onEnterActive, onLeaveActive = _ref.onLeaveActive, onAppearEnd = _ref.onAppearEnd, onEnterEnd = _ref.onEnterEnd, onLeaveEnd = _ref.onLeaveEnd, onVisibleChanged = _ref.onVisibleChanged;
var _useState = useMountStatus(), _useState2 = _slicedToArray(_useState, 2), asyncVisible = _useState2[0], setAsyncVisible = _useState2[1];
var _useState3 = useMountStatus(STATUS_NONE), _useState4 = _slicedToArray(_useState3, 2), status = _useState4[0], setStatus = _useState4[1];
var _useState5 = useMountStatus(null), _useState6 = _slicedToArray(_useState5, 2), style2 = _useState6[0], setStyle = _useState6[1];
var mountedRef = useRef(false);
var deadlineRef = useRef(null);
var destroyedRef = useRef(false);
var cacheElementRef = useRef(null);
function getDomElement() {
var element = getElement2();
return element || cacheElementRef.current;
}
var activeRef = useRef(false);
function onInternalMotionEnd(event) {
var element = getDomElement();
if (event && !event.deadline && event.target !== element) {
return;
}
var canEnd;
if (status === STATUS_APPEAR && activeRef.current) {
canEnd = onAppearEnd === null || onAppearEnd === void 0 ? void 0 : onAppearEnd(element, event);
} else if (status === STATUS_ENTER && activeRef.current) {
canEnd = onEnterEnd === null || onEnterEnd === void 0 ? void 0 : onEnterEnd(element, event);
} else if (status === STATUS_LEAVE && activeRef.current) {
canEnd = onLeaveEnd === null || onLeaveEnd === void 0 ? void 0 : onLeaveEnd(element, event);
}
if (canEnd !== false && !destroyedRef.current) {
setStatus(STATUS_NONE);
setStyle(null);
}
}
var _useDomMotionEvents = useDomMotionEvents(onInternalMotionEnd), _useDomMotionEvents2 = _slicedToArray(_useDomMotionEvents, 1), patchMotionEvents = _useDomMotionEvents2[0];
var eventHandlers = React.useMemo(function() {
var _ref2, _ref3, _ref4;
switch (status) {
case STATUS_APPEAR:
return _ref2 = {}, _defineProperty$1(_ref2, STEP_PREPARE, onAppearPrepare), _defineProperty$1(_ref2, STEP_START, onAppearStart), _defineProperty$1(_ref2, STEP_ACTIVE, onAppearActive), _ref2;
case STATUS_ENTER:
return _ref3 = {}, _defineProperty$1(_ref3, STEP_PREPARE, onEnterPrepare), _defineProperty$1(_ref3, STEP_START, onEnterStart), _defineProperty$1(_ref3, STEP_ACTIVE, onEnterActive), _ref3;
case STATUS_LEAVE:
return _ref4 = {}, _defineProperty$1(_ref4, STEP_PREPARE, onLeavePrepare), _defineProperty$1(_ref4, STEP_START, onLeaveStart), _defineProperty$1(_ref4, STEP_ACTIVE, onLeaveActive), _ref4;
default:
return {};
}
}, [status]);
var _useStepQueue = useStepQueue(status, function(newStep) {
if (newStep === STEP_PREPARE) {
var onPrepare = eventHandlers[STEP_PREPARE];
if (!onPrepare) {
return SkipStep;
}
return onPrepare(getDomElement());
}
if (step in eventHandlers) {
var _eventHandlers$step;
setStyle(((_eventHandlers$step = eventHandlers[step]) === null || _eventHandlers$step === void 0 ? void 0 : _eventHandlers$step.call(eventHandlers, getDomElement(), null)) || null);
}
if (step === STEP_ACTIVE) {
patchMotionEvents(getDomElement());
if (motionDeadline > 0) {
clearTimeout(deadlineRef.current);
deadlineRef.current = setTimeout(function() {
onInternalMotionEnd({
deadline: true
});
}, motionDeadline);
}
}
return DoStep;
}), _useStepQueue2 = _slicedToArray(_useStepQueue, 2), startStep = _useStepQueue2[0], step = _useStepQueue2[1];
var active = isActive(step);
activeRef.current = active;
useIsomorphicLayoutEffect(function() {
setAsyncVisible(visible);
var isMounted = mountedRef.current;
mountedRef.current = true;
if (!supportMotion) {
return;
}
var nextStatus;
if (!isMounted && visible && motionAppear) {
nextStatus = STATUS_APPEAR;
}
if (isMounted && visible && motionEnter) {
nextStatus = STATUS_ENTER;
}
if (isMounted && !visible && motionLeave || !isMounted && motionLeaveImmediately && !visible && motionLeave) {
nextStatus = STATUS_LEAVE;
}
if (nextStatus) {
setStatus(nextStatus);
startStep();
}
}, [visible]);
useEffect(function() {
if (status === STATUS_APPEAR && !motionAppear || status === STATUS_ENTER && !motionEnter || status === STATUS_LEAVE && !motionLeave) {
setStatus(STATUS_NONE);
}
}, [motionAppear, motionEnter, motionLeave]);
useEffect(function() {
return function() {
clearTimeout(deadlineRef.current);
destroyedRef.current = true;
};
}, []);
useEffect(function() {
if (asyncVisible !== void 0 && status === STATUS_NONE) {
onVisibleChanged === null || onVisibleChanged === void 0 ? void 0 : onVisibleChanged(asyncVisible);
}
}, [asyncVisible, status]);
var mergedStyle = style2;
if (eventHandlers[STEP_PREPARE] && step === STEP_START) {
mergedStyle = _objectSpread2$1({
transition: "none"
}, mergedStyle);
}
return [status, step, mergedStyle, asyncVisible !== null && asyncVisible !== void 0 ? asyncVisible : visible];
}
var DomWrapper$1 = /* @__PURE__ */ function(_React$Component) {
_inherits(DomWrapper2, _React$Component);
var _super = _createSuper(DomWrapper2);
function DomWrapper2() {
_classCallCheck(this, DomWrapper2);
return _super.apply(this, arguments);
}
_createClass(DomWrapper2, [{
key: "render",
value: function render() {
return this.props.children;
}
}]);
return DomWrapper2;
}(React.Component);
function genCSSMotion(config) {
var transitionSupport = config;
if (_typeof$1(config) === "object") {
transitionSupport = config.transitionSupport;
}
function isSupportTransition(props) {
return !!(props.motionName && transitionSupport);
}
var CSSMotion2 = /* @__PURE__ */ React.forwardRef(function(props, ref) {
var _props$visible = props.visible, visible = _props$visible === void 0 ? true : _props$visible, _props$removeOnLeave = props.removeOnLeave, removeOnLeave = _props$removeOnLeave === void 0 ? true : _props$removeOnLeave, forceRender = props.forceRender, children = props.children, motionName = props.motionName, leavedClassName = props.leavedClassName, eventProps = props.eventProps;
var supportMotion = isSupportTransition(props);
var nodeRef = useRef();
var wrapperNodeRef = useRef();
function getDomElement() {
try {
return nodeRef.current instanceof HTMLElement ? nodeRef.current : findDOMNode(wrapperNodeRef.current);
} catch (e2) {
return null;
}
}
var _useStatus = useStatus(supportMotion, visible, getDomElement, props), _useStatus2 = _slicedToArray(_useStatus, 4), status = _useStatus2[0], statusStep = _useStatus2[1], statusStyle = _useStatus2[2], mergedVisible = _useStatus2[3];
var renderedRef = React.useRef(mergedVisible);
if (mergedVisible) {
renderedRef.current = true;
}
var setNodeRef = React.useCallback(function(node) {
nodeRef.current = node;
fillRef(ref, node);
}, []);
var motionChildren;
var mergedProps = _objectSpread2$1(_objectSpread2$1({}, eventProps), {}, {
visible
});
if (!children) {
motionChildren = null;
} else if (status === STATUS_NONE || !isSupportTransition(props)) {
if (mergedVisible) {
motionChildren = children(_objectSpread2$1({}, mergedProps), setNodeRef);
} else if (!removeOnLeave && renderedRef.current) {
motionChildren = children(_objectSpread2$1(_objectSpread2$1({}, mergedProps), {}, {
className: leavedClassName
}), setNodeRef);
} else if (forceRender) {
motionChildren = children(_objectSpread2$1(_objectSpread2$1({}, mergedProps), {}, {
style: {
display: "none"
}
}), setNodeRef);
} else {
motionChildren = null;
}
} else {
var _classNames;
var statusSuffix;
if (statusStep === STEP_PREPARE) {
statusSuffix = "prepare";
} else if (isActive(statusStep)) {
statusSuffix = "active";
} else if (statusStep === STEP_START) {
statusSuffix = "start";
}
motionChildren = children(_objectSpread2$1(_objectSpread2$1({}, mergedProps), {}, {
className: classNames(getTransitionName$2(motionName, status), (_classNames = {}, _defineProperty$1(_classNames, getTransitionName$2(motionName, "".concat(status, "-").concat(statusSuffix)), statusSuffix), _defineProperty$1(_classNames, motionName, typeof motionName === "string"), _classNames)),
style: statusStyle
}), setNodeRef);
}
return /* @__PURE__ */ React.createElement(DomWrapper$1, {
ref: wrapperNodeRef
}, motionChildren);
});
CSSMotion2.displayName = "CSSMotion";
return CSSMotion2;
}
var CSSMotion = genCSSMotion(supportTransition);
var STATUS_ADD = "add";
var STATUS_KEEP = "keep";
var STATUS_REMOVE = "remove";
var STATUS_REMOVED = "removed";
function wrapKeyToObject(key2) {
var keyObj;
if (key2 && _typeof$1(key2) === "object" && "key" in key2) {
keyObj = key2;
} else {
keyObj = {
key: key2
};
}
return _objectSpread2$1(_objectSpread2$1({}, keyObj), {}, {
key: String(keyObj.key)
});
}
function parseKeys() {
var keys2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
return keys2.map(wrapKeyToObject);
}
function diffKeys() {
var prevKeys = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
var currentKeys = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
var list = [];
var currentIndex = 0;
var currentLen = currentKeys.length;
var prevKeyObjects = parseKeys(prevKeys);
var currentKeyObjects = parseKeys(currentKeys);
prevKeyObjects.forEach(function(keyObj) {
var hit = false;
for (var i = currentIndex; i < currentLen; i += 1) {
var currentKeyObj = currentKeyObjects[i];
if (currentKeyObj.key === keyObj.key) {
if (currentIndex < i) {
list = list.concat(currentKeyObjects.slice(currentIndex, i).map(function(obj) {
return _objectSpread2$1(_objectSpread2$1({}, obj), {}, {
status: STATUS_ADD
});
}));
currentIndex = i;
}
list.push(_objectSpread2$1(_objectSpread2$1({}, currentKeyObj), {}, {
status: STATUS_KEEP
}));
currentIndex += 1;
hit = true;
break;
}
}
if (!hit) {
list.push(_objectSpread2$1(_objectSpread2$1({}, keyObj), {}, {
status: STATUS_REMOVE
}));
}
});
if (currentIndex < currentLen) {
list = list.concat(currentKeyObjects.slice(currentIndex).map(function(obj) {
return _objectSpread2$1(_objectSpread2$1({}, obj), {}, {
status: STATUS_ADD
});
}));
}
var keys2 = {};
list.forEach(function(_ref) {
var key2 = _ref.key;
keys2[key2] = (keys2[key2] || 0) + 1;
});
var duplicatedKeys = Object.keys(keys2).filter(function(key2) {
return keys2[key2] > 1;
});
duplicatedKeys.forEach(function(matchKey) {
list = list.filter(function(_ref2) {
var key2 = _ref2.key, status = _ref2.status;
return key2 !== matchKey || status !== STATUS_REMOVE;
});
list.forEach(function(node) {
if (node.key === matchKey) {
node.status = STATUS_KEEP;
}
});
});
return list;
}
var _excluded$6 = ["component", "children", "onVisibleChanged"], _excluded2 = ["status"];
var MOTION_PROP_NAMES = ["eventProps", "visible", "children", "motionName", "motionAppear", "motionEnter", "motionLeave", "motionLeaveImmediately", "motionDeadline", "removeOnLeave", "leavedClassName", "onAppearStart", "onAppearActive", "onAppearEnd", "onEnterStart", "onEnterActive", "onEnterEnd", "onLeaveStart", "onLeaveActive", "onLeaveEnd"];
function genCSSMotionList(transitionSupport) {
var CSSMotion$1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : CSSMotion;
var CSSMotionList2 = /* @__PURE__ */ function(_React$Component) {
_inherits(CSSMotionList3, _React$Component);
var _super = _createSuper(CSSMotionList3);
function CSSMotionList3() {
var _this;
_classCallCheck(this, CSSMotionList3);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_this.state = {
keyEntities: []
};
_this.removeKey = function(removeKey) {
_this.setState(function(_ref) {
var keyEntities = _ref.keyEntities;
return {
keyEntities: keyEntities.map(function(entity) {
if (entity.key !== removeKey)
return entity;
return _objectSpread2$1(_objectSpread2$1({}, entity), {}, {
status: STATUS_REMOVED
});
})
};
});
};
return _this;
}
_createClass(CSSMotionList3, [{
key: "render",
value: function render() {
var _this2 = this;
var keyEntities = this.state.keyEntities;
var _this$props = this.props, component = _this$props.component, children = _this$props.children, _onVisibleChanged = _this$props.onVisibleChanged, restProps = _objectWithoutProperties(_this$props, _excluded$6);
var Component2 = component || React.Fragment;
var motionProps = {};
MOTION_PROP_NAMES.forEach(function(prop) {
motionProps[prop] = restProps[prop];
delete restProps[prop];
});
delete restProps.keys;
return /* @__PURE__ */ React.createElement(Component2, restProps, keyEntities.map(function(_ref2) {
var status = _ref2.status, eventProps = _objectWithoutProperties(_ref2, _excluded2);
var visible = status === STATUS_ADD || status === STATUS_KEEP;
return /* @__PURE__ */ React.createElement(CSSMotion$1, _extends$1({}, motionProps, {
key: eventProps.key,
visible,
eventProps,
onVisibleChanged: function onVisibleChanged(changedVisible) {
_onVisibleChanged === null || _onVisibleChanged === void 0 ? void 0 : _onVisibleChanged(changedVisible, {
key: eventProps.key
});
if (!changedVisible) {
_this2.removeKey(eventProps.key);
}
}
}), children);
}));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(_ref3, _ref4) {
var keys2 = _ref3.keys;
var keyEntities = _ref4.keyEntities;
var parsedKeyObjects = parseKeys(keys2);
var mixedKeyEntities = diffKeys(keyEntities, parsedKeyObjects);
return {
keyEntities: mixedKeyEntities.filter(function(entity) {
var prevEntity = keyEntities.find(function(_ref5) {
var key2 = _ref5.key;
return entity.key === key2;
});
if (prevEntity && prevEntity.status === STATUS_REMOVED && entity.status === STATUS_REMOVE) {
return false;
}
return true;
})
};
}
}]);
return CSSMotionList3;
}(React.Component);
CSSMotionList2.defaultProps = {
component: "div"
};
return CSSMotionList2;
}
var CSSMotionList = genCSSMotionList(supportTransition);
var Notice = /* @__PURE__ */ function(_Component) {
_inherits(Notice2, _Component);
var _super = _createSuper(Notice2);
function Notice2() {
var _this;
_classCallCheck(this, Notice2);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_this.closeTimer = null;
_this.close = function(e2) {
if (e2) {
e2.stopPropagation();
}
_this.clearCloseTimer();
var _this$props = _this.props, onClose2 = _this$props.onClose, noticeKey = _this$props.noticeKey;
if (onClose2) {
onClose2(noticeKey);
}
};
_this.startCloseTimer = function() {
if (_this.props.duration) {
_this.closeTimer = window.setTimeout(function() {
_this.close();
}, _this.props.duration * 1e3);
}
};
_this.clearCloseTimer = function() {
if (_this.closeTimer) {
clearTimeout(_this.closeTimer);
_this.closeTimer = null;
}
};
return _this;
}
_createClass(Notice2, [{
key: "componentDidMount",
value: function componentDidMount() {
this.startCloseTimer();
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (this.props.duration !== prevProps.duration || this.props.updateMark !== prevProps.updateMark || this.props.visible !== prevProps.visible && this.props.visible) {
this.restartCloseTimer();
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.clearCloseTimer();
}
}, {
key: "restartCloseTimer",
value: function restartCloseTimer() {
this.clearCloseTimer();
this.startCloseTimer();
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var _this$props2 = this.props, prefixCls = _this$props2.prefixCls, className = _this$props2.className, closable = _this$props2.closable, closeIcon = _this$props2.closeIcon, style2 = _this$props2.style, onClick = _this$props2.onClick, children = _this$props2.children, holder = _this$props2.holder;
var componentClass = "".concat(prefixCls, "-notice");
var dataOrAriaAttributeProps = Object.keys(this.props).reduce(function(acc, key2) {
if (key2.substr(0, 5) === "data-" || key2.substr(0, 5) === "aria-" || key2 === "role") {
acc[key2] = _this2.props[key2];
}
return acc;
}, {});
var node = /* @__PURE__ */ React.createElement("div", _extends$1({
className: classNames(componentClass, className, _defineProperty$1({}, "".concat(componentClass, "-closable"), closable)),
style: style2,
onMouseEnter: this.clearCloseTimer,
onMouseLeave: this.startCloseTimer,
onClick
}, dataOrAriaAttributeProps), /* @__PURE__ */ React.createElement("div", {
className: "".concat(componentClass, "-content")
}, children), closable ? /* @__PURE__ */ React.createElement("a", {
tabIndex: 0,
onClick: this.close,
className: "".concat(componentClass, "-close")
}, closeIcon || /* @__PURE__ */ React.createElement("span", {
className: "".concat(componentClass, "-close-x")
})) : null);
if (holder) {
return /* @__PURE__ */ ReactDOM.createPortal(node, holder);
}
return node;
}
}]);
return Notice2;
}(Component);
Notice.defaultProps = {
onClose: function onClose() {
},
duration: 1.5
};
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr))
return _arrayLikeToArray(arr);
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
return Array.from(iter);
}
function _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.");
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function useNotification(notificationInstance2) {
var createdRef = React.useRef({});
var _React$useState = React.useState([]), _React$useState2 = _slicedToArray(_React$useState, 2), elements = _React$useState2[0], setElements = _React$useState2[1];
function notify(noticeProps) {
var firstMount = true;
notificationInstance2.add(noticeProps, function(div, props) {
var key2 = props.key;
if (div && (!createdRef.current[key2] || firstMount)) {
var noticeEle = /* @__PURE__ */ React.createElement(Notice, _extends$1({}, props, {
holder: div
}));
createdRef.current[key2] = noticeEle;
setElements(function(originElements) {
var index2 = originElements.findIndex(function(ele) {
return ele.key === props.key;
});
if (index2 === -1) {
return [].concat(_toConsumableArray(originElements), [noticeEle]);
}
var cloneList = _toConsumableArray(originElements);
cloneList[index2] = noticeEle;
return cloneList;
});
}
firstMount = false;
});
}
return [notify, /* @__PURE__ */ React.createElement(React.Fragment, null, elements)];
}
var seed = 0;
var now = Date.now();
function getUuid() {
var id2 = seed;
seed += 1;
return "rcNotification_".concat(now, "_").concat(id2);
}
var Notification = /* @__PURE__ */ function(_Component) {
_inherits(Notification2, _Component);
var _super = _createSuper(Notification2);
function Notification2() {
var _this;
_classCallCheck(this, Notification2);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_this.state = {
notices: []
};
_this.hookRefs = /* @__PURE__ */ new Map();
_this.add = function(originNotice, holderCallback) {
var key2 = originNotice.key || getUuid();
var notice2 = _objectSpread2$1(_objectSpread2$1({}, originNotice), {}, {
key: key2
});
var maxCount2 = _this.props.maxCount;
_this.setState(function(previousState) {
var notices = previousState.notices;
var noticeIndex = notices.map(function(v2) {
return v2.notice.key;
}).indexOf(key2);
var updatedNotices = notices.concat();
if (noticeIndex !== -1) {
updatedNotices.splice(noticeIndex, 1, {
notice: notice2,
holderCallback
});
} else {
if (maxCount2 && notices.length >= maxCount2) {
notice2.key = updatedNotices[0].notice.key;
notice2.updateMark = getUuid();
notice2.userPassKey = key2;
updatedNotices.shift();
}
updatedNotices.push({
notice: notice2,
holderCallback
});
}
return {
notices: updatedNotices
};
});
};
_this.remove = function(removeKey) {
_this.setState(function(_ref) {
var notices = _ref.notices;
return {
notices: notices.filter(function(_ref2) {
var _ref2$notice = _ref2.notice, key2 = _ref2$notice.key, userPassKey = _ref2$notice.userPassKey;
var mergedKey = userPassKey || key2;
return mergedKey !== removeKey;
})
};
});
};
_this.noticePropsMap = {};
return _this;
}
_createClass(Notification2, [{
key: "getTransitionName",
value: function getTransitionName3() {
var _this$props = this.props, prefixCls = _this$props.prefixCls, animation = _this$props.animation;
var transitionName2 = this.props.transitionName;
if (!transitionName2 && animation) {
transitionName2 = "".concat(prefixCls, "-").concat(animation);
}
return transitionName2;
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var notices = this.state.notices;
var _this$props2 = this.props, prefixCls = _this$props2.prefixCls, className = _this$props2.className, closeIcon = _this$props2.closeIcon, style2 = _this$props2.style;
var noticeKeys = [];
notices.forEach(function(_ref3, index2) {
var notice2 = _ref3.notice, holderCallback = _ref3.holderCallback;
var updateMark = index2 === notices.length - 1 ? notice2.updateMark : void 0;
var key2 = notice2.key, userPassKey = notice2.userPassKey;
var noticeProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
prefixCls,
closeIcon
}, notice2), notice2.props), {}, {
key: key2,
noticeKey: userPassKey || key2,
updateMark,
onClose: function onClose2(noticeKey) {
var _notice$onClose;
_this2.remove(noticeKey);
(_notice$onClose = notice2.onClose) === null || _notice$onClose === void 0 ? void 0 : _notice$onClose.call(notice2);
},
onClick: notice2.onClick,
children: notice2.content
});
noticeKeys.push(key2);
_this2.noticePropsMap[key2] = {
props: noticeProps,
holderCallback
};
});
return /* @__PURE__ */ React.createElement("div", {
className: classNames(prefixCls, className),
style: style2
}, /* @__PURE__ */ React.createElement(CSSMotionList, {
keys: noticeKeys,
motionName: this.getTransitionName(),
onVisibleChanged: function onVisibleChanged(changedVisible, _ref4) {
var key2 = _ref4.key;