UNPKG

250 kBJavaScriptView Raw
1function _extends() {
2 _extends = Object.assign || function (target) {
3 for (var i = 1; i < arguments.length; i++) {
4 var source = arguments[i];
5
6 for (var key in source) {
7 if (Object.prototype.hasOwnProperty.call(source, key)) {
8 target[key] = source[key];
9 }
10 }
11 }
12
13 return target;
14 };
15
16 return _extends.apply(this, arguments);
17}
18
19function _objectWithoutPropertiesLoose(source, excluded) {
20 if (source == null) return {};
21 var target = {};
22 var sourceKeys = Object.keys(source);
23 var key, i;
24
25 for (i = 0; i < sourceKeys.length; i++) {
26 key = sourceKeys[i];
27 if (excluded.indexOf(key) >= 0) continue;
28 target[key] = source[key];
29 }
30
31 return target;
32}
33
34function getDefaultExportFromCjs (x) {
35 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
36}
37
38function createCommonjsModule(fn, basedir, module) {
39 return module = {
40 path: basedir,
41 exports: {},
42 require: function (path, base) {
43 return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
44 }
45 }, fn(module, module.exports), module.exports;
46}
47
48function getAugmentedNamespace(n) {
49 if (n.__esModule) return n;
50 var a = Object.defineProperty({}, '__esModule', {value: true});
51 Object.keys(n).forEach(function (k) {
52 var d = Object.getOwnPropertyDescriptor(n, k);
53 Object.defineProperty(a, k, d.get ? d : {
54 enumerable: true,
55 get: function () {
56 return n[k];
57 }
58 });
59 });
60 return a;
61}
62
63function commonjsRequire () {
64 throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
65}
66
67/*
68object-assign
69(c) Sindre Sorhus
70@license MIT
71*/
72/* eslint-disable no-unused-vars */
73var getOwnPropertySymbols = Object.getOwnPropertySymbols;
74var hasOwnProperty = Object.prototype.hasOwnProperty;
75var propIsEnumerable = Object.prototype.propertyIsEnumerable;
76
77function toObject(val) {
78 if (val === null || val === undefined) {
79 throw new TypeError('Object.assign cannot be called with null or undefined');
80 }
81
82 return Object(val);
83}
84
85function shouldUseNative() {
86 try {
87 if (!Object.assign) {
88 return false;
89 }
90
91 // Detect buggy property enumeration order in older V8 versions.
92
93 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
94 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
95 test1[5] = 'de';
96 if (Object.getOwnPropertyNames(test1)[0] === '5') {
97 return false;
98 }
99
100 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
101 var test2 = {};
102 for (var i = 0; i < 10; i++) {
103 test2['_' + String.fromCharCode(i)] = i;
104 }
105 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
106 return test2[n];
107 });
108 if (order2.join('') !== '0123456789') {
109 return false;
110 }
111
112 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
113 var test3 = {};
114 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
115 test3[letter] = letter;
116 });
117 if (Object.keys(Object.assign({}, test3)).join('') !==
118 'abcdefghijklmnopqrst') {
119 return false;
120 }
121
122 return true;
123 } catch (err) {
124 // We don't expect any of the above to throw, but better to be safe.
125 return false;
126 }
127}
128
129module.exports = shouldUseNative() ? Object.assign : function (target, source) {
130 var from;
131 var to = toObject(target);
132 var symbols;
133
134 for (var s = 1; s < arguments.length; s++) {
135 from = Object(arguments[s]);
136
137 for (var key in from) {
138 if (hasOwnProperty.call(from, key)) {
139 to[key] = from[key];
140 }
141 }
142
143 if (getOwnPropertySymbols) {
144 symbols = getOwnPropertySymbols(from);
145 for (var i = 0; i < symbols.length; i++) {
146 if (propIsEnumerable.call(from, symbols[i])) {
147 to[symbols[i]] = from[symbols[i]];
148 }
149 }
150 }
151 }
152
153 return to;
154};
155
156var objectAssign = /*#__PURE__*/Object.freeze({
157 __proto__: null
158});
159
160var assign = /*@__PURE__*/getAugmentedNamespace(objectAssign);
161
162function ca(a,b,d,c,e,g,h,f){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else {var l=[d,c,e,g,h,f],m=0;a=Error(b.replace(/%s/g,function(){return l[m++]}));a.name="Invariant Violation";}a.framesToPop=1;throw a;}}
163function B(a){for(var b=arguments.length-1,d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)d+="&args[]="+encodeURIComponent(arguments[c+1]);ca(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",d);}var C={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D={};
164function E(a,b,d){this.props=a;this.context=b;this.refs=D;this.updater=d||C;}E.prototype.isReactComponent={};E.prototype.setState=function(a,b){"object"!==typeof a&&"function"!==typeof a&&null!=a?B("85"):void 0;this.updater.enqueueSetState(this,a,b,"setState");};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};function F(){}F.prototype=E.prototype;function G(a,b,d){this.props=a;this.context=b;this.refs=D;this.updater=d||C;}var H=G.prototype=new F;
165H.constructor=G;assign(H,E.prototype);H.isPureReactComponent=!0;
166
167/**
168 * Copyright (c) 2013-present, Facebook, Inc.
169 *
170 * This source code is licensed under the MIT license found in the
171 * LICENSE file in the root directory of this source tree.
172 */
173
174var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
175
176var ReactPropTypesSecret_1 = ReactPropTypesSecret;
177
178var printWarning = function() {};
179
180{
181 var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
182 var loggedTypeFailures = {};
183
184 printWarning = function(text) {
185 var message = 'Warning: ' + text;
186 if (typeof console !== 'undefined') {
187 console.error(message);
188 }
189 try {
190 // --- Welcome to debugging React ---
191 // This error was thrown as a convenience so that you can use this stack
192 // to find the callsite that caused this warning to fire.
193 throw new Error(message);
194 } catch (x) {}
195 };
196}
197
198/**
199 * Assert that the values match with the type specs.
200 * Error messages are memorized and will only be shown once.
201 *
202 * @param {object} typeSpecs Map of name to a ReactPropType
203 * @param {object} values Runtime values that need to be type-checked
204 * @param {string} location e.g. "prop", "context", "child context"
205 * @param {string} componentName Name of the component for error messages.
206 * @param {?Function} getStack Returns the component stack.
207 * @private
208 */
209function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
210 {
211 for (var typeSpecName in typeSpecs) {
212 if (typeSpecs.hasOwnProperty(typeSpecName)) {
213 var error;
214 // Prop type validation may throw. In case they do, we don't want to
215 // fail the render phase where it didn't fail before. So we log it.
216 // After these have been cleaned up, we'll let them throw.
217 try {
218 // This is intentionally an invariant that gets caught. It's the same
219 // behavior as without this statement except with a better message.
220 if (typeof typeSpecs[typeSpecName] !== 'function') {
221 var err = Error(
222 (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
223 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
224 );
225 err.name = 'Invariant Violation';
226 throw err;
227 }
228 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
229 } catch (ex) {
230 error = ex;
231 }
232 if (error && !(error instanceof Error)) {
233 printWarning(
234 (componentName || 'React class') + ': type specification of ' +
235 location + ' `' + typeSpecName + '` is invalid; the type checker ' +
236 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
237 'You may have forgotten to pass an argument to the type checker ' +
238 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
239 'shape all require an argument).'
240 );
241
242 }
243 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
244 // Only monitor this failure once because there tends to be a lot of the
245 // same error.
246 loggedTypeFailures[error.message] = true;
247
248 var stack = getStack ? getStack() : '';
249
250 printWarning(
251 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
252 );
253 }
254 }
255 }
256 }
257}
258
259var checkPropTypes_1 = checkPropTypes;
260
261var react_development = createCommonjsModule(function (module) {
262
263
264
265{
266 (function() {
267
268var _assign = assign;
269var checkPropTypes = checkPropTypes_1;
270
271// TODO: this is special because it gets imported during build.
272
273var ReactVersion = '16.8.6';
274
275// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
276// nor polyfill, then a plain number is used for performance.
277var hasSymbol = typeof Symbol === 'function' && Symbol.for;
278
279var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
280var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
281var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
282var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
283var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
284var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
285var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
286
287var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
288var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
289var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
290var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
291var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
292
293var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
294var FAUX_ITERATOR_SYMBOL = '@@iterator';
295
296function getIteratorFn(maybeIterable) {
297 if (maybeIterable === null || typeof maybeIterable !== 'object') {
298 return null;
299 }
300 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
301 if (typeof maybeIterator === 'function') {
302 return maybeIterator;
303 }
304 return null;
305}
306
307/**
308 * Use invariant() to assert state which your program assumes to be true.
309 *
310 * Provide sprintf-style format (only %s is supported) and arguments
311 * to provide information about what broke and what you were
312 * expecting.
313 *
314 * The invariant message will be stripped in production, but the invariant
315 * will remain to ensure logic does not differ in production.
316 */
317
318var validateFormat = function () {};
319
320{
321 validateFormat = function (format) {
322 if (format === undefined) {
323 throw new Error('invariant requires an error message argument');
324 }
325 };
326}
327
328function invariant(condition, format, a, b, c, d, e, f) {
329 validateFormat(format);
330
331 if (!condition) {
332 var error = void 0;
333 if (format === undefined) {
334 error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
335 } else {
336 var args = [a, b, c, d, e, f];
337 var argIndex = 0;
338 error = new Error(format.replace(/%s/g, function () {
339 return args[argIndex++];
340 }));
341 error.name = 'Invariant Violation';
342 }
343
344 error.framesToPop = 1; // we don't care about invariant's own frame
345 throw error;
346 }
347}
348
349// Relying on the `invariant()` implementation lets us
350// preserve the format and params in the www builds.
351
352/**
353 * Forked from fbjs/warning:
354 * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
355 *
356 * Only change is we use console.warn instead of console.error,
357 * and do nothing when 'console' is not supported.
358 * This really simplifies the code.
359 * ---
360 * Similar to invariant but only logs a warning if the condition is not met.
361 * This can be used to log issues in development environments in critical
362 * paths. Removing the logging code for production environments will keep the
363 * same logic and follow the same code paths.
364 */
365
366var lowPriorityWarning = function () {};
367
368{
369 var printWarning = function (format) {
370 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
371 args[_key - 1] = arguments[_key];
372 }
373
374 var argIndex = 0;
375 var message = 'Warning: ' + format.replace(/%s/g, function () {
376 return args[argIndex++];
377 });
378 if (typeof console !== 'undefined') {
379 console.warn(message);
380 }
381 try {
382 // --- Welcome to debugging React ---
383 // This error was thrown as a convenience so that you can use this stack
384 // to find the callsite that caused this warning to fire.
385 throw new Error(message);
386 } catch (x) {}
387 };
388
389 lowPriorityWarning = function (condition, format) {
390 if (format === undefined) {
391 throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
392 }
393 if (!condition) {
394 for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
395 args[_key2 - 2] = arguments[_key2];
396 }
397
398 printWarning.apply(undefined, [format].concat(args));
399 }
400 };
401}
402
403var lowPriorityWarning$1 = lowPriorityWarning;
404
405/**
406 * Similar to invariant but only logs a warning if the condition is not met.
407 * This can be used to log issues in development environments in critical
408 * paths. Removing the logging code for production environments will keep the
409 * same logic and follow the same code paths.
410 */
411
412var warningWithoutStack = function () {};
413
414{
415 warningWithoutStack = function (condition, format) {
416 for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
417 args[_key - 2] = arguments[_key];
418 }
419
420 if (format === undefined) {
421 throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
422 }
423 if (args.length > 8) {
424 // Check before the condition to catch violations early.
425 throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
426 }
427 if (condition) {
428 return;
429 }
430 if (typeof console !== 'undefined') {
431 var argsWithFormat = args.map(function (item) {
432 return '' + item;
433 });
434 argsWithFormat.unshift('Warning: ' + format);
435
436 // We intentionally don't use spread (or .apply) directly because it
437 // breaks IE9: https://github.com/facebook/react/issues/13610
438 Function.prototype.apply.call(console.error, console, argsWithFormat);
439 }
440 try {
441 // --- Welcome to debugging React ---
442 // This error was thrown as a convenience so that you can use this stack
443 // to find the callsite that caused this warning to fire.
444 var argIndex = 0;
445 var message = 'Warning: ' + format.replace(/%s/g, function () {
446 return args[argIndex++];
447 });
448 throw new Error(message);
449 } catch (x) {}
450 };
451}
452
453var warningWithoutStack$1 = warningWithoutStack;
454
455var didWarnStateUpdateForUnmountedComponent = {};
456
457function warnNoop(publicInstance, callerName) {
458 {
459 var _constructor = publicInstance.constructor;
460 var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
461 var warningKey = componentName + '.' + callerName;
462 if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
463 return;
464 }
465 warningWithoutStack$1(false, "Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
466 didWarnStateUpdateForUnmountedComponent[warningKey] = true;
467 }
468}
469
470/**
471 * This is the abstract API for an update queue.
472 */
473var ReactNoopUpdateQueue = {
474 /**
475 * Checks whether or not this composite component is mounted.
476 * @param {ReactClass} publicInstance The instance we want to test.
477 * @return {boolean} True if mounted, false otherwise.
478 * @protected
479 * @final
480 */
481 isMounted: function (publicInstance) {
482 return false;
483 },
484
485 /**
486 * Forces an update. This should only be invoked when it is known with
487 * certainty that we are **not** in a DOM transaction.
488 *
489 * You may want to call this when you know that some deeper aspect of the
490 * component's state has changed but `setState` was not called.
491 *
492 * This will not invoke `shouldComponentUpdate`, but it will invoke
493 * `componentWillUpdate` and `componentDidUpdate`.
494 *
495 * @param {ReactClass} publicInstance The instance that should rerender.
496 * @param {?function} callback Called after component is updated.
497 * @param {?string} callerName name of the calling function in the public API.
498 * @internal
499 */
500 enqueueForceUpdate: function (publicInstance, callback, callerName) {
501 warnNoop(publicInstance, 'forceUpdate');
502 },
503
504 /**
505 * Replaces all of the state. Always use this or `setState` to mutate state.
506 * You should treat `this.state` as immutable.
507 *
508 * There is no guarantee that `this.state` will be immediately updated, so
509 * accessing `this.state` after calling this method may return the old value.
510 *
511 * @param {ReactClass} publicInstance The instance that should rerender.
512 * @param {object} completeState Next state.
513 * @param {?function} callback Called after component is updated.
514 * @param {?string} callerName name of the calling function in the public API.
515 * @internal
516 */
517 enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
518 warnNoop(publicInstance, 'replaceState');
519 },
520
521 /**
522 * Sets a subset of the state. This only exists because _pendingState is
523 * internal. This provides a merging strategy that is not available to deep
524 * properties which is confusing. TODO: Expose pendingState or don't use it
525 * during the merge.
526 *
527 * @param {ReactClass} publicInstance The instance that should rerender.
528 * @param {object} partialState Next partial state to be merged with state.
529 * @param {?function} callback Called after component is updated.
530 * @param {?string} Name of the calling function in the public API.
531 * @internal
532 */
533 enqueueSetState: function (publicInstance, partialState, callback, callerName) {
534 warnNoop(publicInstance, 'setState');
535 }
536};
537
538var emptyObject = {};
539{
540 Object.freeze(emptyObject);
541}
542
543/**
544 * Base class helpers for the updating state of a component.
545 */
546function Component(props, context, updater) {
547 this.props = props;
548 this.context = context;
549 // If a component has string refs, we will assign a different object later.
550 this.refs = emptyObject;
551 // We initialize the default updater but the real one gets injected by the
552 // renderer.
553 this.updater = updater || ReactNoopUpdateQueue;
554}
555
556Component.prototype.isReactComponent = {};
557
558/**
559 * Sets a subset of the state. Always use this to mutate
560 * state. You should treat `this.state` as immutable.
561 *
562 * There is no guarantee that `this.state` will be immediately updated, so
563 * accessing `this.state` after calling this method may return the old value.
564 *
565 * There is no guarantee that calls to `setState` will run synchronously,
566 * as they may eventually be batched together. You can provide an optional
567 * callback that will be executed when the call to setState is actually
568 * completed.
569 *
570 * When a function is provided to setState, it will be called at some point in
571 * the future (not synchronously). It will be called with the up to date
572 * component arguments (state, props, context). These values can be different
573 * from this.* because your function may be called after receiveProps but before
574 * shouldComponentUpdate, and this new state, props, and context will not yet be
575 * assigned to this.
576 *
577 * @param {object|function} partialState Next partial state or function to
578 * produce next partial state to be merged with current state.
579 * @param {?function} callback Called after state is updated.
580 * @final
581 * @protected
582 */
583Component.prototype.setState = function (partialState, callback) {
584 !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
585 this.updater.enqueueSetState(this, partialState, callback, 'setState');
586};
587
588/**
589 * Forces an update. This should only be invoked when it is known with
590 * certainty that we are **not** in a DOM transaction.
591 *
592 * You may want to call this when you know that some deeper aspect of the
593 * component's state has changed but `setState` was not called.
594 *
595 * This will not invoke `shouldComponentUpdate`, but it will invoke
596 * `componentWillUpdate` and `componentDidUpdate`.
597 *
598 * @param {?function} callback Called after update is complete.
599 * @final
600 * @protected
601 */
602Component.prototype.forceUpdate = function (callback) {
603 this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
604};
605
606/**
607 * Deprecated APIs. These APIs used to exist on classic React classes but since
608 * we would like to deprecate them, we're not going to move them over to this
609 * modern base class. Instead, we define a getter that warns if it's accessed.
610 */
611{
612 var deprecatedAPIs = {
613 isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
614 replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
615 };
616 var defineDeprecationWarning = function (methodName, info) {
617 Object.defineProperty(Component.prototype, methodName, {
618 get: function () {
619 lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
620 return undefined;
621 }
622 });
623 };
624 for (var fnName in deprecatedAPIs) {
625 if (deprecatedAPIs.hasOwnProperty(fnName)) {
626 defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
627 }
628 }
629}
630
631function ComponentDummy() {}
632ComponentDummy.prototype = Component.prototype;
633
634/**
635 * Convenience component with default shallow equality check for sCU.
636 */
637function PureComponent(props, context, updater) {
638 this.props = props;
639 this.context = context;
640 // If a component has string refs, we will assign a different object later.
641 this.refs = emptyObject;
642 this.updater = updater || ReactNoopUpdateQueue;
643}
644
645var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
646pureComponentPrototype.constructor = PureComponent;
647// Avoid an extra prototype jump for these methods.
648_assign(pureComponentPrototype, Component.prototype);
649pureComponentPrototype.isPureReactComponent = true;
650
651// an immutable object with a single mutable value
652function createRef() {
653 var refObject = {
654 current: null
655 };
656 {
657 Object.seal(refObject);
658 }
659 return refObject;
660}
661
662/**
663 * Keeps track of the current dispatcher.
664 */
665var ReactCurrentDispatcher = {
666 /**
667 * @internal
668 * @type {ReactComponent}
669 */
670 current: null
671};
672
673/**
674 * Keeps track of the current owner.
675 *
676 * The current owner is the component who should own any components that are
677 * currently being constructed.
678 */
679var ReactCurrentOwner = {
680 /**
681 * @internal
682 * @type {ReactComponent}
683 */
684 current: null
685};
686
687var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
688
689var describeComponentFrame = function (name, source, ownerName) {
690 var sourceInfo = '';
691 if (source) {
692 var path = source.fileName;
693 var fileName = path.replace(BEFORE_SLASH_RE, '');
694 {
695 // In DEV, include code for a common special case:
696 // prefer "folder/index.js" instead of just "index.js".
697 if (/^index\./.test(fileName)) {
698 var match = path.match(BEFORE_SLASH_RE);
699 if (match) {
700 var pathBeforeSlash = match[1];
701 if (pathBeforeSlash) {
702 var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
703 fileName = folderName + '/' + fileName;
704 }
705 }
706 }
707 }
708 sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
709 } else if (ownerName) {
710 sourceInfo = ' (created by ' + ownerName + ')';
711 }
712 return '\n in ' + (name || 'Unknown') + sourceInfo;
713};
714
715var Resolved = 1;
716
717
718function refineResolvedLazyComponent(lazyComponent) {
719 return lazyComponent._status === Resolved ? lazyComponent._result : null;
720}
721
722function getWrappedName(outerType, innerType, wrapperName) {
723 var functionName = innerType.displayName || innerType.name || '';
724 return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
725}
726
727function getComponentName(type) {
728 if (type == null) {
729 // Host root, text node or just invalid type.
730 return null;
731 }
732 {
733 if (typeof type.tag === 'number') {
734 warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
735 }
736 }
737 if (typeof type === 'function') {
738 return type.displayName || type.name || null;
739 }
740 if (typeof type === 'string') {
741 return type;
742 }
743 switch (type) {
744 case REACT_CONCURRENT_MODE_TYPE:
745 return 'ConcurrentMode';
746 case REACT_FRAGMENT_TYPE:
747 return 'Fragment';
748 case REACT_PORTAL_TYPE:
749 return 'Portal';
750 case REACT_PROFILER_TYPE:
751 return 'Profiler';
752 case REACT_STRICT_MODE_TYPE:
753 return 'StrictMode';
754 case REACT_SUSPENSE_TYPE:
755 return 'Suspense';
756 }
757 if (typeof type === 'object') {
758 switch (type.$$typeof) {
759 case REACT_CONTEXT_TYPE:
760 return 'Context.Consumer';
761 case REACT_PROVIDER_TYPE:
762 return 'Context.Provider';
763 case REACT_FORWARD_REF_TYPE:
764 return getWrappedName(type, type.render, 'ForwardRef');
765 case REACT_MEMO_TYPE:
766 return getComponentName(type.type);
767 case REACT_LAZY_TYPE:
768 {
769 var thenable = type;
770 var resolvedThenable = refineResolvedLazyComponent(thenable);
771 if (resolvedThenable) {
772 return getComponentName(resolvedThenable);
773 }
774 }
775 }
776 }
777 return null;
778}
779
780var ReactDebugCurrentFrame = {};
781
782var currentlyValidatingElement = null;
783
784function setCurrentlyValidatingElement(element) {
785 {
786 currentlyValidatingElement = element;
787 }
788}
789
790{
791 // Stack implementation injected by the current renderer.
792 ReactDebugCurrentFrame.getCurrentStack = null;
793
794 ReactDebugCurrentFrame.getStackAddendum = function () {
795 var stack = '';
796
797 // Add an extra top frame while an element is being validated
798 if (currentlyValidatingElement) {
799 var name = getComponentName(currentlyValidatingElement.type);
800 var owner = currentlyValidatingElement._owner;
801 stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
802 }
803
804 // Delegate to the injected renderer-specific implementation
805 var impl = ReactDebugCurrentFrame.getCurrentStack;
806 if (impl) {
807 stack += impl() || '';
808 }
809
810 return stack;
811 };
812}
813
814var ReactSharedInternals = {
815 ReactCurrentDispatcher: ReactCurrentDispatcher,
816 ReactCurrentOwner: ReactCurrentOwner,
817 // Used by renderers to avoid bundling object-assign twice in UMD bundles:
818 assign: _assign
819};
820
821{
822 _assign(ReactSharedInternals, {
823 // These should not be included in production.
824 ReactDebugCurrentFrame: ReactDebugCurrentFrame,
825 // Shim for React DOM 16.0.0 which still destructured (but not used) this.
826 // TODO: remove in React 17.0.
827 ReactComponentTreeHook: {}
828 });
829}
830
831/**
832 * Similar to invariant but only logs a warning if the condition is not met.
833 * This can be used to log issues in development environments in critical
834 * paths. Removing the logging code for production environments will keep the
835 * same logic and follow the same code paths.
836 */
837
838var warning = warningWithoutStack$1;
839
840{
841 warning = function (condition, format) {
842 if (condition) {
843 return;
844 }
845 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
846 var stack = ReactDebugCurrentFrame.getStackAddendum();
847 // eslint-disable-next-line react-internal/warning-and-invariant-args
848
849 for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
850 args[_key - 2] = arguments[_key];
851 }
852
853 warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
854 };
855}
856
857var warning$1 = warning;
858
859var hasOwnProperty = Object.prototype.hasOwnProperty;
860
861var RESERVED_PROPS = {
862 key: true,
863 ref: true,
864 __self: true,
865 __source: true
866};
867
868var specialPropKeyWarningShown = void 0;
869var specialPropRefWarningShown = void 0;
870
871function hasValidRef(config) {
872 {
873 if (hasOwnProperty.call(config, 'ref')) {
874 var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
875 if (getter && getter.isReactWarning) {
876 return false;
877 }
878 }
879 }
880 return config.ref !== undefined;
881}
882
883function hasValidKey(config) {
884 {
885 if (hasOwnProperty.call(config, 'key')) {
886 var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
887 if (getter && getter.isReactWarning) {
888 return false;
889 }
890 }
891 }
892 return config.key !== undefined;
893}
894
895function defineKeyPropWarningGetter(props, displayName) {
896 var warnAboutAccessingKey = function () {
897 if (!specialPropKeyWarningShown) {
898 specialPropKeyWarningShown = true;
899 warningWithoutStack$1(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
900 }
901 };
902 warnAboutAccessingKey.isReactWarning = true;
903 Object.defineProperty(props, 'key', {
904 get: warnAboutAccessingKey,
905 configurable: true
906 });
907}
908
909function defineRefPropWarningGetter(props, displayName) {
910 var warnAboutAccessingRef = function () {
911 if (!specialPropRefWarningShown) {
912 specialPropRefWarningShown = true;
913 warningWithoutStack$1(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
914 }
915 };
916 warnAboutAccessingRef.isReactWarning = true;
917 Object.defineProperty(props, 'ref', {
918 get: warnAboutAccessingRef,
919 configurable: true
920 });
921}
922
923/**
924 * Factory method to create a new React element. This no longer adheres to
925 * the class pattern, so do not use new to call it. Also, no instanceof check
926 * will work. Instead test $$typeof field against Symbol.for('react.element') to check
927 * if something is a React Element.
928 *
929 * @param {*} type
930 * @param {*} key
931 * @param {string|object} ref
932 * @param {*} self A *temporary* helper to detect places where `this` is
933 * different from the `owner` when React.createElement is called, so that we
934 * can warn. We want to get rid of owner and replace string `ref`s with arrow
935 * functions, and as long as `this` and owner are the same, there will be no
936 * change in behavior.
937 * @param {*} source An annotation object (added by a transpiler or otherwise)
938 * indicating filename, line number, and/or other information.
939 * @param {*} owner
940 * @param {*} props
941 * @internal
942 */
943var ReactElement = function (type, key, ref, self, source, owner, props) {
944 var element = {
945 // This tag allows us to uniquely identify this as a React Element
946 $$typeof: REACT_ELEMENT_TYPE,
947
948 // Built-in properties that belong on the element
949 type: type,
950 key: key,
951 ref: ref,
952 props: props,
953
954 // Record the component responsible for creating this element.
955 _owner: owner
956 };
957
958 {
959 // The validation flag is currently mutative. We put it on
960 // an external backing store so that we can freeze the whole object.
961 // This can be replaced with a WeakMap once they are implemented in
962 // commonly used development environments.
963 element._store = {};
964
965 // To make comparing ReactElements easier for testing purposes, we make
966 // the validation flag non-enumerable (where possible, which should
967 // include every environment we run tests in), so the test framework
968 // ignores it.
969 Object.defineProperty(element._store, 'validated', {
970 configurable: false,
971 enumerable: false,
972 writable: true,
973 value: false
974 });
975 // self and source are DEV only properties.
976 Object.defineProperty(element, '_self', {
977 configurable: false,
978 enumerable: false,
979 writable: false,
980 value: self
981 });
982 // Two elements created in two different places should be considered
983 // equal for testing purposes and therefore we hide it from enumeration.
984 Object.defineProperty(element, '_source', {
985 configurable: false,
986 enumerable: false,
987 writable: false,
988 value: source
989 });
990 if (Object.freeze) {
991 Object.freeze(element.props);
992 Object.freeze(element);
993 }
994 }
995
996 return element;
997};
998
999/**
1000 * Create and return a new ReactElement of the given type.
1001 * See https://reactjs.org/docs/react-api.html#createelement
1002 */
1003function createElement(type, config, children) {
1004 var propName = void 0;
1005
1006 // Reserved names are extracted
1007 var props = {};
1008
1009 var key = null;
1010 var ref = null;
1011 var self = null;
1012 var source = null;
1013
1014 if (config != null) {
1015 if (hasValidRef(config)) {
1016 ref = config.ref;
1017 }
1018 if (hasValidKey(config)) {
1019 key = '' + config.key;
1020 }
1021
1022 self = config.__self === undefined ? null : config.__self;
1023 source = config.__source === undefined ? null : config.__source;
1024 // Remaining properties are added to a new props object
1025 for (propName in config) {
1026 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1027 props[propName] = config[propName];
1028 }
1029 }
1030 }
1031
1032 // Children can be more than one argument, and those are transferred onto
1033 // the newly allocated props object.
1034 var childrenLength = arguments.length - 2;
1035 if (childrenLength === 1) {
1036 props.children = children;
1037 } else if (childrenLength > 1) {
1038 var childArray = Array(childrenLength);
1039 for (var i = 0; i < childrenLength; i++) {
1040 childArray[i] = arguments[i + 2];
1041 }
1042 {
1043 if (Object.freeze) {
1044 Object.freeze(childArray);
1045 }
1046 }
1047 props.children = childArray;
1048 }
1049
1050 // Resolve default props
1051 if (type && type.defaultProps) {
1052 var defaultProps = type.defaultProps;
1053 for (propName in defaultProps) {
1054 if (props[propName] === undefined) {
1055 props[propName] = defaultProps[propName];
1056 }
1057 }
1058 }
1059 {
1060 if (key || ref) {
1061 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1062 if (key) {
1063 defineKeyPropWarningGetter(props, displayName);
1064 }
1065 if (ref) {
1066 defineRefPropWarningGetter(props, displayName);
1067 }
1068 }
1069 }
1070 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1071}
1072
1073/**
1074 * Return a function that produces ReactElements of a given type.
1075 * See https://reactjs.org/docs/react-api.html#createfactory
1076 */
1077
1078
1079function cloneAndReplaceKey(oldElement, newKey) {
1080 var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
1081
1082 return newElement;
1083}
1084
1085/**
1086 * Clone and return a new ReactElement using element as the starting point.
1087 * See https://reactjs.org/docs/react-api.html#cloneelement
1088 */
1089function cloneElement(element, config, children) {
1090 !!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
1091
1092 var propName = void 0;
1093
1094 // Original props are copied
1095 var props = _assign({}, element.props);
1096
1097 // Reserved names are extracted
1098 var key = element.key;
1099 var ref = element.ref;
1100 // Self is preserved since the owner is preserved.
1101 var self = element._self;
1102 // Source is preserved since cloneElement is unlikely to be targeted by a
1103 // transpiler, and the original source is probably a better indicator of the
1104 // true owner.
1105 var source = element._source;
1106
1107 // Owner will be preserved, unless ref is overridden
1108 var owner = element._owner;
1109
1110 if (config != null) {
1111 if (hasValidRef(config)) {
1112 // Silently steal the ref from the parent.
1113 ref = config.ref;
1114 owner = ReactCurrentOwner.current;
1115 }
1116 if (hasValidKey(config)) {
1117 key = '' + config.key;
1118 }
1119
1120 // Remaining properties override existing props
1121 var defaultProps = void 0;
1122 if (element.type && element.type.defaultProps) {
1123 defaultProps = element.type.defaultProps;
1124 }
1125 for (propName in config) {
1126 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1127 if (config[propName] === undefined && defaultProps !== undefined) {
1128 // Resolve default props
1129 props[propName] = defaultProps[propName];
1130 } else {
1131 props[propName] = config[propName];
1132 }
1133 }
1134 }
1135 }
1136
1137 // Children can be more than one argument, and those are transferred onto
1138 // the newly allocated props object.
1139 var childrenLength = arguments.length - 2;
1140 if (childrenLength === 1) {
1141 props.children = children;
1142 } else if (childrenLength > 1) {
1143 var childArray = Array(childrenLength);
1144 for (var i = 0; i < childrenLength; i++) {
1145 childArray[i] = arguments[i + 2];
1146 }
1147 props.children = childArray;
1148 }
1149
1150 return ReactElement(element.type, key, ref, self, source, owner, props);
1151}
1152
1153/**
1154 * Verifies the object is a ReactElement.
1155 * See https://reactjs.org/docs/react-api.html#isvalidelement
1156 * @param {?object} object
1157 * @return {boolean} True if `object` is a ReactElement.
1158 * @final
1159 */
1160function isValidElement(object) {
1161 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1162}
1163
1164var SEPARATOR = '.';
1165var SUBSEPARATOR = ':';
1166
1167/**
1168 * Escape and wrap key so it is safe to use as a reactid
1169 *
1170 * @param {string} key to be escaped.
1171 * @return {string} the escaped key.
1172 */
1173function escape(key) {
1174 var escapeRegex = /[=:]/g;
1175 var escaperLookup = {
1176 '=': '=0',
1177 ':': '=2'
1178 };
1179 var escapedString = ('' + key).replace(escapeRegex, function (match) {
1180 return escaperLookup[match];
1181 });
1182
1183 return '$' + escapedString;
1184}
1185
1186/**
1187 * TODO: Test that a single child and an array with one item have the same key
1188 * pattern.
1189 */
1190
1191var didWarnAboutMaps = false;
1192
1193var userProvidedKeyEscapeRegex = /\/+/g;
1194function escapeUserProvidedKey(text) {
1195 return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
1196}
1197
1198var POOL_SIZE = 10;
1199var traverseContextPool = [];
1200function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
1201 if (traverseContextPool.length) {
1202 var traverseContext = traverseContextPool.pop();
1203 traverseContext.result = mapResult;
1204 traverseContext.keyPrefix = keyPrefix;
1205 traverseContext.func = mapFunction;
1206 traverseContext.context = mapContext;
1207 traverseContext.count = 0;
1208 return traverseContext;
1209 } else {
1210 return {
1211 result: mapResult,
1212 keyPrefix: keyPrefix,
1213 func: mapFunction,
1214 context: mapContext,
1215 count: 0
1216 };
1217 }
1218}
1219
1220function releaseTraverseContext(traverseContext) {
1221 traverseContext.result = null;
1222 traverseContext.keyPrefix = null;
1223 traverseContext.func = null;
1224 traverseContext.context = null;
1225 traverseContext.count = 0;
1226 if (traverseContextPool.length < POOL_SIZE) {
1227 traverseContextPool.push(traverseContext);
1228 }
1229}
1230
1231/**
1232 * @param {?*} children Children tree container.
1233 * @param {!string} nameSoFar Name of the key path so far.
1234 * @param {!function} callback Callback to invoke with each child found.
1235 * @param {?*} traverseContext Used to pass information throughout the traversal
1236 * process.
1237 * @return {!number} The number of children in this subtree.
1238 */
1239function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
1240 var type = typeof children;
1241
1242 if (type === 'undefined' || type === 'boolean') {
1243 // All of the above are perceived as null.
1244 children = null;
1245 }
1246
1247 var invokeCallback = false;
1248
1249 if (children === null) {
1250 invokeCallback = true;
1251 } else {
1252 switch (type) {
1253 case 'string':
1254 case 'number':
1255 invokeCallback = true;
1256 break;
1257 case 'object':
1258 switch (children.$$typeof) {
1259 case REACT_ELEMENT_TYPE:
1260 case REACT_PORTAL_TYPE:
1261 invokeCallback = true;
1262 }
1263 }
1264 }
1265
1266 if (invokeCallback) {
1267 callback(traverseContext, children,
1268 // If it's the only child, treat the name as if it was wrapped in an array
1269 // so that it's consistent if the number of children grows.
1270 nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
1271 return 1;
1272 }
1273
1274 var child = void 0;
1275 var nextName = void 0;
1276 var subtreeCount = 0; // Count of children found in the current subtree.
1277 var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1278
1279 if (Array.isArray(children)) {
1280 for (var i = 0; i < children.length; i++) {
1281 child = children[i];
1282 nextName = nextNamePrefix + getComponentKey(child, i);
1283 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
1284 }
1285 } else {
1286 var iteratorFn = getIteratorFn(children);
1287 if (typeof iteratorFn === 'function') {
1288 {
1289 // Warn about using Maps as children
1290 if (iteratorFn === children.entries) {
1291 !didWarnAboutMaps ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
1292 didWarnAboutMaps = true;
1293 }
1294 }
1295
1296 var iterator = iteratorFn.call(children);
1297 var step = void 0;
1298 var ii = 0;
1299 while (!(step = iterator.next()).done) {
1300 child = step.value;
1301 nextName = nextNamePrefix + getComponentKey(child, ii++);
1302 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
1303 }
1304 } else if (type === 'object') {
1305 var addendum = '';
1306 {
1307 addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
1308 }
1309 var childrenString = '' + children;
1310 invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
1311 }
1312 }
1313
1314 return subtreeCount;
1315}
1316
1317/**
1318 * Traverses children that are typically specified as `props.children`, but
1319 * might also be specified through attributes:
1320 *
1321 * - `traverseAllChildren(this.props.children, ...)`
1322 * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
1323 *
1324 * The `traverseContext` is an optional argument that is passed through the
1325 * entire traversal. It can be used to store accumulations or anything else that
1326 * the callback might find relevant.
1327 *
1328 * @param {?*} children Children tree object.
1329 * @param {!function} callback To invoke upon traversing each child.
1330 * @param {?*} traverseContext Context for traversal.
1331 * @return {!number} The number of children in this subtree.
1332 */
1333function traverseAllChildren(children, callback, traverseContext) {
1334 if (children == null) {
1335 return 0;
1336 }
1337
1338 return traverseAllChildrenImpl(children, '', callback, traverseContext);
1339}
1340
1341/**
1342 * Generate a key string that identifies a component within a set.
1343 *
1344 * @param {*} component A component that could contain a manual key.
1345 * @param {number} index Index that is used if a manual key is not provided.
1346 * @return {string}
1347 */
1348function getComponentKey(component, index) {
1349 // Do some typechecking here since we call this blindly. We want to ensure
1350 // that we don't block potential future ES APIs.
1351 if (typeof component === 'object' && component !== null && component.key != null) {
1352 // Explicit key
1353 return escape(component.key);
1354 }
1355 // Implicit key determined by the index in the set
1356 return index.toString(36);
1357}
1358
1359function forEachSingleChild(bookKeeping, child, name) {
1360 var func = bookKeeping.func,
1361 context = bookKeeping.context;
1362
1363 func.call(context, child, bookKeeping.count++);
1364}
1365
1366/**
1367 * Iterates through children that are typically specified as `props.children`.
1368 *
1369 * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1370 *
1371 * The provided forEachFunc(child, index) will be called for each
1372 * leaf child.
1373 *
1374 * @param {?*} children Children tree container.
1375 * @param {function(*, int)} forEachFunc
1376 * @param {*} forEachContext Context for forEachContext.
1377 */
1378function forEachChildren(children, forEachFunc, forEachContext) {
1379 if (children == null) {
1380 return children;
1381 }
1382 var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
1383 traverseAllChildren(children, forEachSingleChild, traverseContext);
1384 releaseTraverseContext(traverseContext);
1385}
1386
1387function mapSingleChildIntoContext(bookKeeping, child, childKey) {
1388 var result = bookKeeping.result,
1389 keyPrefix = bookKeeping.keyPrefix,
1390 func = bookKeeping.func,
1391 context = bookKeeping.context;
1392
1393
1394 var mappedChild = func.call(context, child, bookKeeping.count++);
1395 if (Array.isArray(mappedChild)) {
1396 mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
1397 return c;
1398 });
1399 } else if (mappedChild != null) {
1400 if (isValidElement(mappedChild)) {
1401 mappedChild = cloneAndReplaceKey(mappedChild,
1402 // Keep both the (mapped) and old keys if they differ, just as
1403 // traverseAllChildren used to do for objects as children
1404 keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
1405 }
1406 result.push(mappedChild);
1407 }
1408}
1409
1410function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
1411 var escapedPrefix = '';
1412 if (prefix != null) {
1413 escapedPrefix = escapeUserProvidedKey(prefix) + '/';
1414 }
1415 var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
1416 traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
1417 releaseTraverseContext(traverseContext);
1418}
1419
1420/**
1421 * Maps children that are typically specified as `props.children`.
1422 *
1423 * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1424 *
1425 * The provided mapFunction(child, key, index) will be called for each
1426 * leaf child.
1427 *
1428 * @param {?*} children Children tree container.
1429 * @param {function(*, int)} func The map function.
1430 * @param {*} context Context for mapFunction.
1431 * @return {object} Object containing the ordered map of results.
1432 */
1433function mapChildren(children, func, context) {
1434 if (children == null) {
1435 return children;
1436 }
1437 var result = [];
1438 mapIntoWithKeyPrefixInternal(children, result, null, func, context);
1439 return result;
1440}
1441
1442/**
1443 * Count the number of children that are typically specified as
1444 * `props.children`.
1445 *
1446 * See https://reactjs.org/docs/react-api.html#reactchildrencount
1447 *
1448 * @param {?*} children Children tree container.
1449 * @return {number} The number of children.
1450 */
1451function countChildren(children) {
1452 return traverseAllChildren(children, function () {
1453 return null;
1454 }, null);
1455}
1456
1457/**
1458 * Flatten a children object (typically specified as `props.children`) and
1459 * return an array with appropriately re-keyed children.
1460 *
1461 * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1462 */
1463function toArray(children) {
1464 var result = [];
1465 mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
1466 return child;
1467 });
1468 return result;
1469}
1470
1471/**
1472 * Returns the first child in a collection of children and verifies that there
1473 * is only one child in the collection.
1474 *
1475 * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1476 *
1477 * The current implementation of this function assumes that a single child gets
1478 * passed without a wrapper, but the purpose of this helper function is to
1479 * abstract away the particular structure of children.
1480 *
1481 * @param {?object} children Child collection structure.
1482 * @return {ReactElement} The first and only `ReactElement` contained in the
1483 * structure.
1484 */
1485function onlyChild(children) {
1486 !isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
1487 return children;
1488}
1489
1490function createContext(defaultValue, calculateChangedBits) {
1491 if (calculateChangedBits === undefined) {
1492 calculateChangedBits = null;
1493 } else {
1494 {
1495 !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
1496 }
1497 }
1498
1499 var context = {
1500 $$typeof: REACT_CONTEXT_TYPE,
1501 _calculateChangedBits: calculateChangedBits,
1502 // As a workaround to support multiple concurrent renderers, we categorize
1503 // some renderers as primary and others as secondary. We only expect
1504 // there to be two concurrent renderers at most: React Native (primary) and
1505 // Fabric (secondary); React DOM (primary) and React ART (secondary).
1506 // Secondary renderers store their context values on separate fields.
1507 _currentValue: defaultValue,
1508 _currentValue2: defaultValue,
1509 // Used to track how many concurrent renderers this context currently
1510 // supports within in a single renderer. Such as parallel server rendering.
1511 _threadCount: 0,
1512 // These are circular
1513 Provider: null,
1514 Consumer: null
1515 };
1516
1517 context.Provider = {
1518 $$typeof: REACT_PROVIDER_TYPE,
1519 _context: context
1520 };
1521
1522 var hasWarnedAboutUsingNestedContextConsumers = false;
1523 var hasWarnedAboutUsingConsumerProvider = false;
1524
1525 {
1526 // A separate object, but proxies back to the original context object for
1527 // backwards compatibility. It has a different $$typeof, so we can properly
1528 // warn for the incorrect usage of Context as a Consumer.
1529 var Consumer = {
1530 $$typeof: REACT_CONTEXT_TYPE,
1531 _context: context,
1532 _calculateChangedBits: context._calculateChangedBits
1533 };
1534 // $FlowFixMe: Flow complains about not setting a value, which is intentional here
1535 Object.defineProperties(Consumer, {
1536 Provider: {
1537 get: function () {
1538 if (!hasWarnedAboutUsingConsumerProvider) {
1539 hasWarnedAboutUsingConsumerProvider = true;
1540 warning$1(false, 'Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
1541 }
1542 return context.Provider;
1543 },
1544 set: function (_Provider) {
1545 context.Provider = _Provider;
1546 }
1547 },
1548 _currentValue: {
1549 get: function () {
1550 return context._currentValue;
1551 },
1552 set: function (_currentValue) {
1553 context._currentValue = _currentValue;
1554 }
1555 },
1556 _currentValue2: {
1557 get: function () {
1558 return context._currentValue2;
1559 },
1560 set: function (_currentValue2) {
1561 context._currentValue2 = _currentValue2;
1562 }
1563 },
1564 _threadCount: {
1565 get: function () {
1566 return context._threadCount;
1567 },
1568 set: function (_threadCount) {
1569 context._threadCount = _threadCount;
1570 }
1571 },
1572 Consumer: {
1573 get: function () {
1574 if (!hasWarnedAboutUsingNestedContextConsumers) {
1575 hasWarnedAboutUsingNestedContextConsumers = true;
1576 warning$1(false, 'Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
1577 }
1578 return context.Consumer;
1579 }
1580 }
1581 });
1582 // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1583 context.Consumer = Consumer;
1584 }
1585
1586 {
1587 context._currentRenderer = null;
1588 context._currentRenderer2 = null;
1589 }
1590
1591 return context;
1592}
1593
1594function lazy(ctor) {
1595 var lazyType = {
1596 $$typeof: REACT_LAZY_TYPE,
1597 _ctor: ctor,
1598 // React uses these fields to store the result.
1599 _status: -1,
1600 _result: null
1601 };
1602
1603 {
1604 // In production, this would just set it on the object.
1605 var defaultProps = void 0;
1606 var propTypes = void 0;
1607 Object.defineProperties(lazyType, {
1608 defaultProps: {
1609 configurable: true,
1610 get: function () {
1611 return defaultProps;
1612 },
1613 set: function (newDefaultProps) {
1614 warning$1(false, 'React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1615 defaultProps = newDefaultProps;
1616 // Match production behavior more closely:
1617 Object.defineProperty(lazyType, 'defaultProps', {
1618 enumerable: true
1619 });
1620 }
1621 },
1622 propTypes: {
1623 configurable: true,
1624 get: function () {
1625 return propTypes;
1626 },
1627 set: function (newPropTypes) {
1628 warning$1(false, 'React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1629 propTypes = newPropTypes;
1630 // Match production behavior more closely:
1631 Object.defineProperty(lazyType, 'propTypes', {
1632 enumerable: true
1633 });
1634 }
1635 }
1636 });
1637 }
1638
1639 return lazyType;
1640}
1641
1642function forwardRef(render) {
1643 {
1644 if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1645 warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1646 } else if (typeof render !== 'function') {
1647 warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1648 } else {
1649 !(
1650 // Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
1651 render.length === 0 || render.length === 2) ? warningWithoutStack$1(false, 'forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.') : void 0;
1652 }
1653
1654 if (render != null) {
1655 !(render.defaultProps == null && render.propTypes == null) ? warningWithoutStack$1(false, 'forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?') : void 0;
1656 }
1657 }
1658
1659 return {
1660 $$typeof: REACT_FORWARD_REF_TYPE,
1661 render: render
1662 };
1663}
1664
1665function isValidElementType(type) {
1666 return typeof type === 'string' || typeof type === 'function' ||
1667 // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1668 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof 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);
1669}
1670
1671function memo(type, compare) {
1672 {
1673 if (!isValidElementType(type)) {
1674 warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
1675 }
1676 }
1677 return {
1678 $$typeof: REACT_MEMO_TYPE,
1679 type: type,
1680 compare: compare === undefined ? null : compare
1681 };
1682}
1683
1684function resolveDispatcher() {
1685 var dispatcher = ReactCurrentDispatcher.current;
1686 !(dispatcher !== null) ? invariant(false, 'Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.') : void 0;
1687 return dispatcher;
1688}
1689
1690function useContext(Context, unstable_observedBits) {
1691 var dispatcher = resolveDispatcher();
1692 {
1693 !(unstable_observedBits === undefined) ? warning$1(false, 'useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '') : void 0;
1694
1695 // TODO: add a more generic warning for invalid values.
1696 if (Context._context !== undefined) {
1697 var realContext = Context._context;
1698 // Don't deduplicate because this legitimately causes bugs
1699 // and nobody should be using this in existing code.
1700 if (realContext.Consumer === Context) {
1701 warning$1(false, 'Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
1702 } else if (realContext.Provider === Context) {
1703 warning$1(false, 'Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
1704 }
1705 }
1706 }
1707 return dispatcher.useContext(Context, unstable_observedBits);
1708}
1709
1710function useState(initialState) {
1711 var dispatcher = resolveDispatcher();
1712 return dispatcher.useState(initialState);
1713}
1714
1715function useReducer(reducer, initialArg, init) {
1716 var dispatcher = resolveDispatcher();
1717 return dispatcher.useReducer(reducer, initialArg, init);
1718}
1719
1720function useRef(initialValue) {
1721 var dispatcher = resolveDispatcher();
1722 return dispatcher.useRef(initialValue);
1723}
1724
1725function useEffect(create, inputs) {
1726 var dispatcher = resolveDispatcher();
1727 return dispatcher.useEffect(create, inputs);
1728}
1729
1730function useLayoutEffect(create, inputs) {
1731 var dispatcher = resolveDispatcher();
1732 return dispatcher.useLayoutEffect(create, inputs);
1733}
1734
1735function useCallback(callback, inputs) {
1736 var dispatcher = resolveDispatcher();
1737 return dispatcher.useCallback(callback, inputs);
1738}
1739
1740function useMemo(create, inputs) {
1741 var dispatcher = resolveDispatcher();
1742 return dispatcher.useMemo(create, inputs);
1743}
1744
1745function useImperativeHandle(ref, create, inputs) {
1746 var dispatcher = resolveDispatcher();
1747 return dispatcher.useImperativeHandle(ref, create, inputs);
1748}
1749
1750function useDebugValue(value, formatterFn) {
1751 {
1752 var dispatcher = resolveDispatcher();
1753 return dispatcher.useDebugValue(value, formatterFn);
1754 }
1755}
1756
1757/**
1758 * ReactElementValidator provides a wrapper around a element factory
1759 * which validates the props passed to the element. This is intended to be
1760 * used only in DEV and could be replaced by a static type checker for languages
1761 * that support it.
1762 */
1763
1764var propTypesMisspellWarningShown = void 0;
1765
1766{
1767 propTypesMisspellWarningShown = false;
1768}
1769
1770function getDeclarationErrorAddendum() {
1771 if (ReactCurrentOwner.current) {
1772 var name = getComponentName(ReactCurrentOwner.current.type);
1773 if (name) {
1774 return '\n\nCheck the render method of `' + name + '`.';
1775 }
1776 }
1777 return '';
1778}
1779
1780function getSourceInfoErrorAddendum(elementProps) {
1781 if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
1782 var source = elementProps.__source;
1783 var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1784 var lineNumber = source.lineNumber;
1785 return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1786 }
1787 return '';
1788}
1789
1790/**
1791 * Warn if there's no key explicitly set on dynamic arrays of children or
1792 * object keys are not valid. This allows us to keep track of children between
1793 * updates.
1794 */
1795var ownerHasKeyUseWarning = {};
1796
1797function getCurrentComponentErrorInfo(parentType) {
1798 var info = getDeclarationErrorAddendum();
1799
1800 if (!info) {
1801 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1802 if (parentName) {
1803 info = '\n\nCheck the top-level render call using <' + parentName + '>.';
1804 }
1805 }
1806 return info;
1807}
1808
1809/**
1810 * Warn if the element doesn't have an explicit key assigned to it.
1811 * This element is in an array. The array could grow and shrink or be
1812 * reordered. All children that haven't already been validated are required to
1813 * have a "key" property assigned to it. Error statuses are cached so a warning
1814 * will only be shown once.
1815 *
1816 * @internal
1817 * @param {ReactElement} element Element that requires a key.
1818 * @param {*} parentType element's parent's type.
1819 */
1820function validateExplicitKey(element, parentType) {
1821 if (!element._store || element._store.validated || element.key != null) {
1822 return;
1823 }
1824 element._store.validated = true;
1825
1826 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1827 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1828 return;
1829 }
1830 ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
1831
1832 // Usually the current owner is the offender, but if it accepts children as a
1833 // property, it may be the creator of the child that's responsible for
1834 // assigning it a key.
1835 var childOwner = '';
1836 if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1837 // Give the component that originally created this child.
1838 childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
1839 }
1840
1841 setCurrentlyValidatingElement(element);
1842 {
1843 warning$1(false, 'Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
1844 }
1845 setCurrentlyValidatingElement(null);
1846}
1847
1848/**
1849 * Ensure that every element either is passed in a static location, in an
1850 * array with an explicit keys property defined, or in an object literal
1851 * with valid key property.
1852 *
1853 * @internal
1854 * @param {ReactNode} node Statically passed child of any type.
1855 * @param {*} parentType node's parent's type.
1856 */
1857function validateChildKeys(node, parentType) {
1858 if (typeof node !== 'object') {
1859 return;
1860 }
1861 if (Array.isArray(node)) {
1862 for (var i = 0; i < node.length; i++) {
1863 var child = node[i];
1864 if (isValidElement(child)) {
1865 validateExplicitKey(child, parentType);
1866 }
1867 }
1868 } else if (isValidElement(node)) {
1869 // This element was passed in a valid location.
1870 if (node._store) {
1871 node._store.validated = true;
1872 }
1873 } else if (node) {
1874 var iteratorFn = getIteratorFn(node);
1875 if (typeof iteratorFn === 'function') {
1876 // Entry iterators used to provide implicit keys,
1877 // but now we print a separate warning for them later.
1878 if (iteratorFn !== node.entries) {
1879 var iterator = iteratorFn.call(node);
1880 var step = void 0;
1881 while (!(step = iterator.next()).done) {
1882 if (isValidElement(step.value)) {
1883 validateExplicitKey(step.value, parentType);
1884 }
1885 }
1886 }
1887 }
1888 }
1889}
1890
1891/**
1892 * Given an element, validate that its props follow the propTypes definition,
1893 * provided by the type.
1894 *
1895 * @param {ReactElement} element
1896 */
1897function validatePropTypes(element) {
1898 var type = element.type;
1899 if (type === null || type === undefined || typeof type === 'string') {
1900 return;
1901 }
1902 var name = getComponentName(type);
1903 var propTypes = void 0;
1904 if (typeof type === 'function') {
1905 propTypes = type.propTypes;
1906 } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
1907 // Note: Memo only checks outer props here.
1908 // Inner props are checked in the reconciler.
1909 type.$$typeof === REACT_MEMO_TYPE)) {
1910 propTypes = type.propTypes;
1911 } else {
1912 return;
1913 }
1914 if (propTypes) {
1915 setCurrentlyValidatingElement(element);
1916 checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
1917 setCurrentlyValidatingElement(null);
1918 } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1919 propTypesMisspellWarningShown = true;
1920 warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
1921 }
1922 if (typeof type.getDefaultProps === 'function') {
1923 !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
1924 }
1925}
1926
1927/**
1928 * Given a fragment, validate that it can only be provided with fragment props
1929 * @param {ReactElement} fragment
1930 */
1931function validateFragmentProps(fragment) {
1932 setCurrentlyValidatingElement(fragment);
1933
1934 var keys = Object.keys(fragment.props);
1935 for (var i = 0; i < keys.length; i++) {
1936 var key = keys[i];
1937 if (key !== 'children' && key !== 'key') {
1938 warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1939 break;
1940 }
1941 }
1942
1943 if (fragment.ref !== null) {
1944 warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
1945 }
1946
1947 setCurrentlyValidatingElement(null);
1948}
1949
1950function createElementWithValidation(type, props, children) {
1951 var validType = isValidElementType(type);
1952
1953 // We warn in this case but don't throw. We expect the element creation to
1954 // succeed and there will likely be errors in render.
1955 if (!validType) {
1956 var info = '';
1957 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1958 info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
1959 }
1960
1961 var sourceInfo = getSourceInfoErrorAddendum(props);
1962 if (sourceInfo) {
1963 info += sourceInfo;
1964 } else {
1965 info += getDeclarationErrorAddendum();
1966 }
1967
1968 var typeString = void 0;
1969 if (type === null) {
1970 typeString = 'null';
1971 } else if (Array.isArray(type)) {
1972 typeString = 'array';
1973 } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1974 typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
1975 info = ' Did you accidentally export a JSX literal instead of a component?';
1976 } else {
1977 typeString = typeof type;
1978 }
1979
1980 warning$1(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
1981 }
1982
1983 var element = createElement.apply(this, arguments);
1984
1985 // The result can be nullish if a mock or a custom function is used.
1986 // TODO: Drop this when these are no longer allowed as the type argument.
1987 if (element == null) {
1988 return element;
1989 }
1990
1991 // Skip key warning if the type isn't valid since our key validation logic
1992 // doesn't expect a non-string/function type and can throw confusing errors.
1993 // We don't want exception behavior to differ between dev and prod.
1994 // (Rendering will throw with a helpful message and as soon as the type is
1995 // fixed, the key warnings will appear.)
1996 if (validType) {
1997 for (var i = 2; i < arguments.length; i++) {
1998 validateChildKeys(arguments[i], type);
1999 }
2000 }
2001
2002 if (type === REACT_FRAGMENT_TYPE) {
2003 validateFragmentProps(element);
2004 } else {
2005 validatePropTypes(element);
2006 }
2007
2008 return element;
2009}
2010
2011function createFactoryWithValidation(type) {
2012 var validatedFactory = createElementWithValidation.bind(null, type);
2013 validatedFactory.type = type;
2014 // Legacy hook: remove it
2015 {
2016 Object.defineProperty(validatedFactory, 'type', {
2017 enumerable: false,
2018 get: function () {
2019 lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
2020 Object.defineProperty(this, 'type', {
2021 value: type
2022 });
2023 return type;
2024 }
2025 });
2026 }
2027
2028 return validatedFactory;
2029}
2030
2031function cloneElementWithValidation(element, props, children) {
2032 var newElement = cloneElement.apply(this, arguments);
2033 for (var i = 2; i < arguments.length; i++) {
2034 validateChildKeys(arguments[i], newElement.type);
2035 }
2036 validatePropTypes(newElement);
2037 return newElement;
2038}
2039
2040var React = {
2041 Children: {
2042 map: mapChildren,
2043 forEach: forEachChildren,
2044 count: countChildren,
2045 toArray: toArray,
2046 only: onlyChild
2047 },
2048
2049 createRef: createRef,
2050 Component: Component,
2051 PureComponent: PureComponent,
2052
2053 createContext: createContext,
2054 forwardRef: forwardRef,
2055 lazy: lazy,
2056 memo: memo,
2057
2058 useCallback: useCallback,
2059 useContext: useContext,
2060 useEffect: useEffect,
2061 useImperativeHandle: useImperativeHandle,
2062 useDebugValue: useDebugValue,
2063 useLayoutEffect: useLayoutEffect,
2064 useMemo: useMemo,
2065 useReducer: useReducer,
2066 useRef: useRef,
2067 useState: useState,
2068
2069 Fragment: REACT_FRAGMENT_TYPE,
2070 StrictMode: REACT_STRICT_MODE_TYPE,
2071 Suspense: REACT_SUSPENSE_TYPE,
2072
2073 createElement: createElementWithValidation,
2074 cloneElement: cloneElementWithValidation,
2075 createFactory: createFactoryWithValidation,
2076 isValidElement: isValidElement,
2077
2078 version: ReactVersion,
2079
2080 unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
2081 unstable_Profiler: REACT_PROFILER_TYPE,
2082
2083 __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
2084};
2085
2086
2087
2088var React$2 = Object.freeze({
2089 default: React
2090});
2091
2092var React$3 = ( React$2 && React ) || React$2;
2093
2094// TODO: decide on the top-level export form.
2095// This is hacky but makes it work with both Rollup and Jest.
2096var react = React$3.default || React$3;
2097
2098module.exports = react;
2099 })();
2100}
2101});
2102
2103var react = createCommonjsModule(function (module) {
2104
2105{
2106 module.exports = react_development;
2107}
2108});
2109
2110var reactIs_production_min = createCommonjsModule(function (module, exports) {
2111Object.defineProperty(exports,"__esModule",{value:!0});
2112var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.concurrent_mode"):60111,m=b?Symbol.for("react.forward_ref"):60112,n=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.memo"):60115,r=b?Symbol.for("react.lazy"):
211360116;function t(a){if("object"===typeof a&&null!==a){var p=a.$$typeof;switch(p){case c:switch(a=a.type,a){case l:case e:case g:case f:return a;default:switch(a=a&&a.$$typeof,a){case k:case m:case h:return a;default:return p}}case d:return p}}}function u(a){return t(a)===l}exports.typeOf=t;exports.AsyncMode=l;exports.ConcurrentMode=l;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=m;exports.Fragment=e;exports.Profiler=g;exports.Portal=d;
2114exports.StrictMode=f;exports.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===l||a===g||a===f||a===n||"object"===typeof a&&null!==a&&(a.$$typeof===r||a.$$typeof===q||a.$$typeof===h||a.$$typeof===k||a.$$typeof===m)};exports.isAsyncMode=function(a){return u(a)};exports.isConcurrentMode=u;exports.isContextConsumer=function(a){return t(a)===k};exports.isContextProvider=function(a){return t(a)===h};
2115exports.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return t(a)===m};exports.isFragment=function(a){return t(a)===e};exports.isProfiler=function(a){return t(a)===g};exports.isPortal=function(a){return t(a)===d};exports.isStrictMode=function(a){return t(a)===f};
2116});
2117
2118var reactIs_development = createCommonjsModule(function (module, exports) {
2119
2120
2121
2122{
2123 (function() {
2124
2125Object.defineProperty(exports, '__esModule', { value: true });
2126
2127// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
2128// nor polyfill, then a plain number is used for performance.
2129var hasSymbol = typeof Symbol === 'function' && Symbol.for;
2130
2131var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
2132var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
2133var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
2134var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
2135var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
2136var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
2137var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
2138var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
2139var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
2140var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
2141var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
2142var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
2143
2144function isValidElementType(type) {
2145 return typeof type === 'string' || typeof type === 'function' ||
2146 // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
2147 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof 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);
2148}
2149
2150/**
2151 * Forked from fbjs/warning:
2152 * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
2153 *
2154 * Only change is we use console.warn instead of console.error,
2155 * and do nothing when 'console' is not supported.
2156 * This really simplifies the code.
2157 * ---
2158 * Similar to invariant but only logs a warning if the condition is not met.
2159 * This can be used to log issues in development environments in critical
2160 * paths. Removing the logging code for production environments will keep the
2161 * same logic and follow the same code paths.
2162 */
2163
2164var lowPriorityWarning = function () {};
2165
2166{
2167 var printWarning = function (format) {
2168 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2169 args[_key - 1] = arguments[_key];
2170 }
2171
2172 var argIndex = 0;
2173 var message = 'Warning: ' + format.replace(/%s/g, function () {
2174 return args[argIndex++];
2175 });
2176 if (typeof console !== 'undefined') {
2177 console.warn(message);
2178 }
2179 try {
2180 // --- Welcome to debugging React ---
2181 // This error was thrown as a convenience so that you can use this stack
2182 // to find the callsite that caused this warning to fire.
2183 throw new Error(message);
2184 } catch (x) {}
2185 };
2186
2187 lowPriorityWarning = function (condition, format) {
2188 if (format === undefined) {
2189 throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
2190 }
2191 if (!condition) {
2192 for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
2193 args[_key2 - 2] = arguments[_key2];
2194 }
2195
2196 printWarning.apply(undefined, [format].concat(args));
2197 }
2198 };
2199}
2200
2201var lowPriorityWarning$1 = lowPriorityWarning;
2202
2203function typeOf(object) {
2204 if (typeof object === 'object' && object !== null) {
2205 var $$typeof = object.$$typeof;
2206
2207 switch ($$typeof) {
2208 case REACT_ELEMENT_TYPE:
2209 var type = object.type;
2210
2211 switch (type) {
2212 case REACT_CONCURRENT_MODE_TYPE:
2213 case REACT_FRAGMENT_TYPE:
2214 case REACT_PROFILER_TYPE:
2215 case REACT_STRICT_MODE_TYPE:
2216 return type;
2217 default:
2218 var $$typeofType = type && type.$$typeof;
2219
2220 switch ($$typeofType) {
2221 case REACT_CONTEXT_TYPE:
2222 case REACT_FORWARD_REF_TYPE:
2223 case REACT_PROVIDER_TYPE:
2224 return $$typeofType;
2225 default:
2226 return $$typeof;
2227 }
2228 }
2229 case REACT_PORTAL_TYPE:
2230 return $$typeof;
2231 }
2232 }
2233
2234 return undefined;
2235}
2236
2237// AsyncMode alias is deprecated along with isAsyncMode
2238var AsyncMode = REACT_CONCURRENT_MODE_TYPE;
2239var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
2240var ContextConsumer = REACT_CONTEXT_TYPE;
2241var ContextProvider = REACT_PROVIDER_TYPE;
2242var Element = REACT_ELEMENT_TYPE;
2243var ForwardRef = REACT_FORWARD_REF_TYPE;
2244var Fragment = REACT_FRAGMENT_TYPE;
2245var Profiler = REACT_PROFILER_TYPE;
2246var Portal = REACT_PORTAL_TYPE;
2247var StrictMode = REACT_STRICT_MODE_TYPE;
2248
2249var hasWarnedAboutDeprecatedIsAsyncMode = false;
2250
2251// AsyncMode should be deprecated
2252function isAsyncMode(object) {
2253 {
2254 if (!hasWarnedAboutDeprecatedIsAsyncMode) {
2255 hasWarnedAboutDeprecatedIsAsyncMode = true;
2256 lowPriorityWarning$1(false, '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.');
2257 }
2258 }
2259 return isConcurrentMode(object);
2260}
2261function isConcurrentMode(object) {
2262 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
2263}
2264function isContextConsumer(object) {
2265 return typeOf(object) === REACT_CONTEXT_TYPE;
2266}
2267function isContextProvider(object) {
2268 return typeOf(object) === REACT_PROVIDER_TYPE;
2269}
2270function isElement(object) {
2271 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
2272}
2273function isForwardRef(object) {
2274 return typeOf(object) === REACT_FORWARD_REF_TYPE;
2275}
2276function isFragment(object) {
2277 return typeOf(object) === REACT_FRAGMENT_TYPE;
2278}
2279function isProfiler(object) {
2280 return typeOf(object) === REACT_PROFILER_TYPE;
2281}
2282function isPortal(object) {
2283 return typeOf(object) === REACT_PORTAL_TYPE;
2284}
2285function isStrictMode(object) {
2286 return typeOf(object) === REACT_STRICT_MODE_TYPE;
2287}
2288
2289exports.typeOf = typeOf;
2290exports.AsyncMode = AsyncMode;
2291exports.ConcurrentMode = ConcurrentMode;
2292exports.ContextConsumer = ContextConsumer;
2293exports.ContextProvider = ContextProvider;
2294exports.Element = Element;
2295exports.ForwardRef = ForwardRef;
2296exports.Fragment = Fragment;
2297exports.Profiler = Profiler;
2298exports.Portal = Portal;
2299exports.StrictMode = StrictMode;
2300exports.isValidElementType = isValidElementType;
2301exports.isAsyncMode = isAsyncMode;
2302exports.isConcurrentMode = isConcurrentMode;
2303exports.isContextConsumer = isContextConsumer;
2304exports.isContextProvider = isContextProvider;
2305exports.isElement = isElement;
2306exports.isForwardRef = isForwardRef;
2307exports.isFragment = isFragment;
2308exports.isProfiler = isProfiler;
2309exports.isPortal = isPortal;
2310exports.isStrictMode = isStrictMode;
2311 })();
2312}
2313});
2314
2315var reactIs = createCommonjsModule(function (module) {
2316
2317{
2318 module.exports = reactIs_development;
2319}
2320});
2321
2322/**
2323 * Copyright 2015, Yahoo! Inc.
2324 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
2325 */
2326
2327var REACT_STATICS = {
2328 childContextTypes: true,
2329 contextType: true,
2330 contextTypes: true,
2331 defaultProps: true,
2332 displayName: true,
2333 getDefaultProps: true,
2334 getDerivedStateFromError: true,
2335 getDerivedStateFromProps: true,
2336 mixins: true,
2337 propTypes: true,
2338 type: true
2339};
2340
2341var KNOWN_STATICS = {
2342 name: true,
2343 length: true,
2344 prototype: true,
2345 caller: true,
2346 callee: true,
2347 arguments: true,
2348 arity: true
2349};
2350
2351var FORWARD_REF_STATICS = {
2352 '$$typeof': true,
2353 render: true
2354};
2355
2356var TYPE_STATICS = {};
2357TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
2358
2359var defineProperty = Object.defineProperty;
2360var getOwnPropertyNames = Object.getOwnPropertyNames;
2361var getOwnPropertySymbols$1 = Object.getOwnPropertySymbols;
2362var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
2363var getPrototypeOf = Object.getPrototypeOf;
2364var objectPrototype = Object.prototype;
2365
2366function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
2367 if (typeof sourceComponent !== 'string') {
2368 // don't hoist over string (html) components
2369
2370 if (objectPrototype) {
2371 var inheritedComponent = getPrototypeOf(sourceComponent);
2372 if (inheritedComponent && inheritedComponent !== objectPrototype) {
2373 hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
2374 }
2375 }
2376
2377 var keys = getOwnPropertyNames(sourceComponent);
2378
2379 if (getOwnPropertySymbols$1) {
2380 keys = keys.concat(getOwnPropertySymbols$1(sourceComponent));
2381 }
2382
2383 var targetStatics = TYPE_STATICS[targetComponent['$$typeof']] || REACT_STATICS;
2384 var sourceStatics = TYPE_STATICS[sourceComponent['$$typeof']] || REACT_STATICS;
2385
2386 for (var i = 0; i < keys.length; ++i) {
2387 var key = keys[i];
2388 if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
2389 var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
2390 try {
2391 // Avoid failures from read-only properties
2392 defineProperty(targetComponent, key, descriptor);
2393 } catch (e) {}
2394 }
2395 }
2396
2397 return targetComponent;
2398 }
2399
2400 return targetComponent;
2401}
2402
2403var hoistNonReactStatics_cjs = hoistNonReactStatics;
2404
2405function warning(condition, message) {
2406 {
2407 if (condition) {
2408 return;
2409 }
2410
2411 var text = "Warning: " + message;
2412
2413 if (typeof console !== 'undefined') {
2414 console.warn(text);
2415 }
2416
2417 try {
2418 throw Error(text);
2419 } catch (x) {}
2420 }
2421}
2422
2423var printWarning$1 = function() {};
2424
2425{
2426 printWarning$1 = function(text) {
2427 var message = 'Warning: ' + text;
2428 if (typeof console !== 'undefined') {
2429 console.error(message);
2430 }
2431 try {
2432 // --- Welcome to debugging React ---
2433 // This error was thrown as a convenience so that you can use this stack
2434 // to find the callsite that caused this warning to fire.
2435 throw new Error(message);
2436 } catch (x) {}
2437 };
2438}
2439
2440function emptyFunctionThatReturnsNull() {
2441 return null;
2442}
2443
2444var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
2445 /* global Symbol */
2446 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
2447 var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
2448
2449 /**
2450 * Returns the iterator method function contained on the iterable object.
2451 *
2452 * Be sure to invoke the function with the iterable as context:
2453 *
2454 * var iteratorFn = getIteratorFn(myIterable);
2455 * if (iteratorFn) {
2456 * var iterator = iteratorFn.call(myIterable);
2457 * ...
2458 * }
2459 *
2460 * @param {?object} maybeIterable
2461 * @return {?function}
2462 */
2463 function getIteratorFn(maybeIterable) {
2464 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
2465 if (typeof iteratorFn === 'function') {
2466 return iteratorFn;
2467 }
2468 }
2469
2470 /**
2471 * Collection of methods that allow declaration and validation of props that are
2472 * supplied to React components. Example usage:
2473 *
2474 * var Props = require('ReactPropTypes');
2475 * var MyArticle = React.createClass({
2476 * propTypes: {
2477 * // An optional string prop named "description".
2478 * description: Props.string,
2479 *
2480 * // A required enum prop named "category".
2481 * category: Props.oneOf(['News','Photos']).isRequired,
2482 *
2483 * // A prop named "dialog" that requires an instance of Dialog.
2484 * dialog: Props.instanceOf(Dialog).isRequired
2485 * },
2486 * render: function() { ... }
2487 * });
2488 *
2489 * A more formal specification of how these methods are used:
2490 *
2491 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
2492 * decl := ReactPropTypes.{type}(.isRequired)?
2493 *
2494 * Each and every declaration produces a function with the same signature. This
2495 * allows the creation of custom validation functions. For example:
2496 *
2497 * var MyLink = React.createClass({
2498 * propTypes: {
2499 * // An optional string or URI prop named "href".
2500 * href: function(props, propName, componentName) {
2501 * var propValue = props[propName];
2502 * if (propValue != null && typeof propValue !== 'string' &&
2503 * !(propValue instanceof URI)) {
2504 * return new Error(
2505 * 'Expected a string or an URI for ' + propName + ' in ' +
2506 * componentName
2507 * );
2508 * }
2509 * }
2510 * },
2511 * render: function() {...}
2512 * });
2513 *
2514 * @internal
2515 */
2516
2517 var ANONYMOUS = '<<anonymous>>';
2518
2519 // Important!
2520 // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
2521 var ReactPropTypes = {
2522 array: createPrimitiveTypeChecker('array'),
2523 bool: createPrimitiveTypeChecker('boolean'),
2524 func: createPrimitiveTypeChecker('function'),
2525 number: createPrimitiveTypeChecker('number'),
2526 object: createPrimitiveTypeChecker('object'),
2527 string: createPrimitiveTypeChecker('string'),
2528 symbol: createPrimitiveTypeChecker('symbol'),
2529
2530 any: createAnyTypeChecker(),
2531 arrayOf: createArrayOfTypeChecker,
2532 element: createElementTypeChecker(),
2533 instanceOf: createInstanceTypeChecker,
2534 node: createNodeChecker(),
2535 objectOf: createObjectOfTypeChecker,
2536 oneOf: createEnumTypeChecker,
2537 oneOfType: createUnionTypeChecker,
2538 shape: createShapeTypeChecker,
2539 exact: createStrictShapeTypeChecker,
2540 };
2541
2542 /**
2543 * inlined Object.is polyfill to avoid requiring consumers ship their own
2544 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
2545 */
2546 /*eslint-disable no-self-compare*/
2547 function is(x, y) {
2548 // SameValue algorithm
2549 if (x === y) {
2550 // Steps 1-5, 7-10
2551 // Steps 6.b-6.e: +0 != -0
2552 return x !== 0 || 1 / x === 1 / y;
2553 } else {
2554 // Step 6.a: NaN == NaN
2555 return x !== x && y !== y;
2556 }
2557 }
2558 /*eslint-enable no-self-compare*/
2559
2560 /**
2561 * We use an Error-like object for backward compatibility as people may call
2562 * PropTypes directly and inspect their output. However, we don't use real
2563 * Errors anymore. We don't inspect their stack anyway, and creating them
2564 * is prohibitively expensive if they are created too often, such as what
2565 * happens in oneOfType() for any type before the one that matched.
2566 */
2567 function PropTypeError(message) {
2568 this.message = message;
2569 this.stack = '';
2570 }
2571 // Make `instanceof Error` still work for returned errors.
2572 PropTypeError.prototype = Error.prototype;
2573
2574 function createChainableTypeChecker(validate) {
2575 {
2576 var manualPropTypeCallCache = {};
2577 var manualPropTypeWarningCount = 0;
2578 }
2579 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
2580 componentName = componentName || ANONYMOUS;
2581 propFullName = propFullName || propName;
2582
2583 if (secret !== ReactPropTypesSecret_1) {
2584 if (throwOnDirectAccess) {
2585 // New behavior only for users of `prop-types` package
2586 var err = new Error(
2587 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
2588 'Use `PropTypes.checkPropTypes()` to call them. ' +
2589 'Read more at http://fb.me/use-check-prop-types'
2590 );
2591 err.name = 'Invariant Violation';
2592 throw err;
2593 } else if ( typeof console !== 'undefined') {
2594 // Old behavior for people using React.PropTypes
2595 var cacheKey = componentName + ':' + propName;
2596 if (
2597 !manualPropTypeCallCache[cacheKey] &&
2598 // Avoid spamming the console because they are often not actionable except for lib authors
2599 manualPropTypeWarningCount < 3
2600 ) {
2601 printWarning$1(
2602 'You are manually calling a React.PropTypes validation ' +
2603 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
2604 'and will throw in the standalone `prop-types` package. ' +
2605 'You may be seeing this warning due to a third-party PropTypes ' +
2606 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
2607 );
2608 manualPropTypeCallCache[cacheKey] = true;
2609 manualPropTypeWarningCount++;
2610 }
2611 }
2612 }
2613 if (props[propName] == null) {
2614 if (isRequired) {
2615 if (props[propName] === null) {
2616 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
2617 }
2618 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
2619 }
2620 return null;
2621 } else {
2622 return validate(props, propName, componentName, location, propFullName);
2623 }
2624 }
2625
2626 var chainedCheckType = checkType.bind(null, false);
2627 chainedCheckType.isRequired = checkType.bind(null, true);
2628
2629 return chainedCheckType;
2630 }
2631
2632 function createPrimitiveTypeChecker(expectedType) {
2633 function validate(props, propName, componentName, location, propFullName, secret) {
2634 var propValue = props[propName];
2635 var propType = getPropType(propValue);
2636 if (propType !== expectedType) {
2637 // `propValue` being instance of, say, date/regexp, pass the 'object'
2638 // check, but we can offer a more precise error message here rather than
2639 // 'of type `object`'.
2640 var preciseType = getPreciseType(propValue);
2641
2642 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
2643 }
2644 return null;
2645 }
2646 return createChainableTypeChecker(validate);
2647 }
2648
2649 function createAnyTypeChecker() {
2650 return createChainableTypeChecker(emptyFunctionThatReturnsNull);
2651 }
2652
2653 function createArrayOfTypeChecker(typeChecker) {
2654 function validate(props, propName, componentName, location, propFullName) {
2655 if (typeof typeChecker !== 'function') {
2656 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
2657 }
2658 var propValue = props[propName];
2659 if (!Array.isArray(propValue)) {
2660 var propType = getPropType(propValue);
2661 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
2662 }
2663 for (var i = 0; i < propValue.length; i++) {
2664 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
2665 if (error instanceof Error) {
2666 return error;
2667 }
2668 }
2669 return null;
2670 }
2671 return createChainableTypeChecker(validate);
2672 }
2673
2674 function createElementTypeChecker() {
2675 function validate(props, propName, componentName, location, propFullName) {
2676 var propValue = props[propName];
2677 if (!isValidElement(propValue)) {
2678 var propType = getPropType(propValue);
2679 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
2680 }
2681 return null;
2682 }
2683 return createChainableTypeChecker(validate);
2684 }
2685
2686 function createInstanceTypeChecker(expectedClass) {
2687 function validate(props, propName, componentName, location, propFullName) {
2688 if (!(props[propName] instanceof expectedClass)) {
2689 var expectedClassName = expectedClass.name || ANONYMOUS;
2690 var actualClassName = getClassName(props[propName]);
2691 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
2692 }
2693 return null;
2694 }
2695 return createChainableTypeChecker(validate);
2696 }
2697
2698 function createEnumTypeChecker(expectedValues) {
2699 if (!Array.isArray(expectedValues)) {
2700 printWarning$1('Invalid argument supplied to oneOf, expected an instance of array.') ;
2701 return emptyFunctionThatReturnsNull;
2702 }
2703
2704 function validate(props, propName, componentName, location, propFullName) {
2705 var propValue = props[propName];
2706 for (var i = 0; i < expectedValues.length; i++) {
2707 if (is(propValue, expectedValues[i])) {
2708 return null;
2709 }
2710 }
2711
2712 var valuesString = JSON.stringify(expectedValues);
2713 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
2714 }
2715 return createChainableTypeChecker(validate);
2716 }
2717
2718 function createObjectOfTypeChecker(typeChecker) {
2719 function validate(props, propName, componentName, location, propFullName) {
2720 if (typeof typeChecker !== 'function') {
2721 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
2722 }
2723 var propValue = props[propName];
2724 var propType = getPropType(propValue);
2725 if (propType !== 'object') {
2726 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
2727 }
2728 for (var key in propValue) {
2729 if (propValue.hasOwnProperty(key)) {
2730 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
2731 if (error instanceof Error) {
2732 return error;
2733 }
2734 }
2735 }
2736 return null;
2737 }
2738 return createChainableTypeChecker(validate);
2739 }
2740
2741 function createUnionTypeChecker(arrayOfTypeCheckers) {
2742 if (!Array.isArray(arrayOfTypeCheckers)) {
2743 printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') ;
2744 return emptyFunctionThatReturnsNull;
2745 }
2746
2747 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
2748 var checker = arrayOfTypeCheckers[i];
2749 if (typeof checker !== 'function') {
2750 printWarning$1(
2751 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
2752 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
2753 );
2754 return emptyFunctionThatReturnsNull;
2755 }
2756 }
2757
2758 function validate(props, propName, componentName, location, propFullName) {
2759 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
2760 var checker = arrayOfTypeCheckers[i];
2761 if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
2762 return null;
2763 }
2764 }
2765
2766 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
2767 }
2768 return createChainableTypeChecker(validate);
2769 }
2770
2771 function createNodeChecker() {
2772 function validate(props, propName, componentName, location, propFullName) {
2773 if (!isNode(props[propName])) {
2774 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
2775 }
2776 return null;
2777 }
2778 return createChainableTypeChecker(validate);
2779 }
2780
2781 function createShapeTypeChecker(shapeTypes) {
2782 function validate(props, propName, componentName, location, propFullName) {
2783 var propValue = props[propName];
2784 var propType = getPropType(propValue);
2785 if (propType !== 'object') {
2786 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
2787 }
2788 for (var key in shapeTypes) {
2789 var checker = shapeTypes[key];
2790 if (!checker) {
2791 continue;
2792 }
2793 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
2794 if (error) {
2795 return error;
2796 }
2797 }
2798 return null;
2799 }
2800 return createChainableTypeChecker(validate);
2801 }
2802
2803 function createStrictShapeTypeChecker(shapeTypes) {
2804 function validate(props, propName, componentName, location, propFullName) {
2805 var propValue = props[propName];
2806 var propType = getPropType(propValue);
2807 if (propType !== 'object') {
2808 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
2809 }
2810 // We need to check all keys in case some are required but missing from
2811 // props.
2812 var allKeys = assign({}, props[propName], shapeTypes);
2813 for (var key in allKeys) {
2814 var checker = shapeTypes[key];
2815 if (!checker) {
2816 return new PropTypeError(
2817 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
2818 '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
2819 '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
2820 );
2821 }
2822 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
2823 if (error) {
2824 return error;
2825 }
2826 }
2827 return null;
2828 }
2829
2830 return createChainableTypeChecker(validate);
2831 }
2832
2833 function isNode(propValue) {
2834 switch (typeof propValue) {
2835 case 'number':
2836 case 'string':
2837 case 'undefined':
2838 return true;
2839 case 'boolean':
2840 return !propValue;
2841 case 'object':
2842 if (Array.isArray(propValue)) {
2843 return propValue.every(isNode);
2844 }
2845 if (propValue === null || isValidElement(propValue)) {
2846 return true;
2847 }
2848
2849 var iteratorFn = getIteratorFn(propValue);
2850 if (iteratorFn) {
2851 var iterator = iteratorFn.call(propValue);
2852 var step;
2853 if (iteratorFn !== propValue.entries) {
2854 while (!(step = iterator.next()).done) {
2855 if (!isNode(step.value)) {
2856 return false;
2857 }
2858 }
2859 } else {
2860 // Iterator will provide entry [k,v] tuples rather than values.
2861 while (!(step = iterator.next()).done) {
2862 var entry = step.value;
2863 if (entry) {
2864 if (!isNode(entry[1])) {
2865 return false;
2866 }
2867 }
2868 }
2869 }
2870 } else {
2871 return false;
2872 }
2873
2874 return true;
2875 default:
2876 return false;
2877 }
2878 }
2879
2880 function isSymbol(propType, propValue) {
2881 // Native Symbol.
2882 if (propType === 'symbol') {
2883 return true;
2884 }
2885
2886 // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
2887 if (propValue['@@toStringTag'] === 'Symbol') {
2888 return true;
2889 }
2890
2891 // Fallback for non-spec compliant Symbols which are polyfilled.
2892 if (typeof Symbol === 'function' && propValue instanceof Symbol) {
2893 return true;
2894 }
2895
2896 return false;
2897 }
2898
2899 // Equivalent of `typeof` but with special handling for array and regexp.
2900 function getPropType(propValue) {
2901 var propType = typeof propValue;
2902 if (Array.isArray(propValue)) {
2903 return 'array';
2904 }
2905 if (propValue instanceof RegExp) {
2906 // Old webkits (at least until Android 4.0) return 'function' rather than
2907 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
2908 // passes PropTypes.object.
2909 return 'object';
2910 }
2911 if (isSymbol(propType, propValue)) {
2912 return 'symbol';
2913 }
2914 return propType;
2915 }
2916
2917 // This handles more types than `getPropType`. Only used for error messages.
2918 // See `createPrimitiveTypeChecker`.
2919 function getPreciseType(propValue) {
2920 if (typeof propValue === 'undefined' || propValue === null) {
2921 return '' + propValue;
2922 }
2923 var propType = getPropType(propValue);
2924 if (propType === 'object') {
2925 if (propValue instanceof Date) {
2926 return 'date';
2927 } else if (propValue instanceof RegExp) {
2928 return 'regexp';
2929 }
2930 }
2931 return propType;
2932 }
2933
2934 // Returns a string that is postfixed to a warning about an invalid type.
2935 // For example, "undefined" or "of type array"
2936 function getPostfixForTypeWarning(value) {
2937 var type = getPreciseType(value);
2938 switch (type) {
2939 case 'array':
2940 case 'object':
2941 return 'an ' + type;
2942 case 'boolean':
2943 case 'date':
2944 case 'regexp':
2945 return 'a ' + type;
2946 default:
2947 return type;
2948 }
2949 }
2950
2951 // Returns class name of the object, if any.
2952 function getClassName(propValue) {
2953 if (!propValue.constructor || !propValue.constructor.name) {
2954 return ANONYMOUS;
2955 }
2956 return propValue.constructor.name;
2957 }
2958
2959 ReactPropTypes.checkPropTypes = checkPropTypes_1;
2960 ReactPropTypes.PropTypes = ReactPropTypes;
2961
2962 return ReactPropTypes;
2963};
2964
2965var propTypes = createCommonjsModule(function (module) {
2966/**
2967 * Copyright (c) 2013-present, Facebook, Inc.
2968 *
2969 * This source code is licensed under the MIT license found in the
2970 * LICENSE file in the root directory of this source tree.
2971 */
2972
2973{
2974 var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
2975 Symbol.for &&
2976 Symbol.for('react.element')) ||
2977 0xeac7;
2978
2979 var isValidElement = function(object) {
2980 return typeof object === 'object' &&
2981 object !== null &&
2982 object.$$typeof === REACT_ELEMENT_TYPE;
2983 };
2984
2985 // By explicitly using `prop-types` you are opting into new development behavior.
2986 // http://fb.me/prop-types-in-prod
2987 var throwOnDirectAccess = true;
2988 module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess);
2989}
2990});
2991
2992{
2993 module.exports = require('./cjs/react-is.development.js');
2994}
2995
2996var reactIs$1 = /*#__PURE__*/Object.freeze({
2997 __proto__: null
2998});
2999
3000var ReactIs = /*@__PURE__*/getAugmentedNamespace(reactIs$1);
3001
3002/**
3003 * Copyright 2015, Yahoo! Inc.
3004 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
3005 */
3006
3007var REACT_STATICS$1 = {
3008 childContextTypes: true,
3009 contextType: true,
3010 contextTypes: true,
3011 defaultProps: true,
3012 displayName: true,
3013 getDefaultProps: true,
3014 getDerivedStateFromError: true,
3015 getDerivedStateFromProps: true,
3016 mixins: true,
3017 propTypes: true,
3018 type: true
3019};
3020
3021var KNOWN_STATICS$1 = {
3022 name: true,
3023 length: true,
3024 prototype: true,
3025 caller: true,
3026 callee: true,
3027 arguments: true,
3028 arity: true
3029};
3030
3031var FORWARD_REF_STATICS$1 = {
3032 '$$typeof': true,
3033 render: true,
3034 defaultProps: true,
3035 displayName: true,
3036 propTypes: true
3037};
3038
3039var MEMO_STATICS = {
3040 '$$typeof': true,
3041 compare: true,
3042 defaultProps: true,
3043 displayName: true,
3044 propTypes: true,
3045 type: true
3046};
3047
3048var TYPE_STATICS$1 = {};
3049TYPE_STATICS$1[ReactIs.ForwardRef] = FORWARD_REF_STATICS$1;
3050
3051function getStatics(component) {
3052 if (ReactIs.isMemo(component)) {
3053 return MEMO_STATICS;
3054 }
3055 return TYPE_STATICS$1[component['$$typeof']] || REACT_STATICS$1;
3056}
3057
3058var defineProperty$1 = Object.defineProperty;
3059var getOwnPropertyNames$1 = Object.getOwnPropertyNames;
3060var getOwnPropertySymbols$2 = Object.getOwnPropertySymbols;
3061var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
3062var getPrototypeOf$1 = Object.getPrototypeOf;
3063var objectPrototype$1 = Object.prototype;
3064
3065function hoistNonReactStatics$1(targetComponent, sourceComponent, blacklist) {
3066 if (typeof sourceComponent !== 'string') {
3067 // don't hoist over string (html) components
3068
3069 if (objectPrototype$1) {
3070 var inheritedComponent = getPrototypeOf$1(sourceComponent);
3071 if (inheritedComponent && inheritedComponent !== objectPrototype$1) {
3072 hoistNonReactStatics$1(targetComponent, inheritedComponent, blacklist);
3073 }
3074 }
3075
3076 var keys = getOwnPropertyNames$1(sourceComponent);
3077
3078 if (getOwnPropertySymbols$2) {
3079 keys = keys.concat(getOwnPropertySymbols$2(sourceComponent));
3080 }
3081
3082 var targetStatics = getStatics(targetComponent);
3083 var sourceStatics = getStatics(sourceComponent);
3084
3085 for (var i = 0; i < keys.length; ++i) {
3086 var key = keys[i];
3087 if (!KNOWN_STATICS$1[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
3088 var descriptor = getOwnPropertyDescriptor$1(sourceComponent, key);
3089 try {
3090 // Avoid failures from read-only properties
3091 defineProperty$1(targetComponent, key, descriptor);
3092 } catch (e) {}
3093 }
3094 }
3095
3096 return targetComponent;
3097 }
3098
3099 return targetComponent;
3100}
3101
3102var hoistNonReactStatics_cjs$1 = hoistNonReactStatics$1;
3103
3104var getDisplayName_1 = createCommonjsModule(function (module, exports) {
3105
3106Object.defineProperty(exports, "__esModule", {
3107 value: true
3108});
3109exports.default = getDisplayName;
3110function getDisplayName(Component) {
3111 return Component.displayName || Component.name || (typeof Component === 'string' && Component.length > 0 ? Component : 'Unknown');
3112}
3113});
3114
3115var getDisplayName = /*@__PURE__*/getDefaultExportFromCjs(getDisplayName_1);
3116
3117function _defineProperty(obj, key, value) {
3118 if (key in obj) {
3119 Object.defineProperty(obj, key, {
3120 value: value,
3121 enumerable: true,
3122 configurable: true,
3123 writable: true
3124 });
3125 } else {
3126 obj[key] = value;
3127 }
3128
3129 return obj;
3130}
3131
3132function _extends$1() {
3133 _extends$1 = Object.assign || function (target) {
3134 for (var i = 1; i < arguments.length; i++) {
3135 var source = arguments[i];
3136
3137 for (var key in source) {
3138 if (Object.prototype.hasOwnProperty.call(source, key)) {
3139 target[key] = source[key];
3140 }
3141 }
3142 }
3143
3144 return target;
3145 };
3146
3147 return _extends$1.apply(this, arguments);
3148}
3149
3150function _inheritsLoose(subClass, superClass) {
3151 subClass.prototype = Object.create(superClass.prototype);
3152 subClass.prototype.constructor = subClass;
3153 subClass.__proto__ = superClass;
3154}
3155
3156function _assertThisInitialized(self) {
3157 if (self === void 0) {
3158 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3159 }
3160
3161 return self;
3162}
3163
3164function isObject(obj) {
3165 return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
3166}
3167
3168function createThemeProvider(context) {
3169 var ThemeProvider =
3170 /*#__PURE__*/
3171 function (_React$Component) {
3172 _inheritsLoose(ThemeProvider, _React$Component);
3173
3174 function ThemeProvider() {
3175 var _this;
3176
3177 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3178 args[_key] = arguments[_key];
3179 }
3180
3181 _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
3182
3183 _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "cachedTheme", void 0);
3184
3185 _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "lastOuterTheme", void 0);
3186
3187 _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "lastTheme", void 0);
3188
3189 _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderProvider", function (outerTheme) {
3190 var children = _this.props.children;
3191 return react.createElement(context.Provider, {
3192 value: _this.getTheme(outerTheme)
3193 }, children);
3194 });
3195
3196 return _this;
3197 }
3198
3199 var _proto = ThemeProvider.prototype;
3200
3201 // Get the theme from the props, supporting both (outerTheme) => {} as well as object notation
3202 _proto.getTheme = function getTheme(outerTheme) {
3203 if (this.props.theme !== this.lastTheme || outerTheme !== this.lastOuterTheme || !this.cachedTheme) {
3204 this.lastOuterTheme = outerTheme;
3205 this.lastTheme = this.props.theme;
3206
3207 if (typeof this.lastTheme === 'function') {
3208 var theme = this.props.theme;
3209 this.cachedTheme = theme(outerTheme);
3210 warning(isObject(this.cachedTheme), '[ThemeProvider] Please return an object from your theme function') ;
3211 } else {
3212 var _theme = this.props.theme;
3213 warning(isObject(_theme), '[ThemeProvider] Please make your theme prop a plain object') ;
3214 this.cachedTheme = outerTheme ? _extends$1({}, outerTheme, _theme) : _theme;
3215 }
3216 }
3217
3218 return this.cachedTheme;
3219 };
3220
3221 _proto.render = function render() {
3222 var children = this.props.children;
3223
3224 if (!children) {
3225 return null;
3226 }
3227
3228 return react.createElement(context.Consumer, null, this.renderProvider);
3229 };
3230
3231 return ThemeProvider;
3232 }(react.Component);
3233
3234 {
3235 ThemeProvider.propTypes = {
3236 // eslint-disable-next-line react/require-default-props
3237 children: propTypes.node,
3238 theme: propTypes.oneOfType([propTypes.shape({}), propTypes.func]).isRequired
3239 };
3240 }
3241
3242 return ThemeProvider;
3243}
3244
3245function createWithTheme(context) {
3246 return function hoc(Component) {
3247 var withTheme = react.forwardRef(function (props, ref) {
3248 return react.createElement(context.Consumer, null, function (theme) {
3249 warning(isObject(theme), '[theming] Please use withTheme only with the ThemeProvider') ;
3250 return react.createElement(Component, _extends$1({
3251 theme: theme,
3252 ref: ref
3253 }, props));
3254 });
3255 });
3256
3257 {
3258 withTheme.displayName = "WithTheme(" + getDisplayName(Component) + ")";
3259 }
3260
3261 hoistNonReactStatics_cjs$1(withTheme, Component);
3262 return withTheme;
3263 };
3264}
3265
3266function createUseTheme(context) {
3267 var useTheme = function useTheme() {
3268 var theme = react.useContext(context);
3269 warning(isObject(theme), '[theming] Please use useTheme only with the ThemeProvider') ;
3270 return theme;
3271 };
3272
3273 return useTheme;
3274}
3275
3276function createTheming(context) {
3277 return {
3278 context: context,
3279 withTheme: createWithTheme(context),
3280 useTheme: createUseTheme(context),
3281 ThemeProvider: createThemeProvider(context)
3282 };
3283}
3284
3285var ThemeContext = react.createContext();
3286
3287var _createTheming = createTheming(ThemeContext),
3288 withTheme = _createTheming.withTheme,
3289 ThemeProvider = _createTheming.ThemeProvider,
3290 useTheme = _createTheming.useTheme;
3291
3292var getDisplayName$1 = function getDisplayName(Component) {
3293 return Component.displayName || Component.name || 'Component';
3294};
3295
3296var memoize = function memoize(fn) {
3297 var lastArgs;
3298 var lastResult;
3299 return function () {
3300 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3301 args[_key] = arguments[_key];
3302 }
3303
3304 if (Array.isArray(lastArgs) && args.length === lastArgs.length) {
3305 var isSame = true;
3306
3307 for (var i = 0; i < args.length; i++) {
3308 if (args[i] !== lastArgs[i]) {
3309 isSame = false;
3310 }
3311 }
3312
3313 if (isSame) {
3314 return lastResult;
3315 }
3316 }
3317
3318 lastArgs = args;
3319 lastResult = fn.apply(void 0, args);
3320 return lastResult;
3321 };
3322};
3323
3324var mergeClasses = function mergeClasses(baseClasses, additionalClasses) {
3325 var combinedClasses = _extends({}, baseClasses);
3326
3327 for (var name in additionalClasses) {
3328 combinedClasses[name] = name in combinedClasses ? combinedClasses[name] + " " + additionalClasses[name] : additionalClasses[name];
3329 }
3330
3331 return combinedClasses;
3332};
3333
3334/**
3335 * Global index counter to preserve source order.
3336 * As we create the style sheet during componentWillMount lifecycle,
3337 * children are handled after the parents, so the order of style elements would
3338 * be parent->child. It is a problem though when a parent passes a className
3339 * which needs to override any childs styles. StyleSheet of the child has a higher
3340 * specificity, because of the source order.
3341 * So our solution is to render sheets them in the reverse order child->sheet, so
3342 * that parent has a higher specificity.
3343 *
3344 * We start at [Number.MIN_SAFE_INTEGER] to always insert sheets from react-jss first before any
3345 * sheet which might be inserted manually by the user.
3346 */
3347var index = Number.MIN_SAFE_INTEGER || -1e9;
3348
3349var getSheetIndex = function getSheetIndex() {
3350 return index++;
3351};
3352
3353var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
3354
3355var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object' && document.nodeType === 9;
3356
3357var JssContext = react.createContext({
3358 classNamePrefix: '',
3359 disableStylesGeneration: false,
3360 isSSR: !isBrowser
3361});
3362
3363function _defineProperties(target, props) {
3364 for (var i = 0; i < props.length; i++) {
3365 var descriptor = props[i];
3366 descriptor.enumerable = descriptor.enumerable || false;
3367 descriptor.configurable = true;
3368 if ("value" in descriptor) descriptor.writable = true;
3369 Object.defineProperty(target, descriptor.key, descriptor);
3370 }
3371}
3372
3373function _createClass(Constructor, protoProps, staticProps) {
3374 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3375 if (staticProps) _defineProperties(Constructor, staticProps);
3376 return Constructor;
3377}
3378
3379function _inheritsLoose$1(subClass, superClass) {
3380 subClass.prototype = Object.create(superClass.prototype);
3381 subClass.prototype.constructor = subClass;
3382 subClass.__proto__ = superClass;
3383}
3384
3385function _assertThisInitialized$1(self) {
3386 if (self === void 0) {
3387 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3388 }
3389
3390 return self;
3391}
3392
3393var plainObjectConstrurctor = {}.constructor;
3394
3395function cloneStyle(style) {
3396 if (style == null || typeof style !== 'object') return style;
3397 if (Array.isArray(style)) return style.map(cloneStyle);
3398 if (style.constructor !== plainObjectConstrurctor) return style;
3399 var newStyle = {};
3400
3401 for (var name in style) {
3402 newStyle[name] = cloneStyle(style[name]);
3403 }
3404
3405 return newStyle;
3406}
3407/**
3408 * Create a rule instance.
3409 */
3410
3411
3412function createRule(name, decl, options) {
3413 if (name === void 0) {
3414 name = 'unnamed';
3415 }
3416
3417 var jss = options.jss;
3418 var declCopy = cloneStyle(decl);
3419 var rule = jss.plugins.onCreateRule(name, declCopy, options);
3420 if (rule) return rule; // It is an at-rule and it has no instance.
3421
3422 if (name[0] === '@') {
3423 warning(false, "[JSS] Unknown rule " + name) ;
3424 }
3425
3426 return null;
3427}
3428
3429var join = function join(value, by) {
3430 var result = '';
3431
3432 for (var i = 0; i < value.length; i++) {
3433 // Remove !important from the value, it will be readded later.
3434 if (value[i] === '!important') break;
3435 if (result) result += by;
3436 result += value[i];
3437 }
3438
3439 return result;
3440};
3441/**
3442 * Converts JSS array value to a CSS string.
3443 *
3444 * `margin: [['5px', '10px']]` > `margin: 5px 10px;`
3445 * `border: ['1px', '2px']` > `border: 1px, 2px;`
3446 * `margin: [['5px', '10px'], '!important']` > `margin: 5px 10px !important;`
3447 * `color: ['red', !important]` > `color: red !important;`
3448 */
3449
3450
3451var toCssValue = function toCssValue(value) {
3452 if (!Array.isArray(value)) return value;
3453 var cssValue = ''; // Support space separated values via `[['5px', '10px']]`.
3454
3455 if (Array.isArray(value[0])) {
3456 for (var i = 0; i < value.length; i++) {
3457 if (value[i] === '!important') break;
3458 if (cssValue) cssValue += ', ';
3459 cssValue += join(value[i], ' ');
3460 }
3461 } else cssValue = join(value, ', '); // Add !important, because it was ignored.
3462
3463
3464 if (value[value.length - 1] === '!important') {
3465 cssValue += ' !important';
3466 }
3467
3468 return cssValue;
3469};
3470
3471function getWhitespaceSymbols(options) {
3472 if (options && options.format === false) {
3473 return {
3474 linebreak: '',
3475 space: ''
3476 };
3477 }
3478
3479 return {
3480 linebreak: '\n',
3481 space: ' '
3482 };
3483}
3484/**
3485 * Indent a string.
3486 * http://jsperf.com/array-join-vs-for
3487 */
3488
3489
3490function indentStr(str, indent) {
3491 var result = '';
3492
3493 for (var index = 0; index < indent; index++) {
3494 result += ' ';
3495 }
3496
3497 return result + str;
3498}
3499/**
3500 * Converts a Rule to CSS string.
3501 */
3502
3503
3504function toCss(selector, style, options) {
3505 if (options === void 0) {
3506 options = {};
3507 }
3508
3509 var result = '';
3510 if (!style) return result;
3511 var _options = options,
3512 _options$indent = _options.indent,
3513 indent = _options$indent === void 0 ? 0 : _options$indent;
3514 var fallbacks = style.fallbacks;
3515
3516 if (options.format === false) {
3517 indent = -Infinity;
3518 }
3519
3520 var _getWhitespaceSymbols = getWhitespaceSymbols(options),
3521 linebreak = _getWhitespaceSymbols.linebreak,
3522 space = _getWhitespaceSymbols.space;
3523
3524 if (selector) indent++; // Apply fallbacks first.
3525
3526 if (fallbacks) {
3527 // Array syntax {fallbacks: [{prop: value}]}
3528 if (Array.isArray(fallbacks)) {
3529 for (var index = 0; index < fallbacks.length; index++) {
3530 var fallback = fallbacks[index];
3531
3532 for (var prop in fallback) {
3533 var value = fallback[prop];
3534
3535 if (value != null) {
3536 if (result) result += linebreak;
3537 result += indentStr(prop + ":" + space + toCssValue(value) + ";", indent);
3538 }
3539 }
3540 }
3541 } else {
3542 // Object syntax {fallbacks: {prop: value}}
3543 for (var _prop in fallbacks) {
3544 var _value = fallbacks[_prop];
3545
3546 if (_value != null) {
3547 if (result) result += linebreak;
3548 result += indentStr(_prop + ":" + space + toCssValue(_value) + ";", indent);
3549 }
3550 }
3551 }
3552 }
3553
3554 for (var _prop2 in style) {
3555 var _value2 = style[_prop2];
3556
3557 if (_value2 != null && _prop2 !== 'fallbacks') {
3558 if (result) result += linebreak;
3559 result += indentStr(_prop2 + ":" + space + toCssValue(_value2) + ";", indent);
3560 }
3561 } // Allow empty style in this case, because properties will be added dynamically.
3562
3563
3564 if (!result && !options.allowEmpty) return result; // When rule is being stringified before selector was defined.
3565
3566 if (!selector) return result;
3567 indent--;
3568 if (result) result = "" + linebreak + result + linebreak;
3569 return indentStr("" + selector + space + "{" + result, indent) + indentStr('}', indent);
3570}
3571
3572var escapeRegex = /([[\].#*$><+~=|^:(),"'`\s])/g;
3573var nativeEscape = typeof CSS !== 'undefined' && CSS.escape;
3574
3575var escape = function escape(str) {
3576 return nativeEscape ? nativeEscape(str) : str.replace(escapeRegex, '\\$1');
3577};
3578
3579var BaseStyleRule =
3580/*#__PURE__*/
3581function () {
3582 function BaseStyleRule(key, style, options) {
3583 this.type = 'style';
3584 this.isProcessed = false;
3585 var sheet = options.sheet,
3586 Renderer = options.Renderer;
3587 this.key = key;
3588 this.options = options;
3589 this.style = style;
3590 if (sheet) this.renderer = sheet.renderer;else if (Renderer) this.renderer = new Renderer();
3591 }
3592 /**
3593 * Get or set a style property.
3594 */
3595
3596
3597 var _proto = BaseStyleRule.prototype;
3598
3599 _proto.prop = function prop(name, value, options) {
3600 // It's a getter.
3601 if (value === undefined) return this.style[name]; // Don't do anything if the value has not changed.
3602
3603 var force = options ? options.force : false;
3604 if (!force && this.style[name] === value) return this;
3605 var newValue = value;
3606
3607 if (!options || options.process !== false) {
3608 newValue = this.options.jss.plugins.onChangeValue(value, name, this);
3609 }
3610
3611 var isEmpty = newValue == null || newValue === false;
3612 var isDefined = name in this.style; // Value is empty and wasn't defined before.
3613
3614 if (isEmpty && !isDefined && !force) return this; // We are going to remove this value.
3615
3616 var remove = isEmpty && isDefined;
3617 if (remove) delete this.style[name];else this.style[name] = newValue; // Renderable is defined if StyleSheet option `link` is true.
3618
3619 if (this.renderable && this.renderer) {
3620 if (remove) this.renderer.removeProperty(this.renderable, name);else this.renderer.setProperty(this.renderable, name, newValue);
3621 return this;
3622 }
3623
3624 var sheet = this.options.sheet;
3625
3626 if (sheet && sheet.attached) {
3627 warning(false, '[JSS] Rule is not linked. Missing sheet option "link: true".') ;
3628 }
3629
3630 return this;
3631 };
3632
3633 return BaseStyleRule;
3634}();
3635
3636var StyleRule =
3637/*#__PURE__*/
3638function (_BaseStyleRule) {
3639 _inheritsLoose$1(StyleRule, _BaseStyleRule);
3640
3641 function StyleRule(key, style, options) {
3642 var _this;
3643
3644 _this = _BaseStyleRule.call(this, key, style, options) || this;
3645 var selector = options.selector,
3646 scoped = options.scoped,
3647 sheet = options.sheet,
3648 generateId = options.generateId;
3649
3650 if (selector) {
3651 _this.selectorText = selector;
3652 } else if (scoped !== false) {
3653 _this.id = generateId(_assertThisInitialized$1(_assertThisInitialized$1(_this)), sheet);
3654 _this.selectorText = "." + escape(_this.id);
3655 }
3656
3657 return _this;
3658 }
3659 /**
3660 * Set selector string.
3661 * Attention: use this with caution. Most browsers didn't implement
3662 * selectorText setter, so this may result in rerendering of entire Style Sheet.
3663 */
3664
3665
3666 var _proto2 = StyleRule.prototype;
3667 /**
3668 * Apply rule to an element inline.
3669 */
3670
3671 _proto2.applyTo = function applyTo(renderable) {
3672 var renderer = this.renderer;
3673
3674 if (renderer) {
3675 var json = this.toJSON();
3676
3677 for (var prop in json) {
3678 renderer.setProperty(renderable, prop, json[prop]);
3679 }
3680 }
3681
3682 return this;
3683 }
3684 /**
3685 * Returns JSON representation of the rule.
3686 * Fallbacks are not supported.
3687 * Useful for inline styles.
3688 */
3689 ;
3690
3691 _proto2.toJSON = function toJSON() {
3692 var json = {};
3693
3694 for (var prop in this.style) {
3695 var value = this.style[prop];
3696 if (typeof value !== 'object') json[prop] = value;else if (Array.isArray(value)) json[prop] = toCssValue(value);
3697 }
3698
3699 return json;
3700 }
3701 /**
3702 * Generates a CSS string.
3703 */
3704 ;
3705
3706 _proto2.toString = function toString(options) {
3707 var sheet = this.options.sheet;
3708 var link = sheet ? sheet.options.link : false;
3709 var opts = link ? _extends({}, options, {
3710 allowEmpty: true
3711 }) : options;
3712 return toCss(this.selectorText, this.style, opts);
3713 };
3714
3715 _createClass(StyleRule, [{
3716 key: "selector",
3717 set: function set(selector) {
3718 if (selector === this.selectorText) return;
3719 this.selectorText = selector;
3720 var renderer = this.renderer,
3721 renderable = this.renderable;
3722 if (!renderable || !renderer) return;
3723 var hasChanged = renderer.setSelector(renderable, selector); // If selector setter is not implemented, rerender the rule.
3724
3725 if (!hasChanged) {
3726 renderer.replaceRule(renderable, this);
3727 }
3728 }
3729 /**
3730 * Get selector string.
3731 */
3732 ,
3733 get: function get() {
3734 return this.selectorText;
3735 }
3736 }]);
3737
3738 return StyleRule;
3739}(BaseStyleRule);
3740
3741var pluginStyleRule = {
3742 onCreateRule: function onCreateRule(key, style, options) {
3743 if (key[0] === '@' || options.parent && options.parent.type === 'keyframes') {
3744 return null;
3745 }
3746
3747 return new StyleRule(key, style, options);
3748 }
3749};
3750var defaultToStringOptions = {
3751 indent: 1,
3752 children: true
3753};
3754var atRegExp = /@([\w-]+)/;
3755/**
3756 * Conditional rule for @media, @supports
3757 */
3758
3759var ConditionalRule =
3760/*#__PURE__*/
3761function () {
3762 function ConditionalRule(key, styles, options) {
3763 this.type = 'conditional';
3764 this.isProcessed = false;
3765 this.key = key;
3766 var atMatch = key.match(atRegExp);
3767 this.at = atMatch ? atMatch[1] : 'unknown'; // Key might contain a unique suffix in case the `name` passed by user was duplicate.
3768
3769 this.query = options.name || "@" + this.at;
3770 this.options = options;
3771 this.rules = new RuleList(_extends({}, options, {
3772 parent: this
3773 }));
3774
3775 for (var name in styles) {
3776 this.rules.add(name, styles[name]);
3777 }
3778
3779 this.rules.process();
3780 }
3781 /**
3782 * Get a rule.
3783 */
3784
3785
3786 var _proto = ConditionalRule.prototype;
3787
3788 _proto.getRule = function getRule(name) {
3789 return this.rules.get(name);
3790 }
3791 /**
3792 * Get index of a rule.
3793 */
3794 ;
3795
3796 _proto.indexOf = function indexOf(rule) {
3797 return this.rules.indexOf(rule);
3798 }
3799 /**
3800 * Create and register rule, run plugins.
3801 */
3802 ;
3803
3804 _proto.addRule = function addRule(name, style, options) {
3805 var rule = this.rules.add(name, style, options);
3806 if (!rule) return null;
3807 this.options.jss.plugins.onProcessRule(rule);
3808 return rule;
3809 }
3810 /**
3811 * Replace rule, run plugins.
3812 */
3813 ;
3814
3815 _proto.replaceRule = function replaceRule(name, style, options) {
3816 var newRule = this.rules.replace(name, style, options);
3817 if (newRule) this.options.jss.plugins.onProcessRule(newRule);
3818 return newRule;
3819 }
3820 /**
3821 * Generates a CSS string.
3822 */
3823 ;
3824
3825 _proto.toString = function toString(options) {
3826 if (options === void 0) {
3827 options = defaultToStringOptions;
3828 }
3829
3830 var _getWhitespaceSymbols = getWhitespaceSymbols(options),
3831 linebreak = _getWhitespaceSymbols.linebreak;
3832
3833 if (options.indent == null) options.indent = defaultToStringOptions.indent;
3834 if (options.children == null) options.children = defaultToStringOptions.children;
3835
3836 if (options.children === false) {
3837 return this.query + " {}";
3838 }
3839
3840 var children = this.rules.toString(options);
3841 return children ? this.query + " {" + linebreak + children + linebreak + "}" : '';
3842 };
3843
3844 return ConditionalRule;
3845}();
3846
3847var keyRegExp = /@media|@supports\s+/;
3848var pluginConditionalRule = {
3849 onCreateRule: function onCreateRule(key, styles, options) {
3850 return keyRegExp.test(key) ? new ConditionalRule(key, styles, options) : null;
3851 }
3852};
3853var defaultToStringOptions$1 = {
3854 indent: 1,
3855 children: true
3856};
3857var nameRegExp = /@keyframes\s+([\w-]+)/;
3858/**
3859 * Rule for @keyframes
3860 */
3861
3862var KeyframesRule =
3863/*#__PURE__*/
3864function () {
3865 function KeyframesRule(key, frames, options) {
3866 this.type = 'keyframes';
3867 this.at = '@keyframes';
3868 this.isProcessed = false;
3869 var nameMatch = key.match(nameRegExp);
3870
3871 if (nameMatch && nameMatch[1]) {
3872 this.name = nameMatch[1];
3873 } else {
3874 this.name = 'noname';
3875 warning(false, "[JSS] Bad keyframes name " + key) ;
3876 }
3877
3878 this.key = this.type + "-" + this.name;
3879 this.options = options;
3880 var scoped = options.scoped,
3881 sheet = options.sheet,
3882 generateId = options.generateId;
3883 this.id = scoped === false ? this.name : escape(generateId(this, sheet));
3884 this.rules = new RuleList(_extends({}, options, {
3885 parent: this
3886 }));
3887
3888 for (var name in frames) {
3889 this.rules.add(name, frames[name], _extends({}, options, {
3890 parent: this
3891 }));
3892 }
3893
3894 this.rules.process();
3895 }
3896 /**
3897 * Generates a CSS string.
3898 */
3899
3900
3901 var _proto = KeyframesRule.prototype;
3902
3903 _proto.toString = function toString(options) {
3904 if (options === void 0) {
3905 options = defaultToStringOptions$1;
3906 }
3907
3908 var _getWhitespaceSymbols = getWhitespaceSymbols(options),
3909 linebreak = _getWhitespaceSymbols.linebreak;
3910
3911 if (options.indent == null) options.indent = defaultToStringOptions$1.indent;
3912 if (options.children == null) options.children = defaultToStringOptions$1.children;
3913
3914 if (options.children === false) {
3915 return this.at + " " + this.id + " {}";
3916 }
3917
3918 var children = this.rules.toString(options);
3919 if (children) children = "" + linebreak + children + linebreak;
3920 return this.at + " " + this.id + " {" + children + "}";
3921 };
3922
3923 return KeyframesRule;
3924}();
3925
3926var keyRegExp$1 = /@keyframes\s+/;
3927var refRegExp = /\$([\w-]+)/g;
3928
3929var findReferencedKeyframe = function findReferencedKeyframe(val, keyframes) {
3930 if (typeof val === 'string') {
3931 return val.replace(refRegExp, function (match, name) {
3932 if (name in keyframes) {
3933 return keyframes[name];
3934 }
3935
3936 warning(false, "[JSS] Referenced keyframes rule \"" + name + "\" is not defined.") ;
3937 return match;
3938 });
3939 }
3940
3941 return val;
3942};
3943/**
3944 * Replace the reference for a animation name.
3945 */
3946
3947
3948var replaceRef = function replaceRef(style, prop, keyframes) {
3949 var value = style[prop];
3950 var refKeyframe = findReferencedKeyframe(value, keyframes);
3951
3952 if (refKeyframe !== value) {
3953 style[prop] = refKeyframe;
3954 }
3955};
3956
3957var pluginKeyframesRule = {
3958 onCreateRule: function onCreateRule(key, frames, options) {
3959 return typeof key === 'string' && keyRegExp$1.test(key) ? new KeyframesRule(key, frames, options) : null;
3960 },
3961 // Animation name ref replacer.
3962 onProcessStyle: function onProcessStyle(style, rule, sheet) {
3963 if (rule.type !== 'style' || !sheet) return style;
3964 if ('animation-name' in style) replaceRef(style, 'animation-name', sheet.keyframes);
3965 if ('animation' in style) replaceRef(style, 'animation', sheet.keyframes);
3966 return style;
3967 },
3968 onChangeValue: function onChangeValue(val, prop, rule) {
3969 var sheet = rule.options.sheet;
3970
3971 if (!sheet) {
3972 return val;
3973 }
3974
3975 switch (prop) {
3976 case 'animation':
3977 return findReferencedKeyframe(val, sheet.keyframes);
3978
3979 case 'animation-name':
3980 return findReferencedKeyframe(val, sheet.keyframes);
3981
3982 default:
3983 return val;
3984 }
3985 }
3986};
3987
3988var KeyframeRule =
3989/*#__PURE__*/
3990function (_BaseStyleRule) {
3991 _inheritsLoose$1(KeyframeRule, _BaseStyleRule);
3992
3993 function KeyframeRule() {
3994 return _BaseStyleRule.apply(this, arguments) || this;
3995 }
3996
3997 var _proto = KeyframeRule.prototype;
3998 /**
3999 * Generates a CSS string.
4000 */
4001
4002 _proto.toString = function toString(options) {
4003 var sheet = this.options.sheet;
4004 var link = sheet ? sheet.options.link : false;
4005 var opts = link ? _extends({}, options, {
4006 allowEmpty: true
4007 }) : options;
4008 return toCss(this.key, this.style, opts);
4009 };
4010
4011 return KeyframeRule;
4012}(BaseStyleRule);
4013
4014var pluginKeyframeRule = {
4015 onCreateRule: function onCreateRule(key, style, options) {
4016 if (options.parent && options.parent.type === 'keyframes') {
4017 return new KeyframeRule(key, style, options);
4018 }
4019
4020 return null;
4021 }
4022};
4023
4024var FontFaceRule =
4025/*#__PURE__*/
4026function () {
4027 function FontFaceRule(key, style, options) {
4028 this.type = 'font-face';
4029 this.at = '@font-face';
4030 this.isProcessed = false;
4031 this.key = key;
4032 this.style = style;
4033 this.options = options;
4034 }
4035 /**
4036 * Generates a CSS string.
4037 */
4038
4039
4040 var _proto = FontFaceRule.prototype;
4041
4042 _proto.toString = function toString(options) {
4043 var _getWhitespaceSymbols = getWhitespaceSymbols(options),
4044 linebreak = _getWhitespaceSymbols.linebreak;
4045
4046 if (Array.isArray(this.style)) {
4047 var str = '';
4048
4049 for (var index = 0; index < this.style.length; index++) {
4050 str += toCss(this.at, this.style[index]);
4051 if (this.style[index + 1]) str += linebreak;
4052 }
4053
4054 return str;
4055 }
4056
4057 return toCss(this.at, this.style, options);
4058 };
4059
4060 return FontFaceRule;
4061}();
4062
4063var keyRegExp$2 = /@font-face/;
4064var pluginFontFaceRule = {
4065 onCreateRule: function onCreateRule(key, style, options) {
4066 return keyRegExp$2.test(key) ? new FontFaceRule(key, style, options) : null;
4067 }
4068};
4069
4070var ViewportRule =
4071/*#__PURE__*/
4072function () {
4073 function ViewportRule(key, style, options) {
4074 this.type = 'viewport';
4075 this.at = '@viewport';
4076 this.isProcessed = false;
4077 this.key = key;
4078 this.style = style;
4079 this.options = options;
4080 }
4081 /**
4082 * Generates a CSS string.
4083 */
4084
4085
4086 var _proto = ViewportRule.prototype;
4087
4088 _proto.toString = function toString(options) {
4089 return toCss(this.key, this.style, options);
4090 };
4091
4092 return ViewportRule;
4093}();
4094
4095var pluginViewportRule = {
4096 onCreateRule: function onCreateRule(key, style, options) {
4097 return key === '@viewport' || key === '@-ms-viewport' ? new ViewportRule(key, style, options) : null;
4098 }
4099};
4100
4101var SimpleRule =
4102/*#__PURE__*/
4103function () {
4104 function SimpleRule(key, value, options) {
4105 this.type = 'simple';
4106 this.isProcessed = false;
4107 this.key = key;
4108 this.value = value;
4109 this.options = options;
4110 }
4111 /**
4112 * Generates a CSS string.
4113 */
4114 // eslint-disable-next-line no-unused-vars
4115
4116
4117 var _proto = SimpleRule.prototype;
4118
4119 _proto.toString = function toString(options) {
4120 if (Array.isArray(this.value)) {
4121 var str = '';
4122
4123 for (var index = 0; index < this.value.length; index++) {
4124 str += this.key + " " + this.value[index] + ";";
4125 if (this.value[index + 1]) str += '\n';
4126 }
4127
4128 return str;
4129 }
4130
4131 return this.key + " " + this.value + ";";
4132 };
4133
4134 return SimpleRule;
4135}();
4136
4137var keysMap = {
4138 '@charset': true,
4139 '@import': true,
4140 '@namespace': true
4141};
4142var pluginSimpleRule = {
4143 onCreateRule: function onCreateRule(key, value, options) {
4144 return key in keysMap ? new SimpleRule(key, value, options) : null;
4145 }
4146};
4147var plugins = [pluginStyleRule, pluginConditionalRule, pluginKeyframesRule, pluginKeyframeRule, pluginFontFaceRule, pluginViewportRule, pluginSimpleRule];
4148var defaultUpdateOptions = {
4149 process: true
4150};
4151var forceUpdateOptions = {
4152 force: true,
4153 process: true
4154 /**
4155 * Contains rules objects and allows adding/removing etc.
4156 * Is used for e.g. by `StyleSheet` or `ConditionalRule`.
4157 */
4158
4159};
4160
4161var RuleList =
4162/*#__PURE__*/
4163function () {
4164 // Rules registry for access by .get() method.
4165 // It contains the same rule registered by name and by selector.
4166 // Original styles object.
4167 // Used to ensure correct rules order.
4168 function RuleList(options) {
4169 this.map = {};
4170 this.raw = {};
4171 this.index = [];
4172 this.counter = 0;
4173 this.options = options;
4174 this.classes = options.classes;
4175 this.keyframes = options.keyframes;
4176 }
4177 /**
4178 * Create and register rule.
4179 *
4180 * Will not render after Style Sheet was rendered the first time.
4181 */
4182
4183
4184 var _proto = RuleList.prototype;
4185
4186 _proto.add = function add(name, decl, ruleOptions) {
4187 var _this$options = this.options,
4188 parent = _this$options.parent,
4189 sheet = _this$options.sheet,
4190 jss = _this$options.jss,
4191 Renderer = _this$options.Renderer,
4192 generateId = _this$options.generateId,
4193 scoped = _this$options.scoped;
4194
4195 var options = _extends({
4196 classes: this.classes,
4197 parent: parent,
4198 sheet: sheet,
4199 jss: jss,
4200 Renderer: Renderer,
4201 generateId: generateId,
4202 scoped: scoped,
4203 name: name,
4204 keyframes: this.keyframes,
4205 selector: undefined
4206 }, ruleOptions); // When user uses .createStyleSheet(), duplicate names are not possible, but
4207 // `sheet.addRule()` opens the door for any duplicate rule name. When this happens
4208 // we need to make the key unique within this RuleList instance scope.
4209
4210
4211 var key = name;
4212
4213 if (name in this.raw) {
4214 key = name + "-d" + this.counter++;
4215 } // We need to save the original decl before creating the rule
4216 // because cache plugin needs to use it as a key to return a cached rule.
4217
4218
4219 this.raw[key] = decl;
4220
4221 if (key in this.classes) {
4222 // E.g. rules inside of @media container
4223 options.selector = "." + escape(this.classes[key]);
4224 }
4225
4226 var rule = createRule(key, decl, options);
4227 if (!rule) return null;
4228 this.register(rule);
4229 var index = options.index === undefined ? this.index.length : options.index;
4230 this.index.splice(index, 0, rule);
4231 return rule;
4232 }
4233 /**
4234 * Replace rule.
4235 * Create a new rule and remove old one instead of overwriting
4236 * because we want to invoke onCreateRule hook to make plugins work.
4237 */
4238 ;
4239
4240 _proto.replace = function replace(name, decl, ruleOptions) {
4241 var oldRule = this.get(name);
4242 var oldIndex = this.index.indexOf(oldRule);
4243
4244 if (oldRule) {
4245 this.remove(oldRule);
4246 }
4247
4248 var options = ruleOptions;
4249 if (oldIndex !== -1) options = _extends({}, ruleOptions, {
4250 index: oldIndex
4251 });
4252 return this.add(name, decl, options);
4253 }
4254 /**
4255 * Get a rule by name or selector.
4256 */
4257 ;
4258
4259 _proto.get = function get(nameOrSelector) {
4260 return this.map[nameOrSelector];
4261 }
4262 /**
4263 * Delete a rule.
4264 */
4265 ;
4266
4267 _proto.remove = function remove(rule) {
4268 this.unregister(rule);
4269 delete this.raw[rule.key];
4270 this.index.splice(this.index.indexOf(rule), 1);
4271 }
4272 /**
4273 * Get index of a rule.
4274 */
4275 ;
4276
4277 _proto.indexOf = function indexOf(rule) {
4278 return this.index.indexOf(rule);
4279 }
4280 /**
4281 * Run `onProcessRule()` plugins on every rule.
4282 */
4283 ;
4284
4285 _proto.process = function process() {
4286 var plugins = this.options.jss.plugins; // We need to clone array because if we modify the index somewhere else during a loop
4287 // we end up with very hard-to-track-down side effects.
4288
4289 this.index.slice(0).forEach(plugins.onProcessRule, plugins);
4290 }
4291 /**
4292 * Register a rule in `.map`, `.classes` and `.keyframes` maps.
4293 */
4294 ;
4295
4296 _proto.register = function register(rule) {
4297 this.map[rule.key] = rule;
4298
4299 if (rule instanceof StyleRule) {
4300 this.map[rule.selector] = rule;
4301 if (rule.id) this.classes[rule.key] = rule.id;
4302 } else if (rule instanceof KeyframesRule && this.keyframes) {
4303 this.keyframes[rule.name] = rule.id;
4304 }
4305 }
4306 /**
4307 * Unregister a rule.
4308 */
4309 ;
4310
4311 _proto.unregister = function unregister(rule) {
4312 delete this.map[rule.key];
4313
4314 if (rule instanceof StyleRule) {
4315 delete this.map[rule.selector];
4316 delete this.classes[rule.key];
4317 } else if (rule instanceof KeyframesRule) {
4318 delete this.keyframes[rule.name];
4319 }
4320 }
4321 /**
4322 * Update the function values with a new data.
4323 */
4324 ;
4325
4326 _proto.update = function update() {
4327 var name;
4328 var data;
4329 var options;
4330
4331 if (typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'string') {
4332 name = arguments.length <= 0 ? undefined : arguments[0];
4333 data = arguments.length <= 1 ? undefined : arguments[1];
4334 options = arguments.length <= 2 ? undefined : arguments[2];
4335 } else {
4336 data = arguments.length <= 0 ? undefined : arguments[0];
4337 options = arguments.length <= 1 ? undefined : arguments[1];
4338 name = null;
4339 }
4340
4341 if (name) {
4342 this.updateOne(this.get(name), data, options);
4343 } else {
4344 for (var index = 0; index < this.index.length; index++) {
4345 this.updateOne(this.index[index], data, options);
4346 }
4347 }
4348 }
4349 /**
4350 * Execute plugins, update rule props.
4351 */
4352 ;
4353
4354 _proto.updateOne = function updateOne(rule, data, options) {
4355 if (options === void 0) {
4356 options = defaultUpdateOptions;
4357 }
4358
4359 var _this$options2 = this.options,
4360 plugins = _this$options2.jss.plugins,
4361 sheet = _this$options2.sheet; // It is a rules container like for e.g. ConditionalRule.
4362
4363 if (rule.rules instanceof RuleList) {
4364 rule.rules.update(data, options);
4365 return;
4366 }
4367
4368 var style = rule.style;
4369 plugins.onUpdate(data, rule, sheet, options); // We rely on a new `style` ref in case it was mutated during onUpdate hook.
4370
4371 if (options.process && style && style !== rule.style) {
4372 // We need to run the plugins in case new `style` relies on syntax plugins.
4373 plugins.onProcessStyle(rule.style, rule, sheet); // Update and add props.
4374
4375 for (var prop in rule.style) {
4376 var nextValue = rule.style[prop];
4377 var prevValue = style[prop]; // We need to use `force: true` because `rule.style` has been updated during onUpdate hook, so `rule.prop()` will not update the CSSOM rule.
4378 // We do this comparison to avoid unneeded `rule.prop()` calls, since we have the old `style` object here.
4379
4380 if (nextValue !== prevValue) {
4381 rule.prop(prop, nextValue, forceUpdateOptions);
4382 }
4383 } // Remove props.
4384
4385
4386 for (var _prop in style) {
4387 var _nextValue = rule.style[_prop];
4388 var _prevValue = style[_prop]; // We need to use `force: true` because `rule.style` has been updated during onUpdate hook, so `rule.prop()` will not update the CSSOM rule.
4389 // We do this comparison to avoid unneeded `rule.prop()` calls, since we have the old `style` object here.
4390
4391 if (_nextValue == null && _nextValue !== _prevValue) {
4392 rule.prop(_prop, null, forceUpdateOptions);
4393 }
4394 }
4395 }
4396 }
4397 /**
4398 * Convert rules to a CSS string.
4399 */
4400 ;
4401
4402 _proto.toString = function toString(options) {
4403 var str = '';
4404 var sheet = this.options.sheet;
4405 var link = sheet ? sheet.options.link : false;
4406
4407 var _getWhitespaceSymbols = getWhitespaceSymbols(options),
4408 linebreak = _getWhitespaceSymbols.linebreak;
4409
4410 for (var index = 0; index < this.index.length; index++) {
4411 var rule = this.index[index];
4412 var css = rule.toString(options); // No need to render an empty rule.
4413
4414 if (!css && !link) continue;
4415 if (str) str += linebreak;
4416 str += css;
4417 }
4418
4419 return str;
4420 };
4421
4422 return RuleList;
4423}();
4424
4425var StyleSheet =
4426/*#__PURE__*/
4427function () {
4428 function StyleSheet(styles, options) {
4429 this.attached = false;
4430 this.deployed = false;
4431 this.classes = {};
4432 this.keyframes = {};
4433 this.options = _extends({}, options, {
4434 sheet: this,
4435 parent: this,
4436 classes: this.classes,
4437 keyframes: this.keyframes
4438 });
4439
4440 if (options.Renderer) {
4441 this.renderer = new options.Renderer(this);
4442 }
4443
4444 this.rules = new RuleList(this.options);
4445
4446 for (var name in styles) {
4447 this.rules.add(name, styles[name]);
4448 }
4449
4450 this.rules.process();
4451 }
4452 /**
4453 * Attach renderable to the render tree.
4454 */
4455
4456
4457 var _proto = StyleSheet.prototype;
4458
4459 _proto.attach = function attach() {
4460 if (this.attached) return this;
4461 if (this.renderer) this.renderer.attach();
4462 this.attached = true; // Order is important, because we can't use insertRule API if style element is not attached.
4463
4464 if (!this.deployed) this.deploy();
4465 return this;
4466 }
4467 /**
4468 * Remove renderable from render tree.
4469 */
4470 ;
4471
4472 _proto.detach = function detach() {
4473 if (!this.attached) return this;
4474 if (this.renderer) this.renderer.detach();
4475 this.attached = false;
4476 return this;
4477 }
4478 /**
4479 * Add a rule to the current stylesheet.
4480 * Will insert a rule also after the stylesheet has been rendered first time.
4481 */
4482 ;
4483
4484 _proto.addRule = function addRule(name, decl, options) {
4485 var queue = this.queue; // Plugins can create rules.
4486 // In order to preserve the right order, we need to queue all `.addRule` calls,
4487 // which happen after the first `rules.add()` call.
4488
4489 if (this.attached && !queue) this.queue = [];
4490 var rule = this.rules.add(name, decl, options);
4491 if (!rule) return null;
4492 this.options.jss.plugins.onProcessRule(rule);
4493
4494 if (this.attached) {
4495 if (!this.deployed) return rule; // Don't insert rule directly if there is no stringified version yet.
4496 // It will be inserted all together when .attach is called.
4497
4498 if (queue) queue.push(rule);else {
4499 this.insertRule(rule);
4500
4501 if (this.queue) {
4502 this.queue.forEach(this.insertRule, this);
4503 this.queue = undefined;
4504 }
4505 }
4506 return rule;
4507 } // We can't add rules to a detached style node.
4508 // We will redeploy the sheet once user will attach it.
4509
4510
4511 this.deployed = false;
4512 return rule;
4513 }
4514 /**
4515 * Replace a rule in the current stylesheet.
4516 */
4517 ;
4518
4519 _proto.replaceRule = function replaceRule(nameOrSelector, decl, options) {
4520 var oldRule = this.rules.get(nameOrSelector);
4521 if (!oldRule) return this.addRule(nameOrSelector, decl, options);
4522 var newRule = this.rules.replace(nameOrSelector, decl, options);
4523
4524 if (newRule) {
4525 this.options.jss.plugins.onProcessRule(newRule);
4526 }
4527
4528 if (this.attached) {
4529 if (!this.deployed) return newRule; // Don't replace / delete rule directly if there is no stringified version yet.
4530 // It will be inserted all together when .attach is called.
4531
4532 if (this.renderer) {
4533 if (!newRule) {
4534 this.renderer.deleteRule(oldRule);
4535 } else if (oldRule.renderable) {
4536 this.renderer.replaceRule(oldRule.renderable, newRule);
4537 }
4538 }
4539
4540 return newRule;
4541 } // We can't replace rules to a detached style node.
4542 // We will redeploy the sheet once user will attach it.
4543
4544
4545 this.deployed = false;
4546 return newRule;
4547 }
4548 /**
4549 * Insert rule into the StyleSheet
4550 */
4551 ;
4552
4553 _proto.insertRule = function insertRule(rule) {
4554 if (this.renderer) {
4555 this.renderer.insertRule(rule);
4556 }
4557 }
4558 /**
4559 * Create and add rules.
4560 * Will render also after Style Sheet was rendered the first time.
4561 */
4562 ;
4563
4564 _proto.addRules = function addRules(styles, options) {
4565 var added = [];
4566
4567 for (var name in styles) {
4568 var rule = this.addRule(name, styles[name], options);
4569 if (rule) added.push(rule);
4570 }
4571
4572 return added;
4573 }
4574 /**
4575 * Get a rule by name or selector.
4576 */
4577 ;
4578
4579 _proto.getRule = function getRule(nameOrSelector) {
4580 return this.rules.get(nameOrSelector);
4581 }
4582 /**
4583 * Delete a rule by name.
4584 * Returns `true`: if rule has been deleted from the DOM.
4585 */
4586 ;
4587
4588 _proto.deleteRule = function deleteRule(name) {
4589 var rule = typeof name === 'object' ? name : this.rules.get(name);
4590
4591 if (!rule || // Style sheet was created without link: true and attached, in this case we
4592 // won't be able to remove the CSS rule from the DOM.
4593 this.attached && !rule.renderable) {
4594 return false;
4595 }
4596
4597 this.rules.remove(rule);
4598
4599 if (this.attached && rule.renderable && this.renderer) {
4600 return this.renderer.deleteRule(rule.renderable);
4601 }
4602
4603 return true;
4604 }
4605 /**
4606 * Get index of a rule.
4607 */
4608 ;
4609
4610 _proto.indexOf = function indexOf(rule) {
4611 return this.rules.indexOf(rule);
4612 }
4613 /**
4614 * Deploy pure CSS string to a renderable.
4615 */
4616 ;
4617
4618 _proto.deploy = function deploy() {
4619 if (this.renderer) this.renderer.deploy();
4620 this.deployed = true;
4621 return this;
4622 }
4623 /**
4624 * Update the function values with a new data.
4625 */
4626 ;
4627
4628 _proto.update = function update() {
4629 var _this$rules;
4630
4631 (_this$rules = this.rules).update.apply(_this$rules, arguments);
4632
4633 return this;
4634 }
4635 /**
4636 * Updates a single rule.
4637 */
4638 ;
4639
4640 _proto.updateOne = function updateOne(rule, data, options) {
4641 this.rules.updateOne(rule, data, options);
4642 return this;
4643 }
4644 /**
4645 * Convert rules to a CSS string.
4646 */
4647 ;
4648
4649 _proto.toString = function toString(options) {
4650 return this.rules.toString(options);
4651 };
4652
4653 return StyleSheet;
4654}();
4655
4656var PluginsRegistry =
4657/*#__PURE__*/
4658function () {
4659 function PluginsRegistry() {
4660 this.plugins = {
4661 internal: [],
4662 external: []
4663 };
4664 this.registry = {};
4665 }
4666
4667 var _proto = PluginsRegistry.prototype;
4668 /**
4669 * Call `onCreateRule` hooks and return an object if returned by a hook.
4670 */
4671
4672 _proto.onCreateRule = function onCreateRule(name, decl, options) {
4673 for (var i = 0; i < this.registry.onCreateRule.length; i++) {
4674 var rule = this.registry.onCreateRule[i](name, decl, options);
4675 if (rule) return rule;
4676 }
4677
4678 return null;
4679 }
4680 /**
4681 * Call `onProcessRule` hooks.
4682 */
4683 ;
4684
4685 _proto.onProcessRule = function onProcessRule(rule) {
4686 if (rule.isProcessed) return;
4687 var sheet = rule.options.sheet;
4688
4689 for (var i = 0; i < this.registry.onProcessRule.length; i++) {
4690 this.registry.onProcessRule[i](rule, sheet);
4691 }
4692
4693 if (rule.style) this.onProcessStyle(rule.style, rule, sheet);
4694 rule.isProcessed = true;
4695 }
4696 /**
4697 * Call `onProcessStyle` hooks.
4698 */
4699 ;
4700
4701 _proto.onProcessStyle = function onProcessStyle(style, rule, sheet) {
4702 for (var i = 0; i < this.registry.onProcessStyle.length; i++) {
4703 rule.style = this.registry.onProcessStyle[i](rule.style, rule, sheet);
4704 }
4705 }
4706 /**
4707 * Call `onProcessSheet` hooks.
4708 */
4709 ;
4710
4711 _proto.onProcessSheet = function onProcessSheet(sheet) {
4712 for (var i = 0; i < this.registry.onProcessSheet.length; i++) {
4713 this.registry.onProcessSheet[i](sheet);
4714 }
4715 }
4716 /**
4717 * Call `onUpdate` hooks.
4718 */
4719 ;
4720
4721 _proto.onUpdate = function onUpdate(data, rule, sheet, options) {
4722 for (var i = 0; i < this.registry.onUpdate.length; i++) {
4723 this.registry.onUpdate[i](data, rule, sheet, options);
4724 }
4725 }
4726 /**
4727 * Call `onChangeValue` hooks.
4728 */
4729 ;
4730
4731 _proto.onChangeValue = function onChangeValue(value, prop, rule) {
4732 var processedValue = value;
4733
4734 for (var i = 0; i < this.registry.onChangeValue.length; i++) {
4735 processedValue = this.registry.onChangeValue[i](processedValue, prop, rule);
4736 }
4737
4738 return processedValue;
4739 }
4740 /**
4741 * Register a plugin.
4742 */
4743 ;
4744
4745 _proto.use = function use(newPlugin, options) {
4746 if (options === void 0) {
4747 options = {
4748 queue: 'external'
4749 };
4750 }
4751
4752 var plugins = this.plugins[options.queue]; // Avoids applying same plugin twice, at least based on ref.
4753
4754 if (plugins.indexOf(newPlugin) !== -1) {
4755 return;
4756 }
4757
4758 plugins.push(newPlugin);
4759 this.registry = [].concat(this.plugins.external, this.plugins.internal).reduce(function (registry, plugin) {
4760 for (var name in plugin) {
4761 if (name in registry) {
4762 registry[name].push(plugin[name]);
4763 } else {
4764 warning(false, "[JSS] Unknown hook \"" + name + "\".") ;
4765 }
4766 }
4767
4768 return registry;
4769 }, {
4770 onCreateRule: [],
4771 onProcessRule: [],
4772 onProcessStyle: [],
4773 onProcessSheet: [],
4774 onChangeValue: [],
4775 onUpdate: []
4776 });
4777 };
4778
4779 return PluginsRegistry;
4780}();
4781/**
4782 * Sheets registry to access all instances in one place.
4783 */
4784
4785
4786var SheetsRegistry =
4787/*#__PURE__*/
4788function () {
4789 function SheetsRegistry() {
4790 this.registry = [];
4791 }
4792
4793 var _proto = SheetsRegistry.prototype;
4794 /**
4795 * Register a Style Sheet.
4796 */
4797
4798 _proto.add = function add(sheet) {
4799 var registry = this.registry;
4800 var index = sheet.options.index;
4801 if (registry.indexOf(sheet) !== -1) return;
4802
4803 if (registry.length === 0 || index >= this.index) {
4804 registry.push(sheet);
4805 return;
4806 } // Find a position.
4807
4808
4809 for (var i = 0; i < registry.length; i++) {
4810 if (registry[i].options.index > index) {
4811 registry.splice(i, 0, sheet);
4812 return;
4813 }
4814 }
4815 }
4816 /**
4817 * Reset the registry.
4818 */
4819 ;
4820
4821 _proto.reset = function reset() {
4822 this.registry = [];
4823 }
4824 /**
4825 * Remove a Style Sheet.
4826 */
4827 ;
4828
4829 _proto.remove = function remove(sheet) {
4830 var index = this.registry.indexOf(sheet);
4831 this.registry.splice(index, 1);
4832 }
4833 /**
4834 * Convert all attached sheets to a CSS string.
4835 */
4836 ;
4837
4838 _proto.toString = function toString(_temp) {
4839 var _ref = _temp === void 0 ? {} : _temp,
4840 attached = _ref.attached,
4841 options = _objectWithoutPropertiesLoose(_ref, ["attached"]);
4842
4843 var _getWhitespaceSymbols = getWhitespaceSymbols(options),
4844 linebreak = _getWhitespaceSymbols.linebreak;
4845
4846 var css = '';
4847
4848 for (var i = 0; i < this.registry.length; i++) {
4849 var sheet = this.registry[i];
4850
4851 if (attached != null && sheet.attached !== attached) {
4852 continue;
4853 }
4854
4855 if (css) css += linebreak;
4856 css += sheet.toString(options);
4857 }
4858
4859 return css;
4860 };
4861
4862 _createClass(SheetsRegistry, [{
4863 key: "index",
4864
4865 /**
4866 * Current highest index number.
4867 */
4868 get: function get() {
4869 return this.registry.length === 0 ? 0 : this.registry[this.registry.length - 1].options.index;
4870 }
4871 }]);
4872
4873 return SheetsRegistry;
4874}();
4875/**
4876 * This is a global sheets registry. Only DomRenderer will add sheets to it.
4877 * On the server one should use an own SheetsRegistry instance and add the
4878 * sheets to it, because you need to make sure to create a new registry for
4879 * each request in order to not leak sheets across requests.
4880 */
4881
4882
4883var sheets = new SheetsRegistry();
4884/* eslint-disable */
4885
4886/**
4887 * Now that `globalThis` is available on most platforms
4888 * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility)
4889 * we check for `globalThis` first. `globalThis` is necessary for jss
4890 * to run in Agoric's secure version of JavaScript (SES). Under SES,
4891 * `globalThis` exists, but `window`, `self`, and `Function('return
4892 * this')()` are all undefined for security reasons.
4893 *
4894 * https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
4895 */
4896
4897var globalThis$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' && window.Math === Math ? window : typeof self !== 'undefined' && self.Math === Math ? self : Function('return this')();
4898var ns = '2f1acc6c3a606b082e5eef5e54414ffb';
4899if (globalThis$1[ns] == null) globalThis$1[ns] = 0; // Bundle may contain multiple JSS versions at the same time. In order to identify
4900// the current version with just one short number and use it for classes generation
4901// we use a counter. Also it is more accurate, because user can manually reevaluate
4902// the module.
4903
4904var moduleId = globalThis$1[ns]++;
4905var maxRules = 1e10;
4906/**
4907 * Returns a function which generates unique class names based on counters.
4908 * When new generator function is created, rule counter is reseted.
4909 * We need to reset the rule counter for SSR for each request.
4910 */
4911
4912var createGenerateId = function createGenerateId(options) {
4913 if (options === void 0) {
4914 options = {};
4915 }
4916
4917 var ruleCounter = 0;
4918
4919 var generateId = function generateId(rule, sheet) {
4920 ruleCounter += 1;
4921
4922 if (ruleCounter > maxRules) {
4923 warning(false, "[JSS] You might have a memory leak. Rule counter is at " + ruleCounter + ".") ;
4924 }
4925
4926 var jssId = '';
4927 var prefix = '';
4928
4929 if (sheet) {
4930 if (sheet.options.classNamePrefix) {
4931 prefix = sheet.options.classNamePrefix;
4932 }
4933
4934 if (sheet.options.jss.id != null) {
4935 jssId = String(sheet.options.jss.id);
4936 }
4937 }
4938
4939 if (options.minify) {
4940 // Using "c" because a number can't be the first char in a class name.
4941 return "" + (prefix || 'c') + moduleId + jssId + ruleCounter;
4942 }
4943
4944 return prefix + rule.key + "-" + moduleId + (jssId ? "-" + jssId : '') + "-" + ruleCounter;
4945 };
4946
4947 return generateId;
4948};
4949/**
4950 * Cache the value from the first time a function is called.
4951 */
4952
4953
4954var memoize$1 = function memoize(fn) {
4955 var value;
4956 return function () {
4957 if (!value) value = fn();
4958 return value;
4959 };
4960};
4961/**
4962 * Get a style property value.
4963 */
4964
4965
4966var getPropertyValue = function getPropertyValue(cssRule, prop) {
4967 try {
4968 // Support CSSTOM.
4969 if (cssRule.attributeStyleMap) {
4970 return cssRule.attributeStyleMap.get(prop);
4971 }
4972
4973 return cssRule.style.getPropertyValue(prop);
4974 } catch (err) {
4975 // IE may throw if property is unknown.
4976 return '';
4977 }
4978};
4979/**
4980 * Set a style property.
4981 */
4982
4983
4984var setProperty = function setProperty(cssRule, prop, value) {
4985 try {
4986 var cssValue = value;
4987
4988 if (Array.isArray(value)) {
4989 cssValue = toCssValue(value);
4990 } // Support CSSTOM.
4991
4992
4993 if (cssRule.attributeStyleMap) {
4994 cssRule.attributeStyleMap.set(prop, cssValue);
4995 } else {
4996 var indexOfImportantFlag = cssValue ? cssValue.indexOf('!important') : -1;
4997 var cssValueWithoutImportantFlag = indexOfImportantFlag > -1 ? cssValue.substr(0, indexOfImportantFlag - 1) : cssValue;
4998 cssRule.style.setProperty(prop, cssValueWithoutImportantFlag, indexOfImportantFlag > -1 ? 'important' : '');
4999 }
5000 } catch (err) {
5001 // IE may throw if property is unknown.
5002 return false;
5003 }
5004
5005 return true;
5006};
5007/**
5008 * Remove a style property.
5009 */
5010
5011
5012var removeProperty = function removeProperty(cssRule, prop) {
5013 try {
5014 // Support CSSTOM.
5015 if (cssRule.attributeStyleMap) {
5016 cssRule.attributeStyleMap.delete(prop);
5017 } else {
5018 cssRule.style.removeProperty(prop);
5019 }
5020 } catch (err) {
5021 warning(false, "[JSS] DOMException \"" + err.message + "\" was thrown. Tried to remove property \"" + prop + "\".") ;
5022 }
5023};
5024/**
5025 * Set the selector.
5026 */
5027
5028
5029var setSelector = function setSelector(cssRule, selectorText) {
5030 cssRule.selectorText = selectorText; // Return false if setter was not successful.
5031 // Currently works in chrome only.
5032
5033 return cssRule.selectorText === selectorText;
5034};
5035/**
5036 * Gets the `head` element upon the first call and caches it.
5037 * We assume it can't be null.
5038 */
5039
5040
5041var getHead = memoize$1(function () {
5042 return document.querySelector('head');
5043});
5044/**
5045 * Find attached sheet with an index higher than the passed one.
5046 */
5047
5048function findHigherSheet(registry, options) {
5049 for (var i = 0; i < registry.length; i++) {
5050 var sheet = registry[i];
5051
5052 if (sheet.attached && sheet.options.index > options.index && sheet.options.insertionPoint === options.insertionPoint) {
5053 return sheet;
5054 }
5055 }
5056
5057 return null;
5058}
5059/**
5060 * Find attached sheet with the highest index.
5061 */
5062
5063
5064function findHighestSheet(registry, options) {
5065 for (var i = registry.length - 1; i >= 0; i--) {
5066 var sheet = registry[i];
5067
5068 if (sheet.attached && sheet.options.insertionPoint === options.insertionPoint) {
5069 return sheet;
5070 }
5071 }
5072
5073 return null;
5074}
5075/**
5076 * Find a comment with "jss" inside.
5077 */
5078
5079
5080function findCommentNode(text) {
5081 var head = getHead();
5082
5083 for (var i = 0; i < head.childNodes.length; i++) {
5084 var node = head.childNodes[i];
5085
5086 if (node.nodeType === 8 && node.nodeValue.trim() === text) {
5087 return node;
5088 }
5089 }
5090
5091 return null;
5092}
5093/**
5094 * Find a node before which we can insert the sheet.
5095 */
5096
5097
5098function findPrevNode(options) {
5099 var registry = sheets.registry;
5100
5101 if (registry.length > 0) {
5102 // Try to insert before the next higher sheet.
5103 var sheet = findHigherSheet(registry, options);
5104
5105 if (sheet && sheet.renderer) {
5106 return {
5107 parent: sheet.renderer.element.parentNode,
5108 node: sheet.renderer.element
5109 };
5110 } // Otherwise insert after the last attached.
5111
5112
5113 sheet = findHighestSheet(registry, options);
5114
5115 if (sheet && sheet.renderer) {
5116 return {
5117 parent: sheet.renderer.element.parentNode,
5118 node: sheet.renderer.element.nextSibling
5119 };
5120 }
5121 } // Try to find a comment placeholder if registry is empty.
5122
5123
5124 var insertionPoint = options.insertionPoint;
5125
5126 if (insertionPoint && typeof insertionPoint === 'string') {
5127 var comment = findCommentNode(insertionPoint);
5128
5129 if (comment) {
5130 return {
5131 parent: comment.parentNode,
5132 node: comment.nextSibling
5133 };
5134 } // If user specifies an insertion point and it can't be found in the document -
5135 // bad specificity issues may appear.
5136
5137
5138 warning(false, "[JSS] Insertion point \"" + insertionPoint + "\" not found.") ;
5139 }
5140
5141 return false;
5142}
5143/**
5144 * Insert style element into the DOM.
5145 */
5146
5147
5148function insertStyle(style, options) {
5149 var insertionPoint = options.insertionPoint;
5150 var nextNode = findPrevNode(options);
5151
5152 if (nextNode !== false && nextNode.parent) {
5153 nextNode.parent.insertBefore(style, nextNode.node);
5154 return;
5155 } // Works with iframes and any node types.
5156
5157
5158 if (insertionPoint && typeof insertionPoint.nodeType === 'number') {
5159 var insertionPointElement = insertionPoint;
5160 var parentNode = insertionPointElement.parentNode;
5161 if (parentNode) parentNode.insertBefore(style, insertionPointElement.nextSibling);else warning(false, '[JSS] Insertion point is not in the DOM.') ;
5162 return;
5163 }
5164
5165 getHead().appendChild(style);
5166}
5167/**
5168 * Read jss nonce setting from the page if the user has set it.
5169 */
5170
5171
5172var getNonce = memoize$1(function () {
5173 var node = document.querySelector('meta[property="csp-nonce"]');
5174 return node ? node.getAttribute('content') : null;
5175});
5176
5177var _insertRule = function insertRule(container, rule, index) {
5178 try {
5179 if ('insertRule' in container) {
5180 container.insertRule(rule, index);
5181 } // Keyframes rule.
5182 else if ('appendRule' in container) {
5183 container.appendRule(rule);
5184 }
5185 } catch (err) {
5186 warning(false, "[JSS] " + err.message) ;
5187 return false;
5188 }
5189
5190 return container.cssRules[index];
5191};
5192
5193var getValidRuleInsertionIndex = function getValidRuleInsertionIndex(container, index) {
5194 var maxIndex = container.cssRules.length; // In case previous insertion fails, passed index might be wrong
5195
5196 if (index === undefined || index > maxIndex) {
5197 // eslint-disable-next-line no-param-reassign
5198 return maxIndex;
5199 }
5200
5201 return index;
5202};
5203
5204var createStyle = function createStyle() {
5205 var el = document.createElement('style'); // Without it, IE will have a broken source order specificity if we
5206 // insert rules after we insert the style tag.
5207 // It seems to kick-off the source order specificity algorithm.
5208
5209 el.textContent = '\n';
5210 return el;
5211};
5212
5213var DomRenderer =
5214/*#__PURE__*/
5215function () {
5216 // Will be empty if link: true option is not set, because
5217 // it is only for use together with insertRule API.
5218 function DomRenderer(sheet) {
5219 this.getPropertyValue = getPropertyValue;
5220 this.setProperty = setProperty;
5221 this.removeProperty = removeProperty;
5222 this.setSelector = setSelector;
5223 this.hasInsertedRules = false;
5224 this.cssRules = []; // There is no sheet when the renderer is used from a standalone StyleRule.
5225
5226 if (sheet) sheets.add(sheet);
5227 this.sheet = sheet;
5228
5229 var _ref = this.sheet ? this.sheet.options : {},
5230 media = _ref.media,
5231 meta = _ref.meta,
5232 element = _ref.element;
5233
5234 this.element = element || createStyle();
5235 this.element.setAttribute('data-jss', '');
5236 if (media) this.element.setAttribute('media', media);
5237 if (meta) this.element.setAttribute('data-meta', meta);
5238 var nonce = getNonce();
5239 if (nonce) this.element.setAttribute('nonce', nonce);
5240 }
5241 /**
5242 * Insert style element into render tree.
5243 */
5244
5245
5246 var _proto = DomRenderer.prototype;
5247
5248 _proto.attach = function attach() {
5249 // In the case the element node is external and it is already in the DOM.
5250 if (this.element.parentNode || !this.sheet) return;
5251 insertStyle(this.element, this.sheet.options); // When rules are inserted using `insertRule` API, after `sheet.detach().attach()`
5252 // most browsers create a new CSSStyleSheet, except of all IEs.
5253
5254 var deployed = Boolean(this.sheet && this.sheet.deployed);
5255
5256 if (this.hasInsertedRules && deployed) {
5257 this.hasInsertedRules = false;
5258 this.deploy();
5259 }
5260 }
5261 /**
5262 * Remove style element from render tree.
5263 */
5264 ;
5265
5266 _proto.detach = function detach() {
5267 if (!this.sheet) return;
5268 var parentNode = this.element.parentNode;
5269 if (parentNode) parentNode.removeChild(this.element); // In the most browsers, rules inserted using insertRule() API will be lost when style element is removed.
5270 // Though IE will keep them and we need a consistent behavior.
5271
5272 if (this.sheet.options.link) {
5273 this.cssRules = [];
5274 this.element.textContent = '\n';
5275 }
5276 }
5277 /**
5278 * Inject CSS string into element.
5279 */
5280 ;
5281
5282 _proto.deploy = function deploy() {
5283 var sheet = this.sheet;
5284 if (!sheet) return;
5285
5286 if (sheet.options.link) {
5287 this.insertRules(sheet.rules);
5288 return;
5289 }
5290
5291 this.element.textContent = "\n" + sheet.toString() + "\n";
5292 }
5293 /**
5294 * Insert RuleList into an element.
5295 */
5296 ;
5297
5298 _proto.insertRules = function insertRules(rules, nativeParent) {
5299 for (var i = 0; i < rules.index.length; i++) {
5300 this.insertRule(rules.index[i], i, nativeParent);
5301 }
5302 }
5303 /**
5304 * Insert a rule into element.
5305 */
5306 ;
5307
5308 _proto.insertRule = function insertRule(rule, index, nativeParent) {
5309 if (nativeParent === void 0) {
5310 nativeParent = this.element.sheet;
5311 }
5312
5313 if (rule.rules) {
5314 var parent = rule;
5315 var latestNativeParent = nativeParent;
5316
5317 if (rule.type === 'conditional' || rule.type === 'keyframes') {
5318 var _insertionIndex = getValidRuleInsertionIndex(nativeParent, index); // We need to render the container without children first.
5319
5320
5321 latestNativeParent = _insertRule(nativeParent, parent.toString({
5322 children: false
5323 }), _insertionIndex);
5324
5325 if (latestNativeParent === false) {
5326 return false;
5327 }
5328
5329 this.refCssRule(rule, _insertionIndex, latestNativeParent);
5330 }
5331
5332 this.insertRules(parent.rules, latestNativeParent);
5333 return latestNativeParent;
5334 }
5335
5336 var ruleStr = rule.toString();
5337 if (!ruleStr) return false;
5338 var insertionIndex = getValidRuleInsertionIndex(nativeParent, index);
5339
5340 var nativeRule = _insertRule(nativeParent, ruleStr, insertionIndex);
5341
5342 if (nativeRule === false) {
5343 return false;
5344 }
5345
5346 this.hasInsertedRules = true;
5347 this.refCssRule(rule, insertionIndex, nativeRule);
5348 return nativeRule;
5349 };
5350
5351 _proto.refCssRule = function refCssRule(rule, index, cssRule) {
5352 rule.renderable = cssRule; // We only want to reference the top level rules, deleteRule API doesn't support removing nested rules
5353 // like rules inside media queries or keyframes
5354
5355 if (rule.options.parent instanceof StyleSheet) {
5356 this.cssRules.splice(index, 0, cssRule);
5357 }
5358 }
5359 /**
5360 * Delete a rule.
5361 */
5362 ;
5363
5364 _proto.deleteRule = function deleteRule(cssRule) {
5365 var sheet = this.element.sheet;
5366 var index = this.indexOf(cssRule);
5367 if (index === -1) return false;
5368 sheet.deleteRule(index);
5369 this.cssRules.splice(index, 1);
5370 return true;
5371 }
5372 /**
5373 * Get index of a CSS Rule.
5374 */
5375 ;
5376
5377 _proto.indexOf = function indexOf(cssRule) {
5378 return this.cssRules.indexOf(cssRule);
5379 }
5380 /**
5381 * Generate a new CSS rule and replace the existing one.
5382 */
5383 ;
5384
5385 _proto.replaceRule = function replaceRule(cssRule, rule) {
5386 var index = this.indexOf(cssRule);
5387 if (index === -1) return false;
5388 this.element.sheet.deleteRule(index);
5389 this.cssRules.splice(index, 1);
5390 return this.insertRule(rule, index);
5391 }
5392 /**
5393 * Get all rules elements.
5394 */
5395 ;
5396
5397 _proto.getRules = function getRules() {
5398 return this.element.sheet.cssRules;
5399 };
5400
5401 return DomRenderer;
5402}();
5403
5404var instanceCounter = 0;
5405
5406var Jss =
5407/*#__PURE__*/
5408function () {
5409 function Jss(options) {
5410 this.id = instanceCounter++;
5411 this.version = "10.9.2";
5412 this.plugins = new PluginsRegistry();
5413 this.options = {
5414 id: {
5415 minify: false
5416 },
5417 createGenerateId: createGenerateId,
5418 Renderer: isBrowser ? DomRenderer : null,
5419 plugins: []
5420 };
5421 this.generateId = createGenerateId({
5422 minify: false
5423 });
5424
5425 for (var i = 0; i < plugins.length; i++) {
5426 this.plugins.use(plugins[i], {
5427 queue: 'internal'
5428 });
5429 }
5430
5431 this.setup(options);
5432 }
5433 /**
5434 * Prepares various options, applies plugins.
5435 * Should not be used twice on the same instance, because there is no plugins
5436 * deduplication logic.
5437 */
5438
5439
5440 var _proto = Jss.prototype;
5441
5442 _proto.setup = function setup(options) {
5443 if (options === void 0) {
5444 options = {};
5445 }
5446
5447 if (options.createGenerateId) {
5448 this.options.createGenerateId = options.createGenerateId;
5449 }
5450
5451 if (options.id) {
5452 this.options.id = _extends({}, this.options.id, options.id);
5453 }
5454
5455 if (options.createGenerateId || options.id) {
5456 this.generateId = this.options.createGenerateId(this.options.id);
5457 }
5458
5459 if (options.insertionPoint != null) this.options.insertionPoint = options.insertionPoint;
5460
5461 if ('Renderer' in options) {
5462 this.options.Renderer = options.Renderer;
5463 } // eslint-disable-next-line prefer-spread
5464
5465
5466 if (options.plugins) this.use.apply(this, options.plugins);
5467 return this;
5468 }
5469 /**
5470 * Create a Style Sheet.
5471 */
5472 ;
5473
5474 _proto.createStyleSheet = function createStyleSheet(styles, options) {
5475 if (options === void 0) {
5476 options = {};
5477 }
5478
5479 var _options = options,
5480 index = _options.index;
5481
5482 if (typeof index !== 'number') {
5483 index = sheets.index === 0 ? 0 : sheets.index + 1;
5484 }
5485
5486 var sheet = new StyleSheet(styles, _extends({}, options, {
5487 jss: this,
5488 generateId: options.generateId || this.generateId,
5489 insertionPoint: this.options.insertionPoint,
5490 Renderer: this.options.Renderer,
5491 index: index
5492 }));
5493 this.plugins.onProcessSheet(sheet);
5494 return sheet;
5495 }
5496 /**
5497 * Detach the Style Sheet and remove it from the registry.
5498 */
5499 ;
5500
5501 _proto.removeStyleSheet = function removeStyleSheet(sheet) {
5502 sheet.detach();
5503 sheets.remove(sheet);
5504 return this;
5505 }
5506 /**
5507 * Create a rule without a Style Sheet.
5508 * [Deprecated] will be removed in the next major version.
5509 */
5510 ;
5511
5512 _proto.createRule = function createRule$1(name, style, options) {
5513 if (style === void 0) {
5514 style = {};
5515 }
5516
5517 if (options === void 0) {
5518 options = {};
5519 } // Enable rule without name for inline styles.
5520
5521
5522 if (typeof name === 'object') {
5523 return this.createRule(undefined, name, style);
5524 }
5525
5526 var ruleOptions = _extends({}, options, {
5527 name: name,
5528 jss: this,
5529 Renderer: this.options.Renderer
5530 });
5531
5532 if (!ruleOptions.generateId) ruleOptions.generateId = this.generateId;
5533 if (!ruleOptions.classes) ruleOptions.classes = {};
5534 if (!ruleOptions.keyframes) ruleOptions.keyframes = {};
5535 var rule = createRule(name, style, ruleOptions);
5536 if (rule) this.plugins.onProcessRule(rule);
5537 return rule;
5538 }
5539 /**
5540 * Register plugin. Passed function will be invoked with a rule instance.
5541 */
5542 ;
5543
5544 _proto.use = function use() {
5545 var _this = this;
5546
5547 for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
5548 plugins[_key] = arguments[_key];
5549 }
5550
5551 plugins.forEach(function (plugin) {
5552 _this.plugins.use(plugin);
5553 });
5554 return this;
5555 };
5556
5557 return Jss;
5558}();
5559
5560var createJss = function createJss(options) {
5561 return new Jss(options);
5562};
5563/**
5564 * SheetsManager is like a WeakMap which is designed to count StyleSheet
5565 * instances and attach/detach automatically.
5566 * Used in react-jss.
5567 */
5568
5569
5570var SheetsManager =
5571/*#__PURE__*/
5572function () {
5573 function SheetsManager() {
5574 this.length = 0;
5575 this.sheets = new WeakMap();
5576 }
5577
5578 var _proto = SheetsManager.prototype;
5579
5580 _proto.get = function get(key) {
5581 var entry = this.sheets.get(key);
5582 return entry && entry.sheet;
5583 };
5584
5585 _proto.add = function add(key, sheet) {
5586 if (this.sheets.has(key)) return;
5587 this.length++;
5588 this.sheets.set(key, {
5589 sheet: sheet,
5590 refs: 0
5591 });
5592 };
5593
5594 _proto.manage = function manage(key) {
5595 var entry = this.sheets.get(key);
5596
5597 if (entry) {
5598 if (entry.refs === 0) {
5599 entry.sheet.attach();
5600 }
5601
5602 entry.refs++;
5603 return entry.sheet;
5604 }
5605
5606 warning(false, "[JSS] SheetsManager: can't find sheet to manage") ;
5607 return undefined;
5608 };
5609
5610 _proto.unmanage = function unmanage(key) {
5611 var entry = this.sheets.get(key);
5612
5613 if (entry) {
5614 if (entry.refs > 0) {
5615 entry.refs--;
5616 if (entry.refs === 0) entry.sheet.detach();
5617 }
5618 } else {
5619 warning(false, "SheetsManager: can't find sheet to unmanage") ;
5620 }
5621 };
5622
5623 _createClass(SheetsManager, [{
5624 key: "size",
5625 get: function get() {
5626 return this.length;
5627 }
5628 }]);
5629
5630 return SheetsManager;
5631}();
5632/**
5633* Export a constant indicating if this browser has CSSTOM support.
5634* https://developers.google.com/web/updates/2018/03/cssom
5635*/
5636
5637
5638var hasCSSTOMSupport = typeof CSS === 'object' && CSS != null && 'number' in CSS;
5639/**
5640 * Extracts a styles object with only props that contain function values.
5641 */
5642
5643function getDynamicStyles(styles) {
5644 var to = null;
5645
5646 for (var key in styles) {
5647 var value = styles[key];
5648 var type = typeof value;
5649
5650 if (type === 'function') {
5651 if (!to) to = {};
5652 to[key] = value;
5653 } else if (type === 'object' && value !== null && !Array.isArray(value)) {
5654 var extracted = getDynamicStyles(value);
5655
5656 if (extracted) {
5657 if (!to) to = {};
5658 to[key] = extracted;
5659 }
5660 }
5661 }
5662
5663 return to;
5664}
5665/**
5666 * A better abstraction over CSS.
5667 *
5668 * @copyright Oleg Isonen (Slobodskoi) / Isonen 2014-present
5669 * @website https://github.com/cssinjs/jss
5670 * @license MIT
5671 */
5672
5673
5674var index$1 = createJss();
5675
5676var defaultManagers = new Map();
5677var getManager = function getManager(context, managerId) {
5678 // If `managers` map is present in the context, we use it in order to
5679 // let JssProvider reset them when new response has to render server-side.
5680 var managers = context.managers;
5681
5682 if (managers) {
5683 if (!managers[managerId]) {
5684 managers[managerId] = new SheetsManager();
5685 }
5686
5687 return managers[managerId];
5688 }
5689
5690 var manager = defaultManagers.get(managerId);
5691
5692 if (!manager) {
5693 manager = new SheetsManager();
5694 defaultManagers.set(managerId, manager);
5695 }
5696
5697 return manager;
5698};
5699var manageSheet = function manageSheet(options) {
5700 var sheet = options.sheet,
5701 context = options.context,
5702 index = options.index,
5703 theme = options.theme;
5704
5705 if (!sheet) {
5706 return;
5707 }
5708
5709 var manager = getManager(context, index);
5710 manager.manage(theme);
5711
5712 if (context.registry) {
5713 context.registry.add(sheet);
5714 }
5715};
5716var unmanageSheet = function unmanageSheet(options) {
5717 if (!options.sheet) {
5718 return;
5719 }
5720
5721 var manager = getManager(options.context, options.index);
5722 manager.unmanage(options.theme);
5723};
5724
5725var now = Date.now();
5726var fnValuesNs = "fnValues" + now;
5727var fnRuleNs = "fnStyle" + ++now;
5728
5729var functionPlugin = function functionPlugin() {
5730 return {
5731 onCreateRule: function onCreateRule(name, decl, options) {
5732 if (typeof decl !== 'function') return null;
5733 var rule = createRule(name, {}, options);
5734 rule[fnRuleNs] = decl;
5735 return rule;
5736 },
5737 onProcessStyle: function onProcessStyle(style, rule) {
5738 // We need to extract function values from the declaration, so that we can keep core unaware of them.
5739 // We need to do that only once.
5740 // We don't need to extract functions on each style update, since this can happen only once.
5741 // We don't support function values inside of function rules.
5742 if (fnValuesNs in rule || fnRuleNs in rule) return style;
5743 var fnValues = {};
5744
5745 for (var prop in style) {
5746 var value = style[prop];
5747 if (typeof value !== 'function') continue;
5748 delete style[prop];
5749 fnValues[prop] = value;
5750 }
5751
5752 rule[fnValuesNs] = fnValues;
5753 return style;
5754 },
5755 onUpdate: function onUpdate(data, rule, sheet, options) {
5756 var styleRule = rule;
5757 var fnRule = styleRule[fnRuleNs]; // If we have a style function, the entire rule is dynamic and style object
5758 // will be returned from that function.
5759
5760 if (fnRule) {
5761 // Empty object will remove all currently defined props
5762 // in case function rule returns a falsy value.
5763 styleRule.style = fnRule(data) || {};
5764
5765 {
5766 for (var prop in styleRule.style) {
5767 if (typeof styleRule.style[prop] === 'function') {
5768 warning(false, '[JSS] Function values inside function rules are not supported.') ;
5769 break;
5770 }
5771 }
5772 }
5773 }
5774
5775 var fnValues = styleRule[fnValuesNs]; // If we have a fn values map, it is a rule with function values.
5776
5777 if (fnValues) {
5778 for (var _prop in fnValues) {
5779 styleRule.prop(_prop, fnValues[_prop](data), options);
5780 }
5781 }
5782 }
5783 };
5784};
5785
5786function symbolObservablePonyfill(root) {
5787 var result;
5788 var Symbol = root.Symbol;
5789
5790 if (typeof Symbol === 'function') {
5791 if (Symbol.observable) {
5792 result = Symbol.observable;
5793 } else {
5794 result = Symbol('observable');
5795 Symbol.observable = result;
5796 }
5797 } else {
5798 result = '@@observable';
5799 }
5800
5801 return result;
5802}
5803
5804/* global window */
5805
5806var root;
5807
5808if (typeof self !== 'undefined') {
5809 root = self;
5810} else if (typeof window !== 'undefined') {
5811 root = window;
5812} else if (typeof global !== 'undefined') {
5813 root = global;
5814} else if (typeof module !== 'undefined') {
5815 root = module;
5816} else {
5817 root = Function('return this')();
5818}
5819
5820var result = symbolObservablePonyfill(root);
5821
5822var isObservable = function isObservable(value) {
5823 return value && value[result] && value === value[result]();
5824};
5825
5826var observablePlugin = function observablePlugin(updateOptions) {
5827 return {
5828 onCreateRule: function onCreateRule(name, decl, options) {
5829 if (!isObservable(decl)) return null;
5830 var style$ = decl;
5831 var rule = createRule(name, {}, options); // TODO
5832 // Call `stream.subscribe()` returns a subscription, which should be explicitly
5833 // unsubscribed from when we know this sheet is no longer needed.
5834
5835 style$.subscribe(function (style) {
5836 for (var prop in style) {
5837 rule.prop(prop, style[prop], updateOptions);
5838 }
5839 });
5840 return rule;
5841 },
5842 onProcessRule: function onProcessRule(rule) {
5843 if (rule && rule.type !== 'style') return;
5844 var styleRule = rule;
5845 var style = styleRule.style;
5846
5847 var _loop = function _loop(prop) {
5848 var value = style[prop];
5849 if (!isObservable(value)) return "continue";
5850 delete style[prop];
5851 value.subscribe({
5852 next: function next(nextValue) {
5853 styleRule.prop(prop, nextValue, updateOptions);
5854 }
5855 });
5856 };
5857
5858 for (var prop in style) {
5859 var _ret = _loop(prop);
5860
5861 if (_ret === "continue") continue;
5862 }
5863 }
5864 };
5865};
5866
5867var semiWithNl = /;\n/;
5868/**
5869 * Naive CSS parser.
5870 * - Supports only rule body (no selectors)
5871 * - Requires semicolon and new line after the value (except of last line)
5872 * - No nested rules support
5873 */
5874
5875var parse = function parse(cssText) {
5876 var style = {};
5877 var split = cssText.split(semiWithNl);
5878
5879 for (var i = 0; i < split.length; i++) {
5880 var decl = (split[i] || '').trim();
5881 if (!decl) continue;
5882 var colonIndex = decl.indexOf(':');
5883
5884 if (colonIndex === -1) {
5885 warning(false, "[JSS] Malformed CSS string \"" + decl + "\"") ;
5886 continue;
5887 }
5888
5889 var prop = decl.substr(0, colonIndex).trim();
5890 var value = decl.substr(colonIndex + 1).trim();
5891 style[prop] = value;
5892 }
5893
5894 return style;
5895};
5896
5897var onProcessRule = function onProcessRule(rule) {
5898 if (typeof rule.style === 'string') {
5899 rule.style = parse(rule.style);
5900 }
5901};
5902
5903function templatePlugin() {
5904 return {
5905 onProcessRule: onProcessRule
5906 };
5907}
5908
5909var at = '@global';
5910var atPrefix = '@global ';
5911
5912var GlobalContainerRule =
5913/*#__PURE__*/
5914function () {
5915 function GlobalContainerRule(key, styles, options) {
5916 this.type = 'global';
5917 this.at = at;
5918 this.isProcessed = false;
5919 this.key = key;
5920 this.options = options;
5921 this.rules = new RuleList(_extends({}, options, {
5922 parent: this
5923 }));
5924
5925 for (var selector in styles) {
5926 this.rules.add(selector, styles[selector]);
5927 }
5928
5929 this.rules.process();
5930 }
5931 /**
5932 * Get a rule.
5933 */
5934
5935
5936 var _proto = GlobalContainerRule.prototype;
5937
5938 _proto.getRule = function getRule(name) {
5939 return this.rules.get(name);
5940 }
5941 /**
5942 * Create and register rule, run plugins.
5943 */
5944 ;
5945
5946 _proto.addRule = function addRule(name, style, options) {
5947 var rule = this.rules.add(name, style, options);
5948 if (rule) this.options.jss.plugins.onProcessRule(rule);
5949 return rule;
5950 }
5951 /**
5952 * Replace rule, run plugins.
5953 */
5954 ;
5955
5956 _proto.replaceRule = function replaceRule(name, style, options) {
5957 var newRule = this.rules.replace(name, style, options);
5958 if (newRule) this.options.jss.plugins.onProcessRule(newRule);
5959 return newRule;
5960 }
5961 /**
5962 * Get index of a rule.
5963 */
5964 ;
5965
5966 _proto.indexOf = function indexOf(rule) {
5967 return this.rules.indexOf(rule);
5968 }
5969 /**
5970 * Generates a CSS string.
5971 */
5972 ;
5973
5974 _proto.toString = function toString(options) {
5975 return this.rules.toString(options);
5976 };
5977
5978 return GlobalContainerRule;
5979}();
5980
5981var GlobalPrefixedRule =
5982/*#__PURE__*/
5983function () {
5984 function GlobalPrefixedRule(key, style, options) {
5985 this.type = 'global';
5986 this.at = at;
5987 this.isProcessed = false;
5988 this.key = key;
5989 this.options = options;
5990 var selector = key.substr(atPrefix.length);
5991 this.rule = options.jss.createRule(selector, style, _extends({}, options, {
5992 parent: this
5993 }));
5994 }
5995
5996 var _proto2 = GlobalPrefixedRule.prototype;
5997
5998 _proto2.toString = function toString(options) {
5999 return this.rule ? this.rule.toString(options) : '';
6000 };
6001
6002 return GlobalPrefixedRule;
6003}();
6004
6005var separatorRegExp = /\s*,\s*/g;
6006
6007function addScope(selector, scope) {
6008 var parts = selector.split(separatorRegExp);
6009 var scoped = '';
6010
6011 for (var i = 0; i < parts.length; i++) {
6012 scoped += scope + " " + parts[i].trim();
6013 if (parts[i + 1]) scoped += ', ';
6014 }
6015
6016 return scoped;
6017}
6018
6019function handleNestedGlobalContainerRule(rule, sheet) {
6020 var options = rule.options,
6021 style = rule.style;
6022 var rules = style ? style[at] : null;
6023 if (!rules) return;
6024
6025 for (var name in rules) {
6026 sheet.addRule(name, rules[name], _extends({}, options, {
6027 selector: addScope(name, rule.selector)
6028 }));
6029 }
6030
6031 delete style[at];
6032}
6033
6034function handlePrefixedGlobalRule(rule, sheet) {
6035 var options = rule.options,
6036 style = rule.style;
6037
6038 for (var prop in style) {
6039 if (prop[0] !== '@' || prop.substr(0, at.length) !== at) continue;
6040 var selector = addScope(prop.substr(at.length), rule.selector);
6041 sheet.addRule(selector, style[prop], _extends({}, options, {
6042 selector: selector
6043 }));
6044 delete style[prop];
6045 }
6046}
6047/**
6048 * Convert nested rules to separate, remove them from original styles.
6049 */
6050
6051
6052function jssGlobal() {
6053 function onCreateRule(name, styles, options) {
6054 if (!name) return null;
6055
6056 if (name === at) {
6057 return new GlobalContainerRule(name, styles, options);
6058 }
6059
6060 if (name[0] === '@' && name.substr(0, atPrefix.length) === atPrefix) {
6061 return new GlobalPrefixedRule(name, styles, options);
6062 }
6063
6064 var parent = options.parent;
6065
6066 if (parent) {
6067 if (parent.type === 'global' || parent.options.parent && parent.options.parent.type === 'global') {
6068 options.scoped = false;
6069 }
6070 }
6071
6072 if (!options.selector && options.scoped === false) {
6073 options.selector = name;
6074 }
6075
6076 return null;
6077 }
6078
6079 function onProcessRule(rule, sheet) {
6080 if (rule.type !== 'style' || !sheet) return;
6081 handleNestedGlobalContainerRule(rule, sheet);
6082 handlePrefixedGlobalRule(rule, sheet);
6083 }
6084
6085 return {
6086 onCreateRule: onCreateRule,
6087 onProcessRule: onProcessRule
6088 };
6089}
6090
6091var isObject$1 = function isObject(obj) {
6092 return obj && typeof obj === 'object' && !Array.isArray(obj);
6093};
6094
6095var valueNs = "extendCurrValue" + Date.now();
6096
6097function mergeExtend(style, rule, sheet, newStyle) {
6098 var extendType = typeof style.extend; // Extend using a rule name.
6099
6100 if (extendType === 'string') {
6101 if (!sheet) return;
6102 var refRule = sheet.getRule(style.extend);
6103 if (!refRule) return;
6104
6105 if (refRule === rule) {
6106 warning(false, "[JSS] A rule tries to extend itself \n" + rule.toString()) ;
6107 return;
6108 }
6109
6110 var parent = refRule.options.parent;
6111
6112 if (parent) {
6113 var originalStyle = parent.rules.raw[style.extend];
6114 extend(originalStyle, rule, sheet, newStyle);
6115 }
6116
6117 return;
6118 } // Extend using an array.
6119
6120
6121 if (Array.isArray(style.extend)) {
6122 for (var index = 0; index < style.extend.length; index++) {
6123 var singleExtend = style.extend[index];
6124 var singleStyle = typeof singleExtend === 'string' ? _extends({}, style, {
6125 extend: singleExtend
6126 }) : style.extend[index];
6127 extend(singleStyle, rule, sheet, newStyle);
6128 }
6129
6130 return;
6131 } // Extend is a style object.
6132
6133
6134 for (var prop in style.extend) {
6135 if (prop === 'extend') {
6136 extend(style.extend.extend, rule, sheet, newStyle);
6137 continue;
6138 }
6139
6140 if (isObject$1(style.extend[prop])) {
6141 if (!(prop in newStyle)) newStyle[prop] = {};
6142 extend(style.extend[prop], rule, sheet, newStyle[prop]);
6143 continue;
6144 }
6145
6146 newStyle[prop] = style.extend[prop];
6147 }
6148}
6149
6150function mergeRest(style, rule, sheet, newStyle) {
6151 // Copy base style.
6152 for (var prop in style) {
6153 if (prop === 'extend') continue;
6154
6155 if (isObject$1(newStyle[prop]) && isObject$1(style[prop])) {
6156 extend(style[prop], rule, sheet, newStyle[prop]);
6157 continue;
6158 }
6159
6160 if (isObject$1(style[prop])) {
6161 newStyle[prop] = extend(style[prop], rule, sheet);
6162 continue;
6163 }
6164
6165 newStyle[prop] = style[prop];
6166 }
6167}
6168/**
6169 * Recursively extend styles.
6170 */
6171
6172
6173function extend(style, rule, sheet, newStyle) {
6174 if (newStyle === void 0) {
6175 newStyle = {};
6176 }
6177
6178 mergeExtend(style, rule, sheet, newStyle);
6179 mergeRest(style, rule, sheet, newStyle);
6180 return newStyle;
6181}
6182/**
6183 * Handle `extend` property.
6184 */
6185
6186
6187function jssExtend() {
6188 function onProcessStyle(style, rule, sheet) {
6189 if ('extend' in style) return extend(style, rule, sheet);
6190 return style;
6191 }
6192
6193 function onChangeValue(value, prop, rule) {
6194 if (prop !== 'extend') return value; // Value is empty, remove properties set previously.
6195
6196 if (value == null || value === false) {
6197 for (var key in rule[valueNs]) {
6198 rule.prop(key, null);
6199 }
6200
6201 rule[valueNs] = null;
6202 return null;
6203 }
6204
6205 if (typeof value === 'object') {
6206 for (var _key in value) {
6207 rule.prop(_key, value[_key]);
6208 }
6209
6210 rule[valueNs] = value;
6211 } // Make sure we don't set the value in the core.
6212
6213
6214 return null;
6215 }
6216
6217 return {
6218 onProcessStyle: onProcessStyle,
6219 onChangeValue: onChangeValue
6220 };
6221}
6222
6223var separatorRegExp$1 = /\s*,\s*/g;
6224var parentRegExp = /&/g;
6225var refRegExp$1 = /\$([\w-]+)/g;
6226/**
6227 * Convert nested rules to separate, remove them from original styles.
6228 */
6229
6230function jssNested() {
6231 // Get a function to be used for $ref replacement.
6232 function getReplaceRef(container, sheet) {
6233 return function (match, key) {
6234 var rule = container.getRule(key) || sheet && sheet.getRule(key);
6235
6236 if (rule) {
6237 return rule.selector;
6238 }
6239
6240 warning(false, "[JSS] Could not find the referenced rule \"" + key + "\" in \"" + (container.options.meta || container.toString()) + "\".") ;
6241 return key;
6242 };
6243 }
6244
6245 function replaceParentRefs(nestedProp, parentProp) {
6246 var parentSelectors = parentProp.split(separatorRegExp$1);
6247 var nestedSelectors = nestedProp.split(separatorRegExp$1);
6248 var result = '';
6249
6250 for (var i = 0; i < parentSelectors.length; i++) {
6251 var parent = parentSelectors[i];
6252
6253 for (var j = 0; j < nestedSelectors.length; j++) {
6254 var nested = nestedSelectors[j];
6255 if (result) result += ', '; // Replace all & by the parent or prefix & with the parent.
6256
6257 result += nested.indexOf('&') !== -1 ? nested.replace(parentRegExp, parent) : parent + " " + nested;
6258 }
6259 }
6260
6261 return result;
6262 }
6263
6264 function getOptions(rule, container, prevOptions) {
6265 // Options has been already created, now we only increase index.
6266 if (prevOptions) return _extends({}, prevOptions, {
6267 index: prevOptions.index + 1
6268 });
6269 var nestingLevel = rule.options.nestingLevel;
6270 nestingLevel = nestingLevel === undefined ? 1 : nestingLevel + 1;
6271
6272 var options = _extends({}, rule.options, {
6273 nestingLevel: nestingLevel,
6274 index: container.indexOf(rule) + 1 // We don't need the parent name to be set options for chlid.
6275
6276 });
6277
6278 delete options.name;
6279 return options;
6280 }
6281
6282 function onProcessStyle(style, rule, sheet) {
6283 if (rule.type !== 'style') return style;
6284 var styleRule = rule;
6285 var container = styleRule.options.parent;
6286 var options;
6287 var replaceRef;
6288
6289 for (var prop in style) {
6290 var isNested = prop.indexOf('&') !== -1;
6291 var isNestedConditional = prop[0] === '@';
6292 if (!isNested && !isNestedConditional) continue;
6293 options = getOptions(styleRule, container, options);
6294
6295 if (isNested) {
6296 var selector = replaceParentRefs(prop, styleRule.selector); // Lazily create the ref replacer function just once for
6297 // all nested rules within the sheet.
6298
6299 if (!replaceRef) replaceRef = getReplaceRef(container, sheet); // Replace all $refs.
6300
6301 selector = selector.replace(refRegExp$1, replaceRef);
6302 var name = styleRule.key + "-" + prop;
6303
6304 if ('replaceRule' in container) {
6305 // for backward compatibility
6306 container.replaceRule(name, style[prop], _extends({}, options, {
6307 selector: selector
6308 }));
6309 } else {
6310 container.addRule(name, style[prop], _extends({}, options, {
6311 selector: selector
6312 }));
6313 }
6314 } else if (isNestedConditional) {
6315 // Place conditional right after the parent rule to ensure right ordering.
6316 container.addRule(prop, {}, options).addRule(styleRule.key, style[prop], {
6317 selector: styleRule.selector
6318 });
6319 }
6320
6321 delete style[prop];
6322 }
6323
6324 return style;
6325 }
6326
6327 return {
6328 onProcessStyle: onProcessStyle
6329 };
6330}
6331
6332/**
6333 * Set selector.
6334 *
6335 * @param original rule
6336 * @param className class string
6337 * @return flag indicating function was successfull or not
6338 */
6339
6340function registerClass(rule, className) {
6341 // Skip falsy values
6342 if (!className) return true; // Support array of class names `{composes: ['foo', 'bar']}`
6343
6344 if (Array.isArray(className)) {
6345 for (var index = 0; index < className.length; index++) {
6346 var isSetted = registerClass(rule, className[index]);
6347 if (!isSetted) return false;
6348 }
6349
6350 return true;
6351 } // Support space separated class names `{composes: 'foo bar'}`
6352
6353
6354 if (className.indexOf(' ') > -1) {
6355 return registerClass(rule, className.split(' '));
6356 }
6357
6358 var parent = rule.options.parent; // It is a ref to a local rule.
6359
6360 if (className[0] === '$') {
6361 var refRule = parent.getRule(className.substr(1));
6362
6363 if (!refRule) {
6364 warning(false, "[JSS] Referenced rule is not defined. \n" + rule.toString()) ;
6365 return false;
6366 }
6367
6368 if (refRule === rule) {
6369 warning(false, "[JSS] Cyclic composition detected. \n" + rule.toString()) ;
6370 return false;
6371 }
6372
6373 parent.classes[rule.key] += " " + parent.classes[refRule.key];
6374 return true;
6375 }
6376
6377 parent.classes[rule.key] += " " + className;
6378 return true;
6379}
6380/**
6381 * Convert compose property to additional class, remove property from original styles.
6382 */
6383
6384
6385function jssCompose() {
6386 function onProcessStyle(style, rule) {
6387 if (!('composes' in style)) return style;
6388 registerClass(rule, style.composes); // Remove composes property to prevent infinite loop.
6389
6390 delete style.composes;
6391 return style;
6392 }
6393
6394 return {
6395 onProcessStyle: onProcessStyle
6396 };
6397}
6398
6399/* eslint-disable no-var, prefer-template */
6400var uppercasePattern = /[A-Z]/g;
6401var msPattern = /^ms-/;
6402var cache = {};
6403
6404function toHyphenLower(match) {
6405 return '-' + match.toLowerCase()
6406}
6407
6408function hyphenateStyleName(name) {
6409 if (cache.hasOwnProperty(name)) {
6410 return cache[name]
6411 }
6412
6413 var hName = name.replace(uppercasePattern, toHyphenLower);
6414 return (cache[name] = msPattern.test(hName) ? '-' + hName : hName)
6415}
6416
6417/**
6418 * Convert camel cased property names to dash separated.
6419 */
6420
6421function convertCase(style) {
6422 var converted = {};
6423
6424 for (var prop in style) {
6425 var key = prop.indexOf('--') === 0 ? prop : hyphenateStyleName(prop);
6426 converted[key] = style[prop];
6427 }
6428
6429 if (style.fallbacks) {
6430 if (Array.isArray(style.fallbacks)) converted.fallbacks = style.fallbacks.map(convertCase);else converted.fallbacks = convertCase(style.fallbacks);
6431 }
6432
6433 return converted;
6434}
6435/**
6436 * Allow camel cased property names by converting them back to dasherized.
6437 */
6438
6439
6440function camelCase() {
6441 function onProcessStyle(style) {
6442 if (Array.isArray(style)) {
6443 // Handle rules like @font-face, which can have multiple styles in an array
6444 for (var index = 0; index < style.length; index++) {
6445 style[index] = convertCase(style[index]);
6446 }
6447
6448 return style;
6449 }
6450
6451 return convertCase(style);
6452 }
6453
6454 function onChangeValue(value, prop, rule) {
6455 if (prop.indexOf('--') === 0) {
6456 return value;
6457 }
6458
6459 var hyphenatedProp = hyphenateStyleName(prop); // There was no camel case in place
6460
6461 if (prop === hyphenatedProp) return value;
6462 rule.prop(hyphenatedProp, value); // Core will ignore that property value we set the proper one above.
6463
6464 return null;
6465 }
6466
6467 return {
6468 onProcessStyle: onProcessStyle,
6469 onChangeValue: onChangeValue
6470 };
6471}
6472
6473var px = hasCSSTOMSupport && CSS ? CSS.px : 'px';
6474var ms = hasCSSTOMSupport && CSS ? CSS.ms : 'ms';
6475var percent = hasCSSTOMSupport && CSS ? CSS.percent : '%';
6476/**
6477 * Generated jss-plugin-default-unit CSS property units
6478 */
6479
6480var defaultUnits = {
6481 // Animation properties
6482 'animation-delay': ms,
6483 'animation-duration': ms,
6484 // Background properties
6485 'background-position': px,
6486 'background-position-x': px,
6487 'background-position-y': px,
6488 'background-size': px,
6489 // Border Properties
6490 border: px,
6491 'border-bottom': px,
6492 'border-bottom-left-radius': px,
6493 'border-bottom-right-radius': px,
6494 'border-bottom-width': px,
6495 'border-left': px,
6496 'border-left-width': px,
6497 'border-radius': px,
6498 'border-right': px,
6499 'border-right-width': px,
6500 'border-top': px,
6501 'border-top-left-radius': px,
6502 'border-top-right-radius': px,
6503 'border-top-width': px,
6504 'border-width': px,
6505 'border-block': px,
6506 'border-block-end': px,
6507 'border-block-end-width': px,
6508 'border-block-start': px,
6509 'border-block-start-width': px,
6510 'border-block-width': px,
6511 'border-inline': px,
6512 'border-inline-end': px,
6513 'border-inline-end-width': px,
6514 'border-inline-start': px,
6515 'border-inline-start-width': px,
6516 'border-inline-width': px,
6517 'border-start-start-radius': px,
6518 'border-start-end-radius': px,
6519 'border-end-start-radius': px,
6520 'border-end-end-radius': px,
6521 // Margin properties
6522 margin: px,
6523 'margin-bottom': px,
6524 'margin-left': px,
6525 'margin-right': px,
6526 'margin-top': px,
6527 'margin-block': px,
6528 'margin-block-end': px,
6529 'margin-block-start': px,
6530 'margin-inline': px,
6531 'margin-inline-end': px,
6532 'margin-inline-start': px,
6533 // Padding properties
6534 padding: px,
6535 'padding-bottom': px,
6536 'padding-left': px,
6537 'padding-right': px,
6538 'padding-top': px,
6539 'padding-block': px,
6540 'padding-block-end': px,
6541 'padding-block-start': px,
6542 'padding-inline': px,
6543 'padding-inline-end': px,
6544 'padding-inline-start': px,
6545 // Mask properties
6546 'mask-position-x': px,
6547 'mask-position-y': px,
6548 'mask-size': px,
6549 // Width and height properties
6550 height: px,
6551 width: px,
6552 'min-height': px,
6553 'max-height': px,
6554 'min-width': px,
6555 'max-width': px,
6556 // Position properties
6557 bottom: px,
6558 left: px,
6559 top: px,
6560 right: px,
6561 inset: px,
6562 'inset-block': px,
6563 'inset-block-end': px,
6564 'inset-block-start': px,
6565 'inset-inline': px,
6566 'inset-inline-end': px,
6567 'inset-inline-start': px,
6568 // Shadow properties
6569 'box-shadow': px,
6570 'text-shadow': px,
6571 // Column properties
6572 'column-gap': px,
6573 'column-rule': px,
6574 'column-rule-width': px,
6575 'column-width': px,
6576 // Font and text properties
6577 'font-size': px,
6578 'font-size-delta': px,
6579 'letter-spacing': px,
6580 'text-decoration-thickness': px,
6581 'text-indent': px,
6582 'text-stroke': px,
6583 'text-stroke-width': px,
6584 'word-spacing': px,
6585 // Motion properties
6586 motion: px,
6587 'motion-offset': px,
6588 // Outline properties
6589 outline: px,
6590 'outline-offset': px,
6591 'outline-width': px,
6592 // Perspective properties
6593 perspective: px,
6594 'perspective-origin-x': percent,
6595 'perspective-origin-y': percent,
6596 // Transform properties
6597 'transform-origin': percent,
6598 'transform-origin-x': percent,
6599 'transform-origin-y': percent,
6600 'transform-origin-z': percent,
6601 // Transition properties
6602 'transition-delay': ms,
6603 'transition-duration': ms,
6604 // Alignment properties
6605 'vertical-align': px,
6606 'flex-basis': px,
6607 // Some random properties
6608 'shape-margin': px,
6609 size: px,
6610 gap: px,
6611 // Grid properties
6612 grid: px,
6613 'grid-gap': px,
6614 'row-gap': px,
6615 'grid-row-gap': px,
6616 'grid-column-gap': px,
6617 'grid-template-rows': px,
6618 'grid-template-columns': px,
6619 'grid-auto-rows': px,
6620 'grid-auto-columns': px,
6621 // Not existing properties.
6622 // Used to avoid issues with jss-plugin-expand integration.
6623 'box-shadow-x': px,
6624 'box-shadow-y': px,
6625 'box-shadow-blur': px,
6626 'box-shadow-spread': px,
6627 'font-line-height': px,
6628 'text-shadow-x': px,
6629 'text-shadow-y': px,
6630 'text-shadow-blur': px
6631};
6632/**
6633 * Clones the object and adds a camel cased property version.
6634 */
6635
6636function addCamelCasedVersion(obj) {
6637 var regExp = /(-[a-z])/g;
6638
6639 var replace = function replace(str) {
6640 return str[1].toUpperCase();
6641 };
6642
6643 var newObj = {};
6644
6645 for (var key in obj) {
6646 newObj[key] = obj[key];
6647 newObj[key.replace(regExp, replace)] = obj[key];
6648 }
6649
6650 return newObj;
6651}
6652
6653var units = addCamelCasedVersion(defaultUnits);
6654/**
6655 * Recursive deep style passing function
6656 */
6657
6658function iterate(prop, value, options) {
6659 if (value == null) return value;
6660
6661 if (Array.isArray(value)) {
6662 for (var i = 0; i < value.length; i++) {
6663 value[i] = iterate(prop, value[i], options);
6664 }
6665 } else if (typeof value === 'object') {
6666 if (prop === 'fallbacks') {
6667 for (var innerProp in value) {
6668 value[innerProp] = iterate(innerProp, value[innerProp], options);
6669 }
6670 } else {
6671 for (var _innerProp in value) {
6672 value[_innerProp] = iterate(prop + "-" + _innerProp, value[_innerProp], options);
6673 }
6674 } // eslint-disable-next-line no-restricted-globals
6675
6676 } else if (typeof value === 'number' && isNaN(value) === false) {
6677 var unit = options[prop] || units[prop]; // Add the unit if available, except for the special case of 0px.
6678
6679 if (unit && !(value === 0 && unit === px)) {
6680 return typeof unit === 'function' ? unit(value).toString() : "" + value + unit;
6681 }
6682
6683 return value.toString();
6684 }
6685
6686 return value;
6687}
6688/**
6689 * Add unit to numeric values.
6690 */
6691
6692
6693function defaultUnit(options) {
6694 if (options === void 0) {
6695 options = {};
6696 }
6697
6698 var camelCasedOptions = addCamelCasedVersion(options);
6699
6700 function onProcessStyle(style, rule) {
6701 if (rule.type !== 'style') return style;
6702
6703 for (var prop in style) {
6704 style[prop] = iterate(prop, style[prop], camelCasedOptions);
6705 }
6706
6707 return style;
6708 }
6709
6710 function onChangeValue(value, prop) {
6711 return iterate(prop, value, camelCasedOptions);
6712 }
6713
6714 return {
6715 onProcessStyle: onProcessStyle,
6716 onChangeValue: onChangeValue
6717 };
6718}
6719
6720/**
6721 * A scheme for converting properties from array to regular style.
6722 * All properties listed below will be transformed to a string separated by space.
6723 */
6724var propArray = {
6725 'background-size': true,
6726 'background-position': true,
6727 border: true,
6728 'border-bottom': true,
6729 'border-left': true,
6730 'border-top': true,
6731 'border-right': true,
6732 'border-radius': true,
6733 'border-image': true,
6734 'border-width': true,
6735 'border-style': true,
6736 'border-color': true,
6737 'box-shadow': true,
6738 flex: true,
6739 margin: true,
6740 padding: true,
6741 outline: true,
6742 'transform-origin': true,
6743 transform: true,
6744 transition: true
6745 /**
6746 * A scheme for converting arrays to regular styles inside of objects.
6747 * For e.g.: "{position: [0, 0]}" => "background-position: 0 0;".
6748 */
6749
6750};
6751var propArrayInObj = {
6752 position: true,
6753 // background-position
6754 size: true // background-size
6755
6756 /**
6757 * A scheme for parsing and building correct styles from passed objects.
6758 */
6759
6760};
6761var propObj = {
6762 padding: {
6763 top: 0,
6764 right: 0,
6765 bottom: 0,
6766 left: 0
6767 },
6768 margin: {
6769 top: 0,
6770 right: 0,
6771 bottom: 0,
6772 left: 0
6773 },
6774 background: {
6775 attachment: null,
6776 color: null,
6777 image: null,
6778 position: null,
6779 repeat: null
6780 },
6781 border: {
6782 width: null,
6783 style: null,
6784 color: null
6785 },
6786 'border-top': {
6787 width: null,
6788 style: null,
6789 color: null
6790 },
6791 'border-right': {
6792 width: null,
6793 style: null,
6794 color: null
6795 },
6796 'border-bottom': {
6797 width: null,
6798 style: null,
6799 color: null
6800 },
6801 'border-left': {
6802 width: null,
6803 style: null,
6804 color: null
6805 },
6806 outline: {
6807 width: null,
6808 style: null,
6809 color: null
6810 },
6811 'list-style': {
6812 type: null,
6813 position: null,
6814 image: null
6815 },
6816 transition: {
6817 property: null,
6818 duration: null,
6819 'timing-function': null,
6820 timingFunction: null,
6821 // Needed for avoiding comilation issues with jss-plugin-camel-case
6822 delay: null
6823 },
6824 animation: {
6825 name: null,
6826 duration: null,
6827 'timing-function': null,
6828 timingFunction: null,
6829 // Needed to avoid compilation issues with jss-plugin-camel-case
6830 delay: null,
6831 'iteration-count': null,
6832 iterationCount: null,
6833 // Needed to avoid compilation issues with jss-plugin-camel-case
6834 direction: null,
6835 'fill-mode': null,
6836 fillMode: null,
6837 // Needed to avoid compilation issues with jss-plugin-camel-case
6838 'play-state': null,
6839 playState: null // Needed to avoid compilation issues with jss-plugin-camel-case
6840
6841 },
6842 'box-shadow': {
6843 x: 0,
6844 y: 0,
6845 blur: 0,
6846 spread: 0,
6847 color: null,
6848 inset: null
6849 },
6850 'text-shadow': {
6851 x: 0,
6852 y: 0,
6853 blur: null,
6854 color: null
6855 /**
6856 * A scheme for converting non-standart properties inside object.
6857 * For e.g.: include 'border-radius' property inside 'border' object.
6858 */
6859
6860 }
6861};
6862var customPropObj = {
6863 border: {
6864 radius: 'border-radius',
6865 image: 'border-image',
6866 width: 'border-width',
6867 style: 'border-style',
6868 color: 'border-color'
6869 },
6870 'border-bottom': {
6871 width: 'border-bottom-width',
6872 style: 'border-bottom-style',
6873 color: 'border-bottom-color'
6874 },
6875 'border-top': {
6876 width: 'border-top-width',
6877 style: 'border-top-style',
6878 color: 'border-top-color'
6879 },
6880 'border-left': {
6881 width: 'border-left-width',
6882 style: 'border-left-style',
6883 color: 'border-left-color'
6884 },
6885 'border-right': {
6886 width: 'border-right-width',
6887 style: 'border-right-style',
6888 color: 'border-right-color'
6889 },
6890 background: {
6891 size: 'background-size',
6892 image: 'background-image'
6893 },
6894 font: {
6895 style: 'font-style',
6896 variant: 'font-variant',
6897 weight: 'font-weight',
6898 stretch: 'font-stretch',
6899 size: 'font-size',
6900 family: 'font-family',
6901 lineHeight: 'line-height',
6902 // Needed to avoid compilation issues with jss-plugin-camel-case
6903 'line-height': 'line-height'
6904 },
6905 flex: {
6906 grow: 'flex-grow',
6907 basis: 'flex-basis',
6908 direction: 'flex-direction',
6909 wrap: 'flex-wrap',
6910 flow: 'flex-flow',
6911 shrink: 'flex-shrink'
6912 },
6913 align: {
6914 self: 'align-self',
6915 items: 'align-items',
6916 content: 'align-content'
6917 },
6918 grid: {
6919 'template-columns': 'grid-template-columns',
6920 templateColumns: 'grid-template-columns',
6921 'template-rows': 'grid-template-rows',
6922 templateRows: 'grid-template-rows',
6923 'template-areas': 'grid-template-areas',
6924 templateAreas: 'grid-template-areas',
6925 template: 'grid-template',
6926 'auto-columns': 'grid-auto-columns',
6927 autoColumns: 'grid-auto-columns',
6928 'auto-rows': 'grid-auto-rows',
6929 autoRows: 'grid-auto-rows',
6930 'auto-flow': 'grid-auto-flow',
6931 autoFlow: 'grid-auto-flow',
6932 row: 'grid-row',
6933 column: 'grid-column',
6934 'row-start': 'grid-row-start',
6935 rowStart: 'grid-row-start',
6936 'row-end': 'grid-row-end',
6937 rowEnd: 'grid-row-end',
6938 'column-start': 'grid-column-start',
6939 columnStart: 'grid-column-start',
6940 'column-end': 'grid-column-end',
6941 columnEnd: 'grid-column-end',
6942 area: 'grid-area',
6943 gap: 'grid-gap',
6944 'row-gap': 'grid-row-gap',
6945 rowGap: 'grid-row-gap',
6946 'column-gap': 'grid-column-gap',
6947 columnGap: 'grid-column-gap'
6948 }
6949};
6950/* eslint-disable no-use-before-define */
6951
6952/**
6953 * Map values by given prop.
6954 *
6955 * @param {Array} array of values
6956 * @param {String} original property
6957 * @param {String} original rule
6958 * @return {String} mapped values
6959 */
6960
6961function mapValuesByProp(value, prop, rule) {
6962 return value.map(function (item) {
6963 return objectToArray(item, prop, rule, false, true);
6964 });
6965}
6966/**
6967 * Convert array to nested array, if needed
6968 */
6969
6970
6971function processArray(value, prop, scheme, rule) {
6972 if (scheme[prop] == null) return value;
6973 if (value.length === 0) return [];
6974 if (Array.isArray(value[0])) return processArray(value[0], prop, scheme, rule);
6975
6976 if (typeof value[0] === 'object') {
6977 return mapValuesByProp(value, prop, rule);
6978 }
6979
6980 return [value];
6981}
6982/**
6983 * Convert object to array.
6984 */
6985
6986
6987function objectToArray(value, prop, rule, isFallback, isInArray) {
6988 if (!(propObj[prop] || customPropObj[prop])) return [];
6989 var result = []; // Check if exists any non-standard property
6990
6991 if (customPropObj[prop]) {
6992 // eslint-disable-next-line no-param-reassign
6993 value = customPropsToStyle(value, rule, customPropObj[prop], isFallback);
6994 } // Pass throught all standart props
6995
6996
6997 if (Object.keys(value).length) {
6998 for (var baseProp in propObj[prop]) {
6999 if (value[baseProp]) {
7000 if (Array.isArray(value[baseProp])) {
7001 result.push(propArrayInObj[baseProp] === null ? value[baseProp] : value[baseProp].join(' '));
7002 } else result.push(value[baseProp]);
7003
7004 continue;
7005 } // Add default value from props config.
7006
7007
7008 if (propObj[prop][baseProp] != null) {
7009 result.push(propObj[prop][baseProp]);
7010 }
7011 }
7012 }
7013
7014 if (!result.length || isInArray) return result;
7015 return [result];
7016}
7017/**
7018 * Convert custom properties values to styles adding them to rule directly
7019 */
7020
7021
7022function customPropsToStyle(value, rule, customProps, isFallback) {
7023 for (var prop in customProps) {
7024 var propName = customProps[prop]; // If current property doesn't exist already in rule - add new one
7025
7026 if (typeof value[prop] !== 'undefined' && (isFallback || !rule.prop(propName))) {
7027 var _styleDetector;
7028
7029 var appendedValue = styleDetector((_styleDetector = {}, _styleDetector[propName] = value[prop], _styleDetector), rule)[propName]; // Add style directly in rule
7030
7031 if (isFallback) rule.style.fallbacks[propName] = appendedValue;else rule.style[propName] = appendedValue;
7032 } // Delete converted property to avoid double converting
7033
7034
7035 delete value[prop];
7036 }
7037
7038 return value;
7039}
7040/**
7041 * Detect if a style needs to be converted.
7042 */
7043
7044
7045function styleDetector(style, rule, isFallback) {
7046 for (var prop in style) {
7047 var value = style[prop];
7048
7049 if (Array.isArray(value)) {
7050 // Check double arrays to avoid recursion.
7051 if (!Array.isArray(value[0])) {
7052 if (prop === 'fallbacks') {
7053 for (var index = 0; index < style.fallbacks.length; index++) {
7054 style.fallbacks[index] = styleDetector(style.fallbacks[index], rule, true);
7055 }
7056
7057 continue;
7058 }
7059
7060 style[prop] = processArray(value, prop, propArray, rule); // Avoid creating properties with empty values
7061
7062 if (!style[prop].length) delete style[prop];
7063 }
7064 } else if (typeof value === 'object') {
7065 if (prop === 'fallbacks') {
7066 style.fallbacks = styleDetector(style.fallbacks, rule, true);
7067 continue;
7068 }
7069
7070 style[prop] = objectToArray(value, prop, rule, isFallback); // Avoid creating properties with empty values
7071
7072 if (!style[prop].length) delete style[prop];
7073 } // Maybe a computed value resulting in an empty string
7074 else if (style[prop] === '') delete style[prop];
7075 }
7076
7077 return style;
7078}
7079/**
7080 * Adds possibility to write expanded styles.
7081 */
7082
7083
7084function jssExpand() {
7085 function onProcessStyle(style, rule) {
7086 if (!style || rule.type !== 'style') return style;
7087
7088 if (Array.isArray(style)) {
7089 // Pass rules one by one and reformat them
7090 for (var index = 0; index < style.length; index++) {
7091 style[index] = styleDetector(style[index], rule);
7092 }
7093
7094 return style;
7095 }
7096
7097 return styleDetector(style, rule);
7098 }
7099
7100 return {
7101 onProcessStyle: onProcessStyle
7102 };
7103}
7104
7105function _arrayLikeToArray(arr, len) {
7106 if (len == null || len > arr.length) len = arr.length;
7107
7108 for (var i = 0, arr2 = new Array(len); i < len; i++) {
7109 arr2[i] = arr[i];
7110 }
7111
7112 return arr2;
7113}
7114
7115function _arrayWithoutHoles(arr) {
7116 if (Array.isArray(arr)) return _arrayLikeToArray(arr);
7117}
7118
7119function _iterableToArray(iter) {
7120 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
7121}
7122
7123function _unsupportedIterableToArray(o, minLen) {
7124 if (!o) return;
7125 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
7126 var n = Object.prototype.toString.call(o).slice(8, -1);
7127 if (n === "Object" && o.constructor) n = o.constructor.name;
7128 if (n === "Map" || n === "Set") return Array.from(n);
7129 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
7130}
7131
7132function _nonIterableSpread() {
7133 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7134}
7135
7136function _toConsumableArray(arr) {
7137 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
7138}
7139
7140// Export javascript style and css style vendor prefixes.
7141var js = '';
7142var css = '';
7143var vendor = '';
7144var browser = '';
7145var isTouch = isBrowser && 'ontouchstart' in document.documentElement; // We should not do anything if required serverside.
7146
7147if (isBrowser) {
7148 // Order matters. We need to check Webkit the last one because
7149 // other vendors use to add Webkit prefixes to some properties
7150 var jsCssMap = {
7151 Moz: '-moz-',
7152 ms: '-ms-',
7153 O: '-o-',
7154 Webkit: '-webkit-'
7155 };
7156
7157 var _document$createEleme = document.createElement('p'),
7158 style = _document$createEleme.style;
7159
7160 var testProp = 'Transform';
7161
7162 for (var key in jsCssMap) {
7163 if (key + testProp in style) {
7164 js = key;
7165 css = jsCssMap[key];
7166 break;
7167 }
7168 } // Correctly detect the Edge browser.
7169
7170
7171 if (js === 'Webkit' && 'msHyphens' in style) {
7172 js = 'ms';
7173 css = jsCssMap.ms;
7174 browser = 'edge';
7175 } // Correctly detect the Safari browser.
7176
7177
7178 if (js === 'Webkit' && '-apple-trailing-word' in style) {
7179 vendor = 'apple';
7180 }
7181}
7182/**
7183 * Vendor prefix string for the current browser.
7184 *
7185 * @type {{js: String, css: String, vendor: String, browser: String}}
7186 * @api public
7187 */
7188
7189
7190var prefix = {
7191 js: js,
7192 css: css,
7193 vendor: vendor,
7194 browser: browser,
7195 isTouch: isTouch
7196};
7197
7198/**
7199 * Test if a keyframe at-rule should be prefixed or not
7200 *
7201 * @param {String} vendor prefix string for the current browser.
7202 * @return {String}
7203 * @api public
7204 */
7205
7206function supportedKeyframes(key) {
7207 // Keyframes is already prefixed. e.g. key = '@-webkit-keyframes a'
7208 if (key[1] === '-') return key; // No need to prefix IE/Edge. Older browsers will ignore unsupported rules.
7209 // https://caniuse.com/#search=keyframes
7210
7211 if (prefix.js === 'ms') return key;
7212 return "@" + prefix.css + "keyframes" + key.substr(10);
7213}
7214
7215// https://caniuse.com/#search=appearance
7216
7217var appearence = {
7218 noPrefill: ['appearance'],
7219 supportedProperty: function supportedProperty(prop) {
7220 if (prop !== 'appearance') return false;
7221 if (prefix.js === 'ms') return "-webkit-" + prop;
7222 return prefix.css + prop;
7223 }
7224};
7225
7226// https://caniuse.com/#search=color-adjust
7227
7228var colorAdjust = {
7229 noPrefill: ['color-adjust'],
7230 supportedProperty: function supportedProperty(prop) {
7231 if (prop !== 'color-adjust') return false;
7232 if (prefix.js === 'Webkit') return prefix.css + "print-" + prop;
7233 return prop;
7234 }
7235};
7236
7237var regExp = /[-\s]+(.)?/g;
7238/**
7239 * Replaces the letter with the capital letter
7240 *
7241 * @param {String} match
7242 * @param {String} c
7243 * @return {String}
7244 * @api private
7245 */
7246
7247function toUpper(match, c) {
7248 return c ? c.toUpperCase() : '';
7249}
7250/**
7251 * Convert dash separated strings to camel-cased.
7252 *
7253 * @param {String} str
7254 * @return {String}
7255 * @api private
7256 */
7257
7258
7259function camelize(str) {
7260 return str.replace(regExp, toUpper);
7261}
7262
7263/**
7264 * Convert dash separated strings to pascal cased.
7265 *
7266 * @param {String} str
7267 * @return {String}
7268 * @api private
7269 */
7270
7271function pascalize(str) {
7272 return camelize("-" + str);
7273}
7274
7275// but we can use a longhand property instead.
7276// https://caniuse.com/#search=mask
7277
7278var mask = {
7279 noPrefill: ['mask'],
7280 supportedProperty: function supportedProperty(prop, style) {
7281 if (!/^mask/.test(prop)) return false;
7282
7283 if (prefix.js === 'Webkit') {
7284 var longhand = 'mask-image';
7285
7286 if (camelize(longhand) in style) {
7287 return prop;
7288 }
7289
7290 if (prefix.js + pascalize(longhand) in style) {
7291 return prefix.css + prop;
7292 }
7293 }
7294
7295 return prop;
7296 }
7297};
7298
7299// https://caniuse.com/#search=text-orientation
7300
7301var textOrientation = {
7302 noPrefill: ['text-orientation'],
7303 supportedProperty: function supportedProperty(prop) {
7304 if (prop !== 'text-orientation') return false;
7305
7306 if (prefix.vendor === 'apple' && !prefix.isTouch) {
7307 return prefix.css + prop;
7308 }
7309
7310 return prop;
7311 }
7312};
7313
7314// https://caniuse.com/#search=transform
7315
7316var transform = {
7317 noPrefill: ['transform'],
7318 supportedProperty: function supportedProperty(prop, style, options) {
7319 if (prop !== 'transform') return false;
7320
7321 if (options.transform) {
7322 return prop;
7323 }
7324
7325 return prefix.css + prop;
7326 }
7327};
7328
7329// https://caniuse.com/#search=transition
7330
7331var transition = {
7332 noPrefill: ['transition'],
7333 supportedProperty: function supportedProperty(prop, style, options) {
7334 if (prop !== 'transition') return false;
7335
7336 if (options.transition) {
7337 return prop;
7338 }
7339
7340 return prefix.css + prop;
7341 }
7342};
7343
7344// https://caniuse.com/#search=writing-mode
7345
7346var writingMode = {
7347 noPrefill: ['writing-mode'],
7348 supportedProperty: function supportedProperty(prop) {
7349 if (prop !== 'writing-mode') return false;
7350
7351 if (prefix.js === 'Webkit' || prefix.js === 'ms' && prefix.browser !== 'edge') {
7352 return prefix.css + prop;
7353 }
7354
7355 return prop;
7356 }
7357};
7358
7359// https://caniuse.com/#search=user-select
7360
7361var userSelect = {
7362 noPrefill: ['user-select'],
7363 supportedProperty: function supportedProperty(prop) {
7364 if (prop !== 'user-select') return false;
7365
7366 if (prefix.js === 'Moz' || prefix.js === 'ms' || prefix.vendor === 'apple') {
7367 return prefix.css + prop;
7368 }
7369
7370 return prop;
7371 }
7372};
7373
7374// https://caniuse.com/#search=multicolumn
7375// https://github.com/postcss/autoprefixer/issues/491
7376// https://github.com/postcss/autoprefixer/issues/177
7377
7378var breakPropsOld = {
7379 supportedProperty: function supportedProperty(prop, style) {
7380 if (!/^break-/.test(prop)) return false;
7381
7382 if (prefix.js === 'Webkit') {
7383 var jsProp = "WebkitColumn" + pascalize(prop);
7384 return jsProp in style ? prefix.css + "column-" + prop : false;
7385 }
7386
7387 if (prefix.js === 'Moz') {
7388 var _jsProp = "page" + pascalize(prop);
7389
7390 return _jsProp in style ? "page-" + prop : false;
7391 }
7392
7393 return false;
7394 }
7395};
7396
7397// See https://github.com/postcss/autoprefixer/issues/324.
7398
7399var inlineLogicalOld = {
7400 supportedProperty: function supportedProperty(prop, style) {
7401 if (!/^(border|margin|padding)-inline/.test(prop)) return false;
7402 if (prefix.js === 'Moz') return prop;
7403 var newProp = prop.replace('-inline', '');
7404 return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
7405 }
7406};
7407
7408// Camelization is required because we can't test using.
7409// CSS syntax for e.g. in FF.
7410
7411var unprefixed = {
7412 supportedProperty: function supportedProperty(prop, style) {
7413 return camelize(prop) in style ? prop : false;
7414 }
7415};
7416
7417var prefixed = {
7418 supportedProperty: function supportedProperty(prop, style) {
7419 var pascalized = pascalize(prop); // Return custom CSS variable without prefixing.
7420
7421 if (prop[0] === '-') return prop; // Return already prefixed value without prefixing.
7422
7423 if (prop[0] === '-' && prop[1] === '-') return prop;
7424 if (prefix.js + pascalized in style) return prefix.css + prop; // Try webkit fallback.
7425
7426 if (prefix.js !== 'Webkit' && "Webkit" + pascalized in style) return "-webkit-" + prop;
7427 return false;
7428 }
7429};
7430
7431// https://caniuse.com/#search=scroll-snap
7432
7433var scrollSnap = {
7434 supportedProperty: function supportedProperty(prop) {
7435 if (prop.substring(0, 11) !== 'scroll-snap') return false;
7436
7437 if (prefix.js === 'ms') {
7438 return "" + prefix.css + prop;
7439 }
7440
7441 return prop;
7442 }
7443};
7444
7445// https://caniuse.com/#search=overscroll-behavior
7446
7447var overscrollBehavior = {
7448 supportedProperty: function supportedProperty(prop) {
7449 if (prop !== 'overscroll-behavior') return false;
7450
7451 if (prefix.js === 'ms') {
7452 return prefix.css + "scroll-chaining";
7453 }
7454
7455 return prop;
7456 }
7457};
7458
7459var propMap = {
7460 'flex-grow': 'flex-positive',
7461 'flex-shrink': 'flex-negative',
7462 'flex-basis': 'flex-preferred-size',
7463 'justify-content': 'flex-pack',
7464 order: 'flex-order',
7465 'align-items': 'flex-align',
7466 'align-content': 'flex-line-pack' // 'align-self' is handled by 'align-self' plugin.
7467
7468}; // Support old flex spec from 2012.
7469
7470var flex2012 = {
7471 supportedProperty: function supportedProperty(prop, style) {
7472 var newProp = propMap[prop];
7473 if (!newProp) return false;
7474 return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
7475 }
7476};
7477
7478var propMap$1 = {
7479 flex: 'box-flex',
7480 'flex-grow': 'box-flex',
7481 'flex-direction': ['box-orient', 'box-direction'],
7482 order: 'box-ordinal-group',
7483 'align-items': 'box-align',
7484 'flex-flow': ['box-orient', 'box-direction'],
7485 'justify-content': 'box-pack'
7486};
7487var propKeys = Object.keys(propMap$1);
7488
7489var prefixCss = function prefixCss(p) {
7490 return prefix.css + p;
7491}; // Support old flex spec from 2009.
7492
7493
7494var flex2009 = {
7495 supportedProperty: function supportedProperty(prop, style, _ref) {
7496 var multiple = _ref.multiple;
7497
7498 if (propKeys.indexOf(prop) > -1) {
7499 var newProp = propMap$1[prop];
7500
7501 if (!Array.isArray(newProp)) {
7502 return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
7503 }
7504
7505 if (!multiple) return false;
7506
7507 for (var i = 0; i < newProp.length; i++) {
7508 if (!(prefix.js + pascalize(newProp[0]) in style)) {
7509 return false;
7510 }
7511 }
7512
7513 return newProp.map(prefixCss);
7514 }
7515
7516 return false;
7517 }
7518};
7519
7520// plugins = [
7521// ...plugins,
7522// breakPropsOld,
7523// inlineLogicalOld,
7524// unprefixed,
7525// prefixed,
7526// scrollSnap,
7527// flex2012,
7528// flex2009
7529// ]
7530// Plugins without 'noPrefill' value, going last.
7531// 'flex-*' plugins should be at the bottom.
7532// 'flex2009' going after 'flex2012'.
7533// 'prefixed' going after 'unprefixed'
7534
7535var plugins$1 = [appearence, colorAdjust, mask, textOrientation, transform, transition, writingMode, userSelect, breakPropsOld, inlineLogicalOld, unprefixed, prefixed, scrollSnap, overscrollBehavior, flex2012, flex2009];
7536var propertyDetectors = plugins$1.filter(function (p) {
7537 return p.supportedProperty;
7538}).map(function (p) {
7539 return p.supportedProperty;
7540});
7541var noPrefill = plugins$1.filter(function (p) {
7542 return p.noPrefill;
7543}).reduce(function (a, p) {
7544 a.push.apply(a, _toConsumableArray(p.noPrefill));
7545 return a;
7546}, []);
7547
7548var el;
7549var cache$1 = {};
7550
7551if (isBrowser) {
7552 el = document.createElement('p'); // We test every property on vendor prefix requirement.
7553 // Once tested, result is cached. It gives us up to 70% perf boost.
7554 // http://jsperf.com/element-style-object-access-vs-plain-object
7555 //
7556 // Prefill cache with known css properties to reduce amount of
7557 // properties we need to feature test at runtime.
7558 // http://davidwalsh.name/vendor-prefix
7559
7560 var computed = window.getComputedStyle(document.documentElement, '');
7561
7562 for (var key$1 in computed) {
7563 // eslint-disable-next-line no-restricted-globals
7564 if (!isNaN(key$1)) cache$1[computed[key$1]] = computed[key$1];
7565 } // Properties that cannot be correctly detected using the
7566 // cache prefill method.
7567
7568
7569 noPrefill.forEach(function (x) {
7570 return delete cache$1[x];
7571 });
7572}
7573/**
7574 * Test if a property is supported, returns supported property with vendor
7575 * prefix if required. Returns `false` if not supported.
7576 *
7577 * @param {String} prop dash separated
7578 * @param {Object} [options]
7579 * @return {String|Boolean}
7580 * @api public
7581 */
7582
7583
7584function supportedProperty(prop, options) {
7585 if (options === void 0) {
7586 options = {};
7587 }
7588
7589 // For server-side rendering.
7590 if (!el) return prop; // Remove cache for benchmark tests or return property from the cache.
7591
7592 if ( cache$1[prop] != null) {
7593 return cache$1[prop];
7594 } // Check if 'transition' or 'transform' natively supported in browser.
7595
7596
7597 if (prop === 'transition' || prop === 'transform') {
7598 options[prop] = prop in el.style;
7599 } // Find a plugin for current prefix property.
7600
7601
7602 for (var i = 0; i < propertyDetectors.length; i++) {
7603 cache$1[prop] = propertyDetectors[i](prop, el.style, options); // Break loop, if value found.
7604
7605 if (cache$1[prop]) break;
7606 } // Reset styles for current property.
7607 // Firefox can even throw an error for invalid properties, e.g., "0".
7608
7609
7610 try {
7611 el.style[prop] = '';
7612 } catch (err) {
7613 return false;
7614 }
7615
7616 return cache$1[prop];
7617}
7618
7619var cache$1$1 = {};
7620var transitionProperties = {
7621 transition: 1,
7622 'transition-property': 1,
7623 '-webkit-transition': 1,
7624 '-webkit-transition-property': 1
7625};
7626var transPropsRegExp = /(^\s*[\w-]+)|, (\s*[\w-]+)(?![^()]*\))/g;
7627var el$1;
7628/**
7629 * Returns prefixed value transition/transform if needed.
7630 *
7631 * @param {String} match
7632 * @param {String} p1
7633 * @param {String} p2
7634 * @return {String}
7635 * @api private
7636 */
7637
7638function prefixTransitionCallback(match, p1, p2) {
7639 if (p1 === 'var') return 'var';
7640 if (p1 === 'all') return 'all';
7641 if (p2 === 'all') return ', all';
7642 var prefixedValue = p1 ? supportedProperty(p1) : ", " + supportedProperty(p2);
7643 if (!prefixedValue) return p1 || p2;
7644 return prefixedValue;
7645}
7646
7647if (isBrowser) el$1 = document.createElement('p');
7648/**
7649 * Returns prefixed value if needed. Returns `false` if value is not supported.
7650 *
7651 * @param {String} property
7652 * @param {String} value
7653 * @return {String|Boolean}
7654 * @api public
7655 */
7656
7657function supportedValue(property, value) {
7658 // For server-side rendering.
7659 var prefixedValue = value;
7660 if (!el$1 || property === 'content') return value; // It is a string or a number as a string like '1'.
7661 // We want only prefixable values here.
7662 // eslint-disable-next-line no-restricted-globals
7663
7664 if (typeof prefixedValue !== 'string' || !isNaN(parseInt(prefixedValue, 10))) {
7665 return prefixedValue;
7666 } // Create cache key for current value.
7667
7668
7669 var cacheKey = property + prefixedValue; // Remove cache for benchmark tests or return value from cache.
7670
7671 if ( cache$1$1[cacheKey] != null) {
7672 return cache$1$1[cacheKey];
7673 } // IE can even throw an error in some cases, for e.g. style.content = 'bar'.
7674
7675
7676 try {
7677 // Test value as it is.
7678 el$1.style[property] = prefixedValue;
7679 } catch (err) {
7680 // Return false if value not supported.
7681 cache$1$1[cacheKey] = false;
7682 return false;
7683 } // If 'transition' or 'transition-property' property.
7684
7685
7686 if (transitionProperties[property]) {
7687 prefixedValue = prefixedValue.replace(transPropsRegExp, prefixTransitionCallback);
7688 } else if (el$1.style[property] === '') {
7689 // Value with a vendor prefix.
7690 prefixedValue = prefix.css + prefixedValue; // Hardcode test to convert "flex" to "-ms-flexbox" for IE10.
7691
7692 if (prefixedValue === '-ms-flex') el$1.style[property] = '-ms-flexbox'; // Test prefixed value.
7693
7694 el$1.style[property] = prefixedValue; // Return false if value not supported.
7695
7696 if (el$1.style[property] === '') {
7697 cache$1$1[cacheKey] = false;
7698 return false;
7699 }
7700 } // Reset styles for current property.
7701
7702
7703 el$1.style[property] = ''; // Write current value to cache.
7704
7705 cache$1$1[cacheKey] = prefixedValue;
7706 return cache$1$1[cacheKey];
7707}
7708
7709/**
7710 * Add vendor prefix to a property name when needed.
7711 */
7712
7713function jssVendorPrefixer() {
7714 function onProcessRule(rule) {
7715 if (rule.type === 'keyframes') {
7716 var atRule = rule;
7717 atRule.at = supportedKeyframes(atRule.at);
7718 }
7719 }
7720
7721 function prefixStyle(style) {
7722 for (var prop in style) {
7723 var value = style[prop];
7724
7725 if (prop === 'fallbacks' && Array.isArray(value)) {
7726 style[prop] = value.map(prefixStyle);
7727 continue;
7728 }
7729
7730 var changeProp = false;
7731 var supportedProp = supportedProperty(prop);
7732 if (supportedProp && supportedProp !== prop) changeProp = true;
7733 var changeValue = false;
7734 var supportedValue$1 = supportedValue(supportedProp, toCssValue(value));
7735 if (supportedValue$1 && supportedValue$1 !== value) changeValue = true;
7736
7737 if (changeProp || changeValue) {
7738 if (changeProp) delete style[prop];
7739 style[supportedProp || prop] = supportedValue$1 || value;
7740 }
7741 }
7742
7743 return style;
7744 }
7745
7746 function onProcessStyle(style, rule) {
7747 if (rule.type !== 'style') return style;
7748 return prefixStyle(style);
7749 }
7750
7751 function onChangeValue(value, prop) {
7752 return supportedValue(prop, toCssValue(value)) || value;
7753 }
7754
7755 return {
7756 onProcessRule: onProcessRule,
7757 onProcessStyle: onProcessStyle,
7758 onChangeValue: onChangeValue
7759 };
7760}
7761
7762/**
7763 * Sort props by length.
7764 */
7765function jssPropsSort() {
7766 var sort = function sort(prop0, prop1) {
7767 if (prop0.length === prop1.length) {
7768 return prop0 > prop1 ? 1 : -1;
7769 }
7770
7771 return prop0.length - prop1.length;
7772 };
7773
7774 return {
7775 onProcessStyle: function onProcessStyle(style, rule) {
7776 if (rule.type !== 'style') return style;
7777 var newStyle = {};
7778 var props = Object.keys(style).sort(sort);
7779
7780 for (var i = 0; i < props.length; i++) {
7781 newStyle[props[i]] = style[props[i]];
7782 }
7783
7784 return newStyle;
7785 }
7786 };
7787}
7788
7789var create = function create(options) {
7790 if (options === void 0) {
7791 options = {};
7792 }
7793
7794 return {
7795 plugins: [functionPlugin(), observablePlugin(options.observable), templatePlugin(), jssGlobal(), jssExtend(), jssNested(), jssCompose(), camelCase(), defaultUnit(options.defaultUnit), jssExpand(), jssVendorPrefixer(), jssPropsSort()]
7796 };
7797};
7798
7799var defaultJss = createJss(create());
7800
7801var sheetsMeta = new WeakMap();
7802var getMeta = function getMeta(sheet) {
7803 return sheetsMeta.get(sheet);
7804};
7805var addMeta = function addMeta(sheet, meta) {
7806 sheetsMeta.set(sheet, meta);
7807};
7808
7809var getStyles = function getStyles(options) {
7810 var styles = options.styles;
7811
7812 if (typeof styles !== 'function') {
7813 return styles;
7814 }
7815
7816 warning(styles.length !== 0, "[JSS] <" + (options.name || 'Hook') + " />'s styles function doesn't rely on the \"theme\" argument. We recommend declaring styles as an object instead.") ;
7817 return styles(options.theme);
7818};
7819
7820function getSheetOptions(options, link) {
7821 var minify;
7822
7823 if (options.context.id && options.context.id.minify != null) {
7824 minify = options.context.id.minify;
7825 }
7826
7827 var classNamePrefix = options.context.classNamePrefix || '';
7828
7829 if (options.name && !minify) {
7830 classNamePrefix += options.name.replace(/\s/g, '-') + "-";
7831 }
7832
7833 var meta = '';
7834 if (options.name) meta = options.name + ", ";
7835 meta += typeof options.styles === 'function' ? 'Themed' : 'Unthemed';
7836 return _extends({}, options.sheetOptions, {
7837 index: options.index,
7838 meta: meta,
7839 classNamePrefix: classNamePrefix,
7840 link: link,
7841 generateId: options.sheetOptions && options.sheetOptions.generateId ? options.sheetOptions.generateId : options.context.generateId
7842 });
7843}
7844
7845var createStyleSheet = function createStyleSheet(options) {
7846 if (options.context.disableStylesGeneration) {
7847 return undefined;
7848 }
7849
7850 var manager = getManager(options.context, options.index);
7851 var existingSheet = manager.get(options.theme);
7852
7853 if (existingSheet) {
7854 return existingSheet;
7855 }
7856
7857 var jss = options.context.jss || defaultJss;
7858 var styles = getStyles(options);
7859 var dynamicStyles = getDynamicStyles(styles);
7860 var sheet = jss.createStyleSheet(styles, getSheetOptions(options, dynamicStyles !== null));
7861 addMeta(sheet, {
7862 dynamicStyles: dynamicStyles,
7863 styles: styles
7864 });
7865 manager.add(options.theme, sheet);
7866 return sheet;
7867};
7868var removeDynamicRules = function removeDynamicRules(sheet, rules) {
7869 // Loop over each dynamic rule and remove the dynamic rule
7870 // We can't just remove the whole sheet as this has all of the rules for every component instance
7871 for (var key in rules) {
7872 sheet.deleteRule(rules[key]);
7873 }
7874};
7875var updateDynamicRules = function updateDynamicRules(data, sheet, rules) {
7876 // Loop over each dynamic rule and update it
7877 // We can't just update the whole sheet as this has all of the rules for every component instance
7878 for (var key in rules) {
7879 sheet.updateOne(rules[key], data);
7880 }
7881};
7882var addDynamicRules = function addDynamicRules(sheet, data) {
7883 var meta = getMeta(sheet);
7884
7885 if (!meta) {
7886 return undefined;
7887 }
7888
7889 var rules = {}; // Loop over each dynamic rule and add it to the stylesheet
7890
7891 for (var key in meta.dynamicStyles) {
7892 var initialRuleCount = sheet.rules.index.length;
7893 var originalRule = sheet.addRule(key, meta.dynamicStyles[key]); // Loop through all created rules, fixes updating dynamic rules
7894
7895 for (var i = initialRuleCount; i < sheet.rules.index.length; i++) {
7896 var rule = sheet.rules.index[i];
7897 sheet.updateOne(rule, data); // If it's the original rule, we need to add it by the correct key so the hook and hoc
7898 // can correctly concat the dynamic class with the static one
7899
7900 rules[originalRule === rule ? key : rule.key] = rule;
7901 }
7902 }
7903
7904 return rules;
7905};
7906
7907var getSheetClasses = function getSheetClasses(sheet, dynamicRules) {
7908 if (!dynamicRules) {
7909 return sheet.classes;
7910 }
7911
7912 var meta = getMeta(sheet);
7913
7914 if (!meta) {
7915 return sheet.classes;
7916 }
7917
7918 var classes = {};
7919
7920 for (var key in meta.styles) {
7921 classes[key] = sheet.classes[key];
7922
7923 if (key in dynamicRules) {
7924 classes[key] += " " + sheet.classes[dynamicRules[key].key];
7925 }
7926 }
7927
7928 return classes;
7929};
7930
7931function getUseInsertionEffect(isSSR) {
7932 return isSSR ? react.useEffect : react.useInsertionEffect || // React 18+ (https://github.com/reactwg/react-18/discussions/110)
7933 react.useLayoutEffect;
7934}
7935
7936var noTheme = {};
7937
7938var createUseStyles = function createUseStyles(styles, options) {
7939 if (options === void 0) {
7940 options = {};
7941 }
7942
7943 var _options = options,
7944 _options$index = _options.index,
7945 index = _options$index === void 0 ? getSheetIndex() : _options$index,
7946 theming = _options.theming,
7947 name = _options.name,
7948 sheetOptions = _objectWithoutPropertiesLoose(_options, ["index", "theming", "name"]);
7949
7950 var ThemeContext$1 = theming && theming.context || ThemeContext;
7951
7952 var useTheme = function useTheme(theme) {
7953 if (typeof styles === 'function') {
7954 return theme || react.useContext(ThemeContext$1) || noTheme;
7955 }
7956
7957 return noTheme;
7958 };
7959
7960 var emptyObject = {};
7961 return function useStyles(data) {
7962 var isFirstMount = react.useRef(true);
7963 var context = react.useContext(JssContext);
7964 var theme = useTheme(data && data.theme);
7965
7966 var _useMemo = react.useMemo(function () {
7967 var newSheet = createStyleSheet({
7968 context: context,
7969 styles: styles,
7970 name: name,
7971 theme: theme,
7972 index: index,
7973 sheetOptions: sheetOptions
7974 });
7975
7976 if (newSheet && context.isSSR) {
7977 // manage immediately during SSRs. browsers will manage the sheet through useInsertionEffect below
7978 manageSheet({
7979 index: index,
7980 context: context,
7981 sheet: newSheet,
7982 theme: theme
7983 });
7984 }
7985
7986 return [newSheet, newSheet ? addDynamicRules(newSheet, data) : null];
7987 }, [context, theme]),
7988 sheet = _useMemo[0],
7989 dynamicRules = _useMemo[1];
7990
7991 getUseInsertionEffect(context.isSSR)(function () {
7992 // We only need to update the rules on a subsequent update and not in the first mount
7993 if (sheet && dynamicRules && !isFirstMount.current) {
7994 updateDynamicRules(data, sheet, dynamicRules);
7995 }
7996 }, [data]);
7997 getUseInsertionEffect(context.isSSR)(function () {
7998 if (sheet) {
7999 manageSheet({
8000 index: index,
8001 context: context,
8002 sheet: sheet,
8003 theme: theme
8004 });
8005 }
8006
8007 return function () {
8008 if (sheet) {
8009 unmanageSheet({
8010 index: index,
8011 context: context,
8012 sheet: sheet,
8013 theme: theme
8014 }); // when sheet changes, remove related dynamic rules
8015
8016 if (dynamicRules) {
8017 removeDynamicRules(sheet, dynamicRules);
8018 }
8019 }
8020 };
8021 }, [sheet]);
8022 var classes = react.useMemo(function () {
8023 return sheet && dynamicRules ? getSheetClasses(sheet, dynamicRules) : emptyObject;
8024 }, [sheet, dynamicRules]);
8025 react.useDebugValue(classes);
8026 react.useDebugValue(theme === noTheme ? 'No theme' : theme);
8027 react.useEffect(function () {
8028 isFirstMount.current = false;
8029 });
8030 return classes;
8031 };
8032};
8033
8034var NoRenderer = function NoRenderer(props) {
8035 return props.children || null;
8036};
8037/**
8038 * HOC creator function that wrapps the user component.
8039 *
8040 * `withStyles(styles, [options])(Component)`
8041 */
8042
8043
8044var createWithStyles = function createWithStyles(styles, options) {
8045 if (options === void 0) {
8046 options = {};
8047 }
8048
8049 var _options = options,
8050 _options$index = _options.index,
8051 index = _options$index === void 0 ? getSheetIndex() : _options$index,
8052 theming = _options.theming,
8053 injectTheme = _options.injectTheme,
8054 sheetOptions = _objectWithoutPropertiesLoose(_options, ["index", "theming", "injectTheme"]);
8055
8056 var ThemeContext$1 = theming ? theming.context : ThemeContext;
8057 return function (InnerComponent) {
8058 if (InnerComponent === void 0) {
8059 InnerComponent = NoRenderer;
8060 }
8061
8062 var displayName = getDisplayName$1(InnerComponent);
8063 var mergeClassesProp = memoize(function (sheetClasses, classesProp) {
8064 return classesProp ? mergeClasses(sheetClasses, classesProp) : sheetClasses;
8065 });
8066 var hookOptions = Object.assign(sheetOptions, {
8067 theming: theming,
8068 index: index,
8069 name: displayName
8070 });
8071 var useStyles = createUseStyles(styles, hookOptions);
8072 var WithStyles = react.forwardRef(function (props, ref) {
8073 var theme = react.useContext(ThemeContext$1);
8074
8075 var newProps = _extends({}, props);
8076
8077 if (injectTheme && newProps.theme == null) {
8078 newProps.theme = theme;
8079 }
8080
8081 var sheetClasses = useStyles(newProps);
8082 var classes = mergeClassesProp(sheetClasses, props.classes);
8083 return react.createElement(InnerComponent, _extends({}, newProps, {
8084 classes: classes,
8085 ref: ref
8086 }));
8087 });
8088 WithStyles.displayName = "WithStyles(" + displayName + ")";
8089 WithStyles.defaultProps = _extends({}, InnerComponent.defaultProps);
8090 WithStyles.InnerComponent = InnerComponent;
8091 return hoistNonReactStatics_cjs(WithStyles, InnerComponent);
8092 };
8093};
8094
8095function shallowEqualObjects(objA, objB) {
8096 if (objA === objB) {
8097 return true;
8098 }
8099
8100 if (!objA || !objB) {
8101 return false;
8102 }
8103
8104 var aKeys = Object.keys(objA);
8105 var bKeys = Object.keys(objB);
8106 var len = aKeys.length;
8107
8108 if (bKeys.length !== len) {
8109 return false;
8110 }
8111
8112 for (var i = 0; i < len; i++) {
8113 var key = aKeys[i];
8114
8115 if (objA[key] !== objB[key]) {
8116 return false;
8117 }
8118 }
8119
8120 return true;
8121}
8122
8123var initialContext = {};
8124function JssProvider(props) {
8125 var managersRef = react.useRef({});
8126 var prevContextRef = react.useRef();
8127 var registryRef = react.useRef(null);
8128
8129 var createContext = function createContext(parentContext, prevContext) {
8130 if (prevContext === void 0) {
8131 prevContext = initialContext;
8132 }
8133
8134 var registry = props.registry,
8135 classNamePrefix = props.classNamePrefix,
8136 jss = props.jss,
8137 generateId = props.generateId,
8138 disableStylesGeneration = props.disableStylesGeneration,
8139 media = props.media,
8140 id = props.id,
8141 isSSR = props.isSSR;
8142
8143 var context = _extends({}, parentContext);
8144
8145 if (registry) {
8146 context.registry = registry; // This way we identify a new request on the server, because user will create
8147 // a new Registry instance for each.
8148
8149 if (registry !== registryRef.current) {
8150 // We reset managers because we have to regenerate all sheets for the new request.
8151 managersRef.current = {};
8152 registryRef.current = registry;
8153 }
8154 }
8155
8156 context.managers = managersRef.current;
8157
8158 if (id !== undefined) {
8159 context.id = id;
8160 }
8161
8162 if (generateId !== undefined) {
8163 context.generateId = generateId;
8164 } else if (!context.generateId || !prevContext || context.id !== prevContext.id) {
8165 context.generateId = createGenerateId(context.id);
8166 }
8167
8168 if (classNamePrefix) {
8169 context.classNamePrefix = (context.classNamePrefix || '') + classNamePrefix;
8170 }
8171
8172 if (media !== undefined) {
8173 context.media = media;
8174 }
8175
8176 if (jss) {
8177 context.jss = jss;
8178 }
8179
8180 if (disableStylesGeneration !== undefined) {
8181 context.disableStylesGeneration = disableStylesGeneration;
8182 }
8183
8184 if (isSSR !== undefined) {
8185 context.isSSR = isSSR;
8186 }
8187
8188 if (prevContext && shallowEqualObjects(prevContext, context)) {
8189 return prevContext;
8190 }
8191
8192 return context;
8193 };
8194
8195 var renderProvider = function renderProvider(parentContext) {
8196 var children = props.children;
8197 var context = createContext(parentContext, prevContextRef.current);
8198 prevContextRef.current = context;
8199 return react.createElement(JssContext.Provider, {
8200 value: context
8201 }, children);
8202 };
8203
8204 return react.createElement(JssContext.Consumer, null, renderProvider);
8205}
8206
8207function memoize$2(fn) {
8208 var cache = {};
8209 return function (arg) {
8210 if (cache[arg] === undefined) cache[arg] = fn(arg);
8211 return cache[arg];
8212 };
8213}
8214
8215var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|default|defer|dir|disabled|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|itemProp|itemScope|itemType|itemID|itemRef|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
8216
8217var index$2 = memoize$2(function (prop) {
8218 return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
8219 /* o */
8220 && prop.charCodeAt(1) === 110
8221 /* n */
8222 && prop.charCodeAt(2) < 91;
8223}
8224/* Z+1 */
8225);
8226
8227var parseStyles = function parseStyles(args) {
8228 var dynamicStyles = [];
8229 var staticStyle;
8230 var labels = []; // Not using ...rest to optimize perf.
8231
8232 for (var key in args) {
8233 var style = args[key];
8234 if (!style) continue;
8235
8236 if (typeof style === 'function') {
8237 dynamicStyles.push(style);
8238 } else {
8239 if (!staticStyle) staticStyle = {};
8240 Object.assign(staticStyle, style);
8241 var _staticStyle = staticStyle,
8242 _label = _staticStyle.label;
8243
8244 if (_label) {
8245 if (labels.indexOf(_label) === -1) labels.push(_label);
8246 }
8247 }
8248 }
8249
8250 var styles = {};
8251 var label = labels.length === 0 ? 'sc' : labels.join('-');
8252
8253 if (staticStyle) {
8254 // Label should not leak to the core.
8255 if ('label' in staticStyle) delete staticStyle.label;
8256 styles[label] = staticStyle;
8257 } // When there is only one function rule, we don't need to wrap it.
8258
8259
8260 if (dynamicStyles.length === 1) {
8261 styles.scd = dynamicStyles[0];
8262 } // We create a new function rule which will call all other function rules
8263 // and merge the styles they return.
8264
8265
8266 if (dynamicStyles.length > 1) {
8267 styles.scd = function (props) {
8268 var merged = {};
8269
8270 for (var i = 0; i < dynamicStyles.length; i++) {
8271 var dynamicStyle = dynamicStyles[i](props);
8272 if (dynamicStyle) Object.assign(merged, dynamicStyle);
8273 }
8274
8275 return merged;
8276 };
8277 }
8278
8279 return {
8280 styles: styles,
8281 label: label
8282 };
8283};
8284
8285var shouldForwardPropSymbol = Symbol('react-jss-styled');
8286
8287var getShouldForwardProp = function getShouldForwardProp(tagOrComponent, options) {
8288 var shouldForwardProp = options.shouldForwardProp;
8289 var childShouldForwardProp = tagOrComponent[shouldForwardPropSymbol];
8290 var finalShouldForwardProp = shouldForwardProp || childShouldForwardProp;
8291
8292 if (shouldForwardProp && childShouldForwardProp) {
8293 finalShouldForwardProp = function finalShouldForwardProp(prop) {
8294 return childShouldForwardProp(prop) && shouldForwardProp(prop);
8295 };
8296 }
8297
8298 return finalShouldForwardProp;
8299};
8300
8301var getChildProps = function getChildProps(props, shouldForwardProp, isTag) {
8302 var childProps = {};
8303
8304 for (var prop in props) {
8305 if (shouldForwardProp) {
8306 if (shouldForwardProp(prop) === true) {
8307 childProps[prop] = props[prop];
8308 }
8309
8310 continue;
8311 } // We don't want to pass non-dom props to the DOM.
8312
8313
8314 if (isTag) {
8315 if (index$2(prop)) {
8316 childProps[prop] = props[prop];
8317 }
8318
8319 continue;
8320 }
8321
8322 childProps[prop] = props[prop];
8323 }
8324
8325 return childProps;
8326}; // eslint-disable-next-line no-unused-vars
8327
8328
8329var configureStyled = function configureStyled(tagOrComponent, options) {
8330 if (options === void 0) {
8331 options = {};
8332 }
8333
8334 var _options = options,
8335 theming = _options.theming;
8336 var isTag = typeof tagOrComponent === 'string';
8337 var ThemeContext$1 = theming ? theming.context : ThemeContext;
8338 var shouldForwardProp = getShouldForwardProp(tagOrComponent, options);
8339
8340 var _options2 = options,
8341 _ = _options2.shouldForwardProp,
8342 hookOptions = _objectWithoutPropertiesLoose(_options2, ["shouldForwardProp"]);
8343
8344 return function createStyledComponent() {
8345 // eslint-disable-next-line prefer-rest-params
8346 var _parseStyles = parseStyles(arguments),
8347 styles = _parseStyles.styles,
8348 label = _parseStyles.label;
8349
8350 var useStyles = createUseStyles(styles, hookOptions);
8351
8352 var Styled = function Styled(props) {
8353 var as = props.as,
8354 className = props.className;
8355 var theme = react.useContext(ThemeContext$1);
8356 var propsWithTheme = Object.assign({
8357 theme: theme
8358 }, props);
8359 var classes = useStyles(propsWithTheme);
8360 var childProps = getChildProps(props, shouldForwardProp, isTag);
8361 var classNames = ((classes[label] || classes.sc || '') + " " + (classes.scd || '')).trim();
8362 childProps.className = className ? className + " " + classNames : classNames;
8363
8364 if (!isTag && shouldForwardProp) {
8365 tagOrComponent[shouldForwardPropSymbol] = shouldForwardProp;
8366 }
8367
8368 if (isTag && as) {
8369 return react.createElement(as, childProps);
8370 }
8371
8372 return react.createElement(tagOrComponent, childProps);
8373 };
8374
8375 return Styled;
8376 };
8377};
8378
8379var MAX_RULES_PER_SHEET = 10000;
8380var defaultJss$1 = createJss(create());
8381
8382var createCss = function createCss(jss) {
8383 if (jss === void 0) {
8384 jss = defaultJss$1;
8385 }
8386
8387 var cache = new Map();
8388 var ruleIndex = 0;
8389 var sheet;
8390
8391 var getSheet = function getSheet() {
8392 if (!sheet || sheet.rules.index.length > MAX_RULES_PER_SHEET) {
8393 sheet = jss.createStyleSheet().attach();
8394 }
8395
8396 return sheet;
8397 };
8398
8399 function css() {
8400 // eslint-disable-next-line prefer-rest-params
8401 var args = arguments; // We can avoid the need for stringification with a babel plugin,
8402 // which could generate a hash at build time and add it to the object.
8403
8404 var argsStr = JSON.stringify(args);
8405 var cached = cache.get(argsStr);
8406 if (cached) return cached.className;
8407 var flatArgs = []; // Flatten arguments which can be
8408 // - style objects
8409 // - array of style objects
8410 // - arrays of style objects
8411
8412 for (var argIndex in args) {
8413 var arg = args[argIndex];
8414
8415 if (!Array.isArray(arg)) {
8416 flatArgs.push(arg);
8417 continue;
8418 }
8419
8420 for (var innerArgIndex = 0; innerArgIndex < arg.length; innerArgIndex++) {
8421 flatArgs.push(arg[innerArgIndex]);
8422 }
8423 }
8424
8425 var mergedStyle = {};
8426 var labels = [];
8427
8428 for (var i = 0; i < flatArgs.length; i++) {
8429 var style = flatArgs[i];
8430 if (!style) continue;
8431 var styleObject = style; // It can be a class name that css() has previously generated.
8432
8433 if (typeof style === 'string') {
8434 // eslint-disable-next-line no-shadow
8435 var _cached = cache.get(style);
8436
8437 if (_cached) {
8438 // eslint-disable-next-line prefer-spread
8439 if (_cached.labels.length) labels.push.apply(labels, _cached.labels);
8440 styleObject = _cached.style;
8441 }
8442 }
8443
8444 if (styleObject.label && labels.indexOf(styleObject.label) === -1) labels.push(styleObject.label);
8445 Object.assign(mergedStyle, styleObject);
8446 }
8447
8448 delete mergedStyle.label;
8449 var label = labels.length === 0 ? 'css' : labels.join('-');
8450 var key = label + "-" + ruleIndex++;
8451 getSheet().addRule(key, mergedStyle);
8452 var className = getSheet().classes[key];
8453 var cacheValue = {
8454 style: mergedStyle,
8455 labels: labels,
8456 className: className
8457 };
8458 cache.set(argsStr, cacheValue);
8459 cache.set(className, cacheValue);
8460 return className;
8461 } // For testing only.
8462
8463
8464 css.getSheet = getSheet;
8465 return css;
8466};
8467
8468var css$1 = createCss();
8469
8470/* eslint-disable prefer-rest-params, prefer-spread */
8471var create$1 = function create(css) {
8472 if (css === void 0) {
8473 css = css$1;
8474 }
8475
8476 return function createElement(type, props) {
8477 var args = arguments;
8478
8479 if (props && props.css) {
8480 var className = css(props.css);
8481 var newProps = Object.assign({}, props);
8482 newProps.className = props.className ? props.className + " " + className : className;
8483 delete newProps.css;
8484 args[1] = newProps;
8485 }
8486
8487 return react.createElement.apply(undefined, args);
8488 };
8489};
8490var jsx = create$1();
8491
8492export default createWithStyles;
8493export { JssContext, JssProvider, SheetsRegistry, ThemeProvider, createGenerateId, create$1 as createJsx, createTheming, createUseStyles, defaultJss as jss, jsx, configureStyled as styled, useTheme, createWithStyles as withStyles, withTheme };