UNPKG

137 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('jss')) :
3 typeof define === 'function' && define.amd ? define(['exports', 'react', 'jss'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.reactJss = {}, global.React, global.jss));
5}(this, (function (exports, React, jss$1) { 'use strict';
6
7 function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
9 var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
10
11 function _extends() {
12 _extends = Object.assign || function (target) {
13 for (var i = 1; i < arguments.length; i++) {
14 var source = arguments[i];
15
16 for (var key in source) {
17 if (Object.prototype.hasOwnProperty.call(source, key)) {
18 target[key] = source[key];
19 }
20 }
21 }
22
23 return target;
24 };
25
26 return _extends.apply(this, arguments);
27 }
28
29 function _objectWithoutPropertiesLoose(source, excluded) {
30 if (source == null) return {};
31 var target = {};
32 var sourceKeys = Object.keys(source);
33 var key, i;
34
35 for (i = 0; i < sourceKeys.length; i++) {
36 key = sourceKeys[i];
37 if (excluded.indexOf(key) >= 0) continue;
38 target[key] = source[key];
39 }
40
41 return target;
42 }
43
44 function getDefaultExportFromCjs (x) {
45 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
46 }
47
48 function createCommonjsModule(fn, basedir, module) {
49 return module = {
50 path: basedir,
51 exports: {},
52 require: function (path, base) {
53 return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
54 }
55 }, fn(module, module.exports), module.exports;
56 }
57
58 function getAugmentedNamespace(n) {
59 if (n.__esModule) return n;
60 var a = Object.defineProperty({}, '__esModule', {value: true});
61 Object.keys(n).forEach(function (k) {
62 var d = Object.getOwnPropertyDescriptor(n, k);
63 Object.defineProperty(a, k, d.get ? d : {
64 enumerable: true,
65 get: function () {
66 return n[k];
67 }
68 });
69 });
70 return a;
71 }
72
73 function commonjsRequire () {
74 throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
75 }
76
77 var reactIs_production_min = createCommonjsModule(function (module, exports) {
78 Object.defineProperty(exports,"__esModule",{value:!0});
79 var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.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"):
80 60116;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;
81 exports.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};
82 exports.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};
83 });
84
85 var reactIs_development = createCommonjsModule(function (module, exports) {
86
87
88
89 {
90 (function() {
91
92 Object.defineProperty(exports, '__esModule', { value: true });
93
94 // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
95 // nor polyfill, then a plain number is used for performance.
96 var hasSymbol = typeof Symbol === 'function' && Symbol.for;
97
98 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
99 var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
100 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
101 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
102 var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
103 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
104 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
105 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
106 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
107 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
108 var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
109 var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
110
111 function isValidElementType(type) {
112 return typeof type === 'string' || typeof type === 'function' ||
113 // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
114 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);
115 }
116
117 /**
118 * Forked from fbjs/warning:
119 * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
120 *
121 * Only change is we use console.warn instead of console.error,
122 * and do nothing when 'console' is not supported.
123 * This really simplifies the code.
124 * ---
125 * Similar to invariant but only logs a warning if the condition is not met.
126 * This can be used to log issues in development environments in critical
127 * paths. Removing the logging code for production environments will keep the
128 * same logic and follow the same code paths.
129 */
130
131 var lowPriorityWarning = function () {};
132
133 {
134 var printWarning = function (format) {
135 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
136 args[_key - 1] = arguments[_key];
137 }
138
139 var argIndex = 0;
140 var message = 'Warning: ' + format.replace(/%s/g, function () {
141 return args[argIndex++];
142 });
143 if (typeof console !== 'undefined') {
144 console.warn(message);
145 }
146 try {
147 // --- Welcome to debugging React ---
148 // This error was thrown as a convenience so that you can use this stack
149 // to find the callsite that caused this warning to fire.
150 throw new Error(message);
151 } catch (x) {}
152 };
153
154 lowPriorityWarning = function (condition, format) {
155 if (format === undefined) {
156 throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
157 }
158 if (!condition) {
159 for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
160 args[_key2 - 2] = arguments[_key2];
161 }
162
163 printWarning.apply(undefined, [format].concat(args));
164 }
165 };
166 }
167
168 var lowPriorityWarning$1 = lowPriorityWarning;
169
170 function typeOf(object) {
171 if (typeof object === 'object' && object !== null) {
172 var $$typeof = object.$$typeof;
173
174 switch ($$typeof) {
175 case REACT_ELEMENT_TYPE:
176 var type = object.type;
177
178 switch (type) {
179 case REACT_CONCURRENT_MODE_TYPE:
180 case REACT_FRAGMENT_TYPE:
181 case REACT_PROFILER_TYPE:
182 case REACT_STRICT_MODE_TYPE:
183 return type;
184 default:
185 var $$typeofType = type && type.$$typeof;
186
187 switch ($$typeofType) {
188 case REACT_CONTEXT_TYPE:
189 case REACT_FORWARD_REF_TYPE:
190 case REACT_PROVIDER_TYPE:
191 return $$typeofType;
192 default:
193 return $$typeof;
194 }
195 }
196 case REACT_PORTAL_TYPE:
197 return $$typeof;
198 }
199 }
200
201 return undefined;
202 }
203
204 // AsyncMode alias is deprecated along with isAsyncMode
205 var AsyncMode = REACT_CONCURRENT_MODE_TYPE;
206 var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
207 var ContextConsumer = REACT_CONTEXT_TYPE;
208 var ContextProvider = REACT_PROVIDER_TYPE;
209 var Element = REACT_ELEMENT_TYPE;
210 var ForwardRef = REACT_FORWARD_REF_TYPE;
211 var Fragment = REACT_FRAGMENT_TYPE;
212 var Profiler = REACT_PROFILER_TYPE;
213 var Portal = REACT_PORTAL_TYPE;
214 var StrictMode = REACT_STRICT_MODE_TYPE;
215
216 var hasWarnedAboutDeprecatedIsAsyncMode = false;
217
218 // AsyncMode should be deprecated
219 function isAsyncMode(object) {
220 {
221 if (!hasWarnedAboutDeprecatedIsAsyncMode) {
222 hasWarnedAboutDeprecatedIsAsyncMode = true;
223 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.');
224 }
225 }
226 return isConcurrentMode(object);
227 }
228 function isConcurrentMode(object) {
229 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
230 }
231 function isContextConsumer(object) {
232 return typeOf(object) === REACT_CONTEXT_TYPE;
233 }
234 function isContextProvider(object) {
235 return typeOf(object) === REACT_PROVIDER_TYPE;
236 }
237 function isElement(object) {
238 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
239 }
240 function isForwardRef(object) {
241 return typeOf(object) === REACT_FORWARD_REF_TYPE;
242 }
243 function isFragment(object) {
244 return typeOf(object) === REACT_FRAGMENT_TYPE;
245 }
246 function isProfiler(object) {
247 return typeOf(object) === REACT_PROFILER_TYPE;
248 }
249 function isPortal(object) {
250 return typeOf(object) === REACT_PORTAL_TYPE;
251 }
252 function isStrictMode(object) {
253 return typeOf(object) === REACT_STRICT_MODE_TYPE;
254 }
255
256 exports.typeOf = typeOf;
257 exports.AsyncMode = AsyncMode;
258 exports.ConcurrentMode = ConcurrentMode;
259 exports.ContextConsumer = ContextConsumer;
260 exports.ContextProvider = ContextProvider;
261 exports.Element = Element;
262 exports.ForwardRef = ForwardRef;
263 exports.Fragment = Fragment;
264 exports.Profiler = Profiler;
265 exports.Portal = Portal;
266 exports.StrictMode = StrictMode;
267 exports.isValidElementType = isValidElementType;
268 exports.isAsyncMode = isAsyncMode;
269 exports.isConcurrentMode = isConcurrentMode;
270 exports.isContextConsumer = isContextConsumer;
271 exports.isContextProvider = isContextProvider;
272 exports.isElement = isElement;
273 exports.isForwardRef = isForwardRef;
274 exports.isFragment = isFragment;
275 exports.isProfiler = isProfiler;
276 exports.isPortal = isPortal;
277 exports.isStrictMode = isStrictMode;
278 })();
279 }
280 });
281
282 var reactIs = createCommonjsModule(function (module) {
283
284 {
285 module.exports = reactIs_development;
286 }
287 });
288
289 /**
290 * Copyright 2015, Yahoo! Inc.
291 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
292 */
293
294 var REACT_STATICS = {
295 childContextTypes: true,
296 contextType: true,
297 contextTypes: true,
298 defaultProps: true,
299 displayName: true,
300 getDefaultProps: true,
301 getDerivedStateFromError: true,
302 getDerivedStateFromProps: true,
303 mixins: true,
304 propTypes: true,
305 type: true
306 };
307
308 var KNOWN_STATICS = {
309 name: true,
310 length: true,
311 prototype: true,
312 caller: true,
313 callee: true,
314 arguments: true,
315 arity: true
316 };
317
318 var FORWARD_REF_STATICS = {
319 '$$typeof': true,
320 render: true
321 };
322
323 var TYPE_STATICS = {};
324 TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
325
326 var defineProperty = Object.defineProperty;
327 var getOwnPropertyNames = Object.getOwnPropertyNames;
328 var getOwnPropertySymbols = Object.getOwnPropertySymbols;
329 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
330 var getPrototypeOf = Object.getPrototypeOf;
331 var objectPrototype = Object.prototype;
332
333 function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
334 if (typeof sourceComponent !== 'string') {
335 // don't hoist over string (html) components
336
337 if (objectPrototype) {
338 var inheritedComponent = getPrototypeOf(sourceComponent);
339 if (inheritedComponent && inheritedComponent !== objectPrototype) {
340 hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
341 }
342 }
343
344 var keys = getOwnPropertyNames(sourceComponent);
345
346 if (getOwnPropertySymbols) {
347 keys = keys.concat(getOwnPropertySymbols(sourceComponent));
348 }
349
350 var targetStatics = TYPE_STATICS[targetComponent['$$typeof']] || REACT_STATICS;
351 var sourceStatics = TYPE_STATICS[sourceComponent['$$typeof']] || REACT_STATICS;
352
353 for (var i = 0; i < keys.length; ++i) {
354 var key = keys[i];
355 if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
356 var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
357 try {
358 // Avoid failures from read-only properties
359 defineProperty(targetComponent, key, descriptor);
360 } catch (e) {}
361 }
362 }
363
364 return targetComponent;
365 }
366
367 return targetComponent;
368 }
369
370 var hoistNonReactStatics_cjs = hoistNonReactStatics;
371
372 function warning(condition, message) {
373 {
374 if (condition) {
375 return;
376 }
377
378 var text = "Warning: " + message;
379
380 if (typeof console !== 'undefined') {
381 console.warn(text);
382 }
383
384 try {
385 throw Error(text);
386 } catch (x) {}
387 }
388 }
389
390 /*
391 object-assign
392 (c) Sindre Sorhus
393 @license MIT
394 */
395 /* eslint-disable no-unused-vars */
396 var getOwnPropertySymbols$1 = Object.getOwnPropertySymbols;
397 var hasOwnProperty = Object.prototype.hasOwnProperty;
398 var propIsEnumerable = Object.prototype.propertyIsEnumerable;
399
400 function toObject(val) {
401 if (val === null || val === undefined) {
402 throw new TypeError('Object.assign cannot be called with null or undefined');
403 }
404
405 return Object(val);
406 }
407
408 function shouldUseNative() {
409 try {
410 if (!Object.assign) {
411 return false;
412 }
413
414 // Detect buggy property enumeration order in older V8 versions.
415
416 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
417 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
418 test1[5] = 'de';
419 if (Object.getOwnPropertyNames(test1)[0] === '5') {
420 return false;
421 }
422
423 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
424 var test2 = {};
425 for (var i = 0; i < 10; i++) {
426 test2['_' + String.fromCharCode(i)] = i;
427 }
428 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
429 return test2[n];
430 });
431 if (order2.join('') !== '0123456789') {
432 return false;
433 }
434
435 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
436 var test3 = {};
437 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
438 test3[letter] = letter;
439 });
440 if (Object.keys(Object.assign({}, test3)).join('') !==
441 'abcdefghijklmnopqrst') {
442 return false;
443 }
444
445 return true;
446 } catch (err) {
447 // We don't expect any of the above to throw, but better to be safe.
448 return false;
449 }
450 }
451
452 module.exports = shouldUseNative() ? Object.assign : function (target, source) {
453 var from;
454 var to = toObject(target);
455 var symbols;
456
457 for (var s = 1; s < arguments.length; s++) {
458 from = Object(arguments[s]);
459
460 for (var key in from) {
461 if (hasOwnProperty.call(from, key)) {
462 to[key] = from[key];
463 }
464 }
465
466 if (getOwnPropertySymbols$1) {
467 symbols = getOwnPropertySymbols$1(from);
468 for (var i = 0; i < symbols.length; i++) {
469 if (propIsEnumerable.call(from, symbols[i])) {
470 to[symbols[i]] = from[symbols[i]];
471 }
472 }
473 }
474 }
475
476 return to;
477 };
478
479 var objectAssign = /*#__PURE__*/Object.freeze({
480 __proto__: null
481 });
482
483 /**
484 * Copyright (c) 2013-present, Facebook, Inc.
485 *
486 * This source code is licensed under the MIT license found in the
487 * LICENSE file in the root directory of this source tree.
488 */
489
490 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
491
492 var ReactPropTypesSecret_1 = ReactPropTypesSecret;
493
494 var printWarning = function() {};
495
496 {
497 var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
498 var loggedTypeFailures = {};
499
500 printWarning = function(text) {
501 var message = 'Warning: ' + text;
502 if (typeof console !== 'undefined') {
503 console.error(message);
504 }
505 try {
506 // --- Welcome to debugging React ---
507 // This error was thrown as a convenience so that you can use this stack
508 // to find the callsite that caused this warning to fire.
509 throw new Error(message);
510 } catch (x) {}
511 };
512 }
513
514 /**
515 * Assert that the values match with the type specs.
516 * Error messages are memorized and will only be shown once.
517 *
518 * @param {object} typeSpecs Map of name to a ReactPropType
519 * @param {object} values Runtime values that need to be type-checked
520 * @param {string} location e.g. "prop", "context", "child context"
521 * @param {string} componentName Name of the component for error messages.
522 * @param {?Function} getStack Returns the component stack.
523 * @private
524 */
525 function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
526 {
527 for (var typeSpecName in typeSpecs) {
528 if (typeSpecs.hasOwnProperty(typeSpecName)) {
529 var error;
530 // Prop type validation may throw. In case they do, we don't want to
531 // fail the render phase where it didn't fail before. So we log it.
532 // After these have been cleaned up, we'll let them throw.
533 try {
534 // This is intentionally an invariant that gets caught. It's the same
535 // behavior as without this statement except with a better message.
536 if (typeof typeSpecs[typeSpecName] !== 'function') {
537 var err = Error(
538 (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
539 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
540 );
541 err.name = 'Invariant Violation';
542 throw err;
543 }
544 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
545 } catch (ex) {
546 error = ex;
547 }
548 if (error && !(error instanceof Error)) {
549 printWarning(
550 (componentName || 'React class') + ': type specification of ' +
551 location + ' `' + typeSpecName + '` is invalid; the type checker ' +
552 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
553 'You may have forgotten to pass an argument to the type checker ' +
554 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
555 'shape all require an argument).'
556 );
557
558 }
559 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
560 // Only monitor this failure once because there tends to be a lot of the
561 // same error.
562 loggedTypeFailures[error.message] = true;
563
564 var stack = getStack ? getStack() : '';
565
566 printWarning(
567 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
568 );
569 }
570 }
571 }
572 }
573 }
574
575 var checkPropTypes_1 = checkPropTypes;
576
577 var assign = /*@__PURE__*/getAugmentedNamespace(objectAssign);
578
579 var printWarning$1 = function() {};
580
581 {
582 printWarning$1 = function(text) {
583 var message = 'Warning: ' + text;
584 if (typeof console !== 'undefined') {
585 console.error(message);
586 }
587 try {
588 // --- Welcome to debugging React ---
589 // This error was thrown as a convenience so that you can use this stack
590 // to find the callsite that caused this warning to fire.
591 throw new Error(message);
592 } catch (x) {}
593 };
594 }
595
596 function emptyFunctionThatReturnsNull() {
597 return null;
598 }
599
600 var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
601 /* global Symbol */
602 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
603 var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
604
605 /**
606 * Returns the iterator method function contained on the iterable object.
607 *
608 * Be sure to invoke the function with the iterable as context:
609 *
610 * var iteratorFn = getIteratorFn(myIterable);
611 * if (iteratorFn) {
612 * var iterator = iteratorFn.call(myIterable);
613 * ...
614 * }
615 *
616 * @param {?object} maybeIterable
617 * @return {?function}
618 */
619 function getIteratorFn(maybeIterable) {
620 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
621 if (typeof iteratorFn === 'function') {
622 return iteratorFn;
623 }
624 }
625
626 /**
627 * Collection of methods that allow declaration and validation of props that are
628 * supplied to React components. Example usage:
629 *
630 * var Props = require('ReactPropTypes');
631 * var MyArticle = React.createClass({
632 * propTypes: {
633 * // An optional string prop named "description".
634 * description: Props.string,
635 *
636 * // A required enum prop named "category".
637 * category: Props.oneOf(['News','Photos']).isRequired,
638 *
639 * // A prop named "dialog" that requires an instance of Dialog.
640 * dialog: Props.instanceOf(Dialog).isRequired
641 * },
642 * render: function() { ... }
643 * });
644 *
645 * A more formal specification of how these methods are used:
646 *
647 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
648 * decl := ReactPropTypes.{type}(.isRequired)?
649 *
650 * Each and every declaration produces a function with the same signature. This
651 * allows the creation of custom validation functions. For example:
652 *
653 * var MyLink = React.createClass({
654 * propTypes: {
655 * // An optional string or URI prop named "href".
656 * href: function(props, propName, componentName) {
657 * var propValue = props[propName];
658 * if (propValue != null && typeof propValue !== 'string' &&
659 * !(propValue instanceof URI)) {
660 * return new Error(
661 * 'Expected a string or an URI for ' + propName + ' in ' +
662 * componentName
663 * );
664 * }
665 * }
666 * },
667 * render: function() {...}
668 * });
669 *
670 * @internal
671 */
672
673 var ANONYMOUS = '<<anonymous>>';
674
675 // Important!
676 // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
677 var ReactPropTypes = {
678 array: createPrimitiveTypeChecker('array'),
679 bool: createPrimitiveTypeChecker('boolean'),
680 func: createPrimitiveTypeChecker('function'),
681 number: createPrimitiveTypeChecker('number'),
682 object: createPrimitiveTypeChecker('object'),
683 string: createPrimitiveTypeChecker('string'),
684 symbol: createPrimitiveTypeChecker('symbol'),
685
686 any: createAnyTypeChecker(),
687 arrayOf: createArrayOfTypeChecker,
688 element: createElementTypeChecker(),
689 instanceOf: createInstanceTypeChecker,
690 node: createNodeChecker(),
691 objectOf: createObjectOfTypeChecker,
692 oneOf: createEnumTypeChecker,
693 oneOfType: createUnionTypeChecker,
694 shape: createShapeTypeChecker,
695 exact: createStrictShapeTypeChecker,
696 };
697
698 /**
699 * inlined Object.is polyfill to avoid requiring consumers ship their own
700 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
701 */
702 /*eslint-disable no-self-compare*/
703 function is(x, y) {
704 // SameValue algorithm
705 if (x === y) {
706 // Steps 1-5, 7-10
707 // Steps 6.b-6.e: +0 != -0
708 return x !== 0 || 1 / x === 1 / y;
709 } else {
710 // Step 6.a: NaN == NaN
711 return x !== x && y !== y;
712 }
713 }
714 /*eslint-enable no-self-compare*/
715
716 /**
717 * We use an Error-like object for backward compatibility as people may call
718 * PropTypes directly and inspect their output. However, we don't use real
719 * Errors anymore. We don't inspect their stack anyway, and creating them
720 * is prohibitively expensive if they are created too often, such as what
721 * happens in oneOfType() for any type before the one that matched.
722 */
723 function PropTypeError(message) {
724 this.message = message;
725 this.stack = '';
726 }
727 // Make `instanceof Error` still work for returned errors.
728 PropTypeError.prototype = Error.prototype;
729
730 function createChainableTypeChecker(validate) {
731 {
732 var manualPropTypeCallCache = {};
733 var manualPropTypeWarningCount = 0;
734 }
735 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
736 componentName = componentName || ANONYMOUS;
737 propFullName = propFullName || propName;
738
739 if (secret !== ReactPropTypesSecret_1) {
740 if (throwOnDirectAccess) {
741 // New behavior only for users of `prop-types` package
742 var err = new Error(
743 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
744 'Use `PropTypes.checkPropTypes()` to call them. ' +
745 'Read more at http://fb.me/use-check-prop-types'
746 );
747 err.name = 'Invariant Violation';
748 throw err;
749 } else if ( typeof console !== 'undefined') {
750 // Old behavior for people using React.PropTypes
751 var cacheKey = componentName + ':' + propName;
752 if (
753 !manualPropTypeCallCache[cacheKey] &&
754 // Avoid spamming the console because they are often not actionable except for lib authors
755 manualPropTypeWarningCount < 3
756 ) {
757 printWarning$1(
758 'You are manually calling a React.PropTypes validation ' +
759 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
760 'and will throw in the standalone `prop-types` package. ' +
761 'You may be seeing this warning due to a third-party PropTypes ' +
762 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
763 );
764 manualPropTypeCallCache[cacheKey] = true;
765 manualPropTypeWarningCount++;
766 }
767 }
768 }
769 if (props[propName] == null) {
770 if (isRequired) {
771 if (props[propName] === null) {
772 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
773 }
774 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
775 }
776 return null;
777 } else {
778 return validate(props, propName, componentName, location, propFullName);
779 }
780 }
781
782 var chainedCheckType = checkType.bind(null, false);
783 chainedCheckType.isRequired = checkType.bind(null, true);
784
785 return chainedCheckType;
786 }
787
788 function createPrimitiveTypeChecker(expectedType) {
789 function validate(props, propName, componentName, location, propFullName, secret) {
790 var propValue = props[propName];
791 var propType = getPropType(propValue);
792 if (propType !== expectedType) {
793 // `propValue` being instance of, say, date/regexp, pass the 'object'
794 // check, but we can offer a more precise error message here rather than
795 // 'of type `object`'.
796 var preciseType = getPreciseType(propValue);
797
798 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
799 }
800 return null;
801 }
802 return createChainableTypeChecker(validate);
803 }
804
805 function createAnyTypeChecker() {
806 return createChainableTypeChecker(emptyFunctionThatReturnsNull);
807 }
808
809 function createArrayOfTypeChecker(typeChecker) {
810 function validate(props, propName, componentName, location, propFullName) {
811 if (typeof typeChecker !== 'function') {
812 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
813 }
814 var propValue = props[propName];
815 if (!Array.isArray(propValue)) {
816 var propType = getPropType(propValue);
817 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
818 }
819 for (var i = 0; i < propValue.length; i++) {
820 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
821 if (error instanceof Error) {
822 return error;
823 }
824 }
825 return null;
826 }
827 return createChainableTypeChecker(validate);
828 }
829
830 function createElementTypeChecker() {
831 function validate(props, propName, componentName, location, propFullName) {
832 var propValue = props[propName];
833 if (!isValidElement(propValue)) {
834 var propType = getPropType(propValue);
835 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
836 }
837 return null;
838 }
839 return createChainableTypeChecker(validate);
840 }
841
842 function createInstanceTypeChecker(expectedClass) {
843 function validate(props, propName, componentName, location, propFullName) {
844 if (!(props[propName] instanceof expectedClass)) {
845 var expectedClassName = expectedClass.name || ANONYMOUS;
846 var actualClassName = getClassName(props[propName]);
847 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
848 }
849 return null;
850 }
851 return createChainableTypeChecker(validate);
852 }
853
854 function createEnumTypeChecker(expectedValues) {
855 if (!Array.isArray(expectedValues)) {
856 printWarning$1('Invalid argument supplied to oneOf, expected an instance of array.') ;
857 return emptyFunctionThatReturnsNull;
858 }
859
860 function validate(props, propName, componentName, location, propFullName) {
861 var propValue = props[propName];
862 for (var i = 0; i < expectedValues.length; i++) {
863 if (is(propValue, expectedValues[i])) {
864 return null;
865 }
866 }
867
868 var valuesString = JSON.stringify(expectedValues);
869 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
870 }
871 return createChainableTypeChecker(validate);
872 }
873
874 function createObjectOfTypeChecker(typeChecker) {
875 function validate(props, propName, componentName, location, propFullName) {
876 if (typeof typeChecker !== 'function') {
877 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
878 }
879 var propValue = props[propName];
880 var propType = getPropType(propValue);
881 if (propType !== 'object') {
882 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
883 }
884 for (var key in propValue) {
885 if (propValue.hasOwnProperty(key)) {
886 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
887 if (error instanceof Error) {
888 return error;
889 }
890 }
891 }
892 return null;
893 }
894 return createChainableTypeChecker(validate);
895 }
896
897 function createUnionTypeChecker(arrayOfTypeCheckers) {
898 if (!Array.isArray(arrayOfTypeCheckers)) {
899 printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') ;
900 return emptyFunctionThatReturnsNull;
901 }
902
903 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
904 var checker = arrayOfTypeCheckers[i];
905 if (typeof checker !== 'function') {
906 printWarning$1(
907 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
908 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
909 );
910 return emptyFunctionThatReturnsNull;
911 }
912 }
913
914 function validate(props, propName, componentName, location, propFullName) {
915 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
916 var checker = arrayOfTypeCheckers[i];
917 if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
918 return null;
919 }
920 }
921
922 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
923 }
924 return createChainableTypeChecker(validate);
925 }
926
927 function createNodeChecker() {
928 function validate(props, propName, componentName, location, propFullName) {
929 if (!isNode(props[propName])) {
930 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
931 }
932 return null;
933 }
934 return createChainableTypeChecker(validate);
935 }
936
937 function createShapeTypeChecker(shapeTypes) {
938 function validate(props, propName, componentName, location, propFullName) {
939 var propValue = props[propName];
940 var propType = getPropType(propValue);
941 if (propType !== 'object') {
942 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
943 }
944 for (var key in shapeTypes) {
945 var checker = shapeTypes[key];
946 if (!checker) {
947 continue;
948 }
949 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
950 if (error) {
951 return error;
952 }
953 }
954 return null;
955 }
956 return createChainableTypeChecker(validate);
957 }
958
959 function createStrictShapeTypeChecker(shapeTypes) {
960 function validate(props, propName, componentName, location, propFullName) {
961 var propValue = props[propName];
962 var propType = getPropType(propValue);
963 if (propType !== 'object') {
964 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
965 }
966 // We need to check all keys in case some are required but missing from
967 // props.
968 var allKeys = assign({}, props[propName], shapeTypes);
969 for (var key in allKeys) {
970 var checker = shapeTypes[key];
971 if (!checker) {
972 return new PropTypeError(
973 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
974 '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
975 '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
976 );
977 }
978 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
979 if (error) {
980 return error;
981 }
982 }
983 return null;
984 }
985
986 return createChainableTypeChecker(validate);
987 }
988
989 function isNode(propValue) {
990 switch (typeof propValue) {
991 case 'number':
992 case 'string':
993 case 'undefined':
994 return true;
995 case 'boolean':
996 return !propValue;
997 case 'object':
998 if (Array.isArray(propValue)) {
999 return propValue.every(isNode);
1000 }
1001 if (propValue === null || isValidElement(propValue)) {
1002 return true;
1003 }
1004
1005 var iteratorFn = getIteratorFn(propValue);
1006 if (iteratorFn) {
1007 var iterator = iteratorFn.call(propValue);
1008 var step;
1009 if (iteratorFn !== propValue.entries) {
1010 while (!(step = iterator.next()).done) {
1011 if (!isNode(step.value)) {
1012 return false;
1013 }
1014 }
1015 } else {
1016 // Iterator will provide entry [k,v] tuples rather than values.
1017 while (!(step = iterator.next()).done) {
1018 var entry = step.value;
1019 if (entry) {
1020 if (!isNode(entry[1])) {
1021 return false;
1022 }
1023 }
1024 }
1025 }
1026 } else {
1027 return false;
1028 }
1029
1030 return true;
1031 default:
1032 return false;
1033 }
1034 }
1035
1036 function isSymbol(propType, propValue) {
1037 // Native Symbol.
1038 if (propType === 'symbol') {
1039 return true;
1040 }
1041
1042 // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1043 if (propValue['@@toStringTag'] === 'Symbol') {
1044 return true;
1045 }
1046
1047 // Fallback for non-spec compliant Symbols which are polyfilled.
1048 if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1049 return true;
1050 }
1051
1052 return false;
1053 }
1054
1055 // Equivalent of `typeof` but with special handling for array and regexp.
1056 function getPropType(propValue) {
1057 var propType = typeof propValue;
1058 if (Array.isArray(propValue)) {
1059 return 'array';
1060 }
1061 if (propValue instanceof RegExp) {
1062 // Old webkits (at least until Android 4.0) return 'function' rather than
1063 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1064 // passes PropTypes.object.
1065 return 'object';
1066 }
1067 if (isSymbol(propType, propValue)) {
1068 return 'symbol';
1069 }
1070 return propType;
1071 }
1072
1073 // This handles more types than `getPropType`. Only used for error messages.
1074 // See `createPrimitiveTypeChecker`.
1075 function getPreciseType(propValue) {
1076 if (typeof propValue === 'undefined' || propValue === null) {
1077 return '' + propValue;
1078 }
1079 var propType = getPropType(propValue);
1080 if (propType === 'object') {
1081 if (propValue instanceof Date) {
1082 return 'date';
1083 } else if (propValue instanceof RegExp) {
1084 return 'regexp';
1085 }
1086 }
1087 return propType;
1088 }
1089
1090 // Returns a string that is postfixed to a warning about an invalid type.
1091 // For example, "undefined" or "of type array"
1092 function getPostfixForTypeWarning(value) {
1093 var type = getPreciseType(value);
1094 switch (type) {
1095 case 'array':
1096 case 'object':
1097 return 'an ' + type;
1098 case 'boolean':
1099 case 'date':
1100 case 'regexp':
1101 return 'a ' + type;
1102 default:
1103 return type;
1104 }
1105 }
1106
1107 // Returns class name of the object, if any.
1108 function getClassName(propValue) {
1109 if (!propValue.constructor || !propValue.constructor.name) {
1110 return ANONYMOUS;
1111 }
1112 return propValue.constructor.name;
1113 }
1114
1115 ReactPropTypes.checkPropTypes = checkPropTypes_1;
1116 ReactPropTypes.PropTypes = ReactPropTypes;
1117
1118 return ReactPropTypes;
1119 };
1120
1121 var propTypes = createCommonjsModule(function (module) {
1122 /**
1123 * Copyright (c) 2013-present, Facebook, Inc.
1124 *
1125 * This source code is licensed under the MIT license found in the
1126 * LICENSE file in the root directory of this source tree.
1127 */
1128
1129 {
1130 var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
1131 Symbol.for &&
1132 Symbol.for('react.element')) ||
1133 0xeac7;
1134
1135 var isValidElement = function(object) {
1136 return typeof object === 'object' &&
1137 object !== null &&
1138 object.$$typeof === REACT_ELEMENT_TYPE;
1139 };
1140
1141 // By explicitly using `prop-types` you are opting into new development behavior.
1142 // http://fb.me/prop-types-in-prod
1143 var throwOnDirectAccess = true;
1144 module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess);
1145 }
1146 });
1147
1148 {
1149 module.exports = require('./cjs/react-is.development.js');
1150 }
1151
1152 var reactIs$1 = /*#__PURE__*/Object.freeze({
1153 __proto__: null
1154 });
1155
1156 var ReactIs = /*@__PURE__*/getAugmentedNamespace(reactIs$1);
1157
1158 /**
1159 * Copyright 2015, Yahoo! Inc.
1160 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
1161 */
1162
1163 var REACT_STATICS$1 = {
1164 childContextTypes: true,
1165 contextType: true,
1166 contextTypes: true,
1167 defaultProps: true,
1168 displayName: true,
1169 getDefaultProps: true,
1170 getDerivedStateFromError: true,
1171 getDerivedStateFromProps: true,
1172 mixins: true,
1173 propTypes: true,
1174 type: true
1175 };
1176
1177 var KNOWN_STATICS$1 = {
1178 name: true,
1179 length: true,
1180 prototype: true,
1181 caller: true,
1182 callee: true,
1183 arguments: true,
1184 arity: true
1185 };
1186
1187 var FORWARD_REF_STATICS$1 = {
1188 '$$typeof': true,
1189 render: true,
1190 defaultProps: true,
1191 displayName: true,
1192 propTypes: true
1193 };
1194
1195 var MEMO_STATICS = {
1196 '$$typeof': true,
1197 compare: true,
1198 defaultProps: true,
1199 displayName: true,
1200 propTypes: true,
1201 type: true
1202 };
1203
1204 var TYPE_STATICS$1 = {};
1205 TYPE_STATICS$1[ReactIs.ForwardRef] = FORWARD_REF_STATICS$1;
1206
1207 function getStatics(component) {
1208 if (ReactIs.isMemo(component)) {
1209 return MEMO_STATICS;
1210 }
1211 return TYPE_STATICS$1[component['$$typeof']] || REACT_STATICS$1;
1212 }
1213
1214 var defineProperty$1 = Object.defineProperty;
1215 var getOwnPropertyNames$1 = Object.getOwnPropertyNames;
1216 var getOwnPropertySymbols$2 = Object.getOwnPropertySymbols;
1217 var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
1218 var getPrototypeOf$1 = Object.getPrototypeOf;
1219 var objectPrototype$1 = Object.prototype;
1220
1221 function hoistNonReactStatics$1(targetComponent, sourceComponent, blacklist) {
1222 if (typeof sourceComponent !== 'string') {
1223 // don't hoist over string (html) components
1224
1225 if (objectPrototype$1) {
1226 var inheritedComponent = getPrototypeOf$1(sourceComponent);
1227 if (inheritedComponent && inheritedComponent !== objectPrototype$1) {
1228 hoistNonReactStatics$1(targetComponent, inheritedComponent, blacklist);
1229 }
1230 }
1231
1232 var keys = getOwnPropertyNames$1(sourceComponent);
1233
1234 if (getOwnPropertySymbols$2) {
1235 keys = keys.concat(getOwnPropertySymbols$2(sourceComponent));
1236 }
1237
1238 var targetStatics = getStatics(targetComponent);
1239 var sourceStatics = getStatics(sourceComponent);
1240
1241 for (var i = 0; i < keys.length; ++i) {
1242 var key = keys[i];
1243 if (!KNOWN_STATICS$1[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
1244 var descriptor = getOwnPropertyDescriptor$1(sourceComponent, key);
1245 try {
1246 // Avoid failures from read-only properties
1247 defineProperty$1(targetComponent, key, descriptor);
1248 } catch (e) {}
1249 }
1250 }
1251
1252 return targetComponent;
1253 }
1254
1255 return targetComponent;
1256 }
1257
1258 var hoistNonReactStatics_cjs$1 = hoistNonReactStatics$1;
1259
1260 var getDisplayName_1 = createCommonjsModule(function (module, exports) {
1261
1262 Object.defineProperty(exports, "__esModule", {
1263 value: true
1264 });
1265 exports.default = getDisplayName;
1266 function getDisplayName(Component) {
1267 return Component.displayName || Component.name || (typeof Component === 'string' && Component.length > 0 ? Component : 'Unknown');
1268 }
1269 });
1270
1271 var getDisplayName = /*@__PURE__*/getDefaultExportFromCjs(getDisplayName_1);
1272
1273 function _defineProperty(obj, key, value) {
1274 if (key in obj) {
1275 Object.defineProperty(obj, key, {
1276 value: value,
1277 enumerable: true,
1278 configurable: true,
1279 writable: true
1280 });
1281 } else {
1282 obj[key] = value;
1283 }
1284
1285 return obj;
1286 }
1287
1288 function _extends$1() {
1289 _extends$1 = Object.assign || function (target) {
1290 for (var i = 1; i < arguments.length; i++) {
1291 var source = arguments[i];
1292
1293 for (var key in source) {
1294 if (Object.prototype.hasOwnProperty.call(source, key)) {
1295 target[key] = source[key];
1296 }
1297 }
1298 }
1299
1300 return target;
1301 };
1302
1303 return _extends$1.apply(this, arguments);
1304 }
1305
1306 function _inheritsLoose(subClass, superClass) {
1307 subClass.prototype = Object.create(superClass.prototype);
1308 subClass.prototype.constructor = subClass;
1309 subClass.__proto__ = superClass;
1310 }
1311
1312 function _assertThisInitialized(self) {
1313 if (self === void 0) {
1314 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1315 }
1316
1317 return self;
1318 }
1319
1320 function isObject(obj) {
1321 return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
1322 }
1323
1324 function createThemeProvider(context) {
1325 var ThemeProvider =
1326 /*#__PURE__*/
1327 function (_React$Component) {
1328 _inheritsLoose(ThemeProvider, _React$Component);
1329
1330 function ThemeProvider() {
1331 var _this;
1332
1333 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1334 args[_key] = arguments[_key];
1335 }
1336
1337 _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
1338
1339 _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "cachedTheme", void 0);
1340
1341 _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "lastOuterTheme", void 0);
1342
1343 _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "lastTheme", void 0);
1344
1345 _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderProvider", function (outerTheme) {
1346 var children = _this.props.children;
1347 return React__default['default'].createElement(context.Provider, {
1348 value: _this.getTheme(outerTheme)
1349 }, children);
1350 });
1351
1352 return _this;
1353 }
1354
1355 var _proto = ThemeProvider.prototype;
1356
1357 // Get the theme from the props, supporting both (outerTheme) => {} as well as object notation
1358 _proto.getTheme = function getTheme(outerTheme) {
1359 if (this.props.theme !== this.lastTheme || outerTheme !== this.lastOuterTheme || !this.cachedTheme) {
1360 this.lastOuterTheme = outerTheme;
1361 this.lastTheme = this.props.theme;
1362
1363 if (typeof this.lastTheme === 'function') {
1364 var theme = this.props.theme;
1365 this.cachedTheme = theme(outerTheme);
1366 warning(isObject(this.cachedTheme), '[ThemeProvider] Please return an object from your theme function') ;
1367 } else {
1368 var _theme = this.props.theme;
1369 warning(isObject(_theme), '[ThemeProvider] Please make your theme prop a plain object') ;
1370 this.cachedTheme = outerTheme ? _extends$1({}, outerTheme, _theme) : _theme;
1371 }
1372 }
1373
1374 return this.cachedTheme;
1375 };
1376
1377 _proto.render = function render() {
1378 var children = this.props.children;
1379
1380 if (!children) {
1381 return null;
1382 }
1383
1384 return React__default['default'].createElement(context.Consumer, null, this.renderProvider);
1385 };
1386
1387 return ThemeProvider;
1388 }(React__default['default'].Component);
1389
1390 {
1391 ThemeProvider.propTypes = {
1392 // eslint-disable-next-line react/require-default-props
1393 children: propTypes.node,
1394 theme: propTypes.oneOfType([propTypes.shape({}), propTypes.func]).isRequired
1395 };
1396 }
1397
1398 return ThemeProvider;
1399 }
1400
1401 function createWithTheme(context) {
1402 return function hoc(Component) {
1403 var withTheme = React__default['default'].forwardRef(function (props, ref) {
1404 return React__default['default'].createElement(context.Consumer, null, function (theme) {
1405 warning(isObject(theme), '[theming] Please use withTheme only with the ThemeProvider') ;
1406 return React__default['default'].createElement(Component, _extends$1({
1407 theme: theme,
1408 ref: ref
1409 }, props));
1410 });
1411 });
1412
1413 {
1414 withTheme.displayName = "WithTheme(" + getDisplayName(Component) + ")";
1415 }
1416
1417 hoistNonReactStatics_cjs$1(withTheme, Component);
1418 return withTheme;
1419 };
1420 }
1421
1422 function createUseTheme(context) {
1423 var useTheme = function useTheme() {
1424 var theme = React__default['default'].useContext(context);
1425 warning(isObject(theme), '[theming] Please use useTheme only with the ThemeProvider') ;
1426 return theme;
1427 };
1428
1429 return useTheme;
1430 }
1431
1432 function createTheming(context) {
1433 return {
1434 context: context,
1435 withTheme: createWithTheme(context),
1436 useTheme: createUseTheme(context),
1437 ThemeProvider: createThemeProvider(context)
1438 };
1439 }
1440
1441 var ThemeContext = React.createContext();
1442
1443 var _createTheming = createTheming(ThemeContext),
1444 withTheme = _createTheming.withTheme,
1445 ThemeProvider = _createTheming.ThemeProvider,
1446 useTheme = _createTheming.useTheme;
1447
1448 // eslint-disable-next-line no-unused-vars
1449 var getDisplayName$1 = function getDisplayName(Component) {
1450 return Component.displayName || Component.name || 'Component';
1451 };
1452
1453 var memoize = function memoize(fn) {
1454 var lastArgs;
1455 var lastResult;
1456 return function () {
1457 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1458 args[_key] = arguments[_key];
1459 }
1460
1461 if (Array.isArray(lastArgs) && args.length === lastArgs.length) {
1462 var isSame = true;
1463
1464 for (var i = 0; i < args.length; i++) {
1465 if (args[i] !== lastArgs[i]) {
1466 isSame = false;
1467 }
1468 }
1469
1470 if (isSame) {
1471 return lastResult;
1472 }
1473 }
1474
1475 lastArgs = args;
1476 lastResult = fn.apply(void 0, args);
1477 return lastResult;
1478 };
1479 };
1480
1481 var mergeClasses = function mergeClasses(baseClasses, additionalClasses) {
1482 var combinedClasses = _extends({}, baseClasses);
1483
1484 for (var name in additionalClasses) {
1485 combinedClasses[name] = name in combinedClasses ? combinedClasses[name] + " " + additionalClasses[name] : additionalClasses[name];
1486 }
1487
1488 return combinedClasses;
1489 };
1490
1491 /**
1492 * Global index counter to preserve source order.
1493 * As we create the style sheet during componentWillMount lifecycle,
1494 * children are handled after the parents, so the order of style elements would
1495 * be parent->child. It is a problem though when a parent passes a className
1496 * which needs to override any childs styles. StyleSheet of the child has a higher
1497 * specificity, because of the source order.
1498 * So our solution is to render sheets them in the reverse order child->sheet, so
1499 * that parent has a higher specificity.
1500 *
1501 * We start at [Number.MIN_SAFE_INTEGER] to always insert sheets from react-jss first before any
1502 * sheet which might be inserted manually by the user.
1503 */
1504 var index = Number.MIN_SAFE_INTEGER || -1e9;
1505
1506 var getSheetIndex = function getSheetIndex() {
1507 return index++;
1508 };
1509
1510 var _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; };
1511
1512 var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object' && document.nodeType === 9;
1513
1514 var JssContext = React.createContext({
1515 classNamePrefix: '',
1516 disableStylesGeneration: false
1517 });
1518
1519 var defaultManagers = new Map();
1520 var getManager = function getManager(context, managerId) {
1521 // If `managers` map is present in the context, we use it in order to
1522 // let JssProvider reset them when new response has to render server-side.
1523 if (context.managers) {
1524 if (!context.managers[managerId]) {
1525 context.managers[managerId] = new jss$1.SheetsManager();
1526 }
1527
1528 return context.managers[managerId];
1529 }
1530
1531 var manager = defaultManagers.get(managerId);
1532
1533 if (!manager) {
1534 manager = new jss$1.SheetsManager();
1535 defaultManagers.set(managerId, manager);
1536 }
1537
1538 return manager;
1539 };
1540 var manageSheet = function manageSheet(options) {
1541 var sheet = options.sheet,
1542 context = options.context,
1543 index = options.index,
1544 theme = options.theme;
1545
1546 if (!sheet) {
1547 return;
1548 }
1549
1550 var manager = getManager(context, index);
1551 manager.manage(theme);
1552
1553 if (context.registry) {
1554 context.registry.add(sheet);
1555 }
1556 };
1557 var unmanageSheet = function unmanageSheet(options) {
1558 if (!options.sheet) {
1559 return;
1560 }
1561
1562 var manager = getManager(options.context, options.index);
1563 manager.unmanage(options.theme);
1564 };
1565
1566 var now = Date.now();
1567 var fnValuesNs = "fnValues" + now;
1568 var fnRuleNs = "fnStyle" + ++now;
1569
1570 var functionPlugin = function functionPlugin() {
1571 return {
1572 onCreateRule: function onCreateRule(name, decl, options) {
1573 if (typeof decl !== 'function') return null;
1574 var rule = jss$1.createRule(name, {}, options);
1575 rule[fnRuleNs] = decl;
1576 return rule;
1577 },
1578 onProcessStyle: function onProcessStyle(style, rule) {
1579 // We need to extract function values from the declaration, so that we can keep core unaware of them.
1580 // We need to do that only once.
1581 // We don't need to extract functions on each style update, since this can happen only once.
1582 // We don't support function values inside of function rules.
1583 if (fnValuesNs in rule || fnRuleNs in rule) return style;
1584 var fnValues = {};
1585
1586 for (var prop in style) {
1587 var value = style[prop];
1588 if (typeof value !== 'function') continue;
1589 delete style[prop];
1590 fnValues[prop] = value;
1591 } // $FlowFixMe[prop-missing]
1592
1593
1594 rule[fnValuesNs] = fnValues;
1595 return style;
1596 },
1597 onUpdate: function onUpdate(data, rule, sheet, options) {
1598 var styleRule = rule; // $FlowFixMe[prop-missing]
1599
1600 var fnRule = styleRule[fnRuleNs]; // If we have a style function, the entire rule is dynamic and style object
1601 // will be returned from that function.
1602
1603 if (fnRule) {
1604 // Empty object will remove all currently defined props
1605 // in case function rule returns a falsy value.
1606 styleRule.style = fnRule(data) || {};
1607
1608 {
1609 for (var prop in styleRule.style) {
1610 if (typeof styleRule.style[prop] === 'function') {
1611 warning(false, '[JSS] Function values inside function rules are not supported.') ;
1612 break;
1613 }
1614 }
1615 }
1616 } // $FlowFixMe[prop-missing]
1617
1618
1619 var fnValues = styleRule[fnValuesNs]; // If we have a fn values map, it is a rule with function values.
1620
1621 if (fnValues) {
1622 for (var _prop in fnValues) {
1623 styleRule.prop(_prop, fnValues[_prop](data), options);
1624 }
1625 }
1626 }
1627 };
1628 };
1629
1630 function symbolObservablePonyfill(root) {
1631 var result;
1632 var Symbol = root.Symbol;
1633
1634 if (typeof Symbol === 'function') {
1635 if (Symbol.observable) {
1636 result = Symbol.observable;
1637 } else {
1638 result = Symbol('observable');
1639 Symbol.observable = result;
1640 }
1641 } else {
1642 result = '@@observable';
1643 }
1644
1645 return result;
1646 }
1647
1648 /* global window */
1649
1650 var root;
1651
1652 if (typeof self !== 'undefined') {
1653 root = self;
1654 } else if (typeof window !== 'undefined') {
1655 root = window;
1656 } else if (typeof global !== 'undefined') {
1657 root = global;
1658 } else if (typeof module !== 'undefined') {
1659 root = module;
1660 } else {
1661 root = Function('return this')();
1662 }
1663
1664 var result = symbolObservablePonyfill(root);
1665
1666 var isObservable = function isObservable(value) {
1667 return value && value[result] && value === value[result]();
1668 };
1669
1670 var observablePlugin = function observablePlugin(updateOptions) {
1671 return {
1672 onCreateRule: function onCreateRule(name, decl, options) {
1673 if (!isObservable(decl)) return null; // Cast `decl` to `Observable`, since it passed the type guard.
1674
1675 var style$ = decl;
1676 var rule = jss$1.createRule(name, {}, options); // TODO
1677 // Call `stream.subscribe()` returns a subscription, which should be explicitly
1678 // unsubscribed from when we know this sheet is no longer needed.
1679
1680 style$.subscribe(function (style) {
1681 for (var prop in style) {
1682 rule.prop(prop, style[prop], updateOptions);
1683 }
1684 });
1685 return rule;
1686 },
1687 onProcessRule: function onProcessRule(rule) {
1688 if (rule && rule.type !== 'style') return;
1689 var styleRule = rule;
1690 var style = styleRule.style;
1691
1692 var _loop = function _loop(prop) {
1693 var value = style[prop];
1694 if (!isObservable(value)) return "continue";
1695 delete style[prop];
1696 value.subscribe({
1697 next: function next(nextValue) {
1698 styleRule.prop(prop, nextValue, updateOptions);
1699 }
1700 });
1701 };
1702
1703 for (var prop in style) {
1704 var _ret = _loop(prop);
1705
1706 if (_ret === "continue") continue;
1707 }
1708 }
1709 };
1710 };
1711
1712 var semiWithNl = /;\n/;
1713 /**
1714 * Naive CSS parser.
1715 * - Supports only rule body (no selectors)
1716 * - Requires semicolon and new line after the value (except of last line)
1717 * - No nested rules support
1718 */
1719
1720 var parse = function parse(cssText) {
1721 var style = {};
1722 var split = cssText.split(semiWithNl);
1723
1724 for (var i = 0; i < split.length; i++) {
1725 var decl = (split[i] || '').trim();
1726 if (!decl) continue;
1727 var colonIndex = decl.indexOf(':');
1728
1729 if (colonIndex === -1) {
1730 warning(false, "[JSS] Malformed CSS string \"" + decl + "\"") ;
1731 continue;
1732 }
1733
1734 var prop = decl.substr(0, colonIndex).trim();
1735 var value = decl.substr(colonIndex + 1).trim();
1736 style[prop] = value;
1737 }
1738
1739 return style;
1740 };
1741
1742 var onProcessRule = function onProcessRule(rule) {
1743 if (typeof rule.style === 'string') {
1744 // $FlowFixMe[prop-missing] We can safely assume that rule has the style property
1745 rule.style = parse(rule.style);
1746 }
1747 };
1748
1749 function templatePlugin() {
1750 return {
1751 onProcessRule: onProcessRule
1752 };
1753 }
1754
1755 var at = '@global';
1756 var atPrefix = '@global ';
1757
1758 var GlobalContainerRule =
1759 /*#__PURE__*/
1760 function () {
1761 function GlobalContainerRule(key, styles, options) {
1762 this.type = 'global';
1763 this.at = at;
1764 this.rules = void 0;
1765 this.options = void 0;
1766 this.key = void 0;
1767 this.isProcessed = false;
1768 this.key = key;
1769 this.options = options;
1770 this.rules = new jss$1.RuleList(_extends({}, options, {
1771 parent: this
1772 }));
1773
1774 for (var selector in styles) {
1775 this.rules.add(selector, styles[selector]);
1776 }
1777
1778 this.rules.process();
1779 }
1780 /**
1781 * Get a rule.
1782 */
1783
1784
1785 var _proto = GlobalContainerRule.prototype;
1786
1787 _proto.getRule = function getRule(name) {
1788 return this.rules.get(name);
1789 }
1790 /**
1791 * Create and register rule, run plugins.
1792 */
1793 ;
1794
1795 _proto.addRule = function addRule(name, style, options) {
1796 var rule = this.rules.add(name, style, options);
1797 if (rule) this.options.jss.plugins.onProcessRule(rule);
1798 return rule;
1799 }
1800 /**
1801 * Get index of a rule.
1802 */
1803 ;
1804
1805 _proto.indexOf = function indexOf(rule) {
1806 return this.rules.indexOf(rule);
1807 }
1808 /**
1809 * Generates a CSS string.
1810 */
1811 ;
1812
1813 _proto.toString = function toString() {
1814 return this.rules.toString();
1815 };
1816
1817 return GlobalContainerRule;
1818 }();
1819
1820 var GlobalPrefixedRule =
1821 /*#__PURE__*/
1822 function () {
1823 function GlobalPrefixedRule(key, style, options) {
1824 this.type = 'global';
1825 this.at = at;
1826 this.options = void 0;
1827 this.rule = void 0;
1828 this.isProcessed = false;
1829 this.key = void 0;
1830 this.key = key;
1831 this.options = options;
1832 var selector = key.substr(atPrefix.length);
1833 this.rule = options.jss.createRule(selector, style, _extends({}, options, {
1834 parent: this
1835 }));
1836 }
1837
1838 var _proto2 = GlobalPrefixedRule.prototype;
1839
1840 _proto2.toString = function toString(options) {
1841 return this.rule ? this.rule.toString(options) : '';
1842 };
1843
1844 return GlobalPrefixedRule;
1845 }();
1846
1847 var separatorRegExp = /\s*,\s*/g;
1848
1849 function addScope(selector, scope) {
1850 var parts = selector.split(separatorRegExp);
1851 var scoped = '';
1852
1853 for (var i = 0; i < parts.length; i++) {
1854 scoped += scope + " " + parts[i].trim();
1855 if (parts[i + 1]) scoped += ', ';
1856 }
1857
1858 return scoped;
1859 }
1860
1861 function handleNestedGlobalContainerRule(rule, sheet) {
1862 var options = rule.options,
1863 style = rule.style;
1864 var rules = style ? style[at] : null;
1865 if (!rules) return;
1866
1867 for (var name in rules) {
1868 sheet.addRule(name, rules[name], _extends({}, options, {
1869 selector: addScope(name, rule.selector)
1870 }));
1871 }
1872
1873 delete style[at];
1874 }
1875
1876 function handlePrefixedGlobalRule(rule, sheet) {
1877 var options = rule.options,
1878 style = rule.style;
1879
1880 for (var prop in style) {
1881 if (prop[0] !== '@' || prop.substr(0, at.length) !== at) continue;
1882 var selector = addScope(prop.substr(at.length), rule.selector);
1883 sheet.addRule(selector, style[prop], _extends({}, options, {
1884 selector: selector
1885 }));
1886 delete style[prop];
1887 }
1888 }
1889 /**
1890 * Convert nested rules to separate, remove them from original styles.
1891 *
1892 * @param {Rule} rule
1893 * @api public
1894 */
1895
1896
1897 function jssGlobal() {
1898 function onCreateRule(name, styles, options) {
1899 if (!name) return null;
1900
1901 if (name === at) {
1902 return new GlobalContainerRule(name, styles, options);
1903 }
1904
1905 if (name[0] === '@' && name.substr(0, atPrefix.length) === atPrefix) {
1906 return new GlobalPrefixedRule(name, styles, options);
1907 }
1908
1909 var parent = options.parent;
1910
1911 if (parent) {
1912 if (parent.type === 'global' || parent.options.parent && parent.options.parent.type === 'global') {
1913 options.scoped = false;
1914 }
1915 }
1916
1917 if (options.scoped === false) {
1918 options.selector = name;
1919 }
1920
1921 return null;
1922 }
1923
1924 function onProcessRule(rule, sheet) {
1925 if (rule.type !== 'style' || !sheet) return;
1926 handleNestedGlobalContainerRule(rule, sheet);
1927 handlePrefixedGlobalRule(rule, sheet);
1928 }
1929
1930 return {
1931 onCreateRule: onCreateRule,
1932 onProcessRule: onProcessRule
1933 };
1934 }
1935
1936 var isObject$1 = function isObject(obj) {
1937 return obj && typeof obj === 'object' && !Array.isArray(obj);
1938 };
1939
1940 var valueNs = "extendCurrValue" + Date.now();
1941
1942 function mergeExtend(style, rule, sheet, newStyle) {
1943 var extendType = typeof style.extend; // Extend using a rule name.
1944
1945 if (extendType === 'string') {
1946 if (!sheet) return;
1947 var refRule = sheet.getRule(style.extend);
1948 if (!refRule) return;
1949
1950 if (refRule === rule) {
1951 warning(false, "[JSS] A rule tries to extend itself \n" + rule.toString()) ;
1952 return;
1953 }
1954
1955 var parent = refRule.options.parent;
1956
1957 if (parent) {
1958 var originalStyle = parent.rules.raw[style.extend];
1959 extend(originalStyle, rule, sheet, newStyle);
1960 }
1961
1962 return;
1963 } // Extend using an array.
1964
1965
1966 if (Array.isArray(style.extend)) {
1967 for (var index = 0; index < style.extend.length; index++) {
1968 var singleExtend = style.extend[index];
1969 var singleStyle = typeof singleExtend === 'string' ? _extends({}, style, {
1970 extend: singleExtend
1971 }) : style.extend[index];
1972 extend(singleStyle, rule, sheet, newStyle);
1973 }
1974
1975 return;
1976 } // Extend is a style object.
1977
1978
1979 for (var prop in style.extend) {
1980 if (prop === 'extend') {
1981 extend(style.extend.extend, rule, sheet, newStyle);
1982 continue;
1983 }
1984
1985 if (isObject$1(style.extend[prop])) {
1986 if (!(prop in newStyle)) newStyle[prop] = {};
1987 extend(style.extend[prop], rule, sheet, newStyle[prop]);
1988 continue;
1989 }
1990
1991 newStyle[prop] = style.extend[prop];
1992 }
1993 }
1994
1995 function mergeRest(style, rule, sheet, newStyle) {
1996 // Copy base style.
1997 for (var prop in style) {
1998 if (prop === 'extend') continue;
1999
2000 if (isObject$1(newStyle[prop]) && isObject$1(style[prop])) {
2001 extend(style[prop], rule, sheet, newStyle[prop]);
2002 continue;
2003 }
2004
2005 if (isObject$1(style[prop])) {
2006 newStyle[prop] = extend(style[prop], rule, sheet);
2007 continue;
2008 }
2009
2010 newStyle[prop] = style[prop];
2011 }
2012 }
2013 /**
2014 * Recursively extend styles.
2015 */
2016
2017
2018 function extend(style, rule, sheet, newStyle) {
2019 if (newStyle === void 0) {
2020 newStyle = {};
2021 }
2022
2023 mergeExtend(style, rule, sheet, newStyle);
2024 mergeRest(style, rule, sheet, newStyle);
2025 return newStyle;
2026 }
2027 /**
2028 * Handle `extend` property.
2029 *
2030 * @param {Rule} rule
2031 * @api public
2032 */
2033
2034
2035 function jssExtend() {
2036 function onProcessStyle(style, rule, sheet) {
2037 if ('extend' in style) return extend(style, rule, sheet);
2038 return style;
2039 }
2040
2041 function onChangeValue(value, prop, rule) {
2042 if (prop !== 'extend') return value; // Value is empty, remove properties set previously.
2043
2044 if (value == null || value === false) {
2045 // $FlowFixMe[prop-missing]
2046 for (var key in rule[valueNs]) {
2047 rule.prop(key, null);
2048 } // $FlowFixMe[prop-missing] Flow complains because there is no indexer property in StyleRule
2049
2050
2051 rule[valueNs] = null;
2052 return null;
2053 }
2054
2055 if (typeof value === 'object') {
2056 // $FlowFixMe[invalid-in-rhs] This will be an object
2057 for (var _key in value) {
2058 // $FlowFixMe[incompatible-use] This will be an object
2059 rule.prop(_key, value[_key]);
2060 } // $FlowFixMe[prop-missing] Flow complains because there is no indexer property in StyleRule
2061
2062
2063 rule[valueNs] = value;
2064 } // Make sure we don't set the value in the core.
2065
2066
2067 return null;
2068 }
2069
2070 return {
2071 onProcessStyle: onProcessStyle,
2072 onChangeValue: onChangeValue
2073 };
2074 }
2075
2076 var separatorRegExp$1 = /\s*,\s*/g;
2077 var parentRegExp = /&/g;
2078 var refRegExp = /\$([\w-]+)/g;
2079 /**
2080 * Convert nested rules to separate, remove them from original styles.
2081 *
2082 * @param {Rule} rule
2083 * @api public
2084 */
2085
2086 function jssNested() {
2087 // Get a function to be used for $ref replacement.
2088 function getReplaceRef(container, sheet) {
2089 return function (match, key) {
2090 var rule = container.getRule(key) || sheet && sheet.getRule(key);
2091
2092 if (rule) {
2093 rule = rule;
2094 return rule.selector;
2095 }
2096
2097 warning(false, "[JSS] Could not find the referenced rule \"" + key + "\" in \"" + (container.options.meta || container.toString()) + "\".") ;
2098 return key;
2099 };
2100 }
2101
2102 function replaceParentRefs(nestedProp, parentProp) {
2103 var parentSelectors = parentProp.split(separatorRegExp$1);
2104 var nestedSelectors = nestedProp.split(separatorRegExp$1);
2105 var result = '';
2106
2107 for (var i = 0; i < parentSelectors.length; i++) {
2108 var parent = parentSelectors[i];
2109
2110 for (var j = 0; j < nestedSelectors.length; j++) {
2111 var nested = nestedSelectors[j];
2112 if (result) result += ', '; // Replace all & by the parent or prefix & with the parent.
2113
2114 result += nested.indexOf('&') !== -1 ? nested.replace(parentRegExp, parent) : parent + " " + nested;
2115 }
2116 }
2117
2118 return result;
2119 }
2120
2121 function getOptions(rule, container, prevOptions) {
2122 // Options has been already created, now we only increase index.
2123 if (prevOptions) return _extends({}, prevOptions, {
2124 index: prevOptions.index + 1 // $FlowFixMe[prop-missing]
2125
2126 });
2127 var nestingLevel = rule.options.nestingLevel;
2128 nestingLevel = nestingLevel === undefined ? 1 : nestingLevel + 1;
2129
2130 var options = _extends({}, rule.options, {
2131 nestingLevel: nestingLevel,
2132 index: container.indexOf(rule) + 1 // We don't need the parent name to be set options for chlid.
2133
2134 });
2135
2136 delete options.name;
2137 return options;
2138 }
2139
2140 function onProcessStyle(style, rule, sheet) {
2141 if (rule.type !== 'style') return style;
2142 var styleRule = rule;
2143 var container = styleRule.options.parent;
2144 var options;
2145 var replaceRef;
2146
2147 for (var prop in style) {
2148 var isNested = prop.indexOf('&') !== -1;
2149 var isNestedConditional = prop[0] === '@';
2150 if (!isNested && !isNestedConditional) continue;
2151 options = getOptions(styleRule, container, options);
2152
2153 if (isNested) {
2154 var selector = replaceParentRefs(prop, styleRule.selector); // Lazily create the ref replacer function just once for
2155 // all nested rules within the sheet.
2156
2157 if (!replaceRef) replaceRef = getReplaceRef(container, sheet); // Replace all $refs.
2158
2159 selector = selector.replace(refRegExp, replaceRef);
2160 container.addRule(selector, style[prop], _extends({}, options, {
2161 selector: selector
2162 }));
2163 } else if (isNestedConditional) {
2164 // Place conditional right after the parent rule to ensure right ordering.
2165 container.addRule(prop, {}, options) // Flow expects more options but they aren't required
2166 // And flow doesn't know this will always be a StyleRule which has the addRule method
2167 // $FlowFixMe[incompatible-use]
2168 // $FlowFixMe[prop-missing]
2169 .addRule(styleRule.key, style[prop], {
2170 selector: styleRule.selector
2171 });
2172 }
2173
2174 delete style[prop];
2175 }
2176
2177 return style;
2178 }
2179
2180 return {
2181 onProcessStyle: onProcessStyle
2182 };
2183 }
2184
2185 /**
2186 * Set selector.
2187 *
2188 * @param {Object} original rule
2189 * @param {String} className class string
2190 * @return {Boolean} flag, indicating function was successfull or not
2191 */
2192
2193 function registerClass(rule, className) {
2194 // Skip falsy values
2195 if (!className) return true; // Support array of class names `{composes: ['foo', 'bar']}`
2196
2197 if (Array.isArray(className)) {
2198 for (var index = 0; index < className.length; index++) {
2199 var isSetted = registerClass(rule, className[index]);
2200 if (!isSetted) return false;
2201 }
2202
2203 return true;
2204 } // Support space separated class names `{composes: 'foo bar'}`
2205
2206
2207 if (className.indexOf(' ') > -1) {
2208 return registerClass(rule, className.split(' '));
2209 }
2210
2211 var _ref = rule.options,
2212 parent = _ref.parent; // It is a ref to a local rule.
2213
2214 if (className[0] === '$') {
2215 var refRule = parent.getRule(className.substr(1));
2216
2217 if (!refRule) {
2218 warning(false, "[JSS] Referenced rule is not defined. \n" + rule.toString()) ;
2219 return false;
2220 }
2221
2222 if (refRule === rule) {
2223 warning(false, "[JSS] Cyclic composition detected. \n" + rule.toString()) ;
2224 return false;
2225 }
2226
2227 parent.classes[rule.key] += " " + parent.classes[refRule.key];
2228 return true;
2229 }
2230
2231 parent.classes[rule.key] += " " + className;
2232 return true;
2233 }
2234 /**
2235 * Convert compose property to additional class, remove property from original styles.
2236 *
2237 * @param {Rule} rule
2238 * @api public
2239 */
2240
2241
2242 function jssCompose() {
2243 function onProcessStyle(style, rule) {
2244 if (!('composes' in style)) return style;
2245 registerClass(rule, style.composes); // Remove composes property to prevent infinite loop.
2246
2247 delete style.composes;
2248 return style;
2249 }
2250
2251 return {
2252 onProcessStyle: onProcessStyle
2253 };
2254 }
2255
2256 /* eslint-disable no-var, prefer-template */
2257 var uppercasePattern = /[A-Z]/g;
2258 var msPattern = /^ms-/;
2259 var cache = {};
2260
2261 function toHyphenLower(match) {
2262 return '-' + match.toLowerCase()
2263 }
2264
2265 function hyphenateStyleName(name) {
2266 if (cache.hasOwnProperty(name)) {
2267 return cache[name]
2268 }
2269
2270 var hName = name.replace(uppercasePattern, toHyphenLower);
2271 return (cache[name] = msPattern.test(hName) ? '-' + hName : hName)
2272 }
2273
2274 /**
2275 * Convert camel cased property names to dash separated.
2276 *
2277 * @param {Object} style
2278 * @return {Object}
2279 */
2280
2281 function convertCase(style) {
2282 var converted = {};
2283
2284 for (var prop in style) {
2285 var key = prop.indexOf('--') === 0 ? prop : hyphenateStyleName(prop);
2286 converted[key] = style[prop];
2287 }
2288
2289 if (style.fallbacks) {
2290 if (Array.isArray(style.fallbacks)) converted.fallbacks = style.fallbacks.map(convertCase);else converted.fallbacks = convertCase(style.fallbacks);
2291 }
2292
2293 return converted;
2294 }
2295 /**
2296 * Allow camel cased property names by converting them back to dasherized.
2297 *
2298 * @param {Rule} rule
2299 */
2300
2301
2302 function camelCase() {
2303 function onProcessStyle(style) {
2304 if (Array.isArray(style)) {
2305 // Handle rules like @font-face, which can have multiple styles in an array
2306 for (var index = 0; index < style.length; index++) {
2307 style[index] = convertCase(style[index]);
2308 }
2309
2310 return style;
2311 }
2312
2313 return convertCase(style);
2314 }
2315
2316 function onChangeValue(value, prop, rule) {
2317 if (prop.indexOf('--') === 0) {
2318 return value;
2319 }
2320
2321 var hyphenatedProp = hyphenateStyleName(prop); // There was no camel case in place
2322
2323 if (prop === hyphenatedProp) return value;
2324 rule.prop(hyphenatedProp, value); // Core will ignore that property value we set the proper one above.
2325
2326 return null;
2327 }
2328
2329 return {
2330 onProcessStyle: onProcessStyle,
2331 onChangeValue: onChangeValue
2332 };
2333 }
2334
2335 var px = jss$1.hasCSSTOMSupport && CSS ? CSS.px : 'px';
2336 var ms = jss$1.hasCSSTOMSupport && CSS ? CSS.ms : 'ms';
2337 var percent = jss$1.hasCSSTOMSupport && CSS ? CSS.percent : '%';
2338 /**
2339 * Generated jss-plugin-default-unit CSS property units
2340 *
2341 * @type object
2342 */
2343
2344 var defaultUnits = {
2345 // Animation properties
2346 'animation-delay': ms,
2347 'animation-duration': ms,
2348 // Background properties
2349 'background-position': px,
2350 'background-position-x': px,
2351 'background-position-y': px,
2352 'background-size': px,
2353 // Border Properties
2354 border: px,
2355 'border-bottom': px,
2356 'border-bottom-left-radius': px,
2357 'border-bottom-right-radius': px,
2358 'border-bottom-width': px,
2359 'border-left': px,
2360 'border-left-width': px,
2361 'border-radius': px,
2362 'border-right': px,
2363 'border-right-width': px,
2364 'border-top': px,
2365 'border-top-left-radius': px,
2366 'border-top-right-radius': px,
2367 'border-top-width': px,
2368 'border-width': px,
2369 'border-block': px,
2370 'border-block-end': px,
2371 'border-block-end-width': px,
2372 'border-block-start': px,
2373 'border-block-start-width': px,
2374 'border-block-width': px,
2375 'border-inline': px,
2376 'border-inline-end': px,
2377 'border-inline-end-width': px,
2378 'border-inline-start': px,
2379 'border-inline-start-width': px,
2380 'border-inline-width': px,
2381 'border-start-start-radius': px,
2382 'border-start-end-radius': px,
2383 'border-end-start-radius': px,
2384 'border-end-end-radius': px,
2385 // Margin properties
2386 margin: px,
2387 'margin-bottom': px,
2388 'margin-left': px,
2389 'margin-right': px,
2390 'margin-top': px,
2391 'margin-block': px,
2392 'margin-block-end': px,
2393 'margin-block-start': px,
2394 'margin-inline': px,
2395 'margin-inline-end': px,
2396 'margin-inline-start': px,
2397 // Padding properties
2398 padding: px,
2399 'padding-bottom': px,
2400 'padding-left': px,
2401 'padding-right': px,
2402 'padding-top': px,
2403 'padding-block': px,
2404 'padding-block-end': px,
2405 'padding-block-start': px,
2406 'padding-inline': px,
2407 'padding-inline-end': px,
2408 'padding-inline-start': px,
2409 // Mask properties
2410 'mask-position-x': px,
2411 'mask-position-y': px,
2412 'mask-size': px,
2413 // Width and height properties
2414 height: px,
2415 width: px,
2416 'min-height': px,
2417 'max-height': px,
2418 'min-width': px,
2419 'max-width': px,
2420 // Position properties
2421 bottom: px,
2422 left: px,
2423 top: px,
2424 right: px,
2425 inset: px,
2426 'inset-block': px,
2427 'inset-block-end': px,
2428 'inset-block-start': px,
2429 'inset-inline': px,
2430 'inset-inline-end': px,
2431 'inset-inline-start': px,
2432 // Shadow properties
2433 'box-shadow': px,
2434 'text-shadow': px,
2435 // Column properties
2436 'column-gap': px,
2437 'column-rule': px,
2438 'column-rule-width': px,
2439 'column-width': px,
2440 // Font and text properties
2441 'font-size': px,
2442 'font-size-delta': px,
2443 'letter-spacing': px,
2444 'text-decoration-thickness': px,
2445 'text-indent': px,
2446 'text-stroke': px,
2447 'text-stroke-width': px,
2448 'word-spacing': px,
2449 // Motion properties
2450 motion: px,
2451 'motion-offset': px,
2452 // Outline properties
2453 outline: px,
2454 'outline-offset': px,
2455 'outline-width': px,
2456 // Perspective properties
2457 perspective: px,
2458 'perspective-origin-x': percent,
2459 'perspective-origin-y': percent,
2460 // Transform properties
2461 'transform-origin': percent,
2462 'transform-origin-x': percent,
2463 'transform-origin-y': percent,
2464 'transform-origin-z': percent,
2465 // Transition properties
2466 'transition-delay': ms,
2467 'transition-duration': ms,
2468 // Alignment properties
2469 'vertical-align': px,
2470 'flex-basis': px,
2471 // Some random properties
2472 'shape-margin': px,
2473 size: px,
2474 gap: px,
2475 // Grid properties
2476 grid: px,
2477 'grid-gap': px,
2478 'row-gap': px,
2479 'grid-row-gap': px,
2480 'grid-column-gap': px,
2481 'grid-template-rows': px,
2482 'grid-template-columns': px,
2483 'grid-auto-rows': px,
2484 'grid-auto-columns': px,
2485 // Not existing properties.
2486 // Used to avoid issues with jss-plugin-expand integration.
2487 'box-shadow-x': px,
2488 'box-shadow-y': px,
2489 'box-shadow-blur': px,
2490 'box-shadow-spread': px,
2491 'font-line-height': px,
2492 'text-shadow-x': px,
2493 'text-shadow-y': px,
2494 'text-shadow-blur': px
2495 };
2496 /**
2497 * Clones the object and adds a camel cased property version.
2498 */
2499
2500 function addCamelCasedVersion(obj) {
2501 var regExp = /(-[a-z])/g;
2502
2503 var replace = function replace(str) {
2504 return str[1].toUpperCase();
2505 };
2506
2507 var newObj = {};
2508
2509 for (var _key in obj) {
2510 newObj[_key] = obj[_key];
2511 newObj[_key.replace(regExp, replace)] = obj[_key];
2512 }
2513
2514 return newObj;
2515 }
2516
2517 var units = addCamelCasedVersion(defaultUnits);
2518 /**
2519 * Recursive deep style passing function
2520 */
2521
2522 function iterate(prop, value, options) {
2523 if (value == null) return value;
2524
2525 if (Array.isArray(value)) {
2526 for (var i = 0; i < value.length; i++) {
2527 value[i] = iterate(prop, value[i], options);
2528 }
2529 } else if (typeof value === 'object') {
2530 if (prop === 'fallbacks') {
2531 for (var innerProp in value) {
2532 value[innerProp] = iterate(innerProp, value[innerProp], options);
2533 }
2534 } else {
2535 for (var _innerProp in value) {
2536 value[_innerProp] = iterate(prop + "-" + _innerProp, value[_innerProp], options);
2537 }
2538 } // eslint-disable-next-line no-restricted-globals
2539
2540 } else if (typeof value === 'number' && isNaN(value) === false) {
2541 var unit = options[prop] || units[prop]; // Add the unit if available, except for the special case of 0px.
2542
2543 if (unit && !(value === 0 && unit === px)) {
2544 return typeof unit === 'function' ? unit(value).toString() : "" + value + unit;
2545 }
2546
2547 return value.toString();
2548 }
2549
2550 return value;
2551 }
2552 /**
2553 * Add unit to numeric values.
2554 */
2555
2556
2557 function defaultUnit(options) {
2558 if (options === void 0) {
2559 options = {};
2560 }
2561
2562 var camelCasedOptions = addCamelCasedVersion(options);
2563
2564 function onProcessStyle(style, rule) {
2565 if (rule.type !== 'style') return style;
2566
2567 for (var prop in style) {
2568 style[prop] = iterate(prop, style[prop], camelCasedOptions);
2569 }
2570
2571 return style;
2572 }
2573
2574 function onChangeValue(value, prop) {
2575 return iterate(prop, value, camelCasedOptions);
2576 }
2577
2578 return {
2579 onProcessStyle: onProcessStyle,
2580 onChangeValue: onChangeValue
2581 };
2582 }
2583
2584 /**
2585 * A scheme for converting properties from array to regular style.
2586 * All properties listed below will be transformed to a string separated by space.
2587 */
2588 var propArray = {
2589 'background-size': true,
2590 'background-position': true,
2591 border: true,
2592 'border-bottom': true,
2593 'border-left': true,
2594 'border-top': true,
2595 'border-right': true,
2596 'border-radius': true,
2597 'border-image': true,
2598 'border-width': true,
2599 'border-style': true,
2600 'border-color': true,
2601 'box-shadow': true,
2602 flex: true,
2603 margin: true,
2604 padding: true,
2605 outline: true,
2606 'transform-origin': true,
2607 transform: true,
2608 transition: true
2609 /**
2610 * A scheme for converting arrays to regular styles inside of objects.
2611 * For e.g.: "{position: [0, 0]}" => "background-position: 0 0;".
2612 */
2613
2614 };
2615 var propArrayInObj = {
2616 position: true,
2617 // background-position
2618 size: true // background-size
2619
2620 /**
2621 * A scheme for parsing and building correct styles from passed objects.
2622 */
2623
2624 };
2625 var propObj = {
2626 padding: {
2627 top: 0,
2628 right: 0,
2629 bottom: 0,
2630 left: 0
2631 },
2632 margin: {
2633 top: 0,
2634 right: 0,
2635 bottom: 0,
2636 left: 0
2637 },
2638 background: {
2639 attachment: null,
2640 color: null,
2641 image: null,
2642 position: null,
2643 repeat: null
2644 },
2645 border: {
2646 width: null,
2647 style: null,
2648 color: null
2649 },
2650 'border-top': {
2651 width: null,
2652 style: null,
2653 color: null
2654 },
2655 'border-right': {
2656 width: null,
2657 style: null,
2658 color: null
2659 },
2660 'border-bottom': {
2661 width: null,
2662 style: null,
2663 color: null
2664 },
2665 'border-left': {
2666 width: null,
2667 style: null,
2668 color: null
2669 },
2670 outline: {
2671 width: null,
2672 style: null,
2673 color: null
2674 },
2675 'list-style': {
2676 type: null,
2677 position: null,
2678 image: null
2679 },
2680 transition: {
2681 property: null,
2682 duration: null,
2683 'timing-function': null,
2684 timingFunction: null,
2685 // Needed for avoiding comilation issues with jss-plugin-camel-case
2686 delay: null
2687 },
2688 animation: {
2689 name: null,
2690 duration: null,
2691 'timing-function': null,
2692 timingFunction: null,
2693 // Needed to avoid compilation issues with jss-plugin-camel-case
2694 delay: null,
2695 'iteration-count': null,
2696 iterationCount: null,
2697 // Needed to avoid compilation issues with jss-plugin-camel-case
2698 direction: null,
2699 'fill-mode': null,
2700 fillMode: null,
2701 // Needed to avoid compilation issues with jss-plugin-camel-case
2702 'play-state': null,
2703 playState: null // Needed to avoid compilation issues with jss-plugin-camel-case
2704
2705 },
2706 'box-shadow': {
2707 x: 0,
2708 y: 0,
2709 blur: 0,
2710 spread: 0,
2711 color: null,
2712 inset: null
2713 },
2714 'text-shadow': {
2715 x: 0,
2716 y: 0,
2717 blur: null,
2718 color: null
2719 /**
2720 * A scheme for converting non-standart properties inside object.
2721 * For e.g.: include 'border-radius' property inside 'border' object.
2722 */
2723
2724 }
2725 };
2726 var customPropObj = {
2727 border: {
2728 radius: 'border-radius',
2729 image: 'border-image',
2730 width: 'border-width',
2731 style: 'border-style',
2732 color: 'border-color'
2733 },
2734 'border-bottom': {
2735 width: 'border-bottom-width',
2736 style: 'border-bottom-style',
2737 color: 'border-bottom-color'
2738 },
2739 'border-top': {
2740 width: 'border-top-width',
2741 style: 'border-top-style',
2742 color: 'border-top-color'
2743 },
2744 'border-left': {
2745 width: 'border-left-width',
2746 style: 'border-left-style',
2747 color: 'border-left-color'
2748 },
2749 'border-right': {
2750 width: 'border-right-width',
2751 style: 'border-right-style',
2752 color: 'border-right-color'
2753 },
2754 background: {
2755 size: 'background-size',
2756 image: 'background-image'
2757 },
2758 font: {
2759 style: 'font-style',
2760 variant: 'font-variant',
2761 weight: 'font-weight',
2762 stretch: 'font-stretch',
2763 size: 'font-size',
2764 family: 'font-family',
2765 lineHeight: 'line-height',
2766 // Needed to avoid compilation issues with jss-plugin-camel-case
2767 'line-height': 'line-height'
2768 },
2769 flex: {
2770 grow: 'flex-grow',
2771 basis: 'flex-basis',
2772 direction: 'flex-direction',
2773 wrap: 'flex-wrap',
2774 flow: 'flex-flow',
2775 shrink: 'flex-shrink'
2776 },
2777 align: {
2778 self: 'align-self',
2779 items: 'align-items',
2780 content: 'align-content'
2781 },
2782 grid: {
2783 'template-columns': 'grid-template-columns',
2784 templateColumns: 'grid-template-columns',
2785 'template-rows': 'grid-template-rows',
2786 templateRows: 'grid-template-rows',
2787 'template-areas': 'grid-template-areas',
2788 templateAreas: 'grid-template-areas',
2789 template: 'grid-template',
2790 'auto-columns': 'grid-auto-columns',
2791 autoColumns: 'grid-auto-columns',
2792 'auto-rows': 'grid-auto-rows',
2793 autoRows: 'grid-auto-rows',
2794 'auto-flow': 'grid-auto-flow',
2795 autoFlow: 'grid-auto-flow',
2796 row: 'grid-row',
2797 column: 'grid-column',
2798 'row-start': 'grid-row-start',
2799 rowStart: 'grid-row-start',
2800 'row-end': 'grid-row-end',
2801 rowEnd: 'grid-row-end',
2802 'column-start': 'grid-column-start',
2803 columnStart: 'grid-column-start',
2804 'column-end': 'grid-column-end',
2805 columnEnd: 'grid-column-end',
2806 area: 'grid-area',
2807 gap: 'grid-gap',
2808 'row-gap': 'grid-row-gap',
2809 rowGap: 'grid-row-gap',
2810 'column-gap': 'grid-column-gap',
2811 columnGap: 'grid-column-gap'
2812 }
2813 };
2814 /* eslint-disable no-use-before-define */
2815
2816 /**
2817 * Map values by given prop.
2818 *
2819 * @param {Array} array of values
2820 * @param {String} original property
2821 * @param {String} original rule
2822 * @return {String} mapped values
2823 */
2824
2825 function mapValuesByProp(value, prop, rule) {
2826 return value.map(function (item) {
2827 return objectToArray(item, prop, rule, false, true);
2828 });
2829 }
2830 /**
2831 * Convert array to nested array, if needed
2832 */
2833
2834
2835 function processArray(value, prop, scheme, rule) {
2836 if (scheme[prop] == null) return value;
2837 if (value.length === 0) return [];
2838 if (Array.isArray(value[0])) return processArray(value[0], prop, scheme, rule);
2839
2840 if (typeof value[0] === 'object') {
2841 return mapValuesByProp(value, prop, rule);
2842 }
2843
2844 return [value];
2845 }
2846 /**
2847 * Convert object to array.
2848 */
2849
2850
2851 function objectToArray(value, prop, rule, isFallback, isInArray) {
2852 if (!(propObj[prop] || customPropObj[prop])) return [];
2853 var result = []; // Check if exists any non-standard property
2854
2855 if (customPropObj[prop]) {
2856 // eslint-disable-next-line no-param-reassign
2857 value = customPropsToStyle(value, rule, customPropObj[prop], isFallback);
2858 } // Pass throught all standart props
2859
2860
2861 if (Object.keys(value).length) {
2862 for (var baseProp in propObj[prop]) {
2863 if (value[baseProp]) {
2864 if (Array.isArray(value[baseProp])) {
2865 result.push(propArrayInObj[baseProp] === null ? value[baseProp] : value[baseProp].join(' '));
2866 } else result.push(value[baseProp]);
2867
2868 continue;
2869 } // Add default value from props config.
2870
2871
2872 if (propObj[prop][baseProp] != null) {
2873 result.push(propObj[prop][baseProp]);
2874 }
2875 }
2876 }
2877
2878 if (!result.length || isInArray) return result;
2879 return [result];
2880 }
2881 /**
2882 * Convert custom properties values to styles adding them to rule directly
2883 */
2884
2885
2886 function customPropsToStyle(value, rule, customProps, isFallback) {
2887 for (var prop in customProps) {
2888 var propName = customProps[prop]; // If current property doesn't exist already in rule - add new one
2889
2890 if (typeof value[prop] !== 'undefined' && (isFallback || !rule.prop(propName))) {
2891 var _styleDetector;
2892
2893 var appendedValue = styleDetector((_styleDetector = {}, _styleDetector[propName] = value[prop], _styleDetector), rule)[propName]; // Add style directly in rule
2894
2895 if (isFallback) rule.style.fallbacks[propName] = appendedValue;else rule.style[propName] = appendedValue;
2896 } // Delete converted property to avoid double converting
2897
2898
2899 delete value[prop];
2900 }
2901
2902 return value;
2903 }
2904 /**
2905 * Detect if a style needs to be converted.
2906 */
2907
2908
2909 function styleDetector(style, rule, isFallback) {
2910 for (var prop in style) {
2911 var value = style[prop];
2912
2913 if (Array.isArray(value)) {
2914 // Check double arrays to avoid recursion.
2915 if (!Array.isArray(value[0])) {
2916 if (prop === 'fallbacks') {
2917 for (var index = 0; index < style.fallbacks.length; index++) {
2918 style.fallbacks[index] = styleDetector(style.fallbacks[index], rule, true);
2919 }
2920
2921 continue;
2922 }
2923
2924 style[prop] = processArray(value, prop, propArray, rule); // Avoid creating properties with empty values
2925
2926 if (!style[prop].length) delete style[prop];
2927 }
2928 } else if (typeof value === 'object') {
2929 if (prop === 'fallbacks') {
2930 style.fallbacks = styleDetector(style.fallbacks, rule, true);
2931 continue;
2932 }
2933
2934 style[prop] = objectToArray(value, prop, rule, isFallback); // Avoid creating properties with empty values
2935
2936 if (!style[prop].length) delete style[prop];
2937 } // Maybe a computed value resulting in an empty string
2938 else if (style[prop] === '') delete style[prop];
2939 }
2940
2941 return style;
2942 }
2943 /**
2944 * Adds possibility to write expanded styles.
2945 */
2946
2947
2948 function jssExpand() {
2949 function onProcessStyle(style, rule) {
2950 if (!style || rule.type !== 'style') return style;
2951
2952 if (Array.isArray(style)) {
2953 // Pass rules one by one and reformat them
2954 for (var index = 0; index < style.length; index++) {
2955 style[index] = styleDetector(style[index], rule);
2956 }
2957
2958 return style;
2959 }
2960
2961 return styleDetector(style, rule);
2962 }
2963
2964 return {
2965 onProcessStyle: onProcessStyle
2966 };
2967 }
2968
2969 function _arrayLikeToArray(arr, len) {
2970 if (len == null || len > arr.length) len = arr.length;
2971
2972 for (var i = 0, arr2 = new Array(len); i < len; i++) {
2973 arr2[i] = arr[i];
2974 }
2975
2976 return arr2;
2977 }
2978
2979 function _arrayWithoutHoles(arr) {
2980 if (Array.isArray(arr)) return _arrayLikeToArray(arr);
2981 }
2982
2983 function _iterableToArray(iter) {
2984 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
2985 }
2986
2987 function _unsupportedIterableToArray(o, minLen) {
2988 if (!o) return;
2989 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
2990 var n = Object.prototype.toString.call(o).slice(8, -1);
2991 if (n === "Object" && o.constructor) n = o.constructor.name;
2992 if (n === "Map" || n === "Set") return Array.from(n);
2993 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
2994 }
2995
2996 function _nonIterableSpread() {
2997 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2998 }
2999
3000 function _toConsumableArray(arr) {
3001 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
3002 }
3003
3004 // Export javascript style and css style vendor prefixes.
3005 var js = '';
3006 var css = '';
3007 var vendor = '';
3008 var browser = '';
3009 var isTouch = isBrowser && 'ontouchstart' in document.documentElement; // We should not do anything if required serverside.
3010
3011 if (isBrowser) {
3012 // Order matters. We need to check Webkit the last one because
3013 // other vendors use to add Webkit prefixes to some properties
3014 var jsCssMap = {
3015 Moz: '-moz-',
3016 ms: '-ms-',
3017 O: '-o-',
3018 Webkit: '-webkit-'
3019 };
3020
3021 var _document$createEleme = document.createElement('p'),
3022 style = _document$createEleme.style;
3023
3024 var testProp = 'Transform';
3025
3026 for (var key in jsCssMap) {
3027 if (key + testProp in style) {
3028 js = key;
3029 css = jsCssMap[key];
3030 break;
3031 }
3032 } // Correctly detect the Edge browser.
3033
3034
3035 if (js === 'Webkit' && 'msHyphens' in style) {
3036 js = 'ms';
3037 css = jsCssMap.ms;
3038 browser = 'edge';
3039 } // Correctly detect the Safari browser.
3040
3041
3042 if (js === 'Webkit' && '-apple-trailing-word' in style) {
3043 vendor = 'apple';
3044 }
3045 }
3046 /**
3047 * Vendor prefix string for the current browser.
3048 *
3049 * @type {{js: String, css: String, vendor: String, browser: String}}
3050 * @api public
3051 */
3052
3053
3054 var prefix = {
3055 js: js,
3056 css: css,
3057 vendor: vendor,
3058 browser: browser,
3059 isTouch: isTouch
3060 };
3061
3062 /**
3063 * Test if a keyframe at-rule should be prefixed or not
3064 *
3065 * @param {String} vendor prefix string for the current browser.
3066 * @return {String}
3067 * @api public
3068 */
3069
3070 function supportedKeyframes(key) {
3071 // Keyframes is already prefixed. e.g. key = '@-webkit-keyframes a'
3072 if (key[1] === '-') return key; // No need to prefix IE/Edge. Older browsers will ignore unsupported rules.
3073 // https://caniuse.com/#search=keyframes
3074
3075 if (prefix.js === 'ms') return key;
3076 return "@" + prefix.css + "keyframes" + key.substr(10);
3077 }
3078
3079 // https://caniuse.com/#search=appearance
3080
3081 var appearence = {
3082 noPrefill: ['appearance'],
3083 supportedProperty: function supportedProperty(prop) {
3084 if (prop !== 'appearance') return false;
3085 if (prefix.js === 'ms') return "-webkit-" + prop;
3086 return prefix.css + prop;
3087 }
3088 };
3089
3090 // https://caniuse.com/#search=color-adjust
3091
3092 var colorAdjust = {
3093 noPrefill: ['color-adjust'],
3094 supportedProperty: function supportedProperty(prop) {
3095 if (prop !== 'color-adjust') return false;
3096 if (prefix.js === 'Webkit') return prefix.css + "print-" + prop;
3097 return prop;
3098 }
3099 };
3100
3101 var regExp = /[-\s]+(.)?/g;
3102 /**
3103 * Replaces the letter with the capital letter
3104 *
3105 * @param {String} match
3106 * @param {String} c
3107 * @return {String}
3108 * @api private
3109 */
3110
3111 function toUpper(match, c) {
3112 return c ? c.toUpperCase() : '';
3113 }
3114 /**
3115 * Convert dash separated strings to camel-cased.
3116 *
3117 * @param {String} str
3118 * @return {String}
3119 * @api private
3120 */
3121
3122
3123 function camelize(str) {
3124 return str.replace(regExp, toUpper);
3125 }
3126
3127 /**
3128 * Convert dash separated strings to pascal cased.
3129 *
3130 * @param {String} str
3131 * @return {String}
3132 * @api private
3133 */
3134
3135 function pascalize(str) {
3136 return camelize("-" + str);
3137 }
3138
3139 // but we can use a longhand property instead.
3140 // https://caniuse.com/#search=mask
3141
3142 var mask = {
3143 noPrefill: ['mask'],
3144 supportedProperty: function supportedProperty(prop, style) {
3145 if (!/^mask/.test(prop)) return false;
3146
3147 if (prefix.js === 'Webkit') {
3148 var longhand = 'mask-image';
3149
3150 if (camelize(longhand) in style) {
3151 return prop;
3152 }
3153
3154 if (prefix.js + pascalize(longhand) in style) {
3155 return prefix.css + prop;
3156 }
3157 }
3158
3159 return prop;
3160 }
3161 };
3162
3163 // https://caniuse.com/#search=text-orientation
3164
3165 var textOrientation = {
3166 noPrefill: ['text-orientation'],
3167 supportedProperty: function supportedProperty(prop) {
3168 if (prop !== 'text-orientation') return false;
3169
3170 if (prefix.vendor === 'apple' && !prefix.isTouch) {
3171 return prefix.css + prop;
3172 }
3173
3174 return prop;
3175 }
3176 };
3177
3178 // https://caniuse.com/#search=transform
3179
3180 var transform = {
3181 noPrefill: ['transform'],
3182 supportedProperty: function supportedProperty(prop, style, options) {
3183 if (prop !== 'transform') return false;
3184
3185 if (options.transform) {
3186 return prop;
3187 }
3188
3189 return prefix.css + prop;
3190 }
3191 };
3192
3193 // https://caniuse.com/#search=transition
3194
3195 var transition = {
3196 noPrefill: ['transition'],
3197 supportedProperty: function supportedProperty(prop, style, options) {
3198 if (prop !== 'transition') return false;
3199
3200 if (options.transition) {
3201 return prop;
3202 }
3203
3204 return prefix.css + prop;
3205 }
3206 };
3207
3208 // https://caniuse.com/#search=writing-mode
3209
3210 var writingMode = {
3211 noPrefill: ['writing-mode'],
3212 supportedProperty: function supportedProperty(prop) {
3213 if (prop !== 'writing-mode') return false;
3214
3215 if (prefix.js === 'Webkit' || prefix.js === 'ms' && prefix.browser !== 'edge') {
3216 return prefix.css + prop;
3217 }
3218
3219 return prop;
3220 }
3221 };
3222
3223 // https://caniuse.com/#search=user-select
3224
3225 var userSelect = {
3226 noPrefill: ['user-select'],
3227 supportedProperty: function supportedProperty(prop) {
3228 if (prop !== 'user-select') return false;
3229
3230 if (prefix.js === 'Moz' || prefix.js === 'ms' || prefix.vendor === 'apple') {
3231 return prefix.css + prop;
3232 }
3233
3234 return prop;
3235 }
3236 };
3237
3238 // https://caniuse.com/#search=multicolumn
3239 // https://github.com/postcss/autoprefixer/issues/491
3240 // https://github.com/postcss/autoprefixer/issues/177
3241
3242 var breakPropsOld = {
3243 supportedProperty: function supportedProperty(prop, style) {
3244 if (!/^break-/.test(prop)) return false;
3245
3246 if (prefix.js === 'Webkit') {
3247 var jsProp = "WebkitColumn" + pascalize(prop);
3248 return jsProp in style ? prefix.css + "column-" + prop : false;
3249 }
3250
3251 if (prefix.js === 'Moz') {
3252 var _jsProp = "page" + pascalize(prop);
3253
3254 return _jsProp in style ? "page-" + prop : false;
3255 }
3256
3257 return false;
3258 }
3259 };
3260
3261 // See https://github.com/postcss/autoprefixer/issues/324.
3262
3263 var inlineLogicalOld = {
3264 supportedProperty: function supportedProperty(prop, style) {
3265 if (!/^(border|margin|padding)-inline/.test(prop)) return false;
3266 if (prefix.js === 'Moz') return prop;
3267 var newProp = prop.replace('-inline', '');
3268 return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
3269 }
3270 };
3271
3272 // Camelization is required because we can't test using.
3273 // CSS syntax for e.g. in FF.
3274
3275 var unprefixed = {
3276 supportedProperty: function supportedProperty(prop, style) {
3277 return camelize(prop) in style ? prop : false;
3278 }
3279 };
3280
3281 var prefixed = {
3282 supportedProperty: function supportedProperty(prop, style) {
3283 var pascalized = pascalize(prop); // Return custom CSS variable without prefixing.
3284
3285 if (prop[0] === '-') return prop; // Return already prefixed value without prefixing.
3286
3287 if (prop[0] === '-' && prop[1] === '-') return prop;
3288 if (prefix.js + pascalized in style) return prefix.css + prop; // Try webkit fallback.
3289
3290 if (prefix.js !== 'Webkit' && "Webkit" + pascalized in style) return "-webkit-" + prop;
3291 return false;
3292 }
3293 };
3294
3295 // https://caniuse.com/#search=scroll-snap
3296
3297 var scrollSnap = {
3298 supportedProperty: function supportedProperty(prop) {
3299 if (prop.substring(0, 11) !== 'scroll-snap') return false;
3300
3301 if (prefix.js === 'ms') {
3302 return "" + prefix.css + prop;
3303 }
3304
3305 return prop;
3306 }
3307 };
3308
3309 // https://caniuse.com/#search=overscroll-behavior
3310
3311 var overscrollBehavior = {
3312 supportedProperty: function supportedProperty(prop) {
3313 if (prop !== 'overscroll-behavior') return false;
3314
3315 if (prefix.js === 'ms') {
3316 return prefix.css + "scroll-chaining";
3317 }
3318
3319 return prop;
3320 }
3321 };
3322
3323 var propMap = {
3324 'flex-grow': 'flex-positive',
3325 'flex-shrink': 'flex-negative',
3326 'flex-basis': 'flex-preferred-size',
3327 'justify-content': 'flex-pack',
3328 order: 'flex-order',
3329 'align-items': 'flex-align',
3330 'align-content': 'flex-line-pack' // 'align-self' is handled by 'align-self' plugin.
3331
3332 }; // Support old flex spec from 2012.
3333
3334 var flex2012 = {
3335 supportedProperty: function supportedProperty(prop, style) {
3336 var newProp = propMap[prop];
3337 if (!newProp) return false;
3338 return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
3339 }
3340 };
3341
3342 var propMap$1 = {
3343 flex: 'box-flex',
3344 'flex-grow': 'box-flex',
3345 'flex-direction': ['box-orient', 'box-direction'],
3346 order: 'box-ordinal-group',
3347 'align-items': 'box-align',
3348 'flex-flow': ['box-orient', 'box-direction'],
3349 'justify-content': 'box-pack'
3350 };
3351 var propKeys = Object.keys(propMap$1);
3352
3353 var prefixCss = function prefixCss(p) {
3354 return prefix.css + p;
3355 }; // Support old flex spec from 2009.
3356
3357
3358 var flex2009 = {
3359 supportedProperty: function supportedProperty(prop, style, _ref) {
3360 var multiple = _ref.multiple;
3361
3362 if (propKeys.indexOf(prop) > -1) {
3363 var newProp = propMap$1[prop];
3364
3365 if (!Array.isArray(newProp)) {
3366 return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
3367 }
3368
3369 if (!multiple) return false;
3370
3371 for (var i = 0; i < newProp.length; i++) {
3372 if (!(prefix.js + pascalize(newProp[0]) in style)) {
3373 return false;
3374 }
3375 }
3376
3377 return newProp.map(prefixCss);
3378 }
3379
3380 return false;
3381 }
3382 };
3383
3384 // plugins = [
3385 // ...plugins,
3386 // breakPropsOld,
3387 // inlineLogicalOld,
3388 // unprefixed,
3389 // prefixed,
3390 // scrollSnap,
3391 // flex2012,
3392 // flex2009
3393 // ]
3394 // Plugins without 'noPrefill' value, going last.
3395 // 'flex-*' plugins should be at the bottom.
3396 // 'flex2009' going after 'flex2012'.
3397 // 'prefixed' going after 'unprefixed'
3398
3399 var plugins = [appearence, colorAdjust, mask, textOrientation, transform, transition, writingMode, userSelect, breakPropsOld, inlineLogicalOld, unprefixed, prefixed, scrollSnap, overscrollBehavior, flex2012, flex2009];
3400 var propertyDetectors = plugins.filter(function (p) {
3401 return p.supportedProperty;
3402 }).map(function (p) {
3403 return p.supportedProperty;
3404 });
3405 var noPrefill = plugins.filter(function (p) {
3406 return p.noPrefill;
3407 }).reduce(function (a, p) {
3408 a.push.apply(a, _toConsumableArray(p.noPrefill));
3409 return a;
3410 }, []);
3411
3412 var el;
3413 var cache$1 = {};
3414
3415 if (isBrowser) {
3416 el = document.createElement('p'); // We test every property on vendor prefix requirement.
3417 // Once tested, result is cached. It gives us up to 70% perf boost.
3418 // http://jsperf.com/element-style-object-access-vs-plain-object
3419 //
3420 // Prefill cache with known css properties to reduce amount of
3421 // properties we need to feature test at runtime.
3422 // http://davidwalsh.name/vendor-prefix
3423
3424 var computed = window.getComputedStyle(document.documentElement, '');
3425
3426 for (var key$1 in computed) {
3427 // eslint-disable-next-line no-restricted-globals
3428 if (!isNaN(key$1)) cache$1[computed[key$1]] = computed[key$1];
3429 } // Properties that cannot be correctly detected using the
3430 // cache prefill method.
3431
3432
3433 noPrefill.forEach(function (x) {
3434 return delete cache$1[x];
3435 });
3436 }
3437 /**
3438 * Test if a property is supported, returns supported property with vendor
3439 * prefix if required. Returns `false` if not supported.
3440 *
3441 * @param {String} prop dash separated
3442 * @param {Object} [options]
3443 * @return {String|Boolean}
3444 * @api public
3445 */
3446
3447
3448 function supportedProperty(prop, options) {
3449 if (options === void 0) {
3450 options = {};
3451 }
3452
3453 // For server-side rendering.
3454 if (!el) return prop; // Remove cache for benchmark tests or return property from the cache.
3455
3456 if ( cache$1[prop] != null) {
3457 return cache$1[prop];
3458 } // Check if 'transition' or 'transform' natively supported in browser.
3459
3460
3461 if (prop === 'transition' || prop === 'transform') {
3462 options[prop] = prop in el.style;
3463 } // Find a plugin for current prefix property.
3464
3465
3466 for (var i = 0; i < propertyDetectors.length; i++) {
3467 cache$1[prop] = propertyDetectors[i](prop, el.style, options); // Break loop, if value found.
3468
3469 if (cache$1[prop]) break;
3470 } // Reset styles for current property.
3471 // Firefox can even throw an error for invalid properties, e.g., "0".
3472
3473
3474 try {
3475 el.style[prop] = '';
3476 } catch (err) {
3477 return false;
3478 }
3479
3480 return cache$1[prop];
3481 }
3482
3483 var cache$1$1 = {};
3484 var transitionProperties = {
3485 transition: 1,
3486 'transition-property': 1,
3487 '-webkit-transition': 1,
3488 '-webkit-transition-property': 1
3489 };
3490 var transPropsRegExp = /(^\s*[\w-]+)|, (\s*[\w-]+)(?![^()]*\))/g;
3491 var el$1;
3492 /**
3493 * Returns prefixed value transition/transform if needed.
3494 *
3495 * @param {String} match
3496 * @param {String} p1
3497 * @param {String} p2
3498 * @return {String}
3499 * @api private
3500 */
3501
3502 function prefixTransitionCallback(match, p1, p2) {
3503 if (p1 === 'var') return 'var';
3504 if (p1 === 'all') return 'all';
3505 if (p2 === 'all') return ', all';
3506 var prefixedValue = p1 ? supportedProperty(p1) : ", " + supportedProperty(p2);
3507 if (!prefixedValue) return p1 || p2;
3508 return prefixedValue;
3509 }
3510
3511 if (isBrowser) el$1 = document.createElement('p');
3512 /**
3513 * Returns prefixed value if needed. Returns `false` if value is not supported.
3514 *
3515 * @param {String} property
3516 * @param {String} value
3517 * @return {String|Boolean}
3518 * @api public
3519 */
3520
3521 function supportedValue(property, value) {
3522 // For server-side rendering.
3523 var prefixedValue = value;
3524 if (!el$1 || property === 'content') return value; // It is a string or a number as a string like '1'.
3525 // We want only prefixable values here.
3526 // eslint-disable-next-line no-restricted-globals
3527
3528 if (typeof prefixedValue !== 'string' || !isNaN(parseInt(prefixedValue, 10))) {
3529 return prefixedValue;
3530 } // Create cache key for current value.
3531
3532
3533 var cacheKey = property + prefixedValue; // Remove cache for benchmark tests or return value from cache.
3534
3535 if ( cache$1$1[cacheKey] != null) {
3536 return cache$1$1[cacheKey];
3537 } // IE can even throw an error in some cases, for e.g. style.content = 'bar'.
3538
3539
3540 try {
3541 // Test value as it is.
3542 el$1.style[property] = prefixedValue;
3543 } catch (err) {
3544 // Return false if value not supported.
3545 cache$1$1[cacheKey] = false;
3546 return false;
3547 } // If 'transition' or 'transition-property' property.
3548
3549
3550 if (transitionProperties[property]) {
3551 prefixedValue = prefixedValue.replace(transPropsRegExp, prefixTransitionCallback);
3552 } else if (el$1.style[property] === '') {
3553 // Value with a vendor prefix.
3554 prefixedValue = prefix.css + prefixedValue; // Hardcode test to convert "flex" to "-ms-flexbox" for IE10.
3555
3556 if (prefixedValue === '-ms-flex') el$1.style[property] = '-ms-flexbox'; // Test prefixed value.
3557
3558 el$1.style[property] = prefixedValue; // Return false if value not supported.
3559
3560 if (el$1.style[property] === '') {
3561 cache$1$1[cacheKey] = false;
3562 return false;
3563 }
3564 } // Reset styles for current property.
3565
3566
3567 el$1.style[property] = ''; // Write current value to cache.
3568
3569 cache$1$1[cacheKey] = prefixedValue;
3570 return cache$1$1[cacheKey];
3571 }
3572
3573 /**
3574 * Add vendor prefix to a property name when needed.
3575 *
3576 * @api public
3577 */
3578
3579 function jssVendorPrefixer() {
3580 function onProcessRule(rule) {
3581 if (rule.type === 'keyframes') {
3582 var atRule = rule;
3583 atRule.at = supportedKeyframes(atRule.at);
3584 }
3585 }
3586
3587 function prefixStyle(style) {
3588 for (var prop in style) {
3589 var value = style[prop];
3590
3591 if (prop === 'fallbacks' && Array.isArray(value)) {
3592 style[prop] = value.map(prefixStyle);
3593 continue;
3594 }
3595
3596 var changeProp = false;
3597 var supportedProp = supportedProperty(prop);
3598 if (supportedProp && supportedProp !== prop) changeProp = true;
3599 var changeValue = false;
3600 var supportedValue$1 = supportedValue(supportedProp, jss$1.toCssValue(value));
3601 if (supportedValue$1 && supportedValue$1 !== value) changeValue = true;
3602
3603 if (changeProp || changeValue) {
3604 if (changeProp) delete style[prop];
3605 style[supportedProp || prop] = supportedValue$1 || value;
3606 }
3607 }
3608
3609 return style;
3610 }
3611
3612 function onProcessStyle(style, rule) {
3613 if (rule.type !== 'style') return style;
3614 return prefixStyle(style);
3615 }
3616
3617 function onChangeValue(value, prop) {
3618 return supportedValue(prop, jss$1.toCssValue(value)) || value;
3619 }
3620
3621 return {
3622 onProcessRule: onProcessRule,
3623 onProcessStyle: onProcessStyle,
3624 onChangeValue: onChangeValue
3625 };
3626 }
3627
3628 /**
3629 * Sort props by length.
3630 */
3631 function jssPropsSort() {
3632 var sort = function sort(prop0, prop1) {
3633 if (prop0.length === prop1.length) {
3634 return prop0 > prop1 ? 1 : -1;
3635 }
3636
3637 return prop0.length - prop1.length;
3638 };
3639
3640 return {
3641 onProcessStyle: function onProcessStyle(style, rule) {
3642 if (rule.type !== 'style') return style;
3643 var newStyle = {};
3644 var props = Object.keys(style).sort(sort);
3645
3646 for (var i = 0; i < props.length; i++) {
3647 newStyle[props[i]] = style[props[i]];
3648 }
3649
3650 return newStyle;
3651 }
3652 };
3653 }
3654
3655 var create = function create(options) {
3656 if (options === void 0) {
3657 options = {};
3658 }
3659
3660 return {
3661 plugins: [functionPlugin(), observablePlugin(options.observable), templatePlugin(), jssGlobal(), jssExtend(), jssNested(), jssCompose(), camelCase(), defaultUnit(options.defaultUnit), jssExpand(), jssVendorPrefixer(), jssPropsSort()]
3662 };
3663 };
3664
3665 var jss = jss$1.create(create());
3666
3667 var sheetsMeta = new WeakMap();
3668 var getMeta = function getMeta(sheet) {
3669 return sheetsMeta.get(sheet);
3670 };
3671 var addMeta = function addMeta(sheet, meta) {
3672 sheetsMeta.set(sheet, meta);
3673 };
3674
3675 // eslint-disable-next-line no-unused-vars
3676 var getStyles = function getStyles(options) {
3677 var styles = options.styles;
3678
3679 if (typeof styles !== 'function') {
3680 return styles;
3681 }
3682
3683 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.") ;
3684 return styles(options.theme);
3685 };
3686
3687 function getSheetOptions(options, link) {
3688 var minify;
3689
3690 if (options.context.id && options.context.id.minify != null) {
3691 minify = options.context.id.minify;
3692 }
3693
3694 var classNamePrefix = options.context.classNamePrefix || '';
3695
3696 if (options.name && !minify) {
3697 classNamePrefix += options.name.replace(/\s/g, '-') + "-";
3698 }
3699
3700 var meta = '';
3701 if (options.name) meta = options.name + ", ";
3702 meta += typeof options.styles === 'function' ? 'Themed' : 'Unthemed';
3703 return _extends({}, options.sheetOptions, {
3704 index: options.index,
3705 meta: meta,
3706 classNamePrefix: classNamePrefix,
3707 link: link,
3708 generateId: options.sheetOptions.generateId || options.context.generateId
3709 });
3710 }
3711
3712 // eslint-disable-next-line no-unused-vars
3713 var createStyleSheet = function createStyleSheet(options) {
3714 if (options.context.disableStylesGeneration) {
3715 return undefined;
3716 }
3717
3718 var manager = getManager(options.context, options.index);
3719 var existingSheet = manager.get(options.theme);
3720
3721 if (existingSheet) {
3722 return existingSheet;
3723 }
3724
3725 var jss$2 = options.context.jss || jss;
3726 var styles = getStyles(options);
3727 var dynamicStyles = jss$1.getDynamicStyles(styles);
3728 var sheet = jss$2.createStyleSheet(styles, getSheetOptions(options, dynamicStyles !== null));
3729 addMeta(sheet, {
3730 dynamicStyles: dynamicStyles,
3731 styles: styles
3732 });
3733 manager.add(options.theme, sheet);
3734 return sheet;
3735 };
3736 var removeDynamicRules = function removeDynamicRules(sheet, rules) {
3737 // Loop over each dynamic rule and remove the dynamic rule
3738 // We can't just remove the whole sheet as this has all of the rules for every component instance
3739 for (var key in rules) {
3740 sheet.deleteRule(rules[key]);
3741 }
3742 };
3743 var updateDynamicRules = function updateDynamicRules(data, sheet, rules) {
3744 // Loop over each dynamic rule and update it
3745 // We can't just update the whole sheet as this has all of the rules for every component instance
3746 for (var key in rules) {
3747 sheet.updateOne(rules[key], data);
3748 }
3749 };
3750 var addDynamicRules = function addDynamicRules(sheet, data) {
3751 var meta = getMeta(sheet);
3752
3753 if (!meta) {
3754 return undefined;
3755 }
3756
3757 var rules = {}; // Loop over each dynamic rule and add it to the stylesheet
3758
3759 for (var key in meta.dynamicStyles) {
3760 var initialRuleCount = sheet.rules.index.length;
3761 var originalRule = sheet.addRule(key, meta.dynamicStyles[key]); // Loop through all created rules, fixes updating dynamic rules
3762
3763 for (var i = initialRuleCount; i < sheet.rules.index.length; i++) {
3764 var rule = sheet.rules.index[i];
3765 sheet.updateOne(rule, data); // If it's the original rule, we need to add it by the correct key so the hook and hoc
3766 // can correctly concat the dynamic class with the static one
3767
3768 rules[originalRule === rule ? key : rule.key] = rule;
3769 }
3770 }
3771
3772 return rules;
3773 };
3774
3775 var getSheetClasses = function getSheetClasses(sheet, dynamicRules) {
3776 if (!dynamicRules) {
3777 return sheet.classes;
3778 }
3779
3780 var classes = {};
3781 var meta = getMeta(sheet);
3782
3783 if (!meta) {
3784 return sheet.classes;
3785 }
3786
3787 for (var key in meta.styles) {
3788 classes[key] = sheet.classes[key];
3789
3790 if (key in dynamicRules) {
3791 classes[key] += " " + sheet.classes[dynamicRules[key].key];
3792 }
3793 }
3794
3795 return classes;
3796 };
3797
3798 var useEffectOrLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;
3799 var noTheme = {};
3800
3801 var createUseStyles = function createUseStyles(styles, options) {
3802 if (options === void 0) {
3803 options = {};
3804 }
3805
3806 var _options = options,
3807 _options$index = _options.index,
3808 index = _options$index === void 0 ? getSheetIndex() : _options$index,
3809 theming = _options.theming,
3810 name = _options.name,
3811 sheetOptions = _objectWithoutPropertiesLoose(_options, ["index", "theming", "name"]);
3812
3813 var ThemeContext$1 = theming && theming.context || ThemeContext;
3814
3815 var useTheme = function useTheme(theme) {
3816 if (typeof styles === 'function') {
3817 return theme || React.useContext(ThemeContext$1) || noTheme;
3818 }
3819
3820 return noTheme;
3821 };
3822
3823 return function useStyles(data) {
3824 var isFirstMount = React.useRef(true);
3825 var context = React.useContext(JssContext);
3826 var theme = useTheme(data.theme);
3827
3828 var _React$useMemo = React.useMemo(function () {
3829 var newSheet = createStyleSheet({
3830 context: context,
3831 styles: styles,
3832 name: name,
3833 theme: theme,
3834 index: index,
3835 sheetOptions: sheetOptions
3836 });
3837 var newDynamicRules = newSheet ? addDynamicRules(newSheet, data) : null;
3838
3839 if (newSheet) {
3840 manageSheet({
3841 index: index,
3842 context: context,
3843 sheet: newSheet,
3844 theme: theme
3845 });
3846 }
3847
3848 return [newSheet, newDynamicRules];
3849 }, [context, theme]),
3850 sheet = _React$useMemo[0],
3851 dynamicRules = _React$useMemo[1];
3852
3853 useEffectOrLayoutEffect(function () {
3854 // We only need to update the rules on a subsequent update and not in the first mount
3855 if (sheet && dynamicRules && !isFirstMount.current) {
3856 updateDynamicRules(data, sheet, dynamicRules);
3857 }
3858 }, [data]);
3859 useEffectOrLayoutEffect(function () {
3860 return (// cleanup only
3861 function () {
3862 if (sheet) {
3863 unmanageSheet({
3864 index: index,
3865 context: context,
3866 sheet: sheet,
3867 theme: theme
3868 });
3869 }
3870
3871 if (sheet && dynamicRules) {
3872 removeDynamicRules(sheet, dynamicRules);
3873 }
3874 }
3875 );
3876 }, [sheet]);
3877 var classes = sheet && dynamicRules ? getSheetClasses(sheet, dynamicRules) : {};
3878 React.useDebugValue(classes);
3879 React.useDebugValue(theme === noTheme ? 'No theme' : theme);
3880 React.useEffect(function () {
3881 isFirstMount.current = false;
3882 });
3883 return classes;
3884 };
3885 };
3886
3887 var NoRenderer = function NoRenderer(props) {
3888 return props.children || null;
3889 };
3890
3891 /**
3892 * HOC creator function that wrapps the user component.
3893 *
3894 * `withStyles(styles, [options])(Component)`
3895 */
3896 var createWithStyles = function createWithStyles(styles, options) {
3897 if (options === void 0) {
3898 options = {};
3899 }
3900
3901 var _options = options,
3902 _options$index = _options.index,
3903 index = _options$index === void 0 ? getSheetIndex() : _options$index,
3904 theming = _options.theming,
3905 injectTheme = _options.injectTheme,
3906 sheetOptions = _objectWithoutPropertiesLoose(_options, ["index", "theming", "injectTheme"]);
3907
3908 var ThemeContext$1 = theming ? theming.context : ThemeContext;
3909 return function (InnerComponent) {
3910 if (InnerComponent === void 0) {
3911 InnerComponent = NoRenderer;
3912 }
3913
3914 var displayName = getDisplayName$1(InnerComponent);
3915 var mergeClassesProp = memoize(function (sheetClasses, classesProp) {
3916 return classesProp ? mergeClasses(sheetClasses, classesProp) : sheetClasses;
3917 });
3918 var hookOptions = Object.assign(sheetOptions, {
3919 theming: theming,
3920 index: index,
3921 name: displayName
3922 });
3923 var useStyles = createUseStyles(styles, hookOptions);
3924 var WithStyles = React.forwardRef(function (props, ref) {
3925 var theme = React.useContext(ThemeContext$1);
3926
3927 var newProps = _extends({}, props);
3928
3929 if (injectTheme && newProps.theme == null) {
3930 newProps.theme = theme;
3931 }
3932
3933 var sheetClasses = useStyles(newProps);
3934 var classes = mergeClassesProp(sheetClasses, props.classes);
3935 return React.createElement(InnerComponent, _extends({}, newProps, {
3936 classes: classes,
3937 ref: ref
3938 }));
3939 });
3940 WithStyles.displayName = "WithStyles(" + displayName + ")"; // $FlowFixMe[prop-missing] https://github.com/facebook/flow/issues/7467
3941
3942 WithStyles.defaultProps = _extends({}, InnerComponent.defaultProps); // $FlowFixMe[prop-missing]
3943
3944 WithStyles.InnerComponent = InnerComponent;
3945 return hoistNonReactStatics_cjs(WithStyles, InnerComponent);
3946 };
3947 };
3948
3949 function shallowEqualObjects(objA, objB) {
3950 if (objA === objB) {
3951 return true;
3952 }
3953
3954 if (!objA || !objB) {
3955 return false;
3956 }
3957
3958 var aKeys = Object.keys(objA);
3959 var bKeys = Object.keys(objB);
3960 var len = aKeys.length;
3961
3962 if (bKeys.length !== len) {
3963 return false;
3964 }
3965
3966 for (var i = 0; i < len; i++) {
3967 var key = aKeys[i];
3968
3969 if (objA[key] !== objB[key]) {
3970 return false;
3971 }
3972 }
3973
3974 return true;
3975 }
3976
3977 var initialContext = {};
3978
3979 function JssProvider(props) {
3980 var managersRef = React.useRef({});
3981 var prevContextRef = React.useRef();
3982 var registryRef = React.useRef(null);
3983
3984 var createContext = function createContext(parentContext, prevContext) {
3985 if (prevContext === void 0) {
3986 prevContext = initialContext;
3987 }
3988
3989 var registry = props.registry,
3990 classNamePrefix = props.classNamePrefix,
3991 jss = props.jss,
3992 generateId = props.generateId,
3993 disableStylesGeneration = props.disableStylesGeneration,
3994 media = props.media,
3995 id = props.id;
3996
3997 var context = _extends({}, parentContext);
3998
3999 if (registry) {
4000 context.registry = registry; // This way we identify a new request on the server, because user will create
4001 // a new Registry instance for each.
4002
4003 if (registry !== registryRef.current) {
4004 // We reset managers because we have to regenerate all sheets for the new request.
4005 managersRef.current = {};
4006 registryRef.current = registry;
4007 }
4008 }
4009
4010 context.managers = managersRef.current;
4011
4012 if (id !== undefined) {
4013 context.id = id;
4014 }
4015
4016 if (generateId !== undefined) {
4017 context.generateId = generateId;
4018 } else if (!context.generateId || !prevContext || context.id !== prevContext.id) {
4019 context.generateId = jss$1.createGenerateId(context.id);
4020 }
4021
4022 if (classNamePrefix) {
4023 context.classNamePrefix = (context.classNamePrefix || '') + classNamePrefix;
4024 }
4025
4026 if (media !== undefined) {
4027 context.media = media;
4028 }
4029
4030 if (jss) {
4031 context.jss = jss;
4032 }
4033
4034 if (disableStylesGeneration !== undefined) {
4035 context.disableStylesGeneration = disableStylesGeneration;
4036 }
4037
4038 if (prevContext && shallowEqualObjects(prevContext, context)) {
4039 return prevContext;
4040 }
4041
4042 return context;
4043 };
4044
4045 var renderProvider = function renderProvider(parentContext) {
4046 var children = props.children;
4047 var context = createContext(parentContext, prevContextRef.current);
4048 prevContextRef.current = context;
4049 return React.createElement(JssContext.Provider, {
4050 value: context
4051 }, children);
4052 };
4053
4054 return React.createElement(JssContext.Consumer, null, renderProvider);
4055 }
4056
4057 function memoize$1(fn) {
4058 var cache = {};
4059 return function (arg) {
4060 if (cache[arg] === undefined) cache[arg] = fn(arg);
4061 return cache[arg];
4062 };
4063 }
4064
4065 var 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
4066
4067 var index$1 = memoize$1(function (prop) {
4068 return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
4069 /* o */
4070 && prop.charCodeAt(1) === 110
4071 /* n */
4072 && prop.charCodeAt(2) < 91;
4073 }
4074 /* Z+1 */
4075 );
4076
4077 // eslint-disable-next-line no-unused-vars
4078 var parseStyles = function parseStyles(args) {
4079 var dynamicStyles = [];
4080 var staticStyle;
4081 var labels = []; // Not using ...rest to optimize perf.
4082
4083 for (var key in args) {
4084 var style = args[key];
4085 if (!style) continue;
4086
4087 if (typeof style === 'function') {
4088 dynamicStyles.push(style);
4089 } else {
4090 if (!staticStyle) staticStyle = {};
4091 Object.assign(staticStyle, style);
4092
4093 if (staticStyle.label) {
4094 if (labels.indexOf(staticStyle.label) === -1) labels.push(staticStyle.label);
4095 }
4096 }
4097 }
4098
4099 var styles = {};
4100 var label = labels.length === 0 ? 'sc' : labels.join('-');
4101
4102 if (staticStyle) {
4103 // Label should not leak to the core.
4104 if ('label' in staticStyle) delete staticStyle.label;
4105 styles[label] = staticStyle;
4106 } // When there is only one function rule, we don't need to wrap it.
4107
4108
4109 if (dynamicStyles.length === 1) {
4110 styles['scd'] = dynamicStyles[0];
4111 } // We create a new function rule which will call all other function rules
4112 // and merge the styles they return.
4113
4114
4115 if (dynamicStyles.length > 1) {
4116 styles['scd'] = function (props) {
4117 var merged = {};
4118
4119 for (var i = 0; i < dynamicStyles.length; i++) {
4120 var dynamicStyle = dynamicStyles[i](props);
4121 if (dynamicStyle) Object.assign(merged, dynamicStyle);
4122 }
4123
4124 return merged;
4125 };
4126 }
4127
4128 return {
4129 styles: styles,
4130 label: label
4131 };
4132 };
4133
4134 var shouldForwardPropSymbol = Symbol('react-jss-styled');
4135
4136 var getShouldForwardProp = function getShouldForwardProp(tagOrComponent, options) {
4137 var shouldForwardProp = options.shouldForwardProp; // $FlowFixMe[invalid-computed-prop]
4138 // $FlowFixMe[incompatible-type]
4139
4140 var childShouldForwardProp = tagOrComponent[shouldForwardPropSymbol];
4141 var finalShouldForwardProp = shouldForwardProp || childShouldForwardProp;
4142
4143 if (shouldForwardProp && childShouldForwardProp) {
4144 finalShouldForwardProp = function finalShouldForwardProp(prop) {
4145 return childShouldForwardProp(prop) && shouldForwardProp(prop);
4146 };
4147 }
4148
4149 return finalShouldForwardProp;
4150 };
4151
4152 var getChildProps = function getChildProps(props, shouldForwardProp, isTag) {
4153 var childProps = {};
4154
4155 for (var prop in props) {
4156 if (shouldForwardProp) {
4157 if (shouldForwardProp(prop) === true) {
4158 childProps[prop] = props[prop];
4159 }
4160
4161 continue;
4162 } // We don't want to pass non-dom props to the DOM.
4163
4164
4165 if (isTag) {
4166 if (index$1(prop)) {
4167 childProps[prop] = props[prop];
4168 }
4169
4170 continue;
4171 }
4172
4173 childProps[prop] = props[prop];
4174 }
4175
4176 return childProps;
4177 };
4178
4179 // eslint-disable-next-line no-unused-vars
4180 var configureStyled = function configureStyled(tagOrComponent, options) {
4181 if (options === void 0) {
4182 options = {};
4183 }
4184
4185 var _options = options,
4186 theming = _options.theming;
4187 var isTag = typeof tagOrComponent === 'string';
4188 var ThemeContext$1 = theming ? theming.context : ThemeContext;
4189 var shouldForwardProp = getShouldForwardProp(tagOrComponent, options);
4190
4191 var _options2 = options,
4192 _ = _options2.shouldForwardProp,
4193 hookOptions = _objectWithoutPropertiesLoose(_options2, ["shouldForwardProp"]);
4194
4195 return function createStyledComponent() {
4196 // eslint-disable-next-line prefer-rest-params
4197 var _parseStyles = parseStyles(arguments),
4198 styles = _parseStyles.styles,
4199 label = _parseStyles.label;
4200
4201 var useStyles = createUseStyles(styles, hookOptions);
4202
4203 var Styled = function Styled(props) {
4204 var as = props.as,
4205 className = props.className;
4206 var theme = React.useContext(ThemeContext$1);
4207 var propsWithTheme = Object.assign({
4208 theme: theme
4209 }, props);
4210 var classes = useStyles(propsWithTheme);
4211 var childProps = getChildProps(props, shouldForwardProp, isTag);
4212 var classNames = ((classes[label] || classes.sc || '') + " " + (classes.scd || '')).trim();
4213 childProps.className = className ? className + " " + classNames : classNames;
4214
4215 if (!isTag && shouldForwardProp) {
4216 // $FlowFixMe[invalid-computed-prop] we are not supposed to attach random properties to component functions.
4217 // $FlowFixMe[incompatible-use]
4218 tagOrComponent[shouldForwardPropSymbol] = shouldForwardProp;
4219 }
4220
4221 if (isTag && as) {
4222 return React.createElement(as, childProps);
4223 }
4224
4225 return React.createElement(tagOrComponent, childProps);
4226 };
4227
4228 return Styled;
4229 };
4230 };
4231
4232 // Since we are in a single sheet mode, user shouldn't care about this.
4233
4234 var MAX_RULES_PER_SHEET = 10000;
4235 var defaultJss = jss$1.create(create());
4236
4237 var createCss = function createCss(jss) {
4238 if (jss === void 0) {
4239 jss = defaultJss;
4240 }
4241
4242 var cache = new Map();
4243 var ruleIndex = 0;
4244 var sheet;
4245
4246 var getSheet = function getSheet() {
4247 if (!sheet || sheet.rules.index.length > MAX_RULES_PER_SHEET) {
4248 sheet = jss.createStyleSheet().attach();
4249 }
4250
4251 return sheet;
4252 };
4253
4254 function css() {
4255 // eslint-disable-next-line prefer-rest-params
4256 var args = arguments; // We can avoid the need for stringification with a babel plugin,
4257 // which could generate a hash at build time and add it to the object.
4258
4259 var argsStr = JSON.stringify(args);
4260 var cached = cache.get(argsStr);
4261 if (cached) return cached.className;
4262 var flatArgs = []; // Flatten arguments which can be
4263 // - style objects
4264 // - array of style objects
4265 // - arrays of style objects
4266
4267 for (var argIndex in args) {
4268 var arg = args[argIndex];
4269
4270 if (!Array.isArray(arg)) {
4271 flatArgs.push(arg);
4272 continue;
4273 }
4274
4275 for (var innerArgIndex = 0; innerArgIndex < arg.length; innerArgIndex++) {
4276 flatArgs.push(arg[innerArgIndex]);
4277 }
4278 }
4279
4280 var mergedStyle = {};
4281 var labels = [];
4282
4283 for (var i = 0; i < flatArgs.length; i++) {
4284 var style = flatArgs[i];
4285 if (!style) continue;
4286 var styleObject = style; // It can be a class name that css() has previously generated.
4287
4288 if (typeof style === 'string') {
4289 // eslint-disable-next-line no-shadow
4290 var _cached = cache.get(style);
4291
4292 if (_cached) {
4293 // eslint-disable-next-line prefer-spread
4294 if (_cached.labels.length) labels.push.apply(labels, _cached.labels);
4295 styleObject = _cached.style;
4296 }
4297 }
4298
4299 if (styleObject.label && labels.indexOf(styleObject.label) === -1) labels.push(styleObject.label);
4300 Object.assign(mergedStyle, styleObject);
4301 }
4302
4303 delete mergedStyle.label;
4304 var label = labels.length === 0 ? 'css' : labels.join('-');
4305 var key = label + "-" + ruleIndex++;
4306 getSheet().addRule(key, mergedStyle);
4307 var className = getSheet().classes[key];
4308 var cacheValue = {
4309 style: mergedStyle,
4310 labels: labels,
4311 className: className
4312 };
4313 cache.set(argsStr, cacheValue);
4314 cache.set(className, cacheValue);
4315 return className;
4316 } // For testing only.
4317
4318
4319 css.getSheet = getSheet;
4320 return css;
4321 };
4322
4323 var css$1 = createCss();
4324
4325 /* eslint-disable prefer-rest-params, prefer-spread */
4326 var create$1 = function create(css) {
4327 if (css === void 0) {
4328 css = css$1;
4329 }
4330
4331 return function createElement(type, props
4332 /* :: , ..._args: any */
4333 ) {
4334 var args = arguments;
4335
4336 if (props && props.css) {
4337 var className = css(props.css);
4338 var newProps = Object.assign({}, props);
4339 newProps.className = props.className ? props.className + " " + className : className;
4340 delete newProps.css;
4341 args[1] = newProps;
4342 } // $FlowFixMe[missing-arg]
4343
4344
4345 return React.createElement.apply(undefined, args);
4346 };
4347 };
4348 var createElement = create$1();
4349
4350 Object.defineProperty(exports, 'SheetsRegistry', {
4351 enumerable: true,
4352 get: function () {
4353 return jss$1.SheetsRegistry;
4354 }
4355 });
4356 Object.defineProperty(exports, 'createGenerateId', {
4357 enumerable: true,
4358 get: function () {
4359 return jss$1.createGenerateId;
4360 }
4361 });
4362 exports.JssContext = JssContext;
4363 exports.JssProvider = JssProvider;
4364 exports.ThemeProvider = ThemeProvider;
4365 exports.createJsx = create$1;
4366 exports.createTheming = createTheming;
4367 exports.createUseStyles = createUseStyles;
4368 exports.default = createWithStyles;
4369 exports.jss = jss;
4370 exports.jsx = createElement;
4371 exports.styled = configureStyled;
4372 exports.useTheme = useTheme;
4373 exports.withStyles = createWithStyles;
4374 exports.withTheme = withTheme;
4375
4376 Object.defineProperty(exports, '__esModule', { value: true });
4377
4378})));
4379//# sourceMappingURL=react-jss.js.map