styled-components
Version:
CSS for the <Component> Age. Style components your way with speed, strong typing, and flexibility.
3 lines (2 loc) • 34.2 kB
JavaScript
import{__spreadArray as e,__assign as t}from"tslib";import n from"@emotion/is-prop-valid";import r,{createElement as o}from"react";import*as s from"stylis";import i from"@emotion/unitless";var a="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",c="active",u="data-styled-version",l="6.3.11",p="/*!sc*/\n",d="undefined"!=typeof window&&"undefined"!=typeof document,h=void 0===r.createContext,f=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),m={},y="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 v(){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 g(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(v.apply(void 0,e([y[t]],n,!1)).trim())}var S=1<<30,w=new Map,b=new Map,N=1,C=function(e){if(w.has(e))return w.get(e);for(;b.has(N);)N++;var t=N++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>S))throw g(16,"".concat(t));return w.set(e,t),b.set(t,e),t},E=function(e,t){N=t+1,w.set(e,t),b.set(t,e)},_=/invalid hook call/i,A=new Set,I=function(t,n){if("production"!==process.env.NODE_ENV){if(h)return;var o=n?' with the id of "'.concat(n,'"'):"",s="The component ".concat(t).concat(o," 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",i=console.error;try{var a=!0;console.error=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];_.test(t)?(a=!1,A.delete(s)):i.apply(void 0,e([t],n,!1))},"function"==typeof r.useState&&r.useState(null),a&&!A.has(s)&&(console.warn(s),A.add(s))}catch(e){_.test(e.message)&&A.delete(s)}finally{console.error=i}}},P=Object.freeze([]),O=Object.freeze({});function D(e,t,n){return void 0===n&&(n=O),e.theme!==n.theme&&e.theme||t||n.theme}var T=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"]),R=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,x=/(^-|-$)/g;function j(e){return e.replace(R,"-").replace(x,"")}var k=/(a)(d)/gi,M=function(e){return String.fromCharCode(e+(e>25?39:97))};function V(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=M(t%52)+n;return(M(t%52)+n).replace(k,"$1-$2")}var F,G=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},z=function(e){return G(5381,e)};function B(e){return V(z(e)>>>0)}function L(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function $(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var Y="function"==typeof Symbol&&Symbol.for,W=Y?Symbol.for("react.memo"):60115,q=Y?Symbol.for("react.forward_ref"):60112,H={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},U={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},J={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},X=((F={})[q]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},F[W]=J,F);function Z(e){return("type"in(t=e)&&t.type.$$typeof)===W?J:"$$typeof"in e?X[e.$$typeof]:H;var t}var K=Object.defineProperty,Q=Object.getOwnPropertyNames,ee=Object.getOwnPropertySymbols,te=Object.getOwnPropertyDescriptor,ne=Object.getPrototypeOf,re=Object.prototype;function oe(e,t,n){if("string"!=typeof t){if(re){var r=ne(t);r&&r!==re&&oe(e,r,n)}var o=Q(t);ee&&(o=o.concat(ee(t)));for(var s=Z(e),i=Z(t),a=0;a<o.length;++a){var c=o[a];if(!(c in U||n&&n[c]||i&&c in i||s&&c in s)){var u=te(t,c);try{K(e,c,u)}catch(e){}}}}return e}function se(e){return"function"==typeof e}function ie(e){return"object"==typeof e&&"styledComponentId"in e}function ae(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function ce(e,t){return e.join(t||"")}function ue(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function le(e,t,n){if(void 0===n&&(n=!1),!n&&!ue(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=le(e[r],t[r]);else if(ue(t))for(var r in t)e[r]=le(e[r],t[r]);return e}function pe(e,t){Object.defineProperty(e,"toString",{value:t})}var de=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 g(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)+p;return t},e}(),he="style[".concat(a,"][").concat(u,'="').concat(l,'"]'),fe=new RegExp("^".concat(a,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),me=function(e){return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot||"host"in e&&11===e.nodeType},ye=function(e){if(!e)return document;if(me(e))return e;if("getRootNode"in e){var t=e.getRootNode();if(me(t))return t}return document},ve=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)},ge=function(e,t){for(var n,r=(null!==(n=t.textContent)&&void 0!==n?n:"").split(p),o=[],s=0,i=r.length;s<i;s++){var a=r[s].trim();if(a){var c=a.match(fe);if(c){var u=0|parseInt(c[1],10),l=c[2];0!==u&&(E(l,u),ve(e,l,c[3]),e.getTag().insertRules(u,o)),o.length=0}else o.push(a)}}},Se=function(e){for(var t=ye(e.options.target).querySelectorAll(he),n=0,r=t.length;n<r;n++){var o=t[n];o&&o.getAttribute(a)!==c&&(ge(e,o),o.parentNode&&o.parentNode.removeChild(o))}};function we(){return"undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}var be=function(e){var t=document.head,n=e||t,r=document.createElement("style"),o=function(e){var t=Array.from(e.querySelectorAll("style[".concat(a,"]")));return t[t.length-1]}(n),s=void 0!==o?o.nextSibling:null;r.setAttribute(a,c),r.setAttribute(u,l);var i=we();return i&&r.setAttribute("nonce",i),n.insertBefore(r,s),r},Ne=function(){function e(e){this.element=be(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 g(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}(),Ce=function(){function e(e){this.element=be(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}(),Ee=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}(),_e=d,Ae={isServer:!d,useCSSOMInjection:!f},Ie=function(){function e(e,n,r){void 0===e&&(e=O),void 0===n&&(n={});var o=this;this.options=t(t({},Ae),e),this.gs=n,this.names=new Map(r),this.server=!!e.isServer,!this.server&&d&&_e&&(_e=!1,Se(this)),pe(this,function(){return function(e){for(var t=e.getTag(),n=t.length,r="",o=function(n){var o=function(e){return b.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 c=a+".g"+n+'[id="'+o+'"]',u="";s.forEach(function(e){e.length>0&&(u+=e+",")}),r+=i+c+'{content:"'+u+'"}'+p},s=0;s<n;s++)o(s);return r}(o)})}return e.registerId=function(e){return C(e)},e.prototype.rehydrate=function(){!this.server&&d&&Se(this)},e.prototype.reconstructWithOptions=function(n,r){void 0===r&&(r=!0);var o=new e(t(t({},this.options),n),this.gs,r&&this.names||void 0);return!this.server&&d&&n.target!==this.options.target&&ye(this.options.target)!==ye(n.target)&&Se(o),o},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new Ee(n):t?new Ne(n):new Ce(n)}(this.options),new de(e)));var e},e.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},e.prototype.registerName=function(e,t){C(e);var n=this.names.get(e);n?n.add(t):this.names.set(e,new Set([t]))},e.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(C(e),n)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(C(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e}(),Pe=/&/g,Oe=47,De=42;function Te(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!==Oe||e.charCodeAt(s+1)!==De)if(o)i===De&&e.charCodeAt(s+1)===Oe&&(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 Re(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=Re(e.children,t)),e})}function xe(e){var t,n,r,o=void 0===e?O:e,i=o.options,a=void 0===i?O:i,c=o.plugins,u=void 0===c?P:c,l=function(e,r,o){return o.startsWith(n)&&o.endsWith(n)&&o.replaceAll(n,"").length>0?".".concat(t):e},p=u.slice();p.push(function(e){e.type===s.RULESET&&e.value.includes("&")&&(r||(r=new RegExp("\\".concat(n,"\\b"),"g")),e.props[0]=e.props[0].replace(Pe,n).replace(r,l))}),a.prefix&&p.push(s.prefixer),p.push(s.stringify);var d=[],h=s.middleware(p.concat(s.rulesheet(function(e){return d.push(e)}))),f=function(e,o,i,c){void 0===o&&(o=""),void 0===i&&(i=""),void 0===c&&(c="&"),t=c,n=o,r=void 0;var u=function(e){if(!Te(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!==Oe||e.charCodeAt(a+1)!==De)if(i)c===De&&e.charCodeAt(a+1)===Oe&&(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 p=e.substring(r);Te(p)||(n+=p)}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===Oe&&o+1<t&&e.charCodeAt(o+1)===De){for(o+=2;o+1<t&&(e.charCodeAt(o)!==De||e.charCodeAt(o+1)!==Oe);)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===De&&o+1<t&&e.charCodeAt(o+1)===Oe)o>r&&n.push(e.substring(r,o)),r=o+=2;else if(a===Oe&&o+1<t&&e.charCodeAt(o+1)===Oe){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=s.compile(i||o?"".concat(i," ").concat(o," { ").concat(u," }"):u);return a.namespace&&(l=Re(l,a.namespace)),d=[],s.serialize(l,h),d};return f.hash=u.length?u.reduce(function(e,t){return t.name||g(15),G(e,t.name)},5381).toString():"",f}var je=new Ie,ke=xe(),Me={shouldForwardProp:void 0,styleSheet:je,stylis:ke},Ve=h?{Provider:function(e){return e.children},Consumer:function(e){return(0,e.children)(Me)}}:r.createContext(Me),Fe=Ve.Consumer,Ge=h?{Provider:function(e){return e.children},Consumer:function(e){return(0,e.children)(void 0)}}:r.createContext(void 0);function ze(){return h?Me:r.useContext(Ve)}function Be(e){if(h||!r.useMemo)return e.children;var t=ze().styleSheet,n=r.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]),o=r.useMemo(function(){return xe({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:e.stylisPlugins})},[e.enableVendorPrefixes,e.namespace,e.stylisPlugins]),s=r.useMemo(function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:n,stylis:o}},[e.shouldForwardProp,n,o]);return r.createElement(Ve.Provider,{value:s},r.createElement(Ge.Provider,{value:o},e.children))}var Le=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=ke);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,pe(this,function(){throw g(12,String(n.name))})}return e.prototype.getName=function(e){return void 0===e&&(e=ke),this.name+e.hash},e}();function $e(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||e in i||e.startsWith("--")?String(t).trim():"".concat(t,"px")}var Ye=function(e){return e>="A"&&e<="Z"};function We(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(1===n&&"-"===r&&"-"===e[0])return e;Ye(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var qe=function(e){return null==e||!1===e||""===e},He=function(t){var n=[];for(var r in t){var o=t[r];t.hasOwnProperty(r)&&!qe(o)&&(Array.isArray(o)&&o.isCss||se(o)?n.push("".concat(We(r),":"),o,";"):ue(o)?n.push.apply(n,e(e(["".concat(r," {")],He(o),!1),["}"],!1)):n.push("".concat(We(r),": ").concat($e(r,o),";")))}return n};function Ue(e,t,n,r,o){if(void 0===o&&(o=[]),"string"==typeof e)return e&&o.push(e),o;if(qe(e))return o;if(ie(e))return o.push(".".concat(e.styledComponentId)),o;if(se(e)){if(!se(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 Le||ue(s)||null===s||console.error("".concat(L(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.")),Ue(s,t,n,r,o)}var i;if(e instanceof Le)return n?(e.inject(n,r),o.push(e.getName(r))):o.push(e),o;if(ue(e)){for(var a=He(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++)Ue(e[c],t,n,r,o);return o}function Je(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(se(n)&&!ie(n))return!1}return!0}var Xe=z(l),Ze=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&Je(e),this.componentId=t,this.baseHash=G(Xe,t),this.baseStyle=n,Ie.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=ae(r,this.staticRulesId);else{var o=ce(Ue(this.rules,e,t,n)),s=V(G(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=ae(r,s),this.staticRulesId=s}else{for(var a=G(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=G(a,l));else if(l){var p=ce(Ue(l,e,t,n));a=G(G(a,String(u)),p),c+=p}}if(c){var d=V(a>>>0);if(!t.hasNameForId(this.componentId,d)){var h=n(c,".".concat(d),void 0,this.componentId);t.insertRules(this.componentId,d,h)}r=ae(r,d)}}return{className:r,css:"undefined"==typeof window?t.getTag().getGroup(C(this.componentId)):""}},e}(),Ke=h?{Provider:function(e){return e.children},Consumer:function(e){return(0,e.children)(void 0)}}:r.createContext(void 0),Qe=Ke.Consumer;function et(){var e=h?void 0:r.useContext(Ke);if(!e)throw g(18);return e}function tt(e){if(h)return e.children;var n=r.useContext(Ke),o=r.useMemo(function(){return function(e,n){if(!e)throw g(14);if(se(e)){var r=e(n);if("production"!==process.env.NODE_ENV&&(null===r||Array.isArray(r)||"object"!=typeof r))throw g(7);return r}if(Array.isArray(e)||"object"!=typeof e)throw g(8);return n?t(t({},n),e):e}(e.theme,n)},[e.theme,n]);return e.children?r.createElement(Ke.Provider,{value:o},e.children):null}var nt={},rt=new Set;function ot(s,i,a){var c=ie(s),u=s,p=!$(s),d=i.attrs,f=void 0===d?P:d,m=i.componentId,y=void 0===m?function(e,t){var n="string"!=typeof e?"sc":j(e);nt[n]=(nt[n]||0)+1;var r="".concat(n,"-").concat(B(l+n+nt[n]));return t?"".concat(t,"-").concat(r):r}(i.displayName,i.parentComponentId):m,v=i.displayName,g=void 0===v?function(e){return $(e)?"styled.".concat(e):"Styled(".concat(L(e),")")}(s):v,S=i.displayName&&i.componentId?"".concat(j(i.displayName),"-").concat(i.componentId):i.componentId||y,w=c&&u.attrs?u.attrs.concat(f).filter(Boolean):f,b=i.shouldForwardProp;if(c&&u.shouldForwardProp){var N=u.shouldForwardProp;if(i.shouldForwardProp){var E=i.shouldForwardProp;b=function(e,t){return N(e,t)&&E(e,t)}}else b=N}var _=new Ze(a,S,c?u.componentStyle:void 0);function A(s,i){return function(s,i,a){var c=s.attrs,u=s.componentStyle,l=s.defaultProps,p=s.foldedComponentIds,d=s.styledComponentId,f=s.target,m=h?void 0:r.useContext(Ke),y=ze(),v=s.shouldForwardProp||y.shouldForwardProp;"production"!==process.env.NODE_ENV&&r.useDebugValue&&r.useDebugValue(d);var g=D(i,m,l)||(h?void 0:O),S=function(e,n,r){for(var o,s=t(t({},n),{className:void 0,theme:r}),i=0;i<e.length;i+=1){var a=se(o=e[i])?o(s):o;for(var c in a)"className"===c?s.className=ae(s.className,a[c]):"style"===c?s.style=t(t({},s.style),a[c]):s[c]=a[c]}return"className"in n&&"string"==typeof n.className&&(s.className=ae(s.className,n.className)),s}(c,i,g),w=S.as||f,b={};for(var N in S)void 0===S[N]||"$"===N[0]||"as"===N||"theme"===N&&S.theme===g||("forwardedAs"===N?b.as=S.forwardedAs:v&&!v(N,w)||(b[N]=S[N],v||"development"!==process.env.NODE_ENV||n(N)||rt.has(N)||!T.has(w)||(rt.add(N),console.warn('styled-components: it looks like an unknown prop "'.concat(N,'" 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 E=function(e,t){var n=ze(),o=e.generateAndInjectStyles(t,n.styleSheet,n.stylis);return"production"!==process.env.NODE_ENV&&r.useDebugValue&&r.useDebugValue(o.className),o}(u,S),_=E.className;"production"!==process.env.NODE_ENV&&s.warnTooManyClasses&&s.warnTooManyClasses(_);var A=ae(p,d);_&&(A+=" "+_),S.className&&(A+=" "+S.className),b[$(w)&&!T.has(w)?"class":"className"]=A,a&&(b.ref=a);var I=o(w,b);if(h){for(var P=[],R=u,x=function(){var e=y.styleSheet.getTag().getGroup(C(R.componentId));if(e){var t="",n=y.styleSheet.names.get(R.componentId);n&&n.forEach(function(e){t&&(t+="_"),t+=e}),P.push(r.createElement("style",{key:"sc-".concat(R.componentId),precedence:"styled-components",href:"sc-".concat(R.componentId,"-").concat(t),children:e}))}R=R.baseStyle};R;)x();if(P.length)return P.reverse(),r.createElement.apply(r,e(e([r.Fragment,null],P,!1),[I],!1))}return I}(R,s,i)}A.displayName=g;var R=r.forwardRef(A);return R.attrs=w,R.componentStyle=_,R.displayName=g,R.shouldForwardProp=b,R.foldedComponentIds=c?ae(u.foldedComponentIds,u.styledComponentId):"",R.styledComponentId=S,R.target=c?u.target:s,Object.defineProperty(R,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=c?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++)le(e,o[r],!0);return e}({},u.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(I(g,S),R.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={}}}}(g,S)),pe(R,function(){return".".concat(R.styledComponentId)}),p&&oe(R,s,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),R}function st(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 it=function(e){return Object.assign(e,{isCss:!0})};function at(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(se(t)||ue(t))return it(Ue(st(P,e([t],n,!0))));var o=t;return 0===n.length&&1===o.length&&"string"==typeof o[0]?Ue(o):it(Ue(st(o,n)))}function ct(n,r,o){if(void 0===o&&(o=O),!r)throw g(1,r);var s=function(t){for(var s=[],i=1;i<arguments.length;i++)s[i-1]=arguments[i];return n(r,o,at.apply(void 0,e([t],s,!1)))};return s.attrs=function(e){return ct(n,r,t(t({},o),{attrs:Array.prototype.concat(o.attrs,e).filter(Boolean)}))},s.withConfig=function(e){return ct(n,r,t(t({},o),e))},s}var ut=function(e){return ct(ot,e)},lt=ut;T.forEach(function(e){lt[e]=ut(e)});var pt=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=Je(e),Ie.registerId(this.componentId+1)}return e.prototype.createStyles=function(e,t,n,r){var o=r(ce(Ue(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&&Ie.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}();function dt(n){for(var o=[],s=1;s<arguments.length;s++)o[s-1]=arguments[s];var i=at.apply(void 0,e([n],o,!1)),a="sc-global-".concat(B(JSON.stringify(i))),c=new pt(i,a);"production"!==process.env.NODE_ENV&&I(a);var u=new WeakMap,l=function(e){var n=ze(),o=h?void 0:r.useContext(Ke),s=u.get(n.styleSheet);if(void 0===s&&(s=n.styleSheet.allocateGSInstance(a),u.set(n.styleSheet,s)),"production"!==process.env.NODE_ENV&&r.Children.count(e.children)&&console.warn("The global style component ".concat(a," was given child JSX. createGlobalStyle does not render children.")),"production"!==process.env.NODE_ENV&&i.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(e,n,r,o,s){if(c.isStatic)c.renderStyles(e,m,r,s);else{var i=t(t({},n),{theme:D(n,o,l.defaultProps)});c.renderStyles(e,i,r,s)}}(s,e,n.styleSheet,o,n.stylis),h){var p=a+s,d="undefined"==typeof window?n.styleSheet.getTag().getGroup(C(p)):"";if(d)return r.createElement("style",{key:"".concat(a,"-").concat(s),"data-styled-global":a,children:d})}return null};return r.memo(l)}function ht(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=ce(at.apply(void 0,e([t],n,!1))),s=B(o);return new Le(s,o)}function ft(e){var n=r.forwardRef(function(n,o){var s=D(n,h?void 0:r.useContext(Ke),e.defaultProps);return"production"!==process.env.NODE_ENV&&void 0===s&&console.warn('[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class "'.concat(L(e),'"')),r.createElement(e,t(t({},n),{theme:s,ref:o}))});return n.displayName="WithTheme(".concat(L(e),")"),oe(n,e)}var mt=/^\s*<\/[a-z]/i,yt=function(){function e(){var e=this;this._emitSheetCSS=function(){var t=e.instance.toString();if(!t)return"";var n=we(),r=ce([n&&'nonce="'.concat(n,'"'),"".concat(a,'="true"'),"".concat(u,'="').concat(l,'"')].filter(Boolean)," ");return"<style ".concat(r,">").concat(t,"</style>")},this.getStyleTags=function(){if(e.sealed)throw g(2);return e._emitSheetCSS()},this.getStyleElement=function(){var n;if(e.sealed)throw g(2);var o=e.instance.toString();if(!o)return[];var s=((n={})[a]="",n[u]=l,n.dangerouslySetInnerHTML={__html:o},n),i=we();return i&&(s.nonce=i),[r.createElement("style",t({},s,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new Ie({isServer:!0}),this.sealed=!1}return e.prototype.collectStyles=function(e){if(this.sealed)throw g(2);return r.createElement(Be,{sheet:this.instance},e)},e.prototype.interleaveWithNodeStream=function(e){if(this.sealed)throw g(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(),mt.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")},e}(),vt={StyleSheet:Ie,mainSheet:je};"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 gt="__sc-".concat(a,"__");"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window[gt]||(window[gt]=0),1===window[gt]&&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[gt]+=1);export{yt as ServerStyleSheet,Fe as StyleSheetConsumer,Ve as StyleSheetContext,Be as StyleSheetManager,Qe as ThemeConsumer,Ke as ThemeContext,tt as ThemeProvider,vt as __PRIVATE__,dt as createGlobalStyle,at as css,lt as default,ie as isStyledComponent,ht as keyframes,lt as styled,et as useTheme,l as version,ft as withTheme};
//# sourceMappingURL=styled-components.esm.js.map