UNPKG

styled-components

Version:

CSS for the <Component> Age. Style components your way with speed, strong typing, and flexibility.

3 lines (2 loc) 35.3 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("@emotion/is-prop-valid"),n=require("react"),r=require("stylis"),o=require("@emotion/unitless");function s(e){return e&&e.__esModule?e:{default:e}}function i(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var a=/*#__PURE__*/s(t),c=/*#__PURE__*/s(n),u=/*#__PURE__*/i(r),l=/*#__PURE__*/s(o),d="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",p="active",h="data-styled-version",f="6.3.11",m="/*!sc*/\n",y="undefined"!=typeof window&&"undefined"!=typeof document,v=void 0===c.default.createContext,g=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),S={},_="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function w(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=e[0],r=[],o=1,s=e.length;o<s;o+=1)r.push(e[o]);return r.forEach(function(e){n=n.replace(/%[a-z]/,e)}),n}function b(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return"production"===process.env.NODE_ENV?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t," for more information.").concat(n.length>0?" Args: ".concat(n.join(", ")):"")):new Error(w.apply(void 0,e.__spreadArray([_[t]],n,!1)).trim())}var C=1<<30,E=new Map,N=new Map,A=1,P=function(e){if(E.has(e))return E.get(e);for(;N.has(A);)A++;var t=A++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>C))throw b(16,"".concat(t));return E.set(e,t),N.set(t,e),t},I=function(e,t){A=t+1,E.set(e,t),N.set(t,e)},x=/invalid hook call/i,O=new Set,T=function(t,n){if("production"!==process.env.NODE_ENV){if(v)return;var r=n?' with the id of "'.concat(n,'"'):"",o="The component ".concat(t).concat(r," has been created dynamically.\n")+"You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.\nSee https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.\n",s=console.error;try{var i=!0;console.error=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];x.test(t)?(i=!1,O.delete(o)):s.apply(void 0,e.__spreadArray([t],n,!1))},"function"==typeof c.default.useState&&c.default.useState(null),i&&!O.has(o)&&(console.warn(o),O.add(o))}catch(e){x.test(e.message)&&O.delete(o)}finally{console.error=s}}},D=Object.freeze([]),R=Object.freeze({});function j(e,t,n){return void 0===n&&(n=R),e.theme!==n.theme&&e.theme||t||n.theme}var k=new Set(["a","abbr","address","area","article","aside","audio","b","bdi","bdo","blockquote","body","button","br","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","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","map","mark","menu","meter","nav","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","slot","small","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tspan","use"]),M=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,V=/(^-|-$)/g;function G(e){return e.replace(M,"-").replace(V,"")}var F=/(a)(d)/gi,z=function(e){return String.fromCharCode(e+(e>25?39:97))};function B(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=z(t%52)+n;return(z(t%52)+n).replace(F,"$1-$2")}var L,$=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},q=function(e){return $(5381,e)};function Y(e){return B(q(e)>>>0)}function W(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function H(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var U="function"==typeof Symbol&&Symbol.for,J=U?Symbol.for("react.memo"):60115,X=U?Symbol.for("react.forward_ref"):60112,Z={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},K={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Q={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},ee=((L={})[X]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},L[J]=Q,L);function te(e){return("type"in(t=e)&&t.type.$$typeof)===J?Q:"$$typeof"in e?ee[e.$$typeof]:Z;var t}var ne=Object.defineProperty,re=Object.getOwnPropertyNames,oe=Object.getOwnPropertySymbols,se=Object.getOwnPropertyDescriptor,ie=Object.getPrototypeOf,ae=Object.prototype;function ce(e,t,n){if("string"!=typeof t){if(ae){var r=ie(t);r&&r!==ae&&ce(e,r,n)}var o=re(t);oe&&(o=o.concat(oe(t)));for(var s=te(e),i=te(t),a=0;a<o.length;++a){var c=o[a];if(!(c in K||n&&n[c]||i&&c in i||s&&c in s)){var u=se(t,c);try{ne(e,c,u)}catch(e){}}}}return e}function ue(e){return"function"==typeof e}function le(e){return"object"==typeof e&&"styledComponentId"in e}function de(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function pe(e,t){return e.join(t||"")}function he(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function fe(e,t,n){if(void 0===n&&(n=!1),!n&&!he(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=fe(e[r],t[r]);else if(he(t))for(var r in t)e[r]=fe(e[r],t[r]);return e}function me(e,t){Object.defineProperty(e,"toString",{value:t})}var ye=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e,this._cGroup=0,this._cIndex=0}return e.prototype.indexOfGroup=function(e){if(e===this._cGroup)return this._cIndex;var t=this._cIndex;if(e>this._cGroup)for(var n=this._cGroup;n<e;n++)t+=this.groupSizes[n];else for(n=this._cGroup-1;n>=e;n--)t-=this.groupSizes[n];return this._cGroup=e,this._cIndex=t,t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)if((o<<=1)<0)throw b(16,"".concat(e));this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var s=r;s<o;s++)this.groupSizes[s]=0}for(var i=this.indexOfGroup(e+1),a=0,c=(s=0,t.length);s<c;s++)this.tag.insertRule(i,t[s])&&(this.groupSizes[e]++,i++,a++);a>0&&this._cGroup>e&&(this._cIndex+=a)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),r=n+t;this.groupSizes[e]=0;for(var o=n;o<r;o++)this.tag.deleteRule(n);t>0&&this._cGroup>e&&(this._cIndex-=t)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,s=r;s<o;s++)t+=this.tag.getRule(s)+m;return t},e}(),ve="style[".concat(d,"][").concat(h,'="').concat(f,'"]'),ge=new RegExp("^".concat(d,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Se=function(e){return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot||"host"in e&&11===e.nodeType},_e=function(e){if(!e)return document;if(Se(e))return e;if("getRootNode"in e){var t=e.getRootNode();if(Se(t))return t}return document},we=function(e,t,n){for(var r,o=n.split(","),s=0,i=o.length;s<i;s++)(r=o[s])&&e.registerName(t,r)},be=function(e,t){for(var n,r=(null!==(n=t.textContent)&&void 0!==n?n:"").split(m),o=[],s=0,i=r.length;s<i;s++){var a=r[s].trim();if(a){var c=a.match(ge);if(c){var u=0|parseInt(c[1],10),l=c[2];0!==u&&(I(l,u),we(e,l,c[3]),e.getTag().insertRules(u,o)),o.length=0}else o.push(a)}}},Ce=function(e){for(var t=_e(e.options.target).querySelectorAll(ve),n=0,r=t.length;n<r;n++){var o=t[n];o&&o.getAttribute(d)!==p&&(be(e,o),o.parentNode&&o.parentNode.removeChild(o))}};function Ee(){return"undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}var Ne=function(e){var t=document.head,n=e||t,r=document.createElement("style"),o=function(e){var t=Array.from(e.querySelectorAll("style[".concat(d,"]")));return t[t.length-1]}(n),s=void 0!==o?o.nextSibling:null;r.setAttribute(d,p),r.setAttribute(h,f);var i=Ee();return i&&r.setAttribute("nonce",i),n.insertBefore(r,s),r},Ae=function(){function e(e){this.element=Ne(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){var t;if(e.sheet)return e.sheet;for(var n=null!==(t=e.getRootNode().styleSheets)&&void 0!==t?t:document.styleSheets,r=0,o=n.length;r<o;r++){var s=n[r];if(s.ownerNode===e)return s}throw b(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),Pe=function(){function e(e){this.element=Ne(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),Ie=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(e===this.length?this.rules.push(t):this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),xe=y,Oe={isServer:!y,useCSSOMInjection:!g},Te=function(){function t(t,n,r){void 0===t&&(t=R),void 0===n&&(n={});var o=this;this.options=e.__assign(e.__assign({},Oe),t),this.gs=n,this.names=new Map(r),this.server=!!t.isServer,!this.server&&y&&xe&&(xe=!1,Ce(this)),me(this,function(){return function(e){for(var t=e.getTag(),n=t.length,r="",o=function(n){var o=function(e){return N.get(e)}(n);if(void 0===o)return"continue";var s=e.names.get(o);if(void 0===s||!s.size)return"continue";var i=t.getGroup(n);if(0===i.length)return"continue";var a=d+".g"+n+'[id="'+o+'"]',c="";s.forEach(function(e){e.length>0&&(c+=e+",")}),r+=i+a+'{content:"'+c+'"}'+m},s=0;s<n;s++)o(s);return r}(o)})}return t.registerId=function(e){return P(e)},t.prototype.rehydrate=function(){!this.server&&y&&Ce(this)},t.prototype.reconstructWithOptions=function(n,r){void 0===r&&(r=!0);var o=new t(e.__assign(e.__assign({},this.options),n),this.gs,r&&this.names||void 0);return!this.server&&y&&n.target!==this.options.target&&_e(this.options.target)!==_e(n.target)&&Ce(o),o},t.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},t.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new Ie(n):t?new Ae(n):new Pe(n)}(this.options),new ye(e)));var e},t.prototype.hasNameForId=function(e,t){var n,r;return null!==(r=null===(n=this.names.get(e))||void 0===n?void 0:n.has(t))&&void 0!==r&&r},t.prototype.registerName=function(e,t){P(e);var n=this.names.get(e);n?n.add(t):this.names.set(e,new Set([t]))},t.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(P(e),n)},t.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},t.prototype.clearRules=function(e){this.getTag().clearGroup(P(e)),this.clearNames(e)},t.prototype.clearTag=function(){this.tag=void 0},t}(),De=/&/g,Re=47,je=42;function ke(e){if(-1===e.indexOf("}"))return!1;for(var t=e.length,n=0,r=0,o=!1,s=0;s<t;s++){var i=e.charCodeAt(s);if(0!==r||o||i!==Re||e.charCodeAt(s+1)!==je)if(o)i===je&&e.charCodeAt(s+1)===Re&&(o=!1,s++);else if(34!==i&&39!==i||0!==s&&92===e.charCodeAt(s-1)){if(0===r)if(123===i)n++;else if(125===i&&--n<0)return!0}else 0===r?r=i:r===i&&(r=0);else o=!0,s++}return 0!==n||0!==r}function Me(e,t){return e.map(function(e){return"rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map(function(e){return"".concat(t," ").concat(e)})),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=Me(e.children,t)),e})}function Ve(e){var t,n,r,o=void 0===e?R:e,s=o.options,i=void 0===s?R:s,a=o.plugins,c=void 0===a?D:a,l=function(e,r,o){return o.startsWith(n)&&o.endsWith(n)&&o.replaceAll(n,"").length>0?".".concat(t):e},d=c.slice();d.push(function(e){e.type===u.RULESET&&e.value.includes("&")&&(r||(r=new RegExp("\\".concat(n,"\\b"),"g")),e.props[0]=e.props[0].replace(De,n).replace(r,l))}),i.prefix&&d.push(u.prefixer),d.push(u.stringify);var p=[],h=u.middleware(d.concat(u.rulesheet(function(e){return p.push(e)}))),f=function(e,o,s,a){void 0===o&&(o=""),void 0===s&&(s=""),void 0===a&&(a="&"),t=a,n=o,r=void 0;var c=function(e){if(!ke(e))return e;for(var t=e.length,n="",r=0,o=0,s=0,i=!1,a=0;a<t;a++){var c=e.charCodeAt(a);if(0!==s||i||c!==Re||e.charCodeAt(a+1)!==je)if(i)c===je&&e.charCodeAt(a+1)===Re&&(i=!1,a++);else if(34!==c&&39!==c||0!==a&&92===e.charCodeAt(a-1)){if(0===s)if(123===c)o++;else if(125===c){if(--o<0){for(var u=a+1;u<t;){var l=e.charCodeAt(u);if(59===l||10===l)break;u++}u<t&&59===e.charCodeAt(u)&&u++,o=0,a=u-1,r=u;continue}0===o&&(n+=e.substring(r,a+1),r=a+1)}else 59===c&&0===o&&(n+=e.substring(r,a+1),r=a+1)}else 0===s?s=c:s===c&&(s=0);else i=!0,a++}if(r<t){var d=e.substring(r);ke(d)||(n+=d)}return n}(function(e){if(-1===e.indexOf("//"))return e;for(var t=e.length,n=[],r=0,o=0,s=0,i=0;o<t;){var a=e.charCodeAt(o);if(34!==a&&39!==a||0!==o&&92===e.charCodeAt(o-1))if(0===s)if(a===Re&&o+1<t&&e.charCodeAt(o+1)===je){for(o+=2;o+1<t&&(e.charCodeAt(o)!==je||e.charCodeAt(o+1)!==Re);)o++;o+=2}else if(40===a&&o>=3&&108==(32|e.charCodeAt(o-1))&&114==(32|e.charCodeAt(o-2))&&117==(32|e.charCodeAt(o-3)))i=1,o++;else if(i>0)41===a?i--:40===a&&i++,o++;else if(a===je&&o+1<t&&e.charCodeAt(o+1)===Re)o>r&&n.push(e.substring(r,o)),r=o+=2;else if(a===Re&&o+1<t&&e.charCodeAt(o+1)===Re){for(o>r&&n.push(e.substring(r,o));o<t&&10!==e.charCodeAt(o);)o++;r=o}else o++;else o++;else 0===s?s=a:s===a&&(s=0),o++}return 0===r?e:(r<t&&n.push(e.substring(r)),n.join(""))}(e)),l=u.compile(s||o?"".concat(s," ").concat(o," { ").concat(c," }"):c);return i.namespace&&(l=Me(l,i.namespace)),p=[],u.serialize(l,h),p};return f.hash=c.length?c.reduce(function(e,t){return t.name||b(15),$(e,t.name)},5381).toString():"",f}var Ge=new Te,Fe=Ve(),ze={shouldForwardProp:void 0,styleSheet:Ge,stylis:Fe},Be=v?{Provider:function(e){return e.children},Consumer:function(e){return(0,e.children)(ze)}}:c.default.createContext(ze),Le=Be.Consumer,$e=v?{Provider:function(e){return e.children},Consumer:function(e){return(0,e.children)(void 0)}}:c.default.createContext(void 0);function qe(){return v?ze:c.default.useContext(Be)}function Ye(e){if(v||!c.default.useMemo)return e.children;var t=qe().styleSheet,n=c.default.useMemo(function(){var n=t;return e.sheet?n=e.sheet:e.target&&(n=n.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(n=n.reconstructWithOptions({useCSSOMInjection:!1})),n},[e.disableCSSOMInjection,e.sheet,e.target,t]),r=c.default.useMemo(function(){return Ve({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:e.stylisPlugins})},[e.enableVendorPrefixes,e.namespace,e.stylisPlugins]),o=c.default.useMemo(function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:n,stylis:r}},[e.shouldForwardProp,n,r]);return c.default.createElement(Be.Provider,{value:o},c.default.createElement($e.Provider,{value:r},e.children))}var We=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=Fe);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,me(this,function(){throw b(12,String(n.name))})}return e.prototype.getName=function(e){return void 0===e&&(e=Fe),this.name+e.hash},e}();function He(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||e in l.default||e.startsWith("--")?String(t).trim():"".concat(t,"px")}var Ue=function(e){return e>="A"&&e<="Z"};function Je(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(1===n&&"-"===r&&"-"===e[0])return e;Ue(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var Xe=function(e){return null==e||!1===e||""===e},Ze=function(t){var n=[];for(var r in t){var o=t[r];t.hasOwnProperty(r)&&!Xe(o)&&(Array.isArray(o)&&o.isCss||ue(o)?n.push("".concat(Je(r),":"),o,";"):he(o)?n.push.apply(n,e.__spreadArray(e.__spreadArray(["".concat(r," {")],Ze(o),!1),["}"],!1)):n.push("".concat(Je(r),": ").concat(He(r,o),";")))}return n};function Ke(e,t,n,r,o){if(void 0===o&&(o=[]),"string"==typeof e)return e&&o.push(e),o;if(Xe(e))return o;if(le(e))return o.push(".".concat(e.styledComponentId)),o;if(ue(e)){if(!ue(i=e)||i.prototype&&i.prototype.isReactComponent||!t)return o.push(e),o;var s=e(t);return"production"===process.env.NODE_ENV||"object"!=typeof s||Array.isArray(s)||s instanceof We||he(s)||null===s||console.error("".concat(W(e)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),Ke(s,t,n,r,o)}var i;if(e instanceof We)return n?(e.inject(n,r),o.push(e.getName(r))):o.push(e),o;if(he(e)){for(var a=Ze(e),c=0;c<a.length;c++)o.push(a[c]);return o}if(!Array.isArray(e))return o.push(e.toString()),o;for(c=0;c<e.length;c++)Ke(e[c],t,n,r,o);return o}function Qe(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(ue(n)&&!le(n))return!1}return!0}var et=q(f),tt=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&Qe(e),this.componentId=t,this.baseHash=$(et,t),this.baseStyle=n,Te.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var r=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n).className:"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))r=de(r,this.staticRulesId);else{var o=pe(Ke(this.rules,e,t,n)),s=B($(this.baseHash,o)>>>0);if(!t.hasNameForId(this.componentId,s)){var i=n(o,".".concat(s),void 0,this.componentId);t.insertRules(this.componentId,s,i)}r=de(r,s),this.staticRulesId=s}else{for(var a=$(this.baseHash,n.hash),c="",u=0;u<this.rules.length;u++){var l=this.rules[u];if("string"==typeof l)c+=l,"production"!==process.env.NODE_ENV&&(a=$(a,l));else if(l){var d=pe(Ke(l,e,t,n));a=$($(a,String(u)),d),c+=d}}if(c){var p=B(a>>>0);if(!t.hasNameForId(this.componentId,p)){var h=n(c,".".concat(p),void 0,this.componentId);t.insertRules(this.componentId,p,h)}r=de(r,p)}}return{className:r,css:"undefined"==typeof window?t.getTag().getGroup(P(this.componentId)):""}},e}(),nt=v?{Provider:function(e){return e.children},Consumer:function(e){return(0,e.children)(void 0)}}:c.default.createContext(void 0),rt=nt.Consumer,ot={},st=new Set;function it(t,r,o){var s=le(t),i=t,u=!H(t),l=r.attrs,d=void 0===l?D:l,p=r.componentId,h=void 0===p?function(e,t){var n="string"!=typeof e?"sc":G(e);ot[n]=(ot[n]||0)+1;var r="".concat(n,"-").concat(Y(f+n+ot[n]));return t?"".concat(t,"-").concat(r):r}(r.displayName,r.parentComponentId):p,m=r.displayName,y=void 0===m?function(e){return H(e)?"styled.".concat(e):"Styled(".concat(W(e),")")}(t):m,g=r.displayName&&r.componentId?"".concat(G(r.displayName),"-").concat(r.componentId):r.componentId||h,S=s&&i.attrs?i.attrs.concat(d).filter(Boolean):d,_=r.shouldForwardProp;if(s&&i.shouldForwardProp){var w=i.shouldForwardProp;if(r.shouldForwardProp){var b=r.shouldForwardProp;_=function(e,t){return w(e,t)&&b(e,t)}}else _=w}var C=new tt(o,g,s?i.componentStyle:void 0);function E(t,r){return function(t,r,o){var s=t.attrs,i=t.componentStyle,u=t.defaultProps,l=t.foldedComponentIds,d=t.styledComponentId,p=t.target,h=v?void 0:c.default.useContext(nt),f=qe(),m=t.shouldForwardProp||f.shouldForwardProp;"production"!==process.env.NODE_ENV&&c.default.useDebugValue&&c.default.useDebugValue(d);var y=j(r,h,u)||(v?void 0:R),g=function(t,n,r){for(var o,s=e.__assign(e.__assign({},n),{className:void 0,theme:r}),i=0;i<t.length;i+=1){var a=ue(o=t[i])?o(s):o;for(var c in a)"className"===c?s.className=de(s.className,a[c]):"style"===c?s.style=e.__assign(e.__assign({},s.style),a[c]):s[c]=a[c]}return"className"in n&&"string"==typeof n.className&&(s.className=de(s.className,n.className)),s}(s,r,y),S=g.as||p,_={};for(var w in g)void 0===g[w]||"$"===w[0]||"as"===w||"theme"===w&&g.theme===y||("forwardedAs"===w?_.as=g.forwardedAs:m&&!m(w,S)||(_[w]=g[w],m||"development"!==process.env.NODE_ENV||a.default(w)||st.has(w)||!k.has(S)||(st.add(w),console.warn('styled-components: it looks like an unknown prop "'.concat(w,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var b=function(e,t){var n=qe(),r=e.generateAndInjectStyles(t,n.styleSheet,n.stylis);return"production"!==process.env.NODE_ENV&&c.default.useDebugValue&&c.default.useDebugValue(r.className),r}(i,g),C=b.className;"production"!==process.env.NODE_ENV&&t.warnTooManyClasses&&t.warnTooManyClasses(C);var E=de(l,d);C&&(E+=" "+C),g.className&&(E+=" "+g.className),_[H(S)&&!k.has(S)?"class":"className"]=E,o&&(_.ref=o);var N=n.createElement(S,_);if(v){for(var A=[],I=i,x=function(){var e=f.styleSheet.getTag().getGroup(P(I.componentId));if(e){var t="",n=f.styleSheet.names.get(I.componentId);n&&n.forEach(function(e){t&&(t+="_"),t+=e}),A.push(c.default.createElement("style",{key:"sc-".concat(I.componentId),precedence:"styled-components",href:"sc-".concat(I.componentId,"-").concat(t),children:e}))}I=I.baseStyle};I;)x();if(A.length)return A.reverse(),c.default.createElement.apply(c.default,e.__spreadArray(e.__spreadArray([c.default.Fragment,null],A,!1),[N],!1))}return N}(N,t,r)}E.displayName=y;var N=c.default.forwardRef(E);return N.attrs=S,N.componentStyle=C,N.displayName=y,N.shouldForwardProp=_,N.foldedComponentIds=s?de(i.foldedComponentIds,i.styledComponentId):"",N.styledComponentId=g,N.target=s?i.target:t,Object.defineProperty(N,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=s?function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0,o=t;r<o.length;r++)fe(e,o[r],!0);return e}({},i.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(T(y,g),N.warnTooManyClasses=function(e,t){var n={},r=!1;return function(o){if(!r&&(n[o]=!0,Object.keys(n).length>=200)){var s=t?' with the id of "'.concat(t,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(e).concat(s,".\n")+"Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"),r=!0,n={}}}}(y,g)),me(N,function(){return".".concat(N.styledComponentId)}),u&&ce(N,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),N}function at(e,t){for(var n=[e[0]],r=0,o=t.length;r<o;r+=1)n.push(t[r],e[r+1]);return n}var ct=function(e){return Object.assign(e,{isCss:!0})};function ut(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(ue(t)||he(t))return ct(Ke(at(D,e.__spreadArray([t],n,!0))));var o=t;return 0===n.length&&1===o.length&&"string"==typeof o[0]?Ke(o):ct(Ke(at(o,n)))}function lt(t,n,r){if(void 0===r&&(r=R),!n)throw b(1,n);var o=function(o){for(var s=[],i=1;i<arguments.length;i++)s[i-1]=arguments[i];return t(n,r,ut.apply(void 0,e.__spreadArray([o],s,!1)))};return o.attrs=function(o){return lt(t,n,e.__assign(e.__assign({},r),{attrs:Array.prototype.concat(r.attrs,o).filter(Boolean)}))},o.withConfig=function(o){return lt(t,n,e.__assign(e.__assign({},r),o))},o}var dt=function(e){return lt(it,e)},pt=dt;k.forEach(function(e){pt[e]=dt(e)});var ht=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=Qe(e),Te.registerId(this.componentId+1)}return e.prototype.createStyles=function(e,t,n,r){var o=r(pe(Ke(this.rules,t,n,r)),""),s=this.componentId+e;n.insertRules(s,s,o)},e.prototype.removeStyles=function(e,t){t.clearRules(this.componentId+e)},e.prototype.renderStyles=function(e,t,n,r){e>2&&Te.registerId(this.componentId+e);var o=this.componentId+e;this.isStatic?n.hasNameForId(o,o)||this.createStyles(e,t,n,r):(this.removeStyles(e,n),this.createStyles(e,t,n,r))},e}(),ft=/^\s*<\/[a-z]/i,mt=function(){function t(){var t=this;this._emitSheetCSS=function(){var e=t.instance.toString();if(!e)return"";var n=Ee(),r=pe([n&&'nonce="'.concat(n,'"'),"".concat(d,'="true"'),"".concat(h,'="').concat(f,'"')].filter(Boolean)," ");return"<style ".concat(r,">").concat(e,"</style>")},this.getStyleTags=function(){if(t.sealed)throw b(2);return t._emitSheetCSS()},this.getStyleElement=function(){var n;if(t.sealed)throw b(2);var r=t.instance.toString();if(!r)return[];var o=((n={})[d]="",n[h]=f,n.dangerouslySetInnerHTML={__html:r},n),s=Ee();return s&&(o.nonce=s),[c.default.createElement("style",e.__assign({},o,{key:"sc-0-0"}))]},this.seal=function(){t.sealed=!0},this.instance=new Te({isServer:!0}),this.sealed=!1}return t.prototype.collectStyles=function(e){if(this.sealed)throw b(2);return c.default.createElement(Ye,{sheet:this.instance},e)},t.prototype.interleaveWithNodeStream=function(e){if(this.sealed)throw b(2);this.seal();var t=require("stream").Transform,n=this.instance,r=this._emitSheetCSS,o=new t({transform:function(e,t,o){var s=e.toString(),i=r();if(n.clearTag(),ft.test(s)){var a=s.indexOf(">")+1,c=s.slice(0,a),u=s.slice(a);this.push(c+i+u)}else this.push(i+s);o()}});if("on"in e&&"function"==typeof e.on&&"pipe"in e){var s=e;return s.on("error",function(e){o.emit("error",e)}),s.pipe(o)}if("pipe"in e&&"function"==typeof e.pipe)return e.pipe(o);throw new Error("Unsupported stream type")},t}(),yt={StyleSheet:Te,mainSheet:Ge};"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");var vt="__sc-".concat(d,"__");"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window[vt]||(window[vt]=0),1===window[vt]&&console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://styled-components.com/docs/faqs#why-am-i-getting-a-warning-about-several-instances-of-module-on-the-page for more info."),window[vt]+=1),exports.ServerStyleSheet=mt,exports.StyleSheetConsumer=Le,exports.StyleSheetContext=Be,exports.StyleSheetManager=Ye,exports.ThemeConsumer=rt,exports.ThemeContext=nt,exports.ThemeProvider=function(t){if(v)return t.children;var n=c.default.useContext(nt),r=c.default.useMemo(function(){return function(t,n){if(!t)throw b(14);if(ue(t)){var r=t(n);if("production"!==process.env.NODE_ENV&&(null===r||Array.isArray(r)||"object"!=typeof r))throw b(7);return r}if(Array.isArray(t)||"object"!=typeof t)throw b(8);return n?e.__assign(e.__assign({},n),t):t}(t.theme,n)},[t.theme,n]);return t.children?c.default.createElement(nt.Provider,{value:r},t.children):null},exports.__PRIVATE__=yt,exports.createGlobalStyle=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=ut.apply(void 0,e.__spreadArray([t],n,!1)),s="sc-global-".concat(Y(JSON.stringify(o))),i=new ht(o,s);"production"!==process.env.NODE_ENV&&T(s);var a=new WeakMap,u=function(t){var n=qe(),r=v?void 0:c.default.useContext(nt),l=a.get(n.styleSheet);if(void 0===l&&(l=n.styleSheet.allocateGSInstance(s),a.set(n.styleSheet,l)),"production"!==process.env.NODE_ENV&&c.default.Children.count(t.children)&&console.warn("The global style component ".concat(s," was given child JSX. createGlobalStyle does not render children.")),"production"!==process.env.NODE_ENV&&o.some(function(e){return"string"==typeof e&&-1!==e.indexOf("@import")})&&console.warn("Please do not use @import CSS syntax in createGlobalStyle at this time, as the CSSOM APIs we use in production do not handle it well. Instead, we recommend using a library such as react-helmet to inject a typical <link> meta tag to the stylesheet, or simply embedding it manually in your index.html <head> section for a simpler app."),("undefined"==typeof window||!n.styleSheet.server)&&function(t,n,r,o,s){if(i.isStatic)i.renderStyles(t,S,r,s);else{var a=e.__assign(e.__assign({},n),{theme:j(n,o,u.defaultProps)});i.renderStyles(t,a,r,s)}}(l,t,n.styleSheet,r,n.stylis),v){var d=s+l,p="undefined"==typeof window?n.styleSheet.getTag().getGroup(P(d)):"";if(p)return c.default.createElement("style",{key:"".concat(s,"-").concat(l),"data-styled-global":s,children:p})}return null};return c.default.memo(u)},exports.css=ut,exports.default=pt,exports.isStyledComponent=le,exports.keyframes=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.");var o=pe(ut.apply(void 0,e.__spreadArray([t],n,!1))),s=Y(o);return new We(s,o)},exports.styled=pt,exports.useTheme=function(){var e=v?void 0:c.default.useContext(nt);if(!e)throw b(18);return e},exports.version=f,exports.withTheme=function(t){var n=c.default.forwardRef(function(n,r){var o=j(n,v?void 0:c.default.useContext(nt),t.defaultProps);return"production"!==process.env.NODE_ENV&&void 0===o&&console.warn('[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class "'.concat(W(t),'"')),c.default.createElement(t,e.__assign(e.__assign({},n),{theme:o,ref:r}))});return n.displayName="WithTheme(".concat(W(t),")"),ce(n,t)}; //# sourceMappingURL=styled-components.cjs.js.map