@10up/block-components
Version:
10up Components built for the WordPress Block Editor.
1,273 lines (1,082 loc) • 113 kB
JavaScript
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./components/content-search/SearchItem.tsx":
/*!**************************************************!*\
!*** ./components/content-search/SearchItem.tsx ***!
\**************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ defaultRenderItemType: function() { return /* binding */ defaultRenderItemType; }
/* harmony export */ });
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _emotion_styled__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @emotion/styled */ "@emotion/styled");
/* harmony import */ var _emotion_styled__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_emotion_styled__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url");
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities");
/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/rich-text */ "@wordpress/rich-text");
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_5__);
var _jsxFileName = "/Users/fabiankaegy/Developer/10up/block-components/components/content-search/SearchItem.tsx";
const SearchItemWrapper = _emotion_styled__WEBPACK_IMPORTED_MODULE_1___default()((0,_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.Button))`
&&& {
display: flex;
text-align: left;
width: 100%;
justify-content: space-between;
align-items: center;
border-radius: 2px;
box-sizing: border-box;
height: auto !important;
padding: 0.3em 0.7em;
overflow: hidden;
&:hover {
/* Add opacity background to support future color changes */
/* Reduce background from #ddd to 0.05 for text contrast */
background-color: rgba(0, 0, 0, 0.05);
}
}
`;
const SearchItemHeader = (_emotion_styled__WEBPACK_IMPORTED_MODULE_1___default().span)`
display: flex;
flex-direction: column;
align-items: flex-start;
`;
const SearchItemTitle = (_emotion_styled__WEBPACK_IMPORTED_MODULE_1___default().span)`
padding-right: ${({
showType
}) => showType ? 0 : undefined};
`;
const SearchItemInfo = (_emotion_styled__WEBPACK_IMPORTED_MODULE_1___default().span)`
padding-right: ${({
showType
}) => showType ? 0 : undefined};
`;
const SearchItemType = (_emotion_styled__WEBPACK_IMPORTED_MODULE_1___default().span)`
background-color: rgba(0, 0, 0, 0.05);
color: black;
padding: 2px 4px;
text-transform: capitalize;
border-radius: 2px;
flex-shrink: 0;
`;
const StyledTextHighlight = _emotion_styled__WEBPACK_IMPORTED_MODULE_1___default()((0,_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.TextHighlight))`
margin: 0 !important;
padding: 0 !important;
`;
function defaultRenderItemType(suggestion) {
// Rename 'post_tag' to 'tag'. Ideally, the API would return the localized CPT or taxonomy label.
if (suggestion.type === 'post_tag') {
return 'tag';
}
if (suggestion.subtype) {
return suggestion.subtype;
}
return suggestion.type;
}
const SearchItem = ({
item: suggestion,
onSelect: onClick,
searchTerm = '',
id = '',
contentTypes,
renderType = defaultRenderItemType
}) => {
const showType = !!(suggestion.type && contentTypes.length > 1);
const richTextContent = (0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_5__.create)({
html: suggestion.title
});
const textContent = (0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_5__.getTextContent)(richTextContent);
const titleContent = (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3__.decodeEntities)(textContent);
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.Tooltip, {
text: (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3__.decodeEntities)(suggestion.title),
__self: undefined,
__source: {
fileName: _jsxFileName,
lineNumber: 91,
columnNumber: 3
}
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(SearchItemWrapper, {
id: id,
onClick: onClick,
__self: undefined,
__source: {
fileName: _jsxFileName,
lineNumber: 92,
columnNumber: 4
}
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(SearchItemHeader, {
__self: undefined,
__source: {
fileName: _jsxFileName,
lineNumber: 93,
columnNumber: 5
}
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(SearchItemTitle, {
showType: showType,
__self: undefined,
__source: {
fileName: _jsxFileName,
lineNumber: 94,
columnNumber: 6
}
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(StyledTextHighlight, {
text: titleContent,
highlight: searchTerm,
__self: undefined,
__source: {
fileName: _jsxFileName,
lineNumber: 95,
columnNumber: 7
}
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(SearchItemInfo, {
"aria-hidden": true,
showType: showType,
__self: undefined,
__source: {
fileName: _jsxFileName,
lineNumber: 97,
columnNumber: 6
}
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.__experimentalTruncate, {
numberOfLines: 1,
limit: 55,
ellipsizeMode: "middle",
__self: undefined,
__source: {
fileName: _jsxFileName,
lineNumber: 98,
columnNumber: 7
}
}, (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_2__.filterURLForDisplay)((0,_wordpress_url__WEBPACK_IMPORTED_MODULE_2__.safeDecodeURI)(suggestion.url)) || ''))), showType && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(SearchItemType, {
__self: undefined,
__source: {
fileName: _jsxFileName,
lineNumber: 103,
columnNumber: 18
}
}, renderType(suggestion))));
};
/* harmony default export */ __webpack_exports__["default"] = (SearchItem);
/***/ }),
/***/ "./components/content-search/utils.ts":
/*!********************************************!*\
!*** ./components/content-search/utils.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ fetchSearchResults: function() { return /* binding */ fetchSearchResults; },
/* harmony export */ filterOutExcludedItems: function() { return /* binding */ filterOutExcludedItems; },
/* harmony export */ normalizeResults: function() { return /* binding */ normalizeResults; },
/* harmony export */ prepareSearchQuery: function() { return /* binding */ prepareSearchQuery; }
/* harmony export */ });
/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch");
/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url");
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__);
/* eslint-disable no-case-declarations */
const filterOutExcludedItems = ({
results,
excludeItems
}) => {
return results.filter(result => {
let keep = true;
if (excludeItems.length) {
keep = excludeItems.every(item => item.id !== result.id);
}
return keep;
});
};
/*
* Prepares a search query based on the given keyword and page number.
*/
const prepareSearchQuery = ({
keyword,
page,
mode,
perPage,
contentTypes,
queryFilter
}) => {
let searchQuery;
switch (mode) {
case 'user':
searchQuery = (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_1__.addQueryArgs)('wp/v2/users', {
search: keyword,
_fields: ['id', 'link', 'url', 'type', 'name', 'subtype']
});
break;
default:
searchQuery = (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_1__.addQueryArgs)('wp/v2/search', {
search: keyword,
subtype: contentTypes.join(','),
type: mode,
_embed: true,
per_page: perPage,
page,
_fields: ['id', 'link', 'url', 'type', 'title', 'subtype']
});
break;
}
return queryFilter(searchQuery, {
perPage,
page,
contentTypes,
mode,
keyword
});
};
/*
* Depending on the mode value, this method normalizes the format
* of the result array.
*/
const normalizeResults = ({
mode,
results,
excludeItems
}) => {
const filteredResults = filterOutExcludedItems({
results,
excludeItems
});
return filteredResults.map(item => {
switch (mode) {
case 'user':
const userItem = item;
return {
id: userItem.id,
subtype: mode,
title: userItem.name,
type: mode,
url: userItem.link
};
default:
const searchItem = item;
return {
id: searchItem.id,
subtype: searchItem.subtype,
title: searchItem.title,
type: searchItem.type,
url: searchItem.url
};
}
});
};
async function fetchSearchResults({
keyword,
page,
mode,
perPage,
contentTypes,
queryFilter,
excludeItems,
signal
}) {
const searchQueryString = prepareSearchQuery({
keyword,
page,
mode,
perPage,
contentTypes,
queryFilter
});
const response = await _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default()({
path: searchQueryString,
parse: false,
signal
});
const totalPages = parseInt(response.headers && response.headers.get('X-WP-TotalPages') || '0', 10);
let results;
switch (mode) {
case 'user':
results = await response.json();
break;
default:
results = await response.json();
break;
}
const normalizedResults = normalizeResults({
results,
excludeItems,
mode
});
const hasNextPage = totalPages > page;
const hasPreviousPage = page > 1;
return {
results: normalizedResults,
nextPage: hasNextPage ? page + 1 : undefined,
previousPage: hasPreviousPage ? page - 1 : undefined
};
}
/***/ }),
/***/ "./components/styled-components-context/index.tsx":
/*!********************************************************!*\
!*** ./components/styled-components-context/index.tsx ***!
\********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ StyledComponentContext: function() { return /* binding */ StyledComponentContext; }
/* harmony export */ });
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _emotion_react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @emotion/react */ "@emotion/react");
/* harmony import */ var _emotion_react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_emotion_react__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _emotion_cache__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @emotion/cache */ "./node_modules/@emotion/cache/dist/emotion-cache.browser.development.esm.js");
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose");
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_3__);
var _jsxFileName = "/Users/fabiankaegy/Developer/10up/block-components/components/styled-components-context/index.tsx";
const StyledComponentContext = ({
children,
cacheKey
}) => {
const fallbackKey = `${(0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_3__.useInstanceId)(StyledComponentContext)}`;
const defaultCache = (0,_emotion_cache__WEBPACK_IMPORTED_MODULE_2__["default"])({
key: cacheKey || fallbackKey
});
const [cache, setCache] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(defaultCache);
const nodeRef = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_3__.useRefEffect)(node => {
if (node) {
setCache((0,_emotion_cache__WEBPACK_IMPORTED_MODULE_2__["default"])({
key: cacheKey || fallbackKey,
container: node
}));
}
return () => {
setCache(defaultCache);
};
}, [cacheKey, fallbackKey]);
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", {
ref: nodeRef,
style: {
display: 'none'
},
__self: undefined,
__source: {
fileName: _jsxFileName,
lineNumber: 48,
columnNumber: 4
}
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_emotion_react__WEBPACK_IMPORTED_MODULE_1__.CacheProvider, {
value: cache,
__self: undefined,
__source: {
fileName: _jsxFileName,
lineNumber: 49,
columnNumber: 4
}
}, children));
};
/***/ }),
/***/ "./hooks/use-debounced-input/index.ts":
/*!********************************************!*\
!*** ./hooks/use-debounced-input/index.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ useDebouncedInput: function() { return /* binding */ useDebouncedInput; }
/* harmony export */ });
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose");
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_1__);
/**
* Helper hook for input fields that need to debounce the value before using it.
*
* @param {string} defaultValue The default value to use.
* @param {DebouncedInputOptions} options Set of options for useDebounce, 350ms is the default
*
* @returns The input value, the setter and the debounced input value.
*/
function useDebouncedInput(defaultValue = '', options = {
delay: 350
}) {
const [input, setInput] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(defaultValue);
const [debouncedInput, setDebouncedState] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(defaultValue);
const {
delay
} = options;
const setDebouncedInput = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_1__.useDebounce)(setDebouncedState, delay);
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
setDebouncedInput(input);
}, [input, setDebouncedInput]);
return [input, setInput, debouncedInput];
}
/***/ }),
/***/ "./hooks/use-on-click-outside.ts":
/*!***************************************!*\
!*** ./hooks/use-on-click-outside.ts ***!
\***************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ useOnClickOutside: function() { return /* binding */ useOnClickOutside; }
/* harmony export */ });
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose");
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_0__);
/**
* useOnClickOutside
*
* Note: This hook is only intended to be used in the WordPress backend/block editor.
*
* @param {Function} onClickOutside callback that will get invoked when the user clicks outside of the target
* @returns {object} ref to the target element
*/
function useOnClickOutside(onClickOutside) {
const ref = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_0__.useRefEffect)(element => {
if (!element) {
return () => {};
}
const listener = event => {
// Do nothing if clicking ref's element or descendent elements
if (!element || element.contains(event.target)) {
return;
}
onClickOutside(event);
};
const ownerDocument = element.ownerDocument || document;
const isRenderedInsideIframe = ownerDocument !== document;
const editorCanvasIframe = document.querySelector('[name="editor-canvas"]');
const editorCanvasDocument = editorCanvasIframe?.contentDocument;
ownerDocument.addEventListener('mousedown', listener);
ownerDocument.addEventListener('touchstart', listener);
// If the element is rendered inside an iframe, we need to listen to events on the parent document
// as well to detect clicks outside the iframe.
if (isRenderedInsideIframe) {
document.addEventListener('mousedown', listener);
document.addEventListener('touchstart', listener);
// If the element is rendered outside the editor canvas iframe, we need to listen to events on the editor canvas
// document as well to detect clicks inside the editor canvas.
} else if (editorCanvasDocument) {
editorCanvasDocument.addEventListener('mousedown', listener);
editorCanvasDocument.addEventListener('touchstart', listener);
}
return () => {
ownerDocument.removeEventListener('mousedown', listener);
ownerDocument.removeEventListener('touchstart', listener);
if (isRenderedInsideIframe) {
document.removeEventListener('mousedown', listener);
document.removeEventListener('touchstart', listener);
} else if (editorCanvasDocument) {
editorCanvasDocument.removeEventListener('mousedown', listener);
editorCanvasDocument.removeEventListener('touchstart', listener);
}
};
}, [onClickOutside]);
return ref;
}
/***/ }),
/***/ "./node_modules/@emotion/cache/dist/emotion-cache.browser.development.esm.js":
/*!***********************************************************************************!*\
!*** ./node_modules/@emotion/cache/dist/emotion-cache.browser.development.esm.js ***!
\***********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ createCache; }
/* harmony export */ });
/* harmony import */ var _emotion_sheet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @emotion/sheet */ "./node_modules/@emotion/sheet/dist/emotion-sheet.development.esm.js");
/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! stylis */ "./node_modules/stylis/src/Tokenizer.js");
/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! stylis */ "./node_modules/stylis/src/Utility.js");
/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! stylis */ "./node_modules/stylis/src/Enum.js");
/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! stylis */ "./node_modules/stylis/src/Serializer.js");
/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! stylis */ "./node_modules/stylis/src/Middleware.js");
/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! stylis */ "./node_modules/stylis/src/Parser.js");
/* harmony import */ var _emotion_weak_memoize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @emotion/weak-memoize */ "./node_modules/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js");
/* harmony import */ var _emotion_memoize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @emotion/memoize */ "./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js");
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
var previous = 0;
var character = 0;
while (true) {
previous = character;
character = (0,stylis__WEBPACK_IMPORTED_MODULE_3__.peek)(); // &\f
if (previous === 38 && character === 12) {
points[index] = 1;
}
if ((0,stylis__WEBPACK_IMPORTED_MODULE_3__.token)(character)) {
break;
}
(0,stylis__WEBPACK_IMPORTED_MODULE_3__.next)();
}
return (0,stylis__WEBPACK_IMPORTED_MODULE_3__.slice)(begin, stylis__WEBPACK_IMPORTED_MODULE_3__.position);
};
var toRules = function toRules(parsed, points) {
// pretend we've started with a comma
var index = -1;
var character = 44;
do {
switch ((0,stylis__WEBPACK_IMPORTED_MODULE_3__.token)(character)) {
case 0:
// &\f
if (character === 38 && (0,stylis__WEBPACK_IMPORTED_MODULE_3__.peek)() === 12) {
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
// and when it should just concatenate the outer and inner selectors
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
points[index] = 1;
}
parsed[index] += identifierWithPointTracking(stylis__WEBPACK_IMPORTED_MODULE_3__.position - 1, points, index);
break;
case 2:
parsed[index] += (0,stylis__WEBPACK_IMPORTED_MODULE_3__.delimit)(character);
break;
case 4:
// comma
if (character === 44) {
// colon
parsed[++index] = (0,stylis__WEBPACK_IMPORTED_MODULE_3__.peek)() === 58 ? '&\f' : '';
points[index] = parsed[index].length;
break;
}
// fallthrough
default:
parsed[index] += (0,stylis__WEBPACK_IMPORTED_MODULE_4__.from)(character);
}
} while (character = (0,stylis__WEBPACK_IMPORTED_MODULE_3__.next)());
return parsed;
};
var getRules = function getRules(value, points) {
return (0,stylis__WEBPACK_IMPORTED_MODULE_3__.dealloc)(toRules((0,stylis__WEBPACK_IMPORTED_MODULE_3__.alloc)(value), points));
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
var fixedElements = /* #__PURE__ */new WeakMap();
var compat = function compat(element) {
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
// negative .length indicates that this rule has been already prefixed
element.length < 1) {
return;
}
var value = element.value;
var parent = element.parent;
var isImplicitRule = element.column === parent.column && element.line === parent.line;
while (parent.type !== 'rule') {
parent = parent.parent;
if (!parent) return;
} // short-circuit for the simplest case
if (element.props.length === 1 && value.charCodeAt(0) !== 58
/* colon */
&& !fixedElements.get(parent)) {
return;
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
if (isImplicitRule) {
return;
}
fixedElements.set(element, true);
var points = [];
var rules = getRules(value, points);
var parentRules = parent.props;
for (var i = 0, k = 0; i < rules.length; i++) {
for (var j = 0; j < parentRules.length; j++, k++) {
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
}
}
};
var removeLabel = function removeLabel(element) {
if (element.type === 'decl') {
var value = element.value;
if ( // charcode for l
value.charCodeAt(0) === 108 && // charcode for b
value.charCodeAt(2) === 98) {
// this ignores label
element["return"] = '';
element.value = '';
}
}
};
var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
var isIgnoringComment = function isIgnoringComment(element) {
return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
};
var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
return function (element, index, children) {
if (element.type !== 'rule' || cache.compat) return;
var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
if (unsafePseudoClasses) {
var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent`
//
// considering this input:
// .a {
// .b /* comm */ {}
// color: hotpink;
// }
// we get output corresponding to this:
// .a {
// & {
// /* comm */
// color: hotpink;
// }
// .b {}
// }
var commentContainer = isNested ? element.parent.children : // global rule at the root level
children;
for (var i = commentContainer.length - 1; i >= 0; i--) {
var node = commentContainer[i];
if (node.line < element.line) {
break;
} // it is quite weird but comments are *usually* put at `column: element.column - 1`
// so we seek *from the end* for the node that is earlier than the rule's `element` and check that
// this will also match inputs like this:
// .a {
// /* comm */
// .b {}
// }
//
// but that is fine
//
// it would be the easiest to change the placement of the comment to be the first child of the rule:
// .a {
// .b { /* comm */ }
// }
// with such inputs we wouldn't have to search for the comment at all
// TODO: consider changing this comment placement in the next major version
if (node.column < element.column) {
if (isIgnoringComment(node)) {
return;
}
break;
}
}
unsafePseudoClasses.forEach(function (unsafePseudoClass) {
console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
});
}
};
};
var isImportRule = function isImportRule(element) {
return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
};
var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
for (var i = index - 1; i >= 0; i--) {
if (!isImportRule(children[i])) {
return true;
}
}
return false;
}; // use this to remove incorrect elements from further processing
// so they don't get handed to the `sheet` (or anything else)
// as that could potentially lead to additional logs which in turn could be overhelming to the user
var nullifyElement = function nullifyElement(element) {
element.type = '';
element.value = '';
element["return"] = '';
element.children = '';
element.props = '';
};
var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
if (!isImportRule(element)) {
return;
}
if (element.parent) {
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.");
nullifyElement(element);
} else if (isPrependedWithRegularRules(index, children)) {
console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
nullifyElement(element);
}
};
/* eslint-disable no-fallthrough */
function prefix(value, length) {
switch ((0,stylis__WEBPACK_IMPORTED_MODULE_4__.hash)(value, length)) {
// color-adjust
case 5103:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + 'print-' + value + value;
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
case 5737:
case 4201:
case 3177:
case 3433:
case 1641:
case 4457:
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
case 5572:
case 6356:
case 5844:
case 3191:
case 6645:
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
case 6391:
case 5879:
case 5623:
case 6135:
case 4599:
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
case 4215:
case 6389:
case 5109:
case 5365:
case 5621:
case 3829:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + value;
// appearance, user-select, transform, hyphens, text-size-adjust
case 5349:
case 4246:
case 4810:
case 6968:
case 2756:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_5__.MOZ + value + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + value + value;
// flex, flex-direction
case 6828:
case 4268:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + value + value;
// order
case 6165:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + 'flex-' + value + value;
// align-items
case 5187:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /(\w+).+(:[^]+)/, stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + 'box-$1$2' + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + 'flex-$1$2') + value;
// align-self
case 5443:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + 'flex-item-' + (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /flex-|-self/, '') + value;
// align-content
case 4675:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + 'flex-line-pack' + (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /align-content|flex-|-self/, '') + value;
// flex-shrink
case 5548:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, 'shrink', 'negative') + value;
// flex-basis
case 5292:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, 'basis', 'preferred-size') + value;
// flex-grow
case 6060:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + 'box-' + (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, '-grow', '') + stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, 'grow', 'positive') + value;
// transition
case 4554:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /([^-])(transform)/g, '$1' + stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + '$2') + value;
// cursor
case 6187:
return (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)((0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)((0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /(zoom-|grab)/, stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + '$1'), /(image-set)/, stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + '$1'), value, '') + value;
// background, background-image
case 5495:
case 3959:
return (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /(image-set\([^]*)/, stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + '$1' + '$`$1');
// justify-content
case 4968:
return (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)((0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /(.+:)(flex-)?(.*)/, stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + 'box-pack:$3' + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + value;
// (margin|padding)-inline-(start|end)
case 4095:
case 3583:
case 4068:
case 2532:
return (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /(.+)-inline(.+)/, stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + '$1$2') + value;
// (min|max)?(width|height|inline-size|block-size)
case 8116:
case 7059:
case 5753:
case 5535:
case 5445:
case 5701:
case 4933:
case 4677:
case 5533:
case 5789:
case 5021:
case 4765:
// stretch, max-content, min-content, fill-available
if ((0,stylis__WEBPACK_IMPORTED_MODULE_4__.strlen)(value) - 1 - length > 6) switch ((0,stylis__WEBPACK_IMPORTED_MODULE_4__.charat)(value, length + 1)) {
// (m)ax-content, (m)in-content
case 109:
// -
if ((0,stylis__WEBPACK_IMPORTED_MODULE_4__.charat)(value, length + 4) !== 45) break;
// (f)ill-available, (f)it-content
case 102:
return (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /(.+:)(.+)-([^]+)/, '$1' + stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + '$2-$3' + '$1' + stylis__WEBPACK_IMPORTED_MODULE_5__.MOZ + ((0,stylis__WEBPACK_IMPORTED_MODULE_4__.charat)(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
// (s)tretch
case 115:
return ~(0,stylis__WEBPACK_IMPORTED_MODULE_4__.indexof)(value, 'stretch') ? prefix((0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, 'stretch', 'fill-available'), length) + value : value;
}
break;
// position: sticky
case 4949:
// (s)ticky?
if ((0,stylis__WEBPACK_IMPORTED_MODULE_4__.charat)(value, length + 1) !== 115) break;
// display: (flex|inline-flex)
case 6444:
switch ((0,stylis__WEBPACK_IMPORTED_MODULE_4__.charat)(value, (0,stylis__WEBPACK_IMPORTED_MODULE_4__.strlen)(value) - 3 - (~(0,stylis__WEBPACK_IMPORTED_MODULE_4__.indexof)(value, '!important') && 10))) {
// stic(k)y
case 107:
return (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, ':', ':' + stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT) + value;
// (inline-)?fl(e)x
case 101:
return (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + ((0,stylis__WEBPACK_IMPORTED_MODULE_4__.charat)(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + '$2$3' + '$1' + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + '$2box$3') + value;
}
break;
// writing-mode
case 5936:
switch ((0,stylis__WEBPACK_IMPORTED_MODULE_4__.charat)(value, length + 11)) {
// vertical-l(r)
case 114:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
// vertical-r(l)
case 108:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
// horizontal(-)tb
case 45:
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
}
return stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_5__.MS + value + value;
}
return value;
}
var prefixer = function prefixer(element, index, children, callback) {
if (element.length > -1) if (!element["return"]) switch (element.type) {
case stylis__WEBPACK_IMPORTED_MODULE_5__.DECLARATION:
element["return"] = prefix(element.value, element.length);
break;
case stylis__WEBPACK_IMPORTED_MODULE_5__.KEYFRAMES:
return (0,stylis__WEBPACK_IMPORTED_MODULE_6__.serialize)([(0,stylis__WEBPACK_IMPORTED_MODULE_3__.copy)(element, {
value: (0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(element.value, '@', '@' + stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT)
})], callback);
case stylis__WEBPACK_IMPORTED_MODULE_5__.RULESET:
if (element.length) return (0,stylis__WEBPACK_IMPORTED_MODULE_4__.combine)(element.props, function (value) {
switch ((0,stylis__WEBPACK_IMPORTED_MODULE_4__.match)(value, /(::plac\w+|:read-\w+)/)) {
// :read-(only|write)
case ':read-only':
case ':read-write':
return (0,stylis__WEBPACK_IMPORTED_MODULE_6__.serialize)([(0,stylis__WEBPACK_IMPORTED_MODULE_3__.copy)(element, {
props: [(0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /:(read-\w+)/, ':' + stylis__WEBPACK_IMPORTED_MODULE_5__.MOZ + '$1')]
})], callback);
// :placeholder
case '::placeholder':
return (0,stylis__WEBPACK_IMPORTED_MODULE_6__.serialize)([(0,stylis__WEBPACK_IMPORTED_MODULE_3__.copy)(element, {
props: [(0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /:(plac\w+)/, ':' + stylis__WEBPACK_IMPORTED_MODULE_5__.WEBKIT + 'input-$1')]
}), (0,stylis__WEBPACK_IMPORTED_MODULE_3__.copy)(element, {
props: [(0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /:(plac\w+)/, ':' + stylis__WEBPACK_IMPORTED_MODULE_5__.MOZ + '$1')]
}), (0,stylis__WEBPACK_IMPORTED_MODULE_3__.copy)(element, {
props: [(0,stylis__WEBPACK_IMPORTED_MODULE_4__.replace)(value, /:(plac\w+)/, stylis__WEBPACK_IMPORTED_MODULE_5__.MS + 'input-$1')]
})], callback);
}
return '';
});
}
};
var defaultStylisPlugins = [prefixer];
var getSourceMap;
{
var sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
getSourceMap = function getSourceMap(styles) {
var matches = styles.match(sourceMapPattern);
if (!matches) return;
return matches[matches.length - 1];
};
}
var createCache = function createCache(options) {
var key = options.key;
if (!key) {
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.");
}
if (key === 'css') {
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
// note this very very intentionally targets all style elements regardless of the key to ensure
// that creating a cache works inside of render of a React component
Array.prototype.forEach.call(ssrStyles, function (node) {
// we want to only move elements which have a space in the data-emotion attribute value
// because that indicates that it is an Emotion 11 server-side rendered style elements
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
// will not result in the Emotion 10 styles being destroyed
var dataEmotionAttribute = node.getAttribute('data-emotion');
if (dataEmotionAttribute.indexOf(' ') === -1) {
return;
}
document.head.appendChild(node);
node.setAttribute('data-s', '');
});
}
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
{
if (/[^a-z-]/.test(key)) {
throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
}
}
var inserted = {};
var container;
var nodesToHydrate = [];
{
container = options.container || document.head;
Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
var attrib = node.getAttribute("data-emotion").split(' ');
for (var i = 1; i < attrib.length; i++) {
inserted[attrib[i]] = true;
}
nodesToHydrate.push(node);
});
}
var _insert;
var omnipresentPlugins = [compat, removeLabel];
{
omnipresentPlugins.push(createUnsafeSelectorsAlarm({
get compat() {
return cache.compat;
}
}), incorrectImportAlarm);
}
{
var currentSheet;
var finalizingPlugins = [stylis__WEBPACK_IMPORTED_MODULE_6__.stringify, function (element) {
if (!element.root) {
if (element["return"]) {
currentSheet.insert(element["return"]);
} else if (element.value && element.type !== stylis__WEBPACK_IMPORTED_MODULE_5__.COMMENT) {
// insert empty rule in non-production environments
// so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
currentSheet.insert(element.value + "{}");
}
}
} ];
var serializer = (0,stylis__WEBPACK_IMPORTED_MODULE_7__.middleware)(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
var stylis = function stylis(styles) {
return (0,stylis__WEBPACK_IMPORTED_MODULE_6__.serialize)((0,stylis__WEBPACK_IMPORTED_MODULE_8__.compile)(styles), serializer);
};
_insert = function insert(selector, serialized, sheet, shouldCache) {
currentSheet = sheet;
if (getSourceMap) {
var sourceMap = getSourceMap(serialized.styles);
if (sourceMap) {
currentSheet = {
insert: function insert(rule) {
sheet.insert(rule + sourceMap);
}
};
}
}
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
if (shouldCache) {
cache.inserted[serialized.name] = true;
}
};
}
var cache = {
key: key,
sheet: new _emotion_sheet__WEBPACK_IMPORTED_MODULE_0__.StyleSheet({
key: key,
container: container,
nonce: options.nonce,
speedy: options.speedy,
prepend: options.prepend,
insertionPoint: options.insertionPoint
}),
nonce: options.nonce,
inserted: inserted,
registered: {},
insert: _insert
};
cache.sheet.hydrate(nodesToHydrate);
return cache;
};
/***/ }),
/***/ "./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js":
/*!*******************************************************************!*\
!*** ./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js ***!
\*******************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ memoize; }
/* harmony export */ });
function memoize(fn) {
var cache = Object.create(null);
return function (arg) {
if (cache[arg] === undefined) cache[arg] = fn(arg);
return cache[arg];
};
}
/***/ }),
/***/ "./node_modules/@emotion/sheet/dist/emotion-sheet.development.esm.js":
/*!***************************************************************************!*\
!*** ./node_modules/@emotion/sheet/dist/emotion-sheet.development.esm.js ***!
\***************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ StyleSheet: function() { return /* binding */ StyleSheet; }
/* harmony export */ });
var isDevelopment = true;
/*
Based off glamor's StyleSheet, thanks Sunil ❤️
high performance StyleSheet for css-in-js systems
- uses multiple style tags behind the scenes for millions of rules
- uses `insertRule` for appending in production for *much* faster performance
// usage
import { StyleSheet } from '@emotion/sheet'
let styleSheet = new StyleSheet({ key: '', container: document.head })
styleSheet.insert('#box { border: 1px solid red; }')
- appends a css rule into the stylesheet
styleSheet.flush()
- empties the stylesheet of all its contents
*/
function sheetForTag(tag) {
if (tag.sheet) {
return tag.sheet;
} // this weirdness brought to you by firefox
/* istanbul ignore next */
for (var i = 0; i < document.styleSheets.length; i++) {
if (document.styleSheets[i].ownerNode === tag) {
return document.styleSheets[i];
}
} // this function should always return with a value
// TS can't understand it though so we make it stop complaining here
return undefined;
}
function createStyleElement(options) {
var tag = document.createElement('style');
tag.setAttribute('data-emotion', options.key);
if (options.nonce !== undefined) {
tag.setAttribute('nonce', options.nonce);
}
tag.appendChild(document.createTextNode(''));
tag.setAttribute('data-s', '');
return tag;
}
var StyleSheet = /*#__PURE__*/function () {
// Using Node instead of HTMLElement since container may be a ShadowRoot
function StyleSheet(options) {
var _this = this;
this._insertTag = function (tag) {
var before;
if (_this.tags.length === 0) {
if (_this.insertionPoint) {
before = _this.insertionPoint.nextSibling;
} else if (_this.prepend) {
before = _this.container.firstChild;
} else {
before = _this.before;
}
} else {
before = _this.tags[_this.tags.length - 1].nextSibling;
}
_this.container.insertBefore(tag, before);
_this.tags.push(tag);
};
this.isSpeedy = options.speedy === undefined ? !isDevelopment : options.speedy;
this.tags = [];
this.ctr = 0;
this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
this.key = options.key;
this.container = options.container;
this.prepend = options.prepend;
this.insertionPoint = options.insertionPoint;
this.before = null;
}
var _proto = StyleSheet.prototype;
_proto.hydrate = function hydrate(nodes) {
nodes.forEach(this._insertTag);
};
_proto.insert = function insert(rule) {
// the max length is how many rules we have per style tag, it's 65000 in speedy mode
// it's 1 in dev because we insert source maps that map a single rule to a location
// and you can only have one source map per style tag
if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
this._insertTag(createStyleElement(this));
}
var