semantic-styled-ui
Version:
Set of UI components based of Semantic UI with Styled Components
26,229 lines • 896 kB
JavaScript
import*as React from'react';import React__default,{Children,PureComponent,Component,createRef,isValidElement,cloneElement,createElement,useState,useRef,useLayoutEffect,useEffect}from'react';import styled,{css}from'styled-components';import*as ReactDOM from'react-dom';import ReactDOM__default,{createPortal}from'react-dom';function _extends$7() {
_extends$7 = 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$7.apply(this, arguments);
}
function _objectWithoutPropertiesLoose$2(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;
}
function _taggedTemplateLiteralLoose(strings, raw) {
if (!raw) {
raw = strings.slice(0);
}
strings.raw = raw;
return strings;
}var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn) {
var module = { exports: {} };
return fn(module, module.exports), module.exports;
}/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
var ReactPropTypesSecret_1 = ReactPropTypesSecret;/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function emptyFunction() {}
function emptyFunctionWithReset() {}
emptyFunctionWithReset.resetWarningCache = emptyFunction;
var factoryWithThrowingShims = function() {
function shim(props, propName, componentName, location, propFullName, secret) {
if (secret === ReactPropTypesSecret_1) {
// It is still safe when called from React.
return;
}
var err = new Error(
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use PropTypes.checkPropTypes() to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
err.name = 'Invariant Violation';
throw err;
} shim.isRequired = shim;
function getShim() {
return shim;
} // Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
var ReactPropTypes = {
array: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,
symbol: shim,
any: shim,
arrayOf: getShim,
element: shim,
elementType: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim,
exact: getShim,
checkPropTypes: emptyFunctionWithReset,
resetWarningCache: emptyFunction
};
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var propTypes = createCommonjsModule(function (module) {
{
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = factoryWithThrowingShims();
}
});function _objectWithoutPropertiesLoose$1(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;
}/** @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="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n$1=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=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("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n$1:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element$2=c;var ForwardRef=n$1;var Fragment=e;var Lazy=t;var Memo=r;var Portal$2=d;
var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement$1=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n$1};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p};
var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n$1||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
var reactIs_production_min = {
AsyncMode: AsyncMode,
ConcurrentMode: ConcurrentMode,
ContextConsumer: ContextConsumer,
ContextProvider: ContextProvider,
Element: Element$2,
ForwardRef: ForwardRef,
Fragment: Fragment,
Lazy: Lazy,
Memo: Memo,
Portal: Portal$2,
Profiler: Profiler,
StrictMode: StrictMode,
Suspense: Suspense,
isAsyncMode: isAsyncMode,
isConcurrentMode: isConcurrentMode,
isContextConsumer: isContextConsumer,
isContextProvider: isContextProvider,
isElement: isElement$1,
isForwardRef: isForwardRef,
isFragment: isFragment,
isLazy: isLazy,
isMemo: isMemo,
isPortal: isPortal,
isProfiler: isProfiler,
isStrictMode: isStrictMode,
isSuspense: isSuspense,
isValidElementType: isValidElementType,
typeOf: typeOf
};var reactIs = createCommonjsModule(function (module) {
{
module.exports = reactIs_production_min;
}
});function _inheritsLoose$1(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}/**
* The function that correctly handles passing refs.
*
* @param ref - An ref object or function
* @param node - A node that should be passed by ref
*/
var handleRef = function handleRef(ref, node) {
if (typeof ref === 'function') {
ref(node);
return;
}
if (ref !== null && typeof ref === 'object') {
// The `current` property is defined as readonly, however it's a valid way because
// `ref` is a mutable object
ref.current = node;
}
};
/** Checks that the passed object is a valid React ref object. */
var isRefObject = function isRefObject(ref) {
return (// https://github.com/facebook/react/blob/v16.8.2/packages/react-reconciler/src/ReactFiberCommitWork.js#L665
ref !== null && typeof ref === 'object' && ref.hasOwnProperty('current')
);
};var RefFindNode = /*#__PURE__*/function (_React$Component) {
_inheritsLoose$1(RefFindNode, _React$Component);
function RefFindNode() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.prevNode = null;
return _this;
}
var _proto = RefFindNode.prototype;
_proto.componentDidMount = function componentDidMount() {
var currentNode = ReactDOM.findDOMNode(this);
this.prevNode = currentNode;
handleRef(this.props.innerRef, currentNode);
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
var currentNode = ReactDOM.findDOMNode(this);
if (this.prevNode !== currentNode) {
this.prevNode = currentNode;
handleRef(this.props.innerRef, currentNode);
}
if (prevProps.innerRef !== this.props.innerRef) {
handleRef(this.props.innerRef, currentNode);
}
};
_proto.componentWillUnmount = function componentWillUnmount() {
handleRef(this.props.innerRef, null);
delete this.prevNode;
};
_proto.render = function render() {
var children = this.props.children;
return children;
};
return RefFindNode;
}(React.Component);var RefForward = /*#__PURE__*/function (_React$Component) {
_inheritsLoose$1(RefForward, _React$Component);
function RefForward() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.currentNode = null;
_this.handleRefOverride = function (node) {
var _this$props = _this.props,
children = _this$props.children,
innerRef = _this$props.innerRef;
handleRef(children.ref, node);
handleRef(innerRef, node);
_this.currentNode = node;
};
return _this;
}
var _proto = RefForward.prototype;
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
if (prevProps.innerRef !== this.props.innerRef) {
handleRef(this.props.innerRef, this.currentNode);
}
};
_proto.componentWillUnmount = function componentWillUnmount() {
delete this.currentNode;
};
_proto.render = function render() {
var children = this.props.children;
return /*#__PURE__*/React.cloneElement(children, {
ref: this.handleRefOverride
});
};
return RefForward;
}(React.Component);var Ref = function Ref(props) {
var children = props.children,
innerRef = props.innerRef,
rest = _objectWithoutPropertiesLoose$1(props, ["children", "innerRef"]);
var child = React.Children.only(children);
var ElementType = reactIs.isForwardRef(child) ? RefForward : RefFindNode;
var childWithProps = child && rest && Object.keys(rest).length > 0 ? /*#__PURE__*/React.cloneElement(child, rest) : child;
return /*#__PURE__*/React.createElement(ElementType, {
innerRef: innerRef
}, childWithProps);
};function _extends$6() {
_extends$6 = 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$6.apply(this, arguments);
}function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}/** Used for built-in method references. */
var objectProto$j = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$e = objectProto$j.hasOwnProperty;
/**
* The base implementation of `_.has` without support for deep paths.
*
* @private
* @param {Object} [object] The object to query.
* @param {Array|string} key The key to check.
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHas(object, key) {
return object != null && hasOwnProperty$e.call(object, key);
}/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
var isArray$1 = isArray;/** Detect free variable `global` from Node.js. */
var freeGlobal$1 = typeof global == 'object' && global && global.Object === Object && global;
var freeGlobal$2 = freeGlobal$1;/** Detect free variable `self`. */
var freeSelf$1 = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root$1 = freeGlobal$2 || freeSelf$1 || Function('return this')();
var root$2 = root$1;/** Built-in value references. */
var Symbol$1 = root$2.Symbol;
var Symbol$2 = Symbol$1;/** Used for built-in method references. */
var objectProto$i = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$d = objectProto$i.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString$2 = objectProto$i.toString;
/** Built-in value references. */
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty$d.call(value, symToStringTag$1),
tag = value[symToStringTag$1];
try {
value[symToStringTag$1] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString$2.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag$1] = tag;
} else {
delete value[symToStringTag$1];
}
}
return result;
}/** Used for built-in method references. */
var objectProto$h = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString$1 = objectProto$h.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString$1(value) {
return nativeObjectToString$1.call(value);
}/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString$1(value);
}/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike$1(value) {
return value != null && typeof value == 'object';
}/** `Object#toString` result references. */
var symbolTag$2 = '[object Symbol]';
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol$1(value) {
return typeof value == 'symbol' ||
(isObjectLike$1(value) && baseGetTag(value) == symbolTag$2);
}/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/;
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
if (isArray$1(value)) {
return false;
}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
value == null || isSymbol$1(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
(object != null && value in Object(object));
}/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject$2(value) {
var type = typeof value;
return value != null && (type == 'object' || type == 'function');
}/** `Object#toString` result references. */
var asyncTag = '[object AsyncFunction]',
funcTag$1 = '[object Function]',
genTag = '[object GeneratorFunction]',
proxyTag = '[object Proxy]';
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
if (!isObject$2(value)) {
return false;
}
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 9 which returns 'object' for typed arrays and other constructors.
var tag = baseGetTag(value);
return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
}/** Used to detect overreaching core-js shims. */
var coreJsData = root$2['__core-js_shared__'];
var coreJsData$1 = coreJsData;/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}/** Used for built-in method references. */
var funcProto$2 = Function.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString$2 = funcProto$2.toString;
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to convert.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString$2.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used for built-in method references. */
var funcProto$1 = Function.prototype,
objectProto$g = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString$1 = funcProto$1.toString;
/** Used to check objects for own properties. */
var hasOwnProperty$c = objectProto$g.hasOwnProperty;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString$1.call(hasOwnProperty$c).replace(reRegExpChar$1, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject$2(value) || isMasked(value)) {
return false;
}
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue$1(object, key) {
return object == null ? undefined : object[key];
}/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue$1(object, key);
return baseIsNative(value) ? value : undefined;
}/* Built-in method references that are verified to be native. */
var nativeCreate = getNative(Object, 'create');
var nativeCreate$1 = nativeCreate;/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
this.size = 0;
}/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
}/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
/** Used for built-in method references. */
var objectProto$f = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$b = objectProto$f.hasOwnProperty;
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate$1) {
var result = data[key];
return result === HASH_UNDEFINED$2 ? undefined : result;
}
return hasOwnProperty$b.call(data, key) ? data[key] : undefined;
}/** Used for built-in method references. */
var objectProto$e = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$a = objectProto$e.hasOwnProperty;
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return nativeCreate$1 ? (data[key] !== undefined) : hasOwnProperty$a.call(data, key);
}/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = (nativeCreate$1 && value === undefined) ? HASH_UNDEFINED$1 : value;
return this;
}/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}/** Used for built-in method references. */
var arrayProto = Array.prototype;
/** Built-in value references. */
var splice = arrayProto.splice;
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;/* Built-in method references that are verified to be native. */
var Map$1 = getNative(root$2, 'Map');
var Map$2 = Map$1;/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.size = 0;
this.__data__ = {
'hash': new Hash,
'map': new (Map$2 || ListCache),
'string': new Hash
};
}/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
var result = getMapData(this, key)['delete'](key);
this.size -= result ? 1 : 0;
return result;
}/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
var data = getMapData(this, key),
size = data.size;
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
}/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;/** Error message constants. */
var FUNC_ERROR_TEXT$2 = 'Expected a function';
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
* provided, it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is used as the map cache key. The `func`
* is invoked with the `this` binding of the memoized function.
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
* @returns {Function} Returns the new memoized function.
* @example
*
* var object = { 'a': 1, 'b': 2 };
* var other = { 'c': 3, 'd': 4 };
*
* var values = _.memoize(_.values);
* values(object);
* // => [1, 2]
*
* values(other);
* // => [3, 4]
*
* object.a = 2;
* values(object);
* // => [1, 2]
*
* // Modify the result cache.
* values.cache.set(object, ['a', 'b']);
* values(object);
* // => ['a', 'b']
*
* // Replace `_.memoize.Cache`.
* _.memoize.Cache = WeakMap;
*/
function memoize(func, resolver) {
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
throw new TypeError(FUNC_ERROR_TEXT$2);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result) || cache;
return result;
};
memoized.cache = new (memoize.Cache || MapCache);
return memoized;
}
// Expose `MapCache`.
memoize.Cache = MapCache;/** Used as the maximum memoize cache size. */
var MAX_MEMOIZE_SIZE = 500;
/**
* A specialized version of `_.memoize` which clears the memoized function's
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
*
* @private
* @param {Function} func The function to have its output memoized.
* @returns {Function} Returns the new memoized function.
*/
function memoizeCapped(func) {
var result = memoize(func, function(key) {
if (cache.size === MAX_MEMOIZE_SIZE) {
cache.clear();
}
return key;
});
var cache = result.cache;
return result;
}/** Used to match property names within property paths. */
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
/**
* Converts `string` to a property path array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the property path array.
*/
var stringToPath = memoizeCapped(function(string) {
var result = [];
if (string.charCodeAt(0) === 46 /* . */) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, subString) {
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
});
return result;
});
var stringToPath$1 = stringToPath;/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}/** Used as references for various `Number` constants. */
var INFINITY$3 = 1 / 0;
/** Used to convert symbols to primitives and strings. */
var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : undefined,
symbolToString = symbolProto$1 ? symbolProto$1.toString : undefined;
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isArray$1(value)) {
// Recursively convert values (susceptible to call stack limits).
return arrayMap(value, baseToString) + '';
}
if (isSymbol$1(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY$3) ? '-0' : result;
}/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : baseToString(value);
}/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @param {Object} [object] The object to query keys on.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value, object) {
if (isArray$1(value)) {
return value;
}
return isKey(value, object) ? [value] : stringToPath$1(toString(value));
}/** `Object#toString` result references. */
var argsTag$2 = '[object Arguments]';
/**
* The base implementation of `_.isArguments`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
function baseIsArguments(value) {
return isObjectLike$1(value) && baseGetTag(value) == argsTag$2;
}/** Used for built-in method references. */
var objectProto$d = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$9 = objectProto$d.hasOwnProperty;
/** Built-in value references. */
var propertyIsEnumerable$1 = objectProto$d.propertyIsEnumerable;
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
return isObjectLike$1(value) && hasOwnProperty$9.call(value, 'callee') &&
!propertyIsEnumerable$1.call(value, 'callee');
};
var isArguments$1 = isArguments;/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER$2 = 9007199254740991;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
var type = typeof value;
length = length == null ? MAX_SAFE_INTEGER$2 : length;
return !!length &&
(type == 'number' ||
(type != 'symbol' && reIsUint.test(value))) &&
(value > -1 && value % 1 == 0 && value < length);
}/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER$1 = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
}/** Used as references for various `Number` constants. */
var INFINITY$2 = 1 / 0;
/**
* Converts `value` to a string key if it's not a string or symbol.
*
* @private
* @param {*} value The value to inspect.
* @returns {string|symbol} Returns the key.
*/
function toKey(value) {
if (typeof value == 'string' || isSymbol$1(value)) {
return value;
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY$2) ? '-0' : result;
}/**
* Checks if `path` exists on `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @param {Function} hasFunc The function to check properties.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
*/
function hasPath(object, path, hasFunc) {
path = castPath(path, object);
var index = -1,
length = path.length,
result = false;
while (++index < length) {
var key = toKey(path[index]);
if (!(result = object != null && hasFunc(object, key))) {
break;
}
object = object[key];
}
if (result || ++index != length) {
return result;
}
length = object == null ? 0 : object.length;
return !!length && isLength(length) && isIndex(key, length) &&
(isArray$1(object) || isArguments$1(object));
}/**
* Checks if `path` is a direct property of `object`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
* var object = { 'a': { 'b': 2 } };
* var other = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.has(object, 'a');
* // => true
*
* _.has(object, 'a.b');
* // => true
*
* _.has(object, ['a', 'b']);
* // => true
*
* _.has(other, 'a');
* // => false
*/
function has(object, path) {
return object != null && hasPath(object, path, baseHas);
}/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
case 3: return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}/**
* Gets the last element of `array`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to query.
* @returns {*} Returns the last element of `array`.
* @example
*
* _.last([1, 2, 3]);
* // => 3
*/
function last(array) {
var length = array == null ? 0 : array.length;
return length ? array[length - 1] : undefined;
}/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = castPath(path, object);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}/**
* The base implementation of `_.slice` without an iteratee call guard.
*
* @private
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the slice of `array`.
*/
function baseSlice(array, start, end) {
var index = -1,
length = array.length;
if (start < 0) {
start = -start > length ? 0 : (length + start);
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : ((end - start) >>> 0);
start >>>= 0;
var result = Array(length);
while (++index < length) {
result[index] = array[index + start];
}
return result;
}/**
* Gets the parent value at `path` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array} path The path to get the parent value of.
* @returns {*} Returns the parent value.
*/
function parent(object, path) {
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
}/**
* The base implementation of `_.invoke` without support for individual
* method arguments.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the method to invoke.
* @param {Array} args The arguments to invoke the method with.
* @returns {*} Returns the result of the invoked method.
*/
function baseInvoke(object, path, args) {
path = castPath(path, object);
object = parent(object, path);
var func = object == null ? object : object[toKey(last(path))];
return func == null ? undefined : apply(func, object, args);
}/**
* This method returns the first argument it receives.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {*} value Any value.
* @returns {*} Returns `value`.
* @example
*
* var object = { 'a': 1 };
*
* console.log(_.identity(object) === object);
* // => true
*/
function identity(value) {
return value;
}/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$8 = Math.max;
/**
* A specialized version of `baseRest` which transforms the rest array.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @param {Function} transform The rest array transform.
* @returns {Function} Returns the new function.
*/
function overRest(func, start, transform) {
start = nativeMax$8(start === undefined ? (func.length - 1) : start, 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax$8(args.length - start, 0),
array = Array(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = transform(array);
return apply(func, this, otherArgs);
};
}/**
* Creates a function that returns `value`.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Util
* @param {*} value The value to return from the new function.
* @returns {Function} Returns the new constant function.
* @example
*
* var objects = _.times(2, _.constant({ 'a': 1 }));
*
* console.log(objects);
* // => [{ 'a': 1 }, { 'a': 1 }]
*
* console.log(objects[0] === objects[1]);
* // => true
*/
function constant(value) {
return function() {
return value;
};
}var defineProperty = (function() {
try {
var func = getNative(Object, 'defineProperty');
func({}, '', {});
return func;
} catch (e) {}
}());
var defineProperty$1 = defineProperty;/**
* The base implementation of `setToString` without support for hot loop shorting.
*
* @private
* @param {Function} func The function to modify.
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
var baseSetToString = !defineProperty$1 ? identity : function(func, string) {
return defineProperty$1(func, 'toString', {
'configurable': true,
'enumerable': false,
'value': constant(string),
'writable': true
});
};
var baseSetToString$1 = baseSetToString;/** Used to detect hot functions by number of calls within a span of milliseconds. */
var HOT_COUNT = 800,
HOT_SPAN = 16;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeNow = Date.now;
/**
* Creates a function that'll short out and invoke `identity` instead
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
* milliseconds.
*
* @private
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new shortable function.
*/
function shortOut(func) {
var count = 0,
lastCalled = 0;
return function() {
var stamp = nativeNow(),
remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {
if (++count >= HOT_COUNT) {
return arguments[0];
}
} else {
count = 0;
}
return func.apply(undefined, arguments);
};
}/**
* Sets the `toString` method of `func` to return `string`.
*
* @private
* @param {Function} func The function to modify.
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
var setToString = shortOut(baseSetToString$1);
var setToString$1 = setToString;/**
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
*/
function baseRest(func, start) {
return setToString$1(overRest(func, start, identity), func + '');
}/**
* Invokes the method at `path` of `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the method to invoke.
* @param {...*} [args] The arguments to invoke the method with.
* @returns {*} Returns the result of the invoked method.
* @example
*
* var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
*
* _.invoke(object, 'a[0].b.c.slice', 1, 3);
* // => [2, 3]
*/
var invoke = baseRest(baseInvoke);
var _invoke = invoke;function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}/**
* Checks if `value` is `undefined`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
* @example
*
* _.isUndefined(void 0);
* // => true
*
* _.isUndefined(null);
* // => false
*/
function isUndefined(value) {
return value === undefined;
}/**
* The base implementation of `_.clamp` which doesn't coerce arguments.
*
* @private
* @param {number} number The number to clamp.
* @param {number} [lower] The lower bound.
* @param {number} upper The upper bound.
* @returns {number} Returns the clamped number.
*/
function baseClamp(number, lower, upper) {
if (number === number) {
if (upper !== undefined) {
number = number <= upper ? number : upper;
}
if (lower !== undefined) {
number = number >= lower ? number : lower;
}
}
return number;
}/** Used to match a single whitespace character. */
var reWhitespace = /\s/;
/**
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
* character of `string`.
*
* @private
* @param {string} string The string to inspect.
* @returns {number} Returns the index of the last non-whitespace character.
*/
function trimmedEndIndex(string) {
var index = string.length;
while (index-- && reWhitespace.test(string.charAt(index))) {}
return index;
}/** Used to match leading whitespace. */
var reTrimStart = /^\s+/;
/**
* The base implementation of `_.trim`.
*
* @private
* @param {string} string The string to trim.
* @returns {string} Returns the trimmed string.
*/
function baseTrim(string) {
return string
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
: string;
}/** Used as references for various `Number` constants. */
var NAN$1 = 0 / 0;
/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex$1 = /^[-+]0x[0-9a-f]+$/i;
/** Used to detect binary string values. */
var reIsBinary$1 = /^0b[01]+$/i;
/** Used to detect octal string values. */
var reIsOctal$1 = /^0o[0-7]+$/i;
/** Built-in method references without a dependency on `root`. */
var freeParseInt$1 = parseInt;
/**
* Converts `value` to a number.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {number} Returns the number.
* @example
*
* _.toNumber(3.2);
* // => 3.2
*
* _.toNumber(Number.MIN_VALUE);
* // => 5e-324
*
* _.toNumber(Infinity);
* // => Infinity
*
* _.toNumber('3.2');
* // => 3.2
*/
function toNumber$1(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol$1(value)) {
return NAN$1;
}
if (isObject$2(value)) {
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
value = isObject$2(other) ? (other + '') : other;
}
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
value = baseTrim(value);
var isBinary = reIsBinary$1.test(value);
return (isBinary || reIsOctal$1.test(value))
? freeParseInt$1(value.slice(2), isBinary ? 2 : 8)
: (reIsBadHex$1.test(value) ? NAN$1 : +value);
}/** Used as references for various `Number` constants. */
var INFINITY$1 = 1 / 0,
MAX_INTEGER = 1.7976931348623157e+308;
/**
* Converts `value` to a finite number.
*
* @static
* @memberOf _
* @since 4.12.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted number.
* @example
*
* _.toFinite(3.2);
* // => 3.2
*
* _.toFinite(Number.MIN_VALUE);
* // => 5e-324
*
* _.toFinite(Infinity);
* // => 1.7976931348623157e+308
*
* _.toFinite('3.2');
* // => 3.2
*/
function toFinite(value) {
if (!value) {
return value === 0 ? value : 0;
}
value = toNumber$1(value);
if (value === INFINITY$1 || value === -INFINITY$1) {
var sign = (value < 0 ? -1 : 1);
return sign * MAX_INTEGER;
}
return value === value ? value : 0;
}/**
* Converts `value` to an integer.
*
* **Note:** This method is loosely based on
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
* @example
*
* _.toInteger(3.2);
* // => 3
*
* _.toInteger(Number.MIN_VALUE);
* // => 0
*
* _.toInteger(Infinity);
* // => 1.7976931348623157e+308
*
* _.toInteger('3.2');
* // => 3
*/
function toInteger(value) {
var result = toFinite(value),
remainder = result % 1;
return result === result ? (remainder ? result - remainder : result) : 0;
}/**
* A specialized version of `_.filter` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}/**
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseFor(fromRight) {
return function(object, iteratee, keysFunc) {
var index = -1,
iterable = Object(object),
props = keysFunc(object),
length = props.length;
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}/**
* The base implementation of `baseForOwn` which iterates over `object`
* properties returned by `keysFunc` and invokes `iteratee` for each property.
* Iteratee functions may exit iteration early by explicitly returning `false`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
var baseFor = createBaseFor();
var baseFor$1 = baseFor;/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}/**
* This method returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2, _.stubFalse);
* // => [false, false]
*/
function stubFalse() {
return false;
}/** Detect free variable `exports`. */
var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
/** Built-in value references. */
var Buffer = moduleExports$1 ? root$2.Buffer : undefined;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
/**
* Checks if `value` is a buffer.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
* @example
*
* _.isBuffer(new Buffer(2));
* // => true
*
* _.isBuffer(new Uint8Array(2));
* // => false
*/
var isBuffer = nativeIsBuffer || stubFalse;
var isBuffer$1 = isBuffer;/** `Object#toString` result references. */
var argsTag$1 = '[object Arguments]',
arrayTag$1 = '[object Array]',
boolTag$2 = '[object Boolean]',
dateTag$1 = '[object Date]',
errorTag$1 = '[object Error]',
funcTag = '[object Function]',
mapTag$4 = '[object Map]',
numberTag$2 = '[object Number]',
objectTag$3 = '[object Object]',
regexpTag$1 = '[object RegExp]',
setTag$4 = '[object Set]',
stringTag$2 = '[object String]',
weakMapTag$1 = '[object WeakMap]';
var arrayBufferTag$1 = '[object ArrayBuffer]',
dataViewTag$2 = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$2] =
typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] =
typedArrayTags[errorTag$1] = typedArrayTags[funcTag] =
typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] =
typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] =
typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] =
typedArrayTags[weakMapTag$1] = false;
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike$1(value) &&
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
}/**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function(value) {
return func(value);
};
}/** Detect free variable `exports`. */
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal$2.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
// Use `util.types` for Node.js 10+.
var types = freeModule && freeModule.require && freeModule.require('util').types;
if (types) {
return types;
}
// Legacy `process.binding('util')` for Node.js < 10.
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {}
}());
var nodeUtil$1 = nodeUtil;/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
var isTypedArray$1 = isTypedArray;/** Used for built-in method references. */
var objectProto$c = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$8 = objectProto$c.hasOwnProperty;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
var isArr = isArray$1(value),
isArg = !isArr && isArguments$1(value),
isBuff = !isArr && !isArg && isBuffer$1(value),
isType = !isArr && !isArg && !isBuff && isTypedArray$1(value),
skipIndexes = isArr || isArg || isBuff || isType,
result = skipIndexes ? baseTimes(value.length, String) : [],
length = result.length;
for (var key in value) {
if ((inherited || hasOwnProperty$8.call(value, key)) &&
!(skipIndexes && (
// Safari 9 has enumerable `arguments.length` in strict mode.
key == 'length' ||
// Node.js 0.10 has enumerable non-index properties on buffers.
(isBuff && (key == 'offset' || key == 'parent')) ||
// PhantomJS 2 has enumerable non-index properties on typed arrays.
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
// Skip index properties.
isIndex(key, length)
))) {
result.push(key);
}
}
return result;
}/** Used for built-in method references. */
var objectProto$b = Object.prototype;
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$b;
return value === proto;
}/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);
var nativeKeys$1 = nativeKeys;/** Used for built-in method references. */
var objectProto$a = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$7 = objectProto$a.hasOwnProperty;
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys$1(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty$7.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}/**
* The base implementation of `_.forOwn` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwn(object, iteratee) {
return object && baseFor$1(object, iteratee, keys);
}/**
* Creates a `baseEach` or `baseEachRight` function.
*
* @private
* @param {Function} eachFunc The function to iterate over a collection.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee) {
if (collection == null) {
return collection;
}
if (!isArrayLike(collection)) {
return eachFunc(collection, iteratee);
}
var length = collection.length,
index = fromRight ? length : -1,
iterable = Object(collection);
while ((fromRight ? index-- : ++index < length)) {
if (iteratee(iterable[index], index, iterable) === false) {
break;
}
}
return collection;
};
}/**
* The base implementation of `_.forEach` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
*/
var baseEach = createBaseEach(baseForOwn);
var baseEach$1 = baseEach;/**
* The base implementation of `_.filter` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function baseFilter(collection, predicate) {
var result = [];
baseEach$1(collection, function(value, index, collection) {
if (predicate(value, index, collection)) {
result.push(value);
}
});
return result;
}/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache;
this.size = 0;
}/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
var data = this.__data__,
result = data['delete'](key);
this.size = data.size;
return result;
}/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
return this.__data__.get(key);
}/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE$2 = 200;
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof ListCache) {
var pairs = data.__data__;
if (!Map$2 || (pairs.length < LARGE_ARRAY_SIZE$2 - 1)) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
}
data = this.__data__ = new MapCache(pairs);
}
data.set(key, value);
this.size = data.size;
return this;
}/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
}
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;
this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
}
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}/**
* Checks if a `cache` value for `key` exists.
*
* @private
* @param {Object} cache The cache to query.
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function cacheHas(cache, key) {
return cache.has(key);
}/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$5 = 1,
COMPARE_UNORDERED_FLAG$3 = 2;
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Check that cyclic values are equal.
var arrStacked = stack.get(array);
var othStacked = stack.get(other);
if (arrStacked && othStacked) {
return arrStacked == other && othStacked == array;
}
var index = -1,
result = true,
seen = (bitmask & COMPARE_UNORDERED_FLAG$3) ? new SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial
? customizer(othValue, arrValue, index, other, array, stack)
: customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!arraySome(other, function(othValue, othIndex) {
if (!cacheHas(seen, othIndex) &&
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result = false;
break;
}
} else if (!(
arrValue === othValue ||
equalFunc(arrValue, othValue, bitmask, customizer, stack)
)) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}/** Built-in value references. */
var Uint8Array = root$2.Uint8Array;
var Uint8Array$1 = Uint8Array;/**
* Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
* @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
result = Array(map.size);
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$4 = 1,
COMPARE_UNORDERED_FLAG$2 = 2;
/** `Object#toString` result references. */
var boolTag$1 = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
mapTag$3 = '[object Map]',
numberTag$1 = '[object Number]',
regexpTag = '[object RegExp]',
setTag$3 = '[object Set]',
stringTag$1 = '[object String]',
symbolTag$1 = '[object Symbol]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag$1 = '[object DataView]';
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol$2 ? Symbol$2.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag$1:
if ((object.byteLength != other.byteLength) ||
(object.byteOffset != other.byteOffset)) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) {
return false;
}
return true;
case boolTag$1:
case dateTag:
case numberTag$1:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag$1:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == (other + '');
case mapTag$3:
var convert = mapToArray;
case setTag$3:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG$2;
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
stack['delete'](object);
return result;
case symbolTag$1:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}/**
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Function} keysFunc The function to get the keys of `object`.
* @param {Function} symbolsFunc The function to get the symbols of `object`.
* @returns {Array} Returns the array of property names and symbols.
*/
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
}/**
* This method returns a new empty array.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Array} Returns the new empty array.
* @example
*
* var arrays = _.times(2, _.stubArray);
*
* console.log(arrays);
* // => [[], []]
*
* console.log(arrays[0] === arrays[1]);
* // => false
*/
function stubArray() {
return [];
}/** Used for built-in method references. */
var objectProto$9 = Object.prototype;
/** Built-in value references. */
var propertyIsEnumerable = objectProto$9.propertyIsEnumerable;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols;
/**
* Creates an array of the own enumerable symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
if (object == null) {
return [];
}
object = Object(object);
return arrayFilter(nativeGetSymbols(object), function(symbol) {
return propertyIsEnumerable.call(object, symbol);
});
};
var getSymbols$1 = getSymbols;/**
* Creates an array of own enumerable property names and symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeys(object) {
return baseGetAllKeys(object, keys, getSymbols$1);
}/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$3 = 1;
/** Used for built-in method references. */
var objectProto$8 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
objProps = getAllKeys(object),
objLength = objProps.length,
othProps = getAllKeys(other),
othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty$6.call(other, key))) {
return false;
}
}
// Check that cyclic values are equal.
var objStacked = stack.get(object);
var othStacked = stack.get(other);
if (objStacked && othStacked) {
return objStacked == other && othStacked == object;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
if (customizer) {
var compared = isPartial
? customizer(othValue, objValue, key, other, object, stack)
: customizer(objValue, othValue, key, object, other, stack);
}
// Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
: compared
)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
}
stack['delete'](object);
stack['delete'](other);
return result;
}/* Built-in method references that are verified to be native. */
var DataView = getNative(root$2, 'DataView');
var DataView$1 = DataView;/* Built-in method references that are verified to be native. */
var Promise$1 = getNative(root$2, 'Promise');
var Promise$2 = Promise$1;/* Built-in method references that are verified to be native. */
var Set$1 = getNative(root$2, 'Set');
var Set$2 = Set$1;/* Built-in method references that are verified to be native. */
var WeakMap = getNative(root$2, 'WeakMap');
var WeakMap$1 = WeakMap;/** `Object#toString` result references. */
var mapTag$2 = '[object Map]',
objectTag$2 = '[object Object]',
promiseTag = '[object Promise]',
setTag$2 = '[object Set]',
weakMapTag = '[object WeakMap]';
var dataViewTag = '[object DataView]';
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView$1),
mapCtorString = toSource(Map$2),
promiseCtorString = toSource(Promise$2),
setCtorString = toSource(Set$2),
weakMapCtorString = toSource(WeakMap$1);
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
if ((DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag) ||
(Map$2 && getTag(new Map$2) != mapTag$2) ||
(Promise$2 && getTag(Promise$2.resolve()) != promiseTag) ||
(Set$2 && getTag(new Set$2) != setTag$2) ||
(WeakMap$1 && getTag(new WeakMap$1) != weakMapTag)) {
getTag = function(value) {
var result = baseGetTag(value),
Ctor = result == objectTag$2 ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : '';
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag$2;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag$2;
case weakMapCtorString: return weakMapTag;
}
}
return result;
};
}
var getTag$1 = getTag;/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$2 = 1;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
objectTag$1 = '[object Object]';
/** Used for built-in method references. */
var objectProto$7 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray$1(object),
othIsArr = isArray$1(other),
objTag = objIsArr ? arrayTag : getTag$1(object),
othTag = othIsArr ? arrayTag : getTag$1(other);
objTag = objTag == argsTag ? objectTag$1 : objTag;
othTag = othTag == argsTag ? objectTag$1 : othTag;
var objIsObj = objTag == objectTag$1,
othIsObj = othTag == objectTag$1,
isSameTag = objTag == othTag;
if (isSameTag && isBuffer$1(object)) {
if (!isBuffer$1(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new Stack);
return (objIsArr || isTypedArray$1(object))
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
var objIsWrapped = objIsObj && hasOwnProperty$5.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty$5.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack);
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack);
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
}/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {boolean} bitmask The bitmask flags.
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Function} [customizer] The function to customize comparisons.
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObjectLike$1(value) && !isObjectLike$1(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$1 = 1,
COMPARE_UNORDERED_FLAG$1 = 2;
/**
* The base implementation of `_.isMatch` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
* @param {Array} matchData The property names, values, and compare flags to match.
* @param {Function} [customizer] The function to customize comparisons.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
*/
function baseIsMatch(object, source, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = Object(object);
while (index--) {
var data = matchData[index];
if ((noCustomizer && data[2])
? data[1] !== object[data[0]]
: !(data[0] in object)
) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
}
} else {
var stack = new Stack;
if (customizer) {
var result = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result === undefined
? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack)
: result
)) {
return false;
}
}
}
return true;
}/**
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` if suitable for strict
* equality comparisons, else `false`.
*/
function isStrictComparable(value) {
return value === value && !isObject$2(value);
}/**
* Gets the property names, values, and compare flags of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the match data of `object`.
*/
function getMatchData(object) {
var result = keys(object),
length = result.length;
while (length--) {
var key = result[length],
value = object[key];
result[length] = [key, value, isStrictComparable(value)];
}
return result;
}/**
* A specialized version of `matchesProperty` for source values suitable
* for strict equality comparisons, i.e. `===`.
*
* @private
* @param {string} key The key of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function matchesStrictComparable(key, srcValue) {
return function(object) {
if (object == null) {
return false;
}
return object[key] === srcValue &&
(srcValue !== undefined || (key in Object(object)));
};
}/**
* The base implementation of `_.matches` which doesn't clone `source`.
*
* @private
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function(object) {
return object === source || baseIsMatch(object, source, matchData);
};
}/**
* Gets the value at `path` of `object`. If the resolved value is
* `undefined`, the `defaultValue` is returned in its place.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.get(object, 'a[0].b.c');
* // => 3
*
* _.get(object, ['a', '0', 'b', 'c']);
* // => 3
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, path);
return result === undefined ? defaultValue : result;
}/**
* The base implementation of `_.hasIn` without support for deep paths.
*
* @private
* @param {Object} [object] The object to query.
* @param {Array|string} key The key to check.
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHasIn(object, key) {
return object != null && key in Object(object);
}/**
* Checks if `path` is a direct or inherited property of `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.hasIn(object, 'a');
* // => true
*
* _.hasIn(object, 'a.b');
* // => true
*
* _.hasIn(object, ['a', 'b']);
* // => true
*
* _.hasIn(object, 'b');
* // => false
*/
function hasIn(object, path) {
return object != null && hasPath(object, path, baseHasIn);
}/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
COMPARE_UNORDERED_FLAG = 2;
/**
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
*
* @private
* @param {string} path The path of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path), srcValue);
}
return function(object) {
var objValue = get(object, path);
return (objValue === undefined && objValue === srcValue)
? hasIn(object, path)
: baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
};
}/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
}/**
* A specialized version of `baseProperty` which supports deep paths.
*
* @private
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyDeep(path) {
return function(object) {
return baseGet(object, path);
};
}/**
* Creates a function that returns the value at `path` of a given object.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Util
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
* @example
*
* var objects = [
* { 'a': { 'b': 2 } },
* { 'a': { 'b': 1 } }
* ];
*
* _.map(objects, _.property('a.b'));
* // => [2, 1]
*
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
* // => [1, 2]
*/
function property(path) {
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
}/**
* The base implementation of `_.iteratee`.
*
* @private
* @param {*} [value=_.identity] The value to convert to an iteratee.
* @returns {Function} Returns the iteratee.
*/
function baseIteratee(value) {
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
if (typeof value == 'function') {
return value;
}
if (value == null) {
return identity;
}
if (typeof value == 'object') {
return isArray$1(value)
? baseMatchesProperty(value[0], value[1])
: baseMatches(value);
}
return property(value);
}/**
* Iterates over elements of `collection`, returning an array of all elements
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
* **Note:** Unlike `_.remove`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @see _.reject
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* _.filter(users, function(o) { return !o.active; });
* // => objects for ['fred']
*
* // The `_.matches` iteratee shorthand.
* _.filter(users, { 'age': 36, 'active': true });
* // => objects for ['barney']
*
* // The `_.matchesProperty` iteratee shorthand.
* _.filter(users, ['active', false]);
* // => objects for ['fred']
*
* // The `_.property` iteratee shorthand.
* _.filter(users, 'active');
* // => objects for ['barney']
*
* // Combining several predicates using `_.overEvery` or `_.overSome`.
* _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
* // => objects for ['fred', 'barney']
*/
function filter(collection, predicate) {
var func = isArray$1(collection) ? arrayFilter : baseFilter;
return func(collection, baseIteratee(predicate));
}/** `Object#toString` result references. */
var mapTag$1 = '[object Map]',
setTag$1 = '[object Set]';
/** Used for built-in method references. */
var objectProto$6 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
/**
* Checks if `value` is an empty object, collection, map, or set.
*
* Objects are considered empty if they have no own enumerable string keyed
* properties.
*
* Array-like values such as `arguments` objects, arrays, buffers, strings, or
* jQuery-like collections are considered empty if they have a `length` of `0`.
* Similarly, maps and sets are considered empty if they have a `size` of `0`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
* @example
*
* _.isEmpty(null);
* // => true
*
* _.isEmpty(true);
* // => true
*
* _.isEmpty(1);
* // => true
*
* _.isEmpty([1, 2, 3]);
* // => false
*
* _.isEmpty({ 'a': 1 });
* // => false
*/
function isEmpty(value) {
if (value == null) {
return true;
}
if (isArrayLike(value) &&
(isArray$1(value) || typeof value == 'string' || typeof value.splice == 'function' ||
isBuffer$1(value) || isTypedArray$1(value) || isArguments$1(value))) {
return !value.length;
}
var tag = getTag$1(value);
if (tag == mapTag$1 || tag == setTag$1) {
return !value.size;
}
if (isPrototype(value)) {
return !baseKeys(value).length;
}
for (var key in value) {
if (hasOwnProperty$4.call(value, key)) {
return false;
}
}
return true;
}/**
* The base implementation of `_.findIndex` and `_.findLastIndex` without
* support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} predicate The function invoked per iteration.
* @param {number} fromIndex The index to search from.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 1 : -1);
while ((fromRight ? index-- : ++index < length)) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
}/**
* The base implementation of `_.isNaN` without support for number objects.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
*/
function baseIsNaN(value) {
return value !== value;
}/**
* A specialized version of `_.indexOf` which performs strict equality
* comparisons of values, i.e. `===`.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}/**
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseIndexOf(array, value, fromIndex) {
return value === value
? strictIndexOf(array, value, fromIndex)
: baseFindIndex(array, baseIsNaN, fromIndex);
}/**
* A specialized version of `_.includes` for arrays without support for
* specifying an index to search from.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && baseIndexOf(array, value, 0) > -1;
}/**
* This function is like `arrayIncludes` except that it accepts a comparator.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @param {Function} comparator The comparator invoked per element.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludesWith(array, value, comparator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}/**
* This method is like `_.isArrayLike` except that it also checks if `value`
* is an object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object,
* else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
* // => true
*
* _.isArrayLikeObject(document.body.children);
* // => true
*
* _.isArrayLikeObject('abc');
* // => false
*
* _.isArrayLikeObject(_.noop);
* // => false
*/
function isArrayLikeObject(value) {
return isObjectLike$1(value) && isArrayLike(value);
}/**
* A specialized version of `_.forEach` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}/**
* Casts `value` to `identity` if it's not a function.
*
* @private
* @param {*} value The value to inspect.
* @returns {Function} Returns cast function.
*/
function castFunction(value) {
return typeof value == 'function' ? value : identity;
}/**
* Iterates over elements of `collection` and invokes `iteratee` for each element.
* The iteratee is invoked with three arguments: (value, index|key, collection).
* Iteratee functions may exit iteration early by explicitly returning `false`.
*
* **Note:** As with other "Collections" methods, objects with a "length"
* property are iterated like arrays. To avoid this behavior use `_.forIn`
* or `_.forOwn` for object iteration.
*
* @static
* @memberOf _
* @since 0.1.0
* @alias each
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
* @see _.forEachRight
* @example
*
* _.forEach([1, 2], function(value) {
* console.log(value);
* });
* // => Logs `1` then `2`.
*
* _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
* console.log(key);
* });
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
*/
function forEach(collection, iteratee) {
var func = isArray$1(collection) ? arrayEach : baseEach$1;
return func(collection, castFunction(iteratee));
}var getDefaultPropName = function getDefaultPropName(prop) {
return "default" + (prop[0].toUpperCase() + prop.slice(1));
};
/**
* Return the auto controlled state value for a give prop. The initial value is chosen in this order:
* - regular props
* - then, default props
* - then, initial state
* - then, `checked` defaults to false
* - then, `value` defaults to '' or [] if props.multiple
* - else, undefined
*
* @param {string} propName A prop name
* @param {object} [props] A props object
* @param {object} [state] A state object
* @param {boolean} [includeDefaults=false] Whether or not to heed the default props or initial state
*/
var getAutoControlledStateValue = function getAutoControlledStateValue(propName, props, state, includeDefaults) {
if (includeDefaults === void 0) {
includeDefaults = false;
}
// regular props
var propValue = props[propName];
if (propValue !== undefined) return propValue;
if (includeDefaults) {
// defaultProps
var defaultProp = props[getDefaultPropName(propName)];
if (defaultProp !== undefined) return defaultProp; // initial state - state may be null or undefined
if (state) {
var initialState = state[propName];
if (initialState !== undefined) return initialState;
}
} // React doesn't allow changing from uncontrolled to controlled components,
// default checked/value if they were not present.
if (propName === 'checked') return false;
if (propName === 'value') return props.multiple ? [] : ''; // otherwise, undefined
};
var ModernAutoControlledComponent = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(ModernAutoControlledComponent, _React$Component);
function ModernAutoControlledComponent() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
var _this$constructor = _this.constructor,
autoControlledProps = _this$constructor.autoControlledProps,
getAutoControlledStateFromProps = _this$constructor.getAutoControlledStateFromProps;
var state = _invoke(_assertThisInitialized(_this), 'getInitialAutoControlledState', _this.props) || {};
// Set initial state by copying auto controlled props to state.
// Also look for the default prop for any auto controlled props (foo => defaultFoo)
// so we can set initial values from defaults.
var initialAutoControlledState = autoControlledProps.reduce(function (acc, prop) {
acc[prop] = getAutoControlledStateValue(prop, _this.props, state, true);
return acc;
}, {});
_this.state = _extends$6({}, state, initialAutoControlledState, {
autoControlledProps: autoControlledProps,
getAutoControlledStateFromProps: getAutoControlledStateFromProps
});
return _this;
}
ModernAutoControlledComponent.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
var autoControlledProps = state.autoControlledProps,
getAutoControlledStateFromProps = state.getAutoControlledStateFromProps; // Solve the next state for autoControlledProps
var newStateFromProps = autoControlledProps.reduce(function (acc, prop) {
var isNextDefined = !isUndefined(props[prop]); // if next is defined then use its value
if (isNextDefined) acc[prop] = props[prop];
return acc;
}, {}); // Due to the inheritance of the AutoControlledComponent we should call its
// getAutoControlledStateFromProps() and merge it with the existing state
if (getAutoControlledStateFromProps) {
var computedState = getAutoControlledStateFromProps(props, _extends$6({}, state, newStateFromProps), state); // We should follow the idea of getDerivedStateFromProps() and return only modified state
return _extends$6({}, newStateFromProps, computedState);
}
return newStateFromProps;
}
/**
* Override this method to use getDerivedStateFromProps() in child components.
*/
;
ModernAutoControlledComponent.getAutoControlledStateFromProps = function getAutoControlledStateFromProps() {
return null;
};
return ModernAutoControlledComponent;
}(React__default.Component);/**
* Creates a `_.find` or `_.findLast` function.
*
* @private
* @param {Function} findIndexFunc The function to find the collection index.
* @returns {Function} Returns the new find function.
*/
function createFind(findIndexFunc) {
return function(collection, predicate, fromIndex) {
var iterable = Object(collection);
if (!isArrayLike(collection)) {
var iteratee = baseIteratee(predicate);
collection = keys(collection);
predicate = function(key) { return iteratee(iterable[key], key, iterable); };
}
var index = findIndexFunc(collection, predicate, fromIndex);
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
};
}/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$7 = Math.max;
/**
* This method is like `_.find` except that it returns the index of the first
* element `predicate` returns truthy for instead of the element itself.
*
* @static
* @memberOf _
* @since 1.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': true }
* ];
*
* _.findIndex(users, function(o) { return o.user == 'barney'; });
* // => 0
*
* // The `_.matches` iteratee shorthand.
* _.findIndex(users, { 'user': 'fred', 'active': false });
* // => 1
*
* // The `_.matchesProperty` iteratee shorthand.
* _.findIndex(users, ['active', false]);
* // => 0
*
* // The `_.property` iteratee shorthand.
* _.findIndex(users, 'active');
* // => 2
*/
function findIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax$7(length + index, 0);
}
return baseFindIndex(array, baseIteratee(predicate), index);
}/**
* Iterates over elements of `collection`, returning the first element
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false },
* { 'user': 'pebbles', 'age': 1, 'active': true }
* ];
*
* _.find(users, function(o) { return o.age < 40; });
* // => object for 'barney'
*
* // The `_.matches` iteratee shorthand.
* _.find(users, { 'age': 1, 'active': true });
* // => object for 'pebbles'
*
* // The `_.matchesProperty` iteratee shorthand.
* _.find(users, ['active', false]);
* // => object for 'fred'
*
* // The `_.property` iteratee shorthand.
* _.find(users, 'active');
* // => object for 'barney'
*/
var find = createFind(findIndex);
var _find = find;/**
* The base implementation of `_.some` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function baseSome(collection, predicate) {
var result;
baseEach$1(collection, function(value, index, collection) {
result = predicate(value, index, collection);
return !result;
});
return !!result;
}/**
* Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
* else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject$2(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike(object) && isIndex(index, object.length))
: (type == 'string' && index in object)
) {
return eq(object[index], value);
}
return false;
}/**
* Checks if `predicate` returns truthy for **any** element of `collection`.
* Iteration is stopped once `predicate` returns truthy. The predicate is
* invoked with three arguments: (value, index|key, collection).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
* @example
*
* _.some([null, 0, 'yes', false], Boolean);
* // => true
*
* var users = [
* { 'user': 'barney', 'active': true },
* { 'user': 'fred', 'active': false }
* ];
*
* // The `_.matches` iteratee shorthand.
* _.some(users, { 'user': 'barney', 'active': false });
* // => false
*
* // The `_.matchesProperty` iteratee shorthand.
* _.some(users, ['active', false]);
* // => true
*
* // The `_.property` iteratee shorthand.
* _.some(users, 'active');
* // => true
*/
function some(collection, predicate, guard) {
var func = isArray$1(collection) ? arraySome : baseSome;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined;
}
return func(collection, baseIteratee(predicate));
}/**
* Determine if child by type exists in children.
* @param {Object} children The children prop of a component.
* @param {string|Function} type An html tag name string or React component.
* @returns {Boolean}
*/
var someByType = function someByType(children, type) {
return some(Children.toArray(children), {
type: type
});
};
/**
* Tests if children are nil in React and Preact.
* @param {Object} children The children prop of a component.
* @returns {Boolean}
*/
var isNil$1 = function isNil(children) {
return children === null || children === undefined || Array.isArray(children) && children.length === 0;
};var numberToWordMap = {
1: 'one',
2: 'two',
3: 'three',
4: 'four',
5: 'five',
6: 'six',
7: 'seven',
8: 'eight',
9: 'nine',
10: 'ten',
11: 'eleven',
12: 'twelve',
13: 'thirteen',
14: 'fourteen',
15: 'fifteen',
16: 'sixteen'
};
/**
* Return the number word for numbers 1-16.
* Returns strings or numbers as is if there is no corresponding word.
* Returns an empty string if value is not a string or number.
* @param {string|number} value The value to convert to a word.
* @returns {string}
*/
function numberToWord(value) {
var type = typeof value;
if (type === 'string' || type === 'number') {
return numberToWordMap[value] || value;
}
return '';
}/*
* There are 3 prop patterns used to build up the className for a component.
* Each utility here is meant for use in a classnames() argument.
*
* There is no util for valueOnly() because it would simply return val.
* Use the prop value inline instead.
* <Label size='big' />
* <div class="ui big label"></div>
*/
/**
* Props where only the prop key is used in the className.
* @param {*} val A props value
* @param {string} key A props key
*
* @example
* <Label tag />
* <div class="ui tag label"></div>
*/
var useKeyOnly = function useKeyOnly(val, key) {
return val && key;
};
/**
* Props that require both a key and value to create a className.
* @param {*} val A props value
* @param {string} key A props key
*
* @example
* <Label corner='left' />
* <div class="ui left corner label"></div>
*/
var useValueAndKey = function useValueAndKey(val, key) {
return val && val !== true && val + " " + key;
};
/**
* Props whose key will be used in className, or value and key.
* @param {*} val A props value
* @param {string} key A props key
*
* @example Key Only
* <Label pointing />
* <div class="ui pointing label"></div>
*
* @example Key and Value
* <Label pointing='left' />
* <div class="ui left pointing label"></div>
*/
var useKeyOrValueAndKey = function useKeyOrValueAndKey(val, key) {
return val && (val === true ? key : val + " " + key);
}; //
// Prop to className exceptions
//
/**
* The "multiple" prop implements control of visibility and reserved classes for Grid subcomponents.
*
* @param {*} val The value of the "multiple" prop
* @param {*} key A props key
*
* @example
* <Grid.Row only='mobile' />
* <Grid.Row only='mobile tablet' />
* <div class="mobile only row"></div>
* <div class="mobile only tablet only row"></div>
*/
var useMultipleProp = function useMultipleProp(val, key) {
if (!val || val === true) return null;
return val.replace('large screen', 'large-screen').replace(/ vertically/g, '-vertically').split(' ').map(function (prop) {
return prop.replace('-', ' ') + " " + key;
}).join(' ');
};
/**
* The "textAlign" prop follows the useValueAndKey except when the value is "justified'.
* In this case, only the class "justified" is used, ignoring the "aligned" class.
* @param {*} val The value of the "textAlign" prop
*
* @example
* <Container textAlign='justified' />
* <div class="ui justified container"></div>
*
* @example
* <Container textAlign='left' />
* <div class="ui left aligned container"></div>
*/
var useTextAlignProp = function useTextAlignProp(val) {
return val === 'justified' ? 'justified' : useValueAndKey(val, 'aligned');
};
/**
* The "verticalAlign" prop follows the useValueAndKey.
*
* @param {*} val The value of the "verticalAlign" prop
*
* @example
* <Grid verticalAlign='middle' />
* <div class="ui middle aligned grid"></div>
*/
var useVerticalAlignProp = function useVerticalAlignProp(val) {
return useValueAndKey(val, 'aligned');
};
/**
* Create "X", "X wide" and "equal width" classNames.
* "X" is a numberToWord value and "wide" is configurable.
* @param {*} val The prop value
* @param {string} [widthClass=''] The class
* @param {boolean} [canEqual=false] Flag that indicates possibility of "equal" value
*
* @example
* <Grid columns='equal' />
* <div class="ui equal width grid"></div>
*
* <Form widths='equal' />
* <div class="ui equal width form"></div>
*
* <FieldGroup widths='equal' />
* <div class="equal width fields"></div>
*
* @example
* <Grid columns={4} />
* <div class="ui four column grid"></div>
*/
var useWidthProp = function useWidthProp(val, widthClass, canEqual) {
if (widthClass === void 0) {
widthClass = '';
}
if (canEqual === void 0) {
canEqual = false;
}
if (canEqual && val === 'equal') {
return 'equal width';
}
var valType = typeof val;
if ((valType === 'string' || valType === 'number') && widthClass) {
return numberToWord(val) + " " + widthClass;
}
return numberToWord(val);
};/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE$1 = 200;
/**
* The base implementation of methods like `_.difference` without support
* for excluding multiple arrays or iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Array} values The values to exclude.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of filtered values.
*/
function baseDifference(array, values, iteratee, comparator) {
var index = -1,
includes = arrayIncludes,
isCommon = true,
length = array.length,
result = [],
valuesLength = values.length;
if (!length) {
return result;
}
if (iteratee) {
values = arrayMap(values, baseUnary(iteratee));
}
if (comparator) {
includes = arrayIncludesWith;
isCommon = false;
}
else if (values.length >= LARGE_ARRAY_SIZE$1) {
includes = cacheHas;
isCommon = false;
values = new SetCache(values);
}
outer:
while (++index < length) {
var value = array[index],
computed = iteratee == null ? value : iteratee(value);
value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
var valuesIndex = valuesLength;
while (valuesIndex--) {
if (values[valuesIndex] === computed) {
continue outer;
}
}
result.push(value);
}
else if (!includes(values, computed, comparator)) {
result.push(value);
}
}
return result;
}/** Built-in value references. */
var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : undefined;
/**
* Checks if `value` is a flattenable `arguments` object or array.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
function isFlattenable(value) {
return isArray$1(value) || isArguments$1(value) ||
!!(spreadableSymbol && value && value[spreadableSymbol]);
}/**
* The base implementation of `_.flatten` with support for restricting flattening.
*
* @private
* @param {Array} array The array to flatten.
* @param {number} depth The maximum recursion depth.
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
* @param {Array} [result=[]] The initial result value.
* @returns {Array} Returns the new flattened array.
*/
function baseFlatten(array, depth, predicate, isStrict, result) {
var index = -1,
length = array.length;
predicate || (predicate = isFlattenable);
result || (result = []);
while (++index < length) {
var value = array[index];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
// Recursively flatten arrays (susceptible to call stack limits).
baseFlatten(value, depth - 1, predicate, isStrict, result);
} else {
arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}/**
* Creates an array of `array` values not included in the other given arrays
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. The order and references of result values are
* determined by the first array.
*
* **Note:** Unlike `_.pullAll`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
* @see _.without, _.xor
* @example
*
* _.difference([2, 1], [2, 3]);
* // => [1]
*/
var difference = baseRest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
: [];
});
var _difference = difference;/**
* Casts `array` to a slice if it's needed.
*
* @private
* @param {Array} array The array to inspect.
* @param {number} start The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the cast slice.
*/
function castSlice(array, start, end) {
var length = array.length;
end = end === undefined ? length : end;
return (!start && end >= length) ? array : baseSlice(array, start, end);
}/**
* Converts an ASCII `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function asciiToArray(string) {
return string.split('');
}/** Used to compose unicode character classes. */
var rsAstralRange$3 = '\\ud800-\\udfff',
rsComboMarksRange$4 = '\\u0300-\\u036f',
reComboHalfMarksRange$4 = '\\ufe20-\\ufe2f',
rsComboSymbolsRange$4 = '\\u20d0-\\u20ff',
rsComboRange$4 = rsComboMarksRange$4 + reComboHalfMarksRange$4 + rsComboSymbolsRange$4,
rsVarRange$3 = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */
var rsZWJ$3 = '\\u200d';
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasUnicode = RegExp('[' + rsZWJ$3 + rsAstralRange$3 + rsComboRange$4 + rsVarRange$3 + ']');
/**
* Checks if `string` contains Unicode symbols.
*
* @private
* @param {string} string The string to inspect.
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
*/
function hasUnicode(string) {
return reHasUnicode.test(string);
}/** Used to compose unicode character classes. */
var rsAstralRange$2 = '\\ud800-\\udfff',
rsComboMarksRange$3 = '\\u0300-\\u036f',
reComboHalfMarksRange$3 = '\\ufe20-\\ufe2f',
rsComboSymbolsRange$3 = '\\u20d0-\\u20ff',
rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3,
rsVarRange$2 = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */
var rsAstral$1 = '[' + rsAstralRange$2 + ']',
rsCombo$3 = '[' + rsComboRange$3 + ']',
rsFitz$2 = '\\ud83c[\\udffb-\\udfff]',
rsModifier$2 = '(?:' + rsCombo$3 + '|' + rsFitz$2 + ')',
rsNonAstral$2 = '[^' + rsAstralRange$2 + ']',
rsRegional$2 = '(?:\\ud83c[\\udde6-\\uddff]){2}',
rsSurrPair$2 = '[\\ud800-\\udbff][\\udc00-\\udfff]',
rsZWJ$2 = '\\u200d';
/** Used to compose unicode regexes. */
var reOptMod$2 = rsModifier$2 + '?',
rsOptVar$2 = '[' + rsVarRange$2 + ']?',
rsOptJoin$2 = '(?:' + rsZWJ$2 + '(?:' + [rsNonAstral$2, rsRegional$2, rsSurrPair$2].join('|') + ')' + rsOptVar$2 + reOptMod$2 + ')*',
rsSeq$2 = rsOptVar$2 + reOptMod$2 + rsOptJoin$2,
rsSymbol$1 = '(?:' + [rsNonAstral$2 + rsCombo$3 + '?', rsCombo$3, rsRegional$2, rsSurrPair$2, rsAstral$1].join('|') + ')';
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var reUnicode$1 = RegExp(rsFitz$2 + '(?=' + rsFitz$2 + ')|' + rsSymbol$1 + rsSeq$2, 'g');
/**
* Converts a Unicode `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function unicodeToArray(string) {
return string.match(reUnicode$1) || [];
}/**
* Converts `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function stringToArray(string) {
return hasUnicode(string)
? unicodeToArray(string)
: asciiToArray(string);
}/**
* The base implementation of `assignValue` and `assignMergeValue` without
* value checks.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function baseAssignValue(object, key, value) {
if (key == '__proto__' && defineProperty$1) {
defineProperty$1(object, key, {
'configurable': true,
'enumerable': true,
'value': value,
'writable': true
});
} else {
object[key] = value;
}
}/** Used for built-in method references. */
var objectProto$5 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty$3.call(object, key) && eq(objValue, value)) ||
(value === undefined && !(key in object))) {
baseAssignValue(object, key, value);
}
}/**
* The base implementation of `_.set`.
*
* @private
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
* @param {*} value The value to set.
* @param {Function} [customizer] The function to customize path creation.
* @returns {Object} Returns `object`.
*/
function baseSet(object, path, value, customizer) {
if (!isObject$2(object)) {
return object;
}
path = castPath(path, object);
var index = -1,
length = path.length,
lastIndex = length - 1,
nested = object;
while (nested != null && ++index < length) {
var key = toKey(path[index]),
newValue = value;
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
return object;
}
if (index != lastIndex) {
var objValue = nested[key];
newValue = customizer ? customizer(objValue, key, nested) : undefined;
if (newValue === undefined) {
newValue = isObject$2(objValue)
? objValue
: (isIndex(path[index + 1]) ? [] : {});
}
}
assignValue(nested, key, newValue);
nested = nested[key];
}
return object;
}/**
* The base implementation of `_.pickBy` without support for iteratee shorthands.
*
* @private
* @param {Object} object The source object.
* @param {string[]} paths The property paths to pick.
* @param {Function} predicate The function invoked per property.
* @returns {Object} Returns the new object.
*/
function basePickBy(object, paths, predicate) {
var index = -1,
length = paths.length,
result = {};
while (++index < length) {
var path = paths[index],
value = baseGet(object, path);
if (predicate(value, path)) {
baseSet(result, castPath(path, object), value);
}
}
return result;
}/**
* The base implementation of `_.pick` without support for individual
* property identifiers.
*
* @private
* @param {Object} object The source object.
* @param {string[]} paths The property paths to pick.
* @returns {Object} Returns the new object.
*/
function basePick(object, paths) {
return basePickBy(object, paths, function(value, path) {
return hasIn(object, path);
});
}/**
* Flattens `array` a single level deep.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to flatten.
* @returns {Array} Returns the new flattened array.
* @example
*
* _.flatten([1, [2, [3, [4]], 5]]);
* // => [1, 2, [3, [4]], 5]
*/
function flatten(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, 1) : [];
}/**
* A specialized version of `baseRest` which flattens the rest array.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @returns {Function} Returns the new function.
*/
function flatRest(func) {
return setToString$1(overRest(func, undefined, flatten), func + '');
}/**
* Creates an object composed of the picked `object` properties.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [paths] The property paths to pick.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.pick(object, ['a', 'c']);
* // => { 'a': 1, 'c': 3 }
*/
var pick = flatRest(function(object, paths) {
return object == null ? {} : basePick(object, paths);
});
var _pick = pick;/** Built-in value references. */
var getPrototype = overArg(Object.getPrototypeOf, Object);
var getPrototype$1 = getPrototype;/** `Object#toString` result references. */
var objectTag = '[object Object]';
/** Used for built-in method references. */
var funcProto = Function.prototype,
objectProto$4 = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty$2 = objectProto$4.hasOwnProperty;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike$1(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype$1(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty$2.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
funcToString.call(Ctor) == objectCtorString;
}/**
* Checks if `value` is `null` or `undefined`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is nullish, else `false`.
* @example
*
* _.isNil(null);
* // => true
*
* _.isNil(void 0);
* // => true
*
* _.isNil(NaN);
* // => false
*/
function isNil(value) {
return value == null;
}/**
* The base implementation of `_.map` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function baseMap(collection, iteratee) {
var index = -1,
result = isArrayLike(collection) ? Array(collection.length) : [];
baseEach$1(collection, function(value, key, collection) {
result[++index] = iteratee(value, key, collection);
});
return result;
}/**
* Creates an array of values by running each element in `collection` thru
* `iteratee`. The iteratee is invoked with three arguments:
* (value, index|key, collection).
*
* Many lodash methods are guarded to work as iteratees for methods like
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
*
* The guarded methods are:
* `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
* `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
* `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
* `template`, `trim`, `trimEnd`, `trimStart`, and `words`
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
* @example
*
* function square(n) {
* return n * n;
* }
*
* _.map([4, 8], square);
* // => [16, 64]
*
* _.map({ 'a': 4, 'b': 8 }, square);
* // => [16, 64] (iteration order is not guaranteed)
*
* var users = [
* { 'user': 'barney' },
* { 'user': 'fred' }
* ];
*
* // The `_.property` iteratee shorthand.
* _.map(users, 'user');
* // => ['barney', 'fred']
*/
function map(collection, iteratee) {
var func = isArray$1(collection) ? arrayMap : baseMap;
return func(collection, baseIteratee(iteratee));
}/*!
Copyright (c) 2015 Jed Watson.
Based on code that is Copyright 2013-2015, Facebook, Inc.
All rights reserved.
*/
var exenv = createCommonjsModule(function (module) {
/* global define */
(function () {
var canUseDOM = !!(
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
);
var ExecutionEnvironment = {
canUseDOM: canUseDOM,
canUseWorkers: typeof Worker !== 'undefined',
canUseEventListeners:
canUseDOM && !!(window.addEventListener || window.attachEvent),
canUseViewport: canUseDOM && !!window.screen
};
if (module.exports) {
module.exports = ExecutionEnvironment;
} else {
window.ExecutionEnvironment = ExecutionEnvironment;
}
}());
});var eventStack_production = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports,"__esModule",{value:!0});function _typeof(e){return (_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r);}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t);}function _getPrototypeOf(e){return (_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf(e,t){return (_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn(e,t){return !t||"object"!=typeof t&&"function"!=typeof t?_assertThisInitialized(e):t}var EventSet=function(){function e(t){_classCallCheck(this,e),_defineProperty(this,"handlers",void 0),this.handlers=t.slice(0);}return _createClass(e,[{key:"addHandlers",value:function(t){for(var n=this.handlers.slice(0),r=t.length,o=0;o<r;o+=1)n.push(t[o]);return new e(n)}},{key:"dispatchEvent",value:function(e,t){var n=this.handlers.length-1;if(t){for(var r=n;r>=0;r-=1)this.handlers[r].called||(this.handlers[r].called=!0,this.handlers[r](e));for(var o=n;o>=0;o-=1)this.handlers[o].called=!1;}else {(0, this.handlers[n])(e);}}},{key:"hasHandlers",value:function(){return this.handlers.length>0}},{key:"removeHandlers",value:function(t){for(var n=[],r=this.handlers.length,o=0;o<r;o+=1){var a=this.handlers[o];-1===t.indexOf(a)&&n.push(a);}return new e(n)}}]),e}();function cloneMap(e){var t=new Map;return e.forEach(function(e,n){t.set(n,e);}),t}function normalizeHandlers(e){return Array.isArray(e)?e:[e]}var isRefObject=function(e){return null!==e&&"object"===_typeof(e)&&e.hasOwnProperty("current")};function normalizeTarget(e){return "document"===e?document:"window"===e?window:isRefObject(e)?e.current||document:e||document}var EventPool=function(){function e(t,n){_classCallCheck(this,e),_defineProperty(this,"handlerSets",void 0),_defineProperty(this,"poolName",void 0),this.handlerSets=n,this.poolName=t;}return _createClass(e,[{key:"addHandlers",value:function(t,n){var r=cloneMap(this.handlerSets);if(r.has(t)){var o=r.get(t);r.set(t,o.addHandlers(n));}else r.set(t,new EventSet(n));return new e(this.poolName,r)}},{key:"dispatchEvent",value:function(e,t){var n=this.handlerSets.get(e),r="default"===this.poolName;n&&n.dispatchEvent(t,r);}},{key:"hasHandlers",value:function(e){if(!e)return this.handlerSets.size>0;var t=this.handlerSets.get(e);return !!t&&t.hasHandlers()}},{key:"removeHandlers",value:function(t,n){var r=cloneMap(this.handlerSets);if(!r.has(t))return new e(this.poolName,r);var o=r.get(t).removeHandlers(n);return o.hasHandlers()?r.set(t,o):r.delete(t),new e(this.poolName,r)}}]),e}();_defineProperty(EventPool,"createByType",function(e,t,n){var r=new Map;return r.set(t,new EventSet(n)),new EventPool(e,r)});var EventTarget=function(){function e(t){var n=this;_classCallCheck(this,e),_defineProperty(this,"handlers",new Map),_defineProperty(this,"pools",new Map),_defineProperty(this,"target",void 0),_defineProperty(this,"createEmitter",function(e){return function(t){n.pools.forEach(function(n){n.dispatchEvent(e,t);});}}),this.target=t;}return _createClass(e,[{key:"addHandlers",value:function(e,t,n){if(this.pools.has(e)){var r=this.pools.get(e);this.pools.set(e,r.addHandlers(t,n));}else this.pools.set(e,EventPool.createByType(e,t,n));this.handlers.has(t)||this.addTargetHandler(t);}},{key:"hasHandlers",value:function(){return this.handlers.size>0}},{key:"removeHandlers",value:function(e,t,n){if(this.pools.has(e)){var r=this.pools.get(e).removeHandlers(t,n);r.hasHandlers()?this.pools.set(e,r):this.pools.delete(e);var o=!1;this.pools.forEach(function(e){return o=o||e.hasHandlers(t)}),o||this.removeTargetHandler(t);}}},{key:"addTargetHandler",value:function(e){var t=this.createEmitter(e);this.handlers.set(e,t),this.target.addEventListener(e,t,!0);}},{key:"removeTargetHandler",value:function(e){this.handlers.has(e)&&(this.target.removeEventListener(e,this.handlers.get(e),!0),this.handlers.delete(e));}}]),e}(),EventStack=function(){function e(){var t=this;_classCallCheck(this,e),_defineProperty(this,"targets",new Map),_defineProperty(this,"getTarget",function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=normalizeTarget(e);if(t.targets.has(r))return t.targets.get(r);if(!n)return null;var o=new EventTarget(r);return t.targets.set(r,o),o}),_defineProperty(this,"removeTarget",function(e){t.targets.delete(normalizeTarget(e));});}return _createClass(e,[{key:"sub",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(exenv.canUseDOM){var r=n.target,o=void 0===r?document:r,a=n.pool,s=void 0===a?"default":a;this.getTarget(o).addHandlers(s,e,normalizeHandlers(t));}}},{key:"unsub",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(exenv.canUseDOM){var r=n.target,o=void 0===r?document:r,a=n.pool,s=void 0===a?"default":a,i=this.getTarget(o,!1);i&&(i.removeHandlers(s,e,normalizeHandlers(t)),i.hasHandlers()||this.removeTarget(o));}}}]),e}(),instance=new EventStack,EventStack$1=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React__default.PureComponent),_createClass(t,[{key:"componentDidMount",value:function(){this.subscribe(this.props);}},{key:"componentDidUpdate",value:function(e){this.unsubscribe(e),this.subscribe(this.props);}},{key:"componentWillUnmount",value:function(){this.unsubscribe(this.props);}},{key:"subscribe",value:function(e){var t=e.name,n=e.on,r=e.pool,o=e.target;instance.sub(t,n,{pool:r,target:o});}},{key:"unsubscribe",value:function(e){var t=e.name,n=e.on,r=e.pool,o=e.target;instance.unsub(t,n,{pool:r,target:o});}},{key:"render",value:function(){return null}}]),t}();_defineProperty(EventStack$1,"defaultProps",{pool:"default",target:"document"}),EventStack$1.propTypes={},exports.instance=instance,exports.default=EventStack$1;
});var stack;
{
stack = eventStack_production;
}
var lib = stack.default;
var instance = stack.instance;
lib.instance = instance;/**
* This method returns `undefined`.
*
* @static
* @memberOf _
* @since 2.3.0
* @category Util
* @example
*
* _.times(2, _.noop);
* // => [undefined, undefined]
*/
function noop() {
// No operation performed.
}/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/**
* Creates a set object of `values`.
*
* @private
* @param {Array} values The values to add to the set.
* @returns {Object} Returns the new set.
*/
var createSet = !(Set$2 && (1 / setToArray(new Set$2([,-0]))[1]) == INFINITY) ? noop : function(values) {
return new Set$2(values);
};
var createSet$1 = createSet;/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/**
* The base implementation of `_.uniqBy` without support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new duplicate free array.
*/
function baseUniq(array, iteratee, comparator) {
var index = -1,
includes = arrayIncludes,
length = array.length,
isCommon = true,
result = [],
seen = result;
if (comparator) {
isCommon = false;
includes = arrayIncludesWith;
}
else if (length >= LARGE_ARRAY_SIZE) {
var set = iteratee ? null : createSet$1(array);
if (set) {
return setToArray(set);
}
isCommon = false;
includes = cacheHas;
seen = new SetCache;
}
else {
seen = iteratee ? [] : result;
}
outer:
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;
}
}
if (iteratee) {
seen.push(computed);
}
result.push(value);
}
else if (!includes(seen, computed, comparator)) {
if (seen !== result) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}/**
* Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons, in which only the first occurrence of each element
* is kept. The order of result values is determined by the order they occur
* in the array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @returns {Array} Returns the new duplicate free array.
* @example
*
* _.uniq([2, 1, 2]);
* // => [2, 1]
*/
function uniq(array) {
return (array && array.length) ? baseUniq(array) : [];
}/** `Object#toString` result references. */
var numberTag = '[object Number]';
/**
* Checks if `value` is classified as a `Number` primitive or object.
*
* **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
* classified as numbers, use the `_.isFinite` method.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a number, else `false`.
* @example
*
* _.isNumber(3);
* // => true
*
* _.isNumber(Number.MIN_VALUE);
* // => true
*
* _.isNumber(Infinity);
* // => true
*
* _.isNumber('3');
* // => false
*/
function isNumber(value) {
return typeof value == 'number' ||
(isObjectLike$1(value) && baseGetTag(value) == numberTag);
}/** `Object#toString` result references. */
var stringTag = '[object String]';
/**
* Checks if `value` is classified as a `String` primitive or object.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
* @example
*
* _.isString('abc');
* // => true
*
* _.isString(1);
* // => false
*/
function isString(value) {
return typeof value == 'string' ||
(!isArray$1(value) && isObjectLike$1(value) && baseGetTag(value) == stringTag);
}/** `Object#toString` result references. */
var boolTag = '[object Boolean]';
/**
* Checks if `value` is classified as a boolean primitive or object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
* @example
*
* _.isBoolean(false);
* // => true
*
* _.isBoolean(null);
* // => false
*/
function isBoolean(value) {
return value === true || value === false ||
(isObjectLike$1(value) && baseGetTag(value) == boolTag);
}function toVal(mix) {
var k, y, str='';
if (typeof mix === 'string' || typeof mix === 'number') {
str += mix;
} else if (typeof mix === 'object') {
if (Array.isArray(mix)) {
for (k=0; k < mix.length; k++) {
if (mix[k]) {
if (y = toVal(mix[k])) {
str && (str += ' ');
str += y;
}
}
}
} else {
for (k in mix) {
if (mix[k]) {
str && (str += ' ');
str += k;
}
}
}
}
return str;
}
function cx () {
var i=0, tmp, x, str='';
while (i < arguments.length) {
if (tmp = arguments[i++]) {
if (x = toVal(tmp)) {
str && (str += ' ');
str += x;
}
}
}
return str;
}// Factories
// ============================================================
/**
* A more robust React.createElement. It can create elements from primitive values.
*
* @param {function|string} Component A ReactClass or string
* @param {function} mapValueToProps A function that maps a primitive value to the Component props
* @param {string|object|function} val The value to create a ReactElement from
* @param {Object} [options={}]
* @param {object} [options.defaultProps={}] Default props object
* @param {object|function} [options.overrideProps={}] Override props object or function (called with regular props)
* @param {boolean} [options.autoGenerateKey=true] Whether or not automatic key generation is allowed
* @returns {object|null}
*/
function createShorthand(Component, mapValueToProps, val, options) {
if (options === void 0) {
options = {};
}
if (typeof Component !== 'function' && typeof Component !== 'string') {
throw new Error('createShorthand() Component must be a string or function.');
} // short circuit noop values
if (isNil(val) || isBoolean(val)) {
return null;
}
var valIsString = isString(val);
var valIsNumber = isNumber(val);
var valIsFunction = isFunction(val);
var valIsReactElement = /*#__PURE__*/React.isValidElement(val);
var valIsPropsObject = isPlainObject(val);
var valIsPrimitiveValue = valIsString || valIsNumber || isArray$1(val); // unhandled type return null
/* eslint-disable no-console */
if (!valIsFunction && !valIsReactElement && !valIsPropsObject && !valIsPrimitiveValue) {
return null;
}
/* eslint-enable no-console */
// ----------------------------------------
// Build up props
// ----------------------------------------
var _options = options,
_options$defaultProps = _options.defaultProps,
defaultProps = _options$defaultProps === void 0 ? {} : _options$defaultProps; // User's props
var usersProps = valIsReactElement && val.props || valIsPropsObject && val || valIsPrimitiveValue && mapValueToProps(val); // Override props
var _options2 = options,
_options2$overridePro = _options2.overrideProps,
overrideProps = _options2$overridePro === void 0 ? {} : _options2$overridePro;
overrideProps = isFunction(overrideProps) ? overrideProps(_extends$6({}, defaultProps, usersProps)) : overrideProps; // Merge props
/* eslint-disable react/prop-types */
var props = _extends$6({}, defaultProps, usersProps, overrideProps); // Merge className
if (defaultProps.className || overrideProps.className || usersProps.className) {
var mergedClassesNames = cx(defaultProps.className, overrideProps.className, usersProps.className);
props.className = uniq(mergedClassesNames.split(' ')).join(' ');
} // Merge style
if (defaultProps.style || overrideProps.style || usersProps.style) {
props.style = _extends$6({}, defaultProps.style, usersProps.style, overrideProps.style);
} // ----------------------------------------
// Get key
// ----------------------------------------
// Use key, childKey, or generate key
if (isNil(props.key)) {
var childKey = props.childKey;
var _options3 = options,
_options3$autoGenerat = _options3.autoGenerateKey,
autoGenerateKey = _options3$autoGenerat === void 0 ? true : _options3$autoGenerat;
if (!isNil(childKey)) {
// apply and consume the childKey
props.key = typeof childKey === 'function' ? childKey(props) : childKey;
delete props.childKey;
} else if (autoGenerateKey && (valIsString || valIsNumber)) {
// use string/number shorthand values as the key
props.key = val;
}
} // ----------------------------------------
// Create Element
// ----------------------------------------
// Clone ReactElements
if (valIsReactElement) {
return /*#__PURE__*/React.cloneElement(val, props);
}
if (typeof props.children === 'function') {
return props.children(Component, _extends$6({}, props, {
children: undefined
}));
} // Create ReactElements from built up props
if (valIsPrimitiveValue || valIsPropsObject) {
return /*#__PURE__*/React.createElement(Component, props);
} // Call functions with args similar to createElement()
// TODO: V3 remove the implementation
if (valIsFunction) {
return val(Component, props, props.children);
}
/* eslint-enable react/prop-types */
} // ============================================================
// Factory Creators
// ============================================================
/**
* Creates a `createShorthand` function that is waiting for a value and options.
*
* @param {function|string} Component A ReactClass or string
* @param {function} mapValueToProps A function that maps a primitive value to the Component props
* @returns {function} A shorthand factory function waiting for `val` and `defaultProps`.
*/
function createShorthandFactory(Component, mapValueToProps) {
if (typeof Component !== 'function' && typeof Component !== 'string') {
throw new Error('createShorthandFactory() Component must be a string or function.');
}
return function (val, options) {
return createShorthand(Component, mapValueToProps, val, options);
};
} // ============================================================
// HTML Factories
// ============================================================
var createHTMLDivision = /* #__PURE__ */createShorthandFactory('div', function (val) {
return {
children: val
};
});
var createHTMLIframe = /* #__PURE__ */createShorthandFactory('iframe', function (src) {
return {
src: src
};
});
var createHTMLImage = /* #__PURE__ */createShorthandFactory('img', function (val) {
return {
src: val
};
});
var createHTMLInput = /* #__PURE__ */createShorthandFactory('input', function (val) {
return {
type: val
};
});
var createHTMLLabel = /* #__PURE__ */createShorthandFactory('label', function (val) {
return {
children: val
};
});
var createHTMLParagraph = /* #__PURE__ */createShorthandFactory('p', function (val) {
return {
children: val
};
});/**
* Returns an object consisting of props beyond the scope of the Component.
* Useful for getting and spreading unknown props from the user.
* @param {function} Component A function or ReactClass.
* @param {object} props A ReactElement props object
* @returns {{}} A shallow copy of the prop object
*/
var getUnhandledProps = function getUnhandledProps(Component, props) {
// Note that `handledProps` are generated automatically during build with `babel-plugin-transform-react-handled-props`
var _Component$handledPro = Component.handledProps,
handledProps = _Component$handledPro === void 0 ? [] : _Component$handledPro;
return Object.keys(props).reduce(function (acc, prop) {
if (prop === 'childKey') return acc;
if (handledProps.indexOf(prop) === -1) acc[prop] = props[prop];
return acc;
}, {});
};
var getUnhandledProps$1 = getUnhandledProps;/**
* Returns a createElement() type based on the props of the Component.
* Useful for calculating what type a component should render as.
*
* @param {function} Component A function or ReactClass.
* @param {object} props A ReactElement props object
* @param {function} [getDefault] A function that returns a default element type.
* @returns {string|function} A ReactElement type
*/
function getElementType(Component, props, getDefault) {
var _Component$defaultPro = Component.defaultProps,
defaultProps = _Component$defaultPro === void 0 ? {} : _Component$defaultPro; // ----------------------------------------
// user defined "as" element type
if (props.as && props.as !== defaultProps.as) return props.as; // ----------------------------------------
// computed default element type
if (getDefault) {
var computedDefault = getDefault();
if (computedDefault) return computedDefault;
} // ----------------------------------------
// infer anchor links
if (props.href) return 'a'; // ----------------------------------------
// use defaultProp or 'div'
return defaultProps.as || 'div';
}/**
* The base implementation of `_.values` and `_.valuesIn` which creates an
* array of `object` property values corresponding to the property names
* of `props`.
*
* @private
* @param {Object} object The object to query.
* @param {Array} props The property names to get values for.
* @returns {Object} Returns the array of property values.
*/
function baseValues(object, props) {
return arrayMap(props, function(key) {
return object[key];
});
}/**
* Creates an array of the own enumerable string keyed property values of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property values.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.values(new Foo);
* // => [1, 2] (iteration order is not guaranteed)
*
* _.values('hi');
* // => ['h', 'i']
*/
function values(object) {
return object == null ? [] : baseValues(object, keys(object));
}/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$6 = Math.max;
/**
* Checks if `value` is in `collection`. If `collection` is a string, it's
* checked for a substring of `value`, otherwise
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* is used for equality comparisons. If `fromIndex` is negative, it's used as
* the offset from the end of `collection`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object|string} collection The collection to inspect.
* @param {*} value The value to search for.
* @param {number} [fromIndex=0] The index to search from.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
* @returns {boolean} Returns `true` if `value` is found, else `false`.
* @example
*
* _.includes([1, 2, 3], 1);
* // => true
*
* _.includes([1, 2, 3], 1, 2);
* // => false
*
* _.includes({ 'a': 1, 'b': 2 }, 1);
* // => true
*
* _.includes('abcd', 'bc');
* // => true
*/
function includes(collection, value, fromIndex, guard) {
collection = isArrayLike(collection) ? collection : values(collection);
fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
var length = collection.length;
if (fromIndex < 0) {
fromIndex = nativeMax$6(length + fromIndex, 0);
}
return isString(collection)
? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
: (!!length && baseIndexOf(collection, value, fromIndex) > -1);
}var htmlInputAttrs = [// REACT
'selected', 'defaultValue', 'defaultChecked', // LIMITED HTML PROPS
'accept', 'autoCapitalize', 'autoComplete', 'autoCorrect', 'autoFocus', 'checked', 'disabled', 'form', 'id', 'inputMode', 'lang', 'list', 'max', 'maxLength', 'min', 'minLength', 'multiple', 'name', 'pattern', 'placeholder', 'readOnly', 'required', 'step', 'title', 'type', 'value'];
var htmlInputEvents = [// EVENTS
// keyboard
'onKeyDown', 'onKeyPress', 'onKeyUp', // focus
'onFocus', 'onBlur', // form
'onChange', 'onInput', // mouse
'onClick', 'onContextMenu', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', // selection
'onSelect', // touch
'onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart'];
var htmlInputProps = [].concat(htmlInputAttrs, htmlInputEvents);
var htmlImageProps = ['alt', 'height', 'src', 'srcSet', 'width'];
/**
* Returns an array of objects consisting of: props of html input element and rest.
* @param {object} props A ReactElement props object
* @param {Object} [options={}]
* @param {Array} [options.htmlProps] An array of html input props
* @param {boolean} [options.includeAria] Includes all input props that starts with "aria-"
* @returns {[{}, {}]} An array of objects
*/
var partitionHTMLProps = function partitionHTMLProps(props, options) {
if (options === void 0) {
options = {};
}
var _options = options,
_options$htmlProps = _options.htmlProps,
htmlProps = _options$htmlProps === void 0 ? htmlInputProps : _options$htmlProps,
_options$includeAria = _options.includeAria,
includeAria = _options$includeAria === void 0 ? true : _options$includeAria;
var inputProps = {};
var rest = {};
forEach(props, function (val, prop) {
var possibleAria = includeAria && (/^aria-.*$/.test(prop) || prop === 'role');
var target = includes(htmlProps, prop) || possibleAria ? inputProps : rest;
target[prop] = val;
});
return [inputProps, rest];
};var hasDocument = typeof document === 'object' && document !== null;
var hasWindow = typeof window === 'object' && window !== null && window.self === window; // eslint-disable-next-line no-confusing-arrow
var isBrowser = function isBrowser() {
return !isNil(isBrowser.override) ? isBrowser.override : hasDocument && hasWindow;
};
var isBrowser$1 = isBrowser;/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$5 = Math.max,
nativeMin$5 = Math.min;
/**
* The base implementation of `_.inRange` which doesn't coerce arguments.
*
* @private
* @param {number} number The number to check.
* @param {number} start The start of the range.
* @param {number} end The end of the range.
* @returns {boolean} Returns `true` if `number` is in the range, else `false`.
*/
function baseInRange(number, start, end) {
return number >= nativeMin$5(start, end) && number < nativeMax$5(start, end);
}/**
* Checks if `n` is between `start` and up to, but not including, `end`. If
* `end` is not specified, it's set to `start` with `start` then set to `0`.
* If `start` is greater than `end` the params are swapped to support
* negative ranges.
*
* @static
* @memberOf _
* @since 3.3.0
* @category Number
* @param {number} number The number to check.
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @returns {boolean} Returns `true` if `number` is in the range, else `false`.
* @see _.range, _.rangeRight
* @example
*
* _.inRange(3, 2, 4);
* // => true
*
* _.inRange(4, 8);
* // => true
*
* _.inRange(4, 2);
* // => false
*
* _.inRange(2, 2);
* // => false
*
* _.inRange(1.2, 2);
* // => true
*
* _.inRange(5.2, 4);
* // => false
*
* _.inRange(-3, -2, -6);
* // => true
*/
function inRange(number, start, end) {
start = toFinite(start);
if (end === undefined) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
number = toNumber$1(number);
return baseInRange(number, start, end);
}/**
* Gets the first element of `array`.
*
* @static
* @memberOf _
* @since 0.1.0
* @alias first
* @category Array
* @param {Array} array The array to query.
* @returns {*} Returns the first element of `array`.
* @example
*
* _.head([1, 2, 3]);
* // => 1
*
* _.head([]);
* // => undefined
*/
function head(array) {
return (array && array.length) ? array[0] : undefined;
}/**
* Determines if a click's coordinates are within the bounds of a node.
*
* @see https://github.com/Semantic-Org/Semantic-UI-React/pull/2384
*
* @param {object} node - A DOM node.
* @param {object} e - A SyntheticEvent or DOM Event.
* @returns {boolean}
*/
var doesNodeContainClick = function doesNodeContainClick(node, e) {
if (some([e, node], isNil)) return false; // if there is an e.target and it is in the document, use a simple node.contains() check
if (e.target) {
_invoke(e.target, 'setAttribute', 'data-suir-click-target', true);
if (document.querySelector('[data-suir-click-target=true]')) {
_invoke(e.target, 'removeAttribute', 'data-suir-click-target');
return node.contains(e.target);
}
} // Below logic handles cases where the e.target is no longer in the document.
// The result of the click likely has removed the e.target node.
// Instead of node.contains(), we'll identify the click by X/Y position.
// return early if the event properties aren't available
// prevent measuring the node and repainting if we don't need to
var clientX = e.clientX,
clientY = e.clientY;
if (some([clientX, clientY], isNil)) return false; // false if the node is not visible
var clientRects = node.getClientRects(); // Heads Up!
// getClientRects returns a DOMRectList, not an array nor a plain object
// We explicitly avoid _.isEmpty and check .length to cover all possible shapes
if (!node.offsetWidth || !node.offsetHeight || !clientRects || !clientRects.length) return false; // false if the node doesn't have a valid bounding rect
var _first2 = head(clientRects),
top = _first2.top,
bottom = _first2.bottom,
left = _first2.left,
right = _first2.right;
if (some([top, bottom, left, right], isNil)) return false; // we add a small decimal to the upper bound just to make it inclusive
// don't add an whole pixel (1) as the event/node values may be decimal sensitive
return inRange(clientY, top, bottom + 0.001) && inRange(clientX, left, right + 0.001);
};
var doesNodeContainClick$1 = doesNodeContainClick;/**
* @param {number} pageNumber
* @return {Object}
*/
var createEllipsisItem = function createEllipsisItem(pageNumber) {
return {
active: false,
type: 'ellipsisItem',
value: pageNumber
};
};
/**
* @return {Object}
*/
var createFirstPage = function createFirstPage() {
return {
active: false,
type: 'firstItem',
value: 1
};
};
/**
* @param {number} activePage
* @return {Object}
*/
var createPrevItem = function createPrevItem(activePage) {
return {
active: false,
type: 'prevItem',
value: Math.max(1, activePage - 1)
};
};
/**
* @param {number} activePage
* @return {function}
*/
var createPageFactory = function createPageFactory(activePage) {
return function (pageNumber) {
return {
active: activePage === pageNumber,
type: 'pageItem',
value: pageNumber
};
};
};
/**
* @param {number} activePage
* @param {number} totalPages
* @return {Object}
*/
var createNextItem = function createNextItem(activePage, totalPages) {
return {
active: false,
type: 'nextItem',
value: Math.min(activePage + 1, totalPages)
};
};
/**
* @param {number} totalPages
* @return {Object}
*/
var createLastItem = function createLastItem(totalPages) {
return {
active: false,
type: 'lastItem',
value: totalPages
};
};/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil,
nativeMax$4 = Math.max;
/**
* The base implementation of `_.range` and `_.rangeRight` which doesn't
* coerce arguments.
*
* @private
* @param {number} start The start of the range.
* @param {number} end The end of the range.
* @param {number} step The value to increment or decrement by.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Array} Returns the range of numbers.
*/
function baseRange(start, end, step, fromRight) {
var index = -1,
length = nativeMax$4(nativeCeil((end - start) / (step || 1)), 0),
result = Array(length);
while (length--) {
result[fromRight ? length : ++index] = start;
start += step;
}
return result;
}/**
* Creates a `_.range` or `_.rangeRight` function.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new range function.
*/
function createRange(fromRight) {
return function(start, end, step) {
if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
end = step = undefined;
}
// Ensure the sign of `-0` is preserved.
start = toFinite(start);
if (end === undefined) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
return baseRange(start, end, step, fromRight);
};
}/**
* Creates an array of numbers (positive and/or negative) progressing from
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
* `start` is specified without an `end` or `step`. If `end` is not specified,
* it's set to `start` with `start` then set to `0`.
*
* **Note:** JavaScript follows the IEEE-754 standard for resolving
* floating-point values which can produce unexpected results.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @param {number} [step=1] The value to increment or decrement by.
* @returns {Array} Returns the range of numbers.
* @see _.inRange, _.rangeRight
* @example
*
* _.range(4);
* // => [0, 1, 2, 3]
*
* _.range(-4);
* // => [0, -1, -2, -3]
*
* _.range(1, 5);
* // => [1, 2, 3, 4]
*
* _.range(0, 20, 5);
* // => [0, 5, 10, 15]
*
* _.range(0, -4, -1);
* // => [0, -1, -2, -3]
*
* _.range(1, 4, 0);
* // => [1, 1, 1]
*
* _.range(0);
* // => []
*/
var range = createRange();
var _range = range;var createInnerPrefix = function createInnerPrefix(firstGroupEnd, innerGroupStart, pageFactory) {
var prefixPage = innerGroupStart - 1;
var showEllipsis = prefixPage !== firstGroupEnd + 1;
var prefixFactory = showEllipsis ? createEllipsisItem : pageFactory;
return prefixFactory(prefixPage);
};
var createInnerSuffix = function createInnerSuffix(innerGroupEnd, lastGroupStart, pageFactory) {
var suffixPage = innerGroupEnd + 1;
var showEllipsis = suffixPage !== lastGroupStart - 1;
var suffixFactory = showEllipsis ? createEllipsisItem : pageFactory;
return suffixFactory(suffixPage);
};var createSimpleRange = function createSimpleRange(start, end, pageFactory) {
return map(_range(start, end + 1), pageFactory);
};
var createComplexRange = function createComplexRange(options, pageFactory) {
var activePage = options.activePage,
boundaryRange = options.boundaryRange,
hideEllipsis = options.hideEllipsis,
siblingRange = options.siblingRange,
totalPages = options.totalPages;
var ellipsisSize = hideEllipsis ? 0 : 1;
var firstGroupEnd = boundaryRange;
var firstGroup = createSimpleRange(1, firstGroupEnd, pageFactory);
var lastGroupStart = totalPages + 1 - boundaryRange;
var lastGroup = createSimpleRange(lastGroupStart, totalPages, pageFactory);
var innerGroupStart = Math.min(Math.max(activePage - siblingRange, firstGroupEnd + ellipsisSize + 1), lastGroupStart - ellipsisSize - 2 * siblingRange - 1);
var innerGroupEnd = innerGroupStart + 2 * siblingRange;
var innerGroup = createSimpleRange(innerGroupStart, innerGroupEnd, pageFactory);
return [].concat(firstGroup, [!hideEllipsis && createInnerPrefix(firstGroupEnd, innerGroupStart, pageFactory)], innerGroup, [!hideEllipsis && createInnerSuffix(innerGroupEnd, lastGroupStart, pageFactory)], lastGroup).filter(Boolean);
};/**
* Checks the possibility of using simple range generation, if number of generated pages is equal
* or greater than total pages to show.
*
* @param {object} options
* @param {number} options.boundaryRange Number of always visible pages at the beginning and end.
* @param {number} options.siblingRange Number of always visible pages before and after the current one.
* @param {number} options.totalPages Total number of pages.
* @return {boolean}
*/
var isSimplePagination = function isSimplePagination(_ref) {
var boundaryRange = _ref.boundaryRange,
hideEllipsis = _ref.hideEllipsis,
siblingRange = _ref.siblingRange,
totalPages = _ref.totalPages;
var boundaryRangeSize = 2 * boundaryRange;
var ellipsisSize = hideEllipsis ? 0 : 2;
var siblingRangeSize = 2 * siblingRange;
return 1 + ellipsisSize + siblingRangeSize + boundaryRangeSize >= totalPages;
};
var typifyOptions = function typifyOptions(_ref2) {
var activePage = _ref2.activePage,
boundaryRange = _ref2.boundaryRange,
hideEllipsis = _ref2.hideEllipsis,
siblingRange = _ref2.siblingRange,
totalPages = _ref2.totalPages;
return {
activePage: +activePage,
boundaryRange: +boundaryRange,
hideEllipsis: !!hideEllipsis,
siblingRange: +siblingRange,
totalPages: +totalPages
};
};/**
* @param {object} rawOptions
* @param {number|string} rawOptions.activePage
* @param {number|string} rawOptions.boundaryRange Number of always visible pages at the beginning and end.
* @param {boolean} rawOptions.hideEllipsis Marks if ellipsis should be hidden.
* @param {number|string} rawOptions.siblingRange Number of always visible pages before and after the current one.
* @param {number|string} rawOptions.totalPages Total number of pages.
*/
var createPaginationItems = function createPaginationItems(rawOptions) {
var options = typifyOptions(rawOptions);
var activePage = options.activePage,
totalPages = options.totalPages;
var pageFactory = createPageFactory(activePage);
var innerRange = isSimplePagination(options) ? createSimpleRange(1, totalPages, pageFactory) : createComplexRange(options, pageFactory);
return [createFirstPage(), createPrevItem(activePage)].concat(innerRange, [createNextItem(activePage, totalPages), createLastItem(totalPages)]);
};
var createPaginationItems$1 = createPaginationItems;[].concat(keys(numberToWordMap), keys(numberToWordMap).map(Number), values(numberToWordMap));
var DIRECTIONAL_TRANSITIONS = ['browse', 'browse right', 'drop', 'fade', 'fade up', 'fade down', 'fade left', 'fade right', 'fly up', 'fly down', 'fly left', 'fly right', 'horizontal flip', 'vertical flip', 'scale', 'slide up', 'slide down', 'slide left', 'slide right', 'swing up', 'swing down', 'swing left', 'swing right', 'zoom'];
// https://github.com/Semantic-Org/Semantic-UI/blob/master/dist/components/icon.css
var ACCESSIBILITY = ['american sign language interpreting', 'assistive listening systems', 'audio description', 'blind', 'braille', 'closed captioning', 'closed captioning outline', 'deaf', 'low vision', 'phone volume', 'question circle', 'question circle outline', 'sign language', 'tty', 'universal access', 'wheelchair'];
var ARROWS = ['angle double down', 'angle double left', 'angle double right', 'angle double up', 'angle down', 'angle left', 'angle right', 'angle up', 'arrow alternate circle down', 'arrow alternate circle down outline', 'arrow alternate circle left', 'arrow alternate circle left outline', 'arrow alternate circle right', 'arrow alternate circle right outline', 'arrow alternate circle up', 'arrow alternate circle up outline', 'arrow circle down', 'arrow circle left', 'arrow circle right', 'arrow circle up', 'arrow down', 'arrow left', 'arrow right', 'arrow up', 'arrows alternate', 'arrows alternate horizontal', 'arrows alternate vertical', 'caret down', 'caret left', 'caret right', 'caret square down', 'caret square down outline', 'caret square left', 'caret square left outline', 'caret square right', 'caret square right outline', 'caret square up', 'caret square up outline', 'caret up', 'cart arrow down', 'chart line', 'chevron circle down', 'chevron circle left', 'chevron circle right', 'chevron circle up', 'chevron down', 'chevron left', 'chevron right', 'chevron up', 'cloud download', 'cloud upload', 'download', 'exchange', 'expand arrows alternate', 'external alternate', 'external square alternate', 'hand point down', 'hand point down outline', 'hand point left', 'hand point left outline', 'hand point right', 'hand point right outline', 'hand point up', 'hand point up outline', 'hand pointer', 'hand pointer outline', 'history', 'level down alternate', 'level up alternate', 'location arrow', 'long arrow alternate down', 'long arrow alternate left', 'long arrow alternate right', 'long arrow alternate up', 'mouse pointer', 'play', 'random', 'recycle', 'redo', 'redo alternate', 'reply', 'reply all', 'retweet', 'share', 'share square', 'share square outline', 'sign-in', 'sign-out', 'sign-in alternate', 'sign-out alternate', 'sort', 'sort alphabet down', 'sort alphabet up', 'sort amount down', 'sort amount up', 'sort down', 'sort numeric down', 'sort numeric up', 'sort up', 'sync', 'sync alternate', 'text height', 'text width', 'undo', 'undo alternate', 'upload', 'zoom-in', 'zoom-out'];
var AUDIO_VIDEO = ['audio description', 'backward', 'circle', 'circle outline', 'closed captioning', 'closed captioning outline', 'compress', 'eject', 'expand', 'expand arrows alternate', 'fast backward', 'fast forward', 'file audio', 'file audio outline', 'file video', 'file video outline', 'film', 'forward', 'headphones', 'microphone', 'microphone slash', 'music', 'pause', 'pause circle', 'pause circle outline', 'phone volume', 'play', 'play circle', 'play circle outline', 'podcast', 'random', 'redo', 'redo alternate', 'rss', 'rss square', 'step backward', 'step forward', 'stop', 'stop circle', 'stop circle outline', 'sync', 'sync alternate', 'undo', 'undo alternate', 'video', 'volume down', 'volume off', 'volume up'];
var BUSINESS = ['address book', 'address book outline', 'address card', 'address card outline', 'archive', 'balance scale', 'birthday cake', 'book', 'briefcase', 'building', 'building outline', 'bullhorn', 'bullseye', 'calculator', 'calendar', 'calendar outline', 'calendar alternate', 'calendar alternate outline', 'certificate', 'chart area', 'chart bar', 'chart bar outline', 'chart line', 'chart pie', 'clipboard', 'clipboard outline', 'coffee', 'columns', 'compass', 'compass outline', 'copy', 'copy outline', 'copyright', 'copyright outline', 'cut', 'edit', 'edit outline', 'envelope', 'envelope outline', 'envelope open', 'envelope open outline', 'envelope square', 'eraser', 'fax', 'file', 'file outline', 'file alternate', 'file alternate outline', 'folder', 'folder outline', 'folder open', 'folder open outline', 'globe', 'industry', 'paperclip', 'paste', 'pen square', 'pencil alternate', 'percent', 'phone', 'phone square', 'phone volume', 'registered', 'registered outline', 'save', 'save outline', 'sitemap', 'sticky note', 'sticky note outline', 'suitcase', 'table', 'tag', 'tags', 'tasks', 'thumbtack', 'trademark'];
var CHESS = ['chess', 'chess bishop', 'chess board', 'chess king', 'chess knight', 'chess pawn', 'chess queen', 'chess rook', 'square full'];
var CODE = ['archive', 'barcode', 'bath', 'bug', 'code', 'code branch', 'coffee', 'file', 'file outline', 'file alternate', 'file alternate outline', 'file code', 'file code outline', 'filter', 'fire extinguisher', 'folder', 'folder outline', 'folder open', 'folder open outline', 'keyboard', 'keyboard outline', 'microchip', 'qrcode', 'shield alternate', 'sitemap', 'terminal', 'user secret', 'window close', 'window close outline', 'window maximize', 'window maximize outline', 'window minimize', 'window minimize outline', 'window restore', 'window restore outline'];
var COMMUNICATION = ['address book', 'address book outline', 'address card', 'address card outline', 'american sign language interpreting', 'assistive listening systems', 'at', 'bell', 'bell outline', 'bell slash', 'bell slash outline', 'bullhorn', 'comment', 'comment outline', 'comment alternate', 'comment alternate outline', 'comments', 'comments outline', 'envelope', 'envelope outline', 'envelope open', 'envelope open outline', 'envelope square', 'fax', 'inbox', 'language', 'microphone', 'microphone slash', 'mobile', 'mobile alternate', 'paper plane', 'paper plane outline', 'phone', 'phone square', 'phone volume', 'rss', 'rss square', 'tty', 'wifi'];
var COMPUTERS = ['desktop', 'download', 'hdd', 'hdd outline', 'headphones', 'keyboard', 'keyboard outline', 'laptop', 'microchip', 'mobile', 'mobile alternate', 'plug', 'power off', 'print', 'save', 'save outline', 'server', 'tablet', 'tablet alternate', 'tv', 'upload'];
var CURRENCY = ['dollar sign', 'euro sign', 'lira sign', 'money bill alternate', 'money bill alternate outline', 'pound sign', 'ruble sign', 'rupee sign', 'shekel sign', 'won sign', 'yen sign'];
var DATE_TIME = ['bell', 'bell outline', 'bell slash', 'bell slash outline', 'calendar', 'calendar outline', 'calendar alternate', 'calendar alternate outline', 'calendar check', 'calendar check outline', 'calendar minus', 'calendar minus outline', 'calendar plus', 'calendar plus outline', 'calendar times', 'calendar times outline', 'clock', 'clock outline', 'hourglass', 'hourglass outline', 'hourglass end', 'hourglass half', 'hourglass start', 'stopwatch'];
var DESIGN = ['adjust', 'clone', 'clone outline', 'copy', 'copy outline', 'crop', 'crosshairs', 'cut', 'edit', 'edit outline', 'eraser', 'eye', 'eye dropper', 'eye slash', 'eye slash outline', 'object group', 'object group outline', 'object ungroup', 'object ungroup outline', 'paint brush', 'paste', 'pencil alternate', 'save', 'save outline', 'tint'];
var EDITORS = ['align center', 'align justify', 'align left', 'align right', 'bold', 'clipboard', 'clipboard outline', 'clone', 'clone outline', 'columns', 'copy', 'copy outline', 'cut', 'edit', 'edit outline', 'eraser', 'file', 'file outline', 'file alternate', 'file alternate outline', 'font', 'heading', 'i cursor', 'indent', 'italic', 'linkify', 'list', 'list alternate', 'list alternate outline', 'list ol', 'list ul', 'outdent', 'paper plane', 'paper plane outline', 'paperclip', 'paragraph', 'paste', 'pencil alternate', 'print', 'quote left', 'quote right', 'redo', 'redo alternate', 'reply', 'reply all', 'share', 'strikethrough', 'subscript', 'superscript', 'sync', 'sync alternate', 'table', 'tasks', 'text height', 'text width', 'th', 'th large', 'th list', 'trash', 'trash alternate', 'trash alternate outline', 'underline', 'undo', 'undo alternate', 'unlink'];
var FILES = ['archive', 'clone', 'clone outline', 'copy', 'copy outline', 'cut', 'file', 'file outline', 'file alternate', 'file alternate outline', 'file archive', 'file archive outline', 'file audio', 'file audio outline', 'file code', 'file code outline', 'file excel', 'file excel outline', 'file image', 'file image outline', 'file pdf', 'file pdf outline', 'file powerpoint', 'file powerpoint outline', 'file video', 'file video outline', 'file word', 'file word outline', 'folder', 'folder outline', 'folder open', 'folder open outline', 'paste', 'save', 'save outline', 'sticky note', 'sticky note outline'];
var GENDERS = ['genderless', 'mars', 'mars double', 'mars stroke', 'mars stroke horizontal', 'mars stroke vertical', 'mercury', 'neuter', 'transgender', 'transgender alternate', 'venus', 'venus double', 'venus mars'];
var HANDS_GESTURES = ['hand lizard', 'hand lizard outline', 'hand paper', 'hand paper outline', 'hand peace', 'hand peace outline', 'hand point down', 'hand point down outline', 'hand point left', 'hand point left outline', 'hand point right', 'hand point right outline', 'hand point up', 'hand point up outline', 'hand pointer', 'hand pointer outline', 'hand rock', 'hand rock outline', 'hand scissors', 'hand scissors outline', 'hand spock', 'hand spock outline', 'handshake', 'handshake outline', 'thumbs down', 'thumbs down outline', 'thumbs up', 'thumbs up outline'];
var HEALTH = ['ambulance', 'h square', 'heart', 'heart outline', 'heartbeat', 'hospital', 'hospital outline', 'medkit', 'plus square', 'plus square outline', 'stethoscope', 'user md', 'wheelchair'];
var IMAGES = ['adjust', 'bolt', 'camera', 'camera retro', 'clone', 'clone outline', 'compress', 'expand', 'eye', 'eye dropper', 'eye slash', 'eye slash outline', 'file image', 'file image outline', 'film', 'id badge', 'id badge outline', 'id card', 'id card outline', 'image', 'image outline', 'images', 'images outline', 'sliders horizontal', 'tint'];
var INTERFACES = ['ban', 'barcode', 'bars', 'beer', 'bell', 'bell outline', 'bell slash', 'bell slash outline', 'bug', 'bullhorn', 'bullseye', 'calculator', 'calendar', 'calendar outline', 'calendar alternate', 'calendar alternate outline', 'calendar check', 'calendar check outline', 'calendar minus', 'calendar minus outline', 'calendar plus', 'calendar plus outline', 'calendar times', 'calendar times outline', 'certificate', 'check', 'check circle', 'check circle outline', 'check square', 'check square outline', 'circle', 'circle outline', 'clipboard', 'clipboard outline', 'clone', 'clone outline', 'cloud', 'cloud download', 'cloud upload', 'coffee', 'cog', 'cogs', 'copy', 'copy outline', 'cut', 'database', 'dot circle', 'dot circle outline', 'download', 'edit', 'edit outline', 'ellipsis horizontal', 'ellipsis vertical', 'envelope', 'envelope outline', 'envelope open', 'envelope open outline', 'eraser', 'exclamation', 'exclamation circle', 'exclamation triangle', 'external alternate', 'external square alternate', 'eye', 'eye slash', 'eye slash outline', 'file', 'file outline', 'file alternate', 'file alternate outline', 'filter', 'flag', 'flag outline', 'flag checkered', 'folder', 'folder outline', 'folder open', 'folder open outline', 'frown', 'frown outline', 'hashtag', 'heart', 'heart outline', 'history', 'home', 'i cursor', 'info', 'info circle', 'language', 'magic', 'meh', 'meh outline', 'microphone', 'microphone slash', 'minus', 'minus circle', 'minus square', 'minus square outline', 'paste', 'pencil alternate', 'plus', 'plus circle', 'plus square', 'plus square outline', 'qrcode', 'question', 'question circle', 'question circle outline', 'quote left', 'quote right', 'redo', 'redo alternate', 'reply', 'reply all', 'rss', 'rss square', 'save', 'save outline', 'search', 'search minus', 'search plus', 'share', 'share alternate', 'share alternate square', 'share square', 'share square outline', 'shield alternate', 'sign-in', 'sign-out', 'signal', 'sitemap', 'sliders horizontal', 'smile', 'smile outline', 'sort', 'sort alphabet down', 'sort alphabet up', 'sort amount down', 'sort amount up', 'sort down', 'sort numeric down', 'sort numeric up', 'sort up', 'star', 'star outline', 'star half', 'star half outline', 'sync', 'sync alternate', 'thumbs down', 'thumbs down outline', 'thumbs up', 'thumbs up outline', 'times', 'times circle', 'times circle outline', 'toggle off', 'toggle on', 'trash', 'trash alternate', 'trash alternate outline', 'trophy', 'undo', 'undo alternate', 'upload', 'user', 'user outline', 'user circle', 'user circle outline', 'wifi'];
var LOGISTICS = ['box', 'boxes', 'clipboard check', 'clipboard list', 'dolly', 'dolly flatbed', 'pallet', 'shipping fast', 'truck', 'warehouse'];
var MAPS = ['ambulance', 'anchor', 'balance scale', 'bath', 'bed', 'beer', 'bell', 'bell outline', 'bell slash', 'bell slash outline', 'bicycle', 'binoculars', 'birthday cake', 'blind', 'bomb', 'book', 'bookmark', 'bookmark outline', 'briefcase', 'building', 'building outline', 'car', 'coffee', 'crosshairs', 'dollar sign', 'eye', 'eye slash', 'eye slash outline', 'fighter jet', 'fire', 'fire extinguisher', 'flag', 'flag outline', 'flag checkered', 'flask', 'gamepad', 'gavel', 'gift', 'glass martini', 'globe', 'graduation cap', 'h square', 'heart', 'heart outline', 'heartbeat', 'home', 'hospital', 'hospital outline', 'image', 'image outline', 'images', 'images outline', 'industry', 'info', 'info circle', 'key', 'leaf', 'lemon', 'lemon outline', 'life ring', 'life ring outline', 'lightbulb', 'lightbulb outline', 'location arrow', 'low vision', 'magnet', 'male', 'map', 'map outline', 'map marker', 'map marker alternate', 'map pin', 'map signs', 'medkit', 'money bill alternate', 'money bill alternate outline', 'motorcycle', 'music', 'newspaper', 'newspaper outline', 'paw', 'phone', 'phone square', 'phone volume', 'plane', 'plug', 'plus', 'plus square', 'plus square outline', 'print', 'recycle', 'road', 'rocket', 'search', 'search minus', 'search plus', 'ship', 'shopping bag', 'shopping basket', 'shopping cart', 'shower', 'street view', 'subway', 'suitcase', 'tag', 'tags', 'taxi', 'thumbtack', 'ticket alternate', 'tint', 'train', 'tree', 'trophy', 'truck', 'tty', 'umbrella', 'university', 'utensil spoon', 'utensils', 'wheelchair', 'wifi', 'wrench'];
var MEDICAL = ['ambulance', 'band aid', 'dna', 'first aid', 'heart', 'heart outline', 'heartbeat', 'hospital', 'hospital outline', 'hospital symbol', 'pills', 'plus', 'stethoscope', 'syringe', 'thermometer', 'user md', 'weight'];
var OBJECTS = ['ambulance', 'anchor', 'archive', 'balance scale', 'bath', 'bed', 'beer', 'bell', 'bell outline', 'bicycle', 'binoculars', 'birthday cake', 'bomb', 'book', 'bookmark', 'bookmark outline', 'briefcase', 'bug', 'building', 'building outline', 'bullhorn', 'bullseye', 'bus', 'calculator', 'calendar', 'calendar outline', 'calendar alternate', 'calendar alternate outline', 'camera', 'camera retro', 'car', 'clipboard', 'clipboard outline', 'cloud', 'coffee', 'cog', 'cogs', 'compass', 'compass outline', 'copy', 'copy outline', 'cube', 'cubes', 'cut', 'envelope', 'envelope outline', 'envelope open', 'envelope open outline', 'eraser', 'eye', 'eye dropper', 'fax', 'fighter jet', 'file', 'file outline', 'file alternate', 'file alternate outline', 'film', 'fire', 'fire extinguisher', 'flag', 'flag outline', 'flag checkered', 'flask', 'futbol', 'futbol outline', 'gamepad', 'gavel', 'gem', 'gem outline', 'gift', 'glass martini', 'globe', 'graduation cap', 'hdd', 'hdd outline', 'headphones', 'heart', 'heart outline', 'home', 'hospital', 'hospital outline', 'hourglass', 'hourglass outline', 'image', 'image outline', 'images', 'images outline', 'industry', 'key', 'keyboard', 'keyboard outline', 'laptop', 'leaf', 'lemon', 'lemon outline', 'life ring', 'life ring outline', 'lightbulb', 'lightbulb outline', 'lock', 'lock open', 'magic', 'magnet', 'map', 'map outline', 'map marker', 'map marker alternate', 'map pin', 'map signs', 'medkit', 'microchip', 'microphone', 'mobile', 'mobile alternate', 'money bill alternate', 'money bill alternate outline', 'moon', 'moon outline', 'motorcycle', 'newspaper', 'newspaper outline', 'paint brush', 'paper plane', 'paper plane outline', 'paperclip', 'paste', 'paw', 'pencil alternate', 'phone', 'plane', 'plug', 'print', 'puzzle piece', 'road', 'rocket', 'save', 'save outline', 'search', 'shield alternate', 'shopping bag', 'shopping basket', 'shopping cart', 'shower', 'snowflake', 'snowflake outline', 'space shuttle', 'star', 'star outline', 'sticky note', 'sticky note outline', 'stopwatch', 'subway', 'suitcase', 'sun', 'sun outline', 'tablet', 'tablet alternate', 'tachometer alternate', 'tag', 'tags', 'taxi', 'thumbtack', 'ticket alternate', 'train', 'trash', 'trash alternate', 'trash alternate outline', 'tree', 'trophy', 'truck', 'tv', 'umbrella', 'university', 'unlock', 'unlock alternate', 'utensil spoon', 'utensils', 'wheelchair', 'wrench'];
var PAYMENTS_SHOPPING = ['bell', 'bell outline', 'bookmark', 'bookmark outline', 'bullhorn', 'camera', 'camera retro', 'cart arrow down', 'cart plus', 'certificate', 'credit card', 'credit card outline', 'gem', 'gem outline', 'gift', 'handshake', 'handshake outline', 'heart', 'heart outline', 'key', 'shopping bag', 'shopping basket', 'shopping cart', 'star', 'star outline', 'tag', 'tags', 'thumbs down', 'thumbs down outline', 'thumbs up', 'thumbs up outline', 'trophy'];
var SHAPES = ['bookmark', 'bookmark outline', 'calendar', 'calendar outline', 'certificate', 'circle', 'circle outline', 'cloud', 'comment', 'comment outline', 'file', 'file outline', 'folder', 'folder outline', 'heart', 'heart outline', 'map marker', 'play', 'square', 'square outline', 'star', 'star outline'];
var SPINNERS = ['asterisk', 'certificate', 'circle notch', 'cog', 'compass', 'compass outline', 'crosshairs', 'life ring', 'life ring outline', 'snowflake', 'snowflake outline', 'spinner', 'sun', 'sun outline', 'sync'];
var SPORTS = ['baseball ball', 'basketball ball', 'bowling ball', 'football ball', 'futbol', 'futbol outline', 'golf ball', 'hockey puck', 'quidditch', 'table tennis', 'volleyball ball'];
var STATUS = ['ban', 'battery empty', 'battery full', 'battery half', 'battery quarter', 'battery three quarters', 'bell', 'bell outline', 'bell slash', 'bell slash outline', 'calendar', 'calendar outline', 'calendar alternate', 'calendar alternate outline', 'calendar check', 'calendar check outline', 'calendar minus', 'calendar minus outline', 'calendar plus', 'calendar plus outline', 'calendar times', 'calendar times outline', 'cart arrow down', 'cart plus', 'exclamation', 'exclamation circle', 'exclamation triangle', 'eye', 'eye slash', 'eye slash outline', 'file', 'file outline', 'file alternate', 'file alternate outline', 'folder', 'folder outline', 'folder open', 'folder open outline', 'info', 'info circle', 'lock', 'lock open', 'minus', 'minus circle', 'minus square', 'minus square outline', 'plus', 'plus circle', 'plus square', 'plus square outline', 'question', 'question circle', 'question circle outline', 'shield alternate', 'shopping cart', 'sign in alternate', 'sign out alternate', 'thermometer empty', 'thermometer full', 'thermometer half', 'thermometer quarter', 'thermometer three quarters', 'thumbs down', 'thumbs down outline', 'thumbs up', 'thumbs up outline', 'toggle off', 'toggle on', 'unlock', 'unlock alternate'];
var USERS_PEOPLE = ['address book', 'address book outline', 'address card', 'address card outline', 'bed', 'blind', 'child', 'female', 'frown', 'frown outline', 'id badge', 'id badge outline', 'id card', 'id card outline', 'male', 'meh', 'meh outline', 'power off', 'smile', 'smile outline', 'street view', 'user', 'user outline', 'user circle', 'user circle outline', 'user md', 'user plus', 'user secret', 'user times', 'users', 'wheelchair'];
var VEHICLES = ['ambulance', 'bicycle', 'bus', 'car', 'fighter jet', 'motorcycle', 'paper plane', 'paper plane outline', 'plane', 'rocket', 'ship', 'shopping cart', 'space shuttle', 'subway', 'taxi', 'train', 'truck', 'wheelchair'];
var WRITING = ['archive', 'book', 'bookmark', 'bookmark outline', 'edit', 'edit outline', 'envelope', 'envelope outline', 'envelope open', 'envelope open outline', 'eraser', 'file', 'file outline', 'file alternate', 'file alternate outline', 'folder', 'folder outline', 'folder open', 'folder open outline', 'keyboard', 'keyboard outline', 'newspaper', 'newspaper outline', 'paper plane', 'paper plane outline', 'paperclip', 'paragraph', 'pen square', 'pencil alternate', 'quote left', 'quote right', 'sticky note', 'sticky note outline', 'thumbtack'];
var BRANDS = ['500px', 'accessible', 'accusoft', 'adn', 'adversal', 'affiliatetheme', 'algolia', 'amazon', 'amazon pay', 'amilia', 'android', 'angellist', 'angrycreative', 'angular', 'app store', 'app store ios', 'apper', 'apple', 'apple pay', 'asymmetrik', 'audible', 'autoprefixer', 'avianex', 'aviato', 'aws', 'bandcamp', 'behance', 'behance square', 'bimobject', 'bitbucket', 'bitcoin', 'bity', 'black tie', 'blackberry', 'blogger', 'blogger b', 'bluetooth', 'bluetooth b', 'btc', 'buromobelexperte', 'buysellads', 'cc amazon pay', 'cc amex', 'cc apple pay', 'cc diners club', 'cc discover', 'cc jcb', 'cc mastercard', 'cc paypal', 'cc stripe', 'cc visa', 'centercode', 'chrome', 'cloudscale', 'cloudsmith', 'cloudversify', 'codepen', 'codiepie', 'connectdevelop', 'contao', 'cpanel', 'creative commons', 'css3', 'css3 alternate', 'cuttlefish', 'd and d', 'dashcube', 'delicious', 'deploydog', 'deskpro', 'deviantart', 'digg', 'digital ocean', 'discord', 'discourse', 'dochub', 'docker', 'draft2digital', 'dribbble', 'dribbble square', 'dropbox', 'drupal', 'dyalog', 'earlybirds', 'edge', 'elementor', 'ember', 'empire', 'envira', 'erlang', 'ethereum', 'etsy', 'expeditedssl', 'facebook', 'facebook f', 'facebook messenger', 'facebook square', 'firefox', 'first order', 'firstdraft', 'flickr', 'flipboard', 'fly', 'font awesome', 'font awesome alternate', 'font awesome flag', 'fonticons', 'fonticons fi', 'fort awesome', 'fort awesome alternate', 'forumbee', 'foursquare', 'free code camp', 'freebsd', 'get pocket', 'gg', 'gg circle', 'git', 'git square', 'github', 'github alternate', 'github square', 'gitkraken', 'gitlab', 'gitter', 'glide', 'glide g', 'gofore', 'goodreads', 'goodreads g', 'google', 'google drive', 'google play', 'google plus', 'google plus g', 'google plus square', 'google wallet', 'gratipay', 'grav', 'gripfire', 'grunt', 'gulp', 'hacker news', 'hacker news square', 'hips', 'hire a helper', 'hooli', 'hotjar', 'houzz', 'html5', 'hubspot', 'imdb', 'instagram', 'internet explorer', 'ioxhost', 'itunes', 'itunes note', 'jenkins', 'joget', 'joomla', 'js', 'js square', 'jsfiddle', 'keycdn', 'kickstarter', 'kickstarter k', 'korvue', 'laravel', 'lastfm', 'lastfm square', 'leanpub', 'less', 'linechat', 'linkedin', 'linkedin alternate', 'linode', 'linux', 'lyft', 'magento', 'maxcdn', 'medapps', 'medium', 'medium m', 'medrt', 'meetup', 'microsoft', 'mix', 'mixcloud', 'mizuni', 'modx', 'monero', 'napster', 'nintendo switch', 'node', 'node js', 'npm', 'ns8', 'nutritionix', 'odnoklassniki', 'odnoklassniki square', 'opencart', 'openid', 'opera', 'optin monster', 'osi', 'page4', 'pagelines', 'palfed', 'patreon', 'paypal', 'periscope', 'phabricator', 'phoenix framework', 'php', 'pied piper', 'pied piper alternate', 'pied piper pp', 'pinterest', 'pinterest p', 'pinterest square', 'playstation', 'product hunt', 'pushed', 'python', 'qq', 'quinscape', 'quora', 'ravelry', 'react', 'rebel', 'redriver', 'reddit', 'reddit alien', 'reddit square', 'rendact', 'renren', 'replyd', 'resolving', 'rocketchat', 'rockrms', 'safari', 'sass', 'schlix', 'scribd', 'searchengin', 'sellcast', 'sellsy', 'servicestack', 'shirtsinbulk', 'simplybuilt', 'sistrix', 'skyatlas', 'skype', 'slack', 'slack hash', 'slideshare', 'snapchat', 'snapchat ghost', 'snapchat square', 'soundcloud', 'speakap', 'spotify', 'stack exchange', 'stack overflow', 'staylinked', 'steam', 'steam square', 'steam symbol', 'sticker mule', 'strava', 'stripe', 'stripe s', 'studiovinari', 'stumbleupon', 'stumbleupon circle', 'superpowers', 'supple', 'telegram', 'telegram plane', 'tencent weibo', 'themeisle', 'trello', 'tripadvisor', 'tumblr', 'tumblr square', 'twitch', 'twitter', 'twitter square', 'typo3', 'uber', 'uikit', 'uniregistry', 'untappd', 'usb', 'ussunnah', 'vaadin', 'viacoin', 'viadeo', 'viadeo square', 'viber', 'vimeo', 'vimeo square', 'vimeo v', 'vine', 'vk', 'vnv', 'vuejs', 'wechat', 'weibo', 'weixin', 'whatsapp', 'whatsapp square', 'whmcs', 'wikipedia w', 'windows', 'wordpress', 'wordpress simple', 'wpbeginner', 'wpexplorer', 'wpforms', 'xbox', 'xing', 'xing square', 'y combinator', 'yahoo', 'yandex', 'yandex international', 'yelp', 'yoast', 'youtube', 'youtube square'];
var ICONS = uniq([].concat(ACCESSIBILITY, ARROWS, AUDIO_VIDEO, BUSINESS, CHESS, CODE, COMMUNICATION, COMPUTERS, CURRENCY, DATE_TIME, DESIGN, EDITORS, FILES, GENDERS, HANDS_GESTURES, HEALTH, IMAGES, INTERFACES, LOGISTICS, MAPS, MEDICAL, OBJECTS, PAYMENTS_SHOPPING, SHAPES, SPINNERS, SPORTS, STATUS, USERS_PEOPLE, VEHICLES, WRITING, BRANDS));
var ICON_ALIASES = ['chess rock', 'ordered list', 'unordered list', 'user doctor', 'shield', 'puzzle', 'add circle', 'add square', 'add to calendar', 'add to cart', 'add user', 'add', 'alarm mute', 'alarm', 'ald', 'als', 'announcement', 'area chart', 'area graph', 'arrow down cart', 'asexual', 'asl interpreting', 'asl', 'assistive listening devices', 'attach', 'attention', 'balance', 'bar', 'bathtub', 'battery four', 'battery high', 'battery low', 'battery one', 'battery three', 'battery two', 'battery zero', 'birthday', 'block layout', 'bluetooth alternative', 'broken chain', 'browser', 'call square', 'call', 'cancel', 'cart', 'cc', 'chain', 'chat', 'checked calendar', 'checkmark', 'circle notched', 'close', 'cny', 'cocktail', 'commenting', 'computer', 'configure', 'content', 'deafness', 'delete calendar', 'delete', 'detective', 'discussions', 'doctor', 'dollar', 'dont', 'drivers license', 'dropdown', 'emergency', 'envira gallery', 'erase', 'eur', 'euro', 'eyedropper', 'factory', 'favorite', 'feed', 'female homosexual', 'file text', 'file text outline', 'find', 'first aid', 'fork', 'game', 'gay', 'gbp', 'google plus circle', 'google plus official', 'grab', 'graduation', 'grid layout', 'group', 'h', 'hand victory', 'handicap', 'hard of hearing', 'header', 'help circle', 'help', 'heterosexual', 'hide', 'hotel', 'hourglass four', 'hourglass full', 'hourglass one', 'hourglass three', 'hourglass two', 'idea', 'ils', 'in cart', 'inr', 'intergender', 'intersex', 'jpy', 'krw', 'lab', 'law', 'legal', 'lesbian', 'lightning', 'like', 'line graph', 'linkedin square', 'linkify', 'lira', 'list layout', 'magnify', 'mail forward', 'mail outline', 'mail square', 'mail', 'male homosexual', 'man', 'marker', 'mars alternate', 'mars horizontal', 'mars vertical', 'microsoft edge', 'military', 'ms edge', 'mute', 'new pied piper', 'non binary transgender', 'numbered list', 'options', 'other gender horizontal', 'other gender vertical', 'other gender', 'payment', 'paypal card', 'pencil square', 'photo', 'picture', 'pie chart', 'pie graph', 'pied piper hat', 'pin', 'plus cart', 'point', 'pointing down', 'pointing left', 'pointing right', 'pointing up', 'pound', 'power cord', 'power', 'privacy', 'r circle', 'rain', 'record', 'refresh', 'remove circle', 'remove from calendar', 'remove user', 'remove', 'repeat', 'rmb', 'rouble', 'rub', 'ruble', 'rupee', 's15', 'selected radio', 'send', 'setting', 'settings', 'shekel', 'sheqel', 'shipping', 'shop', 'shuffle', 'shutdown', 'sidebar', 'signing', 'signup', 'sliders', 'soccer', 'sort alphabet ascending', 'sort alphabet descending', 'sort ascending', 'sort content ascending', 'sort content descending', 'sort descending', 'sort numeric ascending', 'sort numeric descending', 'sound', 'spy', 'stripe card', 'student', 'talk', 'target', 'teletype', 'television', 'text cursor', 'text telephone', 'theme', 'thermometer', 'thumb tack', 'time', 'tm', 'toggle down', 'toggle left', 'toggle right', 'toggle up', 'translate', 'travel', 'treatment', 'triangle down', 'triangle left', 'triangle right', 'triangle up', 'try', 'unhide', 'unlinkify', 'unmute', 'usd', 'user cancel', 'user close', 'user delete', 'user x', 'vcard', 'video camera', 'video play', 'volume control phone', 'wait', 'warning circle', 'warning sign', 'warning', 'wi-fi', 'winner', 'wizard', 'woman', 'won', 'wordpress beginner', 'wordpress forms', 'world', 'write square', 'x', 'yen', 'zip', 'zoom in', 'zoom out', 'zoom', 'bitbucket square', 'checkmark box', 'circle thin', 'cloud download', 'cloud upload', 'compose', 'conversation', 'credit card alternative', 'currency', 'dashboard', 'diamond', 'disk', 'exchange', 'external share', 'external square', 'external', 'facebook official', 'food', 'hourglass zero', 'level down', 'level up', 'log out', 'meanpath', 'money', 'move', 'pencil', 'protect', 'radio', 'remove bookmark', 'resize horizontal', 'resize vertical', 'sign in', 'sign out', 'spoon', 'star half empty', 'star half full', 'ticket', 'times rectangle', 'write', 'youtube play'];
var ICONS_AND_ALIASES = uniq([].concat(ICONS, ICON_ALIASES)); // Some icon names are not part of icons.css.
// These are only valid as children of other components.
// Their CSS rules are defined by a specific component's CSS.
// We don't want to show name warnings for those usages so we add them as valid names here.
var COMPONENT_CONTEXT_SPECIFIC_ICONS = ['left dropdown' // nested dropdown menu direction icon
];
uniq([].concat(ICONS_AND_ALIASES, COMPONENT_CONTEXT_SPECIFIC_ICONS));/**
* Normalizes the offset value.
* @param {number|array} value The value to normalize.
* @returns {number}
*/
var normalizeOffset = (function (value) {
return typeof value === 'number' || typeof value === 'string' ? [value, value] : value;
});/**
* Normalizes the duration of a transition.
* @param {number|object} duration The value to normalize.
* @param {'hide'|'show'} type The type of transition.
* @returns {number}
*/
var normalizeTransitionDuration = (function (duration, type) {
return typeof duration === 'number' || typeof duration === 'string' ? duration : duration[type];
});/**
* Performs a deep comparison between two values to determine if they are
* equivalent.
*
* **Note:** This method supports comparing arrays, array buffers, booleans,
* date objects, error objects, maps, numbers, `Object` objects, regexes,
* sets, strings, symbols, and typed arrays. `Object` objects are compared
* by their own, not inherited, enumerable properties. Functions and DOM
* nodes are compared by strict equality, i.e. `===`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.isEqual(object, other);
* // => true
*
* object === other;
* // => false
*/
function isEqual(value, other) {
return baseIsEqual(value, other);
}/** Built-in value references. */
var objectCreate = Object.create;
/**
* The base implementation of `_.create` without support for assigning
* properties to the created object.
*
* @private
* @param {Object} proto The object to inherit from.
* @returns {Object} Returns the new object.
*/
var baseCreate = (function() {
function object() {}
return function(proto) {
if (!isObject$2(proto)) {
return {};
}
if (objectCreate) {
return objectCreate(proto);
}
object.prototype = proto;
var result = new object;
object.prototype = undefined;
return result;
};
}());
var baseCreate$1 = baseCreate;// https://medium.com/@alexandereardon/uselayouteffect-and-ssr-192986cdcf7a
var useIsomorphicLayoutEffect$1 = isBrowser$1() && "production" !== 'test' ? React__default.useLayoutEffect : React__default.useEffect;
var useIsomorphicLayoutEffect$2 = useIsomorphicLayoutEffect$1;var CLASS_NAME_DELITIMITER = /\s+/;
/**
* Accepts a set of ref objects that contain classnames as a string and returns an array of unique
* classNames.
*
* @param {Set<React.RefObject>|undefined} classNameRefs
* @returns String[]
*/
function computeClassNames(classNameRefs) {
var classNames = [];
if (classNameRefs) {
classNameRefs.forEach(function (classNameRef) {
if (typeof classNameRef.current === 'string') {
var classNamesForRef = classNameRef.current.split(CLASS_NAME_DELITIMITER);
classNamesForRef.forEach(function (className) {
classNames.push(className);
});
}
});
return classNames.filter(function (className, i, array) {
return className.length > 0 && array.indexOf(className) === i;
});
}
return [];
}
/**
* Computes classnames that should be removed and added to a node based on input differences.
*
* @param {String[]} prevClassNames
* @param {String[]} currentClassNames
*/
function computeClassNamesDifference(prevClassNames, currentClassNames) {
return [currentClassNames.filter(function (className) {
return prevClassNames.indexOf(className) === -1;
}), prevClassNames.filter(function (className) {
return currentClassNames.indexOf(className) === -1;
})];
}
var prevClassNames = new Map();
/**
* @param {HTMLElement} node
* @param {Set<React.RefObject>|undefined} classNameRefs
*/
var handleClassNamesChange = function handleClassNamesChange(node, classNameRefs) {
var currentClassNames = computeClassNames(classNameRefs);
var _computeClassNamesDif = computeClassNamesDifference(prevClassNames.get(node) || [], currentClassNames),
forAdd = _computeClassNamesDif[0],
forRemoval = _computeClassNamesDif[1];
if (node) {
forAdd.forEach(function (className) {
return node.classList.add(className);
});
forRemoval.forEach(function (className) {
return node.classList.remove(className);
});
}
prevClassNames.set(node, currentClassNames);
};
var NodeRegistry = function NodeRegistry() {
var _this = this;
this.add = function (node, classNameRef) {
if (_this.nodes.has(node)) {
var _set = _this.nodes.get(node);
_set.add(classNameRef);
return;
} // IE11 does not support constructor params
var set = new Set();
set.add(classNameRef);
_this.nodes.set(node, set);
};
this.del = function (node, classNameRef) {
if (!_this.nodes.has(node)) {
return;
}
var set = _this.nodes.get(node);
if (set.size === 1) {
_this.nodes.delete(node);
return;
}
set.delete(classNameRef);
};
this.emit = function (node, callback) {
callback(node, _this.nodes.get(node));
};
this.nodes = new Map();
};
var nodeRegistry = new NodeRegistry();
/**
* A React hooks that allows to manage classNames on a DOM node in declarative manner. Accepts
* a HTML element or React ref objects with it.
*
* @param {HTMLElement|React.RefObject} node
* @param {String} className
*/
function useClassNamesOnNode(node, className) {
var classNameRef = React__default.useRef();
var isMounted = React__default.useRef(false);
useIsomorphicLayoutEffect$2(function () {
classNameRef.current = className;
if (isMounted.current) {
var element = isRefObject(node) ? node.current : node;
nodeRegistry.emit(element, handleClassNamesChange);
}
isMounted.current = true;
}, [className]);
useIsomorphicLayoutEffect$2(function () {
var element = isRefObject(node) ? node.current : node;
nodeRegistry.add(element, classNameRef);
nodeRegistry.emit(element, handleClassNamesChange);
return function () {
nodeRegistry.del(element, classNameRef);
nodeRegistry.emit(element, handleClassNamesChange);
};
}, [node]);
}/**
* Creates an array excluding all given values using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* **Note:** Unlike `_.pull`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...*} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
* @see _.difference, _.xor
* @example
*
* _.without([2, 1, 2, 3], 1, 2);
* // => [3]
*/
var without = baseRest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(array, values)
: [];
});
var _without = without;/**
* Several icons can be used together as a group.
*/
function IconGroup(props) {
var children = props.children,
className = props.className,
content = props.content,
size = props.size;
var classes = cx(size, 'icons', className);
var rest = getUnhandledProps$1(IconGroup, props);
var ElementType = getElementType(IconGroup, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
IconGroup.handledProps = ["as", "children", "className", "content", "size"];
IconGroup.propTypes = {};
IconGroup.defaultProps = {
as: 'i'
};/**
* An icon is a glyph used to represent something else.
* @see Image
*/
var Icon = /*#__PURE__*/function (_PureComponent) {
_inheritsLoose(Icon, _PureComponent);
function Icon() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _PureComponent.call.apply(_PureComponent, [this].concat(args)) || this;
_this.handleClick = function (e) {
var disabled = _this.props.disabled;
if (disabled) {
e.preventDefault();
return;
}
_invoke(_this.props, 'onClick', e, _this.props);
};
return _this;
}
var _proto = Icon.prototype;
_proto.getIconAriaOptions = function getIconAriaOptions() {
var ariaOptions = {};
var _this$props = this.props,
ariaLabel = _this$props['aria-label'],
ariaHidden = _this$props['aria-hidden'];
if (isNil(ariaLabel)) {
ariaOptions['aria-hidden'] = 'true';
} else {
ariaOptions['aria-label'] = ariaLabel;
}
if (!isNil(ariaHidden)) {
ariaOptions['aria-hidden'] = ariaHidden;
}
return ariaOptions;
};
_proto.render = function render() {
var _this$props2 = this.props,
bordered = _this$props2.bordered,
circular = _this$props2.circular,
className = _this$props2.className,
color = _this$props2.color,
corner = _this$props2.corner,
disabled = _this$props2.disabled,
fitted = _this$props2.fitted,
flipped = _this$props2.flipped,
inverted = _this$props2.inverted,
link = _this$props2.link,
loading = _this$props2.loading,
name = _this$props2.name,
rotated = _this$props2.rotated,
size = _this$props2.size;
var classes = cx(color, name, size, useKeyOnly(bordered, 'bordered'), useKeyOnly(circular, 'circular'), useKeyOnly(disabled, 'disabled'), useKeyOnly(fitted, 'fitted'), useKeyOnly(inverted, 'inverted'), useKeyOnly(link, 'link'), useKeyOnly(loading, 'loading'), useKeyOrValueAndKey(corner, 'corner'), useValueAndKey(flipped, 'flipped'), useValueAndKey(rotated, 'rotated'), 'icon', className);
var rest = getUnhandledProps$1(Icon, this.props);
var ElementType = getElementType(Icon, this.props);
var ariaOptions = this.getIconAriaOptions();
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, ariaOptions, {
className: classes,
onClick: this.handleClick
}));
};
return Icon;
}(PureComponent);
Icon.handledProps = ["aria-hidden", "aria-label", "as", "bordered", "circular", "className", "color", "corner", "disabled", "fitted", "flipped", "inverted", "link", "loading", "name", "rotated", "size"];
Icon.propTypes = {};
Icon.defaultProps = {
as: 'i'
};
Icon.Group = IconGroup;
Icon.create = createShorthandFactory(Icon, function (value) {
return {
name: value
};
});
var Icon$1 = Icon;var isObject$1 = function isObject(val) {
return val !== null && !Array.isArray(val) && typeof val === 'object'
};
var codes = {
// ----------------------------------------
// By Code
// ----------------------------------------
3: 'Cancel',
6: 'Help',
8: 'Backspace',
9: 'Tab',
12: 'Clear',
13: 'Enter',
16: 'Shift',
17: 'Control',
18: 'Alt',
19: 'Pause',
20: 'CapsLock',
27: 'Escape',
28: 'Convert',
29: 'NonConvert',
30: 'Accept',
31: 'ModeChange',
32: ' ',
33: 'PageUp',
34: 'PageDown',
35: 'End',
36: 'Home',
37: 'ArrowLeft',
38: 'ArrowUp',
39: 'ArrowRight',
40: 'ArrowDown',
41: 'Select',
42: 'Print',
43: 'Execute',
44: 'PrintScreen',
45: 'Insert',
46: 'Delete',
48: ['0', ')'],
49: ['1', '!'],
50: ['2', '@'],
51: ['3', '#'],
52: ['4', '$'],
53: ['5', '%'],
54: ['6', '^'],
55: ['7', '&'],
56: ['8', '*'],
57: ['9', '('],
91: 'OS',
93: 'ContextMenu',
144: 'NumLock',
145: 'ScrollLock',
181: 'VolumeMute',
182: 'VolumeDown',
183: 'VolumeUp',
186: [';', ':'],
187: ['=', '+'],
188: [',', '<'],
189: ['-', '_'],
190: ['.', '>'],
191: ['/', '?'],
192: ['`', '~'],
219: ['[', '{'],
220: ['\\', '|'],
221: [']', '}'],
222: ["'", '"'],
224: 'Meta',
225: 'AltGraph',
246: 'Attn',
247: 'CrSel',
248: 'ExSel',
249: 'EraseEof',
250: 'Play',
251: 'ZoomOut',
};
// Function Keys (F1-24)
for (var i = 0; i < 24; i += 1) {
codes[112 + i] = 'F' + (i + 1);
}
// Alphabet (a-Z)
for (var j = 0; j < 26; j += 1) {
var n = j + 65;
codes[n] = [String.fromCharCode(n + 32), String.fromCharCode(n)];
}
var keyboardKey = {
codes: codes,
/**
* Get the `keyCode` or `which` value from a keyboard event or `key` name.
* @param {string|object} eventOrKey A keyboard event-like object or `key` name.
* @param {string} [eventOrKey.key] If object, it must have one of these keys.
* @param {number} [eventOrKey.keyCode] If object, it must have one of these keys.
* @param {number} [eventOrKey.which] If object, it must have one of these keys.
* @returns {number|undefined}
*/
getCode: function getCode(eventOrKey) {
if (isObject$1(eventOrKey)) {
return eventOrKey.keyCode || eventOrKey.which || this[eventOrKey.key]
}
return this[eventOrKey]
},
/**
* Get the key name from a keyboard event, `keyCode`, or `which` value.
* @param {number|object} eventOrCode A keyboard event-like object or key code.
* @param {string} [eventOrCode.key] If object with a `key` name, it will be returned.
* @param {number} [eventOrCode.keyCode] If object, it must have one of these keys.
* @param {number} [eventOrCode.which] If object, it must have one of these keys.
* @param {boolean} [eventOrCode.shiftKey] If object, it must have one of these keys.
* @returns {string|undefined}
*/
getKey: function getKey(eventOrCode) {
var isEvent = isObject$1(eventOrCode);
// handle events with a `key` already defined
if (isEvent && eventOrCode.key) {
return eventOrCode.key
}
var name = codes[isEvent ? eventOrCode.keyCode || eventOrCode.which : eventOrCode];
if (Array.isArray(name)) {
if (isEvent) {
name = name[eventOrCode.shiftKey ? 1 : 0];
} else {
name = name[0];
}
}
return name
},
// ----------------------------------------
// By Name
// ----------------------------------------
// declare these manually for static analysis
Cancel: 3,
Help: 6,
Backspace: 8,
Tab: 9,
Clear: 12,
Enter: 13,
Shift: 16,
Control: 17,
Alt: 18,
Pause: 19,
CapsLock: 20,
Escape: 27,
Convert: 28,
NonConvert: 29,
Accept: 30,
ModeChange: 31,
' ': 32,
PageUp: 33,
PageDown: 34,
End: 35,
Home: 36,
ArrowLeft: 37,
ArrowUp: 38,
ArrowRight: 39,
ArrowDown: 40,
Select: 41,
Print: 42,
Execute: 43,
PrintScreen: 44,
Insert: 45,
Delete: 46,
0: 48,
')': 48,
1: 49,
'!': 49,
2: 50,
'@': 50,
3: 51,
'#': 51,
4: 52,
$: 52,
5: 53,
'%': 53,
6: 54,
'^': 54,
7: 55,
'&': 55,
8: 56,
'*': 56,
9: 57,
'(': 57,
a: 65,
A: 65,
b: 66,
B: 66,
c: 67,
C: 67,
d: 68,
D: 68,
e: 69,
E: 69,
f: 70,
F: 70,
g: 71,
G: 71,
h: 72,
H: 72,
i: 73,
I: 73,
j: 74,
J: 74,
k: 75,
K: 75,
l: 76,
L: 76,
m: 77,
M: 77,
n: 78,
N: 78,
o: 79,
O: 79,
p: 80,
P: 80,
q: 81,
Q: 81,
r: 82,
R: 82,
s: 83,
S: 83,
t: 84,
T: 84,
u: 85,
U: 85,
v: 86,
V: 86,
w: 87,
W: 87,
x: 88,
X: 88,
y: 89,
Y: 89,
z: 90,
Z: 90,
OS: 91,
ContextMenu: 93,
F1: 112,
F2: 113,
F3: 114,
F4: 115,
F5: 116,
F6: 117,
F7: 118,
F8: 119,
F9: 120,
F10: 121,
F11: 122,
F12: 123,
F13: 124,
F14: 125,
F15: 126,
F16: 127,
F17: 128,
F18: 129,
F19: 130,
F20: 131,
F21: 132,
F22: 133,
F23: 134,
F24: 135,
NumLock: 144,
ScrollLock: 145,
VolumeMute: 181,
VolumeDown: 182,
VolumeUp: 183,
';': 186,
':': 186,
'=': 187,
'+': 187,
',': 188,
'<': 188,
'-': 189,
_: 189,
'.': 190,
'>': 190,
'/': 191,
'?': 191,
'`': 192,
'~': 192,
'[': 219,
'{': 219,
'\\': 220,
'|': 220,
']': 221,
'}': 221,
"'": 222,
'"': 222,
Meta: 224,
AltGraph: 225,
Attn: 246,
CrSel: 247,
ExSel: 248,
EraseEof: 249,
Play: 250,
ZoomOut: 251,
};
// ----------------------------------------
// By Alias
// ----------------------------------------
// provide dot-notation accessible keys for all key names
keyboardKey.Spacebar = keyboardKey[' '];
keyboardKey.Digit0 = keyboardKey['0'];
keyboardKey.Digit1 = keyboardKey['1'];
keyboardKey.Digit2 = keyboardKey['2'];
keyboardKey.Digit3 = keyboardKey['3'];
keyboardKey.Digit4 = keyboardKey['4'];
keyboardKey.Digit5 = keyboardKey['5'];
keyboardKey.Digit6 = keyboardKey['6'];
keyboardKey.Digit7 = keyboardKey['7'];
keyboardKey.Digit8 = keyboardKey['8'];
keyboardKey.Digit9 = keyboardKey['9'];
keyboardKey.Tilde = keyboardKey['~'];
keyboardKey.GraveAccent = keyboardKey['`'];
keyboardKey.ExclamationPoint = keyboardKey['!'];
keyboardKey.AtSign = keyboardKey['@'];
keyboardKey.PoundSign = keyboardKey['#'];
keyboardKey.PercentSign = keyboardKey['%'];
keyboardKey.Caret = keyboardKey['^'];
keyboardKey.Ampersand = keyboardKey['&'];
keyboardKey.PlusSign = keyboardKey['+'];
keyboardKey.MinusSign = keyboardKey['-'];
keyboardKey.EqualsSign = keyboardKey['='];
keyboardKey.DivisionSign = keyboardKey['/'];
keyboardKey.MultiplicationSign = keyboardKey['*'];
keyboardKey.Comma = keyboardKey[','];
keyboardKey.Decimal = keyboardKey['.'];
keyboardKey.Colon = keyboardKey[':'];
keyboardKey.Semicolon = keyboardKey[';'];
keyboardKey.Pipe = keyboardKey['|'];
keyboardKey.BackSlash = keyboardKey['\\'];
keyboardKey.QuestionMark = keyboardKey['?'];
keyboardKey.SingleQuote = keyboardKey["'"];
keyboardKey.DoubleQuote = keyboardKey['"'];
keyboardKey.LeftCurlyBrace = keyboardKey['{'];
keyboardKey.RightCurlyBrace = keyboardKey['}'];
keyboardKey.LeftParenthesis = keyboardKey['('];
keyboardKey.RightParenthesis = keyboardKey[')'];
keyboardKey.LeftAngleBracket = keyboardKey['<'];
keyboardKey.RightAngleBracket = keyboardKey['>'];
keyboardKey.LeftSquareBracket = keyboardKey['['];
keyboardKey.RightSquareBracket = keyboardKey[']'];
var keyboardKey_1 = keyboardKey;/**
* An inner component that allows you to render children outside their parent.
*/
var PortalInner = /*#__PURE__*/function (_Component) {
_inheritsLoose(PortalInner, _Component);
function PortalInner() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleRef = function (c) {
handleRef(_this.props.innerRef, c);
};
return _this;
}
var _proto = PortalInner.prototype;
_proto.componentDidMount = function componentDidMount() {
_invoke(this.props, 'onMount', null, this.props);
};
_proto.componentWillUnmount = function componentWillUnmount() {
_invoke(this.props, 'onUnmount', null, this.props);
};
_proto.render = function render() {
if (!isBrowser$1()) return null;
var _this$props = this.props,
children = _this$props.children,
_this$props$mountNode = _this$props.mountNode,
mountNode = _this$props$mountNode === void 0 ? document.body : _this$props$mountNode;
return /*#__PURE__*/createPortal( /*#__PURE__*/React__default.createElement(Ref, {
innerRef: this.handleRef
}, children), mountNode);
};
return PortalInner;
}(Component);
PortalInner.handledProps = ["children", "innerRef", "mountNode", "onMount", "onUnmount"];
PortalInner.propTypes = {};
var PortalInner$1 = PortalInner;/**
* A component that allows you to render children outside their parent.
* @see Modal
* @see Popup
* @see Dimmer
* @see Confirm
*/
var Portal = /*#__PURE__*/function (_Component) {
_inheritsLoose(Portal, _Component);
function Portal() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.contentRef = /*#__PURE__*/React__default.createRef();
_this.triggerRef = /*#__PURE__*/React__default.createRef();
_this.latestDocumentMouseDownEvent = null;
_this.handleDocumentMouseDown = function (e) {
_this.latestDocumentMouseDownEvent = e;
};
_this.handleDocumentClick = function (e) {
var closeOnDocumentClick = _this.props.closeOnDocumentClick;
var currentMouseDownEvent = _this.latestDocumentMouseDownEvent;
_this.latestDocumentMouseDownEvent = null;
if (!_this.contentRef.current || // no portal
doesNodeContainClick$1(_this.triggerRef.current, e) || // event happened in trigger (delegate to trigger handlers)
currentMouseDownEvent && doesNodeContainClick$1(_this.contentRef.current, currentMouseDownEvent) || // event originated in the portal but was ended outside
doesNodeContainClick$1(_this.contentRef.current, e) // event happened in the portal
) {
return;
} // ignore the click
if (closeOnDocumentClick) {
_this.close(e);
}
};
_this.handleEscape = function (e) {
if (!_this.props.closeOnEscape) return;
if (keyboardKey_1.getCode(e) !== keyboardKey_1.Escape) return;
_this.close(e);
};
_this.handlePortalMouseLeave = function (e) {
var _this$props = _this.props,
closeOnPortalMouseLeave = _this$props.closeOnPortalMouseLeave,
mouseLeaveDelay = _this$props.mouseLeaveDelay;
if (!closeOnPortalMouseLeave) return; // Do not close the portal when 'mouseleave' is triggered by children
if (e.target !== _this.contentRef.current) return;
_this.mouseLeaveTimer = _this.closeWithTimeout(e, mouseLeaveDelay);
};
_this.handlePortalMouseEnter = function () {
// In order to enable mousing from the trigger to the portal, we need to
// clear the mouseleave timer that was set when leaving the trigger.
var closeOnPortalMouseLeave = _this.props.closeOnPortalMouseLeave;
if (!closeOnPortalMouseLeave) return;
clearTimeout(_this.mouseLeaveTimer);
};
_this.handleTriggerBlur = function (e) {
var _this$props2 = _this.props,
trigger = _this$props2.trigger,
closeOnTriggerBlur = _this$props2.closeOnTriggerBlur; // Call original event handler
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
rest[_key2 - 1] = arguments[_key2];
}
_invoke.apply(void 0, [trigger, 'props.onBlur', e].concat(rest)); // IE 11 doesn't work with relatedTarget in blur events
var target = e.relatedTarget || document.activeElement; // do not close if focus is given to the portal
var didFocusPortal = _invoke(_this.contentRef.current, 'contains', target);
if (!closeOnTriggerBlur || didFocusPortal) return;
_this.close(e);
};
_this.handleTriggerClick = function (e) {
var _this$props3 = _this.props,
trigger = _this$props3.trigger,
closeOnTriggerClick = _this$props3.closeOnTriggerClick,
openOnTriggerClick = _this$props3.openOnTriggerClick;
var open = _this.state.open; // Call original event handler
for (var _len3 = arguments.length, rest = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
rest[_key3 - 1] = arguments[_key3];
}
_invoke.apply(void 0, [trigger, 'props.onClick', e].concat(rest));
if (open && closeOnTriggerClick) {
_this.close(e);
} else if (!open && openOnTriggerClick) {
_this.open(e);
}
};
_this.handleTriggerFocus = function (e) {
var _this$props4 = _this.props,
trigger = _this$props4.trigger,
openOnTriggerFocus = _this$props4.openOnTriggerFocus; // Call original event handler
for (var _len4 = arguments.length, rest = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
rest[_key4 - 1] = arguments[_key4];
}
_invoke.apply(void 0, [trigger, 'props.onFocus', e].concat(rest));
if (!openOnTriggerFocus) return;
_this.open(e);
};
_this.handleTriggerMouseLeave = function (e) {
clearTimeout(_this.mouseEnterTimer);
var _this$props5 = _this.props,
trigger = _this$props5.trigger,
closeOnTriggerMouseLeave = _this$props5.closeOnTriggerMouseLeave,
mouseLeaveDelay = _this$props5.mouseLeaveDelay; // Call original event handler
for (var _len5 = arguments.length, rest = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
rest[_key5 - 1] = arguments[_key5];
}
_invoke.apply(void 0, [trigger, 'props.onMouseLeave', e].concat(rest));
if (!closeOnTriggerMouseLeave) return;
_this.mouseLeaveTimer = _this.closeWithTimeout(e, mouseLeaveDelay);
};
_this.handleTriggerMouseEnter = function (e) {
clearTimeout(_this.mouseLeaveTimer);
var _this$props6 = _this.props,
trigger = _this$props6.trigger,
mouseEnterDelay = _this$props6.mouseEnterDelay,
openOnTriggerMouseEnter = _this$props6.openOnTriggerMouseEnter; // Call original event handler
for (var _len6 = arguments.length, rest = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
rest[_key6 - 1] = arguments[_key6];
}
_invoke.apply(void 0, [trigger, 'props.onMouseEnter', e].concat(rest));
if (!openOnTriggerMouseEnter) return;
_this.mouseEnterTimer = _this.openWithTimeout(e, mouseEnterDelay);
};
_this.open = function (e) {
_invoke(_this.props, 'onOpen', e, _extends$6({}, _this.props, {
open: true
}));
_this.setState({
open: true
});
};
_this.openWithTimeout = function (e, delay) {
// React wipes the entire event object and suggests using e.persist() if
// you need the event for async access. However, even with e.persist
// certain required props (e.g. currentTarget) are null so we're forced to clone.
var eventClone = _extends$6({}, e);
return setTimeout(function () {
return _this.open(eventClone);
}, delay || 0);
};
_this.close = function (e) {
_invoke(_this.props, 'onClose', e, _extends$6({}, _this.props, {
open: false
}));
_this.setState({
open: false
});
};
_this.closeWithTimeout = function (e, delay) {
// React wipes the entire event object and suggests using e.persist() if
// you need the event for async access. However, even with e.persist
// certain required props (e.g. currentTarget) are null so we're forced to clone.
var eventClone = _extends$6({}, e);
return setTimeout(function () {
return _this.close(eventClone);
}, delay || 0);
};
_this.handleMount = function () {
_invoke(_this.props, 'onMount', null, _this.props);
};
_this.handleUnmount = function () {
_invoke(_this.props, 'onUnmount', null, _this.props);
};
_this.handleTriggerRef = function (c) {
_this.triggerRef.current = c;
handleRef(_this.props.triggerRef, c);
};
return _this;
}
var _proto = Portal.prototype;
_proto.componentWillUnmount = function componentWillUnmount() {
// Clean up timers
clearTimeout(this.mouseEnterTimer);
clearTimeout(this.mouseLeaveTimer);
} // ----------------------------------------
// Document Event Handlers
// ----------------------------------------
;
_proto.render = function render() {
var _this$props7 = this.props,
children = _this$props7.children,
eventPool = _this$props7.eventPool,
mountNode = _this$props7.mountNode,
trigger = _this$props7.trigger;
var open = this.state.open;
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, open && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PortalInner$1, {
innerRef: this.contentRef,
mountNode: mountNode,
onMount: this.handleMount,
onUnmount: this.handleUnmount
}, children), /*#__PURE__*/React__default.createElement(lib, {
name: "mouseleave",
on: this.handlePortalMouseLeave,
pool: eventPool,
target: this.contentRef
}), /*#__PURE__*/React__default.createElement(lib, {
name: "mouseenter",
on: this.handlePortalMouseEnter,
pool: eventPool,
target: this.contentRef
}), /*#__PURE__*/React__default.createElement(lib, {
name: "mousedown",
on: this.handleDocumentMouseDown,
pool: eventPool
}), /*#__PURE__*/React__default.createElement(lib, {
name: "click",
on: this.handleDocumentClick,
pool: eventPool
}), /*#__PURE__*/React__default.createElement(lib, {
name: "keydown",
on: this.handleEscape,
pool: eventPool
})), trigger && /*#__PURE__*/React__default.createElement(Ref, {
innerRef: this.handleTriggerRef
}, /*#__PURE__*/React__default.cloneElement(trigger, {
onBlur: this.handleTriggerBlur,
onClick: this.handleTriggerClick,
onFocus: this.handleTriggerFocus,
onMouseLeave: this.handleTriggerMouseLeave,
onMouseEnter: this.handleTriggerMouseEnter
})));
};
return Portal;
}(ModernAutoControlledComponent);
Portal.handledProps = ["children", "closeOnDocumentClick", "closeOnEscape", "closeOnPortalMouseLeave", "closeOnTriggerBlur", "closeOnTriggerClick", "closeOnTriggerMouseLeave", "defaultOpen", "eventPool", "mountNode", "mouseEnterDelay", "mouseLeaveDelay", "onClose", "onMount", "onOpen", "onUnmount", "open", "openOnTriggerClick", "openOnTriggerFocus", "openOnTriggerMouseEnter", "trigger", "triggerRef"];
Portal.propTypes = {};
Portal.defaultProps = {
closeOnDocumentClick: true,
closeOnEscape: true,
eventPool: 'default',
openOnTriggerClick: true
};
Portal.autoControlledProps = ['open'];
Portal.Inner = PortalInner$1;
var Portal$1 = Portal;/**
* A dimmable sub-component for Dimmer.
*/
function DimmerDimmable(props) {
var blurring = props.blurring,
className = props.className,
children = props.children,
content = props.content,
dimmed = props.dimmed;
var classes = cx(useKeyOnly(blurring, 'blurring'), useKeyOnly(dimmed, 'dimmed'), 'dimmable', className);
var rest = getUnhandledProps$1(DimmerDimmable, props);
var ElementType = getElementType(DimmerDimmable, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
DimmerDimmable.handledProps = ["as", "blurring", "children", "className", "content", "dimmed"];
DimmerDimmable.propTypes = {};/**
* An inner element for a Dimmer.
*/
var DimmerInner = /*#__PURE__*/function (_Component) {
_inheritsLoose(DimmerInner, _Component);
function DimmerInner() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.containerRef = /*#__PURE__*/createRef();
_this.contentRef = /*#__PURE__*/createRef();
_this.handleClick = function (e) {
var contentRef = _this.contentRef.current;
_invoke(_this.props, 'onClick', e, _this.props);
if (contentRef && contentRef !== e.target && doesNodeContainClick$1(contentRef, e)) {
return;
}
_invoke(_this.props, 'onClickOutside', e, _this.props);
};
return _this;
}
var _proto = DimmerInner.prototype;
_proto.componentDidMount = function componentDidMount() {
var active = this.props.active;
this.toggleStyles(active);
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
var currentActive = this.props.active;
var prevActive = prevProps.active;
if (prevActive !== currentActive) this.toggleStyles(currentActive);
};
_proto.toggleStyles = function toggleStyles(active) {
var containerRef = this.containerRef.current;
if (!containerRef || !containerRef.style) return;
if (active) {
containerRef.style.setProperty('display', 'flex', 'important');
} else {
containerRef.style.removeProperty('display');
}
};
_proto.render = function render() {
var _this$props = this.props,
active = _this$props.active,
children = _this$props.children,
className = _this$props.className,
content = _this$props.content,
disabled = _this$props.disabled,
inverted = _this$props.inverted,
page = _this$props.page,
simple = _this$props.simple,
verticalAlign = _this$props.verticalAlign;
var classes = cx('ui', useKeyOnly(active, 'active transition visible'), useKeyOnly(disabled, 'disabled'), useKeyOnly(inverted, 'inverted'), useKeyOnly(page, 'page'), useKeyOnly(simple, 'simple'), useVerticalAlignProp(verticalAlign), 'dimmer', className);
var rest = getUnhandledProps$1(DimmerInner, this.props);
var ElementType = getElementType(DimmerInner, this.props);
var childrenContent = isNil$1(children) ? content : children;
return /*#__PURE__*/React__default.createElement(Ref, {
innerRef: this.containerRef
}, /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
onClick: this.handleClick
}), childrenContent && /*#__PURE__*/React__default.createElement("div", {
className: "content",
ref: this.contentRef
}, childrenContent)));
};
return DimmerInner;
}(Component);
DimmerInner.handledProps = ["active", "as", "children", "className", "content", "disabled", "inverted", "onClick", "onClickOutside", "page", "simple", "verticalAlign"];
DimmerInner.propTypes = {};/**
* A dimmer hides distractions to focus attention on particular content.
*/
var Dimmer = /*#__PURE__*/function (_Component) {
_inheritsLoose(Dimmer, _Component);
function Dimmer() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handlePortalMount = function () {
if (!isBrowser$1()) return; // Heads up, IE doesn't support second argument in add()
document.body.classList.add('dimmed');
document.body.classList.add('dimmable');
};
_this.handlePortalUnmount = function () {
if (!isBrowser$1()) return; // Heads up, IE doesn't support second argument in add()
document.body.classList.remove('dimmed');
document.body.classList.remove('dimmable');
};
return _this;
}
var _proto = Dimmer.prototype;
_proto.render = function render() {
var _this$props = this.props,
active = _this$props.active,
page = _this$props.page;
var rest = getUnhandledProps$1(Dimmer, this.props);
if (page) {
return /*#__PURE__*/React__default.createElement(Portal$1, {
closeOnEscape: false,
closeOnDocumentClick: false,
onMount: this.handlePortalMount,
onUnmount: this.handlePortalUnmount,
open: active,
openOnTriggerClick: false
}, /*#__PURE__*/React__default.createElement(DimmerInner, _extends$6({}, rest, {
active: active,
page: page
})));
}
return /*#__PURE__*/React__default.createElement(DimmerInner, _extends$6({}, rest, {
active: active,
page: page
}));
};
return Dimmer;
}(Component);
Dimmer.handledProps = ["active", "page"];
Dimmer.propTypes = {};
Dimmer.Dimmable = DimmerDimmable;
Dimmer.Inner = DimmerInner;
Dimmer.create = createShorthandFactory(Dimmer, function (value) {
return {
content: value
};
});/**
* A group of images.
*/
function ImageGroup(props) {
var children = props.children,
className = props.className,
content = props.content,
size = props.size;
var classes = cx('ui', size, className, 'images');
var rest = getUnhandledProps$1(ImageGroup, props);
var ElementType = getElementType(ImageGroup, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
ImageGroup.handledProps = ["as", "children", "className", "content", "size"];
ImageGroup.propTypes = {};/**
* An image is a graphic representation of something.
* @see Icon
*/
function Image(props) {
var avatar = props.avatar,
bordered = props.bordered,
centered = props.centered,
children = props.children,
circular = props.circular,
className = props.className,
content = props.content,
dimmer = props.dimmer,
disabled = props.disabled,
floated = props.floated,
fluid = props.fluid,
hidden = props.hidden,
href = props.href,
inline = props.inline,
label = props.label,
rounded = props.rounded,
size = props.size,
spaced = props.spaced,
verticalAlign = props.verticalAlign,
wrapped = props.wrapped,
ui = props.ui;
var classes = cx(useKeyOnly(ui, 'ui'), size, useKeyOnly(avatar, 'avatar'), useKeyOnly(bordered, 'bordered'), useKeyOnly(circular, 'circular'), useKeyOnly(centered, 'centered'), useKeyOnly(disabled, 'disabled'), useKeyOnly(fluid, 'fluid'), useKeyOnly(hidden, 'hidden'), useKeyOnly(inline, 'inline'), useKeyOnly(rounded, 'rounded'), useKeyOrValueAndKey(spaced, 'spaced'), useValueAndKey(floated, 'floated'), useVerticalAlignProp(verticalAlign), 'image', className);
var rest = getUnhandledProps$1(Image, props);
var _partitionHTMLProps = partitionHTMLProps(rest, {
htmlProps: htmlImageProps
}),
imgTagProps = _partitionHTMLProps[0],
rootProps = _partitionHTMLProps[1];
var ElementType = getElementType(Image, props, function () {
if (!isNil(dimmer) || !isNil(label) || !isNil(wrapped) || !isNil$1(children)) {
return 'div';
}
});
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
if (!isNil$1(content)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), content);
}
if (ElementType === 'img') {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rootProps, imgTagProps, {
className: classes
}));
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rootProps, {
className: classes,
href: href
}), Dimmer.create(dimmer, {
autoGenerateKey: false
}), Label.create(label, {
autoGenerateKey: false
}), /*#__PURE__*/React__default.createElement("img", imgTagProps));
}
Image.handledProps = ["as", "avatar", "bordered", "centered", "children", "circular", "className", "content", "dimmer", "disabled", "floated", "fluid", "hidden", "href", "inline", "label", "rounded", "size", "spaced", "ui", "verticalAlign", "wrapped"];
Image.Group = ImageGroup;
Image.propTypes = {};
Image.defaultProps = {
as: 'img',
ui: true
};
Image.create = createShorthandFactory(Image, function (value) {
return {
src: value
};
});function LabelDetail(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('detail', className);
var rest = getUnhandledProps$1(LabelDetail, props);
var ElementType = getElementType(LabelDetail, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
LabelDetail.handledProps = ["as", "children", "className", "content"];
LabelDetail.propTypes = {};
LabelDetail.create = createShorthandFactory(LabelDetail, function (val) {
return {
content: val
};
});/**
* A label can be grouped.
*/
function LabelGroup(props) {
var children = props.children,
circular = props.circular,
className = props.className,
color = props.color,
content = props.content,
size = props.size,
tag = props.tag;
var classes = cx('ui', color, size, useKeyOnly(circular, 'circular'), useKeyOnly(tag, 'tag'), 'labels', className);
var rest = getUnhandledProps$1(LabelGroup, props);
var ElementType = getElementType(LabelGroup, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
LabelGroup.handledProps = ["as", "children", "circular", "className", "color", "content", "size", "tag"];
LabelGroup.propTypes = {};/**
* A label displays content classification.
*/
var Label = /*#__PURE__*/function (_Component) {
_inheritsLoose(Label, _Component);
function Label() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleClick = function (e) {
var onClick = _this.props.onClick;
if (onClick) onClick(e, _this.props);
};
_this.handleIconOverrides = function (predefinedProps) {
return {
onClick: function onClick(e) {
_invoke(predefinedProps, 'onClick', e);
_invoke(_this.props, 'onRemove', e, _this.props);
}
};
};
return _this;
}
var _proto = Label.prototype;
_proto.render = function render() {
var _this$props = this.props,
active = _this$props.active,
attached = _this$props.attached,
basic = _this$props.basic,
children = _this$props.children,
circular = _this$props.circular,
className = _this$props.className,
color = _this$props.color,
content = _this$props.content,
corner = _this$props.corner,
detail = _this$props.detail,
empty = _this$props.empty,
floating = _this$props.floating,
horizontal = _this$props.horizontal,
icon = _this$props.icon,
image = _this$props.image,
onRemove = _this$props.onRemove,
pointing = _this$props.pointing,
prompt = _this$props.prompt,
removeIcon = _this$props.removeIcon,
ribbon = _this$props.ribbon,
size = _this$props.size,
tag = _this$props.tag;
var pointingClass = pointing === true && 'pointing' || (pointing === 'left' || pointing === 'right') && pointing + " pointing" || (pointing === 'above' || pointing === 'below') && "pointing " + pointing;
var classes = cx('ui', color, pointingClass, size, useKeyOnly(active, 'active'), useKeyOnly(basic, 'basic'), useKeyOnly(circular, 'circular'), useKeyOnly(empty, 'empty'), useKeyOnly(floating, 'floating'), useKeyOnly(horizontal, 'horizontal'), useKeyOnly(image === true, 'image'), useKeyOnly(prompt, 'prompt'), useKeyOnly(tag, 'tag'), useKeyOrValueAndKey(corner, 'corner'), useKeyOrValueAndKey(ribbon, 'ribbon'), useValueAndKey(attached, 'attached'), 'label', className);
var rest = getUnhandledProps$1(Label, this.props);
var ElementType = getElementType(Label, this.props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
onClick: this.handleClick
}), children);
}
var removeIconShorthand = isUndefined(removeIcon) ? 'delete' : removeIcon;
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({
className: classes,
onClick: this.handleClick
}, rest), Icon$1.create(icon, {
autoGenerateKey: false
}), typeof image !== 'boolean' && Image.create(image, {
autoGenerateKey: false
}), content, LabelDetail.create(detail, {
autoGenerateKey: false
}), onRemove && Icon$1.create(removeIconShorthand, {
autoGenerateKey: false,
overrideProps: this.handleIconOverrides
}));
};
return Label;
}(Component);
Label.handledProps = ["active", "as", "attached", "basic", "children", "circular", "className", "color", "content", "corner", "detail", "empty", "floating", "horizontal", "icon", "image", "onClick", "onRemove", "pointing", "prompt", "removeIcon", "ribbon", "size", "tag"];
Label.propTypes = {};
Label.Detail = LabelDetail;
Label.Group = LabelGroup;
Label.create = createShorthandFactory(Label, function (value) {
return {
content: value
};
});/**
* Used in some Button types, such as `animated`.
*/
function ButtonContent(props) {
var children = props.children,
className = props.className,
content = props.content,
hidden = props.hidden,
visible = props.visible;
var classes = cx(useKeyOnly(visible, 'visible'), useKeyOnly(hidden, 'hidden'), 'content', className);
var rest = getUnhandledProps$1(ButtonContent, props);
var ElementType = getElementType(ButtonContent, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
ButtonContent.handledProps = ["as", "children", "className", "content", "hidden", "visible"];
ButtonContent.propTypes = {};/**
* Buttons can be grouped.
*/
function ButtonGroup(props) {
var attached = props.attached,
basic = props.basic,
buttons = props.buttons,
children = props.children,
className = props.className,
color = props.color,
compact = props.compact,
content = props.content,
floated = props.floated,
fluid = props.fluid,
icon = props.icon,
inverted = props.inverted,
labeled = props.labeled,
negative = props.negative,
positive = props.positive,
primary = props.primary,
secondary = props.secondary,
size = props.size,
toggle = props.toggle,
vertical = props.vertical,
widths = props.widths;
var classes = cx('ui', color, size, useKeyOnly(basic, 'basic'), useKeyOnly(compact, 'compact'), useKeyOnly(fluid, 'fluid'), useKeyOnly(icon, 'icon'), useKeyOnly(inverted, 'inverted'), useKeyOnly(labeled, 'labeled'), useKeyOnly(negative, 'negative'), useKeyOnly(positive, 'positive'), useKeyOnly(primary, 'primary'), useKeyOnly(secondary, 'secondary'), useKeyOnly(toggle, 'toggle'), useKeyOnly(vertical, 'vertical'), useKeyOrValueAndKey(attached, 'attached'), useValueAndKey(floated, 'floated'), useWidthProp(widths), 'buttons', className);
var rest = getUnhandledProps$1(ButtonGroup, props);
var ElementType = getElementType(ButtonGroup, props);
if (isNil(buttons)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), map(buttons, function (button) {
return Button$2.create(button);
}));
}
ButtonGroup.handledProps = ["as", "attached", "basic", "buttons", "children", "className", "color", "compact", "content", "floated", "fluid", "icon", "inverted", "labeled", "negative", "positive", "primary", "secondary", "size", "toggle", "vertical", "widths"];
ButtonGroup.propTypes = {};/**
* Button groups can contain conditionals.
*/
function ButtonOr(props) {
var className = props.className,
text = props.text;
var classes = cx('or', className);
var rest = getUnhandledProps$1(ButtonOr, props);
var ElementType = getElementType(ButtonOr, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
"data-text": text
}));
}
ButtonOr.handledProps = ["as", "className", "text"];
ButtonOr.propTypes = {};/**
* A Button indicates a possible user action.
* @see Form
* @see Icon
* @see Label
*/
var Button$1 = /*#__PURE__*/function (_Component) {
_inheritsLoose(Button, _Component);
function Button() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.ref = /*#__PURE__*/createRef();
_this.computeElementType = function () {
var _this$props = _this.props,
attached = _this$props.attached,
label = _this$props.label;
if (!isNil(attached) || !isNil(label)) return 'div';
};
_this.computeTabIndex = function (ElementType) {
var _this$props2 = _this.props,
disabled = _this$props2.disabled,
tabIndex = _this$props2.tabIndex;
if (!isNil(tabIndex)) return tabIndex;
if (disabled) return -1;
if (ElementType === 'div') return 0;
};
_this.focus = function () {
return _invoke(_this.ref.current, 'focus');
};
_this.handleClick = function (e) {
var disabled = _this.props.disabled;
if (disabled) {
e.preventDefault();
return;
}
_invoke(_this.props, 'onClick', e, _this.props);
};
_this.hasIconClass = function () {
var _this$props3 = _this.props,
labelPosition = _this$props3.labelPosition,
children = _this$props3.children,
content = _this$props3.content,
icon = _this$props3.icon;
if (icon === true) return true;
return icon && (labelPosition || isNil$1(children) && isNil(content));
};
return _this;
}
var _proto = Button.prototype;
_proto.computeButtonAriaRole = function computeButtonAriaRole(ElementType) {
var role = this.props.role;
if (!isNil(role)) return role;
if (ElementType !== 'button') return 'button';
};
_proto.render = function render() {
var _this$props4 = this.props,
active = _this$props4.active,
animated = _this$props4.animated,
attached = _this$props4.attached,
basic = _this$props4.basic,
children = _this$props4.children,
circular = _this$props4.circular,
className = _this$props4.className,
color = _this$props4.color,
compact = _this$props4.compact,
content = _this$props4.content,
disabled = _this$props4.disabled,
floated = _this$props4.floated,
fluid = _this$props4.fluid,
icon = _this$props4.icon,
inverted = _this$props4.inverted,
label = _this$props4.label,
labelPosition = _this$props4.labelPosition,
loading = _this$props4.loading,
negative = _this$props4.negative,
positive = _this$props4.positive,
primary = _this$props4.primary,
secondary = _this$props4.secondary,
size = _this$props4.size,
toggle = _this$props4.toggle;
var baseClasses = cx(color, size, useKeyOnly(active, 'active'), useKeyOnly(basic, 'basic'), useKeyOnly(circular, 'circular'), useKeyOnly(compact, 'compact'), useKeyOnly(fluid, 'fluid'), useKeyOnly(this.hasIconClass(), 'icon'), useKeyOnly(inverted, 'inverted'), useKeyOnly(loading, 'loading'), useKeyOnly(negative, 'negative'), useKeyOnly(positive, 'positive'), useKeyOnly(primary, 'primary'), useKeyOnly(secondary, 'secondary'), useKeyOnly(toggle, 'toggle'), useKeyOrValueAndKey(animated, 'animated'), useKeyOrValueAndKey(attached, 'attached'));
var labeledClasses = cx(useKeyOrValueAndKey(labelPosition || !!label, 'labeled'));
var wrapperClasses = cx(useKeyOnly(disabled, 'disabled'), useValueAndKey(floated, 'floated'));
var rest = getUnhandledProps$1(Button, this.props);
var ElementType = getElementType(Button, this.props, this.computeElementType);
var tabIndex = this.computeTabIndex(ElementType);
if (!isNil(label)) {
var buttonClasses = cx('ui', baseClasses, 'button', className);
var containerClasses = cx('ui', labeledClasses, 'button', className, wrapperClasses);
var labelElement = Label.create(label, {
defaultProps: {
basic: true,
pointing: labelPosition === 'left' ? 'right' : 'left'
},
autoGenerateKey: false
});
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: containerClasses,
onClick: this.handleClick
}), labelPosition === 'left' && labelElement, /*#__PURE__*/React__default.createElement(Ref, {
innerRef: this.ref
}, /*#__PURE__*/React__default.createElement("button", {
className: buttonClasses,
"aria-pressed": toggle ? !!active : undefined,
disabled: disabled,
tabIndex: tabIndex
}, Icon$1.create(icon, {
autoGenerateKey: false
}), " ", content)), (labelPosition === 'right' || !labelPosition) && labelElement);
}
var classes = cx('ui', baseClasses, wrapperClasses, labeledClasses, 'button', className);
var hasChildren = !isNil$1(children);
var role = this.computeButtonAriaRole(ElementType);
return /*#__PURE__*/React__default.createElement(Ref, {
innerRef: this.ref
}, /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
"aria-pressed": toggle ? !!active : undefined,
disabled: disabled && ElementType === 'button' || undefined,
onClick: this.handleClick,
role: role,
tabIndex: tabIndex
}), hasChildren && children, !hasChildren && Icon$1.create(icon, {
autoGenerateKey: false
}), !hasChildren && content));
};
return Button;
}(Component);
Button$1.handledProps = ["active", "animated", "as", "attached", "basic", "children", "circular", "className", "color", "compact", "content", "disabled", "floated", "fluid", "icon", "inverted", "label", "labelPosition", "loading", "negative", "onClick", "positive", "primary", "role", "secondary", "size", "tabIndex", "toggle"];
Button$1.propTypes = {};
Button$1.defaultProps = {
as: 'button'
};
Button$1.Content = ButtonContent;
Button$1.Group = ButtonGroup;
Button$1.Or = ButtonOr;
Button$1.create = createShorthandFactory(Button$1, function (value) {
return {
content: value
};
});
var Button$2 = Button$1;/**
* A specialized version of `_.reduce` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @param {boolean} [initAccum] Specify using the first element of `array` as
* the initial value.
* @returns {*} Returns the accumulated value.
*/
function arrayReduce(array, iteratee, accumulator, initAccum) {
var index = -1,
length = array == null ? 0 : array.length;
if (initAccum && length) {
accumulator = array[++index];
}
while (++index < length) {
accumulator = iteratee(accumulator, array[index], index, array);
}
return accumulator;
}/**
* The base implementation of `_.reduce` and `_.reduceRight`, without support
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} accumulator The initial value.
* @param {boolean} initAccum Specify using the first or last element of
* `collection` as the initial value.
* @param {Function} eachFunc The function to iterate over `collection`.
* @returns {*} Returns the accumulated value.
*/
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
eachFunc(collection, function(value, index, collection) {
accumulator = initAccum
? (initAccum = false, value)
: iteratee(accumulator, value, index, collection);
});
return accumulator;
}/**
* Reduces `collection` to a value which is the accumulated result of running
* each element in `collection` thru `iteratee`, where each successive
* invocation is supplied the return value of the previous. If `accumulator`
* is not given, the first element of `collection` is used as the initial
* value. The iteratee is invoked with four arguments:
* (accumulator, value, index|key, collection).
*
* Many lodash methods are guarded to work as iteratees for methods like
* `_.reduce`, `_.reduceRight`, and `_.transform`.
*
* The guarded methods are:
* `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
* and `sortBy`
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @returns {*} Returns the accumulated value.
* @see _.reduceRight
* @example
*
* _.reduce([1, 2], function(sum, n) {
* return sum + n;
* }, 0);
* // => 3
*
* _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
* (result[value] || (result[value] = [])).push(key);
* return result;
* }, {});
* // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
*/
function reduce(collection, iteratee, accumulator) {
var func = isArray$1(collection) ? arrayReduce : baseReduce,
initAccum = arguments.length < 3;
return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach$1);
}//
var shallowequal = function shallowEqual(objA, objB, compare, compareContext) {
var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
if (ret !== void 0) {
return !!ret;
}
if (objA === objB) {
return true;
}
if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
// Test for A's keys different from B.
for (var idx = 0; idx < keysA.length; idx++) {
var key = keysA[idx];
if (!bHasOwnProperty(key)) {
return false;
}
var valueA = objA[key];
var valueB = objB[key];
ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
if (ret === false || (ret === void 0 && valueA !== valueB)) {
return false;
}
}
return true;
};/**
* A modal can contain a row of actions.
*/
var ModalActions = /*#__PURE__*/function (_Component) {
_inheritsLoose(ModalActions, _Component);
function ModalActions() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleButtonOverrides = function (predefinedProps) {
return {
onClick: function onClick(e, buttonProps) {
_invoke(predefinedProps, 'onClick', e, buttonProps);
_invoke(_this.props, 'onActionClick', e, buttonProps);
}
};
};
return _this;
}
var _proto = ModalActions.prototype;
_proto.render = function render() {
var _this2 = this;
var _this$props = this.props,
actions = _this$props.actions,
children = _this$props.children,
className = _this$props.className,
content = _this$props.content;
var classes = cx('actions', className);
var rest = getUnhandledProps$1(ModalActions, this.props);
var ElementType = getElementType(ModalActions, this.props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
if (!isNil$1(content)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), content);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), map(actions, function (action) {
return Button$2.create(action, {
overrideProps: _this2.handleButtonOverrides
});
}));
};
return ModalActions;
}(Component);
ModalActions.handledProps = ["actions", "as", "children", "className", "content", "onActionClick"];
ModalActions.propTypes = {};
ModalActions.create = createShorthandFactory(ModalActions, function (actions) {
return {
actions: actions
};
});/**
* A modal can contain content.
*/
function ModalContent(props) {
var children = props.children,
className = props.className,
content = props.content,
image = props.image,
scrolling = props.scrolling;
var classes = cx(className, useKeyOnly(image, 'image'), useKeyOnly(scrolling, 'scrolling'), 'content');
var rest = getUnhandledProps$1(ModalContent, props);
var ElementType = getElementType(ModalContent, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
ModalContent.handledProps = ["as", "children", "className", "content", "image", "scrolling"];
ModalContent.propTypes = {};
ModalContent.create = createShorthandFactory(ModalContent, function (content) {
return {
content: content
};
});/**
* A modal can contain a description with one or more paragraphs.
*/
function ModalDescription(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('description', className);
var rest = getUnhandledProps$1(ModalDescription, props);
var ElementType = getElementType(ModalDescription, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
ModalDescription.handledProps = ["as", "children", "className", "content"];
ModalDescription.propTypes = {};/**
* A modal has a dimmer.
*/
function ModalDimmer(props) {
var blurring = props.blurring,
children = props.children,
className = props.className,
centered = props.centered,
content = props.content,
inverted = props.inverted,
mountNode = props.mountNode,
scrolling = props.scrolling;
var ref = React__default.useRef();
var classes = cx('ui', useKeyOnly(inverted, 'inverted'), useKeyOnly(!centered, 'top aligned'), 'page modals dimmer transition visible active', className);
var bodyClasses = cx('dimmable dimmed', useKeyOnly(blurring, 'blurring'), useKeyOnly(scrolling, 'scrolling'));
var rest = getUnhandledProps$1(ModalDimmer, props);
var ElementType = getElementType(ModalDimmer, props);
useClassNamesOnNode(mountNode, bodyClasses);
React__default.useEffect(function () {
if (ref.current && ref.current.style) {
ref.current.style.setProperty('display', 'flex', 'important');
}
}, []);
return /*#__PURE__*/React__default.createElement(Ref, {
innerRef: ref
}, /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children));
}
ModalDimmer.handledProps = ["as", "blurring", "centered", "children", "className", "content", "inverted", "mountNode", "scrolling"];
ModalDimmer.propTypes = {};
ModalDimmer.create = createShorthandFactory(ModalDimmer, function (content) {
return {
content: content
};
});/**
* A modal can have a header.
*/
function ModalHeader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('header', className);
var rest = getUnhandledProps$1(ModalHeader, props);
var ElementType = getElementType(ModalHeader, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
ModalHeader.handledProps = ["as", "children", "className", "content"];
ModalHeader.propTypes = {};
ModalHeader.create = createShorthandFactory(ModalHeader, function (content) {
return {
content: content
};
});// https://github.com/Semantic-Org/Semantic-UI/blob/2.4.1/src/definitions/modules/modal.js#L956
var OFFSET = 0; // https://github.com/Semantic-Org/Semantic-UI/blob/2.4.1/src/definitions/modules/modal.js#L990
var PADDING = 50;
/**
* Ensures that modal can fit viewport without scroll.
*
* @param modalRect {DOMRect}
*
* @see https://github.com/Semantic-Org/Semantic-UI/blob/2.4.1/src/definitions/modules/modal.js#L608
*/
var canFit = function canFit(modalRect) {
// original: scrollHeight = $module.prop('scrollHeight'),
// is replaced by .height because scrollHeight provides integer which produces glitches
// https://github.com/Semantic-Org/Semantic-UI-React/issues/2221
var scrollHeight = modalRect.height + OFFSET; // $module.outerHeight() + settings.offset
var height = modalRect.height + OFFSET; // original: $(window).height()
var contextHeight = window.innerHeight;
var verticalCenter = contextHeight / 2;
var topOffset = -(height / 2); // padding with edge of page
var paddingHeight = PADDING;
var startPosition = verticalCenter + topOffset; // 0
// original: scrollHeight > height
// ? startPosition + scrollHeight + paddingHeight < contextHeight
// : height + paddingHeight * 2 < contextHeight
return startPosition + scrollHeight + paddingHeight < contextHeight;
};
/**
* Creates legacy styles for IE11.
*
* @param isFitted {Boolean}
* @param centered {Boolean}
* @param modalRect {DOMRect}
*
* @see https://github.com/Semantic-Org/Semantic-UI/blob/2.4.1/src/definitions/modules/modal.js#L718
*/
var getLegacyStyles = function getLegacyStyles(isFitted, centered, modalRect) {
var marginTop = centered && isFitted ? -(modalRect.height / 2) : 0;
var marginLeft = -(modalRect.width / 2);
return {
marginLeft: marginLeft,
marginTop: marginTop
};
}; // https://github.com/Semantic-Org/Semantic-UI/blob/2.4.1/src/definitions/modules/modal.js#L631
/* istanbul ignore next */
var isLegacy = function isLegacy() {
return !window.ActiveXObject && 'ActiveXObject' in window;
};/**
* A modal displays content that temporarily blocks interactions with the main view of a site.
* @see Confirm
* @see Portal
*/
var Modal = /*#__PURE__*/function (_Component) {
_inheritsLoose(Modal, _Component);
function Modal() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.legacy = isBrowser$1() && isLegacy();
_this.ref = /*#__PURE__*/createRef();
_this.dimmerRef = /*#__PURE__*/createRef();
_this.latestDocumentMouseDownEvent = null;
_this.getMountNode = function () {
return isBrowser$1() ? _this.props.mountNode || document.body : null;
};
_this.handleActionsOverrides = function (predefinedProps) {
return {
onActionClick: function onActionClick(e, actionProps) {
_invoke(predefinedProps, 'onActionClick', e, actionProps);
_invoke(_this.props, 'onActionClick', e, _this.props);
_this.handleClose(e);
}
};
};
_this.handleClose = function (e) {
_invoke(_this.props, 'onClose', e, _extends$6({}, _this.props, {
open: false
}));
_this.setState({
open: false
});
};
_this.handleDocumentMouseDown = function (e) {
_this.latestDocumentMouseDownEvent = e;
};
_this.handleDocumentClick = function (e) {
var closeOnDimmerClick = _this.props.closeOnDimmerClick;
var currentDocumentMouseDownEvent = _this.latestDocumentMouseDownEvent;
_this.latestDocumentMouseDownEvent = null;
if (!closeOnDimmerClick || doesNodeContainClick$1(_this.ref.current, currentDocumentMouseDownEvent) || doesNodeContainClick$1(_this.ref.current, e)) return;
_invoke(_this.props, 'onClose', e, _extends$6({}, _this.props, {
open: false
}));
_this.setState({
open: false
});
};
_this.handleIconOverrides = function (predefinedProps) {
return {
onClick: function onClick(e) {
_invoke(predefinedProps, 'onClick', e);
_this.handleClose(e);
}
};
};
_this.handleOpen = function (e) {
_invoke(_this.props, 'onOpen', e, _extends$6({}, _this.props, {
open: true
}));
_this.setState({
open: true
});
};
_this.handlePortalMount = function (e) {
var eventPool = _this.props.eventPool;
_this.setState({
scrolling: false
});
_this.setPositionAndClassNames();
instance.sub('mousedown', _this.handleDocumentMouseDown, {
pool: eventPool,
target: _this.dimmerRef.current
});
instance.sub('click', _this.handleDocumentClick, {
pool: eventPool,
target: _this.dimmerRef.current
});
_invoke(_this.props, 'onMount', e, _this.props);
};
_this.handlePortalUnmount = function (e) {
var eventPool = _this.props.eventPool;
cancelAnimationFrame(_this.animationRequestId);
instance.unsub('mousedown', _this.handleDocumentMouseDown, {
pool: eventPool,
target: _this.dimmerRef.current
});
instance.unsub('click', _this.handleDocumentClick, {
pool: eventPool,
target: _this.dimmerRef.current
});
_invoke(_this.props, 'onUnmount', e, _this.props);
};
_this.setPositionAndClassNames = function () {
var centered = _this.props.centered;
var scrolling;
var newState = {};
if (_this.ref.current) {
var rect = _this.ref.current.getBoundingClientRect();
var isFitted = canFit(rect);
scrolling = !isFitted; // Styles should be computed for IE11
var legacyStyles = _this.legacy ? getLegacyStyles(isFitted, centered, rect) : {};
if (!shallowequal(_this.state.legacyStyles, legacyStyles)) {
newState.legacyStyles = legacyStyles;
}
if (_this.state.scrolling !== scrolling) {
newState.scrolling = scrolling;
}
}
if (!isEmpty(newState)) _this.setState(newState);
_this.animationRequestId = requestAnimationFrame(_this.setPositionAndClassNames);
};
_this.renderContent = function (rest) {
var _this$props = _this.props,
actions = _this$props.actions,
basic = _this$props.basic,
children = _this$props.children,
className = _this$props.className,
closeIcon = _this$props.closeIcon,
content = _this$props.content,
header = _this$props.header,
size = _this$props.size,
style = _this$props.style;
var _this$state = _this.state,
legacyStyles = _this$state.legacyStyles,
scrolling = _this$state.scrolling;
var classes = cx('ui', size, useKeyOnly(basic, 'basic'), useKeyOnly(_this.legacy, 'legacy'), useKeyOnly(scrolling, 'scrolling'), 'modal transition visible active', className);
var ElementType = getElementType(Modal, _this.props);
var closeIconName = closeIcon === true ? 'close' : closeIcon;
var closeIconJSX = Icon$1.create(closeIconName, {
overrideProps: _this.handleIconOverrides
});
return /*#__PURE__*/React__default.createElement(Ref, {
innerRef: _this.ref
}, /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
style: _extends$6({}, legacyStyles, style)
}), closeIconJSX, isNil$1(children) ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, ModalHeader.create(header, {
autoGenerateKey: false
}), ModalContent.create(content, {
autoGenerateKey: false
}), ModalActions.create(actions, {
overrideProps: _this.handleActionsOverrides
})) : children));
};
return _this;
}
var _proto = Modal.prototype;
_proto.componentWillUnmount = function componentWillUnmount() {
this.handlePortalUnmount();
} // Do not access document when server side rendering
;
_proto.render = function render() {
var _this$props2 = this.props,
centered = _this$props2.centered,
closeOnDocumentClick = _this$props2.closeOnDocumentClick,
dimmer = _this$props2.dimmer,
eventPool = _this$props2.eventPool,
trigger = _this$props2.trigger;
var _this$state2 = this.state,
open = _this$state2.open,
scrolling = _this$state2.scrolling;
var mountNode = this.getMountNode(); // Short circuit when server side rendering
if (!isBrowser$1()) {
return /*#__PURE__*/isValidElement(trigger) ? trigger : null;
}
var unhandled = getUnhandledProps$1(Modal, this.props);
var portalPropNames = Portal$1.handledProps;
var rest = reduce(unhandled, function (acc, val, key) {
if (!includes(portalPropNames, key)) acc[key] = val;
return acc;
}, {});
var portalProps = _pick(unhandled, portalPropNames); // Heads up!
//
// The SUI CSS selector to prevent the modal itself from blurring requires an immediate .dimmer child:
// .blurring.dimmed.dimmable>:not(.dimmer) { ... }
//
// The .blurring.dimmed.dimmable is the body, so that all body content inside is blurred.
// We need the immediate child to be the dimmer to :not() blur the modal itself!
// Otherwise, the portal div is also blurred, blurring the modal.
//
// We cannot them wrap the modalJSX in an actual <Dimmer /> instead, we apply the dimmer classes to the <Portal />.
return /*#__PURE__*/React__default.createElement(Portal$1, _extends$6({
closeOnDocumentClick: closeOnDocumentClick
}, portalProps, {
trigger: trigger,
eventPool: eventPool,
mountNode: mountNode,
open: open,
onClose: this.handleClose,
onMount: this.handlePortalMount,
onOpen: this.handleOpen,
onUnmount: this.handlePortalUnmount
}), /*#__PURE__*/React__default.createElement(Ref, {
innerRef: this.dimmerRef
}, ModalDimmer.create(isPlainObject(dimmer) ? dimmer : {}, {
autoGenerateKey: false,
defaultProps: {
blurring: dimmer === 'blurring',
inverted: dimmer === 'inverted'
},
overrideProps: {
children: this.renderContent(rest),
centered: centered,
mountNode: mountNode,
scrolling: scrolling
}
})));
};
return Modal;
}(ModernAutoControlledComponent);
Modal.handledProps = ["actions", "as", "basic", "centered", "children", "className", "closeIcon", "closeOnDimmerClick", "closeOnDocumentClick", "content", "defaultOpen", "dimmer", "eventPool", "header", "mountNode", "onActionClick", "onClose", "onMount", "onOpen", "onUnmount", "open", "size", "style", "trigger"];
Modal.propTypes = {};
Modal.defaultProps = {
centered: true,
dimmer: true,
closeOnDimmerClick: true,
closeOnDocumentClick: false,
eventPool: 'Modal'
};
Modal.autoControlledProps = ['open'];
Modal.Actions = ModalActions;
Modal.Content = ModalContent;
Modal.Description = ModalDescription;
Modal.Dimmer = ModalDimmer;
Modal.Header = ModalHeader;
var Modal$1 = Modal;/**
* A Confirm modal gives the user a choice to confirm or cancel an action/
* @see Modal
*/
var Confirm = /*#__PURE__*/function (_Component) {
_inheritsLoose(Confirm, _Component);
function Confirm() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleCancel = function (e) {
_invoke(_this.props, 'onCancel', e, _this.props);
};
_this.handleCancelOverrides = function (predefinedProps) {
return {
onClick: function onClick(e, buttonProps) {
_invoke(predefinedProps, 'onClick', e, buttonProps);
_this.handleCancel(e);
}
};
};
_this.handleConfirmOverrides = function (predefinedProps) {
return {
onClick: function onClick(e, buttonProps) {
_invoke(predefinedProps, 'onClick', e, buttonProps);
_invoke(_this.props, 'onConfirm', e, _this.props);
}
};
};
return _this;
}
var _proto = Confirm.prototype;
_proto.render = function render() {
var _this$props = this.props,
cancelButton = _this$props.cancelButton,
confirmButton = _this$props.confirmButton,
content = _this$props.content,
header = _this$props.header,
open = _this$props.open,
size = _this$props.size;
var rest = getUnhandledProps$1(Confirm, this.props); // `open` is auto controlled by the Modal
// It cannot be present (even undefined) with `defaultOpen`
// only apply it if the user provided an open prop
var openProp = {};
if (has(this.props, 'open')) openProp.open = open;
return /*#__PURE__*/React__default.createElement(Modal$1, _extends$6({}, rest, openProp, {
size: size,
onClose: this.handleCancel
}), Modal$1.Header.create(header, {
autoGenerateKey: false
}), Modal$1.Content.create(content, {
autoGenerateKey: false
}), /*#__PURE__*/React__default.createElement(Modal$1.Actions, null, Button$2.create(cancelButton, {
autoGenerateKey: false,
overrideProps: this.handleCancelOverrides
}), Button$2.create(confirmButton, {
autoGenerateKey: false,
defaultProps: {
primary: true
},
overrideProps: this.handleConfirmOverrides
})));
};
return Confirm;
}(Component);
Confirm.handledProps = ["cancelButton", "confirmButton", "content", "header", "onCancel", "onConfirm", "open", "size"];
Confirm.propTypes = {};
Confirm.defaultProps = {
cancelButton: 'Cancel',
confirmButton: 'OK',
content: 'Are you sure?',
size: 'small'
};
var Confirm$1 = Confirm;/**
* A menu item may include a header or may itself be a header.
*/
function MenuHeader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('header', className);
var rest = getUnhandledProps$1(MenuHeader, props);
var ElementType = getElementType(MenuHeader, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
MenuHeader.handledProps = ["as", "children", "className", "content"];
MenuHeader.propTypes = {};/**
* The base implementation of `_.propertyOf` without support for deep paths.
*
* @private
* @param {Object} object The object to query.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyOf(object) {
return function(key) {
return object == null ? undefined : object[key];
};
}/** Used to map Latin Unicode letters to basic Latin letters. */
var deburredLetters = {
// Latin-1 Supplement block.
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
'\xc7': 'C', '\xe7': 'c',
'\xd0': 'D', '\xf0': 'd',
'\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
'\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
'\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
'\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
'\xd1': 'N', '\xf1': 'n',
'\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
'\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
'\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
'\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
'\xc6': 'Ae', '\xe6': 'ae',
'\xde': 'Th', '\xfe': 'th',
'\xdf': 'ss',
// Latin Extended-A block.
'\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
'\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
'\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
'\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
'\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
'\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
'\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
'\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
'\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
'\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
'\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
'\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
'\u0134': 'J', '\u0135': 'j',
'\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
'\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
'\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
'\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
'\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
'\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
'\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
'\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
'\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
'\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
'\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
'\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
'\u0163': 't', '\u0165': 't', '\u0167': 't',
'\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
'\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
'\u0174': 'W', '\u0175': 'w',
'\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
'\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
'\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
'\u0132': 'IJ', '\u0133': 'ij',
'\u0152': 'Oe', '\u0153': 'oe',
'\u0149': "'n", '\u017f': 's'
};
/**
* Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
* letters to basic Latin letters.
*
* @private
* @param {string} letter The matched letter to deburr.
* @returns {string} Returns the deburred letter.
*/
var deburrLetter = basePropertyOf(deburredLetters);
var deburrLetter$1 = deburrLetter;/** Used to match Latin Unicode letters (excluding mathematical operators). */
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
/** Used to compose unicode character classes. */
var rsComboMarksRange$2 = '\\u0300-\\u036f',
reComboHalfMarksRange$2 = '\\ufe20-\\ufe2f',
rsComboSymbolsRange$2 = '\\u20d0-\\u20ff',
rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2;
/** Used to compose unicode capture groups. */
var rsCombo$2 = '[' + rsComboRange$2 + ']';
/**
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
*/
var reComboMark = RegExp(rsCombo$2, 'g');
/**
* Deburrs `string` by converting
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
* letters to basic Latin letters and removing
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to deburr.
* @returns {string} Returns the deburred string.
* @example
*
* _.deburr('déjà vu');
* // => 'deja vu'
*/
function deburr(string) {
string = toString(string);
return string && string.replace(reLatin, deburrLetter$1).replace(reComboMark, '');
}/** Used to match words composed of alphanumeric characters. */
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
/**
* Splits an ASCII `string` into an array of its words.
*
* @private
* @param {string} The string to inspect.
* @returns {Array} Returns the words of `string`.
*/
function asciiWords(string) {
return string.match(reAsciiWord) || [];
}/** Used to detect strings that need a more robust regexp to match words. */
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
/**
* Checks if `string` contains a word composed of Unicode symbols.
*
* @private
* @param {string} string The string to inspect.
* @returns {boolean} Returns `true` if a word is found, else `false`.
*/
function hasUnicodeWord(string) {
return reHasUnicodeWord.test(string);
}/** Used to compose unicode character classes. */
var rsAstralRange$1 = '\\ud800-\\udfff',
rsComboMarksRange$1 = '\\u0300-\\u036f',
reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f',
rsComboSymbolsRange$1 = '\\u20d0-\\u20ff',
rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1,
rsDingbatRange = '\\u2700-\\u27bf',
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
rsPunctuationRange = '\\u2000-\\u206f',
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
rsVarRange$1 = '\\ufe0e\\ufe0f',
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
/** Used to compose unicode capture groups. */
var rsApos$1 = "['\u2019]",
rsBreak = '[' + rsBreakRange + ']',
rsCombo$1 = '[' + rsComboRange$1 + ']',
rsDigits = '\\d+',
rsDingbat = '[' + rsDingbatRange + ']',
rsLower = '[' + rsLowerRange + ']',
rsMisc = '[^' + rsAstralRange$1 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
rsFitz$1 = '\\ud83c[\\udffb-\\udfff]',
rsModifier$1 = '(?:' + rsCombo$1 + '|' + rsFitz$1 + ')',
rsNonAstral$1 = '[^' + rsAstralRange$1 + ']',
rsRegional$1 = '(?:\\ud83c[\\udde6-\\uddff]){2}',
rsSurrPair$1 = '[\\ud800-\\udbff][\\udc00-\\udfff]',
rsUpper = '[' + rsUpperRange + ']',
rsZWJ$1 = '\\u200d';
/** Used to compose unicode regexes. */
var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
rsOptContrLower = '(?:' + rsApos$1 + '(?:d|ll|m|re|s|t|ve))?',
rsOptContrUpper = '(?:' + rsApos$1 + '(?:D|LL|M|RE|S|T|VE))?',
reOptMod$1 = rsModifier$1 + '?',
rsOptVar$1 = '[' + rsVarRange$1 + ']?',
rsOptJoin$1 = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsOptVar$1 + reOptMod$1 + ')*',
rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1,
rsEmoji = '(?:' + [rsDingbat, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsSeq$1;
/** Used to match complex or compound words. */
var reUnicodeWord = RegExp([
rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
rsUpper + '+' + rsOptContrUpper,
rsOrdUpper,
rsOrdLower,
rsDigits,
rsEmoji
].join('|'), 'g');
/**
* Splits a Unicode `string` into an array of its words.
*
* @private
* @param {string} The string to inspect.
* @returns {Array} Returns the words of `string`.
*/
function unicodeWords(string) {
return string.match(reUnicodeWord) || [];
}/**
* Splits `string` into an array of its words.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to inspect.
* @param {RegExp|string} [pattern] The pattern to match words.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the words of `string`.
* @example
*
* _.words('fred, barney, & pebbles');
* // => ['fred', 'barney', 'pebbles']
*
* _.words('fred, barney, & pebbles', /[^, ]+/g);
* // => ['fred', 'barney', '&', 'pebbles']
*/
function words(string, pattern, guard) {
string = toString(string);
pattern = guard ? undefined : pattern;
if (pattern === undefined) {
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
}
return string.match(pattern) || [];
}/** Used to compose unicode capture groups. */
var rsApos = "['\u2019]";
/** Used to match apostrophes. */
var reApos = RegExp(rsApos, 'g');
/**
* Creates a function like `_.camelCase`.
*
* @private
* @param {Function} callback The function to combine each word.
* @returns {Function} Returns the new compounder function.
*/
function createCompounder(callback) {
return function(string) {
return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
};
}/**
* Creates a function like `_.lowerFirst`.
*
* @private
* @param {string} methodName The name of the `String` case method to use.
* @returns {Function} Returns the new case function.
*/
function createCaseFirst(methodName) {
return function(string) {
string = toString(string);
var strSymbols = hasUnicode(string)
? stringToArray(string)
: undefined;
var chr = strSymbols
? strSymbols[0]
: string.charAt(0);
var trailing = strSymbols
? castSlice(strSymbols, 1).join('')
: string.slice(1);
return chr[methodName]() + trailing;
};
}/**
* Converts the first character of `string` to upper case.
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.upperFirst('fred');
* // => 'Fred'
*
* _.upperFirst('FRED');
* // => 'FRED'
*/
var upperFirst = createCaseFirst('toUpperCase');
var upperFirst$1 = upperFirst;/**
* Converts `string` to
* [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
*
* @static
* @memberOf _
* @since 3.1.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the start cased string.
* @example
*
* _.startCase('--foo-bar--');
* // => 'Foo Bar'
*
* _.startCase('fooBar');
* // => 'Foo Bar'
*
* _.startCase('__FOO_BAR__');
* // => 'FOO BAR'
*/
var startCase = createCompounder(function(result, word, index) {
return result + (index ? ' ' : '') + upperFirst$1(word);
});
var _startCase = startCase;/**
* A menu can contain an item.
*/
var MenuItem = /*#__PURE__*/function (_Component) {
_inheritsLoose(MenuItem, _Component);
function MenuItem() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleClick = function (e) {
var disabled = _this.props.disabled;
if (!disabled) _invoke(_this.props, 'onClick', e, _this.props);
};
return _this;
}
var _proto = MenuItem.prototype;
_proto.render = function render() {
var _this$props = this.props,
active = _this$props.active,
children = _this$props.children,
className = _this$props.className,
color = _this$props.color,
content = _this$props.content,
disabled = _this$props.disabled,
fitted = _this$props.fitted,
header = _this$props.header,
icon = _this$props.icon,
link = _this$props.link,
name = _this$props.name,
onClick = _this$props.onClick,
position = _this$props.position;
var classes = cx(color, position, useKeyOnly(active, 'active'), useKeyOnly(disabled, 'disabled'), useKeyOnly(icon === true || icon && !(name || content), 'icon'), useKeyOnly(header, 'header'), useKeyOnly(link, 'link'), useKeyOrValueAndKey(fitted, 'fitted'), 'item', className);
var ElementType = getElementType(MenuItem, this.props, function () {
if (onClick) return 'a';
});
var rest = getUnhandledProps$1(MenuItem, this.props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
onClick: this.handleClick
}), children);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
onClick: this.handleClick
}), Icon$1.create(icon, {
autoGenerateKey: false
}), isNil$1(content) ? _startCase(name) : content);
};
return MenuItem;
}(Component);
MenuItem.handledProps = ["active", "as", "children", "className", "color", "content", "disabled", "fitted", "header", "icon", "index", "link", "name", "onClick", "position"];
MenuItem.propTypes = {};
MenuItem.create = createShorthandFactory(MenuItem, function (val) {
return {
content: val,
name: val
};
});/**
* A menu can contain a sub menu.
*/
function MenuMenu(props) {
var children = props.children,
className = props.className,
content = props.content,
position = props.position;
var classes = cx(position, 'menu', className);
var rest = getUnhandledProps$1(MenuMenu, props);
var ElementType = getElementType(MenuMenu, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
MenuMenu.handledProps = ["as", "children", "className", "content", "position"];
MenuMenu.propTypes = {};/**
* A menu displays grouped navigation actions.
* @see Dropdown
*/
var Menu = /*#__PURE__*/function (_Component) {
_inheritsLoose(Menu, _Component);
function Menu() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleItemOverrides = function (predefinedProps) {
return {
onClick: function onClick(e, itemProps) {
var index = itemProps.index;
_this.setState({
activeIndex: index
});
_invoke(predefinedProps, 'onClick', e, itemProps);
_invoke(_this.props, 'onItemClick', e, itemProps);
}
};
};
return _this;
}
var _proto = Menu.prototype;
_proto.renderItems = function renderItems() {
var _this2 = this;
var items = this.props.items;
var activeIndex = this.state.activeIndex;
return map(items, function (item, index) {
return MenuItem.create(item, {
defaultProps: {
active: parseInt(activeIndex, 10) === index,
index: index
},
overrideProps: _this2.handleItemOverrides
});
});
};
_proto.render = function render() {
var _this$props = this.props,
attached = _this$props.attached,
borderless = _this$props.borderless,
children = _this$props.children,
className = _this$props.className,
color = _this$props.color,
compact = _this$props.compact,
fixed = _this$props.fixed,
floated = _this$props.floated,
fluid = _this$props.fluid,
icon = _this$props.icon,
inverted = _this$props.inverted,
pagination = _this$props.pagination,
pointing = _this$props.pointing,
secondary = _this$props.secondary,
size = _this$props.size,
stackable = _this$props.stackable,
tabular = _this$props.tabular,
text = _this$props.text,
vertical = _this$props.vertical,
widths = _this$props.widths;
var classes = cx('ui', color, size, useKeyOnly(borderless, 'borderless'), useKeyOnly(compact, 'compact'), useKeyOnly(fluid, 'fluid'), useKeyOnly(inverted, 'inverted'), useKeyOnly(pagination, 'pagination'), useKeyOnly(pointing, 'pointing'), useKeyOnly(secondary, 'secondary'), useKeyOnly(stackable, 'stackable'), useKeyOnly(text, 'text'), useKeyOnly(vertical, 'vertical'), useKeyOrValueAndKey(attached, 'attached'), useKeyOrValueAndKey(floated, 'floated'), useKeyOrValueAndKey(icon, 'icon'), useKeyOrValueAndKey(tabular, 'tabular'), useValueAndKey(fixed, 'fixed'), useWidthProp(widths, 'item'), className, 'menu');
var rest = getUnhandledProps$1(Menu, this.props);
var ElementType = getElementType(Menu, this.props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? this.renderItems() : children);
};
return Menu;
}(ModernAutoControlledComponent);
Menu.handledProps = ["activeIndex", "as", "attached", "borderless", "children", "className", "color", "compact", "defaultActiveIndex", "fixed", "floated", "fluid", "icon", "inverted", "items", "onItemClick", "pagination", "pointing", "secondary", "size", "stackable", "tabular", "text", "vertical", "widths"];
Menu.propTypes = {};
Menu.autoControlledProps = ['activeIndex'];
Menu.Header = MenuHeader;
Menu.Item = MenuItem;
Menu.Menu = MenuMenu;
Menu.create = createShorthandFactory(Menu, function (items) {
return {
items: items
};
});
var Menu$1 = Menu;/**
* An item of a pagination.
*/
var PaginationItem = /*#__PURE__*/function (_Component) {
_inheritsLoose(PaginationItem, _Component);
function PaginationItem() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleClick = function (e) {
_invoke(_this.props, 'onClick', e, _this.props);
};
_this.handleKeyDown = function (e) {
_invoke(_this.props, 'onKeyDown', e, _this.props);
if (keyboardKey_1.getCode(e) === keyboardKey_1.Enter) _invoke(_this.props, 'onClick', e, _this.props);
};
_this.handleOverrides = function () {
return {
onClick: _this.handleClick,
onKeyDown: _this.handleKeyDown
};
};
return _this;
}
var _proto = PaginationItem.prototype;
_proto.render = function render() {
var _this$props = this.props,
active = _this$props.active,
type = _this$props.type;
var disabled = this.props.disabled || type === 'ellipsisItem';
return MenuItem.create(this.props, {
defaultProps: {
active: active,
'aria-current': active,
'aria-disabled': disabled,
disabled: disabled,
onClick: this.handleClick,
onKeyDown: this.handleKeyDown,
tabIndex: disabled ? -1 : 0
},
overrideProps: this.handleOverrides
});
};
return PaginationItem;
}(Component);
PaginationItem.handledProps = ["active", "disabled", "onClick", "onKeyDown", "type"];
PaginationItem.propTypes = {};
PaginationItem.create = createShorthandFactory(PaginationItem, function (content) {
return {
content: content
};
});
var PaginationItem$1 = PaginationItem;/**
* A component to render a pagination.
*/
var Pagination = /*#__PURE__*/function (_Component) {
_inheritsLoose(Pagination, _Component);
function Pagination() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleItemClick = function (e, _ref) {
var nextActivePage = _ref.value;
var prevActivePage = _this.state.activePage; // Heads up! We need the cast to the "number" type there, as `activePage` can be a string
if (+prevActivePage === +nextActivePage) return;
_this.setState({
activePage: nextActivePage
});
_invoke(_this.props, 'onPageChange', e, _extends$6({}, _this.props, {
activePage: nextActivePage
}));
};
_this.handleItemOverrides = function (active, type, value) {
return function (predefinedProps) {
return {
active: active,
type: type,
key: type + "-" + value,
onClick: function onClick(e, itemProps) {
_invoke(predefinedProps, 'onClick', e, itemProps);
if (itemProps.type !== 'ellipsisItem') _this.handleItemClick(e, itemProps);
}
};
};
};
return _this;
}
var _proto = Pagination.prototype;
_proto.getInitialAutoControlledState = function getInitialAutoControlledState() {
return {
activePage: 1
};
};
_proto.render = function render() {
var _this2 = this;
var _this$props = this.props,
ariaLabel = _this$props['aria-label'],
boundaryRange = _this$props.boundaryRange,
disabled = _this$props.disabled,
ellipsisItem = _this$props.ellipsisItem,
siblingRange = _this$props.siblingRange,
totalPages = _this$props.totalPages;
var activePage = this.state.activePage;
var items = createPaginationItems$1({
activePage: activePage,
boundaryRange: boundaryRange,
hideEllipsis: isNil(ellipsisItem),
siblingRange: siblingRange,
totalPages: totalPages
});
var rest = getUnhandledProps$1(Pagination, this.props);
return /*#__PURE__*/React__default.createElement(Menu$1, _extends$6({}, rest, {
"aria-label": ariaLabel,
pagination: true,
role: "navigation"
}), map(items, function (_ref2) {
var active = _ref2.active,
type = _ref2.type,
value = _ref2.value;
return PaginationItem$1.create(_this2.props[type], {
defaultProps: {
content: value,
disabled: disabled,
value: value
},
overrideProps: _this2.handleItemOverrides(active, type, value)
});
}));
};
return Pagination;
}(ModernAutoControlledComponent);
Pagination.handledProps = ["activePage", "aria-label", "boundaryRange", "defaultActivePage", "disabled", "ellipsisItem", "firstItem", "lastItem", "nextItem", "onPageChange", "pageItem", "prevItem", "siblingRange", "totalPages"];
Pagination.propTypes = {};
Pagination.autoControlledProps = ['activePage'];
Pagination.defaultProps = {
'aria-label': 'Pagination Navigation',
boundaryRange: 1,
ellipsisItem: '...',
firstItem: {
'aria-label': 'First item',
content: '«'
},
lastItem: {
'aria-label': 'Last item',
content: '»'
},
nextItem: {
'aria-label': 'Next item',
content: '⟩'
},
pageItem: {},
prevItem: {
'aria-label': 'Previous item',
content: '⟨'
},
siblingRange: 1
};
Pagination.Item = PaginationItem$1;/**
* Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
* it's created. Arrays are created for missing index properties while objects
* are created for all other missing properties. Use `_.setWith` to customize
* `path` creation.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
* @param {*} value The value to set.
* @returns {Object} Returns `object`.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.set(object, 'a[0].b.c', 4);
* console.log(object.a[0].b.c);
* // => 4
*
* _.set(object, ['x', '0', 'y', 'z'], 5);
* console.log(object.x[0].y.z);
* // => 5
*/
function set(object, path, value) {
return object == null ? object : baseSet(object, path, value);
}/**
* A checkbox allows a user to select a value from a small set of options, often binary.
* @see Form
* @see Radio
*/
var Checkbox = /*#__PURE__*/function (_Component) {
_inheritsLoose(Checkbox, _Component);
function Checkbox() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.inputRef = /*#__PURE__*/createRef();
_this.labelRef = /*#__PURE__*/createRef();
_this.canToggle = function () {
var _this$props = _this.props,
disabled = _this$props.disabled,
radio = _this$props.radio,
readOnly = _this$props.readOnly;
var checked = _this.state.checked;
return !disabled && !readOnly && !(radio && checked);
};
_this.computeTabIndex = function () {
var _this$props2 = _this.props,
disabled = _this$props2.disabled,
tabIndex = _this$props2.tabIndex;
if (!isNil(tabIndex)) return tabIndex;
return disabled ? -1 : 0;
};
_this.handleClick = function (e) {
var id = _this.props.id;
var _this$state = _this.state,
checked = _this$state.checked,
indeterminate = _this$state.indeterminate;
var isInputClick = _invoke(_this.inputRef.current, 'contains', e.target);
var isLabelClick = _invoke(_this.labelRef.current, 'contains', e.target);
var isRootClick = !isLabelClick && !isInputClick;
var hasId = !isNil(id);
var isLabelClickAndForwardedToInput = isLabelClick && hasId; // https://github.com/Semantic-Org/Semantic-UI-React/pull/3351
if (!isLabelClickAndForwardedToInput) {
_invoke(_this.props, 'onClick', e, _extends$6({}, _this.props, {
checked: !checked,
indeterminate: !!indeterminate
}));
}
if (_this.isClickFromMouse) {
_this.isClickFromMouse = false;
if (isLabelClick && !hasId) {
_this.handleChange(e);
} // Changes should be triggered for the slider variation
if (isRootClick) {
_this.handleChange(e);
}
if (isLabelClick && hasId) {
// To prevent two clicks from being fired from the component we have to stop the propagation
// from the "input" click: https://github.com/Semantic-Org/Semantic-UI-React/issues/3433
e.stopPropagation();
}
}
};
_this.handleChange = function (e) {
var checked = _this.state.checked;
if (!_this.canToggle()) return;
_invoke(_this.props, 'onChange', e, _extends$6({}, _this.props, {
checked: !checked,
indeterminate: false
}));
_this.setState({
checked: !checked,
indeterminate: false
});
};
_this.handleMouseDown = function (e) {
var _this$state2 = _this.state,
checked = _this$state2.checked,
indeterminate = _this$state2.indeterminate;
_invoke(_this.props, 'onMouseDown', e, _extends$6({}, _this.props, {
checked: !!checked,
indeterminate: !!indeterminate
}));
if (!e.defaultPrevented) {
_invoke(_this.inputRef.current, 'focus');
} // Heads up!
// We need to call "preventDefault" to keep element focused.
e.preventDefault();
};
_this.handleMouseUp = function (e) {
var _this$state3 = _this.state,
checked = _this$state3.checked,
indeterminate = _this$state3.indeterminate;
_this.isClickFromMouse = true;
_invoke(_this.props, 'onMouseUp', e, _extends$6({}, _this.props, {
checked: !!checked,
indeterminate: !!indeterminate
}));
};
_this.setIndeterminate = function () {
var indeterminate = _this.state.indeterminate;
set(_this.inputRef, 'current.indeterminate', !!indeterminate);
};
return _this;
}
var _proto = Checkbox.prototype;
_proto.componentDidMount = function componentDidMount() {
this.setIndeterminate();
};
_proto.componentDidUpdate = function componentDidUpdate() {
this.setIndeterminate();
};
_proto.render = function render() {
var _this$props3 = this.props,
className = _this$props3.className,
disabled = _this$props3.disabled,
label = _this$props3.label,
id = _this$props3.id,
name = _this$props3.name,
radio = _this$props3.radio,
readOnly = _this$props3.readOnly,
slider = _this$props3.slider,
toggle = _this$props3.toggle,
type = _this$props3.type,
value = _this$props3.value;
var _this$state4 = this.state,
checked = _this$state4.checked,
indeterminate = _this$state4.indeterminate;
var classes = cx('ui', useKeyOnly(checked, 'checked'), useKeyOnly(disabled, 'disabled'), useKeyOnly(indeterminate, 'indeterminate'), // auto apply fitted class to compact white space when there is no label
// https://semantic-ui.com/modules/checkbox.html#fitted
useKeyOnly(isNil(label), 'fitted'), useKeyOnly(radio, 'radio'), useKeyOnly(readOnly, 'read-only'), useKeyOnly(slider, 'slider'), useKeyOnly(toggle, 'toggle'), 'checkbox', className);
var unhandled = getUnhandledProps$1(Checkbox, this.props);
var ElementType = getElementType(Checkbox, this.props);
var _partitionHTMLProps = partitionHTMLProps(unhandled, {
htmlProps: htmlInputAttrs
}),
htmlInputProps = _partitionHTMLProps[0],
rest = _partitionHTMLProps[1]; // Heads Up!
// Do not remove empty labels, they are required by SUI CSS
var labelElement = createHTMLLabel(label, {
defaultProps: {
htmlFor: id
},
autoGenerateKey: false
}) || /*#__PURE__*/React__default.createElement("label", {
htmlFor: id
});
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
onClick: this.handleClick,
onChange: this.handleChange,
onMouseDown: this.handleMouseDown,
onMouseUp: this.handleMouseUp
}), /*#__PURE__*/React__default.createElement(Ref, {
innerRef: this.inputRef
}, /*#__PURE__*/React__default.createElement("input", _extends$6({}, htmlInputProps, {
checked: checked,
className: "hidden",
disabled: disabled,
id: id,
name: name,
readOnly: true,
tabIndex: this.computeTabIndex(),
type: type,
value: value
}))), /*#__PURE__*/React__default.createElement(Ref, {
innerRef: this.labelRef
}, labelElement));
};
return Checkbox;
}(ModernAutoControlledComponent);
Checkbox.handledProps = ["as", "checked", "className", "defaultChecked", "defaultIndeterminate", "disabled", "fitted", "id", "indeterminate", "label", "name", "onChange", "onClick", "onMouseDown", "onMouseUp", "radio", "readOnly", "slider", "tabIndex", "toggle", "type", "value"];
Checkbox.propTypes = {};
Checkbox.defaultProps = {
type: 'checkbox'
};
Checkbox.autoControlledProps = ['checked', 'indeterminate'];/**
* A Radio is sugar for <Checkbox radio />.
* Useful for exclusive groups of sliders or toggles.
* @see Checkbox
* @see Form
*/
function Radio(props) {
var slider = props.slider,
toggle = props.toggle,
type = props.type;
var rest = getUnhandledProps$1(Radio, props); // const ElementType = getElementType(Radio, props)
// radio, slider, toggle are exclusive
// use an undefined radio if slider or toggle are present
var radio = !(slider || toggle) || undefined;
return /*#__PURE__*/React__default.createElement(Checkbox, _extends$6({}, rest, {
type: type,
radio: radio,
slider: slider,
toggle: toggle
}));
}
Radio.handledProps = ["slider", "toggle", "type"];
Radio.propTypes = {};
Radio.defaultProps = {
type: 'radio'
};/**
* Creates an array with all falsey values removed. The values `false`, `null`,
* `0`, `""`, `undefined`, and `NaN` are falsey.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to compact.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* _.compact([0, 1, false, 2, '', 3]);
* // => [1, 2, 3]
*/
function compact(array) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (value) {
result[resIndex++] = value;
}
}
return result;
}/**
* A specialized version of `_.every` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if all elements pass the predicate check,
* else `false`.
*/
function arrayEvery(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (!predicate(array[index], index, array)) {
return false;
}
}
return true;
}/**
* The base implementation of `_.every` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if all elements pass the predicate check,
* else `false`
*/
function baseEvery(collection, predicate) {
var result = true;
baseEach$1(collection, function(value, index, collection) {
result = !!predicate(value, index, collection);
return result;
});
return result;
}/**
* Checks if `predicate` returns truthy for **all** elements of `collection`.
* Iteration is stopped once `predicate` returns falsey. The predicate is
* invoked with three arguments: (value, index|key, collection).
*
* **Note:** This method returns `true` for
* [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
* [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
* elements of empty collections.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {boolean} Returns `true` if all elements pass the predicate check,
* else `false`.
* @example
*
* _.every([true, 1, null, 'yes'], Boolean);
* // => false
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': false },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* // The `_.matches` iteratee shorthand.
* _.every(users, { 'user': 'barney', 'active': false });
* // => false
*
* // The `_.matchesProperty` iteratee shorthand.
* _.every(users, ['active', false]);
* // => true
*
* // The `_.property` iteratee shorthand.
* _.every(users, 'active');
* // => false
*/
function every(collection, predicate, guard) {
var func = isArray$1(collection) ? arrayEvery : baseEvery;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined;
}
return func(collection, baseIteratee(predicate));
}/**
* Creates a slice of `array` with `n` elements dropped from the end.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to drop.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.dropRight([1, 2, 3]);
* // => [1, 2]
*
* _.dropRight([1, 2, 3], 2);
* // => [1]
*
* _.dropRight([1, 2, 3], 5);
* // => []
*
* _.dropRight([1, 2, 3], 0);
* // => [1, 2, 3]
*/
function dropRight(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = (guard || n === undefined) ? 1 : toInteger(n);
n = length - n;
return baseSlice(array, 0, n < 0 ? 0 : n);
}/**
* Gets the size of an ASCII `string`.
*
* @private
* @param {string} string The string inspect.
* @returns {number} Returns the string size.
*/
var asciiSize = baseProperty('length');
var asciiSize$1 = asciiSize;/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff',
rsComboMarksRange = '\\u0300-\\u036f',
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
rsComboSymbolsRange = '\\u20d0-\\u20ff',
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
rsVarRange = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */
var rsAstral = '[' + rsAstralRange + ']',
rsCombo = '[' + rsComboRange + ']',
rsFitz = '\\ud83c[\\udffb-\\udfff]',
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
rsNonAstral = '[^' + rsAstralRange + ']',
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
rsZWJ = '\\u200d';
/** Used to compose unicode regexes. */
var reOptMod = rsModifier + '?',
rsOptVar = '[' + rsVarRange + ']?',
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
rsSeq = rsOptVar + reOptMod + rsOptJoin,
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
/**
* Gets the size of a Unicode `string`.
*
* @private
* @param {string} string The string inspect.
* @returns {number} Returns the string size.
*/
function unicodeSize(string) {
var result = reUnicode.lastIndex = 0;
while (reUnicode.test(string)) {
++result;
}
return result;
}/**
* Gets the number of symbols in `string`.
*
* @private
* @param {string} string The string to inspect.
* @returns {number} Returns the string size.
*/
function stringSize(string) {
return hasUnicode(string)
? unicodeSize(string)
: asciiSize$1(string);
}/** `Object#toString` result references. */
var mapTag = '[object Map]',
setTag = '[object Set]';
/**
* Gets the size of `collection` by returning its length for array-like
* values or the number of own enumerable string keyed properties for objects.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object|string} collection The collection to inspect.
* @returns {number} Returns the collection size.
* @example
*
* _.size([1, 2, 3]);
* // => 3
*
* _.size({ 'a': 1, 'b': 2 });
* // => 2
*
* _.size('pebbles');
* // => 7
*/
function size(collection) {
if (collection == null) {
return 0;
}
if (isArrayLike(collection)) {
return isString(collection) ? stringSize(collection) : collection.length;
}
var tag = getTag$1(collection);
if (tag == mapTag || tag == setTag) {
return collection.size;
}
return baseKeys(collection).length;
}/**
* Creates an array of unique values, in order, from all given arrays using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of combined values.
* @example
*
* _.union([2], [1, 2]);
* // => [2, 1]
*/
var union = baseRest(function(arrays) {
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
var _union = union;/**
* A flag is is used to represent a political state.
*/
var Flag = /*#__PURE__*/function (_PureComponent) {
_inheritsLoose(Flag, _PureComponent);
function Flag() {
return _PureComponent.apply(this, arguments) || this;
}
var _proto = Flag.prototype;
_proto.render = function render() {
var _this$props = this.props,
className = _this$props.className,
name = _this$props.name;
var classes = cx(name, 'flag', className);
var rest = getUnhandledProps$1(Flag, this.props);
var ElementType = getElementType(Flag, this.props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}));
};
return Flag;
}(PureComponent);
Flag.handledProps = ["as", "className", "name"];
Flag.propTypes = {};
Flag.defaultProps = {
as: 'i'
};
Flag.create = createShorthandFactory(Flag, function (value) {
return {
name: value
};
});
var Flag$1 = Flag;/**
* A dropdown menu can contain dividers to separate related content.
*/
function DropdownDivider(props) {
var className = props.className;
var classes = cx('divider', className);
var rest = getUnhandledProps$1(DropdownDivider, props);
var ElementType = getElementType(DropdownDivider, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}));
}
DropdownDivider.handledProps = ["as", "className"];
DropdownDivider.propTypes = {};/**
* An item sub-component for Dropdown component.
*/
var DropdownItem = /*#__PURE__*/function (_Component) {
_inheritsLoose(DropdownItem, _Component);
function DropdownItem() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleClick = function (e) {
_invoke(_this.props, 'onClick', e, _this.props);
};
return _this;
}
var _proto = DropdownItem.prototype;
_proto.render = function render() {
var _this$props = this.props,
active = _this$props.active,
children = _this$props.children,
className = _this$props.className,
content = _this$props.content,
disabled = _this$props.disabled,
description = _this$props.description,
flag = _this$props.flag,
icon = _this$props.icon,
image = _this$props.image,
label = _this$props.label,
selected = _this$props.selected,
text = _this$props.text;
var classes = cx(useKeyOnly(active, 'active'), useKeyOnly(disabled, 'disabled'), useKeyOnly(selected, 'selected'), 'item', className); // add default dropdown icon if item contains another menu
var iconName = isNil(icon) ? someByType(children, 'DropdownMenu') && 'dropdown' : icon;
var rest = getUnhandledProps$1(DropdownItem, this.props);
var ElementType = getElementType(DropdownItem, this.props);
var ariaOptions = {
role: 'option',
'aria-disabled': disabled,
'aria-checked': active,
'aria-selected': selected
};
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, ariaOptions, {
className: classes,
onClick: this.handleClick
}), children);
}
var flagElement = Flag$1.create(flag, {
autoGenerateKey: false
});
var iconElement = Icon$1.create(iconName, {
autoGenerateKey: false
});
var imageElement = Image.create(image, {
autoGenerateKey: false
});
var labelElement = Label.create(label, {
autoGenerateKey: false
});
var descriptionElement = createShorthand('span', function (val) {
return {
children: val
};
}, description, {
defaultProps: {
className: 'description'
},
autoGenerateKey: false
});
var textElement = createShorthand('span', function (val) {
return {
children: val
};
}, isNil$1(content) ? text : content, {
defaultProps: {
className: 'text'
},
autoGenerateKey: false
});
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, ariaOptions, {
className: classes,
onClick: this.handleClick
}), imageElement, iconElement, flagElement, labelElement, descriptionElement, textElement);
};
return DropdownItem;
}(Component);
DropdownItem.handledProps = ["active", "as", "children", "className", "content", "description", "disabled", "flag", "icon", "image", "label", "onClick", "selected", "text", "value"];
DropdownItem.propTypes = {};
DropdownItem.create = createShorthandFactory(DropdownItem, function (opts) {
return opts;
});
var DropdownItem$1 = DropdownItem;/**
* A dropdown menu can contain a header.
*/
function DropdownHeader(props) {
var children = props.children,
className = props.className,
content = props.content,
icon = props.icon;
var classes = cx('header', className);
var rest = getUnhandledProps$1(DropdownHeader, props);
var ElementType = getElementType(DropdownHeader, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), Icon$1.create(icon, {
autoGenerateKey: false
}), content);
}
DropdownHeader.handledProps = ["as", "children", "className", "content", "icon"];
DropdownHeader.propTypes = {};
DropdownHeader.create = createShorthandFactory(DropdownHeader, function (content) {
return {
content: content
};
});/**
* A dropdown menu can contain a menu.
*/
function DropdownMenu(props) {
var children = props.children,
className = props.className,
content = props.content,
direction = props.direction,
open = props.open,
scrolling = props.scrolling;
var classes = cx(direction, useKeyOnly(open, 'visible'), useKeyOnly(scrolling, 'scrolling'), 'menu transition', className);
var rest = getUnhandledProps$1(DropdownMenu, props);
var ElementType = getElementType(DropdownMenu, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
DropdownMenu.handledProps = ["as", "children", "className", "content", "direction", "open", "scrolling"];
DropdownMenu.propTypes = {};/**
* A search item sub-component for Dropdown component.
*/
var DropdownSearchInput = /*#__PURE__*/function (_Component) {
_inheritsLoose(DropdownSearchInput, _Component);
function DropdownSearchInput() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleChange = function (e) {
var value = get(e, 'target.value');
_invoke(_this.props, 'onChange', e, _extends$6({}, _this.props, {
value: value
}));
};
return _this;
}
var _proto = DropdownSearchInput.prototype;
_proto.render = function render() {
var _this$props = this.props,
autoComplete = _this$props.autoComplete,
className = _this$props.className,
tabIndex = _this$props.tabIndex,
type = _this$props.type,
value = _this$props.value;
var classes = cx('search', className);
var rest = getUnhandledProps$1(DropdownSearchInput, this.props);
return /*#__PURE__*/React__default.createElement("input", _extends$6({}, rest, {
"aria-autocomplete": "list",
autoComplete: autoComplete,
className: classes,
onChange: this.handleChange,
tabIndex: tabIndex,
type: type,
value: value
}));
};
return DropdownSearchInput;
}(Component);
DropdownSearchInput.handledProps = ["as", "autoComplete", "className", "tabIndex", "type", "value"];
DropdownSearchInput.propTypes = {};
DropdownSearchInput.defaultProps = {
autoComplete: 'off',
type: 'text'
};
DropdownSearchInput.create = createShorthandFactory(DropdownSearchInput, function (type) {
return {
type: type
};
});
var DropdownSearchInput$1 = DropdownSearchInput;/**
* A dropdown contains a selected value.
*/
function DropdownText(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('divider', className);
var rest = getUnhandledProps$1(DropdownText, props);
var ElementType = getElementType(DropdownText, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({
"aria-atomic": true,
"aria-live": "polite",
role: "alert"
}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
DropdownText.handledProps = ["as", "children", "className", "content"];
DropdownText.propTypes = {};
DropdownText.create = createShorthandFactory(DropdownText, function (val) {
return {
content: val
};
});/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
reHasRegExpChar = RegExp(reRegExpChar.source);
/**
* Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
* "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to escape.
* @returns {string} Returns the escaped string.
* @example
*
* _.escapeRegExp('[lodash](https://lodash.com/)');
* // => '\[lodash\]\(https://lodash\.com/\)'
*/
function escapeRegExp(string) {
string = toString(string);
return (string && reHasRegExpChar.test(string))
? string.replace(reRegExpChar, '\\$&')
: string;
}// that hasn't yet been persisted to state.
function getMenuOptions(config) {
var additionLabel = config.additionLabel,
additionPosition = config.additionPosition,
allowAdditions = config.allowAdditions,
deburr$1 = config.deburr,
multiple = config.multiple,
options = config.options,
search = config.search,
searchQuery = config.searchQuery,
value = config.value;
var filteredOptions = options; // filter out active options
if (multiple) {
filteredOptions = filter(filteredOptions, function (opt) {
return !includes(value, opt.value);
});
} // filter by search query
if (search && searchQuery) {
if (isFunction(search)) {
filteredOptions = search(filteredOptions, searchQuery);
} else {
// remove diacritics on search input and options, if deburr prop is set
var strippedQuery = deburr$1 ? deburr(searchQuery) : searchQuery;
var re = new RegExp(escapeRegExp(strippedQuery), 'i');
filteredOptions = filter(filteredOptions, function (opt) {
return re.test(deburr$1 ? deburr(opt.text) : opt.text);
});
}
} // insert the "add" item
if (allowAdditions && search && searchQuery && !some(filteredOptions, {
text: searchQuery
})) {
var additionLabelElement = /*#__PURE__*/React__default.isValidElement(additionLabel) ? /*#__PURE__*/React__default.cloneElement(additionLabel, {
key: 'addition-label'
}) : additionLabel || '';
var addItem = {
key: 'addition',
// by using an array, we can pass multiple elements, but when doing so
// we must specify a `key` for React to know which one is which
text: [additionLabelElement, /*#__PURE__*/React__default.createElement("b", {
key: "addition-query"
}, searchQuery)],
value: searchQuery,
className: 'addition',
'data-additional': true
};
if (additionPosition === 'top') filteredOptions.unshift(addItem);else filteredOptions.push(addItem);
}
return filteredOptions;
}
getMenuOptions.handledProps = [];function getSelectedIndex(config) {
var additionLabel = config.additionLabel,
additionPosition = config.additionPosition,
allowAdditions = config.allowAdditions,
deburr = config.deburr,
multiple = config.multiple,
options = config.options,
search = config.search,
searchQuery = config.searchQuery,
selectedIndex = config.selectedIndex,
value = config.value;
var menuOptions = getMenuOptions({
value: value,
options: options,
searchQuery: searchQuery,
additionLabel: additionLabel,
additionPosition: additionPosition,
allowAdditions: allowAdditions,
deburr: deburr,
multiple: multiple,
search: search
});
var enabledIndexes = reduce(menuOptions, function (memo, item, index) {
if (!item.disabled) memo.push(index);
return memo;
}, []);
var newSelectedIndex; // update the selected index
if (!selectedIndex || selectedIndex < 0) {
var firstIndex = enabledIndexes[0]; // Select the currently active item, if none, use the first item.
// Multiple selects remove active items from the list,
// their initial selected index should be 0.
newSelectedIndex = multiple ? firstIndex : findIndex(menuOptions, ['value', value]) || enabledIndexes[0];
} else if (multiple) {
newSelectedIndex = _find(enabledIndexes, function (index) {
return index >= selectedIndex;
}); // multiple selects remove options from the menu as they are made active
// keep the selected index within range of the remaining items
if (selectedIndex >= menuOptions.length - 1) {
newSelectedIndex = enabledIndexes[enabledIndexes.length - 1];
}
} else {
var activeIndex = findIndex(menuOptions, ['value', value]); // regular selects can only have one active item
// set the selected index to the currently active item
newSelectedIndex = includes(enabledIndexes, activeIndex) ? activeIndex : undefined;
}
if (!newSelectedIndex || newSelectedIndex < 0) {
newSelectedIndex = enabledIndexes[0];
}
return newSelectedIndex;
}var getKeyOrValue = function getKeyOrValue(key, value) {
return isNil(key) ? value : key;
};
var getKeyAndValues = function getKeyAndValues(options) {
return options ? options.map(function (option) {
return _pick(option, ['key', 'value']);
}) : options;
};
function renderItemContent(item) {
var flag = item.flag,
image = item.image,
text = item.text; // TODO: remove this in v3
// This maintains compatibility with Shorthand API in v1 as this might be called in "Label.create()"
if (isFunction(text)) {
return text;
}
return {
content: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, Flag$1.create(flag), Image.create(image), text)
};
}
/**
* A dropdown allows a user to select a value from a series of options.
* @see Form
* @see Select
* @see Menu
*/
var Dropdown = /*#__PURE__*/function (_Component) {
_inheritsLoose(Dropdown, _Component);
function Dropdown() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.searchRef = /*#__PURE__*/createRef();
_this.sizerRef = /*#__PURE__*/createRef();
_this.ref = /*#__PURE__*/createRef();
_this.handleChange = function (e, value) {
_invoke(_this.props, 'onChange', e, _extends$6({}, _this.props, {
value: value
}));
};
_this.closeOnChange = function (e) {
var _this$props = _this.props,
closeOnChange = _this$props.closeOnChange,
multiple = _this$props.multiple;
var shouldClose = isUndefined(closeOnChange) ? !multiple : closeOnChange;
if (shouldClose) {
_this.close(e, noop);
}
};
_this.closeOnEscape = function (e) {
if (!_this.props.closeOnEscape) return;
if (keyboardKey_1.getCode(e) !== keyboardKey_1.Escape) return;
e.preventDefault();
_this.close(e);
};
_this.moveSelectionOnKeyDown = function (e) {
var _moves;
var _this$props2 = _this.props,
multiple = _this$props2.multiple,
selectOnNavigation = _this$props2.selectOnNavigation;
var open = _this.state.open;
if (!open) {
return;
}
var moves = (_moves = {}, _moves[keyboardKey_1.ArrowDown] = 1, _moves[keyboardKey_1.ArrowUp] = -1, _moves);
var move = moves[keyboardKey_1.getCode(e)];
if (move === undefined) {
return;
}
e.preventDefault();
var nextIndex = _this.getSelectedIndexAfterMove(move);
if (!multiple && selectOnNavigation) {
_this.makeSelectedItemActive(e, nextIndex);
}
_this.setState({
selectedIndex: nextIndex
});
};
_this.openOnSpace = function (e) {
var _e$target, _e$target2, _e$target3;
var shouldHandleEvent = _this.state.focus && !_this.state.open && keyboardKey_1.getCode(e) === keyboardKey_1.Spacebar;
var shouldPreventDefault = ((_e$target = e.target) == null ? void 0 : _e$target.tagName) !== 'INPUT' && ((_e$target2 = e.target) == null ? void 0 : _e$target2.tagName) !== 'TEXTAREA' && ((_e$target3 = e.target) == null ? void 0 : _e$target3.isContentEditable) !== true;
if (shouldHandleEvent) {
if (shouldPreventDefault) {
e.preventDefault();
}
_this.open(e);
}
};
_this.openOnArrow = function (e) {
var _this$state = _this.state,
focus = _this$state.focus,
open = _this$state.open;
if (focus && !open) {
var code = keyboardKey_1.getCode(e);
if (code === keyboardKey_1.ArrowDown || code === keyboardKey_1.ArrowUp) {
e.preventDefault();
_this.open(e);
}
}
};
_this.makeSelectedItemActive = function (e, selectedIndex) {
var _this$state2 = _this.state,
open = _this$state2.open,
value = _this$state2.value;
var multiple = _this.props.multiple;
var item = _this.getSelectedItem(selectedIndex);
var selectedValue = get(item, 'value'); // prevent selecting null if there was no selected item value
// prevent selecting duplicate items when the dropdown is closed
if (isNil(selectedValue) || !open) {
return value;
} // state value may be undefined
var newValue = multiple ? _union(value, [selectedValue]) : selectedValue;
var valueHasChanged = multiple ? !!_difference(newValue, value).length : newValue !== value;
if (valueHasChanged) {
// notify the onChange prop that the user is trying to change value
_this.setState({
value: newValue
});
_this.handleChange(e, newValue); // Heads up! This event handler should be called after `onChange`
// Notify the onAddItem prop if this is a new value
if (item['data-additional']) {
_invoke(_this.props, 'onAddItem', e, _extends$6({}, _this.props, {
value: selectedValue
}));
}
}
return value;
};
_this.selectItemOnEnter = function (e) {
var search = _this.props.search;
var _this$state3 = _this.state,
open = _this$state3.open,
selectedIndex = _this$state3.selectedIndex;
if (!open) {
return;
}
var shouldSelect = keyboardKey_1.getCode(e) === keyboardKey_1.Enter || // https://github.com/Semantic-Org/Semantic-UI-React/pull/3766
!search && keyboardKey_1.getCode(e) === keyboardKey_1.Spacebar;
if (!shouldSelect) {
return;
}
e.preventDefault();
var optionSize = size(getMenuOptions({
value: _this.state.value,
options: _this.props.options,
searchQuery: _this.state.searchQuery,
additionLabel: _this.props.additionLabel,
additionPosition: _this.props.additionPosition,
allowAdditions: _this.props.allowAdditions,
deburr: _this.props.deburr,
multiple: _this.props.multiple,
search: _this.props.search
}));
if (search && optionSize === 0) {
return;
}
var nextValue = _this.makeSelectedItemActive(e, selectedIndex); // This is required as selected value may be the same
_this.setState({
selectedIndex: getSelectedIndex({
additionLabel: _this.props.additionLabel,
additionPosition: _this.props.additionPosition,
allowAdditions: _this.props.allowAdditions,
deburr: _this.props.deburr,
multiple: _this.props.multiple,
search: _this.props.search,
selectedIndex: selectedIndex,
value: nextValue,
options: _this.props.options,
searchQuery: ''
})
});
_this.closeOnChange(e);
_this.clearSearchQuery();
if (search) {
_invoke(_this.searchRef.current, 'focus');
}
};
_this.removeItemOnBackspace = function (e) {
var _this$props3 = _this.props,
multiple = _this$props3.multiple,
search = _this$props3.search;
var _this$state4 = _this.state,
searchQuery = _this$state4.searchQuery,
value = _this$state4.value;
if (keyboardKey_1.getCode(e) !== keyboardKey_1.Backspace) return;
if (searchQuery || !search || !multiple || isEmpty(value)) return;
e.preventDefault(); // remove most recent value
var newValue = dropRight(value);
_this.setState({
value: newValue
});
_this.handleChange(e, newValue);
};
_this.closeOnDocumentClick = function (e) {
if (!_this.props.closeOnBlur) return; // If event happened in the dropdown, ignore it
if (_this.ref.current && doesNodeContainClick$1(_this.ref.current, e)) return;
_this.close();
};
_this.handleMouseDown = function (e) {
_this.isMouseDown = true;
_invoke(_this.props, 'onMouseDown', e, _this.props);
document.addEventListener('mouseup', _this.handleDocumentMouseUp);
};
_this.handleDocumentMouseUp = function () {
_this.isMouseDown = false;
document.removeEventListener('mouseup', _this.handleDocumentMouseUp);
};
_this.handleClick = function (e) {
var _this$props4 = _this.props,
minCharacters = _this$props4.minCharacters,
search = _this$props4.search;
var _this$state5 = _this.state,
open = _this$state5.open,
searchQuery = _this$state5.searchQuery;
_invoke(_this.props, 'onClick', e, _this.props); // prevent closeOnDocumentClick()
e.stopPropagation();
if (!search) return _this.toggle(e);
if (open) {
_invoke(_this.searchRef.current, 'focus');
return;
}
if (searchQuery.length >= minCharacters || minCharacters === 1) {
_this.open(e);
return;
}
_invoke(_this.searchRef.current, 'focus');
};
_this.handleIconClick = function (e) {
var clearable = _this.props.clearable;
var hasValue = _this.hasValue();
_invoke(_this.props, 'onClick', e, _this.props); // prevent handleClick()
e.stopPropagation();
if (clearable && hasValue) {
_this.clearValue(e);
} else {
_this.toggle(e);
}
};
_this.handleItemClick = function (e, item) {
var _this$props5 = _this.props,
multiple = _this$props5.multiple,
search = _this$props5.search;
var currentValue = _this.state.value;
var value = item.value; // prevent toggle() in handleClick()
e.stopPropagation(); // prevent closeOnDocumentClick() if multiple or item is disabled
if (multiple || item.disabled) {
e.nativeEvent.stopImmediatePropagation();
}
if (item.disabled) {
return;
}
var isAdditionItem = item['data-additional'];
var newValue = multiple ? _union(_this.state.value, [value]) : value;
var valueHasChanged = multiple ? !!_difference(newValue, currentValue).length : newValue !== currentValue; // notify the onChange prop that the user is trying to change value
if (valueHasChanged) {
_this.setState({
value: newValue
});
_this.handleChange(e, newValue);
}
_this.clearSearchQuery();
if (search) {
_invoke(_this.searchRef.current, 'focus');
} else {
_invoke(_this.ref.current, 'focus');
}
_this.closeOnChange(e); // Heads up! This event handler should be called after `onChange`
// Notify the onAddItem prop if this is a new value
if (isAdditionItem) {
_invoke(_this.props, 'onAddItem', e, _extends$6({}, _this.props, {
value: value
}));
}
};
_this.handleFocus = function (e) {
var focus = _this.state.focus;
if (focus) return;
_invoke(_this.props, 'onFocus', e, _this.props);
_this.setState({
focus: true
});
};
_this.handleBlur = function (e) {
// Heads up! Don't remove this.
// https://github.com/Semantic-Org/Semantic-UI-React/issues/1315
var currentTarget = get(e, 'currentTarget');
if (currentTarget && currentTarget.contains(document.activeElement)) return;
var _this$props6 = _this.props,
closeOnBlur = _this$props6.closeOnBlur,
multiple = _this$props6.multiple,
selectOnBlur = _this$props6.selectOnBlur; // do not "blur" when the mouse is down inside of the Dropdown
if (_this.isMouseDown) return;
_invoke(_this.props, 'onBlur', e, _this.props);
if (selectOnBlur && !multiple) {
_this.makeSelectedItemActive(e, _this.state.selectedIndex);
if (closeOnBlur) _this.close();
}
_this.setState({
focus: false
});
_this.clearSearchQuery();
};
_this.handleSearchChange = function (e, _ref) {
var value = _ref.value;
// prevent propagating to this.props.onChange()
e.stopPropagation();
var minCharacters = _this.props.minCharacters;
var open = _this.state.open;
var newQuery = value;
_invoke(_this.props, 'onSearchChange', e, _extends$6({}, _this.props, {
searchQuery: newQuery
}));
_this.setState({
searchQuery: newQuery,
selectedIndex: 0
}); // open search dropdown on search query
if (!open && newQuery.length >= minCharacters) {
_this.open();
return;
} // close search dropdown if search query is too small
if (open && minCharacters !== 1 && newQuery.length < minCharacters) _this.close();
};
_this.handleKeyDown = function (e) {
_this.moveSelectionOnKeyDown(e);
_this.openOnArrow(e);
_this.openOnSpace(e);
_this.selectItemOnEnter(e);
_invoke(_this.props, 'onKeyDown', e);
};
_this.getSelectedItem = function (selectedIndex) {
var options = getMenuOptions({
value: _this.state.value,
options: _this.props.options,
searchQuery: _this.state.searchQuery,
additionLabel: _this.props.additionLabel,
additionPosition: _this.props.additionPosition,
allowAdditions: _this.props.allowAdditions,
deburr: _this.props.deburr,
multiple: _this.props.multiple,
search: _this.props.search
});
return get(options, "[" + selectedIndex + "]");
};
_this.getItemByValue = function (value) {
var options = _this.props.options;
return _find(options, {
value: value
});
};
_this.getDropdownAriaOptions = function () {
var _this$props7 = _this.props,
loading = _this$props7.loading,
disabled = _this$props7.disabled,
search = _this$props7.search,
multiple = _this$props7.multiple;
var open = _this.state.open;
var ariaOptions = {
role: search ? 'combobox' : 'listbox',
'aria-busy': loading,
'aria-disabled': disabled,
'aria-expanded': !!open
};
if (ariaOptions.role === 'listbox') {
ariaOptions['aria-multiselectable'] = multiple;
}
return ariaOptions;
};
_this.clearSearchQuery = function () {
var searchQuery = _this.state.searchQuery;
if (searchQuery === undefined || searchQuery === '') return;
_this.setState({
searchQuery: ''
});
};
_this.handleLabelClick = function (e, labelProps) {
// prevent focusing search input on click
e.stopPropagation();
_this.setState({
selectedLabel: labelProps.value
});
_invoke(_this.props, 'onLabelClick', e, labelProps);
};
_this.handleLabelRemove = function (e, labelProps) {
// prevent focusing search input on click
e.stopPropagation();
var value = _this.state.value;
var newValue = _without(value, labelProps.value);
_this.setState({
value: newValue
});
_this.handleChange(e, newValue);
};
_this.getSelectedIndexAfterMove = function (offset, startIndex) {
if (startIndex === void 0) {
startIndex = _this.state.selectedIndex;
}
var options = getMenuOptions({
value: _this.state.value,
options: _this.props.options,
searchQuery: _this.state.searchQuery,
additionLabel: _this.props.additionLabel,
additionPosition: _this.props.additionPosition,
allowAdditions: _this.props.allowAdditions,
deburr: _this.props.deburr,
multiple: _this.props.multiple,
search: _this.props.search
}); // Prevent infinite loop
// TODO: remove left part of condition after children API will be removed
if (options === undefined || every(options, 'disabled')) return;
var lastIndex = options.length - 1;
var wrapSelection = _this.props.wrapSelection; // next is after last, wrap to beginning
// next is before first, wrap to end
var nextIndex = startIndex + offset; // if 'wrapSelection' is set to false and selection is after last or before first, it just does not change
if (!wrapSelection && (nextIndex > lastIndex || nextIndex < 0)) {
nextIndex = startIndex;
} else if (nextIndex > lastIndex) {
nextIndex = 0;
} else if (nextIndex < 0) {
nextIndex = lastIndex;
}
if (options[nextIndex].disabled) {
return _this.getSelectedIndexAfterMove(offset, nextIndex);
}
return nextIndex;
};
_this.handleIconOverrides = function (predefinedProps) {
var clearable = _this.props.clearable;
var classes = cx(clearable && _this.hasValue() && 'clear', predefinedProps.className);
return {
className: classes,
onClick: function onClick(e) {
_invoke(predefinedProps, 'onClick', e, predefinedProps);
_this.handleIconClick(e);
}
};
};
_this.clearValue = function (e) {
var multiple = _this.props.multiple;
var newValue = multiple ? [] : '';
_this.setState({
value: newValue
});
_this.handleChange(e, newValue);
};
_this.computeSearchInputTabIndex = function () {
var _this$props8 = _this.props,
disabled = _this$props8.disabled,
tabIndex = _this$props8.tabIndex;
if (!isNil(tabIndex)) return tabIndex;
return disabled ? -1 : 0;
};
_this.computeSearchInputWidth = function () {
var searchQuery = _this.state.searchQuery;
if (_this.sizerRef.current && searchQuery) {
// resize the search input, temporarily show the sizer so we can measure it
_this.sizerRef.current.style.display = 'inline';
_this.sizerRef.current.textContent = searchQuery;
var searchWidth = Math.ceil(_this.sizerRef.current.getBoundingClientRect().width);
_this.sizerRef.current.style.removeProperty('display');
return searchWidth;
}
};
_this.computeTabIndex = function () {
var _this$props9 = _this.props,
disabled = _this$props9.disabled,
search = _this$props9.search,
tabIndex = _this$props9.tabIndex; // don't set a root node tabIndex as the search input has its own tabIndex
if (search) return undefined;
if (disabled) return -1;
return isNil(tabIndex) ? 0 : tabIndex;
};
_this.handleSearchInputOverrides = function (predefinedProps) {
return {
onChange: function onChange(e, inputProps) {
_invoke(predefinedProps, 'onChange', e, inputProps);
_this.handleSearchChange(e, inputProps);
}
};
};
_this.hasValue = function () {
var multiple = _this.props.multiple;
var value = _this.state.value;
return multiple ? !isEmpty(value) : !isNil(value) && value !== '';
};
_this.scrollSelectedItemIntoView = function () {
if (!_this.ref.current) return;
var menu = _this.ref.current.querySelector('.menu.visible');
if (!menu) return;
var item = menu.querySelector('.item.selected');
if (!item) return;
var isOutOfUpperView = item.offsetTop < menu.scrollTop;
var isOutOfLowerView = item.offsetTop + item.clientHeight > menu.scrollTop + menu.clientHeight;
if (isOutOfUpperView) {
menu.scrollTop = item.offsetTop;
} else if (isOutOfLowerView) {
// eslint-disable-next-line no-mixed-operators
menu.scrollTop = item.offsetTop + item.clientHeight - menu.clientHeight;
}
};
_this.setOpenDirection = function () {
if (!_this.ref.current) return;
var menu = _this.ref.current.querySelector('.menu.visible');
if (!menu) return;
var dropdownRect = _this.ref.current.getBoundingClientRect();
var menuHeight = menu.clientHeight;
var spaceAtTheBottom = document.documentElement.clientHeight - dropdownRect.top - dropdownRect.height - menuHeight;
var spaceAtTheTop = dropdownRect.top - menuHeight;
var upward = spaceAtTheBottom < 0 && spaceAtTheTop > spaceAtTheBottom; // set state only if there's a relevant difference
if (!upward !== !_this.state.upward) {
_this.setState({
upward: upward
});
}
};
_this.open = function (e, triggerSetState) {
if (e === void 0) {
e = null;
}
if (triggerSetState === void 0) {
triggerSetState = true;
}
var _this$props10 = _this.props,
disabled = _this$props10.disabled,
search = _this$props10.search;
if (disabled) return;
if (search) _invoke(_this.searchRef.current, 'focus');
_invoke(_this.props, 'onOpen', e, _this.props);
if (triggerSetState) {
_this.setState({
open: true
});
}
_this.scrollSelectedItemIntoView();
};
_this.close = function (e, callback) {
if (callback === void 0) {
callback = _this.handleClose;
}
if (_this.state.open) {
_invoke(_this.props, 'onClose', e, _this.props);
_this.setState({
open: false
}, callback);
}
};
_this.handleClose = function () {
var hasSearchFocus = document.activeElement === _this.searchRef.current; // https://github.com/Semantic-Org/Semantic-UI-React/issues/627
// Blur the Dropdown on close so it is blurred after selecting an item.
// This is to prevent it from re-opening when switching tabs after selecting an item.
if (!hasSearchFocus && _this.ref.current) {
_this.ref.current.blur();
}
var hasDropdownFocus = document.activeElement === _this.ref.current;
var hasFocus = hasSearchFocus || hasDropdownFocus; // We need to keep the virtual model in sync with the browser focus change
// https://github.com/Semantic-Org/Semantic-UI-React/issues/692
_this.setState({
focus: hasFocus
});
};
_this.toggle = function (e) {
return _this.state.open ? _this.close(e) : _this.open(e);
};
_this.renderText = function () {
var _this$props11 = _this.props,
multiple = _this$props11.multiple,
placeholder = _this$props11.placeholder,
search = _this$props11.search,
text = _this$props11.text;
var _this$state6 = _this.state,
searchQuery = _this$state6.searchQuery,
selectedIndex = _this$state6.selectedIndex,
value = _this$state6.value,
open = _this$state6.open;
var hasValue = _this.hasValue();
var classes = cx(placeholder && !hasValue && 'default', 'text', search && searchQuery && 'filtered');
var _text = placeholder;
var selectedItem;
if (text) {
_text = text;
} else if (open && !multiple) {
selectedItem = _this.getSelectedItem(selectedIndex);
} else if (hasValue) {
selectedItem = _this.getItemByValue(value);
}
return DropdownText.create(selectedItem ? renderItemContent(selectedItem) : _text, {
defaultProps: {
className: classes
}
});
};
_this.renderSearchInput = function () {
var _this$props12 = _this.props,
search = _this$props12.search,
searchInput = _this$props12.searchInput;
var searchQuery = _this.state.searchQuery;
return search && /*#__PURE__*/React__default.createElement(Ref, {
innerRef: _this.searchRef
}, DropdownSearchInput$1.create(searchInput, {
defaultProps: {
style: {
width: _this.computeSearchInputWidth()
},
tabIndex: _this.computeSearchInputTabIndex(),
value: searchQuery
},
overrideProps: _this.handleSearchInputOverrides
}));
};
_this.renderSearchSizer = function () {
var _this$props13 = _this.props,
search = _this$props13.search,
multiple = _this$props13.multiple;
return search && multiple && /*#__PURE__*/React__default.createElement("span", {
className: "sizer",
ref: _this.sizerRef
});
};
_this.renderLabels = function () {
var _this$props14 = _this.props,
multiple = _this$props14.multiple,
renderLabel = _this$props14.renderLabel;
var _this$state7 = _this.state,
selectedLabel = _this$state7.selectedLabel,
value = _this$state7.value;
if (!multiple || isEmpty(value)) {
return;
}
var selectedItems = map(value, _this.getItemByValue);
// if no item could be found for a given state value the selected item will be undefined
// compact the selectedItems so we only have actual objects left
return map(compact(selectedItems), function (item, index) {
var defaultProps = {
active: item.value === selectedLabel,
as: 'a',
key: getKeyOrValue(item.key, item.value),
onClick: _this.handleLabelClick,
onRemove: _this.handleLabelRemove,
value: item.value
};
return Label.create(renderLabel(item, index, defaultProps), {
defaultProps: defaultProps
});
});
};
_this.renderOptions = function () {
var _this$props15 = _this.props,
lazyLoad = _this$props15.lazyLoad,
multiple = _this$props15.multiple,
search = _this$props15.search,
noResultsMessage = _this$props15.noResultsMessage;
var _this$state8 = _this.state,
open = _this$state8.open,
selectedIndex = _this$state8.selectedIndex,
value = _this$state8.value; // lazy load, only render options when open
if (lazyLoad && !open) return null;
var options = getMenuOptions({
value: _this.state.value,
options: _this.props.options,
searchQuery: _this.state.searchQuery,
additionLabel: _this.props.additionLabel,
additionPosition: _this.props.additionPosition,
allowAdditions: _this.props.allowAdditions,
deburr: _this.props.deburr,
multiple: _this.props.multiple,
search: _this.props.search
});
if (noResultsMessage !== null && search && isEmpty(options)) {
return /*#__PURE__*/React__default.createElement("div", {
className: "message"
}, noResultsMessage);
}
var isActive = multiple ? function (optValue) {
return includes(value, optValue);
} : function (optValue) {
return optValue === value;
};
return map(options, function (opt, i) {
return DropdownItem$1.create(_extends$6({
active: isActive(opt.value),
onClick: _this.handleItemClick,
selected: selectedIndex === i
}, opt, {
key: getKeyOrValue(opt.key, opt.value),
// Needed for handling click events on disabled items
style: _extends$6({}, opt.style, {
pointerEvents: 'all'
})
}));
});
};
_this.renderMenu = function () {
var _this$props16 = _this.props,
children = _this$props16.children,
direction = _this$props16.direction,
header = _this$props16.header;
var open = _this.state.open;
var ariaOptions = _this.getDropdownMenuAriaOptions(); // single menu child
if (!isNil$1(children)) {
var menuChild = Children.only(children);
var className = cx(direction, useKeyOnly(open, 'visible'), menuChild.props.className);
return /*#__PURE__*/cloneElement(menuChild, _extends$6({
className: className
}, ariaOptions));
}
return /*#__PURE__*/React__default.createElement(DropdownMenu, _extends$6({}, ariaOptions, {
direction: direction,
open: open
}), DropdownHeader.create(header, {
autoGenerateKey: false
}), _this.renderOptions());
};
return _this;
}
var _proto = Dropdown.prototype;
_proto.getInitialAutoControlledState = function getInitialAutoControlledState() {
return {
focus: false,
searchQuery: ''
};
};
Dropdown.getAutoControlledStateFromProps = function getAutoControlledStateFromProps(nextProps, computedState, prevState) {
// These values are stored only for a comparison on next getAutoControlledStateFromProps()
var derivedState = {
__options: nextProps.options,
__value: computedState.value
}; // The selected index is only dependent:
var shouldComputeSelectedIndex = // On value change
!shallowequal(prevState.__value, computedState.value) || // On option keys/values, we only check those properties to avoid recursive performance impacts.
// https://github.com/Semantic-Org/Semantic-UI-React/issues/3000
!isEqual(getKeyAndValues(nextProps.options), getKeyAndValues(prevState.__options));
if (shouldComputeSelectedIndex) {
derivedState.selectedIndex = getSelectedIndex({
additionLabel: nextProps.additionLabel,
additionPosition: nextProps.additionPosition,
allowAdditions: nextProps.allowAdditions,
deburr: nextProps.deburr,
multiple: nextProps.multiple,
search: nextProps.search,
selectedIndex: computedState.selectedIndex,
value: computedState.value,
options: nextProps.options,
searchQuery: computedState.searchQuery
});
}
return derivedState;
};
_proto.componentDidMount = function componentDidMount() {
var open = this.state.open;
if (open) {
this.open(null, false);
}
};
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
return !shallowequal(nextProps, this.props) || !shallowequal(nextState, this.state);
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
// eslint-disable-line complexity
var _this$props17 = this.props,
closeOnBlur = _this$props17.closeOnBlur,
minCharacters = _this$props17.minCharacters,
openOnFocus = _this$props17.openOnFocus,
search = _this$props17.search;
/* eslint-enable no-console */
// focused / blurred
if (!prevState.focus && this.state.focus) {
if (!this.isMouseDown) {
var openable = !search || search && minCharacters === 1 && !this.state.open;
if (openOnFocus && openable) this.open();
}
} else if (prevState.focus && !this.state.focus) {
if (!this.isMouseDown && closeOnBlur) {
this.close();
}
} // opened / closed
if (!prevState.open && this.state.open) {
this.setOpenDirection();
this.scrollSelectedItemIntoView();
} else if (prevState.open && !this.state.open) ;
if (prevState.selectedIndex !== this.state.selectedIndex) {
this.scrollSelectedItemIntoView();
}
} // ----------------------------------------
// Document Event Handlers
// ----------------------------------------
// onChange needs to receive a value
// can't rely on props.value if we are controlled
;
_proto.getDropdownMenuAriaOptions = function getDropdownMenuAriaOptions() {
var _this$props18 = this.props,
search = _this$props18.search,
multiple = _this$props18.multiple;
var ariaOptions = {};
if (search) {
ariaOptions['aria-multiselectable'] = multiple;
ariaOptions.role = 'listbox';
}
return ariaOptions;
} // ----------------------------------------
// Setters
// ----------------------------------------
;
_proto.render = function render() {
var _this$props19 = this.props,
basic = _this$props19.basic,
button = _this$props19.button,
className = _this$props19.className,
compact = _this$props19.compact,
disabled = _this$props19.disabled,
error = _this$props19.error,
fluid = _this$props19.fluid,
floating = _this$props19.floating,
icon = _this$props19.icon,
inline = _this$props19.inline,
item = _this$props19.item,
labeled = _this$props19.labeled,
loading = _this$props19.loading,
multiple = _this$props19.multiple,
pointing = _this$props19.pointing,
search = _this$props19.search,
selection = _this$props19.selection,
scrolling = _this$props19.scrolling,
simple = _this$props19.simple,
trigger = _this$props19.trigger;
var _this$state9 = this.state,
focus = _this$state9.focus,
open = _this$state9.open,
upward = _this$state9.upward; // Classes
var classes = cx('ui', useKeyOnly(open, 'active visible'), useKeyOnly(disabled, 'disabled'), useKeyOnly(error, 'error'), useKeyOnly(loading, 'loading'), useKeyOnly(basic, 'basic'), useKeyOnly(button, 'button'), useKeyOnly(compact, 'compact'), useKeyOnly(fluid, 'fluid'), useKeyOnly(floating, 'floating'), useKeyOnly(inline, 'inline'), // TODO: consider augmentation to render Dropdowns as Button/Menu, solves icon/link item issues
// https://github.com/Semantic-Org/Semantic-UI-React/issues/401#issuecomment-240487229
// TODO: the icon class is only required when a dropdown is a button
// useKeyOnly(icon, 'icon'),
useKeyOnly(labeled, 'labeled'), useKeyOnly(item, 'item'), useKeyOnly(multiple, 'multiple'), useKeyOnly(search, 'search'), useKeyOnly(selection, 'selection'), useKeyOnly(simple, 'simple'), useKeyOnly(scrolling, 'scrolling'), useKeyOnly(upward, 'upward'), useKeyOrValueAndKey(pointing, 'pointing'), 'dropdown', className);
var rest = getUnhandledProps$1(Dropdown, this.props);
var ElementType = getElementType(Dropdown, this.props);
var ariaOptions = this.getDropdownAriaOptions(ElementType, this.props);
return /*#__PURE__*/React__default.createElement(Ref, {
innerRef: this.ref
}, /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, ariaOptions, {
className: classes,
onBlur: this.handleBlur,
onClick: this.handleClick,
onKeyDown: this.handleKeyDown,
onMouseDown: this.handleMouseDown,
onFocus: this.handleFocus,
onChange: this.handleChange,
tabIndex: this.computeTabIndex()
}), this.renderLabels(), this.renderSearchInput(), this.renderSearchSizer(), trigger || this.renderText(), Icon$1.create(icon, {
overrideProps: this.handleIconOverrides,
autoGenerateKey: false
}), this.renderMenu(), open && /*#__PURE__*/React__default.createElement(lib, {
name: "keydown",
on: this.closeOnEscape
}), open && /*#__PURE__*/React__default.createElement(lib, {
name: "click",
on: this.closeOnDocumentClick
}), focus && /*#__PURE__*/React__default.createElement(lib, {
name: "keydown",
on: this.removeItemOnBackspace
})));
};
return Dropdown;
}(ModernAutoControlledComponent);
Dropdown.handledProps = ["additionLabel", "additionPosition", "allowAdditions", "as", "basic", "button", "children", "className", "clearable", "closeOnBlur", "closeOnChange", "closeOnEscape", "compact", "deburr", "defaultOpen", "defaultSearchQuery", "defaultSelectedLabel", "defaultUpward", "defaultValue", "direction", "disabled", "error", "floating", "fluid", "header", "icon", "inline", "item", "labeled", "lazyLoad", "loading", "minCharacters", "multiple", "noResultsMessage", "onAddItem", "onBlur", "onChange", "onClick", "onClose", "onFocus", "onLabelClick", "onMouseDown", "onOpen", "onSearchChange", "open", "openOnFocus", "options", "placeholder", "pointing", "renderLabel", "scrolling", "search", "searchInput", "searchQuery", "selectOnBlur", "selectOnNavigation", "selectedLabel", "selection", "simple", "tabIndex", "text", "trigger", "upward", "value", "wrapSelection"];
Dropdown.propTypes = {};
Dropdown.defaultProps = {
additionLabel: 'Add ',
additionPosition: 'top',
closeOnBlur: true,
closeOnEscape: true,
deburr: false,
icon: 'dropdown',
minCharacters: 1,
noResultsMessage: 'No results found.',
openOnFocus: true,
renderLabel: renderItemContent,
searchInput: 'text',
selectOnBlur: true,
selectOnNavigation: true,
wrapSelection: true
};
Dropdown.autoControlledProps = ['open', 'searchQuery', 'selectedLabel', 'value', 'upward'];
Dropdown.Divider = DropdownDivider;
Dropdown.Header = DropdownHeader;
Dropdown.Item = DropdownItem$1;
Dropdown.Menu = DropdownMenu;
Dropdown.SearchInput = DropdownSearchInput$1;
Dropdown.Text = DropdownText;/**
* A Select is sugar for <Dropdown selection />.
* @see Dropdown
* @see Form
*/
function Select(props) {
return /*#__PURE__*/React__default.createElement(Dropdown, _extends$6({}, props, {
selection: true
}));
}
Select.handledProps = ["options"];
Select.propTypes = {};
Select.Divider = Dropdown.Divider;
Select.Header = Dropdown.Header;
Select.Item = Dropdown.Item;
Select.Menu = Dropdown.Menu;/**
* A TextArea can be used to allow for extended user input.
* @see Form
*/
var TextArea = /*#__PURE__*/function (_Component) {
_inheritsLoose(TextArea, _Component);
function TextArea() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.ref = /*#__PURE__*/createRef();
_this.focus = function () {
return _this.ref.current.focus();
};
_this.handleChange = function (e) {
var value = get(e, 'target.value');
_invoke(_this.props, 'onChange', e, _extends$6({}, _this.props, {
value: value
}));
};
_this.handleInput = function (e) {
var value = get(e, 'target.value');
_invoke(_this.props, 'onInput', e, _extends$6({}, _this.props, {
value: value
}));
};
return _this;
}
var _proto = TextArea.prototype;
_proto.render = function render() {
var _this$props = this.props,
rows = _this$props.rows,
value = _this$props.value;
var rest = getUnhandledProps$1(TextArea, this.props);
var ElementType = getElementType(TextArea, this.props);
return /*#__PURE__*/React__default.createElement(Ref, {
innerRef: this.ref
}, /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
onChange: this.handleChange,
onInput: this.handleInput,
rows: rows,
value: value
})));
};
return TextArea;
}(Component);
TextArea.handledProps = ["as", "onChange", "onInput", "rows", "value"];
TextArea.propTypes = {};
TextArea.defaultProps = {
as: 'textarea',
rows: 3
};
var TextArea$1 = TextArea;/**
* Creates an object with the same keys as `object` and values generated
* by running each own enumerable string keyed property of `object` thru
* `iteratee`. The iteratee is invoked with three arguments:
* (value, key, object).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns the new mapped object.
* @see _.mapKeys
* @example
*
* var users = {
* 'fred': { 'user': 'fred', 'age': 40 },
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
* };
*
* _.mapValues(users, function(o) { return o.age; });
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
*
* // The `_.property` iteratee shorthand.
* _.mapValues(users, 'age');
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
*/
function mapValues(object, iteratee) {
var result = {};
iteratee = baseIteratee(iteratee);
baseForOwn(object, function(value, key, object) {
baseAssignValue(result, key, iteratee(value, key, object));
});
return result;
}/**
* A specialized version of `baseAggregator` for arrays.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform keys.
* @param {Object} accumulator The initial aggregated object.
* @returns {Function} Returns `accumulator`.
*/
function arrayAggregator(array, setter, iteratee, accumulator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
var value = array[index];
setter(accumulator, value, iteratee(value), array);
}
return accumulator;
}/**
* Aggregates elements of `collection` on `accumulator` with keys transformed
* by `iteratee` and values set by `setter`.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform keys.
* @param {Object} accumulator The initial aggregated object.
* @returns {Function} Returns `accumulator`.
*/
function baseAggregator(collection, setter, iteratee, accumulator) {
baseEach$1(collection, function(value, key, collection) {
setter(accumulator, value, iteratee(value), collection);
});
return accumulator;
}/**
* Creates a function like `_.groupBy`.
*
* @private
* @param {Function} setter The function to set accumulator values.
* @param {Function} [initializer] The accumulator object initializer.
* @returns {Function} Returns the new aggregator function.
*/
function createAggregator(setter, initializer) {
return function(collection, iteratee) {
var func = isArray$1(collection) ? arrayAggregator : baseAggregator,
accumulator = initializer ? initializer() : {};
return func(collection, setter, baseIteratee(iteratee), accumulator);
};
}/**
* Creates an object composed of keys generated from the results of running
* each element of `collection` thru `iteratee`. The corresponding value of
* each key is the last element responsible for generating the key. The
* iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
* var array = [
* { 'dir': 'left', 'code': 97 },
* { 'dir': 'right', 'code': 100 }
* ];
*
* _.keyBy(array, function(o) {
* return String.fromCharCode(o.code);
* });
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
*
* _.keyBy(array, 'dir');
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
*/
var keyBy = createAggregator(function(result, value, key) {
baseAssignValue(result, key, value);
});
var _keyBy = keyBy;/**
* Given `this.props.children`, return an object mapping key to child.
*
* @param {object} children Element's children
* @return {object} Mapping of key to child
*/
var getChildMapping = function getChildMapping(children) {
return _keyBy(filter(Children.toArray(children), isValidElement), 'key');
};
var getPendingKeys = function getPendingKeys(prev, next) {
var nextKeysPending = {};
var pendingKeys = [];
forEach(keys(prev), function (prevKey) {
if (!has(next, prevKey)) {
pendingKeys.push(prevKey);
return;
}
if (pendingKeys.length) {
nextKeysPending[prevKey] = pendingKeys;
pendingKeys = [];
}
});
return [nextKeysPending, pendingKeys];
};
var getValue = function getValue(key, prev, next) {
return has(next, key) ? next[key] : prev[key];
};
/**
* When you're adding or removing children some may be added or removed in the same render pass. We want to show *both*
* since we want to simultaneously animate elements in and out. This function takes a previous set of keys and a new set
* of keys and merges them with its best guess of the correct ordering.
*
* @param {object} prev Prev children as returned from `getChildMapping()`
* @param {object} next Next children as returned from `getChildMapping()`
* @return {object} A key set that contains all keys in `prev` and all keys in `next` in a reasonable order
*/
var mergeChildMappings = function mergeChildMappings(prev, next) {
if (prev === void 0) {
prev = {};
}
if (next === void 0) {
next = {};
}
var childMapping = {};
var _getPendingKeys = getPendingKeys(prev, next),
nextKeysPending = _getPendingKeys[0],
pendingKeys = _getPendingKeys[1];
forEach(keys(next), function (nextKey) {
if (has(nextKeysPending, nextKey)) {
forEach(nextKeysPending[nextKey], function (pendingKey) {
childMapping[pendingKey] = getValue(pendingKey, prev, next);
});
}
childMapping[nextKey] = getValue(nextKey, prev, next);
});
forEach(pendingKeys, function (pendingKey) {
childMapping[pendingKey] = getValue(pendingKey, prev, next);
});
return childMapping;
};/**
* Wraps a React element with a Transition component.
*
* @param {React.ReactElement} child
* @param {Function} onHide
* @param {Object} [options={}]
* @param {String} [options.animation]
* @param {Number} [options.duration]
* @param {Boolean} [options.directional]
* @param {Boolean} [options.transitionOnMount=false]
* @param {Boolean} [options.visible=true]
*/
function wrapChild(child, onHide, options) {
if (options === void 0) {
options = {};
}
var key = child.key;
var _options = options,
animation = _options.animation,
directional = _options.directional,
duration = _options.duration,
_options$transitionOn = _options.transitionOnMount,
transitionOnMount = _options$transitionOn === void 0 ? false : _options$transitionOn,
_options$visible = _options.visible,
visible = _options$visible === void 0 ? true : _options$visible;
return /*#__PURE__*/React__default.createElement(Transition, {
animation: animation,
directional: directional,
duration: duration,
key: key,
onHide: onHide,
reactKey: key,
transitionOnMount: transitionOnMount,
visible: visible
}, child);
}
wrapChild.handledProps = [];/**
* A Transition.Group animates children as they mount and unmount.
*/
var TransitionGroup = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(TransitionGroup, _React$Component);
function TransitionGroup() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.state = {
// Keeping a callback under the state is a hack to make it accessible under getDerivedStateFromProps()
handleOnHide: function handleOnHide(nothing, childProps) {
var reactKey = childProps.reactKey;
_this.setState(function (state) {
var children = _extends$6({}, state.children);
delete children[reactKey];
return {
children: children
};
});
}
};
return _this;
}
TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
var animation = props.animation,
duration = props.duration,
directional = props.directional;
var prevMapping = state.children; // A short circuit for an initial render as there will be no `prevMapping`
if (typeof prevMapping === 'undefined') {
return {
children: mapValues(getChildMapping(props.children), function (child) {
return wrapChild(child, state.handleOnHide, {
animation: animation,
duration: duration,
directional: directional
});
})
};
}
var nextMapping = getChildMapping(props.children);
var children = mergeChildMappings(prevMapping, nextMapping);
forEach(children, function (child, key) {
var hasPrev = has(prevMapping, key);
var hasNext = has(nextMapping, key);
var prevChild = prevMapping[key];
var isLeaving = !get(prevChild, 'props.visible'); // Heads up!
// An item is new (entering), it will be picked from `nextChildren`, so it should be wrapped
if (hasNext && (!hasPrev || isLeaving)) {
children[key] = wrapChild(child, state.handleOnHide, {
animation: animation,
duration: duration,
directional: directional,
transitionOnMount: true
});
return;
} // Heads up!
// An item is old (exiting), it will be picked from `prevChildren`, so it has been already
// wrapped, so should be only updated
if (!hasNext && hasPrev && !isLeaving) {
children[key] = /*#__PURE__*/React__default.cloneElement(prevChild, {
visible: false
});
return;
} // Heads up!
// An item item hasn't changed transition states, but it will be picked from `nextChildren`,
// so we should wrap it again
var _prevChild$props = prevChild.props,
visible = _prevChild$props.visible,
transitionOnMount = _prevChild$props.transitionOnMount;
children[key] = wrapChild(child, state.handleOnHide, {
animation: animation,
duration: duration,
directional: directional,
transitionOnMount: transitionOnMount,
visible: visible
});
});
return {
children: children
};
};
var _proto = TransitionGroup.prototype;
_proto.render = function render() {
var children = this.state.children;
var ElementType = getElementType(TransitionGroup, this.props);
var rest = getUnhandledProps$1(TransitionGroup, this.props);
return /*#__PURE__*/React__default.createElement(ElementType, rest, values(children));
};
return TransitionGroup;
}(React__default.Component);
TransitionGroup.handledProps = ["animation", "as", "children", "directional", "duration"];
TransitionGroup.propTypes = {};
TransitionGroup.defaultProps = {
as: React__default.Fragment,
animation: 'fade',
duration: 500
};var TRANSITION_STATUS_INITIAL = 'INITIAL';
var TRANSITION_STATUS_ENTERED = 'ENTERED';
var TRANSITION_STATUS_ENTERING = 'ENTERING';
var TRANSITION_STATUS_EXITED = 'EXITED';
var TRANSITION_STATUS_EXITING = 'EXITING';
var TRANSITION_STATUS_UNMOUNTED = 'UNMOUNTED';
/**
* @param {Object} [options]
* @param {String} [options.status]
* @param {Boolean} [options.mountOnShow]
* @param {Boolean} [options.transitionOnMount]
* @param {Boolean} [options.visible]
* @param {Boolean} [options.unmountOnHide]
*/
function computeStatuses(options) {
var mountOnShow = options.mountOnShow,
status = options.status,
transitionOnMount = options.transitionOnMount,
visible = options.visible,
unmountOnHide = options.unmountOnHide;
if (visible) {
if (status === TRANSITION_STATUS_INITIAL) {
if (transitionOnMount) {
return {
animating: true,
status: TRANSITION_STATUS_ENTERING,
nextStatus: TRANSITION_STATUS_ENTERED
};
}
return {
animating: false,
status: TRANSITION_STATUS_ENTERED,
nextStatus: undefined
};
}
if (status === TRANSITION_STATUS_UNMOUNTED) {
return {
animating: true,
status: TRANSITION_STATUS_ENTERING,
nextStatus: TRANSITION_STATUS_ENTERED
};
}
if (status === TRANSITION_STATUS_EXITED || status === TRANSITION_STATUS_EXITING) {
return {
animating: true,
status: TRANSITION_STATUS_ENTERING,
nextStatus: TRANSITION_STATUS_ENTERED
};
}
if (status === TRANSITION_STATUS_ENTERING) {
return {};
}
/* istanbul ignore else */
if (status === TRANSITION_STATUS_ENTERED) {
return {
animating: false,
status: TRANSITION_STATUS_ENTERED,
nextStatus: undefined
};
}
}
if (status === TRANSITION_STATUS_INITIAL) {
if (mountOnShow || unmountOnHide) {
return {
animating: false,
status: TRANSITION_STATUS_UNMOUNTED,
nextStatus: undefined
};
}
return {
animating: false,
status: TRANSITION_STATUS_EXITED,
nextStatus: undefined
};
}
if (status === TRANSITION_STATUS_ENTERED || status === TRANSITION_STATUS_ENTERING) {
return {
animating: true,
status: TRANSITION_STATUS_EXITING,
nextStatus: unmountOnHide ? TRANSITION_STATUS_UNMOUNTED : TRANSITION_STATUS_EXITED
};
}
if (status === TRANSITION_STATUS_EXITING) {
return {};
}
if (status === TRANSITION_STATUS_EXITED) {
return {
animating: false,
status: TRANSITION_STATUS_EXITED,
nextStatus: undefined
};
}
/* istanbul ignore else */
if (status === TRANSITION_STATUS_UNMOUNTED) {
return {
animating: false,
status: TRANSITION_STATUS_UNMOUNTED,
nextStatus: undefined
};
}
/* istanbul ignore next */
throw new Error("Transition:computeStatuses(): an unexpected status transition: { visible: " + visible + ", status: " + status + " }");
}var _TRANSITION_CALLBACK_, _TRANSITION_STYLE_TYP;
var TRANSITION_CALLBACK_TYPE = (_TRANSITION_CALLBACK_ = {}, _TRANSITION_CALLBACK_[TRANSITION_STATUS_ENTERED] = 'show', _TRANSITION_CALLBACK_[TRANSITION_STATUS_EXITED] = 'hide', _TRANSITION_CALLBACK_);
var TRANSITION_STYLE_TYPE = (_TRANSITION_STYLE_TYP = {}, _TRANSITION_STYLE_TYP[TRANSITION_STATUS_ENTERING] = 'show', _TRANSITION_STYLE_TYP[TRANSITION_STATUS_EXITING] = 'hide', _TRANSITION_STYLE_TYP);
/**
* A transition is an animation usually used to move content in or out of view.
*/
var Transition = /*#__PURE__*/function (_Component) {
_inheritsLoose(Transition, _Component);
function Transition() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.state = {
status: TRANSITION_STATUS_INITIAL
};
_this.handleStart = function (nextStatus) {
var duration = _this.props.duration;
var durationType = TRANSITION_CALLBACK_TYPE[nextStatus];
var durationValue = normalizeTransitionDuration(duration, durationType);
_this.timeoutId = setTimeout(function () {
return _this.setState({
status: nextStatus
});
}, durationValue);
};
_this.updateStatus = function (prevState) {
if (prevState.status !== _this.state.status) {
// Timeout should be cleared in any case as previous can lead set to unexpected `nextStatus`
clearTimeout(_this.timeoutId);
if (_this.state.nextStatus) {
_this.handleStart(_this.state.nextStatus);
}
}
if (!prevState.animating && _this.state.animating) {
_invoke(_this.props, 'onStart', null, _extends$6({}, _this.props, {
status: _this.state.status
}));
}
if (prevState.animating && !_this.state.animating) {
var callback = _this.state.status === TRANSITION_STATUS_ENTERED ? 'onShow' : 'onHide';
_invoke(_this.props, 'onComplete', null, _extends$6({}, _this.props, {
status: _this.state.status
}));
_invoke(_this.props, callback, null, _extends$6({}, _this.props, {
status: _this.state.status
}));
}
};
_this.computeClasses = function () {
var _this$props = _this.props,
animation = _this$props.animation,
directional = _this$props.directional,
children = _this$props.children;
var _this$state = _this.state,
animating = _this$state.animating,
status = _this$state.status;
var childClasses = get(children, 'props.className');
var isDirectional = isNil(directional) ? includes(DIRECTIONAL_TRANSITIONS, animation) : directional;
if (isDirectional) {
return cx(animation, childClasses, useKeyOnly(animating, 'animating'), useKeyOnly(status === TRANSITION_STATUS_ENTERING, 'in'), useKeyOnly(status === TRANSITION_STATUS_EXITING, 'out'), useKeyOnly(status === TRANSITION_STATUS_EXITED, 'hidden'), useKeyOnly(status !== TRANSITION_STATUS_EXITED, 'visible'), 'transition');
}
return cx(animation, childClasses, useKeyOnly(animating, 'animating transition'));
};
_this.computeStyle = function () {
var _this$props2 = _this.props,
children = _this$props2.children,
duration = _this$props2.duration;
var status = _this.state.status;
var childStyle = get(children, 'props.style');
var type = TRANSITION_STYLE_TYPE[status];
var animationDuration = type && normalizeTransitionDuration(duration, type) + "ms";
return _extends$6({}, childStyle, {
animationDuration: animationDuration
});
};
return _this;
}
// ----------------------------------------
// Lifecycle
// ----------------------------------------
Transition.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
var derivedState = computeStatuses({
mountOnShow: props.mountOnShow,
status: state.status,
transitionOnMount: props.transitionOnMount,
visible: props.visible,
unmountOnHide: props.unmountOnHide
});
return derivedState;
};
var _proto = Transition.prototype;
_proto.componentDidMount = function componentDidMount() {
this.updateStatus({});
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
this.updateStatus(prevState);
};
_proto.componentWillUnmount = function componentWillUnmount() {
clearTimeout(this.timeoutId);
} // ----------------------------------------
// Callback handling
// ----------------------------------------
;
// ----------------------------------------
// Render
// ----------------------------------------
_proto.render = function render() {
var children = this.props.children;
var status = this.state.status;
if (status === TRANSITION_STATUS_UNMOUNTED) {
return null;
}
return /*#__PURE__*/cloneElement(children, {
className: this.computeClasses(),
style: this.computeStyle()
});
};
return Transition;
}(Component);
Transition.INITIAL = TRANSITION_STATUS_INITIAL;
Transition.ENTERED = TRANSITION_STATUS_ENTERED;
Transition.ENTERING = TRANSITION_STATUS_ENTERING;
Transition.EXITED = TRANSITION_STATUS_EXITED;
Transition.EXITING = TRANSITION_STATUS_EXITING;
Transition.UNMOUNTED = TRANSITION_STATUS_UNMOUNTED;
Transition.Group = TransitionGroup;
Transition.handledProps = ["animation", "children", "directional", "duration", "mountOnShow", "onComplete", "onHide", "onShow", "onStart", "reactKey", "transitionOnMount", "unmountOnHide", "visible"];
Transition.propTypes = {};
Transition.defaultProps = {
animation: 'fade',
duration: 500,
visible: true,
mountOnShow: true,
transitionOnMount: false,
unmountOnHide: false
};/**
* A sugar for `Portal` and `Transition`.
* @see Portal
* @see Transition
*/
var TransitionablePortal = /*#__PURE__*/function (_Component) {
_inheritsLoose(TransitionablePortal, _Component);
function TransitionablePortal() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.state = {};
_this.handlePortalClose = function () {
_this.setState({
portalOpen: -1
});
};
_this.handlePortalOpen = function () {
_this.setState({
portalOpen: true
});
};
_this.handleTransitionHide = function (nothing, data) {
var portalOpen = _this.state.portalOpen;
_this.setState({
transitionVisible: false
});
_invoke(_this.props, 'onClose', null, _extends$6({}, data, {
portalOpen: false,
transitionVisible: false
}));
_invoke(_this.props, 'onHide', null, _extends$6({}, data, {
portalOpen: portalOpen,
transitionVisible: false
}));
};
_this.handleTransitionStart = function (nothing, data) {
var portalOpen = _this.state.portalOpen;
var status = data.status;
var transitionVisible = status === TRANSITION_STATUS_ENTERING;
_invoke(_this.props, 'onStart', null, _extends$6({}, data, {
portalOpen: portalOpen,
transitionVisible: transitionVisible
})); // Heads up! TransitionablePortal fires onOpen callback on the start of transition animation
if (!transitionVisible) return;
_this.setState({
transitionVisible: transitionVisible
});
_invoke(_this.props, 'onOpen', null, _extends$6({}, data, {
transitionVisible: transitionVisible,
portalOpen: true
}));
};
return _this;
}
// ----------------------------------------
// Lifecycle
// ----------------------------------------
TransitionablePortal.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
// This is definitely a hack :(
//
// It's coupled with handlePortalClose() for force set the state of `portalOpen` omitting
// props.open. It's related to implementation of the component itself as `onClose()` will be
// called after a transition will end.
// https://github.com/Semantic-Org/Semantic-UI-React/issues/2382
if (state.portalOpen === -1) {
return {
portalOpen: false
};
}
if (isUndefined(props.open)) {
return null;
}
return {
portalOpen: props.open
};
} // ----------------------------------------
// Callback handling
// ----------------------------------------
;
var _proto = TransitionablePortal.prototype;
// ----------------------------------------
// Render
// ----------------------------------------
_proto.render = function render() {
var _this$props = this.props,
children = _this$props.children,
transition = _this$props.transition;
var _this$state = this.state,
portalOpen = _this$state.portalOpen,
transitionVisible = _this$state.transitionVisible;
var open = portalOpen || transitionVisible;
var rest = getUnhandledProps$1(TransitionablePortal, this.props);
return /*#__PURE__*/React__default.createElement(Portal$1, _extends$6({}, rest, {
open: open,
onOpen: this.handlePortalOpen,
onClose: this.handlePortalClose
}), /*#__PURE__*/React__default.createElement(Transition, _extends$6({}, transition, {
transitionOnMount: true,
onStart: this.handleTransitionStart,
onHide: this.handleTransitionHide,
visible: portalOpen
}), children));
};
return TransitionablePortal;
}(Component);
TransitionablePortal.handledProps = ["children", "onClose", "onHide", "onOpen", "onStart", "open", "transition"];
TransitionablePortal.propTypes = {};
TransitionablePortal.defaultProps = {
transition: {
animation: 'scale',
duration: 400
}
};/**
* Visibility provides a set of callbacks for when a content appears in the viewport.
*/
var Visibility = /*#__PURE__*/function (_Component) {
_inheritsLoose(Visibility, _Component);
function Visibility() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.calculations = {
bottomPassed: false,
bottomVisible: false,
fits: false,
passing: false,
offScreen: false,
onScreen: false,
topPassed: false,
topVisible: false
};
_this.firedCallbacks = [];
_this.ref = /*#__PURE__*/createRef();
_this.fire = function (_ref, value, reverse) {
var callback = _ref.callback,
name = _ref.name;
if (reverse === void 0) {
reverse = false;
}
var _this$props = _this.props,
continuous = _this$props.continuous,
once = _this$props.once; // Heads up! For the execution is required:
// - current value correspond to the fired direction
// - `continuous` is true or calculation values are different
var matchesDirection = _this.calculations[value] !== reverse;
var executionPossible = continuous || _this.calculations[value] !== _this.oldCalculations[value];
if (matchesDirection && executionPossible) _this.execute(callback, name); // Heads up! We should remove callback from the happened when it's not `once`
if (!once) _this.firedCallbacks = _without(_this.firedCallbacks, name);
};
_this.handleUpdate = function () {
if (_this.ticking) return;
_this.ticking = true;
_this.frameId = requestAnimationFrame(_this.update);
};
_this.update = function () {
if (!_this.mounted) return;
_this.ticking = false;
_this.oldCalculations = _this.calculations;
_this.calculations = _this.computeCalculations();
_this.pageYOffset = _this.getPageYOffset();
var _this$props2 = _this.props,
onBottomPassed = _this$props2.onBottomPassed,
onBottomPassedReverse = _this$props2.onBottomPassedReverse,
onBottomVisible = _this$props2.onBottomVisible,
onBottomVisibleReverse = _this$props2.onBottomVisibleReverse,
onPassing = _this$props2.onPassing,
onPassingReverse = _this$props2.onPassingReverse,
onTopPassed = _this$props2.onTopPassed,
onTopPassedReverse = _this$props2.onTopPassedReverse,
onTopVisible = _this$props2.onTopVisible,
onTopVisibleReverse = _this$props2.onTopVisibleReverse,
onOffScreen = _this$props2.onOffScreen,
onOnScreen = _this$props2.onOnScreen,
updateOn = _this$props2.updateOn;
var forward = {
bottomPassed: {
callback: onBottomPassed,
name: 'onBottomPassed'
},
bottomVisible: {
callback: onBottomVisible,
name: 'onBottomVisible'
},
passing: {
callback: onPassing,
name: 'onPassing'
},
offScreen: {
callback: onOffScreen,
name: 'onOffScreen'
},
onScreen: {
callback: onOnScreen,
name: 'onOnScreen'
},
topPassed: {
callback: onTopPassed,
name: 'onTopPassed'
},
topVisible: {
callback: onTopVisible,
name: 'onTopVisible'
}
};
var reverse = {
bottomPassed: {
callback: onBottomPassedReverse,
name: 'onBottomPassedReverse'
},
bottomVisible: {
callback: onBottomVisibleReverse,
name: 'onBottomVisibleReverse'
},
passing: {
callback: onPassingReverse,
name: 'onPassingReverse'
},
topPassed: {
callback: onTopPassedReverse,
name: 'onTopPassedReverse'
},
topVisible: {
callback: onTopVisibleReverse,
name: 'onTopVisibleReverse'
}
};
_invoke(_this.props, 'onUpdate', null, _extends$6({}, _this.props, {
calculations: _this.calculations
}));
_this.fireOnPassed(); // Heads up! Reverse callbacks should be fired first
forEach(reverse, function (data, value) {
return _this.fire(data, value, true);
});
forEach(forward, function (data, value) {
return _this.fire(data, value);
});
if (updateOn === 'repaint') _this.handleUpdate();
};
return _this;
}
var _proto = Visibility.prototype;
// ----------------------------------------
// Lifecycle
// ----------------------------------------
_proto.componentDidMount = function componentDidMount() {
this.mounted = true;
if (!isBrowser$1()) return;
var _this$props3 = this.props,
context = _this$props3.context,
fireOnMount = _this$props3.fireOnMount,
updateOn = _this$props3.updateOn;
this.pageYOffset = this.getPageYOffset();
this.attachHandlers(context, updateOn);
if (fireOnMount) this.update();
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
var cleanHappened = prevProps.continuous !== this.props.continuous || prevProps.once !== this.props.once || prevProps.updateOn !== this.props.updateOn; // Heads up! We should clean up array of happened callbacks, if values of these props are changed
if (cleanHappened) this.firedCallbacks = [];
if (prevProps.context !== this.props.context || prevProps.updateOn !== this.props.updateOn) {
this.unattachHandlers(prevProps.context);
this.attachHandlers(this.props.context, this.props.updateOn);
}
};
_proto.componentWillUnmount = function componentWillUnmount() {
var context = this.props.context;
this.unattachHandlers(context);
this.mounted = false;
};
_proto.attachHandlers = function attachHandlers(context, updateOn) {
if (updateOn === 'events') {
if (context) {
instance.sub('resize', this.handleUpdate, {
target: context
});
instance.sub('scroll', this.handleUpdate, {
target: context
});
}
return;
} // Heads up!
// We will deal with `repaint` there
this.handleUpdate();
};
_proto.unattachHandlers = function unattachHandlers(context) {
if (context) {
instance.unsub('resize', this.handleUpdate, {
target: context
});
instance.unsub('scroll', this.handleUpdate, {
target: context
});
}
if (this.frameId) cancelAnimationFrame(this.frameId);
} // ----------------------------------------
// Callback handling
// ----------------------------------------
;
_proto.execute = function execute(callback, name) {
var continuous = this.props.continuous;
if (!callback) return; // Heads up! When `continuous` is true, callback will be fired always
if (!continuous && includes(this.firedCallbacks, name)) return;
callback(null, _extends$6({}, this.props, {
calculations: this.calculations
}));
this.firedCallbacks.push(name);
};
_proto.fireOnPassed = function fireOnPassed() {
var _this2 = this;
var _this$calculations = this.calculations,
percentagePassed = _this$calculations.percentagePassed,
pixelsPassed = _this$calculations.pixelsPassed;
var onPassed = this.props.onPassed;
forEach(onPassed, function (callback, passed) {
var pixelsValue = Number(passed);
if (pixelsValue && pixelsPassed >= pixelsValue) {
_this2.execute(callback, passed);
return;
}
var matchPercentage = ("" + passed).match(/^(\d+)%$/);
if (!matchPercentage) return;
var percentageValue = Number(matchPercentage[1]) / 100;
if (percentagePassed >= percentageValue) _this2.execute(callback, passed);
});
};
// ----------------------------------------
// Helpers
// ----------------------------------------
_proto.computeCalculations = function computeCalculations() {
var offset = this.props.offset;
var _this$ref$current$get = this.ref.current.getBoundingClientRect(),
bottom = _this$ref$current$get.bottom,
height = _this$ref$current$get.height,
top = _this$ref$current$get.top,
width = _this$ref$current$get.width;
var _normalizeOffset = normalizeOffset(offset),
topOffset = _normalizeOffset[0],
bottomOffset = _normalizeOffset[1];
var newOffset = this.getPageYOffset();
var direction = newOffset > this.pageYOffset ? 'down' : 'up';
var topPassed = top < topOffset;
var bottomPassed = bottom < bottomOffset;
var pixelsPassed = bottomPassed ? 0 : Math.max(top * -1, 0);
var percentagePassed = pixelsPassed / height;
var bottomVisible = bottom >= bottomOffset && bottom <= window.innerHeight;
var topVisible = top >= topOffset && top <= window.innerHeight;
var fits = topVisible && bottomVisible;
var passing = topPassed && !bottomPassed;
var onScreen = (topVisible || topPassed) && !bottomPassed;
var offScreen = !onScreen;
return {
bottomPassed: bottomPassed,
bottomVisible: bottomVisible,
direction: direction,
fits: fits,
height: height,
passing: passing,
percentagePassed: percentagePassed,
pixelsPassed: pixelsPassed,
offScreen: offScreen,
onScreen: onScreen,
topPassed: topPassed,
topVisible: topVisible,
width: width
};
};
_proto.getPageYOffset = function getPageYOffset() {
var context = this.props.context;
if (context) {
// Heads up! `window` doesn't have `pageYOffset` property
return context === window ? window.pageYOffset : context.scrollTop;
}
return 0;
} // ----------------------------------------
// Render
// ----------------------------------------
;
_proto.render = function render() {
var children = this.props.children;
var ElementType = getElementType(Visibility, this.props);
var rest = getUnhandledProps$1(Visibility, this.props);
return /*#__PURE__*/React__default.createElement(Ref, {
innerRef: this.ref
}, /*#__PURE__*/React__default.createElement(ElementType, rest, children));
};
return Visibility;
}(Component);
Visibility.handledProps = ["as", "children", "context", "continuous", "fireOnMount", "offset", "onBottomPassed", "onBottomPassedReverse", "onBottomVisible", "onBottomVisibleReverse", "onOffScreen", "onOnScreen", "onPassed", "onPassing", "onPassingReverse", "onTopPassed", "onTopPassedReverse", "onTopVisible", "onTopVisibleReverse", "onUpdate", "once", "updateOn"];
Visibility.propTypes = {};
Visibility.defaultProps = {
context: isBrowser$1() ? window : null,
continuous: false,
offset: [0, 0],
once: true,
updateOn: 'events'
};/**
* A divider sub-component for Breadcrumb component.
*/
function BreadcrumbDivider(props) {
var children = props.children,
className = props.className,
content = props.content,
icon = props.icon;
var classes = cx('divider', className);
var rest = getUnhandledProps$1(BreadcrumbDivider, props);
var ElementType = getElementType(BreadcrumbDivider, props);
if (!isNil(icon)) {
return Icon$1.create(icon, {
defaultProps: _extends$6({}, rest, {
className: classes
}),
autoGenerateKey: false
});
}
if (!isNil(content)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), content);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? '/' : children);
}
BreadcrumbDivider.handledProps = ["as", "children", "className", "content", "icon"];
BreadcrumbDivider.propTypes = {};
BreadcrumbDivider.create = createShorthandFactory(BreadcrumbDivider, function (icon) {
return {
icon: icon
};
});/**
* A section sub-component for Breadcrumb component.
*/
var BreadcrumbSection = /*#__PURE__*/function (_Component) {
_inheritsLoose(BreadcrumbSection, _Component);
function BreadcrumbSection() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.computeElementType = function () {
var _this$props = _this.props,
link = _this$props.link,
onClick = _this$props.onClick;
if (link || onClick) return 'a';
};
_this.handleClick = function (e) {
return _invoke(_this.props, 'onClick', e, _this.props);
};
return _this;
}
var _proto = BreadcrumbSection.prototype;
_proto.render = function render() {
var _this$props2 = this.props,
active = _this$props2.active,
children = _this$props2.children,
className = _this$props2.className,
content = _this$props2.content,
href = _this$props2.href;
var classes = cx(useKeyOnly(active, 'active'), 'section', className);
var rest = getUnhandledProps$1(BreadcrumbSection, this.props);
var ElementType = getElementType(BreadcrumbSection, this.props, this.computeElementType);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
href: href,
onClick: this.handleClick
}), isNil$1(children) ? content : children);
};
return BreadcrumbSection;
}(Component);
BreadcrumbSection.handledProps = ["active", "as", "children", "className", "content", "href", "link", "onClick"];
BreadcrumbSection.propTypes = {};
BreadcrumbSection.create = createShorthandFactory(BreadcrumbSection, function (content) {
return {
content: content,
link: true
};
});/**
* A breadcrumb is used to show hierarchy between content.
*/
function Breadcrumb(props) {
var children = props.children,
className = props.className,
divider = props.divider,
icon = props.icon,
sections = props.sections,
size = props.size;
var classes = cx('ui', size, 'breadcrumb', className);
var rest = getUnhandledProps$1(Breadcrumb, props);
var ElementType = getElementType(Breadcrumb, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
var childElements = [];
forEach(sections, function (section, index) {
// section
var breadcrumbElement = BreadcrumbSection.create(section);
childElements.push(breadcrumbElement); // divider
if (index !== sections.length - 1) {
var key = breadcrumbElement.key + "_divider" || JSON.stringify(section);
childElements.push(BreadcrumbDivider.create({
content: divider,
icon: icon,
key: key
}));
}
});
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), childElements);
}
Breadcrumb.handledProps = ["as", "children", "className", "divider", "icon", "sections", "size"];
Breadcrumb.propTypes = {};
Breadcrumb.Divider = BreadcrumbDivider;
Breadcrumb.Section = BreadcrumbSection;/**
* A field is a form element containing a label and an input.
* @see Form
* @see Button
* @see Checkbox
* @see Dropdown
* @see Input
* @see Radio
* @see Select
* @see Visibility
*/
function FormField(props) {
var children = props.children,
className = props.className,
content = props.content,
control = props.control,
disabled = props.disabled,
error = props.error,
inline = props.inline,
label = props.label,
required = props.required,
type = props.type,
width = props.width,
id = props.id;
var classes = cx(useKeyOnly(disabled, 'disabled'), useKeyOnly(error, 'error'), useKeyOnly(inline, 'inline'), useKeyOnly(required, 'required'), useWidthProp(width, 'wide'), 'field', className);
var rest = getUnhandledProps$1(FormField, props);
var ElementType = getElementType(FormField, props);
var errorPointing = get(error, 'pointing', 'above');
var errorLabel = Label.create(error, {
autoGenerateKey: false,
defaultProps: {
prompt: true,
pointing: errorPointing,
id: id ? id + "-error-message" : undefined,
role: 'alert',
'aria-atomic': true
}
});
var errorLabelBefore = (errorPointing === 'below' || errorPointing === 'right') && errorLabel;
var errorLabelAfter = (errorPointing === 'above' || errorPointing === 'left') && errorLabel; // ----------------------------------------
// No Control
// ----------------------------------------
if (isNil(control)) {
if (isNil(label)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
id: id
}), isNil$1(children) ? content : children);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
id: id
}), errorLabelBefore, createHTMLLabel(label, {
autoGenerateKey: false
}), errorLabelAfter);
} // ----------------------------------------
// Checkbox/Radio Control
// ----------------------------------------
var ariaDescribedBy = id && error ? id + "-error-message" : null;
var ariaAttrs = {
'aria-describedby': ariaDescribedBy,
'aria-invalid': error ? true : undefined
};
var controlProps = _extends$6({}, rest, {
content: content,
children: children,
disabled: disabled,
required: required,
type: type,
id: id
}); // wrap HTML checkboxes/radios in the label
if (control === 'input' && (type === 'checkbox' || type === 'radio')) {
return /*#__PURE__*/React__default.createElement(ElementType, {
className: classes
}, /*#__PURE__*/React__default.createElement("label", null, errorLabelBefore, /*#__PURE__*/createElement(control, _extends$6({}, ariaAttrs, controlProps)), " ", label, errorLabelAfter));
} // pass label prop to controls that support it
if (control === Checkbox || control === Radio) {
return /*#__PURE__*/React__default.createElement(ElementType, {
className: classes
}, errorLabelBefore, /*#__PURE__*/createElement(control, _extends$6({}, ariaAttrs, controlProps, {
label: label
})), errorLabelAfter);
} // ----------------------------------------
// Other Control
// ----------------------------------------
return /*#__PURE__*/React__default.createElement(ElementType, {
className: classes
}, createHTMLLabel(label, {
defaultProps: {
htmlFor: id
},
autoGenerateKey: false
}), errorLabelBefore, /*#__PURE__*/createElement(control, _extends$6({}, ariaAttrs, controlProps)), errorLabelAfter);
}
FormField.handledProps = ["as", "children", "className", "content", "control", "disabled", "error", "id", "inline", "label", "required", "type", "width"];
FormField.propTypes = {};/**
* Sugar for <Form.Field control={Button} />.
* @see Button
* @see Form
*/
function FormButton(props) {
var control = props.control;
var rest = getUnhandledProps$1(FormButton, props);
var ElementType = getElementType(FormButton, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
control: control
}));
}
FormButton.handledProps = ["as", "control"];
FormButton.propTypes = {};
FormButton.defaultProps = {
as: FormField,
control: Button$2
};/**
* Sugar for <Form.Field control={Checkbox} />.
* @see Checkbox
* @see Form
*/
function FormCheckbox(props) {
var control = props.control;
var rest = getUnhandledProps$1(FormCheckbox, props);
var ElementType = getElementType(FormCheckbox, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
control: control
}));
}
FormCheckbox.handledProps = ["as", "control"];
FormCheckbox.propTypes = {};
FormCheckbox.defaultProps = {
as: FormField,
control: Checkbox
};/**
* Sugar for <Form.Field control={Dropdown} />.
* @see Dropdown
* @see Form
*/
function FormDropdown(props) {
var control = props.control;
var rest = getUnhandledProps$1(FormDropdown, props);
var ElementType = getElementType(FormDropdown, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
control: control
}));
}
FormDropdown.handledProps = ["as", "control"];
FormDropdown.propTypes = {};
FormDropdown.defaultProps = {
as: FormField,
control: Dropdown
};/**
* A set of fields can appear grouped together.
* @see Form
*/
function FormGroup(props) {
var children = props.children,
className = props.className,
grouped = props.grouped,
inline = props.inline,
unstackable = props.unstackable,
widths = props.widths;
var classes = cx(useKeyOnly(grouped, 'grouped'), useKeyOnly(inline, 'inline'), useKeyOnly(unstackable, 'unstackable'), useWidthProp(widths, null, true), 'fields', className);
var rest = getUnhandledProps$1(FormGroup, props);
var ElementType = getElementType(FormGroup, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
FormGroup.handledProps = ["as", "children", "className", "grouped", "inline", "unstackable", "widths"];
FormGroup.propTypes = {};/**
* An Input is a field used to elicit a response from a user.
* @see Button
* @see Form
* @see Icon
* @see Label
*/
var Input = /*#__PURE__*/function (_Component) {
_inheritsLoose(Input, _Component);
function Input() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.inputRef = /*#__PURE__*/createRef();
_this.computeIcon = function () {
var _this$props = _this.props,
loading = _this$props.loading,
icon = _this$props.icon;
if (!isNil(icon)) return icon;
if (loading) return 'spinner';
};
_this.computeTabIndex = function () {
var _this$props2 = _this.props,
disabled = _this$props2.disabled,
tabIndex = _this$props2.tabIndex;
if (!isNil(tabIndex)) return tabIndex;
if (disabled) return -1;
};
_this.focus = function () {
return _this.inputRef.current.focus();
};
_this.select = function () {
return _this.inputRef.current.select();
};
_this.handleChange = function (e) {
var value = get(e, 'target.value');
_invoke(_this.props, 'onChange', e, _extends$6({}, _this.props, {
value: value
}));
};
_this.handleChildOverrides = function (child, defaultProps) {
return _extends$6({}, defaultProps, child.props, {
ref: function ref(c) {
handleRef(child.ref, c);
_this.inputRef.current = c;
}
});
};
_this.partitionProps = function () {
var _this$props3 = _this.props,
disabled = _this$props3.disabled,
type = _this$props3.type;
var tabIndex = _this.computeTabIndex();
var unhandled = getUnhandledProps$1(Input, _this.props);
var _partitionHTMLProps = partitionHTMLProps(unhandled),
htmlInputProps = _partitionHTMLProps[0],
rest = _partitionHTMLProps[1];
return [_extends$6({}, htmlInputProps, {
disabled: disabled,
type: type,
tabIndex: tabIndex,
onChange: _this.handleChange,
ref: _this.inputRef
}), rest];
};
return _this;
}
var _proto = Input.prototype;
_proto.render = function render() {
var _this2 = this;
var _this$props4 = this.props,
action = _this$props4.action,
actionPosition = _this$props4.actionPosition,
children = _this$props4.children,
className = _this$props4.className,
disabled = _this$props4.disabled,
error = _this$props4.error,
fluid = _this$props4.fluid,
focus = _this$props4.focus,
icon = _this$props4.icon,
iconPosition = _this$props4.iconPosition,
input = _this$props4.input,
inverted = _this$props4.inverted,
label = _this$props4.label,
labelPosition = _this$props4.labelPosition,
loading = _this$props4.loading,
size = _this$props4.size,
transparent = _this$props4.transparent,
type = _this$props4.type;
var classes = cx('ui', size, useKeyOnly(disabled, 'disabled'), useKeyOnly(error, 'error'), useKeyOnly(fluid, 'fluid'), useKeyOnly(focus, 'focus'), useKeyOnly(inverted, 'inverted'), useKeyOnly(loading, 'loading'), useKeyOnly(transparent, 'transparent'), useValueAndKey(actionPosition, 'action') || useKeyOnly(action, 'action'), useValueAndKey(iconPosition, 'icon') || useKeyOnly(icon || loading, 'icon'), useValueAndKey(labelPosition, 'labeled') || useKeyOnly(label, 'labeled'), 'input', className);
var ElementType = getElementType(Input, this.props);
var _this$partitionProps = this.partitionProps(),
htmlInputProps = _this$partitionProps[0],
rest = _this$partitionProps[1]; // Render with children
// ----------------------------------------
if (!isNil$1(children)) {
// add htmlInputProps to the `<input />` child
var childElements = map(Children.toArray(children), function (child) {
if (child.type !== 'input') return child;
return /*#__PURE__*/cloneElement(child, _this2.handleChildOverrides(child, htmlInputProps));
});
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), childElements);
} // Render Shorthand
// ----------------------------------------
var actionElement = Button$2.create(action, {
autoGenerateKey: false
});
var labelElement = Label.create(label, {
defaultProps: {
className: cx('label', // add 'left|right corner'
includes(labelPosition, 'corner') && labelPosition)
},
autoGenerateKey: false
});
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), actionPosition === 'left' && actionElement, labelPosition !== 'right' && labelElement, createHTMLInput(input || type, {
defaultProps: htmlInputProps,
autoGenerateKey: false
}), Icon$1.create(this.computeIcon(), {
autoGenerateKey: false
}), actionPosition !== 'left' && actionElement, labelPosition === 'right' && labelElement);
};
return Input;
}(Component);
Input.handledProps = ["action", "actionPosition", "as", "children", "className", "disabled", "error", "fluid", "focus", "icon", "iconPosition", "input", "inverted", "label", "labelPosition", "loading", "onChange", "size", "tabIndex", "transparent", "type"];
Input.propTypes = {};
Input.defaultProps = {
type: 'text'
};
Input.create = createShorthandFactory(Input, function (type) {
return {
type: type
};
});
var Input$1 = Input;/**
* Sugar for <Form.Field control={Input} />.
* @see Form
* @see Input
*/
function FormInput(props) {
var control = props.control;
var rest = getUnhandledProps$1(FormInput, props);
var ElementType = getElementType(FormInput, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
control: control
}));
}
FormInput.handledProps = ["as", "control"];
FormInput.propTypes = {};
FormInput.defaultProps = {
as: FormField,
control: Input$1
};/**
* Sugar for <Form.Field control={Radio} />.
* @see Form
* @see Radio
*/
function FormRadio(props) {
var control = props.control;
var rest = getUnhandledProps$1(FormRadio, props);
var ElementType = getElementType(FormRadio, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
control: control
}));
}
FormRadio.handledProps = ["as", "control"];
FormRadio.propTypes = {};
FormRadio.defaultProps = {
as: FormField,
control: Radio
};/**
* Sugar for <Form.Field control={Select} />.
* @see Form
* @see Select
*/
function FormSelect(props) {
var control = props.control,
options = props.options;
var rest = getUnhandledProps$1(FormSelect, props);
var ElementType = getElementType(FormSelect, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
control: control,
options: options
}));
}
FormSelect.handledProps = ["as", "control", "options"];
FormSelect.propTypes = {};
FormSelect.defaultProps = {
as: FormField,
control: Select
};/**
* Sugar for <Form.Field control={TextArea} />.
* @see Form
* @see TextArea
*/
function FormTextArea(props) {
var control = props.control;
var rest = getUnhandledProps$1(FormTextArea, props);
var ElementType = getElementType(FormTextArea, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
control: control
}));
}
FormTextArea.handledProps = ["as", "control"];
FormTextArea.propTypes = {};
FormTextArea.defaultProps = {
as: FormField,
control: TextArea$1
};/**
* A Form displays a set of related user input fields in a structured way.
* @see Button
* @see Checkbox
* @see Dropdown
* @see Input
* @see Message
* @see Radio
* @see Select
* @see Visibility
*/
var Form = /*#__PURE__*/function (_Component) {
_inheritsLoose(Form, _Component);
function Form() {
var _this;
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
_args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(_args)) || this;
_this.handleSubmit = function (e) {
var action = _this.props.action; // Heads up! Third party libs can pass own data as first argument, we need to check that it has preventDefault()
// method.
if (typeof action !== 'string') _invoke(e, 'preventDefault');
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
_invoke.apply(void 0, [_this.props, 'onSubmit', e, _this.props].concat(args));
};
return _this;
}
var _proto = Form.prototype;
_proto.render = function render() {
var _this$props = this.props,
action = _this$props.action,
children = _this$props.children,
className = _this$props.className,
error = _this$props.error,
inverted = _this$props.inverted,
loading = _this$props.loading,
reply = _this$props.reply,
size = _this$props.size,
success = _this$props.success,
unstackable = _this$props.unstackable,
warning = _this$props.warning,
widths = _this$props.widths;
var classes = cx('ui', size, useKeyOnly(error, 'error'), useKeyOnly(inverted, 'inverted'), useKeyOnly(loading, 'loading'), useKeyOnly(reply, 'reply'), useKeyOnly(success, 'success'), useKeyOnly(unstackable, 'unstackable'), useKeyOnly(warning, 'warning'), useWidthProp(widths, null, true), 'form', className);
var rest = getUnhandledProps$1(Form, this.props);
var ElementType = getElementType(Form, this.props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
action: action,
className: classes,
onSubmit: this.handleSubmit
}), children);
};
return Form;
}(Component);
Form.handledProps = ["action", "as", "children", "className", "error", "inverted", "loading", "onSubmit", "reply", "size", "success", "unstackable", "warning", "widths"];
Form.propTypes = {};
Form.defaultProps = {
as: 'form'
};
Form.Field = FormField;
Form.Button = FormButton;
Form.Checkbox = FormCheckbox;
Form.Dropdown = FormDropdown;
Form.Group = FormGroup;
Form.Input = FormInput;
Form.Radio = FormRadio;
Form.Select = FormSelect;
Form.TextArea = FormTextArea;
var Form$1 = Form;/**
* A column sub-component for Grid.
*/
function GridColumn(props) {
var children = props.children,
className = props.className,
computer = props.computer,
color = props.color,
floated = props.floated,
largeScreen = props.largeScreen,
mobile = props.mobile,
only = props.only,
stretched = props.stretched,
tablet = props.tablet,
textAlign = props.textAlign,
verticalAlign = props.verticalAlign,
widescreen = props.widescreen,
width = props.width;
var classes = cx(color, useKeyOnly(stretched, 'stretched'), useMultipleProp(only, 'only'), useTextAlignProp(textAlign), useValueAndKey(floated, 'floated'), useVerticalAlignProp(verticalAlign), useWidthProp(computer, 'wide computer'), useWidthProp(largeScreen, 'wide large screen'), useWidthProp(mobile, 'wide mobile'), useWidthProp(tablet, 'wide tablet'), useWidthProp(widescreen, 'wide widescreen'), useWidthProp(width, 'wide'), 'column', className);
var rest = getUnhandledProps$1(GridColumn, props);
var ElementType = getElementType(GridColumn, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
GridColumn.handledProps = ["as", "children", "className", "color", "computer", "floated", "largeScreen", "mobile", "only", "stretched", "tablet", "textAlign", "verticalAlign", "widescreen", "width"];
GridColumn.propTypes = {};
GridColumn.create = createShorthandFactory(GridColumn, function (children) {
return {
children: children
};
});/**
* A row sub-component for Grid.
*/
function GridRow(props) {
var centered = props.centered,
children = props.children,
className = props.className,
color = props.color,
columns = props.columns,
divided = props.divided,
only = props.only,
reversed = props.reversed,
stretched = props.stretched,
textAlign = props.textAlign,
verticalAlign = props.verticalAlign;
var classes = cx(color, useKeyOnly(centered, 'centered'), useKeyOnly(divided, 'divided'), useKeyOnly(stretched, 'stretched'), useMultipleProp(only, 'only'), useMultipleProp(reversed, 'reversed'), useTextAlignProp(textAlign), useVerticalAlignProp(verticalAlign), useWidthProp(columns, 'column', true), 'row', className);
var rest = getUnhandledProps$1(GridRow, props);
var ElementType = getElementType(GridRow, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
GridRow.handledProps = ["as", "centered", "children", "className", "color", "columns", "divided", "only", "reversed", "stretched", "textAlign", "verticalAlign"];
GridRow.propTypes = {};/**
* A grid is used to harmonize negative space in a layout.
*/
function Grid(props) {
var celled = props.celled,
centered = props.centered,
children = props.children,
className = props.className,
columns = props.columns,
container = props.container,
divided = props.divided,
doubling = props.doubling,
inverted = props.inverted,
padded = props.padded,
relaxed = props.relaxed,
reversed = props.reversed,
stackable = props.stackable,
stretched = props.stretched,
textAlign = props.textAlign,
verticalAlign = props.verticalAlign;
var classes = cx('ui', useKeyOnly(centered, 'centered'), useKeyOnly(container, 'container'), useKeyOnly(doubling, 'doubling'), useKeyOnly(inverted, 'inverted'), useKeyOnly(stackable, 'stackable'), useKeyOnly(stretched, 'stretched'), useKeyOrValueAndKey(celled, 'celled'), useKeyOrValueAndKey(divided, 'divided'), useKeyOrValueAndKey(padded, 'padded'), useKeyOrValueAndKey(relaxed, 'relaxed'), useMultipleProp(reversed, 'reversed'), useTextAlignProp(textAlign), useVerticalAlignProp(verticalAlign), useWidthProp(columns, 'column', true), 'grid', className);
var rest = getUnhandledProps$1(Grid, props);
var ElementType = getElementType(Grid, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
Grid.handledProps = ["as", "celled", "centered", "children", "className", "columns", "container", "divided", "doubling", "inverted", "padded", "relaxed", "reversed", "stackable", "stretched", "textAlign", "verticalAlign"];
Grid.Column = GridColumn;
Grid.Row = GridRow;
Grid.propTypes = {};/**
* A message can contain a content.
*/
function MessageContent(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('content', className);
var rest = getUnhandledProps$1(MessageContent, props);
var ElementType = getElementType(MessageContent, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
MessageContent.handledProps = ["as", "children", "className", "content"];
MessageContent.propTypes = {};/**
* A message can contain a header.
*/
function MessageHeader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('header', className);
var rest = getUnhandledProps$1(MessageHeader, props);
var ElementType = getElementType(MessageHeader, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
MessageHeader.handledProps = ["as", "children", "className", "content"];
MessageHeader.propTypes = {};
MessageHeader.create = createShorthandFactory(MessageHeader, function (val) {
return {
content: val
};
});/**
* A message list can contain an item.
*/
function MessageItem(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('content', className);
var rest = getUnhandledProps$1(MessageItem, props);
var ElementType = getElementType(MessageItem, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
MessageItem.handledProps = ["as", "children", "className", "content"];
MessageItem.propTypes = {};
MessageItem.defaultProps = {
as: 'li'
};
MessageItem.create = createShorthandFactory(MessageItem, function (content) {
return {
content: content
};
});/**
* A message can contain a list of items.
*/
function MessageList(props) {
var children = props.children,
className = props.className,
items = props.items;
var classes = cx('list', className);
var rest = getUnhandledProps$1(MessageList, props);
var ElementType = getElementType(MessageList, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? map(items, MessageItem.create) : children);
}
MessageList.handledProps = ["as", "children", "className", "items"];
MessageList.propTypes = {};
MessageList.defaultProps = {
as: 'ul'
};
MessageList.create = createShorthandFactory(MessageList, function (val) {
return {
items: val
};
});/**
* A message displays information that explains nearby content.
* @see Form
*/
var Message = /*#__PURE__*/function (_Component) {
_inheritsLoose(Message, _Component);
function Message() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleDismiss = function (e) {
var onDismiss = _this.props.onDismiss;
if (onDismiss) onDismiss(e, _this.props);
};
return _this;
}
var _proto = Message.prototype;
_proto.render = function render() {
var _this$props = this.props,
attached = _this$props.attached,
children = _this$props.children,
className = _this$props.className,
color = _this$props.color,
compact = _this$props.compact,
content = _this$props.content,
error = _this$props.error,
floating = _this$props.floating,
header = _this$props.header,
hidden = _this$props.hidden,
icon = _this$props.icon,
info = _this$props.info,
list = _this$props.list,
negative = _this$props.negative,
onDismiss = _this$props.onDismiss,
positive = _this$props.positive,
size = _this$props.size,
success = _this$props.success,
visible = _this$props.visible,
warning = _this$props.warning;
var classes = cx('ui', color, size, useKeyOnly(compact, 'compact'), useKeyOnly(error, 'error'), useKeyOnly(floating, 'floating'), useKeyOnly(hidden, 'hidden'), useKeyOnly(icon, 'icon'), useKeyOnly(info, 'info'), useKeyOnly(negative, 'negative'), useKeyOnly(positive, 'positive'), useKeyOnly(success, 'success'), useKeyOnly(visible, 'visible'), useKeyOnly(warning, 'warning'), useKeyOrValueAndKey(attached, 'attached'), 'message', className);
var dismissIcon = onDismiss && /*#__PURE__*/React__default.createElement(Icon$1, {
name: "close",
onClick: this.handleDismiss
});
var rest = getUnhandledProps$1(Message, this.props);
var ElementType = getElementType(Message, this.props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), dismissIcon, children);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), dismissIcon, Icon$1.create(icon, {
autoGenerateKey: false
}), (!isNil(header) || !isNil(content) || !isNil(list)) && /*#__PURE__*/React__default.createElement(MessageContent, null, MessageHeader.create(header, {
autoGenerateKey: false
}), MessageList.create(list, {
autoGenerateKey: false
}), createHTMLParagraph(content, {
autoGenerateKey: false
})));
};
return Message;
}(Component);
Message.handledProps = ["as", "attached", "children", "className", "color", "compact", "content", "error", "floating", "header", "hidden", "icon", "info", "list", "negative", "onDismiss", "positive", "size", "success", "visible", "warning"];
Message.propTypes = {};
Message.Content = MessageContent;
Message.Header = MessageHeader;
Message.List = MessageList;
Message.Item = MessageItem;function TableBody(props) {
var children = props.children,
className = props.className;
var classes = cx(className);
var rest = getUnhandledProps$1(TableBody, props);
var ElementType = getElementType(TableBody, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
TableBody.handledProps = ["as", "children", "className"];
TableBody.defaultProps = {
as: 'tbody'
};
TableBody.propTypes = {};/**
* A table row can have cells.
*/
function TableCell(props) {
var active = props.active,
children = props.children,
className = props.className,
collapsing = props.collapsing,
content = props.content,
disabled = props.disabled,
error = props.error,
icon = props.icon,
negative = props.negative,
positive = props.positive,
selectable = props.selectable,
singleLine = props.singleLine,
textAlign = props.textAlign,
verticalAlign = props.verticalAlign,
warning = props.warning,
width = props.width;
var classes = cx(useKeyOnly(active, 'active'), useKeyOnly(collapsing, 'collapsing'), useKeyOnly(disabled, 'disabled'), useKeyOnly(error, 'error'), useKeyOnly(negative, 'negative'), useKeyOnly(positive, 'positive'), useKeyOnly(selectable, 'selectable'), useKeyOnly(singleLine, 'single line'), useKeyOnly(warning, 'warning'), useTextAlignProp(textAlign), useVerticalAlignProp(verticalAlign), useWidthProp(width, 'wide'), className);
var rest = getUnhandledProps$1(TableCell, props);
var ElementType = getElementType(TableCell, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), Icon$1.create(icon), content);
}
TableCell.handledProps = ["active", "as", "children", "className", "collapsing", "content", "disabled", "error", "icon", "negative", "positive", "selectable", "singleLine", "textAlign", "verticalAlign", "warning", "width"];
TableCell.defaultProps = {
as: 'td'
};
TableCell.propTypes = {};
TableCell.create = createShorthandFactory(TableCell, function (content) {
return {
content: content
};
});/**
* A table can have a header.
*/
function TableHeader(props) {
var children = props.children,
className = props.className,
content = props.content,
fullWidth = props.fullWidth;
var classes = cx(useKeyOnly(fullWidth, 'full-width'), className);
var rest = getUnhandledProps$1(TableHeader, props);
var ElementType = getElementType(TableHeader, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
TableHeader.handledProps = ["as", "children", "className", "content", "fullWidth"];
TableHeader.defaultProps = {
as: 'thead'
};
TableHeader.propTypes = {};/**
* A table can have a footer.
*/
function TableFooter(props) {
var as = props.as;
var rest = getUnhandledProps$1(TableFooter, props);
return /*#__PURE__*/React__default.createElement(TableHeader, _extends$6({}, rest, {
as: as
}));
}
TableFooter.handledProps = ["as"];
TableFooter.propTypes = {};
TableFooter.defaultProps = {
as: 'tfoot'
};/**
* A table can have a header cell.
*/
function TableHeaderCell(props) {
var as = props.as,
className = props.className,
sorted = props.sorted;
var classes = cx(useValueAndKey(sorted, 'sorted'), className);
var rest = getUnhandledProps$1(TableHeaderCell, props);
return /*#__PURE__*/React__default.createElement(TableCell, _extends$6({}, rest, {
as: as,
className: classes
}));
}
TableHeaderCell.handledProps = ["as", "className", "sorted"];
TableHeaderCell.propTypes = {};
TableHeaderCell.defaultProps = {
as: 'th'
};/**
* A table can have rows.
*/
function TableRow(props) {
var active = props.active,
cellAs = props.cellAs,
cells = props.cells,
children = props.children,
className = props.className,
disabled = props.disabled,
error = props.error,
negative = props.negative,
positive = props.positive,
textAlign = props.textAlign,
verticalAlign = props.verticalAlign,
warning = props.warning;
var classes = cx(useKeyOnly(active, 'active'), useKeyOnly(disabled, 'disabled'), useKeyOnly(error, 'error'), useKeyOnly(negative, 'negative'), useKeyOnly(positive, 'positive'), useKeyOnly(warning, 'warning'), useTextAlignProp(textAlign), useVerticalAlignProp(verticalAlign), className);
var rest = getUnhandledProps$1(TableRow, props);
var ElementType = getElementType(TableRow, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), map(cells, function (cell) {
return TableCell.create(cell, {
defaultProps: {
as: cellAs
}
});
}));
}
TableRow.handledProps = ["active", "as", "cellAs", "cells", "children", "className", "disabled", "error", "negative", "positive", "textAlign", "verticalAlign", "warning"];
TableRow.defaultProps = {
as: 'tr',
cellAs: 'td'
};
TableRow.propTypes = {};
TableRow.create = createShorthandFactory(TableRow, function (cells) {
return {
cells: cells
};
});/**
* A table displays a collections of data grouped into rows.
*/
function Table(props) {
var attached = props.attached,
basic = props.basic,
celled = props.celled,
children = props.children,
className = props.className,
collapsing = props.collapsing,
color = props.color,
columns = props.columns,
compact = props.compact,
definition = props.definition,
fixed = props.fixed,
footerRow = props.footerRow,
headerRow = props.headerRow,
headerRows = props.headerRows,
inverted = props.inverted,
padded = props.padded,
renderBodyRow = props.renderBodyRow,
selectable = props.selectable,
singleLine = props.singleLine,
size = props.size,
sortable = props.sortable,
stackable = props.stackable,
striped = props.striped,
structured = props.structured,
tableData = props.tableData,
textAlign = props.textAlign,
unstackable = props.unstackable,
verticalAlign = props.verticalAlign;
var classes = cx('ui', color, size, useKeyOnly(celled, 'celled'), useKeyOnly(collapsing, 'collapsing'), useKeyOnly(definition, 'definition'), useKeyOnly(fixed, 'fixed'), useKeyOnly(inverted, 'inverted'), useKeyOnly(selectable, 'selectable'), useKeyOnly(singleLine, 'single line'), useKeyOnly(sortable, 'sortable'), useKeyOnly(stackable, 'stackable'), useKeyOnly(striped, 'striped'), useKeyOnly(structured, 'structured'), useKeyOnly(unstackable, 'unstackable'), useKeyOrValueAndKey(attached, 'attached'), useKeyOrValueAndKey(basic, 'basic'), useKeyOrValueAndKey(compact, 'compact'), useKeyOrValueAndKey(padded, 'padded'), useTextAlignProp(textAlign), useVerticalAlignProp(verticalAlign), useWidthProp(columns, 'column'), 'table', className);
var rest = getUnhandledProps$1(Table, props);
var ElementType = getElementType(Table, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
var hasHeaderRows = headerRow || headerRows;
var headerShorthandOptions = {
defaultProps: {
cellAs: 'th'
}
};
var headerElement = hasHeaderRows && /*#__PURE__*/React__default.createElement(TableHeader, null, TableRow.create(headerRow, headerShorthandOptions), map(headerRows, function (data) {
return TableRow.create(data, headerShorthandOptions);
}));
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), headerElement, /*#__PURE__*/React__default.createElement(TableBody, null, renderBodyRow && map(tableData, function (data, index) {
return TableRow.create(renderBodyRow(data, index));
})), footerRow && /*#__PURE__*/React__default.createElement(TableFooter, null, TableRow.create(footerRow)));
}
Table.handledProps = ["as", "attached", "basic", "celled", "children", "className", "collapsing", "color", "columns", "compact", "definition", "fixed", "footerRow", "headerRow", "headerRows", "inverted", "padded", "renderBodyRow", "selectable", "singleLine", "size", "sortable", "stackable", "striped", "structured", "tableData", "textAlign", "unstackable", "verticalAlign"];
Table.defaultProps = {
as: 'table'
};
Table.propTypes = {};
Table.Body = TableBody;
Table.Cell = TableCell;
Table.Footer = TableFooter;
Table.Header = TableHeader;
Table.HeaderCell = TableHeaderCell;
Table.Row = TableRow;/**
* A container limits content to a maximum width.
*/
function Container(props) {
var children = props.children,
className = props.className,
content = props.content,
fluid = props.fluid,
text = props.text,
textAlign = props.textAlign;
var classes = cx('ui', useKeyOnly(text, 'text'), useKeyOnly(fluid, 'fluid'), useTextAlignProp(textAlign), 'container', className);
var rest = getUnhandledProps$1(Container, props);
var ElementType = getElementType(Container, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
Container.handledProps = ["as", "children", "className", "content", "fluid", "text", "textAlign"];
Container.propTypes = {};/**
* A divider visually segments content into groups.
*/
function Divider(props) {
var children = props.children,
className = props.className,
clearing = props.clearing,
content = props.content,
fitted = props.fitted,
hidden = props.hidden,
horizontal = props.horizontal,
inverted = props.inverted,
section = props.section,
vertical = props.vertical;
var classes = cx('ui', useKeyOnly(clearing, 'clearing'), useKeyOnly(fitted, 'fitted'), useKeyOnly(hidden, 'hidden'), useKeyOnly(horizontal, 'horizontal'), useKeyOnly(inverted, 'inverted'), useKeyOnly(section, 'section'), useKeyOnly(vertical, 'vertical'), 'divider', className);
var rest = getUnhandledProps$1(Divider, props);
var ElementType = getElementType(Divider, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
Divider.handledProps = ["as", "children", "className", "clearing", "content", "fitted", "hidden", "horizontal", "inverted", "section", "vertical"];
Divider.propTypes = {};/**
* Headers may contain subheaders.
*/
function HeaderSubheader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('sub header', className);
var rest = getUnhandledProps$1(HeaderSubheader, props);
var ElementType = getElementType(HeaderSubheader, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
HeaderSubheader.handledProps = ["as", "children", "className", "content"];
HeaderSubheader.propTypes = {};
HeaderSubheader.create = createShorthandFactory(HeaderSubheader, function (content) {
return {
content: content
};
});/**
* Header content wraps the main content when there is an adjacent Icon or Image.
*/
function HeaderContent(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('content', className);
var rest = getUnhandledProps$1(HeaderContent, props);
var ElementType = getElementType(HeaderContent, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
HeaderContent.handledProps = ["as", "children", "className", "content"];
HeaderContent.propTypes = {};/**
* A header provides a short summary of content
*/
function Header(props) {
var attached = props.attached,
block = props.block,
children = props.children,
className = props.className,
color = props.color,
content = props.content,
disabled = props.disabled,
dividing = props.dividing,
floated = props.floated,
icon = props.icon,
image = props.image,
inverted = props.inverted,
size = props.size,
sub = props.sub,
subheader = props.subheader,
textAlign = props.textAlign;
var classes = cx('ui', color, size, useKeyOnly(block, 'block'), useKeyOnly(disabled, 'disabled'), useKeyOnly(dividing, 'dividing'), useValueAndKey(floated, 'floated'), useKeyOnly(icon === true, 'icon'), useKeyOnly(image === true, 'image'), useKeyOnly(inverted, 'inverted'), useKeyOnly(sub, 'sub'), useKeyOrValueAndKey(attached, 'attached'), useTextAlignProp(textAlign), 'header', className);
var rest = getUnhandledProps$1(Header, props);
var ElementType = getElementType(Header, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
var iconElement = Icon$1.create(icon, {
autoGenerateKey: false
});
var imageElement = Image.create(image, {
autoGenerateKey: false
});
var subheaderElement = HeaderSubheader.create(subheader, {
autoGenerateKey: false
});
if (iconElement || imageElement) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), iconElement || imageElement, (content || subheaderElement) && /*#__PURE__*/React__default.createElement(HeaderContent, null, content, subheaderElement));
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), content, subheaderElement);
}
Header.handledProps = ["as", "attached", "block", "children", "className", "color", "content", "disabled", "dividing", "floated", "icon", "image", "inverted", "size", "sub", "subheader", "textAlign"];
Header.propTypes = {};
Header.Content = HeaderContent;
Header.Subheader = HeaderSubheader;/**
* A list item can contain a description.
*/
function ListDescription(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx(className, 'description');
var rest = getUnhandledProps$1(ListDescription, props);
var ElementType = getElementType(ListDescription, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
ListDescription.handledProps = ["as", "children", "className", "content"];
ListDescription.propTypes = {};
ListDescription.create = createShorthandFactory(ListDescription, function (content) {
return {
content: content
};
});/**
* A list item can contain a header.
*/
function ListHeader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('header', className);
var rest = getUnhandledProps$1(ListHeader, props);
var ElementType = getElementType(ListHeader, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
ListHeader.handledProps = ["as", "children", "className", "content"];
ListHeader.propTypes = {};
ListHeader.create = createShorthandFactory(ListHeader, function (content) {
return {
content: content
};
});/**
* A list item can contain a content.
*/
function ListContent(props) {
var children = props.children,
className = props.className,
content = props.content,
description = props.description,
floated = props.floated,
header = props.header,
verticalAlign = props.verticalAlign;
var classes = cx(useValueAndKey(floated, 'floated'), useVerticalAlignProp(verticalAlign), 'content', className);
var rest = getUnhandledProps$1(ListContent, props);
var ElementType = getElementType(ListContent, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), ListHeader.create(header), ListDescription.create(description), content);
}
ListContent.handledProps = ["as", "children", "className", "content", "description", "floated", "header", "verticalAlign"];
ListContent.propTypes = {};
ListContent.create = createShorthandFactory(ListContent, function (content) {
return {
content: content
};
});/**
* A list item can contain an icon.
*/
function ListIcon(props) {
var className = props.className,
verticalAlign = props.verticalAlign;
var classes = cx(useVerticalAlignProp(verticalAlign), className);
var rest = getUnhandledProps$1(ListIcon, props);
return /*#__PURE__*/React__default.createElement(Icon$1, _extends$6({}, rest, {
className: classes
}));
}
ListIcon.handledProps = ["className", "verticalAlign"];
ListIcon.propTypes = {};
ListIcon.create = createShorthandFactory(ListIcon, function (name) {
return {
name: name
};
});/**
* A list item can contain a set of items.
*/
var ListItem = /*#__PURE__*/function (_Component) {
_inheritsLoose(ListItem, _Component);
function ListItem() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleClick = function (e) {
var disabled = _this.props.disabled;
if (!disabled) _invoke(_this.props, 'onClick', e, _this.props);
};
return _this;
}
var _proto = ListItem.prototype;
_proto.render = function render() {
var _this$props = this.props,
active = _this$props.active,
children = _this$props.children,
className = _this$props.className,
content = _this$props.content,
description = _this$props.description,
disabled = _this$props.disabled,
header = _this$props.header,
icon = _this$props.icon,
image = _this$props.image,
value = _this$props.value;
var ElementType = getElementType(ListItem, this.props);
var classes = cx(useKeyOnly(active, 'active'), useKeyOnly(disabled, 'disabled'), useKeyOnly(ElementType !== 'li', 'item'), className);
var rest = getUnhandledProps$1(ListItem, this.props);
var valueProp = ElementType === 'li' ? {
value: value
} : {
'data-value': value
};
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, valueProp, {
role: "listitem",
className: classes,
onClick: this.handleClick
}, rest), children);
}
var iconElement = ListIcon.create(icon, {
autoGenerateKey: false
});
var imageElement = Image.create(image, {
autoGenerateKey: false
}); // See description of `content` prop for explanation about why this is necessary.
if (! /*#__PURE__*/isValidElement(content) && isPlainObject(content)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, valueProp, {
role: "listitem",
className: classes,
onClick: this.handleClick
}, rest), iconElement || imageElement, ListContent.create(content, {
autoGenerateKey: false,
defaultProps: {
header: header,
description: description
}
}));
}
var headerElement = ListHeader.create(header, {
autoGenerateKey: false
});
var descriptionElement = ListDescription.create(description, {
autoGenerateKey: false
});
if (iconElement || imageElement) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, valueProp, {
role: "listitem",
className: classes,
onClick: this.handleClick
}, rest), iconElement || imageElement, (content || headerElement || descriptionElement) && /*#__PURE__*/React__default.createElement(ListContent, null, headerElement, descriptionElement, content));
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, valueProp, {
role: "listitem",
className: classes,
onClick: this.handleClick
}, rest), headerElement, descriptionElement, content);
};
return ListItem;
}(Component);
ListItem.handledProps = ["active", "as", "children", "className", "content", "description", "disabled", "header", "icon", "image", "onClick", "value"];
ListItem.propTypes = {};
ListItem.create = createShorthandFactory(ListItem, function (content) {
return {
content: content
};
});
var ListItem$1 = ListItem;/**
* A list can contain a sub list.
*/
function ListList(props) {
var children = props.children,
className = props.className,
content = props.content;
var rest = getUnhandledProps$1(ListList, props);
var ElementType = getElementType(ListList, props);
var classes = cx(useKeyOnly(ElementType !== 'ul' && ElementType !== 'ol', 'list'), className);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
ListList.handledProps = ["as", "children", "className", "content"];
ListList.propTypes = {};/**
* A list groups related content.
*/
var List = /*#__PURE__*/function (_Component) {
_inheritsLoose(List, _Component);
function List() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleItemOverrides = function (predefinedProps) {
return {
onClick: function onClick(e, itemProps) {
_invoke(predefinedProps, 'onClick', e, itemProps);
_invoke(_this.props, 'onItemClick', e, itemProps);
}
};
};
return _this;
}
var _proto = List.prototype;
_proto.render = function render() {
var _this2 = this;
var _this$props = this.props,
animated = _this$props.animated,
bulleted = _this$props.bulleted,
celled = _this$props.celled,
children = _this$props.children,
className = _this$props.className,
content = _this$props.content,
divided = _this$props.divided,
floated = _this$props.floated,
horizontal = _this$props.horizontal,
inverted = _this$props.inverted,
items = _this$props.items,
link = _this$props.link,
ordered = _this$props.ordered,
relaxed = _this$props.relaxed,
selection = _this$props.selection,
size = _this$props.size,
verticalAlign = _this$props.verticalAlign;
var classes = cx('ui', size, useKeyOnly(animated, 'animated'), useKeyOnly(bulleted, 'bulleted'), useKeyOnly(celled, 'celled'), useKeyOnly(divided, 'divided'), useKeyOnly(horizontal, 'horizontal'), useKeyOnly(inverted, 'inverted'), useKeyOnly(link, 'link'), useKeyOnly(ordered, 'ordered'), useKeyOnly(selection, 'selection'), useKeyOrValueAndKey(relaxed, 'relaxed'), useValueAndKey(floated, 'floated'), useVerticalAlignProp(verticalAlign), 'list', className);
var rest = getUnhandledProps$1(List, this.props);
var ElementType = getElementType(List, this.props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({
role: "list",
className: classes
}, rest), children);
}
if (!isNil$1(content)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({
role: "list",
className: classes
}, rest), content);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({
role: "list",
className: classes
}, rest), map(items, function (item) {
return ListItem$1.create(item, {
overrideProps: _this2.handleItemOverrides
});
}));
};
return List;
}(Component);
List.handledProps = ["animated", "as", "bulleted", "celled", "children", "className", "content", "divided", "floated", "horizontal", "inverted", "items", "link", "onItemClick", "ordered", "relaxed", "selection", "size", "verticalAlign"];
List.propTypes = {};
List.Content = ListContent;
List.Description = ListDescription;
List.Header = ListHeader;
List.Icon = ListIcon;
List.Item = ListItem$1;
List.List = ListList;
var List$1 = List;/**
* A loader alerts a user to wait for an activity to complete.
* @see Dimmer
*/
function Loader(props) {
var active = props.active,
children = props.children,
className = props.className,
content = props.content,
disabled = props.disabled,
indeterminate = props.indeterminate,
inline = props.inline,
inverted = props.inverted,
size = props.size;
var classes = cx('ui', size, useKeyOnly(active, 'active'), useKeyOnly(disabled, 'disabled'), useKeyOnly(indeterminate, 'indeterminate'), useKeyOnly(inverted, 'inverted'), useKeyOnly(children || content, 'text'), useKeyOrValueAndKey(inline, 'inline'), 'loader', className);
var rest = getUnhandledProps$1(Loader, props);
var ElementType = getElementType(Loader, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
Loader.handledProps = ["active", "as", "children", "className", "content", "disabled", "indeterminate", "inline", "inverted", "size"];
Loader.propTypes = {};/**
* A placeholder can contain a header.
*/
function PlaceholderHeader(props) {
var children = props.children,
className = props.className,
content = props.content,
image = props.image;
var classes = cx(useKeyOnly(image, 'image'), 'header', className);
var rest = getUnhandledProps$1(PlaceholderHeader, props);
var ElementType = getElementType(PlaceholderHeader, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
PlaceholderHeader.handledProps = ["as", "children", "className", "content", "image"];
PlaceholderHeader.propTypes = {};/**
* A placeholder can contain an image.
*/
function PlaceholderImage(props) {
var className = props.className,
square = props.square,
rectangular = props.rectangular;
var classes = cx(useKeyOnly(square, 'square'), useKeyOnly(rectangular, 'rectangular'), 'image', className);
var rest = getUnhandledProps$1(PlaceholderImage, props);
var ElementType = getElementType(PlaceholderImage, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}));
}
PlaceholderImage.handledProps = ["as", "className", "rectangular", "square"];
PlaceholderImage.propTypes = {};/**
* A placeholder can contain have lines of text.
*/
function PlaceholderLine(props) {
var className = props.className,
length = props.length;
var classes = cx('line', length, className);
var rest = getUnhandledProps$1(PlaceholderLine, props);
var ElementType = getElementType(PlaceholderLine, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}));
}
PlaceholderLine.handledProps = ["as", "className", "length"];
PlaceholderLine.propTypes = {};/**
* A placeholder can contain a paragraph.
*/
function PlaceholderParagraph(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('paragraph', className);
var rest = getUnhandledProps$1(PlaceholderParagraph, props);
var ElementType = getElementType(PlaceholderParagraph, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
PlaceholderParagraph.handledProps = ["as", "children", "className", "content"];
PlaceholderParagraph.propTypes = {};/**
* A placeholder is used to reserve space for content that soon will appear in a layout.
*/
function Placeholder(props) {
var children = props.children,
className = props.className,
content = props.content,
fluid = props.fluid,
inverted = props.inverted;
var classes = cx('ui', useKeyOnly(fluid, 'fluid'), useKeyOnly(inverted, 'inverted'), 'placeholder', className);
var rest = getUnhandledProps$1(Placeholder, props);
var ElementType = getElementType(Placeholder, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
Placeholder.handledProps = ["as", "children", "className", "content", "fluid", "inverted"];
Placeholder.propTypes = {};
Placeholder.Header = PlaceholderHeader;
Placeholder.Image = PlaceholderImage;
Placeholder.Line = PlaceholderLine;
Placeholder.Paragraph = PlaceholderParagraph;/**
* A rail is used to show accompanying content outside the boundaries of the main view of a site.
*/
function Rail(props) {
var attached = props.attached,
children = props.children,
className = props.className,
close = props.close,
content = props.content,
dividing = props.dividing,
internal = props.internal,
position = props.position,
size = props.size;
var classes = cx('ui', position, size, useKeyOnly(attached, 'attached'), useKeyOnly(dividing, 'dividing'), useKeyOnly(internal, 'internal'), useKeyOrValueAndKey(close, 'close'), 'rail', className);
var rest = getUnhandledProps$1(Rail, props);
var ElementType = getElementType(Rail, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
Rail.handledProps = ["as", "attached", "children", "className", "close", "content", "dividing", "internal", "position", "size"];
Rail.propTypes = {};/**
* A content sub-component for the Reveal.
*/
function RevealContent(props) {
var children = props.children,
className = props.className,
content = props.content,
hidden = props.hidden,
visible = props.visible;
var classes = cx('ui', useKeyOnly(hidden, 'hidden'), useKeyOnly(visible, 'visible'), 'content', className);
var rest = getUnhandledProps$1(RevealContent, props);
var ElementType = getElementType(RevealContent, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
RevealContent.handledProps = ["as", "children", "className", "content", "hidden", "visible"];
RevealContent.propTypes = {};/**
* A reveal displays additional content in place of previous content when activated.
*/
function Reveal(props) {
var active = props.active,
animated = props.animated,
children = props.children,
className = props.className,
content = props.content,
disabled = props.disabled,
instant = props.instant;
var classes = cx('ui', animated, useKeyOnly(active, 'active'), useKeyOnly(disabled, 'disabled'), useKeyOnly(instant, 'instant'), 'reveal', className);
var rest = getUnhandledProps$1(Reveal, props);
var ElementType = getElementType(Reveal, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
Reveal.handledProps = ["active", "animated", "as", "children", "className", "content", "disabled", "instant"];
Reveal.propTypes = {};
Reveal.Content = RevealContent;/**
* A group of segments can be formatted to appear together.
*/
function SegmentGroup(props) {
var children = props.children,
className = props.className,
compact = props.compact,
content = props.content,
horizontal = props.horizontal,
piled = props.piled,
raised = props.raised,
size = props.size,
stacked = props.stacked;
var classes = cx('ui', size, useKeyOnly(compact, 'compact'), useKeyOnly(horizontal, 'horizontal'), useKeyOnly(piled, 'piled'), useKeyOnly(raised, 'raised'), useKeyOnly(stacked, 'stacked'), 'segments', className);
var rest = getUnhandledProps$1(SegmentGroup, props);
var ElementType = getElementType(SegmentGroup, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
SegmentGroup.handledProps = ["as", "children", "className", "compact", "content", "horizontal", "piled", "raised", "size", "stacked"];
SegmentGroup.propTypes = {};/**
* A placeholder segment can be inline.
*/
function SegmentInline(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('inline', className);
var rest = getUnhandledProps$1(SegmentInline, props);
var ElementType = getElementType(SegmentInline, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
SegmentInline.handledProps = ["as", "children", "className", "content"];
SegmentInline.propTypes = {};/**
* A segment is used to create a grouping of related content.
*/
function Segment(props) {
var attached = props.attached,
basic = props.basic,
children = props.children,
circular = props.circular,
className = props.className,
clearing = props.clearing,
color = props.color,
compact = props.compact,
content = props.content,
disabled = props.disabled,
floated = props.floated,
inverted = props.inverted,
loading = props.loading,
placeholder = props.placeholder,
padded = props.padded,
piled = props.piled,
raised = props.raised,
secondary = props.secondary,
size = props.size,
stacked = props.stacked,
tertiary = props.tertiary,
textAlign = props.textAlign,
vertical = props.vertical;
var classes = cx('ui', color, size, useKeyOnly(basic, 'basic'), useKeyOnly(circular, 'circular'), useKeyOnly(clearing, 'clearing'), useKeyOnly(compact, 'compact'), useKeyOnly(disabled, 'disabled'), useKeyOnly(inverted, 'inverted'), useKeyOnly(loading, 'loading'), useKeyOnly(placeholder, 'placeholder'), useKeyOnly(piled, 'piled'), useKeyOnly(raised, 'raised'), useKeyOnly(secondary, 'secondary'), useKeyOnly(stacked, 'stacked'), useKeyOnly(tertiary, 'tertiary'), useKeyOnly(vertical, 'vertical'), useKeyOrValueAndKey(attached, 'attached'), useKeyOrValueAndKey(padded, 'padded'), useTextAlignProp(textAlign), useValueAndKey(floated, 'floated'), 'segment', className);
var rest = getUnhandledProps$1(Segment, props);
var ElementType = getElementType(Segment, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
Segment.handledProps = ["as", "attached", "basic", "children", "circular", "className", "clearing", "color", "compact", "content", "disabled", "floated", "inverted", "loading", "padded", "piled", "placeholder", "raised", "secondary", "size", "stacked", "tertiary", "textAlign", "vertical"];
Segment.Group = SegmentGroup;
Segment.Inline = SegmentInline;
Segment.propTypes = {};function StepDescription(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('description', className);
var rest = getUnhandledProps$1(StepDescription, props);
var ElementType = getElementType(StepDescription, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
StepDescription.handledProps = ["as", "children", "className", "content"];
StepDescription.propTypes = {};
StepDescription.create = createShorthandFactory(StepDescription, function (content) {
return {
content: content
};
});/**
* A step can contain a title.
*/
function StepTitle(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('title', className);
var rest = getUnhandledProps$1(StepTitle, props);
var ElementType = getElementType(StepTitle, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
StepTitle.handledProps = ["as", "children", "className", "content"];
StepTitle.propTypes = {};
StepTitle.create = createShorthandFactory(StepTitle, function (content) {
return {
content: content
};
});/**
* A step can contain a content.
*/
function StepContent(props) {
var children = props.children,
className = props.className,
content = props.content,
description = props.description,
title = props.title;
var classes = cx('content', className);
var rest = getUnhandledProps$1(StepContent, props);
var ElementType = getElementType(StepContent, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
if (!isNil$1(content)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), content);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), StepTitle.create(title, {
autoGenerateKey: false
}), StepDescription.create(description, {
autoGenerateKey: false
}));
}
StepContent.handledProps = ["as", "children", "className", "content", "description", "title"];
StepContent.propTypes = {};
StepContent.create = createShorthandFactory(StepContent, function (content) {
return {
content: content
};
});/**
* A set of steps.
*/
function StepGroup(props) {
var attached = props.attached,
children = props.children,
className = props.className,
content = props.content,
fluid = props.fluid,
items = props.items,
ordered = props.ordered,
size = props.size,
stackable = props.stackable,
unstackable = props.unstackable,
vertical = props.vertical,
widths = props.widths;
var classes = cx('ui', size, useKeyOnly(fluid, 'fluid'), useKeyOnly(ordered, 'ordered'), useKeyOnly(unstackable, 'unstackable'), useKeyOnly(vertical, 'vertical'), useKeyOrValueAndKey(attached, 'attached'), useValueAndKey(stackable, 'stackable'), useWidthProp(widths), 'steps', className);
var rest = getUnhandledProps$1(StepGroup, props);
var ElementType = getElementType(StepGroup, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
if (!isNil$1(content)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), content);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), map(items, function (item) {
return Step$1.create(item);
}));
}
StepGroup.handledProps = ["as", "attached", "children", "className", "content", "fluid", "items", "ordered", "size", "stackable", "unstackable", "vertical", "widths"];
StepGroup.propTypes = {};/**
* A step shows the completion status of an activity in a series of activities.
*/
var Step = /*#__PURE__*/function (_Component) {
_inheritsLoose(Step, _Component);
function Step() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.computeElementType = function () {
var onClick = _this.props.onClick;
if (onClick) return 'a';
};
_this.handleClick = function (e) {
var disabled = _this.props.disabled;
if (!disabled) _invoke(_this.props, 'onClick', e, _this.props);
};
return _this;
}
var _proto = Step.prototype;
_proto.render = function render() {
var _this$props = this.props,
active = _this$props.active,
children = _this$props.children,
className = _this$props.className,
completed = _this$props.completed,
content = _this$props.content,
description = _this$props.description,
disabled = _this$props.disabled,
href = _this$props.href,
icon = _this$props.icon,
link = _this$props.link,
title = _this$props.title;
var classes = cx(useKeyOnly(active, 'active'), useKeyOnly(completed, 'completed'), useKeyOnly(disabled, 'disabled'), useKeyOnly(link, 'link'), 'step', className);
var rest = getUnhandledProps$1(Step, this.props);
var ElementType = getElementType(Step, this.props, this.computeElementType);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
href: href,
onClick: this.handleClick
}), children);
}
if (!isNil$1(content)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
href: href,
onClick: this.handleClick
}), content);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
href: href,
onClick: this.handleClick
}), Icon$1.create(icon, {
autoGenerateKey: false
}), StepContent.create({
description: description,
title: title
}, {
autoGenerateKey: false
}));
};
return Step;
}(Component);
Step.handledProps = ["active", "as", "children", "className", "completed", "content", "description", "disabled", "href", "icon", "link", "onClick", "ordered", "title"];
Step.propTypes = {};
Step.Content = StepContent;
Step.Description = StepDescription;
Step.Group = StepGroup;
Step.Title = StepTitle;
Step.create = createShorthandFactory(Step, function (content) {
return {
content: content
};
});
var Step$1 = Step;/**
* A title sub-component for Accordion component.
*/
var AccordionTitle = /*#__PURE__*/function (_Component) {
_inheritsLoose(AccordionTitle, _Component);
function AccordionTitle() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleClick = function (e) {
return _invoke(_this.props, 'onClick', e, _this.props);
};
return _this;
}
var _proto = AccordionTitle.prototype;
_proto.render = function render() {
var _this$props = this.props,
active = _this$props.active,
children = _this$props.children,
className = _this$props.className,
content = _this$props.content,
icon = _this$props.icon;
var classes = cx(useKeyOnly(active, 'active'), 'title', className);
var rest = getUnhandledProps$1(AccordionTitle, this.props);
var ElementType = getElementType(AccordionTitle, this.props);
var iconValue = isNil(icon) ? 'dropdown' : icon;
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
onClick: this.handleClick
}), children);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
onClick: this.handleClick
}), Icon$1.create(iconValue, {
autoGenerateKey: false
}), content);
};
return AccordionTitle;
}(Component);
AccordionTitle.handledProps = ["active", "as", "children", "className", "content", "icon", "index", "onClick"];
AccordionTitle.propTypes = {};
AccordionTitle.create = createShorthandFactory(AccordionTitle, function (content) {
return {
content: content
};
});/**
* A content sub-component for Accordion component.
*/
function AccordionContent(props) {
var active = props.active,
children = props.children,
className = props.className,
content = props.content;
var classes = cx('content', useKeyOnly(active, 'active'), className);
var rest = getUnhandledProps$1(AccordionContent, props);
var ElementType = getElementType(AccordionContent, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
AccordionContent.handledProps = ["active", "as", "children", "className", "content"];
AccordionContent.propTypes = {};
AccordionContent.create = createShorthandFactory(AccordionContent, function (content) {
return {
content: content
};
});/**
* A panel sub-component for Accordion component.
*/
var AccordionPanel = /*#__PURE__*/function (_Component) {
_inheritsLoose(AccordionPanel, _Component);
function AccordionPanel() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleTitleOverrides = function (predefinedProps) {
return {
onClick: function onClick(e, titleProps) {
_invoke(predefinedProps, 'onClick', e, titleProps);
_invoke(_this.props, 'onTitleClick', e, titleProps);
}
};
};
return _this;
}
var _proto = AccordionPanel.prototype;
_proto.render = function render() {
var _this$props = this.props,
active = _this$props.active,
content = _this$props.content,
index = _this$props.index,
title = _this$props.title;
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, AccordionTitle.create(title, {
autoGenerateKey: false,
defaultProps: {
active: active,
index: index
},
overrideProps: this.handleTitleOverrides
}), AccordionContent.create(content, {
autoGenerateKey: false,
defaultProps: {
active: active
}
}));
};
return AccordionPanel;
}(Component);
AccordionPanel.handledProps = ["active", "content", "index", "onTitleClick", "title"];
AccordionPanel.propTypes = {};
AccordionPanel.create = createShorthandFactory(AccordionPanel, null);
var AccordionPanel$1 = AccordionPanel;/**
* An Accordion can contain sub-accordions.
*/
var AccordionAccordion = /*#__PURE__*/function (_Component) {
_inheritsLoose(AccordionAccordion, _Component);
function AccordionAccordion() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.computeNewIndex = function (index) {
var exclusive = _this.props.exclusive;
var activeIndex = _this.state.activeIndex;
if (exclusive) return index === activeIndex ? -1 : index; // check to see if index is in array, and remove it, if not then add it
return includes(activeIndex, index) ? _without(activeIndex, index) : [].concat(activeIndex, [index]);
};
_this.handleTitleClick = function (e, titleProps) {
var index = titleProps.index;
_this.setState({
activeIndex: _this.computeNewIndex(index)
});
_invoke(_this.props, 'onTitleClick', e, titleProps);
};
_this.isIndexActive = function (index) {
var exclusive = _this.props.exclusive;
var activeIndex = _this.state.activeIndex;
return exclusive ? activeIndex === index : includes(activeIndex, index);
};
return _this;
}
var _proto = AccordionAccordion.prototype;
_proto.getInitialAutoControlledState = function getInitialAutoControlledState(_ref) {
var exclusive = _ref.exclusive;
return {
activeIndex: exclusive ? -1 : []
};
};
_proto.componentDidMount = function componentDidMount() {
};
_proto.componentDidUpdate = function componentDidUpdate() {
};
_proto.render = function render() {
var _this2 = this;
var _this$props = this.props,
className = _this$props.className,
children = _this$props.children,
panels = _this$props.panels;
var classes = cx('accordion', className);
var rest = getUnhandledProps$1(AccordionAccordion, this.props);
var ElementType = getElementType(AccordionAccordion, this.props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? map(panels, function (panel, index) {
return AccordionPanel$1.create(panel, {
defaultProps: {
active: _this2.isIndexActive(index),
index: index,
onTitleClick: _this2.handleTitleClick
}
});
}) : children);
};
return AccordionAccordion;
}(ModernAutoControlledComponent);
AccordionAccordion.handledProps = ["activeIndex", "as", "children", "className", "defaultActiveIndex", "exclusive", "onTitleClick", "panels"];
AccordionAccordion.propTypes = {};
AccordionAccordion.defaultProps = {
exclusive: true
};
AccordionAccordion.autoControlledProps = ['activeIndex'];
AccordionAccordion.create = createShorthandFactory(AccordionAccordion, function (content) {
return {
content: content
};
});/**
* An accordion allows users to toggle the display of sections of content.
*/
function Accordion(props) {
var className = props.className,
fluid = props.fluid,
inverted = props.inverted,
styled = props.styled;
var classes = cx('ui', useKeyOnly(fluid, 'fluid'), useKeyOnly(inverted, 'inverted'), useKeyOnly(styled, 'styled'), className);
var rest = getUnhandledProps$1(Accordion, props);
return /*#__PURE__*/React__default.createElement(AccordionAccordion, _extends$6({}, rest, {
className: classes
}));
}
Accordion.handledProps = ["className", "fluid", "inverted", "styled"];
Accordion.propTypes = {};
Accordion.Accordion = AccordionAccordion;
Accordion.Content = AccordionContent;
Accordion.Panel = AccordionPanel$1;
Accordion.Title = AccordionTitle;/**
* An embed displays content from other websites like YouTube videos or Google Maps.
*/
var Embed = /*#__PURE__*/function (_Component) {
_inheritsLoose(Embed, _Component);
function Embed() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleClick = function (e) {
var onClick = _this.props.onClick;
var active = _this.state.active;
if (onClick) onClick(e, _extends$6({}, _this.props, {
active: true
}));
if (!active) _this.setState({
active: true
});
};
return _this;
}
var _proto = Embed.prototype;
_proto.getSrc = function getSrc() {
var _this$props = this.props,
_this$props$autoplay = _this$props.autoplay,
autoplay = _this$props$autoplay === void 0 ? true : _this$props$autoplay,
_this$props$brandedUI = _this$props.brandedUI,
brandedUI = _this$props$brandedUI === void 0 ? false : _this$props$brandedUI,
_this$props$color = _this$props.color,
color = _this$props$color === void 0 ? '#444444' : _this$props$color,
_this$props$hd = _this$props.hd,
hd = _this$props$hd === void 0 ? true : _this$props$hd,
id = _this$props.id,
source = _this$props.source,
url = _this$props.url;
if (source === 'youtube') {
return ["//www.youtube.com/embed/" + id, '?autohide=true', "&autoplay=" + autoplay, "&color=" + encodeURIComponent(color), "&hq=" + hd, '&jsapi=false', "&modestbranding=" + brandedUI, "&rel=" + (brandedUI ? 0 : 1)].join('');
}
if (source === 'vimeo') {
return ["//player.vimeo.com/video/" + id, '?api=false', "&autoplay=" + autoplay, '&byline=false', "&color=" + encodeURIComponent(color), '&portrait=false', '&title=false'].join('');
}
return url;
};
_proto.render = function render() {
var _this$props2 = this.props,
aspectRatio = _this$props2.aspectRatio,
className = _this$props2.className,
icon = _this$props2.icon,
placeholder = _this$props2.placeholder;
var active = this.state.active;
var classes = cx('ui', aspectRatio, useKeyOnly(active, 'active'), 'embed', className);
var rest = getUnhandledProps$1(Embed, this.props);
var ElementType = getElementType(Embed, this.props);
var iconShorthand = icon !== undefined ? icon : 'video play';
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
onClick: this.handleClick
}), Icon$1.create(iconShorthand, {
autoGenerateKey: false
}), placeholder && /*#__PURE__*/React__default.createElement("img", {
className: "placeholder",
src: placeholder
}), this.renderEmbed());
};
_proto.renderEmbed = function renderEmbed() {
var _this$props3 = this.props,
children = _this$props3.children,
content = _this$props3.content,
iframe = _this$props3.iframe,
source = _this$props3.source;
var active = this.state.active;
if (!active) return null;
if (!isNil$1(children)) return /*#__PURE__*/React__default.createElement("div", {
className: "embed"
}, children);
if (!isNil$1(content)) return /*#__PURE__*/React__default.createElement("div", {
className: "embed"
}, content);
return /*#__PURE__*/React__default.createElement("div", {
className: "embed"
}, createHTMLIframe(isNil$1(iframe) ? this.getSrc() : iframe, {
defaultProps: {
allowFullScreen: false,
frameBorder: 0,
height: '100%',
scrolling: 'no',
src: this.getSrc(),
title: "Embedded content from " + source + ".",
width: '100%'
},
autoGenerateKey: false
}));
};
return Embed;
}(ModernAutoControlledComponent);
Embed.handledProps = ["active", "as", "aspectRatio", "autoplay", "brandedUI", "children", "className", "color", "content", "defaultActive", "hd", "icon", "id", "iframe", "onClick", "placeholder", "source", "url"];
Embed.propTypes = {};
Embed.autoControlledProps = ['active'];var ManagerReferenceNodeContext = React.createContext();
React.createContext();/**
* Takes an argument and if it's an array, returns the first item in the array,
* otherwise returns the argument. Used for Preact compatibility.
*/
var unwrapArray = function unwrapArray(arg) {
return Array.isArray(arg) ? arg[0] : arg;
};
/**
* Takes a maybe-undefined function and arbitrary args and invokes the function
* only if it is defined.
*/
var safeInvoke = function safeInvoke(fn) {
if (typeof fn === 'function') {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return fn.apply(void 0, args);
}
};
/**
* Sets a ref using either a ref callback or a ref object
*/
var setRef = function setRef(ref, node) {
// if its a function call it
if (typeof ref === 'function') {
return safeInvoke(ref, node);
} // otherwise we should treat it as a ref object
else if (ref != null) {
ref.current = node;
}
};
/**
* Simple ponyfill for Object.fromEntries
*/
var fromEntries = function fromEntries(entries) {
return entries.reduce(function (acc, _ref) {
var key = _ref[0],
value = _ref[1];
acc[key] = value;
return acc;
}, {});
};
/**
* Small wrapper around `useLayoutEffect` to get rid of the warning on SSR envs
*/
var useIsomorphicLayoutEffect = typeof window !== 'undefined' && window.document && window.document.createElement ? React.useLayoutEffect : React.useEffect;var top = 'top';
var bottom = 'bottom';
var right = 'right';
var left = 'left';
var auto = 'auto';
var basePlacements = [top, bottom, right, left];
var start = 'start';
var end = 'end';
var clippingParents = 'clippingParents';
var viewport = 'viewport';
var popper = 'popper';
var reference = 'reference';
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
return acc.concat([placement + "-" + start, placement + "-" + end]);
}, []);
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
}, []); // modifiers that need to read the DOM
var beforeRead = 'beforeRead';
var read = 'read';
var afterRead = 'afterRead'; // pure-logic modifiers
var beforeMain = 'beforeMain';
var main = 'main';
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
var beforeWrite = 'beforeWrite';
var write = 'write';
var afterWrite = 'afterWrite';
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];function getNodeName(element) {
return element ? (element.nodeName || '').toLowerCase() : null;
}/*:: import type { Window } from '../types'; */
/*:: declare function getWindow(node: Node | Window): Window; */
function getWindow(node) {
if (node.toString() !== '[object Window]') {
var ownerDocument = node.ownerDocument;
return ownerDocument ? ownerDocument.defaultView || window : window;
}
return node;
}/*:: declare function isElement(node: mixed): boolean %checks(node instanceof
Element); */
function isElement(node) {
var OwnElement = getWindow(node).Element;
return node instanceof OwnElement || node instanceof Element;
}
/*:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof
HTMLElement); */
function isHTMLElement(node) {
var OwnElement = getWindow(node).HTMLElement;
return node instanceof OwnElement || node instanceof HTMLElement;
}
/*:: declare function isShadowRoot(node: mixed): boolean %checks(node instanceof
ShadowRoot); */
function isShadowRoot(node) {
var OwnElement = getWindow(node).ShadowRoot;
return node instanceof OwnElement || node instanceof ShadowRoot;
}// and applies them to the HTMLElements such as popper and arrow
function applyStyles(_ref) {
var state = _ref.state;
Object.keys(state.elements).forEach(function (name) {
var style = state.styles[name] || {};
var attributes = state.attributes[name] || {};
var element = state.elements[name]; // arrow is optional + virtual elements
if (!isHTMLElement(element) || !getNodeName(element)) {
return;
} // Flow doesn't support to extend this property, but it's the most
// effective way to apply styles to an HTMLElement
// $FlowFixMe
Object.assign(element.style, style);
Object.keys(attributes).forEach(function (name) {
var value = attributes[name];
if (value === false) {
element.removeAttribute(name);
} else {
element.setAttribute(name, value === true ? '' : value);
}
});
});
}
function effect$2(_ref2) {
var state = _ref2.state;
var initialStyles = {
popper: {
position: state.options.strategy,
left: '0',
top: '0',
margin: '0'
},
arrow: {
position: 'absolute'
},
reference: {}
};
Object.assign(state.elements.popper.style, initialStyles.popper);
if (state.elements.arrow) {
Object.assign(state.elements.arrow.style, initialStyles.arrow);
}
return function () {
Object.keys(state.elements).forEach(function (name) {
var element = state.elements[name];
var attributes = state.attributes[name] || {};
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
var style = styleProperties.reduce(function (style, property) {
style[property] = '';
return style;
}, {}); // arrow is optional + virtual elements
if (!isHTMLElement(element) || !getNodeName(element)) {
return;
} // Flow doesn't support to extend this property, but it's the most
// effective way to apply styles to an HTMLElement
// $FlowFixMe
Object.assign(element.style, style);
Object.keys(attributes).forEach(function (attribute) {
element.removeAttribute(attribute);
});
});
};
} // eslint-disable-next-line import/no-unused-modules
var applyStyles$1 = {
name: 'applyStyles',
enabled: true,
phase: 'write',
fn: applyStyles,
effect: effect$2,
requires: ['computeStyles']
};function getBasePlacement(placement) {
return placement.split('-')[0];
}// Returns the layout rect of an element relative to its offsetParent. Layout
// means it doesn't take into account transforms.
function getLayoutRect(element) {
return {
x: element.offsetLeft,
y: element.offsetTop,
width: element.offsetWidth,
height: element.offsetHeight
};
}function contains(parent, child) {
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
if (parent.contains(child)) {
return true;
} // then fallback to custom implementation with Shadow DOM support
else if (rootNode && isShadowRoot(rootNode)) {
var next = child;
do {
if (next && parent.isSameNode(next)) {
return true;
} // $FlowFixMe: need a better way to handle this...
next = next.parentNode || next.host;
} while (next);
} // Give up, the result is false
return false;
}function getComputedStyle$1(element) {
return getWindow(element).getComputedStyle(element);
}function isTableElement(element) {
return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
}function getDocumentElement(element) {
// $FlowFixMe: assume body is always available
return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
}function getParentNode(element) {
if (getNodeName(element) === 'html') {
return element;
}
return (// $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
element.parentNode || // DOM Element detected
// $FlowFixMe: need a better way to handle this...
element.host || // ShadowRoot detected
// $FlowFixMe: HTMLElement is a Node
getDocumentElement(element) // fallback
);
}function getTrueOffsetParent(element) {
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
getComputedStyle$1(element).position === 'fixed') {
return null;
}
var offsetParent = element.offsetParent;
if (offsetParent) {
var html = getDocumentElement(offsetParent);
if (getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && getComputedStyle$1(html).position !== 'static') {
return html;
}
}
return offsetParent;
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
// return the containing block
function getContainingBlock(element) {
var currentNode = getParentNode(element);
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that
// create a containing block.
if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') {
return currentNode;
} else {
currentNode = currentNode.parentNode;
}
}
return null;
} // Gets the closest ancestor positioned element. Handles some edge cases,
// such as table ancestors and cross browser bugs.
function getOffsetParent(element) {
var window = getWindow(element);
var offsetParent = getTrueOffsetParent(element);
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
offsetParent = getTrueOffsetParent(offsetParent);
}
if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static') {
return window;
}
return offsetParent || getContainingBlock(element) || window;
}function getMainAxisFromPlacement(placement) {
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
}function within(min, value, max) {
return Math.max(min, Math.min(value, max));
}function getFreshSideObject() {
return {
top: 0,
right: 0,
bottom: 0,
left: 0
};
}function mergePaddingObject(paddingObject) {
return Object.assign(Object.assign({}, getFreshSideObject()), paddingObject);
}function expandToHashMap(value, keys) {
return keys.reduce(function (hashMap, key) {
hashMap[key] = value;
return hashMap;
}, {});
}function arrow(_ref) {
var _state$modifiersData$;
var state = _ref.state,
name = _ref.name;
var arrowElement = state.elements.arrow;
var popperOffsets = state.modifiersData.popperOffsets;
var basePlacement = getBasePlacement(state.placement);
var axis = getMainAxisFromPlacement(basePlacement);
var isVertical = [left, right].indexOf(basePlacement) >= 0;
var len = isVertical ? 'height' : 'width';
if (!arrowElement || !popperOffsets) {
return;
}
var paddingObject = state.modifiersData[name + "#persistent"].padding;
var arrowRect = getLayoutRect(arrowElement);
var minProp = axis === 'y' ? top : left;
var maxProp = axis === 'y' ? bottom : right;
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
var startDiff = popperOffsets[axis] - state.rects.reference[axis];
var arrowOffsetParent = getOffsetParent(arrowElement);
var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
// outside of the popper bounds
var min = paddingObject[minProp];
var max = clientSize - arrowRect[len] - paddingObject[maxProp];
var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
var offset = within(min, center, max); // Prevents breaking syntax highlighting...
var axisProp = axis;
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
}
function effect$1(_ref2) {
var state = _ref2.state,
options = _ref2.options,
name = _ref2.name;
var _options$element = options.element,
arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element,
_options$padding = options.padding,
padding = _options$padding === void 0 ? 0 : _options$padding;
if (arrowElement == null) {
return;
} // CSS selector
if (typeof arrowElement === 'string') {
arrowElement = state.elements.popper.querySelector(arrowElement);
if (!arrowElement) {
return;
}
}
if (!contains(state.elements.popper, arrowElement)) {
return;
}
state.elements.arrow = arrowElement;
state.modifiersData[name + "#persistent"] = {
padding: mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements))
};
} // eslint-disable-next-line import/no-unused-modules
var arrow$1 = {
name: 'arrow',
enabled: true,
phase: 'main',
fn: arrow,
effect: effect$1,
requires: ['popperOffsets'],
requiresIfExists: ['preventOverflow']
};var unsetSides = {
top: 'auto',
right: 'auto',
bottom: 'auto',
left: 'auto'
}; // Round the offsets to the nearest suitable subpixel based on the DPR.
// Zooming can change the DPR, but it seems to report a value that will
// cleanly divide the values into the appropriate subpixels.
function roundOffsets(_ref) {
var x = _ref.x,
y = _ref.y;
var win = window;
var dpr = win.devicePixelRatio || 1;
return {
x: Math.round(x * dpr) / dpr || 0,
y: Math.round(y * dpr) / dpr || 0
};
}
function mapToStyles(_ref2) {
var _Object$assign2;
var popper = _ref2.popper,
popperRect = _ref2.popperRect,
placement = _ref2.placement,
offsets = _ref2.offsets,
position = _ref2.position,
gpuAcceleration = _ref2.gpuAcceleration,
adaptive = _ref2.adaptive;
var _roundOffsets = roundOffsets(offsets),
x = _roundOffsets.x,
y = _roundOffsets.y;
var hasX = offsets.hasOwnProperty('x');
var hasY = offsets.hasOwnProperty('y');
var sideX = left;
var sideY = top;
var win = window;
if (adaptive) {
var offsetParent = getOffsetParent(popper);
if (offsetParent === getWindow(popper)) {
offsetParent = getDocumentElement(popper);
} // $FlowFixMe: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
/*:: offsetParent = (offsetParent: Element); */
if (placement === top) {
sideY = bottom;
y -= offsetParent.clientHeight - popperRect.height;
y *= gpuAcceleration ? 1 : -1;
}
if (placement === left) {
sideX = right;
x -= offsetParent.clientWidth - popperRect.width;
x *= gpuAcceleration ? 1 : -1;
}
}
var commonStyles = Object.assign({
position: position
}, adaptive && unsetSides);
if (gpuAcceleration) {
var _Object$assign;
return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
}
return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
}
function computeStyles(_ref3) {
var state = _ref3.state,
options = _ref3.options;
var _options$gpuAccelerat = options.gpuAcceleration,
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
_options$adaptive = options.adaptive,
adaptive = _options$adaptive === void 0 ? true : _options$adaptive;
var commonStyles = {
placement: getBasePlacement(state.placement),
popper: state.elements.popper,
popperRect: state.rects.popper,
gpuAcceleration: gpuAcceleration
};
if (state.modifiersData.popperOffsets != null) {
state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
offsets: state.modifiersData.popperOffsets,
position: state.options.strategy,
adaptive: adaptive
})));
}
if (state.modifiersData.arrow != null) {
state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
offsets: state.modifiersData.arrow,
position: 'absolute',
adaptive: false
})));
}
state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
'data-popper-placement': state.placement
});
} // eslint-disable-next-line import/no-unused-modules
var computeStyles$1 = {
name: 'computeStyles',
enabled: true,
phase: 'beforeWrite',
fn: computeStyles,
data: {}
};var passive = {
passive: true
};
function effect(_ref) {
var state = _ref.state,
instance = _ref.instance,
options = _ref.options;
var _options$scroll = options.scroll,
scroll = _options$scroll === void 0 ? true : _options$scroll,
_options$resize = options.resize,
resize = _options$resize === void 0 ? true : _options$resize;
var window = getWindow(state.elements.popper);
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
if (scroll) {
scrollParents.forEach(function (scrollParent) {
scrollParent.addEventListener('scroll', instance.update, passive);
});
}
if (resize) {
window.addEventListener('resize', instance.update, passive);
}
return function () {
if (scroll) {
scrollParents.forEach(function (scrollParent) {
scrollParent.removeEventListener('scroll', instance.update, passive);
});
}
if (resize) {
window.removeEventListener('resize', instance.update, passive);
}
};
} // eslint-disable-next-line import/no-unused-modules
var eventListeners = {
name: 'eventListeners',
enabled: true,
phase: 'write',
fn: function fn() {},
effect: effect,
data: {}
};var hash$1 = {
left: 'right',
right: 'left',
bottom: 'top',
top: 'bottom'
};
function getOppositePlacement(placement) {
return placement.replace(/left|right|bottom|top/g, function (matched) {
return hash$1[matched];
});
}var hash = {
start: 'end',
end: 'start'
};
function getOppositeVariationPlacement(placement) {
return placement.replace(/start|end/g, function (matched) {
return hash[matched];
});
}function getBoundingClientRect(element) {
var rect = element.getBoundingClientRect();
return {
width: rect.width,
height: rect.height,
top: rect.top,
right: rect.right,
bottom: rect.bottom,
left: rect.left,
x: rect.left,
y: rect.top
};
}function getWindowScroll(node) {
var win = getWindow(node);
var scrollLeft = win.pageXOffset;
var scrollTop = win.pageYOffset;
return {
scrollLeft: scrollLeft,
scrollTop: scrollTop
};
}function getWindowScrollBarX(element) {
// If <html> has a CSS width greater than the viewport, then this will be
// incorrect for RTL.
// Popper 1 is broken in this case and never had a bug report so let's assume
// it's not an issue. I don't think anyone ever specifies width on <html>
// anyway.
// Browsers where the left scrollbar doesn't cause an issue report `0` for
// this (e.g. Edge 2019, IE11, Safari)
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
}function getViewportRect(element) {
var win = getWindow(element);
var html = getDocumentElement(element);
var visualViewport = win.visualViewport;
var width = html.clientWidth;
var height = html.clientHeight;
var x = 0;
var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
// can be obscured underneath it.
// Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
// if it isn't open, so if this isn't available, the popper will be detected
// to overflow the bottom of the screen too early.
if (visualViewport) {
width = visualViewport.width;
height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
// In Chrome, it returns a value very close to 0 (+/-) but contains rounding
// errors due to floating point numbers, so we need to check precision.
// Safari returns a number <= 0, usually < -1 when pinch-zoomed
// Feature detection fails in mobile emulation mode in Chrome.
// Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
// 0.001
// Fallback here: "Not Safari" userAgent
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
x = visualViewport.offsetLeft;
y = visualViewport.offsetTop;
}
}
return {
width: width,
height: height,
x: x + getWindowScrollBarX(element),
y: y
};
}// of the `<html>` and `<body>` rect bounds if horizontally scrollable
function getDocumentRect(element) {
var html = getDocumentElement(element);
var winScroll = getWindowScroll(element);
var body = element.ownerDocument.body;
var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
var y = -winScroll.scrollTop;
if (getComputedStyle$1(body || html).direction === 'rtl') {
x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
}
return {
width: width,
height: height,
x: x,
y: y
};
}function isScrollParent(element) {
// Firefox wants us to check `-x` and `-y` variations as well
var _getComputedStyle = getComputedStyle$1(element),
overflow = _getComputedStyle.overflow,
overflowX = _getComputedStyle.overflowX,
overflowY = _getComputedStyle.overflowY;
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
}function getScrollParent(node) {
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
// $FlowFixMe: assume body is always available
return node.ownerDocument.body;
}
if (isHTMLElement(node) && isScrollParent(node)) {
return node;
}
return getScrollParent(getParentNode(node));
}/*
given a DOM element, return the list of all scroll parents, up the list of ancesors
until we get to the top window object. This list is what we attach scroll listeners
to, because if any of these parent elements scroll, we'll need to re-calculate the
reference element's position.
*/
function listScrollParents(element, list) {
if (list === void 0) {
list = [];
}
var scrollParent = getScrollParent(element);
var isBody = getNodeName(scrollParent) === 'body';
var win = getWindow(scrollParent);
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
var updatedList = list.concat(target);
return isBody ? updatedList : // $FlowFixMe: isBody tells us target will be an HTMLElement here
updatedList.concat(listScrollParents(getParentNode(target)));
}function rectToClientRect(rect) {
return Object.assign(Object.assign({}, rect), {}, {
left: rect.x,
top: rect.y,
right: rect.x + rect.width,
bottom: rect.y + rect.height
});
}function getInnerBoundingClientRect(element) {
var rect = getBoundingClientRect(element);
rect.top = rect.top + element.clientTop;
rect.left = rect.left + element.clientLeft;
rect.bottom = rect.top + element.clientHeight;
rect.right = rect.left + element.clientWidth;
rect.width = element.clientWidth;
rect.height = element.clientHeight;
rect.x = rect.left;
rect.y = rect.top;
return rect;
}
function getClientRectFromMixedType(element, clippingParent) {
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
} // A "clipping parent" is an overflowable container with the characteristic of
// clipping (or hiding) overflowing elements with a position different from
// `initial`
function getClippingParents(element) {
var clippingParents = listScrollParents(getParentNode(element));
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0;
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
if (!isElement(clipperElement)) {
return [];
} // $FlowFixMe: https://github.com/facebook/flow/issues/1414
return clippingParents.filter(function (clippingParent) {
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
});
} // Gets the maximum area that the element is visible in due to any number of
// clipping parents
function getClippingRect(element, boundary, rootBoundary) {
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
var firstClippingParent = clippingParents[0];
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
var rect = getClientRectFromMixedType(element, clippingParent);
accRect.top = Math.max(rect.top, accRect.top);
accRect.right = Math.min(rect.right, accRect.right);
accRect.bottom = Math.min(rect.bottom, accRect.bottom);
accRect.left = Math.max(rect.left, accRect.left);
return accRect;
}, getClientRectFromMixedType(element, firstClippingParent));
clippingRect.width = clippingRect.right - clippingRect.left;
clippingRect.height = clippingRect.bottom - clippingRect.top;
clippingRect.x = clippingRect.left;
clippingRect.y = clippingRect.top;
return clippingRect;
}function getVariation(placement) {
return placement.split('-')[1];
}function computeOffsets(_ref) {
var reference = _ref.reference,
element = _ref.element,
placement = _ref.placement;
var basePlacement = placement ? getBasePlacement(placement) : null;
var variation = placement ? getVariation(placement) : null;
var commonX = reference.x + reference.width / 2 - element.width / 2;
var commonY = reference.y + reference.height / 2 - element.height / 2;
var offsets;
switch (basePlacement) {
case top:
offsets = {
x: commonX,
y: reference.y - element.height
};
break;
case bottom:
offsets = {
x: commonX,
y: reference.y + reference.height
};
break;
case right:
offsets = {
x: reference.x + reference.width,
y: commonY
};
break;
case left:
offsets = {
x: reference.x - element.width,
y: commonY
};
break;
default:
offsets = {
x: reference.x,
y: reference.y
};
}
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
if (mainAxis != null) {
var len = mainAxis === 'y' ? 'height' : 'width';
switch (variation) {
case start:
offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2);
break;
case end:
offsets[mainAxis] = Math.floor(offsets[mainAxis]) + Math.ceil(reference[len] / 2 - element[len] / 2);
break;
}
}
return offsets;
}function detectOverflow(state, options) {
if (options === void 0) {
options = {};
}
var _options = options,
_options$placement = _options.placement,
placement = _options$placement === void 0 ? state.placement : _options$placement,
_options$boundary = _options.boundary,
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
_options$rootBoundary = _options.rootBoundary,
rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
_options$elementConte = _options.elementContext,
elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
_options$altBoundary = _options.altBoundary,
altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
_options$padding = _options.padding,
padding = _options$padding === void 0 ? 0 : _options$padding;
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
var altContext = elementContext === popper ? reference : popper;
var referenceElement = state.elements.reference;
var popperRect = state.rects.popper;
var element = state.elements[altBoundary ? altContext : elementContext];
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
var referenceClientRect = getBoundingClientRect(referenceElement);
var popperOffsets = computeOffsets({
reference: referenceClientRect,
element: popperRect,
strategy: 'absolute',
placement: placement
});
var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
// 0 or negative = within the clipping rect
var overflowOffsets = {
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
};
var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
if (elementContext === popper && offsetData) {
var offset = offsetData[placement];
Object.keys(overflowOffsets).forEach(function (key) {
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
overflowOffsets[key] += offset[axis] * multiply;
});
}
return overflowOffsets;
}/*:: type OverflowsMap = { [ComputedPlacement]: number }; */
/*;; type OverflowsMap = { [key in ComputedPlacement]: number }; */
function computeAutoPlacement(state, options) {
if (options === void 0) {
options = {};
}
var _options = options,
placement = _options.placement,
boundary = _options.boundary,
rootBoundary = _options.rootBoundary,
padding = _options.padding,
flipVariations = _options.flipVariations,
_options$allowedAutoP = _options.allowedAutoPlacements,
allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
var variation = getVariation(placement);
var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
return getVariation(placement) === variation;
}) : basePlacements; // $FlowFixMe
var allowedPlacements = placements$1.filter(function (placement) {
return allowedAutoPlacements.indexOf(placement) >= 0;
});
if (allowedPlacements.length === 0) {
allowedPlacements = placements$1;
} // $FlowFixMe: Flow seems to have problems with two array unions...
var overflows = allowedPlacements.reduce(function (acc, placement) {
acc[placement] = detectOverflow(state, {
placement: placement,
boundary: boundary,
rootBoundary: rootBoundary,
padding: padding
})[getBasePlacement(placement)];
return acc;
}, {});
return Object.keys(overflows).sort(function (a, b) {
return overflows[a] - overflows[b];
});
}function getExpandedFallbackPlacements(placement) {
if (getBasePlacement(placement) === auto) {
return [];
}
var oppositePlacement = getOppositePlacement(placement);
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
}
function flip(_ref) {
var state = _ref.state,
options = _ref.options,
name = _ref.name;
if (state.modifiersData[name]._skip) {
return;
}
var _options$mainAxis = options.mainAxis,
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
_options$altAxis = options.altAxis,
checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
specifiedFallbackPlacements = options.fallbackPlacements,
padding = options.padding,
boundary = options.boundary,
rootBoundary = options.rootBoundary,
altBoundary = options.altBoundary,
_options$flipVariatio = options.flipVariations,
flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
allowedAutoPlacements = options.allowedAutoPlacements;
var preferredPlacement = state.options.placement;
var basePlacement = getBasePlacement(preferredPlacement);
var isBasePlacement = basePlacement === preferredPlacement;
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
placement: placement,
boundary: boundary,
rootBoundary: rootBoundary,
padding: padding,
flipVariations: flipVariations,
allowedAutoPlacements: allowedAutoPlacements
}) : placement);
}, []);
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
var checksMap = new Map();
var makeFallbackChecks = true;
var firstFittingPlacement = placements[0];
for (var i = 0; i < placements.length; i++) {
var placement = placements[i];
var _basePlacement = getBasePlacement(placement);
var isStartVariation = getVariation(placement) === start;
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
var len = isVertical ? 'width' : 'height';
var overflow = detectOverflow(state, {
placement: placement,
boundary: boundary,
rootBoundary: rootBoundary,
altBoundary: altBoundary,
padding: padding
});
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
if (referenceRect[len] > popperRect[len]) {
mainVariationSide = getOppositePlacement(mainVariationSide);
}
var altVariationSide = getOppositePlacement(mainVariationSide);
var checks = [];
if (checkMainAxis) {
checks.push(overflow[_basePlacement] <= 0);
}
if (checkAltAxis) {
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
}
if (checks.every(function (check) {
return check;
})) {
firstFittingPlacement = placement;
makeFallbackChecks = false;
break;
}
checksMap.set(placement, checks);
}
if (makeFallbackChecks) {
// `2` may be desired in some cases – research later
var numberOfChecks = flipVariations ? 3 : 1;
var _loop = function _loop(_i) {
var fittingPlacement = placements.find(function (placement) {
var checks = checksMap.get(placement);
if (checks) {
return checks.slice(0, _i).every(function (check) {
return check;
});
}
});
if (fittingPlacement) {
firstFittingPlacement = fittingPlacement;
return "break";
}
};
for (var _i = numberOfChecks; _i > 0; _i--) {
var _ret = _loop(_i);
if (_ret === "break") break;
}
}
if (state.placement !== firstFittingPlacement) {
state.modifiersData[name]._skip = true;
state.placement = firstFittingPlacement;
state.reset = true;
}
} // eslint-disable-next-line import/no-unused-modules
var flip$1 = {
name: 'flip',
enabled: true,
phase: 'main',
fn: flip,
requiresIfExists: ['offset'],
data: {
_skip: false
}
};function getSideOffsets(overflow, rect, preventedOffsets) {
if (preventedOffsets === void 0) {
preventedOffsets = {
x: 0,
y: 0
};
}
return {
top: overflow.top - rect.height - preventedOffsets.y,
right: overflow.right - rect.width + preventedOffsets.x,
bottom: overflow.bottom - rect.height + preventedOffsets.y,
left: overflow.left - rect.width - preventedOffsets.x
};
}
function isAnySideFullyClipped(overflow) {
return [top, right, bottom, left].some(function (side) {
return overflow[side] >= 0;
});
}
function hide(_ref) {
var state = _ref.state,
name = _ref.name;
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
var preventedOffsets = state.modifiersData.preventOverflow;
var referenceOverflow = detectOverflow(state, {
elementContext: 'reference'
});
var popperAltOverflow = detectOverflow(state, {
altBoundary: true
});
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
state.modifiersData[name] = {
referenceClippingOffsets: referenceClippingOffsets,
popperEscapeOffsets: popperEscapeOffsets,
isReferenceHidden: isReferenceHidden,
hasPopperEscaped: hasPopperEscaped
};
state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
'data-popper-reference-hidden': isReferenceHidden,
'data-popper-escaped': hasPopperEscaped
});
} // eslint-disable-next-line import/no-unused-modules
var hide$1 = {
name: 'hide',
enabled: true,
phase: 'main',
requiresIfExists: ['preventOverflow'],
fn: hide
};function distanceAndSkiddingToXY(placement, rects, offset) {
var basePlacement = getBasePlacement(placement);
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
var _ref = typeof offset === 'function' ? offset(Object.assign(Object.assign({}, rects), {}, {
placement: placement
})) : offset,
skidding = _ref[0],
distance = _ref[1];
skidding = skidding || 0;
distance = (distance || 0) * invertDistance;
return [left, right].indexOf(basePlacement) >= 0 ? {
x: distance,
y: skidding
} : {
x: skidding,
y: distance
};
}
function offset(_ref2) {
var state = _ref2.state,
options = _ref2.options,
name = _ref2.name;
var _options$offset = options.offset,
offset = _options$offset === void 0 ? [0, 0] : _options$offset;
var data = placements.reduce(function (acc, placement) {
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
return acc;
}, {});
var _data$state$placement = data[state.placement],
x = _data$state$placement.x,
y = _data$state$placement.y;
if (state.modifiersData.popperOffsets != null) {
state.modifiersData.popperOffsets.x += x;
state.modifiersData.popperOffsets.y += y;
}
state.modifiersData[name] = data;
} // eslint-disable-next-line import/no-unused-modules
var offset$1 = {
name: 'offset',
enabled: true,
phase: 'main',
requires: ['popperOffsets'],
fn: offset
};function popperOffsets(_ref) {
var state = _ref.state,
name = _ref.name;
// Offsets are the actual position the popper needs to have to be
// properly positioned near its reference element
// This is the most basic placement, and will be adjusted by
// the modifiers in the next step
state.modifiersData[name] = computeOffsets({
reference: state.rects.reference,
element: state.rects.popper,
strategy: 'absolute',
placement: state.placement
});
} // eslint-disable-next-line import/no-unused-modules
var popperOffsets$1 = {
name: 'popperOffsets',
enabled: true,
phase: 'read',
fn: popperOffsets,
data: {}
};function getAltAxis(axis) {
return axis === 'x' ? 'y' : 'x';
}function preventOverflow(_ref) {
var state = _ref.state,
options = _ref.options,
name = _ref.name;
var _options$mainAxis = options.mainAxis,
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
_options$altAxis = options.altAxis,
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
boundary = options.boundary,
rootBoundary = options.rootBoundary,
altBoundary = options.altBoundary,
padding = options.padding,
_options$tether = options.tether,
tether = _options$tether === void 0 ? true : _options$tether,
_options$tetherOffset = options.tetherOffset,
tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
var overflow = detectOverflow(state, {
boundary: boundary,
rootBoundary: rootBoundary,
padding: padding,
altBoundary: altBoundary
});
var basePlacement = getBasePlacement(state.placement);
var variation = getVariation(state.placement);
var isBasePlacement = !variation;
var mainAxis = getMainAxisFromPlacement(basePlacement);
var altAxis = getAltAxis(mainAxis);
var popperOffsets = state.modifiersData.popperOffsets;
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign(Object.assign({}, state.rects), {}, {
placement: state.placement
})) : tetherOffset;
var data = {
x: 0,
y: 0
};
if (!popperOffsets) {
return;
}
if (checkMainAxis) {
var mainSide = mainAxis === 'y' ? top : left;
var altSide = mainAxis === 'y' ? bottom : right;
var len = mainAxis === 'y' ? 'height' : 'width';
var offset = popperOffsets[mainAxis];
var min = popperOffsets[mainAxis] + overflow[mainSide];
var max = popperOffsets[mainAxis] - overflow[altSide];
var additive = tether ? -popperRect[len] / 2 : 0;
var minLen = variation === start ? referenceRect[len] : popperRect[len];
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
// outside the reference bounds
var arrowElement = state.elements.arrow;
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
width: 0,
height: 0
};
var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
var arrowPaddingMin = arrowPaddingObject[mainSide];
var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
// to include its full size in the calculation. If the reference is small
// and near the edge of a boundary, the popper can overflow even if the
// reference is not overflowing as well (e.g. virtual elements with no
// width or height)
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
var preventedOffset = within(tether ? Math.min(min, tetherMin) : min, offset, tether ? Math.max(max, tetherMax) : max);
popperOffsets[mainAxis] = preventedOffset;
data[mainAxis] = preventedOffset - offset;
}
if (checkAltAxis) {
var _mainSide = mainAxis === 'x' ? top : left;
var _altSide = mainAxis === 'x' ? bottom : right;
var _offset = popperOffsets[altAxis];
var _min = _offset + overflow[_mainSide];
var _max = _offset - overflow[_altSide];
var _preventedOffset = within(_min, _offset, _max);
popperOffsets[altAxis] = _preventedOffset;
data[altAxis] = _preventedOffset - _offset;
}
state.modifiersData[name] = data;
} // eslint-disable-next-line import/no-unused-modules
var preventOverflow$1 = {
name: 'preventOverflow',
enabled: true,
phase: 'main',
fn: preventOverflow,
requiresIfExists: ['offset']
};function getHTMLElementScroll(element) {
return {
scrollLeft: element.scrollLeft,
scrollTop: element.scrollTop
};
}function getNodeScroll(node) {
if (node === getWindow(node) || !isHTMLElement(node)) {
return getWindowScroll(node);
} else {
return getHTMLElementScroll(node);
}
}// Composite means it takes into account transforms as well as layout.
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
if (isFixed === void 0) {
isFixed = false;
}
var documentElement = getDocumentElement(offsetParent);
var rect = getBoundingClientRect(elementOrVirtualElement);
var isOffsetParentAnElement = isHTMLElement(offsetParent);
var scroll = {
scrollLeft: 0,
scrollTop: 0
};
var offsets = {
x: 0,
y: 0
};
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
isScrollParent(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isHTMLElement(offsetParent)) {
offsets = getBoundingClientRect(offsetParent);
offsets.x += offsetParent.clientLeft;
offsets.y += offsetParent.clientTop;
} else if (documentElement) {
offsets.x = getWindowScrollBarX(documentElement);
}
}
return {
x: rect.left + scroll.scrollLeft - offsets.x,
y: rect.top + scroll.scrollTop - offsets.y,
width: rect.width,
height: rect.height
};
}function order(modifiers) {
var map = new Map();
var visited = new Set();
var result = [];
modifiers.forEach(function (modifier) {
map.set(modifier.name, modifier);
}); // On visiting object, check for its dependencies and visit them recursively
function sort(modifier) {
visited.add(modifier.name);
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
requires.forEach(function (dep) {
if (!visited.has(dep)) {
var depModifier = map.get(dep);
if (depModifier) {
sort(depModifier);
}
}
});
result.push(modifier);
}
modifiers.forEach(function (modifier) {
if (!visited.has(modifier.name)) {
// check for visited object
sort(modifier);
}
});
return result;
}
function orderModifiers(modifiers) {
// order based on dependencies
var orderedModifiers = order(modifiers); // order based on phase
return modifierPhases.reduce(function (acc, phase) {
return acc.concat(orderedModifiers.filter(function (modifier) {
return modifier.phase === phase;
}));
}, []);
}function debounce$1(fn) {
var pending;
return function () {
if (!pending) {
pending = new Promise(function (resolve) {
Promise.resolve().then(function () {
pending = undefined;
resolve(fn());
});
});
}
return pending;
};
}function mergeByName(modifiers) {
var merged = modifiers.reduce(function (merged, current) {
var existing = merged[current.name];
merged[current.name] = existing ? Object.assign(Object.assign(Object.assign({}, existing), current), {}, {
options: Object.assign(Object.assign({}, existing.options), current.options),
data: Object.assign(Object.assign({}, existing.data), current.data)
}) : current;
return merged;
}, {}); // IE11 does not support Object.values
return Object.keys(merged).map(function (key) {
return merged[key];
});
}var DEFAULT_OPTIONS = {
placement: 'bottom',
modifiers: [],
strategy: 'absolute'
};
function areValidElements() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return !args.some(function (element) {
return !(element && typeof element.getBoundingClientRect === 'function');
});
}
function popperGenerator(generatorOptions) {
if (generatorOptions === void 0) {
generatorOptions = {};
}
var _generatorOptions = generatorOptions,
_generatorOptions$def = _generatorOptions.defaultModifiers,
defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
_generatorOptions$def2 = _generatorOptions.defaultOptions,
defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
return function createPopper(reference, popper, options) {
if (options === void 0) {
options = defaultOptions;
}
var state = {
placement: 'bottom',
orderedModifiers: [],
options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
modifiersData: {},
elements: {
reference: reference,
popper: popper
},
attributes: {},
styles: {}
};
var effectCleanupFns = [];
var isDestroyed = false;
var instance = {
state: state,
setOptions: function setOptions(options) {
cleanupModifierEffects();
state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
state.scrollParents = {
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
popper: listScrollParents(popper)
}; // Orders the modifiers based on their dependencies and `phase`
// properties
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
state.orderedModifiers = orderedModifiers.filter(function (m) {
return m.enabled;
}); // Validate the provided modifiers so that the consumer will get warned
runModifierEffects();
return instance.update();
},
// Sync update – it will always be executed, even if not necessary. This
// is useful for low frequency updates where sync behavior simplifies the
// logic.
// For high frequency updates (e.g. `resize` and `scroll` events), always
// prefer the async Popper#update method
forceUpdate: function forceUpdate() {
if (isDestroyed) {
return;
}
var _state$elements = state.elements,
reference = _state$elements.reference,
popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
// anymore
if (!areValidElements(reference, popper)) {
return;
} // Store the reference and popper rects to be read by modifiers
state.rects = {
reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
popper: getLayoutRect(popper)
}; // Modifiers have the ability to reset the current update cycle. The
// most common use case for this is the `flip` modifier changing the
// placement, which then needs to re-run all the modifiers, because the
// logic was previously ran for the previous placement and is therefore
// stale/incorrect
state.reset = false;
state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
// is filled with the initial data specified by the modifier. This means
// it doesn't persist and is fresh on each update.
// To ensure persistent data, use `${name}#persistent`
state.orderedModifiers.forEach(function (modifier) {
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
});
for (var index = 0; index < state.orderedModifiers.length; index++) {
if (state.reset === true) {
state.reset = false;
index = -1;
continue;
}
var _state$orderedModifie = state.orderedModifiers[index],
fn = _state$orderedModifie.fn,
_state$orderedModifie2 = _state$orderedModifie.options,
_options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
name = _state$orderedModifie.name;
if (typeof fn === 'function') {
state = fn({
state: state,
options: _options,
name: name,
instance: instance
}) || state;
}
}
},
// Async and optimistically optimized update – it will not be executed if
// not necessary (debounced to run at most once-per-tick)
update: debounce$1(function () {
return new Promise(function (resolve) {
instance.forceUpdate();
resolve(state);
});
}),
destroy: function destroy() {
cleanupModifierEffects();
isDestroyed = true;
}
};
if (!areValidElements(reference, popper)) {
return instance;
}
instance.setOptions(options).then(function (state) {
if (!isDestroyed && options.onFirstUpdate) {
options.onFirstUpdate(state);
}
}); // Modifiers have the ability to execute arbitrary code before the first
// update cycle runs. They will be executed in the same order as the update
// cycle. This is useful when a modifier adds some persistent data that
// other modifiers need to use, but the modifier is run after the dependent
// one.
function runModifierEffects() {
state.orderedModifiers.forEach(function (_ref3) {
var name = _ref3.name,
_ref3$options = _ref3.options,
options = _ref3$options === void 0 ? {} : _ref3$options,
effect = _ref3.effect;
if (typeof effect === 'function') {
var cleanupFn = effect({
state: state,
name: name,
instance: instance,
options: options
});
var noopFn = function noopFn() {};
effectCleanupFns.push(cleanupFn || noopFn);
}
});
}
function cleanupModifierEffects() {
effectCleanupFns.forEach(function (fn) {
return fn();
});
effectCleanupFns = [];
}
return instance;
};
}var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
var createPopper = /*#__PURE__*/popperGenerator({
defaultModifiers: defaultModifiers
}); // eslint-disable-next-line import/no-unused-modules
/* global Map:readonly, Set:readonly, ArrayBuffer:readonly */
var hasElementType = typeof Element !== 'undefined';
var hasMap = typeof Map === 'function';
var hasSet = typeof Set === 'function';
var hasArrayBuffer = typeof ArrayBuffer === 'function' && !!ArrayBuffer.isView;
// Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js
function equal(a, b) {
// START: fast-deep-equal es6/index.js 3.1.1
if (a === b) return true;
if (a && b && typeof a == 'object' && typeof b == 'object') {
if (a.constructor !== b.constructor) return false;
var length, i, keys;
if (Array.isArray(a)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (!equal(a[i], b[i])) return false;
return true;
}
// START: Modifications:
// 1. Extra `has<Type> &&` helpers in initial condition allow es6 code
// to co-exist with es5.
// 2. Replace `for of` with es5 compliant iteration using `for`.
// Basically, take:
//
// ```js
// for (i of a.entries())
// if (!b.has(i[0])) return false;
// ```
//
// ... and convert to:
//
// ```js
// it = a.entries();
// while (!(i = it.next()).done)
// if (!b.has(i.value[0])) return false;
// ```
//
// **Note**: `i` access switches to `i.value`.
var it;
if (hasMap && (a instanceof Map) && (b instanceof Map)) {
if (a.size !== b.size) return false;
it = a.entries();
while (!(i = it.next()).done)
if (!b.has(i.value[0])) return false;
it = a.entries();
while (!(i = it.next()).done)
if (!equal(i.value[1], b.get(i.value[0]))) return false;
return true;
}
if (hasSet && (a instanceof Set) && (b instanceof Set)) {
if (a.size !== b.size) return false;
it = a.entries();
while (!(i = it.next()).done)
if (!b.has(i.value[0])) return false;
return true;
}
// END: Modifications
if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (a[i] !== b[i]) return false;
return true;
}
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) return false;
for (i = length; i-- !== 0;)
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
// END: fast-deep-equal
// START: react-fast-compare
// custom handling for DOM elements
if (hasElementType && a instanceof Element) return false;
// custom handling for React/Preact
for (i = length; i-- !== 0;) {
if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) {
// React-specific: avoid traversing React elements' _owner
// Preact-specific: avoid traversing Preact elements' __v and __o
// __v = $_original / $_vnode
// __o = $_owner
// These properties contain circular references and are not needed when
// comparing the actual elements (and not their owners)
// .$$typeof and ._store on just reasonable markers of elements
continue;
}
// all other properties should be traversed as usual
if (!equal(a[keys[i]], b[keys[i]])) return false;
}
// END: react-fast-compare
// START: fast-deep-equal
return true;
}
return a !== a && b !== b;
}
// end fast-deep-equal
var reactFastCompare = function isEqual(a, b) {
try {
return equal(a, b);
} catch (error) {
if (((error.message || '').match(/stack|recursion/i))) {
// warn on circular references, don't crash
// browsers give this different errors name and messages:
// chrome/safari: "RangeError", "Maximum call stack size exceeded"
// firefox: "InternalError", too much recursion"
// edge: "Error", "Out of stack space"
console.warn('react-fast-compare cannot handle circular refs');
return false;
}
// some other error. we should definitely know about these
throw error;
}
};var EMPTY_MODIFIERS$1 = [];
var usePopper = function usePopper(referenceElement, popperElement, options) {
if (options === void 0) {
options = {};
}
var prevOptions = React.useRef(null);
var optionsWithDefaults = {
onFirstUpdate: options.onFirstUpdate,
placement: options.placement || 'bottom',
strategy: options.strategy || 'absolute',
modifiers: options.modifiers || EMPTY_MODIFIERS$1
};
var _React$useState = React.useState({
styles: {
popper: {
position: optionsWithDefaults.strategy,
left: '0',
top: '0'
}
},
attributes: {}
}),
state = _React$useState[0],
setState = _React$useState[1];
var updateStateModifier = React.useMemo(function () {
return {
name: 'updateState',
enabled: true,
phase: 'write',
fn: function fn(_ref) {
var state = _ref.state;
var elements = Object.keys(state.elements);
setState({
styles: fromEntries(elements.map(function (element) {
return [element, state.styles[element] || {}];
})),
attributes: fromEntries(elements.map(function (element) {
return [element, state.attributes[element]];
}))
});
},
requires: ['computeStyles']
};
}, []);
var popperOptions = React.useMemo(function () {
var newOptions = {
onFirstUpdate: optionsWithDefaults.onFirstUpdate,
placement: optionsWithDefaults.placement,
strategy: optionsWithDefaults.strategy,
modifiers: [].concat(optionsWithDefaults.modifiers, [updateStateModifier, {
name: 'applyStyles',
enabled: false
}])
};
if (reactFastCompare(prevOptions.current, newOptions)) {
return prevOptions.current || newOptions;
} else {
prevOptions.current = newOptions;
return newOptions;
}
}, [optionsWithDefaults.onFirstUpdate, optionsWithDefaults.placement, optionsWithDefaults.strategy, optionsWithDefaults.modifiers, updateStateModifier]);
var popperInstanceRef = React.useRef();
useIsomorphicLayoutEffect(function () {
if (popperInstanceRef.current) {
popperInstanceRef.current.setOptions(popperOptions);
}
}, [popperOptions]);
useIsomorphicLayoutEffect(function () {
if (referenceElement == null || popperElement == null) {
return;
}
var createPopper$1 = options.createPopper || createPopper;
var popperInstance = createPopper$1(referenceElement, popperElement, popperOptions);
popperInstanceRef.current = popperInstance;
return function () {
popperInstance.destroy();
popperInstanceRef.current = null;
};
}, [referenceElement, popperElement, options.createPopper]);
return {
state: popperInstanceRef.current ? popperInstanceRef.current.state : null,
styles: state.styles,
attributes: state.attributes,
update: popperInstanceRef.current ? popperInstanceRef.current.update : null,
forceUpdate: popperInstanceRef.current ? popperInstanceRef.current.forceUpdate : null
};
};var NOOP = function NOOP() {
return void 0;
};
var NOOP_PROMISE = function NOOP_PROMISE() {
return Promise.resolve(null);
};
var EMPTY_MODIFIERS = [];
function Popper(_ref) {
var _ref$placement = _ref.placement,
placement = _ref$placement === void 0 ? 'bottom' : _ref$placement,
_ref$strategy = _ref.strategy,
strategy = _ref$strategy === void 0 ? 'absolute' : _ref$strategy,
_ref$modifiers = _ref.modifiers,
modifiers = _ref$modifiers === void 0 ? EMPTY_MODIFIERS : _ref$modifiers,
referenceElement = _ref.referenceElement,
onFirstUpdate = _ref.onFirstUpdate,
innerRef = _ref.innerRef,
children = _ref.children;
var referenceNode = React.useContext(ManagerReferenceNodeContext);
var _React$useState = React.useState(null),
popperElement = _React$useState[0],
setPopperElement = _React$useState[1];
var _React$useState2 = React.useState(null),
arrowElement = _React$useState2[0],
setArrowElement = _React$useState2[1];
React.useEffect(function () {
setRef(innerRef, popperElement);
}, [innerRef, popperElement]);
var options = React.useMemo(function () {
return {
placement: placement,
strategy: strategy,
onFirstUpdate: onFirstUpdate,
modifiers: [].concat(modifiers, [{
name: 'arrow',
enabled: arrowElement != null,
options: {
element: arrowElement
}
}])
};
}, [placement, strategy, onFirstUpdate, modifiers, arrowElement]);
var _usePopper = usePopper(referenceElement || referenceNode, popperElement, options),
state = _usePopper.state,
styles = _usePopper.styles,
forceUpdate = _usePopper.forceUpdate,
update = _usePopper.update;
var childrenProps = React.useMemo(function () {
return {
ref: setPopperElement,
style: styles.popper,
placement: state ? state.placement : placement,
hasPopperEscaped: state && state.modifiersData.hide ? state.modifiersData.hide.hasPopperEscaped : null,
isReferenceHidden: state && state.modifiersData.hide ? state.modifiersData.hide.isReferenceHidden : null,
arrowProps: {
style: styles.arrow,
ref: setArrowElement
},
forceUpdate: forceUpdate || NOOP,
update: update || NOOP_PROMISE
};
}, [setPopperElement, setArrowElement, placement, state, styles, update, forceUpdate]);
return unwrapArray(children)(childrenProps);
}/**
* The base implementation of `_.invert` and `_.invertBy` which inverts
* `object` with values transformed by `iteratee` and set by `setter`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform values.
* @param {Object} accumulator The initial inverted object.
* @returns {Function} Returns `accumulator`.
*/
function baseInverter(object, setter, iteratee, accumulator) {
baseForOwn(object, function(value, key, object) {
setter(accumulator, iteratee(value), key, object);
});
return accumulator;
}/**
* Creates a function like `_.invertBy`.
*
* @private
* @param {Function} setter The function to set accumulator values.
* @param {Function} toIteratee The function to resolve iteratees.
* @returns {Function} Returns the new inverter function.
*/
function createInverter(setter, toIteratee) {
return function(object, iteratee) {
return baseInverter(object, setter, toIteratee(iteratee), {});
};
}/** Used for built-in method references. */
var objectProto$3 = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto$3.toString;
/**
* Creates an object composed of the inverted keys and values of `object`.
* If `object` contains duplicate values, subsequent values overwrite
* property assignments of previous values.
*
* @static
* @memberOf _
* @since 0.7.0
* @category Object
* @param {Object} object The object to invert.
* @returns {Object} Returns the new inverted object.
* @example
*
* var object = { 'a': 1, 'b': 2, 'c': 1 };
*
* _.invert(object);
* // => { '1': 'c', '2': 'b' }
*/
var invert = createInverter(function(result, value, key) {
if (value != null &&
typeof value.toString != 'function') {
value = nativeObjectToString.call(value);
}
result[value] = key;
}, constant(identity));
var _invert = invert;var positionsMapping = {
'top center': 'top',
'top left': 'top-start',
'top right': 'top-end',
'bottom center': 'bottom',
'bottom left': 'bottom-start',
'bottom right': 'bottom-end',
'right center': 'right',
'left center': 'left'
};
keys(positionsMapping);
var placementMapping = _invert(positionsMapping);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$5(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}var ReferenceProxy = /*#__PURE__*/function () {
function ReferenceProxy(refObject) {
this.ref = refObject;
}
var _proto = ReferenceProxy.prototype;
_proto.getBoundingClientRect = function getBoundingClientRect() {
return _invoke(this.ref.current, 'getBoundingClientRect') || {};
};
_createClass$5(ReferenceProxy, [{
key: "clientWidth",
get: function get() {
return this.getBoundingClientRect().width;
}
}, {
key: "clientHeight",
get: function get() {
return this.getBoundingClientRect().height;
}
}, {
key: "parentNode",
get: function get() {
return this.ref.current ? this.ref.current.parentNode : undefined;
}
}]);
return ReferenceProxy;
}();
/**
* Popper.js does not support ref objects from `createRef()` as referenceElement. If we will pass
* directly `ref`, `ref.current` will be `null` at the render process. We use memoize to keep the
* same reference between renders.
*
* @see https://popper.js.org/popper-documentation.html#referenceObject
*/
var createReferenceProxy = memoize(function (reference) {
return new ReferenceProxy(isRefObject(reference) ? reference : {
current: reference
});
});
var createReferenceProxy$1 = createReferenceProxy;/**
* A PopupContent displays the content body of a Popover.
*/
function PopupContent(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('content', className);
var rest = getUnhandledProps$1(PopupContent, props);
var ElementType = getElementType(PopupContent, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
PopupContent.handledProps = ["as", "children", "className", "content"];
PopupContent.propTypes = {};
PopupContent.create = createShorthandFactory(PopupContent, function (children) {
return {
children: children
};
});/**
* A PopupHeader displays a header in a Popover.
*/
function PopupHeader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('header', className);
var rest = getUnhandledProps$1(PopupHeader, props);
var ElementType = getElementType(PopupHeader, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
PopupHeader.handledProps = ["as", "children", "className", "content"];
PopupHeader.propTypes = {};
PopupHeader.create = createShorthandFactory(PopupHeader, function (children) {
return {
children: children
};
});/**
* A Popup displays additional information on top of a page.
*/
var Popup = /*#__PURE__*/function (_Component) {
_inheritsLoose(Popup, _Component);
function Popup() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.state = {};
_this.open = false;
_this.zIndexWasSynced = false;
_this.triggerRef = /*#__PURE__*/React__default.createRef();
_this.getPortalProps = function () {
var portalProps = {};
var _this$props = _this.props,
on = _this$props.on,
hoverable = _this$props.hoverable;
var normalizedOn = isArray$1(on) ? on : [on];
if (hoverable) {
portalProps.closeOnPortalMouseLeave = true;
portalProps.mouseLeaveDelay = 300;
}
if (includes(normalizedOn, 'hover')) {
portalProps.openOnTriggerClick = false;
portalProps.closeOnTriggerClick = false;
portalProps.openOnTriggerMouseEnter = true;
portalProps.closeOnTriggerMouseLeave = true; // Taken from SUI: https://git.io/vPmCm
portalProps.mouseLeaveDelay = 70;
portalProps.mouseEnterDelay = 50;
}
if (includes(normalizedOn, 'click')) {
portalProps.openOnTriggerClick = true;
portalProps.closeOnTriggerClick = true;
portalProps.closeOnDocumentClick = true;
}
if (includes(normalizedOn, 'focus')) {
portalProps.openOnTriggerFocus = true;
portalProps.closeOnTriggerBlur = true;
}
return portalProps;
};
_this.hideOnScroll = function (e) {
_this.setState({
closed: true
});
instance.unsub('scroll', _this.hideOnScroll, {
target: window
});
_this.timeoutId = setTimeout(function () {
_this.setState({
closed: false
});
}, 50);
_this.handleClose(e);
};
_this.handleClose = function (e) {
_invoke(_this.props, 'onClose', e, _extends$6({}, _this.props, {
open: false
}));
};
_this.handleOpen = function (e) {
_invoke(_this.props, 'onOpen', e, _extends$6({}, _this.props, {
open: true
}));
};
_this.handlePortalMount = function (e) {
_invoke(_this.props, 'onMount', e, _this.props);
};
_this.handlePortalUnmount = function (e) {
_this.positionUpdate = null;
_invoke(_this.props, 'onUnmount', e, _this.props);
};
_this.renderContent = function (_ref) {
var popperPlacement = _ref.placement,
popperRef = _ref.ref,
update = _ref.update,
popperStyle = _ref.style;
var _this$props2 = _this.props,
basic = _this$props2.basic,
children = _this$props2.children,
className = _this$props2.className,
content = _this$props2.content,
hideOnScroll = _this$props2.hideOnScroll,
flowing = _this$props2.flowing,
header = _this$props2.header,
inverted = _this$props2.inverted,
popper = _this$props2.popper,
size = _this$props2.size,
style = _this$props2.style,
wide = _this$props2.wide;
var contentRestProps = _this.state.contentRestProps;
_this.positionUpdate = update;
var classes = cx('ui', placementMapping[popperPlacement], size, useKeyOrValueAndKey(wide, 'wide'), useKeyOnly(basic, 'basic'), useKeyOnly(flowing, 'flowing'), useKeyOnly(inverted, 'inverted'), 'popup transition visible', className);
var ElementType = getElementType(Popup, _this.props);
var styles = _extends$6({
// Heads up! We need default styles to get working correctly `flowing`
left: 'auto',
right: 'auto',
// This is required to be properly positioned inside wrapping `div`
position: 'initial'
}, style);
var innerElement = /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, contentRestProps, {
className: classes,
style: styles
}), isNil$1(children) ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, PopupHeader.create(header, {
autoGenerateKey: false
}), PopupContent.create(content, {
autoGenerateKey: false
})) : children, hideOnScroll && /*#__PURE__*/React__default.createElement(lib, {
on: _this.hideOnScroll,
name: "scroll",
target: "window"
})); // https://github.com/popperjs/popper-core/blob/f1f9d1ab75b6b0e962f90a5b2a50f6cfd307d794/src/createPopper.js#L136-L137
// Heads up!
// A wrapping `div` there is a pure magic, it's required as Popper warns on margins that are
// defined by SUI CSS. It also means that this `div` will be positioned instead of `content`.
return createHTMLDivision(popper || {}, {
overrideProps: {
children: innerElement,
ref: popperRef,
style: _extends$6({
// Fixes layout for floated elements
// https://github.com/Semantic-Org/Semantic-UI-React/issues/4092
display: 'flex'
}, popperStyle)
}
});
};
return _this;
}
Popup.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
if (state.closed || state.disabled) return {};
var unhandledProps = getUnhandledProps$1(Popup, props);
var contentRestProps = reduce(unhandledProps, function (acc, val, key) {
if (!includes(Portal$1.handledProps, key)) acc[key] = val;
return acc;
}, {});
var portalRestProps = _pick(unhandledProps, Portal$1.handledProps);
return {
contentRestProps: contentRestProps,
portalRestProps: portalRestProps
};
};
var _proto = Popup.prototype;
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
var depsEqual = shallowequal(this.props.popperDependencies, prevProps.popperDependencies);
if (!depsEqual) {
this.handleUpdate();
}
};
_proto.componentWillUnmount = function componentWillUnmount() {
clearTimeout(this.timeoutId);
};
_proto.handleUpdate = function handleUpdate() {
if (this.positionUpdate) this.positionUpdate();
};
_proto.render = function render() {
var _this2 = this;
var _this$props3 = this.props,
context = _this$props3.context,
disabled = _this$props3.disabled,
eventsEnabled = _this$props3.eventsEnabled,
offset = _this$props3.offset,
pinned = _this$props3.pinned,
popper = _this$props3.popper,
popperModifiers = _this$props3.popperModifiers,
position = _this$props3.position,
positionFixed = _this$props3.positionFixed,
trigger = _this$props3.trigger;
var _this$state = this.state,
closed = _this$state.closed,
portalRestProps = _this$state.portalRestProps;
if (closed || disabled) {
return trigger;
}
var modifiers = [{
name: 'arrow',
enabled: false
}, {
name: 'eventListeners',
options: {
scroll: !!eventsEnabled,
resize: !!eventsEnabled
}
}, {
name: 'flip',
enabled: !pinned
}, {
name: 'preventOverflow',
enabled: !!offset
}, {
name: 'offset',
enabled: !!offset,
options: {
offset: offset
}
}].concat(popperModifiers, [// We are syncing zIndex from `.ui.popup.content` to avoid layering issues as in SUIR we are using an additional
// `div` for Popper.js
// https://github.com/Semantic-Org/Semantic-UI-React/issues/4083
{
name: 'syncZIndex',
enabled: true,
phase: 'beforeRead',
fn: function fn(_ref2) {
var _popper$style;
var state = _ref2.state;
if (_this2.zIndexWasSynced) {
return;
} // if zIndex defined in <Popup popper={{ style: {} }} /> there is no sense to override it
var definedZIndex = popper == null ? void 0 : (_popper$style = popper.style) == null ? void 0 : _popper$style.zIndex;
if (isUndefined(definedZIndex)) {
// eslint-disable-next-line no-param-reassign
state.elements.popper.style.zIndex = window.getComputedStyle(state.elements.popper.firstChild).zIndex;
}
_this2.zIndexWasSynced = true;
},
effect: function effect() {
return function () {
_this2.zIndexWasSynced = false;
};
}
}]);
var referenceElement = createReferenceProxy$1(isNil(context) ? this.triggerRef : context);
var mergedPortalProps = _extends$6({}, this.getPortalProps(), portalRestProps);
return /*#__PURE__*/React__default.createElement(Portal$1, _extends$6({}, mergedPortalProps, {
onClose: this.handleClose,
onMount: this.handlePortalMount,
onOpen: this.handleOpen,
onUnmount: this.handlePortalUnmount,
trigger: trigger,
triggerRef: this.triggerRef
}), /*#__PURE__*/React__default.createElement(Popper, {
modifiers: modifiers,
placement: positionsMapping[position],
strategy: positionFixed ? 'fixed' : null,
referenceElement: referenceElement
}, this.renderContent));
};
return Popup;
}(Component);
Popup.handledProps = ["as", "basic", "children", "className", "content", "context", "disabled", "eventsEnabled", "flowing", "header", "hideOnScroll", "hoverable", "inverted", "offset", "on", "onClose", "onMount", "onOpen", "onUnmount", "pinned", "popper", "popperDependencies", "popperModifiers", "position", "positionFixed", "size", "style", "trigger", "wide"];
Popup.propTypes = {};
Popup.defaultProps = {
disabled: false,
eventsEnabled: true,
on: ['click', 'hover'],
pinned: false,
popperModifiers: [],
position: 'top left'
};
Popup.Content = PopupContent;
Popup.Header = PopupHeader;/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeIsFinite = root$2.isFinite,
nativeMin$4 = Math.min;
/**
* Creates a function like `_.round`.
*
* @private
* @param {string} methodName The name of the `Math` method to use when rounding.
* @returns {Function} Returns the new round function.
*/
function createRound(methodName) {
var func = Math[methodName];
return function(number, precision) {
number = toNumber$1(number);
precision = precision == null ? 0 : nativeMin$4(toInteger(precision), 292);
if (precision && nativeIsFinite(number)) {
// Shift with exponential notation to avoid floating-point issues.
// See [MDN](https://mdn.io/round#Examples) for more details.
var pair = (toString(number) + 'e').split('e'),
value = func(pair[0] + 'e' + (+pair[1] + precision));
pair = (toString(value) + 'e').split('e');
return +(pair[0] + 'e' + (+pair[1] - precision));
}
return func(number);
};
}/**
* Computes `number` rounded to `precision`.
*
* @static
* @memberOf _
* @since 3.10.0
* @category Math
* @param {number} number The number to round.
* @param {number} [precision=0] The precision to round to.
* @returns {number} Returns the rounded number.
* @example
*
* _.round(4.006);
* // => 4
*
* _.round(4.006, 2);
* // => 4.01
*
* _.round(4060, -2);
* // => 4100
*/
var round = createRound('round');
var _round = round;/**
* Clamps `number` within the inclusive `lower` and `upper` bounds.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Number
* @param {number} number The number to clamp.
* @param {number} [lower] The lower bound.
* @param {number} upper The upper bound.
* @returns {number} Returns the clamped number.
* @example
*
* _.clamp(-10, -5, 5);
* // => -5
*
* _.clamp(10, -5, 5);
* // => 5
*/
function clamp(number, lower, upper) {
if (upper === undefined) {
upper = lower;
lower = undefined;
}
if (upper !== undefined) {
upper = toNumber$1(upper);
upper = upper === upper ? upper : 0;
}
if (lower !== undefined) {
lower = toNumber$1(lower);
lower = lower === lower ? lower : 0;
}
return baseClamp(toNumber$1(number), lower, upper);
}/**
* A progress bar shows the progression of a task.
*/
var Progress = /*#__PURE__*/function (_Component) {
_inheritsLoose(Progress, _Component);
function Progress() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.calculatePercent = function () {
var _this$props = _this.props,
percent = _this$props.percent,
total = _this$props.total,
value = _this$props.value;
if (!isUndefined(percent)) return percent;
if (!isUndefined(total) && !isUndefined(value)) return value / total * 100;
};
_this.computeValueText = function (percent) {
var _this$props2 = _this.props,
progress = _this$props2.progress,
total = _this$props2.total,
value = _this$props2.value;
if (progress === 'value') return value;
if (progress === 'ratio') return value + "/" + total;
return percent + "%";
};
_this.getPercent = function () {
var _this$props3 = _this.props,
precision = _this$props3.precision,
progress = _this$props3.progress,
total = _this$props3.total,
value = _this$props3.value;
var percent = clamp(_this.calculatePercent(), 0, 100);
if (!isUndefined(total) && !isUndefined(value) && progress === 'value') {
return value / total * 100;
}
if (progress === 'value') return value;
if (isUndefined(precision)) return percent;
return _round(percent, precision);
};
_this.isAutoSuccess = function () {
var _this$props4 = _this.props,
autoSuccess = _this$props4.autoSuccess,
percent = _this$props4.percent,
total = _this$props4.total,
value = _this$props4.value;
return autoSuccess && (percent >= 100 || value >= total);
};
_this.renderLabel = function () {
var _this$props5 = _this.props,
children = _this$props5.children,
content = _this$props5.content,
label = _this$props5.label;
if (!isNil$1(children)) return /*#__PURE__*/React__default.createElement("div", {
className: "label"
}, children);
if (!isNil$1(content)) return /*#__PURE__*/React__default.createElement("div", {
className: "label"
}, content);
return createHTMLDivision(label, {
autoGenerateKey: false,
defaultProps: {
className: 'label'
}
});
};
_this.renderProgress = function (percent) {
var _this$props6 = _this.props,
precision = _this$props6.precision,
progress = _this$props6.progress;
if (!progress && isUndefined(precision)) return;
return /*#__PURE__*/React__default.createElement("div", {
className: "progress"
}, _this.computeValueText(percent));
};
return _this;
}
var _proto = Progress.prototype;
_proto.render = function render() {
var _this$props7 = this.props,
active = _this$props7.active,
attached = _this$props7.attached,
className = _this$props7.className,
color = _this$props7.color,
disabled = _this$props7.disabled,
error = _this$props7.error,
indicating = _this$props7.indicating,
inverted = _this$props7.inverted,
size = _this$props7.size,
success = _this$props7.success,
warning = _this$props7.warning;
var classes = cx('ui', color, size, useKeyOnly(active || indicating, 'active'), useKeyOnly(disabled, 'disabled'), useKeyOnly(error, 'error'), useKeyOnly(indicating, 'indicating'), useKeyOnly(inverted, 'inverted'), useKeyOnly(success || this.isAutoSuccess(), 'success'), useKeyOnly(warning, 'warning'), useValueAndKey(attached, 'attached'), 'progress', className);
var rest = getUnhandledProps$1(Progress, this.props);
var ElementType = getElementType(Progress, this.props);
var percent = this.getPercent() || 0;
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
"data-percent": Math.floor(percent)
}), /*#__PURE__*/React__default.createElement("div", {
className: "bar",
style: {
width: percent + "%"
}
}, this.renderProgress(percent)), this.renderLabel());
};
return Progress;
}(Component);
Progress.handledProps = ["active", "as", "attached", "autoSuccess", "children", "className", "color", "content", "disabled", "error", "indicating", "inverted", "label", "percent", "precision", "progress", "size", "success", "total", "value", "warning"];
Progress.propTypes = {};
var Progress$1 = Progress;/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH$1 = 4294967295;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin$3 = Math.min;
/**
* Invokes the iteratee `n` times, returning an array of the results of
* each invocation. The iteratee is invoked with one argument; (index).
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the array of results.
* @example
*
* _.times(3, String);
* // => ['0', '1', '2']
*
* _.times(4, _.constant(0));
* // => [0, 0, 0, 0]
*/
function times(n, iteratee) {
n = toInteger(n);
if (n < 1 || n > MAX_SAFE_INTEGER) {
return [];
}
var index = MAX_ARRAY_LENGTH$1,
length = nativeMin$3(n, MAX_ARRAY_LENGTH$1);
iteratee = castFunction(iteratee);
n -= MAX_ARRAY_LENGTH$1;
var result = baseTimes(length, iteratee);
while (++index < n) {
iteratee(index);
}
return result;
}/**
* An internal icon sub-component for Rating component
*/
var RatingIcon = /*#__PURE__*/function (_Component) {
_inheritsLoose(RatingIcon, _Component);
function RatingIcon() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleClick = function (e) {
_invoke(_this.props, 'onClick', e, _this.props);
};
_this.handleKeyUp = function (e) {
_invoke(_this.props, 'onKeyUp', e, _this.props);
switch (keyboardKey_1.getCode(e)) {
case keyboardKey_1.Enter:
case keyboardKey_1.Spacebar:
e.preventDefault();
_invoke(_this.props, 'onClick', e, _this.props);
break;
}
};
_this.handleMouseEnter = function (e) {
_invoke(_this.props, 'onMouseEnter', e, _this.props);
};
return _this;
}
var _proto = RatingIcon.prototype;
_proto.render = function render() {
var _this$props = this.props,
active = _this$props.active,
className = _this$props.className,
selected = _this$props.selected;
var classes = cx(useKeyOnly(active, 'active'), useKeyOnly(selected, 'selected'), 'icon', className);
var rest = getUnhandledProps$1(RatingIcon, this.props);
var ElementType = getElementType(RatingIcon, this.props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
onClick: this.handleClick,
onKeyUp: this.handleKeyUp,
onMouseEnter: this.handleMouseEnter,
role: "radio"
}));
};
return RatingIcon;
}(Component);
RatingIcon.handledProps = ["active", "as", "className", "index", "onClick", "onKeyUp", "onMouseEnter", "selected"];
RatingIcon.propTypes = {};
RatingIcon.defaultProps = {
as: 'i'
};/**
* A rating indicates user interest in content.
*/
var Rating = /*#__PURE__*/function (_Component) {
_inheritsLoose(Rating, _Component);
function Rating() {
var _this;
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
_args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(_args)) || this;
_this.handleIconClick = function (e, _ref) {
var index = _ref.index;
var _this$props = _this.props,
clearable = _this$props.clearable,
disabled = _this$props.disabled,
maxRating = _this$props.maxRating,
onRate = _this$props.onRate;
var rating = _this.state.rating;
if (disabled) return; // default newRating is the clicked icon
// allow toggling a binary rating
// allow clearing ratings
var newRating = index + 1;
if (clearable === 'auto' && maxRating === 1) {
newRating = +!rating;
} else if (clearable === true && newRating === rating) {
newRating = 0;
} // set rating
_this.setState({
rating: newRating,
isSelecting: false
});
if (onRate) onRate(e, _extends$6({}, _this.props, {
rating: newRating
}));
};
_this.handleIconMouseEnter = function (e, _ref2) {
var index = _ref2.index;
if (_this.props.disabled) return;
_this.setState({
selectedIndex: index,
isSelecting: true
});
};
_this.handleMouseLeave = function () {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
_invoke.apply(void 0, [_this.props, 'onMouseLeave'].concat(args));
if (_this.props.disabled) return;
_this.setState({
selectedIndex: -1,
isSelecting: false
});
};
return _this;
}
var _proto = Rating.prototype;
_proto.render = function render() {
var _this2 = this;
var _this$props2 = this.props,
className = _this$props2.className,
disabled = _this$props2.disabled,
icon = _this$props2.icon,
maxRating = _this$props2.maxRating,
size = _this$props2.size;
var _this$state = this.state,
rating = _this$state.rating,
selectedIndex = _this$state.selectedIndex,
isSelecting = _this$state.isSelecting;
var classes = cx('ui', icon, size, useKeyOnly(disabled, 'disabled'), useKeyOnly(isSelecting && !disabled && selectedIndex >= 0, 'selected'), 'rating', className);
var rest = getUnhandledProps$1(Rating, this.props);
var ElementType = getElementType(Rating, this.props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
role: "radiogroup",
onMouseLeave: this.handleMouseLeave,
tabIndex: disabled ? 0 : -1
}), times(maxRating, function (i) {
return /*#__PURE__*/React__default.createElement(RatingIcon, {
tabIndex: disabled ? -1 : 0,
active: rating >= i + 1,
"aria-checked": rating === i + 1,
"aria-posinset": i + 1,
"aria-setsize": maxRating,
index: i,
key: i,
onClick: _this2.handleIconClick,
onMouseEnter: _this2.handleIconMouseEnter,
selected: selectedIndex >= i && isSelecting
});
}));
};
return Rating;
}(ModernAutoControlledComponent);
Rating.handledProps = ["as", "className", "clearable", "defaultRating", "disabled", "icon", "maxRating", "onRate", "rating", "size"];
Rating.propTypes = {};
Rating.autoControlledProps = ['rating'];
Rating.defaultProps = {
clearable: 'auto',
maxRating: 1
};
Rating.Icon = RatingIcon;function _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;
}/** Used to store function metadata. */
var metaMap = WeakMap$1 && new WeakMap$1;
var metaMap$1 = metaMap;/**
* The base implementation of `setData` without support for hot loop shorting.
*
* @private
* @param {Function} func The function to associate metadata with.
* @param {*} data The metadata.
* @returns {Function} Returns `func`.
*/
var baseSetData = !metaMap$1 ? identity : function(func, data) {
metaMap$1.set(func, data);
return func;
};
var baseSetData$1 = baseSetData;/**
* Creates a function that produces an instance of `Ctor` regardless of
* whether it was invoked as part of a `new` expression or by `call` or `apply`.
*
* @private
* @param {Function} Ctor The constructor to wrap.
* @returns {Function} Returns the new wrapped function.
*/
function createCtor(Ctor) {
return function() {
// Use a `switch` statement to work with class constructors. See
// http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
// for more details.
var args = arguments;
switch (args.length) {
case 0: return new Ctor;
case 1: return new Ctor(args[0]);
case 2: return new Ctor(args[0], args[1]);
case 3: return new Ctor(args[0], args[1], args[2]);
case 4: return new Ctor(args[0], args[1], args[2], args[3]);
case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
}
var thisBinding = baseCreate$1(Ctor.prototype),
result = Ctor.apply(thisBinding, args);
// Mimic the constructor's `return` behavior.
// See https://es5.github.io/#x13.2.2 for more details.
return isObject$2(result) ? result : thisBinding;
};
}/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG$6 = 1;
/**
* Creates a function that wraps `func` to invoke it with the optional `this`
* binding of `thisArg`.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createBind(func, bitmask, thisArg) {
var isBind = bitmask & WRAP_BIND_FLAG$6,
Ctor = createCtor(func);
function wrapper() {
var fn = (this && this !== root$2 && this instanceof wrapper) ? Ctor : func;
return fn.apply(isBind ? thisArg : this, arguments);
}
return wrapper;
}/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$3 = Math.max;
/**
* Creates an array that is the composition of partially applied arguments,
* placeholders, and provided arguments into a single array of arguments.
*
* @private
* @param {Array} args The provided arguments.
* @param {Array} partials The arguments to prepend to those provided.
* @param {Array} holders The `partials` placeholder indexes.
* @params {boolean} [isCurried] Specify composing for a curried function.
* @returns {Array} Returns the new array of composed arguments.
*/
function composeArgs(args, partials, holders, isCurried) {
var argsIndex = -1,
argsLength = args.length,
holdersLength = holders.length,
leftIndex = -1,
leftLength = partials.length,
rangeLength = nativeMax$3(argsLength - holdersLength, 0),
result = Array(leftLength + rangeLength),
isUncurried = !isCurried;
while (++leftIndex < leftLength) {
result[leftIndex] = partials[leftIndex];
}
while (++argsIndex < holdersLength) {
if (isUncurried || argsIndex < argsLength) {
result[holders[argsIndex]] = args[argsIndex];
}
}
while (rangeLength--) {
result[leftIndex++] = args[argsIndex++];
}
return result;
}/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$2 = Math.max;
/**
* This function is like `composeArgs` except that the arguments composition
* is tailored for `_.partialRight`.
*
* @private
* @param {Array} args The provided arguments.
* @param {Array} partials The arguments to append to those provided.
* @param {Array} holders The `partials` placeholder indexes.
* @params {boolean} [isCurried] Specify composing for a curried function.
* @returns {Array} Returns the new array of composed arguments.
*/
function composeArgsRight(args, partials, holders, isCurried) {
var argsIndex = -1,
argsLength = args.length,
holdersIndex = -1,
holdersLength = holders.length,
rightIndex = -1,
rightLength = partials.length,
rangeLength = nativeMax$2(argsLength - holdersLength, 0),
result = Array(rangeLength + rightLength),
isUncurried = !isCurried;
while (++argsIndex < rangeLength) {
result[argsIndex] = args[argsIndex];
}
var offset = argsIndex;
while (++rightIndex < rightLength) {
result[offset + rightIndex] = partials[rightIndex];
}
while (++holdersIndex < holdersLength) {
if (isUncurried || argsIndex < argsLength) {
result[offset + holders[holdersIndex]] = args[argsIndex++];
}
}
return result;
}/**
* Gets the number of `placeholder` occurrences in `array`.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} placeholder The placeholder to search for.
* @returns {number} Returns the placeholder count.
*/
function countHolders(array, placeholder) {
var length = array.length,
result = 0;
while (length--) {
if (array[length] === placeholder) {
++result;
}
}
return result;
}/**
* The function whose prototype chain sequence wrappers inherit from.
*
* @private
*/
function baseLodash() {
// No operation performed.
}/** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = 4294967295;
/**
* Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
*
* @private
* @constructor
* @param {*} value The value to wrap.
*/
function LazyWrapper(value) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__dir__ = 1;
this.__filtered__ = false;
this.__iteratees__ = [];
this.__takeCount__ = MAX_ARRAY_LENGTH;
this.__views__ = [];
}
// Ensure `LazyWrapper` is an instance of `baseLodash`.
LazyWrapper.prototype = baseCreate$1(baseLodash.prototype);
LazyWrapper.prototype.constructor = LazyWrapper;/**
* Gets metadata for `func`.
*
* @private
* @param {Function} func The function to query.
* @returns {*} Returns the metadata for `func`.
*/
var getData = !metaMap$1 ? noop : function(func) {
return metaMap$1.get(func);
};
var getData$1 = getData;/** Used to lookup unminified function names. */
var realNames = {};
var realNames$1 = realNames;/** Used for built-in method references. */
var objectProto$2 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
/**
* Gets the name of `func`.
*
* @private
* @param {Function} func The function to query.
* @returns {string} Returns the function name.
*/
function getFuncName(func) {
var result = (func.name + ''),
array = realNames$1[result],
length = hasOwnProperty$1.call(realNames$1, result) ? array.length : 0;
while (length--) {
var data = array[length],
otherFunc = data.func;
if (otherFunc == null || otherFunc == func) {
return data.name;
}
}
return result;
}/**
* The base constructor for creating `lodash` wrapper objects.
*
* @private
* @param {*} value The value to wrap.
* @param {boolean} [chainAll] Enable explicit method chain sequences.
*/
function LodashWrapper(value, chainAll) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__chain__ = !!chainAll;
this.__index__ = 0;
this.__values__ = undefined;
}
LodashWrapper.prototype = baseCreate$1(baseLodash.prototype);
LodashWrapper.prototype.constructor = LodashWrapper;/**
* Copies the values of `source` to `array`.
*
* @private
* @param {Array} source The array to copy values from.
* @param {Array} [array=[]] The array to copy values to.
* @returns {Array} Returns `array`.
*/
function copyArray(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}/**
* Creates a clone of `wrapper`.
*
* @private
* @param {Object} wrapper The wrapper to clone.
* @returns {Object} Returns the cloned wrapper.
*/
function wrapperClone(wrapper) {
if (wrapper instanceof LazyWrapper) {
return wrapper.clone();
}
var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
result.__actions__ = copyArray(wrapper.__actions__);
result.__index__ = wrapper.__index__;
result.__values__ = wrapper.__values__;
return result;
}/** Used for built-in method references. */
var objectProto$1 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto$1.hasOwnProperty;
/**
* Creates a `lodash` object which wraps `value` to enable implicit method
* chain sequences. Methods that operate on and return arrays, collections,
* and functions can be chained together. Methods that retrieve a single value
* or may return a primitive value will automatically end the chain sequence
* and return the unwrapped value. Otherwise, the value must be unwrapped
* with `_#value`.
*
* Explicit chain sequences, which must be unwrapped with `_#value`, may be
* enabled using `_.chain`.
*
* The execution of chained methods is lazy, that is, it's deferred until
* `_#value` is implicitly or explicitly called.
*
* Lazy evaluation allows several methods to support shortcut fusion.
* Shortcut fusion is an optimization to merge iteratee calls; this avoids
* the creation of intermediate arrays and can greatly reduce the number of
* iteratee executions. Sections of a chain sequence qualify for shortcut
* fusion if the section is applied to an array and iteratees accept only
* one argument. The heuristic for whether a section qualifies for shortcut
* fusion is subject to change.
*
* Chaining is supported in custom builds as long as the `_#value` method is
* directly or indirectly included in the build.
*
* In addition to lodash methods, wrappers have `Array` and `String` methods.
*
* The wrapper `Array` methods are:
* `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
*
* The wrapper `String` methods are:
* `replace` and `split`
*
* The wrapper methods that support shortcut fusion are:
* `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
* `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
* `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
*
* The chainable wrapper methods are:
* `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
* `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
* `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
* `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
* `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
* `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
* `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
* `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
* `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
* `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
* `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
* `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
* `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
* `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
* `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
* `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
* `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
* `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
* `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
* `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
* `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
* `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
* `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
* `zipObject`, `zipObjectDeep`, and `zipWith`
*
* The wrapper methods that are **not** chainable by default are:
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
* `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
* `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
* `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
* `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
* `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
* `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
* `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
* `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
* `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
* `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
* `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
* `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
* `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
* `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
* `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
* `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
* `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
* `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
* `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
* `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
* `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
* `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
* `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
* `upperFirst`, `value`, and `words`
*
* @name _
* @constructor
* @category Seq
* @param {*} value The value to wrap in a `lodash` instance.
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* function square(n) {
* return n * n;
* }
*
* var wrapped = _([1, 2, 3]);
*
* // Returns an unwrapped value.
* wrapped.reduce(_.add);
* // => 6
*
* // Returns a wrapped value.
* var squares = wrapped.map(square);
*
* _.isArray(squares);
* // => false
*
* _.isArray(squares.value());
* // => true
*/
function lodash(value) {
if (isObjectLike$1(value) && !isArray$1(value) && !(value instanceof LazyWrapper)) {
if (value instanceof LodashWrapper) {
return value;
}
if (hasOwnProperty.call(value, '__wrapped__')) {
return wrapperClone(value);
}
}
return new LodashWrapper(value);
}
// Ensure wrappers are instances of `baseLodash`.
lodash.prototype = baseLodash.prototype;
lodash.prototype.constructor = lodash;/**
* Checks if `func` has a lazy counterpart.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` has a lazy counterpart,
* else `false`.
*/
function isLaziable(func) {
var funcName = getFuncName(func),
other = lodash[funcName];
if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
return false;
}
if (func === other) {
return true;
}
var data = getData$1(other);
return !!data && func === data[0];
}/**
* Sets metadata for `func`.
*
* **Note:** If this function becomes hot, i.e. is invoked a lot in a short
* period of time, it will trip its breaker and transition to an identity
* function to avoid garbage collection pauses in V8. See
* [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
* for more details.
*
* @private
* @param {Function} func The function to associate metadata with.
* @param {*} data The metadata.
* @returns {Function} Returns `func`.
*/
var setData = shortOut(baseSetData$1);
var setData$1 = setData;/** Used to match wrap detail comments. */
var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
reSplitDetails = /,? & /;
/**
* Extracts wrapper details from the `source` body comment.
*
* @private
* @param {string} source The source to inspect.
* @returns {Array} Returns the wrapper details.
*/
function getWrapDetails(source) {
var match = source.match(reWrapDetails);
return match ? match[1].split(reSplitDetails) : [];
}/** Used to match wrap detail comments. */
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
/**
* Inserts wrapper `details` in a comment at the top of the `source` body.
*
* @private
* @param {string} source The source to modify.
* @returns {Array} details The details to insert.
* @returns {string} Returns the modified source.
*/
function insertWrapDetails(source, details) {
var length = details.length;
if (!length) {
return source;
}
var lastIndex = length - 1;
details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
details = details.join(length > 2 ? ', ' : ' ');
return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
}/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG$5 = 1,
WRAP_BIND_KEY_FLAG$4 = 2,
WRAP_CURRY_FLAG$4 = 8,
WRAP_CURRY_RIGHT_FLAG$2 = 16,
WRAP_PARTIAL_FLAG$2 = 32,
WRAP_PARTIAL_RIGHT_FLAG$3 = 64,
WRAP_ARY_FLAG$2 = 128,
WRAP_REARG_FLAG$1 = 256,
WRAP_FLIP_FLAG$1 = 512;
/** Used to associate wrap methods with their bit flags. */
var wrapFlags = [
['ary', WRAP_ARY_FLAG$2],
['bind', WRAP_BIND_FLAG$5],
['bindKey', WRAP_BIND_KEY_FLAG$4],
['curry', WRAP_CURRY_FLAG$4],
['curryRight', WRAP_CURRY_RIGHT_FLAG$2],
['flip', WRAP_FLIP_FLAG$1],
['partial', WRAP_PARTIAL_FLAG$2],
['partialRight', WRAP_PARTIAL_RIGHT_FLAG$3],
['rearg', WRAP_REARG_FLAG$1]
];
/**
* Updates wrapper `details` based on `bitmask` flags.
*
* @private
* @returns {Array} details The details to modify.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @returns {Array} Returns `details`.
*/
function updateWrapDetails(details, bitmask) {
arrayEach(wrapFlags, function(pair) {
var value = '_.' + pair[0];
if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
details.push(value);
}
});
return details.sort();
}/**
* Sets the `toString` method of `wrapper` to mimic the source of `reference`
* with wrapper details in a comment at the top of the source body.
*
* @private
* @param {Function} wrapper The function to modify.
* @param {Function} reference The reference function.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @returns {Function} Returns `wrapper`.
*/
function setWrapToString(wrapper, reference, bitmask) {
var source = (reference + '');
return setToString$1(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
}/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG$4 = 1,
WRAP_BIND_KEY_FLAG$3 = 2,
WRAP_CURRY_BOUND_FLAG$1 = 4,
WRAP_CURRY_FLAG$3 = 8,
WRAP_PARTIAL_FLAG$1 = 32,
WRAP_PARTIAL_RIGHT_FLAG$2 = 64;
/**
* Creates a function that wraps `func` to continue currying.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {Function} wrapFunc The function to create the `func` wrapper.
* @param {*} placeholder The placeholder value.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to prepend to those provided to
* the new function.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
var isCurry = bitmask & WRAP_CURRY_FLAG$3,
newHolders = isCurry ? holders : undefined,
newHoldersRight = isCurry ? undefined : holders,
newPartials = isCurry ? partials : undefined,
newPartialsRight = isCurry ? undefined : partials;
bitmask |= (isCurry ? WRAP_PARTIAL_FLAG$1 : WRAP_PARTIAL_RIGHT_FLAG$2);
bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG$2 : WRAP_PARTIAL_FLAG$1);
if (!(bitmask & WRAP_CURRY_BOUND_FLAG$1)) {
bitmask &= ~(WRAP_BIND_FLAG$4 | WRAP_BIND_KEY_FLAG$3);
}
var newData = [
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
newHoldersRight, argPos, ary, arity
];
var result = wrapFunc.apply(undefined, newData);
if (isLaziable(func)) {
setData$1(result, newData);
}
result.placeholder = placeholder;
return setWrapToString(result, func, bitmask);
}/**
* Gets the argument placeholder value for `func`.
*
* @private
* @param {Function} func The function to inspect.
* @returns {*} Returns the placeholder value.
*/
function getHolder(func) {
var object = func;
return object.placeholder;
}/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin$2 = Math.min;
/**
* Reorder `array` according to the specified indexes where the element at
* the first index is assigned as the first element, the element at
* the second index is assigned as the second element, and so on.
*
* @private
* @param {Array} array The array to reorder.
* @param {Array} indexes The arranged array indexes.
* @returns {Array} Returns `array`.
*/
function reorder(array, indexes) {
var arrLength = array.length,
length = nativeMin$2(indexes.length, arrLength),
oldArray = copyArray(array);
while (length--) {
var index = indexes[length];
array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
}
return array;
}/** Used as the internal argument placeholder. */
var PLACEHOLDER$1 = '__lodash_placeholder__';
/**
* Replaces all `placeholder` elements in `array` with an internal placeholder
* and returns an array of their indexes.
*
* @private
* @param {Array} array The array to modify.
* @param {*} placeholder The placeholder to replace.
* @returns {Array} Returns the new array of placeholder indexes.
*/
function replaceHolders(array, placeholder) {
var index = -1,
length = array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (value === placeholder || value === PLACEHOLDER$1) {
array[index] = PLACEHOLDER$1;
result[resIndex++] = index;
}
}
return result;
}/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG$3 = 1,
WRAP_BIND_KEY_FLAG$2 = 2,
WRAP_CURRY_FLAG$2 = 8,
WRAP_CURRY_RIGHT_FLAG$1 = 16,
WRAP_ARY_FLAG$1 = 128,
WRAP_FLIP_FLAG = 512;
/**
* Creates a function that wraps `func` to invoke it with optional `this`
* binding of `thisArg`, partial application, and currying.
*
* @private
* @param {Function|string} func The function or method name to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to prepend to those provided to
* the new function.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [partialsRight] The arguments to append to those provided
* to the new function.
* @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
var isAry = bitmask & WRAP_ARY_FLAG$1,
isBind = bitmask & WRAP_BIND_FLAG$3,
isBindKey = bitmask & WRAP_BIND_KEY_FLAG$2,
isCurried = bitmask & (WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1),
isFlip = bitmask & WRAP_FLIP_FLAG,
Ctor = isBindKey ? undefined : createCtor(func);
function wrapper() {
var length = arguments.length,
args = Array(length),
index = length;
while (index--) {
args[index] = arguments[index];
}
if (isCurried) {
var placeholder = getHolder(wrapper),
holdersCount = countHolders(args, placeholder);
}
if (partials) {
args = composeArgs(args, partials, holders, isCurried);
}
if (partialsRight) {
args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
}
length -= holdersCount;
if (isCurried && length < arity) {
var newHolders = replaceHolders(args, placeholder);
return createRecurry(
func, bitmask, createHybrid, wrapper.placeholder, thisArg,
args, newHolders, argPos, ary, arity - length
);
}
var thisBinding = isBind ? thisArg : this,
fn = isBindKey ? thisBinding[func] : func;
length = args.length;
if (argPos) {
args = reorder(args, argPos);
} else if (isFlip && length > 1) {
args.reverse();
}
if (isAry && ary < length) {
args.length = ary;
}
if (this && this !== root$2 && this instanceof wrapper) {
fn = Ctor || createCtor(fn);
}
return fn.apply(thisBinding, args);
}
return wrapper;
}/**
* Creates a function that wraps `func` to enable currying.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {number} arity The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createCurry(func, bitmask, arity) {
var Ctor = createCtor(func);
function wrapper() {
var length = arguments.length,
args = Array(length),
index = length,
placeholder = getHolder(wrapper);
while (index--) {
args[index] = arguments[index];
}
var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
? []
: replaceHolders(args, placeholder);
length -= holders.length;
if (length < arity) {
return createRecurry(
func, bitmask, createHybrid, wrapper.placeholder, undefined,
args, holders, undefined, undefined, arity - length);
}
var fn = (this && this !== root$2 && this instanceof wrapper) ? Ctor : func;
return apply(fn, this, args);
}
return wrapper;
}/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG$2 = 1;
/**
* Creates a function that wraps `func` to invoke it with the `this` binding
* of `thisArg` and `partials` prepended to the arguments it receives.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} partials The arguments to prepend to those provided to
* the new function.
* @returns {Function} Returns the new wrapped function.
*/
function createPartial(func, bitmask, thisArg, partials) {
var isBind = bitmask & WRAP_BIND_FLAG$2,
Ctor = createCtor(func);
function wrapper() {
var argsIndex = -1,
argsLength = arguments.length,
leftIndex = -1,
leftLength = partials.length,
args = Array(leftLength + argsLength),
fn = (this && this !== root$2 && this instanceof wrapper) ? Ctor : func;
while (++leftIndex < leftLength) {
args[leftIndex] = partials[leftIndex];
}
while (argsLength--) {
args[leftIndex++] = arguments[++argsIndex];
}
return apply(fn, isBind ? thisArg : this, args);
}
return wrapper;
}/** Used as the internal argument placeholder. */
var PLACEHOLDER = '__lodash_placeholder__';
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG$1 = 1,
WRAP_BIND_KEY_FLAG$1 = 2,
WRAP_CURRY_BOUND_FLAG = 4,
WRAP_CURRY_FLAG$1 = 8,
WRAP_ARY_FLAG = 128,
WRAP_REARG_FLAG = 256;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin$1 = Math.min;
/**
* Merges the function metadata of `source` into `data`.
*
* Merging metadata reduces the number of wrappers used to invoke a function.
* This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
* may be applied regardless of execution order. Methods like `_.ary` and
* `_.rearg` modify function arguments, making the order in which they are
* executed important, preventing the merging of metadata. However, we make
* an exception for a safe combined case where curried functions have `_.ary`
* and or `_.rearg` applied.
*
* @private
* @param {Array} data The destination metadata.
* @param {Array} source The source metadata.
* @returns {Array} Returns `data`.
*/
function mergeData(data, source) {
var bitmask = data[1],
srcBitmask = source[1],
newBitmask = bitmask | srcBitmask,
isCommon = newBitmask < (WRAP_BIND_FLAG$1 | WRAP_BIND_KEY_FLAG$1 | WRAP_ARY_FLAG);
var isCombo =
((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG$1)) ||
((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG$1));
// Exit early if metadata can't be merged.
if (!(isCommon || isCombo)) {
return data;
}
// Use source `thisArg` if available.
if (srcBitmask & WRAP_BIND_FLAG$1) {
data[2] = source[2];
// Set when currying a bound function.
newBitmask |= bitmask & WRAP_BIND_FLAG$1 ? 0 : WRAP_CURRY_BOUND_FLAG;
}
// Compose partial arguments.
var value = source[3];
if (value) {
var partials = data[3];
data[3] = partials ? composeArgs(partials, value, source[4]) : value;
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
}
// Compose partial right arguments.
value = source[5];
if (value) {
partials = data[5];
data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
}
// Use source `argPos` if available.
value = source[7];
if (value) {
data[7] = value;
}
// Use source `ary` if it's smaller.
if (srcBitmask & WRAP_ARY_FLAG) {
data[8] = data[8] == null ? source[8] : nativeMin$1(data[8], source[8]);
}
// Use source `arity` if one is not provided.
if (data[9] == null) {
data[9] = source[9];
}
// Use source `func` and merge bitmasks.
data[0] = source[0];
data[1] = newBitmask;
return data;
}/** Error message constants. */
var FUNC_ERROR_TEXT$1 = 'Expected a function';
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1,
WRAP_BIND_KEY_FLAG = 2,
WRAP_CURRY_FLAG = 8,
WRAP_CURRY_RIGHT_FLAG = 16,
WRAP_PARTIAL_FLAG = 32,
WRAP_PARTIAL_RIGHT_FLAG$1 = 64;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$1 = Math.max;
/**
* Creates a function that either curries or invokes `func` with optional
* `this` binding and partially applied arguments.
*
* @private
* @param {Function|string} func The function or method name to wrap.
* @param {number} bitmask The bitmask flags.
* 1 - `_.bind`
* 2 - `_.bindKey`
* 4 - `_.curry` or `_.curryRight` of a bound function
* 8 - `_.curry`
* 16 - `_.curryRight`
* 32 - `_.partial`
* 64 - `_.partialRight`
* 128 - `_.rearg`
* 256 - `_.ary`
* 512 - `_.flip`
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to be partially applied.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
if (!isBindKey && typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT$1);
}
var length = partials ? partials.length : 0;
if (!length) {
bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG$1);
partials = holders = undefined;
}
ary = ary === undefined ? ary : nativeMax$1(toInteger(ary), 0);
arity = arity === undefined ? arity : toInteger(arity);
length -= holders ? holders.length : 0;
if (bitmask & WRAP_PARTIAL_RIGHT_FLAG$1) {
var partialsRight = partials,
holdersRight = holders;
partials = holders = undefined;
}
var data = isBindKey ? undefined : getData$1(func);
var newData = [
func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
argPos, ary, arity
];
if (data) {
mergeData(newData, data);
}
func = newData[0];
bitmask = newData[1];
thisArg = newData[2];
partials = newData[3];
holders = newData[4];
arity = newData[9] = newData[9] === undefined
? (isBindKey ? 0 : func.length)
: nativeMax$1(newData[9] - length, 0);
if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
}
if (!bitmask || bitmask == WRAP_BIND_FLAG) {
var result = createBind(func, bitmask, thisArg);
} else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
result = createCurry(func, bitmask, arity);
} else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
result = createPartial(func, bitmask, thisArg, partials);
} else {
result = createHybrid.apply(undefined, newData);
}
var setter = data ? baseSetData$1 : setData$1;
return setWrapToString(setter(result, newData), func, bitmask);
}/** Used to compose bitmasks for function metadata. */
var WRAP_PARTIAL_RIGHT_FLAG = 64;
/**
* This method is like `_.partial` except that partially applied arguments
* are appended to the arguments it receives.
*
* The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for partially applied arguments.
*
* **Note:** This method doesn't set the "length" property of partially
* applied functions.
*
* @static
* @memberOf _
* @since 1.0.0
* @category Function
* @param {Function} func The function to partially apply arguments to.
* @param {...*} [partials] The arguments to be partially applied.
* @returns {Function} Returns the new partially applied function.
* @example
*
* function greet(greeting, name) {
* return greeting + ' ' + name;
* }
*
* var greetFred = _.partialRight(greet, 'fred');
* greetFred('hi');
* // => 'hi fred'
*
* // Partially applied with placeholders.
* var sayHelloTo = _.partialRight(greet, 'hello', _);
* sayHelloTo('fred');
* // => 'hello fred'
*/
var partialRight = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partialRight));
return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
});
// Assign default placeholders.
partialRight.placeholder = {};
var _partialRight = partialRight;function SearchCategoryLayout(props) {
var categoryContent = props.categoryContent,
resultsContent = props.resultsContent;
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
className: "name"
}, categoryContent), /*#__PURE__*/React__default.createElement("div", {
className: "results"
}, resultsContent));
}
SearchCategoryLayout.handledProps = ["categoryContent", "resultsContent"];
SearchCategoryLayout.propTypes = {};function SearchCategory(props) {
var active = props.active,
children = props.children,
className = props.className,
content = props.content,
layoutRenderer = props.layoutRenderer,
renderer = props.renderer;
var classes = cx(useKeyOnly(active, 'active'), 'category', className);
var rest = getUnhandledProps$1(SearchCategory, props);
var ElementType = getElementType(SearchCategory, props);
var categoryContent = renderer(props);
var resultsContent = isNil$1(children) ? content : children;
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), layoutRenderer({
categoryContent: categoryContent,
resultsContent: resultsContent
}));
}
SearchCategory.handledProps = ["active", "as", "children", "className", "content", "layoutRenderer", "name", "renderer", "results"];
SearchCategory.defaultProps = {
layoutRenderer: SearchCategoryLayout,
renderer: function renderer(_ref) {
var name = _ref.name;
return name;
}
};
SearchCategory.propTypes = {};// image. However, optionally wrapping it makes this function a lot more
// complicated and harder to read. Since always wrapping it doesn't affect
// the style in any way let's just do that.
//
// Note: To avoid requiring a wrapping div, we return an array here so to
// prevent rendering issues each node needs a unique key.
var defaultRenderer = function defaultRenderer(_ref) {
var image = _ref.image,
price = _ref.price,
title = _ref.title,
description = _ref.description;
return [image && /*#__PURE__*/React__default.createElement("div", {
key: "image",
className: "image"
}, createHTMLImage(image, {
autoGenerateKey: false
})), /*#__PURE__*/React__default.createElement("div", {
key: "content",
className: "content"
}, price && /*#__PURE__*/React__default.createElement("div", {
className: "price"
}, price), title && /*#__PURE__*/React__default.createElement("div", {
className: "title"
}, title), description && /*#__PURE__*/React__default.createElement("div", {
className: "description"
}, description))];
};
defaultRenderer.handledProps = [];
var SearchResult = /*#__PURE__*/function (_Component) {
_inheritsLoose(SearchResult, _Component);
function SearchResult() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleClick = function (e) {
var onClick = _this.props.onClick;
if (onClick) onClick(e, _this.props);
};
return _this;
}
var _proto = SearchResult.prototype;
_proto.render = function render() {
var _this$props = this.props,
active = _this$props.active,
className = _this$props.className,
renderer = _this$props.renderer;
var classes = cx(useKeyOnly(active, 'active'), 'result', className);
var rest = getUnhandledProps$1(SearchResult, this.props);
var ElementType = getElementType(SearchResult, this.props); // Note: You technically only need the 'content' wrapper when there's an
// image. However, optionally wrapping it makes this function a lot more
// complicated and harder to read. Since always wrapping it doesn't affect
// the style in any way let's just do that.
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
onClick: this.handleClick
}), renderer(this.props));
};
return SearchResult;
}(Component);
SearchResult.handledProps = ["active", "as", "className", "content", "description", "id", "image", "onClick", "price", "renderer", "title"];
SearchResult.propTypes = {};
SearchResult.defaultProps = {
renderer: defaultRenderer
};function SearchResults(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('results transition', className);
var rest = getUnhandledProps$1(SearchResults, props);
var ElementType = getElementType(SearchResults, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
SearchResults.handledProps = ["as", "children", "className", "content"];
SearchResults.propTypes = {};var overrideSearchInputProps = function overrideSearchInputProps(predefinedProps) {
var input = predefinedProps.input;
if (isUndefined(input)) {
return _extends$6({}, predefinedProps, {
input: {
className: 'prompt'
}
});
}
if (isPlainObject(input)) {
return _extends$6({}, predefinedProps, {
input: _extends$6({}, input, {
className: cx(input.className, 'prompt')
})
});
}
return predefinedProps;
};
/**
* A search module allows a user to query for results from a selection of data
*/
var Search = /*#__PURE__*/function (_Component) {
_inheritsLoose(Search, _Component);
function Search() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleResultSelect = function (e, result) {
_invoke(_this.props, 'onResultSelect', e, _extends$6({}, _this.props, {
result: result
}));
};
_this.handleSelectionChange = function (e) {
var result = _this.getSelectedResult();
_invoke(_this.props, 'onSelectionChange', e, _extends$6({}, _this.props, {
result: result
}));
};
_this.closeOnEscape = function (e) {
if (keyboardKey_1.getCode(e) !== keyboardKey_1.Escape) return;
e.preventDefault();
_this.close();
};
_this.moveSelectionOnKeyDown = function (e) {
switch (keyboardKey_1.getCode(e)) {
case keyboardKey_1.ArrowDown:
e.preventDefault();
_this.moveSelectionBy(e, 1);
break;
case keyboardKey_1.ArrowUp:
e.preventDefault();
_this.moveSelectionBy(e, -1);
break;
}
};
_this.selectItemOnEnter = function (e) {
if (keyboardKey_1.getCode(e) !== keyboardKey_1.Enter) return;
var result = _this.getSelectedResult(); // prevent selecting null if there was no selected item value
if (!result) return;
e.preventDefault(); // notify the onResultSelect prop that the user is trying to change value
_this.setValue(result.title);
_this.handleResultSelect(e, result);
_this.close();
};
_this.closeOnDocumentClick = function (e) {
_this.close();
};
_this.handleMouseDown = function (e) {
_this.isMouseDown = true;
_invoke(_this.props, 'onMouseDown', e, _this.props);
instance.sub('mouseup', _this.handleDocumentMouseUp);
};
_this.handleDocumentMouseUp = function () {
_this.isMouseDown = false;
instance.unsub('mouseup', _this.handleDocumentMouseUp);
};
_this.handleInputClick = function (e) {
// prevent closeOnDocumentClick()
e.nativeEvent.stopImmediatePropagation();
_this.tryOpen();
};
_this.handleItemClick = function (e, _ref) {
var id = _ref.id;
var result = _this.getSelectedResult(id); // prevent closeOnDocumentClick()
e.nativeEvent.stopImmediatePropagation(); // notify the onResultSelect prop that the user is trying to change value
_this.setValue(result.title);
_this.handleResultSelect(e, result);
_this.close();
};
_this.handleItemMouseDown = function (e) {
// Heads up! We should prevent default to prevent blur events.
// https://github.com/Semantic-Org/Semantic-UI-React/issues/3298
e.preventDefault();
};
_this.handleFocus = function (e) {
_invoke(_this.props, 'onFocus', e, _this.props);
_this.setState({
focus: true
});
};
_this.handleBlur = function (e) {
_invoke(_this.props, 'onBlur', e, _this.props);
_this.setState({
focus: false
});
};
_this.handleSearchChange = function (e) {
// prevent propagating to this.props.onChange()
e.stopPropagation();
var minCharacters = _this.props.minCharacters;
var open = _this.state.open;
var newQuery = e.target.value;
_invoke(_this.props, 'onSearchChange', e, _extends$6({}, _this.props, {
value: newQuery
})); // open search dropdown on search query
if (newQuery.length < minCharacters) {
_this.close();
} else if (!open) {
_this.tryOpen(newQuery);
}
_this.setValue(newQuery);
};
_this.getFlattenedResults = function () {
var _this$props = _this.props,
category = _this$props.category,
results = _this$props.results;
return !category ? results : reduce(results, function (memo, categoryData) {
return memo.concat(categoryData.results);
}, []);
};
_this.getSelectedResult = function (index) {
if (index === void 0) {
index = _this.state.selectedIndex;
}
var results = _this.getFlattenedResults();
return get(results, index);
};
_this.setValue = function (value) {
var selectFirstResult = _this.props.selectFirstResult;
_this.setState({
value: value,
selectedIndex: selectFirstResult ? 0 : -1
});
};
_this.moveSelectionBy = function (e, offset) {
var selectedIndex = _this.state.selectedIndex;
var results = _this.getFlattenedResults();
var lastIndex = results.length - 1; // next is after last, wrap to beginning
// next is before first, wrap to end
var nextIndex = selectedIndex + offset;
if (nextIndex > lastIndex) nextIndex = 0;else if (nextIndex < 0) nextIndex = lastIndex;
_this.setState({
selectedIndex: nextIndex
});
_this.scrollSelectedItemIntoView();
_this.handleSelectionChange(e);
};
_this.scrollSelectedItemIntoView = function () {
// Do not access document when server side rendering
if (!isBrowser$1()) return;
var menu = document.querySelector('.ui.search.active.visible .results.visible');
if (!menu) return;
var item = menu.querySelector('.result.active');
if (!item) return;
var isOutOfUpperView = item.offsetTop < menu.scrollTop;
var isOutOfLowerView = item.offsetTop + item.clientHeight > menu.scrollTop + menu.clientHeight;
if (isOutOfUpperView) {
menu.scrollTop = item.offsetTop;
} else if (isOutOfLowerView) {
menu.scrollTop = item.offsetTop + item.clientHeight - menu.clientHeight;
}
};
_this.tryOpen = function (currentValue) {
if (currentValue === void 0) {
currentValue = _this.state.value;
}
var minCharacters = _this.props.minCharacters;
if (currentValue.length < minCharacters) return;
_this.open();
};
_this.open = function () {
_this.setState({
open: true
});
};
_this.close = function () {
_this.setState({
open: false
});
};
_this.renderSearchInput = function (rest) {
var _this$props2 = _this.props,
icon = _this$props2.icon,
input = _this$props2.input;
var value = _this.state.value;
return Input$1.create(input, {
autoGenerateKey: false,
defaultProps: _extends$6({}, rest, {
autoComplete: 'off',
icon: icon,
onChange: _this.handleSearchChange,
onClick: _this.handleInputClick,
tabIndex: '0',
value: value
}),
// Nested shorthand props need special treatment to survive the shallow merge
overrideProps: overrideSearchInputProps
});
};
_this.renderNoResults = function () {
var _this$props3 = _this.props,
noResultsDescription = _this$props3.noResultsDescription,
noResultsMessage = _this$props3.noResultsMessage;
return /*#__PURE__*/React__default.createElement("div", {
className: "message empty"
}, /*#__PURE__*/React__default.createElement("div", {
className: "header"
}, noResultsMessage), noResultsDescription && /*#__PURE__*/React__default.createElement("div", {
className: "description"
}, noResultsDescription));
};
_this.renderResult = function (_ref2, index, _array, offset) {
var childKey = _ref2.childKey,
result = _objectWithoutPropertiesLoose(_ref2, ["childKey"]);
if (offset === void 0) {
offset = 0;
}
var resultRenderer = _this.props.resultRenderer;
var selectedIndex = _this.state.selectedIndex;
var offsetIndex = index + offset;
return /*#__PURE__*/React__default.createElement(SearchResult, _extends$6({
key: childKey || result.id || result.title,
active: selectedIndex === offsetIndex,
onClick: _this.handleItemClick,
onMouseDown: _this.handleItemMouseDown,
renderer: resultRenderer
}, result, {
id: offsetIndex // Used to lookup the result on item click
}));
};
_this.renderResults = function () {
var results = _this.props.results;
return map(results, _this.renderResult);
};
_this.renderCategories = function () {
var _this$props4 = _this.props,
categoryLayoutRenderer = _this$props4.categoryLayoutRenderer,
categoryRenderer = _this$props4.categoryRenderer,
categories = _this$props4.results;
var selectedIndex = _this.state.selectedIndex;
var count = 0;
return map(categories, function (_ref3) {
var childKey = _ref3.childKey,
category = _objectWithoutPropertiesLoose(_ref3, ["childKey"]);
var categoryProps = _extends$6({
key: childKey || category.name,
active: inRange(selectedIndex, count, count + category.results.length),
layoutRenderer: categoryLayoutRenderer,
renderer: categoryRenderer
}, category);
var renderFn = _partialRight(_this.renderResult, count);
count += category.results.length;
return /*#__PURE__*/React__default.createElement(SearchCategory, categoryProps, category.results.map(renderFn));
});
};
_this.renderMenuContent = function () {
var _this$props5 = _this.props,
category = _this$props5.category,
showNoResults = _this$props5.showNoResults,
results = _this$props5.results;
if (isEmpty(results)) {
return showNoResults ? _this.renderNoResults() : null;
}
return category ? _this.renderCategories() : _this.renderResults();
};
_this.renderResultsMenu = function () {
var open = _this.state.open;
var resultsClasses = open ? 'visible' : '';
var menuContent = _this.renderMenuContent();
if (!menuContent) return;
return /*#__PURE__*/React__default.createElement(SearchResults, {
className: resultsClasses
}, menuContent);
};
return _this;
}
Search.getAutoControlledStateFromProps = function getAutoControlledStateFromProps(props, state) {
// We need to store a `prevValue` to compare as in `getDerivedStateFromProps` we don't have
// prevState
if (typeof state.prevValue !== 'undefined' && shallowequal(state.prevValue, state.value)) {
return {
prevValue: state.value
};
}
var selectedIndex = props.selectFirstResult ? 0 : -1;
return {
prevValue: state.value,
selectedIndex: selectedIndex
};
};
var _proto = Search.prototype;
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
return !shallowequal(nextProps, this.props) || !shallowequal(nextState, this.state);
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
// eslint-disable-line complexity
// focused / blurred
if (!prevState.focus && this.state.focus) {
if (!this.isMouseDown) {
this.tryOpen();
}
if (this.state.open) {
instance.sub('keydown', [this.moveSelectionOnKeyDown, this.selectItemOnEnter]);
}
} else if (prevState.focus && !this.state.focus) {
if (!this.isMouseDown) {
this.close();
}
instance.unsub('keydown', [this.moveSelectionOnKeyDown, this.selectItemOnEnter]);
} // opened / closed
if (!prevState.open && this.state.open) {
this.open();
instance.sub('click', this.closeOnDocumentClick);
instance.sub('keydown', [this.closeOnEscape, this.moveSelectionOnKeyDown, this.selectItemOnEnter]);
} else if (prevState.open && !this.state.open) {
this.close();
instance.unsub('click', this.closeOnDocumentClick);
instance.unsub('keydown', [this.closeOnEscape, this.moveSelectionOnKeyDown, this.selectItemOnEnter]);
}
};
_proto.componentWillUnmount = function componentWillUnmount() {
instance.unsub('click', this.closeOnDocumentClick);
instance.unsub('keydown', [this.closeOnEscape, this.moveSelectionOnKeyDown, this.selectItemOnEnter]);
} // ----------------------------------------
// Document Event Handlers
// ----------------------------------------
;
_proto.render = function render() {
var _this$state = this.state,
searchClasses = _this$state.searchClasses,
focus = _this$state.focus,
open = _this$state.open;
var _this$props6 = this.props,
aligned = _this$props6.aligned,
category = _this$props6.category,
className = _this$props6.className,
fluid = _this$props6.fluid,
loading = _this$props6.loading,
size = _this$props6.size; // Classes
var classes = cx('ui', open && 'active visible', size, searchClasses, useKeyOnly(category, 'category'), useKeyOnly(focus, 'focus'), useKeyOnly(fluid, 'fluid'), useKeyOnly(loading, 'loading'), useValueAndKey(aligned, 'aligned'), 'search', className);
var unhandled = getUnhandledProps$1(Search, this.props);
var ElementType = getElementType(Search, this.props);
var _partitionHTMLProps = partitionHTMLProps(unhandled, {
htmlProps: htmlInputAttrs
}),
htmlInputProps = _partitionHTMLProps[0],
rest = _partitionHTMLProps[1];
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
onBlur: this.handleBlur,
onFocus: this.handleFocus,
onMouseDown: this.handleMouseDown
}), this.renderSearchInput(htmlInputProps), this.renderResultsMenu());
};
return Search;
}(ModernAutoControlledComponent);
Search.handledProps = ["aligned", "as", "category", "categoryLayoutRenderer", "categoryRenderer", "className", "defaultOpen", "defaultValue", "fluid", "icon", "input", "loading", "minCharacters", "noResultsDescription", "noResultsMessage", "onBlur", "onFocus", "onMouseDown", "onResultSelect", "onSearchChange", "onSelectionChange", "open", "resultRenderer", "results", "selectFirstResult", "showNoResults", "size", "value"];
Search.propTypes = {};
Search.defaultProps = {
icon: 'search',
input: 'text',
minCharacters: 1,
noResultsMessage: 'No results found.',
showNoResults: true
};
Search.autoControlledProps = ['open', 'value'];
Search.Category = SearchCategory;
Search.Result = SearchResult;
Search.Results = SearchResults;var isActionSupported = function isActionSupported(element, method) {
return element ? !!element[method] : false;
};
var useEventListener = function useEventListener(options) {
var capture = options.capture,
listener = options.listener,
type = options.type,
target = options.target,
targetRef = options.targetRef;
var latestListener = React.useRef(listener);
latestListener.current = listener;
var eventHandler = React.useCallback(function (event) {
return latestListener.current(event);
}, []);
React.useEffect(function () {
var element = typeof targetRef === 'undefined' ? target : targetRef.current;
if (isActionSupported(element, 'addEventListener')) {
element.addEventListener(type, eventHandler, capture);
}
return function () {
if (isActionSupported(element, 'removeEventListener')) {
element.removeEventListener(type, eventHandler, capture);
}
};
}, [capture, eventHandler, target, targetRef, type]);
};var EventListener = /*#__PURE__*/function () {
function EventListener(props) {
useEventListener(props);
return null;
}
EventListener.defaultProps = {
capture: false
};
return EventListener;
}();var documentRef = {
current: typeof document === 'undefined' ? null : document
};/**
* A pushable sub-component for Sidebar.
*/
function SidebarPushable(props) {
var className = props.className,
children = props.children,
content = props.content;
var classes = cx('pushable', className);
var rest = getUnhandledProps$1(SidebarPushable, props);
var ElementType = getElementType(SidebarPushable, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
SidebarPushable.handledProps = ["as", "children", "className", "content"];
SidebarPushable.propTypes = {};/**
* A pushable sub-component for Sidebar.
*/
function SidebarPusher(props) {
var className = props.className,
dimmed = props.dimmed,
children = props.children,
content = props.content;
var classes = cx('pusher', useKeyOnly(dimmed, 'dimmed'), className);
var rest = getUnhandledProps$1(SidebarPusher, props);
var ElementType = getElementType(SidebarPusher, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
SidebarPusher.handledProps = ["as", "children", "className", "content", "dimmed"];
SidebarPusher.propTypes = {};/**
* A sidebar hides additional content beside a page.
*/
var Sidebar = /*#__PURE__*/function (_Component) {
_inheritsLoose(Sidebar, _Component);
function Sidebar(props) {
var _this;
_this = _Component.call(this, props) || this;
_this.ref = /*#__PURE__*/createRef();
_this.handleAnimationStart = function () {
var visible = _this.props.visible;
var callback = visible ? 'onVisible' : 'onHide';
clearTimeout(_this.animationTimer);
_this.animationTimer = setTimeout(_this.handleAnimationEnd, Sidebar.animationDuration);
if (_this.skipNextCallback) {
_this.skipNextCallback = false;
return;
}
_invoke(_this.props, callback, null, _this.props);
};
_this.handleAnimationEnd = function () {
var visible = _this.props.visible;
var callback = visible ? 'onShow' : 'onHidden';
_this.setState({
animationTick: 0
});
_invoke(_this.props, callback, null, _this.props);
};
_this.handleDocumentClick = function (e) {
if (!doesNodeContainClick$1(_this.ref.current, e)) {
_this.skipNextCallback = true;
_invoke(_this.props, 'onHide', e, _extends$6({}, _this.props, {
visible: false
}));
}
};
_this.state = {
animationTick: 0,
visible: props.visible
};
return _this;
}
Sidebar.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
// We use `animationTick` to understand when an animation should be scheduled
var tickIncrement = !!props.visible === !!state.visible ? 0 : 1;
return {
animationTick: state.animationTick + tickIncrement,
visible: props.visible
};
};
var _proto = Sidebar.prototype;
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
if (this.state.animationTick > prevState.animationTick) {
this.handleAnimationStart();
}
};
_proto.componentWillUnmount = function componentWillUnmount() {
clearTimeout(this.animationTimer);
};
_proto.render = function render() {
var _this$props = this.props,
animation = _this$props.animation,
className = _this$props.className,
children = _this$props.children,
content = _this$props.content,
direction = _this$props.direction,
target = _this$props.target,
visible = _this$props.visible,
width = _this$props.width;
var animationTick = this.state.animationTick;
var classes = cx('ui', animation, direction, width, useKeyOnly(animationTick > 0, 'animating'), useKeyOnly(visible, 'visible'), 'sidebar', className);
var rest = getUnhandledProps$1(Sidebar, this.props);
var ElementType = getElementType(Sidebar, this.props);
var targetProp = isRefObject(target) ? {
targetRef: target
} : {
target: target
};
return /*#__PURE__*/React__default.createElement(Ref, {
innerRef: this.ref
}, /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children, visible && /*#__PURE__*/React__default.createElement(EventListener, _extends$6({
listener: this.handleDocumentClick,
type: "click"
}, targetProp))));
};
return Sidebar;
}(Component);
Sidebar.handledProps = ["animation", "as", "children", "className", "content", "direction", "onHidden", "onHide", "onShow", "onVisible", "target", "visible", "width"];
Sidebar.propTypes = {};
Sidebar.defaultProps = {
direction: 'left',
target: documentRef,
visible: false
};
Sidebar.animationDuration = 500;
Sidebar.autoControlledProps = ['visible'];
Sidebar.Pushable = SidebarPushable;
Sidebar.Pusher = SidebarPusher;
var Sidebar$1 = Sidebar;/**
* Sticky content stays fixed to the browser viewport while another column of content is visible on the page.
*/
var Sticky = /*#__PURE__*/function (_Component) {
_inheritsLoose(Sticky, _Component);
function Sticky() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.state = {
active: true,
sticky: false
};
_this.stickyRef = /*#__PURE__*/createRef();
_this.triggerRef = /*#__PURE__*/createRef();
_this.addListeners = function (scrollContext) {
var scrollContextNode = isRefObject(scrollContext) ? scrollContext.current : scrollContext;
if (scrollContextNode) {
instance.sub('resize', _this.handleUpdate, {
target: scrollContextNode
});
instance.sub('scroll', _this.handleUpdate, {
target: scrollContextNode
});
}
};
_this.removeListeners = function (scrollContext) {
var scrollContextNode = isRefObject(scrollContext) ? scrollContext.current : scrollContext;
if (scrollContextNode) {
instance.unsub('resize', _this.handleUpdate, {
target: scrollContextNode
});
instance.unsub('scroll', _this.handleUpdate, {
target: scrollContextNode
});
}
};
_this.update = function (e) {
var pushing = _this.state.pushing;
_this.ticking = false;
_this.assignRects();
if (pushing) {
if (_this.didReachStartingPoint()) return _this.stickToContextTop(e);
if (_this.didTouchScreenBottom()) return _this.stickToScreenBottom(e);
return _this.stickToContextBottom(e);
}
if (_this.isOversized()) {
if (_this.contextRect.top > 0) return _this.stickToContextTop(e);
if (_this.contextRect.bottom < window.innerHeight) return _this.stickToContextBottom(e);
}
if (_this.didTouchScreenTop()) {
if (_this.didReachContextBottom()) return _this.stickToContextBottom(e);
return _this.stickToScreenTop(e);
}
return _this.stickToContextTop(e);
};
_this.handleUpdate = function (e) {
if (!_this.ticking) {
_this.ticking = true;
_this.frameId = requestAnimationFrame(function () {
return _this.update(e);
});
}
};
_this.assignRects = function () {
var context = _this.props.context;
var contextNode = isRefObject(context) ? context.current : context || document.body;
_this.triggerRect = _this.triggerRef.current.getBoundingClientRect();
_this.contextRect = contextNode.getBoundingClientRect();
_this.stickyRect = _this.stickyRef.current.getBoundingClientRect();
};
_this.didReachContextBottom = function () {
var offset = _this.props.offset;
return _this.stickyRect.height + offset >= _this.contextRect.bottom;
};
_this.didReachStartingPoint = function () {
return _this.stickyRect.top <= _this.triggerRect.top;
};
_this.didTouchScreenTop = function () {
return _this.triggerRect.top < _this.props.offset;
};
_this.didTouchScreenBottom = function () {
var bottomOffset = _this.props.bottomOffset;
return _this.contextRect.bottom + bottomOffset > window.innerHeight;
};
_this.isOversized = function () {
return _this.stickyRect.height > window.innerHeight;
};
_this.pushing = function (pushing) {
var possible = _this.props.pushing;
if (possible) _this.setState({
pushing: pushing
});
};
_this.stick = function (e, bound) {
_this.setState({
bound: bound,
sticky: true
});
_invoke(_this.props, 'onStick', e, _this.props);
};
_this.unstick = function (e, bound) {
_this.setState({
bound: bound,
sticky: false
});
_invoke(_this.props, 'onUnstick', e, _this.props);
};
_this.stickToContextBottom = function (e) {
_invoke(_this.props, 'onBottom', e, _this.props);
_this.stick(e, true);
_this.pushing(true);
};
_this.stickToContextTop = function (e) {
_invoke(_this.props, 'onTop', e, _this.props);
_this.unstick(e, false);
_this.pushing(false);
};
_this.stickToScreenBottom = function (e) {
var bottom = _this.props.bottomOffset;
_this.stick(e, false);
_this.setState({
bottom: bottom,
top: null
});
};
_this.stickToScreenTop = function (e) {
var top = _this.props.offset;
_this.stick(e, false);
_this.setState({
top: top,
bottom: null
});
};
return _this;
}
var _proto = Sticky.prototype;
_proto.componentDidMount = function componentDidMount() {
if (!isBrowser$1()) return;
var active = this.state.active;
if (active) {
this.handleUpdate();
this.addListeners(this.props.scrollContext);
}
};
Sticky.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
if (state.active !== props.active && !props.active) {
return {
active: props.active,
sticky: false
};
}
return {
active: props.active
};
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
if (prevState.active === this.state.active) {
if (prevProps.scrollContext !== this.props.scrollContext) {
this.removeListeners(prevProps.scrollContext);
this.addListeners(this.props.scrollContext);
}
return;
}
if (this.state.active) {
this.handleUpdate();
this.addListeners(this.props.scrollContext);
return;
}
this.removeListeners(prevProps.scrollContext);
};
_proto.componentWillUnmount = function componentWillUnmount() {
if (!isBrowser$1()) return;
var active = this.state.active;
if (active) {
this.removeListeners(this.props.scrollContext);
cancelAnimationFrame(this.frameId);
}
} // ----------------------------------------
// Events
// ----------------------------------------
;
_proto.computeStyle = function computeStyle() {
var styleElement = this.props.styleElement;
var _this$state = this.state,
bottom = _this$state.bottom,
bound = _this$state.bound,
sticky = _this$state.sticky,
top = _this$state.top;
if (!sticky) return styleElement;
return _extends$6({
bottom: bound ? 0 : bottom,
top: bound ? undefined : top,
width: this.triggerRect.width
}, styleElement);
} // Return true when the component reached the bottom of the context
;
// ----------------------------------------
// Render
// ----------------------------------------
_proto.render = function render() {
var _this$props = this.props,
children = _this$props.children,
className = _this$props.className;
var _this$state2 = this.state,
bottom = _this$state2.bottom,
bound = _this$state2.bound,
sticky = _this$state2.sticky;
var rest = getUnhandledProps$1(Sticky, this.props);
var ElementType = getElementType(Sticky, this.props);
var containerClasses = cx(sticky && 'ui', sticky && 'stuck-container', sticky && (bound ? 'bound-container' : 'fixed-container'), className);
var elementClasses = cx('ui', sticky && (bound ? 'bound bottom' : 'fixed'), sticky && !bound && (bottom === null ? 'top' : 'bottom'), 'sticky');
var triggerStyles = sticky && this.stickyRect ? {
height: this.stickyRect.height
} : {};
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: containerClasses
}), /*#__PURE__*/React__default.createElement("div", {
ref: this.triggerRef,
style: triggerStyles
}), /*#__PURE__*/React__default.createElement("div", {
className: elementClasses,
ref: this.stickyRef,
style: this.computeStyle()
}, children));
};
return Sticky;
}(Component);
Sticky.handledProps = ["active", "as", "bottomOffset", "children", "className", "context", "offset", "onBottom", "onStick", "onTop", "onUnstick", "pushing", "scrollContext", "styleElement"];
Sticky.propTypes = {};
Sticky.defaultProps = {
active: true,
bottomOffset: 0,
offset: 0,
scrollContext: isBrowser$1() ? window : null
};/**
* A tab pane holds the content of a tab.
*/
function TabPane(props) {
var active = props.active,
children = props.children,
className = props.className,
content = props.content,
loading = props.loading;
var classes = cx(useKeyOnly(active, 'active'), useKeyOnly(loading, 'loading'), 'tab', className);
var rest = getUnhandledProps$1(TabPane, props);
var ElementType = getElementType(TabPane, props);
var calculatedDefaultProps = {};
if (ElementType === Segment) {
calculatedDefaultProps.attached = 'bottom';
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, calculatedDefaultProps, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
TabPane.handledProps = ["active", "as", "children", "className", "content", "loading"];
TabPane.defaultProps = {
as: Segment,
active: true
};
TabPane.propTypes = {};
TabPane.create = createShorthandFactory(TabPane, function (content) {
return {
content: content
};
});/**
* A Tab is a hidden section of content activated by a Menu.
* @see Menu
* @see Segment
*/
var Tab = /*#__PURE__*/function (_Component) {
_inheritsLoose(Tab, _Component);
function Tab() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleItemClick = function (e, _ref) {
var index = _ref.index;
_invoke(_this.props, 'onTabChange', e, _extends$6({}, _this.props, {
activeIndex: index
}));
_this.setState({
activeIndex: index
});
};
return _this;
}
var _proto = Tab.prototype;
_proto.getInitialAutoControlledState = function getInitialAutoControlledState() {
return {
activeIndex: 0
};
};
_proto.renderItems = function renderItems() {
var _this$props = this.props,
panes = _this$props.panes,
renderActiveOnly = _this$props.renderActiveOnly;
var activeIndex = this.state.activeIndex;
if (renderActiveOnly) return _invoke(get(panes, "[" + activeIndex + "]"), 'render', this.props);
return map(panes, function (_ref2, index) {
var pane = _ref2.pane;
return TabPane.create(pane, {
overrideProps: {
active: index === activeIndex
}
});
});
};
_proto.renderMenu = function renderMenu() {
var _this$props2 = this.props,
menu = _this$props2.menu,
panes = _this$props2.panes,
menuPosition = _this$props2.menuPosition;
var activeIndex = this.state.activeIndex;
if (menu.tabular === true && menuPosition === 'right') {
menu.tabular = 'right';
}
return Menu$1.create(menu, {
autoGenerateKey: false,
overrideProps: {
items: map(panes, 'menuItem'),
onItemClick: this.handleItemClick,
activeIndex: activeIndex
}
});
};
_proto.renderVertical = function renderVertical(menu) {
var _this$props3 = this.props,
grid = _this$props3.grid,
menuPosition = _this$props3.menuPosition;
var paneWidth = grid.paneWidth,
tabWidth = grid.tabWidth,
gridProps = _objectWithoutPropertiesLoose(grid, ["paneWidth", "tabWidth"]);
var position = menuPosition || menu.props.tabular === 'right' && 'right' || 'left';
return /*#__PURE__*/React__default.createElement(Grid, gridProps, position === 'left' && GridColumn.create({
width: tabWidth,
children: menu
}, {
autoGenerateKey: false
}), GridColumn.create({
width: paneWidth,
children: this.renderItems(),
stretched: true
}, {
autoGenerateKey: false
}), position === 'right' && GridColumn.create({
width: tabWidth,
children: menu
}, {
autoGenerateKey: false
}));
};
_proto.render = function render() {
var menu = this.renderMenu();
var rest = getUnhandledProps$1(Tab, this.props);
var ElementType = getElementType(Tab, this.props);
if (menu.props.vertical) {
return /*#__PURE__*/React__default.createElement(ElementType, rest, this.renderVertical(menu));
}
return /*#__PURE__*/React__default.createElement(ElementType, rest, menu.props.attached !== 'bottom' && menu, this.renderItems(), menu.props.attached === 'bottom' && menu);
};
return Tab;
}(ModernAutoControlledComponent);
Tab.handledProps = ["activeIndex", "as", "defaultActiveIndex", "grid", "menu", "menuPosition", "onTabChange", "panes", "renderActiveOnly"];
Tab.propTypes = {};
Tab.autoControlledProps = ['activeIndex'];
Tab.defaultProps = {
grid: {
paneWidth: 12,
tabWidth: 4
},
menu: {
attached: true,
tabular: true
},
renderActiveOnly: true
};
Tab.Pane = TabPane;
var Tab$1 = Tab;/**
* An ad displays third-party promotional content.
*/
function Advertisement(props) {
var centered = props.centered,
children = props.children,
className = props.className,
content = props.content,
test = props.test,
unit = props.unit;
var classes = cx('ui', unit, useKeyOnly(centered, 'centered'), useKeyOnly(test, 'test'), 'ad', className);
var rest = getUnhandledProps$1(Advertisement, props);
var ElementType = getElementType(Advertisement, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
"data-text": test
}), isNil$1(children) ? content : children);
}
Advertisement.handledProps = ["as", "centered", "children", "className", "content", "test", "unit"];
Advertisement.propTypes = {};/**
* A card can contain a description with one or more paragraphs.
*/
function CardDescription(props) {
var children = props.children,
className = props.className,
content = props.content,
textAlign = props.textAlign;
var classes = cx(useTextAlignProp(textAlign), 'description', className);
var rest = getUnhandledProps$1(CardDescription, props);
var ElementType = getElementType(CardDescription, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
CardDescription.handledProps = ["as", "children", "className", "content", "textAlign"];
CardDescription.propTypes = {};/**
* A card can contain a header.
*/
function CardHeader(props) {
var children = props.children,
className = props.className,
content = props.content,
textAlign = props.textAlign;
var classes = cx(useTextAlignProp(textAlign), 'header', className);
var rest = getUnhandledProps$1(CardHeader, props);
var ElementType = getElementType(CardHeader, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
CardHeader.handledProps = ["as", "children", "className", "content", "textAlign"];
CardHeader.propTypes = {};/**
* A card can contain content metadata.
*/
function CardMeta(props) {
var children = props.children,
className = props.className,
content = props.content,
textAlign = props.textAlign;
var classes = cx(useTextAlignProp(textAlign), 'meta', className);
var rest = getUnhandledProps$1(CardMeta, props);
var ElementType = getElementType(CardMeta, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
CardMeta.handledProps = ["as", "children", "className", "content", "textAlign"];
CardMeta.propTypes = {};/**
* A card can contain blocks of content or extra content meant to be formatted separately from the main content.
*/
function CardContent(props) {
var children = props.children,
className = props.className,
content = props.content,
description = props.description,
extra = props.extra,
header = props.header,
meta = props.meta,
textAlign = props.textAlign;
var classes = cx(useKeyOnly(extra, 'extra'), useTextAlignProp(textAlign), 'content', className);
var rest = getUnhandledProps$1(CardContent, props);
var ElementType = getElementType(CardContent, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
if (!isNil$1(content)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), content);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), createShorthand(CardHeader, function (val) {
return {
content: val
};
}, header, {
autoGenerateKey: false
}), createShorthand(CardMeta, function (val) {
return {
content: val
};
}, meta, {
autoGenerateKey: false
}), createShorthand(CardDescription, function (val) {
return {
content: val
};
}, description, {
autoGenerateKey: false
}));
}
CardContent.handledProps = ["as", "children", "className", "content", "description", "extra", "header", "meta", "textAlign"];
CardContent.propTypes = {};/**
* A group of cards.
*/
function CardGroup(props) {
var centered = props.centered,
children = props.children,
className = props.className,
content = props.content,
doubling = props.doubling,
items = props.items,
itemsPerRow = props.itemsPerRow,
stackable = props.stackable,
textAlign = props.textAlign;
var classes = cx('ui', useKeyOnly(centered, 'centered'), useKeyOnly(doubling, 'doubling'), useKeyOnly(stackable, 'stackable'), useTextAlignProp(textAlign), useWidthProp(itemsPerRow), 'cards', className);
var rest = getUnhandledProps$1(CardGroup, props);
var ElementType = getElementType(CardGroup, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
if (!isNil$1(content)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), content);
}
var itemsJSX = map(items, function (item) {
var key = item.key || [item.header, item.description].join('-');
return /*#__PURE__*/React__default.createElement(Card, _extends$6({
key: key
}, item));
});
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), itemsJSX);
}
CardGroup.handledProps = ["as", "centered", "children", "className", "content", "doubling", "items", "itemsPerRow", "stackable", "textAlign"];
CardGroup.propTypes = {};/**
* A card displays site content in a manner similar to a playing card.
*/
var Card = /*#__PURE__*/function (_Component) {
_inheritsLoose(Card, _Component);
function Card() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this.handleClick = function (e) {
var onClick = _this.props.onClick;
if (onClick) onClick(e, _this.props);
};
return _this;
}
var _proto = Card.prototype;
_proto.render = function render() {
var _this$props = this.props,
centered = _this$props.centered,
children = _this$props.children,
className = _this$props.className,
color = _this$props.color,
content = _this$props.content,
description = _this$props.description,
extra = _this$props.extra,
fluid = _this$props.fluid,
header = _this$props.header,
href = _this$props.href,
image = _this$props.image,
link = _this$props.link,
meta = _this$props.meta,
onClick = _this$props.onClick,
raised = _this$props.raised;
var classes = cx('ui', color, useKeyOnly(centered, 'centered'), useKeyOnly(fluid, 'fluid'), useKeyOnly(link, 'link'), useKeyOnly(raised, 'raised'), 'card', className);
var rest = getUnhandledProps$1(Card, this.props);
var ElementType = getElementType(Card, this.props, function () {
if (onClick) return 'a';
});
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
href: href,
onClick: this.handleClick
}), children);
}
if (!isNil$1(content)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
href: href,
onClick: this.handleClick
}), content);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes,
href: href,
onClick: this.handleClick
}), Image.create(image, {
autoGenerateKey: false,
defaultProps: {
ui: false,
wrapped: true
}
}), (description || header || meta) && /*#__PURE__*/React__default.createElement(CardContent, {
description: description,
header: header,
meta: meta
}), extra && /*#__PURE__*/React__default.createElement(CardContent, {
extra: true
}, extra));
};
return Card;
}(Component);
Card.handledProps = ["as", "centered", "children", "className", "color", "content", "description", "extra", "fluid", "header", "href", "image", "link", "meta", "onClick", "raised"];
Card.propTypes = {};
Card.Content = CardContent;
Card.Description = CardDescription;
Card.Group = CardGroup;
Card.Header = CardHeader;
Card.Meta = CardMeta;/**
* A comment can contain an action.
*/
function CommentAction(props) {
var active = props.active,
className = props.className,
children = props.children,
content = props.content;
var classes = cx(useKeyOnly(active, 'active'), className);
var rest = getUnhandledProps$1(CommentAction, props);
var ElementType = getElementType(CommentAction, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
CommentAction.handledProps = ["active", "as", "children", "className", "content"];
CommentAction.defaultProps = {
as: 'a'
};
CommentAction.propTypes = {};/**
* A comment can contain an list of actions a user may perform related to this comment.
*/
function CommentActions(props) {
var className = props.className,
children = props.children,
content = props.content;
var classes = cx('actions', className);
var rest = getUnhandledProps$1(CommentActions, props);
var ElementType = getElementType(CommentActions, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
CommentActions.handledProps = ["as", "children", "className", "content"];
CommentActions.propTypes = {};/**
* A comment can contain an author.
*/
function CommentAuthor(props) {
var className = props.className,
children = props.children,
content = props.content;
var classes = cx('author', className);
var rest = getUnhandledProps$1(CommentAuthor, props);
var ElementType = getElementType(CommentAuthor, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
CommentAuthor.handledProps = ["as", "children", "className", "content"];
CommentAuthor.propTypes = {};/**
* A comment can contain an image or avatar.
*/
function CommentAvatar(props) {
var className = props.className,
src = props.src;
var classes = cx('avatar', className);
var rest = getUnhandledProps$1(CommentAvatar, props);
var _partitionHTMLProps = partitionHTMLProps(rest, {
htmlProps: htmlImageProps
}),
imageProps = _partitionHTMLProps[0],
rootProps = _partitionHTMLProps[1];
var ElementType = getElementType(CommentAvatar, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rootProps, {
className: classes
}), createHTMLImage(src, {
autoGenerateKey: false,
defaultProps: imageProps
}));
}
CommentAvatar.handledProps = ["as", "className", "src"];
CommentAvatar.propTypes = {};/**
* A comment can contain content.
*/
function CommentContent(props) {
var className = props.className,
children = props.children,
content = props.content;
var classes = cx(className, 'content');
var rest = getUnhandledProps$1(CommentContent, props);
var ElementType = getElementType(CommentContent, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
CommentContent.handledProps = ["as", "children", "className", "content"];
CommentContent.propTypes = {};/**
* Comments can be grouped.
*/
function CommentGroup(props) {
var className = props.className,
children = props.children,
collapsed = props.collapsed,
content = props.content,
minimal = props.minimal,
size = props.size,
threaded = props.threaded;
var classes = cx('ui', size, useKeyOnly(collapsed, 'collapsed'), useKeyOnly(minimal, 'minimal'), useKeyOnly(threaded, 'threaded'), 'comments', className);
var rest = getUnhandledProps$1(CommentGroup, props);
var ElementType = getElementType(CommentGroup, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
CommentGroup.handledProps = ["as", "children", "className", "collapsed", "content", "minimal", "size", "threaded"];
CommentGroup.propTypes = {};/**
* A comment can contain metadata about the comment, an arbitrary amount of metadata may be defined.
*/
function CommentMetadata(props) {
var className = props.className,
children = props.children,
content = props.content;
var classes = cx('metadata', className);
var rest = getUnhandledProps$1(CommentMetadata, props);
var ElementType = getElementType(CommentMetadata, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
CommentMetadata.handledProps = ["as", "children", "className", "content"];
CommentMetadata.propTypes = {};/**
* A comment can contain text.
*/
function CommentText(props) {
var className = props.className,
children = props.children,
content = props.content;
var classes = cx(className, 'text');
var rest = getUnhandledProps$1(CommentText, props);
var ElementType = getElementType(CommentText, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
CommentText.handledProps = ["as", "children", "className", "content"];
CommentText.propTypes = {};/**
* A comment displays user feedback to site content.
*/
function Comment(props) {
var className = props.className,
children = props.children,
collapsed = props.collapsed,
content = props.content;
var classes = cx(useKeyOnly(collapsed, 'collapsed'), 'comment', className);
var rest = getUnhandledProps$1(Comment, props);
var ElementType = getElementType(Comment, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
Comment.handledProps = ["as", "children", "className", "collapsed", "content"];
Comment.propTypes = {};
Comment.Author = CommentAuthor;
Comment.Action = CommentAction;
Comment.Actions = CommentActions;
Comment.Avatar = CommentAvatar;
Comment.Content = CommentContent;
Comment.Group = CommentGroup;
Comment.Metadata = CommentMetadata;
Comment.Text = CommentText;/**
* An item can contain a header.
*/
function ItemHeader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('header', className);
var rest = getUnhandledProps$1(ItemHeader, props);
var ElementType = getElementType(ItemHeader, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
ItemHeader.handledProps = ["as", "children", "className", "content"];
ItemHeader.propTypes = {};
ItemHeader.create = createShorthandFactory(ItemHeader, function (content) {
return {
content: content
};
});/**
* An item can contain a description with a single or multiple paragraphs.
*/
function ItemDescription(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('description', className);
var rest = getUnhandledProps$1(ItemDescription, props);
var ElementType = getElementType(ItemDescription, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
ItemDescription.handledProps = ["as", "children", "className", "content"];
ItemDescription.propTypes = {};
ItemDescription.create = createShorthandFactory(ItemDescription, function (content) {
return {
content: content
};
});/**
* An item can contain extra content meant to be formatted separately from the main content.
*/
function ItemExtra(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('extra', className);
var rest = getUnhandledProps$1(ItemExtra, props);
var ElementType = getElementType(ItemExtra, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
ItemExtra.handledProps = ["as", "children", "className", "content"];
ItemExtra.propTypes = {};
ItemExtra.create = createShorthandFactory(ItemExtra, function (content) {
return {
content: content
};
});/**
* An item can contain content metadata.
*/
function ItemMeta(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('meta', className);
var rest = getUnhandledProps$1(ItemMeta, props);
var ElementType = getElementType(ItemMeta, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
ItemMeta.handledProps = ["as", "children", "className", "content"];
ItemMeta.propTypes = {};
ItemMeta.create = createShorthandFactory(ItemMeta, function (content) {
return {
content: content
};
});/**
* An item can contain content.
*/
function ItemContent(props) {
var children = props.children,
className = props.className,
content = props.content,
description = props.description,
extra = props.extra,
header = props.header,
meta = props.meta,
verticalAlign = props.verticalAlign;
var classes = cx(useVerticalAlignProp(verticalAlign), 'content', className);
var rest = getUnhandledProps$1(ItemContent, props);
var ElementType = getElementType(ItemContent, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), ItemHeader.create(header, {
autoGenerateKey: false
}), ItemMeta.create(meta, {
autoGenerateKey: false
}), ItemDescription.create(description, {
autoGenerateKey: false
}), ItemExtra.create(extra, {
autoGenerateKey: false
}), content);
}
ItemContent.handledProps = ["as", "children", "className", "content", "description", "extra", "header", "meta", "verticalAlign"];
ItemContent.propTypes = {};/**
* A group of items.
*/
function ItemGroup(props) {
var children = props.children,
className = props.className,
content = props.content,
divided = props.divided,
items = props.items,
link = props.link,
relaxed = props.relaxed,
unstackable = props.unstackable;
var classes = cx('ui', useKeyOnly(divided, 'divided'), useKeyOnly(link, 'link'), useKeyOnly(unstackable, 'unstackable'), useKeyOrValueAndKey(relaxed, 'relaxed'), 'items', className);
var rest = getUnhandledProps$1(ItemGroup, props);
var ElementType = getElementType(ItemGroup, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
if (!isNil$1(content)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), content);
}
var itemsJSX = map(items, function (item) {
var childKey = item.childKey,
itemProps = _objectWithoutPropertiesLoose(item, ["childKey"]);
var finalKey = childKey || [itemProps.content, itemProps.description, itemProps.header, itemProps.meta].join('-');
return /*#__PURE__*/React__default.createElement(Item, _extends$6({}, itemProps, {
key: finalKey
}));
});
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), itemsJSX);
}
ItemGroup.handledProps = ["as", "children", "className", "content", "divided", "items", "link", "relaxed", "unstackable"];
ItemGroup.propTypes = {};/**
* An item can contain an image.
*/
function ItemImage(props) {
var size = props.size;
var rest = getUnhandledProps$1(ItemImage, props);
return /*#__PURE__*/React__default.createElement(Image, _extends$6({}, rest, {
size: size,
ui: !!size,
wrapped: true
}));
}
ItemImage.handledProps = ["size"];
ItemImage.propTypes = {};
ItemImage.create = createShorthandFactory(ItemImage, function (src) {
return {
src: src
};
});/**
* An item view presents large collections of site content for display.
*/
function Item(props) {
var children = props.children,
className = props.className,
content = props.content,
description = props.description,
extra = props.extra,
header = props.header,
image = props.image,
meta = props.meta;
var classes = cx('item', className);
var rest = getUnhandledProps$1(Item, props);
var ElementType = getElementType(Item, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), ItemImage.create(image, {
autoGenerateKey: false
}), /*#__PURE__*/React__default.createElement(ItemContent, {
content: content,
description: description,
extra: extra,
header: header,
meta: meta
}));
}
Item.handledProps = ["as", "children", "className", "content", "description", "extra", "header", "image", "meta"];
Item.Content = ItemContent;
Item.Description = ItemDescription;
Item.Extra = ItemExtra;
Item.Group = ItemGroup;
Item.Header = ItemHeader;
Item.Image = ItemImage;
Item.Meta = ItemMeta;
Item.propTypes = {};/**
* A group of statistics.
*/
function StatisticGroup(props) {
var children = props.children,
className = props.className,
color = props.color,
content = props.content,
horizontal = props.horizontal,
inverted = props.inverted,
items = props.items,
size = props.size,
widths = props.widths;
var classes = cx('ui', color, size, useKeyOnly(horizontal, 'horizontal'), useKeyOnly(inverted, 'inverted'), useWidthProp(widths), 'statistics', className);
var rest = getUnhandledProps$1(StatisticGroup, props);
var ElementType = getElementType(StatisticGroup, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
if (!isNil$1(content)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), content);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), map(items, function (item) {
return Statistic.create(item);
}));
}
StatisticGroup.handledProps = ["as", "children", "className", "color", "content", "horizontal", "inverted", "items", "size", "widths"];
StatisticGroup.propTypes = {};/**
* A statistic can contain a label to help provide context for the presented value.
*/
function StatisticLabel(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx('label', className);
var rest = getUnhandledProps$1(StatisticLabel, props);
var ElementType = getElementType(StatisticLabel, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
StatisticLabel.handledProps = ["as", "children", "className", "content"];
StatisticLabel.propTypes = {};
StatisticLabel.create = createShorthandFactory(StatisticLabel, function (content) {
return {
content: content
};
});/**
* A statistic can contain a numeric, icon, image, or text value.
*/
function StatisticValue(props) {
var children = props.children,
className = props.className,
content = props.content,
text = props.text;
var classes = cx(useKeyOnly(text, 'text'), 'value', className);
var rest = getUnhandledProps$1(StatisticValue, props);
var ElementType = getElementType(StatisticValue, props);
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), isNil$1(children) ? content : children);
}
StatisticValue.handledProps = ["as", "children", "className", "content", "text"];
StatisticValue.propTypes = {};
StatisticValue.create = createShorthandFactory(StatisticValue, function (content) {
return {
content: content
};
});/**
* A statistic emphasizes the current value of an attribute.
*/
function Statistic(props) {
var children = props.children,
className = props.className,
color = props.color,
content = props.content,
floated = props.floated,
horizontal = props.horizontal,
inverted = props.inverted,
label = props.label,
size = props.size,
text = props.text,
value = props.value;
var classes = cx('ui', color, size, useValueAndKey(floated, 'floated'), useKeyOnly(horizontal, 'horizontal'), useKeyOnly(inverted, 'inverted'), 'statistic', className);
var rest = getUnhandledProps$1(Statistic, props);
var ElementType = getElementType(Statistic, props);
if (!isNil$1(children)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), children);
}
if (!isNil$1(content)) {
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), content);
}
return /*#__PURE__*/React__default.createElement(ElementType, _extends$6({}, rest, {
className: classes
}), StatisticValue.create(value, {
defaultProps: {
text: text
},
autoGenerateKey: false
}), StatisticLabel.create(label, {
autoGenerateKey: false
}));
}
Statistic.handledProps = ["as", "children", "className", "color", "content", "floated", "horizontal", "inverted", "label", "size", "text", "value"];
Statistic.propTypes = {};
Statistic.Group = StatisticGroup;
Statistic.Label = StatisticLabel;
Statistic.Value = StatisticValue;
Statistic.create = createShorthandFactory(Statistic, function (content) {
return {
content: content
};
});var baseColors = {
blue: "#172749",
red: "#fe0000",
grey: "#5b5b5b",
success: "#28a745",
info: "#31CCEC",
warning: "#ffc107",
danger: "#dc3545",
light: "#d2d7db",
offWhite: "#f3f4f5",
dark: "#343c42",
black: "#070707",
white: "#fff"
};
var defaultColors = _extends$7({}, baseColors, {
primary: baseColors.blue,
secondary: baseColors.white,
accent: baseColors.red
});// REVIEW: this format provides the best format for hover intellisense without completely cluttering
/**
* @typedef {{ start: "flex-start", end: "flex-end", center: "center", initial: "initial", split: "space-between", justify: "normal" }} flexAlignMap
* @type {flexAlignMap}
*/
var flexAlignMap = {
start: "flex-start",
end: "flex-end",
center: "center",
initial: "initial",
split: "space-between",
// only valid for justify (content?)
// value doesn't matter since really isn't used
justify: "normal"
};
/**
* @typedef {{ start: "left", end: "right", center: "center", initial: "initial", justify: "justify" }} textAlignMap
* @type {textAlignMap}
*/
var textAlignMap = {
start: "left",
end: "right",
center: "center",
initial: "initial",
justify: "justify"
}; // needs the type narrowed
// https://2ality.com/2020/06/type-guards-assertion-functions-typescript.html
/**
* @typedef {{none: "0", fitted: "0.25em", compact: "0.5em", tight: "1em", base: "2em",relaxed: "4em", loose: "6em"}} spacingMap
* @type {spacingMap}
*/
var spacingMap = Object.freeze({
none: "0",
fitted: "0.25em",
compact: "0.5em",
tight: "1em",
base: "2em",
relaxed: "4em",
loose: "6em"
});
/**
* @typedef {{ small: 90, base: 155, large: 215 }} logoSizes
* @type {logoSizes}
*/
var logoSizes = {
small: 90,
base: 155,
large: 215
};
/**
* numbers are used with `em`
*
* @typedef {{ small: 4, base: 6, large: 8 }} logoSizesSVG
* @type {logoSizesSVG}
*/
var logoSizesSVG = {
small: 4,
base: 6,
large: 8
};
/**
* @typedef {{mini: "0.4em", tiny: "0.5em", small: "0.75em", medium: "1em", large: "1.5em", big: "2em", bigger: "3em", huge: "4em", massive: "8em" }} iconMap
* @type {iconMap}
*/
var iconMap = {
mini: "0.4em",
tiny: "0.5em",
small: "0.75em",
medium: "1em",
large: "1.5em",
big: "2em",
bigger: "3em",
huge: "4em",
massive: "8em"
};/**
* Capitalize first letter of words and remove spaces.
*
* @param {string} str - arbitrary input
* @returns {string} parsed into title-case with spaces removed
* @example
*
* toJoinedTitleCase('an arbitrary string input')
* // => 'AnArbitraryStringInput'
*/
var toJoinedTitleCase = function toJoinedTitleCase(str) {
if (str === void 0) {
str = "";
}
return str.replace(/\w*/g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.slice(1);
}).replace(/\W/g, "");
};
/**
* Clamp duration of scrolling.
*
* Used for smooth scrolling when clicking anchor link
* with `react-scroll` plugin, duration increases with dist.
*
* @requires `react-scroll`
* @param {number} scrollDistanceInPx - distance of element from viewport
* @returns {number} ms equal to scroll distance capped at upper and lower bounds of 800 & 2000
*/
var calcDuration = function calcDuration(scrollDistanceInPx) {
var min = 800;
var max = 2000;
return Math.min(Math.max(Math.abs(scrollDistanceInPx), min), max);
};
/**
* Lowercase and replace spaces with dashes.
*
* @param {string} str - arbitrary input
* @returns {string} parsed output
* @example
*
* process('An Arbitrary String Input')
* // => 'an-arbitrary-string-input'
*/
var process = function process(str) {
if (str === void 0) {
str = "";
}
return str.toLowerCase().replace(/\W/g, "-");
};
/**
* Convert camel case string to kebab case.
*
* @param {string} str - arbitrary input
* @returns {string} parsed output
* @example
*
* camelCaseToDash('userId')
* // => 'user-id'
* camelCaseToDash('waitAMoment')
* // => 'wait-a-moment'
* camelCaseToDash('TurboPascal')
* // => 'turbo-pascal'
*/
var camelToKebab = function camelToKebab(str) {
if (str === void 0) {
str = "";
}
return str.replace(/([A-Za-z])(?=[A-Z])/g, "$1-").toLowerCase();
};
/**
* URL encodes the data of key, value pairs as submitted by a form.
*
* @param {Record<string, string>} data - arbitrary form data
* @returns {string} URL encoded data
* @example
*
* encode({ key1: 'val1', key2: 'val2' })
* // => 'key1=val1&key2=val2'
*/
var encode = function encode(data) {
return Object.entries(data).map(function (_ref) {
var key = _ref[0],
val = _ref[1];
return encodeURIComponent(key) + "=" + encodeURIComponent(val);
}).join("&");
};
/**
* identical to `.includes()` on `String.prototype` or `Array.prototype` but accepts multiple terms
*
* @param {string | any[]} con - anything that has an `include()` method on its prototype
* @param {any[]} searchVals - targets to check for presence in `con`
* @returns {boolean} true if any of the `searchVals` are included in the `con`
* @example
*
* includesAny("paddingTop", ["padding", "margin"])
* // => true
* includesAny(["paddingTop"], ["padding", "margin"])
* // => false
*/
var includesAny = function includesAny(con, searchVals) {
if (searchVals === void 0) {
searchVals = [];
}
return searchVals.some(function (searchVal) {
return con.includes(searchVal);
});
};
/**
* creates a new obj without any keys that were declared as undefined on the input obj
*
* @param {any} obj - arbitrary object
* @returns {string} input object without `undefined` property keys
* @example
*
* removeUndef({ key1: 'val1', key2: undefined })
* // => {key1: 'val1'}
*/
var removeUndef = function removeUndef(obj) {
return Object.fromEntries(Object.entries(obj).filter(function (kv) {
return kv[1] != null && kv[1] !== undefined;
}));
};
/**
* Soft merge new props into a React Component without
* overwriting the original props (preserves immutability).
*
* @param {React.ReactElement<P>} [element] - instance target to receive new props
* @param {{}} [props] - object of new props
* @returns {false | React.ReactElement<Intersect<P, props>>} cloned React Element with shallowly merged props
* @requires `react`
* @template {{}} P - props obj
* @example
*
* withNewProps(<Container prop0='val0' />, { prop1: 'val1', prop2: 'val2' })
* // => <Container prop0='val0' prop1='val1' prop2='val2' />
* withNewProps(<Container prop3='important-value' />, { prop3: 'val3', prop4: 'val4' })
* // => <Container prop3='important-value' prop4='val4' />
*
*/
var withNewProps = function withNewProps(element, props) {
if (props === void 0) {
props = {};
}
return element && /*#__PURE__*/React__default.cloneElement(element, _extends$7({}, removeUndef(props), element.props));
};
/**
* **hard** merge new props into a React Component and overwrite the original props.
*
* @param {React.ReactElement<P>} [element] - instance target to receive new props
* @param {{}} [props] - object of new props
* @returns {false | React.ReactElement<Intersect<P, props>>} cloned React Element with shallowly merged props
* @requires `react`
* @template {{}} P - props obj
* @example
*
* withNewProps(<Container prop0='val0' />, { prop1: 'val1', prop2: 'val2' })
* // => <Container prop0='val0' prop1='val1' prop2='val2' />
* withNewProps(<Container prop3='important-value' />, { prop3: 'val3', prop4: 'val4' })
* // => <Container prop3='val3' prop4='val4' />
*
*/
var withProps = function withProps(element, props) {
if (props === void 0) {
props = {};
}
return element && /*#__PURE__*/React__default.cloneElement(element, _extends$7({}, element.props, removeUndef(props)));
};
/**
* helper function to find and return semantic name used for debugging components
*
* @param {object} target - usually a react element
* @param {string=} target.displayName - manually defined name for debug
* @param {string=} target.name - generally assigned via React from var name
* @returns {string} best "name" of element
*/
var getComponentName = function getComponentName(_ref2) {
var displayName = _ref2.displayName,
name = _ref2.name;
return displayName || name || "SSUIComponent";
};
/**
* add a string tab label to React DevTools via displayName property
*
* @template T
* @param {string} tag - label to display
* @param {T} target - any component definition
* @returns {T & { displayName: string }} mutated input for convenience
*/
var withTag = function withTag(tag, target) {
// eslint-disable-next-line no-param-reassign
target.displayName = tag + "(" + getComponentName(target) + ")";
return target;
};
/**
* @deprecated replaced with transient props from styled-components
*
* Dynamically prevent props from reaching DOM elements
* by providing styled-components a prop blacklist. Most
* useful to prevent props intended for a styled component
* from getting picked up by the {...rest} of the base component.
*
* Technical: closes over input Component and coerces rendered EnhancedComponent element
* to Component.type.
*
* @param {React.ComponentType<{ children?: any; ref?: any }>} Component - tgt to control props of
* @param {string[]} propKeys - array of prop keys to block
* @returns {React.ForwardRefExoticComponent<Intersect<Pick<Intersect<Record<string, any>, {children?: any}>, number|string>, React.RefAttributes<any>>>}
* ref forwarding function that removes unwanted `propKeys` from original props
* @requires `react` && usually `styled-components`
* @see https://www.styled-components.com/docs/faqs#why-am-i-getting-html-attribute-warnings
* @todo check out making curried like this: https://codesandbox.io/s/l50mlwqo1q
* @example
*
* const ContainerWithPassThrough = ({ className, ...rest }) => (
* <div className={className} {...rest} />
* )
*
* const FilteredContainer = withoutProps(ContainerWithPassThrough, ['color'])
* const Container = styled(FilteredContainer)`
* color: ${({ color }) => color};
* `
*
* const Component = ({ color }) => (
* <Container
* color={color}
* className='con'
* />
* )
*
* <Component color='blue' />
* // => <div className='con' /> // with a blue color
*/
var withoutProps = function withoutProps(Component, propKeys) {
if (propKeys === void 0) {
propKeys = [];
}
// facilitate debugging with named func
var FilteredComponent = function FilteredComponent(_ref3, ref) {
var children = _ref3.children,
rest = _objectWithoutPropertiesLoose$2(_ref3, ["children"]);
var filteredProps = Object.fromEntries(Object.entries(rest).filter(function (_ref4) {
var key = _ref4[0];
return !propKeys.includes(key);
}));
return /*#__PURE__*/React__default.createElement(Component, Object.assign({
ref: ref
}, filteredProps), children);
}; // attach "FilteredProps" tag in React Dev Tools v5
FilteredComponent.displayName = "FilteredProps(" + getComponentName(Component) + ")"; // ensure ref points to Element NOT functional FilteredComponent
var result = /*#__PURE__*/React__default.forwardRef(FilteredComponent);
result.displayName = "FilteredProps(" + result.displayName + ")"; // pass thru original name tags
return result;
}; // helpful for testing
var sleep = function sleep(ms) {
return function (data) {
return new Promise(function (resolve) {
return setTimeout(function () {
return resolve(data);
}, ms);
});
};
};/* eslint-disable jsdoc/check-tag-names */
/**
* allow quick implementation of standardized media query sizes
*
* phone: `<= 425px`
*
* tablet: `426px - 767px`
*
* mobile: `<= 767px`
*
* laptop: `768px - 991px`
*
* portable: `<= 991px`
*
* stationary: `>= 992px`
*
* desktop: `992px - 1199px`
*
* widescreen: `1200px - 1919px`
*
* ultrawide: `>= 1920px`
*/
var media = {
/**
* apply styled-component css when screen-size `<= 425px`
*
* @type {"screen and (max-width: 425px)"}
* @example
* const Component = styled.div`
* [at]media ${media.phone} {
* font-size: 0.97rem;
* }
* `
*/
phone: "screen and (max-width: 425px)",
/**
* apply styled-component css when screen-size `>= 426px` && screen-size `<= 767px`
*
* @type {"screen and (min-width: 426px) and (max-width: 767px)"}
* @example
* const Component = styled.div`
* [at]media ${media.tablet} {
* font-size: 0.97rem;
* }
* `
*/
tablet: "screen and (min-width: 426px) and (max-width: 767px)",
/**
* apply styled-component css when screen-size `<= 767px`
*
* @type {"screen and (max-width: 767px)"}
* @example
* const Component = styled.div`
* [at]media ${media.mobile} {
* font-size: 0.97rem;
* }
* `
*/
mobile: "screen and (max-width: 767px)",
/**
* apply styled-component css when screen-size `>= 768px` && screen-size `<= 991px`
*
* @type {"screen and (min-width: 768px) and (max-width:991px)"}
* @example
* const Component = styled.div`
* [at]media ${media.laptop} {
* font-size: 0.97rem;
* }
* `
*/
laptop: "screen and (min-width: 768px) and (max-width: 991px)",
/**
* apply styled-component css when screen-size `<= 991px`
*
* @type {"screen and (max-width: 991px)"}
* @example
* const Component = styled.div`
* [at]media ${media.portable} {
* font-size: 0.97rem;
* }
* `
*/
portable: "screen and (max-width: 991px)",
/**
* apply styled-component css when screen-size `>= 992px`
*
* @type {"screen and (min-width: 992px)"}
* @example
* const Component = styled.div`
* [at]media ${media.stationary} {
* font-size: 0.97rem;
* }
* `
*/
stationary: "screen and (min-width: 992px)",
/**
* apply styled-component css when screen-size `>= 992px` && screen-size `<= 1199px`
*
* @type {"screen and (min-width: 992px) and (max-width: 1199px)"}
* @example
* const Component = styled.div`
* [at]media ${media.desktop} {
* font-size: 0.97rem;
* }
* `
*/
desktop: "screen and (min-width: 992px) and (max-width: 1199px)",
/**
* apply styled-component css when screen-size `1200px - 1919px`
*
* @type {"screen and (min-width: 1200px) and (max-width: 1919px)"}
* @example
* const Component = styled.div`
* [at]media ${media.widescreen} {
* font-size: 0.97rem;
* }
* `
*/
widescreen: "screen and (min-width: 1200px)",
/**
* apply styled-component css when screen-size `>= 1920px`
*
* @type {"screen and (min-width: 1920px"}
* @example
* const Component = styled.div`
* [at]media ${media.ultrawide} {
* font-size: 0.97rem;
* }
* `
*/
ultrawide: "screen and (min-width: 1920px)"
};/**
* Convert an iterable of key, value pair arrays to an object, reverses Object.entries(),
* shim for Object.fromEntries().
*
* @param {[string, any][]} iter - iterable of tuple arrays of key, value pairs
* @returns {Record<string, any>} obj with key, value pairs assigned
*/
var ObjectFromEntries = function ObjectFromEntries(iter) {
var obj = {};
var arr = [].concat(iter);
if (Object.getOwnPropertyDescriptor(obj, "fromEntries")) {
return Object.fromEntries(arr);
}
arr.forEach(function (pair) {
// eslint-disable-next-line no-new-object
if (new Object(pair) !== pair) {
throw new TypeError("iterable for fromEntries should yield objects");
}
var key = pair[0],
val = pair[1];
Object.defineProperty(obj, key, {
configurable: true,
enumerable: true,
writable: true,
value: val
});
});
return obj;
};/**
* @typedef {import("../types").SpacingSide} SpacingSide
*/
var testUsingLastParamAsDefault = function testUsingLastParamAsDefault(sides) {
return function (fallback, _ref) {
_ref.internal;
var output = function output(raw) {
if (raw === void 0) {
raw = fallback;
}
var val = raw.$padding || raw.padding || raw; // priority goes to a props object
// decode supported strings like "compact"
if (Object.keys(spacingMap).includes(val)) val = spacingMap[val]; // NOTE: guaranteed to have a spacing unit string here (e.g. "20px", "10em", "0")
if (sides.includes("all")) {
return {
paddingBlockStart: val,
paddingBlockEnd: val,
paddingInlineStart: val,
paddingInlineEnd: val
};
}
var styles = {};
if (sides.includes("left")) styles.paddingInlineStart = val;
if (sides.includes("start")) styles.paddingInlineStart = val;
if (sides.includes("right")) styles.paddingInlineEnd = val;
if (sides.includes("end")) styles.paddingInlineEnd = val;
if (sides.includes("top")) styles.paddingBlockStart = val;
if (sides.includes("bottom")) styles.paddingBlockEnd = val;
if (sides.includes("horizontal")) {
styles.paddingInlineStart = val;
styles.paddingInlineEnd = val;
}
if (sides.includes("vertical")) {
styles.paddingBlockStart = val;
styles.paddingBlockEnd = val;
}
return styles;
}; // forward props if calling directly from styled-component (no default)
if (fallback.$padding || fallback.padding) return output();
return output;
};
};
/**
* helper to generate margin or padding func that can be used as a styled components
* function that accepts props or by executing the curried func, to return a string in
* spacing units
*
* @param {"padding" | "margin"} type - prefix for spacing CSS keys
* @returns {(sides: SpacingSide | SpacingSide[]) => (val: string | { $padding?: string, padding?: string }) => {}} curried
* function that can be expanded in a styled template string or left to automatically
* execute using props from styled component
* @example
*
* const styledObj = spacing("padding")("start")("1em") // =>> { paddingLeft: "1em" }
* const styledFunc = spacing("padding")("bottom") // =>> (props) => { paddingBottom: "2em" }
* const StyledComponent = styled.div`
* ${spacing("padding")("all")("0")};
* ${styledObj};
* ${styledFunc};
* `
*
* // usage as prop only applies to the `styledFunc` version
* const FC = () => (
* <StyledComponent $padding='4em' />
* )
*
* // => paddingLeft === 1em
* // => paddingTop === 0
* // => paddingRight === 4em
* // => paddingBottom === 0
*/
var spacing = function spacing(type) {
return function (sides) {
return function (rawVal, flags) {
if (flags === void 0) {
flags = [];
}
var val = rawVal["$" + type] || rawVal[type] || rawVal; // priority goes to a props object
// decode supported strings like "compact"
if (Object.keys(spacingMap).includes(val)) val = spacingMap[val]; // NOTE: guaranteed to have a spacing unit string here (e.g. "20px", "10em", "0")
var styles = {}; // translate inputted target sides to CSS property keys
if (includesAny(sides, ["left", "start", "horizontal", "all"])) {
styles[type + "Left"] = val;
}
if (includesAny(sides, ["right", "end", "horizontal", "all"])) {
styles[type + "Right"] = val;
}
if (includesAny(sides, ["top", "vertical", "all"])) {
styles[type + "Top"] = val;
}
if (includesAny(sides, ["bottom", "vertical", "all"])) {
styles[type + "Bottom"] = val;
} // apply flags by mapping properties to new object with modifications
return Object.fromEntries(Object.entries(styles).map(function (_ref2) {
var keyIn = _ref2[0],
valIn = _ref2[1];
var keyOut = keyIn;
var valOut = valIn;
if (includesAny(flags, ["important", "!"])) {
valOut = valOut + " !important";
} // wrap obj property in pseudo key
if (includesAny(flags, ["internal"])) {
if (includesAny(keyIn, ["Left", "Top", "Start"])) {
var _valOut;
valOut = (_valOut = {}, _valOut[keyOut] = valOut, _valOut);
keyOut = ":not(:first-child)";
}
if (includesAny(keyIn, ["Right", "Bottom", "End"])) {
var _valOut2;
valOut = (_valOut2 = {}, _valOut2[keyOut] = valOut, _valOut2);
keyOut = ":not(:last-child)";
}
}
if (includesAny(flags, ["external"])) {
if (includesAny(keyIn, ["Left", "Top", "Start"])) {
var _valOut3;
valOut = (_valOut3 = {}, _valOut3[keyOut] = valOut, _valOut3);
keyOut = ":first-child";
}
if (includesAny(keyIn, ["Right", "Bottom", "End"])) {
var _valOut4;
valOut = (_valOut4 = {}, _valOut4[keyOut] = valOut, _valOut4);
keyOut = ":last-child";
}
}
return [keyOut, valOut];
}));
};
};
};
/**
* can be used as a styled components function that accepts props or by executing the
* curried func, to return a string in spacing units
*
* @param sides - what sides to apply padding to, multiple sides supported as array
* @returns curried function that can be expanded in a styled template string or left to
* automatically execute using props from styled component
*
* @example
*
* const styledObj = padding("start")("1em") // =>> { paddingLeft: "1em" }
* const styledFunc = padding("bottom") // =>> (props) => { paddingBottom: "2em" }
* const StyledComponent = styled.div`
* ${padding("all")("0")};
* ${styledObj};
* ${styledFunc};
* `
*
* // usage as prop only applies to the `styledFunc` version
* const FC = () => (
* <StyledComponent $padding='4em' />
* )
*
* // => paddingLeft === 1em
* // => paddingTop === 0
* // => paddingRight === 4em
* // => paddingBottom === 0
*/
var padding = spacing("padding");
/**
* can be used as a styled components function that accepts props or by executing the
* curried func, to return a string in spacing units
*
* @param sides - what sides to apply margin to, multiple sides supported as array
* @returns curried function that can be expanded in a styled template string or left to
* automatically execute using props from styled component
*
* @example
*
* const styledObj = margin("start")("1em") // =>> { marginLeft: "1em" }
* const styledFunc = margin("bottom") // =>> (props) => { marginBottom: "2em" }
* const StyledComponent = styled.div`
* ${margin("all")("0")};
* ${styledObj};
* ${styledFunc};
* `
*
* // usage as prop only applies to the `styledFunc` version
* const FC = () => (
* <StyledComponent $margin='4em' />
* )
*
* // => marginLeft === 1em
* // => marginTop === 0
* // => marginRight === 4em
* // => marginBottom === 0
*/
var margin = spacing("margin");
/**
* Get a function to execute inside styled components that applies target
* css property to styled-component with backup preset from theme.
*
* @param {string} property - css property to target
* @returns {(preset: DefaultColor) => (props: Record<string, any>) => Record<string, any>}
* function that destructures `property` and applies it inside style object
* @requires `styled-components`
* @example
* const StyledElement = styled.div`
* ${getProperty('$margin')('default')};
* `
*
* const FC = () => (
* <StyledElement $margin='2em' />
* )
*/
var getProperty = function getProperty(property) {
return function (preset) {
return function (props) {
var _ref3;
return _ref3 = {}, _ref3[property.slice(1)] = props[property] || props.theme[preset] || defaultColors[preset], _ref3;
};
};
};
/**
* Get a function to execute inside styled components that applies target
* css property as hover style to styled-component with backup preset from theme.
*
* **NOTE**: Input property and props require the word `Hover` appended to the end of the prop.
*
* @param {string} property - css property to target (with manually appended word `Hover`)
* @returns {(preset: DefaultColor) => (props: Record<string, any>) => FlattenSimpleInterpolation}
* function that destructures `property` and applies
* it inside style template wrapped with a hover pseudo-selector
* @requires `styled-components`
* @example
*
* const StyledElement = styled.div`
* ${getHoverProperty('$marginHover')('default')};
* `
*
* <StyledElement $marginHover='2em' />
*/
var getHoverProperty = function getHoverProperty(property) {
return function (preset) {
return function (props) {
var _hover;
var propKey = camelToKebab(property.slice(1, property.indexOf("Hover")));
return {
"&:hover": (_hover = {}, _hover[propKey] = props[property] || props.theme[preset] || defaultColors[preset], _hover)
};
};
};
};
/**
* Applies css property 'color' to styled-component with backup preset from theme.
*
* @param preset - optional preset to use from theme prop
* @returns function that destructures `property` and applies it inside style object
* @requires `styled-components`
* @example
*
* const StyledElement = styled.div`
* ${getColor('white')};
* `
*
* <StyledElement $color='red' />
*/
var getColor = getProperty("$color");
/**
* applies css property 'backgroundColor' to styled-component with backup preset from theme
*
* @param preset - optional preset to use from theme prop
* @returns function that destructures `property` and applies it inside style object
* @requires `styled-components`
* @example
*
* const StyledElement = styled.div`
* ${getBackgroundColor('secondary')};
* `
*
* <StyledElement $backgroundColor='red' />
*/
var getBackgroundColor = getProperty("$backgroundColor");
/**
* applies css property 'color' to styled-component with backup preset from theme
*
* **NOTE**: input property and props require the word `Hover` appended to the end of the prop
*
* @param preset - css property to target (with manually appended word `Hover`)
* @returns function that destructures `property` and applies it
* inside style template wrapped with a hover pseudo-selector
* @requires `styled-components`
* @example
*
* const StyledElement = styled.div`
* ${getHoverColor('primary')};
* `
*
* <StyledElement $colorHover='red' />
*/
var getHoverColor = getHoverProperty("$colorHover");
/**
* applies css property 'backgroundColor' to styled-component with backup preset from theme
*
* **NOTE**: input property and props require the word `Hover` appended to the end of the prop
*
* @param preset - css property to target (with manually appended word `Hover`)
* @returns function that destructures `property` and applies it
* inside style template wrapped with a hover pseudo-selector
* @requires `styled-components`
* @example
*
* const StyledElement = styled.div`
* ${getHoverBackgroundColor('primary')};
* `
*
* <StyledElement $backgroundColorHover='red' />
*/
var getHoverBackgroundColor = getHoverProperty("$backgroundColorHover");function _templateObject2$g() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n /* display: flex; */\n}\n"]);
_templateObject2$g = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$h() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n display: flex;\n justify-content: ", ";\n align-items: ", ";\n flex-direction: ", ";\n flex-wrap: ", ";\n}\n"]);
_templateObject$h = function _templateObject() {
return data;
};
return data;
}
var S$h = {}; // styled-components namespace
S$h.Flexbox = styled.div(_templateObject$h(), function (_ref) {
var $justify = _ref.$justify;
return flexAlignMap[$justify];
}, function (_ref2) {
var $align = _ref2.$align;
return flexAlignMap[$align];
}, function (_ref3) {
var $column = _ref3.$column;
return $column ? "column" : undefined;
}, function (_ref4) {
var $wrap = _ref4.$wrap;
return $wrap ? "wrap" : undefined;
});
S$h.FlexItem = styled.div(_templateObject2$g());
var Flexbox = function Flexbox(_ref5) {
var justify = _ref5.justify,
align = _ref5.align,
column = _ref5.column,
wrap = _ref5.wrap,
children = _ref5.children,
rest = _objectWithoutPropertiesLoose$2(_ref5, ["justify", "align", "column", "wrap", "children"]);
return /*#__PURE__*/React__default.createElement(S$h.Flexbox, Object.assign({
$wrap: wrap,
$justify: justify,
$align: align,
$column: column
}, rest), React__default.Children.map(children, function (Child) {
return Child != null && Child.type ? /*#__PURE__*/React__default.createElement(S$h.FlexItem, Object.assign({
as: Child.type
}, Child.props), Child.props.children) : Child;
}));
};
Flexbox.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* position / justification of all content
*/
align: propTypes.oneOf(["center", "end", "initial", "justify", "split", "start"]),
/**
* primary content rendered inside the Flexbox
*/
children: propTypes.node,
/**
* direction of flex
*/
column: propTypes.bool,
/**
* position / justification of all content
*/
justify: propTypes.oneOf(["center", "end", "initial", "justify", "split", "start"]),
/**
* should use a wrapper instead of applying flex styles directly to children
*/
wrap: propTypes.bool
};function _templateObject6$2() {
var data = _taggedTemplateLiteralLoose(["\n@media not ", " {\n&&&&&& {\n ", "\n}\n }\n @media ", " {\n&&&&&& {\n ", "\n}\n }\n"]);
_templateObject6$2 = function _templateObject6() {
return data;
};
return data;
}
function _templateObject5$4() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n}\n"]);
_templateObject5$4 = function _templateObject5() {
return data;
};
return data;
}
function _templateObject4$5() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n position: absolute !important;\n top: 0;\n left: -0.5%;\n height: 100%;\n width: 100.5%;\n z-index: 3;\n}\n &&&&&& img:last-child {\n object-fit: cover !important;\n object-position: 45% 55% !important;\n }\n"]);
_templateObject4$5 = function _templateObject4() {
return data;
};
return data;
}
function _templateObject3$7() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n z-index: 10;\n text-align: ", ";\n position: relative;\n\n /* break words at syllable in non-chrome browsers */\n overflow-wrap: break-word;\n word-wrap: break-word;\n\n -ms-word-break: break-all;\n /* This is the dangerous one in WebKit, as it breaks things wherever */\n word-break: break-all;\n /* Instead use this non-standard one: */\n word-break: break-word;\n\n /* Adds a hyphen where the word breaks, if supported (No Blink) */\n hyphens: auto;\n}\n\n @media screen and (-webkit-min-device-pixel-ratio: 0) {\n&&&&&& {\n text-align: ", "\n}\n }\n"]);
_templateObject3$7 = function _templateObject3() {
return data;
};
return data;
}
function _templateObject2$f() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n z-index: 10;\n position: relative;\n color: ", ";\n}\n @media ", " {\n&&&&&& {\n text-align: center\n}\n }\n"]);
_templateObject2$f = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$g() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n text-align: ", ";\n}\n"]);
_templateObject$g = function _templateObject() {
return data;
};
return data;
}
var S$g = {}; // styled-components namespace
S$g.Section = styled.section(_templateObject$g(), function (_ref) {
var $align = _ref.$align;
return $align;
});
S$g.Header = styled(Header)(_templateObject2$f(), function (_ref2) {
var $color = _ref2.$color;
return $color;
}, media.mobile);
S$g.Content = styled(Header.Content)(_templateObject3$7(), function (_ref3) {
var $centered = _ref3.$centered;
return $centered && "justify";
}, function (_ref4) {
var $centered = _ref4.$centered;
return $centered && "left";
});
S$g.BackgroundImage = styled.img(_templateObject4$5());
S$g.Icon = styled.span(_templateObject5$4(), getColor("primary"));
S$g.FlexIcon = styled(Flexbox)(_templateObject6$2(), media.mobile, margin("end")("base"), media.mobile, margin("bottom")("1.5em"));
/**
* @type {typeof import(".").Blurb}
*/
var Blurb = function Blurb(_ref5) {
var _ref5$as = _ref5.as,
as = _ref5$as === void 0 ? "h2" : _ref5$as,
icon = _ref5.icon,
backgroundImage = _ref5.backgroundImage,
_ref5$align = _ref5.align,
align = _ref5$align === void 0 ? "center" : _ref5$align,
header = _ref5.header,
_ref5$color = _ref5.color,
color = _ref5$color === void 0 ? "" : _ref5$color,
_ref5$vertical = _ref5.vertical,
vertical = _ref5$vertical === void 0 ? false : _ref5$vertical,
children = _ref5.children,
rest = _objectWithoutPropertiesLoose$2(_ref5, ["as", "icon", "backgroundImage", "align", "header", "color", "vertical", "children"]);
return vertical ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Item, rest, /*#__PURE__*/React__default.createElement(S$g.FlexIcon, {
align: "center",
justify: "center"
}, /*#__PURE__*/React__default.createElement(S$g.Icon, null, withNewProps(icon, {
align: align
}))), /*#__PURE__*/React__default.createElement(Flexbox, {
as: Item.Content,
column: true,
justify: "center"
}, /*#__PURE__*/React__default.createElement(S$g.Header, {
forwardedAs: as
}, header), /*#__PURE__*/React__default.createElement(Item.Description, null, children)))) : /*#__PURE__*/React__default.createElement(S$g.Section, Object.assign({
$align: align
}, rest), backgroundImage && /*#__PURE__*/React__default.createElement(S$g.BackgroundImage, Object.assign({
as: backgroundImage.type
}, backgroundImage.props), backgroundImage.children), icon && /*#__PURE__*/React__default.createElement(S$g.Icon, null, withNewProps(icon, {
align: align
})), header && /*#__PURE__*/React__default.createElement(S$g.Header, {
forwardedAs: as,
$color: color
}, header), children && /*#__PURE__*/React__default.createElement(S$g.Content, {
$centered: align
}, children));
};
Blurb.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* position / justification of all content
*/
align: propTypes.oneOf(["center", "end", "initial", "justify", "split", "start"]),
/**
* element type to render `header` as (string or function)
*
* supports HTML tag as a string or React component definition
*
* @example
*
* 'div'
* 'section'
* {ReactComponent}
* Card
*/
as: propTypes.elementType,
/**
* element representing image to cover background
*/
backgroundImage: propTypes.node,
children: propTypes.node,
/**
* apply css supported color string to Header text, overrides theme / default
*/
color: propTypes.string,
/**
* primary content (styled as text)
*/
header: propTypes.node,
/**
* content above header
*/
icon: propTypes.node,
/**
* useful for rendering multiple blurbs in a column
*/
vertical: propTypes.bool
};function _templateObject10() {
var data = _taggedTemplateLiteralLoose(["\n max-width: 700px !important;\n @media ", " {\n flex-wrap: nowrap;\n }\n @media ", " {\n flex-wrap: nowrap;\n }\n @media ", " {\n flex-wrap: nowrap;\n }\n "]);
_templateObject10 = function _templateObject10() {
return data;
};
return data;
}
function _templateObject9() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n}\n"]);
_templateObject9 = function _templateObject9() {
return data;
};
return data;
}
function _templateObject8() {
var data = _taggedTemplateLiteralLoose(["\n ", ";\n\n &:last-of-type {\n ", ";\n }\n &:first-of-type {\n ", ";\n }\n "]);
_templateObject8 = function _templateObject8() {
return data;
};
return data;
}
function _templateObject7$1() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n}\n\n @media ", " {\n&&&&&& {\n box-shadow: none\n}\n }\n\n @media ", " {\n&&&&&& {\n ", ";\n ", ";\n ", "\n}\n }\n"]);
_templateObject7$1 = function _templateObject7() {
return data;
};
return data;
}
function _templateObject6$1() {
var data = _taggedTemplateLiteralLoose(["\n @media ", " {\n flex-wrap: nowrap;\n }\n @media ", " {\n flex-wrap: nowrap;\n }\n @media ", " {\n flex-wrap: nowrap;\n }\n "]);
_templateObject6$1 = function _templateObject6() {
return data;
};
return data;
}
function _templateObject5$3() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n}\n"]);
_templateObject5$3 = function _templateObject5() {
return data;
};
return data;
}
function _templateObject4$4() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n text-align: ", ";\n}\n"]);
_templateObject4$4 = function _templateObject4() {
return data;
};
return data;
}
function _templateObject3$6() {
var data = _taggedTemplateLiteralLoose(["\n@media ", " {\n&&&&&& {\n text-align: left\n}\n }\n"]);
_templateObject3$6 = function _templateObject3() {
return data;
};
return data;
}
function _templateObject2$e() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n}\n"]);
_templateObject2$e = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$f() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n}\n"]);
_templateObject$f = function _templateObject() {
return data;
};
return data;
}
var S$f = {}; // styled-components namespace
var MAX_COLUMNS = 4;
/* fix absurdly wide blurb segments on tablet size */
/* use "!important" to override .ui.text.container */
S$f.Blurbs = styled(Segment)(_templateObject$f(), function (_ref) {
var $padded = _ref.$padded;
return $padded === "top" && padding("top") || $padded === "bottom" && padding("bottom") || $padded && padding("vertical");
});
/* pad between title/content and items */
S$f.Header = styled(Container)(_templateObject2$e(), padding("bottom")("2.75em", ["!"]));
S$f.Title = styled(Header).attrs({
forwardedAs: "h2"
})(_templateObject3$6(), media.phone);
S$f.Content = styled(Header.Content)(_templateObject4$4(), function (_ref2) {
var $centered = _ref2.$centered;
return $centered && "justify";
});
S$f.Grid = styled(Grid)(_templateObject5$3(), function (_ref3) {
var $fullWidth = _ref3.$fullWidth;
return $fullWidth === "gutter" && css(_templateObject6$1(), media.laptop, media.desktop, media.widescreen);
});
S$f.GridCol = styled(Grid.Column)(_templateObject7$1(), function (_ref4) {
var $fullWidth = _ref4.$fullWidth;
return $fullWidth === "gutter" && css(_templateObject8(), margin("horizontal")("10px"), margin("right")("20px"), margin("left")("20px"));
}, media.laptop, media.mobile, padding("horizontal")("0"), padding("vertical")("2em", ["internal", "!"]), padding("vertical")("0", ["external", "!"]));
S$f.ItemGroup = styled(Item.Group)(_templateObject9(), function (_ref5) {
var $fullWidth = _ref5.$fullWidth;
return !$fullWidth && css(_templateObject10(), media.laptop, media.desktop, media.widescreen);
});
var Blurbs = function Blurbs(_ref6) {
var title = _ref6.title,
content = _ref6.content,
_ref6$fullWidth = _ref6.fullWidth,
fullWidth = _ref6$fullWidth === void 0 ? false : _ref6$fullWidth,
_ref6$centered = _ref6.centered,
centered = _ref6$centered === void 0 ? false : _ref6$centered,
_ref6$color = _ref6.color,
color = _ref6$color === void 0 ? "" : _ref6$color,
_ref6$secondary = _ref6.secondary,
secondary = _ref6$secondary === void 0 ? false : _ref6$secondary,
_ref6$padded = _ref6.padded,
padded = _ref6$padded === void 0 ? false : _ref6$padded,
_ref6$padding = _ref6.padding,
padding = _ref6$padding === void 0 ? "relaxed" : _ref6$padding,
_ref6$vertical = _ref6.vertical,
vertical = _ref6$vertical === void 0 ? false : _ref6$vertical,
children = _ref6.children,
rest = _objectWithoutPropertiesLoose$2(_ref6, ["title", "content", "fullWidth", "centered", "color", "secondary", "padded", "padding", "vertical", "children"]);
return /*#__PURE__*/React__default.createElement(S$f.Blurbs, Object.assign({
$padded: padded,
padding: padding,
forwardedAs: "section",
vertical: true,
basic: true,
secondary: secondary
}, rest), (title || content) && /*#__PURE__*/React__default.createElement(S$f.Header, null, title && /*#__PURE__*/React__default.createElement(S$f.Title, {
textAlign: centered ? "center" : undefined
}, title), content && /*#__PURE__*/React__default.createElement(Container, {
text: true
}, /*#__PURE__*/React__default.createElement(S$f.Content, {
$centered: centered
}, content))), vertical ? /*#__PURE__*/React__default.createElement(S$f.ItemGroup, {
relaxed: true,
divided: true
}, React__default.Children.map(children, function (blurb) {
return withNewProps(blurb, {
color: color || undefined,
vertical: vertical || undefined
});
})) : /*#__PURE__*/React__default.createElement(S$f.Grid, {
columns: Math.min(React__default.Children.count(children), MAX_COLUMNS),
relaxed: true,
doubling: true,
stackable: true,
divided: React__default.Children.count(children) <= MAX_COLUMNS || undefined,
$fullWidth: fullWidth
}, React__default.Children.map(children, function (blurb) {
return /*#__PURE__*/React__default.createElement(S$f.GridCol, {
$fullWidth: fullWidth
}, withNewProps(blurb, {
color: color || undefined,
vertical: vertical || undefined
}));
})));
};
Blurbs.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* center title and justify body content
*/
centered: propTypes.oneOf(["center", "end", "initial", "justify", "split", "start"]),
/**
* primary content of Blurbs.Item
*/
children: propTypes.node,
/**
* apply css supported color string to all children, overrides theme / default
*/
color: propTypes.string,
/**
* body content proceeding blurbs
*/
content: propTypes.node,
/**
* do not restrict width of blurbs container
*/
fullWidth: propTypes.oneOfType([propTypes.oneOf(["gutter"]), propTypes.bool]),
/**
* if/where spacing around element exists
*/
padded: propTypes.oneOfType([propTypes.oneOf(["both", "bottom", "top"]), propTypes.bool]),
/**
* control amount of spacing around element
*/
padding: propTypes.oneOf(["base", "compact", "loose", "relaxed", "tight"]),
/**
* format to appear less prominent (grey background)
*/
secondary: propTypes.bool,
/**
* header
*/
title: propTypes.node,
/**
* useful for rendering multiple blurbs in a column
*/
vertical: propTypes.bool
};
Blurbs.Item = withTag("SSUI", Blurb);function _templateObject2$d() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n /* use \"!important\" to override Transition */\n display: flex !important;\n}\n"]);
_templateObject2$d = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$e() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n}\n"]);
_templateObject$e = function _templateObject() {
return data;
};
return data;
}
var S$e = {}; // styled-components namespace
S$e.Form = styled(Form$1)(_templateObject$e(), function (_ref) {
var $padded = _ref.$padded;
return $padded === "top" && padding("top") || $padded === "bottom" && padding("bottom") || $padded && padding("vertical");
});
S$e.Message = styled(Message)(_templateObject2$d());
/**
* Complex form component that can just handle fields and 1 textarea.
* Can be most effectively used as a contact form. Also provides feedback
* for successful and failed submissions.
*/
var ContactForm = function ContactForm(_ref2) {
var _ref2$name = _ref2.name,
name = _ref2$name === void 0 ? "" : _ref2$name,
_ref2$fields = _ref2.fields,
fields = _ref2$fields === void 0 ? [] : _ref2$fields,
_ref2$textArea = _ref2.textArea,
textArea = _ref2$textArea === void 0 ? true : _ref2$textArea,
_ref2$button = _ref2.button,
button = _ref2$button === void 0 ? "Submit" : _ref2$button,
_ref2$padded = _ref2.padded,
padded = _ref2$padded === void 0 ? false : _ref2$padded,
_ref2$padding = _ref2.padding,
padding = _ref2$padding === void 0 ? "base" : _ref2$padding,
_ref2$onSubmit = _ref2.onSubmit,
onSubmit = _ref2$onSubmit === void 0 ? function () {} : _ref2$onSubmit,
children = _ref2.children,
rest = _objectWithoutPropertiesLoose$2(_ref2, ["name", "fields", "textArea", "button", "padded", "padding", "onSubmit", "children"]);
var _useState = useState(false),
success = _useState[0],
setSuccess = _useState[1];
var _useState2 = useState(false),
error = _useState2[0],
setError = _useState2[1];
/** @type {Record<string, string>} process and push raw fields into state */
var fieldsInit = {};
fields.forEach(function (field) {
if (!field.includes(";")) {
fieldsInit[process(field)] = "";
} else {
fieldsInit[process(field.slice(0, field.indexOf("(")))] = "";
}
});
var _useState3 = useState(fieldsInit),
fieldsObj = _useState3[0],
setFieldsObj = _useState3[1];
var _useState4 = useState(""),
textAreaVal = _useState4[0],
setTextArea = _useState4[1];
var removeSuccessMessage = function removeSuccessMessage(ms) {
if (ms === void 0) {
ms = 6000;
}
setTimeout(function () {
setSuccess(false);
}, ms);
};
var handleSubmit = function handleSubmit(evt) {
if (Object.values(fieldsObj).some(function (val) {
return val === "";
})) {
setSuccess(false);
setError(true);
} else {
fetch("/", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: encode(_extends$7({
"form-name": "contact",
"text-area": textAreaVal
}, fieldsObj))
}).catch(function (error_) {
return console.error(error_);
}); // reset state of fields
var newFieldsObj = Object.fromEntries(Object.keys(fieldsObj).map(function (key) {
return [key, ""];
}));
setSuccess(true);
setError(false);
setFieldsObj(newFieldsObj); // call user's submit function
onSubmit();
removeSuccessMessage();
}
evt.preventDefault();
};
var handleChange = function handleChange(_, _ref3) {
var _extends2;
var id = _ref3.id,
value = _ref3.value;
setFieldsObj(_extends$7({}, fieldsObj, (_extends2 = {}, _extends2[id] = value, _extends2)));
};
var handleChangeArea = function handleChangeArea(_, _ref4) {
var value = _ref4.value;
setTextArea(value);
};
return /*#__PURE__*/React__default.createElement(S$e.Form, Object.assign({
name: name,
onSubmit: handleSubmit,
"data-netlify": "true",
"data-netlify-honeypot": "bot-field",
success: success,
error: error,
$padded: padded,
$padding: padding
}, rest), /*#__PURE__*/React__default.createElement("input", {
type: "hidden",
name: "bot-field"
}), /*#__PURE__*/React__default.createElement("input", {
type: "hidden",
name: "form-name",
value: name
}), fields.map(function (_, i) {
return i % 2 === 0 && fields.slice(i, i + 2);
}) // group fields by twos
.filter(Boolean) // remove falsy (null) entries
.map(function (fieldGroup) {
return /*#__PURE__*/React__default.createElement(Form$1.Group, {
key: "group-" + process(fieldGroup.toString()),
widths: "equal"
}, fieldGroup.map(function (field) {
if (field.includes(";")) {
// custom syntax due to Contentful limitations
var title = field.slice(0, field.indexOf("("));
var options = field.slice(field.indexOf("(") + 1, field.indexOf(")")); // remove title
options = options.split("; ");
options = options.map(function (op) {
return {
text: op,
value: op
};
});
var processedTitle = process(title);
return /*#__PURE__*/React__default.createElement(Form$1.Select, {
error: error && fieldsObj[processedTitle] === "",
id: processedTitle,
key: processedTitle,
fluid: true,
placeholder: title,
label: title,
onChange: handleChange,
value: fieldsObj[processedTitle],
options: options
});
}
var processedField = process(field);
return /*#__PURE__*/React__default.createElement(Form$1.Input, {
name: processedField,
error: error && fieldsObj[processedField] === "",
id: processedField,
key: processedField,
fluid: true,
placeholder: field,
label: field,
onChange: handleChange,
value: fieldsObj[processedField]
});
}));
}), textArea && /*#__PURE__*/React__default.createElement(Form$1.TextArea, {
name: "text-area",
id: "text-area",
error: error && textAreaVal === "",
placeholder: "Message",
label: textArea === true ? "Enter message below:" : textArea,
style: {
minHeight: 125
},
onChange: handleChangeArea,
value: textAreaVal
}), children, /*#__PURE__*/React__default.createElement(Transition.Group, {
animation: "fade down",
duration: 500
}, success && /*#__PURE__*/React__default.createElement(S$e.Message, {
icon: true,
success: true
}, /*#__PURE__*/React__default.createElement(Icon$1, {
name: "check",
"aria-label": "success"
}), /*#__PURE__*/React__default.createElement(Message.Content, null, /*#__PURE__*/React__default.createElement(Message.Header, null, "Form Submitted"), "You'll hear back from us shortly!")), error && /*#__PURE__*/React__default.createElement(S$e.Message, {
icon: true,
error: true
}, /*#__PURE__*/React__default.createElement(Icon$1, {
name: "exclamation",
"aria-label": "failure"
}), /*#__PURE__*/React__default.createElement(Message.Content, null, /*#__PURE__*/React__default.createElement(Message.Header, null, "Error"), "Please fill out all fields!"))), /*#__PURE__*/React__default.createElement(Form$1.Button, {
type: "submit"
}, button));
};
ContactForm.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* button text content
*/
button: propTypes.string,
/**
* additional form fields
*/
children: propTypes.node,
/**
* labels for fields
*/
fields: propTypes.arrayOf(propTypes.string),
/**
* enhances semantics
*/
name: propTypes.string,
/**
* called when form is successfully submitted
*/
onSubmit: propTypes.func,
/**
* if/where spacing around element exists
*/
padded: propTypes.oneOfType([propTypes.oneOf(["both", "bottom", "top"]), propTypes.bool]),
/**
* amount of spacing around element
*/
padding: propTypes.oneOf(["base", "compact", "loose", "relaxed", "tight"]),
/**
* label or pass false to disable, defaults to "Enter Message Below:"
*/
textArea: propTypes.oneOfType([propTypes.string, propTypes.bool])
};/**
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/** Used to match leading and trailing whitespace. */
var reTrim = /^\s+|\s+$/g;
/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
/** Used to detect binary string values. */
var reIsBinary = /^0b[01]+$/i;
/** Used to detect octal string values. */
var reIsOctal = /^0o[0-7]+$/i;
/** Built-in method references without a dependency on `root`. */
var freeParseInt = parseInt;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max,
nativeMin = Math.min;
/**
* Gets the timestamp of the number of milliseconds that have elapsed since
* the Unix epoch (1 January 1970 00:00:00 UTC).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Date
* @returns {number} Returns the timestamp.
* @example
*
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation.
*/
var now = function() {
return root.Date.now();
};
/**
* Creates a debounced function that delays invoking `func` until after `wait`
* milliseconds have elapsed since the last time the debounced function was
* invoked. The debounced function comes with a `cancel` method to cancel
* delayed `func` invocations and a `flush` method to immediately invoke them.
* Provide `options` to indicate whether `func` should be invoked on the
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
* with the last arguments provided to the debounced function. Subsequent
* calls to the debounced function return the result of the last `func`
* invocation.
*
* **Note:** If `leading` and `trailing` options are `true`, `func` is
* invoked on the trailing edge of the timeout only if the debounced function
* is invoked more than once during the `wait` timeout.
*
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
*
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.debounce` and `_.throttle`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to debounce.
* @param {number} [wait=0] The number of milliseconds to delay.
* @param {Object} [options={}] The options object.
* @param {boolean} [options.leading=false]
* Specify invoking on the leading edge of the timeout.
* @param {number} [options.maxWait]
* The maximum time `func` is allowed to be delayed before it's invoked.
* @param {boolean} [options.trailing=true]
* Specify invoking on the trailing edge of the timeout.
* @returns {Function} Returns the new debounced function.
* @example
*
* // Avoid costly calculations while the window size is in flux.
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
*
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
* jQuery(element).on('click', _.debounce(sendMail, 300, {
* 'leading': true,
* 'trailing': false
* }));
*
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
* var source = new EventSource('/stream');
* jQuery(source).on('message', debounced);
*
* // Cancel the trailing debounced invocation.
* jQuery(window).on('popstate', debounced.cancel);
*/
function debounce(func, wait, options) {
var lastArgs,
lastThis,
maxWait,
result,
timerId,
lastCallTime,
lastInvokeTime = 0,
leading = false,
maxing = false,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
wait = toNumber(wait) || 0;
if (isObject(options)) {
leading = !!options.leading;
maxing = 'maxWait' in options;
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
function invokeFunc(time) {
var args = lastArgs,
thisArg = lastThis;
lastArgs = lastThis = undefined;
lastInvokeTime = time;
result = func.apply(thisArg, args);
return result;
}
function leadingEdge(time) {
// Reset any `maxWait` timer.
lastInvokeTime = time;
// Start the timer for the trailing edge.
timerId = setTimeout(timerExpired, wait);
// Invoke the leading edge.
return leading ? invokeFunc(time) : result;
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime,
result = wait - timeSinceLastCall;
return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime;
// Either this is the first call, activity has stopped and we're at the
// trailing edge, the system time has gone backwards and we're treating
// it as the trailing edge, or we've hit the `maxWait` limit.
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
}
function timerExpired() {
var time = now();
if (shouldInvoke(time)) {
return trailingEdge(time);
}
// Restart the timer.
timerId = setTimeout(timerExpired, remainingWait(time));
}
function trailingEdge(time) {
timerId = undefined;
// Only invoke if we have `lastArgs` which means `func` has been
// debounced at least once.
if (trailing && lastArgs) {
return invokeFunc(time);
}
lastArgs = lastThis = undefined;
return result;
}
function cancel() {
if (timerId !== undefined) {
clearTimeout(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = undefined;
}
function flush() {
return timerId === undefined ? result : trailingEdge(now());
}
function debounced() {
var time = now(),
isInvoking = shouldInvoke(time);
lastArgs = arguments;
lastThis = this;
lastCallTime = time;
if (isInvoking) {
if (timerId === undefined) {
return leadingEdge(lastCallTime);
}
if (maxing) {
// Handle invocations in a tight loop.
timerId = setTimeout(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === undefined) {
timerId = setTimeout(timerExpired, wait);
}
return result;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
}
/**
* Creates a throttled function that only invokes `func` at most once per
* every `wait` milliseconds. The throttled function comes with a `cancel`
* method to cancel delayed `func` invocations and a `flush` method to
* immediately invoke them. Provide `options` to indicate whether `func`
* should be invoked on the leading and/or trailing edge of the `wait`
* timeout. The `func` is invoked with the last arguments provided to the
* throttled function. Subsequent calls to the throttled function return the
* result of the last `func` invocation.
*
* **Note:** If `leading` and `trailing` options are `true`, `func` is
* invoked on the trailing edge of the timeout only if the throttled function
* is invoked more than once during the `wait` timeout.
*
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
*
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.throttle` and `_.debounce`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to throttle.
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
* @param {Object} [options={}] The options object.
* @param {boolean} [options.leading=true]
* Specify invoking on the leading edge of the timeout.
* @param {boolean} [options.trailing=true]
* Specify invoking on the trailing edge of the timeout.
* @returns {Function} Returns the new throttled function.
* @example
*
* // Avoid excessively updating the position while scrolling.
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
*
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
* jQuery(element).on('click', throttled);
*
* // Cancel the trailing throttled invocation.
* jQuery(window).on('popstate', throttled.cancel);
*/
function throttle(func, wait, options) {
var leading = true,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (isObject(options)) {
leading = 'leading' in options ? !!options.leading : leading;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
return debounce(func, wait, {
'leading': leading,
'maxWait': wait,
'trailing': trailing
});
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
}
/**
* Converts `value` to a number.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {number} Returns the number.
* @example
*
* _.toNumber(3.2);
* // => 3.2
*
* _.toNumber(Number.MIN_VALUE);
* // => 5e-324
*
* _.toNumber(Infinity);
* // => Infinity
*
* _.toNumber('3.2');
* // => 3.2
*/
function toNumber(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject(value)) {
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
value = isObject(other) ? (other + '') : other;
}
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
value = value.replace(reTrim, '');
var isBinary = reIsBinary.test(value);
return (isBinary || reIsOctal.test(value))
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
: (reIsBadHex.test(value) ? NAN : +value);
}
var lodash_throttle = throttle;var passiveEventListeners = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
/*
* Tell the browser that the event listener won't prevent a scroll.
* Allowing the browser to continue scrolling without having to
* to wait for the listener to return.
*/
exports.addPassiveEventListener = function addPassiveEventListener(target, eventName, listener) {
var supportsPassiveOption = function () {
var supportsPassiveOption = false;
try {
var opts = Object.defineProperty({}, 'passive', {
get: function get() {
supportsPassiveOption = true;
}
});
window.addEventListener('test', null, opts);
} catch (e) {}
return supportsPassiveOption;
}();
target.addEventListener(eventName, listener, supportsPassiveOption ? { passive: true } : false);
};
exports.removePassiveEventListener = function removePassiveEventListener(target, eventName, listener) {
target.removeEventListener(eventName, listener);
};
});var _lodash2 = _interopRequireDefault$8(lodash_throttle);
function _interopRequireDefault$8(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// The eventHandler will execute at a rate of 15fps
var eventThrottler = function eventThrottler(eventHandler) {
return (0, _lodash2.default)(eventHandler, 66);
};
var scrollSpy = {
spyCallbacks: [],
spySetState: [],
scrollSpyContainers: [],
mount: function mount(scrollSpyContainer) {
if (scrollSpyContainer) {
var eventHandler = eventThrottler(function (event) {
scrollSpy.scrollHandler(scrollSpyContainer);
});
scrollSpy.scrollSpyContainers.push(scrollSpyContainer);
(0, passiveEventListeners.addPassiveEventListener)(scrollSpyContainer, 'scroll', eventHandler);
}
},
isMounted: function isMounted(scrollSpyContainer) {
return scrollSpy.scrollSpyContainers.indexOf(scrollSpyContainer) !== -1;
},
currentPositionX: function currentPositionX(scrollSpyContainer) {
if (scrollSpyContainer === document) {
var supportPageOffset = window.pageYOffset !== undefined;
var isCSS1Compat = (document.compatMode || "") === "CSS1Compat";
return supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
} else {
return scrollSpyContainer.scrollLeft;
}
},
currentPositionY: function currentPositionY(scrollSpyContainer) {
if (scrollSpyContainer === document) {
var supportPageOffset = window.pageXOffset !== undefined;
var isCSS1Compat = (document.compatMode || "") === "CSS1Compat";
return supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
} else {
return scrollSpyContainer.scrollTop;
}
},
scrollHandler: function scrollHandler(scrollSpyContainer) {
var callbacks = scrollSpy.scrollSpyContainers[scrollSpy.scrollSpyContainers.indexOf(scrollSpyContainer)].spyCallbacks || [];
callbacks.forEach(function (c) {
return c(scrollSpy.currentPositionX(scrollSpyContainer), scrollSpy.currentPositionY(scrollSpyContainer));
});
},
addStateHandler: function addStateHandler(handler) {
scrollSpy.spySetState.push(handler);
},
addSpyHandler: function addSpyHandler(handler, scrollSpyContainer) {
var container = scrollSpy.scrollSpyContainers[scrollSpy.scrollSpyContainers.indexOf(scrollSpyContainer)];
if (!container.spyCallbacks) {
container.spyCallbacks = [];
}
container.spyCallbacks.push(handler);
handler(scrollSpy.currentPositionX(scrollSpyContainer), scrollSpy.currentPositionY(scrollSpyContainer));
},
updateStates: function updateStates() {
scrollSpy.spySetState.forEach(function (s) {
return s();
});
},
unmount: function unmount(stateHandler, spyHandler) {
scrollSpy.scrollSpyContainers.forEach(function (c) {
return c.spyCallbacks && c.spyCallbacks.length && c.spyCallbacks.splice(c.spyCallbacks.indexOf(spyHandler), 1);
});
if (scrollSpy.spySetState && scrollSpy.spySetState.length) {
scrollSpy.spySetState.splice(scrollSpy.spySetState.indexOf(stateHandler), 1);
}
document.removeEventListener('scroll', scrollSpy.scrollHandler);
},
update: function update() {
return scrollSpy.scrollSpyContainers.forEach(function (c) {
return scrollSpy.scrollHandler(c);
});
}
};
var _default$c = scrollSpy;
var scrollSpy_1 = /*#__PURE__*/Object.defineProperty({
default: _default$c
}, '__esModule', {value: true});var updateHash = function updateHash(hash, historyUpdate) {
var hashVal = hash.indexOf("#") === 0 ? hash.substring(1) : hash;
var hashToUpdate = hashVal ? "#" + hashVal : "";
var curLoc = window && window.location;
var urlToPush = hashToUpdate ? curLoc.pathname + curLoc.search + hashToUpdate : curLoc.pathname + curLoc.search;
historyUpdate ? history.pushState(null, "", urlToPush) : history.replaceState(null, "", urlToPush);
};
var getHash = function getHash() {
return window.location.hash.replace(/^#/, "");
};
var filterElementInContainer = function filterElementInContainer(container) {
return function (element) {
return container.contains ? container != element && container.contains(element) : !!(container.compareDocumentPosition(element) & 16);
};
};
var scrollOffset = function scrollOffset(c, t, horizontal) {
if (horizontal) {
return c === document ? t.getBoundingClientRect().left + (window.scrollX || window.pageXOffset) : getComputedStyle(c).position !== "static" ? t.offsetLeft : t.offsetLeft - c.offsetLeft;
} else {
return c === document ? t.getBoundingClientRect().top + (window.scrollY || window.pageYOffset) : getComputedStyle(c).position !== "static" ? t.offsetTop : t.offsetTop - c.offsetTop;
}
};
var _default$b = {
updateHash: updateHash,
getHash: getHash,
filterElementInContainer: filterElementInContainer,
scrollOffset: scrollOffset
};
var utils = /*#__PURE__*/Object.defineProperty({
default: _default$b
}, '__esModule', {value: true});var _default$a = {
/*
* https://github.com/oblador/angular-scroll (duScrollDefaultEasing)
*/
defaultEasing: function defaultEasing(x) {
if (x < 0.5) {
return Math.pow(x * 2, 2) / 2;
}
return 1 - Math.pow((1 - x) * 2, 2) / 2;
},
/*
* https://gist.github.com/gre/1650294
*/
// no easing, no acceleration
linear: function linear(x) {
return x;
},
// accelerating from zero velocity
easeInQuad: function easeInQuad(x) {
return x * x;
},
// decelerating to zero velocity
easeOutQuad: function easeOutQuad(x) {
return x * (2 - x);
},
// acceleration until halfway, then deceleration
easeInOutQuad: function easeInOutQuad(x) {
return x < .5 ? 2 * x * x : -1 + (4 - 2 * x) * x;
},
// accelerating from zero velocity
easeInCubic: function easeInCubic(x) {
return x * x * x;
},
// decelerating to zero velocity π
easeOutCubic: function easeOutCubic(x) {
return --x * x * x + 1;
},
// acceleration until halfway, then deceleration
easeInOutCubic: function easeInOutCubic(x) {
return x < .5 ? 4 * x * x * x : (x - 1) * (2 * x - 2) * (2 * x - 2) + 1;
},
// accelerating from zero velocity
easeInQuart: function easeInQuart(x) {
return x * x * x * x;
},
// decelerating to zero velocity
easeOutQuart: function easeOutQuart(x) {
return 1 - --x * x * x * x;
},
// acceleration until halfway, then deceleration
easeInOutQuart: function easeInOutQuart(x) {
return x < .5 ? 8 * x * x * x * x : 1 - 8 * --x * x * x * x;
},
// accelerating from zero velocity
easeInQuint: function easeInQuint(x) {
return x * x * x * x * x;
},
// decelerating to zero velocity
easeOutQuint: function easeOutQuint(x) {
return 1 + --x * x * x * x * x;
},
// acceleration until halfway, then deceleration
easeInOutQuint: function easeInOutQuint(x) {
return x < .5 ? 16 * x * x * x * x * x : 1 + 16 * --x * x * x * x * x;
}
};
var smooth = /*#__PURE__*/Object.defineProperty({
default: _default$a
}, '__esModule', {value: true});var events = ['mousedown', 'mousewheel', 'touchmove', 'keydown'];
var _default$9 = {
subscribe: function subscribe(cancelEvent) {
return typeof document !== 'undefined' && events.forEach(function (event) {
return (0, passiveEventListeners.addPassiveEventListener)(document, event, cancelEvent);
});
}
};
var cancelEvents = /*#__PURE__*/Object.defineProperty({
default: _default$9
}, '__esModule', {value: true});var Events = {
registered: {},
scrollEvent: {
register: function register(evtName, callback) {
Events.registered[evtName] = callback;
},
remove: function remove(evtName) {
Events.registered[evtName] = null;
}
}
};
var _default$8 = Events;
var scrollEvents = /*#__PURE__*/Object.defineProperty({
default: _default$8
}, '__esModule', {value: true});var _extends$5 = 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; };
_interopRequireDefault$7(utils);
var _smooth2 = _interopRequireDefault$7(smooth);
var _cancelEvents2 = _interopRequireDefault$7(cancelEvents);
var _scrollEvents2$1 = _interopRequireDefault$7(scrollEvents);
function _interopRequireDefault$7(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*
* Gets the easing type from the smooth prop within options.
*/
var getAnimationType = function getAnimationType(options) {
return _smooth2.default[options.smooth] || _smooth2.default.defaultEasing;
};
/*
* Function helper
*/
var functionWrapper = function functionWrapper(value) {
return typeof value === 'function' ? value : function () {
return value;
};
};
/*
* Wraps window properties to allow server side rendering
*/
var currentWindowProperties = function currentWindowProperties() {
if (typeof window !== 'undefined') {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame;
}
};
/*
* Helper function to never extend 60fps on the webpage.
*/
var requestAnimationFrameHelper = function () {
return currentWindowProperties() || function (callback, element, delay) {
window.setTimeout(callback, delay || 1000 / 60, new Date().getTime());
};
}();
var makeData = function makeData() {
return {
currentPosition: 0,
startPosition: 0,
targetPosition: 0,
progress: 0,
duration: 0,
cancel: false,
target: null,
containerElement: null,
to: null,
start: null,
delta: null,
percent: null,
delayTimeout: null
};
};
var currentPositionX = function currentPositionX(options) {
var containerElement = options.data.containerElement;
if (containerElement && containerElement !== document && containerElement !== document.body) {
return containerElement.scrollLeft;
} else {
var supportPageOffset = window.pageXOffset !== undefined;
var isCSS1Compat = (document.compatMode || "") === "CSS1Compat";
return supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
}
};
var currentPositionY = function currentPositionY(options) {
var containerElement = options.data.containerElement;
if (containerElement && containerElement !== document && containerElement !== document.body) {
return containerElement.scrollTop;
} else {
var supportPageOffset = window.pageXOffset !== undefined;
var isCSS1Compat = (document.compatMode || "") === "CSS1Compat";
return supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
}
};
var scrollContainerWidth = function scrollContainerWidth(options) {
var containerElement = options.data.containerElement;
if (containerElement && containerElement !== document && containerElement !== document.body) {
return containerElement.scrollWidth - containerElement.offsetWidth;
} else {
var body = document.body;
var html = document.documentElement;
return Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
}
};
var scrollContainerHeight = function scrollContainerHeight(options) {
var containerElement = options.data.containerElement;
if (containerElement && containerElement !== document && containerElement !== document.body) {
return containerElement.scrollHeight - containerElement.offsetHeight;
} else {
var body = document.body;
var html = document.documentElement;
return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
}
};
var animateScroll = function animateScroll(easing, options, timestamp) {
var data = options.data;
// Cancel on specific events
if (!options.ignoreCancelEvents && data.cancel) {
if (_scrollEvents2$1.default.registered['end']) {
_scrollEvents2$1.default.registered['end'](data.to, data.target, data.currentPositionY);
}
return;
}
data.delta = Math.round(data.targetPosition - data.startPosition);
if (data.start === null) {
data.start = timestamp;
}
data.progress = timestamp - data.start;
data.percent = data.progress >= data.duration ? 1 : easing(data.progress / data.duration);
data.currentPosition = data.startPosition + Math.ceil(data.delta * data.percent);
if (data.containerElement && data.containerElement !== document && data.containerElement !== document.body) {
if (options.horizontal) {
data.containerElement.scrollLeft = data.currentPosition;
} else {
data.containerElement.scrollTop = data.currentPosition;
}
} else {
if (options.horizontal) {
window.scrollTo(data.currentPosition, 0);
} else {
window.scrollTo(0, data.currentPosition);
}
}
if (data.percent < 1) {
var easedAnimate = animateScroll.bind(null, easing, options);
requestAnimationFrameHelper.call(window, easedAnimate);
return;
}
if (_scrollEvents2$1.default.registered['end']) {
_scrollEvents2$1.default.registered['end'](data.to, data.target, data.currentPosition);
}
};
var setContainer = function setContainer(options) {
options.data.containerElement = !options ? null : options.containerId ? document.getElementById(options.containerId) : options.container && options.container.nodeType ? options.container : document;
};
var animateTopScroll = function animateTopScroll(scrollOffset, options, to, target) {
options.data = options.data || makeData();
window.clearTimeout(options.data.delayTimeout);
_cancelEvents2.default.subscribe(function () {
options.data.cancel = true;
});
setContainer(options);
options.data.start = null;
options.data.cancel = false;
options.data.startPosition = options.horizontal ? currentPositionX(options) : currentPositionY(options);
options.data.targetPosition = options.absolute ? scrollOffset : scrollOffset + options.data.startPosition;
if (options.data.startPosition === options.data.targetPosition) {
if (_scrollEvents2$1.default.registered['end']) {
_scrollEvents2$1.default.registered['end'](options.data.to, options.data.target, options.data.currentPosition);
}
return;
}
options.data.delta = Math.round(options.data.targetPosition - options.data.startPosition);
options.data.duration = functionWrapper(options.duration)(options.data.delta);
options.data.duration = isNaN(parseFloat(options.data.duration)) ? 1000 : parseFloat(options.data.duration);
options.data.to = to;
options.data.target = target;
var easing = getAnimationType(options);
var easedAnimate = animateScroll.bind(null, easing, options);
if (options && options.delay > 0) {
options.data.delayTimeout = window.setTimeout(function () {
if (_scrollEvents2$1.default.registered['begin']) {
_scrollEvents2$1.default.registered['begin'](options.data.to, options.data.target);
}
requestAnimationFrameHelper.call(window, easedAnimate);
}, options.delay);
return;
}
if (_scrollEvents2$1.default.registered['begin']) {
_scrollEvents2$1.default.registered['begin'](options.data.to, options.data.target);
}
requestAnimationFrameHelper.call(window, easedAnimate);
};
var proceedOptions = function proceedOptions(options) {
options = _extends$5({}, options);
options.data = options.data || makeData();
options.absolute = true;
return options;
};
var scrollToTop = function scrollToTop(options) {
animateTopScroll(0, proceedOptions(options));
};
var scrollTo = function scrollTo(toPosition, options) {
animateTopScroll(toPosition, proceedOptions(options));
};
var scrollToBottom = function scrollToBottom(options) {
options = proceedOptions(options);
setContainer(options);
animateTopScroll(options.horizontal ? scrollContainerWidth(options) : scrollContainerHeight(options), options);
};
var scrollMore = function scrollMore(toPosition, options) {
options = proceedOptions(options);
setContainer(options);
var currentPosition = options.horizontal ? currentPositionX(options) : currentPositionY(options);
animateTopScroll(toPosition + currentPosition, options);
};
var _default$7 = {
animateTopScroll: animateTopScroll,
getAnimationType: getAnimationType,
scrollToTop: scrollToTop,
scrollToBottom: scrollToBottom,
scrollTo: scrollTo,
scrollMore: scrollMore
};
var animateScroll_1 = /*#__PURE__*/Object.defineProperty({
default: _default$7
}, '__esModule', {value: true});var _extends$4 = 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; };
var _utils2$1 = _interopRequireDefault$6(utils);
var _animateScroll2 = _interopRequireDefault$6(animateScroll_1);
var _scrollEvents2 = _interopRequireDefault$6(scrollEvents);
function _interopRequireDefault$6(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var __mapped = {};
var __activeLink = void 0;
var _default$6 = {
unmount: function unmount() {
__mapped = {};
},
register: function register(name, element) {
__mapped[name] = element;
},
unregister: function unregister(name) {
delete __mapped[name];
},
get: function get(name) {
return __mapped[name] || document.getElementById(name) || document.getElementsByName(name)[0] || document.getElementsByClassName(name)[0];
},
setActiveLink: function setActiveLink(link) {
return __activeLink = link;
},
getActiveLink: function getActiveLink() {
return __activeLink;
},
scrollTo: function scrollTo(to, props) {
var target = this.get(to);
if (!target) {
console.warn("target Element not found");
return;
}
props = _extends$4({}, props, { absolute: false });
var containerId = props.containerId;
var container = props.container;
var containerElement = void 0;
if (containerId) {
containerElement = document.getElementById(containerId);
} else if (container && container.nodeType) {
containerElement = container;
} else {
containerElement = document;
}
props.absolute = true;
var horizontal = props.horizontal;
var scrollOffset = _utils2$1.default.scrollOffset(containerElement, target, horizontal) + (props.offset || 0);
/*
* if animate is not provided just scroll into the view
*/
if (!props.smooth) {
if (_scrollEvents2.default.registered['begin']) {
_scrollEvents2.default.registered['begin'](to, target);
}
if (containerElement === document) {
if (props.horizontal) {
window.scrollTo(scrollOffset, 0);
} else {
window.scrollTo(0, scrollOffset);
}
} else {
containerElement.scrollTop = scrollOffset;
}
if (_scrollEvents2.default.registered['end']) {
_scrollEvents2.default.registered['end'](to, target);
}
return;
}
/*
* Animate scrolling
*/
_animateScroll2.default.animateTopScroll(scrollOffset, props, to, target);
}
};
var scroller = /*#__PURE__*/Object.defineProperty({
default: _default$6
}, '__esModule', {value: true});var _utils2 = _interopRequireDefault$5(utils);
function _interopRequireDefault$5(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var scrollHash = {
mountFlag: false,
initialized: false,
scroller: null,
containers: {},
mount: function mount(scroller) {
this.scroller = scroller;
this.handleHashChange = this.handleHashChange.bind(this);
window.addEventListener('hashchange', this.handleHashChange);
this.initStateFromHash();
this.mountFlag = true;
},
mapContainer: function mapContainer(to, container) {
this.containers[to] = container;
},
isMounted: function isMounted() {
return this.mountFlag;
},
isInitialized: function isInitialized() {
return this.initialized;
},
initStateFromHash: function initStateFromHash() {
var _this = this;
var hash = this.getHash();
if (hash) {
window.setTimeout(function () {
_this.scrollTo(hash, true);
_this.initialized = true;
}, 10);
} else {
this.initialized = true;
}
},
scrollTo: function scrollTo(to, isInit) {
var scroller = this.scroller;
var element = scroller.get(to);
if (element && (isInit || to !== scroller.getActiveLink())) {
var container = this.containers[to] || document;
scroller.scrollTo(to, { container: container });
}
},
getHash: function getHash() {
return _utils2.default.getHash();
},
changeHash: function changeHash(to, saveHashHistory) {
if (this.isInitialized() && _utils2.default.getHash() !== to) {
_utils2.default.updateHash(to, saveHashHistory);
}
},
handleHashChange: function handleHashChange() {
this.scrollTo(this.getHash());
},
unmount: function unmount() {
this.scroller = null;
this.containers = null;
window.removeEventListener('hashchange', this.handleHashChange);
}
};
var _default$5 = scrollHash;
var scrollHash_1 = /*#__PURE__*/Object.defineProperty({
default: _default$5
}, '__esModule', {value: true});var _extends$3 = 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; };
var _createClass$4 = 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; }; }();
var _react2$4 = _interopRequireDefault$4(React__default);
var _scrollSpy2 = _interopRequireDefault$4(scrollSpy_1);
var _scroller2$1 = _interopRequireDefault$4(scroller);
var _propTypes2$2 = _interopRequireDefault$4(propTypes);
var _scrollHash2 = _interopRequireDefault$4(scrollHash_1);
function _interopRequireDefault$4(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck$5(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn$5(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; }
function _inherits$5(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; }
var protoTypes$1 = {
to: _propTypes2$2.default.string.isRequired,
containerId: _propTypes2$2.default.string,
container: _propTypes2$2.default.object,
activeClass: _propTypes2$2.default.string,
spy: _propTypes2$2.default.bool,
horizontal: _propTypes2$2.default.bool,
smooth: _propTypes2$2.default.oneOfType([_propTypes2$2.default.bool, _propTypes2$2.default.string]),
offset: _propTypes2$2.default.number,
delay: _propTypes2$2.default.number,
isDynamic: _propTypes2$2.default.bool,
onClick: _propTypes2$2.default.func,
duration: _propTypes2$2.default.oneOfType([_propTypes2$2.default.number, _propTypes2$2.default.func]),
absolute: _propTypes2$2.default.bool,
onSetActive: _propTypes2$2.default.func,
onSetInactive: _propTypes2$2.default.func,
ignoreCancelEvents: _propTypes2$2.default.bool,
hashSpy: _propTypes2$2.default.bool,
saveHashHistory: _propTypes2$2.default.bool
};
var _default$4 = function (Component, customScroller) {
var scroller = customScroller || _scroller2$1.default;
var Link = function (_React$PureComponent) {
_inherits$5(Link, _React$PureComponent);
function Link(props) {
_classCallCheck$5(this, Link);
var _this = _possibleConstructorReturn$5(this, (Link.__proto__ || Object.getPrototypeOf(Link)).call(this, props));
_initialiseProps.call(_this);
_this.state = {
active: false
};
return _this;
}
_createClass$4(Link, [{
key: 'getScrollSpyContainer',
value: function getScrollSpyContainer() {
var containerId = this.props.containerId;
var container = this.props.container;
if (containerId && !container) {
return document.getElementById(containerId);
}
if (container && container.nodeType) {
return container;
}
return document;
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
if (this.props.spy || this.props.hashSpy) {
var scrollSpyContainer = this.getScrollSpyContainer();
if (!_scrollSpy2.default.isMounted(scrollSpyContainer)) {
_scrollSpy2.default.mount(scrollSpyContainer);
}
if (this.props.hashSpy) {
if (!_scrollHash2.default.isMounted()) {
_scrollHash2.default.mount(scroller);
}
_scrollHash2.default.mapContainer(this.props.to, scrollSpyContainer);
}
_scrollSpy2.default.addSpyHandler(this.spyHandler, scrollSpyContainer);
this.setState({
container: scrollSpyContainer
});
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
_scrollSpy2.default.unmount(this.stateHandler, this.spyHandler);
}
}, {
key: 'render',
value: function render() {
var className = "";
if (this.state && this.state.active) {
className = ((this.props.className || "") + " " + (this.props.activeClass || "active")).trim();
} else {
className = this.props.className;
}
var props = _extends$3({}, this.props);
for (var prop in protoTypes$1) {
if (props.hasOwnProperty(prop)) {
delete props[prop];
}
}
props.className = className;
props.onClick = this.handleClick;
return _react2$4.default.createElement(Component, props);
}
}]);
return Link;
}(_react2$4.default.PureComponent);
var _initialiseProps = function _initialiseProps() {
var _this2 = this;
this.scrollTo = function (to, props) {
scroller.scrollTo(to, _extends$3({}, _this2.state, props));
};
this.handleClick = function (event) {
/*
* give the posibility to override onClick
*/
if (_this2.props.onClick) {
_this2.props.onClick(event);
}
/*
* dont bubble the navigation
*/
if (event.stopPropagation) event.stopPropagation();
if (event.preventDefault) event.preventDefault();
/*
* do the magic!
*/
_this2.scrollTo(_this2.props.to, _this2.props);
};
this.spyHandler = function (x, y) {
var scrollSpyContainer = _this2.getScrollSpyContainer();
if (_scrollHash2.default.isMounted() && !_scrollHash2.default.isInitialized()) {
return;
}
var horizontal = _this2.props.horizontal;
var to = _this2.props.to;
var element = null;
var isInside = void 0;
var isOutside = void 0;
if (horizontal) {
var elemLeftBound = 0;
var elemRightBound = 0;
var containerLeft = 0;
if (scrollSpyContainer.getBoundingClientRect) {
var containerCords = scrollSpyContainer.getBoundingClientRect();
containerLeft = containerCords.left;
}
if (!element || _this2.props.isDynamic) {
element = scroller.get(to);
if (!element) {
return;
}
var cords = element.getBoundingClientRect();
elemLeftBound = cords.left - containerLeft + x;
elemRightBound = elemLeftBound + cords.width;
}
var offsetX = x - _this2.props.offset;
isInside = offsetX >= Math.floor(elemLeftBound) && offsetX < Math.floor(elemRightBound);
isOutside = offsetX < Math.floor(elemLeftBound) || offsetX >= Math.floor(elemRightBound);
} else {
var elemTopBound = 0;
var elemBottomBound = 0;
var containerTop = 0;
if (scrollSpyContainer.getBoundingClientRect) {
var _containerCords = scrollSpyContainer.getBoundingClientRect();
containerTop = _containerCords.top;
}
if (!element || _this2.props.isDynamic) {
element = scroller.get(to);
if (!element) {
return;
}
var _cords = element.getBoundingClientRect();
elemTopBound = _cords.top - containerTop + y;
elemBottomBound = elemTopBound + _cords.height;
}
var offsetY = y - _this2.props.offset;
isInside = offsetY >= Math.floor(elemTopBound) && offsetY < Math.floor(elemBottomBound);
isOutside = offsetY < Math.floor(elemTopBound) || offsetY >= Math.floor(elemBottomBound);
}
var activeLink = scroller.getActiveLink();
if (isOutside) {
if (to === activeLink) {
scroller.setActiveLink(void 0);
}
if (_this2.props.hashSpy && _scrollHash2.default.getHash() === to) {
var _props$saveHashHistor = _this2.props.saveHashHistory,
saveHashHistory = _props$saveHashHistor === undefined ? false : _props$saveHashHistor;
_scrollHash2.default.changeHash("", saveHashHistory);
}
if (_this2.props.spy && _this2.state.active) {
_this2.setState({ active: false });
_this2.props.onSetInactive && _this2.props.onSetInactive(to, element);
}
}
if (isInside && (activeLink !== to || _this2.state.active === false)) {
scroller.setActiveLink(to);
var _props$saveHashHistor2 = _this2.props.saveHashHistory,
_saveHashHistory = _props$saveHashHistor2 === undefined ? false : _props$saveHashHistor2;
_this2.props.hashSpy && _scrollHash2.default.changeHash(to, _saveHashHistory);
if (_this2.props.spy) {
_this2.setState({ active: true });
_this2.props.onSetActive && _this2.props.onSetActive(to, element);
}
}
};
};
Link.propTypes = protoTypes$1;
Link.defaultProps = { offset: 0 };
return Link;
};
var scrollLink = /*#__PURE__*/Object.defineProperty({
default: _default$4
}, '__esModule', {value: true});var _react2$3 = _interopRequireDefault$3(React__default);
var _scrollLink2$1 = _interopRequireDefault$3(scrollLink);
function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck$4(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn$4(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; }
function _inherits$4(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; }
var LinkElement = function (_React$Component) {
_inherits$4(LinkElement, _React$Component);
function LinkElement() {
var _ref;
var _temp, _this, _ret;
_classCallCheck$4(this, LinkElement);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn$4(this, (_ref = LinkElement.__proto__ || Object.getPrototypeOf(LinkElement)).call.apply(_ref, [this].concat(args))), _this), _this.render = function () {
return _react2$3.default.createElement(
'a',
_this.props,
_this.props.children
);
}, _temp), _possibleConstructorReturn$4(_this, _ret);
}
return LinkElement;
}(_react2$3.default.Component);
var _default$3 = (0, _scrollLink2$1.default)(LinkElement);
var Link$1 = /*#__PURE__*/Object.defineProperty({
default: _default$3
}, '__esModule', {value: true});var _createClass$3 = 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; }; }();
var _react2$2 = _interopRequireDefault$2(React__default);
var _scrollLink2 = _interopRequireDefault$2(scrollLink);
function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn$3(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; }
function _inherits$3(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; }
var ButtonElement = function (_React$Component) {
_inherits$3(ButtonElement, _React$Component);
function ButtonElement() {
_classCallCheck$3(this, ButtonElement);
return _possibleConstructorReturn$3(this, (ButtonElement.__proto__ || Object.getPrototypeOf(ButtonElement)).apply(this, arguments));
}
_createClass$3(ButtonElement, [{
key: 'render',
value: function render() {
return _react2$2.default.createElement(
'input',
this.props,
this.props.children
);
}
}]);
return ButtonElement;
}(_react2$2.default.Component);
var _default$2 = (0, _scrollLink2.default)(ButtonElement);
var Button = /*#__PURE__*/Object.defineProperty({
default: _default$2
}, '__esModule', {value: true});var _extends$2 = 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; };
var _createClass$2 = 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; }; }();
var _react2$1 = _interopRequireDefault$1(React__default);
_interopRequireDefault$1(ReactDOM__default);
var _scroller2 = _interopRequireDefault$1(scroller);
var _propTypes2$1 = _interopRequireDefault$1(propTypes);
function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn$2(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; }
function _inherits$2(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; }
var _default$1 = function (Component) {
var Element = function (_React$Component) {
_inherits$2(Element, _React$Component);
function Element(props) {
_classCallCheck$2(this, Element);
var _this = _possibleConstructorReturn$2(this, (Element.__proto__ || Object.getPrototypeOf(Element)).call(this, props));
_this.childBindings = {
domNode: null
};
return _this;
}
_createClass$2(Element, [{
key: 'componentDidMount',
value: function componentDidMount() {
if (typeof window === 'undefined') {
return false;
}
this.registerElems(this.props.name);
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate(prevProps) {
if (this.props.name !== prevProps.name) {
this.registerElems(this.props.name);
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
if (typeof window === 'undefined') {
return false;
}
_scroller2.default.unregister(this.props.name);
}
}, {
key: 'registerElems',
value: function registerElems(name) {
_scroller2.default.register(name, this.childBindings.domNode);
}
}, {
key: 'render',
value: function render() {
return _react2$1.default.createElement(Component, _extends$2({}, this.props, { parentBindings: this.childBindings }));
}
}]);
return Element;
}(_react2$1.default.Component);
Element.propTypes = {
name: _propTypes2$1.default.string,
id: _propTypes2$1.default.string
};
return Element;
};
var scrollElement = /*#__PURE__*/Object.defineProperty({
default: _default$1
}, '__esModule', {value: true});var _extends$1 = 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; };
var _createClass$1 = 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; }; }();
var _react2 = _interopRequireDefault(React__default);
var _scrollElement2 = _interopRequireDefault(scrollElement);
var _propTypes2 = _interopRequireDefault(propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn$1(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; }
function _inherits$1(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; }
var ElementWrapper = function (_React$Component) {
_inherits$1(ElementWrapper, _React$Component);
function ElementWrapper() {
_classCallCheck$1(this, ElementWrapper);
return _possibleConstructorReturn$1(this, (ElementWrapper.__proto__ || Object.getPrototypeOf(ElementWrapper)).apply(this, arguments));
}
_createClass$1(ElementWrapper, [{
key: 'render',
value: function render() {
var _this2 = this;
// Remove `parentBindings` from props
var newProps = _extends$1({}, this.props);
if (newProps.parentBindings) {
delete newProps.parentBindings;
}
return _react2.default.createElement(
'div',
_extends$1({}, newProps, { ref: function ref(el) {
_this2.props.parentBindings.domNode = el;
} }),
this.props.children
);
}
}]);
return ElementWrapper;
}(_react2.default.Component);
ElementWrapper.propTypes = {
name: _propTypes2.default.string,
id: _propTypes2.default.string
};
var _default = (0, _scrollElement2.default)(ElementWrapper);
var Element$1 = /*#__PURE__*/Object.defineProperty({
default: _default
}, '__esModule', {value: true});/* DEPRECATED */
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; };
var _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; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _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; }
function _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; }
var protoTypes = {
to: propTypes.string.isRequired,
containerId: propTypes.string,
container: propTypes.object,
activeClass: propTypes.string,
spy: propTypes.bool,
smooth: propTypes.oneOfType([propTypes.bool, propTypes.string]),
offset: propTypes.number,
delay: propTypes.number,
isDynamic: propTypes.bool,
onClick: propTypes.func,
duration: propTypes.oneOfType([propTypes.number, propTypes.func]),
absolute: propTypes.bool,
onSetActive: propTypes.func,
onSetInactive: propTypes.func,
ignoreCancelEvents: propTypes.bool,
hashSpy: propTypes.bool
};
var Helpers = {
Scroll: function Scroll(Component, customScroller) {
console.warn("Helpers.Scroll is deprecated since v1.7.0");
var scroller$1 = customScroller || scroller;
var Scroll = function (_React$Component) {
_inherits(Scroll, _React$Component);
function Scroll(props) {
_classCallCheck(this, Scroll);
var _this = _possibleConstructorReturn(this, (Scroll.__proto__ || Object.getPrototypeOf(Scroll)).call(this, props));
_initialiseProps.call(_this);
_this.state = {
active: false
};
return _this;
}
_createClass(Scroll, [{
key: 'getScrollSpyContainer',
value: function getScrollSpyContainer() {
var containerId = this.props.containerId;
var container = this.props.container;
if (containerId) {
return document.getElementById(containerId);
}
if (container && container.nodeType) {
return container;
}
return document;
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
if (this.props.spy || this.props.hashSpy) {
var scrollSpyContainer = this.getScrollSpyContainer();
if (!scrollSpy_1.isMounted(scrollSpyContainer)) {
scrollSpy_1.mount(scrollSpyContainer);
}
if (this.props.hashSpy) {
if (!scrollHash_1.isMounted()) {
scrollHash_1.mount(scroller$1);
}
scrollHash_1.mapContainer(this.props.to, scrollSpyContainer);
}
if (this.props.spy) {
scrollSpy_1.addStateHandler(this.stateHandler);
}
scrollSpy_1.addSpyHandler(this.spyHandler, scrollSpyContainer);
this.setState({
container: scrollSpyContainer
});
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
scrollSpy_1.unmount(this.stateHandler, this.spyHandler);
}
}, {
key: 'render',
value: function render() {
var className = "";
if (this.state && this.state.active) {
className = ((this.props.className || "") + " " + (this.props.activeClass || "active")).trim();
} else {
className = this.props.className;
}
var props = _extends({}, this.props);
for (var prop in protoTypes) {
if (props.hasOwnProperty(prop)) {
delete props[prop];
}
}
props.className = className;
props.onClick = this.handleClick;
return React__default.createElement(Component, props);
}
}]);
return Scroll;
}(React__default.Component);
var _initialiseProps = function _initialiseProps() {
var _this2 = this;
this.scrollTo = function (to, props) {
scroller$1.scrollTo(to, _extends({}, _this2.state, props));
};
this.handleClick = function (event) {
/*
* give the posibility to override onClick
*/
if (_this2.props.onClick) {
_this2.props.onClick(event);
}
/*
* dont bubble the navigation
*/
if (event.stopPropagation) event.stopPropagation();
if (event.preventDefault) event.preventDefault();
/*
* do the magic!
*/
_this2.scrollTo(_this2.props.to, _this2.props);
};
this.stateHandler = function () {
if (scroller$1.getActiveLink() !== _this2.props.to) {
if (_this2.state !== null && _this2.state.active && _this2.props.onSetInactive) {
_this2.props.onSetInactive();
}
_this2.setState({ active: false });
}
};
this.spyHandler = function (y) {
var scrollSpyContainer = _this2.getScrollSpyContainer();
if (scrollHash_1.isMounted() && !scrollHash_1.isInitialized()) {
return;
}
var to = _this2.props.to;
var element = null;
var elemTopBound = 0;
var elemBottomBound = 0;
var containerTop = 0;
if (scrollSpyContainer.getBoundingClientRect) {
var containerCords = scrollSpyContainer.getBoundingClientRect();
containerTop = containerCords.top;
}
if (!element || _this2.props.isDynamic) {
element = scroller$1.get(to);
if (!element) {
return;
}
var cords = element.getBoundingClientRect();
elemTopBound = cords.top - containerTop + y;
elemBottomBound = elemTopBound + cords.height;
}
var offsetY = y - _this2.props.offset;
var isInside = offsetY >= Math.floor(elemTopBound) && offsetY < Math.floor(elemBottomBound);
var isOutside = offsetY < Math.floor(elemTopBound) || offsetY >= Math.floor(elemBottomBound);
var activeLink = scroller$1.getActiveLink();
if (isOutside) {
if (to === activeLink) {
scroller$1.setActiveLink(void 0);
}
if (_this2.props.hashSpy && scrollHash_1.getHash() === to) {
scrollHash_1.changeHash();
}
if (_this2.props.spy && _this2.state.active) {
_this2.setState({ active: false });
_this2.props.onSetInactive && _this2.props.onSetInactive();
}
return scrollSpy_1.updateStates();
}
if (isInside && activeLink !== to) {
scroller$1.setActiveLink(to);
_this2.props.hashSpy && scrollHash_1.changeHash(to);
if (_this2.props.spy) {
_this2.setState({ active: true });
_this2.props.onSetActive && _this2.props.onSetActive(to);
}
return scrollSpy_1.updateStates();
}
};
};
Scroll.propTypes = protoTypes;
Scroll.defaultProps = { offset: 0 };
return Scroll;
},
Element: function Element(Component) {
console.warn("Helpers.Element is deprecated since v1.7.0");
var Element = function (_React$Component2) {
_inherits(Element, _React$Component2);
function Element(props) {
_classCallCheck(this, Element);
var _this3 = _possibleConstructorReturn(this, (Element.__proto__ || Object.getPrototypeOf(Element)).call(this, props));
_this3.childBindings = {
domNode: null
};
return _this3;
}
_createClass(Element, [{
key: 'componentDidMount',
value: function componentDidMount() {
if (typeof window === 'undefined') {
return false;
}
this.registerElems(this.props.name);
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate(prevProps) {
if (this.props.name !== prevProps.name) {
this.registerElems(this.props.name);
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
if (typeof window === 'undefined') {
return false;
}
scroller.unregister(this.props.name);
}
}, {
key: 'registerElems',
value: function registerElems(name) {
scroller.register(name, this.childBindings.domNode);
}
}, {
key: 'render',
value: function render() {
return React__default.createElement(Component, _extends({}, this.props, { parentBindings: this.childBindings }));
}
}]);
return Element;
}(React__default.Component);
Element.propTypes = {
name: propTypes.string,
id: propTypes.string
};
return Element;
}
};
var Helpers_1 = Helpers;var modules = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Helpers = exports.ScrollElement = exports.ScrollLink = exports.animateScroll = exports.scrollSpy = exports.Events = exports.scroller = exports.Element = exports.Button = exports.Link = undefined;
var _Link2 = _interopRequireDefault(Link$1);
var _Button2 = _interopRequireDefault(Button);
var _Element2 = _interopRequireDefault(Element$1);
var _scroller2 = _interopRequireDefault(scroller);
var _scrollEvents2 = _interopRequireDefault(scrollEvents);
var _scrollSpy2 = _interopRequireDefault(scrollSpy_1);
var _animateScroll2 = _interopRequireDefault(animateScroll_1);
var _scrollLink2 = _interopRequireDefault(scrollLink);
var _scrollElement2 = _interopRequireDefault(scrollElement);
var _Helpers2 = _interopRequireDefault(Helpers_1);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.Link = _Link2.default;
exports.Button = _Button2.default;
exports.Element = _Element2.default;
exports.scroller = _scroller2.default;
exports.Events = _scrollEvents2.default;
exports.scrollSpy = _scrollSpy2.default;
exports.animateScroll = _animateScroll2.default;
exports.ScrollLink = _scrollLink2.default;
exports.ScrollElement = _scrollElement2.default;
exports.Helpers = _Helpers2.default;
exports.default = { Link: _Link2.default, Button: _Button2.default, Element: _Element2.default, scroller: _scroller2.default, Events: _scrollEvents2.default, scrollSpy: _scrollSpy2.default, animateScroll: _animateScroll2.default, ScrollLink: _scrollLink2.default, ScrollElement: _scrollElement2.default, Helpers: _Helpers2.default };
});var Link = function Link(_ref) {
var _ref$as = _ref.as,
as = _ref$as === void 0 ? "a" : _ref$as,
_ref$link = _ref.link,
link = _ref$link === void 0 ? "" : _ref$link,
_ref$wrap = _ref.wrap,
wrap = _ref$wrap === void 0 ? false : _ref$wrap,
_ref$forwarded = _ref.forwarded,
forwarded = _ref$forwarded === void 0 ? false : _ref$forwarded,
children = _ref.children,
rest = _objectWithoutPropertiesLoose$2(_ref, ["as", "link", "wrap", "forwarded", "children"]);
return React__default.Children.map(children, function (Child) {
var _globalThis$location, _globalThis$location3, _globalThis$location4;
if (!Child) return false; // prevent wrapping empty elements
if (typeof Child !== "object" && !wrap) {
console.warn("SSUI Link component should not be passed primitive type children unless `wrap` is also passed.", "children will be wrapped automatically for now.", "Child content:", Child); // eslint-disable-next-line no-param-reassign
wrap = true;
} // const isExternal =
// window &&
// link.startsWith("http") &&
// new URL(link)?.origin !== window.location.origin
var isExternal = globalThis && link.includes(":") && new URL(link).origin !== (globalThis == null ? void 0 : (_globalThis$location = globalThis.location) == null ? void 0 : _globalThis$location.origin);
var isAnchor = !isExternal && link.includes("#");
var anchorProps = {
spy: true,
smooth: true,
duration: calcDuration,
// reset hash link identifier
onClick: function onClick() {
var _globalThis$history, _globalThis$location2;
globalThis == null ? void 0 : (_globalThis$history = globalThis.history) == null ? void 0 : _globalThis$history.pushState("", document.title, (_globalThis$location2 = globalThis.location) == null ? void 0 : _globalThis$location2.pathname);
}
};
var externalProps = {
rel: "noopener noreferrer",
target: "_blank"
}; // clean url if user accidentally includes hostname
var url = globalThis && link.startsWith("http") && new URL(link).origin === (globalThis == null ? void 0 : (_globalThis$location3 = globalThis.location) == null ? void 0 : _globalThis$location3.origin) ? link.replace(globalThis == null ? void 0 : (_globalThis$location4 = globalThis.location) == null ? void 0 : _globalThis$location4.origin, "") : link;
var props = _extends$7({
href: !isAnchor && url || undefined,
// remove "#" if internal anchor, `to` is included for internal non-anchors urls
// that are not using the default `as="a"`
to: url && !isExternal && (isAnchor ? url.slice(url.indexOf("#") + 1) : as !== "a" && url) || undefined
}, rest, isAnchor && anchorProps, isExternal && externalProps); // use `react-scroll` for smooth scrolling hash/anchor links
var Tag = isAnchor ? modules.Link : as;
if (wrap) return /*#__PURE__*/React__default.createElement(Tag, props, Child);
if (forwarded) return withProps(Child, _extends$7({}, props, {
forwardedAs: Tag
}));
return withProps(Child, _extends$7({}, props, {
as: Tag
}));
});
};
Link.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* element type to render as (string or function) supports HTML tag as a string or
* React component definition
* NOTE: ignored if `link` contains a "#"
*
* @example
* 'div'
* 'section'
* ReactComponent
* Card
*/
as: propTypes.elementType,
/**
* primary content, usually a string, but handles multiple items by linking each of them
*/
children: propTypes.node,
/**
* when not wrapping, will convert `as` tag to `forwardedAs` for passing the prop thru a
* `styled-components`
*/
forwarded: propTypes.bool,
/**
* hash link (prefixed with "#") or internal link applied via a new `to` field or can
* be used as a standard href if a full link is provided
*
* @example
* internal: "/blog/contact"
* anchor: "#contact-section"
* external: "https://example.com"
*/
link: propTypes.string,
/**
* creates a new element of the type of `as` tag and applies props newly created tag
*/
wrap: propTypes.bool
};function _templateObject2$c() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n display: flex;\n ", ";\n ", ";\n}\n\n &&&&&&:first-child {\n ", ";\n }\n\n &&&&&&:last-child {\n ", ";\n }\n"]);
_templateObject2$c = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$d() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n display: flex;\n justify-content: ", ";\n\n ", ";\n\n ", ";\n}\n /* TODO: add option to say (internal) where 1st nd last have no padding/margin */\n &&&&&&:first-child {\n ", ";\n }\n &&&&&&:last-child {\n ", ";\n }\n"]);
_templateObject$d = function _templateObject() {
return data;
};
return data;
}
var S$d = {}; // styled-components namespace
S$d.Group = styled.div(_templateObject$d(), function (_ref) {
var $justify = _ref.$justify;
return flexAlignMap[$justify];
}, margin("horizontal")(spacingMap.tight), function (_ref2) {
var $padded = _ref2.$padded;
_ref2.$padding;
return $padded === "top" && padding("top") || $padded === "bottom" && padding("bottom") || $padded && padding("vertical");
}, margin("left")("0"), margin("right")("0"));
S$d.IconLinkItem = styled.div(_templateObject2$c(), margin("all")("0"), padding("horizontal")(spacingMap.compact), padding("left")("0"), padding("right")("0"));
var IconLinkGroup = function IconLinkGroup(_ref3) {
var _ref3$justify = _ref3.justify,
justify = _ref3$justify === void 0 ? "initial" : _ref3$justify,
_ref3$padded = _ref3.padded,
padded = _ref3$padded === void 0 ? false : _ref3$padded,
_ref3$padding = _ref3.padding,
padding = _ref3$padding === void 0 ? "tight" : _ref3$padding,
_ref3$className = _ref3.className,
className = _ref3$className === void 0 ? "" : _ref3$className,
children = _ref3.children,
rest = _objectWithoutPropertiesLoose$2(_ref3, ["justify", "padded", "padding", "className", "children"]);
return /*#__PURE__*/React__default.createElement(S$d.Group, {
$justify: justify,
$padded: padded,
$padding: padding,
className: className
}, React__default.Children.map(children, function (Child) {
return /*#__PURE__*/React__default.createElement(S$d.IconLinkItem, null, withNewProps(Child, rest));
}));
};
IconLinkGroup.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* primary content of icon(s)
*/
children: propTypes.node,
/**
* additional or pass thru classes for composition
*/
className: propTypes.string,
/**
* flex alignment of icon container
*/
justify: propTypes.oneOf(["center", "end", "initial", "justify", "split", "start"]),
/**
* spacing around element exists
*/
padded: propTypes.oneOfType([propTypes.oneOf(["both", "bottom", "top"]), propTypes.bool]),
/**
* control amount of spacing around element
*/
padding: propTypes.oneOf(["base", "compact", "loose", "relaxed", "tight"])
};function _templateObject5$2() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n display: flex;\n flex-direction: column;\n align-items: ", ";\n justify-content: ", ";\n}\n"]);
_templateObject5$2 = function _templateObject5() {
return data;
};
return data;
}
function _templateObject4$3() {
var data = _taggedTemplateLiteralLoose(["\n ", ":hover & {\n color: ", ";\n }\n "]);
_templateObject4$3 = function _templateObject4() {
return data;
};
return data;
}
function _templateObject3$5() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n color: ", ";\n\n ", ";\n}\n"]);
_templateObject3$5 = function _templateObject3() {
return data;
};
return data;
}
function _templateObject2$b() {
var data = _taggedTemplateLiteralLoose(["\n ", ":hover & {\n /* cursor: pointer; */\n opacity: 1;\n /* if colorHover not provided */\n /* if light, try white theme then default */\n /* if inverted, try secondary theme then default */\n /* else use primary color */\n color: ", ";\n }\n "]);
_templateObject2$b = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$c() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: ", ";\n padding: ", ";\n ", ";\n opacity: 1;\n\n /* if color not provided */\n /* if light, try light theme then default */\n /* if inverted, try secondary theme then default */\n /* else use primary color */\n color: ", ";\n\n ", ";\n}\n"]);
_templateObject$c = function _templateObject() {
return data;
};
return data;
}
var S$c = {}; // styled-components namespace
S$c.Icon = styled(Icon$1)(_templateObject$c(), function (_ref) {
var $size = _ref.$size;
return iconMap[$size];
}, function (_ref2) {
var $group = _ref2.$group;
return $group ? "0 0.5em" : "0";
}, margin("all")("0"), function (_ref3) {
var $color = _ref3.$color,
$light = _ref3.$light,
$inverted = _ref3.$inverted,
theme = _ref3.theme;
return $color || $light && (theme.light || defaultColors.light) || $inverted && (theme.secondary || defaultColors.secondary) || theme.primary || defaultColors.primary;
}, function (_ref4) {
var link = _ref4.link;
return link && css(_templateObject2$b(), S$c.Wrapper, function (_ref5) {
var $colorHover = _ref5.$colorHover,
$light = _ref5.$light,
$inverted = _ref5.$inverted,
theme = _ref5.theme;
return $colorHover || $light && (theme.white || defaultColors.white) || $inverted && (theme.primary || defaultColors.primary) || theme.secondary || defaultColors.secondary;
});
});
S$c.Label = styled.span(_templateObject3$5(), function (_ref6) {
var $color = _ref6.$color,
$light = _ref6.$light,
$inverted = _ref6.$inverted,
theme = _ref6.theme;
return $color || $light && (theme.light || defaultColors.light) || $inverted && (theme.secondary || defaultColors.secondary) || theme.primary || defaultColors.primary;
}, function (_ref7) {
var $link = _ref7.$link;
return $link && css(_templateObject4$3(), S$c.Wrapper, function (_ref8) {
var $colorHover = _ref8.$colorHover,
$light = _ref8.$light,
$inverted = _ref8.$inverted,
theme = _ref8.theme;
return $colorHover || $light && (theme.white || defaultColors.white) || $inverted && (theme.primary || defaultColors.primary) || theme.secondary || defaultColors.secondary;
});
});
/* eslint-enable indent */
S$c.Wrapper = styled.div(_templateObject5$2(), function (_ref9) {
var $align = _ref9.$align;
return $align === "center" ? $align : "flex-" + $align;
}, function (_ref10) {
var $align = _ref10.$align;
return $align === "center" ? $align : "flex-" + $align;
});
var IconLink = function IconLink(_ref11) {
var as = _ref11.as,
_ref11$name = _ref11.name,
name = _ref11$name === void 0 ? "" : _ref11$name,
_ref11$label = _ref11.label,
label = _ref11$label === void 0 ? "" : _ref11$label,
_ref11$link = _ref11.link,
link = _ref11$link === void 0 ? "" : _ref11$link,
_ref11$align = _ref11.align,
align = _ref11$align === void 0 ? "center" : _ref11$align,
_ref11$size = _ref11.size,
size = _ref11$size === void 0 ? "medium" : _ref11$size,
_ref11$light = _ref11.light,
light = _ref11$light === void 0 ? false : _ref11$light,
_ref11$inverted = _ref11.inverted,
inverted = _ref11$inverted === void 0 ? false : _ref11$inverted,
_ref11$fitted = _ref11.fitted,
fitted = _ref11$fitted === void 0 ? false : _ref11$fitted,
_ref11$color = _ref11.color,
color = _ref11$color === void 0 ? "" : _ref11$color,
_ref11$colorHover = _ref11.colorHover,
colorHover = _ref11$colorHover === void 0 ? "" : _ref11$colorHover,
rest = _objectWithoutPropertiesLoose$2(_ref11, ["as", "name", "label", "link", "align", "size", "light", "inverted", "fitted", "color", "colorHover"]);
return /*#__PURE__*/React__default.createElement(S$c.Wrapper, {
$align: align
}, link ? /*#__PURE__*/React__default.createElement(Link, Object.assign({
wrap: true,
"aria-label": !label ? name + " icon link" : undefined,
as: as,
link: typeof link !== "boolean" ? link : undefined
}, rest), /*#__PURE__*/React__default.createElement(S$c.Icon, {
name: name.toLowerCase(),
link: !!link,
fitted: fitted,
$size: size,
$inverted: inverted,
$light: light,
$color: color,
$colorHover: colorHover
}), label && /*#__PURE__*/React__default.createElement(S$c.Label, {
$link: true,
$inverted: inverted,
$light: light,
$color: color,
$colorHover: colorHover
}, label === true ? name : label)) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(S$c.Icon, Object.assign({
// forwardedAs={as}
name: name.toLowerCase(),
fitted: fitted,
$size: size,
$inverted: inverted,
$light: light,
$color: color,
$colorHover: colorHover
}, rest)), label && /*#__PURE__*/React__default.createElement(S$c.Label, {
$inverted: inverted,
$light: light,
$color: color,
$colorHover: colorHover
}, label === true ? name : label)));
};
IconLink.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* position / justification of all content
*/
align: propTypes.oneOf(["center", "end", "initial", "justify", "split", "start"]),
/**
* element type to render as (string or function)
* supports HTML tag as a string or React component definition
*
* @example
* 'div'
* 'section'
* ReactComponent
* Card
*/
as: propTypes.elementType,
children: propTypes.node,
/**
* apply css supported color string to Icon and text, overrides theme / default
*/
color: propTypes.string,
/**
* apply css supported color string to Icon and text on hover, overrides theme / default
*/
colorHover: propTypes.string,
/**
* reduce padding
*/
fitted: propTypes.bool,
/**
* set color to secondary, colorHover to primary
*/
inverted: propTypes.bool,
/**
* display a text string with the icon
*/
label: propTypes.oneOfType([propTypes.string, propTypes.bool]),
/**
* set color to grey, colorHover to white
*/
light: propTypes.bool,
/**
* anchor link (prefixed with "#") or standard href
*/
link: propTypes.oneOfType([propTypes.string, propTypes.bool]),
/**
* icon name as supported by Font Awesome 5.0.8
*
* @see - [Icon Name Reference Sheet](https://react.semantic-ui.com/elements/icon/)
*/
name: propTypes.string.isRequired,
/**
* size based on "em" units
*/
size: propTypes.oneOf(["big", "bigger", "huge", "large", "massive", "medium", "mini", "small", "tiny"])
};
IconLink.Group = withTag("SSUI", IconLinkGroup);function _templateObject5$1() {
var data = _taggedTemplateLiteralLoose(["\n top: 50%;\n transform: translateY(-50%);\n position: relative;\n "]);
_templateObject5$1 = function _templateObject5() {
return data;
};
return data;
}
function _templateObject4$2() {
var data = _taggedTemplateLiteralLoose(["\n height: 100%;\n object-fit: cover;\n "]);
_templateObject4$2 = function _templateObject4() {
return data;
};
return data;
}
function _templateObject3$4() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n}\n"]);
_templateObject3$4 = function _templateObject3() {
return data;
};
return data;
}
function _templateObject2$a() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n display: flex;\n}\n\n &&&&&& .content .header {\n color: rgba(0, 0, 0, 0.87);\n }\n"]);
_templateObject2$a = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$b() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n /* width: fit-content; */\n height: 100%;\n}\n"]);
_templateObject$b = function _templateObject() {
return data;
};
return data;
}
var S$b = {}; // styled-components namespace
// TODO: fix width
S$b.Dimmable = styled(Dimmer.Dimmable)(_templateObject$b());
S$b.Dimmer = styled(Dimmer)(_templateObject2$a(), function (_ref) {
var $dimmed = _ref.$dimmed;
return !$dimmed && "visibility: hidden";
}); // css functions not necessary but add syntax highlighting
S$b.Image = styled.img(_templateObject3$4(), function (_ref2) {
var $fill = _ref2.$fill;
return $fill ? css(_templateObject4$2()) : css(_templateObject5$1());
});
var PortfolioItem = function PortfolioItem(_ref3) {
var _ref3$title = _ref3.title,
title = _ref3$title === void 0 ? "" : _ref3$title,
_ref3$subtitle = _ref3.subtitle,
subtitle = _ref3$subtitle === void 0 ? "" : _ref3$subtitle,
_ref3$fill = _ref3.fill,
fill = _ref3$fill === void 0 ? true : _ref3$fill,
_ref3$children = _ref3.children,
children = _ref3$children === void 0 ? null : _ref3$children,
rest = _objectWithoutPropertiesLoose$2(_ref3, ["title", "subtitle", "fill", "children"]);
var _useState = useState(false),
hovered = _useState[0],
setHovered = _useState[1];
return /*#__PURE__*/React__default.createElement(Grid.Column, rest, children && /*#__PURE__*/React__default.createElement(S$b.Dimmable, {
dimmed: hovered,
onMouseEnter: function onMouseEnter() {
return setHovered(true);
},
onMouseLeave: function onMouseLeave() {
return setHovered(false);
}
}, /*#__PURE__*/React__default.createElement(S$b.Image, Object.assign({
$fill: fill,
centered: true,
as: children.type
}, children.props)), (title || subtitle) && /*#__PURE__*/React__default.createElement(S$b.Dimmer, {
inverted: true,
simple: true,
$dimmed: hovered
}, title && /*#__PURE__*/React__default.createElement(Header, {
as: "h2"
}, title), subtitle && /*#__PURE__*/React__default.createElement(Header, {
as: "h3"
}, subtitle))));
};
PortfolioItem.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* image-based content
*/
children: propTypes.node,
/**
* determine when to cover the entire space with hidden overflow
*/
fill: propTypes.bool,
/**
* secondary content
*/
subtitle: propTypes.node,
/**
* primary content
*/
title: propTypes.node
};function _templateObject3$3() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n text-align: ", ";\n}\n"]);
_templateObject3$3 = function _templateObject3() {
return data;
};
return data;
}
function _templateObject2$9() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n text-align: ", ";\n}\n @media ", " {\n&&&&&& {\n text-align: center\n}\n }\n"]);
_templateObject2$9 = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$a() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n ", ";\n}\n"]);
_templateObject$a = function _templateObject() {
return data;
};
return data;
}
var S$a = {}; // styled-components namespace
S$a.Header = styled(Header)(_templateObject$a(), margin("bottom")("1.25em", ["internal"]), function (_ref) {
var $padded = _ref.$padded;
return $padded === "top" && padding("top")(spacingMap.base) || $padded === "bottom" && padding("bottom")(spacingMap.base) || $padded && padding("vertical")(spacingMap.base);
});
S$a.Title = styled.div(_templateObject2$9(), function (_ref2) {
var $textAlign = _ref2.$textAlign;
return $textAlign;
}, media.mobile);
S$a.Subtitle = styled(Header.Subheader)(_templateObject3$3(), function (_ref3) {
var $textAlign = _ref3.$textAlign;
return $textAlign;
}); // TODO: test mobile, may need `container` on `Grid`
var Title = function Title(_ref4) {
var _ref4$as = _ref4.as,
as = _ref4$as === void 0 ? "h1" : _ref4$as,
_ref4$subtitle = _ref4.subtitle,
subtitle = _ref4$subtitle === void 0 ? null : _ref4$subtitle,
_ref4$textAlign = _ref4.textAlign,
textAlign = _ref4$textAlign === void 0 ? "left" : _ref4$textAlign,
_ref4$textAlignSub = _ref4.textAlignSub,
textAlignSub = _ref4$textAlignSub === void 0 ? "left" : _ref4$textAlignSub,
_ref4$padded = _ref4.padded,
padded = _ref4$padded === void 0 ? false : _ref4$padded,
children = _ref4.children,
rest = _objectWithoutPropertiesLoose$2(_ref4, ["as", "subtitle", "textAlign", "textAlignSub", "padded", "children"]);
return (children || subtitle) && /*#__PURE__*/React__default.createElement(S$a.Header, Object.assign({
$padded: padded
}, rest), children && /*#__PURE__*/React__default.createElement(S$a.Title, {
as: as,
$textAlign: textAlign
}, children), subtitle && /*#__PURE__*/React__default.createElement(S$a.Subtitle, {
$textAlign: textAlignSub
}, subtitle));
};
Title.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* what the main content is rendered as
*/
as: propTypes.elementType,
/**
* main title content
*/
children: propTypes.node,
/**
* if/where spacing around element exists
*/
padded: propTypes.oneOfType([propTypes.oneOf(["both", "bottom", "top"]), propTypes.bool]),
/**
* subtitle content
*/
subtitle: propTypes.node,
/**
* format title content
*/
textAlign: propTypes.oneOf(["center", "end", "initial", "justify", "split", "start"]),
/**
* format body / subtitle content
*/
textAlignSub: propTypes.oneOf(["center", "end", "initial", "justify", "split", "start"])
};function _templateObject2$8() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n text-align: center;\n}\n"]);
_templateObject2$8 = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$9() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n text-decoration: underline;\n ", ";\n ", ";\n}\n"]);
_templateObject$9 = function _templateObject() {
return data;
};
return data;
}
var S$9 = {}; // styled-components namespace
S$9.Link = styled.a(_templateObject$9(), getColor("light"), getHoverColor("white"));
S$9.Div = styled.div(_templateObject2$8());
var maybeLowerCase = function maybeLowerCase(str, enabled) {
if (str === void 0) {
str = "";
}
if (enabled === void 0) {
enabled = false;
}
return enabled ? str.toLowerCase() : str;
};
var FooterContent = function FooterContent(_ref) {
var _ref$copyright = _ref.copyright,
copyright = _ref$copyright === void 0 ? "" : _ref$copyright,
_ref$date = _ref.date,
date = _ref$date === void 0 ? "" : _ref$date,
_ref$developerName = _ref.developerName,
developerName = _ref$developerName === void 0 ? "" : _ref$developerName,
_ref$developerLink = _ref.developerLink,
developerLink = _ref$developerLink === void 0 ? "" : _ref$developerLink,
_ref$stacked = _ref.stacked,
stacked = _ref$stacked === void 0 ? false : _ref$stacked,
_ref$lowerCased = _ref.lowerCased,
lowerCased = _ref$lowerCased === void 0 ? false : _ref$lowerCased,
rest = _objectWithoutPropertiesLoose$2(_ref, ["copyright", "date", "developerName", "developerLink", "stacked", "lowerCased"]);
var dateObj = date ? new Date(date) : new Date();
return /*#__PURE__*/React__default.createElement(S$9.Div, rest, copyright && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, maybeLowerCase("Copyright \xA9 " + copyright + " " + dateObj.getFullYear(), lowerCased), dateObj.getFullYear() !== new Date().getFullYear() && " - " + new Date().getFullYear()), copyright && developerName && (stacked ? /*#__PURE__*/React__default.createElement("br", null) : " | "), developerName && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, maybeLowerCase("Designed and Developed by", lowerCased), "\xA0", /*#__PURE__*/React__default.createElement(S$9.Link, {
href: developerLink
}, developerName)));
};
FooterContent.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
children: propTypes.node,
/**
* company that holds copyright
*/
copyright: propTypes.string,
/**
* date the copyright began, displays as year.
*
* expands to include range from provided date to current year when they don't match
*/
date: propTypes.string,
/**
* your website or blog or whatever
*/
developerLink: propTypes.string,
/**
* you!
*/
developerName: propTypes.node,
/**
* stylistically format text as lower case
*/
lowerCased: propTypes.bool,
/**
* format content as stacked
*/
stacked: propTypes.bool
};function _templateObject2$7() {
var data = _taggedTemplateLiteralLoose(["\n@media ", " {\n&&&&&& {\n justify-content: center\n}\n }\n"]);
_templateObject2$7 = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$8() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n font-size: 0.85em;\n ", ";\n ", ";\n ", ";\n}\n\n &&&&&& a:link,\n &&&&&& a:visited {\n text-decoration: underline;\n ", ";\n ", ";\n }\n\n &&&&&& i {\n text-decoration: none;\n }\n\n &&&&&& a i {\n text-decoration: none;\n }\n\n &&&&&& a > i {\n text-decoration: none;\n }\n\n &&&&&& a > * {\n text-decoration: none;\n }\n"]);
_templateObject$8 = function _templateObject() {
return data;
};
return data;
}
var S$8 = {}; // styled-components namespace
var ForwardedSegment = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
var children = _ref.children,
rest = _objectWithoutPropertiesLoose$2(_ref, ["children"]);
return /*#__PURE__*/React__default.createElement(Ref, {
innerRef: ref
}, /*#__PURE__*/React__default.createElement(Segment, rest, children));
});
S$8.Segment = styled(ForwardedSegment)(_templateObject$8(), margin("top")("0"), getColor("light"), getBackgroundColor("primary"), getColor("light"), getHoverColor("white"));
S$8.Flexbox = styled(Flexbox)(_templateObject2$7(), media.mobile);
var Footer = function Footer(_ref2) {
var _ref2$color = _ref2.color,
color = _ref2$color === void 0 ? "" : _ref2$color,
_ref2$backgroundColor = _ref2.backgroundColor,
backgroundColor = _ref2$backgroundColor === void 0 ? "" : _ref2$backgroundColor,
_ref2$sticky = _ref2.sticky,
sticky = _ref2$sticky === void 0 ? true : _ref2$sticky,
_ref2$fullWidth = _ref2.fullWidth,
fullWidth = _ref2$fullWidth === void 0 ? false : _ref2$fullWidth,
_ref2$inverted = _ref2.inverted,
inverted = _ref2$inverted === void 0 ? false : _ref2$inverted,
_ref2$children = _ref2.children,
children = _ref2$children === void 0 ? [] : _ref2$children,
rest = _objectWithoutPropertiesLoose$2(_ref2, ["color", "backgroundColor", "sticky", "fullWidth", "inverted", "children"]);
/** @type {React.MutableRefObject<HTMLNode>} */
var con = useRef(); // update parent container to flex and apply grow to the prev sibling
// enable dynamic sized footer that stays at the bottom, even when there's little content
useLayoutEffect(function () {
if (sticky && con != null && con.current) {
var el = con.current.parentNode;
el.children[el.children.length - 2].style.flex = "1 0 auto";
el.style.display = "flex";
el.style.flexDirection = "column";
el.style.minHeight = "100vh";
}
});
var childrenArr = React__default.Children.toArray(children);
if (childrenArr.length > 2) console.warn("Footer only supports up to 2 children, the first 2 children provided will be used");
return (
/*#__PURE__*/
// bug in "semantic-ui-react": ">0.85.0"
// code is incorrectly identifying Child as a forwardRef despite
// eventual child rendering as functional component, manually override
// https://github.com/Semantic-Org/Semantic-UI-React/pull/3405/commits/d6f29a9f515cfe48628e90af7311c9f823beef7a
React__default.createElement(Ref, {
innerRef: con
}, /*#__PURE__*/React__default.createElement(S$8.Segment, Object.assign({
forwardedAs: "footer",
$color: color || (inverted ? undefined : "grey"),
$backgroundColor: backgroundColor,
basic: true,
vertical: true
}, rest), /*#__PURE__*/React__default.createElement(Container, {
fluid: fullWidth
}, /*#__PURE__*/React__default.createElement(S$8.Flexbox, {
justify: "split",
wrap: true
}, childrenArr[0] && withNewProps(childrenArr[0], {
inverted: inverted
}), childrenArr[1] && withNewProps(childrenArr[1], {
inverted: inverted
})))))
);
};
Footer.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* apply css supported color string to background, overrides theme / default
*/
backgroundColor: propTypes.string,
/**
* primary content rendered inside the footer
*
* **NOTE: only supports 2 or less children**
*/
children: propTypes.node,
/**
* apply css supported color string to content, overrides theme / default
*/
color: propTypes.string,
/**
* allow footer to stretch to edges
*/
fullWidth: propTypes.bool,
/**
* set color to secondary, colorHover to primary
*/
inverted: propTypes.bool,
/**
* attach footer to bottom of page when little content
*/
sticky: propTypes.bool
};
Footer.Content = withTag("SSUI", FooterContent);function _templateObject$7() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n font-display: fallback;\n font-weight: normal;\n ", ";\n ", ";\n font-size: ", ";\n}\n"]);
_templateObject$7 = function _templateObject() {
return data;
};
return data;
}
var S$7 = {}; // styled-components namespace
S$7.Title = styled(Header)(_templateObject$7(), getColor("white"), function (_ref) {
var $inlineLogo = _ref.$inlineLogo;
return $inlineLogo && "display: inline-block";
}, function (_ref2) {
var $inlineLogo = _ref2.$inlineLogo;
return $inlineLogo && margin("bottom")("0");
}, function (_ref3) {
var $secondary = _ref3.$secondary;
return $secondary ? "1.95em" : "2.4em";
});
var HeroTitle = function HeroTitle(_ref4) {
var _ref4$inlineLogo = _ref4.inlineLogo,
inlineLogo = _ref4$inlineLogo === void 0 ? "big" : _ref4$inlineLogo,
_ref4$color = _ref4.color,
color = _ref4$color === void 0 ? "" : _ref4$color,
_ref4$secondary = _ref4.secondary,
secondary = _ref4$secondary === void 0 ? "" : _ref4$secondary,
children = _ref4.children,
rest = _objectWithoutPropertiesLoose$2(_ref4, ["inlineLogo", "color", "secondary", "children"]);
return /*#__PURE__*/React__default.createElement(S$7.Title, Object.assign({
forwardedAs: secondary ? "h2" : "h1",
$color: color,
$secondary: secondary,
$inlineLogo: inlineLogo
}, rest), children);
};
HeroTitle.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* text-based content
*/
children: propTypes.node,
/**
* apply css supported color string to Icon and text, overrides theme / default
*/
color: propTypes.string,
/**
* format logo left of content
*/
inlineLogo: propTypes.string,
/**
* de-emphasize the title content
*/
secondary: propTypes.bool
};function _templateObject2$6() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n font-size: 1.4em;\n}\n"]);
_templateObject2$6 = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$6() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n font-display: fallback;\n font-weight: normal;\n}\n"]);
_templateObject$6 = function _templateObject() {
return data;
};
return data;
}
var S$6 = {}; // styled-components namespace
S$6.BaseHeader = styled(Header)(_templateObject$6(), getColor("white"));
S$6.Subtitle = styled(S$6.BaseHeader)(_templateObject2$6(), function (_ref) {
var $inlineLogo = _ref.$inlineLogo;
return $inlineLogo && margin("top")("0.75em");
});
var HeroSubtitle = function HeroSubtitle(_ref2) {
var _ref2$as = _ref2.as,
as = _ref2$as === void 0 ? "h2" : _ref2$as,
color = _ref2.color,
inlineLogo = _ref2.inlineLogo,
children = _ref2.children,
rest = _objectWithoutPropertiesLoose$2(_ref2, ["as", "color", "inlineLogo", "children"]);
return /*#__PURE__*/React__default.createElement(S$6.Subtitle, Object.assign({
forwardedAs: as,
$color: color,
$inlineLogo: inlineLogo
}, rest), children);
};
HeroSubtitle.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* what the main content is rendered as
*/
as: propTypes.elementType,
/**
* text-based content
*/
children: propTypes.node,
/**
* apply css supported color string to Icon and text, overrides theme / default
*/
color: propTypes.string,
/**
* format logo left of content
*/
inlineLogo: propTypes.node
};var HeroLogo = function HeroLogo(_ref) {
var children = _ref.children,
rest = _objectWithoutPropertiesLoose$2(_ref, ["children"]);
return /*#__PURE__*/React__default.createElement("img", Object.assign({
as: children.type
}, children.props, rest, {
alt: "logo"
}));
};
HeroLogo.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* text-based content
*/
children: propTypes.node
};function _templateObject2$5() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n ", ";\n vertical-align: bottom;\n /* width: 1em; */\n /* height: 1em; */\n}\n"]);
_templateObject2$5 = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$5() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n display: inline-flex;\n align-items: center;\n line-height: 1.2em;\n ", ";\n ", ";\n ", ";\n transition: ease-in-out 50ms;\n\n ", ";\n\n ", ";\n}\n &&&&&&:hover {\n transition: ease-in-out 100ms;\n }\n"]);
_templateObject$5 = function _templateObject() {
return data;
};
return data;
}
var S$5 = {}; // styled-components namespace
S$5.Button = styled(Button$2)(_templateObject$5(), margin("right")("0"), getColor("white"), getBackgroundColor("secondary"), margin("top")("0.5em"), getHoverBackgroundColor("primary"));
S$5.IconLink = styled(IconLink)(_templateObject2$5(), getColor("white"), function (_ref) {
var $pointing = _ref.$pointing;
return "margin-" + $pointing + ": .75em";
});
var HeroButton = function HeroButton(_ref2) {
var _ref2$as = _ref2.as,
as = _ref2$as === void 0 ? "a" : _ref2$as,
_ref2$link = _ref2.link,
link = _ref2$link === void 0 ? "" : _ref2$link,
_ref2$pointing = _ref2.pointing,
pointing = _ref2$pointing === void 0 ? "right" : _ref2$pointing,
_ref2$compact = _ref2.compact,
compact = _ref2$compact === void 0 ? false : _ref2$compact,
_ref2$size = _ref2.size,
size = _ref2$size === void 0 ? "big" : _ref2$size,
_ref2$color = _ref2.color,
color = _ref2$color === void 0 ? "" : _ref2$color,
_ref2$colorHover = _ref2.colorHover,
colorHover = _ref2$colorHover === void 0 ? "" : _ref2$colorHover,
children = _ref2.children,
rest = _objectWithoutPropertiesLoose$2(_ref2, ["as", "link", "pointing", "compact", "size", "color", "colorHover", "children"]);
return /*#__PURE__*/React__default.createElement(Link, Object.assign({
as: as,
forwarded: true,
link: link
}, rest), /*#__PURE__*/React__default.createElement(S$5.Button, {
primary: true,
size: size,
compact: compact,
$backgroundColor: color,
$backgroundColorHover: colorHover
}, pointing === "left" && /*#__PURE__*/React__default.createElement(S$5.IconLink, {
$pointing: "right",
name: "angle left"
}), children, pointing === "right" && /*#__PURE__*/React__default.createElement(S$5.IconLink, {
$pointing: "left",
name: "angle right"
})));
};
HeroButton.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* element type to render as (string or function)
* supports HTML tag as a string or React component definition
*
* @example
* 'div'
* 'section'
* ReactComponent
* Card
*/
as: propTypes.elementType,
/**
* text-based content
*/
children: propTypes.node,
/**
* apply css supported color string to background, overrides theme / default
* text defaults to `white` and background to `secondary` theme settings
*/
color: propTypes.string,
/**
* apply css supported color string to background on hover, overrides theme / default
* defaults to `primary` theme setting
*/
colorHover: propTypes.string,
/**
* reduce padding whitespace
*/
compact: propTypes.bool,
/**
* anchor link (prefixed with "#") or standard href
*/
link: propTypes.string,
/**
* formatted with active page indicator
*/
pointing: propTypes.oneOf(["left", "right"]),
/**
* size passed to SUI button
*/
size: propTypes.oneOf(["left", "right"])
};function _templateObject7() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n position: absolute !important;\n top: 0;\n left: -0.5%;\n height: 100%;\n width: 100.5%;\n z-index: 1;\n}\n &&&&&& img:last-child {\n object-fit: cover !important;\n object-position: 45% 55% !important;\n }\n"]);
_templateObject7 = function _templateObject7() {
return data;
};
return data;
}
function _templateObject6() {
var data = _taggedTemplateLiteralLoose(["5px solid ", ""]);
_templateObject6 = function _templateObject6() {
return data;
};
return data;
}
function _templateObject5() {
var data = _taggedTemplateLiteralLoose(["5px solid ", ""]);
_templateObject5 = function _templateObject5() {
return data;
};
return data;
}
function _templateObject4$1() {
var data = _taggedTemplateLiteralLoose(["\n ", ";\n ", ";\n ", ";\n ", ";\n\n @media ", " {\n ", ";\n }\n @media ", " {\n ", ";\n max-width: unset;\n align-items: center;\n text-align: center;\n }\n @media ", " {\n ", ";\n }\n "]);
_templateObject4$1 = function _templateObject4() {
return data;
};
return data;
}
function _templateObject3$2() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n align-items: ", ";\n text-align: ", ";\n display: flex;\n flex-direction: column;\n max-width: ", ";\n\n ", ";\n\n border-bottom: ", ";\n z-index: 3;\n position: relative;\n}\n"]);
_templateObject3$2 = function _templateObject3() {
return data;
};
return data;
}
function _templateObject2$4() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n display: flex;\n justify-content: ", ";\n}\n"]);
_templateObject2$4 = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$4() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n padding-top: ", ";\n padding-bottom: ", ";\n}\n\n /* background overlay to dim and saturate */\n\n &&&&&&::before {\n content: \"\";\n height: 100%;\n width: 100.5%;\n background: ", ";\n filter: saturate(1.8) sepia(0.4);\n background-repeat: no-repeat;\n background-size: cover;\n background-position: center + 45%;\n top: 0;\n left: -0.5%;\n position: absolute;\n z-index: 2;\n }\n\n @media ", " {\n&&&&&& {\n font-size: 0.9rem\n}\n }\n\n @media ", " {\n&&&&&& {\n font-size: 0.8rem\n}\n }\n\n @media ", " {\n&&&&&& {\n font-size: 0.8rem\n}\n }\n\n @media ", " {\n&&&&&& {\n font-size: 0.8rem\n}\n }\n"]);
_templateObject$4 = function _templateObject() {
return data;
};
return data;
}
var sizes = {
small: {
relaxed: "8em",
base: "6em",
compact: "4em"
},
medium: {
relaxed: "12em",
base: "9em",
compact: "6em"
},
large: {
relaxed: "16em",
base: "12em",
compact: "8em"
}
};
var S$4 = {};
S$4.Segment = styled(Segment)(_templateObject$4(), function (_ref) {
var baseline = _ref.baseline,
$size = _ref.$size;
if (baseline === "top") return sizes.small[$size];
if (baseline === "center") return sizes.medium[$size];
return sizes.large[$size];
}, function (_ref2) {
var baseline = _ref2.baseline,
$size = _ref2.$size;
if (baseline === "top") return sizes.large[$size];
if (baseline === "center") return sizes.medium[$size];
return sizes.small[$size];
}, function (_ref3) {
var overlay = _ref3.overlay;
return overlay === "dark" && "linear-gradient(0deg,rgba(0, 0, 0, 0.5),rgba(0, 0, 0, 0.5))" || overlay === "darker" && "linear-gradient(0deg,rgba(0, 0, 0, 0.65),rgba(0, 0, 0, 0.65))" || overlay === "darkest" && "linear-gradient(0deg,rgba(0, 0, 0, 0.65),rgba(0, 0, 0, 0.75))";
}, media.desktop, media.laptop, media.tablet, media.phone);
S$4.Container = styled(Container)(_templateObject2$4(), function (_ref4) {
var $justify = _ref4.$justify;
return flexAlignMap[$justify];
});
var getBackgroundColorOpacity = function getBackgroundColorOpacity() {
var out = getBackgroundColor("secondary").apply(void 0, arguments);
out.backgroundColor += "80";
return out;
};
S$4.Chunk = styled.header(_templateObject3$2(), function (_ref5) {
var $textAlign = _ref5.$textAlign;
return flexAlignMap[$textAlign];
}, function (_ref6) {
var $textAlign = _ref6.$textAlign;
return textAlignMap[$textAlign];
}, function (_ref7) {
var $boxed = _ref7.$boxed;
return $boxed ? "36em" : undefined;
}, function (_ref8) {
var $boxed = _ref8.$boxed;
return $boxed && css(_templateObject4$1(), getBackgroundColorOpacity, padding("all")("2.3em"), margin("start")("auto"), margin("end")("4em"), media.laptop, margin("end")("3em"), media.mobile, margin("horizontal")("2em"), media.phone, padding("all")("1.5em"));
}, function (_ref9) {
var $underline = _ref9.$underline,
theme = _ref9.theme;
return $underline === true && css(_templateObject5(), theme.accent || defaultColors.accent) || $underline && css(_templateObject6(), $underline) || "none";
});
/* use "!important" to override Gatsby-Image inline style */
S$4.BackgroundImage = styled.img(_templateObject7());
var Hero = function Hero(_ref10) {
var _ref10$overlay = _ref10.overlay,
overlay = _ref10$overlay === void 0 ? "dark" : _ref10$overlay,
_ref10$baseline = _ref10.baseline,
baseline = _ref10$baseline === void 0 ? "bottom" : _ref10$baseline,
_ref10$justify = _ref10.justify,
justify = _ref10$justify === void 0 ? "start" : _ref10$justify,
_ref10$textAlign = _ref10.textAlign,
textAlign = _ref10$textAlign === void 0 ? "start" : _ref10$textAlign,
_ref10$underline = _ref10.underline,
underline = _ref10$underline === void 0 ? false : _ref10$underline,
_ref10$size = _ref10.size,
size = _ref10$size === void 0 ? "base" : _ref10$size;
_ref10.inlineLogo;
var _ref10$boxed = _ref10.boxed,
boxed = _ref10$boxed === void 0 ? false : _ref10$boxed;
_ref10.color;
var _ref10$images = _ref10.images,
images = _ref10$images === void 0 ? [] : _ref10$images,
children = _ref10.children,
rest = _objectWithoutPropertiesLoose$2(_ref10, ["overlay", "baseline", "justify", "textAlign", "underline", "size", "inlineLogo", "boxed", "color", "images", "children"]);
var _useState = useState(0),
curBackground = _useState[0],
setCurBackground = _useState[1];
useEffect(function () {
var cycle = setTimeout(function () {
setCurBackground((curBackground + 1) % images.length);
}, 6000);
return function () {
return clearTimeout(cycle);
};
});
return /*#__PURE__*/React__default.createElement(S$4.Segment, Object.assign({
vertical: true,
baseline: baseline,
$size: size,
overlay: overlay
}, rest), React__default.Children.map(images, function (Background, i) {
return /*#__PURE__*/React__default.createElement(Transition, {
key: Background.props.alt,
visible: i === curBackground,
animation: "fade",
duration: 3000
}, /*#__PURE__*/React__default.createElement(S$4.BackgroundImage, Object.assign({
as: Background.type
}, Background.props)));
}), boxed ? /*#__PURE__*/React__default.createElement(S$4.Chunk, {
$boxed: boxed,
$textAlign: textAlign,
$underline: underline
}, children) : /*#__PURE__*/React__default.createElement(S$4.Container, {
$justify: justify
}, /*#__PURE__*/React__default.createElement(S$4.Chunk, {
$boxed: boxed,
$textAlign: textAlign,
$underline: underline
}, children)));
};
Hero.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* align content to top or bottom
*/
baseline: propTypes.oneOf(["bottom", "center", "top"]),
/**
* limit the width of the content and draw border
*/
boxed: propTypes.bool,
/**
* primary content rendered on top of the hero
*/
children: propTypes.node,
/**
* apply css supported color string to Icon and text, overrides theme / default
*/
color: propTypes.string,
/**
* background images
*/
images: propTypes.arrayOf(propTypes.element),
/**
* format logo left of content
*/
inlineLogo: propTypes.bool,
/**
* flex alignment of Hero content container
*/
justify: propTypes.oneOf(["center", "end", "initial", "justify", "split", "start"]),
/**
* darken background image to improve readability
*/
overlay: propTypes.oneOf(["dark", "darker", "darkest"]),
/**
* size using "em" units
*/
size: propTypes.oneOf(["base", "compact", "relaxed"]),
/**
* flex alignment of Hero content container
*/
textAlign: propTypes.oneOf(["center", "end", "initial", "justify", "split", "start"]),
/**
* apply css supported color string or use default if true
*/
underline: propTypes.oneOfType([propTypes.string, propTypes.bool])
};
Hero.Button = withTag("SSUI", HeroButton);
Hero.Title = withTag("SSUI", HeroTitle);
Hero.Subtitle = withTag("SSUI", HeroSubtitle);
Hero.Logo = withTag("SSUI", HeroLogo);function _templateObject2$3() {
var data = _taggedTemplateLiteralLoose(["\n border-bottom: 2px solid rgba(34, 36, 38, 0.15);\n\n &.active {\n border-bottom: 2px solid #1b1c1d;\n }\n\n /* remove rounded edge that distorts underline */\n &:last-child {\n border-radius: 0;\n }\n\n /* mix primary menu w secondary menu style */\n &:hover {\n background-color: rgba(0, 0, 0, 0.05);\n }\n "]);
_templateObject2$3 = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$3() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n}\n\n /* REVIEW: report bug when placing this block before the prev */\n\n @media ", " {\n &&&&&& a {\n /* font-size: 0.97rem; */\n }\n }\n"]);
_templateObject$3 = function _templateObject() {
return data;
};
return data;
}
var S$3 = {}; // styled-components namespace
S$3.Item = styled(Menu$1.Item)(_templateObject$3(), function (_ref) {
var $pointing = _ref.$pointing;
return $pointing && css(_templateObject2$3());
}, media.phone);
var NavigationItem = function NavigationItem(_ref2) {
var _ref2$as = _ref2.as,
as = _ref2$as === void 0 ? "a" : _ref2$as,
_ref2$link = _ref2.link,
link = _ref2$link === void 0 ? "" : _ref2$link;
_ref2.stacked;
var _ref2$pointing = _ref2.pointing,
pointing = _ref2$pointing === void 0 ? false : _ref2$pointing,
children = _ref2.children,
rest = _objectWithoutPropertiesLoose$2(_ref2, ["as", "link", "stacked", "pointing", "children"]);
return /*#__PURE__*/React__default.createElement(Link, Object.assign({
onClick: function onClick(e) {
return e.currentTarget.blur();
} // prevent keeping focus after navigating to new page
,
as: as,
forwarded: true // prevent getting caught by styled component `S.Item`
,
link: link
}, rest), /*#__PURE__*/React__default.createElement(S$3.Item, {
$pointing: pointing
}, children));
};
NavigationItem.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* element type to render as (string or function)
* supports HTML tag as a string or React component definition
*
* @example
* 'div'
* 'section'
* ReactComponent
* Card
*/
as: propTypes.elementType,
/**
* primary content, usually string, used as link if link not provided
*/
children: propTypes.node,
/**
* anchor link (prefixed with "#") or standard href
*/
link: propTypes.string,
/**
* formatted with active indicator
*/
pointing: propTypes.bool,
/**
* required to support stacking logo
*/
stacked: propTypes.bool
};function _templateObject3$1() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n position: relative !important;\n height: 3em !important;\n width: auto !important;\n /* height: 100% !important;\n width: 100% !important; */\n\n /* FIXME: does not work with Gatsby probably */\n /* reset weird behavior in gatsby */\n /* will work with regular img child or gatsby-image picture element */\n /* img:last-child {\n position: relative !important;\n width: ", "px !important;\n\n @media ", " {\n width: ", "px !important;\n }\n }\n\n svg {\n padding: 0.6em;\n vertical-align: middle;\n width: ", "em;\n\n @media ", " {\n width: ", "em;\n }\n } */\n}\n"]);
_templateObject3$1 = function _templateObject3() {
return data;
};
return data;
}
function _templateObject2$2() {
var data = _taggedTemplateLiteralLoose(["\n ", ";\n\n & > .item {\n border-bottom: none;\n }\n "]);
_templateObject2$2 = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$2() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n align-self: center;\n\n ", ";\n}\n"]);
_templateObject$2 = function _templateObject() {
return data;
};
return data;
}
var S$2 = {}; // styled-components namespace
// css functions not necessary but add syntax highlighting
// if stacked, set stacked logo spacing & remove underline
S$2.Wrapper = styled.div(_templateObject$2(), function (_ref) {
var $stacked = _ref.$stacked;
return $stacked && css(_templateObject2$2(), margin("horizontal")("50%"));
}); // use "!important" to override Gatsby-Image inline style
S$2.Logo = styled.div(_templateObject3$1(), function (_ref2) {
var $logoSize = _ref2.$logoSize;
return logoSizes[$logoSize];
}, media.phone, function (_ref3) {
var $logoSize = _ref3.$logoSize;
return logoSizes[$logoSize] * 0.8;
}, function (_ref4) {
var logoSize = _ref4.logoSize;
return logoSizesSVG[logoSize];
}, media.phone, function (_ref5) {
var logoSize = _ref5.logoSize;
return logoSizesSVG[logoSize] * 0.8;
});
var NavigationLogo = function NavigationLogo(_ref6) {
var _ref6$as = _ref6.as,
as = _ref6$as === void 0 ? "a" : _ref6$as,
_ref6$link = _ref6.link,
link = _ref6$link === void 0 ? "/" : _ref6$link,
_ref6$stacked = _ref6.stacked,
stacked = _ref6$stacked === void 0 ? false : _ref6$stacked,
_ref6$logoSize = _ref6.logoSize,
logoSize = _ref6$logoSize === void 0 ? "base" : _ref6$logoSize,
_ref6$className = _ref6.className,
className = _ref6$className === void 0 ? "" : _ref6$className,
children = _ref6.children,
rest = _objectWithoutPropertiesLoose$2(_ref6, ["as", "link", "stacked", "logoSize", "className", "children"]);
return /*#__PURE__*/React__default.createElement(S$2.Wrapper, {
$stacked: stacked,
className: className
}, /*#__PURE__*/React__default.createElement(NavigationItem, Object.assign({
as: as,
link: link,
stacked: stacked
}, rest), /*#__PURE__*/React__default.createElement(S$2.Logo, Object.assign({
as: children.type
}, children.props, {
$logoSize: logoSize
}))));
};
NavigationLogo.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* element type to render as (string or function)
* supports HTML tag as a string or React component definition
*
* @example
* 'div'
* 'section'
* ReactComponent
* Card
*/
as: propTypes.elementType,
/**
* primary content, usually a string
*/
children: propTypes.node,
/**
* additional or pass thru classes for composition
*/
className: propTypes.string,
/**
* anchor link (prefixed with "#") or standard href
*/
link: propTypes.string,
/**
* simple em based size
*/
logoSize: propTypes.oneOf(["base", "large", "small"]),
/**
* required to support stacking logo
*/
stacked: propTypes.bool
};function _templateObject4() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n flex-wrap: wrap;\n justify-content: center;\n}\n"]);
_templateObject4 = function _templateObject4() {
return data;
};
return data;
}
function _templateObject3() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n justify-content: ", ";\n flex-wrap: wrap;\n\n ", ";\n\n ", ";\n\n ", ";\n ", ";\n\n ", ";\n}\n\n &&&&&&:after {\n display: none;\n }\n\n @media ", " {\n&&&&&& {\n justify-content: center;\n}\n }\n"]);
_templateObject3 = function _templateObject3() {
return data;
};
return data;
}
function _templateObject2$1() {
var data = _taggedTemplateLiteralLoose(["\n position: absolute;\n z-index: 1000;\n width: 100%;\n background-color: #ffffff00;\n padding: ", ";\n "]);
_templateObject2$1 = function _templateObject2() {
return data;
};
return data;
}
function _templateObject$1() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n ", ";\n}\n"]);
_templateObject$1 = function _templateObject() {
return data;
};
return data;
}
var S$1 = {}; // styled-components namespace
// TODO: https://react.semantic-ui.com/collections/menu/#types-attached
S$1.Segment = styled(Segment)(_templateObject$1(), function (_ref) {
var $pointing = _ref.$pointing;
return $pointing && padding("bottom")("0");
}, function (_ref2) {
var $floating = _ref2.$floating,
$relaxed = _ref2.$relaxed;
return $floating && css(_templateObject2$1(), $relaxed ? "1em 1.5em" : "0em");
});
S$1.Menu = styled(Menu$1)(_templateObject3(), function (_ref3) {
var $justify = _ref3.$justify;
return flexAlignMap[$justify];
}, function (_ref4) {
var $split = _ref4.$split;
return $split && "justify-content: space-between";
}, function (_ref5) {
var pointing = _ref5.pointing;
return pointing && "& .item { border-radius: 0px }";
}, function (_ref6) {
var pointing = _ref6.pointing;
return pointing && "border-bottom: none";
}, function (_ref7) {
var pointing = _ref7.pointing;
return pointing && margin("bottom")("2px");
}, function (_ref8) {
var pointing = _ref8.pointing,
$floating = _ref8.$floating;
return pointing && $floating && "border: none";
}, media.mobile);
S$1.SubMenu = styled(Menu$1.Menu)(_templateObject4()); // TODO: add sticky header
var Navigation = function Navigation(_ref9) {
var _ref9$as = _ref9.as,
as = _ref9$as === void 0 ? "a" : _ref9$as,
size = _ref9.size,
_ref9$text = _ref9.text,
text = _ref9$text === void 0 ? false : _ref9$text,
_ref9$relaxed = _ref9.relaxed,
relaxed = _ref9$relaxed === void 0 ? false : _ref9$relaxed,
_ref9$primary = _ref9.primary,
primary = _ref9$primary === void 0 ? false : _ref9$primary,
_ref9$noPointing = _ref9.noPointing,
noPointing = _ref9$noPointing === void 0 ? false : _ref9$noPointing,
_ref9$textAlign = _ref9.textAlign,
textAlign = _ref9$textAlign === void 0 ? "center" : _ref9$textAlign,
_ref9$justify = _ref9.justify,
justify = _ref9$justify === void 0 ? "center" : _ref9$justify,
_ref9$inverted = _ref9.inverted,
inverted = _ref9$inverted === void 0 ? false : _ref9$inverted,
_ref9$fullWidth = _ref9.fullWidth,
fullWidth = _ref9$fullWidth === void 0 ? false : _ref9$fullWidth,
_ref9$split = _ref9.split,
split = _ref9$split === void 0 ? false : _ref9$split,
_ref9$floating = _ref9.floating,
floating = _ref9$floating === void 0 ? false : _ref9$floating,
_ref9$children = _ref9.children,
children = _ref9$children === void 0 ? null : _ref9$children,
rest = _objectWithoutPropertiesLoose$2(_ref9, ["as", "size", "text", "relaxed", "primary", "noPointing", "textAlign", "justify", "inverted", "fullWidth", "split", "floating", "children"]);
return fullWidth || !split ? /*#__PURE__*/React__default.createElement(S$1.Menu, Object.assign({
forwardedAs: "nav",
size: size,
text: text,
secondary: !primary,
pointing: !noPointing,
inverted: inverted,
$justify: justify,
$floating: floating,
$split: split
}, rest), React__default.Children.map(children, function (Child) {
return withNewProps(Child, {
forwardedAs: as,
pointing: !noPointing
});
})) : /*#__PURE__*/React__default.createElement(Container, {
textAlign: textAlign
}, /*#__PURE__*/React__default.createElement(S$1.Menu, {
forwardedAs: "nav",
size: size,
text: text,
compact: !relaxed,
secondary: !primary,
pointing: !noPointing,
inverted: inverted,
$floating: floating
}, React__default.Children.map(children, function (Child) {
return withNewProps(Child, {
forwardedAs: as,
pointing: !noPointing
});
})));
};
Navigation.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* element type to render as (string or function)
* supports HTML tag as a string or React component definition
*
* @example
* 'div'
* 'section'
* ReactComponent
* Card
*/
as: propTypes.elementType,
/**
* collection of items to render as menu
*/
children: propTypes.node,
/**
* elevate nav to sit on top of underlying container
*/
floating: propTypes.bool,
/**
* allow content to reach the edges of the parent
*/
fullWidth: propTypes.bool,
/**
* flip the colors for display on a light colored background
*/
inverted: propTypes.bool,
/**
* horizontal position
*/
justify: propTypes.oneOf(["center", "end", "initial", "justify", "split", "start"]),
/**
* don't indicate active page
*/
noPointing: propTypes.bool,
/**
* increase prominence
*/
primary: propTypes.bool,
/**
* increase whitespace
*/
relaxed: propTypes.bool,
/**
* size using "em" units
*/
size: propTypes.oneOf(["huge", "large", "massive", "mini", "small", "tiny"]),
/**
* put all space between children
*
* **NOTE:** only works with 2 items
*/
split: propTypes.bool,
/**
* format to be used with text items
*/
text: propTypes.bool,
/**
* horizontal position
*/
textAlign: propTypes.oneOf(["center", "end", "initial", "justify", "split", "start"])
};
Navigation.Left = withTag("SSUI", function (_ref10) {
var children = _ref10.children,
rest = _objectWithoutPropertiesLoose$2(_ref10, ["children"]);
return /*#__PURE__*/React__default.createElement(S$1.SubMenu, null, React__default.Children.map(children, function (Child) {
return withNewProps(Child, rest);
}));
});
Navigation.Right = withTag("SSUI", function (_ref11) {
var children = _ref11.children,
rest = _objectWithoutPropertiesLoose$2(_ref11, ["children"]);
return /*#__PURE__*/React__default.createElement(S$1.SubMenu, null, React__default.Children.map(children, function (Child) {
return withNewProps(Child, rest);
}));
});
Navigation.Item = withTag("SSUI", NavigationItem);
Navigation.Logo = withTag("SSUI", NavigationLogo);var Section404 = function Section404(_ref) {
var _ref$title = _ref.title,
title = _ref$title === void 0 ? "404: Missing Page Error" : _ref$title,
_ref$content = _ref.content,
content = _ref$content === void 0 ? "You've arrived at an invalid URL. We apologize for the inconvenience!" : _ref$content,
_ref$textAlign = _ref.textAlign,
textAlign = _ref$textAlign === void 0 ? "center" : _ref$textAlign,
rest = _objectWithoutPropertiesLoose$2(_ref, ["title", "content", "textAlign"]);
return /*#__PURE__*/React__default.createElement(Grid, Object.assign({
textAlign: textAlign,
verticalAlign: "middle"
}, rest), /*#__PURE__*/React__default.createElement(Grid.Column, null, /*#__PURE__*/React__default.createElement(Title, {
subtitle: content,
textAlignBody: "center"
}, title)));
};
Section404.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
children: propTypes.node,
/**
* subtitle of main message
*/
content: propTypes.node,
/**
* format body content
*/
textAlign: propTypes.oneOf(["center", "end", "initial", "justify", "split", "start"]),
/**
* main message of the error section
*/
title: propTypes.node
};function _templateObject2() {
var data = _taggedTemplateLiteralLoose(["\n@media ", " {\n &&&&&&:not(.fluid) {\n max-width: 425px !important;\n padding: 0 1.5em !important;\n margin: 0 auto !important;\n }\n }\n @media ", " {\n &&&&&&:not(.fluid) {\n padding: 0 0.5em !important;\n }\n }\n"]);
_templateObject2 = function _templateObject2() {
return data;
};
return data;
}
function _templateObject() {
var data = _taggedTemplateLiteralLoose(["\n&&&&&& {\n ", ";\n}\n\n &&&&&&:first-child {\n ", ";\n }\n\n &&&&&&:last-child {\n ", ";\n }\n"]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
var S = {}; // styled-components namespace
S.Segment = styled(Segment)(_templateObject(), padding("vertical")("2em"), padding("top")("2.5em"), padding("bottom")("4em"));
S.Container = styled(Container)(_templateObject2(), media.tablet, media.phone);
var PageSegment = function PageSegment(_ref) {
var _ref$secondary = _ref.secondary,
secondary = _ref$secondary === void 0 ? false : _ref$secondary,
text = _ref.text,
children = _ref.children,
rest = _objectWithoutPropertiesLoose$2(_ref, ["secondary", "text", "children"]);
return /*#__PURE__*/React__default.createElement(S.Segment, Object.assign({
forwardedAs: "section",
vertical: true,
basic: true,
secondary: secondary
}, rest), /*#__PURE__*/React__default.createElement(S.Container, {
text: text
}, children));
};
PageSegment.propTypes = {
// -------------------------------- Warning -----------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them, edit the .d.ts file and run any yarn dev / build command |
// ----------------------------------------------------------------------------
/**
* primary content
*/
children: propTypes.node,
/**
* format to appear less prominent (grey background)
*/
secondary: propTypes.bool,
/**
* pass to `Container` component to narrow the width of the segment
*/
text: propTypes.bool
};var SSUI=/*#__PURE__*/Object.freeze({__proto__:null,Blurb:Blurb,Blurbs:Blurbs,ContactForm:ContactForm,IconLink:IconLink,Link:Link,PortfolioItem:PortfolioItem,Title:Title,Footer:Footer,Hero:Hero,Navigation:Navigation,Section404:Section404,Flexbox:Flexbox,PageSegment:PageSegment});Object.values(SSUI).forEach(function (component) {
// @ts-ignore
// eslint-disable-next-line no-param-reassign
component.displayName = "SSUI(" + getComponentName(component) + ")";
});export{Accordion,Advertisement,Blurb,Blurbs,Breadcrumb,Button$2 as Button,Card,Checkbox,Comment,Confirm$1 as Confirm,ContactForm,Container,Dimmer,Divider,Dropdown,Embed,Flag$1 as Flag,Flexbox,Footer,Form$1 as Form,Grid,Header,Hero,Icon$1 as Icon,IconLink,Image,Input$1 as Input,Item,Label,Link,List$1 as List,Loader,Menu$1 as Menu,Message,Modal$1 as Modal,Navigation,ObjectFromEntries,PageSegment,Pagination,Placeholder,Popup,Portal$1 as Portal,PortfolioItem,Progress$1 as Progress,Radio,Rail,Rating,Ref,Reveal,Search,Section404,Segment,Select,Sidebar$1 as Sidebar,Statistic,Step$1 as Step,Sticky,Tab$1 as Tab,Table,TextArea$1 as TextArea,Title,Transition,TransitionablePortal,Visibility,calcDuration,camelToKebab,defaultColors,encode,flexAlignMap,getBackgroundColor,getColor,getComponentName,getHoverBackgroundColor,getHoverColor,getHoverProperty,getProperty,iconMap,includesAny,logoSizes,logoSizesSVG,margin,media,padding,process,sleep,spacing,spacingMap,testUsingLastParamAsDefault,textAlignMap,toJoinedTitleCase,withNewProps,withProps,withTag,withoutProps};//# sourceMappingURL=index.esm.js.map