UNPKG

188 kBJavaScriptView Raw
1import "core-js/modules/es.symbol.iterator.js";
2import "core-js/modules/es.object.freeze.js";
3
4var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
5
6function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
8function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
10function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
12function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
14function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
15
16function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
17
18function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
20function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
21
22function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
23
24import "core-js/modules/es.object.assign.js";
25import "core-js/modules/es.regexp.exec.js";
26import "core-js/modules/es.object.to-string.js";
27import "core-js/modules/web.dom-collections.for-each.js";
28import "core-js/modules/es.string.trim.js";
29import "core-js/modules/es.string.replace.js";
30import "core-js/modules/es.array.slice.js";
31import "core-js/modules/es.array.join.js";
32import "core-js/modules/es.array.map.js";
33import "core-js/modules/es.array.iterator.js";
34import "core-js/modules/es.string.iterator.js";
35import "core-js/modules/es.weak-map.js";
36import "core-js/modules/web.dom-collections.iterator.js";
37import "core-js/modules/es.string.match.js";
38import "core-js/modules/es.string.split.js";
39import "core-js/modules/es.array.concat.js";
40import "core-js/modules/es.function.name.js";
41import "core-js/modules/esnext.global-this.js";
42import "core-js/modules/es.symbol.js";
43import "core-js/modules/es.symbol.description.js";
44import "core-js/modules/es.object.get-own-property-names.js";
45import "core-js/modules/es.object.get-own-property-descriptor.js";
46import "core-js/modules/es.object.get-prototype-of.js";
47import "core-js/modules/es.regexp.to-string.js";
48import "core-js/modules/es.set.js";
49import "core-js/modules/es.reflect.construct.js";
50import "core-js/modules/es.map.js";
51import "core-js/modules/es.number.to-fixed.js";
52import "core-js/modules/es.string.bold.js";
53import "core-js/modules/es.object.entries.js";
54import "core-js/modules/es.object.keys.js";
55import "core-js/modules/es.array.from.js";
56import "core-js/modules/es.regexp.constructor.js";
57import "core-js/modules/es.array.includes.js";
58import "core-js/modules/es.string.includes.js";
59import * as React from 'react';
60import { useContext, createElement, createContext, forwardRef, Fragment, useRef, useLayoutEffect } from 'react';
61import memoize$1 from 'memoizerific';
62import { logger } from '@storybook/client-logger';
63
64function _extends$1() {
65 _extends$1 = Object.assign || function (target) {
66 for (var i = 1; i < arguments.length; i++) {
67 var source = arguments[i];
68
69 for (var key in source) {
70 if (Object.prototype.hasOwnProperty.call(source, key)) {
71 target[key] = source[key];
72 }
73 }
74 }
75
76 return target;
77 };
78
79 return _extends$1.apply(this, arguments);
80}
81
82function memoize(fn) {
83 var cache = Object.create(null);
84 return function (arg) {
85 if (cache[arg] === undefined) cache[arg] = fn(arg);
86 return cache[arg];
87 };
88}
89
90var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|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|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|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|loading|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|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|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
91
92var isPropValid = /* #__PURE__ */memoize(function (prop) {
93 return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
94 /* o */
95 && prop.charCodeAt(1) === 110
96 /* n */
97 && prop.charCodeAt(2) < 91;
98}
99/* Z+1 */
100);
101/*
102
103Based off glamor's StyleSheet, thanks Sunil ❤️
104
105high performance StyleSheet for css-in-js systems
106
107- uses multiple style tags behind the scenes for millions of rules
108- uses `insertRule` for appending in production for *much* faster performance
109
110// usage
111
112import { StyleSheet } from '@emotion/sheet'
113
114let styleSheet = new StyleSheet({ key: '', container: document.head })
115
116styleSheet.insert('#box { border: 1px solid red; }')
117- appends a css rule into the stylesheet
118
119styleSheet.flush()
120- empties the stylesheet of all its contents
121
122*/
123// $FlowFixMe
124
125function sheetForTag$1(tag) {
126 if (tag.sheet) {
127 // $FlowFixMe
128 return tag.sheet;
129 } // this weirdness brought to you by firefox
130
131 /* istanbul ignore next */
132
133
134 for (var i = 0; i < document.styleSheets.length; i++) {
135 if (document.styleSheets[i].ownerNode === tag) {
136 // $FlowFixMe
137 return document.styleSheets[i];
138 }
139 }
140}
141
142function createStyleElement$1(options) {
143 var tag = document.createElement('style');
144 tag.setAttribute('data-emotion', options.key);
145
146 if (options.nonce !== undefined) {
147 tag.setAttribute('nonce', options.nonce);
148 }
149
150 tag.appendChild(document.createTextNode(''));
151 tag.setAttribute('data-s', '');
152 return tag;
153}
154
155var StyleSheet$1 = /*#__PURE__*/function () {
156 function StyleSheet(options) {
157 var _this = this;
158
159 this._insertTag = function (tag) {
160 var before;
161
162 if (_this.tags.length === 0) {
163 if (_this.insertionPoint) {
164 before = _this.insertionPoint.nextSibling;
165 } else if (_this.prepend) {
166 before = _this.container.firstChild;
167 } else {
168 before = _this.before;
169 }
170 } else {
171 before = _this.tags[_this.tags.length - 1].nextSibling;
172 }
173
174 _this.container.insertBefore(tag, before);
175
176 _this.tags.push(tag);
177 };
178
179 this.isSpeedy = options.speedy === undefined ? process.env.NODE_ENV === 'production' : options.speedy;
180 this.tags = [];
181 this.ctr = 0;
182 this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
183
184 this.key = options.key;
185 this.container = options.container;
186 this.prepend = options.prepend;
187 this.insertionPoint = options.insertionPoint;
188 this.before = null;
189 }
190
191 var _proto = StyleSheet.prototype;
192
193 _proto.hydrate = function hydrate(nodes) {
194 nodes.forEach(this._insertTag);
195 };
196
197 _proto.insert = function insert(rule) {
198 // the max length is how many rules we have per style tag, it's 65000 in speedy mode
199 // it's 1 in dev because we insert source maps that map a single rule to a location
200 // and you can only have one source map per style tag
201 if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
202 this._insertTag(createStyleElement$1(this));
203 }
204
205 var tag = this.tags[this.tags.length - 1];
206
207 if (process.env.NODE_ENV !== 'production') {
208 var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105;
209
210 if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) {
211 // this would only cause problem in speedy mode
212 // but we don't want enabling speedy to affect the observable behavior
213 // so we report this error at all times
214 console.error("You're attempting to insert the following rule:\n" + rule + '\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.');
215 }
216
217 this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule;
218 }
219
220 if (this.isSpeedy) {
221 var sheet = sheetForTag$1(tag);
222
223 try {
224 // this is the ultrafast version, works across browsers
225 // the big drawback is that the css won't be editable in devtools
226 sheet.insertRule(rule, sheet.cssRules.length);
227 } catch (e) {
228 if (process.env.NODE_ENV !== 'production' && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear){/.test(rule)) {
229 console.error("There was a problem inserting the following rule: \"" + rule + "\"", e);
230 }
231 }
232 } else {
233 tag.appendChild(document.createTextNode(rule));
234 }
235
236 this.ctr++;
237 };
238
239 _proto.flush = function flush() {
240 // $FlowFixMe
241 this.tags.forEach(function (tag) {
242 return tag.parentNode && tag.parentNode.removeChild(tag);
243 });
244 this.tags = [];
245 this.ctr = 0;
246
247 if (process.env.NODE_ENV !== 'production') {
248 this._alreadyInsertedOrderInsensitiveRule = false;
249 }
250 };
251
252 return StyleSheet;
253}();
254
255var MS = '-ms-';
256var MOZ = '-moz-';
257var WEBKIT = '-webkit-';
258var COMMENT = 'comm';
259var RULESET = 'rule';
260var DECLARATION = 'decl';
261var IMPORT = '@import';
262var KEYFRAMES = '@keyframes';
263/**
264 * @param {number}
265 * @return {number}
266 */
267
268var abs = Math.abs;
269/**
270 * @param {number}
271 * @return {string}
272 */
273
274var from = String.fromCharCode;
275/**
276 * @param {object}
277 * @return {object}
278 */
279
280var assign = Object.assign;
281/**
282 * @param {string} value
283 * @param {number} length
284 * @return {number}
285 */
286
287function hash(value, length) {
288 return (((length << 2 ^ charat(value, 0)) << 2 ^ charat(value, 1)) << 2 ^ charat(value, 2)) << 2 ^ charat(value, 3);
289}
290/**
291 * @param {string} value
292 * @return {string}
293 */
294
295
296function trim(value) {
297 return value.trim();
298}
299/**
300 * @param {string} value
301 * @param {RegExp} pattern
302 * @return {string?}
303 */
304
305
306function match(value, pattern) {
307 return (value = pattern.exec(value)) ? value[0] : value;
308}
309/**
310 * @param {string} value
311 * @param {(string|RegExp)} pattern
312 * @param {string} replacement
313 * @return {string}
314 */
315
316
317function replace(value, pattern, replacement) {
318 return value.replace(pattern, replacement);
319}
320/**
321 * @param {string} value
322 * @param {string} search
323 * @return {number}
324 */
325
326
327function indexof(value, search) {
328 return value.indexOf(search);
329}
330/**
331 * @param {string} value
332 * @param {number} index
333 * @return {number}
334 */
335
336
337function charat(value, index) {
338 return value.charCodeAt(index) | 0;
339}
340/**
341 * @param {string} value
342 * @param {number} begin
343 * @param {number} end
344 * @return {string}
345 */
346
347
348function substr(value, begin, end) {
349 return value.slice(begin, end);
350}
351/**
352 * @param {string} value
353 * @return {number}
354 */
355
356
357function strlen(value) {
358 return value.length;
359}
360/**
361 * @param {any[]} value
362 * @return {number}
363 */
364
365
366function sizeof(value) {
367 return value.length;
368}
369/**
370 * @param {any} value
371 * @param {any[]} array
372 * @return {any}
373 */
374
375
376function append(value, array) {
377 return array.push(value), value;
378}
379/**
380 * @param {string[]} array
381 * @param {function} callback
382 * @return {string}
383 */
384
385
386function combine(array, callback) {
387 return array.map(callback).join('');
388}
389
390var line = 1;
391var column = 1;
392var length = 0;
393var position = 0;
394var character = 0;
395var characters = '';
396/**
397 * @param {string} value
398 * @param {object | null} root
399 * @param {object | null} parent
400 * @param {string} type
401 * @param {string[] | string} props
402 * @param {object[] | string} children
403 * @param {number} length
404 */
405
406function node(value, root, parent, type, props, children, length) {
407 return {
408 value: value,
409 root: root,
410 parent: parent,
411 type: type,
412 props: props,
413 children: children,
414 line: line,
415 column: column,
416 length: length,
417 return: ''
418 };
419}
420/**
421 * @param {object} root
422 * @param {object} props
423 * @return {object}
424 */
425
426
427function copy(root, props) {
428 return assign(node('', null, null, '', null, null, 0), root, {
429 length: -root.length
430 }, props);
431}
432/**
433 * @return {number}
434 */
435
436
437function char() {
438 return character;
439}
440/**
441 * @return {number}
442 */
443
444
445function prev() {
446 character = position > 0 ? charat(characters, --position) : 0;
447 if (column--, character === 10) column = 1, line--;
448 return character;
449}
450/**
451 * @return {number}
452 */
453
454
455function next() {
456 character = position < length ? charat(characters, position++) : 0;
457 if (column++, character === 10) column = 1, line++;
458 return character;
459}
460/**
461 * @return {number}
462 */
463
464
465function peek() {
466 return charat(characters, position);
467}
468/**
469 * @return {number}
470 */
471
472
473function caret() {
474 return position;
475}
476/**
477 * @param {number} begin
478 * @param {number} end
479 * @return {string}
480 */
481
482
483function slice(begin, end) {
484 return substr(characters, begin, end);
485}
486/**
487 * @param {number} type
488 * @return {number}
489 */
490
491
492function token(type) {
493 switch (type) {
494 // \0 \t \n \r \s whitespace token
495 case 0:
496 case 9:
497 case 10:
498 case 13:
499 case 32:
500 return 5;
501 // ! + , / > @ ~ isolate token
502
503 case 33:
504 case 43:
505 case 44:
506 case 47:
507 case 62:
508 case 64:
509 case 126: // ; { } breakpoint token
510
511 case 59:
512 case 123:
513 case 125:
514 return 4;
515 // : accompanied token
516
517 case 58:
518 return 3;
519 // " ' ( [ opening delimit token
520
521 case 34:
522 case 39:
523 case 40:
524 case 91:
525 return 2;
526 // ) ] closing delimit token
527
528 case 41:
529 case 93:
530 return 1;
531 }
532
533 return 0;
534}
535/**
536 * @param {string} value
537 * @return {any[]}
538 */
539
540
541function alloc(value) {
542 return line = column = 1, length = strlen(characters = value), position = 0, [];
543}
544/**
545 * @param {any} value
546 * @return {any}
547 */
548
549
550function dealloc(value) {
551 return characters = '', value;
552}
553/**
554 * @param {number} type
555 * @return {string}
556 */
557
558
559function delimit(type) {
560 return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)));
561}
562/**
563 * @param {number} type
564 * @return {string}
565 */
566
567
568function whitespace(type) {
569 while (character = peek()) {
570 if (character < 33) next();else break;
571 }
572
573 return token(type) > 2 || token(character) > 3 ? '' : ' ';
574}
575/**
576 * @param {number} index
577 * @param {number} count
578 * @return {string}
579 */
580
581
582function escaping(index, count) {
583 while (--count && next()) {
584 // not 0-9 A-F a-f
585 if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97) break;
586 }
587
588 return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32));
589}
590/**
591 * @param {number} type
592 * @return {number}
593 */
594
595
596function delimiter(type) {
597 while (next()) {
598 switch (character) {
599 // ] ) " '
600 case type:
601 return position;
602 // " '
603
604 case 34:
605 case 39:
606 if (type !== 34 && type !== 39) delimiter(character);
607 break;
608 // (
609
610 case 40:
611 if (type === 41) delimiter(type);
612 break;
613 // \
614
615 case 92:
616 next();
617 break;
618 }
619 }
620
621 return position;
622}
623/**
624 * @param {number} type
625 * @param {number} index
626 * @return {number}
627 */
628
629
630function commenter(type, index) {
631 while (next()) {
632 // //
633 if (type + character === 47 + 10) break; // /*
634 else if (type + character === 42 + 42 && peek() === 47) break;
635 }
636
637 return '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next());
638}
639/**
640 * @param {number} index
641 * @return {string}
642 */
643
644
645function identifier(index) {
646 while (!token(peek())) {
647 next();
648 }
649
650 return slice(index, position);
651}
652/**
653 * @param {string} value
654 * @return {object[]}
655 */
656
657
658function compile(value) {
659 return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value));
660}
661/**
662 * @param {string} value
663 * @param {object} root
664 * @param {object?} parent
665 * @param {string[]} rule
666 * @param {string[]} rules
667 * @param {string[]} rulesets
668 * @param {number[]} pseudo
669 * @param {number[]} points
670 * @param {string[]} declarations
671 * @return {object}
672 */
673
674
675function parse(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
676 var index = 0;
677 var offset = 0;
678 var length = pseudo;
679 var atrule = 0;
680 var property = 0;
681 var previous = 0;
682 var variable = 1;
683 var scanning = 1;
684 var ampersand = 1;
685 var character = 0;
686 var type = '';
687 var props = rules;
688 var children = rulesets;
689 var reference = rule;
690 var characters = type;
691
692 while (scanning) {
693 switch (previous = character, character = next()) {
694 // (
695 case 40:
696 if (previous != 108 && characters.charCodeAt(length - 1) == 58) {
697 if (indexof(characters += replace(delimit(character), '&', '&\f'), '&\f') != -1) ampersand = -1;
698 break;
699 }
700
701 // " ' [
702
703 case 34:
704 case 39:
705 case 91:
706 characters += delimit(character);
707 break;
708 // \t \n \r \s
709
710 case 9:
711 case 10:
712 case 13:
713 case 32:
714 characters += whitespace(previous);
715 break;
716 // \
717
718 case 92:
719 characters += escaping(caret() - 1, 7);
720 continue;
721 // /
722
723 case 47:
724 switch (peek()) {
725 case 42:
726 case 47:
727 append(comment(commenter(next(), caret()), root, parent), declarations);
728 break;
729
730 default:
731 characters += '/';
732 }
733
734 break;
735 // {
736
737 case 123 * variable:
738 points[index++] = strlen(characters) * ampersand;
739 // } ; \0
740
741 case 125 * variable:
742 case 59:
743 case 0:
744 switch (character) {
745 // \0 }
746 case 0:
747 case 125:
748 scanning = 0;
749 // ;
750
751 case 59 + offset:
752 if (property > 0 && strlen(characters) - length) append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations);
753 break;
754 // @ ;
755
756 case 59:
757 characters += ';';
758 // { rule/at-rule
759
760 default:
761 append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets);
762 if (character === 123) if (offset === 0) parse(characters, root, reference, reference, props, rulesets, length, points, children);else switch (atrule) {
763 // d m s
764 case 100:
765 case 109:
766 case 115:
767 parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children);
768 break;
769
770 default:
771 parse(characters, reference, reference, reference, [''], children, 0, points, children);
772 }
773 }
774
775 index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo;
776 break;
777 // :
778
779 case 58:
780 length = 1 + strlen(characters), property = previous;
781
782 default:
783 if (variable < 1) if (character == 123) --variable;else if (character == 125 && variable++ == 0 && prev() == 125) continue;
784
785 switch (characters += from(character), character * variable) {
786 // &
787 case 38:
788 ampersand = offset > 0 ? 1 : (characters += '\f', -1);
789 break;
790 // ,
791
792 case 44:
793 points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1;
794 break;
795 // @
796
797 case 64:
798 // -
799 if (peek() === 45) characters += delimit(next());
800 atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++;
801 break;
802 // -
803
804 case 45:
805 if (previous === 45 && strlen(characters) == 2) variable = 0;
806 }
807
808 }
809 }
810
811 return rulesets;
812}
813/**
814 * @param {string} value
815 * @param {object} root
816 * @param {object?} parent
817 * @param {number} index
818 * @param {number} offset
819 * @param {string[]} rules
820 * @param {number[]} points
821 * @param {string} type
822 * @param {string[]} props
823 * @param {string[]} children
824 * @param {number} length
825 * @return {object}
826 */
827
828
829function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length) {
830 var post = offset - 1;
831 var rule = offset === 0 ? rules : [''];
832 var size = sizeof(rule);
833
834 for (var i = 0, j = 0, k = 0; i < index; ++i) {
835 for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x) {
836 if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x]))) props[k++] = z;
837 }
838 }
839
840 return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length);
841}
842/**
843 * @param {number} value
844 * @param {object} root
845 * @param {object?} parent
846 * @return {object}
847 */
848
849
850function comment(value, root, parent) {
851 return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0);
852}
853/**
854 * @param {string} value
855 * @param {object} root
856 * @param {object?} parent
857 * @param {number} length
858 * @return {object}
859 */
860
861
862function declaration(value, root, parent, length) {
863 return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length);
864}
865/**
866 * @param {string} value
867 * @param {number} length
868 * @return {string}
869 */
870
871
872function prefix(value, length) {
873 switch (hash(value, length)) {
874 // color-adjust
875 case 5103:
876 return WEBKIT + 'print-' + value + value;
877 // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
878
879 case 5737:
880 case 4201:
881 case 3177:
882 case 3433:
883 case 1641:
884 case 4457:
885 case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
886
887 case 5572:
888 case 6356:
889 case 5844:
890 case 3191:
891 case 6645:
892 case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
893
894 case 6391:
895 case 5879:
896 case 5623:
897 case 6135:
898 case 4599:
899 case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
900
901 case 4215:
902 case 6389:
903 case 5109:
904 case 5365:
905 case 5621:
906 case 3829:
907 return WEBKIT + value + value;
908 // appearance, user-select, transform, hyphens, text-size-adjust
909
910 case 5349:
911 case 4246:
912 case 4810:
913 case 6968:
914 case 2756:
915 return WEBKIT + value + MOZ + value + MS + value + value;
916 // flex, flex-direction
917
918 case 6828:
919 case 4268:
920 return WEBKIT + value + MS + value + value;
921 // order
922
923 case 6165:
924 return WEBKIT + value + MS + 'flex-' + value + value;
925 // align-items
926
927 case 5187:
928 return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;
929 // align-self
930
931 case 5443:
932 return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;
933 // align-content
934
935 case 4675:
936 return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;
937 // flex-shrink
938
939 case 5548:
940 return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;
941 // flex-basis
942
943 case 5292:
944 return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;
945 // flex-grow
946
947 case 6060:
948 return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;
949 // transition
950
951 case 4554:
952 return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;
953 // cursor
954
955 case 6187:
956 return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;
957 // background, background-image
958
959 case 5495:
960 case 3959:
961 return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1');
962 // justify-content
963
964 case 4968:
965 return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;
966 // (margin|padding)-inline-(start|end)
967
968 case 4095:
969 case 3583:
970 case 4068:
971 case 2532:
972 return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;
973 // (min|max)?(width|height|inline-size|block-size)
974
975 case 8116:
976 case 7059:
977 case 5753:
978 case 5535:
979 case 5445:
980 case 5701:
981 case 4933:
982 case 4677:
983 case 5533:
984 case 5789:
985 case 5021:
986 case 4765:
987 // stretch, max-content, min-content, fill-available
988 if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {
989 // (m)ax-content, (m)in-content
990 case 109:
991 // -
992 if (charat(value, length + 4) !== 45) break;
993 // (f)ill-available, (f)it-content
994
995 case 102:
996 return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
997 // (s)tretch
998
999 case 115:
1000 return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;
1001 }
1002 break;
1003 // position: sticky
1004
1005 case 4949:
1006 // (s)ticky?
1007 if (charat(value, length + 1) !== 115) break;
1008 // display: (flex|inline-flex)
1009
1010 case 6444:
1011 switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
1012 // stic(k)y
1013 case 107:
1014 return replace(value, ':', ':' + WEBKIT) + value;
1015 // (inline-)?fl(e)x
1016
1017 case 101:
1018 return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;
1019 }
1020
1021 break;
1022 // writing-mode
1023
1024 case 5936:
1025 switch (charat(value, length + 11)) {
1026 // vertical-l(r)
1027 case 114:
1028 return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
1029 // vertical-r(l)
1030
1031 case 108:
1032 return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
1033 // horizontal(-)tb
1034
1035 case 45:
1036 return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
1037 }
1038
1039 return WEBKIT + value + MS + value + value;
1040 }
1041
1042 return value;
1043}
1044/**
1045 * @param {object[]} children
1046 * @param {function} callback
1047 * @return {string}
1048 */
1049
1050
1051function serialize(children, callback) {
1052 var output = '';
1053 var length = sizeof(children);
1054
1055 for (var i = 0; i < length; i++) {
1056 output += callback(children[i], i, children, callback) || '';
1057 }
1058
1059 return output;
1060}
1061/**
1062 * @param {object} element
1063 * @param {number} index
1064 * @param {object[]} children
1065 * @param {function} callback
1066 * @return {string}
1067 */
1068
1069
1070function stringify(element, index, children, callback) {
1071 switch (element.type) {
1072 case IMPORT:
1073 case DECLARATION:
1074 return element.return = element.return || element.value;
1075
1076 case COMMENT:
1077 return '';
1078
1079 case KEYFRAMES:
1080 return element.return = element.value + '{' + serialize(element.children, callback) + '}';
1081
1082 case RULESET:
1083 element.value = element.props.join(',');
1084 }
1085
1086 return strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : '';
1087}
1088/**
1089 * @param {function[]} collection
1090 * @return {function}
1091 */
1092
1093
1094function middleware(collection) {
1095 var length = sizeof(collection);
1096 return function (element, index, children, callback) {
1097 var output = '';
1098
1099 for (var i = 0; i < length; i++) {
1100 output += collection[i](element, index, children, callback) || '';
1101 }
1102
1103 return output;
1104 };
1105}
1106/**
1107 * @param {function} callback
1108 * @return {function}
1109 */
1110
1111
1112function rulesheet(callback) {
1113 return function (element) {
1114 if (!element.root) if (element = element.return) callback(element);
1115 };
1116}
1117/**
1118 * @param {object} element
1119 * @param {number} index
1120 * @param {object[]} children
1121 * @param {function} callback
1122 */
1123
1124
1125function prefixer(element, index, children, callback) {
1126 if (element.length > -1) if (!element.return) switch (element.type) {
1127 case DECLARATION:
1128 element.return = prefix(element.value, element.length);
1129 break;
1130
1131 case KEYFRAMES:
1132 return serialize([copy(element, {
1133 value: replace(element.value, '@', '@' + WEBKIT)
1134 })], callback);
1135
1136 case RULESET:
1137 if (element.length) return combine(element.props, function (value) {
1138 switch (match(value, /(::plac\w+|:read-\w+)/)) {
1139 // :read-(only|write)
1140 case ':read-only':
1141 case ':read-write':
1142 return serialize([copy(element, {
1143 props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]
1144 })], callback);
1145 // :placeholder
1146
1147 case '::placeholder':
1148 return serialize([copy(element, {
1149 props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]
1150 }), copy(element, {
1151 props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]
1152 }), copy(element, {
1153 props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]
1154 })], callback);
1155 }
1156
1157 return '';
1158 });
1159 }
1160}
1161
1162var weakMemoize = function weakMemoize(func) {
1163 // $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps
1164 var cache = new WeakMap();
1165 return function (arg) {
1166 if (cache.has(arg)) {
1167 // $FlowFixMe
1168 return cache.get(arg);
1169 }
1170
1171 var ret = func(arg);
1172 cache.set(arg, ret);
1173 return ret;
1174 };
1175};
1176
1177var last = function last(arr) {
1178 return arr.length ? arr[arr.length - 1] : null;
1179}; // based on https://github.com/thysultan/stylis.js/blob/e6843c373ebcbbfade25ebcc23f540ed8508da0a/src/Tokenizer.js#L239-L244
1180
1181
1182var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
1183 var previous = 0;
1184 var character = 0;
1185
1186 while (true) {
1187 previous = character;
1188 character = peek(); // &\f
1189
1190 if (previous === 38 && character === 12) {
1191 points[index] = 1;
1192 }
1193
1194 if (token(character)) {
1195 break;
1196 }
1197
1198 next();
1199 }
1200
1201 return slice(begin, position);
1202};
1203
1204var toRules = function toRules(parsed, points) {
1205 // pretend we've started with a comma
1206 var index = -1;
1207 var character = 44;
1208
1209 do {
1210 switch (token(character)) {
1211 case 0:
1212 // &\f
1213 if (character === 38 && peek() === 12) {
1214 // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
1215 // stylis inserts \f after & to know when & where it should replace this sequence with the context selector
1216 // and when it should just concatenate the outer and inner selectors
1217 // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
1218 points[index] = 1;
1219 }
1220
1221 parsed[index] += identifierWithPointTracking(position - 1, points, index);
1222 break;
1223
1224 case 2:
1225 parsed[index] += delimit(character);
1226 break;
1227
1228 case 4:
1229 // comma
1230 if (character === 44) {
1231 // colon
1232 parsed[++index] = peek() === 58 ? '&\f' : '';
1233 points[index] = parsed[index].length;
1234 break;
1235 }
1236
1237 // fallthrough
1238
1239 default:
1240 parsed[index] += from(character);
1241 }
1242 } while (character = next());
1243
1244 return parsed;
1245};
1246
1247var getRules = function getRules(value, points) {
1248 return dealloc(toRules(alloc(value), points));
1249}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
1250
1251
1252var fixedElements = /* #__PURE__ */new WeakMap();
1253
1254var compat = function compat(element) {
1255 if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
1256 // negative .length indicates that this rule has been already prefixed
1257 element.length < 1) {
1258 return;
1259 }
1260
1261 var value = element.value,
1262 parent = element.parent;
1263 var isImplicitRule = element.column === parent.column && element.line === parent.line;
1264
1265 while (parent.type !== 'rule') {
1266 parent = parent.parent;
1267 if (!parent) return;
1268 } // short-circuit for the simplest case
1269
1270
1271 if (element.props.length === 1 && value.charCodeAt(0) !== 58
1272 /* colon */
1273 && !fixedElements.get(parent)) {
1274 return;
1275 } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
1276 // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
1277
1278
1279 if (isImplicitRule) {
1280 return;
1281 }
1282
1283 fixedElements.set(element, true);
1284 var points = [];
1285 var rules = getRules(value, points);
1286 var parentRules = parent.props;
1287
1288 for (var i = 0, k = 0; i < rules.length; i++) {
1289 for (var j = 0; j < parentRules.length; j++, k++) {
1290 element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
1291 }
1292 }
1293};
1294
1295var removeLabel = function removeLabel(element) {
1296 if (element.type === 'decl') {
1297 var value = element.value;
1298
1299 if ( // charcode for l
1300 value.charCodeAt(0) === 108 && // charcode for b
1301 value.charCodeAt(2) === 98) {
1302 // this ignores label
1303 element["return"] = '';
1304 element.value = '';
1305 }
1306 }
1307};
1308
1309var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
1310
1311var isIgnoringComment = function isIgnoringComment(element) {
1312 return !!element && element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
1313};
1314
1315var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
1316 return function (element, index, children) {
1317 if (element.type !== 'rule') return;
1318 var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
1319
1320 if (unsafePseudoClasses && cache.compat !== true) {
1321 var prevElement = index > 0 ? children[index - 1] : null;
1322
1323 if (prevElement && isIgnoringComment(last(prevElement.children))) {
1324 return;
1325 }
1326
1327 unsafePseudoClasses.forEach(function (unsafePseudoClass) {
1328 console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
1329 });
1330 }
1331 };
1332};
1333
1334var isImportRule = function isImportRule(element) {
1335 return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
1336};
1337
1338var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
1339 for (var i = index - 1; i >= 0; i--) {
1340 if (!isImportRule(children[i])) {
1341 return true;
1342 }
1343 }
1344
1345 return false;
1346}; // use this to remove incorrect elements from further processing
1347// so they don't get handed to the `sheet` (or anything else)
1348// as that could potentially lead to additional logs which in turn could be overhelming to the user
1349
1350
1351var nullifyElement = function nullifyElement(element) {
1352 element.type = '';
1353 element.value = '';
1354 element["return"] = '';
1355 element.children = '';
1356 element.props = '';
1357};
1358
1359var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
1360 if (!isImportRule(element)) {
1361 return;
1362 }
1363
1364 if (element.parent) {
1365 console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
1366 nullifyElement(element);
1367 } else if (isPrependedWithRegularRules(index, children)) {
1368 console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
1369 nullifyElement(element);
1370 }
1371};
1372
1373var isBrowser$6 = typeof document !== 'undefined';
1374var getServerStylisCache = isBrowser$6 ? undefined : weakMemoize(function () {
1375 return memoize(function () {
1376 var cache = {};
1377 return function (name) {
1378 return cache[name];
1379 };
1380 });
1381});
1382var defaultStylisPlugins = [prefixer];
1383
1384var createCache = function createCache(options) {
1385 var key = options.key;
1386
1387 if (process.env.NODE_ENV !== 'production' && !key) {
1388 throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements.");
1389 }
1390
1391 if (isBrowser$6 && key === 'css') {
1392 var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
1393 // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
1394 // note this very very intentionally targets all style elements regardless of the key to ensure
1395 // that creating a cache works inside of render of a React component
1396
1397 Array.prototype.forEach.call(ssrStyles, function (node) {
1398 // we want to only move elements which have a space in the data-emotion attribute value
1399 // because that indicates that it is an Emotion 11 server-side rendered style elements
1400 // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
1401 // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
1402 // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
1403 // will not result in the Emotion 10 styles being destroyed
1404 var dataEmotionAttribute = node.getAttribute('data-emotion');
1405
1406 if (dataEmotionAttribute.indexOf(' ') === -1) {
1407 return;
1408 }
1409
1410 document.head.appendChild(node);
1411 node.setAttribute('data-s', '');
1412 });
1413 }
1414
1415 var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
1416
1417 if (process.env.NODE_ENV !== 'production') {
1418 // $FlowFixMe
1419 if (/[^a-z-]/.test(key)) {
1420 throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
1421 }
1422 }
1423
1424 var inserted = {}; // $FlowFixMe
1425
1426 var container;
1427 var nodesToHydrate = [];
1428
1429 if (isBrowser$6) {
1430 container = options.container || document.head;
1431 Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
1432 // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
1433 document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
1434 var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe
1435
1436 for (var i = 1; i < attrib.length; i++) {
1437 inserted[attrib[i]] = true;
1438 }
1439
1440 nodesToHydrate.push(node);
1441 });
1442 }
1443
1444 var _insert;
1445
1446 var omnipresentPlugins = [compat, removeLabel];
1447
1448 if (process.env.NODE_ENV !== 'production') {
1449 omnipresentPlugins.push(createUnsafeSelectorsAlarm({
1450 get compat() {
1451 return cache.compat;
1452 }
1453
1454 }), incorrectImportAlarm);
1455 }
1456
1457 if (isBrowser$6) {
1458 var currentSheet;
1459 var finalizingPlugins = [stringify, process.env.NODE_ENV !== 'production' ? function (element) {
1460 if (!element.root) {
1461 if (element["return"]) {
1462 currentSheet.insert(element["return"]);
1463 } else if (element.value && element.type !== COMMENT) {
1464 // insert empty rule in non-production environments
1465 // so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
1466 currentSheet.insert(element.value + "{}");
1467 }
1468 }
1469 } : rulesheet(function (rule) {
1470 currentSheet.insert(rule);
1471 })];
1472 var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
1473
1474 var stylis = function stylis(styles) {
1475 return serialize(compile(styles), serializer);
1476 };
1477
1478 _insert = function insert(selector, serialized, sheet, shouldCache) {
1479 currentSheet = sheet;
1480
1481 if (process.env.NODE_ENV !== 'production' && serialized.map !== undefined) {
1482 currentSheet = {
1483 insert: function insert(rule) {
1484 sheet.insert(rule + serialized.map);
1485 }
1486 };
1487 }
1488
1489 stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
1490
1491 if (shouldCache) {
1492 cache.inserted[serialized.name] = true;
1493 }
1494 };
1495 } else {
1496 var _finalizingPlugins = [stringify];
1497
1498 var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
1499
1500 var _stylis = function _stylis(styles) {
1501 return serialize(compile(styles), _serializer);
1502 }; // $FlowFixMe
1503
1504
1505 var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
1506
1507 var getRules = function getRules(selector, serialized) {
1508 var name = serialized.name;
1509
1510 if (serverStylisCache[name] === undefined) {
1511 serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
1512 }
1513
1514 return serverStylisCache[name];
1515 };
1516
1517 _insert = function _insert(selector, serialized, sheet, shouldCache) {
1518 var name = serialized.name;
1519 var rules = getRules(selector, serialized);
1520
1521 if (cache.compat === undefined) {
1522 // in regular mode, we don't set the styles on the inserted cache
1523 // since we don't need to and that would be wasting memory
1524 // we return them so that they are rendered in a style tag
1525 if (shouldCache) {
1526 cache.inserted[name] = true;
1527 }
1528
1529 if ( // using === development instead of !== production
1530 // because if people do ssr in tests, the source maps showing up would be annoying
1531 process.env.NODE_ENV === 'development' && serialized.map !== undefined) {
1532 return rules + serialized.map;
1533 }
1534
1535 return rules;
1536 } else {
1537 // in compat mode, we put the styles on the inserted cache so
1538 // that emotion-server can pull out the styles
1539 // except when we don't want to cache it which was in Global but now
1540 // is nowhere but we don't want to do a major right now
1541 // and just in case we're going to leave the case here
1542 // it's also not affecting client side bundle size
1543 // so it's really not a big deal
1544 if (shouldCache) {
1545 cache.inserted[name] = rules;
1546 } else {
1547 return rules;
1548 }
1549 }
1550 };
1551 }
1552
1553 var cache = {
1554 key: key,
1555 sheet: new StyleSheet$1({
1556 key: key,
1557 container: container,
1558 nonce: options.nonce,
1559 speedy: options.speedy,
1560 prepend: options.prepend,
1561 insertionPoint: options.insertionPoint
1562 }),
1563 nonce: options.nonce,
1564 inserted: inserted,
1565 registered: {},
1566 insert: _insert
1567 };
1568 cache.sheet.hydrate(nodesToHydrate);
1569 return cache;
1570};
1571
1572var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1573var reactIs$1 = {
1574 exports: {}
1575};
1576var reactIs_production_min = {};
1577/** @license React v16.13.1
1578 * react-is.production.min.js
1579 *
1580 * Copyright (c) Facebook, Inc. and its affiliates.
1581 *
1582 * This source code is licensed under the MIT license found in the
1583 * LICENSE file in the root directory of this source tree.
1584 */
1585
1586var b = "function" === typeof Symbol && Symbol.for,
1587 c = b ? Symbol.for("react.element") : 60103,
1588 d = b ? Symbol.for("react.portal") : 60106,
1589 e = b ? Symbol.for("react.fragment") : 60107,
1590 f = b ? Symbol.for("react.strict_mode") : 60108,
1591 g = b ? Symbol.for("react.profiler") : 60114,
1592 h = b ? Symbol.for("react.provider") : 60109,
1593 k = b ? Symbol.for("react.context") : 60110,
1594 l = b ? Symbol.for("react.async_mode") : 60111,
1595 m = b ? Symbol.for("react.concurrent_mode") : 60111,
1596 n = b ? Symbol.for("react.forward_ref") : 60112,
1597 p = b ? Symbol.for("react.suspense") : 60113,
1598 q = b ? Symbol.for("react.suspense_list") : 60120,
1599 r = b ? Symbol.for("react.memo") : 60115,
1600 t = b ? Symbol.for("react.lazy") : 60116,
1601 v = b ? Symbol.for("react.block") : 60121,
1602 w = b ? Symbol.for("react.fundamental") : 60117,
1603 x = b ? Symbol.for("react.responder") : 60118,
1604 y = b ? Symbol.for("react.scope") : 60119;
1605
1606function z(a) {
1607 if ("object" === _typeof(a) && null !== a) {
1608 var u = a.$$typeof;
1609
1610 switch (u) {
1611 case c:
1612 switch (a = a.type, a) {
1613 case l:
1614 case m:
1615 case e:
1616 case g:
1617 case f:
1618 case p:
1619 return a;
1620
1621 default:
1622 switch (a = a && a.$$typeof, a) {
1623 case k:
1624 case n:
1625 case t:
1626 case r:
1627 case h:
1628 return a;
1629
1630 default:
1631 return u;
1632 }
1633
1634 }
1635
1636 case d:
1637 return u;
1638 }
1639 }
1640}
1641
1642function A(a) {
1643 return z(a) === m;
1644}
1645
1646reactIs_production_min.AsyncMode = l;
1647reactIs_production_min.ConcurrentMode = m;
1648reactIs_production_min.ContextConsumer = k;
1649reactIs_production_min.ContextProvider = h;
1650reactIs_production_min.Element = c;
1651reactIs_production_min.ForwardRef = n;
1652reactIs_production_min.Fragment = e;
1653reactIs_production_min.Lazy = t;
1654reactIs_production_min.Memo = r;
1655reactIs_production_min.Portal = d;
1656reactIs_production_min.Profiler = g;
1657reactIs_production_min.StrictMode = f;
1658reactIs_production_min.Suspense = p;
1659
1660reactIs_production_min.isAsyncMode = function (a) {
1661 return A(a) || z(a) === l;
1662};
1663
1664reactIs_production_min.isConcurrentMode = A;
1665
1666reactIs_production_min.isContextConsumer = function (a) {
1667 return z(a) === k;
1668};
1669
1670reactIs_production_min.isContextProvider = function (a) {
1671 return z(a) === h;
1672};
1673
1674reactIs_production_min.isElement = function (a) {
1675 return "object" === _typeof(a) && null !== a && a.$$typeof === c;
1676};
1677
1678reactIs_production_min.isForwardRef = function (a) {
1679 return z(a) === n;
1680};
1681
1682reactIs_production_min.isFragment = function (a) {
1683 return z(a) === e;
1684};
1685
1686reactIs_production_min.isLazy = function (a) {
1687 return z(a) === t;
1688};
1689
1690reactIs_production_min.isMemo = function (a) {
1691 return z(a) === r;
1692};
1693
1694reactIs_production_min.isPortal = function (a) {
1695 return z(a) === d;
1696};
1697
1698reactIs_production_min.isProfiler = function (a) {
1699 return z(a) === g;
1700};
1701
1702reactIs_production_min.isStrictMode = function (a) {
1703 return z(a) === f;
1704};
1705
1706reactIs_production_min.isSuspense = function (a) {
1707 return z(a) === p;
1708};
1709
1710reactIs_production_min.isValidElementType = function (a) {
1711 return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === _typeof(a) && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
1712};
1713
1714reactIs_production_min.typeOf = z;
1715var reactIs_development = {};
1716/** @license React v16.13.1
1717 * react-is.development.js
1718 *
1719 * Copyright (c) Facebook, Inc. and its affiliates.
1720 *
1721 * This source code is licensed under the MIT license found in the
1722 * LICENSE file in the root directory of this source tree.
1723 */
1724
1725if (process.env.NODE_ENV !== "production") {
1726 (function () {
1727 // nor polyfill, then a plain number is used for performance.
1728 var hasSymbol = typeof Symbol === 'function' && Symbol.for;
1729 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
1730 var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
1731 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
1732 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
1733 var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
1734 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
1735 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
1736 // (unstable) APIs that have been removed. Can we remove the symbols?
1737
1738 var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
1739 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
1740 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
1741 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
1742 var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
1743 var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
1744 var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
1745 var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
1746 var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
1747 var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
1748 var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
1749
1750 function isValidElementType(type) {
1751 return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1752 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || _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 || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
1753 }
1754
1755 function typeOf(object) {
1756 if (_typeof(object) === 'object' && object !== null) {
1757 var $$typeof = object.$$typeof;
1758
1759 switch ($$typeof) {
1760 case REACT_ELEMENT_TYPE:
1761 var type = object.type;
1762
1763 switch (type) {
1764 case REACT_ASYNC_MODE_TYPE:
1765 case REACT_CONCURRENT_MODE_TYPE:
1766 case REACT_FRAGMENT_TYPE:
1767 case REACT_PROFILER_TYPE:
1768 case REACT_STRICT_MODE_TYPE:
1769 case REACT_SUSPENSE_TYPE:
1770 return type;
1771
1772 default:
1773 var $$typeofType = type && type.$$typeof;
1774
1775 switch ($$typeofType) {
1776 case REACT_CONTEXT_TYPE:
1777 case REACT_FORWARD_REF_TYPE:
1778 case REACT_LAZY_TYPE:
1779 case REACT_MEMO_TYPE:
1780 case REACT_PROVIDER_TYPE:
1781 return $$typeofType;
1782
1783 default:
1784 return $$typeof;
1785 }
1786
1787 }
1788
1789 case REACT_PORTAL_TYPE:
1790 return $$typeof;
1791 }
1792 }
1793
1794 return undefined;
1795 } // AsyncMode is deprecated along with isAsyncMode
1796
1797
1798 var AsyncMode = REACT_ASYNC_MODE_TYPE;
1799 var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
1800 var ContextConsumer = REACT_CONTEXT_TYPE;
1801 var ContextProvider = REACT_PROVIDER_TYPE;
1802 var Element = REACT_ELEMENT_TYPE;
1803 var ForwardRef = REACT_FORWARD_REF_TYPE;
1804 var Fragment = REACT_FRAGMENT_TYPE;
1805 var Lazy = REACT_LAZY_TYPE;
1806 var Memo = REACT_MEMO_TYPE;
1807 var Portal = REACT_PORTAL_TYPE;
1808 var Profiler = REACT_PROFILER_TYPE;
1809 var StrictMode = REACT_STRICT_MODE_TYPE;
1810 var Suspense = REACT_SUSPENSE_TYPE;
1811 var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
1812
1813 function isAsyncMode(object) {
1814 {
1815 if (!hasWarnedAboutDeprecatedIsAsyncMode) {
1816 hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
1817
1818 console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
1819 }
1820 }
1821 return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
1822 }
1823
1824 function isConcurrentMode(object) {
1825 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
1826 }
1827
1828 function isContextConsumer(object) {
1829 return typeOf(object) === REACT_CONTEXT_TYPE;
1830 }
1831
1832 function isContextProvider(object) {
1833 return typeOf(object) === REACT_PROVIDER_TYPE;
1834 }
1835
1836 function isElement(object) {
1837 return _typeof(object) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1838 }
1839
1840 function isForwardRef(object) {
1841 return typeOf(object) === REACT_FORWARD_REF_TYPE;
1842 }
1843
1844 function isFragment(object) {
1845 return typeOf(object) === REACT_FRAGMENT_TYPE;
1846 }
1847
1848 function isLazy(object) {
1849 return typeOf(object) === REACT_LAZY_TYPE;
1850 }
1851
1852 function isMemo(object) {
1853 return typeOf(object) === REACT_MEMO_TYPE;
1854 }
1855
1856 function isPortal(object) {
1857 return typeOf(object) === REACT_PORTAL_TYPE;
1858 }
1859
1860 function isProfiler(object) {
1861 return typeOf(object) === REACT_PROFILER_TYPE;
1862 }
1863
1864 function isStrictMode(object) {
1865 return typeOf(object) === REACT_STRICT_MODE_TYPE;
1866 }
1867
1868 function isSuspense(object) {
1869 return typeOf(object) === REACT_SUSPENSE_TYPE;
1870 }
1871
1872 reactIs_development.AsyncMode = AsyncMode;
1873 reactIs_development.ConcurrentMode = ConcurrentMode;
1874 reactIs_development.ContextConsumer = ContextConsumer;
1875 reactIs_development.ContextProvider = ContextProvider;
1876 reactIs_development.Element = Element;
1877 reactIs_development.ForwardRef = ForwardRef;
1878 reactIs_development.Fragment = Fragment;
1879 reactIs_development.Lazy = Lazy;
1880 reactIs_development.Memo = Memo;
1881 reactIs_development.Portal = Portal;
1882 reactIs_development.Profiler = Profiler;
1883 reactIs_development.StrictMode = StrictMode;
1884 reactIs_development.Suspense = Suspense;
1885 reactIs_development.isAsyncMode = isAsyncMode;
1886 reactIs_development.isConcurrentMode = isConcurrentMode;
1887 reactIs_development.isContextConsumer = isContextConsumer;
1888 reactIs_development.isContextProvider = isContextProvider;
1889 reactIs_development.isElement = isElement;
1890 reactIs_development.isForwardRef = isForwardRef;
1891 reactIs_development.isFragment = isFragment;
1892 reactIs_development.isLazy = isLazy;
1893 reactIs_development.isMemo = isMemo;
1894 reactIs_development.isPortal = isPortal;
1895 reactIs_development.isProfiler = isProfiler;
1896 reactIs_development.isStrictMode = isStrictMode;
1897 reactIs_development.isSuspense = isSuspense;
1898 reactIs_development.isValidElementType = isValidElementType;
1899 reactIs_development.typeOf = typeOf;
1900 })();
1901}
1902
1903if (process.env.NODE_ENV === 'production') {
1904 reactIs$1.exports = reactIs_production_min;
1905} else {
1906 reactIs$1.exports = reactIs_development;
1907}
1908
1909var reactIs = reactIs$1.exports;
1910/**
1911 * Copyright 2015, Yahoo! Inc.
1912 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
1913 */
1914
1915var REACT_STATICS = {
1916 childContextTypes: true,
1917 contextType: true,
1918 contextTypes: true,
1919 defaultProps: true,
1920 displayName: true,
1921 getDefaultProps: true,
1922 getDerivedStateFromError: true,
1923 getDerivedStateFromProps: true,
1924 mixins: true,
1925 propTypes: true,
1926 type: true
1927};
1928var KNOWN_STATICS = {
1929 name: true,
1930 length: true,
1931 prototype: true,
1932 caller: true,
1933 callee: true,
1934 arguments: true,
1935 arity: true
1936};
1937var FORWARD_REF_STATICS = {
1938 '$$typeof': true,
1939 render: true,
1940 defaultProps: true,
1941 displayName: true,
1942 propTypes: true
1943};
1944var MEMO_STATICS = {
1945 '$$typeof': true,
1946 compare: true,
1947 defaultProps: true,
1948 displayName: true,
1949 propTypes: true,
1950 type: true
1951};
1952var TYPE_STATICS = {};
1953TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
1954TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
1955
1956function getStatics(component) {
1957 // React v16.11 and below
1958 if (reactIs.isMemo(component)) {
1959 return MEMO_STATICS;
1960 } // React v16.12 and above
1961
1962
1963 return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
1964}
1965
1966var defineProperty = Object.defineProperty;
1967var getOwnPropertyNames = Object.getOwnPropertyNames;
1968var getOwnPropertySymbols = Object.getOwnPropertySymbols;
1969var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1970var getPrototypeOf = Object.getPrototypeOf;
1971var objectPrototype = Object.prototype;
1972
1973function hoistNonReactStatics$2(targetComponent, sourceComponent, blacklist) {
1974 if (typeof sourceComponent !== 'string') {
1975 // don't hoist over string (html) components
1976 if (objectPrototype) {
1977 var inheritedComponent = getPrototypeOf(sourceComponent);
1978
1979 if (inheritedComponent && inheritedComponent !== objectPrototype) {
1980 hoistNonReactStatics$2(targetComponent, inheritedComponent, blacklist);
1981 }
1982 }
1983
1984 var keys = getOwnPropertyNames(sourceComponent);
1985
1986 if (getOwnPropertySymbols) {
1987 keys = keys.concat(getOwnPropertySymbols(sourceComponent));
1988 }
1989
1990 var targetStatics = getStatics(targetComponent);
1991 var sourceStatics = getStatics(sourceComponent);
1992
1993 for (var i = 0; i < keys.length; ++i) {
1994 var key = keys[i];
1995
1996 if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
1997 var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
1998
1999 try {
2000 // Avoid failures from read-only properties
2001 defineProperty(targetComponent, key, descriptor);
2002 } catch (e) {}
2003 }
2004 }
2005 }
2006
2007 return targetComponent;
2008}
2009
2010var hoistNonReactStatics_cjs = hoistNonReactStatics$2; // and if this module doesn't actually contain any logic of its own
2011// then Rollup just use 'hoist-non-react-statics' directly in other chunks
2012
2013var hoistNonReactStatics = function hoistNonReactStatics(targetComponent, sourceComponent) {
2014 return hoistNonReactStatics_cjs(targetComponent, sourceComponent);
2015};
2016
2017var hoistNonReactStatics$1 = hoistNonReactStatics;
2018var isBrowser$5 = typeof document !== 'undefined';
2019
2020function getRegisteredStyles$1(registered, registeredStyles, classNames) {
2021 var rawClassName = '';
2022 classNames.split(' ').forEach(function (className) {
2023 if (registered[className] !== undefined) {
2024 registeredStyles.push(registered[className] + ";");
2025 } else {
2026 rawClassName += className + " ";
2027 }
2028 });
2029 return rawClassName;
2030}
2031
2032var registerStyles$1 = function registerStyles(cache, serialized, isStringTag) {
2033 var className = cache.key + "-" + serialized.name;
2034
2035 if ( // we only need to add the styles to the registered cache if the
2036 // class name could be used further down
2037 // the tree but if it's a string tag, we know it won't
2038 // so we don't have to add it to registered cache.
2039 // this improves memory usage since we can avoid storing the whole style string
2040 (isStringTag === false || // we need to always store it if we're in compat mode and
2041 // in node since emotion-server relies on whether a style is in
2042 // the registered cache to know whether a style is global or not
2043 // also, note that this check will be dead code eliminated in the browser
2044 isBrowser$5 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
2045 cache.registered[className] = serialized.styles;
2046 }
2047};
2048
2049var insertStyles$1 = function insertStyles(cache, serialized, isStringTag) {
2050 registerStyles$1(cache, serialized, isStringTag);
2051 var className = cache.key + "-" + serialized.name;
2052
2053 if (cache.inserted[serialized.name] === undefined) {
2054 var stylesForSSR = '';
2055 var current = serialized;
2056
2057 do {
2058 var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
2059
2060 if (!isBrowser$5 && maybeStyles !== undefined) {
2061 stylesForSSR += maybeStyles;
2062 }
2063
2064 current = current.next;
2065 } while (current !== undefined);
2066
2067 if (!isBrowser$5 && stylesForSSR.length !== 0) {
2068 return stylesForSSR;
2069 }
2070 }
2071};
2072/* eslint-disable */
2073// Inspired by https://github.com/garycourt/murmurhash-js
2074// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
2075
2076
2077function murmur2(str) {
2078 // 'm' and 'r' are mixing constants generated offline.
2079 // They're not really 'magic', they just happen to work well.
2080 // const m = 0x5bd1e995;
2081 // const r = 24;
2082 // Initialize the hash
2083 var h = 0; // Mix 4 bytes at a time into the hash
2084
2085 var k,
2086 i = 0,
2087 len = str.length;
2088
2089 for (; len >= 4; ++i, len -= 4) {
2090 k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
2091 k =
2092 /* Math.imul(k, m): */
2093 (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
2094 k ^=
2095 /* k >>> r: */
2096 k >>> 24;
2097 h =
2098 /* Math.imul(k, m): */
2099 (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^
2100 /* Math.imul(h, m): */
2101 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
2102 } // Handle the last few bytes of the input array
2103
2104
2105 switch (len) {
2106 case 3:
2107 h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
2108
2109 case 2:
2110 h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
2111
2112 case 1:
2113 h ^= str.charCodeAt(i) & 0xff;
2114 h =
2115 /* Math.imul(h, m): */
2116 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
2117 } // Do a few final mixes of the hash to ensure the last few
2118 // bytes are well-incorporated.
2119
2120
2121 h ^= h >>> 13;
2122 h =
2123 /* Math.imul(h, m): */
2124 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
2125 return ((h ^ h >>> 15) >>> 0).toString(36);
2126}
2127
2128var unitlessKeys = {
2129 animationIterationCount: 1,
2130 borderImageOutset: 1,
2131 borderImageSlice: 1,
2132 borderImageWidth: 1,
2133 boxFlex: 1,
2134 boxFlexGroup: 1,
2135 boxOrdinalGroup: 1,
2136 columnCount: 1,
2137 columns: 1,
2138 flex: 1,
2139 flexGrow: 1,
2140 flexPositive: 1,
2141 flexShrink: 1,
2142 flexNegative: 1,
2143 flexOrder: 1,
2144 gridRow: 1,
2145 gridRowEnd: 1,
2146 gridRowSpan: 1,
2147 gridRowStart: 1,
2148 gridColumn: 1,
2149 gridColumnEnd: 1,
2150 gridColumnSpan: 1,
2151 gridColumnStart: 1,
2152 msGridRow: 1,
2153 msGridRowSpan: 1,
2154 msGridColumn: 1,
2155 msGridColumnSpan: 1,
2156 fontWeight: 1,
2157 lineHeight: 1,
2158 opacity: 1,
2159 order: 1,
2160 orphans: 1,
2161 tabSize: 1,
2162 widows: 1,
2163 zIndex: 1,
2164 zoom: 1,
2165 WebkitLineClamp: 1,
2166 // SVG-related properties
2167 fillOpacity: 1,
2168 floodOpacity: 1,
2169 stopOpacity: 1,
2170 strokeDasharray: 1,
2171 strokeDashoffset: 1,
2172 strokeMiterlimit: 1,
2173 strokeOpacity: 1,
2174 strokeWidth: 1
2175};
2176var ILLEGAL_ESCAPE_SEQUENCE_ERROR$2 = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
2177var UNDEFINED_AS_OBJECT_KEY_ERROR$1 = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).";
2178var hyphenateRegex$1 = /[A-Z]|^ms/g;
2179var animationRegex$1 = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
2180
2181var isCustomProperty$1 = function isCustomProperty(property) {
2182 return property.charCodeAt(1) === 45;
2183};
2184
2185var isProcessableValue$1 = function isProcessableValue(value) {
2186 return value != null && typeof value !== 'boolean';
2187};
2188
2189var processStyleName$1 = /* #__PURE__ */memoize(function (styleName) {
2190 return isCustomProperty$1(styleName) ? styleName : styleName.replace(hyphenateRegex$1, '-$&').toLowerCase();
2191});
2192
2193var processStyleValue$1 = function processStyleValue(key, value) {
2194 switch (key) {
2195 case 'animation':
2196 case 'animationName':
2197 {
2198 if (typeof value === 'string') {
2199 return value.replace(animationRegex$1, function (match, p1, p2) {
2200 cursor$1 = {
2201 name: p1,
2202 styles: p2,
2203 next: cursor$1
2204 };
2205 return p1;
2206 });
2207 }
2208 }
2209 }
2210
2211 if (unitlessKeys[key] !== 1 && !isCustomProperty$1(key) && typeof value === 'number' && value !== 0) {
2212 return value + 'px';
2213 }
2214
2215 return value;
2216};
2217
2218if (process.env.NODE_ENV !== 'production') {
2219 var contentValuePattern$1 = /(attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
2220 var contentValues$1 = ['normal', 'none', 'initial', 'inherit', 'unset'];
2221 var oldProcessStyleValue$1 = processStyleValue$1;
2222 var msPattern$1 = /^-ms-/;
2223 var hyphenPattern$1 = /-(.)/g;
2224 var hyphenatedCache$1 = {};
2225
2226 processStyleValue$1 = function processStyleValue(key, value) {
2227 if (key === 'content') {
2228 if (typeof value !== 'string' || contentValues$1.indexOf(value) === -1 && !contentValuePattern$1.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '"' && value.charAt(0) !== "'")) {
2229 throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
2230 }
2231 }
2232
2233 var processed = oldProcessStyleValue$1(key, value);
2234
2235 if (processed !== '' && !isCustomProperty$1(key) && key.indexOf('-') !== -1 && hyphenatedCache$1[key] === undefined) {
2236 hyphenatedCache$1[key] = true;
2237 console.error("Using kebab-case for css properties in objects is not supported. Did you mean " + key.replace(msPattern$1, 'ms-').replace(hyphenPattern$1, function (str, _char) {
2238 return _char.toUpperCase();
2239 }) + "?");
2240 }
2241
2242 return processed;
2243 };
2244}
2245
2246function handleInterpolation$1(mergedProps, registered, interpolation) {
2247 if (interpolation == null) {
2248 return '';
2249 }
2250
2251 if (interpolation.__emotion_styles !== undefined) {
2252 if (process.env.NODE_ENV !== 'production' && interpolation.toString() === 'NO_COMPONENT_SELECTOR') {
2253 throw new Error('Component selectors can only be used in conjunction with @emotion/babel-plugin.');
2254 }
2255
2256 return interpolation;
2257 }
2258
2259 switch (_typeof(interpolation)) {
2260 case 'boolean':
2261 {
2262 return '';
2263 }
2264
2265 case 'object':
2266 {
2267 if (interpolation.anim === 1) {
2268 cursor$1 = {
2269 name: interpolation.name,
2270 styles: interpolation.styles,
2271 next: cursor$1
2272 };
2273 return interpolation.name;
2274 }
2275
2276 if (interpolation.styles !== undefined) {
2277 var next = interpolation.next;
2278
2279 if (next !== undefined) {
2280 // not the most efficient thing ever but this is a pretty rare case
2281 // and there will be very few iterations of this generally
2282 while (next !== undefined) {
2283 cursor$1 = {
2284 name: next.name,
2285 styles: next.styles,
2286 next: cursor$1
2287 };
2288 next = next.next;
2289 }
2290 }
2291
2292 var styles = interpolation.styles + ";";
2293
2294 if (process.env.NODE_ENV !== 'production' && interpolation.map !== undefined) {
2295 styles += interpolation.map;
2296 }
2297
2298 return styles;
2299 }
2300
2301 return createStringFromObject$1(mergedProps, registered, interpolation);
2302 }
2303
2304 case 'function':
2305 {
2306 if (mergedProps !== undefined) {
2307 var previousCursor = cursor$1;
2308 var result = interpolation(mergedProps);
2309 cursor$1 = previousCursor;
2310 return handleInterpolation$1(mergedProps, registered, result);
2311 } else if (process.env.NODE_ENV !== 'production') {
2312 console.error('Functions that are interpolated in css calls will be stringified.\n' + 'If you want to have a css call based on props, create a function that returns a css call like this\n' + 'let dynamicStyle = (props) => css`color: ${props.color}`\n' + 'It can be called directly with props or interpolated in a styled call like this\n' + "let SomeComponent = styled('div')`${dynamicStyle}`");
2313 }
2314
2315 break;
2316 }
2317
2318 case 'string':
2319 if (process.env.NODE_ENV !== 'production') {
2320 var matched = [];
2321 var replaced = interpolation.replace(animationRegex$1, function (match, p1, p2) {
2322 var fakeVarName = "animation" + matched.length;
2323 matched.push("const " + fakeVarName + " = keyframes`" + p2.replace(/^@keyframes animation-\w+/, '') + "`");
2324 return "${" + fakeVarName + "}";
2325 });
2326
2327 if (matched.length) {
2328 console.error('`keyframes` output got interpolated into plain string, please wrap it with `css`.\n\n' + 'Instead of doing this:\n\n' + [].concat(matched, ["`" + replaced + "`"]).join('\n') + '\n\nYou should wrap it with `css` like this:\n\n' + ("css`" + replaced + "`"));
2329 }
2330 }
2331
2332 break;
2333 } // finalize string values (regular strings and functions interpolated into css calls)
2334
2335
2336 if (registered == null) {
2337 return interpolation;
2338 }
2339
2340 var cached = registered[interpolation];
2341 return cached !== undefined ? cached : interpolation;
2342}
2343
2344function createStringFromObject$1(mergedProps, registered, obj) {
2345 var string = '';
2346
2347 if (Array.isArray(obj)) {
2348 for (var i = 0; i < obj.length; i++) {
2349 string += handleInterpolation$1(mergedProps, registered, obj[i]) + ";";
2350 }
2351 } else {
2352 for (var _key in obj) {
2353 var value = obj[_key];
2354
2355 if (_typeof(value) !== 'object') {
2356 if (registered != null && registered[value] !== undefined) {
2357 string += _key + "{" + registered[value] + "}";
2358 } else if (isProcessableValue$1(value)) {
2359 string += processStyleName$1(_key) + ":" + processStyleValue$1(_key, value) + ";";
2360 }
2361 } else {
2362 if (_key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') {
2363 throw new Error('Component selectors can only be used in conjunction with @emotion/babel-plugin.');
2364 }
2365
2366 if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
2367 for (var _i = 0; _i < value.length; _i++) {
2368 if (isProcessableValue$1(value[_i])) {
2369 string += processStyleName$1(_key) + ":" + processStyleValue$1(_key, value[_i]) + ";";
2370 }
2371 }
2372 } else {
2373 var interpolated = handleInterpolation$1(mergedProps, registered, value);
2374
2375 switch (_key) {
2376 case 'animation':
2377 case 'animationName':
2378 {
2379 string += processStyleName$1(_key) + ":" + interpolated + ";";
2380 break;
2381 }
2382
2383 default:
2384 {
2385 if (process.env.NODE_ENV !== 'production' && _key === 'undefined') {
2386 console.error(UNDEFINED_AS_OBJECT_KEY_ERROR$1);
2387 }
2388
2389 string += _key + "{" + interpolated + "}";
2390 }
2391 }
2392 }
2393 }
2394 }
2395 }
2396
2397 return string;
2398}
2399
2400var labelPattern$1 = /label:\s*([^\s;\n{]+)\s*(;|$)/g;
2401var sourceMapPattern$1;
2402
2403if (process.env.NODE_ENV !== 'production') {
2404 sourceMapPattern$1 = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
2405} // this is the cursor for keyframes
2406// keyframes are stored on the SerializedStyles object as a linked list
2407
2408
2409var cursor$1;
2410
2411var serializeStyles$1 = function serializeStyles(args, registered, mergedProps) {
2412 if (args.length === 1 && _typeof(args[0]) === 'object' && args[0] !== null && args[0].styles !== undefined) {
2413 return args[0];
2414 }
2415
2416 var stringMode = true;
2417 var styles = '';
2418 cursor$1 = undefined;
2419 var strings = args[0];
2420
2421 if (strings == null || strings.raw === undefined) {
2422 stringMode = false;
2423 styles += handleInterpolation$1(mergedProps, registered, strings);
2424 } else {
2425 if (process.env.NODE_ENV !== 'production' && strings[0] === undefined) {
2426 console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR$2);
2427 }
2428
2429 styles += strings[0];
2430 } // we start at 1 since we've already handled the first arg
2431
2432
2433 for (var i = 1; i < args.length; i++) {
2434 styles += handleInterpolation$1(mergedProps, registered, args[i]);
2435
2436 if (stringMode) {
2437 if (process.env.NODE_ENV !== 'production' && strings[i] === undefined) {
2438 console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR$2);
2439 }
2440
2441 styles += strings[i];
2442 }
2443 }
2444
2445 var sourceMap;
2446
2447 if (process.env.NODE_ENV !== 'production') {
2448 styles = styles.replace(sourceMapPattern$1, function (match) {
2449 sourceMap = match;
2450 return '';
2451 });
2452 } // using a global regex with .exec is stateful so lastIndex has to be reset each time
2453
2454
2455 labelPattern$1.lastIndex = 0;
2456 var identifierName = '';
2457 var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
2458
2459 while ((match = labelPattern$1.exec(styles)) !== null) {
2460 identifierName += '-' + // $FlowFixMe we know it's not null
2461 match[1];
2462 }
2463
2464 var name = murmur2(styles) + identifierName;
2465
2466 if (process.env.NODE_ENV !== 'production') {
2467 // $FlowFixMe SerializedStyles type doesn't have toString property (and we don't want to add it)
2468 return {
2469 name: name,
2470 styles: styles,
2471 map: sourceMap,
2472 next: cursor$1,
2473 toString: function toString() {
2474 return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
2475 }
2476 };
2477 }
2478
2479 return {
2480 name: name,
2481 styles: styles,
2482 next: cursor$1
2483 };
2484};
2485
2486var isBrowser$4 = typeof document !== 'undefined';
2487var hasOwnProperty$1 = {}.hasOwnProperty;
2488var EmotionCacheContext = /* #__PURE__ */createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
2489// because this module is primarily intended for the browser and node
2490// but it's also required in react native and similar environments sometimes
2491// and we could have a special build just for that
2492// but this is much easier and the native packages
2493// might use a different theme context in the future anyway
2494typeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({
2495 key: 'css'
2496}) : null);
2497
2498if (process.env.NODE_ENV !== 'production') {
2499 EmotionCacheContext.displayName = 'EmotionCacheContext';
2500}
2501
2502var CacheProvider = EmotionCacheContext.Provider;
2503
2504var withEmotionCache = function withEmotionCache(func) {
2505 // $FlowFixMe
2506 return /*#__PURE__*/forwardRef(function (props, ref) {
2507 // the cache will never be null in the browser
2508 var cache = useContext(EmotionCacheContext);
2509 return func(props, cache, ref);
2510 });
2511};
2512
2513if (!isBrowser$4) {
2514 withEmotionCache = function withEmotionCache(func) {
2515 return function (props) {
2516 var cache = useContext(EmotionCacheContext);
2517
2518 if (cache === null) {
2519 // yes, we're potentially creating this on every render
2520 // it doesn't actually matter though since it's only on the server
2521 // so there will only every be a single render
2522 // that could change in the future because of suspense and etc. but for now,
2523 // this works and i don't want to optimise for a future thing that we aren't sure about
2524 cache = createCache({
2525 key: 'css'
2526 });
2527 return /*#__PURE__*/createElement(EmotionCacheContext.Provider, {
2528 value: cache
2529 }, func(props, cache));
2530 } else {
2531 return func(props, cache);
2532 }
2533 };
2534 };
2535}
2536
2537var ThemeContext = /* #__PURE__ */createContext({});
2538
2539if (process.env.NODE_ENV !== 'production') {
2540 ThemeContext.displayName = 'EmotionThemeContext';
2541}
2542
2543var useTheme$1 = function useTheme() {
2544 return useContext(ThemeContext);
2545};
2546
2547var getTheme = function getTheme(outerTheme, theme) {
2548 if (typeof theme === 'function') {
2549 var mergedTheme = theme(outerTheme);
2550
2551 if (process.env.NODE_ENV !== 'production' && (mergedTheme == null || _typeof(mergedTheme) !== 'object' || Array.isArray(mergedTheme))) {
2552 throw new Error('[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!');
2553 }
2554
2555 return mergedTheme;
2556 }
2557
2558 if (process.env.NODE_ENV !== 'production' && (theme == null || _typeof(theme) !== 'object' || Array.isArray(theme))) {
2559 throw new Error('[ThemeProvider] Please make your theme prop a plain object');
2560 }
2561
2562 return _extends$1({}, outerTheme, theme);
2563};
2564
2565var createCacheWithTheme = /* #__PURE__ */weakMemoize(function (outerTheme) {
2566 return weakMemoize(function (theme) {
2567 return getTheme(outerTheme, theme);
2568 });
2569});
2570
2571var ThemeProvider = function ThemeProvider(props) {
2572 var theme = useContext(ThemeContext);
2573
2574 if (props.theme !== theme) {
2575 theme = createCacheWithTheme(theme)(props.theme);
2576 }
2577
2578 return /*#__PURE__*/createElement(ThemeContext.Provider, {
2579 value: theme
2580 }, props.children);
2581};
2582
2583function withTheme$1(Component) {
2584 var componentName = Component.displayName || Component.name || 'Component';
2585
2586 var render = function render(props, ref) {
2587 var theme = useContext(ThemeContext);
2588 return /*#__PURE__*/createElement(Component, _extends$1({
2589 theme: theme,
2590 ref: ref
2591 }, props));
2592 }; // $FlowFixMe
2593
2594
2595 var WithTheme = /*#__PURE__*/forwardRef(render);
2596 WithTheme.displayName = "WithTheme(" + componentName + ")";
2597 return hoistNonReactStatics$1(WithTheme, Component);
2598}
2599
2600var getLastPart = function getLastPart(functionName) {
2601 // The match may be something like 'Object.createEmotionProps' or
2602 // 'Loader.prototype.render'
2603 var parts = functionName.split('.');
2604 return parts[parts.length - 1];
2605};
2606
2607var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {
2608 // V8
2609 var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
2610 if (match) return getLastPart(match[1]); // Safari / Firefox
2611
2612 match = /^([A-Za-z0-9$.]+)@/.exec(line);
2613 if (match) return getLastPart(match[1]);
2614 return undefined;
2615};
2616
2617var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS
2618// identifiers, thus we only need to replace what is a valid character for JS,
2619// but not for CSS.
2620
2621var sanitizeIdentifier = function sanitizeIdentifier(identifier) {
2622 return identifier.replace(/\$/g, '-');
2623};
2624
2625var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {
2626 if (!stackTrace) return undefined;
2627 var lines = stackTrace.split('\n');
2628
2629 for (var i = 0; i < lines.length; i++) {
2630 var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error"
2631
2632 if (!functionName) continue; // If we reach one of these, we have gone too far and should quit
2633
2634 if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an
2635 // uppercase letter
2636
2637 if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName);
2638 }
2639
2640 return undefined;
2641};
2642
2643var isBrowser$1$1 = typeof document !== 'undefined';
2644var useInsertionEffect$2 = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : function useInsertionEffect(create) {
2645 create();
2646};
2647
2648function useInsertionEffectMaybe$1(create) {
2649 if (!isBrowser$1$1) {
2650 return create();
2651 }
2652
2653 useInsertionEffect$2(create);
2654}
2655
2656var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
2657var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
2658
2659var createEmotionProps = function createEmotionProps(type, props) {
2660 if (process.env.NODE_ENV !== 'production' && typeof props.css === 'string' && // check if there is a css declaration
2661 props.css.indexOf(':') !== -1) {
2662 throw new Error("Strings are not allowed as css prop values, please wrap it in a css template literal from '@emotion/react' like this: css`" + props.css + "`");
2663 }
2664
2665 var newProps = {};
2666
2667 for (var key in props) {
2668 if (hasOwnProperty$1.call(props, key)) {
2669 newProps[key] = props[key];
2670 }
2671 }
2672
2673 newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when
2674 // the label hasn't already been computed
2675
2676 if (process.env.NODE_ENV !== 'production' && !!props.css && (_typeof(props.css) !== 'object' || typeof props.css.name !== 'string' || props.css.name.indexOf('-') === -1)) {
2677 var label = getLabelFromStackTrace(new Error().stack);
2678 if (label) newProps[labelPropName] = label;
2679 }
2680
2681 return newProps;
2682};
2683
2684var Insertion$2 = function Insertion(_ref) {
2685 var cache = _ref.cache,
2686 serialized = _ref.serialized,
2687 isStringTag = _ref.isStringTag;
2688 registerStyles$1(cache, serialized, isStringTag);
2689 var rules = useInsertionEffectMaybe$1(function () {
2690 return insertStyles$1(cache, serialized, isStringTag);
2691 });
2692
2693 if (!isBrowser$4 && rules !== undefined) {
2694 var _ref2;
2695
2696 var serializedNames = serialized.name;
2697 var next = serialized.next;
2698
2699 while (next !== undefined) {
2700 serializedNames += ' ' + next.name;
2701 next = next.next;
2702 }
2703
2704 return /*#__PURE__*/createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
2705 __html: rules
2706 }, _ref2.nonce = cache.sheet.nonce, _ref2));
2707 }
2708
2709 return null;
2710};
2711
2712var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
2713 var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works
2714 // not passing the registered cache to serializeStyles because it would
2715 // make certain babel optimisations not possible
2716
2717 if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {
2718 cssProp = cache.registered[cssProp];
2719 }
2720
2721 var WrappedComponent = props[typePropName];
2722 var registeredStyles = [cssProp];
2723 var className = '';
2724
2725 if (typeof props.className === 'string') {
2726 className = getRegisteredStyles$1(cache.registered, registeredStyles, props.className);
2727 } else if (props.className != null) {
2728 className = props.className + " ";
2729 }
2730
2731 var serialized = serializeStyles$1(registeredStyles, undefined, useContext(ThemeContext));
2732
2733 if (process.env.NODE_ENV !== 'production' && serialized.name.indexOf('-') === -1) {
2734 var labelFromStack = props[labelPropName];
2735
2736 if (labelFromStack) {
2737 serialized = serializeStyles$1([serialized, 'label:' + labelFromStack + ';']);
2738 }
2739 }
2740
2741 className += cache.key + "-" + serialized.name;
2742 var newProps = {};
2743
2744 for (var key in props) {
2745 if (hasOwnProperty$1.call(props, key) && key !== 'css' && key !== typePropName && (process.env.NODE_ENV === 'production' || key !== labelPropName)) {
2746 newProps[key] = props[key];
2747 }
2748 }
2749
2750 newProps.ref = ref;
2751 newProps.className = className;
2752 return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion$2, {
2753 cache: cache,
2754 serialized: serialized,
2755 isStringTag: typeof WrappedComponent === 'string'
2756 }), /*#__PURE__*/createElement(WrappedComponent, newProps));
2757});
2758
2759if (process.env.NODE_ENV !== 'production') {
2760 Emotion.displayName = 'EmotionCssPropInternal';
2761}
2762/*
2763
2764Based off glamor's StyleSheet, thanks Sunil ❤️
2765
2766high performance StyleSheet for css-in-js systems
2767
2768- uses multiple style tags behind the scenes for millions of rules
2769- uses `insertRule` for appending in production for *much* faster performance
2770
2771// usage
2772
2773import { StyleSheet } from '@emotion/sheet'
2774
2775let styleSheet = new StyleSheet({ key: '', container: document.head })
2776
2777styleSheet.insert('#box { border: 1px solid red; }')
2778- appends a css rule into the stylesheet
2779
2780styleSheet.flush()
2781- empties the stylesheet of all its contents
2782
2783*/
2784// $FlowFixMe
2785
2786
2787function sheetForTag(tag) {
2788 if (tag.sheet) {
2789 // $FlowFixMe
2790 return tag.sheet;
2791 } // this weirdness brought to you by firefox
2792
2793 /* istanbul ignore next */
2794
2795
2796 for (var i = 0; i < document.styleSheets.length; i++) {
2797 if (document.styleSheets[i].ownerNode === tag) {
2798 // $FlowFixMe
2799 return document.styleSheets[i];
2800 }
2801 }
2802}
2803
2804function createStyleElement(options) {
2805 var tag = document.createElement('style');
2806 tag.setAttribute('data-emotion', options.key);
2807
2808 if (options.nonce !== undefined) {
2809 tag.setAttribute('nonce', options.nonce);
2810 }
2811
2812 tag.appendChild(document.createTextNode(''));
2813 tag.setAttribute('data-s', '');
2814 return tag;
2815}
2816
2817var StyleSheet = /*#__PURE__*/function () {
2818 function StyleSheet(options) {
2819 var _this = this;
2820
2821 this._insertTag = function (tag) {
2822 var before;
2823
2824 if (_this.tags.length === 0) {
2825 if (_this.insertionPoint) {
2826 before = _this.insertionPoint.nextSibling;
2827 } else if (_this.prepend) {
2828 before = _this.container.firstChild;
2829 } else {
2830 before = _this.before;
2831 }
2832 } else {
2833 before = _this.tags[_this.tags.length - 1].nextSibling;
2834 }
2835
2836 _this.container.insertBefore(tag, before);
2837
2838 _this.tags.push(tag);
2839 };
2840
2841 this.isSpeedy = options.speedy === undefined ? process.env.NODE_ENV === 'production' : options.speedy;
2842 this.tags = [];
2843 this.ctr = 0;
2844 this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
2845
2846 this.key = options.key;
2847 this.container = options.container;
2848 this.prepend = options.prepend;
2849 this.insertionPoint = options.insertionPoint;
2850 this.before = null;
2851 }
2852
2853 var _proto = StyleSheet.prototype;
2854
2855 _proto.hydrate = function hydrate(nodes) {
2856 nodes.forEach(this._insertTag);
2857 };
2858
2859 _proto.insert = function insert(rule) {
2860 // the max length is how many rules we have per style tag, it's 65000 in speedy mode
2861 // it's 1 in dev because we insert source maps that map a single rule to a location
2862 // and you can only have one source map per style tag
2863 if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
2864 this._insertTag(createStyleElement(this));
2865 }
2866
2867 var tag = this.tags[this.tags.length - 1];
2868
2869 if (process.env.NODE_ENV !== 'production') {
2870 var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105;
2871
2872 if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) {
2873 // this would only cause problem in speedy mode
2874 // but we don't want enabling speedy to affect the observable behavior
2875 // so we report this error at all times
2876 console.error("You're attempting to insert the following rule:\n" + rule + '\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.');
2877 }
2878
2879 this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule;
2880 }
2881
2882 if (this.isSpeedy) {
2883 var sheet = sheetForTag(tag);
2884
2885 try {
2886 // this is the ultrafast version, works across browsers
2887 // the big drawback is that the css won't be editable in devtools
2888 sheet.insertRule(rule, sheet.cssRules.length);
2889 } catch (e) {
2890 if (process.env.NODE_ENV !== 'production' && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear){/.test(rule)) {
2891 console.error("There was a problem inserting the following rule: \"" + rule + "\"", e);
2892 }
2893 }
2894 } else {
2895 tag.appendChild(document.createTextNode(rule));
2896 }
2897
2898 this.ctr++;
2899 };
2900
2901 _proto.flush = function flush() {
2902 // $FlowFixMe
2903 this.tags.forEach(function (tag) {
2904 return tag.parentNode && tag.parentNode.removeChild(tag);
2905 });
2906 this.tags = [];
2907 this.ctr = 0;
2908
2909 if (process.env.NODE_ENV !== 'production') {
2910 this._alreadyInsertedOrderInsensitiveRule = false;
2911 }
2912 };
2913
2914 return StyleSheet;
2915}();
2916
2917var pkg = {
2918 name: "@emotion/react",
2919 version: "11.8.1",
2920 main: "dist/emotion-react.cjs.js",
2921 module: "dist/emotion-react.esm.js",
2922 browser: {
2923 "./dist/emotion-react.cjs.js": "./dist/emotion-react.browser.cjs.js",
2924 "./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js"
2925 },
2926 types: "types/index.d.ts",
2927 files: ["src", "dist", "jsx-runtime", "jsx-dev-runtime", "_isolated-hnrs", "types/*.d.ts", "macro.js", "macro.d.ts", "macro.js.flow"],
2928 sideEffects: false,
2929 author: "Emotion Contributors",
2930 license: "MIT",
2931 scripts: {
2932 "test:typescript": "dtslint types"
2933 },
2934 dependencies: {
2935 "@babel/runtime": "^7.13.10",
2936 "@emotion/babel-plugin": "^11.7.1",
2937 "@emotion/cache": "^11.7.1",
2938 "@emotion/serialize": "^1.0.2",
2939 "@emotion/sheet": "^1.1.0",
2940 "@emotion/utils": "^1.1.0",
2941 "@emotion/weak-memoize": "^0.2.5",
2942 "hoist-non-react-statics": "^3.3.1"
2943 },
2944 peerDependencies: {
2945 "@babel/core": "^7.0.0",
2946 react: ">=16.8.0"
2947 },
2948 peerDependenciesMeta: {
2949 "@babel/core": {
2950 optional: true
2951 },
2952 "@types/react": {
2953 optional: true
2954 }
2955 },
2956 devDependencies: {
2957 "@babel/core": "^7.13.10",
2958 "@emotion/css": "11.7.1",
2959 "@emotion/css-prettifier": "1.0.1",
2960 "@emotion/server": "11.4.0",
2961 "@emotion/styled": "11.8.1",
2962 "@types/react": "^16.9.11",
2963 dtslint: "^0.3.0",
2964 "html-tag-names": "^1.1.2",
2965 react: "16.14.0",
2966 "svg-tag-names": "^1.1.1"
2967 },
2968 repository: "https://github.com/emotion-js/emotion/tree/main/packages/react",
2969 publishConfig: {
2970 access: "public"
2971 },
2972 "umd:main": "dist/emotion-react.umd.min.js",
2973 preconstruct: {
2974 entrypoints: ["./index.js", "./jsx-runtime.js", "./jsx-dev-runtime.js", "./_isolated-hnrs.js"],
2975 umdName: "emotionReact"
2976 }
2977};
2978
2979var jsx = function jsx(type, props) {
2980 var args = arguments;
2981
2982 if (props == null || !hasOwnProperty$1.call(props, 'css')) {
2983 // $FlowFixMe
2984 return createElement.apply(undefined, args);
2985 }
2986
2987 var argsLength = args.length;
2988 var createElementArgArray = new Array(argsLength);
2989 createElementArgArray[0] = Emotion;
2990 createElementArgArray[1] = createEmotionProps(type, props);
2991
2992 for (var i = 2; i < argsLength; i++) {
2993 createElementArgArray[i] = args[i];
2994 } // $FlowFixMe
2995
2996
2997 return createElement.apply(null, createElementArgArray);
2998};
2999
3000var useInsertionEffect$1 = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : useLayoutEffect;
3001var warnedAboutCssPropForGlobal = false; // maintain place over rerenders.
3002// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
3003// initial client-side render from SSR, use place of hydrating tag
3004
3005var Global$1 = /* #__PURE__ */withEmotionCache(function (props, cache) {
3006 if (process.env.NODE_ENV !== 'production' && !warnedAboutCssPropForGlobal && ( // check for className as well since the user is
3007 // probably using the custom createElement which
3008 // means it will be turned into a className prop
3009 // $FlowFixMe I don't really want to add it to the type since it shouldn't be used
3010 props.className || props.css)) {
3011 console.error("It looks like you're using the css prop on Global, did you mean to use the styles prop instead?");
3012 warnedAboutCssPropForGlobal = true;
3013 }
3014
3015 var styles = props.styles;
3016 var serialized = serializeStyles$1([styles], undefined, useContext(ThemeContext));
3017
3018 if (!isBrowser$4) {
3019 var _ref;
3020
3021 var serializedNames = serialized.name;
3022 var serializedStyles = serialized.styles;
3023 var next = serialized.next;
3024
3025 while (next !== undefined) {
3026 serializedNames += ' ' + next.name;
3027 serializedStyles += next.styles;
3028 next = next.next;
3029 }
3030
3031 var shouldCache = cache.compat === true;
3032 var rules = cache.insert("", {
3033 name: serializedNames,
3034 styles: serializedStyles
3035 }, cache.sheet, shouldCache);
3036
3037 if (shouldCache) {
3038 return null;
3039 }
3040
3041 return /*#__PURE__*/createElement("style", (_ref = {}, _ref["data-emotion"] = cache.key + "-global " + serializedNames, _ref.dangerouslySetInnerHTML = {
3042 __html: rules
3043 }, _ref.nonce = cache.sheet.nonce, _ref));
3044 } // yes, i know these hooks are used conditionally
3045 // but it is based on a constant that will never change at runtime
3046 // it's effectively like having two implementations and switching them out
3047 // so it's not actually breaking anything
3048
3049
3050 var sheetRef = useRef();
3051 useInsertionEffect$1(function () {
3052 var key = cache.key + "-global";
3053 var sheet = new StyleSheet({
3054 key: key,
3055 nonce: cache.sheet.nonce,
3056 container: cache.sheet.container,
3057 speedy: cache.sheet.isSpeedy
3058 });
3059 var rehydrating = false; // $FlowFixMe
3060
3061 var node = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]");
3062
3063 if (cache.sheet.tags.length) {
3064 sheet.before = cache.sheet.tags[0];
3065 }
3066
3067 if (node !== null) {
3068 rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s
3069
3070 node.setAttribute('data-emotion', key);
3071 sheet.hydrate([node]);
3072 }
3073
3074 sheetRef.current = [sheet, rehydrating];
3075 return function () {
3076 sheet.flush();
3077 };
3078 }, [cache]);
3079 useInsertionEffect$1(function () {
3080 var sheetRefCurrent = sheetRef.current;
3081 var sheet = sheetRefCurrent[0],
3082 rehydrating = sheetRefCurrent[1];
3083
3084 if (rehydrating) {
3085 sheetRefCurrent[1] = false;
3086 return;
3087 }
3088
3089 if (serialized.next !== undefined) {
3090 // insert keyframes
3091 insertStyles$1(cache, serialized.next, true);
3092 }
3093
3094 if (sheet.tags.length) {
3095 // if this doesn't exist then it will be null so the style element will be appended
3096 var element = sheet.tags[sheet.tags.length - 1].nextElementSibling;
3097 sheet.before = element;
3098 sheet.flush();
3099 }
3100
3101 cache.insert("", serialized, sheet, false);
3102 }, [cache, serialized.name]);
3103 return null;
3104});
3105
3106if (process.env.NODE_ENV !== 'production') {
3107 Global$1.displayName = 'EmotionGlobal';
3108}
3109
3110function css() {
3111 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3112 args[_key] = arguments[_key];
3113 }
3114
3115 return serializeStyles$1(args);
3116}
3117
3118var keyframes = function keyframes() {
3119 var insertable = css.apply(void 0, arguments);
3120 var name = "animation-" + insertable.name; // $FlowFixMe
3121
3122 return {
3123 name: name,
3124 styles: "@keyframes " + name + "{" + insertable.styles + "}",
3125 anim: 1,
3126 toString: function toString() {
3127 return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
3128 }
3129 };
3130};
3131
3132var classnames = function classnames(args) {
3133 var len = args.length;
3134 var i = 0;
3135 var cls = '';
3136
3137 for (; i < len; i++) {
3138 var arg = args[i];
3139 if (arg == null) continue;
3140 var toAdd = void 0;
3141
3142 switch (_typeof(arg)) {
3143 case 'boolean':
3144 break;
3145
3146 case 'object':
3147 {
3148 if (Array.isArray(arg)) {
3149 toAdd = classnames(arg);
3150 } else {
3151 if (process.env.NODE_ENV !== 'production' && arg.styles !== undefined && arg.name !== undefined) {
3152 console.error('You have passed styles created with `css` from `@emotion/react` package to the `cx`.\n' + '`cx` is meant to compose class names (strings) so you should convert those styles to a class name by passing them to the `css` received from <ClassNames/> component.');
3153 }
3154
3155 toAdd = '';
3156
3157 for (var k in arg) {
3158 if (arg[k] && k) {
3159 toAdd && (toAdd += ' ');
3160 toAdd += k;
3161 }
3162 }
3163 }
3164
3165 break;
3166 }
3167
3168 default:
3169 {
3170 toAdd = arg;
3171 }
3172 }
3173
3174 if (toAdd) {
3175 cls && (cls += ' ');
3176 cls += toAdd;
3177 }
3178 }
3179
3180 return cls;
3181};
3182
3183function merge(registered, css, className) {
3184 var registeredStyles = [];
3185 var rawClassName = getRegisteredStyles$1(registered, registeredStyles, className);
3186
3187 if (registeredStyles.length < 2) {
3188 return className;
3189 }
3190
3191 return rawClassName + css(registeredStyles);
3192}
3193
3194var Insertion$1 = function Insertion(_ref) {
3195 var cache = _ref.cache,
3196 serializedArr = _ref.serializedArr;
3197 var rules = useInsertionEffectMaybe$1(function () {
3198 var rules = '';
3199
3200 for (var i = 0; i < serializedArr.length; i++) {
3201 var res = insertStyles$1(cache, serializedArr[i], false);
3202
3203 if (!isBrowser$4 && res !== undefined) {
3204 rules += res;
3205 }
3206 }
3207
3208 if (!isBrowser$4) {
3209 return rules;
3210 }
3211 });
3212
3213 if (!isBrowser$4 && rules.length !== 0) {
3214 var _ref2;
3215
3216 return /*#__PURE__*/createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedArr.map(function (serialized) {
3217 return serialized.name;
3218 }).join(' '), _ref2.dangerouslySetInnerHTML = {
3219 __html: rules
3220 }, _ref2.nonce = cache.sheet.nonce, _ref2));
3221 }
3222
3223 return null;
3224};
3225
3226var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
3227 var hasRendered = false;
3228 var serializedArr = [];
3229
3230 var css = function css() {
3231 if (hasRendered && process.env.NODE_ENV !== 'production') {
3232 throw new Error('css can only be used during render');
3233 }
3234
3235 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3236 args[_key] = arguments[_key];
3237 }
3238
3239 var serialized = serializeStyles$1(args, cache.registered);
3240 serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`
3241
3242 registerStyles$1(cache, serialized, false);
3243 return cache.key + "-" + serialized.name;
3244 };
3245
3246 var cx = function cx() {
3247 if (hasRendered && process.env.NODE_ENV !== 'production') {
3248 throw new Error('cx can only be used during render');
3249 }
3250
3251 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
3252 args[_key2] = arguments[_key2];
3253 }
3254
3255 return merge(cache.registered, css, classnames(args));
3256 };
3257
3258 var content = {
3259 css: css,
3260 cx: cx,
3261 theme: useContext(ThemeContext)
3262 };
3263 var ele = props.children(content);
3264 hasRendered = true;
3265 return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion$1, {
3266 cache: cache,
3267 serializedArr: serializedArr
3268 }), ele);
3269});
3270
3271if (process.env.NODE_ENV !== 'production') {
3272 ClassNames.displayName = 'EmotionClassNames';
3273}
3274
3275if (process.env.NODE_ENV !== 'production') {
3276 var isBrowser$3 = typeof document !== 'undefined'; // #1727 for some reason Jest evaluates modules twice if some consuming module gets mocked with jest.mock
3277
3278 var isJest = typeof jest !== 'undefined';
3279
3280 if (isBrowser$3 && !isJest) {
3281 // globalThis has wide browser support - https://caniuse.com/?search=globalThis, Node.js 12 and later
3282 var globalContext = // $FlowIgnore
3283 typeof globalThis !== 'undefined' ? globalThis // eslint-disable-line no-undef
3284 : isBrowser$3 ? window : global;
3285 var globalKey = "__EMOTION_REACT_" + pkg.version.split('.')[0] + "__";
3286
3287 if (globalContext[globalKey]) {
3288 console.warn('You are loading @emotion/react when it is already loaded. Running ' + 'multiple instances may cause problems. This can happen if multiple ' + 'versions are used, or if multiple builds of the same version are ' + 'used.');
3289 }
3290
3291 globalContext[globalKey] = true;
3292 }
3293}
3294
3295var isBrowser$2 = typeof document !== 'undefined';
3296
3297function getRegisteredStyles(registered, registeredStyles, classNames) {
3298 var rawClassName = '';
3299 classNames.split(' ').forEach(function (className) {
3300 if (registered[className] !== undefined) {
3301 registeredStyles.push(registered[className] + ";");
3302 } else {
3303 rawClassName += className + " ";
3304 }
3305 });
3306 return rawClassName;
3307}
3308
3309var registerStyles = function registerStyles(cache, serialized, isStringTag) {
3310 var className = cache.key + "-" + serialized.name;
3311
3312 if ( // we only need to add the styles to the registered cache if the
3313 // class name could be used further down
3314 // the tree but if it's a string tag, we know it won't
3315 // so we don't have to add it to registered cache.
3316 // this improves memory usage since we can avoid storing the whole style string
3317 (isStringTag === false || // we need to always store it if we're in compat mode and
3318 // in node since emotion-server relies on whether a style is in
3319 // the registered cache to know whether a style is global or not
3320 // also, note that this check will be dead code eliminated in the browser
3321 isBrowser$2 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
3322 cache.registered[className] = serialized.styles;
3323 }
3324};
3325
3326var insertStyles = function insertStyles(cache, serialized, isStringTag) {
3327 registerStyles(cache, serialized, isStringTag);
3328 var className = cache.key + "-" + serialized.name;
3329
3330 if (cache.inserted[serialized.name] === undefined) {
3331 var stylesForSSR = '';
3332 var current = serialized;
3333
3334 do {
3335 var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
3336
3337 if (!isBrowser$2 && maybeStyles !== undefined) {
3338 stylesForSSR += maybeStyles;
3339 }
3340
3341 current = current.next;
3342 } while (current !== undefined);
3343
3344 if (!isBrowser$2 && stylesForSSR.length !== 0) {
3345 return stylesForSSR;
3346 }
3347 }
3348};
3349
3350var ILLEGAL_ESCAPE_SEQUENCE_ERROR$1 = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
3351var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).";
3352var hyphenateRegex = /[A-Z]|^ms/g;
3353var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
3354
3355var isCustomProperty = function isCustomProperty(property) {
3356 return property.charCodeAt(1) === 45;
3357};
3358
3359var isProcessableValue = function isProcessableValue(value) {
3360 return value != null && typeof value !== 'boolean';
3361};
3362
3363var processStyleName = /* #__PURE__ */memoize(function (styleName) {
3364 return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();
3365});
3366
3367var processStyleValue = function processStyleValue(key, value) {
3368 switch (key) {
3369 case 'animation':
3370 case 'animationName':
3371 {
3372 if (typeof value === 'string') {
3373 return value.replace(animationRegex, function (match, p1, p2) {
3374 cursor = {
3375 name: p1,
3376 styles: p2,
3377 next: cursor
3378 };
3379 return p1;
3380 });
3381 }
3382 }
3383 }
3384
3385 if (unitlessKeys[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {
3386 return value + 'px';
3387 }
3388
3389 return value;
3390};
3391
3392if (process.env.NODE_ENV !== 'production') {
3393 var contentValuePattern = /(attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
3394 var contentValues = ['normal', 'none', 'initial', 'inherit', 'unset'];
3395 var oldProcessStyleValue = processStyleValue;
3396 var msPattern = /^-ms-/;
3397 var hyphenPattern = /-(.)/g;
3398 var hyphenatedCache = {};
3399
3400 processStyleValue = function processStyleValue(key, value) {
3401 if (key === 'content') {
3402 if (typeof value !== 'string' || contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '"' && value.charAt(0) !== "'")) {
3403 throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
3404 }
3405 }
3406
3407 var processed = oldProcessStyleValue(key, value);
3408
3409 if (processed !== '' && !isCustomProperty(key) && key.indexOf('-') !== -1 && hyphenatedCache[key] === undefined) {
3410 hyphenatedCache[key] = true;
3411 console.error("Using kebab-case for css properties in objects is not supported. Did you mean " + key.replace(msPattern, 'ms-').replace(hyphenPattern, function (str, _char) {
3412 return _char.toUpperCase();
3413 }) + "?");
3414 }
3415
3416 return processed;
3417 };
3418}
3419
3420function handleInterpolation(mergedProps, registered, interpolation) {
3421 if (interpolation == null) {
3422 return '';
3423 }
3424
3425 if (interpolation.__emotion_styles !== undefined) {
3426 if (process.env.NODE_ENV !== 'production' && interpolation.toString() === 'NO_COMPONENT_SELECTOR') {
3427 throw new Error('Component selectors can only be used in conjunction with @emotion/babel-plugin.');
3428 }
3429
3430 return interpolation;
3431 }
3432
3433 switch (_typeof(interpolation)) {
3434 case 'boolean':
3435 {
3436 return '';
3437 }
3438
3439 case 'object':
3440 {
3441 if (interpolation.anim === 1) {
3442 cursor = {
3443 name: interpolation.name,
3444 styles: interpolation.styles,
3445 next: cursor
3446 };
3447 return interpolation.name;
3448 }
3449
3450 if (interpolation.styles !== undefined) {
3451 var next = interpolation.next;
3452
3453 if (next !== undefined) {
3454 // not the most efficient thing ever but this is a pretty rare case
3455 // and there will be very few iterations of this generally
3456 while (next !== undefined) {
3457 cursor = {
3458 name: next.name,
3459 styles: next.styles,
3460 next: cursor
3461 };
3462 next = next.next;
3463 }
3464 }
3465
3466 var styles = interpolation.styles + ";";
3467
3468 if (process.env.NODE_ENV !== 'production' && interpolation.map !== undefined) {
3469 styles += interpolation.map;
3470 }
3471
3472 return styles;
3473 }
3474
3475 return createStringFromObject(mergedProps, registered, interpolation);
3476 }
3477
3478 case 'function':
3479 {
3480 if (mergedProps !== undefined) {
3481 var previousCursor = cursor;
3482 var result = interpolation(mergedProps);
3483 cursor = previousCursor;
3484 return handleInterpolation(mergedProps, registered, result);
3485 } else if (process.env.NODE_ENV !== 'production') {
3486 console.error('Functions that are interpolated in css calls will be stringified.\n' + 'If you want to have a css call based on props, create a function that returns a css call like this\n' + 'let dynamicStyle = (props) => css`color: ${props.color}`\n' + 'It can be called directly with props or interpolated in a styled call like this\n' + "let SomeComponent = styled('div')`${dynamicStyle}`");
3487 }
3488
3489 break;
3490 }
3491
3492 case 'string':
3493 if (process.env.NODE_ENV !== 'production') {
3494 var matched = [];
3495 var replaced = interpolation.replace(animationRegex, function (match, p1, p2) {
3496 var fakeVarName = "animation" + matched.length;
3497 matched.push("const " + fakeVarName + " = keyframes`" + p2.replace(/^@keyframes animation-\w+/, '') + "`");
3498 return "${" + fakeVarName + "}";
3499 });
3500
3501 if (matched.length) {
3502 console.error('`keyframes` output got interpolated into plain string, please wrap it with `css`.\n\n' + 'Instead of doing this:\n\n' + [].concat(matched, ["`" + replaced + "`"]).join('\n') + '\n\nYou should wrap it with `css` like this:\n\n' + ("css`" + replaced + "`"));
3503 }
3504 }
3505
3506 break;
3507 } // finalize string values (regular strings and functions interpolated into css calls)
3508
3509
3510 if (registered == null) {
3511 return interpolation;
3512 }
3513
3514 var cached = registered[interpolation];
3515 return cached !== undefined ? cached : interpolation;
3516}
3517
3518function createStringFromObject(mergedProps, registered, obj) {
3519 var string = '';
3520
3521 if (Array.isArray(obj)) {
3522 for (var i = 0; i < obj.length; i++) {
3523 string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
3524 }
3525 } else {
3526 for (var _key in obj) {
3527 var value = obj[_key];
3528
3529 if (_typeof(value) !== 'object') {
3530 if (registered != null && registered[value] !== undefined) {
3531 string += _key + "{" + registered[value] + "}";
3532 } else if (isProcessableValue(value)) {
3533 string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";";
3534 }
3535 } else {
3536 if (_key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') {
3537 throw new Error('Component selectors can only be used in conjunction with @emotion/babel-plugin.');
3538 }
3539
3540 if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
3541 for (var _i = 0; _i < value.length; _i++) {
3542 if (isProcessableValue(value[_i])) {
3543 string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";";
3544 }
3545 }
3546 } else {
3547 var interpolated = handleInterpolation(mergedProps, registered, value);
3548
3549 switch (_key) {
3550 case 'animation':
3551 case 'animationName':
3552 {
3553 string += processStyleName(_key) + ":" + interpolated + ";";
3554 break;
3555 }
3556
3557 default:
3558 {
3559 if (process.env.NODE_ENV !== 'production' && _key === 'undefined') {
3560 console.error(UNDEFINED_AS_OBJECT_KEY_ERROR);
3561 }
3562
3563 string += _key + "{" + interpolated + "}";
3564 }
3565 }
3566 }
3567 }
3568 }
3569 }
3570
3571 return string;
3572}
3573
3574var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g;
3575var sourceMapPattern;
3576
3577if (process.env.NODE_ENV !== 'production') {
3578 sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
3579} // this is the cursor for keyframes
3580// keyframes are stored on the SerializedStyles object as a linked list
3581
3582
3583var cursor;
3584
3585var serializeStyles = function serializeStyles(args, registered, mergedProps) {
3586 if (args.length === 1 && _typeof(args[0]) === 'object' && args[0] !== null && args[0].styles !== undefined) {
3587 return args[0];
3588 }
3589
3590 var stringMode = true;
3591 var styles = '';
3592 cursor = undefined;
3593 var strings = args[0];
3594
3595 if (strings == null || strings.raw === undefined) {
3596 stringMode = false;
3597 styles += handleInterpolation(mergedProps, registered, strings);
3598 } else {
3599 if (process.env.NODE_ENV !== 'production' && strings[0] === undefined) {
3600 console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR$1);
3601 }
3602
3603 styles += strings[0];
3604 } // we start at 1 since we've already handled the first arg
3605
3606
3607 for (var i = 1; i < args.length; i++) {
3608 styles += handleInterpolation(mergedProps, registered, args[i]);
3609
3610 if (stringMode) {
3611 if (process.env.NODE_ENV !== 'production' && strings[i] === undefined) {
3612 console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR$1);
3613 }
3614
3615 styles += strings[i];
3616 }
3617 }
3618
3619 var sourceMap;
3620
3621 if (process.env.NODE_ENV !== 'production') {
3622 styles = styles.replace(sourceMapPattern, function (match) {
3623 sourceMap = match;
3624 return '';
3625 });
3626 } // using a global regex with .exec is stateful so lastIndex has to be reset each time
3627
3628
3629 labelPattern.lastIndex = 0;
3630 var identifierName = '';
3631 var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
3632
3633 while ((match = labelPattern.exec(styles)) !== null) {
3634 identifierName += '-' + // $FlowFixMe we know it's not null
3635 match[1];
3636 }
3637
3638 var name = murmur2(styles) + identifierName;
3639
3640 if (process.env.NODE_ENV !== 'production') {
3641 // $FlowFixMe SerializedStyles type doesn't have toString property (and we don't want to add it)
3642 return {
3643 name: name,
3644 styles: styles,
3645 map: sourceMap,
3646 next: cursor,
3647 toString: function toString() {
3648 return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
3649 }
3650 };
3651 }
3652
3653 return {
3654 name: name,
3655 styles: styles,
3656 next: cursor
3657 };
3658};
3659
3660var testOmitPropsOnStringTag = isPropValid;
3661
3662var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) {
3663 return key !== 'theme';
3664};
3665
3666var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) {
3667 return typeof tag === 'string' && // 96 is one less than the char code
3668 // for "a" so this is checking that
3669 // it's a lowercase character
3670 tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent;
3671};
3672
3673var composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) {
3674 var shouldForwardProp;
3675
3676 if (options) {
3677 var optionsShouldForwardProp = options.shouldForwardProp;
3678 shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) {
3679 return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName);
3680 } : optionsShouldForwardProp;
3681 }
3682
3683 if (typeof shouldForwardProp !== 'function' && isReal) {
3684 shouldForwardProp = tag.__emotion_forwardProp;
3685 }
3686
3687 return shouldForwardProp;
3688};
3689
3690var isBrowser = typeof document !== 'undefined';
3691var useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : function useInsertionEffect(create) {
3692 create();
3693};
3694
3695function useInsertionEffectMaybe(create) {
3696 if (!isBrowser) {
3697 return create();
3698 }
3699
3700 useInsertionEffect(create);
3701}
3702
3703var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
3704var isBrowser$1 = typeof document !== 'undefined';
3705
3706var Insertion = function Insertion(_ref) {
3707 var cache = _ref.cache,
3708 serialized = _ref.serialized,
3709 isStringTag = _ref.isStringTag;
3710 registerStyles(cache, serialized, isStringTag);
3711 var rules = useInsertionEffectMaybe(function () {
3712 return insertStyles(cache, serialized, isStringTag);
3713 });
3714
3715 if (!isBrowser$1 && rules !== undefined) {
3716 var _ref2;
3717
3718 var serializedNames = serialized.name;
3719 var next = serialized.next;
3720
3721 while (next !== undefined) {
3722 serializedNames += ' ' + next.name;
3723 next = next.next;
3724 }
3725
3726 return /*#__PURE__*/createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
3727 __html: rules
3728 }, _ref2.nonce = cache.sheet.nonce, _ref2));
3729 }
3730
3731 return null;
3732};
3733
3734var createStyled = function createStyled(tag, options) {
3735 if (process.env.NODE_ENV !== 'production') {
3736 if (tag === undefined) {
3737 throw new Error('You are trying to create a styled element with an undefined component.\nYou may have forgotten to import it.');
3738 }
3739 }
3740
3741 var isReal = tag.__emotion_real === tag;
3742 var baseTag = isReal && tag.__emotion_base || tag;
3743 var identifierName;
3744 var targetClassName;
3745
3746 if (options !== undefined) {
3747 identifierName = options.label;
3748 targetClassName = options.target;
3749 }
3750
3751 var shouldForwardProp = composeShouldForwardProps(tag, options, isReal);
3752 var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag);
3753 var shouldUseAs = !defaultShouldForwardProp('as');
3754 return function () {
3755 var args = arguments;
3756 var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : [];
3757
3758 if (identifierName !== undefined) {
3759 styles.push("label:" + identifierName + ";");
3760 }
3761
3762 if (args[0] == null || args[0].raw === undefined) {
3763 styles.push.apply(styles, args);
3764 } else {
3765 if (process.env.NODE_ENV !== 'production' && args[0][0] === undefined) {
3766 console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
3767 }
3768
3769 styles.push(args[0][0]);
3770 var len = args.length;
3771 var i = 1;
3772
3773 for (; i < len; i++) {
3774 if (process.env.NODE_ENV !== 'production' && args[0][i] === undefined) {
3775 console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
3776 }
3777
3778 styles.push(args[i], args[0][i]);
3779 }
3780 } // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class
3781
3782
3783 var Styled = withEmotionCache(function (props, cache, ref) {
3784 var FinalTag = shouldUseAs && props.as || baseTag;
3785 var className = '';
3786 var classInterpolations = [];
3787 var mergedProps = props;
3788
3789 if (props.theme == null) {
3790 mergedProps = {};
3791
3792 for (var key in props) {
3793 mergedProps[key] = props[key];
3794 }
3795
3796 mergedProps.theme = useContext(ThemeContext);
3797 }
3798
3799 if (typeof props.className === 'string') {
3800 className = getRegisteredStyles(cache.registered, classInterpolations, props.className);
3801 } else if (props.className != null) {
3802 className = props.className + " ";
3803 }
3804
3805 var serialized = serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps);
3806 className += cache.key + "-" + serialized.name;
3807
3808 if (targetClassName !== undefined) {
3809 className += " " + targetClassName;
3810 }
3811
3812 var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp;
3813 var newProps = {};
3814
3815 for (var _key in props) {
3816 if (shouldUseAs && _key === 'as') continue;
3817
3818 if ( // $FlowFixMe
3819 finalShouldForwardProp(_key)) {
3820 newProps[_key] = props[_key];
3821 }
3822 }
3823
3824 newProps.className = className;
3825 newProps.ref = ref;
3826 return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, {
3827 cache: cache,
3828 serialized: serialized,
3829 isStringTag: typeof FinalTag === 'string'
3830 }), /*#__PURE__*/createElement(FinalTag, newProps));
3831 });
3832 Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")";
3833 Styled.defaultProps = tag.defaultProps;
3834 Styled.__emotion_real = Styled;
3835 Styled.__emotion_base = baseTag;
3836 Styled.__emotion_styles = styles;
3837 Styled.__emotion_forwardProp = shouldForwardProp;
3838 Object.defineProperty(Styled, 'toString', {
3839 value: function value() {
3840 if (targetClassName === undefined && process.env.NODE_ENV !== 'production') {
3841 return 'NO_COMPONENT_SELECTOR';
3842 } // $FlowFixMe: coerce undefined to string
3843
3844
3845 return "." + targetClassName;
3846 }
3847 });
3848
3849 Styled.withComponent = function (nextTag, nextOptions) {
3850 return createStyled(nextTag, _extends$1({}, options, nextOptions, {
3851 shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true)
3852 })).apply(void 0, styles);
3853 };
3854
3855 return Styled;
3856 };
3857};
3858
3859var tags = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG
3860'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan'];
3861var newStyled = createStyled.bind();
3862tags.forEach(function (tagName) {
3863 // $FlowFixMe: we can ignore this because its exposed type is defined by the CreateStyled type
3864 newStyled[tagName] = newStyled(tagName);
3865});
3866
3867function _extends() {
3868 _extends = Object.assign || function (target) {
3869 for (var i = 1; i < arguments.length; i++) {
3870 var source = arguments[i];
3871
3872 for (var key in source) {
3873 if (Object.prototype.hasOwnProperty.call(source, key)) {
3874 target[key] = source[key];
3875 }
3876 }
3877 }
3878
3879 return target;
3880 };
3881
3882 return _extends.apply(this, arguments);
3883}
3884
3885function _assertThisInitialized(self) {
3886 if (self === void 0) {
3887 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3888 }
3889
3890 return self;
3891}
3892
3893function _setPrototypeOf(o, p) {
3894 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
3895 o.__proto__ = p;
3896 return o;
3897 };
3898
3899 return _setPrototypeOf(o, p);
3900}
3901
3902function _inheritsLoose(subClass, superClass) {
3903 subClass.prototype = Object.create(superClass.prototype);
3904 subClass.prototype.constructor = subClass;
3905
3906 _setPrototypeOf(subClass, superClass);
3907}
3908
3909function _getPrototypeOf(o) {
3910 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
3911 return o.__proto__ || Object.getPrototypeOf(o);
3912 };
3913 return _getPrototypeOf(o);
3914}
3915
3916function _isNativeFunction(fn) {
3917 return Function.toString.call(fn).indexOf("[native code]") !== -1;
3918}
3919
3920function _isNativeReflectConstruct() {
3921 if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3922 if (Reflect.construct.sham) return false;
3923 if (typeof Proxy === "function") return true;
3924
3925 try {
3926 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
3927 return true;
3928 } catch (e) {
3929 return false;
3930 }
3931}
3932
3933function _construct(Parent, args, Class) {
3934 if (_isNativeReflectConstruct()) {
3935 _construct = Reflect.construct;
3936 } else {
3937 _construct = function _construct(Parent, args, Class) {
3938 var a = [null];
3939 a.push.apply(a, args);
3940 var Constructor = Function.bind.apply(Parent, a);
3941 var instance = new Constructor();
3942 if (Class) _setPrototypeOf(instance, Class.prototype);
3943 return instance;
3944 };
3945 }
3946
3947 return _construct.apply(null, arguments);
3948}
3949
3950function _wrapNativeSuper(Class) {
3951 var _cache = typeof Map === "function" ? new Map() : undefined;
3952
3953 _wrapNativeSuper = function _wrapNativeSuper(Class) {
3954 if (Class === null || !_isNativeFunction(Class)) return Class;
3955
3956 if (typeof Class !== "function") {
3957 throw new TypeError("Super expression must either be null or a function");
3958 }
3959
3960 if (typeof _cache !== "undefined") {
3961 if (_cache.has(Class)) return _cache.get(Class);
3962
3963 _cache.set(Class, Wrapper);
3964 }
3965
3966 function Wrapper() {
3967 return _construct(Class, arguments, _getPrototypeOf(this).constructor);
3968 }
3969
3970 Wrapper.prototype = Object.create(Class.prototype, {
3971 constructor: {
3972 value: Wrapper,
3973 enumerable: false,
3974 writable: true,
3975 configurable: true
3976 }
3977 });
3978 return _setPrototypeOf(Wrapper, Class);
3979 };
3980
3981 return _wrapNativeSuper(Class);
3982}
3983/**
3984 * Parse errors.md and turn it into a simple hash of code: message
3985 * @private
3986 */
3987
3988
3989var ERRORS = {
3990 "1": "Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).\n\n",
3991 "2": "Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).\n\n",
3992 "3": "Passed an incorrect argument to a color function, please pass a string representation of a color.\n\n",
3993 "4": "Couldn't generate valid rgb string from %s, it returned %s.\n\n",
3994 "5": "Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.\n\n",
3995 "6": "Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).\n\n",
3996 "7": "Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).\n\n",
3997 "8": "Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.\n\n",
3998 "9": "Please provide a number of steps to the modularScale helper.\n\n",
3999 "10": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
4000 "11": "Invalid value passed as base to modularScale, expected number or em string but got \"%s\"\n\n",
4001 "12": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got \"%s\" instead.\n\n",
4002 "13": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got \"%s\" instead.\n\n",
4003 "14": "Passed invalid pixel value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
4004 "15": "Passed invalid base value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
4005 "16": "You must provide a template to this method.\n\n",
4006 "17": "You passed an unsupported selector state to this method.\n\n",
4007 "18": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
4008 "19": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
4009 "20": "expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
4010 "21": "expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
4011 "22": "expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
4012 "23": "fontFace expects a name of a font-family.\n\n",
4013 "24": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
4014 "25": "fontFace expects localFonts to be an array.\n\n",
4015 "26": "fontFace expects fileFormats to be an array.\n\n",
4016 "27": "radialGradient requries at least 2 color-stops to properly render.\n\n",
4017 "28": "Please supply a filename to retinaImage() as the first argument.\n\n",
4018 "29": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
4019 "30": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
4020 "31": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation\n\n",
4021 "32": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')\n\n",
4022 "33": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation\n\n",
4023 "34": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
4024 "35": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
4025 "36": "Property must be a string value.\n\n",
4026 "37": "Syntax Error at %s.\n\n",
4027 "38": "Formula contains a function that needs parentheses at %s.\n\n",
4028 "39": "Formula is missing closing parenthesis at %s.\n\n",
4029 "40": "Formula has too many closing parentheses at %s.\n\n",
4030 "41": "All values in a formula must have the same unit or be unitless.\n\n",
4031 "42": "Please provide a number of steps to the modularScale helper.\n\n",
4032 "43": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
4033 "44": "Invalid value passed as base to modularScale, expected number or em/rem string but got %s.\n\n",
4034 "45": "Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.\n\n",
4035 "46": "Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.\n\n",
4036 "47": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
4037 "48": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
4038 "49": "Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
4039 "50": "Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.\n\n",
4040 "51": "Expects the first argument object to have the properties prop, fromSize, and toSize.\n\n",
4041 "52": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
4042 "53": "fontFace expects localFonts to be an array.\n\n",
4043 "54": "fontFace expects fileFormats to be an array.\n\n",
4044 "55": "fontFace expects a name of a font-family.\n\n",
4045 "56": "linearGradient requries at least 2 color-stops to properly render.\n\n",
4046 "57": "radialGradient requries at least 2 color-stops to properly render.\n\n",
4047 "58": "Please supply a filename to retinaImage() as the first argument.\n\n",
4048 "59": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
4049 "60": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
4050 "61": "Property must be a string value.\n\n",
4051 "62": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
4052 "63": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
4053 "64": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.\n\n",
4054 "65": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').\n\n",
4055 "66": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.\n\n",
4056 "67": "You must provide a template to this method.\n\n",
4057 "68": "You passed an unsupported selector state to this method.\n\n",
4058 "69": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got %s instead.\n\n",
4059 "70": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got %s instead.\n\n",
4060 "71": "Passed invalid pixel value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
4061 "72": "Passed invalid base value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
4062 "73": "Please provide a valid CSS variable.\n\n",
4063 "74": "CSS variable not found and no default was provided.\n\n",
4064 "75": "important requires a valid style object, got a %s instead.\n\n",
4065 "76": "fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n\n",
4066 "77": "remToPx expects a value in \"rem\" but you provided it in \"%s\".\n\n",
4067 "78": "base must be set in \"px\" or \"%\" but you set it in \"%s\".\n"
4068};
4069/**
4070 * super basic version of sprintf
4071 * @private
4072 */
4073
4074function format() {
4075 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
4076 args[_key] = arguments[_key];
4077 }
4078
4079 var a = args[0];
4080 var b = [];
4081 var c;
4082
4083 for (c = 1; c < args.length; c += 1) {
4084 b.push(args[c]);
4085 }
4086
4087 b.forEach(function (d) {
4088 a = a.replace(/%[a-z]/, d);
4089 });
4090 return a;
4091}
4092/**
4093 * Create an error file out of errors.md for development and a simple web link to the full errors
4094 * in production mode.
4095 * @private
4096 */
4097
4098
4099var PolishedError = /*#__PURE__*/function (_Error) {
4100 _inheritsLoose(PolishedError, _Error);
4101
4102 function PolishedError(code) {
4103 var _this;
4104
4105 if (process.env.NODE_ENV === 'production') {
4106 _this = _Error.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + code + " for more information.") || this;
4107 } else {
4108 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
4109 args[_key2 - 1] = arguments[_key2];
4110 }
4111
4112 _this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;
4113 }
4114
4115 return _assertThisInitialized(_this);
4116 }
4117
4118 return PolishedError;
4119}( /*#__PURE__*/_wrapNativeSuper(Error));
4120
4121function colorToInt(color) {
4122 return Math.round(color * 255);
4123}
4124
4125function convertToInt(red, green, blue) {
4126 return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue);
4127}
4128
4129function hslToRgb(hue, saturation, lightness, convert) {
4130 if (convert === void 0) {
4131 convert = convertToInt;
4132 }
4133
4134 if (saturation === 0) {
4135 // achromatic
4136 return convert(lightness, lightness, lightness);
4137 } // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
4138
4139
4140 var huePrime = (hue % 360 + 360) % 360 / 60;
4141 var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
4142 var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
4143 var red = 0;
4144 var green = 0;
4145 var blue = 0;
4146
4147 if (huePrime >= 0 && huePrime < 1) {
4148 red = chroma;
4149 green = secondComponent;
4150 } else if (huePrime >= 1 && huePrime < 2) {
4151 red = secondComponent;
4152 green = chroma;
4153 } else if (huePrime >= 2 && huePrime < 3) {
4154 green = chroma;
4155 blue = secondComponent;
4156 } else if (huePrime >= 3 && huePrime < 4) {
4157 green = secondComponent;
4158 blue = chroma;
4159 } else if (huePrime >= 4 && huePrime < 5) {
4160 red = secondComponent;
4161 blue = chroma;
4162 } else if (huePrime >= 5 && huePrime < 6) {
4163 red = chroma;
4164 blue = secondComponent;
4165 }
4166
4167 var lightnessModification = lightness - chroma / 2;
4168 var finalRed = red + lightnessModification;
4169 var finalGreen = green + lightnessModification;
4170 var finalBlue = blue + lightnessModification;
4171 return convert(finalRed, finalGreen, finalBlue);
4172}
4173
4174var namedColorMap = {
4175 aliceblue: 'f0f8ff',
4176 antiquewhite: 'faebd7',
4177 aqua: '00ffff',
4178 aquamarine: '7fffd4',
4179 azure: 'f0ffff',
4180 beige: 'f5f5dc',
4181 bisque: 'ffe4c4',
4182 black: '000',
4183 blanchedalmond: 'ffebcd',
4184 blue: '0000ff',
4185 blueviolet: '8a2be2',
4186 brown: 'a52a2a',
4187 burlywood: 'deb887',
4188 cadetblue: '5f9ea0',
4189 chartreuse: '7fff00',
4190 chocolate: 'd2691e',
4191 coral: 'ff7f50',
4192 cornflowerblue: '6495ed',
4193 cornsilk: 'fff8dc',
4194 crimson: 'dc143c',
4195 cyan: '00ffff',
4196 darkblue: '00008b',
4197 darkcyan: '008b8b',
4198 darkgoldenrod: 'b8860b',
4199 darkgray: 'a9a9a9',
4200 darkgreen: '006400',
4201 darkgrey: 'a9a9a9',
4202 darkkhaki: 'bdb76b',
4203 darkmagenta: '8b008b',
4204 darkolivegreen: '556b2f',
4205 darkorange: 'ff8c00',
4206 darkorchid: '9932cc',
4207 darkred: '8b0000',
4208 darksalmon: 'e9967a',
4209 darkseagreen: '8fbc8f',
4210 darkslateblue: '483d8b',
4211 darkslategray: '2f4f4f',
4212 darkslategrey: '2f4f4f',
4213 darkturquoise: '00ced1',
4214 darkviolet: '9400d3',
4215 deeppink: 'ff1493',
4216 deepskyblue: '00bfff',
4217 dimgray: '696969',
4218 dimgrey: '696969',
4219 dodgerblue: '1e90ff',
4220 firebrick: 'b22222',
4221 floralwhite: 'fffaf0',
4222 forestgreen: '228b22',
4223 fuchsia: 'ff00ff',
4224 gainsboro: 'dcdcdc',
4225 ghostwhite: 'f8f8ff',
4226 gold: 'ffd700',
4227 goldenrod: 'daa520',
4228 gray: '808080',
4229 green: '008000',
4230 greenyellow: 'adff2f',
4231 grey: '808080',
4232 honeydew: 'f0fff0',
4233 hotpink: 'ff69b4',
4234 indianred: 'cd5c5c',
4235 indigo: '4b0082',
4236 ivory: 'fffff0',
4237 khaki: 'f0e68c',
4238 lavender: 'e6e6fa',
4239 lavenderblush: 'fff0f5',
4240 lawngreen: '7cfc00',
4241 lemonchiffon: 'fffacd',
4242 lightblue: 'add8e6',
4243 lightcoral: 'f08080',
4244 lightcyan: 'e0ffff',
4245 lightgoldenrodyellow: 'fafad2',
4246 lightgray: 'd3d3d3',
4247 lightgreen: '90ee90',
4248 lightgrey: 'd3d3d3',
4249 lightpink: 'ffb6c1',
4250 lightsalmon: 'ffa07a',
4251 lightseagreen: '20b2aa',
4252 lightskyblue: '87cefa',
4253 lightslategray: '789',
4254 lightslategrey: '789',
4255 lightsteelblue: 'b0c4de',
4256 lightyellow: 'ffffe0',
4257 lime: '0f0',
4258 limegreen: '32cd32',
4259 linen: 'faf0e6',
4260 magenta: 'f0f',
4261 maroon: '800000',
4262 mediumaquamarine: '66cdaa',
4263 mediumblue: '0000cd',
4264 mediumorchid: 'ba55d3',
4265 mediumpurple: '9370db',
4266 mediumseagreen: '3cb371',
4267 mediumslateblue: '7b68ee',
4268 mediumspringgreen: '00fa9a',
4269 mediumturquoise: '48d1cc',
4270 mediumvioletred: 'c71585',
4271 midnightblue: '191970',
4272 mintcream: 'f5fffa',
4273 mistyrose: 'ffe4e1',
4274 moccasin: 'ffe4b5',
4275 navajowhite: 'ffdead',
4276 navy: '000080',
4277 oldlace: 'fdf5e6',
4278 olive: '808000',
4279 olivedrab: '6b8e23',
4280 orange: 'ffa500',
4281 orangered: 'ff4500',
4282 orchid: 'da70d6',
4283 palegoldenrod: 'eee8aa',
4284 palegreen: '98fb98',
4285 paleturquoise: 'afeeee',
4286 palevioletred: 'db7093',
4287 papayawhip: 'ffefd5',
4288 peachpuff: 'ffdab9',
4289 peru: 'cd853f',
4290 pink: 'ffc0cb',
4291 plum: 'dda0dd',
4292 powderblue: 'b0e0e6',
4293 purple: '800080',
4294 rebeccapurple: '639',
4295 red: 'f00',
4296 rosybrown: 'bc8f8f',
4297 royalblue: '4169e1',
4298 saddlebrown: '8b4513',
4299 salmon: 'fa8072',
4300 sandybrown: 'f4a460',
4301 seagreen: '2e8b57',
4302 seashell: 'fff5ee',
4303 sienna: 'a0522d',
4304 silver: 'c0c0c0',
4305 skyblue: '87ceeb',
4306 slateblue: '6a5acd',
4307 slategray: '708090',
4308 slategrey: '708090',
4309 snow: 'fffafa',
4310 springgreen: '00ff7f',
4311 steelblue: '4682b4',
4312 tan: 'd2b48c',
4313 teal: '008080',
4314 thistle: 'd8bfd8',
4315 tomato: 'ff6347',
4316 turquoise: '40e0d0',
4317 violet: 'ee82ee',
4318 wheat: 'f5deb3',
4319 white: 'fff',
4320 whitesmoke: 'f5f5f5',
4321 yellow: 'ff0',
4322 yellowgreen: '9acd32'
4323};
4324/**
4325 * Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
4326 * @private
4327 */
4328
4329function nameToHex(color) {
4330 if (typeof color !== 'string') return color;
4331 var normalizedColorName = color.toLowerCase();
4332 return namedColorMap[normalizedColorName] ? "#" + namedColorMap[normalizedColorName] : color;
4333}
4334
4335var hexRegex = /^#[a-fA-F0-9]{6}$/;
4336var hexRgbaRegex = /^#[a-fA-F0-9]{8}$/;
4337var reducedHexRegex = /^#[a-fA-F0-9]{3}$/;
4338var reducedRgbaHexRegex = /^#[a-fA-F0-9]{4}$/;
4339var rgbRegex = /^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i;
4340var rgbaRegex = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
4341var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
4342var hslaRegex = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
4343/**
4344 * Returns an RgbColor or RgbaColor object. This utility function is only useful
4345 * if want to extract a color component. With the color util `toColorString` you
4346 * can convert a RgbColor or RgbaColor object back to a string.
4347 *
4348 * @example
4349 * // Assigns `{ red: 255, green: 0, blue: 0 }` to color1
4350 * const color1 = parseToRgb('rgb(255, 0, 0)');
4351 * // Assigns `{ red: 92, green: 102, blue: 112, alpha: 0.75 }` to color2
4352 * const color2 = parseToRgb('hsla(210, 10%, 40%, 0.75)');
4353 */
4354
4355function parseToRgb(color) {
4356 if (typeof color !== 'string') {
4357 throw new PolishedError(3);
4358 }
4359
4360 var normalizedColor = nameToHex(color);
4361
4362 if (normalizedColor.match(hexRegex)) {
4363 return {
4364 red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
4365 green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
4366 blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16)
4367 };
4368 }
4369
4370 if (normalizedColor.match(hexRgbaRegex)) {
4371 var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
4372 return {
4373 red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
4374 green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
4375 blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16),
4376 alpha: alpha
4377 };
4378 }
4379
4380 if (normalizedColor.match(reducedHexRegex)) {
4381 return {
4382 red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
4383 green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
4384 blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16)
4385 };
4386 }
4387
4388 if (normalizedColor.match(reducedRgbaHexRegex)) {
4389 var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2));
4390
4391 return {
4392 red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
4393 green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
4394 blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16),
4395 alpha: _alpha
4396 };
4397 }
4398
4399 var rgbMatched = rgbRegex.exec(normalizedColor);
4400
4401 if (rgbMatched) {
4402 return {
4403 red: parseInt("" + rgbMatched[1], 10),
4404 green: parseInt("" + rgbMatched[2], 10),
4405 blue: parseInt("" + rgbMatched[3], 10)
4406 };
4407 }
4408
4409 var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
4410
4411 if (rgbaMatched) {
4412 return {
4413 red: parseInt("" + rgbaMatched[1], 10),
4414 green: parseInt("" + rgbaMatched[2], 10),
4415 blue: parseInt("" + rgbaMatched[3], 10),
4416 alpha: parseFloat("" + rgbaMatched[4]) > 1 ? parseFloat("" + rgbaMatched[4]) / 100 : parseFloat("" + rgbaMatched[4])
4417 };
4418 }
4419
4420 var hslMatched = hslRegex.exec(normalizedColor);
4421
4422 if (hslMatched) {
4423 var hue = parseInt("" + hslMatched[1], 10);
4424 var saturation = parseInt("" + hslMatched[2], 10) / 100;
4425 var lightness = parseInt("" + hslMatched[3], 10) / 100;
4426 var rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")";
4427 var hslRgbMatched = rgbRegex.exec(rgbColorString);
4428
4429 if (!hslRgbMatched) {
4430 throw new PolishedError(4, normalizedColor, rgbColorString);
4431 }
4432
4433 return {
4434 red: parseInt("" + hslRgbMatched[1], 10),
4435 green: parseInt("" + hslRgbMatched[2], 10),
4436 blue: parseInt("" + hslRgbMatched[3], 10)
4437 };
4438 }
4439
4440 var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
4441
4442 if (hslaMatched) {
4443 var _hue = parseInt("" + hslaMatched[1], 10);
4444
4445 var _saturation = parseInt("" + hslaMatched[2], 10) / 100;
4446
4447 var _lightness = parseInt("" + hslaMatched[3], 10) / 100;
4448
4449 var _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")";
4450
4451 var _hslRgbMatched = rgbRegex.exec(_rgbColorString);
4452
4453 if (!_hslRgbMatched) {
4454 throw new PolishedError(4, normalizedColor, _rgbColorString);
4455 }
4456
4457 return {
4458 red: parseInt("" + _hslRgbMatched[1], 10),
4459 green: parseInt("" + _hslRgbMatched[2], 10),
4460 blue: parseInt("" + _hslRgbMatched[3], 10),
4461 alpha: parseFloat("" + hslaMatched[4]) > 1 ? parseFloat("" + hslaMatched[4]) / 100 : parseFloat("" + hslaMatched[4])
4462 };
4463 }
4464
4465 throw new PolishedError(5);
4466}
4467
4468function rgbToHsl(color) {
4469 // make sure rgb are contained in a set of [0, 255]
4470 var red = color.red / 255;
4471 var green = color.green / 255;
4472 var blue = color.blue / 255;
4473 var max = Math.max(red, green, blue);
4474 var min = Math.min(red, green, blue);
4475 var lightness = (max + min) / 2;
4476
4477 if (max === min) {
4478 // achromatic
4479 if (color.alpha !== undefined) {
4480 return {
4481 hue: 0,
4482 saturation: 0,
4483 lightness: lightness,
4484 alpha: color.alpha
4485 };
4486 } else {
4487 return {
4488 hue: 0,
4489 saturation: 0,
4490 lightness: lightness
4491 };
4492 }
4493 }
4494
4495 var hue;
4496 var delta = max - min;
4497 var saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);
4498
4499 switch (max) {
4500 case red:
4501 hue = (green - blue) / delta + (green < blue ? 6 : 0);
4502 break;
4503
4504 case green:
4505 hue = (blue - red) / delta + 2;
4506 break;
4507
4508 default:
4509 // blue case
4510 hue = (red - green) / delta + 4;
4511 break;
4512 }
4513
4514 hue *= 60;
4515
4516 if (color.alpha !== undefined) {
4517 return {
4518 hue: hue,
4519 saturation: saturation,
4520 lightness: lightness,
4521 alpha: color.alpha
4522 };
4523 }
4524
4525 return {
4526 hue: hue,
4527 saturation: saturation,
4528 lightness: lightness
4529 };
4530}
4531/**
4532 * Returns an HslColor or HslaColor object. This utility function is only useful
4533 * if want to extract a color component. With the color util `toColorString` you
4534 * can convert a HslColor or HslaColor object back to a string.
4535 *
4536 * @example
4537 * // Assigns `{ hue: 0, saturation: 1, lightness: 0.5 }` to color1
4538 * const color1 = parseToHsl('rgb(255, 0, 0)');
4539 * // Assigns `{ hue: 128, saturation: 1, lightness: 0.5, alpha: 0.75 }` to color2
4540 * const color2 = parseToHsl('hsla(128, 100%, 50%, 0.75)');
4541 */
4542
4543
4544function parseToHsl(color) {
4545 // Note: At a later stage we can optimize this function as right now a hsl
4546 // color would be parsed converted to rgb values and converted back to hsl.
4547 return rgbToHsl(parseToRgb(color));
4548}
4549/**
4550 * Reduces hex values if possible e.g. #ff8866 to #f86
4551 * @private
4552 */
4553
4554
4555var reduceHexValue = function reduceHexValue(value) {
4556 if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
4557 return "#" + value[1] + value[3] + value[5];
4558 }
4559
4560 return value;
4561};
4562
4563var reduceHexValue$1 = reduceHexValue;
4564
4565function numberToHex(value) {
4566 var hex = value.toString(16);
4567 return hex.length === 1 ? "0" + hex : hex;
4568}
4569
4570function colorToHex(color) {
4571 return numberToHex(Math.round(color * 255));
4572}
4573
4574function convertToHex(red, green, blue) {
4575 return reduceHexValue$1("#" + colorToHex(red) + colorToHex(green) + colorToHex(blue));
4576}
4577
4578function hslToHex(hue, saturation, lightness) {
4579 return hslToRgb(hue, saturation, lightness, convertToHex);
4580}
4581/**
4582 * Returns a string value for the color. The returned result is the smallest possible hex notation.
4583 *
4584 * @example
4585 * // Styles as object usage
4586 * const styles = {
4587 * background: hsl(359, 0.75, 0.4),
4588 * background: hsl({ hue: 360, saturation: 0.75, lightness: 0.4 }),
4589 * }
4590 *
4591 * // styled-components usage
4592 * const div = styled.div`
4593 * background: ${hsl(359, 0.75, 0.4)};
4594 * background: ${hsl({ hue: 360, saturation: 0.75, lightness: 0.4 })};
4595 * `
4596 *
4597 * // CSS in JS Output
4598 *
4599 * element {
4600 * background: "#b3191c";
4601 * background: "#b3191c";
4602 * }
4603 */
4604
4605
4606function hsl(value, saturation, lightness) {
4607 if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number') {
4608 return hslToHex(value, saturation, lightness);
4609 } else if (_typeof(value) === 'object' && saturation === undefined && lightness === undefined) {
4610 return hslToHex(value.hue, value.saturation, value.lightness);
4611 }
4612
4613 throw new PolishedError(1);
4614}
4615/**
4616 * Returns a string value for the color. The returned result is the smallest possible rgba or hex notation.
4617 *
4618 * @example
4619 * // Styles as object usage
4620 * const styles = {
4621 * background: hsla(359, 0.75, 0.4, 0.7),
4622 * background: hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0,7 }),
4623 * background: hsla(359, 0.75, 0.4, 1),
4624 * }
4625 *
4626 * // styled-components usage
4627 * const div = styled.div`
4628 * background: ${hsla(359, 0.75, 0.4, 0.7)};
4629 * background: ${hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0,7 })};
4630 * background: ${hsla(359, 0.75, 0.4, 1)};
4631 * `
4632 *
4633 * // CSS in JS Output
4634 *
4635 * element {
4636 * background: "rgba(179,25,28,0.7)";
4637 * background: "rgba(179,25,28,0.7)";
4638 * background: "#b3191c";
4639 * }
4640 */
4641
4642
4643function hsla(value, saturation, lightness, alpha) {
4644 if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number' && typeof alpha === 'number') {
4645 return alpha >= 1 ? hslToHex(value, saturation, lightness) : "rgba(" + hslToRgb(value, saturation, lightness) + "," + alpha + ")";
4646 } else if (_typeof(value) === 'object' && saturation === undefined && lightness === undefined && alpha === undefined) {
4647 return value.alpha >= 1 ? hslToHex(value.hue, value.saturation, value.lightness) : "rgba(" + hslToRgb(value.hue, value.saturation, value.lightness) + "," + value.alpha + ")";
4648 }
4649
4650 throw new PolishedError(2);
4651}
4652/**
4653 * Returns a string value for the color. The returned result is the smallest possible hex notation.
4654 *
4655 * @example
4656 * // Styles as object usage
4657 * const styles = {
4658 * background: rgb(255, 205, 100),
4659 * background: rgb({ red: 255, green: 205, blue: 100 }),
4660 * }
4661 *
4662 * // styled-components usage
4663 * const div = styled.div`
4664 * background: ${rgb(255, 205, 100)};
4665 * background: ${rgb({ red: 255, green: 205, blue: 100 })};
4666 * `
4667 *
4668 * // CSS in JS Output
4669 *
4670 * element {
4671 * background: "#ffcd64";
4672 * background: "#ffcd64";
4673 * }
4674 */
4675
4676
4677function rgb(value, green, blue) {
4678 if (typeof value === 'number' && typeof green === 'number' && typeof blue === 'number') {
4679 return reduceHexValue$1("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue));
4680 } else if (_typeof(value) === 'object' && green === undefined && blue === undefined) {
4681 return reduceHexValue$1("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
4682 }
4683
4684 throw new PolishedError(6);
4685}
4686/**
4687 * Returns a string value for the color. The returned result is the smallest possible rgba or hex notation.
4688 *
4689 * Can also be used to fade a color by passing a hex value or named CSS color along with an alpha value.
4690 *
4691 * @example
4692 * // Styles as object usage
4693 * const styles = {
4694 * background: rgba(255, 205, 100, 0.7),
4695 * background: rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 }),
4696 * background: rgba(255, 205, 100, 1),
4697 * background: rgba('#ffffff', 0.4),
4698 * background: rgba('black', 0.7),
4699 * }
4700 *
4701 * // styled-components usage
4702 * const div = styled.div`
4703 * background: ${rgba(255, 205, 100, 0.7)};
4704 * background: ${rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 })};
4705 * background: ${rgba(255, 205, 100, 1)};
4706 * background: ${rgba('#ffffff', 0.4)};
4707 * background: ${rgba('black', 0.7)};
4708 * `
4709 *
4710 * // CSS in JS Output
4711 *
4712 * element {
4713 * background: "rgba(255,205,100,0.7)";
4714 * background: "rgba(255,205,100,0.7)";
4715 * background: "#ffcd64";
4716 * background: "rgba(255,255,255,0.4)";
4717 * background: "rgba(0,0,0,0.7)";
4718 * }
4719 */
4720
4721
4722function rgba(firstValue, secondValue, thirdValue, fourthValue) {
4723 if (typeof firstValue === 'string' && typeof secondValue === 'number') {
4724 var rgbValue = parseToRgb(firstValue);
4725 return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
4726 } else if (typeof firstValue === 'number' && typeof secondValue === 'number' && typeof thirdValue === 'number' && typeof fourthValue === 'number') {
4727 return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
4728 } else if (_typeof(firstValue) === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
4729 return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
4730 }
4731
4732 throw new PolishedError(7);
4733}
4734
4735var isRgb = function isRgb(color) {
4736 return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined');
4737};
4738
4739var isRgba = function isRgba(color) {
4740 return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && typeof color.alpha === 'number';
4741};
4742
4743var isHsl = function isHsl(color) {
4744 return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined');
4745};
4746
4747var isHsla = function isHsla(color) {
4748 return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && typeof color.alpha === 'number';
4749};
4750/**
4751 * Converts a RgbColor, RgbaColor, HslColor or HslaColor object to a color string.
4752 * This util is useful in case you only know on runtime which color object is
4753 * used. Otherwise we recommend to rely on `rgb`, `rgba`, `hsl` or `hsla`.
4754 *
4755 * @example
4756 * // Styles as object usage
4757 * const styles = {
4758 * background: toColorString({ red: 255, green: 205, blue: 100 }),
4759 * background: toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 }),
4760 * background: toColorString({ hue: 240, saturation: 1, lightness: 0.5 }),
4761 * background: toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 }),
4762 * }
4763 *
4764 * // styled-components usage
4765 * const div = styled.div`
4766 * background: ${toColorString({ red: 255, green: 205, blue: 100 })};
4767 * background: ${toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 })};
4768 * background: ${toColorString({ hue: 240, saturation: 1, lightness: 0.5 })};
4769 * background: ${toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 })};
4770 * `
4771 *
4772 * // CSS in JS Output
4773 * element {
4774 * background: "#ffcd64";
4775 * background: "rgba(255,205,100,0.72)";
4776 * background: "#00f";
4777 * background: "rgba(179,25,25,0.72)";
4778 * }
4779 */
4780
4781
4782function toColorString(color) {
4783 if (_typeof(color) !== 'object') throw new PolishedError(8);
4784 if (isRgba(color)) return rgba(color);
4785 if (isRgb(color)) return rgb(color);
4786 if (isHsla(color)) return hsla(color);
4787 if (isHsl(color)) return hsl(color);
4788 throw new PolishedError(8);
4789} // Type definitions taken from https://github.com/gcanti/flow-static-land/blob/master/src/Fun.js
4790// eslint-disable-next-line no-unused-vars
4791// eslint-disable-next-line no-unused-vars
4792// eslint-disable-next-line no-redeclare
4793
4794
4795function curried(f, length, acc) {
4796 return function fn() {
4797 // eslint-disable-next-line prefer-rest-params
4798 var combined = acc.concat(Array.prototype.slice.call(arguments));
4799 return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
4800 };
4801} // eslint-disable-next-line no-redeclare
4802
4803
4804function curry(f) {
4805 // eslint-disable-line no-redeclare
4806 return curried(f, f.length, []);
4807}
4808
4809function guard(lowerBoundary, upperBoundary, value) {
4810 return Math.max(lowerBoundary, Math.min(upperBoundary, value));
4811}
4812/**
4813 * Returns a string value for the darkened color.
4814 *
4815 * @example
4816 * // Styles as object usage
4817 * const styles = {
4818 * background: darken(0.2, '#FFCD64'),
4819 * background: darken('0.2', 'rgba(255,205,100,0.7)'),
4820 * }
4821 *
4822 * // styled-components usage
4823 * const div = styled.div`
4824 * background: ${darken(0.2, '#FFCD64')};
4825 * background: ${darken('0.2', 'rgba(255,205,100,0.7)')};
4826 * `
4827 *
4828 * // CSS in JS Output
4829 *
4830 * element {
4831 * background: "#ffbd31";
4832 * background: "rgba(255,189,49,0.7)";
4833 * }
4834 */
4835
4836
4837function darken(amount, color) {
4838 if (color === 'transparent') return color;
4839 var hslColor = parseToHsl(color);
4840 return toColorString(_extends({}, hslColor, {
4841 lightness: guard(0, 1, hslColor.lightness - parseFloat(amount))
4842 }));
4843} // prettier-ignore
4844
4845
4846var curriedDarken = /*#__PURE__*/curry
4847/* ::<number | string, string, string> */
4848(darken);
4849var curriedDarken$1 = curriedDarken;
4850/**
4851 * Returns a string value for the lightened color.
4852 *
4853 * @example
4854 * // Styles as object usage
4855 * const styles = {
4856 * background: lighten(0.2, '#CCCD64'),
4857 * background: lighten('0.2', 'rgba(204,205,100,0.7)'),
4858 * }
4859 *
4860 * // styled-components usage
4861 * const div = styled.div`
4862 * background: ${lighten(0.2, '#FFCD64')};
4863 * background: ${lighten('0.2', 'rgba(204,205,100,0.7)')};
4864 * `
4865 *
4866 * // CSS in JS Output
4867 *
4868 * element {
4869 * background: "#e5e6b1";
4870 * background: "rgba(229,230,177,0.7)";
4871 * }
4872 */
4873
4874function lighten(amount, color) {
4875 if (color === 'transparent') return color;
4876 var hslColor = parseToHsl(color);
4877 return toColorString(_extends({}, hslColor, {
4878 lightness: guard(0, 1, hslColor.lightness + parseFloat(amount))
4879 }));
4880} // prettier-ignore
4881
4882
4883var curriedLighten = /*#__PURE__*/curry
4884/* ::<number | string, string, string> */
4885(lighten);
4886var curriedLighten$1 = curriedLighten;
4887/**
4888 * Increases the opacity of a color. Its range for the amount is between 0 to 1.
4889 *
4890 *
4891 * @example
4892 * // Styles as object usage
4893 * const styles = {
4894 * background: opacify(0.1, 'rgba(255, 255, 255, 0.9)');
4895 * background: opacify(0.2, 'hsla(0, 0%, 100%, 0.5)'),
4896 * background: opacify('0.5', 'rgba(255, 0, 0, 0.2)'),
4897 * }
4898 *
4899 * // styled-components usage
4900 * const div = styled.div`
4901 * background: ${opacify(0.1, 'rgba(255, 255, 255, 0.9)')};
4902 * background: ${opacify(0.2, 'hsla(0, 0%, 100%, 0.5)')},
4903 * background: ${opacify('0.5', 'rgba(255, 0, 0, 0.2)')},
4904 * `
4905 *
4906 * // CSS in JS Output
4907 *
4908 * element {
4909 * background: "#fff";
4910 * background: "rgba(255,255,255,0.7)";
4911 * background: "rgba(255,0,0,0.7)";
4912 * }
4913 */
4914
4915function opacify(amount, color) {
4916 if (color === 'transparent') return color;
4917 var parsedColor = parseToRgb(color);
4918 var alpha = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1;
4919
4920 var colorWithAlpha = _extends({}, parsedColor, {
4921 alpha: guard(0, 1, (alpha * 100 + parseFloat(amount) * 100) / 100)
4922 });
4923
4924 return rgba(colorWithAlpha);
4925} // prettier-ignore
4926
4927
4928var curriedOpacify = /*#__PURE__*/curry
4929/* ::<number | string, string, string> */
4930(opacify);
4931var curriedOpacify$1 = curriedOpacify;
4932/**
4933 * Decreases the opacity of a color. Its range for the amount is between 0 to 1.
4934 *
4935 *
4936 * @example
4937 * // Styles as object usage
4938 * const styles = {
4939 * background: transparentize(0.1, '#fff'),
4940 * background: transparentize(0.2, 'hsl(0, 0%, 100%)'),
4941 * background: transparentize('0.5', 'rgba(255, 0, 0, 0.8)'),
4942 * }
4943 *
4944 * // styled-components usage
4945 * const div = styled.div`
4946 * background: ${transparentize(0.1, '#fff')};
4947 * background: ${transparentize(0.2, 'hsl(0, 0%, 100%)')};
4948 * background: ${transparentize('0.5', 'rgba(255, 0, 0, 0.8)')};
4949 * `
4950 *
4951 * // CSS in JS Output
4952 *
4953 * element {
4954 * background: "rgba(255,255,255,0.9)";
4955 * background: "rgba(255,255,255,0.8)";
4956 * background: "rgba(255,0,0,0.3)";
4957 * }
4958 */
4959
4960function transparentize(amount, color) {
4961 if (color === 'transparent') return color;
4962 var parsedColor = parseToRgb(color);
4963 var alpha = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1;
4964
4965 var colorWithAlpha = _extends({}, parsedColor, {
4966 alpha: guard(0, 1, +(alpha * 100 - parseFloat(amount) * 100).toFixed(2) / 100)
4967 });
4968
4969 return rgba(colorWithAlpha);
4970} // prettier-ignore
4971
4972
4973var curriedTransparentize = /*#__PURE__*/curry
4974/* ::<number | string, string, string> */
4975(transparentize);
4976var curriedTransparentize$1 = curriedTransparentize;
4977var color = {
4978 // Official color palette
4979 primary: '#FF4785',
4980 secondary: '#1EA7FD',
4981 tertiary: '#FAFBFC',
4982 ancillary: '#22a699',
4983 // Complimentary
4984 orange: '#FC521F',
4985 gold: '#FFAE00',
4986 green: '#66BF3C',
4987 seafoam: '#37D5D3',
4988 purple: '#6F2CAC',
4989 ultraviolet: '#2A0481',
4990 // Monochrome
4991 lightest: '#FFFFFF',
4992 lighter: '#F8F8F8',
4993 light: '#F3F3F3',
4994 mediumlight: '#EEEEEE',
4995 medium: '#DDDDDD',
4996 mediumdark: '#999999',
4997 dark: '#666666',
4998 darker: '#444444',
4999 darkest: '#333333',
5000 // For borders
5001 border: 'rgba(0,0,0,.1)',
5002 // Status
5003 positive: '#66BF3C',
5004 negative: '#FF4400',
5005 warning: '#E69D00',
5006 critical: '#FFFFFF',
5007 defaultText: '#333333',
5008 inverseText: '#FFFFFF'
5009};
5010var background = {
5011 app: '#F6F9FC',
5012 bar: '#FFFFFF',
5013 content: color.lightest,
5014 gridCellSize: 10,
5015 hoverable: curriedTransparentize$1(0.93, color.secondary),
5016 // Notification, error, and warning backgrounds
5017 positive: '#E1FFD4',
5018 negative: '#FEDED2',
5019 warning: '#FFF5CF',
5020 critical: '#FF4400'
5021};
5022var typography = {
5023 fonts: {
5024 base: ['"Nunito Sans"', '-apple-system', '".SFNSText-Regular"', '"San Francisco"', 'BlinkMacSystemFont', '"Segoe UI"', '"Helvetica Neue"', 'Helvetica', 'Arial', 'sans-serif'].join(', '),
5025 mono: ['ui-monospace', 'Menlo', 'Monaco', '"Roboto Mono"', '"Oxygen Mono"', '"Ubuntu Monospace"', '"Source Code Pro"', '"Droid Sans Mono"', '"Courier New"', 'monospace'].join(', ')
5026 },
5027 weight: {
5028 regular: 400,
5029 bold: 700,
5030 black: 900
5031 },
5032 size: {
5033 s1: 12,
5034 s2: 14,
5035 s3: 16,
5036 m1: 20,
5037 m2: 24,
5038 m3: 28,
5039 l1: 32,
5040 l2: 40,
5041 l3: 48,
5042 code: 90
5043 }
5044};
5045var createReset = memoize$1(1)(function (_ref3) {
5046 var typography = _ref3.typography;
5047 return {
5048 body: {
5049 fontFamily: typography.fonts.base,
5050 fontSize: typography.size.s3,
5051 margin: 0,
5052 WebkitFontSmoothing: 'antialiased',
5053 MozOsxFontSmoothing: 'grayscale',
5054 WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)',
5055 WebkitOverflowScrolling: 'touch'
5056 },
5057 '*': {
5058 boxSizing: 'border-box'
5059 },
5060 'h1, h2, h3, h4, h5, h6': {
5061 fontWeight: typography.weight.regular,
5062 margin: 0,
5063 padding: 0
5064 },
5065 'button, input, textarea, select': {
5066 fontFamily: 'inherit',
5067 fontSize: 'inherit',
5068 boxSizing: 'border-box'
5069 },
5070 sub: {
5071 fontSize: '0.8em',
5072 bottom: '-0.2em'
5073 },
5074 sup: {
5075 fontSize: '0.8em',
5076 top: '-0.2em'
5077 },
5078 'b, strong': {
5079 fontWeight: typography.weight.bold
5080 },
5081 hr: {
5082 border: 'none',
5083 borderTop: '1px solid silver',
5084 clear: 'both',
5085 marginBottom: '1.25rem'
5086 },
5087 code: {
5088 fontFamily: typography.fonts.mono,
5089 WebkitFontSmoothing: 'antialiased',
5090 MozOsxFontSmoothing: 'grayscale',
5091 display: 'inline-block',
5092 paddingLeft: 2,
5093 paddingRight: 2,
5094 verticalAlign: 'baseline',
5095 color: 'inherit'
5096 },
5097 pre: {
5098 fontFamily: typography.fonts.mono,
5099 WebkitFontSmoothing: 'antialiased',
5100 MozOsxFontSmoothing: 'grayscale',
5101 lineHeight: '18px',
5102 padding: '11px 1rem',
5103 whiteSpace: 'pre-wrap',
5104 color: 'inherit',
5105 borderRadius: 3,
5106 margin: '1rem 0'
5107 }
5108 };
5109});
5110var createGlobal = memoize$1(1)(function (_ref4) {
5111 var color = _ref4.color,
5112 background = _ref4.background,
5113 typography = _ref4.typography;
5114 var resetStyles = createReset({
5115 typography: typography
5116 });
5117 return Object.assign(Object.assign({}, resetStyles), {
5118 body: Object.assign(Object.assign({}, resetStyles.body), {
5119 color: color.defaultText,
5120 background: background.app,
5121 overflow: 'hidden'
5122 }),
5123 hr: Object.assign(Object.assign({}, resetStyles.hr), {
5124 borderTop: "1px solid ".concat(color.border)
5125 })
5126 });
5127});
5128var theme$1 = {
5129 base: 'light',
5130 // Storybook-specific color palette
5131 colorPrimary: '#FF4785',
5132 colorSecondary: '#1EA7FD',
5133 // UI
5134 appBg: background.app,
5135 appContentBg: color.lightest,
5136 appBorderColor: color.border,
5137 appBorderRadius: 4,
5138 // Fonts
5139 fontBase: typography.fonts.base,
5140 fontCode: typography.fonts.mono,
5141 // Text colors
5142 textColor: color.darkest,
5143 textInverseColor: color.lightest,
5144 textMutedColor: color.dark,
5145 // Toolbar default and active colors
5146 barTextColor: color.mediumdark,
5147 barSelectedColor: color.secondary,
5148 barBg: color.lightest,
5149 // Form colors
5150 inputBg: color.lightest,
5151 inputBorder: color.border,
5152 inputTextColor: color.darkest,
5153 inputBorderRadius: 4
5154};
5155var theme = {
5156 base: 'dark',
5157 // Storybook-specific color palette
5158 colorPrimary: '#FF4785',
5159 colorSecondary: '#1EA7FD',
5160 // UI
5161 appBg: '#2f2f2f',
5162 appContentBg: color.darkest,
5163 appBorderColor: 'rgba(255,255,255,.1)',
5164 appBorderRadius: 4,
5165 // Fonts
5166 fontBase: typography.fonts.base,
5167 fontCode: typography.fonts.mono,
5168 // Text colors
5169 textColor: color.lightest,
5170 textInverseColor: color.darkest,
5171 textMutedColor: color.mediumdark,
5172 // Toolbar default and active colors
5173 barTextColor: '#999999',
5174 barSelectedColor: color.secondary,
5175 barBg: color.darkest,
5176 // Form colors
5177 inputBg: '#3f3f3f',
5178 inputBorder: 'rgba(0,0,0,.3)',
5179 inputTextColor: color.lightest,
5180 inputBorderRadius: 4
5181};
5182var win;
5183
5184if (typeof window !== "undefined") {
5185 win = window;
5186} else if (typeof commonjsGlobal !== "undefined") {
5187 win = commonjsGlobal;
5188} else if (typeof self !== "undefined") {
5189 win = self;
5190} else {
5191 win = {};
5192}
5193
5194var window_1 = win;
5195var globalWindow = window_1.window;
5196
5197var mkColor = function mkColor(color) {
5198 return {
5199 color: color
5200 };
5201}; // Check if it is a string. This is for the sake of warning users
5202// and the successive guarding logics that use String methods.
5203
5204
5205var isColorString = function isColorString(color) {
5206 if (typeof color !== 'string') {
5207 logger.warn("Color passed to theme object should be a string. Instead " + "".concat(color, "(").concat(_typeof(color), ") was passed."));
5208 return false;
5209 }
5210
5211 return true;
5212}; // Passing arguments that can't be converted to RGB such as linear-gradient
5213// to library polished's functions such as lighten or darken throws the error
5214// that crashes the entire storybook. It needs to be guarded when arguments
5215// of those functions are from user input.
5216
5217
5218var isValidColorForPolished = function isValidColorForPolished(color) {
5219 return !/(gradient|var|calc)/.test(color);
5220};
5221
5222var applyPolished = function applyPolished(type, color) {
5223 if (type === 'darken') {
5224 return rgba("".concat(curriedDarken$1(1, color)), 0.95);
5225 }
5226
5227 if (type === 'lighten') {
5228 return rgba("".concat(curriedLighten$1(1, color)), 0.95);
5229 }
5230
5231 return color;
5232};
5233
5234var colorFactory = function colorFactory(type) {
5235 return function (color) {
5236 if (!isColorString(color)) {
5237 return color;
5238 }
5239
5240 if (!isValidColorForPolished(color)) {
5241 return color;
5242 } // Guard anything that is not working with polished.
5243
5244
5245 try {
5246 return applyPolished(type, color);
5247 } catch (error) {
5248 return color;
5249 }
5250 };
5251};
5252
5253var lightenColor = colorFactory('lighten');
5254var darkenColor = colorFactory('darken'); // The default color scheme is light so unless the preferred color
5255// scheme is set to dark we always want to use the light theme
5256
5257var getPreferredColorScheme = function getPreferredColorScheme() {
5258 if (!globalWindow || !globalWindow.matchMedia) return 'light';
5259 var isDarkThemePreferred = globalWindow.matchMedia('(prefers-color-scheme: dark)').matches;
5260 if (isDarkThemePreferred) return 'dark';
5261 return 'light';
5262}; // This generates theme variables in the correct shape for the UI
5263
5264
5265var themes = {
5266 light: theme$1,
5267 dark: theme,
5268 normal: theme$1
5269};
5270var preferredColorScheme = getPreferredColorScheme();
5271
5272var create$1 = function create$1() {
5273 var vars = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
5274 base: preferredColorScheme
5275 };
5276 var rest = arguments.length > 1 ? arguments[1] : undefined;
5277 var inherit = Object.assign(Object.assign(Object.assign(Object.assign({}, themes[preferredColorScheme]), themes[vars.base] || {}), vars), {
5278 base: themes[vars.base] ? vars.base : preferredColorScheme
5279 });
5280 return Object.assign(Object.assign(Object.assign({}, rest), inherit), {
5281 barSelectedColor: vars.barSelectedColor || inherit.colorSecondary
5282 });
5283};
5284/*! *****************************************************************************
5285Copyright (c) Microsoft Corporation.
5286
5287Permission to use, copy, modify, and/or distribute this software for any
5288purpose with or without fee is hereby granted.
5289
5290THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
5291REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
5292AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
5293INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
5294LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
5295OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
5296PERFORMANCE OF THIS SOFTWARE.
5297***************************************************************************** */
5298
5299
5300function __rest(s, e) {
5301 var t = {};
5302
5303 for (var p in s) {
5304 if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
5305 }
5306
5307 if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
5308 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
5309 }
5310 return t;
5311}
5312
5313var easing = {
5314 rubber: 'cubic-bezier(0.175, 0.885, 0.335, 1.05)'
5315};
5316var rotate360 = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tfrom {\n\t\ttransform: rotate(0deg);\n\t}\n\tto {\n\t\ttransform: rotate(360deg);\n\t}\n"])));
5317var glow = keyframes(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n 0%, 100% { opacity: 1; }\n 50% { opacity: .4; }\n"])));
5318var float = keyframes(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n 0% { transform: translateY(1px); }\n 25% { transform: translateY(0px); }\n 50% { transform: translateY(-3px); }\n 100% { transform: translateY(1px); }\n"])));
5319var jiggle = keyframes(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n 0%, 100% { transform:translate3d(0,0,0); }\n 12.5%, 62.5% { transform:translate3d(-4px,0,0); }\n 37.5%, 87.5% { transform: translate3d(4px,0,0); }\n"])));
5320var inlineGlow = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n animation: ", " 1.5s ease-in-out infinite;\n color: transparent;\n cursor: progress;\n"])), glow); // hover & active state for links and buttons
5321
5322var hoverable = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n transition: all 150ms ease-out;\n transform: translate3d(0, 0, 0);\n\n &:hover {\n transform: translate3d(0, -2px, 0);\n }\n\n &:active {\n transform: translate3d(0, 0, 0);\n }\n"])));
5323var animation = {
5324 rotate360: rotate360,
5325 glow: glow,
5326 float: float,
5327 jiggle: jiggle,
5328 inlineGlow: inlineGlow,
5329 hoverable: hoverable
5330};
5331var chromeDark = {
5332 BASE_FONT_FAMILY: 'Menlo, monospace',
5333 BASE_FONT_SIZE: '11px',
5334 BASE_LINE_HEIGHT: 1.2,
5335 BASE_BACKGROUND_COLOR: 'rgb(36, 36, 36)',
5336 BASE_COLOR: 'rgb(213, 213, 213)',
5337 OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES: 10,
5338 OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES: 5,
5339 OBJECT_NAME_COLOR: 'rgb(227, 110, 236)',
5340 OBJECT_VALUE_NULL_COLOR: 'rgb(127, 127, 127)',
5341 OBJECT_VALUE_UNDEFINED_COLOR: 'rgb(127, 127, 127)',
5342 OBJECT_VALUE_REGEXP_COLOR: 'rgb(233, 63, 59)',
5343 OBJECT_VALUE_STRING_COLOR: 'rgb(233, 63, 59)',
5344 OBJECT_VALUE_SYMBOL_COLOR: 'rgb(233, 63, 59)',
5345 OBJECT_VALUE_NUMBER_COLOR: 'hsl(252, 100%, 75%)',
5346 OBJECT_VALUE_BOOLEAN_COLOR: 'hsl(252, 100%, 75%)',
5347 OBJECT_VALUE_FUNCTION_PREFIX_COLOR: 'rgb(85, 106, 242)',
5348 HTML_TAG_COLOR: 'rgb(93, 176, 215)',
5349 HTML_TAGNAME_COLOR: 'rgb(93, 176, 215)',
5350 HTML_TAGNAME_TEXT_TRANSFORM: 'lowercase',
5351 HTML_ATTRIBUTE_NAME_COLOR: 'rgb(155, 187, 220)',
5352 HTML_ATTRIBUTE_VALUE_COLOR: 'rgb(242, 151, 102)',
5353 HTML_COMMENT_COLOR: 'rgb(137, 137, 137)',
5354 HTML_DOCTYPE_COLOR: 'rgb(192, 192, 192)',
5355 ARROW_COLOR: 'rgb(145, 145, 145)',
5356 ARROW_MARGIN_RIGHT: 3,
5357 ARROW_FONT_SIZE: 12,
5358 ARROW_ANIMATION_DURATION: '0',
5359 TREENODE_FONT_FAMILY: 'Menlo, monospace',
5360 TREENODE_FONT_SIZE: '11px',
5361 TREENODE_LINE_HEIGHT: 1.2,
5362 TREENODE_PADDING_LEFT: 12,
5363 TABLE_BORDER_COLOR: 'rgb(85, 85, 85)',
5364 TABLE_TH_BACKGROUND_COLOR: 'rgb(44, 44, 44)',
5365 TABLE_TH_HOVER_COLOR: 'rgb(48, 48, 48)',
5366 TABLE_SORT_ICON_COLOR: 'black',
5367 TABLE_DATA_BACKGROUND_IMAGE: 'linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 50%, rgba(51, 139, 255, 0.0980392) 50%, rgba(51, 139, 255, 0.0980392))',
5368 TABLE_DATA_BACKGROUND_SIZE: '128px 32px'
5369};
5370var chromeLight = {
5371 BASE_FONT_FAMILY: 'Menlo, monospace',
5372 BASE_FONT_SIZE: '11px',
5373 BASE_LINE_HEIGHT: 1.2,
5374 BASE_BACKGROUND_COLOR: 'white',
5375 BASE_COLOR: 'black',
5376 OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES: 10,
5377 OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES: 5,
5378 OBJECT_NAME_COLOR: 'rgb(136, 19, 145)',
5379 OBJECT_VALUE_NULL_COLOR: 'rgb(128, 128, 128)',
5380 OBJECT_VALUE_UNDEFINED_COLOR: 'rgb(128, 128, 128)',
5381 OBJECT_VALUE_REGEXP_COLOR: 'rgb(196, 26, 22)',
5382 OBJECT_VALUE_STRING_COLOR: 'rgb(196, 26, 22)',
5383 OBJECT_VALUE_SYMBOL_COLOR: 'rgb(196, 26, 22)',
5384 OBJECT_VALUE_NUMBER_COLOR: 'rgb(28, 0, 207)',
5385 OBJECT_VALUE_BOOLEAN_COLOR: 'rgb(28, 0, 207)',
5386 OBJECT_VALUE_FUNCTION_PREFIX_COLOR: 'rgb(13, 34, 170)',
5387 HTML_TAG_COLOR: 'rgb(168, 148, 166)',
5388 HTML_TAGNAME_COLOR: 'rgb(136, 18, 128)',
5389 HTML_TAGNAME_TEXT_TRANSFORM: 'lowercase',
5390 HTML_ATTRIBUTE_NAME_COLOR: 'rgb(153, 69, 0)',
5391 HTML_ATTRIBUTE_VALUE_COLOR: 'rgb(26, 26, 166)',
5392 HTML_COMMENT_COLOR: 'rgb(35, 110, 37)',
5393 HTML_DOCTYPE_COLOR: 'rgb(192, 192, 192)',
5394 ARROW_COLOR: '#6e6e6e',
5395 ARROW_MARGIN_RIGHT: 3,
5396 ARROW_FONT_SIZE: 12,
5397 ARROW_ANIMATION_DURATION: '0',
5398 TREENODE_FONT_FAMILY: 'Menlo, monospace',
5399 TREENODE_FONT_SIZE: '11px',
5400 TREENODE_LINE_HEIGHT: 1.2,
5401 TREENODE_PADDING_LEFT: 12,
5402 TABLE_BORDER_COLOR: '#aaa',
5403 TABLE_TH_BACKGROUND_COLOR: '#eee',
5404 TABLE_TH_HOVER_COLOR: 'hsla(0, 0%, 90%, 1)',
5405 TABLE_SORT_ICON_COLOR: '#6e6e6e',
5406 TABLE_DATA_BACKGROUND_IMAGE: 'linear-gradient(to bottom, white, white 50%, rgb(234, 243, 255) 50%, rgb(234, 243, 255))',
5407 TABLE_DATA_BACKGROUND_SIZE: '128px 32px'
5408};
5409
5410var convertColors = function convertColors(colors) {
5411 return Object.entries(colors).reduce(function (acc, _ref5) {
5412 var _ref6 = _slicedToArray(_ref5, 2),
5413 k = _ref6[0],
5414 v = _ref6[1];
5415
5416 return Object.assign(Object.assign({}, acc), _defineProperty({}, k, mkColor(v)));
5417 }, {});
5418};
5419
5420var create = function create(_ref7) {
5421 var colors = _ref7.colors,
5422 mono = _ref7.mono;
5423 var colorsObjs = convertColors(colors);
5424 return {
5425 token: {
5426 fontFamily: mono,
5427 WebkitFontSmoothing: 'antialiased',
5428 '&.tag': colorsObjs.red3,
5429 '&.comment': Object.assign(Object.assign({}, colorsObjs.green1), {
5430 fontStyle: 'italic'
5431 }),
5432 '&.prolog': Object.assign(Object.assign({}, colorsObjs.green1), {
5433 fontStyle: 'italic'
5434 }),
5435 '&.doctype': Object.assign(Object.assign({}, colorsObjs.green1), {
5436 fontStyle: 'italic'
5437 }),
5438 '&.cdata': Object.assign(Object.assign({}, colorsObjs.green1), {
5439 fontStyle: 'italic'
5440 }),
5441 '&.string': colorsObjs.red1,
5442 '&.url': colorsObjs.cyan1,
5443 '&.symbol': colorsObjs.cyan1,
5444 '&.number': colorsObjs.cyan1,
5445 '&.boolean': colorsObjs.cyan1,
5446 '&.variable': colorsObjs.cyan1,
5447 '&.constant': colorsObjs.cyan1,
5448 '&.inserted': colorsObjs.cyan1,
5449 '&.atrule': colorsObjs.blue1,
5450 '&.keyword': colorsObjs.blue1,
5451 '&.attr-value': colorsObjs.blue1,
5452 '&.punctuation': colorsObjs.gray1,
5453 '&.operator': colorsObjs.gray1,
5454 '&.function': colorsObjs.gray1,
5455 '&.deleted': colorsObjs.red2,
5456 '&.important': {
5457 fontWeight: 'bold'
5458 },
5459 '&.bold': {
5460 fontWeight: 'bold'
5461 },
5462 '&.italic': {
5463 fontStyle: 'italic'
5464 },
5465 '&.class-name': colorsObjs.cyan2,
5466 '&.selector': colorsObjs.red3,
5467 '&.attr-name': colorsObjs.red4,
5468 '&.property': colorsObjs.red4,
5469 '&.regex': colorsObjs.red4,
5470 '&.entity': colorsObjs.red4,
5471 '&.directive.tag .tag': Object.assign({
5472 background: '#ffff00'
5473 }, colorsObjs.gray1)
5474 },
5475 'language-json .token.boolean': colorsObjs.blue1,
5476 'language-json .token.number': colorsObjs.blue1,
5477 'language-json .token.property': colorsObjs.cyan2,
5478 namespace: {
5479 opacity: 0.7
5480 }
5481 };
5482};
5483
5484var lightSyntaxColors = {
5485 green1: '#008000',
5486 red1: '#A31515',
5487 red2: '#9a050f',
5488 red3: '#800000',
5489 red4: '#ff0000',
5490 gray1: '#393A34',
5491 cyan1: '#36acaa',
5492 cyan2: '#2B91AF',
5493 blue1: '#0000ff',
5494 blue2: '#00009f'
5495};
5496var darkSyntaxColors = {
5497 green1: '#7C7C7C',
5498 red1: '#92C379',
5499 red2: '#9a050f',
5500 red3: '#A8FF60',
5501 red4: '#96CBFE',
5502 gray1: '#EDEDED',
5503 cyan1: '#C6C5FE',
5504 cyan2: '#FFFFB6',
5505 blue1: '#B474DD',
5506 blue2: '#00009f'
5507};
5508
5509var createColors = function createColors(vars) {
5510 return {
5511 // Changeable colors
5512 primary: vars.colorPrimary,
5513 secondary: vars.colorSecondary,
5514 tertiary: color.tertiary,
5515 ancillary: color.ancillary,
5516 // Complimentary
5517 orange: color.orange,
5518 gold: color.gold,
5519 green: color.green,
5520 seafoam: color.seafoam,
5521 purple: color.purple,
5522 ultraviolet: color.ultraviolet,
5523 // Monochrome
5524 lightest: color.lightest,
5525 lighter: color.lighter,
5526 light: color.light,
5527 mediumlight: color.mediumlight,
5528 medium: color.medium,
5529 mediumdark: color.mediumdark,
5530 dark: color.dark,
5531 darker: color.darker,
5532 darkest: color.darkest,
5533 // For borders
5534 border: color.border,
5535 // Status
5536 positive: color.positive,
5537 negative: color.negative,
5538 warning: color.warning,
5539 critical: color.critical,
5540 defaultText: vars.textColor || color.darkest,
5541 inverseText: vars.textInverseColor || color.lightest
5542 };
5543};
5544
5545var convert = function convert() {
5546 var inherit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : themes[getPreferredColorScheme()];
5547
5548 var base = inherit.base,
5549 colorPrimary = inherit.colorPrimary,
5550 colorSecondary = inherit.colorSecondary,
5551 appBg = inherit.appBg,
5552 appContentBg = inherit.appContentBg,
5553 appBorderColor = inherit.appBorderColor,
5554 appBorderRadius = inherit.appBorderRadius,
5555 fontBase = inherit.fontBase,
5556 fontCode = inherit.fontCode,
5557 textColor = inherit.textColor,
5558 textInverseColor = inherit.textInverseColor,
5559 barTextColor = inherit.barTextColor,
5560 barSelectedColor = inherit.barSelectedColor,
5561 barBg = inherit.barBg,
5562 inputBg = inherit.inputBg,
5563 inputBorder = inherit.inputBorder,
5564 inputTextColor = inherit.inputTextColor,
5565 inputBorderRadius = inherit.inputBorderRadius,
5566 brandTitle = inherit.brandTitle,
5567 brandUrl = inherit.brandUrl,
5568 brandImage = inherit.brandImage,
5569 brandTarget = inherit.brandTarget,
5570 gridCellSize = inherit.gridCellSize,
5571 rest = __rest(inherit, ["base", "colorPrimary", "colorSecondary", "appBg", "appContentBg", "appBorderColor", "appBorderRadius", "fontBase", "fontCode", "textColor", "textInverseColor", "barTextColor", "barSelectedColor", "barBg", "inputBg", "inputBorder", "inputTextColor", "inputBorderRadius", "brandTitle", "brandUrl", "brandImage", "brandTarget", "gridCellSize"]);
5572
5573 return Object.assign(Object.assign({}, rest || {}), {
5574 base: base,
5575 color: createColors(inherit),
5576 background: {
5577 app: appBg,
5578 bar: barBg,
5579 content: appContentBg,
5580 gridCellSize: gridCellSize || background.gridCellSize,
5581 hoverable: background.hoverable,
5582 positive: background.positive,
5583 negative: background.negative,
5584 warning: background.warning,
5585 critical: background.critical
5586 },
5587 typography: {
5588 fonts: {
5589 base: fontBase,
5590 mono: fontCode
5591 },
5592 weight: typography.weight,
5593 size: typography.size
5594 },
5595 animation: animation,
5596 easing: easing,
5597 input: {
5598 border: inputBorder,
5599 background: inputBg,
5600 color: inputTextColor,
5601 borderRadius: inputBorderRadius
5602 },
5603 // UI
5604 layoutMargin: 10,
5605 appBorderColor: appBorderColor,
5606 appBorderRadius: appBorderRadius,
5607 // Toolbar default/active colors
5608 barTextColor: barTextColor,
5609 barSelectedColor: barSelectedColor || colorSecondary,
5610 barBg: barBg,
5611 // Brand logo/text
5612 brand: {
5613 title: brandTitle,
5614 url: brandUrl,
5615 image: brandImage || (brandTitle ? null : undefined),
5616 target: brandTarget
5617 },
5618 code: create({
5619 colors: base === 'light' ? lightSyntaxColors : darkSyntaxColors,
5620 mono: fontCode
5621 }),
5622 // Addon actions theme
5623 // API example https://github.com/xyc/react-inspector/blob/master/src/styles/themes/chromeLight.js
5624 addonActionsTheme: Object.assign(Object.assign({}, base === 'light' ? chromeLight : chromeDark), {
5625 BASE_FONT_FAMILY: fontCode,
5626 BASE_FONT_SIZE: typography.size.s2 - 1,
5627 BASE_LINE_HEIGHT: '18px',
5628 BASE_BACKGROUND_COLOR: 'transparent',
5629 BASE_COLOR: textColor,
5630 ARROW_COLOR: curriedOpacify$1(0.2, appBorderColor),
5631 ARROW_MARGIN_RIGHT: 4,
5632 ARROW_FONT_SIZE: 8,
5633 TREENODE_FONT_FAMILY: fontCode,
5634 TREENODE_FONT_SIZE: typography.size.s2 - 1,
5635 TREENODE_LINE_HEIGHT: '18px',
5636 TREENODE_PADDING_LEFT: 12
5637 })
5638 });
5639};
5640
5641var isEmpty = function isEmpty(o) {
5642 return Object.keys(o).length === 0;
5643};
5644
5645var isObject = function isObject(o) {
5646 return o != null && _typeof(o) === 'object';
5647};
5648
5649var hasOwnProperty = function hasOwnProperty(o) {
5650 var _Object$prototype$has;
5651
5652 for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
5653 args[_key3 - 1] = arguments[_key3];
5654 }
5655
5656 return (_Object$prototype$has = Object.prototype.hasOwnProperty).call.apply(_Object$prototype$has, [o].concat(args));
5657};
5658
5659var deletedDiff = function deletedDiff(lhs, rhs) {
5660 if (lhs === rhs || !isObject(lhs) || !isObject(rhs)) return {};
5661 var l = lhs;
5662 var r = rhs;
5663 return Object.keys(l).reduce(function (acc, key) {
5664 if (hasOwnProperty(r, key)) {
5665 var difference = deletedDiff(l[key], r[key]);
5666 if (isObject(difference) && isEmpty(difference)) return acc;
5667 acc[key] = difference;
5668 return acc;
5669 }
5670
5671 acc[key] = undefined;
5672 return acc;
5673 }, {});
5674};
5675
5676function dedent(templ) {
5677 var values = [];
5678
5679 for (var _i = 1; _i < arguments.length; _i++) {
5680 values[_i - 1] = arguments[_i];
5681 }
5682
5683 var strings = Array.from(typeof templ === 'string' ? [templ] : templ);
5684 strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, '');
5685 var indentLengths = strings.reduce(function (arr, str) {
5686 var matches = str.match(/\n([\t ]+|(?!\s).)/g);
5687
5688 if (matches) {
5689 return arr.concat(matches.map(function (match) {
5690 var _a, _b;
5691
5692 return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
5693 }));
5694 }
5695
5696 return arr;
5697 }, []);
5698
5699 if (indentLengths.length) {
5700 var pattern_1 = new RegExp("\n[\t ]{" + Math.min.apply(Math, indentLengths) + "}", 'g');
5701 strings = strings.map(function (str) {
5702 return str.replace(pattern_1, '\n');
5703 });
5704 }
5705
5706 strings[0] = strings[0].replace(/^\r?\n/, '');
5707 var string = strings[0];
5708 values.forEach(function (value, i) {
5709 var endentations = string.match(/(?:^|\n)( *)$/);
5710 var endentation = endentations ? endentations[1] : '';
5711 var indentedValue = value;
5712
5713 if (typeof value === 'string' && value.includes('\n')) {
5714 indentedValue = String(value).split('\n').map(function (str, i) {
5715 return i === 0 ? str : "" + endentation + str;
5716 }).join('\n');
5717 }
5718
5719 string += indentedValue + strings[i + 1];
5720 });
5721 return string;
5722}
5723
5724var ensure = function ensure(input) {
5725 if (!input) {
5726 return convert(theme$1);
5727 }
5728
5729 var missing = deletedDiff(theme$1, input);
5730
5731 if (Object.keys(missing).length) {
5732 logger.warn(dedent(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n Your theme is missing properties, you should update your theme!\n\n theme-data missing:\n "]))), missing);
5733 }
5734
5735 return convert(input);
5736}; // eslint-disable-next-line @typescript-eslint/triple-slash-reference
5737
5738
5739var useTheme = useTheme$1;
5740var withTheme = withTheme$1;
5741var Global = Global$1;
5742var styled = newStyled;
5743var ignoreSsrWarning = '/* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */';
5744export { CacheProvider, ClassNames, Global, ThemeProvider, background, color, convert, create$1 as create, createCache, createGlobal, createReset, css, darkenColor as darken, ensure, ignoreSsrWarning, isPropValid, jsx, keyframes, lightenColor as lighten, styled, themes, typography, useTheme, withTheme };