UNPKG

510 kBJavaScriptView Raw
1var _templateObject;import"regenerator-runtime/runtime.js";function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}function _defineProperty2(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray2(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray2(arr);}function _toArray(arr){return _arrayWithHoles2(arr)||_iterableToArray(arr)||_unsupportedIterableToArray2(arr)||_nonIterableRest2();}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _slicedToArray2(arr,i){return _arrayWithHoles2(arr)||_iterableToArrayLimit2(arr,i)||_unsupportedIterableToArray2(arr,i)||_nonIterableRest2();}function _nonIterableRest2(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray2(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray2(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray2(o,minLen);}function _arrayLikeToArray2(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit2(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles2(arr){if(Array.isArray(arr))return arr;}function _classCallCheck2(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function __defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass2(Constructor,protoProps,staticProps){if(protoProps)__defineProperties(Constructor.prototype,protoProps);if(staticProps)__defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits2(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf2(subClass,superClass);}function _setPrototypeOf2(o,p){_setPrototypeOf2=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf2(o,p);}function _createSuper2(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct2();return function _createSuperInternal(){var Super=_getPrototypeOf2(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf2(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn2(this,result);};}function _possibleConstructorReturn2(self,call){if(call&&(_typeof2(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized2(self);}function _assertThisInitialized2(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct2(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf2(o){_getPrototypeOf2=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf2(o);}function _typeof2(obj){"@babel/helpers - typeof";return _typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof2(obj);}import"core-js/modules/esnext.global-this.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.symbol.description.js";import"core-js/modules/es.object.assign.js";import"core-js/modules/es.object.get-own-property-names.js";import"core-js/modules/es.array.map.js";import"core-js/modules/es.array.join.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.split.js";import"core-js/modules/es.function.name.js";import"core-js/modules/es.symbol.iterator.js";import"core-js/modules/es.array.iterator.js";import"core-js/modules/es.string.iterator.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.regexp.constructor.js";import"core-js/modules/es.regexp.to-string.js";import"core-js/modules/es.map.js";import"core-js/modules/es.set.js";import"core-js/modules/es.array-buffer.constructor.js";import"core-js/modules/es.regexp.flags.js";import"core-js/modules/es.string.match.js";import"core-js/modules/es.string.replace.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.array.concat.js";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import"core-js/modules/es.array.splice.js";import"core-js/modules/es.array.slice.js";import"core-js/modules/es.string.trim.js";import"core-js/modules/es.object.get-own-property-descriptors.js";import"core-js/modules/es.object.get-prototype-of.js";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.promise.js";import"core-js/modules/es.object.freeze.js";import"core-js/modules/es.weak-map.js";import"core-js/modules/es.array.from.js";import"core-js/modules/es.string.bold.js";import"core-js/modules/es.object.values.js";import"core-js/modules/es.number.to-fixed.js";import"core-js/modules/es.array.flat.js";import"core-js/modules/es.array.unscopables.flat.js";import"core-js/modules/es.array.fill.js";import"core-js/modules/es.array.find.js";import"core-js/modules/es.object.entries.js";import"core-js/modules/esnext.string.replace-all.js";import"core-js/modules/es.string.repeat.js";import"core-js/modules/es.string.starts-with.js";import"core-js/modules/es.array.find-index.js";import"core-js/modules/es.symbol.to-string-tag.js";import"core-js/modules/es.json.to-string-tag.js";import"core-js/modules/es.math.to-string-tag.js";import"core-js/modules/es.string.search.js";import"core-js/modules/es.number.epsilon.js";import"core-js/modules/es.number.constructor.js";import"core-js/modules/es.array.sort.js";import"core-js/modules/es.string.link.js";import"core-js/modules/es.string.ends-with.js";import"core-js/modules/es.string.trim-end.js";import"core-js/modules/es.object.is.js";import React$2,{Component,Children,Fragment,useMemo,useState,useCallback,forwardRef,useReducer,useEffect,useRef,cloneElement}from'react';import require$$2 from'react-dom';import{Link as Link$1,Location,Route,LocationProvider,useNavigate}from'@storybook/router';import{ActiveTabs,useStorybookApi,isRoot,isStory,Consumer,merge,isGroup,useStorybookState,Provider as Provider$1}from'@storybook/api';import{styled,withTheme,Global,useTheme,keyframes,createGlobal,createCache,ThemeProvider,CacheProvider,ensure}from'@storybook/theming';import{TabButton,StorybookLogo,Icons,Button as Button$1,WithTooltip,TooltipLinkList,Spaced,Link,ScrollArea,Badge,IconButton,Separator,getStoryHref,TabBar,FlexBar,Zoom as Zoom$1,Loader as Loader$1,Tabs,StorybookIcon,DocumentWrapper,SyntaxHighlighter,Form,Symbols}from'@storybook/components';import memoize from'memoizerific';import{logger}from'@storybook/client-logger';import{STORIES_COLLAPSE_ALL,STORIES_EXPAND_ALL,FORCE_REMOUNT,SET_CURRENT_STORY}from'@storybook/core-events';import{shortcutToHumanString,eventToShortcut,shortcutMatchesShortcut}from'@storybook/api/shortcut';import{types,addons}from'@storybook/addons';import qs from'qs';import semver from'@storybook/semver';var commonjsGlobal=typeof globalThis!=='undefined'?globalThis:typeof window!=='undefined'?window:typeof global!=='undefined'?global:typeof self!=='undefined'?self:{};function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,'default')?x['default']:x;}function getAugmentedNamespace(n){if(n.__esModule)return n;var a=Object.defineProperty({},'__esModule',{value:true});Object.keys(n).forEach(function(k){var d=Object.getOwnPropertyDescriptor(n,k);Object.defineProperty(a,k,d.get?d:{enumerable:true,get:function get(){return n[k];}});});return a;}var win;if(typeof window!=="undefined"){win=window;}else if(typeof commonjsGlobal!=="undefined"){win=commonjsGlobal;}else if(typeof self!=="undefined"){win=self;}else{win={};}var window_1=win;var propTypes={exports:{}};var reactIs$1={exports:{}};var reactIs_production_min$1={};/** @license React v16.13.1
2 * react-is.production.min.js
3 *
4 * Copyright (c) Facebook, Inc. and its affiliates.
5 *
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the root directory of this source tree.
8 */var b$3="function"===typeof Symbol&&Symbol.for,c$3=b$3?Symbol.for("react.element"):60103,d$3=b$3?Symbol.for("react.portal"):60106,e$3=b$3?Symbol.for("react.fragment"):60107,f$3=b$3?Symbol.for("react.strict_mode"):60108,g$3=b$3?Symbol.for("react.profiler"):60114,h$3=b$3?Symbol.for("react.provider"):60109,k$3=b$3?Symbol.for("react.context"):60110,l$3=b$3?Symbol.for("react.async_mode"):60111,m$3=b$3?Symbol.for("react.concurrent_mode"):60111,n$3=b$3?Symbol.for("react.forward_ref"):60112,p$3=b$3?Symbol.for("react.suspense"):60113,q$3=b$3?Symbol.for("react.suspense_list"):60120,r$3=b$3?Symbol.for("react.memo"):60115,t$1=b$3?Symbol.for("react.lazy"):60116,v$3=b$3?Symbol.for("react.block"):60121,w$3=b$3?Symbol.for("react.fundamental"):60117,x$3=b$3?Symbol.for("react.responder"):60118,y$3=b$3?Symbol.for("react.scope"):60119;function z$3(a){if("object"===_typeof2(a)&&null!==a){var u=a.$$typeof;switch(u){case c$3:switch(a=a.type,a){case l$3:case m$3:case e$3:case g$3:case f$3:case p$3:return a;default:switch(a=a&&a.$$typeof,a){case k$3:case n$3:case t$1:case r$3:case h$3:return a;default:return u;}}case d$3:return u;}}}function A$3(a){return z$3(a)===m$3;}reactIs_production_min$1.AsyncMode=l$3;reactIs_production_min$1.ConcurrentMode=m$3;reactIs_production_min$1.ContextConsumer=k$3;reactIs_production_min$1.ContextProvider=h$3;reactIs_production_min$1.Element=c$3;reactIs_production_min$1.ForwardRef=n$3;reactIs_production_min$1.Fragment=e$3;reactIs_production_min$1.Lazy=t$1;reactIs_production_min$1.Memo=r$3;reactIs_production_min$1.Portal=d$3;reactIs_production_min$1.Profiler=g$3;reactIs_production_min$1.StrictMode=f$3;reactIs_production_min$1.Suspense=p$3;reactIs_production_min$1.isAsyncMode=function(a){return A$3(a)||z$3(a)===l$3;};reactIs_production_min$1.isConcurrentMode=A$3;reactIs_production_min$1.isContextConsumer=function(a){return z$3(a)===k$3;};reactIs_production_min$1.isContextProvider=function(a){return z$3(a)===h$3;};reactIs_production_min$1.isElement=function(a){return"object"===_typeof2(a)&&null!==a&&a.$$typeof===c$3;};reactIs_production_min$1.isForwardRef=function(a){return z$3(a)===n$3;};reactIs_production_min$1.isFragment=function(a){return z$3(a)===e$3;};reactIs_production_min$1.isLazy=function(a){return z$3(a)===t$1;};reactIs_production_min$1.isMemo=function(a){return z$3(a)===r$3;};reactIs_production_min$1.isPortal=function(a){return z$3(a)===d$3;};reactIs_production_min$1.isProfiler=function(a){return z$3(a)===g$3;};reactIs_production_min$1.isStrictMode=function(a){return z$3(a)===f$3;};reactIs_production_min$1.isSuspense=function(a){return z$3(a)===p$3;};reactIs_production_min$1.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e$3||a===m$3||a===g$3||a===f$3||a===p$3||a===q$3||"object"===_typeof2(a)&&null!==a&&(a.$$typeof===t$1||a.$$typeof===r$3||a.$$typeof===h$3||a.$$typeof===k$3||a.$$typeof===n$3||a.$$typeof===w$3||a.$$typeof===x$3||a.$$typeof===y$3||a.$$typeof===v$3);};reactIs_production_min$1.typeOf=z$3;var reactIs_development$1={};/** @license React v16.13.1
9 * react-is.development.js
10 *
11 * Copyright (c) Facebook, Inc. and its affiliates.
12 *
13 * This source code is licensed under the MIT license found in the
14 * LICENSE file in the root directory of this source tree.
15 */if(process.env.NODE_ENV!=="production"){(function(){// nor polyfill, then a plain number is used for performance.
16var hasSymbol=typeof Symbol==='function'&&Symbol.for;var REACT_ELEMENT_TYPE=hasSymbol?Symbol.for('react.element'):0xeac7;var REACT_PORTAL_TYPE=hasSymbol?Symbol.for('react.portal'):0xeaca;var REACT_FRAGMENT_TYPE=hasSymbol?Symbol.for('react.fragment'):0xeacb;var REACT_STRICT_MODE_TYPE=hasSymbol?Symbol.for('react.strict_mode'):0xeacc;var REACT_PROFILER_TYPE=hasSymbol?Symbol.for('react.profiler'):0xead2;var REACT_PROVIDER_TYPE=hasSymbol?Symbol.for('react.provider'):0xeacd;var REACT_CONTEXT_TYPE=hasSymbol?Symbol.for('react.context'):0xeace;// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
17// (unstable) APIs that have been removed. Can we remove the symbols?
18var REACT_ASYNC_MODE_TYPE=hasSymbol?Symbol.for('react.async_mode'):0xeacf;var REACT_CONCURRENT_MODE_TYPE=hasSymbol?Symbol.for('react.concurrent_mode'):0xeacf;var REACT_FORWARD_REF_TYPE=hasSymbol?Symbol.for('react.forward_ref'):0xead0;var REACT_SUSPENSE_TYPE=hasSymbol?Symbol.for('react.suspense'):0xead1;var REACT_SUSPENSE_LIST_TYPE=hasSymbol?Symbol.for('react.suspense_list'):0xead8;var REACT_MEMO_TYPE=hasSymbol?Symbol.for('react.memo'):0xead3;var REACT_LAZY_TYPE=hasSymbol?Symbol.for('react.lazy'):0xead4;var REACT_BLOCK_TYPE=hasSymbol?Symbol.for('react.block'):0xead9;var REACT_FUNDAMENTAL_TYPE=hasSymbol?Symbol.for('react.fundamental'):0xead5;var REACT_RESPONDER_TYPE=hasSymbol?Symbol.for('react.responder'):0xead6;var REACT_SCOPE_TYPE=hasSymbol?Symbol.for('react.scope'):0xead7;function isValidElementType(type){return typeof type==='string'||typeof type==='function'||// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
19type===REACT_FRAGMENT_TYPE||type===REACT_CONCURRENT_MODE_TYPE||type===REACT_PROFILER_TYPE||type===REACT_STRICT_MODE_TYPE||type===REACT_SUSPENSE_TYPE||type===REACT_SUSPENSE_LIST_TYPE||_typeof2(type)==='object'&&type!==null&&(type.$$typeof===REACT_LAZY_TYPE||type.$$typeof===REACT_MEMO_TYPE||type.$$typeof===REACT_PROVIDER_TYPE||type.$$typeof===REACT_CONTEXT_TYPE||type.$$typeof===REACT_FORWARD_REF_TYPE||type.$$typeof===REACT_FUNDAMENTAL_TYPE||type.$$typeof===REACT_RESPONDER_TYPE||type.$$typeof===REACT_SCOPE_TYPE||type.$$typeof===REACT_BLOCK_TYPE);}function typeOf(object){if(_typeof2(object)==='object'&&object!==null){var $$typeof=object.$$typeof;switch($$typeof){case REACT_ELEMENT_TYPE:var type=object.type;switch(type){case REACT_ASYNC_MODE_TYPE:case REACT_CONCURRENT_MODE_TYPE:case REACT_FRAGMENT_TYPE:case REACT_PROFILER_TYPE:case REACT_STRICT_MODE_TYPE:case REACT_SUSPENSE_TYPE:return type;default:var $$typeofType=type&&type.$$typeof;switch($$typeofType){case REACT_CONTEXT_TYPE:case REACT_FORWARD_REF_TYPE:case REACT_LAZY_TYPE:case REACT_MEMO_TYPE:case REACT_PROVIDER_TYPE:return $$typeofType;default:return $$typeof;}}case REACT_PORTAL_TYPE:return $$typeof;}}return undefined;}// AsyncMode is deprecated along with isAsyncMode
20var AsyncMode=REACT_ASYNC_MODE_TYPE;var ConcurrentMode=REACT_CONCURRENT_MODE_TYPE;var ContextConsumer=REACT_CONTEXT_TYPE;var ContextProvider=REACT_PROVIDER_TYPE;var Element=REACT_ELEMENT_TYPE;var ForwardRef=REACT_FORWARD_REF_TYPE;var Fragment=REACT_FRAGMENT_TYPE;var Lazy=REACT_LAZY_TYPE;var Memo=REACT_MEMO_TYPE;var Portal=REACT_PORTAL_TYPE;var Profiler=REACT_PROFILER_TYPE;var StrictMode=REACT_STRICT_MODE_TYPE;var Suspense=REACT_SUSPENSE_TYPE;var hasWarnedAboutDeprecatedIsAsyncMode=false;// AsyncMode should be deprecated
21function isAsyncMode(object){{if(!hasWarnedAboutDeprecatedIsAsyncMode){hasWarnedAboutDeprecatedIsAsyncMode=true;// Using console['warn'] to evade Babel and ESLint
22console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, '+'and will be removed in React 17+. Update your code to use '+'ReactIs.isConcurrentMode() instead. It has the exact same API.');}}return isConcurrentMode(object)||typeOf(object)===REACT_ASYNC_MODE_TYPE;}function isConcurrentMode(object){return typeOf(object)===REACT_CONCURRENT_MODE_TYPE;}function isContextConsumer(object){return typeOf(object)===REACT_CONTEXT_TYPE;}function isContextProvider(object){return typeOf(object)===REACT_PROVIDER_TYPE;}function isElement(object){return _typeof2(object)==='object'&&object!==null&&object.$$typeof===REACT_ELEMENT_TYPE;}function isForwardRef(object){return typeOf(object)===REACT_FORWARD_REF_TYPE;}function isFragment(object){return typeOf(object)===REACT_FRAGMENT_TYPE;}function isLazy(object){return typeOf(object)===REACT_LAZY_TYPE;}function isMemo(object){return typeOf(object)===REACT_MEMO_TYPE;}function isPortal(object){return typeOf(object)===REACT_PORTAL_TYPE;}function isProfiler(object){return typeOf(object)===REACT_PROFILER_TYPE;}function isStrictMode(object){return typeOf(object)===REACT_STRICT_MODE_TYPE;}function isSuspense(object){return typeOf(object)===REACT_SUSPENSE_TYPE;}reactIs_development$1.AsyncMode=AsyncMode;reactIs_development$1.ConcurrentMode=ConcurrentMode;reactIs_development$1.ContextConsumer=ContextConsumer;reactIs_development$1.ContextProvider=ContextProvider;reactIs_development$1.Element=Element;reactIs_development$1.ForwardRef=ForwardRef;reactIs_development$1.Fragment=Fragment;reactIs_development$1.Lazy=Lazy;reactIs_development$1.Memo=Memo;reactIs_development$1.Portal=Portal;reactIs_development$1.Profiler=Profiler;reactIs_development$1.StrictMode=StrictMode;reactIs_development$1.Suspense=Suspense;reactIs_development$1.isAsyncMode=isAsyncMode;reactIs_development$1.isConcurrentMode=isConcurrentMode;reactIs_development$1.isContextConsumer=isContextConsumer;reactIs_development$1.isContextProvider=isContextProvider;reactIs_development$1.isElement=isElement;reactIs_development$1.isForwardRef=isForwardRef;reactIs_development$1.isFragment=isFragment;reactIs_development$1.isLazy=isLazy;reactIs_development$1.isMemo=isMemo;reactIs_development$1.isPortal=isPortal;reactIs_development$1.isProfiler=isProfiler;reactIs_development$1.isStrictMode=isStrictMode;reactIs_development$1.isSuspense=isSuspense;reactIs_development$1.isValidElementType=isValidElementType;reactIs_development$1.typeOf=typeOf;})();}if(process.env.NODE_ENV==='production'){reactIs$1.exports=reactIs_production_min$1;}else{reactIs$1.exports=reactIs_development$1;}/*
23object-assign
24(c) Sindre Sorhus
25@license MIT
26*/ /* eslint-disable no-unused-vars */var getOwnPropertySymbols=Object.getOwnPropertySymbols;var hasOwnProperty$1=Object.prototype.hasOwnProperty;var propIsEnumerable=Object.prototype.propertyIsEnumerable;function toObject(val){if(val===null||val===undefined){throw new TypeError('Object.assign cannot be called with null or undefined');}return Object(val);}function shouldUseNative(){try{if(!Object.assign){return false;}// Detect buggy property enumeration order in older V8 versions.
27// https://bugs.chromium.org/p/v8/issues/detail?id=4118
28var test1=new String('abc');// eslint-disable-line no-new-wrappers
29test1[5]='de';if(Object.getOwnPropertyNames(test1)[0]==='5'){return false;}// https://bugs.chromium.org/p/v8/issues/detail?id=3056
30var test2={};for(var i=0;i<10;i++){test2['_'+String.fromCharCode(i)]=i;}var order2=Object.getOwnPropertyNames(test2).map(function(n){return test2[n];});if(order2.join('')!=='0123456789'){return false;}// https://bugs.chromium.org/p/v8/issues/detail?id=3056
31var test3={};'abcdefghijklmnopqrst'.split('').forEach(function(letter){test3[letter]=letter;});if(Object.keys(Object.assign({},test3)).join('')!=='abcdefghijklmnopqrst'){return false;}return true;}catch(err){// We don't expect any of the above to throw, but better to be safe.
32return false;}}var objectAssign=shouldUseNative()?Object.assign:function(target,source){var from;var to=toObject(target);var symbols;for(var s=1;s<arguments.length;s++){from=Object(arguments[s]);for(var key in from){if(hasOwnProperty$1.call(from,key)){to[key]=from[key];}}if(getOwnPropertySymbols){symbols=getOwnPropertySymbols(from);for(var i=0;i<symbols.length;i++){if(propIsEnumerable.call(from,symbols[i])){to[symbols[i]]=from[symbols[i]];}}}}return to;};/**
33 * Copyright (c) 2013-present, Facebook, Inc.
34 *
35 * This source code is licensed under the MIT license found in the
36 * LICENSE file in the root directory of this source tree.
37 */var ReactPropTypesSecret$3='SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';var ReactPropTypesSecret_1=ReactPropTypesSecret$3;var has$2=Function.call.bind(Object.prototype.hasOwnProperty);/**
38 * Copyright (c) 2013-present, Facebook, Inc.
39 *
40 * This source code is licensed under the MIT license found in the
41 * LICENSE file in the root directory of this source tree.
42 */var printWarning$1=function printWarning$1(){};if(process.env.NODE_ENV!=='production'){var ReactPropTypesSecret$2=ReactPropTypesSecret_1;var loggedTypeFailures={};var has$1=has$2;printWarning$1=function printWarning$1(text){var message='Warning: '+text;if(typeof console!=='undefined'){console.error(message);}try{// --- Welcome to debugging React ---
43// This error was thrown as a convenience so that you can use this stack
44// to find the callsite that caused this warning to fire.
45throw new Error(message);}catch(x){/**/}};}/**
46 * Assert that the values match with the type specs.
47 * Error messages are memorized and will only be shown once.
48 *
49 * @param {object} typeSpecs Map of name to a ReactPropType
50 * @param {object} values Runtime values that need to be type-checked
51 * @param {string} location e.g. "prop", "context", "child context"
52 * @param {string} componentName Name of the component for error messages.
53 * @param {?Function} getStack Returns the component stack.
54 * @private
55 */function checkPropTypes$1(typeSpecs,values,location,componentName,getStack){if(process.env.NODE_ENV!=='production'){for(var typeSpecName in typeSpecs){if(has$1(typeSpecs,typeSpecName)){var error;// Prop type validation may throw. In case they do, we don't want to
56// fail the render phase where it didn't fail before. So we log it.
57// After these have been cleaned up, we'll let them throw.
58try{// This is intentionally an invariant that gets caught. It's the same
59// behavior as without this statement except with a better message.
60if(typeof typeSpecs[typeSpecName]!=='function'){var err=Error((componentName||'React class')+': '+location+' type `'+typeSpecName+'` is invalid; '+'it must be a function, usually from the `prop-types` package, but received `'+_typeof2(typeSpecs[typeSpecName])+'`.'+'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');err.name='Invariant Violation';throw err;}error=typeSpecs[typeSpecName](values,typeSpecName,componentName,location,null,ReactPropTypesSecret$2);}catch(ex){error=ex;}if(error&&!(error instanceof Error)){printWarning$1((componentName||'React class')+': type specification of '+location+' `'+typeSpecName+'` is invalid; the type checker '+'function must return `null` or an `Error` but returned a '+_typeof2(error)+'. '+'You may have forgotten to pass an argument to the type checker '+'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and '+'shape all require an argument).');}if(error instanceof Error&&!(error.message in loggedTypeFailures)){// Only monitor this failure once because there tends to be a lot of the
61// same error.
62loggedTypeFailures[error.message]=true;var stack=getStack?getStack():'';printWarning$1('Failed '+location+' type: '+error.message+(stack!=null?stack:''));}}}}}/**
63 * Resets warning cache when testing.
64 *
65 * @private
66 */checkPropTypes$1.resetWarningCache=function(){if(process.env.NODE_ENV!=='production'){loggedTypeFailures={};}};var checkPropTypes_1=checkPropTypes$1;/**
67 * Copyright (c) 2013-present, Facebook, Inc.
68 *
69 * This source code is licensed under the MIT license found in the
70 * LICENSE file in the root directory of this source tree.
71 */var ReactIs$1=reactIs$1.exports;var assign=objectAssign;var ReactPropTypesSecret$1=ReactPropTypesSecret_1;var has=has$2;var checkPropTypes=checkPropTypes_1;var printWarning=function printWarning(){};if(process.env.NODE_ENV!=='production'){printWarning=function printWarning(text){var message='Warning: '+text;if(typeof console!=='undefined'){console.error(message);}try{// --- Welcome to debugging React ---
72// This error was thrown as a convenience so that you can use this stack
73// to find the callsite that caused this warning to fire.
74throw new Error(message);}catch(x){}};}function emptyFunctionThatReturnsNull(){return null;}var factoryWithTypeCheckers=function factoryWithTypeCheckers(isValidElement,throwOnDirectAccess){/* global Symbol */var ITERATOR_SYMBOL=typeof Symbol==='function'&&Symbol.iterator;var FAUX_ITERATOR_SYMBOL='@@iterator';// Before Symbol spec.
75/**
76 * Returns the iterator method function contained on the iterable object.
77 *
78 * Be sure to invoke the function with the iterable as context:
79 *
80 * var iteratorFn = getIteratorFn(myIterable);
81 * if (iteratorFn) {
82 * var iterator = iteratorFn.call(myIterable);
83 * ...
84 * }
85 *
86 * @param {?object} maybeIterable
87 * @return {?function}
88 */function getIteratorFn(maybeIterable){var iteratorFn=maybeIterable&&(ITERATOR_SYMBOL&&maybeIterable[ITERATOR_SYMBOL]||maybeIterable[FAUX_ITERATOR_SYMBOL]);if(typeof iteratorFn==='function'){return iteratorFn;}}/**
89 * Collection of methods that allow declaration and validation of props that are
90 * supplied to React components. Example usage:
91 *
92 * var Props = require('ReactPropTypes');
93 * var MyArticle = React.createClass({
94 * propTypes: {
95 * // An optional string prop named "description".
96 * description: Props.string,
97 *
98 * // A required enum prop named "category".
99 * category: Props.oneOf(['News','Photos']).isRequired,
100 *
101 * // A prop named "dialog" that requires an instance of Dialog.
102 * dialog: Props.instanceOf(Dialog).isRequired
103 * },
104 * render: function() { ... }
105 * });
106 *
107 * A more formal specification of how these methods are used:
108 *
109 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
110 * decl := ReactPropTypes.{type}(.isRequired)?
111 *
112 * Each and every declaration produces a function with the same signature. This
113 * allows the creation of custom validation functions. For example:
114 *
115 * var MyLink = React.createClass({
116 * propTypes: {
117 * // An optional string or URI prop named "href".
118 * href: function(props, propName, componentName) {
119 * var propValue = props[propName];
120 * if (propValue != null && typeof propValue !== 'string' &&
121 * !(propValue instanceof URI)) {
122 * return new Error(
123 * 'Expected a string or an URI for ' + propName + ' in ' +
124 * componentName
125 * );
126 * }
127 * }
128 * },
129 * render: function() {...}
130 * });
131 *
132 * @internal
133 */var ANONYMOUS='<<anonymous>>';// Important!
134// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
135var ReactPropTypes={array:createPrimitiveTypeChecker('array'),bigint:createPrimitiveTypeChecker('bigint'),bool:createPrimitiveTypeChecker('boolean'),func:createPrimitiveTypeChecker('function'),number:createPrimitiveTypeChecker('number'),object:createPrimitiveTypeChecker('object'),string:createPrimitiveTypeChecker('string'),symbol:createPrimitiveTypeChecker('symbol'),any:createAnyTypeChecker(),arrayOf:createArrayOfTypeChecker,element:createElementTypeChecker(),elementType:createElementTypeTypeChecker(),instanceOf:createInstanceTypeChecker,node:createNodeChecker(),objectOf:createObjectOfTypeChecker,oneOf:createEnumTypeChecker,oneOfType:createUnionTypeChecker,shape:createShapeTypeChecker,exact:createStrictShapeTypeChecker};/**
136 * inlined Object.is polyfill to avoid requiring consumers ship their own
137 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
138 */ /*eslint-disable no-self-compare*/function is(x,y){// SameValue algorithm
139if(x===y){// Steps 1-5, 7-10
140// Steps 6.b-6.e: +0 != -0
141return x!==0||1/x===1/y;}else{// Step 6.a: NaN == NaN
142return x!==x&&y!==y;}}/*eslint-enable no-self-compare*/ /**
143 * We use an Error-like object for backward compatibility as people may call
144 * PropTypes directly and inspect their output. However, we don't use real
145 * Errors anymore. We don't inspect their stack anyway, and creating them
146 * is prohibitively expensive if they are created too often, such as what
147 * happens in oneOfType() for any type before the one that matched.
148 */function PropTypeError(message,data){this.message=message;this.data=data&&_typeof2(data)==='object'?data:{};this.stack='';}// Make `instanceof Error` still work for returned errors.
149PropTypeError.prototype=Error.prototype;function createChainableTypeChecker(validate){if(process.env.NODE_ENV!=='production'){var manualPropTypeCallCache={};var manualPropTypeWarningCount=0;}function checkType(isRequired,props,propName,componentName,location,propFullName,secret){componentName=componentName||ANONYMOUS;propFullName=propFullName||propName;if(secret!==ReactPropTypesSecret$1){if(throwOnDirectAccess){// New behavior only for users of `prop-types` package
150var 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;}else if(process.env.NODE_ENV!=='production'&&typeof console!=='undefined'){// Old behavior for people using React.PropTypes
151var cacheKey=componentName+':'+propName;if(!manualPropTypeCallCache[cacheKey]&&// Avoid spamming the console because they are often not actionable except for lib authors
152manualPropTypeWarningCount<3){printWarning('You are manually calling a React.PropTypes validation '+'function for the `'+propFullName+'` prop on `'+componentName+'`. This is deprecated '+'and will throw in the standalone `prop-types` package. '+'You may be seeing this warning due to a third-party PropTypes '+'library. See https://fb.me/react-warning-dont-call-proptypes '+'for details.');manualPropTypeCallCache[cacheKey]=true;manualPropTypeWarningCount++;}}}if(props[propName]==null){if(isRequired){if(props[propName]===null){return new PropTypeError('The '+location+' `'+propFullName+'` is marked as required '+('in `'+componentName+'`, but its value is `null`.'));}return new PropTypeError('The '+location+' `'+propFullName+'` is marked as required in '+('`'+componentName+'`, but its value is `undefined`.'));}return null;}else{return validate(props,propName,componentName,location,propFullName);}}var chainedCheckType=checkType.bind(null,false);chainedCheckType.isRequired=checkType.bind(null,true);return chainedCheckType;}function createPrimitiveTypeChecker(expectedType){function validate(props,propName,componentName,location,propFullName,secret){var propValue=props[propName];var propType=getPropType(propValue);if(propType!==expectedType){// `propValue` being instance of, say, date/regexp, pass the 'object'
153// check, but we can offer a more precise error message here rather than
154// 'of type `object`'.
155var preciseType=getPreciseType(propValue);return new PropTypeError('Invalid '+location+' `'+propFullName+'` of type '+('`'+preciseType+'` supplied to `'+componentName+'`, expected ')+('`'+expectedType+'`.'),{expectedType:expectedType});}return null;}return createChainableTypeChecker(validate);}function createAnyTypeChecker(){return createChainableTypeChecker(emptyFunctionThatReturnsNull);}function createArrayOfTypeChecker(typeChecker){function validate(props,propName,componentName,location,propFullName){if(typeof typeChecker!=='function'){return new PropTypeError('Property `'+propFullName+'` of component `'+componentName+'` has invalid PropType notation inside arrayOf.');}var propValue=props[propName];if(!Array.isArray(propValue)){var propType=getPropType(propValue);return new PropTypeError('Invalid '+location+' `'+propFullName+'` of type '+('`'+propType+'` supplied to `'+componentName+'`, expected an array.'));}for(var i=0;i<propValue.length;i++){var error=typeChecker(propValue,i,componentName,location,propFullName+'['+i+']',ReactPropTypesSecret$1);if(error instanceof Error){return error;}}return null;}return createChainableTypeChecker(validate);}function createElementTypeChecker(){function validate(props,propName,componentName,location,propFullName){var propValue=props[propName];if(!isValidElement(propValue)){var propType=getPropType(propValue);return new PropTypeError('Invalid '+location+' `'+propFullName+'` of type '+('`'+propType+'` supplied to `'+componentName+'`, expected a single ReactElement.'));}return null;}return createChainableTypeChecker(validate);}function createElementTypeTypeChecker(){function validate(props,propName,componentName,location,propFullName){var propValue=props[propName];if(!ReactIs$1.isValidElementType(propValue)){var propType=getPropType(propValue);return new PropTypeError('Invalid '+location+' `'+propFullName+'` of type '+('`'+propType+'` supplied to `'+componentName+'`, expected a single ReactElement type.'));}return null;}return createChainableTypeChecker(validate);}function createInstanceTypeChecker(expectedClass){function validate(props,propName,componentName,location,propFullName){if(!(props[propName]instanceof expectedClass)){var expectedClassName=expectedClass.name||ANONYMOUS;var actualClassName=getClassName(props[propName]);return new PropTypeError('Invalid '+location+' `'+propFullName+'` of type '+('`'+actualClassName+'` supplied to `'+componentName+'`, expected ')+('instance of `'+expectedClassName+'`.'));}return null;}return createChainableTypeChecker(validate);}function createEnumTypeChecker(expectedValues){if(!Array.isArray(expectedValues)){if(process.env.NODE_ENV!=='production'){if(arguments.length>1){printWarning('Invalid arguments supplied to oneOf, expected an array, got '+arguments.length+' arguments. '+'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).');}else{printWarning('Invalid argument supplied to oneOf, expected an array.');}}return emptyFunctionThatReturnsNull;}function validate(props,propName,componentName,location,propFullName){var propValue=props[propName];for(var i=0;i<expectedValues.length;i++){if(is(propValue,expectedValues[i])){return null;}}var valuesString=JSON.stringify(expectedValues,function replacer(key,value){var type=getPreciseType(value);if(type==='symbol'){return String(value);}return value;});return new PropTypeError('Invalid '+location+' `'+propFullName+'` of value `'+String(propValue)+'` '+('supplied to `'+componentName+'`, expected one of '+valuesString+'.'));}return createChainableTypeChecker(validate);}function createObjectOfTypeChecker(typeChecker){function validate(props,propName,componentName,location,propFullName){if(typeof typeChecker!=='function'){return new PropTypeError('Property `'+propFullName+'` of component `'+componentName+'` has invalid PropType notation inside objectOf.');}var propValue=props[propName];var propType=getPropType(propValue);if(propType!=='object'){return new PropTypeError('Invalid '+location+' `'+propFullName+'` of type '+('`'+propType+'` supplied to `'+componentName+'`, expected an object.'));}for(var key in propValue){if(has(propValue,key)){var error=typeChecker(propValue,key,componentName,location,propFullName+'.'+key,ReactPropTypesSecret$1);if(error instanceof Error){return error;}}}return null;}return createChainableTypeChecker(validate);}function createUnionTypeChecker(arrayOfTypeCheckers){if(!Array.isArray(arrayOfTypeCheckers)){process.env.NODE_ENV!=='production'?printWarning('Invalid argument supplied to oneOfType, expected an instance of array.'):void 0;return emptyFunctionThatReturnsNull;}for(var i=0;i<arrayOfTypeCheckers.length;i++){var checker=arrayOfTypeCheckers[i];if(typeof checker!=='function'){printWarning('Invalid argument supplied to oneOfType. Expected an array of check functions, but '+'received '+getPostfixForTypeWarning(checker)+' at index '+i+'.');return emptyFunctionThatReturnsNull;}}function validate(props,propName,componentName,location,propFullName){var expectedTypes=[];for(var i=0;i<arrayOfTypeCheckers.length;i++){var checker=arrayOfTypeCheckers[i];var checkerResult=checker(props,propName,componentName,location,propFullName,ReactPropTypesSecret$1);if(checkerResult==null){return null;}if(checkerResult.data&&has(checkerResult.data,'expectedType')){expectedTypes.push(checkerResult.data.expectedType);}}var expectedTypesMessage=expectedTypes.length>0?', expected one of type ['+expectedTypes.join(', ')+']':'';return new PropTypeError('Invalid '+location+' `'+propFullName+'` supplied to '+('`'+componentName+'`'+expectedTypesMessage+'.'));}return createChainableTypeChecker(validate);}function createNodeChecker(){function validate(props,propName,componentName,location,propFullName){if(!isNode(props[propName])){return new PropTypeError('Invalid '+location+' `'+propFullName+'` supplied to '+('`'+componentName+'`, expected a ReactNode.'));}return null;}return createChainableTypeChecker(validate);}function invalidValidatorError(componentName,location,propFullName,key,type){return new PropTypeError((componentName||'React class')+': '+location+' type `'+propFullName+'.'+key+'` is invalid; '+'it must be a function, usually from the `prop-types` package, but received `'+type+'`.');}function createShapeTypeChecker(shapeTypes){function validate(props,propName,componentName,location,propFullName){var propValue=props[propName];var propType=getPropType(propValue);if(propType!=='object'){return new PropTypeError('Invalid '+location+' `'+propFullName+'` of type `'+propType+'` '+('supplied to `'+componentName+'`, expected `object`.'));}for(var key in shapeTypes){var checker=shapeTypes[key];if(typeof checker!=='function'){return invalidValidatorError(componentName,location,propFullName,key,getPreciseType(checker));}var error=checker(propValue,key,componentName,location,propFullName+'.'+key,ReactPropTypesSecret$1);if(error){return error;}}return null;}return createChainableTypeChecker(validate);}function createStrictShapeTypeChecker(shapeTypes){function validate(props,propName,componentName,location,propFullName){var propValue=props[propName];var propType=getPropType(propValue);if(propType!=='object'){return new PropTypeError('Invalid '+location+' `'+propFullName+'` of type `'+propType+'` '+('supplied to `'+componentName+'`, expected `object`.'));}// We need to check all keys in case some are required but missing from props.
156var allKeys=assign({},props[propName],shapeTypes);for(var key in allKeys){var checker=shapeTypes[key];if(has(shapeTypes,key)&&typeof checker!=='function'){return invalidValidatorError(componentName,location,propFullName,key,getPreciseType(checker));}if(!checker){return new PropTypeError('Invalid '+location+' `'+propFullName+'` key `'+key+'` supplied to `'+componentName+'`.'+'\nBad object: '+JSON.stringify(props[propName],null,' ')+'\nValid keys: '+JSON.stringify(Object.keys(shapeTypes),null,' '));}var error=checker(propValue,key,componentName,location,propFullName+'.'+key,ReactPropTypesSecret$1);if(error){return error;}}return null;}return createChainableTypeChecker(validate);}function isNode(propValue){switch(_typeof2(propValue)){case'number':case'string':case'undefined':return true;case'boolean':return!propValue;case'object':if(Array.isArray(propValue)){return propValue.every(isNode);}if(propValue===null||isValidElement(propValue)){return true;}var iteratorFn=getIteratorFn(propValue);if(iteratorFn){var iterator=iteratorFn.call(propValue);var step;if(iteratorFn!==propValue.entries){while(!(step=iterator.next()).done){if(!isNode(step.value)){return false;}}}else{// Iterator will provide entry [k,v] tuples rather than values.
157while(!(step=iterator.next()).done){var entry=step.value;if(entry){if(!isNode(entry[1])){return false;}}}}}else{return false;}return true;default:return false;}}function isSymbol(propType,propValue){// Native Symbol.
158if(propType==='symbol'){return true;}// falsy value can't be a Symbol
159if(!propValue){return false;}// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
160if(propValue['@@toStringTag']==='Symbol'){return true;}// Fallback for non-spec compliant Symbols which are polyfilled.
161if(typeof Symbol==='function'&&propValue instanceof Symbol){return true;}return false;}// Equivalent of `typeof` but with special handling for array and regexp.
162function getPropType(propValue){var propType=_typeof2(propValue);if(Array.isArray(propValue)){return'array';}if(propValue instanceof RegExp){// Old webkits (at least until Android 4.0) return 'function' rather than
163// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
164// passes PropTypes.object.
165return'object';}if(isSymbol(propType,propValue)){return'symbol';}return propType;}// This handles more types than `getPropType`. Only used for error messages.
166// See `createPrimitiveTypeChecker`.
167function getPreciseType(propValue){if(typeof propValue==='undefined'||propValue===null){return''+propValue;}var propType=getPropType(propValue);if(propType==='object'){if(propValue instanceof Date){return'date';}else if(propValue instanceof RegExp){return'regexp';}}return propType;}// Returns a string that is postfixed to a warning about an invalid type.
168// For example, "undefined" or "of type array"
169function getPostfixForTypeWarning(value){var type=getPreciseType(value);switch(type){case'array':case'object':return'an '+type;case'boolean':case'date':case'regexp':return'a '+type;default:return type;}}// Returns class name of the object, if any.
170function getClassName(propValue){if(!propValue.constructor||!propValue.constructor.name){return ANONYMOUS;}return propValue.constructor.name;}ReactPropTypes.checkPropTypes=checkPropTypes;ReactPropTypes.resetWarningCache=checkPropTypes.resetWarningCache;ReactPropTypes.PropTypes=ReactPropTypes;return ReactPropTypes;};/**
171 * Copyright (c) 2013-present, Facebook, Inc.
172 *
173 * This source code is licensed under the MIT license found in the
174 * LICENSE file in the root directory of this source tree.
175 */var ReactPropTypesSecret=ReactPropTypesSecret_1;function emptyFunction(){}function emptyFunctionWithReset(){}emptyFunctionWithReset.resetWarningCache=emptyFunction;var factoryWithThrowingShims=function factoryWithThrowingShims(){function shim(props,propName,componentName,location,propFullName,secret){if(secret===ReactPropTypesSecret){// It is still safe when called from React.
176return;}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;}// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
177var ReactPropTypes={array:shim,bigint: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;};/**
178 * Copyright (c) 2013-present, Facebook, Inc.
179 *
180 * This source code is licensed under the MIT license found in the
181 * LICENSE file in the root directory of this source tree.
182 */if(process.env.NODE_ENV!=='production'){var ReactIs=reactIs$1.exports;// By explicitly using `prop-types` you are opting into new development behavior.
183// http://fb.me/prop-types-in-prod
184var throwOnDirectAccess=true;propTypes.exports=factoryWithTypeCheckers(ReactIs.isElement,throwOnDirectAccess);}else{// By explicitly using `prop-types` you are opting into new production behavior.
185// http://fb.me/prop-types-in-prod
186propTypes.exports=factoryWithThrowingShims();}var PropTypes=propTypes.exports;/* 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
187function equal(a,b){// START: fast-deep-equal es6/index.js 3.1.1
188if(a===b)return true;if(a&&b&&_typeof2(a)=='object'&&_typeof2(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:
189// 1. Extra `has<Type> &&` helpers in initial condition allow es6 code
190// to co-exist with es5.
191// 2. Replace `for of` with es5 compliant iteration using `for`.
192// Basically, take:
193//
194// ```js
195// for (i of a.entries())
196// if (!b.has(i[0])) return false;
197// ```
198//
199// ... and convert to:
200//
201// ```js
202// it = a.entries();
203// while (!(i = it.next()).done)
204// if (!b.has(i.value[0])) return false;
205// ```
206//
207// **Note**: `i` access switches to `i.value`.
208var 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
209if(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
210// START: react-fast-compare
211// custom handling for DOM elements
212if(hasElementType&&a instanceof Element)return false;// custom handling for React/Preact
213for(i=length;i--!==0;){if((keys[i]==='_owner'||keys[i]==='__v'||keys[i]==='__o')&&a.$$typeof){// React-specific: avoid traversing React elements' _owner
214// Preact-specific: avoid traversing Preact elements' __v and __o
215// __v = $_original / $_vnode
216// __o = $_owner
217// These properties contain circular references and are not needed when
218// comparing the actual elements (and not their owners)
219// .$$typeof and ._store on just reasonable markers of elements
220continue;}// all other properties should be traversed as usual
221if(!equal(a[keys[i]],b[keys[i]]))return false;}// END: react-fast-compare
222// START: fast-deep-equal
223return true;}return a!==a&&b!==b;}// end fast-deep-equal
224var 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
225// browsers give this different errors name and messages:
226// chrome/safari: "RangeError", "Maximum call stack size exceeded"
227// firefox: "InternalError", too much recursion"
228// edge: "Error", "Out of stack space"
229console.warn('react-fast-compare cannot handle circular refs');return false;}// some other error. we should definitely know about these
230throw error;}};/**
231 * Copyright (c) 2013-present, Facebook, Inc.
232 *
233 * This source code is licensed under the MIT license found in the
234 * LICENSE file in the root directory of this source tree.
235 */ /**
236 * Use invariant() to assert state which your program assumes to be true.
237 *
238 * Provide sprintf-style format (only %s is supported) and arguments
239 * to provide information about what broke and what you were
240 * expecting.
241 *
242 * The invariant message will be stripped in production, but the invariant
243 * will remain to ensure logic does not differ in production.
244 */var NODE_ENV=process.env.NODE_ENV;var invariant$1=function invariant$1(condition,format,a,b,c,d,e,f){if(NODE_ENV!=='production'){if(format===undefined){throw new Error('invariant requires an error message argument');}}if(!condition){var error;if(format===undefined){error=new Error('Minified exception occurred; use the non-minified dev environment '+'for the full error message and additional helpful warnings.');}else{var args=[a,b,c,d,e,f];var argIndex=0;error=new Error(format.replace(/%s/g,function(){return args[argIndex++];}));error.name='Invariant Violation';}error.framesToPop=1;// we don't care about invariant's own frame
245throw error;}};var invariant_1=invariant$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(_typeof2(objA)!=="object"||!objA||_typeof2(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.
246for(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;};function a$1(){return(a$1=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r){Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n]);}}return t;}).apply(this,arguments);}function s$1(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,c$2(t,e);}function c$2(t,e){return(c$2=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t;})(t,e);}function u$2(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++){e.indexOf(r=o[n])>=0||(i[r]=t[r]);}return i;}var l$2={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},p$2={rel:["amphtml","canonical","alternate"]},f$2={type:["application/ld+json"]},d$2={charset:"",name:["robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},h$2=Object.keys(l$2).map(function(t){return l$2[t];}),m$2={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},y$2=Object.keys(m$2).reduce(function(t,e){return t[m$2[e]]=e,t;},{}),T$1=function T$1(t,e){for(var r=t.length-1;r>=0;r-=1){var n=t[r];if(Object.prototype.hasOwnProperty.call(n,e))return n[e];}return null;},g$2=function g$2(t){var e=T$1(t,l$2.TITLE),r=T$1(t,"titleTemplate");if(Array.isArray(e)&&(e=e.join("")),r&&e)return r.replace(/%s/g,function(){return e;});var n=T$1(t,"defaultTitle");return e||n||void 0;},b$2=function b$2(t){return T$1(t,"onChangeClientState")||function(){};},v$2=function v$2(t,e){return e.filter(function(e){return void 0!==e[t];}).map(function(e){return e[t];}).reduce(function(t,e){return a$1({},t,e);},{});},A$2=function A$2(t,e){return e.filter(function(t){return void 0!==t[l$2.BASE];}).map(function(t){return t[l$2.BASE];}).reverse().reduce(function(e,r){if(!e.length)for(var n=Object.keys(r),i=0;i<n.length;i+=1){var o=n[i].toLowerCase();if(-1!==t.indexOf(o)&&r[o])return e.concat(r);}return e;},[]);},C$2=function C$2(t,e,r){var n={};return r.filter(function(e){return!!Array.isArray(e[t])||(void 0!==e[t]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+t+' should be of type "Array". Instead found type "'+_typeof2(e[t])+'"'),!1);}).map(function(e){return e[t];}).reverse().reduce(function(t,r){var i={};r.filter(function(t){for(var r,o=Object.keys(t),a=0;a<o.length;a+=1){var s=o[a],c=s.toLowerCase();-1===e.indexOf(c)||"rel"===r&&"canonical"===t[r].toLowerCase()||"rel"===c&&"stylesheet"===t[c].toLowerCase()||(r=c),-1===e.indexOf(s)||"innerHTML"!==s&&"cssText"!==s&&"itemprop"!==s||(r=s);}if(!r||!t[r])return!1;var u=t[r].toLowerCase();return n[r]||(n[r]={}),i[r]||(i[r]={}),!n[r][u]&&(i[r][u]=!0,!0);}).reverse().forEach(function(e){return t.push(e);});for(var o=Object.keys(i),s=0;s<o.length;s+=1){var c=o[s],u=a$1({},n[c],i[c]);n[c]=u;}return t;},[]).reverse();},O$1=function O$1(t,e){if(Array.isArray(t)&&t.length)for(var r=0;r<t.length;r+=1){if(t[r][e])return!0;}return!1;},S$1=function S$1(t){return Array.isArray(t)?t.join(""):t;},E$2=function E$2(t,e){return Array.isArray(t)?t.reduce(function(t,r){return function(t,e){for(var r=Object.keys(t),n=0;n<r.length;n+=1){if(e[r[n]]&&e[r[n]].includes(t[r[n]]))return!0;}return!1;}(r,e)?t.priority.push(r):t.default.push(r),t;},{priority:[],default:[]}):{default:t};},I$2=function I$2(t,e){var r;return a$1({},t,((r={})[e]=void 0,r));},P$1=[l$2.NOSCRIPT,l$2.SCRIPT,l$2.STYLE],w$2=function w$2(t,e){return void 0===e&&(e=!0),!1===e?String(t):String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;");},x$2=function x$2(t){return Object.keys(t).reduce(function(e,r){var n=void 0!==t[r]?r+'="'+t[r]+'"':""+r;return e?e+" "+n:n;},"");},L$1=function L$1(t,e){return void 0===e&&(e={}),Object.keys(t).reduce(function(e,r){return e[m$2[r]||r]=t[r],e;},e);},j$1=function j$1(e,r){return r.map(function(r,n){var i,o=((i={key:n})["data-rh"]=!0,i);return Object.keys(r).forEach(function(t){var e=m$2[t]||t;"innerHTML"===e||"cssText"===e?o.dangerouslySetInnerHTML={__html:r.innerHTML||r.cssText}:o[e]=r[t];}),React$2.createElement(e,o);});},M$1=function M$1(e,r,n){switch(e){case l$2.TITLE:return{toComponent:function toComponent(){return n=r.titleAttributes,(i={key:e=r.title})["data-rh"]=!0,o=L$1(n,i),[React$2.createElement(l$2.TITLE,o,e)];var e,n,i,o;},toString:function toString(){return function(t,e,r,n){var i=x$2(r),o=S$1(e);return i?"<"+t+' data-rh="true" '+i+">"+w$2(o,n)+"</"+t+">":"<"+t+' data-rh="true">'+w$2(o,n)+"</"+t+">";}(e,r.title,r.titleAttributes,n);}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function toComponent(){return L$1(r);},toString:function toString(){return x$2(r);}};default:return{toComponent:function toComponent(){return j$1(e,r);},toString:function toString(){return function(t,e,r){return e.reduce(function(e,n){var i=Object.keys(n).filter(function(t){return!("innerHTML"===t||"cssText"===t);}).reduce(function(t,e){var i=void 0===n[e]?e:e+'="'+w$2(n[e],r)+'"';return t?t+" "+i:i;},""),o=n.innerHTML||n.cssText||"",a=-1===P$1.indexOf(t);return e+"<"+t+' data-rh="true" '+i+(a?"/>":">"+o+"</"+t+">");},"");}(e,r,n);}};}},k$2=function k$2(t){var e=t.baseTag,r=t.bodyAttributes,n=t.encode,i=t.htmlAttributes,o=t.noscriptTags,a=t.styleTags,s=t.title,c=void 0===s?"":s,u=t.titleAttributes,h=t.linkTags,m=t.metaTags,y=t.scriptTags,T={toComponent:function toComponent(){},toString:function toString(){return"";}};if(t.prioritizeSeoTags){var g=function(t){var e=t.linkTags,r=t.scriptTags,n=t.encode,i=E$2(t.metaTags,d$2),o=E$2(e,p$2),a=E$2(r,f$2);return{priorityMethods:{toComponent:function toComponent(){return[].concat(j$1(l$2.META,i.priority),j$1(l$2.LINK,o.priority),j$1(l$2.SCRIPT,a.priority));},toString:function toString(){return M$1(l$2.META,i.priority,n)+" "+M$1(l$2.LINK,o.priority,n)+" "+M$1(l$2.SCRIPT,a.priority,n);}},metaTags:i.default,linkTags:o.default,scriptTags:a.default};}(t);T=g.priorityMethods,h=g.linkTags,m=g.metaTags,y=g.scriptTags;}return{priority:T,base:M$1(l$2.BASE,e,n),bodyAttributes:M$1("bodyAttributes",r,n),htmlAttributes:M$1("htmlAttributes",i,n),link:M$1(l$2.LINK,h,n),meta:M$1(l$2.META,m,n),noscript:M$1(l$2.NOSCRIPT,o,n),script:M$1(l$2.SCRIPT,y,n),style:M$1(l$2.STYLE,a,n),title:M$1(l$2.TITLE,{title:c,titleAttributes:u},n)};},H$2=[],N$1=function N$1(t,e){var r=this;void 0===e&&(e="undefined"!=typeof document),this.instances=[],this.value={setHelmet:function setHelmet(t){r.context.helmet=t;},helmetInstances:{get:function get(){return r.canUseDOM?H$2:r.instances;},add:function add(t){(r.canUseDOM?H$2:r.instances).push(t);},remove:function remove(t){var e=(r.canUseDOM?H$2:r.instances).indexOf(t);(r.canUseDOM?H$2:r.instances).splice(e,1);}}},this.context=t,this.canUseDOM=e,e||(t.helmet=k$2({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}));},R$1=React$2.createContext({}),D$2=PropTypes.shape({setHelmet:PropTypes.func,helmetInstances:PropTypes.shape({get:PropTypes.func,add:PropTypes.func,remove:PropTypes.func})}),U$1="undefined"!=typeof document,q$2=function(e){function r(t){var n;return(n=e.call(this,t)||this).helmetData=new N$1(n.props.context,r.canUseDOM),n;}return s$1(r,e),r.prototype.render=function(){return React$2.createElement(R$1.Provider,{value:this.helmetData.value},this.props.children);},r;}(Component);q$2.canUseDOM=U$1,q$2.propTypes={context:PropTypes.shape({helmet:PropTypes.shape()}),children:PropTypes.node.isRequired},q$2.defaultProps={context:{}},q$2.displayName="HelmetProvider";var Y$1=function Y$1(t,e){var r,n=document.head||document.querySelector(l$2.HEAD),i=n.querySelectorAll(t+"[data-rh]"),o=[].slice.call(i),a=[];return e&&e.length&&e.forEach(function(e){var n=document.createElement(t);for(var i in e){Object.prototype.hasOwnProperty.call(e,i)&&("innerHTML"===i?n.innerHTML=e.innerHTML:"cssText"===i?n.styleSheet?n.styleSheet.cssText=e.cssText:n.appendChild(document.createTextNode(e.cssText)):n.setAttribute(i,void 0===e[i]?"":e[i]));}n.setAttribute("data-rh","true"),o.some(function(t,e){return r=e,n.isEqualNode(t);})?o.splice(r,1):a.push(n);}),o.forEach(function(t){return t.parentNode.removeChild(t);}),a.forEach(function(t){return n.appendChild(t);}),{oldTags:o,newTags:a};},B$2=function B$2(t,e){var r=document.getElementsByTagName(t)[0];if(r){for(var n=r.getAttribute("data-rh"),i=n?n.split(","):[],o=[].concat(i),a=Object.keys(e),s=0;s<a.length;s+=1){var c=a[s],u=e[c]||"";r.getAttribute(c)!==u&&r.setAttribute(c,u),-1===i.indexOf(c)&&i.push(c);var l=o.indexOf(c);-1!==l&&o.splice(l,1);}for(var p=o.length-1;p>=0;p-=1){r.removeAttribute(o[p]);}i.length===o.length?r.removeAttribute("data-rh"):r.getAttribute("data-rh")!==a.join(",")&&r.setAttribute("data-rh",a.join(","));}},K$1=function K$1(t,e){var r=t.baseTag,n=t.htmlAttributes,i=t.linkTags,o=t.metaTags,a=t.noscriptTags,s=t.onChangeClientState,c=t.scriptTags,u=t.styleTags,p=t.title,f=t.titleAttributes;B$2(l$2.BODY,t.bodyAttributes),B$2(l$2.HTML,n),function(t,e){void 0!==t&&document.title!==t&&(document.title=S$1(t)),B$2(l$2.TITLE,e);}(p,f);var d={baseTag:Y$1(l$2.BASE,r),linkTags:Y$1(l$2.LINK,i),metaTags:Y$1(l$2.META,o),noscriptTags:Y$1(l$2.NOSCRIPT,a),scriptTags:Y$1(l$2.SCRIPT,c),styleTags:Y$1(l$2.STYLE,u)},h={},m={};Object.keys(d).forEach(function(t){var e=d[t],r=e.newTags,n=e.oldTags;r.length&&(h[t]=r),n.length&&(m[t]=d[t].oldTags);}),e&&e(),s(t,h,m);},_$1=null,z$2=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++){n[i]=arguments[i];}return(e=t.call.apply(t,[this].concat(n))||this).rendered=!1,e;}s$1(e,t);var r=e.prototype;return r.shouldComponentUpdate=function(t){return!shallowequal(t,this.props);},r.componentDidUpdate=function(){this.emitChange();},r.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange();},r.emitChange=function(){var t,e,r=this.props.context,n=r.setHelmet,i=null,o=(t=r.helmetInstances.get().map(function(t){var e=a$1({},t.props);return delete e.context,e;}),{baseTag:A$2(["href"],t),bodyAttributes:v$2("bodyAttributes",t),defer:T$1(t,"defer"),encode:T$1(t,"encodeSpecialCharacters"),htmlAttributes:v$2("htmlAttributes",t),linkTags:C$2(l$2.LINK,["rel","href"],t),metaTags:C$2(l$2.META,["name","charset","http-equiv","property","itemprop"],t),noscriptTags:C$2(l$2.NOSCRIPT,["innerHTML"],t),onChangeClientState:b$2(t),scriptTags:C$2(l$2.SCRIPT,["src","innerHTML"],t),styleTags:C$2(l$2.STYLE,["cssText"],t),title:g$2(t),titleAttributes:v$2("titleAttributes",t),prioritizeSeoTags:O$1(t,"prioritizeSeoTags")});q$2.canUseDOM?(e=o,_$1&&cancelAnimationFrame(_$1),e.defer?_$1=requestAnimationFrame(function(){K$1(e,function(){_$1=null;});}):(K$1(e),_$1=null)):k$2&&(i=k$2(o)),n(i);},r.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange());},r.render=function(){return this.init(),null;},e;}(Component);z$2.propTypes={context:D$2.isRequired},z$2.displayName="HelmetDispatcher";var F$2=["children"],G$2=["children"],W$1=function(e){function r(){return e.apply(this,arguments)||this;}s$1(r,e);var o=r.prototype;return o.shouldComponentUpdate=function(t){return!reactFastCompare(I$2(this.props,"helmetData"),I$2(t,"helmetData"));},o.mapNestedChildrenToProps=function(t,e){if(!e)return null;switch(t.type){case l$2.SCRIPT:case l$2.NOSCRIPT:return{innerHTML:e};case l$2.STYLE:return{cssText:e};default:throw new Error("<"+t.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.");}},o.flattenArrayTypeChildren=function(t){var e,r=t.child,n=t.arrayTypeChildren;return a$1({},n,((e={})[r.type]=[].concat(n[r.type]||[],[a$1({},t.newChildProps,this.mapNestedChildrenToProps(r,t.nestedChildren))]),e));},o.mapObjectTypeChildren=function(t){var e,r,n=t.child,i=t.newProps,o=t.newChildProps,s=t.nestedChildren;switch(n.type){case l$2.TITLE:return a$1({},i,((e={})[n.type]=s,e.titleAttributes=a$1({},o),e));case l$2.BODY:return a$1({},i,{bodyAttributes:a$1({},o)});case l$2.HTML:return a$1({},i,{htmlAttributes:a$1({},o)});default:return a$1({},i,((r={})[n.type]=a$1({},o),r));}},o.mapArrayTypeChildrenToProps=function(t,e){var r=a$1({},e);return Object.keys(t).forEach(function(e){var n;r=a$1({},r,((n={})[e]=t[e],n));}),r;},o.warnOnInvalidChildren=function(t,e){return invariant_1(h$2.some(function(e){return t.type===e;}),"function"==typeof t.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+h$2.join(", ")+" are allowed. Helmet does not support rendering <"+t.type+"> elements. Refer to our API for more information."),invariant_1(!e||"string"==typeof e||Array.isArray(e)&&!e.some(function(t){return"string"!=typeof t;}),"Helmet expects a string as a child of <"+t.type+">. Did you forget to wrap your children in braces? ( <"+t.type+">{``}</"+t.type+"> ) Refer to our API for more information."),!0;},o.mapChildrenToProps=function(e,r){var n=this,i={};return React$2.Children.forEach(e,function(t){if(t&&t.props){var e=t.props,o=e.children,a=u$2(e,F$2),s=Object.keys(a).reduce(function(t,e){return t[y$2[e]||e]=a[e],t;},{}),c=t.type;switch("symbol"==_typeof2(c)?c=c.toString():n.warnOnInvalidChildren(t,o),c){case l$2.FRAGMENT:r=n.mapChildrenToProps(o,r);break;case l$2.LINK:case l$2.META:case l$2.NOSCRIPT:case l$2.SCRIPT:case l$2.STYLE:i=n.flattenArrayTypeChildren({child:t,arrayTypeChildren:i,newChildProps:s,nestedChildren:o});break;default:r=n.mapObjectTypeChildren({child:t,newProps:r,newChildProps:s,nestedChildren:o});}}}),this.mapArrayTypeChildrenToProps(i,r);},o.render=function(){var e=this.props,r=e.children,n=u$2(e,G$2),i=a$1({},n),o=n.helmetData;return r&&(i=this.mapChildrenToProps(r,i)),!o||o instanceof N$1||(o=new N$1(o.context,o.instances)),o?React$2.createElement(z$2,a$1({},i,{context:o.value,helmetData:void 0})):React$2.createElement(R$1.Consumer,null,function(e){return React$2.createElement(z$2,a$1({},i,{context:e}));});},r;}(Component);W$1.propTypes={base:PropTypes.object,bodyAttributes:PropTypes.object,children:PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node),PropTypes.node]),defaultTitle:PropTypes.string,defer:PropTypes.bool,encodeSpecialCharacters:PropTypes.bool,htmlAttributes:PropTypes.object,link:PropTypes.arrayOf(PropTypes.object),meta:PropTypes.arrayOf(PropTypes.object),noscript:PropTypes.arrayOf(PropTypes.object),onChangeClientState:PropTypes.func,script:PropTypes.arrayOf(PropTypes.object),style:PropTypes.arrayOf(PropTypes.object),title:PropTypes.string,titleAttributes:PropTypes.object,titleTemplate:PropTypes.string,prioritizeSeoTags:PropTypes.bool,helmetData:PropTypes.object},W$1.defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1},W$1.displayName="Helmet";var cjs$1={};Object.defineProperty(cjs$1,'__esModule',{value:true});/* eslint-disable no-undefined,no-param-reassign,no-shadow */ /**
247 * Throttle execution of a function. Especially useful for rate limiting
248 * execution of handlers on events like resize and scroll.
249 *
250 * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
251 * @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the
252 * throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time
253 * after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,
254 * the internal counter is reset).
255 * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
256 * to `callback` when the throttled-function is executed.
257 * @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),
258 * schedule `callback` to execute after `delay` ms.
259 *
260 * @returns {Function} A new, throttled, function.
261 */function throttle$1(delay,noTrailing,callback,debounceMode){/*
262 * After wrapper has stopped being called, this timeout ensures that
263 * `callback` is executed at the proper times in `throttle` and `end`
264 * debounce modes.
265 */var timeoutID;var cancelled=false;// Keep track of the last time `callback` was executed.
266var lastExec=0;// Function to clear existing timeout
267function clearExistingTimeout(){if(timeoutID){clearTimeout(timeoutID);}}// Function to cancel next exec
268function cancel(){clearExistingTimeout();cancelled=true;}// `noTrailing` defaults to falsy.
269if(typeof noTrailing!=='boolean'){debounceMode=callback;callback=noTrailing;noTrailing=undefined;}/*
270 * The `wrapper` function encapsulates all of the throttling / debouncing
271 * functionality and when executed will limit the rate at which `callback`
272 * is executed.
273 */function wrapper(){for(var _len=arguments.length,arguments_=new Array(_len),_key=0;_key<_len;_key++){arguments_[_key]=arguments[_key];}var self=this;var elapsed=Date.now()-lastExec;if(cancelled){return;}// Execute `callback` and update the `lastExec` timestamp.
274function exec(){lastExec=Date.now();callback.apply(self,arguments_);}/*
275 * If `debounceMode` is true (at begin) this is used to clear the flag
276 * to allow future `callback` executions.
277 */function clear(){timeoutID=undefined;}if(debounceMode&&!timeoutID){/*
278 * Since `wrapper` is being called for the first time and
279 * `debounceMode` is true (at begin), execute `callback`.
280 */exec();}clearExistingTimeout();if(debounceMode===undefined&&elapsed>delay){/*
281 * In throttle mode, if `delay` time has been exceeded, execute
282 * `callback`.
283 */exec();}else if(noTrailing!==true){/*
284 * In trailing throttle mode, since `delay` time has not been
285 * exceeded, schedule `callback` to execute `delay` ms after most
286 * recent execution.
287 *
288 * If `debounceMode` is true (at begin), schedule `clear` to execute
289 * after `delay` ms.
290 *
291 * If `debounceMode` is false (at end), schedule `callback` to
292 * execute after `delay` ms.
293 */timeoutID=setTimeout(debounceMode?clear:exec,debounceMode===undefined?delay-elapsed:delay);}}wrapper.cancel=cancel;// Return the wrapper function.
294return wrapper;}/* eslint-disable no-undefined */ /**
295 * Debounce execution of a function. Debouncing, unlike throttling,
296 * guarantees that a function is only executed a single time, either at the
297 * very beginning of a series of calls, or at the very end.
298 *
299 * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
300 * @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
301 * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
302 * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
303 * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
304 * to `callback` when the debounced-function is executed.
305 *
306 * @returns {Function} A new, debounced function.
307 */function debounce$3(delay,atBegin,callback){return callback===undefined?throttle$1(delay,atBegin,false):throttle$1(delay,callback,atBegin!==false);}cjs$1.debounce=debounce$3;cjs$1.throttle=throttle$1;var collectionUtils={exports:{}};var utils$3=collectionUtils.exports={};/**
308 * Loops through the collection and calls the callback for each element. if the callback returns truthy, the loop is broken and returns the same value.
309 * @public
310 * @param {*} collection The collection to loop through. Needs to have a length property set and have indices set from 0 to length - 1.
311 * @param {function} callback The callback to be called for each element. The element will be given as a parameter to the callback. If this callback returns truthy, the loop is broken and the same value is returned.
312 * @returns {*} The value that a callback has returned (if truthy). Otherwise nothing.
313 */utils$3.forEach=function(collection,callback){for(var i=0;i<collection.length;i++){var result=callback(collection[i]);if(result){return result;}}};var elementUtils=function elementUtils(options){var getState=options.stateHandler.getState;/**
314 * Tells if the element has been made detectable and ready to be listened for resize events.
315 * @public
316 * @param {element} The element to check.
317 * @returns {boolean} True or false depending on if the element is detectable or not.
318 */function isDetectable(element){var state=getState(element);return state&&!!state.isDetectable;}/**
319 * Marks the element that it has been made detectable and ready to be listened for resize events.
320 * @public
321 * @param {element} The element to mark.
322 */function markAsDetectable(element){getState(element).isDetectable=true;}/**
323 * Tells if the element is busy or not.
324 * @public
325 * @param {element} The element to check.
326 * @returns {boolean} True or false depending on if the element is busy or not.
327 */function isBusy(element){return!!getState(element).busy;}/**
328 * Marks the object is busy and should not be made detectable.
329 * @public
330 * @param {element} element The element to mark.
331 * @param {boolean} busy If the element is busy or not.
332 */function markBusy(element,busy){getState(element).busy=!!busy;}return{isDetectable:isDetectable,markAsDetectable:markAsDetectable,isBusy:isBusy,markBusy:markBusy};};var listenerHandler=function listenerHandler(idHandler){var eventListeners={};/**
333 * Gets all listeners for the given element.
334 * @public
335 * @param {element} element The element to get all listeners for.
336 * @returns All listeners for the given element.
337 */function getListeners(element){var id=idHandler.get(element);if(id===undefined){return[];}return eventListeners[id]||[];}/**
338 * Stores the given listener for the given element. Will not actually add the listener to the element.
339 * @public
340 * @param {element} element The element that should have the listener added.
341 * @param {function} listener The callback that the element has added.
342 */function addListener(element,listener){var id=idHandler.get(element);if(!eventListeners[id]){eventListeners[id]=[];}eventListeners[id].push(listener);}function removeListener(element,listener){var listeners=getListeners(element);for(var i=0,len=listeners.length;i<len;++i){if(listeners[i]===listener){listeners.splice(i,1);break;}}}function removeAllListeners(element){var listeners=getListeners(element);if(!listeners){return;}listeners.length=0;}return{get:getListeners,add:addListener,removeListener:removeListener,removeAllListeners:removeAllListeners};};var idGenerator=function idGenerator(){var idCount=1;/**
343 * Generates a new unique id in the context.
344 * @public
345 * @returns {number} A unique id in the context.
346 */function generate(){return idCount++;}return{generate:generate};};var idHandler=function idHandler(options){var idGenerator=options.idGenerator;var getState=options.stateHandler.getState;/**
347 * Gets the resize detector id of the element.
348 * @public
349 * @param {element} element The target element to get the id of.
350 * @returns {string|number|null} The id of the element. Null if it has no id.
351 */function getId(element){var state=getState(element);if(state&&state.id!==undefined){return state.id;}return null;}/**
352 * Sets the resize detector id of the element. Requires the element to have a resize detector state initialized.
353 * @public
354 * @param {element} element The target element to set the id of.
355 * @returns {string|number|null} The id of the element.
356 */function setId(element){var state=getState(element);if(!state){throw new Error("setId required the element to have a resize detection state.");}var id=idGenerator.generate();state.id=id;return id;}return{get:getId,set:setId};};/* global console: false */ /**
357 * Reporter that handles the reporting of logs, warnings and errors.
358 * @public
359 * @param {boolean} quiet Tells if the reporter should be quiet or not.
360 */var reporter=function reporter(quiet){function noop(){//Does nothing.
361}var reporter={log:noop,warn:noop,error:noop};if(!quiet&&window.console){var attachFunction=function attachFunction(reporter,name){//The proxy is needed to be able to call the method with the console context,
362//since we cannot use bind.
363reporter[name]=function reporterProxy(){var f=console[name];if(f.apply){//IE9 does not support console.log.apply :)
364f.apply(console,arguments);}else{for(var i=0;i<arguments.length;i++){f(arguments[i]);}}};};attachFunction(reporter,"log");attachFunction(reporter,"warn");attachFunction(reporter,"error");}return reporter;};var browserDetector$2={exports:{}};var detector=browserDetector$2.exports={};detector.isIE=function(version){function isAnyIeVersion(){var agent=navigator.userAgent.toLowerCase();return agent.indexOf("msie")!==-1||agent.indexOf("trident")!==-1||agent.indexOf(" edge/")!==-1;}if(!isAnyIeVersion()){return false;}if(!version){return true;}//Shamelessly stolen from https://gist.github.com/padolsey/527683
365var ieVersion=function(){var undef,v=3,div=document.createElement("div"),all=div.getElementsByTagName("i");do{div.innerHTML="<!--[if gt IE "+ ++v+"]><i></i><![endif]-->";}while(all[0]);return v>4?v:undef;}();return version===ieVersion;};detector.isLegacyOpera=function(){return!!window.opera;};var utils$2={exports:{}};var utils$1=utils$2.exports={};utils$1.getOption=getOption$1;function getOption$1(options,name,defaultValue){var value=options[name];if((value===undefined||value===null)&&defaultValue!==undefined){return defaultValue;}return value;}var utils=utils$2.exports;var batchProcessor=function batchProcessorMaker(options){options=options||{};var reporter=options.reporter;var asyncProcess=utils.getOption(options,"async",true);var autoProcess=utils.getOption(options,"auto",true);if(autoProcess&&!asyncProcess){reporter&&reporter.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true.");asyncProcess=true;}var batch=Batch();var asyncFrameHandler;var isProcessing=false;function addFunction(level,fn){if(!isProcessing&&autoProcess&&asyncProcess&&batch.size()===0){// Since this is async, it is guaranteed to be executed after that the fn is added to the batch.
366// This needs to be done before, since we're checking the size of the batch to be 0.
367processBatchAsync();}batch.add(level,fn);}function processBatch(){// Save the current batch, and create a new batch so that incoming functions are not added into the currently processing batch.
368// Continue processing until the top-level batch is empty (functions may be added to the new batch while processing, and so on).
369isProcessing=true;while(batch.size()){var processingBatch=batch;batch=Batch();processingBatch.process();}isProcessing=false;}function forceProcessBatch(localAsyncProcess){if(isProcessing){return;}if(localAsyncProcess===undefined){localAsyncProcess=asyncProcess;}if(asyncFrameHandler){cancelFrame(asyncFrameHandler);asyncFrameHandler=null;}if(localAsyncProcess){processBatchAsync();}else{processBatch();}}function processBatchAsync(){asyncFrameHandler=requestFrame(processBatch);}function cancelFrame(listener){// var cancel = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.clearTimeout;
370var cancel=clearTimeout;return cancel(listener);}function requestFrame(callback){// var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function(fn) { return window.setTimeout(fn, 20); };
371var raf=function raf(fn){return setTimeout(fn,0);};return raf(callback);}return{add:addFunction,force:forceProcessBatch};};function Batch(){var batch={};var size=0;var topLevel=0;var bottomLevel=0;function add(level,fn){if(!fn){fn=level;level=0;}if(level>topLevel){topLevel=level;}else if(level<bottomLevel){bottomLevel=level;}if(!batch[level]){batch[level]=[];}batch[level].push(fn);size++;}function process(){for(var level=bottomLevel;level<=topLevel;level++){var fns=batch[level];for(var i=0;i<fns.length;i++){var fn=fns[i];fn();}}}function getSize(){return size;}return{add:add,process:process,size:getSize};}var prop="_erd";function initState(element){element[prop]={};return getState$1(element);}function getState$1(element){return element[prop];}function cleanState(element){delete element[prop];}var stateHandler$1={initState:initState,getState:getState$1,cleanState:cleanState};/**
372 * Resize detection strategy that injects objects to elements in order to detect resize events.
373 * Heavily inspired by: http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/
374 */var browserDetector$1=browserDetector$2.exports;var object=function object(options){options=options||{};var reporter=options.reporter;var batchProcessor=options.batchProcessor;var getState=options.stateHandler.getState;if(!reporter){throw new Error("Missing required dependency: reporter.");}/**
375 * Adds a resize event listener to the element.
376 * @public
377 * @param {element} element The element that should have the listener added.
378 * @param {function} listener The listener callback to be called for each resize event of the element. The element will be given as a parameter to the listener callback.
379 */function addListener(element,listener){function listenerProxy(){listener(element);}if(browserDetector$1.isIE(8)){//IE 8 does not support object, but supports the resize event directly on elements.
380getState(element).object={proxy:listenerProxy};element.attachEvent("onresize",listenerProxy);}else{var object=getObject(element);if(!object){throw new Error("Element is not detectable by this strategy.");}object.contentDocument.defaultView.addEventListener("resize",listenerProxy);}}function buildCssTextString(rules){var seperator=options.important?" !important; ":"; ";return(rules.join(seperator)+seperator).trim();}/**
381 * Makes an element detectable and ready to be listened for resize events. Will call the callback when the element is ready to be listened for resize changes.
382 * @private
383 * @param {object} options Optional options object.
384 * @param {element} element The element to make detectable
385 * @param {function} callback The callback to be called when the element is ready to be listened for resize changes. Will be called with the element as first parameter.
386 */function makeDetectable(options,element,callback){if(!callback){callback=element;element=options;options=null;}options=options||{};options.debug;function injectObject(element,callback){var OBJECT_STYLE=buildCssTextString(["display: block","position: absolute","top: 0","left: 0","width: 100%","height: 100%","border: none","padding: 0","margin: 0","opacity: 0","z-index: -1000","pointer-events: none"]);//The target element needs to be positioned (everything except static) so the absolute positioned object will be positioned relative to the target element.
387// Position altering may be performed directly or on object load, depending on if style resolution is possible directly or not.
388var positionCheckPerformed=false;// The element may not yet be attached to the DOM, and therefore the style object may be empty in some browsers.
389// Since the style object is a reference, it will be updated as soon as the element is attached to the DOM.
390var style=window.getComputedStyle(element);var width=element.offsetWidth;var height=element.offsetHeight;getState(element).startSize={width:width,height:height};function mutateDom(){function alterPositionStyles(){if(style.position==="static"){element.style.setProperty("position","relative",options.important?"important":"");var removeRelativeStyles=function removeRelativeStyles(reporter,element,style,property){function getNumericalValue(value){return value.replace(/[^-\d\.]/g,"");}var value=style[property];if(value!=="auto"&&getNumericalValue(value)!=="0"){reporter.warn("An element that is positioned static has style."+property+"="+value+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+property+" will be set to 0. Element: ",element);element.style.setProperty(property,"0",options.important?"important":"");}};//Check so that there are no accidental styles that will make the element styled differently now that is is relative.
391//If there are any, set them to 0 (this should be okay with the user since the style properties did nothing before [since the element was positioned static] anyway).
392removeRelativeStyles(reporter,element,style,"top");removeRelativeStyles(reporter,element,style,"right");removeRelativeStyles(reporter,element,style,"bottom");removeRelativeStyles(reporter,element,style,"left");}}function onObjectLoad(){// The object has been loaded, which means that the element now is guaranteed to be attached to the DOM.
393if(!positionCheckPerformed){alterPositionStyles();}/*jshint validthis: true */function getDocument(element,callback){//Opera 12 seem to call the object.onload before the actual document has been created.
394//So if it is not present, poll it with an timeout until it is present.
395//TODO: Could maybe be handled better with object.onreadystatechange or similar.
396if(!element.contentDocument){var state=getState(element);if(state.checkForObjectDocumentTimeoutId){window.clearTimeout(state.checkForObjectDocumentTimeoutId);}state.checkForObjectDocumentTimeoutId=setTimeout(function checkForObjectDocument(){state.checkForObjectDocumentTimeoutId=0;getDocument(element,callback);},100);return;}callback(element.contentDocument);}//Mutating the object element here seems to fire another load event.
397//Mutating the inner document of the object element is fine though.
398var objectElement=this;//Create the style element to be added to the object.
399getDocument(objectElement,function onObjectDocumentReady(objectDocument){//Notify that the element is ready to be listened to.
400callback(element);});}// The element may be detached from the DOM, and some browsers does not support style resolving of detached elements.
401// The alterPositionStyles needs to be delayed until we know the element has been attached to the DOM (which we are sure of when the onObjectLoad has been fired), if style resolution is not possible.
402if(style.position!==""){alterPositionStyles();positionCheckPerformed=true;}//Add an object element as a child to the target element that will be listened to for resize events.
403var object=document.createElement("object");object.style.cssText=OBJECT_STYLE;object.tabIndex=-1;object.type="text/html";object.setAttribute("aria-hidden","true");object.onload=onObjectLoad;//Safari: This must occur before adding the object to the DOM.
404//IE: Does not like that this happens before, even if it is also added after.
405if(!browserDetector$1.isIE()){object.data="about:blank";}if(!getState(element)){// The element has been uninstalled before the actual loading happened.
406return;}element.appendChild(object);getState(element).object=object;//IE: This must occur after adding the object to the DOM.
407if(browserDetector$1.isIE()){object.data="about:blank";}}if(batchProcessor){batchProcessor.add(mutateDom);}else{mutateDom();}}if(browserDetector$1.isIE(8)){//IE 8 does not support objects properly. Luckily they do support the resize event.
408//So do not inject the object and notify that the element is already ready to be listened to.
409//The event handler for the resize event is attached in the utils.addListener instead.
410callback(element);}else{injectObject(element,callback);}}/**
411 * Returns the child object of the target element.
412 * @private
413 * @param {element} element The target element.
414 * @returns The object element of the target.
415 */function getObject(element){return getState(element).object;}function uninstall(element){if(!getState(element)){return;}var object=getObject(element);if(!object){return;}if(browserDetector$1.isIE(8)){element.detachEvent("onresize",object.proxy);}else{element.removeChild(object);}if(getState(element).checkForObjectDocumentTimeoutId){window.clearTimeout(getState(element).checkForObjectDocumentTimeoutId);}delete getState(element).object;}return{makeDetectable:makeDetectable,addListener:addListener,uninstall:uninstall};};/**
416 * Resize detection strategy that injects divs to elements in order to detect resize events on scroll events.
417 * Heavily inspired by: https://github.com/marcj/css-element-queries/blob/master/src/ResizeSensor.js
418 */var forEach$1=collectionUtils.exports.forEach;var scroll=function scroll(options){options=options||{};var reporter=options.reporter;var batchProcessor=options.batchProcessor;var getState=options.stateHandler.getState;options.stateHandler.hasState;var idHandler=options.idHandler;if(!batchProcessor){throw new Error("Missing required dependency: batchProcessor");}if(!reporter){throw new Error("Missing required dependency: reporter.");}//TODO: Could this perhaps be done at installation time?
419var scrollbarSizes=getScrollbarSizes();var styleId="erd_scroll_detection_scrollbar_style";var detectionContainerClass="erd_scroll_detection_container";function initDocument(targetDocument){// Inject the scrollbar styling that prevents them from appearing sometimes in Chrome.
420// The injected container needs to have a class, so that it may be styled with CSS (pseudo elements).
421injectScrollStyle(targetDocument,styleId,detectionContainerClass);}initDocument(window.document);function buildCssTextString(rules){var seperator=options.important?" !important; ":"; ";return(rules.join(seperator)+seperator).trim();}function getScrollbarSizes(){var width=500;var height=500;var child=document.createElement("div");child.style.cssText=buildCssTextString(["position: absolute","width: "+width*2+"px","height: "+height*2+"px","visibility: hidden","margin: 0","padding: 0"]);var container=document.createElement("div");container.style.cssText=buildCssTextString(["position: absolute","width: "+width+"px","height: "+height+"px","overflow: scroll","visibility: none","top: "+-width*3+"px","left: "+-height*3+"px","visibility: hidden","margin: 0","padding: 0"]);container.appendChild(child);document.body.insertBefore(container,document.body.firstChild);var widthSize=width-container.clientWidth;var heightSize=height-container.clientHeight;document.body.removeChild(container);return{width:widthSize,height:heightSize};}function injectScrollStyle(targetDocument,styleId,containerClass){function injectStyle(style,method){method=method||function(element){targetDocument.head.appendChild(element);};var styleElement=targetDocument.createElement("style");styleElement.innerHTML=style;styleElement.id=styleId;method(styleElement);return styleElement;}if(!targetDocument.getElementById(styleId)){var containerAnimationClass=containerClass+"_animation";var containerAnimationActiveClass=containerClass+"_animation_active";var style="/* Created by the element-resize-detector library. */\n";style+="."+containerClass+" > div::-webkit-scrollbar { "+buildCssTextString(["display: none"])+" }\n\n";style+="."+containerAnimationActiveClass+" { "+buildCssTextString(["-webkit-animation-duration: 0.1s","animation-duration: 0.1s","-webkit-animation-name: "+containerAnimationClass,"animation-name: "+containerAnimationClass])+" }\n";style+="@-webkit-keyframes "+containerAnimationClass+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }\n";style+="@keyframes "+containerAnimationClass+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }";injectStyle(style);}}function addAnimationClass(element){element.className+=" "+detectionContainerClass+"_animation_active";}function addEvent(el,name,cb){if(el.addEventListener){el.addEventListener(name,cb);}else if(el.attachEvent){el.attachEvent("on"+name,cb);}else{return reporter.error("[scroll] Don't know how to add event listeners.");}}function removeEvent(el,name,cb){if(el.removeEventListener){el.removeEventListener(name,cb);}else if(el.detachEvent){el.detachEvent("on"+name,cb);}else{return reporter.error("[scroll] Don't know how to remove event listeners.");}}function getExpandElement(element){return getState(element).container.childNodes[0].childNodes[0].childNodes[0];}function getShrinkElement(element){return getState(element).container.childNodes[0].childNodes[0].childNodes[1];}/**
422 * Adds a resize event listener to the element.
423 * @public
424 * @param {element} element The element that should have the listener added.
425 * @param {function} listener The listener callback to be called for each resize event of the element. The element will be given as a parameter to the listener callback.
426 */function addListener(element,listener){var listeners=getState(element).listeners;if(!listeners.push){throw new Error("Cannot add listener to an element that is not detectable.");}getState(element).listeners.push(listener);}/**
427 * Makes an element detectable and ready to be listened for resize events. Will call the callback when the element is ready to be listened for resize changes.
428 * @private
429 * @param {object} options Optional options object.
430 * @param {element} element The element to make detectable
431 * @param {function} callback The callback to be called when the element is ready to be listened for resize changes. Will be called with the element as first parameter.
432 */function makeDetectable(options,element,callback){if(!callback){callback=element;element=options;options=null;}options=options||{};function debug(){if(options.debug){var args=Array.prototype.slice.call(arguments);args.unshift(idHandler.get(element),"Scroll: ");if(reporter.log.apply){reporter.log.apply(null,args);}else{for(var i=0;i<args.length;i++){reporter.log(args[i]);}}}}function isDetached(element){function isInDocument(element){var isInShadowRoot=element.getRootNode&&element.getRootNode().contains(element);return element===element.ownerDocument.body||element.ownerDocument.body.contains(element)||isInShadowRoot;}if(!isInDocument(element)){return true;}// FireFox returns null style in hidden iframes. See https://github.com/wnr/element-resize-detector/issues/68 and https://bugzilla.mozilla.org/show_bug.cgi?id=795520
433if(window.getComputedStyle(element)===null){return true;}return false;}function isUnrendered(element){// Check the absolute positioned container since the top level container is display: inline.
434var container=getState(element).container.childNodes[0];var style=window.getComputedStyle(container);return!style.width||style.width.indexOf("px")===-1;//Can only compute pixel value when rendered.
435}function getStyle(){// Some browsers only force layouts when actually reading the style properties of the style object, so make sure that they are all read here,
436// so that the user of the function can be sure that it will perform the layout here, instead of later (important for batching).
437var elementStyle=window.getComputedStyle(element);var style={};style.position=elementStyle.position;style.width=element.offsetWidth;style.height=element.offsetHeight;style.top=elementStyle.top;style.right=elementStyle.right;style.bottom=elementStyle.bottom;style.left=elementStyle.left;style.widthCSS=elementStyle.width;style.heightCSS=elementStyle.height;return style;}function storeStartSize(){var style=getStyle();getState(element).startSize={width:style.width,height:style.height};debug("Element start size",getState(element).startSize);}function initListeners(){getState(element).listeners=[];}function storeStyle(){debug("storeStyle invoked.");if(!getState(element)){debug("Aborting because element has been uninstalled");return;}var style=getStyle();getState(element).style=style;}function storeCurrentSize(element,width,height){getState(element).lastWidth=width;getState(element).lastHeight=height;}function getExpandChildElement(element){return getExpandElement(element).childNodes[0];}function getWidthOffset(){return 2*scrollbarSizes.width+1;}function getHeightOffset(){return 2*scrollbarSizes.height+1;}function getExpandWidth(width){return width+10+getWidthOffset();}function getExpandHeight(height){return height+10+getHeightOffset();}function getShrinkWidth(width){return width*2+getWidthOffset();}function getShrinkHeight(height){return height*2+getHeightOffset();}function positionScrollbars(element,width,height){var expand=getExpandElement(element);var shrink=getShrinkElement(element);var expandWidth=getExpandWidth(width);var expandHeight=getExpandHeight(height);var shrinkWidth=getShrinkWidth(width);var shrinkHeight=getShrinkHeight(height);expand.scrollLeft=expandWidth;expand.scrollTop=expandHeight;shrink.scrollLeft=shrinkWidth;shrink.scrollTop=shrinkHeight;}function injectContainerElement(){var container=getState(element).container;if(!container){container=document.createElement("div");container.className=detectionContainerClass;container.style.cssText=buildCssTextString(["visibility: hidden","display: inline","width: 0px","height: 0px","z-index: -1","overflow: hidden","margin: 0","padding: 0"]);getState(element).container=container;addAnimationClass(container);element.appendChild(container);var onAnimationStart=function onAnimationStart(){getState(element).onRendered&&getState(element).onRendered();};addEvent(container,"animationstart",onAnimationStart);// Store the event handler here so that they may be removed when uninstall is called.
438// See uninstall function for an explanation why it is needed.
439getState(element).onAnimationStart=onAnimationStart;}return container;}function injectScrollElements(){function alterPositionStyles(){var style=getState(element).style;if(style.position==="static"){element.style.setProperty("position","relative",options.important?"important":"");var removeRelativeStyles=function removeRelativeStyles(reporter,element,style,property){function getNumericalValue(value){return value.replace(/[^-\d\.]/g,"");}var value=style[property];if(value!=="auto"&&getNumericalValue(value)!=="0"){reporter.warn("An element that is positioned static has style."+property+"="+value+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+property+" will be set to 0. Element: ",element);element.style[property]=0;}};//Check so that there are no accidental styles that will make the element styled differently now that is is relative.
440//If there are any, set them to 0 (this should be okay with the user since the style properties did nothing before [since the element was positioned static] anyway).
441removeRelativeStyles(reporter,element,style,"top");removeRelativeStyles(reporter,element,style,"right");removeRelativeStyles(reporter,element,style,"bottom");removeRelativeStyles(reporter,element,style,"left");}}function getLeftTopBottomRightCssText(left,top,bottom,right){left=!left?"0":left+"px";top=!top?"0":top+"px";bottom=!bottom?"0":bottom+"px";right=!right?"0":right+"px";return["left: "+left,"top: "+top,"right: "+right,"bottom: "+bottom];}debug("Injecting elements");if(!getState(element)){debug("Aborting because element has been uninstalled");return;}alterPositionStyles();var rootContainer=getState(element).container;if(!rootContainer){rootContainer=injectContainerElement();}// Due to this WebKit bug https://bugs.webkit.org/show_bug.cgi?id=80808 (currently fixed in Blink, but still present in WebKit browsers such as Safari),
442// we need to inject two containers, one that is width/height 100% and another that is left/top -1px so that the final container always is 1x1 pixels bigger than
443// the targeted element.
444// When the bug is resolved, "containerContainer" may be removed.
445// The outer container can occasionally be less wide than the targeted when inside inline elements element in WebKit (see https://bugs.webkit.org/show_bug.cgi?id=152980).
446// This should be no problem since the inner container either way makes sure the injected scroll elements are at least 1x1 px.
447var scrollbarWidth=scrollbarSizes.width;var scrollbarHeight=scrollbarSizes.height;var containerContainerStyle=buildCssTextString(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden","width: 100%","height: 100%","left: 0px","top: 0px"]);var containerStyle=buildCssTextString(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden"].concat(getLeftTopBottomRightCssText(-(1+scrollbarWidth),-(1+scrollbarHeight),-scrollbarHeight,-scrollbarWidth)));var expandStyle=buildCssTextString(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]);var shrinkStyle=buildCssTextString(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]);var expandChildStyle=buildCssTextString(["position: absolute","left: 0","top: 0"]);var shrinkChildStyle=buildCssTextString(["position: absolute","width: 200%","height: 200%"]);var containerContainer=document.createElement("div");var container=document.createElement("div");var expand=document.createElement("div");var expandChild=document.createElement("div");var shrink=document.createElement("div");var shrinkChild=document.createElement("div");// Some browsers choke on the resize system being rtl, so force it to ltr. https://github.com/wnr/element-resize-detector/issues/56
448// However, dir should not be set on the top level container as it alters the dimensions of the target element in some browsers.
449containerContainer.dir="ltr";containerContainer.style.cssText=containerContainerStyle;containerContainer.className=detectionContainerClass;container.className=detectionContainerClass;container.style.cssText=containerStyle;expand.style.cssText=expandStyle;expandChild.style.cssText=expandChildStyle;shrink.style.cssText=shrinkStyle;shrinkChild.style.cssText=shrinkChildStyle;expand.appendChild(expandChild);shrink.appendChild(shrinkChild);container.appendChild(expand);container.appendChild(shrink);containerContainer.appendChild(container);rootContainer.appendChild(containerContainer);function onExpandScroll(){var state=getState(element);if(state&&state.onExpand){state.onExpand();}else{debug("Aborting expand scroll handler: element has been uninstalled");}}function onShrinkScroll(){var state=getState(element);if(state&&state.onShrink){state.onShrink();}else{debug("Aborting shrink scroll handler: element has been uninstalled");}}addEvent(expand,"scroll",onExpandScroll);addEvent(shrink,"scroll",onShrinkScroll);// Store the event handlers here so that they may be removed when uninstall is called.
450// See uninstall function for an explanation why it is needed.
451getState(element).onExpandScroll=onExpandScroll;getState(element).onShrinkScroll=onShrinkScroll;}function registerListenersAndPositionElements(){function updateChildSizes(element,width,height){var expandChild=getExpandChildElement(element);var expandWidth=getExpandWidth(width);var expandHeight=getExpandHeight(height);expandChild.style.setProperty("width",expandWidth+"px",options.important?"important":"");expandChild.style.setProperty("height",expandHeight+"px",options.important?"important":"");}function updateDetectorElements(done){var width=element.offsetWidth;var height=element.offsetHeight;// Check whether the size has actually changed since last time the algorithm ran. If not, some steps may be skipped.
452var sizeChanged=width!==getState(element).lastWidth||height!==getState(element).lastHeight;debug("Storing current size",width,height);// Store the size of the element sync here, so that multiple scroll events may be ignored in the event listeners.
453// Otherwise the if-check in handleScroll is useless.
454storeCurrentSize(element,width,height);// Since we delay the processing of the batch, there is a risk that uninstall has been called before the batch gets to execute.
455// Since there is no way to cancel the fn executions, we need to add an uninstall guard to all fns of the batch.
456batchProcessor.add(0,function performUpdateChildSizes(){if(!sizeChanged){return;}if(!getState(element)){debug("Aborting because element has been uninstalled");return;}if(!areElementsInjected()){debug("Aborting because element container has not been initialized");return;}if(options.debug){var w=element.offsetWidth;var h=element.offsetHeight;if(w!==width||h!==height){reporter.warn(idHandler.get(element),"Scroll: Size changed before updating detector elements.");}}updateChildSizes(element,width,height);});batchProcessor.add(1,function updateScrollbars(){// This function needs to be invoked event though the size is unchanged. The element could have been resized very quickly and then
457// been restored to the original size, which will have changed the scrollbar positions.
458if(!getState(element)){debug("Aborting because element has been uninstalled");return;}if(!areElementsInjected()){debug("Aborting because element container has not been initialized");return;}positionScrollbars(element,width,height);});if(sizeChanged&&done){batchProcessor.add(2,function(){if(!getState(element)){debug("Aborting because element has been uninstalled");return;}if(!areElementsInjected()){debug("Aborting because element container has not been initialized");return;}done();});}}function areElementsInjected(){return!!getState(element).container;}function notifyListenersIfNeeded(){function isFirstNotify(){return getState(element).lastNotifiedWidth===undefined;}debug("notifyListenersIfNeeded invoked");var state=getState(element);// Don't notify if the current size is the start size, and this is the first notification.
459if(isFirstNotify()&&state.lastWidth===state.startSize.width&&state.lastHeight===state.startSize.height){return debug("Not notifying: Size is the same as the start size, and there has been no notification yet.");}// Don't notify if the size already has been notified.
460if(state.lastWidth===state.lastNotifiedWidth&&state.lastHeight===state.lastNotifiedHeight){return debug("Not notifying: Size already notified");}debug("Current size not notified, notifying...");state.lastNotifiedWidth=state.lastWidth;state.lastNotifiedHeight=state.lastHeight;forEach$1(getState(element).listeners,function(listener){listener(element);});}function handleRender(){debug("startanimation triggered.");if(isUnrendered(element)){debug("Ignoring since element is still unrendered...");return;}debug("Element rendered.");var expand=getExpandElement(element);var shrink=getShrinkElement(element);if(expand.scrollLeft===0||expand.scrollTop===0||shrink.scrollLeft===0||shrink.scrollTop===0){debug("Scrollbars out of sync. Updating detector elements...");updateDetectorElements(notifyListenersIfNeeded);}}function handleScroll(){debug("Scroll detected.");if(isUnrendered(element)){// Element is still unrendered. Skip this scroll event.
461debug("Scroll event fired while unrendered. Ignoring...");return;}updateDetectorElements(notifyListenersIfNeeded);}debug("registerListenersAndPositionElements invoked.");if(!getState(element)){debug("Aborting because element has been uninstalled");return;}getState(element).onRendered=handleRender;getState(element).onExpand=handleScroll;getState(element).onShrink=handleScroll;var style=getState(element).style;updateChildSizes(element,style.width,style.height);}function finalizeDomMutation(){debug("finalizeDomMutation invoked.");if(!getState(element)){debug("Aborting because element has been uninstalled");return;}var style=getState(element).style;storeCurrentSize(element,style.width,style.height);positionScrollbars(element,style.width,style.height);}function ready(){callback(element);}function install(){debug("Installing...");initListeners();storeStartSize();batchProcessor.add(0,storeStyle);batchProcessor.add(1,injectScrollElements);batchProcessor.add(2,registerListenersAndPositionElements);batchProcessor.add(3,finalizeDomMutation);batchProcessor.add(4,ready);}debug("Making detectable...");if(isDetached(element)){debug("Element is detached");injectContainerElement();debug("Waiting until element is attached...");getState(element).onRendered=function(){debug("Element is now attached");install();};}else{install();}}function uninstall(element){var state=getState(element);if(!state){// Uninstall has been called on a non-erd element.
462return;}// Uninstall may have been called in the following scenarios:
463// (1) Right between the sync code and async batch (here state.busy = true, but nothing have been registered or injected).
464// (2) In the ready callback of the last level of the batch by another element (here, state.busy = true, but all the stuff has been injected).
465// (3) After the installation process (here, state.busy = false and all the stuff has been injected).
466// So to be on the safe side, let's check for each thing before removing.
467// We need to remove the event listeners, because otherwise the event might fire on an uninstall element which results in an error when trying to get the state of the element.
468state.onExpandScroll&&removeEvent(getExpandElement(element),"scroll",state.onExpandScroll);state.onShrinkScroll&&removeEvent(getShrinkElement(element),"scroll",state.onShrinkScroll);state.onAnimationStart&&removeEvent(state.container,"animationstart",state.onAnimationStart);state.container&&element.removeChild(state.container);}return{makeDetectable:makeDetectable,addListener:addListener,uninstall:uninstall,initDocument:initDocument};};var forEach=collectionUtils.exports.forEach;var elementUtilsMaker=elementUtils;var listenerHandlerMaker=listenerHandler;var idGeneratorMaker=idGenerator;var idHandlerMaker=idHandler;var reporterMaker=reporter;var browserDetector=browserDetector$2.exports;var batchProcessorMaker=batchProcessor;var stateHandler=stateHandler$1;//Detection strategies.
469var objectStrategyMaker=object;var scrollStrategyMaker=scroll;function isCollection(obj){return Array.isArray(obj)||obj.length!==undefined;}function toArray(collection){if(!Array.isArray(collection)){var array=[];forEach(collection,function(obj){array.push(obj);});return array;}else{return collection;}}function isElement(obj){return obj&&obj.nodeType===1;}/**
470 * @typedef idHandler
471 * @type {object}
472 * @property {function} get Gets the resize detector id of the element.
473 * @property {function} set Generate and sets the resize detector id of the element.
474 */ /**
475 * @typedef Options
476 * @type {object}
477 * @property {boolean} callOnAdd Determines if listeners should be called when they are getting added.
478 Default is true. If true, the listener is guaranteed to be called when it has been added.
479 If false, the listener will not be guarenteed to be called when it has been added (does not prevent it from being called).
480 * @property {idHandler} idHandler A custom id handler that is responsible for generating, setting and retrieving id's for elements.
481 If not provided, a default id handler will be used.
482 * @property {reporter} reporter A custom reporter that handles reporting logs, warnings and errors.
483 If not provided, a default id handler will be used.
484 If set to false, then nothing will be reported.
485 * @property {boolean} debug If set to true, the the system will report debug messages as default for the listenTo method.
486 */ /**
487 * Creates an element resize detector instance.
488 * @public
489 * @param {Options?} options Optional global options object that will decide how this instance will work.
490 */var elementResizeDetector=function elementResizeDetector(options){options=options||{};//idHandler is currently not an option to the listenTo function, so it should not be added to globalOptions.
491var idHandler;if(options.idHandler){// To maintain compatability with idHandler.get(element, readonly), make sure to wrap the given idHandler
492// so that readonly flag always is true when it's used here. This may be removed next major version bump.
493idHandler={get:function get(element){return options.idHandler.get(element,true);},set:options.idHandler.set};}else{var idGenerator=idGeneratorMaker();var defaultIdHandler=idHandlerMaker({idGenerator:idGenerator,stateHandler:stateHandler});idHandler=defaultIdHandler;}//reporter is currently not an option to the listenTo function, so it should not be added to globalOptions.
494var reporter=options.reporter;if(!reporter){//If options.reporter is false, then the reporter should be quiet.
495var quiet=reporter===false;reporter=reporterMaker(quiet);}//batchProcessor is currently not an option to the listenTo function, so it should not be added to globalOptions.
496var batchProcessor=getOption(options,"batchProcessor",batchProcessorMaker({reporter:reporter}));//Options to be used as default for the listenTo function.
497var globalOptions={};globalOptions.callOnAdd=!!getOption(options,"callOnAdd",true);globalOptions.debug=!!getOption(options,"debug",false);var eventListenerHandler=listenerHandlerMaker(idHandler);var elementUtils=elementUtilsMaker({stateHandler:stateHandler});//The detection strategy to be used.
498var detectionStrategy;var desiredStrategy=getOption(options,"strategy","object");var importantCssRules=getOption(options,"important",false);var strategyOptions={reporter:reporter,batchProcessor:batchProcessor,stateHandler:stateHandler,idHandler:idHandler,important:importantCssRules};if(desiredStrategy==="scroll"){if(browserDetector.isLegacyOpera()){reporter.warn("Scroll strategy is not supported on legacy Opera. Changing to object strategy.");desiredStrategy="object";}else if(browserDetector.isIE(9)){reporter.warn("Scroll strategy is not supported on IE9. Changing to object strategy.");desiredStrategy="object";}}if(desiredStrategy==="scroll"){detectionStrategy=scrollStrategyMaker(strategyOptions);}else if(desiredStrategy==="object"){detectionStrategy=objectStrategyMaker(strategyOptions);}else{throw new Error("Invalid strategy name: "+desiredStrategy);}//Calls can be made to listenTo with elements that are still being installed.
499//Also, same elements can occur in the elements list in the listenTo function.
500//With this map, the ready callbacks can be synchronized between the calls
501//so that the ready callback can always be called when an element is ready - even if
502//it wasn't installed from the function itself.
503var onReadyCallbacks={};/**
504 * Makes the given elements resize-detectable and starts listening to resize events on the elements. Calls the event callback for each event for each element.
505 * @public
506 * @param {Options?} options Optional options object. These options will override the global options. Some options may not be overriden, such as idHandler.
507 * @param {element[]|element} elements The given array of elements to detect resize events of. Single element is also valid.
508 * @param {function} listener The callback to be executed for each resize event for each element.
509 */function listenTo(options,elements,listener){function onResizeCallback(element){var listeners=eventListenerHandler.get(element);forEach(listeners,function callListenerProxy(listener){listener(element);});}function addListener(callOnAdd,element,listener){eventListenerHandler.add(element,listener);if(callOnAdd){listener(element);}}//Options object may be omitted.
510if(!listener){listener=elements;elements=options;options={};}if(!elements){throw new Error("At least one element required.");}if(!listener){throw new Error("Listener required.");}if(isElement(elements)){// A single element has been passed in.
511elements=[elements];}else if(isCollection(elements)){// Convert collection to array for plugins.
512// TODO: May want to check so that all the elements in the collection are valid elements.
513elements=toArray(elements);}else{return reporter.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");}var elementsReady=0;var callOnAdd=getOption(options,"callOnAdd",globalOptions.callOnAdd);var onReadyCallback=getOption(options,"onReady",function noop(){});var debug=getOption(options,"debug",globalOptions.debug);forEach(elements,function attachListenerToElement(element){if(!stateHandler.getState(element)){stateHandler.initState(element);idHandler.set(element);}var id=idHandler.get(element);debug&&reporter.log("Attaching listener to element",id,element);if(!elementUtils.isDetectable(element)){debug&&reporter.log(id,"Not detectable.");if(elementUtils.isBusy(element)){debug&&reporter.log(id,"System busy making it detectable");//The element is being prepared to be detectable. Do not make it detectable.
514//Just add the listener, because the element will soon be detectable.
515addListener(callOnAdd,element,listener);onReadyCallbacks[id]=onReadyCallbacks[id]||[];onReadyCallbacks[id].push(function onReady(){elementsReady++;if(elementsReady===elements.length){onReadyCallback();}});return;}debug&&reporter.log(id,"Making detectable...");//The element is not prepared to be detectable, so do prepare it and add a listener to it.
516elementUtils.markBusy(element,true);return detectionStrategy.makeDetectable({debug:debug,important:importantCssRules},element,function onElementDetectable(element){debug&&reporter.log(id,"onElementDetectable");if(stateHandler.getState(element)){elementUtils.markAsDetectable(element);elementUtils.markBusy(element,false);detectionStrategy.addListener(element,onResizeCallback);addListener(callOnAdd,element,listener);// Since the element size might have changed since the call to "listenTo", we need to check for this change,
517// so that a resize event may be emitted.
518// Having the startSize object is optional (since it does not make sense in some cases such as unrendered elements), so check for its existance before.
519// Also, check the state existance before since the element may have been uninstalled in the installation process.
520var state=stateHandler.getState(element);if(state&&state.startSize){var width=element.offsetWidth;var height=element.offsetHeight;if(state.startSize.width!==width||state.startSize.height!==height){onResizeCallback(element);}}if(onReadyCallbacks[id]){forEach(onReadyCallbacks[id],function(callback){callback();});}}else{// The element has been unisntalled before being detectable.
521debug&&reporter.log(id,"Element uninstalled before being detectable.");}delete onReadyCallbacks[id];elementsReady++;if(elementsReady===elements.length){onReadyCallback();}});}debug&&reporter.log(id,"Already detecable, adding listener.");//The element has been prepared to be detectable and is ready to be listened to.
522addListener(callOnAdd,element,listener);elementsReady++;});if(elementsReady===elements.length){onReadyCallback();}}function uninstall(elements){if(!elements){return reporter.error("At least one element is required.");}if(isElement(elements)){// A single element has been passed in.
523elements=[elements];}else if(isCollection(elements)){// Convert collection to array for plugins.
524// TODO: May want to check so that all the elements in the collection are valid elements.
525elements=toArray(elements);}else{return reporter.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");}forEach(elements,function(element){eventListenerHandler.removeAllListeners(element);detectionStrategy.uninstall(element);stateHandler.cleanState(element);});}function initDocument(targetDocument){detectionStrategy.initDocument&&detectionStrategy.initDocument(targetDocument);}return{listenTo:listenTo,removeListener:eventListenerHandler.removeListener,removeAllListeners:eventListenerHandler.removeAllListeners,uninstall:uninstall,initDocument:initDocument};};function getOption(options,name,defaultValue){var value=options[name];if((value===undefined||value===null)&&defaultValue!==undefined){return defaultValue;}return value;}var React$1=React$2;var ReactDOM=require$$2;var invariant=invariant_1;var throttleDebounce=cjs$1;var createResizeDetector=elementResizeDetector;var isShallowEqual=shallowequal;function _interopDefaultLegacy(e){return e&&_typeof2(e)==='object'&&'default'in e?e:{'default':e};}var React__default=/*#__PURE__*/_interopDefaultLegacy(React$1);var ReactDOM__default=/*#__PURE__*/_interopDefaultLegacy(ReactDOM);var invariant__default=/*#__PURE__*/_interopDefaultLegacy(invariant);var createResizeDetector__default=/*#__PURE__*/_interopDefaultLegacy(createResizeDetector);var isShallowEqual__default=/*#__PURE__*/_interopDefaultLegacy(isShallowEqual);function ownKeys$1(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});}keys.push.apply(keys,symbols);}return keys;}function _objectSpread2(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys$1(Object(source),true).forEach(function(key){_defineProperty$2(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys$1(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}function _classCallCheck$1(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties$1(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$1(Constructor,protoProps,staticProps){if(protoProps)_defineProperties$1(Constructor.prototype,protoProps);if(staticProps)_defineProperties$1(Constructor,staticProps);return Constructor;}function _defineProperty$2(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _extends$2(){_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;};return _extends$2.apply(this,arguments);}function _inherits$1(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf$3(subClass,superClass);}function _getPrototypeOf$2(o){_getPrototypeOf$2=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf$2(o);}function _setPrototypeOf$3(o,p){_setPrototypeOf$3=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf$3(o,p);}function _isNativeReflectConstruct$2(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}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;}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose$1(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _assertThisInitialized$3(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _possibleConstructorReturn$1(self,call){if(call&&(_typeof2(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized$3(self);}function _createSuper$1(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct$2();return function _createSuperInternal(){var Super=_getPrototypeOf$2(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf$2(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn$1(this,result);};}var instances={};// Lazily require to not cause bug
526// https://github.com/ctrlplusb/react-sizeme/issues/6
527function resizeDetector(){var strategy=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'scroll';if(!instances[strategy]){instances[strategy]=createResizeDetector__default['default']({strategy:strategy});}return instances[strategy];}var _excluded$1=["explicitRef","className","style","size","disablePlaceholder","onSize"];var errMsg='react-sizeme: an error occurred whilst stopping to listen to node size changes';var defaultConfig={monitorWidth:true,monitorHeight:false,refreshRate:16,refreshMode:'throttle',noPlaceholder:false,resizeDetectorStrategy:'scroll'};function getDisplayName(WrappedComponent){return WrappedComponent.displayName||WrappedComponent.name||'Component';}/**
528 * This is a utility wrapper component that will allow our higher order
529 * component to get a ref handle on our wrapped components html.
530 * @see https://gist.github.com/jimfb/32b587ee6177665fb4cf
531 */var ReferenceWrapper=/*#__PURE__*/function(_Component){_inherits$1(ReferenceWrapper,_Component);var _super=_createSuper$1(ReferenceWrapper);function ReferenceWrapper(){_classCallCheck$1(this,ReferenceWrapper);return _super.apply(this,arguments);}_createClass$1(ReferenceWrapper,[{key:"render",value:function render(){return React$1.Children.only(this.props.children);}}]);return ReferenceWrapper;}(React$1.Component);_defineProperty$2(ReferenceWrapper,"displayName",'SizeMeReferenceWrapper');function Placeholder$1(_ref){var className=_ref.className,style=_ref.style;// Lets create the props for the temp element.
532var phProps={};// We will use any provided className/style or else make the temp
533// container take the full available space.
534if(!className&&!style){phProps.style={width:'100%',height:'100%'};}else{if(className){phProps.className=className;}if(style){phProps.style=style;}}return/*#__PURE__*/React__default['default'].createElement("div",phProps);}Placeholder$1.displayName='SizeMePlaceholder';/**
535 * As we need to maintain a ref on the root node that is rendered within our
536 * SizeMe component we need to wrap our entire render in a sub component.
537 * Without this, we lose the DOM ref after the placeholder is removed from
538 * the render and the actual component is rendered.
539 * It took me forever to figure this out, so tread extra careful on this one!
540 */var renderWrapper=function renderWrapper(WrappedComponent){function SizeMeRenderer(props){var explicitRef=props.explicitRef,className=props.className,style=props.style,size=props.size,disablePlaceholder=props.disablePlaceholder;props.onSize;var restProps=_objectWithoutProperties(props,_excluded$1);var noSizeData=size==null||size.width==null&&size.height==null;var renderPlaceholder=noSizeData&&!disablePlaceholder;var renderProps={className:className,style:style};if(size!=null){renderProps.size=size;}var toRender=renderPlaceholder?/*#__PURE__*/React__default['default'].createElement(Placeholder$1,{className:className,style:style}):/*#__PURE__*/React__default['default'].createElement(WrappedComponent,_extends$2({},renderProps,restProps));return/*#__PURE__*/React__default['default'].createElement(ReferenceWrapper,{ref:explicitRef},toRender);}SizeMeRenderer.displayName="SizeMeRenderer(".concat(getDisplayName(WrappedComponent),")");return SizeMeRenderer;};/**
541 * :: config -> Component -> WrappedComponent
542 *
543 * Higher order component that allows the wrapped component to become aware
544 * of it's size, by receiving it as an object within it's props.
545 *
546 * @param monitorWidth
547 * Default true, whether changes in the element's width should be monitored,
548 * causing a size property to be broadcast.
549 * @param monitorHeight
550 * Default false, whether changes in the element's height should be monitored,
551 * causing a size property to be broadcast.
552 *
553 * @return The wrapped component.
554 */function withSize(){var config=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultConfig;var _config$monitorWidth=config.monitorWidth,monitorWidth=_config$monitorWidth===void 0?defaultConfig.monitorWidth:_config$monitorWidth,_config$monitorHeight=config.monitorHeight,monitorHeight=_config$monitorHeight===void 0?defaultConfig.monitorHeight:_config$monitorHeight,_config$refreshRate=config.refreshRate,refreshRate=_config$refreshRate===void 0?defaultConfig.refreshRate:_config$refreshRate,_config$refreshMode=config.refreshMode,refreshMode=_config$refreshMode===void 0?defaultConfig.refreshMode:_config$refreshMode,_config$noPlaceholder=config.noPlaceholder,noPlaceholder=_config$noPlaceholder===void 0?defaultConfig.noPlaceholder:_config$noPlaceholder,_config$resizeDetecto=config.resizeDetectorStrategy,resizeDetectorStrategy=_config$resizeDetecto===void 0?defaultConfig.resizeDetectorStrategy:_config$resizeDetecto;invariant__default['default'](monitorWidth||monitorHeight,'You have to monitor at least one of the width or height when using "sizeMe"');invariant__default['default'](refreshRate>=16,"It is highly recommended that you don't put your refreshRate lower than "+'16 as this may cause layout thrashing.');invariant__default['default'](refreshMode==='throttle'||refreshMode==='debounce','The refreshMode should have a value of "throttle" or "debounce"');var refreshDelayStrategy=refreshMode==='throttle'?throttleDebounce.throttle:throttleDebounce.debounce;return function WrapComponent(WrappedComponent){var SizeMeRenderWrapper=renderWrapper(WrappedComponent);var SizeAwareComponent=/*#__PURE__*/function(_React$Component){_inherits$1(SizeAwareComponent,_React$Component);var _super2=_createSuper$1(SizeAwareComponent);function SizeAwareComponent(){var _this;_classCallCheck$1(this,SizeAwareComponent);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super2.call.apply(_super2,[this].concat(args));_defineProperty$2(_assertThisInitialized$3(_this),"domEl",null);_defineProperty$2(_assertThisInitialized$3(_this),"state",{width:undefined,height:undefined});_defineProperty$2(_assertThisInitialized$3(_this),"uninstall",function(){if(_this.domEl){try{_this.detector.uninstall(_this.domEl);}catch(err){// eslint-disable-next-line no-console
555console.warn(errMsg);}_this.domEl=null;}});_defineProperty$2(_assertThisInitialized$3(_this),"determineStrategy",function(props){if(props.onSize){if(!_this.callbackState){_this.callbackState=_objectSpread2({},_this.state);}_this.strategy='callback';}else{_this.strategy='render';}});_defineProperty$2(_assertThisInitialized$3(_this),"strategisedSetState",function(state){if(_this.strategy==='callback'){_this.callbackState=state;_this.props.onSize(state);}_this.setState(state);});_defineProperty$2(_assertThisInitialized$3(_this),"strategisedGetState",function(){return _this.strategy==='callback'?_this.callbackState:_this.state;});_defineProperty$2(_assertThisInitialized$3(_this),"refCallback",function(element){_this.element=element;});_defineProperty$2(_assertThisInitialized$3(_this),"hasSizeChanged",function(current,next){var c=current;var n=next;return monitorWidth&&c.width!==n.width||monitorHeight&&c.height!==n.height;});_defineProperty$2(_assertThisInitialized$3(_this),"checkIfSizeChanged",refreshDelayStrategy(refreshRate,function(el){var _el$getBoundingClient=el.getBoundingClientRect(),width=_el$getBoundingClient.width,height=_el$getBoundingClient.height;var next={width:monitorWidth?width:null,height:monitorHeight?height:null};if(_this.hasSizeChanged(_this.strategisedGetState(),next)){_this.strategisedSetState(next);}}));return _this;}_createClass$1(SizeAwareComponent,[{key:"componentDidMount",value:function componentDidMount(){this.detector=resizeDetector(resizeDetectorStrategy);this.determineStrategy(this.props);this.handleDOMNode();}},{key:"componentDidUpdate",value:function componentDidUpdate(){this.determineStrategy(this.props);this.handleDOMNode();}},{key:"componentWillUnmount",value:function componentWillUnmount(){// Change our size checker to a noop just in case we have some
556// late running events.
557this.hasSizeChanged=function(){return undefined;};this.checkIfSizeChanged=function(){return undefined;};this.uninstall();}},{key:"handleDOMNode",value:function handleDOMNode(){var found=this.element&&ReactDOM__default['default'].findDOMNode(this.element);if(!found){// If we previously had a dom node then we need to ensure that
558// we remove any existing listeners to avoid memory leaks.
559this.uninstall();return;}if(!this.domEl){this.domEl=found;this.detector.listenTo(this.domEl,this.checkIfSizeChanged);}else if(this.domEl.isSameNode&&!this.domEl.isSameNode(found)||this.domEl!==found){this.uninstall();this.domEl=found;this.detector.listenTo(this.domEl,this.checkIfSizeChanged);}else;}},{key:"render",value:function render(){var disablePlaceholder=withSize.enableSSRBehaviour||withSize.noPlaceholders||noPlaceholder||this.strategy==='callback';var size=_objectSpread2({},this.state);return/*#__PURE__*/React__default['default'].createElement(SizeMeRenderWrapper,_extends$2({explicitRef:this.refCallback,size:this.strategy==='callback'?null:size,disablePlaceholder:disablePlaceholder},this.props));}}]);return SizeAwareComponent;}(React__default['default'].Component);_defineProperty$2(SizeAwareComponent,"displayName","SizeMe(".concat(getDisplayName(WrappedComponent),")"));SizeAwareComponent.WrappedComponent=WrappedComponent;return SizeAwareComponent;};}/**
560 * Allow SizeMe to run within SSR environments. This is a "global" behaviour
561 * flag that should be set within the initialisation phase of your application.
562 *
563 * Warning: don't set this flag unless you need to as using it may cause
564 * extra render cycles to happen within your components depending on the logic
565 * contained within them around the usage of the `size` data.
566 *
567 * DEPRECATED: Please use the global noPlaceholders
568 */withSize.enableSSRBehaviour=false;/**
569 * Global configuration allowing to disable placeholder rendering for all
570 * sizeMe components.
571 */withSize.noPlaceholders=false;var _excluded=["children","render"],_excluded2=["children","render"],_excluded3=["children","render"];var SizeMe=/*#__PURE__*/function(_Component){_inherits$1(SizeMe,_Component);var _super=_createSuper$1(SizeMe);function SizeMe(props){var _this;_classCallCheck$1(this,SizeMe);_this=_super.call(this,props);_defineProperty$2(_assertThisInitialized$3(_this),"createComponent",function(config){_this.SizeAware=withSize(config)(function(_ref){var children=_ref.children;return children;});});_defineProperty$2(_assertThisInitialized$3(_this),"onSize",function(size){return _this.setState({size:size});});props.children;props.render;var sizeMeConfig=_objectWithoutProperties(props,_excluded);_this.createComponent(sizeMeConfig);_this.state={size:{width:undefined,height:undefined}};return _this;}_createClass$1(SizeMe,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){var _this$props=this.props;_this$props.children;_this$props.render;var currentSizeMeConfig=_objectWithoutProperties(_this$props,_excluded2);prevProps.children;prevProps.render;var prevSizeMeConfig=_objectWithoutProperties(prevProps,_excluded3);if(!isShallowEqual__default['default'](currentSizeMeConfig,prevSizeMeConfig)){this.createComponent(currentSizeMeConfig);}}},{key:"render",value:function render(){var SizeAware=this.SizeAware;var render=this.props.children||this.props.render;return/*#__PURE__*/React__default['default'].createElement(SizeAware,{onSize:this.onSize},render({size:this.state.size}));}}]);return SizeMe;}(React$1.Component);_defineProperty$2(SizeMe,"defaultProps",{children:undefined,render:undefined});withSize.SizeMe=SizeMe;withSize.withSize=withSize;var reactSizeme=withSize;var Root$2=styled.div({position:'fixed',left:0,top:0,width:'100vw',height:'100vh',overflow:'hidden'});var SIDEBAR=ActiveTabs.SIDEBAR,CANVAS=ActiveTabs.CANVAS,ADDONS=ActiveTabs.ADDONS;var Pane$1=styled.div({transition:'transform .2s ease',position:'absolute',top:0,height:'100%',overflow:'auto'},function(_ref14){var theme=_ref14.theme;return{background:theme.background.content,'&:nth-of-type(1)':{borderRight:"1px solid ".concat(theme.appBorderColor)},'&:nth-of-type(3)':{borderLeft:"1px solid ".concat(theme.appBorderColor)}};},function(_ref15){var index=_ref15.index;switch(index){case 0:{return{width:'80vw',transform:'translateX(-80vw)',left:0};}case 1:{return{width:'100%',transform:'translateX(0) scale(1)',left:0};}case 2:{return{width:'80vw',transform:'translateX(80vw)',right:0};}default:{return{};}}},function(_ref16){var active=_ref16.active,index=_ref16.index;switch(true){case index===0&&active===SIDEBAR:{return{transform:'translateX(-0px)'};}case index===1&&active===SIDEBAR:{return{transform:'translateX(40vw) translateY(-42.5vh) translateY(40px) scale(0.2)'};}case index===1&&active===ADDONS:{return{transform:'translateX(-40vw) translateY(-42.5vh) translateY(40px) scale(0.2)'};}case index===2&&active===ADDONS:{return{transform:'translateX(0px)'};}default:{return{};}}});var Panels=React$2.memo(function(_ref17){var children=_ref17.children,active=_ref17.active,isFullscreen=_ref17.isFullscreen;return React$2.createElement(PanelsContainer,{isFullscreen:isFullscreen},Children.toArray(children).map(function(item,index){return(// eslint-disable-next-line react/no-array-index-key
572React$2.createElement(Pane$1,{key:index,index:index,active:active},item));}));});Panels.displayName='Panels';var PanelsContainer=styled.div({position:'fixed',top:0,left:0,width:'100vw'},function(_ref18){var isFullscreen=_ref18.isFullscreen;return{height:isFullscreen?'100vh':'calc(100% - 40px)'};});var Bar$1=styled.nav({position:'fixed',bottom:0,left:0,width:'100vw',height:40,display:'flex',boxShadow:'0 1px 5px 0 rgba(0, 0, 0, 0.1)','& > *':{flex:1}},function(_ref19){var theme=_ref19.theme;return{background:theme.barBg};});var Mobile=/*#__PURE__*/function(_Component2){_inherits2(Mobile,_Component2);var _super3=_createSuper2(Mobile);function Mobile(props){var _this8;_classCallCheck2(this,Mobile);_this8=_super3.call(this,props);var options=props.options;_this8.state={active:options.isFullscreen?CANVAS:options.initialActive||SIDEBAR};return _this8;}_createClass2(Mobile,[{key:"render",value:function render(){var _this9=this;var _this$props3=this.props,Sidebar=_this$props3.Sidebar,Preview=_this$props3.Preview,Panel=_this$props3.Panel,Notifications=_this$props3.Notifications,pages=_this$props3.pages,viewMode=_this$props3.viewMode,options=_this$props3.options,docsOnly=_this$props3.docsOnly;var active=this.state.active;return React$2.createElement(Root$2,null,React$2.createElement(Notifications,{placement:{position:'fixed',bottom:60,left:20,right:20}}),React$2.createElement(Panels,{active:active,isFullscreen:options.isFullscreen},React$2.createElement(Sidebar,null),React$2.createElement("div",null,React$2.createElement("div",{hidden:!viewMode},React$2.createElement(Preview,{showToolbar:options.showToolbar,id:"main",viewMode:viewMode})),pages.map(function(_ref20){var key=_ref20.key,Route=_ref20.route,Content=_ref20.render;return React$2.createElement(Route,{key:key},React$2.createElement(Content,null));})),React$2.createElement(Panel,{hidden:!viewMode})),!options.isFullscreen&&React$2.createElement(Bar$1,null,React$2.createElement(TabButton,{onClick:function onClick(){return _this9.setState({active:SIDEBAR});},active:active===SIDEBAR},"Sidebar"),React$2.createElement(TabButton,{onClick:function onClick(){return _this9.setState({active:CANVAS});},active:active===CANVAS},viewMode?'Canvas':null,pages.map(function(_ref21){var key=_ref21.key,Route=_ref21.route;return React$2.createElement(Route,{key:key},key);})),viewMode&&!docsOnly?React$2.createElement(TabButton,{onClick:function onClick(){return _this9.setState({active:ADDONS});},active:active===ADDONS},"Addons"):null));}}]);return Mobile;}(Component);/*! *****************************************************************************
573Copyright (c) Microsoft Corporation.
574
575Permission to use, copy, modify, and/or distribute this software for any
576purpose with or without fee is hereby granted.
577
578THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
579REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
580AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
581INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
582LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
583OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
584PERFORMANCE OF THIS SOFTWARE.
585***************************************************************************** */var _assign=function __assign(){_assign=Object.assign||function __assign(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s){if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p];}}return t;};return _assign.apply(this,arguments);};function __rest(s,e){var t={};for(var p in s){if(Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0)t[p]=s[p];}if(s!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++){if(e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i]))t[p[i]]=s[p[i]];}return t;}function __awaiter(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value);});}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value));}catch(e){reject(e);}}function rejected(value){try{step(generator["throw"](value));}catch(e){reject(e);}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected);}step((generator=generator.apply(thisArg,_arguments||[])).next());});}var store2={exports:{}};/*! store2 - v2.13.1 - 2021-12-20
586* Copyright (c) 2021 Nathan Bubna; Licensed (MIT OR GPL-3.0) */(function(module){(function(window,define){var _={version:"2.13.1",areas:{},apis:{},// utilities
587inherit:function inherit(api,o){for(var p in api){if(!o.hasOwnProperty(p)){Object.defineProperty(o,p,Object.getOwnPropertyDescriptor(api,p));}}return o;},stringify:function stringify(d,fn){return d===undefined||typeof d==="function"?d+'':JSON.stringify(d,fn||_.replace);},parse:function parse(s,fn){// if it doesn't parse, return as is
588try{return JSON.parse(s,fn||_.revive);}catch(e){return s;}},// extension hooks
589fn:function fn(name,_fn){_.storeAPI[name]=_fn;for(var api in _.apis){_.apis[api][name]=_fn;}},get:function get(area,key){return area.getItem(key);},set:function set(area,key,string){area.setItem(key,string);},remove:function remove(area,key){area.removeItem(key);},key:function key(area,i){return area.key(i);},length:function length(area){return area.length;},clear:function clear(area){area.clear();},// core functions
590Store:function Store(id,area,namespace){var store=_.inherit(_.storeAPI,function(key,data,overwrite){if(arguments.length===0){return store.getAll();}if(typeof data==="function"){return store.transact(key,data,overwrite);}// fn=data, alt=overwrite
591if(data!==undefined){return store.set(key,data,overwrite);}if(typeof key==="string"||typeof key==="number"){return store.get(key);}if(typeof key==="function"){return store.each(key);}if(!key){return store.clear();}return store.setAll(key,data);// overwrite=data, data=key
592});store._id=id;try{var testKey='__store2_test';area.setItem(testKey,'ok');store._area=area;area.removeItem(testKey);}catch(e){store._area=_.storage('fake');}store._ns=namespace||'';if(!_.areas[id]){_.areas[id]=store._area;}if(!_.apis[store._ns+store._id]){_.apis[store._ns+store._id]=store;}return store;},storeAPI:{// admin functions
593area:function area(id,_area){var store=this[id];if(!store||!store.area){store=_.Store(id,_area,this._ns);//new area-specific api in this namespace
594if(!this[id]){this[id]=store;}}return store;},namespace:function namespace(_namespace,singleArea){if(!_namespace){return this._ns?this._ns.substring(0,this._ns.length-1):'';}var ns=_namespace,store=this[ns];if(!store||!store.namespace){store=_.Store(this._id,this._area,this._ns+ns+'.');//new namespaced api
595if(!this[ns]){this[ns]=store;}if(!singleArea){for(var name in _.areas){store.area(name,_.areas[name]);}}}return store;},isFake:function isFake(force){if(force){this._real=this._area;this._area=_.storage('fake');}else if(force===false){this._area=this._real||this._area;}return this._area.name==='fake';},toString:function toString(){return'store'+(this._ns?'.'+this.namespace():'')+'['+this._id+']';},// storage functions
596has:function has(key){if(this._area.has){return this._area.has(this._in(key));//extension hook
597}return!!(this._in(key)in this._area);},size:function size(){return this.keys().length;},each:function each(fn,fill){// fill is used by keys(fillList) and getAll(fillList))
598for(var i=0,m=_.length(this._area);i<m;i++){var key=this._out(_.key(this._area,i));if(key!==undefined){if(fn.call(this,key,this.get(key),fill)===false){break;}}if(m>_.length(this._area)){m--;i--;}// in case of removeItem
599}return fill||this;},keys:function keys(fillList){return this.each(function(k,v,list){list.push(k);},fillList||[]);},get:function get(key,alt){var s=_.get(this._area,this._in(key)),fn;if(typeof alt==="function"){fn=alt;alt=null;}return s!==null?_.parse(s,fn):alt!=null?alt:s;},getAll:function getAll(fillObj){return this.each(function(k,v,all){all[k]=v;},fillObj||{});},transact:function transact(key,fn,alt){var val=this.get(key,alt),ret=fn(val);this.set(key,ret===undefined?val:ret);return this;},set:function set(key,data,overwrite){var d=this.get(key),replacer;if(d!=null&&overwrite===false){return data;}if(typeof overwrite!=="boolean"){replacer=overwrite;}return _.set(this._area,this._in(key),_.stringify(data,replacer))||d;},setAll:function setAll(data,overwrite){var changed,val;for(var key in data){val=data[key];if(this.set(key,val,overwrite)!==val){changed=true;}}return changed;},add:function add(key,data,replacer){var d=this.get(key);if(d instanceof Array){data=d.concat(data);}else if(d!==null){var type=_typeof2(d);if(type===_typeof2(data)&&type==='object'){for(var k in data){d[k]=data[k];}data=d;}else{data=d+data;}}_.set(this._area,this._in(key),_.stringify(data,replacer));return data;},remove:function remove(key,alt){var d=this.get(key,alt);_.remove(this._area,this._in(key));return d;},clear:function clear(){if(!this._ns){_.clear(this._area);}else{this.each(function(k){_.remove(this._area,this._in(k));},1);}return this;},clearAll:function clearAll(){var area=this._area;for(var id in _.areas){if(_.areas.hasOwnProperty(id)){this._area=_.areas[id];this.clear();}}this._area=area;return this;},// internal use functions
600_in:function _in(k){if(typeof k!=="string"){k=_.stringify(k);}return this._ns?this._ns+k:k;},_out:function _out(k){return this._ns?k&&k.indexOf(this._ns)===0?k.substring(this._ns.length):undefined:// so each() knows to skip it
601k;}},// end _.storeAPI
602storage:function storage(name){return _.inherit(_.storageAPI,{items:{},name:name});},storageAPI:{length:0,has:function has(k){return this.items.hasOwnProperty(k);},key:function key(i){var c=0;for(var k in this.items){if(this.has(k)&&i===c++){return k;}}},setItem:function setItem(k,v){if(!this.has(k)){this.length++;}this.items[k]=v;},removeItem:function removeItem(k){if(this.has(k)){delete this.items[k];this.length--;}},getItem:function getItem(k){return this.has(k)?this.items[k]:null;},clear:function clear(){for(var k in this.items){this.removeItem(k);}}}// end _.storageAPI
603};var store=// safely set this up (throws error in IE10/32bit mode for local files)
604_.Store("local",function(){try{return localStorage;}catch(e){}}());store.local=store;// for completeness
605store._=_;// for extenders and debuggers...
606// safely setup store.session (throws exception in FF for file:/// urls)
607store.area("session",function(){try{return sessionStorage;}catch(e){}}());store.area("page",_.storage("page"));if(typeof define==='function'&&define.amd!==undefined){define('store2',[],function(){return store;});}else if(module.exports){module.exports=store;}else{// expose the primary store fn to the global object and save conflicts
608if(window.store){_.conflict=window.store;}window.store=store;}})(commonjsGlobal,commonjsGlobal&&commonjsGlobal.define);})(store2);var store=store2.exports;/**
609 * Checks if `value` is the
610 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
611 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
612 *
613 * @static
614 * @memberOf _
615 * @since 0.1.0
616 * @category Lang
617 * @param {*} value The value to check.
618 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
619 * @example
620 *
621 * _.isObject({});
622 * // => true
623 *
624 * _.isObject([1, 2, 3]);
625 * // => true
626 *
627 * _.isObject(_.noop);
628 * // => true
629 *
630 * _.isObject(null);
631 * // => false
632 */function isObject$3(value){var type=_typeof2(value);return value!=null&&(type=='object'||type=='function');}var isObject_1=isObject$3;/** Detect free variable `global` from Node.js. */var freeGlobal$1=_typeof2(commonjsGlobal)=='object'&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal;var _freeGlobal=freeGlobal$1;var freeGlobal=_freeGlobal;/** Detect free variable `self`. */var freeSelf=(typeof self==="undefined"?"undefined":_typeof2(self))=='object'&&self&&self.Object===Object&&self;/** Used as a reference to the global object. */var root$2=freeGlobal||freeSelf||Function('return this')();var _root=root$2;var root$1=_root;/**
633 * Gets the timestamp of the number of milliseconds that have elapsed since
634 * the Unix epoch (1 January 1970 00:00:00 UTC).
635 *
636 * @static
637 * @memberOf _
638 * @since 2.4.0
639 * @category Date
640 * @returns {number} Returns the timestamp.
641 * @example
642 *
643 * _.defer(function(stamp) {
644 * console.log(_.now() - stamp);
645 * }, _.now());
646 * // => Logs the number of milliseconds it took for the deferred invocation.
647 */var now$1=function now$1(){return root$1.Date.now();};var now_1=now$1;/** Used to match a single whitespace character. */var reWhitespace=/\s/;/**
648 * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
649 * character of `string`.
650 *
651 * @private
652 * @param {string} string The string to inspect.
653 * @returns {number} Returns the index of the last non-whitespace character.
654 */function trimmedEndIndex$1(string){var index=string.length;while(index--&&reWhitespace.test(string.charAt(index))){}return index;}var _trimmedEndIndex=trimmedEndIndex$1;var trimmedEndIndex=_trimmedEndIndex;/** Used to match leading whitespace. */var reTrimStart=/^\s+/;/**
655 * The base implementation of `_.trim`.
656 *
657 * @private
658 * @param {string} string The string to trim.
659 * @returns {string} Returns the trimmed string.
660 */function baseTrim$1(string){return string?string.slice(0,trimmedEndIndex(string)+1).replace(reTrimStart,''):string;}var _baseTrim=baseTrim$1;var root=_root;/** Built-in value references. */var Symbol$3=root.Symbol;var _Symbol=Symbol$3;var Symbol$2=_Symbol;/** Used for built-in method references. */var objectProto$1=Object.prototype;/** Used to check objects for own properties. */var hasOwnProperty=objectProto$1.hasOwnProperty;/**
661 * Used to resolve the
662 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
663 * of values.
664 */var nativeObjectToString$1=objectProto$1.toString;/** Built-in value references. */var symToStringTag$1=Symbol$2?Symbol$2.toStringTag:undefined;/**
665 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
666 *
667 * @private
668 * @param {*} value The value to query.
669 * @returns {string} Returns the raw `toStringTag`.
670 */function getRawTag$1(value){var isOwn=hasOwnProperty.call(value,symToStringTag$1),tag=value[symToStringTag$1];try{value[symToStringTag$1]=undefined;var unmasked=true;}catch(e){}var result=nativeObjectToString$1.call(value);if(unmasked){if(isOwn){value[symToStringTag$1]=tag;}else{delete value[symToStringTag$1];}}return result;}var _getRawTag=getRawTag$1;/** Used for built-in method references. */var objectProto=Object.prototype;/**
671 * Used to resolve the
672 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
673 * of values.
674 */var nativeObjectToString=objectProto.toString;/**
675 * Converts `value` to a string using `Object.prototype.toString`.
676 *
677 * @private
678 * @param {*} value The value to convert.
679 * @returns {string} Returns the converted string.
680 */function objectToString$1(value){return nativeObjectToString.call(value);}var _objectToString=objectToString$1;var Symbol$1=_Symbol,getRawTag=_getRawTag,objectToString=_objectToString;/** `Object#toString` result references. */var nullTag='[object Null]',undefinedTag='[object Undefined]';/** Built-in value references. */var symToStringTag=Symbol$1?Symbol$1.toStringTag:undefined;/**
681 * The base implementation of `getTag` without fallbacks for buggy environments.
682 *
683 * @private
684 * @param {*} value The value to query.
685 * @returns {string} Returns the `toStringTag`.
686 */function baseGetTag$1(value){if(value==null){return value===undefined?undefinedTag:nullTag;}return symToStringTag&&symToStringTag in Object(value)?getRawTag(value):objectToString(value);}var _baseGetTag=baseGetTag$1;/**
687 * Checks if `value` is object-like. A value is object-like if it's not `null`
688 * and has a `typeof` result of "object".
689 *
690 * @static
691 * @memberOf _
692 * @since 4.0.0
693 * @category Lang
694 * @param {*} value The value to check.
695 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
696 * @example
697 *
698 * _.isObjectLike({});
699 * // => true
700 *
701 * _.isObjectLike([1, 2, 3]);
702 * // => true
703 *
704 * _.isObjectLike(_.noop);
705 * // => false
706 *
707 * _.isObjectLike(null);
708 * // => false
709 */function isObjectLike$1(value){return value!=null&&_typeof2(value)=='object';}var isObjectLike_1=isObjectLike$1;var baseGetTag=_baseGetTag,isObjectLike=isObjectLike_1;/** `Object#toString` result references. */var symbolTag='[object Symbol]';/**
710 * Checks if `value` is classified as a `Symbol` primitive or object.
711 *
712 * @static
713 * @memberOf _
714 * @since 4.0.0
715 * @category Lang
716 * @param {*} value The value to check.
717 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
718 * @example
719 *
720 * _.isSymbol(Symbol.iterator);
721 * // => true
722 *
723 * _.isSymbol('abc');
724 * // => false
725 */function isSymbol$1(value){return _typeof2(value)=='symbol'||isObjectLike(value)&&baseGetTag(value)==symbolTag;}var isSymbol_1=isSymbol$1;var baseTrim=_baseTrim,isObject$2=isObject_1,isSymbol=isSymbol_1;/** Used as references for various `Number` constants. */var NAN=0/0;/** 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;/**
726 * Converts `value` to a number.
727 *
728 * @static
729 * @memberOf _
730 * @since 4.0.0
731 * @category Lang
732 * @param {*} value The value to process.
733 * @returns {number} Returns the number.
734 * @example
735 *
736 * _.toNumber(3.2);
737 * // => 3.2
738 *
739 * _.toNumber(Number.MIN_VALUE);
740 * // => 5e-324
741 *
742 * _.toNumber(Infinity);
743 * // => Infinity
744 *
745 * _.toNumber('3.2');
746 * // => 3.2
747 */function toNumber$1(value){if(typeof value=='number'){return value;}if(isSymbol(value)){return NAN;}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.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value;}var toNumber_1=toNumber$1;var isObject$1=isObject_1,now=now_1,toNumber=toNumber_1;/** Error message constants. */var FUNC_ERROR_TEXT$1='Expected a function';/* Built-in method references for those with the same name as other `lodash` methods. */var nativeMax=Math.max,nativeMin=Math.min;/**
748 * Creates a debounced function that delays invoking `func` until after `wait`
749 * milliseconds have elapsed since the last time the debounced function was
750 * invoked. The debounced function comes with a `cancel` method to cancel
751 * delayed `func` invocations and a `flush` method to immediately invoke them.
752 * Provide `options` to indicate whether `func` should be invoked on the
753 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
754 * with the last arguments provided to the debounced function. Subsequent
755 * calls to the debounced function return the result of the last `func`
756 * invocation.
757 *
758 * **Note:** If `leading` and `trailing` options are `true`, `func` is
759 * invoked on the trailing edge of the timeout only if the debounced function
760 * is invoked more than once during the `wait` timeout.
761 *
762 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
763 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
764 *
765 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
766 * for details over the differences between `_.debounce` and `_.throttle`.
767 *
768 * @static
769 * @memberOf _
770 * @since 0.1.0
771 * @category Function
772 * @param {Function} func The function to debounce.
773 * @param {number} [wait=0] The number of milliseconds to delay.
774 * @param {Object} [options={}] The options object.
775 * @param {boolean} [options.leading=false]
776 * Specify invoking on the leading edge of the timeout.
777 * @param {number} [options.maxWait]
778 * The maximum time `func` is allowed to be delayed before it's invoked.
779 * @param {boolean} [options.trailing=true]
780 * Specify invoking on the trailing edge of the timeout.
781 * @returns {Function} Returns the new debounced function.
782 * @example
783 *
784 * // Avoid costly calculations while the window size is in flux.
785 * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
786 *
787 * // Invoke `sendMail` when clicked, debouncing subsequent calls.
788 * jQuery(element).on('click', _.debounce(sendMail, 300, {
789 * 'leading': true,
790 * 'trailing': false
791 * }));
792 *
793 * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
794 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
795 * var source = new EventSource('/stream');
796 * jQuery(source).on('message', debounced);
797 *
798 * // Cancel the trailing debounced invocation.
799 * jQuery(window).on('popstate', debounced.cancel);
800 */function debounce$2(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$1);}wait=toNumber(wait)||0;if(isObject$1(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.
801lastInvokeTime=time;// Start the timer for the trailing edge.
802timerId=setTimeout(timerExpired,wait);// Invoke the leading edge.
803return leading?invokeFunc(time):result;}function remainingWait(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime,timeWaiting=wait-timeSinceLastCall;return maxing?nativeMin(timeWaiting,maxWait-timeSinceLastInvoke):timeWaiting;}function shouldInvoke(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime;// Either this is the first call, activity has stopped and we're at the
804// trailing edge, the system time has gone backwards and we're treating
805// it as the trailing edge, or we've hit the `maxWait` limit.
806return lastCallTime===undefined||timeSinceLastCall>=wait||timeSinceLastCall<0||maxing&&timeSinceLastInvoke>=maxWait;}function timerExpired(){var time=now();if(shouldInvoke(time)){return trailingEdge(time);}// Restart the timer.
807timerId=setTimeout(timerExpired,remainingWait(time));}function trailingEdge(time){timerId=undefined;// Only invoke if we have `lastArgs` which means `func` has been
808// debounced at least once.
809if(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.
810clearTimeout(timerId);timerId=setTimeout(timerExpired,wait);return invokeFunc(lastCallTime);}}if(timerId===undefined){timerId=setTimeout(timerExpired,wait);}return result;}debounced.cancel=cancel;debounced.flush=flush;return debounced;}var debounce_1=debounce$2;var get$1=function get$1(){try{var data=store.local.get("storybook-layout");return data||false;}catch(e){// eslint-disable-next-line no-console
811console.error(e);return false;}};var write=memoize(1)(function(changes){try{store.local.set("storybook-layout",changes);}catch(e){// eslint-disable-next-line no-console
812console.error(e);}});var set=debounce_1(write,500);var cjs={exports:{}};var Draggable$2={};function toVal(mix){var k,y,str='';if(typeof mix==='string'||typeof mix==='number'){str+=mix;}else if(_typeof2(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 clsx_m(){var i=0,tmp,x,str='';while(i<arguments.length){if(tmp=arguments[i++]){if(x=toVal(tmp)){str&&(str+=' ');str+=x;}}}return str;}var clsx_m$1=/*#__PURE__*/Object.freeze({__proto__:null,'default':clsx_m});var require$$3=/*@__PURE__*/getAugmentedNamespace(clsx_m$1);var domFns={};var shims={};Object.defineProperty(shims,"__esModule",{value:true});shims.findInArray=findInArray;shims.isFunction=isFunction;shims.isNum=isNum;shims.int=int;shims.dontSetMe=dontSetMe;// @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc
813function findInArray(array/*: Array<any> | TouchList*/,callback/*: Function*/)/*: any*/{for(var i=0,length=array.length;i<length;i++){if(callback.apply(callback,[array[i],i,array]))return array[i];}}function isFunction(func/*: any*/)/*: boolean %checks*/{// $FlowIgnore[method-unbinding]
814return typeof func==='function'||Object.prototype.toString.call(func)==='[object Function]';}function isNum(num/*: any*/)/*: boolean %checks*/{return typeof num==='number'&&!isNaN(num);}function int(a/*: string*/)/*: number*/{return parseInt(a,10);}function dontSetMe(props/*: Object*/,propName/*: string*/,componentName/*: string*/)/*: ?Error*/{if(props[propName]){return new Error("Invalid prop ".concat(propName," passed to ").concat(componentName," - do not set this, set it on the child."));}}var getPrefix$1={};Object.defineProperty(getPrefix$1,"__esModule",{value:true});getPrefix$1.getPrefix=getPrefix;getPrefix$1.browserPrefixToKey=browserPrefixToKey;getPrefix$1.browserPrefixToStyle=browserPrefixToStyle;getPrefix$1.default=void 0;var prefixes=['Moz','Webkit','O','ms'];function getPrefix()/*: string*/{var _window$document,_window$document$docu;var prop/*: string*/=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'transform';// Ensure we're running in an environment where there is actually a global
815// `window` obj
816if(typeof window==='undefined')return'';// If we're in a pseudo-browser server-side environment, this access
817// path may not exist, so bail out if it doesn't.
818var style=(_window$document=window.document)===null||_window$document===void 0?void 0:(_window$document$docu=_window$document.documentElement)===null||_window$document$docu===void 0?void 0:_window$document$docu.style;if(!style)return'';if(prop in style)return'';for(var i=0;i<prefixes.length;i++){if(browserPrefixToKey(prop,prefixes[i])in style)return prefixes[i];}return'';}function browserPrefixToKey(prop/*: string*/,prefix/*: string*/)/*: string*/{return prefix?"".concat(prefix).concat(kebabToTitleCase(prop)):prop;}function browserPrefixToStyle(prop/*: string*/,prefix/*: string*/)/*: string*/{return prefix?"-".concat(prefix.toLowerCase(),"-").concat(prop):prop;}function kebabToTitleCase(str/*: string*/)/*: string*/{var out='';var shouldCapitalize=true;for(var i=0;i<str.length;i++){if(shouldCapitalize){out+=str[i].toUpperCase();shouldCapitalize=false;}else if(str[i]==='-'){shouldCapitalize=true;}else{out+=str[i];}}return out;}// Default export is the prefix itself, like 'Moz', 'Webkit', etc
819// Note that you may have to re-test for certain things; for instance, Chrome 50
820// can handle unprefixed `transform`, but not unprefixed `user-select`
821var _default=getPrefix()/*: string*/;getPrefix$1.default=_default;function _typeof$1(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof$1=function _typeof(obj){return typeof obj;};}else{_typeof$1=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof$1(obj);}Object.defineProperty(domFns,"__esModule",{value:true});domFns.matchesSelector=matchesSelector;domFns.matchesSelectorAndParentsTo=matchesSelectorAndParentsTo;domFns.addEvent=addEvent;domFns.removeEvent=removeEvent;domFns.outerHeight=outerHeight;domFns.outerWidth=outerWidth;domFns.innerHeight=innerHeight$1;domFns.innerWidth=innerWidth$1;domFns.offsetXYFromParent=offsetXYFromParent;domFns.createCSSTransform=createCSSTransform;domFns.createSVGTransform=createSVGTransform;domFns.getTranslation=getTranslation;domFns.getTouch=getTouch;domFns.getTouchIdentifier=getTouchIdentifier;domFns.addUserSelectStyles=addUserSelectStyles;domFns.removeUserSelectStyles=removeUserSelectStyles;domFns.addClassName=addClassName;domFns.removeClassName=removeClassName;var _shims$2=shims;var _getPrefix=_interopRequireWildcard$1(getPrefix$1);function _getRequireWildcardCache$1(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache$1=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard$1(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||_typeof$1(obj)!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache$1(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});}keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty$1(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}function _defineProperty$1(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var matchesSelectorFunc='';function matchesSelector(el/*: Node*/,selector/*: string*/)/*: boolean*/{if(!matchesSelectorFunc){matchesSelectorFunc=(0,_shims$2.findInArray)(['matches','webkitMatchesSelector','mozMatchesSelector','msMatchesSelector','oMatchesSelector'],function(method){// $FlowIgnore: Doesn't think elements are indexable
822return(0,_shims$2.isFunction)(el[method]);});}// Might not be found entirely (not an Element?) - in that case, bail
823// $FlowIgnore: Doesn't think elements are indexable
824if(!(0,_shims$2.isFunction)(el[matchesSelectorFunc]))return false;// $FlowIgnore: Doesn't think elements are indexable
825return el[matchesSelectorFunc](selector);}// Works up the tree to the draggable itself attempting to match selector.
826function matchesSelectorAndParentsTo(el/*: Node*/,selector/*: string*/,baseNode/*: Node*/)/*: boolean*/{var node=el;do{if(matchesSelector(node,selector))return true;if(node===baseNode)return false;node=node.parentNode;}while(node);return false;}function addEvent(el/*: ?Node*/,event/*: string*/,handler/*: Function*/,inputOptions/*: Object*/)/*: void*/{if(!el)return;var options=_objectSpread({capture:true},inputOptions);// $FlowIgnore[method-unbinding]
827if(el.addEventListener){el.addEventListener(event,handler,options);}else if(el.attachEvent){el.attachEvent('on'+event,handler);}else{// $FlowIgnore: Doesn't think elements are indexable
828el['on'+event]=handler;}}function removeEvent(el/*: ?Node*/,event/*: string*/,handler/*: Function*/,inputOptions/*: Object*/)/*: void*/{if(!el)return;var options=_objectSpread({capture:true},inputOptions);// $FlowIgnore[method-unbinding]
829if(el.removeEventListener){el.removeEventListener(event,handler,options);}else if(el.detachEvent){el.detachEvent('on'+event,handler);}else{// $FlowIgnore: Doesn't think elements are indexable
830el['on'+event]=null;}}function outerHeight(node/*: HTMLElement*/)/*: number*/{// This is deliberately excluding margin for our calculations, since we are using
831// offsetTop which is including margin. See getBoundPosition
832var height=node.clientHeight;var computedStyle=node.ownerDocument.defaultView.getComputedStyle(node);height+=(0,_shims$2.int)(computedStyle.borderTopWidth);height+=(0,_shims$2.int)(computedStyle.borderBottomWidth);return height;}function outerWidth(node/*: HTMLElement*/)/*: number*/{// This is deliberately excluding margin for our calculations, since we are using
833// offsetLeft which is including margin. See getBoundPosition
834var width=node.clientWidth;var computedStyle=node.ownerDocument.defaultView.getComputedStyle(node);width+=(0,_shims$2.int)(computedStyle.borderLeftWidth);width+=(0,_shims$2.int)(computedStyle.borderRightWidth);return width;}function innerHeight$1(node/*: HTMLElement*/)/*: number*/{var height=node.clientHeight;var computedStyle=node.ownerDocument.defaultView.getComputedStyle(node);height-=(0,_shims$2.int)(computedStyle.paddingTop);height-=(0,_shims$2.int)(computedStyle.paddingBottom);return height;}function innerWidth$1(node/*: HTMLElement*/)/*: number*/{var width=node.clientWidth;var computedStyle=node.ownerDocument.defaultView.getComputedStyle(node);width-=(0,_shims$2.int)(computedStyle.paddingLeft);width-=(0,_shims$2.int)(computedStyle.paddingRight);return width;}/*:: interface EventWithOffset {
835 clientX: number, clientY: number
836}*/ // Get from offsetParent
837function offsetXYFromParent(evt/*: EventWithOffset*/,offsetParent/*: HTMLElement*/,scale/*: number*/)/*: ControlPosition*/{var isBody=offsetParent===offsetParent.ownerDocument.body;var offsetParentRect=isBody?{left:0,top:0}:offsetParent.getBoundingClientRect();var x=(evt.clientX+offsetParent.scrollLeft-offsetParentRect.left)/scale;var y=(evt.clientY+offsetParent.scrollTop-offsetParentRect.top)/scale;return{x:x,y:y};}function createCSSTransform(controlPos/*: ControlPosition*/,positionOffset/*: PositionOffsetControlPosition*/)/*: Object*/{var translation=getTranslation(controlPos,positionOffset,'px');return _defineProperty$1({},(0,_getPrefix.browserPrefixToKey)('transform',_getPrefix.default),translation);}function createSVGTransform(controlPos/*: ControlPosition*/,positionOffset/*: PositionOffsetControlPosition*/)/*: string*/{var translation=getTranslation(controlPos,positionOffset,'');return translation;}function getTranslation(_ref2,positionOffset/*: PositionOffsetControlPosition*/,unitSuffix/*: string*/)/*: string*/{var x=_ref2.x,y=_ref2.y;var translation="translate(".concat(x).concat(unitSuffix,",").concat(y).concat(unitSuffix,")");if(positionOffset){var defaultX="".concat(typeof positionOffset.x==='string'?positionOffset.x:positionOffset.x+unitSuffix);var defaultY="".concat(typeof positionOffset.y==='string'?positionOffset.y:positionOffset.y+unitSuffix);translation="translate(".concat(defaultX,", ").concat(defaultY,")")+translation;}return translation;}function getTouch(e/*: MouseTouchEvent*/,identifier/*: number*/)/*: ?{clientX: number, clientY: number}*/{return e.targetTouches&&(0,_shims$2.findInArray)(e.targetTouches,function(t){return identifier===t.identifier;})||e.changedTouches&&(0,_shims$2.findInArray)(e.changedTouches,function(t){return identifier===t.identifier;});}function getTouchIdentifier(e/*: MouseTouchEvent*/)/*: ?number*/{if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier;}// User-select Hacks:
838//
839// Useful for preventing blue highlights all over everything when dragging.
840// Note we're passing `document` b/c we could be iframed
841function addUserSelectStyles(doc/*: ?Document*/){if(!doc)return;var styleEl=doc.getElementById('react-draggable-style-el');if(!styleEl){styleEl=doc.createElement('style');styleEl.type='text/css';styleEl.id='react-draggable-style-el';styleEl.innerHTML='.react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n';styleEl.innerHTML+='.react-draggable-transparent-selection *::selection {all: inherit;}\n';doc.getElementsByTagName('head')[0].appendChild(styleEl);}if(doc.body)addClassName(doc.body,'react-draggable-transparent-selection');}function removeUserSelectStyles(doc/*: ?Document*/){if(!doc)return;try{if(doc.body)removeClassName(doc.body,'react-draggable-transparent-selection');// $FlowIgnore: IE
842if(doc.selection){// $FlowIgnore: IE
843doc.selection.empty();}else{// Remove selection caused by scroll, unless it's a focused input
844// (we use doc.defaultView in case we're in an iframe)
845var selection=(doc.defaultView||window).getSelection();if(selection&&selection.type!=='Caret'){selection.removeAllRanges();}}}catch(e){// probably IE
846}}function addClassName(el/*: HTMLElement*/,className/*: string*/){if(el.classList){el.classList.add(className);}else{if(!el.className.match(new RegExp("(?:^|\\s)".concat(className,"(?!\\S)")))){el.className+=" ".concat(className);}}}function removeClassName(el/*: HTMLElement*/,className/*: string*/){if(el.classList){el.classList.remove(className);}else{el.className=el.className.replace(new RegExp("(?:^|\\s)".concat(className,"(?!\\S)"),'g'),'');}}var positionFns={};Object.defineProperty(positionFns,"__esModule",{value:true});positionFns.getBoundPosition=getBoundPosition;positionFns.snapToGrid=snapToGrid;positionFns.canDragX=canDragX;positionFns.canDragY=canDragY;positionFns.getControlPosition=getControlPosition;positionFns.createCoreData=createCoreData;positionFns.createDraggableData=createDraggableData;var _shims$1=shims;var _domFns$1=domFns;function getBoundPosition(draggable/*: Draggable*/,x/*: number*/,y/*: number*/)/*: [number, number]*/{// If no bounds, short-circuit and move on
847if(!draggable.props.bounds)return[x,y];// Clone new bounds
848var bounds=draggable.props.bounds;bounds=typeof bounds==='string'?bounds:cloneBounds(bounds);var node=findDOMNode(draggable);if(typeof bounds==='string'){var ownerDocument=node.ownerDocument;var ownerWindow=ownerDocument.defaultView;var boundNode;if(bounds==='parent'){boundNode=node.parentNode;}else{boundNode=ownerDocument.querySelector(bounds);}if(!(boundNode instanceof ownerWindow.HTMLElement)){throw new Error('Bounds selector "'+bounds+'" could not find an element.');}var boundNodeEl/*: HTMLElement*/=boundNode;// for Flow, can't seem to refine correctly
849var nodeStyle=ownerWindow.getComputedStyle(node);var boundNodeStyle=ownerWindow.getComputedStyle(boundNodeEl);// Compute bounds. This is a pain with padding and offsets but this gets it exactly right.
850bounds={left:-node.offsetLeft+(0,_shims$1.int)(boundNodeStyle.paddingLeft)+(0,_shims$1.int)(nodeStyle.marginLeft),top:-node.offsetTop+(0,_shims$1.int)(boundNodeStyle.paddingTop)+(0,_shims$1.int)(nodeStyle.marginTop),right:(0,_domFns$1.innerWidth)(boundNodeEl)-(0,_domFns$1.outerWidth)(node)-node.offsetLeft+(0,_shims$1.int)(boundNodeStyle.paddingRight)-(0,_shims$1.int)(nodeStyle.marginRight),bottom:(0,_domFns$1.innerHeight)(boundNodeEl)-(0,_domFns$1.outerHeight)(node)-node.offsetTop+(0,_shims$1.int)(boundNodeStyle.paddingBottom)-(0,_shims$1.int)(nodeStyle.marginBottom)};}// Keep x and y below right and bottom limits...
851if((0,_shims$1.isNum)(bounds.right))x=Math.min(x,bounds.right);if((0,_shims$1.isNum)(bounds.bottom))y=Math.min(y,bounds.bottom);// But above left and top limits.
852if((0,_shims$1.isNum)(bounds.left))x=Math.max(x,bounds.left);if((0,_shims$1.isNum)(bounds.top))y=Math.max(y,bounds.top);return[x,y];}function snapToGrid(grid/*: [number, number]*/,pendingX/*: number*/,pendingY/*: number*/)/*: [number, number]*/{var x=Math.round(pendingX/grid[0])*grid[0];var y=Math.round(pendingY/grid[1])*grid[1];return[x,y];}function canDragX(draggable/*: Draggable*/)/*: boolean*/{return draggable.props.axis==='both'||draggable.props.axis==='x';}function canDragY(draggable/*: Draggable*/)/*: boolean*/{return draggable.props.axis==='both'||draggable.props.axis==='y';}// Get {x, y} positions from event.
853function getControlPosition(e/*: MouseTouchEvent*/,touchIdentifier/*: ?number*/,draggableCore/*: DraggableCore*/)/*: ?ControlPosition*/{var touchObj=typeof touchIdentifier==='number'?(0,_domFns$1.getTouch)(e,touchIdentifier):null;if(typeof touchIdentifier==='number'&&!touchObj)return null;// not the right touch
854var node=findDOMNode(draggableCore);// User can provide an offsetParent if desired.
855var offsetParent=draggableCore.props.offsetParent||node.offsetParent||node.ownerDocument.body;return(0,_domFns$1.offsetXYFromParent)(touchObj||e,offsetParent,draggableCore.props.scale);}// Create an data object exposed by <DraggableCore>'s events
856function createCoreData(draggable/*: DraggableCore*/,x/*: number*/,y/*: number*/)/*: DraggableData*/{var state=draggable.state;var isStart=!(0,_shims$1.isNum)(state.lastX);var node=findDOMNode(draggable);if(isStart){// If this is our first move, use the x and y as last coords.
857return{node:node,deltaX:0,deltaY:0,lastX:x,lastY:y,x:x,y:y};}else{// Otherwise calculate proper values.
858return{node:node,deltaX:x-state.lastX,deltaY:y-state.lastY,lastX:state.lastX,lastY:state.lastY,x:x,y:y};}}// Create an data exposed by <Draggable>'s events
859function createDraggableData(draggable/*: Draggable*/,coreData/*: DraggableData*/)/*: DraggableData*/{var scale=draggable.props.scale;return{node:coreData.node,x:draggable.state.x+coreData.deltaX/scale,y:draggable.state.y+coreData.deltaY/scale,deltaX:coreData.deltaX/scale,deltaY:coreData.deltaY/scale,lastX:draggable.state.x,lastY:draggable.state.y};}// A lot faster than stringify/parse
860function cloneBounds(bounds/*: Bounds*/)/*: Bounds*/{return{left:bounds.left,top:bounds.top,right:bounds.right,bottom:bounds.bottom};}function findDOMNode(draggable/*: Draggable | DraggableCore*/)/*: HTMLElement*/{var node=draggable.findDOMNode();if(!node){throw new Error('<DraggableCore>: Unmounted during event!');}// $FlowIgnore we can't assert on HTMLElement due to tests... FIXME
861return node;}var DraggableCore$2={};var log$1={};Object.defineProperty(log$1,"__esModule",{value:true});log$1.default=log;/*eslint no-console:0*/function log(){}function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}Object.defineProperty(DraggableCore$2,"__esModule",{value:true});DraggableCore$2.default=void 0;var React=_interopRequireWildcard(React$2);var _propTypes=_interopRequireDefault(propTypes.exports);var _reactDom=_interopRequireDefault(require$$2);var _domFns=domFns;var _positionFns=positionFns;var _shims=shims;var _log=_interopRequireDefault(log$1);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||_typeof(obj)!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf$2(subClass,superClass);}function _setPrototypeOf$2(o,p){_setPrototypeOf$2=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf$2(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct$1();return function _createSuperInternal(){var Super=_getPrototypeOf$1(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf$1(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized$2(self);}function _assertThisInitialized$2(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct$1(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf$1(o){_getPrototypeOf$1=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf$1(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}// Simple abstraction for dragging events names.
862var eventsFor={touch:{start:'touchstart',move:'touchmove',stop:'touchend'},mouse:{start:'mousedown',move:'mousemove',stop:'mouseup'}};// Default to mouse events.
863var dragEventFor=eventsFor.mouse;/*:: type DraggableCoreState = {
864 dragging: boolean,
865 lastX: number,
866 lastY: number,
867 touchIdentifier: ?number
868};*/ /*:: export type DraggableData = {
869 node: HTMLElement,
870 x: number, y: number,
871 deltaX: number, deltaY: number,
872 lastX: number, lastY: number,
873};*/ /*:: export type DraggableEventHandler = (e: MouseEvent, data: DraggableData) => void | false;*/ /*:: export type ControlPosition = {x: number, y: number};*/ /*:: export type PositionOffsetControlPosition = {x: number|string, y: number|string};*/ /*:: export type DraggableCoreDefaultProps = {
874 allowAnyClick: boolean,
875 disabled: boolean,
876 enableUserSelectHack: boolean,
877 onStart: DraggableEventHandler,
878 onDrag: DraggableEventHandler,
879 onStop: DraggableEventHandler,
880 onMouseDown: (e: MouseEvent) => void,
881 scale: number,
882};*/ /*:: export type DraggableCoreProps = {
883 ...DraggableCoreDefaultProps,
884 cancel: string,
885 children: ReactElement<any>,
886 offsetParent: HTMLElement,
887 grid: [number, number],
888 handle: string,
889 nodeRef?: ?React.ElementRef<any>,
890};*/ //
891// Define <DraggableCore>.
892//
893// <DraggableCore> is for advanced usage of <Draggable>. It maintains minimal internal state so it can
894// work well with libraries that require more control over the element.
895//
896var DraggableCore$1=/*#__PURE__*/function(_React$Component){_inherits(DraggableCore,_React$Component);var _super=_createSuper(DraggableCore);function DraggableCore(){var _this;_classCallCheck(this,DraggableCore);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_defineProperty(_assertThisInitialized$2(_this),"state",{dragging:false,// Used while dragging to determine deltas.
897lastX:NaN,lastY:NaN,touchIdentifier:null});_defineProperty(_assertThisInitialized$2(_this),"mounted",false);_defineProperty(_assertThisInitialized$2(_this),"handleDragStart",function(e){// Make it possible to attach event handlers on top of this one.
898_this.props.onMouseDown(e);// Only accept left-clicks.
899if(!_this.props.allowAnyClick&&typeof e.button==='number'&&e.button!==0)return false;// Get nodes. Be sure to grab relative document (could be iframed)
900var thisNode=_this.findDOMNode();if(!thisNode||!thisNode.ownerDocument||!thisNode.ownerDocument.body){throw new Error('<DraggableCore> not mounted on DragStart!');}var ownerDocument=thisNode.ownerDocument;// Short circuit if handle or cancel prop was provided and selector doesn't match.
901if(_this.props.disabled||!(e.target instanceof ownerDocument.defaultView.Node)||_this.props.handle&&!(0,_domFns.matchesSelectorAndParentsTo)(e.target,_this.props.handle,thisNode)||_this.props.cancel&&(0,_domFns.matchesSelectorAndParentsTo)(e.target,_this.props.cancel,thisNode)){return;}// Prevent scrolling on mobile devices, like ipad/iphone.
902// Important that this is after handle/cancel.
903if(e.type==='touchstart')e.preventDefault();// Set touch identifier in component state if this is a touch event. This allows us to
904// distinguish between individual touches on multitouch screens by identifying which
905// touchpoint was set to this element.
906var touchIdentifier=(0,_domFns.getTouchIdentifier)(e);_this.setState({touchIdentifier:touchIdentifier});// Get the current drag point from the event. This is used as the offset.
907var position=(0,_positionFns.getControlPosition)(e,touchIdentifier,_assertThisInitialized$2(_this));if(position==null)return;// not possible but satisfies flow
908var x=position.x,y=position.y;// Create an event object with all the data parents need to make a decision here.
909var coreEvent=(0,_positionFns.createCoreData)(_assertThisInitialized$2(_this),x,y);(0,_log.default)('DraggableCore: handleDragStart: %j',coreEvent);// Call event handler. If it returns explicit false, cancel.
910(0,_log.default)('calling',_this.props.onStart);var shouldUpdate=_this.props.onStart(e,coreEvent);if(shouldUpdate===false||_this.mounted===false)return;// Add a style to the body to disable user-select. This prevents text from
911// being selected all over the page.
912if(_this.props.enableUserSelectHack)(0,_domFns.addUserSelectStyles)(ownerDocument);// Initiate dragging. Set the current x and y as offsets
913// so we know how much we've moved during the drag. This allows us
914// to drag elements around even if they have been moved, without issue.
915_this.setState({dragging:true,lastX:x,lastY:y});// Add events to the document directly so we catch when the user's mouse/touch moves outside of
916// this element. We use different events depending on whether or not we have detected that this
917// is a touch-capable device.
918(0,_domFns.addEvent)(ownerDocument,dragEventFor.move,_this.handleDrag);(0,_domFns.addEvent)(ownerDocument,dragEventFor.stop,_this.handleDragStop);});_defineProperty(_assertThisInitialized$2(_this),"handleDrag",function(e){// Get the current drag point from the event. This is used as the offset.
919var position=(0,_positionFns.getControlPosition)(e,_this.state.touchIdentifier,_assertThisInitialized$2(_this));if(position==null)return;var x=position.x,y=position.y;// Snap to grid if prop has been provided
920if(Array.isArray(_this.props.grid)){var deltaX=x-_this.state.lastX,deltaY=y-_this.state.lastY;var _snapToGrid=(0,_positionFns.snapToGrid)(_this.props.grid,deltaX,deltaY);var _snapToGrid2=_slicedToArray(_snapToGrid,2);deltaX=_snapToGrid2[0];deltaY=_snapToGrid2[1];if(!deltaX&&!deltaY)return;// skip useless drag
921x=_this.state.lastX+deltaX,y=_this.state.lastY+deltaY;}var coreEvent=(0,_positionFns.createCoreData)(_assertThisInitialized$2(_this),x,y);(0,_log.default)('DraggableCore: handleDrag: %j',coreEvent);// Call event handler. If it returns explicit false, trigger end.
922var shouldUpdate=_this.props.onDrag(e,coreEvent);if(shouldUpdate===false||_this.mounted===false){try{// $FlowIgnore
923_this.handleDragStop(new MouseEvent('mouseup'));}catch(err){// Old browsers
924var event=document.createEvent('MouseEvents')/*: any*/ /*: MouseTouchEvent*/;// I see why this insanity was deprecated
925// $FlowIgnore
926event.initMouseEvent('mouseup',true,true,window,0,0,0,0,0,false,false,false,false,0,null);_this.handleDragStop(event);}return;}_this.setState({lastX:x,lastY:y});});_defineProperty(_assertThisInitialized$2(_this),"handleDragStop",function(e){if(!_this.state.dragging)return;var position=(0,_positionFns.getControlPosition)(e,_this.state.touchIdentifier,_assertThisInitialized$2(_this));if(position==null)return;var x=position.x,y=position.y;var coreEvent=(0,_positionFns.createCoreData)(_assertThisInitialized$2(_this),x,y);// Call event handler
927var shouldContinue=_this.props.onStop(e,coreEvent);if(shouldContinue===false||_this.mounted===false)return false;var thisNode=_this.findDOMNode();if(thisNode){// Remove user-select hack
928if(_this.props.enableUserSelectHack)(0,_domFns.removeUserSelectStyles)(thisNode.ownerDocument);}(0,_log.default)('DraggableCore: handleDragStop: %j',coreEvent);// Reset the el.
929_this.setState({dragging:false,lastX:NaN,lastY:NaN});if(thisNode){// Remove event handlers
930(0,_log.default)('DraggableCore: Removing handlers');(0,_domFns.removeEvent)(thisNode.ownerDocument,dragEventFor.move,_this.handleDrag);(0,_domFns.removeEvent)(thisNode.ownerDocument,dragEventFor.stop,_this.handleDragStop);}});_defineProperty(_assertThisInitialized$2(_this),"onMouseDown",function(e){dragEventFor=eventsFor.mouse;// on touchscreen laptops we could switch back to mouse
931return _this.handleDragStart(e);});_defineProperty(_assertThisInitialized$2(_this),"onMouseUp",function(e){dragEventFor=eventsFor.mouse;return _this.handleDragStop(e);});_defineProperty(_assertThisInitialized$2(_this),"onTouchStart",function(e){// We're on a touch device now, so change the event handlers
932dragEventFor=eventsFor.touch;return _this.handleDragStart(e);});_defineProperty(_assertThisInitialized$2(_this),"onTouchEnd",function(e){// We're on a touch device now, so change the event handlers
933dragEventFor=eventsFor.touch;return _this.handleDragStop(e);});return _this;}_createClass(DraggableCore,[{key:"componentDidMount",value:function componentDidMount(){this.mounted=true;// Touch handlers must be added with {passive: false} to be cancelable.
934// https://developers.google.com/web/updates/2017/01/scrolling-intervention
935var thisNode=this.findDOMNode();if(thisNode){(0,_domFns.addEvent)(thisNode,eventsFor.touch.start,this.onTouchStart,{passive:false});}}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.mounted=false;// Remove any leftover event handlers. Remove both touch and mouse handlers in case
936// some browser quirk caused a touch event to fire during a mouse move, or vice versa.
937var thisNode=this.findDOMNode();if(thisNode){var ownerDocument=thisNode.ownerDocument;(0,_domFns.removeEvent)(ownerDocument,eventsFor.mouse.move,this.handleDrag);(0,_domFns.removeEvent)(ownerDocument,eventsFor.touch.move,this.handleDrag);(0,_domFns.removeEvent)(ownerDocument,eventsFor.mouse.stop,this.handleDragStop);(0,_domFns.removeEvent)(ownerDocument,eventsFor.touch.stop,this.handleDragStop);(0,_domFns.removeEvent)(thisNode,eventsFor.touch.start,this.onTouchStart,{passive:false});if(this.props.enableUserSelectHack)(0,_domFns.removeUserSelectStyles)(ownerDocument);}}// React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
938// the underlying DOM node ourselves. See the README for more information.
939},{key:"findDOMNode",value:function findDOMNode()/*: ?HTMLElement*/{var _this$props$nodeRef$c,_this$props,_this$props$nodeRef;return(_this$props$nodeRef$c=(_this$props=this.props)===null||_this$props===void 0?void 0:(_this$props$nodeRef=_this$props.nodeRef)===null||_this$props$nodeRef===void 0?void 0:_this$props$nodeRef.current)!==null&&_this$props$nodeRef$c!==void 0?_this$props$nodeRef$c:_reactDom.default.findDOMNode(this);}},{key:"render",value:function render()/*: React.Element<any>*/{// Reuse the child provided
940// This makes it flexible to use whatever element is wanted (div, ul, etc)
941return/*#__PURE__*/React.cloneElement(React.Children.only(this.props.children),{// Note: mouseMove handler is attached to document so it will still function
942// when the user drags quickly and leaves the bounds of the element.
943onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,// onTouchStart is added on `componentDidMount` so they can be added with
944// {passive: false}, which allows it to cancel. See
945// https://developers.google.com/web/updates/2017/01/scrolling-intervention
946onTouchEnd:this.onTouchEnd});}}]);return DraggableCore;}(React.Component);DraggableCore$2.default=DraggableCore$1;_defineProperty(DraggableCore$1,"displayName",'DraggableCore');_defineProperty(DraggableCore$1,"propTypes",{/**
947 * `allowAnyClick` allows dragging using any mouse button.
948 * By default, we only accept the left button.
949 *
950 * Defaults to `false`.
951 */allowAnyClick:_propTypes.default.bool,/**
952 * `disabled`, if true, stops the <Draggable> from dragging. All handlers,
953 * with the exception of `onMouseDown`, will not fire.
954 */disabled:_propTypes.default.bool,/**
955 * By default, we add 'user-select:none' attributes to the document body
956 * to prevent ugly text selection during drag. If this is causing problems
957 * for your app, set this to `false`.
958 */enableUserSelectHack:_propTypes.default.bool,/**
959 * `offsetParent`, if set, uses the passed DOM node to compute drag offsets
960 * instead of using the parent node.
961 */offsetParent:function offsetParent(props/*: DraggableCoreProps*/,propName/*: $Keys<DraggableCoreProps>*/){if(props[propName]&&props[propName].nodeType!==1){throw new Error('Draggable\'s offsetParent must be a DOM Node.');}},/**
962 * `grid` specifies the x and y that dragging should snap to.
963 */grid:_propTypes.default.arrayOf(_propTypes.default.number),/**
964 * `handle` specifies a selector to be used as the handle that initiates drag.
965 *
966 * Example:
967 *
968 * ```jsx
969 * let App = React.createClass({
970 * render: function () {
971 * return (
972 * <Draggable handle=".handle">
973 * <div>
974 * <div className="handle">Click me to drag</div>
975 * <div>This is some other content</div>
976 * </div>
977 * </Draggable>
978 * );
979 * }
980 * });
981 * ```
982 */handle:_propTypes.default.string,/**
983 * `cancel` specifies a selector to be used to prevent drag initialization.
984 *
985 * Example:
986 *
987 * ```jsx
988 * let App = React.createClass({
989 * render: function () {
990 * return(
991 * <Draggable cancel=".cancel">
992 * <div>
993 * <div className="cancel">You can't drag from here</div>
994 * <div>Dragging here works fine</div>
995 * </div>
996 * </Draggable>
997 * );
998 * }
999 * });
1000 * ```
1001 */cancel:_propTypes.default.string,/* If running in React Strict mode, ReactDOM.findDOMNode() is deprecated.
1002 * Unfortunately, in order for <Draggable> to work properly, we need raw access
1003 * to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef`
1004 * as in this example:
1005 *
1006 * function MyComponent() {
1007 * const nodeRef = React.useRef(null);
1008 * return (
1009 * <Draggable nodeRef={nodeRef}>
1010 * <div ref={nodeRef}>Example Target</div>
1011 * </Draggable>
1012 * );
1013 * }
1014 *
1015 * This can be used for arbitrarily nested components, so long as the ref ends up
1016 * pointing to the actual child DOM node and not a custom component.
1017 */nodeRef:_propTypes.default.object,/**
1018 * Called when dragging starts.
1019 * If this function returns the boolean false, dragging will be canceled.
1020 */onStart:_propTypes.default.func,/**
1021 * Called while dragging.
1022 * If this function returns the boolean false, dragging will be canceled.
1023 */onDrag:_propTypes.default.func,/**
1024 * Called when dragging stops.
1025 * If this function returns the boolean false, the drag will remain active.
1026 */onStop:_propTypes.default.func,/**
1027 * A workaround option which can be passed if onMouseDown needs to be accessed,
1028 * since it'll always be blocked (as there is internal use of onMouseDown)
1029 */onMouseDown:_propTypes.default.func,/**
1030 * `scale`, if set, applies scaling while dragging an element
1031 */scale:_propTypes.default.number,/**
1032 * These properties should be defined on the child, not here.
1033 */className:_shims.dontSetMe,style:_shims.dontSetMe,transform:_shims.dontSetMe});_defineProperty(DraggableCore$1,"defaultProps",{allowAnyClick:false,// by default only accept left click
1034disabled:false,enableUserSelectHack:true,onStart:function onStart(){},onDrag:function onDrag(){},onStop:function onStop(){},onMouseDown:function onMouseDown(){},scale:1});(function(exports){function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"DraggableCore",{enumerable:true,get:function get(){return _DraggableCore.default;}});exports.default=void 0;var React=_interopRequireWildcard(React$2);var _propTypes=_interopRequireDefault(propTypes.exports);var _reactDom=_interopRequireDefault(require$$2);var _clsx2=_interopRequireDefault(require$$3);var _domFns=domFns;var _positionFns=positionFns;var _shims=shims;var _DraggableCore=_interopRequireDefault(DraggableCore$2);var _log=_interopRequireDefault(log$1);var _excluded=["axis","bounds","children","defaultPosition","defaultClassName","defaultClassNameDragging","defaultClassNameDragged","position","positionOffset","scale"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||_typeof(obj)!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}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;}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});}keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}//
1035// Define <Draggable>
1036//
1037var Draggable=/*#__PURE__*/function(_React$Component){_inherits(Draggable,_React$Component);var _super=_createSuper(Draggable);function Draggable(props/*: DraggableProps*/){var _this;_classCallCheck(this,Draggable);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"onDragStart",function(e,coreData){(0,_log.default)('Draggable: onDragStart: %j',coreData);// Short-circuit if user's callback killed it.
1038var shouldStart=_this.props.onStart(e,(0,_positionFns.createDraggableData)(_assertThisInitialized(_this),coreData));// Kills start event on core as well, so move handlers are never bound.
1039if(shouldStart===false)return false;_this.setState({dragging:true,dragged:true});});_defineProperty(_assertThisInitialized(_this),"onDrag",function(e,coreData){if(!_this.state.dragging)return false;(0,_log.default)('Draggable: onDrag: %j',coreData);var uiData=(0,_positionFns.createDraggableData)(_assertThisInitialized(_this),coreData);var newState/*: $Shape<DraggableState>*/={x:uiData.x,y:uiData.y};// Keep within bounds.
1040if(_this.props.bounds){// Save original x and y.
1041var x=newState.x,y=newState.y;// Add slack to the values used to calculate bound position. This will ensure that if
1042// we start removing slack, the element won't react to it right away until it's been
1043// completely removed.
1044newState.x+=_this.state.slackX;newState.y+=_this.state.slackY;// Get bound position. This will ceil/floor the x and y within the boundaries.
1045var _getBoundPosition=(0,_positionFns.getBoundPosition)(_assertThisInitialized(_this),newState.x,newState.y),_getBoundPosition2=_slicedToArray(_getBoundPosition,2),newStateX=_getBoundPosition2[0],newStateY=_getBoundPosition2[1];newState.x=newStateX;newState.y=newStateY;// Recalculate slack by noting how much was shaved by the boundPosition handler.
1046newState.slackX=_this.state.slackX+(x-newState.x);newState.slackY=_this.state.slackY+(y-newState.y);// Update the event we fire to reflect what really happened after bounds took effect.
1047uiData.x=newState.x;uiData.y=newState.y;uiData.deltaX=newState.x-_this.state.x;uiData.deltaY=newState.y-_this.state.y;}// Short-circuit if user's callback killed it.
1048var shouldUpdate=_this.props.onDrag(e,uiData);if(shouldUpdate===false)return false;_this.setState(newState);});_defineProperty(_assertThisInitialized(_this),"onDragStop",function(e,coreData){if(!_this.state.dragging)return false;// Short-circuit if user's callback killed it.
1049var shouldContinue=_this.props.onStop(e,(0,_positionFns.createDraggableData)(_assertThisInitialized(_this),coreData));if(shouldContinue===false)return false;(0,_log.default)('Draggable: onDragStop: %j',coreData);var newState/*: $Shape<DraggableState>*/={dragging:false,slackX:0,slackY:0};// If this is a controlled component, the result of this operation will be to
1050// revert back to the old position. We expect a handler on `onDragStop`, at the least.
1051var controlled=Boolean(_this.props.position);if(controlled){var _this$props$position=_this.props.position,x=_this$props$position.x,y=_this$props$position.y;newState.x=x;newState.y=y;}_this.setState(newState);});_this.state={// Whether or not we are currently dragging.
1052dragging:false,// Whether or not we have been dragged before.
1053dragged:false,// Current transform x and y.
1054x:props.position?props.position.x:props.defaultPosition.x,y:props.position?props.position.y:props.defaultPosition.y,prevPropsPosition:_objectSpread({},props.position),// Used for compensating for out-of-bounds drags
1055slackX:0,slackY:0,// Can only determine if SVG after mounting
1056isElementSVG:false};if(props.position&&!(props.onDrag||props.onStop)){// eslint-disable-next-line no-console
1057console.warn('A `position` was applied to this <Draggable>, without drag handlers. This will make this '+'component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the '+'`position` of this element.');}return _this;}_createClass(Draggable,[{key:"componentDidMount",value:function componentDidMount(){// Check to see if the element passed is an instanceof SVGElement
1058if(typeof window.SVGElement!=='undefined'&&this.findDOMNode()instanceof window.SVGElement){this.setState({isElementSVG:true});}}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.setState({dragging:false});// prevents invariant if unmounted while dragging
1059}// React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
1060// the underlying DOM node ourselves. See the README for more information.
1061},{key:"findDOMNode",value:function findDOMNode()/*: ?HTMLElement*/{var _this$props$nodeRef$c,_this$props,_this$props$nodeRef;return(_this$props$nodeRef$c=(_this$props=this.props)===null||_this$props===void 0?void 0:(_this$props$nodeRef=_this$props.nodeRef)===null||_this$props$nodeRef===void 0?void 0:_this$props$nodeRef.current)!==null&&_this$props$nodeRef$c!==void 0?_this$props$nodeRef$c:_reactDom.default.findDOMNode(this);}},{key:"render",value:function render()/*: ReactElement<any>*/{var _clsx;var _this$props2=this.props;_this$props2.axis;_this$props2.bounds;var children=_this$props2.children,defaultPosition=_this$props2.defaultPosition,defaultClassName=_this$props2.defaultClassName,defaultClassNameDragging=_this$props2.defaultClassNameDragging,defaultClassNameDragged=_this$props2.defaultClassNameDragged,position=_this$props2.position,positionOffset=_this$props2.positionOffset;_this$props2.scale;var draggableCoreProps=_objectWithoutProperties(_this$props2,_excluded);var style={};var svgTransform=null;// If this is controlled, we don't want to move it - unless it's dragging.
1062var controlled=Boolean(position);var draggable=!controlled||this.state.dragging;var validPosition=position||defaultPosition;var transformOpts={// Set left if horizontal drag is enabled
1063x:(0,_positionFns.canDragX)(this)&&draggable?this.state.x:validPosition.x,// Set top if vertical drag is enabled
1064y:(0,_positionFns.canDragY)(this)&&draggable?this.state.y:validPosition.y};// If this element was SVG, we use the `transform` attribute.
1065if(this.state.isElementSVG){svgTransform=(0,_domFns.createSVGTransform)(transformOpts,positionOffset);}else{// Add a CSS transform to move the element around. This allows us to move the element around
1066// without worrying about whether or not it is relatively or absolutely positioned.
1067// If the item you are dragging already has a transform set, wrap it in a <span> so <Draggable>
1068// has a clean slate.
1069style=(0,_domFns.createCSSTransform)(transformOpts,positionOffset);}// Mark with class while dragging
1070var className=(0,_clsx2.default)(children.props.className||'',defaultClassName,(_clsx={},_defineProperty(_clsx,defaultClassNameDragging,this.state.dragging),_defineProperty(_clsx,defaultClassNameDragged,this.state.dragged),_clsx));// Reuse the child provided
1071// This makes it flexible to use whatever element is wanted (div, ul, etc)
1072return/*#__PURE__*/React.createElement(_DraggableCore.default,_extends({},draggableCoreProps,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),/*#__PURE__*/React.cloneElement(React.Children.only(children),{className:className,style:_objectSpread(_objectSpread({},children.props.style),style),transform:svgTransform}));}}],[{key:"getDerivedStateFromProps",value:// React 16.3+
1073// Arity (props, state)
1074function getDerivedStateFromProps(_ref,_ref2)/*: ?$Shape<DraggableState>*/{var position=_ref.position;var prevPropsPosition=_ref2.prevPropsPosition;// Set x/y if a new position is provided in props that is different than the previous.
1075if(position&&(!prevPropsPosition||position.x!==prevPropsPosition.x||position.y!==prevPropsPosition.y)){(0,_log.default)('Draggable: getDerivedStateFromProps %j',{position:position,prevPropsPosition:prevPropsPosition});return{x:position.x,y:position.y,prevPropsPosition:_objectSpread({},position)};}return null;}}]);return Draggable;}(React.Component);exports.default=Draggable;_defineProperty(Draggable,"displayName",'Draggable');_defineProperty(Draggable,"propTypes",_objectSpread(_objectSpread({},_DraggableCore.default.propTypes),{},{/**
1076 * `axis` determines which axis the draggable can move.
1077 *
1078 * Note that all callbacks will still return data as normal. This only
1079 * controls flushing to the DOM.
1080 *
1081 * 'both' allows movement horizontally and vertically.
1082 * 'x' limits movement to horizontal axis.
1083 * 'y' limits movement to vertical axis.
1084 * 'none' limits all movement.
1085 *
1086 * Defaults to 'both'.
1087 */axis:_propTypes.default.oneOf(['both','x','y','none']),/**
1088 * `bounds` determines the range of movement available to the element.
1089 * Available values are:
1090 *
1091 * 'parent' restricts movement within the Draggable's parent node.
1092 *
1093 * Alternatively, pass an object with the following properties, all of which are optional:
1094 *
1095 * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
1096 *
1097 * All values are in px.
1098 *
1099 * Example:
1100 *
1101 * ```jsx
1102 * let App = React.createClass({
1103 * render: function () {
1104 * return (
1105 * <Draggable bounds={{right: 300, bottom: 300}}>
1106 * <div>Content</div>
1107 * </Draggable>
1108 * );
1109 * }
1110 * });
1111 * ```
1112 */bounds:_propTypes.default.oneOfType([_propTypes.default.shape({left:_propTypes.default.number,right:_propTypes.default.number,top:_propTypes.default.number,bottom:_propTypes.default.number}),_propTypes.default.string,_propTypes.default.oneOf([false])]),defaultClassName:_propTypes.default.string,defaultClassNameDragging:_propTypes.default.string,defaultClassNameDragged:_propTypes.default.string,/**
1113 * `defaultPosition` specifies the x and y that the dragged item should start at
1114 *
1115 * Example:
1116 *
1117 * ```jsx
1118 * let App = React.createClass({
1119 * render: function () {
1120 * return (
1121 * <Draggable defaultPosition={{x: 25, y: 25}}>
1122 * <div>I start with transformX: 25px and transformY: 25px;</div>
1123 * </Draggable>
1124 * );
1125 * }
1126 * });
1127 * ```
1128 */defaultPosition:_propTypes.default.shape({x:_propTypes.default.number,y:_propTypes.default.number}),positionOffset:_propTypes.default.shape({x:_propTypes.default.oneOfType([_propTypes.default.number,_propTypes.default.string]),y:_propTypes.default.oneOfType([_propTypes.default.number,_propTypes.default.string])}),/**
1129 * `position`, if present, defines the current position of the element.
1130 *
1131 * This is similar to how form elements in React work - if no `position` is supplied, the component
1132 * is uncontrolled.
1133 *
1134 * Example:
1135 *
1136 * ```jsx
1137 * let App = React.createClass({
1138 * render: function () {
1139 * return (
1140 * <Draggable position={{x: 25, y: 25}}>
1141 * <div>I start with transformX: 25px and transformY: 25px;</div>
1142 * </Draggable>
1143 * );
1144 * }
1145 * });
1146 * ```
1147 */position:_propTypes.default.shape({x:_propTypes.default.number,y:_propTypes.default.number}),/**
1148 * These properties should be defined on the child, not here.
1149 */className:_shims.dontSetMe,style:_shims.dontSetMe,transform:_shims.dontSetMe}));_defineProperty(Draggable,"defaultProps",_objectSpread(_objectSpread({},_DraggableCore.default.defaultProps),{},{axis:'both',bounds:false,defaultClassName:'react-draggable',defaultClassNameDragging:'react-draggable-dragging',defaultClassNameDragged:'react-draggable-dragged',defaultPosition:{x:0,y:0},scale:1}));})(Draggable$2);var _require=Draggable$2,Draggable=_require.default,DraggableCore=_require.DraggableCore;// Previous versions of this lib exported <Draggable> as the root export. As to no-// them, or TypeScript, we export *both* as the root and as 'default'.
1150// See https://github.com/mzabriskie/react-draggable/pull/254
1151// and https://github.com/mzabriskie/react-draggable/issues/266
1152cjs.exports=Draggable;cjs.exports.default=Draggable;cjs.exports.DraggableCore=DraggableCore;var Draggable$1=cjs.exports;var Handle=styled.div(function(_ref22){var theme=_ref22.theme,isDragging=_ref22.isDragging;return{zIndex:10,position:'absolute',top:0,left:0,display:'flex',justifyContent:'center',alignItems:'center',color:isDragging?theme.color.secondary:theme.appBorderColor,overflow:'hidden',transition:'color 0.2s linear, background-position 0.2s linear, background-size 0.2s linear, background 0.2s linear','&:hover':{color:theme.color.secondary}};},function(_ref23){var axis=_ref23.axis;return{cursor:axis==='x'?'col-resize':'row-resize'};},function(_ref24){var theme=_ref24.theme,axis=_ref24.axis;return axis==='x'?{height:'100%',width:theme.layoutMargin,marginLeft:0}:{height:theme.layoutMargin,width:'100%',marginTop:0};},function(_ref25){var axis=_ref25.axis,isDragging=_ref25.isDragging;if(axis==='y'){var style={backgroundImage:"radial-gradient(at center center,rgba(0,0,0,0.2) 0%,transparent 70%,transparent 100%)",backgroundSize:'100% 50px',backgroundPosition:'50% 0',backgroundRepeat:'no-repeat'};return isDragging?style:Object.assign(Object.assign({},style),{backgroundPosition:'50% 10px','&:hover':style});}if(axis==='x'){var _style={backgroundImage:"radial-gradient(at center center,rgba(0,0,0,0.2) 0%,transparent 70%,transparent 100%)",backgroundSize:'50px 100%',backgroundPosition:'0 50%',backgroundRepeat:'no-repeat'};return isDragging?_style:Object.assign(Object.assign({},_style),{backgroundPosition:'10px 50%','&:hover':_style});}return{};});var MIN_NAV_WIDTH=200;// visually there's an additional 10px due to the canvas' left margin
1153var MIN_CANVAS_WIDTH=200;// visually it's 10px less due to the canvas' left margin
1154var MIN_CANVAS_HEIGHT=200;// visually it's 50px less due to the canvas toolbar and top margin
1155var MIN_PANEL_WIDTH=200;// visually it's 10px less due to the canvas' right margin
1156var MIN_PANEL_HEIGHT=200;// visually it's 50px less due to the panel toolbar and bottom margin
1157var DEFAULT_NAV_WIDTH=220;var DEFAULT_PANEL_WIDTH=400;var Pane=styled.div({position:'absolute',boxSizing:'border-box',top:0,left:0,width:'100%',height:'100%'},function(_ref26){var hidden=_ref26.hidden;return hidden?{opacity:0}:{opacity:1};},function(_ref27){var top=_ref27.top;return top?{zIndex:9}:{};},function(_ref28){var border=_ref28.border,theme=_ref28.theme;switch(border){case'left':{return{borderLeft:"1px solid ".concat(theme.appBorderColor)};}case'right':{return{borderRight:"1px solid ".concat(theme.appBorderColor)};}case'top':{return{borderTop:"1px solid ".concat(theme.appBorderColor)};}case'bottom':{return{borderBottom:"1px solid ".concat(theme.appBorderColor)};}default:{return{};}}},function(_ref29){var animate=_ref29.animate;return animate?{transition:['width','height','top','left','background','opacity','transform'].map(function(p){return"".concat(p," 0.1s ease-out");}).join(',')}:{};});var Paper=styled.div({position:'absolute',top:0,left:0,width:'100%',height:'100%'},function(_ref30){var isFullscreen=_ref30.isFullscreen,theme=_ref30.theme;return isFullscreen?{boxShadow:'none',borderRadius:0}:{borderRadius:theme.appBorderRadius,overflow:'hidden',boxShadow:'0 1px 5px 0 rgba(0, 0, 0, 0.1)'};});var Sidebar$2=function Sidebar$2(_a){var _a$hidden=_a.hidden,hidden=_a$hidden===void 0?false:_a$hidden,children=_a.children,_a$position=_a.position,position=_a$position===void 0?undefined:_a$position,props=__rest(_a,["hidden","children","position"]);return hidden?null:React$2.createElement(Pane,Object.assign({style:position},props),children);};var Main$1=function Main$1(_a){var _a$isFullscreen=_a.isFullscreen,isFullscreen=_a$isFullscreen===void 0?false:_a$isFullscreen,children=_a.children,_a$position2=_a.position,position=_a$position2===void 0?undefined:_a$position2,props=__rest(_a,["isFullscreen","children","position"]);return React$2.createElement(Pane,Object.assign({style:position,top:true},props,{role:"main"}),React$2.createElement(Paper,{isFullscreen:isFullscreen},children));};var Preview$1=function Preview$1(_a){var _a$hidden2=_a.hidden,hidden=_a$hidden2===void 0?false:_a$hidden2,children=_a.children,_a$position3=_a.position,position=_a$position3===void 0?undefined:_a$position3,props=__rest(_a,["hidden","children","position"]);return React$2.createElement(Pane,Object.assign({style:position,top:true,hidden:hidden},props),children);};var Panel$1=function Panel$1(_a){var _a$hidden3=_a.hidden,hidden=_a$hidden3===void 0?false:_a$hidden3,children=_a.children,_a$position4=_a.position,position=_a$position4===void 0?undefined:_a$position4,_a$align=_a.align,align=_a$align===void 0?'right':_a$align,props=__rest(_a,["hidden","children","position","align"]);return React$2.createElement(Pane,Object.assign({style:position,hidden:hidden},props,{border:align==='bottom'?'top':'left'}),children);};var HoverBlocker=styled.div({position:'absolute',left:0,top:0,zIndex:15,height:'100vh',width:'100vw'});var getPreviewPosition=function getPreviewPosition(_ref31){var panelPosition=_ref31.panelPosition,isPanelHidden=_ref31.isPanelHidden,isNavHidden=_ref31.isNavHidden,isFullscreen=_ref31.isFullscreen,bounds=_ref31.bounds,resizerPanel=_ref31.resizerPanel,resizerNav=_ref31.resizerNav,margin=_ref31.margin;if(isFullscreen||isPanelHidden){return{};}var navX=isNavHidden?0:resizerNav.x;var panelX=resizerPanel.x;var panelY=resizerPanel.y;return panelPosition==='bottom'?{height:panelY-margin,left:0,top:0,width:bounds.width-navX-2*margin}:{height:bounds.height-2*margin,left:0,top:0,width:panelX-navX-margin};};var getMainPosition=function getMainPosition(_ref32){var bounds=_ref32.bounds,resizerNav=_ref32.resizerNav,isNavHidden=_ref32.isNavHidden,isFullscreen=_ref32.isFullscreen,margin=_ref32.margin;if(isFullscreen){return{};}var navX=isNavHidden?0:resizerNav.x;return{height:bounds.height-margin*2,left:navX+margin,top:margin,width:bounds.width-navX-margin*2};};var getPanelPosition=function getPanelPosition(_ref33){var isPanelBottom=_ref33.isPanelBottom,isPanelHidden=_ref33.isPanelHidden,isNavHidden=_ref33.isNavHidden,bounds=_ref33.bounds,resizerPanel=_ref33.resizerPanel,resizerNav=_ref33.resizerNav,margin=_ref33.margin;var navX=isNavHidden?0:resizerNav.x;var panelX=resizerPanel.x;var panelY=resizerPanel.y;if(isPanelBottom&&isPanelHidden){return{height:bounds.height-panelY-margin,left:0,top:panelY-margin,width:bounds.width-navX-2*margin};}if(!isPanelBottom&&isPanelHidden){return{height:bounds.height-2*margin,left:panelX-navX-margin,top:0,width:bounds.width-panelX-margin};}return isPanelBottom?{height:bounds.height-panelY-margin,left:0,top:panelY-margin,width:bounds.width-navX-2*margin}:{height:bounds.height-2*margin,left:panelX-navX-margin,top:0,width:bounds.width-panelX-margin};};var Layout=/*#__PURE__*/function(_Component3){_inherits2(Layout,_Component3);var _super4=_createSuper2(Layout);function Layout(props){var _this10;_classCallCheck2(this,Layout);_this10=_super4.call(this,props);_this10.resizeNav=function(e,data){if(data.deltaX){_this10.setState({resizerNav:{x:data.x,y:data.y}});}};_this10.resizePanel=function(e,data){var options=_this10.props.options;if(data.deltaY&&options.panelPosition==='bottom'||data.deltaX&&options.panelPosition==='right'){_this10.setState({resizerPanel:{x:data.x,y:data.y}});}};_this10.setDragNav=function(){_this10.setState({isDragging:'nav'});};_this10.setDragPanel=function(){_this10.setState({isDragging:'panel'});};_this10.unsetDrag=function(){_this10.setState({isDragging:false});};var bounds=props.bounds,options=props.options;var _get$=get$1(),resizerNav=_get$.resizerNav,resizerPanel=_get$.resizerPanel;_this10.state={isDragging:false,resizerNav:resizerNav||{x:DEFAULT_NAV_WIDTH,y:0},resizerPanel:resizerPanel||(options.panelPosition==='bottom'?{x:0,y:Math.round(bounds.height*0.6)}:{x:bounds.width-DEFAULT_PANEL_WIDTH,y:0})};return _this10;}_createClass2(Layout,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){var _this$state=this.state,resizerPanel=_this$state.resizerPanel,resizerNav=_this$state.resizerNav;set({resizerPanel:resizerPanel,resizerNav:resizerNav});var _prevProps$bounds=prevProps.bounds,prevWidth=_prevProps$bounds.width,prevHeight=_prevProps$bounds.height;var _this$props4=this.props,bounds=_this$props4.bounds,options=_this$props4.options;var width=bounds.width,height=bounds.height;if(width!==prevWidth||height!==prevHeight){var panelPosition=options.panelPosition;var isPanelBottom=panelPosition==='bottom';if(isPanelBottom){this.setState({resizerPanel:{x:prevState.resizerPanel.x,y:prevState.resizerPanel.y-(prevHeight-height)}});}else{this.setState({resizerPanel:{x:prevState.resizerPanel.x-(prevWidth-width),y:prevState.resizerPanel.y}});}}}},{key:"render",value:function render(){var _this$props5=this.props,children=_this$props5.children,bounds=_this$props5.bounds,options=_this$props5.options,theme=_this$props5.theme,viewMode=_this$props5.viewMode,docsOnly=_this$props5.docsOnly,panelCount=_this$props5.panelCount;var _this$state2=this.state,isDragging=_this$state2.isDragging,resizerNav=_this$state2.resizerNav,resizerPanel=_this$state2.resizerPanel;var margin=theme.layoutMargin;var isNavHidden=options.isFullscreen||!options.showNav;var isPanelHidden=options.isFullscreen||!options.showPanel||docsOnly||viewMode!=='story'||panelCount===0;var isFullscreen=options.isFullscreen||isNavHidden&&isPanelHidden;var showToolbar=options.showToolbar;var panelPosition=options.panelPosition;var isPanelBottom=panelPosition==='bottom';var isPanelRight=panelPosition==='right';var panelX=resizerPanel.x;var navX=resizerNav.x;return bounds?React$2.createElement(Fragment,null,isNavHidden?null:React$2.createElement(Draggable$1,{axis:"x",position:resizerNav,bounds:{left:MIN_NAV_WIDTH,top:0,right:isPanelRight&&!isPanelHidden?panelX-MIN_CANVAS_WIDTH:bounds.width-MIN_CANVAS_WIDTH,bottom:0},onStart:this.setDragNav,onDrag:this.resizeNav,onStop:this.unsetDrag},React$2.createElement(Handle,{axis:"x",isDragging:isDragging==='nav'})),isPanelHidden?null:React$2.createElement(Draggable$1,{axis:isPanelBottom?'y':'x',position:resizerPanel,bounds:isPanelBottom?{left:0,top:MIN_CANVAS_HEIGHT,right:0,bottom:bounds.height-MIN_PANEL_HEIGHT}:{left:isNavHidden?MIN_CANVAS_WIDTH:navX+MIN_CANVAS_WIDTH,top:0,right:bounds.width-MIN_PANEL_WIDTH,bottom:0},onStart:this.setDragPanel,onDrag:this.resizePanel,onStop:this.unsetDrag},React$2.createElement(Handle,{isDragging:isDragging==='panel',style:isPanelBottom?{left:navX+margin,width:bounds.width-navX-2*margin,marginTop:-margin}:{marginLeft:-margin},axis:isPanelBottom?'y':'x'})),isDragging?React$2.createElement(HoverBlocker,null):null,children({mainProps:{viewMode:viewMode,animate:!isDragging,isFullscreen:isFullscreen,position:getMainPosition({bounds:bounds,resizerNav:resizerNav,isNavHidden:isNavHidden,isFullscreen:isFullscreen,margin:margin})},previewProps:{viewMode:viewMode,docsOnly:docsOnly,animate:!isDragging,isFullscreen:isFullscreen,showToolbar:showToolbar,position:getPreviewPosition({isFullscreen:isFullscreen,isNavHidden:isNavHidden,isPanelHidden:isPanelHidden,resizerNav:resizerNav,resizerPanel:resizerPanel,bounds:bounds,panelPosition:panelPosition,margin:margin})},navProps:{viewMode:viewMode,animate:!isDragging,hidden:isNavHidden,position:{height:bounds.height,left:0,top:0,width:navX+margin}},panelProps:{viewMode:viewMode,animate:!isDragging,align:options.panelPosition,hidden:isPanelHidden,position:getPanelPosition({isPanelBottom:isPanelBottom,isPanelHidden:isPanelHidden,isNavHidden:isNavHidden,bounds:bounds,resizerPanel:resizerPanel,resizerNav:resizerNav,margin:margin})}})):null;}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(props,state){var bounds=props.bounds,options=props.options;var resizerPanel=state.resizerPanel,resizerNav=state.resizerNav;var isNavHidden=options.isFullscreen||!options.showNav;var isPanelHidden=options.isFullscreen||!options.showPanel;var panelPosition=options.panelPosition;var isPanelRight=panelPosition==='right';var isPanelBottom=panelPosition==='bottom';var navX=resizerNav.x;var panelX=resizerPanel.x;var panelY=resizerPanel.y;var mutation={};if(!isNavHidden){var minPanelWidth=!isPanelHidden&&isPanelRight?MIN_PANEL_WIDTH:0;var minMainWidth=MIN_CANVAS_WIDTH+minPanelWidth;var maxNavX=bounds.width-minMainWidth;var minNavX=MIN_NAV_WIDTH;// coordinate translates directly to width here
1158if(navX>maxNavX){// upper bound
1159mutation.resizerNav={x:maxNavX,y:0};}else if(navX<minNavX||maxNavX<minNavX){// lower bound, supercedes upper bound if needed
1160mutation.resizerNav={x:minNavX,y:0};}}if(isPanelRight&&!isPanelHidden){var maxPanelX=bounds.width-MIN_PANEL_WIDTH;var minPanelX=navX+MIN_CANVAS_WIDTH;if(panelX>maxPanelX||panelX===0){// upper bound or when switching orientation
1161mutation.resizerPanel={x:maxPanelX,y:0};}else if(panelX<minPanelX){// lower bound
1162mutation.resizerPanel={x:minPanelX,y:0};}}if(isPanelBottom&&!isPanelHidden){var maxPanelY=bounds.height-MIN_PANEL_HEIGHT;if(panelY>maxPanelY||panelY===0){// lower bound or when switching orientation
1163mutation.resizerPanel={x:0,y:bounds.height-200};}// upper bound is enforced by the Draggable's bounds
1164}return mutation.resizerPanel||mutation.resizerNav?Object.assign(Object.assign({},state),mutation):state;}}]);return Layout;}(Component);Layout.defaultProps={viewMode:undefined,docsOnly:false};var ThemedLayout=withTheme(Layout);var Desktop=Object.assign(React$2.memo(function(_ref34){var Panel=_ref34.Panel,Sidebar=_ref34.Sidebar,Preview=_ref34.Preview,Notifications=_ref34.Notifications,pages=_ref34.pages,options=_ref34.options,_ref34$viewMode=_ref34.viewMode,viewMode=_ref34$viewMode===void 0?undefined:_ref34$viewMode,_ref34$width=_ref34.width,width=_ref34$width===void 0?0:_ref34$width,_ref34$height=_ref34.height,height=_ref34$height===void 0?0:_ref34$height,panelCount=_ref34.panelCount,_ref34$docsOnly=_ref34.docsOnly,docsOnly=_ref34$docsOnly===void 0?false:_ref34$docsOnly;return React$2.createElement(Fragment,null,React$2.createElement(Notifications,{placement:{position:'fixed',bottom:20,left:20}}),width&&height?React$2.createElement(ThemedLayout,{options:options,bounds:{width:width,height:height,top:0,left:0},viewMode:viewMode,docsOnly:!!docsOnly,panelCount:panelCount},function(_ref35){var navProps=_ref35.navProps,mainProps=_ref35.mainProps,panelProps=_ref35.panelProps,previewProps=_ref35.previewProps;return React$2.createElement(Fragment,null,React$2.createElement(Sidebar$2,Object.assign({},navProps),React$2.createElement(Sidebar,null)),React$2.createElement(Main$1,Object.assign({},mainProps,{isFullscreen:!!mainProps.isFullscreen}),React$2.createElement(Preview$1,Object.assign({},previewProps,{hidden:viewMode==='settings'}),React$2.createElement(Preview,{id:"main"})),React$2.createElement(Panel$1,Object.assign({},panelProps,{hidden:viewMode!=='story'||docsOnly}),React$2.createElement(Panel,null)),pages.map(function(_ref36){var key=_ref36.key,Route=_ref36.route,Content=_ref36.render;return React$2.createElement(Route,{key:key},React$2.createElement(Content,null));})));}):React$2.createElement("div",{title:JSON.stringify({width:width,height:height})}));}),{displayName:'DesktopLayout'});var StorybookLogoStyled=styled(StorybookLogo)({width:'auto',height:'22px !important',display:'block'});var Img$1=styled.img({width:'auto',height:'auto',display:'block',maxWidth:'100%'});var LogoLink=styled.a(function(_ref37){var theme=_ref37.theme;return{display:'inline-block',height:'100%',margin:'-3px -4px',padding:'2px 3px',border:'1px solid transparent',borderRadius:3,color:'inherit',textDecoration:'none','&:focus':{outline:0,borderColor:theme.color.secondary}};});var Brand=withTheme(function(_ref38){var theme=_ref38.theme;var _theme$brand=theme.brand,_theme$brand$title=_theme$brand.title,title=_theme$brand$title===void 0?'Storybook':_theme$brand$title,_theme$brand$url=_theme$brand.url,url=_theme$brand$url===void 0?'./':_theme$brand$url,image=_theme$brand.image,target=_theme$brand.target;var targetValue=target||(url==='./'?'':'_blank');// When image is explicitly set to null, enable custom HTML support
1165if(image===null){if(title===null)return null;// eslint-disable-next-line react/no-danger
1166if(!url)return React$2.createElement("div",{dangerouslySetInnerHTML:{__html:title}});return React$2.createElement(LogoLink,{href:url,target:targetValue,dangerouslySetInnerHTML:{__html:title}});}var logo=image?React$2.createElement(Img$1,{src:image,alt:title}):React$2.createElement(StorybookLogoStyled,{alt:title});if(url){return React$2.createElement(LogoLink,{title:title,href:url,target:targetValue},logo);}// The wrapper div serves to prevent image misalignment
1167return React$2.createElement("div",null,logo);});var sharedStyles={height:10,width:10,marginLeft:-5,marginRight:-5,display:'block'};var Icon=styled(Icons)(sharedStyles,function(_ref39){var theme=_ref39.theme;return{color:theme.color.secondary};});var Img=styled.img(sharedStyles);var Placeholder=styled.div(sharedStyles);var MenuItemIcon=function MenuItemIcon(_ref40){var icon=_ref40.icon,imgSrc=_ref40.imgSrc;if(icon){return React$2.createElement(Icon,{icon:icon});}if(imgSrc){return React$2.createElement(Img,{src:imgSrc,alt:"image"});}return React$2.createElement(Placeholder,null);};var MenuButton=styled(Button$1)(function(_ref41){var highlighted=_ref41.highlighted,theme=_ref41.theme;return Object.assign({position:'relative',overflow:'visible',padding:7,transition:'none','&:focus':{background:theme.barBg,boxShadow:'none'},// creates a pseudo border that does not affect the box model, but is accessible in high contrast mode
1168'&:focus:before':{content:'""',position:'absolute',top:0,bottom:0,left:0,right:0,borderRadius:'100%',border:"1px solid ".concat(theme.color.secondary)}},highlighted&&{'&:after':{content:'""',position:'absolute',top:0,right:0,width:8,height:8,borderRadius:8,background:theme.color.positive}});});var SidebarMenuList=function SidebarMenuList(_ref42){var menu=_ref42.menu,onHide=_ref42.onHide;var links=useMemo(function(){return menu.map(function(_a){var _onClick=_a.onClick,rest=__rest(_a,["onClick"]);return Object.assign(Object.assign({},rest),{onClick:function onClick(event,item){if(_onClick){_onClick(event,item);}onHide();}});});},[menu]);return React$2.createElement(TooltipLinkList,{links:links});};var SidebarMenu=function SidebarMenu(_ref43){var isHighlighted=_ref43.isHighlighted,menu=_ref43.menu;return React$2.createElement(WithTooltip,{placement:"top",trigger:"click",closeOnClick:true,tooltip:function tooltip(_ref44){var onHide=_ref44.onHide;return React$2.createElement(SidebarMenuList,{onHide:onHide,menu:menu});}},React$2.createElement(MenuButton,{outline:true,small:true,containsIcon:true,highlighted:isHighlighted,title:"Shortcuts"},React$2.createElement(Icons,{icon:"ellipsis"})));};var BrandArea=styled.div(function(_ref45){var theme=_ref45.theme;return{fontSize:theme.typography.size.s2,fontWeight:theme.typography.weight.bold,color:theme.color.defaultText,marginRight:20,display:'flex',width:'100%',alignItems:'center',minHeight:22,'& > *':{maxWidth:'100%',height:'auto',display:'block',flex:'1 1 auto'}};});var HeadingWrapper=styled.div({display:'flex',alignItems:'center',justifyContent:'space-between',position:'relative',minHeight:28});var SkipToCanvasLink=styled(Button$1)(function(_ref46){var theme=_ref46.theme;return{display:'none','@media (min-width: 600px)':{display:'block',position:'absolute',width:'100%',padding:'10px 15px',fontSize:theme.typography.size.s1,zIndex:1,transform:'translate(0,-100px)','&:focus':{transform:'translate(0)'}}};});var Heading=function Heading(_a){var _a$menuHighlighted=_a.menuHighlighted,menuHighlighted=_a$menuHighlighted===void 0?false:_a$menuHighlighted,menu=_a.menu,skipLinkHref=_a.skipLinkHref,props=__rest(_a,["menuHighlighted","menu","skipLinkHref"]);return React$2.createElement(HeadingWrapper,Object.assign({},props),skipLinkHref&&React$2.createElement(SkipToCanvasLink,{secondary:true,isLink:true,tabIndex:0,href:skipLinkHref},"Skip to canvas"),React$2.createElement(BrandArea,null,React$2.createElement(Brand,null)),React$2.createElement(SidebarMenu,{menu:menu,isHighlighted:menuHighlighted}));};var DEFAULT_REF_ID='storybook_internal';var collapseAllStories=function collapseAllStories(stories){// keep track of component IDs that have been rewritten to the ID of their first leaf child
1169var componentIdToLeafId={};// 1) remove all leaves
1170var leavesRemoved=Object.values(stories).filter(function(item){return!(item.isLeaf&&stories[item.parent].isComponent);});// 2) make all components leaves and rewrite their ID's to the first leaf child
1171var componentsFlattened=leavesRemoved.map(function(item){var id=item.id,isComponent=item.isComponent,children=item.children,rest=__rest(item,["id","isComponent","children"]);// this is a folder, so just leave it alone
1172if(!isComponent){return item;}var nonLeafChildren=[];var leafChildren=[];children.forEach(function(child){return(stories[child].isLeaf?leafChildren:nonLeafChildren).push(child);});if(leafChildren.length===0){return item;// pass through, we'll handle you later
1173}var leafId=leafChildren[0];var component=Object.assign(Object.assign({args:{}},rest),{id:leafId,kind:stories[leafId].kind,isRoot:false,isLeaf:true,isComponent:true,children:[]});componentIdToLeafId[id]=leafId;// this is a component, so it should not have any non-leaf children
1174if(nonLeafChildren.length!==0){throw new Error("Unexpected '".concat(item.id,"': ").concat(JSON.stringify({isComponent:isComponent,nonLeafChildren:nonLeafChildren})));}return component;});// 3) rewrite all the children as needed
1175var childrenRewritten=componentsFlattened.map(function(item){if(item.isLeaf){return item;}var children=item.children,rest=__rest(item,["children"]);var rewritten=children.map(function(child){return componentIdToLeafId[child]||child;});return Object.assign({children:rewritten},rest);});var result={};childrenRewritten.forEach(function(item){result[item.id]=item;});return result;};var collapseDocsOnlyStories=function collapseDocsOnlyStories(storiesHash){// keep track of component IDs that have been rewritten to the ID of their first leaf child
1176var componentIdToLeafId={};var docsOnlyStoriesRemoved=Object.values(storiesHash).filter(function(item){if(item.isLeaf&&item.parameters&&item.parameters.docsOnly){componentIdToLeafId[item.parent]=item.id;return false;// filter it out
1177}return true;});var docsOnlyComponentsCollapsed=docsOnlyStoriesRemoved.map(function(item){// collapse docs-only components
1178var isComponent=item.isComponent,children=item.children,id=item.id;if(isComponent&&children.length===1){var leafId=componentIdToLeafId[id];if(leafId){var collapsed=Object.assign(Object.assign({args:{}},item),{id:leafId,isLeaf:true,children:[]});return collapsed;}}// update groups
1179if(children){var rewritten=children.map(function(child){return componentIdToLeafId[child]||child;});return Object.assign(Object.assign({},item),{children:rewritten});}// pass through stories unmodified
1180return item;});var result={};docsOnlyComponentsCollapsed.forEach(function(item){result[item.id]=item;});return result;};function _extends$1(){_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;};return _extends$1.apply(this,arguments);}function _assertThisInitialized$1(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _setPrototypeOf$1(o,p){_setPrototypeOf$1=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf$1(o,p);}function _inheritsLoose$1(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;_setPrototypeOf$1(subClass,superClass);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _isNativeFunction(fn){return Function.toString.call(fn).indexOf("[native code]")!==-1;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _construct(Parent,args,Class){if(_isNativeReflectConstruct()){_construct=Reflect.construct;}else{_construct=function _construct(Parent,args,Class){var a=[null];a.push.apply(a,args);var Constructor=Function.bind.apply(Parent,a);var instance=new Constructor();if(Class)_setPrototypeOf$1(instance,Class.prototype);return instance;};}return _construct.apply(null,arguments);}function _wrapNativeSuper(Class){var _cache=typeof Map==="function"?new Map():undefined;_wrapNativeSuper=function _wrapNativeSuper(Class){if(Class===null||!_isNativeFunction(Class))return Class;if(typeof Class!=="function"){throw new TypeError("Super expression must either be null or a function");}if(typeof _cache!=="undefined"){if(_cache.has(Class))return _cache.get(Class);_cache.set(Class,Wrapper);}function Wrapper(){return _construct(Class,arguments,_getPrototypeOf(this).constructor);}Wrapper.prototype=Object.create(Class.prototype,{constructor:{value:Wrapper,enumerable:false,writable:true,configurable:true}});return _setPrototypeOf$1(Wrapper,Class);};return _wrapNativeSuper(Class);}/**
1181 * Parse errors.md and turn it into a simple hash of code: message
1182 * @private
1183 */var ERRORS={"1":"Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).\n\n","2":"Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).\n\n","3":"Passed an incorrect argument to a color function, please pass a string representation of a color.\n\n","4":"Couldn't generate valid rgb string from %s, it returned %s.\n\n","5":"Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.\n\n","6":"Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).\n\n","7":"Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).\n\n","8":"Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.\n\n","9":"Please provide a number of steps to the modularScale helper.\n\n","10":"Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n","11":"Invalid value passed as base to modularScale, expected number or em string but got \"%s\"\n\n","12":"Expected a string ending in \"px\" or a number passed as the first argument to %s(), got \"%s\" instead.\n\n","13":"Expected a string ending in \"px\" or a number passed as the second argument to %s(), got \"%s\" instead.\n\n","14":"Passed invalid pixel value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n","15":"Passed invalid base value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n","16":"You must provide a template to this method.\n\n","17":"You passed an unsupported selector state to this method.\n\n","18":"minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n","19":"fromSize and toSize must be provided as stringified numbers with the same units.\n\n","20":"expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n","21":"expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n","22":"expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n","23":"fontFace expects a name of a font-family.\n\n","24":"fontFace expects either the path to the font file(s) or a name of a local copy.\n\n","25":"fontFace expects localFonts to be an array.\n\n","26":"fontFace expects fileFormats to be an array.\n\n","27":"radialGradient requries at least 2 color-stops to properly render.\n\n","28":"Please supply a filename to retinaImage() as the first argument.\n\n","29":"Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n","30":"Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n","31":"The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation\n\n","32":"To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')\n\n","33":"The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation\n\n","34":"borderRadius expects a radius value as a string or number as the second argument.\n\n","35":"borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n","36":"Property must be a string value.\n\n","37":"Syntax Error at %s.\n\n","38":"Formula contains a function that needs parentheses at %s.\n\n","39":"Formula is missing closing parenthesis at %s.\n\n","40":"Formula has too many closing parentheses at %s.\n\n","41":"All values in a formula must have the same unit or be unitless.\n\n","42":"Please provide a number of steps to the modularScale helper.\n\n","43":"Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n","44":"Invalid value passed as base to modularScale, expected number or em/rem string but got %s.\n\n","45":"Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.\n\n","46":"Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.\n\n","47":"minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n","48":"fromSize and toSize must be provided as stringified numbers with the same units.\n\n","49":"Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n","50":"Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.\n\n","51":"Expects the first argument object to have the properties prop, fromSize, and toSize.\n\n","52":"fontFace expects either the path to the font file(s) or a name of a local copy.\n\n","53":"fontFace expects localFonts to be an array.\n\n","54":"fontFace expects fileFormats to be an array.\n\n","55":"fontFace expects a name of a font-family.\n\n","56":"linearGradient requries at least 2 color-stops to properly render.\n\n","57":"radialGradient requries at least 2 color-stops to properly render.\n\n","58":"Please supply a filename to retinaImage() as the first argument.\n\n","59":"Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n","60":"Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n","61":"Property must be a string value.\n\n","62":"borderRadius expects a radius value as a string or number as the second argument.\n\n","63":"borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n","64":"The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.\n\n","65":"To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').\n\n","66":"The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.\n\n","67":"You must provide a template to this method.\n\n","68":"You passed an unsupported selector state to this method.\n\n","69":"Expected a string ending in \"px\" or a number passed as the first argument to %s(), got %s instead.\n\n","70":"Expected a string ending in \"px\" or a number passed as the second argument to %s(), got %s instead.\n\n","71":"Passed invalid pixel value %s to %s(), please pass a value like \"12px\" or 12.\n\n","72":"Passed invalid base value %s to %s(), please pass a value like \"12px\" or 12.\n\n","73":"Please provide a valid CSS variable.\n\n","74":"CSS variable not found and no default was provided.\n\n","75":"important requires a valid style object, got a %s instead.\n\n","76":"fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n\n","77":"remToPx expects a value in \"rem\" but you provided it in \"%s\".\n\n","78":"base must be set in \"px\" or \"%\" but you set it in \"%s\".\n"};/**
1184 * super basic version of sprintf
1185 * @private
1186 */function format$1(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var a=args[0];var b=[];var c;for(c=1;c<args.length;c+=1){b.push(args[c]);}b.forEach(function(d){a=a.replace(/%[a-z]/,d);});return a;}/**
1187 * Create an error file out of errors.md for development and a simple web link to the full errors
1188 * in production mode.
1189 * @private
1190 */var PolishedError=/*#__PURE__*/function(_Error){_inheritsLoose$1(PolishedError,_Error);function PolishedError(code){var _this;if(process.env.NODE_ENV==='production'){_this=_Error.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+code+" for more information.")||this;}else{for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}_this=_Error.call(this,format$1.apply(void 0,[ERRORS[code]].concat(args)))||this;}return _assertThisInitialized$1(_this);}return PolishedError;}(/*#__PURE__*/_wrapNativeSuper(Error));function colorToInt(color){return Math.round(color*255);}function convertToInt(red,green,blue){return colorToInt(red)+","+colorToInt(green)+","+colorToInt(blue);}function hslToRgb(hue,saturation,lightness,convert){if(convert===void 0){convert=convertToInt;}if(saturation===0){// achromatic
1191return convert(lightness,lightness,lightness);}// formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
1192var huePrime=(hue%360+360)%360/60;var chroma=(1-Math.abs(2*lightness-1))*saturation;var secondComponent=chroma*(1-Math.abs(huePrime%2-1));var red=0;var green=0;var blue=0;if(huePrime>=0&&huePrime<1){red=chroma;green=secondComponent;}else if(huePrime>=1&&huePrime<2){red=secondComponent;green=chroma;}else if(huePrime>=2&&huePrime<3){green=chroma;blue=secondComponent;}else if(huePrime>=3&&huePrime<4){green=secondComponent;blue=chroma;}else if(huePrime>=4&&huePrime<5){red=secondComponent;blue=chroma;}else if(huePrime>=5&&huePrime<6){red=chroma;blue=secondComponent;}var lightnessModification=lightness-chroma/2;var finalRed=red+lightnessModification;var finalGreen=green+lightnessModification;var finalBlue=blue+lightnessModification;return convert(finalRed,finalGreen,finalBlue);}var namedColorMap={aliceblue:'f0f8ff',antiquewhite:'faebd7',aqua:'00ffff',aquamarine:'7fffd4',azure:'f0ffff',beige:'f5f5dc',bisque:'ffe4c4',black:'000',blanchedalmond:'ffebcd',blue:'0000ff',blueviolet:'8a2be2',brown:'a52a2a',burlywood:'deb887',cadetblue:'5f9ea0',chartreuse:'7fff00',chocolate:'d2691e',coral:'ff7f50',cornflowerblue:'6495ed',cornsilk:'fff8dc',crimson:'dc143c',cyan:'00ffff',darkblue:'00008b',darkcyan:'008b8b',darkgoldenrod:'b8860b',darkgray:'a9a9a9',darkgreen:'006400',darkgrey:'a9a9a9',darkkhaki:'bdb76b',darkmagenta:'8b008b',darkolivegreen:'556b2f',darkorange:'ff8c00',darkorchid:'9932cc',darkred:'8b0000',darksalmon:'e9967a',darkseagreen:'8fbc8f',darkslateblue:'483d8b',darkslategray:'2f4f4f',darkslategrey:'2f4f4f',darkturquoise:'00ced1',darkviolet:'9400d3',deeppink:'ff1493',deepskyblue:'00bfff',dimgray:'696969',dimgrey:'696969',dodgerblue:'1e90ff',firebrick:'b22222',floralwhite:'fffaf0',forestgreen:'228b22',fuchsia:'ff00ff',gainsboro:'dcdcdc',ghostwhite:'f8f8ff',gold:'ffd700',goldenrod:'daa520',gray:'808080',green:'008000',greenyellow:'adff2f',grey:'808080',honeydew:'f0fff0',hotpink:'ff69b4',indianred:'cd5c5c',indigo:'4b0082',ivory:'fffff0',khaki:'f0e68c',lavender:'e6e6fa',lavenderblush:'fff0f5',lawngreen:'7cfc00',lemonchiffon:'fffacd',lightblue:'add8e6',lightcoral:'f08080',lightcyan:'e0ffff',lightgoldenrodyellow:'fafad2',lightgray:'d3d3d3',lightgreen:'90ee90',lightgrey:'d3d3d3',lightpink:'ffb6c1',lightsalmon:'ffa07a',lightseagreen:'20b2aa',lightskyblue:'87cefa',lightslategray:'789',lightslategrey:'789',lightsteelblue:'b0c4de',lightyellow:'ffffe0',lime:'0f0',limegreen:'32cd32',linen:'faf0e6',magenta:'f0f',maroon:'800000',mediumaquamarine:'66cdaa',mediumblue:'0000cd',mediumorchid:'ba55d3',mediumpurple:'9370db',mediumseagreen:'3cb371',mediumslateblue:'7b68ee',mediumspringgreen:'00fa9a',mediumturquoise:'48d1cc',mediumvioletred:'c71585',midnightblue:'191970',mintcream:'f5fffa',mistyrose:'ffe4e1',moccasin:'ffe4b5',navajowhite:'ffdead',navy:'000080',oldlace:'fdf5e6',olive:'808000',olivedrab:'6b8e23',orange:'ffa500',orangered:'ff4500',orchid:'da70d6',palegoldenrod:'eee8aa',palegreen:'98fb98',paleturquoise:'afeeee',palevioletred:'db7093',papayawhip:'ffefd5',peachpuff:'ffdab9',peru:'cd853f',pink:'ffc0cb',plum:'dda0dd',powderblue:'b0e0e6',purple:'800080',rebeccapurple:'639',red:'f00',rosybrown:'bc8f8f',royalblue:'4169e1',saddlebrown:'8b4513',salmon:'fa8072',sandybrown:'f4a460',seagreen:'2e8b57',seashell:'fff5ee',sienna:'a0522d',silver:'c0c0c0',skyblue:'87ceeb',slateblue:'6a5acd',slategray:'708090',slategrey:'708090',snow:'fffafa',springgreen:'00ff7f',steelblue:'4682b4',tan:'d2b48c',teal:'008080',thistle:'d8bfd8',tomato:'ff6347',turquoise:'40e0d0',violet:'ee82ee',wheat:'f5deb3',white:'fff',whitesmoke:'f5f5f5',yellow:'ff0',yellowgreen:'9acd32'};/**
1193 * Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
1194 * @private
1195 */function nameToHex(color){if(typeof color!=='string')return color;var normalizedColorName=color.toLowerCase();return namedColorMap[normalizedColorName]?"#"+namedColorMap[normalizedColorName]:color;}var hexRegex=/^#[a-fA-F0-9]{6}$/;var hexRgbaRegex=/^#[a-fA-F0-9]{8}$/;var reducedHexRegex=/^#[a-fA-F0-9]{3}$/;var reducedRgbaHexRegex=/^#[a-fA-F0-9]{4}$/;var rgbRegex=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i;var rgbaRegex=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;var hslRegex=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;var hslaRegex=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;/**
1196 * Returns an RgbColor or RgbaColor object. This utility function is only useful
1197 * if want to extract a color component. With the color util `toColorString` you
1198 * can convert a RgbColor or RgbaColor object back to a string.
1199 *
1200 * @example
1201 * // Assigns `{ red: 255, green: 0, blue: 0 }` to color1
1202 * const color1 = parseToRgb('rgb(255, 0, 0)');
1203 * // Assigns `{ red: 92, green: 102, blue: 112, alpha: 0.75 }` to color2
1204 * const color2 = parseToRgb('hsla(210, 10%, 40%, 0.75)');
1205 */function parseToRgb(color){if(typeof color!=='string'){throw new PolishedError(3);}var normalizedColor=nameToHex(color);if(normalizedColor.match(hexRegex)){return{red:parseInt(""+normalizedColor[1]+normalizedColor[2],16),green:parseInt(""+normalizedColor[3]+normalizedColor[4],16),blue:parseInt(""+normalizedColor[5]+normalizedColor[6],16)};}if(normalizedColor.match(hexRgbaRegex)){var alpha=parseFloat((parseInt(""+normalizedColor[7]+normalizedColor[8],16)/255).toFixed(2));return{red:parseInt(""+normalizedColor[1]+normalizedColor[2],16),green:parseInt(""+normalizedColor[3]+normalizedColor[4],16),blue:parseInt(""+normalizedColor[5]+normalizedColor[6],16),alpha:alpha};}if(normalizedColor.match(reducedHexRegex)){return{red:parseInt(""+normalizedColor[1]+normalizedColor[1],16),green:parseInt(""+normalizedColor[2]+normalizedColor[2],16),blue:parseInt(""+normalizedColor[3]+normalizedColor[3],16)};}if(normalizedColor.match(reducedRgbaHexRegex)){var _alpha=parseFloat((parseInt(""+normalizedColor[4]+normalizedColor[4],16)/255).toFixed(2));return{red:parseInt(""+normalizedColor[1]+normalizedColor[1],16),green:parseInt(""+normalizedColor[2]+normalizedColor[2],16),blue:parseInt(""+normalizedColor[3]+normalizedColor[3],16),alpha:_alpha};}var rgbMatched=rgbRegex.exec(normalizedColor);if(rgbMatched){return{red:parseInt(""+rgbMatched[1],10),green:parseInt(""+rgbMatched[2],10),blue:parseInt(""+rgbMatched[3],10)};}var rgbaMatched=rgbaRegex.exec(normalizedColor.substring(0,50));if(rgbaMatched){return{red:parseInt(""+rgbaMatched[1],10),green:parseInt(""+rgbaMatched[2],10),blue:parseInt(""+rgbaMatched[3],10),alpha:parseFloat(""+rgbaMatched[4])>1?parseFloat(""+rgbaMatched[4])/100:parseFloat(""+rgbaMatched[4])};}var hslMatched=hslRegex.exec(normalizedColor);if(hslMatched){var hue=parseInt(""+hslMatched[1],10);var saturation=parseInt(""+hslMatched[2],10)/100;var lightness=parseInt(""+hslMatched[3],10)/100;var rgbColorString="rgb("+hslToRgb(hue,saturation,lightness)+")";var hslRgbMatched=rgbRegex.exec(rgbColorString);if(!hslRgbMatched){throw new PolishedError(4,normalizedColor,rgbColorString);}return{red:parseInt(""+hslRgbMatched[1],10),green:parseInt(""+hslRgbMatched[2],10),blue:parseInt(""+hslRgbMatched[3],10)};}var hslaMatched=hslaRegex.exec(normalizedColor.substring(0,50));if(hslaMatched){var _hue=parseInt(""+hslaMatched[1],10);var _saturation=parseInt(""+hslaMatched[2],10)/100;var _lightness=parseInt(""+hslaMatched[3],10)/100;var _rgbColorString="rgb("+hslToRgb(_hue,_saturation,_lightness)+")";var _hslRgbMatched=rgbRegex.exec(_rgbColorString);if(!_hslRgbMatched){throw new PolishedError(4,normalizedColor,_rgbColorString);}return{red:parseInt(""+_hslRgbMatched[1],10),green:parseInt(""+_hslRgbMatched[2],10),blue:parseInt(""+_hslRgbMatched[3],10),alpha:parseFloat(""+hslaMatched[4])>1?parseFloat(""+hslaMatched[4])/100:parseFloat(""+hslaMatched[4])};}throw new PolishedError(5);}/**
1206 * Reduces hex values if possible e.g. #ff8866 to #f86
1207 * @private
1208 */var reduceHexValue=function reduceHexValue(value){if(value.length===7&&value[1]===value[2]&&value[3]===value[4]&&value[5]===value[6]){return"#"+value[1]+value[3]+value[5];}return value;};var reduceHexValue$1=reduceHexValue;function numberToHex(value){var hex=value.toString(16);return hex.length===1?"0"+hex:hex;}/**
1209 * Returns a string value for the color. The returned result is the smallest possible hex notation.
1210 *
1211 * @example
1212 * // Styles as object usage
1213 * const styles = {
1214 * background: rgb(255, 205, 100),
1215 * background: rgb({ red: 255, green: 205, blue: 100 }),
1216 * }
1217 *
1218 * // styled-components usage
1219 * const div = styled.div`
1220 * background: ${rgb(255, 205, 100)};
1221 * background: ${rgb({ red: 255, green: 205, blue: 100 })};
1222 * `
1223 *
1224 * // CSS in JS Output
1225 *
1226 * element {
1227 * background: "#ffcd64";
1228 * background: "#ffcd64";
1229 * }
1230 */function rgb(value,green,blue){if(typeof value==='number'&&typeof green==='number'&&typeof blue==='number'){return reduceHexValue$1("#"+numberToHex(value)+numberToHex(green)+numberToHex(blue));}else if(_typeof2(value)==='object'&&green===undefined&&blue===undefined){return reduceHexValue$1("#"+numberToHex(value.red)+numberToHex(value.green)+numberToHex(value.blue));}throw new PolishedError(6);}/**
1231 * Returns a string value for the color. The returned result is the smallest possible rgba or hex notation.
1232 *
1233 * Can also be used to fade a color by passing a hex value or named CSS color along with an alpha value.
1234 *
1235 * @example
1236 * // Styles as object usage
1237 * const styles = {
1238 * background: rgba(255, 205, 100, 0.7),
1239 * background: rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 }),
1240 * background: rgba(255, 205, 100, 1),
1241 * background: rgba('#ffffff', 0.4),
1242 * background: rgba('black', 0.7),
1243 * }
1244 *
1245 * // styled-components usage
1246 * const div = styled.div`
1247 * background: ${rgba(255, 205, 100, 0.7)};
1248 * background: ${rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 })};
1249 * background: ${rgba(255, 205, 100, 1)};
1250 * background: ${rgba('#ffffff', 0.4)};
1251 * background: ${rgba('black', 0.7)};
1252 * `
1253 *
1254 * // CSS in JS Output
1255 *
1256 * element {
1257 * background: "rgba(255,205,100,0.7)";
1258 * background: "rgba(255,205,100,0.7)";
1259 * background: "#ffcd64";
1260 * background: "rgba(255,255,255,0.4)";
1261 * background: "rgba(0,0,0,0.7)";
1262 * }
1263 */function rgba(firstValue,secondValue,thirdValue,fourthValue){if(typeof firstValue==='string'&&typeof secondValue==='number'){var rgbValue=parseToRgb(firstValue);return"rgba("+rgbValue.red+","+rgbValue.green+","+rgbValue.blue+","+secondValue+")";}else if(typeof firstValue==='number'&&typeof secondValue==='number'&&typeof thirdValue==='number'&&typeof fourthValue==='number'){return fourthValue>=1?rgb(firstValue,secondValue,thirdValue):"rgba("+firstValue+","+secondValue+","+thirdValue+","+fourthValue+")";}else if(_typeof2(firstValue)==='object'&&secondValue===undefined&&thirdValue===undefined&&fourthValue===undefined){return firstValue.alpha>=1?rgb(firstValue.red,firstValue.green,firstValue.blue):"rgba("+firstValue.red+","+firstValue.green+","+firstValue.blue+","+firstValue.alpha+")";}throw new PolishedError(7);}// eslint-disable-next-line no-unused-vars
1264// eslint-disable-next-line no-unused-vars
1265// eslint-disable-next-line no-redeclare
1266function curried(f,length,acc){return function fn(){// eslint-disable-next-line prefer-rest-params
1267var combined=acc.concat(Array.prototype.slice.call(arguments));return combined.length>=length?f.apply(this,combined):curried(f,length,combined);};}// eslint-disable-next-line no-redeclare
1268function curry(f){// eslint-disable-line no-redeclare
1269return curried(f,f.length,[]);}function guard(lowerBoundary,upperBoundary,value){return Math.max(lowerBoundary,Math.min(upperBoundary,value));}/**
1270 * Decreases the opacity of a color. Its range for the amount is between 0 to 1.
1271 *
1272 *
1273 * @example
1274 * // Styles as object usage
1275 * const styles = {
1276 * background: transparentize(0.1, '#fff'),
1277 * background: transparentize(0.2, 'hsl(0, 0%, 100%)'),
1278 * background: transparentize('0.5', 'rgba(255, 0, 0, 0.8)'),
1279 * }
1280 *
1281 * // styled-components usage
1282 * const div = styled.div`
1283 * background: ${transparentize(0.1, '#fff')};
1284 * background: ${transparentize(0.2, 'hsl(0, 0%, 100%)')};
1285 * background: ${transparentize('0.5', 'rgba(255, 0, 0, 0.8)')};
1286 * `
1287 *
1288 * // CSS in JS Output
1289 *
1290 * element {
1291 * background: "rgba(255,255,255,0.9)";
1292 * background: "rgba(255,255,255,0.8)";
1293 * background: "rgba(255,0,0,0.3)";
1294 * }
1295 */function transparentize(amount,color){if(color==='transparent')return color;var parsedColor=parseToRgb(color);var alpha=typeof parsedColor.alpha==='number'?parsedColor.alpha:1;var colorWithAlpha=_extends$1({},parsedColor,{alpha:guard(0,1,+(alpha*100-parseFloat(amount)*100).toFixed(2)/100)});return rgba(colorWithAlpha);}// prettier-ignore
1296var curriedTransparentize=/*#__PURE__*/curry/* ::<number | string, string, string> */(transparentize);var curriedTransparentize$1=curriedTransparentize;var LOADER_SEQUENCE=[0,0,1,1,2,3,3,3,1,1,1,2,2,2,3];var Loadingitem=styled.div({cursor:'progress',fontSize:13,height:'16px',marginTop:4,marginBottom:4,alignItems:'center',overflow:'hidden'},function(_ref47){var _ref47$depth=_ref47.depth,depth=_ref47$depth===void 0?0:_ref47$depth;return{marginLeft:depth*15,maxWidth:85-depth*5};},function(_ref48){var theme=_ref48.theme;return theme.animation.inlineGlow;},function(_ref49){var theme=_ref49.theme;return{background:theme.appBorderColor};});var Contained=styled.div({display:'flex',flexDirection:'column',paddingLeft:20,paddingRight:20});var Loader=function Loader(_ref50){var size=_ref50.size;var repeats=Math.ceil(size/LOADER_SEQUENCE.length);// Creates an array that repeats LOADER_SEQUENCE depths in order, until the size is reached.
1297var sequence=Array.from(Array(repeats)).fill(LOADER_SEQUENCE).flat().slice(0,size);return React$2.createElement(Fragment,null,sequence.map(function(depth,index){return(// eslint-disable-next-line react/no-array-index-key
1298React$2.createElement(Loadingitem,{depth:depth,key:index}));}));};var globalWindow$3=window_1.window,document$8=window_1.document;var TextStyle=styled.div(function(_ref51){var theme=_ref51.theme;return{fontSize:theme.typography.size.s2-1,lineHeight:'20px',margin:0};});var Text=styled.div(function(_ref52){var theme=_ref52.theme;return{fontSize:theme.typography.size.s2-1,lineHeight:'20px',margin:0,code:{fontSize:theme.typography.size.s1},ul:{paddingLeft:20,marginTop:8,marginBottom:8}};});var ErrorDisplay=styled.pre({width:420,boxSizing:'border-box',borderRadius:8,overflow:'auto',whiteSpace:'pre'},function(_ref53){var theme=_ref53.theme;return{color:theme.color.dark};});var ErrorName=styled.strong(function(_ref54){var theme=_ref54.theme;return{color:theme.color.orange};});var ErrorImportant=styled.strong(function(_ref55){var theme=_ref55.theme;return{color:theme.color.ancillary,textDecoration:'underline'};});var ErrorDetail=styled.em(function(_ref56){var theme=_ref56.theme;return{color:theme.color.mediumdark};});var firstLineRegex=/(Error): (.*)\n/;var linesRegex=/at (?:(.*) )?\(?(.+)\)?/;var ErrorFormatter=function ErrorFormatter(_ref57){var error=_ref57.error;if(!error){return React$2.createElement(Fragment,null,"This error has no stack or message");}if(!error.stack){return React$2.createElement(Fragment,null,error.message||'This error has no stack or message');}var input=error.stack.toString();var match=input.match(firstLineRegex);if(!match){return React$2.createElement(Fragment,null,input);}var _match=_slicedToArray2(match,3),type=_match[1],name=_match[2];var rawLines=input.split(/\n/).slice(1);var _rawLines$map$filter=rawLines.map(function(line){var r=line.match(linesRegex);return r?{name:r[1],location:r[2].replace(document$8.location.origin,'')}:null;}).filter(Boolean),_rawLines$map$filter2=_toArray(_rawLines$map$filter),lines=_rawLines$map$filter2.slice(1);return React$2.createElement(Fragment,null,React$2.createElement("span",null,type),": ",React$2.createElement(ErrorName,null,name),React$2.createElement("br",null),lines.map(function(l,i){return l.name?// eslint-disable-next-line react/no-array-index-key
1299React$2.createElement(Fragment,{key:i},' ',"at ",React$2.createElement(ErrorImportant,null,l.name)," (",React$2.createElement(ErrorDetail,null,l.location),")",React$2.createElement("br",null)):// eslint-disable-next-line react/no-array-index-key
1300React$2.createElement(Fragment,{key:i},' ',"at ",React$2.createElement(ErrorDetail,null,l.location),React$2.createElement("br",null));}));};var AuthBlock=function AuthBlock(_ref58){var loginUrl=_ref58.loginUrl,id=_ref58.id;var _useState=useState(false),_useState2=_slicedToArray2(_useState,2),isAuthAttempted=_useState2[0],setAuthAttempted=_useState2[1];var refresh=useCallback(function(){globalWindow$3.document.location.reload();},[]);var open=useCallback(function(e){e.preventDefault();var childWindow=globalWindow$3.open(loginUrl,"storybook_auth_".concat(id),'resizable,scrollbars');// poll for window to close
1301var timer=setInterval(function(){if(!childWindow){logger.error('unable to access loginUrl window');clearInterval(timer);}else if(childWindow.closed){clearInterval(timer);setAuthAttempted(true);}},1000);},[]);return React$2.createElement(Contained,null,React$2.createElement(Spaced,null,isAuthAttempted?React$2.createElement(Fragment,null,React$2.createElement(Text,null,"Authentication on ",React$2.createElement("strong",null,loginUrl)," concluded. Refresh the page to fetch this Storybook."),React$2.createElement("div",null,React$2.createElement(Button$1,{small:true,gray:true,onClick:refresh},React$2.createElement(Icons,{icon:"sync"}),"Refresh now"))):React$2.createElement(Fragment,null,React$2.createElement(Text,null,"Sign in to browse this Storybook."),React$2.createElement("div",null,React$2.createElement(Button$1,{small:true,gray:true,onClick:open},React$2.createElement(Icons,{icon:"lock"}),"Sign in")))));};var ErrorBlock=function ErrorBlock(_ref59){var error=_ref59.error;return React$2.createElement(Contained,null,React$2.createElement(Spaced,null,React$2.createElement(TextStyle,null,"Oh no! Something went wrong loading this Storybook.",React$2.createElement("br",null),React$2.createElement(WithTooltip,{trigger:"click",closeOnClick:false,tooltip:React$2.createElement(ErrorDisplay,null,React$2.createElement(ErrorFormatter,{error:error}))},React$2.createElement(Link,{isButton:true},"View error ",React$2.createElement(Icons,{icon:"arrowdown"}))),' ',React$2.createElement(Link,{withArrow:true,href:"https://storybook.js.org/docs",cancel:false,target:"_blank"},"View docs"))));};var FlexSpaced=styled(Spaced)({display:'flex'});var WideSpaced=styled(Spaced)({flex:1});var EmptyBlock=function EmptyBlock(_ref60){var isMain=_ref60.isMain;return React$2.createElement(Contained,null,React$2.createElement(FlexSpaced,{col:1},React$2.createElement(WideSpaced,null,React$2.createElement(Text,null,isMain?React$2.createElement(React$2.Fragment,null,"Oh no! Your Storybook is empty. Possible reasons why:",React$2.createElement("ul",null,React$2.createElement("li",null,"The glob specified in ",React$2.createElement("code",null,"main.js")," isn't correct."),React$2.createElement("li",null,"No stories are defined in your story files.")),' '):React$2.createElement(React$2.Fragment,null,"Yikes! Something went wrong loading these stories.")))));};var LoaderBlock=function LoaderBlock(_ref61){var isMain=_ref61.isMain;return React$2.createElement(Contained,null,React$2.createElement(Loader,{size:isMain?17:5}));};var document$7=window_1.document,globalWindow$2=window_1.window;var IndicatorPlacement=styled.aside(function(_ref62){var theme=_ref62.theme;return{height:16,display:'flex',alignItems:'center','& > * + *':{marginLeft:theme.layoutMargin}};});var IndicatorClickTarget=styled.button(function(_ref63){var theme=_ref63.theme;return{height:20,width:20,padding:0,margin:0,display:'flex',alignItems:'center',justifyContent:'center',background:'transparent',outline:'none',border:'1px solid transparent',borderRadius:'100%',cursor:'pointer',color:theme.base==='light'?curriedTransparentize$1(0.3,theme.color.defaultText):curriedTransparentize$1(0.6,theme.color.defaultText),'&:hover':{color:theme.barSelectedColor},'&:focus':{color:theme.barSelectedColor,borderColor:theme.color.secondary},svg:{height:10,width:10,transition:'all 150ms ease-out',color:'inherit'}};});var MessageTitle=styled.span(function(_ref64){var theme=_ref64.theme;return{fontWeight:theme.typography.weight.bold};});var Message$1=styled.a(function(_ref65){var theme=_ref65.theme;return{textDecoration:'none',lineHeight:'16px',padding:15,display:'flex',flexDirection:'row',alignItems:'flex-start',color:theme.color.defaultText,'&:not(:last-child)':{borderBottom:"1px solid ".concat(theme.appBorderColor)},'&:hover':{background:theme.background.hoverable,color:theme.color.darker},'&:link':{color:theme.color.darker},'&:active':{color:theme.color.darker},'&:focus':{color:theme.color.darker},'& > *':{flex:1},'& > svg':{marginTop:3,width:16,height:16,marginRight:10,flex:'unset'}};});var MessageWrapper=styled.div({width:280,boxSizing:'border-box',borderRadius:8,overflow:'hidden'});var BlueIcon=styled(Icons)(function(_ref66){var theme=_ref66.theme;return{color:theme.color.secondary};});var YellowIcon=styled(Icons)(function(_ref67){var theme=_ref67.theme;return{color:theme.color.gold};});var RedIcon=styled(Icons)(function(_ref68){var theme=_ref68.theme;return{color:theme.color.negative};});var GreenIcon=styled(Icons)(function(_ref69){var theme=_ref69.theme;return{color:theme.color.green};});var Version=styled.div(function(_ref70){var theme=_ref70.theme;return{display:'flex',alignItems:'center',fontSize:theme.typography.size.s1,fontWeight:theme.typography.weight.regular,color:theme.base==='light'?curriedTransparentize$1(0.3,theme.color.defaultText):curriedTransparentize$1(0.6,theme.color.defaultText),'& > * + *':{marginLeft:4},svg:{height:10,width:10}};});var CurrentVersion=function CurrentVersion(_ref71){var url=_ref71.url,versions=_ref71.versions;var currentVersionId=useMemo(function(){var c=Object.entries(versions).find(function(_ref72){var _ref73=_slicedToArray2(_ref72,2),k=_ref73[0],v=_ref73[1];return v===url;});return c&&c[0]?c[0]:'current';},[url,versions]);return React$2.createElement(Version,null,React$2.createElement("span",null,currentVersionId),React$2.createElement(Icons,{icon:"chevrondown"}));};var RefIndicator=React$2.memo(forwardRef(function(_a,forwardedRef){var state=_a.state,ref=__rest(_a,["state"]);var api=useStorybookApi();var list=useMemo(function(){return Object.values(ref.stories||{});},[ref.stories]);var componentCount=useMemo(function(){return list.filter(function(v){return v.isComponent;}).length;},[list]);var leafCount=useMemo(function(){return list.filter(function(v){return v.isLeaf;}).length;},[list]);var changeVersion=useCallback(function(event,item){event.preventDefault();api.changeRefVersion(ref.id,item.href);},[]);return React$2.createElement(IndicatorPlacement,{ref:forwardedRef},React$2.createElement(WithTooltip,{placement:"bottom-start",trigger:"click",tooltip:React$2.createElement(MessageWrapper,null,React$2.createElement(Spaced,{row:0},state==='loading'&&React$2.createElement(LoadingMessage,{url:ref.url}),(state==='error'||state==='empty')&&React$2.createElement(ErrorOccurredMessage,{url:ref.url}),state==='ready'&&React$2.createElement(ReadyMessage,Object.assign({},{url:ref.url,componentCount:componentCount,leafCount:leafCount})),state==='auth'&&React$2.createElement(LoginRequiredMessage,Object.assign({},ref)),ref.type==='auto-inject'&&state!=='error'&&React$2.createElement(PerformanceDegradedMessage,null),state!=='loading'&&React$2.createElement(ReadDocsMessage,null)))},React$2.createElement(IndicatorClickTarget,{"data-action":"toggle-indicator","aria-label":"toggle indicator"},React$2.createElement(Icons,{icon:"globe"}))),ref.versions&&Object.keys(ref.versions).length?React$2.createElement(WithTooltip,{placement:"bottom-start",trigger:"click",tooltip:React$2.createElement(TooltipLinkList,{links:Object.entries(ref.versions).map(function(_ref74){var _ref75=_slicedToArray2(_ref74,2),id=_ref75[0],href=_ref75[1];return{left:href===ref.url?React$2.createElement(MenuItemIcon,{icon:"check"}):React$2.createElement("span",null),id:id,title:id,href:href,onClick:changeVersion};})})},React$2.createElement(CurrentVersion,{url:ref.url,versions:ref.versions})):null);}));var ReadyMessage=function ReadyMessage(_ref76){var url=_ref76.url,componentCount=_ref76.componentCount,leafCount=_ref76.leafCount;return React$2.createElement(Message$1,{href:url.replace(/\/?$/,'/index.html'),target:"_blank"},React$2.createElement(BlueIcon,{icon:"globe"}),React$2.createElement("div",null,React$2.createElement(MessageTitle,null,"View external Storybook"),React$2.createElement("div",null,"Explore ",componentCount," components and ",leafCount," stories in a new browser tab.")));};var LoginRequiredMessage=function LoginRequiredMessage(_ref77){var loginUrl=_ref77.loginUrl,id=_ref77.id;var open=useCallback(function(e){e.preventDefault();var childWindow=globalWindow$2.open(loginUrl,"storybook_auth_".concat(id),'resizable,scrollbars');// poll for window to close
1302var timer=setInterval(function(){if(!childWindow){clearInterval(timer);}else if(childWindow.closed){clearInterval(timer);document$7.location.reload();}},1000);},[]);return React$2.createElement(Message$1,{onClick:open},React$2.createElement(YellowIcon,{icon:"lock"}),React$2.createElement("div",null,React$2.createElement(MessageTitle,null,"Log in required"),React$2.createElement("div",null,"You need to authenticate to view this Storybook's components.")));};var ReadDocsMessage=function ReadDocsMessage(){return React$2.createElement(Message$1,{href:"https://storybook.js.org",target:"_blank"},React$2.createElement(GreenIcon,{icon:"document"}),React$2.createElement("div",null,React$2.createElement(MessageTitle,null,"Read Composition docs"),React$2.createElement("div",null,"Learn how to combine multiple Storybooks into one.")));};var ErrorOccurredMessage=function ErrorOccurredMessage(_ref78){var url=_ref78.url;return React$2.createElement(Message$1,{href:url.replace(/\/?$/,'/index.html'),target:"_blank"},React$2.createElement(RedIcon,{icon:"alert"}),React$2.createElement("div",null,React$2.createElement(MessageTitle,null,"Something went wrong"),React$2.createElement("div",null,"This external Storybook didn't load. Debug it in a new tab now.")));};var LoadingMessage=function LoadingMessage(_ref79){var url=_ref79.url;return React$2.createElement(Message$1,{href:url.replace(/\/?$/,'/index.html'),target:"_blank"},React$2.createElement(BlueIcon,{icon:"time"}),React$2.createElement("div",null,React$2.createElement(MessageTitle,null,"Please wait"),React$2.createElement("div",null,"This Storybook is loading.")));};var PerformanceDegradedMessage=function PerformanceDegradedMessage(){return React$2.createElement(Message$1,{href:"https://storybook.js.org/docs",target:"_blank"},React$2.createElement(YellowIcon,{icon:"lightning"}),React$2.createElement("div",null,React$2.createElement(MessageTitle,null,"Reduce lag"),React$2.createElement("div",null,"Learn how to speed up Composition performance.")));};var DOCS_MODE$4=window_1.DOCS_MODE;var CollapseIcon=styled.span(function(_ref80){var theme=_ref80.theme,isExpanded=_ref80.isExpanded;return{display:'inline-block',width:0,height:0,marginTop:6,marginLeft:8,marginRight:5,color:curriedTransparentize$1(0.4,theme.color.mediumdark),borderTop:'3px solid transparent',borderBottom:'3px solid transparent',borderLeft:"3px solid",transform:isExpanded?'rotateZ(90deg)':'none',transition:'transform .1s ease-out'};});var iconColors={light:{document:DOCS_MODE$4?'secondary':'#ff8300',bookmarkhollow:'seafoam',component:'secondary',folder:'ultraviolet'},dark:{document:DOCS_MODE$4?'secondary':'gold',bookmarkhollow:'seafoam',component:'secondary',folder:'primary'}};var isColor=function isColor(theme,color){return color in theme.color;};var TypeIcon=styled(Icons)({width:12,height:12,padding:1,marginTop:3,marginRight:5,flex:'0 0 auto'},function(_ref81){var theme=_ref81.theme,icon=_ref81.icon,_ref81$symbol=_ref81.symbol,symbol=_ref81$symbol===void 0?icon:_ref81$symbol;var colors=theme.base==='dark'?iconColors.dark:iconColors.light;var color=colors[symbol];return{color:isColor(theme,color)?theme.color[color]:color};});var BranchNode=styled.button(function(_ref82){var theme=_ref82.theme,_ref82$depth=_ref82.depth,depth=_ref82$depth===void 0?0:_ref82$depth,_ref82$isExpandable=_ref82.isExpandable,isExpandable=_ref82$isExpandable===void 0?false:_ref82$isExpandable;return{width:'100%',border:'none',cursor:'pointer',display:'flex',alignItems:'start',textAlign:'left',padding:3,paddingLeft:"".concat((isExpandable?2:18)+depth*16,"px"),color:'inherit',fontSize:"".concat(theme.typography.size.s2-1,"px"),background:'transparent','&:hover, &:focus':{background:theme.background.hoverable,outline:'none'}};});var LeafNode=styled.a(function(_ref83){var theme=_ref83.theme,_ref83$depth=_ref83.depth,depth=_ref83$depth===void 0?0:_ref83$depth;return{cursor:'pointer',display:'flex',alignItems:'start',padding:3,paddingLeft:"".concat(18+depth*16,"px"),fontSize:"".concat(theme.typography.size.s2-1,"px"),textDecoration:'none',color:theme.color.defaultText,background:'transparent','&:hover, &:focus':{outline:'none',background:theme.background.hoverable},'&[data-selected="true"]':{color:theme.color.lightest,background:theme.color.secondary,fontWeight:theme.typography.weight.bold,'&:hover, &:focus':{background:theme.color.secondary},svg:{color:theme.color.lightest}}};});var Path=styled.span(function(_ref84){var theme=_ref84.theme;return{display:'grid',justifyContent:'start',gridAutoColumns:'auto',gridAutoFlow:'column',color:theme.textMutedColor,fontSize:"".concat(theme.typography.size.s1-1,"px"),'& > span':{whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis'},'& > span + span':{position:'relative',marginLeft:4,paddingLeft:7,'&:before':{content:"'/'",position:'absolute',left:0}}};});var RootNode=styled.div(function(_ref85){var theme=_ref85.theme;return{display:'flex',alignItems:'center',justifyContent:'space-between',padding:'0 20px',marginTop:16,marginBottom:4,fontSize:"".concat(theme.typography.size.s1-1,"px"),fontWeight:theme.typography.weight.black,lineHeight:'16px',minHeight:20,letterSpacing:'0.35em',textTransform:'uppercase',color:theme.color.mediumdark};});var GroupNode=React$2.memo(function(_a){var children=_a.children,_a$isExpanded=_a.isExpanded,isExpanded=_a$isExpanded===void 0?false:_a$isExpanded,_a$isExpandable=_a.isExpandable,isExpandable=_a$isExpandable===void 0?false:_a$isExpandable,props=__rest(_a,["children","isExpanded","isExpandable"]);return React$2.createElement(BranchNode,Object.assign({isExpandable:isExpandable,tabIndex:-1},props),isExpandable?React$2.createElement(CollapseIcon,{isExpanded:isExpanded}):null,React$2.createElement(TypeIcon,{symbol:"folder",color:"primary"}),children);});var ComponentNode=React$2.memo(function(_a){var theme=_a.theme,children=_a.children,isExpanded=_a.isExpanded,isExpandable=_a.isExpandable,isSelected=_a.isSelected,props=__rest(_a,["theme","children","isExpanded","isExpandable","isSelected"]);return React$2.createElement(BranchNode,Object.assign({isExpandable:isExpandable,tabIndex:-1},props),isExpandable&&React$2.createElement(CollapseIcon,{isExpanded:isExpanded}),React$2.createElement(TypeIcon,{symbol:"component",color:"secondary"}),children);});var DocumentNode=React$2.memo(function(_a){var theme=_a.theme,children=_a.children,props=__rest(_a,["theme","children"]);return React$2.createElement(LeafNode,Object.assign({tabIndex:-1},props),React$2.createElement(TypeIcon,{symbol:"document"}),children);});var StoryNode=React$2.memo(function(_a){var theme=_a.theme,children=_a.children,props=__rest(_a,["theme","children"]);return React$2.createElement(LeafNode,Object.assign({tabIndex:-1},props),React$2.createElement(TypeIcon,{symbol:"bookmarkhollow"}),children);});var debounce$1=debounce_1,isObject=isObject_1;/** Error message constants. */var FUNC_ERROR_TEXT='Expected a function';/**
1303 * Creates a throttled function that only invokes `func` at most once per
1304 * every `wait` milliseconds. The throttled function comes with a `cancel`
1305 * method to cancel delayed `func` invocations and a `flush` method to
1306 * immediately invoke them. Provide `options` to indicate whether `func`
1307 * should be invoked on the leading and/or trailing edge of the `wait`
1308 * timeout. The `func` is invoked with the last arguments provided to the
1309 * throttled function. Subsequent calls to the throttled function return the
1310 * result of the last `func` invocation.
1311 *
1312 * **Note:** If `leading` and `trailing` options are `true`, `func` is
1313 * invoked on the trailing edge of the timeout only if the throttled function
1314 * is invoked more than once during the `wait` timeout.
1315 *
1316 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
1317 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
1318 *
1319 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
1320 * for details over the differences between `_.throttle` and `_.debounce`.
1321 *
1322 * @static
1323 * @memberOf _
1324 * @since 0.1.0
1325 * @category Function
1326 * @param {Function} func The function to throttle.
1327 * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
1328 * @param {Object} [options={}] The options object.
1329 * @param {boolean} [options.leading=true]
1330 * Specify invoking on the leading edge of the timeout.
1331 * @param {boolean} [options.trailing=true]
1332 * Specify invoking on the trailing edge of the timeout.
1333 * @returns {Function} Returns the new throttled function.
1334 * @example
1335 *
1336 * // Avoid excessively updating the position while scrolling.
1337 * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
1338 *
1339 * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
1340 * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
1341 * jQuery(element).on('click', throttled);
1342 *
1343 * // Cancel the trailing throttled invocation.
1344 * jQuery(window).on('popstate', throttled.cancel);
1345 */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$1(func,wait,{'leading':leading,'maxWait':wait,'trailing':trailing});}var throttle_1=throttle;var codeToKeyMap={// event.code => event.key
1346Space:' ',Slash:'/',ArrowLeft:'ArrowLeft',ArrowUp:'ArrowUp',ArrowRight:'ArrowRight',ArrowDown:'ArrowDown',Escape:'Escape',Enter:'Enter'};var allFalse={alt:false,ctrl:false,meta:false,shift:false};var matchesModifiers=function matchesModifiers(modifiers,event){var _ref86=modifiers===false?allFalse:modifiers,alt=_ref86.alt,ctrl=_ref86.ctrl,meta=_ref86.meta,shift=_ref86.shift;if(typeof alt==='boolean'&&alt!==event.altKey)return false;if(typeof ctrl==='boolean'&&ctrl!==event.ctrlKey)return false;if(typeof meta==='boolean'&&meta!==event.metaKey)return false;if(typeof shift==='boolean'&&shift!==event.shiftKey)return false;return true;};var matchesKeyCode=function matchesKeyCode(code,event){// event.code is preferable but not supported in IE
1347return event.code?event.code===code:event.key===codeToKeyMap[code];};var document$6=window_1.document,globalWindow$1=window_1.window,DOCS_MODE$3=window_1.DOCS_MODE;var createId=function createId(itemId,refId){return!refId||refId===DEFAULT_REF_ID?itemId:"".concat(refId,"_").concat(itemId);};var getLink=function getLink(itemId,refId){var type=DOCS_MODE$3?'docs':'story';return"".concat(document$6.location.pathname,"?path=/").concat(type,"/").concat(createId(itemId,refId));};var get=memoize(1000)(function(id,dataset){return dataset[id];});var getParent=memoize(1000)(function(id,dataset){var item=get(id,dataset);return item&&!isRoot(item)?get(item.parent,dataset):undefined;});var getParents=memoize(1000)(function(id,dataset){var parent=getParent(id,dataset);return parent?[parent].concat(_toConsumableArray(getParents(parent.id,dataset))):[];});var getAncestorIds=memoize(1000)(function(data,id){return getParents(id,data).map(function(item){return item.id;});});var getDescendantIds=memoize(1000)(function(data,id,skipLeafs){var _ref87=data[id]||{},_ref87$children=_ref87.children,children=_ref87$children===void 0?[]:_ref87$children;return children.reduce(function(acc,childId){if(!data[childId]||skipLeafs&&data[childId].isLeaf)return acc;acc.push.apply(acc,[childId].concat(_toConsumableArray(getDescendantIds(data,childId,skipLeafs))));return acc;},[]);});function getPath(item,ref){var parent=!isRoot(item)&&item.parent?ref.stories[item.parent]:null;if(parent)return[].concat(_toConsumableArray(getPath(parent,ref)),[parent.name]);return ref.id===DEFAULT_REF_ID?[]:[ref.title||ref.id];}var searchItem=function searchItem(item,ref){return Object.assign(Object.assign({},item),{refId:ref.id,path:getPath(item,ref)});};function cycle(array,index,delta){var next=index+delta%array.length;if(next<0)next=array.length+next;if(next>=array.length)next-=array.length;return next;}var scrollIntoView$1=function scrollIntoView$1(element){var center=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(!element)return;var _element$getBoundingC=element.getBoundingClientRect(),top=_element$getBoundingC.top,bottom=_element$getBoundingC.bottom;var isInView=top>=0&&bottom<=(globalWindow$1.innerHeight||document$6.documentElement.clientHeight);if(!isInView)element.scrollIntoView({block:center?'center':'nearest'});};var getStateType=function getStateType(isLoading,isAuthRequired,isError,isEmpty){switch(true){case isAuthRequired:return'auth';case isError:return'error';case isLoading:return'loading';case isEmpty:return'empty';default:return'ready';}};var isAncestor=function isAncestor(element,maybeAncestor){if(!element||!maybeAncestor)return false;if(element===maybeAncestor)return true;return isAncestor(element.parentElement,maybeAncestor);};var removeNoiseFromName=function removeNoiseFromName(storyName){return storyName.replaceAll(/(\s|-|_)/gi,'');};var isStoryHoistable=function isStoryHoistable(storyName,componentName){return removeNoiseFromName(storyName)===removeNoiseFromName(componentName);};var document$5=window_1.document;var initializeExpanded=function initializeExpanded(_ref88){var refId=_ref88.refId,data=_ref88.data,initialExpanded=_ref88.initialExpanded,highlightedRef=_ref88.highlightedRef,rootIds=_ref88.rootIds;var _a,_b;var highlightedAncestors=((_a=highlightedRef.current)===null||_a===void 0?void 0:_a.refId)===refId?getAncestorIds(data,(_b=highlightedRef.current)===null||_b===void 0?void 0:_b.itemId):[];return[].concat(_toConsumableArray(rootIds),_toConsumableArray(highlightedAncestors)).reduce(function(acc,id){return Object.assign(acc,_defineProperty2({},id,id in initialExpanded?initialExpanded[id]:true));},{});};var noop$1=function noop$1(){};var useExpanded=function useExpanded(_ref89){var containerRef=_ref89.containerRef,isBrowsing=_ref89.isBrowsing,refId=_ref89.refId,data=_ref89.data,initialExpanded=_ref89.initialExpanded,rootIds=_ref89.rootIds,highlightedRef=_ref89.highlightedRef,setHighlightedItemId=_ref89.setHighlightedItemId,selectedStoryId=_ref89.selectedStoryId,onSelectStoryId=_ref89.onSelectStoryId;var api=useStorybookApi();// Track the set of currently expanded nodes within this tree.
1348// Root nodes are expanded by default.
1349var _useReducer=useReducer(function(state,_ref90){var ids=_ref90.ids,value=_ref90.value;return ids.reduce(function(acc,id){return Object.assign(acc,_defineProperty2({},id,value));},Object.assign({},state));},{refId:refId,data:data,highlightedRef:highlightedRef,rootIds:rootIds,initialExpanded:initialExpanded},initializeExpanded),_useReducer2=_slicedToArray2(_useReducer,2),expanded=_useReducer2[0],setExpanded=_useReducer2[1];var getElementByDataItemId=useCallback(function(id){var _a;return(_a=containerRef.current)===null||_a===void 0?void 0:_a.querySelector("[data-item-id=\"".concat(id,"\"]"));},[containerRef]);var highlightElement=useCallback(function(element){setHighlightedItemId(element.getAttribute('data-item-id'));scrollIntoView$1(element);},[setHighlightedItemId]);var updateExpanded=useCallback(function(_ref91){var ids=_ref91.ids,value=_ref91.value;var _a;setExpanded({ids:ids,value:value});if(ids.length===1){var element=(_a=containerRef.current)===null||_a===void 0?void 0:_a.querySelector("[data-item-id=\"".concat(ids[0],"\"][data-ref-id=\"").concat(refId,"\"]"));if(element)highlightElement(element);}},[containerRef,highlightElement,refId]);// Expand the whole ancestry of the currently selected story whenever it changes.
1350useEffect(function(){setExpanded({ids:getAncestorIds(data,selectedStoryId),value:true});},[data,selectedStoryId]);var collapseAll=useCallback(function(){var ids=Object.keys(data).filter(function(id){return!rootIds.includes(id);});setExpanded({ids:ids,value:false});},[data,rootIds]);var expandAll=useCallback(function(){setExpanded({ids:Object.keys(data),value:true});},[data]);useEffect(function(){if(!api)return noop$1;api.on(STORIES_COLLAPSE_ALL,collapseAll);api.on(STORIES_EXPAND_ALL,expandAll);return function(){api.off(STORIES_COLLAPSE_ALL,collapseAll);api.off(STORIES_EXPAND_ALL,expandAll);};},[api,collapseAll,expandAll]);// Expand, collapse or select nodes in the tree using keyboard shortcuts.
1351useEffect(function(){var menuElement=document$5.getElementById('storybook-explorer-menu');// Even though we ignore repeated events, use throttle because IE doesn't support event.repeat.
1352var navigateTree=throttle_1(function(event){var _a,_b;var highlightedItemId=((_a=highlightedRef.current)===null||_a===void 0?void 0:_a.refId)===refId&&((_b=highlightedRef.current)===null||_b===void 0?void 0:_b.itemId);if(!isBrowsing||!containerRef.current||!highlightedItemId||event.repeat)return;if(!matchesModifiers(false,event))return;var isEnter=matchesKeyCode('Enter',event);var isSpace=matchesKeyCode('Space',event);var isArrowLeft=matchesKeyCode('ArrowLeft',event);var isArrowRight=matchesKeyCode('ArrowRight',event);if(!(isEnter||isSpace||isArrowLeft||isArrowRight))return;var highlightedElement=getElementByDataItemId(highlightedItemId);if(!highlightedElement||highlightedElement.getAttribute('data-ref-id')!==refId)return;var target=event.target;if(!isAncestor(menuElement,target)&&!isAncestor(target,menuElement))return;if(target.hasAttribute('data-action')){if(isEnter||isSpace)return;target.blur();}var type=highlightedElement.getAttribute('data-nodetype');if((isEnter||isSpace)&&['component','story','document'].includes(type)){onSelectStoryId(highlightedItemId);}var isExpanded=highlightedElement.getAttribute('aria-expanded');if(isArrowLeft){if(isExpanded==='true'){// The highlighted node is expanded, so we collapse it.
1353setExpanded({ids:[highlightedItemId],value:false});return;}var parentId=highlightedElement.getAttribute('data-parent-id');var parentElement=parentId&&getElementByDataItemId(parentId);if(parentElement&&parentElement.getAttribute('data-highlightable')==='true'){// The highlighted node isn't expanded, so we move the highlight to its parent instead.
1354highlightElement(parentElement);return;}// The parent can't be highlighted, which means it must be a root.
1355// The highlighted node is already collapsed, so we collapse its descendants.
1356setExpanded({ids:getDescendantIds(data,highlightedItemId,true),value:false});return;}if(isArrowRight){if(isExpanded==='false'){updateExpanded({ids:[highlightedItemId],value:true});}else if(isExpanded==='true'){updateExpanded({ids:getDescendantIds(data,highlightedItemId,true),value:true});}}},60);document$5.addEventListener('keydown',navigateTree);return function(){return document$5.removeEventListener('keydown',navigateTree);};},[containerRef,isBrowsing,refId,data,highlightedRef,setHighlightedItemId,onSelectStoryId]);return[expanded,updateExpanded];};var Action=styled.button(function(_ref92){var theme=_ref92.theme;return{display:'inline-flex',alignItems:'center',justifyContent:'center',width:20,height:20,margin:0,marginLeft:'auto',padding:0,outline:0,lineHeight:'normal',background:'none',border:"1px solid transparent",borderRadius:'100%',cursor:'pointer',transition:'all 150ms ease-out',color:theme.base==='light'?curriedTransparentize$1(0.3,theme.color.defaultText):curriedTransparentize$1(0.6,theme.color.defaultText),'&:hover':{color:theme.color.secondary},'&:focus':{color:theme.color.secondary,borderColor:theme.color.secondary,'&:not(:focus-visible)':{borderColor:'transparent'}},svg:{width:10,height:10}};});var CollapseButton$1=styled.button(function(_ref93){var theme=_ref93.theme;return{// Reset button
1357background:'transparent',border:'none',outline:'none',boxSizing:'content-box',cursor:'pointer',position:'relative',textAlign:'left',lineHeight:'normal',font:'inherit',color:'inherit',letterSpacing:'inherit',textTransform:'inherit',display:'flex',flex:'0 1 auto',padding:'3px 10px 1px 1px',margin:0,marginLeft:-19,overflow:'hidden',borderRadius:26,transition:'color 150ms, box-shadow 150ms','span:first-of-type':{marginTop:4,marginRight:7},'&:focus':{boxShadow:"0 0 0 1px ".concat(theme.color.secondary),color:theme.color.secondary,'span:first-of-type':{color:theme.color.secondary},'&:not(:focus-visible)':{boxShadow:'none'}}};});var LeafNodeStyleWrapper=styled.div(function(_ref94){var theme=_ref94.theme;return{position:'relative'};});var SkipToContentLink=styled(Button$1)(function(_ref95){var theme=_ref95.theme;return{display:'none','@media (min-width: 600px)':{display:'block',zIndex:-1,position:'absolute',top:1,right:20,height:'20px',fontSize:'10px',padding:'5px 10px','&:focus':{background:'white',zIndex:1}}};});var Node=React$2.memo(function(_ref96){var item=_ref96.item,refId=_ref96.refId,isOrphan=_ref96.isOrphan,isDisplayed=_ref96.isDisplayed,isSelected=_ref96.isSelected,isFullyExpanded=_ref96.isFullyExpanded,setFullyExpanded=_ref96.setFullyExpanded,isExpanded=_ref96.isExpanded,setExpanded=_ref96.setExpanded,onSelectStoryId=_ref96.onSelectStoryId;var _a,_b,_c;if(!isDisplayed)return null;var id=createId(item.id,refId);if(isStory(item)){var _LeafNode=item.isComponent?DocumentNode:StoryNode;return React$2.createElement(LeafNodeStyleWrapper,null,React$2.createElement(_LeafNode,{key:id,id:id,className:"sidebar-item","data-ref-id":refId,"data-item-id":item.id,"data-parent-id":item.parent,"data-nodetype":item.isComponent?'document':'story',"data-selected":isSelected,"data-highlightable":isDisplayed,depth:isOrphan?item.depth:item.depth-1,href:getLink(item.id,refId),onClick:function onClick(event){event.preventDefault();onSelectStoryId(item.id);}},((_a=item.renderLabel)===null||_a===void 0?void 0:_a.call(item,item))||item.name),isSelected&&React$2.createElement(SkipToContentLink,{secondary:true,outline:true,isLink:true,href:"#storybook-preview-wrapper"},"Skip to canvas"));}if(isRoot(item)){return React$2.createElement(RootNode,{key:id,id:id,className:"sidebar-subheading","data-ref-id":refId,"data-item-id":item.id,"data-nodetype":"root"},React$2.createElement(CollapseButton$1,{type:"button","data-action":"collapse-root",onClick:function onClick(event){event.preventDefault();setExpanded({ids:[item.id],value:!isExpanded});},"aria-expanded":isExpanded},React$2.createElement(CollapseIcon,{isExpanded:isExpanded}),((_b=item.renderLabel)===null||_b===void 0?void 0:_b.call(item,item))||item.name),isExpanded&&React$2.createElement(Action,{type:"button",className:"sidebar-subheading-action","aria-label":"expand","data-action":"expand-all","data-expanded":isFullyExpanded,onClick:function onClick(event){event.preventDefault();setFullyExpanded();}},React$2.createElement(Icons,{icon:isFullyExpanded?'collapse':'expandalt'})));}var BranchNode=item.isComponent?ComponentNode:GroupNode;return React$2.createElement(BranchNode,{key:id,id:id,className:"sidebar-item","data-ref-id":refId,"data-item-id":item.id,"data-parent-id":item.parent,"data-nodetype":item.isComponent?'component':'group',"data-highlightable":isDisplayed,"aria-controls":item.children&&item.children[0],"aria-expanded":isExpanded,depth:isOrphan?item.depth:item.depth-1,isComponent:item.isComponent,isExpandable:item.children&&item.children.length>0,isExpanded:isExpanded,onClick:function onClick(event){event.preventDefault();setExpanded({ids:[item.id],value:!isExpanded});if(item.isComponent&&!isExpanded)onSelectStoryId(item.id);}},((_c=item.renderLabel)===null||_c===void 0?void 0:_c.call(item,item))||item.name);});var Root$1=React$2.memo(function(_a){var setExpanded=_a.setExpanded,isFullyExpanded=_a.isFullyExpanded,expandableDescendants=_a.expandableDescendants,props=__rest(_a,["setExpanded","isFullyExpanded","expandableDescendants"]);var setFullyExpanded=useCallback(function(){return setExpanded({ids:expandableDescendants,value:!isFullyExpanded});},[setExpanded,isFullyExpanded,expandableDescendants]);return React$2.createElement(Node,Object.assign({},props,{setExpanded:setExpanded,isFullyExpanded:isFullyExpanded,setFullyExpanded:setFullyExpanded}));});var Container$4=styled.div(function(props){return{marginTop:props.hasOrphans?20:0,marginBottom:20};});var Tree=React$2.memo(function(_ref97){var isBrowsing=_ref97.isBrowsing,isMain=_ref97.isMain,refId=_ref97.refId,data=_ref97.data,highlightedRef=_ref97.highlightedRef,setHighlightedItemId=_ref97.setHighlightedItemId,selectedStoryId=_ref97.selectedStoryId,onSelectStoryId=_ref97.onSelectStoryId;var containerRef=useRef(null);// Find top-level nodes and group them so we can hoist any orphans and expand any roots.
1358var _useMemo=useMemo(function(){return Object.keys(data).reduce(function(acc,id){var item=data[id];if(isRoot(item))acc[0].push(id);else if(!item.parent)acc[1].push(id);if(isRoot(item)&&item.startCollapsed)acc[2][id]=false;return acc;},[[],[],{}]);},[data]),_useMemo2=_slicedToArray2(_useMemo,3),rootIds=_useMemo2[0],orphanIds=_useMemo2[1],initialExpanded=_useMemo2[2];// Pull up (hoist) any "orphan" items that don't have a root item as ancestor so they get
1359// displayed at the top of the tree, before any root items.
1360// Also create a map of expandable descendants for each root/orphan item, which is needed later.
1361// Doing that here is a performance enhancement, as it avoids traversing the tree again later.
1362var _useMemo3=useMemo(function(){return orphanIds.concat(rootIds).reduce(function(acc,nodeId){var _acc$orphansFirst;var descendantIds=getDescendantIds(data,nodeId,false);(_acc$orphansFirst=acc.orphansFirst).push.apply(_acc$orphansFirst,[nodeId].concat(_toConsumableArray(descendantIds)));acc.expandableDescendants[nodeId]=descendantIds.filter(function(d){return!data[d].isLeaf;});return acc;},{orphansFirst:[],expandableDescendants:{}});},[data,rootIds,orphanIds]),orphansFirst=_useMemo3.orphansFirst,expandableDescendants=_useMemo3.expandableDescendants;// Create a list of component IDs which have exactly one story, which name exactly matches the component name.
1363var singleStoryComponentIds=useMemo(function(){return orphansFirst.filter(function(nodeId){var _data$nodeId=data[nodeId],_data$nodeId$children=_data$nodeId.children,children=_data$nodeId$children===void 0?[]:_data$nodeId$children,isComponent=_data$nodeId.isComponent,isLeaf=_data$nodeId.isLeaf,name=_data$nodeId.name;return!isLeaf&&isComponent&&children.length===1&&isStory(data[children[0]])&&isStoryHoistable(data[children[0]].name,name);});},[data,orphansFirst]);// Omit single-story components from the list of nodes.
1364var collapsedItems=useMemo(function(){return orphansFirst.filter(function(id){return!singleStoryComponentIds.includes(id);});},[orphanIds,orphansFirst,singleStoryComponentIds]);// Rewrite the dataset to place the child story in place of the component.
1365var collapsedData=useMemo(function(){return singleStoryComponentIds.reduce(function(acc,id){var _data$id=data[id],children=_data$id.children,parent=_data$id.parent;var _children=_slicedToArray2(children,1),childId=_children[0];if(parent){var siblings=_toConsumableArray(data[parent].children);siblings[siblings.indexOf(id)]=childId;acc[parent]=Object.assign(Object.assign({},data[parent]),{children:siblings});}acc[childId]=Object.assign(Object.assign({},data[childId]),{parent:parent,depth:data[childId].depth-1});return acc;},Object.assign({},data));},[data]);var ancestry=useMemo(function(){return collapsedItems.reduce(function(acc,id){return Object.assign(acc,_defineProperty2({},id,getAncestorIds(collapsedData,id)));},{});},[collapsedItems,collapsedData]);// Track expanded nodes, keep it in sync with props and enable keyboard shortcuts.
1366var _useExpanded=useExpanded({containerRef:containerRef,isBrowsing:isBrowsing,refId:refId,data:collapsedData,initialExpanded:initialExpanded,rootIds:rootIds,highlightedRef:highlightedRef,setHighlightedItemId:setHighlightedItemId,selectedStoryId:selectedStoryId,onSelectStoryId:onSelectStoryId}),_useExpanded2=_slicedToArray2(_useExpanded,2),expanded=_useExpanded2[0],setExpanded=_useExpanded2[1];return React$2.createElement(Container$4,{ref:containerRef,hasOrphans:isMain&&orphanIds.length>0},collapsedItems.map(function(itemId){var item=collapsedData[itemId];var id=createId(itemId,refId);if(isRoot(item)){var descendants=expandableDescendants[item.id];var isFullyExpanded=descendants.every(function(d){return expanded[d];});return React$2.createElement(Root$1,{key:id,item:item,refId:refId,isOrphan:false,isDisplayed:true,isSelected:selectedStoryId===itemId,isExpanded:!!expanded[itemId],setExpanded:setExpanded,isFullyExpanded:isFullyExpanded,expandableDescendants:descendants,onSelectStoryId:onSelectStoryId});}var isDisplayed=!item.parent||ancestry[itemId].every(function(a){return expanded[a];});return React$2.createElement(Node,{key:id,item:item,refId:refId,isOrphan:orphanIds.some(function(oid){return itemId===oid||itemId.startsWith("".concat(oid,"-"));}),isDisplayed:isDisplayed,isSelected:selectedStoryId===itemId,isExpanded:!!expanded[itemId],setExpanded:setExpanded,onSelectStoryId:onSelectStoryId});}));});var Wrapper=styled.div(function(_ref98){var isMain=_ref98.isMain;return{position:'relative',marginLeft:-20,marginRight:-20,marginTop:isMain?undefined:0};});var RefHead=styled.div(function(_ref99){var theme=_ref99.theme;return{fontWeight:theme.typography.weight.black,fontSize:theme.typography.size.s2-1,// Similar to ListItem.tsx
1367textDecoration:'none',lineHeight:'16px',display:'flex',alignItems:'center',justifyContent:'space-between',background:'transparent',width:'100%',marginTop:20,paddingTop:16,borderTop:"1px solid ".concat(theme.appBorderColor),color:theme.base==='light'?theme.color.defaultText:curriedTransparentize$1(0.2,theme.color.defaultText)};});var RefTitle=styled.span(function(_ref100){var theme=_ref100.theme;return{display:'block',textOverflow:'ellipsis',whiteSpace:'nowrap',flex:1,overflow:'hidden',marginLeft:2};});var CollapseButton=styled.button(function(_ref101){var theme=_ref101.theme;return{// Reset button
1368background:'transparent',border:'1px solid transparent',borderRadius:26,outline:'none',boxSizing:'content-box',cursor:'pointer',position:'relative',textAlign:'left',lineHeight:'normal',font:'inherit',color:'inherit',display:'flex',padding:3,paddingLeft:1,paddingRight:12,margin:0,marginLeft:-20,overflow:'hidden','span:first-of-type':{marginTop:5},'&:focus':{borderColor:theme.color.secondary,'span:first-of-type':{borderLeftColor:theme.color.secondary}}};});var Ref=React$2.memo(function(props){var api=useStorybookApi();var stories=props.stories,refId=props.id,_props$title=props.title,title=_props$title===void 0?refId:_props$title,isLoadingMain=props.isLoading,isBrowsing=props.isBrowsing,selectedStoryId=props.selectedStoryId,highlightedRef=props.highlightedRef,setHighlighted=props.setHighlighted,loginUrl=props.loginUrl,type=props.type,_props$expanded=props.expanded,expanded=_props$expanded===void 0?true:_props$expanded,ready=props.ready,error=props.error;var length=useMemo(function(){return stories?Object.keys(stories).length:0;},[stories]);var indicatorRef=useRef(null);var isMain=refId===DEFAULT_REF_ID;var isLoadingInjected=type==='auto-inject'&&!ready;var isLoading=isLoadingMain||isLoadingInjected||type==='unknown';var isError=!!error;var isEmpty=!isLoading&&length===0;var isAuthRequired=!!loginUrl&&length===0;var state=getStateType(isLoading,isAuthRequired,isError,isEmpty);var _useState3=useState(expanded),_useState4=_slicedToArray2(_useState3,2),isExpanded=_useState4[0],setExpanded=_useState4[1];var handleClick=useCallback(function(){return setExpanded(function(value){return!value;});},[setExpanded]);var setHighlightedItemId=useCallback(function(itemId){return setHighlighted({itemId:itemId,refId:refId});},[setHighlighted]);var onSelectStoryId=useCallback(function(storyId){return api&&api.selectStory(storyId,undefined,{ref:!isMain&&refId});},[api,isMain,refId]);return React$2.createElement(React$2.Fragment,null,isMain||React$2.createElement(RefHead,{"aria-label":"".concat(isExpanded?'Hide':'Show'," ").concat(title," stories"),"aria-expanded":isExpanded},React$2.createElement(CollapseButton,{"data-action":"collapse-ref",onClick:handleClick},React$2.createElement(CollapseIcon,{isExpanded:isExpanded}),React$2.createElement(RefTitle,{title:title},title)),React$2.createElement(RefIndicator,Object.assign({},props,{state:state,ref:indicatorRef}))),isExpanded&&React$2.createElement(Wrapper,{"data-title":title,isMain:isMain},state==='auth'&&React$2.createElement(AuthBlock,{id:refId,loginUrl:loginUrl}),state==='error'&&React$2.createElement(ErrorBlock,{error:error}),state==='loading'&&React$2.createElement(LoaderBlock,{isMain:isMain}),state==='empty'&&React$2.createElement(EmptyBlock,{isMain:isMain}),state==='ready'&&React$2.createElement(Tree,{isBrowsing:isBrowsing,isMain:isMain,refId:refId,data:stories,selectedStoryId:selectedStoryId,onSelectStoryId:onSelectStoryId,highlightedRef:highlightedRef,setHighlightedItemId:setHighlightedItemId})));});var document$4=window_1.document,globalWindow=window_1.window;var fromSelection=function fromSelection(selection){return selection?{itemId:selection.storyId,refId:selection.refId}:null;};var useHighlighted=function useHighlighted(_ref102){var containerRef=_ref102.containerRef,isLoading=_ref102.isLoading,isBrowsing=_ref102.isBrowsing,dataset=_ref102.dataset,selected=_ref102.selected;var initialHighlight=fromSelection(selected);var highlightedRef=useRef(initialHighlight);var _useState5=useState(initialHighlight),_useState6=_slicedToArray2(_useState5,2),highlighted=_useState6[0],setHighlighted=_useState6[1];var updateHighlighted=useCallback(function(highlight){highlightedRef.current=highlight;setHighlighted(highlight);},[highlightedRef]);// Sets the highlighted node and scrolls it into view, using DOM elements as reference
1369var highlightElement=useCallback(function(element){var center=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var itemId=element.getAttribute('data-item-id');var refId=element.getAttribute('data-ref-id');if(!itemId||!refId)return;updateHighlighted({itemId:itemId,refId:refId});scrollIntoView$1(element,center);},[updateHighlighted]);// Highlight and scroll to the selected story whenever the selection or dataset changes
1370useEffect(function(){var highlight=fromSelection(selected);updateHighlighted(highlight);if(highlight){var itemId=highlight.itemId,refId=highlight.refId;setTimeout(function(){var _a;scrollIntoView$1((_a=containerRef.current)===null||_a===void 0?void 0:_a.querySelector("[data-item-id=\"".concat(itemId,"\"][data-ref-id=\"").concat(refId,"\"]")),true// make sure it's clearly visible by centering it
1371);},0);}},[dataset,highlightedRef,containerRef,selected]);// Highlight nodes up/down the tree using arrow keys
1372useEffect(function(){var menuElement=document$4.getElementById('storybook-explorer-menu');var lastRequestId;var navigateTree=function navigateTree(event){if(isLoading||!isBrowsing||!containerRef.current)return;// allow event.repeat
1373if(!matchesModifiers(false,event))return;var isArrowUp=matchesKeyCode('ArrowUp',event);var isArrowDown=matchesKeyCode('ArrowDown',event);if(!(isArrowUp||isArrowDown))return;event.preventDefault();var requestId=globalWindow.requestAnimationFrame(function(){globalWindow.cancelAnimationFrame(lastRequestId);lastRequestId=requestId;var target=event.target;if(!isAncestor(menuElement,target)&&!isAncestor(target,menuElement))return;if(target.hasAttribute('data-action'))target.blur();var highlightable=Array.from(containerRef.current.querySelectorAll('[data-highlightable=true]'));var currentIndex=highlightable.findIndex(function(el){var _a,_b;return el.getAttribute('data-item-id')===((_a=highlightedRef.current)===null||_a===void 0?void 0:_a.itemId)&&el.getAttribute('data-ref-id')===((_b=highlightedRef.current)===null||_b===void 0?void 0:_b.refId);});var nextIndex=cycle(highlightable,currentIndex,isArrowUp?-1:1);var didRunAround=isArrowUp?nextIndex===highlightable.length-1:nextIndex===0;highlightElement(highlightable[nextIndex],didRunAround);});};document$4.addEventListener('keydown',navigateTree);return function(){return document$4.removeEventListener('keydown',navigateTree);};},[isLoading,isBrowsing,highlightedRef,highlightElement]);return[highlighted,updateHighlighted,highlightedRef];};var HighlightStyles=function HighlightStyles(_ref103){var refId=_ref103.refId,itemId=_ref103.itemId;return React$2.createElement(Global,{styles:function styles(_ref104){var _dataRefId$conca;var color=_ref104.color;var background=curriedTransparentize$1(0.85,color.secondary);return _defineProperty2({},"[data-ref-id=\"".concat(refId,"\"][data-item-id=\"").concat(itemId,"\"]:not([data-selected=\"true\"])"),(_dataRefId$conca={},_defineProperty2(_dataRefId$conca,"&[data-nodetype=\"component\"], &[data-nodetype=\"group\"]",{background:background,'&:hover, &:focus':{background:background}}),_defineProperty2(_dataRefId$conca,"&[data-nodetype=\"story\"], &[data-nodetype=\"document\"]",{color:color.defaultText,background:background,'&:hover, &:focus':{background:background}}),_dataRefId$conca));}});};var Explorer=React$2.memo(function(_ref106){var isLoading=_ref106.isLoading,isBrowsing=_ref106.isBrowsing,dataset=_ref106.dataset,selected=_ref106.selected;var containerRef=useRef(null);// Track highlighted nodes, keep it in sync with props and enable keyboard navigation
1374var _useHighlighted=useHighlighted({containerRef:containerRef,isLoading:isLoading,isBrowsing:isBrowsing,dataset:dataset,selected:selected}),_useHighlighted2=_slicedToArray2(_useHighlighted,3),highlighted=_useHighlighted2[0],setHighlighted=_useHighlighted2[1],highlightedRef=_useHighlighted2[2];return React$2.createElement("div",{ref:containerRef,id:"storybook-explorer-tree","data-highlighted-ref-id":highlighted===null||highlighted===void 0?void 0:highlighted.refId,"data-highlighted-item-id":highlighted===null||highlighted===void 0?void 0:highlighted.itemId},highlighted&&React$2.createElement(HighlightStyles,Object.assign({},highlighted)),dataset.entries.map(function(_ref107){var _ref108=_slicedToArray2(_ref107,2),refId=_ref108[0],ref=_ref108[1];return React$2.createElement(Ref,Object.assign({},ref,{key:refId,isLoading:isLoading,isBrowsing:isBrowsing,selectedStoryId:(selected===null||selected===void 0?void 0:selected.refId)===ref.id?selected.storyId:null,highlightedRef:highlightedRef,setHighlighted:setHighlighted}));}));});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;}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;_setPrototypeOf(subClass,superClass);}var reactIs={exports:{}};var reactIs_production_min={};/** @license React v17.0.2
1375 * react-is.production.min.js
1376 *
1377 * Copyright (c) Facebook, Inc. and its affiliates.
1378 *
1379 * This source code is licensed under the MIT license found in the
1380 * LICENSE file in the root directory of this source tree.
1381 */var b$1=60103,c$1=60106,d$1=60107,e$2=60108,f$1=60114,g$1=60109,h$1=60110,k$1=60112,l$1=60113,m$1=60120,n$2=60115,p$1=60116,q$1=60121,r$2=60122,u$1=60117,v$1=60129,w$1=60131;if("function"===typeof Symbol&&Symbol.for){var x$1=Symbol.for;b$1=x$1("react.element");c$1=x$1("react.portal");d$1=x$1("react.fragment");e$2=x$1("react.strict_mode");f$1=x$1("react.profiler");g$1=x$1("react.provider");h$1=x$1("react.context");k$1=x$1("react.forward_ref");l$1=x$1("react.suspense");m$1=x$1("react.suspense_list");n$2=x$1("react.memo");p$1=x$1("react.lazy");q$1=x$1("react.block");r$2=x$1("react.server.block");u$1=x$1("react.fundamental");v$1=x$1("react.debug_trace_mode");w$1=x$1("react.legacy_hidden");}function y$1(a){if("object"===_typeof2(a)&&null!==a){var t=a.$$typeof;switch(t){case b$1:switch(a=a.type,a){case d$1:case f$1:case e$2:case l$1:case m$1:return a;default:switch(a=a&&a.$$typeof,a){case h$1:case k$1:case p$1:case n$2:case g$1:return a;default:return t;}}case c$1:return t;}}}var z$1=g$1,A$1=b$1,B$1=k$1,C$1=d$1,D$1=p$1,E$1=n$2,F$1=c$1,G$1=f$1,H$1=e$2,I$1=l$1;reactIs_production_min.ContextConsumer=h$1;reactIs_production_min.ContextProvider=z$1;reactIs_production_min.Element=A$1;reactIs_production_min.ForwardRef=B$1;reactIs_production_min.Fragment=C$1;reactIs_production_min.Lazy=D$1;reactIs_production_min.Memo=E$1;reactIs_production_min.Portal=F$1;reactIs_production_min.Profiler=G$1;reactIs_production_min.StrictMode=H$1;reactIs_production_min.Suspense=I$1;reactIs_production_min.isAsyncMode=function(){return!1;};reactIs_production_min.isConcurrentMode=function(){return!1;};reactIs_production_min.isContextConsumer=function(a){return y$1(a)===h$1;};reactIs_production_min.isContextProvider=function(a){return y$1(a)===g$1;};reactIs_production_min.isElement=function(a){return"object"===_typeof2(a)&&null!==a&&a.$$typeof===b$1;};reactIs_production_min.isForwardRef=function(a){return y$1(a)===k$1;};reactIs_production_min.isFragment=function(a){return y$1(a)===d$1;};reactIs_production_min.isLazy=function(a){return y$1(a)===p$1;};reactIs_production_min.isMemo=function(a){return y$1(a)===n$2;};reactIs_production_min.isPortal=function(a){return y$1(a)===c$1;};reactIs_production_min.isProfiler=function(a){return y$1(a)===f$1;};reactIs_production_min.isStrictMode=function(a){return y$1(a)===e$2;};reactIs_production_min.isSuspense=function(a){return y$1(a)===l$1;};reactIs_production_min.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d$1||a===f$1||a===v$1||a===e$2||a===l$1||a===m$1||a===w$1||"object"===_typeof2(a)&&null!==a&&(a.$$typeof===p$1||a.$$typeof===n$2||a.$$typeof===g$1||a.$$typeof===h$1||a.$$typeof===k$1||a.$$typeof===u$1||a.$$typeof===q$1||a[0]===r$2)?!0:!1;};reactIs_production_min.typeOf=y$1;var reactIs_development={};/** @license React v17.0.2
1382 * react-is.development.js
1383 *
1384 * Copyright (c) Facebook, Inc. and its affiliates.
1385 *
1386 * This source code is licensed under the MIT license found in the
1387 * LICENSE file in the root directory of this source tree.
1388 */if(process.env.NODE_ENV!=="production"){(function(){// When adding new symbols to this file,
1389// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
1390// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
1391// nor polyfill, then a plain number is used for performance.
1392var REACT_ELEMENT_TYPE=0xeac7;var REACT_PORTAL_TYPE=0xeaca;var REACT_FRAGMENT_TYPE=0xeacb;var REACT_STRICT_MODE_TYPE=0xeacc;var REACT_PROFILER_TYPE=0xead2;var REACT_PROVIDER_TYPE=0xeacd;var REACT_CONTEXT_TYPE=0xeace;var REACT_FORWARD_REF_TYPE=0xead0;var REACT_SUSPENSE_TYPE=0xead1;var REACT_SUSPENSE_LIST_TYPE=0xead8;var REACT_MEMO_TYPE=0xead3;var REACT_LAZY_TYPE=0xead4;var REACT_BLOCK_TYPE=0xead9;var REACT_SERVER_BLOCK_TYPE=0xeada;var REACT_FUNDAMENTAL_TYPE=0xead5;var REACT_DEBUG_TRACING_MODE_TYPE=0xeae1;var REACT_LEGACY_HIDDEN_TYPE=0xeae3;if(typeof Symbol==='function'&&Symbol.for){var symbolFor=Symbol.for;REACT_ELEMENT_TYPE=symbolFor('react.element');REACT_PORTAL_TYPE=symbolFor('react.portal');REACT_FRAGMENT_TYPE=symbolFor('react.fragment');REACT_STRICT_MODE_TYPE=symbolFor('react.strict_mode');REACT_PROFILER_TYPE=symbolFor('react.profiler');REACT_PROVIDER_TYPE=symbolFor('react.provider');REACT_CONTEXT_TYPE=symbolFor('react.context');REACT_FORWARD_REF_TYPE=symbolFor('react.forward_ref');REACT_SUSPENSE_TYPE=symbolFor('react.suspense');REACT_SUSPENSE_LIST_TYPE=symbolFor('react.suspense_list');REACT_MEMO_TYPE=symbolFor('react.memo');REACT_LAZY_TYPE=symbolFor('react.lazy');REACT_BLOCK_TYPE=symbolFor('react.block');REACT_SERVER_BLOCK_TYPE=symbolFor('react.server.block');REACT_FUNDAMENTAL_TYPE=symbolFor('react.fundamental');symbolFor('react.scope');symbolFor('react.opaque.id');REACT_DEBUG_TRACING_MODE_TYPE=symbolFor('react.debug_trace_mode');symbolFor('react.offscreen');REACT_LEGACY_HIDDEN_TYPE=symbolFor('react.legacy_hidden');}// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
1393var enableScopeAPI=false;// Experimental Create Event Handle API.
1394function isValidElementType(type){if(typeof type==='string'||typeof type==='function'){return true;}// Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1395if(type===REACT_FRAGMENT_TYPE||type===REACT_PROFILER_TYPE||type===REACT_DEBUG_TRACING_MODE_TYPE||type===REACT_STRICT_MODE_TYPE||type===REACT_SUSPENSE_TYPE||type===REACT_SUSPENSE_LIST_TYPE||type===REACT_LEGACY_HIDDEN_TYPE||enableScopeAPI){return true;}if(_typeof2(type)==='object'&&type!==null){if(type.$$typeof===REACT_LAZY_TYPE||type.$$typeof===REACT_MEMO_TYPE||type.$$typeof===REACT_PROVIDER_TYPE||type.$$typeof===REACT_CONTEXT_TYPE||type.$$typeof===REACT_FORWARD_REF_TYPE||type.$$typeof===REACT_FUNDAMENTAL_TYPE||type.$$typeof===REACT_BLOCK_TYPE||type[0]===REACT_SERVER_BLOCK_TYPE){return true;}}return false;}function typeOf(object){if(_typeof2(object)==='object'&&object!==null){var $$typeof=object.$$typeof;switch($$typeof){case REACT_ELEMENT_TYPE:var type=object.type;switch(type){case REACT_FRAGMENT_TYPE:case REACT_PROFILER_TYPE:case REACT_STRICT_MODE_TYPE:case REACT_SUSPENSE_TYPE:case REACT_SUSPENSE_LIST_TYPE:return type;default:var $$typeofType=type&&type.$$typeof;switch($$typeofType){case REACT_CONTEXT_TYPE:case REACT_FORWARD_REF_TYPE:case REACT_LAZY_TYPE:case REACT_MEMO_TYPE:case REACT_PROVIDER_TYPE:return $$typeofType;default:return $$typeof;}}case REACT_PORTAL_TYPE:return $$typeof;}}return undefined;}var ContextConsumer=REACT_CONTEXT_TYPE;var ContextProvider=REACT_PROVIDER_TYPE;var Element=REACT_ELEMENT_TYPE;var ForwardRef=REACT_FORWARD_REF_TYPE;var Fragment=REACT_FRAGMENT_TYPE;var Lazy=REACT_LAZY_TYPE;var Memo=REACT_MEMO_TYPE;var Portal=REACT_PORTAL_TYPE;var Profiler=REACT_PROFILER_TYPE;var StrictMode=REACT_STRICT_MODE_TYPE;var Suspense=REACT_SUSPENSE_TYPE;var hasWarnedAboutDeprecatedIsAsyncMode=false;var hasWarnedAboutDeprecatedIsConcurrentMode=false;// AsyncMode should be deprecated
1396function isAsyncMode(object){{if(!hasWarnedAboutDeprecatedIsAsyncMode){hasWarnedAboutDeprecatedIsAsyncMode=true;// Using console['warn'] to evade Babel and ESLint
1397console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, '+'and will be removed in React 18+.');}}return false;}function isConcurrentMode(object){{if(!hasWarnedAboutDeprecatedIsConcurrentMode){hasWarnedAboutDeprecatedIsConcurrentMode=true;// Using console['warn'] to evade Babel and ESLint
1398console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, '+'and will be removed in React 18+.');}}return false;}function isContextConsumer(object){return typeOf(object)===REACT_CONTEXT_TYPE;}function isContextProvider(object){return typeOf(object)===REACT_PROVIDER_TYPE;}function isElement(object){return _typeof2(object)==='object'&&object!==null&&object.$$typeof===REACT_ELEMENT_TYPE;}function isForwardRef(object){return typeOf(object)===REACT_FORWARD_REF_TYPE;}function isFragment(object){return typeOf(object)===REACT_FRAGMENT_TYPE;}function isLazy(object){return typeOf(object)===REACT_LAZY_TYPE;}function isMemo(object){return typeOf(object)===REACT_MEMO_TYPE;}function isPortal(object){return typeOf(object)===REACT_PORTAL_TYPE;}function isProfiler(object){return typeOf(object)===REACT_PROFILER_TYPE;}function isStrictMode(object){return typeOf(object)===REACT_STRICT_MODE_TYPE;}function isSuspense(object){return typeOf(object)===REACT_SUSPENSE_TYPE;}reactIs_development.ContextConsumer=ContextConsumer;reactIs_development.ContextProvider=ContextProvider;reactIs_development.Element=Element;reactIs_development.ForwardRef=ForwardRef;reactIs_development.Fragment=Fragment;reactIs_development.Lazy=Lazy;reactIs_development.Memo=Memo;reactIs_development.Portal=Portal;reactIs_development.Profiler=Profiler;reactIs_development.StrictMode=StrictMode;reactIs_development.Suspense=Suspense;reactIs_development.isAsyncMode=isAsyncMode;reactIs_development.isConcurrentMode=isConcurrentMode;reactIs_development.isContextConsumer=isContextConsumer;reactIs_development.isContextProvider=isContextProvider;reactIs_development.isElement=isElement;reactIs_development.isForwardRef=isForwardRef;reactIs_development.isFragment=isFragment;reactIs_development.isLazy=isLazy;reactIs_development.isMemo=isMemo;reactIs_development.isPortal=isPortal;reactIs_development.isProfiler=isProfiler;reactIs_development.isStrictMode=isStrictMode;reactIs_development.isSuspense=isSuspense;reactIs_development.isValidElementType=isValidElementType;reactIs_development.typeOf=typeOf;})();}if(process.env.NODE_ENV==='production'){reactIs.exports=reactIs_production_min;}else{reactIs.exports=reactIs_development;}function t(t){return"object"==_typeof2(t)&&null!=t&&1===t.nodeType;}function e$1(t,e){return(!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t;}function n$1(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e$1(r.overflowY,n)||e$1(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement;}catch(t){return null;}}(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth);}(t);}return!1;}function r$1(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0;}function computeScrollIntoView(e,i){var o=window,l=i.scrollMode,d=i.block,u=i.inline,h=i.boundary,a=i.skipOverflowHiddenElements,c="function"==typeof h?h:function(t){return t!==h;};if(!t(e))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,s=[],p=e;t(p)&&c(p);){if((p=p.parentElement)===f){s.push(p);break;}null!=p&&p===document.body&&n$1(p)&&!n$1(document.documentElement)||null!=p&&n$1(p,a)&&s.push(p);}for(var m=o.visualViewport?o.visualViewport.width:innerWidth,g=o.visualViewport?o.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,v=window.scrollY||pageYOffset,W=e.getBoundingClientRect(),b=W.height,H=W.width,y=W.top,E=W.right,M=W.bottom,V=W.left,x="start"===d||"nearest"===d?y:"end"===d?M:y+b/2,I="center"===u?V+H/2:"end"===u?E:V,C=[],T=0;T<s.length;T++){var k=s[T],B=k.getBoundingClientRect(),D=B.height,O=B.width,R=B.top,X=B.right,Y=B.bottom,L=B.left;if("if-needed"===l&&y>=0&&V>=0&&M<=g&&E<=m&&y>=R&&M<=Y&&V>=L&&E<=X)return C;var S=getComputedStyle(k),j=parseInt(S.borderLeftWidth,10),q=parseInt(S.borderTopWidth,10),z=parseInt(S.borderRightWidth,10),A=parseInt(S.borderBottomWidth,10),F=0,G=0,J="offsetWidth"in k?k.offsetWidth-k.clientWidth-j-z:0,K="offsetHeight"in k?k.offsetHeight-k.clientHeight-q-A:0;if(f===k)F="start"===d?x:"end"===d?x-g:"nearest"===d?r$1(v,v+g,g,q,A,v+x,v+x+b,b):x-g/2,G="start"===u?I:"center"===u?I-m/2:"end"===u?I-m:r$1(w,w+m,m,j,z,w+I,w+I+H,H),F=Math.max(0,F+v),G=Math.max(0,G+w);else{F="start"===d?x-R-q:"end"===d?x-Y+A+K:"nearest"===d?r$1(R,Y,D,q,A+K,x,x+b,b):x-(R+D/2)+K/2,G="start"===u?I-L-j:"center"===u?I-(L+O/2)+J/2:"end"===u?I-X+z+J:r$1(L,X,O,j,z+J,I,I+H,H);var N=k.scrollLeft,P=k.scrollTop;x+=P-(F=Math.max(0,Math.min(P+F,k.scrollHeight-D+K))),I+=N-(G=Math.max(0,Math.min(N+G,k.scrollWidth-O+J)));}C.push({el:k,top:F,left:G});}return C;}var idCounter=0;/**
1399 * Accepts a parameter and returns it if it's a function
1400 * or a noop function if it's not. This allows us to
1401 * accept a callback, but not worry about it if it's not
1402 * passed.
1403 * @param {Function} cb the callback
1404 * @return {Function} a function
1405 */function cbToCb(cb){return typeof cb==='function'?cb:noop;}function noop(){}/**
1406 * Scroll node into view if necessary
1407 * @param {HTMLElement} node the element that should scroll into view
1408 * @param {HTMLElement} menuNode the menu element of the component
1409 */function scrollIntoView(node,menuNode){if(!node){return;}var actions=computeScrollIntoView(node,{boundary:menuNode,block:'nearest',scrollMode:'if-needed'});actions.forEach(function(_ref){var el=_ref.el,top=_ref.top,left=_ref.left;el.scrollTop=top;el.scrollLeft=left;});}/**
1410 * @param {HTMLElement} parent the parent node
1411 * @param {HTMLElement} child the child node
1412 * @param {Window} environment The window context where downshift renders.
1413 * @return {Boolean} whether the parent is the child or the child is in the parent
1414 */function isOrContainsNode(parent,child,environment){var result=parent===child||child instanceof environment.Node&&parent.contains&&parent.contains(child);return result;}/**
1415 * Simple debounce implementation. Will call the given
1416 * function once after the time given has passed since
1417 * it was last called.
1418 * @param {Function} fn the function to call after the time
1419 * @param {Number} time the time to wait
1420 * @return {Function} the debounced function
1421 */function debounce(fn,time){var timeoutId;function cancel(){if(timeoutId){clearTimeout(timeoutId);}}function wrapper(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}cancel();timeoutId=setTimeout(function(){timeoutId=null;fn.apply(void 0,args);},time);}wrapper.cancel=cancel;return wrapper;}/**
1422 * This is intended to be used to compose event handlers.
1423 * They are executed in order until one of them sets
1424 * `event.preventDownshiftDefault = true`.
1425 * @param {...Function} fns the event handler functions
1426 * @return {Function} the event handler to add to an element
1427 */function callAllEventHandlers(){for(var _len2=arguments.length,fns=new Array(_len2),_key2=0;_key2<_len2;_key2++){fns[_key2]=arguments[_key2];}return function(event){for(var _len3=arguments.length,args=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){args[_key3-1]=arguments[_key3];}return fns.some(function(fn){if(fn){fn.apply(void 0,[event].concat(args));}return event.preventDownshiftDefault||event.hasOwnProperty('nativeEvent')&&event.nativeEvent.preventDownshiftDefault;});};}function handleRefs(){for(var _len4=arguments.length,refs=new Array(_len4),_key4=0;_key4<_len4;_key4++){refs[_key4]=arguments[_key4];}return function(node){refs.forEach(function(ref){if(typeof ref==='function'){ref(node);}else if(ref){ref.current=node;}});};}/**
1428 * This generates a unique ID for an instance of Downshift
1429 * @return {String} the unique ID
1430 */function generateId(){return String(idCounter++);}/**
1431 * Default implementation for status message. Only added when menu is open.
1432 * Will specify if there are results in the list, and if so, how many,
1433 * and what keys are relevant.
1434 *
1435 * @param {Object} param the downshift state and other relevant properties
1436 * @return {String} the a11y status message
1437 */function getA11yStatusMessage$1(_ref2){var isOpen=_ref2.isOpen,resultCount=_ref2.resultCount,previousResultCount=_ref2.previousResultCount;if(!isOpen){return'';}if(!resultCount){return'No results are available.';}if(resultCount!==previousResultCount){return resultCount+" result"+(resultCount===1?' is':'s are')+" available, use up and down arrow keys to navigate. Press Enter key to select.";}return'';}/**
1438 * Takes an argument and if it's an array, returns the first item in the array
1439 * otherwise returns the argument
1440 * @param {*} arg the maybe-array
1441 * @param {*} defaultValue the value if arg is falsey not defined
1442 * @return {*} the arg or it's first item
1443 */function unwrapArray(arg,defaultValue){arg=Array.isArray(arg)?/* istanbul ignore next (preact) */arg[0]:arg;if(!arg&&defaultValue){return defaultValue;}else{return arg;}}/**
1444 * @param {Object} element (P)react element
1445 * @return {Boolean} whether it's a DOM element
1446 */function isDOMElement(element){return typeof element.type==='string';}/**
1447 * @param {Object} element (P)react element
1448 * @return {Object} the props
1449 */function getElementProps(element){return element.props;}/**
1450 * Throws a helpful error message for required properties. Useful
1451 * to be used as a default in destructuring or object params.
1452 * @param {String} fnName the function name
1453 * @param {String} propName the prop name
1454 */function requiredProp(fnName,propName){// eslint-disable-next-line no-console
1455console.error("The property \""+propName+"\" is required in \""+fnName+"\"");}var stateKeys=['highlightedIndex','inputValue','isOpen','selectedItem','type'];/**
1456 * @param {Object} state the state object
1457 * @return {Object} state that is relevant to downshift
1458 */function pickState(state){if(state===void 0){state={};}var result={};stateKeys.forEach(function(k){if(state.hasOwnProperty(k)){result[k]=state[k];}});return result;}/**
1459 * This will perform a shallow merge of the given state object
1460 * with the state coming from props
1461 * (for the controlled component scenario)
1462 * This is used in state updater functions so they're referencing
1463 * the right state regardless of where it comes from.
1464 *
1465 * @param {Object} state The state of the component/hook.
1466 * @param {Object} props The props that may contain controlled values.
1467 * @returns {Object} The merged controlled state.
1468 */function getState(state,props){return Object.keys(state).reduce(function(prevState,key){prevState[key]=isControlledProp(props,key)?props[key]:state[key];return prevState;},{});}/**
1469 * This determines whether a prop is a "controlled prop" meaning it is
1470 * state which is controlled by the outside of this component rather
1471 * than within this component.
1472 *
1473 * @param {Object} props The props that may contain controlled values.
1474 * @param {String} key the key to check
1475 * @return {Boolean} whether it is a controlled controlled prop
1476 */function isControlledProp(props,key){return props[key]!==undefined;}/**
1477 * Normalizes the 'key' property of a KeyboardEvent in IE/Edge
1478 * @param {Object} event a keyboardEvent object
1479 * @return {String} keyboard key
1480 */function normalizeArrowKey(event){var key=event.key,keyCode=event.keyCode;/* istanbul ignore next (ie) */if(keyCode>=37&&keyCode<=40&&key.indexOf('Arrow')!==0){return"Arrow"+key;}return key;}/**
1481 * Simple check if the value passed is object literal
1482 * @param {*} obj any things
1483 * @return {Boolean} whether it's object literal
1484 */function isPlainObject(obj){return Object.prototype.toString.call(obj)==='[object Object]';}/**
1485 * Returns the new index in the list, in a circular way. If next value is out of bonds from the total,
1486 * it will wrap to either 0 or itemCount - 1.
1487 *
1488 * @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.
1489 * @param {number} baseIndex The initial position to move from.
1490 * @param {number} itemCount The total number of items.
1491 * @param {Function} getItemNodeFromIndex Used to check if item is disabled.
1492 * @param {boolean} circular Specify if navigation is circular. Default is true.
1493 * @returns {number} The new index after the move.
1494 */function getNextWrappingIndex(moveAmount,baseIndex,itemCount,getItemNodeFromIndex,circular){if(circular===void 0){circular=true;}if(itemCount===0){return-1;}var itemsLastIndex=itemCount-1;if(typeof baseIndex!=='number'||baseIndex<0||baseIndex>=itemCount){baseIndex=moveAmount>0?-1:itemsLastIndex+1;}var newIndex=baseIndex+moveAmount;if(newIndex<0){newIndex=circular?itemsLastIndex:0;}else if(newIndex>itemsLastIndex){newIndex=circular?0:itemsLastIndex;}var nonDisabledNewIndex=getNextNonDisabledIndex(moveAmount,newIndex,itemCount,getItemNodeFromIndex,circular);if(nonDisabledNewIndex===-1){return baseIndex>=itemCount?-1:baseIndex;}return nonDisabledNewIndex;}/**
1495 * Returns the next index in the list of an item that is not disabled.
1496 *
1497 * @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.
1498 * @param {number} baseIndex The initial position to move from.
1499 * @param {number} itemCount The total number of items.
1500 * @param {Function} getItemNodeFromIndex Used to check if item is disabled.
1501 * @param {boolean} circular Specify if navigation is circular. Default is true.
1502 * @returns {number} The new index. Returns baseIndex if item is not disabled. Returns next non-disabled item otherwise. If no non-disabled found it will return -1.
1503 */function getNextNonDisabledIndex(moveAmount,baseIndex,itemCount,getItemNodeFromIndex,circular){var currentElementNode=getItemNodeFromIndex(baseIndex);if(!currentElementNode||!currentElementNode.hasAttribute('disabled')){return baseIndex;}if(moveAmount>0){for(var index=baseIndex+1;index<itemCount;index++){if(!getItemNodeFromIndex(index).hasAttribute('disabled')){return index;}}}else{for(var _index=baseIndex-1;_index>=0;_index--){if(!getItemNodeFromIndex(_index).hasAttribute('disabled')){return _index;}}}if(circular){return moveAmount>0?getNextNonDisabledIndex(1,0,itemCount,getItemNodeFromIndex,false):getNextNonDisabledIndex(-1,itemCount-1,itemCount,getItemNodeFromIndex,false);}return-1;}/**
1504 * Checks if event target is within the downshift elements.
1505 *
1506 * @param {EventTarget} target Target to check.
1507 * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).
1508 * @param {Window} environment The window context where downshift renders.
1509 * @param {boolean} checkActiveElement Whether to also check activeElement.
1510 *
1511 * @returns {boolean} Whether or not the target is within downshift elements.
1512 */function targetWithinDownshift(target,downshiftElements,environment,checkActiveElement){if(checkActiveElement===void 0){checkActiveElement=true;}return downshiftElements.some(function(contextNode){return contextNode&&(isOrContainsNode(contextNode,target,environment)||checkActiveElement&&isOrContainsNode(contextNode,environment.document.activeElement,environment));});}// eslint-disable-next-line import/no-mutable-exports
1513var validateControlledUnchanged=noop;/* istanbul ignore next */if(process.env.NODE_ENV!=='production'){validateControlledUnchanged=function validateControlledUnchanged(state,prevProps,nextProps){var warningDescription="This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props";Object.keys(state).forEach(function(propKey){if(prevProps[propKey]!==undefined&&nextProps[propKey]===undefined){// eslint-disable-next-line no-console
1514console.error("downshift: A component has changed the controlled prop \""+propKey+"\" to be uncontrolled. "+warningDescription);}else if(prevProps[propKey]===undefined&&nextProps[propKey]!==undefined){// eslint-disable-next-line no-console
1515console.error("downshift: A component has changed the uncontrolled prop \""+propKey+"\" to be controlled. "+warningDescription);}});};}var cleanupStatus=debounce(function(documentProp){getStatusDiv(documentProp).textContent='';},500);/**
1516 * @param {String} status the status message
1517 * @param {Object} documentProp document passed by the user.
1518 */function setStatus(status,documentProp){var div=getStatusDiv(documentProp);if(!status){return;}div.textContent=status;cleanupStatus(documentProp);}/**
1519 * Get the status node or create it if it does not already exist.
1520 * @param {Object} documentProp document passed by the user.
1521 * @return {HTMLElement} the status node.
1522 */function getStatusDiv(documentProp){if(documentProp===void 0){documentProp=document;}var statusDiv=documentProp.getElementById('a11y-status-message');if(statusDiv){return statusDiv;}statusDiv=documentProp.createElement('div');statusDiv.setAttribute('id','a11y-status-message');statusDiv.setAttribute('role','status');statusDiv.setAttribute('aria-live','polite');statusDiv.setAttribute('aria-relevant','additions text');Object.assign(statusDiv.style,{border:'0',clip:'rect(0 0 0 0)',height:'1px',margin:'-1px',overflow:'hidden',padding:'0',position:'absolute',width:'1px'});documentProp.body.appendChild(statusDiv);return statusDiv;}var unknown=process.env.NODE_ENV!=="production"?'__autocomplete_unknown__':0;var mouseUp=process.env.NODE_ENV!=="production"?'__autocomplete_mouseup__':1;var itemMouseEnter=process.env.NODE_ENV!=="production"?'__autocomplete_item_mouseenter__':2;var keyDownArrowUp=process.env.NODE_ENV!=="production"?'__autocomplete_keydown_arrow_up__':3;var keyDownArrowDown=process.env.NODE_ENV!=="production"?'__autocomplete_keydown_arrow_down__':4;var keyDownEscape=process.env.NODE_ENV!=="production"?'__autocomplete_keydown_escape__':5;var keyDownEnter=process.env.NODE_ENV!=="production"?'__autocomplete_keydown_enter__':6;var keyDownHome=process.env.NODE_ENV!=="production"?'__autocomplete_keydown_home__':7;var keyDownEnd=process.env.NODE_ENV!=="production"?'__autocomplete_keydown_end__':8;var clickItem=process.env.NODE_ENV!=="production"?'__autocomplete_click_item__':9;var blurInput=process.env.NODE_ENV!=="production"?'__autocomplete_blur_input__':10;var changeInput=process.env.NODE_ENV!=="production"?'__autocomplete_change_input__':11;var keyDownSpaceButton=process.env.NODE_ENV!=="production"?'__autocomplete_keydown_space_button__':12;var clickButton=process.env.NODE_ENV!=="production"?'__autocomplete_click_button__':13;var blurButton=process.env.NODE_ENV!=="production"?'__autocomplete_blur_button__':14;var controlledPropUpdatedSelectedItem=process.env.NODE_ENV!=="production"?'__autocomplete_controlled_prop_updated_selected_item__':15;var touchEnd=process.env.NODE_ENV!=="production"?'__autocomplete_touchend__':16;var stateChangeTypes$3=/*#__PURE__*/Object.freeze({__proto__:null,unknown:unknown,mouseUp:mouseUp,itemMouseEnter:itemMouseEnter,keyDownArrowUp:keyDownArrowUp,keyDownArrowDown:keyDownArrowDown,keyDownEscape:keyDownEscape,keyDownEnter:keyDownEnter,keyDownHome:keyDownHome,keyDownEnd:keyDownEnd,clickItem:clickItem,blurInput:blurInput,changeInput:changeInput,keyDownSpaceButton:keyDownSpaceButton,clickButton:clickButton,blurButton:blurButton,controlledPropUpdatedSelectedItem:controlledPropUpdatedSelectedItem,touchEnd:touchEnd});var _excluded$4=["refKey","ref"],_excluded2$3=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],_excluded3$2=["onKeyDown","onBlur","onChange","onInput","onChangeText"],_excluded4$1=["refKey","ref"],_excluded5$1=["onMouseMove","onMouseDown","onClick","onPress","index","item"];var Downshift=/*#__PURE__*/function(){var Downshift=/*#__PURE__*/function(_Component){_inheritsLoose(Downshift,_Component);function Downshift(_props){var _this;_this=_Component.call(this,_props)||this;// fancy destructuring + defaults + aliases
1523// this basically says each value of state should either be set to
1524// the initial value or the default value if the initial value is not provided
1525_this.id=_this.props.id||"downshift-"+generateId();_this.menuId=_this.props.menuId||_this.id+"-menu";_this.labelId=_this.props.labelId||_this.id+"-label";_this.inputId=_this.props.inputId||_this.id+"-input";_this.getItemId=_this.props.getItemId||function(index){return _this.id+"-item-"+index;};_this.input=null;_this.items=[];_this.itemCount=null;_this.previousResultCount=0;_this.timeoutIds=[];_this.internalSetTimeout=function(fn,time){var id=setTimeout(function(){_this.timeoutIds=_this.timeoutIds.filter(function(i){return i!==id;});fn();},time);_this.timeoutIds.push(id);};_this.setItemCount=function(count){_this.itemCount=count;};_this.unsetItemCount=function(){_this.itemCount=null;};_this.setHighlightedIndex=function(highlightedIndex,otherStateToSet){if(highlightedIndex===void 0){highlightedIndex=_this.props.defaultHighlightedIndex;}if(otherStateToSet===void 0){otherStateToSet={};}otherStateToSet=pickState(otherStateToSet);_this.internalSetState(_extends({highlightedIndex:highlightedIndex},otherStateToSet));};_this.clearSelection=function(cb){_this.internalSetState({selectedItem:null,inputValue:'',highlightedIndex:_this.props.defaultHighlightedIndex,isOpen:_this.props.defaultIsOpen},cb);};_this.selectItem=function(item,otherStateToSet,cb){otherStateToSet=pickState(otherStateToSet);_this.internalSetState(_extends({isOpen:_this.props.defaultIsOpen,highlightedIndex:_this.props.defaultHighlightedIndex,selectedItem:item,inputValue:_this.props.itemToString(item)},otherStateToSet),cb);};_this.selectItemAtIndex=function(itemIndex,otherStateToSet,cb){var item=_this.items[itemIndex];if(item==null){return;}_this.selectItem(item,otherStateToSet,cb);};_this.selectHighlightedItem=function(otherStateToSet,cb){return _this.selectItemAtIndex(_this.getState().highlightedIndex,otherStateToSet,cb);};_this.internalSetState=function(stateToSet,cb){var isItemSelected,onChangeArg;var onStateChangeArg={};var isStateToSetFunction=typeof stateToSet==='function';// we want to call `onInputValueChange` before the `setState` call
1526// so someone controlling the `inputValue` state gets notified of
1527// the input change as soon as possible. This avoids issues with
1528// preserving the cursor position.
1529// See https://github.com/downshift-js/downshift/issues/217 for more info.
1530if(!isStateToSetFunction&&stateToSet.hasOwnProperty('inputValue')){_this.props.onInputValueChange(stateToSet.inputValue,_extends({},_this.getStateAndHelpers(),stateToSet));}return _this.setState(function(state){state=_this.getState(state);var newStateToSet=isStateToSetFunction?stateToSet(state):stateToSet;// Your own function that could modify the state that will be set.
1531newStateToSet=_this.props.stateReducer(state,newStateToSet);// checks if an item is selected, regardless of if it's different from
1532// what was selected before
1533// used to determine if onSelect and onChange callbacks should be called
1534isItemSelected=newStateToSet.hasOwnProperty('selectedItem');// this keeps track of the object we want to call with setState
1535var nextState={};// this is just used to tell whether the state changed
1536var nextFullState={};// we need to call on change if the outside world is controlling any of our state
1537// and we're trying to update that state. OR if the selection has changed and we're
1538// trying to update the selection
1539if(isItemSelected&&newStateToSet.selectedItem!==state.selectedItem){onChangeArg=newStateToSet.selectedItem;}newStateToSet.type=newStateToSet.type||unknown;Object.keys(newStateToSet).forEach(function(key){// onStateChangeArg should only have the state that is
1540// actually changing
1541if(state[key]!==newStateToSet[key]){onStateChangeArg[key]=newStateToSet[key];}// the type is useful for the onStateChangeArg
1542// but we don't actually want to set it in internal state.
1543// this is an undocumented feature for now... Not all internalSetState
1544// calls support it and I'm not certain we want them to yet.
1545// But it enables users controlling the isOpen state to know when
1546// the isOpen state changes due to mouseup events which is quite handy.
1547if(key==='type'){return;}nextFullState[key]=newStateToSet[key];// if it's coming from props, then we don't care to set it internally
1548if(!isControlledProp(_this.props,key)){nextState[key]=newStateToSet[key];}});// if stateToSet is a function, then we weren't able to call onInputValueChange
1549// earlier, so we'll call it now that we know what the inputValue state will be.
1550if(isStateToSetFunction&&newStateToSet.hasOwnProperty('inputValue')){_this.props.onInputValueChange(newStateToSet.inputValue,_extends({},_this.getStateAndHelpers(),newStateToSet));}return nextState;},function(){// call the provided callback if it's a function
1551cbToCb(cb)();// only call the onStateChange and onChange callbacks if
1552// we have relevant information to pass them.
1553var hasMoreStateThanType=Object.keys(onStateChangeArg).length>1;if(hasMoreStateThanType){_this.props.onStateChange(onStateChangeArg,_this.getStateAndHelpers());}if(isItemSelected){_this.props.onSelect(stateToSet.selectedItem,_this.getStateAndHelpers());}if(onChangeArg!==undefined){_this.props.onChange(onChangeArg,_this.getStateAndHelpers());}// this is currently undocumented and therefore subject to change
1554// We'll try to not break it, but just be warned.
1555_this.props.onUserAction(onStateChangeArg,_this.getStateAndHelpers());});};_this.rootRef=function(node){return _this._rootNode=node;};_this.getRootProps=function(_temp,_temp2){var _extends2;var _ref=_temp===void 0?{}:_temp,_ref$refKey=_ref.refKey,refKey=_ref$refKey===void 0?'ref':_ref$refKey,ref=_ref.ref,rest=_objectWithoutPropertiesLoose(_ref,_excluded$4);var _ref2=_temp2===void 0?{}:_temp2,_ref2$suppressRefErro=_ref2.suppressRefError,suppressRefError=_ref2$suppressRefErro===void 0?false:_ref2$suppressRefErro;// this is used in the render to know whether the user has called getRootProps.
1556// It uses that to know whether to apply the props automatically
1557_this.getRootProps.called=true;_this.getRootProps.refKey=refKey;_this.getRootProps.suppressRefError=suppressRefError;var _this$getState=_this.getState(),isOpen=_this$getState.isOpen;return _extends((_extends2={},_extends2[refKey]=handleRefs(ref,_this.rootRef),_extends2.role='combobox',_extends2['aria-expanded']=isOpen,_extends2['aria-haspopup']='listbox',_extends2['aria-owns']=isOpen?_this.menuId:null,_extends2['aria-labelledby']=_this.labelId,_extends2),rest);};_this.keyDownHandlers={ArrowDown:function ArrowDown(event){var _this2=this;event.preventDefault();if(this.getState().isOpen){var amount=event.shiftKey?5:1;this.moveHighlightedIndex(amount,{type:keyDownArrowDown});}else{this.internalSetState({isOpen:true,type:keyDownArrowDown},function(){var itemCount=_this2.getItemCount();if(itemCount>0){var _this2$getState=_this2.getState(),highlightedIndex=_this2$getState.highlightedIndex;var nextHighlightedIndex=getNextWrappingIndex(1,highlightedIndex,itemCount,function(index){return _this2.getItemNodeFromIndex(index);});_this2.setHighlightedIndex(nextHighlightedIndex,{type:keyDownArrowDown});}});}},ArrowUp:function ArrowUp(event){var _this3=this;event.preventDefault();if(this.getState().isOpen){var amount=event.shiftKey?-5:-1;this.moveHighlightedIndex(amount,{type:keyDownArrowUp});}else{this.internalSetState({isOpen:true,type:keyDownArrowUp},function(){var itemCount=_this3.getItemCount();if(itemCount>0){var _this3$getState=_this3.getState(),highlightedIndex=_this3$getState.highlightedIndex;var nextHighlightedIndex=getNextWrappingIndex(-1,highlightedIndex,itemCount,function(index){return _this3.getItemNodeFromIndex(index);});_this3.setHighlightedIndex(nextHighlightedIndex,{type:keyDownArrowUp});}});}},Enter:function Enter(event){if(event.which===229){return;}var _this$getState2=this.getState(),isOpen=_this$getState2.isOpen,highlightedIndex=_this$getState2.highlightedIndex;if(isOpen&&highlightedIndex!=null){event.preventDefault();var item=this.items[highlightedIndex];var itemNode=this.getItemNodeFromIndex(highlightedIndex);if(item==null||itemNode&&itemNode.hasAttribute('disabled')){return;}this.selectHighlightedItem({type:keyDownEnter});}},Escape:function Escape(event){event.preventDefault();this.reset(_extends({type:keyDownEscape},!this.state.isOpen&&{selectedItem:null,inputValue:''}));}};_this.buttonKeyDownHandlers=_extends({},_this.keyDownHandlers,{' ':function _(event){event.preventDefault();this.toggleMenu({type:keyDownSpaceButton});}});_this.inputKeyDownHandlers=_extends({},_this.keyDownHandlers,{Home:function Home(event){var _this4=this;var _this$getState3=this.getState(),isOpen=_this$getState3.isOpen;if(!isOpen){return;}event.preventDefault();var itemCount=this.getItemCount();if(itemCount<=0||!isOpen){return;}// get next non-disabled starting downwards from 0 if that's disabled.
1558var newHighlightedIndex=getNextNonDisabledIndex(1,0,itemCount,function(index){return _this4.getItemNodeFromIndex(index);},false);this.setHighlightedIndex(newHighlightedIndex,{type:keyDownHome});},End:function End(event){var _this5=this;var _this$getState4=this.getState(),isOpen=_this$getState4.isOpen;if(!isOpen){return;}event.preventDefault();var itemCount=this.getItemCount();if(itemCount<=0||!isOpen){return;}// get next non-disabled starting upwards from last index if that's disabled.
1559var newHighlightedIndex=getNextNonDisabledIndex(-1,itemCount-1,itemCount,function(index){return _this5.getItemNodeFromIndex(index);},false);this.setHighlightedIndex(newHighlightedIndex,{type:keyDownEnd});}});_this.getToggleButtonProps=function(_temp3){var _ref3=_temp3===void 0?{}:_temp3,onClick=_ref3.onClick;_ref3.onPress;var onKeyDown=_ref3.onKeyDown,onKeyUp=_ref3.onKeyUp,onBlur=_ref3.onBlur,rest=_objectWithoutPropertiesLoose(_ref3,_excluded2$3);var _this$getState5=_this.getState(),isOpen=_this$getState5.isOpen;var enabledEventHandlers={onClick:callAllEventHandlers(onClick,_this.buttonHandleClick),onKeyDown:callAllEventHandlers(onKeyDown,_this.buttonHandleKeyDown),onKeyUp:callAllEventHandlers(onKeyUp,_this.buttonHandleKeyUp),onBlur:callAllEventHandlers(onBlur,_this.buttonHandleBlur)};var eventHandlers=rest.disabled?{}:enabledEventHandlers;return _extends({type:'button',role:'button','aria-label':isOpen?'close menu':'open menu','aria-haspopup':true,'data-toggle':true},eventHandlers,rest);};_this.buttonHandleKeyUp=function(event){// Prevent click event from emitting in Firefox
1560event.preventDefault();};_this.buttonHandleKeyDown=function(event){var key=normalizeArrowKey(event);if(_this.buttonKeyDownHandlers[key]){_this.buttonKeyDownHandlers[key].call(_assertThisInitialized(_this),event);}};_this.buttonHandleClick=function(event){event.preventDefault();// handle odd case for Safari and Firefox which
1561// don't give the button the focus properly.
1562/* istanbul ignore if (can't reasonably test this) */if(_this.props.environment.document.activeElement===_this.props.environment.document.body){event.target.focus();}// to simplify testing components that use downshift, we'll not wrap this in a setTimeout
1563// if the NODE_ENV is test. With the proper build system, this should be dead code eliminated
1564// when building for production and should therefore have no impact on production code.
1565if(process.env.NODE_ENV==='test'){_this.toggleMenu({type:clickButton});}else{// Ensure that toggle of menu occurs after the potential blur event in iOS
1566_this.internalSetTimeout(function(){return _this.toggleMenu({type:clickButton});});}};_this.buttonHandleBlur=function(event){var blurTarget=event.target;// Save blur target for comparison with activeElement later
1567// Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element
1568_this.internalSetTimeout(function(){if(!_this.isMouseDown&&(_this.props.environment.document.activeElement==null||_this.props.environment.document.activeElement.id!==_this.inputId)&&_this.props.environment.document.activeElement!==blurTarget// Do nothing if we refocus the same element again (to solve issue in Safari on iOS)
1569){_this.reset({type:blurButton});}});};_this.getLabelProps=function(props){return _extends({htmlFor:_this.inputId,id:_this.labelId},props);};_this.getInputProps=function(_temp4){var _ref4=_temp4===void 0?{}:_temp4,onKeyDown=_ref4.onKeyDown,onBlur=_ref4.onBlur,onChange=_ref4.onChange,onInput=_ref4.onInput;_ref4.onChangeText;var rest=_objectWithoutPropertiesLoose(_ref4,_excluded3$2);var onChangeKey;var eventHandlers={};/* istanbul ignore next (preact) */{onChangeKey='onChange';}var _this$getState6=_this.getState(),inputValue=_this$getState6.inputValue,isOpen=_this$getState6.isOpen,highlightedIndex=_this$getState6.highlightedIndex;if(!rest.disabled){var _eventHandlers;eventHandlers=(_eventHandlers={},_eventHandlers[onChangeKey]=callAllEventHandlers(onChange,onInput,_this.inputHandleChange),_eventHandlers.onKeyDown=callAllEventHandlers(onKeyDown,_this.inputHandleKeyDown),_eventHandlers.onBlur=callAllEventHandlers(onBlur,_this.inputHandleBlur),_eventHandlers);}return _extends({'aria-autocomplete':'list','aria-activedescendant':isOpen&&typeof highlightedIndex==='number'&&highlightedIndex>=0?_this.getItemId(highlightedIndex):null,'aria-controls':isOpen?_this.menuId:null,'aria-labelledby':_this.labelId,// https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
1570// revert back since autocomplete="nope" is ignored on latest Chrome and Opera
1571autoComplete:'off',value:inputValue,id:_this.inputId},eventHandlers,rest);};_this.inputHandleKeyDown=function(event){var key=normalizeArrowKey(event);if(key&&_this.inputKeyDownHandlers[key]){_this.inputKeyDownHandlers[key].call(_assertThisInitialized(_this),event);}};_this.inputHandleChange=function(event){_this.internalSetState({type:changeInput,isOpen:true,inputValue:event.target.value,highlightedIndex:_this.props.defaultHighlightedIndex});};_this.inputHandleBlur=function(){// Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element
1572_this.internalSetTimeout(function(){var downshiftButtonIsActive=_this.props.environment.document&&!!_this.props.environment.document.activeElement&&!!_this.props.environment.document.activeElement.dataset&&_this.props.environment.document.activeElement.dataset.toggle&&_this._rootNode&&_this._rootNode.contains(_this.props.environment.document.activeElement);if(!_this.isMouseDown&&!downshiftButtonIsActive){_this.reset({type:blurInput});}});};_this.menuRef=function(node){_this._menuNode=node;};_this.getMenuProps=function(_temp5,_temp6){var _extends3;var _ref5=_temp5===void 0?{}:_temp5,_ref5$refKey=_ref5.refKey,refKey=_ref5$refKey===void 0?'ref':_ref5$refKey,ref=_ref5.ref,props=_objectWithoutPropertiesLoose(_ref5,_excluded4$1);var _ref6=_temp6===void 0?{}:_temp6,_ref6$suppressRefErro=_ref6.suppressRefError,suppressRefError=_ref6$suppressRefErro===void 0?false:_ref6$suppressRefErro;_this.getMenuProps.called=true;_this.getMenuProps.refKey=refKey;_this.getMenuProps.suppressRefError=suppressRefError;return _extends((_extends3={},_extends3[refKey]=handleRefs(ref,_this.menuRef),_extends3.role='listbox',_extends3['aria-labelledby']=props&&props['aria-label']?null:_this.labelId,_extends3.id=_this.menuId,_extends3),props);};_this.getItemProps=function(_temp7){var _enabledEventHandlers;var _ref7=_temp7===void 0?{}:_temp7,onMouseMove=_ref7.onMouseMove,onMouseDown=_ref7.onMouseDown,onClick=_ref7.onClick;_ref7.onPress;var index=_ref7.index,_ref7$item=_ref7.item,item=_ref7$item===void 0?process.env.NODE_ENV==='production'?/* istanbul ignore next */undefined:requiredProp('getItemProps','item'):_ref7$item,rest=_objectWithoutPropertiesLoose(_ref7,_excluded5$1);if(index===undefined){_this.items.push(item);index=_this.items.indexOf(item);}else{_this.items[index]=item;}var onSelectKey='onClick';var customClickHandler=onClick;var enabledEventHandlers=(_enabledEventHandlers={// onMouseMove is used over onMouseEnter here. onMouseMove
1573// is only triggered on actual mouse movement while onMouseEnter
1574// can fire on DOM changes, interrupting keyboard navigation
1575onMouseMove:callAllEventHandlers(onMouseMove,function(){if(index===_this.getState().highlightedIndex){return;}_this.setHighlightedIndex(index,{type:itemMouseEnter});// We never want to manually scroll when changing state based
1576// on `onMouseMove` because we will be moving the element out
1577// from under the user which is currently scrolling/moving the
1578// cursor
1579_this.avoidScrolling=true;_this.internalSetTimeout(function(){return _this.avoidScrolling=false;},250);}),onMouseDown:callAllEventHandlers(onMouseDown,function(event){// This prevents the activeElement from being changed
1580// to the item so it can remain with the current activeElement
1581// which is a more common use case.
1582event.preventDefault();})},_enabledEventHandlers[onSelectKey]=callAllEventHandlers(customClickHandler,function(){_this.selectItemAtIndex(index,{type:clickItem});}),_enabledEventHandlers);// Passing down the onMouseDown handler to prevent redirect
1583// of the activeElement if clicking on disabled items
1584var eventHandlers=rest.disabled?{onMouseDown:enabledEventHandlers.onMouseDown}:enabledEventHandlers;return _extends({id:_this.getItemId(index),role:'option','aria-selected':_this.getState().highlightedIndex===index},eventHandlers,rest);};_this.clearItems=function(){_this.items=[];};_this.reset=function(otherStateToSet,cb){if(otherStateToSet===void 0){otherStateToSet={};}otherStateToSet=pickState(otherStateToSet);_this.internalSetState(function(_ref8){var selectedItem=_ref8.selectedItem;return _extends({isOpen:_this.props.defaultIsOpen,highlightedIndex:_this.props.defaultHighlightedIndex,inputValue:_this.props.itemToString(selectedItem)},otherStateToSet);},cb);};_this.toggleMenu=function(otherStateToSet,cb){if(otherStateToSet===void 0){otherStateToSet={};}otherStateToSet=pickState(otherStateToSet);_this.internalSetState(function(_ref9){var isOpen=_ref9.isOpen;return _extends({isOpen:!isOpen},isOpen&&{highlightedIndex:_this.props.defaultHighlightedIndex},otherStateToSet);},function(){var _this$getState7=_this.getState(),isOpen=_this$getState7.isOpen,highlightedIndex=_this$getState7.highlightedIndex;if(isOpen){if(_this.getItemCount()>0&&typeof highlightedIndex==='number'){_this.setHighlightedIndex(highlightedIndex,otherStateToSet);}}cbToCb(cb)();});};_this.openMenu=function(cb){_this.internalSetState({isOpen:true},cb);};_this.closeMenu=function(cb){_this.internalSetState({isOpen:false},cb);};_this.updateStatus=debounce(function(){var state=_this.getState();var item=_this.items[state.highlightedIndex];var resultCount=_this.getItemCount();var status=_this.props.getA11yStatusMessage(_extends({itemToString:_this.props.itemToString,previousResultCount:_this.previousResultCount,resultCount:resultCount,highlightedItem:item},state));_this.previousResultCount=resultCount;setStatus(status,_this.props.environment.document);},200);var _this$props=_this.props,defaultHighlightedIndex=_this$props.defaultHighlightedIndex,_this$props$initialHi=_this$props.initialHighlightedIndex,_highlightedIndex=_this$props$initialHi===void 0?defaultHighlightedIndex:_this$props$initialHi,defaultIsOpen=_this$props.defaultIsOpen,_this$props$initialIs=_this$props.initialIsOpen,_isOpen=_this$props$initialIs===void 0?defaultIsOpen:_this$props$initialIs,_this$props$initialIn=_this$props.initialInputValue,_inputValue=_this$props$initialIn===void 0?'':_this$props$initialIn,_this$props$initialSe=_this$props.initialSelectedItem,_selectedItem=_this$props$initialSe===void 0?null:_this$props$initialSe;var _state=_this.getState({highlightedIndex:_highlightedIndex,isOpen:_isOpen,inputValue:_inputValue,selectedItem:_selectedItem});if(_state.selectedItem!=null&&_this.props.initialInputValue===undefined){_state.inputValue=_this.props.itemToString(_state.selectedItem);}_this.state=_state;return _this;}var _proto=Downshift.prototype;/**
1585 * Clear all running timeouts
1586 */_proto.internalClearTimeouts=function internalClearTimeouts(){this.timeoutIds.forEach(function(id){clearTimeout(id);});this.timeoutIds=[];}/**
1587 * Gets the state based on internal state or props
1588 * If a state value is passed via props, then that
1589 * is the value given, otherwise it's retrieved from
1590 * stateToMerge
1591 *
1592 * @param {Object} stateToMerge defaults to this.state
1593 * @return {Object} the state
1594 */;_proto.getState=function getState$1(stateToMerge){if(stateToMerge===void 0){stateToMerge=this.state;}return getState(stateToMerge,this.props);};_proto.getItemCount=function getItemCount(){// things read better this way. They're in priority order:
1595// 1. `this.itemCount`
1596// 2. `this.props.itemCount`
1597// 3. `this.items.length`
1598var itemCount=this.items.length;if(this.itemCount!=null){itemCount=this.itemCount;}else if(this.props.itemCount!==undefined){itemCount=this.props.itemCount;}return itemCount;};_proto.getItemNodeFromIndex=function getItemNodeFromIndex(index){return this.props.environment.document.getElementById(this.getItemId(index));};_proto.scrollHighlightedItemIntoView=function scrollHighlightedItemIntoView(){/* istanbul ignore else (react-native) */{var node=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(node,this._menuNode);}};_proto.moveHighlightedIndex=function moveHighlightedIndex(amount,otherStateToSet){var _this6=this;var itemCount=this.getItemCount();var _this$getState8=this.getState(),highlightedIndex=_this$getState8.highlightedIndex;if(itemCount>0){var nextHighlightedIndex=getNextWrappingIndex(amount,highlightedIndex,itemCount,function(index){return _this6.getItemNodeFromIndex(index);});this.setHighlightedIndex(nextHighlightedIndex,otherStateToSet);}};_proto.getStateAndHelpers=function getStateAndHelpers(){var _this$getState9=this.getState(),highlightedIndex=_this$getState9.highlightedIndex,inputValue=_this$getState9.inputValue,selectedItem=_this$getState9.selectedItem,isOpen=_this$getState9.isOpen;var itemToString=this.props.itemToString;var id=this.id;var getRootProps=this.getRootProps,getToggleButtonProps=this.getToggleButtonProps,getLabelProps=this.getLabelProps,getMenuProps=this.getMenuProps,getInputProps=this.getInputProps,getItemProps=this.getItemProps,openMenu=this.openMenu,closeMenu=this.closeMenu,toggleMenu=this.toggleMenu,selectItem=this.selectItem,selectItemAtIndex=this.selectItemAtIndex,selectHighlightedItem=this.selectHighlightedItem,setHighlightedIndex=this.setHighlightedIndex,clearSelection=this.clearSelection,clearItems=this.clearItems,reset=this.reset,setItemCount=this.setItemCount,unsetItemCount=this.unsetItemCount,setState=this.internalSetState;return{// prop getters
1599getRootProps:getRootProps,getToggleButtonProps:getToggleButtonProps,getLabelProps:getLabelProps,getMenuProps:getMenuProps,getInputProps:getInputProps,getItemProps:getItemProps,// actions
1600reset:reset,openMenu:openMenu,closeMenu:closeMenu,toggleMenu:toggleMenu,selectItem:selectItem,selectItemAtIndex:selectItemAtIndex,selectHighlightedItem:selectHighlightedItem,setHighlightedIndex:setHighlightedIndex,clearSelection:clearSelection,clearItems:clearItems,setItemCount:setItemCount,unsetItemCount:unsetItemCount,setState:setState,// props
1601itemToString:itemToString,// derived
1602id:id,// state
1603highlightedIndex:highlightedIndex,inputValue:inputValue,isOpen:isOpen,selectedItem:selectedItem};}//////////////////////////// ROOT
1604;_proto.componentDidMount=function componentDidMount(){var _this7=this;/* istanbul ignore if (react-native) */if(process.env.NODE_ENV!=='production'&&!false&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError){validateGetMenuPropsCalledCorrectly(this._menuNode,this.getMenuProps);}/* istanbul ignore if (react-native) */{// this.isMouseDown helps us track whether the mouse is currently held down.
1605// This is useful when the user clicks on an item in the list, but holds the mouse
1606// down long enough for the list to disappear (because the blur event fires on the input)
1607// this.isMouseDown is used in the blur handler on the input to determine whether the blur event should
1608// trigger hiding the menu.
1609var onMouseDown=function onMouseDown(){_this7.isMouseDown=true;};var onMouseUp=function onMouseUp(event){_this7.isMouseDown=false;// if the target element or the activeElement is within a downshift node
1610// then we don't want to reset downshift
1611var contextWithinDownshift=targetWithinDownshift(event.target,[_this7._rootNode,_this7._menuNode],_this7.props.environment);if(!contextWithinDownshift&&_this7.getState().isOpen){_this7.reset({type:mouseUp},function(){return _this7.props.onOuterClick(_this7.getStateAndHelpers());});}};// Touching an element in iOS gives focus and hover states, but touching out of
1612// the element will remove hover, and persist the focus state, resulting in the
1613// blur event not being triggered.
1614// this.isTouchMove helps us track whether the user is tapping or swiping on a touch screen.
1615// If the user taps outside of Downshift, the component should be reset,
1616// but not if the user is swiping
1617var onTouchStart=function onTouchStart(){_this7.isTouchMove=false;};var onTouchMove=function onTouchMove(){_this7.isTouchMove=true;};var onTouchEnd=function onTouchEnd(event){var contextWithinDownshift=targetWithinDownshift(event.target,[_this7._rootNode,_this7._menuNode],_this7.props.environment,false);if(!_this7.isTouchMove&&!contextWithinDownshift&&_this7.getState().isOpen){_this7.reset({type:touchEnd},function(){return _this7.props.onOuterClick(_this7.getStateAndHelpers());});}};var environment=this.props.environment;environment.addEventListener('mousedown',onMouseDown);environment.addEventListener('mouseup',onMouseUp);environment.addEventListener('touchstart',onTouchStart);environment.addEventListener('touchmove',onTouchMove);environment.addEventListener('touchend',onTouchEnd);this.cleanup=function(){_this7.internalClearTimeouts();_this7.updateStatus.cancel();environment.removeEventListener('mousedown',onMouseDown);environment.removeEventListener('mouseup',onMouseUp);environment.removeEventListener('touchstart',onTouchStart);environment.removeEventListener('touchmove',onTouchMove);environment.removeEventListener('touchend',onTouchEnd);};}};_proto.shouldScroll=function shouldScroll(prevState,prevProps){var _ref10=this.props.highlightedIndex===undefined?this.getState():this.props,currentHighlightedIndex=_ref10.highlightedIndex;var _ref11=prevProps.highlightedIndex===undefined?prevState:prevProps,prevHighlightedIndex=_ref11.highlightedIndex;var scrollWhenOpen=currentHighlightedIndex&&this.getState().isOpen&&!prevState.isOpen;var scrollWhenNavigating=currentHighlightedIndex!==prevHighlightedIndex;return scrollWhenOpen||scrollWhenNavigating;};_proto.componentDidUpdate=function componentDidUpdate(prevProps,prevState){if(process.env.NODE_ENV!=='production'){validateControlledUnchanged(this.state,prevProps,this.props);/* istanbul ignore if (react-native) */if(this.getMenuProps.called&&!this.getMenuProps.suppressRefError){validateGetMenuPropsCalledCorrectly(this._menuNode,this.getMenuProps);}}if(isControlledProp(this.props,'selectedItem')&&this.props.selectedItemChanged(prevProps.selectedItem,this.props.selectedItem)){this.internalSetState({type:controlledPropUpdatedSelectedItem,inputValue:this.props.itemToString(this.props.selectedItem)});}if(!this.avoidScrolling&&this.shouldScroll(prevState,prevProps)){this.scrollHighlightedItemIntoView();}/* istanbul ignore else (react-native) */{this.updateStatus();}};_proto.componentWillUnmount=function componentWillUnmount(){this.cleanup();// avoids memory leak
1618};_proto.render=function render(){var children=unwrapArray(this.props.children,noop);// because the items are rerendered every time we call the children
1619// we clear this out each render and it will be populated again as
1620// getItemProps is called.
1621this.clearItems();// we reset this so we know whether the user calls getRootProps during
1622// this render. If they do then we don't need to do anything,
1623// if they don't then we need to clone the element they return and
1624// apply the props for them.
1625this.getRootProps.called=false;this.getRootProps.refKey=undefined;this.getRootProps.suppressRefError=undefined;// we do something similar for getMenuProps
1626this.getMenuProps.called=false;this.getMenuProps.refKey=undefined;this.getMenuProps.suppressRefError=undefined;// we do something similar for getLabelProps
1627this.getLabelProps.called=false;// and something similar for getInputProps
1628this.getInputProps.called=false;var element=unwrapArray(children(this.getStateAndHelpers()));if(!element){return null;}if(this.getRootProps.called||this.props.suppressRefError){if(process.env.NODE_ENV!=='production'&&!this.getRootProps.suppressRefError&&!this.props.suppressRefError){validateGetRootPropsCalledCorrectly(element,this.getRootProps);}return element;}else if(isDOMElement(element)){// they didn't apply the root props, but we can clone
1629// this and apply the props ourselves
1630return/*#__PURE__*/cloneElement(element,this.getRootProps(getElementProps(element)));}/* istanbul ignore else */if(process.env.NODE_ENV!=='production'){// they didn't apply the root props, but they need to
1631// otherwise we can't query around the autocomplete
1632throw new Error('downshift: If you return a non-DOM element, you must apply the getRootProps function');}/* istanbul ignore next */return undefined;};return Downshift;}(Component);Downshift.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:false,getA11yStatusMessage:getA11yStatusMessage$1,itemToString:function itemToString(i){if(i==null){return'';}if(process.env.NODE_ENV!=='production'&&isPlainObject(i)&&!i.hasOwnProperty('toString')){// eslint-disable-next-line no-console
1633console.warn('downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.','The object that was passed:',i);}return String(i);},onStateChange:noop,onInputValueChange:noop,onUserAction:noop,onChange:noop,onSelect:noop,onOuterClick:noop,selectedItemChanged:function selectedItemChanged(prevItem,item){return prevItem!==item;},environment:/* istanbul ignore next (ssr) */typeof window==='undefined'?{}:window,stateReducer:function stateReducer(state,stateToSet){return stateToSet;},suppressRefError:false,scrollIntoView:scrollIntoView};Downshift.stateChangeTypes=stateChangeTypes$3;return Downshift;}();process.env.NODE_ENV!=="production"?Downshift.propTypes={children:PropTypes.func,defaultHighlightedIndex:PropTypes.number,defaultIsOpen:PropTypes.bool,initialHighlightedIndex:PropTypes.number,initialSelectedItem:PropTypes.any,initialInputValue:PropTypes.string,initialIsOpen:PropTypes.bool,getA11yStatusMessage:PropTypes.func,itemToString:PropTypes.func,onChange:PropTypes.func,onSelect:PropTypes.func,onStateChange:PropTypes.func,onInputValueChange:PropTypes.func,onUserAction:PropTypes.func,onOuterClick:PropTypes.func,selectedItemChanged:PropTypes.func,stateReducer:PropTypes.func,itemCount:PropTypes.number,id:PropTypes.string,environment:PropTypes.shape({addEventListener:PropTypes.func,removeEventListener:PropTypes.func,document:PropTypes.shape({getElementById:PropTypes.func,activeElement:PropTypes.any,body:PropTypes.any})}),suppressRefError:PropTypes.bool,scrollIntoView:PropTypes.func,// things we keep in state for uncontrolled components
1634// but can accept as props for controlled components
1635/* eslint-disable react/no-unused-prop-types */selectedItem:PropTypes.any,isOpen:PropTypes.bool,inputValue:PropTypes.string,highlightedIndex:PropTypes.number,labelId:PropTypes.string,inputId:PropTypes.string,menuId:PropTypes.string,getItemId:PropTypes.func/* eslint-enable react/no-unused-prop-types */}:void 0;var Downshift$1=Downshift;function validateGetMenuPropsCalledCorrectly(node,_ref12){var refKey=_ref12.refKey;if(!node){// eslint-disable-next-line no-console
1636console.error("downshift: The ref prop \""+refKey+"\" from getMenuProps was not applied correctly on your menu element.");}}function validateGetRootPropsCalledCorrectly(element,_ref13){var refKey=_ref13.refKey;var refKeySpecified=refKey!=='ref';var isComposite=!isDOMElement(element);if(isComposite&&!refKeySpecified&&!reactIs.exports.isForwardRef(element)){// eslint-disable-next-line no-console
1637console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');}else if(!isComposite&&refKeySpecified){// eslint-disable-next-line no-console
1638console.error("downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \""+refKey+"\"");}if(!reactIs.exports.isForwardRef(element)&&!getElementProps(element)[refKey]){// eslint-disable-next-line no-console
1639console.error("downshift: You must apply the ref prop \""+refKey+"\" from getRootProps onto your root element.");}}/**
1640 * Default state reducer that returns the changes.
1641 *
1642 * @param {Object} s state.
1643 * @param {Object} a action with changes.
1644 * @returns {Object} changes.
1645 */function stateReducer(s,a){return a.changes;}/**
1646 * Returns a message to be added to aria-live region when item is selected.
1647 *
1648 * @param {Object} selectionParameters Parameters required to build the message.
1649 * @returns {string} The a11y message.
1650 */function getA11ySelectionMessage(selectionParameters){var selectedItem=selectionParameters.selectedItem,itemToStringLocal=selectionParameters.itemToString;return selectedItem?itemToStringLocal(selectedItem)+" has been selected.":'';}/**
1651 * Debounced call for updating the a11y message.
1652 */debounce(function(getA11yMessage,document){setStatus(getA11yMessage(),document);},200);// istanbul ignore next
1653function itemToString(item){return item?String(item):'';}var defaultProps$3={itemToString:itemToString,stateReducer:stateReducer,getA11ySelectionMessage:getA11ySelectionMessage,scrollIntoView:scrollIntoView,circularNavigation:false,environment:/* istanbul ignore next (ssr) */typeof window==='undefined'?{}:window};/**
1654 * Custom hook that checks if getter props are called correctly.
1655 *
1656 * @param {...any} propKeys Getter prop names to be handled.
1657 * @returns {Function} Setter function called inside getter props to set call information.
1658 */ /* istanbul ignore next */if(process.env.NODE_ENV!=='production');/* istanbul ignore next */if(process.env.NODE_ENV!=='production');({items:PropTypes.array.isRequired,itemToString:PropTypes.func,getA11yStatusMessage:PropTypes.func,getA11ySelectionMessage:PropTypes.func,circularNavigation:PropTypes.bool,highlightedIndex:PropTypes.number,defaultHighlightedIndex:PropTypes.number,initialHighlightedIndex:PropTypes.number,isOpen:PropTypes.bool,defaultIsOpen:PropTypes.bool,initialIsOpen:PropTypes.bool,selectedItem:PropTypes.any,initialSelectedItem:PropTypes.any,defaultSelectedItem:PropTypes.any,id:PropTypes.string,labelId:PropTypes.string,menuId:PropTypes.string,getItemId:PropTypes.func,toggleButtonId:PropTypes.string,stateReducer:PropTypes.func,onSelectedItemChange:PropTypes.func,onHighlightedIndexChange:PropTypes.func,onStateChange:PropTypes.func,onIsOpenChange:PropTypes.func,environment:PropTypes.shape({addEventListener:PropTypes.func,removeEventListener:PropTypes.func,document:PropTypes.shape({getElementById:PropTypes.func,activeElement:PropTypes.any,body:PropTypes.any})})});/**
1659 * Default implementation for status message. Only added when menu is open.
1660 * Will specift if there are results in the list, and if so, how many,
1661 * and what keys are relevant.
1662 *
1663 * @param {Object} param the downshift state and other relevant properties
1664 * @return {String} the a11y status message
1665 */function getA11yStatusMessage(_a){var isOpen=_a.isOpen,resultCount=_a.resultCount,previousResultCount=_a.previousResultCount;if(!isOpen){return'';}if(!resultCount){return'No results are available.';}if(resultCount!==previousResultCount){return resultCount+" result"+(resultCount===1?' is':'s are')+" available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.";}return'';}_assign(_assign({},defaultProps$3),{getA11yStatusMessage:getA11yStatusMessage});// eslint-disable-next-line import/no-mutable-exports
1666/* istanbul ignore next */if(process.env.NODE_ENV!=='production');process.env.NODE_ENV!=="production"?'__menu_keydown_arrow_down__':0;process.env.NODE_ENV!=="production"?'__menu_keydown_arrow_up__':1;process.env.NODE_ENV!=="production"?'__menu_keydown_escape__':2;process.env.NODE_ENV!=="production"?'__menu_keydown_home__':3;process.env.NODE_ENV!=="production"?'__menu_keydown_end__':4;process.env.NODE_ENV!=="production"?'__menu_keydown_enter__':5;process.env.NODE_ENV!=="production"?'__menu_keydown_space_button__':6;process.env.NODE_ENV!=="production"?'__menu_keydown_character__':7;process.env.NODE_ENV!=="production"?'__menu_blur__':8;process.env.NODE_ENV!=="production"?'__menu_mouse_leave__':9;process.env.NODE_ENV!=="production"?'__item_mouse_move__':10;process.env.NODE_ENV!=="production"?'__item_click__':11;process.env.NODE_ENV!=="production"?'__togglebutton_click__':12;process.env.NODE_ENV!=="production"?'__togglebutton_keydown_arrow_down__':13;process.env.NODE_ENV!=="production"?'__togglebutton_keydown_arrow_up__':14;process.env.NODE_ENV!=="production"?'__togglebutton_keydown_character__':15;process.env.NODE_ENV!=="production"?'__function_toggle_menu__':16;process.env.NODE_ENV!=="production"?'__function_open_menu__':17;process.env.NODE_ENV!=="production"?'__function_close_menu__':18;process.env.NODE_ENV!=="production"?'__function_set_highlighted_index__':19;process.env.NODE_ENV!=="production"?'__function_select_item__':20;process.env.NODE_ENV!=="production"?'__function_set_input_value__':21;process.env.NODE_ENV!=="production"?'__function_reset__':22;process.env.NODE_ENV!=="production"?'__input_keydown_arrow_down__':0;process.env.NODE_ENV!=="production"?'__input_keydown_arrow_up__':1;process.env.NODE_ENV!=="production"?'__input_keydown_escape__':2;process.env.NODE_ENV!=="production"?'__input_keydown_home__':3;process.env.NODE_ENV!=="production"?'__input_keydown_end__':4;process.env.NODE_ENV!=="production"?'__input_keydown_enter__':5;process.env.NODE_ENV!=="production"?'__input_change__':6;process.env.NODE_ENV!=="production"?'__input_blur__':7;process.env.NODE_ENV!=="production"?'__menu_mouse_leave__':8;process.env.NODE_ENV!=="production"?'__item_mouse_move__':9;process.env.NODE_ENV!=="production"?'__item_click__':10;process.env.NODE_ENV!=="production"?'__togglebutton_click__':11;process.env.NODE_ENV!=="production"?'__function_toggle_menu__':12;process.env.NODE_ENV!=="production"?'__function_open_menu__':13;process.env.NODE_ENV!=="production"?'__function_close_menu__':14;process.env.NODE_ENV!=="production"?'__function_set_highlighted_index__':15;process.env.NODE_ENV!=="production"?'__function_select_item__':16;process.env.NODE_ENV!=="production"?'__function_set_input_value__':17;process.env.NODE_ENV!=="production"?'__function_reset__':18;process.env.NODE_ENV!=="production"?'__controlled_prop_updated_selected_item__':19;({items:PropTypes.array.isRequired,itemToString:PropTypes.func,getA11yStatusMessage:PropTypes.func,getA11ySelectionMessage:PropTypes.func,circularNavigation:PropTypes.bool,highlightedIndex:PropTypes.number,defaultHighlightedIndex:PropTypes.number,initialHighlightedIndex:PropTypes.number,isOpen:PropTypes.bool,defaultIsOpen:PropTypes.bool,initialIsOpen:PropTypes.bool,selectedItem:PropTypes.any,initialSelectedItem:PropTypes.any,defaultSelectedItem:PropTypes.any,inputValue:PropTypes.string,defaultInputValue:PropTypes.string,initialInputValue:PropTypes.string,id:PropTypes.string,labelId:PropTypes.string,menuId:PropTypes.string,getItemId:PropTypes.func,inputId:PropTypes.string,toggleButtonId:PropTypes.string,stateReducer:PropTypes.func,onSelectedItemChange:PropTypes.func,onHighlightedIndexChange:PropTypes.func,onStateChange:PropTypes.func,onIsOpenChange:PropTypes.func,onInputValueChange:PropTypes.func,environment:PropTypes.shape({addEventListener:PropTypes.func,removeEventListener:PropTypes.func,document:PropTypes.shape({getElementById:PropTypes.func,activeElement:PropTypes.any,body:PropTypes.any})})});/* istanbul ignore next */if(process.env.NODE_ENV!=='production');_extends({},defaultProps$3,{getA11yStatusMessage:getA11yStatusMessage$1,circularNavigation:true});/**
1667 * Returns a message to be added to aria-live region when item is removed.
1668 *
1669 * @param {Object} selectionParameters Parameters required to build the message.
1670 * @returns {string} The a11y message.
1671 */function getA11yRemovalMessage(selectionParameters){var removedSelectedItem=selectionParameters.removedSelectedItem,itemToStringLocal=selectionParameters.itemToString;return itemToStringLocal(removedSelectedItem)+" has been removed.";}({selectedItems:PropTypes.array,initialSelectedItems:PropTypes.array,defaultSelectedItems:PropTypes.array,itemToString:PropTypes.func,getA11yRemovalMessage:PropTypes.func,stateReducer:PropTypes.func,activeIndex:PropTypes.number,initialActiveIndex:PropTypes.number,defaultActiveIndex:PropTypes.number,onActiveIndexChange:PropTypes.func,onSelectedItemsChange:PropTypes.func,keyNavigationNext:PropTypes.string,keyNavigationPrevious:PropTypes.string,environment:PropTypes.shape({addEventListener:PropTypes.func,removeEventListener:PropTypes.func,document:PropTypes.shape({getElementById:PropTypes.func,activeElement:PropTypes.any,body:PropTypes.any})})});({itemToString:defaultProps$3.itemToString,stateReducer:defaultProps$3.stateReducer,environment:defaultProps$3.environment,getA11yRemovalMessage:getA11yRemovalMessage,keyNavigationNext:'ArrowRight',keyNavigationPrevious:'ArrowLeft'});// eslint-disable-next-line import/no-mutable-exports
1672/* istanbul ignore next */if(process.env.NODE_ENV!=='production');process.env.NODE_ENV!=="production"?'__selected_item_click__':0;process.env.NODE_ENV!=="production"?'__selected_item_keydown_delete__':1;process.env.NODE_ENV!=="production"?'__selected_item_keydown_backspace__':2;process.env.NODE_ENV!=="production"?'__selected_item_keydown_navigation_next__':3;process.env.NODE_ENV!=="production"?'__selected_item_keydown_navigation_previous__':4;process.env.NODE_ENV!=="production"?'__dropdown_keydown_navigation_previous__':5;process.env.NODE_ENV!=="production"?'__dropdown_keydown_backspace__':6;process.env.NODE_ENV!=="production"?'__dropdown_click__':7;process.env.NODE_ENV!=="production"?'__function_add_selected_item__':8;process.env.NODE_ENV!=="production"?'__function_remove_selected_item__':9;process.env.NODE_ENV!=="production"?'__function_set_selected_items__':10;process.env.NODE_ENV!=="production"?'__function_set_active_index__':11;process.env.NODE_ENV!=="production"?'__function_reset__':12;var fuse={exports:{}};/*!
1673 * Fuse.js v3.6.1 - Lightweight fuzzy-search (http://fusejs.io)
1674 *
1675 * Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)
1676 * All Rights Reserved. Apache Software License 2.0
1677 *
1678 * http://www.apache.org/licenses/LICENSE-2.0
1679 */(function(module,exports){!function(e,t){module.exports=t();}(commonjsGlobal,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports;}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n});},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==_typeof2(e)&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e){r.d(n,o,function(t){return e[t];}.bind(null,o));}return n;},r.n=function(e){var t=e&&e.__esModule?function(){return e.default;}:function(){return e;};return r.d(t,"a",t),t;},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t);},r.p="",r(r.s=0);}([function(e,t,r){function n(e){return(n="function"==typeof Symbol&&"symbol"==_typeof2(Symbol.iterator)?function(e){return _typeof2(e);}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof2(e);})(e);}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n);}}var i=r(1),a=r(7),s=a.get,c=(a.deepValue,a.isArray),h=function(){function e(t,r){var n=r.location,o=void 0===n?0:n,i=r.distance,a=void 0===i?100:i,c=r.threshold,h=void 0===c?.6:c,l=r.maxPatternLength,u=void 0===l?32:l,f=r.caseSensitive,v=void 0!==f&&f,p=r.tokenSeparator,d=void 0===p?/ +/g:p,g=r.findAllMatches,y=void 0!==g&&g,m=r.minMatchCharLength,k=void 0===m?1:m,b=r.id,S=void 0===b?null:b,x=r.keys,M=void 0===x?[]:x,_=r.shouldSort,w=void 0===_||_,L=r.getFn,A=void 0===L?s:L,O=r.sortFn,C=void 0===O?function(e,t){return e.score-t.score;}:O,j=r.tokenize,P=void 0!==j&&j,I=r.matchAllTokens,F=void 0!==I&&I,T=r.includeMatches,N=void 0!==T&&T,z=r.includeScore,E=void 0!==z&&z,W=r.verbose,K=void 0!==W&&W;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function");}(this,e),this.options={location:o,distance:a,threshold:h,maxPatternLength:u,isCaseSensitive:v,tokenSeparator:d,findAllMatches:y,minMatchCharLength:k,id:S,keys:M,includeMatches:N,includeScore:E,shouldSort:w,getFn:A,sortFn:C,verbose:K,tokenize:P,matchAllTokens:F},this.setCollection(t),this._processKeys(M);}var t,r;return t=e,(r=[{key:"setCollection",value:function value(e){return this.list=e,e;}},{key:"_processKeys",value:function value(e){if(this._keyWeights={},this._keyNames=[],e.length&&"string"==typeof e[0])for(var t=0,r=e.length;t<r;t+=1){var n=e[t];this._keyWeights[n]=1,this._keyNames.push(n);}else{for(var a=0,s=0,c=e.length;s<c;s+=1){var h=e[s];if(!h.hasOwnProperty("name"))throw new Error('Missing "name" property in key object');var l=h.name;if(this._keyNames.push(l),!h.hasOwnProperty("weight"))throw new Error('Missing "weight" property in key object');var u=h.weight;if(u<0||u>1)throw new Error('"weight" property in key must bein the range of [0, 1)');this._keyWeights[l]=u,a+=u;}if(a>1)throw new Error("Total of weights cannot exceed 1");}}},{key:"search",value:function value(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:!1};this._log('---------\nSearch pattern: "'.concat(e,'"'));var r=this._prepareSearchers(e),n=r.tokenSearchers,o=r.fullSearcher,i=this._search(n,o);return this._computeScore(i),this.options.shouldSort&&this._sort(i),t.limit&&"number"==typeof t.limit&&(i=i.slice(0,t.limit)),this._format(i);}},{key:"_prepareSearchers",value:function value(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var r=e.split(this.options.tokenSeparator),n=0,o=r.length;n<o;n+=1){t.push(new i(r[n],this.options));}return{tokenSearchers:t,fullSearcher:new i(e,this.options)};}},{key:"_search",value:function value(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=this.list,n={},o=[];if("string"==typeof r[0]){for(var i=0,a=r.length;i<a;i+=1){this._analyze({key:"",value:r[i],record:i,index:i},{resultMap:n,results:o,tokenSearchers:e,fullSearcher:t});}return o;}for(var s=0,c=r.length;s<c;s+=1){for(var h=r[s],l=0,u=this._keyNames.length;l<u;l+=1){var f=this._keyNames[l];this._analyze({key:f,value:this.options.getFn(h,f),record:h,index:s},{resultMap:n,results:o,tokenSearchers:e,fullSearcher:t});}}return o;}},{key:"_analyze",value:function value(e,t){var r=this,n=e.key,o=e.arrayIndex,i=void 0===o?-1:o,a=e.value,s=e.record,h=e.index,l=t.tokenSearchers,u=void 0===l?[]:l,f=t.fullSearcher,v=t.resultMap,p=void 0===v?{}:v,d=t.results,g=void 0===d?[]:d;!function e(t,o,i,a){if(null!=o)if("string"==typeof o){var s=!1,h=-1,l=0;r._log("\nKey: ".concat(""===n?"--":n));var v=f.search(o);if(r._log('Full text: "'.concat(o,'", score: ').concat(v.score)),r.options.tokenize){for(var d=o.split(r.options.tokenSeparator),y=d.length,m=[],k=0,b=u.length;k<b;k+=1){var S=u[k];r._log('\nPattern: "'.concat(S.pattern,'"'));for(var x=!1,M=0;M<y;M+=1){var _=d[M],w=S.search(_),L={};w.isMatch?(L[_]=w.score,s=!0,x=!0,m.push(w.score)):(L[_]=1,r.options.matchAllTokens||m.push(1)),r._log('Token: "'.concat(_,'", score: ').concat(L[_]));}x&&(l+=1);}h=m[0];for(var A=m.length,O=1;O<A;O+=1){h+=m[O];}h/=A,r._log("Token score average:",h);}var C=v.score;h>-1&&(C=(C+h)/2),r._log("Score average:",C);var j=!r.options.tokenize||!r.options.matchAllTokens||l>=u.length;if(r._log("\nCheck Matches: ".concat(j)),(s||v.isMatch)&&j){var P={key:n,arrayIndex:t,value:o,score:C};r.options.includeMatches&&(P.matchedIndices=v.matchedIndices);var I=p[a];I?I.output.push(P):(p[a]={item:i,output:[P]},g.push(p[a]));}}else if(c(o))for(var F=0,T=o.length;F<T;F+=1){e(F,o[F],i,a);}}(i,a,s,h);}},{key:"_computeScore",value:function value(e){this._log("\n\nComputing score:\n");for(var t=this._keyWeights,r=!!Object.keys(t).length,n=0,o=e.length;n<o;n+=1){for(var i=e[n],a=i.output,s=a.length,c=1,h=0;h<s;h+=1){var l=a[h],u=l.key,f=r?t[u]:1,v=0===l.score&&t&&t[u]>0?Number.EPSILON:l.score;c*=Math.pow(v,f);}i.score=c,this._log(i);}}},{key:"_sort",value:function value(e){this._log("\n\nSorting...."),e.sort(this.options.sortFn);}},{key:"_format",value:function value(e){var t=[];if(this.options.verbose){var r=[];this._log("\n\nOutput:\n\n",JSON.stringify(e,function(e,t){if("object"===n(t)&&null!==t){if(-1!==r.indexOf(t))return;r.push(t);}return t;},2)),r=null;}var o=[];this.options.includeMatches&&o.push(function(e,t){var r=e.output;t.matches=[];for(var n=0,o=r.length;n<o;n+=1){var i=r[n];if(0!==i.matchedIndices.length){var a={indices:i.matchedIndices,value:i.value};i.key&&(a.key=i.key),i.hasOwnProperty("arrayIndex")&&i.arrayIndex>-1&&(a.arrayIndex=i.arrayIndex),t.matches.push(a);}}}),this.options.includeScore&&o.push(function(e,t){t.score=e.score;});for(var i=0,a=e.length;i<a;i+=1){var s=e[i];if(this.options.id&&(s.item=this.options.getFn(s.item,this.options.id)[0]),o.length){for(var c={item:s.item},h=0,l=o.length;h<l;h+=1){o[h](s,c);}t.push(c);}else t.push(s.item);}return t;}},{key:"_log",value:function value(){var e;this.options.verbose&&(e=console).log.apply(e,arguments);}}])&&o(t.prototype,r),e;}();e.exports=h;},function(e,t,r){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n);}}var o=r(2),i=r(3),a=r(6),s=function(){function e(t,r){var n=r.location,o=void 0===n?0:n,i=r.distance,s=void 0===i?100:i,c=r.threshold,h=void 0===c?.6:c,l=r.maxPatternLength,u=void 0===l?32:l,f=r.isCaseSensitive,v=void 0!==f&&f,p=r.tokenSeparator,d=void 0===p?/ +/g:p,g=r.findAllMatches,y=void 0!==g&&g,m=r.minMatchCharLength,k=void 0===m?1:m,b=r.includeMatches,S=void 0!==b&&b;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function");}(this,e),this.options={location:o,distance:s,threshold:h,maxPatternLength:u,isCaseSensitive:v,tokenSeparator:d,findAllMatches:y,includeMatches:S,minMatchCharLength:k},this.pattern=v?t:t.toLowerCase(),this.pattern.length<=u&&(this.patternAlphabet=a(this.pattern));}var t,r;return t=e,(r=[{key:"search",value:function value(e){var t=this.options,r=t.isCaseSensitive,n=t.includeMatches;if(r||(e=e.toLowerCase()),this.pattern===e){var a={isMatch:!0,score:0};return n&&(a.matchedIndices=[[0,e.length-1]]),a;}var s=this.options,c=s.maxPatternLength,h=s.tokenSeparator;if(this.pattern.length>c)return o(e,this.pattern,h);var l=this.options,u=l.location,f=l.distance,v=l.threshold,p=l.findAllMatches,d=l.minMatchCharLength;return i(e,this.pattern,this.patternAlphabet,{location:u,distance:f,threshold:v,findAllMatches:p,minMatchCharLength:d,includeMatches:n});}}])&&n(t.prototype,r),e;}();e.exports=s;},function(e,t){var r=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/ +/g,o=new RegExp(t.replace(r,"\\$&").replace(n,"|")),i=e.match(o),a=!!i,s=[];if(a)for(var c=0,h=i.length;c<h;c+=1){var l=i[c];s.push([e.indexOf(l),l.length-1]);}return{score:a?.5:1,isMatch:a,matchedIndices:s};};},function(e,t,r){var n=r(4),o=r(5);e.exports=function(e,t,r,i){for(var a=i.location,s=void 0===a?0:a,c=i.distance,h=void 0===c?100:c,l=i.threshold,u=void 0===l?.6:l,f=i.findAllMatches,v=void 0!==f&&f,p=i.minMatchCharLength,d=void 0===p?1:p,g=i.includeMatches,y=void 0!==g&&g,m=s,k=e.length,b=u,S=e.indexOf(t,m),x=t.length,M=[],_=0;_<k;_+=1){M[_]=0;}if(-1!==S){var w=n(t,{errors:0,currentLocation:S,expectedLocation:m,distance:h});if(b=Math.min(w,b),-1!==(S=e.lastIndexOf(t,m+x))){var L=n(t,{errors:0,currentLocation:S,expectedLocation:m,distance:h});b=Math.min(L,b);}}S=-1;for(var A=[],O=1,C=x+k,j=1<<(x<=31?x-1:30),P=0;P<x;P+=1){for(var I=0,F=C;I<F;){n(t,{errors:P,currentLocation:m+F,expectedLocation:m,distance:h})<=b?I=F:C=F,F=Math.floor((C-I)/2+I);}C=F;var T=Math.max(1,m-F+1),N=v?k:Math.min(m+F,k)+x,z=Array(N+2);z[N+1]=(1<<P)-1;for(var E=N;E>=T;E-=1){var W=E-1,K=r[e.charAt(W)];if(K&&(M[W]=1),z[E]=(z[E+1]<<1|1)&K,0!==P&&(z[E]|=(A[E+1]|A[E])<<1|1|A[E+1]),z[E]&j&&(O=n(t,{errors:P,currentLocation:W,expectedLocation:m,distance:h}))<=b){if(b=O,(S=W)<=m)break;T=Math.max(1,2*m-S);}}if(n(t,{errors:P+1,currentLocation:m,expectedLocation:m,distance:h})>b)break;A=z;}var $={isMatch:S>=0,score:0===O?.001:O};return y&&($.matchedIndices=o(M,d)),$;};},function(e,t){e.exports=function(e,t){var r=t.errors,n=void 0===r?0:r,o=t.currentLocation,i=void 0===o?0:o,a=t.expectedLocation,s=void 0===a?0:a,c=t.distance,h=void 0===c?100:c,l=n/e.length,u=Math.abs(s-i);return h?l+u/h:u?1:l;};},function(e,t){e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=[],n=-1,o=-1,i=0,a=e.length;i<a;i+=1){var s=e[i];s&&-1===n?n=i:s||-1===n||((o=i-1)-n+1>=t&&r.push([n,o]),n=-1);}return e[i-1]&&i-n>=t&&r.push([n,i-1]),r;};},function(e,t){e.exports=function(e){for(var t={},r=e.length,n=0;n<r;n+=1){t[e.charAt(n)]=0;}for(var o=0;o<r;o+=1){t[e.charAt(o)]|=1<<r-o-1;}return t;};},function(e,t){var r=function r(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e);},n=function n(e){return null==e?"":function(e){if("string"==typeof e)return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t;}(e);},o=function o(e){return"string"==typeof e;},i=function i(e){return"number"==typeof e;};e.exports={get:function get(e,t){var a=[];return function e(t,s){if(s){var c=s.indexOf("."),h=s,l=null;-1!==c&&(h=s.slice(0,c),l=s.slice(c+1));var u=t[h];if(null!=u)if(l||!o(u)&&!i(u)){if(r(u))for(var f=0,v=u.length;f<v;f+=1){e(u[f],l);}else l&&e(u,l);}else a.push(n(u));}else a.push(t);}(e,t),a;},isArray:r,isString:o,isNum:i,toString:n};}]);});})(fuse);var Fuse=/*@__PURE__*/getDefaultExportFromCjs(fuse.exports);function isCloseType(x){return!!(x&&x.closeMenu);}function isClearType(x){return!!(x&&x.clearLastViewed);}function isExpandType(x){return!!(x&&x.showAll);}function isSearchResult(x){return!!(x&&x.item);}var document$3=window_1.document;var DEFAULT_MAX_SEARCH_RESULTS=50;var options={shouldSort:true,tokenize:true,findAllMatches:true,includeScore:true,includeMatches:true,threshold:0.2,location:0,distance:100,maxPatternLength:32,minMatchCharLength:1,keys:[{name:'name',weight:0.7},{name:'path',weight:0.3}]};var ScreenReaderLabel=styled.label({position:'absolute',left:-10000,top:'auto',width:1,height:1,overflow:'hidden'});var SearchIcon=styled(Icons)(function(_ref109){var theme=_ref109.theme;return{width:12,height:12,position:'absolute',top:8,left:10,zIndex:1,pointerEvents:'none',color:theme.textMutedColor};});var SearchField=styled.div(function(_ref110){var theme=_ref110.theme;return{display:'flex',flexDirection:'column',position:'relative','&:focus-within svg':{color:theme.color.defaultText}};});var Input$1=styled.input(function(_ref111){var theme=_ref111.theme;return{appearance:'none',height:28,paddingLeft:28,paddingRight:28,border:"1px solid ".concat(curriedTransparentize$1(0.6,theme.color.mediumdark)),background:'transparent',borderRadius:28,fontSize:"".concat(theme.typography.size.s1,"px"),fontFamily:'inherit',transition:'all 150ms',color:theme.color.defaultText,'&:focus, &:active':{outline:0,borderColor:theme.color.secondary,background:theme.background.app},'&::placeholder':{color:theme.textMutedColor},'&:valid ~ code, &:focus ~ code':{display:'none'},'&:invalid ~ svg':{display:'none'},'&:valid ~ svg':{display:'block'},'&::-ms-clear':{display:'none'},'&::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration':{display:'none'}};});var FocusKey=styled.code(function(_ref112){var theme=_ref112.theme;return{position:'absolute',top:6,right:12,width:16,height:16,zIndex:1,lineHeight:'17px',textAlign:'center',fontSize:'11px',background:'rgba(0,0,0,0.1)',color:theme.textMutedColor,borderRadius:2,userSelect:'none',pointerEvents:'none'};});var ClearIcon=styled(Icons)(function(_ref113){var theme=_ref113.theme;return{width:16,height:16,padding:4,position:'absolute',top:6,right:8,zIndex:1,background:'rgba(0,0,0,0.1)',borderRadius:16,color:theme.color.defaultText,cursor:'pointer'};});var FocusContainer=styled.div({outline:0});var Search=React$2.memo(function(_ref114){var children=_ref114.children,dataset=_ref114.dataset,_ref114$isLoading=_ref114.isLoading,isLoading=_ref114$isLoading===void 0?false:_ref114$isLoading,_ref114$enableShortcu=_ref114.enableShortcuts,enableShortcuts=_ref114$enableShortcu===void 0?true:_ref114$enableShortcu,getLastViewed=_ref114.getLastViewed,clearLastViewed=_ref114.clearLastViewed,_ref114$initialQuery=_ref114.initialQuery,initialQuery=_ref114$initialQuery===void 0?'':_ref114$initialQuery;var api=useStorybookApi();var inputRef=useRef(null);var _useState7=useState('Find components'),_useState8=_slicedToArray2(_useState7,2),inputPlaceholder=_useState8[0],setPlaceholder=_useState8[1];var _useState9=useState(false),_useState10=_slicedToArray2(_useState9,2),allComponents=_useState10[0],showAllComponents=_useState10[1];var selectStory=useCallback(function(id,refId){if(api)api.selectStory(id,undefined,{ref:refId!==DEFAULT_REF_ID&&refId});inputRef.current.blur();showAllComponents(false);},[api,inputRef,showAllComponents,DEFAULT_REF_ID]);var list=useMemo(function(){return dataset.entries.reduce(function(acc,_ref115){var _ref116=_slicedToArray2(_ref115,2),refId=_ref116[0],stories=_ref116[1].stories;if(stories){acc.push.apply(acc,_toConsumableArray(Object.values(stories).map(function(item){return searchItem(item,dataset.hash[refId]);})));}return acc;},[]);},[dataset]);var fuse=useMemo(function(){return new Fuse(list,options);},[list]);var getResults=useCallback(function(input){if(!input)return[];var results=[];var resultIds=new Set();var distinctResults=fuse.search(input).filter(function(_ref117){var item=_ref117.item;if(!(item.isComponent||item.isLeaf)||resultIds.has(item.parent))return false;resultIds.add(item.id);return true;});if(distinctResults.length){results=distinctResults.slice(0,allComponents?1000:DEFAULT_MAX_SEARCH_RESULTS);if(distinctResults.length>DEFAULT_MAX_SEARCH_RESULTS&&!allComponents){results.push({showAll:function showAll(){return showAllComponents(true);},totalCount:distinctResults.length,moreCount:distinctResults.length-DEFAULT_MAX_SEARCH_RESULTS});}}return results;},[allComponents,fuse]);var stateReducer=useCallback(function(state,changes){switch(changes.type){case Downshift$1.stateChangeTypes.blurInput:{return Object.assign(Object.assign({},changes),{// Prevent clearing the input on blur
1680inputValue:state.inputValue,// Return to the tree view after selecting an item
1681isOpen:state.inputValue&&!state.selectedItem,selectedItem:null});}case Downshift$1.stateChangeTypes.mouseUp:{// Prevent clearing the input on refocus
1682return{};}case Downshift$1.stateChangeTypes.keyDownEscape:{if(state.inputValue){// Clear the inputValue, but don't return to the tree view
1683return Object.assign(Object.assign({},changes),{inputValue:'',isOpen:true,selectedItem:null});}// When pressing escape a second time, blur the input and return to the tree view
1684inputRef.current.blur();return Object.assign(Object.assign({},changes),{isOpen:false,selectedItem:null});}case Downshift$1.stateChangeTypes.clickItem:case Downshift$1.stateChangeTypes.keyDownEnter:{if(isSearchResult(changes.selectedItem)){var _changes$selectedItem=changes.selectedItem.item,id=_changes$selectedItem.id,refId=_changes$selectedItem.refId;selectStory(id,refId);// Return to the tree view, but keep the input value
1685return Object.assign(Object.assign({},changes),{inputValue:state.inputValue,isOpen:false});}if(isExpandType(changes.selectedItem)){changes.selectedItem.showAll();// Downshift should completely ignore this
1686return{};}if(isClearType(changes.selectedItem)){changes.selectedItem.clearLastViewed();inputRef.current.blur();// Nothing to see anymore, so return to the tree view
1687return{isOpen:false};}if(isCloseType(changes.selectedItem)){inputRef.current.blur();// Return to the tree view
1688return{isOpen:false};}return changes;}case Downshift$1.stateChangeTypes.changeInput:{// Reset the "show more" state whenever the input changes
1689showAllComponents(false);return changes;}default:return changes;}},[inputRef,selectStory,showAllComponents]);return React$2.createElement(Downshift$1,{initialInputValue:initialQuery,stateReducer:stateReducer,// @ts-ignore
1690itemToString:function itemToString(result){var _a;return((_a=result===null||result===void 0?void 0:result.item)===null||_a===void 0?void 0:_a.name)||'';}},function(_ref118){var isOpen=_ref118.isOpen,openMenu=_ref118.openMenu,closeMenu=_ref118.closeMenu,inputValue=_ref118.inputValue,clearSelection=_ref118.clearSelection,getInputProps=_ref118.getInputProps,getItemProps=_ref118.getItemProps,getLabelProps=_ref118.getLabelProps,getMenuProps=_ref118.getMenuProps,getRootProps=_ref118.getRootProps,highlightedIndex=_ref118.highlightedIndex;var input=inputValue?inputValue.trim():'';var results=input?getResults(input):[];var lastViewed=!input&&getLastViewed();if(lastViewed&&lastViewed.length){results=lastViewed.reduce(function(acc,_ref119){var storyId=_ref119.storyId,refId=_ref119.refId;var data=dataset.hash[refId];if(data&&data.stories&&data.stories[storyId]){var story=data.stories[storyId];var item=story.isLeaf&&!story.isComponent&&!story.isRoot?data.stories[story.parent]:story;// prevent duplicates
1691if(!acc.some(function(res){return res.item.refId===refId&&res.item.id===item.id;})){acc.push({item:searchItem(item,dataset.hash[refId]),matches:[],score:0});}}return acc;},[]);results.push({closeMenu:closeMenu});if(results.length>0){results.push({clearLastViewed:clearLastViewed});}}var inputProps=getInputProps({id:'storybook-explorer-searchfield',ref:inputRef,required:true,type:'search',placeholder:inputPlaceholder,onFocus:function onFocus(){openMenu();setPlaceholder('Type to find...');},onBlur:function onBlur(){return setPlaceholder('Find components');}});return React$2.createElement(React$2.Fragment,null,React$2.createElement(ScreenReaderLabel,Object.assign({},getLabelProps()),"Search for components"),React$2.createElement(SearchField,Object.assign({},getRootProps({refKey:''},{suppressRefError:true}),{className:"search-field"}),React$2.createElement(SearchIcon,{icon:"search"}),React$2.createElement(Input$1,Object.assign({},inputProps)),enableShortcuts&&React$2.createElement(FocusKey,null,"/"),React$2.createElement(ClearIcon,{icon:"cross",onClick:function onClick(){return clearSelection();}})),React$2.createElement(FocusContainer,{tabIndex:0,id:"storybook-explorer-menu"},children({query:input,results:results,isBrowsing:!isOpen&&document$3.activeElement!==inputRef.current,closeMenu:closeMenu,getMenuProps:getMenuProps,getItemProps:getItemProps,highlightedIndex:highlightedIndex})));});});var document$2=window_1.document,DOCS_MODE$2=window_1.DOCS_MODE;var ResultsList=styled.ol({listStyle:'none',margin:0,marginLeft:-20,marginRight:-20,padding:0});var ResultRow=styled.li(function(_ref120){var theme=_ref120.theme,isHighlighted=_ref120.isHighlighted;return{display:'block',margin:0,padding:0,background:isHighlighted?theme.background.hoverable:'transparent',cursor:'pointer','a:hover, button:hover':{background:'transparent'}};});var NoResults=styled.div(function(_ref121){var theme=_ref121.theme;return{marginTop:20,textAlign:'center',fontSize:"".concat(theme.typography.size.s2-1,"px"),lineHeight:"18px",color:theme.color.defaultText,small:{color:theme.barTextColor,fontSize:"".concat(theme.typography.size.s1,"px")}};});var Mark=styled.mark(function(_ref122){var theme=_ref122.theme;return{background:'transparent',color:theme.color.secondary};});var ActionRow=styled(ResultRow)({display:'flex',padding:'6px 19px',alignItems:'center'});var BackActionRow=styled(ActionRow)({marginTop:8});var ActionLabel=styled.span(function(_ref123){var theme=_ref123.theme;return{flexGrow:1,color:theme.color.mediumdark,fontSize:"".concat(theme.typography.size.s1,"px")};});var ActionIcon=styled(Icons)(function(_ref124){var theme=_ref124.theme;return{display:'inline-block',width:10,height:10,marginRight:6,color:theme.color.mediumdark};});var ActionKey=styled.code(function(_ref125){var theme=_ref125.theme;return{minWidth:16,height:16,lineHeight:'17px',textAlign:'center',fontSize:'11px',background:'rgba(0,0,0,0.1)',color:theme.textMutedColor,borderRadius:2,userSelect:'none',pointerEvents:'none'};});var Highlight=React$2.memo(function(_ref126){var children=_ref126.children,match=_ref126.match;if(!match)return React$2.createElement(React$2.Fragment,null,children);var value=match.value,indices=match.indices;var _indices$reduce=indices.reduce(function(_ref127,_ref128,index,_ref129){var cursor=_ref127.cursor,nodes=_ref127.nodes;var _ref130=_slicedToArray2(_ref128,2),start=_ref130[0],end=_ref130[1];var length=_ref129.length;/* eslint-disable react/no-array-index-key */nodes.push(React$2.createElement("span",{key:"".concat(index,"-0")},value.slice(cursor,start)));nodes.push(React$2.createElement(Mark,{key:"".concat(index,"-1")},value.slice(start,end+1)));if(index===length-1){nodes.push(React$2.createElement("span",{key:"".concat(index,"-2")},value.slice(end+1)));}/* eslint-enable react/no-array-index-key */ /* eslint-enable react/no-array-index-key */return{cursor:end+1,nodes:nodes};},{cursor:0,nodes:[]}),result=_indices$reduce.nodes;return React$2.createElement(React$2.Fragment,null,result);});var Result=React$2.memo(function(_a){var item=_a.item,matches=_a.matches,icon=_a.icon,onClick=_a.onClick,props=__rest(_a,["item","matches","icon","onClick"]);var click=useCallback(function(event){event.preventDefault();onClick(event);},[onClick]);var nameMatch=matches.find(function(match){return match.key==='name';});var pathMatches=matches.filter(function(match){return match.key==='path';});var label=React$2.createElement("div",{className:"search-result-item--label"},React$2.createElement("strong",null,React$2.createElement(Highlight,{match:nameMatch},item.name)),React$2.createElement(Path,null,item.path.map(function(group,index){return(// eslint-disable-next-line react/no-array-index-key
1692React$2.createElement("span",{key:index},React$2.createElement(Highlight,{match:pathMatches.find(function(match){return match.arrayIndex===index;})},group)));})));var title="".concat(item.path.join(' / ')," / ").concat(item.name);if(DOCS_MODE$2){return React$2.createElement(ResultRow,Object.assign({},props),React$2.createElement(DocumentNode,{depth:0,onClick:click,href:getLink(item.id,item.refId),title:title},label));}var TreeNode=item.isComponent?ComponentNode:StoryNode;return React$2.createElement(ResultRow,Object.assign({},props),React$2.createElement(TreeNode,{isExpanded:false,depth:0,onClick:onClick,title:title},label));});var SearchResults=React$2.memo(function(_ref131){var query=_ref131.query,results=_ref131.results,closeMenu=_ref131.closeMenu,getMenuProps=_ref131.getMenuProps,getItemProps=_ref131.getItemProps,highlightedIndex=_ref131.highlightedIndex,_ref131$isLoading=_ref131.isLoading,isLoading=_ref131$isLoading===void 0?false:_ref131$isLoading,_ref131$enableShortcu=_ref131.enableShortcuts,enableShortcuts=_ref131$enableShortcu===void 0?true:_ref131$enableShortcu;useEffect(function(){var handleEscape=function handleEscape(event){if(!enableShortcuts||isLoading||event.repeat)return;if(matchesModifiers(false,event)&&matchesKeyCode('Escape',event)){var target=event.target;if((target===null||target===void 0?void 0:target.id)==='storybook-explorer-searchfield')return;// handled by downshift
1693event.preventDefault();closeMenu();}};document$2.addEventListener('keydown',handleEscape);return function(){return document$2.removeEventListener('keydown',handleEscape);};},[enableShortcuts,isLoading]);return React$2.createElement(ResultsList,Object.assign({},getMenuProps()),results.length>0&&!query&&React$2.createElement("li",null,React$2.createElement(RootNode,{className:"search-result-recentlyOpened"},"Recently opened")),results.length===0&&query&&React$2.createElement("li",null,React$2.createElement(NoResults,null,React$2.createElement("strong",null,"No components found"),React$2.createElement("br",null),React$2.createElement("small",null,"Find components by name or path."))),results.map(function(result,index){if(isCloseType(result)){return React$2.createElement(BackActionRow,Object.assign({},result,getItemProps({key:index,index:index,item:result}),{isHighlighted:highlightedIndex===index,className:"search-result-back"}),React$2.createElement(ActionIcon,{icon:"arrowleft"}),React$2.createElement(ActionLabel,null,"Back to components"),React$2.createElement(ActionKey,null,"ESC"));}if(isClearType(result)){return React$2.createElement(ActionRow,Object.assign({},result,getItemProps({key:index,index:index,item:result}),{isHighlighted:highlightedIndex===index,className:"search-result-clearHistory"}),React$2.createElement(ActionIcon,{icon:"trash"}),React$2.createElement(ActionLabel,null,"Clear history"));}if(isExpandType(result)){return React$2.createElement(ActionRow,Object.assign({},result,getItemProps({key:index,index:index,item:result}),{isHighlighted:highlightedIndex===index,className:"search-result-more"}),React$2.createElement(ActionIcon,{icon:"plus"}),React$2.createElement(ActionLabel,null,"Show ",result.moreCount," more results"));}var item=result.item;var key="".concat(item.refId,"::").concat(item.id);return React$2.createElement(Result,Object.assign({},result,getItemProps({key:key,index:index,item:result}),{isHighlighted:highlightedIndex===index,className:"search-result-item"}));}));});var save=debounce_1(function(value){return store.set('lastViewedStoryIds',value);},1000);var useLastViewed=function useLastViewed(selection){var initialLastViewedStoryIds=useMemo(function(){var items=store.get('lastViewedStoryIds');if(!items||!Array.isArray(items))return[];if(!items.some(function(item){return _typeof2(item)==='object'&&item.storyId&&item.refId;}))return[];return items;},[store]);var lastViewedRef=useRef(initialLastViewedStoryIds);var updateLastViewed=useCallback(function(story){var items=lastViewedRef.current;var index=items.findIndex(function(_ref132){var storyId=_ref132.storyId,refId=_ref132.refId;return storyId===story.storyId&&refId===story.refId;});if(index===0)return;if(index===-1){lastViewedRef.current=[story].concat(_toConsumableArray(items));}else{lastViewedRef.current=[story].concat(_toConsumableArray(items.slice(0,index)),_toConsumableArray(items.slice(index+1)));}save(lastViewedRef.current);},[lastViewedRef]);useEffect(function(){if(selection)updateLastViewed(selection);},[selection]);return{getLastViewed:useCallback(function(){return lastViewedRef.current;},[lastViewedRef]),clearLastViewed:useCallback(function(){lastViewedRef.current=lastViewedRef.current.slice(0,1);save(lastViewedRef.current);},[lastViewedRef])};};var DOCS_MODE$1=window_1.DOCS_MODE;var Container$3=styled.nav({position:'absolute',zIndex:1,left:0,top:0,bottom:0,right:0,width:'100%',height:'100%'});var StyledSpaced=styled(Spaced)({paddingBottom:'2.5rem'});var CustomScrollArea=styled(ScrollArea)({'&&&&& .os-scrollbar-handle:before':{left:-12},'&&&&& .os-scrollbar-vertical':{right:5},padding:20});var Swap=React$2.memo(function(_ref133){var children=_ref133.children,condition=_ref133.condition;var _React$2$Children$toA=React$2.Children.toArray(children),_React$2$Children$toA2=_slicedToArray2(_React$2$Children$toA,2),a=_React$2$Children$toA2[0],b=_React$2$Children$toA2[1];return React$2.createElement(React$2.Fragment,null,React$2.createElement("div",{style:{display:condition?'block':'none'}},a),React$2.createElement("div",{style:{display:condition?'none':'block'}},b));});var useCombination=function useCombination(stories,ready,error,refs){var hash=useMemo(function(){return Object.assign(_defineProperty2({},DEFAULT_REF_ID,{stories:stories,title:null,id:DEFAULT_REF_ID,url:'iframe.html',ready:ready,error:error}),refs);},[refs,stories]);return useMemo(function(){return{hash:hash,entries:Object.entries(hash)};},[hash]);};var Sidebar$1=React$2.memo(function(_ref134){var _ref134$storyId=_ref134.storyId,storyId=_ref134$storyId===void 0?null:_ref134$storyId,_ref134$refId=_ref134.refId,refId=_ref134$refId===void 0?DEFAULT_REF_ID:_ref134$refId,storiesHash=_ref134.stories,storiesConfigured=_ref134.storiesConfigured,storiesFailed=_ref134.storiesFailed,menu=_ref134.menu,_ref134$menuHighlight=_ref134.menuHighlighted,menuHighlighted=_ref134$menuHighlight===void 0?false:_ref134$menuHighlight,_ref134$enableShortcu=_ref134.enableShortcuts,enableShortcuts=_ref134$enableShortcu===void 0?true:_ref134$enableShortcu,_ref134$refs=_ref134.refs,refs=_ref134$refs===void 0?{}:_ref134$refs;var collapseFn=DOCS_MODE$1?collapseAllStories:collapseDocsOnlyStories;var selected=useMemo(function(){return storyId&&{storyId:storyId,refId:refId};},[storyId,refId]);var stories=useMemo(function(){return collapseFn(storiesHash);},[DOCS_MODE$1,storiesHash]);var adaptedRefs=useMemo(function(){return Object.entries(refs).reduce(function(acc,_ref135){var _ref136=_slicedToArray2(_ref135,2),id=_ref136[0],ref=_ref136[1];if(ref.stories){acc[id]=Object.assign(Object.assign({},ref),{stories:collapseFn(ref.stories)});}else{acc[id]=ref;}return acc;},{});},[DOCS_MODE$1,refs]);var dataset=useCombination(stories,storiesConfigured,storiesFailed,adaptedRefs);var isLoading=!dataset.hash[DEFAULT_REF_ID].ready;var lastViewedProps=useLastViewed(selected);return React$2.createElement(Container$3,{className:"container sidebar-container"},React$2.createElement(CustomScrollArea,{vertical:true},React$2.createElement(StyledSpaced,{row:1.6},React$2.createElement(Heading,{className:"sidebar-header",menuHighlighted:menuHighlighted,menu:menu,skipLinkHref:"#storybook-preview-wrapper"}),React$2.createElement(Search,Object.assign({dataset:dataset,isLoading:isLoading,enableShortcuts:enableShortcuts},lastViewedProps),function(_ref137){var query=_ref137.query,results=_ref137.results,isBrowsing=_ref137.isBrowsing,closeMenu=_ref137.closeMenu,getMenuProps=_ref137.getMenuProps,getItemProps=_ref137.getItemProps,highlightedIndex=_ref137.highlightedIndex;return React$2.createElement(Swap,{condition:isBrowsing},React$2.createElement(Explorer,{dataset:dataset,selected:selected,isLoading:isLoading,isBrowsing:isBrowsing}),React$2.createElement(SearchResults,{query:query,results:results,closeMenu:closeMenu,getMenuProps:getMenuProps,getItemProps:getItemProps,highlightedIndex:highlightedIndex,enableShortcuts:enableShortcuts,isLoading:isLoading}));}))));});var focusableUIElements={storySearchField:'storybook-explorer-searchfield',storyListMenu:'storybook-explorer-menu',storyPanelRoot:'storybook-panel-root'};var Key=styled.code(function(_ref138){var theme=_ref138.theme;return{width:16,height:16,lineHeight:'17px',textAlign:'center',fontSize:'11px',background:'rgba(0,0,0,0.07)',color:theme.color.defaultText,borderRadius:2,userSelect:'none',pointerEvents:'none','& + &':{marginLeft:2}};});var Shortcut=function Shortcut(_ref139){var keys=_ref139.keys;return React$2.createElement(React$2.Fragment,null,keys.map(function(key,index){return(// eslint-disable-next-line react/no-array-index-key
1694React$2.createElement(Key,{key:index},shortcutToHumanString([key])));}));};var useMenu=function useMenu(api,showToolbar,isFullscreen,showPanel,showNav,enableShortcuts){var theme=useTheme();var shortcutKeys=api.getShortcutKeys();var about=useMemo(function(){return{id:'about',title:'About your Storybook',onClick:function onClick(){return api.navigateToSettingsPage('/settings/about');},right:api.versionUpdateAvailable()&&React$2.createElement(Badge,{status:"positive"},"Update"),left:React$2.createElement(MenuItemIcon,null)};},[api,enableShortcuts,shortcutKeys]);var releaseNotes=useMemo(function(){return{id:'release-notes',title:'Release notes',onClick:function onClick(){return api.navigateToSettingsPage('/settings/release-notes');},left:React$2.createElement(MenuItemIcon,null)};},[api,enableShortcuts,shortcutKeys]);var shortcuts=useMemo(function(){return{id:'shortcuts',title:'Keyboard shortcuts',onClick:function onClick(){return api.navigateToSettingsPage('/settings/shortcuts');},right:enableShortcuts?React$2.createElement(Shortcut,{keys:shortcutKeys.shortcutsPage}):null,left:React$2.createElement(MenuItemIcon,null),style:{borderBottom:"4px solid ".concat(theme.appBorderColor)}};},[api,enableShortcuts,shortcutKeys]);var sidebarToggle=useMemo(function(){return{id:'S',title:'Show sidebar',onClick:function onClick(){return api.toggleNav();},right:enableShortcuts?React$2.createElement(Shortcut,{keys:shortcutKeys.toggleNav}):null,left:showNav?React$2.createElement(MenuItemIcon,{icon:"check"}):React$2.createElement(MenuItemIcon,null)};},[api,enableShortcuts,shortcutKeys,showNav]);var toolbarToogle=useMemo(function(){return{id:'T',title:'Show toolbar',onClick:function onClick(){return api.toggleToolbar();},right:enableShortcuts?React$2.createElement(Shortcut,{keys:shortcutKeys.toolbar}):null,left:showToolbar?React$2.createElement(MenuItemIcon,{icon:"check"}):React$2.createElement(MenuItemIcon,null)};},[api,enableShortcuts,shortcutKeys,showToolbar]);var addonsToggle=useMemo(function(){return{id:'A',title:'Show addons',onClick:function onClick(){return api.togglePanel();},right:enableShortcuts?React$2.createElement(Shortcut,{keys:shortcutKeys.togglePanel}):null,left:showPanel?React$2.createElement(MenuItemIcon,{icon:"check"}):React$2.createElement(MenuItemIcon,null)};},[api,enableShortcuts,shortcutKeys,showPanel]);var addonsOrientationToggle=useMemo(function(){return{id:'D',title:'Change addons orientation',onClick:function onClick(){return api.togglePanelPosition();},right:enableShortcuts?React$2.createElement(Shortcut,{keys:shortcutKeys.panelPosition}):null,left:React$2.createElement(MenuItemIcon,null)};},[api,enableShortcuts,shortcutKeys]);var fullscreenToggle=useMemo(function(){return{id:'F',title:'Go full screen',onClick:function onClick(){return api.toggleFullscreen();},right:enableShortcuts?React$2.createElement(Shortcut,{keys:shortcutKeys.fullScreen}):null,left:isFullscreen?'check':React$2.createElement(MenuItemIcon,null)};},[api,enableShortcuts,shortcutKeys,isFullscreen]);var searchToggle=useMemo(function(){return{id:'/',title:'Search',onClick:function onClick(){return api.focusOnUIElement(focusableUIElements.storySearchField);},right:enableShortcuts?React$2.createElement(Shortcut,{keys:shortcutKeys.search}):null,left:React$2.createElement(MenuItemIcon,null)};},[api,enableShortcuts,shortcutKeys]);var up=useMemo(function(){return{id:'up',title:'Previous component',onClick:function onClick(){return api.jumpToComponent(-1);},right:enableShortcuts?React$2.createElement(Shortcut,{keys:shortcutKeys.prevComponent}):null,left:React$2.createElement(MenuItemIcon,null)};},[api,enableShortcuts,shortcutKeys]);var down=useMemo(function(){return{id:'down',title:'Next component',onClick:function onClick(){return api.jumpToComponent(1);},right:enableShortcuts?React$2.createElement(Shortcut,{keys:shortcutKeys.nextComponent}):null,left:React$2.createElement(MenuItemIcon,null)};},[api,enableShortcuts,shortcutKeys]);var prev=useMemo(function(){return{id:'prev',title:'Previous story',onClick:function onClick(){return api.jumpToStory(-1);},right:enableShortcuts?React$2.createElement(Shortcut,{keys:shortcutKeys.prevStory}):null,left:React$2.createElement(MenuItemIcon,null)};},[api,enableShortcuts,shortcutKeys]);var next=useMemo(function(){return{id:'next',title:'Next story',onClick:function onClick(){return api.jumpToStory(1);},right:enableShortcuts?React$2.createElement(Shortcut,{keys:shortcutKeys.nextStory}):null,left:React$2.createElement(MenuItemIcon,null)};},[api,enableShortcuts,shortcutKeys]);var collapse=useMemo(function(){return{id:'collapse',title:'Collapse all',onClick:function onClick(){return api.collapseAll();},right:enableShortcuts?React$2.createElement(Shortcut,{keys:shortcutKeys.collapseAll}):null,left:React$2.createElement(MenuItemIcon,null)};},[api,enableShortcuts,shortcutKeys]);var getAddonsShortcuts=function getAddonsShortcuts(){var addonsShortcuts=api.getAddonsShortcuts();var keys=shortcutKeys;return Object.entries(addonsShortcuts).filter(function(_ref140){var _ref141=_slicedToArray2(_ref140,2),actionName=_ref141[0],showInMenu=_ref141[1].showInMenu;return showInMenu;}).map(function(_ref142){var _ref143=_slicedToArray2(_ref142,2),actionName=_ref143[0],_ref143$=_ref143[1],label=_ref143$.label,action=_ref143$.action;return{id:actionName,title:label,onClick:function onClick(){return action();},right:enableShortcuts?React$2.createElement(Shortcut,{keys:keys[actionName]}):null,left:React$2.createElement(MenuItemIcon,null)};});};return useMemo(function(){return[about].concat(_toConsumableArray(api.releaseNotesVersion()?[releaseNotes]:[]),[shortcuts,sidebarToggle,toolbarToogle,addonsToggle,addonsOrientationToggle,fullscreenToggle,searchToggle,up,down,prev,next,collapse],_toConsumableArray(getAddonsShortcuts()));},[about].concat(_toConsumableArray(api.releaseNotesVersion()?[releaseNotes]:[]),[shortcuts,sidebarToggle,toolbarToogle,addonsToggle,addonsOrientationToggle,fullscreenToggle,searchToggle,up,down,prev,next,collapse]));};var Sidebar=React$2.memo(function(){var mapper=function mapper(_ref144){var state=_ref144.state,api=_ref144.api;var _state$ui=state.ui,name=_state$ui.name,url=_state$ui.url,enableShortcuts=_state$ui.enableShortcuts,viewMode=state.viewMode,storyId=state.storyId,refId=state.refId,_state$layout=state.layout,showToolbar=_state$layout.showToolbar,isFullscreen=_state$layout.isFullscreen,showPanel=_state$layout.showPanel,showNav=_state$layout.showNav,storiesHash=state.storiesHash,storiesConfigured=state.storiesConfigured,storiesFailed=state.storiesFailed,refs=state.refs;var menu=useMenu(api,showToolbar,isFullscreen,showPanel,showNav,enableShortcuts);return{title:name,url:url,stories:storiesHash,storiesFailed:storiesFailed,storiesConfigured:storiesConfigured,refs:refs,storyId:storyId,refId:refId,viewMode:viewMode,menu:menu,menuHighlighted:api.versionUpdateAvailable(),enableShortcuts:enableShortcuts};};return React$2.createElement(Consumer,{filter:mapper},function(fromState){return React$2.createElement(Sidebar$1,Object.assign({},fromState));});});var FrameWrap=styled.div(function(_ref145){var offset=_ref145.offset;return{position:'absolute',overflow:'auto',left:0,right:0,bottom:0,top:offset,zIndex:3,transition:'all 0.1s linear',height:"calc(100% - ".concat(offset,"px)"),background:'transparent'};});var UnstyledLink=styled(Link$1)({color:'inherit',textDecoration:'inherit',display:'inline-block'});styled.span({// Hides full screen icon at mobile breakpoint defined in app.js
1695'@media (max-width: 599px)':{display:'none'}});var IframeWrapper=styled.div(function(_ref146){var theme=_ref146.theme;return{position:'absolute',top:0,left:0,bottom:0,right:0,width:'100%',height:'100%',background:theme.background.content};});var LoaderWrapper$1=styled.div(function(_ref147){var theme=_ref147.theme;return{position:'absolute',top:0,left:0,bottom:0,right:0,background:theme.background.content,zIndex:1};});var initialZoom=1;var Context=React$2.createContext({value:initialZoom,set:function set(v){}});var ZoomProvider=/*#__PURE__*/function(_Component4){_inherits2(ZoomProvider,_Component4);var _super5=_createSuper2(ZoomProvider);function ZoomProvider(){var _this11;_classCallCheck2(this,ZoomProvider);_this11=_super5.apply(this,arguments);_this11.state={value:initialZoom};_this11.set=function(value){return _this11.setState({value:value});};return _this11;}_createClass2(ZoomProvider,[{key:"render",value:function render(){var _this$props6=this.props,children=_this$props6.children,shouldScale=_this$props6.shouldScale;var set=this.set;var value=this.state.value;return React$2.createElement(Context.Provider,{value:{value:shouldScale?value:initialZoom,set:set}},children);}}]);return ZoomProvider;}(Component);var ZoomConsumer=Context.Consumer;var Zoom=React$2.memo(function(_ref148){var zoomIn=_ref148.zoomIn,zoomOut=_ref148.zoomOut,reset=_ref148.reset;return React$2.createElement(React$2.Fragment,null,React$2.createElement(IconButton,{key:"zoomin",onClick:zoomIn,title:"Zoom in"},React$2.createElement(Icons,{icon:"zoom"})),React$2.createElement(IconButton,{key:"zoomout",onClick:zoomOut,title:"Zoom out"},React$2.createElement(Icons,{icon:"zoomout"})),React$2.createElement(IconButton,{key:"zoomreset",onClick:reset,title:"Reset zoom"},React$2.createElement(Icons,{icon:"zoomreset"})));});var ZoomWrapper=React$2.memo(function(_ref149){var set=_ref149.set,value=_ref149.value;var zoomIn=useCallback(function(e){e.preventDefault();set(0.8*value);},[set,value]);var zoomOut=useCallback(function(e){e.preventDefault();set(1.25*value);},[set,value]);var reset=useCallback(function(e){e.preventDefault();set(initialZoom);},[set,initialZoom]);return React$2.createElement(Zoom,Object.assign({key:"zoom"},{zoomIn:zoomIn,zoomOut:zoomOut,reset:reset}));});var zoomTool={title:'zoom',id:'zoom',match:function match(_ref150){var viewMode=_ref150.viewMode;return viewMode==='story';},render:React$2.memo(function(){return React$2.createElement(React$2.Fragment,null,React$2.createElement(ZoomConsumer,null,function(_ref151){var set=_ref151.set,value=_ref151.value;return React$2.createElement(ZoomWrapper,Object.assign({},{set:set,value:value}));}),React$2.createElement(Separator,null));})};var ApplyWrappers=function ApplyWrappers(_ref152){var wrappers=_ref152.wrappers,id=_ref152.id,storyId=_ref152.storyId,active=_ref152.active,children=_ref152.children;return React$2.createElement(Fragment,null,wrappers.reduceRight(function(acc,wrapper,index){return wrapper.render({index:index,children:acc,id:id,storyId:storyId,active:active});},children));};var defaultWrappers=[{render:function render(p){return React$2.createElement(IframeWrapper,{id:"storybook-preview-wrapper",hidden:!p.active},p.children);}}];var toggleSelection=function toggleSelection(){var selection=document.getSelection();if(!selection.rangeCount){return function(){};}var active=document.activeElement;var ranges=[];for(var i=0;i<selection.rangeCount;i++){ranges.push(selection.getRangeAt(i));}switch(active.tagName.toUpperCase()){// .toUpperCase handles XHTML
1696case'INPUT':case'TEXTAREA':active.blur();break;default:active=null;break;}selection.removeAllRanges();return function(){selection.type==='Caret'&&selection.removeAllRanges();if(!selection.rangeCount){ranges.forEach(function(range){selection.addRange(range);});}active&&active.focus();};};var deselectCurrent=toggleSelection;var clipboardToIE11Formatting={"text/plain":"Text","text/html":"Url","default":"Text"};var defaultMessage="Copy to clipboard: #{key}, Enter";function format(message){var copyKey=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return message.replace(/#{\s*key\s*}/g,copyKey);}function copy(text,options){var debug,message,reselectPrevious,range,selection,mark,success=false;if(!options){options={};}debug=options.debug||false;try{reselectPrevious=deselectCurrent();range=document.createRange();selection=document.getSelection();mark=document.createElement("span");mark.textContent=text;// reset user styles for span element
1697mark.style.all="unset";// prevents scrolling to the end of the page
1698mark.style.position="fixed";mark.style.top=0;mark.style.clip="rect(0, 0, 0, 0)";// used to preserve spaces and line breaks
1699mark.style.whiteSpace="pre";// do not inherit user-select (it may be `none`)
1700mark.style.webkitUserSelect="text";mark.style.MozUserSelect="text";mark.style.msUserSelect="text";mark.style.userSelect="text";mark.addEventListener("copy",function(e){e.stopPropagation();if(options.format){e.preventDefault();if(typeof e.clipboardData==="undefined"){// IE 11
1701debug&&console.warn("unable to use e.clipboardData");debug&&console.warn("trying IE specific stuff");window.clipboardData.clearData();var format=clipboardToIE11Formatting[options.format]||clipboardToIE11Formatting["default"];window.clipboardData.setData(format,text);}else{// all other browsers
1702e.clipboardData.clearData();e.clipboardData.setData(options.format,text);}}if(options.onCopy){e.preventDefault();options.onCopy(e.clipboardData);}});document.body.appendChild(mark);range.selectNodeContents(mark);selection.addRange(range);var successful=document.execCommand("copy");if(!successful){throw new Error("copy command was unsuccessful");}success=true;}catch(err){debug&&console.error("unable to copy using execCommand: ",err);debug&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(options.format||"text",text);options.onCopy&&options.onCopy(window.clipboardData);success=true;}catch(err){debug&&console.error("unable to copy using clipboardData: ",err);debug&&console.error("falling back to prompt");message=format("message"in options?options.message:defaultMessage);window.prompt(message,text);}}finally{if(selection){if(typeof selection.removeRange=="function"){selection.removeRange(range);}else{selection.removeAllRanges();}}if(mark){document.body.removeChild(mark);}reselectPrevious();}return success;}var copyToClipboard=copy;var PREVIEW_URL$2=window_1.PREVIEW_URL;var copyMapper=function copyMapper(_ref153){var state=_ref153.state;var storyId=state.storyId,refId=state.refId,refs=state.refs;var ref=refs[refId];return{refId:refId,baseUrl:ref?"".concat(ref.url,"/iframe.html"):PREVIEW_URL$2||'iframe.html',storyId:storyId,queryParams:state.customQueryParams};};var copyTool={title:'copy',id:'copy',match:function match(_ref154){var viewMode=_ref154.viewMode;return viewMode==='story';},render:function render(){return React$2.createElement(Consumer,{filter:copyMapper},function(_ref155){var baseUrl=_ref155.baseUrl,storyId=_ref155.storyId,queryParams=_ref155.queryParams;return storyId?React$2.createElement(IconButton,{key:"copy",onClick:function onClick(){return copyToClipboard(getStoryHref(baseUrl,storyId,queryParams));},title:"Copy canvas link"},React$2.createElement(Icons,{icon:"link"})):null;});}};var PREVIEW_URL$1=window_1.PREVIEW_URL;var ejectMapper=function ejectMapper(_ref156){var state=_ref156.state;var storyId=state.storyId,refId=state.refId,refs=state.refs;var ref=refs[refId];return{refId:refId,baseUrl:ref?"".concat(ref.url,"/iframe.html"):PREVIEW_URL$1||'iframe.html',storyId:storyId,queryParams:state.customQueryParams};};var ejectTool={title:'eject',id:'eject',match:function match(_ref157){var viewMode=_ref157.viewMode;return viewMode==='story';},render:function render(){return React$2.createElement(Consumer,{filter:ejectMapper},function(_ref158){var baseUrl=_ref158.baseUrl,storyId=_ref158.storyId,queryParams=_ref158.queryParams;return storyId?React$2.createElement(IconButton,{key:"opener",href:getStoryHref(baseUrl,storyId,queryParams),target:"_blank",title:"Open canvas in new tab"},React$2.createElement(Icons,{icon:"sharealt"})):null;});}};var menuMapper$2=function menuMapper$2(_ref159){var api=_ref159.api,state=_ref159.state;return{isVisible:state.layout.showNav,singleStory:state.singleStory,toggle:function toggle(){return api.toggleNav();}};};var menuTool={title:'menu',id:'menu',match:function match(_ref160){var viewMode=_ref160.viewMode;return viewMode==='story';},render:function render(){return React$2.createElement(Consumer,{filter:menuMapper$2},function(_ref161){var isVisible=_ref161.isVisible,toggle=_ref161.toggle,singleStory=_ref161.singleStory;return!singleStory&&!isVisible&&React$2.createElement(React$2.Fragment,null,React$2.createElement(IconButton,{"aria-label":"Show sidebar",key:"menu",onClick:toggle,title:"Show sidebar"},React$2.createElement(Icons,{icon:"menu"})),React$2.createElement(Separator,null));});}};var menuMapper$1=function menuMapper$1(_ref162){var api=_ref162.api,state=_ref162.state;return{isVisible:state.layout.showPanel,singleStory:state.singleStory,panelPosition:state.layout.panelPosition,toggle:function toggle(){return api.togglePanel();}};};var addonsTool={title:'addons',id:'addons',match:function match(_ref163){var viewMode=_ref163.viewMode;return viewMode==='story';},render:function render(){return React$2.createElement(Consumer,{filter:menuMapper$1},function(_ref164){var isVisible=_ref164.isVisible,toggle=_ref164.toggle,singleStory=_ref164.singleStory,panelPosition=_ref164.panelPosition;return!singleStory&&!isVisible&&React$2.createElement(React$2.Fragment,null,React$2.createElement(IconButton,{"aria-label":"Show addons",key:"addons",onClick:toggle,title:"Show addons"},React$2.createElement(Icons,{icon:panelPosition==='bottom'?'bottombar':'sidebaralt'})));});}};var StyledAnimatedIconButton=styled(IconButton)(function(_ref165){var theme=_ref165.theme,animating=_ref165.animating,disabled=_ref165.disabled;return{opacity:disabled?0.5:1,svg:{animation:animating&&"".concat(theme.animation.rotate360," 1000ms ease-out")}};});var menuMapper=function menuMapper(_ref166){var api=_ref166.api,state=_ref166.state;var storyId=state.storyId;return{storyId:storyId,remount:function remount(){return api.emit(FORCE_REMOUNT,{storyId:state.storyId});}};};var remountTool={title:'remount',id:'remount',match:function match(_ref167){var viewMode=_ref167.viewMode;return viewMode==='story';},render:function render(){return React$2.createElement(Consumer,{filter:menuMapper},function(_ref168){var remount=_ref168.remount,storyId=_ref168.storyId;var _useState11=useState(false),_useState12=_slicedToArray2(_useState11,2),isAnimating=_useState12[0],setIsAnimating=_useState12[1];var animateAndReplay=function animateAndReplay(){if(!storyId)return;setIsAnimating(true);remount();};return React$2.createElement(StyledAnimatedIconButton,{key:"remount",title:"Remount component",onClick:animateAndReplay,onAnimationEnd:function onAnimationEnd(){return setIsAnimating(false);},animating:isAnimating,disabled:!storyId},React$2.createElement(Icons,{icon:"sync"}));});}};var getTools=function getTools(getFn){return Object.values(getFn(types.TOOL));};var getToolsExtra=function getToolsExtra(getFn){return Object.values(getFn(types.TOOLEXTRA));};var Bar=function Bar(_a){var props=__rest(_a,["shown"]);return React$2.createElement(FlexBar,Object.assign({},props));};var Toolbar=styled(Bar)({position:'absolute',left:0,right:0,top:0,transition:'transform .2s linear'},function(_ref169){var shown=_ref169.shown;return{transform:shown?'translateY(0px)':'translateY(-40px)'};});var fullScreenMapper=function fullScreenMapper(_ref170){var api=_ref170.api,state=_ref170.state;return{toggle:api.toggleFullscreen,value:state.layout.isFullscreen,shortcut:shortcutToHumanString(api.getShortcutKeys().fullScreen),hasPanel:Object.keys(api.getPanels()).length>0,singleStory:state.singleStory};};var fullScreenTool={title:'fullscreen',id:'fullscreen',match:function match(p){return['story','docs'].includes(p.viewMode);},render:function render(){return React$2.createElement(Consumer,{filter:fullScreenMapper},function(_ref171){var toggle=_ref171.toggle,value=_ref171.value,shortcut=_ref171.shortcut,hasPanel=_ref171.hasPanel,singleStory=_ref171.singleStory;return(!singleStory||singleStory&&hasPanel)&&React$2.createElement(IconButton,{key:"full",onClick:toggle,title:"".concat(value?'Exit full screen':'Go full screen'," [").concat(shortcut,"]")},React$2.createElement(Icons,{icon:value?'close':'expand'}));});}};var tabsMapper=function tabsMapper(_ref172){var state=_ref172.state;return{viewMode:state.docsOnly,storyId:state.storyId,path:state.path,location:state.location,refId:state.refId};};var createTabsTool=function createTabsTool(tabs){return{title:'title',id:'title',render:function render(){return React$2.createElement(Consumer,{filter:tabsMapper},function(rp){return React$2.createElement(Fragment,null,React$2.createElement(TabBar,{key:"tabs"},tabs.filter(function(p){return!p.hidden;}).map(function(t,index){var to=t.route(rp);var isActive=rp.path===to;return React$2.createElement(UnstyledLink,{key:t.id||"l".concat(index),to:to},React$2.createElement(TabButton,{disabled:t.disabled,active:isActive},t.title));})),React$2.createElement(Separator,null));});}};};var defaultTools=[remountTool,zoomTool];var defaultToolsExtra=[addonsTool,fullScreenTool,ejectTool,copyTool];var useTools=function useTools(getElements,tabs,viewMode,story,location,path){var toolsFromConfig=useMemo(function(){return getTools(getElements);},[getElements]);var toolsExtraFromConfig=useMemo(function(){return getToolsExtra(getElements);},[getElements]);var tools=useMemo(function(){return[].concat(defaultTools,_toConsumableArray(toolsFromConfig));},[defaultTools,toolsFromConfig]);var toolsExtra=useMemo(function(){return[].concat(defaultToolsExtra,_toConsumableArray(toolsExtraFromConfig));},[defaultToolsExtra,toolsExtraFromConfig]);return useMemo(function(){return story&&story.parameters?filterTools(tools,toolsExtra,tabs,{viewMode:viewMode,story:story,location:location,path:path}):{left:tools,right:toolsExtra};},[viewMode,story,location,path,tools,toolsExtra,tabs]);};var ToolRes=React$2.memo(function(_ref173){var api=_ref173.api,story=_ref173.story,tabs=_ref173.tabs,isShown=_ref173.isShown,location=_ref173.location,path=_ref173.path,viewMode=_ref173.viewMode;var _useTools=useTools(api.getElements,tabs,viewMode,story,location,path),left=_useTools.left,right=_useTools.right;return left||right?React$2.createElement(Toolbar,{key:"toolbar",shown:isShown,border:true},React$2.createElement(Tools,{key:"left",list:left}),React$2.createElement(Tools,{key:"right",list:right})):null;});var ToolbarComp=React$2.memo(function(props){return React$2.createElement(Location,null,function(_ref174){var location=_ref174.location,path=_ref174.path,viewMode=_ref174.viewMode;return React$2.createElement(ToolRes,Object.assign({},props,{location:location,path:path,viewMode:viewMode}));});});var Tools=React$2.memo(function(_ref175){var list=_ref175.list;return React$2.createElement(React$2.Fragment,null,list.filter(Boolean).map(function(_a,index){var Render=_a.render,id=_a.id,t=__rest(_a,["render","id"]);return(// @ts-ignore
1703React$2.createElement(Render,{key:id||t.key||"f-".concat(index)}));}));});function toolbarItemHasBeenExcluded(item,story){var _a;var toolbarItemsFromStoryParameters='toolbar'in story.parameters?story.parameters.toolbar:undefined;var _addons$getConfig=addons.getConfig(),toolbarItemsFromAddonsConfig=_addons$getConfig.toolbar;var toolbarItems=merge(toolbarItemsFromAddonsConfig,toolbarItemsFromStoryParameters);return toolbarItems?!!((_a=toolbarItems[item.id])===null||_a===void 0?void 0:_a.hidden):false;}function filterTools(tools,toolsExtra,tabs,_ref176){var viewMode=_ref176.viewMode,story=_ref176.story,location=_ref176.location,path=_ref176.path;var toolsLeft=[menuTool,tabs.filter(function(p){return!p.hidden;}).length>=1&&createTabsTool(tabs)].concat(_toConsumableArray(tools));var toolsRight=_toConsumableArray(toolsExtra);var filter=function filter(item){return item&&(!item.match||item.match({storyId:story.id,refId:story.refId,viewMode:viewMode,location:location,path:path}))&&!toolbarItemHasBeenExcluded(item,story);};var left=toolsLeft.filter(filter);var right=toolsRight.filter(filter);return{left:left,right:right};}var StyledIframe=styled.iframe({position:'absolute',display:'block',boxSizing:'content-box',height:'100%',width:'100%',border:'0 none',transition:'all .3s, background-position 0s, visibility 0s',backgroundPosition:'-1px -1px, -1px -1px, -1px -1px, -1px -1px'});function IFrame(props){var active=props.active,id=props.id,title=props.title,src=props.src,allowFullScreen=props.allowFullScreen,scale=props.scale,rest=__rest(props,["active","id","title","src","allowFullScreen","scale"]);var iFrameRef=React$2.useRef(null);return React$2.createElement(Zoom$1.IFrame,{scale:scale,active:active,iFrameRef:iFrameRef},React$2.createElement(StyledIframe,Object.assign({"data-is-storybook":active?'true':'false',onLoad:function onLoad(e){return e.currentTarget.setAttribute('data-is-loaded','true');},id:id,title:title,src:src,allowFullScreen:allowFullScreen,ref:iFrameRef},rest)));}var stringifyQueryParams=function stringifyQueryParams(queryParams){return qs.stringify(queryParams,{addQueryPrefix:true,encode:false}).replace(/^\?/,'&');};var getActive=function getActive(refId){if(refId){return"storybook-ref-".concat(refId);}return'storybook-preview-iframe';};var SkipToSidebarLink=styled(Button$1)(function(_ref177){var theme=_ref177.theme;return{display:'none','@media (min-width: 600px)':{position:'absolute',display:'block',top:10,right:15,padding:'10px 15px',fontSize:theme.typography.size.s1,transform:'translateY(-100px)','&:focus':{transform:'translateY(0)',zIndex:1}}};});var whenSidebarIsVisible=function whenSidebarIsVisible(_ref178){var state=_ref178.state;return{isFullscreen:state.layout.isFullscreen,showNav:state.layout.showNav,selectedStoryId:state.storyId};};var FramesRenderer=function FramesRenderer(_ref179){var refs=_ref179.refs,story=_ref179.story,scale=_ref179.scale,_ref179$viewMode=_ref179.viewMode,viewMode=_ref179$viewMode===void 0?'story':_ref179$viewMode,refId=_ref179.refId,_ref179$queryParams=_ref179.queryParams,queryParams=_ref179$queryParams===void 0?{}:_ref179$queryParams,baseUrl=_ref179.baseUrl,_ref179$storyId=_ref179.storyId,storyId=_ref179$storyId===void 0?'*':_ref179$storyId;var _a;var version=(_a=refs[refId])===null||_a===void 0?void 0:_a.version;var stringifiedQueryParams=stringifyQueryParams(Object.assign(Object.assign({},queryParams),version&&{version:version}));var active=getActive(refId);var styles=useMemo(function(){// add #root to make the selector high enough in specificity
1704return{'#root [data-is-storybook="false"]':{display:'none'},'#root [data-is-storybook="true"]':{display:'block'}};},[]);var _useState13=useState({'storybook-preview-iframe':getStoryHref(baseUrl,storyId,Object.assign(Object.assign(Object.assign({},queryParams),version&&{version:version}),{viewMode:viewMode}))}),_useState14=_slicedToArray2(_useState13,2),frames=_useState14[0],setFrames=_useState14[1];useEffect(function(){var newFrames=Object.values(refs).filter(function(r){if(r.error){return false;}if(r.type==='auto-inject'){return true;}if(story&&r.id===story.refId){return true;}return false;}).reduce(function(acc,r){return Object.assign(Object.assign({},acc),_defineProperty2({},"storybook-ref-".concat(r.id),"".concat(r.url,"/iframe.html?id=").concat(storyId,"&viewMode=").concat(viewMode,"&refId=").concat(r.id).concat(stringifiedQueryParams)));},frames);setFrames(newFrames);},[storyId,story,refs]);return React$2.createElement(Fragment,null,React$2.createElement(Global,{styles:styles}),React$2.createElement(Consumer,{filter:whenSidebarIsVisible},function(_ref180){var isFullscreen=_ref180.isFullscreen,showNav=_ref180.showNav,selectedStoryId=_ref180.selectedStoryId;if(!isFullscreen&&!!showNav&&selectedStoryId){return React$2.createElement(SkipToSidebarLink,{secondary:true,isLink:true,tabIndex:0,href:"#".concat(selectedStoryId)},"Skip to sidebar");}return null;}),Object.entries(frames).map(function(_ref181){var _ref182=_slicedToArray2(_ref181,2),id=_ref182[0],src=_ref182[1];return React$2.createElement(Fragment,{key:id},React$2.createElement(IFrame,{active:id===active,key:refs[id]?refs[id].url:id,id:id,title:id,src:src,allowFullScreen:true,scale:scale}));}));};var getWrappers=function getWrappers(getFn){return Object.values(getFn(types.PREVIEW));};var getTabs=function getTabs(getFn){return Object.values(getFn(types.TAB));};var canvasMapper=function canvasMapper(_ref183){var state=_ref183.state,api=_ref183.api;return{storyId:state.storyId,refId:state.refId,viewMode:state.viewMode,customCanvas:api.renderPreview,queryParams:state.customQueryParams,getElements:api.getElements,story:api.getData(state.storyId,state.refId),storiesConfigured:state.storiesConfigured,storiesFailed:state.storiesFailed,refs:state.refs,active:!!(state.viewMode&&state.viewMode.match(/^(story|docs)$/))};};var createCanvas=function createCanvas(id){var baseUrl=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'iframe.html';var withLoader=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;return{id:'canvas',title:'Canvas',route:function route(_ref184){var storyId=_ref184.storyId,refId=_ref184.refId;return refId?"/story/".concat(refId,"_").concat(storyId):"/story/".concat(storyId);},match:function match(_ref185){var viewMode=_ref185.viewMode;return!!(viewMode&&viewMode.match(/^(story|docs)$/));},render:function render(){return React$2.createElement(Consumer,{filter:canvasMapper},function(_ref186){var story=_ref186.story,refs=_ref186.refs,customCanvas=_ref186.customCanvas,storyId=_ref186.storyId,refId=_ref186.refId,viewMode=_ref186.viewMode,queryParams=_ref186.queryParams,getElements=_ref186.getElements,storiesConfigured=_ref186.storiesConfigured,storiesFailed=_ref186.storiesFailed,active=_ref186.active;var wrappers=useMemo(function(){return[].concat(defaultWrappers,_toConsumableArray(getWrappers(getElements)));},[getElements].concat(defaultWrappers));var isLoading=story?!!refs[refId]&&!refs[refId].ready:!storiesFailed&&!storiesConfigured;return React$2.createElement(ZoomConsumer,null,function(_ref187){var scale=_ref187.value;return React$2.createElement(React$2.Fragment,null,withLoader&&isLoading&&React$2.createElement(LoaderWrapper$1,null,React$2.createElement(Loader$1,{id:"preview-loader",role:"progressbar"})),React$2.createElement(ApplyWrappers,{id:id,storyId:storyId,viewMode:viewMode,active:active,wrappers:wrappers},customCanvas?customCanvas(storyId,viewMode,id,baseUrl,scale,queryParams):React$2.createElement(FramesRenderer,{baseUrl:baseUrl,refs:refs,scale:scale,story:story,viewMode:viewMode,refId:refId,queryParams:queryParams,storyId:storyId})));});});}};};var useTabs=function useTabs(id,baseUrl,withLoader,getElements,story){var canvas=useMemo(function(){return createCanvas(id,baseUrl,withLoader);},[id,baseUrl,withLoader]);var tabsFromConfig=useMemo(function(){return getTabs(getElements);},[getElements]);return useMemo(function(){if(story===null||story===void 0?void 0:story.parameters){return filterTabs([canvas].concat(_toConsumableArray(tabsFromConfig)),story.parameters);}return[canvas].concat(_toConsumableArray(tabsFromConfig));},[story,canvas].concat(_toConsumableArray(tabsFromConfig)));};var Preview=React$2.memo(function(props){var api=props.api,previewId=props.id,options=props.options,viewMode=props.viewMode,storyId=props.storyId,_props$story=props.story,story=_props$story===void 0?undefined:_props$story,description=props.description,baseUrl=props.baseUrl,_props$withLoader=props.withLoader,withLoader=_props$withLoader===void 0?true:_props$withLoader;var getElements=api.getElements;var tabs=useTabs(previewId,baseUrl,withLoader,getElements,story);var shouldScale=viewMode==='story';var showToolbar=options.showToolbar,_options$showTabs=options.showTabs,showTabs=_options$showTabs===void 0?true:_options$showTabs;var visibleTabsInToolbar=showTabs?tabs:[];var previousStoryId=useRef(storyId);var previousViewMode=useRef(viewMode);useEffect(function(){if(story&&viewMode){// Don't emit the event on first ("real") render, only when story or mode changes
1705if(storyId!==previousStoryId.current||viewMode!==previousViewMode.current){previousStoryId.current=storyId;previousViewMode.current=viewMode;if(viewMode.match(/docs|story/)){var refId=story.refId,id=story.id;api.emit(SET_CURRENT_STORY,{storyId:id,viewMode:viewMode,options:{target:refId?"storybook-ref-".concat(refId):'storybook-preview-iframe'}});}}}},[story,viewMode]);return React$2.createElement(Fragment,null,previewId==='main'&&React$2.createElement(W$1,{key:"description"},React$2.createElement("title",null,description)),React$2.createElement(ZoomProvider,{shouldScale:shouldScale},React$2.createElement(ToolbarComp,{key:"tools",story:story,api:api,isShown:showToolbar,tabs:visibleTabsInToolbar}),React$2.createElement(FrameWrap,{key:"frame",offset:showToolbar?40:0},tabs.map(function(_a,i){var Render=_a.render,match=_a.match,t=__rest(_a,["render","match"]);// @ts-ignore
1706var key=t.id||t.key||i;return React$2.createElement(Fragment,{key:key},React$2.createElement(Location,null,function(lp){return React$2.createElement(Render,{active:match(lp)});}));}))));});function filterTabs(panels,parameters){var _addons$getConfig2=addons.getConfig(),previewTabs=_addons$getConfig2.previewTabs;var parametersTabs=parameters?parameters.previewTabs:undefined;if(previewTabs||parametersTabs){// deep merge global and local settings
1707var tabs=merge(previewTabs,parametersTabs);var arrTabs=Object.keys(tabs).map(function(key,index){return Object.assign(Object.assign({index:index},typeof tabs[key]==='string'?{title:tabs[key]}:tabs[key]),{id:key});});return panels.filter(function(panel){var t=arrTabs.find(function(tab){return tab.id===panel.id;});return t===undefined||t.id==='canvas'||!t.hidden;}).map(function(panel,index){return Object.assign(Object.assign({},panel),{index:index});}).sort(function(p1,p2){var tab_1=arrTabs.find(function(tab){return tab.id===p1.id;});// @ts-ignore
1708var index_1=tab_1?tab_1.index:arrTabs.length+p1.index;var tab_2=arrTabs.find(function(tab){return tab.id===p2.id;});// @ts-ignore
1709var index_2=tab_2?tab_2.index:arrTabs.length+p2.index;return index_1-index_2;}).map(function(panel){var t=arrTabs.find(function(tab){return tab.id===panel.id;});if(t){return Object.assign(Object.assign({},panel),{title:t.title||panel.title,disabled:t.disabled,hidden:t.hidden});}return panel;});}return panels;}var PREVIEW_URL=window_1.PREVIEW_URL;var splitTitleAddExtraSpace=function splitTitleAddExtraSpace(input){return input.split('/').join(' / ').replace(/\s\s/,' ');};var getDescription=function getDescription(item){if(isRoot(item)){return item.name?"".concat(item.name," \u22C5 Storybook"):'Storybook';}if(isGroup(item)){return item.name?"".concat(item.name," \u22C5 Storybook"):'Storybook';}if(isStory(item)){var kind=item.kind,name=item.name;return kind&&name?splitTitleAddExtraSpace("".concat(kind," - ").concat(name," \u22C5 Storybook")):'Storybook';}return'Storybook';};var mapper$2=function mapper$2(_ref188){var api=_ref188.api,state=_ref188.state;var layout=state.layout,location=state.location,customQueryParams=state.customQueryParams,storyId=state.storyId,refs=state.refs,viewMode=state.viewMode,path=state.path,refId=state.refId;var story=api.getData(storyId,refId);var docsOnly=story&&story.parameters?!!story.parameters.docsOnly:false;return{api:api,story:story,options:layout,description:getDescription(story),viewMode:viewMode,path:path,refs:refs,storyId:storyId,baseUrl:PREVIEW_URL||'iframe.html',queryParams:customQueryParams,docsOnly:docsOnly,location:location};};var PreviewConnected=React$2.memo(function(props){return React$2.createElement(Consumer,{filter:mapper$2},function(fromState){return React$2.createElement(Preview,Object.assign({},props,fromState));});});var DesktopOnlyIconButton=styled(IconButton)({// Hides full screen icon at mobile breakpoint defined in app.js
1710'@media (max-width: 599px)':{display:'none'}});var SafeTabContent=React$2.memo(function(_ref189){var children=_ref189.children;return children;});var SafeTab=/*#__PURE__*/function(_Component5){_inherits2(SafeTab,_Component5);var _super6=_createSuper2(SafeTab);function SafeTab(props){var _this12;_classCallCheck2(this,SafeTab);_this12=_super6.call(this,props);_this12.state={hasError:false};return _this12;}_createClass2(SafeTab,[{key:"componentDidCatch",value:function componentDidCatch(error,info){this.setState({hasError:true});// eslint-disable-next-line no-console
1711console.error(error,info);}},{key:"render",value:function render(){var hasError=this.state.hasError;var _this$props7=this.props,children=_this$props7.children,title=_this$props7.title,id=_this$props7.id;if(hasError){return React$2.createElement("h1",null,"Something went wrong.");}return React$2.createElement(SafeTabContent,{id:id,title:title},children);}}]);return SafeTab;}(Component);var AddonPanel=React$2.memo(function(_ref190){var panels=_ref190.panels,shortcuts=_ref190.shortcuts,actions=_ref190.actions,_ref190$selectedPanel=_ref190.selectedPanel,selectedPanel=_ref190$selectedPanel===void 0?null:_ref190$selectedPanel,_ref190$panelPosition=_ref190.panelPosition,panelPosition=_ref190$panelPosition===void 0?'right':_ref190$panelPosition,_ref190$absolute=_ref190.absolute,absolute=_ref190$absolute===void 0?true:_ref190$absolute;return React$2.createElement(Tabs,{absolute:absolute,selected:selectedPanel,actions:actions,tools:React$2.createElement(Fragment,null,React$2.createElement(DesktopOnlyIconButton,{key:"position",onClick:actions.togglePosition,title:"Change addon orientation [".concat(shortcutToHumanString(shortcuts.panelPosition),"]")},React$2.createElement(Icons,{icon:panelPosition==='bottom'?'sidebaralt':'bottombar'})),React$2.createElement(DesktopOnlyIconButton,{key:"visibility",onClick:actions.toggleVisibility,title:"Hide addons [".concat(shortcutToHumanString(shortcuts.togglePanel),"]")},React$2.createElement(Icons,{icon:"close"}))),id:"storybook-panel-root"},Object.entries(panels).map(function(_ref191){var _ref192=_slicedToArray2(_ref191,2),k=_ref192[0],v=_ref192[1];return React$2.createElement(SafeTab,{key:k,id:k,title:v.title},v.render);}));});AddonPanel.displayName='AddonPanel';var createPanelActions=memoize(1)(function(api){return{onSelect:function onSelect(panel){return api.setSelectedPanel(panel);},toggleVisibility:function toggleVisibility(){return api.togglePanel();},togglePosition:function togglePosition(){return api.togglePanelPosition();}};});var mapper$1=function mapper$1(_ref193){var state=_ref193.state,api=_ref193.api;return{panels:api.getStoryPanels(),selectedPanel:api.getSelectedPanel(),panelPosition:state.layout.panelPosition,actions:createPanelActions(api),shortcuts:api.getShortcutKeys()};};var Panel=function Panel(props){return React$2.createElement(Consumer,{filter:mapper$1},function(customProps){return React$2.createElement(AddonPanel,Object.assign({},props,customProps));});};var DEFAULT_ICON_COLOUR='#66BF3C';var Notification=styled.div(function(_ref194){var theme=_ref194.theme;return{position:'relative',display:'flex',padding:15,width:280,borderRadius:4,alignItems:'center',background:theme.base==='light'?'rgba(50,53,71,0.97)':'linear-gradient(0deg, rgba(248,248,248,0.97) 0%, rgba(247,252,255,0.97) 100%)',boxShadow:"0 2px 5px 0 rgba(0,0,0,0.05), 0 5px 15px 0 rgba(0,0,0,0.1)",color:theme.color.inverseText,textDecoration:'none'};});var NotificationWithInteractiveStates=styled(Notification)(function(){return{transition:'all 150ms ease-out',transform:'translate3d(0, 0, 0)','&:hover':{transform:'translate3d(0, -3px, 0)',boxShadow:'0 1px 3px 0 rgba(30,167,253,0.5), 0 2px 5px 0 rgba(0,0,0,0.05), 0 5px 15px 0 rgba(0,0,0,0.1)'},'&:active':{transform:'translate3d(0, 0, 0)',boxShadow:'0 1px 3px 0 rgba(30,167,253,0.5), 0 2px 5px 0 rgba(0,0,0,0.05), 0 5px 15px 0 rgba(0,0,0,0.1)'},'&:focus':{boxShadow:'0 1px 3px 0 rgba(30,167,253,0.5), 0 2px 5px 0 rgba(0,0,0,0.05), 0 5px 15px 0 rgba(0,0,0,0.1)'}};});var NotificationLink=NotificationWithInteractiveStates.withComponent(Link$1);var NotificationIconWrapper=styled.div(function(){return{display:'flex',marginRight:10,alignItems:'center'};});var NotificationTextWrapper=styled.div(function(){return{width:'100%',display:'flex',flexDirection:'column'};});var Headline=styled.div(function(_ref195){var theme=_ref195.theme,hasIcon=_ref195.hasIcon;return{height:'100%',width:hasIcon?205:230,alignItems:'center',whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis',fontSize:theme.typography.size.s1,lineHeight:'16px',fontWeight:theme.typography.weight.bold};});var SubHeadline=styled.div(function(_ref196){var theme=_ref196.theme;return{color:curriedTransparentize$1(0.25,theme.color.inverseText),fontSize:theme.typography.size.s1-1,lineHeight:'14px',marginTop:2};});var ItemContent=function ItemContent(_ref197){var icon=_ref197.icon,_ref197$content=_ref197.content,headline=_ref197$content.headline,subHeadline=_ref197$content.subHeadline;return React$2.createElement(React$2.Fragment,null,!icon||React$2.createElement(NotificationIconWrapper,null,React$2.createElement(Icons,{icon:icon.name,width:16,color:icon.color||DEFAULT_ICON_COLOUR})),React$2.createElement(NotificationTextWrapper,null,React$2.createElement(Headline,{title:headline,hasIcon:!!icon},headline),subHeadline&&React$2.createElement(SubHeadline,null,subHeadline)));};var DismissButtonWrapper=styled(IconButton)(function(_ref198){var theme=_ref198.theme;return{alignSelf:'center',marginTop:0,color:theme.base==='light'?'rgba(255,255,255,0.7)':' #999999'};});var DismissNotificationItem=function DismissNotificationItem(_ref199){var onDismiss=_ref199.onDismiss;return React$2.createElement(DismissButtonWrapper,{title:"Dismiss notification",onClick:function onClick(e){e.preventDefault();onDismiss();}},React$2.createElement(Icons,{icon:"closeAlt",height:12,width:12}));};styled.div({height:48});var NotificationItem=function NotificationItem(_ref200){var _ref200$notification=_ref200.notification,content=_ref200$notification.content,link=_ref200$notification.link,onClear=_ref200$notification.onClear,id=_ref200$notification.id,icon=_ref200$notification.icon,onDismissNotification=_ref200.onDismissNotification;var dismissNotificationItem=function dismissNotificationItem(){onDismissNotification(id);onClear();};return link?React$2.createElement(NotificationLink,{to:link},React$2.createElement(ItemContent,{icon:icon,content:content}),React$2.createElement(DismissNotificationItem,{onDismiss:dismissNotificationItem})):React$2.createElement(Notification,null,React$2.createElement(ItemContent,{icon:icon,content:content}),React$2.createElement(DismissNotificationItem,{onDismiss:dismissNotificationItem}));};var List=styled.div({zIndex:10,'> * + *':{marginTop:10},'&:empty':{display:'none'}},function(_ref201){var placement=_ref201.placement;return placement||{bottom:0,left:0,right:0,position:'fixed'};});var NotificationList=function NotificationList(_ref202){var notifications=_ref202.notifications,clearNotification=_ref202.clearNotification,_ref202$placement=_ref202.placement,placement=_ref202$placement===void 0?undefined:_ref202$placement;return React$2.createElement(List,{placement:placement},notifications.map(function(notification){return React$2.createElement(NotificationItem,{key:notification.id,onDismissNotification:function onDismissNotification(id){return clearNotification(id);},notification:notification});}));};var mapper=function mapper(_ref203){var state=_ref203.state;var _useStorybookApi=useStorybookApi(),clearNotification=_useStorybookApi.clearNotification;var notifications=state.notifications;return{notifications:notifications,clearNotification:clearNotification};};var NotificationConnect=function NotificationConnect(props){return React$2.createElement(Consumer,{filter:mapper},function(fromState){return React$2.createElement(NotificationList,Object.assign({},props,fromState));});};function e(){return(e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n){Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);}}return t;}).apply(this,arguments);}var n=/[\'\"]/;var r=["children","options"],o=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","className","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce(function(t,e){return t[e.toLowerCase()]=e,t;},{for:"htmlFor"}),c={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},a=["style","script"],u=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,i=/mailto:/i,l=/\n{2,}$/,s=/^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/,_2=/^ *> ?/gm,f=/^ {2,}\n/,d=/^(?:( *[-*_]) *){3,}(?:\n *)+\n/,p=/^\s*(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n *)+\n?/,g=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,m=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,y=/^(?:\n *)*\n/,h=/\r\n?/g,k=/^\[\^([^\]]+)](:.*)\n/,x=/^\[\^([^\]]+)]/,v=/\f/g,b=/^\s*?\[(x|\s)\]/,S=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,$=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,w=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?([^>]*)\/{0}>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1)[\s\S])*?)<\/\1>\n*/i,z=/&([a-z]+);/g,E=/^<!--[\s\S]*?(?:-->)/,A=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,R=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,I=/^\{.*\}$/,M=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,O=/^<([^ >]+@[^ >]+)>/,B=/^<([^ >]+:\/[^ >]+)>/,L=/ *\n+$/,T=/(?:^|\n)( *)$/,j=/-([a-z])?/gi,C=/^(.*\|?.*)\n *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*)\n?/,D=/^\[([^\]]*)\]:\s*(\S+)\s*("([^"]*)")?/,N=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,Z=/^\[([^\]]*)\] ?\[([^\]]*)\]/,F=/(\[|\])/g,P=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,G=/\t/g,H=/^ *\| */,q=/(^ *\||\| *$)/g,U=/ *$/,V=/^ *:-+: *$/,W=/^ *:-+ *$/,Q=/^ *-+: *$/,X=/^([*_])\1((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1\1(?!\1)/,J=/^([*_])((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1(?!\1|\w)/,K=/^~~((?:\[.*?\]|<.*?>(?:.*?<.*?>)?|`.*?`|.)*?)~~/,Y=/^\\([^0-9A-Za-z\s])/,tt=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,et=/^\n+/,nt=/^([ \t]*)/,rt=/\\([^0-9A-Z\s])/gi,ot=new RegExp("^( *)((?:[*+-]|\\d+\\.)) +"),ct=new RegExp("^( *)((?:[*+-]|\\d+\\.)) +[^\\n]*(?:\\n(?!\\1(?:[*+-]|\\d+\\.) )[^\\n]*)*(\\n|$)","gm"),at=new RegExp("^( *)((?:[*+-]|\\d+\\.)) [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1(?:[*+-]|\\d+\\.) (?!(?:[*+-]|\\d+\\.) ))\\n*|\\s*\\n*$)"),ut="(?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*",it=new RegExp("^\\[("+ut+")\\]\\(\\s*<?((?:[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),lt=new RegExp("^!\\[("+ut+")\\]\\(\\s*<?((?:[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),st=[s,g,p,S,$,E,ct,at,C],_t=[].concat(st,[/^[^\n]+(?: \n|\n{2,})/,w,R]);function ft(t){return t.replace(/[ÀÁÂÃÄÅàáâãäåæÆ]/g,"a").replace(/[çÇ]/g,"c").replace(/[ðÐ]/g,"d").replace(/[ÈÉÊËéèêë]/g,"e").replace(/[ÏïÎîÍíÌì]/g,"i").replace(/[Ññ]/g,"n").replace(/[øØœŒÕõÔôÓóÒò]/g,"o").replace(/[ÜüÛûÚúÙù]/g,"u").replace(/[ŸÿÝý]/g,"y").replace(/[^a-z0-9- ]/gi,"").replace(/ /gi,"-").toLowerCase();}function dt(t){return Q.test(t)?"right":V.test(t)?"center":W.test(t)?"left":null;}function pt(t,e,n){var r=n.t;n.t=!0;var o=e(t.trim(),n);n.t=r;var c=[[]];return o.forEach(function(t,e){"tableSeparator"===t.type?0!==e&&e!==o.length-1&&c.push([]):("text"!==t.type||null!=o[e+1]&&"tableSeparator"!==o[e+1].type||(t.content=t.content.replace(U,"")),c[c.length-1].push(t));}),c;}function gt(t,e,n){n.o=!0;var r=pt(t[1],e,n),o=t[2].replace(q,"").split("|").map(dt),c=function(t,e,n){return t.trim().split("\n").map(function(t){return pt(t,e,n);});}(t[3],e,n);return n.o=!1,{align:o,cells:c,header:r,type:"table"};}function mt(t,e){return null==t.align[e]?{}:{textAlign:t.align[e]};}function yt(t){return function(e,n){return n.o?t.exec(e):null;};}function ht(t){return function(e,n){return n.o||n.u?t.exec(e):null;};}function kt(t){return function(e,n){return n.o||n.u?null:t.exec(e);};}function xt(t){return function(e){return t.exec(e);};}function vt(t,e,n){if(e.o||e.u)return null;if(n&&!n.endsWith("\n"))return null;var r="";t.split("\n").every(function(t){return!st.some(function(e){return e.test(t);})&&(r+=t+"\n",t.trim());});var o=r.trimEnd();return""==o?null:[r,o];}function bt(t){try{if(decodeURIComponent(t).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data):/i))return null;}catch(t){return null;}return t;}function St(t){return t.replace(rt,"$1");}function $t(t,e,n){var r=n.o||!1,o=n.u||!1;n.o=!0,n.u=!0;var c=t(e,n);return n.o=r,n.u=o,c;}function wt(t,e,n){var r=n.o||!1,o=n.u||!1;n.o=!1,n.u=!0;var c=t(e,n);return n.o=r,n.u=o,c;}function zt(t,e,n){return n.o=!1,t(e+"\n\n",n);}var Et=function Et(t,e,n){return{content:$t(e,t[1],n)};};function At(){return{};}function Rt(){return null;}function It(){for(var _len5=arguments.length,t=new Array(_len5),_key5=0;_key5<_len5;_key5++){t[_key5]=arguments[_key5];}return t.filter(Boolean).join(" ");}function Mt(t,e,n){var r=t;var o=e.split(".");for(;o.length&&(r=r[o[0]],void 0!==r);){o.shift();}return r||n;}var Ot;function Bt(r){var q=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};q.overrides=q.overrides||{},q.slugify=q.slugify||ft,q.namedCodesToUnicode=q.namedCodesToUnicode?e({},c,q.namedCodesToUnicode):c;var U=q.createElement||React$2.createElement;function V(t,n){var o=Mt(q.overrides,"".concat(t,".props"),{});for(var _len6=arguments.length,r=new Array(_len6>2?_len6-2:0),_key6=2;_key6<_len6;_key6++){r[_key6-2]=arguments[_key6];}return U.apply(void 0,[function(t,e){var n=Mt(e,t);return n?"function"==typeof n||"object"==_typeof2(n)&&"render"in n?n:Mt(e,"".concat(t,".component"),t):t;}(t,q.overrides),e({},n,o,{className:It(null==n?void 0:n.className,o.className)||void 0})].concat(r));}function W(e){var n=!1;q.forceInline?n=!0:q.forceBlock||(n=!1===P.test(e));var r=pt(dt(n?e:"".concat(e.trimEnd().replace(et,""),"\n\n"),{o:n}));for(;"string"==typeof r[r.length-1]&&!r[r.length-1].trim();){r.pop();}if(null===q.wrapper)return r;var o=q.wrapper||(n?"span":"div");var c;if(r.length>1||q.forceWrapper)c=r;else{if(1===r.length)return c=r[0],"string"==typeof c?V("span",{key:"outer"},c):c;c=null;}return React$2.createElement(o,{key:"outer"},c);}function Q(e){var r=e.match(u);return r?r.reduce(function(e,r,c){var a=r.indexOf("=");if(-1!==a){var _u=function(t){return-1!==t.indexOf("-")&&null===t.match(A)&&(t=t.replace(j,function(t,e){return e.toUpperCase();})),t;}(r.slice(0,a)).trim(),_i2=function(t){return t?(n.test(t.charAt(0))&&(t=t.substr(1)),n.test(t.charAt(t.length-1))&&(t=t.substr(0,t.length-1)),t):"";}(r.slice(a+1).trim()),_l=o[_u]||_u,_s2=e[_l]=function(t,e){return"style"===t?e.split(/;\s?/).reduce(function(t,e){var n=e.slice(0,e.indexOf(":"));return t[n.replace(/(-[a-z])/g,function(t){return t[1].toUpperCase();})]=e.slice(n.length+1).trim(),t;},{}):"href"===t?bt(e):(e.match(I)&&(e=e.slice(1,e.length-1)),"true"===e||"false"!==e&&e);}(_u,_i2);"string"==typeof _s2&&(w.test(_s2)||R.test(_s2))&&(e[_l]=React$2.cloneElement(W(_s2.trim()),{key:c}));}else"style"!==r&&(e[o[r]||r]=!0);return e;},{}):void 0;}var rt=[],ut={},st={blockQuote:{i:kt(s),l:Ot.HIGH,_:function _(t,e,n){return{content:e(t[0].replace(_2,""),n)};},p:function p(t,e,n){return V("blockquote",{key:n.g},e(t.content,n));}},breakLine:{i:xt(f),l:Ot.HIGH,_:At,p:function p(t,e,n){return V("br",{key:n.g});}},breakThematic:{i:kt(d),l:Ot.HIGH,_:At,p:function p(t,e,n){return V("hr",{key:n.g});}},codeBlock:{i:kt(g),l:Ot.MAX,_:function _(t){return{content:t[0].replace(/^ {4}/gm,"").replace(/\n+$/,""),lang:void 0};},p:function p(t,e,n){return V("pre",{key:n.g},V("code",{className:t.lang?"lang-".concat(t.lang):""},t.content));}},codeFenced:{i:kt(p),l:Ot.MAX,_:function _(t){return{content:t[3],lang:t[2]||void 0,type:"codeBlock"};}},codeInline:{i:ht(m),l:Ot.LOW,_:function _(t){return{content:t[2]};},p:function p(t,e,n){return V("code",{key:n.g},t.content);}},footnote:{i:kt(k),l:Ot.MAX,_:function _(t){return rt.push({footnote:t[2],identifier:t[1]}),{};},p:Rt},footnoteReference:{i:yt(x),l:Ot.HIGH,_:function _(t){return{content:t[1],target:"#".concat(q.slugify(t[1]))};},p:function p(t,e,n){return V("a",{key:n.g,href:bt(t.target)},V("sup",{key:n.g},t.content));}},gfmTask:{i:yt(b),l:Ot.HIGH,_:function _(t){return{completed:"x"===t[1].toLowerCase()};},p:function p(t,e,n){return V("input",{checked:t.completed,key:n.g,readOnly:!0,type:"checkbox"});}},heading:{i:kt(S),l:Ot.HIGH,_:function _(t,e,n){return{content:$t(e,t[2],n),id:q.slugify(t[2]),level:t[1].length};},p:function p(t,e,n){return t.tag="h".concat(t.level),V(t.tag,{id:t.id,key:n.g},e(t.content,n));}},headingSetext:{i:kt($),l:Ot.MAX,_:function _(t,e,n){return{content:$t(e,t[1],n),level:"="===t[2]?1:2,type:"heading"};}},htmlComment:{i:xt(E),l:Ot.HIGH,_:function _(){return{};},p:Rt},image:{i:ht(lt),l:Ot.HIGH,_:function _(t){return{alt:t[1],target:St(t[2]),title:t[3]};},p:function p(t,e,n){return V("img",{key:n.g,alt:t.alt||void 0,title:t.title||void 0,src:bt(t.target)});}},link:{i:yt(it),l:Ot.LOW,_:function _(t,e,n){return{content:wt(e,t[1],n),target:St(t[2]),title:t[3]};},p:function p(t,e,n){return V("a",{key:n.g,href:bt(t.target),title:t.title},e(t.content,n));}},linkAngleBraceStyleDetector:{i:yt(B),l:Ot.MAX,_:function _(t){return{content:[{content:t[1],type:"text"}],target:t[1],type:"link"};}},linkBareUrlDetector:{i:function i(t,e){return e.m?null:yt(M)(t,e);},l:Ot.MAX,_:function _(t){return{content:[{content:t[1],type:"text"}],target:t[1],title:void 0,type:"link"};}},linkMailtoDetector:{i:yt(O),l:Ot.MAX,_:function _(t){var e=t[1],n=t[1];return i.test(n)||(n="mailto:"+n),{content:[{content:e.replace("mailto:",""),type:"text"}],target:n,type:"link"};}},list:{i:function i(t,e,n){var r=T.exec(n);return!r||!e.h&&e.o?null:at.exec(t=r[1]+t);},l:Ot.HIGH,_:function _(t,e,n){var r=t[2],o=r.length>1,c=o?+r:void 0,a=t[0].replace(l,"\n").match(ct);var u=!1;return{items:a.map(function(t,r){var o=ot.exec(t)[0].length,c=new RegExp("^ {1,"+o+"}","gm"),i=t.replace(c,"").replace(ot,""),l=r===a.length-1,s=-1!==i.indexOf("\n\n")||l&&u;u=s;var _=n.o,f=n.h;var d;n.h=!0,s?(n.o=!1,d=i.replace(L,"\n\n")):(n.o=!0,d=i.replace(L,""));var p=e(d,n);return n.o=_,n.h=f,p;}),ordered:o,start:c};},p:function p(t,e,n){return V(t.ordered?"ol":"ul",{key:n.g,start:t.start},t.items.map(function(t,r){return V("li",{key:r},e(t,n));}));}},newlineCoalescer:{i:kt(y),l:Ot.LOW,_:At,p:function p(){return"\n";}},paragraph:{i:vt,l:Ot.LOW,_:Et,p:function p(t,e,n){return V("p",{key:n.g},e(t.content,n));}},ref:{i:yt(D),l:Ot.MAX,_:function _(t){return ut[t[1]]={target:t[2],title:t[4]},{};},p:Rt},refImage:{i:ht(N),l:Ot.MAX,_:function _(t){return{alt:t[1]||void 0,ref:t[2]};},p:function p(t,e,n){return V("img",{key:n.g,alt:t.alt,src:bt(ut[t.ref].target),title:ut[t.ref].title});}},refLink:{i:yt(Z),l:Ot.MAX,_:function _(t,e,n){return{content:e(t[1],n),fallbackContent:e(t[0].replace(F,"\\$1"),n),ref:t[2]};},p:function p(t,e,n){return ut[t.ref]?V("a",{key:n.g,href:bt(ut[t.ref].target),title:ut[t.ref].title},e(t.content,n)):V("span",{key:n.g},e(t.fallbackContent,n));}},table:{i:kt(C),l:Ot.HIGH,_:gt,p:function p(t,e,n){return V("table",{key:n.g},V("thead",null,V("tr",null,t.header.map(function(r,o){return V("th",{key:o,style:mt(t,o)},e(r,n));}))),V("tbody",null,t.cells.map(function(r,o){return V("tr",{key:o},r.map(function(r,o){return V("td",{key:o,style:mt(t,o)},e(r,n));}));})));}},tableSeparator:{i:function i(t,e){return e.t?H.exec(t):null;},l:Ot.HIGH,_:function _(){return{type:"tableSeparator"};},p:function p(){return" | ";}},text:{i:xt(tt),l:Ot.MIN,_:function _(t){return{content:t[0].replace(z,function(t,e){return q.namedCodesToUnicode[e]?q.namedCodesToUnicode[e]:t;})};},p:function p(t){return t.content;}},textBolded:{i:ht(X),l:Ot.MED,_:function _(t,e,n){return{content:e(t[2],n)};},p:function p(t,e,n){return V("strong",{key:n.g},e(t.content,n));}},textEmphasized:{i:ht(J),l:Ot.LOW,_:function _(t,e,n){return{content:e(t[2],n)};},p:function p(t,e,n){return V("em",{key:n.g},e(t.content,n));}},textEscaped:{i:ht(Y),l:Ot.HIGH,_:function _(t){return{content:t[1],type:"text"};}},textStrikethroughed:{i:ht(K),l:Ot.LOW,_:Et,p:function p(t,e,n){return V("del",{key:n.g},e(t.content,n));}}};!0!==q.disableParsingRawHTML&&(st.htmlBlock={i:xt(w),l:Ot.HIGH,_:function _(t,e,n){var _t$3$match=t[3].match(nt),_t$3$match2=_slicedToArray2(_t$3$match,2),r=_t$3$match2[1],o=new RegExp("^".concat(r),"gm"),c=t[3].replace(o,""),u=(i=c,_t.some(function(t){return t.test(i);})?zt:$t);var i;var l=t[1].toLowerCase(),s=-1!==a.indexOf(l);n.m=n.m||"a"===l;var _=s?t[3]:u(e,c,n);return n.m=!1,{attrs:Q(t[2]),content:_,noInnerParse:s,tag:s?l:t[1]};},p:function p(t,n,r){return V(t.tag,e({key:r.g},t.attrs),t.noInnerParse?t.content:n(t.content,r));}},st.htmlSelfClosing={i:xt(R),l:Ot.HIGH,_:function _(t){return{attrs:Q(t[2]||""),tag:t[1]};},p:function p(t,n,r){return V(t.tag,e({},t.attrs,{key:r.g}));}});var dt=function(t){var e=Object.keys(t);function n(r,o){var c=[],a="";for(;r;){var _u2=0;for(;_u2<e.length;){var _i3=e[_u2],_l2=t[_i3],_s3=_l2.i(r,o,a);if(_s3){var _t2=_s3[0];r=r.substring(_t2.length);var _e2=_l2._(_s3,n,o);null==_e2.type&&(_e2.type=_i3),c.push(_e2),a=_t2;break;}_u2++;}}return c;}return e.sort(function(e,n){var r=t[e].l,o=t[n].l;return r!==o?r-o:e<n?-1:1;}),function(t,e){return n(function(t){return t.replace(h,"\n").replace(v,"").replace(G," ");}(t),e);};}(st),pt=(Bt=function(t){return function(e,n,r){return t[e.type].p(e,n,r);};}(st),function t(e){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(Array.isArray(e)){var _r=n.g,_o=[];var _c2=!1;for(var _r2=0;_r2<e.length;_r2++){n.g=_r2;var _a2=t(e[_r2],n),_u3="string"==typeof _a2;_u3&&_c2?_o[_o.length-1]+=_a2:null!==_a2&&_o.push(_a2),_c2=_u3;}return n.g=_r,_o;}return Bt(e,t,n);});var Bt;var Lt=W(r);return rt.length?V("div",null,Lt,V("footer",{key:"footer"},rt.map(function(t){return V("div",{id:q.slugify(t.identifier),key:t.identifier},t.identifier,pt(dt(t.footnote,{o:!0})));}))):Lt;}!function(t){t[t.MAX=0]="MAX",t[t.HIGH=1]="HIGH",t[t.MED=2]="MED",t[t.LOW=3]="LOW",t[t.MIN=4]="MIN";}(Ot||(Ot={}));var Markdown=function Markdown(e){var n=e.children,o=e.options,c=function(t,e){if(null==t)return{};var n,r,o={},c=Object.keys(t);for(r=0;r<c.length;r++){e.indexOf(n=c[r])>=0||(o[n]=t[n]);}return o;}(e,r);return React$2.cloneElement(Bt(n,o),c);};var Footer=styled.div(function(_ref204){var theme=_ref204.theme;return{display:'flex',paddingTop:20,marginTop:20,borderTop:"1px solid ".concat(theme.appBorderColor),fontWeight:theme.typography.weight.bold,'& > * + *':{marginLeft:20}};});var SettingsFooter=function SettingsFooter(props){return React$2.createElement(Footer,Object.assign({},props),React$2.createElement(Link,{secondary:true,href:"https://storybook.js.org",cancel:false,target:"_blank"},"Docs"),React$2.createElement(Link,{secondary:true,href:"https://github.com/storybookjs/storybook",cancel:false,target:"_blank"},"GitHub"),React$2.createElement(Link,{secondary:true,href:"https://storybook.js.org/support",cancel:false,target:"_blank"},"Support"));};var Header$1=styled.header(function(_ref205){var theme=_ref205.theme;return{marginBottom:20,fontSize:theme.typography.size.m3,fontWeight:theme.typography.weight.black,alignItems:'center',display:'flex','> svg':{height:32,width:'auto',marginRight:8}};});var Subheading=styled.span(function(_ref206){var theme=_ref206.theme;return{letterSpacing:'0.35em',textTransform:'uppercase',fontWeight:theme.typography.weight.black,fontSize:theme.typography.size.s2-1,lineHeight:'24px',color:theme.color.mediumdark};});var SubheadingLink=styled(Link)(function(_ref207){var theme=_ref207.theme;return{fontSize:theme.typography.size.s1};});var Subheader=styled.div({display:'flex',justifyContent:'space-between',alignItems:'center',marginBottom:'.75rem'});var UpdateMessage=styled.div(function(_ref208){var status=_ref208.status,theme=_ref208.theme;if(status==='positive'){return{background:theme.background.positive,color:theme.color.positive};}if(status==='negative'){return{background:theme.background.negative,color:theme.color.negative};}return{background:'#EAF3FC',color:theme.color.darkest};},function(_ref209){var theme=_ref209.theme;return{fontWeight:theme.typography.weight.bold,fontSize:theme.typography.size.s2,padding:'10px 20px',marginBottom:24,borderRadius:theme.appBorderRadius,border:"1px solid ".concat(theme.appBorderColor),textAlign:'center'};});var ErrorMessage=styled.div(function(_ref210){var theme=_ref210.theme;return{fontWeight:theme.typography.weight.bold,textAlign:'center'};});var Upgrade=styled.div(function(_ref211){var theme=_ref211.theme;return{marginTop:20,borderTop:"1px solid ".concat(theme.appBorderColor)};});var Container$2=styled.div({padding:"3rem 20px",maxWidth:600,margin:'0 auto'});var AboutScreen=function AboutScreen(_ref212){var _ref212$latest=_ref212.latest,latest=_ref212$latest===void 0?null:_ref212$latest,current=_ref212.current;var canUpdate=latest&&semver.gt(latest.version,current.version);var updateMessage;if(latest){if(canUpdate){updateMessage=React$2.createElement(UpdateMessage,{status:"positive"},"Storybook ",latest.version," is available. Upgrade from ",current.version," now.");}else{updateMessage=React$2.createElement(UpdateMessage,{status:"neutral"},"Looking good! You're up to date.");}}else{updateMessage=React$2.createElement(UpdateMessage,{status:"negative"},"Oops! The latest version of Storybook couldn't be fetched.");}return React$2.createElement(Container$2,null,React$2.createElement(Header$1,null,React$2.createElement(StorybookIcon,null),"Storybook ",current.version),updateMessage,latest?React$2.createElement(Fragment,null,React$2.createElement(Subheader,null,React$2.createElement(Subheading,null,latest.version," Changelog"),React$2.createElement(SubheadingLink,{secondary:true,href:"https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md",withArrow:true,cancel:false,target:"_blank"},"Read full changelog")),React$2.createElement(DocumentWrapper,null,React$2.createElement(Markdown,null,latest.info.plain))):React$2.createElement(ErrorMessage,null,React$2.createElement(Link,{href:"https://github.com/storybookjs/storybook/releases",target:"_blank",withArrow:true,secondary:true,cancel:false},"Check Storybook's release history")),canUpdate&&React$2.createElement(Upgrade,null,React$2.createElement(DocumentWrapper,null,React$2.createElement("p",null,React$2.createElement("b",null,"Upgrade all Storybook packages to latest:")),React$2.createElement(SyntaxHighlighter,{language:"bash",copyable:true,padded:true,bordered:true},"npx sb upgrade"))),React$2.createElement(SettingsFooter,null));};// Clear a notification on mount. This could be exported by core/notifications.js perhaps?
1712var NotificationClearer=/*#__PURE__*/function(_Component6){_inherits2(NotificationClearer,_Component6);var _super7=_createSuper2(NotificationClearer);function NotificationClearer(){_classCallCheck2(this,NotificationClearer);return _super7.apply(this,arguments);}_createClass2(NotificationClearer,[{key:"componentDidMount",value:function componentDidMount(){var _this$props8=this.props,api=_this$props8.api,notificationId=_this$props8.notificationId;api.clearNotification(notificationId);}},{key:"render",value:function render(){var children=this.props.children;return children;}}]);return NotificationClearer;}(Component);var AboutPage=function AboutPage(){var api=useStorybookApi();return React$2.createElement(NotificationClearer,{api:api,notificationId:"update"},React$2.createElement(AboutScreen,{current:api.getCurrentVersion(),latest:api.getLatestVersion()}));};var Centered=styled.div({top:'50%',position:'absolute',transform:'translateY(-50%)',width:'100%',textAlign:'center'});var LoaderWrapper=styled.div({position:'relative',height:'32px'});var Message=styled.div(function(_ref213){var theme=_ref213.theme;return{paddingTop:'12px',color:theme.color.mediumdark,maxWidth:'295px',margin:'0 auto',fontSize:"".concat(theme.typography.size.s1,"px"),lineHeight:"16px"};});var Iframe=styled.iframe({position:'absolute',top:0,left:0,right:0,bottom:0,border:0,margin:0,padding:0,width:'100%',height:'100%'},function(_ref214){var isLoaded=_ref214.isLoaded;return{visibility:isLoaded?'visible':'hidden'};});var AlertIcon=styled(function(props){return React$2.createElement(Icons,Object.assign({icon:"alert"},props));})(function(_ref215){var theme=_ref215.theme;return{color:theme.color.mediumdark,width:40,margin:'0 auto'};});var getIframeUrl=function getIframeUrl(version){var _version$split=version.split('.'),_version$split2=_slicedToArray2(_version$split,2),major=_version$split2[0],minor=_version$split2[1];return"https://storybook.js.org/releases/iframe/".concat(major,".").concat(minor);};var ReleaseNotesLoader=function ReleaseNotesLoader(){return React$2.createElement(Centered,null,React$2.createElement(LoaderWrapper,null,React$2.createElement(Loader$1,null)),React$2.createElement(Message,null,"Loading release notes"));};var MaxWaitTimeMessaging=function MaxWaitTimeMessaging(){return React$2.createElement(Centered,null,React$2.createElement(AlertIcon,null),React$2.createElement(Message,null,"The release notes couldn't be loaded. Check your internet connection and try again."));};var PureReleaseNotesScreen=function PureReleaseNotesScreen(_ref216){var didHitMaxWaitTime=_ref216.didHitMaxWaitTime,isLoaded=_ref216.isLoaded,setLoaded=_ref216.setLoaded,version=_ref216.version;return React$2.createElement(Fragment,null,!isLoaded&&!didHitMaxWaitTime&&React$2.createElement(ReleaseNotesLoader,null),didHitMaxWaitTime?React$2.createElement(MaxWaitTimeMessaging,null):React$2.createElement(Iframe,{isLoaded:isLoaded,onLoad:function onLoad(){return setLoaded(true);},src:getIframeUrl(version),title:"Release notes for Storybook version ".concat(version)}));};var MAX_WAIT_TIME=10000;// 10 seconds
1713var ReleaseNotesScreen=function ReleaseNotesScreen(_ref217){var version=_ref217.version;var _useState15=useState(false),_useState16=_slicedToArray2(_useState15,2),isLoaded=_useState16[0],setLoaded=_useState16[1];var _useState17=useState(false),_useState18=_slicedToArray2(_useState17,2),didHitMaxWaitTime=_useState18[0],setDidHitMaxWaitTime=_useState18[1];useEffect(function(){var timer=setTimeout(function(){return!isLoaded&&setDidHitMaxWaitTime(true);},MAX_WAIT_TIME);return function(){return clearTimeout(timer);};},[isLoaded]);return React$2.createElement(PureReleaseNotesScreen,{didHitMaxWaitTime:didHitMaxWaitTime,isLoaded:isLoaded,setLoaded:setLoaded,version:version});};var ReleaseNotesPage=function ReleaseNotesPage(){var api=useStorybookApi();useEffect(function(){api.setDidViewReleaseNotes();},[]);var version=api.releaseNotesVersion();return React$2.createElement(ReleaseNotesScreen,{version:version});};var Button=Form.Button,Input=Form.Input;var Header=styled.header(function(_ref218){var theme=_ref218.theme;return{marginBottom:20,fontSize:theme.typography.size.m3,fontWeight:theme.typography.weight.black,alignItems:'center',display:'flex'};});// Grid
1714var HeaderItem=styled.div(function(_ref219){var theme=_ref219.theme;return{fontWeight:theme.typography.weight.bold};});var GridHeaderRow=styled.div({alignSelf:'flex-end',display:'grid',margin:'10px 0',gridTemplateColumns:'1fr 1fr 12px','& > *:last-of-type':{gridColumn:'2 / 2',justifySelf:'flex-end',gridRow:'1'}});var Row=styled.div(function(_ref220){var theme=_ref220.theme;return{padding:'6px 0',borderTop:"1px solid ".concat(theme.appBorderColor),display:'grid',gridTemplateColumns:'1fr 1fr 0px'};});var GridWrapper=styled.div({display:'grid',gridTemplateColumns:'1fr',gridAutoRows:'minmax(auto, auto)',marginBottom:20});// Form
1715var Description=styled.div({alignSelf:'center'});var TextInput=styled(Input)(function(_ref221){var valid=_ref221.valid,theme=_ref221.theme;return valid==='error'?{animation:"".concat(theme.animation.jiggle," 700ms ease-out")}:{};},{display:'flex',width:80,flexDirection:'column',justifySelf:'flex-end',paddingLeft:4,paddingRight:4,textAlign:'center'});var Fade=keyframes(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n0%,100% { opacity: 0; }\n 50% { opacity: 1; }\n"])));var SuccessIcon=styled(Icons)(function(_ref222){var valid=_ref222.valid,theme=_ref222.theme;return valid==='valid'?{color:theme.color.positive,animation:"".concat(Fade," 2s ease forwards")}:{opacity:0};},{alignSelf:'center',display:'flex',marginLeft:10,height:14,width:14});var Container$1=styled.div(function(_ref223){var theme=_ref223.theme;return{fontSize:theme.typography.size.s2,padding:"3rem 20px",maxWidth:600,margin:'0 auto'};});var shortcutLabels={fullScreen:'Go full screen',togglePanel:'Toggle addons',panelPosition:'Toggle addons orientation',toggleNav:'Toggle sidebar',toolbar:'Toggle canvas toolbar',search:'Focus search',focusNav:'Focus sidebar',focusIframe:'Focus canvas',focusPanel:'Focus addons',prevComponent:'Previous component',nextComponent:'Next component',prevStory:'Previous story',nextStory:'Next story',shortcutsPage:'Go to shortcuts page',aboutPage:'Go to about page',collapseAll:'Collapse all items on sidebar',expandAll:'Expand all items on sidebar'};// Shortcuts that cannot be configured
1716var fixedShortcuts=['escape'];function toShortcutState(shortcutKeys){return Object.entries(shortcutKeys).reduce(function(acc,_ref224){var _ref225=_slicedToArray2(_ref224,2),feature=_ref225[0],shortcut=_ref225[1];return fixedShortcuts.includes(feature)?acc:Object.assign(Object.assign({},acc),_defineProperty2({},feature,{shortcut:shortcut,error:false}));},{});}var ShortcutsScreen=/*#__PURE__*/function(_Component7){_inherits2(ShortcutsScreen,_Component7);var _super8=_createSuper2(ShortcutsScreen);function ShortcutsScreen(props){var _this13;_classCallCheck2(this,ShortcutsScreen);_this13=_super8.call(this,props);_this13.onKeyDown=function(e){var _this13$state=_this13.state,activeFeature=_this13$state.activeFeature,shortcutKeys=_this13$state.shortcutKeys;if(e.key==='Backspace'){return _this13.restoreDefault();}var shortcut=eventToShortcut(e);// Keypress is not a potential shortcut
1717if(!shortcut){return false;}// Check we don't match any other shortcuts
1718var error=!!Object.entries(shortcutKeys).find(function(_ref226){var _ref227=_slicedToArray2(_ref226,2),feature=_ref227[0],existingShortcut=_ref227[1].shortcut;return feature!==activeFeature&&existingShortcut&&shortcutMatchesShortcut(shortcut,existingShortcut);});return _this13.setState({shortcutKeys:Object.assign(Object.assign({},shortcutKeys),_defineProperty2({},activeFeature,{shortcut:shortcut,error:error}))});};_this13.onFocus=function(focusedInput){return function(){var shortcutKeys=_this13.state.shortcutKeys;_this13.setState({activeFeature:focusedInput,shortcutKeys:Object.assign(Object.assign({},shortcutKeys),_defineProperty2({},focusedInput,{shortcut:null,error:false}))});};};_this13.onBlur=function(){return __awaiter(_assertThisInitialized2(_this13),void 0,void 0,/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var _this$state3,shortcutKeys,activeFeature,_shortcutKeys$activeF,shortcut,error;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_this$state3=this.state,shortcutKeys=_this$state3.shortcutKeys,activeFeature=_this$state3.activeFeature;if(!shortcutKeys[activeFeature]){_context.next=6;break;}_shortcutKeys$activeF=shortcutKeys[activeFeature],shortcut=_shortcutKeys$activeF.shortcut,error=_shortcutKeys$activeF.error;if(!(!shortcut||error)){_context.next=5;break;}return _context.abrupt("return",this.restoreDefault());case 5:return _context.abrupt("return",this.saveShortcut());case 6:return _context.abrupt("return",false);case 7:case"end":return _context.stop();}}},_callee,this);}));};_this13.saveShortcut=function(){return __awaiter(_assertThisInitialized2(_this13),void 0,void 0,/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){var _this$state4,activeFeature,shortcutKeys,setShortcut;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_this$state4=this.state,activeFeature=_this$state4.activeFeature,shortcutKeys=_this$state4.shortcutKeys;setShortcut=this.props.setShortcut;_context2.next=4;return setShortcut(activeFeature,shortcutKeys[activeFeature].shortcut);case 4:this.setState({successField:activeFeature});case 5:case"end":return _context2.stop();}}},_callee2,this);}));};_this13.restoreDefaults=function(){return __awaiter(_assertThisInitialized2(_this13),void 0,void 0,/*#__PURE__*/regeneratorRuntime.mark(function _callee3(){var restoreAllDefaultShortcuts,defaultShortcuts;return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:restoreAllDefaultShortcuts=this.props.restoreAllDefaultShortcuts;_context3.next=3;return restoreAllDefaultShortcuts();case 3:defaultShortcuts=_context3.sent;return _context3.abrupt("return",this.setState({shortcutKeys:toShortcutState(defaultShortcuts)}));case 5:case"end":return _context3.stop();}}},_callee3,this);}));};_this13.restoreDefault=function(){return __awaiter(_assertThisInitialized2(_this13),void 0,void 0,/*#__PURE__*/regeneratorRuntime.mark(function _callee4(){var _this$state5,activeFeature,shortcutKeys,restoreDefaultShortcut,defaultShortcut;return regeneratorRuntime.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_this$state5=this.state,activeFeature=_this$state5.activeFeature,shortcutKeys=_this$state5.shortcutKeys;restoreDefaultShortcut=this.props.restoreDefaultShortcut;_context4.next=4;return restoreDefaultShortcut(activeFeature);case 4:defaultShortcut=_context4.sent;return _context4.abrupt("return",this.setState({shortcutKeys:Object.assign(Object.assign({},shortcutKeys),toShortcutState(_defineProperty2({},activeFeature,defaultShortcut)))}));case 6:case"end":return _context4.stop();}}},_callee4,this);}));};_this13.displaySuccessMessage=function(activeElement){var _this13$state2=_this13.state,successField=_this13$state2.successField,shortcutKeys=_this13$state2.shortcutKeys;return activeElement===successField&&shortcutKeys[activeElement].error===false?'valid':undefined;};_this13.displayError=function(activeElement){var _this13$state3=_this13.state,activeFeature=_this13$state3.activeFeature,shortcutKeys=_this13$state3.shortcutKeys;return activeElement===activeFeature&&shortcutKeys[activeElement].error===true?'error':undefined;};_this13.renderKeyInput=function(){var _this13$state4=_this13.state,shortcutKeys=_this13$state4.shortcutKeys,addonsShortcutLabels=_this13$state4.addonsShortcutLabels;var arr=Object.entries(shortcutKeys).map(function(_ref228){var _ref229=_slicedToArray2(_ref228,2),feature=_ref229[0],shortcut=_ref229[1].shortcut;return React$2.createElement(Row,{key:feature},React$2.createElement(Description,null,shortcutLabels[feature]||addonsShortcutLabels[feature]),React$2.createElement(TextInput,{spellCheck:"false",valid:_this13.displayError(feature),className:"modalInput",onBlur:_this13.onBlur,onFocus:_this13.onFocus(feature),// @ts-ignore
1719onKeyDown:_this13.onKeyDown,value:shortcut?shortcutToHumanString(shortcut):'',placeholder:"Type keys",readOnly:true}),React$2.createElement(SuccessIcon,{valid:_this13.displaySuccessMessage(feature),icon:"check"}));});return arr;};_this13.renderKeyForm=function(){return React$2.createElement(GridWrapper,null,React$2.createElement(GridHeaderRow,null,React$2.createElement(HeaderItem,null,"Commands"),React$2.createElement(HeaderItem,null,"Shortcut")),_this13.renderKeyInput());};_this13.state={activeFeature:undefined,successField:undefined,// The initial shortcutKeys that come from props are the defaults/what was saved
1720// As the user interacts with the page, the state stores the temporary, unsaved shortcuts
1721// This object also includes the error attached to each shortcut
1722shortcutKeys:toShortcutState(props.shortcutKeys),addonsShortcutLabels:props.addonsShortcutLabels};return _this13;}_createClass2(ShortcutsScreen,[{key:"render",value:function render(){var layout=this.renderKeyForm();return React$2.createElement(Container$1,null,React$2.createElement(Header,null,"Keyboard shortcuts"),layout,React$2.createElement(Button,{tertiary:true,small:true,id:"restoreDefaultsHotkeys",onClick:this.restoreDefaults},"Restore defaults"),React$2.createElement(SettingsFooter,null));}}]);return ShortcutsScreen;}(Component);var ShortcutsPage=function ShortcutsPage(){return React$2.createElement(Consumer,null,function(_ref230){var _ref230$api=_ref230.api,getShortcutKeys=_ref230$api.getShortcutKeys,getAddonsShortcutLabels=_ref230$api.getAddonsShortcutLabels,setShortcut=_ref230$api.setShortcut,restoreDefaultShortcut=_ref230$api.restoreDefaultShortcut,restoreAllDefaultShortcuts=_ref230$api.restoreAllDefaultShortcuts;return React$2.createElement(ShortcutsScreen,Object.assign({shortcutKeys:getShortcutKeys(),addonsShortcutLabels:getAddonsShortcutLabels()},{setShortcut:setShortcut,restoreDefaultShortcut:restoreDefaultShortcut,restoreAllDefaultShortcuts:restoreAllDefaultShortcuts}));});};var document$1=window_1.document;var TabBarButton=React$2.memo(function(_ref231){var changeTab=_ref231.changeTab,id=_ref231.id,title=_ref231.title;return React$2.createElement(Location,null,function(_ref232){var path=_ref232.path;var active=path.includes("settings/".concat(id));return React$2.createElement(TabButton,{id:"tabbutton-".concat(id),className:['tabbutton'].concat(active?['tabbutton-active']:[]).join(' '),type:"button",key:"id",active:active,onClick:function onClick(){return changeTab(id);},role:"tab"},title);});});var Content=styled(ScrollArea)({position:'absolute',top:40,left:0,right:0,bottom:0,overflow:'auto'},function(_ref233){var theme=_ref233.theme;return{background:theme.background.content};});var Pages=function Pages(_ref234){var changeTab=_ref234.changeTab,onClose=_ref234.onClose,_ref234$enableShortcu=_ref234.enableShortcuts,enableShortcuts=_ref234$enableShortcu===void 0?true:_ref234$enableShortcu,_ref234$hasReleaseNot=_ref234.hasReleaseNotes,hasReleaseNotes=_ref234$hasReleaseNot===void 0?false:_ref234$hasReleaseNot;React$2.useEffect(function(){var handleEscape=function handleEscape(event){if(!enableShortcuts||event.repeat)return;if(matchesModifiers(false,event)&&matchesKeyCode('Escape',event)){event.preventDefault();onClose();}};document$1.addEventListener('keydown',handleEscape);return function(){return document$1.removeEventListener('keydown',handleEscape);};},[]);return React$2.createElement(Fragment,null,React$2.createElement(FlexBar,{border:true},React$2.createElement(TabBar,{role:"tablist"},React$2.createElement(TabBarButton,{id:"about",title:"About",changeTab:changeTab}),hasReleaseNotes&&React$2.createElement(TabBarButton,{id:"release-notes",title:"Release notes",changeTab:changeTab}),React$2.createElement(TabBarButton,{id:"shortcuts",title:"Keyboard shortcuts",changeTab:changeTab})),React$2.createElement(IconButton,{onClick:function onClick(e){e.preventDefault();return onClose();},title:"Close settings page"},React$2.createElement(Icons,{icon:"close"}))),React$2.createElement(Content,{vertical:true,horizontal:false},React$2.createElement(Route,{path:"about"},React$2.createElement(AboutPage,{key:"about"})),React$2.createElement(Route,{path:"release-notes"},React$2.createElement(ReleaseNotesPage,{key:"release-notes"})),React$2.createElement(Route,{path:"shortcuts"},React$2.createElement(ShortcutsPage,{key:"shortcuts"}))));};var SettingsPages=function SettingsPages(){var api=useStorybookApi();var state=useStorybookState();var changeTab=function changeTab(tab){return api.changeSettingsTab(tab);};return React$2.createElement(Pages,{hasReleaseNotes:!!api.releaseNotesVersion(),enableShortcuts:state.ui.enableShortcuts,changeTab:changeTab,onClose:api.closeSettings});};var View=styled.div({position:'fixed',overflow:'hidden',height:'100vh',width:'100vw'});var App=React$2.memo(function(_ref235){var viewMode=_ref235.viewMode,docsOnly=_ref235.docsOnly,layout=_ref235.layout,panelCount=_ref235.panelCount,_ref235$size=_ref235.size,width=_ref235$size.width,height=_ref235$size.height;var content;var props=useMemo(function(){return{Sidebar:Sidebar,Preview:PreviewConnected,Panel:Panel,Notifications:NotificationConnect,pages:[{key:'settings',render:function render(){return React$2.createElement(SettingsPages,null);},route:function route(_ref236){var children=_ref236.children;return React$2.createElement(Route,{path:"/settings/",startsWith:true},children);}}]};},[]);if(!width||!height){content=React$2.createElement("div",null);}else if(width<600){content=React$2.createElement(Mobile,Object.assign({},props,{viewMode:viewMode,options:layout,docsOnly:docsOnly}));}else{content=React$2.createElement(Desktop,Object.assign({},props,{viewMode:viewMode,options:layout,docsOnly:docsOnly},{width:width,height:height},{panelCount:panelCount}));}return React$2.createElement(View,null,React$2.createElement(Global,{styles:createGlobal}),React$2.createElement(Symbols,{icons:['folder','component','document','bookmarkhollow']}),content);},// This is the default shallowEqual implementation, but with custom behavior for the `size` prop.
1723function(prevProps,nextProps){if(Object.is(prevProps,nextProps))return true;if(_typeof2(prevProps)!=='object'||prevProps===null)return false;if(_typeof2(nextProps)!=='object'||nextProps===null)return false;var keysA=Object.keys(prevProps);var keysB=Object.keys(nextProps);if(keysA.length!==keysB.length)return false;// eslint-disable-next-line no-restricted-syntax
1724for(var _i4=0,_keysA=keysA;_i4<_keysA.length;_i4++){var key=_keysA[_i4];if(key==='size'){// SizeMe injects a new `size` object every time, even if the width/height doesn't change,
1725// so we chech that one manually.
1726if(prevProps[key].width!==nextProps[key].width)return false;if(prevProps[key].height!==nextProps[key].height)return false;}else{if(!Object.prototype.hasOwnProperty.call(nextProps,key))return false;if(!Object.is(prevProps[key],nextProps[key]))return false;}}return true;});var SizedApp=reactSizeme({monitorHeight:true})(App);App.displayName='App';var Provider=/*#__PURE__*/function(){function Provider(){_classCallCheck2(this,Provider);}_createClass2(Provider,[{key:"getElements",value:function getElements(_type){throw new Error('Provider.getElements() is not implemented!');}},{key:"handleAPI",value:function handleAPI(_api){throw new Error('Provider.handleAPI() is not implemented!');}},{key:"getConfig",value:function getConfig(){console.error('Provider.getConfig() is not implemented!');return{};}}]);return Provider;}();// eslint-disable-next-line @typescript-eslint/triple-slash-reference
1727var emotionCache=createCache({key:'sto'});emotionCache.compat=true;var DOCS_MODE=window_1.DOCS_MODE;// @ts-ignore
1728ThemeProvider.displayName='ThemeProvider';// @ts-ignore
1729q$2.displayName='HelmetProvider';var getDocsMode=function getDocsMode(){try{return!!DOCS_MODE;}catch(e){return false;}};var Container=process.env.XSTORYBOOK_EXAMPLE_APP?React$2.StrictMode:React$2.Fragment;var Root=function Root(_ref237){var provider=_ref237.provider;return React$2.createElement(Container,{key:"container"},React$2.createElement(q$2,{key:"helmet.Provider"},React$2.createElement(LocationProvider,{key:"location.provider"},React$2.createElement(Main,{provider:provider}))));};var Main=function Main(_ref238){var provider=_ref238.provider;var navigate=useNavigate();return React$2.createElement(Location,{key:"location.consumer"},function(locationData){return React$2.createElement(Provider$1,Object.assign({key:"manager",provider:provider},locationData,{navigate:navigate,docsMode:getDocsMode()}),function(_ref239){var state=_ref239.state,api=_ref239.api;var panelCount=Object.keys(api.getPanels()).length;var story=api.getData(state.storyId,state.refId);var isLoading=story?!!state.refs[state.refId]&&!state.refs[state.refId].ready:!state.storiesFailed&&!state.storiesConfigured;return React$2.createElement(CacheProvider,{value:emotionCache},React$2.createElement(ThemeProvider,{key:"theme.provider",theme:ensure(state.theme)},React$2.createElement(SizedApp,{key:"app",viewMode:state.viewMode,layout:isLoading?Object.assign(Object.assign({},state.layout),{showPanel:false}):state.layout,panelCount:panelCount,docsOnly:story&&story.parameters&&story.parameters.docsOnly})));});});};function renderStorybookUI(domNode,provider){if(!(provider instanceof Provider)){throw new Error('provider is not extended from the base Provider');}require$$2.render(React$2.createElement(Root,{key:"root",provider:provider}),domNode);}export{Provider,Root,renderStorybookUI as default};